@prisma/orm-toolchain 8.0.0-rc.1-dev.38 → 8.0.0-rc.1-dev.40

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 (171) hide show
  1. package/dist/bin__prisma-next.mjs +25 -318
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/{caught-errors-DLPzfzIW-CQ9BoXD-.mjs → caught-errors-BZo7zcRc-C-pIEasG.mjs} +3 -3
  4. package/dist/{caught-errors-DLPzfzIW-CQ9BoXD-.mjs.map → caught-errors-BZo7zcRc-C-pIEasG.mjs.map} +1 -1
  5. package/dist/{cli-errors-BG6bItjG-DwdKIeGz.mjs → cli-errors-B4zTLaqQ-CXgjO9t4.mjs} +20 -3
  6. package/dist/cli-errors-B4zTLaqQ-CXgjO9t4.mjs.map +1 -0
  7. package/dist/{cli-errors-BiKBrOXc-JPxQqO58.d.mts → cli-errors-iquUoY6O-BFboxglv.d.mts} +17 -9
  8. package/dist/cli-errors-iquUoY6O-BFboxglv.d.mts.map +1 -0
  9. package/dist/cli.mjs +2895 -182
  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 +2 -2
  23. package/dist/cli__commands__migration-graph.mjs +1 -1
  24. package/dist/cli__commands__migration-list.d.mts +2 -2
  25. package/dist/cli__commands__migration-list.mjs +1 -1
  26. package/dist/cli__commands__migration-log.d.mts +2 -2
  27. package/dist/cli__commands__migration-log.mjs +1 -1
  28. package/dist/cli__commands__migration-new.mjs +1 -1
  29. package/dist/cli__commands__migration-plan.d.mts +1 -1
  30. package/dist/cli__commands__migration-plan.mjs +1 -1
  31. package/dist/cli__commands__migration-show.d.mts +1 -1
  32. package/dist/cli__commands__migration-show.mjs +1 -1
  33. package/dist/cli__commands__migration-status.d.mts +2 -2
  34. package/dist/cli__commands__migration-status.mjs +2 -2
  35. package/dist/cli__commands__ref.mjs +1 -1
  36. package/dist/cli__commands__telemetry.mjs +1 -1
  37. package/dist/cli__control-api.d.mts +4 -4
  38. package/dist/cli__control-api.mjs +15 -15
  39. package/dist/cli__control-api__testing.d.mts +1 -1
  40. package/dist/cli__control-api__testing.mjs +2 -1
  41. package/dist/cli__control-api__testing.mjs.map +1 -1
  42. package/dist/cli__init-output.d.mts +1 -1
  43. package/dist/cli__init-output.mjs +1 -1
  44. package/dist/{client-DU9qtBxW-BjVHiKzE.mjs → client-C6Qp5ujC-Dxb7r79B.mjs} +12 -15
  45. package/dist/client-C6Qp5ujC-Dxb7r79B.mjs.map +1 -0
  46. package/dist/code-templates-D73q329L-CSx0Jg-6.mjs +295 -0
  47. package/dist/code-templates-D73q329L-CSx0Jg-6.mjs.map +1 -0
  48. package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs +65 -0
  49. package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs.map +1 -0
  50. package/dist/{command-helpers-CwLvFwMB-BWwUQhlT.mjs → command-helpers-BCgwcqTe-lNCtppzM.mjs} +3 -3
  51. package/dist/{command-helpers-CwLvFwMB-BWwUQhlT.mjs.map → command-helpers-BCgwcqTe-lNCtppzM.mjs.map} +1 -1
  52. package/dist/{contract-at-errors-Dptf8RE_-B5gr04Sc.mjs → contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs} +3 -3
  53. package/dist/{contract-at-errors-Dptf8RE_-B5gr04Sc.mjs.map → contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs.map} +1 -1
  54. package/dist/contract-emit-DDWBBvF1-BeGZCRrb.mjs +2 -0
  55. package/dist/{contract-emit-CZQZ1i4z-p9LSGmmQ.mjs → contract-emit-DFScp9D6-6H-UJMFv.mjs} +5 -5
  56. package/dist/{contract-emit-CZQZ1i4z-p9LSGmmQ.mjs.map → contract-emit-DFScp9D6-6H-UJMFv.mjs.map} +1 -1
  57. package/dist/{contract-emit-BQFpcb2A-BwT9iVdb.mjs → contract-emit-DsvAx-dY-DQzoDO34.mjs} +5 -5
  58. package/dist/{contract-emit-BQFpcb2A-BwT9iVdb.mjs.map → contract-emit-DsvAx-dY-DQzoDO34.mjs.map} +1 -1
  59. package/dist/{contract-infer-C6cYOihE-CIUCgmw0.mjs → contract-infer-BwIDGl7v-CZrdWXAr.mjs} +4 -4
  60. package/dist/{contract-infer-C6cYOihE-CIUCgmw0.mjs.map → contract-infer-BwIDGl7v-CZrdWXAr.mjs.map} +1 -1
  61. package/dist/{contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs → contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs} +4 -4
  62. package/dist/{contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs.map → contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs.map} +1 -1
  63. package/dist/{contract-space-aggregate-loader-CoLTf3Ce-pQDru2w0.mjs → contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs} +4 -4
  64. package/dist/{contract-space-aggregate-loader-CoLTf3Ce-pQDru2w0.mjs.map → contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs.map} +1 -1
  65. package/dist/{db-init-DypCy1e3-CBrYfhHF.mjs → db-init-BolXrKAI-CwG-zEDW.mjs} +6 -6
  66. package/dist/{db-init-DypCy1e3-CBrYfhHF.mjs.map → db-init-BolXrKAI-CwG-zEDW.mjs.map} +1 -1
  67. package/dist/{db-init-failure-BmCcHUfc-BqDxyrJE.mjs → db-init-failure-B5cQML4A-5zr-99Ek.mjs} +3 -3
  68. package/dist/{db-init-failure-BmCcHUfc-BqDxyrJE.mjs.map → db-init-failure-B5cQML4A-5zr-99Ek.mjs.map} +1 -1
  69. package/dist/{db-schema-DHfPM-5V-JeCjrQ55.mjs → db-schema-DvdLBdEY-Dl6e1d_Y.mjs} +4 -4
  70. package/dist/{db-schema-DHfPM-5V-JeCjrQ55.mjs.map → db-schema-DvdLBdEY-Dl6e1d_Y.mjs.map} +1 -1
  71. package/dist/{db-sign-DbAxRcZh-C-nT9kcG.mjs → db-sign-DCp4c8CA-B3tun-kh.mjs} +6 -6
  72. package/dist/{db-sign-DbAxRcZh-C-nT9kcG.mjs.map → db-sign-DCp4c8CA-B3tun-kh.mjs.map} +1 -1
  73. package/dist/{db-update-J59yROwL-DCP-_z2W.mjs → db-update-CfayE8WE-CPhQyDaZ.mjs} +6 -6
  74. package/dist/{db-update-J59yROwL-DCP-_z2W.mjs.map → db-update-CfayE8WE-CPhQyDaZ.mjs.map} +1 -1
  75. package/dist/{db-verify-0TpDMziA-CJDKutMN.mjs → db-verify-BN7IrOAL-kEzRNJUl.mjs} +7 -65
  76. package/dist/db-verify-BN7IrOAL-kEzRNJUl.mjs.map +1 -0
  77. package/dist/{exports-DaxzMVtq.mjs → exports-B3xY_FHp.mjs} +304 -18
  78. package/dist/exports-B3xY_FHp.mjs.map +1 -0
  79. package/dist/{format-cbJY7l6v-CjMUDTAs.mjs → format-Ca7dUE6B-BMFqrc6D.mjs} +5 -5
  80. package/dist/{format-cbJY7l6v-CjMUDTAs.mjs.map → format-Ca7dUE6B-BMFqrc6D.mjs.map} +1 -1
  81. package/dist/{framework-components-C3K7SBeC-Bj5gx85-.mjs → framework-components-Bau7o1-J-DTp6AUoq.mjs} +3 -3
  82. package/dist/{framework-components-C3K7SBeC-Bj5gx85-.mjs.map → framework-components-Bau7o1-J-DTp6AUoq.mjs.map} +1 -1
  83. package/dist/init-DJrxDasP-DoQftaPY.mjs +800 -0
  84. package/dist/init-DJrxDasP-DoQftaPY.mjs.map +1 -0
  85. package/dist/{inspect-live-schema-Cf77j9Vd-i5fzNW4T.mjs → inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs} +5 -5
  86. package/dist/{inspect-live-schema-Cf77j9Vd-i5fzNW4T.mjs.map → inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs.map} +1 -1
  87. package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs +115 -0
  88. package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs.map +1 -0
  89. package/dist/{invariants-1zL5-9Mc-BCeOLxd_.mjs → invariants-Bltd8DyA-Cg_1Lu0q.mjs} +4 -4
  90. package/dist/{invariants-1zL5-9Mc-BCeOLxd_.mjs.map → invariants-Bltd8DyA-Cg_1Lu0q.mjs.map} +1 -1
  91. package/dist/{legend-BQcPKTLe-bn9e4_ZU.mjs → legend-DGv9e2_0-BtetgRz4.mjs} +3 -3
  92. package/dist/{legend-BQcPKTLe-bn9e4_ZU.mjs.map → legend-DGv9e2_0-BtetgRz4.mjs.map} +1 -1
  93. package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs → migrate-BXATUjYE-Do79Imf-.mjs} +12 -12
  94. package/dist/{migrate-CgSnzAUm-aGstaO5N.mjs.map → migrate-BXATUjYE-Do79Imf-.mjs.map} +1 -1
  95. package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs → migrate-failure-D4NvkoCk-0bttmQs2.mjs} +5 -5
  96. package/dist/{migrate-failure-CnoUcDms-taa9pfd7.mjs.map → migrate-failure-D4NvkoCk-0bttmQs2.mjs.map} +1 -1
  97. package/dist/{migrate-show-Dlo-YzOk-BXo-DmwI.d.mts → migrate-show-B8UJ9dmb-C4RTPbDk.d.mts} +3 -3
  98. package/dist/{migrate-show-Dlo-YzOk-BXo-DmwI.d.mts.map → migrate-show-B8UJ9dmb-C4RTPbDk.d.mts.map} +1 -1
  99. package/dist/{migrate-show-kVUG1xdo-bVTW8tu4.mjs → migrate-show-C_9xR4Qt-B-Y0PGKw.mjs} +6 -6
  100. package/dist/{migrate-show-kVUG1xdo-bVTW8tu4.mjs.map → migrate-show-C_9xR4Qt-B-Y0PGKw.mjs.map} +1 -1
  101. package/dist/{migration-check-CBMoMDX2-DhSEOGNg.mjs → migration-check-Bbdw7t-r-C2VTMK61.mjs} +6 -6
  102. package/dist/{migration-check-CBMoMDX2-DhSEOGNg.mjs.map → migration-check-Bbdw7t-r-C2VTMK61.mjs.map} +1 -1
  103. package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs +163 -0
  104. package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs.map +1 -0
  105. package/dist/{migration-command-scaffold-B1BiWKLI-Bskk5UKX.mjs → migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs} +5 -5
  106. package/dist/{migration-command-scaffold-B1BiWKLI-Bskk5UKX.mjs.map → migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs.map} +1 -1
  107. package/dist/{migration-graph-B30X5398-BH3zB9Mn.mjs → migration-graph-B8WxW_tm-qGNf7jQh.mjs} +3 -3
  108. package/dist/{migration-graph-B30X5398-BH3zB9Mn.mjs.map → migration-graph-B8WxW_tm-qGNf7jQh.mjs.map} +1 -1
  109. package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs → migration-graph-BOwu76mF-kOTWFvfV.mjs} +9 -9
  110. package/dist/{migration-graph-D2dbLCkl-CCHL0aDA.mjs.map → migration-graph-BOwu76mF-kOTWFvfV.mjs.map} +1 -1
  111. package/dist/{migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs → migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs} +17 -3
  112. package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map +1 -0
  113. package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs → migration-graph-sections-BBHPOFN--COKyUKQ4.mjs} +4 -4
  114. package/dist/{migration-graph-sections-0lKA5l1b-CTHQquu7.mjs.map → migration-graph-sections-BBHPOFN--COKyUKQ4.mjs.map} +1 -1
  115. package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs → migration-list-CKuYcMQq-CubZzE9i.mjs} +7 -7
  116. package/dist/{migration-list-DCx0KOFp-B3MiGnpa.mjs.map → migration-list-CKuYcMQq-CubZzE9i.mjs.map} +1 -1
  117. package/dist/{migration-list-BQTfSGbT-DoNqbNsu.mjs → migration-list-CY08bD8I-PoXuv94c.mjs} +3 -3
  118. package/dist/{migration-list-BQTfSGbT-DoNqbNsu.mjs.map → migration-list-CY08bD8I-PoXuv94c.mjs.map} +1 -1
  119. package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs → migration-log-CUbGla-9-BLIrWjwN.mjs} +8 -8
  120. package/dist/{migration-log-CJ6_9_uj-uWyc3vlC.mjs.map → migration-log-CUbGla-9-BLIrWjwN.mjs.map} +1 -1
  121. package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs → migration-log-table-eES9lPjv-BCFm8qJr.mjs} +3 -3
  122. package/dist/{migration-log-table-DRiOnvzf-zTQBThqe.mjs.map → migration-log-table-eES9lPjv-BCFm8qJr.mjs.map} +1 -1
  123. package/dist/{migration-new-CXLgOLXz-2C5s_q7n.mjs → migration-new-ChvZjf5X-BFhEM0BF.mjs} +4 -4
  124. package/dist/{migration-new-CXLgOLXz-2C5s_q7n.mjs.map → migration-new-ChvZjf5X-BFhEM0BF.mjs.map} +1 -1
  125. package/dist/{migration-new-Bp5dPKnF-D-Fb6vEp.mjs → migration-new-DXMvJdbB-BkrpDfcr.mjs} +7 -7
  126. package/dist/{migration-new-Bp5dPKnF-D-Fb6vEp.mjs.map → migration-new-DXMvJdbB-BkrpDfcr.mjs.map} +1 -1
  127. package/dist/{migration-path-target-BNTSTPAc-D7dQ4K7x.mjs → migration-path-target-JDWqF9kj-B7zoMq6X.mjs} +3 -3
  128. package/dist/{migration-path-target-BNTSTPAc-D7dQ4K7x.mjs.map → migration-path-target-JDWqF9kj-B7zoMq6X.mjs.map} +1 -1
  129. package/dist/{migration-plan-CharRhoN-BIB3WL65.d.mts → migration-plan-BV9f5Xjq-DiyscOMc.d.mts} +3 -3
  130. package/dist/{migration-plan-CharRhoN-BIB3WL65.d.mts.map → migration-plan-BV9f5Xjq-DiyscOMc.d.mts.map} +1 -1
  131. package/dist/{migration-plan-BxfF1Hdo-BKn0xMlY.mjs → migration-plan-Bz1hOTHF-CFCtPuOv.mjs} +4 -4
  132. package/dist/{migration-plan-BxfF1Hdo-BKn0xMlY.mjs.map → migration-plan-Bz1hOTHF-CFCtPuOv.mjs.map} +1 -1
  133. package/dist/{migration-plan-C6KrFHJT-CRkTsE7L.mjs → migration-plan-Cfz0efEL-DMNFq5b2.mjs} +8 -8
  134. package/dist/{migration-plan-C6KrFHJT-CRkTsE7L.mjs.map → migration-plan-Cfz0efEL-DMNFq5b2.mjs.map} +1 -1
  135. package/dist/{migration-show-Dhnlx_GU-DhWLLt3Z.mjs → migration-show-BGdR1xnT-Cg3M0FPh.mjs} +8 -8
  136. package/dist/{migration-show-Dhnlx_GU-DhWLLt3Z.mjs.map → migration-show-BGdR1xnT-Cg3M0FPh.mjs.map} +1 -1
  137. package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs → migration-status-BIrAJ5af-D-_mMBUA.mjs} +12 -11
  138. package/dist/{migration-status-S88DjM8c-DLHnCKfW.mjs.map → migration-status-BIrAJ5af-D-_mMBUA.mjs.map} +1 -1
  139. package/dist/{output-DWNYqZGc-D2sRgLAm.mjs → output-DP3woAjV-BxCr9nHA.mjs} +21 -11
  140. package/dist/output-DP3woAjV-BxCr9nHA.mjs.map +1 -0
  141. package/dist/{project-import-root-nwdoPWap--5vXe4zp.mjs → project-import-root-B4nM-VWX-D__g0hTb.mjs} +3 -3
  142. package/dist/{project-import-root-nwdoPWap--5vXe4zp.mjs.map → project-import-root-B4nM-VWX-D__g0hTb.mjs.map} +1 -1
  143. package/dist/{init-Bco4QkKJ-DqUZVrBU.mjs → redact-secrets-Cvia6eTB-BE_Pg3k9.mjs} +741 -1517
  144. package/dist/redact-secrets-Cvia6eTB-BE_Pg3k9.mjs.map +1 -0
  145. package/dist/{ref-gZQjdz8I-CW6n9Fc0.mjs → ref-4x6BGSsd-ClaoZIQh.mjs} +4 -4
  146. package/dist/{ref-gZQjdz8I-CW6n9Fc0.mjs.map → ref-4x6BGSsd-ClaoZIQh.mjs.map} +1 -1
  147. package/dist/{ref-C8oaaeky-ColNkWpr.mjs → ref-WXLIR9Xm-12IUtoBU.mjs} +5 -5
  148. package/dist/{ref-C8oaaeky-ColNkWpr.mjs.map → ref-WXLIR9Xm-12IUtoBU.mjs.map} +1 -1
  149. package/dist/{ref-resolution-DAK4OK3x-B-8ZZc0f.mjs → ref-resolution-BSN1amKm-C6-TTM2N.mjs} +3 -3
  150. package/dist/{ref-resolution-DAK4OK3x-B-8ZZc0f.mjs.map → ref-resolution-BSN1amKm-C6-TTM2N.mjs.map} +1 -1
  151. package/dist/{schemas-Bm2e3Hk1-qLKF0B36.d.mts → schemas-BGgjiKV0-Rh8RlMCl.d.mts} +4 -2
  152. package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts.map +1 -0
  153. package/dist/{schemas-BMkqaqvM-CLaqlat4.mjs → schemas-CYSD83Cu-Bff4PPoi.mjs} +3 -2
  154. package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs.map +1 -0
  155. package/dist/{telemetry-DPXFYAsz-CPW2USxs.mjs → telemetry-BD52LETE-Cqeb7ebh.mjs} +3 -3
  156. package/dist/{telemetry-DPXFYAsz-CPW2USxs.mjs.map → telemetry-BD52LETE-Cqeb7ebh.mjs.map} +1 -1
  157. package/dist/vite-plugin-contract-emit.mjs +1 -1
  158. package/package.json +13 -13
  159. package/dist/cli-errors-BG6bItjG-DwdKIeGz.mjs.map +0 -1
  160. package/dist/cli-errors-BiKBrOXc-JPxQqO58.d.mts.map +0 -1
  161. package/dist/client-DU9qtBxW-BjVHiKzE.mjs.map +0 -1
  162. package/dist/contract-emit-Bzt11N4v-BQ2Pr8KG.mjs +0 -2
  163. package/dist/db-verify-0TpDMziA-CJDKutMN.mjs.map +0 -1
  164. package/dist/exports-DaxzMVtq.mjs.map +0 -1
  165. package/dist/init-Bco4QkKJ-DqUZVrBU.mjs.map +0 -1
  166. package/dist/migration-check-BVK9vfan-Dfg8lbeB.mjs +0 -272
  167. package/dist/migration-check-BVK9vfan-Dfg8lbeB.mjs.map +0 -1
  168. package/dist/migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs.map +0 -1
  169. package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +0 -1
  170. package/dist/schemas-BMkqaqvM-CLaqlat4.mjs.map +0 -1
  171. package/dist/schemas-Bm2e3Hk1-qLKF0B36.d.mts.map +0 -1
