import type { RetryConfig } from '../types.ts'; import type { FetchPlugin } from '../engine/types.ts'; /** * Merges a per-call retry override over a base retry config, the same way * for every caller — the retry plugin's execute hook and the executor's * response metadata both resolve through this so the reported `res.config.retry` * can never drift from the config the request actually ran with. * * Per-call retry wins in both directions: it can remove retries from a * retrying engine and re-enable them on a `retry: false` engine. `false`/ * `true` per-call values are expected already normalized upstream to * `{ maxAttempts: 0 }` / `{}` (executor.makeRequestOptions). * * @param baseConfig - The engine/plugin's current base retry config * @param perCallRetry - The current request's normalized per-call retry override, if any */ export declare function resolveRetryConfig(baseConfig: RetryConfig | false | undefined, perCallRetry: RetryConfig | undefined): Required; /** * Factory function that creates a retry plugin for FetchEngine. * * The plugin installs an `execute` (pipe) hook at priority `-20` that * wraps the core request function in a retry loop with exponential backoff. * * @param defaultConfig - Default retry configuration for the engine * @returns FetchPlugin that can be installed via `engine.use()` or `plugins` config * * @example * const api = new FetchEngine({ * baseUrl: 'https://api.example.com', * plugins: [ * retryPlugin({ maxAttempts: 3, baseDelay: 1000 }) * ] * }); */ export declare function retryPlugin(defaultConfig?: RetryConfig | false): FetchPlugin;