@prisma/orm-toolchain 8.0.0-rc.1-dev.4 → 8.0.0-rc.1-dev.6

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 (170) hide show
  1. package/dist/{aggregate-B4mhR4Sk.mjs → aggregate-i-rfetSO.mjs} +8 -8
  2. package/dist/{aggregate-B4mhR4Sk.mjs.map → aggregate-i-rfetSO.mjs.map} +1 -1
  3. package/dist/bin__prisma-next.mjs +22 -22
  4. package/dist/bin__prisma-next.mjs.map +1 -1
  5. package/dist/cli.mjs +2 -2
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/cli__commands__contract-emit.mjs +1 -1
  8. package/dist/cli__commands__contract-infer.mjs +1 -1
  9. package/dist/cli__commands__db-init.mjs +1 -1
  10. package/dist/cli__commands__db-schema.mjs +1 -1
  11. package/dist/cli__commands__db-sign.mjs +1 -1
  12. package/dist/cli__commands__db-update.mjs +1 -1
  13. package/dist/cli__commands__db-verify.mjs +1 -1
  14. package/dist/cli__commands__migrate.d.mts +1 -1
  15. package/dist/cli__commands__migrate.mjs +1 -1
  16. package/dist/cli__commands__migration-check.d.mts +1 -1
  17. package/dist/cli__commands__migration-check.mjs +1 -1
  18. package/dist/cli__commands__migration-graph.d.mts +1 -1
  19. package/dist/cli__commands__migration-graph.mjs +1 -1
  20. package/dist/cli__commands__migration-list.d.mts +1 -1
  21. package/dist/cli__commands__migration-list.mjs +1 -1
  22. package/dist/cli__commands__migration-log.d.mts +1 -1
  23. package/dist/cli__commands__migration-log.mjs +1 -1
  24. package/dist/cli__commands__migration-new.mjs +1 -1
  25. package/dist/cli__commands__migration-plan.mjs +1 -1
  26. package/dist/cli__commands__migration-show.mjs +1 -1
  27. package/dist/cli__commands__migration-status.d.mts +1 -1
  28. package/dist/cli__commands__migration-status.mjs +1 -1
  29. package/dist/cli__commands__ref.d.mts +1 -1
  30. package/dist/cli__commands__ref.mjs +1 -1
  31. package/dist/cli__commands__telemetry.mjs +1 -1
  32. package/dist/cli__control-api.d.mts +1 -1
  33. package/dist/cli__control-api.mjs +2 -2
  34. package/dist/cli__migration-cli.mjs +3 -6
  35. package/dist/cli__migration-cli.mjs.map +1 -1
  36. package/dist/{client-75qrAPqf-7l0C0H_b.mjs → client-7aUYC7ci-Bh9mLxkl.mjs} +16 -12
  37. package/dist/client-7aUYC7ci-Bh9mLxkl.mjs.map +1 -0
  38. package/dist/{command-helpers-CAoXqAY9-DWUBcTXM.mjs → command-helpers-C4WpR-QE-CK2gkj6l.mjs} +30 -74
  39. package/dist/command-helpers-C4WpR-QE-CK2gkj6l.mjs.map +1 -0
  40. package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs +44 -0
  41. package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +1 -0
  42. package/dist/{contract-emit-B6odMoem-C87PBvmo.mjs → contract-emit-CTm2zfuG-8mtkxW8M.mjs} +12 -11
  43. package/dist/contract-emit-CTm2zfuG-8mtkxW8M.mjs.map +1 -0
  44. package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs → contract-emit-D8IXP9Qp-CecAQio1.mjs} +4 -4
  45. package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs.map → contract-emit-D8IXP9Qp-CecAQio1.mjs.map} +1 -1
  46. package/dist/{contract-infer-BnkqpftN-DwBzasOu.mjs → contract-infer-C8-RqHeK-D_dm3onP.mjs} +5 -5
  47. package/dist/contract-infer-C8-RqHeK-D_dm3onP.mjs.map +1 -0
  48. package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs} +3 -3
  49. package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map} +1 -1
  50. package/dist/{contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs → contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs} +6 -6
  51. package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +1 -0
  52. package/dist/{db-init-bd0_x2Q8.mjs → db-init-CXMcvoIA.mjs} +9 -12
  53. package/dist/db-init-CXMcvoIA.mjs.map +1 -0
  54. package/dist/{db-schema-CwgAWTqG.mjs → db-schema-j8DERh4t.mjs} +4 -4
  55. package/dist/{db-schema-CwgAWTqG.mjs.map → db-schema-j8DERh4t.mjs.map} +1 -1
  56. package/dist/{db-sign-vqiYfpjI.mjs → db-sign-xV_rpoIc.mjs} +10 -10
  57. package/dist/db-sign-xV_rpoIc.mjs.map +1 -0
  58. package/dist/{db-update-Br0diOCo.mjs → db-update-DXa2DIvu.mjs} +11 -11
  59. package/dist/db-update-DXa2DIvu.mjs.map +1 -0
  60. package/dist/{db-verify-CKPsRFrj-T7nSt7yT.mjs → db-verify-YWHjuKC7-DidK1gx1.mjs} +9 -6
  61. package/dist/db-verify-YWHjuKC7-DidK1gx1.mjs.map +1 -0
  62. package/dist/{errors--qsXZUtL.d.mts → errors-AkMBj-YP.d.mts} +8 -8
  63. package/dist/errors-AkMBj-YP.d.mts.map +1 -0
  64. package/dist/{errors-IpZm1Skp-BH495dRd.mjs → errors-BwusfLIN-BXM7K-ww.mjs} +42 -51
  65. package/dist/errors-BwusfLIN-BXM7K-ww.mjs.map +1 -0
  66. package/dist/{format-ByDm2goZ-BIRlFoo6.mjs → format-Bw3LVJ1v-D10inUT9.mjs} +12 -9
  67. package/dist/format-Bw3LVJ1v-D10inUT9.mjs.map +1 -0
  68. package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs → framework-components-3DdB31mk-BPGSuOyZ.mjs} +3 -3
  69. package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs.map → framework-components-3DdB31mk-BPGSuOyZ.mjs.map} +1 -1
  70. package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs → graph-membership-h9ejuZla-ewjYM5wz.mjs} +3 -3
  71. package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map → graph-membership-h9ejuZla-ewjYM5wz.mjs.map} +1 -1
  72. package/dist/{init-BGm77aWc-jHVUn63W.mjs → init-CPB89WK2-Di4kgP6B.mjs} +4 -4
  73. package/dist/{init-BGm77aWc-jHVUn63W.mjs.map → init-CPB89WK2-Di4kgP6B.mjs.map} +1 -1
  74. package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs} +4 -4
  75. package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs.map → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map} +1 -1
  76. package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs → invariants-CMcQxRas-CXX9uhQW.mjs} +3 -3
  77. package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs.map → invariants-CMcQxRas-CXX9uhQW.mjs.map} +1 -1
  78. package/dist/{io-C8TdyBKt-DloEBi70.mjs → io-CL3hSv42-DGZtTs89.mjs} +8 -8
  79. package/dist/{io-C8TdyBKt-DloEBi70.mjs.map → io-CL3hSv42-DGZtTs89.mjs.map} +1 -1
  80. package/dist/{migrate-BdVFDKF2.mjs → migrate-COusRrm7.mjs} +28 -22
  81. package/dist/migrate-COusRrm7.mjs.map +1 -0
  82. package/dist/{migration-check-CcG-fB8r-qpu6xdbA.mjs → migration-check-CueEJelQ-J81XR_ns.mjs} +10 -10
  83. package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +1 -0
  84. package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs} +4 -4
  85. package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs.map → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map} +1 -1
  86. package/dist/{migration-BuUmO7It.mjs → migration-diUAhNaa.mjs} +3 -3
  87. package/dist/{migration-BuUmO7It.mjs.map → migration-diUAhNaa.mjs.map} +1 -1
  88. package/dist/{migration-graph-vmgkL3k4.mjs → migration-graph-BL6vfLcE.mjs} +4 -4
  89. package/dist/{migration-graph-vmgkL3k4.mjs.map → migration-graph-BL6vfLcE.mjs.map} +1 -1
  90. package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs → migration-graph-D6bN-mX0-DwMWY8DA.mjs} +3 -3
  91. package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs.map → migration-graph-D6bN-mX0-DwMWY8DA.mjs.map} +1 -1
  92. package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs → migration-list-D2_JdzWC-MRHYYVQE.mjs} +6 -6
  93. package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs.map → migration-list-D2_JdzWC-MRHYYVQE.mjs.map} +1 -1
  94. package/dist/{migration-log-CS5IWcNq-DI7FTHCA.mjs → migration-log-BXbz6-Lj-CKHbat5f.mjs} +4 -6
  95. package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +1 -0
  96. package/dist/{migration-new-GmW2anVb.mjs → migration-new-szZFsA3C.mjs} +16 -15
  97. package/dist/migration-new-szZFsA3C.mjs.map +1 -0
  98. package/dist/{migration-path-target-D3Sj55PI-BICblCuk.mjs → migration-path-target-BPYp3LNc-qRQlG_Yn.mjs} +4 -4
  99. package/dist/migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map +1 -0
  100. package/dist/{migration-plan-q_L84PN1-ClkGgtVz.mjs → migration-plan-CxXAXYc8-Dnp-v8Nl.mjs} +17 -18
  101. package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +1 -0
  102. package/dist/{migration-show--pW4XhKs.mjs → migration-show-BKsIh7Uz.mjs} +9 -9
  103. package/dist/migration-show-BKsIh7Uz.mjs.map +1 -0
  104. package/dist/{migration-status-CFlzlRmu-QHUxHm_l.mjs → migration-status-CNnRInne--cvmx56T.mjs} +15 -15
  105. package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +1 -0
  106. package/dist/migration-tools.d.mts +2 -2
  107. package/dist/migration-tools.mjs +12 -12
  108. package/dist/migration-tools__aggregate.mjs +1 -1
  109. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  110. package/dist/migration-tools__errors.d.mts +1 -1
  111. package/dist/migration-tools__errors.mjs +1 -1
  112. package/dist/migration-tools__invariants.mjs +1 -1
  113. package/dist/migration-tools__io.mjs +1 -1
  114. package/dist/migration-tools__migration-graph.mjs +2 -2
  115. package/dist/migration-tools__migration.mjs +1 -1
  116. package/dist/migration-tools__ref-resolution.mjs +1 -1
  117. package/dist/migration-tools__refs.mjs +1 -1
  118. package/dist/migration-tools__spaces.d.mts +1 -1
  119. package/dist/migration-tools__spaces.mjs +2 -2
  120. package/dist/{project-import-root-CpwLCDLY-DkVwAnWj.mjs → project-import-root-C_bd0ooL-CLXW-gp6.mjs} +10 -8
  121. package/dist/project-import-root-C_bd0ooL-CLXW-gp6.mjs.map +1 -0
  122. package/dist/{ref-sHE8zOcm.mjs → ref-DjZ5Y8ju.mjs} +11 -11
  123. package/dist/ref-DjZ5Y8ju.mjs.map +1 -0
  124. package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs → ref-advancement-CSPMoQs3-CPkL3IFF.mjs} +4 -4
  125. package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs.map → ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map} +1 -1
  126. package/dist/{ref-resolution-BjJBWPjX.mjs → ref-resolution-BsdziDFA.mjs} +2 -2
  127. package/dist/{ref-resolution-BjJBWPjX.mjs.map → ref-resolution-BsdziDFA.mjs.map} +1 -1
  128. package/dist/{refs-BDbB9BRB-D6Za3Q49.mjs → refs-DtoeUivZ-qay0UMSP.mjs} +6 -6
  129. package/dist/refs-DtoeUivZ-qay0UMSP.mjs.map +1 -0
  130. package/dist/{spaces-C27bA-xc.mjs → spaces-BNd2Tlk0.mjs} +7 -7
  131. package/dist/spaces-BNd2Tlk0.mjs.map +1 -0
  132. package/dist/{spaces-DxFj5y8l.d.mts → spaces-D5qtTlhj.d.mts} +2 -2
  133. package/dist/{spaces-DxFj5y8l.d.mts.map → spaces-D5qtTlhj.d.mts.map} +1 -1
  134. package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs → telemetry-DVBHDQd6-BEdoMii0.mjs} +3 -3
  135. package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs.map → telemetry-DVBHDQd6-BEdoMii0.mjs.map} +1 -1
  136. package/dist/{types-DZWEs4si-D8UlyJI0.d.mts → types-2n_H3DQ9-Bks8UPEO.d.mts} +8 -2
  137. package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +1 -0
  138. package/dist/{verify-DnVNjc5C-BGdsblBK.mjs → verify-C6L_hiJU-CN3eEe3Y.mjs} +3 -3
  139. package/dist/{verify-DnVNjc5C-BGdsblBK.mjs.map → verify-C6L_hiJU-CN3eEe3Y.mjs.map} +1 -1
  140. package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs} +4 -4
  141. package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map} +1 -1
  142. package/dist/vite-plugin-contract-emit.mjs +1 -1
  143. package/package.json +12 -12
  144. package/dist/client-75qrAPqf-7l0C0H_b.mjs.map +0 -1
  145. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +0 -1
  146. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +0 -36
  147. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +0 -1
  148. package/dist/contract-emit-B6odMoem-C87PBvmo.mjs.map +0 -1
  149. package/dist/contract-infer-BnkqpftN-DwBzasOu.mjs.map +0 -1
  150. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +0 -1
  151. package/dist/db-init-bd0_x2Q8.mjs.map +0 -1
  152. package/dist/db-sign-vqiYfpjI.mjs.map +0 -1
  153. package/dist/db-update-Br0diOCo.mjs.map +0 -1
  154. package/dist/db-verify-CKPsRFrj-T7nSt7yT.mjs.map +0 -1
  155. package/dist/errors--qsXZUtL.d.mts.map +0 -1
  156. package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +0 -1
  157. package/dist/format-ByDm2goZ-BIRlFoo6.mjs.map +0 -1
  158. package/dist/migrate-BdVFDKF2.mjs.map +0 -1
  159. package/dist/migration-check-CcG-fB8r-qpu6xdbA.mjs.map +0 -1
  160. package/dist/migration-log-CS5IWcNq-DI7FTHCA.mjs.map +0 -1
  161. package/dist/migration-new-GmW2anVb.mjs.map +0 -1
  162. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +0 -1
  163. package/dist/migration-plan-q_L84PN1-ClkGgtVz.mjs.map +0 -1
  164. package/dist/migration-show--pW4XhKs.mjs.map +0 -1
  165. package/dist/migration-status-CFlzlRmu-QHUxHm_l.mjs.map +0 -1
  166. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +0 -1
  167. package/dist/ref-sHE8zOcm.mjs.map +0 -1
  168. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +0 -1
  169. package/dist/spaces-C27bA-xc.mjs.map +0 -1
  170. package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +0 -1
