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

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 (138) hide show
  1. package/dist/bin__prisma-next.mjs +23 -23
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/{caught-errors-BZ-9WASe-DH4DaDha.mjs → caught-errors-DLPzfzIW-CQ9BoXD-.mjs} +3 -3
  4. package/dist/{caught-errors-BZ-9WASe-DH4DaDha.mjs.map → caught-errors-DLPzfzIW-CQ9BoXD-.mjs.map} +1 -1
  5. package/dist/{cli-errors-C6_pH59O-CzD4SYcJ.mjs → cli-errors-BG6bItjG-DwdKIeGz.mjs} +4 -4
  6. package/dist/cli-errors-BG6bItjG-DwdKIeGz.mjs.map +1 -0
  7. package/dist/{cli-errors-f5PRtVdm-C6xVKeQn.d.mts → cli-errors-BiKBrOXc-JPxQqO58.d.mts} +48 -6
  8. package/dist/cli-errors-BiKBrOXc-JPxQqO58.d.mts.map +1 -0
  9. package/dist/cli.mjs +572 -33
  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 +11 -3
  36. package/dist/cli__control-api.d.mts.map +1 -1
  37. package/dist/cli__control-api.mjs +15 -15
  38. package/dist/cli__control-api__testing.d.mts +1 -1
  39. package/dist/{client-BqhVohc5-DFRVWFps.mjs → client-DU9qtBxW-BjVHiKzE.mjs} +57 -11
  40. package/dist/client-DU9qtBxW-BjVHiKzE.mjs.map +1 -0
  41. package/dist/{command-helpers-kD9CO1hd-BPhnkBin.mjs → command-helpers-CwLvFwMB-BWwUQhlT.mjs} +3 -3
  42. package/dist/{command-helpers-kD9CO1hd-BPhnkBin.mjs.map → command-helpers-CwLvFwMB-BWwUQhlT.mjs.map} +1 -1
  43. package/dist/{contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs → contract-at-errors-Dptf8RE_-B5gr04Sc.mjs} +3 -3
  44. package/dist/{contract-at-errors-CLFX1-Gc-MNPXDx1t.mjs.map → contract-at-errors-Dptf8RE_-B5gr04Sc.mjs.map} +1 -1
  45. package/dist/{contract-emit-BlvUNMHM-BEioUVR5.mjs → contract-emit-BQFpcb2A-BwT9iVdb.mjs} +5 -5
  46. package/dist/{contract-emit-BlvUNMHM-BEioUVR5.mjs.map → contract-emit-BQFpcb2A-BwT9iVdb.mjs.map} +1 -1
  47. package/dist/contract-emit-Bzt11N4v-BQ2Pr8KG.mjs +2 -0
  48. package/dist/{contract-emit-CrYO0A8x-60BOqXFr.mjs → contract-emit-CZQZ1i4z-p9LSGmmQ.mjs} +6 -6
  49. package/dist/{contract-emit-CrYO0A8x-60BOqXFr.mjs.map → contract-emit-CZQZ1i4z-p9LSGmmQ.mjs.map} +1 -1
  50. package/dist/{contract-infer-C8kLphsm-C7-AIYMc.mjs → contract-infer-C6cYOihE-CIUCgmw0.mjs} +4 -4
  51. package/dist/{contract-infer-C8kLphsm-C7-AIYMc.mjs.map → contract-infer-C6cYOihE-CIUCgmw0.mjs.map} +1 -1
  52. package/dist/{contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs → contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs} +4 -4
  53. package/dist/{contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs.map → contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs.map} +1 -1
  54. package/dist/{contract-space-aggregate-loader-BpdB-mHG-BiU0IUeb.mjs → contract-space-aggregate-loader-CoLTf3Ce-pQDru2w0.mjs} +4 -4
  55. package/dist/{contract-space-aggregate-loader-BpdB-mHG-BiU0IUeb.mjs.map → contract-space-aggregate-loader-CoLTf3Ce-pQDru2w0.mjs.map} +1 -1
  56. package/dist/{db-init-CyNsXRAB-D3xWQ-vy.mjs → db-init-DypCy1e3-CBrYfhHF.mjs} +6 -6
  57. package/dist/{db-init-CyNsXRAB-D3xWQ-vy.mjs.map → db-init-DypCy1e3-CBrYfhHF.mjs.map} +1 -1
  58. package/dist/{db-init-failure-XYOVL4o7-BitY_JYn.mjs → db-init-failure-BmCcHUfc-BqDxyrJE.mjs} +3 -3
  59. package/dist/{db-init-failure-XYOVL4o7-BitY_JYn.mjs.map → db-init-failure-BmCcHUfc-BqDxyrJE.mjs.map} +1 -1
  60. package/dist/{db-schema-7zNGHgYN-BVaRHPxg.mjs → db-schema-DHfPM-5V-JeCjrQ55.mjs} +4 -4
  61. package/dist/{db-schema-7zNGHgYN-BVaRHPxg.mjs.map → db-schema-DHfPM-5V-JeCjrQ55.mjs.map} +1 -1
  62. package/dist/{db-sign-DAs6J3XG-xxP2CCnO.mjs → db-sign-DbAxRcZh-C-nT9kcG.mjs} +6 -6
  63. package/dist/{db-sign-DAs6J3XG-xxP2CCnO.mjs.map → db-sign-DbAxRcZh-C-nT9kcG.mjs.map} +1 -1
  64. package/dist/{db-update-BX1sOuQk-CpeLgPeN.mjs → db-update-J59yROwL-DCP-_z2W.mjs} +16 -7
  65. package/dist/db-update-J59yROwL-DCP-_z2W.mjs.map +1 -0
  66. package/dist/{db-verify-CN4nmxxF-DSRWae0u.mjs → db-verify-0TpDMziA-CJDKutMN.mjs} +5 -5
  67. package/dist/{db-verify-CN4nmxxF-DSRWae0u.mjs.map → db-verify-0TpDMziA-CJDKutMN.mjs.map} +1 -1
  68. package/dist/{format-DceifGAK-BJhTdkcO.mjs → format-cbJY7l6v-CjMUDTAs.mjs} +5 -5
  69. package/dist/{format-DceifGAK-BJhTdkcO.mjs.map → format-cbJY7l6v-CjMUDTAs.mjs.map} +1 -1
  70. package/dist/{framework-components-CPFWl2Ix-CrIZL3jG.mjs → framework-components-C3K7SBeC-Bj5gx85-.mjs} +3 -3
  71. package/dist/{framework-components-CPFWl2Ix-CrIZL3jG.mjs.map → framework-components-C3K7SBeC-Bj5gx85-.mjs.map} +1 -1
  72. package/dist/{init-SY01IBU--CQFYh2As.mjs → init-Bco4QkKJ-DqUZVrBU.mjs} +4 -4
  73. package/dist/{init-SY01IBU--CQFYh2As.mjs.map → init-Bco4QkKJ-DqUZVrBU.mjs.map} +1 -1
  74. package/dist/{inspect-live-schema-BaLAtOgO-Bs0gs_yP.mjs → inspect-live-schema-Cf77j9Vd-i5fzNW4T.mjs} +5 -5
  75. package/dist/{inspect-live-schema-BaLAtOgO-Bs0gs_yP.mjs.map → inspect-live-schema-Cf77j9Vd-i5fzNW4T.mjs.map} +1 -1
  76. package/dist/{invariants-1L2zfc6--BpedlAbF.mjs → invariants-1zL5-9Mc-BCeOLxd_.mjs} +4 -4
  77. package/dist/{invariants-1L2zfc6--BpedlAbF.mjs.map → invariants-1zL5-9Mc-BCeOLxd_.mjs.map} +1 -1
  78. package/dist/{legend-aXC5H1jH-Dg1yWonK.mjs → legend-BQcPKTLe-bn9e4_ZU.mjs} +3 -3
  79. package/dist/{legend-aXC5H1jH-Dg1yWonK.mjs.map → legend-BQcPKTLe-bn9e4_ZU.mjs.map} +1 -1
  80. package/dist/{migrate-DRiUHRCS-Cci6EEZv.mjs → migrate-CgSnzAUm-aGstaO5N.mjs} +12 -12
  81. package/dist/{migrate-DRiUHRCS-Cci6EEZv.mjs.map → migrate-CgSnzAUm-aGstaO5N.mjs.map} +1 -1
  82. package/dist/{migrate-failure-Bdr3AJee-C9yNeQXy.mjs → migrate-failure-CnoUcDms-taa9pfd7.mjs} +4 -4
  83. package/dist/{migrate-failure-Bdr3AJee-C9yNeQXy.mjs.map → migrate-failure-CnoUcDms-taa9pfd7.mjs.map} +1 -1
  84. package/dist/{migrate-show-DutwCc2F-BhGfH7D-.d.mts → migrate-show-Dlo-YzOk-BXo-DmwI.d.mts} +3 -3
  85. package/dist/{migrate-show-DutwCc2F-BhGfH7D-.d.mts.map → migrate-show-Dlo-YzOk-BXo-DmwI.d.mts.map} +1 -1
  86. package/dist/{migrate-show-bdXjSFgh-CQxl5yNp.mjs → migrate-show-kVUG1xdo-bVTW8tu4.mjs} +6 -6
  87. package/dist/{migrate-show-bdXjSFgh-CQxl5yNp.mjs.map → migrate-show-kVUG1xdo-bVTW8tu4.mjs.map} +1 -1
  88. package/dist/{migration-check-BHiINj74-CVazN1LV.mjs → migration-check-BVK9vfan-Dfg8lbeB.mjs} +6 -6
  89. package/dist/{migration-check-BHiINj74-CVazN1LV.mjs.map → migration-check-BVK9vfan-Dfg8lbeB.mjs.map} +1 -1
  90. package/dist/{migration-check-of-RPYRk-HuXtDO8i.mjs → migration-check-CBMoMDX2-DhSEOGNg.mjs} +6 -6
  91. package/dist/{migration-check-of-RPYRk-HuXtDO8i.mjs.map → migration-check-CBMoMDX2-DhSEOGNg.mjs.map} +1 -1
  92. package/dist/{migration-command-scaffold-zJFTGn5k-5AGczeSx.mjs → migration-command-scaffold-B1BiWKLI-Bskk5UKX.mjs} +5 -5
  93. package/dist/{migration-command-scaffold-zJFTGn5k-5AGczeSx.mjs.map → migration-command-scaffold-B1BiWKLI-Bskk5UKX.mjs.map} +1 -1
  94. package/dist/{migration-graph-DmdVVJoZ-DDBKjUMz.mjs → migration-graph-B30X5398-BH3zB9Mn.mjs} +3 -3
  95. package/dist/{migration-graph-DmdVVJoZ-DDBKjUMz.mjs.map → migration-graph-B30X5398-BH3zB9Mn.mjs.map} +1 -1
  96. package/dist/{migration-graph-D0KHjNJ--CWzX9Zzc.mjs → migration-graph-D2dbLCkl-CCHL0aDA.mjs} +8 -8
  97. package/dist/{migration-graph-D0KHjNJ--CWzX9Zzc.mjs.map → migration-graph-D2dbLCkl-CCHL0aDA.mjs.map} +1 -1
  98. package/dist/{migration-graph-sections-BWcFCOL6-_G0Wb4QR.mjs → migration-graph-sections-0lKA5l1b-CTHQquu7.mjs} +3 -3
  99. package/dist/{migration-graph-sections-BWcFCOL6-_G0Wb4QR.mjs.map → migration-graph-sections-0lKA5l1b-CTHQquu7.mjs.map} +1 -1
  100. package/dist/{migration-list-W0dqabIj-Dc2NH_LY.mjs → migration-list-BQTfSGbT-DoNqbNsu.mjs} +3 -3
  101. package/dist/{migration-list-W0dqabIj-Dc2NH_LY.mjs.map → migration-list-BQTfSGbT-DoNqbNsu.mjs.map} +1 -1
  102. package/dist/{migration-list-B0SANIeM-DiXQ9LyS.mjs → migration-list-DCx0KOFp-B3MiGnpa.mjs} +6 -6
  103. package/dist/{migration-list-B0SANIeM-DiXQ9LyS.mjs.map → migration-list-DCx0KOFp-B3MiGnpa.mjs.map} +1 -1
  104. package/dist/{migration-log-B3iiP8ns-B4tdLSye.mjs → migration-log-CJ6_9_uj-uWyc3vlC.mjs} +6 -6
  105. package/dist/{migration-log-B3iiP8ns-B4tdLSye.mjs.map → migration-log-CJ6_9_uj-uWyc3vlC.mjs.map} +1 -1
  106. package/dist/{migration-new-YSdtJTRp-Dc06LNJe.mjs → migration-new-Bp5dPKnF-D-Fb6vEp.mjs} +7 -7
  107. package/dist/{migration-new-YSdtJTRp-Dc06LNJe.mjs.map → migration-new-Bp5dPKnF-D-Fb6vEp.mjs.map} +1 -1
  108. package/dist/{migration-new-Bf5K9fNK-Cd90rYmm.mjs → migration-new-CXLgOLXz-2C5s_q7n.mjs} +4 -4
  109. package/dist/{migration-new-Bf5K9fNK-Cd90rYmm.mjs.map → migration-new-CXLgOLXz-2C5s_q7n.mjs.map} +1 -1
  110. package/dist/{migration-path-target-5r1leSW5-B0EMgvEv.mjs → migration-path-target-BNTSTPAc-D7dQ4K7x.mjs} +3 -3
  111. package/dist/{migration-path-target-5r1leSW5-B0EMgvEv.mjs.map → migration-path-target-BNTSTPAc-D7dQ4K7x.mjs.map} +1 -1
  112. package/dist/{migration-plan-oterbw8h-_GrKbsRb.mjs → migration-plan-BxfF1Hdo-BKn0xMlY.mjs} +4 -4
  113. package/dist/{migration-plan-oterbw8h-_GrKbsRb.mjs.map → migration-plan-BxfF1Hdo-BKn0xMlY.mjs.map} +1 -1
  114. package/dist/{migration-plan-CZY8HVCh-BbfQvxnb.mjs → migration-plan-C6KrFHJT-CRkTsE7L.mjs} +8 -8
  115. package/dist/{migration-plan-CZY8HVCh-BbfQvxnb.mjs.map → migration-plan-C6KrFHJT-CRkTsE7L.mjs.map} +1 -1
  116. package/dist/{migration-plan-4cnnP6yM-DXzRfi_A.d.mts → migration-plan-CharRhoN-BIB3WL65.d.mts} +3 -3
  117. package/dist/{migration-plan-4cnnP6yM-DXzRfi_A.d.mts.map → migration-plan-CharRhoN-BIB3WL65.d.mts.map} +1 -1
  118. package/dist/{migration-show-iX2cduR4-C3-FENR4.mjs → migration-show-Dhnlx_GU-DhWLLt3Z.mjs} +8 -8
  119. package/dist/{migration-show-iX2cduR4-C3-FENR4.mjs.map → migration-show-Dhnlx_GU-DhWLLt3Z.mjs.map} +1 -1
  120. package/dist/{migration-status-BZ6gOxyJ-sbhPgABr.mjs → migration-status-S88DjM8c-DLHnCKfW.mjs} +10 -10
  121. package/dist/{migration-status-BZ6gOxyJ-sbhPgABr.mjs.map → migration-status-S88DjM8c-DLHnCKfW.mjs.map} +1 -1
  122. package/dist/{project-import-root-BPuwl2j1-DTX9G73z.mjs → project-import-root-nwdoPWap--5vXe4zp.mjs} +3 -3
  123. package/dist/{project-import-root-BPuwl2j1-DTX9G73z.mjs.map → project-import-root-nwdoPWap--5vXe4zp.mjs.map} +1 -1
  124. package/dist/{ref-CVD6j3jA-BAgpZLNM.mjs → ref-C8oaaeky-ColNkWpr.mjs} +5 -5
  125. package/dist/{ref-CVD6j3jA-BAgpZLNM.mjs.map → ref-C8oaaeky-ColNkWpr.mjs.map} +1 -1
  126. package/dist/{ref-CaqNqeRF-cjWFAueu.mjs → ref-gZQjdz8I-CW6n9Fc0.mjs} +4 -4
  127. package/dist/{ref-CaqNqeRF-cjWFAueu.mjs.map → ref-gZQjdz8I-CW6n9Fc0.mjs.map} +1 -1
  128. package/dist/{ref-resolution-D4fAdXo8-Dfaky0yw.mjs → ref-resolution-DAK4OK3x-B-8ZZc0f.mjs} +3 -3
  129. package/dist/{ref-resolution-D4fAdXo8-Dfaky0yw.mjs.map → ref-resolution-DAK4OK3x-B-8ZZc0f.mjs.map} +1 -1
  130. package/dist/{telemetry-fKuZOFpu-DNUWfIHo.mjs → telemetry-DPXFYAsz-CPW2USxs.mjs} +3 -3
  131. package/dist/{telemetry-fKuZOFpu-DNUWfIHo.mjs.map → telemetry-DPXFYAsz-CPW2USxs.mjs.map} +1 -1
  132. package/dist/vite-plugin-contract-emit.mjs +1 -1
  133. package/package.json +12 -12
  134. package/dist/cli-errors-C6_pH59O-CzD4SYcJ.mjs.map +0 -1
  135. package/dist/cli-errors-f5PRtVdm-C6xVKeQn.d.mts.map +0 -1
  136. package/dist/client-BqhVohc5-DFRVWFps.mjs.map +0 -1
  137. package/dist/contract-emit-Csa6R0gt-DvxFlS0O.mjs +0 -2
  138. package/dist/db-update-BX1sOuQk-CpeLgPeN.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"db-schema-7zNGHgYN-BVaRHPxg.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-schema-7zNGHgYN.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 { n as formatIntrospectOutput, t as formatIntrospectJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { Command } from \"commander\";\n//#region src/commands/db-schema.ts\nfunction toIntrospectSchemaResult(result) {\n\treturn {\n\t\tok: true,\n\t\tsummary: \"Schema read successfully\",\n\t\ttarget: result.target,\n\t\tschema: result.schema,\n\t\tmeta: result.meta,\n\t\ttimings: result.timings\n\t};\n}\nfunction createDbSchemaCommand() {\n\tconst command = new Command(\"schema\");\n\tsetCommandDescriptions(command, \"Inspect the live database schema\", \"Reads the live database schema and prints it as a tree by default or as JSON with\\n--json. This command is always read-only and never writes files. To save machine-\\nreadable output, use shell redirection, for example `prisma-next db schema --json > schema.json`.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db schema --db $DATABASE_URL\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json > schema.json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await inspectLiveSchema(options, flags, ui, Date.now(), {\n\t\t\tcommandName: \"db schema\",\n\t\t\tdescription: \"Inspect the live database schema\",\n\t\t\turl: \"https://pris.ly/db-schema\"\n\t\t}), flags, ui, (value) => {\n\t\t\tconst introspectResult = toIntrospectSchemaResult(value);\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(formatIntrospectJson(introspectResult));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst output = formatIntrospectOutput(introspectResult, value.schemaView, flags);\n\t\t\tif (output) ui.log(output);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbSchemaCommand as t };\n\n//# sourceMappingURL=db-schema-7zNGHgYN.mjs.map"],"mappings":";;;;;;AAMA,SAAS,yBAAyB,QAAQ;CACzC,OAAO;EACN,IAAI;EACJ,SAAS;EACT,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;CACjB;AACD;AACA,SAAS,wBAAwB;CAChC,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBAAuB,SAAS,oCAAoC,yQAAyQ;CAC7U,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EACjK,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,kBAAkB,SAAS,OAAO,IAAI,KAAK,IAAI,GAAG;GACrF,aAAa;GACb,aAAa;GACb,KAAK;EACN,CAAC,GAAG,OAAO,KAAK,UAAU;GACzB,MAAM,mBAAmB,yBAAyB,KAAK;GACvD,IAAI,MAAM,MAAM;IACf,GAAG,OAAO,qBAAqB,gBAAgB,CAAC;IAChD;GACD;GACA,MAAM,SAAS,uBAAuB,kBAAkB,MAAM,YAAY,KAAK;GAC/E,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"db-schema-DHfPM-5V-JeCjrQ55.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-schema-DHfPM-5V.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-CwLvFwMB.mjs\";\nimport { t as inspectLiveSchema } from \"./inspect-live-schema-Cf77j9Vd.mjs\";\nimport { n as formatIntrospectOutput, t as formatIntrospectJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { Command } from \"commander\";\n//#region src/commands/db-schema.ts\nfunction toIntrospectSchemaResult(result) {\n\treturn {\n\t\tok: true,\n\t\tsummary: \"Schema read successfully\",\n\t\ttarget: result.target,\n\t\tschema: result.schema,\n\t\tmeta: result.meta,\n\t\ttimings: result.timings\n\t};\n}\nfunction createDbSchemaCommand() {\n\tconst command = new Command(\"schema\");\n\tsetCommandDescriptions(command, \"Inspect the live database schema\", \"Reads the live database schema and prints it as a tree by default or as JSON with\\n--json. This command is always read-only and never writes files. To save machine-\\nreadable output, use shell redirection, for example `prisma-next db schema --json > schema.json`.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db schema --db $DATABASE_URL\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json > schema.json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await inspectLiveSchema(options, flags, ui, Date.now(), {\n\t\t\tcommandName: \"db schema\",\n\t\t\tdescription: \"Inspect the live database schema\",\n\t\t\turl: \"https://pris.ly/db-schema\"\n\t\t}), flags, ui, (value) => {\n\t\t\tconst introspectResult = toIntrospectSchemaResult(value);\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(formatIntrospectJson(introspectResult));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst output = formatIntrospectOutput(introspectResult, value.schemaView, flags);\n\t\t\tif (output) ui.log(output);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbSchemaCommand as t };\n\n//# sourceMappingURL=db-schema-DHfPM-5V.mjs.map"],"mappings":";;;;;;AAMA,SAAS,yBAAyB,QAAQ;CACzC,OAAO;EACN,IAAI;EACJ,SAAS;EACT,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;CACjB;AACD;AACA,SAAS,wBAAwB;CAChC,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBAAuB,SAAS,oCAAoC,yQAAyQ;CAC7U,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EACjK,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,kBAAkB,SAAS,OAAO,IAAI,KAAK,IAAI,GAAG;GACrF,aAAa;GACb,aAAa;GACb,KAAK;EACN,CAAC,GAAG,OAAO,KAAK,UAAU;GACzB,MAAM,mBAAmB,yBAAyB,KAAK;GACvD,IAAI,MAAM,MAAM;IACf,GAAG,OAAO,qBAAqB,gBAAgB,CAAC;IAChD;GACD;GACA,MAAM,SAAS,uBAAuB,kBAAkB,MAAM,YAAY,KAAK;GAC/E,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,17 +1,17 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
