@prisma/orm-toolchain 8.0.0-rc.1-dev.6 → 8.0.0-rc.1-dev.7

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 (200) hide show
  1. package/dist/{aggregate-i-rfetSO.mjs → aggregate-D53gnb7v.mjs} +8 -8
  2. package/dist/{aggregate-i-rfetSO.mjs.map → aggregate-D53gnb7v.mjs.map} +1 -1
  3. package/dist/bin__prisma-next.mjs +22 -22
  4. package/dist/bin__prisma-next.mjs.map +1 -1
  5. package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs +14 -0
  6. package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs.map +1 -0
  7. package/dist/{types-2n_H3DQ9-Bks8UPEO.d.mts → cli-errors-CDr3WcJP-NFry5GHb.d.mts} +2 -2
  8. package/dist/cli-errors-CDr3WcJP-NFry5GHb.d.mts.map +1 -0
  9. package/dist/cli.mjs +2 -2
  10. package/dist/cli__commands__contract-emit.mjs +1 -1
  11. package/dist/cli__commands__contract-infer.mjs +1 -1
  12. package/dist/cli__commands__db-init.mjs +1 -1
  13. package/dist/cli__commands__db-schema.mjs +1 -1
  14. package/dist/cli__commands__db-sign.mjs +1 -1
  15. package/dist/cli__commands__db-update.mjs +1 -1
  16. package/dist/cli__commands__db-verify.mjs +1 -1
  17. package/dist/cli__commands__migrate.d.mts +3 -12
  18. package/dist/cli__commands__migrate.d.mts.map +1 -1
  19. package/dist/cli__commands__migrate.mjs +1 -1
  20. package/dist/cli__commands__migration-check.d.mts +1 -57
  21. package/dist/cli__commands__migration-check.d.mts.map +1 -1
  22. package/dist/cli__commands__migration-check.mjs +2 -2
  23. package/dist/cli__commands__migration-graph.d.mts +1 -1
  24. package/dist/cli__commands__migration-graph.mjs +1 -1
  25. package/dist/cli__commands__migration-list.d.mts +4 -44
  26. package/dist/cli__commands__migration-list.d.mts.map +1 -1
  27. package/dist/cli__commands__migration-list.mjs +2 -2
  28. package/dist/cli__commands__migration-log.d.mts +1 -1
  29. package/dist/cli__commands__migration-log.mjs +1 -1
  30. package/dist/cli__commands__migration-new.mjs +1 -1
  31. package/dist/cli__commands__migration-plan.d.mts +2 -47
  32. package/dist/cli__commands__migration-plan.d.mts.map +1 -1
  33. package/dist/cli__commands__migration-plan.mjs +1 -1
  34. package/dist/cli__commands__migration-show.mjs +1 -1
  35. package/dist/cli__commands__migration-status.d.mts +1 -1
  36. package/dist/cli__commands__migration-status.mjs +1 -1
  37. package/dist/cli__commands__ref.d.mts +1 -28
  38. package/dist/cli__commands__ref.d.mts.map +1 -1
  39. package/dist/cli__commands__ref.mjs +2 -2
  40. package/dist/cli__commands__telemetry.mjs +1 -1
  41. package/dist/cli__control-api.d.mts +502 -2
  42. package/dist/cli__control-api.d.mts.map +1 -1
  43. package/dist/cli__control-api.mjs +18 -3
  44. package/dist/cli__migration-cli.mjs +2 -2
  45. package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs → client-Y6qbDk7X-BzKLmBZo.mjs} +8 -8
  46. package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs.map → client-Y6qbDk7X-BzKLmBZo.mjs.map} +1 -1
  47. package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs → command-helpers-C4WpR-QE-DE494TSG.mjs} +2 -2
  48. package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs.map → command-helpers-C4WpR-QE-DE494TSG.mjs.map} +1 -1
  49. package/dist/config-loader.d.mts +2 -18
  50. package/dist/{contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs → contract-at-errors-Dv1mxKYO-C29YB4RC.mjs} +4 -4
  51. package/dist/contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map +1 -0
  52. package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs → contract-emit-CTm2zfuG-7PV9SBY6.mjs} +4 -4
  53. package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs.map → contract-emit-CTm2zfuG-7PV9SBY6.mjs.map} +1 -1
  54. package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs → contract-emit-D8IXP9Qp-Df6NwXn8.mjs} +3 -3
  55. package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs.map → contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map} +1 -1
  56. package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs → contract-infer-BwT7ngoo-Dx6aAwIN.mjs} +4 -4
  57. package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs.map → contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map} +1 -1
  58. package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs +82 -0
  59. package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map +1 -0
  60. package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs} +3 -3
  61. package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs.map} +1 -1
  62. package/dist/{contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs → contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs} +6 -6
  63. package/dist/contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map +1 -0
  64. package/dist/{db-init-CXMcvoIA.mjs → db-init-CBj_EWg3.mjs} +15 -26
  65. package/dist/db-init-CBj_EWg3.mjs.map +1 -0
  66. package/dist/{db-schema-j8DERh4t.mjs → db-schema-BWpeh0Q_.mjs} +4 -4
  67. package/dist/{db-schema-j8DERh4t.mjs.map → db-schema-BWpeh0Q_.mjs.map} +1 -1
  68. package/dist/{db-sign-xV_rpoIc.mjs → db-sign-DCb_DKtv.mjs} +13 -29
  69. package/dist/db-sign-DCb_DKtv.mjs.map +1 -0
  70. package/dist/{db-update-DXa2DIvu.mjs → db-update-WX0KitcX.mjs} +27 -50
  71. package/dist/db-update-WX0KitcX.mjs.map +1 -0
  72. package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs} +5 -5
  73. package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs.map → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map} +1 -1
  74. package/dist/{errors-BwusfLIN-BXM7K-ww.mjs → errors-Co-8oaiB-CB-6Uqki.mjs} +5 -4
  75. package/dist/{errors-BwusfLIN-BXM7K-ww.mjs.map → errors-Co-8oaiB-CB-6Uqki.mjs.map} +1 -1
  76. package/dist/{errors-AkMBj-YP.d.mts → errors-NRmFpwR1.d.mts} +6 -2
  77. package/dist/errors-NRmFpwR1.d.mts.map +1 -0
  78. package/dist/{format-Bw3LVJ1v-D10inUT9.mjs → format-Bw3LVJ1v-BJ6lVFMA.mjs} +2 -2
  79. package/dist/{format-Bw3LVJ1v-D10inUT9.mjs.map → format-Bw3LVJ1v-BJ6lVFMA.mjs.map} +1 -1
  80. package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs → framework-components-3DdB31mk-BHyX-OlJ.mjs} +2 -2
  81. package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs.map → framework-components-3DdB31mk-BHyX-OlJ.mjs.map} +1 -1
  82. package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs → graph-membership-BEmNEMtP-rz61CLM5.mjs} +3 -3
  83. package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs.map → graph-membership-BEmNEMtP-rz61CLM5.mjs.map} +1 -1
  84. package/dist/index-Df9igRvP.d.mts +18 -0
  85. package/dist/index-Df9igRvP.d.mts.map +1 -0
  86. package/dist/{init-CPB89WK2-Di4kgP6B.mjs → init-CPB89WK2-DPZRZ9Ee.mjs} +3 -3
  87. package/dist/{init-CPB89WK2-Di4kgP6B.mjs.map → init-CPB89WK2-DPZRZ9Ee.mjs.map} +1 -1
  88. package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs} +4 -4
  89. package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map} +1 -1
  90. package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs +52 -0
  91. package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs.map +1 -0
  92. package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs → invariants-C1WVUAH7-DlOBTTkM.mjs} +3 -3
  93. package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs.map → invariants-C1WVUAH7-DlOBTTkM.mjs.map} +1 -1
  94. package/dist/{io-CL3hSv42-DGZtTs89.mjs → io-CHUUeHh0-CoCBe9eN.mjs} +5 -5
  95. package/dist/{io-CL3hSv42-DGZtTs89.mjs.map → io-CHUUeHh0-CoCBe9eN.mjs.map} +1 -1
  96. package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs +22 -0
  97. package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs.map +1 -0
  98. package/dist/{migrate-COusRrm7.mjs → migrate-B-NAuO90.mjs} +87 -230
  99. package/dist/migrate-B-NAuO90.mjs.map +1 -0
  100. package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts +56 -0
  101. package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts.map +1 -0
  102. package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs +202 -0
  103. package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +1 -0
  104. package/dist/{migration-diUAhNaa.mjs → migration-DAJY-NmR.mjs} +3 -3
  105. package/dist/{migration-diUAhNaa.mjs.map → migration-DAJY-NmR.mjs.map} +1 -1
  106. package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs +254 -0
  107. package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +1 -0
  108. package/dist/{migration-check-CueEJelQ-J81XR_ns.mjs → migration-check-DONPyXff-CGTUpLv-.mjs} +12 -254
  109. package/dist/migration-check-DONPyXff-CGTUpLv-.mjs.map +1 -0
  110. package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs} +4 -4
  111. package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map} +1 -1
  112. package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs → migration-graph-DDaOHo10-yJFAbKCu.mjs} +3 -3
  113. package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs.map → migration-graph-DDaOHo10-yJFAbKCu.mjs.map} +1 -1
  114. package/dist/{migration-graph-BL6vfLcE.mjs → migration-graph-Dn469b0l.mjs} +10 -19
  115. package/dist/migration-graph-Dn469b0l.mjs.map +1 -0
  116. package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs +35 -0
  117. package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map +1 -0
  118. package/dist/migration-list-C9OPCMt--C28yBgVr.mjs +102 -0
  119. package/dist/migration-list-C9OPCMt--C28yBgVr.mjs.map +1 -0
  120. package/dist/migration-list-jk4iCtmO.mjs +120 -0
  121. package/dist/migration-list-jk4iCtmO.mjs.map +1 -0
  122. package/dist/{migration-log-BXbz6-Lj-CKHbat5f.mjs → migration-log-DQzUBrm8-D3m9wcuf.mjs} +7 -5
  123. package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +1 -0
  124. package/dist/migration-new-BkSY6m0t.mjs +50 -0
  125. package/dist/migration-new-BkSY6m0t.mjs.map +1 -0
  126. package/dist/{migration-new-szZFsA3C.mjs → migration-new-g98oB3nC-BcrkxAAt.mjs} +12 -52
  127. package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +1 -0
  128. package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs → migration-path-target-BPYp3LNc-DsDdLU0J.mjs} +2 -2
  129. package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map → migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map} +1 -1
  130. package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts +159 -0
  131. package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts.map +1 -0
  132. package/dist/migration-plan-CjIYMJZy.mjs +172 -0
  133. package/dist/migration-plan-CjIYMJZy.mjs.map +1 -0
  134. package/dist/{migration-plan-CxXAXYc8-Dnp-v8Nl.mjs → migration-plan-CwuZLXVE-DAJ-JUQT.mjs} +45 -183
  135. package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +1 -0
  136. package/dist/{migration-show-BKsIh7Uz.mjs → migration-show-CW6EKtfw.mjs} +13 -9
  137. package/dist/migration-show-CW6EKtfw.mjs.map +1 -0
  138. package/dist/{migration-status-CNnRInne--cvmx56T.mjs → migration-status-DSQcBhiN.mjs} +37 -68
  139. package/dist/migration-status-DSQcBhiN.mjs.map +1 -0
  140. package/dist/migration-tools.d.mts +4 -4
  141. package/dist/migration-tools.mjs +13 -13
  142. package/dist/migration-tools__aggregate.mjs +1 -1
  143. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  144. package/dist/migration-tools__errors.d.mts +2 -2
  145. package/dist/migration-tools__errors.mjs +2 -2
  146. package/dist/migration-tools__invariants.mjs +1 -1
  147. package/dist/migration-tools__io.mjs +1 -1
  148. package/dist/migration-tools__migration-graph.mjs +2 -2
  149. package/dist/migration-tools__migration.mjs +1 -1
  150. package/dist/migration-tools__ref-resolution.mjs +1 -1
  151. package/dist/migration-tools__refs.mjs +1 -1
  152. package/dist/migration-tools__spaces.mjs +2 -2
  153. package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs → project-import-root-C_bd0ooL-WkbJLnAA.mjs} +2 -2
  154. package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs.map → project-import-root-C_bd0ooL-WkbJLnAA.mjs.map} +1 -1
  155. package/dist/ref-DSAZime8.mjs +72 -0
  156. package/dist/ref-DSAZime8.mjs.map +1 -0
  157. package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs +96 -0
  158. package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs.map +1 -0
  159. package/dist/ref-eJjxzYTh-CNiyDL4p.mjs +109 -0
  160. package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +1 -0
  161. package/dist/{ref-resolution-BsdziDFA.mjs → ref-resolution-Ct2GMcNB.mjs} +2 -2
  162. package/dist/{ref-resolution-BsdziDFA.mjs.map → ref-resolution-Ct2GMcNB.mjs.map} +1 -1
  163. package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs +16 -0
  164. package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map +1 -0
  165. package/dist/{refs-DtoeUivZ-qay0UMSP.mjs → refs-B2BL8z3i-DGGFB7Mj.mjs} +3 -3
  166. package/dist/{refs-DtoeUivZ-qay0UMSP.mjs.map → refs-B2BL8z3i-DGGFB7Mj.mjs.map} +1 -1
  167. package/dist/refs-fQLFcMoq-UTlvnijY.mjs +47 -0
  168. package/dist/refs-fQLFcMoq-UTlvnijY.mjs.map +1 -0
  169. package/dist/{spaces-BNd2Tlk0.mjs → spaces-DxuvClN9.mjs} +6 -6
  170. package/dist/{spaces-BNd2Tlk0.mjs.map → spaces-DxuvClN9.mjs.map} +1 -1
  171. package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs → telemetry-DVBHDQd6-Ckn5oClN.mjs} +2 -2
  172. package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs.map → telemetry-DVBHDQd6-Ckn5oClN.mjs.map} +1 -1
  173. package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs → verify-C6L_hiJU-B4V3bqvG.mjs} +2 -2
  174. package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs.map → verify-C6L_hiJU-B4V3bqvG.mjs.map} +1 -1
  175. package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs} +4 -4
  176. package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs.map} +1 -1
  177. package/dist/vite-plugin-contract-emit.mjs +1 -1
  178. package/package.json +12 -12
  179. package/dist/config-loader.d.mts.map +0 -1
  180. package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +0 -1
  181. package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +0 -1
  182. package/dist/db-init-CXMcvoIA.mjs.map +0 -1
  183. package/dist/db-sign-xV_rpoIc.mjs.map +0 -1
  184. package/dist/db-update-DXa2DIvu.mjs.map +0 -1
  185. package/dist/errors-AkMBj-YP.d.mts.map +0 -1
  186. package/dist/migrate-COusRrm7.mjs.map +0 -1
  187. package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +0 -1
  188. package/dist/migration-graph-BL6vfLcE.mjs.map +0 -1
  189. package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs +0 -228
  190. package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs.map +0 -1
  191. package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +0 -1
  192. package/dist/migration-new-szZFsA3C.mjs.map +0 -1
  193. package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +0 -1
  194. package/dist/migration-show-BKsIh7Uz.mjs.map +0 -1
  195. package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +0 -1
  196. package/dist/ref-DjZ5Y8ju.mjs +0 -171
  197. package/dist/ref-DjZ5Y8ju.mjs.map +0 -1
  198. package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs +0 -57
  199. package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map +0 -1
  200. package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +0 -1
