@prisma/orm-toolchain 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1

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 (196) hide show
  1. package/README.md +1 -5
  2. package/dist/{aggregate-DLUJLq5Y.d.mts → aggregate-BpcQdygS.d.mts} +83 -36
  3. package/dist/aggregate-BpcQdygS.d.mts.map +1 -0
  4. package/dist/{aggregate-CPZB020V.mjs → aggregate-T_HG6gq6.mjs} +118 -57
  5. package/dist/aggregate-T_HG6gq6.mjs.map +1 -0
  6. package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs +1026 -0
  7. package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs.map +1 -0
  8. package/dist/cli-telemetry.d.mts +9 -8
  9. package/dist/cli-telemetry.d.mts.map +1 -1
  10. package/dist/cli-telemetry.mjs +30 -27
  11. package/dist/cli-telemetry.mjs.map +1 -1
  12. package/dist/cli.d.mts +7 -14
  13. package/dist/cli.d.mts.map +1 -1
  14. package/dist/cli.mjs +3769 -1506
  15. package/dist/cli.mjs.map +1 -1
  16. package/dist/cli__control-api.d.mts +233 -93
  17. package/dist/cli__control-api.d.mts.map +1 -1
  18. package/dist/cli__control-api.mjs +3 -2
  19. package/dist/cli__control-api__testing.d.mts +5 -4
  20. package/dist/cli__control-api__testing.d.mts.map +1 -1
  21. package/dist/cli__control-api__testing.mjs +21 -16
  22. package/dist/cli__control-api__testing.mjs.map +1 -1
  23. package/dist/cli__init-output.d.mts +11 -1
  24. package/dist/cli__init-output.d.mts.map +1 -1
  25. package/dist/cli__init-output.mjs +1 -1
  26. package/dist/cli__migration-cli.d.mts +1 -1
  27. package/dist/cli__migration-cli.mjs +65 -19
  28. package/dist/cli__migration-cli.mjs.map +1 -1
  29. package/dist/config-loader.d.mts +2 -2
  30. package/dist/config-loader.mjs +2 -2
  31. package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs → contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs} +44 -16
  32. package/dist/contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs.map +1 -0
  33. package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts +59 -0
  34. package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts.map +1 -0
  35. package/dist/contract-snapshot-store-DrIwu5pn.d.mts +2 -0
  36. package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts → db-sign-gvrl0kFE-D-nTGx88.d.mts} +330 -230
  37. package/dist/db-sign-gvrl0kFE-D-nTGx88.d.mts.map +1 -0
  38. package/dist/{domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs → domain-type-generation-B4m774CV-WAjyhZHw.mjs} +144 -154
  39. package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +1 -0
  40. package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts +78 -0
  41. package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map +1 -0
  42. package/dist/emitter.d.mts +3 -3
  43. package/dist/emitter.mjs +3 -3
  44. package/dist/emitter__domain-type-generation.d.mts +2 -2
  45. package/dist/emitter__domain-type-generation.mjs +2 -2
  46. package/dist/{errors-D59OCpoI.d.mts → errors-CLwhWJiz.d.mts} +14 -3
  47. package/dist/errors-CLwhWJiz.d.mts.map +1 -0
  48. package/dist/{errors-CXbGUWGu-CstQHPh6.mjs → errors-DXha_4l--relAaiI4.mjs} +37 -42
  49. package/dist/errors-DXha_4l--relAaiI4.mjs.map +1 -0
  50. package/dist/exports-BCIlMjIW-DkUBVDzl.mjs +421 -0
  51. package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +1 -0
  52. package/dist/exports-BlYTE3-J.mjs +539 -0
  53. package/dist/exports-BlYTE3-J.mjs.map +1 -0
  54. package/dist/exports-CKgwcXbp.mjs +3973 -0
  55. package/dist/exports-CKgwcXbp.mjs.map +1 -0
  56. package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs +19 -0
  57. package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map +1 -0
  58. package/dist/{hash-DH8hl5Rq-BpM2t3Nu.mjs → hash-BAZVWU4a-BQovI7hF.mjs} +24 -3
  59. package/dist/hash-BAZVWU4a-BQovI7hF.mjs.map +1 -0
  60. package/dist/hash-CwWGlFWV.d.mts +1 -0
  61. package/dist/{hash-XZYYKJ-i.d.mts → hash-DclMqd7S-WBvXJ_4C.d.mts} +17 -4
  62. package/dist/hash-DclMqd7S-WBvXJ_4C.d.mts.map +1 -0
  63. package/dist/{import-roots-CfoYgejL.d.mts → import-roots-ARK1wjzc.d.mts} +3 -3
  64. package/dist/{import-roots-CfoYgejL.d.mts.map → import-roots-ARK1wjzc.d.mts.map} +1 -1
  65. package/dist/{import-roots-CNFBPAT1.mjs → import-roots-BPn2s_fq.mjs} +6 -6
  66. package/dist/import-roots-BPn2s_fq.mjs.map +1 -0
  67. package/dist/index-CWPFeYyi.d.mts +204 -0
  68. package/dist/index-CWPFeYyi.d.mts.map +1 -0
  69. package/dist/{index-Dgwl8Tzs.d.mts → index-tAySVPvZ.d.mts} +16 -4
  70. package/dist/index-tAySVPvZ.d.mts.map +1 -0
  71. package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs → invariants-DrF9p5Gd-BF70vGl1.mjs} +3 -3
  72. package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs.map → invariants-DrF9p5Gd-BF70vGl1.mjs.map} +1 -1
  73. package/dist/{io-635GlNx1-D3zrw2qu.mjs → io-BNxFm3eg-DYD82QeZ.mjs} +8 -8
  74. package/dist/io-BNxFm3eg-DYD82QeZ.mjs.map +1 -0
  75. package/dist/io-D8Epu7iY.d.mts +1 -0
  76. package/dist/{io-sr4CO9_t-C3eV_kn-.d.mts → io-DZfMV51z-BKlH5Dhb.d.mts} +9 -2
  77. package/dist/io-DZfMV51z-BKlH5Dhb.d.mts.map +1 -0
  78. package/dist/{migration-B2ljMJim.d.mts → migration-Bjz05034.d.mts} +12 -5
  79. package/dist/migration-Bjz05034.d.mts.map +1 -0
  80. package/dist/{migration-hspPIEeV.mjs → migration-CWyjX9vz.mjs} +18 -6
  81. package/dist/migration-CWyjX9vz.mjs.map +1 -0
  82. package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs → migration-graph-BoiiZAaU-DLht12k7.mjs} +6 -89
  83. package/dist/migration-graph-BoiiZAaU-DLht12k7.mjs.map +1 -0
  84. package/dist/{migration-graph-tarTxJ99-BrGBANeE.d.mts → migration-graph-D8IuOkZb-pSI7-k4_.d.mts} +7 -29
  85. package/dist/migration-graph-D8IuOkZb-pSI7-k4_.d.mts.map +1 -0
  86. package/dist/migration-graph-Dra4CcyN.d.mts +14 -0
  87. package/dist/migration-graph-Dra4CcyN.d.mts.map +1 -0
  88. package/dist/migration-tools.d.mts +17 -15
  89. package/dist/migration-tools.mjs +15 -15
  90. package/dist/migration-tools__aggregate.d.mts +2 -2
  91. package/dist/migration-tools__aggregate.mjs +2 -2
  92. package/dist/migration-tools__contract-snapshot-store.d.mts +4 -2
  93. package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
  94. package/dist/migration-tools__errors.d.mts +2 -2
  95. package/dist/migration-tools__errors.mjs +1 -1
  96. package/dist/migration-tools__hash.d.mts +2 -1
  97. package/dist/migration-tools__hash.mjs +1 -1
  98. package/dist/migration-tools__invariants.mjs +1 -1
  99. package/dist/migration-tools__io.d.mts +2 -2
  100. package/dist/migration-tools__io.mjs +1 -1
  101. package/dist/migration-tools__migration-graph.d.mts +3 -3
  102. package/dist/migration-tools__migration-graph.mjs +3 -3
  103. package/dist/migration-tools__migration-ts.d.mts +2 -2
  104. package/dist/migration-tools__migration-ts.mjs +2 -2
  105. package/dist/migration-tools__migration.d.mts +1 -1
  106. package/dist/migration-tools__migration.mjs +1 -1
  107. package/dist/migration-tools__ref-resolution.d.mts +2 -2
  108. package/dist/migration-tools__ref-resolution.mjs +2 -2
  109. package/dist/migration-tools__refs.mjs +1 -1
  110. package/dist/migration-tools__spaces.d.mts +1 -1
  111. package/dist/migration-tools__spaces.mjs +2 -2
  112. package/dist/{migration-ts-DdVm0rws.mjs → migration-ts-DDgjsR1O.mjs} +6 -5
  113. package/dist/migration-ts-DDgjsR1O.mjs.map +1 -0
  114. package/dist/{migration-ts-CNaAtK8C.d.mts → migration-ts-SGer0PXq.d.mts} +4 -2
  115. package/dist/migration-ts-SGer0PXq.d.mts.map +1 -0
  116. package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs +23 -0
  117. package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs.map +1 -0
  118. package/dist/output-BcC8eB0h-C5bRd-aC.mjs +129 -0
  119. package/dist/output-BcC8eB0h-C5bRd-aC.mjs.map +1 -0
  120. package/dist/publish-surface.d.mts +1 -1
  121. package/dist/publish-surface.mjs +2 -2
  122. package/dist/publish-surface__import-roots.d.mts +1 -1
  123. package/dist/publish-surface__import-roots.mjs +1 -1
  124. package/dist/publish-surface__shells.mjs +1 -1
  125. package/dist/quick-reference-mongo.md +12 -12
  126. package/dist/quick-reference-postgres.md +10 -10
  127. package/dist/quick-reference-prisma7.md +80 -0
  128. package/dist/readme-mongo.md +6 -6
  129. package/dist/readme-postgres.md +6 -6
  130. package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs +6663 -0
  131. package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs.map +1 -0
  132. package/dist/{ref-resolution-COGOSL57.d.mts → ref-resolution-BPhR-kta.d.mts} +29 -11
  133. package/dist/ref-resolution-BPhR-kta.d.mts.map +1 -0
  134. package/dist/{ref-resolution-HeNBXW53.mjs → ref-resolution-Eo0QHp4f.mjs} +30 -6
  135. package/dist/ref-resolution-Eo0QHp4f.mjs.map +1 -0
  136. package/dist/{refs-WK86uYYp-gM8tvWQP.mjs → refs-DM3q3IZC-BC6H6P0X.mjs} +9 -9
  137. package/dist/refs-DM3q3IZC-BC6H6P0X.mjs.map +1 -0
  138. package/dist/{shells-C4HbRAr5.mjs → shells-w_yEDhe8.mjs} +98 -31
  139. package/dist/shells-w_yEDhe8.mjs.map +1 -0
  140. package/dist/{spaces-Dj65JrwZ.d.mts → spaces-BWULKO54.d.mts} +3 -3
  141. package/dist/{spaces-Dj65JrwZ.d.mts.map → spaces-BWULKO54.d.mts.map} +1 -1
  142. package/dist/{spaces-4qMOAYE9.mjs → spaces-c9xdiXW8.mjs} +14 -13
  143. package/dist/spaces-c9xdiXW8.mjs.map +1 -0
  144. package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs} +7 -7
  145. package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs.map} +1 -1
  146. package/dist/vite-plugin-contract-emit.d.mts +1 -1
  147. package/dist/vite-plugin-contract-emit.mjs +10 -10
  148. package/dist/vite-plugin-contract-emit.mjs.map +1 -1
  149. package/package.json +16 -15
  150. package/dist/aggregate-CPZB020V.mjs.map +0 -1
  151. package/dist/aggregate-DLUJLq5Y.d.mts.map +0 -1
  152. package/dist/contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map +0 -1
  153. package/dist/contract-snapshot-store-CbqynbtE.d.mts +0 -28
  154. package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +0 -1
  155. package/dist/db-verify-BwgNK50T-DGvKgFCK.d.mts.map +0 -1
  156. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +0 -63
  157. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +0 -1
  158. package/dist/domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs.map +0 -1
  159. package/dist/errors-CXbGUWGu-CstQHPh6.mjs.map +0 -1
  160. package/dist/errors-D59OCpoI.d.mts.map +0 -1
  161. package/dist/exports-8ZUN43ve.mjs +0 -1734
  162. package/dist/exports-8ZUN43ve.mjs.map +0 -1
  163. package/dist/exports-BCLg4CiV-05kuwcb0.mjs +0 -160
  164. package/dist/exports-BCLg4CiV-05kuwcb0.mjs.map +0 -1
  165. package/dist/exports-BZaG8_w_.mjs +0 -243
  166. package/dist/exports-BZaG8_w_.mjs.map +0 -1
  167. package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs +0 -14
  168. package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs.map +0 -1
  169. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +0 -1
  170. package/dist/hash-XZYYKJ-i.d.mts.map +0 -1
  171. package/dist/import-roots-CNFBPAT1.mjs.map +0 -1
  172. package/dist/index-DRs7L6N0.d.mts +0 -57
  173. package/dist/index-DRs7L6N0.d.mts.map +0 -1
  174. package/dist/index-Dgwl8Tzs.d.mts.map +0 -1
  175. package/dist/io-635GlNx1-D3zrw2qu.mjs.map +0 -1
  176. package/dist/io-DYfeLJxR.d.mts +0 -1
  177. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +0 -1
  178. package/dist/migration-B2ljMJim.d.mts.map +0 -1
  179. package/dist/migration-graph-Dqndu0i5.d.mts +0 -9
  180. package/dist/migration-graph-Dqndu0i5.d.mts.map +0 -1
  181. package/dist/migration-graph-_SJImD5V-BURyY1KM.mjs.map +0 -1
  182. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +0 -1
  183. package/dist/migration-hspPIEeV.mjs.map +0 -1
  184. package/dist/migration-ts-CNaAtK8C.d.mts.map +0 -1
  185. package/dist/migration-ts-DdVm0rws.mjs.map +0 -1
  186. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +0 -13
  187. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +0 -1
  188. package/dist/output-CovTDY14-CUoAqLML.mjs +0 -77
  189. package/dist/output-CovTDY14-CUoAqLML.mjs.map +0 -1
  190. package/dist/ref-h6InR6dO-rGfl18Jv.mjs +0 -4686
  191. package/dist/ref-h6InR6dO-rGfl18Jv.mjs.map +0 -1
  192. package/dist/ref-resolution-COGOSL57.d.mts.map +0 -1
  193. package/dist/ref-resolution-HeNBXW53.mjs.map +0 -1
  194. package/dist/refs-WK86uYYp-gM8tvWQP.mjs.map +0 -1
  195. package/dist/shells-C4HbRAr5.mjs.map +0 -1
  196. package/dist/spaces-4qMOAYE9.mjs.map +0 -1
