@prisma/orm-toolchain 8.0.0-rc.1-dev.32 → 8.0.0-rc.1-dev.34

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 (146) 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-B_oGFiYw-BqX49eW0.mjs → caught-errors-BZ-9WASe-DH4DaDha.mjs} +3 -3
  4. package/dist/{caught-errors-B_oGFiYw-BqX49eW0.mjs.map → caught-errors-BZ-9WASe-DH4DaDha.mjs.map} +1 -1
  5. package/dist/{cli-errors-CihMAEVj-C1uUYBop.mjs → cli-errors-C6_pH59O-CzD4SYcJ.mjs} +4 -3
  6. package/dist/{cli-errors-CihMAEVj-C1uUYBop.mjs.map → cli-errors-C6_pH59O-CzD4SYcJ.mjs.map} +1 -1
  7. package/dist/{cli-errors-C8DGzS94-CPP3UmRT.d.mts → cli-errors-f5PRtVdm-C6xVKeQn.d.mts} +8 -3
  8. package/dist/cli-errors-f5PRtVdm-C6xVKeQn.d.mts.map +1 -0
  9. package/dist/cli.mjs +961 -27
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/cli__commands__contract-emit.mjs +1 -1
  12. package/dist/cli__commands__contract-infer.mjs +1 -1
  13. package/dist/cli__commands__db-init.mjs +1 -1
  14. package/dist/cli__commands__db-schema.mjs +1 -1
  15. package/dist/cli__commands__db-sign.mjs +1 -1
  16. package/dist/cli__commands__db-update.mjs +1 -1
  17. package/dist/cli__commands__db-verify.mjs +1 -1
  18. package/dist/cli__commands__migrate.d.mts +2 -2
  19. package/dist/cli__commands__migrate.mjs +1 -1
  20. package/dist/cli__commands__migration-check.mjs +1 -1
  21. package/dist/cli__commands__migration-graph.d.mts +1 -1
  22. package/dist/cli__commands__migration-graph.mjs +1 -1
  23. package/dist/cli__commands__migration-list.d.mts +1 -1
  24. package/dist/cli__commands__migration-list.mjs +1 -1
  25. package/dist/cli__commands__migration-log.d.mts +1 -1
  26. package/dist/cli__commands__migration-log.mjs +1 -1
  27. package/dist/cli__commands__migration-new.mjs +1 -1
  28. package/dist/cli__commands__migration-plan.d.mts +1 -1
  29. package/dist/cli__commands__migration-plan.mjs +1 -1
  30. package/dist/cli__commands__migration-show.mjs +1 -1
  31. package/dist/cli__commands__migration-status.d.mts +1 -1
  32. package/dist/cli__commands__migration-status.mjs +1 -1
  33. package/dist/cli__commands__ref.mjs +1 -1
  34. package/dist/cli__commands__telemetry.mjs +1 -1
  35. package/dist/cli__control-api.d.mts +3 -3
  36. package/dist/cli__control-api.mjs +15 -15
  37. package/dist/cli__control-api__testing.d.mts +1 -1
  38. package/dist/{client-C4Gh4PBz-BMUlBcuE.mjs → client-BqhVohc5-DFRVWFps.mjs} +5 -5
  39. package/dist/{client-C4Gh4PBz-BMUlBcuE.mjs.map → client-BqhVohc5-DFRVWFps.mjs.map} +1 -1
  40. package/dist/{command-helpers-Dw3LDEu_-B4AETH4D.mjs → command-helpers-kD9CO1hd-BPhnkBin.mjs} +4 -4
  41. package/dist/{command-helpers-Dw3LDEu_-B4AETH4D.mjs.map → command-helpers-kD9CO1hd-BPhnkBin.mjs.map} +1 -1
  42. package/dist/{contract-at-errors-BsQiGdZC-D8l9-WWt.mjs → contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs} +3 -3
  43. package/dist/{contract-at-errors-BsQiGdZC-D8l9-WWt.mjs.map → contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs.map} +1 -1
  44. package/dist/{contract-emit-CIdgw3Kq-BcfYaUfn.mjs → contract-emit-BlvUNMHM-BEioUVR5.mjs} +6 -6
  45. package/dist/{contract-emit-CIdgw3Kq-BcfYaUfn.mjs.map → contract-emit-BlvUNMHM-BEioUVR5.mjs.map} +1 -1
  46. package/dist/{contract-emit-WIAaN0lC-DKOdtrUQ.mjs → contract-emit-CrYO0A8x-60BOqXFr.mjs} +5 -5
  47. package/dist/{contract-emit-WIAaN0lC-DKOdtrUQ.mjs.map → contract-emit-CrYO0A8x-60BOqXFr.mjs.map} +1 -1
  48. package/dist/contract-emit-Csa6R0gt-DvxFlS0O.mjs +2 -0
  49. package/dist/{contract-infer-xOEwVWds-CE5gw1PF.mjs → contract-infer-C8kLphsm-C7-AIYMc.mjs} +5 -5
  50. package/dist/{contract-infer-xOEwVWds-CE5gw1PF.mjs.map → contract-infer-C8kLphsm-C7-AIYMc.mjs.map} +1 -1
  51. package/dist/{contract-snapshot-resolution-BnH6_mw7-BrzAsS93.mjs → contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs} +4 -4
  52. package/dist/{contract-snapshot-resolution-BnH6_mw7-BrzAsS93.mjs.map → contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs.map} +1 -1
  53. package/dist/{contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs → contract-space-aggregate-loader-BpdB-mHG-BiU0IUeb.mjs} +4 -4
  54. package/dist/{contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs.map → contract-space-aggregate-loader-BpdB-mHG-BiU0IUeb.mjs.map} +1 -1
  55. package/dist/{db-init-CEk9Utl4-vGmJajwZ.mjs → db-init-CyNsXRAB-D3xWQ-vy.mjs} +7 -39
  56. package/dist/db-init-CyNsXRAB-D3xWQ-vy.mjs.map +1 -0
  57. package/dist/db-init-failure-XYOVL4o7-BitY_JYn.mjs +44 -0
  58. package/dist/db-init-failure-XYOVL4o7-BitY_JYn.mjs.map +1 -0
  59. package/dist/{db-schema-D_PJvBI3-BTnfCqbX.mjs → db-schema-7zNGHgYN-BVaRHPxg.mjs} +6 -6
  60. package/dist/{db-schema-D_PJvBI3-BTnfCqbX.mjs.map → db-schema-7zNGHgYN-BVaRHPxg.mjs.map} +1 -1
  61. package/dist/{db-sign-Bparnnii-Yd5pb4VF.mjs → db-sign-DAs6J3XG-xxP2CCnO.mjs} +8 -8
  62. package/dist/{db-sign-Bparnnii-Yd5pb4VF.mjs.map → db-sign-DAs6J3XG-xxP2CCnO.mjs.map} +1 -1
  63. package/dist/{db-update-CsKZyDYp-B8Zl7W4k.mjs → db-update-BX1sOuQk-CpeLgPeN.mjs} +7 -7
  64. package/dist/{db-update-CsKZyDYp-B8Zl7W4k.mjs.map → db-update-BX1sOuQk-CpeLgPeN.mjs.map} +1 -1
  65. package/dist/{db-verify-B33E7HXH-D87fiNt3.mjs → db-verify-CN4nmxxF-DSRWae0u.mjs} +7 -7
  66. package/dist/{db-verify-B33E7HXH-D87fiNt3.mjs.map → db-verify-CN4nmxxF-DSRWae0u.mjs.map} +1 -1
  67. package/dist/{format-CYdgHub4-Cs6VcFje.mjs → format-D5x0jz7q-xalz6Fkn.mjs} +5 -5
  68. package/dist/{format-CYdgHub4-Cs6VcFje.mjs.map → format-D5x0jz7q-xalz6Fkn.mjs.map} +1 -1
  69. package/dist/{framework-components-CXxMNF8E-C-g2cchI.mjs → framework-components-CPFWl2Ix-CrIZL3jG.mjs} +3 -3
  70. package/dist/{framework-components-CXxMNF8E-C-g2cchI.mjs.map → framework-components-CPFWl2Ix-CrIZL3jG.mjs.map} +1 -1
  71. package/dist/{init-B8U_9kn7-CdhTYHfO.mjs → init-BvLCfVjC-DOPO-TLF.mjs} +5 -5
  72. package/dist/{init-B8U_9kn7-CdhTYHfO.mjs.map → init-BvLCfVjC-DOPO-TLF.mjs.map} +1 -1
  73. package/dist/{inspect-live-schema-BAiaX0n9-DBQFEsMC.mjs → inspect-live-schema-BaLAtOgO-Bs0gs_yP.mjs} +5 -5
  74. package/dist/{inspect-live-schema-BAiaX0n9-DBQFEsMC.mjs.map → inspect-live-schema-BaLAtOgO-Bs0gs_yP.mjs.map} +1 -1
  75. package/dist/{invariants-CsxL0lbZ-B9Hfpj2R.mjs → invariants-1L2zfc6--BpedlAbF.mjs} +4 -4
  76. package/dist/{invariants-CsxL0lbZ-B9Hfpj2R.mjs.map → invariants-1L2zfc6--BpedlAbF.mjs.map} +1 -1
  77. package/dist/{legend-QYDKKevn-DCIlAPn4.mjs → legend-aXC5H1jH-Dg1yWonK.mjs} +3 -3
  78. package/dist/{legend-QYDKKevn-DCIlAPn4.mjs.map → legend-aXC5H1jH-Dg1yWonK.mjs.map} +1 -1
  79. package/dist/{migrate-DYx_CSbN-BuQ0lk-0.mjs → migrate-DRiUHRCS-Cci6EEZv.mjs} +32 -79
  80. package/dist/migrate-DRiUHRCS-Cci6EEZv.mjs.map +1 -0
  81. package/dist/migrate-failure-Bdr3AJee-C9yNeQXy.mjs +96 -0
  82. package/dist/migrate-failure-Bdr3AJee-C9yNeQXy.mjs.map +1 -0
  83. package/dist/{migrate-show-DWIvU6Y_-BQyWhZD1.d.mts → migrate-show-DutwCc2F-BhGfH7D-.d.mts} +5 -3
  84. package/dist/migrate-show-DutwCc2F-BhGfH7D-.d.mts.map +1 -0
  85. package/dist/{migrate-show-CPZEq35I-DeL3WVjs.mjs → migrate-show-bdXjSFgh-CQxl5yNp.mjs} +7 -7
  86. package/dist/migrate-show-bdXjSFgh-CQxl5yNp.mjs.map +1 -0
  87. package/dist/{migration-check-COMRj5eu-DbJgriA8.mjs → migration-check-aoZ8kXNA-DX2J84Cv.mjs} +7 -7
  88. package/dist/{migration-check-COMRj5eu-DbJgriA8.mjs.map → migration-check-aoZ8kXNA-DX2J84Cv.mjs.map} +1 -1
  89. package/dist/{migration-check-BUAcSrvA-DSS5Yvco.mjs → migration-check-of-RPYRk-HuXtDO8i.mjs} +6 -6
  90. package/dist/{migration-check-BUAcSrvA-DSS5Yvco.mjs.map → migration-check-of-RPYRk-HuXtDO8i.mjs.map} +1 -1
  91. package/dist/{migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs → migration-command-scaffold-zJFTGn5k-5AGczeSx.mjs} +5 -5
  92. package/dist/{migration-command-scaffold-CIMPoR6f-Ba-S9gXa.mjs.map → migration-command-scaffold-zJFTGn5k-5AGczeSx.mjs.map} +1 -1
  93. package/dist/{migration-graph-BsGstA5L-BQiNbrkP.mjs → migration-graph-D0KHjNJ--CWzX9Zzc.mjs} +10 -10
  94. package/dist/{migration-graph-BsGstA5L-BQiNbrkP.mjs.map → migration-graph-D0KHjNJ--CWzX9Zzc.mjs.map} +1 -1
  95. package/dist/{migration-graph-BtP1Va3T-C8PpuaYw.mjs → migration-graph-DmdVVJoZ-DDBKjUMz.mjs} +3 -3
  96. package/dist/{migration-graph-BtP1Va3T-C8PpuaYw.mjs.map → migration-graph-DmdVVJoZ-DDBKjUMz.mjs.map} +1 -1
  97. package/dist/{migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs → migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs} +5 -5
  98. package/dist/{migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs.map → migration-graph-command-render-BeuEyf2B-BNH9oUB_.mjs.map} +1 -1
  99. package/dist/{migration-graph-sections-CceYWPCP-LqImOaK1.mjs → migration-graph-sections-BWcFCOL6-_G0Wb4QR.mjs} +4 -4
  100. package/dist/{migration-graph-sections-CceYWPCP-LqImOaK1.mjs.map → migration-graph-sections-BWcFCOL6-_G0Wb4QR.mjs.map} +1 -1
  101. package/dist/{migration-list-BiVyonwG-CdMbBV5Z.mjs → migration-list-B0SANIeM-DiXQ9LyS.mjs} +8 -8
  102. package/dist/{migration-list-BiVyonwG-CdMbBV5Z.mjs.map → migration-list-B0SANIeM-DiXQ9LyS.mjs.map} +1 -1
  103. package/dist/{migration-list-AKRIIovW-BN-Zrwk0.mjs → migration-list-W0dqabIj-Dc2NH_LY.mjs} +3 -3
  104. package/dist/{migration-list-AKRIIovW-BN-Zrwk0.mjs.map → migration-list-W0dqabIj-Dc2NH_LY.mjs.map} +1 -1
  105. package/dist/{migration-log-Z3-L172x-CvQTNJvI.mjs → migration-log-B3iiP8ns-B4tdLSye.mjs} +9 -9
  106. package/dist/{migration-log-Z3-L172x-CvQTNJvI.mjs.map → migration-log-B3iiP8ns-B4tdLSye.mjs.map} +1 -1
  107. package/dist/{migration-log-table-JR7fFVbE-DR2mom6h.mjs → migration-log-table-DRiOnvzf-zTQBThqe.mjs} +3 -3
  108. package/dist/{migration-log-table-JR7fFVbE-DR2mom6h.mjs.map → migration-log-table-DRiOnvzf-zTQBThqe.mjs.map} +1 -1
  109. package/dist/{migration-new-DDnQd7Ql-1WT_J_zf.mjs → migration-new-Bf5K9fNK-Cd90rYmm.mjs} +5 -5
  110. package/dist/{migration-new-DDnQd7Ql-1WT_J_zf.mjs.map → migration-new-Bf5K9fNK-Cd90rYmm.mjs.map} +1 -1
  111. package/dist/{migration-new-ZlgxFcbH-CxlZs2hr.mjs → migration-new-YSdtJTRp-Dc06LNJe.mjs} +7 -7
  112. package/dist/{migration-new-ZlgxFcbH-CxlZs2hr.mjs.map → migration-new-YSdtJTRp-Dc06LNJe.mjs.map} +1 -1
  113. package/dist/{migration-path-target-yA4h5Zc6-DlzBblBG.mjs → migration-path-target-5r1leSW5-B0EMgvEv.mjs} +3 -3
  114. package/dist/{migration-path-target-yA4h5Zc6-DlzBblBG.mjs.map → migration-path-target-5r1leSW5-B0EMgvEv.mjs.map} +1 -1
  115. package/dist/{migration-plan-s94qwFHi-86F_Aklp.d.mts → migration-plan-4cnnP6yM-DXzRfi_A.d.mts} +3 -3
  116. package/dist/{migration-plan-s94qwFHi-86F_Aklp.d.mts.map → migration-plan-4cnnP6yM-DXzRfi_A.d.mts.map} +1 -1
  117. package/dist/{migration-plan-DiLJTAep-2B463CwW.mjs → migration-plan-CZY8HVCh-BbfQvxnb.mjs} +8 -8
  118. package/dist/{migration-plan-DiLJTAep-2B463CwW.mjs.map → migration-plan-CZY8HVCh-BbfQvxnb.mjs.map} +1 -1
  119. package/dist/{migration-plan-CROSunPS-B66Rh_6T.mjs → migration-plan-oterbw8h-_GrKbsRb.mjs} +5 -5
  120. package/dist/{migration-plan-CROSunPS-B66Rh_6T.mjs.map → migration-plan-oterbw8h-_GrKbsRb.mjs.map} +1 -1
  121. package/dist/{migration-show-mJD52S2d-DiD-rCBB.mjs → migration-show-iX2cduR4-C3-FENR4.mjs} +9 -9
  122. package/dist/{migration-show-mJD52S2d-DiD-rCBB.mjs.map → migration-show-iX2cduR4-C3-FENR4.mjs.map} +1 -1
  123. package/dist/{migration-status-7Zawokrj-BwTcRAjf.mjs → migration-status-DCAQ3_C1-ofDvCvUk.mjs} +12 -12
  124. package/dist/{migration-status-7Zawokrj-BwTcRAjf.mjs.map → migration-status-DCAQ3_C1-ofDvCvUk.mjs.map} +1 -1
  125. package/dist/{project-import-root-Bkz1gPB2-jhrMFebo.mjs → project-import-root-BPuwl2j1-DTX9G73z.mjs} +3 -3
  126. package/dist/{project-import-root-Bkz1gPB2-jhrMFebo.mjs.map → project-import-root-BPuwl2j1-DTX9G73z.mjs.map} +1 -1
  127. package/dist/{ref-DftuSibc-CasZ6LgA.mjs → ref-CVD6j3jA-BAgpZLNM.mjs} +5 -5
  128. package/dist/{ref-DftuSibc-CasZ6LgA.mjs.map → ref-CVD6j3jA-BAgpZLNM.mjs.map} +1 -1
  129. package/dist/{ref-Cycefq_T-DQE5AM66.mjs → ref-CaqNqeRF-cjWFAueu.mjs} +5 -5
  130. package/dist/{ref-Cycefq_T-DQE5AM66.mjs.map → ref-CaqNqeRF-cjWFAueu.mjs.map} +1 -1
  131. package/dist/{ref-resolution-Bi4lpxM8-BbfL_yv8.mjs → ref-resolution-D4fAdXo8-Dfaky0yw.mjs} +3 -3
  132. package/dist/{ref-resolution-Bi4lpxM8-BbfL_yv8.mjs.map → ref-resolution-D4fAdXo8-Dfaky0yw.mjs.map} +1 -1
  133. package/dist/{telemetry-LP1Suxsf-CY1l7lD0.mjs → telemetry-fKuZOFpu-DNUWfIHo.mjs} +4 -4
  134. package/dist/{telemetry-LP1Suxsf-CY1l7lD0.mjs.map → telemetry-fKuZOFpu-DNUWfIHo.mjs.map} +1 -1
  135. package/dist/{terminal-ui-JJKxvT0q-CPDEJqqU.mjs → terminal-ui-Cqz4LVL7-B0mcVdLy.mjs} +3 -3
  136. package/dist/{terminal-ui-JJKxvT0q-CPDEJqqU.mjs.map → terminal-ui-Cqz4LVL7-B0mcVdLy.mjs.map} +1 -1
  137. package/dist/{verify-wUSBDQwh-Bv3NV9WG.mjs → verify-Cogr_Fj9-D3lCWA6t.mjs} +3 -3
  138. package/dist/{verify-wUSBDQwh-Bv3NV9WG.mjs.map → verify-Cogr_Fj9-D3lCWA6t.mjs.map} +1 -1
  139. package/dist/vite-plugin-contract-emit.mjs +1 -1
  140. package/package.json +12 -12
  141. package/dist/cli-errors-C8DGzS94-CPP3UmRT.d.mts.map +0 -1
  142. package/dist/contract-emit-BAfPwP3y-DfV1Stry.mjs +0 -2
  143. package/dist/db-init-CEk9Utl4-vGmJajwZ.mjs.map +0 -1
  144. package/dist/migrate-DYx_CSbN-BuQ0lk-0.mjs.map +0 -1
  145. package/dist/migrate-show-CPZEq35I-DeL3WVjs.mjs.map +0 -1
  146. package/dist/migrate-show-DWIvU6Y_-BQyWhZD1.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"command-helpers-Dw3LDEu_-B4AETH4D.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/command-helpers-Dw3LDEu_.mjs"],"sourcesContent":["import { D as errorRuntime, b as errorOutputFormatMutex, f as errorInvalidOutputFormat, t as CliStructuredError } from \"./cli-errors-CihMAEVj.mjs\";\nimport { f as createColorFormatter, i as formatErrorOutput, p as formatDim, r as formatErrorJson, t as createTerminalUI } from \"./terminal-ui-JJKxvT0q.mjs\";\nimport \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { hasMigrations } from \"@internal/framework-components/control\";\nimport { APP_SPACE_ID as APP_SPACE_ID$1, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { blue, bold, cyan, dim, green, magenta } from \"colorette\";\nimport wrapAnsi from \"wrap-ansi\";\nimport stringWidth from \"string-width\";\nimport stripAnsi from \"strip-ansi\";\nimport { isCI } from \"ci-info\";\n//#region src/utils/formatters/styled.ts\n/**\n* Fixed width for left column in help output.\n*/\nconst LEFT_COLUMN_WIDTH$1 = 20;\n/**\n* Creates an arrow segment badge with green background and white text.\n* Body: green background with white \"prisma-next\" text\n* Tip: dark grey arrow pointing right (Powerline separator)\n*/\nfunction createPrismaNextBadge$1(useColor) {\n\tif (!useColor) return \"prisma-next\";\n\treturn bold(\"prisma-next\");\n}\n/**\n* Creates a padding function.\n*/\nfunction createPadFunction() {\n\treturn (s, w) => s + \" \".repeat(Math.max(0, w - s.length));\n}\n/**\n* Formats a header line: brand + operation + intent\n*/\nfunction formatHeaderLine$1(options) {\n\tif (options.operation) return `${options.brand} ${options.operation} → ${options.intent}`;\n\treturn `${options.brand} ${options.intent}`;\n}\n/**\n* Formats a \"Read more\" URL line.\n* The \"Read more\" label is in default color (not cyan), and the URL is blue.\n*/\nfunction formatReadMoreLine$1(options) {\n\tconst labelPadded = createPadFunction()(\"Read more\", options.maxLabelWidth);\n\tconst valueColored = options.useColor ? blue(options.url) : options.url;\n\treturn `${options.formatDimText(\"│\")} ${labelPadded} ${valueColored}`;\n}\n/**\n* Pads text to a fixed width, accounting for ANSI escape codes.\n* Uses string-width to measure the actual display width.\n*/\nfunction padToFixedWidth(text, width) {\n\tconst actualWidth = stringWidth(text);\n\tconst padding = Math.max(0, width - actualWidth);\n\treturn text + \" \".repeat(padding);\n}\n/**\n* Renders a command tree structure.\n* Handles both single-level (subcommands of a command) and multi-level (top-level commands with subcommands) trees.\n*/\nfunction renderCommandTree(options) {\n\tconst { commands, useColor, formatDimText, hasItemsAfter, continuationPrefix } = options;\n\tconst lines = [];\n\tif (commands.length === 0) return lines;\n\tfor (let i = 0; i < commands.length; i++) {\n\t\tconst cmd = commands[i];\n\t\tif (!cmd) continue;\n\t\tconst subcommands = cmd.commands.filter((subcmd) => !subcmd.name().startsWith(\"_\"));\n\t\tconst isLastCommand = i === commands.length - 1;\n\t\tif (subcommands.length > 0) {\n\t\t\tconst treePrefix = `${isLastCommand && !hasItemsAfter ? formatDimText(\"└\") : formatDimText(\"├\")}─ `;\n\t\t\tconst treePrefixWidth = stringWidth(stripAnsi(treePrefix));\n\t\t\tconst remainingWidth = LEFT_COLUMN_WIDTH$1 - treePrefixWidth;\n\t\t\tconst commandNamePadded = padToFixedWidth(cmd.name(), remainingWidth);\n\t\t\tconst commandNameColored = useColor ? cyan(commandNamePadded) : commandNamePadded;\n\t\t\tlines.push(`${formatDimText(\"│\")} ${treePrefix}${commandNameColored}`);\n\t\t\tfor (let j = 0; j < subcommands.length; j++) {\n\t\t\t\tconst subcmd = subcommands[j];\n\t\t\t\tif (!subcmd) continue;\n\t\t\t\tconst isLastSubcommand = j === subcommands.length - 1;\n\t\t\t\tconst shortDescription = subcmd.description() || \"\";\n\t\t\t\tconst treeChar = isLastSubcommand ? \"└\" : \"├\";\n\t\t\t\tconst continuation = continuationPrefix ?? (isLastCommand && isLastSubcommand && !hasItemsAfter ? \" \" : formatDimText(\"│\"));\n\t\t\t\tconst subTreePrefix = `${continuation === \" \" ? \" \" : continuation} ${formatDimText(treeChar)}─ `;\n\t\t\t\tconst subTreePrefixWidth = stringWidth(stripAnsi(subTreePrefix));\n\t\t\t\tconst subRemainingWidth = LEFT_COLUMN_WIDTH$1 - subTreePrefixWidth;\n\t\t\t\tconst subcommandNamePadded = padToFixedWidth(subcmd.name(), subRemainingWidth);\n\t\t\t\tconst subcommandNameColored = useColor ? cyan(subcommandNamePadded) : subcommandNamePadded;\n\t\t\t\tlines.push(`${formatDimText(\"│\")} ${subTreePrefix}${subcommandNameColored} ${shortDescription}`);\n\t\t\t}\n\t\t} else {\n\t\t\tconst treePrefix = `${isLastCommand && !hasItemsAfter ? formatDimText(\"└\") : formatDimText(\"├\")}─ `;\n\t\t\tconst treePrefixWidth = stringWidth(stripAnsi(treePrefix));\n\t\t\tconst remainingWidth = LEFT_COLUMN_WIDTH$1 - treePrefixWidth;\n\t\t\tconst commandNamePadded = padToFixedWidth(cmd.name(), remainingWidth);\n\t\t\tconst commandNameColored = useColor ? cyan(commandNamePadded) : commandNamePadded;\n\t\t\tconst shortDescription = cmd.description() || \"\";\n\t\t\tlines.push(`${formatDimText(\"│\")} ${treePrefix}${commandNameColored} ${shortDescription}`);\n\t\t}\n\t}\n\treturn lines;\n}\n/**\n* Formats the header in the new experimental visual style.\n* This header appears at the start of command output, showing the operation,\n* intent, documentation link, and parameters.\n*/\nfunction formatStyledHeader(options) {\n\tconst lines = [];\n\tconst useColor = options.flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst brand = createPrismaNextBadge$1(useColor);\n\tconst operation = useColor ? bold(options.command) : options.command;\n\tconst intent = formatDimText(options.description);\n\tlines.push(formatHeaderLine$1({\n\t\tbrand,\n\t\toperation,\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tfor (const detail of options.details) {\n\t\tconst labelPadded = padToFixedWidth(`${detail.label}:`, LEFT_COLUMN_WIDTH$1);\n\t\tconst labelColored = useColor ? cyan(labelPadded) : labelPadded;\n\t\tlines.push(`${formatDimText(\"│\")} ${labelColored} ${detail.value}`);\n\t}\n\tif (options.url) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(formatReadMoreLine$1({\n\t\t\turl: options.url,\n\t\t\tmaxLabelWidth: LEFT_COLUMN_WIDTH$1,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n/**\n* Formats a success message in the styled output format.\n*/\nfunction formatSuccessMessage(flags) {\n\treturn `${createColorFormatter(flags.color !== false, green)(\"✔\")} Success`;\n}\n//#endregion\n//#region src/utils/formatters/help.ts\n/**\n* Fixed width for left column in help output.\n* Must match the value in styled.ts.\n*/\nconst LEFT_COLUMN_WIDTH = 20;\n/**\n* Minimum width for right column wrapping in help output.\n*/\nconst RIGHT_COLUMN_MIN_WIDTH = 40;\n/**\n* Maximum width for right column wrapping in help output (when terminal is wide enough).\n*/\nconst RIGHT_COLUMN_MAX_WIDTH = 90;\n/**\n* Gets the terminal width, or returns a default if not available.\n*/\nfunction getTerminalWidth() {\n\tconst terminalWidth = process.stderr.columns || process.stdout.columns;\n\tconst envWidth = Number.parseInt(process.env[\"CLI_WIDTH\"] || \"\", 10);\n\treturn terminalWidth || (Number.isFinite(envWidth) ? envWidth : 80);\n}\n/**\n* Calculates the available width for the right column based on terminal width.\n*/\nfunction calculateRightColumnWidth() {\n\tconst availableWidth = getTerminalWidth() - 2 - LEFT_COLUMN_WIDTH - 2;\n\treturn Math.max(RIGHT_COLUMN_MIN_WIDTH, Math.min(availableWidth, RIGHT_COLUMN_MAX_WIDTH));\n}\n/**\n* Creates the CLI brand badge.\n*/\nfunction createPrismaNextBadge(useColor) {\n\treturn useColor ? bold(\"prisma-next\") : \"prisma-next\";\n}\n/**\n* Formats a header line: brand + operation + intent\n*/\nfunction formatHeaderLine(options) {\n\tif (options.operation) return `${options.brand} ${options.operation} → ${options.intent}`;\n\treturn `${options.brand} ${options.intent}`;\n}\n/**\n* Wraps text to fit within a specified width using wrap-ansi.\n*/\nfunction wrapTextAnsi(text, width) {\n\treturn wrapAnsi(text, width, {\n\t\thard: false,\n\t\ttrim: true\n\t}).split(\"\\n\");\n}\n/**\n* Formats a default value as \"default: <value>\" with dimming.\n*/\nfunction formatDefaultValue(value, useColor) {\n\tconst defaultText = `default: ${String(value)}`;\n\treturn useColor ? dim(defaultText) : defaultText;\n}\n/**\n* Formats a \"Read more\" URL line.\n*/\nfunction formatReadMoreLine(options) {\n\tconst labelPadded = `Read more${\" \".repeat(Math.max(0, options.maxLabelWidth - 9))}`;\n\tconst valueColored = options.useColor ? blue(options.url) : options.url;\n\treturn `${options.formatDimText(\"│\")} ${labelPadded} ${valueColored}`;\n}\n/**\n* Formats multiline description with \"Prisma Next\" in green.\n*/\nfunction formatMultilineDescription(options) {\n\tconst lines = [];\n\tconst formatGreen = (text) => options.useColor ? green(text) : text;\n\tconst wrapWidth = 24 + calculateRightColumnWidth() - 2;\n\tfor (const descLine of options.descriptionLines) {\n\t\tconst wrappedLines = wrapTextAnsi(descLine.replace(/Prisma Next/g, (match) => formatGreen(match)), wrapWidth);\n\t\tfor (const wrappedLine of wrappedLines) lines.push(`${options.formatDimText(\"│\")} ${wrappedLine}`);\n\t}\n\treturn lines;\n}\n/**\n* Maps command paths to their documentation URLs.\n*/\nfunction getCommandDocsUrl(commandPath) {\n\treturn {\n\t\t\"contract emit\": \"https://pris.ly/contract-emit\",\n\t\t\"contract infer\": \"https://pris.ly/contract-infer\",\n\t\t\"db schema\": \"https://pris.ly/db-schema\",\n\t\t\"db verify\": \"https://pris.ly/db-verify\",\n\t\t\"db update\": \"https://pris.ly/db-update\",\n\t\t\"migration plan\": \"https://pris.ly/migration-plan\",\n\t\tmigrate: \"https://pris.ly/migrate\",\n\t\t\"migration show\": \"https://pris.ly/migration-show\",\n\t\t\"migration status\": \"https://pris.ly/migration-status\"\n\t}[commandPath];\n}\n/**\n* Builds the full command path from a command and its parents.\n*/\nfunction buildCommandPath(command) {\n\tconst parts = [];\n\tlet current = command;\n\twhile (current && current.name() !== \"prisma-next\") {\n\t\tparts.unshift(current.name());\n\t\tcurrent = current.parent ?? void 0;\n\t}\n\treturn parts.join(\" \");\n}\n/**\n* Formats help output for a command using the styled format.\n*/\nfunction formatCommandHelp(options) {\n\tconst { command, flags } = options;\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst commandPath = buildCommandPath(command);\n\tconst shortDescription = command.description() || \"\";\n\tconst longDescription = getLongDescription(command);\n\tconst argsSuffix = command.registeredArguments.map((arg) => arg.required ? `<${arg.name()}>` : `[${arg.name()}]`).join(\" \");\n\tconst brand = createPrismaNextBadge(useColor);\n\tconst commandWithArgs = argsSuffix ? `${commandPath} ${argsSuffix}` : commandPath;\n\tconst operation = useColor ? bold(commandWithArgs) : commandWithArgs;\n\tconst intent = formatDimText(shortDescription);\n\tlines.push(formatHeaderLine({\n\t\tbrand,\n\t\toperation,\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tconst optionsList = command.options.map((opt) => {\n\t\tconst description = opt.description || \"\";\n\t\tconst defaultValue = opt.defaultValue;\n\t\treturn {\n\t\t\tflags: opt.flags,\n\t\t\tdescription,\n\t\t\tdefaultValue\n\t\t};\n\t});\n\tconst subcommands = command.commands.filter((cmd) => !cmd.name().startsWith(\"_\"));\n\tif (subcommands.length > 0) {\n\t\tconst treeLines = renderCommandTree({\n\t\t\tcommands: subcommands,\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\thasItemsAfter: optionsList.length > 0\n\t\t});\n\t\tlines.push(...treeLines);\n\t}\n\tif (subcommands.length > 0 && optionsList.length > 0) lines.push(formatDimText(\"│\"));\n\tif (optionsList.length > 0) for (const opt of optionsList) {\n\t\tconst flagsPadded = padToFixedWidth(opt.flags, LEFT_COLUMN_WIDTH);\n\t\tlet flagsColored = flagsPadded;\n\t\tif (useColor) {\n\t\t\tflagsColored = flagsPadded.replace(/(<[^>]+>)/g, (match) => magenta(match));\n\t\t\tflagsColored = cyan(flagsColored);\n\t\t}\n\t\tconst rightColumnWidth = calculateRightColumnWidth();\n\t\tconst wrappedDescription = wrapTextAnsi(opt.description, rightColumnWidth);\n\t\tlines.push(`${formatDimText(\"│\")} ${flagsColored} ${wrappedDescription[0] || \"\"}`);\n\t\tfor (let i = 1; i < wrappedDescription.length; i++) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${wrappedDescription[i] || \"\"}`);\n\t\t}\n\t\tif (opt.defaultValue !== void 0) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tconst defaultText = formatDefaultValue(opt.defaultValue, useColor);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${defaultText}`);\n\t\t}\n\t}\n\tconst docsUrl = getCommandDocsUrl(commandPath);\n\tif (docsUrl) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(formatReadMoreLine({\n\t\t\turl: docsUrl,\n\t\t\tmaxLabelWidth: LEFT_COLUMN_WIDTH,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tconst examples = getCommandExamples(command);\n\tif (examples && examples.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(`${formatDimText(\"│\")} ${formatDimText(\"Examples:\")}`);\n\t\tfor (const example of examples) lines.push(`${formatDimText(\"│\")} ${useColor ? dim(\"$\") : \"$\"} ${example}`);\n\t}\n\tconst seeAlso = getCommandSeeAlso(command);\n\tif (seeAlso && seeAlso.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(`${formatDimText(\"│\")} ${formatDimText(\"See also:\")}`);\n\t\tfor (const ref of seeAlso) lines.push(`${formatDimText(\"│\")} ${ref.verb} ${formatDimText(ref.oneLiner)}`);\n\t}\n\tif (longDescription) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tconst descriptionLines = longDescription.split(\"\\n\").filter((line) => line.trim().length > 0);\n\t\tlines.push(...formatMultilineDescription({\n\t\t\tdescriptionLines,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n/**\n* Formats help output for the root program using the styled format.\n*/\nfunction formatRootHelp(options) {\n\tconst { program, flags } = options;\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst brand = createPrismaNextBadge(useColor);\n\tconst intent = formatDimText(\"Manage your data layer\");\n\tlines.push(formatHeaderLine({\n\t\tbrand,\n\t\toperation: \"\",\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tconst topLevelCommands = program.commands.filter((cmd) => !cmd.name().startsWith(\"_\") && cmd.name() !== \"help\");\n\tconst globalOptions = program.options.map((opt) => {\n\t\tconst description = opt.description || \"\";\n\t\tconst defaultValue = opt.defaultValue;\n\t\treturn {\n\t\t\tflags: opt.flags,\n\t\t\tdescription,\n\t\t\tdefaultValue\n\t\t};\n\t});\n\tif (topLevelCommands.length > 0) {\n\t\tconst treeLines = renderCommandTree({\n\t\t\tcommands: topLevelCommands,\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\thasItemsAfter: globalOptions.length > 0\n\t\t});\n\t\tlines.push(...treeLines);\n\t}\n\tif (topLevelCommands.length > 0 && globalOptions.length > 0) lines.push(formatDimText(\"│\"));\n\tif (globalOptions.length > 0) for (const opt of globalOptions) {\n\t\tconst flagsPadded = padToFixedWidth(opt.flags, LEFT_COLUMN_WIDTH);\n\t\tlet flagsColored = flagsPadded;\n\t\tif (useColor) {\n\t\t\tflagsColored = flagsPadded.replace(/(<[^>]+>)/g, (match) => magenta(match));\n\t\t\tflagsColored = cyan(flagsColored);\n\t\t}\n\t\tconst rightColumnWidth = calculateRightColumnWidth();\n\t\tconst wrappedDescription = wrapTextAnsi(opt.description, rightColumnWidth);\n\t\tlines.push(`${formatDimText(\"│\")} ${flagsColored} ${wrappedDescription[0] || \"\"}`);\n\t\tfor (let i = 1; i < wrappedDescription.length; i++) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${wrappedDescription[i] || \"\"}`);\n\t\t}\n\t\tif (opt.defaultValue !== void 0) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tconst defaultText = formatDefaultValue(opt.defaultValue, useColor);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${defaultText}`);\n\t\t}\n\t}\n\tconst formatGreen = (text) => useColor ? green(text) : text;\n\tconst descriptionLines = [`Use ${formatGreen(\"Prisma Next\")} to define your data layer as a contract. Sign your database and application with the same contract to guarantee compatibility. Plan and apply migrations to safely evolve your schema.`];\n\tif (descriptionLines.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(...formatMultilineDescription({\n\t\t\tdescriptionLines,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/utils/is-ci.ts\n/**\n* Returns true when the process is running in any CI environment recognised\n* by the `ci-info` package. The single source of truth for CI detection\n* across this CLI — colour-output suppression and telemetry-skip both call\n* this helper, so neither path drifts from the other when a new CI provider\n* is added upstream.\n*\n* `ci-info` checks the standard `CI=true` marker plus dozens of\n* provider-specific environment variables (Buildkite, Jenkins, Drone,\n* Bitbucket Pipelines, Azure Pipelines, AWS CodeBuild, …) that the raw\n* `process.env.CI` read misses.\n*\n*/\nfunction isCI$1() {\n\treturn isCI;\n}\n//#endregion\n//#region src/utils/result-handler.ts\n/**\n* Processes a CLI command result, handling both success and error cases.\n* Formats output appropriately and returns the exit code.\n* Never throws - returns exit code for commands to use with process.exit().\n*\n* Error output:\n* - JSON mode: JSON error to stdout (piped) via ui.output(), human sees nothing on stderr.\n* - Interactive: human-readable error to stderr.\n*/\nfunction handleResult(result, flags, ui, onSuccess) {\n\tif (result.ok) {\n\t\tif (onSuccess) onSuccess(result.value);\n\t\treturn 0;\n\t}\n\tconst envelope = result.failure.toEnvelope();\n\tif (flags.json) ui.output(formatErrorJson(envelope));\n\telse ui.error(formatErrorOutput(envelope, flags));\n\treturn result.failure.code === \"CLI.INIT_USER_ABORTED\" ? 3 : 2;\n}\n//#endregion\n//#region src/utils/global-flags.ts\nfunction isJsonFlagSet(json) {\n\treturn json === true;\n}\nfunction resolveOutputFormat(options) {\n\tconst formatOption = options.format;\n\tconst jsonFlag = isJsonFlagSet(options.json);\n\tif (formatOption !== void 0) {\n\t\tif (formatOption !== \"pretty\" && formatOption !== \"json\") throw errorInvalidOutputFormat(formatOption);\n\t\tif (jsonFlag && formatOption === \"pretty\") throw errorOutputFormatMutex();\n\t\treturn {\n\t\t\tformat: formatOption,\n\t\t\texplicitFormat: true\n\t\t};\n\t}\n\tif (jsonFlag) return {\n\t\tformat: \"json\",\n\t\texplicitFormat: false\n\t};\n\tif (!process.stdout.isTTY) return {\n\t\tformat: \"json\",\n\t\texplicitFormat: false\n\t};\n\treturn {\n\t\tformat: \"pretty\",\n\t\texplicitFormat: false\n\t};\n}\nfunction inferJsonModeForParseError(options) {\n\tif (options.format === \"json\") return true;\n\tif (isJsonFlagSet(options.json) && options.format !== \"pretty\") return true;\n\tif (options.format !== void 0) return false;\n\treturn !process.stdout.isTTY;\n}\nfunction emitGlobalFlagParseError(error, options) {\n\tconst jsonMode = inferJsonModeForParseError(options);\n\tconst flags = {\n\t\tformat: jsonMode ? \"json\" : \"pretty\",\n\t\texplicitFormat: false,\n\t\t...jsonMode ? { json: true } : {},\n\t\tcolor: false,\n\t\tverbose: 0,\n\t\tinteractive: false\n\t};\n\tconst ui = createTerminalUI(flags);\n\tconst exitCode = handleResult(notOk(error), flags, ui);\n\tprocess.exit(exitCode);\n}\n/**\n* Parses global flags from CLI options.\n* Handles verbosity flags (-v, --trace), output format (--format, --json),\n* quiet mode, color, interactivity (--interactive/--no-interactive), and\n* auto-accept (-y/--yes).\n*\n* On invalid or conflicting format flags, prints a structured CLI error\n* envelope and exits with code 2.\n*/\nfunction parseGlobalFlagsOrExit(options) {\n\ttry {\n\t\treturn parseGlobalFlags(options);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) emitGlobalFlagParseError(error, options);\n\t\tthrow error;\n\t}\n}\n/**\n* Parses global flags from CLI options.\n* Handles verbosity flags (-v, --trace), output format (--format, --json),\n* quiet mode, color, interactivity (--interactive/--no-interactive), and\n* auto-accept (-y/--yes).\n*\n* Throws {@link CliStructuredError} for invalid or conflicting format flags.\n*/\nfunction parseGlobalFlags(options) {\n\tconst { format, explicitFormat } = resolveOutputFormat(options);\n\tconst flags = {\n\t\tformat,\n\t\texplicitFormat\n\t};\n\tif (format === \"json\") flags.json = true;\n\tif (options.quiet || options.q) flags.quiet = true;\n\tif (options.trace || process.env[\"PRISMA_NEXT_TRACE\"] === \"1\") flags.verbose = 2;\n\telse if (options.verbose || options.v || process.env[\"PRISMA_NEXT_DEBUG\"] === \"1\") flags.verbose = 1;\n\telse flags.verbose = 0;\n\tif (process.env[\"NO_COLOR\"] || flags.json) flags.color = false;\n\telse if (options[\"no-color\"]) flags.color = false;\n\telse if (options.color !== void 0) flags.color = options.color;\n\telse flags.color = process.stdout.isTTY && !isCI$1();\n\tif (options[\"no-interactive\"]) flags.interactive = false;\n\telse if (options.interactive !== void 0) flags.interactive = options.interactive;\n\telse flags.interactive = !!process.stdout.isTTY;\n\tif (options.yes || options.y) flags.yes = true;\n\treturn flags;\n}\n/**\n* Bridges the two TTY checks (stdout via `flags`, stdin via\n* `process.stdin.isTTY`) into the `canPrompt` boolean the interactive\n* `init` flow consumes.\n*\n* Per the [Style Guide § Interactivity](../../../../../../../docs/CLI%20Style%20Guide.md#interactivity):\n*\n* - `flags.interactive` governs *decoration* (TerminalUI, intro/outro,\n* spinners) and is derived from stdout-TTY by `parseGlobalFlags`,\n* honouring `--interactive` / `--no-interactive`.\n* - Prompting additionally requires a stdin TTY — closing stdin is a\n* common signal in CI / agent environments even when stdout stays\n* attached.\n* - `--interactive` is the explicit override: when the user passes it,\n* we honour it (e.g. testing flows where stdin is stubbed).\n*\n* Single source of truth for the interactive-prompt decision: both the\n* `init` action handler and the preAction telemetry bridge derive\n* prompt-eligibility from this helper so they cannot drift. Lives in\n* `global-flags` (alongside `parseGlobalFlags`) to keep\n* `utils/telemetry` and `commands/init/index` free of an import cycle.\n*\n* Exported so callers and tests can derive the same value without\n* touching `process` globals.\n*/\nfunction deriveCanPrompt(opts) {\n\tif (opts.optionInteractive === true) return true;\n\tif (opts.flagsInteractive === false) return false;\n\treturn opts.stdinIsTTY;\n}\n//#endregion\n//#region src/utils/command-helpers.ts\nconst longDescriptions = /* @__PURE__ */ new WeakMap();\nconst commandExamples = /* @__PURE__ */ new WeakMap();\nconst commandSeeAlso = /* @__PURE__ */ new WeakMap();\n/**\n* Sets both short and long descriptions for a command.\n* The short description is used in command trees and headers.\n* The long description is shown at the bottom of help output.\n*/\nfunction setCommandDescriptions(command, shortDescription, longDescription) {\n\tcommand.description(shortDescription);\n\tif (longDescription) longDescriptions.set(command, longDescription);\n\treturn command;\n}\n/**\n* Sets copy-pastable examples for a command, shown in help text.\n*/\nfunction setCommandExamples(command, examples) {\n\tcommandExamples.set(command, examples);\n\treturn command;\n}\n/**\n* Gets the long description from a command if it was set via setCommandDescriptions.\n*/\nfunction getLongDescription(command) {\n\treturn longDescriptions.get(command);\n}\n/**\n* Gets examples from a command if set via setCommandExamples.\n*/\nfunction getCommandExamples(command) {\n\treturn commandExamples.get(command);\n}\n/**\n* Sets cross-references to related commands, rendered in a \"See also\"\n* section below the Examples block in help output.\n*/\nfunction setCommandSeeAlso(command, refs) {\n\tcommandSeeAlso.set(command, refs);\n\treturn command;\n}\n/**\n* Gets the see-also cross-references from a command.\n*/\nfunction getCommandSeeAlso(command) {\n\treturn commandSeeAlso.get(command);\n}\n/**\n* Resolves the absolute path to contract.json from the config.\n*/\nfunction resolveContractPath(config) {\n\tif (config.contract?.output === void 0) throw errorRuntime(\"CONFIG.VALIDATION_FAILED\", \"config.contract.output is required to resolve the contract path\", {\n\t\twhy: \"CLI commands read the emitted contract from config.contract.output; the config has no value to read.\",\n\t\tfix: \"Ensure your prisma-next.config.ts goes through `defineConfig()`, which normalises a default output when the provider supplies an input path, or set `contract.output` explicitly.\"\n\t});\n\treturn resolve(config.contract.output);\n}\n/**\n* Resolves the migrations directory and config path from CLI options.\n* Shared by migrate, migration-plan, and migration-status.\n*\n* - `migrationsDir` is the project's top-level `migrations/` directory\n* (the root that the aggregate loader walks for every contract space).\n* - `appMigrationsDir` is the app subspace directory under it\n* (`<migrationsDir>/<APP_SPACE_ID>/`). Every per-app reader / writer\n* (`migration new`, `migration plan`, `migrate`,\n* `migration status`, `migration show`, `migration ref`) operates on\n* this directory. Extensions own their own `migrations/<spaceId>/`.\n* - `refsDir` is the app's refs directory (`<appMigrationsDir>/refs/`).\n* The framework does not maintain refs at the migrations root.\n*\n* `cwd` is the directory the command was invoked from; every relative path in\n* the result is computed against it.\n*/\nfunction resolveMigrationPaths(configOption, config, cwd) {\n\tconst resolvedConfigPath = configOption ? resolve(cwd, configOption) : void 0;\n\tconst configPath = resolvedConfigPath ? relative(cwd, resolvedConfigPath) : \"prisma-next.config.ts\";\n\tconst migrationsDir = resolve(resolvedConfigPath ? resolve(resolvedConfigPath, \"..\") : cwd, config.migrations?.dir ?? \"migrations\");\n\tconst migrationsRelative = relative(cwd, migrationsDir);\n\tconst appMigrationsDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID$1);\n\treturn {\n\t\tconfigPath,\n\t\tmigrationsDir,\n\t\tmigrationsRelative,\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative: relative(cwd, appMigrationsDir),\n\t\trefsDir: resolve(appMigrationsDir, \"refs\")\n\t};\n}\nfunction collectDeclaredInvariants(graph) {\n\tconst declared = /* @__PURE__ */ new Set();\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) for (const inv of edge.invariants) declared.add(inv);\n\treturn declared;\n}\n/**\n* Maps a `MigrationEdge` to the structural-edge shape used in the\n* `MIGRATION.NO_INVARIANT_PATH` error envelope. Shared between\n* `migrate` and `migration status` so both commands surface\n* the same JSON wire shape when an invariant-aware route is unsatisfiable.\n*/\nfunction toStructuralEdge(edge) {\n\treturn {\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tinvariants: edge.invariants\n\t};\n}\nfunction targetSupportsMigrations(target) {\n\treturn hasMigrations(target);\n}\n/**\n* Hangs up without letting the hang-up decide the command's result. A rejection out of a\n* `finally` replaces the value the `try`/`catch` already returned, so an unguarded close turns a\n* mapped connection error into an unmapped one — and that is the case it hits most, because a\n* `connect()` that failed leaves nothing to close.\n*/\nasync function closeQuietly(client) {\n\ttry {\n\t\tawait client.close();\n\t} catch {}\n}\nfunction getTargetMigrations(target) {\n\treturn hasMigrations(target) ? target.migrations : void 0;\n}\n/**\n* Reads and parses contract.json, validating the framework-level envelope\n* fields (storageHash, schemaVersion, target, targetFamily).\n*\n* Family-specific validation (storage structure, codec mappings, etc.)\n* happens downstream in the control client via the family instance.\n*/\nasync function readContractEnvelope(config) {\n\tconst contractPath = resolveContractPath(config);\n\tconst content = await readFile(contractPath, \"utf-8\");\n\tconst json = JSON.parse(content);\n\tconst { schemaVersion, target, targetFamily, profileHash } = json;\n\tconst storageHash = json[\"storage\"]?.[\"storageHash\"];\n\tif (typeof storageHash !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \\`prisma-next contract emit\\` to regenerate.`, { where: { path: contractPath } });\n\tif (typeof schemaVersion !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });\n\tif (typeof target !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });\n\tif (typeof targetFamily !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });\n\treturn {\n\t\t...json,\n\t\tstorageHash,\n\t\tschemaVersion,\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...typeof profileHash === \"string\" ? { profileHash } : {}\n\t};\n}\n/**\n* Masks credentials in a database connection URL.\n* Handles standard URLs (username + password + query params) and libpq-style key=value strings.\n*/\nfunction maskConnectionUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tif (parsed.username) parsed.username = \"****\";\n\t\tif (parsed.password) parsed.password = \"****\";\n\t\tfor (const key of [...parsed.searchParams.keys()]) if (/password/i.test(key)) parsed.searchParams.set(key, \"****\");\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn url.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n/**\n* Strips raw connection URL fragments from an error message to prevent credential leakage.\n* Call this before surfacing driver errors to the user.\n*/\nfunction sanitizeErrorMessage(message, connectionUrl) {\n\tif (!connectionUrl) return message;\n\ttry {\n\t\tconst parsed = new URL(connectionUrl);\n\t\tlet sanitized = message;\n\t\tsanitized = sanitized.replaceAll(connectionUrl, maskConnectionUrl(connectionUrl));\n\t\tif (parsed.password) sanitized = sanitized.replaceAll(parsed.password, \"****\");\n\t\tif (parsed.username) sanitized = sanitized.replaceAll(parsed.username, \"****\");\n\t\treturn sanitized;\n\t} catch {\n\t\treturn message.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n/**\n* Registers the global CLI options shared by every command:\n* --format, --json, -q/--quiet, -v/--verbose, --trace, --color, --no-color,\n* --interactive, --no-interactive, -y/--yes.\n*\n* Also sets up the styled help formatter.\n*/\nfunction addGlobalOptions(command) {\n\treturn command.configureHelp({ formatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t} }).option(\"--format <pretty|json>\", \"Output format (default: pretty, or json when stdout is not a TTY)\").option(\"--json\", \"Output as JSON (alias for --format json)\").option(\"-q, --quiet\", \"Quiet mode: errors only\").option(\"-v, --verbose\", \"Verbose output: debug info, timings\").option(\"--trace\", \"Trace output: deep internals, stack traces\").option(\"--color\", \"Force color output\").option(\"--no-color\", \"Disable color output\").option(\"--interactive\", \"Force interactive mode\").option(\"--no-interactive\", \"Disable interactive prompts\").option(\"-y, --yes\", \"Auto-accept prompts\");\n}\n//#endregion\nexport { formatSuccessMessage as C, formatStyledHeader as S, parseGlobalFlagsOrExit as _, maskConnectionUrl as a, formatCommandHelp as b, resolveMigrationPaths as c, setCommandExamples as d, setCommandSeeAlso as f, parseGlobalFlags as g, deriveCanPrompt as h, getTargetMigrations as i, sanitizeErrorMessage as l, toStructuralEdge as m, closeQuietly as n, readContractEnvelope as o, targetSupportsMigrations as p, collectDeclaredInvariants as r, resolveContractPath as s, addGlobalOptions as t, setCommandDescriptions as u, handleResult as v, formatRootHelp as x, isCI$1 as y };\n\n//# sourceMappingURL=command-helpers-Dw3LDEu_.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,sBAAsB;;;;;;AAM5B,SAAS,wBAAwB,UAAU;CAC1C,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,KAAK,aAAa;AAC1B;;;;AAIA,SAAS,oBAAoB;CAC5B,QAAQ,GAAG,MAAM,IAAI,IAAI,OAAO,KAAK,IAAI,GAAG,IAAI,EAAE,MAAM,CAAC;AAC1D;;;;AAIA,SAAS,mBAAmB,SAAS;CACpC,IAAI,QAAQ,WAAW,OAAO,GAAG,QAAQ,MAAM,GAAG,QAAQ,UAAU,KAAK,QAAQ;CACjF,OAAO,GAAG,QAAQ,MAAM,GAAG,QAAQ;AACpC;;;;;AAKA,SAAS,qBAAqB,SAAS;CACtC,MAAM,cAAc,kBAAkB,CAAC,CAAC,aAAa,QAAQ,aAAa;CAC1E,MAAM,eAAe,QAAQ,WAAW,KAAK,QAAQ,GAAG,IAAI,QAAQ;CACpE,OAAO,GAAG,QAAQ,cAAc,GAAG,EAAE,GAAG,YAAY,IAAI;AACzD;;;;;AAKA,SAAS,gBAAgB,MAAM,OAAO;CACrC,MAAM,cAAc,YAAY,IAAI;CACpC,MAAM,UAAU,KAAK,IAAI,GAAG,QAAQ,WAAW;CAC/C,OAA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BAAiB,qCAAqC,CAAC,CAAC,OAAO,WAAW,4CAA4C,CAAC,CAAC,OAAO,WAAW,oBAAoB,CAAC,CAAC,OAAO,cAAc,sBAAsB,CAAC,CAAC,OAAO,iBAAiB,wBAAwB,CAAC,CAAC,OAAO,oBAAoB,6BAA6B,CAAC,CAAC,OAAO,aAAa,qBAAqB;AACnkB"}