@@ -1,78 +1,19 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
- import { N as errorTargetMismatch, P as errorUnexpected, c as errorContractValidationFailed, d as errorDriverRequired, f as errorFileNotFound, k as errorRuntime$1, l as errorDatabaseConnectionRequired, p as errorHashMismatch, t as CliStructuredError$1, v as errorMarkerMissing } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
2
+ import { A as errorRuntime$1, F as errorUnexpected, P as errorTargetMismatch, f as errorDriverRequired, l as errorContractValidationFailed, m as errorHashMismatch, p as errorFileNotFound, t as CliStructuredError$1, u as errorDatabaseConnectionRequired, y as errorMarkerMissing } from "./cli-errors-B4zTLaqQ-CXgjO9t4.mjs";
3
3
  import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
4
- import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
4
+ import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-BCgwcqTe-lNCtppzM.mjs";
5
5
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
6
- import { t as createControlClient } from "./client-DU9qtBxW-BjVHiKzE.mjs";
6
+ import { t as createControlClient } from "./client-C6Qp5ujC-Dxb7r79B.mjs";
7
+ import { t as combineVerifyResults } from "./combine-verify-results-B87B_pMc-D4l22OqY.mjs";
7
8
  import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-Cogr_Fj9-D3lCWA6t.mjs";
