durabull
Version:
A durable workflow engine built on top of BullMQ and Redis
22 lines (21 loc) • 772 B
TypeScript
import { Workflow } from '../Workflow';
import { WorkflowRecord, HistoryEvent } from './history';
export interface WorkflowExecutionContext {
workflowId: string;
workflow: Workflow<any, any>;
record: WorkflowRecord;
history?: {
events: HistoryEvent[];
cursor: number;
};
isResume: boolean;
clockCursor: number;
timerCursor: number;
sideEffectCursor: number;
activityCursor: number;
childWorkflowCursor: number;
eventIndex?: Map<string, HistoryEvent>;
}
export declare function getWorkflowContext(): WorkflowExecutionContext | undefined;
export declare function runInWorkflowContext<T>(ctx: WorkflowExecutionContext, fn: () => T): T;
export declare const getVirtualTimestamp: (workflowId?: string) => number;