/** * Release Asset Manifest — in-process consumption cache (production HTML). * * Fetches manifests from the project-scoped GET endpoint once per release and * caches them under collision-free release/version tuple identities. Ready manifests are * cached for a bounded TTL (15 min) so superseded manifests are eventually * replaced; non-ready / missing results are cached for a short TTL so the * common "no manifest" case stays cheap. * * Consumption is gated by `VERYFRONT_RELEASE_ASSET_MANIFEST=1` (default OFF). * When the flag is off, `getReadyManifestForRender` always returns null so the * HTML output is byte-identical to today. * * Most callers use the non-blocking read so fallback stays cheap. HTML shell * generation uses the awaited read so import maps, preload hints, CSS, and * hydration data are generated from one manifest snapshot. * * Multi-tenancy: each releaseId is served by the fetcher registered for that * specific releaseId (the adapter that owns it). There is no cross-project * token reuse. If no per-releaseId fetcher is registered, the call returns null * (byte-identical JIT fallback). * * @module release-assets/manifest-cache */ import { type ReleaseAssetManifest } from "./manifest-schema.js"; /** Controls revalidation behavior for awaited manifest reads. */ export interface ReadyManifestReadOptions { /** * Retry a cached non-ready result after a short throttle instead of waiting * for the full null TTL. Used by module responses that cannot be cached * safely until dependency imports can be rewritten through the manifest. */ refreshCachedNull?: boolean; } /** Cancellation context passed to a release-scoped manifest fetcher. */ export interface ReleaseAssetManifestFetchContext { /** Aborted when the fetch times out or its fetcher loses ownership. */ readonly signal: AbortSignal; } /** Untrusted control-plane response returned by a registered fetcher. */ export interface ReleaseAssetManifestFetchResult { readonly state: string; readonly manifest_version: number; readonly manifest: unknown; } /** * Fetcher used to retrieve a manifest for a release. Registered per-release ID * by the runtime adapter that owns that release, so the correct project-scoped * token is always used. Returns null when the manifest is unavailable. */ export interface ReleaseAssetManifestFetcher { (releaseId: string, context: ReleaseAssetManifestFetchContext): Promise; } /** Idempotent cleanup for one fetcher registration. */ export type ReleaseAssetManifestFetcherCleanup = () => void; /** * Register a project-scoped manifest fetcher for the given releaseId. * * Called by the FS adapter when its content context is set to a release. * Overwrites any previous registration for the same releaseId (safe — the * latest adapter for a release is the authoritative owner). */ export declare function registerManifestFetcherForRelease(releaseId: string, fetcher: ReleaseAssetManifestFetcher): ReleaseAssetManifestFetcherCleanup; /** * Remove the manifest fetcher for the given releaseId. * * This is an unconditional administrative removal. Adapter owners should use * the cleanup returned by `registerManifestFetcherForRelease` so an older * adapter cannot remove a newer registration for the same release. */ export declare function unregisterManifestFetcherForRelease(releaseId: string): void; /** True when production manifest consumption is enabled via env flag. */ export declare function isReleaseAssetManifestEnabled(): boolean; /** * Return a ready manifest for `releaseId` if one is cached, else null. * * Non-blocking: on a cache miss (or expired entry) it schedules a background * fetch and returns null for the current render. Returns null immediately when * the flag is off or no fetcher is registered for this releaseId. */ export declare function getReadyManifestForRender(releaseId: string | null | undefined): ReleaseAssetManifest | null; /** * Await a ready manifest for rendering when release-manifest consumption is * enabled. */ export declare function getReadyManifestForRenderAsync(releaseId: string | null | undefined, options?: ReadyManifestReadOptions): Promise; /** * Resolve the release manifest used as the production browser-module admission * boundary. Unlike rendering optimizations, this security decision is never * controlled by the release-manifest rollout flag. */ export declare function getReadyManifestForBrowserModuleAdmission(releaseId: string | null | undefined, options?: ReadyManifestReadOptions): Promise; /** Clear cached manifest bodies while keeping registered fetchers intact. */ export declare function clearCachedReleaseAssetManifests(): void; /** Clear the cache and fetcher registry (tests / adapter teardown). */ export declare function clearReleaseAssetManifestCache(): void; //# sourceMappingURL=manifest-cache.d.ts.map