8
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
10
  import { relative, resolve } from "pathe";
10
11
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
11
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
12
12
  import { readFile } from "node:fs/promises";
13
13
  import { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from "@prisma/orm-framework/components/control";
14
14
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
15
15
  import { Command } from "commander";
16
- //#region ../../../1-framework/3-tooling/cli/dist/db-verify-0TpDMziA.mjs
17
- /**
18
- * Collapse the aggregate verifier's per-space contract-satisfaction results
19
- * into a single {@link VerifyDatabaseSchemaResult} for the CLI display
20
- * surface, and carry the deduplicated unclaimed-elements list alongside it.
21
- * Concatenates the issue lists across spaces; uses the app space's result as
22
- * the structural envelope (storage hash, target). Extras are already
23
- * stripped from each per-space result, so nothing here duplicates an
24
- * unclaimed element per space.
25
- *
26
- * **Unclaimed disposition.** In strict mode a non-empty `unclaimed` list fails
27
- * the combined verdict (`ok: false`); in lenient mode it is carried for
28
- * informational rendering only. The list itself is returned unchanged for the
29
- * renderer.
30
- *
31
- * **Summary policy.** Preserve the per-family phrasing whenever the
32
- * combined `ok` flag agrees with the app space's `ok` flag — this is
33
- * the common case (single-family deployments, single-app deployments)
34
- * and the family's "satisfies / does not satisfy contract" phrasing
35
- * stays user-visible. When the app passes but an extension fails (or
36
- * vice versa) the app's summary contradicts the envelope, so fall back
37
- * to the first failing space's summary. This keeps family phrasing
38
- * intact and the envelope internally consistent (`ok: false` ↔ failure
39
- * summary).
40
- */
41
- function combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {
42
- const appResult = perSpace.get(appSpaceId) ?? perSpace.values().next().value;
43
- if (appResult === void 0) throw new InternalError("Aggregate verifier returned no per-space verify results — this is a wiring bug.");
44
- let okAll = true;
45
- let firstFailure;
46
- let issues = [];
47
- let warningIssues = [];
48
- for (const [, result] of perSpace) {
49
- if (!result.ok) {
50
- okAll = false;
51
- if (firstFailure === void 0) firstFailure = result;
52
- }
53
- issues = [...issues, ...result.schema.issues];
54
- warningIssues = [...warningIssues, ...result.schema.warnings?.issues ?? []];
55
- }
56
- const unclaimedFails = strict && unclaimed.length > 0;
57
- const ok = okAll && !unclaimedFails;
58
- const summary = okAll ? unclaimedFails ? `Database schema has ${unclaimed.length} unclaimed element${unclaimed.length === 1 ? "" : "s"} (not in any contract)` : appResult.summary : appResult.ok ? firstFailure?.summary ?? appResult.summary : appResult.summary;
59
- return {
60
- result: {
61
- ok,
62
- ...ok ? {} : { code: appResult.code ?? "CONTRACT.MARKER_REQUIRED" },
63
- summary,
64
- contract: appResult.contract,
65
- target: appResult.target,
66
- schema: {
67
- issues,
68
- warnings: { issues: warningIssues }
69
- },
70
- meta: { strict },
71
- timings: { total: 0 }
72
- },
73
- unclaimed
74
- };
75
- }
16
+ //#region ../../../1-framework/3-tooling/cli/dist/db-verify-BN7IrOAL.mjs
76
17
  /**
77
18
  * Maps a VerifyDatabaseResult failure to a CliStructuredError.
78
19
  */
@@ -272,6 +213,7 @@ async function executeDbVerifyCommand(options, flags, ui, mode) {
272
213
  onProgress
273
214
  });
