import { EventEmitter } from 'events'; /** * Simple Flow Engine - Easy integration with any Node.js backend */ export interface FlowStep { id: string; handler: (data: any, context: FlowContext) => Promise; dependencies?: string[]; retries?: number; timeout?: number; } export interface FlowContext { executionId: string; startTime: number; variables: Record; metadata: Record; } export interface FlowResult { success: boolean; data: any; error?: string; executionTime: number; steps: string[]; metadata: Record; } export declare class SimpleFlowEngine extends EventEmitter { private steps; private stepOrder; private commonPayload; private middleware; constructor(); /** * Set common payload/data that will be available to all steps */ setCommonPayload(payload: any): this; /** * Add middleware that runs before each step */ use(middleware: (data: any, context: FlowContext) => Promise): this; /** * Add a step to the workflow */ step(id: string, handler: (data: any, context: FlowContext) => Promise, options?: { retries?: number; timeout?: number; dependencies?: string[]; }): this; /** * Execute the workflow */ execute(inputData?: any): Promise; /** * Execute with timeout */ private executeWithTimeout; /** * Delay utility */ private delay; /** * Get workflow info */ getInfo(): { steps: string[]; stepOrder: string[]; hasCommonPayload: boolean; middlewareCount: number; }; /** * Clear all steps */ clear(): this; } /** * Factory function for creating flows */ export declare function createFlow(): SimpleFlowEngine; /** * Express middleware integration */ export declare function expressFlow(flow: SimpleFlowEngine): (req: any, res: any, next: any) => Promise; /** * Fastify plugin integration */ export declare function fastifyFlow(flow: SimpleFlowEngine): (request: any, reply: any) => Promise; //# sourceMappingURL=SimpleFlowEngine.d.ts.map