@@ -1,10 +1,10 @@
1
- import { t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
- import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
3
- import { B as formatMigrationJson, D as errorRunnerFailed, N as errorUnexpected, Q as mapRefResolutionError, V as formatMigrationPlanOutput, Z as mapMigrationToolsError, at as resolveMigrationPaths, ct as setCommandExamples, d as errorContractValidationFailed, n as ERROR_CODE_DESTRUCTIVE_CHANGES, o as createTerminalUI, ot as sanitizeErrorMessage, p as errorDestructiveChanges, q as handleResult, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, x as errorMigrationPlanningFailed, z as formatMigrationApplyOutput } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
4
- import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
5
- import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "./migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs";
6
- import { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from "./ref-advancement-CSPMoQs3-fEipZrdu.mjs";
7
- import { n as parseContractRef } from "./ref-resolution-BjJBWPjX.mjs";
1
+ import { t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
2
+ import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
3
+ import { B as formatMigrationJson, D as errorRunnerFailed, N as errorUnexpected, V as formatMigrationPlanOutput, Z as mapRefResolutionError, at as sanitizeErrorMessage, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, n as ERROR_CODE_DESTRUCTIVE_CHANGES, o as createTerminalUI, ot as setCommandDescriptions, p as errorDestructiveChanges, q as handleResult, st as setCommandExamples, t as CliStructuredError$1, x as errorMigrationPlanningFailed, z as formatMigrationApplyOutput } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
4
+ import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs";
5
+ import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "./migration-command-scaffold-DNRo4exb-9JCezdoT.mjs";
6
+ import { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from "./ref-advancement-CSPMoQs3-CPkL3IFF.mjs";
7
+ import { n as parseContractRef } from "./ref-resolution-BsdziDFA.mjs";
8
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
9
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
10
10
  import { join } from "pathe";
@@ -25,7 +25,8 @@ function mapDbUpdateFailure(failure) {
25
25
  meta: {
26
26
  ...failure.meta,
27
27
  ...failure.warnings && failure.warnings.length > 0 ? { plannerWarnings: failure.warnings } : {}
28
- }
28
+ },
29
+ ...ifDefined("cause", failure.cause)
29
30
  });
30
31
  }
31
32
  if (failure.code === "DESTRUCTIVE_CHANGES") return errorDestructiveChanges(failure.summary, {
@@ -69,7 +70,6 @@ async function executeDbUpdateCommand(options, flags, ui, startTime) {
69
70
  contractJson = await readContractSnapshotJson(migrationsDir, targetHash);
70
71
  contractJsonPathForSnapshot = join(contractSnapshotDir(migrationsDir, targetHash), "contract.json");
71
72
  } catch (error) {
72
- if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
73
73
  if (CliStructuredError$1.is(error)) return notOk(error);
74
74
  throw error;
75
75
  }
@@ -103,7 +103,7 @@ async function executeDbUpdateCommand(options, flags, ui, startTime) {
103
103
  hash: advancementHash
104
104
  });
105
105
  } catch (error) {
106
- if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
106
+ if (MigrationToolsError.is(error)) return notOk(error);
107
107
  throw error;
108
108
  }
109
109
  return ok({
@@ -180,4 +180,4 @@ function createDbUpdateCommand() {
180
180
  //#endregion
181
181
  export { createDbUpdateCommand as t };
182
182
 
183
- //# sourceMappingURL=db-update-Br0diOCo.mjs.map
183
+ //# sourceMappingURL=db-update-DXa2DIvu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-update-DXa2DIvu.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/db-update.mjs"],"sourcesContent":["import { B as errorContractValidationFailed, C as formatMigrationApplyOutput, F as CliStructuredError, H as errorDestructiveChanges, I as ERROR_CODE_DESTRUCTIVE_CHANGES, T as formatMigrationPlanOutput, X as errorMigrationPlanningFailed, _ as createTerminalUI, c as sanitizeErrorMessage, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapRefResolutionError, nt as errorRunnerFailed, s as resolveMigrationPaths, u as setCommandExamples, w as formatMigrationJson, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { n as buildReadAggregate } from \"../contract-space-aggregate-loader-CziO_ZRW.mjs\";\nimport { n as prepareMigrationContext, t as addMigrationCommandOptions } from \"../migration-command-scaffold-DNRo4exb.mjs\";\nimport { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from \"../ref-advancement-CSPMoQs3.mjs\";\nimport { Command } from \"commander\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join } from \"pathe\";\nimport { assertNever } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/db-update.ts\n/**\n* Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.\n*/\nfunction mapDbUpdateFailure(failure) {\n\tif (failure.code === \"PLANNING_FAILED\") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });\n\tif (failure.code === \"RUNNER_FAILED\") {\n\t\tconst fix = (typeof failure.meta?.[\"runnerErrorCode\"] === \"string\" ? failure.meta[\"runnerErrorCode\"] : void 0) === \"MIGRATION.LEGACY_MARKER_SHAPE\" ? \"Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema.\" : \"Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`\";\n\t\treturn errorRunnerFailed(failure.summary, {\n\t\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\t\tfix,\n\t\t\tmeta: {\n\t\t\t\t...failure.meta,\n\t\t\t\t...failure.warnings && failure.warnings.length > 0 ? { plannerWarnings: failure.warnings } : {}\n\t\t\t},\n\t\t\t...ifDefined(\"cause\", failure.cause)\n\t\t});\n\t}\n\tif (failure.code === \"DESTRUCTIVE_CHANGES\") return errorDestructiveChanges(failure.summary, {\n\t\t...ifDefined(\"why\", failure.why),\n\t\tfix: \"Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first\",\n\t\t...ifDefined(\"meta\", failure.meta)\n\t});\n\tconst exhaustive = failure.code;\n\treturn assertNever(exhaustive, `Unhandled DbUpdateFailure code: ${String(exhaustive)}`);\n}\n/**\n* Executes the db update command and returns a structured Result.\n*/\nasync function executeDbUpdateCommand(options, flags, ui, startTime) {\n\tconst ctxResult = await prepareMigrationContext(options, flags, ui, {\n\t\tcommandName: \"db update\",\n\t\tdescription: \"Update your database schema to match your contract\",\n\t\turl: \"https://pris.ly/db-update\"\n\t});\n\tif (!ctxResult.ok) return ctxResult;\n\tconst { client, config, dbConnection, onProgress, contractPathAbsolute } = ctxResult.value;\n\tlet { contractJson } = ctxResult.value;\n\tlet contractJsonPathForSnapshot = contractPathAbsolute;\n\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\tif (options.to) try {\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\tconst refResult = parseContractRef(options.to, {\n\t\t\tgraph,\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tconst targetHash = refResult.value.hash;\n\t\tif (!bundles.find((p) => p.metadata.to === targetHash)) return notOk(errorUnexpected(`No migration bundle found for --to \"${options.to}\" (resolved hash: ${targetHash})`, {\n\t\t\twhy: `The ref resolved successfully but no on-disk migration package has a destination (\\`to\\`) hash matching ${targetHash}.`,\n\t\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.\"\n\t\t}));\n\t\tcontractJson = await readContractSnapshotJson(migrationsDir, targetHash);\n\t\tcontractJsonPathForSnapshot = join(contractSnapshotDir(migrationsDir, targetHash), \"contract.json\");\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst result = await client.dbUpdate({\n\t\t\tcontract: contractJson,\n\t\t\tmode: options.dryRun ? \"plan\" : \"apply\",\n\t\t\tmigrationsDir,\n\t\t\t...flags.yes ? { acceptDataLoss: true } : {},\n\t\t\tonProgress\n\t\t});\n\t\tif (!result.ok) return notOk(mapDbUpdateFailure(result.failure));\n\t\tconst advancementHash = result.value.mode === \"apply\" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;\n\t\tlet refAdvancementFields = {\n\t\t\tadvancedRef: null,\n\t\t\tplannedAdvanceRef: null\n\t\t};\n\t\tif (computeRefAdvancementName({\n\t\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t\t...ifDefined(\"db\", options.db)\n\t\t}) !== null) try {\n\t\t\tconst contractIR = await readContractIR(contractJson, contractJsonPathForSnapshot);\n\t\t\trefAdvancementFields = await buildRefAdvancementFields({\n\t\t\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t\t\t...ifDefined(\"db\", options.db),\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tcontractIR,\n\t\t\t\tmode: result.value.mode,\n\t\t\t\thash: advancementHash\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: result.value.mode,\n\t\t\tplan: {\n\t\t\t\ttargetId: ctxResult.value.config.target.targetId,\n\t\t\t\tdestination: {\n\t\t\t\t\tstorageHash: result.value.destination.storageHash,\n\t\t\t\t\t...ifDefined(\"profileHash\", result.value.destination.profileHash)\n\t\t\t\t},\n\t\t\t\toperations: result.value.plan.operations.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\t...ifDefined(\"preview\", result.value.plan.preview)\n\t\t\t},\n\t\t\t...ifDefined(\"execution\", result.value.execution ? {\n\t\t\t\toperationsPlanned: result.value.execution.operationsPlanned,\n\t\t\t\toperationsExecuted: result.value.execution.operationsExecuted\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"marker\", result.value.marker ? {\n\t\t\t\tstorageHash: result.value.marker.storageHash,\n\t\t\t\t...ifDefined(\"profileHash\", result.value.marker.profileHash)\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"perSpace\", result.value.perSpace),\n\t\t\t...ifDefined(\"warnings\", result.value.warnings),\n\t\t\tadvancedRef: refAdvancementFields.advancedRef,\n\t\t\tplannedAdvanceRef: refAdvancementFields.plannedAdvanceRef,\n\t\t\tsummary: result.value.summary,\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during db update: ${safeMessage}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createDbUpdateCommand() {\n\tconst command = new Command(\"update\");\n\tsetCommandDescriptions(command, \"Update your database schema to match your contract\", \"Compares your database schema to the emitted contract and applies the necessary\\nchanges. Works on any database, whether or not it has been initialized with `db init`.\\nDestructive operations prompt for confirmation in interactive mode. Use -y to\\nauto-accept or --dry-run to preview first.\");\n\tsetCommandExamples(command, [\"prisma-next db update --db $DATABASE_URL\", \"prisma-next db update --db $DATABASE_URL --dry-run\"]);\n\taddMigrationCommandOptions(command);\n\tcommand.option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\");\n\tcommand.option(\"--advance-ref <name>\", \"Ref to advance to the post-command contract hash\");\n\tcommand.action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet result = await executeDbUpdateCommand(options, flags, ui, startTime);\n\t\tif (!result.ok && result.failure.code === ERROR_CODE_DESTRUCTIVE_CHANGES && flags.interactive && !flags.json && !flags.yes) {\n\t\t\tconst destructiveOps = result.failure.meta?.destructiveOperations ?? [];\n\t\t\tif (destructiveOps.length > 0) ui.warn(`${destructiveOps.length} destructive operation(s) that may cause data loss:\\n${destructiveOps.map((op) => ` ${ui.yellow(\"▸\")} ${op.label}`).join(\"\\n\")}`);\n\t\t\tif (await ui.confirm(\"Apply destructive changes? This cannot be undone.\")) result = await executeDbUpdateCommand(options, {\n\t\t\t\t...flags,\n\t\t\t\tyes: true\n\t\t\t}, ui, Date.now());\n\t\t}\n\t\tconst exitCode = handleResult(result, flags, ui, (dbUpdateResult) => {\n\t\t\tif (flags.json) ui.output(formatMigrationJson(dbUpdateResult));\n\t\t\telse {\n\t\t\t\tconst output = dbUpdateResult.mode === \"plan\" ? formatMigrationPlanOutput(dbUpdateResult, flags) : formatMigrationApplyOutput(dbUpdateResult, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbUpdateCommand };\n\n//# sourceMappingURL=db-update.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,mBAAmB,SAAS;CACpC,IAAI,QAAQ,SAAS,mBAAmB,OAAO,6BAA6B,EAAE,WAAW,QAAQ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M,MAAM,GAAG,OAAO,oBAAoB,cAAc,CAAC;QACxD;IACJ,MAAM,SAAS,eAAe,SAAS,SAAS,0BAA0B,gBAAgB,KAAK,IAAI,2BAA2B,gBAAgB,KAAK;IACnJ,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
@@ -1,8 +1,8 @@
1
- import { $ as maskConnectionUrl, M as errorTargetMismatch, N as errorUnexpected, O as errorRuntime$1, W as formatStyledHeader, at as resolveMigrationPaths, b as errorMarkerMissing, ct as setCommandExamples, d as errorContractValidationFailed, f as errorDatabaseConnectionRequired, g as errorHashMismatch, h as errorFileNotFound, it as resolveContractPath, m as errorDriverRequired, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
1
+ import { M as errorTargetMismatch, N as errorUnexpected, O as errorRuntime$1, Q as maskConnectionUrl, W as formatStyledHeader, b as errorMarkerMissing, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, g as errorHashMismatch, h as errorFileNotFound, it as resolveMigrationPaths, m as errorDriverRequired, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, rt as resolveContractPath, st as setCommandExamples, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
2
2
  import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
3
3
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
4
- import { t as createControlClient } from "./client-75qrAPqf-7l0C0H_b.mjs";
5
- import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-DnVNjc5C-BGdsblBK.mjs";
4
+ import { t as createControlClient } from "./client-7aUYC7ci-Bh9mLxkl.mjs";
5
+ import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-C6L_hiJU-CN3eEe3Y.mjs";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
8
8
  import { relative, resolve } from "pathe";
@@ -11,7 +11,7 @@ import { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARG
11
11
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
12
12
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
13
13
  import { Command } from "commander";
14
- //#region ../../../1-framework/3-tooling/cli/dist/db-verify-CKPsRFrj.mjs
14
+ //#region ../../../1-framework/3-tooling/cli/dist/db-verify-YWHjuKC7.mjs
15
15
  /**
16
16
  * Collapse the aggregate verifier's per-space contract-satisfaction results
17
17
  * into a single {@link VerifyDatabaseSchemaResult} for the CLI display
@@ -93,7 +93,10 @@ function mapVerifyFailure(verifyResult) {
93
93
  }
94
94
  if (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? "unknown");
95
95
  }
96
- return errorRuntime$1(verifyResult.summary);
96
+ return errorRuntime$1("CONTRACT.VERIFY_FAILED", verifyResult.summary, {
97
+ why: "Verification failed",
98
+ fix: "Check contract and database state"
99
+ });
97
100
  }
98
101
  function errorInvalidVerifyMode(options) {
99
102
  return new CliStructuredError$1("CLI.INVALID_VERIFY_MODE", "Invalid verify mode", {
@@ -393,4 +396,4 @@ function createDbVerifyCommand() {
393
396
  //#endregion
394
397
  export { createDbVerifyCommand as t };
395
398
 
396
- //# sourceMappingURL=db-verify-CKPsRFrj-T7nSt7yT.mjs.map
399
+ //# sourceMappingURL=db-verify-YWHjuKC7-DidK1gx1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-verify-YWHjuKC7-DidK1gx1.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-YWHjuKC7.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, G as errorHashMismatch, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Y as errorMarkerMissing, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, st as errorTargetMismatch, 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-7aUYC7ci.mjs\";\nimport { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from \"./verify-C6L_hiJU.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, createControlStack } from \"@internal/framework-components/control\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/utils/combine-verify-results.ts\n/**\n* Collapse the aggregate verifier's per-space contract-satisfaction results\n* into a single {@link VerifyDatabaseSchemaResult} for the CLI display\n* surface, and carry the deduplicated unclaimed-elements list alongside it.\n* Concatenates the issue lists across spaces; uses the app space's result as\n* the structural envelope (storage hash, target). Extras are already\n* stripped from each per-space result, so nothing here duplicates an\n* unclaimed element per space.\n*\n* **Unclaimed disposition.** In strict mode a non-empty `unclaimed` list fails\n* the combined verdict (`ok: false`); in lenient mode it is carried for\n* informational rendering only. The list itself is returned unchanged for the\n* renderer.\n*\n* **Summary policy.** Preserve the per-family phrasing whenever the\n* combined `ok` flag agrees with the app space's `ok` flag — this is\n* the common case (single-family deployments, single-app deployments)\n* and the family's \"satisfies / does not satisfy contract\" phrasing\n* stays user-visible. When the app passes but an extension fails (or\n* vice versa) the app's summary contradicts the envelope, so fall back\n* to the first failing space's summary. This keeps family phrasing\n* intact and the envelope internally consistent (`ok: false` ↔ failure\n* summary).\n*/\nfunction combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {\n\tconst appResult = perSpace.get(appSpaceId) ?? perSpace.values().next().value;\n\tif (appResult === void 0) throw new InternalError(\"Aggregate verifier returned no per-space verify results — this is a wiring bug.\");\n\tlet okAll = true;\n\tlet firstFailure;\n\tlet issues = [];\n\tlet warningIssues = [];\n\tfor (const [, result] of perSpace) {\n\t\tif (!result.ok) {\n\t\t\tokAll = false;\n\t\t\tif (firstFailure === void 0) firstFailure = result;\n\t\t}\n\t\tissues = [...issues, ...result.schema.issues];\n\t\twarningIssues = [...warningIssues, ...result.schema.warnings?.issues ?? []];\n\t}\n\tconst unclaimedFails = strict && unclaimed.length > 0;\n\tconst ok = okAll && !unclaimedFails;\n\tconst summary = okAll ? unclaimedFails ? `Database schema has ${unclaimed.length} unclaimed element${unclaimed.length === 1 ? \"\" : \"s\"} (not in any contract)` : appResult.summary : appResult.ok ? firstFailure?.summary ?? appResult.summary : appResult.summary;\n\treturn {\n\t\tresult: {\n\t\t\tok,\n\t\t\t...ok ? {} : { code: appResult.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\t\tsummary,\n\t\t\tcontract: appResult.contract,\n\t\t\ttarget: appResult.target,\n\t\t\tschema: {\n\t\t\t\tissues,\n\t\t\t\twarnings: { issues: warningIssues }\n\t\t\t},\n\t\t\tmeta: { strict },\n\t\t\ttimings: { total: 0 }\n\t\t},\n\t\tunclaimed\n\t};\n}\n//#endregion\n//#region src/commands/db-verify.ts\n/**\n* Maps a VerifyDatabaseResult failure to a CliStructuredError.\n*/\nfunction mapVerifyFailure(verifyResult) {\n\tif (!verifyResult.ok && verifyResult.code) {\n\t\tif (verifyResult.code === VERIFY_CODE_MARKER_MISSING) return errorMarkerMissing();\n\t\tif (verifyResult.code === VERIFY_CODE_HASH_MISMATCH) {\n\t\t\tconst storageMatch = verifyResult.marker?.storageHash === verifyResult.contract.storageHash;\n\t\t\tconst profileMatch = !verifyResult.contract.profileHash || verifyResult.marker?.profileHash === verifyResult.contract.profileHash;\n\t\t\tif (!storageMatch) return errorHashMismatch({\n\t\t\t\twhy: \"Contract storageHash does not match database marker\",\n\t\t\t\texpected: verifyResult.contract.storageHash,\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.storageHash)\n\t\t\t});\n\t\t\treturn errorHashMismatch({\n\t\t\t\twhy: profileMatch ? \"Contract hash does not match database marker\" : \"Contract profileHash does not match database marker\",\n\t\t\t\t...ifDefined(\"expected\", verifyResult.contract.profileHash),\n\t\t\t\t...ifDefined(\"actual\", verifyResult.marker?.profileHash)\n\t\t\t});\n\t\t}\n\t\tif (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? \"unknown\");\n\t}\n\treturn errorRuntime(\"CONTRACT.VERIFY_FAILED\", verifyResult.summary, {\n\t\twhy: \"Verification failed\",\n\t\tfix: \"Check contract and database state\"\n\t});\n}\nfunction errorInvalidVerifyMode(options) {\n\treturn new CliStructuredError(\"CLI.INVALID_VERIFY_MODE\", \"Invalid verify mode\", {\n\t\twhy: options.why,\n\t\tfix: options.fix,\n\t\tdocsUrl: \"https://pris.ly/db-verify\"\n\t});\n}\nfunction resolveDbVerifyMode(options) {\n\tif (options.markerOnly && options.schemaOnly) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--marker-only` and `--schema-only` cannot be used together\",\n\t\tfix: \"Choose one mode: omit both to check the marker and schema, use `--marker-only` to check only the marker, or use `--schema-only` to check only the live schema.\"\n\t}));\n\tif (options.markerOnly && options.strict) return notOk(errorInvalidVerifyMode({\n\t\twhy: \"`--strict` requires schema verification, but `--marker-only` skips it\",\n\t\tfix: \"Remove `--strict`, or use `db verify` / `db verify --schema-only` when you want to check the live schema in strict mode.\"\n\t}));\n\tif (options.schemaOnly) return ok(\"schema-only\");\n\tif (options.markerOnly) return ok(\"marker-only\");\n\treturn ok(\"full\");\n}\nfunction formatDbVerifyModeLabel(mode, strict) {\n\tif (mode === \"marker-only\") return \"marker only\";\n\tif (mode === \"schema-only\") return `schema only (${strict ? \"strict\" : \"tolerant\"})`;\n\treturn `full (marker + schema, ${strict ? \"strict\" : \"tolerant\"})`;\n}\nfunction formatDbVerifyInvocation(mode, strict) {\n\tconst args = [\"db verify\"];\n\tif (mode === \"marker-only\") args.push(\"--marker-only\");\n\tif (mode === \"schema-only\") args.push(\"--schema-only\");\n\tif (strict) args.push(\"--strict\");\n\treturn args.join(\" \");\n}\nfunction createDbVerifyConnectionRequiredError(options) {\n\tconst invocation = formatDbVerifyInvocation(options.mode, options.strict);\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${invocation} (set db.connection in ${options.configPath}, or pass --db <url>)`,\n\t\tretryCommand: `prisma-next ${invocation} --db <url>`\n\t});\n}\nfunction renderVerifyHeader(paths, options, mode, flags, ui) {\n\tif (flags.json || flags.quiet) return;\n\tconst description = mode === \"schema-only\" ? \"Check whether the live database schema matches your contract\" : mode === \"marker-only\" ? \"Check whether the database marker matches your contract\" : \"Check whether the database marker and live schema match your contract\";\n\tconst details = [\n\t\t{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: paths.configPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"contract\",\n\t\t\tvalue: paths.contractPath\n\t\t},\n\t\t{\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: formatDbVerifyModeLabel(mode, options.strict ?? false)\n\t\t}\n\t];\n\tif (options.db) details.push({\n\t\tlabel: \"database\",\n\t\tvalue: maskConnectionUrl(options.db)\n\t});\n\tui.stderr(formatStyledHeader({\n\t\tcommand: \"db verify\",\n\t\tdescription,\n\t\turl: \"https://pris.ly/db-verify\",\n\t\tdetails,\n\t\tflags\n\t}));\n}\nasync function resolveVerifyPaths(options) {\n\tconst 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\treturn {\n\t\tconfig,\n\t\tconfigPath,\n\t\tcontractPathAbsolute,\n\t\tcontractPath: relative(process.cwd(), contractPathAbsolute)\n\t};\n}\nasync function resolveVerifySetup(paths, options, mode) {\n\tconst { config, configPath, contractPathAbsolute, contractPath } = paths;\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = familyInstance.deserializeContract(JSON.parse(contractJsonContent));\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (typeof dbConnection !== \"string\" || dbConnection.length === 0) return notOk(createDbVerifyConnectionRequiredError({\n\t\tconfigPath,\n\t\tmode,\n\t\tstrict: options.strict ?? false\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${formatDbVerifyInvocation(mode, options.strict ?? false)}` }));\n\treturn ok({\n\t\t...paths,\n\t\tcontractJson,\n\t\tdbConnection\n\t});\n}\nfunction createVerifyClient(setup) {\n\treturn createControlClient({\n\t\tfamily: setup.config.family,\n\t\ttarget: setup.config.target,\n\t\tadapter: setup.config.adapter,\n\t\tdriver: setup.config.driver,\n\t\textensions: setup.config.extensions ?? []\n\t});\n}\nfunction wrapVerifyError(error, contractPathAbsolute, modeLabel) {\n\tif (CliStructuredError.is(error)) return notOk(error);\n\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during ${modeLabel}: ${error instanceof Error ? error.message : String(error)}` }));\n}\n/**\n* Executes the db verify command and returns a structured Result.\n*/\nasync function executeDbVerifyCommand(options, flags, ui, mode) {\n\tconst startTime = Date.now();\n\tconst paths = await resolveVerifyPaths(options);\n\trenderVerifyHeader(paths, options, mode, flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, mode);\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config);\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst verifyResult = await client.verify({\n\t\t\tcontract: contractJson,\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tif (!verifyResult.ok) return notOk(mapVerifyFailure(verifyResult));\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: mode === \"marker-only\",\n\t\t\tskipMarker: false,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\tif (mode === \"marker-only\") return ok({\n\t\t\tok: true,\n\t\t\tmode: \"marker-only\",\n\t\t\tsummary: \"Database marker matches contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\twarning: \"Schema verification skipped because --marker-only was provided\",\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"skipped\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst combined = combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed);\n\t\tif (!combined.result.ok) return notOk(combined);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: \"full\",\n\t\t\tsummary: \"Database marker and schema match contract\",\n\t\t\tcontract: verifyResult.contract,\n\t\t\tmarker: verifyResult.marker,\n\t\t\ttarget: verifyResult.target,\n\t\t\t...ifDefined(\"missingCodecs\", verifyResult.missingCodecs),\n\t\t\t...ifDefined(\"codecCoverageSkipped\", verifyResult.codecCoverageSkipped),\n\t\t\tschema: {\n\t\t\t\tsummary: combined.result.summary,\n\t\t\t\tstrict: combined.result.meta?.strict ?? false,\n\t\t\t\twarnings: (combined.result.schema.warnings?.issues ?? []).map((issue) => issue.path.join(\"/\"))\n\t\t\t},\n\t\t\tunclaimed: combined.unclaimed,\n\t\t\tmeta: {\n\t\t\t\t...verifyResult.meta ?? {},\n\t\t\t\tschemaVerification: \"performed\"\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify\");\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nasync function executeDbSchemaOnlyVerifyCommand(options, flags, ui) {\n\tconst paths = await resolveVerifyPaths(options);\n\trenderVerifyHeader(paths, options, \"schema-only\", flags, ui);\n\tconst setupResult = await resolveVerifySetup(paths, options, \"schema-only\");\n\tif (!setupResult.ok) return setupResult;\n\tconst { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;\n\tconst { migrationsDir } = resolveMigrationPaths(options.config, setupResult.value.config);\n\tconst client = createVerifyClient(setupResult.value);\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst aggregateResult = await client.dbVerify({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\tstrict: options.strict ?? false,\n\t\t\tskipSchema: false,\n\t\t\tskipMarker: true,\n\t\t\tonProgress\n\t\t});\n\t\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\t\treturn ok(combineVerifyResults(aggregateResult.value.schemaResults, aggregateResult.value.appSpaceId, options.strict ?? false, aggregateResult.value.unclaimed));\n\t} catch (error) {\n\t\treturn wrapVerifyError(error, contractPathAbsolute, \"db verify --schema-only\");\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createDbVerifyCommand() {\n\tconst command = new Command(\"verify\");\n\tsetCommandDescriptions(command, \"Check whether the database marker and live schema match your contract\", \"Verifies the database marker first, then checks the database schema matches your contract.\\nUse `--marker-only` for marker-only verification, `--schema-only` to skip marker checks and\\ninspect only the live schema, and `--strict` to fail if the database includes elements\\nnot present in the contract.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db verify --db $DATABASE_URL\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --schema-only --strict\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --marker-only\",\n\t\t\"prisma-next db verify --db $DATABASE_URL --json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--marker-only\", \"Skip schema verification and only check the database marker\").option(\"--schema-only\", \"Skip marker verification and only check whether the live schema satisfies the contract\").option(\"--strict\", \"Strict mode: schema elements not present in the contract are considered an error\", false).action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst modeResult = resolveDbVerifyMode(options);\n\t\tif (!modeResult.ok) {\n\t\t\tconst exitCode = handleResult(modeResult, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst mode = modeResult.value;\n\t\tif (mode === \"schema-only\") {\n\t\t\tconst result = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);\n\t\t\tconst exitCode = handleResult(result, flags, ui, (combined) => {\n\t\t\t\tif (flags.json) ui.output(formatSchemaVerifyJson(combined.result, combined.unclaimed));\n\t\t\t\telse {\n\t\t\t\t\tconst renderFlags = combined.result.ok ? flags : {\n\t\t\t\t\t\t...flags,\n\t\t\t\t\t\tquiet: false\n\t\t\t\t\t};\n\t\t\t\t\tconst output = formatSchemaVerifyOutput(combined.result, renderFlags, combined.unclaimed);\n\t\t\t\t\tif (output) ui.log(output);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (result.ok && !result.value.result.ok) process.exit(1);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tconst result = await executeDbVerifyCommand(options, flags, ui, mode);\n\t\tif (result.ok) {\n\t\t\tif (flags.json) ui.output(formatVerifyJson(result.value));\n\t\t\telse {\n\t\t\t\tconst output = formatVerifyOutput(result.value, flags);\n\t\t\t\tif (output) ui.log(output);\n\t\t\t}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (CliStructuredError.is(result.failure)) {\n\t\t\tconst exitCode = handleResult(result, flags, ui);\n\t\t\tprocess.exit(exitCode);\n\t\t}\n\t\tif (flags.json) ui.output(formatSchemaVerifyJson(result.failure.result, result.failure.unclaimed));\n\t\telse {\n\t\t\tconst output = formatSchemaVerifyOutput(result.failure.result, {\n\t\t\t\t...flags,\n\t\t\t\tquiet: false\n\t\t\t}, result.failure.unclaimed);\n\t\t\tif (output) ui.log(output);\n\t\t}\n\t\tprocess.exit(1);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbVerifyCommand as t };\n\n//# sourceMappingURL=db-verify-YWHjuKC7.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,qBAAqB,UAAU,YAAY,QAAQ,WAAW;CACtE,MAAM,YAAY,SAAS,IAAI,UAAU,KAAK,SAAS,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;CACvE,IAAI,cAAc,KAAK,GAAG,MAAM,IAAI,cAAc,iFAAiF;CACnI,IAAI,QAAQ;CACZ,IAAI;CACJ,IAAI,SAAS,CAAC;CACd,IAAI,gBAAgB,CAAC;CACrB,KAAK,MAAM,GAAG,WAAW,UAAU;EAClC,IAAI,CAAC,OAAO,IAAI;GACf,QAAQ;GACR,IAAI,iBAAiB,KAAK,GAAG,eAAe;EAC7C;EACA,SAAS,CAAC,GAAG,QAAQ,GAAG,OAAO,OAAO,MAAM;EAC5C,gBAAgB,CAAC,GAAG,eAAe,GAAG,OAAO,OAAO,UAAU,UAAU,CAAC,CAAC;CAC3E;CACA,MAAM,iBAAiB,UAAU,UAAU,SAAS;CACpD,MAAM,KAAK,SAAS,CAAC;CACrB,MAAM,UAAU,QAAQ,iBAAiB,uBAAuB,UAAU,OAAO,oBAAoB,UAAU,WAAW,IAAI,KAAK,IAAI,0BAA0B,UAAU,UAAU,UAAU,KAAK,cAAc,WAAW,UAAU,UAAU,UAAU;CAC3P,OAAO;EACN,QAAQ;GACP;GACA,GAAG,KAAK,CAAC,IAAI,EAA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AAO,KAAK,CAAC;QACnD;IACJ,MAAM,SAAS,mBAAmB,OAAO,OAAO,KAAK;IACrD,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;GACA,QAAQ,KAAK,CAAC;EACf;EACA,IAAIA,qBAAmB,GAAG,OAAO,OAAO,GAAG;GAC1C,MAAM,WAAW,aAAa,QAAQ,OAAO,EAAE;GAC/C,QAAQ,KAAK,QAAQ;EACtB;EACA,IAAI,MAAM,MAAM,GAAG,OAAO,uBAAuB,OAAO,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC;OAC5F;GACJ,MAAM,SAAS,yBAAyB,OAAO,QAAQ,QAAQ;IAC9D,GAAG;IACH,OAAO;GACR,GAAG,OAAO,QAAQ,SAAS;GAC3B,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
@@ -1,3 +1,4 @@
1
+ import { CliStructuredError } from "@prisma/orm-framework/errors/control";
1
2
  //#region ../../../1-framework/3-tooling/migration/dist/exports/errors.d.mts
2
3
  //#region src/errors.d.ts
3
4
  /**
@@ -14,18 +15,17 @@
14
15
  * - category: Always 'MIGRATION'
15
16
  * - why: Explains the cause in plain language
16
17
  * - fix: Actionable remediation step
17
- * - details: Machine-readable structured data for agents
18
+ * - meta: Machine-readable structured data for agents
18
19
  */
19
- declare class MigrationToolsError extends Error {
20
- readonly code: string;
21
- readonly category: "MIGRATION";
20
+ declare class MigrationToolsError extends CliStructuredError {
21
+ readonly category: 'MIGRATION';
22
+ readonly code: `MIGRATION.${string}`;
22
23
  readonly why: string;
23
24
  readonly fix: string;
24
- readonly details: Record<string, unknown> | undefined;
25
- constructor(code: string, summary: string, options: {
25
+ constructor(code: `MIGRATION.${string}`, summary: string, options: {
26
26
  readonly why: string;
27
27
  readonly fix: string;
28
- readonly details?: Record<string, unknown>;
28
+ readonly meta?: Record<string, unknown>;
29
29
  });
30
30
  static is(error: unknown): error is MigrationToolsError;
31
31
  }
@@ -69,4 +69,4 @@ declare function errorContractSnapshotMissing(storageHash: string, expectedPath:
69
69
  declare function errorContractSnapshotHashMismatch(storageHash: string, actualHash: string, dir: string): MigrationToolsError;
70
70
  //#endregion
71
71
  export { errorDescriptorHeadHashMismatch as a, errorNoInvariantPath as c, errorContractSnapshotMissing as i, errorUnknownInvariant as l, NoInvariantPathStructuralEdge as n, errorInvalidJson as o, errorContractSnapshotHashMismatch as r, errorInvalidRefName as s, MigrationToolsError as t };
72
- //# sourceMappingURL=errors--qsXZUtL.d.mts.map
72
+ //# sourceMappingURL=errors-AkMBj-YP.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-AkMBj-YP.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/errors.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;cAkBc,4BAA4B;WAC/B;WACA;WACA;WACA;EACT,YAAY,6BAA6B,iBAAiB;aAC/C;aACA;aACA,OAAO;;SAEX,GAAG,iBAAiB,SAAS;;iBAErB,iBAAiB,kBAAkB,qBAAqB;iBACxD,gCAAgC;WACtC;WACA;WACA;IACP;iBACa,oBAAoB,kBAAkB;;;;;;;;;;;;UAY7C;WACC;WACA;WACA;WACA;WACA;;iBAEM,qBAAqB;WAC3B;WACA;WACA;WACA,yBAAyB;IAChC;iBACa,sBAAsB;WAC5B;WACA;WACA;IACP;iBACa,6BAA6B,qBAAqB,uBAAuB;iBACzE,kCAAkC,qBAAqB,oBAAoB,cAAc"}
@@ -1,6 +1,7 @@
1
+ import { CliStructuredError } from "@prisma/orm-framework/errors/control";
1
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
3
  import { dirname, relative } from "pathe";
3
- //#region ../../../1-framework/3-tooling/migration/dist/errors-IpZm1Skp.mjs
4
+ //#region ../../../1-framework/3-tooling/migration/dist/errors-BwusfLIN.mjs
4
5
  /**
5
6
  * Build the canonical "re-emit this package" remediation hint.
6
7
  *
@@ -29,40 +30,30 @@ function reemitHint(dir, fallback) {
29
30
  * - category: Always 'MIGRATION'
30
31
  * - why: Explains the cause in plain language
31
32
  * - fix: Actionable remediation step
32
- * - details: Machine-readable structured data for agents
33
+ * - meta: Machine-readable structured data for agents
33
34
  */
34
- var MigrationToolsError = class extends Error {
35
- code;
36
- category = "MIGRATION";
37
- why;
38
- fix;
39
- details;
35
+ var MigrationToolsError = class extends CliStructuredError {
36
+ category;
40
37
  constructor(code, summary, options) {
41
- super(summary);
42
- this.name = "MigrationToolsError";
43
- this.code = code;
44
- this.why = options.why;
45
- this.fix = options.fix;
46
- this.details = options.details;
38
+ super(code, summary, options);
39
+ this.category = "MIGRATION";
47
40
  }
48
41
  static is(error) {
49
- if (!(error instanceof Error)) return false;
50
- const candidate = error;
51
- return candidate.name === "MigrationToolsError" && typeof candidate.code === "string";
42
+ return CliStructuredError.is(error) && "category" in error && error.category === "MIGRATION" && error.code.startsWith("MIGRATION.");
52
43
  }
53
44
  };
54
45
  function errorDirectoryExists(dir) {
55
46
  return new MigrationToolsError("MIGRATION.DIR_EXISTS", "Migration directory already exists", {
56
47
  why: `The directory "${dir}" already exists. Each migration must have a unique directory.`,
57
48
  fix: "Use --name to pick a different name, or delete the existing directory and re-run.",
58
- details: { dir }
49
+ meta: { dir }
59
50
  });
60
51
  }
61
52
  function errorMissingFile(file, dir) {
62
53
  return new MigrationToolsError("MIGRATION.FILE_MISSING", `Missing ${file}`, {
63
54
  why: `Expected "${file}" in "${dir}" but the file does not exist.`,
64
55
  fix: reemitHint(dir, "or delete the directory if the migration is unwanted and the source TypeScript is gone."),
65
- details: {
56
+ meta: {
66
57
  file,
67
58
  dir
68
59
  }
@@ -72,7 +63,7 @@ function errorInvalidJson(filePath, parseError) {
72
63
  return new MigrationToolsError("MIGRATION.INVALID_JSON", "Invalid JSON in migration file", {
73
64
  why: `Failed to parse "${filePath}": ${parseError}`,
74
65
  fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
75
- details: {
66
+ meta: {
76
67
  filePath,
77
68
  parseError
78
69
  }
@@ -82,7 +73,7 @@ function errorInvalidManifest(filePath, reason) {
82
73
  return new MigrationToolsError("MIGRATION.INVALID_MANIFEST", "Invalid migration manifest", {
83
74
  why: `Migration manifest at "${filePath}" is invalid: ${reason}`,
84
75
  fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
85
- details: {
76
+ meta: {
86
77
  filePath,
87
78
  reason
88
79
  }
@@ -92,14 +83,14 @@ function errorDescribeMissingEndContract() {
92
83
  return new MigrationToolsError("MIGRATION.DESCRIBE_INVALID", "Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.", {
93
84
  why: "Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.",
94
85
  fix: "Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.",
95
- details: { reason: "missing-end-contract" }
86
+ meta: { reason: "missing-end-contract" }
96
87
  });
97
88
  }
98
89
  function errorDescribeInvalidMetadata(summary) {
99
90
  return new MigrationToolsError("MIGRATION.DESCRIBE_INVALID", `describe() returned invalid metadata: ${summary}`, {
100
91
  why: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,
101
92
  fix: "Ensure describe() returns { from: string | null, to: string } with valid contract hashes.",
102
- details: {
93
+ meta: {
103
94
  reason: "invalid-metadata",
104
95
  summary
105
96
  }
@@ -109,21 +100,21 @@ function errorOperationsNotArray() {
109
100
  return new MigrationToolsError("MIGRATION.PLAN_NOT_ARRAY", "operations must be an array", {
110
101
  why: "The migration instance's `operations` getter returned a non-array value.",
111
102
  fix: "Ensure the `operations` getter returns an array of migration operations.",
112
- details: {}
103
+ meta: {}
113
104
  });
114
105
  }
115
106
  function errorSpaceHeadRefMissing(spaceId) {
116
107
  return new MigrationToolsError("MIGRATION.CHECK_HEAD_REF_MISSING", `Contract space "${spaceId}" has no head ref; its contract cannot be resolved from the snapshot store without one.`, {
117
108
  why: `Contract space "${spaceId}" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,
118
109
  fix: "Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.",
119
- details: { spaceId }
110
+ meta: { spaceId }
120
111
  });
121
112
  }
122
113
  function errorInvalidOperationEntry(index, reason) {
123
114
  return new MigrationToolsError("MIGRATION.INVALID_OPERATION_ENTRY", "Migration operation entry is malformed", {
124
115
  why: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,
125
116
  fix: "Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').",
126
- details: {
117
+ meta: {
127
118
  index,
128
119
  reason
129
120
  }
@@ -133,21 +124,21 @@ function errorInvalidSlug(slug) {
133
124
  return new MigrationToolsError("MIGRATION.INVALID_NAME", "Invalid migration name", {
134
125
  why: `The slug "${slug}" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,
135
126
  fix: "Provide a name with at least one alphanumeric character, e.g. --name add_users.",
136
- details: { slug }
127
+ meta: { slug }
137
128
  });
138
129
  }
139
130
  function errorInvalidDestName(destName) {
140
131
  return new MigrationToolsError("MIGRATION.INVALID_DEST_NAME", "Invalid copy destination name", {
141
132
  why: `The destination name "${destName}" must be a single path segment (no ".." or directory separators).`,
142
133
  fix: "Use a simple file name such as \"contract.json\" for each destination in the copy list.",
143
- details: { destName }
134
+ meta: { destName }
144
135
  });
145
136
  }
146
137
  function errorInvalidSpaceId(spaceId) {
147
138
  return new MigrationToolsError("MIGRATION.INVALID_SPACE_ID", "Invalid contract space identifier", {
148
139
  why: `The space id "${spaceId}" does not match the required pattern /^[a-z][a-z0-9_-]{0,63}$/. Space ids are used as filesystem directory names under \`migrations/\`, so the pattern is conservative on purpose.`,
149
140
  fix: "Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.",
150
- details: { spaceId }
141
+ meta: { spaceId }
151
142
  });
152
143
  }
153
144
  function errorDescriptorHeadHashMismatch(args) {
@@ -155,7 +146,7 @@ function errorDescriptorHeadHashMismatch(args) {
155
146
  return new MigrationToolsError("MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH", "Extension descriptor's headRef.hash does not match its contractJson", {
156
147
  why: `Extension "${extensionId}" publishes a \`contractSpace\` whose \`headRef.hash\` (${headRefHash}) does not match the canonical hash recomputed from \`contractSpace.contractJson\` (${recomputedHash}). This means the extension descriptor was published with stale \`headRef.hash\` — typically because the contract was bumped without rerunning the extension's emit pipeline.`,
157
148
  fix: "Re-run the extension authoring pipeline so `contractJson.storage.storageHash` and `headRef.hash` agree, then republish the extension. If you are the extension author and you intentionally bumped `contractJson`, recompute and update `headRef.hash` (and refresh any on-disk migration metadata that derives from it).",
158
- details: {
149
+ meta: {
159
150
  extensionId,
160
151
  recomputedHash,
161
152
  headRefHash
@@ -166,7 +157,7 @@ function errorDuplicateSpaceId(spaceId) {
166
157
  return new MigrationToolsError("MIGRATION.DUPLICATE_SPACE_ID", "Duplicate contract space identifier", {
167
158
  why: `The space id "${spaceId}" appears more than once in the per-space planner input. Each space id must be unique across the inputs (the per-space planner emits one output entry per id).`,
168
159
  fix: "Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.",
169
- details: { spaceId }
160
+ meta: { spaceId }
170
161
  });
171
162
  }
172
163
  function errorAmbiguousTarget(branchTips, context) {
@@ -174,7 +165,7 @@ function errorAmbiguousTarget(branchTips, context) {
174
165
  return new MigrationToolsError("MIGRATION.AMBIGUOUS_TARGET", "Ambiguous migration target", {
175
166
  why: `The migration history has diverged into multiple branches: ${branchTips.join(", ")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,
176
167
  fix: "Use `ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `migration plan`, or use --from <hash> to explicitly select a starting point.",
177
- details: {
168
+ meta: {
178
169
  branchTips,
179
170
  ...context ? {
180
171
  divergencePoint: context.divergencePoint,
@@ -187,14 +178,14 @@ function errorNoInitialMigration(nodes) {
187
178
  return new MigrationToolsError("MIGRATION.NO_INITIAL_MIGRATION", "No initial migration found", {
188
179
  why: `No migration starts from the empty contract state (known hashes: ${nodes.join(", ")}). At least one migration must originate from the empty state.`,
189
180
  fix: "Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.",
190
- details: { nodes }
181
+ meta: { nodes }
191
182
  });
192
183
  }
193
184
  function errorInvalidRefFile(filePath, reason) {
194
185
  return new MigrationToolsError("MIGRATION.INVALID_REF_FILE", "Invalid ref file", {
195
186
  why: `Ref file at "${filePath}" is invalid: ${reason}`,
196
187
  fix: "Ensure the ref file contains valid JSON with { \"hash\": \"<64 hex chars>\", \"invariants\": [\"...\"] }.",
197
- details: {
188
+ meta: {
198
189
  path: filePath,
199
190
  reason
200
191
  }
@@ -204,35 +195,35 @@ function errorInvalidRefName(refName) {
204
195
  return new MigrationToolsError("MIGRATION.INVALID_REF_NAME", "Invalid ref name", {
205
196
  why: `Ref name "${refName}" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no "." or ".." segments).`,
206
197
  fix: `Use a valid ref name (e.g., "staging", "envs/production").`,
207
- details: { refName }
198
+ meta: { refName }
208
199
  });
209
200
  }
210
201
  function errorNoTarget(reachableHashes) {
211
202
  return new MigrationToolsError("MIGRATION.NO_TARGET", "No migration target could be resolved", {
212
203
  why: `The migration history contains cycles and no target can be resolved automatically (reachable hashes: ${reachableHashes.join(", ")}). This typically happens after rollback migrations (e.g., C1→C2→C1).`,
213
204
  fix: "Use --from <hash> to specify the planning origin explicitly.",
214
- details: { reachableHashes }
205
+ meta: { reachableHashes }
215
206
  });
216
207
  }
217
208
  function errorInvalidRefValue(value) {
218
209
  return new MigrationToolsError("MIGRATION.INVALID_REF_VALUE", "Invalid ref value", {
219
210
  why: `Ref value "${value}" is not a valid contract hash. Values must be a 64-character hex digest or "empty".`,
220
211
  fix: "Use a valid storage hash from `prisma-next contract emit` output or an existing migration.",
221
- details: { value }
212
+ meta: { value }
222
213
  });
223
214
  }
224
215
  function errorInvalidInvariantId(invariantId) {
225
216
  return new MigrationToolsError("MIGRATION.INVALID_INVARIANT_ID", "Invalid invariantId", {
226
217
  why: `invariantId ${JSON.stringify(invariantId)} is invalid. Ids must be non-empty and contain no whitespace or control characters (including Unicode whitespace like NBSP); other content (kebab-case, camelCase, namespaced, Unicode letters) is allowed.`,
227
218
  fix: "Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \"backfill-user-phone\", \"users/backfill-phone\", or \"BackfillUserPhone\".",
228
- details: { invariantId }
219
+ meta: { invariantId }
229
220
  });
230
221
  }
231
222
  function errorDuplicateInvariantInEdge(invariantId) {
232
223
  return new MigrationToolsError("MIGRATION.DUPLICATE_INVARIANT_IN_EDGE", "Duplicate invariantId on a single migration", {
233
224
  why: `invariantId "${invariantId}" is declared by more than one dataTransform on the same migration. The marker stores invariants as a set and the routing layer treats them as edge-level, so two ops cannot share a routing identity.`,
234
225
  fix: "Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.",
235
- details: { invariantId }
226
+ meta: { invariantId }
236
227
  });
237
228
  }
238
229
  function errorProvidedInvariantsMismatch(filePath, stored, derived) {
@@ -243,7 +234,7 @@ function errorProvidedInvariantsMismatch(filePath, stored, derived) {
243
234
  return new MigrationToolsError("MIGRATION.PROVIDED_INVARIANTS_MISMATCH", "providedInvariants on migration.json disagrees with ops.json", {
244
235
  why: missing.length === 0 && extra.length === 0 ? `migration.json at "${filePath}" stores providedInvariants ${JSON.stringify(stored)}, but the canonical value derived from ops.json is ${JSON.stringify(derived)} — same ids, different order. Canonical providedInvariants is sorted ascending.` : `migration.json at "${filePath}" stores providedInvariants ${JSON.stringify(stored)}, but the value derived from ops.json is ${JSON.stringify(derived)}. The manifest copy was likely hand-edited without re-emitting.`,
245
236
  fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
246
- details: {
237
+ meta: {
247
238
  filePath,
248
239
  stored,
249
240
  derived,
@@ -261,7 +252,7 @@ function errorNoInvariantPath(args) {
261
252
  return new MigrationToolsError("MIGRATION.NO_INVARIANT_PATH", "No path covers the required invariants", {
262
253
  why: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(", ")}], missing=[${missingList}].`,
263
254
  fix: "Add a migration on the path that runs `dataTransform({ invariantId: \"<id>\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.",
264
- details: {
255
+ meta: {
265
256
  required,
266
257
  missing,
267
258
  structuralPath,
@@ -274,7 +265,7 @@ function errorUnknownInvariant(args) {
274
265
  return new MigrationToolsError("MIGRATION.UNKNOWN_INVARIANT", "Ref declares invariants no migration in the graph provides", {
275
266
  why: `${refName ? `Ref "${refName}" declares` : "Declares"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(", ")}].`,
276
267
  fix: "Either the ref has a typo, or the declaring migration has not been authored/attested yet. Re-check the ref file and the migrations directory.",
277
- details: {
268
+ meta: {
278
269
  unknown,
279
270
  declared,
280
271
  ...ifDefined("refName", refName)
@@ -285,7 +276,7 @@ function errorMigrationHashMismatch(dir, storedHash, computedHash) {
285
276
  return new MigrationToolsError("MIGRATION.HASH_MISMATCH", "Migration package is corrupt", {
286
277
  why: `Stored migrationHash "${storedHash}" does not match the recomputed hash "${computedHash}" for "${relative(process.cwd(), dir)}". The migration.json or ops.json has been edited or partially written since emit.`,
287
278
  fix: reemitHint(dir, "or restore the directory from version control."),
288
- details: {
279
+ meta: {
289
280
  dir,
290
281
  storedHash,
291
282
  computedHash
@@ -302,7 +293,7 @@ function errorRefNotResolvable(refName) {
302
293
  return new MigrationToolsError("MIGRATION.REF_NOT_RESOLVABLE", `Ref "${refName}" is not resolvable`, {
303
294
  why: `Ref "${refName}" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,
304
295
  fix: `Create the ref with "prisma-next ref set ${refName} <hash>" (or advance it via "prisma-next db update --advance-ref ${refName}"), or pass a hash that is a node in the migration graph.`,
305
- details: {
296
+ meta: {
306
297
  refName,
307
298
  identifier: refName
308
299
  }
@@ -312,7 +303,7 @@ function errorBundleNotFoundForGraphNode(hash, explicitLabel) {
312
303
  return new MigrationToolsError("MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE", explicitLabel ? `No migration bundle found for reference "${explicitLabel}" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {
313
304
  why: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\`to\`) hash matching it.`,
314
305
  fix: "Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.",
315
- details: {
306
+ meta: {
316
307
  hash,
317
308
  ...explicitLabel ? { explicitLabel } : {}
318
309
  }
@@ -322,7 +313,7 @@ function errorContractDeserializationFailed(filePath, message) {
322
313
  return new MigrationToolsError("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract failed to deserialize", {
323
314
  why: `Contract at "${filePath}" failed to deserialize: ${message}`,
324
315
  fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
325
- details: {
316
+ meta: {
326
317
  filePath,
327
318
  message
328
319
  }
@@ -334,7 +325,7 @@ function errorHashNotInGraph(hash, graph) {
334
325
  return new MigrationToolsError("MIGRATION.HASH_NOT_IN_GRAPH", `Hash "${hash}" is not a node in the migration graph`, {
335
326
  why: `The migration graph contains nodes ${reachableList}; "${hash}" isn't one of them.`,
336
327
  fix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run "prisma-next migration plan" to introduce it.`,
337
- details: {
328
+ meta: {
338
329
  hash,
339
330
  reachableHashes
340
331
  }
@@ -344,7 +335,7 @@ function errorContractSnapshotMissing(storageHash, expectedPath) {
344
335
  return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_MISSING", "Contract snapshot is missing", {
345
336
  why: `Expected a contract snapshot for ${storageHash} at "${expectedPath}" but the file does not exist.`,
346
337
  fix: "Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`prisma-next migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.",
347
- details: {
338
+ meta: {
348
339
  storageHash,
349
340
  expectedPath
350
341
  }
@@ -354,7 +345,7 @@ function errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {
354
345
  return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH", "Contract snapshot hash mismatch", {
355
346
  why: `The contract JSON's inner storage.storageHash ("${actualHash}") does not match the requested storage hash ("${storageHash}") for snapshot directory "${dir}".`,
356
347
  fix: "Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.",
357
- details: {
348
+ meta: {
358
349
  storageHash,
359
350
  actualHash,
360
351
  dir
@@ -365,7 +356,7 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
365
356
  return new MigrationToolsError("MIGRATION.CONTRACT_VIEW_MISSING", `${className}.${accessor} requires ${jsonField}`, {
366
357
  why: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,
367
358
  fix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,
368
- details: {
359
+ meta: {
369
360
  className,
370
361
  accessor,
371
362
  jsonField
@@ -375,4 +366,4 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
375
366
  //#endregion
376
367
  export { errorOperationsNotArray as A, errorInvalidSpaceId as C, errorNoInitialMigration as D, errorMissingFile as E, errorRefNotResolvable as M, errorSpaceHeadRefMissing as N, errorNoInvariantPath as O, errorUnknownInvariant as P, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractDeserializationFailed as i, errorProvidedInvariantsMismatch as j, errorNoTarget as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorAmbiguousTarget as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorBundleNotFoundForGraphNode as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };
377
368
 
378
- //# sourceMappingURL=errors-IpZm1Skp-BH495dRd.mjs.map
369
+ //# sourceMappingURL=errors-BwusfLIN-BXM7K-ww.mjs.map