@prisma/orm-toolchain 8.0.0-rc.1-dev.25 → 8.0.0-rc.1-dev.26

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 (160) hide show
  1. package/dist/bin__prisma-next.mjs +24 -24
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/{caught-errors-nYuTn3NK-DkD-ZrDr.mjs → caught-errors-B_oGFiYw-BqX49eW0.mjs} +3 -3
  4. package/dist/{caught-errors-nYuTn3NK-DkD-ZrDr.mjs.map → caught-errors-B_oGFiYw-BqX49eW0.mjs.map} +1 -1
  5. package/dist/{cli-errors-C7vbvQuK-DLpSxz4U.d.mts → cli-errors-C8DGzS94-CPP3UmRT.d.mts} +6 -5
  6. package/dist/cli-errors-C8DGzS94-CPP3UmRT.d.mts.map +1 -0
  7. package/dist/{cli-errors-kU09RUaz-CUkQ9XuM.mjs → cli-errors-CihMAEVj-C1uUYBop.mjs} +122 -28
  8. package/dist/cli-errors-CihMAEVj-C1uUYBop.mjs.map +1 -0
  9. package/dist/cli.mjs +383 -14
  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.d.mts +1 -1
  21. package/dist/cli__commands__migration-check.mjs +2 -2
  22. package/dist/cli__commands__migration-graph.d.mts +12 -10
  23. package/dist/cli__commands__migration-graph.d.mts.map +1 -1
  24. package/dist/cli__commands__migration-graph.mjs +1 -1
  25. package/dist/cli__commands__migration-list.d.mts +4 -4
  26. package/dist/cli__commands__migration-list.mjs +1 -1
  27. package/dist/cli__commands__migration-log.d.mts +4 -4
  28. package/dist/cli__commands__migration-log.mjs +1 -1
  29. package/dist/cli__commands__migration-new.mjs +1 -1
  30. package/dist/cli__commands__migration-plan.d.mts +1 -1
  31. package/dist/cli__commands__migration-plan.mjs +1 -1
  32. package/dist/cli__commands__migration-show.d.mts +1 -1
  33. package/dist/cli__commands__migration-show.mjs +1 -1
  34. package/dist/cli__commands__migration-status.d.mts +4 -4
  35. package/dist/cli__commands__migration-status.mjs +2 -2
  36. package/dist/cli__commands__ref.mjs +1 -1
  37. package/dist/cli__commands__telemetry.mjs +1 -1
  38. package/dist/cli__control-api.d.mts +33 -31
  39. package/dist/cli__control-api.d.mts.map +1 -1
  40. package/dist/cli__control-api.mjs +15 -15
  41. package/dist/cli__control-api__testing.d.mts +1 -1
  42. package/dist/{client-milNsAnF-B92uF3yv.mjs → client-CaIWFVnh-PVaTEvdx.mjs} +5 -5
  43. package/dist/{client-milNsAnF-B92uF3yv.mjs.map → client-CaIWFVnh-PVaTEvdx.mjs.map} +1 -1
  44. package/dist/{command-helpers-bGYd7Aab-BNSzfbHK.mjs → command-helpers-DutQjYgy-CDfFwtAa.mjs} +16 -5
  45. package/dist/{command-helpers-bGYd7Aab-BNSzfbHK.mjs.map → command-helpers-DutQjYgy-CDfFwtAa.mjs.map} +1 -1
  46. package/dist/{contract-at-errors-BTeDEXm4-BAIDia2-.mjs → contract-at-errors-BsQiGdZC-BY8u2is4.mjs} +3 -3
  47. package/dist/{contract-at-errors-BTeDEXm4-BAIDia2-.mjs.map → contract-at-errors-BsQiGdZC-BY8u2is4.mjs.map} +1 -1
  48. package/dist/contract-emit-BAfPwP3y-DfV1Stry.mjs +2 -0
  49. package/dist/{contract-emit-Ci-8sP-b-QzQXK2xQ.mjs → contract-emit-BJDLPMxp-qaGmQUQr.mjs} +6 -6
  50. package/dist/{contract-emit-Ci-8sP-b-QzQXK2xQ.mjs.map → contract-emit-BJDLPMxp-qaGmQUQr.mjs.map} +1 -1
  51. package/dist/{contract-emit-Bdf4DAR4-lKqkbfZT.mjs → contract-emit-WIAaN0lC-DKOdtrUQ.mjs} +5 -5
  52. package/dist/{contract-emit-Bdf4DAR4-lKqkbfZT.mjs.map → contract-emit-WIAaN0lC-DKOdtrUQ.mjs.map} +1 -1
  53. package/dist/{contract-infer-hhyMJiwS-BJ5cYC9P.mjs → contract-infer-B929dnCJ-KkT9frLY.mjs} +5 -5
  54. package/dist/{contract-infer-hhyMJiwS-BJ5cYC9P.mjs.map → contract-infer-B929dnCJ-KkT9frLY.mjs.map} +1 -1
  55. package/dist/{contract-snapshot-resolution-CyvX0DPz-BBQI_70j.mjs → contract-snapshot-resolution-D2f9kGs0-BenF4tbi.mjs} +4 -4
  56. package/dist/{contract-snapshot-resolution-CyvX0DPz-BBQI_70j.mjs.map → contract-snapshot-resolution-D2f9kGs0-BenF4tbi.mjs.map} +1 -1
  57. package/dist/{contract-space-aggregate-loader-DOzo1sk9-CCPCubsg.mjs → contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs} +4 -4
  58. package/dist/{contract-space-aggregate-loader-DOzo1sk9-CCPCubsg.mjs.map → contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs.map} +1 -1
  59. package/dist/{db-init-3CbSYxRI-BlTkWh8n.mjs → db-init-CU_x-p2M-_6oEFLiG.mjs} +7 -7
  60. package/dist/db-init-CU_x-p2M-_6oEFLiG.mjs.map +1 -0
  61. package/dist/{db-schema-BVLbe3EL-WLnbuo77.mjs → db-schema-BKAn8UrM-DP4k7BAB.mjs} +6 -6
  62. package/dist/{db-schema-BVLbe3EL-WLnbuo77.mjs.map → db-schema-BKAn8UrM-DP4k7BAB.mjs.map} +1 -1
  63. package/dist/{db-sign-Cdw2RmoG-C-X5UheR.mjs → db-sign-BQF-jVXg-D467Bhpj.mjs} +9 -9
  64. package/dist/db-sign-BQF-jVXg-D467Bhpj.mjs.map +1 -0
  65. package/dist/{db-update-BHOdo8PV-BVBNKrJc.mjs → db-update-B0_Q4ykE-CT9vcaMu.mjs} +8 -8
  66. package/dist/db-update-B0_Q4ykE-CT9vcaMu.mjs.map +1 -0
  67. package/dist/{db-verify-C9P9oNCs-gieY7hV2.mjs → db-verify-C0DJc8z6-f3gZeEMD.mjs} +9 -9
  68. package/dist/db-verify-C0DJc8z6-f3gZeEMD.mjs.map +1 -0
  69. package/dist/{format-Ddhz7xFW-Bo1nhay8.mjs → format-SYdHyutg-IqXk-tDV.mjs} +5 -5
  70. package/dist/{format-Ddhz7xFW-Bo1nhay8.mjs.map → format-SYdHyutg-IqXk-tDV.mjs.map} +1 -1
  71. package/dist/{framework-components-Cruf6BPK-CaQvMI3T.mjs → framework-components-CXxMNF8E-C-g2cchI.mjs} +3 -3
  72. package/dist/{framework-components-Cruf6BPK-CaQvMI3T.mjs.map → framework-components-CXxMNF8E-C-g2cchI.mjs.map} +1 -1
  73. package/dist/{init-DjdnLDyf-2nVOeVG9.mjs → init-BvE3r7P6-CjJraEPP.mjs} +5 -5
  74. package/dist/{init-DjdnLDyf-2nVOeVG9.mjs.map → init-BvE3r7P6-CjJraEPP.mjs.map} +1 -1
  75. package/dist/{inspect-live-schema-BEQun_1x-CZpCgg8A.mjs → inspect-live-schema-D8d7aI6a-_Q_4S5wm.mjs} +6 -6
  76. package/dist/inspect-live-schema-D8d7aI6a-_Q_4S5wm.mjs.map +1 -0
  77. package/dist/{invariants-D5TNnX5E-rjPoJGFq.mjs → invariants-TW5CizTS-BsIpi4h4.mjs} +4 -4
  78. package/dist/{invariants-D5TNnX5E-rjPoJGFq.mjs.map → invariants-TW5CizTS-BsIpi4h4.mjs.map} +1 -1
  79. package/dist/{legend-BBtAETiW-BHqTbUjx.mjs → legend-QYDKKevn-DCIlAPn4.mjs} +3 -3
  80. package/dist/{legend-BBtAETiW-BHqTbUjx.mjs.map → legend-QYDKKevn-DCIlAPn4.mjs.map} +1 -1
  81. package/dist/{migrate-show-CUymfnbM-BbpcO2FY.mjs → migrate-show-C-fdCznr-BH88FGVn.mjs} +7 -7
  82. package/dist/migrate-show-C-fdCznr-BH88FGVn.mjs.map +1 -0
  83. package/dist/{migrate-show-g71Z4vJw-ocdTvf70.d.mts → migrate-show-DWIvU6Y_-BQyWhZD1.d.mts} +4 -4
  84. package/dist/{migrate-show-g71Z4vJw-ocdTvf70.d.mts.map → migrate-show-DWIvU6Y_-BQyWhZD1.d.mts.map} +1 -1
  85. package/dist/{migrate-B-hpVTxi-DJzFYT2w.mjs → migrate-vNMZJk7M-DKogRyOh.mjs} +14 -14
  86. package/dist/migrate-vNMZJk7M-DKogRyOh.mjs.map +1 -0
  87. package/dist/{migration-check-DHYPMUFe-Cni_ZUzB.mjs → migration-check-C-2GTAGq-Duc0P6Uo.mjs} +16 -16
  88. package/dist/migration-check-C-2GTAGq-Duc0P6Uo.mjs.map +1 -0
  89. package/dist/{migration-check-zgqYe3SB-B6LI6wY7.mjs → migration-check-DATj3HSn-Del6ZSln.mjs} +26 -21
  90. package/dist/migration-check-DATj3HSn-Del6ZSln.mjs.map +1 -0
  91. package/dist/{migration-command-scaffold-DsT7ke7B-D3u913Po.mjs → migration-command-scaffold-BezR8GWB-BZFB2PC-.mjs} +5 -5
  92. package/dist/{migration-command-scaffold-DsT7ke7B-D3u913Po.mjs.map → migration-command-scaffold-BezR8GWB-BZFB2PC-.mjs.map} +1 -1
  93. package/dist/{migration-graph-Dm9gU0oE-DxPD_SNA.mjs → migration-graph-B1mg_jel-HVG6FLD0.mjs} +20 -62
  94. package/dist/migration-graph-B1mg_jel-HVG6FLD0.mjs.map +1 -0
  95. package/dist/{migration-graph-CChCjts3-ERrIm5aT.mjs → migration-graph-BtP1Va3T-CMOZgqVW.mjs} +3 -3
  96. package/dist/{migration-graph-CChCjts3-ERrIm5aT.mjs.map → migration-graph-BtP1Va3T-CMOZgqVW.mjs.map} +1 -1
  97. package/dist/migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs +67 -0
  98. package/dist/migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs.map +1 -0
  99. package/dist/{migration-list-Bkase_ZM-D-bErpSr.mjs → migration-list-AKRIIovW-Cr39jOaI.mjs} +3 -3
  100. package/dist/{migration-list-Bkase_ZM-D-bErpSr.mjs.map → migration-list-AKRIIovW-Cr39jOaI.mjs.map} +1 -1
  101. package/dist/{migration-list-DDGUTC8Y-B_X7rkez.mjs → migration-list-RSlyGyvD-KKmZtdY1.mjs} +7 -7
  102. package/dist/{migration-list-DDGUTC8Y-B_X7rkez.mjs.map → migration-list-RSlyGyvD-KKmZtdY1.mjs.map} +1 -1
  103. package/dist/migration-log-CBfOcyPC-DTqCL1cs.mjs +123 -0
  104. package/dist/migration-log-CBfOcyPC-DTqCL1cs.mjs.map +1 -0
  105. package/dist/{migration-log-Cft50PRu-DcnHdxT4.mjs → migration-log-table-C0dSMG9T-BhBYrdka.mjs} +4 -120
  106. package/dist/migration-log-table-C0dSMG9T-BhBYrdka.mjs.map +1 -0
  107. package/dist/{migration-new-D9GHbYwF-C8D22HXG.mjs → migration-new-1LYliIXy-BK_Xz0Z6.mjs} +5 -5
  108. package/dist/{migration-new-D9GHbYwF-C8D22HXG.mjs.map → migration-new-1LYliIXy-BK_Xz0Z6.mjs.map} +1 -1
  109. package/dist/{migration-new-RorO1I8r-Ch8NQ4GQ.mjs → migration-new-DcPO4tiw-Bew7S-bj.mjs} +7 -7
  110. package/dist/{migration-new-RorO1I8r-Ch8NQ4GQ.mjs.map → migration-new-DcPO4tiw-Bew7S-bj.mjs.map} +1 -1
  111. package/dist/{migration-path-target-DhGt62Mi-dm4TU1hJ.mjs → migration-path-target-yA4h5Zc6-DlzBblBG.mjs} +7 -7
  112. package/dist/migration-path-target-yA4h5Zc6-DlzBblBG.mjs.map +1 -0
  113. package/dist/{migration-plan-BOhasCLr-GJWYoOA8.mjs → migration-plan-B0z2Qpa5-6b1SJSsb.mjs} +5 -5
  114. package/dist/{migration-plan-BOhasCLr-GJWYoOA8.mjs.map → migration-plan-B0z2Qpa5-6b1SJSsb.mjs.map} +1 -1
  115. package/dist/{migration-plan-DrCTzrXH-CDJbdiC6.mjs → migration-plan-Cb7s5Ifx-Bwa2O0Ov.mjs} +8 -8
  116. package/dist/{migration-plan-DrCTzrXH-CDJbdiC6.mjs.map → migration-plan-Cb7s5Ifx-Bwa2O0Ov.mjs.map} +1 -1
  117. package/dist/{migration-plan-t2e_8yD2-w5Ffa0V_.d.mts → migration-plan-s94qwFHi-86F_Aklp.d.mts} +4 -4
  118. package/dist/{migration-plan-t2e_8yD2-w5Ffa0V_.d.mts.map → migration-plan-s94qwFHi-86F_Aklp.d.mts.map} +1 -1
  119. package/dist/{migration-show-DRARjIbv-1p6EE_Uw.mjs → migration-show-BRy1GVBE-NuwoczhZ.mjs} +13 -22
  120. package/dist/migration-show-BRy1GVBE-NuwoczhZ.mjs.map +1 -0
  121. package/dist/{migration-status-Yh0eOQJN-YpcPDpNh.mjs → migration-status-Dob4onB1-0YkQF25g.mjs} +12 -12
  122. package/dist/migration-status-Dob4onB1-0YkQF25g.mjs.map +1 -0
  123. package/dist/{project-import-root--e8xli8Z-Bfrvrv67.mjs → project-import-root-Bkz1gPB2-jhrMFebo.mjs} +3 -3
  124. package/dist/{project-import-root--e8xli8Z-Bfrvrv67.mjs.map → project-import-root-Bkz1gPB2-jhrMFebo.mjs.map} +1 -1
  125. package/dist/{ref-Cu7Zc1Hv-_R4MnDfr.mjs → ref-B643Z0CS-CoJgdv7h.mjs} +5 -5
  126. package/dist/{ref-Cu7Zc1Hv-_R4MnDfr.mjs.map → ref-B643Z0CS-CoJgdv7h.mjs.map} +1 -1
  127. package/dist/{ref-BQcl8Ksv-BYZY0Ktb.mjs → ref-D9J4TNYz-Dk7HCAoq.mjs} +5 -5
  128. package/dist/{ref-BQcl8Ksv-BYZY0Ktb.mjs.map → ref-D9J4TNYz-Dk7HCAoq.mjs.map} +1 -1
  129. package/dist/{ref-resolution-BYCRg72z-DFhwf-XR.mjs → ref-resolution-Bi4lpxM8-BX-7sl0f.mjs} +3 -3
  130. package/dist/{ref-resolution-BYCRg72z-DFhwf-XR.mjs.map → ref-resolution-Bi4lpxM8-BX-7sl0f.mjs.map} +1 -1
  131. package/dist/{schemas-KhXMzNA_-CzZ7GFX_.mjs → schemas-BMkqaqvM-CLaqlat4.mjs} +9 -3
  132. package/dist/{schemas-KhXMzNA_-CzZ7GFX_.mjs.map → schemas-BMkqaqvM-CLaqlat4.mjs.map} +1 -1
  133. package/dist/{schemas-CeGMYFYX-h3OcU__O.d.mts → schemas-Bm2e3Hk1-qLKF0B36.d.mts} +16 -4
  134. package/dist/{schemas-CeGMYFYX-h3OcU__O.d.mts.map → schemas-Bm2e3Hk1-qLKF0B36.d.mts.map} +1 -1
  135. package/dist/{telemetry-Dh6e0ams-BsjGN3tQ.mjs → telemetry-DFEbk6sD-BYEW2bCJ.mjs} +4 -4
  136. package/dist/{telemetry-Dh6e0ams-BsjGN3tQ.mjs.map → telemetry-DFEbk6sD-BYEW2bCJ.mjs.map} +1 -1
  137. package/dist/{terminal-ui-ypPE9cN6-ilMBkmwT.mjs → terminal-ui-DQNCDg2u-B3PFqjB8.mjs} +10 -3
  138. package/dist/terminal-ui-DQNCDg2u-B3PFqjB8.mjs.map +1 -0
  139. package/dist/{verify-DBsKxZrK-eDPxNiSS.mjs → verify-TphNCyMu-h8vrnbud.mjs} +3 -3
  140. package/dist/{verify-DBsKxZrK-eDPxNiSS.mjs.map → verify-TphNCyMu-h8vrnbud.mjs.map} +1 -1
  141. package/dist/vite-plugin-contract-emit.mjs +1 -1
  142. package/package.json +12 -12
  143. package/dist/cli-errors-C7vbvQuK-DLpSxz4U.d.mts.map +0 -1
  144. package/dist/cli-errors-kU09RUaz-CUkQ9XuM.mjs.map +0 -1
  145. package/dist/contract-emit-E6m8HE42-Bfiodzf_.mjs +0 -2
  146. package/dist/db-init-3CbSYxRI-BlTkWh8n.mjs.map +0 -1
  147. package/dist/db-sign-Cdw2RmoG-C-X5UheR.mjs.map +0 -1
  148. package/dist/db-update-BHOdo8PV-BVBNKrJc.mjs.map +0 -1
  149. package/dist/db-verify-C9P9oNCs-gieY7hV2.mjs.map +0 -1
  150. package/dist/inspect-live-schema-BEQun_1x-CZpCgg8A.mjs.map +0 -1
  151. package/dist/migrate-B-hpVTxi-DJzFYT2w.mjs.map +0 -1
  152. package/dist/migrate-show-CUymfnbM-BbpcO2FY.mjs.map +0 -1
  153. package/dist/migration-check-DHYPMUFe-Cni_ZUzB.mjs.map +0 -1
  154. package/dist/migration-check-zgqYe3SB-B6LI6wY7.mjs.map +0 -1
  155. package/dist/migration-graph-Dm9gU0oE-DxPD_SNA.mjs.map +0 -1
  156. package/dist/migration-log-Cft50PRu-DcnHdxT4.mjs.map +0 -1
  157. package/dist/migration-path-target-DhGt62Mi-dm4TU1hJ.mjs.map +0 -1
  158. package/dist/migration-show-DRARjIbv-1p6EE_Uw.mjs.map +0 -1
  159. package/dist/migration-status-Yh0eOQJN-YpcPDpNh.mjs.map +0 -1
  160. package/dist/terminal-ui-ypPE9cN6-ilMBkmwT.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,24 +1,37 @@
