/** * Retry utility with exponential backoff and jitter. * * Features: * - Exponential backoff with random jitter * - Configurable max retries * - Retry on specific status codes and network errors * - Respect Retry-After header from 429 responses * - Progress callback for logging */ export interface RetryOptions { /** * Maximum number of retry attempts (default: 3) */ maxRetries?: number; /** * Initial delay in milliseconds before first retry (default: 1000) */ initialDelayMs?: number; /** * Maximum delay in milliseconds (default: 30000) */ maxDelayMs?: number; /** * HTTP status codes that should trigger a retry (default: [429, 503, 504]) */ retryableStatusCodes?: number[]; /** * Callback invoked before each retry attempt * @param attempt - Current attempt number (1-indexed) * @param error - The error that triggered the retry * @param delayMs - Calculated delay before retry in milliseconds */ onRetry?: (attempt: number, error: Error, delayMs: number) => void; } /** * Retry an async operation with exponential backoff. * * @param operation - Async function to retry * @param options - Retry configuration options * @returns Promise resolving to operation result * @throws Last error if all retries exhausted * * @example * ```typescript * const result = await retryWithBackoff( * () => fetchClient.get('/api/resource'), * { * maxRetries: 3, * onRetry: (attempt, error, delay) => { * console.log(`Retry ${attempt} after ${delay}ms: ${error.message}`); * } * } * ); * ``` */ export declare function retryWithBackoff(operation: () => Promise, options?: RetryOptions): Promise; //# sourceMappingURL=retryWithBackoff.d.ts.map