@prisma/orm-toolchain 8.0.0-rc.1-dev.21 → 8.0.0-rc.1-dev.23

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 (167) 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-D7Qznyrm-BzYooF6H.mjs → caught-errors-D7Qznyrm-DaZubR00.mjs} +2 -2
  4. package/dist/{caught-errors-D7Qznyrm-BzYooF6H.mjs.map → caught-errors-D7Qznyrm-DaZubR00.mjs.map} +1 -1
  5. package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts} +3 -3
  6. package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts.map → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts.map} +1 -1
  7. package/dist/cli-telemetry.mjs +6 -5
  8. package/dist/cli-telemetry.mjs.map +1 -1
  9. package/dist/cli.mjs +2 -2
  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 +5 -5
  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 +66 -0
  39. package/dist/cli__control-api__testing.d.mts.map +1 -0
  40. package/dist/cli__control-api__testing.mjs +255 -0
  41. package/dist/cli__control-api__testing.mjs.map +1 -0
  42. package/dist/cli__migration-cli.mjs +13 -4
  43. package/dist/cli__migration-cli.mjs.map +1 -1
  44. package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs → client-BNAEJZ76-ld7eOxpZ.mjs} +5 -5
  45. package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs.map → client-BNAEJZ76-ld7eOxpZ.mjs.map} +1 -1
  46. package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs → command-helpers-C4WpR-QE-DNllqff1.mjs} +3 -3
  47. package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs.map → command-helpers-C4WpR-QE-DNllqff1.mjs.map} +1 -1
  48. package/dist/config-loader.d.mts +2 -2
  49. package/dist/config-loader.mjs +2 -2
  50. package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs} +2 -2
  51. package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs.map} +1 -1
  52. package/dist/{contract-emit-D8IXP9Qp-Df6NwXn8.mjs → contract-emit-DFu7h-Zl-7DBgYNv7.mjs} +9 -13
  53. package/dist/contract-emit-DFu7h-Zl-7DBgYNv7.mjs.map +1 -0
  54. package/dist/{contract-emit-CTm2zfuG-7PV9SBY6.mjs → contract-emit-DT0JKUZT-BYE7WZPc.mjs} +17 -9
  55. package/dist/contract-emit-DT0JKUZT-BYE7WZPc.mjs.map +1 -0
  56. package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs → contract-infer-C_b7E71m-D2UO-X-k.mjs} +4 -4
  57. package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map → contract-infer-C_b7E71m-D2UO-X-k.mjs.map} +1 -1
  58. package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs} +3 -3
  59. package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs.map} +1 -1
  60. package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs} +2 -2
  61. package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs.map} +1 -1
  62. package/dist/{db-init-CBj_EWg3.mjs → db-init-Cqjw5Flp.mjs} +3 -3
  63. package/dist/{db-init-CBj_EWg3.mjs.map → db-init-Cqjw5Flp.mjs.map} +1 -1
  64. package/dist/{db-schema-BWpeh0Q_.mjs → db-schema-CRGCFKlH.mjs} +4 -4
  65. package/dist/{db-schema-BWpeh0Q_.mjs.map → db-schema-CRGCFKlH.mjs.map} +1 -1
  66. package/dist/{db-sign-DCb_DKtv.mjs → db-sign-BPQduGHb.mjs} +18 -7
  67. package/dist/db-sign-BPQduGHb.mjs.map +1 -0
  68. package/dist/{db-update-WX0KitcX.mjs → db-update-DuEk-ra5.mjs} +4 -4
  69. package/dist/{db-update-WX0KitcX.mjs.map → db-update-DuEk-ra5.mjs.map} +1 -1
  70. package/dist/{db-verify-B8ax2Y_x-Bp4s5Ra6.mjs → db-verify-DPH4lonK-pteoYVnK.mjs} +26 -11
  71. package/dist/db-verify-DPH4lonK-pteoYVnK.mjs.map +1 -0
  72. package/dist/exports-BN0vFTxG.mjs.map +1 -1
  73. package/dist/{exports-BnihzVhw.mjs → exports-DAA3XD4a.mjs} +15 -3
  74. package/dist/exports-DAA3XD4a.mjs.map +1 -0
  75. package/dist/exports-DVoyX2LM.mjs +173 -0
  76. package/dist/exports-DVoyX2LM.mjs.map +1 -0
  77. package/dist/{format-Bw3LVJ1v-BJ6lVFMA.mjs → format-DyVeO1z5-D1lnTJaz.mjs} +7 -11
  78. package/dist/format-DyVeO1z5-D1lnTJaz.mjs.map +1 -0
  79. package/dist/{framework-components-3DdB31mk-BHyX-OlJ.mjs → framework-components-ioeTnj2Z-yyQtaVWk.mjs} +7 -5
  80. package/dist/framework-components-ioeTnj2Z-yyQtaVWk.mjs.map +1 -0
  81. package/dist/index-Deu3DQZI.d.mts +47 -0
  82. package/dist/index-Deu3DQZI.d.mts.map +1 -0
  83. package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs → init-BwYYd10C-CJq9i42m.mjs} +4 -4
  84. package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs.map → init-BwYYd10C-CJq9i42m.mjs.map} +1 -1
  85. package/dist/{inspect-live-schema-Da76TWOs-CAFqkhGb.mjs → inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs} +15 -12
  86. package/dist/inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs.map +1 -0
  87. package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs → invariants-BzYfO9IL-BPDPDIr0.mjs} +2 -2
  88. package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs.map → invariants-BzYfO9IL-BPDPDIr0.mjs.map} +1 -1
  89. package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs → legend-5iwwlLU2-Bit8enjF.mjs} +2 -2
  90. package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs.map → legend-5iwwlLU2-Bit8enjF.mjs.map} +1 -1
  91. package/dist/{migrate-B-NAuO90.mjs → migrate-Bfsw18KQ.mjs} +23 -12
  92. package/dist/migrate-Bfsw18KQ.mjs.map +1 -0
  93. package/dist/{migrate-show-B2LkXkoB-D1ZNl84C.mjs → migrate-show-CO5OiR3J-DE4NIjvW.mjs} +18 -7
  94. package/dist/migrate-show-CO5OiR3J-DE4NIjvW.mjs.map +1 -0
  95. package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts} +3 -3
  96. package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts.map → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts.map} +1 -1
  97. package/dist/{migration-check-BDjtAn7x-B0nEBR0k.mjs → migration-check-BfOnfgyY-DII6Ty5m.mjs} +19 -7
  98. package/dist/migration-check-BfOnfgyY-DII6Ty5m.mjs.map +1 -0
  99. package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs → migration-check-DONPyXff-KpD0q3Zh.mjs} +4 -4
  100. package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs.map → migration-check-DONPyXff-KpD0q3Zh.mjs.map} +1 -1
  101. package/dist/{migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs → migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs} +24 -7
  102. package/dist/migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs.map +1 -0
  103. package/dist/{migration-graph-Dn469b0l.mjs → migration-graph-BHiSuhBR.mjs} +17 -8
  104. package/dist/migration-graph-BHiSuhBR.mjs.map +1 -0
  105. package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs → migration-graph-HKch1Xk4-DD-3zdSg.mjs} +2 -2
  106. package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map → migration-graph-HKch1Xk4-DD-3zdSg.mjs.map} +1 -1
  107. package/dist/{migration-list-jk4iCtmO.mjs → migration-list-BkTNEeOK.mjs} +16 -7
  108. package/dist/migration-list-BkTNEeOK.mjs.map +1 -0
  109. package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs → migration-list-C9OPCMt--BBm2c7tN.mjs} +2 -2
  110. package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs.map → migration-list-C9OPCMt--BBm2c7tN.mjs.map} +1 -1
  111. package/dist/{migration-log-DQzUBrm8-D3m9wcuf.mjs → migration-log-CqrwQXER-cqf2INDN.mjs} +17 -7
  112. package/dist/migration-log-CqrwQXER-cqf2INDN.mjs.map +1 -0
  113. package/dist/{migration-new-g98oB3nC-BcrkxAAt.mjs → migration-new-Cjhe_MIE-CIovsuXK.mjs} +17 -8
  114. package/dist/migration-new-Cjhe_MIE-CIovsuXK.mjs.map +1 -0
  115. package/dist/{migration-new-BkSY6m0t.mjs → migration-new-NuMfcbH8.mjs} +3 -3
  116. package/dist/{migration-new-BkSY6m0t.mjs.map → migration-new-NuMfcbH8.mjs.map} +1 -1
  117. package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs} +2 -2
  118. package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs.map} +1 -1
  119. package/dist/{migration-plan-CjIYMJZy.mjs → migration-plan-D81XmVwy.mjs} +3 -3
  120. package/dist/{migration-plan-CjIYMJZy.mjs.map → migration-plan-D81XmVwy.mjs.map} +1 -1
  121. package/dist/{migration-plan-CwuZLXVE-DAJ-JUQT.mjs → migration-plan-DE7-vtqT-jgtSH4Lw.mjs} +18 -9
  122. package/dist/migration-plan-DE7-vtqT-jgtSH4Lw.mjs.map +1 -0
  123. package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts → migration-plan-DvBJhxXg-B5aHAOtu.d.mts} +3 -3
  124. package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts.map → migration-plan-DvBJhxXg-B5aHAOtu.d.mts.map} +1 -1
  125. package/dist/{migration-show-CW6EKtfw.mjs → migration-show-DEsLJ6-a.mjs} +18 -8
  126. package/dist/migration-show-DEsLJ6-a.mjs.map +1 -0
  127. package/dist/{migration-status-DSQcBhiN.mjs → migration-status-DfLM3VqL.mjs} +21 -10
  128. package/dist/migration-status-DfLM3VqL.mjs.map +1 -0
  129. package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs → project-import-root-C_bd0ooL-CusfluWF.mjs} +2 -2
  130. package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs.map → project-import-root-C_bd0ooL-CusfluWF.mjs.map} +1 -1
  131. package/dist/{ref-DSAZime8.mjs → ref-D6JzE8nq.mjs} +3 -3
  132. package/dist/{ref-DSAZime8.mjs.map → ref-D6JzE8nq.mjs.map} +1 -1
  133. package/dist/{ref-eJjxzYTh-CNiyDL4p.mjs → ref-DrAvdDhN-q1ccuI03.mjs} +21 -10
  134. package/dist/ref-DrAvdDhN-q1ccuI03.mjs.map +1 -0
  135. package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs → ref-resolution-_S4xTT2L-JfNjZU9d.mjs} +2 -2
  136. package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map → ref-resolution-_S4xTT2L-JfNjZU9d.mjs.map} +1 -1
  137. package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs → telemetry-DVBHDQd6-CWNTFnMO.mjs} +2 -2
  138. package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs.map → telemetry-DVBHDQd6-CWNTFnMO.mjs.map} +1 -1
  139. package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs → verify-C6L_hiJU-MX67LFfI.mjs} +2 -2
  140. package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs.map → verify-C6L_hiJU-MX67LFfI.mjs.map} +1 -1
  141. package/dist/vite-plugin-contract-emit.mjs +5 -3
  142. package/dist/vite-plugin-contract-emit.mjs.map +1 -1
  143. package/package.json +13 -12
  144. package/dist/contract-emit-CTm2zfuG-7PV9SBY6.mjs.map +0 -1
  145. package/dist/contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map +0 -1
  146. package/dist/db-sign-DCb_DKtv.mjs.map +0 -1
  147. package/dist/db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map +0 -1
  148. package/dist/exports-BnihzVhw.mjs.map +0 -1
  149. package/dist/exports-CDX9kZuw.mjs +0 -119
  150. package/dist/exports-CDX9kZuw.mjs.map +0 -1
  151. package/dist/format-Bw3LVJ1v-BJ6lVFMA.mjs.map +0 -1
  152. package/dist/framework-components-3DdB31mk-BHyX-OlJ.mjs.map +0 -1
  153. package/dist/index-Df9igRvP.d.mts +0 -18
  154. package/dist/index-Df9igRvP.d.mts.map +0 -1
  155. package/dist/inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map +0 -1
  156. package/dist/migrate-B-NAuO90.mjs.map +0 -1
  157. package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +0 -1
  158. package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +0 -1
  159. package/dist/migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map +0 -1
  160. package/dist/migration-graph-Dn469b0l.mjs.map +0 -1
  161. package/dist/migration-list-jk4iCtmO.mjs.map +0 -1
  162. package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +0 -1
  163. package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +0 -1
  164. package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +0 -1
  165. package/dist/migration-show-CW6EKtfw.mjs.map +0 -1
  166. package/dist/migration-status-DSQcBhiN.mjs.map +0 -1
  167. package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +0 -1