@@ -0,0 +1,159 @@
1
+ import { t as CliStructuredError$1 } from "./cli-errors-CDr3WcJP-NFry5GHb.mjs";
2
+ import { t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
3
+ import { t as CommonCommandOptions } from "./global-flags-BpoOYtNZ-CHZD3fud.mjs";
4
+ import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
5
+ import "./metadata-BtscDay2.mjs";
6
+ import "./package-N9PPdFV_.mjs";
7
+ import { Result } from "@prisma/orm-framework/utils/result";
8
+ import { OperationPreview } from "@prisma/orm-framework/components/control";
9
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-plan-BsOYRogP.d.mts
10
+ //#region src/control-api/operations/contract-space-seed-phase.d.ts
11
+ /**
12
+ * In-memory authored migration package shipped by an extension descriptor.
13
+ * Mirrors `MigrationPackage` from `@internal/migration-tools/io` (the
14
+ * on-disk shape minus `dirPath`); redeclared structurally here so the
15
+ * CLI helper does not couple to any family's `ExtensionMigrationPackage`
16
+ * type — any family that ships pre-built migration packages can pass
17
+ * them through unchanged.
18
+ */
19
+ interface DescriptorMigrationPackage {
20
+ readonly dirName: string;
21
+ readonly metadata: MigrationMetadata$1;
22
+ readonly ops: MigrationOps;
23
+ }
24
+ /**
25
+ * Minimal descriptor view consumed by the seed phase. Mirrors the shape
26
+ * the SQL family ships on each declared extension entry; only the fields
27
+ * the seed phase needs are surfaced.
28
+ */
29
+ interface SeedPhaseExtensionInput {
30
+ readonly id: string;
31
+ readonly contractSpace?: {
32
+ readonly contractJson: unknown;
33
+ readonly headRef: {
34
+ readonly hash: string;
35
+ readonly invariants: readonly string[];
36
+ };
37
+ readonly migrations: readonly DescriptorMigrationPackage[];
38
+ };
39
+ }
40
+ interface ContractSpaceSeedPhaseInputs {
41
+ readonly migrationsDir: string;
42
+ readonly extensions: ReadonlyArray<SeedPhaseExtensionInput>;
43
+ }
44
+ /**
45
+ * One per-space record describing what the seed phase did for an
46
+ * extension contract space. Surfaced verbatim by the caller (typically
47
+ * `migration plan`) so users see a single line per touched extension.
48
+ *
49
+ * - `action: 'updated'` — either the on-disk head pointer changed, or
50
+ * one or more new descriptor-shipped migration packages were
51
+ * materialised into `migrations/<spaceId>/<dirName>/`.
52
+ * - `action: 'unchanged'` — the on-disk head already matched the
53
+ * descriptor and no new migration packages needed to be written.
54
+ *
55
+ * Either way, the artifacts (`contract.json`, `contract.d.ts`,
56
+ * `refs/head.json`) are re-emitted: the framework owns those files and
57
+ * makes the re-emit observably idempotent at the byte level.
58
+ */
59
+ interface ContractSpaceSeedPhaseRecord {
60
+ readonly spaceId: string;
61
+ readonly action: 'updated' | 'unchanged';
62
+ readonly priorHash: string | null;
63
+ readonly newHash: string;
64
+ readonly newMigrationDirs: readonly string[];
65
+ }
66
+ interface ContractSpaceSeedPhaseResult {
67
+ readonly seeded: readonly ContractSpaceSeedPhaseRecord[];
68
+ }
69
+ /**
70
+ * Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4).
71
+ *
72
+ * For every extension that exposes a `contractSpace`:
73
+ *
74
+ * 1. Read the on-disk head ref (returns `null` on first emit).
75
+ * 2. Write the head contract into the migrations-root snapshot store
76
+ * (write-if-absent, keyed by hash) and unconditionally re-emit
77
+ * `refs/head.json`, via {@link emitContractSpaceArtifacts}. The
78
+ * framework owns `refs/head.json`; re-emit is the contract for that
79
+ * file. The snapshot itself is only written once per distinct hash.
80
+ * 3. Materialise any descriptor-shipped migration packages not yet on
81
+ * disk via {@link materialiseExtensionMigrationPackageIfMissing}.
82
+ * Existing packages are left untouched (by-existence skip).
83
+ *
84
+ * The return value lets the caller render a per-space status line and
85
+ * lets the phase-2 aggregate loader run on a now-consistent disk state
86
+ * (every loaded extension is guaranteed to have its head ref pinned
87
+ * to the descriptor's hash and to ship every package the descriptor
88
+ * declares).
89
+ *
90
+ * Output ordering is deterministic and alphabetical by spaceId (via
91
+ * {@link planAllSpaces}, which also detects duplicate spaceIds). This
92
+ * matches the canonical sort order used by every other aggregate
93
+ * surface (`migrate`, `migration status`, the runner).
94
+ */
95
+ declare function runContractSpaceSeedPhase(inputs: ContractSpaceSeedPhaseInputs): Promise<ContractSpaceSeedPhaseResult>;
96
+ //#endregion
97
+ //#region src/control-api/operations/migration-plan.d.ts
98
+ interface MigrationPlanOptions extends CommonCommandOptions {
99
+ readonly config?: string;
100
+ readonly name?: string;
101
+ readonly from?: string;
102
+ readonly to?: string;
103
+ }
104
+ interface MigrationPlanResult {
105
+ readonly ok: boolean;
106
+ readonly noOp: boolean;
107
+ readonly from: string | null;
108
+ readonly to: string;
109
+ readonly dir?: string;
110
+ readonly baselineDir?: string;
111
+ /**
112
+ * Extension-space migration packages materialised onto disk during this
113
+ * `plan` run. Each entry names a `migrations/<spaceId>/<dirName>/`
114
+ * tree the framework wrote alongside the app-space migration directory.
115
+ * Empty when the project has no extension packs declaring a contract
116
+ * space, or when every extension-space package is already on disk.
117
+ *
118
+ * Surfacing these in the result (rather than only via `ui.step` log
119
+ * lines) makes the cross-space side effect explicit to JSON consumers
120
+ * and the success-summary renderer — the same cross-space side effect
121
+ * that `migrate` will replay.
122
+ */
123
+ readonly emittedExtensionDirs: readonly {
124
+ readonly spaceId: string;
125
+ readonly dirName: string;
126
+ }[];
127
+ readonly operations: readonly {
128
+ readonly id: string;
129
+ readonly label: string;
130
+ readonly operationClass: string;
131
+ }[];
132
+ /**
133
+ * Family-agnostic textual preview of the migration plan operations.
134
+ * Replaces the previous `sql?: readonly string[]` field; consumers should
135
+ * read `result.preview?.statements`.
136
+ */
137
+ readonly preview?: OperationPreview;
138
+ readonly summary: string;
139
+ /**
140
+ * When true, `migration.ts` was written but contains unfilled
141
+ * `placeholder(...)` calls. The user must edit the file and then run
142
+ * `node migration.ts` to self-emit `ops.json` / `migration.json`.
143
+ */
144
+ readonly pendingPlaceholders?: boolean;
145
+ readonly timings: {
146
+ readonly total: number;
147
+ };
148
+ }
149
+ declare function executeMigrationPlanCommand(options: MigrationPlanOptions, startTime: number, callbacks?: {
150
+ readonly onContextResolved?: (ctx: {
151
+ readonly configPath: string;
152
+ readonly contractPath: string;
153
+ readonly appMigrationsRelative: string;
154
+ }) => void;
155
+ readonly onSeeded?: (record: ContractSpaceSeedPhaseRecord) => void;
156
+ }): Promise<Result<MigrationPlanResult, CliStructuredError$1>>;
157
+ //#endregion
158
+ export { executeMigrationPlanCommand as a, MigrationPlanResult as i, ContractSpaceSeedPhaseRecord as n, runContractSpaceSeedPhase as o, ContractSpaceSeedPhaseResult as r, ContractSpaceSeedPhaseInputs as t };
159
+ //# sourceMappingURL=migration-plan-BsOYRogP-CC1UFAbu.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-plan-BsOYRogP-CC1UFAbu.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-plan-BsOYRogP.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;UAeU;WACC;WACA,UAAU;WACV,KAAK;;;;;;;UAON;WACC;WACA;aACE;aACA;eACE;eACA;;aAEF,qBAAqB;;;UAGxB;WACC;WACA,YAAY,cAAc;;;;;;;;;;;;;;;;;UAiB3B;WACC;WACA;WACA;WACA;WACA;;UAED;WACC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BX,0BAA0B,QAAQ,+BAA+B,QAAQ;;;UAGhF,6BAA6B;WAC5B;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;WACA;WACA;WACA;;;;;;;;;;;;;WAaA;aACE;aACA;;WAEF;aACE;aACA;aACA;;;;;;;WAOF,UAAU;WACV;;;;;;WAMA;WACA;aACE;;;iBAGI,4BAA4B,SAAS,sBAAsB,mBAAmB;WACpF,qBAAqB;aACnB;aACA;aACA;;WAEF,YAAY,QAAQ;IAC3B,QAAQ,OAAO,qBAAqB"}
@@ -0,0 +1,172 @@
1
+ import { W as formatStyledHeader, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
2
+ import { t as executeMigrationPlanCommand } from "./migration-plan-CwuZLXVE-DAJ-JUQT.mjs";
3
+ import { notOk, ok } from "@prisma/orm-framework/utils/result";
4
+ import { Command } from "commander";
5
+ //#region ../../../1-framework/3-tooling/cli/dist/commands/migration-plan.mjs
6
+ function createMigrationPlanCommand() {
7
+ const command = new Command("plan");
8
+ setCommandDescriptions(command, "Plan a migration from contract changes", "Compares the emitted contract against the latest on-disk migration state and\nproduces a new migration package with the required operations. No database\nconnection is needed — this is a fully offline operation.");
9
+ setCommandExamples(command, [
10
+ "prisma-next migration plan",
11
+ "prisma-next migration plan --name add-users-table",
12
+ "prisma-next migration plan --to <migration-dir>^ --name rollback"
13
+ ]);
14
+ addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").option("--name <slug>", "Name slug for the migration directory", "migration").option("--from <contract>", "Starting contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)").option("--to <contract>", "Destination contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path); defaults to the emitted contract").action(async (options) => {
15
+ const flags = parseGlobalFlagsOrExit(options);
16
+ const startTime = Date.now();
17
+ const ui = createTerminalUI(flags);
18
+ const exitCode = handleResult(await executeMigrationPlanCommand(options, startTime, {
19
+ onContextResolved: ({ configPath, contractPath, appMigrationsRelative }) => {
20
+ if (!flags.json && !flags.quiet) {
21
+ const details = [
22
+ {
23
+ label: "config",
24
+ value: configPath
25
+ },
26
+ {
27
+ label: "contract",
28
+ value: contractPath
29
+ },
30
+ {
31
+ label: "migrations",
32
+ value: appMigrationsRelative
33
+ }
34
+ ];
35
+ if (options.from) details.push({
36
+ label: "from",
37
+ value: options.from
38
+ });
39
+ if (options.to) details.push({
40
+ label: "to",
41
+ value: options.to
42
+ });
43
+ if (options.name) details.push({
44
+ label: "name",
45
+ value: options.name
46
+ });
47
+ const header = formatStyledHeader({
48
+ command: "migration plan",
49
+ description: "Plan a migration from contract changes",
50
+ url: "https://pris.ly/migration-plan",
51
+ details,
52
+ flags
53
+ });
54
+ ui.stderr(header);
55
+ }
56
+ },
57
+ onSeeded: (record) => {
58
+ if (!flags.json && !flags.quiet && record.action === "updated") {
59
+ const pkgSuffix = record.newMigrationDirs.length > 0 ? `; ${record.newMigrationDirs.length} new migration package(s) materialised` : "";
60
+ ui.step(`Updated ${record.spaceId} to ${record.newHash}${pkgSuffix}`);
61
+ }
62
+ }
63
+ }), flags, ui, (planResult) => {
64
+ if (flags.json) ui.output(JSON.stringify(planResult, null, 2));
65
+ else if (!flags.quiet) ui.log(formatMigrationPlanOutput(planResult, flags));
66
+ });
67
+ process.exit(exitCode);
68
+ });
69
+ return command;
70
+ }
71
+ function formatMigrationPlanOutput(result, flags) {
72
+ const lines = [];
73
+ const useColor = flags.color !== false;
74
+ const green_ = useColor ? (s) => `\x1b[32m${s}\x1b[0m` : (s) => s;
75
+ const yellow_ = useColor ? (s) => `\x1b[33m${s}\x1b[0m` : (s) => s;
76
+ const dim_ = useColor ? (s) => `\x1b[2m${s}\x1b[0m` : (s) => s;
77
+ function appendEmittedExtensions() {
78
+ if (result.emittedExtensionDirs.length === 0) return;
79
+ lines.push("");
80
+ lines.push(dim_("Emitted extension migrations:"));
81
+ for (const entry of result.emittedExtensionDirs) lines.push(dim_(` ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));
82
+ lines.push("");
83
+ lines.push(`Next: review the extension migrations above, then run ${green_("prisma-next migrate")}.`);
84
+ }
85
+ if (result.noOp) {
86
+ lines.push(`${green_("✔")} No changes detected`);
87
+ lines.push(dim_(` from: ${result.from}`));
88
+ lines.push(dim_(` to: ${result.to}`));
89
+ appendEmittedExtensions();
90
+ return lines.join("\n");
91
+ }
92
+ if (result.pendingPlaceholders) {
93
+ lines.push(`${yellow_("⚠")} ${result.summary}`);
94
+ lines.push("");
95
+ lines.push(dim_(`from: ${result.from}`));
96
+ lines.push(dim_(`to: ${result.to}`));
97
+ if (result.dir) lines.push(dim_(`dir: ${result.dir}`));
98
+ lines.push("");
99
+ lines.push("Open migration.ts and replace each `placeholder(...)` call with your actual query.");
100
+ lines.push(`Then run: ${green_(`node ${result.dir ?? "<dir>"}/migration.ts`)}`);
101
+ appendEmittedExtensions();
102
+ return lines.join("\n");
103
+ }
104
+ lines.push(`${green_("✔")} ${result.summary}`);
105
+ lines.push("");
106
+ if (result.operations.length > 0) {
107
+ lines.push(dim_("│"));
108
+ for (let i = 0; i < result.operations.length; i++) {
109
+ const op = result.operations[i];
110
+ const treeChar = i === result.operations.length - 1 ? "└" : "├";
111
+ const destructiveMarker = op.operationClass === "destructive" ? ` ${yellow_("(destructive)")}` : "";
112
+ lines.push(`${dim_(treeChar)}─ ${op.label}${destructiveMarker}`);
113
+ }
114
+ if (result.operations.some((op) => op.operationClass === "destructive")) {
115
+ lines.push("");
116
+ lines.push(`${yellow_("⚠")} This migration contains destructive operations that may cause data loss.`);
117
+ }
118
+ lines.push("");
119
+ }
120
+ lines.push(dim_(`from: ${result.from}`));
121
+ lines.push(dim_(`to: ${result.to}`));
122
+ if (result.baselineDir) lines.push(dim_(`Baseline → ${result.baselineDir}`));
123
+ if (result.dir) lines.push(dim_(`App space → ${result.dir}`));
124
+ for (const entry of result.emittedExtensionDirs) lines.push(dim_(`Extension space ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));
125
+ lines.push("");
126
+ const reviewTarget = result.baselineDir !== void 0 && result.dir !== void 0 ? `${result.baselineDir} and ${result.dir}` : result.baselineDir ?? result.dir ?? "<dir>";
127
+ lines.push(`Next: review ${green_(reviewTarget)} if needed, then run ${green_("prisma-next migrate")}.`);
128
+ if (result.preview && result.preview.statements.length > 0) {
129
+ const allSql = result.preview.statements.every((s) => s.language === "sql");
130
+ lines.push("");
131
+ lines.push(dim_(allSql ? "DDL preview" : "Operation preview"));
132
+ lines.push("");
133
+ for (const statement of result.preview.statements) {
134
+ const trimmed = statement.text.trim();
135
+ if (!trimmed) continue;
136
+ const line = statement.language === "sql" && !trimmed.endsWith(";") ? `${trimmed};` : trimmed;
137
+ lines.push(line);
138
+ }
139
+ }
140
+ if (flags.verbose && result.timings) {
141
+ lines.push("");
142
+ lines.push(dim_(`Total time: ${result.timings.total}ms`));
143
+ }
144
+ return lines.join("\n");
145
+ }
146
+ /**
147
+ * Resolve a migration package by **target contract hash** (`metadata.to`)
148
+ * using exact match or prefix match.
149
+ *
150
+ * Note: matches `metadata.to` (the contract hash this migration produces),
151
+ * not `metadata.migrationHash` (the package's content-addressed identity).
152
+ * Tries exact match first, then prefix match. Returns the matched package on
153
+ * success, or a discriminated failure indicating whether the prefix was
154
+ * ambiguous or simply not found.
155
+ *
156
+ * @internal Exported for testing only.
157
+ */
158
+ function resolveBundleByPrefix(bundles, needle) {
159
+ const exact = bundles.find((p) => p.metadata.to === needle);
160
+ if (exact) return ok(exact);
161
+ const candidates = bundles.filter((p) => p.metadata.to.startsWith(needle));
162
+ if (candidates.length === 1) return ok(candidates[0]);
163
+ if (candidates.length > 1) return notOk({
164
+ reason: "ambiguous",
165
+ count: candidates.length
166
+ });
167
+ return notOk({ reason: "not-found" });
168
+ }
169
+ //#endregion
170
+ export { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };
171
+
172
+ //# sourceMappingURL=migration-plan-CjIYMJZy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-plan-CjIYMJZy.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-plan.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { t as executeMigrationPlanCommand } from \"../migration-plan-CwuZLXVE.mjs\";\nimport { Command } from \"commander\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/commands/migration-plan.ts\nfunction createMigrationPlanCommand() {\n\tconst command = new Command(\"plan\");\n\tsetCommandDescriptions(command, \"Plan a migration from contract changes\", \"Compares the emitted contract against the latest on-disk migration state and\\nproduces a new migration package with the required operations. No database\\nconnection is needed — this is a fully offline operation.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration plan\",\n\t\t\"prisma-next migration plan --name add-users-table\",\n\t\t\"prisma-next migration plan --to <migration-dir>^ --name rollback\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--name <slug>\", \"Name slug for the migration directory\", \"migration\").option(\"--from <contract>\", \"Starting contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--to <contract>\", \"Destination contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path); defaults to the emitted contract\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationPlanCommand(options, startTime, {\n\t\t\tonContextResolved: ({ configPath, contractPath, appMigrationsRelative }) => {\n\t\t\t\tif (!flags.json && !flags.quiet) {\n\t\t\t\t\tconst details = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\t\t\tvalue: configPath\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"contract\",\n\t\t\t\t\t\t\tvalue: contractPath\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\t\t\tvalue: appMigrationsRelative\n\t\t\t\t\t\t}\n\t\t\t\t\t];\n\t\t\t\t\tif (options.from) details.push({\n\t\t\t\t\t\tlabel: \"from\",\n\t\t\t\t\t\tvalue: options.from\n\t\t\t\t\t});\n\t\t\t\t\tif (options.to) details.push({\n\t\t\t\t\t\tlabel: \"to\",\n\t\t\t\t\t\tvalue: options.to\n\t\t\t\t\t});\n\t\t\t\t\tif (options.name) details.push({\n\t\t\t\t\t\tlabel: \"name\",\n\t\t\t\t\t\tvalue: options.name\n\t\t\t\t\t});\n\t\t\t\t\tconst header = formatStyledHeader({\n\t\t\t\t\t\tcommand: \"migration plan\",\n\t\t\t\t\t\tdescription: \"Plan a migration from contract changes\",\n\t\t\t\t\t\turl: \"https://pris.ly/migration-plan\",\n\t\t\t\t\t\tdetails,\n\t\t\t\t\t\tflags\n\t\t\t\t\t});\n\t\t\t\t\tui.stderr(header);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonSeeded: (record) => {\n\t\t\t\tif (!flags.json && !flags.quiet && record.action === \"updated\") {\n\t\t\t\t\tconst pkgSuffix = record.newMigrationDirs.length > 0 ? `; ${record.newMigrationDirs.length} new migration package(s) materialised` : \"\";\n\t\t\t\t\tui.step(`Updated ${record.spaceId} to ${record.newHash}${pkgSuffix}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}), flags, ui, (planResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(planResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationPlanOutput(planResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\nfunction formatMigrationPlanOutput(result, flags) {\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst green_ = useColor ? (s) => `\\x1b[32m${s}\\x1b[0m` : (s) => s;\n\tconst yellow_ = useColor ? (s) => `\\x1b[33m${s}\\x1b[0m` : (s) => s;\n\tconst dim_ = useColor ? (s) => `\\x1b[2m${s}\\x1b[0m` : (s) => s;\n\tfunction appendEmittedExtensions() {\n\t\tif (result.emittedExtensionDirs.length === 0) return;\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(\"Emitted extension migrations:\"));\n\t\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(` ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\t\tlines.push(\"\");\n\t\tlines.push(`Next: review the extension migrations above, then run ${green_(\"prisma-next migrate\")}.`);\n\t}\n\tif (result.noOp) {\n\t\tlines.push(`${green_(\"✔\")} No changes detected`);\n\t\tlines.push(dim_(` from: ${result.from}`));\n\t\tlines.push(dim_(` to: ${result.to}`));\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tif (result.pendingPlaceholders) {\n\t\tlines.push(`${yellow_(\"⚠\")} ${result.summary}`);\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`from: ${result.from}`));\n\t\tlines.push(dim_(`to: ${result.to}`));\n\t\tif (result.dir) lines.push(dim_(`dir: ${result.dir}`));\n\t\tlines.push(\"\");\n\t\tlines.push(\"Open migration.ts and replace each `placeholder(...)` call with your actual query.\");\n\t\tlines.push(`Then run: ${green_(`node ${result.dir ?? \"<dir>\"}/migration.ts`)}`);\n\t\tappendEmittedExtensions();\n\t\treturn lines.join(\"\\n\");\n\t}\n\tlines.push(`${green_(\"✔\")} ${result.summary}`);\n\tlines.push(\"\");\n\tif (result.operations.length > 0) {\n\t\tlines.push(dim_(\"│\"));\n\t\tfor (let i = 0; i < result.operations.length; i++) {\n\t\t\tconst op = result.operations[i];\n\t\t\tconst treeChar = i === result.operations.length - 1 ? \"└\" : \"├\";\n\t\t\tconst destructiveMarker = op.operationClass === \"destructive\" ? ` ${yellow_(\"(destructive)\")}` : \"\";\n\t\t\tlines.push(`${dim_(treeChar)}─ ${op.label}${destructiveMarker}`);\n\t\t}\n\t\tif (result.operations.some((op) => op.operationClass === \"destructive\")) {\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(`${yellow_(\"⚠\")} This migration contains destructive operations that may cause data loss.`);\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\tlines.push(dim_(`from: ${result.from}`));\n\tlines.push(dim_(`to: ${result.to}`));\n\tif (result.baselineDir) lines.push(dim_(`Baseline → ${result.baselineDir}`));\n\tif (result.dir) lines.push(dim_(`App space → ${result.dir}`));\n\tfor (const entry of result.emittedExtensionDirs) lines.push(dim_(`Extension space ${entry.spaceId} → migrations/${entry.spaceId}/${entry.dirName}`));\n\tlines.push(\"\");\n\tconst reviewTarget = result.baselineDir !== void 0 && result.dir !== void 0 ? `${result.baselineDir} and ${result.dir}` : result.baselineDir ?? result.dir ?? \"<dir>\";\n\tlines.push(`Next: review ${green_(reviewTarget)} if needed, then run ${green_(\"prisma-next migrate\")}.`);\n\tif (result.preview && result.preview.statements.length > 0) {\n\t\tconst allSql = result.preview.statements.every((s) => s.language === \"sql\");\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(allSql ? \"DDL preview\" : \"Operation preview\"));\n\t\tlines.push(\"\");\n\t\tfor (const statement of result.preview.statements) {\n\t\t\tconst trimmed = statement.text.trim();\n\t\t\tif (!trimmed) continue;\n\t\t\tconst line = statement.language === \"sql\" && !trimmed.endsWith(\";\") ? `${trimmed};` : trimmed;\n\t\t\tlines.push(line);\n\t\t}\n\t}\n\tif (flags.verbose && result.timings) {\n\t\tlines.push(\"\");\n\t\tlines.push(dim_(`Total time: ${result.timings.total}ms`));\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Resolve a migration package by **target contract hash** (`metadata.to`)\n* using exact match or prefix match.\n*\n* Note: matches `metadata.to` (the contract hash this migration produces),\n* not `metadata.migrationHash` (the package's content-addressed identity).\n* Tries exact match first, then prefix match. Returns the matched package on\n* success, or a discriminated failure indicating whether the prefix was\n* ambiguous or simply not found.\n*\n* @internal Exported for testing only.\n*/\nfunction resolveBundleByPrefix(bundles, needle) {\n\tconst exact = bundles.find((p) => p.metadata.to === needle);\n\tif (exact) return ok(exact);\n\tconst candidates = bundles.filter((p) => p.metadata.to.startsWith(needle));\n\tif (candidates.length === 1) return ok(candidates[0]);\n\tif (candidates.length > 1) return notOk({\n\t\treason: \"ambiguous\",\n\t\tcount: candidates.length\n\t});\n\treturn notOk({ reason: \"not-found\" });\n}\n//#endregion\nexport { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };\n\n//# sourceMappingURL=migration-plan.mjs.map"],"mappings":";;;;;AAKA,SAAS,6BAA6B;CACrC,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,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