# @types/oja

> TypeScript definitions for oja

Latest version **1.1.5** (published 2023-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/oja
pnpm add @types/oja
yarn add @types/oja
bun add @types/oja
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2023-11-21 |
| First published | 2018-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/oja
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/oja
- npm.io page: https://npm.io/package/@types/oja

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 1.1.5 (latest) — 2023-11-21
- 1.1.2 (ts4.3) — 2023-09-03
- 1.1.1 (ts2.2) — 2019-10-15
- 1.1.4 — 2023-11-07
- 1.1.3 — 2023-10-18
- 1.1.0 — 2018-08-25

## README

# Installation
> `npm install --save @types/oja`

# Summary
This package contains type definitions for oja (https://github.com/dimichgh/oja#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/oja.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/oja/index.d.ts)
````ts
/// <reference types="node" />

import { EventEmitter } from "events";
import { Readable } from "stream";
export type ConsumerCallback = (payload: any, runtime: Flow) => void;

export type Primitive =
    | boolean
    | number
    | string
    | symbol
    | null
    | undefined;

export interface State {
    queue: string[];
    pending: string[];
}

export type DefinitionFunction = (publisher: StageContext, runtime: Flow) => any;

export type AddableFunction = (runtime: Flow) => void;
export type AddableToAction = Action | AddableFunction;

export class EventContext {
    constructor(context: EventContext | object);
    stageContext(topics: string | readonly string[]): StageContext;
    state(): State;
    repub(type: string, handler: (event: any) => void): void;
    on(type: string, handler: (event: any) => void): this;
    once(type: string, handler: (event: any) => void): this;
    emit(name: string, value: any): this;
    get(name: string): any;
}

export class StageContext extends EventContext {
    pub(data: any): void;
}

export class ReadableStream extends Readable {
    constructor(topic: string, emitter: EventEmitter);
    push(data: any): boolean;
}

export class Flow {
    constructor(baseFlow?: Flow);
    consume(topic: string | readonly string[], callback: ConsumerCallback): this;
    consume(topic: string): Promise<any>;
    consume(
        topics: readonly string[],
    ): Promise<{
        [key: string]: string;
    }>;
    consumeStream(
        topic: string,
        callback: (stream: ReadableStream) => void,
    ): this;
    consumeStream(topic: string): ReadableStream;
    getReader(
        topic: string,
    ): {
        next(): Promise<any>;
    };
    define(topics: string | readonly string[]): StageContext;
    define(
        topic: string,
        data: Promise<Primitive> | DefinitionFunction | object | Primitive,
    ): this;
    catch(callback: (err: any) => void): this;
    timeout(topics: string | readonly string[], ms: number): this;
    state(): State;
}

export class Action extends Flow {
    constructor();
    activate(): this;
    execute(): void;
    add(...child: AddableToAction[]): this;
}

export class FunctionAction extends Action {
    constructor(callback: (runtime: FunctionAction) => any);
    execute(): any;
}

````

### Additional Details
 * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Laurens Stötzel](https://github.com/buffcode).

---
_Source: https://npm.io/package/@types/oja · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