@@ -0,0 +1,19 @@
1
+ import { p as errorHashNotInGraph } from "./errors-DXha_4l--relAaiI4.mjs";
2
+ //#region ../../../1-framework/3-tooling/migration/dist/graph-membership-DxpNgxfZ.mjs
3
+ function isGraphNode(hash, graph) {
4
+ if (hash === "empty") return true;
5
+ return graph.nodes.has(hash);
6
+ }
7
+ /** True when a marker hash is in a space's history: a graph node, or the head of a space that has no migrations. */
8
+ function isInSpaceHistory(hash, space) {
9
+ if (isGraphNode(hash, space.graph)) return true;
10
+ return space.graph.nodes.size === 0 && hash === space.headHash;
11
+ }
12
+ function assertHashIsGraphNode(hash, graph) {
13
+ if (isGraphNode(hash, graph)) return;
14
+ throw errorHashNotInGraph(hash, graph);
15
+ }
16
+ //#endregion
17
+ export { isGraphNode as n, isInSpaceHistory as r, assertHashIsGraphNode as t };
18
+
19
+ //# sourceMappingURL=graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-membership-DxpNgxfZ-BfqA-H7V.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/graph-membership-DxpNgxfZ.mjs"],"sourcesContent":["import { p as errorHashNotInGraph } from \"./errors-DXha_4l-.mjs\";\nimport \"./constants-CM-w38DQ.mjs\";\n//#region src/graph-membership.ts\nfunction isGraphNode(hash, graph) {\n\tif (hash === \"empty\") return true;\n\treturn graph.nodes.has(hash);\n}\n/** True when a marker hash is in a space's history: a graph node, or the head of a space that has no migrations. */\nfunction isInSpaceHistory(hash, space) {\n\tif (isGraphNode(hash, space.graph)) return true;\n\treturn space.graph.nodes.size === 0 && hash === space.headHash;\n}\nfunction assertHashIsGraphNode(hash, graph) {\n\tif (isGraphNode(hash, graph)) return;\n\tthrow errorHashNotInGraph(hash, graph);\n}\n//#endregion\nexport { isGraphNode as n, isInSpaceHistory as r, assertHashIsGraphNode as t };\n\n//# sourceMappingURL=graph-membership-DxpNgxfZ.mjs.map"],"mappings":";;AAGA,SAAS,YAAY,MAAM,OAAO;CACjC,IAAI,SAAS,SAAS,OAAO;CAC7B,OAAO,MAAM,MAAM,IAAI,IAAI;AAC5B;;AAEA,SAAS,iBAAiB,MAAM,OAAO;CACtC,IAAI,YAAY,MAAM,MAAM,KAAK,GAAG,OAAO;CAC3C,OAAO,MAAM,MAAM,MAAM,SAAS,KAAK,SAAS,MAAM;AACvD;AACA,SAAS,sBAAsB,MAAM,OAAO;CAC3C,IAAI,YAAY,MAAM,KAAK,GAAG;CAC9B,MAAM,oBAAoB,MAAM,KAAK;AACtC"}
@@ -1,6 +1,27 @@
1
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
1
2
  import { createHash } from "node:crypto";
2
3
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
3
- //#region ../../../1-framework/3-tooling/migration/dist/hash-DH8hl5Rq.mjs
4
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
5
+ import { computeStorageHash } from "@prisma/orm-framework/contract/hashing";
6
+ //#region ../../../1-framework/3-tooling/migration/dist/hash-BAZVWU4a.mjs
7
+ /**
8
+ * Recompute the storage hash a contract's content publishes as its
9
+ * identity. The published `storage.storageHash` is the output of the emit
10
+ * pipeline's `computeStorageHash` call over a storage object that did not
11
+ * yet carry `storageHash`, so the field is stripped before recomputing.
12
+ * Shared by snapshot content verification and descriptor
13
+ * self-consistency — the one place this invariant lives.
14
+ */
15
+ function recomputePublishedStorageHash(args) {
16
+ const { storageHash: _published, ...storageWithoutHash } = blindCast(args.storage ?? {});
17
+ return computeStorageHash({
18
+ target: typeof args.target === "string" ? args.target : "",
19
+ targetFamily: typeof args.targetFamily === "string" ? args.targetFamily : "",
20
+ storage: storageWithoutHash,
21
+ ...ifDefined("shouldPreserveEmpty", args.hooks?.shouldPreserveEmpty),
22
+ ...ifDefined("sortStorage", args.hooks?.sortStorage)
23
+ });
24
+ }
4
25
  function sha256Hex(input) {
5
26
  return createHash("sha256").update(input).digest("hex");
6
27
  }
@@ -59,6 +80,6 @@ function verifyMigrationHash(pkg) {
59
80
  };
60
81
  }
61
82
  //#endregion
62
- export { verifyMigrationHash as n, computeMigrationHash as t };
83
+ export { recomputePublishedStorageHash as n, verifyMigrationHash as r, computeMigrationHash as t };
63
84
 
