import { RetryOptions } from "../types/index.mjs"; //#region src/promise/retry.d.ts /** * Retries a function until it succeeds or max attempts are reached. * * @template T - The type of the resolved value * @param fn - The function to retry (can be async or return a promise) * @param options - The options object * @param options.maxAttempts - Maximum number of attempts (default: 3) * @param options.delay - Delay between attempts in milliseconds (default: 1000) * @param options.backoff - Backoff multiplier for exponential backoff (default: 1, no backoff) * @param options.onRetry - Callback function called on each retry with the attempt number and error * @param options.signal - Optional AbortSignal that cancels remaining attempts when aborted * @returns Returns a promise that resolves with the function result or rejects with the last error * * @example * const result = await retry(() => fetchData(), { maxAttempts: 5, delay: 1000 }); * * @example * const result = await retry(() => fetchData(), { * maxAttempts: 5, * delay: 1000, * backoff: 2, // exponential backoff * onRetry: (attempt, error) => console.log(`Attempt ${attempt} failed: ${error.message}`) * }); */ declare function retry(fn: () => T | Promise, options?: RetryOptions): Promise; //#endregion export { retry }; //# sourceMappingURL=retry.d.mts.map