everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
1 lines • 5.39 kB
Source Map (JSON)
{"version":3,"file":"manifest-schema.cjs","names":["z","createHash"],"sources":["../../../src/services/platform/manifest-schema.ts"],"sourcesContent":["/**\n * The platform release manifest's wire schema (ADR 0034) — a leaf module so\n * the registry's resolution machine and the manifest's composer can both\n * import it without a cycle. The composer, inventory, compat gate, and\n * resolution machine live in `platform/manifest.ts` and\n * `registry/resolution.ts` respectively; this file holds only the schema.\n */\nimport { createHash } from \"node:crypto\";\nimport { z } from \"zod\";\n\n/** The release that cut the registry wire over (ticket 10): extends targets\n * still publishing the pre-cutover composition must redeploy on this\n * version or newer — resolution rejects their tags with exactly that\n * instruction. */\nexport const CUTOVER_RELEASE = \"2.0.0-rc.37\";\n\nexport const ManifestSchema = z.object({\n schemaVersion: z.literal(1),\n kind: z.literal(\"everything-dev/platform-manifest\"),\n frameworkVersion: z.string().min(1),\n everyPluginVersion: z.string().min(1),\n /** The serving build's repo HEAD (full sha) — omitted when the compose\n * context has no git (regression image builds, build-arg-less builds). */\n gitSha: z.string().min(7).optional(),\n image: z.object({\n ref: z.string().min(1),\n tags: z.array(z.string().min(1)),\n }),\n catalog: z.record(z.string(), z.string()),\n sharedDeps: z.record(\n z.string(),\n z.object({\n version: z.string(),\n requiredVersion: z.union([z.string(), z.boolean()]),\n singleton: z.boolean(),\n eager: z.boolean(),\n strictVersion: z.boolean(),\n shareScope: z.string(),\n }),\n ),\n templateInventory: z.array(\n z.object({\n path: z.string(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/),\n }),\n ),\n compat: z.object({ minChild: z.string().min(1) }),\n /**\n * The release's remote-record map (ADR 0034 amendment — release-scoped\n * extends inheritance): each entry records the immutable descriptor the\n * release published for a config remote (dotted config path, e.g.\n * `app.auth`, `app.auth.ui`, `plugins.votes.ui`) — children authored to\n * this release re-point inherited remotes at THESE bytes instead of the\n * parent's live config whenever the parent publishes. Optional: releases\n * composed before the field carry no remotes, and old readers strip\n * unknown keys.\n */\n remotes: z\n .record(\n z.string(),\n z.object({\n base: z.string().min(1),\n digest: z.object({\n manifest: z.string().min(1),\n integrity: z.string().min(1),\n }),\n }),\n )\n .optional(),\n});\nexport type Manifest = z.infer<typeof ManifestSchema>;\n\n/** The thin tag — the manifest.json home carries `{ schemaVersion, version,\n * digest }` and nothing else; the full manifest lives at the immutable\n * `versions/<v>.json` and the digest pins its exact bytes. */\nexport const ManifestTagSchema = z.object({\n schemaVersion: z.literal(1),\n version: z.string().min(1),\n digest: z.string().min(1),\n});\nexport type ManifestTag = z.infer<typeof ManifestTagSchema>;\n\n/** The digest of a manifest's serialized bytes — the train hashes the exact\n * string it publishes; the resolution machine re-serializes the fetched\n * record and verifies (JSON preserves key order, so the bytes round-trip). */\nexport function digestOfManifest(serialized: string): string {\n return createHash(\"sha256\").update(serialized).digest(\"hex\");\n}\n\n/** The thin tag for a composed manifest, over its serialized record bytes. */\nexport function manifestTagOf(manifest: Manifest, serialized: string): ManifestTag {\n return {\n schemaVersion: 1,\n version: manifest.frameworkVersion,\n digest: digestOfManifest(serialized),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,kBAAkB;AAE/B,MAAa,iBAAiBA,MAAE,OAAO;CACrC,eAAeA,MAAE,QAAQ,CAAC;CAC1B,MAAMA,MAAE,QAAQ,kCAAkC;CAClD,kBAAkBA,MAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAClC,oBAAoBA,MAAE,OAAO,CAAC,CAAC,IAAI,CAAC;;;CAGpC,QAAQA,MAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACnC,OAAOA,MAAE,OAAO;EACd,KAAKA,MAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EACrB,MAAMA,MAAE,MAAMA,MAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;CACD,SAASA,MAAE,OAAOA,MAAE,OAAO,GAAGA,MAAE,OAAO,CAAC;C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