import type { VextRouteFreshnessIdentity } from "../contract/types.js"; import type { VextHeaders } from "../../types/headers.js"; export interface VextFrontendFreshnessKey { route: string; path: string; query: Record; locale: string; buildId: string; partition: string; policy: Pick; } export interface VextFrontendFreshnessResponse { payload: unknown; status: number; headers: VextHeaders; } export interface VextFrontendFreshnessEntry { schemaVersion: 1; key: VextFrontendFreshnessKey; keyDigest: string; createdAt: string; expiresAt: number | null; tags: readonly string[]; response: VextFrontendFreshnessResponse; } export interface VextFrontendFreshnessReadResult { state: "miss" | "fresh" | "stale"; entry?: VextFrontendFreshnessEntry; } export interface VextFrontendFreshnessWriteInput { key: VextFrontendFreshnessKey; tags: readonly string[]; ttlMs?: number; response: VextFrontendFreshnessResponse; } export interface VextFrontendFreshnessInvalidation { route?: string; path?: string; tag?: string; key?: string; locale?: string; partition?: string; } export interface VextFrontendFreshnessInvalidationResult { matched: string[]; removed: string[]; } /** * File-backed public frontend freshness store. Entries are immutable, and the * only mutable file is a small metadata pointer written via fsync + rename. * A failed write therefore leaves the previous pointer (last-known-good) * readable for stale serving and restart recovery. */ export declare class VextFrontendFreshnessStore { readonly rootDir: string; private readonly inFlight; constructor(rootDir: string); read(key: VextFrontendFreshnessKey): Promise; write(input: VextFrontendFreshnessWriteInput): Promise; singleFlight(key: VextFrontendFreshnessKey, operation: () => Promise): Promise<{ value: T; leader: boolean; }>; invalidate(target: VextFrontendFreshnessInvalidation): Promise; get rootPath(): string; private get entriesDir(); private get pointersDir(); private readPointer; private readEntry; } export declare function getFrontendFreshnessStore(rootDir: string): VextFrontendFreshnessStore; export declare function invalidateFrontendFreshness(rootDir: string, target: VextFrontendFreshnessInvalidation): Promise; export declare function createFreshnessKeyDigest(key: VextFrontendFreshnessKey): string;