1
1
  import { i as loadConfig } from "./exports-BZLNbtkY.mjs";
2
+ import { F as requireLiveDatabase, N as errorUnexpected, a as errorConfigValidation$1, b as errorNoMigrations, d as errorFileNotFound, h as errorLegendHumanOnly, j as errorTargetMigrationNotSupported, s as errorContractValidationFailed, v as errorMigrationPackageNotFound } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
2
3
  import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-05kuwcb0.mjs";
3
- import { t as createContractEmitCommand } from "./contract-emit-Ci-8sP-b-QzQXK2xQ.mjs";
4
- import { t as createFormatCommand } from "./format-Ddhz7xFW-Bo1nhay8.mjs";
5
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-DOzo1sk9-CCPCubsg.mjs";
6
- import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-Bkase_ZM-D-bErpSr.mjs";
4
+ import { p as renderMigrationShowLines } from "./terminal-ui-DQNCDg2u-B3PFqjB8.mjs";
5
+ import { c as spaceMigrationDirectory } from "./verify-contract-spaces-WvjSiWcB-DZPPCwWO.mjs";
6
+ import { S as targetSupportsMigrations, f as maskConnectionUrl, n as closeQuietly } from "./command-helpers-DutQjYgy-CDfFwtAa.mjs";
7
+ import { t as createContractEmitCommand } from "./contract-emit-BJDLPMxp-qaGmQUQr.mjs";
8
+ import { t as createFormatCommand } from "./format-SYdHyutg-IqXk-tDV.mjs";
9
+ import { a as loadContractSpaceAggregateForCli, r as buildReadAggregate } from "./contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs";
10
+ import { t as createControlClient } from "./client-CaIWFVnh-PVaTEvdx.mjs";
11
+ import { t as mapCaughtMigrationError } from "./caught-errors-B_oGFiYw-BqX49eW0.mjs";
12
+ import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-AKRIIovW-Cr39jOaI.mjs";
13
+ import { n as resolveMigrationRef } from "./ref-resolution-Bi4lpxM8-BX-7sl0f.mjs";
7
14
  import { g as renderMigrationGraphLegend, l as createAnsiMigrationListStyler, v as renderMigrationListWithStyle } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