274
215
  if (!aggregateResult.ok) return notOk(aggregateResult.failure);
216
+ if (aggregateResult.value.markerDrift !== null) return notOk(aggregateResult.value.markerDrift);
275
217
  if (mode === "marker-only") return ok({
276
218
  ok: true,
277
219
  mode: "marker-only",
@@ -413,4 +355,4 @@ function createDbVerifyCommand() {
413
355
  //#endregion
414
356
  export { createDbVerifyCommand as t };
415
357
 
416
- //# sourceMappingURL=db-verify-0TpDMziA-CJDKutMN.mjs.map
358
+ //# sourceMappingURL=db-verify-BN7IrOAL-kEzRNJUl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-verify-BN7IrOAL-kEzRNJUl.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-BN7IrOAL.mjs"],"sourcesContent":["import { N as errorTargetMismatch, P as errorUnexpected, c as errorContractValidationFailed, d as errorDriverRequired, f as errorFileNotFound, k as errorRuntime, l as errorDatabaseConnectionRequired, p as errorHashMismatch, t as CliStructuredError, v as errorMarkerMissing } from \"./cli-errors-B4zTLaqQ.mjs\";\nimport { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-BCgwcqTe.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-C6Qp5ujC.mjs\";\nimport { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { t as combineVerifyResults } from \"./combine-verify-results-B87B_pMc.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 { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from \"@internal/framework-components/control\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/commands/db-verify.ts\n/**\n* Maps a VerifyDatabaseResult failure to a CliStructuredError.\n*/\nfunction mapVerifyFailure(verifyResult) {\n\tif (!verifyResult.ok && verifyResult.code) {\n\t\tif (verifyResult.code === VERIFY_CODE_MARKER_MISSING) return errorMarkerMissing();\n\t\tif (verifyResult.code === VERIFY_CODE_HASH_MISMATCH) {\n\t\t\tconst storageMatch = verifyResult.marker?.storageHash === verifyResult.contract.storageHash;\n\t\t\tconst profileMatch = !verifyResult.contract.profileHash || verifyResult.marker?.profileHash === verifyResult.contract.profileHash;\n\t\t\tif (!storageMatch) return errorHashMismatch({\n\t\t\t\twhy: \"Contract storageHash does not match database marker\",\n\t\t\t\texpected: verifyResult.contract.storageHash,\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.storageHash)\n\t\t\t});\n\t\t\treturn errorHashMismatch({\n\t\t\t\twhy: profileMatch ? \"Contract hash does not match database marker\" : \"Contract profileHash does not match database marker\",\n\t\t\t\t...ifDefined(\"expected\", verifyResult.contract.profileHash),\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.profileHash)\n\t\t\t});\n\t\t}\n\t\tif (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? \"unknown\");\n\t}\n\treturn errorRuntime(\"CONTRACT.VERIFY_FAILED\", verifyResult.summary, {\n\t\twhy: \"Verification failed\",\n\t\tfix: \"Check contract and database state\"\n\t});\n}\nfunction errorInvalidVerifyMode(options) {\n\treturn new CliStructuredError(\"CLI.INVALID_VERIFY_MODE\", \"Invalid verify mode\", {\n\t\twhy: options.why,\n\t\tfix: options.fix,\n\t\tdocsUrl: \"https://pris.ly/db-verify\"\n\t});\n}\nfunction resolveDbVerifyMode(options) {\n\tif (options.markerOnly && options.schemaOnly) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--marker-only` and `--schema-only` cannot be used together\",\n\t\tfix: \"Choose one mode: omit both to check the marker and schema, use `--marker-only` to check only the marker, or use `--schema-only` to check only the live schema.\"\n\t}));\n\tif (options.markerOnly && options.strict) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--strict` requires schema verification, but `--marker-only` skips it\",\n\t\tfix: \"Remove `--strict`, or use `db verify` / `db verify --schema-only` when you want to check the live schema in strict mode.\"\n\t}));\n\tif (options.schemaOnly) return ok(\"schema-only\");\n\tif (options.markerOnly) return ok(\"marker-only\");\n\treturn ok(\"full\");\n}\nfunction formatDbVerifyModeLabel(mode, strict) {\n\tif (mode === \"marker-only\") return \"marker only\";\n\tif (mode === \"schema-only\") return `schema only (${strict ? \"strict\" : \"tolerant\"})`;\n\treturn `full (marker + schema, ${strict ? \"strict\" : \"tolerant\"})`;\n}\nfunction formatDbVerifyInvocation(mode, strict) {\n\tconst args = [\"db verify\"];\n\tif (mode === \"marker-only\") args.push(\"--marker-only\");\n\tif (mode === \"schema-only\") args.push(\"--schema-only\");\n\tif (strict) args.push(\"--strict\");\n\treturn args.join(\" \");\n}\nfunction createDbVerifyConnectionRequiredError(options) {\n\tconst invocation = formatDbVerifyInvocation(options.mode, options.strict);\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${invocation} (set db.connection in ${options.configPath}, or pass --db <url>)`,\n\t\tretryCommand: `prisma-next ${invocation} --db <url>`\n\t});\n}\nfunction renderVerifyHeader(paths, options, mode, flags, ui) {\n\tif (flags.json || flags.quiet) return;\n\tconst description = mode === \"schema-only\" ? \"Check whether the live database schema matches your contract\" : mode === \"marker-only\" ? \"Check whether the database marker matches your contract\" : \"Check whether the database marker and live schema match your contract\";\n\tconst details = [\n\t\t{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: paths.configPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: paths.contractPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: formatDbVerifyModeLabel(mode, options.strict ?? false)\n\t\t}\n\t];\n\tif (options.db) details.push({\n\t\tlabel: \"database\",\n\t\tvalue: maskConnectionUrl(options.db)\n\t});\n\tui.stderr(formatStyledHeader({\n\t\tcommand: \"db verify\",\n\t\tdescription,\n\t\turl: \"https://pris.ly/db-verify\",\n\t\tdetails,\n\t\tflags\n\t}));\n}\nasync function resolveVerifyPaths(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 = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tconst contractPathAbsolute = resolveContractPath(config);\n\treturn ok({\n\t\tconfig,\n\t\tconfigPath,\n\t\tcontractPathAbsolute,\n\t\tcontractPath: relative(process.cwd(), contractPathAbsolute)\n\t});\n}\nasync function resolveVerifySetup(paths, options, mode) {\n\tconst { config, configPath, contractPathAbsolute, contractPath } = paths;\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = 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 ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (typeof dbConnection !== \"string\" || dbConnection.length === 0) return notOk(createDbVerifyConnectionRequiredError({\n\t\tconfigPath,\n\t\tmode,\n\t\tstrict: options.strict ?? false\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${formatDbVerifyInvocation(mode, options.strict ?? false)}` }));\n\treturn ok({\n\t\t...paths,\n\t\tcontractJson,\n\t\tdbConnection\n\t});\n}\nfunction createVerifyClient(setup) {\n\treturn createControlClient({\n\t\tfamily: setup.config.family,\n\t\ttarget: setup.config.target,\n\t\tadapter: setup.config.adapter,\n\t\tdriver: setup.config.driver,\n\t\textensions: setup.config.extensions ?? []\n\t});\n}\nfunction wrapVerifyError(error, contractPathAbsolute, modeLabel) {\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during ${modeLabel}: ${error instanceof Error ? error.message : String(error)}` }));\n}\n/**\n* Executes the db verify command and returns a structured Result.\n*/\nasync function executeDbVerifyCommand(options, flags, ui, mode) {\n\tconst startTime = Date.now();\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, mode, flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, mode);\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst verifyResult = await client.verify({\n\t\t\tcontract: contractJson,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!verifyResult.ok) return notOk(mapVerifyFailure(verifyResult));\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: mode === \"marker-only\",\n\t\t\tskipMarker: false,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\tif (aggregateResult.value.markerDrift !== null) return notOk(aggregateResult.value.markerDrift);\n\t\tif (mode === \"marker-only\") return ok({\n\t\t\tok: true,\n\t\t\tmode: \"marker-only\",\n\t\t\tsummary: \"Database marker matches contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\twarning: \"Schema verification skipped because --marker-only was provided\",\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"skipped\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst combined = combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed);\n\t\tif (!combined.result.ok) return notOk(combined);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: \"full\",\n\t\t\tsummary: \"Database marker and schema match contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\tschema: {\n\t\t\t\tsummary: combined.result.summary,\n\t\t\t\tstrict: combined.result.meta?.strict ?? false,\n\t\t\t\twarnings: (combined.result.schema.warnings?.issues ?? []).map((issue) => issue.path.join(\"/\"))\n\t\t\t},\n\t\t\tunclaimed: combined.unclaimed,\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"performed\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nasync function executeDbSchemaOnlyVerifyCommand(options, flags, ui) {\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, \"schema-only\", flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, \"schema-only\");\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: false,\n\t\t\tskipMarker: true,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\treturn ok(combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed));\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify --schema-only\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbVerifyCommand() {\n\tconst command = new Command(\"verify\");\n\tsetCommandDescriptions(command, \"Check whether the database marker and live schema match your contract\", \"Verifies the database marker first, then checks the database schema matches your contract.\\nUse `--marker-only` for marker-only verification, `--schema-only` to skip marker checks and\\ninspect only the live schema, and `--strict` to fail if the database includes elements\\nnot present in the contract.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db verify --db $DATABASE_URL\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --marker-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--marker-only\", \"Skip schema verification and only check the database marker\").option(\"--schema-only\", \"Skip marker verification and only check whether the live schema satisfies the contract\").option(\"--strict\", \"Strict mode: schema elements not present in the contract are considered an error\", false).action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst modeResult = resolveDbVerifyMode(options);\n\t\tif (!modeResult.ok) {\n\t\t\tconst exitCode = handleResult(modeResult, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst mode = modeResult.value;\n\t\tif (mode === \"schema-only\") {\n\t\t\tconst result = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);\n\t\t\tconst exitCode = handleResult(result, flags, ui, (combined) => {\n\t\t\t\tif (flags.json) ui.output(formatSchemaVerifyJson(combined.result, combined.unclaimed));\n\t\t\t\telse {\n\t\t\t\t\tconst renderFlags = combined.result.ok ? flags : {\n\t\t\t\t\t\t...flags,\n\t\t\t\t\t\tquiet: false\n\t\t\t\t\t};\n\t\t\t\t\tconst output = formatSchemaVerifyOutput(combined.result, renderFlags, combined.unclaimed);\n\t\t\t\t\tif (output) ui.log(output);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (result.ok && !result.value.result.ok) process.exit(1);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst result = await executeDbVerifyCommand(options, flags, ui, mode);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatVerifyJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatVerifyOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (CliStructuredError.is(result.failure)) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(result.failure.result, result.failure.unclaimed));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(result.failure.result, {\n\t\t\t\t...flags,\n\t\t\t\tquiet: false\n\t\t\t}, result.failure.unclaimed);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbVerifyCommand as t };\n\n//# sourceMappingURL=db-verify-BN7IrOAL.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,iBAAiB,cAAc;CACvC,IAAI,CAAC,aAAa,MAAM,aAAa,MAAM;EAC1C,IAAI,aAAa,SAAS,4BAA4B,OAAO,mBAAmB;EAChF,IAAI,aAAa,SAAS,2BAA2B;GACpD,MAAM,eAAe,aAAa,QAAQ,gBAAgB,aAAa,SAAS;GAChF,MAAM,eAAe,CAAC,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,KAAK;IACrD,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;GACA,QAAQ,KAAK,CAAC;EACf;EACA,IAAIA,qBAAmB,GAAG,OAAO,OAAO,GAAG;GAC1C,MAAM,WAAW,aAAa,QAAQ,OAAO,EAAE;GAC/C,QAAQ,KAAK,QAAQ;EACtB;EACA,IAAI,MAAM,MAAM,GAAG,OAAO,uBAAuB,OAAO,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC;OAC5F;GACJ,MAAM,SAAS,yBAAyB,OAAO,QAAQ,QAAQ;IAC9D,GAAG;IACH,OAAO;GACR,GAAG,OAAO,QAAQ,SAAS;GAC3B,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
@@ -5,13 +5,16 @@ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
5
5
  import { createControlStack } from "@prisma/orm-framework/components/control";
6
6
  import { format } from "@prisma/orm-framework/psl-parser/format";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
- import { CompletionItemKind, DiagnosticSeverity, DidChangeWatchedFilesNotification, DocumentDiagnosticReportKind, FoldingRangeKind, InsertTextFormat, RegistrationRequest, SemanticTokenModifiers, SemanticTokenTypes, TextDocumentSyncKind, TextDocuments } from "vscode-languageserver";
8
+ import { CompletionItemKind, ConnectionError, DiagnosticSeverity, DidChangeWatchedFilesNotification, DocumentDiagnosticReportKind, FoldingRangeKind, InsertTextFormat, ProposedFeatures, RegistrationRequest, SemanticTokenModifiers, SemanticTokenTypes, TextDocumentSyncKind, TextDocuments, createConnection } from "vscode-languageserver";
9
9
  import { TextDocument } from "vscode-languageserver-textdocument";
10
10
  import { ArrayLiteralAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectLiteralExprAst, StringLiteralExprAst, TypesBlockAst, any, filterChildren, findChildToken, parse, skipTriviaToken } from "@prisma/orm-framework/psl-parser/syntax";
11
11
  import { isAuthoringPslBlockDescriptor } from "@prisma/orm-framework/components/authoring";
12
12
  import { buildSymbolTable, findBlockDescriptor } from "@prisma/orm-framework/psl-parser";
13
13
  import { hasPslInterpreter } from "@prisma/orm-framework/psl-parser/interpret";
14
- import { ProposedFeatures, createConnection } from "vscode-languageserver/node";
14
+ import { ProposedFeatures as ProposedFeatures$1, StreamMessageReader, StreamMessageWriter, createConnection as createConnection$1, createProtocolConnection } from "vscode-languageserver/node";
15
+ import { Console } from "node:console";
16
+ import { Readable, Writable } from "node:stream";
17
+ import { StringDecoder } from "node:string_decoder";
15
18
  //#region ../../../1-framework/3-tooling/language-server/dist/exports/index.mjs
16
19
  const ParseDiagnosticSeverity = {
17
20
  Error: 1,
@@ -571,6 +574,57 @@ function addFoldingRange(declaration, sourceFile, ranges) {
571
574
  });
572
575
  }
573
576
  /**
577
+ * Wraps a connection so that an outbound call the client is no longer there to
578
+ * receive does nothing, instead of throwing at whoever made it.
579
+ *
580
+ * `vscode-jsonrpc` marks the connection closed the moment the input stream
581
+ * ends, and every send after that throws synchronously. A throw that escapes a
582
+ * notification handler ends the process: jsonrpc reports it through its logger,
583
+ * which is the connection's own remote console, so the report is another send —
584
+ * it throws again inside a `.catch()`, and the unhandled rejection is fatal.
585
+ *
586
+ * The wrapper carries the check so no individual send site has to: reads walk
587
+ * the connection's features (`console`, `languages`, …) and hand back guarded
588
+ * functions, so a send added later is guarded by construction. Only the
589
+ * connection's departure is swallowed — any other synchronous failure is a bug
590
+ * in the caller and still reaches it.
591
+ */
592
+ function guardedConnection(connection) {
593
+ return guardCalls(connection);
594
+ }
595
+ function guardCalls(target) {
596
+ const guarded = /* @__PURE__ */ new Map();
597
+ return new Proxy(target, { get: (source, property) => {
598
+ const cached = guarded.get(property);
599
+ if (cached !== void 0) return cached;
600
+ const value = Reflect.get(source, property);
601
+ if (typeof value === "function") {
602
+ const call = (...args) => whileConnected(() => Reflect.apply(value, source, args));
603
+ guarded.set(property, call);
604
+ return call;
605
+ }
606
+ if (typeof value === "object" && value !== null) {
607
+ const feature = guardCalls(value);
608
+ guarded.set(property, feature);
609
+ return feature;
610
+ }
611
+ return value;
612
+ } });
613
+ }
614
+ function whileConnected(send) {
615
+ let sent;
616
+ try {
617
+ sent = send();
618
+ } catch (error) {
619
+ if (error instanceof ConnectionError) return Promise.resolve(void 0);
620
+ throw error;
621
+ }
622
+ return isThenable(sent) ? sent.then(void 0, () => void 0) : sent;
623
+ }
624
+ function isThenable(value) {
625
+ return typeof value === "object" && value !== null && "then" in value && typeof Reflect.get(value, "then") === "function";
626
+ }
627
+ /**
574
628
  * Composes the stages exactly as the contract-psl provider does, so the editor
575
629
  * and the build agree: `parse` then `buildSymbolTable`, parse diagnostics ahead
576
630
  * of symbol-table diagnostics. Never throws on malformed input — `parse`
@@ -1006,19 +1060,19 @@ function lastGoodProject(entry) {
1006
1060
  const CONFIG_LOAD_FAILED_CODE = "PRISMA_NEXT_CONFIG_LOAD_FAILED";
1007
1061
  const semanticTokenSourceLimit = 1e5;
1008
1062
  function createServer(connection) {
1063
+ return createServerOn(guardedConnection(connection));
1064
+ }
1065
+ function createServerOn(connection) {
1009
1066
  const documents = new TextDocuments(TextDocument);
1010
1067
  const managedProjects = /* @__PURE__ */ new Map();
1011
1068
  const documentConfigPaths = /* @__PURE__ */ new Map();
1012
1069
  let rootPath = process.cwd();
1013
1070
  let watchedConfigGlob = join(rootPath, "**", CONFIG_FILENAME);
1014
1071
  let clientCapabilities = noClientCapabilities;
1015
- let disposed = false;
1016
1072
  function sendDiagnostics(params) {
1017
- if (disposed) return;
1018
1073
  connection.sendDiagnostics(params);
1019
1074
  }
1020
1075
  function logWarn(message) {
1021
- if (disposed) return;
1022
1076
  connection.console.warn(message);
1023
1077
  }
1024
1078
  async function publish(uri) {
@@ -1208,10 +1262,7 @@ function createServer(connection) {
1208
1262
  }
1209
1263
  function publishSafely(uri) {
1210
1264
  publish(uri).catch((error) => {
1211
- if (disposed) return;
1212
- try {
1213
- connection.console.error(error instanceof Error ? error.message : String(error));
1214
- } catch {}
1265
+ connection.console.error(error instanceof Error ? error.message : String(error));
1215
1266
  });
1216
1267
  }
1217
1268
  async function formatDocument(uri) {
@@ -1303,7 +1354,7 @@ function createServer(connection) {
1303
1354
  id: "prisma-8-config-watcher",
1304
1355
  method: DidChangeWatchedFilesNotification.type.method,
1305
1356
  registerOptions: { watchers: [{ globPattern: watchedConfigGlob }] }
1306
- }] }).catch(() => void 0);
1357
+ }] });
1307
1358
  else logWarn("Client does not support dynamic file-watcher registration; Prisma Next config changes will not be picked up without a restart.");
