@prisma/orm-toolchain 8.0.0-rc.1-dev.21 → 8.0.0-rc.1-dev.23

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 (167) hide show
  1. package/dist/bin__prisma-next.mjs +23 -23
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/{caught-errors-D7Qznyrm-BzYooF6H.mjs → caught-errors-D7Qznyrm-DaZubR00.mjs} +2 -2
  4. package/dist/{caught-errors-D7Qznyrm-BzYooF6H.mjs.map → caught-errors-D7Qznyrm-DaZubR00.mjs.map} +1 -1
  5. package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts} +3 -3
  6. package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts.map → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts.map} +1 -1
  7. package/dist/cli-telemetry.mjs +6 -5
  8. package/dist/cli-telemetry.mjs.map +1 -1
  9. package/dist/cli.mjs +2 -2
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/cli__commands__contract-emit.mjs +1 -1
  12. package/dist/cli__commands__contract-infer.mjs +1 -1
  13. package/dist/cli__commands__db-init.mjs +1 -1
  14. package/dist/cli__commands__db-schema.mjs +1 -1
  15. package/dist/cli__commands__db-sign.mjs +1 -1
  16. package/dist/cli__commands__db-update.mjs +1 -1
  17. package/dist/cli__commands__db-verify.mjs +1 -1
  18. package/dist/cli__commands__migrate.d.mts +2 -2
  19. package/dist/cli__commands__migrate.mjs +1 -1
  20. package/dist/cli__commands__migration-check.mjs +1 -1
  21. package/dist/cli__commands__migration-graph.d.mts +1 -1
  22. package/dist/cli__commands__migration-graph.mjs +1 -1
  23. package/dist/cli__commands__migration-list.d.mts +1 -1
  24. package/dist/cli__commands__migration-list.mjs +1 -1
  25. package/dist/cli__commands__migration-log.d.mts +1 -1
  26. package/dist/cli__commands__migration-log.mjs +1 -1
  27. package/dist/cli__commands__migration-new.mjs +1 -1
  28. package/dist/cli__commands__migration-plan.d.mts +1 -1
  29. package/dist/cli__commands__migration-plan.mjs +1 -1
  30. package/dist/cli__commands__migration-show.mjs +1 -1
  31. package/dist/cli__commands__migration-status.d.mts +1 -1
  32. package/dist/cli__commands__migration-status.mjs +1 -1
  33. package/dist/cli__commands__ref.mjs +1 -1
  34. package/dist/cli__commands__telemetry.mjs +1 -1
  35. package/dist/cli__control-api.d.mts +5 -5
  36. package/dist/cli__control-api.d.mts.map +1 -1
  37. package/dist/cli__control-api.mjs +15 -15
  38. package/dist/cli__control-api__testing.d.mts +66 -0
  39. package/dist/cli__control-api__testing.d.mts.map +1 -0
  40. package/dist/cli__control-api__testing.mjs +255 -0
  41. package/dist/cli__control-api__testing.mjs.map +1 -0
  42. package/dist/cli__migration-cli.mjs +13 -4
  43. package/dist/cli__migration-cli.mjs.map +1 -1
  44. package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs → client-BNAEJZ76-ld7eOxpZ.mjs} +5 -5
  45. package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs.map → client-BNAEJZ76-ld7eOxpZ.mjs.map} +1 -1
  46. package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs → command-helpers-C4WpR-QE-DNllqff1.mjs} +3 -3
  47. package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs.map → command-helpers-C4WpR-QE-DNllqff1.mjs.map} +1 -1
  48. package/dist/config-loader.d.mts +2 -2
  49. package/dist/config-loader.mjs +2 -2
  50. package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs} +2 -2
  51. package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs.map} +1 -1
  52. package/dist/{contract-emit-D8IXP9Qp-Df6NwXn8.mjs → contract-emit-DFu7h-Zl-7DBgYNv7.mjs} +9 -13
  53. package/dist/contract-emit-DFu7h-Zl-7DBgYNv7.mjs.map +1 -0
  54. package/dist/{contract-emit-CTm2zfuG-7PV9SBY6.mjs → contract-emit-DT0JKUZT-BYE7WZPc.mjs} +17 -9
  55. package/dist/contract-emit-DT0JKUZT-BYE7WZPc.mjs.map +1 -0
  56. package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs → contract-infer-C_b7E71m-D2UO-X-k.mjs} +4 -4
  57. package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map → contract-infer-C_b7E71m-D2UO-X-k.mjs.map} +1 -1
  58. package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs} +3 -3
  59. package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs.map} +1 -1
  60. package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs} +2 -2
  61. package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs.map} +1 -1
  62. package/dist/{db-init-CBj_EWg3.mjs → db-init-Cqjw5Flp.mjs} +3 -3
  63. package/dist/{db-init-CBj_EWg3.mjs.map → db-init-Cqjw5Flp.mjs.map} +1 -1
  64. package/dist/{db-schema-BWpeh0Q_.mjs → db-schema-CRGCFKlH.mjs} +4 -4
  65. package/dist/{db-schema-BWpeh0Q_.mjs.map → db-schema-CRGCFKlH.mjs.map} +1 -1
  66. package/dist/{db-sign-DCb_DKtv.mjs → db-sign-BPQduGHb.mjs} +18 -7
  67. package/dist/db-sign-BPQduGHb.mjs.map +1 -0
  68. package/dist/{db-update-WX0KitcX.mjs → db-update-DuEk-ra5.mjs} +4 -4
  69. package/dist/{db-update-WX0KitcX.mjs.map → db-update-DuEk-ra5.mjs.map} +1 -1
  70. package/dist/{db-verify-B8ax2Y_x-Bp4s5Ra6.mjs → db-verify-DPH4lonK-pteoYVnK.mjs} +26 -11
  71. package/dist/db-verify-DPH4lonK-pteoYVnK.mjs.map +1 -0
  72. package/dist/exports-BN0vFTxG.mjs.map +1 -1
  73. package/dist/{exports-BnihzVhw.mjs → exports-DAA3XD4a.mjs} +15 -3
  74. package/dist/exports-DAA3XD4a.mjs.map +1 -0
  75. package/dist/exports-DVoyX2LM.mjs +173 -0
  76. package/dist/exports-DVoyX2LM.mjs.map +1 -0
  77. package/dist/{format-Bw3LVJ1v-BJ6lVFMA.mjs → format-DyVeO1z5-D1lnTJaz.mjs} +7 -11
  78. package/dist/format-DyVeO1z5-D1lnTJaz.mjs.map +1 -0
  79. package/dist/{framework-components-3DdB31mk-BHyX-OlJ.mjs → framework-components-ioeTnj2Z-yyQtaVWk.mjs} +7 -5
  80. package/dist/framework-components-ioeTnj2Z-yyQtaVWk.mjs.map +1 -0
  81. package/dist/index-Deu3DQZI.d.mts +47 -0
  82. package/dist/index-Deu3DQZI.d.mts.map +1 -0
  83. package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs → init-BwYYd10C-CJq9i42m.mjs} +4 -4
  84. package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs.map → init-BwYYd10C-CJq9i42m.mjs.map} +1 -1
  85. package/dist/{inspect-live-schema-Da76TWOs-CAFqkhGb.mjs → inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs} +15 -12
  86. package/dist/inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs.map +1 -0
  87. package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs → invariants-BzYfO9IL-BPDPDIr0.mjs} +2 -2
  88. package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs.map → invariants-BzYfO9IL-BPDPDIr0.mjs.map} +1 -1
  89. package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs → legend-5iwwlLU2-Bit8enjF.mjs} +2 -2
  90. package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs.map → legend-5iwwlLU2-Bit8enjF.mjs.map} +1 -1
  91. package/dist/{migrate-B-NAuO90.mjs → migrate-Bfsw18KQ.mjs} +23 -12
  92. package/dist/migrate-Bfsw18KQ.mjs.map +1 -0
  93. package/dist/{migrate-show-B2LkXkoB-D1ZNl84C.mjs → migrate-show-CO5OiR3J-DE4NIjvW.mjs} +18 -7
  94. package/dist/migrate-show-CO5OiR3J-DE4NIjvW.mjs.map +1 -0
  95. package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts} +3 -3
  96. package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts.map → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts.map} +1 -1
  97. package/dist/{migration-check-BDjtAn7x-B0nEBR0k.mjs → migration-check-BfOnfgyY-DII6Ty5m.mjs} +19 -7
  98. package/dist/migration-check-BfOnfgyY-DII6Ty5m.mjs.map +1 -0
  99. package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs → migration-check-DONPyXff-KpD0q3Zh.mjs} +4 -4
  100. package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs.map → migration-check-DONPyXff-KpD0q3Zh.mjs.map} +1 -1
  101. package/dist/{migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs → migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs} +24 -7
  102. package/dist/migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs.map +1 -0
  103. package/dist/{migration-graph-Dn469b0l.mjs → migration-graph-BHiSuhBR.mjs} +17 -8
  104. package/dist/migration-graph-BHiSuhBR.mjs.map +1 -0
  105. package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs → migration-graph-HKch1Xk4-DD-3zdSg.mjs} +2 -2
  106. package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map → migration-graph-HKch1Xk4-DD-3zdSg.mjs.map} +1 -1
  107. package/dist/{migration-list-jk4iCtmO.mjs → migration-list-BkTNEeOK.mjs} +16 -7
  108. package/dist/migration-list-BkTNEeOK.mjs.map +1 -0
  109. package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs → migration-list-C9OPCMt--BBm2c7tN.mjs} +2 -2
  110. package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs.map → migration-list-C9OPCMt--BBm2c7tN.mjs.map} +1 -1
  111. package/dist/{migration-log-DQzUBrm8-D3m9wcuf.mjs → migration-log-CqrwQXER-cqf2INDN.mjs} +17 -7
  112. package/dist/migration-log-CqrwQXER-cqf2INDN.mjs.map +1 -0
  113. package/dist/{migration-new-g98oB3nC-BcrkxAAt.mjs → migration-new-Cjhe_MIE-CIovsuXK.mjs} +17 -8
  114. package/dist/migration-new-Cjhe_MIE-CIovsuXK.mjs.map +1 -0
  115. package/dist/{migration-new-BkSY6m0t.mjs → migration-new-NuMfcbH8.mjs} +3 -3
  116. package/dist/{migration-new-BkSY6m0t.mjs.map → migration-new-NuMfcbH8.mjs.map} +1 -1
  117. package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs} +2 -2
  118. package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs.map} +1 -1
  119. package/dist/{migration-plan-CjIYMJZy.mjs → migration-plan-D81XmVwy.mjs} +3 -3
  120. package/dist/{migration-plan-CjIYMJZy.mjs.map → migration-plan-D81XmVwy.mjs.map} +1 -1
  121. package/dist/{migration-plan-CwuZLXVE-DAJ-JUQT.mjs → migration-plan-DE7-vtqT-jgtSH4Lw.mjs} +18 -9
  122. package/dist/migration-plan-DE7-vtqT-jgtSH4Lw.mjs.map +1 -0
  123. package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts → migration-plan-DvBJhxXg-B5aHAOtu.d.mts} +3 -3
  124. package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts.map → migration-plan-DvBJhxXg-B5aHAOtu.d.mts.map} +1 -1
  125. package/dist/{migration-show-CW6EKtfw.mjs → migration-show-DEsLJ6-a.mjs} +18 -8
  126. package/dist/migration-show-DEsLJ6-a.mjs.map +1 -0
  127. package/dist/{migration-status-DSQcBhiN.mjs → migration-status-DfLM3VqL.mjs} +21 -10
  128. package/dist/migration-status-DfLM3VqL.mjs.map +1 -0
  129. package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs → project-import-root-C_bd0ooL-CusfluWF.mjs} +2 -2
  130. package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs.map → project-import-root-C_bd0ooL-CusfluWF.mjs.map} +1 -1
  131. package/dist/{ref-DSAZime8.mjs → ref-D6JzE8nq.mjs} +3 -3
  132. package/dist/{ref-DSAZime8.mjs.map → ref-D6JzE8nq.mjs.map} +1 -1
  133. package/dist/{ref-eJjxzYTh-CNiyDL4p.mjs → ref-DrAvdDhN-q1ccuI03.mjs} +21 -10
  134. package/dist/ref-DrAvdDhN-q1ccuI03.mjs.map +1 -0
  135. package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs → ref-resolution-_S4xTT2L-JfNjZU9d.mjs} +2 -2
  136. package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map → ref-resolution-_S4xTT2L-JfNjZU9d.mjs.map} +1 -1
  137. package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs → telemetry-DVBHDQd6-CWNTFnMO.mjs} +2 -2
  138. package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs.map → telemetry-DVBHDQd6-CWNTFnMO.mjs.map} +1 -1
  139. package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs → verify-C6L_hiJU-MX67LFfI.mjs} +2 -2
  140. package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs.map → verify-C6L_hiJU-MX67LFfI.mjs.map} +1 -1
  141. package/dist/vite-plugin-contract-emit.mjs +5 -3
  142. package/dist/vite-plugin-contract-emit.mjs.map +1 -1
  143. package/package.json +13 -12
  144. package/dist/contract-emit-CTm2zfuG-7PV9SBY6.mjs.map +0 -1
  145. package/dist/contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map +0 -1
  146. package/dist/db-sign-DCb_DKtv.mjs.map +0 -1
  147. package/dist/db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map +0 -1
  148. package/dist/exports-BnihzVhw.mjs.map +0 -1
  149. package/dist/exports-CDX9kZuw.mjs +0 -119
  150. package/dist/exports-CDX9kZuw.mjs.map +0 -1
  151. package/dist/format-Bw3LVJ1v-BJ6lVFMA.mjs.map +0 -1
  152. package/dist/framework-components-3DdB31mk-BHyX-OlJ.mjs.map +0 -1
  153. package/dist/index-Df9igRvP.d.mts +0 -18
  154. package/dist/index-Df9igRvP.d.mts.map +0 -1
  155. package/dist/inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map +0 -1
  156. package/dist/migrate-B-NAuO90.mjs.map +0 -1
  157. package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +0 -1
  158. package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +0 -1
  159. package/dist/migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map +0 -1
  160. package/dist/migration-graph-Dn469b0l.mjs.map +0 -1
  161. package/dist/migration-list-jk4iCtmO.mjs.map +0 -1
  162. package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +0 -1
  163. package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +0 -1
  164. package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +0 -1
  165. package/dist/migration-show-CW6EKtfw.mjs.map +0 -1
  166. package/dist/migration-status-DSQcBhiN.mjs.map +0 -1
  167. package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +0 -1