- import { N as errorUnexpected, c as errorDatabaseConnectionRequired, d as errorFileNotFound, s as errorContractValidationFailed, t as CliStructuredError$1, u as errorDriverRequired } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
+ import { P as errorUnexpected, c as errorContractValidationFailed, d as errorDriverRequired, f as errorFileNotFound, l as errorDatabaseConnectionRequired, t as CliStructuredError$1 } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
3
3
  import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
4
- import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
4
+ import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
5
5
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
6
- import { t as createControlClient } from "./client-BqhVohc5-DFRVWFps.mjs";
7
- import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs";
6
+ import { t as createControlClient } from "./client-DU9qtBxW-BjVHiKzE.mjs";
7
+ import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs";
8
8
  import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "./verify-Cogr_Fj9-D3lCWA6t.mjs";
9
9
  import { relative, resolve } from "pathe";
10
10
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
11
11
  import { readFile } from "node:fs/promises";
12
12
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
13
13
  import { Command } from "commander";
14
- //#region ../../../1-framework/3-tooling/cli/dist/db-sign-DAs6J3XG.mjs
14
+ //#region ../../../1-framework/3-tooling/cli/dist/db-sign-DbAxRcZh.mjs
15
15
  /**
16
16
  * Executes the db sign command and returns a structured Result.
17
17
  * Success: SignDatabaseResult (sign happened)
@@ -169,4 +169,4 @@ function createDbSignCommand() {
169
169
  //#endregion
170
170
  export { createDbSignCommand as t };
171
171
 
172
- //# sourceMappingURL=db-sign-DAs6J3XG-xxP2CCnO.mjs.map
172
+ //# sourceMappingURL=db-sign-DbAxRcZh-C-nT9kcG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-sign-DAs6J3XG-xxP2CCnO.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-DAs6J3XG.mjs"],"sourcesContent":["import { M as errorUnexpected, l as errorDriverRequired, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-C6_pH59O.mjs\";\nimport { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-BqhVohc5.mjs\";\nimport { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { t as resolveContractRefToSnapshot } from \"./contract-snapshot-resolution-BUUdIcgG.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/commands/db-sign.ts\n/**\n* Executes the db sign command and returns a structured Result.\n* Success: SignDatabaseResult (sign happened)\n* Failure: CliStructuredError (infra error) or VerifyDatabaseSchemaResult (schema mismatch)\n*/\nasync function executeDbSignCommand(contractArg, options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tconst effectiveContractArg = contractArg ?? options.contract;\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: effectiveContractArg ?? contractPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"db sign\",\n\t\t\tdescription: \"Sign the database with your contract so you can safely run queries\",\n\t\t\turl: \"https://pris.ly/db-sign\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tlet contractJson;\n\tif (effectiveContractArg) try {\n\t\tconst { migrationsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\t\tconst resolved = await resolveContractRefToSnapshot({\n\t\t\tconfig,\n\t\t\tmigrationsDir,\n\t\t\trefInput: effectiveContractArg,\n\t\t\tcontractPathAbsolute,\n\t\t\tfallbackToEmitted: true\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tcontractJson = resolved.value.contractJson;\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to resolve contract reference: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\telse {\n\t\tlet contractJsonContent;\n\t\ttry {\n\t\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t\t}));\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t}\n\t\ttry {\n\t\t\tcontractJson = JSON.parse(contractJsonContent);\n\t\t} catch (error) {\n\t\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t\t}\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for db sign (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"db sign\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for db sign\" }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst schemaVerifyResult = await client.schemaVerify({\n\t\t\tcontract: contractJson,\n\t\t\tstrict: false,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!schemaVerifyResult.ok) return notOk(schemaVerifyResult);\n\t\treturn ok(await client.sign({\n\t\t\tcontract: contractJson,\n\t\t\tcontractPath,\n\t\t\tconfigPath,\n\t\t\tonProgress\n\t\t}));\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during db sign: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbSignCommand() {\n\tconst command = new Command(\"sign\");\n\tsetCommandDescriptions(command, \"Sign the database with your contract so you can safely run queries\", \"Verifies that your database schema satisfies the emitted contract, and if so, writes or\\nupdates the database signature. This command is idempotent and safe to run\\nin CI/deployment pipelines. The signature records that this database instance is aligned\\nwith a specific contract version.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db sign --db $DATABASE_URL\",\n\t\t\"prisma-next db sign production --db $DATABASE_URL\",\n\t\t\"prisma-next db sign --contract production --db $DATABASE_URL\"\n\t]);\n\taddGlobalOptions(command).argument(\"[contract]\", \"Contract reference (hash, prefix, ref name, or migration dir name)\").option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--contract <contract>\", \"Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").action(async (positionalContract, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tif (positionalContract && options.contract) {\n\t\t\tprocess.stderr.write(\"Cannot specify both a positional contract argument and --contract flag.\\n\");\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst result = await executeDbSignCommand(positionalContract, options, flags, ui);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatSignJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatSignOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tconst failure = result.failure;\n\t\tif (failure instanceof CliStructuredError) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(failure));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(failure, flags);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbSignCommand as t };\n\n//# sourceMappingURL=db-sign-DAs6J3XG.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAe,qBAAqB,aAAa,SAAS,OAAO,IAAI;CACpE,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,aAAa,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;CACvF,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,MAAM,eAAe,SAAS,QAAQ,IAAI,GAAG,oBAAoB;CACjE,MAAM,uBAAuB,eAAe,QAAQ;CACpD,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAChC,MAAM,UAAU,CAAC;GAChB,OAAO;GACP,OAAO;EACR,GAAG;GACF,OAAO;GACP,OAAO,wBAAwB;EAChC,CAAC;EACD,IAAI,QAAQ,IAAI,QAAQ,KAAK;GAC5B,OAAO;GACP,OAAO,kBAAkB,QAAQ,EAAE;EACpC,CAAC;EACD,MAAM,SAAS,mBAAmB;GACjC,SAAS;GACT,aAAa;GACb,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B,CAAC,CAAC,OAAO,yBAAyB,oFAAoF,CAAC,CAAC,OAAO,OAAO,oBAAoB,YAAY;EACxY,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,IAAI,sBAAsB,QAAQ,UAAU;GAC3C,QAAQ,OAAO,MAAM,2EAA2E;GAChG,QAAQ,KAAK,CAAC;GACd;EACD;EACA,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,SAAS,MAAM,qBAAqB,oBAAoB,SAAS,OAAO,EAAE;EAChF,IAAI,OAAO,IAAI;GACd,IAAI,MAAM,MAAM,GAAG,OAAO,eAAe,OAAO,KAAK,CAAC;QACjD;IACJ,MAAM,SAAS,iBAAiB,OAAO,OAAO,KAAK;IACnD,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;GACA,QAAQ,KAAK,CAAC;EACf;EACA,MAAM,UAAU,OAAO;EACvB,IAAI,mBAAmBA,sBAAoB;GAC1C,MAAM,WAAW,aAAa,QAAQ,OAAO,EAAE;GAC/C,QAAQ,KAAK,QAAQ;EACtB;EACA,IAAI,MAAM,MAAM,GAAG,OAAO,uBAAuB,OAAO,CAAC;OACpD;GACJ,MAAM,SAAS,yBAAyB,SAAS,KAAK;GACtD,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"db-sign-DbAxRcZh-C-nT9kcG.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-DbAxRcZh.mjs"],"sourcesContent":["import { N as errorUnexpected, c as errorDatabaseConnectionRequired, d as errorFileNotFound, s as errorContractValidationFailed, t as CliStructuredError, u as errorDriverRequired } from \"./cli-errors-BG6bItjG.mjs\";\nimport { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-DU9qtBxW.mjs\";\nimport { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { t as resolveContractRefToSnapshot } from \"./contract-snapshot-resolution-DvZvbNcZ.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/commands/db-sign.ts\n/**\n* Executes the db sign command and returns a structured Result.\n* Success: SignDatabaseResult (sign happened)\n* Failure: CliStructuredError (infra error) or VerifyDatabaseSchemaResult (schema mismatch)\n*/\nasync function executeDbSignCommand(contractArg, options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\n\tconst effectiveContractArg = contractArg ?? options.contract;\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: effectiveContractArg ?? contractPath\n\t\t}];\n\t\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"db sign\",\n\t\t\tdescription: \"Sign the database with your contract so you can safely run queries\",\n\t\t\turl: \"https://pris.ly/db-sign\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tlet contractJson;\n\tif (effectiveContractArg) try {\n\t\tconst { migrationsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\t\tconst resolved = await resolveContractRefToSnapshot({\n\t\t\tconfig,\n\t\t\tmigrationsDir,\n\t\t\trefInput: effectiveContractArg,\n\t\t\tcontractPathAbsolute,\n\t\t\tfallbackToEmitted: true\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tcontractJson = resolved.value.contractJson;\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to resolve contract reference: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\telse {\n\t\tlet contractJsonContent;\n\t\ttry {\n\t\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t\t}));\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t}\n\t\ttry {\n\t\t\tcontractJson = JSON.parse(contractJsonContent);\n\t\t} catch (error) {\n\t\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t\t}\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for db sign (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"db sign\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for db sign\" }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst schemaVerifyResult = await client.schemaVerify({\n\t\t\tcontract: contractJson,\n\t\t\tstrict: false,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!schemaVerifyResult.ok) return notOk(schemaVerifyResult);\n\t\treturn ok(await client.sign({\n\t\t\tcontract: contractJson,\n\t\t\tcontractPath,\n\t\t\tconfigPath,\n\t\t\tonProgress\n\t\t}));\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during db sign: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbSignCommand() {\n\tconst command = new Command(\"sign\");\n\tsetCommandDescriptions(command, \"Sign the database with your contract so you can safely run queries\", \"Verifies that your database schema satisfies the emitted contract, and if so, writes or\\nupdates the database signature. This command is idempotent and safe to run\\nin CI/deployment pipelines. The signature records that this database instance is aligned\\nwith a specific contract version.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db sign --db $DATABASE_URL\",\n\t\t\"prisma-next db sign production --db $DATABASE_URL\",\n\t\t\"prisma-next db sign --contract production --db $DATABASE_URL\"\n\t]);\n\taddGlobalOptions(command).argument(\"[contract]\", \"Contract reference (hash, prefix, ref name, or migration dir name)\").option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--contract <contract>\", \"Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").action(async (positionalContract, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tif (positionalContract && options.contract) {\n\t\t\tprocess.stderr.write(\"Cannot specify both a positional contract argument and --contract flag.\\n\");\n\t\t\tprocess.exit(2);\n\t\t\treturn;\n\t\t}\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst result = await executeDbSignCommand(positionalContract, options, flags, ui);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatSignJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatSignOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tconst failure = result.failure;\n\t\tif (failure instanceof CliStructuredError) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(failure));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(failure, flags);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbSignCommand as t };\n\n//# sourceMappingURL=db-sign-DbAxRcZh.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAe,qBAAqB,aAAa,SAAS,OAAO,IAAI;CACpE,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,aAAa,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI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f,CAAC;CACD,OAAO;AACR"}
@@ -1,15 +1,15 @@
1
- import { D as errorRunnerFailed, N as errorUnexpected, l as errorDestructiveChanges, n as ERROR_CODE_DESTRUCTIVE_CHANGES, s as errorContractValidationFailed, t as CliStructuredError$1, y as errorMigrationPlanningFailed } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
1
+ import { O as errorRunnerFailed, P as errorUnexpected, b as errorMigrationPlanningFailed, c as errorContractValidationFailed, n as ERROR_CODE_DESTRUCTIVE_CHANGES, o as errorConsentPlanMismatch, t as CliStructuredError$1, u as errorDestructiveChanges } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
2
2
  import { c as formatMigrationApplyOutput, l as formatMigrationJson, r as createTerminalUI, u as formatMigrationPlanOutput } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
3
- import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, n as closeQuietly, u as handleResult, v as sanitizeErrorMessage, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
3
+ import { _ as resolveMigrationPaths, b as setCommandExamples, m as parseGlobalFlagsOrExit, n as closeQuietly, u as handleResult, v as sanitizeErrorMessage, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
4
4
  import { o as resolveRefAdvancementFields } from "./ref-advancement-DaZBzm7m-WoqnFAyr.mjs";
5
- import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "./migration-command-scaffold-zJFTGn5k-5AGczeSx.mjs";
6
- import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-BUUdIcgG-8mbs6-OD.mjs";
5
+ import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-DvZvbNcZ-DHFCWe_k.mjs";
6
+ import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "./migration-command-scaffold-B1BiWKLI-Bskk5UKX.mjs";
7
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
8
8
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
9
9
  import { assertNever } from "@prisma/orm-framework/utils/internal-error";
10
10
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
11
11
  import { Command } from "commander";
12
- //#region ../../../1-framework/3-tooling/cli/dist/db-update-BX1sOuQk.mjs
12
+ //#region ../../../1-framework/3-tooling/cli/dist/db-update-J59yROwL.mjs
13
13
  /**
14
14
  * Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.
15
15
  */
@@ -30,7 +30,16 @@ function mapDbUpdateFailure(failure) {
30
30
  if (failure.code === "DESTRUCTIVE_CHANGES") return errorDestructiveChanges(failure.summary, {
31
31
  ...ifDefined("why", failure.why),
32
32
  fix: "Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first",
33
- ...ifDefined("meta", failure.meta)
33
+ ...failure.destructiveChanges ? { meta: {
34
+ destructiveOperations: failure.destructiveChanges.destructiveOperations,
35
+ databaseName: failure.destructiveChanges.databaseName,
36
+ planHash: failure.destructiveChanges.planHash
37
+ } } : {}
38
+ });
39
+ if (failure.code === "CONSENT_PLAN_MISMATCH") return errorConsentPlanMismatch({
40
+ consentedPlanHash: failure.consentPlanMismatch?.consentedPlanHash ?? "",
41
+ planHash: failure.consentPlanMismatch?.planHash ?? "",
42
+ ...ifDefined("why", failure.why)
34
43
  });
35
44
  const exhaustive = failure.code;
36
45
  return assertNever(exhaustive, `Unhandled DbUpdateFailure code: ${String(exhaustive)}`);
@@ -159,4 +168,4 @@ function createDbUpdateCommand() {
159
168
  //#endregion
160
169
  export { createDbUpdateCommand as t };
161
170
 
162
- //# sourceMappingURL=db-update-BX1sOuQk-CpeLgPeN.mjs.map
171
+ //# sourceMappingURL=db-update-J59yROwL-DCP-_z2W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-update-J59yROwL-DCP-_z2W.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-update-J59yROwL.mjs"],"sourcesContent":["import { D as errorRunnerFailed, N as errorUnexpected, a as errorConsentPlanMismatch, l as errorDestructiveChanges, n as ERROR_CODE_DESTRUCTIVE_CHANGES, s as errorContractValidationFailed, t as CliStructuredError, y as errorMigrationPlanningFailed } from \"./cli-errors-BG6bItjG.mjs\";\nimport { c as formatMigrationPlanOutput, o as formatMigrationApplyOutput, s as formatMigrationJson, t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { _ as parseGlobalFlagsOrExit, c as resolveMigrationPaths, d as setCommandExamples, l as sanitizeErrorMessage, n as closeQuietly, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { o as resolveRefAdvancementFields } from \"./ref-advancement-DaZBzm7m.mjs\";\nimport { n as prepareMigrationContext, t as addMigrationCommandOptions } from \"./migration-command-scaffold-B1BiWKLI.mjs\";\nimport { t as resolveContractRefToSnapshot } from \"./contract-snapshot-resolution-DvZvbNcZ.mjs\";\nimport { Command } from \"commander\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { assertNever } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/commands/db-update.ts\n/**\n* Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.\n*/\nfunction mapDbUpdateFailure(failure) {\n\tif (failure.code === \"PLANNING_FAILED\") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });\n\tif (failure.code === \"RUNNER_FAILED\") {\n\t\tconst fix = (typeof failure.meta?.[\"runnerErrorCode\"] === \"string\" ? failure.meta[\"runnerErrorCode\"] : void 0) === \"MIGRATION.LEGACY_MARKER_SHAPE\" ? \"Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema.\" : \"Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`\";\n\t\treturn errorRunnerFailed(failure.summary, {\n\t\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\t\tfix,\n\t\t\tmeta: {\n\t\t\t\t...failure.meta,\n\t\t\t\t...failure.warnings && failure.warnings.length > 0 ? { plannerWarnings: failure.warnings } : {}\n\t\t\t},\n\t\t\t...ifDefined(\"cause\", failure.cause)\n\t\t});\n\t}\n\tif (failure.code === \"DESTRUCTIVE_CHANGES\") return errorDestructiveChanges(failure.summary, {\n\t\t...ifDefined(\"why\", failure.why),\n\t\tfix: \"Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first\",\n\t\t...failure.destructiveChanges ? { meta: {\n\t\t\tdestructiveOperations: failure.destructiveChanges.destructiveOperations,\n\t\t\tdatabaseName: failure.destructiveChanges.databaseName,\n\t\t\tplanHash: failure.destructiveChanges.planHash\n\t\t} } : {}\n\t});\n\tif (failure.code === \"CONSENT_PLAN_MISMATCH\") return errorConsentPlanMismatch({\n\t\tconsentedPlanHash: failure.consentPlanMismatch?.consentedPlanHash ?? \"\",\n\t\tplanHash: failure.consentPlanMismatch?.planHash ?? \"\",\n\t\t...ifDefined(\"why\", failure.why)\n\t});\n\tconst exhaustive = failure.code;\n\treturn assertNever(exhaustive, `Unhandled DbUpdateFailure code: ${String(exhaustive)}`);\n}\n/**\n* Executes the db update command and returns a structured Result.\n*/\nasync function executeDbUpdateCommand(options, flags, ui, startTime) {\n\tconst ctxResult = await prepareMigrationContext(options, flags, ui, {\n\t\tcommandName: \"db update\",\n\t\tdescription: \"Update your database schema to match your contract\",\n\t\turl: \"https://pris.ly/db-update\"\n\t});\n\tif (!ctxResult.ok) return ctxResult;\n\tconst { client, config, dbConnection, onProgress, contractPathAbsolute } = ctxResult.value;\n\tlet { contractJson } = ctxResult.value;\n\tlet contractJsonPathForSnapshot = contractPathAbsolute;\n\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config, process.cwd());\n\tif (options.to) {\n\t\tconst resolved = await resolveContractRefToSnapshot({\n\t\t\tconfig,\n\t\t\tmigrationsDir,\n\t\t\trefInput: options.to,\n\t\t\tcontractPathAbsolute,\n\t\t\tfallbackToEmitted: false,\n\t\t\tmissingBundleFlag: \"--to\"\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tcontractJson = resolved.value.contractJson;\n\t\tcontractJsonPathForSnapshot = resolved.value.contractJsonPath;\n\t}\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst result = await client.dbUpdate({\n\t\t\tcontract: contractJson,\n\t\t\tmode: options.dryRun ? \"plan\" : \"apply\",\n\t\t\tmigrationsDir,\n\t\t\t...flags.yes ? { acceptDataLoss: true } : {},\n\t\t\tonProgress\n\t\t});\n\t\tif (!result.ok) return notOk(mapDbUpdateFailure(result.failure));\n\t\tconst advancementHash = result.value.mode === \"apply\" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;\n\t\tconst advancement = await resolveRefAdvancementFields({\n\t\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t\t...ifDefined(\"db\", options.db),\n\t\t\trefsDir,\n\t\t\tmigrationsDir,\n\t\t\tcontractJson,\n\t\t\tcontractJsonPath: contractJsonPathForSnapshot,\n\t\t\tmode: result.value.mode,\n\t\t\thash: advancementHash\n\t\t});\n\t\tif (!advancement.ok) return notOk(advancement.failure);\n\t\tconst refAdvancementFields = advancement.value;\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: result.value.mode,\n\t\t\tplan: {\n\t\t\t\ttargetId: ctxResult.value.config.target.targetId,\n\t\t\t\tdestination: {\n\t\t\t\t\tstorageHash: result.value.destination.storageHash,\n\t\t\t\t\t...ifDefined(\"profileHash\", result.value.destination.profileHash)\n\t\t\t\t},\n\t\t\t\toperations: result.value.plan.operations.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\t...ifDefined(\"preview\", result.value.plan.preview)\n\t\t\t},\n\t\t\t...ifDefined(\"execution\", result.value.execution ? {\n\t\t\t\toperationsPlanned: result.value.execution.operationsPlanned,\n\t\t\t\toperationsExecuted: result.value.execution.operationsExecuted\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"marker\", result.value.marker ? {\n\t\t\t\tstorageHash: result.value.marker.storageHash,\n\t\t\t\t...ifDefined(\"profileHash\", result.value.marker.profileHash)\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"perSpace\", result.value.perSpace),\n\t\t\t...ifDefined(\"warnings\", result.value.warnings),\n\t\t\tadvancedRef: refAdvancementFields.advancedRef,\n\t\t\tplannedAdvanceRef: refAdvancementFields.plannedAdvanceRef,\n\t\t\tsummary: result.value.summary,\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during db update: ${safeMessage}` }));\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbUpdateCommand() {\n\tconst command = new Command(\"update\");\n\tsetCommandDescriptions(command, \"Update your database schema to match your contract\", \"Compares your database schema to the emitted contract and applies the necessary\\nchanges. Works on any database, whether or not it has been initialized with `db init`.\\nDestructive operations prompt for confirmation in interactive mode. Use -y to\\nauto-accept or --dry-run to preview first.\");\n\tsetCommandExamples(command, [\"prisma-next db update --db $DATABASE_URL\", \"prisma-next db update --db $DATABASE_URL --dry-run\"]);\n\taddMigrationCommandOptions(command);\n\tcommand.option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\");\n\tcommand.option(\"--advance-ref <name>\", \"Ref to advance to the post-command contract hash\");\n\tcommand.action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet result = await executeDbUpdateCommand(options, flags, ui, startTime);\n\t\tif (!result.ok && result.failure.code === ERROR_CODE_DESTRUCTIVE_CHANGES && flags.interactive && !flags.json && !flags.yes) {\n\t\t\tconst destructiveOps = result.failure.meta?.destructiveOperations ?? [];\n\t\t\tif (destructiveOps.length > 0) ui.warn(`${destructiveOps.length} destructive operation(s) that may cause data loss:\\n${destructiveOps.map((op) => ` ${ui.yellow(\"▸\")} ${op.label}`).join(\"\\n\")}`);\n\t\t\tif (await ui.confirm(\"Apply destructive changes? This cannot be undone.\")) result = await executeDbUpdateCommand(options, {\n\t\t\t\t...flags,\n\t\t\t\tyes: true\n\t\t\t}, ui, Date.now());\n\t\t}\n\t\tconst exitCode = handleResult(result, flags, ui, (dbUpdateResult) => {\n\t\t\tif (flags.json) ui.output(formatMigrationJson(dbUpdateResult));\n\t\t\telse {\n\t\t\t\tconst output = dbUpdateResult.mode === \"plan\" ? formatMigrationPlanOutput(dbUpdateResult, flags) : formatMigrationApplyOutput(dbUpdateResult, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbUpdateCommand as t };\n\n//# sourceMappingURL=db-update-J59yROwL.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,mBAAmB,SAAS;CACpC,IAAI,QAAQ,SAAS,mBAAmB,OAAO,6BAA6B,EAAE,WAAW,QAAQ,aAAa,CAAC,EAAE,CAAC;CAClH,IAAI,QAAQ,SAAS,iBAAiB;EACrC,MAAM,OAAO,OAAO,QAAQ,OAAO,uBAAuB,WAAW,QAAQ,KAAK,qBAAqB,KAAK,OAAO,kCAAkC,iMAAiM;EACtV,OAAO,kBAAkB,QAAQ,SAAS;GACzC,KAAK,QAAQ,OAAO;GACpB;GACA,MAAM;IAC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C,OAAO,MAAM,OAAO,QAAQ,SAAS,kCAAkC,MAAM,eAAe,CAAC,MAAM,QAAQ,CAAC,MAAM,KAAK;GAC3H,MAAM,iBAAiB,OAAO,QAAQ,MAAM,yBAAyB,CAAC;GACtE,IAAI,eAAe,SAAS,GAAG,GAAG,KAAK,GAAG,eAAe,OAAO,uDAAuD,eAAe,KAAK,OAAO,KAAK,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,GAAG;GACjM,IAAI,MAAM,GAAG,QAAQ,mDAAmD,GAAG,SAAS,MAAM,uBAAuB,SAAS;IACzH,GAAG;IACH,KAAK;GACN,GAAG,IAAI,KAAK,IAAI,CAAC;EAClB;EACA,MAAM,WAAW,aAAa,QAAQ,OAAO,KAAK,mBAAmB;GACpE,IAAI,MAAM,MAAM,GAAG,OAAO,oBAAoB,cAAc,CAAC;QACxD;IACJ,MAAM,SAAS,eAAe,SAAS,SAAS,0BAA0B,gBAAgB,KAAK,IAAI,2BAA2B,gBAAgB,KAAK;IACnJ,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,9 +1,9 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
- import { M as errorTargetMismatch, N as errorUnexpected, O as errorRuntime$1, _ as errorMarkerMissing, c as errorDatabaseConnectionRequired, d as errorFileNotFound, f as errorHashMismatch, s as errorContractValidationFailed, t as CliStructuredError$1, u as errorDriverRequired } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
+ import { N as errorTargetMismatch, P as errorUnexpected, c as errorContractValidationFailed, d as errorDriverRequired, f as errorFileNotFound, k as errorRuntime$1, l as errorDatabaseConnectionRequired, p as errorHashMismatch, t as CliStructuredError$1, v as errorMarkerMissing } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
3
3
  import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
4
- import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
4
+ import { _ as resolveMigrationPaths, b as setCommandExamples, f as maskConnectionUrl, g as resolveContractPath, m as parseGlobalFlagsOrExit, n as closeQuietly, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
5
5
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
6
- import { t as createControlClient } from "./client-BqhVohc5-DFRVWFps.mjs";
6
+ import { t as createControlClient } from "./client-DU9qtBxW-BjVHiKzE.mjs";
7
7
  import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-Cogr_Fj9-D3lCWA6t.mjs";
8
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
9
  import { relative, resolve } from "pathe";
@@ -13,7 +13,7 @@ import { readFile } from "node:fs/promises";
13
13
  import { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from "@prisma/orm-framework/components/control";
14
14
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
15
15
  import { Command } from "commander";
16
- //#region ../../../1-framework/3-tooling/cli/dist/db-verify-CN4nmxxF.mjs
16
+ //#region ../../../1-framework/3-tooling/cli/dist/db-verify-0TpDMziA.mjs
17
17
  /**
18
18
  * Collapse the aggregate verifier's per-space contract-satisfaction results
19
19
  * into a single {@link VerifyDatabaseSchemaResult} for the CLI display
@@ -413,4 +413,4 @@ function createDbVerifyCommand() {
413
413
  //#endregion
414
414
  export { createDbVerifyCommand as t };
415
415
 
416
- //# sourceMappingURL=db-verify-CN4nmxxF-DSRWae0u.mjs.map
416
+ //# sourceMappingURL=db-verify-0TpDMziA-CJDKutMN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-verify-CN4nmxxF-DSRWae0u.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-CN4nmxxF.mjs"],"sourcesContent":["import { D as errorRuntime, M as errorUnexpected, d as errorHashMismatch, g as errorMarkerMissing, j as errorTargetMismatch, l as errorDriverRequired, o as errorContractValidationFailed, s as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorFileNotFound } from \"./cli-errors-C6_pH59O.mjs\";\nimport { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-kD9CO1hd.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-BqhVohc5.mjs\";\nimport { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from \"@internal/framework-components/control\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/utils/combine-verify-results.ts\n/**\n* Collapse the aggregate verifier's per-space contract-satisfaction results\n* into a single {@link VerifyDatabaseSchemaResult} for the CLI display\n* surface, and carry the deduplicated unclaimed-elements list alongside it.\n* Concatenates the issue lists across spaces; uses the app space's result as\n* the structural envelope (storage hash, target). Extras are already\n* stripped from each per-space result, so nothing here duplicates an\n* unclaimed element per space.\n*\n* **Unclaimed disposition.** In strict mode a non-empty `unclaimed` list fails\n* the combined verdict (`ok: false`); in lenient mode it is carried for\n* informational rendering only. The list itself is returned unchanged for the\n* renderer.\n*\n* **Summary policy.** Preserve the per-family phrasing whenever the\n* combined `ok` flag agrees with the app space's `ok` flag — this is\n* the common case (single-family deployments, single-app deployments)\n* and the family's \"satisfies / does not satisfy contract\" phrasing\n* stays user-visible. When the app passes but an extension fails (or\n* vice versa) the app's summary contradicts the envelope, so fall back\n* to the first failing space's summary. This keeps family phrasing\n* intact and the envelope internally consistent (`ok: false` ↔ failure\n* summary).\n*/\nfunction combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {\n\tconst appResult = perSpace.get(appSpaceId) ?? perSpace.values().next().value;\n\tif (appResult === void 0) throw new InternalError(\"Aggregate verifier returned no per-space verify results — this is a wiring bug.\");\n\tlet okAll = true;\n\tlet firstFailure;\n\tlet issues = [];\n\tlet warningIssues = [];\n\tfor (const [, result] of perSpace) {\n\t\tif (!result.ok) {\n\t\t\tokAll = false;\n\t\t\tif (firstFailure === void 0) firstFailure = result;\n\t\t}\n\t\tissues = [...issues, ...result.schema.issues];\n\t\twarningIssues = [...warningIssues, ...result.schema.warnings?.issues ?? []];\n\t}\n\tconst unclaimedFails = strict && unclaimed.length > 0;\n\tconst ok = okAll && !unclaimedFails;\n\tconst summary = okAll ? unclaimedFails ? `Database schema has ${unclaimed.length} unclaimed element${unclaimed.length === 1 ? \"\" : \"s\"} (not in any contract)` : appResult.summary : appResult.ok ? firstFailure?.summary ?? appResult.summary : appResult.summary;\n\treturn {\n\t\tresult: {\n\t\t\tok,\n\t\t\t...ok ? {} : { code: appResult.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\t\tsummary,\n\t\t\tcontract: appResult.contract,\n\t\t\ttarget: appResult.target,\n\t\t\tschema: {\n\t\t\t\tissues,\n\t\t\t\twarnings: { issues: warningIssues }\n\t\t\t},\n\t\t\tmeta: { strict },\n\t\t\ttimings: { total: 0 }\n\t\t},\n\t\tunclaimed\n\t};\n}\n//#endregion\n//#region src/commands/db-verify.ts\n/**\n* Maps a VerifyDatabaseResult failure to a CliStructuredError.\n*/\nfunction mapVerifyFailure(verifyResult) {\n\tif (!verifyResult.ok && verifyResult.code) {\n\t\tif (verifyResult.code === VERIFY_CODE_MARKER_MISSING) return errorMarkerMissing();\n\t\tif (verifyResult.code === VERIFY_CODE_HASH_MISMATCH) {\n\t\t\tconst storageMatch = verifyResult.marker?.storageHash === verifyResult.contract.storageHash;\n\t\t\tconst profileMatch = !verifyResult.contract.profileHash || verifyResult.marker?.profileHash === verifyResult.contract.profileHash;\n\t\t\tif (!storageMatch) return errorHashMismatch({\n\t\t\t\twhy: \"Contract storageHash does not match database marker\",\n\t\t\t\texpected: verifyResult.contract.storageHash,\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.storageHash)\n\t\t\t});\n\t\t\treturn errorHashMismatch({\n\t\t\t\twhy: profileMatch ? \"Contract hash does not match database marker\" : \"Contract profileHash does not match database marker\",\n\t\t\t\t...ifDefined(\"expected\", verifyResult.contract.profileHash),\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.profileHash)\n\t\t\t});\n\t\t}\n\t\tif (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? \"unknown\");\n\t}\n\treturn errorRuntime(\"CONTRACT.VERIFY_FAILED\", verifyResult.summary, {\n\t\twhy: \"Verification failed\",\n\t\tfix: \"Check contract and database state\"\n\t});\n}\nfunction errorInvalidVerifyMode(options) {\n\treturn new CliStructuredError(\"CLI.INVALID_VERIFY_MODE\", \"Invalid verify mode\", {\n\t\twhy: options.why,\n\t\tfix: options.fix,\n\t\tdocsUrl: \"https://pris.ly/db-verify\"\n\t});\n}\nfunction resolveDbVerifyMode(options) {\n\tif (options.markerOnly && options.schemaOnly) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--marker-only` and `--schema-only` cannot be used together\",\n\t\tfix: \"Choose one mode: omit both to check the marker and schema, use `--marker-only` to check only the marker, or use `--schema-only` to check only the live schema.\"\n\t}));\n\tif (options.markerOnly && options.strict) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--strict` requires schema verification, but `--marker-only` skips it\",\n\t\tfix: \"Remove `--strict`, or use `db verify` / `db verify --schema-only` when you want to check the live schema in strict mode.\"\n\t}));\n\tif (options.schemaOnly) return ok(\"schema-only\");\n\tif (options.markerOnly) return ok(\"marker-only\");\n\treturn ok(\"full\");\n}\nfunction formatDbVerifyModeLabel(mode, strict) {\n\tif (mode === \"marker-only\") return \"marker only\";\n\tif (mode === \"schema-only\") return `schema only (${strict ? \"strict\" : \"tolerant\"})`;\n\treturn `full (marker + schema, ${strict ? \"strict\" : \"tolerant\"})`;\n}\nfunction formatDbVerifyInvocation(mode, strict) {\n\tconst args = [\"db verify\"];\n\tif (mode === \"marker-only\") args.push(\"--marker-only\");\n\tif (mode === \"schema-only\") args.push(\"--schema-only\");\n\tif (strict) args.push(\"--strict\");\n\treturn args.join(\" \");\n}\nfunction createDbVerifyConnectionRequiredError(options) {\n\tconst invocation = formatDbVerifyInvocation(options.mode, options.strict);\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${invocation} (set db.connection in ${options.configPath}, or pass --db <url>)`,\n\t\tretryCommand: `prisma-next ${invocation} --db <url>`\n\t});\n}\nfunction renderVerifyHeader(paths, options, mode, flags, ui) {\n\tif (flags.json || flags.quiet) return;\n\tconst description = mode === \"schema-only\" ? \"Check whether the live database schema matches your contract\" : mode === \"marker-only\" ? \"Check whether the database marker matches your contract\" : \"Check whether the database marker and live schema match your contract\";\n\tconst details = [\n\t\t{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: paths.configPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: paths.contractPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: formatDbVerifyModeLabel(mode, options.strict ?? false)\n\t\t}\n\t];\n\tif (options.db) details.push({\n\t\tlabel: \"database\",\n\t\tvalue: maskConnectionUrl(options.db)\n\t});\n\tui.stderr(formatStyledHeader({\n\t\tcommand: \"db verify\",\n\t\tdescription,\n\t\turl: \"https://pris.ly/db-verify\",\n\t\tdetails,\n\t\tflags\n\t}));\n}\nasync function resolveVerifyPaths(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tconst contractPathAbsolute = resolveContractPath(config);\n\treturn ok({\n\t\tconfig,\n\t\tconfigPath,\n\t\tcontractPathAbsolute,\n\t\tcontractPath: relative(process.cwd(), contractPathAbsolute)\n\t});\n}\nasync function resolveVerifySetup(paths, options, mode) {\n\tconst { config, configPath, contractPathAbsolute, contractPath } = paths;\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (typeof dbConnection !== \"string\" || dbConnection.length === 0) return notOk(createDbVerifyConnectionRequiredError({\n\t\tconfigPath,\n\t\tmode,\n\t\tstrict: options.strict ?? false\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${formatDbVerifyInvocation(mode, options.strict ?? false)}` }));\n\treturn ok({\n\t\t...paths,\n\t\tcontractJson,\n\t\tdbConnection\n\t});\n}\nfunction createVerifyClient(setup) {\n\treturn createControlClient({\n\t\tfamily: setup.config.family,\n\t\ttarget: setup.config.target,\n\t\tadapter: setup.config.adapter,\n\t\tdriver: setup.config.driver,\n\t\textensions: setup.config.extensions ?? []\n\t});\n}\nfunction wrapVerifyError(error, contractPathAbsolute, modeLabel) {\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during ${modeLabel}: ${error instanceof Error ? error.message : String(error)}` }));\n}\n/**\n* Executes the db verify command and returns a structured Result.\n*/\nasync function executeDbVerifyCommand(options, flags, ui, mode) {\n\tconst startTime = Date.now();\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, mode, flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, mode);\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst verifyResult = await client.verify({\n\t\t\tcontract: contractJson,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!verifyResult.ok) return notOk(mapVerifyFailure(verifyResult));\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: mode === \"marker-only\",\n\t\t\tskipMarker: false,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\tif (mode === \"marker-only\") return ok({\n\t\t\tok: true,\n\t\t\tmode: \"marker-only\",\n\t\t\tsummary: \"Database marker matches contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\twarning: \"Schema verification skipped because --marker-only was provided\",\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"skipped\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst combined = combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed);\n\t\tif (!combined.result.ok) return notOk(combined);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: \"full\",\n\t\t\tsummary: \"Database marker and schema match contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\tschema: {\n\t\t\t\tsummary: combined.result.summary,\n\t\t\t\tstrict: combined.result.meta?.strict ?? false,\n\t\t\t\twarnings: (combined.result.schema.warnings?.issues ?? []).map((issue) => issue.path.join(\"/\"))\n\t\t\t},\n\t\t\tunclaimed: combined.unclaimed,\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"performed\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nasync function executeDbSchemaOnlyVerifyCommand(options, flags, ui) {\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, \"schema-only\", flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, \"schema-only\");\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: false,\n\t\t\tskipMarker: true,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\treturn ok(combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed));\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify --schema-only\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbVerifyCommand() {\n\tconst command = new Command(\"verify\");\n\tsetCommandDescriptions(command, \"Check whether the database marker and live schema match your contract\", \"Verifies the database marker first, then checks the database schema matches your contract.\\nUse `--marker-only` for marker-only verification, `--schema-only` to skip marker checks and\\ninspect only the live schema, and `--strict` to fail if the database includes elements\\nnot present in the contract.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db verify --db $DATABASE_URL\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --marker-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--marker-only\", \"Skip schema verification and only check the database marker\").option(\"--schema-only\", \"Skip marker verification and only check whether the live schema satisfies the contract\").option(\"--strict\", \"Strict mode: schema elements not present in the contract are considered an error\", false).action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst modeResult = resolveDbVerifyMode(options);\n\t\tif (!modeResult.ok) {\n\t\t\tconst exitCode = handleResult(modeResult, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst mode = modeResult.value;\n\t\tif (mode === \"schema-only\") {\n\t\t\tconst result = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);\n\t\t\tconst exitCode = handleResult(result, flags, ui, (combined) => {\n\t\t\t\tif (flags.json) ui.output(formatSchemaVerifyJson(combined.result, combined.unclaimed));\n\t\t\t\telse {\n\t\t\t\t\tconst renderFlags = combined.result.ok ? flags : {\n\t\t\t\t\t\t...flags,\n\t\t\t\t\t\tquiet: false\n\t\t\t\t\t};\n\t\t\t\t\tconst output = formatSchemaVerifyOutput(combined.result, renderFlags, combined.unclaimed);\n\t\t\t\t\tif (output) ui.log(output);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (result.ok && !result.value.result.ok) process.exit(1);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst result = await executeDbVerifyCommand(options, flags, ui, mode);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatVerifyJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatVerifyOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (CliStructuredError.is(result.failure)) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(result.failure.result, result.failure.unclaimed));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(result.failure.result, {\n\t\t\t\t...flags,\n\t\t\t\tquiet: false\n\t\t\t}, result.failure.unclaimed);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbVerifyCommand as t };\n\n//# sourceMappingURL=db-verify-CN4nmxxF.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,qBAAqB,UAAU,YAAY,QAAQ,WAAW;CACtE,MAAM,YAAY,SAAS,IAAI,UAAU,KAAK,SAAS,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;CACvE,IAAI,cAAc,KAAK,GAAG,MAAM,IAAI,cAAc,iFAAiF;CACnI,IAAI,QAAQ;CACZ,IAAI;CACJ,IAAI,SAAS,CAAC;CACd,IAAI,gBAAgB,CAAC;CAC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,QAAQ;IAC9D,GAAG;IACH,OAAO;GACR,GAAG,OAAO,QAAQ,SAAS;GAC3B,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
1
+ {"version":3,"file":"db-verify-0TpDMziA-CJDKutMN.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-0TpDMziA.mjs"],"sourcesContent":["import { M as errorTargetMismatch, N as errorUnexpected, O as errorRuntime, _ as errorMarkerMissing, c as errorDatabaseConnectionRequired, d as errorFileNotFound, f as errorHashMismatch, s as errorContractValidationFailed, t as CliStructuredError, u as errorDriverRequired } from \"./cli-errors-BG6bItjG.mjs\";\nimport { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, a as maskConnectionUrl, c as resolveMigrationPaths, d as setCommandExamples, n as closeQuietly, s as resolveContractPath, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-DU9qtBxW.mjs\";\nimport { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from \"./verify-Cogr_Fj9.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from \"@internal/framework-components/control\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/utils/combine-verify-results.ts\n/**\n* Collapse the aggregate verifier's per-space contract-satisfaction results\n* into a single {@link VerifyDatabaseSchemaResult} for the CLI display\n* surface, and carry the deduplicated unclaimed-elements list alongside it.\n* Concatenates the issue lists across spaces; uses the app space's result as\n* the structural envelope (storage hash, target). Extras are already\n* stripped from each per-space result, so nothing here duplicates an\n* unclaimed element per space.\n*\n* **Unclaimed disposition.** In strict mode a non-empty `unclaimed` list fails\n* the combined verdict (`ok: false`); in lenient mode it is carried for\n* informational rendering only. The list itself is returned unchanged for the\n* renderer.\n*\n* **Summary policy.** Preserve the per-family phrasing whenever the\n* combined `ok` flag agrees with the app space's `ok` flag — this is\n* the common case (single-family deployments, single-app deployments)\n* and the family's \"satisfies / does not satisfy contract\" phrasing\n* stays user-visible. When the app passes but an extension fails (or\n* vice versa) the app's summary contradicts the envelope, so fall back\n* to the first failing space's summary. This keeps family phrasing\n* intact and the envelope internally consistent (`ok: false` ↔ failure\n* summary).\n*/\nfunction combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {\n\tconst appResult = perSpace.get(appSpaceId) ?? perSpace.values().next().value;\n\tif (appResult === void 0) throw new InternalError(\"Aggregate verifier returned no per-space verify results — this is a wiring bug.\");\n\tlet okAll = true;\n\tlet firstFailure;\n\tlet issues = [];\n\tlet warningIssues = [];\n\tfor (const [, result] of perSpace) {\n\t\tif (!result.ok) {\n\t\t\tokAll = false;\n\t\t\tif (firstFailure === void 0) firstFailure = result;\n\t\t}\n\t\tissues = [...issues, ...result.schema.issues];\n\t\twarningIssues = [...warningIssues, ...result.schema.warnings?.issues ?? []];\n\t}\n\tconst unclaimedFails = strict && unclaimed.length > 0;\n\tconst ok = okAll && !unclaimedFails;\n\tconst summary = okAll ? unclaimedFails ? `Database schema has ${unclaimed.length} unclaimed element${unclaimed.length === 1 ? \"\" : \"s\"} (not in any contract)` : appResult.summary : appResult.ok ? firstFailure?.summary ?? appResult.summary : appResult.summary;\n\treturn {\n\t\tresult: {\n\t\t\tok,\n\t\t\t...ok ? {} : { code: appResult.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\t\tsummary,\n\t\t\tcontract: appResult.contract,\n\t\t\ttarget: appResult.target,\n\t\t\tschema: {\n\t\t\t\tissues,\n\t\t\t\twarnings: { issues: warningIssues }\n\t\t\t},\n\t\t\tmeta: { strict },\n\t\t\ttimings: { total: 0 }\n\t\t},\n\t\tunclaimed\n\t};\n}\n//#endregion\n//#region src/commands/db-verify.ts\n/**\n* Maps a VerifyDatabaseResult failure to a CliStructuredError.\n*/\nfunction mapVerifyFailure(verifyResult) {\n\tif (!verifyResult.ok && verifyResult.code) {\n\t\tif (verifyResult.code === VERIFY_CODE_MARKER_MISSING) return errorMarkerMissing();\n\t\tif (verifyResult.code === VERIFY_CODE_HASH_MISMATCH) {\n\t\t\tconst storageMatch = verifyResult.marker?.storageHash === verifyResult.contract.storageHash;\n\t\t\tconst profileMatch = !verifyResult.contract.profileHash || verifyResult.marker?.profileHash === verifyResult.contract.profileHash;\n\t\t\tif (!storageMatch) return errorHashMismatch({\n\t\t\t\twhy: \"Contract storageHash does not match database marker\",\n\t\t\t\texpected: verifyResult.contract.storageHash,\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.storageHash)\n\t\t\t});\n\t\t\treturn errorHashMismatch({\n\t\t\t\twhy: profileMatch ? \"Contract hash does not match database marker\" : \"Contract profileHash does not match database marker\",\n\t\t\t\t...ifDefined(\"expected\", verifyResult.contract.profileHash),\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.profileHash)\n\t\t\t});\n\t\t}\n\t\tif (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? \"unknown\");\n\t}\n\treturn errorRuntime(\"CONTRACT.VERIFY_FAILED\", verifyResult.summary, {\n\t\twhy: \"Verification failed\",\n\t\tfix: \"Check contract and database state\"\n\t});\n}\nfunction errorInvalidVerifyMode(options) {\n\treturn new CliStructuredError(\"CLI.INVALID_VERIFY_MODE\", \"Invalid verify mode\", {\n\t\twhy: options.why,\n\t\tfix: options.fix,\n\t\tdocsUrl: \"https://pris.ly/db-verify\"\n\t});\n}\nfunction resolveDbVerifyMode(options) {\n\tif (options.markerOnly && options.schemaOnly) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--marker-only` and `--schema-only` cannot be used together\",\n\t\tfix: \"Choose one mode: omit both to check the marker and schema, use `--marker-only` to check only the marker, or use `--schema-only` to check only the live schema.\"\n\t}));\n\tif (options.markerOnly && options.strict) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--strict` requires schema verification, but `--marker-only` skips it\",\n\t\tfix: \"Remove `--strict`, or use `db verify` / `db verify --schema-only` when you want to check the live schema in strict mode.\"\n\t}));\n\tif (options.schemaOnly) return ok(\"schema-only\");\n\tif (options.markerOnly) return ok(\"marker-only\");\n\treturn ok(\"full\");\n}\nfunction formatDbVerifyModeLabel(mode, strict) {\n\tif (mode === \"marker-only\") return \"marker only\";\n\tif (mode === \"schema-only\") return `schema only (${strict ? \"strict\" : \"tolerant\"})`;\n\treturn `full (marker + schema, ${strict ? \"strict\" : \"tolerant\"})`;\n}\nfunction formatDbVerifyInvocation(mode, strict) {\n\tconst args = [\"db verify\"];\n\tif (mode === \"marker-only\") args.push(\"--marker-only\");\n\tif (mode === \"schema-only\") args.push(\"--schema-only\");\n\tif (strict) args.push(\"--strict\");\n\treturn args.join(\" \");\n}\nfunction createDbVerifyConnectionRequiredError(options) {\n\tconst invocation = formatDbVerifyInvocation(options.mode, options.strict);\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${invocation} (set db.connection in ${options.configPath}, or pass --db <url>)`,\n\t\tretryCommand: `prisma-next ${invocation} --db <url>`\n\t});\n}\nfunction renderVerifyHeader(paths, options, mode, flags, ui) {\n\tif (flags.json || flags.quiet) return;\n\tconst description = mode === \"schema-only\" ? \"Check whether the live database schema matches your contract\" : mode === \"marker-only\" ? \"Check whether the database marker matches your contract\" : \"Check whether the database marker and live schema match your contract\";\n\tconst details = [\n\t\t{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: paths.configPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: paths.contractPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: formatDbVerifyModeLabel(mode, options.strict ?? false)\n\t\t}\n\t];\n\tif (options.db) details.push({\n\t\tlabel: \"database\",\n\t\tvalue: maskConnectionUrl(options.db)\n\t});\n\tui.stderr(formatStyledHeader({\n\t\tcommand: \"db verify\",\n\t\tdescription,\n\t\turl: \"https://pris.ly/db-verify\",\n\t\tdetails,\n\t\tflags\n\t}));\n}\nasync function resolveVerifyPaths(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tconst contractPathAbsolute = resolveContractPath(config);\n\treturn ok({\n\t\tconfig,\n\t\tconfigPath,\n\t\tcontractPathAbsolute,\n\t\tcontractPath: relative(process.cwd(), contractPathAbsolute)\n\t});\n}\nasync function resolveVerifySetup(paths, options, mode) {\n\tconst { config, configPath, contractPathAbsolute, contractPath } = paths;\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (typeof dbConnection !== \"string\" || dbConnection.length === 0) return notOk(createDbVerifyConnectionRequiredError({\n\t\tconfigPath,\n\t\tmode,\n\t\tstrict: options.strict ?? false\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${formatDbVerifyInvocation(mode, options.strict ?? false)}` }));\n\treturn ok({\n\t\t...paths,\n\t\tcontractJson,\n\t\tdbConnection\n\t});\n}\nfunction createVerifyClient(setup) {\n\treturn createControlClient({\n\t\tfamily: setup.config.family,\n\t\ttarget: setup.config.target,\n\t\tadapter: setup.config.adapter,\n\t\tdriver: setup.config.driver,\n\t\textensions: setup.config.extensions ?? []\n\t});\n}\nfunction wrapVerifyError(error, contractPathAbsolute, modeLabel) {\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during ${modeLabel}: ${error instanceof Error ? error.message : String(error)}` }));\n}\n/**\n* Executes the db verify command and returns a structured Result.\n*/\nasync function executeDbVerifyCommand(options, flags, ui, mode) {\n\tconst startTime = Date.now();\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, mode, flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, mode);\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst verifyResult = await client.verify({\n\t\t\tcontract: contractJson,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!verifyResult.ok) return notOk(mapVerifyFailure(verifyResult));\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: mode === \"marker-only\",\n\t\t\tskipMarker: false,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\tif (mode === \"marker-only\") return ok({\n\t\t\tok: true,\n\t\t\tmode: \"marker-only\",\n\t\t\tsummary: \"Database marker matches contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\twarning: \"Schema verification skipped because --marker-only was provided\",\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"skipped\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst combined = combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed);\n\t\tif (!combined.result.ok) return notOk(combined);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: \"full\",\n\t\t\tsummary: \"Database marker and schema match contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\tschema: {\n\t\t\t\tsummary: combined.result.summary,\n\t\t\t\tstrict: combined.result.meta?.strict ?? false,\n\t\t\t\twarnings: (combined.result.schema.warnings?.issues ?? []).map((issue) => issue.path.join(\"/\"))\n\t\t\t},\n\t\t\tunclaimed: combined.unclaimed,\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"performed\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nasync function executeDbSchemaOnlyVerifyCommand(options, flags, ui) {\n\tconst pathsResult = await resolveVerifyPaths(options);\n\tif (!pathsResult.ok) return pathsResult;\n\tconst paths = pathsResult.value;\n\trenderVerifyHeader(paths, options, \"schema-only\", flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, \"schema-only\");\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config, process.cwd());\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: false,\n\t\t\tskipMarker: true,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\treturn ok(combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed));\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify --schema-only\");\n\t} finally {\n\t\tawait closeQuietly(client);\n\t}\n}\nfunction createDbVerifyCommand() {\n\tconst command = new Command(\"verify\");\n\tsetCommandDescriptions(command, \"Check whether the database marker and live schema match your contract\", \"Verifies the database marker first, then checks the database schema matches your contract.\\nUse `--marker-only` for marker-only verification, `--schema-only` to skip marker checks and\\ninspect only the live schema, and `--strict` to fail if the database includes elements\\nnot present in the contract.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db verify --db $DATABASE_URL\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --marker-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--marker-only\", \"Skip schema verification and only check the database marker\").option(\"--schema-only\", \"Skip marker verification and only check whether the live schema satisfies the contract\").option(\"--strict\", \"Strict mode: schema elements not present in the contract are considered an error\", false).action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst modeResult = resolveDbVerifyMode(options);\n\t\tif (!modeResult.ok) {\n\t\t\tconst exitCode = handleResult(modeResult, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst mode = modeResult.value;\n\t\tif (mode === \"schema-only\") {\n\t\t\tconst result = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);\n\t\t\tconst exitCode = handleResult(result, flags, ui, (combined) => {\n\t\t\t\tif (flags.json) ui.output(formatSchemaVerifyJson(combined.result, combined.unclaimed));\n\t\t\t\telse {\n\t\t\t\t\tconst renderFlags = combined.result.ok ? flags : {\n\t\t\t\t\t\t...flags,\n\t\t\t\t\t\tquiet: false\n\t\t\t\t\t};\n\t\t\t\t\tconst output = formatSchemaVerifyOutput(combined.result, renderFlags, combined.unclaimed);\n\t\t\t\t\tif (output) ui.log(output);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (result.ok && !result.value.result.ok) process.exit(1);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst result = await executeDbVerifyCommand(options, flags, ui, mode);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatVerifyJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatVerifyOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (CliStructuredError.is(result.failure)) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(result.failure.result, result.failure.unclaimed));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(result.failure.result, {\n\t\t\t\t...flags,\n\t\t\t\tquiet: false\n\t\t\t}, result.failure.unclaimed);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbVerifyCommand as t };\n\n//# sourceMappingURL=db-verify-0TpDMziA.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,qBAAqB,UAAU,YAAY,QAAQ,WAAW;CACtE,MAAM,YAAY,SAAS,IAAI,UAAU,KAAK,SAAS,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;CACvE,IAAI,cAAc,KAAK,GAAG,MAAM,IAAI,cAAc,iFAAiF;CACnI,IAAI,QAAQ;CACZ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,SAAS,CAAC;OAC5F;GACJ,MAAM,SAAS,yBAAyB,OAAO,QAAQ,QAAQ;IAC9D,GAAG;IACH,OAAO;GACR,GAAG,OAAO,QAAQ,SAAS;GAC3B,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
@@ -1,7 +1,7 @@
1
1
  import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
2
- import { N as errorUnexpected, O as errorRuntime$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
2
+ import { P as errorUnexpected, k as errorRuntime$1 } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
3
3
  import { r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
4
- import { b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-kD9CO1hd-BPhnkBin.mjs";
4
+ import { b as setCommandExamples, m as parseGlobalFlagsOrExit, s as formatStyledHeader, t as addGlobalOptions, u as handleResult, y as setCommandDescriptions } from "./command-helpers-CwLvFwMB-BWwUQhlT.mjs";
5
5
  import { relative, resolve } from "pathe";
6
6
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
7
7
  import { readFile, writeFile } from "node:fs/promises";
@@ -9,7 +9,7 @@ import { notOk, ok } from "@prisma/orm-framework/utils/result";
9
9
  import { Command } from "commander";
10
10
  import { EOL } from "node:os";
11
11
  import { format } from "@prisma/orm-framework/psl-parser/format";
12
- //#region ../../../1-framework/3-tooling/cli/dist/format-B-3QEUOd.mjs
12
+ //#region ../../../1-framework/3-tooling/cli/dist/format-BGt6HCfT.mjs
13
13
  function resolveNewline(formatterNewline, eol) {
14
14
  if (formatterNewline !== void 0) return formatterNewline;
15
15
  return eol === "\r\n" ? "CRLF" : "LF";
@@ -63,7 +63,7 @@ async function executeFormat(options) {
63
63
  });
64
64
  }
65
65
  //#endregion
66
- //#region ../../../1-framework/3-tooling/cli/dist/format-DceifGAK.mjs
66
+ //#region ../../../1-framework/3-tooling/cli/dist/format-cbJY7l6v.mjs
67
67
  async function runFormat(options) {
68
68
  const configResult = await loadConfigForSections(options.config, ["contract", "formatter"]);
69
69
  if (!configResult.ok) return configResult;
@@ -107,4 +107,4 @@ function createFormatCommand() {
107
107
  //#endregion
108
108
  export { executeFormat as n, createFormatCommand as t };
109
109
 
110
- //# sourceMappingURL=format-DceifGAK-BJhTdkcO.mjs.map
110
+ //# sourceMappingURL=format-cbJY7l6v-CjMUDTAs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-DceifGAK-BJhTdkcO.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/format-B-3QEUOd.mjs","../../../../1-framework/3-tooling/cli/dist/format-DceifGAK.mjs"],"sourcesContent":["import { D as errorRuntime, M as errorUnexpected } from \"./cli-errors-C6_pH59O.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { resolve } from \"pathe\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { EOL } from \"node:os\";\nimport { format } from \"@internal/psl-parser/format\";\n//#region src/control-api/operations/format.ts\nfunction resolveNewline(formatterNewline, eol) {\n\tif (formatterNewline !== void 0) return formatterNewline;\n\treturn eol === \"\\r\\n\" ? \"CRLF\" : \"LF\";\n}\nasync function executeFormat(options) {\n\tconst eol = options.eol ?? EOL;\n\tconst config = options.config;\n\tconst source = config.contract?.source;\n\tif (source?.format !== \"psl\") return ok({ formatted: false });\n\tconst declaredPath = source.inputs?.[0];\n\tif (declaredPath === void 0) return ok({ formatted: false });\n\tconst inputPath = resolve(options.cwd, declaredPath);\n\tlet contents;\n\ttry {\n\t\tcontents = await readFile(inputPath, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to read contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} exists and is readable.`,\n\t\t\tcause: error\n\t\t}));\n\t}\n\tconst formatOptions = {\n\t\tindent: config.formatter?.indent ?? 2,\n\t\tnewline: resolveNewline(config.formatter?.newline, eol)\n\t};\n\tlet formatted;\n\ttry {\n\t\tformatted = format(contents, formatOptions);\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"PSL.PARSE_FAILED\") return notOk(errorRuntime(\"PSL.PARSE_FAILED\", \"Cannot format PSL with parse errors\", {\n\t\t\twhy: error.message,\n\t\t\tfix: \"Fix the parse errors in your schema and try again.\",\n\t\t\tmeta: { diagnostics: error.meta?.[\"diagnostics\"] },\n\t\t\tcause: error\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n\t}\n\ttry {\n\t\tawait writeFile(inputPath, formatted, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"CLI.FILE_WRITE_FAILED\", \"Failed to write formatted contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} is writable.`,\n\t\t\tcause: error\n\t\t}));\n\t}\n\treturn ok({\n\t\tformatted: true,\n\t\tpath: inputPath\n\t});\n}\n//#endregion\nexport { executeFormat as t };\n\n//# sourceMappingURL=format-B-3QEUOd.mjs.map","import { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { 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 executeFormat } from \"./format-B-3QEUOd.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { relative, resolve } from \"pathe\";\n//#region src/commands/format.ts\nasync function runFormat(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\"contract\", \"formatter\"]);\n\tif (!configResult.ok) return configResult;\n\treturn executeFormat({\n\t\tconfig: configResult.value,\n\t\tcwd: process.cwd()\n\t});\n}\nfunction createFormatCommand() {\n\tconst command = new Command(\"format\");\n\tsetCommandDescriptions(command, \"Format your PSL contract source\", \"Formats the Prisma schema (PSL) contract source declared in your config\\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\\nread from the optional formatter config section, defaulting to two spaces and the\\nsystem newline.\");\n\tsetCommandExamples(command, [\"prisma-next format\", \"prisma-next format --config ./custom-config.ts\"]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst displayConfigPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\t\t\tui.stderr(formatStyledHeader({\n\t\t\t\tcommand: \"format\",\n\t\t\t\tdescription: \"Format your PSL contract source\",\n\t\t\t\tdetails: [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: displayConfigPath\n\t\t\t\t}],\n\t\t\t\tflags\n\t\t\t}));\n\t\t}\n\t\tconst exitCode = handleResult(await runFormat(options), flags, ui, (value) => {\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(JSON.stringify(value));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (flags.quiet) return;\n\t\t\tif (value.formatted) ui.success(`Formatted ${relative(process.cwd(), value.path ?? \"\")}`);\n\t\t\telse ui.info(\"Nothing to format (contract source is not PSL).\");\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createFormatCommand as t };\n\n//# sourceMappingURL=format-DceifGAK.mjs.map"],"mappings":";;;;;;;;;;;;AAQA,SAAS,eAAe,kBAAkB,KAAK;CAC9C,IAAI,qBAAqB,KAAK,GAAG,OAAO;CACxC,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Y7l6v-CjMUDTAs.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/format-BGt6HCfT.mjs","../../../../1-framework/3-tooling/cli/dist/format-cbJY7l6v.mjs"],"sourcesContent":["import { N as errorUnexpected, O as errorRuntime } from \"./cli-errors-BG6bItjG.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { resolve } from \"pathe\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { EOL } from \"node:os\";\nimport { format } from \"@internal/psl-parser/format\";\n//#region src/control-api/operations/format.ts\nfunction resolveNewline(formatterNewline, eol) {\n\tif (formatterNewline !== void 0) return formatterNewline;\n\treturn eol === \"\\r\\n\" ? \"CRLF\" : \"LF\";\n}\nasync function executeFormat(options) {\n\tconst eol = options.eol ?? EOL;\n\tconst config = options.config;\n\tconst source = config.contract?.source;\n\tif (source?.format !== \"psl\") return ok({ formatted: false });\n\tconst declaredPath = source.inputs?.[0];\n\tif (declaredPath === void 0) return ok({ formatted: false });\n\tconst inputPath = resolve(options.cwd, declaredPath);\n\tlet contents;\n\ttry {\n\t\tcontents = await readFile(inputPath, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to read contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} exists and is readable.`,\n\t\t\tcause: error\n\t\t}));\n\t}\n\tconst formatOptions = {\n\t\tindent: config.formatter?.indent ?? 2,\n\t\tnewline: resolveNewline(config.formatter?.newline, eol)\n\t};\n\tlet formatted;\n\ttry {\n\t\tformatted = format(contents, formatOptions);\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"PSL.PARSE_FAILED\") return notOk(errorRuntime(\"PSL.PARSE_FAILED\", \"Cannot format PSL with parse errors\", {\n\t\t\twhy: error.message,\n\t\t\tfix: \"Fix the parse errors in your schema and try again.\",\n\t\t\tmeta: { diagnostics: error.meta?.[\"diagnostics\"] },\n\t\t\tcause: error\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n\t}\n\ttry {\n\t\tawait writeFile(inputPath, formatted, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"CLI.FILE_WRITE_FAILED\", \"Failed to write formatted contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} is writable.`,\n\t\t\tcause: error\n\t\t}));\n\t}\n\treturn ok({\n\t\tformatted: true,\n\t\tpath: inputPath\n\t});\n}\n//#endregion\nexport { executeFormat as t };\n\n//# sourceMappingURL=format-BGt6HCfT.mjs.map","import { t as createTerminalUI } from \"./terminal-ui-Cqz4LVL7.mjs\";\nimport { S as formatStyledHeader, _ as parseGlobalFlagsOrExit, d as setCommandExamples, t as addGlobalOptions, u as setCommandDescriptions, v as handleResult } from \"./command-helpers-CwLvFwMB.mjs\";\nimport { t as executeFormat } from \"./format-BGt6HCfT.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { relative, resolve } from \"pathe\";\n//#region src/commands/format.ts\nasync function runFormat(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\"contract\", \"formatter\"]);\n\tif (!configResult.ok) return configResult;\n\treturn executeFormat({\n\t\tconfig: configResult.value,\n\t\tcwd: process.cwd()\n\t});\n}\nfunction createFormatCommand() {\n\tconst command = new Command(\"format\");\n\tsetCommandDescriptions(command, \"Format your PSL contract source\", \"Formats the Prisma schema (PSL) contract source declared in your config\\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\\nread from the optional formatter config section, defaulting to two spaces and the\\nsystem newline.\");\n\tsetCommandExamples(command, [\"prisma-next format\", \"prisma-next format --config ./custom-config.ts\"]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst displayConfigPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\t\t\tui.stderr(formatStyledHeader({\n\t\t\t\tcommand: \"format\",\n\t\t\t\tdescription: \"Format your PSL contract source\",\n\t\t\t\tdetails: [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: displayConfigPath\n\t\t\t\t}],\n\t\t\t\tflags\n\t\t\t}));\n\t\t}\n\t\tconst exitCode = handleResult(await runFormat(options), flags, ui, (value) => {\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(JSON.stringify(value));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (flags.quiet) return;\n\t\t\tif (value.formatted) ui.success(`Formatted ${relative(process.cwd(), value.path ?? \"\")}`);\n\t\t\telse ui.info(\"Nothing to format (contract source is not PSL).\");\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createFormatCommand as t };\n\n//# sourceMappingURL=format-cbJY7l6v.mjs.map"],"mappings":";;;;;;;;;;;;AAQA,SAAS,eAAe,kBAAkB,KAAK;CAC9C,IAAI,qBAAqB,KAAK,GAAG,OAAO;CACxC,OAAO,QAAQ,SAAS,SAAS;AAClC;AACA,eAAe,cAAc,SAAS;CACrC,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,SAAS,QAAQ;CACvB,MAAM,SAAS,OAAO,UAAU;CAChC,IAAI,QAAQ,WAAW,OAAO,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CAC5D,MAAM,eAAe,OAAO,SAAS;CACrC,IAAI,iBAAiB,KAAK,GAAG,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CAC3D,MAAM,YAAY,QAAQ,QAAQ,KAAK,YAAY;CACnD,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,SAAS,WA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AAC,sBAAsB,gDAAgD,CAAC;CACpG,iBAAiB,OAAO,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EAC9G,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;GAChC,MAAM,oBAAoB,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;GAC9F,GAAG,OAAO,mBAAmB;IAC5B,SAAS;IACT,aAAa;IACb,SAAS,CAAC;KACT,OAAO;KACP,OAAO;IACR,CAAC;IACD;GACD,CAAC,CAAC;EACH;EACA,MAAM,WAAW,aAAa,MAAM,UAAU,OAAO,GAAG,OAAO,KAAK,UAAU;GAC7E,IAAI,MAAM,MAAM;IACf,GAAG,OAAO,KAAK,UAAU,KAAK,CAAC;IAC/B;GACD;GACA,IAAI,MAAM,OAAO;GACjB,IAAI,MAAM,WAAW,GAAG,QAAQ,aAAa,SAAS,QAAQ,IAAI,GAAG,MAAM,QAAQ,EAAE,GAAG;QACnF,GAAG,KAAK,iDAAiD;EAC/D,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,6 +1,6 @@
1
- import { a as errorConfigValidation } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
1
+ import { a as errorConfigValidation } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
2
2
  import "@prisma/orm-framework/components/components";
3
- //#region ../../../1-framework/3-tooling/cli/dist/framework-components-CPFWl2Ix.mjs
3
+ //#region ../../../1-framework/3-tooling/cli/dist/framework-components-C3K7SBeC.mjs
4
4
  /**
5
5
  * Asserts that all framework components are compatible with the expected family and target.
6
6
  *
@@ -57,4 +57,4 @@ function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId,
57
57
  //#endregion
58
58
  export { assertFrameworkComponentsCompatible as t };
59
59
 
60
- //# sourceMappingURL=framework-components-CPFWl2Ix-CrIZL3jG.mjs.map
60
+ //# sourceMappingURL=framework-components-C3K7SBeC-Bj5gx85-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-components-CPFWl2Ix-CrIZL3jG.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/framework-components-CPFWl2Ix.mjs"],"sourcesContent":["import { i as errorConfigValidation } from \"./cli-errors-C6_pH59O.mjs\";\nimport \"@internal/framework-components/components\";\n//#region src/utils/framework-components.ts\n/**\n* Asserts that all framework components are compatible with the expected family and target.\n*\n* This function validates that each component in the framework components array:\n* - Has kind 'target', 'adapter', 'extension', or 'driver'\n* - Has familyId matching expectedFamilyId\n* - Has targetId matching expectedTargetId\n*\n* This validation happens at the CLI composition boundary, before passing components\n* to typed planner/runner instances. It fills the gap between runtime validation\n* (via the config loader's `collectConfigIssues` diagnostics) and compile-time\n* type enforcement.\n*\n* @param expectedFamilyId - The expected family ID (e.g., 'sql')\n* @param expectedTargetId - The expected target ID (e.g., 'postgres')\n* @param frameworkComponents - Array of framework components to validate\n* @returns The same array typed as TargetBoundComponentDescriptor\n* @throws CliStructuredError if any component is incompatible\n*\n* @example\n* ```ts\n* const configResult = await loadConfigForSections(undefined, ['family', 'target', 'adapter', 'extensions']);\n* const config = configResult.assertOk();\n* const frameworkComponents = [config.target, config.adapter, ...(config.extensions ?? [])];\n*\n* // Validate and type-narrow components before passing to planner\n* const typedComponents = assertFrameworkComponentsCompatible(\n* config.family.familyId,\n* config.target.targetId,\n* frameworkComponents\n* );\n*\n* const planner = target.migrations.createPlanner(familyInstance);\n* planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n* ```\n*/\nfunction assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {\n\tfor (let i = 0; i < frameworkComponents.length; i++) {\n\t\tconst component = frameworkComponents[i];\n\t\tif (typeof component !== \"object\" || component === null) throw errorConfigValidation(\"frameworkComponents[]\", { why: `Framework component at index ${i} must be an object` });\n\t\tconst record = component;\n\t\tif (!Object.hasOwn(record, \"kind\")) throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} must have 'kind' property` });\n\t\tconst kind = record[\"kind\"];\n\t\tif (kind !== \"target\" && kind !== \"adapter\" && kind !== \"extension\" && kind !== \"driver\") throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')` });\n\t\tif (!Object.hasOwn(record, \"familyId\")) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property` });\n\t\tconst familyId = record[\"familyId\"];\n\t\tif (familyId !== expectedFamilyId) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'` });\n\t\tif (!Object.hasOwn(record, \"targetId\")) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property` });\n\t\tconst targetId = record[\"targetId\"];\n\t\tif (targetId !== expectedTargetId) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'` });\n\t}\n\treturn frameworkComponents;\n}\n//#endregion\nexport { assertFrameworkComponentsCompatible as t };\n\n//# sourceMappingURL=framework-components-CPFWl2Ix.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,oCAAoC,kBAAkB,kBAAkB,qBAAqB;CACrG,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACpD,MAAM,YAAY,oBAAoB;EACtC,IAAI,OAAO,cAAc,YAAY,cAAc,MAAM,MAAM,sBAAsB,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,oBAAoB,CAAC;EAC5K,MAAM,SAAS;EACf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAAG,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,4BAA4B,CAAC;EACpK,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAAU,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAA2D,CAAC;EAC3R,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;EAC3O,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;CAC5O;CACA,OAAO;AACR"}
1
+ {"version":3,"file":"framework-components-C3K7SBeC-Bj5gx85-.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/framework-components-C3K7SBeC.mjs"],"sourcesContent":["import { i as errorConfigValidation } from \"./cli-errors-BG6bItjG.mjs\";\nimport \"@internal/framework-components/components\";\n//#region src/utils/framework-components.ts\n/**\n* Asserts that all framework components are compatible with the expected family and target.\n*\n* This function validates that each component in the framework components array:\n* - Has kind 'target', 'adapter', 'extension', or 'driver'\n* - Has familyId matching expectedFamilyId\n* - Has targetId matching expectedTargetId\n*\n* This validation happens at the CLI composition boundary, before passing components\n* to typed planner/runner instances. It fills the gap between runtime validation\n* (via the config loader's `collectConfigIssues` diagnostics) and compile-time\n* type enforcement.\n*\n* @param expectedFamilyId - The expected family ID (e.g., 'sql')\n* @param expectedTargetId - The expected target ID (e.g., 'postgres')\n* @param frameworkComponents - Array of framework components to validate\n* @returns The same array typed as TargetBoundComponentDescriptor\n* @throws CliStructuredError if any component is incompatible\n*\n* @example\n* ```ts\n* const configResult = await loadConfigForSections(undefined, ['family', 'target', 'adapter', 'extensions']);\n* const config = configResult.assertOk();\n* const frameworkComponents = [config.target, config.adapter, ...(config.extensions ?? [])];\n*\n* // Validate and type-narrow components before passing to planner\n* const typedComponents = assertFrameworkComponentsCompatible(\n* config.family.familyId,\n* config.target.targetId,\n* frameworkComponents\n* );\n*\n* const planner = target.migrations.createPlanner(familyInstance);\n* planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n* ```\n*/\nfunction assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {\n\tfor (let i = 0; i < frameworkComponents.length; i++) {\n\t\tconst component = frameworkComponents[i];\n\t\tif (typeof component !== \"object\" || component === null) throw errorConfigValidation(\"frameworkComponents[]\", { why: `Framework component at index ${i} must be an object` });\n\t\tconst record = component;\n\t\tif (!Object.hasOwn(record, \"kind\")) throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} must have 'kind' property` });\n\t\tconst kind = record[\"kind\"];\n\t\tif (kind !== \"target\" && kind !== \"adapter\" && kind !== \"extension\" && kind !== \"driver\") throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')` });\n\t\tif (!Object.hasOwn(record, \"familyId\")) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property` });\n\t\tconst familyId = record[\"familyId\"];\n\t\tif (familyId !== expectedFamilyId) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'` });\n\t\tif (!Object.hasOwn(record, \"targetId\")) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property` });\n\t\tconst targetId = record[\"targetId\"];\n\t\tif (targetId !== expectedTargetId) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'` });\n\t}\n\treturn frameworkComponents;\n}\n//#endregion\nexport { assertFrameworkComponentsCompatible as t };\n\n//# sourceMappingURL=framework-components-C3K7SBeC.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,oCAAoC,kBAAkB,kBAAkB,qBAAqB;CACrG,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACpD,MAAM,YAAY,oBAAoB;EACtC,IAAI,OAAO,cAAc,YAAY,cAAc,MAAM,MAAM,sBAAsB,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,oBAAoB,CAAC;EAC5K,MAAM,SAAS;EACf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAAG,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,4BAA4B,CAAC;EACpK,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAAU,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAA2D,CAAC;EAC3R,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;EAC3O,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;CAC5O;CACA,OAAO;AACR"}
@@ -1,4 +1,4 @@
1
- import { t as CliStructuredError$1 } from "./cli-errors-C6_pH59O-CzD4SYcJ.mjs";
1
+ import { t as CliStructuredError$1 } from "./cli-errors-BG6bItjG-DwdKIeGz.mjs";
2
2
  import { a as formatErrorJson, o as formatErrorOutput, r as createTerminalUI } from "./terminal-ui-Cqz4LVL7-B0mcVdLy.mjs";
3
3
  import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-DWNYqZGc-D2sRgLAm.mjs";
4
4
  import { a as schemaSample, c as targetLabel, i as scaffoldSpecifierResolverFor, l as targetPackageName, n as dbFile, o as starterSchema, r as defaultSchemaPath, s as targetEntrypoint, t as configFile, u as version } from "./bin__prisma-next.mjs";
@@ -15,7 +15,7 @@ import { execFile } from "node:child_process";
15
15
  import { promisify } from "node:util";
16
16
  import { detect, getUserAgent } from "package-manager-detector/detect";
17
17
  import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
18
- //#region ../../../1-framework/3-tooling/cli/dist/init-SY01IBU-.mjs
18
+ //#region ../../../1-framework/3-tooling/cli/dist/init-Bco4QkKJ.mjs
19
19
  const KNOWN = /* @__PURE__ */ new Set([
20
20
  "pnpm",
21
21
  "npm",
@@ -2182,7 +2182,7 @@ async function runEmit(ctx) {
2182
2182
  const spinner = ctx.ui.spinner();
2183
2183
  spinner.start("Emitting contract...");
2184
2184
  try {
2185
- const { executeContractEmit } = await import("./contract-emit-Csa6R0gt-DvxFlS0O.mjs");
2185
+ const { executeContractEmit } = await import("./contract-emit-Bzt11N4v-BQ2Pr8KG.mjs");
2186
2186
  const { loadConfigForSections } = await import("./exports-BZLNbtkY.mjs").then((n) => n.t);
2187
2187
  const configFilePath = join(ctx.baseDir, "prisma-next.config.ts");
2188
2188
  const configResult = await loadConfigForSections(configFilePath, [
@@ -2249,4 +2249,4 @@ function sanitisePackageName(raw) {
2249
2249
  //#endregion
2250
2250
  export { runInit };
2251
2251
 
2252
- //# sourceMappingURL=init-SY01IBU--CQFYh2As.mjs.map
2252
+ //# sourceMappingURL=init-Bco4QkKJ-DqUZVrBU.mjs.map