everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
49 lines • 1.66 kB
text/typescript
import { PlatformReleaseManifest } from "../platform/manifest-schema.cjs";
//#region src/services/registry/cache.d.ts
interface ManifestCacheRecord {
schemaVersion: 1;
kind: "everything-dev/platform-manifest-cache";
resolvedAt: string;
source: {
account: string;
gateway: string;
};
manifest: PlatformReleaseManifest;
provenance?: "slot" | "pointer";
}
declare const MANIFEST_CACHE_TTL_MS: number;
type ManifestCacheRead = {
state: "miss";
} | {
state: "stale";
record: ManifestCacheRecord;
} | {
state: "hit";
record: ManifestCacheRecord;
};
interface ReadManifestCacheOptions {
configDir: string;
/** When set, a fresh cache only hits if the record IS that release — the
* pin-match half of the #546 predicate. */
pin?: string;
now?: () => number;
ttlMs?: number;
/** test seam — replaces the file read */
read?: () => ManifestCacheRecord | null;
}
interface WriteManifestCacheOptions {
configDir: string;
record: ManifestCacheRecord;
/** test seam — replaces the file write */
write?: (record: ManifestCacheRecord) => void;
}
/**
* The freshness predicate: `resolvedAt` inside the TTL, parseable (a cache
* with an unparseable timestamp is stale — never trusted), and pin-matched
* when a pin is in force.
*/
declare function readManifestCache(opts: ReadManifestCacheOptions): ManifestCacheRead;
declare function writeManifestCache(opts: WriteManifestCacheOptions): void;
//#endregion
export { MANIFEST_CACHE_TTL_MS, ManifestCacheRead, ManifestCacheRecord, ReadManifestCacheOptions, WriteManifestCacheOptions, readManifestCache, writeManifestCache };
//# sourceMappingURL=cache.d.cts.map