15
+ import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-yA4h5Zc6-DlzBblBG.mjs";
16
+ import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-BtP1Va3T-CMOZgqVW.mjs";
17
+ import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs";
18
+ import { n as renderMigrationLogTable, r as serializeLedgerEntriesForJson, t as MIGRATION_LOG_EMPTY_MESSAGE } from "./migration-log-table-C0dSMG9T-BhBYrdka.mjs";
8
19
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
9
20
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
10
- import { join, normalize, resolve } from "pathe";
21
+ import { join, normalize, relative, resolve } from "pathe";
11
22
  import { existsSync, unlinkSync, writeFileSync } from "node:fs";
12
23
  import { DOCS_BASE, isStructuredError } from "@prisma/orm-framework/utils/structured-error";
13
- import { blindCast } from "@prisma/orm-framework/utils/casts";
24
+ import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
14
25
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
26
+ import { readFile } from "node:fs/promises";
27
+ import { APP_SPACE_ID, createControlStack } from "@prisma/orm-framework/components/control";
15
28
  import { collectConfigIssues } from "@prisma/orm-framework/config/config-validation";
16
29
  import { tmpdir } from "node:os";
17
- import { defineCommand, defineCommandFamily, defineConfigSection, flag } from "@prisma/cli-engine";
30
+ import { defineCommand, defineCommandFamily, defineConfigSection, flag, positional } from "@prisma/cli-engine";
18
31
  import { CliStructuredError as CliStructuredError$1, notOk, ok } from "@prisma/cli-engine/protocol";