@@ -1,18 +1,21 @@
1
- import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, at as sanitizeErrorMessage, f as errorDatabaseConnectionRequired, m as errorDriverRequired, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
2
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
1
+ import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, at as sanitizeErrorMessage, f as errorDatabaseConnectionRequired, m as errorDriverRequired, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
3
3
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
4
- import { t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
4
+ import { t as createControlClient } from "./client-BNAEJZ76-ld7eOxpZ.mjs";
5
5
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
6
6
  import { relative, resolve } from "pathe";
7
- //#region ../../../1-framework/3-tooling/cli/dist/inspect-live-schema-Da76TWOs.mjs
7
+ //#region ../../../1-framework/3-tooling/cli/dist/inspect-live-schema-CXH4ZGHT.mjs
8
8
  async function inspectLiveSchema(options, flags, ui, startTime, context) {
9
- let config;
10
- try {
11
- config = await loadConfig(options.config);
12
- } catch (error) {
13
- if (CliStructuredError$1.is(error)) return notOk(error);
14
- return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: "Failed to load config" }));
15
- }
9
+ const configResult = await loadConfigForSections(options.config, [
10
+ "family",
11
+ "target",
12
+ "adapter",
13
+ "driver",
14
+ "extensions",
15
+ "db"
16
+ ]);
17
+ if (!configResult.ok) return configResult;
18
+ const config = configResult.value;
16
19
  const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
