@moostjs/event-wf
Version:
38 lines (34 loc) • 1.81 kB
TypeScript
import { TWorkflowSchema, TWorkflowSpy, TFlowOutput } from '@prostojs/wf';
export { StepRetriableError, TFlowOutput, TWorkflowSchema } from '@prostojs/wf';
import { WooksWf, TWooksWfOptions } from '@wooksjs/event-wf';
export { useWFContext, useWfState } from '@wooksjs/event-wf';
import { TMoostAdapter, Moost, TMoostAdapterOptions } from 'moost';
declare function Step(path?: string): MethodDecorator;
declare function Workflow(path?: string): MethodDecorator;
declare function WorkflowSchema<T>(schema: TWorkflowSchema<T>): MethodDecorator;
declare const WorkflowParam: (name: 'resume' | 'indexes' | 'schemaId' | 'stepId' | 'context' | 'input' | 'state') => ParameterDecorator & PropertyDecorator;
interface TWfHandlerMeta {
path: string;
}
declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta> {
protected opts?: WooksWf<T, IR> | TWooksWfOptions | undefined;
private readonly debug?;
readonly name = "workflow";
protected wfApp: WooksWf<T, IR>;
constructor(opts?: WooksWf<T, IR> | TWooksWfOptions | undefined, debug?: boolean | undefined);
onNotFound(): Promise<unknown>;
protected moost?: Moost;
protected toInit: Array<() => void>;
onInit(moost: Moost): void;
getWfApp(): WooksWf<T, IR>;
attachSpy<I>(fn: TWorkflowSpy<T, I, IR>): () => void;
detachSpy<I>(fn: TWorkflowSpy<T, I, IR>): void;
start<I>(schemaId: string, initialContext: T, input?: I): Promise<TFlowOutput<T, I, IR>>;
resume<I>(state: {
schemaId: string;
context: T;
indexes: number[];
}, input?: I): Promise<TFlowOutput<T, I, IR>>;
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<TWfHandlerMeta, T>): void;
}
export { MoostWf, Step, type TWfHandlerMeta, Workflow, WorkflowParam, WorkflowSchema };