1308
1359
  });
1309
1360
  connection.onDidChangeWatchedFiles(async (params) => {
@@ -1316,7 +1367,7 @@ function createServer(connection) {
1316
1367
  }
1317
1368
  if (!clientCapabilities.pullDiagnostics) await republishOpenDocumentsForConfig(configPath);
1318
1369
  }
1319
- if (clientCapabilities.pullDiagnostics && clientCapabilities.diagnosticsRefresh && changedConfigPaths.size > 0 && !disposed) connection.languages.diagnostics.refresh().catch(() => void 0);
1370
+ if (clientCapabilities.pullDiagnostics && clientCapabilities.diagnosticsRefresh && changedConfigPaths.size > 0) connection.languages.diagnostics.refresh();
1320
1371
  });
1321
1372
  connection.onDocumentFormatting((params) => formatDocument(params.textDocument.uri));
1322
1373
  connection.onCompletion((params) => completeDocument(params.textDocument.uri, params.position));
@@ -1378,10 +1429,7 @@ function createServer(connection) {
1378
1429
  clearConfigFailure(configPath);
1379
1430
  }
1380
1431
  return {
1381
- dispose: () => {
1382
- disposed = true;
1383
- connection.dispose();
1384
- },
1432
+ dispose: () => connection.dispose(),
1385
1433
  getDocumentAst: (uri) => artifactsForDocument(uri)?.document(uri),
1386
1434
  getProjectSymbolTable: (uri) => artifactsForDocument(uri)?.symbolTable()
1387
1435
  };
