import { WorkflowContext } from './context.types'; import { ErrorHandler } from './error-handler.types'; import { PersistenceAdapter, LockAdapter, LoggerAdapter } from './adapter.types'; import { IWorkflowPlugin } from './plugin.types'; import { IState } from './state.types'; export declare enum ConcurrencyMode { SEQUENTIAL = "sequential", PARALLEL = "parallel", THROTTLE = "throttle" } export interface ConcurrencyConfig = Record> { groupBy: string | ((context: WorkflowContext) => string); mode: ConcurrencyMode; maxConcurrentAfterUnlock?: number; } export interface TransitionConfig { from: TState | TState[]; to: TState; condition?: (context: WorkflowContext) => boolean | Promise; } export interface ConditionalTransition { from: TState; conditions: Array<{ condition: (context: WorkflowContext) => boolean | Promise; to: TState; virtualOutputs?: Partial any | Promise)>>; }>; default?: TState; defaultVirtualOutputs?: Partial any | Promise)>>; } export interface WorkflowMetadataConfig { name: string; states: Record; initialState: TState; concurrency?: ConcurrencyConfig; transitions?: TransitionConfig[]; conditionalTransitions?: ConditionalTransition[]; errorHandler?: ErrorHandler | (new (...args: any[]) => ErrorHandler); stateHandlers?: StateHandler[]; } /** * A state handler bound to a workflow. Declaring handlers on the workflow scopes their * lookup to that workflow, so two workflows may reuse the same state value safely. */ export type StateHandler = (new (...args: any[]) => IState) | IState; export interface WorkflowLifecycleHooks = Record, TOutputs extends Record = Record> { onStart?: (context: WorkflowContext) => Promise | void; onComplete?: (context: WorkflowContext) => Promise | void; onError?: (context: WorkflowContext, error: Error) => Promise | void; beforeState?: (context: WorkflowContext) => Promise | void; afterState?: (context: WorkflowContext) => Promise | void; } export interface WorkflowConfigOptions { persistence?: PersistenceAdapter | (new (...args: any[]) => PersistenceAdapter); lockAdapter?: LockAdapter | (new (...args: any[]) => LockAdapter); logger?: LoggerAdapter | (new (...args: any[]) => LoggerAdapter); plugins?: Array IWorkflowPlugin)>; } //# sourceMappingURL=workflow.types.d.ts.map