@prisma/orm-toolchain 8.0.0-rc.11-dev.11 → 8.0.0-rc.11-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{aggregate-B4HKshLQ.mjs → aggregate-DI9VS7yL.mjs} +6 -9
- package/dist/aggregate-DI9VS7yL.mjs.map +1 -0
- package/dist/{aggregate-D_eX4zoo.d.mts → aggregate-DKBycuzO.d.mts} +1 -3
- package/dist/aggregate-DKBycuzO.d.mts.map +1 -0
- package/dist/cli.mjs +135 -115
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +6 -8
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__migration-cli.mjs +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-snapshot-store-CbqynbtE.d.mts → contract-snapshot-store-BqDMcO4r.d.mts} +2 -3
- package/dist/{contract-snapshot-store-CbqynbtE.d.mts.map → contract-snapshot-store-BqDMcO4r.d.mts.map} +1 -1
- package/dist/{contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs → contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs} +3 -12
- package/dist/{contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map → contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs.map} +1 -1
- package/dist/{domain-type-generation-CR9ECUau-DOlKbcaE.mjs → domain-type-generation-BVFTIUm6-BRbRrGYB.mjs} +3 -7
- package/dist/domain-type-generation-BVFTIUm6-BRbRrGYB.mjs.map +1 -0
- package/dist/emitter.d.mts +1 -1
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.mjs +1 -1
- package/dist/{exports-B8peSdx4.mjs → exports-DGC_nDQ0.mjs} +2 -2
- package/dist/{exports-B8peSdx4.mjs.map → exports-DGC_nDQ0.mjs.map} +1 -1
- package/dist/{exports-CE6OD63o-4Qpqr2W7.mjs → exports-DkJil2JJ-6p86L2r4.mjs} +4 -4
- package/dist/{exports-CE6OD63o-4Qpqr2W7.mjs.map → exports-DkJil2JJ-6p86L2r4.mjs.map} +1 -1
- package/dist/{exports-BXXeNWlj.mjs → exports-Do7_pH8Y.mjs} +2 -2
- package/dist/{exports-BXXeNWlj.mjs.map → exports-Do7_pH8Y.mjs.map} +1 -1
- package/dist/{index-D217lbiW.d.mts → index-K9cFK1Ge.d.mts} +9 -2
- package/dist/index-K9cFK1Ge.d.mts.map +1 -0
- package/dist/{io-BmWQNxRP-DQqbcPsS.mjs → io-DSQXOfBH-GRpmFG2F.mjs} +3 -3
- package/dist/{io-BmWQNxRP-DQqbcPsS.mjs.map → io-DSQXOfBH-GRpmFG2F.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +3 -3
- package/dist/migration-tools.mjs +6 -6
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -2
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-uqvZQnnQ-DpAQaLiM.mjs → ref-DSvAirqq-oqBwkhgP.mjs} +87 -86
- package/dist/{ref-uqvZQnnQ-DpAQaLiM.mjs.map → ref-DSvAirqq-oqBwkhgP.mjs.map} +1 -1
- package/dist/{spaces-BCZiAZQn.mjs → spaces-DzFtKEl3.mjs} +4 -4
- package/dist/{spaces-BCZiAZQn.mjs.map → spaces-DzFtKEl3.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs → verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs} +3 -3
- package/dist/{verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map → verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/aggregate-B4HKshLQ.mjs.map +0 -1
- package/dist/aggregate-D_eX4zoo.d.mts.map +0 -1
- package/dist/domain-type-generation-CR9ECUau-DOlKbcaE.mjs.map +0 -1
- package/dist/index-D217lbiW.d.mts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from "./errors-SoLLYLtw-DMxVbVs9.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { s as readMigrationsDir } from "./io-
|
|
2
|
+
import { a as writeContractSnapshot } from "./contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs";
|
|
3
|
+
import { s as readMigrationsDir } from "./io-DSQXOfBH-GRpmFG2F.mjs";
|
|
4
4
|
import { l as reconstructGraph, o as findPathWithDecision } from "./migration-graph-CW4bMmTz-B5xFtFVB.mjs";
|
|
5
|
-
import { c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID } from "./verify-contract-spaces-
|
|
5
|
+
import { c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID } from "./verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs";
|
|
6
6
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
7
|
import { computeStorageHash } from "@prisma/orm-framework/contract/hashing";
|
|
8
8
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -264,4 +264,4 @@ function planAllSpaces(inputs, planSpace) {
|
|
|
264
264
|
//#endregion
|
|
265
265
|
export { gatherDiskContractSpaceState as a, emitContractSpaceArtifacts as i, computeExtensionSpaceApplyPath as n, planAllSpaces as o, contractSpaceFromJson as r, assertDescriptorSelfConsistency as t };
|
|
266
266
|
|
|
267
|
-
//# sourceMappingURL=spaces-
|
|
267
|
+
//# sourceMappingURL=spaces-DzFtKEl3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaces-BCZiAZQn.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/spaces.mjs"],"sourcesContent":["import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from \"../errors-SoLLYLtw.mjs\";\nimport { o as writeContractSnapshot } from \"../contract-snapshot-store-qGrwlGmt.mjs\";\nimport { s as readMigrationsDir } from \"../io-BmWQNxRP.mjs\";\nimport \"../constants-CM-w38DQ.mjs\";\nimport { l as reconstructGraph, o as findPathWithDecision } from \"../migration-graph-CW4bMmTz.mjs\";\nimport { a as RESERVED_SPACE_SUBDIR_NAMES, c as isValidSpaceId, i as APP_SPACE_ID, l as spaceMigrationDirectory, n as verifyContractSpaces, o as SPACE_REFS_DIRNAME, r as readContractSpaceHeadRef, s as assertValidSpaceId, t as listContractSpaceDirectories, u as spaceRefsDirectory } from \"../verify-contract-spaces-CrxvgpwD.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { join } from \"pathe\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\n//#region src/assert-descriptor-self-consistency.ts\n/**\n* Assert that an extension descriptor is self-consistent: the\n* `headRef.hash` it publishes must match the canonical hash recomputed\n* from its `contractSpace.contractJson`.\n*\n* Recomputes via {@link computeStorageHash} — the same canonical-JSON\n* pipeline the descriptor's own emit pipeline produced the hash with —\n* over `(target, targetFamily, storage)`. Mismatch indicates the\n* extension author bumped `contractJson` without rerunning emit, leaving\n* the descriptor's `headRef.hash` stale; the consumer-side helpers\n* (drift detection, on-disk artefact emission, runner marker writes) all\n* trust `headRef.hash` as the canonical identity, so a stale value would\n* silently corrupt every downstream boundary.\n*\n* Synchronous, pure, no I/O. Throws\n* `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH` on failure with both the\n* recomputed and published hashes in `meta` so callers can surface a\n* clear remediation hint without re-deriving them.\n*/\nfunction assertDescriptorSelfConsistency(inputs) {\n\tconst { storageHash: _stripped, ...storageWithoutHash } = inputs.storage;\n\tconst recomputed = computeStorageHash({\n\t\ttarget: inputs.target,\n\t\ttargetFamily: inputs.targetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...ifDefined(\"shouldPreserveEmpty\", inputs.shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", inputs.sortStorage)\n\t});\n\tif (recomputed !== inputs.headRefHash) throw errorDescriptorHeadHashMismatch({\n\t\textensionId: inputs.extensionId,\n\t\trecomputedHash: recomputed,\n\t\theadRefHash: inputs.headRefHash\n\t});\n}\n//#endregion\n//#region src/compute-extension-space-apply-path.ts\n/**\n* Compute the apply path for an extension contract space — the shortest\n* sequence of on-disk migration packages that walks the live marker\n* forward to the on-disk head ref hash, covering every required\n* invariant.\n*\n* Reads only on-disk artifacts (`migrations/<spaceId>/refs/head.json`\n* and the per-space migration packages). **Does not import any\n* extension descriptor module** — `db init` / `db update` must remain\n* runnable without the descriptor source on disk.\n*\n* Behaviour:\n* - Returns `{ kind: 'ok', pathOps: [], … }` when the marker is already\n* at the recorded head and no required invariants are missing.\n* - Returns `{ kind: 'unreachable' }` when the marker hash is not\n* structurally connected to the recorded head in the graph.\n* - Returns `{ kind: 'unsatisfiable', missing, … }` when the marker is\n* reachable but no path covers the required invariants.\n* - Returns `{ kind: 'contractSpaceHeadRefMissing' }` when the per-space\n* `refs/head.json` is absent — the precheck verifier should already\n* have rejected this case, but the helper is defensive so callers can\n* surface a coherent error rather than throw.\n*/\nasync function computeExtensionSpaceApplyPath(inputs) {\n\tconst { projectMigrationsDir, spaceId, currentMarkerHash, currentMarkerInvariants } = inputs;\n\tconst contractSpaceHeadRef = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\tif (contractSpaceHeadRef === null) return { kind: \"contractSpaceHeadRefMissing\" };\n\tconst { packages } = await readMigrationsDir(spaceMigrationDirectory(projectMigrationsDir, spaceId), { migrationsDir: projectMigrationsDir });\n\tconst graph = reconstructGraph(packages);\n\tconst fromHash = currentMarkerHash ?? \"empty\";\n\tconst required = new Set(contractSpaceHeadRef.invariants.filter((id) => !currentMarkerInvariants.includes(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, contractSpaceHeadRef.hash, { required });\n\tif (outcome.kind === \"unreachable\") return {\n\t\tkind: \"unreachable\",\n\t\tcontractSpaceHeadRef\n\t};\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tcontractSpaceHeadRef,\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(({ dirName, to }) => ({\n\t\t\tdirName,\n\t\t\tto\n\t\t}))\n\t};\n\tconst packagesByHash = new Map(packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst pathOps = [];\n\tconst walkedMigrationDirs = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${spaceId}\"`);\n\t\twalkedMigrationDirs.push(pkg.dirName);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tcontractSpaceHeadRef,\n\t\tprovidedInvariants: [...providedInvariantsSet].sort(),\n\t\tpathOps,\n\t\twalkedMigrationDirs\n\t};\n}\n//#endregion\n//#region src/contract-space-from-json.ts\n/**\n* Materialise a typed {@link ContractSpace} from the JSON artefacts a\n* contract-space extension package emits to disk.\n*\n* Extension descriptors wire `contract.json`, per-migration\n* `migration.json` / `ops.json`, and `refs/head.json` to the framework's\n* typed surfaces. TypeScript widens JSON imports to a structural record\n* that does not preserve readonly modifiers or branded scalars (e.g.\n* `StorageHashBase<'abc123...'>`), so authoring the descriptor inline\n* forces every wiring site to cast through `unknown`. This helper\n* encapsulates the single narrowing point: descriptor sources stay\n* cast-free, and the (necessary) coercion is colocated with the\n* documentation explaining why it is safe.\n*\n* Safety: the JSON files passed here are produced by the framework's own\n* emit pipeline (`prisma contract emit` and `MigrationCLI.run`)\n* and re-validated downstream by the runner / verifier. The descriptor\n* is a pass-through wiring layer — no descriptor consumer treats the\n* narrowed types as a stronger guarantee than \"these came from the\n* canonical emit pipeline\".\n*\n* The helper does not introspect or schema-validate the inputs; runtime\n* validation is the responsibility of `family.deserializeContract`\n* (codec-aware, invoked at control-stack construction) and the\n* per-migration `readMigrationPackage` reader used when loading\n* from disk. JSON-imported packages flow through the descriptor without\n* a disk read, so the equivalent runtime guarantee comes from the emit\n* pipeline that produced the JSON in the first place.\n*/\nfunction contractSpaceFromJson(inputs) {\n\tconst migrations = inputs.migrations.map((m) => ({\n\t\tdirName: m.dirName,\n\t\tmetadata: m.metadata,\n\t\tops: m.ops\n\t}));\n\treturn {\n\t\tcontractJson: inputs.contractJson,\n\t\tmigrations,\n\t\theadRef: inputs.headRef\n\t};\n}\n//#endregion\n//#region src/emit-contract-space-artifacts.ts\n/**\n* Emit the per-space artifacts — the head contract snapshot (written into\n* the migrations-root-wide `snapshots/` store, keyed by `headRef.hash`) and\n* `refs/head.json` — under `<projectMigrationsDir>/<spaceId>/`.\n*\n* The head contract snapshot is write-if-absent (see\n* {@link writeContractSnapshot}): a changed extension contract has a new\n* hash, so it lands as a new store entry; an unchanged hash means identical\n* canonical content already sits there. `refs/head.json` stays\n* always-overwrite: the framework owns it, so running `migrate` twice with\n* the same inputs is a no-op observably (idempotent), but the helper does\n* not check pre-existing contents — re-emit always wins.\n*\n* Path layout matches the convention in\n* [`spaceMigrationDirectory`](./space-layout.ts). The space id is\n* validated against `[a-z][a-z0-9_-]{0,63}` via\n* {@link assertValidSpaceId} for filesystem-safety reasons; the helper\n* accepts every space uniformly (including the app space, default\n* `'app'`).\n*\n* The migrations directory and space subdirectory are created if they\n* do not yet exist (`mkdir { recursive: true }`).\n*/\nasync function emitContractSpaceArtifacts(projectMigrationsDir, spaceId, inputs) {\n\tassertValidSpaceId(spaceId);\n\tconst refsDir = spaceRefsDirectory(join(projectMigrationsDir, spaceId));\n\tawait mkdir(refsDir, { recursive: true });\n\tawait writeContractSnapshot(projectMigrationsDir, inputs.headRef.hash, {\n\t\tcontractJson: inputs.contract,\n\t\tcontractDts: inputs.contractDts\n\t});\n\tconst sortedInvariants = [...inputs.headRef.invariants].sort();\n\tconst headJson = canonicalizeJson({\n\t\thash: inputs.headRef.hash,\n\t\tinvariants: sortedInvariants\n\t});\n\tawait writeFile(join(refsDir, \"head.json\"), `${headJson}\\n`);\n}\n//#endregion\n//#region src/gather-disk-contract-space-state.ts\n/**\n* Read the on-disk state the per-space verifier needs:\n*\n* - The list of contract-space directories under\n* `<projectMigrationsDir>/` (via\n* {@link import('./verify-contract-spaces').listContractSpaceDirectories}).\n* - The on-disk head ref `(hash, invariants)` for each declared extension space\n* (via {@link readContractSpaceHeadRef}; missing on-disk artefacts are simply\n* omitted — the verifier reports them as `declaredButUnmigrated`).\n*\n* Synchronous in spirit but async due to filesystem reads. Reads only\n* the user's repo. **Does not import any extension descriptor module.**\n*\n* Composition convention: pure target-agnostic primitive in\n* `1-framework`; the SQL family (and any future target family) wires\n* it into its `dbInit` / `verify` flows alongside its own marker-row\n* read before invoking `verifyContractSpaces`.\n*/\nasync function gatherDiskContractSpaceState(args) {\n\tconst { projectMigrationsDir, loadedSpaceIds } = args;\n\tconst spaceDirsOnDisk = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst headRefsBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of loadedSpaceIds) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tconst head = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\t\tif (head !== null) headRefsBySpace.set(spaceId, head);\n\t}\n\treturn {\n\t\tspaceDirsOnDisk,\n\t\theadRefsBySpace\n\t};\n}\n//#endregion\n//#region src/plan-all-spaces.ts\n/**\n* Iterate the per-space planner across a set of loaded contract spaces\n* and return a deterministic shape regardless of declaration order.\n*\n* Behaviour:\n*\n* - The output is sorted alphabetically by `spaceId`. Two callers\n* passing the same set of inputs in different orders observe\n* byte-identical outputs.\n* - The per-space planner (`planSpace`) is called exactly once per\n* input, in alphabetical-by-spaceId order. Its return value is\n* attached to the corresponding output entry verbatim.\n* - Duplicate `spaceId`s in the input array throw\n* `MIGRATION.DUPLICATE_SPACE_ID` before any `planSpace` call runs,\n* keeping the planner pure when the input is malformed.\n*\n* The signature is generic over `TContract` and `TPackage` because the\n* shape is framework-neutral (SQL family today, Mongo family\n* eventually). Callers wire in whatever contract value and migration\n* package shape their family already speaks.\n*\n* Synchronous: the underlying per-space planner (target's\n* `MigrationPlanner.plan(...)`) is synchronous; callers that need to\n* resolve async I/O (e.g. reading on-disk `contract.json` from disk)\n* resolve it before calling `planAllSpaces` and pass the materialised\n* inputs through.\n*/\nfunction planAllSpaces(inputs, planSpace) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const input of inputs) {\n\t\tif (seen.has(input.spaceId)) throw errorDuplicateSpaceId(input.spaceId);\n\t\tseen.add(input.spaceId);\n\t}\n\treturn [...inputs].sort((a, b) => {\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t}).map((input) => ({\n\t\tspaceId: input.spaceId,\n\t\tmigrationPackages: planSpace(input)\n\t}));\n}\n//#endregion\nexport { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, sp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,CAAC;CACD,MAAM,UAAU,KAAK,SAAS,WAAW,GAAG,GAAG,SAAS,GAAG;AAC5D;;;;;;;;;;;;;;;;;;;AAqBA,eAAe,6BAA6B,MAAM;CACjD,MAAM,EAAE,sBAAsB,mBAAmB;CACjD,MAAM,kBAAkB,MAAM,6BAA6B,oBAAoB;CAC/E,MAAM,kCAAkC,IAAI,IAAI;CAChD,KAAK,MAAM,WAAW,gBAAgB;EACrC,IAAI,YAAY,cAAc;EAC9B,MAAM,OAAO,MAAM,yBAAyB,sBAAsB,OAAO;EACzE,IAAI,SAAS,MAAM,gBAAgB,IAAI,SAAS,IAAI;CACrD;CACA,OAAO;EACN;EACA;CACD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,cAAc,QAAQ,WAAW;CACzC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,SAAS,QAAQ;EAC3B,IAAI,KAAK,IAAI,MAAM,OAAO,GAAG,MAAM,sBAAsB,MAAM,OAAO;EACtE,KAAK,IAAI,MAAM,OAAO;CACvB;CACA,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM;EACjC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,OAAO;CACR,CAAC,CAAC,CAAC,KAAK,WAAW;EAClB,SAAS,MAAM;EACf,mBAAmB,UAAU,KAAK;CACnC,EAAE;AACH"}
|
|
1
|
+
{"version":3,"file":"spaces-DzFtKEl3.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/spaces.mjs"],"sourcesContent":["import { f as errorDuplicateSpaceId, l as errorDescriptorHeadHashMismatch } from \"../errors-SoLLYLtw.mjs\";\nimport { a as writeContractSnapshot } from \"../contract-snapshot-store-D-mFkiHR.mjs\";\nimport { s as readMigrationsDir } from \"../io-DSQXOfBH.mjs\";\nimport \"../constants-CM-w38DQ.mjs\";\nimport { l as reconstructGraph, o as findPathWithDecision } from \"../migration-graph-CW4bMmTz.mjs\";\nimport { a as RESERVED_SPACE_SUBDIR_NAMES, c as isValidSpaceId, i as APP_SPACE_ID, l as spaceMigrationDirectory, n as verifyContractSpaces, o as SPACE_REFS_DIRNAME, r as readContractSpaceHeadRef, s as assertValidSpaceId, t as listContractSpaceDirectories, u as spaceRefsDirectory } from \"../verify-contract-spaces-_vwt5LT0.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { join } from \"pathe\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\n//#region src/assert-descriptor-self-consistency.ts\n/**\n* Assert that an extension descriptor is self-consistent: the\n* `headRef.hash` it publishes must match the canonical hash recomputed\n* from its `contractSpace.contractJson`.\n*\n* Recomputes via {@link computeStorageHash} — the same canonical-JSON\n* pipeline the descriptor's own emit pipeline produced the hash with —\n* over `(target, targetFamily, storage)`. Mismatch indicates the\n* extension author bumped `contractJson` without rerunning emit, leaving\n* the descriptor's `headRef.hash` stale; the consumer-side helpers\n* (drift detection, on-disk artefact emission, runner marker writes) all\n* trust `headRef.hash` as the canonical identity, so a stale value would\n* silently corrupt every downstream boundary.\n*\n* Synchronous, pure, no I/O. Throws\n* `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH` on failure with both the\n* recomputed and published hashes in `meta` so callers can surface a\n* clear remediation hint without re-deriving them.\n*/\nfunction assertDescriptorSelfConsistency(inputs) {\n\tconst { storageHash: _stripped, ...storageWithoutHash } = inputs.storage;\n\tconst recomputed = computeStorageHash({\n\t\ttarget: inputs.target,\n\t\ttargetFamily: inputs.targetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...ifDefined(\"shouldPreserveEmpty\", inputs.shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", inputs.sortStorage)\n\t});\n\tif (recomputed !== inputs.headRefHash) throw errorDescriptorHeadHashMismatch({\n\t\textensionId: inputs.extensionId,\n\t\trecomputedHash: recomputed,\n\t\theadRefHash: inputs.headRefHash\n\t});\n}\n//#endregion\n//#region src/compute-extension-space-apply-path.ts\n/**\n* Compute the apply path for an extension contract space — the shortest\n* sequence of on-disk migration packages that walks the live marker\n* forward to the on-disk head ref hash, covering every required\n* invariant.\n*\n* Reads only on-disk artifacts (`migrations/<spaceId>/refs/head.json`\n* and the per-space migration packages). **Does not import any\n* extension descriptor module** — `db init` / `db update` must remain\n* runnable without the descriptor source on disk.\n*\n* Behaviour:\n* - Returns `{ kind: 'ok', pathOps: [], … }` when the marker is already\n* at the recorded head and no required invariants are missing.\n* - Returns `{ kind: 'unreachable' }` when the marker hash is not\n* structurally connected to the recorded head in the graph.\n* - Returns `{ kind: 'unsatisfiable', missing, … }` when the marker is\n* reachable but no path covers the required invariants.\n* - Returns `{ kind: 'contractSpaceHeadRefMissing' }` when the per-space\n* `refs/head.json` is absent — the precheck verifier should already\n* have rejected this case, but the helper is defensive so callers can\n* surface a coherent error rather than throw.\n*/\nasync function computeExtensionSpaceApplyPath(inputs) {\n\tconst { projectMigrationsDir, spaceId, currentMarkerHash, currentMarkerInvariants } = inputs;\n\tconst contractSpaceHeadRef = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\tif (contractSpaceHeadRef === null) return { kind: \"contractSpaceHeadRefMissing\" };\n\tconst { packages } = await readMigrationsDir(spaceMigrationDirectory(projectMigrationsDir, spaceId), { migrationsDir: projectMigrationsDir });\n\tconst graph = reconstructGraph(packages);\n\tconst fromHash = currentMarkerHash ?? \"empty\";\n\tconst required = new Set(contractSpaceHeadRef.invariants.filter((id) => !currentMarkerInvariants.includes(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, contractSpaceHeadRef.hash, { required });\n\tif (outcome.kind === \"unreachable\") return {\n\t\tkind: \"unreachable\",\n\t\tcontractSpaceHeadRef\n\t};\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tcontractSpaceHeadRef,\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(({ dirName, to }) => ({\n\t\t\tdirName,\n\t\t\tto\n\t\t}))\n\t};\n\tconst packagesByHash = new Map(packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst pathOps = [];\n\tconst walkedMigrationDirs = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${spaceId}\"`);\n\t\twalkedMigrationDirs.push(pkg.dirName);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tcontractSpaceHeadRef,\n\t\tprovidedInvariants: [...providedInvariantsSet].sort(),\n\t\tpathOps,\n\t\twalkedMigrationDirs\n\t};\n}\n//#endregion\n//#region src/contract-space-from-json.ts\n/**\n* Materialise a typed {@link ContractSpace} from the JSON artefacts a\n* contract-space extension package emits to disk.\n*\n* Extension descriptors wire `contract.json`, per-migration\n* `migration.json` / `ops.json`, and `refs/head.json` to the framework's\n* typed surfaces. TypeScript widens JSON imports to a structural record\n* that does not preserve readonly modifiers or branded scalars (e.g.\n* `StorageHashBase<'abc123...'>`), so authoring the descriptor inline\n* forces every wiring site to cast through `unknown`. This helper\n* encapsulates the single narrowing point: descriptor sources stay\n* cast-free, and the (necessary) coercion is colocated with the\n* documentation explaining why it is safe.\n*\n* Safety: the JSON files passed here are produced by the framework's own\n* emit pipeline (`prisma contract emit` and `MigrationCLI.run`)\n* and re-validated downstream by the runner / verifier. The descriptor\n* is a pass-through wiring layer — no descriptor consumer treats the\n* narrowed types as a stronger guarantee than \"these came from the\n* canonical emit pipeline\".\n*\n* The helper does not introspect or schema-validate the inputs; runtime\n* validation is the responsibility of `family.deserializeContract`\n* (codec-aware, invoked at control-stack construction) and the\n* per-migration `readMigrationPackage` reader used when loading\n* from disk. JSON-imported packages flow through the descriptor without\n* a disk read, so the equivalent runtime guarantee comes from the emit\n* pipeline that produced the JSON in the first place.\n*/\nfunction contractSpaceFromJson(inputs) {\n\tconst migrations = inputs.migrations.map((m) => ({\n\t\tdirName: m.dirName,\n\t\tmetadata: m.metadata,\n\t\tops: m.ops\n\t}));\n\treturn {\n\t\tcontractJson: inputs.contractJson,\n\t\tmigrations,\n\t\theadRef: inputs.headRef\n\t};\n}\n//#endregion\n//#region src/emit-contract-space-artifacts.ts\n/**\n* Emit the per-space artifacts — the head contract snapshot (written into\n* the migrations-root-wide `snapshots/` store, keyed by `headRef.hash`) and\n* `refs/head.json` — under `<projectMigrationsDir>/<spaceId>/`.\n*\n* The head contract snapshot is write-if-absent (see\n* {@link writeContractSnapshot}): a changed extension contract has a new\n* hash, so it lands as a new store entry; an unchanged hash means identical\n* canonical content already sits there. `refs/head.json` stays\n* always-overwrite: the framework owns it, so running `migrate` twice with\n* the same inputs is a no-op observably (idempotent), but the helper does\n* not check pre-existing contents — re-emit always wins.\n*\n* Path layout matches the convention in\n* [`spaceMigrationDirectory`](./space-layout.ts). The space id is\n* validated against `[a-z][a-z0-9_-]{0,63}` via\n* {@link assertValidSpaceId} for filesystem-safety reasons; the helper\n* accepts every space uniformly (including the app space, default\n* `'app'`).\n*\n* The migrations directory and space subdirectory are created if they\n* do not yet exist (`mkdir { recursive: true }`).\n*/\nasync function emitContractSpaceArtifacts(projectMigrationsDir, spaceId, inputs) {\n\tassertValidSpaceId(spaceId);\n\tconst refsDir = spaceRefsDirectory(join(projectMigrationsDir, spaceId));\n\tawait mkdir(refsDir, { recursive: true });\n\tawait writeContractSnapshot(projectMigrationsDir, inputs.headRef.hash, {\n\t\tcontractJson: inputs.contract,\n\t\tcontractDts: inputs.contractDts\n\t});\n\tconst sortedInvariants = [...inputs.headRef.invariants].sort();\n\tconst headJson = canonicalizeJson({\n\t\thash: inputs.headRef.hash,\n\t\tinvariants: sortedInvariants\n\t});\n\tawait writeFile(join(refsDir, \"head.json\"), `${headJson}\\n`);\n}\n//#endregion\n//#region src/gather-disk-contract-space-state.ts\n/**\n* Read the on-disk state the per-space verifier needs:\n*\n* - The list of contract-space directories under\n* `<projectMigrationsDir>/` (via\n* {@link import('./verify-contract-spaces').listContractSpaceDirectories}).\n* - The on-disk head ref `(hash, invariants)` for each declared extension space\n* (via {@link readContractSpaceHeadRef}; missing on-disk artefacts are simply\n* omitted — the verifier reports them as `declaredButUnmigrated`).\n*\n* Synchronous in spirit but async due to filesystem reads. Reads only\n* the user's repo. **Does not import any extension descriptor module.**\n*\n* Composition convention: pure target-agnostic primitive in\n* `1-framework`; the SQL family (and any future target family) wires\n* it into its `dbInit` / `verify` flows alongside its own marker-row\n* read before invoking `verifyContractSpaces`.\n*/\nasync function gatherDiskContractSpaceState(args) {\n\tconst { projectMigrationsDir, loadedSpaceIds } = args;\n\tconst spaceDirsOnDisk = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst headRefsBySpace = /* @__PURE__ */ new Map();\n\tfor (const spaceId of loadedSpaceIds) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tconst head = await readContractSpaceHeadRef(projectMigrationsDir, spaceId);\n\t\tif (head !== null) headRefsBySpace.set(spaceId, head);\n\t}\n\treturn {\n\t\tspaceDirsOnDisk,\n\t\theadRefsBySpace\n\t};\n}\n//#endregion\n//#region src/plan-all-spaces.ts\n/**\n* Iterate the per-space planner across a set of loaded contract spaces\n* and return a deterministic shape regardless of declaration order.\n*\n* Behaviour:\n*\n* - The output is sorted alphabetically by `spaceId`. Two callers\n* passing the same set of inputs in different orders observe\n* byte-identical outputs.\n* - The per-space planner (`planSpace`) is called exactly once per\n* input, in alphabetical-by-spaceId order. Its return value is\n* attached to the corresponding output entry verbatim.\n* - Duplicate `spaceId`s in the input array throw\n* `MIGRATION.DUPLICATE_SPACE_ID` before any `planSpace` call runs,\n* keeping the planner pure when the input is malformed.\n*\n* The signature is generic over `TContract` and `TPackage` because the\n* shape is framework-neutral (SQL family today, Mongo family\n* eventually). Callers wire in whatever contract value and migration\n* package shape their family already speaks.\n*\n* Synchronous: the underlying per-space planner (target's\n* `MigrationPlanner.plan(...)`) is synchronous; callers that need to\n* resolve async I/O (e.g. reading on-disk `contract.json` from disk)\n* resolve it before calling `planAllSpaces` and pass the materialised\n* inputs through.\n*/\nfunction planAllSpaces(inputs, planSpace) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const input of inputs) {\n\t\tif (seen.has(input.spaceId)) throw errorDuplicateSpaceId(input.spaceId);\n\t\tseen.add(input.spaceId);\n\t}\n\treturn [...inputs].sort((a, b) => {\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t}).map((input) => ({\n\t\tspaceId: input.spaceId,\n\t\tmigrationPackages: planSpace(input)\n\t}));\n}\n//#endregion\nexport { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };\n\n//# sourceMappingURL=spaces.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,gCAAgC,QAAQ;CAChD,MAAM,EAAE,aAAa,WAAW,GAAG,uBAAuB,OAAO;CACjE,MAAM,aAAa,mBAAmB;EACrC,QAAQ,OAAO;EACf,cAAc,OAAO;EACrB,SAAS;EACT,GAAG,UAAU,uBAAuB,OAAO,mBAAmB;EAC9D,GAAG,UAAU,eAAe,OAAO,WAAW;CAC/C,CAAC;CACD,IAAI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AAS,MAAM,gBAAgB,IAAI,SAAS,IAAI;CACrD;CACA,OAAO;EACN;EACA;CACD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,cAAc,QAAQ,WAAW;CACzC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,SAAS,QAAQ;EAC3B,IAAI,KAAK,IAAI,MAAM,OAAO,GAAG,MAAM,sBAAsB,MAAM,OAAO;EACtE,KAAK,IAAI,MAAM,OAAO;CACvB;CACA,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM;EACjC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,OAAO;CACR,CAAC,CAAC,CAAC,KAAK,WAAW;EAClB,SAAS,MAAM;EACf,mBAAmB,UAAU,KAAK;CACnC,EAAE;AACH"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from "./errors-SoLLYLtw-DMxVbVs9.mjs";
|
|
2
|
-
import { t as MANIFEST_FILE } from "./io-
|
|
2
|
+
import { t as MANIFEST_FILE } from "./io-DSQXOfBH-GRpmFG2F.mjs";
|
|
3
3
|
import { APP_SPACE_ID as APP_SPACE_ID$1, CONTRACT_SNAPSHOTS_DIRNAME } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { join } from "pathe";
|
|
5
5
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
6
|
-
//#region ../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-
|
|
6
|
+
//#region ../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-_vwt5LT0.mjs
|
|
7
7
|
/**
|
|
8
8
|
* Pattern a contract-space identifier must match. The constraint is
|
|
9
9
|
* filesystem-friendly: lowercase letters / digits / hyphen / underscore,
|
|
@@ -249,4 +249,4 @@ function verifyContractSpaces(inputs) {
|
|
|
249
249
|
//#endregion
|
|
250
250
|
export { isValidSpaceId as a, spaceMigrationDirectory as c, assertValidSpaceId as i, spaceRefsDirectory as l, RESERVED_SPACE_SUBDIR_NAMES as n, listContractSpaceDirectories as o, SPACE_REFS_DIRNAME as r, readContractSpaceHeadRef as s, APP_SPACE_ID$1 as t, verifyContractSpaces as u };
|
|
251
251
|
|
|
252
|
-
//# sourceMappingURL=verify-contract-spaces-
|
|
252
|
+
//# sourceMappingURL=verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-CrxvgpwD.mjs"],"sourcesContent":["import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from \"./errors-SoLLYLtw.mjs\";\nimport { t as MANIFEST_FILE } from \"./io-BmWQNxRP.mjs\";\nimport { join } from \"pathe\";\nimport { readFile, readdir, stat } from \"node:fs/promises\";\nimport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME } from \"@internal/framework-components/control\";\n//#region src/space-layout.ts\n/**\n* Pattern a contract-space identifier must match. The constraint is\n* filesystem-friendly: lowercase letters / digits / hyphen / underscore,\n* starts with a letter, max 64 characters.\n*/\nconst SPACE_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;\nfunction isValidSpaceId(spaceId) {\n\treturn SPACE_ID_PATTERN.test(spaceId);\n}\nfunction assertValidSpaceId(spaceId) {\n\tif (!isValidSpaceId(spaceId)) throw errorInvalidSpaceId(spaceId);\n}\n/**\n* Resolve the migrations subdirectory for a given contract space.\n*\n* Every contract space — including the app space (default `'app'`) —\n* lands under `<projectMigrationsDir>/<spaceId>/`. The space id is\n* validated against {@link SPACE_ID_PATTERN} because it becomes a\n* filesystem directory name verbatim.\n*\n* `projectMigrationsDir` is the project's top-level `migrations/`\n* directory; the helper does not assume anything about its absolute /\n* relative shape and is symmetric with `pathe.join`.\n*/\nfunction spaceMigrationDirectory(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\treturn join(projectMigrationsDir, spaceId);\n}\n/**\n* Per-space subdirectory name reserved for the ref store\n* (`migrations/<space>/<SPACE_REFS_DIRNAME>/*.json`). Single source of\n* truth: every helper that composes a per-space refs path imports this\n* constant, and the enumerator uses it (via\n* {@link RESERVED_SPACE_SUBDIR_NAMES}) to exclude reserved names from\n* the contract-space candidate list.\n*/\nconst SPACE_REFS_DIRNAME = \"refs\";\n/**\n* Names reserved under `migrations/` that must never be enumerated as a\n* phantom contract space: `SPACE_REFS_DIRNAME` (e.g. a top-level\n* `migrations/refs/` left in the wrong place) and\n* `CONTRACT_SNAPSHOTS_DIRNAME` (the migrations-root-wide contract\n* snapshot store, `migrations/snapshots/`).\n*/\nconst RESERVED_SPACE_SUBDIR_NAMES = /* @__PURE__ */ new Set([SPACE_REFS_DIRNAME, CONTRACT_SNAPSHOTS_DIRNAME]);\n/**\n* Resolve the per-space refs directory for `spaceMigrationsDir`\n* (typically the value returned by {@link spaceMigrationDirectory}).\n* Composes the canonical {@link SPACE_REFS_DIRNAME} so callers do not\n* hard-code the literal.\n*/\nfunction spaceRefsDirectory(spaceMigrationsDir) {\n\treturn join(spaceMigrationsDir, SPACE_REFS_DIRNAME);\n}\n//#endregion\n//#region src/read-contract-space-head-ref.ts\nfunction hasErrnoCode$1(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* Read the head ref (`hash` + `invariants`) for a contract space from\n* `<projectMigrationsDir>/<spaceId>/refs/head.json`.\n*\n* Returns `null` when the file does not exist (first emit). Surfaces\n* `MIGRATION.INVALID_JSON` / `MIGRATION.INVALID_REF_FILE` on a corrupt\n* `refs/head.json` so callers can distinguish \"no head ref on disk\"\n* (returns `null`) from \"head ref present but unreadable\" (throws).\n*\n* Validates the space id against `[a-z][a-z0-9_-]{0,63}` for the same\n* filesystem-safety reasons as the rest of the per-space helpers. The\n* helper is uniform across the app and extension spaces.\n*/\nasync function readContractSpaceHeadRef(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\tconst filePath = join(spaceRefsDirectory(spaceMigrationDirectory(projectMigrationsDir, spaceId)), \"head.json\");\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode$1(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(filePath, e instanceof Error ? e.message : String(e));\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null) throw errorInvalidRefFile(filePath, \"expected an object\");\n\tconst obj = parsed;\n\tif (typeof obj.hash !== \"string\") throw errorInvalidRefFile(filePath, \"expected an object with a string `hash` field\");\n\tif (!Array.isArray(obj.invariants) || obj.invariants.some((value) => typeof value !== \"string\")) throw errorInvalidRefFile(filePath, \"expected an object with an `invariants` array of strings\");\n\treturn {\n\t\thash: obj.hash,\n\t\tinvariants: obj.invariants\n\t};\n}\n//#endregion\n//#region src/verify-contract-spaces.ts\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* List the per-space subdirectories under\n* `<projectRoot>/migrations/`. Returns space-id directory names (sorted\n* alphabetically) — i.e. any non-dot-prefixed, non-reserved\n* ({@link RESERVED_SPACE_SUBDIR_NAMES}) subdirectory whose root does\n* **not** contain a `migration.json` manifest. The manifest is the\n* structural marker of a user-authored migration directory (see\n* `readMigrationsDir` in `./io`); directory names themselves belong to\n* the user and are not part of the contract. The reserved-name filter\n* keeps `migrations/snapshots/` (the contract snapshot store) from ever\n* being enumerated as a phantom contract space.\n*\n* Returns `[]` if the migrations directory does not exist (greenfield\n* project).\n*\n* Reads only the user's repo. **No descriptor import.** The caller\n* (verifier) feeds the result into {@link verifyContractSpaces} alongside\n* the loaded-space set and the marker rows.\n*/\nasync function listContractSpaceDirectories(projectMigrationsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = (await readdir(projectMigrationsDir, { withFileTypes: true })).map((d) => ({\n\t\t\tname: d.name,\n\t\t\tisDirectory: d.isDirectory()\n\t\t}));\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return [];\n\t\tthrow error;\n\t}\n\tconst namedCandidates = entries.filter((e) => e.isDirectory).map((e) => e.name).filter((name) => !name.startsWith(\".\")).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).sort();\n\treturn (await Promise.all(namedCandidates.map(async (name) => {\n\t\ttry {\n\t\t\tawait stat(join(projectMigrationsDir, name, MANIFEST_FILE));\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: true\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: false\n\t\t\t};\n\t\t\tthrow error;\n\t\t}\n\t}))).filter((c) => !c.isMigrationDir).map((c) => c.name);\n}\n/**\n* Pure structural verifier for the per-space mechanism. Aggregates the\n* three orphan / missing checks plus per-space hash and invariant\n* comparison.\n*\n* Algorithm:\n*\n* - For every extension space declared in `loadedSpaces` (`'app'`\n* excluded — the per-space verifier is scoped to extension spaces;\n* the app is verified through the aggregate path):\n* - If no contract-space dir on disk → `declaredButUnmigrated`.\n* - Else if `markerRowsBySpace` lacks an entry → no violation here;\n* the live-DB compare done outside this helper is where the\n* absence shows up.\n* - Else compare marker hash / invariants vs. on-disk head hash /\n* invariants → `hashMismatch` / `invariantsMismatch` on drift.\n* - For every contract-space dir on disk that is not in `loadedSpaces` →\n* `orphanSpaceDir`.\n* - For every marker row whose `space` is not in `loadedSpaces` →\n* `orphanMarker`. The app-space marker is always loaded (`'app'` is\n* in `loadedSpaces` by definition).\n*\n* Output is deterministic: violations are sorted first by `kind`\n* (`declaredButUnmigrated` → `orphanMarker` → `orphanSpaceDir` →\n* `hashMismatch` → `invariantsMismatch`) then by `spaceId`. Two callers\n* passing equivalent inputs see byte-identical violation lists.\n*\n* Synchronous, pure, no I/O. **Does not import the extension descriptor**\n* (the inputs are pre-resolved by the caller); the verifier reads only\n* the user repo, not `node_modules`.\n*/\nfunction verifyContractSpaces(inputs) {\n\tconst violations = [];\n\tfor (const spaceId of [...inputs.loadedSpaces].sort()) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tif (!inputs.spaceDirsOnDisk.includes(spaceId)) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"declaredButUnmigrated\",\n\t\t\t\tspaceId,\n\t\t\t\tremediation: `Extension '${spaceId}' is declared in extensions but has not been emitted; run \\`{bin} db migrate\\`.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst head = inputs.headRefsBySpace.get(spaceId);\n\t\tconst marker = inputs.markerRowsBySpace.get(spaceId);\n\t\tif (!head || !marker) continue;\n\t\tif (head.hash !== marker.hash) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tspaceId,\n\t\t\t\tpriorHeadHash: head.hash,\n\t\t\t\tmarkerHash: marker.hash,\n\t\t\t\tremediation: `Marker row for space '${spaceId}' is keyed at ${marker.hash}, but the on-disk ${join(\"migrations\", spaceId, \"contract.json\")} resolves to ${head.hash}. Run \\`{bin} db update\\` to advance the database, or \\`{bin} db migrate\\` if the descriptor was bumped without re-emitting.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst onDiskInvariants = [...head.invariants].sort();\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = onDiskInvariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) violations.push({\n\t\t\tkind: \"invariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tonDiskInvariants,\n\t\t\tmarkerInvariants: [...marker.invariants].sort(),\n\t\t\tremediation: `Marker row for space '${spaceId}' is missing invariants [${missing.map((s) => JSON.stringify(s)).join(\", \")}]. Run \\`{bin} db update\\` to apply the corresponding data-transform migrations.`\n\t\t});\n\t}\n\tfor (const dir of [...inputs.spaceDirsOnDisk].sort()) if (!inputs.loadedSpaces.has(dir)) violations.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: dir,\n\t\tremediation: `Orphan contract-space directory \\`${join(\"migrations\", dir)}/\\` for an extension not in extensions; remove the directory or re-add the extension.`\n\t});\n\tfor (const space of [...inputs.markerRowsBySpace.keys()].sort()) if (!inputs.loadedSpaces.has(space)) violations.push({\n\t\tkind: \"orphanMarker\",\n\t\tspaceId: space,\n\t\tremediation: `Orphan marker row for space '${space}' (no longer in extensions); remediation: manually delete the row from \\`prisma_contract.marker\\`.`\n\t});\n\tif (violations.length === 0) return { ok: true };\n\tconst kindOrder = {\n\t\tdeclaredButUnmigrated: 0,\n\t\torphanMarker: 1,\n\t\torphanSpaceDir: 2,\n\t\thashMismatch: 3,\n\t\tinvariantsMismatch: 4\n\t};\n\tviolations.sort((a, b) => {\n\t\tconst k = kindOrder[a.kind] - kindOrder[b.kind];\n\t\tif (k !== 0) return k;\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t});\n\treturn {\n\t\tok: false,\n\t\tviolations\n\t};\n}\n//#endregion\nexport { RESERVED_SPACE_SUBDIR_NAMES as a, isValidSpaceId as c, APP_SPACE_ID as i, spaceMigrationDirectory as l, verifyContractSpaces as n, SPACE_REFS_DIRNAME as o, readContractSpaceHeadRef as r, assertValidSpaceId as s, listContractSpaceDirectories as t, spaceRefsDirectory as u };\n\n//# sourceMappingURL=verify-contract-spaces-CrxvgpwD.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,mBAAmB;AACzB,SAAS,eAAe,SAAS;CAChC,OAAO,iBAAiB,KAAK,OAAO;AACrC;AACA,SAAS,mBAAmB,SAAS;CACpC,IAAI,CAAC,eAAe,OAAO,GAAG,MAAM,oBAA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uB;EACvB,cAAc;EACd,gBAAgB;EAChB,cAAc;EACd,oBAAoB;CACrB;CACA,WAAW,MAAM,GAAG,MAAM;EACzB,MAAM,IAAI,UAAU,EAAE,QAAQ,UAAU,EAAE;EAC1C,IAAI,MAAM,GAAG,OAAO;EACpB,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,OAAO;CACR,CAAC;CACD,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-_vwt5LT0.mjs"],"sourcesContent":["import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from \"./errors-SoLLYLtw.mjs\";\nimport { t as MANIFEST_FILE } from \"./io-DSQXOfBH.mjs\";\nimport { join } from \"pathe\";\nimport { readFile, readdir, stat } from \"node:fs/promises\";\nimport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME } from \"@internal/framework-components/control\";\n//#region src/space-layout.ts\n/**\n* Pattern a contract-space identifier must match. The constraint is\n* filesystem-friendly: lowercase letters / digits / hyphen / underscore,\n* starts with a letter, max 64 characters.\n*/\nconst SPACE_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;\nfunction isValidSpaceId(spaceId) {\n\treturn SPACE_ID_PATTERN.test(spaceId);\n}\nfunction assertValidSpaceId(spaceId) {\n\tif (!isValidSpaceId(spaceId)) throw errorInvalidSpaceId(spaceId);\n}\n/**\n* Resolve the migrations subdirectory for a given contract space.\n*\n* Every contract space — including the app space (default `'app'`) —\n* lands under `<projectMigrationsDir>/<spaceId>/`. The space id is\n* validated against {@link SPACE_ID_PATTERN} because it becomes a\n* filesystem directory name verbatim.\n*\n* `projectMigrationsDir` is the project's top-level `migrations/`\n* directory; the helper does not assume anything about its absolute /\n* relative shape and is symmetric with `pathe.join`.\n*/\nfunction spaceMigrationDirectory(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\treturn join(projectMigrationsDir, spaceId);\n}\n/**\n* Per-space subdirectory name reserved for the ref store\n* (`migrations/<space>/<SPACE_REFS_DIRNAME>/*.json`). Single source of\n* truth: every helper that composes a per-space refs path imports this\n* constant, and the enumerator uses it (via\n* {@link RESERVED_SPACE_SUBDIR_NAMES}) to exclude reserved names from\n* the contract-space candidate list.\n*/\nconst SPACE_REFS_DIRNAME = \"refs\";\n/**\n* Names reserved under `migrations/` that must never be enumerated as a\n* phantom contract space: `SPACE_REFS_DIRNAME` (e.g. a top-level\n* `migrations/refs/` left in the wrong place) and\n* `CONTRACT_SNAPSHOTS_DIRNAME` (the migrations-root-wide contract\n* snapshot store, `migrations/snapshots/`).\n*/\nconst RESERVED_SPACE_SUBDIR_NAMES = /* @__PURE__ */ new Set([SPACE_REFS_DIRNAME, CONTRACT_SNAPSHOTS_DIRNAME]);\n/**\n* Resolve the per-space refs directory for `spaceMigrationsDir`\n* (typically the value returned by {@link spaceMigrationDirectory}).\n* Composes the canonical {@link SPACE_REFS_DIRNAME} so callers do not\n* hard-code the literal.\n*/\nfunction spaceRefsDirectory(spaceMigrationsDir) {\n\treturn join(spaceMigrationsDir, SPACE_REFS_DIRNAME);\n}\n//#endregion\n//#region src/read-contract-space-head-ref.ts\nfunction hasErrnoCode$1(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* Read the head ref (`hash` + `invariants`) for a contract space from\n* `<projectMigrationsDir>/<spaceId>/refs/head.json`.\n*\n* Returns `null` when the file does not exist (first emit). Surfaces\n* `MIGRATION.INVALID_JSON` / `MIGRATION.INVALID_REF_FILE` on a corrupt\n* `refs/head.json` so callers can distinguish \"no head ref on disk\"\n* (returns `null`) from \"head ref present but unreadable\" (throws).\n*\n* Validates the space id against `[a-z][a-z0-9_-]{0,63}` for the same\n* filesystem-safety reasons as the rest of the per-space helpers. The\n* helper is uniform across the app and extension spaces.\n*/\nasync function readContractSpaceHeadRef(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\tconst filePath = join(spaceRefsDirectory(spaceMigrationDirectory(projectMigrationsDir, spaceId)), \"head.json\");\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode$1(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(filePath, e instanceof Error ? e.message : String(e));\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null) throw errorInvalidRefFile(filePath, \"expected an object\");\n\tconst obj = parsed;\n\tif (typeof obj.hash !== \"string\") throw errorInvalidRefFile(filePath, \"expected an object with a string `hash` field\");\n\tif (!Array.isArray(obj.invariants) || obj.invariants.some((value) => typeof value !== \"string\")) throw errorInvalidRefFile(filePath, \"expected an object with an `invariants` array of strings\");\n\treturn {\n\t\thash: obj.hash,\n\t\tinvariants: obj.invariants\n\t};\n}\n//#endregion\n//#region src/verify-contract-spaces.ts\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* List the per-space subdirectories under\n* `<projectRoot>/migrations/`. Returns space-id directory names (sorted\n* alphabetically) — i.e. any non-dot-prefixed, non-reserved\n* ({@link RESERVED_SPACE_SUBDIR_NAMES}) subdirectory whose root does\n* **not** contain a `migration.json` manifest. The manifest is the\n* structural marker of a user-authored migration directory (see\n* `readMigrationsDir` in `./io`); directory names themselves belong to\n* the user and are not part of the contract. The reserved-name filter\n* keeps `migrations/snapshots/` (the contract snapshot store) from ever\n* being enumerated as a phantom contract space.\n*\n* Returns `[]` if the migrations directory does not exist (greenfield\n* project).\n*\n* Reads only the user's repo. **No descriptor import.** The caller\n* (verifier) feeds the result into {@link verifyContractSpaces} alongside\n* the loaded-space set and the marker rows.\n*/\nasync function listContractSpaceDirectories(projectMigrationsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = (await readdir(projectMigrationsDir, { withFileTypes: true })).map((d) => ({\n\t\t\tname: d.name,\n\t\t\tisDirectory: d.isDirectory()\n\t\t}));\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return [];\n\t\tthrow error;\n\t}\n\tconst namedCandidates = entries.filter((e) => e.isDirectory).map((e) => e.name).filter((name) => !name.startsWith(\".\")).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).sort();\n\treturn (await Promise.all(namedCandidates.map(async (name) => {\n\t\ttry {\n\t\t\tawait stat(join(projectMigrationsDir, name, MANIFEST_FILE));\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: true\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: false\n\t\t\t};\n\t\t\tthrow error;\n\t\t}\n\t}))).filter((c) => !c.isMigrationDir).map((c) => c.name);\n}\n/**\n* Pure structural verifier for the per-space mechanism. Aggregates the\n* three orphan / missing checks plus per-space hash and invariant\n* comparison.\n*\n* Algorithm:\n*\n* - For every extension space declared in `loadedSpaces` (`'app'`\n* excluded — the per-space verifier is scoped to extension spaces;\n* the app is verified through the aggregate path):\n* - If no contract-space dir on disk → `declaredButUnmigrated`.\n* - Else if `markerRowsBySpace` lacks an entry → no violation here;\n* the live-DB compare done outside this helper is where the\n* absence shows up.\n* - Else compare marker hash / invariants vs. on-disk head hash /\n* invariants → `hashMismatch` / `invariantsMismatch` on drift.\n* - For every contract-space dir on disk that is not in `loadedSpaces` →\n* `orphanSpaceDir`.\n* - For every marker row whose `space` is not in `loadedSpaces` →\n* `orphanMarker`. The app-space marker is always loaded (`'app'` is\n* in `loadedSpaces` by definition).\n*\n* Output is deterministic: violations are sorted first by `kind`\n* (`declaredButUnmigrated` → `orphanMarker` → `orphanSpaceDir` →\n* `hashMismatch` → `invariantsMismatch`) then by `spaceId`. Two callers\n* passing equivalent inputs see byte-identical violation lists.\n*\n* Synchronous, pure, no I/O. **Does not import the extension descriptor**\n* (the inputs are pre-resolved by the caller); the verifier reads only\n* the user repo, not `node_modules`.\n*/\nfunction verifyContractSpaces(inputs) {\n\tconst violations = [];\n\tfor (const spaceId of [...inputs.loadedSpaces].sort()) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tif (!inputs.spaceDirsOnDisk.includes(spaceId)) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"declaredButUnmigrated\",\n\t\t\t\tspaceId,\n\t\t\t\tremediation: `Extension '${spaceId}' is declared in extensions but has not been emitted; run \\`{bin} db migrate\\`.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst head = inputs.headRefsBySpace.get(spaceId);\n\t\tconst marker = inputs.markerRowsBySpace.get(spaceId);\n\t\tif (!head || !marker) continue;\n\t\tif (head.hash !== marker.hash) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tspaceId,\n\t\t\t\tpriorHeadHash: head.hash,\n\t\t\t\tmarkerHash: marker.hash,\n\t\t\t\tremediation: `Marker row for space '${spaceId}' is keyed at ${marker.hash}, but the on-disk ${join(\"migrations\", spaceId, \"contract.json\")} resolves to ${head.hash}. Run \\`{bin} db update\\` to advance the database, or \\`{bin} db migrate\\` if the descriptor was bumped without re-emitting.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst onDiskInvariants = [...head.invariants].sort();\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = onDiskInvariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) violations.push({\n\t\t\tkind: \"invariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tonDiskInvariants,\n\t\t\tmarkerInvariants: [...marker.invariants].sort(),\n\t\t\tremediation: `Marker row for space '${spaceId}' is missing invariants [${missing.map((s) => JSON.stringify(s)).join(\", \")}]. Run \\`{bin} db update\\` to apply the corresponding data-transform migrations.`\n\t\t});\n\t}\n\tfor (const dir of [...inputs.spaceDirsOnDisk].sort()) if (!inputs.loadedSpaces.has(dir)) violations.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: dir,\n\t\tremediation: `Orphan contract-space directory \\`${join(\"migrations\", dir)}/\\` for an extension not in extensions; remove the directory or re-add the extension.`\n\t});\n\tfor (const space of [...inputs.markerRowsBySpace.keys()].sort()) if (!inputs.loadedSpaces.has(space)) violations.push({\n\t\tkind: \"orphanMarker\",\n\t\tspaceId: space,\n\t\tremediation: `Orphan marker row for space '${space}' (no longer in extensions); remediation: manually delete the row from \\`prisma_contract.marker\\`.`\n\t});\n\tif (violations.length === 0) return { ok: true };\n\tconst kindOrder = {\n\t\tdeclaredButUnmigrated: 0,\n\t\torphanMarker: 1,\n\t\torphanSpaceDir: 2,\n\t\thashMismatch: 3,\n\t\tinvariantsMismatch: 4\n\t};\n\tviolations.sort((a, b) => {\n\t\tconst k = kindOrder[a.kind] - kindOrder[b.kind];\n\t\tif (k !== 0) return k;\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t});\n\treturn {\n\t\tok: false,\n\t\tviolations\n\t};\n}\n//#endregion\nexport { RESERVED_SPACE_SUBDIR_NAMES as a, isValidSpaceId as c, APP_SPACE_ID as i, spaceMigrationDirectory as l, verifyContractSpaces as n, SPACE_REFS_DIRNAME as o, readContractSpaceHeadRef as r, assertValidSpaceId as s, listContractSpaceDirectories as t, spaceRefsDirectory as u };\n\n//# sourceMappingURL=verify-contract-spaces-_vwt5LT0.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,mBAAmB;AACzB,SAAS,eAAe,SAAS;CAChC,OAAO,iBAAiB,KAAK,OAAO;AACrC;AACA,SAAS,mBAAmB,SAAS;CACpC,IAAI,CAAC,eAAe,OAAO,GAAG,MAAM,oBAAoB,OAAO;AAChE;;;;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,gBAAgB;EAChB,cAAc;EACd,oBAAoB;CACrB;CACA,WAAW,MAAM,GAAG,MAAM;EACzB,MAAM,IAAI,UAAU,EAAE,QAAQ,UAAU,EAAE;EAC1C,IAAI,MAAM,GAAG,OAAO;EACpB,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,IAAI,EAAE,UAAU,EAAE,SAAS,OAAO;EAClC,OAAO;CACR,CAAC;CACD,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as getEmittedArtifactPaths } from "./exports-
|
|
2
|
-
import { B as executeContractEmit, g as disposeEmitQueue } from "./ref-
|
|
3
|
-
import { a as loadConfigForSections } from "./exports-
|
|
1
|
+
import { r as getEmittedArtifactPaths } from "./exports-DkJil2JJ-6p86L2r4.mjs";
|
|
2
|
+
import { B as executeContractEmit, g as disposeEmitQueue } from "./ref-DSvAirqq-oqBwkhgP.mjs";
|
|
3
|
+
import { a as loadConfigForSections } from "./exports-Do7_pH8Y.mjs";
|
|
4
4
|
import { extname, resolve } from "pathe";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs
|
|
6
6
|
const PLUGIN_NAME = "prisma-vite-plugin-contract-emit";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-toolchain",
|
|
3
|
-
"version": "8.0.0-rc.11-dev.
|
|
3
|
+
"version": "8.0.0-rc.11-dev.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.11-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.11-dev.12",
|
|
13
13
|
"@vercel/detect-agent": "^1.2.4",
|
|
14
14
|
"arktype": "^2.2.2",
|
|
15
15
|
"c12": "^3.3.4",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"wrap-ansi": "^10.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@internal/cli": "8.0.0-rc.11-dev.
|
|
33
|
-
"@internal/cli-telemetry": "8.0.0-rc.11-dev.
|
|
34
|
-
"@internal/config-loader": "8.0.0-rc.11-dev.
|
|
35
|
-
"@internal/emitter": "8.0.0-rc.11-dev.
|
|
36
|
-
"@internal/language-server": "8.0.0-rc.11-dev.
|
|
37
|
-
"@internal/migration-tools": "8.0.0-rc.11-dev.
|
|
38
|
-
"@internal/publish-surface": "8.0.0-rc.11-dev.
|
|
39
|
-
"@repo/tsconfig": "8.0.0-rc.11-dev.
|
|
40
|
-
"@repo/tsdown": "8.0.0-rc.11-dev.
|
|
41
|
-
"@internal/vite-plugin-contract-emit": "8.0.0-rc.11-dev.
|
|
32
|
+
"@internal/cli": "8.0.0-rc.11-dev.12",
|
|
33
|
+
"@internal/cli-telemetry": "8.0.0-rc.11-dev.12",
|
|
34
|
+
"@internal/config-loader": "8.0.0-rc.11-dev.12",
|
|
35
|
+
"@internal/emitter": "8.0.0-rc.11-dev.12",
|
|
36
|
+
"@internal/language-server": "8.0.0-rc.11-dev.12",
|
|
37
|
+
"@internal/migration-tools": "8.0.0-rc.11-dev.12",
|
|
38
|
+
"@internal/publish-surface": "8.0.0-rc.11-dev.12",
|
|
39
|
+
"@repo/tsconfig": "8.0.0-rc.11-dev.12",
|
|
40
|
+
"@repo/tsdown": "8.0.0-rc.11-dev.12",
|
|
41
|
+
"@internal/vite-plugin-contract-emit": "8.0.0-rc.11-dev.12",
|
|
42
42
|
"tsdown": "0.22.14",
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-B4HKshLQ.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.mjs"],"sourcesContent":["import { M as errorRefNotResolvable, N as errorSpaceHeadRefMissing, i as errorContractDeserializationFailed, p as errorHashNotInGraph, r as errorBundleNotFoundForGraphNode, t as MigrationToolsError } from \"../errors-SoLLYLtw.mjs\";\nimport { n as readContractSnapshotDts, r as readContractSnapshotJson, t as contractSnapshotDir } from \"../contract-snapshot-store-qGrwlGmt.mjs\";\nimport { s as readMigrationsDir } from \"../io-BmWQNxRP.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"../constants-CM-w38DQ.mjs\";\nimport { n as isGraphNode } from \"../graph-membership-DY1Onbc3.mjs\";\nimport { l as reconstructGraph, o as findPathWithDecision } from \"../migration-graph-CW4bMmTz.mjs\";\nimport { a as readRefsTolerant, r as readRef, t as HEAD_REF_NAME } from \"../refs-BpSpzdYB.mjs\";\nimport { c as isValidSpaceId, i as APP_SPACE_ID, l as spaceMigrationDirectory, r as readContractSpaceHeadRef, t as listContractSpaceDirectories, u as spaceRefsDirectory } from \"../verify-contract-spaces-CrxvgpwD.mjs\";\nimport { join } from \"pathe\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates, entityAt } from \"@internal/framework-components/ir\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\n//#region src/aggregate/aggregate.ts\nfunction contractAtMemoKey(hash, refName) {\n\treturn `${hash}\\0${refName ?? \"\"}`;\n}\nfunction deserializeContractAtPath(filePath, contractJson, deserializeContract) {\n\ttry {\n\t\treturn deserializeContract(contractJson);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) throw error;\n\t\tthrow errorContractDeserializationFailed(filePath, error instanceof Error ? error.message : String(error));\n\t}\n}\nasync function readContractSnapshotEntry(migrationsDir, hash, deserializeContract) {\n\tconst contractJson = await readContractSnapshotJson(migrationsDir, hash);\n\treturn {\n\t\tcontractJson,\n\t\tcontractDts: await readContractSnapshotDts(migrationsDir, hash),\n\t\tcontract: deserializeContractAtPath(join(contractSnapshotDir(migrationsDir, hash), \"contract.json\"), contractJson, deserializeContract)\n\t};\n}\nasync function resolveContractAt(args) {\n\tconst { hash, opts, refsDir, migrationsDir, packages, graph, deserializeContract } = args;\n\tconst refName = opts?.refName;\n\tif (refName !== void 0) {\n\t\tlet refEntry;\n\t\ttry {\n\t\t\trefEntry = await readRef(refsDir, refName);\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.UNKNOWN_REF\") refEntry = void 0;\n\t\t\telse throw error;\n\t\t}\n\t\tif (refEntry) {\n\t\t\tconst { contractJson, contractDts, contract } = await readContractSnapshotEntry(migrationsDir, refEntry.hash, deserializeContract);\n\t\t\treturn {\n\t\t\t\thash: refEntry.hash,\n\t\t\t\tcontractJson,\n\t\t\t\tcontractDts,\n\t\t\t\tcontract,\n\t\t\t\tprovenance: \"ref\"\n\t\t\t};\n\t\t}\n\t\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\t\thash,\n\t\t\tmigrationsDir,\n\t\t\tpackages,\n\t\t\tdeserializeContract,\n\t\t\texplicitLabel: refName\n\t\t});\n\t\tthrow errorRefNotResolvable(refName);\n\t}\n\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\thash,\n\t\tmigrationsDir,\n\t\tpackages,\n\t\tdeserializeContract\n\t});\n\tthrow errorHashNotInGraph(hash, graph);\n}\nasync function resolveGraphNodeContractAt(args) {\n\tconst { hash, migrationsDir, packages, deserializeContract, explicitLabel } = args;\n\tif (!packages.find((pkg) => pkg.metadata.to === hash)) throw errorBundleNotFoundForGraphNode(hash, explicitLabel);\n\tconst { contractJson, contractDts, contract } = await readContractSnapshotEntry(migrationsDir, hash, deserializeContract);\n\treturn {\n\t\thash,\n\t\tcontractJson,\n\t\tcontractDts,\n\t\tcontract,\n\t\tprovenance: \"graph-node\"\n\t};\n}\n/**\n* Resolve a contract space's head ref, asserting it is present. The apply/verify\n* engine only runs after `checkIntegrity` has refused on `headRefMissing`,\n* so a space reaching the planner / verifier without a head ref is a\n* programming error (the integrity gate was skipped), not a user-facing\n* state. The app space's head ref is always synthesised, so this only\n* ever guards an ungated extension space.\n*/\nfunction requireHeadRef(space) {\n\tif (space.headRef === null) throw new InternalError(`Contract space \"${space.spaceId}\" has no head ref; the integrity gate must refuse a missing head ref before planning or verifying.`);\n\treturn space.headRef;\n}\n/**\n* Build a {@link AggregateContractSpace} with lazily-memoised `graph()`,\n* `contract()`, and `contractAt()` facets.\n*\n* `graph()` reconstructs the migration graph from `packages` on first\n* call and caches it. `contract()` calls `resolveContract` on first call\n* and caches the result; a throwing `resolveContract` (e.g. a missing or\n* undeserializable on-disk contract) re-throws on each call rather than\n* caching a value — `checkIntegrity` surfaces that as `contractUnreadable`.\n* `contractAt()` materializes the contract at an arbitrary graph node with\n* the same resolution order as plan-time ref resolution: the ref's pointer\n* plus the store entry keyed by the pointer's hash first (when\n* `opts.refName` is set), else the contract snapshot store entry keyed by\n* the matching package's `to` hash.\n*/\nfunction createAggregateContractSpace(args) {\n\tconst { spaceId, packages, refs, headRef, refsDir, migrationsDir, resolveContract, deserializeContract } = args;\n\tlet graphMemo;\n\tlet contractMemo;\n\tconst contractAtMemo = /* @__PURE__ */ new Map();\n\tfunction spaceGraph() {\n\t\tgraphMemo ??= reconstructGraph(packages);\n\t\treturn graphMemo;\n\t}\n\treturn {\n\t\tspaceId,\n\t\tpackages,\n\t\trefs,\n\t\theadRef,\n\t\tgraph: spaceGraph,\n\t\tcontract() {\n\t\t\tcontractMemo ??= resolveContract();\n\t\t\treturn contractMemo;\n\t\t},\n\t\tasync contractAt(hash, opts) {\n\t\t\tconst key = contractAtMemoKey(hash, opts?.refName);\n\t\t\tconst cached = contractAtMemo.get(key);\n\t\t\tif (cached) return cached;\n\t\t\tconst result = await resolveContractAt({\n\t\t\t\thash,\n\t\t\t\topts,\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tpackages,\n\t\t\t\tgraph: spaceGraph(),\n\t\t\t\tdeserializeContract\n\t\t\t});\n\t\t\tcontractAtMemo.set(key, result);\n\t\t\treturn result;\n\t\t}\n\t};\n}\n/**\n* Collect the union of every namespace declared across all contract spaces of an\n* aggregate (app + extensions) and return a minimal object with the shape\n* `{ storage: { namespaces } }` suitable for passing to\n* `familyInstance.introspect`.\n*\n* Callers invoke this after the integrity gate (`buildContractSpaceAggregate`\n* with `checkContracts: true`), so every `space.contract()` call is safe —\n* no try/catch is needed here.\n*/\nfunction collectAggregateNamespaces(aggregate) {\n\tconst merged = {};\n\tfor (const space of aggregate.spaces()) for (const [key, ns] of Object.entries(space.contract().storage.namespaces)) {\n\t\tconst existing = merged[key];\n\t\tmerged[key] = existing === void 0 ? ns : mergeNamespaceEntries(existing, ns);\n\t}\n\treturn { storage: { namespaces: merged } };\n}\n/**\n* Union two contract spaces' declarations for the same namespace id, per\n* entity kind. Two spaces may legitimately share a namespace (e.g. both\n* declaring tables in `public`); element-level disjointness is enforced by\n* `checkIntegrity`, so the kind maps never collide on a name — replacing the\n* whole namespace would silently drop the earlier space's entities.\n*/\nfunction mergeNamespaceEntries(a, b) {\n\tconst entries = { ...a.entries };\n\tfor (const [entityKind, kindMap] of Object.entries(b.entries)) entries[entityKind] = {\n\t\t...entries[entityKind],\n\t\t...kindMap\n\t};\n\treturn {\n\t\t...a,\n\t\tentries\n\t};\n}\n/**\n* Assemble a {@link ContractSpaceAggregate} value from its contract spaces and a\n* `checkIntegrity` implementation. The query methods (`listSpaces` /\n* `hasSpace` / `space` / `spaces`) are derived here so every aggregate —\n* loader-built or test-built — shares one query surface: `app` first,\n* then `extensions` in the order supplied (the loader sorts them\n* lex-ascending by `spaceId`).\n*/\nfunction createContractSpaceAggregate(args) {\n\tconst { targetId, app, extensions, checkIntegrity } = args;\n\tconst ordered = [app, ...extensions];\n\tconst byId = new Map(ordered.map((m) => [m.spaceId, m]));\n\tconst spaceDeclares = (space, coordinate) => {\n\t\tconst key = coordinateKey(coordinate);\n\t\tfor (const coord of elementCoordinates(space.contract().storage)) if (coordinateKey(coord) === key) return true;\n\t\treturn false;\n\t};\n\treturn {\n\t\ttargetId,\n\t\tapp,\n\t\textensions,\n\t\tlistSpaces: () => ordered.map((m) => m.spaceId),\n\t\thasSpace: (id) => byId.has(id),\n\t\tspace: (id) => byId.get(id),\n\t\tspaces: () => ordered,\n\t\tdeclaresEntity: (coordinate) => ordered.some((space) => spaceDeclares(space, coordinate)),\n\t\tdeclaringSpaces: (coordinate) => ordered.filter((space) => spaceDeclares(space, coordinate)).map((s) => s.spaceId),\n\t\tcheckIntegrity\n\t};\n}\n//#endregion\n//#region src/aggregate/all-external.ts\nfunction isControlPolicy(value) {\n\treturn value === \"managed\" || value === \"tolerated\" || value === \"external\" || value === \"observed\";\n}\n/**\n* True when every storage element the contract declares resolves to the\n* `external` control policy (ADR 224) — element-level `control` first, the\n* contract's `defaultControlPolicy` otherwise. A contract with no storage\n* elements is vacuously all-external.\n*\n* This is the precondition for advancing a contract space's marker without\n* any migrations (the declared-state resolution the db-init aggregate\n* planner and `migrate` share): only when nothing in the space is\n* Prisma 8-managed can the storage structure be correct without a\n* migration having produced it. Any space that declares a managed element\n* but ships no migration graph is an authoring bug and must fail loudly.\n*/\nfunction allStorageElementsExternal(contract) {\n\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\tconst entity = entityAt(contract.storage, coordinate);\n\t\tconst declared = entity !== null && typeof entity === \"object\" ? blindCast(entity).control : void 0;\n\t\tif (effectiveControlPolicy(isControlPolicy(declared) ? declared : void 0, contract.defaultControlPolicy) !== \"external\") return false;\n\t}\n\treturn true;\n}\n//#endregion\n//#region src/aggregate/check-integrity.ts\n/**\n* Walk the loaded model and return **every** integrity violation — never\n* bailing at the first. Structurally-derivable violations (load-time\n* problems, self-edges, missing / unreachable head refs) are always\n* produced; layout-drift checks require `declaredExtensions`, and\n* contract / target / disjointness checks require `checkContracts`.\n*/\nfunction computeIntegrityViolations(input, opts) {\n\tconst violations = [];\n\tfor (const { space, problems, refProblems, headRefProblem, isApp } of input.spaces) {\n\t\tconst { spaceId } = space;\n\t\tfor (const problem of problems) violations.push(loadProblemToViolation(spaceId, problem));\n\t\tfor (const refProblem of refProblems) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: refProblem.refName,\n\t\t\tdetail: refProblem.detail\n\t\t});\n\t\tif (headRefProblem !== null) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: headRefProblem.refName,\n\t\t\tdetail: headRefProblem.detail\n\t\t});\n\t\tfor (const pkg of space.packages) {\n\t\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\t\tconst isSelfEdge = from === pkg.metadata.to;\n\t\t\tconst hasDataOp = pkg.ops.some((op) => op.operationClass === \"data\");\n\t\t\tif (isSelfEdge && !hasDataOp) violations.push({\n\t\t\t\tkind: \"sameSourceAndTarget\",\n\t\t\t\tspaceId,\n\t\t\t\tdirName: pkg.dirName,\n\t\t\t\thash: from\n\t\t\t});\n\t\t}\n\t\tviolations.push(...duplicateMigrationHashViolations(spaceId, space.packages));\n\t\tif (!isApp && headRefProblem === null) {\n\t\t\tif (space.headRef === null) violations.push({\n\t\t\t\tkind: \"headRefMissing\",\n\t\t\t\tspaceId\n\t\t\t});\n\t\t\telse if (space.packages.length > 0 && !headRefPresentInGraph(space, space.headRef.hash)) violations.push({\n\t\t\t\tkind: \"headRefNotInGraph\",\n\t\t\t\tspaceId,\n\t\t\t\thash: space.headRef.hash\n\t\t\t});\n\t\t}\n\t}\n\tif (opts?.declaredExtensions !== void 0) violations.push(...layoutViolations(input.spaces, opts.declaredExtensions));\n\tif (opts?.checkContracts === true) violations.push(...contractViolations(input));\n\treturn violations;\n}\nfunction loadProblemToViolation(spaceId, problem) {\n\tswitch (problem.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tkind: \"hashMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tstored: problem.stored,\n\t\t\tcomputed: problem.computed\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tkind: \"packageUnloadable\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tdetail: problem.detail\n\t\t};\n\t}\n}\nfunction duplicateMigrationHashViolations(spaceId, packages) {\n\tconst dirNamesByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst hash = pkg.metadata.migrationHash;\n\t\tconst dirNames = dirNamesByHash.get(hash);\n\t\tif (dirNames) dirNames.push(pkg.dirName);\n\t\telse dirNamesByHash.set(hash, [pkg.dirName]);\n\t}\n\tconst out = [];\n\tfor (const [migrationHash, dirNames] of dirNamesByHash) if (dirNames.length > 1) out.push({\n\t\tkind: \"duplicateMigrationHash\",\n\t\tspaceId,\n\t\tmigrationHash,\n\t\tdirNames: [...dirNames].sort()\n\t});\n\treturn out;\n}\n/**\n* Whether a space's head-ref hash is present in its reconstructed graph.\n* An empty graph is reachable only by the empty-contract sentinel.\n*/\nfunction headRefPresentInGraph(space, headHash) {\n\tconst graph = space.graph();\n\tif (graph.nodes.size === 0) return headHash === EMPTY_CONTRACT_HASH;\n\treturn graph.nodes.has(headHash);\n}\nfunction layoutViolations(spaces, declaredExtensions) {\n\tconst out = [];\n\tconst extensionSpaceIds = new Set(spaces.filter((s) => !s.isApp).map((s) => s.space.spaceId));\n\tconst declaredIds = new Set(declaredExtensions.map((d) => d.id));\n\tfor (const id of [...extensionSpaceIds].sort()) if (!declaredIds.has(id)) out.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: id\n\t});\n\tfor (const id of [...declaredIds].sort()) if (!extensionSpaceIds.has(id)) out.push({\n\t\tkind: \"declaredButUnmigrated\",\n\t\tspaceId: id\n\t});\n\treturn out;\n}\nfunction contractViolations(input) {\n\tconst out = [];\n\tconst elementClaimedBy = /* @__PURE__ */ new Map();\n\tconst elementLabel = /* @__PURE__ */ new Map();\n\tfor (const { space } of input.spaces) {\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = space.contract();\n\t\t} catch (error) {\n\t\t\tout.push({\n\t\t\t\tkind: \"contractUnreadable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tdetail: detailOf$1(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (contract.target !== input.targetId) out.push({\n\t\t\tkind: \"targetMismatch\",\n\t\t\tspaceId: space.spaceId,\n\t\t\texpected: input.targetId,\n\t\t\tactual: contract.target\n\t\t});\n\t\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\t\tconst key = coordinateKey(coordinate);\n\t\t\tconst claimers = elementClaimedBy.get(key);\n\t\t\tif (claimers) claimers.push(space.spaceId);\n\t\t\telse {\n\t\t\t\telementClaimedBy.set(key, [space.spaceId]);\n\t\t\t\telementLabel.set(key, `${coordinate.namespaceId}.${coordinate.entityName}`);\n\t\t\t}\n\t\t}\n\t}\n\tconst disjointness = [];\n\tfor (const [key, claimedBy] of elementClaimedBy) if (claimedBy.length > 1) {\n\t\tconst element = elementLabel.get(key) ?? key;\n\t\tdisjointness.push({\n\t\t\tkind: \"disjointness\",\n\t\t\telement,\n\t\t\tclaimedBy: [...claimedBy].sort()\n\t\t});\n\t}\n\tdisjointness.sort((a, b) => a.kind === \"disjointness\" && b.kind === \"disjointness\" ? a.element.localeCompare(b.element) : 0);\n\tout.push(...disjointness);\n\treturn out;\n}\nfunction detailOf$1(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n//#endregion\n//#region src/aggregate/fabricated-migration-edge.ts\nfunction buildFabricatedMigrationEdge(args) {\n\treturn {\n\t\tdirName: \"\",\n\t\tmigrationHash: args.destinationStorageHash,\n\t\tfrom: args.currentMarkerStorageHash ?? \"\",\n\t\tto: args.destinationStorageHash,\n\t\toperationCount: args.operationCount,\n\t\t...args.destinationContractJson !== void 0 ? { destinationContractJson: args.destinationContractJson } : {}\n\t};\n}\n//#endregion\n//#region src/aggregate/loader.ts\n/**\n* Build a tolerant, queryable {@link ContractSpaceAggregate} from on-disk\n* migration state plus the caller's live app contract.\n*\n* Building **never throws on disk content**: a hash- or\n* invariants-mismatched package is retained, an unparseable package is\n* omitted, a missing extension head ref leaves `headRef: null`, and an\n* unreadable on-disk contract defers its failure to `space.contract()`.\n* Every such problem is judged by {@link ContractSpaceAggregate.checkIntegrity}\n* rather than aborting the load. The only rejections are catastrophic I/O\n* (a `migrations/` that exists but is unreadable for reasons other than\n* absence).\n*\n* The app space's head ref is synthesised from the live contract's\n* storage hash (the app contract is authored independently of the\n* migration graph), and `app.contract()` returns the supplied contract.\n* Extension spaces read their contract, refs, and head ref from disk.\n*/\nasync function loadContractSpaceAggregate(input) {\n\tconst { migrationsDir, deserializeContract, appContract } = input;\n\tconst targetId = appContract.target;\n\tconst appState = await loadAppSpace(migrationsDir, appContract, deserializeContract);\n\tconst extensionStates = await loadExtensionSpaces(migrationsDir, deserializeContract);\n\tconst spaces = [appState, ...extensionStates];\n\treturn createContractSpaceAggregate({\n\t\ttargetId,\n\t\tapp: appState.space,\n\t\textensions: extensionStates.map((state) => state.space),\n\t\tcheckIntegrity: (opts) => computeIntegrityViolations({\n\t\t\ttargetId,\n\t\t\tspaces\n\t\t}, opts)\n\t});\n}\nasync function loadAppSpace(migrationsDir, appContract, deserializeContract) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, { migrationsDir });\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId: APP_SPACE_ID,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef: {\n\t\t\t\thash: appContract.storage.storageHash,\n\t\t\t\tinvariants: []\n\t\t\t},\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => appContract,\n\t\t\tdeserializeContract\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem: null,\n\t\tisApp: true\n\t};\n}\nasync function loadExtensionSpaces(migrationsDir, deserializeContract) {\n\tconst extensionIds = (await listContractSpaceDirectories(migrationsDir)).filter((name) => name !== APP_SPACE_ID).filter(isValidSpaceId).sort();\n\tconst states = [];\n\tfor (const spaceId of extensionIds) states.push(await loadExtensionSpace(migrationsDir, spaceId, deserializeContract));\n\treturn states;\n}\nasync function loadExtensionSpace(migrationsDir, spaceId, deserializeContract) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, spaceId);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, { migrationsDir });\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\tconst { headRef, problem: headRefProblem } = await readHeadRefTolerant(migrationsDir, spaceId);\n\tconst rawContract = await readRawContractDeferred(migrationsDir, spaceId, headRef);\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef,\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => deserializeContract(rawContract()),\n\t\t\tdeserializeContract\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem,\n\t\tisApp: false\n\t};\n}\n/**\n* Read an extension's head ref, distinguishing a *genuinely absent*\n* `head.json` (`headRef: null`, no problem — judged `headRefMissing`)\n* from one that *exists but cannot be parsed* (`headRef: null` plus a\n* problem — judged `refUnreadable`, not `headRefMissing`).\n* `readContractSpaceHeadRef` already returns `null` only for ENOENT and\n* throws for unparseable / schema-invalid content, so the throw is the\n* corruption signal. Construction never throws on disk content.\n*/\nfunction isToleratedRefHeadReadError(error) {\n\tif (MigrationToolsError.is(error)) return true;\n\tif (!(error instanceof Error)) return false;\n\tconst code = error.code;\n\treturn code === \"ENOENT\" || code === \"EISDIR\";\n}\nasync function readHeadRefTolerant(migrationsDir, spaceId) {\n\ttry {\n\t\treturn {\n\t\t\theadRef: await readContractSpaceHeadRef(migrationsDir, spaceId),\n\t\t\tproblem: null\n\t\t};\n\t} catch (error) {\n\t\tif (!isToleratedRefHeadReadError(error)) throw error;\n\t\treturn {\n\t\t\theadRef: null,\n\t\t\tproblem: {\n\t\t\t\trefName: HEAD_REF_NAME,\n\t\t\t\tdetail: detailOf(error)\n\t\t\t}\n\t\t};\n\t}\n}\nfunction detailOf(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\n/**\n* Read the raw contract snapshot-store entry eagerly (cheap I/O) but defer\n* its (throwing) failure to call time, so a missing or unparseable store\n* entry becomes a `contract()` throw — surfaced as `contractUnreadable` —\n* rather than a construction failure. When `headRef` is absent there is no\n* hash to resolve against the store, so the deferred call always throws;\n* `checkIntegrity` already reports that case as `headRefMissing`, and a\n* `checkContracts` pass surfaces the same space as `contractUnreadable`.\n*/\nasync function readRawContractDeferred(migrationsDir, spaceId, headRef) {\n\tif (headRef === null) return () => {\n\t\tthrow errorSpaceHeadRefMissing(spaceId);\n\t};\n\ttry {\n\t\tconst raw = await readContractSnapshotJson(migrationsDir, headRef.hash);\n\t\treturn () => raw;\n\t} catch (error) {\n\t\treturn () => {\n\t\t\tthrow error;\n\t\t};\n\t}\n}\n//#endregion\n//#region src/aggregate/strategies/plan-from-diff.ts\n/**\n* Plan a migration for a single contract space from a diff against the full\n* live schema, delegating to the family's `createPlanner(...).plan(...)`.\n*\n* The planner diffs the whole introspected schema, so it sees other contract\n* spaces' tables as \"extras\"; the orchestration hands the planner the\n* aggregate as an ownership oracle so it can ask, per extra, whether any\n* space owns it — a sibling-owned table is left untouched, so the planner\n* never emits a destructive drop for it, and this strategy holds no ownership\n* logic of its own. The schema is never pruned before planning: cross-space\n* foreign keys need every sibling table visible to the diff.\n*\n* The produced plan's `targetId` is set from `aggregateTargetId`\n* (the aggregate's ambient target). The family's planner does not\n* stamp `targetId` on the produced plan; the aggregate planner is\n* the single point that knows the target.\n*\n* Used by:\n*\n* - The app space by default (CLI policy\n* `ignoreGraphFor: { app.spaceId }`).\n* - Any extension space whose `headRef.invariants` is empty and whose\n* graph is non-empty (the all-external, zero-migration-package case is\n* handled directly by the aggregate planner without calling this).\n*/\nasync function planFromDiff(input) {\n\tconst plannerResult = await input.migrations.createPlanner(input.adapter).plan({\n\t\tcontract: input.space.contract(),\n\t\tschema: input.schemaIntrospection,\n\t\tpolicy: input.operationPolicy,\n\t\tfromContract: null,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tspaceId: input.space.spaceId,\n\t\townership: input.ownership,\n\t\tsnapshotsImportPath: \"\"\n\t});\n\tif (plannerResult.kind === \"failure\") return {\n\t\tkind: \"failure\",\n\t\tconflicts: plannerResult.conflicts\n\t};\n\tconst producedPlan = plannerResult.plan;\n\tconst plan = new Proxy(producedPlan, {\n\t\tget(target, prop) {\n\t\t\tif (prop === \"targetId\") return input.aggregateTargetId;\n\t\t\treturn Reflect.get(target, prop, target);\n\t\t},\n\t\thas(target, prop) {\n\t\t\tif (prop === \"targetId\") return true;\n\t\t\treturn Reflect.has(target, prop);\n\t\t}\n\t});\n\tconst destinationStorageHash = producedPlan.destination.storageHash;\n\tconst producedOps = await Promise.all(producedPlan.operations);\n\tconst destinationContract = input.space.contract();\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan,\n\t\t\tdisplayOps: producedOps,\n\t\t\tdestinationContract,\n\t\t\tstrategy: \"plan-from-diff\",\n\t\t\t...plannerResult.warnings && plannerResult.warnings.length > 0 ? { warnings: plannerResult.warnings } : {},\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: input.currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash,\n\t\t\t\toperationCount: producedOps.length,\n\t\t\t\tdestinationContractJson: destinationContract\n\t\t\t})]\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/strategies/resolve-recorded-path.ts\n/**\n* Resolve a contract space's hydrated migration graph to the path from the\n* live marker to `space.headRef.hash`, covering every required invariant.\n*\n* Pure synchronous function — no I/O. The aggregate's loader has\n* already integrity-checked every package and reconstructed the graph;\n* this resolves the path by looking up ops by `migrationHash` and\n* assembles a `MigrationPlan` with `targetId` set from the aggregate (no\n* placeholder cast).\n*\n* Required invariants are computed as `headRef.invariants \\ marker.invariants`\n* — the marker already declares some invariants satisfied; the path\n* only needs to provide the remainder. Mirrors today's\n* `computeExtensionSpaceApplyPath` semantics.\n*/\nfunction resolveRecordedPath(input) {\n\tconst { aggregateTargetId, space, currentMarker, refName } = input;\n\tconst headRef = requireHeadRef(space);\n\tconst graph = space.graph();\n\tconst packagesByMigrationHash = new Map(space.packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst fromHash = currentMarker?.storageHash ?? \"empty\";\n\tconst markerInvariants = new Set(currentMarker?.invariants ?? []);\n\tconst required = new Set(headRef.invariants.filter((id) => !markerInvariants.has(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, headRef.hash, {\n\t\trequired,\n\t\t...refName !== void 0 ? { refName } : {}\n\t});\n\tif (outcome.kind === \"unreachable\") return { kind: \"unreachable\" };\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tmissing: outcome.missing\n\t};\n\tconst pathOps = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tconst edgeRefs = [];\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByMigrationHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${space.spaceId}\". The hydrated migration graph and packagesByMigrationHash map are out of sync — this should be unreachable; report.`);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t\tedgeRefs.push({\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tdirName: edge.dirName,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\t...pkg.endContractJson !== void 0 ? { destinationContractJson: pkg.endContractJson } : {}\n\t\t});\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregateTargetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: pathOps,\n\t\t\t\tprovidedInvariants: [...providedInvariantsSet].sort()\n\t\t\t},\n\t\t\tdisplayOps: pathOps,\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"resolve-recorded-path\",\n\t\t\tmigrationEdges: edgeRefs,\n\t\t\tpathDecision: outcome.decision\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/planner.ts\n/**\n* Plan a migration across every contract space of a {@link ContractSpaceAggregate}.\n*\n* Per-space operation selection, in order; first match wins:\n*\n* 1. If `callerPolicy.ignoreGraphFor.has(space.spaceId)`:\n* - If `space.headRef.invariants` is empty → `planFromDiff`.\n* - Else → `policyConflict` (a diff-fabricated plan cannot satisfy\n* authored invariants).\n* 2. Else if `space.graph()` is non-empty AND `resolveRecordedPath`\n* succeeds → its result.\n* 3. Else if `space.graph()` is non-empty but unresolvable →\n* `extensionPathUnreachable` / `extensionPathUnsatisfiable`.\n* 4. Else (empty graph — the space ships no migration packages at all,\n* e.g. an all-external extension space like Supabase's `auth`/`storage`)\n* if `space.headRef.invariants` is empty → declare the no-op state\n* directly (zero ops, destination = head ref) without invoking the\n* family planner.\n* 5. Else → `extensionPathUnsatisfiable` (an empty graph cannot satisfy\n* non-empty invariants).\n*\n* Output `applyOrder` is `[...aggregate.extensions.map(spaceId), aggregate.app.spaceId]`\n* — extensions alphabetical, then app — matching today's\n* `concatenateSpaceApplyInputs` ordering. This preserves\n* `MigrationRunnerFailure.failingSpace` attribution byte-for-byte.\n*\n* Every emitted `MigrationPlan` has `targetId = aggregate.targetId`.\n* No placeholder cast; no patch step.\n*/\nasync function planMigration(input) {\n\tconst { aggregate, currentDBState, callerPolicy } = input;\n\tconst perSpace = /* @__PURE__ */ new Map();\n\tconst orderedSpaces = [...aggregate.extensions, aggregate.app];\n\tfor (const space of orderedSpaces) {\n\t\tconst currentMarker = currentDBState.markersBySpaceId.get(space.spaceId) ?? null;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst ignoreGraph = callerPolicy.ignoreGraphFor.has(space.spaceId);\n\t\tconst invariantsRequired = headRef.invariants.length > 0;\n\t\tif (ignoreGraph && invariantsRequired) return notOk({\n\t\t\tkind: \"policyConflict\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tdetail: `\\`callerPolicy.ignoreGraphFor\\` requested for space \"${space.spaceId}\", but the contract space declares non-empty head-ref invariants (${headRef.invariants.join(\", \")}). A plan built directly from the contract IR cannot satisfy authored invariants — the graph must be walked. Either remove \"${space.spaceId}\" from \\`ignoreGraphFor\\` or amend the on-disk head ref to declare zero invariants.`\n\t\t});\n\t\tif (ignoreGraph) {\n\t\t\tconst diffOutcome = await planFromDiff({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tcurrentMarker,\n\t\t\t\tspace,\n\t\t\t\townership: aggregate,\n\t\t\t\tschemaIntrospection: currentDBState.schemaIntrospection,\n\t\t\t\tadapter: input.adapter,\n\t\t\t\tmigrations: input.migrations,\n\t\t\t\tframeworkComponents: input.frameworkComponents,\n\t\t\t\toperationPolicy: input.operationPolicy\n\t\t\t});\n\t\t\tif (diffOutcome.kind === \"failure\") return notOk({\n\t\t\t\tkind: \"planFromDiffFailed\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tconflicts: diffOutcome.conflicts\n\t\t\t});\n\t\t\tperSpace.set(space.spaceId, diffOutcome.result);\n\t\t\tcontinue;\n\t\t}\n\t\tif (space.graph().nodes.size > 0) {\n\t\t\tconst resolved = resolveRecordedPath({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tspace,\n\t\t\t\tcurrentMarker\n\t\t\t});\n\t\t\tif (resolved.kind === \"ok\") {\n\t\t\t\tperSpace.set(space.spaceId, resolved.result);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (resolved.kind === \"unreachable\") return notOk({\n\t\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\ttarget: headRef.hash\n\t\t\t});\n\t\t\treturn notOk({\n\t\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tmissingInvariants: resolved.missing\n\t\t\t});\n\t\t}\n\t\tif (invariantsRequired) return notOk({\n\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tmissingInvariants: [...headRef.invariants].sort()\n\t\t});\n\t\tif (!allStorageElementsExternal(space.contract())) return notOk({\n\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\ttarget: headRef.hash\n\t\t});\n\t\tperSpace.set(space.spaceId, {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregate.targetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: []\n\t\t\t},\n\t\t\tdisplayOps: [],\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"declared-state\",\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash: headRef.hash,\n\t\t\t\toperationCount: 0\n\t\t\t})]\n\t\t});\n\t}\n\treturn ok({\n\t\tperSpace,\n\t\tapplyOrder: [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId]\n\t});\n}\nfunction pathIsUnder(path, prefix) {\n\tif (path.length < prefix.length) return false;\n\treturn prefix.every((segment, i) => path[i] === segment);\n}\n/**\n* Whether an issue's subject is a WHOLE top-level entity — as opposed to\n* something nested under one (e.g. a field, an index, or a policy). Calls\n* the injected `classify` capability, which resolves this from the issue's\n* node `nodeKind` (this aggregate never reaches into the node itself).\n* Absent `classify` (or a `classify` that returns nothing for this issue —\n* a family that doesn't classify) falls back to path shape: a\n* top-level entity's path is exactly its own name (one segment), so\n* anything deeper is nested.\n*/\nfunction isWholeEntityIssue(issue, classify) {\n\tconst granularity = classify?.(issue);\n\tif (granularity !== void 0) return granularity === \"entity\";\n\treturn issue.path.length === 1;\n}\n/**\n* A contract space's contract-satisfaction view. Strips the top-level entity\n* extras — the `not-expected` findings on whole-entity nodes (plus the\n* findings the differ's total descent reported under those entities). Those\n* belong to the standalone unclaimed-elements list\n* ({@link collectExtraElementCoordinates}), never a space's own verdict.\n*\n* Nested `not-expected` findings (an extra field on the space's own\n* declared entity…) and structural findings (an undeclared policy) are\n* the space's **own drift** and stay.\n*\n* The verdict recomputes from the surviving list: the per-space result is\n* issue-based (`ok` ⇔ the list is empty), so a space whose only failures\n* were top-level extras passes after the strip.\n*/\nfunction stripExtraFindings(result, classify) {\n\tconst droppedTablePaths = result.schema.issues.filter((issue) => issueOutcome(issue) === \"not-expected\" && isWholeEntityIssue(issue, classify)).map((issue) => issue.path);\n\tconst issues = result.schema.issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tif (classify?.(issue) === \"structural\") return true;\n\t\treturn !droppedTablePaths.some((prefix) => pathIsUnder(issue.path, prefix));\n\t});\n\tif (issues.length === result.schema.issues.length) return result;\n\tconst ok = issues.length === 0;\n\tconst { code: staleCode, ...envelope } = result;\n\treturn {\n\t\t...envelope,\n\t\tok,\n\t\t...ok ? {} : { code: result.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : result.summary,\n\t\tschema: {\n\t\t\tissues,\n\t\t\t...result.schema.warnings !== void 0 ? { warnings: result.schema.warnings } : {}\n\t\t}\n\t};\n}\n/**\n* The schema-IR entity coordinate a `not-expected` `SchemaDiffIssue`\n* addresses, when its subject is a whole top-level entity. A nested leaf\n* (a field, an index, a policy on an undeclared entity) has no entity of\n* its own to report here.\n*\n* The whole-entity's name is the last path segment: the differ builds each\n* path from its nodes' ids, so at a whole-entity finding the last segment is\n* exactly the entity name — for every family, whether or not it stamps a\n* granularity. The namespace segment only exists for namespace-qualified\n* paths (`['database', namespaceId, entityName]`); single-namespace families\n* (a flat `['database', entityName]`, or a bare `[entityName]`) have no\n* separate segment, so every entity they declare implicitly shares one\n* namespace — the same sentinel the aggregate's own coordinate walk uses\n* for those families.\n*\n* `entityKind` is asked from the injected `classifyEntityKind` capability —\n* this module never names a family entity kind itself. Absent a classifier\n* (the classifier-absent path-shape fallback, e.g. a document family) the\n* coordinate carries {@link UNCLASSIFIED_ENTITY_KIND}: no ownership\n* consumer queries `declaresEntity` for a family in that state today, so\n* nothing reads the value as true.\n*/\nfunction schemaDiffIssueCoordinate(issue, classify, classifyEntityKind) {\n\tif (!isWholeEntityIssue(issue, classify)) return void 0;\n\tconst entityName = issue.path[issue.path.length - 1];\n\tif (entityName === void 0) return void 0;\n\treturn {\n\t\tnamespaceId: issue.path.length === 3 ? issue.path[1] ?? UNBOUND_NAMESPACE_ID : UNBOUND_NAMESPACE_ID,\n\t\tentityKind: classifyEntityKind?.(issue) ?? \"unclassified-entity\",\n\t\tentityName\n\t};\n}\n/**\n* The schema-IR entity coordinates of every live element this contract\n* space's diff reports as `not-expected`, deduplicated. The verifier gathers\n* these across all spaces and keeps only the coordinates no contract space\n* declares — the standalone unclaimed-elements list, reported once for the\n* whole database.\n*/\nfunction collectExtraElementCoordinates(result, classify, classifyEntityKind) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const issue of result.schema.issues) {\n\t\tif (issueOutcome(issue) !== \"not-expected\") continue;\n\t\tconst coordinate = schemaDiffIssueCoordinate(issue, classify, classifyEntityKind);\n\t\tif (coordinate === void 0) continue;\n\t\tseen.set(coordinateKey(coordinate), coordinate);\n\t}\n\treturn [...seen.values()];\n}\n//#endregion\n//#region src/aggregate/verifier.ts\n/**\n* Verify a {@link ContractSpaceAggregate} against the live database\n* state. Bundles two checks:\n*\n* - `markerCheck` per contract space: compare the live marker row against the\n* space's `headRef.hash` + `headRef.invariants`. Absence is a\n* distinct kind, not an error (callers — `db verify` strict vs\n* `db init` precondition — choose how to interpret it).\n* - `schemaCheck`: two distinct outputs from the per-space diffs.\n* `perSpace` — each space verified against the **full**\n* introspected schema, then its extras stripped, leaving the space's\n* declared nodes (its contract-satisfaction view; verdict is\n* missing/mismatch only). `unclaimed` — the extras gathered\n* across every space, deduplicated, and filtered to the names no contract\n* space declares (via the passive aggregate's ownership query); reported\n* once for the database. No schema is pruned before verifying.\n*\n* `markerCheck.orphanMarkers` lists every marker row whose `space` is\n* not a contract space of the aggregate. `db verify` callers reject orphans;\n* future tooling may not.\n*\n* Pure synchronous function; no I/O. The caller (CLI) gathers\n* `markersBySpaceId` and `schemaIntrospection` ahead of the call.\n*/\nfunction verifyMigration(input) {\n\ttry {\n\t\treturn runVerifyMigration(input);\n\t} catch (error) {\n\t\treturn notOk({\n\t\t\tkind: \"introspectionFailure\",\n\t\t\tdetail: error instanceof Error ? error.message : String(error)\n\t\t});\n\t}\n}\nfunction runVerifyMigration(input) {\n\tconst { aggregate, markersBySpaceId, schemaIntrospection, mode, verifySchemaForSpace, classifySubjectGranularity, classifyEntityKind } = input;\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tconst aggregateSpaceIds = new Set(allSpaces.map((m) => m.spaceId));\n\tconst markerPerSpace = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst marker = markersBySpaceId.get(space.spaceId) ?? null;\n\t\tif (marker === null) {\n\t\t\tmarkerPerSpace.set(space.spaceId, { kind: \"absent\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst headRef = requireHeadRef(space);\n\t\tif (marker.storageHash !== headRef.hash) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tmarkerHash: marker.storageHash,\n\t\t\t\texpected: headRef.hash\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = headRef.invariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"missingInvariants\",\n\t\t\t\tmissing: [...missing].sort()\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tmarkerPerSpace.set(space.spaceId, { kind: \"ok\" });\n\t}\n\tconst orphanMarkers = [];\n\tfor (const [spaceId, row] of markersBySpaceId) if (row !== null && !aggregateSpaceIds.has(spaceId)) orphanMarkers.push({\n\t\tspaceId,\n\t\trow\n\t});\n\torphanMarkers.sort((a, b) => a.spaceId.localeCompare(b.spaceId));\n\tconst schemaPerSpace = /* @__PURE__ */ new Map();\n\tconst extraCoordinates = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst result = verifySchemaForSpace(schemaIntrospection, space, mode);\n\t\tschemaPerSpace.set(space.spaceId, stripExtraFindings(result, classifySubjectGranularity));\n\t\tfor (const coordinate of collectExtraElementCoordinates(result, classifySubjectGranularity, classifyEntityKind)) extraCoordinates.set(coordinateKey(coordinate), coordinate);\n\t}\n\tconst unclaimed = [...new Set([...extraCoordinates.values()].filter((coordinate) => !aggregate.declaresEntity(coordinate)).map((coordinate) => coordinate.entityName))].sort((a, b) => a.localeCompare(b));\n\treturn ok({\n\t\tmarkerCheck: {\n\t\t\tperSpace: markerPerSpace,\n\t\t\torphanMarkers\n\t\t},\n\t\tschemaCheck: {\n\t\t\tperSpace: schemaPerSpace,\n\t\t\tunclaimed\n\t\t}\n\t});\n}\n//#endregion\nexport { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration };\n\n//# sourceMappingURL=aggregate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,kBAAkB,MAAM,SAAS;CACzC,OAAO,GAAG,KAAK,IAAI,WAAW;AAC/B;AACA,SAAS,0BAA0B,UAAU,cAAc,qBAAqB;CAC/E,IAAI;EACH,OAAO,oBAAoB,YAAY;CACxC,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,GAAG,MAAM;EACzC,MAAM,mCAAmC,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;CAC1G;AACD;AACA,eAAe,0BAA0B,eAAe,MAAM,qBAAqB;CAClF,MAAM,eAAe,MAAM,yBAAyB,eAAe,IAAI;CACvE,OAAO;EACN;EACA,aAAa,MAAM,wBAAwB,eAAe,IAAI;EAC9D,UAAU,0BAA0B,KAAK,oBAAoB,eAAe,IAAI,GAAG,eAAe,GAAG,cAAc,mBAAmB;CACvI;AACD;AACA,eAAe,kBAAkB,MAAM;CACtC,MAAM,EAAE,MAAM,MAAM,SAAS,eAAe,UAAU,OAAO,wBAAwB;CACrF,MAAM,UAAU,MAAM;CACtB,IAAI,YAAY,KAAK,GAAG;EACvB,IAAI;EACJ,IAAI;GACH,WAAW,MAAM,QAAQ,SAAS,OAAO;EAC1C,SAAS,OAA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mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BK;WACM;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;;;;;;;;;;;;;;UAcD;WACC;WACA;;;;;;;;;;;UAWD;;;;;;WAMC,8BAA8B;;;;;WAK9B;;;;UAID;WACC;;KAEN;WACM;WACA;WACA;WACA;WACA,UAAU;;WAEV;WACA;WACA;WACA;WACA,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAyCX;WACC;WACA,mBAAmB;WACnB,MAAM;WACN,SAAS;EAClB,SAAS;EACT,YAAY;EACZ,WAAW,cAAc,OAAO,oBAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAkCpD,+BAA+B;WAC9B;WACA,KAAK;WACL,qBAAqB;EAC9B;EACA,SAAS;EACT,MAAM,aAAa;EACnB,mBAAmB;EACnB,eAAe,YAAY;EAC3B,gBAAgB,YAAY;EAC5B,eAAe,OAAO,iCAAiC;;;;;;;;;;;;iBAYxC,eAAe,OAAO,yBAAyB;;;;;;;;;;;;;;;;iBAgB/C,6BAA6B;WACnC;WACA,mBAAmB;WACnB,MAAM;WACN,SAAS;WACT;WACA;WACA,uBAAuB;WACvB,sBAAsB,iBAAiB;IAC9C;;;;;;;;;;;iBAWa,2BAA2B,WAAW;WAC5C;aACE,YAAY,SAAS,eAAe;;;;;;;;;;;iBAWhC,6BAA6B;WACnC;WACA,KAAK;WACL,qBAAqB;WACrB,iBAAiB,OAAO,mCAAmC;IAClE;;;;;;;;;;;;;;;;iBAgBa,2BAA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AED;WACC;WACA,OAAO;WACP,eAAe;;;;;;;WAOf;;;;;;;;;;;;;;;;;iBAiBM,oBAAoB,OAAO,4BAA4B;;;;;;;;;;KAUnE,2BAA2B,OAAO,oBAAoB;;;;;;;;KAQtD,8BAA8B,OAAO;;;;;;;;;UAShC;WACC,WAAW;WACX,kBAAkB,oBAAoB;WACtC;WACA;;;;;;;;WAQA,uBAAuB,iBAAiB,OAAO,wBAAwB,+BAA+B;;;;;;;;WAQtG,6BAA6B;;;;;;;;WAQ7B,qBAAqB;;;;;;;;KAQ3B;WACM;;WAEA;;WAEA;WACA;WACA;;WAEA;WACA;;UAED;WACC,UAAU,oBAAoB;WAC9B;aACE;aACA,KAAK;;;UAGR;;;;;;;WAOC,UAAU,oBAAoB;;;;;;;;WAQ9B;;UAED;WACC,aAAa;WACb,aAAa;;KAEnB;WACM;WACA;;KAEN,iBAAiB,OAAO,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;iBAyB7B,gBAAgB,OAAO,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domain-type-generation-CR9ECUau-DOlKbcaE.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-CR9ECUau.mjs"],"sourcesContent":["import { isSafeTypeExpression } from \"./type-expression-safety.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { renderImports, tsStringLiteral } from \"@internal/ts-render\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/emitter-errors.ts\nfunction emitterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/domain-type-generation.ts\nfunction serializeValue(value) {\n\tif (value === null) return \"null\";\n\tif (value === void 0) return \"undefined\";\n\tif (typeof value === \"string\") return tsStringLiteral(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (Array.isArray(value)) return `readonly [${value.map((v) => serializeValue(v)).join(\", \")}]`;\n\tif (typeof value === \"object\") {\n\t\tconst entries = [];\n\t\tfor (const [k, v] of Object.entries(value)) entries.push(`readonly ${serializeObjectKey(k)}: ${serializeValue(v)}`);\n\t\treturn `{ ${entries.join(\"; \")} }`;\n\t}\n\treturn \"unknown\";\n}\nfunction serializeObjectKey(key) {\n\tif (/^[$A-Z_a-z][$\\w]*$/.test(key)) return key;\n\treturn serializeValue(key);\n}\nfunction serializeNamespaceId(value) {\n\treturn `${serializeValue(value)} & NamespaceId`;\n}\nfunction serializeCrossReference(ref) {\n\treturn `{ readonly namespace: ${serializeNamespaceId(String(ref.namespace))}; readonly model: ${serializeValue(ref.model)}${ref.space !== void 0 ? `; readonly space: ${serializeValue(ref.space)}` : \"\"} }`;\n}\nfunction generateRootsType(roots) {\n\tif (!roots || Object.keys(roots).length === 0) return \"Record<string, never>\";\n\treturn `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join(\"; \")} }`;\n}\nfunction contractFieldModifierSuffix(field) {\n\treturn (field.many === true ? \"; readonly many: true\" : \"\") + (field.dict === true ? \"; readonly dict: true\" : \"\");\n}\nfunction generateModelFieldEntry(fieldName, field) {\n\tconst mods = contractFieldModifierSuffix(field);\n\tconst { nullable, type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${mods} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;\n}\nfunction generateModelFieldsType(fields) {\n\tconst fieldEntries = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) fieldEntries.push(generateModelFieldEntry(fieldName, field));\n\treturn fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n}\nfunction generateModelRelationsType(relations) {\n\tconst relationEntries = [];\n\tfor (const [relName, rel] of Object.entries(relations)) {\n\t\tif (typeof rel !== \"object\" || rel === null) continue;\n\t\tconst relObj = rel;\n\t\tconst toRef = relObj[\"to\"];\n\t\tif (toRef !== null && typeof toRef === \"object\" && \"space\" in toRef && toRef.space !== void 0) {\n\t\t\trelationEntries.push(`readonly ${serializeObjectKey(relName)}: never`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst parts = [];\n\t\tif (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);\n\t\tif (relObj[\"cardinality\"]) parts.push(`readonly cardinality: ${serializeValue(relObj[\"cardinality\"])}`);\n\t\tif (typeof relObj[\"nullable\"] === \"boolean\") parts.push(`readonly nullable: ${relObj[\"nullable\"]}`);\n\t\tconst on = relObj[\"on\"];\n\t\tif (on && (!on.localFields || !on.targetFields)) throw emitterError(\"CONTRACT.RELATION_INVALID\", `Relation \"${relName}\" has an \"on\" block but is missing localFields or targetFields`, { meta: { relation: relName } });\n\t\tif (on?.localFields && on.targetFields) {\n\t\t\tconst localFields = on.localFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tconst targetFields = on.targetFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tparts.push(`readonly on: { readonly localFields: readonly [${localFields}]; readonly targetFields: readonly [${targetFields}] }`);\n\t\t}\n\t\tif (relObj[\"cardinality\"] === \"N:M\") {\n\t\t\tconst { through } = blindCast(relObj);\n\t\t\tconst table = serializeValue(through.table);\n\t\t\tconst namespaceId = serializeValue(through.namespaceId);\n\t\t\tconst parentColumns = through.parentColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst childColumns = through.childColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst targetColumns = through.targetColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tparts.push(`readonly through: { readonly table: ${table}; readonly namespaceId: ${namespaceId}; readonly parentColumns: readonly [${parentColumns}]; readonly childColumns: readonly [${childColumns}]; readonly targetColumns: readonly [${targetColumns}] }`);\n\t\t}\n\t\tif (parts.length > 0) relationEntries.push(`readonly ${serializeObjectKey(relName)}: { ${parts.join(\"; \")} }`);\n\t}\n\tif (relationEntries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${relationEntries.join(\"; \")} }`;\n}\nfunction generateModelsType(models, generateModelStorage) {\n\tif (!models || Object.keys(models).length === 0) return \"Record<string, never>\";\n\tconst modelTypes = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst fieldsType = generateModelFieldsType(model.fields);\n\t\tconst relationsType = generateModelRelationsType(model.relations);\n\t\tconst storageType = generateModelStorage(modelName, model);\n\t\tconst modelParts = [\n\t\t\t`readonly fields: ${fieldsType}`,\n\t\t\t`readonly relations: ${relationsType}`,\n\t\t\t`readonly storage: ${storageType}`\n\t\t];\n\t\tif (model.owner) modelParts.push(`readonly owner: ${serializeValue(model.owner)}`);\n\t\tif (model.discriminator) modelParts.push(`readonly discriminator: ${serializeValue(model.discriminator)}`);\n\t\tif (model.variants) modelParts.push(`readonly variants: ${serializeValue(model.variants)}`);\n\t\tif (model.base) modelParts.push(`readonly base: ${serializeCrossReference(model.base)}`);\n\t\tmodelTypes.push(`readonly ${serializeObjectKey(modelName)}: { ${modelParts.join(\"; \")} }`);\n\t}\n\treturn `{ ${modelTypes.join(\"; \")} }`;\n}\nfunction deduplicateImports(imports) {\n\tconst seenKeys = /* @__PURE__ */ new Set();\n\tconst result = [];\n\tfor (const imp of imports) {\n\t\tconst key = `${imp.package}::${imp.named}`;\n\t\tif (!seenKeys.has(key)) {\n\t\t\tseenKeys.add(key);\n\t\t\tresult.push(imp);\n\t\t}\n\t}\n\treturn result;\n}\nfunction generateImportLines(imports, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst rendered = renderImports(imports.map((imp) => ({\n\t\tmoduleSpecifier: resolveImportSpecifier(imp.package),\n\t\tsymbol: imp.named,\n\t\talias: imp.alias,\n\t\ttypeOnly: true\n\t})));\n\treturn rendered === \"\" ? [] : rendered.split(\"\\n\");\n}\nfunction generateCodecTypeIntersection(imports, named) {\n\treturn imports.filter((imp) => imp.named === named).map((imp) => imp.alias).join(\" & \") || \"Record<string, never>\";\n}\nfunction serializeExecutionType(execution) {\n\tconst parts = [\"readonly executionHash: ExecutionHash\"];\n\tfor (const [key, value] of Object.entries(execution)) {\n\t\tif (key === \"executionHash\") continue;\n\t\tparts.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nfunction generateHashTypeAliases(hashes) {\n\tconst executionHashType = hashes.executionHash ? `ExecutionHashBase<${serializeValue(hashes.executionHash)}>` : \"ExecutionHashBase<string>\";\n\treturn [\n\t\t`export type StorageHash = StorageHashBase<${serializeValue(hashes.storageHash)}>;`,\n\t\t`export type ExecutionHash = ${executionHashType};`,\n\t\t`export type ProfileHash = ProfileHashBase<${serializeValue(hashes.profileHash)}>;`\n\t].join(\"\\n\");\n}\nfunction applyModifiers(base, field) {\n\tlet result = base;\n\tif (field.many === true) result = `ReadonlyArray<${result}>`;\n\tif (field.dict === true) result = `Readonly<Record<string, ${result}>>`;\n\tif (field.nullable) result = `${result} | null`;\n\treturn result;\n}\n/**\n* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by\n* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not\n* a generic serializer. `side`: `output` = read type, `input` = create/update type.\n*\n* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when\n* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value\n* isn't literal-expressible. A caller that needs column and field types to agree shares this so both\n* compute the union identically.\n*/\nfunction renderValueSetType(values, codecId, side, codecLookup) {\n\tif (values.length === 0 || codecLookup?.renderValueLiteralFor === void 0) return void 0;\n\tconst literals = [];\n\tfor (const value of values) {\n\t\tconst lit = codecLookup.renderValueLiteralFor(codecId, value, side);\n\t\tif (lit === void 0 || !isSafeTypeExpression(lit)) return void 0;\n\t\tliterals.push(lit);\n\t}\n\treturn literals.join(\" | \");\n}\nfunction resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet) {\n\tconst { type } = field;\n\tswitch (type.kind) {\n\t\tcase \"scalar\": {\n\t\t\tif (resolvedValueSet) {\n\t\t\t\tconst output = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"output\", codecLookup);\n\t\t\t\tconst input = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"input\", codecLookup);\n\t\t\t\tif (output !== void 0 && input !== void 0) return {\n\t\t\t\t\toutput: applyModifiers(output, field),\n\t\t\t\t\tinput: applyModifiers(input, field)\n\t\t\t\t};\n\t\t\t}\n\t\t\tlet outputResolved;\n\t\t\tlet inputResolved;\n\t\t\tconst effectiveTypeParams = (type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0) ?? resolvedTypeParams;\n\t\t\tif (codecLookup && effectiveTypeParams && Object.keys(effectiveTypeParams).length > 0) {\n\t\t\t\tconst rendered = codecLookup.renderOutputTypeFor(type.codecId, effectiveTypeParams);\n\t\t\t\tif (rendered && isSafeTypeExpression(rendered)) outputResolved = rendered;\n\t\t\t\tconst renderedInput = codecLookup.renderInputTypeFor?.(type.codecId, effectiveTypeParams);\n\t\t\t\tif (renderedInput && isSafeTypeExpression(renderedInput)) inputResolved = renderedInput;\n\t\t\t}\n\t\t\tconst codecAccessor = `CodecTypes[${serializeValue(type.codecId)}]`;\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(outputResolved ?? `${codecAccessor}[\"output\"]`, field),\n\t\t\t\tinput: applyModifiers(inputResolved ?? `${codecAccessor}[\"input\"]`, field)\n\t\t\t};\n\t\t}\n\t\tcase \"valueObject\": return {\n\t\t\toutput: applyModifiers(`${type.name}Output`, field),\n\t\t\tinput: applyModifiers(`${type.name}Input`, field)\n\t\t};\n\t\tcase \"union\": {\n\t\t\tconst outputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}][\"output\"]` : `${m.name}Output`);\n\t\t\tconst inputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}][\"input\"]` : `${m.name}Input`);\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(outputMembers.join(\" | \"), field),\n\t\t\t\tinput: applyModifiers(inputMembers.join(\" | \"), field)\n\t\t\t};\n\t\t}\n\t\tdefault: return {\n\t\t\toutput: applyModifiers(\"unknown\", field),\n\t\t\tinput: applyModifiers(\"unknown\", field)\n\t\t};\n\t}\n}\nfunction generateFieldResolvedType(field, codecLookup, side = \"output\") {\n\treturn resolveFieldType(field, codecLookup)[side];\n}\n/**\n* Resolves one model field's input and output types the way `FieldOutputTypes` /\n* `FieldInputTypes` do: inline type params win over the family resolver, and a family-resolved\n* value set renders as a literal union.\n*/\nfunction resolveModelFieldType(modelName, fieldName, field, model, resolvers) {\n\tconst resolvedTypeParams = (field.type.kind === \"scalar\" && field.type.typeParams && Object.keys(field.type.typeParams).length > 0 ? field.type.typeParams : void 0) ?? resolvers.resolveFieldTypeParams?.(modelName, fieldName, model);\n\tconst resolvedValueSet = resolvers.resolveFieldValueSet?.(modelName, fieldName, model);\n\treturn resolveFieldType(field, resolvers.codecLookup, resolvedTypeParams, resolvedValueSet);\n}\nfunction generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {\n\tif (!models || Object.keys(models).length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst resolvers = {\n\t\tcodecLookup,\n\t\tresolveFieldTypeParams,\n\t\tresolveFieldValueSet\n\t};\n\tconst outputModelEntries = [];\n\tconst inputModelEntries = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tif (!model) continue;\n\t\tconst outputFieldEntries = [];\n\t\tconst inputFieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(model.fields)) {\n\t\t\tconst resolved = resolveModelFieldType(modelName, fieldName, field, model, resolvers);\n\t\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\t\toutputFieldEntries.push(`${key}: ${resolved.output}`);\n\t\t\tinputFieldEntries.push(`${key}: ${resolved.input}`);\n\t\t}\n\t\tconst outputFields = outputFieldEntries.length > 0 ? `{ ${outputFieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tconst inputFields = inputFieldEntries.length > 0 ? `{ ${inputFieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tconst modelKey = `readonly ${serializeObjectKey(modelName)}`;\n\t\toutputModelEntries.push(`${modelKey}: ${outputFields}`);\n\t\tinputModelEntries.push(`${modelKey}: ${inputFields}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputModelEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputModelEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldTypesMapsByNamespace(namespaceModels, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {\n\tif (namespaceModels.length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst outputNamespaceEntries = [];\n\tconst inputNamespaceEntries = [];\n\tfor (const [nsId, models] of namespaceModels) {\n\t\tconst inner = generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet);\n\t\tconst nsKey = `readonly ${serializeObjectKey(nsId)}`;\n\t\toutputNamespaceEntries.push(`${nsKey}: ${inner.output}`);\n\t\tinputNamespaceEntries.push(`${nsKey}: ${inner.input}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputNamespaceEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputNamespaceEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldOutputTypesMap(models, codecLookup, resolveFieldTypeParams) {\n\treturn generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).output;\n}\nfunction generateFieldInputTypesMap(models, codecLookup, resolveFieldTypeParams) {\n\treturn generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).input;\n}\nfunction generateValueObjectType(_voName, vo, _valueObjects, side = \"output\", codecLookup) {\n\treturn resolveValueObjectType(_voName, vo, _valueObjects, codecLookup)[side];\n}\nfunction resolveValueObjectType(_voName, vo, _valueObjects, codecLookup) {\n\tconst outputEntries = [];\n\tconst inputEntries = [];\n\tfor (const [fieldName, field] of Object.entries(vo.fields)) {\n\t\tconst resolved = resolveFieldType(field, codecLookup);\n\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\toutputEntries.push(`${key}: ${resolved.output}`);\n\t\tinputEntries.push(`${key}: ${resolved.input}`);\n\t}\n\tconst empty = \"Record<string, never>\";\n\treturn {\n\t\toutput: outputEntries.length > 0 ? `{ ${outputEntries.join(\"; \")} }` : empty,\n\t\tinput: inputEntries.length > 0 ? `{ ${inputEntries.join(\"; \")} }` : empty\n\t};\n}\nfunction generateContractFieldDescriptor(fieldName, field) {\n\tconst mods = [];\n\tif (field.many === true) mods.push(\"; readonly many: true\");\n\tif (field.dict === true) mods.push(\"; readonly dict: true\");\n\tconst modStr = mods.join(\"\");\n\tconst { type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${modStr} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;\n}\nfunction generateValueObjectsDescriptorType(valueObjects) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"Record<string, never>\";\n\tconst voEntries = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst fieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(vo.fields)) fieldEntries.push(generateContractFieldDescriptor(fieldName, field));\n\t\tconst fieldsType = fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tvoEntries.push(`readonly ${serializeObjectKey(voName)}: { readonly fields: ${fieldsType} }`);\n\t}\n\treturn `{ ${voEntries.join(\"; \")} }`;\n}\nfunction generateValueObjectTypeAliases(valueObjects, codecLookup) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"\";\n\tconst aliases = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst resolved = resolveValueObjectType(voName, vo, valueObjects, codecLookup);\n\t\taliases.push(`export type ${voName}Output = ${resolved.output};`);\n\t\taliases.push(`export type ${voName}Input = ${resolved.input};`);\n\t}\n\treturn aliases.join(\"\\n\");\n}\n//#endregion\nexport { serializeCrossReference as C, serializeValue as D, serializeObjectKey as E, emitterError as O, resolveValueObjectType as S, serializeNamespaceId as T, generateValueObjectTypeAliases as _, generateFieldInputTypesMap as a, resolveFieldType as b, generateFieldTypesMapsByNamespace as c, generateModelFieldEntry as d, generateModelFieldsType as f, generateValueObjectType as g, generateRootsType as h, generateContractFieldDescriptor as i, generateHashTypeAliases as l, generateModelsType as m, generateBothFieldTypesMaps as n, generateFieldOutputTypesMap as o, generateModelRelationsType as p, generateCodecTypeIntersection as r, generateFieldResolvedType as s, deduplicateImports as t, generateImportLines as u, generateValueObjectsDescriptorType as v, serializeExecutionType as w, resolveModelFieldType as x, renderValueSetType as y };\n\n//# sourceMappingURL=domain-type-generation-CR9ECUau.mjs.map"],"mappings":";;;;;;AAMA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,eAAe,OAAO;CAC9B,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,UAAU,KAAK,GAAG,OAAO;CAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,aAAa,MAAM,KAAK,MAAM,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;CAC7F,IAAI,OAAO,UAAU,UAAU;EAC9B,MAAM,UAAU,CAAC;EACjB,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,KAAK,GAAG,QAAQ,KAAK,YAAY,mBAAmB,CAAC,EAAE,IAAI,eAAe,CAAC,GAAG;EAClH,OAAO,KAAK,QAAQ,KAAK,IAAI,EAAE;CAChC;CACA,OAAO;AACR;AACA,SAAS,mBAAmB,KAAK;CAChC,IAAI,qBAAqB,KAAK,GAAG,GAAG,OAAO;CAC3C,OAAO,eAAe,GAAG;AAC1B;AACA,SAAS,qBAAqB,OAAO;CACpC,OAAO,GAAG,eAAe,KAAK,EAAE;AACjC;AACA,SAAS,wBAAwB,KAAK;CACrC,OAAO,yBAAyB,qBAAqB,OAAO,IAAI,SAAS,CAAC,EAAE,oBAAoB,eAAe,IAAI,KAAK,IAAI,IAAI,UAAU,KAAK,IAAI,qBAAqB,eAAe,IAAI,KAAK,MAAM,GA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