@prisma/orm-toolchain 8.0.0-rc.24-dev.43 → 8.0.0-rc.24-dev.44

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.
Files changed (91) hide show
  1. package/dist/{aggregate-D7dLfF9a.mjs → aggregate-B2D5REGs.mjs} +9 -9
  2. package/dist/{aggregate-D7dLfF9a.mjs.map → aggregate-B2D5REGs.mjs.map} +1 -1
  3. package/dist/{aggregate-BMh4SLep.d.mts → aggregate-CvDNKQbR.d.mts} +5 -5
  4. package/dist/{aggregate-BMh4SLep.d.mts.map → aggregate-CvDNKQbR.d.mts.map} +1 -1
  5. package/dist/{caught-errors-D8Hn_D5h-C4BJDZ5y.mjs → caught-errors-DZXnK8Ls-zVmM4nr3.mjs} +577 -49
  6. package/dist/caught-errors-DZXnK8Ls-zVmM4nr3.mjs.map +1 -0
  7. package/dist/cli-telemetry.mjs +1 -1
  8. package/dist/cli.d.mts +1 -1
  9. package/dist/cli.mjs +189 -70
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/cli__control-api.d.mts +12 -59
  12. package/dist/cli__control-api.d.mts.map +1 -1
  13. package/dist/cli__control-api.mjs +2 -2
  14. package/dist/cli__control-api__testing.d.mts +1 -1
  15. package/dist/cli__migration-cli.mjs +4 -4
  16. package/dist/cli__migration-cli.mjs.map +1 -1
  17. package/dist/config-loader.mjs +1 -1
  18. package/dist/contract-snapshot-store-D-s2aKZY.d.mts +2 -0
  19. package/dist/{contract-snapshot-store-DRAG5XXy-DOvf98Np.d.mts → contract-snapshot-store-DRAG5XXy-ChW4hBLb.d.mts} +2 -2
  20. package/dist/{contract-snapshot-store-DRAG5XXy-DOvf98Np.d.mts.map → contract-snapshot-store-DRAG5XXy-ChW4hBLb.d.mts.map} +1 -1
  21. package/dist/{contract-snapshot-store-Ds7lE7vL-Dn444yIq.mjs → contract-snapshot-store-Dl6v-Uxr-CwhnMsgc.mjs} +4 -4
  22. package/dist/{contract-snapshot-store-Ds7lE7vL-Dn444yIq.mjs.map → contract-snapshot-store-Dl6v-Uxr-CwhnMsgc.mjs.map} +1 -1
  23. package/dist/{db-sign-DLIR5swa-CMgFrBoH.d.mts → db-sign-BQMw6RX9-Stp7Gjj7.d.mts} +187 -18
  24. package/dist/db-sign-BQMw6RX9-Stp7Gjj7.d.mts.map +1 -0
  25. package/dist/{domain-type-generation-BGcbGgHJ-Cdw5RNaZ.mjs → domain-type-generation-BGcbGgHJ-SB6n89eE.mjs} +3 -3
  26. package/dist/{domain-type-generation-BGcbGgHJ-Cdw5RNaZ.mjs.map → domain-type-generation-BGcbGgHJ-SB6n89eE.mjs.map} +1 -1
  27. package/dist/emitter.mjs +2 -2
  28. package/dist/emitter__domain-type-generation.mjs +1 -1
  29. package/dist/{errors-BMq40nYH-Cg8PBect.mjs → errors-BlaB9AFz-CZDOC0mV.mjs} +8 -10
  30. package/dist/{errors-BMq40nYH-Cg8PBect.mjs.map → errors-BlaB9AFz-CZDOC0mV.mjs.map} +1 -1
  31. package/dist/{exports-BiXPktAF.mjs → exports-B0yFVod3.mjs} +3 -3
  32. package/dist/{exports-BiXPktAF.mjs.map → exports-B0yFVod3.mjs.map} +1 -1
  33. package/dist/{exports-CCuYD8dO-yw1GizAT.mjs → exports-CCuYD8dO-fFXwpizm.mjs} +3 -3
  34. package/dist/{exports-CCuYD8dO-yw1GizAT.mjs.map → exports-CCuYD8dO-fFXwpizm.mjs.map} +1 -1
  35. package/dist/{exports-CZ6dPu-O.mjs → exports-DNFYCa6U.mjs} +3 -3
  36. package/dist/{exports-CZ6dPu-O.mjs.map → exports-DNFYCa6U.mjs.map} +1 -1
  37. package/dist/{graph-membership-D7m41lWA-B68g1CRS.mjs → graph-membership-ClCmhVjf-8XCns4rf.mjs} +3 -3
  38. package/dist/{graph-membership-D7m41lWA-B68g1CRS.mjs.map → graph-membership-ClCmhVjf-8XCns4rf.mjs.map} +1 -1
  39. package/dist/hash-DcBt3lpO.d.mts +1 -0
  40. package/dist/{hash-DclMqd7S-WBvXJ_4C.d.mts → hash-DclMqd7S-Dddl_NeA.d.mts} +2 -2
  41. package/dist/{hash-DclMqd7S-WBvXJ_4C.d.mts.map → hash-DclMqd7S-Dddl_NeA.d.mts.map} +1 -1
  42. package/dist/{invariants-DxCj82g2-DhGkStla.mjs → invariants-c9W7-6DY-CzSdi8Vp.mjs} +3 -3
  43. package/dist/{invariants-DxCj82g2-DhGkStla.mjs.map → invariants-c9W7-6DY-CzSdi8Vp.mjs.map} +1 -1
  44. package/dist/io-BalYebmm.d.mts +1 -0
  45. package/dist/{io-D51jgF31-RTnIqw4C.mjs → io-DUsSXBRO-BqRNb69U.mjs} +5 -5
  46. package/dist/{io-D51jgF31-RTnIqw4C.mjs.map → io-DUsSXBRO-BqRNb69U.mjs.map} +1 -1
  47. package/dist/{io-DpAplMzQ-oLyfXvz-.d.mts → io-DpAplMzQ-ZTJi-tTr.d.mts} +2 -2
  48. package/dist/{io-DpAplMzQ-oLyfXvz-.d.mts.map → io-DpAplMzQ-ZTJi-tTr.d.mts.map} +1 -1
  49. package/dist/{migration-DTmtOJ0n.mjs → migration-C1l4_CWi.mjs} +3 -3
  50. package/dist/{migration-DTmtOJ0n.mjs.map → migration-C1l4_CWi.mjs.map} +1 -1
  51. package/dist/{migration-graph-BoiiZAaU-DLht12k7.mjs → migration-graph-DBJAol1y-DX61Ss3X.mjs} +19 -3
  52. package/dist/{migration-graph-BoiiZAaU-DLht12k7.mjs.map → migration-graph-DBJAol1y-DX61Ss3X.mjs.map} +1 -1
  53. package/dist/{migration-graph-D8IuOkZb-pSI7-k4_.d.mts → migration-graph-DCIdjMtC-CAs3pm1A.d.mts} +10 -3
  54. package/dist/{migration-graph-D8IuOkZb-pSI7-k4_.d.mts.map → migration-graph-DCIdjMtC-CAs3pm1A.d.mts.map} +1 -1
  55. package/dist/{migration-graph-Dra4CcyN.d.mts → migration-graph-GiSYbAc8.d.mts} +2 -2
  56. package/dist/{migration-graph-Dra4CcyN.d.mts.map → migration-graph-GiSYbAc8.d.mts.map} +1 -1
  57. package/dist/migration-tools.d.mts +14 -14
  58. package/dist/migration-tools.mjs +13 -13
  59. package/dist/migration-tools__aggregate.d.mts +1 -1
  60. package/dist/migration-tools__aggregate.mjs +1 -1
  61. package/dist/migration-tools__contract-snapshot-store.d.mts +3 -3
  62. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  63. package/dist/migration-tools__errors.mjs +1 -1
  64. package/dist/migration-tools__hash.d.mts +2 -2
  65. package/dist/migration-tools__invariants.mjs +1 -1
  66. package/dist/migration-tools__io.d.mts +2 -2
  67. package/dist/migration-tools__io.mjs +1 -1
  68. package/dist/migration-tools__migration-graph.d.mts +3 -3
  69. package/dist/migration-tools__migration-graph.mjs +3 -3
  70. package/dist/migration-tools__migration.mjs +1 -1
  71. package/dist/migration-tools__ref-resolution.mjs +1 -1
  72. package/dist/migration-tools__refs.mjs +1 -1
  73. package/dist/migration-tools__spaces.mjs +2 -2
  74. package/dist/{ref-BrtKINun-CRtoeAmD.mjs → ref-C7TozKnq-C4UYYbRT.mjs} +362 -160
  75. package/dist/ref-C7TozKnq-C4UYYbRT.mjs.map +1 -0
  76. package/dist/{ref-resolution-C0xsiRig.mjs → ref-resolution-533MGMov.mjs} +2 -2
  77. package/dist/{ref-resolution-C0xsiRig.mjs.map → ref-resolution-533MGMov.mjs.map} +1 -1
  78. package/dist/{refs-t_JbIjGo-BVCqKpXd.mjs → refs-BE6yEgSV-CbpqGnbl.mjs} +3 -3
  79. package/dist/{refs-t_JbIjGo-BVCqKpXd.mjs.map → refs-BE6yEgSV-CbpqGnbl.mjs.map} +1 -1
  80. package/dist/{spaces-qTjiPqw0.mjs → spaces-Cj_GYpmM.mjs} +7 -7
  81. package/dist/{spaces-qTjiPqw0.mjs.map → spaces-Cj_GYpmM.mjs.map} +1 -1
  82. package/dist/{verify-contract-spaces-BZV67Pqk-DhswS52A.mjs → verify-contract-spaces-DvU9lE0Y-Y1WwEsPA.mjs} +4 -4
  83. package/dist/{verify-contract-spaces-BZV67Pqk-DhswS52A.mjs.map → verify-contract-spaces-DvU9lE0Y-Y1WwEsPA.mjs.map} +1 -1
  84. package/dist/vite-plugin-contract-emit.mjs +3 -3
  85. package/package.json +11 -11
  86. package/dist/caught-errors-D8Hn_D5h-C4BJDZ5y.mjs.map +0 -1
  87. package/dist/contract-snapshot-store-CtlOZtzJ.d.mts +0 -2
  88. package/dist/db-sign-DLIR5swa-CMgFrBoH.d.mts.map +0 -1
  89. package/dist/hash-CwWGlFWV.d.mts +0 -1
  90. package/dist/io-CpR7fgmB.d.mts +0 -1
  91. package/dist/ref-BrtKINun-CRtoeAmD.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caught-errors-DZXnK8Ls-zVmM4nr3.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/caught-errors-DZXnK8Ls.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { CliStructuredError as CliStructuredError$1, errorConfigValidation, errorContractConfigMissing, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFileNotFound, errorMigrationPlanningFailed, errorTargetMigrationNotSupported, errorUnexpected } from \"@internal/errors/control\";\nimport { APP_SPACE_ID, hasMigrations } from \"@internal/framework-components/control\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { join, relative, resolve } from \"pathe\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { findPath, findPathWithInvariants, historyEndsFrom, isGraphNode, reconstructGraph } from \"@internal/migration-tools/migration-graph\";\nimport { contractHashAtMarker } from \"@internal/migration-tools/aggregate\";\nimport { errorHashMismatch, errorMarkerMissing, errorRuntime, errorTargetMismatch } from \"@internal/errors/execution\";\nimport \"@internal/errors/migration\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID as APP_SPACE_ID$1, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\n//#region src/control-api/operations/graph-queries.ts\n/**\n* Read-only migration-graph queries commands need at the control-api seam.\n*/\n/** True when the on-disk graph contains a path fromHash → toHash. */\nfunction hasMigrationPath(graph, fromHash, toHash) {\n\treturn findPath(graph, fromHash, toHash) !== null;\n}\n/** The invariants `target` requires that the database at `marker` does not record. */\nfunction missingInvariants(marker, target) {\n\tconst recorded = new Set(marker?.invariants ?? []);\n\treturn new Set(target.invariants.filter((invariant) => !recorded.has(invariant)));\n}\n/** `space.emittedHash` is the contract the caller takes as emitted, as `PlanSpace.emittedHash` describes. */\nfunction migrationsToTarget(space, marker, target) {\n\tconst from = contractHashAtMarker(marker);\n\tconst missing = missingInvariants(marker, target);\n\tif (from === target.hash && missing.size === 0) return { kind: \"none-needed\" };\n\tif (findPathWithInvariants(space.graph, from, target.hash, missing) !== null) return { kind: \"on-disk\" };\n\tconst missingInvariantIds = [...missing].sort();\n\tif (from !== target.hash) return {\n\t\tkind: \"plan-needed\",\n\t\tmissingInvariants: missingInvariantIds\n\t};\n\treturn {\n\t\tkind: \"at-target-missing-invariants\",\n\t\tmissingInvariants: missingInvariantIds,\n\t\t...ifDefined(\"newMigration\", (space.graph.reverseChain.get(target.hash)?.length ?? 0) > 0 ? {\n\t\t\tfrom: target.hash,\n\t\t\temitFirst: space.emittedHash !== target.hash\n\t\t} : void 0)\n\t};\n}\n//#endregion\n//#region src/control-api/operations/plan-arguments.ts\nfunction reference(value) {\n\treturn {\n\t\tkind: \"reference\",\n\t\treference: value\n\t};\n}\n/** The ref `refs` defines under `name`; not one `Object.prototype` holds, such as `constructor`. */\nfunction refNamed(refs, name) {\n\treturn Object.hasOwn(refs, name) ? refs[name] : void 0;\n}\n/** The names of `refs`, the `db` ref first. */\nfunction refNames(refs) {\n\treturn Object.keys(refs).sort((a, b) => a === \"db\" ? -1 : b === \"db\" ? 1 : a.localeCompare(b));\n}\n/** Where the history that continues from `hash` ends, as `--from` names each end. */\nfunction historyEnds(graph, hash = EMPTY_CONTRACT_HASH) {\n\treturn historyEndsFrom(graph, hash).map((end) => end === EMPTY_CONTRACT_HASH ? \"@empty\" : end);\n}\n/**\n* The `--from` the user chooses, for `reason`, when where the database is cannot be told: with no\n* migrations, `@empty` or a ref, which `migration plan` baselines; otherwise where the history ends;\n* with the space unread, none named.\n*/\nfunction migrationPlanChoice(space, reason) {\n\treturn {\n\t\tkind: \"ambiguous\",\n\t\treason,\n\t\tcandidates: space === void 0 ? [] : space.graph.nodes.size === 0 ? [\"@empty\", ...refNames(space.refs)] : historyEnds(space.graph)\n\t};\n}\nconst NO_MARKER = \"The database has no marker\";\nconst ADOPT_FIRST = \"A database that is not empty needs adopting first\";\n/** Why a database with no marker in a space with no migrations gets a plan from `@empty` only as a choice. */\nconst NO_MARKER_REASON = `${NO_MARKER}, so a plan from \\`@empty\\` fits only an empty database. ${ADOPT_FIRST}: emit the contract that describes it as it is, before your change, and record it with \\`{bin} db sign\\`, then plan from there`;\n/**\n* Why `db migrate` on a database with no marker, in a space with migrations, fits only an empty\n* database, and how to adopt one that is not: `sign` is the `db sign <contract>` and `list` the\n* `migration list` advice prints.\n*/\nfunction noMarkerReplayText(sign, list) {\n\treturn `${NO_MARKER}, so \\`db migrate\\` applies every migration on disk from the first, which fits only an empty database. ${ADOPT_FIRST}: record the contract it is at with \\`${sign}\\`, naming the migration whose result it matches (\\`${list}\\` shows them), and \\`db migrate\\` then applies only the migrations after it`;\n}\nfunction at(from) {\n\treturn {\n\t\tfrom,\n\t\tafterUnapplied: false\n\t};\n}\n/**\n* The `--from` that makes `migration plan` start where a database at `position` is. A contract a\n* migration records is named by its hash. An empty database starts where its history ends, because\n* a plan from the empty contract would recreate what the existing migrations create; with no\n* migration from the empty contract it starts at `@empty`. With no migrations, a database with no\n* marker may be empty or may need adopting, so the plan from `@empty` is a choice; a database at a\n* contract a ref names starts from the ref, which `migration plan` baselines.\n*/\nfunction startAtPosition(space, position) {\n\tconst { graph, refs } = space;\n\tif (position.kind === \"unknown\") return at(migrationPlanChoice(space, position.reason));\n\tif (position.kind === \"unmarked\" || position.hash === EMPTY_CONTRACT_HASH) {\n\t\tif (graph.nodes.size === 0) return at(position.kind === \"unmarked\" ? {\n\t\t\tkind: \"ambiguous\",\n\t\t\treason: NO_MARKER_REASON,\n\t\t\tcandidates: [\"@empty\"]\n\t\t} : reference(\"@empty\"));\n\t\treturn startAtEndOf(graph, EMPTY_CONTRACT_HASH, \"The migration history an empty database replays\");\n\t}\n\tif (isGraphNode(position.hash, graph)) return at(reference(position.hash));\n\tif (graph.nodes.size === 0) {\n\t\tconst [name] = refNames(refs).filter((each) => refs[each]?.hash === position.hash);\n\t\tif (name !== void 0) return at(reference(name));\n\t\treturn at({\n\t\t\tkind: \"none\",\n\t\t\treason: `No ref names contract ${position.hash}, and with no migrations \\`migration plan\\` starts only from \\`@empty\\` or a ref`\n\t\t});\n\t}\n\treturn at({\n\t\tkind: \"none\",\n\t\treason: `No migration records contract ${position.hash}, and \\`migration plan\\` starts only from a contract a migration records`\n\t});\n}\n/**\n* Where the history that continues from `hash` ends: the one end, or a choice of them, past\n* migrations not applied when an end is not `hash` itself.\n*/\nfunction startAtEndOf(graph, hash, history) {\n\tconst ends = historyEnds(graph, hash);\n\tconst start = hash === EMPTY_CONTRACT_HASH ? \"@empty\" : hash;\n\tconst afterUnapplied = ends.some((end) => end !== start);\n\tconst [onlyEnd] = ends;\n\tif (ends.length === 1 && onlyEnd !== void 0) return {\n\t\tfrom: reference(onlyEnd),\n\t\tafterUnapplied\n\t};\n\treturn {\n\t\tfrom: {\n\t\t\tkind: \"ambiguous\",\n\t\t\treason: `${history} has more than one end`,\n\t\t\tcandidates: ends\n\t\t},\n\t\tafterUnapplied\n\t};\n}\n/**\n* The `--to` that makes `migration plan` end at `end`: none for the emitted contract, which it\n* targets by default, nor for a contract hash that is the one the run was given; a ref by its name;\n* a contract a migration records by its hash. It does not plan to the empty contract, by its hash or\n* a ref, or to any other contract no migration records.\n*/\nfunction migrationPlanTo(space, end) {\n\tif (end.kind === \"emitted\") return { kind: \"default\" };\n\tif ((end.kind === \"ref\" ? refNamed(space.refs, end.name)?.hash : end.hash) === EMPTY_CONTRACT_HASH) return {\n\t\tkind: \"none\",\n\t\treason: \"`migration plan` does not plan a migration to the empty contract\"\n\t};\n\tif (end.kind === \"ref\") return reference(end.name);\n\tif (isGraphNode(end.hash, space.graph)) return reference(end.hash);\n\tif (end.hash === space.emittedHash) return { kind: \"default\" };\n\treturn {\n\t\tkind: \"none\",\n\t\treason: `No migration records contract ${end.hash}, and \\`migration plan --to\\` ends only at a contract a migration records, a ref, or the emitted contract`\n\t};\n}\n/**\n* The `--from` and `--to` of the `migration plan` that takes a database at `position` to `end`. To\n* a contract the history records, the plan leaves from where the database is. To the emitted\n* contract, a new one, it extends the history: it starts where the history that continues from the\n* database's contract ends, so `db migrate` applies the migrations after it and then the new one,\n* and the plan forks nothing.\n*/\nfunction migrationPlanArguments(space, position, end) {\n\tconst to = migrationPlanTo(space, end);\n\tconst start = to.kind === \"default\" && position.kind === \"contract\" && position.hash !== EMPTY_CONTRACT_HASH && isGraphNode(position.hash, space.graph) ? startAtEndOf(space.graph, position.hash, \"The migration history that continues from where the database is\") : startAtPosition(space, position);\n\treturn {\n\t\tfrom: start.from,\n\t\tto,\n\t\t...ifDefined(\"startsAfterUnapplied\", start.afterUnapplied ? true : void 0)\n\t};\n}\nconst EMPTY_ORIGIN_STATEMENTS = \"A plan from `@empty` creates every model, so its statements name nothing it can resolve\";\n/**\n* `from` for a plan that carries `--rename`, `--delete`, `--convert` or `--backfill`: such a plan\n* cannot start at `@empty`, so that start is dropped, and with no start left there is no plan.\n*/\nfunction migrationPlanFromForStatements(from) {\n\tif (from.kind === \"reference\" && from.reference === \"@empty\") return {\n\t\tkind: \"none\",\n\t\treason: EMPTY_ORIGIN_STATEMENTS\n\t};\n\tif (from.kind !== \"ambiguous\" || !from.candidates.includes(\"@empty\")) return from;\n\tconst candidates = from.candidates.filter((candidate) => candidate !== \"@empty\");\n\treturn candidates.length === 0 ? {\n\t\tkind: \"none\",\n\t\treason: `${from.reason}. ${EMPTY_ORIGIN_STATEMENTS}`\n\t} : {\n\t\t...from,\n\t\tcandidates\n\t};\n}\n/**\n* The `--from` that plans a failed migration again after its directory is deleted: the contract it\n* started from, as `--from` names it in the graph without that migration.\n*/\nfunction migrationPlanReplacing(space, failed) {\n\tif (failed.from === EMPTY_CONTRACT_HASH) return reference(\"@empty\");\n\treturn startAtPosition({\n\t\tgraph: reconstructGraph(space.packages.filter(({ dirName }) => dirName !== failed.dirName)),\n\t\trefs: space.refs\n\t}, {\n\t\tkind: \"contract\",\n\t\thash: failed.from\n\t}).from;\n}\n/**\n* The `migration plan` that takes the database at `marker` to `end`, with how it reaches `end`\n* through migrations when the contract `end` names is known.\n*/\nfunction migrationPlanForDatabase(space, marker, end) {\n\tconst position = databasePositionOf(marker?.storageHash);\n\tconst plan = migrationPlanArguments(space, position, end);\n\tconst target = planEndContract(space, end);\n\treturn {\n\t\t...plan,\n\t\tposition,\n\t\t...ifDefined(\"migrationsToTarget\", target === void 0 ? void 0 : migrationsToTarget(space, marker, target))\n\t};\n}\n/** The contract `end` names, with the invariants a ref requires; undefined when it is not known. */\nfunction planEndContract(space, end) {\n\tswitch (end.kind) {\n\t\tcase \"emitted\": return space.emittedHash === void 0 ? void 0 : {\n\t\t\thash: space.emittedHash,\n\t\t\tinvariants: []\n\t\t};\n\t\tcase \"ref\": return refNamed(space.refs, end.name);\n\t\tcase \"contract\": return {\n\t\t\thash: end.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\n}\n/** Where a database whose marker names `markerHash`, or that has none, is. */\nfunction databasePositionOf(markerHash) {\n\tif (markerHash === void 0) return { kind: \"unmarked\" };\n\treturn {\n\t\tkind: \"contract\",\n\t\thash: markerHash\n\t};\n}\n/**\n* The application space of `aggregate`, as a {@link PlanSpace}, with `emitted.hash` as its\n* `emittedHash`: by default the hash of the contract the run was given, the aggregate's.\n*/\nfunction appSpaceOf(aggregate, emitted = { hash: aggregate.app.contract().storage.storageHash }) {\n\treturn {\n\t\tspaceId: aggregate.app.spaceId,\n\t\tgraph: aggregate.app.graph(),\n\t\trefs: aggregate.app.refs,\n\t\t...ifDefined(\"emittedHash\", emitted.hash)\n\t};\n}\n/**\n* The `--from` that makes `migration plan` start where a run of it started: the `--from` it was\n* given, or the origin it resolved by default, which is `@empty`, the `db` ref it baselined from, or\n* the hash the `db` ref names.\n*/\nfunction migrationPlanFromRun(optionsFrom, resolution) {\n\tif (optionsFrom !== void 0) return reference(optionsFrom);\n\tswitch (resolution.kind) {\n\t\tcase \"greenfield\": return reference(\"@empty\");\n\t\tcase \"auto-baseline\": return reference(\"db\");\n\t\tcase \"graph-node\":\n\t\tcase \"ref\": return reference(resolution.fromHash);\n\t}\n}\n//#endregion\n//#region src/control-api/statements/statement-flag.ts\nconst SHELL_SAFE = /^[A-Za-z0-9_.:/@%+,-]+$/;\n/** The value as a shell passes it through unchanged, single-quoted when needed. */\nfunction shellQuoted(value) {\n\treturn SHELL_SAFE.test(value) ? value : `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n/**\n* A statement written as a flag a shell passes through unchanged: the value is single-quoted when\n* it has a character a shell would read, and joined with `=` when it starts with `-`, which a\n* parser would otherwise read as a flag.\n*/\nfunction statementFlag(statement) {\n\tconst value = shellQuoted(statement.text);\n\treturn statement.text.startsWith(\"-\") ? `--${statement.verb}=${value}` : `--${statement.verb} ${value}`;\n}\n//#endregion\n//#region src/utils/next-actions.ts\n/**\n* The typed remediation the CLI attaches to its own errors and findings.\n* Constructors live here rather than in any library the CLI calls: naming a\n* runnable invocation is something only the CLI can do.\n*/\nfunction runCommandAction(label, command) {\n\treturn {\n\t\tkind: \"run-command\",\n\t\tlabel,\n\t\tcommand\n\t};\n}\n/** Advice the user carries out or decides on themselves, such as changing data in the database or choosing between plans; it has no command to run and edits no file. */\nfunction chooseAction(label) {\n\treturn {\n\t\tkind: \"user-choice\",\n\t\tlabel\n\t};\n}\n/** Advice that changes a file before anything runs again. */\nfunction editFileAction(label) {\n\treturn {\n\t\tkind: \"edit-file\",\n\t\tlabel\n\t};\n}\n//#endregion\n//#region src/utils/printed-command.ts\n/** The invocation of a command run with `ctx`, given `--db` when `db` is defined. */\nfunction cliInvocation(ctx, db) {\n\treturn {\n\t\tcwd: ctx.cwd,\n\t\tconfigPath: ctx.configPath,\n\t\tdbGiven: db !== void 0\n\t};\n}\n/** The flags of `db migrate` or `db update` that a re-run repeats, as the user gave them. */\nfunction rerunFlags(flags) {\n\treturn [\n\t\t...flags.to === void 0 ? [] : [\"--to\", shellQuoted(flags.to)],\n\t\t...flags.advanceRef === void 0 ? [] : [\"--advance-ref\", shellQuoted(flags.advanceRef)],\n\t\t...flags.noAdvanceRef === true ? [\"--no-advance-ref\"] : [],\n\t\t...flags.permitPolicyChange === true ? [\"--permit-policy-change\"] : []\n\t];\n}\n/** The `db migrate` the user ran, with the flags they gave. */\nfunction dbMigrateRerun(invocation) {\n\treturn cliCommand(invocation, \"db migrate\", invocation.rerunArgs ?? []);\n}\n/**\n* The `db migrate` that applies a migration planned after changing the contract source: it ends at\n* the new emitted contract, so it leaves out the user's `--to` and the `--permit-policy-change`\n* that goes with it, and keeps the other flags.\n*/\nfunction dbMigrateToEmitted(invocation) {\n\tconst given = invocation.rerunArgs ?? [];\n\treturn cliCommand(invocation, \"db migrate\", given.filter((word, index) => word !== \"--to\" && given[index - 1] !== \"--to\" && word !== \"--permit-policy-change\"));\n}\n/**\n* The `db migrate` that applies what a failed `db update` advises to plan to `to`. It repeats the\n* flags the user gave `db update`, which `db migrate` takes with the same meaning: `--to`, and\n* `--advance-ref` and `--permit-policy-change`, without which it would not do what `db update` was\n* asked to. Without a `--to` among them, it takes the plan's.\n*/\nfunction dbUpdateApplyCommand(invocation, to) {\n\tconst given = invocation?.rerunArgs ?? [];\n\treturn cliCommand(invocation, \"db migrate\", [...given.includes(\"--to\") || to.kind === \"none\" ? [] : argumentWords(\"--to\", to), ...given]);\n}\n/** The `db update` the user ran, with the flags they gave and `statements`, by default the run's own. */\nfunction dbUpdateRerun(invocation, statements = invocation.statementArgs ?? []) {\n\treturn cliCommand(invocation, \"db update\", [...invocation.rerunArgs ?? [], ...statements]);\n}\n/** The commands that connect to a database: those whose flags include `dbFlag`, which a test checks. */\nconst COMMANDS_TAKING_DB = /* @__PURE__ */ new Set([\n\t\"contract infer\",\n\t\"db init\",\n\t\"db migrate\",\n\t\"db schema\",\n\t\"db sign\",\n\t\"db update\",\n\t\"db verify\",\n\t\"migration log\",\n\t\"migration status\"\n]);\nfunction configWords(configPath) {\n\treturn configPath === void 0 ? [] : [\"--config\", shellQuoted(configPath)];\n}\n/**\n* A CLI command as advice prints it: `{bin}`, the command and its arguments, the `--config` the CLI\n* was given, and, for a command that connects to a database, `--db <url>` when the CLI was given\n* `--db`, so it runs as printed from the directory the CLI ran in, against the same database. The\n* URL stays a placeholder because it can hold credentials.\n*/\nfunction cliCommand(invocation, command, args = []) {\n\treturn [\n\t\t\"{bin}\",\n\t\tcommand,\n\t\t...args,\n\t\t...configWords(invocation?.configPath),\n\t\t...invocation?.dbGiven === true && COMMANDS_TAKING_DB.has(command) ? [\"--db\", \"<url>\"] : []\n\t].join(\" \");\n}\n/** A `migration plan` that starts at `from`, as advice prints it; `from` resolves as printed. */\nfunction printedPlanCommand(invocation, from, flags) {\n\treturn cliCommand(invocation, \"migration plan\", [...argumentWords(\"--from\", from), ...flags]);\n}\n/** What advice prints where `--from` is for the user to choose. */\nconst CONTRACT_PLACEHOLDER = \"<contract>\";\n/** The `migration plan` that goes from `plan.from` to `plan.to` (the emitted contract when absent) with `flags`. */\nfunction printedPlan(invocation, plan, flags) {\n\tconst { to = { kind: \"default\" } } = plan;\n\tconst from = carriesStatement(flags) ? migrationPlanFromForStatements(plan.from) : plan.from;\n\tif (from.kind === \"none\" || to.kind === \"none\") return {\n\t\tkind: \"none\",\n\t\treason: [from, to].flatMap((argument) => argument.kind === \"none\" ? [argument.reason] : []).join(\". \")\n\t};\n\tconst words = [...argumentWords(\"--to\", to), ...flags];\n\treturn from.kind === \"ambiguous\" ? printedChoicePlan(invocation, from, words) : {\n\t\tkind: \"runs\",\n\t\tcommand: printedPlanCommand(invocation, from, words)\n\t};\n}\n/**\n* How advice moves the database `plan` describes to `plan.to`: with the `migration plan` from\n* `plan.from` with `flags`, by applying migrations on disk, or why neither can. `apply` is the\n* `db migrate` that applies the result, by default the one that follows `db update`.\n*/\nfunction printedWayToTarget(invocation, plan, flags, apply = dbUpdateApplyCommand(invocation, plan.to)) {\n\tconst target = targetText(plan.to);\n\tconst migrations = plan.migrationsToTarget ?? {\n\t\tkind: \"plan-needed\",\n\t\tmissingInvariants: []\n\t};\n\tswitch (migrations.kind) {\n\t\tcase \"none-needed\": return {\n\t\t\tkind: \"at-target\",\n\t\t\treason: `The database is already at ${target} and records every invariant it requires, so there is no migration to apply`\n\t\t};\n\t\tcase \"on-disk\": {\n\t\t\tconst onDisk = `Migrations on disk already lead from the database to ${target}, so a migration planned now would be a second path between the same two contracts, and \\`db migrate\\` applies only one of them`;\n\t\t\tconst adoptFirst = noMarkerText(invocation, plan);\n\t\t\tconst reason = adoptFirst === void 0 ? onDisk : `${onDisk}. ${adoptFirst}`;\n\t\t\treturn {\n\t\t\t\tkind: \"on-disk\",\n\t\t\t\treason,\n\t\t\t\tapply,\n\t\t\t\ttext: `${reason}. Apply them with \\`${apply}\\`, which names the migration.ts to change if one of them fails`,\n\t\t\t\t...ifDefined(\"adoptFirst\", adoptFirst)\n\t\t\t};\n\t\t}\n\t\tcase \"at-target-missing-invariants\": {\n\t\t\tconst { missingInvariants, newMigration } = migrations;\n\t\t\tconst finish = (migrationTs) => `add to ${migrationTs} ${transformsText(missingInvariants)}, run \\`${writtenMigrationRunCommand(invocation)}\\` for its directory, and apply it with \\`${apply}\\``;\n\t\t\treturn {\n\t\t\t\tkind: \"none\",\n\t\t\t\treason: `The database is at ${target}, but no migration on disk provides ${invariantsText(missingInvariants)} it requires and the database does not record, and a plan from a contract to itself is empty. ${selfMigrationText(invocation, target, newMigration, finish)}`\n\t\t\t};\n\t\t}\n\t\tcase \"plan-needed\": {\n\t\t\tconst adoptFirst = noMarkerText(invocation, plan);\n\t\t\tif (plan.startsAfterUnapplied === true && carriesStatement(flags) && plan.from.kind !== \"none\" && !(plan.from.kind === \"reference\" && plan.from.reference === \"@empty\")) return applyUnappliedFirst(invocation, plan.from, adoptFirst);\n\t\t\tconst printed = printedPlan(invocation, plan, flags);\n\t\t\tif (printed.kind === \"none\") return printed;\n\t\t\tconst { missingInvariants } = migrations;\n\t\t\tconst run = `${missingInvariants.length === 0 ? \"\" : `add to it ${transformsText(missingInvariants)}, `}run \\`${writtenMigrationRunCommand(invocation)}\\` for the directory it writes`;\n\t\t\treturn {\n\t\t\t\t...printed,\n\t\t\t\tafterPlan: adoptFirst === void 0 ? `${run}, and apply it with \\`${apply}\\`` : `${run}. ${adoptFirst}. Then apply it with \\`${apply}\\``\n\t\t\t};\n\t\t}\n\t}\n}\n/**\n* For a database with no marker in a space with migrations, why `db migrate` fits it only when it\n* is empty, and how to adopt it when it is not.\n*/\nfunction noMarkerText(invocation, plan) {\n\tif (plan.position?.kind !== \"unmarked\" || plan.startsAfterUnapplied !== true) return void 0;\n\treturn noMarkerReplayText(cliCommand(invocation, \"db sign\", [CONTRACT_PLACEHOLDER]), cliCommand(invocation, \"migration list\"));\n}\n/**\n* Why advice that carries a statement prints no plan from `from`, past migrations on disk the\n* database has not applied: one of them may already make the change. It says to apply them first,\n* after `adoptFirst` for a database with no marker, then run the command again. It never offers\n* `@empty` as where to apply them to, since that empties the database.\n*/\nfunction applyUnappliedFirst(invocation, from, adoptFirst) {\n\tconst lead = \"Migrations on disk that the database has not applied come before where a plan for this change would start, and one of them may already make the change, so the plan could not carry it\";\n\tconst candidates = from.kind === \"ambiguous\" ? from.candidates.filter((each) => each !== \"@empty\") : [];\n\tconst [onlyCandidate] = candidates;\n\tconst end = from.kind === \"reference\" ? from.reference : candidates.length === 1 && onlyCandidate !== void 0 ? onlyCandidate : CONTRACT_PLACEHOLDER;\n\tconst runs = end !== CONTRACT_PLACEHOLDER;\n\tconst command = cliCommand(invocation, \"db migrate\", [\"--to\", runs ? shellQuoted(end) : end]);\n\tconst apply = `Apply them first with ${`\\`${command}\\``}${!runs && candidates.length > 0 ? `, replacing ${CONTRACT_PLACEHOLDER} with one of ${candidates.map((each) => `\\`${each}\\``).join(\", \")}` : \"\"}, which names the migration.ts to change if one of them fails, then run the command again`;\n\treturn {\n\t\tkind: \"none\",\n\t\treason: adoptFirst === void 0 ? `${lead}. ${apply}` : `${lead}. ${adoptFirst}. ${apply}`,\n\t\tapplyFirst: {\n\t\t\tcommand,\n\t\t\truns,\n\t\t\ttext: apply,\n\t\t\t...ifDefined(\"adoptFirst\", adoptFirst)\n\t\t}\n\t};\n}\n/**\n* How to write a migration from `target`, the contract the database is at, to itself, then\n* `finish` it, given the words that name its migration.ts.\n*/\nfunction selfMigrationText(invocation, target, newMigration, finish) {\n\tif (newMigration === void 0) return `Write a migration from that contract to itself, ${finish(\"its migration.ts\")}`;\n\tconst command = `\\`${cliCommand(invocation, \"migration new\", [\"--from\", newMigration.from])}\\``;\n\tif (!newMigration.emitFirst) return `Write a migration from that contract to itself with ${command}, ${finish(\"its migration.ts\")}`;\n\tconst emit = `\\`${cliCommand(invocation, \"contract emit\")}\\``;\n\treturn `Change your contract source so it describes ${target} and run ${emit}, then write a migration from that contract to itself with ${command}. Then change your contract source back and run ${emit} again, because \\`db update\\` and \\`migration plan\\` target the emitted contract. Then ${finish(\"the new migration's migration.ts\")}`;\n}\nfunction targetText(to) {\n\tswitch (to.kind) {\n\t\tcase \"reference\": return `\\`${to.reference}\\``;\n\t\tcase \"default\": return \"the emitted contract\";\n\t\tcase \"none\": return \"the contract the run moves it to\";\n\t}\n}\nfunction quotedInvariants(invariants) {\n\treturn invariants.map((id) => JSON.stringify(id)).join(\", \");\n}\nfunction invariantsText(invariants) {\n\treturn `${invariants.length === 1 ? \"the invariant\" : \"the invariants\"} ${quotedInvariants(invariants)}`;\n}\n/** The `dataTransform` operations that provide `invariants`: each carries one `invariantId`. */\nfunction transformsText(invariants) {\n\treturn invariants.length === 1 ? `a \\`dataTransform\\` with \\`invariantId\\` ${quotedInvariants(invariants)}` : `a \\`dataTransform\\` for each of the invariants ${quotedInvariants(invariants)}, with that invariant as its \\`invariantId\\``;\n}\nconst STATEMENT_FLAGS = /* @__PURE__ */ new Set([\n\t\"--rename\",\n\t\"--delete\",\n\t\"--convert\",\n\t\"--backfill\"\n]);\nfunction carriesStatement(flags) {\n\treturn flags.some((flag) => STATEMENT_FLAGS.has(flag.split(/[\\s=]/)[0] ?? \"\"));\n}\n/**\n* A `migration plan` whose `--from` the user chooses, for `choice.reason`, from `choice.candidates`:\n* with one candidate, the command names it and the reason says when it fits.\n*/\nfunction printedChoicePlan(invocation, choice, flags) {\n\tconst [only] = choice.candidates;\n\tif (choice.candidates.length === 1 && only !== void 0) return {\n\t\tkind: \"fill\",\n\t\tcommand: printedPlanCommand(invocation, {\n\t\t\tkind: \"reference\",\n\t\t\treference: only\n\t\t}, flags),\n\t\tfill: choice.reason\n\t};\n\tconst statements = carriesStatement(flags);\n\tconst choices = choice.candidates.length > 0 ? `one of ${choice.candidates.map((candidate) => `\\`${candidate}\\``).join(\", \")}` : `a contract \\`${cliCommand(invocation, \"migration list\")}\\` shows${statements ? \" or a ref that names one\" : \", a ref that names one, or `@empty`\"}`;\n\treturn {\n\t\tkind: \"fill\",\n\t\tcommand: cliCommand(invocation, \"migration plan\", [\n\t\t\t\"--from\",\n\t\t\tCONTRACT_PLACEHOLDER,\n\t\t\t...flags\n\t\t]),\n\t\tfill: `${choice.reason}, so replace ${CONTRACT_PLACEHOLDER} with ${choices}`\n\t};\n}\n/** `plan` quoted for a sentence: its command, followed for `fill` by what to put in its placeholder. */\nfunction quotedPlan(plan) {\n\treturn plan.kind === \"runs\" ? `\\`${plan.command}\\`` : `\\`${plan.command}\\` (${plan.fill})`;\n}\n/** The next action for `plan`: a command when it runs, otherwise the choice or the reason it has none. */\nfunction planAction(label, plan) {\n\tswitch (plan.kind) {\n\t\tcase \"runs\": return runCommandAction(label, plan.command);\n\t\tcase \"fill\": return chooseAction(`${label} with \\`${plan.command}\\`. ${plan.fill}.`);\n\t\tcase \"none\": return chooseAction(plan.reason);\n\t}\n}\nfunction argumentWords(flag, argument) {\n\treturn argument.kind === \"reference\" ? [flag, shellQuoted(argument.reference)] : [];\n}\n/**\n* The command that runs a `migration.ts`, named relative to the directory the CLI ran in, with the\n* `--config` the CLI was given, so it loads the same config.\n*/\nfunction selfEmitCommand(invocation, migrationTs) {\n\treturn [\n\t\t\"node\",\n\t\tshellQuoted(printedPath(invocation, migrationTs)),\n\t\t...configWords(invocation.configPath)\n\t].join(\" \");\n}\n/** The command that runs the `migration.ts` a `migration plan` writes, with its directory a placeholder. */\nfunction writtenMigrationRunCommand(invocation) {\n\treturn [\n\t\t\"node\",\n\t\t\"<migration directory>/migration.ts\",\n\t\t...configWords(invocation?.configPath)\n\t].join(\" \");\n}\n/** A path as advice prints it: relative to the directory the CLI ran in. */\nfunction printedPath(invocation, path) {\n\treturn relative(invocation.cwd, path);\n}\n//#endregion\n//#region src/utils/cli-errors.ts\n/**\n* A CLI-raised error that carries the typed remediation as well as the prose.\n* Only the CLI knows which invocation fixes a failure, so only errors raised\n* here spell one; the foundation classes every library also raises keep\n* carrying `code`, `why` and `fix` alone.\n*\n* Both fields are required: the `fix` prose is what the commander shell still\n* renders, and the handler boundary drops it in favour of `nextActions` when it\n* settles the engine's envelope.\n*/\nvar ActionableCliError = class extends CliStructuredError$1 {\n\tnextActions;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.nextActions = options.nextActions;\n\t}\n};\n/**\n* A command that accepts a contract reference both as a positional and as a\n* flag was given both. Structured rather than a bare stderr line, so a script\n* sees the same envelope every other invocation failure produces.\n*/\nfunction errorContractArgConflict(options) {\n\tconst fix = \"Pass the contract reference once — either as the positional argument or as --contract.\";\n\treturn new ActionableCliError(\"CLI.CONTRACT_ARG_CONFLICT\", \"Cannot specify both a positional contract argument and --contract\", {\n\t\twhy: `The positional argument names \"${options.positional}\" and --contract names \"${options.flag}\"; there is no rule for which wins.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tpositional: options.positional,\n\t\t\tflag: options.flag\n\t\t}\n\t});\n}\n/**\n* A command was told both which ref to advance and not to advance any ref.\n* Same envelope as the positional/flag contract conflict, so a script sees\n* every invocation conflict in one shape.\n*/\nfunction errorAdvanceRefArgConflict(options) {\n\tconst fix = \"Pass either --advance-ref <name> or --no-advance-ref, not both.\";\n\treturn new ActionableCliError(\"CLI.ADVANCE_REF_ARG_CONFLICT\", \"Cannot specify both --advance-ref and --no-advance-ref\", {\n\t\twhy: `--advance-ref names \"${options.advanceRef}\" while --no-advance-ref asks for no ref to be written; there is no rule for which wins.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: { advanceRef: options.advanceRef }\n\t});\n}\n/**\n* `db migrate --advance-ref <name>` targets the empty contract, which a ref cannot name, so the ref\n* could never be written. Raised before anything is applied.\n*/\nfunction errorRefTargetEmpty(options) {\n\treturn new ActionableCliError(\"MIGRATION.REF_TARGET_EMPTY\", `Cannot advance ref \"${options.name}\" to the empty contract`, {\n\t\twhy: \"This run would bring the database to the empty contract. The empty contract is where the planner starts, not a contract a ref can name, so the ref could never be written. Nothing was applied.\",\n\t\tfix: \"Run the command again without --advance-ref.\",\n\t\tnextActions: [runCommandAction(\"Apply without advancing a ref\", options.rerunWithoutRef)],\n\t\tmeta: { name: options.name }\n\t});\n}\nfunction quotedSpaces(spaces) {\n\treturn spaces.map((space) => `\"${space}\"`).join(\", \");\n}\nfunction notSignedSentence(spaces, because, becausePlural) {\n\tif (spaces.length === 0) return \"\";\n\treturn spaces.length === 1 ? ` Space ${quotedSpaces(spaces)} was not signed, because ${because}.` : ` Spaces ${quotedSpaces(spaces)} were not signed, because ${becausePlural}.`;\n}\n/**\n* `db sign` wrote the markers, then failed to write one or more refs or their snapshots. The database is signed; running the command again writes the refs. The error also names the spaces it did not sign: those whose schema failed verification, those whose marker changed while it ran, and those whose marker lacks invariants their head ref requires, and it carries each of those spaces' findings.\n*/\nfunction errorSignRefsNotWritten(options) {\n\tconst { signedSpaces, failedSpaces, conflictSpaces, refusedSpaces, unwrittenRefs, rerunCommand } = options;\n\tconst markers = signedSpaces.length === 1 ? `the marker of space ${quotedSpaces(signedSpaces)} holds its contract` : `the markers of spaces ${quotedSpaces(signedSpaces)} hold their contracts`;\n\tconst notSigned = notSignedSentence(failedSpaces, \"its schema does not satisfy its contract\", \"their schemas do not satisfy their contracts\") + notSignedSentence(conflictSpaces, \"its marker changed while db sign ran\", \"their markers changed while db sign ran\") + notSignedSentence(refusedSpaces.map(({ space }) => space), \"its marker does not record invariants its head ref requires\", \"their markers do not record invariants their head refs require\");\n\tconst refs = unwrittenRefs.map((ref) => `ref \"${ref.name}\" of space \"${ref.space}\" (${ref.reason})`).join(\"; \");\n\tconst count = unwrittenRefs.length;\n\treturn new ActionableCliError(\"MIGRATION.SIGN_REFS_NOT_WRITTEN\", `Database signed, but ${count} ${count === 1 ? \"ref was\" : \"refs were\"} not written`, {\n\t\twhy: `The database was signed: ${markers}.${notSigned} These refs were not written: ${refs}.`,\n\t\tfix: `Fix what stopped the write, then run \\`${rerunCommand}\\` again: the markers already hold the contracts, so it writes only the refs.`,\n\t\tnextActions: [runCommandAction(\"Sign again to write the refs that were not written\", rerunCommand), ...refusedSpaces.length === 0 ? [] : [runCommandAction(\"Run the migrations that provide the missing invariants, then sign again\", options.migrateCommand)]],\n\t\tmeta: {\n\t\t\tsignedSpaces,\n\t\t\tfailedSpaces,\n\t\t\tconflictSpaces,\n\t\t\trefusedSpaces,\n\t\t\tunwrittenRefs,\n\t\t\tadvancedRefs: options.advancedRefs\n\t\t},\n\t\tdiagnostics: options.diagnostics,\n\t\tcause: options.cause\n\t});\n}\nfunction errorRefSetHashNotInGraph(resolvedHash, reachableHashes) {\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none — migration graph is empty)\";\n\tconst fix = reachableHashes.length > 0 ? \"Set the ref to the `to` hash of an on-disk migration; `{bin} migration list` shows them.\" : \"Run `{bin} migration plan` first.\";\n\tconst nextActions = reachableHashes.length > 0 ? [runCommandAction(\"List the migrations and their destination hashes\", \"{bin} migration list\"), chooseAction(\"Set the ref to the `to` hash of one of them\")] : [runCommandAction(\"Plan the first migration\", \"{bin} migration plan\")];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved contract hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: reachableHashes.length > 0 ? `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.` : \"The migration graph is empty — no hashes reachable.\",\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableHashes: [...reachableHashes]\n\t\t}\n\t});\n}\nfunction errorRefSetEmptySentinel(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_EMPTY_SENTINEL\", `Cannot set ref to the empty-database sentinel: ${hash}`, {\n\t\twhy: \"The empty-database sentinel is a planner internal; it is not a valid ref target.\",\n\t\tfix: \"Set the ref to a contract hash from the migration graph, or use another ref name.\",\n\t\tnextActions: [chooseAction(\"Set the ref to a contract hash from the migration graph\"), chooseAction(\"Or use another ref name\")],\n\t\tmeta: { hash }\n\t});\n}\n/**\n* `--legend` was combined with a machine-readable or silent output flag.\n* The legend is human-only decoration on stderr.\n*/\nfunction errorLegendHumanOnly(conflictingFlag) {\n\treturn new ActionableCliError(\"MIGRATION.LEGEND_HUMAN_ONLY\", \"`--legend` is only available for human-readable output\", {\n\t\twhy: `\\`--legend\\` prints a glyph key to stderr and cannot be combined with ${conflictingFlag}.`,\n\t\tfix: `Omit ${conflictingFlag} to print the legend alongside the tree, or omit --legend when using ${conflictingFlag}.`,\n\t\tnextActions: [chooseAction(`Omit ${conflictingFlag} to print the legend alongside the tree`), chooseAction(`Or omit --legend when using ${conflictingFlag}`)],\n\t\tmeta: { conflictingFlag }\n\t});\n}\n/**\n* `--space <id>` was given a value that doesn't satisfy the contract-space\n* naming rule (`[a-z][a-z0-9_-]{0,63}` per `isValidSpaceId`). Fires before\n* any fs work — the input is syntactically rejected the same way an on-disk\n* directory with that name would be skipped by the enumerator.\n*/\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new ActionableCliError(\"MIGRATION.INVALID_SPACE_ID\", `Invalid contract space id: ${spaceId}`, {\n\t\twhy: \"Contract space ids must match [a-z][a-z0-9_-]{0,63} (lowercase, starts with a letter, max 64 characters — the rule applied to every on-disk space directory).\",\n\t\tfix: \"Pass a space id that matches the directory naming rule, or omit --space to list every space.\",\n\t\tnextActions: [chooseAction(\"Pass a space id matching [a-z][a-z0-9_-]{0,63}\"), runCommandAction(\"Or list every space\", \"{bin} migration list\")],\n\t\tmeta: { spaceId }\n\t});\n}\n/**\n* `migration list --space <id>` was given a contract-space id that has no\n* directory under `migrations/`. Distinct from \"the space exists but is\n* empty\" — that path renders the empty-state line and exits 0 per the\n* slice spec § Empty-state. This error fires only when `<projectMigrationsDir>/<spaceId>`\n* does not exist on disk.\n*\n* `availableSpaces` lists the contract-space directory names actually\n* present, sorted lex-asc, so the diagnostic can suggest a near match\n* without making the user reach for `ls`.\n*/\nfunction errorSpaceNotFound(spaceId, availableSpaces) {\n\tconst availableList = availableSpaces.length > 0 ? availableSpaces.join(\", \") : \"(none — no contract spaces on disk yet)\";\n\tconst fix = availableSpaces.length > 0 ? `Pick one of: ${availableList}. Run \\`{bin} migration list\\` (no --space) to see every space's migrations.` : \"Author a migration with `{bin} migration new` to create the first contract-space directory.\";\n\tconst nextActions = availableSpaces.length > 0 ? [chooseAction(`Pick one of: ${availableList}`), runCommandAction(\"See every space's migrations\", \"{bin} migration list\")] : [runCommandAction(\"Author the first migration, which creates the contract-space directory\", \"{bin} migration new\")];\n\treturn new ActionableCliError(\"MIGRATION.SPACE_NOT_FOUND\", `Unknown contract space: ${spaceId}`, {\n\t\twhy: `No directory named \"${spaceId}\" exists under the migrations root.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tspaceId,\n\t\t\tavailableSpaces: [...availableSpaces]\n\t\t}\n\t});\n}\nfunction errorContractTypesModuleMissing() {\n\tconst fix = \"A config assembled by hand sets `contract.typesModule` to a module that exports the framework's and family's contract types. If the config comes from a target package's `defineConfig`, that package is older than this requirement: upgrade it to a release that sets the member.\";\n\treturn new ActionableCliError(\"CONFIG.CONTRACT_TYPES_MODULE_MISSING\", \"Config names no contract types module\", {\n\t\twhy: \"Config.contract.typesModule is not set, so a generated contract.d.ts has no module to import the framework and family contract types from.\",\n\t\tfix,\n\t\tnextActions: [editFileAction(fix)]\n\t});\n}\nfunction errorMigrationModuleMissing() {\n\tconst fix = \"A config assembled by hand sets `migrations.module` to the module that exports the target's migration helpers. If the config comes from a target package's `defineConfig`, that package is older than this requirement: upgrade it to a release that sets the member.\";\n\treturn new ActionableCliError(\"CONFIG.MIGRATION_MODULE_MISSING\", \"Config names no migration module\", {\n\t\twhy: \"Config.migrations.module is not set, so a rendered migration.ts has no module to import Migration, MigrationCLI and the operation helpers from.\",\n\t\tfix,\n\t\tnextActions: [editFileAction(fix)]\n\t});\n}\n/**\n* A `migration show` target resolved to a directory or a graph node, but no\n* on-disk package was loaded for it.\n*/\nfunction errorMigrationPackageNotFound(why) {\n\treturn new ActionableCliError(\"MIGRATION.PACKAGE_NOT_FOUND\", \"Migration package not found\", {\n\t\twhy,\n\t\tfix: \"Pass a directory name, hash prefix, or path to an on-disk app-space migration package.\",\n\t\tnextActions: [chooseAction(\"Pass a directory name, hash prefix, or path to an on-disk app-space migration package\"), runCommandAction(\"List what is on disk\", \"{bin} migration list\")]\n\t});\n}\n/** The app space has no migration packages at all, so no target can resolve. */\nfunction errorNoMigrations(appMigrationsRelative) {\n\treturn new ActionableCliError(\"MIGRATION.NO_MIGRATIONS\", \"No migrations found\", {\n\t\twhy: `No migration packages found in ${appMigrationsRelative}`,\n\t\tfix: \"Run `{bin} migration plan` to create a migration first.\",\n\t\tnextActions: [runCommandAction(\"Create the first migration\", \"{bin} migration plan\")]\n\t});\n}\nfunction errorRefSetBundleNotFound(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_BUNDLE_NOT_FOUND\", `No migration bundle matches graph-node hash ${hash}`, {\n\t\twhy: `The hash is a graph node but no on-disk bundle has metadata.to = ${hash}.`,\n\t\tfix: \"Run `pnpm fixtures:check`, or re-emit the migration that produces this hash so its bundle is restored.\",\n\t\tnextActions: [runCommandAction(\"Restore the checked-in fixtures\", \"pnpm fixtures:check\"), chooseAction(\"Or re-emit the migration that produces this hash\")],\n\t\tmeta: { hash }\n\t});\n}\n/**\n* The choices a refusal of `migration plan`'s origin gives, for `reason`: a plan from a contract\n* `migration plan` can start from, and the `db` ref pointed at one, which `migration ref set` takes only for a\n* contract a migration records.\n*/\nfunction originChoices(space, reason, invocation) {\n\tconst choice = migrationPlanChoice(space, reason);\n\tconst refTargets = choice.candidates.filter((candidate) => candidate !== \"@empty\");\n\tconst refChoice = `Point the db ref at the contract your database is at with \\`${cliCommand(invocation, \"migration ref set\", [\"db\", CONTRACT_PLACEHOLDER])}\\`, replacing ${CONTRACT_PLACEHOLDER} with ${refTargets.length > 0 ? `one of ${refTargets.map((target) => `\\`${target}\\``).join(\", \")}` : `a contract \\`${cliCommand(invocation, \"migration list\")}\\` shows`}`;\n\treturn {\n\t\tplan: printedChoicePlan(invocation, choice, []),\n\t\trefChoice\n\t};\n}\nfunction planFromCommand(invocation, from) {\n\treturn cliCommand(invocation, \"migration plan\", [\"--from\", shellQuoted(from)]);\n}\nfunction errorPlanForgotTheFlag(resolvedHash, reachableRefs, space, options) {\n\tconst invocation = options?.invocation;\n\tconst reachableList = reachableRefs.length > 0 ? reachableRefs.map((r) => `${r.name} (${r.hash})`).join(\", \") : \"(none)\";\n\tconst { plan: explicit, refChoice } = originChoices(space, `No migration records contract ${resolvedHash}`, invocation);\n\tconst refFix = reachableRefs.length > 0 ? `Run migration plan with ${reachableRefs.map((r) => `--from ${r.name}`).join(\" or \")}.` : `Plan from a contract a migration records with \\`${explicit.command}\\`: ${explicit.fill}. Or ${refChoice.charAt(0).toLowerCase()}${refChoice.slice(1)}.`;\n\tconst nextActions = reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, planFromCommand(invocation, ref.name))) : [planAction(\"Plan from an explicit origin\", explicit), chooseAction(refChoice)];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved from-hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`,\n\t\tfix: refFix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableRefs: reachableRefs.map((r) => r.name)\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\n/**\n* `viaRef: true` (the default) mirrors migration-tools' `errorRefNotResolvable`:\n* a ref name with no pointer file, where the fallback hash isn't a graph\n* node either — there's nothing to materialize a contract from.\n* `viaRef: false` is a distinct, ref-independent case: an explicit `--from\n* <hash>` that doesn't name a ref, on an empty migration graph, so there is\n* no graph node and no ref to resolve a contract through.\n*/\nfunction errorSnapshotMissing(identifier, options) {\n\tconst viaRef = options?.viaRef !== false;\n\tconst fix = viaRef ? `Create the ref with \"{bin} migration ref set ${identifier} <hash>\" (or advance it via \"{bin} db update --advance-ref ${identifier}\"), or pass a hash that is a node in the migration graph.` : `No contract source exists for hash \"${identifier}\" on an empty migration graph. Use --from with a ref name (its contract resolves through the snapshot store), or run db update first.`;\n\tconst nextActions = viaRef ? [\n\t\trunCommandAction(`Create the ref \"${identifier}\"`, `{bin} migration ref set ${identifier} <hash>`),\n\t\trunCommandAction(\"Or advance it from the database\", `{bin} db update --advance-ref ${identifier}`),\n\t\tchooseAction(\"Or pass a hash that is a node in the migration graph\")\n\t] : [chooseAction(\"Pass --from a ref name, whose contract resolves through the snapshot store\"), runCommandAction(\"Or populate the graph first\", \"{bin} db update\")];\n\treturn new ActionableCliError(\"MIGRATION.SNAPSHOT_MISSING\", viaRef ? `Ref \"${identifier}\" is not resolvable` : `No contract source for from-hash \"${identifier}\"`, {\n\t\twhy: viaRef ? `Ref \"${identifier}\" has no pointer file, and the hash being resolved is not a node in the migration graph either.` : `Hash \"${identifier}\" is not a node in the migration graph (the graph is empty), and it does not name a ref either.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tidentifier,\n\t\t\tviaRef\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\n/**\n* Default origin resolution for `migration plan` found nothing (no `--from`,\n* no `db` ref) while migrations already exist on disk. Planning would silently\n* produce an empty-origin migration that ignores the existing history — almost\n* always a mistake — so the command refuses and names the three exits.\n*/\nfunction errorPlanOriginUnknown(reachableRefs, space, invocation) {\n\tconst { plan: explicit, refChoice } = originChoices(space, \"No `db` ref and no --from say where the plan starts\", invocation);\n\tconst fromEmpty = planFromCommand(invocation, \"@empty\");\n\treturn new ActionableCliError(\"MIGRATION.PLAN_ORIGIN_UNKNOWN\", \"Cannot determine the plan origin: migrations exist but no origin is named\", {\n\t\twhy: \"Migrations exist on disk, but there is no `db` ref and no --from was given, so the plan origin would silently fall back to an empty database and the resulting migration would recreate everything the existing migrations already create.\",\n\t\tfix: [\n\t\t\t`${refChoice}, or, on a database whose migration history does not need to be kept, advance it via \\`${cliCommand(invocation, \"db update\")}\\`.`,\n\t\t\treachableRefs.length > 0 ? `Or pass the origin explicitly: ${reachableRefs.map((r) => `\\`${planFromCommand(invocation, r.name)}\\``).join(\" or \")}.` : `Or pass the origin explicitly: \\`${explicit.command}\\`. ${explicit.fill}.`,\n\t\t\t\"Or pass --from @empty to deliberately plan from an empty database.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\tchooseAction(refChoice),\n\t\t\t...reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, planFromCommand(invocation, ref.name))) : [planAction(\"Plan from an explicit origin\", explicit)],\n\t\t\trunCommandAction(\"Plan from an empty database deliberately\", fromEmpty)\n\t\t],\n\t\tmeta: { reachableRefs: reachableRefs.map((r) => r.name) }\n\t});\n}\nfunction errorStatementInvalid(statement, why, fix) {\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_INVALID\", `Invalid statement \"--${statement.verb} ${statement.text}\"`, {\n\t\twhy,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb\n\t\t}\n\t});\n}\n/**\n* A statement is well formed, but its names do not resolve in the\n* origin and destination contracts the way a rename requires.\n*/\nfunction errorStatementUnresolved(statement, why, fix) {\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_UNRESOLVED\", `Cannot resolve statement \"--${statement.verb} ${statement.text}\"`, {\n\t\twhy,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb\n\t\t}\n\t});\n}\n/**\n* A rename or convert typed in answer to a data-loss question was planned, and the plan still loses\n* the subject's data: the statement does not account for the operation the question was about.\n*/\nfunction errorStatementDidNotResolveLoss(statement, subject) {\n\tconst fix = `Answer the question about \"${subject}\" with ${statementFlag({\n\t\tverb: \"delete\",\n\t\ttext: subject\n\t})} if its data may be lost, or give a ${statement.verb} statement that keeps that data.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_DID_NOT_RESOLVE_LOSS\", `\"--${statement.verb} ${statement.text}\" does not keep the data of \"${subject}\"`, {\n\t\twhy: `The plan was made again with the statement, and it still loses the data of \"${subject}\".`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb,\n\t\t\tsubject\n\t\t}\n\t});\n}\n/** `--convert` and `--delete` name the same field, and each answers its type change differently. */\nfunction errorConvertAndDelete(field) {\n\tconst fix = `Give one of them: ${statementFlag({\n\t\tverb: \"convert\",\n\t\ttext: field\n\t})}, or ${statementFlag({\n\t\tverb: \"delete\",\n\t\ttext: field\n\t})}.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_INVALID\", `\"--convert ${field}\" and \"--delete ${field}\" conflict`, {\n\t\twhy: `Both answer the type change of \"${field}\": --convert converts each value with code you write in migration.ts, and --delete lets the database cast each value, losing those it cannot keep.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: field,\n\t\t\tverb: \"convert\"\n\t\t}\n\t});\n}\nconst MIGRATION_PLAN_VERBS = [\n\t\"rename\",\n\t\"delete\",\n\t\"convert\",\n\t\"backfill\"\n];\n/**\n* `refused`, `--convert` or `--backfill` statements that ask for code the user writes, were given\n* to `db update`, which applies its plan directly and so has no migration file whose slot the user\n* could fill. `statements` are every statement the user gave, in the order given: the `migration\n* plan` command the error suggests carries each one that command accepts, from `origin`; when no plan\n* can start there, the error says why and suggests none. Its commands repeat the `--config` of `invocation`.\n*/\nfunction needsMigrationFileReason(refused) {\n\tconst converts = refused.some(({ verb }) => verb === \"convert\");\n\tconst backfills = refused.some(({ verb }) => verb === \"backfill\");\n\tif (converts && backfills) return \"--convert of a field and --backfill ask for a migration file with a slot for the code that converts the values or the value that fills the field\";\n\treturn converts ? \"--convert of a field asks for a migration file with a slot for the code that converts its values\" : \"--backfill asks for a migration file with a slot for the value that fills the field\";\n}\nfunction errorStatementNeedsMigrationFile(statements, refused, invocation, migrationPlan) {\n\tconst written = refused.map(({ verb, text }) => `\"--${verb} ${text}\"`);\n\tconst listed = written.length === 1 ? written[0] : `${written.slice(0, -1).join(\", \")} and ${written.at(-1)}`;\n\tconst why = `${needsMigrationFileReason(refused)}, and db update has no migration file to fill: it applies its plan directly.`;\n\tconst plan = printedWayToTarget(invocation, migrationPlan, statements.filter(({ verb }) => MIGRATION_PLAN_VERBS.includes(verb)).map(statementFlag));\n\tif (plan.kind === \"on-disk\") {\n\t\tconst edit = \"Write what these statements ask for in the migration.ts of the migration on disk that changes the field, and run that migration.ts with `node`\";\n\t\treturn new ActionableCliError(\"MIGRATION.STATEMENT_NEEDS_MIGRATION_FILE\", `db update cannot carry out ${listed}`, {\n\t\t\twhy: `${why} ${plan.reason}.`,\n\t\t\tfix: plan.adoptFirst === void 0 ? `${edit}, then apply the migrations with \\`${plan.apply}\\`. Or leave out these statements: db update then asks before it loses any data.` : `${edit}. ${plan.adoptFirst}. Then apply the migrations with \\`${plan.apply}\\`. Or leave out these statements: db update then asks before it loses any data.`,\n\t\t\tnextActions: [\n\t\t\t\tchooseAction(edit),\n\t\t\t\t...plan.adoptFirst === void 0 ? [] : [chooseAction(plan.adoptFirst)],\n\t\t\t\trunCommandAction(\"Then apply the migrations on disk\", plan.apply),\n\t\t\t\tchooseAction(\"Or run db update without these statements\")\n\t\t\t],\n\t\t\tmeta: { statements: refused.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\ttext\n\t\t\t})) }\n\t\t});\n\t}\n\tif (plan.kind === \"none\" && plan.applyFirst !== void 0) {\n\t\tconst { command, runs, text: applyText, adoptFirst } = plan.applyFirst;\n\t\treturn new ActionableCliError(\"MIGRATION.STATEMENT_NEEDS_MIGRATION_FILE\", `db update cannot carry out ${listed}`, {\n\t\t\twhy: `${why} ${plan.reason}.`,\n\t\t\tfix: `${plan.reason}. Or leave out these statements: db update then asks before it loses any data.`,\n\t\t\tnextActions: [\n\t\t\t\t...adoptFirst === void 0 ? [] : [chooseAction(adoptFirst)],\n\t\t\t\truns ? runCommandAction(\"Apply the migrations on disk the database has not applied, then run the command again\", command) : chooseAction(applyText),\n\t\t\t\tchooseAction(\"Or run db update without these statements\")\n\t\t\t],\n\t\t\tmeta: { statements: refused.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\ttext\n\t\t\t})) }\n\t\t});\n\t}\n\tif (plan.kind === \"none\" || plan.kind === \"at-target\") return new ActionableCliError(\"MIGRATION.STATEMENT_NEEDS_MIGRATION_FILE\", `db update cannot carry out ${listed}`, {\n\t\twhy: `${why} No migration can be planned for them either. ${plan.reason}.`,\n\t\tfix: \"Leave out these statements: db update then asks before it loses any data.\",\n\t\tnextActions: [chooseAction(\"Run db update without these statements\")],\n\t\tmeta: { statements: refused.map(({ verb, text }) => ({\n\t\t\tverb,\n\t\t\ttext\n\t\t})) }\n\t});\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_NEEDS_MIGRATION_FILE\", `db update cannot carry out ${listed}`, {\n\t\twhy,\n\t\tfix: `Plan the change with ${quotedPlan(plan)}, fill in the migration.ts it writes, ${plan.afterPlan}. Or leave out these statements: db update then asks before it loses any data.`,\n\t\tnextActions: [planAction(\"Plan the change into a migration file to fill in\", plan), chooseAction(\"Or run db update without these statements\")],\n\t\tmeta: { statements: refused.map(({ verb, text }) => ({\n\t\t\tverb,\n\t\t\ttext\n\t\t})) }\n\t});\n}\nfunction unusedConsentSentence({ verb, text, alreadyAnsweredBy: answeredBy }) {\n\tif (answeredBy === void 0) return `--${verb} ${text} was given but nothing in this run asked about ${text}.`;\n\tif (answeredBy.kind === \"namespace\") return `--${verb} ${text} was given, but every question about namespace \"${answeredBy.namespace}\" was already answered by another flag.`;\n\treturn `--${verb} ${text} was given, but the question about ${answeredBy.subject} was already answered by --${answeredBy.flag.verb} ${answeredBy.flag.text}.`;\n}\nfunction errorConsentUnused(unused, asked) {\n\tconst actions = [...unused.some(({ alreadyAnsweredBy }) => alreadyAnsweredBy === void 0) ? [\"Remove the flag, or spell the subject the way the command names it.\"] : [], ...unused.some(({ alreadyAnsweredBy }) => alreadyAnsweredBy !== void 0) ? [\"Give one flag per question.\"] : []];\n\treturn new CliStructuredError$1(\"CLI.CONSENT_UNUSED\", unused.map(unusedConsentSentence).join(\" \"), {\n\t\t...ifDefined(\"why\", asked.length === 0 ? void 0 : `The run asked about ${asked.join(\", \")}.`),\n\t\tnextActions: actions.map((label) => ({\n\t\t\tkind: \"user-choice\",\n\t\t\tlabel\n\t\t})),\n\t\tmeta: {\n\t\t\tunused: unused.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\tvalues: [text]\n\t\t\t})),\n\t\t\t...asked.length === 0 ? {} : { asked }\n\t\t}\n\t});\n}\n/**\n* `delete` or `allow` statements given to a programmatic call match no question the plan asks,\n* so they consent to nothing.\n*/\nfunction errorStatementAnswersNoQuestion(statements, subjects) {\n\tconst written = statements.map(({ verb, text }) => `\"--${verb} ${text}\"`);\n\tconst listed = written.length === 1 ? `Statement ${written[0]} answers` : `Statements ${written.slice(0, -1).join(\", \")} and ${written.at(-1)} answer`;\n\tconst fix = subjects.length === 0 ? \"Leave the statements out: the plan asks no question.\" : `Leave them out, or name a subject the plan asks about: ${subjects.join(\", \")}.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_ANSWERS_NO_QUESTION\", `${listed} no question of the plan`, {\n\t\twhy: \"A delete or allow statement consents to an operation the plan asks about, and these name no subject the plan would lose data from or change access to.\",\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatements: statements.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\ttext\n\t\t\t})),\n\t\t\tsubjects\n\t\t}\n\t});\n}\n/**\n* Without statements, `db update` drops a renamed table or column and creates it again under the\n* new name, so any advice to run without them says so.\n*/\nconst WITHOUT_STATEMENTS_DROPS = \"A plan made without statements drops the storage of each renamed model or field with its data and creates it again under the new name, and asks for consent before it does.\";\n/** How to store the snapshot of the contract the database is at, so statements can resolve. */\nconst STORE_ORIGIN_SNAPSHOT_STEPS = [\n\t\"1. Put the contract source back to the version the database is at, and run `{bin} contract emit`.\",\n\t\"2. Run `{bin} db update --advance-ref <name> --dry-run`, with the same `--db` as this command if it has one, and check that it plans no operations. Then run it again without `--dry-run`: the database matches that contract, so this changes nothing in it, and it stores the contract snapshot. If the dry run plans operations, the database has drifted from that contract; settle that before you go on.\",\n\t\"3. Put the new contract source back, run `{bin} contract emit`, and run this command again with `--advance-ref <name>`.\"\n];\n/**\n* Statements were given, but there is no origin contract to resolve their old\n* names against.\n*/\nfunction errorStatementOriginUnknown(origin) {\n\tif (origin.hash === null) return new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the database has no marker\", {\n\t\twhy: \"The database has no marker: Prisma has never initialised or updated it, so there is no earlier contract whose names a statement could rename.\",\n\t\tfix: `Leave out the statements. If the database already holds data under the old names, preview the plan with --dry-run first. ${WITHOUT_STATEMENTS_DROPS}`,\n\t\tnextActions: [chooseAction(`Leave out the statements, and preview the plan with --dry-run first. ${WITHOUT_STATEMENTS_DROPS}`)],\n\t\tmeta: {\n\t\t\thash: null,\n\t\t\tsnapshotDirectory: origin.snapshotDirectory\n\t\t}\n\t});\n\tconst meta = {\n\t\thash: origin.hash,\n\t\tsnapshotDirectory: origin.snapshotDirectory,\n\t\t...ifDefined(\"unreadable\", origin.unreadable)\n\t};\n\tif (origin.unreadable !== void 0) return new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the origin contract snapshot cannot be read\", {\n\t\twhy: `The contract snapshot for hash \"${origin.hash}\" in ${origin.snapshotDirectory} could not be read: ${origin.unreadable}`,\n\t\tfix: [\"Restore migrations/snapshots/ from version control. If no good copy exists, store the snapshot again:\", ...STORE_ORIGIN_SNAPSHOT_STEPS].join(\"\\n\"),\n\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or store the snapshot again from the contract the database is at\")],\n\t\tmeta\n\t});\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the origin contract is unknown\", {\n\t\twhy: `No contract snapshot for hash \"${origin.hash}\" was found in ${origin.snapshotDirectory}. Statements name things in the contract the database is at, so the command needs that contract. \\`db update\\` stores the snapshot of the contract it applies only when it advances a ref: the \\`db\\` ref by default, or with \\`--db <url>\\` only the ref named by \\`--advance-ref <name>\\`. Most likely the run that brought the database to this contract advanced no ref.`,\n\t\tfix: [\n\t\t\t\"Store the snapshot of the contract the database is at, then run the rename:\",\n\t\t\t...STORE_ORIGIN_SNAPSHOT_STEPS,\n\t\t\t\"Adding --advance-ref to this command alone does not help: it would store the new contract, not the one the database is at. `migration plan --from` does not apply to `db update`.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\tchooseAction(\"Put the contract source back to the version the database is at, and emit it\"),\n\t\t\trunCommandAction(\"Check that it plans no operations (with the same --db as this command, if any)\", \"{bin} db update --advance-ref <name> --dry-run\"),\n\t\t\trunCommandAction(\"Then store its snapshot, which changes nothing in the database\", \"{bin} db update --advance-ref <name>\"),\n\t\t\tchooseAction(\"Put the new contract source back, emit it, and run this command again with --advance-ref <name>\")\n\t\t],\n\t\tmeta\n\t});\n}\n/**\n* `migration plan` refuses a first migration whose planner produced no operations: the contract\n* describes nothing to create.\n*/\nfunction errorPlanProducedNoOperations(destination) {\n\treturn errorMigrationPlanningFailed({ conflicts: [{\n\t\tkind: \"nothingToCreate\",\n\t\tsummary: \"This contract describes nothing migration plan can create, so there is no first migration to plan.\",\n\t\twhy: destination.isEmitted ? \"If the database needs something the contract does not describe, run `prisma migration new`, add its operations to the new `migration.ts`, then run that `migration.ts` with `node` to write `ops.json`.\" : \"`prisma migration new` writes a migration only to the emitted contract. If the database needs something this contract does not describe, emit it, run `prisma migration new`, add its operations to the new `migration.ts`, then run that `migration.ts` with `node` to write `ops.json`.\"\n\t}] });\n}\nconst ROLLBACK_IS_DESTRUCTIVE = \"A rollback (reverse) plan is expected to contain destructive (DROP) operations — review them before applying\";\nconst RENAMES_AND_DATA_NEED_MORE = \"Plan a rename with --rename old:new; re-adding a required field without a safe default, or a type change that needs data, may need you to fill in the planned migration.ts\";\n/**\n* The advice to plan the missing migration in the app space and apply it, or, when no `migration\n* plan` can author it, why not. The apply step is the `db migrate` the user ran, when its flags are\n* known.\n*/\nfunction planThenApply(plan, invocation) {\n\tconst printed = printedPlan(invocation, plan, []);\n\tif (printed.kind === \"none\") return noPlanReaches(printed.reason, invocation);\n\tconst to = plan.to.kind === \"reference\" ? [\"--to\", shellQuoted(plan.to.reference)] : [];\n\tconst planStep = printed.kind === \"runs\" ? printed.command : `${printed.command}\\n ${printed.fill}.`;\n\tconst applyCommand = cliCommand(invocation, \"db migrate\", invocation.rerunArgs ?? to);\n\tconst listCommand = cliCommand(invocation, \"migration list\");\n\tconst showCommand = cliCommand(invocation, \"migration show\", [\"<bundle>\"]);\n\treturn {\n\t\tfix: [\n\t\t\t\"Plan the missing edge, then apply it:\",\n\t\t\t` 1. ${planStep}`,\n\t\t\t` 2. ${applyCommand}`,\n\t\t\t`${ROLLBACK_IS_DESTRUCTIVE}.`,\n\t\t\t`${RENAMES_AND_DATA_NEED_MORE}.`,\n\t\t\t`Inspect the on-disk graph with \\`${listCommand}\\`, or \\`${showCommand}\\` for any bundle in the path you expected.`\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\tplanAction(\"Plan the missing edge\", printed),\n\t\t\tprinted.kind === \"runs\" ? runCommandAction(\"Apply it\", applyCommand) : chooseAction(`Then apply it with \\`${applyCommand}\\``),\n\t\t\tchooseAction(ROLLBACK_IS_DESTRUCTIVE),\n\t\t\tchooseAction(RENAMES_AND_DATA_NEED_MORE),\n\t\t\trunCommandAction(\"Inspect the on-disk graph\", listCommand),\n\t\t\trunCommandAction(\"Inspect a bundle in the path you expected\", showCommand)\n\t\t]\n\t};\n}\n/**\n* The advice when no `migration plan` can author the missing path: `reason` says why, and the\n* advice points at the graph.\n*/\nfunction noPlanReaches(reason, invocation) {\n\tconst listCommand = cliCommand(invocation, \"migration list\");\n\treturn {\n\t\tfix: [`${reason}.`, `Inspect the on-disk graph with \\`${listCommand}\\`.`].join(\"\\n\"),\n\t\tnextActions: [chooseAction(reason), runCommandAction(\"Inspect the on-disk graph\", listCommand)]\n\t};\n}\n/** `MIGRATION.UNFILLED_PLACEHOLDER` from `db migrate`: a migration to apply still has `placeholder(...)` calls, so its `ops.json` lacks their operations. */\nfunction errorMigrationHasUnfilledPlaceholders(directory, invocation) {\n\tconst migrationTs = join(directory, \"migration.ts\");\n\tconst edit = `Replace each placeholder(...) call in ${printedPath(invocation, migrationTs)} with the value or query it stands for.`;\n\tconst emit = selfEmitCommand(invocation, migrationTs);\n\tconst migrate = dbMigrateRerun(invocation);\n\treturn new ActionableCliError(\"MIGRATION.UNFILLED_PLACEHOLDER\", \"Migration has unfilled placeholders\", {\n\t\twhy: `The migration in ${printedPath(invocation, directory)} still has placeholder(...) calls in its migration.ts, so its ops.json does not hold their operations. Applying it would move the database to its contract without them.`,\n\t\tfix: `${edit} Then run ${emit} to write ops.json, and run ${migrate} again.`,\n\t\tnextActions: [\n\t\t\teditFileAction(edit),\n\t\t\trunCommandAction(\"Write ops.json\", emit),\n\t\t\trunCommandAction(\"Apply the migration\", migrate)\n\t\t],\n\t\tmeta: { directory }\n\t});\n}\n/** `MIGRATION.PATH_UNREACHABLE` with the caller's advice; {@link planThenApply} builds the app space's. */\nfunction errorPathUnreachable(failure, advice) {\n\treturn new ActionableCliError(\"MIGRATION.PATH_UNREACHABLE\", failure.summary, {\n\t\twhy: failure.why,\n\t\tfix: advice.fix,\n\t\tnextActions: advice.nextActions,\n\t\tmeta: failure.meta\n\t});\n}\n/**\n* Shared \"needs a live database\" precondition for read verbs that consult the\n* marker/ledger (`migration log`, `migration status`). A command needs both a\n* connection string and a control-plane driver; either missing yields the same\n* `CONFIG.DB_CONNECTION_REQUIRED` envelope with `meta.missingFlags` (canonical long-form flags\n* per CLI Style Guide §Errors) so callers can react programmatically. Returns\n* `null` when both are present.\n*/\nfunction requireLiveDatabase(args) {\n\tif (args.dbConnection && args.hasDriver) return null;\n\tconst missingFlags = args.dbConnection ? [] : [\"--db\"];\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: args.why,\n\t\tmissingFlags,\n\t\t...ifDefined(\"commandName\", args.commandName),\n\t\t...ifDefined(\"retryCommand\", args.retryCommand)\n\t});\n}\n/**\n* Maps a `RefResolutionError` from the contract/migration reference\n* resolver into a CLI structured error envelope.\n*/\n/**\n* A migration ref (dirName or hash-prefix) resolves in more than one contract\n* space. The user must qualify with `--space <id>` to disambiguate.\n*/\nfunction errorAmbiguousMigrationRef(ref, spaceIds) {\n\tconst spaceList = spaceIds.join(\", \");\n\treturn new ActionableCliError(\"MIGRATION.AMBIGUOUS_MIGRATION_REF\", `Ambiguous migration reference: \"${ref}\" resolves in multiple spaces — qualify with --space <id>`, {\n\t\twhy: `\"${ref}\" matches migrations in spaces: ${spaceList}.`,\n\t\tfix: `Qualify with --space <id> to select one space. Available matching spaces: ${spaceList}.`,\n\t\tnextActions: [chooseAction(`Qualify with --space <id>, one of: ${spaceList}`)],\n\t\tmeta: {\n\t\t\tref,\n\t\t\tspaceIds: [...spaceIds]\n\t\t}\n\t});\n}\nfunction mapRefResolutionError(error) {\n\tswitch (error.kind) {\n\t\tcase \"not-found\": {\n\t\t\tconst fix = error.grammar === \"contract\" ? \"Provide a valid contract hash, ref name, or migration directory name.\" : \"Provide a valid migration directory name or migration hash.\";\n\t\t\treturn new ActionableCliError(\"MIGRATION.REF_NOT_FOUND\", `Not a known ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\t\twhy: `No ${error.grammar} matching \"${error.input}\" exists in the migration graph or refs index.`,\n\t\t\t\tfix,\n\t\t\t\tnextActions: [chooseAction(fix)],\n\t\t\t\tmeta: {\n\t\t\t\t\tinput: error.input,\n\t\t\t\t\tgrammar: error.grammar\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcase \"ambiguous\": return new ActionableCliError(\"MIGRATION.REF_AMBIGUOUS\", `Ambiguous ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\twhy: `\"${error.input}\" matches multiple ${error.grammar}s: ${error.candidates.join(\", \")}`,\n\t\t\tfix: \"Provide a longer prefix or use the full hash to disambiguate.\",\n\t\t\tnextActions: [chooseAction(\"Provide a longer prefix or use the full hash to disambiguate\")],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\tcandidates: error.candidates,\n\t\t\t\tgrammar: error.grammar\n\t\t\t}\n\t\t});\n\t\tcase \"wrong-grammar\": return new ActionableCliError(\"MIGRATION.REF_WRONG_GRAMMAR\", error.message, {\n\t\t\twhy: error.message,\n\t\t\tfix: error.fix,\n\t\t\tnextActions: [chooseAction(error.fix)],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\texpectedGrammar: error.expectedGrammar\n\t\t\t}\n\t\t});\n\t\tcase \"invalid-format\": return new ActionableCliError(\"MIGRATION.REF_INVALID_FORMAT\", `Invalid reference format: \"${error.input}\"`, {\n\t\t\twhy: error.reason,\n\t\t\tfix: \"Provide a valid contract hash, ref name, or migration directory name.\",\n\t\t\tnextActions: [chooseAction(\"Provide a valid contract hash, ref name, or migration directory name\")],\n\t\t\tmeta: { input: error.input }\n\t\t});\n\t}\n}\n//#endregion\n//#region src/orm/migration/paths.ts\n/**\n* The directory of the config file that wrote the section, recorded when the\n* engine validated it. Every command runs behind that validation, so its\n* absence here is a bug.\n*/\nfunction baseDirFor(config) {\n\tif (config.baseDir === void 0) throw new InternalError(\"the orm config section reached a command without baseDir\");\n\treturn config.baseDir;\n}\n/**\n* Where a config keeps its migrations: `migrations.dir`, default `migrations`, resolved against the config's `baseDir`. `base` stands in for `baseDir` when a config built in memory carries none.\n*/\nfunction migrationsDirFor(config, base) {\n\treturn resolve(config.baseDir ?? base ?? baseDirFor(config), config.migrations?.dir ?? \"migrations\");\n}\n/** The app subspace under {@link migrationsDirFor}. */\nfunction appMigrationsDirFor(config) {\n\treturn spaceMigrationDirectory(migrationsDirFor(config), APP_SPACE_ID);\n}\n/**\n* Where refs live. The framework keeps them under the app subspace rather than\n* at the migrations root.\n*/\nfunction appRefsDirFor(config) {\n\treturn resolve(appMigrationsDirFor(config), \"refs\");\n}\n/** The emitted contract; the validated config carries `contract.output` absolute. */\nfunction contractPathFor(config) {\n\treturn config.contract?.output;\n}\n/**\n* The header's rendering of a path: relative to where the user invoked the\n* CLI, as the commander shell rendered it against the config file.\n*/\nfunction displayPath(path, cwd) {\n\treturn relative(cwd, path);\n}\n//#endregion\n//#region src/utils/url-credentials.ts\nconst MASK = \"****\";\nconst URL_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\//;\nconst LEADING_URL_USERINFO = /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/([^/?#\\s]+)@/;\nconst URL_USERINFO = /([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/?#\\s]+)@/g;\nconst PASSWORD_QUERY_PARAMETER = /([?&][^=&#\\s]*password[^=&#\\s]*=)([^&#\\s]*)/gi;\nfunction hasUrlScheme(text) {\n\treturn URL_SCHEME.test(text);\n}\n/**\n* Reads the userinfo of a URL without parsing its hosts, so it works for URLs `new URL` rejects,\n* such as a seed list of several `host:port` pairs. The userinfo ends at the last `@` before the\n* first `/`, `?` or `#`.\n*/\nfunction urlUserinfo(url) {\n\treturn splitUserinfo(url.match(LEADING_URL_USERINFO)?.[1] ?? \"\");\n}\n/**\n* Reads the values of the query parameters whose key contains `password`, the same ones\n* `redactUrlCredentials` masks, without parsing hosts.\n*/\nfunction passwordQueryValues(url) {\n\treturn [...url.matchAll(PASSWORD_QUERY_PARAMETER)].map((match) => match[2] ?? \"\");\n}\n/**\n* Masks the userinfo and any password query parameter of every URL in `text`, without parsing\n* hosts. The masked form matches what `new URL` gives when its username and password are set to\n* `****`.\n*/\nfunction redactUrlCredentials(text) {\n\treturn text.replace(URL_USERINFO, (_match, scheme, userinfo) => `${scheme}${maskUserinfo(splitUserinfo(userinfo))}@`).replace(PASSWORD_QUERY_PARAMETER, `$1${MASK}`);\n}\nfunction splitUserinfo(userinfo) {\n\tconst colon = userinfo.indexOf(\":\");\n\tif (colon === -1) return {\n\t\tusername: userinfo,\n\t\tpassword: \"\"\n\t};\n\treturn {\n\t\tusername: userinfo.slice(0, colon),\n\t\tpassword: userinfo.slice(colon + 1)\n\t};\n}\nfunction maskUserinfo({ username, password }) {\n\treturn `${username ? MASK : \"\"}${password ? `:${MASK}` : \"\"}`;\n}\n//#endregion\n//#region src/utils/command-helpers.ts\nconst PASSWORD_QUERY_KEY = /password/i;\nfunction contractTypesModuleOf(config) {\n\tconst module = config.contract?.typesModule;\n\treturn module === void 0 ? notOk(errorContractTypesModuleMissing()) : ok(module);\n}\nfunction migrationModuleOf(config) {\n\tconst module = config.migrations?.module;\n\treturn module === void 0 ? notOk(errorMigrationModuleMissing()) : ok(module);\n}\n/**\n* Resolves the absolute path to contract.json from the config.\n*/\nfunction resolveContractPath(config) {\n\tif (config.contract?.output === void 0) throw errorRuntime(\"CONFIG.VALIDATION_FAILED\", \"config.contract.output is required to resolve the contract path\", {\n\t\twhy: \"CLI commands read the emitted contract from config.contract.output; the config has no value to read.\",\n\t\tfix: \"Ensure your prisma.config.ts goes through `defineConfig()`, which normalises a default output when the provider supplies an input path, or set `contract.output` explicitly.\"\n\t});\n\treturn resolve(config.contract.output);\n}\n/**\n* Resolves the migrations directory and config path from CLI options.\n* Shared by migrate, migration-plan, and migration-status.\n*\n* - `migrationsDir` is the project's top-level `migrations/` directory\n* (the root that the aggregate loader walks for every contract space).\n* - `appMigrationsDir` is the app subspace directory under it\n* (`<migrationsDir>/<APP_SPACE_ID>/`). Every per-app reader / writer\n* (`migration new`, `migration plan`, `migrate`,\n* `migration status`, `migration show`, `migration ref`) operates on\n* this directory. Extensions own their own `migrations/<spaceId>/`.\n* - `refsDir` is the app's refs directory (`<appMigrationsDir>/refs/`).\n* The framework does not maintain refs at the migrations root.\n*\n* `cwd` is the directory the command was invoked from; every relative path in\n* the result is computed against it.\n*/\nfunction resolveMigrationPaths(config, cwd) {\n\tconst configPath = \"prisma.config.ts\";\n\tconst migrationsDir = migrationsDirFor(config, cwd);\n\tconst migrationsRelative = relative(cwd, migrationsDir);\n\tconst appMigrationsDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID$1);\n\treturn {\n\t\tconfigPath,\n\t\tmigrationsDir,\n\t\tmigrationsRelative,\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative: relative(cwd, appMigrationsDir),\n\t\trefsDir: resolve(appMigrationsDir, \"refs\")\n\t};\n}\nfunction collectDeclaredInvariants(graph) {\n\tconst declared = /* @__PURE__ */ new Set();\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) for (const inv of edge.invariants) declared.add(inv);\n\treturn declared;\n}\n/**\n* Maps a `MigrationEdge` to the structural-edge shape used in the\n* `MIGRATION.NO_INVARIANT_PATH` error envelope. Shared between\n* `migrate` and `migration status` so both commands surface\n* the same JSON wire shape when an invariant-aware route is unsatisfiable.\n*/\nfunction toStructuralEdge(edge) {\n\treturn {\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tinvariants: edge.invariants\n\t};\n}\nfunction targetSupportsMigrations(target) {\n\treturn hasMigrations(target);\n}\n/**\n* Hangs up without letting the hang-up decide the command's result. A rejection out of a\n* `finally` replaces the value the `try`/`catch` already returned, so an unguarded close turns a\n* mapped connection error into an unmapped one — and that is the case it hits most, because a\n* `connect()` that failed leaves nothing to close.\n*/\nasync function closeQuietly(client) {\n\ttry {\n\t\tawait client.close();\n\t} catch {}\n}\nfunction getTargetMigrations(target) {\n\treturn hasMigrations(target) ? target.migrations : void 0;\n}\n/**\n* Reads and parses contract.json, validating the framework-level envelope\n* fields (storageHash, schemaVersion, target, targetFamily).\n*\n* Family-specific validation (storage structure, codec mappings, etc.)\n* happens downstream in the control client via the family instance.\n*/\nasync function readContractEnvelope(config) {\n\tconst contractPath = resolveContractPath(config);\n\tconst content = await readFile(contractPath, \"utf-8\");\n\tconst json = JSON.parse(content);\n\tconst { schemaVersion, target, targetFamily, profileHash } = json;\n\tconst storageHash = json[\"storage\"]?.[\"storageHash\"];\n\tif (typeof storageHash !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \\`{bin} contract emit\\` to regenerate.`, { where: { path: contractPath } });\n\tif (typeof schemaVersion !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });\n\tif (typeof target !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });\n\tif (typeof targetFamily !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });\n\treturn {\n\t\t...json,\n\t\tstorageHash,\n\t\tschemaVersion,\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...typeof profileHash === \"string\" ? { profileHash } : {}\n\t};\n}\n/**\n* Masks credentials in a database connection URL.\n* Handles standard URLs (username + password + query params), URLs `new URL` rejects (such as\n* multi-host URLs), and libpq-style key=value strings.\n*/\nfunction maskConnectionUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tif (parsed.username) parsed.username = \"****\";\n\t\tif (parsed.password) parsed.password = \"****\";\n\t\tfor (const key of [...parsed.searchParams.keys()]) if (PASSWORD_QUERY_KEY.test(key)) parsed.searchParams.set(key, \"****\");\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn hasUrlScheme(url) ? redactUrlCredentials(url) : maskKeyValueCredentials(url);\n\t}\n}\n/**\n* Strips raw connection URL fragments from an error message to prevent credential leakage.\n* Call this before surfacing driver errors to the user.\n*/\nfunction sanitizeErrorMessage(message, connectionUrl) {\n\tif (!connectionUrl) return message;\n\tconst secrets = connectionUrlSecrets(connectionUrl);\n\tif (secrets === void 0) return maskKeyValueCredentials(message);\n\tlet sanitized = message.replaceAll(connectionUrl, maskConnectionUrl(connectionUrl));\n\tfor (const secret of secrets.filter(Boolean).sort(longestFirst)) sanitized = sanitized.replaceAll(secret, \"****\");\n\treturn sanitized;\n}\n/** A next action with the connection string removed from each of its strings. */\nfunction nextActionWithoutConnectionString(action, connectionUrl) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connectionUrl);\n\treturn {\n\t\tkind: action.kind,\n\t\tlabel: clean(action.label),\n\t\t...ifDefined(\"command\", action.command === void 0 ? void 0 : clean(action.command)),\n\t\t...ifDefined(\"commands\", action.commands?.map(clean)),\n\t\t...ifDefined(\"url\", action.url === void 0 ? void 0 : clean(action.url)),\n\t\t...ifDefined(\"reason\", action.reason === void 0 ? void 0 : clean(action.reason))\n\t};\n}\n/** `meta` with the connection string removed from every string it holds, however deeply nested. */\nfunction metaWithoutConnectionString(meta, connectionUrl) {\n\tconst clean = (value) => {\n\t\tif (typeof value === \"string\") return sanitizeErrorMessage(value, connectionUrl);\n\t\tif (Array.isArray(value)) return value.map(clean);\n\t\tif (typeof value === \"object\" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, clean(entry)]));\n\t\treturn value;\n\t};\n\treturn Object.fromEntries(Object.entries(meta).map(([key, value]) => [key, clean(value)]));\n}\nfunction connectionUrlSecrets(connectionUrl) {\n\ttry {\n\t\tconst { username, password, searchParams } = new URL(connectionUrl);\n\t\treturn [\n\t\t\tusername,\n\t\t\tpassword,\n\t\t\t...[...searchParams].filter(([key]) => PASSWORD_QUERY_KEY.test(key)).map(([, value]) => value)\n\t\t];\n\t} catch {\n\t\tif (!hasUrlScheme(connectionUrl)) return;\n\t\tconst { username, password } = urlUserinfo(connectionUrl);\n\t\treturn [\n\t\t\tusername,\n\t\t\tpassword,\n\t\t\t...passwordQueryValues(connectionUrl)\n\t\t];\n\t}\n}\nfunction longestFirst(a, b) {\n\treturn b.length - a.length;\n}\nfunction maskKeyValueCredentials(text) {\n\treturn text.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n}\n//#endregion\n//#region src/control-api/operations/caught-errors.ts\n/**\n* The error a command reports for one it caught. A CLI error is reported as it is, and so is any other error a library raised with a structured code, such as `CONTRACT.DEFAULT_INVALID` for a stale contract's default or `CONTRACT.TYPE_PARAMS_INVALID` for its type parameters: the code says what went wrong better than the command can. An `InternalError` is thrown again, so the command boundary, `defineOrmCommand`, lets the engine report it as a bug. Anything else is reported as `CLI.UNEXPECTED` with the `why` the command gives for the error's message, and a `code` it carries that is not a structured one, such as a driver's `ECONNREFUSED` or a SQLSTATE, in `meta.code`.\n*\n* A command that holds a database connection passes its connection string, which is then removed from every string the reported error carries, whichever of those it is.\n*/\nfunction errorFromCaught(error, why, options = {}) {\n\tconst reported = reportedError(error, why);\n\treturn options.connection === void 0 ? reported : withoutConnectionString(reported, options.connection);\n}\n/** A structured error a library raised, reported under its own code, message and fields. */\nfunction cliErrorFromStructured(error) {\n\tif (CliStructuredError$1.is(error)) return error;\n\treturn new CliStructuredError$1(error.code, error.message, {\n\t\t...ifDefined(\"severity\", error.severity),\n\t\t...ifDefined(\"why\", error.why),\n\t\t...ifDefined(\"fix\", error.fix),\n\t\t...ifDefined(\"nextActions\", error.nextActions),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl),\n\t\tcause: error\n\t});\n}\nfunction reportedError(error, why) {\n\tif (isInternalError(error)) throw error;\n\tif (CliStructuredError$1.is(error)) return error;\n\tif (isStructuredError(error)) return cliErrorFromStructured(error);\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst driverCode = error instanceof Error ? Reflect.get(error, \"code\") : void 0;\n\treturn errorUnexpected(message, {\n\t\twhy: why(message),\n\t\t...ifDefined(\"meta\", typeof driverCode === \"string\" ? { code: driverCode } : void 0),\n\t\tcause: error\n\t});\n}\nfunction withoutConnectionString(error, connection) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connection);\n\treturn new CliStructuredError$1(error.code, clean(error.message), {\n\t\tseverity: error.severity,\n\t\t...ifDefined(\"why\", error.why === void 0 ? void 0 : clean(error.why)),\n\t\t...ifDefined(\"fix\", error.fix === void 0 ? void 0 : clean(error.fix)),\n\t\t...ifDefined(\"nextActions\", error.nextActions?.map((action) => nextActionWithoutConnectionString(action, connection))),\n\t\t...ifDefined(\"diagnostics\", error.diagnostics?.map((diagnostic) => diagnosticWithoutConnectionString(diagnostic, connection))),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta === void 0 ? void 0 : metaWithoutConnectionString(error.meta, connection)),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl),\n\t\tcause: error.cause\n\t});\n}\nfunction diagnosticWithoutConnectionString(diagnostic, connection) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connection);\n\treturn {\n\t\t...diagnostic,\n\t\tsummary: clean(diagnostic.summary),\n\t\t...ifDefined(\"why\", diagnostic.why === void 0 ? void 0 : clean(diagnostic.why)),\n\t\tnextActions: diagnostic.nextActions.map((action) => nextActionWithoutConnectionString(action, connection)),\n\t\t...ifDefined(\"meta\", diagnostic.meta === void 0 ? void 0 : metaWithoutConnectionString(diagnostic.meta, connection))\n\t};\n}\n//#endregion\nexport { errorSignRefsNotWritten as $, errorContractTypesModuleMissing as A, runCommandAction as At, errorMigrationHasUnfilledPlaceholders as B, migrationPlanTo as Bt, STORE_ORIGIN_SNAPSHOT_STEPS as C, printedWayToTarget as Ct, errorConsentUnused as D, writtenMigrationRunCommand as Dt, errorConfigValidation as E, selfEmitCommand as Et, errorFileNotFound as F, migrationPlanArguments as Ft, errorPlanForgotTheFlag as G, errorMigrationPlanningFailed as H, errorHashMismatch as I, migrationPlanChoice as It, errorRefSetBundleNotFound as J, errorPlanOriginUnknown as K, errorInvalidSpaceId as L, migrationPlanForDatabase as Lt, errorConvertAndDelete as M, statementFlag as Mt, errorDatabaseConnectionRequired as N, appSpaceOf as Nt, errorContractArgConflict as O, chooseAction as Ot, errorDriverRequired as P, databasePositionOf as Pt, errorRuntime as Q, errorLegendHumanOnly as R, migrationPlanFromRun as Rt, CliStructuredError$1 as S, printedPlan as St, errorAmbiguousMigrationRef as T, rerunFlags as Tt, errorNoMigrations as U, errorMigrationPackageNotFound as V, hasMigrationPath as Vt, errorPathUnreachable as W, errorRefSetHashNotInGraph as X, errorRefSetEmptySentinel as Y, errorRefTargetEmpty as Z, baseDirFor as _, dbMigrateRerun as _t, contractTypesModuleOf as a, errorStatementNeedsMigrationFile as at, migrationsDirFor as b, planAction as bt, migrationModuleOf as c, errorTargetMigrationNotSupported as ct, resolveMigrationPaths as d, mapRefResolutionError as dt, errorSnapshotMissing as et, targetSupportsMigrations as f, planThenApply as ft, appRefsDirFor as g, cliInvocation as gt, appMigrationsDirFor as h, cliCommand as ht, collectDeclaredInvariants as i, errorStatementInvalid as it, errorContractValidationFailed as j, shellQuoted as jt, errorContractConfigMissing as k, editFileAction as kt, readContractEnvelope as l, errorTargetMismatch as lt, redactUrlCredentials as m, CONTRACT_PLACEHOLDER as mt, errorFromCaught as n, errorStatementAnswersNoQuestion as nt, getTargetMigrations as o, errorStatementOriginUnknown as ot, toStructuralEdge as p, requireLiveDatabase as pt, errorPlanProducedNoOperations as q, closeQuietly as r, errorStatementDidNotResolveLoss as rt, maskConnectionUrl as s, errorStatementUnresolved as st, cliErrorFromStructured as t, errorSpaceNotFound as tt, resolveContractPath as u, errorUnexpected as ut, contractPathFor as v, dbMigrateToEmitted as vt, errorAdvanceRefArgConflict as w, quotedPlan as wt, ActionableCliError as x, printedPath as xt, displayPath as y, dbUpdateRerun as yt, errorMarkerMissing as z, migrationP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AqB,MAAM,UAAU;CAC7D,OAAO;EACN,GAAG;EACH,SAAS,MAAM,WAAW,OAAO;EACjC,GAAG,UAAU,OAAO,WAAW,QAAQ,KAAK,IAAI,KAAK,IAAI,MAAM,WAAW,GAAG,CAAC;EAC9E,aAAa,WAAW,YAAY,KAAK,WAAW,kCAAkC,QAAQ,UAAU,CAAC;EACzG,GAAG,UAAU,QAAQ,WAAW,SAAS,KAAK,IAAI,KAAK,IAAI,4BAA4B,WAAW,MAAM,UAAU,CAAC;CACpH;AACD"}
@@ -38,7 +38,7 @@ async function loadProjectConfig(projectRoot) {
38
38
  const orm = config["orm"];
39
39
  if (orm === null || typeof orm !== "object" || Array.isArray(orm)) return EMPTY_PROJECT_CONFIG;
40
40
  config = blindCast(orm);
41
- const { validateOrmSection } = await import("./exports-CZ6dPu-O.mjs").then((n) => n.o);
41
+ const { validateOrmSection } = await import("./exports-DNFYCa6U.mjs").then((n) => n.o);
42
42
  const validation = validateOrmSection(config, {
43
43
  files: [],
44
44
  keys: {}
package/dist/cli.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import "./db-sign-DLIR5swa-CMgFrBoH.mjs";
1
+ import "./db-sign-BQMw6RX9-Stp7Gjj7.mjs";
2
2
  import { y as ormConfigSection } from "./index-C3KtOcBP.mjs";
3
3
  import { Contract } from "@prisma/orm-framework/contract/types";
4
4
  import { LoadedConfig } from "@prisma/cli-engine";