/** * dsh-widgets — the shared host HTTP plumbing. * * `memoTtl` (the per-key TTL + single-flight cache the channels share), * `readJsonBody` (the size-capped request body reader) and the two policy * constants they are written against. Split out of `src/index.ts` (Phase H1). */ /** How long a JSON route body may be re-served without recomputing it. * * The rail is allowed to poll (a Command Code window moves while the reader * watches), and a reader may keep several tabs open, so without a cache every * tab buys its own round of upstream calls and its own log fold. 20 s is short * enough that no client sees a stale number it could have acted on, and long * enough to collapse a burst — including the degraded-payload retry — into one * upstream pass. Errors are never cached. */ export declare const ROUTE_CACHE_MS = 20000; /** * Per-key TTL + single-flight memo for a route body. * * `force` (the `?refresh=1` path) skips the TTL but still JOINS an in-flight * computation, so two tabs asking at the same instant still produce one fold. * A rejected computation is never stored. * * @param ttlMs - how long a stored value stays fresh. * @returns a reader that computes on miss and shares one promise on a burst. */ export declare function memoTtl(ttlMs: number): (key: string, compute: () => Promise | T, force?: boolean) => Promise; /** Accumulate a Node IncomingMessage body into a JSON value (size-capped). */ export declare function readJsonBody(req: unknown): Promise;