import { IPolicy } from 'polly-ts-core'; /** * Options for configuring pollyFetch. */ interface PollyFetchOptions { /** * Predicate to determine if a response should be treated as a failure. * If true, an HTTPError will be thrown, triggering policy failure handling. * Default: Returns true for status 429 and 5xx. */ shouldFail?: (response: Response) => boolean; } /** * Custom error class for HTTP failures. */ declare class HttpError extends Error { readonly response: Response; constructor(response: Response, message?: string); } /** * Wraps the global fetch function (or any custom fetch) with a Polly policy. * * @param policy The policy to wrap the fetch call with. * @param options Configuration options. * @returns A decorated fetch function. */ declare function pollyFetch(policy: IPolicy, options?: PollyFetchOptions): (input: RequestInfo | URL, init?: RequestInit) => Promise; export { HttpError, type PollyFetchOptions, pollyFetch };