/** * Saga Pattern - Distributed transaction orchestration with compensation */ import { Logger } from "../types/common"; import { SagaOptions, SagaResult, SagaStep } from "../types/saga"; /** * Internal options for saga execution (without context and steps) */ interface SagaInternalOptions { logger?: Logger; onStepStart?: (stepName: string, index: number) => void; onStepComplete?: (stepName: string, result: unknown) => void; onStepFailed?: (stepName: string, error: Error) => void; onCompensate?: (stepName: string) => void; onComplete?: (context: TContext) => void; onFailure?: (error: Error, context: TContext) => void; } /** * Saga - Distributed transaction orchestrator */ export declare class Saga { private steps; private context; private logger; private options; constructor(initialContext: TContext, options?: SagaInternalOptions); /** * Add a step to the saga */ addStep(step: SagaStep): this; /** * Add multiple steps */ addSteps(steps: SagaStep[]): this; /** * Execute the saga */ execute(): Promise>; /** * Compensate executed steps (in reverse order) */ private compensate; /** * Execute function with timeout */ private executeWithTimeout; /** * Get current context */ getContext(): TContext; /** * Update context */ updateContext(updates: Partial): void; } /** * Execute a saga with single parameter API */ export declare function executeSaga(options: SagaOptions): Promise>; export {}; //# sourceMappingURL=saga.d.ts.map