export interface RetryOptions { /** Max retry attempts (default: 3) */ maxRetries?: number; /** Initial delay in ms (default: 100) */ initialDelay?: number; /** Max delay in ms (default: 5000) */ maxDelay?: number; /** Exponential backoff multiplier (default: 2) */ backoffMultiplier?: number; /** Add jitter to delays (default: true) */ jitter?: boolean; /** Only retry these error codes (default: retry all retryable errors) */ retryOn?: string[]; /** Custom retry condition */ shouldRetry?: (error: Error, attempt: number) => boolean; /** Callback on each retry */ onRetry?: (error: Error, attempt: number, delay: number) => void; } /** Check if an error is retryable */ export declare function isRetryable(error: Error): boolean; /** Calculate delay for next retry with exponential backoff */ export declare function calculateDelay(attempt: number, options: Required>): number; /** * Execute a function with automatic retries on failure. * * @param fn - Function to execute * @param options - Retry options * @returns Result of the function * @throws Last error after all retries exhausted * * @example * ```typescript * const result = await withRetry( * () => client.push('queue', data), * { maxRetries: 3, onRetry: (err, attempt) => console.log(`Retry ${attempt}`) } * ); * ``` */ export declare function withRetry(fn: () => Promise, options?: RetryOptions): Promise; /** * Create a retryable version of a function. * * @param fn - Function to wrap * @param options - Retry options * @returns Wrapped function with retry logic * * @example * ```typescript * const retryablePush = retryable( * (queue: string, data: any) => client.push(queue, data), * { maxRetries: 3 } * ); * await retryablePush('emails', { to: 'user@example.com' }); * ``` */ export declare function retryable(fn: (...args: TArgs) => Promise, options?: RetryOptions): (...args: TArgs) => Promise; /** * Retry configuration presets */ export declare const RetryPresets: { /** Quick retries for interactive operations */ fast: RetryOptions; /** Standard retries for most operations (uses SDK defaults) */ standard: RetryOptions; /** Aggressive retries for critical operations */ aggressive: RetryOptions; /** No retries */ none: RetryOptions; }; //# sourceMappingURL=retry.d.ts.map