19
32
  import { pathToFileURL } from "node:url";
20
33
  import { build } from "esbuild";
21
- //#region ../../../1-framework/3-tooling/cli/dist/load-config-Aw9VS_dF.mjs
34
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-Bj0g_Kv6.mjs
22
35
  const MISSING_CONFIG_ACTION = {
23
36
  kind: "run-command",
24
37
  label: "Create a configuration file",
@@ -165,11 +178,14 @@ function toUnexpected(error) {
165
178
  }
166
179
  /**
167
180
  * Both classes name themselves `CliStructuredError`, so the engine's duck test
168
- * accepts prisma/prisma's too. What actually separates them is `nextActions`:
169
- * the engine's constructor always sets it, prisma/prisma's never does.
181
+ * accepts prisma/prisma's too, and a CLI factory carrying typed actions looks
182
+ * conformant without being one its `toEnvelope` still writes `fix` and no
183
+ * `nextActions`. Only an error the engine itself built is already in protocol
184
+ * shape, and `@prisma/cli-engine` is an exact-pinned, unbundled dependency, so
185
+ * there is one module instance and identity holds.
170
186
  */
171
187
  function conformsToProtocol(error) {
172
- return CliStructuredError$1.is(error) && Array.isArray(error.nextActions);
188
+ return error instanceof CliStructuredError$1;
173
189
  }
174
190
  /**
175
191
  * Turns the transitional `fix` prose into typed actions. A multi-line fix is
@@ -191,7 +207,7 @@ function toEngineDiagnostic(error) {
191
207
  severity: error.severity ?? "error",
192
208
  summary: error.message,
193
209
  ...ifDefined("why", error.why),
194
- nextActions: actionsFromFix(error.fix),
210
+ nextActions: error.nextActions ?? actionsFromFix(error.fix),
195
211
  ...ifDefined("where", error.where),
196
212
  ...ifDefined("meta", error.meta),
197
213
  ...ifDefined("docsUrl", error.docsUrl)
@@ -246,6 +262,121 @@ function defineOrmCommand(def) {
246
262
  function migrationsDirFor(config, cwd) {
247
263
  return resolve(cwd, config.migrations?.dir ?? "migrations");
248
264
  }
265
+ /** The app subspace under {@link migrationsDirFor}. */
266
+ function appMigrationsDirFor(config, cwd) {
267
+ return spaceMigrationDirectory(migrationsDirFor(config, cwd), APP_SPACE_ID);
268
+ }
269
+ /**
270
+ * The emitted contract. The config loader has already resolved
271
+ * `contract.output` against the config file's directory, so this only has an
272
+ * effect for a config handed in raw, as tests do.
273
+ */
274
+ function contractPathFor(config, cwd) {
275
+ const output = config.contract?.output;
276
+ return output === void 0 ? void 0 : resolve(cwd, output);
277
+ }
278
+ /**
279
+ * The header's rendering of a path: relative to where the user invoked the
280
+ * CLI, as the commander shell rendered it against the config file.
281
+ */
282
+ function displayPath(path, cwd) {
283
+ return relative(cwd, path);
284
+ }
285
+ function graphPresentations(inputs) {
286
+ return {
287
+ human: () => [{
288
+ kind: "fields",
289
+ rows: [{
290
+ label: "migrations",
291
+ value: inputs.migrationsDir
292
+ }, ...inputs.space === void 0 ? [] : [{
293
+ label: "space",
294
+ value: inputs.space
295
+ }]]
296
+ }, ...inputs.legendLines.length === 0 ? [] : [{
297
+ kind: "list",
298
+ items: [...inputs.legendLines]
299
+ }]],
300
+ stdout: () => inputs.lines,
301
+ json: () => inputs.document
302
+ };
303
+ }
304
+ function graphSummary(spaces) {
305
+ const contracts = spaces.reduce((count, space) => count + space.contracts.length, 0);
306
+ const migrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
307
+ return `${spaces.length} space(s), ${contracts} contract(s), ${migrations} migration(s)`;
308
+ }
309
+ const migrationGraphCommand = defineOrmCommand({
310
+ help: {
311
+ summary: "Show the migration graph topology",
312
+ description: "Renders the migration graph topology. Offline — does not consult the\ndatabase. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\n--dot emits Graphviz DOT for the app graph instead of the tree, and\nignores --space; in json mode the result carries the DOT text alongside\nthe graph document.",
313
+ examples: [
314
+ "migration graph",
315
+ "migration graph --json",
316
+ "migration graph --dot",
317
+ "migration graph --ascii",
318
+ "migration graph --legend",
319
+ "migration graph --space app"
320
+ ]
321
+ },
322
+ args: { flags: {
323
+ space: flag.string({
324
+ brief: "Narrow output to a single contract space",
325
+ placeholder: "id"
326
+ }),
327
+ dot: flag.boolean({ brief: "Emit Graphviz DOT for the app graph" }),
328
+ ascii: flag.boolean({ brief: "Use ASCII glyphs (pipe-friendly)" }),
329
+ legend: flag.boolean({ brief: "Print a key for the tree glyphs and lane colors" })
330
+ } },
331
+ needs: { config: ormConfigSection },
332
+ handler: async (args, ctx) => {
333
+ if (args.flags.legend && args.flags.dot) return notOk(normalizeError(errorLegendHumanOnly("--dot")));
334
+ const migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);
335
+ const loaded = await buildReadAggregate(ctx.config, { migrationsDir });
336
+ if (!loaded.ok) return notOk(normalizeError(loaded.failure));
337
+ const { aggregate, contractHash: liveContractHash } = loaded.value;
338
+ const listed = runMigrationList({
339
+ spaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),
340
+ ...ifDefined("spaceFilter", args.flags.space)
341
+ });
342
+ if (!listed.ok) return notOk(normalizeError(listed.failure));
343
+ const scopedSpaces = listed.value.spaces;
344
+ const glyphMode = args.flags.ascii ? "ascii" : "unicode";
345
+ const graphSpaces = [...buildMigrationSpaceGraphEntries({
346
+ aggregate,
347
+ scopedSpaces
348
+ })];
349
+ const summary = graphSummary(graphSpaces);
350
+ const graphDocument = {
351
+ ok: true,
352
+ spaces: graphSpaces,
353
+ summary
354
+ };
355
+ const dot = args.flags.dot ? renderMigrationGraphDot(aggregate.app.graph()) : void 0;
356
+ const document = dot === void 0 ? graphDocument : {
357
+ ...graphDocument,
358
+ dot
359
+ };
360
+ const lines = dot === void 0 ? renderMigrationGraphSections(buildMigrationGraphTreeSections({
361
+ aggregate,
362
+ scopedSpaces,
363
+ liveContractHash,
364
+ glyphMode,
365
+ colorize: false
366
+ }), summary).split("\n") : dot.split("\n");
367
+ const legendLines = args.flags.legend ? renderMigrationGraphLegend({
368
+ colorize: false,
369
+ glyphMode
370
+ }).split("\n") : [];
371
+ return ok(ctx.present({ data: document }, graphPresentations({
372
+ document,
373
+ lines,
374
+ migrationsDir: displayPath(migrationsDir, ctx.cwd),
375
+ space: args.flags.space,
376
+ legendLines
377
+ })));
378
+ }
379
+ });
249
380
  function listPresentations(inputs) {
250
381
  return {
251
382
  human: () => [{
@@ -310,13 +441,246 @@ const migrationListCommand = defineOrmCommand({
310
441
  return ok(ctx.present({ data: listed.value }, listPresentations({
311
442
  list: listed.value,
312
443
  lines,
313
- migrationsDir,
444
+ migrationsDir: displayPath(migrationsDir, ctx.cwd),
314
445
  space: args.flags.space,
315
446
  legendLines
316
447
  })));
317
448
  }
318
449
  });
319
450
  /**
451
+ * The database connection override, declared from here by every command that
452
+ * accepts one so its brief and placeholder cannot drift apart. Resolution
453
+ * order is the flag, then `config.db.connection`, then
454
+ * `CONFIG.DB_CONNECTION_REQUIRED`.
455
+ */
456
+ const dbFlag = flag.string({
457
+ brief: "Database connection string",
458
+ placeholder: "url"
459
+ });
460
+ function logPresentations(inputs) {
461
+ return {
462
+ human: () => inputs.database === void 0 ? [] : [{
463
+ kind: "fields",
464
+ rows: [{
465
+ label: "database",
466
+ value: inputs.database
467
+ }]
468
+ }],
469
+ stdout: () => inputs.lines,
470
+ json: () => inputs.document
471
+ };
472
+ }
473
+ function logLines(entries, options) {
474
+ if (entries.length === 0) return [MIGRATION_LOG_EMPTY_MESSAGE];
475
+ return renderMigrationLogTable(entries, {
476
+ utc: options.utc,
477
+ styler: createAnsiMigrationListStyler({ useColor: false }),
478
+ glyphMode: options.glyphMode
479
+ }).split("\n");
480
+ }
481
+ const migrationLogCommand = defineOrmCommand({
482
+ help: {
483
+ summary: "Show executed migration history",
484
+ description: "Reads the database ledger and displays every applied migration edge in\nchronological order, including rollbacks and re-applies, merged across\nall contract spaces. Requires a database connection.",
485
+ examples: [
486
+ "migration log",
487
+ "migration log --db $DATABASE_URL",
488
+ "migration log --utc",
489
+ "migration log --json"
490
+ ]
491
+ },
492
+ args: { flags: {
493
+ db: dbFlag,
494
+ utc: flag.boolean({ brief: "Render human timestamps in UTC instead of local time" }),
495
+ ascii: flag.boolean({ brief: "Use ASCII glyphs (pipe-friendly)" })
496
+ } },
497
+ needs: { config: ormConfigSection },
498
+ handler: async (args, ctx) => {
499
+ const dbConnection = args.flags.db ?? ctx.config.db?.connection;
500
+ const missingDb = requireLiveDatabase({
501
+ dbConnection,
502
+ hasDriver: ctx.config.driver !== void 0,
503
+ why: "migration log needs a database connection and driver to read the ledger (set db.connection in prisma-next.config.ts, or pass --db <url>)",
504
+ commandName: "migration log"
505
+ });
506
+ if (missingDb !== null) return notOk(normalizeError(missingDb));
507
+ if (!targetSupportsMigrations(ctx.config.target)) return notOk(normalizeError(errorTargetMigrationNotSupported({ why: "migration log reads the ledger a migration runner writes, and the configured target provides no runner." })));
508
+ const client = createControlClient({
509
+ family: ctx.config.family,
510
+ target: ctx.config.target,
511
+ adapter: ctx.config.adapter,
512
+ ...ifDefined("driver", ctx.config.driver),
513
+ extensions: ctx.config.extensions ?? []
514
+ });
515
+ let entries;
516
+ try {
517
+ await client.connect(dbConnection);
518
+ entries = await client.readLedger();
519
+ } catch (error) {
520
+ return notOk(normalizeError(mapCaughtMigrationError(error) ?? errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` })));
521
+ } finally {
522
+ await closeQuietly(client);
523
+ }
524
+ const records = serializeLedgerEntriesForJson(entries);
525
+ const document = {
526
+ ok: true,
527
+ records,
528
+ summary: `${records.length} migration(s) applied`
529
+ };
530
+ const glyphMode = args.flags.ascii ? "ascii" : "unicode";
531
+ return ok(ctx.present({ data: document }, logPresentations({
532
+ document,
533
+ lines: logLines(entries, {
534
+ utc: args.flags.utc,
535
+ glyphMode
536
+ }),
537
+ database: typeof dbConnection === "string" ? maskConnectionUrl(dbConnection) : void 0
538
+ })));
539
+ }
540
+ });
541
+ function showPresentations(inputs) {
542
+ return {
543
+ human: () => [{
544
+ kind: "fields",
545
+ rows: [
546
+ {
547
+ label: "contract",
548
+ value: inputs.contractPath
549
+ },
550
+ {
551
+ label: "migrations",
552
+ value: inputs.appMigrationsRelative
553
+ },
554
+ {
555
+ label: "target",
556
+ value: inputs.target
557
+ }
558
+ ]
559
+ }],
560
+ stdout: () => renderMigrationShowLines(inputs.document.migration, { colorize: false }),
561
+ json: () => inputs.document
562
+ };
563
+ }
564
+ /**
565
+ * A path-looking target must land inside `migrations/app/`; anything else is a
566
+ * migration reference resolved against the app graph and refs. Both routes are
567
+ * app-space only, as they are today.
568
+ */
569
+ function resolvePackage(inputs) {
570
+ if (looksLikePath(inputs.target)) {
571
+ const path = resolveAppTargetPath(inputs.cwd, inputs.target, inputs.appMigrationsDir, inputs.appMigrationsRelative);
572
+ if (!path.ok) return notOk(normalizeError(path.failure));
573
+ const matched = findPackageByDirPath(inputs.packages, path.value);
574
+ return matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`No loaded migration package at ${relative(inputs.cwd, path.value)}`))) : ok(matched);
575
+ }
576
+ if (inputs.packages.length === 0) return notOk(normalizeError(errorNoMigrations(inputs.appMigrationsRelative)));
577
+ const ref = resolveMigrationRef(inputs.target, {
578
+ graph: inputs.graph,
579
+ refs: inputs.refs
580
+ });
581
+ if (!ref.ok) return notOk(normalizeError(ref.failure));
582
+ const matched = inputs.packages.find((candidate) => candidate.metadata.migrationHash === ref.value.migrationHash);
583
+ return matched === void 0 ? notOk(normalizeError(errorMigrationPackageNotFound(`Resolved migration "${ref.value.dirName}" but the package was not loaded`))) : ok(matched);
584
+ }
585
+ const migrationShowCommand = defineOrmCommand({
586
+ help: {
587
+ summary: "Display migration package contents",
588
+ description: "Shows the operations, statement preview, and metadata for one app-space\nmigration. Accepts a directory path, directory name, or hash prefix.\nOffline — does not consult the database.",
589
+ examples: [
590
+ "migration show 20260101_100000_add_user",
591
+ "migration show a1b2c3",
592
+ "migration show migrations/app/20260101_100000_add_user",
593
+ "migration show 20260101_100000_add_user --json"
594
+ ]
595
+ },
596
+ args: { positionals: { target: positional.string({
597
+ brief: "Migration reference: directory name, hash/prefix, ref, or path",
598
+ placeholder: "target"
599
+ }) } },
600
+ needs: { config: ormConfigSection },
601
+ handler: async (args, ctx) => {
602
+ const { target } = args.positionals;
603
+ const contractPath = contractPathFor(ctx.config, ctx.cwd);
604
+ if (contractPath === void 0) return notOk(normalizeError(errorConfigValidation$1("contract.output", {
605
+ why: "migration show reads the emitted contract from config.contract.output; the config has no value to read.",
606
+ section: "contract"
607
+ })));
608
+ const migrationsDir = migrationsDirFor(ctx.config, ctx.cwd);
609
+ const appMigrationsDir = appMigrationsDirFor(ctx.config, ctx.cwd);
610
+ const appMigrationsRelative = displayPath(appMigrationsDir, ctx.cwd);
611
+ let contractJson;
612
+ try {
613
+ contractJson = await readFile(contractPath, "utf-8");
614
+ } catch (error) {
615
+ return notOk(normalizeError(Reflect.get(Object(error), "code") === "ENOENT" ? errorFileNotFound(contractPath, {
616
+ why: `Contract file not found at ${contractPath}`,
617
+ fix: `Run \`prisma-next contract emit\` to generate ${relative(ctx.cwd, contractPath)}`
618
+ }) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: "Failed to read contract file" })));
619
+ }
620
+ const familyInstance = ctx.config.family.create(createControlStack(ctx.config));
621
+ let appContract;
622
+ try {
623
+ appContract = familyInstance.deserializeContract(castAs(JSON.parse(contractJson)));
624
+ } catch (error) {
625
+ return notOk(normalizeError(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPath } })));
626
+ }
627
+ const loaded = await loadContractSpaceAggregateForCli({
628
+ targetId: ctx.config.target.targetId,
629
+ migrationsDir,
630
+ appContract,
631
+ extensions: [],
632
+ deserializeContract: (json) => familyInstance.deserializeContract(json)
633
+ });
634
+ if (!loaded.ok) return notOk(normalizeError(loaded.failure));
635
+ const aggregate = loaded.value;
636
+ const resolved = resolvePackage({
637
+ target,
638
+ cwd: ctx.cwd,
639
+ appMigrationsDir,
640
+ appMigrationsRelative,
641
+ packages: aggregate.app.packages,
642
+ graph: aggregate.app.graph(),
643
+ refs: aggregate.app.refs
644
+ });
645
+ if (!resolved.ok) return notOk(resolved.failure);
646
+ const pkg = resolved.value;
647
+ const client = createControlClient({
648
+ family: ctx.config.family,
649
+ target: ctx.config.target,
650
+ adapter: ctx.config.adapter,
651
+ ...ifDefined("driver", ctx.config.driver),
652
+ extensions: ctx.config.extensions ?? []
653
+ });
654
+ const ops = castAs(pkg.ops);
655
+ const preview = client.toOperationPreview(ops) ?? { statements: [] };
656
+ const migration = {
657
+ space: APP_SPACE_ID,
658
+ name: pkg.dirName,
659
+ hash: pkg.metadata.migrationHash,
660
+ fromContract: pkg.metadata.from,
661
+ toContract: pkg.metadata.to,
662
+ createdAt: pkg.metadata.createdAt,
663
+ operations: ops.map((op) => ({
664
+ id: op.id,
665
+ label: op.label,
666
+ operationClass: op.operationClass
667
+ })),
668
+ preview: { statements: [...preview.statements] }
669
+ };
670
+ const document = {
671
+ ok: true,
672
+ summary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,
673
+ migration
674
+ };
675
+ return ok(ctx.present({ data: document }, showPresentations({
676
+ document,
677
+ contractPath: displayPath(contractPath, ctx.cwd),
678
+ appMigrationsRelative,
679
+ target
680
+ })));
681
+ }
682
+ });
683
+ /**
320
684
  * The engine derives each diagnostic's docs link from this base plus the
321
685
  * dotted code.
322
686
  */
@@ -328,7 +692,12 @@ const DOCS_BASE_URL = `${DOCS_BASE}/`;
328
692
  */
329
693
  const ormCommandFamily = defineCommandFamily({
330
694
  configSection: ormConfigSection,
331
- commands: { "migration list": migrationListCommand },
695
+ commands: {
696
+ "migration graph": migrationGraphCommand,
697
+ "migration list": migrationListCommand,
698
+ "migration log": migrationLogCommand,
699
+ "migration show": migrationShowCommand
700
+ },
332
701
  docsBaseUrl: DOCS_BASE_URL
333
702
  });
334
703
  /**