64
- //# sourceMappingURL=hash-DH8hl5Rq-BpM2t3Nu.mjs.map
85
+ //# sourceMappingURL=hash-BAZVWU4a-BQovI7hF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-BAZVWU4a-BQovI7hF.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/hash-BAZVWU4a.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { createHash } from \"node:crypto\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\n//#region src/hash.ts\n/**\n* Recompute the storage hash a contract's content publishes as its\n* identity. The published `storage.storageHash` is the output of the emit\n* pipeline's `computeStorageHash` call over a storage object that did not\n* yet carry `storageHash`, so the field is stripped before recomputing.\n* Shared by snapshot content verification and descriptor\n* self-consistency — the one place this invariant lives.\n*/\nfunction recomputePublishedStorageHash(args) {\n\tconst { storageHash: _published, ...storageWithoutHash } = blindCast(args.storage ?? {});\n\treturn computeStorageHash({\n\t\ttarget: typeof args.target === \"string\" ? args.target : \"\",\n\t\ttargetFamily: typeof args.targetFamily === \"string\" ? args.targetFamily : \"\",\n\t\tstorage: storageWithoutHash,\n\t\t...ifDefined(\"shouldPreserveEmpty\", args.hooks?.shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", args.hooks?.sortStorage)\n\t});\n}\nfunction sha256Hex(input) {\n\treturn createHash(\"sha256\").update(input).digest(\"hex\");\n}\n/**\n* Content-addressed migration hash over (metadata envelope, ops). See\n* ADR 199 — Storage-only migration identity for the rationale: the\n* storage-hash bookends (`from`, `to`) inside the envelope anchor the\n* contract identity by hash. The full contract IRs are not part of the\n* manifest — they live in sibling `*-contract.json` files authored\n* alongside the migration, never inlined here.\n*\n* The integrity check is purely structural, not semantic. The function\n* canonicalizes its inputs via `sortKeys` (recursive) + `JSON.stringify`\n* and hashes the result. Target-specific operation payloads (`step.sql`,\n* Mongo's pipeline AST, …) are hashed verbatim — no per-target\n* normalization is required, because what's being verified is \"do the\n* on-disk bytes still produce their recorded hash\", not \"do two\n* semantically-equivalent migrations hash the same\". The latter is an\n* emit-drift concern (ADR 192 step 2).\n*\n* The symmetry across write and read holds because `JSON.parse(\n* JSON.stringify(x))` round-trips JSON-safe values losslessly and\n* `sortKeys` is idempotent and deterministic — write-time and read-time\n* canonicalization produce the same canonical bytes regardless of\n* source-side key ordering or whitespace.\n*\n* The `migrationHash` field on the metadata is stripped before hashing\n* so the function can be used both at write time (when no hash exists\n* yet) and at verify time (rehashing an already-attested record).\n*/\nfunction computeMigrationHash(metadata, ops) {\n\tconst { migrationHash: _migrationHash, ...strippedMeta } = metadata;\n\treturn sha256Hex(canonicalizeJson([canonicalizeJson(strippedMeta), canonicalizeJson(ops)].map(sha256Hex)));\n}\n/**\n* Re-hash an in-memory migration package and compare against the stored\n* `migrationHash`. See `computeMigrationHash` for the canonicalization rules.\n*\n* Returns `{ ok: true }` when the package is internally consistent, or\n* `{ ok: false, reason: 'mismatch', storedHash, computedHash }` when it is\n* not — typically a sign of FS corruption, partial writes, or a post-emit\n* hand edit.\n*/\nfunction verifyMigrationHash(pkg) {\n\tconst computed = computeMigrationHash(pkg.metadata, pkg.ops);\n\tif (pkg.metadata.migrationHash === computed) return {\n\t\tok: true,\n\t\tstoredHash: pkg.metadata.migrationHash,\n\t\tcomputedHash: computed\n\t};\n\treturn {\n\t\tok: false,\n\t\treason: \"mismatch\",\n\t\tstoredHash: pkg.metadata.migrationHash,\n\t\tcomputedHash: computed\n\t};\n}\n//#endregion\nexport { recomputePublishedStorageHash as n, verifyMigrationHash as r, computeMigrationHash as t };\n\n//# sourceMappingURL=hash-BAZVWU4a.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,8BAA8B,MAAM;CAC5C,MAAM,EAAE,aAAa,YAAY,GAAG,uBAAuB,UAAU,KAAK,WAAW,CAAC,CAAC;CACvF,OAAO,mBAAmB;EACzB,QAAQ,OAAO,KAAK,WAAW,WAAW,KAAK,SAAS;EACxD,cAAc,OAAO,KAAK,iBAAiB,WAAW,KAAK,eAAe;EAC1E,SAAS;EACT,GAAG,UAAU,uBAAuB,KAAK,OAAO,mBAAmB;EACnE,GAAG,UAAU,eAAe,KAAK,OAAO,WAAW;CACpD,CAAC;AACF;AACA,SAAS,UAAU,OAAO;CACzB,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,KAAK;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,qBAAqB,UAAU,KAAK;CAC5C,MAAM,EAAE,eAAe,gBAAgB,GAAG,iBAAiB;CAC3D,OAAO,UAAU,iBAAiB,CAAC,iBAAiB,YAAY,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;AAC1G;;;;;;;;;;AAUA,SAAS,oBAAoB,KAAK;CACjC,MAAM,WAAW,qBAAqB,IAAI,UAAU,IAAI,GAAG;CAC3D,IAAI,IAAI,SAAS,kBAAkB,UAAU,OAAO;EACnD,IAAI;EACJ,YAAY,IAAI,SAAS;EACzB,cAAc;CACf;CACA,OAAO;EACN,IAAI;EACJ,QAAQ;EACR,YAAY,IAAI,SAAS;EACzB,cAAc;CACf;AACD"}
@@ -0,0 +1 @@
1
+ import "./hash-DclMqd7S-WBvXJ_4C.mjs";
@@ -1,7 +1,20 @@
1
- import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
2
1
  import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
3
- //#region ../../../1-framework/3-tooling/migration/dist/exports/hash.d.mts
2
+ import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
3
+ import { PreserveEmptyPredicate, StorageSort } from "@prisma/orm-framework/contract/hashing";
4
+ //#region ../../../1-framework/3-tooling/migration/dist/hash-DclMqd7S.d.mts
4
5
  //#region src/hash.d.ts
