UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

59 lines • 2.5 kB
//#region src/services/registry/keys.d.ts /** * The registry's typed key model — the one derivation every reader and * writer shares. A key is a closed union; its wire form (`keyPathOf`) is the * exact FastKV key string (`apps/<account>/<gateway>/…`). Consumers never * hand-build registry paths: the golden tests pin the wire forms, and the * invariant they encode is the one this module exists to make provable — * the account segment is the signing namespace (`dev.everything.near`), the * gateway segment is the runtime's domain (`everything.dev`), and nothing * that reads or writes may derive one from the other. * * Vocabulary (the sprint's decision ledger, .scratch/registry-primitive): * - `RuntimeRef` — `bos://<account>/<gateway>`: a runtime's identity. * - `RuntimeConfig` — the runtime's composition (bos.config.json). * - `Manifest` — the moving release tag (manifest.json, thin: version + digest). * - `Version` — the immutable per-release record (versions/<v>.json). * - `DeployRecord` — the per-deploy audit trail (deploys/<ts>.json). */ type RuntimeRef = `bos://${string}/${string}`; interface RuntimeRefParts { accountId: string; gatewayId: string; } type RegistryKey = { readonly kind: "runtimeConfig"; readonly ref: RuntimeRef; readonly path?: readonly string[]; } | { readonly kind: "manifest"; readonly ref: RuntimeRef; } | { readonly kind: "version"; readonly ref: RuntimeRef; readonly version: string; } | { readonly kind: "deployRecord"; readonly ref: RuntimeRef; readonly ts: string; }; declare class RegistryRefError extends Error { constructor(message: string); } /** `runtimeRefOf({ accountId, gatewayId })` — the runtime identity. */ declare function runtimeRefOf(parts: RuntimeRefParts): RuntimeRef; /** * Parse a runtime ref into its parts. Extra path segments beyond * `<gateway>` are the config sub-path (`bos://a/g/team/app` → * `path: ["team", "app"]`); a `#fragment` is stripped. Throws * `RegistryRefError` on any malformed ref. */ declare function parseRuntimeRef(ref: RuntimeRef | string): RuntimeRefParts & { path: string[]; }; /** The exact wire key for a registry key — raw (unencoded); the client * encodes it as a single path segment per the FastKV read API. */ declare function keyPathOf(key: RegistryKey): string; //#endregion export { RegistryKey, RegistryRefError, RuntimeRef, RuntimeRefParts, keyPathOf, parseRuntimeRef, runtimeRefOf }; //# sourceMappingURL=keys.d.cts.map