export interface SingleflightOptions { /** Last-resort age after which a never-settling leader may be replaced. */ staleAfterMs?: number; /** Called after this exact leader is evicted as stale. */ onStaleEvicted?: () => void; /** Maximum callers that may join an existing leader. */ maxFollowers?: number; /** Lets this caller detach without cancelling other callers. */ signal?: AbortSignal; /** Cancels the shared operation after its final caller detaches. */ cancelWhenUnobserved?: boolean; } export declare class SingleflightFollowerLimitError extends Error { constructor(); } export interface SingleflightControl { /** Whether this operation is still the exact leader registered for its key. */ isCurrent(): boolean; /** Shared cancellation that fires only after every caller detaches. */ signal: AbortSignal; } /** * Wait for shared work while allowing this caller to detach independently. * Aborting `signal` rejects only this waiter; it never cancels `shared`. */ export declare function waitForSharedPromise(shared: Promise, signal?: AbortSignal): Promise; export declare class Singleflight { private inflight; private waitForEntry; do(key: string, operation: (control: SingleflightControl) => Promise, options?: SingleflightOptions): Promise; has(key: string): boolean; /** Allow a replacement leader while the forgotten operation finishes independently. */ forget(key: string): boolean; get size(): number; } //# sourceMappingURL=singleflight.d.ts.map