/** Options for {@link retryWithBackoff}. */ export interface RetryOptions { /** Total number of attempts (first try + retries). Must be at least 1. */ maxAttempts: number; /** Delay before the first retry (milliseconds). */ delayMs: number; /** Multiplier applied to the delay after each retry (default `1` = fixed delay). */ backoffMultiplier?: number; /** Upper bound on the computed delay (milliseconds). Only meaningful when `backoffMultiplier` is greater than 1. */ maxDelayMs?: number; /** * Called before sleeping between retries. Return `false` to stop retrying and * rethrow the error immediately (fail-fast for non-transient failures). When * omitted, every error is retried up to `maxAttempts` times. */ shouldRetry?: (error: unknown) => boolean; /** Called after each failed attempt, before the backoff sleep. */ onRetry?: (attempt: number, error: unknown) => void | Promise; /** Override the sleep implementation (primarily for testing). */ sleep?: (ms: number) => Promise; } /** * Execute `operation` up to {@link RetryOptions.maxAttempts} times, sleeping * with optional exponential backoff between failures. * * @throws The error from the last failed attempt when all attempts are exhausted, * or immediately when `shouldRetry` returns `false`. */ export declare function retryWithBackoff(operation: () => Promise, options: RetryOptions): Promise; //# sourceMappingURL=retry.d.ts.map