everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
1 lines • 3.5 kB
Source Map (JSON)
{"version":3,"file":"pointer.mjs","names":[],"sources":["../../../src/services/registry/pointer.ts"],"sourcesContent":["/**\n * The release-pointer plane's pre-cutover wire (sprint registry-primitive,\n * ticket 05). The key model (keys.ts) speaks the post-cutover wire —\n * `manifest.json`, `versions/<v>.json`, `deploys/<ts>.json` — but the train\n * still writes and the rollback still reads the old keys. Until ticket 10's\n * cutover, THIS file is the only place the old wire keys are derived; every\n * consumer derives them through here so the flip is one file.\n *\n * TODO(cutover): delete the templates below and re-point the helpers onto\n * keyPathOf({ kind: \"manifest\" | \"version\" | \"deployRecord\", ... }).\n */\nimport { fetchRegistryKey } from \"./fastkv\";\n\n/** The pointer key relative to `apps/<account>/<gateway>/` — the form\n * `fetchRegistryKey` takes (it wraps with the runtime prefix) and the form\n * the history endpoint's `keyPath` parameter takes. The full-key helpers\n * below are derived from these — one derivation per wire key, so ticket 10's\n * cutover flips this file and nothing else. */\nexport const MANIFEST_TAG_REL_KEY = \"manifest.json\";\n\nexport function getVersionRelKey(version: string): string {\n return `versions/${version}.json`;\n}\n\nexport function getManifestKey(accountId: string, gatewayId: string): string {\n return `apps/${accountId}/${gatewayId}/${MANIFEST_TAG_REL_KEY}`;\n}\n\nexport function getVersionKey(accountId: string, gatewayId: string, version: string): string {\n return `apps/${accountId}/${gatewayId}/${getVersionRelKey(version)}`;\n}\n\n/** The per-deploy audit record's key — the timestamp is munged into a\n * FastKV-safe path form. */\nexport function deployAuditKeyOf(\n accountId: string,\n gatewayId: string,\n publishedAt: string,\n): string {\n return `apps/${accountId}/${gatewayId}/deploys/${publishedAt.replace(/[:.]/g, \"-\")}.json`;\n}\n\n/** The release classifier's pointer read: absent (null) means no release has\n * published; a read failure throws — an unknown state must never silently\n * classify a release as non-release. The keyPath is RELATIVE —\n * `fetchRegistryKey` wraps it with the runtime prefix (a full key here\n * double-prefixes the wire key and reads a key that can never exist). */\nexport function readManifestTag<T>(\n accountId: string,\n gatewayId: string,\n registry?: string,\n): Promise<T | null> {\n return fetchRegistryKey<T>(accountId, gatewayId, MANIFEST_TAG_REL_KEY, registry);\n}\n\n/** The release leg's immutability check: the version record must either be\n * absent or hold byte-identical content — a divergent republish is a burned\n * version. */\nexport function readVersionRecord<T>(\n accountId: string,\n gatewayId: string,\n version: string,\n registry?: string,\n): Promise<T | null> {\n return fetchRegistryKey<T>(accountId, gatewayId, getVersionRelKey(version), registry);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAa,uBAAuB;AAEpC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,YAAY,QAAQ;AAC7B;AAEA,SAAgB,eAAe,WAAmB,WAA2B;CAC3E,OAAO,QAAQ,UAAU,GAAG,UAAU,GAAG;AAC3C;AAEA,SAAgB,cAAc,WAAmB,WAAmB,SAAyB;CAC3F,OAAO,QAAQ,UAAU,GAAG,UAAU,GAAG,iBAAiB,OAAO;AACnE;;;AAIA,SAAgB,iBACd,WACA,WACA,aACQ;CACR,OAAO,QAAQ,UAAU,GAAG,UAAU,WAAW,YAAY,QAAQ,SAAS,GAAG,EAAE;AACrF;;;;;;AAOA,SAAgB,gBACd,WACA,WACA,UACmB;CACnB,OAAO,iBAAoB,WAAW,WAAW,sBAAsB,QAAQ;AACjF;;;;AAKA,SAAgB,kBACd,WACA,WACA,SACA,UACmB;CACnB,OAAO,iBAAoB,WAAW,WAAW,iBAAiB,OAAO,GAAG,QAAQ;AACtF"}