import { AxiosInstance, AxiosResponse } from 'axios'; declare module 'axios' { interface AxiosRequestConfig { /** * Opts a mutating request (POST/PUT/PATCH/DELETE) into transient-error * retries. Only set this on endpoints known to be idempotent: a mutation * that received a gateway error may still have been applied upstream, and * a retry would apply it again. * * Only honored by the shared REST instance created in api.ts — bare * axios calls (e.g. presigned-URL asset downloads) register no retry * interceptor, so the flag is inert there. * * Do not combine with a custom transformRequest: a retry replays the * already-transformed body through the transform again, and reuses the * previous attempt's Content-Length header, so a non-idempotent or * length-changing transform silently corrupts or truncates the body on * the wire. (The default JSON transform is idempotent, and * stream-producing transforms are blocked by the stream-body guard.) */ checklyRetry?: boolean; /** Internal: attempts already made for this logical request. */ checklyRetryAttempt?: number; } } export interface RetryOptions { /** Total attempts including the initial request. */ attempts?: number; /** Base delay for exponential backoff, in milliseconds. */ baseDelayMs?: number; /** Cap for a single jittered backoff delay, in milliseconds. */ maxBackoffDelayMs?: number; /** Largest server-provided Retry-After honored verbatim, in milliseconds. */ maxRetryAfterMs?: number; /** * Overridable in tests to avoid real sleeps. The abort signal fires when * the wait is abandoned early; a sleep should cancel its timer then. */ sleep?: (ms: number, abortSignal?: AbortSignal) => Promise; /** Overridable in tests to make jitter deterministic. */ random?: () => number; } /** * Parses a Retry-After header value (delay-seconds or HTTP-date) into a * delay in milliseconds, or undefined if the value is absent or malformed. */ export declare function parseRetryAfter(value: unknown): number | undefined; /** * Creates an axios response rejection handler that retries transient upstream * failures with bounded, jittered exponential backoff. Register it before the * error-mapping interceptor so it sees the raw AxiosError; a successful retry * resolves into the next interceptor's fulfilled handler, and an exhausted * one rethrows into its rejection handler. */ export declare function createRetryInterceptor(api: AxiosInstance, options?: RetryOptions): (error: unknown) => Promise;