@@ -1439,10 +1487,248 @@ function configPathsFromWatchedChanges(paths) {
1439
1487
  for (const path of paths) if (path?.endsWith("prisma-next.config.ts")) configPaths.add(path);
1440
1488
  return configPaths;
1441
1489
  }
1442
- function startServer() {
1443
- return createServer(createConnection(ProposedFeatures.all));
1490
+ /**
1491
+ * `objectMode: false` is what makes this a byte stream rather than a stream of
1492
+ * whatever objects the host yielded: it converts each chunk to a `Buffer`.
1493
+ * `vscode-jsonrpc` needs that — it slices header blocks with
1494
+ * `Buffer.from(chunk, 0, length)`, and on a plain `Uint8Array` those arguments
1495
+ * are ignored, so it reads the whole chunk as one header block and rejects the
1496
+ * message.
1497
+ */
1498
+ function byteInputStream(stdin) {
1499
+ return Readable.from(stdin, { objectMode: false });
1500
+ }
1501
+ /**
1502
+ * Bridges the byte stream `vscode-jsonrpc` writes to the text sink a host
1503
+ * hands over.
1504
+ *
1505
+ * LSP declares each message's `Content-Length` in bytes, so a UTF-8 sequence
1506
+ * that arrives split across two writes has to be held back until it is whole:
1507
+ * decoding half of one yields a replacement character, which is a different
1508
+ * number of bytes than the header promised. `StreamMessageWriter` writes each
1509
+ * body in one call and Node never splits a chunk given to `_write`, so the
1510
+ * decoder holds nothing back in practice — it is here because the contract
1511
+ * this satisfies is "bytes in, text out", and a writer that chunks its bodies
1512
+ * would otherwise corrupt every multi-byte message silently.
1513
+ *
1514
+ * Back-pressure is dropped: `TextSink.write` returns nothing to wait on, so
1515
+ * every write reports flushed the moment the sink has taken it. A client that
1516
+ * stops reading grows the host's own output queue instead of slowing the
1517
+ * server down, and the diagnostics for a large schema are not small. Fixing it
1518
+ * needs a sink that reports when it drained.
1519
+ */
1520
+ function textOutputStream(stdout) {
1521
+ const decoder = new StringDecoder("utf8");
1522
+ return new Writable({
1523
+ write(chunk, _encoding, callback) {
1524
+ stdout.write(decoder.write(chunk));
1525
+ callback();
1526
+ },
1527
+ final(callback) {
1528
+ const pending = decoder.end();
1529
+ if (pending !== "") stdout.write(pending);
1530
+ callback();
1531
+ }
1532
+ });
1533
+ }
1534
+ /**
1535
+ * Sends everything written through the global `console` to the host's stderr
1536
+ * for the length of the run, and returns the undo.
1537
+ *
1538
+ * The client owns stdout: anything on it that is not a `Content-Length` frame
1539
+ * desynchronises the client for good. `console.log` and friends write straight
1540
+ * to the process's own stdout, so one call from anywhere in the dependency
1541
+ * graph — resolving a project's config reaches c12 and jiti — corrupts the
1542
+ * protocol. `vscode-languageserver/node` redirects the console for exactly
1543
+ * this reason when it takes stdio off `process.argv`; over injected streams
1544
+ * that never runs, so the redirect happens here.
1545
+ *
1546
+ * A dependency that writes to `process.stdout` directly still reaches the
1547
+ * client. Nothing short of replacing the process's own descriptor covers that,
1548
+ * and only the host owns the process.
1549
+ */
1550
+ function captureConsole(stderr) {
1551
+ const host = globalThis.console;
1552
+ const sink = textOutputStream(stderr);
1553
+ globalThis.console = new Console({
1554
+ stdout: sink,
1555
+ stderr: sink
1556
+ });
1557
+ return () => {
1558
+ globalThis.console = host;
1559
+ };
1560
+ }
1561
+ /**
1562
+ * How long the conversation may stand completely still before a message the
1563
+ * connection took off the reader but never dispatched is written off. It
1564
+ * answers a cancellation itself without telling anyone, so the count of
1565
+ * messages awaiting dispatch can be left standing; every other route decrements
1566
+ * it. Any activity restarts the clock, so this delays the exit rather than
1567
+ * cutting a reply short.
1568
+ */
1569
+ const stalledDispatchGraceMs = 50;
1570
+ /**
1571
+ * How long a host abort lets in-flight work drain before the run settles
1572
+ * regardless. The host has already decided to stop, so a handler that never
1573
+ * settles — or work that never goes idle — must not hold the exit code back
1574
+ * forever; it only gets this long to finish cleanly.
1575
+ */
1576
+ const abortDrainDeadlineMs = 2e3;
1577
+ /**
1578
+ * How often the client's process id is polled when the host handed one over.
1579
+ * The same cadence `vscode-languageserver/node` uses for its own watch.
1580
+ */
1581
+ const clientProcessPollMs = 3e3;
1582
+ function processAlive(pid) {
1583
+ try {
1584
+ process.kill(pid, 0);
1585
+ return true;
1586
+ } catch {
1587
+ return false;
1588
+ }
1589
+ }
1590
+ /**
1591
+ * Runs the server over the host's streams and resolves with the exit code the
1592
+ * client's departure implies. The host owns the process, so nothing here ends
1593
+ * it; every route out settles the promise instead.
1594
+ */
1595
+ function runServerOverStreams(streams) {
1596
+ const input = byteInputStream(streams.stdin);
1597
+ const inputMessages = new StreamMessageReader(input);
1598
+ const outputMessages = new StreamMessageWriter(textOutputStream(streams.stdout));
1599
+ const releaseConsole = captureConsole(streams.stderr);
1600
+ return new Promise((resolve) => {
1601
+ let settled = false;
1602
+ /**
1603
+ * Messages the connection is handling and replies it is writing. A request
1604
+ * handler's dispatch covers everything it awaits and the write of its
1605
+ * reply, so this stays above zero for as long as the client is owed
1606
+ * anything.
1607
+ */
1608
+ let inFlight = 0;
1609
+ /** Messages decoded off the stream that the connection has not started. */
1610
+ let awaitingDispatch = 0;
1611
+ let lastActivity = Date.now();
1612
+ let departure;
1613
+ let idleCheck;
1614
+ let abortDeadline;
1615
+ let clientWatch;
1616
+ function settle(code) {
1617
+ if (settled) return;
1618
+ settled = true;
1619
+ if (idleCheck !== void 0) clearTimeout(idleCheck);
1620
+ if (abortDeadline !== void 0) clearTimeout(abortDeadline);
1621
+ if (clientWatch !== void 0) clearInterval(clientWatch);
1622
+ releaseConsole();
1623
+ server.dispose();
1624
+ input.destroy();
1625
+ resolve(code);
1626
+ }
1627
+ function moved() {
1628
+ lastActivity = Date.now();
1629
+ checkIdle();
1630
+ }
1631
+ /**
1632
+ * Settles once nothing is left in flight. The client's departure is not the
1633
+ * end of the work: everything already read is queued, and a handler that
1634
+ * awaits — resolving a project reads the filesystem — has its reply written
1635
+ * turns later.
1636
+ */
1637
+ function settleOnceIdle(code) {
1638
+ departure ??= code;
1639
+ checkIdle();
1640
+ }
1641
+ function checkIdle() {
1642
+ if (settled || departure === void 0 || idleCheck !== void 0) return;
1643
+ idleCheck = setTimeout(() => {
1644
+ idleCheck = void 0;
1645
+ if (settled || departure === void 0) return;
1646
+ if (inFlight > 0) return;
1647
+ if (awaitingDispatch === 0 || Date.now() - lastActivity >= stalledDispatchGraceMs) {
1648
+ settle(departure());
1649
+ return;
1650
+ }
1651
+ checkIdle();
1652
+ }, 1);
1653
+ }
1654
+ /** LSP reserves 0 for a client that asked to shut down before leaving. */
1655
+ function departureCode() {
1656
+ return watchDog.shutdownReceived ? 0 : 1;
1657
+ }
1658
+ const reader = {
1659
+ onError: inputMessages.onError,
1660
+ onClose: inputMessages.onClose,
1661
+ onPartialMessage: inputMessages.onPartialMessage,
1662
+ listen: (callback) => inputMessages.listen((message) => {
1663
+ awaitingDispatch += 1;
1664
+ moved();
1665
+ callback(message);
1666
+ }),
1667
+ dispose: () => inputMessages.dispose()
1668
+ };
1669
+ const writer = {
1670
+ onError: outputMessages.onError,
1671
+ onClose: outputMessages.onClose,
1672
+ write: (message) => {
1673
+ inFlight += 1;
1674
+ moved();
1675
+ return outputMessages.write(message).finally(() => {
1676
+ inFlight -= 1;
1677
+ moved();
1678
+ });
1679
+ },
1680
+ end: () => outputMessages.end(),
1681
+ dispose: () => outputMessages.dispose()
1682
+ };
1683
+ const watchDog = {
1684
+ shutdownReceived: false,
1685
+ initialize: () => void 0,
1686
+ exit: (code) => settleOnceIdle(() => code)
1687
+ };
1688
+ const server = createServer(createConnection((logger) => createProtocolConnection(reader, writer, logger, { messageStrategy: { handleMessage: (message, next) => {
1689
+ awaitingDispatch -= 1;
1690
+ inFlight += 1;
1691
+ moved();
1692
+ return Promise.resolve(next(message)).finally(() => {
1693
+ inFlight -= 1;
1694
+ moved();
1695
+ });
1696
+ } } }), watchDog, ProposedFeatures.all));
1697
+ inputMessages.onClose(() => settleOnceIdle(departureCode));
1698
+ inputMessages.onError((error) => {
1699
+ streams.stderr.write(`Language server transport error: ${messageOf(error)}\n`);
1700
+ settleOnceIdle(() => 1);
1701
+ });
1702
+ const clientProcessId = streams.clientProcessId;
1703
+ if (clientProcessId !== void 0) {
1704
+ const settleIfClientGone = () => {
1705
+ if (!processAlive(clientProcessId)) settle(departureCode());
1706
+ };
1707
+ clientWatch = setInterval(settleIfClientGone, clientProcessPollMs);
1708
+ clientWatch.unref();
1709
+ settleIfClientGone();
1710
+ }
1711
+ function settleOnAbort() {
1712
+ settleOnceIdle(departureCode);
1713
+ abortDeadline ??= setTimeout(() => settle(departureCode()), abortDrainDeadlineMs);
1714
+ abortDeadline.unref();
1715
+ }
1716
+ const hostShutdown = streams.signal;
1717
+ if (hostShutdown?.aborted === true) settleOnAbort();
1718
+ else hostShutdown?.addEventListener("abort", settleOnAbort, { once: true });
1719
+ });
1720
+ }
1721
+ function messageOf(error) {
1722
+ return error instanceof Error ? error.message : String(error);
1723
+ }
1724
+ function startServer(streams) {
1725
+ if (streams === void 0) {
1726
+ createServer(createConnection$1(ProposedFeatures$1.all));
1727
+ return;
1728
+ }
1729
+ return runServerOverStreams(streams);
1444
1730
  }
1445
1731
  //#endregion
1446
1732
  export { startServer };
1447
1733
 
1448
- //# sourceMappingURL=exports-DaxzMVtq.mjs.map
1734
+ //# sourceMappingURL=exports-B3xY_FHp.mjs.map