17
20
  if (!flags.json && !flags.quiet) {
18
21
  const details = [{
@@ -88,4 +91,4 @@ async function inspectLiveSchema(options, flags, ui, startTime, context) {
88
91
  //#endregion
89
92
  export { inspectLiveSchema as t };
90
93
 
91
- //# sourceMappingURL=inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map
94
+ //# sourceMappingURL=inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/inspect-live-schema-CXH4ZGHT.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, c as sanitizeErrorMessage, ct as errorUnexpected, i as maskConnectionUrl } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-BNAEJZ76.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\n//#region src/commands/inspect-live-schema.ts\nasync function inspectLiveSchema(options, flags, ui, startTime, context) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\telse if (config.db?.connection && typeof config.db.connection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(config.db.connection)\n\t\t});\n\t\tui.stderr(formatStyledHeader({\n\t\t\tcommand: context.commandName,\n\t\t\tdescription: context.description,\n\t\t\turl: context.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t}));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${context.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: context.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${context.commandName}` }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst schema = await client.introspect({\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tconst schemaView = client.toSchemaView(schema);\n\t\tconst pslContractAst = client.inferPslContract(schema);\n\t\tconst pslBlockDescriptors = client.getPslBlockDescriptors();\n\t\tconst dbUrl = typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0;\n\t\treturn ok({\n\t\t\tconfig,\n\t\t\tschema,\n\t\t\tschemaView,\n\t\t\tpslContractAst,\n\t\t\tpslBlockDescriptors,\n\t\t\ttarget: {\n\t\t\t\tfamilyId: config.family.familyId,\n\t\t\t\tid: config.target.targetId\n\t\t\t},\n\t\t\tmeta: {\n\t\t\t\tconfigPath,\n\t\t\t\t...dbUrl ? { dbUrl } : {}\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during ${context.commandName}: ${safeMessage}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\n//#endregion\nexport { inspectLiveSchema as t };\n\n//# sourceMappingURL=inspect-live-schema-CXH4ZGHT.mjs.map"],"mappings":";;;;;;;AAOA,eAAe,kBAAkB,SAAS,OAAO,IAAI,WAAW,SAAS;CACxE,M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,OAAO,aAAa,MAAM;EAC7C,MAAM,iBAAiB,OAAO,iBAAiB,MAAM;EACrD,MAAM,sBAAsB,OAAO,uBAAuB;EAC1D,MAAM,QAAQ,OAAO,iBAAiB,WAAW,kBAAkB,YAAY,IAAI,KAAK;EACxF,OAAO,GAAG;GACT;GACA;GACA;GACA;GACA;GACA,QAAQ;IACP,UAAU,OAAO,OAAO;IACxB,IAAI,OAAO,OAAO;GACnB;GACA,MAAM;IACL;IACA,GAAG,QAAQ,EAAE,MAAM,IAAI,CAAC;GACzB;GACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;EAC1C,CAAC;CACF,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM,cAAc,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,OAAO,iBAAiB,WAAW,eAAe,KAAK,CAAC;EACzJ,OAAO,MAAM,gBAAgB,aAAa,EAAE,KAAK,2BAA2B,QAAQ,YAAY,IAAI,cAAc,CAAC,CAAC;CACrH,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { O as errorNoInvariantPath, P as errorUnknownInvariant } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
2
2
  import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-DDaOHo10-yJFAbKCu.mjs";
3
- import { i as collectDeclaredInvariants, ut as toStructuralEdge, y as errorMarkerMismatch } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
3
+ import { i as collectDeclaredInvariants, ut as toStructuralEdge, y as errorMarkerMismatch } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
4
4
  import { n as isGraphNode } from "./graph-membership-BEmNEMtP-rz61CLM5.mjs";
5
5
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
6
  //#region ../../../1-framework/3-tooling/cli/dist/invariants-BzYfO9IL.mjs
@@ -49,4 +49,4 @@ function refuseMissingInvariantPath(args) {
49
49
  //#endregion
50
50
  export { refuseUnknownInvariants as i, refuseMarkerOutsideGraph as n, refuseMissingInvariantPath as r, hasMigrationPath as t };
51
51
 
52
- //# sourceMappingURL=invariants-BzYfO9IL-BXTvx0z9.mjs.map
52
+ //# sourceMappingURL=invariants-BzYfO9IL-BPDPDIr0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"invariants-BzYfO9IL-BXTvx0z9.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/invariants-BzYfO9IL.mjs"],"sourcesContent":["import { J as errorMarkerMismatch, n as collectDeclaredInvariants, p as toStructuralEdge } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, findPath, findPathWithDecision, isGraphNode } from \"@internal/migration-tools/migration-graph\";\n//#region src/control-api/operations/graph-queries.ts\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/**\n* Refusal for a live marker hash that is not a node of the on-disk app graph.\n* Same errorMarkerMismatch envelope migrate raises today, or null when the marker is a node.\n*/\nfunction refuseMarkerOutsideGraph(args) {\n\tif (isGraphNode(args.markerHash, args.graph)) return null;\n\treturn errorMarkerMismatch(args.markerHash, [...args.graph.nodes].sort(), findLatestMigration(args.graph)?.to ?? null);\n}\n//#endregion\n//#region src/control-api/operations/invariants.ts\n/**\n* Invariant refusals shared by migrate and migration status: unknown ref invariants and unsatisfiable invariant paths.\n*/\n/** Refuses ref invariants neither declared on any graph edge nor present on the live marker. */\nfunction refuseUnknownInvariants(args) {\n\tconst declared = collectDeclaredInvariants(args.graph);\n\tconst known = new Set(declared);\n\tfor (const id of args.markerInvariants) known.add(id);\n\tconst unknown = args.refInvariants.filter((id) => !known.has(id));\n\tif (unknown.length === 0) return null;\n\treturn errorUnknownInvariant({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\tunknown,\n\t\tdeclared: [...declared].sort()\n\t});\n}\n/** Refuses a --to target whose missing invariants no path from originHash satisfies. */\nfunction refuseMissingInvariantPath(args) {\n\tconst outcome = findPathWithDecision(args.graph, args.originHash, args.targetHash, {\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: new Set(args.missing)\n\t});\n\tif (outcome.kind !== \"unsatisfiable\") return null;\n\treturn errorNoInvariantPath({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: [...args.missing].sort(),\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t});\n}\n//#endregion\nexport { refuseMarkerOutsideGraph as i, refuseUnknownInvariants as n, hasMigrationPath as r, refuseMissingInvariantPath as t };\n\n//# sourceMappingURL=invariants-BzYfO9IL.mjs.map"],"mappings":";;;;;;;AAMA,SAAS,iBAAiB,OAAO,UAAU,QAAQ;CAClD,OAAO,SAAS,OAAO,UAAU,MAAM,MAAM;AAC9C;;;;;AAKA,SAAS,yBAAyB,MAAM;CACvC,IAAI,YAAY,KAAK,YAAY,KAAK,KAAK,GAAG,OAAO;CACrD,OAAO,oBAAoB,KAAK,YAAY,CAAC,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,GAAG,oBAAoB,KAAK,KAAK,CAAC,EAAE,MAAM,IAAI;AACtH;;;;;AAOA,SAAS,wBAAwB,MAAM;CACtC,MAAM,WAAW,0BAA0B,KAAK,KAAK;CACrD,MAAM,QAAQ,IAAI,IAAI,QAAQ;CAC9B,KAAK,MAAM,MAAM,KAAK,kBAAkB,MAAM,IAAI,EAAE;CACpD,MAAM,UAAU,KAAK,cAAc,QAAQ,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;CAChE,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,OAAO,sBAAsB;EAC5B,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC;EACA,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK;CAC9B,CAAC;AACF;;AAEA,SAAS,2BAA2B,MAAM;CACzC,MAAM,UAAU,qBAAqB,KAAK,OAAO,KAAK,YAAY,KAAK,YAAY;EAClF,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC,UAAU,IAAI,IAAI,KAAK,OAAO;CAC/B,CAAC;CACD,IAAI,QAAQ,SAAS,iBAAiB,OAAO;CAC7C,OAAO,qBAAqB;EAC3B,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC,UAAU,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,KAAK;EACjC,SAAS,QAAQ;EACjB,gBAAgB,QAAQ,eAAe,IAAI,gBAAgB;CAC5D,CAAC;AACF"}
1
+ {"version":3,"file":"invariants-BzYfO9IL-BPDPDIr0.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/invariants-BzYfO9IL.mjs"],"sourcesContent":["import { J as errorMarkerMismatch, n as collectDeclaredInvariants, p as toStructuralEdge } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, findPath, findPathWithDecision, isGraphNode } from \"@internal/migration-tools/migration-graph\";\n//#region src/control-api/operations/graph-queries.ts\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/**\n* Refusal for a live marker hash that is not a node of the on-disk app graph.\n* Same errorMarkerMismatch envelope migrate raises today, or null when the marker is a node.\n*/\nfunction refuseMarkerOutsideGraph(args) {\n\tif (isGraphNode(args.markerHash, args.graph)) return null;\n\treturn errorMarkerMismatch(args.markerHash, [...args.graph.nodes].sort(), findLatestMigration(args.graph)?.to ?? null);\n}\n//#endregion\n//#region src/control-api/operations/invariants.ts\n/**\n* Invariant refusals shared by migrate and migration status: unknown ref invariants and unsatisfiable invariant paths.\n*/\n/** Refuses ref invariants neither declared on any graph edge nor present on the live marker. */\nfunction refuseUnknownInvariants(args) {\n\tconst declared = collectDeclaredInvariants(args.graph);\n\tconst known = new Set(declared);\n\tfor (const id of args.markerInvariants) known.add(id);\n\tconst unknown = args.refInvariants.filter((id) => !known.has(id));\n\tif (unknown.length === 0) return null;\n\treturn errorUnknownInvariant({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\tunknown,\n\t\tdeclared: [...declared].sort()\n\t});\n}\n/** Refuses a --to target whose missing invariants no path from originHash satisfies. */\nfunction refuseMissingInvariantPath(args) {\n\tconst outcome = findPathWithDecision(args.graph, args.originHash, args.targetHash, {\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: new Set(args.missing)\n\t});\n\tif (outcome.kind !== \"unsatisfiable\") return null;\n\treturn errorNoInvariantPath({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: [...args.missing].sort(),\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t});\n}\n//#endregion\nexport { refuseMarkerOutsideGraph as i, refuseUnknownInvariants as n, hasMigrationPath as r, refuseMissingInvariantPath as t };\n\n//# sourceMappingURL=invariants-BzYfO9IL.mjs.map"],"mappings":";;;;;;;AAMA,SAAS,iBAAiB,OAAO,UAAU,QAAQ;CAClD,OAAO,SAAS,OAAO,UAAU,MAAM,MAAM;AAC9C;;;;;AAKA,SAAS,yBAAyB,MAAM;CACvC,IAAI,YAAY,KAAK,YAAY,KAAK,KAAK,GAAG,OAAO;CACrD,OAAO,oBAAoB,KAAK,YAAY,CAAC,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,GAAG,oBAAoB,KAAK,KAAK,CAAC,EAAE,MAAM,IAAI;AACtH;;;;;AAOA,SAAS,wBAAwB,MAAM;CACtC,MAAM,WAAW,0BAA0B,KAAK,KAAK;CACrD,MAAM,QAAQ,IAAI,IAAI,QAAQ;CAC9B,KAAK,MAAM,MAAM,KAAK,kBAAkB,MAAM,IAAI,EAAE;CACpD,MAAM,UAAU,KAAK,cAAc,QAAQ,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;CAChE,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,OAAO,sBAAsB;EAC5B,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC;EACA,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK;CAC9B,CAAC;AACF;;AAEA,SAAS,2BAA2B,MAAM;CACzC,MAAM,UAAU,qBAAqB,KAAK,OAAO,KAAK,YAAY,KAAK,YAAY;EAClF,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC,UAAU,IAAI,IAAI,KAAK,OAAO;CAC/B,CAAC;CACD,IAAI,QAAQ,SAAS,iBAAiB,OAAO;CAC7C,OAAO,qBAAqB;EAC3B,GAAG,UAAU,WAAW,KAAK,OAAO;EACpC,UAAU,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,KAAK;EACjC,SAAS,QAAQ;EACjB,gBAAgB,QAAQ,eAAe,IAAI,gBAAgB;CAC5D,CAAC;AACF"}
@@ -1,4 +1,4 @@
1
- import { v as errorLegendHumanOnly } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
1
+ import { v as errorLegendHumanOnly } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
2
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
3
3
  //#region ../../../1-framework/3-tooling/cli/dist/legend-5iwwlLU2.mjs
4
4
  /**
@@ -19,4 +19,4 @@ function validateLegendOptions(options, flags) {
19
19
  //#endregion
20
20
  export { validateLegendOptions as n, shouldShowLegend as t };
21
21
 
22
- //# sourceMappingURL=legend-5iwwlLU2-CB8bdQKJ.mjs.map
22
+ //# sourceMappingURL=legend-5iwwlLU2-Bit8enjF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"legend-5iwwlLU2-CB8bdQKJ.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/legend-5iwwlLU2.mjs"],"sourcesContent":["import { q as errorLegendHumanOnly } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/utils/legend.ts\n/**\n* The legend is decoration printed alongside the command header on stderr, so\n* it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n* `--quiet`) exactly as the header is.\n*/\nfunction shouldShowLegend(options, flags) {\n\treturn options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;\n}\nfunction validateLegendOptions(options, flags) {\n\tif (options.legend !== true) return ok(void 0);\n\tif (flags.json === true) return notOk(errorLegendHumanOnly(\"--json\"));\n\tif (flags.quiet === true) return notOk(errorLegendHumanOnly(\"--quiet\"));\n\tif (options.dot === true) return notOk(errorLegendHumanOnly(\"--dot\"));\n\treturn ok(void 0);\n}\n//#endregion\nexport { validateLegendOptions as n, shouldShowLegend as t };\n\n//# sourceMappingURL=legend-5iwwlLU2.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,iBAAiB,SAAS,OAAO;CACzC,OAAO,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAClG;AACA,SAAS,sBAAsB,SAAS,OAAO;CAC9C,IAAI,QAAQ,WAAW,MAAM,OAAO,GAAG,KAAK,CAAC;CAC7C,IAAI,MAAM,SAAS,MAAM,OAAO,MAAM,qBAAqB,QAAQ,CAAC;CACpE,IAAI,MAAM,UAAU,MAAM,OAAO,MAAM,qBAAqB,SAAS,CAAC;CACtE,IAAI,QAAQ,QAAQ,MAAM,OAAO,MAAM,qBAAqB,OAAO,CAAC;CACpE,OAAO,GAAG,KAAK,CAAC;AACjB"}
1
+ {"version":3,"file":"legend-5iwwlLU2-Bit8enjF.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/legend-5iwwlLU2.mjs"],"sourcesContent":["import { q as errorLegendHumanOnly } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/utils/legend.ts\n/**\n* The legend is decoration printed alongside the command header on stderr, so\n* it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n* `--quiet`) exactly as the header is.\n*/\nfunction shouldShowLegend(options, flags) {\n\treturn options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;\n}\nfunction validateLegendOptions(options, flags) {\n\tif (options.legend !== true) return ok(void 0);\n\tif (flags.json === true) return notOk(errorLegendHumanOnly(\"--json\"));\n\tif (flags.quiet === true) return notOk(errorLegendHumanOnly(\"--quiet\"));\n\tif (options.dot === true) return notOk(errorLegendHumanOnly(\"--dot\"));\n\treturn ok(void 0);\n}\n//#endregion\nexport { validateLegendOptions as n, shouldShowLegend as t };\n\n//# sourceMappingURL=legend-5iwwlLU2.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,iBAAiB,SAAS,OAAO;CACzC,OAAO,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAClG;AACA,SAAS,sBAAsB,SAAS,OAAO;CAC9C,IAAI,QAAQ,WAAW,MAAM,OAAO,GAAG,KAAK,CAAC;CAC7C,IAAI,MAAM,SAAS,MAAM,OAAO,MAAM,qBAAqB,QAAQ,CAAC;CACpE,IAAI,MAAM,UAAU,MAAM,OAAO,MAAM,qBAAqB,SAAS,CAAC;CACtE,IAAI,QAAQ,QAAQ,MAAM,OAAO,MAAM,qBAAqB,OAAO,CAAC;CACpE,OAAO,GAAG,KAAK,CAAC;AACjB"}
@@ -1,15 +1,15 @@
1
- import { D as errorRunnerFailed, N as errorUnexpected, Q as maskConnectionUrl, R as formatMigrationApplyCommandOutput, S as errorPathUnreachable, W as formatStyledHeader, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, h as errorFileNotFound, it as resolveMigrationPaths, j as errorTargetMigrationNotSupported, lt as targetSupportsMigrations, m as errorDriverRequired, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, rt as resolveContractPath, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
2
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
1
+ import { D as errorRunnerFailed, N as errorUnexpected, Q as maskConnectionUrl, R as formatMigrationApplyCommandOutput, S as errorPathUnreachable, W as formatStyledHeader, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, h as errorFileNotFound, it as resolveMigrationPaths, j as errorTargetMigrationNotSupported, lt as targetSupportsMigrations, m as errorDriverRequired, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, rt as resolveContractPath, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
3
3
  import { a as readContractIR, t as advanceRefSafely } from "./ref-advancement-DaZBzm7m-BZQtedYC.mjs";
4
- import { a as loadContractSpaceAggregateForCli, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
5
- import { t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
6
- import { t as mapContractAtError } from "./contract-at-errors-Dv1mxKYO-C29YB4RC.mjs";
7
- import { t as resolveContractRef } from "./ref-resolution-_S4xTT2L-BE5zgO2W.mjs";
8
- import { i as refuseUnknownInvariants, n as refuseMarkerOutsideGraph } from "./invariants-BzYfO9IL-BXTvx0z9.mjs";
9
- import { t as listRefsByContractHash } from "./migration-list-C9OPCMt--C28yBgVr.mjs";
4
+ import { a as loadContractSpaceAggregateForCli, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
5
+ import { t as createControlClient } from "./client-BNAEJZ76-ld7eOxpZ.mjs";
6
+ import { t as mapContractAtError } from "./contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs";
7
+ import { t as resolveContractRef } from "./ref-resolution-_S4xTT2L-JfNjZU9d.mjs";
8
+ import { i as refuseUnknownInvariants, n as refuseMarkerOutsideGraph } from "./invariants-BzYfO9IL-BPDPDIr0.mjs";
9
+ import { t as listRefsByContractHash } from "./migration-list-C9OPCMt--BBm2c7tN.mjs";
10
10
  import { c as computeMaxDirNameWidth, d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as renderMigrationGraphCommand, i as buildMigrationGraphRows, r as buildGrid, s as computeLabelColumn, u as formatOnPathMigrationRow } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
11
- import { t as mapCaughtMigrationError } from "./caught-errors-D7Qznyrm-BzYooF6H.mjs";
12
- import { t as executeMigrateShowPlan } from "./migrate-show-B2LkXkoB-D1ZNl84C.mjs";
11
+ import { t as mapCaughtMigrationError } from "./caught-errors-D7Qznyrm-DaZubR00.mjs";
12
+ import { t as executeMigrateShowPlan } from "./migrate-show-CO5OiR3J-DE4NIjvW.mjs";
13
13
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
14
14
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
15
15
  import { readFile } from "node:fs/promises";
@@ -151,7 +151,18 @@ function mapApplyFailure(failure) {
151
151
  });
152
152
  }
153
153
  async function executeMigrateCommand(options, flags, ui, startTime) {
154
- const config = await loadConfig(options.config);
154
+ const configResult = await loadConfigForSections(options.config, [
155
+ "family",
156
+ "target",
157
+ "adapter",
158
+ "driver",
159
+ "extensions",
160
+ "db",
161
+ "migrations",
162
+ "contract"
163
+ ]);
164
+ if (!configResult.ok) return configResult;
165
+ const config = configResult.value;
155
166
  const { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);
156
167
  const dbConnection = options.db ?? config.db?.connection;
157
168
  if (!dbConnection) return notOk(errorDatabaseConnectionRequired({
@@ -360,4 +371,4 @@ function createMigrateCommand() {
360
371
  //#endregion
361
372
  export { createMigrateCommand as t };
362
373
 
363
- //# sourceMappingURL=migrate-B-NAuO90.mjs.map
374
+ //# sourceMappingURL=migrate-Bfsw18KQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-Bfsw18KQ.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migrate.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, S as formatMigrationApplyCommandOutput, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Z as errorPathUnreachable, _ as createTerminalUI, ct as errorUnexpected, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, nt as errorRunnerFailed, o as resolveContractPath, ot as errorTargetMigrationNotSupported, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { a as loadContractSpaceAggregateForCli, s as refuseContractSpaceIntegrity, u as toDeclaredExtensionsFromRaw } from \"../contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { t as createControlClient } from \"../client-BNAEJZ76.mjs\";\nimport { a as readContractIR, t as advanceRefSafely } from \"../ref-advancement-DaZBzm7m.mjs\";\nimport { t as mapCaughtMigrationError } from \"../caught-errors-D7Qznyrm.mjs\";\nimport { t as mapContractAtError } from \"../contract-at-errors-Dv1mxKYO.mjs\";\nimport { i as refuseMarkerOutsideGraph, n as refuseUnknownInvariants } from \"../invariants-BzYfO9IL.mjs\";\nimport { t as executeMigrateShowPlan } from \"../migrate-show-CO5OiR3J.mjs\";\nimport { t as listRefsByContractHash } from \"../migration-list-C9OPCMt-.mjs\";\nimport { t as resolveContractRef } from \"../ref-resolution-_S4xTT2L.mjs\";\nimport { d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as buildGrid, i as formatOnPathMigrationRow, m as buildMigrationGraphRows, n as computeMaxDirNameWidth, r as renderMigrationGraphCommand, t as computeLabelColumn } from \"../migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\n//#region src/commands/migrate.ts\n/**\n* Read-only preview of the migration path `migrate` will take. Delegates the\n* path computation to {@link executeMigrateShowPlan} (the control-api core)\n* and keeps only the styled header plus the Tier-3 graph rendering here.\n*/\nasync function executeMigrateShowCommand(options, flags, ui) {\n\tconst planResult = await executeMigrateShowPlan({\n\t\t...ifDefined(\"config\", options.config),\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"to\", options.to),\n\t\t...ifDefined(\"from\", options.from),\n\t\tonPreflightComplete: ({ configPath, migrationsRelative, dbConnection, hasExplicitFrom }) => {\n\t\t\tif (!flags.json && !flags.quiet) {\n\t\t\t\tconst details = [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t}, {\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t}];\n\t\t\t\tif (dbConnection && !hasExplicitFrom) details.push({\n\t\t\t\t\tlabel: \"database\",\n\t\t\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t\t\t});\n\t\t\t\tif (options.from) details.push({\n\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\tvalue: options.from\n\t\t\t\t});\n\t\t\t\tif (options.to) details.push({\n\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\tvalue: options.to\n\t\t\t\t});\n\t\t\t\tconst header = formatStyledHeader({\n\t\t\t\t\tcommand: \"migrate --show\",\n\t\t\t\t\tdescription: \"Preview the migration path migrate will take (read-only)\",\n\t\t\t\t\tdetails,\n\t\t\t\t\tflags\n\t\t\t\t});\n\t\t\t\tui.stderr(header);\n\t\t\t}\n\t\t}\n\t});\n\tif (!planResult.ok) return notOk(planResult.failure);\n\tconst plan = planResult.value;\n\tconst { aggregate, contractHash } = plan;\n\tconst orderedMigrations = plan.migrations;\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tlet graphOutput;\n\tlet runListDirNameWidth;\n\tlet runListLeftPad;\n\tif (!flags.json) {\n\t\tconst onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));\n\t\tconst colorize = flags.color !== false;\n\t\tconst spaceLayouts = allSpaces.map((space) => {\n\t\t\tconst isApp = space.spaceId === aggregate.app.spaceId;\n\t\t\tconst spaceGraph = space.graph();\n\t\t\tconst rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});\n\t\t\tconst edgeAnnotations = /* @__PURE__ */ new Map();\n\t\t\tfor (const edge of spaceGraph.migrationByHash.values()) edgeAnnotations.set(edge.migrationHash, { pathHighlight: onPathHashes.has(edge.migrationHash) ? \"on-path\" : \"off-path\" });\n\t\t\treturn {\n\t\t\t\tspace,\n\t\t\t\tisApp,\n\t\t\t\tspaceGraph,\n\t\t\t\trowModel,\n\t\t\t\tgrid: buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations)),\n\t\t\t\tedgeAnnotations\n\t\t\t};\n\t\t});\n\t\tconst globalLabelColumn = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, \"unicode\"))) : void 0;\n\t\tconst globalMaxDirNameWidthFromLayouts = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel))) : void 0;\n\t\tconst runListMaxFromMigrations = orderedMigrations.length > 0 ? Math.max(...orderedMigrations.map((m) => m.dirName.length)) : 0;\n\t\tconst globalMaxDirNameWidth = globalMaxDirNameWidthFromLayouts !== void 0 ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations) : void 0;\n\t\trunListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;\n\t\trunListLeftPad = globalLabelColumn;\n\t\tconst showSpaceHeadings = allSpaces.length > 1;\n\t\tconst sections = [];\n\t\tfor (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {\n\t\t\tconst liveMarkerHash = plan.renderMarkerHashBySpace.get(space.spaceId);\n\t\t\tconst tree = renderMigrationGraphCommand({\n\t\t\t\tgrid,\n\t\t\t\trowModel,\n\t\t\t\tcontractHash,\n\t\t\t\tisAppSpace: isApp,\n\t\t\t\t...plan.usedLiveMarker ? { dbHash: liveMarkerHash } : {},\n\t\t\t\trefsByHash: listRefsByContractHash(space),\n\t\t\t\tedgeAnnotationsByHash: edgeAnnotations,\n\t\t\t\tcolorize,\n\t\t\t\tglyphMode: \"unicode\",\n\t\t\t\t...globalLabelColumn !== void 0 ? { globalLabelColumn } : {},\n\t\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t\t});\n\t\t\tif (tree.length === 0) continue;\n\t\t\tif (showSpaceHeadings) sections.push(`${space.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, \" \")}`);\n\t\t\telse sections.push(tree);\n\t\t}\n\t\tgraphOutput = sections.join(\"\\n\\n\");\n\t}\n\treturn ok({\n\t\tok: true,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: plan.summary,\n\t\t...graphOutput !== void 0 ? { graphOutput } : {},\n\t\t...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},\n\t\t...runListLeftPad !== void 0 ? { runListLeftPad } : {}\n\t});\n}\nfunction formatMigrateShowOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst colorize = flags.color !== false;\n\tconst lines = [];\n\tif (result.graphOutput !== void 0 && result.graphOutput.length > 0) {\n\t\tlines.push(result.graphOutput);\n\t\tlines.push(\"\");\n\t}\n\tconst n = result.migrations.length;\n\tif (n > 0) {\n\t\tlines.push(`The following ${n} migration${n === 1 ? \"\" : \"s\"} will run:`);\n\t\tconst isMultiSpace = result.runListLeftPad !== void 0;\n\t\tconst gutter = result.runListLeftPad ?? 0;\n\t\tconst rawDirNameWidth = result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));\n\t\tconst listDirNameWidth = gutter + Math.max(rawDirNameWidth + 2, 25 - gutter) - (isMultiSpace ? 2 : 4);\n\t\tfor (const m of result.migrations) lines.push(` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, \"unicode\")}`);\n\t} else lines.push(result.summary);\n\treturn lines.join(\"\\n\");\n}\nfunction mapApplyFailure(failure) {\n\tif (failure.code === \"MIGRATION_PATH_NOT_FOUND\") return errorPathUnreachable(failure);\n\treturn errorRunnerFailed(failure.summary, {\n\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\tfix: \"Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.\",\n\t\tmeta: failure.meta ?? {},\n\t\t...ifDefined(\"cause\", failure.cause)\n\t});\n}\nasync function executeMigrateCommand(options, flags, ui, startTime) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migrate\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for migrate\" }));\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst toArg = options.to;\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractRaw;\n\tlet contractContent;\n\ttry {\n\t\tcontractContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate a valid contract.json, then retry.\"\n\t\t}));\n\t\treturn notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\ttry {\n\t\tcontractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst loadedAggregate = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: contractRaw,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loadedAggregate.ok) return notOk(loadedAggregate.failure);\n\tconst aggregate = loadedAggregate.value;\n\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),\n\t\tcheckContracts: true\n\t});\n\tif (integrityFailure) return notOk(integrityFailure);\n\tlet refEntry;\n\tlet refName;\n\tif (toArg) {\n\t\tconst refs = aggregate.app.refs;\n\t\tconst refResult = resolveContractRef(toArg, {\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(refResult.failure);\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\trefName = refResult.value.provenance.refName;\n\t\t\tconst resolved = refs[refName];\n\t\t\tif (resolved) refEntry = resolved;\n\t\t} else refEntry = {\n\t\t\thash: refResult.value.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (typeof dbConnection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t});\n\t\tif (toArg) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: toArg\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate\",\n\t\t\tdescription: \"Apply planned migrations to advance the database\",\n\t\t\turl: \"https://pris.ly/migrate\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\tif (appMarker !== null) {\n\t\t\tconst markerRefusal = refuseMarkerOutsideGraph({\n\t\t\t\tmarkerHash: appMarker.storageHash,\n\t\t\t\tgraph: appGraph\n\t\t\t});\n\t\t\tif (markerRefusal) return notOk(markerRefusal);\n\t\t}\n\t\tif (refEntry && refEntry.invariants.length > 0) {\n\t\t\tconst invariantRefusal = refuseUnknownInvariants({\n\t\t\t\tgraph: appGraph,\n\t\t\t\tmarkerInvariants: appMarker?.invariants ?? [],\n\t\t\t\trefInvariants: refEntry.invariants,\n\t\t\t\t...ifDefined(\"refName\", toArg)\n\t\t\t});\n\t\t\tif (invariantRefusal) return notOk(invariantRefusal);\n\t\t}\n\t\tif (!flags.quiet && !flags.json) ui.step(\"Loading contract spaces…\");\n\t\tlet applyContract = contractRaw;\n\t\tlet snapshotContractJson = JSON.parse(contractContent);\n\t\tlet snapshotContractDts;\n\t\tif (toArg && refEntry) {\n\t\t\tconst targetHash = refEntry.hash;\n\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {\n\t\t\t\tconst at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);\n\t\t\t\tapplyContract = at.contract;\n\t\t\t\tsnapshotContractJson = at.contractJson;\n\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t} catch (error) {\n\t\t\t\treturn mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t}\n\t\t}\n\t\tconst applyResult = await client.migrate({\n\t\t\tcontract: applyContract,\n\t\t\tmigrationsDir,\n\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},\n\t\t\t...refEntry !== void 0 ? ifDefined(\"refName\", toArg) : {}\n\t\t});\n\t\tif (!applyResult.ok) return notOk(mapApplyFailure(applyResult.failure));\n\t\tconst { value } = applyResult;\n\t\tlet advancedRef = null;\n\t\tif (options.advanceRef !== void 0) {\n\t\t\tconst contractIR = snapshotContractDts !== void 0 ? {\n\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t} : await readContractIR(snapshotContractJson, contractPathAbsolute);\n\t\t\tconst advanced = await advanceRefSafely({\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tname: options.advanceRef,\n\t\t\t\thash: value.markerHash,\n\t\t\t\tcontractIR\n\t\t\t});\n\t\t\tif (!advanced.ok) return notOk(advanced.failure);\n\t\t\tadvancedRef = {\n\t\t\t\tname: advanced.value.name,\n\t\t\t\thash: advanced.value.hash\n\t\t\t};\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\tmigrationsTotal: value.perSpace.length,\n\t\t\tmarkerHash: value.markerHash,\n\t\t\tapplied: value.applied,\n\t\t\tsummary: value.summary,\n\t\t\tperSpace: value.perSpace,\n\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\ttimings: { total: Date.now() - startTime },\n\t\t\tadvancedRef\n\t\t});\n\t} catch (error) {\n\t\tconst mapped = mapCaughtMigrationError(error);\n\t\tif (mapped) return notOk(mapped);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrateCommand() {\n\tconst command = new Command(\"migrate\");\n\tsetCommandDescriptions(command, \"Apply planned migrations to advance the database\", \"Walks every contract space (app + extensions) and applies pending\\non-disk migrations in canonical order (extensions alphabetically,\\nthen app). Graph-walks the on-disk migration graph for every space.\\nUse --to to target a specific contract (hash, ref name, migration dir).\\nUse --show for a read-only preview of the path that would run.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migrate --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to abc123 --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --from @contract --to production\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--advance-ref <name>\", \"Advance the named ref to the post-apply marker after success\").option(\"--show\", \"Preview the migration path without applying (read-only)\").option(\"--from <contract>\", \"From-state for --show preview (@contract, @db, hash, ref name, or migration dir)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (options.show) {\n\t\t\tconst exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {\n\t\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\t\telse ui.output(formatMigrateShowOutput(showResult, flags));\n\t\t\t});\n\t\t\tprocess.exit(exitCode);\n\t\t\treturn;\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrateCommand };\n\n//# sourceMappingURL=migrate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,eAAe,0BAA0B,SAAS,OAAO,IAAI;CAC5D,MAAM,aAAa,MAAM,uBAAuB;EAC/C,GAAG,UAAU,UAAU,QAAQ,MAAM;EACrC,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,QAAQ,QAAQ,IAAI;EACjC,sBAAsB,EAAE,YAAY,oBAAoB,cAAc,sBAAsB;GAC3F,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;IAChC,MAAM,UAAU,CAAC;KAChB,OAAO;KACP,OAAO;IACR,GAAG;KACF,OAAO;KACP,OAAO;IACR,CAAC;IACD,IAAI,gBAAgB,CAAC,iBAAiB,QAAQ,KAAK;KAClD,OAAO;KACP,OAAO,kBAAkB,OAAO,YAAY,CAAC;IAC9C,CAAC;IACD,IAAI,QAAQ,MAAM,QAAQ,KAAK;KAC9B,OAAO;KACP,OAAO,QAAQ;IAChB,CAAC;IACD,IAAI,QAAQ,IAAI,QAAQ,KAAK;KAC5B,OAAO;KACP,OAAO,QAAQ;IAChB,CAAC;IACD,MAAM,SAAS,mBAAmB;KACjC,SAAS;KACT,aAAa;KACb;KACA;IACD,CAAC;IACD,GAAG,OAAO,MAAM;GACjB;EACD;CACD,CAAC;CACD,IA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K,IAAI;EAC3B,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,QAAQ,MAAM;GACjB,MAAM,WAAW,aAAa,MAAM,0BAA0B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,eAAe;IAC7G,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;SACxD,GAAG,OAAO,wBAAwB,YAAY,KAAK,CAAC;GAC1D,CAAC;GACD,QAAQ,KAAK,QAAQ;GACrB;EACD;EACA,MAAM,WAAW,aAAa,MAAM,sBAAsB,SAAS,OAAO,IAAI,SAAS,GAAG,OAAO,KAAK,kBAAkB;GACvH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,OAAO,GAAG,IAAI,kCAAkC,eAAe,KAAK,CAAC;EACtF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,14 +1,14 @@
1
1
  import { t as MigrationToolsError } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
2
2
  import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
3
- import { N as errorUnexpected, O as errorRuntime$1, S as errorPathUnreachable, Z as mapRefResolutionError, f as errorDatabaseConnectionRequired, it as resolveMigrationPaths, nt as requireLiveDatabase, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
4
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
3
+ import { N as errorUnexpected, O as errorRuntime$1, S as errorPathUnreachable, Z as mapRefResolutionError, f as errorDatabaseConnectionRequired, it as resolveMigrationPaths, nt as requireLiveDatabase, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
4
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
5
5
  import { i as readRefs } from "./refs-B2BL8z3i-DGGFB7Mj.mjs";
6
6
  import { u as requireHeadRef } from "./aggregate-D53gnb7v.mjs";
7
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
8
- import { a as planSpacePath, t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
7
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
8
+ import { a as planSpacePath, t as createControlClient } from "./client-BNAEJZ76-ld7eOxpZ.mjs";
9
9
  import { n as parseContractRef } from "./ref-resolution-Ct2GMcNB.mjs";
10
10
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
11
- //#region ../../../1-framework/3-tooling/cli/dist/migrate-show-B2LkXkoB.mjs
11
+ //#region ../../../1-framework/3-tooling/cli/dist/migrate-show-CO5OiR3J.mjs
12
12
  /**
13
13
  * Read-only preview core for `migrate --show`: computes the migration path through the same planSpacePath seam the real apply uses, stopping before any write boundary.
14
14
  */
@@ -24,7 +24,18 @@ import { notOk, ok } from "@prisma/orm-framework/utils/result";
24
24
  * DB state is mutated.
25
25
  */
26
26
  async function executeMigrateShowPlan(options) {
27
- const config = await loadConfig(options.config);
27
+ const configResult = await loadConfigForSections(options.config, [
28
+ "family",
29
+ "target",
30
+ "adapter",
31
+ "driver",
32
+ "extensions",
33
+ "db",
34
+ "migrations",
35
+ "contract"
36
+ ]);
37
+ if (!configResult.ok) return configResult;
38
+ const config = configResult.value;
28
39
  const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);
29
40
  const dbConnection = options.db ?? config.db?.connection;
30
41
  const hasDriver = !!config.driver;
@@ -199,4 +210,4 @@ async function executeMigrateShowPlan(options) {
199
210
  //#endregion
200
211
  export { executeMigrateShowPlan as t };
201
212
 
202
- //# sourceMappingURL=migrate-show-B2LkXkoB-D1ZNl84C.mjs.map
213
+ //# sourceMappingURL=migrate-show-CO5OiR3J-DE4NIjvW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-show-CO5OiR3J-DE4NIjvW.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-show-CO5OiR3J.mjs"],"sourcesContent":["import { F as CliStructuredError, V as errorDatabaseConnectionRequired, Z as errorPathUnreachable, ct as errorUnexpected, lt as mapRefResolutionError, rt as errorRuntime, s as resolveMigrationPaths, ut as requireLiveDatabase } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { n as planSpacePath, t as createControlClient } from \"./client-BNAEJZ76.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { requireHeadRef } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/migrate-show.ts\n/**\n* Read-only preview core for `migrate --show`: computes the migration path through the same planSpacePath seam the real apply uses, stopping before any write boundary.\n*/\n/**\n* Computes the path through the SAME seam as `executeMigrate`:\n* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n* the full marker including `invariants` (not just `storageHash`).\n* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,\n* which feeds `resolveRecordedPath()` with the same target hash, target invariants,\n* and current marker as the real apply path uses.\n*\n* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n* DB state is mutated.\n*/\nasync function executeMigrateShowPlan(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst hasExplicitFrom = options.from !== void 0;\n\tif (!hasExplicitFrom) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tlet targetHash = contractHash;\n\tlet refInvariants;\n\tif (options.to) {\n\t\tconst toResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));\n\t\tif (toResult.value.provenance.kind === \"reserved-db\") return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"@db is not valid as a --to target; it names the live database state, not a target contract.\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\ttargetHash = toResult.value.hash;\n\t\tif (toResult.value.provenance.kind === \"ref\") {\n\t\t\tconst refEntry = allRefs[toResult.value.provenance.refName];\n\t\t\tif (refEntry) refInvariants = refEntry.invariants;\n\t\t}\n\t}\n\toptions.onPreflightComplete?.({\n\t\tconfigPath,\n\t\tmigrationsRelative,\n\t\tdbConnection,\n\t\thasExplicitFrom\n\t});\n\tconst markerBySpace = /* @__PURE__ */ new Map();\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tif (hasExplicitFrom) if (options.from === \"@db\") {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from @db --db $DATABASE_URL\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t} else {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tif (fromResult.value.provenance.kind === \"reserved-db\") {\n\t\t\tconst missingDb = requireLiveDatabase({\n\t\t\t\tdbConnection,\n\t\t\t\thasDriver,\n\t\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\"\n\t\t\t});\n\t\t\tif (missingDb) return notOk(missingDb);\n\t\t} else {\n\t\t\tconst fromHash = fromResult.value.hash;\n\t\t\tconst offlineMarker = fromHash === EMPTY_CONTRACT_HASH ? null : {\n\t\t\t\tstorageHash: fromHash,\n\t\t\t\tinvariants: []\n\t\t\t};\n\t\t\tmarkerBySpace.set(aggregate.app.spaceId, offlineMarker);\n\t\t}\n\t}\n\tconst needsLiveMarker = !hasExplicitFrom || options.from === \"@db\";\n\tif (needsLiveMarker) {\n\t\tif (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"A database connection is required to read the live marker for migrate --show\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconst allMarkers = await client.readAllMarkers();\n\t\t\tfor (const space of allSpaces) {\n\t\t\t\tconst marker = allMarkers.get(space.spaceId);\n\t\t\t\tmarkerBySpace.set(space.spaceId, marker ?? null);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tconst canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];\n\tconst orderedMigrations = [];\n\tfor (const space of canonicalOrderSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: isAppSpace ? targetHash : headRef.hash,\n\t\t\trefInvariants: isAppSpace ? refInvariants : void 0,\n\t\t\tliveMarker: markerBySpace.get(space.spaceId) ?? null\n\t\t});\n\t\tif (outcome.kind === \"at-head\") continue;\n\t\tif (outcome.kind === \"never-planned\") return notOk(errorPathUnreachable({\n\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\tsummary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n\t\t\twhy: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\ttarget: outcome.targetHash,\n\t\t\t\tkind: \"neverPlanned\"\n\t\t\t}\n\t\t}));\n\t\tif (outcome.kind === \"unreachable\") {\n\t\t\tconst fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\treturn notOk(errorPathUnreachable({\n\t\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\t\tsummary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n\t\t\t\twhy: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n\t\t\t\tmeta: {\n\t\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: outcome.targetHash\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (outcome.kind === \"unsatisfiable\") return notOk(errorRuntime(\"MIGRATION.NO_INVARIANT_PATH\", `Missing required invariants for space \"${outcome.spaceId}\"`, {\n\t\t\twhy: `The path requires invariants not available on disk: ${outcome.missing.join(\", \")}`,\n\t\t\tfix: \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\tmissing: [...outcome.missing]\n\t\t\t}\n\t\t}));\n\t\tfor (const edge of outcome.plan.migrationEdges) orderedMigrations.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to\n\t\t});\n\t}\n\tconst count = orderedMigrations.length;\n\treturn ok({\n\t\taggregate,\n\t\tcontractHash,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`,\n\t\trenderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH])),\n\t\tusedLiveMarker: needsLiveMarker\n\t});\n}\n//#endregion\nexport { executeMigrateShowPlan as t };\n\n//# sourceMappingURL=migrate-show-CO5OiR3J.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,eAAe,uBAAuB,SAAS;CAC9C,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAA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GAC5J,KAAK,uDAAuD,QAAQ,QAAQ,KAAK,IAAI;GACrF,KAAK;GACL,MAAM;IACL,SAAS,QAAQ;IACjB,SAAS,CAAC,GAAG,QAAQ,OAAO;GAC7B;EACD,CAAC,CAAC;EACF,KAAK,MAAM,QAAQ,QAAQ,KAAK,gBAAgB,kBAAkB,KAAK;GACtE,SAAS,MAAM;GACf,SAAS,KAAK;GACd,eAAe,KAAK;GACpB,MAAM,KAAK;GACX,IAAI,KAAK;EACV,CAAC;CACF;CACA,MAAM,QAAQ,kBAAkB;CAChC,OAAO,GAAG;EACT;EACA;EACA,YAAY;EACZ,SAAS,UAAU,IAAI,wCAAwC,GAAG,MAAM,YAAY,UAAU,IAAI,KAAK,IAAI;EAC3G,yBAAyB,IAAI,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,SAAS,cAAc,IAAI,EAAE,OAAO,CAAC,EAAE,eAAA,OAAkC,CAAC,CAAC;EACpI,gBAAgB;CACjB,CAAC;AACF"}
@@ -1,7 +1,7 @@
1
- import { t as CliStructuredError$1 } from "./cli-errors-CDr3WcJP-NFry5GHb.mjs";
1
+ import { t as CliStructuredError$1 } from "./cli-errors-BKPhkBSf-Ca-ymb6S.mjs";
2
2
  import { c as ContractSpaceAggregate } from "./aggregate-BflrjWPO.mjs";
3
3
  import { Result } from "@prisma/orm-framework/utils/result";
4
- //#region ../../../1-framework/3-tooling/cli/dist/migrate-show-60NNqVia.d.mts
4
+ //#region ../../../1-framework/3-tooling/cli/dist/migrate-show-Cu3k9mZm.d.mts
5
5
  //#region src/control-api/operations/migrate-show.d.ts
6
6
  /**
7
7
  * One migration that will run in a `migrate --show` preview, in execution order.
@@ -53,4 +53,4 @@ interface MigrateShowPlanSuccess {
53
53
  declare function executeMigrateShowPlan(options: ExecuteMigrateShowPlanOptions): Promise<Result<MigrateShowPlanSuccess, CliStructuredError$1>>;
54
54
  //#endregion
55
55
  export { executeMigrateShowPlan as i, MigrateShowMigration as n, MigrateShowPlanSuccess as r, ExecuteMigrateShowPlanOptions as t };
56
- //# sourceMappingURL=migrate-show-60NNqVia-oGqMaVA9.d.mts.map
56
+ //# sourceMappingURL=migrate-show-Cu3k9mZm-B-nCgvK1.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-show-60NNqVia-oGqMaVA9.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-show-60NNqVia.d.mts"],"mappings":";;;;;;;;UAOU;WACC;WACA;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;WACA;;;;;WAKA,uBAAuB;aACrB;aACA;aACA;aACA;;;UAGH;WACC,WAAW;WACX;WACA,qBAAqB;WACrB;;WAEA,yBAAyB;;WAEzB;;;;;;;;;;;;;iBAaM,uBAAuB,SAAS,gCAAgC,QAAQ,OAAO,wBAAwB"}
1
+ {"version":3,"file":"migrate-show-Cu3k9mZm-B-nCgvK1.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-show-Cu3k9mZm.d.mts"],"mappings":";;;;;;;;UAOU;WACC;WACA;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;WACA;;;;;WAKA,uBAAuB;aACrB;aACA;aACA;aACA;;;UAGH;WACC,WAAW;WACX;WACA,qBAAqB;WACrB;;WAEA,yBAAyB;;WAEzB;;;;;;;;;;;;;iBAaM,uBAAuB,SAAS,gCAAgC,QAAQ,OAAO,wBAAwB"}
@@ -1,10 +1,10 @@
1
- import { I as formatErrorJson, L as formatErrorOutput, W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
2
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
3
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
4
- import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-DONPyXff-CGTUpLv-.mjs";
1
+ import { I as formatErrorJson, L as formatErrorOutput, W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
3
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
4
+ import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-DONPyXff-KpD0q3Zh.mjs";
5
5
  import { join, relative } from "pathe";
6
6
  import { Command } from "commander";
7
- //#region ../../../1-framework/3-tooling/cli/dist/migration-check-BDjtAn7x.mjs
7
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-check-BfOnfgyY.mjs
8
8
  function migrationPathRelative(dirPath) {
9
9
  return relative(process.cwd(), dirPath);
10
10
  }
@@ -114,7 +114,19 @@ function integrityViolationToCheckFailure(violation, migrationsDir) {
114
114
  }
115
115
  }
116
116
  async function executeMigrationCheckCommand(target, options, flags, ui) {
117
- const config = await loadConfig(options.config);
117
+ const configResult = await loadConfigForSections(options.config, [
118
+ "family",
119
+ "target",
120
+ "adapter",
121
+ "extensions",
122
+ "migrations",
123
+ "contract"
124
+ ]);
125
+ if (!configResult.ok) return {
126
+ error: configResult.failure,
127
+ exitCode: 2
128
+ };
129
+ const config = configResult.value;
118
130
  const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
119
131
  if (!flags.json && !flags.quiet) {
120
132
  const details = [{
@@ -251,4 +263,4 @@ function createMigrationCheckCommand() {
251
263
  //#endregion
252
264
  export { createMigrationCheckCommand as t };
253
265
 
254
- //# sourceMappingURL=migration-check-BDjtAn7x-B0nEBR0k.mjs.map
266
+ //# sourceMappingURL=migration-check-BfOnfgyY-DII6Ty5m.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-check-BfOnfgyY-DII6Ty5m.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-BfOnfgyY.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, x as formatErrorOutput } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from \"./migration-check-DONPyXff.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { join, relative } from \"pathe\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json and ops.json agree.\"\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tfix: \"Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op.\"\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tfix: \"Remove the orphan directory, or declare the extension in `extensions`.\"\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tfix: \"Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused.\"\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tfix: \"Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control.\"\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tfix: \"Re-emit the contract space migrations, or restore the missing migration package.\"\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Repair or remove the corrupt ref file.\"\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tfix: \"Update the extension to target the configured database, or change the project target.\"\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tfix: \"Update the contracts so each storage element is owned by exactly one contract space.\"\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract.\"\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tfix: \"Re-emit one of the conflicting packages so each migrationHash is unique.\"\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return {\n\t\terror: configResult.failure,\n\t\texitCode: 2\n\t};\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tui.log(` fix: ${f.fix}`);\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-BfOnfgyY.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,sBAAsB,SAAS,UAAU;CACjD,OAAO,KAAK,sBAAsB,OAAO,GAAG,QAAQ;AACrD;;;;;AAKA,SAAS,iCAAiC,WAAW,eAAe;CACnE,MAAM,iBAAiB,YAAY,sBAAsB,KAAK,eAAe,OAAO,CAAC;CACrF,MAAM,mBAAmB,SAAS,YAAY,sBAAsB,KAAK,eAAe,SAAS,OAAO,CAAC;CACzG,MAAM,eAAe,SAAS,YAAY,sBAAsB,KAAK,eAAe,SAAS,QAAQ,GAAG,QAAQ,MAAM,CAAC;CACvH,QAAQ,UAAU,MAAlB;EACC,KAAK,gBAAgB,OAAO;GAC3B,OAAO,UAAU;GACjB,MAAM;GACN,OAAO,sBAAsB,KAAK,eAAe,UAAU,SAAS,UAAU,OAAO,GAAG,gBAAgB;GACxG,KAAK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gBAAgB,KAAK;GACnG,GAAG,IAAI,KAAK,OAAO,UAAU,aAAa;EAC3C,OAAO;GACN,KAAK,MAAM,KAAK,OAAO,UAAU;IAChC,GAAG,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK;IAC3C,GAAG,IAAI,UAAU,EAAE,KAAK;GACzB;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
@@ -3,11 +3,11 @@ import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contr
3
3
  import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
4
4
  import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
5
5
  import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories } from "./verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs";
6
- import { A as errorSpaceNotFound, Z as mapRefResolutionError, _ as errorInvalidSpaceId, c as errorAmbiguousMigrationRef, rt as resolveContractPath } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
6
+ import { A as errorSpaceNotFound, Z as mapRefResolutionError, _ as errorInvalidSpaceId, c as errorAmbiguousMigrationRef, rt as resolveContractPath } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
7
7
  import { s as loadContractSpaceAggregate } from "./aggregate-D53gnb7v.mjs";
8
- import { u as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
8
+ import { u as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
9
9
  import { r as parseMigrationRef } from "./ref-resolution-Ct2GMcNB.mjs";
10
- import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-BPYp3LNc-DsDdLU0J.mjs";
10
+ import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-BPYp3LNc-DjdEIQsZ.mjs";
11
11
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
12
12
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
13
13
  import { join, relative } from "pathe";
@@ -352,4 +352,4 @@ async function checkSingleTarget(target, inputs) {
352
352
  //#endregion
353
353
  export { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };
354
354
 
355
- //# sourceMappingURL=migration-check-DONPyXff-CGTUpLv-.mjs.map
355
+ //# sourceMappingURL=migration-check-DONPyXff-KpD0q3Zh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-check-DONPyXff-CGTUpLv-.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-DONPyXff.mjs"],"sourcesContent":["import { K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, at as errorSpaceNotFound, lt as mapRefResolutionError, o as resolveContractPath } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-BPYp3LNc.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\nexport { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };\n\n//# sourceMappingURL=migration-check-DONPyXff.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,sBAAsB,SAAS,UAAU;CACjD,OAAO,KAAK,sBAAsB,OAAO,GAAG,QAAQ;AACrD;AACA,SAAS,gBAAgB,SAAS,SAAS,SAAS,UAAU;CAC7D,IAAI,CAAC,WAAW,KAAK,SAAS,QAAQ,CAAC,GAAG,OAAO;EAChD,OAAO;EACP,MAAM;EACN,OAAO,sBAAsB,SAAS,QAAQ;EAC9C,KAAK,GAAG,SAAS,mBAAmB;EACpC,KAAK;CACN;CACA,OAAO;AACR;;;;;;;;;AASA,eAAe,yBAAyB,SAAS,KAAK,eAAe;CACpE,IAAI;CACJ,IAAI;EACH,cAAc,oBAAoB,eAAe,IAAI,SAAS,EAAE;CACjE,QAAQ;EACP,OAAO;GACN,OAAO;GACP,MAAM;GACN,OAAO,sBAAsB,IAAI,OAAO;GACxC,KAAK,cAAc,IAAI,QAAQ,iBAAiB,IAAI,SAAS,GAAG;GAChE,KAAK;EACN;CACD;CACA,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,yBAAyB,eAAe,IAAI,SAAS,EAAE;CACpE,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,KAAK,MAAM,SAAS,uCAAuC,OAAO;EAClG,OAAO;GACN,OAAO;GACP,MAAM;GACN,OAAO,sBAAsB,IAAI,OAAO;GACxC,KA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a;EACpB,MAAM;EACN,OAAO,sBAAsB,WAAW,SAAS,gBAAgB;EACjE,KAAK,eAAe,aAAa,WAAW,kCAAkC,aAAa;EAC3F,KAAK;CACN,CAAC;CACD,MAAM,kBAAkB,MAAM,yBAAyB,aAAa,SAAS,YAAY,aAAa,oBAAoB;CAC1H,IAAI,iBAAiB,SAAS,KAAK,eAAe;CAClD,MAAM,kBAAkB,aAAa,YAAY,QAAQ,aAAa,UAAU,KAAK;CACrF,IAAI,SAAS,WAAW,GAAG,OAAO;EACjC,QAAQ;GACP,IAAI;GACJ,UAAU,CAAC;GACX,SAAS;EACV;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;CACA,OAAO;EACN,QAAQ;GACP,IAAI;GACJ;GACA,SAAS,GAAG,SAAS,OAAO;EAC7B;EACA,UAAU;EACV,GAAG,UAAU,mBAAmB,eAAe;CAChD;AACD"}
1
+ {"version":3,"file":"migration-check-DONPyXff-KpD0q3Zh.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-DONPyXff.mjs"],"sourcesContent":["import { K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, at as errorSpaceNotFound, lt as mapRefResolutionError, o as resolveContractPath } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-BPYp3LNc.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\nexport { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };\n\n//# sourceMappingURL=migration-check-DONPyXff.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,sBAAsB,SAAS,UAAU;CACjD,OAAO,KAAK,sBAAsB,OAAO,GAAG,QAAQ;AACrD;AACA,SAAS,gBAAgB,SAAS,SAAS,SAAS,UAAU;CAC7D,IAAI,CAAC,WAAW,KAAK,SAAS,QAAQ,CAAC,GAAG,OAAO;EAChD,OAAO;EACP,MAAM;EACN,OAAO,sBAAsB,SAAS,QAAQ;EAC9C,KAAK,GAAG,SAAS,mBAAmB;EACpC,KAAK;CACN;CACA,OAAO;AACR;;;;;;;;;AASA,eAAe,yBAAyB,SAAS,KAAK,eAAe;CACpE,IAAI;CACJ,IAAI;EACH,cAAc,oBAAoB,eAAe,IAAI,SAAS,EAAE;CACjE,QAAQ;EACP,OAAO;GACN,OAAO;GACP,MAAM;GACN,OAAO,sBAAsB,IAAI,OAAO;GACxC,KAAK,cAAc,IAAI,QAAQ,iBAAiB,IAAI,SAAS,GAAG;GAChE,KAAK;EACN;CACD;CACA,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,yBAAyB,eAAe,IAAI,SAAS,EAAE;CACpE,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG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