@@ -2,15 +2,15 @@ import { t as MigrationToolsError } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
2
2
  import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs";
3
3
  import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
4
4
  import { r as findLatestMigration } from "./migration-graph-DDaOHo10-yJFAbKCu.mjs";
5
- import { E as errorRefSetHashNotInGraph, N as errorUnexpected, O as errorRuntime$1, T as errorRefSetEmptySentinel, Z as mapRefResolutionError, h as errorFileNotFound, it as resolveMigrationPaths, t as CliStructuredError$1, w as errorRefSetBundleNotFound } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
6
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
5
+ import { E as errorRefSetHashNotInGraph, N as errorUnexpected, O as errorRuntime$1, T as errorRefSetEmptySentinel, Z as mapRefResolutionError, h as errorFileNotFound, it as resolveMigrationPaths, t as CliStructuredError$1, w as errorRefSetBundleNotFound } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
6
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
7
7
  import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, u as validateRefValue } from "./refs-B2BL8z3i-DGGFB7Mj.mjs";
8
8
  import { n as isGraphNode } from "./graph-membership-BEmNEMtP-rz61CLM5.mjs";
9
- import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
9
+ import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
10
10
  import { n as parseContractRef } from "./ref-resolution-Ct2GMcNB.mjs";
11
11
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
12
12
  import { join } from "pathe";
13
- //#region ../../../1-framework/3-tooling/cli/dist/ref-eJjxzYTh.mjs
13
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-DrAvdDhN.mjs
14
14
  /**
15
15
  * Policy cores of the `ref set` / `ref delete` / `ref list` commands: load config, resolve the reference, and write or read the refs index.
16
16
  */
@@ -26,8 +26,17 @@ function cliErrorInvalidRefName(name) {
26
26
  }
27
27
  async function executeRefSetCommand(name, contractInput, options) {
28
28
  if (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));
29
+ const configResult = await loadConfigForSections(options.config, [
30
+ "family",
31
+ "target",
32
+ "adapter",
33
+ "extensions",
34
+ "migrations",
35
+ "contract"
36
+ ]);
37
+ if (!configResult.ok) return configResult;
38
+ const config = configResult.value;
29
39
  try {
30
- const config = await loadConfig(options.config);
31
40
  const { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);
32
41
  const loaded = await buildReadAggregate(config, { migrationsDir });
33
42
  if (!loaded.ok) return notOk(loaded.failure);
@@ -76,9 +85,10 @@ async function executeRefSetCommand(name, contractInput, options) {
76
85
  }
77
86
  }
