import { type IStream } from '../../stream/index.js'; export interface IRecoverConfig { /** Minimum interval between retries, in ms. Default 10 seconds. */ recoverTime?: number; /** Optional transform applied to the source before re-running, given the * delay until the next attempt fires. Useful e.g. to re-create a fetch * with backoff-aware metadata. */ recoverWith?: (source: IStream, delayMs: number) => IStream; /** Internal: timestamp (scheduler time) of the last attempt. Set * automatically on recursion; callers should leave this unset. */ lastRuntime?: number; } export interface IRecoverCurry { (config: IRecoverConfig, s: IStream): IStream; (config: IRecoverConfig): (s: IStream) => IStream; } /** * On stream end, re-subscribe to the source — but throttle so attempts are * spaced at least `recoverTime` ms apart. If the previous run lasted longer * than `recoverTime`, the next attempt fires immediately; otherwise it is * deferred via `at()` so the scheduler holds the gap. * * source: -a-b| * recover({recoverTime}): -a-b- ... wait ... -a-b- ... */ export declare const recover: IRecoverCurry;