/** * Async Utilities for qtests * * Provides comprehensive async/await utilities, timeout handling, * retry logic, and flow control utilities for async operations. */ export interface AsyncOptions { timeout?: number; retries?: number; delay?: number; backoff?: boolean; maxBackoff?: number; } export interface BatchOptions { concurrency?: number; timeout?: number; onSuccess?: (result: T, index: number) => void; onError?: (error: Error, index: number) => void; } export interface WorkflowStep { name: string; action: (data?: any) => Promise; timeout?: number; retries?: number; dependencies?: string[]; condition?: (data: any) => boolean; } export interface WorkflowResult { results: Record; steps: string[]; duration: number; success: boolean; errors?: Record; } declare const asyncConfig: { defaultTimeout: number; defaultRetries: number; concurrency: number; slowThreshold: number; }; /** * Create a timeout promise */ export declare const createTimeout: (ms: number, reason?: string) => Promise; /** * Wait for specified time */ export declare const wait: (ms: number) => Promise; /** * Execute with timeout */ export declare const withTimeout: (operation: () => Promise, timeoutMs: number, reason?: string) => Promise; /** * Execute with retries */ export declare const withRetries: (operation: () => Promise, options: AsyncOptions, context: string) => Promise; /** * Execute with timeout and retries */ export declare const withTimeoutAndRetries: (operation: () => Promise, options?: AsyncOptions, context?: string) => Promise; /** * Execute multiple operations in parallel */ export declare const parallel: (operations: Array<() => Promise>, options?: BatchOptions) => Promise; /** * Execute operations sequentially */ export declare const sequential: (operations: Array<() => Promise>, context?: string) => Promise; /** * Wait for condition to be true */ export declare const waitForCondition: (condition: () => boolean | Promise, options?: AsyncOptions) => Promise; /** * Execute with callback pattern */ export declare const executeWithCallback: (operation: (callback: (error?: Error, result?: T) => void) => void) => Promise; /** * Create debounced function */ export declare const debounce: any>(func: T, delayMs: number) => ((...args: Parameters) => void); /** * Create throttled function */ export declare const throttle: any>(func: T, delayMs: number) => ((...args: Parameters) => void); /** * Execute workflow steps */ export declare const executeWorkflow: (steps: WorkflowStep[], context?: any) => Promise>; /** * Race multiple operations */ export declare const race: (operations: Array<() => Promise>, options?: { timeout?: number; }) => Promise<{ result: T; index: number; winner: string; }>; /** * Configure async utilities */ export declare const configure: (options: Partial) => void; /** * Get current configuration */ export declare const getConfig: () => { defaultTimeout: number; defaultRetries: number; concurrency: number; slowThreshold: number; }; export {}; //# sourceMappingURL=asyncUtils.d.ts.map