import { BaseError } from 'make-error'; import { type RequestWithTimeout } from './fetch.type'; export declare class FetchTimeoutError extends BaseError { readonly response: Response; readonly timeout: number; constructor(response: Response, timeout: number); } /** * Clones a request and keeps its non-standard `timeout`, which `Request.clone()` drops. * * A fetch handler that sends a clone (the rate limiter sends one per attempt) uses this so that {@link fetchTimeout} * still sees the timeout the request factory put on the request — including a per-request value, which wins over the * configured default. * * @param request - The request to clone. * @returns The clone, carrying the same `timeout` (0 included) when the request had one. */ export declare function cloneRequestWithTimeout(request: Request): RequestWithTimeout; /** * Wraps a fetch function to add automatic timeout/abort support. If a timeout value is present on the * RequestInit or Request, the request is aborted after that many milliseconds without a response. A timeout * of 0 disables it. * * An abort signal the caller already set (on the RequestInit, or on the Request itself) keeps working: the * request aborts on whichever comes first, the caller's signal or the timeout. * * The timeout covers the wait for the response (its headers). Reading the body afterwards is not timed out; * abort the caller's signal for that. * * A fetch handler that sends a clone of the request must clone it with {@link cloneRequestWithTimeout}; a plain * `Request.clone()` loses the timeout. * * @param inputFetch - The fetch function to wrap with timeout behavior. * @returns A wrapped fetch function that enforces timeouts via AbortController. */ export declare function fetchTimeout(inputFetch: typeof fetch): typeof fetch;