6
+ /**
7
+ * The canonicalization hooks a family's emit pipeline computes storage
8
+ * hashes with. Sourced from the target serializer's
9
+ * `hashCanonicalizationHooks` — never from its serialization-preserve
10
+ * hooks, which may be broader (Postgres preserves required entity-kind
11
+ * fields at default values on disk that the published hash canonicalized
12
+ * away).
13
+ */
14
+ interface SnapshotCanonicalizationHooks {
15
+ readonly shouldPreserveEmpty?: PreserveEmptyPredicate;
16
+ readonly sortStorage?: StorageSort;
17
+ }
5
18
  interface VerifyResult {
6
19
  readonly ok: boolean;
7
20
  readonly reason?: 'mismatch';
@@ -49,5 +62,5 @@ declare function computeMigrationHash(metadata: Omit<MigrationMetadata$1, 'migra
49
62
  */
50
63
  declare function verifyMigrationHash(pkg: OnDiskMigrationPackage): VerifyResult;
51
64
  //#endregion
52
- export { computeMigrationHash as n, verifyMigrationHash as r, VerifyResult as t };
53
- //# sourceMappingURL=hash-XZYYKJ-i.d.mts.map
65
+ export { verifyMigrationHash as i, VerifyResult as n, computeMigrationHash as r, SnapshotCanonicalizationHooks as t };
66
+ //# sourceMappingURL=hash-DclMqd7S-WBvXJ_4C.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-DclMqd7S-WBvXJ_4C.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/hash-DclMqd7S.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;WACC,sBAAsB;WACtB,cAAc;;UAEf;WACC;WACA;WACA;WACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BM,qBAAqB,UAAU,KAAK;WAC1C;GACR,KAAK;;;;;;;;;;iBAUS,oBAAoB,KAAK,yBAAyB"}
@@ -81,7 +81,7 @@ declare function createImportSpecifierResolver(root: ImportRoot): ImportSpecifie
81
81
  * The import roots a scaffolded application can be generated against.
82
82
  *
83
83
  * `platform` is absent deliberately, and this is a modelling statement rather
84
- * than a limitation to be lifted: `prisma-next init` writes an application
84
+ * than a limitation to be lifted: `prisma orm init` writes an application
85
85
  * around a per-database facade, and that facade's `runtime` entrypoint is its
86
86
  * own wiring code, not a re-export of anything. A decomposed install has no
87
87
  * name for it because it has no such module — it wires the platform packages
@@ -92,7 +92,7 @@ type ScaffoldImportRoot = Extract<ImportRoot, {
92
92
  mode: 'internal' | 'facade';
93
93
  }>;
94
94
  /**
95
- * Builds the resolver `prisma-next init` scaffolds with. Identical to
95
+ * Builds the resolver `prisma orm init` scaffolds with. Identical to
96
96
  * {@link createImportSpecifierResolver} except that it will not accept a root
97
97
  * a scaffold cannot express, so the impossible case is rejected where the
98
98
  * resolver is made rather than when a template happens to hit a name.
@@ -116,4 +116,4 @@ declare function importedSpecifiers(source: string): string[];
116
116
  declare function transitiveImports(source: string, root: ImportRoot): string[];
117
117
  //#endregion
118
118
  export { ScaffoldImportRoot as a, createScaffoldSpecifierResolver as c, importedSpecifiers as d, internalImportRoot as f, transitiveImports as h, ImportSpecifierResolver as i, directDependencyShells as l, resolveImportSpecifier as m, ImportRootError as n, buildOwnerIndex as o, platformEntrypointOf as p, ImportRootMode as r, createImportSpecifierResolver as s, ImportRoot as t, importRootForDependencies as u };
119
- //# sourceMappingURL=import-roots-CfoYgejL.d.mts.map
119
+ //# sourceMappingURL=import-roots-ARK1wjzc.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-roots-CfoYgejL.d.mts","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.d.mts"],"mappings":";;;;cAGc,wBAAwB;KACjC;;;;;;;;;;;KAWA;WACM;;WAEA;WACA,QAAQ;;WAER;;cAEG,oBAAoB,QAAQ;EACxC;;;;;;;KAOG,2BAA2B;;;;;;;;;;;;;;;;;iBAiBf,0BAA0B,cAAc,mBAAmB;UAClE;WACC,OAAO;WACP;;;;;;;;iBAQM,gBAAgB,QAAQ,YAAY,WAAW,mBAAmB,YAAY;;;;;;;iBAO9E,uBAAuB,MAAM,aAAa,YAAY;;;;;;iBAMtD,qBAAqB;EACpC,OAAO;EACP;;iBAEe,uBAAuB,mBAAmB,MAAM;iBAChD,8BAA8B,MAAM,aAAa;;;;;;;;;;;;KAY7D,qBAAqB,QAAQ;EAChC;;;;;;;;iBAQe,gCAAgC,MAAM,qBAAqB;;iBAE3D,mBAAmB;;;;;;;;;;;;;;iBAcnB,kBAAkB,gBAAgB,MAAM"}
1
+ {"version":3,"file":"import-roots-ARK1wjzc.d.mts","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.d.mts"],"mappings":";;;;cAGc,wBAAwB;KACjC;;;;;;;;;;;KAWA;WACM;;WAEA;WACA,QAAQ;;WAER;;cAEG,oBAAoB,QAAQ;EACxC;;;;;;;KAOG,2BAA2B;;;;;;;;;;;;;;;;;iBAiBf,0BAA0B,cAAc,mBAAmB;UAClE;WACC,OAAO;WACP;;;;;;;;iBAQM,gBAAgB,QAAQ,YAAY,WAAW,mBAAmB,YAAY;;;;;;;iBAO9E,uBAAuB,MAAM,aAAa,YAAY;;;;;;iBAMtD,qBAAqB;EACpC,OAAO;EACP;;iBAEe,uBAAuB,mBAAmB,MAAM;iBAChD,8BAA8B,MAAM,aAAa;;;;;;;;;;;;KAY7D,qBAAqB,QAAQ;EAChC;;;;;;;;iBAQe,gCAAgC,MAAM,qBAAqB;;iBAE3D,mBAAmB;;;;;;;;;;;;;;iBAcnB,kBAAkB,gBAAgB,MAAM"}
@@ -1,12 +1,12 @@
1
- import { n as publicShells } from "./shells-C4HbRAr5.mjs";
1
+ import { n as publicShells } from "./shells-w_yEDhe8.mjs";
2
2
  //#region ../../../0-shared/publish-surface/dist/import-roots.mjs
3
3
  /**
4
4
  * Import-root resolution: the one place that turns an internal workspace
5
5
  * specifier into the name generated code should carry.
6
6
  *
7
7
  * Emission writes package names into files the user keeps — generated
8
- * contract types, scaffolded migrations, `prisma-next init` output. Which
9
- * name is correct depends on how the application installed Prisma Next, so
8
+ * contract types, scaffolded migrations, `prisma orm init` output. Which
9
+ * name is correct depends on how the application installed Prisma 8, so
10
10
  * every emitter resolves through an {@link ImportRoot} rather than hardcoding
11
11
  * a specifier. The mapping itself is `./shells`; nothing here duplicates it.
12
12
  */
@@ -160,7 +160,7 @@ function createImportSpecifierResolver(root) {
160
160
  return (specifier) => resolveImportSpecifier(specifier, root);
161
161
  }
162
162
  /**
163
- * Builds the resolver `prisma-next init` scaffolds with. Identical to
163
+ * Builds the resolver `prisma orm init` scaffolds with. Identical to
164
164
  * {@link createImportSpecifierResolver} except that it will not accept a root
165
165
  * a scaffold cannot express, so the impossible case is rejected where the
166
166
  * resolver is made rather than when a template happens to hit a name.
@@ -215,10 +215,10 @@ function transitiveImports(source, root) {
215
215
  /**
216
216
  * Published packages this workspace does not own but `init` installs into a
217
217
  * scaffolded application directly, so its files may import them:
218
- * `@prisma/cli-engine` is the config file's `defineConfig` import.
218
+ * `@prisma/cli-engine` is the config file's `definePrismaConfig` import.
219
219
  */
220
220
  const EXTERNAL_DIRECT_DEPENDENCIES = /* @__PURE__ */ new Set(["@prisma/cli-engine"]);
221
221
  //#endregion
222
222
  export { directDependencyShells as a, internalImportRoot as c, transitiveImports as d, createScaffoldSpecifierResolver as i, platformEntrypointOf as l, buildOwnerIndex as n, importRootForDependencies as o, createImportSpecifierResolver as r, importedSpecifiers as s, ImportRootError as t, resolveImportSpecifier as u };
223
223
 
224
- //# sourceMappingURL=import-roots-CNFBPAT1.mjs.map
224
+ //# sourceMappingURL=import-roots-BPn2s_fq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-roots-BPn2s_fq.mjs","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.mjs"],"sourcesContent":["import { publicShells } from \"./shells.mjs\";\n//#region src/import-roots.ts\n/**\n* Import-root resolution: the one place that turns an internal workspace\n* specifier into the name generated code should carry.\n*\n* Emission writes package names into files the user keeps — generated\n* contract types, scaffolded migrations, `prisma orm init` output. Which\n* name is correct depends on how the application installed Prisma 8, so\n* every emitter resolves through an {@link ImportRoot} rather than hardcoding\n* a specifier. The mapping itself is `./shells`; nothing here duplicates it.\n*/\nconst INTERNAL_SCOPE = \"@internal/\";\nconst PUBLISHED_SCOPE = \"@prisma/\";\n/** An import root that emitted code cannot express. */\nvar ImportRootError = class extends Error {};\nconst internalImportRoot = { mode: \"internal\" };\n/**\n* The import root an application's own dependency list expresses.\n*\n* Emission has to name packages the application can actually resolve, and the\n* application already states which those are. Reading its manifest keeps the\n* two from drifting and lets consumers move to published names one project at\n* a time instead of behind a repository-wide switch.\n*\n* A project that names exactly one facade is on the facade root; one that\n* names platform shells without a facade is a decomposed install; anything\n* else — including a project with no `@prisma/orm-*` dependency at all — is on\n* the internal root, which emits workspace names unchanged.\n*\n* @throws {ImportRootError} when the project depends on two facades, which no\n* single generated file can be emitted for.\n*/\nfunction importRootForDependencies(dependencies) {\n\tconst named = new Set(dependencies);\n\tconst facades = [];\n\tlet hasPlatform = false;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (!named.has(shell)) continue;\n\t\tif (definition.kind === \"facade\") facades.push(shell);\n\t\tif (definition.kind === \"platform\") hasPlatform = true;\n\t}\n\tif (facades.length > 1) throw new ImportRootError(`an application may depend on only one database facade, but this one depends on ${facades.join(\" and \")}`);\n\tconst [facade] = facades;\n\tif (facade !== void 0) return {\n\t\tmode: \"facade\",\n\t\tfacade\n\t};\n\treturn hasPlatform ? { mode: \"platform\" } : internalImportRoot;\n}\nconst owners = buildOwnerIndex(publicShells);\n/**\n* Takes the shell map as an argument rather than closing over `publicShells`\n* so the duplicate-owner guard is reachable from a test: the real map is\n* valid by construction, and a guard nothing can exercise is a guard nobody\n* knows still works.\n*/\nfunction buildOwnerIndex(shells) {\n\tconst index = /* @__PURE__ */ new Map();\n\tfor (const [shell, definition] of shells) for (const pkg of definition.packages) {\n\t\tconst existing = index.get(pkg.name);\n\t\tif (existing !== void 0) throw new ImportRootError(`${pkg.name} is mapped to both ${existing.shell} and ${shell}; one module may live in only one published package (ADR 242)`);\n\t\tindex.set(pkg.name, {\n\t\t\tshell,\n\t\t\tentry: pkg.entry\n\t\t});\n\t}\n\treturn index;\n}\nfunction splitSpecifier(specifier) {\n\tconst [scope, pkg, ...rest] = specifier.split(\"/\");\n\treturn {\n\t\tname: `${scope}/${pkg}`,\n\t\tsubpath: rest.join(\"/\")\n\t};\n}\nfunction joinEntrypoint(shell, entry, subpath) {\n\tconst tail = [entry, subpath].filter(Boolean).join(\"/\");\n\treturn tail === \"\" ? shell : `${shell}/${tail}`;\n}\n/**\n* The shells an application installs directly under this root. Emitted code\n* may name only these: a package manager puts a package's own dependencies in\n* its own `node_modules`, so importing a transitively installed package fails\n* to resolve at run time even though the files are on disk.\n*/\nfunction directDependencyShells(root) {\n\tconst direct = /* @__PURE__ */ new Set();\n\tif (root.mode === \"internal\") return direct;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (definition.kind === \"extension\") direct.add(shell);\n\t\tif (root.mode === \"platform\" && definition.kind === \"platform\") direct.add(shell);\n\t}\n\tif (root.mode === \"facade\") direct.add(root.facade);\n\treturn direct;\n}\nfunction owningShell(specifier, name) {\n\tconst owner = owners.get(name);\n\tif (owner === void 0) throw new ImportRootError(`${specifier} is not mapped to any published shell`);\n\treturn owner;\n}\n/**\n* The platform-install name for an internal specifier, with the shell that\n* owns it. The shell build needs both: an import that stays inside the shell\n* being built is bundled rather than externalized.\n*/\nfunction platformEntrypointOf(specifier) {\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tconst owner = owningShell(specifier, name);\n\treturn {\n\t\tshell: owner.shell,\n\t\tid: joinEntrypoint(owner.shell, owner.entry, subpath)\n\t};\n}\n/**\n* The facade's own name for an internal specifier it republishes, or\n* `undefined` when the facade does not carry that surface.\n*/\nfunction facadeEntrypoint(facade, name, subpath) {\n\tconst definition = publicShells.get(facade);\n\t/* v8 ignore next -- @preserve: every ShellName is a key of publicShells */\n\tif (definition === void 0) throw new ImportRootError(`unknown shell ${facade}`);\n\tif (definition.kind !== \"facade\") throw new ImportRootError(`${facade} is a ${definition.kind} shell, not a facade`);\n\tfor (const reexport of definition.reexports ?? []) {\n\t\tif (reexport.package !== name) continue;\n\t\tif (subpath === \"\" && reexport.root === false) return void 0;\n\t\tif (reexport.subpaths !== void 0 && !reexport.subpaths.includes(subpath)) return void 0;\n\t\treturn joinEntrypoint(facade, reexport.entry, subpath);\n\t}\n}\nfunction describe(root) {\n\treturn root.mode === \"facade\" ? `${root.mode} (${root.facade})` : root.mode;\n}\nfunction resolveImportSpecifier(specifier, root) {\n\tif (root.mode === \"internal\") return specifier;\n\tif (!specifier.startsWith(INTERNAL_SCOPE)) return specifier;\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tif (root.mode === \"facade\") {\n\t\tconst republished = facadeEntrypoint(root.facade, name, subpath);\n\t\tif (republished !== void 0) return republished;\n\t}\n\tconst owner = owningShell(specifier, name);\n\tconst published = joinEntrypoint(owner.shell, owner.entry, subpath);\n\tif (!directDependencyShells(root).has(owner.shell)) throw new ImportRootError(unreachableUnder(specifier, published, root));\n\treturn published;\n}\n/**\n* Why a specifier has no name under `root`.\n*\n* The facade wording deliberately does not say \"not a direct dependency\":\n* under ADR 242 the answer to that is never \"install the platform package\n* too\", it is that the facade has to republish the surface.\n*/\nfunction unreachableUnder(specifier, published, root) {\n\tif (root.mode === \"facade\") return `${specifier} has no name under ${root.facade}: the facade does not republish ${published}. An application installs one facade and nothing else, so every surface it reaches has to be one of that facade’s own entrypoints (ADR 242).`;\n\treturn `${specifier} resolves to ${published}, which an application on the ${describe(root)} import root does not depend on directly. Emitted code may name only direct dependencies (ADR 242).`;\n}\nfunction createImportSpecifierResolver(root) {\n\tif (root.mode === \"internal\") return (specifier) => specifier;\n\treturn (specifier) => resolveImportSpecifier(specifier, root);\n}\n/**\n* Builds the resolver `prisma orm init` scaffolds with. Identical to\n* {@link createImportSpecifierResolver} except that it will not accept a root\n* a scaffold cannot express, so the impossible case is rejected where the\n* resolver is made rather than when a template happens to hit a name.\n*/\nfunction createScaffoldSpecifierResolver(root) {\n\treturn createImportSpecifierResolver(root);\n}\nconst MODULE_SPECIFIER = /\\b(?:from|import)\\s*\\(?\\s*(['\"])([^'\"\\n]+)\\1/g;\n/**\n* True when `source` contains module syntax that must carry a quoted\n* specifier: `import '<s>'`, `import('<s>')`, or an import/export clause\n* followed by `from '<s>'`.\n*\n* Deliberately independent of {@link MODULE_SPECIFIER} — it exists to notice\n* when that scanner has stopped matching, so it accepts any quote character,\n* including the backtick a renderer must never emit. It does still require a\n* quote: the word \"import\" on its own appears in prose and comments all the\n* time, and treating that as module syntax made the check below fire on files\n* that have no imports at all.\n*/\nconst HAS_IMPORT_SYNTAX = /(?:^|[\\s(;}])import\\s*[('\"`]|(?:^|[\\s;}])(?:import|export)\\b[\\w$*,{}\\s]*?\\bfrom\\s*['\"`]/;\n/** The module specifiers a generated source file names. */\nfunction importedSpecifiers(source) {\n\treturn [...source.matchAll(MODULE_SPECIFIER)].map(([, , specifier]) => specifier ?? \"\");\n}\n/**\n* The specifiers in a generated file that the application would not have as a\n* direct dependency under `root` — the thing no emitted file may contain.\n*\n* Under the `internal` root nothing is reported: those names are the\n* repository's own, and every in-repo consumer resolves them through the\n* workspace.\n*\n* Throws rather than returning `[]` when the source plainly has imports but\n* the scan found none. An audit whose scanner has stopped matching would\n* otherwise report every file as clean, which is the one failure mode that\n* makes the audit worse than not having it.\n*/\nfunction transitiveImports(source, root) {\n\tconst specifiers = importedSpecifiers(source);\n\tif (specifiers.length === 0 && HAS_IMPORT_SYNTAX.test(source)) throw new ImportRootError(\"source contains import syntax but no specifier was recognised; the audit would pass vacuously\");\n\tif (root.mode === \"internal\") return [];\n\tconst direct = new Set(directDependencyShells(root));\n\treturn specifiers.filter((specifier) => {\n\t\tif (specifier.startsWith(INTERNAL_SCOPE)) return true;\n\t\tif (!specifier.startsWith(PUBLISHED_SCOPE)) return false;\n\t\tconst [scope, shell] = specifier.split(\"/\");\n\t\tconst name = `${scope}/${shell}`;\n\t\treturn !direct.has(name) && !EXTERNAL_DIRECT_DEPENDENCIES.has(name);\n\t});\n}\n/**\n* Published packages this workspace does not own but `init` installs into a\n* scaffolded application directly, so its files may import them:\n* `@prisma/cli-engine` is the config file's `definePrismaConfig` import.\n*/\nconst EXTERNAL_DIRECT_DEPENDENCIES = /* @__PURE__ */ new Set([\"@prisma/cli-engine\"]);\n//#endregion\nexport { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };\n\n//# sourceMappingURL=import-roots.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;;AAExB,IAAI,kBAAkB,cAAc,MAAM,CAAC;AAC3C,MAAM,qBAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAiB9C,SAAS,0BAA0B,cAAc;CAChD,MAAM,QAAQ,IAAI,IAAI,YAAY;CAClC,MAAM,UAAU,CAAC;CACjB,IAAI,cAAc;CAClB,KAAK,MAAM,CAAC,OAAO,eAAe,cAAc;EAC/C,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG;EACvB,IAAI,WAAW,SAAS,UAAU,QAAQ,KAAK,KAAK;EACpD,IAAI,WAAW,SAAS,YAAY,cAAc;CACnD;CACA,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,gBAAgB,kFAAkF,QAAQ,KAAK,OAAO,GAAG;CAC3J,MAAM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AAG;EAC1C,MAAM,OAAO,GAAG,MAAM,GAAG;EACzB,OAAO,CAAC,OAAO,IAAI,IAAI,KAAK,CAAC,6BAA6B,IAAI,IAAI;CACnE,CAAC;AACF;;;;;;AAMA,MAAM,+CAA+C,IAAI,IAAI,CAAC,oBAAoB,CAAC"}
@@ -0,0 +1,204 @@
1
+ import { CliStructuredError } from "@prisma/orm-framework/errors/control";
2
+ import { Result } from "@prisma/orm-framework/utils/result";
3
+ import { ConfigSection, SectionProvenance } from "@prisma/cli-engine";
4
+ import { PrismaNextConfig, PrismaNextConfig as PrismaNextConfig$1 } from "@prisma/orm-framework/config/config-types";
5
+ //#region ../../../1-framework/3-tooling/config-loader/dist/exports/index.d.mts
6
+ //#region src/expand-contract-inputs.d.ts
7
+ /**
8
+ * Expands a finalized contract source input list into its member file set:
9
+ * absolute, deduped by canonical path, sorted. `patterns` must already be
10
+ * absolute (the `orm` config schema resolves each entry against the config
11
+ * file that wrote it but does not expand it).
12
+ *
13
+ * A wildcard-free entry (per tinyglobby's own magic-character check) passes
14
+ * through verbatim — no globbing, no existence check, no directory
15
+ * expansion — so a literal file, a nonexistent path (its read error
16
+ * surfaces downstream), and a directory (`contract-prisma7`'s adoption
17
+ * surface) all reach the result unchanged. Only entries containing glob
18
+ * magic run through `tinyglobby`, directories-not-auto-expanded and
19
+ * files-only; a glob matching nothing contributes nothing — no diagnostic
20
+ * here.
21
+ */
22
+ declare function expandContractInputs(patterns: readonly string[] | undefined): Promise<readonly string[]>;
23
+ /**
24
+ * The first glob entry of `patterns` that `path` matches, whether or not a
25
+ * file exists at `path`. Both must be absolute.
26
+ */
27
+ declare function globContractInputMatching(patterns: readonly string[], path: string): string | undefined;
28
+ //#endregion
29
+ //#region src/orm-section.d.ts
30
+ /** The single config section the `orm` command family owns. */
31
+ declare const ORM_CONFIG_SECTION_NAME = "orm";
32
+ /**
33
+ * Top-level subsections of the `orm` section. Diagnostics carry the
34
+ * subsection they concern so commands can fail on the ones they read and
35
+ * ignore the rest.
36
+ */
37
+ type ConfigSection$1 = 'family' | 'target' | 'adapter' | 'driver' | 'extensions' | 'db' | 'contract' | 'migrations' | 'formatter';
38
+ declare function isConfigSection(value: string): value is ConfigSection$1;
39
+ /**
40
+ * The shape of the `orm` section of `prisma.config.ts`, declared once. The
41
+ * CLI engine derives validation, the diagnostics naming a bad field and the
42
+ * file to fix, and the resolution of every `path` field against the config
43
+ * file that wrote it (prisma-cli ADR 0005). Relative paths are resolved
44
+ * before any command sees the value, and the value carries `baseDir`.
45
+ */
46
+ declare const ormConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
47
+ family: {
48
+ emission: object;
49
+ id: string;
50
+ familyId: string;
51
+ version: string;
52
+ create: Function;
53
+ kind: "family";
54
+ };
55
+ target: {
56
+ targetId: string;
57
+ id: string;
58
+ familyId: string;
59
+ version: string;
60
+ create: Function;
61
+ kind: "target";
62
+ };
63
+ adapter: {
64
+ targetId: string;
65
+ id: string;
66
+ familyId: string;
67
+ version: string;
68
+ create: Function;
69
+ kind: "adapter";
70
+ };
71
+ migrations: import("arktype/internal/attributes.ts").Default<{
72
+ dir: (In: import("arktype/internal/attributes.ts").Default<string, string>) => import("arktype").Out<string>;
73
+ }, {}>;
74
+ driver?: {
75
+ targetId: string;
76
+ id: string;
77
+ familyId: string;
78
+ version: string;
79
+ create: Function;
80
+ kind: "driver";
81
+ };
82
+ extensions?: {
83
+ targetId: string;
84
+ id: string;
85
+ familyId: string;
86
+ version: string;
87
+ create: Function;
88
+ kind: "extension";
89
+ }[];
90
+ db?: {
91
+ connection?: unknown;
92
+ };
93
+ contract?: {
94
+ source: {
95
+ load: Function;
96
+ format: "psl" | "typescript";
97
+ inputs?: ((In: string) => import("arktype").Out<string>)[];
98
+ parserOptions?: {
99
+ grammar?: "prisma-7" | "prisma-8";
100
+ };
101
+ };
102
+ output: (In: import("arktype/internal/attributes.ts").Default<string, string>) => import("arktype").Out<string>;
103
+ };
104
+ formatter?: {
105
+ indent?: number | "tab";
106
+ newline?: "LF" | "CRLF";
107
+ };
108
+ }, {
109
+ path: (In: string) => import("arktype").Out<string>;
110
+ }>;
111
+ /**
112
+ * The section token the ORM's commands declare in `needs.config`. The
113
+ * engine validates the merged section with its provenance and hands the
114
+ * handler the value: absolute paths, `migrations.dir` defaulted, `baseDir`
115
+ * recorded.
116
+ */
117
+ declare const ormConfigSection: ConfigSection<PrismaNextConfig>;
118
+ /**
119
+ * Validates a raw `orm` section the way the engine does for a command,
120
+ * for the loaders and tools that read the config outside a command run.
121
+ */
122
+ declare function validateOrmSection(raw: unknown, provenance: SectionProvenance): ReturnType<typeof ormConfigSection.validate>;
123
+ //#endregion
124
+ //#region src/load.d.ts
125
+ declare const CONFIG_FILENAME = "prisma.config.ts";
126
+ /**
127
+ * A successfully evaluated config plus the structural diagnostics found in it.
128
+ * Diagnostics are tagged with the config section they concern
129
+ * (`meta.section`); sections without diagnostics are safe to read. Callers
130
+ * must guard access through {@link requireConfigSections} — a section with a
131
+ * diagnostic may be missing or malformed despite the `PrismaNextConfig` type.
132
+ */
133
+ interface LoadedConfig$1 {
134
+ readonly config: PrismaNextConfig;
135
+ readonly diagnostics: readonly CliStructuredError[];
136
+ }
137
+ declare function findNearestConfigPathForFile(filePath: string): Promise<string | undefined>;
138
+ /**
139
+ * Validates a raw `orm` section and resolves its paths against `configDir`, the way a loaded config
140
+ * file is. A caller that builds the section in memory gets the same diagnostics as one that wrote
141
+ * it to `prisma.config.ts`.
142
+ */
143
+ declare function buildLoadedConfig(rawConfig: Record<string, unknown>, configDir: string): LoadedConfig$1;
144
+ /** One evaluated config file: its path and its top-level sections. */
145
+ interface ConfigFile {
146
+ readonly path: string;
147
+ /** The file's top-level keys minus the ones the file format keeps for itself. */
148
+ readonly sections: Readonly<Record<string, unknown>>;
149
+ }
150
+ /** The evaluated config chain, before any section is validated. */
151
+ interface ConfigFiles {
152
+ /** The requested file first, then the files it extends. */
153
+ readonly files: readonly ConfigFile[];
154
+ /** c12's merge of every file, nearest file winning. */
155
+ readonly merged: Readonly<Record<string, unknown>>;
156
+ }
157
+ /**
158
+ * Evaluates `prisma.config.ts` and hands back each file on the chain with its
159
+ * sections as written, plus c12's merge. Failures that prevent evaluation are
160
+ * the Result failure. Nothing is validated or resolved here: the CLI engine
161
+ * validates each section against its schema with the files' provenance, and
162
+ * {@link loadConfig} does the same for the `orm` section outside a command run.
163
+ */
164
+ declare function loadConfigFiles(configPath?: string, options?: {
165
+ readonly cwd?: string;
166
+ }): Promise<Result<ConfigFiles, CliStructuredError>>;
167
+ /**
168
+ * The raw default export of the module at `configPath`, evaluated exactly as
169
+ * {@link loadConfig} evaluates it and returned without validation or the
170
+ * version-marker check. The caller decides what the export means — a
171
+ * default export without the `$prismaConfig` marker is what an earlier Prisma
172
+ * CLI's config looks like.
173
+ */
174
+ declare function evaluateConfigModule(configPath: string, options?: {
175
+ readonly cwd?: string;
176
+ }): Promise<Result<unknown, CliStructuredError>>;
177
+ /**
178
+ * Loads the Prisma 8 config and validates its `orm` section.
179
+ *
180
+ * Failures that prevent evaluation entirely — missing file, module that does
181
+ * not evaluate (`CONFIG.FILE_NOT_FOUND`, `CONFIG.EVALUATION_FAILED`) — are the
182
+ * `Result` failure. Structural problems inside an evaluated config do not
183
+ * fail the load: they are returned as section-tagged diagnostics so commands
184
+ * fail only on the sections they read (via {@link requireConfigSections}).
185
+ */
186
+ declare function loadConfig(configPath?: string, options?: {
187
+ readonly cwd?: string;
188
+ }): Promise<Result<LoadedConfig$1, CliStructuredError>>;
189
+ /**
190
+ * Narrows a {@link LoadedConfig} to the sections a command reads. Fails with
191
+ * the first diagnostic concerning a required section; diagnostics on other
192
+ * sections are ignored so unrelated commands keep working.
193
+ */
194
+ declare function requireConfigSections(loaded: LoadedConfig$1, sections: readonly ConfigSection$1[]): Result<PrismaNextConfig, CliStructuredError>;
195
+ /**
196
+ * Convenience composition of {@link loadConfig} and
197
+ * {@link requireConfigSections} for commands that read a fixed set of
198
+ * sections and have no use for diagnostics outside them.
199
+ */
200
+ declare function loadConfigForSections(configPath: string | undefined, sections: readonly ConfigSection$1[]): Promise<Result<PrismaNextConfig, CliStructuredError>>;
201
+ declare function loadConfigForFile(filePath: string): Promise<Result<LoadedConfig$1, CliStructuredError>>;
202
+ //#endregion
203
+ export { loadConfigForSections as _, LoadedConfig$1 as a, requireConfigSections as b, buildLoadedConfig as c, findNearestConfigPathForFile as d, globContractInputMatching as f, loadConfigForFile as g, loadConfigFiles as h, ConfigSection$1 as i, evaluateConfigModule as l, loadConfig as m, ConfigFile as n, ORM_CONFIG_SECTION_NAME as o, isConfigSection as p, ConfigFiles as r, PrismaNextConfig$1 as s, CONFIG_FILENAME as t, expandContractInputs as u, ormConfigSchema as v, validateOrmSection as x, ormConfigSection as y };
204
+ //# sourceMappingURL=index-CWPFeYyi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CWPFeYyi.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAoBiB,qBAAqB,0CAA0C;;;;;iBAK/D,0BAA0B,6BAA6B;;;;cAI1D;;;;;;KAMT;iBACY,gBAAgB,gBAAgB,SAAS;;;;;;;;cAQ5C,+DAA+D;EAC3E;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF,qDAAqD;IACnD,MAAM,6CAA6C,8CAA8C;;EAEnG;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;;EAEF;IACE;MACE,MAAM;MACN;MACA,WAAW,iCAAiC;MAC5C;QACE;;;IAGJ,SAAS,6CAA6C,8CAA8C;;EAEtG;IACE;IACA;;;EAGF,OAAO,iCAAiC;;;;;;;;cAQ5B,kBAAkB,cAAgB;;;;;iBAK/B,mBAAmB,cAAc,YAAY,oBAAoB,kBAAkB,iBAAiB;;;cAGvG;;;;;;;;UAQJ;WACC,QAAQ;WACR,sBAAsB;;iBAEhB,6BAA6B,mBAAmB;;;;;;iBAMhD,kBAAkB,WAAW,yBAAyB,oBAAoB;;UAEjF;WACC;;WAEA,UAAU,SAAS;;;UAGpB;;WAEC,gBAAgB;;WAEhB,QAAQ,SAAS;;;;;;;;;iBASX,gBAAgB,qBAAqB;WAC3C;IACP,QAAQ,OAAO,aAAa;;;;;;;;iBAQf,qBAAqB,oBAAoB;WAC/C;IACP,QAAQ,gBAAgB;;;;;;;;;;iBAUX,WAAW,qBAAqB;WACtC;IACP,QAAQ,OAAO,gBAAc;;;;;;iBAMhB,sBAAsB,QAAQ,gBAAc,mBAAmB,oBAAkB,OAAO,kBAAoB;;;;;;iBAM5G,sBAAsB,gCAAgC,mBAAmB,oBAAkB,QAAQ,OAAO,kBAAoB;iBAC9H,kBAAkB,mBAAmB,QAAQ,OAAO,gBAAc"}
@@ -1,10 +1,10 @@
1
- import "./domain-type-generation-PkAb39ob-Ct8AGqow.mjs";
2
- import { EmissionSpi, GenerateContractTypesOptions, ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
1
+ import "./domain-type-generation-DZjtzrbE-BpOOD3YV.mjs";
3
2
  import { PreserveEmptyPredicate, SerializeContract, StorageSort } from "@prisma/orm-framework/contract/hashing";
3
+ import { EmissionSpi, GenerateContractTypesOptions, ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
4
4
  import { AggregateDescriptor } from "@prisma/orm-framework/components/components";
5
5
  import { Contract } from "@prisma/orm-framework/contract/types";
6
6
  import { AnyCodecDescriptor, CodecLookup } from "@prisma/orm-framework/components/codec";
7
- //#region ../../../1-framework/3-tooling/emitter/dist/index-uXQjRiyo.d.mts
7
+ //#region ../../../1-framework/3-tooling/emitter/dist/index-DwyuWn4O.d.mts
8
8
  //#region src/artifact-paths.d.ts
9
9
  interface EmittedArtifactPaths {
10
10
  readonly jsonPath: string;
@@ -21,6 +21,7 @@ declare function getEmittedArtifactPaths(outputJsonPath: string): EmittedArtifac
21
21
  interface EmitStackInput {
22
22
  readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
23
23
  readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
24
+ readonly parameterizedOutputTypeImports?: ReadonlyArray<TypesImportSpec>;
24
25
  readonly extensionIds?: ReadonlyArray<string>;
25
26
  readonly codecLookup?: CodecLookup;
26
27
  readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;
@@ -55,6 +56,17 @@ interface EmitOptions {
55
56
  * while its own code still imports workspace names.
56
57
  */
57
58
  readonly resolveImportSpecifier?: ImportSpecifierResolver;
59
+ /**
60
+ * Threaded from `descriptor.supportsNamespaces`. `false` drops the namespace segment from emitted `Models` member names and the `models` constant.
61
+ */
62
+ readonly supportsNamespaces?: boolean;
63
+ /**
64
+ * Hydrates the canonical JSON object back into a contract. The declarations
65
+ * are always generated from that round-trip, never from the contract as
66
+ * authored, so `contract.d.ts` orders every collection the way
67
+ * `contract.json` does and a render from the JSON reproduces it exactly.
68
+ */
69
+ readonly deserializeContract: (json: Record<string, unknown>) => Contract;
58
70
  }
59
71
  interface EmitResult {
60
72
  readonly contractJson: string;
@@ -75,4 +87,4 @@ declare function generateContractDts(contract: Contract, emitter: EmissionSpi, c
75
87
  }, options?: GenerateContractTypesOptions, codecLookup?: CodecLookup, resolveImportSpecifier?: ImportSpecifierResolver): string;
76
88
  //#endregion
77
89
  export { emit as a, EmittedArtifactPaths as i, EmitResult as n, generateContractDts as o, EmitStackInput as r, getEmittedArtifactPaths as s, EmitOptions as t };
78
- //# sourceMappingURL=index-Dgwl8Tzs.d.mts.map
90
+ //# sourceMappingURL=index-tAySVPvZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-tAySVPvZ.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/index-DwyuWn4O.d.mts"],"mappings":";;;;;;;;UAOU;WACC;WACA;;iBAEM,wBAAwB,yBAAyB;;;;;;;;UAQxD;WACC,mBAAmB,cAAc;WACjC,4BAA4B,cAAc;WAC1C,iCAAiC,cAAc;WAC/C,eAAe;WACf,cAAc;WACd,mBAAmB,cAAc;WACjC,uBAAuB,cAAc;;UAEtC;WACC;;;;;;;;;;WAUA,mBAAmB;;;;;WAKnB,sBAAsB;;;;;WAKtB,cAAc;;;;;;;WAOd,yBAAyB;;;;WAIzB;;;;;;;WAOA,sBAAsB,MAAM,4BAA4B;;UAEzD;WACC;WACA;WACA;WACA;WACA;;;;iBAIM,KAAK,UAAU,UAAU,OAAO,gBAAgB,cAAc,aAAa,SAAS,cAAc,QAAQ;;;iBAG1G,oBAAoB,UAAU,UAAU,SAAS,aAAa,kBAAkB,cAAc,kBAAkB;WACtH;WACA;WACA;GACR,UAAU,8BAA8B,cAAc,aAAa,yBAAyB"}
@@ -1,5 +1,5 @@
1
- import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-CXbGUWGu-CstQHPh6.mjs";
2
- //#region ../../../1-framework/3-tooling/migration/dist/invariants-CTHy88OP.mjs
1
+ import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-DXha_4l--relAaiI4.mjs";
2
+ //#region ../../../1-framework/3-tooling/migration/dist/invariants-DrF9p5Gd.mjs
3
3
  /**
4
4
  * Hygiene check for `invariantId`. Rejects empty values plus any
5
5
  * whitespace or control character (including Unicode whitespace like
@@ -54,4 +54,4 @@ function readInvariantId(op) {
54
54
  //#endregion
55
55
  export { validateInvariantId as n, deriveProvidedInvariants as t };
56
56
 
57
- //# sourceMappingURL=invariants-CTHy88OP-CYI2a8IO.mjs.map
57
+ //# sourceMappingURL=invariants-DrF9p5Gd-BF70vGl1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"invariants-CTHy88OP-CYI2a8IO.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-CTHy88OP.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-CXbGUWGu.mjs\";\n//#region src/invariants.ts\n/**\n* Hygiene check for `invariantId`. Rejects empty values plus any\n* whitespace or control character (including Unicode whitespace like\n* NBSP and em space, which are visually identical to ASCII space and\n* routinely sneak in via paste).\n*/\nfunction validateInvariantId(invariantId) {\n\tif (invariantId.length === 0) return false;\n\treturn !/[\\p{Cc}\\p{White_Space}]/u.test(invariantId);\n}\n/**\n* Walk a migration's operations and produce its `providedInvariants`\n* aggregate: the sorted, deduplicated list of `invariantId`s declared\n* by ops in the migration. Ops without an `invariantId` are skipped.\n*\n* Both `data`-class ops (data-transforms, e.g. backfills) and\n* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle\n* via `installEqlBundleOp`) may declare invariantIds: the\n* `operationClass` axis classifies *policy gating* (which kinds of ops\n* a `db init` / `db update` policy permits), while `invariantId`\n* classifies *marker bookkeeping* (which named bundles of work a\n* future regeneration knows to skip). The two concerns are\n* intentionally orthogonal — an extension can ship additive\n* non-IR-derivable DDL (the only way the planner can know the bundle\n* is already applied is via the invariantId on the marker) without\n* needing to mis-classify it as `data`-class.\n*\n* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and\n* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.\n*\n* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n* — extension migrations carry `invariantId`s on additive ops; e.g.\n* cipherstash's `installEqlBundle` and structural `create-*` ops are\n* additive-class but carry `cipherstash:*` invariantIds.\n*/\nfunction deriveProvidedInvariants(ops) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const op of ops) {\n\t\tconst invariantId = readInvariantId(op);\n\t\tif (invariantId === void 0) continue;\n\t\tif (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);\n\t\tif (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);\n\t\tseen.add(invariantId);\n\t}\n\treturn [...seen].sort();\n}\nfunction readInvariantId(op) {\n\tif (!Object.hasOwn(op, \"invariantId\")) return void 0;\n\tconst candidate = op.invariantId;\n\treturn typeof candidate === \"string\" ? candidate : void 0;\n}\n//#endregion\nexport { validateInvariantId as n, deriveProvidedInvariants as t };\n\n//# sourceMappingURL=invariants-CTHy88OP.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,aAAa;CACzC,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,OAAO,CAAC,2BAA2B,KAAK,WAAW;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB,KAAK;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,MAAM,KAAK;EACrB,MAAM,cAAc,gBAAgB,EAAE;EACtC,IAAI,gBAAgB,KAAK,GAAG;EAC5B,IAAI,CAAC,oBAAoB,WAAW,GAAG,MAAM,wBAAwB,WAAW;EAChF,IAAI,KAAK,IAAI,WAAW,GAAG,MAAM,8BAA8B,WAAW;EAC1E,KAAK,IAAI,WAAW;CACrB;CACA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;AACvB;AACA,SAAS,gBAAgB,IAAI;CAC5B,IAAI,CAAC,OAAO,OAAO,IAAI,aAAa,GAAG,OAAO,KAAK;CACnD,MAAM,YAAY,GAAG;CACrB,OAAO,OAAO,cAAc,WAAW,YAAY,KAAK;AACzD"}
1
+ {"version":3,"file":"invariants-DrF9p5Gd-BF70vGl1.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-DrF9p5Gd.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-DXha_4l-.mjs\";\n//#region src/invariants.ts\n/**\n* Hygiene check for `invariantId`. Rejects empty values plus any\n* whitespace or control character (including Unicode whitespace like\n* NBSP and em space, which are visually identical to ASCII space and\n* routinely sneak in via paste).\n*/\nfunction validateInvariantId(invariantId) {\n\tif (invariantId.length === 0) return false;\n\treturn !/[\\p{Cc}\\p{White_Space}]/u.test(invariantId);\n}\n/**\n* Walk a migration's operations and produce its `providedInvariants`\n* aggregate: the sorted, deduplicated list of `invariantId`s declared\n* by ops in the migration. Ops without an `invariantId` are skipped.\n*\n* Both `data`-class ops (data-transforms, e.g. backfills) and\n* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle\n* via `installEqlBundleOp`) may declare invariantIds: the\n* `operationClass` axis classifies *policy gating* (which kinds of ops\n* a `db init` / `db update` policy permits), while `invariantId`\n* classifies *marker bookkeeping* (which named bundles of work a\n* future regeneration knows to skip). The two concerns are\n* intentionally orthogonal — an extension can ship additive\n* non-IR-derivable DDL (the only way the planner can know the bundle\n* is already applied is via the invariantId on the marker) without\n* needing to mis-classify it as `data`-class.\n*\n* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and\n* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.\n*\n* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n* — extension migrations carry `invariantId`s on additive ops; e.g.\n* cipherstash's `installEqlBundle` and structural `create-*` ops are\n* additive-class but carry `cipherstash:*` invariantIds.\n*/\nfunction deriveProvidedInvariants(ops) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const op of ops) {\n\t\tconst invariantId = readInvariantId(op);\n\t\tif (invariantId === void 0) continue;\n\t\tif (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);\n\t\tif (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);\n\t\tseen.add(invariantId);\n\t}\n\treturn [...seen].sort();\n}\nfunction readInvariantId(op) {\n\tif (!Object.hasOwn(op, \"invariantId\")) return void 0;\n\tconst candidate = op.invariantId;\n\treturn typeof candidate === \"string\" ? candidate : void 0;\n}\n//#endregion\nexport { validateInvariantId as n, deriveProvidedInvariants as t };\n\n//# sourceMappingURL=invariants-DrF9p5Gd.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,aAAa;CACzC,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,OAAO,CAAC,2BAA2B,KAAK,WAAW;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB,KAAK;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,MAAM,KAAK;EACrB,MAAM,cAAc,gBAAgB,EAAE;EACtC,IAAI,gBAAgB,KAAK,GAAG;EAC5B,IAAI,CAAC,oBAAoB,WAAW,GAAG,MAAM,wBAAwB,WAAW;EAChF,IAAI,KAAK,IAAI,WAAW,GAAG,MAAM,8BAA8B,WAAW;EAC1E,KAAK,IAAI,WAAW;CACrB;CACA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;AACvB;AACA,SAAS,gBAAgB,IAAI;CAC5B,IAAI,CAAC,OAAO,OAAO,IAAI,aAAa,GAAG,OAAO,KAAK;CACnD,MAAM,YAAY,GAAG;CACrB,OAAO,OAAO,cAAc,WAAW,YAAY,KAAK;AACzD"}
@@ -1,13 +1,13 @@
1
- import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, j as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-CXbGUWGu-CstQHPh6.mjs";
2
- import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs";
3
- import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
4
- import { t as deriveProvidedInvariants } from "./invariants-CTHy88OP-CYI2a8IO.mjs";
5
- import { n as MigrationOpsSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
1
+ import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-DXha_4l--relAaiI4.mjs";
2
+ import { r as verifyMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
3
+ import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs";
4
+ import { t as deriveProvidedInvariants } from "./invariants-DrF9p5Gd-BF70vGl1.mjs";
5
+ import { n as MigrationOpsSchema } from "./op-schema-3tXg0LTS-DqpOKDEa.mjs";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { basename, dirname, join, resolve } from "pathe";
8
8
  import { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
9
9
  import { type } from "arktype";
10
- //#region ../../../1-framework/3-tooling/migration/dist/io-635GlNx1.mjs
10
+ //#region ../../../1-framework/3-tooling/migration/dist/io-BNxFm3eg.mjs
11
11
  const MANIFEST_FILE = "migration.json";
12
12
  const OPS_FILE = "ops.json";
13
13
  const MAX_SLUG_LENGTH = 64;
@@ -161,7 +161,7 @@ async function readMigrationPackage(dir, options) {
161
161
  validateOps(ops, opsPath);
162
162
  const derivedInvariants = deriveProvidedInvariants(ops);
163
163
  if (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);
164
- const endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to);
164
+ const endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to, options.verifySnapshotContent);
165
165
  const pkg = {
166
166
  dirName: basename(absoluteDir),
167
167
  dirPath: absoluteDir,
@@ -310,4 +310,4 @@ function formatMigrationDirName(timestamp, slug) {
310
310
  //#endregion
311
311
  export { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };
312
312
 
313
- //# sourceMappingURL=io-635GlNx1-D3zrw2qu.mjs.map
313
+ //# sourceMappingURL=io-BNxFm3eg-DYD82QeZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io-BNxFm3eg-DYD82QeZ.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-BNxFm3eg.mjs"],"sourcesContent":["import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from \"./errors-DXha_4l-.mjs\";\nimport { r as verifyMigrationHash } from \"./hash-BAZVWU4a.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-6gIBcUeb.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-DrF9p5Gd.mjs\";\nimport { n as MigrationOpsSchema } from \"./op-schema-3tXg0LTS.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join, resolve } from \"pathe\";\nimport { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/io.ts\nconst MANIFEST_FILE = \"migration.json\";\nconst OPS_FILE = \"ops.json\";\nconst MAX_SLUG_LENGTH = 64;\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\nconst MigrationMetadataSchema = type({\n\t\"+\": \"reject\",\n\tfrom: \"string > 0 | null\",\n\tto: \"string\",\n\tmigrationHash: \"string\",\n\tprovidedInvariants: \"string[]\",\n\tcreatedAt: \"string\"\n});\nasync function writeMigrationPackage(dir, metadata, ops) {\n\tawait mkdir(dirname(dir), { recursive: true });\n\ttry {\n\t\tawait mkdir(dir);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"EEXIST\")) throw errorDirectoryExists(dir);\n\t\tthrow error;\n\t}\n\tawait writeFile(join(dir, MANIFEST_FILE), JSON.stringify(metadata, null, 2), { flag: \"wx\" });\n\tawait writeFile(join(dir, OPS_FILE), JSON.stringify(ops, null, 2), { flag: \"wx\" });\n}\n/**\n* Materialise an in-memory {@link MigrationPackage} to a per-space\n* directory on disk.\n*\n* Writes two files under `<targetDir>/<pkg.dirName>/`:\n*\n* - `migration.json` — the manifest (pretty-printed, matches\n* {@link writeMigrationPackage}'s output for byte-for-byte parity with\n* app-space migrations).\n* - `ops.json` — the operation list (pretty-printed).\n*\n* Distinct verb from the lower-level {@link writeMigrationPackage}\n* (which takes constituent `(metadata, ops)`): callers reading\n* `materialise…` know they are persisting a struct-typed package.\n*\n* Overwrite-idempotent: the per-package directory is cleared before\n* each emit, so re-running against the same `targetDir` produces\n* byte-identical contents and never leaves stale files behind. The\n* lower-level {@link writeMigrationPackage} stays strict because the\n* CLI authoring path (`migration plan` / `migration new`) deliberately\n* refuses to clobber an existing authored migration; this helper is\n* the re-emit path that is supposed to converge on a single canonical\n* on-disk shape.\n*\n* The per-space head contract resolves through\n* `<projectMigrationsDir>/snapshots/<hex>/` (written by\n* {@link import('./emit-contract-space-artifacts').emitContractSpaceArtifacts}),\n* not inside the per-package directory. The runner reads only\n* `migration.json` + `ops.json` from each package.\n*/\nasync function materialiseMigrationPackage(targetDir, pkg) {\n\tconst dir = join(targetDir, pkg.dirName);\n\tawait rm(dir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait writeMigrationPackage(dir, pkg.metadata, pkg.ops);\n}\n/**\n* Idempotent variant of {@link materialiseMigrationPackage}: writes the\n* package only if `<targetDir>/<pkg.dirName>/` does not already exist on\n* disk as a directory; returns `{ written: false }` when the package\n* directory is present (no rewrite, no comparison — by-existence skip).\n*\n* Concretely:\n* - existing directory → skip silently, return `{ written: false }`.\n* - missing path → write three files via {@link materialiseMigrationPackage},\n* return `{ written: true }`.\n* - path exists but is not a directory (file/symlink) → treated as\n* missing; {@link materialiseMigrationPackage} will attempt creation\n* and fail with an appropriate OS error.\n* - any other I/O error from `stat` → propagated unchanged.\n*\n* Used by the CLI's `runContractSpaceExtensionMigrationsPass` to\n* materialise extension migration packages into a project's\n* `migrations/<spaceId>/` directory, and by extension-package tests\n* that mirror the same idempotent-rematerialise property locally\n* without taking a CLI dependency.\n*/\nasync function materialiseExtensionMigrationPackageIfMissing(targetDir, pkg) {\n\tif (await directoryExists(join(targetDir, pkg.dirName))) return { written: false };\n\tawait materialiseMigrationPackage(targetDir, pkg);\n\treturn { written: true };\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\n/**\n* Copy a list of files into `destDir`, optionally renaming each one.\n*\n* The destination directory is created (with `recursive: true`) if it\n* does not already exist. Each source path is copied byte-for-byte into\n* `destDir/<destName>`; missing sources throw `ENOENT`. The helper is\n* intentionally generic: callers own the list of files and the naming\n* convention for the copies.\n*/\nasync function copyFilesWithRename(destDir, files) {\n\tawait mkdir(destDir, { recursive: true });\n\tfor (const file of files) {\n\t\tif (basename(file.destName) !== file.destName) throw errorInvalidDestName(file.destName);\n\t\tawait copyFile(file.sourcePath, join(destDir, file.destName));\n\t}\n}\nasync function writeMigrationMetadata(dir, metadata) {\n\tawait writeFile(join(dir, MANIFEST_FILE), `${JSON.stringify(metadata, null, 2)}\\n`);\n}\nasync function writeMigrationOps(dir, ops) {\n\tawait writeFile(join(dir, OPS_FILE), `${JSON.stringify(ops, null, 2)}\\n`);\n}\nasync function readMigrationPackage(dir, options) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(MANIFEST_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(OPS_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(manifestPath, e instanceof Error ? e.message : String(e));\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(opsPath, e instanceof Error ? e.message : String(e));\n\t}\n\tvalidateMetadata(metadata, manifestPath);\n\tvalidateOps(ops, opsPath);\n\tconst derivedInvariants = deriveProvidedInvariants(ops);\n\tif (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);\n\tconst endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to, options.verifySnapshotContent);\n\tconst pkg = {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops,\n\t\t...ifDefined(\"endContractJson\", endContractJson)\n\t};\n\tconst verification = verifyMigrationHash(pkg);\n\tif (!verification.ok) throw errorMigrationHashMismatch(absoluteDir, verification.storedHash, verification.computedHash);\n\treturn pkg;\n}\n/**\n* Reads a migration package's manifest and ops without running hash or\n* invariants verification. Returns `null` when the files cannot be read or\n* parsed (i.e. when the package is genuinely unloadable).\n*\n* Used by {@link readMigrationsDir} to retain a package whose hash or\n* invariants diverge from what is stored on disk — the raw content is still\n* useful for display / querying; only integrity is in question.\n*/\nasync function readMigrationPackageRaw(dir) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (MigrationMetadataSchema(metadata) instanceof type.errors) return null;\n\tif (MigrationOpsSchema(ops) instanceof type.errors) return null;\n\treturn {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops\n\t};\n}\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\nfunction validateMetadata(metadata, filePath) {\n\tconst result = MigrationMetadataSchema(metadata);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction validateOps(ops, filePath) {\n\tconst result = MigrationOpsSchema(ops);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction packageLoadProblemDetailFromError(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nasync function readMigrationsDir(migrationsRoot, options) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(migrationsRoot);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\tpackages: [],\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst packages = [];\n\tconst problems = [];\n\tfor (const entry of entries.sort()) {\n\t\tconst entryPath = join(migrationsRoot, entry);\n\t\tif (!(await stat(entryPath)).isDirectory()) continue;\n\t\tconst manifestPath = join(entryPath, MANIFEST_FILE);\n\t\ttry {\n\t\t\tawait stat(manifestPath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tlet pkg;\n\t\ttry {\n\t\t\tpkg = await readMigrationPackage(entryPath, options);\n\t\t} catch (error) {\n\t\t\tconst dirName = entry;\n\t\t\tif (MigrationToolsError.is(error)) {\n\t\t\t\tif (error.code === \"MIGRATION.HASH_MISMATCH\") {\n\t\t\t\t\tconst meta = error.meta;\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\t\t\tdirName,\n\t\t\t\t\t\tstored: typeof meta?.[\"storedHash\"] === \"string\" ? meta[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof meta?.[\"computedHash\"] === \"string\" ? meta[\"computedHash\"] : \"\"\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (error.code === \"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\") {\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\t\t\t\tdirName\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tproblems.push({\n\t\t\t\tkind: \"packageUnloadable\",\n\t\t\t\tdirName,\n\t\t\t\tdetail: packageLoadProblemDetailFromError(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpackages.push(pkg);\n\t}\n\treturn {\n\t\tpackages,\n\t\tproblems\n\t};\n}\nfunction formatMigrationDirName(timestamp, slug) {\n\tconst sanitized = slug.toLowerCase().replace(/[^a-z0-9]/g, \"_\").replace(/_+/g, \"_\").replace(/^_|_$/g, \"\");\n\tif (sanitized.length === 0) throw errorInvalidSlug(slug);\n\tconst truncated = sanitized.slice(0, MAX_SLUG_LENGTH);\n\treturn `${timestamp.getUTCFullYear()}${String(timestamp.getUTCMonth() + 1).padStart(2, \"0\")}${String(timestamp.getUTCDate()).padStart(2, \"0\")}T${String(timestamp.getUTCHours()).padStart(2, \"0\")}${String(timestamp.getUTCMinutes()).padStart(2, \"0\")}_${truncated}`;\n}\n//#endregion\nexport { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };\n\n//# sourceMappingURL=io-BNxFm3eg.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,MAAM,SAAS;AACjD;AACA,MAAM,0BAA0B,KAAK;CACpC,KAAK;CACL,MAAM;CACN,IAAI;CACJ,eAAe;CACf,oBAAoB;CACpB,WAAW;AACZ,CAAC;AACD,eAAe,sBAAsB,KAAK,UAAU,KAAK;CACxD,MAAM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;CAC7C,IAAI;EACH,MAAM,MAAM,GAAG;CAChB,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,qBAAqB,GAAG;EACjE,MAAM;CACP;CACA,MAAM,UAAU,KAAK,KAAK,aAAa,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC3F,MAAM,UAAU,KAAK,KAAK,QAAQ,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAClF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAe,4BAA4B,WAAW,KAAK;CAC1D,MAAM,MAAM,KAAK,WAAW,IAAI,OAAO;CACvC,MAAM,GAAG,KAAK;EACb,WAAW;EACX,OAAO;C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