/** * `singleFlight` / `memoizeAsync` — in-flight promise coalescing. * * The fleet hand-rolls this shape at least nine times: honeybook's * `apiVersionPromise` (self-clearing memoized fetch), infinitecampus's * `loginInFlight`, onehome's `capturePromise`, vibo's `loginInFlight` + * `reauthInFlight`, alltrails's `ensureApiKey`/`bridgeReady`, tripadvisor's * `bridgeReady`, artsonia's `ensureStarted`, and redfin's promise-caching * `LocalityPoolCache`. Two primitives cover all of them: * * - {@link singleFlight} — one shared in-flight promise, cleared on settle * (the login/refresh/bridge-ready guard). * - {@link memoizeAsync} — a keyed promise cache that coalesces concurrent * loads and evicts a rejected load so the next call retries (the keyed * loader cache). */ /** * Wrap an async `fn` so concurrent calls share ONE in-flight invocation. The * in-flight promise is cleared once it settles, so the next call starts fresh * and a rejection doesn't poison later callers (every waiter of the failed * flight still sees the rejection). * * This is the guard `createOAuth2Refresher` embeds, exposed standalone for * login flows, bridge-start, and API-version fetches. */ export declare function singleFlight(fn: () => Promise): () => Promise; /** The keyed async cache returned by {@link memoizeAsync}. */ export interface AsyncMemo { /** Load (or return the cached/in-flight load of) the value for `key`. */ get(key: K): Promise; /** Drop one key so the next {@link get} reloads it. */ delete(key: K): void; /** Drop everything. */ clear(): void; /** Number of cached (or in-flight) keys. */ readonly size: number; } /** * Memoize an async `loader` by key, caching the **promise** so concurrent * `get`s of the same key coalesce onto one load. A load that REJECTS is * evicted as it settles — the rejection reaches every coalesced waiter, but * the next `get` retries instead of replaying the cached failure. * * `delete`/`clear` cover invalidation and the `_reset*` test hooks the donor * repos (redfin, zola) exposed by hand. */ export declare function memoizeAsync(loader: (key: K) => Promise): AsyncMemo; //# sourceMappingURL=single-flight.d.ts.map