@prisma/orm-toolchain 8.0.0-rc.1-dev.6 → 8.0.0-rc.1-dev.8
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.
- package/dist/{aggregate-i-rfetSO.mjs → aggregate-D53gnb7v.mjs} +8 -8
- package/dist/{aggregate-i-rfetSO.mjs.map → aggregate-D53gnb7v.mjs.map} +1 -1
- package/dist/bin__prisma-next.mjs +22 -22
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs +14 -0
- package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs.map +1 -0
- package/dist/{types-2n_H3DQ9-Bks8UPEO.d.mts → cli-errors-CDr3WcJP-NFry5GHb.d.mts} +2 -2
- package/dist/cli-errors-CDr3WcJP-NFry5GHb.d.mts.map +1 -0
- package/dist/cli.mjs +2 -2
- package/dist/cli__commands__contract-emit.mjs +1 -1
- package/dist/cli__commands__contract-infer.mjs +1 -1
- package/dist/cli__commands__db-init.mjs +1 -1
- package/dist/cli__commands__db-schema.mjs +1 -1
- package/dist/cli__commands__db-sign.mjs +1 -1
- package/dist/cli__commands__db-update.mjs +1 -1
- package/dist/cli__commands__db-verify.mjs +1 -1
- package/dist/cli__commands__migrate.d.mts +3 -12
- package/dist/cli__commands__migrate.d.mts.map +1 -1
- package/dist/cli__commands__migrate.mjs +1 -1
- package/dist/cli__commands__migration-check.d.mts +1 -57
- package/dist/cli__commands__migration-check.d.mts.map +1 -1
- package/dist/cli__commands__migration-check.mjs +2 -2
- package/dist/cli__commands__migration-graph.d.mts +1 -1
- package/dist/cli__commands__migration-graph.mjs +1 -1
- package/dist/cli__commands__migration-list.d.mts +4 -44
- package/dist/cli__commands__migration-list.d.mts.map +1 -1
- package/dist/cli__commands__migration-list.mjs +2 -2
- package/dist/cli__commands__migration-log.d.mts +1 -1
- package/dist/cli__commands__migration-log.mjs +1 -1
- package/dist/cli__commands__migration-new.mjs +1 -1
- package/dist/cli__commands__migration-plan.d.mts +2 -47
- package/dist/cli__commands__migration-plan.d.mts.map +1 -1
- package/dist/cli__commands__migration-plan.mjs +1 -1
- package/dist/cli__commands__migration-show.mjs +1 -1
- package/dist/cli__commands__migration-status.d.mts +1 -1
- package/dist/cli__commands__migration-status.mjs +1 -1
- package/dist/cli__commands__ref.d.mts +1 -28
- package/dist/cli__commands__ref.d.mts.map +1 -1
- package/dist/cli__commands__ref.mjs +2 -2
- package/dist/cli__commands__telemetry.mjs +1 -1
- package/dist/cli__control-api.d.mts +502 -2
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +18 -3
- package/dist/cli__migration-cli.mjs +2 -2
- package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs → client-Y6qbDk7X-BzKLmBZo.mjs} +8 -8
- package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs.map → client-Y6qbDk7X-BzKLmBZo.mjs.map} +1 -1
- package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs → command-helpers-C4WpR-QE-DE494TSG.mjs} +2 -2
- package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs.map → command-helpers-C4WpR-QE-DE494TSG.mjs.map} +1 -1
- package/dist/config-loader.d.mts +2 -18
- package/dist/{contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs → contract-at-errors-Dv1mxKYO-C29YB4RC.mjs} +4 -4
- package/dist/contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map +1 -0
- package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs → contract-emit-CTm2zfuG-7PV9SBY6.mjs} +4 -4
- package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs.map → contract-emit-CTm2zfuG-7PV9SBY6.mjs.map} +1 -1
- package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs → contract-emit-D8IXP9Qp-Df6NwXn8.mjs} +3 -3
- package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs.map → contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map} +1 -1
- package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs → contract-infer-BwT7ngoo-Dx6aAwIN.mjs} +4 -4
- package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs.map → contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map} +1 -1
- package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs +82 -0
- package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map +1 -0
- package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs} +3 -3
- package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs → contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs} +6 -6
- package/dist/contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map +1 -0
- package/dist/{db-init-CXMcvoIA.mjs → db-init-CBj_EWg3.mjs} +15 -26
- package/dist/db-init-CBj_EWg3.mjs.map +1 -0
- package/dist/{db-schema-j8DERh4t.mjs → db-schema-BWpeh0Q_.mjs} +4 -4
- package/dist/{db-schema-j8DERh4t.mjs.map → db-schema-BWpeh0Q_.mjs.map} +1 -1
- package/dist/{db-sign-xV_rpoIc.mjs → db-sign-DCb_DKtv.mjs} +13 -29
- package/dist/db-sign-DCb_DKtv.mjs.map +1 -0
- package/dist/{db-update-DXa2DIvu.mjs → db-update-WX0KitcX.mjs} +27 -50
- package/dist/db-update-WX0KitcX.mjs.map +1 -0
- package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs} +5 -5
- package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs.map → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map} +1 -1
- package/dist/{errors-BwusfLIN-BXM7K-ww.mjs → errors-Co-8oaiB-CB-6Uqki.mjs} +5 -4
- package/dist/{errors-BwusfLIN-BXM7K-ww.mjs.map → errors-Co-8oaiB-CB-6Uqki.mjs.map} +1 -1
- package/dist/{errors-AkMBj-YP.d.mts → errors-NRmFpwR1.d.mts} +6 -2
- package/dist/errors-NRmFpwR1.d.mts.map +1 -0
- package/dist/{format-Bw3LVJ1v-D10inUT9.mjs → format-Bw3LVJ1v-BJ6lVFMA.mjs} +2 -2
- package/dist/{format-Bw3LVJ1v-D10inUT9.mjs.map → format-Bw3LVJ1v-BJ6lVFMA.mjs.map} +1 -1
- package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs → framework-components-3DdB31mk-BHyX-OlJ.mjs} +2 -2
- package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs.map → framework-components-3DdB31mk-BHyX-OlJ.mjs.map} +1 -1
- package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs → graph-membership-BEmNEMtP-rz61CLM5.mjs} +3 -3
- package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs.map → graph-membership-BEmNEMtP-rz61CLM5.mjs.map} +1 -1
- package/dist/index-Df9igRvP.d.mts +18 -0
- package/dist/index-Df9igRvP.d.mts.map +1 -0
- package/dist/{init-CPB89WK2-Di4kgP6B.mjs → init-CPB89WK2-DPZRZ9Ee.mjs} +3 -3
- package/dist/{init-CPB89WK2-Di4kgP6B.mjs.map → init-CPB89WK2-DPZRZ9Ee.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs} +4 -4
- package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map} +1 -1
- package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs +52 -0
- package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs.map +1 -0
- package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs → invariants-C1WVUAH7-DlOBTTkM.mjs} +3 -3
- package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs.map → invariants-C1WVUAH7-DlOBTTkM.mjs.map} +1 -1
- package/dist/{io-CL3hSv42-DGZtTs89.mjs → io-CHUUeHh0-CoCBe9eN.mjs} +5 -5
- package/dist/{io-CL3hSv42-DGZtTs89.mjs.map → io-CHUUeHh0-CoCBe9eN.mjs.map} +1 -1
- package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs +22 -0
- package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs.map +1 -0
- package/dist/{migrate-COusRrm7.mjs → migrate-B-NAuO90.mjs} +87 -230
- package/dist/migrate-B-NAuO90.mjs.map +1 -0
- package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts +56 -0
- package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts.map +1 -0
- package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs +202 -0
- package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +1 -0
- package/dist/{migration-diUAhNaa.mjs → migration-DAJY-NmR.mjs} +3 -3
- package/dist/{migration-diUAhNaa.mjs.map → migration-DAJY-NmR.mjs.map} +1 -1
- package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs +254 -0
- package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +1 -0
- package/dist/{migration-check-CueEJelQ-J81XR_ns.mjs → migration-check-DONPyXff-CGTUpLv-.mjs} +12 -254
- package/dist/migration-check-DONPyXff-CGTUpLv-.mjs.map +1 -0
- package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs} +4 -4
- package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map} +1 -1
- package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs → migration-graph-DDaOHo10-yJFAbKCu.mjs} +3 -3
- package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs.map → migration-graph-DDaOHo10-yJFAbKCu.mjs.map} +1 -1
- package/dist/{migration-graph-BL6vfLcE.mjs → migration-graph-Dn469b0l.mjs} +10 -19
- package/dist/migration-graph-Dn469b0l.mjs.map +1 -0
- package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs +35 -0
- package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map +1 -0
- package/dist/migration-list-C9OPCMt--C28yBgVr.mjs +102 -0
- package/dist/migration-list-C9OPCMt--C28yBgVr.mjs.map +1 -0
- package/dist/migration-list-jk4iCtmO.mjs +120 -0
- package/dist/migration-list-jk4iCtmO.mjs.map +1 -0
- package/dist/{migration-log-BXbz6-Lj-CKHbat5f.mjs → migration-log-DQzUBrm8-D3m9wcuf.mjs} +7 -5
- package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +1 -0
- package/dist/migration-new-BkSY6m0t.mjs +50 -0
- package/dist/migration-new-BkSY6m0t.mjs.map +1 -0
- package/dist/{migration-new-szZFsA3C.mjs → migration-new-g98oB3nC-BcrkxAAt.mjs} +12 -52
- package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +1 -0
- package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs → migration-path-target-BPYp3LNc-DsDdLU0J.mjs} +2 -2
- package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map → migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map} +1 -1
- package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts +159 -0
- package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts.map +1 -0
- package/dist/migration-plan-CjIYMJZy.mjs +172 -0
- package/dist/migration-plan-CjIYMJZy.mjs.map +1 -0
- package/dist/{migration-plan-CxXAXYc8-Dnp-v8Nl.mjs → migration-plan-CwuZLXVE-DAJ-JUQT.mjs} +45 -183
- package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +1 -0
- package/dist/{migration-show-BKsIh7Uz.mjs → migration-show-CW6EKtfw.mjs} +13 -9
- package/dist/migration-show-CW6EKtfw.mjs.map +1 -0
- package/dist/{migration-status-CNnRInne--cvmx56T.mjs → migration-status-DSQcBhiN.mjs} +37 -68
- package/dist/migration-status-DSQcBhiN.mjs.map +1 -0
- package/dist/migration-tools.d.mts +4 -4
- package/dist/migration-tools.mjs +13 -13
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.d.mts +2 -2
- package/dist/migration-tools__errors.mjs +2 -2
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs → project-import-root-C_bd0ooL-WkbJLnAA.mjs} +2 -2
- package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs.map → project-import-root-C_bd0ooL-WkbJLnAA.mjs.map} +1 -1
- package/dist/ref-DSAZime8.mjs +72 -0
- package/dist/ref-DSAZime8.mjs.map +1 -0
- package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs +96 -0
- package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs.map +1 -0
- package/dist/ref-eJjxzYTh-CNiyDL4p.mjs +109 -0
- package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +1 -0
- package/dist/{ref-resolution-BsdziDFA.mjs → ref-resolution-Ct2GMcNB.mjs} +2 -2
- package/dist/{ref-resolution-BsdziDFA.mjs.map → ref-resolution-Ct2GMcNB.mjs.map} +1 -1
- package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs +16 -0
- package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map +1 -0
- package/dist/{refs-DtoeUivZ-qay0UMSP.mjs → refs-B2BL8z3i-DGGFB7Mj.mjs} +3 -3
- package/dist/{refs-DtoeUivZ-qay0UMSP.mjs.map → refs-B2BL8z3i-DGGFB7Mj.mjs.map} +1 -1
- package/dist/refs-fQLFcMoq-UTlvnijY.mjs +47 -0
- package/dist/refs-fQLFcMoq-UTlvnijY.mjs.map +1 -0
- package/dist/{spaces-BNd2Tlk0.mjs → spaces-DxuvClN9.mjs} +6 -6
- package/dist/{spaces-BNd2Tlk0.mjs.map → spaces-DxuvClN9.mjs.map} +1 -1
- package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs → telemetry-DVBHDQd6-Ckn5oClN.mjs} +2 -2
- package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs.map → telemetry-DVBHDQd6-Ckn5oClN.mjs.map} +1 -1
- package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs → verify-C6L_hiJU-B4V3bqvG.mjs} +2 -2
- package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs.map → verify-C6L_hiJU-B4V3bqvG.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs} +4 -4
- package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +0 -1
- package/dist/db-init-CXMcvoIA.mjs.map +0 -1
- package/dist/db-sign-xV_rpoIc.mjs.map +0 -1
- package/dist/db-update-DXa2DIvu.mjs.map +0 -1
- package/dist/errors-AkMBj-YP.d.mts.map +0 -1
- package/dist/migrate-COusRrm7.mjs.map +0 -1
- package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +0 -1
- package/dist/migration-graph-BL6vfLcE.mjs.map +0 -1
- package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs +0 -228
- package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs.map +0 -1
- package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +0 -1
- package/dist/migration-new-szZFsA3C.mjs.map +0 -1
- package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +0 -1
- package/dist/migration-show-BKsIh7Uz.mjs.map +0 -1
- package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +0 -1
- package/dist/ref-DjZ5Y8ju.mjs +0 -171
- package/dist/ref-DjZ5Y8ju.mjs.map +0 -1
- package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs +0 -57
- package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map +0 -1
- package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-schema-
|
|
1
|
+
{"version":3,"file":"db-schema-BWpeh0Q_.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/db-schema.mjs"],"sourcesContent":["import { _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { t as inspectLiveSchema } from \"../inspect-live-schema-Da76TWOs.mjs\";\nimport { n as formatIntrospectOutput, t as formatIntrospectJson } from \"../verify-C6L_hiJU.mjs\";\nimport { Command } from \"commander\";\n//#region src/commands/db-schema.ts\nfunction toIntrospectSchemaResult(result) {\n\treturn {\n\t\tok: true,\n\t\tsummary: \"Schema read successfully\",\n\t\ttarget: result.target,\n\t\tschema: result.schema,\n\t\tmeta: result.meta,\n\t\ttimings: result.timings\n\t};\n}\nfunction createDbSchemaCommand() {\n\tconst command = new Command(\"schema\");\n\tsetCommandDescriptions(command, \"Inspect the live database schema\", \"Reads the live database schema and prints it as a tree by default or as JSON with\\n--json. This command is always read-only and never writes files. To save machine-\\nreadable output, use shell redirection, for example `prisma-next db schema --json > schema.json`.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next db schema --db $DATABASE_URL\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json\",\n\t\t\"prisma-next db schema --db $DATABASE_URL --json > schema.json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await inspectLiveSchema(options, flags, ui, Date.now(), {\n\t\t\tcommandName: \"db schema\",\n\t\t\tdescription: \"Inspect the live database schema\",\n\t\t\turl: \"https://pris.ly/db-schema\"\n\t\t}), flags, ui, (value) => {\n\t\t\tconst introspectResult = toIntrospectSchemaResult(value);\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(formatIntrospectJson(introspectResult));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst output = formatIntrospectOutput(introspectResult, value.schemaView, flags);\n\t\t\tif (output) ui.log(output);\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createDbSchemaCommand };\n\n//# sourceMappingURL=db-schema.mjs.map"],"mappings":";;;;;AAKA,SAAS,yBAAyB,QAAQ;CACzC,OAAO;EACN,IAAI;EACJ,SAAS;EACT,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;CACjB;AACD;AACA,SAAS,wBAAwB;CAChC,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBAAuB,SAAS,oCAAoC,yQAAyQ;CAC7U,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EACjK,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,kBAAkB,SAAS,OAAO,IAAI,KAAK,IAAI,GAAG;GACrF,aAAa;GACb,aAAa;GACb,KAAK;EACN,CAAC,GAAG,OAAO,KAAK,UAAU;GACzB,MAAM,mBAAmB,yBAAyB,KAAK;GACvD,IAAI,MAAM,MAAM;IACf,GAAG,OAAO,qBAAqB,gBAAgB,CAAC;IAChD;GACD;GACA,MAAM,SAAS,uBAAuB,kBAAkB,MAAM,YAAY,KAAK;GAC/E,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { r as readContractSnapshotJson } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
|
|
3
|
-
import { N as errorUnexpected, O as errorRuntime$1, Q as maskConnectionUrl, W as formatStyledHeader, Z as mapRefResolutionError, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, 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";
|
|
1
|
+
import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, 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-DE494TSG.mjs";
|
|
4
2
|
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
5
3
|
import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "./verify-C6L_hiJU-CN3eEe3Y.mjs";
|
|
4
|
+
import { t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
|
|
5
|
+
import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs";
|
|
6
|
+
import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "./verify-C6L_hiJU-B4V3bqvG.mjs";
|
|
10
7
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
11
8
|
import { relative, resolve } from "pathe";
|
|
12
9
|
import { readFile } from "node:fs/promises";
|
|
@@ -48,29 +45,16 @@ async function executeDbSignCommand(contractArg, options, flags, ui) {
|
|
|
48
45
|
let contractJson;
|
|
49
46
|
if (effectiveContractArg) try {
|
|
50
47
|
const { migrationsDir } = resolveMigrationPaths(options.config, config);
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
graph,
|
|
58
|
-
refs
|
|
48
|
+
const resolved = await resolveContractRefToSnapshot({
|
|
49
|
+
config,
|
|
50
|
+
migrationsDir,
|
|
51
|
+
refInput: effectiveContractArg,
|
|
52
|
+
contractPathAbsolute,
|
|
53
|
+
fallbackToEmitted: true
|
|
59
54
|
});
|
|
60
|
-
if (!
|
|
61
|
-
|
|
62
|
-
if (bundles.find((p) => p.metadata.to === targetHash)) contractJson = await readContractSnapshotJson(migrationsDir, targetHash);
|
|
63
|
-
else {
|
|
64
|
-
const defaultRaw = await readFile(contractPathAbsolute, "utf-8");
|
|
65
|
-
const defaultContract = JSON.parse(defaultRaw);
|
|
66
|
-
if (defaultContract["storage"]?.["storageHash"] === targetHash) contractJson = defaultContract;
|
|
67
|
-
else return notOk(errorRuntime$1("MIGRATION.SNAPSHOT_MISSING", `No contract file found for hash "${targetHash}"`, {
|
|
68
|
-
why: `Resolved contract reference "${effectiveContractArg}" to hash "${targetHash}" but no migration produces that hash and the emitted contract does not match.`,
|
|
69
|
-
fix: "Ensure the target contract exists on disk — either as a migration endpoint or as the emitted contract.json."
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
55
|
+
if (!resolved.ok) return notOk(resolved.failure);
|
|
56
|
+
contractJson = resolved.value.contractJson;
|
|
72
57
|
} catch (error) {
|
|
73
|
-
if (MigrationToolsError.is(error)) return notOk(error);
|
|
74
58
|
if (error instanceof CliStructuredError$1) return notOk(error);
|
|
75
59
|
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to resolve contract reference: ${error instanceof Error ? error.message : String(error)}` }));
|
|
76
60
|
}
|
|
@@ -172,4 +156,4 @@ function createDbSignCommand() {
|
|
|
172
156
|
//#endregion
|
|
173
157
|
export { createDbSignCommand as t };
|
|
174
158
|
|
|
175
|
-
//# sourceMappingURL=db-sign-
|
|
159
|
+
//# sourceMappingURL=db-sign-DCb_DKtv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;CACvF,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,MAAM,eAAe,SAAS,QAAQ,IAAI,GAAG,oBAAoB;CACjE,MAAM,uBAAuB,eAAe,QAAQ;CACpD,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAChC,MAAM,UAAU,CAAC;GAChB,OAAO;GACP,OAAO;EACR,GAAG;GACF,OAAO;GACP,OAAO,wBAAwB;EAChC,CAAC;EACD,IAAI,QAAQ,IAAI,QAAQ,KAAK;GAC5B,O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,cAAc,oEAAoE,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,yBAAyB,oFAAoF,CAAC,CAAC,OAAO,OAAO,oBAAoB,YAAY;EACxY,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,IAAI,sBAAsB,QAAQ,UAAU;GAC3C,QAAQ,OAAO,MAAM,2EAA2E;GAChG,QAAQ,KAAK,CAAC;GACd;EACD;EACA,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,SAAS,MAAM,qBAAqB,oBAAoB,SAAS,OAAO,EAAE;EAChF,IAAI,OAAO,IAAI;GACd,IAAI,MAAM,MAAM,GAAG,OAAO,eAAe,OAAO,KAAK,CAAC;QACjD;IACJ,MAAM,SAAS,iBAAiB,OAAO,OAAO,KAAK;IACnD,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;GACA,QAAQ,KAAK,CAAC;EACf;EACA,MAAM,UAAU,OAAO;EACvB,IAAI,mBAAmBA,sBAAoB;GAC1C,MAAM,WAAW,aAAa,QAAQ,OAAO,EAAE;GAC/C,QAAQ,KAAK,QAAQ;EACtB;EACA,IAAI,MAAM,MAAM,GAAG,OAAO,uBAAuB,OAAO,CAAC;OACpD;GACJ,MAAM,SAAS,yBAAyB,SAAS,KAAK;GACtD,IAAI,QAAQ,GAAG,IAAI,MAAM;EAC1B;EACA,QAAQ,KAAK,CAAC;CACf,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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";
|
|
1
|
+
import { B as formatMigrationJson, D as errorRunnerFailed, N as errorUnexpected, V as formatMigrationPlanOutput, 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-DE494TSG.mjs";
|
|
2
|
+
import { o as resolveRefAdvancementFields } from "./ref-advancement-DaZBzm7m-BZQtedYC.mjs";
|
|
3
|
+
import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "./migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs";
|
|
4
|
+
import { t as resolveContractRefToSnapshot } from "./contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs";
|
|
8
5
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
9
6
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
10
|
-
import { join } from "pathe";
|
|
11
7
|
import { assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
12
8
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
13
9
|
import { Command } from "commander";
|
|
@@ -51,27 +47,18 @@ async function executeDbUpdateCommand(options, flags, ui, startTime) {
|
|
|
51
47
|
let { contractJson } = ctxResult.value;
|
|
52
48
|
let contractJsonPathForSnapshot = contractPathAbsolute;
|
|
53
49
|
const { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);
|
|
54
|
-
if (options.to)
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
refs
|
|
50
|
+
if (options.to) {
|
|
51
|
+
const resolved = await resolveContractRefToSnapshot({
|
|
52
|
+
config,
|
|
53
|
+
migrationsDir,
|
|
54
|
+
refInput: options.to,
|
|
55
|
+
contractPathAbsolute,
|
|
56
|
+
fallbackToEmitted: false,
|
|
57
|
+
missingBundleFlag: "--to"
|
|
63
58
|
});
|
|
64
|
-
if (!
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
why: `The ref resolved successfully but no on-disk migration package has a destination (\`to\`) hash matching ${targetHash}.`,
|
|
68
|
-
fix: "Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations."
|
|
69
|
-
}));
|
|
70
|
-
contractJson = await readContractSnapshotJson(migrationsDir, targetHash);
|
|
71
|
-
contractJsonPathForSnapshot = join(contractSnapshotDir(migrationsDir, targetHash), "contract.json");
|
|
72
|
-
} catch (error) {
|
|
73
|
-
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
74
|
-
throw error;
|
|
59
|
+
if (!resolved.ok) return notOk(resolved.failure);
|
|
60
|
+
contractJson = resolved.value.contractJson;
|
|
61
|
+
contractJsonPathForSnapshot = resolved.value.contractJsonPath;
|
|
75
62
|
}
|
|
76
63
|
try {
|
|
77
64
|
await client.connect(dbConnection);
|
|
@@ -84,28 +71,18 @@ async function executeDbUpdateCommand(options, flags, ui, startTime) {
|
|
|
84
71
|
});
|
|
85
72
|
if (!result.ok) return notOk(mapDbUpdateFailure(result.failure));
|
|
86
73
|
const advancementHash = result.value.mode === "apply" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;
|
|
87
|
-
|
|
88
|
-
advancedRef: null,
|
|
89
|
-
plannedAdvanceRef: null
|
|
90
|
-
};
|
|
91
|
-
if (computeRefAdvancementName({
|
|
74
|
+
const advancement = await resolveRefAdvancementFields({
|
|
92
75
|
...ifDefined("advanceRef", options.advanceRef),
|
|
93
|
-
...ifDefined("db", options.db)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
hash: advancementHash
|
|
104
|
-
});
|
|
105
|
-
} catch (error) {
|
|
106
|
-
if (MigrationToolsError.is(error)) return notOk(error);
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
76
|
+
...ifDefined("db", options.db),
|
|
77
|
+
refsDir,
|
|
78
|
+
migrationsDir,
|
|
79
|
+
contractJson,
|
|
80
|
+
contractJsonPath: contractJsonPathForSnapshot,
|
|
81
|
+
mode: result.value.mode,
|
|
82
|
+
hash: advancementHash
|
|
83
|
+
});
|
|
84
|
+
if (!advancement.ok) return notOk(advancement.failure);
|
|
85
|
+
const refAdvancementFields = advancement.value;
|
|
109
86
|
return ok({
|
|
110
87
|
ok: true,
|
|
111
88
|
mode: result.value.mode,
|
|
@@ -180,4 +157,4 @@ function createDbUpdateCommand() {
|
|
|
180
157
|
//#endregion
|
|
181
158
|
export { createDbUpdateCommand as t };
|
|
182
159
|
|
|
183
|
-
//# sourceMappingURL=db-update-
|
|
160
|
+
//# sourceMappingURL=db-update-WX0KitcX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-update-WX0KitcX.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, nt as errorRunnerFailed, s as resolveMigrationPaths, u as setCommandExamples, w as formatMigrationJson, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { o as resolveRefAdvancementFields } from \"../ref-advancement-DaZBzm7m.mjs\";\nimport { n as prepareMigrationContext, t as addMigrationCommandOptions } from \"../migration-command-scaffold-BPqXPCFV.mjs\";\nimport { t as resolveContractRefToSnapshot } from \"../contract-snapshot-resolution-SATuw0JW.mjs\";\nimport { Command } from \"commander\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { assertNever } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/commands/db-update.ts\n/**\n* Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.\n*/\nfunction mapDbUpdateFailure(failure) {\n\tif (failure.code === \"PLANNING_FAILED\") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });\n\tif (failure.code === \"RUNNER_FAILED\") {\n\t\tconst fix = (typeof failure.meta?.[\"runnerErrorCode\"] === \"string\" ? failure.meta[\"runnerErrorCode\"] : void 0) === \"MIGRATION.LEGACY_MARKER_SHAPE\" ? \"Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema.\" : \"Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`\";\n\t\treturn errorRunnerFailed(failure.summary, {\n\t\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\t\tfix,\n\t\t\tmeta: {\n\t\t\t\t...failure.meta,\n\t\t\t\t...failure.warnings && failure.warnings.length > 0 ? { plannerWarnings: failure.warnings } : {}\n\t\t\t},\n\t\t\t...ifDefined(\"cause\", failure.cause)\n\t\t});\n\t}\n\tif (failure.code === \"DESTRUCTIVE_CHANGES\") return errorDestructiveChanges(failure.summary, {\n\t\t...ifDefined(\"why\", failure.why),\n\t\tfix: \"Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first\",\n\t\t...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) {\n\t\tconst resolved = await resolveContractRefToSnapshot({\n\t\t\tconfig,\n\t\t\tmigrationsDir,\n\t\t\trefInput: options.to,\n\t\t\tcontractPathAbsolute,\n\t\t\tfallbackToEmitted: false,\n\t\t\tmissingBundleFlag: \"--to\"\n\t\t});\n\t\tif (!resolved.ok) return notOk(resolved.failure);\n\t\tcontractJson = resolved.value.contractJson;\n\t\tcontractJsonPathForSnapshot = resolved.value.contractJsonPath;\n\t}\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst result = await client.dbUpdate({\n\t\t\tcontract: contractJson,\n\t\t\tmode: options.dryRun ? \"plan\" : \"apply\",\n\t\t\tmigrationsDir,\n\t\t\t...flags.yes ? { acceptDataLoss: true } : {},\n\t\t\tonProgress\n\t\t});\n\t\tif (!result.ok) return notOk(mapDbUpdateFailure(result.failure));\n\t\tconst advancementHash = result.value.mode === \"apply\" ? result.value.marker?.storageHash ?? result.value.destination.storageHash : result.value.destination.storageHash;\n\t\tconst advancement = await resolveRefAdvancementFields({\n\t\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t\t...ifDefined(\"db\", options.db),\n\t\t\trefsDir,\n\t\t\tmigrationsDir,\n\t\t\tcontractJson,\n\t\t\tcontractJsonPath: contractJsonPathForSnapshot,\n\t\t\tmode: result.value.mode,\n\t\t\thash: advancementHash\n\t\t});\n\t\tif (!advancement.ok) return notOk(advancement.failure);\n\t\tconst refAdvancementFields = advancement.value;\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmode: result.value.mode,\n\t\t\tplan: {\n\t\t\t\ttargetId: ctxResult.value.config.target.targetId,\n\t\t\t\tdestination: {\n\t\t\t\t\tstorageHash: result.value.destination.storageHash,\n\t\t\t\t\t...ifDefined(\"profileHash\", result.value.destination.profileHash)\n\t\t\t\t},\n\t\t\t\toperations: result.value.plan.operations.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\t...ifDefined(\"preview\", result.value.plan.preview)\n\t\t\t},\n\t\t\t...ifDefined(\"execution\", result.value.execution ? {\n\t\t\t\toperationsPlanned: result.value.execution.operationsPlanned,\n\t\t\t\toperationsExecuted: result.value.execution.operationsExecuted\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"marker\", result.value.marker ? {\n\t\t\t\tstorageHash: result.value.marker.storageHash,\n\t\t\t\t...ifDefined(\"profileHash\", result.value.marker.profileHash)\n\t\t\t} : void 0),\n\t\t\t...ifDefined(\"perSpace\", result.value.perSpace),\n\t\t\t...ifDefined(\"warnings\", result.value.warnings),\n\t\t\tadvancedRef: refAdvancementFields.advancedRef,\n\t\t\tplannedAdvanceRef: refAdvancementFields.plannedAdvanceRef,\n\t\t\tsummary: result.value.summary,\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (isStructuredError(error) && error.code === \"CONTRACT.VALIDATION_FAILED\") return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during db update: ${safeMessage}` }));\n\t} finally {\n\t\tawait 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":";;;;;;;;;;;;;AA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,IAAI,SAAS;EACvE,IAAI,CAAC,OAAO,MAAM,OAAO,QAAQ,SAAS,kCAAkC,MAAM,eAAe,CAAC,MAAM,QAAQ,CAAC,MAAM,KAAK;GAC3H,MAAM,iBAAiB,OAAO,QAAQ,MAAM,yBAAyB,CAAC;GACtE,IAAI,eAAe,SAAS,GAAG,GAAG,KAAK,GAAG,eAAe,OAAO,uDAAuD,eAAe,KAAK,OAAO,KAAK,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,GAAG;GACjM,IAAI,MAAM,GAAG,QAAQ,mDAAmD,GAAG,SAAS,MAAM,uBAAuB,SAAS;IACzH,GAAG;IACH,KAAK;GACN,GAAG,IAAI,KAAK,IAAI,CAAC;EAClB;EACA,MAAM,WAAW,aAAa,QAAQ,OAAO,KAAK,mBAAmB;GACpE,IAAI,MAAM,MAAM,GAAG,OAAO,oBAAoB,cAAc,CAAC;QACxD;IACJ,MAAM,SAAS,eAAe,SAAS,SAAS,0BAA0B,gBAAgB,KAAK,IAAI,2BAA2B,gBAAgB,KAAK;IACnJ,IAAI,QAAQ,GAAG,IAAI,MAAM;GAC1B;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
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-DE494TSG.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-
|
|
5
|
-
import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-C6L_hiJU-
|
|
4
|
+
import { t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
|
|
5
|
+
import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "./verify-C6L_hiJU-B4V3bqvG.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-
|
|
14
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-verify-B8ax2Y_x.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
|
|
@@ -396,4 +396,4 @@ function createDbVerifyCommand() {
|
|
|
396
396
|
//#endregion
|
|
397
397
|
export { createDbVerifyCommand as t };
|
|
398
398
|
|
|
399
|
-
//# sourceMappingURL=db-verify-
|
|
399
|
+
//# sourceMappingURL=db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map
|
|
@@ -1 +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,i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,QAAQ,GAAG,IAAI,MAAM;IAC1B;GACD,CAAC;GACD,IAAI,OAAO,MAAM,CAAC,OAAO,MAAM,OAAO,IAAI,QAAQ,KAAK,CAAC;GACxD,QAAQ,KAAK,QAAQ;EACtB;EACA,MAAM,SAAS,MAAM,uBAAuB,SAAS,OAAO,IAAI,IAAI;EACpE,IAAI,OAAO,IAAI;GACd,IAAI,MAAM,MAAM,GAAG,OAAO,iBAAiB,OAAO,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
|
+
{"version":3,"file":"db-verify-B8ax2Y_x-Bp4s5Ra6.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-B8ax2Y_x.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-Y6qbDk7X.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//#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AO,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,7 +1,7 @@
|
|
|
1
1
|
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
3
|
import { dirname, relative } from "pathe";
|
|
4
|
-
//#region ../../../1-framework/3-tooling/migration/dist/errors-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/migration/dist/errors-Co-8oaiB.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Build the canonical "re-emit this package" remediation hint.
|
|
7
7
|
*
|
|
@@ -309,14 +309,15 @@ function errorBundleNotFoundForGraphNode(hash, explicitLabel) {
|
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
|
-
function errorContractDeserializationFailed(filePath, message) {
|
|
312
|
+
function errorContractDeserializationFailed(filePath, message, options) {
|
|
313
313
|
return new MigrationToolsError("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract failed to deserialize", {
|
|
314
314
|
why: `Contract at "${filePath}" failed to deserialize: ${message}`,
|
|
315
315
|
fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
|
|
316
316
|
meta: {
|
|
317
317
|
filePath,
|
|
318
318
|
message
|
|
319
|
-
}
|
|
319
|
+
},
|
|
320
|
+
...ifDefined("cause", options?.cause)
|
|
320
321
|
});
|
|
321
322
|
}
|
|
322
323
|
function errorHashNotInGraph(hash, graph) {
|
|
@@ -366,4 +367,4 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
|
|
|
366
367
|
//#endregion
|
|
367
368
|
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 };
|
|
368
369
|
|
|
369
|
-
//# sourceMappingURL=errors-
|
|
370
|
+
//# sourceMappingURL=errors-Co-8oaiB-CB-6Uqki.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-BwusfLIN-BXM7K-ww.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/errors-BwusfLIN.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { dirname, relative } from \"pathe\";\n//#region src/errors.ts\n/**\n* Build the canonical \"re-emit this package\" remediation hint.\n*\n* Every on-disk migration package ships its own `migration.ts` author-time\n* file. Running it regenerates `migration.json` and `ops.json` with the\n* correct hash + metadata, so it is the right primitive whenever a single\n* package's on-disk artifacts are missing, malformed, or otherwise corrupt.\n* Pointing users at `migration plan` would emit a *new* package rather than\n* heal the broken one.\n*/\nfunction reemitHint(dir, fallback) {\n\tconst reemit = `Re-emit the package by running \\`node \"${relative(process.cwd(), dir)}/migration.ts\"\\``;\n\treturn fallback ? `${reemit}, ${fallback}` : `${reemit}.`;\n}\n/**\n* Structured error for migration tooling operations.\n*\n* Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under\n* the MIGRATION namespace. These are tooling-time errors (file I/O, hash\n* verification, migration history reconstruction), distinct from the runtime\n* MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,\n* etc.).\n*\n* Fields:\n* - code: Stable machine-readable code (MIGRATION.SUBCODE)\n* - category: Always 'MIGRATION'\n* - why: Explains the cause in plain language\n* - fix: Actionable remediation step\n* - meta: Machine-readable structured data for agents\n*/\nvar MigrationToolsError = class extends CliStructuredError {\n\tcategory;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.category = \"MIGRATION\";\n\t}\n\tstatic is(error) {\n\t\treturn CliStructuredError.is(error) && \"category\" in error && error.category === \"MIGRATION\" && error.code.startsWith(\"MIGRATION.\");\n\t}\n};\nfunction errorDirectoryExists(dir) {\n\treturn new MigrationToolsError(\"MIGRATION.DIR_EXISTS\", \"Migration directory already exists\", {\n\t\twhy: `The directory \"${dir}\" already exists. Each migration must have a unique directory.`,\n\t\tfix: \"Use --name to pick a different name, or delete the existing directory and re-run.\",\n\t\tmeta: { dir }\n\t});\n}\nfunction errorMissingFile(file, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.FILE_MISSING\", `Missing ${file}`, {\n\t\twhy: `Expected \"${file}\" in \"${dir}\" but the file does not exist.`,\n\t\tfix: reemitHint(dir, \"or delete the directory if the migration is unwanted and the source TypeScript is gone.\"),\n\t\tmeta: {\n\t\t\tfile,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorInvalidJson(filePath, parseError) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_JSON\", \"Invalid JSON in migration file\", {\n\t\twhy: `Failed to parse \"${filePath}\": ${parseError}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tparseError\n\t\t}\n\t});\n}\nfunction errorInvalidManifest(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_MANIFEST\", \"Invalid migration manifest\", {\n\t\twhy: `Migration manifest at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorDescribeMissingEndContract() {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", \"Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.\", {\n\t\twhy: \"Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.\",\n\t\tfix: \"Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.\",\n\t\tmeta: { reason: \"missing-end-contract\" }\n\t});\n}\nfunction errorDescribeInvalidMetadata(summary) {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", `describe() returned invalid metadata: ${summary}`, {\n\t\twhy: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,\n\t\tfix: \"Ensure describe() returns { from: string | null, to: string } with valid contract hashes.\",\n\t\tmeta: {\n\t\t\treason: \"invalid-metadata\",\n\t\t\tsummary\n\t\t}\n\t});\n}\nfunction errorOperationsNotArray() {\n\treturn new MigrationToolsError(\"MIGRATION.PLAN_NOT_ARRAY\", \"operations must be an array\", {\n\t\twhy: \"The migration instance's `operations` getter returned a non-array value.\",\n\t\tfix: \"Ensure the `operations` getter returns an array of migration operations.\",\n\t\tmeta: {}\n\t});\n}\nfunction errorSpaceHeadRefMissing(spaceId) {\n\treturn 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.`, {\n\t\twhy: `Contract space \"${spaceId}\" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,\n\t\tfix: \"Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorInvalidOperationEntry(index, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Migration operation entry is malformed\", {\n\t\twhy: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,\n\t\tfix: \"Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').\",\n\t\tmeta: {\n\t\t\tindex,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidSlug(slug) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_NAME\", \"Invalid migration name\", {\n\t\twhy: `The slug \"${slug}\" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,\n\t\tfix: \"Provide a name with at least one alphanumeric character, e.g. --name add_users.\",\n\t\tmeta: { slug }\n\t});\n}\nfunction errorInvalidDestName(destName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_DEST_NAME\", \"Invalid copy destination name\", {\n\t\twhy: `The destination name \"${destName}\" must be a single path segment (no \"..\" or directory separators).`,\n\t\tfix: \"Use a simple file name such as \\\"contract.json\\\" for each destination in the copy list.\",\n\t\tmeta: { destName }\n\t});\n}\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_SPACE_ID\", \"Invalid contract space identifier\", {\n\t\twhy: `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.`,\n\t\tfix: \"Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorDescriptorHeadHashMismatch(args) {\n\tconst { extensionId, recomputedHash, headRefHash } = args;\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH\", \"Extension descriptor's headRef.hash does not match its contractJson\", {\n\t\twhy: `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.`,\n\t\tfix: \"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).\",\n\t\tmeta: {\n\t\t\textensionId,\n\t\t\trecomputedHash,\n\t\t\theadRefHash\n\t\t}\n\t});\n}\nfunction errorDuplicateSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_SPACE_ID\", \"Duplicate contract space identifier\", {\n\t\twhy: `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).`,\n\t\tfix: \"Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorAmbiguousTarget(branchTips, context) {\n\tconst divergenceInfo = context ? `\\nDivergence point: ${context.divergencePoint}\\nBranches:\\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(\" → \") || \"direct\"})`).join(\"\\n\")}` : \"\";\n\treturn new MigrationToolsError(\"MIGRATION.AMBIGUOUS_TARGET\", \"Ambiguous migration target\", {\n\t\twhy: `The migration history has diverged into multiple branches: ${branchTips.join(\", \")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tbranchTips,\n\t\t\t...context ? {\n\t\t\t\tdivergencePoint: context.divergencePoint,\n\t\t\t\tbranches: context.branches\n\t\t\t} : {}\n\t\t}\n\t});\n}\nfunction errorNoInitialMigration(nodes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_INITIAL_MIGRATION\", \"No initial migration found\", {\n\t\twhy: `No migration starts from the empty contract state (known hashes: ${nodes.join(\", \")}). At least one migration must originate from the empty state.`,\n\t\tfix: \"Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.\",\n\t\tmeta: { nodes }\n\t});\n}\nfunction errorInvalidRefFile(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_FILE\", \"Invalid ref file\", {\n\t\twhy: `Ref file at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: \"Ensure the ref file contains valid JSON with { \\\"hash\\\": \\\"<64 hex chars>\\\", \\\"invariants\\\": [\\\"...\\\"] }.\",\n\t\tmeta: {\n\t\t\tpath: filePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidRefName(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_NAME\", \"Invalid ref name\", {\n\t\twhy: `Ref name \"${refName}\" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no \".\" or \"..\" segments).`,\n\t\tfix: `Use a valid ref name (e.g., \"staging\", \"envs/production\").`,\n\t\tmeta: { refName }\n\t});\n}\nfunction errorNoTarget(reachableHashes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_TARGET\", \"No migration target could be resolved\", {\n\t\twhy: `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).`,\n\t\tfix: \"Use --from <hash> to specify the planning origin explicitly.\",\n\t\tmeta: { reachableHashes }\n\t});\n}\nfunction errorInvalidRefValue(value) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_VALUE\", \"Invalid ref value\", {\n\t\twhy: `Ref value \"${value}\" is not a valid contract hash. Values must be a 64-character hex digest or \"empty\".`,\n\t\tfix: \"Use a valid storage hash from `prisma-next contract emit` output or an existing migration.\",\n\t\tmeta: { value }\n\t});\n}\nfunction errorInvalidInvariantId(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_INVARIANT_ID\", \"Invalid invariantId\", {\n\t\twhy: `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.`,\n\t\tfix: \"Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \\\"backfill-user-phone\\\", \\\"users/backfill-phone\\\", or \\\"BackfillUserPhone\\\".\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorDuplicateInvariantInEdge(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_INVARIANT_IN_EDGE\", \"Duplicate invariantId on a single migration\", {\n\t\twhy: `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.`,\n\t\tfix: \"Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorProvidedInvariantsMismatch(filePath, stored, derived) {\n\tconst storedSet = new Set(stored);\n\tconst derivedSet = new Set(derived);\n\tconst missing = [...derivedSet].filter((id) => !storedSet.has(id));\n\tconst extra = [...storedSet].filter((id) => !derivedSet.has(id));\n\treturn new MigrationToolsError(\"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\", \"providedInvariants on migration.json disagrees with ops.json\", {\n\t\twhy: 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.`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tstored,\n\t\t\tderived,\n\t\t\tdifference: {\n\t\t\t\tmissing,\n\t\t\t\textra\n\t\t\t}\n\t\t}\n\t});\n}\nfunction errorNoInvariantPath(args) {\n\tconst { refName, required, missing, structuralPath } = args;\n\tconst refClause = refName ? `Ref \"${refName}\"` : \"Target\";\n\tconst missingList = missing.map((id) => JSON.stringify(id)).join(\", \");\n\treturn new MigrationToolsError(\"MIGRATION.NO_INVARIANT_PATH\", \"No path covers the required invariants\", {\n\t\twhy: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(\", \")}], missing=[${missingList}].`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\trequired,\n\t\t\tmissing,\n\t\t\tstructuralPath,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorUnknownInvariant(args) {\n\tconst { refName, unknown, declared } = args;\n\treturn new MigrationToolsError(\"MIGRATION.UNKNOWN_INVARIANT\", \"Ref declares invariants no migration in the graph provides\", {\n\t\twhy: `${refName ? `Ref \"${refName}\" declares` : \"Declares\"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(\", \")}].`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tunknown,\n\t\t\tdeclared,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorMigrationHashMismatch(dir, storedHash, computedHash) {\n\treturn new MigrationToolsError(\"MIGRATION.HASH_MISMATCH\", \"Migration package is corrupt\", {\n\t\twhy: `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.`,\n\t\tfix: reemitHint(dir, \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tdir,\n\t\t\tstoredHash,\n\t\t\tcomputedHash\n\t\t}\n\t});\n}\n/**\n* A ref name that resolves to nothing: no pointer file named `refName`\n* exists, and the hash being resolved (the `contractAt` argument, used as a\n* fallback when the pointer is absent) is not a node in the migration graph\n* either. There is no contract to materialize.\n*/\nfunction errorRefNotResolvable(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.REF_NOT_RESOLVABLE\", `Ref \"${refName}\" is not resolvable`, {\n\t\twhy: `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.`,\n\t\tfix: `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.`,\n\t\tmeta: {\n\t\t\trefName,\n\t\t\tidentifier: refName\n\t\t}\n\t});\n}\nfunction errorBundleNotFoundForGraphNode(hash, explicitLabel) {\n\treturn 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}`, {\n\t\twhy: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\\`to\\`) hash matching it.`,\n\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.\",\n\t\tmeta: {\n\t\t\thash,\n\t\t\t...explicitLabel ? { explicitLabel } : {}\n\t\t}\n\t});\n}\nfunction errorContractDeserializationFailed(filePath, message) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract failed to deserialize\", {\n\t\twhy: `Contract at \"${filePath}\" failed to deserialize: ${message}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tmessage\n\t\t}\n\t});\n}\nfunction errorHashNotInGraph(hash, graph) {\n\tconst reachableHashes = [...graph.nodes].sort();\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none)\";\n\treturn new MigrationToolsError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Hash \"${hash}\" is not a node in the migration graph`, {\n\t\twhy: `The migration graph contains nodes ${reachableList}; \"${hash}\" isn't one of them.`,\n\t\tfix: `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.`,\n\t\tmeta: {\n\t\t\thash,\n\t\t\treachableHashes\n\t\t}\n\t});\n}\nfunction errorContractSnapshotMissing(storageHash, expectedPath) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_MISSING\", \"Contract snapshot is missing\", {\n\t\twhy: `Expected a contract snapshot for ${storageHash} at \"${expectedPath}\" but the file does not exist.`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\texpectedPath\n\t\t}\n\t});\n}\nfunction errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH\", \"Contract snapshot hash mismatch\", {\n\t\twhy: `The contract JSON's inner storage.storageHash (\"${actualHash}\") does not match the requested storage hash (\"${storageHash}\") for snapshot directory \"${dir}\".`,\n\t\tfix: \"Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\tactualHash,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorMigrationContractViewMissing(className, accessor, jsonField) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_VIEW_MISSING\", `${className}.${accessor} requires ${jsonField}`, {\n\t\twhy: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,\n\t\tfix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,\n\t\tmeta: {\n\t\t\tclassName,\n\t\t\taccessor,\n\t\t\tjsonField\n\t\t}\n\t});\n}\n//#endregion\nexport { 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 };\n\n//# sourceMappingURL=errors-BwusfLIN.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,WAAW,KAAK,UAAU;CAClC,MAAM,SAAS,0CAA0C,SAAS,QAAQ,IAAI,GAAG,GAAG,EAAE;CACtF,OAAO,WAAW,GAAG,OAAO,IAAI,aAAa,GAAG,OAAO;AACxD;;;;;;;;;;;;;;;;;AAiBA,IAAI,sBAAsB,cAAc,mBAAmB;CAC1D;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,WAAW;CACjB;CACA,OAAO,GAAG,OAAO;EAChB,OAAO,mBAAmB,GAAG,KAAK,KAAK,cAAc,SAAS,M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oBAAoB,6CAA6C,kCAAkC;EAC7G,KAAK,gBAAgB,SAAS,2BAA2B;EACzD,KAAK,WAAW,QAAQ,QAAQ,GAAG,gDAAgD;EACnF,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,oBAAoB,MAAM,OAAO;CACzC,MAAM,kBAAkB,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,KAAK;CAC9C,MAAM,gBAAgB,gBAAgB,SAAS,IAAI,gBAAgB,KAAK,IAAI,IAAI;CAChF,OAAO,IAAI,oBAAoB,+BAA+B,SAAS,KAAK,yCAAyC;EACpH,KAAK,sCAAsC,cAAc,KAAK,KAAK;EACnE,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,6BAA6B,aAAa,cAAc;CAChE,OAAO,IAAI,oBAAoB,uCAAuC,gCAAgC;EACrG,KAAK,oCAAoC,YAAY,OAAO,aAAa;EACzE,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,kCAAkC,aAAa,YAAY,KAAK;CACxE,OAAO,IAAI,oBAAoB,6CAA6C,mCAAmC;EAC9G,KAAK,mDAAmD,WAAW,iDAAiD,YAAY,6BAA6B,IAAI;EACjK,KAAK;EACL,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,kCAAkC,WAAW,UAAU,WAAW;CAC1E,OAAO,IAAI,oBAAoB,mCAAmC,GAAG,UAAU,GAAG,SAAS,YAAY,aAAa;EACnH,KAAK,GAAG,UAAU,GAAG,SAAS,sCAAsC,UAAU;EAC9E,KAAK,OAAO,UAAU,gEAAgE,SAAS;EAC/F,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"errors-Co-8oaiB-CB-6Uqki.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/errors-Co-8oaiB.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { dirname, relative } from \"pathe\";\n//#region src/errors.ts\n/**\n* Build the canonical \"re-emit this package\" remediation hint.\n*\n* Every on-disk migration package ships its own `migration.ts` author-time\n* file. Running it regenerates `migration.json` and `ops.json` with the\n* correct hash + metadata, so it is the right primitive whenever a single\n* package's on-disk artifacts are missing, malformed, or otherwise corrupt.\n* Pointing users at `migration plan` would emit a *new* package rather than\n* heal the broken one.\n*/\nfunction reemitHint(dir, fallback) {\n\tconst reemit = `Re-emit the package by running \\`node \"${relative(process.cwd(), dir)}/migration.ts\"\\``;\n\treturn fallback ? `${reemit}, ${fallback}` : `${reemit}.`;\n}\n/**\n* Structured error for migration tooling operations.\n*\n* Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under\n* the MIGRATION namespace. These are tooling-time errors (file I/O, hash\n* verification, migration history reconstruction), distinct from the runtime\n* MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,\n* etc.).\n*\n* Fields:\n* - code: Stable machine-readable code (MIGRATION.SUBCODE)\n* - category: Always 'MIGRATION'\n* - why: Explains the cause in plain language\n* - fix: Actionable remediation step\n* - meta: Machine-readable structured data for agents\n*/\nvar MigrationToolsError = class extends CliStructuredError {\n\tcategory;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.category = \"MIGRATION\";\n\t}\n\tstatic is(error) {\n\t\treturn CliStructuredError.is(error) && \"category\" in error && error.category === \"MIGRATION\" && error.code.startsWith(\"MIGRATION.\");\n\t}\n};\nfunction errorDirectoryExists(dir) {\n\treturn new MigrationToolsError(\"MIGRATION.DIR_EXISTS\", \"Migration directory already exists\", {\n\t\twhy: `The directory \"${dir}\" already exists. Each migration must have a unique directory.`,\n\t\tfix: \"Use --name to pick a different name, or delete the existing directory and re-run.\",\n\t\tmeta: { dir }\n\t});\n}\nfunction errorMissingFile(file, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.FILE_MISSING\", `Missing ${file}`, {\n\t\twhy: `Expected \"${file}\" in \"${dir}\" but the file does not exist.`,\n\t\tfix: reemitHint(dir, \"or delete the directory if the migration is unwanted and the source TypeScript is gone.\"),\n\t\tmeta: {\n\t\t\tfile,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorInvalidJson(filePath, parseError) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_JSON\", \"Invalid JSON in migration file\", {\n\t\twhy: `Failed to parse \"${filePath}\": ${parseError}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tparseError\n\t\t}\n\t});\n}\nfunction errorInvalidManifest(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_MANIFEST\", \"Invalid migration manifest\", {\n\t\twhy: `Migration manifest at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorDescribeMissingEndContract() {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", \"Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.\", {\n\t\twhy: \"Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.\",\n\t\tfix: \"Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.\",\n\t\tmeta: { reason: \"missing-end-contract\" }\n\t});\n}\nfunction errorDescribeInvalidMetadata(summary) {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", `describe() returned invalid metadata: ${summary}`, {\n\t\twhy: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,\n\t\tfix: \"Ensure describe() returns { from: string | null, to: string } with valid contract hashes.\",\n\t\tmeta: {\n\t\t\treason: \"invalid-metadata\",\n\t\t\tsummary\n\t\t}\n\t});\n}\nfunction errorOperationsNotArray() {\n\treturn new MigrationToolsError(\"MIGRATION.PLAN_NOT_ARRAY\", \"operations must be an array\", {\n\t\twhy: \"The migration instance's `operations` getter returned a non-array value.\",\n\t\tfix: \"Ensure the `operations` getter returns an array of migration operations.\",\n\t\tmeta: {}\n\t});\n}\nfunction errorSpaceHeadRefMissing(spaceId) {\n\treturn 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.`, {\n\t\twhy: `Contract space \"${spaceId}\" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,\n\t\tfix: \"Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorInvalidOperationEntry(index, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Migration operation entry is malformed\", {\n\t\twhy: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,\n\t\tfix: \"Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').\",\n\t\tmeta: {\n\t\t\tindex,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidSlug(slug) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_NAME\", \"Invalid migration name\", {\n\t\twhy: `The slug \"${slug}\" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,\n\t\tfix: \"Provide a name with at least one alphanumeric character, e.g. --name add_users.\",\n\t\tmeta: { slug }\n\t});\n}\nfunction errorInvalidDestName(destName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_DEST_NAME\", \"Invalid copy destination name\", {\n\t\twhy: `The destination name \"${destName}\" must be a single path segment (no \"..\" or directory separators).`,\n\t\tfix: \"Use a simple file name such as \\\"contract.json\\\" for each destination in the copy list.\",\n\t\tmeta: { destName }\n\t});\n}\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_SPACE_ID\", \"Invalid contract space identifier\", {\n\t\twhy: `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.`,\n\t\tfix: \"Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorDescriptorHeadHashMismatch(args) {\n\tconst { extensionId, recomputedHash, headRefHash } = args;\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH\", \"Extension descriptor's headRef.hash does not match its contractJson\", {\n\t\twhy: `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.`,\n\t\tfix: \"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).\",\n\t\tmeta: {\n\t\t\textensionId,\n\t\t\trecomputedHash,\n\t\t\theadRefHash\n\t\t}\n\t});\n}\nfunction errorDuplicateSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_SPACE_ID\", \"Duplicate contract space identifier\", {\n\t\twhy: `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).`,\n\t\tfix: \"Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorAmbiguousTarget(branchTips, context) {\n\tconst divergenceInfo = context ? `\\nDivergence point: ${context.divergencePoint}\\nBranches:\\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(\" → \") || \"direct\"})`).join(\"\\n\")}` : \"\";\n\treturn new MigrationToolsError(\"MIGRATION.AMBIGUOUS_TARGET\", \"Ambiguous migration target\", {\n\t\twhy: `The migration history has diverged into multiple branches: ${branchTips.join(\", \")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tbranchTips,\n\t\t\t...context ? {\n\t\t\t\tdivergencePoint: context.divergencePoint,\n\t\t\t\tbranches: context.branches\n\t\t\t} : {}\n\t\t}\n\t});\n}\nfunction errorNoInitialMigration(nodes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_INITIAL_MIGRATION\", \"No initial migration found\", {\n\t\twhy: `No migration starts from the empty contract state (known hashes: ${nodes.join(\", \")}). At least one migration must originate from the empty state.`,\n\t\tfix: \"Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.\",\n\t\tmeta: { nodes }\n\t});\n}\nfunction errorInvalidRefFile(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_FILE\", \"Invalid ref file\", {\n\t\twhy: `Ref file at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: \"Ensure the ref file contains valid JSON with { \\\"hash\\\": \\\"<64 hex chars>\\\", \\\"invariants\\\": [\\\"...\\\"] }.\",\n\t\tmeta: {\n\t\t\tpath: filePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidRefName(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_NAME\", \"Invalid ref name\", {\n\t\twhy: `Ref name \"${refName}\" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no \".\" or \"..\" segments).`,\n\t\tfix: `Use a valid ref name (e.g., \"staging\", \"envs/production\").`,\n\t\tmeta: { refName }\n\t});\n}\nfunction errorNoTarget(reachableHashes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_TARGET\", \"No migration target could be resolved\", {\n\t\twhy: `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).`,\n\t\tfix: \"Use --from <hash> to specify the planning origin explicitly.\",\n\t\tmeta: { reachableHashes }\n\t});\n}\nfunction errorInvalidRefValue(value) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_VALUE\", \"Invalid ref value\", {\n\t\twhy: `Ref value \"${value}\" is not a valid contract hash. Values must be a 64-character hex digest or \"empty\".`,\n\t\tfix: \"Use a valid storage hash from `prisma-next contract emit` output or an existing migration.\",\n\t\tmeta: { value }\n\t});\n}\nfunction errorInvalidInvariantId(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_INVARIANT_ID\", \"Invalid invariantId\", {\n\t\twhy: `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.`,\n\t\tfix: \"Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \\\"backfill-user-phone\\\", \\\"users/backfill-phone\\\", or \\\"BackfillUserPhone\\\".\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorDuplicateInvariantInEdge(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_INVARIANT_IN_EDGE\", \"Duplicate invariantId on a single migration\", {\n\t\twhy: `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.`,\n\t\tfix: \"Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorProvidedInvariantsMismatch(filePath, stored, derived) {\n\tconst storedSet = new Set(stored);\n\tconst derivedSet = new Set(derived);\n\tconst missing = [...derivedSet].filter((id) => !storedSet.has(id));\n\tconst extra = [...storedSet].filter((id) => !derivedSet.has(id));\n\treturn new MigrationToolsError(\"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\", \"providedInvariants on migration.json disagrees with ops.json\", {\n\t\twhy: 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.`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tstored,\n\t\t\tderived,\n\t\t\tdifference: {\n\t\t\t\tmissing,\n\t\t\t\textra\n\t\t\t}\n\t\t}\n\t});\n}\nfunction errorNoInvariantPath(args) {\n\tconst { refName, required, missing, structuralPath } = args;\n\tconst refClause = refName ? `Ref \"${refName}\"` : \"Target\";\n\tconst missingList = missing.map((id) => JSON.stringify(id)).join(\", \");\n\treturn new MigrationToolsError(\"MIGRATION.NO_INVARIANT_PATH\", \"No path covers the required invariants\", {\n\t\twhy: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(\", \")}], missing=[${missingList}].`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\trequired,\n\t\t\tmissing,\n\t\t\tstructuralPath,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorUnknownInvariant(args) {\n\tconst { refName, unknown, declared } = args;\n\treturn new MigrationToolsError(\"MIGRATION.UNKNOWN_INVARIANT\", \"Ref declares invariants no migration in the graph provides\", {\n\t\twhy: `${refName ? `Ref \"${refName}\" declares` : \"Declares\"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(\", \")}].`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tunknown,\n\t\t\tdeclared,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorMigrationHashMismatch(dir, storedHash, computedHash) {\n\treturn new MigrationToolsError(\"MIGRATION.HASH_MISMATCH\", \"Migration package is corrupt\", {\n\t\twhy: `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.`,\n\t\tfix: reemitHint(dir, \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tdir,\n\t\t\tstoredHash,\n\t\t\tcomputedHash\n\t\t}\n\t});\n}\n/**\n* A ref name that resolves to nothing: no pointer file named `refName`\n* exists, and the hash being resolved (the `contractAt` argument, used as a\n* fallback when the pointer is absent) is not a node in the migration graph\n* either. There is no contract to materialize.\n*/\nfunction errorRefNotResolvable(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.REF_NOT_RESOLVABLE\", `Ref \"${refName}\" is not resolvable`, {\n\t\twhy: `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.`,\n\t\tfix: `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.`,\n\t\tmeta: {\n\t\t\trefName,\n\t\t\tidentifier: refName\n\t\t}\n\t});\n}\nfunction errorBundleNotFoundForGraphNode(hash, explicitLabel) {\n\treturn 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}`, {\n\t\twhy: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\\`to\\`) hash matching it.`,\n\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.\",\n\t\tmeta: {\n\t\t\thash,\n\t\t\t...explicitLabel ? { explicitLabel } : {}\n\t\t}\n\t});\n}\nfunction errorContractDeserializationFailed(filePath, message, options) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract failed to deserialize\", {\n\t\twhy: `Contract at \"${filePath}\" failed to deserialize: ${message}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tmessage\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\nfunction errorHashNotInGraph(hash, graph) {\n\tconst reachableHashes = [...graph.nodes].sort();\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none)\";\n\treturn new MigrationToolsError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Hash \"${hash}\" is not a node in the migration graph`, {\n\t\twhy: `The migration graph contains nodes ${reachableList}; \"${hash}\" isn't one of them.`,\n\t\tfix: `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.`,\n\t\tmeta: {\n\t\t\thash,\n\t\t\treachableHashes\n\t\t}\n\t});\n}\nfunction errorContractSnapshotMissing(storageHash, expectedPath) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_MISSING\", \"Contract snapshot is missing\", {\n\t\twhy: `Expected a contract snapshot for ${storageHash} at \"${expectedPath}\" but the file does not exist.`,\n\t\tfix: \"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.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\texpectedPath\n\t\t}\n\t});\n}\nfunction errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH\", \"Contract snapshot hash mismatch\", {\n\t\twhy: `The contract JSON's inner storage.storageHash (\"${actualHash}\") does not match the requested storage hash (\"${storageHash}\") for snapshot directory \"${dir}\".`,\n\t\tfix: \"Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\tactualHash,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorMigrationContractViewMissing(className, accessor, jsonField) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_VIEW_MISSING\", `${className}.${accessor} requires ${jsonField}`, {\n\t\twhy: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,\n\t\tfix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,\n\t\tmeta: {\n\t\t\tclassName,\n\t\t\taccessor,\n\t\t\tjsonField\n\t\t}\n\t});\n}\n//#endregion\nexport { 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,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