78
87
  async function executeRefDeleteCommand(name, options) {
88
+ const configResult = await loadConfigForSections(options.config, ["migrations"]);
89
+ if (!configResult.ok) return configResult;
79
90
  try {
80
- const config = await loadConfig(options.config);
81
- const { refsDir } = resolveMigrationPaths(options.config, config);
91
+ const { refsDir } = resolveMigrationPaths(options.config, configResult.value);
82
92
  await deleteRef(refsDir, name);
83
93
  return ok({
84
94
  ok: true,
@@ -91,9 +101,10 @@ async function executeRefDeleteCommand(name, options) {
91
101
  }
92
102
  }
93
103
  async function executeRefListCommand(options) {
104
+ const configResult = await loadConfigForSections(options.config, ["migrations"]);
105
+ if (!configResult.ok) return configResult;
94
106
  try {
95
- const config = await loadConfig(options.config);
96
- const { refsDir } = resolveMigrationPaths(options.config, config);
107
+ const { refsDir } = resolveMigrationPaths(options.config, configResult.value);
97
108
  return ok({
98
109
  ok: true,
99
110
  refs: await readRefs(refsDir)
@@ -106,4 +117,4 @@ async function executeRefListCommand(options) {
106
117
  //#endregion
107
118
  export { executeRefListCommand as n, executeRefSetCommand as r, executeRefDeleteCommand as t };
108
119
 
109
- //# sourceMappingURL=ref-eJjxzYTh-CNiyDL4p.mjs.map
120
+ //# sourceMappingURL=ref-DrAvdDhN-q1ccuI03.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-DrAvdDhN-q1ccuI03.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-DrAvdDhN.mjs"],"sourcesContent":["import { $ as errorRefSetBundleNotFound, F as CliStructuredError, W as errorFileNotFound, ct as errorUnexpected, et as errorRefSetEmptySentinel, lt as mapRefResolutionError, rt as errorRuntime, s as resolveMigrationPaths, tt as errorRefSetHashNotInGraph } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join } from \"pathe\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { deleteRef, readRefs, validateRefName, validateRefValue, writeRef } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/ref.ts\n/**\n* Policy cores of the `ref set` / `ref delete` / `ref list` commands: load config, resolve the reference, and write or read the refs index.\n*/\nfunction mapError(error) {\n\tif (MigrationToolsError.is(error)) return error;\n\treturn errorUnexpected(error instanceof Error ? error.message : String(error));\n}\nfunction cliErrorInvalidRefName(name) {\n\treturn errorRuntime(\"MIGRATION.INVALID_REF_NAME\", `Invalid ref name \"${name}\"`, {\n\t\twhy: `Ref name \"${name}\" does not match the required format`,\n\t\tfix: \"Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments\"\n\t});\n}\nasync function executeRefSetCommand(name, contractInput, options) {\n\tif (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\ttry {\n\t\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\t\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tlet resolvedHash;\n\t\tif (validateRefValue(contractInput)) resolvedHash = contractInput;\n\t\telse {\n\t\t\tconst refResult = parseContractRef(contractInput, {\n\t\t\t\tgraph,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\t\tresolvedHash = refResult.value.hash;\n\t\t}\n\t\tif (resolvedHash === EMPTY_CONTRACT_HASH) return notOk(errorRefSetEmptySentinel(resolvedHash));\n\t\tif (!isGraphNode(resolvedHash, graph)) {\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\treturn notOk(errorRefSetHashNotInGraph(resolvedHash, [...graph.nodes].sort(), graphTip));\n\t\t}\n\t\tif (!bundles.find((bundle) => bundle.metadata.to === resolvedHash)) return notOk(errorRefSetBundleNotFound(resolvedHash));\n\t\tconst contractJsonPath = join(contractSnapshotDir(migrationsDir, resolvedHash), \"contract.json\");\n\t\ttry {\n\t\t\tawait readContractSnapshotJson(migrationsDir, resolvedHash);\n\t\t} catch (readError) {\n\t\t\tif (MigrationToolsError.is(readError) && readError.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return notOk(errorFileNotFound(contractJsonPath, {\n\t\t\t\twhy: `Migration bundle for hash ${resolvedHash} is missing its contract snapshot at ${contractJsonPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t\t}));\n\t\t\tthrow readError;\n\t\t}\n\t\tawait writeRef(refsDir, name, {\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefDeleteCommand(name, options) {\n\tconst configResult = await loadConfigForSections(options.config, [\"migrations\"]);\n\tif (!configResult.ok) return configResult;\n\ttry {\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, configResult.value);\n\t\tawait deleteRef(refsDir, name);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\tdeleted: true\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefListCommand(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\"migrations\"]);\n\tif (!configResult.ok) return configResult;\n\ttry {\n\t\tconst { refsDir } = resolveMigrationPaths(options.config, configResult.value);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\trefs: await readRefs(refsDir)\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\n//#endregion\nexport { executeRefListCommand as n, executeRefSetCommand as r, executeRefDeleteCommand as t };\n\n//# sourceMappingURL=ref-DrAvdDhN.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,SAAS,OAAO;CACxB,IAAI,oBAAoB,GAAG,KAAK,GAAG,OAAO;CAC1C,OAAO,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAC9E;AACA,SAAS,uBAAuB,MAAM;CACrC,OAAOA,eAAa,8BAA8B,qBAAqB,KAAK,IAAI;EAC/E,KAAK,aAAa,KAAK;EACvB,KAAK;CACN,CAAC;AACF;AACA,eAAe,qBAAqB,MAAM,eAAe,SAAS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+1,4 @@
1
- import { Z as mapRefResolutionError } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
1
+ import { Z as mapRefResolutionError } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
2
  import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-Ct2GMcNB.mjs";
3
3
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
4
4
  //#region ../../../1-framework/3-tooling/cli/dist/ref-resolution-_S4xTT2L.mjs
@@ -13,4 +13,4 @@ function resolveMigrationRef(input, context) {
13
13
  //#endregion
14
14
  export { resolveMigrationRef as n, resolveContractRef as t };
15
15
 
16
- //# sourceMappingURL=ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map
16
+ //# sourceMappingURL=ref-resolution-_S4xTT2L-JfNjZU9d.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-resolution-_S4xTT2L-BE5zgO2W.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-resolution-_S4xTT2L.mjs"],"sourcesContent":["import { lt as mapRefResolutionError } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { parseContractRef, parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/ref-resolution.ts\nfunction resolveContractRef(input, context) {\n\tconst result = parseContractRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\nfunction resolveMigrationRef(input, context) {\n\tconst result = parseMigrationRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\n//#endregion\nexport { resolveMigrationRef as n, resolveContractRef as t };\n\n//# sourceMappingURL=ref-resolution-_S4xTT2L.mjs.map"],"mappings":";;;;AAIA,SAAS,mBAAmB,OAAO,SAAS;CAC3C,MAAM,SAAS,iBAAiB,OAAO,OAAO;CAC9C,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,IAAI,MAAM,sBAAsB,OAAO,OAAO,CAAC;AAClF;AACA,SAAS,oBAAoB,OAAO,SAAS;CAC5C,MAAM,SAAS,kBAAkB,OAAO,OAAO;CAC/C,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,IAAI,MAAM,sBAAsB,OAAO,OAAO,CAAC;AAClF"}
1
+ {"version":3,"file":"ref-resolution-_S4xTT2L-JfNjZU9d.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-resolution-_S4xTT2L.mjs"],"sourcesContent":["import { lt as mapRefResolutionError } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { parseContractRef, parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/ref-resolution.ts\nfunction resolveContractRef(input, context) {\n\tconst result = parseContractRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\nfunction resolveMigrationRef(input, context) {\n\tconst result = parseMigrationRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\n//#endregion\nexport { resolveMigrationRef as n, resolveContractRef as t };\n\n//# sourceMappingURL=ref-resolution-_S4xTT2L.mjs.map"],"mappings":";;;;AAIA,SAAS,mBAAmB,OAAO,SAAS;CAC3C,MAAM,SAAS,iBAAiB,OAAO,OAAO;CAC9C,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,IAAI,MAAM,sBAAsB,OAAO,OAAO,CAAC;AAClF;AACA,SAAS,oBAAoB,OAAO,SAAS;CAC5C,MAAM,SAAS,kBAAkB,OAAO,OAAO;CAC/C,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,IAAI,MAAM,sBAAsB,OAAO,OAAO,CAAC;AAClF"}
@@ -1,4 +1,4 @@
1
- import { $ as parseGlobalFlags, P as formatCommandHelp, Y as isCI$1, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
1
+ import { $ as parseGlobalFlags, P as formatCommandHelp, Y as isCI$1, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
2
  import { a as resolveGating, d as writeUserConfig, i as readUserConfig, u as userConfigPath } from "./exports-BN0vFTxG.mjs";
3
3
  import { Command } from "commander";
4
4
  //#region ../../../1-framework/3-tooling/cli/dist/telemetry-DVBHDQd6.mjs
@@ -117,4 +117,4 @@ function createTelemetryCommand() {
117
117
  //#endregion
118
118
  export { createTelemetryCommand as t };
119
119
 
120
- //# sourceMappingURL=telemetry-DVBHDQd6-Ckn5oClN.mjs.map
120
+ //# sourceMappingURL=telemetry-DVBHDQd6-CWNTFnMO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-DVBHDQd6-Ckn5oClN.mjs","names":["isCI"],"sources":["../../../../1-framework/3-tooling/cli/dist/telemetry-DVBHDQd6.mjs"],"sourcesContent":["import { D as isCI, O as formatCommandHelp, _ as createTerminalUI, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { Command } from \"commander\";\nimport { readUserConfig, resolveGating, userConfigPath, writeUserConfig } from \"@internal/cli-telemetry\";\n//#region src/commands/telemetry/status.ts\n/**\n* Resolves the same gate the runtime uses (CI check + `resolveGating`) and\n* projects it into a user-facing status. Pure read: never mints, never\n* writes. The `installationId` value itself is never surfaced — only its\n* presence — so `status` discloses nothing identifying.\n*/\nfunction resolveTelemetryStatus(inputs) {\n\tconst config = readUserConfig();\n\tconst configPath = userConfigPath();\n\tconst installationIdStored = typeof config.installationId === \"string\" && config.installationId.length > 0;\n\tif (inputs.inCI) return {\n\t\tenabled: false,\n\t\treason: \"ci\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n\tconst gating = resolveGating({\n\t\tenv: inputs.env,\n\t\tconfig\n\t});\n\tif (!gating.enabled) return {\n\t\tenabled: false,\n\t\treason: gating.reason === \"env-override\" ? \"env-opt-out\" : \"stored-opt-out\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n\treturn {\n\t\tenabled: true,\n\t\treason: config.enableTelemetry === true ? \"stored-opt-in\" : \"default-on\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n}\nconst REASON_EXPLANATION = {\n\tci: \"CI environment detected — telemetry is hard-disabled.\",\n\t\"env-opt-out\": \"an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).\",\n\t\"stored-opt-out\": \"\\\"enableTelemetry\\\": false is stored in your config.\",\n\t\"stored-opt-in\": \"\\\"enableTelemetry\\\": true is stored in your config.\",\n\t\"default-on\": \"no explicit choice is stored, so the opt-out default applies.\"\n};\nfunction formatTelemetryStatusLines(status) {\n\treturn [\n\t\t`Telemetry is ${status.enabled ? \"enabled\" : \"disabled\"}: ${REASON_EXPLANATION[status.reason]}`,\n\t\t`Config file: ${status.configPath}`,\n\t\t`Installation ID: ${status.installationIdStored ? \"stored\" : \"not stored\"}`\n\t];\n}\n//#endregion\n//#region src/commands/telemetry/index.ts\nfunction createTelemetryStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show whether anonymous CLI telemetry is enabled and why\", \"Reports whether telemetry is currently enabled or disabled and the reason\\n(default-on, stored opt-out, environment opt-out, or CI), the path to your\\nuser-level config file, and whether an installation ID has been stored.\\nRead-only: never sends an event, never mints an ID, never writes anything.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst status = resolveTelemetryStatus({\n\t\t\tenv: process.env,\n\t\t\tinCI: isCI()\n\t\t});\n\t\tif (flags.json) ui.output(JSON.stringify(status));\n\t\telse for (const line of formatTelemetryStatusLines(status)) ui.output(line);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryEnableCommand() {\n\tconst command = new Command(\"enable\");\n\tsetCommandDescriptions(command, \"Enable anonymous CLI telemetry\", \"Stores \\\"enableTelemetry\\\": true in your user-level config and mints an\\ninstallation ID if one is not already stored.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\twriteUserConfig({ enableTelemetry: true });\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (flags.json) ui.output(JSON.stringify({\n\t\t\tenableTelemetry: true,\n\t\t\tconfigPath: userConfigPath()\n\t\t}));\n\t\telse ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryDisableCommand() {\n\tconst command = new Command(\"disable\");\n\tsetCommandDescriptions(command, \"Disable anonymous CLI telemetry\", \"Stores \\\"enableTelemetry\\\": false in your user-level config. No installation\\nID is minted and no event is sent.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\twriteUserConfig({ enableTelemetry: false });\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (flags.json) ui.output(JSON.stringify({\n\t\t\tenableTelemetry: false,\n\t\t\tconfigPath: userConfigPath()\n\t\t}));\n\t\telse ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryCommand() {\n\tconst command = new Command(\"telemetry\");\n\tsetCommandDescriptions(command, \"Inspect and change anonymous CLI telemetry\", \"Show telemetry status, or enable / disable anonymous CLI usage data.\\nTelemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\\nfor what is collected and why.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next telemetry status\",\n\t\t\"prisma-next telemetry disable\",\n\t\t\"prisma-next telemetry enable\"\n\t]);\n\tcommand.configureHelp({\n\t\tformatHelp: (cmd) => formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t}),\n\t\tsubcommandDescription: () => \"\"\n\t});\n\tcommand.addCommand(createTelemetryStatusCommand());\n\tcommand.addCommand(createTelemetryEnableCommand());\n\tcommand.addCommand(createTelemetryDisableCommand());\n\treturn command;\n}\n//#endregion\nexport { createTelemetryCommand as t };\n\n//# sourceMappingURL=telemetry-DVBHDQd6.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,uBAAuB,QAAQ;CACvC,MAAM,SAAS,eAAe;CAC9B,MAAM,aAAa,eAAe;CAClC,MAAM,uBAAuB,OAAO,OAAO,mBAAmB,YAAY,OAAO,eAAe,SAAS;CACzG,IAAI,OAAO,MAAM,OAAO;EACvB,SAAS;EACT,QAAQ;EACR;EACA;CACD;CACA,MAAM,SAAS,cAAc;EAC5B,KAAK,OAAO;EACZ;CACD,CAAC;CACD,IAAI,CAAC,OAAO,SAAS,OAAO;EAC3B,SAAS;EACT,QAAQ,OAAO,WAAW,iBAAiB,gBAAgB;EAC3D;EACA;CACD;CACA,OAAO;EACN,SAAS;EACT,QAAQ,OAAO,oBAAoB,OAAO,kBAAkB;EAC5D;EACA;CACD;AACD;AACA,MAAM,qBAAqB;CAC1B,IAAI;CACJ,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,cAAc;AACf;AACA,SAAS,2BAA2B,QAAQ;CAC3C,OAAO;EACN,gBAAgB,OAAO,UAAU,YAAY,WAAW,IAAI,mBAAmB,OAAO;EACtF,gBAAgB,OAAO;EACvB,oBAAoB,OAAO,uBAAuB,WAAW;CAC9D;AACD;AAGA,SAAS,+BAA+B;CACvC,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBAAuB,SAAS,2DAA2D,4SAA4S;CACvY,OAAO,iBAAiB,OAAO,CAAC,CAAC,QAAQ,YAAY;EACpD,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,SAAS,uBAAuB;GACrC,KAAK,QAAQ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Q,cAAc;EACrB,aAAa,QAAQ,kBAAkB;GACtC,SAAS;GACT,OAAO,iBAAiB,CAAC,CAAC;EAC3B,CAAC;EACD,6BAA6B;CAC9B,CAAC;CACD,QAAQ,WAAW,6BAA6B,CAAC;CACjD,QAAQ,WAAW,6BAA6B,CAAC;CACjD,QAAQ,WAAW,8BAA8B,CAAC;CAClD,OAAO;AACR"}
1
+ {"version":3,"file":"telemetry-DVBHDQd6-CWNTFnMO.mjs","names":["isCI"],"sources":["../../../../1-framework/3-tooling/cli/dist/telemetry-DVBHDQd6.mjs"],"sourcesContent":["import { D as isCI, O as formatCommandHelp, _ as createTerminalUI, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { Command } from \"commander\";\nimport { readUserConfig, resolveGating, userConfigPath, writeUserConfig } from \"@internal/cli-telemetry\";\n//#region src/commands/telemetry/status.ts\n/**\n* Resolves the same gate the runtime uses (CI check + `resolveGating`) and\n* projects it into a user-facing status. Pure read: never mints, never\n* writes. The `installationId` value itself is never surfaced — only its\n* presence — so `status` discloses nothing identifying.\n*/\nfunction resolveTelemetryStatus(inputs) {\n\tconst config = readUserConfig();\n\tconst configPath = userConfigPath();\n\tconst installationIdStored = typeof config.installationId === \"string\" && config.installationId.length > 0;\n\tif (inputs.inCI) return {\n\t\tenabled: false,\n\t\treason: \"ci\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n\tconst gating = resolveGating({\n\t\tenv: inputs.env,\n\t\tconfig\n\t});\n\tif (!gating.enabled) return {\n\t\tenabled: false,\n\t\treason: gating.reason === \"env-override\" ? \"env-opt-out\" : \"stored-opt-out\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n\treturn {\n\t\tenabled: true,\n\t\treason: config.enableTelemetry === true ? \"stored-opt-in\" : \"default-on\",\n\t\tconfigPath,\n\t\tinstallationIdStored\n\t};\n}\nconst REASON_EXPLANATION = {\n\tci: \"CI environment detected — telemetry is hard-disabled.\",\n\t\"env-opt-out\": \"an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).\",\n\t\"stored-opt-out\": \"\\\"enableTelemetry\\\": false is stored in your config.\",\n\t\"stored-opt-in\": \"\\\"enableTelemetry\\\": true is stored in your config.\",\n\t\"default-on\": \"no explicit choice is stored, so the opt-out default applies.\"\n};\nfunction formatTelemetryStatusLines(status) {\n\treturn [\n\t\t`Telemetry is ${status.enabled ? \"enabled\" : \"disabled\"}: ${REASON_EXPLANATION[status.reason]}`,\n\t\t`Config file: ${status.configPath}`,\n\t\t`Installation ID: ${status.installationIdStored ? \"stored\" : \"not stored\"}`\n\t];\n}\n//#endregion\n//#region src/commands/telemetry/index.ts\nfunction createTelemetryStatusCommand() {\n\tconst command = new Command(\"status\");\n\tsetCommandDescriptions(command, \"Show whether anonymous CLI telemetry is enabled and why\", \"Reports whether telemetry is currently enabled or disabled and the reason\\n(default-on, stored opt-out, environment opt-out, or CI), the path to your\\nuser-level config file, and whether an installation ID has been stored.\\nRead-only: never sends an event, never mints an ID, never writes anything.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst status = resolveTelemetryStatus({\n\t\t\tenv: process.env,\n\t\t\tinCI: isCI()\n\t\t});\n\t\tif (flags.json) ui.output(JSON.stringify(status));\n\t\telse for (const line of formatTelemetryStatusLines(status)) ui.output(line);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryEnableCommand() {\n\tconst command = new Command(\"enable\");\n\tsetCommandDescriptions(command, \"Enable anonymous CLI telemetry\", \"Stores \\\"enableTelemetry\\\": true in your user-level config and mints an\\ninstallation ID if one is not already stored.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\twriteUserConfig({ enableTelemetry: true });\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (flags.json) ui.output(JSON.stringify({\n\t\t\tenableTelemetry: true,\n\t\t\tconfigPath: userConfigPath()\n\t\t}));\n\t\telse ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryDisableCommand() {\n\tconst command = new Command(\"disable\");\n\tsetCommandDescriptions(command, \"Disable anonymous CLI telemetry\", \"Stores \\\"enableTelemetry\\\": false in your user-level config. No installation\\nID is minted and no event is sent.\");\n\treturn addGlobalOptions(command).action((options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\twriteUserConfig({ enableTelemetry: false });\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (flags.json) ui.output(JSON.stringify({\n\t\t\tenableTelemetry: false,\n\t\t\tconfigPath: userConfigPath()\n\t\t}));\n\t\telse ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);\n\t\tprocess.exit(0);\n\t});\n}\nfunction createTelemetryCommand() {\n\tconst command = new Command(\"telemetry\");\n\tsetCommandDescriptions(command, \"Inspect and change anonymous CLI telemetry\", \"Show telemetry status, or enable / disable anonymous CLI usage data.\\nTelemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\\nfor what is collected and why.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next telemetry status\",\n\t\t\"prisma-next telemetry disable\",\n\t\t\"prisma-next telemetry enable\"\n\t]);\n\tcommand.configureHelp({\n\t\tformatHelp: (cmd) => formatCommandHelp({\n\t\t\tcommand: cmd,\n\t\t\tflags: parseGlobalFlags({})\n\t\t}),\n\t\tsubcommandDescription: () => \"\"\n\t});\n\tcommand.addCommand(createTelemetryStatusCommand());\n\tcommand.addCommand(createTelemetryEnableCommand());\n\tcommand.addCommand(createTelemetryDisableCommand());\n\treturn command;\n}\n//#endregion\nexport { createTelemetryCommand as t };\n\n//# sourceMappingURL=telemetry-DVBHDQd6.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAA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atDim, X as isVerbose, a as createColorFormatter } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
1
+ import { F as formatDim, X as isVerbose, a as createColorFormatter } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { issueOutcome } from "@prisma/orm-framework/components/control";
4
4
  import { bold, cyan, dim, green, magenta, red, yellow } from "colorette";
@@ -280,4 +280,4 @@ function formatSignJson(result) {
280
280
  //#endregion
281
281
  export { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };
282
282
 
283
- //# sourceMappingURL=verify-C6L_hiJU-B4V3bqvG.mjs.map
283
+ //# sourceMappingURL=verify-C6L_hiJU-MX67LFfI.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"verify-C6L_hiJU-B4V3bqvG.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/verify-C6L_hiJU.mjs"],"sourcesContent":["import { M as createColorFormatter, N as formatDim, P as isVerbose } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { bold, cyan, dim, green, magenta, red, yellow } from \"colorette\";\n//#region src/utils/formatters/verify.ts\n/** Human-readable label for each outcome, prefixed onto an issue's message for display. */\nconst OUTCOME_LABEL = {\n\t\"not-found\": \"missing\",\n\t\"not-expected\": \"extra\",\n\t\"not-equal\": \"mismatch\"\n};\n/**\n* The issue's display text: its own path, prefixed with a human label for\n* why it's flagged. Turning the presence-derived outcome (and the path) into\n* prose is this formatter's job, not the differ's — the differ's issue is\n* data (`path` + nodes), not prose.\n*/\nfunction formatIssueMessage(issue) {\n\treturn `${OUTCOME_LABEL[issueOutcome(issue)]}: ${issue.path.join(\"/\")}`;\n}\n/**\n* Formats human-readable output for database verify.\n*/\nfunction formatVerifyOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst verificationMode = result.mode === \"full\" ? `marker + schema${result.schema?.strict ? \" (strict)\" : \" (tolerant)\"}` : \"marker only (--marker-only)\";\n\tlines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\tlines.push(`${formatDimText(` verification: ${verificationMode}`)}`);\n\tlines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);\n\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\tif (result.schema?.warnings && result.schema.warnings.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of result.schema.warnings) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (result.unclaimed && result.unclaimed.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of result.unclaimed) lines.push(` ${formatYellow(\"⚠\")} ${name}`);\n\t}\n\tif (result.warning) {\n\t\tlines.push(\"\");\n\t\tlines.push(`${formatYellow(\"⚠\")} ${result.warning}`);\n\t}\n\tif (isVerbose(flags, 1)) {\n\t\tif (result.codecCoverageSkipped) lines.push(`${formatDimText(\" Codec coverage check skipped (helper returned no supported types)\")}`);\n\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database verify.\n*/\nfunction formatVerifyJson(result) {\n\tconst output = {\n\t\tok: result.ok,\n\t\tsummary: result.summary,\n\t\tmode: result.mode,\n\t\tcontract: result.contract,\n\t\t...ifDefined(\"marker\", result.marker),\n\t\ttarget: result.target,\n\t\t...ifDefined(\"missingCodecs\", result.missingCodecs),\n\t\t...ifDefined(\"codecCoverageSkipped\", result.codecCoverageSkipped),\n\t\t...ifDefined(\"schema\", result.schema),\n\t\tunclaimed: result.unclaimed ?? [],\n\t\t...ifDefined(\"warning\", result.warning),\n\t\t...ifDefined(\"meta\", result.meta),\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n/**\n* Formats JSON output for database introspection.\n*/\nfunction formatIntrospectJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n/**\n* Renders a schema tree structure from CoreSchemaView.\n* Status-glyph tree styling shared with the retired verification-tree renderer.\n*/\nfunction renderSchemaTree(node, flags, options) {\n\tconst { isLast, prefix, useColor, formatDimText, isRoot = false } = options;\n\tconst lines = [];\n\tlet formattedLabel = node.label;\n\tif (useColor) switch (node.kind) {\n\t\tcase \"root\":\n\t\t\tformattedLabel = bold(node.label);\n\t\t\tbreak;\n\t\tcase \"entity\": {\n\t\t\tconst tableMatch = node.label.match(/^table\\s+(.+)$/);\n\t\t\tif (tableMatch?.[1]) {\n\t\t\t\tconst tableName = tableMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"table\")} ${cyan(tableName)}`;\n\t\t\t} else formattedLabel = cyan(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"collection\":\n\t\t\tformattedLabel = dim(node.label);\n\t\t\tbreak;\n\t\tcase \"field\": {\n\t\t\tconst columnMatch = node.label.match(/^([^:]+):\\s*(.+)$/);\n\t\t\tif (columnMatch?.[1] && columnMatch[2]) {\n\t\t\t\tconst columnName = columnMatch[1];\n\t\t\t\tconst rest = columnMatch[2];\n\t\t\t\tconst typeMatch = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n\t\t\t\tif (typeMatch?.[1] && typeMatch[2]) {\n\t\t\t\t\tconst typeDisplay = typeMatch[1];\n\t\t\t\t\tconst nullability = typeMatch[2];\n\t\t\t\t\tformattedLabel = `${cyan(columnName)}: ${typeDisplay} ${dim(nullability)}`;\n\t\t\t\t} else formattedLabel = `${cyan(columnName)}: ${rest}`;\n\t\t\t} else formattedLabel = node.label;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"index\": {\n\t\t\tconst pkMatch = node.label.match(/^primary key:\\s*(.+)$/);\n\t\t\tif (pkMatch?.[1]) {\n\t\t\t\tconst columnNames = pkMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"primary key\")}: ${cyan(columnNames)}`;\n\t\t\t} else {\n\t\t\t\tconst uniqueMatch = node.label.match(/^unique\\s+(.+)$/);\n\t\t\t\tif (uniqueMatch?.[1]) {\n\t\t\t\t\tconst name = uniqueMatch[1];\n\t\t\t\t\tformattedLabel = `${dim(\"unique\")} ${cyan(name)}`;\n\t\t\t\t} else {\n\t\t\t\t\tconst indexMatch = node.label.match(/^(unique\\s+)?index\\s+(.+)$/);\n\t\t\t\t\tif (indexMatch?.[2]) {\n\t\t\t\t\t\tconst indexPrefix = indexMatch[1] ? `${dim(\"unique\")} ` : \"\";\n\t\t\t\t\t\tconst name = indexMatch[2];\n\t\t\t\t\t\tformattedLabel = `${indexPrefix}${dim(\"index\")} ${cyan(name)}`;\n\t\t\t\t\t} else formattedLabel = dim(node.label);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"dependency\": {\n\t\t\tconst extMatch = node.label.match(/^([^\\s]+)\\s+(extension is enabled)$/);\n\t\t\tif (extMatch?.[1] && extMatch[2]) {\n\t\t\t\tconst extName = extMatch[1];\n\t\t\t\tconst rest = extMatch[2];\n\t\t\t\tformattedLabel = `${cyan(extName)} ${dim(rest)}`;\n\t\t\t} else formattedLabel = magenta(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tformattedLabel = node.label;\n\t\t\tbreak;\n\t}\n\tif (isRoot) lines.push(formattedLabel);\n\telse {\n\t\tconst treePrefix = `${formatDimText(isLast ? \"└\" : \"├\")}─ `;\n\t\tlines.push(`${prefix}${treePrefix}${formattedLabel}`);\n\t}\n\tif (node.children && node.children.length > 0) {\n\t\tconst childPrefix = isRoot ? \"\" : `${prefix}${isLast ? \" \" : `${formatDimText(\"│\")} `}`;\n\t\tfor (let i = 0; i < node.children.length; i++) {\n\t\t\tconst child = node.children[i];\n\t\t\tif (!child) continue;\n\t\t\tconst childLines = renderSchemaTree(child, flags, {\n\t\t\t\tisLast: i === node.children.length - 1,\n\t\t\t\tprefix: childPrefix,\n\t\t\t\tuseColor,\n\t\t\t\tformatDimText,\n\t\t\t\tisRoot: false\n\t\t\t});\n\t\t\tlines.push(...childLines);\n\t\t}\n\t}\n\treturn lines;\n}\n/**\n* Formats human-readable output for database introspection.\n*/\nfunction formatIntrospectOutput(result, schemaView, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (schemaView) {\n\t\tconst treeLines = renderSchemaTree(schemaView.root, flags, {\n\t\t\tisLast: true,\n\t\t\tprefix: \"\",\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\tisRoot: true\n\t\t});\n\t\tlines.push(...treeLines);\n\t} else {\n\t\tlines.push(`✔ ${result.summary}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tlines.push(` Target: ${result.target.familyId}/${result.target.id}`);\n\t\t\tif (result.meta?.dbUrl) lines.push(` Database: ${result.meta.dbUrl}`);\n\t\t}\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats human-readable output for database schema verification.\n*/\nfunction formatSchemaVerifyOutput(result, flags, unclaimed = []) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatRed = createColorFormatter(useColor, red);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst issueMessages = result.schema.issues.map(formatIssueMessage);\n\tif (issueMessages.length > 0) {\n\t\tlines.push(formatRed(\"Schema issues:\"));\n\t\tfor (const message of issueMessages) lines.push(` ${formatRed(\"✖\")} ${message}`);\n\t}\n\tconst warningMessages = (result.schema.warnings?.issues ?? []).map(formatIssueMessage);\n\tif (warningMessages.length > 0) {\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of warningMessages) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (unclaimed.length > 0) {\n\t\tconst strict = result.meta?.strict ?? false;\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push((strict ? formatRed : formatYellow)(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? \"✖\" : \"⚠\")} ${name}`);\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\tif (lines.length > 0) lines.push(\"\");\n\tif (result.ok) lines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\telse {\n\t\tconst codeText = result.code ? ` (${result.code})` : \"\";\n\t\tlines.push(`${formatRed(\"✖\")} ${result.summary}${codeText}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database schema verification. The unclaimed-elements\n* list is a top-level field alongside the combined result, reported once for\n* the whole database.\n*/\nfunction formatSchemaVerifyJson(result, unclaimed = []) {\n\treturn JSON.stringify({\n\t\t...result,\n\t\tunclaimed\n\t}, null, 2);\n}\n/**\n* Formats human-readable output for database sign.\n*/\nfunction formatSignOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (result.ok) {\n\t\tlines.push(`${formatGreen(\"✔\")} Database signed`);\n\t\tconst previousHash = result.marker.previous?.storageHash ?? \"none\";\n\t\tconst currentHash = result.contract.storageHash;\n\t\tlines.push(`${formatDimText(` from: ${previousHash}`)}`);\n\t\tlines.push(`${formatDimText(` to: ${currentHash}`)}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\t\t\tif (result.marker.previous?.profileHash) lines.push(`${formatDimText(` previous profileHash: ${result.marker.previous.profileHash}`)}`);\n\t\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database sign.\n*/\nfunction formatSignJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n//#endregion\nexport { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };\n\n//# sourceMappingURL=verify-C6L_hiJU.mjs.map"],"mappings":";;;;;;AAMA,MAAM,gBAAgB;CACrB,aAAa;CACb,gBAAgB;CAChB,aAAa;AACd;;;;;;;AAOA,SAAS,mBAAmB,OAAO;CAClC,OAAO,GAAG,cAAc,aAAa,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,GAAG;AACrE;;;;AAIA,SAAS,mBAAmB,QAAQ,OAAO;CAC1C,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,CAAC;CACf,MAAM,WAAW,MAAM,UAAU;CACjC,MAAM,cAAc,qBAAqB,UAAU,KAAK;CACxD,MAAM,eAAe,qBAAqB,UAAU,MAAM;CAC1D,MAAM,iBAAiB,SAAS,UAAU,UAAU,IAAI;CACxD,MAAM,mBAAmB,OAAO,SAAS,SAAS,kBAAkB,OAAO,QAAQ,SAAS,cAAc,kBAAkB;CAC5H,MAAM,KAAK,GAAG,YAAY,GAAG,EAAE,GAAG,OAAO,SAAS;CAClD,MAAM,KAAK,G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X;;;;AAIA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,CAAC;CACf,MAAM,WAAW,MAAM,UAAU;CACjC,MAAM,cAAc,qBAAqB,UAAU,KAAK;CACxD,MAAM,iBAAiB,SAAS,UAAU,UAAU,IAAI;CACxD,IAAI,OAAO,IAAI;EACd,MAAM,KAAK,GAAG,YAAY,GAAG,EAAE,iBAAiB;EAChD,MAAM,eAAe,OAAO,OAAO,UAAU,eAAe;EAC5D,MAAM,cAAc,OAAO,SAAS;EACpC,MAAM,KAAK,GAAG,cAAc,WAAW,cAAc,GAAG;EACxD,MAAM,KAAK,GAAG,cAAc,WAAW,aAAa,GAAG;EACvD,IAAI,UAAU,OAAO,CAAC,GAAG;GACxB,IAAI,OAAO,SAAS,aAAa,MAAM,KAAK,GAAG,cAAc,kBAAkB,OAAO,SAAS,aAAa,GAAG;GAC/G,IAAI,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,GAAG,cAAc,2BAA2B,OAAO,OAAO,SAAS,aAAa,GAAG;GACvI,MAAM,KAAK,GAAG,cAAc,iBAAiB,OAAO,QAAQ,MAAM,GAAG,GAAG;EACzE;CACD;CACA,OAAO,MAAM,KAAK,IAAI;AACvB;;;;AAIA,SAAS,eAAe,QAAQ;CAC/B,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACtC"}
1
+ {"version":3,"file":"verify-C6L_hiJU-MX67LFfI.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/verify-C6L_hiJU.mjs"],"sourcesContent":["import { M as createColorFormatter, N as formatDim, P as isVerbose } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { bold, cyan, dim, green, magenta, red, yellow } from \"colorette\";\n//#region src/utils/formatters/verify.ts\n/** Human-readable label for each outcome, prefixed onto an issue's message for display. */\nconst OUTCOME_LABEL = {\n\t\"not-found\": \"missing\",\n\t\"not-expected\": \"extra\",\n\t\"not-equal\": \"mismatch\"\n};\n/**\n* The issue's display text: its own path, prefixed with a human label for\n* why it's flagged. Turning the presence-derived outcome (and the path) into\n* prose is this formatter's job, not the differ's — the differ's issue is\n* data (`path` + nodes), not prose.\n*/\nfunction formatIssueMessage(issue) {\n\treturn `${OUTCOME_LABEL[issueOutcome(issue)]}: ${issue.path.join(\"/\")}`;\n}\n/**\n* Formats human-readable output for database verify.\n*/\nfunction formatVerifyOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst verificationMode = result.mode === \"full\" ? `marker + schema${result.schema?.strict ? \" (strict)\" : \" (tolerant)\"}` : \"marker only (--marker-only)\";\n\tlines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\tlines.push(`${formatDimText(` verification: ${verificationMode}`)}`);\n\tlines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);\n\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\tif (result.schema?.warnings && result.schema.warnings.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of result.schema.warnings) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (result.unclaimed && result.unclaimed.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of result.unclaimed) lines.push(` ${formatYellow(\"⚠\")} ${name}`);\n\t}\n\tif (result.warning) {\n\t\tlines.push(\"\");\n\t\tlines.push(`${formatYellow(\"⚠\")} ${result.warning}`);\n\t}\n\tif (isVerbose(flags, 1)) {\n\t\tif (result.codecCoverageSkipped) lines.push(`${formatDimText(\" Codec coverage check skipped (helper returned no supported types)\")}`);\n\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database verify.\n*/\nfunction formatVerifyJson(result) {\n\tconst output = {\n\t\tok: result.ok,\n\t\tsummary: result.summary,\n\t\tmode: result.mode,\n\t\tcontract: result.contract,\n\t\t...ifDefined(\"marker\", result.marker),\n\t\ttarget: result.target,\n\t\t...ifDefined(\"missingCodecs\", result.missingCodecs),\n\t\t...ifDefined(\"codecCoverageSkipped\", result.codecCoverageSkipped),\n\t\t...ifDefined(\"schema\", result.schema),\n\t\tunclaimed: result.unclaimed ?? [],\n\t\t...ifDefined(\"warning\", result.warning),\n\t\t...ifDefined(\"meta\", result.meta),\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n/**\n* Formats JSON output for database introspection.\n*/\nfunction formatIntrospectJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n/**\n* Renders a schema tree structure from CoreSchemaView.\n* Status-glyph tree styling shared with the retired verification-tree renderer.\n*/\nfunction renderSchemaTree(node, flags, options) {\n\tconst { isLast, prefix, useColor, formatDimText, isRoot = false } = options;\n\tconst lines = [];\n\tlet formattedLabel = node.label;\n\tif (useColor) switch (node.kind) {\n\t\tcase \"root\":\n\t\t\tformattedLabel = bold(node.label);\n\t\t\tbreak;\n\t\tcase \"entity\": {\n\t\t\tconst tableMatch = node.label.match(/^table\\s+(.+)$/);\n\t\t\tif (tableMatch?.[1]) {\n\t\t\t\tconst tableName = tableMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"table\")} ${cyan(tableName)}`;\n\t\t\t} else formattedLabel = cyan(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"collection\":\n\t\t\tformattedLabel = dim(node.label);\n\t\t\tbreak;\n\t\tcase \"field\": {\n\t\t\tconst columnMatch = node.label.match(/^([^:]+):\\s*(.+)$/);\n\t\t\tif (columnMatch?.[1] && columnMatch[2]) {\n\t\t\t\tconst columnName = columnMatch[1];\n\t\t\t\tconst rest = columnMatch[2];\n\t\t\t\tconst typeMatch = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n\t\t\t\tif (typeMatch?.[1] && typeMatch[2]) {\n\t\t\t\t\tconst typeDisplay = typeMatch[1];\n\t\t\t\t\tconst nullability = typeMatch[2];\n\t\t\t\t\tformattedLabel = `${cyan(columnName)}: ${typeDisplay} ${dim(nullability)}`;\n\t\t\t\t} else formattedLabel = `${cyan(columnName)}: ${rest}`;\n\t\t\t} else formattedLabel = node.label;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"index\": {\n\t\t\tconst pkMatch = node.label.match(/^primary key:\\s*(.+)$/);\n\t\t\tif (pkMatch?.[1]) {\n\t\t\t\tconst columnNames = pkMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"primary key\")}: ${cyan(columnNames)}`;\n\t\t\t} else {\n\t\t\t\tconst uniqueMatch = node.label.match(/^unique\\s+(.+)$/);\n\t\t\t\tif (uniqueMatch?.[1]) {\n\t\t\t\t\tconst name = uniqueMatch[1];\n\t\t\t\t\tformattedLabel = `${dim(\"unique\")} ${cyan(name)}`;\n\t\t\t\t} else {\n\t\t\t\t\tconst indexMatch = node.label.match(/^(unique\\s+)?index\\s+(.+)$/);\n\t\t\t\t\tif (indexMatch?.[2]) {\n\t\t\t\t\t\tconst indexPrefix = indexMatch[1] ? `${dim(\"unique\")} ` : \"\";\n\t\t\t\t\t\tconst name = indexMatch[2];\n\t\t\t\t\t\tformattedLabel = `${indexPrefix}${dim(\"index\")} ${cyan(name)}`;\n\t\t\t\t\t} else formattedLabel = dim(node.label);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"dependency\": {\n\t\t\tconst extMatch = node.label.match(/^([^\\s]+)\\s+(extension is enabled)$/);\n\t\t\tif (extMatch?.[1] && extMatch[2]) {\n\t\t\t\tconst extName = extMatch[1];\n\t\t\t\tconst rest = extMatch[2];\n\t\t\t\tformattedLabel = `${cyan(extName)} ${dim(rest)}`;\n\t\t\t} else formattedLabel = magenta(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tformattedLabel = node.label;\n\t\t\tbreak;\n\t}\n\tif (isRoot) lines.push(formattedLabel);\n\telse {\n\t\tconst treePrefix = `${formatDimText(isLast ? \"└\" : \"├\")}─ `;\n\t\tlines.push(`${prefix}${treePrefix}${formattedLabel}`);\n\t}\n\tif (node.children && node.children.length > 0) {\n\t\tconst childPrefix = isRoot ? \"\" : `${prefix}${isLast ? \" \" : `${formatDimText(\"│\")} `}`;\n\t\tfor (let i = 0; i < node.children.length; i++) {\n\t\t\tconst child = node.children[i];\n\t\t\tif (!child) continue;\n\t\t\tconst childLines = renderSchemaTree(child, flags, {\n\t\t\t\tisLast: i === node.children.length - 1,\n\t\t\t\tprefix: childPrefix,\n\t\t\t\tuseColor,\n\t\t\t\tformatDimText,\n\t\t\t\tisRoot: false\n\t\t\t});\n\t\t\tlines.push(...childLines);\n\t\t}\n\t}\n\treturn lines;\n}\n/**\n* Formats human-readable output for database introspection.\n*/\nfunction formatIntrospectOutput(result, schemaView, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (schemaView) {\n\t\tconst treeLines = renderSchemaTree(schemaView.root, flags, {\n\t\t\tisLast: true,\n\t\t\tprefix: \"\",\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\tisRoot: true\n\t\t});\n\t\tlines.push(...treeLines);\n\t} else {\n\t\tlines.push(`✔ ${result.summary}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tlines.push(` Target: ${result.target.familyId}/${result.target.id}`);\n\t\t\tif (result.meta?.dbUrl) lines.push(` Database: ${result.meta.dbUrl}`);\n\t\t}\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats human-readable output for database schema verification.\n*/\nfunction formatSchemaVerifyOutput(result, flags, unclaimed = []) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatRed = createColorFormatter(useColor, red);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst issueMessages = result.schema.issues.map(formatIssueMessage);\n\tif (issueMessages.length > 0) {\n\t\tlines.push(formatRed(\"Schema issues:\"));\n\t\tfor (const message of issueMessages) lines.push(` ${formatRed(\"✖\")} ${message}`);\n\t}\n\tconst warningMessages = (result.schema.warnings?.issues ?? []).map(formatIssueMessage);\n\tif (warningMessages.length > 0) {\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of warningMessages) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (unclaimed.length > 0) {\n\t\tconst strict = result.meta?.strict ?? false;\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push((strict ? formatRed : formatYellow)(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? \"✖\" : \"⚠\")} ${name}`);\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\tif (lines.length > 0) lines.push(\"\");\n\tif (result.ok) lines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\telse {\n\t\tconst codeText = result.code ? ` (${result.code})` : \"\";\n\t\tlines.push(`${formatRed(\"✖\")} ${result.summary}${codeText}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database schema verification. The unclaimed-elements\n* list is a top-level field alongside the combined result, reported once for\n* the whole database.\n*/\nfunction formatSchemaVerifyJson(result, unclaimed = []) {\n\treturn JSON.stringify({\n\t\t...result,\n\t\tunclaimed\n\t}, null, 2);\n}\n/**\n* Formats human-readable output for database sign.\n*/\nfunction formatSignOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (result.ok) {\n\t\tlines.push(`${formatGreen(\"✔\")} Database signed`);\n\t\tconst previousHash = result.marker.previous?.storageHash ?? \"none\";\n\t\tconst currentHash = result.contract.storageHash;\n\t\tlines.push(`${formatDimText(` from: ${previousHash}`)}`);\n\t\tlines.push(`${formatDimText(` to: ${currentHash}`)}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\t\t\tif (result.marker.previous?.profileHash) lines.push(`${formatDimText(` previous profileHash: ${result.marker.previous.profileHash}`)}`);\n\t\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database sign.\n*/\nfunction formatSignJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n//#endregion\nexport { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };\n\n//# sourceMappingURL=verify-C6L_hiJU.mjs.map"],"mappings":";;;;;;AAMA,MAAM,gBAAgB;CACrB,aAAa;CACb,gBAAgB;CAChB,aAAa;AACd;;;;;;;AAOA,SAAS,mBAAmB,OAAO;CAClC,OAAO,GAAG,cAAc,aAAa,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,GAAG;AACrE;;;;AAIA,SAAS,mBAAmB,QAAQ,OAAO;CAC1C,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,C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ContractEmit } from "./contract-emit-CTm2zfuG-7PV9SBY6.mjs";
1
+ import { n as disposeEmitQueue, r as executeContractEmit } from "./contract-emit-DT0JKUZT-BYE7WZPc.mjs";
2
2
  import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-okAfZydo.mjs";
3
- import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
3
+ import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
4
4
  import { extname, resolve } from "pathe";
5
5
  //#region ../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs
6
6
  const PLUGIN_NAME = "prisma-vite-plugin-contract-emit";
@@ -193,7 +193,9 @@ function prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {
193
193
  const previousIgnoredOutputFiles = new Set(ignoredOutputFiles);
194
194
  ignoredOutputFiles.clear();
195
195
  try {
196
- const config = await loadConfig(absoluteConfigPath);
196
+ const configResult = await loadConfigForSections(absoluteConfigPath, ["contract"]);
197
+ if (!configResult.ok) throw configResult.failure;
198
+ const config = configResult.value;
197
199
  didWarnConfigWatchFallback = false;
198
200
  const contract = config.contract;
199
201
  if (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma-next.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma Next contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma-next.config.ts (relative or absolute). Defaults to 'prisma-next.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma-next.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst config = await loadConfig(absoluteConfigPath);\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma Next config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BD,SAAS,iBAAiB,aAAa,qBAAqB,SAAS;CACpE,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,WAAW,SAAS,YAAY;CACtC,IAAI;CACJ,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,uCAAuC,IAAI,IAAI;CACrD,IAAI,gBAAgB;CACpB,IAAI,2BAA2B,IAAI,gBAAgB;CACnD,IAAI,SAAS;CACb,IAAI,iBAAiB;CACrB,IAAI,gBAAgB;CACpB,IAAI,oCAAoC;CACxC,IAAI,6BAA6B;CACjC,SAAS,IAAI,SAAS,QAAQ,QAAQ;EACrC,IAAI,aAAa,UAAU;EAC3B,IAAI,UAAU,WAAW,aA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QAAQ,cAAc,WAAW,QAAQ,IAAI,IAAI;GAC5D,IAAI,aAAa,SAAS,GAAG;IAC5B,MAAM,eAAe,gDAAgD,mBAAmB;IACxF,SAAS,YAAY;IACrB,WAAW,GAAG,KAAK;KAClB,MAAM;KACN,KAAK;MACJ,SAAS,iBAAiB;MAC1B,OAAO;MACP,QAAQ;KACT;IACD,CAAC;GACF,OAAO;IACN,IAAI,YAAY,aAAa,KAAK,SAAS,OAAO;IAClD,IAAI,aAAa,SAAS,KAAK,MAAM,QAAQ,cAAc,IAAI,KAAK,QAAQ,OAAO;GACpF;GACA,MAAM,YAAY,EAAE,qBAAqB,MAAM,CAAC;EACjD;EACA,gBAAgB,KAAK;GACpB,wBAAwB,IAAI,IAAI;EACjC;CACD;AACD"}
1
+ {"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma-next.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma Next contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma-next.config.ts (relative or absolute). Defaults to 'prisma-next.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma-next.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\"contract\"]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst config = configResult.value;\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma Next config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BD,SAAS,iBAAiB,aAAa,qBAAqB,SAAS;CACpE,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,WAAW,SAAS,YAAY;CACtC,IAAI;CACJ,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,uCAAuC,IAAI,IAAI;CACrD,IAAI,gBAAgB;CACpB,IAAI,2BAA2B,IAAI,gBAAgB;CACnD,IAAI,SAAS;CACb,IAAI,iBAAiB;CACrB,IAAI,gBAAgB;CACpB,IAAI,oCAAoC;CACxC,IAAI,6BAA6B;CACjC,SAAS,IAAI,SAAS,QAAQ,QAAQ;EACrC,IAAI,aAAa,UAAU;EAC3B,IAAI,UAAU,WAAW,aAAa,SAAS;EAC/C,QAAQ,IAAI,IAAI,YAAY,IAAI,SAAS;CAC1C;CACA,SAAS,SAAS,SAAS,OAAO;EACjC,IAAI,aAAa,UAAU;EAC3B,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,QAAQ,OAAO,KAAK,IAAI;EACtF,QA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ACxF,SAAS,YAAY;IACrB,WAAW,GAAG,KAAK;KAClB,MAAM;KACN,KAAK;MACJ,SAAS,iBAAiB;MAC1B,OAAO;MACP,QAAQ;KACT;IACD,CAAC;GACF,OAAO;IACN,IAAI,YAAY,aAAa,KAAK,SAAS,OAAO;IAClD,IAAI,aAAa,SAAS,KAAK,MAAM,QAAQ,cAAc,IAAI,KAAK,QAAQ,OAAO;GACpF;GACA,MAAM,YAAY,EAAE,qBAAqB,MAAM,CAAC;EACjD;EACA,gBAAgB,KAAK;GACpB,wBAAwB,IAAI,IAAI;EACjC;CACD;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-toolchain",
3
- "version": "8.0.0-rc.1-dev.21",
3
+ "version": "8.0.0-rc.1-dev.23",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@clack/prompts": "^1.7.0",
16
- "@prisma/orm-framework": "8.0.0-rc.1-dev.21",
16
+ "@prisma/orm-framework": "8.0.0-rc.1-dev.23",
17
17
  "@vercel/detect-agent": "^1.2.4",
18
18
  "arktype": "^2.2.2",
19
19
  "c12": "^3.3.4",
@@ -34,16 +34,16 @@
34
34
  "wrap-ansi": "^10.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@internal/cli": "8.0.0-rc.1-dev.21",
38
- "@internal/cli-telemetry": "8.0.0-rc.1-dev.21",
39
- "@internal/config-loader": "8.0.0-rc.1-dev.21",
40
- "@internal/emitter": "8.0.0-rc.1-dev.21",
41
- "@internal/language-server": "8.0.0-rc.1-dev.21",
42
- "@internal/migration-tools": "8.0.0-rc.1-dev.21",
43
- "@internal/publish-surface": "8.0.0-rc.1-dev.21",
44
- "@repo/tsconfig": "8.0.0-rc.1-dev.21",
45
- "@repo/tsdown": "8.0.0-rc.1-dev.21",
46
- "@internal/vite-plugin-contract-emit": "8.0.0-rc.1-dev.21",
37
+ "@internal/cli": "8.0.0-rc.1-dev.23",
38
+ "@internal/cli-telemetry": "8.0.0-rc.1-dev.23",
39
+ "@internal/config-loader": "8.0.0-rc.1-dev.23",
40
+ "@internal/emitter": "8.0.0-rc.1-dev.23",
41
+ "@internal/language-server": "8.0.0-rc.1-dev.23",
42
+ "@internal/migration-tools": "8.0.0-rc.1-dev.23",
43
+ "@internal/publish-surface": "8.0.0-rc.1-dev.23",
44
+ "@repo/tsconfig": "8.0.0-rc.1-dev.23",
45
+ "@repo/tsdown": "8.0.0-rc.1-dev.23",
46
+ "@internal/vite-plugin-contract-emit": "8.0.0-rc.1-dev.23",
47
47
  "tsdown": "0.22.14",
48
48
  "typescript": "5.9.3"
49
49
  },
@@ -82,6 +82,7 @@
82
82
  "./cli/commands/telemetry": "./dist/cli__commands__telemetry.mjs",
83
83
  "./cli/config-types": "./dist/cli__config-types.mjs",
84
84
  "./cli/control-api": "./dist/cli__control-api.mjs",
85
+ "./cli/control-api/testing": "./dist/cli__control-api__testing.mjs",
85
86
  "./cli/init-output": "./dist/cli__init-output.mjs",
86
87
  "./cli/migration-cli": "./dist/cli__migration-cli.mjs",
87
88
  "./cli-telemetry": "./dist/cli-telemetry.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract-emit-CTm2zfuG-7PV9SBY6.mjs","names":["errorRuntime","errorContractConfigMissing"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-CTm2zfuG.mjs"],"sourcesContent":["import { rt as errorRuntime, z as errorContractConfigMissing } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-3DdB31mk.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-C_bd0ooL.mjs\";\nimport { t as enrichContract } from \"./contract-enrichment-DrMvvY2A.mjs\";\nimport { createRequire } from \"node:module\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { emit, getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join } from \"pathe\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { abortable } from \"@internal/utils/abortable\";\n//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\n//#region src/utils/emit-queue.ts\n/**\n* Per-output FIFO queue for `executeContractEmit`.\n*\n* Ensures that at most one emit (load → resolve source → emit bytes → publish)\n* runs per output JSON path at a time. Concurrent calls for the same path\n* line up behind the in-flight one and run in submission order; the user-visible\n* outcome is \"last submission wins on disk\" without any supersession bookkeeping.\n*\n* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`\n* when they stop publishing to a path, otherwise the module-global `Map`\n* accumulates one entry per unique output path for the lifetime of the process.\n*/\nconst emitQueues = /* @__PURE__ */ new Map();\nfunction queueEmitByOutput(outputJsonPath, action) {\n\tconst next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);\n\temitQueues.set(outputJsonPath, next);\n\treturn next;\n}\nfunction disposeEmitQueue(outputJsonPath) {\n\temitQueues.delete(outputJsonPath);\n}\n//#endregion\n//#region src/utils/publish-contract-artifact-pair.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction createTempArtifactPath(path, publicationToken, phase) {\n\treturn join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);\n}\nasync function readExistingArtifact(path) {\n\ttry {\n\t\treturn { content: await readFile(path, \"utf-8\") };\n\t} catch (error) {\n\t\tif (isRecord$1(error) && error[\"code\"] === \"ENOENT\") return \"remove\";\n\t\tthrow error;\n\t}\n}\nasync function restoreArtifact(path, previous, publicationToken) {\n\tif (previous === \"remove\") {\n\t\tawait rm(path, { force: true });\n\t\treturn;\n\t}\n\tconst restorePath = createTempArtifactPath(path, publicationToken, \"rollback\");\n\tawait writeFile(restorePath, previous.content, \"utf-8\");\n\ttry {\n\t\tawait rename(restorePath, path);\n\t} finally {\n\t\tawait rm(restorePath, { force: true });\n\t}\n}\nfunction withRollbackFailureCause(error, rollbackFailures) {\n\tconst rollbackCause = new AggregateError(rollbackFailures, \"Failed to restore published artifacts\");\n\tif (error instanceof Error) {\n\t\tObject.defineProperty(error, \"cause\", {\n\t\t\tvalue: rollbackCause,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t\treturn error;\n\t}\n\treturn new Error(String(error), { cause: rollbackCause });\n}\nasync function publishPairWithRollback(entries, publicationToken) {\n\tconst replaced = [];\n\ttry {\n\t\tfor (const entry of entries) {\n\t\t\tawait rename(entry.tempPath, entry.outputPath);\n\t\t\treplaced.push(entry);\n\t\t}\n\t} catch (error) {\n\t\tconst rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === \"rejected\" ? [result.reason] : []);\n\t\tif (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);\n\t\tthrow error;\n\t}\n}\nasync function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {\n\tconst tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, \"next\");\n\tconst tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, \"next\");\n\ttry {\n\t\tawait writeFile(tempJsonPath, contractJson, \"utf-8\");\n\t\tawait writeFile(tempDtsPath, contractDts, \"utf-8\");\n\t\tif (await beforePublish?.() === false) return false;\n\t\tconst previousJson = await readExistingArtifact(outputJsonPath);\n\t\tawait publishPairWithRollback([{\n\t\t\ttempPath: tempDtsPath,\n\t\t\toutputPath: outputDtsPath,\n\t\t\tprevious: await readExistingArtifact(outputDtsPath)\n\t\t}, {\n\t\t\ttempPath: tempJsonPath,\n\t\t\toutputPath: outputJsonPath,\n\t\t\tprevious: previousJson\n\t\t}], publicationToken);\n\t\treturn true;\n\t} finally {\n\t\tawait Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);\n\t}\n}\n//#endregion\n//#region src/utils/validate-contract-deps.ts\nconst IMPORT_PATTERN = /import\\s+type\\s+.*?\\s+from\\s+['\"](@[^/]+\\/[^/'\"]+)/g;\nfunction extractPackageSpecifiers(dtsContent) {\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const match of dtsContent.matchAll(IMPORT_PATTERN)) {\n\t\tconst pkg = match[1];\n\t\tif (pkg) packages.add(pkg);\n\t}\n\treturn [...packages];\n}\nfunction validateContractDeps(dtsContent, projectRoot) {\n\tconst packages = extractPackageSpecifiers(dtsContent);\n\tconst resolve = createRequire(`${projectRoot}/package.json`);\n\tconst missing = [];\n\tfor (const pkg of packages) try {\n\t\tresolve.resolve(`${pkg}/package.json`);\n\t} catch {\n\t\tmissing.push(pkg);\n\t}\n\tif (missing.length === 0) return { missing };\n\treturn {\n\t\tmissing,\n\t\twarning: [\n\t\t\t\"contract.d.ts imports types from packages that are not installed:\",\n\t\t\tmissing.map((p) => ` - ${p}`).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"Install them with your package manager:\",\n\t\t\t...missing.map((p) => ` ${p}`)\n\t\t].join(\"\\n\")\n\t};\n}\n//#endregion\n//#region src/control-api/operations/contract-emit.ts\nvar contract_emit_exports = /* @__PURE__ */ __exportAll({ executeContractEmit: () => executeContractEmit });\nconst EMIT_ACTION = \"emit\";\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction startSpan(onProgress, spanId, label) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanStart\",\n\t\tspanId,\n\t\tlabel\n\t});\n}\nfunction endSpan(onProgress, spanId, outcome) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanEnd\",\n\t\tspanId,\n\t\toutcome\n\t});\n}\nfunction failedToResolveContractSource(why, fix, meta, cause) {\n\treturn errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to resolve contract source\", {\n\t\twhy,\n\t\tfix,\n\t\t...ifDefined(\"meta\", meta),\n\t\t...ifDefined(\"cause\", cause)\n\t});\n}\nfunction diagnosticLocationSuffix(diagnostic) {\n\tconst sourceId = typeof diagnostic[\"sourceId\"] === \"string\" ? diagnostic[\"sourceId\"] : void 0;\n\tconst span = isRecord(diagnostic[\"span\"]) ? diagnostic[\"span\"] : void 0;\n\tconst start = span && isRecord(span[\"start\"]) ? span[\"start\"] : void 0;\n\tconst line = start && typeof start[\"line\"] === \"number\" ? start[\"line\"] : void 0;\n\tconst column = start && typeof start[\"column\"] === \"number\" ? start[\"column\"] : void 0;\n\tif (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;\n\tif (sourceId) return ` (${sourceId})`;\n\treturn \"\";\n}\nfunction mapDiagnosticsToIssues(diagnostics) {\n\tconst issues = [];\n\tfor (const raw of diagnostics) {\n\t\tif (!isRecord(raw)) continue;\n\t\tconst code = typeof raw[\"code\"] === \"string\" ? raw[\"code\"] : \"diagnostic\";\n\t\tconst message = typeof raw[\"message\"] === \"string\" ? raw[\"message\"] : \"\";\n\t\tissues.push({\n\t\t\tkind: code,\n\t\t\tmessage: `${message}${diagnosticLocationSuffix(raw)}`\n\t\t});\n\t}\n\treturn issues;\n}\nfunction validateProviderResult(providerResult) {\n\tif (!isRecord(providerResult) || typeof providerResult[\"ok\"] !== \"boolean\") return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed result shape.\", \"Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).\")\n\t};\n\tif (providerResult[\"ok\"]) {\n\t\tif (!(\"value\" in providerResult)) return {\n\t\t\tok: false,\n\t\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed success result: missing value.\", \"Ensure contract.source.load success payload is ok(Contract).\")\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalue: providerResult[\"value\"]\n\t\t};\n\t}\n\tconst failure = providerResult[\"failure\"];\n\tif (!isRecord(failure) || typeof failure[\"summary\"] !== \"string\" || !Array.isArray(failure[\"diagnostics\"])) return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed failure result: expected summary and diagnostics.\", \"Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).\")\n\t};\n\treturn {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(String(failure[\"summary\"]), \"Fix contract source diagnostics and return ok(Contract).\", {\n\t\t\tdiagnostics: failure[\"diagnostics\"],\n\t\t\tissues: mapDiagnosticsToIssues(failure[\"diagnostics\"]),\n\t\t\t...ifDefined(\"providerMeta\", failure[\"meta\"])\n\t\t})\n\t};\n}\n/**\n* Canonical contract emit operation.\n*\n* This is the SINGLE publication path used by both the CLI command\n* (`prisma-next contract emit`) and the Vite plugin\n* (`@internal/vite-plugin-contract-emit`). New callers must go through this\n* function rather than re-implementing load → emit → publish.\n*\n* The whole flow (load config → resolve source → emit bytes → atomic publish)\n* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls\n* for the same output line up FIFO; the user-visible outcome is \"last\n* submission wins on disk\" without any supersession bookkeeping. Within a\n* single emit, `publishContractArtifactPair` stages temp files, renames\n* `contract.d.ts` before `contract.json`, and attempts to restore the previous\n* pair if either rename fails — so type-only consumers never observe a\n* mismatched pair.\n*\n* @throws {CliStructuredError} on config/source/validation problems\n* @throws {DOMException} `AbortError` if cancelled via `signal`\n*/\nasync function executeContractEmit(options) {\n\tconst { configPath, outputPath, signal = new AbortController().signal, onProgress } = options;\n\tconst unlessAborted = abortable(signal);\n\tconst config = await unlessAborted(loadConfig(configPath));\n\tif (!config.contract) throw errorContractConfigMissing({ why: \"Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }\" });\n\tconst contractConfig = config.contract;\n\tconst effectiveOutput = outputPath !== void 0 ? join(outputPath, \"contract.json\") : contractConfig.output;\n\tif (!effectiveOutput) throw errorContractConfigMissing({ why: \"Contract config must have output path. This should not happen if defineConfig() was used.\" });\n\tif (typeof contractConfig.source?.load !== \"function\") throw errorContractConfigMissing({ why: \"Contract config must include a valid source provider object\" });\n\tlet outputPaths;\n\ttry {\n\t\toutputPaths = getEmittedArtifactPaths(effectiveOutput);\n\t} catch (error) {\n\t\tthrow errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) });\n\t}\n\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;\n\treturn queueEmitByOutput(outputJsonPath, async () => {\n\t\tconst stack = createControlStack(config);\n\t\tconst sourceContext = {\n\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\tcodecLookup: stack.codecLookup,\n\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\tcapabilities: stack.capabilities\n\t\t};\n\t\tstartSpan(onProgress, \"resolveSource\", \"Resolving contract source...\");\n\t\tlet providerResult;\n\t\ttry {\n\t\t\tproviderResult = await unlessAborted(contractConfig.source.load(sourceContext));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tif (signal.aborted || isRecord(error) && error[\"name\"] === \"AbortError\") throw error;\n\t\t\tthrow failedToResolveContractSource(error instanceof Error ? error.message : String(error), \"Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.\", void 0, error);\n\t\t}\n\t\tconst validatedContract = validateProviderResult(providerResult);\n\t\tif (!validatedContract.ok) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tthrow validatedContract.error;\n\t\t}\n\t\tendSpan(onProgress, \"resolveSource\", \"ok\");\n\t\tstartSpan(onProgress, \"emit\", \"Emitting contract...\");\n\t\tlet emitResult;\n\t\ttry {\n\t\t\tconst familyInstance = config.family.create(stack);\n\t\t\tconst rawComponents = [\n\t\t\t\tconfig.target,\n\t\t\t\tconfig.adapter,\n\t\t\t\t...config.extensions ?? []\n\t\t\t];\n\t\t\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);\n\t\t\tconst enrichedIR = enrichContract(validatedContract.value, frameworkComponents);\n\t\t\tconst rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tconst deserializedContract = familyInstance.deserializeContract(rawContractJson);\n\t\t\tconst { contractSerializer } = config.target;\n\t\t\tconst serializeContract = (c) => contractSerializer.serializeContract(c);\n\t\t\temitResult = await unlessAborted(emit(deserializedContract, stack, config.family.emission, {\n\t\t\t\toutputJsonPath,\n\t\t\t\tserializeContract,\n\t\t\t\tresolveImportSpecifier: createProjectSpecifierResolver(configPath),\n\t\t\t\t...ifDefined(\"shouldPreserveEmpty\", contractSerializer.shouldPreserveEmpty),\n\t\t\t\t...ifDefined(\"sortStorage\", contractSerializer.sortStorage)\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"emit\", \"error\");\n\t\t\tthrow error;\n\t\t}\n\t\tendSpan(onProgress, \"emit\", \"ok\");\n\t\tawait unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));\n\t\tawait publishContractArtifactPair({\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath,\n\t\t\tcontractJson: emitResult.contractJson,\n\t\t\tcontractDts: emitResult.contractDts,\n\t\t\tpublicationToken: String(process.hrtime.bigint())\n\t\t});\n\t\tconst validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;\n\t\treturn {\n\t\t\tstorageHash: emitResult.storageHash,\n\t\t\t...ifDefined(\"executionHash\", emitResult.executionHash),\n\t\t\tprofileHash: emitResult.profileHash,\n\t\t\tfiles: {\n\t\t\t\tjson: outputJsonPath,\n\t\t\t\tdts: outputDtsPath\n\t\t\t},\n\t\t\t...ifDefined(\"validationWarning\", validationWarning)\n\t\t};\n\t});\n}\n//#endregion\nexport { executeContractEmit as n, disposeEmitQueue as r, contract_emit_exports as t };\n\n//# sourceMappingURL=contract-emit-CTm2zfuG.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAI,YAAY,OAAO;AACvB,IAAI,eAAe,KAAK,eAAe;CACtC,IAAI,SAAS,CAAC;CACd,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;CACD,IAAI,CAAC,YAAY,UAAU,QAAQ,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC;CAC1E,OAAO;AACR;;;;;;;;;;;;;AAeA,MAAM,6BAA6B,IAAI,IAAI;AAC3C,SAAS,kBAAkB,gBAAgB,QAAQ;CAClD,MAAM,QAAQ,WAAW,IAAI,cAAc,KAAK,QAAQ,QAAQ,EAAA,CAAG,KAAK,QAAQ,MAAM;CACtF,WAAW,IAAI,gBAAgB,IAAI;CACnC,OAAO;AACR;AACA,SAAS,iBAAiB,gBAAgB;CACzC,WAAW,OAAO,cAAc;AACjC;AAGA,SAAS,WAAW,OAAO;CAC1B,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;AACA,SAAS,uBAAuB,MAAM,kBAAkB,OAAO;CAC9D,OAAO,KAAK,QAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,EAAE,GAAG,QAAQ,IAAI,GAAG,iBAAiB,GAAG,MAAM,KAAK;AAChG;AACA,eAAe,qBAAqB,MAAM;CACzC,IAAI;EACH,OAAO,EAAE,SAAS,MAAM,SAAS,MAAM,OAAO,EAAE;CACjD,SAAS,OAAO;EACf,IAAI,WAAW,KAAK,KAAK,MAAM,YAAY,UAAU,OAAO;EAC5D,MAAM;CACP;AACD;AACA,eAAe,g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sBAAsB,oCAAoC,OAAO,OAAO,UAAU,OAAO,OAAO,UAAU,aAAa;GAC7H,MAAM,aAAa,eAAe,kBAAkB,OAAO,mBAAmB;GAC9E,MAAM,kBAAkB,OAAO,OAAO,mBAAmB,kBAAkB,UAAU;GACrF,MAAM,uBAAuB,eAAe,oBAAoB,eAAe;GAC/E,MAAM,EAAE,uBAAuB,OAAO;GACtC,MAAM,qBAAqB,MAAM,mBAAmB,kBAAkB,CAAC;GACvE,aAAa,MAAM,cAAc,KAAK,sBAAsB,OAAO,OAAO,OAAO,UAAU;IAC1F;IACA;IACA,wBAAwB,+BAA+B,UAAU;IACjE,GAAG,UAAU,uBAAuB,mBAAmB,mBAAmB;IAC1E,GAAG,UAAU,eAAe,mBAAmB,WAAW;GAC3D,CAAC,CAAC;EACH,SAAS,OAAO;GACf,QAAQ,YAAY,QAAQ,OAAO;GACnC,MAAM;EACP;EACA,QAAQ,YAAY,QAAQ,IAAI;EAChC,MAAM,cAAc,MAAM,QAAQ,cAAc,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC;EACvE,MAAM,4BAA4B;GACjC;GACA;GACA,cAAc,WAAW;GACzB,aAAa,WAAW;GACxB,kBAAkB,OAAO,QAAQ,OAAO,OAAO,CAAC;EACjD,CAAC;EACD,MAAM,oBAAoB,qBAAqB,WAAW,aAAa,QAAQ,aAAa,CAAC,CAAC,CAAC;EAC/F,OAAO;GACN,aAAa,WAAW;GACxB,GAAG,UAAU,iBAAiB,WAAW,aAAa;GACtD,aAAa,WAAW;GACxB,OAAO;IACN,MAAM;IACN,KAAK;GACN;GACA,GAAG,UAAU,qBAAqB,iBAAiB;EACpD;CACD,CAAC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract-emit-D8IXP9Qp-Df6NwXn8.mjs","names":["errorUnexpected"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-D8IXP9Qp.mjs"],"sourcesContent":["import { n as executeContractEmit } from \"./contract-emit-CTm2zfuG.mjs\";\nimport { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { errorContractConfigMissing } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, join, relative, resolve } from \"pathe\";\n//#region src/utils/formatters/emit.ts\n/**\n* Formats human-readable output for contract emit.\n*/\nfunction formatEmitOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst jsonPath = relative(process.cwd(), result.files.json);\n\tconst dtsPath = relative(process.cwd(), result.files.dts);\n\tlines.push(`✔ Emitted contract.json → ${jsonPath}`);\n\tlines.push(`✔ Emitted contract.d.ts → ${dtsPath}`);\n\tlines.push(` storageHash: ${result.storageHash}`);\n\tif (result.executionHash) lines.push(` executionHash: ${result.executionHash}`);\n\tif (result.profileHash) lines.push(` profileHash: ${result.profileHash}`);\n\tif (isVerbose(flags, 1)) lines.push(` Total time: ${result.timings.total}ms`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for contract emit.\n*/\nfunction formatEmitJson(result) {\n\tconst output = {\n\t\tok: true,\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\t...result.profileHash ? { profileHash: result.profileHash } : {},\n\t\toutDir: result.outDir,\n\t\tfiles: result.files,\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n//#endregion\n//#region src/commands/contract-emit.ts\n/**\n* Pre-load the config just to compute display paths for the styled header. The\n* actual emit work goes through `executeContractEmit`, which loads the config\n* itself; the redundant load here is bounded and lets the header render before\n* the emit spans start.\n*/\nasync function resolveHeaderPaths(configOption, outputPath) {\n\tconst displayConfigPath = configOption ? relative(process.cwd(), resolve(configOption)) : \"prisma-next.config.ts\";\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(configOption);\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError$1) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to load config\" }));\n\t}\n\tconst effectiveJsonPath = outputPath !== void 0 ? join(outputPath, \"contract.json\") : config.contract?.output;\n\tif (!effectiveJsonPath) return notOk(errorContractConfigMissing({ why: \"Config.contract.output is required for emit. Define it in your config: contract: { source: ..., output: ... }\" }));\n\ttry {\n\t\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = getEmittedArtifactPaths(effectiveJsonPath);\n\t\treturn ok({\n\t\t\tdisplayConfigPath,\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) }));\n\t}\n}\nasync function executeContractEmitCommand(options, flags, ui, startTime) {\n\tconst outputPath = options.outputPath !== void 0 ? resolve(options.outputPath) : void 0;\n\tconst headerPathsResult = await resolveHeaderPaths(options.config, outputPath);\n\tif (!headerPathsResult.ok) return headerPathsResult;\n\tconst { displayConfigPath, outputJsonPath, outputDtsPath } = headerPathsResult.value;\n\tif (!flags.json && !flags.quiet) ui.stderr(formatStyledHeader({\n\t\tcommand: \"contract emit\",\n\t\tdescription: \"Emit your contract artifacts\",\n\t\turl: \"https://pris.ly/contract-emit\",\n\t\tdetails: [\n\t\t\t{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: displayConfigPath\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"contract\",\n\t\t\t\tvalue: relative(process.cwd(), outputJsonPath)\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"types\",\n\t\t\t\tvalue: relative(process.cwd(), outputDtsPath)\n\t\t\t}\n\t\t],\n\t\tflags\n\t}));\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\tconst configPath = options.config ? resolve(options.config) : \"prisma-next.config.ts\";\n\tlet result;\n\ttry {\n\t\tresult = await executeContractEmit({\n\t\t\tconfigPath,\n\t\t\tonProgress,\n\t\t\t...ifDefined(\"outputPath\", outputPath)\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(\"Unexpected error during contract emit\", { why: error instanceof Error ? error.message : String(error) }));\n\t}\n\tif (result.validationWarning) ui.warn(result.validationWarning);\n\treturn ok({\n\t\tstorageHash: result.storageHash,\n\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\tprofileHash: result.profileHash,\n\t\toutDir: dirname(result.files.json),\n\t\tfiles: result.files,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractEmitCommand() {\n\tconst command = new Command(\"emit\");\n\tsetCommandDescriptions(command, \"Emit your contract artifacts\", \"Reads your contract source (TypeScript or Prisma schema) and emits contract.json and\\ncontract.d.ts. The contract.json contains the canonical contract structure, and\\ncontract.d.ts provides TypeScript types for type-safe query building.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract emit\",\n\t\t\"prisma-next contract emit --config ./custom-config.ts\",\n\t\t\"prisma-next contract emit --output-path ./generated\"\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--output-path <dir>\", \"Directory to write contract.json and contract.d.ts into\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractEmitCommand(options, flags, ui, Date.now()), flags, ui, (emitResult) => {\n\t\t\tif (flags.json) ui.output(formatEmitJson(emitResult));\n\t\t\telse {\n\t\t\t\tconst output = formatEmitOutput(emitResult, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t\tif (!flags.quiet) ui.success(formatSuccessMessage(flags));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractEmitCommand as t };\n\n//# sourceMappingURL=contract-emit-D8IXP9Qp.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,IAAI,MAAM,OAAO,OAAO;CACxB,MAAM,QAAQ,CAAC;CACf,MAAM,WAAW,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI;CAC1D,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG;CACxD,MAAM,KAAK,6BAA6B,UAAU;CAClD,MAAM,KAAK,6BAA6B,SAAS;CACjD,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACjD,IAAI,OAAO,eAAe,MAAM,KAAK,oBAAoB,OAAO,eAAe;CAC/E,IAAI,OAAO,aAAa,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACzE,IAAI,UAAU,OAAO,CAAC,GAAG,MAAM,KAAK,iBAAiB,OAAO,QAAQ,MAAM,GAAG;CAC7E,OAAO,MAAM,KAAK,IAAI;AACvB;;;;AAIA,SAAS,eAAe,QAAQ;CAC/B,MAAM,SAAS;EACd,IAAI;EACJ,aAAa,OAAO;EACpB,GAAG,UAAU,iBAAiB,OAAO,aAAa;EAClD,GAAG,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;EAC/D,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,SAAS,OAAO;CACjB;CACA,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACtC;;;;;;;AASA,eAAe,mBAAmB,cAAc,YAAY;CAC3D,MAAM,oBAAoB,eAAe,SAAS,QAAQ,IAAI,GAAG,QAAQ,YAAY,CAAC,IAAI;CAC1F,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,WA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,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"db-sign-DCb_DKtv.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/db-sign.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { t as createProgressAdapter } from \"../progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"../client-Y6qbDk7X.mjs\";\nimport { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from \"../verify-C6L_hiJU.mjs\";\nimport { t as resolveContractRefToSnapshot } from \"../contract-snapshot-resolution-SATuw0JW.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } 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 config = await loadConfig(options.config);\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);\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 client.close();\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 };\n\n//# sourceMappingURL=db-sign.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAe,qBAAqB,aAAa,SAAS,OAAO,IAAI;CACpE,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,aAAa,QAAQ,SAAS,SAAS,QAAQ,IAAI,GA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