1
+ {"version":3,"file":"command-helpers-kD9CO1hd-BPhnkBin.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/command-helpers-kD9CO1hd.mjs"],"sourcesContent":["import { D as errorRuntime, b as errorOutputFormatMutex, f as errorInvalidOutputFormat, t as CliStructuredError } from \"./cli-errors-C6_pH59O.mjs\";\nimport { i as formatErrorOutput, m as formatDim, p as createColorFormatter, r as formatErrorJson, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { hasMigrations } from \"@internal/framework-components/control\";\nimport { APP_SPACE_ID as APP_SPACE_ID$1, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\nimport { blue, bold, cyan, dim, green, magenta } from \"colorette\";\nimport wrapAnsi from \"wrap-ansi\";\nimport stringWidth from \"string-width\";\nimport stripAnsi from \"strip-ansi\";\nimport { isCI } from \"ci-info\";\n//#region src/utils/formatters/styled.ts\n/**\n* Fixed width for left column in help output.\n*/\nconst LEFT_COLUMN_WIDTH$1 = 20;\n/**\n* Creates an arrow segment badge with green background and white text.\n* Body: green background with white \"prisma-next\" text\n* Tip: dark grey arrow pointing right (Powerline separator)\n*/\nfunction createPrismaNextBadge$1(useColor) {\n\tif (!useColor) return \"prisma-next\";\n\treturn bold(\"prisma-next\");\n}\n/**\n* Creates a padding function.\n*/\nfunction createPadFunction() {\n\treturn (s, w) => s + \" \".repeat(Math.max(0, w - s.length));\n}\n/**\n* Formats a header line: brand + operation + intent\n*/\nfunction formatHeaderLine$1(options) {\n\tif (options.operation) return `${options.brand} ${options.operation} → ${options.intent}`;\n\treturn `${options.brand} ${options.intent}`;\n}\n/**\n* Formats a \"Read more\" URL line.\n* The \"Read more\" label is in default color (not cyan), and the URL is blue.\n*/\nfunction formatReadMoreLine$1(options) {\n\tconst labelPadded = createPadFunction()(\"Read more\", options.maxLabelWidth);\n\tconst valueColored = options.useColor ? blue(options.url) : options.url;\n\treturn `${options.formatDimText(\"│\")} ${labelPadded} ${valueColored}`;\n}\n/**\n* Pads text to a fixed width, accounting for ANSI escape codes.\n* Uses string-width to measure the actual display width.\n*/\nfunction padToFixedWidth(text, width) {\n\tconst actualWidth = stringWidth(text);\n\tconst padding = Math.max(0, width - actualWidth);\n\treturn text + \" \".repeat(padding);\n}\n/**\n* Renders a command tree structure.\n* Handles both single-level (subcommands of a command) and multi-level (top-level commands with subcommands) trees.\n*/\nfunction renderCommandTree(options) {\n\tconst { commands, useColor, formatDimText, hasItemsAfter, continuationPrefix } = options;\n\tconst lines = [];\n\tif (commands.length === 0) return lines;\n\tfor (let i = 0; i < commands.length; i++) {\n\t\tconst cmd = commands[i];\n\t\tif (!cmd) continue;\n\t\tconst subcommands = cmd.commands.filter((subcmd) => !subcmd.name().startsWith(\"_\"));\n\t\tconst isLastCommand = i === commands.length - 1;\n\t\tif (subcommands.length > 0) {\n\t\t\tconst treePrefix = `${isLastCommand && !hasItemsAfter ? formatDimText(\"└\") : formatDimText(\"├\")}─ `;\n\t\t\tconst treePrefixWidth = stringWidth(stripAnsi(treePrefix));\n\t\t\tconst remainingWidth = LEFT_COLUMN_WIDTH$1 - treePrefixWidth;\n\t\t\tconst commandNamePadded = padToFixedWidth(cmd.name(), remainingWidth);\n\t\t\tconst commandNameColored = useColor ? cyan(commandNamePadded) : commandNamePadded;\n\t\t\tlines.push(`${formatDimText(\"│\")} ${treePrefix}${commandNameColored}`);\n\t\t\tfor (let j = 0; j < subcommands.length; j++) {\n\t\t\t\tconst subcmd = subcommands[j];\n\t\t\t\tif (!subcmd) continue;\n\t\t\t\tconst isLastSubcommand = j === subcommands.length - 1;\n\t\t\t\tconst shortDescription = subcmd.description() || \"\";\n\t\t\t\tconst treeChar = isLastSubcommand ? \"└\" : \"├\";\n\t\t\t\tconst continuation = continuationPrefix ?? (isLastCommand && isLastSubcommand && !hasItemsAfter ? \" \" : formatDimText(\"│\"));\n\t\t\t\tconst subTreePrefix = `${continuation === \" \" ? \" \" : continuation} ${formatDimText(treeChar)}─ `;\n\t\t\t\tconst subTreePrefixWidth = stringWidth(stripAnsi(subTreePrefix));\n\t\t\t\tconst subRemainingWidth = LEFT_COLUMN_WIDTH$1 - subTreePrefixWidth;\n\t\t\t\tconst subcommandNamePadded = padToFixedWidth(subcmd.name(), subRemainingWidth);\n\t\t\t\tconst subcommandNameColored = useColor ? cyan(subcommandNamePadded) : subcommandNamePadded;\n\t\t\t\tlines.push(`${formatDimText(\"│\")} ${subTreePrefix}${subcommandNameColored} ${shortDescription}`);\n\t\t\t}\n\t\t} else {\n\t\t\tconst treePrefix = `${isLastCommand && !hasItemsAfter ? formatDimText(\"└\") : formatDimText(\"├\")}─ `;\n\t\t\tconst treePrefixWidth = stringWidth(stripAnsi(treePrefix));\n\t\t\tconst remainingWidth = LEFT_COLUMN_WIDTH$1 - treePrefixWidth;\n\t\t\tconst commandNamePadded = padToFixedWidth(cmd.name(), remainingWidth);\n\t\t\tconst commandNameColored = useColor ? cyan(commandNamePadded) : commandNamePadded;\n\t\t\tconst shortDescription = cmd.description() || \"\";\n\t\t\tlines.push(`${formatDimText(\"│\")} ${treePrefix}${commandNameColored} ${shortDescription}`);\n\t\t}\n\t}\n\treturn lines;\n}\n/**\n* Formats the header in the new experimental visual style.\n* This header appears at the start of command output, showing the operation,\n* intent, documentation link, and parameters.\n*/\nfunction formatStyledHeader(options) {\n\tconst lines = [];\n\tconst useColor = options.flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst brand = createPrismaNextBadge$1(useColor);\n\tconst operation = useColor ? bold(options.command) : options.command;\n\tconst intent = formatDimText(options.description);\n\tlines.push(formatHeaderLine$1({\n\t\tbrand,\n\t\toperation,\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tfor (const detail of options.details) {\n\t\tconst labelPadded = padToFixedWidth(`${detail.label}:`, LEFT_COLUMN_WIDTH$1);\n\t\tconst labelColored = useColor ? cyan(labelPadded) : labelPadded;\n\t\tlines.push(`${formatDimText(\"│\")} ${labelColored} ${detail.value}`);\n\t}\n\tif (options.url) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(formatReadMoreLine$1({\n\t\t\turl: options.url,\n\t\t\tmaxLabelWidth: LEFT_COLUMN_WIDTH$1,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n/**\n* Formats a success message in the styled output format.\n*/\nfunction formatSuccessMessage(flags) {\n\treturn `${createColorFormatter(flags.color !== false, green)(\"✔\")} Success`;\n}\n//#endregion\n//#region src/utils/formatters/help.ts\n/**\n* Fixed width for left column in help output.\n* Must match the value in styled.ts.\n*/\nconst LEFT_COLUMN_WIDTH = 20;\n/**\n* Minimum width for right column wrapping in help output.\n*/\nconst RIGHT_COLUMN_MIN_WIDTH = 40;\n/**\n* Maximum width for right column wrapping in help output (when terminal is wide enough).\n*/\nconst RIGHT_COLUMN_MAX_WIDTH = 90;\n/**\n* Gets the terminal width, or returns a default if not available.\n*/\nfunction getTerminalWidth() {\n\tconst terminalWidth = process.stderr.columns || process.stdout.columns;\n\tconst envWidth = Number.parseInt(process.env[\"CLI_WIDTH\"] || \"\", 10);\n\treturn terminalWidth || (Number.isFinite(envWidth) ? envWidth : 80);\n}\n/**\n* Calculates the available width for the right column based on terminal width.\n*/\nfunction calculateRightColumnWidth() {\n\tconst availableWidth = getTerminalWidth() - 2 - LEFT_COLUMN_WIDTH - 2;\n\treturn Math.max(RIGHT_COLUMN_MIN_WIDTH, Math.min(availableWidth, RIGHT_COLUMN_MAX_WIDTH));\n}\n/**\n* Creates the CLI brand badge.\n*/\nfunction createPrismaNextBadge(useColor) {\n\treturn useColor ? bold(\"prisma-next\") : \"prisma-next\";\n}\n/**\n* Formats a header line: brand + operation + intent\n*/\nfunction formatHeaderLine(options) {\n\tif (options.operation) return `${options.brand} ${options.operation} → ${options.intent}`;\n\treturn `${options.brand} ${options.intent}`;\n}\n/**\n* Wraps text to fit within a specified width using wrap-ansi.\n*/\nfunction wrapTextAnsi(text, width) {\n\treturn wrapAnsi(text, width, {\n\t\thard: false,\n\t\ttrim: true\n\t}).split(\"\\n\");\n}\n/**\n* Formats a default value as \"default: <value>\" with dimming.\n*/\nfunction formatDefaultValue(value, useColor) {\n\tconst defaultText = `default: ${String(value)}`;\n\treturn useColor ? dim(defaultText) : defaultText;\n}\n/**\n* Formats a \"Read more\" URL line.\n*/\nfunction formatReadMoreLine(options) {\n\tconst labelPadded = `Read more${\" \".repeat(Math.max(0, options.maxLabelWidth - 9))}`;\n\tconst valueColored = options.useColor ? blue(options.url) : options.url;\n\treturn `${options.formatDimText(\"│\")} ${labelPadded} ${valueColored}`;\n}\n/**\n* Formats multiline description with \"Prisma Next\" in green.\n*/\nfunction formatMultilineDescription(options) {\n\tconst lines = [];\n\tconst formatGreen = (text) => options.useColor ? green(text) : text;\n\tconst wrapWidth = 24 + calculateRightColumnWidth() - 2;\n\tfor (const descLine of options.descriptionLines) {\n\t\tconst wrappedLines = wrapTextAnsi(descLine.replace(/Prisma Next/g, (match) => formatGreen(match)), wrapWidth);\n\t\tfor (const wrappedLine of wrappedLines) lines.push(`${options.formatDimText(\"│\")} ${wrappedLine}`);\n\t}\n\treturn lines;\n}\n/**\n* Maps command paths to their documentation URLs.\n*/\nfunction getCommandDocsUrl(commandPath) {\n\treturn {\n\t\t\"contract emit\": \"https://pris.ly/contract-emit\",\n\t\t\"contract infer\": \"https://pris.ly/contract-infer\",\n\t\t\"db schema\": \"https://pris.ly/db-schema\",\n\t\t\"db verify\": \"https://pris.ly/db-verify\",\n\t\t\"db update\": \"https://pris.ly/db-update\",\n\t\t\"migration plan\": \"https://pris.ly/migration-plan\",\n\t\tmigrate: \"https://pris.ly/migrate\",\n\t\t\"migration show\": \"https://pris.ly/migration-show\",\n\t\t\"migration status\": \"https://pris.ly/migration-status\"\n\t}[commandPath];\n}\n/**\n* Builds the full command path from a command and its parents.\n*/\nfunction buildCommandPath(command) {\n\tconst parts = [];\n\tlet current = command;\n\twhile (current && current.name() !== \"prisma-next\") {\n\t\tparts.unshift(current.name());\n\t\tcurrent = current.parent ?? void 0;\n\t}\n\treturn parts.join(\" \");\n}\n/**\n* Formats help output for a command using the styled format.\n*/\nfunction formatCommandHelp(options) {\n\tconst { command, flags } = options;\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst commandPath = buildCommandPath(command);\n\tconst shortDescription = command.description() || \"\";\n\tconst longDescription = getLongDescription(command);\n\tconst argsSuffix = command.registeredArguments.map((arg) => arg.required ? `<${arg.name()}>` : `[${arg.name()}]`).join(\" \");\n\tconst brand = createPrismaNextBadge(useColor);\n\tconst commandWithArgs = argsSuffix ? `${commandPath} ${argsSuffix}` : commandPath;\n\tconst operation = useColor ? bold(commandWithArgs) : commandWithArgs;\n\tconst intent = formatDimText(shortDescription);\n\tlines.push(formatHeaderLine({\n\t\tbrand,\n\t\toperation,\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tconst optionsList = command.options.map((opt) => {\n\t\tconst description = opt.description || \"\";\n\t\tconst defaultValue = opt.defaultValue;\n\t\treturn {\n\t\t\tflags: opt.flags,\n\t\t\tdescription,\n\t\t\tdefaultValue\n\t\t};\n\t});\n\tconst subcommands = command.commands.filter((cmd) => !cmd.name().startsWith(\"_\"));\n\tif (subcommands.length > 0) {\n\t\tconst treeLines = renderCommandTree({\n\t\t\tcommands: subcommands,\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\thasItemsAfter: optionsList.length > 0\n\t\t});\n\t\tlines.push(...treeLines);\n\t}\n\tif (subcommands.length > 0 && optionsList.length > 0) lines.push(formatDimText(\"│\"));\n\tif (optionsList.length > 0) for (const opt of optionsList) {\n\t\tconst flagsPadded = padToFixedWidth(opt.flags, LEFT_COLUMN_WIDTH);\n\t\tlet flagsColored = flagsPadded;\n\t\tif (useColor) {\n\t\t\tflagsColored = flagsPadded.replace(/(<[^>]+>)/g, (match) => magenta(match));\n\t\t\tflagsColored = cyan(flagsColored);\n\t\t}\n\t\tconst rightColumnWidth = calculateRightColumnWidth();\n\t\tconst wrappedDescription = wrapTextAnsi(opt.description, rightColumnWidth);\n\t\tlines.push(`${formatDimText(\"│\")} ${flagsColored} ${wrappedDescription[0] || \"\"}`);\n\t\tfor (let i = 1; i < wrappedDescription.length; i++) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${wrappedDescription[i] || \"\"}`);\n\t\t}\n\t\tif (opt.defaultValue !== void 0) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tconst defaultText = formatDefaultValue(opt.defaultValue, useColor);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${defaultText}`);\n\t\t}\n\t}\n\tconst docsUrl = getCommandDocsUrl(commandPath);\n\tif (docsUrl) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(formatReadMoreLine({\n\t\t\turl: docsUrl,\n\t\t\tmaxLabelWidth: LEFT_COLUMN_WIDTH,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tconst examples = getCommandExamples(command);\n\tif (examples && examples.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(`${formatDimText(\"│\")} ${formatDimText(\"Examples:\")}`);\n\t\tfor (const example of examples) lines.push(`${formatDimText(\"│\")} ${useColor ? dim(\"$\") : \"$\"} ${example}`);\n\t}\n\tconst seeAlso = getCommandSeeAlso(command);\n\tif (seeAlso && seeAlso.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(`${formatDimText(\"│\")} ${formatDimText(\"See also:\")}`);\n\t\tfor (const ref of seeAlso) lines.push(`${formatDimText(\"│\")} ${ref.verb} ${formatDimText(ref.oneLiner)}`);\n\t}\n\tif (longDescription) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tconst descriptionLines = longDescription.split(\"\\n\").filter((line) => line.trim().length > 0);\n\t\tlines.push(...formatMultilineDescription({\n\t\t\tdescriptionLines,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n/**\n* Formats help output for the root program using the styled format.\n*/\nfunction formatRootHelp(options) {\n\tconst { program, flags } = options;\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst brand = createPrismaNextBadge(useColor);\n\tconst intent = formatDimText(\"Manage your data layer\");\n\tlines.push(formatHeaderLine({\n\t\tbrand,\n\t\toperation: \"\",\n\t\tintent\n\t}));\n\tlines.push(formatDimText(\"│\"));\n\tconst topLevelCommands = program.commands.filter((cmd) => !cmd.name().startsWith(\"_\") && cmd.name() !== \"help\");\n\tconst globalOptions = program.options.map((opt) => {\n\t\tconst description = opt.description || \"\";\n\t\tconst defaultValue = opt.defaultValue;\n\t\treturn {\n\t\t\tflags: opt.flags,\n\t\t\tdescription,\n\t\t\tdefaultValue\n\t\t};\n\t});\n\tif (topLevelCommands.length > 0) {\n\t\tconst treeLines = renderCommandTree({\n\t\t\tcommands: topLevelCommands,\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\thasItemsAfter: globalOptions.length > 0\n\t\t});\n\t\tlines.push(...treeLines);\n\t}\n\tif (topLevelCommands.length > 0 && globalOptions.length > 0) lines.push(formatDimText(\"│\"));\n\tif (globalOptions.length > 0) for (const opt of globalOptions) {\n\t\tconst flagsPadded = padToFixedWidth(opt.flags, LEFT_COLUMN_WIDTH);\n\t\tlet flagsColored = flagsPadded;\n\t\tif (useColor) {\n\t\t\tflagsColored = flagsPadded.replace(/(<[^>]+>)/g, (match) => magenta(match));\n\t\t\tflagsColored = cyan(flagsColored);\n\t\t}\n\t\tconst rightColumnWidth = calculateRightColumnWidth();\n\t\tconst wrappedDescription = wrapTextAnsi(opt.description, rightColumnWidth);\n\t\tlines.push(`${formatDimText(\"│\")} ${flagsColored} ${wrappedDescription[0] || \"\"}`);\n\t\tfor (let i = 1; i < wrappedDescription.length; i++) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${wrappedDescription[i] || \"\"}`);\n\t\t}\n\t\tif (opt.defaultValue !== void 0) {\n\t\t\tconst emptyLabel = \" \".repeat(LEFT_COLUMN_WIDTH);\n\t\t\tconst defaultText = formatDefaultValue(opt.defaultValue, useColor);\n\t\t\tlines.push(`${formatDimText(\"│\")} ${emptyLabel} ${defaultText}`);\n\t\t}\n\t}\n\tconst formatGreen = (text) => useColor ? green(text) : text;\n\tconst descriptionLines = [`Use ${formatGreen(\"Prisma Next\")} to define your data layer as a contract. Sign your database and application with the same contract to guarantee compatibility. Plan and apply migrations to safely evolve your schema.`];\n\tif (descriptionLines.length > 0) {\n\t\tlines.push(formatDimText(\"│\"));\n\t\tlines.push(...formatMultilineDescription({\n\t\t\tdescriptionLines,\n\t\t\tuseColor,\n\t\t\tformatDimText\n\t\t}));\n\t}\n\tlines.push(formatDimText(\"└\"));\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n//#endregion\n//#region src/utils/is-ci.ts\n/**\n* Returns true when the process is running in any CI environment recognised\n* by the `ci-info` package. The single source of truth for CI detection\n* across this CLI — colour-output suppression and telemetry-skip both call\n* this helper, so neither path drifts from the other when a new CI provider\n* is added upstream.\n*\n* `ci-info` checks the standard `CI=true` marker plus dozens of\n* provider-specific environment variables (Buildkite, Jenkins, Drone,\n* Bitbucket Pipelines, Azure Pipelines, AWS CodeBuild, …) that the raw\n* `process.env.CI` read misses.\n*\n*/\nfunction isCI$1() {\n\treturn isCI;\n}\n//#endregion\n//#region src/utils/result-handler.ts\n/**\n* Processes a CLI command result, handling both success and error cases.\n* Formats output appropriately and returns the exit code.\n* Never throws - returns exit code for commands to use with process.exit().\n*\n* Error output:\n* - JSON mode: JSON error to stdout (piped) via ui.output(), human sees nothing on stderr.\n* - Interactive: human-readable error to stderr.\n*/\nfunction handleResult(result, flags, ui, onSuccess) {\n\tif (result.ok) {\n\t\tif (onSuccess) onSuccess(result.value);\n\t\treturn 0;\n\t}\n\tconst envelope = result.failure.toEnvelope();\n\tif (flags.json) ui.output(formatErrorJson(envelope));\n\telse ui.error(formatErrorOutput(envelope, flags));\n\treturn result.failure.code === \"CLI.INIT_USER_ABORTED\" ? 3 : 2;\n}\n//#endregion\n//#region src/utils/global-flags.ts\nfunction isJsonFlagSet(json) {\n\treturn json === true;\n}\nfunction resolveOutputFormat(options) {\n\tconst formatOption = options.format;\n\tconst jsonFlag = isJsonFlagSet(options.json);\n\tif (formatOption !== void 0) {\n\t\tif (formatOption !== \"pretty\" && formatOption !== \"json\") throw errorInvalidOutputFormat(formatOption);\n\t\tif (jsonFlag && formatOption === \"pretty\") throw errorOutputFormatMutex();\n\t\treturn {\n\t\t\tformat: formatOption,\n\t\t\texplicitFormat: true\n\t\t};\n\t}\n\tif (jsonFlag) return {\n\t\tformat: \"json\",\n\t\texplicitFormat: false\n\t};\n\tif (!process.stdout.isTTY) return {\n\t\tformat: \"json\",\n\t\texplicitFormat: false\n\t};\n\treturn {\n\t\tformat: \"pretty\",\n\t\texplicitFormat: false\n\t};\n}\nfunction inferJsonModeForParseError(options) {\n\tif (options.format === \"json\") return true;\n\tif (isJsonFlagSet(options.json) && options.format !== \"pretty\") return true;\n\tif (options.format !== void 0) return false;\n\treturn !process.stdout.isTTY;\n}\nfunction emitGlobalFlagParseError(error, options) {\n\tconst jsonMode = inferJsonModeForParseError(options);\n\tconst flags = {\n\t\tformat: jsonMode ? \"json\" : \"pretty\",\n\t\texplicitFormat: false,\n\t\t...jsonMode ? { json: true } : {},\n\t\tcolor: false,\n\t\tverbose: 0,\n\t\tinteractive: false\n\t};\n\tconst ui = createTerminalUI(flags);\n\tconst exitCode = handleResult(notOk(error), flags, ui);\n\tprocess.exit(exitCode);\n}\n/**\n* Parses global flags from CLI options.\n* Handles verbosity flags (-v, --trace), output format (--format, --json),\n* quiet mode, color, interactivity (--interactive/--no-interactive), and\n* auto-accept (-y/--yes).\n*\n* On invalid or conflicting format flags, prints a structured CLI error\n* envelope and exits with code 2.\n*/\nfunction parseGlobalFlagsOrExit(options) {\n\ttry {\n\t\treturn parseGlobalFlags(options);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) emitGlobalFlagParseError(error, options);\n\t\tthrow error;\n\t}\n}\n/**\n* Parses global flags from CLI options.\n* Handles verbosity flags (-v, --trace), output format (--format, --json),\n* quiet mode, color, interactivity (--interactive/--no-interactive), and\n* auto-accept (-y/--yes).\n*\n* Throws {@link CliStructuredError} for invalid or conflicting format flags.\n*/\nfunction parseGlobalFlags(options) {\n\tconst { format, explicitFormat } = resolveOutputFormat(options);\n\tconst flags = {\n\t\tformat,\n\t\texplicitFormat\n\t};\n\tif (format === \"json\") flags.json = true;\n\tif (options.quiet || options.q) flags.quiet = true;\n\tif (options.trace || process.env[\"PRISMA_NEXT_TRACE\"] === \"1\") flags.verbose = 2;\n\telse if (options.verbose || options.v || process.env[\"PRISMA_NEXT_DEBUG\"] === \"1\") flags.verbose = 1;\n\telse flags.verbose = 0;\n\tif (process.env[\"NO_COLOR\"] || flags.json) flags.color = false;\n\telse if (options[\"no-color\"]) flags.color = false;\n\telse if (options.color !== void 0) flags.color = options.color;\n\telse flags.color = process.stdout.isTTY && !isCI$1();\n\tif (options[\"no-interactive\"]) flags.interactive = false;\n\telse if (options.interactive !== void 0) flags.interactive = options.interactive;\n\telse flags.interactive = !!process.stdout.isTTY;\n\tif (options.yes || options.y) flags.yes = true;\n\treturn flags;\n}\n/**\n* Bridges the two TTY checks (stdout via `flags`, stdin via\n* `process.stdin.isTTY`) into the `canPrompt` boolean the interactive\n* `init` flow consumes.\n*\n* Per the [Style Guide § Interactivity](../../../../../../../docs/CLI%20Style%20Guide.md#interactivity):\n*\n* - `flags.interactive` governs *decoration* (TerminalUI, intro/outro,\n* spinners) and is derived from stdout-TTY by `parseGlobalFlags`,\n* honouring `--interactive` / `--no-interactive`.\n* - Prompting additionally requires a stdin TTY — closing stdin is a\n* common signal in CI / agent environments even when stdout stays\n* attached.\n* - `--interactive` is the explicit override: when the user passes it,\n* we honour it (e.g. testing flows where stdin is stubbed).\n*\n* Single source of truth for the interactive-prompt decision: both the\n* `init` action handler and the preAction telemetry bridge derive\n* prompt-eligibility from this helper so they cannot drift. Lives in\n* `global-flags` (alongside `parseGlobalFlags`) to keep\n* `utils/telemetry` and `commands/init/index` free of an import cycle.\n*\n* Exported so callers and tests can derive the same value without\n* touching `process` globals.\n*/\nfunction deriveCanPrompt(opts) {\n\tif (opts.optionInteractive === true) return true;\n\tif (opts.flagsInteractive === false) return false;\n\treturn opts.stdinIsTTY;\n}\n//#endregion\n//#region src/utils/command-helpers.ts\nconst longDescriptions = /* @__PURE__ */ new WeakMap();\nconst commandExamples = /* @__PURE__ */ new WeakMap();\nconst commandSeeAlso = /* @__PURE__ */ new WeakMap();\n/**\n* Sets both short and long descriptions for a command.\n* The short description is used in command trees and headers.\n* The long description is shown at the bottom of help output.\n*/\nfunction setCommandDescriptions(command, shortDescription, longDescription) {\n\tcommand.description(shortDescription);\n\tif (longDescription) longDescriptions.set(command, longDescription);\n\treturn command;\n}\n/**\n* Sets copy-pastable examples for a command, shown in help text.\n*/\nfunction setCommandExamples(command, examples) {\n\tcommandExamples.set(command, examples);\n\treturn command;\n}\n/**\n* Gets the long description from a command if it was set via setCommandDescriptions.\n*/\nfunction getLongDescription(command) {\n\treturn longDescriptions.get(command);\n}\n/**\n* Gets examples from a command if set via setCommandExamples.\n*/\nfunction getCommandExamples(command) {\n\treturn commandExamples.get(command);\n}\n/**\n* Sets cross-references to related commands, rendered in a \"See also\"\n* section below the Examples block in help output.\n*/\nfunction setCommandSeeAlso(command, refs) {\n\tcommandSeeAlso.set(command, refs);\n\treturn command;\n}\n/**\n* Gets the see-also cross-references from a command.\n*/\nfunction getCommandSeeAlso(command) {\n\treturn commandSeeAlso.get(command);\n}\n/**\n* Resolves the absolute path to contract.json from the config.\n*/\nfunction resolveContractPath(config) {\n\tif (config.contract?.output === void 0) throw errorRuntime(\"CONFIG.VALIDATION_FAILED\", \"config.contract.output is required to resolve the contract path\", {\n\t\twhy: \"CLI commands read the emitted contract from config.contract.output; the config has no value to read.\",\n\t\tfix: \"Ensure your prisma-next.config.ts goes through `defineConfig()`, which normalises a default output when the provider supplies an input path, or set `contract.output` explicitly.\"\n\t});\n\treturn resolve(config.contract.output);\n}\n/**\n* Resolves the migrations directory and config path from CLI options.\n* Shared by migrate, migration-plan, and migration-status.\n*\n* - `migrationsDir` is the project's top-level `migrations/` directory\n* (the root that the aggregate loader walks for every contract space).\n* - `appMigrationsDir` is the app subspace directory under it\n* (`<migrationsDir>/<APP_SPACE_ID>/`). Every per-app reader / writer\n* (`migration new`, `migration plan`, `migrate`,\n* `migration status`, `migration show`, `migration ref`) operates on\n* this directory. Extensions own their own `migrations/<spaceId>/`.\n* - `refsDir` is the app's refs directory (`<appMigrationsDir>/refs/`).\n* The framework does not maintain refs at the migrations root.\n*\n* `cwd` is the directory the command was invoked from; every relative path in\n* the result is computed against it.\n*/\nfunction resolveMigrationPaths(configOption, config, cwd) {\n\tconst resolvedConfigPath = configOption ? resolve(cwd, configOption) : void 0;\n\tconst configPath = resolvedConfigPath ? relative(cwd, resolvedConfigPath) : \"prisma-next.config.ts\";\n\tconst migrationsDir = resolve(resolvedConfigPath ? resolve(resolvedConfigPath, \"..\") : cwd, config.migrations?.dir ?? \"migrations\");\n\tconst migrationsRelative = relative(cwd, migrationsDir);\n\tconst appMigrationsDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID$1);\n\treturn {\n\t\tconfigPath,\n\t\tmigrationsDir,\n\t\tmigrationsRelative,\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative: relative(cwd, appMigrationsDir),\n\t\trefsDir: resolve(appMigrationsDir, \"refs\")\n\t};\n}\nfunction collectDeclaredInvariants(graph) {\n\tconst declared = /* @__PURE__ */ new Set();\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) for (const inv of edge.invariants) declared.add(inv);\n\treturn declared;\n}\n/**\n* Maps a `MigrationEdge` to the structural-edge shape used in the\n* `MIGRATION.NO_INVARIANT_PATH` error envelope. Shared between\n* `migrate` and `migration status` so both commands surface\n* the same JSON wire shape when an invariant-aware route is unsatisfiable.\n*/\nfunction toStructuralEdge(edge) {\n\treturn {\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tinvariants: edge.invariants\n\t};\n}\nfunction targetSupportsMigrations(target) {\n\treturn hasMigrations(target);\n}\n/**\n* Hangs up without letting the hang-up decide the command's result. A rejection out of a\n* `finally` replaces the value the `try`/`catch` already returned, so an unguarded close turns a\n* mapped connection error into an unmapped one — and that is the case it hits most, because a\n* `connect()` that failed leaves nothing to close.\n*/\nasync function closeQuietly(client) {\n\ttry {\n\t\tawait client.close();\n\t} catch {}\n}\nfunction getTargetMigrations(target) {\n\treturn hasMigrations(target) ? target.migrations : void 0;\n}\n/**\n* Reads and parses contract.json, validating the framework-level envelope\n* fields (storageHash, schemaVersion, target, targetFamily).\n*\n* Family-specific validation (storage structure, codec mappings, etc.)\n* happens downstream in the control client via the family instance.\n*/\nasync function readContractEnvelope(config) {\n\tconst contractPath = resolveContractPath(config);\n\tconst content = await readFile(contractPath, \"utf-8\");\n\tconst json = JSON.parse(content);\n\tconst { schemaVersion, target, targetFamily, profileHash } = json;\n\tconst storageHash = json[\"storage\"]?.[\"storageHash\"];\n\tif (typeof storageHash !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \\`prisma-next contract emit\\` to regenerate.`, { where: { path: contractPath } });\n\tif (typeof schemaVersion !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });\n\tif (typeof target !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });\n\tif (typeof targetFamily !== \"string\") throw new CliStructuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });\n\treturn {\n\t\t...json,\n\t\tstorageHash,\n\t\tschemaVersion,\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...typeof profileHash === \"string\" ? { profileHash } : {}\n\t};\n}\n/**\n* Masks credentials in a database connection URL.\n* Handles standard URLs (username + password + query params) and libpq-style key=value strings.\n*/\nfunction maskConnectionUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tif (parsed.username) parsed.username = \"****\";\n\t\tif (parsed.password) parsed.password = \"****\";\n\t\tfor (const key of [...parsed.searchParams.keys()]) if (/password/i.test(key)) parsed.searchParams.set(key, \"****\");\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn url.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n/**\n* Strips raw connection URL fragments from an error message to prevent credential leakage.\n* Call this before surfacing driver errors to the user.\n*/\nfunction sanitizeErrorMessage(message, connectionUrl) {\n\tif (!connectionUrl) return message;\n\ttry {\n\t\tconst parsed = new URL(connectionUrl);\n\t\tlet sanitized = message;\n\t\tsanitized = sanitized.replaceAll(connectionUrl, maskConnectionUrl(connectionUrl));\n\t\tif (parsed.password) sanitized = sanitized.replaceAll(parsed.password, \"****\");\n\t\tif (parsed.username) sanitized = sanitized.replaceAll(parsed.username, \"****\");\n\t\treturn sanitized;\n\t} catch {\n\t\treturn message.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n/**\n* Registers the global CLI options shared by every command:\n* --format, --json, -q/--quiet, -v/--verbose, --trace, --color, --no-color,\n* --interactive, --no-interactive, -y/--yes.\n*\n* Also sets up the styled help formatter.\n*/\nfunction addGlobalOptions(command) {\n\treturn command.configureHelp({ formatHelp: (cmd) => {\n\t\treturn formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t});\n\t} }).option(\"--format <pretty|json>\", \"Output format (default: pretty, or json when stdout is not a TTY)\").option(\"--json\", \"Output as JSON (alias for --format json)\").option(\"-q, --quiet\", \"Quiet mode: errors only\").option(\"-v, --verbose\", \"Verbose output: debug info, timings\").option(\"--trace\", \"Trace output: deep internals, stack traces\").option(\"--color\", \"Force color output\").option(\"--no-color\", \"Disable color output\").option(\"--interactive\", \"Force interactive mode\").option(\"--no-interactive\", \"Disable interactive prompts\").option(\"-y, --yes\", \"Auto-accept prompts\");\n}\n//#endregion\nexport { formatSuccessMessage as C, formatStyledHeader as S, parseGlobalFlagsOrExit as _, maskConnectionUrl as a, formatCommandHelp as b, resolveMigrationPaths as c, setCommandExamples as d, setCommandSeeAlso as f, parseGlobalFlags as g, deriveCanPrompt as h, getTargetMigrations as i, sanitizeErrorMessage as l, toStructuralEdge as m, closeQuietly as n, readContractEnvelope as o, targetSupportsMigrations as p, collectDeclaredInvariants as r, resolveContractPath as s, addGlobalOptions as t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G,GAAG,OAAO,aAAa,IAAI,KAAK,MAAM;EACjH,OAAO,OAAO,SAAS;CACxB,QAAQ;EACP,OAAO,IAAI,QAAQ,wBAAwB,eAAe,CAAC,CAAC,QAAQ,oBAAoB,WAAW;CACpG;AACD;;;;;AAKA,SAAS,qBAAqB,SAAS,eAAe;CACrD,IAAI,CAAC,eAAe,OAAO;CAC3B,IAAI;EACH,MAAM,SAAS,IAAI,IAAI,aAAa;EACpC,IAAI,YAAY;EAChB,YAAY,UAAU,WAAW,eAAe,kBAAkB,aAAa,CAAC;EAChF,IAAI,OAAO,UAAU,YAAY,UAAU,WAAW,OAAO,UAAU,MAAM;EAC7E,IAAI,OAAO,UAAU,YAAY,UAAU,WAAW,OAAO,UAAU,MAAM;EAC7E,OAAO;CACR,QAAQ;EACP,OAAO,QAAQ,QAAQ,wBAAwB,eAAe,CAAC,CAAC,QAAQ,oBAAoB,WAAW;CACxG;AACD;;;;;;;;AAQA,SAAS,iBAAiB,SAAS;CAClC,OAAO,QAAQ,cAAc,EAAE,aAAa,QAAQ;EACnD,OAAO,kBAAkB;GACxB,SAAS;GACT,OAAO,iBAAiB,CAAC,CAAC;EAC3B,CAAC;CACF,EAAE,CAAC,CAAC,CAAC,OAAO,0BAA0B,mEAAmE,CAAC,CAAC,OAAO,UAAU,0CAA0C,CAAC,CAAC,OAAO,eAAe,yBAAyB,CAAC,CAAC,OAAO,iBAAiB,qCAAqC,CAAC,CAAC,OAAO,WAAW,4CAA4C,CAAC,CAAC,OAAO,WAAW,oBAAoB,CAAC,CAAC,OAAO,cAAc,sBAAsB,CAAC,CAAC,OAAO,iBAAiB,wBAAwB,CAAC,CAAC,OAAO,oBAAoB,6BAA6B,CAAC,CAAC,OAAO,aAAa,qBAAqB;AACnkB"}
@@ -1,7 +1,7 @@
1
- import { N as errorUnexpected, d as errorFileNotFound, k as errorSnapshotMissing, s as errorContractValidationFailed, t as CliStructuredError$1 } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
1
+ import { N as errorUnexpected, d as errorFileNotFound, k as errorSnapshotMissing, s as errorContractValidationFailed, t as CliStructuredError$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
2
  import { t as MigrationToolsError } from "./errors-CXbGUWGu-BQi6YS-H.mjs";
3
3
  import { notOk } from "@prisma/orm-framework/utils/result";
4
- //#region ../../../1-framework/3-tooling/cli/dist/contract-at-errors-BsQiGdZC.mjs
4
+ //#region ../../../1-framework/3-tooling/cli/dist/contract-at-errors-CLFX1-Gc.mjs
5
5
  function mapContractAtError(error, options) {
6
6
  if (MigrationToolsError.is(error)) switch (error.code) {
7
7
  case "MIGRATION.REF_NOT_RESOLVABLE": return notOk(errorSnapshotMissing(typeof error.meta?.["refName"] === "string" ? error.meta["refName"] : typeof error.meta?.["identifier"] === "string" ? error.meta["identifier"] : "unknown", { cause: error }));
@@ -41,4 +41,4 @@ function mapContractAtError(error, options) {
41
41
  //#endregion
42
42
  export { mapContractAtError as t };
43
43
 
44
- //# sourceMappingURL=contract-at-errors-BsQiGdZC-D8l9-WWt.mjs.map
44
+ //# sourceMappingURL=contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-at-errors-BsQiGdZC-D8l9-WWt.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-at-errors-BsQiGdZC.mjs"],"sourcesContent":["import { M as errorUnexpected, O as errorSnapshotMissing, o as errorContractValidationFailed, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-CihMAEVj.mjs\";\nimport { notOk } from \"@internal/utils/result\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\n//#region src/control-api/operations/contract-at-errors.ts\nfunction mapContractAtError(error, options) {\n\tif (MigrationToolsError.is(error)) switch (error.code) {\n\t\tcase \"MIGRATION.REF_NOT_RESOLVABLE\": return notOk(errorSnapshotMissing(typeof error.meta?.[\"refName\"] === \"string\" ? error.meta[\"refName\"] : typeof error.meta?.[\"identifier\"] === \"string\" ? error.meta[\"identifier\"] : \"unknown\", { cause: error }));\n\t\tcase \"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\treturn notOk(errorContractValidationFailed(`Predecessor contract at ${filePath} failed to deserialize: ${typeof error.meta?.[\"message\"] === \"string\" ? error.meta[\"message\"] : error.message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.INVALID_JSON\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\tconst message = typeof error.meta?.[\"parseError\"] === \"string\" ? error.meta[\"parseError\"] : error.message;\n\t\t\treturn notOk(errorContractValidationFailed((options?.artifactRole ?? \"from\") === \"to\" ? `Target contract at ${filePath} failed to deserialize: ${message}` : `Predecessor contract at ${filePath} failed to deserialize: ${message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\": return notOk(errorUnexpected(error.message, {\n\t\t\twhy: error.why,\n\t\t\tfix: error.fix,\n\t\t\tcause: error\n\t\t}));\n\t\tcase \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\": {\n\t\t\tconst expectedPath = typeof error.meta?.[\"expectedPath\"] === \"string\" ? error.meta[\"expectedPath\"] : \"migrations/snapshots/\";\n\t\t\treturn notOk(errorFileNotFound(expectedPath, {\n\t\t\t\twhy: (options?.artifactRole ?? \"from\") === \"to\" ? `Target migration is missing its contract snapshot at ${expectedPath}` : `Predecessor migration is missing its contract snapshot at ${expectedPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\",\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tdefault: return notOk(error);\n\t}\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tthrow error;\n}\n//#endregion\nexport { mapContractAtError as t };\n\n//# sourceMappingURL=contract-at-errors-BsQiGdZC.mjs.map"],"mappings":";;;;AAIA,SAAS,mBAAmB,OAAO,SAAS;CAC3C,IAAI,oBAAoB,GAAG,KAAK,GAAG,QAAQ,MAAM,MAAd;EAClC,KAAK,gCAAgC,OAAO,MAAM,qBAAqB,OAAO,MAAM,OAAO,eAAe,WAAW,MAAM,KAAK,aAAa,OAAO,MAAM,OAAO,kBAAkB,WAAW,MAAM,KAAK,gBAAgB,WAAW,EAAE,OAAO,MAAM,CAAC,CAAC;EACrP,KAAK,6CAA6C;GACjD,MAAM,WAAW,OAAO,MAAM,OAAO,gBAAgB,WAAW,MAAM,KAAK,cAAc;GACzF,OAAO,MAAM,8BAA8B,2BAA2B,SAAS,0BAA0B,OAAO,MAAM,OAAO,eAAe,WAAW,MAAM,KAAK,aAAa,MAAM,WAAW;IAC/L,OAAO,EAAE,MAAM,SAAS;IACxB,OAAO;GACR,CAAC,CAAC;EACH;EACA,KAAK,0BAA0B;GAC9B,MAAM,WAAW,OAAO,MAAM,OAAO,gBAAgB,WAAW,MAAM,KAAK,cAAc;GACzF,MAAM,UAAU,OAAO,MAAM,OAAO,kBAAkB,WAAW,MAAM,KAAK,gBAAgB,MAAM;GAClG,OAAO,MAAM,+BAA+B,SAAS,gBAAgB,YAAY,OAAO,sBAAsB,SAAS,0BAA0B,YAAY,2BAA2B,SAAS,0BAA0B,WAAW;IACrO,OAAO,EAAE,MAAM,SAAS;IACxB,OAAO;GACR,CAAC,CAAC;EACH;EACA,KAAK,6CAA6C,OAAO,MAAM,gBAAgB,MAAM,SAAS;GAC7F,KAAK,MAAM;GACX,KAAK,MAAM;GACX,OAAO;EACR,CAAC,CAAC;EACF,KAAK,uCAAuC;GAC3C,MAAM,eAAe,OAAO,MAAM,OAAO,oBAAoB,WAAW,MAAM,KAAK,kBAAkB;GACrG,OAAO,MAAM,kBAAkB,cAAc;IAC5C,MAAM,SAAS,gBAAgB,YAAY,OAAO,wDAAwD,iBAAiB,6DAA6D;IACxL,KAAK;IACL,OAAO;GACR,CAAC,CAAC;EACH;EACA,SAAS,OAAO,MAAM,KAAK;CAC5B;CACA,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;CACpD,MAAM;AACP"}
1
+ {"version":3,"file":"contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-at-errors-CLFX1-Gc.mjs"],"sourcesContent":["import { M as errorUnexpected, O as errorSnapshotMissing, o as errorContractValidationFailed, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-C6_pH59O.mjs\";\nimport { notOk } from \"@internal/utils/result\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\n//#region src/control-api/operations/contract-at-errors.ts\nfunction mapContractAtError(error, options) {\n\tif (MigrationToolsError.is(error)) switch (error.code) {\n\t\tcase \"MIGRATION.REF_NOT_RESOLVABLE\": return notOk(errorSnapshotMissing(typeof error.meta?.[\"refName\"] === \"string\" ? error.meta[\"refName\"] : typeof error.meta?.[\"identifier\"] === \"string\" ? error.meta[\"identifier\"] : \"unknown\", { cause: error }));\n\t\tcase \"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\treturn notOk(errorContractValidationFailed(`Predecessor contract at ${filePath} failed to deserialize: ${typeof error.meta?.[\"message\"] === \"string\" ? error.meta[\"message\"] : error.message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.INVALID_JSON\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\tconst message = typeof error.meta?.[\"parseError\"] === \"string\" ? error.meta[\"parseError\"] : error.message;\n\t\t\treturn notOk(errorContractValidationFailed((options?.artifactRole ?? \"from\") === \"to\" ? `Target contract at ${filePath} failed to deserialize: ${message}` : `Predecessor contract at ${filePath} failed to deserialize: ${message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\": return notOk(errorUnexpected(error.message, {\n\t\t\twhy: error.why,\n\t\t\tfix: error.fix,\n\t\t\tcause: error\n\t\t}));\n\t\tcase \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\": {\n\t\t\tconst expectedPath = typeof error.meta?.[\"expectedPath\"] === \"string\" ? error.meta[\"expectedPath\"] : \"migrations/snapshots/\";\n\t\t\treturn notOk(errorFileNotFound(expectedPath, {\n\t\t\t\twhy: (options?.artifactRole ?? \"from\") === \"to\" ? `Target migration is missing its contract snapshot at ${expectedPath}` : `Predecessor migration is missing its contract snapshot at ${expectedPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\",\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tdefault: return notOk(error);\n\t}\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tthrow error;\n}\n//#endregion\nexport { mapContractAtError as t };\n\n//# sourceMappingURL=contract-at-errors-CLFX1-Gc.mjs.map"],"mappings":";;;;AAIA,SAAS,mBAAmB,OAAO,SAAS;CAC3C,IAAI,oBAAoB,GAAG,KAAK,GAAG,QAAQ,MAAM,MAAd;EAClC,KAAK,gCAAgC,OAAO,MAAM,qBAAqB,OAAO,MAAM,OAAO,eAAe,WAAW,MAAM,KAAK,aAAa,OAAO,MAAM,OAAO,kBAAkB,WAAW,MAAM,KAAK,gBAAgB,WAAW,EAAE,OAAO,MAAM,CAAC,CAAC;EACrP,KAAK,6CAA6C;GACjD,MAAM,WAAW,OAAO,MAAM,OAAO,gBAAgB,WAAW,MAAM,KAAK,cAAc;GACzF,OAAO,MAAM,8BAA8B,2BAA2B,SAAS,0BAA0B,OAAO,MAAM,OAAO,eAAe,WAAW,MAAM,KAAK,aAAa,MAAM,WAAW;IAC/L,OAAO,EAAE,MAAM,SAAS;IACxB,OAAO;GACR,CAAC,CAAC;EACH;EACA,KAAK,0BAA0B;GAC9B,MAAM,WAAW,OAAO,MAAM,OAAO,gBAAgB,WAAW,MAAM,KAAK,cAAc;GACzF,MAAM,UAAU,OAAO,MAAM,OAAO,kBAAkB,WAAW,MAAM,KAAK,gBAAgB,MAAM;GAClG,OAAO,MAAM,+BAA+B,SAAS,gBAAgB,YAAY,OAAO,sBAAsB,SAAS,0BAA0B,YAAY,2BAA2B,SAAS,0BAA0B,WAAW;IACrO,OAAO,EAAE,MAAM,SAAS;IACxB,OAAO;GACR,CAAC,CAAC;EACH;EACA,KAAK,6CAA6C,OAAO,MAAM,gBAAgB,MAAM,SAAS;GAC7F,KAAK,MAAM;GACX,KAAK,MAAM;GACX,OAAO;EACR,CAAC,CAAC;EACF,KAAK,uCAAuC;GAC3C,MAAM,eAAe,OAAO,MAAM,OAAO,oBAAoB,WAAW,MAAM,KAAK,kBAAkB;GACrG,OAAO,MAAM,kBAAkB,cAAc;IAC5C,MAAM,SAAS,gBAAgB,YAAY,OAAO,wDAAwD,iBAAiB,6DAA6D;IACxL,KAAK;IACL,OAAO;GACR,CAAC,CAAC;EACH;EACA,SAAS,OAAO,MAAM,KAAK;CAC5B;CACA,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;CACpD,MAAM;AACP"}
@@ -1,16 +1,16 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
- import { N as errorUnexpected, t as CliStructuredError$1 } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
2
+ import { N as errorUnexpected, t as CliStructuredError$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
3
3
  import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-05kuwcb0.mjs";
4
- import { n as executeContractEmit } from "./contract-emit-WIAaN0lC-DKOdtrUQ.mjs";
5
- import { p as isVerbose, r as createTerminalUI } from "./terminal-ui-JJKxvT0q-CPDEJqqU.mjs";
6
- import { b as setCommandExamples, c as formatSuccessMessage, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-Dw3LDEu_-B4AETH4D.mjs";
4
+ import { n as executeContractEmit } from "./contract-emit-CrYO0A8x-60BOqXFr.mjs";
5
+ import { p as isVerbose, r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
6
+ import { b as setCommandExamples, c as formatSuccessMessage, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
7
7
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
8
8
  import { errorContractConfigMissing } from "@prisma/orm-framework/errors/control";
9
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
10
10
  import { dirname, join, relative, resolve } from "pathe";
11
11
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
12
12
  import { Command } from "commander";
13
- //#region ../../../1-framework/3-tooling/cli/dist/contract-emit-CIdgw3Kq.mjs
13
+ //#region ../../../1-framework/3-tooling/cli/dist/contract-emit-BlvUNMHM.mjs
14
14
  /**
15
15
  * Formats human-readable output for contract emit.
16
16
  */
@@ -151,4 +151,4 @@ function createContractEmitCommand() {
151
151
  //#endregion
152
152
  export { createContractEmitCommand as t };
153
153
 
154
- //# sourceMappingURL=contract-emit-CIdgw3Kq-BcfYaUfn.mjs.map
154
+ //# sourceMappingURL=contract-emit-BlvUNMHM-BEioUVR5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-emit-CIdgw3Kq-BcfYaUfn.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-CIdgw3Kq.mjs"],"sourcesContent":["import { M as errorUnexpected, t as CliStructuredError$1 } from \"./cli-errors-CihMAEVj.mjs\";\nimport { t as executeContractEmit } from \"./contract-emit-WIAaN0lC.mjs\";\nimport { m as isVerbose, t as createTerminalUI } from \"./terminal-ui-JJKxvT0q.mjs\";\nimport { C as formatSuccessMessage, S as formatStyledHeader, _ as parseGlobalFlagsOrExit, d as setCommandExamples, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { errorContractConfigMissing } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, join, relative, resolve } from \"pathe\";\n//#region src/utils/formatters/emit.ts\n/**\n* Formats human-readable output for contract emit.\n*/\nfunction formatEmitOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst jsonPath = relative(process.cwd(), result.files.json);\n\tconst dtsPath = relative(process.cwd(), result.files.dts);\n\tlines.push(`✔ Emitted contract.json → ${jsonPath}`);\n\tlines.push(`✔ Emitted contract.d.ts → ${dtsPath}`);\n\tlines.push(` storageHash: ${result.storageHash}`);\n\tif (result.executionHash) lines.push(` executionHash: ${result.executionHash}`);\n\tif (result.profileHash) lines.push(` profileHash: ${result.profileHash}`);\n\tif (isVerbose(flags, 1)) lines.push(` Total time: ${result.timings.total}ms`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for contract emit.\n*/\nfunction formatEmitJson(result) {\n\tconst output = {\n\t\tok: true,\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\t...result.profileHash ? { profileHash: result.profileHash } : {},\n\t\toutDir: result.outDir,\n\t\tfiles: result.files,\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n//#endregion\n//#region src/commands/contract-emit.ts\n/**\n* Loads the config once, for both the styled header's display paths and the\n* emit itself — `executeContractEmit` takes the loaded config rather than\n* reading it a second time.\n*/\nasync function resolveEmitContext(configOption, outputPath) {\n\tconst displayConfigPath = configOption ? relative(process.cwd(), resolve(configOption)) : \"prisma-next.config.ts\";\n\tconst configResult = await loadConfigForSections(configOption, [\n\t\t\"contract\",\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst effectiveJsonPath = outputPath !== void 0 ? join(outputPath, \"contract.json\") : config.contract?.output;\n\tif (!effectiveJsonPath) return notOk(errorContractConfigMissing({ why: \"Config.contract.output is required for emit. Define it in your config: contract: { source: ..., output: ... }\" }));\n\ttry {\n\t\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = getEmittedArtifactPaths(effectiveJsonPath);\n\t\treturn ok({\n\t\t\tconfig,\n\t\t\tdisplayConfigPath,\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) }));\n\t}\n}\nasync function executeContractEmitCommand(options, flags, ui, startTime) {\n\tconst outputPath = options.outputPath !== void 0 ? resolve(options.outputPath) : void 0;\n\tconst emitContextResult = await resolveEmitContext(options.config, outputPath);\n\tif (!emitContextResult.ok) return emitContextResult;\n\tconst { config, displayConfigPath, outputJsonPath, outputDtsPath } = emitContextResult.value;\n\tif (!flags.json && !flags.quiet) ui.stderr(formatStyledHeader({\n\t\tcommand: \"contract emit\",\n\t\tdescription: \"Emit your contract artifacts\",\n\t\turl: \"https://pris.ly/contract-emit\",\n\t\tdetails: [\n\t\t\t{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: displayConfigPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"contract\",\n\t\t\t\tvalue: relative(process.cwd(), outputJsonPath)\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"types\",\n\t\t\t\tvalue: relative(process.cwd(), outputDtsPath)\n\t\t\t}\n\t\t],\n\t\tflags\n\t}));\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\tconst configPath = options.config ? resolve(options.config) : \"prisma-next.config.ts\";\n\tlet result;\n\ttry {\n\t\tresult = await executeContractEmit({\n\t\t\tconfig,\n\t\t\tcwd: process.cwd(),\n\t\t\tconfigPath,\n\t\t\tonProgress,\n\t\t\t...ifDefined(\"outputPath\", outputPath)\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(\"Unexpected error during contract emit\", { why: error instanceof Error ? error.message : String(error) }));\n\t}\n\tif (result.validationWarning) ui.warn(result.validationWarning);\n\treturn ok({\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\tprofileHash: result.profileHash,\n\t\toutDir: dirname(result.files.json),\n\t\tfiles: result.files,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractEmitCommand() {\n\tconst command = new Command(\"emit\");\n\tsetCommandDescriptions(command, \"Emit your contract artifacts\", \"Reads your contract source (TypeScript or Prisma schema) and emits contract.json and\\ncontract.d.ts. The contract.json contains the canonical contract structure, and\\ncontract.d.ts provides TypeScript types for type-safe query building.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract emit\",\n\t\t\"prisma-next contract emit --config ./custom-config.ts\",\n\t\t\"prisma-next contract emit --output-path ./generated\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--output-path <dir>\", \"Directory to write contract.json and contract.d.ts into\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractEmitCommand(options, flags, ui, Date.now()), flags, ui, (emitResult) => {\n\t\t\tif (flags.json) ui.output(formatEmitJson(emitResult));\n\t\t\telse {\n\t\t\t\tconst output = formatEmitOutput(emitResult, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t\tif (!flags.quiet) ui.success(formatSuccessMessage(flags));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractEmitCommand as t };\n\n//# sourceMappingURL=contract-emit-CIdgw3Kq.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,CAAC;CACf,MAAM,WAAW,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI;CAC1D,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG;CACxD,MAAM,KAAK,6BAA6B,UAAU;CAClD,MAAM,KAAK,6BAA6B,SAAS;CACjD,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACjD,IAAI,OAAO,eAAe,MAAM,KAAK,oBAAoB,OAAO,eAAe;CAC/E,IAAI,OAAO,aAAa,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACzE,IAAI,UAAU,OAAO,CAAC,GAAG,MAAM,KAAK,iBAAiB,OAAO,QAAQ,MAAM,GAAG;CAC7E,OAAO,MAAM,KAAK,IAAI;AACvB;;;;AAIA,SAAS,eAAe,QAAQ;CAC/B,MAAM,SAAS;EACd,IAAI;EACJ,aAAa,OAAO;EACpB,GAAG,UAAU,iBAAiB,OAAO,aAAa;EAClD,GAAG,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;EAC/D,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,SAAS,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C;IACJ,MAAM,SAAS,iBAAiB,YAAY,KAAK;IACjD,IAAI,QAAQ,GAAG,IAAI,MAAM;IACzB,IAAI,CAAC,MAAM,OAAO,GAAG,QAAQ,qBAAqB,KAAK,CAAC;GACzD;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"contract-emit-BlvUNMHM-BEioUVR5.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-BlvUNMHM.mjs"],"sourcesContent":["import { M as errorUnexpected, t as CliStructuredError$1 } from \"./cli-errors-C6_pH59O.mjs\";\nimport { t as executeContractEmit } from \"./contract-emit-CrYO0A8x.mjs\";\nimport { h as isVerbose, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { C as formatSuccessMessage, S as formatStyledHeader, _ as parseGlobalFlagsOrExit, d as setCommandExamples, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { errorContractConfigMissing } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, join, relative, resolve } from \"pathe\";\n//#region src/utils/formatters/emit.ts\n/**\n* Formats human-readable output for contract emit.\n*/\nfunction formatEmitOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst jsonPath = relative(process.cwd(), result.files.json);\n\tconst dtsPath = relative(process.cwd(), result.files.dts);\n\tlines.push(`✔ Emitted contract.json → ${jsonPath}`);\n\tlines.push(`✔ Emitted contract.d.ts → ${dtsPath}`);\n\tlines.push(` storageHash: ${result.storageHash}`);\n\tif (result.executionHash) lines.push(` executionHash: ${result.executionHash}`);\n\tif (result.profileHash) lines.push(` profileHash: ${result.profileHash}`);\n\tif (isVerbose(flags, 1)) lines.push(` Total time: ${result.timings.total}ms`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for contract emit.\n*/\nfunction formatEmitJson(result) {\n\tconst output = {\n\t\tok: true,\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\t...result.profileHash ? { profileHash: result.profileHash } : {},\n\t\toutDir: result.outDir,\n\t\tfiles: result.files,\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n//#endregion\n//#region src/commands/contract-emit.ts\n/**\n* Loads the config once, for both the styled header's display paths and the\n* emit itself — `executeContractEmit` takes the loaded config rather than\n* reading it a second time.\n*/\nasync function resolveEmitContext(configOption, outputPath) {\n\tconst displayConfigPath = configOption ? relative(process.cwd(), resolve(configOption)) : \"prisma-next.config.ts\";\n\tconst configResult = await loadConfigForSections(configOption, [\n\t\t\"contract\",\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst effectiveJsonPath = outputPath !== void 0 ? join(outputPath, \"contract.json\") : config.contract?.output;\n\tif (!effectiveJsonPath) return notOk(errorContractConfigMissing({ why: \"Config.contract.output is required for emit. Define it in your config: contract: { source: ..., output: ... }\" }));\n\ttry {\n\t\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = getEmittedArtifactPaths(effectiveJsonPath);\n\t\treturn ok({\n\t\t\tconfig,\n\t\t\tdisplayConfigPath,\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) }));\n\t}\n}\nasync function executeContractEmitCommand(options, flags, ui, startTime) {\n\tconst outputPath = options.outputPath !== void 0 ? resolve(options.outputPath) : void 0;\n\tconst emitContextResult = await resolveEmitContext(options.config, outputPath);\n\tif (!emitContextResult.ok) return emitContextResult;\n\tconst { config, displayConfigPath, outputJsonPath, outputDtsPath } = emitContextResult.value;\n\tif (!flags.json && !flags.quiet) ui.stderr(formatStyledHeader({\n\t\tcommand: \"contract emit\",\n\t\tdescription: \"Emit your contract artifacts\",\n\t\turl: \"https://pris.ly/contract-emit\",\n\t\tdetails: [\n\t\t\t{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: displayConfigPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"contract\",\n\t\t\t\tvalue: relative(process.cwd(), outputJsonPath)\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"types\",\n\t\t\t\tvalue: relative(process.cwd(), outputDtsPath)\n\t\t\t}\n\t\t],\n\t\tflags\n\t}));\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\tconst configPath = options.config ? resolve(options.config) : \"prisma-next.config.ts\";\n\tlet result;\n\ttry {\n\t\tresult = await executeContractEmit({\n\t\t\tconfig,\n\t\t\tcwd: process.cwd(),\n\t\t\tconfigPath,\n\t\t\tonProgress,\n\t\t\t...ifDefined(\"outputPath\", outputPath)\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(\"Unexpected error during contract emit\", { why: error instanceof Error ? error.message : String(error) }));\n\t}\n\tif (result.validationWarning) ui.warn(result.validationWarning);\n\treturn ok({\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\tprofileHash: result.profileHash,\n\t\toutDir: dirname(result.files.json),\n\t\tfiles: result.files,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractEmitCommand() {\n\tconst command = new Command(\"emit\");\n\tsetCommandDescriptions(command, \"Emit your contract artifacts\", \"Reads your contract source (TypeScript or Prisma schema) and emits contract.json and\\ncontract.d.ts. The contract.json contains the canonical contract structure, and\\ncontract.d.ts provides TypeScript types for type-safe query building.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract emit\",\n\t\t\"prisma-next contract emit --config ./custom-config.ts\",\n\t\t\"prisma-next contract emit --output-path ./generated\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--output-path <dir>\", \"Directory to write contract.json and contract.d.ts into\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractEmitCommand(options, flags, ui, Date.now()), flags, ui, (emitResult) => {\n\t\t\tif (flags.json) ui.output(formatEmitJson(emitResult));\n\t\t\telse {\n\t\t\t\tconst output = formatEmitOutput(emitResult, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t\tif (!flags.quiet) ui.success(formatSuccessMessage(flags));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractEmitCommand as t };\n\n//# sourceMappingURL=contract-emit-BlvUNMHM.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,CAAC;CACf,MAAM,WAAW,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI;CAC1D,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG;CACxD,MAAM,KAAK,6BAA6B,UAAU;CAClD,MAAM,KAAK,6BAA6B,SAAS;CACjD,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACjD,IAAI,OAAO,eAAe,MAAM,KAAK,oBAAoB,OAAO,eAAe;CAC/E,IAAI,OAAO,aAAa,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACzE,IAAI,UAAU,OAAO,CAAC,GAAG,MAAM,KAAK,iBAAiB,OAAO,QAAQ,MAAM,GAAG;CAC7E,OAAO,MAAM,KAAK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AAO,YAAY;EACvM,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,2BAA2B,SAAS,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,OAAO,KAAK,eAAe;GAC1H,IAAI,MAAM,MAAM,GAAG,OAAO,eAAe,UAAU,CAAC;QAC/C;IACJ,MAAM,SAAS,iBAAiB,YAAY,KAAK;IACjD,IAAI,QAAQ,GAAG,IAAI,MAAM;IACzB,IAAI,CAAC,MAAM,OAAO,GAAG,QAAQ,qBAAqB,KAAK,CAAC;GACzD;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,6 +1,6 @@
1
- import { O as errorRuntime$1, o as errorContractConfigMissing$1 } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
2
- import { t as assertFrameworkComponentsCompatible } from "./framework-components-CXxMNF8E-C-g2cchI.mjs";
3
- import { t as createProjectSpecifierResolver } from "./project-import-root-Bkz1gPB2-jhrMFebo.mjs";
1
+ import { O as errorRuntime$1, o as errorContractConfigMissing$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
+ import { t as assertFrameworkComponentsCompatible } from "./framework-components-CPFWl2Ix-CrIZL3jG.mjs";
3
+ import { t as createProjectSpecifierResolver } from "./project-import-root-BPuwl2j1-DTX9G73z.mjs";
4
4
  import { t as enrichContract } from "./contract-enrichment-DrMvvY2A-DxNGeF4d.mjs";
5
5
  import { r as getEmittedArtifactPaths, t as emit } from "./exports-BCLg4CiV-05kuwcb0.mjs";
6
6
  import { createRequire } from "node:module";
@@ -9,7 +9,7 @@ import { basename, dirname, join } from "pathe";
9
9
  import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
10
10
  import { createControlStack } from "@prisma/orm-framework/components/control";
11
11
  import { abortable } from "@prisma/orm-framework/utils/abortable";
12
- //#region ../../../1-framework/3-tooling/cli/dist/contract-emit-WIAaN0lC.mjs
12
+ //#region ../../../1-framework/3-tooling/cli/dist/contract-emit-CrYO0A8x.mjs
13
13
  /**
14
14
  * Per-output FIFO queue for `executeContractEmit`.
15
15
  *
@@ -327,4 +327,4 @@ async function executeContractEmit(options) {
327
327
  //#endregion
328
328
  export { executeContractEmit as n, disposeEmitQueue as t };
329
329
 
330
- //# sourceMappingURL=contract-emit-WIAaN0lC-DKOdtrUQ.mjs.map
330
+ //# sourceMappingURL=contract-emit-CrYO0A8x-60BOqXFr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-emit-WIAaN0lC-DKOdtrUQ.mjs","names":["errorRuntime","errorContractConfigMissing"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-WIAaN0lC.mjs"],"sourcesContent":["import { D as errorRuntime, a as errorContractConfigMissing } from \"./cli-errors-CihMAEVj.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-CXxMNF8E.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-Bkz1gPB2.mjs\";\nimport { t as enrichContract } from \"./contract-enrichment-DrMvvY2A.mjs\";\nimport { createRequire } from \"node:module\";\nimport { emit, getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join } from \"pathe\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { abortable } from \"@internal/utils/abortable\";\n//#region src/utils/emit-queue.ts\n/**\n* Per-output FIFO queue for `executeContractEmit`.\n*\n* Ensures that at most one emit (load → resolve source → emit bytes → publish)\n* runs per output JSON path at a time. Concurrent calls for the same path\n* line up behind the in-flight one and run in submission order; the user-visible\n* outcome is \"last submission wins on disk\" without any supersession bookkeeping.\n*\n* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`\n* when they stop publishing to a path, otherwise the module-global `Map`\n* accumulates one entry per unique output path for the lifetime of the process.\n*/\nconst emitQueues = /* @__PURE__ */ new Map();\nfunction queueEmitByOutput(outputJsonPath, action) {\n\tconst next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);\n\temitQueues.set(outputJsonPath, next);\n\treturn next;\n}\nfunction disposeEmitQueue(outputJsonPath) {\n\temitQueues.delete(outputJsonPath);\n}\n//#endregion\n//#region src/utils/publish-contract-artifact-pair.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction createTempArtifactPath(path, publicationToken, phase) {\n\treturn join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);\n}\nasync function readExistingArtifact(path) {\n\ttry {\n\t\treturn { content: await readFile(path, \"utf-8\") };\n\t} catch (error) {\n\t\tif (isRecord$1(error) && error[\"code\"] === \"ENOENT\") return \"remove\";\n\t\tthrow error;\n\t}\n}\nasync function restoreArtifact(path, previous, publicationToken) {\n\tif (previous === \"remove\") {\n\t\tawait rm(path, { force: true });\n\t\treturn;\n\t}\n\tconst restorePath = createTempArtifactPath(path, publicationToken, \"rollback\");\n\tawait writeFile(restorePath, previous.content, \"utf-8\");\n\ttry {\n\t\tawait rename(restorePath, path);\n\t} finally {\n\t\tawait rm(restorePath, { force: true });\n\t}\n}\nfunction withRollbackFailureCause(error, rollbackFailures) {\n\tconst rollbackCause = new AggregateError(rollbackFailures, \"Failed to restore published artifacts\");\n\tif (error instanceof Error) {\n\t\tObject.defineProperty(error, \"cause\", {\n\t\t\tvalue: rollbackCause,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t\treturn error;\n\t}\n\treturn new Error(String(error), { cause: rollbackCause });\n}\nasync function publishPairWithRollback(entries, publicationToken) {\n\tconst replaced = [];\n\ttry {\n\t\tfor (const entry of entries) {\n\t\t\tawait rename(entry.tempPath, entry.outputPath);\n\t\t\treplaced.push(entry);\n\t\t}\n\t} catch (error) {\n\t\tconst rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === \"rejected\" ? [result.reason] : []);\n\t\tif (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);\n\t\tthrow error;\n\t}\n}\nasync function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {\n\tconst tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, \"next\");\n\tconst tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, \"next\");\n\ttry {\n\t\tawait writeFile(tempJsonPath, contractJson, \"utf-8\");\n\t\tawait writeFile(tempDtsPath, contractDts, \"utf-8\");\n\t\tif (await beforePublish?.() === false) return false;\n\t\tconst previousJson = await readExistingArtifact(outputJsonPath);\n\t\tawait publishPairWithRollback([{\n\t\t\ttempPath: tempDtsPath,\n\t\t\toutputPath: outputDtsPath,\n\t\t\tprevious: await readExistingArtifact(outputDtsPath)\n\t\t}, {\n\t\t\ttempPath: tempJsonPath,\n\t\t\toutputPath: outputJsonPath,\n\t\t\tprevious: previousJson\n\t\t}], publicationToken);\n\t\treturn true;\n\t} finally {\n\t\tawait Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);\n\t}\n}\n//#endregion\n//#region src/utils/validate-contract-deps.ts\nconst IMPORT_PATTERN = /import\\s+type\\s+.*?\\s+from\\s+['\"](@[^/]+\\/[^/'\"]+)/g;\nfunction extractPackageSpecifiers(dtsContent) {\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const match of dtsContent.matchAll(IMPORT_PATTERN)) {\n\t\tconst pkg = match[1];\n\t\tif (pkg) packages.add(pkg);\n\t}\n\treturn [...packages];\n}\nfunction validateContractDeps(dtsContent, projectRoot) {\n\tconst packages = extractPackageSpecifiers(dtsContent);\n\tconst resolve = createRequire(`${projectRoot}/package.json`);\n\tconst missing = [];\n\tfor (const pkg of packages) try {\n\t\tresolve.resolve(`${pkg}/package.json`);\n\t} catch {\n\t\tmissing.push(pkg);\n\t}\n\tif (missing.length === 0) return { missing };\n\treturn {\n\t\tmissing,\n\t\twarning: [\n\t\t\t\"contract.d.ts imports types from packages that are not installed:\",\n\t\t\tmissing.map((p) => ` - ${p}`).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"Install them with your package manager:\",\n\t\t\t...missing.map((p) => ` ${p}`)\n\t\t].join(\"\\n\")\n\t};\n}\n//#endregion\n//#region src/control-api/operations/contract-emit.ts\nconst EMIT_ACTION = \"emit\";\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction startSpan(onProgress, spanId, label) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanStart\",\n\t\tspanId,\n\t\tlabel\n\t});\n}\nfunction endSpan(onProgress, spanId, outcome) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanEnd\",\n\t\tspanId,\n\t\toutcome\n\t});\n}\nfunction failedToResolveContractSource(why, fix, meta, cause) {\n\treturn errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to resolve contract source\", {\n\t\twhy,\n\t\tfix,\n\t\t...ifDefined(\"meta\", meta),\n\t\t...ifDefined(\"cause\", cause)\n\t});\n}\nfunction diagnosticLocationSuffix(diagnostic) {\n\tconst sourceId = typeof diagnostic[\"sourceId\"] === \"string\" ? diagnostic[\"sourceId\"] : void 0;\n\tconst span = isRecord(diagnostic[\"span\"]) ? diagnostic[\"span\"] : void 0;\n\tconst start = span && isRecord(span[\"start\"]) ? span[\"start\"] : void 0;\n\tconst line = start && typeof start[\"line\"] === \"number\" ? start[\"line\"] : void 0;\n\tconst column = start && typeof start[\"column\"] === \"number\" ? start[\"column\"] : void 0;\n\tif (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;\n\tif (sourceId) return ` (${sourceId})`;\n\treturn \"\";\n}\nfunction mapDiagnosticsToIssues(diagnostics) {\n\tconst issues = [];\n\tfor (const raw of diagnostics) {\n\t\tif (!isRecord(raw)) continue;\n\t\tconst code = typeof raw[\"code\"] === \"string\" ? raw[\"code\"] : \"diagnostic\";\n\t\tconst message = typeof raw[\"message\"] === \"string\" ? raw[\"message\"] : \"\";\n\t\tissues.push({\n\t\t\tkind: code,\n\t\t\tmessage: `${message}${diagnosticLocationSuffix(raw)}`\n\t\t});\n\t}\n\treturn issues;\n}\nfunction validateProviderResult(providerResult) {\n\tif (!isRecord(providerResult) || typeof providerResult[\"ok\"] !== \"boolean\") return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed result shape.\", \"Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).\")\n\t};\n\tif (providerResult[\"ok\"]) {\n\t\tif (!(\"value\" in providerResult)) return {\n\t\t\tok: false,\n\t\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed success result: missing value.\", \"Ensure contract.source.load success payload is ok(Contract).\")\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalue: providerResult[\"value\"]\n\t\t};\n\t}\n\tconst failure = providerResult[\"failure\"];\n\tif (!isRecord(failure) || typeof failure[\"summary\"] !== \"string\" || !Array.isArray(failure[\"diagnostics\"])) return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed failure result: expected summary and diagnostics.\", \"Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).\")\n\t};\n\treturn {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(String(failure[\"summary\"]), \"Fix contract source diagnostics and return ok(Contract).\", {\n\t\t\tdiagnostics: failure[\"diagnostics\"],\n\t\t\tissues: mapDiagnosticsToIssues(failure[\"diagnostics\"]),\n\t\t\t...ifDefined(\"providerMeta\", failure[\"meta\"])\n\t\t})\n\t};\n}\n/**\n* Canonical contract emit operation.\n*\n* This is the SINGLE publication path used by both the CLI command\n* (`prisma-next contract emit`) and the Vite plugin\n* (`@internal/vite-plugin-contract-emit`). New callers must go through this\n* function rather than re-implementing load → emit → publish.\n*\n* The whole flow (load config → resolve source → emit bytes → atomic publish)\n* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls\n* for the same output line up FIFO; the user-visible outcome is \"last\n* submission wins on disk\" without any supersession bookkeeping. Within a\n* single emit, `publishContractArtifactPair` stages temp files, renames\n* `contract.d.ts` before `contract.json`, and attempts to restore the previous\n* pair if either rename fails — so type-only consumers never observe a\n* mismatched pair.\n*\n* @throws {CliStructuredError} on config/source/validation problems\n* @throws {DOMException} `AbortError` if cancelled via `signal`\n*/\nasync function executeContractEmit(options) {\n\tconst { config, configPath, outputPath, signal = new AbortController().signal, onProgress } = options;\n\tconst unlessAborted = abortable(signal);\n\tif (!config.contract) throw errorContractConfigMissing({ why: \"Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }\" });\n\tconst contractConfig = config.contract;\n\tconst effectiveOutput = outputPath !== void 0 ? join(outputPath, \"contract.json\") : contractConfig.output;\n\tif (!effectiveOutput) throw errorContractConfigMissing({ why: \"Contract config must have output path. This should not happen if defineConfig() was used.\" });\n\tif (typeof contractConfig.source?.load !== \"function\") throw errorContractConfigMissing({ why: \"Contract config must include a valid source provider object\" });\n\tlet outputPaths;\n\ttry {\n\t\toutputPaths = getEmittedArtifactPaths(effectiveOutput);\n\t} catch (error) {\n\t\tthrow errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) });\n\t}\n\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;\n\treturn queueEmitByOutput(outputJsonPath, async () => {\n\t\tconst stack = createControlStack(config);\n\t\tconst sourceContext = {\n\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\tcodecLookup: stack.codecLookup,\n\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\tcapabilities: stack.capabilities\n\t\t};\n\t\tstartSpan(onProgress, \"resolveSource\", \"Resolving contract source...\");\n\t\tlet providerResult;\n\t\ttry {\n\t\t\tproviderResult = await unlessAborted(contractConfig.source.load(sourceContext));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tif (signal.aborted || isRecord(error) && error[\"name\"] === \"AbortError\") throw error;\n\t\t\tthrow failedToResolveContractSource(error instanceof Error ? error.message : String(error), \"Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.\", void 0, error);\n\t\t}\n\t\tconst validatedContract = validateProviderResult(providerResult);\n\t\tif (!validatedContract.ok) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tthrow validatedContract.error;\n\t\t}\n\t\tendSpan(onProgress, \"resolveSource\", \"ok\");\n\t\tstartSpan(onProgress, \"emit\", \"Emitting contract...\");\n\t\tlet emitResult;\n\t\ttry {\n\t\t\tconst familyInstance = config.family.create(stack);\n\t\t\tconst rawComponents = [\n\t\t\t\tconfig.target,\n\t\t\t\tconfig.adapter,\n\t\t\t\t...config.extensions ?? []\n\t\t\t];\n\t\t\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);\n\t\t\tconst enrichedIR = enrichContract(validatedContract.value, frameworkComponents);\n\t\t\tconst rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tconst deserializedContract = familyInstance.deserializeContract(rawContractJson);\n\t\t\tconst { contractSerializer } = config.target;\n\t\t\tconst serializeContract = (c) => contractSerializer.serializeContract(c);\n\t\t\temitResult = await unlessAborted(emit(deserializedContract, stack, config.family.emission, {\n\t\t\t\toutputJsonPath,\n\t\t\t\tserializeContract,\n\t\t\t\tresolveImportSpecifier: createProjectSpecifierResolver(configPath),\n\t\t\t\t...ifDefined(\"shouldPreserveEmpty\", contractSerializer.shouldPreserveEmpty),\n\t\t\t\t...ifDefined(\"sortStorage\", contractSerializer.sortStorage)\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"emit\", \"error\");\n\t\t\tthrow error;\n\t\t}\n\t\tendSpan(onProgress, \"emit\", \"ok\");\n\t\tawait unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));\n\t\tawait publishContractArtifactPair({\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath,\n\t\t\tcontractJson: emitResult.contractJson,\n\t\t\tcontractDts: emitResult.contractDts,\n\t\t\tpublicationToken: String(process.hrtime.bigint())\n\t\t});\n\t\tconst validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;\n\t\treturn {\n\t\t\tstorageHash: emitResult.storageHash,\n\t\t\t...ifDefined(\"executionHash\", emitResult.executionHash),\n\t\t\tprofileHash: emitResult.profileHash,\n\t\t\tfiles: {\n\t\t\t\tjson: outputJsonPath,\n\t\t\t\tdts: outputDtsPath\n\t\t\t},\n\t\t\t...ifDefined(\"validationWarning\", validationWarning)\n\t\t};\n\t});\n}\n//#endregion\nexport { disposeEmitQueue as n, executeContractEmit as t };\n\n//# sourceMappingURL=contract-emit-WIAaN0lC.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,6BAA6B,IAAI,IAAI;AAC3C,SAAS,kBAAkB,gBAAgB,QAAQ;CAClD,MAAM,QAAQ,WAAW,IAAI,cAAc,KAAK,QAAQ,QAAQ,EAAA,CAAG,KAAK,QAAQ,MAAM;CACtF,WAAW,IAAI,gBAAgB,IAAI;CACnC,OAAO;AACR;AACA,SAAS,iBAAiB,gBAAgB;CACzC,WAAW,OAAO,cAAc;AACjC;AAGA,SAAS,WAAW,OAAO;CAC1B,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AACA,SAAS,uBAAuB,MAAM,kBAAkB,OAAO;CAC9D,OAAO,KAAK,QAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,EAAE,GAAG,QAAQ,IAAI,GAAG,iBAAiB,GAAG,MAAM,KAAK;AAChG;AACA,eAAe,qBAAqB,MAAM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AgB;IACrB,OAAO;IACP,OAAO;IACP,GAAG,OAAO,cAAc,CAAC;GAC1B;GACA,MAAM,sBAAsB,oCAAoC,OAAO,OAAO,UAAU,OAAO,OAAO,UAAU,aAAa;GAC7H,MAAM,aAAa,eAAe,kBAAkB,OAAO,mBAAmB;GAC9E,MAAM,kBAAkB,OAAO,OAAO,mBAAmB,kBAAkB,UAAU;GACrF,MAAM,uBAAuB,eAAe,oBAAoB,eAAe;GAC/E,MAAM,EAAE,uBAAuB,OAAO;GACtC,MAAM,qBAAqB,MAAM,mBAAmB,kBAAkB,CAAC;GACvE,aAAa,MAAM,cAAc,KAAK,sBAAsB,OAAO,OAAO,OAAO,UAAU;IAC1F;IACA;IACA,wBAAwB,+BAA+B,UAAU;IACjE,GAAG,UAAU,uBAAuB,mBAAmB,mBAAmB;IAC1E,GAAG,UAAU,eAAe,mBAAmB,WAAW;GAC3D,CAAC,CAAC;EACH,SAAS,OAAO;GACf,QAAQ,YAAY,QAAQ,OAAO;GACnC,MAAM;EACP;EACA,QAAQ,YAAY,QAAQ,IAAI;EAChC,MAAM,cAAc,MAAM,QAAQ,cAAc,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC;EACvE,MAAM,4BAA4B;GACjC;GACA;GACA,cAAc,WAAW;GACzB,aAAa,WAAW;GACxB,kBAAkB,OAAO,QAAQ,OAAO,OAAO,CAAC;EACjD,CAAC;EACD,MAAM,oBAAoB,qBAAqB,WAAW,aAAa,QAAQ,aAAa,CAAC,CAAC,CAAC;EAC/F,OAAO;GACN,aAAa,WAAW;GACxB,GAAG,UAAU,iBAAiB,WAAW,aAAa;GACtD,aAAa,WAAW;GACxB,OAAO;IACN,MAAM;IACN,KAAK;GACN;GACA,GAAG,UAAU,qBAAqB,iBAAiB;EACpD;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"contract-emit-CrYO0A8x-60BOqXFr.mjs","names":["errorRuntime","errorContractConfigMissing"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-CrYO0A8x.mjs"],"sourcesContent":["import { D as errorRuntime, a as errorContractConfigMissing } from \"./cli-errors-C6_pH59O.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-CPFWl2Ix.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-BPuwl2j1.mjs\";\nimport { t as enrichContract } from \"./contract-enrichment-DrMvvY2A.mjs\";\nimport { createRequire } from \"node:module\";\nimport { emit, getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join } from \"pathe\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { abortable } from \"@internal/utils/abortable\";\n//#region src/utils/emit-queue.ts\n/**\n* Per-output FIFO queue for `executeContractEmit`.\n*\n* Ensures that at most one emit (load → resolve source → emit bytes → publish)\n* runs per output JSON path at a time. Concurrent calls for the same path\n* line up behind the in-flight one and run in submission order; the user-visible\n* outcome is \"last submission wins on disk\" without any supersession bookkeeping.\n*\n* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`\n* when they stop publishing to a path, otherwise the module-global `Map`\n* accumulates one entry per unique output path for the lifetime of the process.\n*/\nconst emitQueues = /* @__PURE__ */ new Map();\nfunction queueEmitByOutput(outputJsonPath, action) {\n\tconst next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);\n\temitQueues.set(outputJsonPath, next);\n\treturn next;\n}\nfunction disposeEmitQueue(outputJsonPath) {\n\temitQueues.delete(outputJsonPath);\n}\n//#endregion\n//#region src/utils/publish-contract-artifact-pair.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction createTempArtifactPath(path, publicationToken, phase) {\n\treturn join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);\n}\nasync function readExistingArtifact(path) {\n\ttry {\n\t\treturn { content: await readFile(path, \"utf-8\") };\n\t} catch (error) {\n\t\tif (isRecord$1(error) && error[\"code\"] === \"ENOENT\") return \"remove\";\n\t\tthrow error;\n\t}\n}\nasync function restoreArtifact(path, previous, publicationToken) {\n\tif (previous === \"remove\") {\n\t\tawait rm(path, { force: true });\n\t\treturn;\n\t}\n\tconst restorePath = createTempArtifactPath(path, publicationToken, \"rollback\");\n\tawait writeFile(restorePath, previous.content, \"utf-8\");\n\ttry {\n\t\tawait rename(restorePath, path);\n\t} finally {\n\t\tawait rm(restorePath, { force: true });\n\t}\n}\nfunction withRollbackFailureCause(error, rollbackFailures) {\n\tconst rollbackCause = new AggregateError(rollbackFailures, \"Failed to restore published artifacts\");\n\tif (error instanceof Error) {\n\t\tObject.defineProperty(error, \"cause\", {\n\t\t\tvalue: rollbackCause,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t\treturn error;\n\t}\n\treturn new Error(String(error), { cause: rollbackCause });\n}\nasync function publishPairWithRollback(entries, publicationToken) {\n\tconst replaced = [];\n\ttry {\n\t\tfor (const entry of entries) {\n\t\t\tawait rename(entry.tempPath, entry.outputPath);\n\t\t\treplaced.push(entry);\n\t\t}\n\t} catch (error) {\n\t\tconst rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === \"rejected\" ? [result.reason] : []);\n\t\tif (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);\n\t\tthrow error;\n\t}\n}\nasync function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {\n\tconst tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, \"next\");\n\tconst tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, \"next\");\n\ttry {\n\t\tawait writeFile(tempJsonPath, contractJson, \"utf-8\");\n\t\tawait writeFile(tempDtsPath, contractDts, \"utf-8\");\n\t\tif (await beforePublish?.() === false) return false;\n\t\tconst previousJson = await readExistingArtifact(outputJsonPath);\n\t\tawait publishPairWithRollback([{\n\t\t\ttempPath: tempDtsPath,\n\t\t\toutputPath: outputDtsPath,\n\t\t\tprevious: await readExistingArtifact(outputDtsPath)\n\t\t}, {\n\t\t\ttempPath: tempJsonPath,\n\t\t\toutputPath: outputJsonPath,\n\t\t\tprevious: previousJson\n\t\t}], publicationToken);\n\t\treturn true;\n\t} finally {\n\t\tawait Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);\n\t}\n}\n//#endregion\n//#region src/utils/validate-contract-deps.ts\nconst IMPORT_PATTERN = /import\\s+type\\s+.*?\\s+from\\s+['\"](@[^/]+\\/[^/'\"]+)/g;\nfunction extractPackageSpecifiers(dtsContent) {\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const match of dtsContent.matchAll(IMPORT_PATTERN)) {\n\t\tconst pkg = match[1];\n\t\tif (pkg) packages.add(pkg);\n\t}\n\treturn [...packages];\n}\nfunction validateContractDeps(dtsContent, projectRoot) {\n\tconst packages = extractPackageSpecifiers(dtsContent);\n\tconst resolve = createRequire(`${projectRoot}/package.json`);\n\tconst missing = [];\n\tfor (const pkg of packages) try {\n\t\tresolve.resolve(`${pkg}/package.json`);\n\t} catch {\n\t\tmissing.push(pkg);\n\t}\n\tif (missing.length === 0) return { missing };\n\treturn {\n\t\tmissing,\n\t\twarning: [\n\t\t\t\"contract.d.ts imports types from packages that are not installed:\",\n\t\t\tmissing.map((p) => ` - ${p}`).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"Install them with your package manager:\",\n\t\t\t...missing.map((p) => ` ${p}`)\n\t\t].join(\"\\n\")\n\t};\n}\n//#endregion\n//#region src/control-api/operations/contract-emit.ts\nconst EMIT_ACTION = \"emit\";\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction startSpan(onProgress, spanId, label) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanStart\",\n\t\tspanId,\n\t\tlabel\n\t});\n}\nfunction endSpan(onProgress, spanId, outcome) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanEnd\",\n\t\tspanId,\n\t\toutcome\n\t});\n}\nfunction failedToResolveContractSource(why, fix, meta, cause) {\n\treturn errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to resolve contract source\", {\n\t\twhy,\n\t\tfix,\n\t\t...ifDefined(\"meta\", meta),\n\t\t...ifDefined(\"cause\", cause)\n\t});\n}\nfunction diagnosticLocationSuffix(diagnostic) {\n\tconst sourceId = typeof diagnostic[\"sourceId\"] === \"string\" ? diagnostic[\"sourceId\"] : void 0;\n\tconst span = isRecord(diagnostic[\"span\"]) ? diagnostic[\"span\"] : void 0;\n\tconst start = span && isRecord(span[\"start\"]) ? span[\"start\"] : void 0;\n\tconst line = start && typeof start[\"line\"] === \"number\" ? start[\"line\"] : void 0;\n\tconst column = start && typeof start[\"column\"] === \"number\" ? start[\"column\"] : void 0;\n\tif (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;\n\tif (sourceId) return ` (${sourceId})`;\n\treturn \"\";\n}\nfunction mapDiagnosticsToIssues(diagnostics) {\n\tconst issues = [];\n\tfor (const raw of diagnostics) {\n\t\tif (!isRecord(raw)) continue;\n\t\tconst code = typeof raw[\"code\"] === \"string\" ? raw[\"code\"] : \"diagnostic\";\n\t\tconst message = typeof raw[\"message\"] === \"string\" ? raw[\"message\"] : \"\";\n\t\tissues.push({\n\t\t\tkind: code,\n\t\t\tmessage: `${message}${diagnosticLocationSuffix(raw)}`\n\t\t});\n\t}\n\treturn issues;\n}\nfunction validateProviderResult(providerResult) {\n\tif (!isRecord(providerResult) || typeof providerResult[\"ok\"] !== \"boolean\") return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed result shape.\", \"Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).\")\n\t};\n\tif (providerResult[\"ok\"]) {\n\t\tif (!(\"value\" in providerResult)) return {\n\t\t\tok: false,\n\t\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed success result: missing value.\", \"Ensure contract.source.load success payload is ok(Contract).\")\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalue: providerResult[\"value\"]\n\t\t};\n\t}\n\tconst failure = providerResult[\"failure\"];\n\tif (!isRecord(failure) || typeof failure[\"summary\"] !== \"string\" || !Array.isArray(failure[\"diagnostics\"])) return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed failure result: expected summary and diagnostics.\", \"Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).\")\n\t};\n\treturn {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(String(failure[\"summary\"]), \"Fix contract source diagnostics and return ok(Contract).\", {\n\t\t\tdiagnostics: failure[\"diagnostics\"],\n\t\t\tissues: mapDiagnosticsToIssues(failure[\"diagnostics\"]),\n\t\t\t...ifDefined(\"providerMeta\", failure[\"meta\"])\n\t\t})\n\t};\n}\n/**\n* Canonical contract emit operation.\n*\n* This is the SINGLE publication path used by both the CLI command\n* (`prisma-next contract emit`) and the Vite plugin\n* (`@internal/vite-plugin-contract-emit`). New callers must go through this\n* function rather than re-implementing load → emit → publish.\n*\n* The whole flow (load config → resolve source → emit bytes → atomic publish)\n* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls\n* for the same output line up FIFO; the user-visible outcome is \"last\n* submission wins on disk\" without any supersession bookkeeping. Within a\n* single emit, `publishContractArtifactPair` stages temp files, renames\n* `contract.d.ts` before `contract.json`, and attempts to restore the previous\n* pair if either rename fails — so type-only consumers never observe a\n* mismatched pair.\n*\n* @throws {CliStructuredError} on config/source/validation problems\n* @throws {DOMException} `AbortError` if cancelled via `signal`\n*/\nasync function executeContractEmit(options) {\n\tconst { config, configPath, outputPath, signal = new AbortController().signal, onProgress } = options;\n\tconst unlessAborted = abortable(signal);\n\tif (!config.contract) throw errorContractConfigMissing({ why: \"Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }\" });\n\tconst contractConfig = config.contract;\n\tconst effectiveOutput = outputPath !== void 0 ? join(outputPath, \"contract.json\") : contractConfig.output;\n\tif (!effectiveOutput) throw errorContractConfigMissing({ why: \"Contract config must have output path. This should not happen if defineConfig() was used.\" });\n\tif (typeof contractConfig.source?.load !== \"function\") throw errorContractConfigMissing({ why: \"Contract config must include a valid source provider object\" });\n\tlet outputPaths;\n\ttry {\n\t\toutputPaths = getEmittedArtifactPaths(effectiveOutput);\n\t} catch (error) {\n\t\tthrow errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) });\n\t}\n\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;\n\treturn queueEmitByOutput(outputJsonPath, async () => {\n\t\tconst stack = createControlStack(config);\n\t\tconst sourceContext = {\n\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\tcodecLookup: stack.codecLookup,\n\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\tcapabilities: stack.capabilities\n\t\t};\n\t\tstartSpan(onProgress, \"resolveSource\", \"Resolving contract source...\");\n\t\tlet providerResult;\n\t\ttry {\n\t\t\tproviderResult = await unlessAborted(contractConfig.source.load(sourceContext));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tif (signal.aborted || isRecord(error) && error[\"name\"] === \"AbortError\") throw error;\n\t\t\tthrow failedToResolveContractSource(error instanceof Error ? error.message : String(error), \"Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.\", void 0, error);\n\t\t}\n\t\tconst validatedContract = validateProviderResult(providerResult);\n\t\tif (!validatedContract.ok) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tthrow validatedContract.error;\n\t\t}\n\t\tendSpan(onProgress, \"resolveSource\", \"ok\");\n\t\tstartSpan(onProgress, \"emit\", \"Emitting contract...\");\n\t\tlet emitResult;\n\t\ttry {\n\t\t\tconst familyInstance = config.family.create(stack);\n\t\t\tconst rawComponents = [\n\t\t\t\tconfig.target,\n\t\t\t\tconfig.adapter,\n\t\t\t\t...config.extensions ?? []\n\t\t\t];\n\t\t\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);\n\t\t\tconst enrichedIR = enrichContract(validatedContract.value, frameworkComponents);\n\t\t\tconst rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tconst deserializedContract = familyInstance.deserializeContract(rawContractJson);\n\t\t\tconst { contractSerializer } = config.target;\n\t\t\tconst serializeContract = (c) => contractSerializer.serializeContract(c);\n\t\t\temitResult = await unlessAborted(emit(deserializedContract, stack, config.family.emission, {\n\t\t\t\toutputJsonPath,\n\t\t\t\tserializeContract,\n\t\t\t\tresolveImportSpecifier: createProjectSpecifierResolver(configPath),\n\t\t\t\t...ifDefined(\"shouldPreserveEmpty\", contractSerializer.shouldPreserveEmpty),\n\t\t\t\t...ifDefined(\"sortStorage\", contractSerializer.sortStorage)\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"emit\", \"error\");\n\t\t\tthrow error;\n\t\t}\n\t\tendSpan(onProgress, \"emit\", \"ok\");\n\t\tawait unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));\n\t\tawait publishContractArtifactPair({\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath,\n\t\t\tcontractJson: emitResult.contractJson,\n\t\t\tcontractDts: emitResult.contractDts,\n\t\t\tpublicationToken: String(process.hrtime.bigint())\n\t\t});\n\t\tconst validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;\n\t\treturn {\n\t\t\tstorageHash: emitResult.storageHash,\n\t\t\t...ifDefined(\"executionHash\", emitResult.executionHash),\n\t\t\tprofileHash: emitResult.profileHash,\n\t\t\tfiles: {\n\t\t\t\tjson: outputJsonPath,\n\t\t\t\tdts: outputDtsPath\n\t\t\t},\n\t\t\t...ifDefined(\"validationWarning\", validationWarning)\n\t\t};\n\t});\n}\n//#endregion\nexport { disposeEmitQueue as n, executeContractEmit as t };\n\n//# sourceMappingURL=contract-emit-CrYO0A8x.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,6BAA6B,IAAI,IAAI;AAC3C,SAAS,kBAAkB,gBAAgB,QAAQ;CAClD,MAAM,QAAQ,WAAW,IAAI,cAAc,KAAK,QAAQ,QAAQ,EAAA,CAAG,KAAK,QAAQ,MAAM;CACtF,WAAW,IAAI,gBAAgB,IAAI;CACnC,OAAO;AACR;AACA,SAAS,iBAAiB,gBAAgB;CACzC,WAAW,OAAO,cAAc;AACjC;AAGA,SAAS,WAAW,OAAO;CAC1B,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AACA,SAAS,uBAAuB,MAAM,kBAAkB,OAAO;CAC9D,OAAO,KAAK,QAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,EAAE,GAAG,QAAQ,IAAI,GAAG,iBAAiB,GAAG,MAAM,KAAK;AAChG;AACA,eAAe,qBAAqB,MAAM;CACzC,IAAI;EACH,OAAO,EAAE,SAAS,MAAM,SAAS,MAAM,OAAO,EAAE;CACjD,SAAS,OAAO;EACf,IAAI,WAAW,KAAK,KAAK,MAAM,YAAY,UAAU,OAAO;EAC5D,MAAM;CACP;AACD;AACA,eAAe,gBAAgB,MAAM,UAAU,kBAAkB;CAChE,IAAI,aAAa,UAAU;EAC1B,MAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC;EAC9B;CACD;CACA,MAAM,cAAc,uBAAuB,MAAM,kBAAkB,UAAU;CAC7E,MAAM,UAAU,aAAa,SAAS,SAAS,OAAO;CACtD,IAAI;EACH,MAAM,OAAO,aAAa,IAAI;CAC/B,UAAU;EACT,MAAM,GAAG,aAAa,EAA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+B,UAAU;IACjE,GAAG,UAAU,uBAAuB,mBAAmB,mBAAmB;IAC1E,GAAG,UAAU,eAAe,mBAAmB,WAAW;GAC3D,CAAC,CAAC;EACH,SAAS,OAAO;GACf,QAAQ,YAAY,QAAQ,OAAO;GACnC,MAAM;EACP;EACA,QAAQ,YAAY,QAAQ,IAAI;EAChC,MAAM,cAAc,MAAM,QAAQ,cAAc,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC;EACvE,MAAM,4BAA4B;GACjC;GACA;GACA,cAAc,WAAW;GACzB,aAAa,WAAW;GACxB,kBAAkB,OAAO,QAAQ,OAAO,OAAO,CAAC;EACjD,CAAC;EACD,MAAM,oBAAoB,qBAAqB,WAAW,aAAa,QAAQ,aAAa,CAAC,CAAC,CAAC;EAC/F,OAAO;GACN,aAAa,WAAW;GACxB,GAAG,UAAU,iBAAiB,WAAW,aAAa;GACtD,aAAa,WAAW;GACxB,OAAO;IACN,MAAM;IACN,KAAK;GACN;GACA,GAAG,UAAU,qBAAqB,iBAAiB;EACpD;CACD,CAAC;AACF"}
@@ -0,0 +1,2 @@
1
+ import { n as executeContractEmit } from "./contract-emit-CrYO0A8x-60BOqXFr.mjs";
2
+ export { executeContractEmit };
@@ -1,13 +1,13 @@
1
- import { r as createTerminalUI } from "./terminal-ui-JJKxvT0q-CPDEJqqU.mjs";
2
- import { b as setCommandExamples, m as parseGlobalFlagsOrExit, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-Dw3LDEu_-B4AETH4D.mjs";
3
- import { t as inspectLiveSchema } from "./inspect-live-schema-BAiaX0n9-DBQFEsMC.mjs";
1
+ import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
2
+ import { b as setCommandExamples, m as parseGlobalFlagsOrExit, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
3
+ import { t as inspectLiveSchema } from "./inspect-live-schema-BaLAtOgO-Bs0gs_yP.mjs";
4
4
  import { errorRuntime } from "@prisma/orm-framework/errors/execution";
5
5
  import { dirname, relative, resolve } from "pathe";
6
6
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
7
7
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
8
8
  import { Command } from "commander";
9
9
  import { printPsl } from "@prisma/orm-framework/psl-printer";
10
- //#region ../../../1-framework/3-tooling/cli/dist/contract-infer-xOEwVWds.mjs
10
+ //#region ../../../1-framework/3-tooling/cli/dist/contract-infer-C8kLphsm.mjs
11
11
  /**
12
12
  * Resolves the output path for the inferred PSL contract.
13
13
  *
@@ -71,4 +71,4 @@ function createContractInferCommand() {
71
71
  //#endregion
72
72
  export { createContractInferCommand as t };
73
73
 
74
- //# sourceMappingURL=contract-infer-xOEwVWds-CE5gw1PF.mjs.map
74
+ //# sourceMappingURL=contract-infer-C8kLphsm-C7-AIYMc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-infer-xOEwVWds-CE5gw1PF.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-infer-xOEwVWds.mjs"],"sourcesContent":["import { t as createTerminalUI } from \"./terminal-ui-JJKxvT0q.mjs\";\nimport { _ as parseGlobalFlagsOrExit, d as setCommandExamples, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-Dw3LDEu_.mjs\";\nimport { t as inspectLiveSchema } from \"./inspect-live-schema-BAiaX0n9.mjs\";\nimport { Command } from \"commander\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, relative, resolve } from \"pathe\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { printPsl } from \"@internal/psl-printer\";\n//#region src/commands/contract-infer-paths.ts\n/**\n* Resolves the output path for the inferred PSL contract.\n*\n* Priority:\n* 1. --output <path> flag (resolved relative to cwd)\n* 2. contract.prisma next to config.contract.output\n* 3. Canonical default: contract.prisma in the config directory\n*/\nfunction resolveContractInferOutputPath(options, contractOutput) {\n\tconst configDir = options.config ? dirname(resolve(process.cwd(), options.config)) : process.cwd();\n\tif (options.output) return resolve(process.cwd(), options.output);\n\tif (contractOutput) return resolve(dirname(resolve(configDir, contractOutput)), \"contract.prisma\");\n\treturn resolve(configDir, \"contract.prisma\");\n}\n//#endregion\n//#region src/commands/contract-infer.ts\nasync function executeContractInferCommand(options, flags, ui, startTime) {\n\tconst inspectResult = await inspectLiveSchema(options, flags, ui, startTime, {\n\t\tcommandName: \"contract infer\",\n\t\tdescription: \"Infer a PSL contract from the live database schema\",\n\t\turl: \"https://pris.ly/contract-infer\"\n\t});\n\tif (!inspectResult.ok) return inspectResult;\n\tconst { config, target, meta, pslContractAst, pslBlockDescriptors } = inspectResult.value;\n\tif (!pslContractAst) return notOk(errorRuntime(\"CONTRACT.INFER_UNSUPPORTED\", \"contract infer is not supported for this family\", {\n\t\twhy: \"The configured family does not implement the PslContractInferCapable capability, so an inferred PSL contract cannot be produced from the live database schema.\",\n\t\tfix: \"Use a family that supports contract inference (e.g. SQL/Postgres).\"\n\t}));\n\tconst outputPath = resolveContractInferOutputPath(options, config.contract?.output);\n\tconst pslContent = printPsl(pslContractAst, { pslBlockDescriptors });\n\tif (existsSync(outputPath) && !flags.json && !flags.quiet) ui.stderr(`\\u26A0 Overwriting existing file: ${relative(process.cwd(), outputPath)}`);\n\tmkdirSync(dirname(outputPath), { recursive: true });\n\twriteFileSync(outputPath, pslContent, \"utf-8\");\n\tconst pslPath = relative(process.cwd(), outputPath);\n\tif (!flags.json && !flags.quiet) ui.stderr(`\\u2714 Contract written to ${pslPath}`);\n\treturn ok({\n\t\tok: true,\n\t\tsummary: \"Contract inferred successfully\",\n\t\ttarget,\n\t\tpsl: { path: pslPath },\n\t\tmeta,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractInferCommand() {\n\tconst command = new Command(\"infer\");\n\tsetCommandDescriptions(command, \"Infer a PSL contract from the live database schema\", \"Reads the live database schema and writes an inferred PSL contract to disk.\\nThis command stops at `contract.prisma`; follow it with `contract emit` and\\n`db sign` as separate steps.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract infer --db $DATABASE_URL\",\n\t\t\"prisma-next contract infer --db $DATABASE_URL --output ./src/prisma/contract.prisma\",\n\t\t\"prisma-next contract infer --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(\"--output <path>\", \"Write the inferred PSL contract to the specified path\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractInferCommand(options, flags, ui, Date.now()), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractInferCommand as t };\n\n//# sourceMappingURL=contract-infer-xOEwVWds.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,+BAA+B,SAAS,gBAAgB;CAChE,MAAM,YAAY,QAAQ,SAAS,QAAQ,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM,CAAC,IAAI,QAAQ,IAAI;CACjG,IAAI,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM;CAChE,IAAI,gBAAgB,OAAO,QAAQ,QAAQ,QAAQ,WAAW,cAAc,CAAC,GAAG,iBAAiB;CACjG,OAAO,QAAQ,WAAW,iBAAiB;AAC5C;AAGA,eAAe,4BAA4B,SAAS,OAAO,IAAI,WAAW;CACzE,MAAM,gBAAgB,MAAM,kBAAkB,SAAS,OAAO,IAAI,WAAW;EAC5E,aAAa;EACb,aAAa;EACb,KAAK;CACN,CAAC;CACD,IAAI,CAAC,cAAc,IAAI,OAAO;CAC9B,MAAM,EAAE,QAAQ,QAAQ,MAAM,gBAAg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C,CAAC;EACzD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"contract-infer-C8kLphsm-C7-AIYMc.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-infer-C8kLphsm.mjs"],"sourcesContent":["import { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { _ as parseGlobalFlagsOrExit, d as setCommandExamples, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { t as inspectLiveSchema } from \"./inspect-live-schema-BaLAtOgO.mjs\";\nimport { Command } from \"commander\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, relative, resolve } from \"pathe\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { printPsl } from \"@internal/psl-printer\";\n//#region src/commands/contract-infer-paths.ts\n/**\n* Resolves the output path for the inferred PSL contract.\n*\n* Priority:\n* 1. --output <path> flag (resolved relative to cwd)\n* 2. contract.prisma next to config.contract.output\n* 3. Canonical default: contract.prisma in the config directory\n*/\nfunction resolveContractInferOutputPath(options, contractOutput) {\n\tconst configDir = options.config ? dirname(resolve(process.cwd(), options.config)) : process.cwd();\n\tif (options.output) return resolve(process.cwd(), options.output);\n\tif (contractOutput) return resolve(dirname(resolve(configDir, contractOutput)), \"contract.prisma\");\n\treturn resolve(configDir, \"contract.prisma\");\n}\n//#endregion\n//#region src/commands/contract-infer.ts\nasync function executeContractInferCommand(options, flags, ui, startTime) {\n\tconst inspectResult = await inspectLiveSchema(options, flags, ui, startTime, {\n\t\tcommandName: \"contract infer\",\n\t\tdescription: \"Infer a PSL contract from the live database schema\",\n\t\turl: \"https://pris.ly/contract-infer\"\n\t});\n\tif (!inspectResult.ok) return inspectResult;\n\tconst { config, target, meta, pslContractAst, pslBlockDescriptors } = inspectResult.value;\n\tif (!pslContractAst) return notOk(errorRuntime(\"CONTRACT.INFER_UNSUPPORTED\", \"contract infer is not supported for this family\", {\n\t\twhy: \"The configured family does not implement the PslContractInferCapable capability, so an inferred PSL contract cannot be produced from the live database schema.\",\n\t\tfix: \"Use a family that supports contract inference (e.g. SQL/Postgres).\"\n\t}));\n\tconst outputPath = resolveContractInferOutputPath(options, config.contract?.output);\n\tconst pslContent = printPsl(pslContractAst, { pslBlockDescriptors });\n\tif (existsSync(outputPath) && !flags.json && !flags.quiet) ui.stderr(`\\u26A0 Overwriting existing file: ${relative(process.cwd(), outputPath)}`);\n\tmkdirSync(dirname(outputPath), { recursive: true });\n\twriteFileSync(outputPath, pslContent, \"utf-8\");\n\tconst pslPath = relative(process.cwd(), outputPath);\n\tif (!flags.json && !flags.quiet) ui.stderr(`\\u2714 Contract written to ${pslPath}`);\n\treturn ok({\n\t\tok: true,\n\t\tsummary: \"Contract inferred successfully\",\n\t\ttarget,\n\t\tpsl: { path: pslPath },\n\t\tmeta,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractInferCommand() {\n\tconst command = new Command(\"infer\");\n\tsetCommandDescriptions(command, \"Infer a PSL contract from the live database schema\", \"Reads the live database schema and writes an inferred PSL contract to disk.\\nThis command stops at `contract.prisma`; follow it with `contract emit` and\\n`db sign` as separate steps.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract infer --db $DATABASE_URL\",\n\t\t\"prisma-next contract infer --db $DATABASE_URL --output ./src/prisma/contract.prisma\",\n\t\t\"prisma-next contract infer --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(\"--output <path>\", \"Write the inferred PSL contract to the specified path\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractInferCommand(options, flags, ui, Date.now()), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractInferCommand as t };\n\n//# sourceMappingURL=contract-infer-C8kLphsm.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,+BAA+B,SAAS,gBAAgB;CAChE,MAAM,YAAY,QAAQ,SAAS,QAAQ,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM,CAAC,IAAI,QAAQ,IAAI;CACjG,IAAI,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM;CAChE,IAAI,gBAAgB,OAAO,QAAQ,QAAQ,QAAQ,WAAW,cAAc,CAAC,GAAG,iBAAiB;CACjG,OAAO,QAAQ,WAAW,iBAAiB;AAC5C;AAGA,eAAe,4BAA4B,SAAS,OAAO,IAAI,WAAW;CACzE,MAAM,gBAAgB,MAAM,kBAAkB,SAAS,OAAO,IAAI,WAAW;EAC5E,aAAa;EACb,aAAa;EACb,KAAK;CACN,CAAC;CACD,IAAI,CAAC,cAAc,IAAI,OAAO;CAC9B,MAAM,EAAE,QAAQ,QAAQ,MAAM,gBAAgB,wBAAwB,cAAc;CACpF,IAAI,CAAC,gBAAgB,OAAO,MAAM,aAAa,8BAA8B,mDAAmD;EAC/H,KAAK;EACL,KAAK;CACN,CAAC,CAAC;CACF,MAAM,aAAa,+BAA+B,SAAS,OAAO,UAAU,MAAM;CAClF,MAAM,aAAa,SAAS,gBAAgB,EAAE,oBAAoB,CAAC;CACnE,IAAI,WAAW,UAAU,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,qCAAqC,SAAS,QAAQ,IAAI,GAAG,UAAU,GAAG;CAC/I,UAAU,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;CAClD,cAAc,YAAY,YAAY,OAAO;CAC7C,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,UAAU;CAClD,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,8BAA8B,SAAS;CAClF,OAAO,GAAG;EACT,IAAI;EACJ,SAAS;EACT;EACA,KAAK,EAAE,MAAM,QAAQ;EACrB;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C,CAAC;AACF;AACA,SAAS,6BAA6B;CACrC,MAAM,UAAU,IAAI,QAAQ,OAAO;CACnC,uBAAuB,SAAS,sDAAsD,wLAAwL;CAC9Q,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,mBAAmB,uDAAuD,CAAC,CAAC,OAAO,OAAO,YAAY;EACpP,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,4BAA4B,SAAS,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,OAAO,KAAK,UAAU;GACtH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;EACzD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,13 +1,13 @@
1
- import { N as errorUnexpected, O as errorRuntime$1, P as mapRefResolutionError, d as errorFileNotFound, t as CliStructuredError$1 } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
1
+ import { N as errorUnexpected, O as errorRuntime$1, P as mapRefResolutionError, d as errorFileNotFound, t as CliStructuredError$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
2
  import { i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-CXbGUWGu-BQi6YS-H.mjs";
3
3
  import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs";
4
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-1wG1OiDk-D75luh5-.mjs";
4
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-BpdB-mHG-BiU0IUeb.mjs";
5
5
  import { n as parseContractRef } from "./ref-resolution-sGcINe7o.mjs";
6
6
  import { join } from "pathe";
7
7
  import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
8
8
  import { readFile } from "node:fs/promises";
9
9
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
10
- //#region ../../../1-framework/3-tooling/cli/dist/contract-snapshot-resolution-BnH6_mw7.mjs
10
+ //#region ../../../1-framework/3-tooling/cli/dist/contract-snapshot-resolution-BUUdIcgG.mjs
11
11
  /**
12
12
  * Resolves a user-supplied contract reference to an on-disk contract JSON (snapshot store or emitted contract), shared by db sign and db update --to.
13
13
  */
@@ -79,4 +79,4 @@ async function resolveContractRefToSnapshot(options) {
79
79
  //#endregion
80
80
  export { resolveContractRefToSnapshot as t };
81
81
 
82
- //# sourceMappingURL=contract-snapshot-resolution-BnH6_mw7-BrzAsS93.mjs.map
82
+ //# sourceMappingURL=contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs.map