import { Result } from './result.js'; /** * Options for async retry decorator. */ export interface RetryOptions { /** Maximum number of attempts (default: 3) */ maxAttempts?: number; /** Initial delay in milliseconds (default: 1000) */ initialDelay?: number; /** Maximum delay in milliseconds (default: 10000) */ maxDelay?: number; /** Exponential backoff base (default: 2.0) */ exponentialBase?: number; /** HTTP status codes to retry on (default: [429, 500, 502, 503, 504]) */ retryOnStatus?: number[]; /** Whether to retry on network errors (default: true) */ retryOnNetworkError?: boolean; /** * Exception constructors that trigger a retry even when HTTP status / network * heuristics do not match. */ retryOnExceptions?: Array unknown>; } /** * Async retry decorator for functions. * Wraps an async function with retry logic using exponential backoff. * * @param fn - The async function to wrap * @param options - Retry configuration options * @returns Wrapped function that retries on failure * * @example * const fetchWithRetry = asyncRetry( * async () => fetch('https://api.example.com/data'), * { maxAttempts: 3, initialDelay: 1000 } * ); */ export declare function asyncRetry Promise>(fn: T, options?: RetryOptions): T; /** * Async retry decorator that returns Result instead of throwing. * * @param fn - The async function to wrap * @param options - Retry configuration options * @returns Wrapped function that returns Result * * @example * const fetchWithRetry = asyncRetryResult( * async () => fetch('https://api.example.com/data').then(r => r.json()), * { maxAttempts: 3 } * ); * const result = await fetchWithRetry(); * if (result.success) { * console.log(result.data); * } */ export declare function asyncRetryResult(fn: (...args: any[]) => Promise, options?: RetryOptions): (...args: any[]) => Promise>; //# sourceMappingURL=retry.d.ts.map