@prisma/orm-toolchain 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +28 -0
- package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
- package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
- package/dist/aggregate-BflrjWPO.d.mts +803 -0
- package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
- package/dist/bin__prisma-next.mjs +800 -0
- package/dist/bin__prisma-next.mjs.map +1 -0
- package/dist/cli-telemetry.d.mts +367 -0
- package/dist/cli-telemetry.d.mts.map +1 -0
- package/dist/cli-telemetry.mjs +48 -0
- package/dist/cli-telemetry.mjs.map +1 -0
- package/dist/cli-telemetry__sender.d.mts +1 -0
- package/dist/cli-telemetry__sender.mjs +1 -0
- package/dist/cli.d.mts +31 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +180 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/cli__commands__contract-emit.d.mts +2 -0
- package/dist/cli__commands__contract-emit.mjs +2 -0
- package/dist/cli__commands__contract-infer.d.mts +7 -0
- package/dist/cli__commands__contract-infer.d.mts.map +1 -0
- package/dist/cli__commands__contract-infer.mjs +2 -0
- package/dist/cli__commands__db-init.d.mts +7 -0
- package/dist/cli__commands__db-init.d.mts.map +1 -0
- package/dist/cli__commands__db-init.mjs +2 -0
- package/dist/cli__commands__db-schema.d.mts +7 -0
- package/dist/cli__commands__db-schema.d.mts.map +1 -0
- package/dist/cli__commands__db-schema.mjs +2 -0
- package/dist/cli__commands__db-sign.d.mts +7 -0
- package/dist/cli__commands__db-sign.d.mts.map +1 -0
- package/dist/cli__commands__db-sign.mjs +2 -0
- package/dist/cli__commands__db-update.d.mts +7 -0
- package/dist/cli__commands__db-update.d.mts.map +1 -0
- package/dist/cli__commands__db-update.mjs +2 -0
- package/dist/cli__commands__db-verify.d.mts +7 -0
- package/dist/cli__commands__db-verify.d.mts.map +1 -0
- package/dist/cli__commands__db-verify.mjs +2 -0
- package/dist/cli__commands__migrate.d.mts +66 -0
- package/dist/cli__commands__migrate.d.mts.map +1 -0
- package/dist/cli__commands__migrate.mjs +2 -0
- package/dist/cli__commands__migration-check.d.mts +64 -0
- package/dist/cli__commands__migration-check.d.mts.map +1 -0
- package/dist/cli__commands__migration-check.mjs +3 -0
- package/dist/cli__commands__migration-graph.d.mts +36 -0
- package/dist/cli__commands__migration-graph.d.mts.map +1 -0
- package/dist/cli__commands__migration-graph.mjs +2 -0
- package/dist/cli__commands__migration-list.d.mts +79 -0
- package/dist/cli__commands__migration-list.d.mts.map +1 -0
- package/dist/cli__commands__migration-list.mjs +2 -0
- package/dist/cli__commands__migration-log.d.mts +20 -0
- package/dist/cli__commands__migration-log.d.mts.map +1 -0
- package/dist/cli__commands__migration-log.mjs +2 -0
- package/dist/cli__commands__migration-new.d.mts +7 -0
- package/dist/cli__commands__migration-new.d.mts.map +1 -0
- package/dist/cli__commands__migration-new.mjs +2 -0
- package/dist/cli__commands__migration-plan.d.mts +79 -0
- package/dist/cli__commands__migration-plan.d.mts.map +1 -0
- package/dist/cli__commands__migration-plan.mjs +2 -0
- package/dist/cli__commands__migration-show.d.mts +27 -0
- package/dist/cli__commands__migration-show.d.mts.map +1 -0
- package/dist/cli__commands__migration-show.mjs +2 -0
- package/dist/cli__commands__migration-status.d.mts +55 -0
- package/dist/cli__commands__migration-status.d.mts.map +1 -0
- package/dist/cli__commands__migration-status.mjs +3 -0
- package/dist/cli__commands__ref.d.mts +34 -0
- package/dist/cli__commands__ref.d.mts.map +1 -0
- package/dist/cli__commands__ref.mjs +2 -0
- package/dist/cli__commands__telemetry.d.mts +7 -0
- package/dist/cli__commands__telemetry.d.mts.map +1 -0
- package/dist/cli__commands__telemetry.mjs +2 -0
- package/dist/cli__config-types.d.mts +2 -0
- package/dist/cli__config-types.mjs +2 -0
- package/dist/cli__control-api.d.mts +141 -0
- package/dist/cli__control-api.d.mts.map +1 -0
- package/dist/cli__control-api.mjs +4 -0
- package/dist/cli__init-output.d.mts +37 -0
- package/dist/cli__init-output.d.mts.map +1 -0
- package/dist/cli__init-output.mjs +2 -0
- package/dist/cli__migration-cli.d.mts +79 -0
- package/dist/cli__migration-cli.d.mts.map +1 -0
- package/dist/cli__migration-cli.mjs +407 -0
- package/dist/cli__migration-cli.mjs.map +1 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
- package/dist/config-loader.d.mts +18 -0
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +2 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
- package/dist/constants-Dkcn8Qu4.d.mts +10 -0
- package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
- package/dist/contract-emit-B65_UiFn.d.mts +7 -0
- package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
- package/dist/db-init-Vbkb_TKZ.mjs +153 -0
- package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
- package/dist/db-schema-ClQCu3xY.mjs +47 -0
- package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
- package/dist/db-sign-jjXDgQ1u.mjs +175 -0
- package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
- package/dist/db-update-BQlrqtDD.mjs +183 -0
- package/dist/db-update-BQlrqtDD.mjs.map +1 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
- package/dist/emitter.d.mts +75 -0
- package/dist/emitter.d.mts.map +1 -0
- package/dist/emitter.mjs +3 -0
- package/dist/emitter__domain-type-generation.d.mts +2 -0
- package/dist/emitter__domain-type-generation.mjs +2 -0
- package/dist/emitter__type-expression-safety.d.mts +6 -0
- package/dist/emitter__type-expression-safety.d.mts.map +1 -0
- package/dist/emitter__type-expression-safety.mjs +2 -0
- package/dist/errors--qsXZUtL.d.mts +72 -0
- package/dist/errors--qsXZUtL.d.mts.map +1 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
- package/dist/exports-BN0vFTxG.mjs +276 -0
- package/dist/exports-BN0vFTxG.mjs.map +1 -0
- package/dist/exports-B_xhKZmC.mjs +1436 -0
- package/dist/exports-B_xhKZmC.mjs.map +1 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
- package/dist/exports-Dl2aGAk7.mjs +119 -0
- package/dist/exports-Dl2aGAk7.mjs.map +1 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
- package/dist/hash-XZYYKJ-i.d.mts +53 -0
- package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
- package/dist/import-roots-B6CtsWXb.d.mts +119 -0
- package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
- package/dist/import-roots-NDOIEDVj.mjs +217 -0
- package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
- package/dist/invariants-B5wLrgQS.d.mts +39 -0
- package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
- package/dist/io-DYfeLJxR.d.mts +1 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
- package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
- package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
- package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
- package/dist/metadata-BtscDay2.d.mts +1 -0
- package/dist/migrate-Cb_iv264.mjs +500 -0
- package/dist/migrate-Cb_iv264.mjs.map +1 -0
- package/dist/migration-B2ljMJim.d.mts +155 -0
- package/dist/migration-B2ljMJim.d.mts.map +1 -0
- package/dist/migration-BuUmO7It.mjs +209 -0
- package/dist/migration-BuUmO7It.mjs.map +1 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs +597 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +1 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
- package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
- package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
- package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
- package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
- package/dist/migration-new-BurCjyaQ.mjs +168 -0
- package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
- package/dist/migration-show-Bx5I5aW9.mjs +171 -0
- package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs +444 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +1 -0
- package/dist/migration-tools.d.mts +23 -0
- package/dist/migration-tools.mjs +17 -0
- package/dist/migration-tools__aggregate.d.mts +2 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__constants.d.mts +2 -0
- package/dist/migration-tools__constants.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__errors.d.mts +2 -0
- package/dist/migration-tools__errors.mjs +2 -0
- package/dist/migration-tools__graph.d.mts +2 -0
- package/dist/migration-tools__graph.mjs +1 -0
- package/dist/migration-tools__hash.d.mts +2 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__invariants.d.mts +2 -0
- package/dist/migration-tools__invariants.mjs +2 -0
- package/dist/migration-tools__io.d.mts +3 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__ledger-origin.d.mts +2 -0
- package/dist/migration-tools__ledger-origin.mjs +2 -0
- package/dist/migration-tools__metadata.d.mts +3 -0
- package/dist/migration-tools__metadata.mjs +1 -0
- package/dist/migration-tools__migration-graph.d.mts +3 -0
- package/dist/migration-tools__migration-graph.mjs +3 -0
- package/dist/migration-tools__migration-ts.d.mts +2 -0
- package/dist/migration-tools__migration-ts.mjs +2 -0
- package/dist/migration-tools__migration.d.mts +2 -0
- package/dist/migration-tools__migration.mjs +2 -0
- package/dist/migration-tools__package.d.mts +3 -0
- package/dist/migration-tools__package.mjs +1 -0
- package/dist/migration-tools__ref-resolution.d.mts +2 -0
- package/dist/migration-tools__ref-resolution.mjs +2 -0
- package/dist/migration-tools__refs.d.mts +2 -0
- package/dist/migration-tools__refs.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +3 -0
- package/dist/migration-tools__spaces.mjs +3 -0
- package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
- package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
- package/dist/migration-ts-FyF55c4M.mjs +67 -0
- package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
- package/dist/package-N9PPdFV_.d.mts +3 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
- package/dist/publish-surface.d.mts +3 -0
- package/dist/publish-surface.mjs +3 -0
- package/dist/publish-surface__import-roots.d.mts +2 -0
- package/dist/publish-surface__import-roots.mjs +2 -0
- package/dist/publish-surface__shells.d.mts +2 -0
- package/dist/publish-surface__shells.mjs +2 -0
- package/dist/quick-reference-mongo.md +114 -0
- package/dist/quick-reference-postgres.md +93 -0
- package/dist/readme-mongo.md +35 -0
- package/dist/readme-postgres.md +34 -0
- package/dist/ref-B6cTthTi.mjs +171 -0
- package/dist/ref-B6cTthTi.mjs.map +1 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
- package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
- package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
- package/dist/ref-resolution-COGOSL57.d.mts +127 -0
- package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts +192 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts.map +1 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
- package/dist/shells-BenrJHp2.mjs +602 -0
- package/dist/shells-BenrJHp2.mjs.map +1 -0
- package/dist/shells-COHV_Ozf.d.mts +135 -0
- package/dist/shells-COHV_Ozf.d.mts.map +1 -0
- package/dist/spaces-C27bA-xc.mjs +267 -0
- package/dist/spaces-C27bA-xc.mjs.map +1 -0
- package/dist/spaces-DxFj5y8l.d.mts +415 -0
- package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
- package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
- package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.d.mts +54 -0
- package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +303 -0
- package/dist/vite-plugin-contract-emit.mjs.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { g as errorInvalidJson, t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
|
|
3
|
+
import { r as buildMigrationArtifacts } from "./migration-BuUmO7It.mjs";
|
|
4
|
+
import { CliStructuredError, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
|
|
5
|
+
import { dirname, join } from "pathe";
|
|
6
|
+
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
7
|
+
import { errorMigrationTargetMismatch } from "@prisma/orm-framework/errors/migration";
|
|
8
|
+
import { readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { Cli, Command, Option, UsageError } from "clipanion";
|
|
11
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-cli.mjs
|
|
12
|
+
/**
|
|
13
|
+
* The migration-file CLI interface: the actor invoked when the author runs
|
|
14
|
+
* `node migration.ts` directly.
|
|
15
|
+
*
|
|
16
|
+
* Naming: this is *not* a "migration runner" in the apply-time sense. The
|
|
17
|
+
* apply-time runner is the thing `prisma-next migrate` uses to
|
|
18
|
+
* execute migration JSON ops against a database. `MigrationCLI` is the
|
|
19
|
+
* tiny CLI surface owned by an authored `migration.ts` file: parse the
|
|
20
|
+
* file's argv, load the project's `prisma-next.config.ts`, assemble a
|
|
21
|
+
* `ControlStack`, instantiate the migration class, and serialize.
|
|
22
|
+
*
|
|
23
|
+
* The user authors a migration class, then calls
|
|
24
|
+
* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope
|
|
25
|
+
* after the class definition. When the file is invoked as a node
|
|
26
|
+
* entrypoint (`node migration.ts`), the CLI:
|
|
27
|
+
*
|
|
28
|
+
* 1. Detects whether the file is the direct entrypoint (no-op when imported).
|
|
29
|
+
* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via
|
|
30
|
+
* [clipanion](https://github.com/arcanis/clipanion).
|
|
31
|
+
* 3. Loads the project's `prisma-next.config.ts` via the same `loadConfig`
|
|
32
|
+
* the CLI commands use, walking up from the migration file's directory.
|
|
33
|
+
* 4. Probe-instantiates the migration class without a stack so it can read
|
|
34
|
+
* `targetId` and verify it matches `config.target.targetId`
|
|
35
|
+
* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter
|
|
36
|
+
* construction runs.
|
|
37
|
+
* 5. Assembles a `ControlStack` from the loaded config descriptors and
|
|
38
|
+
* constructs the migration with that stack.
|
|
39
|
+
* 6. Reads any previously-scaffolded `migration.json`, then calls
|
|
40
|
+
* `buildMigrationArtifacts` from `@internal/migration-tools` to
|
|
41
|
+
* produce in-memory `ops.json` + `migration.json` content. Persists
|
|
42
|
+
* the result to disk (or prints in dry-run mode).
|
|
43
|
+
*
|
|
44
|
+
* File I/O lives here, in `@internal/cli`: this is the only place
|
|
45
|
+
* that legitimately combines config loading, stack assembly, and
|
|
46
|
+
* on-disk persistence. `@internal/migration-tools` owns the pure
|
|
47
|
+
* conversion from a `Migration` instance to artifact strings; `Migration`
|
|
48
|
+
* stays a pure abstract class.
|
|
49
|
+
*
|
|
50
|
+
* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`
|
|
51
|
+
* for its in-process testability and runtime-agnostic execution surface; see
|
|
52
|
+
* `docs/architecture docs/research/commander-friction-points.md` for the
|
|
53
|
+
* evaluation rubric and the durable rationale that drove the choice).
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Flags exposed by the migration-file CLI.
|
|
57
|
+
*
|
|
58
|
+
* Must stay in sync with the `Option` declarations on
|
|
59
|
+
* `MigrationFileCommand` below. This list is rendered in the
|
|
60
|
+
* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,
|
|
61
|
+
* so order matters for user-visible output (declaration order is the
|
|
62
|
+
* order users see when they run `--help`).
|
|
63
|
+
*/
|
|
64
|
+
const KNOWN_FLAGS = [
|
|
65
|
+
"--help",
|
|
66
|
+
"--dry-run",
|
|
67
|
+
"--config"
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* The clipanion command that owns the migration-file CLI's option
|
|
71
|
+
* declarations. The class is internal — `MigrationCLI.run` is the
|
|
72
|
+
* stable public surface. Adding a flag here automatically updates
|
|
73
|
+
* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be
|
|
74
|
+
* updated in tandem).
|
|
75
|
+
*/
|
|
76
|
+
var MigrationFileCommand = class extends Command {
|
|
77
|
+
static paths = [Command.Default];
|
|
78
|
+
static usage = Command.Usage({
|
|
79
|
+
description: "Self-emit ops.json and migration.json from a class-flow migration",
|
|
80
|
+
details: `
|
|
81
|
+
Loads the project's prisma-next.config.ts, assembles a ControlStack
|
|
82
|
+
from the configured target/adapter/extensions, and serializes the
|
|
83
|
+
migration's operations + metadata next to this file.
|
|
84
|
+
`,
|
|
85
|
+
examples: [
|
|
86
|
+
["Self-emit ops.json + migration.json next to migration.ts", "$0"],
|
|
87
|
+
["Preview without writing files", "$0 --dry-run"],
|
|
88
|
+
["Use a non-default config path", "$0 --config ./custom.config.ts"]
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
dryRun = Option.Boolean("--dry-run", false, { description: "Print operations to stdout without writing files" });
|
|
92
|
+
config = Option.String("--config", { description: "Path to prisma-next.config.ts" });
|
|
93
|
+
/**
|
|
94
|
+
* Unused: orchestration runs inside `MigrationCLI.run` so error
|
|
95
|
+
* routing stays under our control (clipanion's `cli.run` writes
|
|
96
|
+
* error output to `context.stdout`, but our contract requires
|
|
97
|
+
* structured errors on stderr). `cli.process` is used to parse
|
|
98
|
+
* argv into a populated `MigrationFileCommand` instance whose
|
|
99
|
+
* fields drive the orchestration directly.
|
|
100
|
+
*/
|
|
101
|
+
async execute() {
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* The CLI surface invoked by an authored `migration.ts` file. Exposed as
|
|
107
|
+
* a class with a static `run` method (rather than a free function) to
|
|
108
|
+
* give the concept a stable identity in the ubiquitous language: this is
|
|
109
|
+
* the "migration-file CLI", distinct from the apply-time runner that
|
|
110
|
+
* executes migration JSON ops.
|
|
111
|
+
*
|
|
112
|
+
* Currently a single static method. Future surface (e.g. a programmatic
|
|
113
|
+
* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can
|
|
114
|
+
* land here without changing the import shape used by every authored
|
|
115
|
+
* migration.
|
|
116
|
+
*/
|
|
117
|
+
var MigrationCLI = class {
|
|
118
|
+
/**
|
|
119
|
+
* Orchestrates a class-flow `migration.ts` script run.
|
|
120
|
+
*
|
|
121
|
+
* The third argument is the in-process testability surface: callers
|
|
122
|
+
* (and tests) may inject `argv`, `stdout`, and `stderr` instead of
|
|
123
|
+
* relying on `process.argv` / `process.stdout` / `process.stderr`.
|
|
124
|
+
* Each option defaults to its `process` global when omitted, so
|
|
125
|
+
* existing two-argument call sites
|
|
126
|
+
* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to
|
|
127
|
+
* compile and behave identically.
|
|
128
|
+
*
|
|
129
|
+
* Returns the exit code so the caller can branch on it. Also writes
|
|
130
|
+
* the same code to `process.exitCode` so script-style callers that
|
|
131
|
+
* don't await the return value still surface a non-zero exit when
|
|
132
|
+
* something fails.
|
|
133
|
+
*
|
|
134
|
+
* Exit codes:
|
|
135
|
+
* - 0 — success, or `--help`, or imported-not-entrypoint no-op.
|
|
136
|
+
* - 1 — runtime/orchestration error (config not found, target
|
|
137
|
+
* mismatch, etc.).
|
|
138
|
+
* - 2 — usage error (unknown flag, malformed `--config`). Aligns
|
|
139
|
+
* with `docs/CLI Style Guide.md` § Exit Codes.
|
|
140
|
+
*/
|
|
141
|
+
static async run(importMetaUrl, MigrationClass, options = {}) {
|
|
142
|
+
if (!importMetaUrl) return 0;
|
|
143
|
+
const argv = options.argv ?? process.argv;
|
|
144
|
+
const stdout = options.stdout ?? process.stdout;
|
|
145
|
+
const stderr = options.stderr ?? process.stderr;
|
|
146
|
+
if (!isDirectEntrypoint(importMetaUrl, argv)) return 0;
|
|
147
|
+
const exitCode = await orchestrate(importMetaUrl, MigrationClass, {
|
|
148
|
+
argv,
|
|
149
|
+
stdout,
|
|
150
|
+
stderr
|
|
151
|
+
});
|
|
152
|
+
if (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;
|
|
153
|
+
return exitCode;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Argv-aware variant of the entrypoint guard. The shared
|
|
158
|
+
* `@internal/migration-tools` helper of the same name reads
|
|
159
|
+
* `process.argv[1]` directly, which doesn't compose with the new
|
|
160
|
+
* in-process testability surface (tests inject `argv` without mutating
|
|
161
|
+
* the process global). Inlined here so the migration-file CLI's check
|
|
162
|
+
* follows the injected `argv[1]` consistently.
|
|
163
|
+
*/
|
|
164
|
+
function isDirectEntrypoint(importMetaUrl, argv) {
|
|
165
|
+
const argv1 = argv[1];
|
|
166
|
+
if (!argv1) return false;
|
|
167
|
+
try {
|
|
168
|
+
return realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Argv-and-stream-driven orchestration body. Pulled out of the static
|
|
175
|
+
* method so the entrypoint guard / process-default plumbing stays
|
|
176
|
+
* separate from the parse + load + serialize steps.
|
|
177
|
+
*/
|
|
178
|
+
async function orchestrate(importMetaUrl, MigrationClass, ctx) {
|
|
179
|
+
const cli = Cli.from([MigrationFileCommand], {
|
|
180
|
+
binaryName: "migration.ts",
|
|
181
|
+
binaryLabel: "Migration file CLI"
|
|
182
|
+
});
|
|
183
|
+
const input = ctx.argv.slice(2);
|
|
184
|
+
const configError = detectInvalidConfig(input);
|
|
185
|
+
if (configError) {
|
|
186
|
+
writeStructuredError(ctx.stderr, configError);
|
|
187
|
+
return 2;
|
|
188
|
+
}
|
|
189
|
+
let parsed;
|
|
190
|
+
try {
|
|
191
|
+
const command = cli.process({
|
|
192
|
+
input: [...input],
|
|
193
|
+
context: {
|
|
194
|
+
stdout: ctx.stdout,
|
|
195
|
+
stderr: ctx.stderr
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (!(command instanceof MigrationFileCommand)) {
|
|
199
|
+
ctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
parsed = command;
|
|
203
|
+
} catch (err) {
|
|
204
|
+
return renderParseError(err, input, ctx.stderr);
|
|
205
|
+
}
|
|
206
|
+
if (parsed.help) {
|
|
207
|
+
ctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
await runMigration(importMetaUrl, MigrationClass, parsed, ctx);
|
|
212
|
+
return 0;
|
|
213
|
+
} catch (err) {
|
|
214
|
+
if (CliStructuredError.is(err)) writeStructuredError(ctx.stderr, err);
|
|
215
|
+
else if (MigrationToolsError.is(err)) {
|
|
216
|
+
const fix = err.fix ? `\n${err.fix}` : "";
|
|
217
|
+
ctx.stderr.write(`${err.code}: ${err.message}\n${err.why}${fix}\n`);
|
|
218
|
+
} else ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
219
|
+
return 1;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`
|
|
224
|
+
* contains a malformed `--config`:
|
|
225
|
+
*
|
|
226
|
+
* - `--config` as the last token (no value follows).
|
|
227
|
+
* - `--config <flag>` where `<flag>` starts with `-` (silently
|
|
228
|
+
* consuming the next flag would either drop the flag or serialize
|
|
229
|
+
* against the wrong project).
|
|
230
|
+
* - `--config <empty>` where the value is the empty string. Shells
|
|
231
|
+
* expand `--config ""` (or `--config "$UNSET_VAR"`) into a real
|
|
232
|
+
* empty argv token; treating that as a usage error here surfaces
|
|
233
|
+
* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an
|
|
234
|
+
* empty path.
|
|
235
|
+
* - `--config=` (the equals form with an empty value). Same shape as
|
|
236
|
+
* the empty-string case above; the user expressed intent to override
|
|
237
|
+
* the config path but the override is empty.
|
|
238
|
+
*
|
|
239
|
+
* `--config=<value>` and `--config <value>` with a non-empty value are
|
|
240
|
+
* both valid (and the equals form's value is allowed to start with
|
|
241
|
+
* `-` — the `=` makes the binding explicit).
|
|
242
|
+
*/
|
|
243
|
+
function detectInvalidConfig(input) {
|
|
244
|
+
for (let i = 0; i < input.length; i++) {
|
|
245
|
+
const token = input[i];
|
|
246
|
+
if (token === "--config") {
|
|
247
|
+
const next = input[i + 1];
|
|
248
|
+
if (next === void 0 || next === "") return errorMigrationCliInvalidConfigArg();
|
|
249
|
+
if (next.startsWith("-")) return errorMigrationCliInvalidConfigArg({ nextToken: next });
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (token === "--config=") return errorMigrationCliInvalidConfigArg();
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Translate clipanion's parse-time errors into the project's structured
|
|
258
|
+
* error envelopes.
|
|
259
|
+
*
|
|
260
|
+
* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and
|
|
261
|
+
* the bare-trailing `--config` case (where arity-1 needs a value but
|
|
262
|
+
* none was supplied). Distinguished by inspecting the input array.
|
|
263
|
+
* - `UsageError` covers schema/validator failures from typanion. None
|
|
264
|
+
* of the migration-file CLI's options have validators today, but we
|
|
265
|
+
* still translate it as a usage error (exit 2) for forward-compat.
|
|
266
|
+
* - Anything else re-throws — caller's outer catch will surface it as
|
|
267
|
+
* exit 1 (runtime error).
|
|
268
|
+
*/
|
|
269
|
+
function renderParseError(err, input, stderr) {
|
|
270
|
+
if (isUnknownSyntaxError(err)) {
|
|
271
|
+
writeStructuredError(stderr, errorMigrationCliUnknownFlag({
|
|
272
|
+
flag: findOffendingFlag(input),
|
|
273
|
+
knownFlags: KNOWN_FLAGS
|
|
274
|
+
}));
|
|
275
|
+
return 2;
|
|
276
|
+
}
|
|
277
|
+
if (err instanceof UsageError) {
|
|
278
|
+
writeStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));
|
|
279
|
+
return 2;
|
|
280
|
+
}
|
|
281
|
+
throw err;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Duck-type check for clipanion's `UnknownSyntaxError`: the class is
|
|
285
|
+
* thrown by the parser but is not re-exported from the package's main
|
|
286
|
+
* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).
|
|
287
|
+
* Identified by `name === 'UnknownSyntaxError'` and the
|
|
288
|
+
* `clipanion.type === 'none'` discriminator that clipanion's
|
|
289
|
+
* `ErrorWithMeta` interface guarantees.
|
|
290
|
+
*/
|
|
291
|
+
function isUnknownSyntaxError(err) {
|
|
292
|
+
if (!(err instanceof Error) || err.name !== "UnknownSyntaxError") return false;
|
|
293
|
+
const meta = err.clipanion;
|
|
294
|
+
return typeof meta === "object" && meta !== null && meta.type === "none";
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Best-effort: pull the first input token that doesn't match a known
|
|
298
|
+
* flag. Falls back to the first token when we can't pinpoint it. The
|
|
299
|
+
* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope
|
|
300
|
+
* (`Unknown flag \`<name>\``) and round-tripped via `meta.flag` so
|
|
301
|
+
* agent consumers can render their own "did you mean" suggestions.
|
|
302
|
+
*/
|
|
303
|
+
function findOffendingFlag(input) {
|
|
304
|
+
for (const token of input) {
|
|
305
|
+
if (!token.startsWith("-")) continue;
|
|
306
|
+
const head = token.split("=", 1)[0] ?? token;
|
|
307
|
+
if (!KNOWN_FLAGS.includes(head) && head !== "-h") return head;
|
|
308
|
+
}
|
|
309
|
+
return input[0] ?? "";
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Write a `CliStructuredError` envelope to the given stream. Format
|
|
313
|
+
* matches the legacy hand-rolled writer (`message: why`) so the rest of
|
|
314
|
+
* the project's error rendering stays consistent across surfaces. The
|
|
315
|
+
* full PN code (`PN-<domain>-<code>`) is included so consumers can
|
|
316
|
+
* grep for stable identifiers.
|
|
317
|
+
*/
|
|
318
|
+
function writeStructuredError(stream, err) {
|
|
319
|
+
const envelope = err.toEnvelope();
|
|
320
|
+
const why = envelope.why ?? envelope.summary;
|
|
321
|
+
const fix = envelope.fix ? `\n${envelope.fix}` : "";
|
|
322
|
+
stream.write(`${envelope.code}: ${envelope.summary}\n${why}${fix}\n`);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Read a previously-scaffolded `migration.json` from disk, returning
|
|
326
|
+
* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`
|
|
327
|
+
* when the file is present but cannot be parsed as JSON. The CLI feeds
|
|
328
|
+
* this into `buildMigrationArtifacts` so the pure builder can preserve
|
|
329
|
+
* fields owned by `migration plan` (contract bookends, `createdAt`) across
|
|
330
|
+
* re-emits.
|
|
331
|
+
*
|
|
332
|
+
* Author-time path: this loader still does not verify the manifest hash
|
|
333
|
+
* or schema — that is the apply-time loader's job. Hash mismatch is the
|
|
334
|
+
* *expected* outcome of a re-author (the developer's source changes
|
|
335
|
+
* invalidate the prior hash by construction), and verification here
|
|
336
|
+
* would block legitimate regenerations. Syntactic JSON-parse failure,
|
|
337
|
+
* however, is now surfaced rather than swallowed: a malformed
|
|
338
|
+
* `migration.json` indicates either a hand-edit gone wrong or partial
|
|
339
|
+
* write, and silently rebuilding from `describe()` would discard the
|
|
340
|
+
* user's on-disk content (preserved bookends, `createdAt`) without any
|
|
341
|
+
* indication something was wrong on disk.
|
|
342
|
+
* Apply-time consumers always route through the verifying
|
|
343
|
+
* `readMigrationPackage` in `@internal/migration-tools/io` instead.
|
|
344
|
+
*/
|
|
345
|
+
function readExistingMetadata(metadataPath) {
|
|
346
|
+
let raw;
|
|
347
|
+
try {
|
|
348
|
+
raw = readFileSync(metadataPath, "utf-8");
|
|
349
|
+
} catch {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
try {
|
|
353
|
+
return JSON.parse(raw);
|
|
354
|
+
} catch (e) {
|
|
355
|
+
throw errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Persist a migration instance's artifacts to `migrationDir`. In
|
|
360
|
+
* `dryRun` mode the artifacts are printed to stdout (with the same
|
|
361
|
+
* `--- migration.json --- / --- ops.json ---` framing the legacy
|
|
362
|
+
* `serializeMigration` helper used) and no files are written. Otherwise
|
|
363
|
+
* `ops.json` and `migration.json` are written next to `migration.ts` and
|
|
364
|
+
* a confirmation line is printed.
|
|
365
|
+
*
|
|
366
|
+
* File I/O lives in the CLI rather than `@internal/migration-tools`
|
|
367
|
+
* so the migration-tools package stays focused on the pure
|
|
368
|
+
* `Migration` → in-memory artifact conversion. The CLI is the only
|
|
369
|
+
* legitimate site for combining config loading, stack assembly, and
|
|
370
|
+
* filesystem persistence.
|
|
371
|
+
*/
|
|
372
|
+
async function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {
|
|
373
|
+
const metadataPath = join(migrationDir, "migration.json");
|
|
374
|
+
const { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));
|
|
375
|
+
if (dryRun) {
|
|
376
|
+
stdout.write(`--- migration.json ---\n${metadataJson}\n`);
|
|
377
|
+
stdout.write("--- ops.json ---\n");
|
|
378
|
+
stdout.write(`${opsJson}\n`);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
writeFileSync(join(migrationDir, "ops.json"), opsJson);
|
|
382
|
+
writeFileSync(metadataPath, metadataJson);
|
|
383
|
+
stdout.write(`Wrote ops.json + migration.json to ${migrationDir}\n`);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Inner orchestration: load config, probe-construct the migration,
|
|
387
|
+
* verify target, assemble the stack, construct with the stack, persist.
|
|
388
|
+
*
|
|
389
|
+
* Throws `CliStructuredError` for known failure modes (config not
|
|
390
|
+
* found, target mismatch); the outer `orchestrate` translates those to
|
|
391
|
+
* exit 1.
|
|
392
|
+
*/
|
|
393
|
+
async function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {
|
|
394
|
+
const migrationDir = dirname(fileURLToPath(importMetaUrl));
|
|
395
|
+
const config = await loadConfig(parsed.config);
|
|
396
|
+
const probe = new MigrationClass();
|
|
397
|
+
if (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({
|
|
398
|
+
migrationTargetId: probe.targetId,
|
|
399
|
+
configTargetId: config.target.targetId
|
|
400
|
+
});
|
|
401
|
+
await serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);
|
|
402
|
+
ctx.stderr;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
export { MigrationCLI };
|
|
406
|
+
|
|
407
|
+
//# sourceMappingURL=cli__migration-cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { loadConfig } from \"@internal/config-loader\";\nimport { CliStructuredError, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { dirname, join } from \"pathe\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { MigrationToolsError, errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma-next migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma-next.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the project's `prisma-next.config.ts` via the same `loadConfig`\n* the CLI commands use, walking up from the migration file's directory.\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma-next.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma-next.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (CliStructuredError.is(err)) writeStructuredError(ctx.stderr, err);\n\t\telse if (MigrationToolsError.is(err)) {\n\t\t\tconst fix = err.fix ? `\\n${err.fix}` : \"\";\n\t\t\tctx.stderr.write(`${err.code}: ${err.message}\\n${err.why}${fix}\\n`);\n\t\t} else ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationDir = dirname(fileURLToPath(importMetaUrl));\n\tconst config = await loadConfig(parsed.config);\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":"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"}
|