export type RetryOptions = { /** Total attempts including the first. Default 4 (1 try + up to 3 retries). */ maxAttempts?: number; /** Delay before the first retry; doubles each subsequent attempt. */ baseDelayMs?: number; /** Ceiling on the pre-jitter backoff delay. */ maxDelayMs?: number; /** Injectable for tests — defaults to a real timer-based sleep. */ sleepFn?: (ms: number) => Promise; /** Called before each retry's sleep, e.g. to log a warning. */ onRetry?: (attempt: number, delayMs: number, reason: string) => void; /** * Per-attempt timeout. Applied fresh to each attempt, since a signal that * already fired would abort every retry instantly. Without it a host that * silently drops packets (rather than refusing) leaves each attempt waiting * on the OS TCP timeout — minutes, multiplied by `maxAttempts`, which is * long enough to stall a cloud environment's setup script. */ timeoutMs?: number; }; /** * Fetch with bounded retry + exponential backoff, retrying only on transport * failures (network error, timeout) and 5xx responses — a 4xx means the * request itself is wrong and retrying it would just fail the same way * again. Returns the final `Response` even when it's still non-ok once * attempts are exhausted, so the caller's existing `!response.ok` handling * keeps working unchanged; re-throws the last transport error if every * attempt failed without ever getting a response. */ export declare function fetchWithRetry(fetchImpl: typeof fetch, url: string, init: RequestInit, options?: RetryOptions): Promise; //# sourceMappingURL=http-retry.d.ts.map