@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,101 @@
|
|
|
1
|
+
import { N as errorUnexpected, O as errorRuntime$1, W as formatStyledHeader, ct as setCommandExamples, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
|
|
3
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
5
|
+
import { relative, resolve } from "pathe";
|
|
6
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
7
|
+
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
import { EOL } from "node:os";
|
|
10
|
+
import { format } from "@prisma/orm-framework/psl-parser/format";
|
|
11
|
+
//#region ../../../1-framework/3-tooling/cli/dist/format-ByDm2goZ.mjs
|
|
12
|
+
function resolveNewline(formatterNewline, eol) {
|
|
13
|
+
if (formatterNewline !== void 0) return formatterNewline;
|
|
14
|
+
return eol === "\r\n" ? "CRLF" : "LF";
|
|
15
|
+
}
|
|
16
|
+
async function executeFormat(options) {
|
|
17
|
+
const eol = options.eol ?? EOL;
|
|
18
|
+
let config;
|
|
19
|
+
try {
|
|
20
|
+
config = await loadConfig(options.configPath);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
23
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));
|
|
24
|
+
}
|
|
25
|
+
const source = config.contract?.source;
|
|
26
|
+
if (source?.format !== "psl") return ok({ formatted: false });
|
|
27
|
+
const inputPath = source.inputs?.[0];
|
|
28
|
+
if (inputPath === void 0) return ok({ formatted: false });
|
|
29
|
+
let contents;
|
|
30
|
+
try {
|
|
31
|
+
contents = await readFile(inputPath, "utf-8");
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return notOk(errorRuntime$1("Failed to read contract source file", {
|
|
34
|
+
why: error instanceof Error ? error.message : String(error),
|
|
35
|
+
fix: `Check that ${inputPath} exists and is readable.`
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
const formatOptions = {
|
|
39
|
+
indent: config.formatter?.indent ?? 2,
|
|
40
|
+
newline: resolveNewline(config.formatter?.newline, eol)
|
|
41
|
+
};
|
|
42
|
+
let formatted;
|
|
43
|
+
try {
|
|
44
|
+
formatted = format(contents, formatOptions);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (isStructuredError(error) && error.code === "PSL.PARSE_FAILED") return notOk(errorRuntime$1("Cannot format PSL with parse errors", {
|
|
47
|
+
why: error.message,
|
|
48
|
+
fix: "Fix the parse errors in your schema and try again.",
|
|
49
|
+
meta: { diagnostics: error.meta?.["diagnostics"] }
|
|
50
|
+
}));
|
|
51
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
await writeFile(inputPath, formatted, "utf-8");
|
|
55
|
+
} catch (error) {
|
|
56
|
+
return notOk(errorRuntime$1("Failed to write formatted contract source file", {
|
|
57
|
+
why: error instanceof Error ? error.message : String(error),
|
|
58
|
+
fix: `Check that ${inputPath} is writable.`
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
return ok({
|
|
62
|
+
formatted: true,
|
|
63
|
+
path: inputPath
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function createFormatCommand() {
|
|
67
|
+
const command = new Command("format");
|
|
68
|
+
setCommandDescriptions(command, "Format your PSL contract source", "Formats the Prisma schema (PSL) contract source declared in your config\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\nread from the optional formatter config section, defaulting to two spaces and the\nsystem newline.");
|
|
69
|
+
setCommandExamples(command, ["prisma-next format", "prisma-next format --config ./custom-config.ts"]);
|
|
70
|
+
addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").action(async (options) => {
|
|
71
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
72
|
+
const ui = createTerminalUI(flags);
|
|
73
|
+
if (!flags.json && !flags.quiet) {
|
|
74
|
+
const displayConfigPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
|
|
75
|
+
ui.stderr(formatStyledHeader({
|
|
76
|
+
command: "format",
|
|
77
|
+
description: "Format your PSL contract source",
|
|
78
|
+
details: [{
|
|
79
|
+
label: "config",
|
|
80
|
+
value: displayConfigPath
|
|
81
|
+
}],
|
|
82
|
+
flags
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
const exitCode = handleResult(await executeFormat({ ...ifDefined("configPath", options.config) }), flags, ui, (value) => {
|
|
86
|
+
if (flags.json) {
|
|
87
|
+
ui.output(JSON.stringify(value));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (flags.quiet) return;
|
|
91
|
+
if (value.formatted) ui.success(`Formatted ${relative(process.cwd(), value.path ?? "")}`);
|
|
92
|
+
else ui.info("Nothing to format (contract source is not PSL).");
|
|
93
|
+
});
|
|
94
|
+
process.exit(exitCode);
|
|
95
|
+
});
|
|
96
|
+
return command;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { createFormatCommand as t };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=format-ByDm2goZ-DKLyhNHo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-ByDm2goZ-DKLyhNHo.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/format-ByDm2goZ.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorRuntime, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.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, writeFile } from \"node:fs/promises\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { EOL } from \"node:os\";\nimport { format } from \"@internal/psl-parser/format\";\n//#region src/control-api/operations/format.ts\nfunction resolveNewline(formatterNewline, eol) {\n\tif (formatterNewline !== void 0) return formatterNewline;\n\treturn eol === \"\\r\\n\" ? \"CRLF\" : \"LF\";\n}\nasync function executeFormat(options) {\n\tconst eol = options.eol ?? EOL;\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(options.configPath);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n\t}\n\tconst source = config.contract?.source;\n\tif (source?.format !== \"psl\") return ok({ formatted: false });\n\tconst inputPath = source.inputs?.[0];\n\tif (inputPath === void 0) return ok({ formatted: false });\n\tlet contents;\n\ttry {\n\t\tcontents = await readFile(inputPath, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"Failed to read contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} exists and is readable.`\n\t\t}));\n\t}\n\tconst formatOptions = {\n\t\tindent: config.formatter?.indent ?? 2,\n\t\tnewline: resolveNewline(config.formatter?.newline, eol)\n\t};\n\tlet formatted;\n\ttry {\n\t\tformatted = format(contents, formatOptions);\n\t} catch (error) {\n\t\tif (isStructuredError(error) && error.code === \"PSL.PARSE_FAILED\") return notOk(errorRuntime(\"Cannot format PSL with parse errors\", {\n\t\t\twhy: error.message,\n\t\t\tfix: \"Fix the parse errors in your schema and try again.\",\n\t\t\tmeta: { diagnostics: error.meta?.[\"diagnostics\"] }\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error)));\n\t}\n\ttry {\n\t\tawait writeFile(inputPath, formatted, \"utf-8\");\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"Failed to write formatted contract source file\", {\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tfix: `Check that ${inputPath} is writable.`\n\t\t}));\n\t}\n\treturn ok({\n\t\tformatted: true,\n\t\tpath: inputPath\n\t});\n}\n//#endregion\n//#region src/commands/format.ts\nfunction createFormatCommand() {\n\tconst command = new Command(\"format\");\n\tsetCommandDescriptions(command, \"Format your PSL contract source\", \"Formats the Prisma schema (PSL) contract source declared in your config\\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline are\\nread from the optional formatter config section, defaulting to two spaces and the\\nsystem newline.\");\n\tsetCommandExamples(command, [\"prisma-next format\", \"prisma-next format --config ./custom-config.ts\"]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst displayConfigPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\t\t\tui.stderr(formatStyledHeader({\n\t\t\t\tcommand: \"format\",\n\t\t\t\tdescription: \"Format your PSL contract source\",\n\t\t\t\tdetails: [{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: displayConfigPath\n\t\t\t\t}],\n\t\t\t\tflags\n\t\t\t}));\n\t\t}\n\t\tconst exitCode = handleResult(await executeFormat({ ...ifDefined(\"configPath\", options.config) }), flags, ui, (value) => {\n\t\t\tif (flags.json) {\n\t\t\t\tui.output(JSON.stringify(value));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (flags.quiet) return;\n\t\t\tif (value.formatted) ui.success(`Formatted ${relative(process.cwd(), value.path ?? \"\")}`);\n\t\t\telse ui.info(\"Nothing to format (contract source is not PSL).\");\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createFormatCommand as t };\n\n//# sourceMappingURL=format-ByDm2goZ.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,eAAe,kBAAkB,KAAK;CAC9C,IAAI,qBAAqB,KAAK,GAAG,OAAO;CACxC,OAAO,QAAQ,SAAS,SAAS;AAClC;AACA,eAAe,cAAc,SAAS;CACrC,MAAM,MAAM,QAAQ,OAAO;CAC3B,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,WAAW,QAAQ,UAAU;CAC7C,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,OAAO,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CACrF;CACA,MAAM,SAAS,OAAO,UAAU;CAChC,IAAI,QAAQ,WAAW,OAAO,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CAC5D,MAAM,YAAY,OAAO,SAAS;CAClC,IAAI,cAAc,KAAK,GAAG,OAAO,GAAG,EAAE,WAAW,MAAM,CAAC;CACxD,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,SAAS,WAAW,OAAO;CAC7C,SAAS,OAAO;EACf,OAAO,MAAMC,eAAa,uCAAuC;GAChE,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC1D,KAAK,cAAc,UAAU;EAC9B,CAAC,CAAC;CACH;CACA,MAAM,gBAAgB;EACrB,QAAQ,OAAO,WAAW,UAAU;EACpC,SAAS,eAAe,OAAO,WAAW,SAAS,GAAG;CACvD;CACA,IAAI;CACJ,IAAI;EACH,YAAY,OAAO,UAAU,aAAa;CAC3C,SAAS,OAAO;EACf,IAAI,kBAAkB,KAAK,KAAK,MAAM,SAAS,oBAAoB,OAAO,MAAMA,eAAa,uCAAuC;GACnI,KAAK,MAAM;GACX,KAAK;GACL,MAAM,EAAE,aAAa,MAAM,OAAO,eAAe;EAClD,CAAC,CAAC;EACF,OAAO,MAAM,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CACrF;CACA,IAAI;EACH,MAAM,UAAU,WAAW,WAAW,OAAO;CAC9C,SAAS,OAAO;EACf,OAAO,MAAMA,eAAa,kDAAkD;GAC3E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC1D,KAAK,cAAc,UAAU;EAC9B,CAAC,CAAC;CACH;CACA,OAAO,GAAG;EACT,WAAW;EACX,MAAM;CACP,CAAC;AACF;AAGA,SAAS,sBAAsB;CAC9B,MAAM,UAAU,IAAI,QAAQ,QAAQ;CACpC,uBAAuB,SAAS,mCAAmC,4UAA4U;CAC/Y,mBAAmB,SAAS,CAAC,sBAAsB,gDAAgD,CAAC;CACpG,iBAAiB,OAAO,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EAC9G,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;GAChC,MAAM,oBAAoB,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;GAC9F,GAAG,OAAO,mBAAmB;IAC5B,SAAS;IACT,aAAa;IACb,SAAS,CAAC;KACT,OAAO;KACP,OAAO;IACR,CAAC;IACD;GACD,CAAC,CAAC;EACH;EACA,MAAM,WAAW,aAAa,MAAM,cAAc,EAAE,GAAG,UAAU,cAAc,QAAQ,MAAM,EAAE,CAAC,GAAG,OAAO,KAAK,UAAU;GACxH,IAAI,MAAM,MAAM;IACf,GAAG,OAAO,KAAK,UAAU,KAAK,CAAC;IAC/B;GACD;GACA,IAAI,MAAM,OAAO;GACjB,IAAI,MAAM,WAAW,GAAG,QAAQ,aAAa,SAAS,QAAQ,IAAI,GAAG,MAAM,QAAQ,EAAE,GAAG;QACnF,GAAG,KAAK,iDAAiD;EAC/D,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { l as errorConfigValidation } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import "@prisma/orm-framework/components/components";
|
|
3
|
+
//#region ../../../1-framework/3-tooling/cli/dist/framework-components-CjshQKHA.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Asserts that all framework components are compatible with the expected family and target.
|
|
6
|
+
*
|
|
7
|
+
* This function validates that each component in the framework components array:
|
|
8
|
+
* - Has kind 'target', 'adapter', 'extension', or 'driver'
|
|
9
|
+
* - Has familyId matching expectedFamilyId
|
|
10
|
+
* - Has targetId matching expectedTargetId
|
|
11
|
+
*
|
|
12
|
+
* This validation happens at the CLI composition boundary, before passing components
|
|
13
|
+
* to typed planner/runner instances. It fills the gap between runtime validation
|
|
14
|
+
* (via `validateConfig()`) and compile-time type enforcement.
|
|
15
|
+
*
|
|
16
|
+
* @param expectedFamilyId - The expected family ID (e.g., 'sql')
|
|
17
|
+
* @param expectedTargetId - The expected target ID (e.g., 'postgres')
|
|
18
|
+
* @param frameworkComponents - Array of framework components to validate
|
|
19
|
+
* @returns The same array typed as TargetBoundComponentDescriptor
|
|
20
|
+
* @throws CliStructuredError if any component is incompatible
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const config = await loadConfig();
|
|
25
|
+
* const frameworkComponents = [config.target, config.adapter, ...(config.extensions ?? [])];
|
|
26
|
+
*
|
|
27
|
+
* // Validate and type-narrow components before passing to planner
|
|
28
|
+
* const typedComponents = assertFrameworkComponentsCompatible(
|
|
29
|
+
* config.family.familyId,
|
|
30
|
+
* config.target.targetId,
|
|
31
|
+
* frameworkComponents
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* const planner = target.migrations.createPlanner(familyInstance);
|
|
35
|
+
* planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {
|
|
39
|
+
for (let i = 0; i < frameworkComponents.length; i++) {
|
|
40
|
+
const component = frameworkComponents[i];
|
|
41
|
+
if (typeof component !== "object" || component === null) throw errorConfigValidation("frameworkComponents[]", { why: `Framework component at index ${i} must be an object` });
|
|
42
|
+
const record = component;
|
|
43
|
+
if (!Object.hasOwn(record, "kind")) throw errorConfigValidation("frameworkComponents[].kind", { why: `Framework component at index ${i} must have 'kind' property` });
|
|
44
|
+
const kind = record["kind"];
|
|
45
|
+
if (kind !== "target" && kind !== "adapter" && kind !== "extension" && kind !== "driver") throw errorConfigValidation("frameworkComponents[].kind", { why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')` });
|
|
46
|
+
if (!Object.hasOwn(record, "familyId")) throw errorConfigValidation("frameworkComponents[].familyId", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property` });
|
|
47
|
+
const familyId = record["familyId"];
|
|
48
|
+
if (familyId !== expectedFamilyId) throw errorConfigValidation("frameworkComponents[].familyId", { why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'` });
|
|
49
|
+
if (!Object.hasOwn(record, "targetId")) throw errorConfigValidation("frameworkComponents[].targetId", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property` });
|
|
50
|
+
const targetId = record["targetId"];
|
|
51
|
+
if (targetId !== expectedTargetId) throw errorConfigValidation("frameworkComponents[].targetId", { why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'` });
|
|
52
|
+
}
|
|
53
|
+
return frameworkComponents;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { assertFrameworkComponentsCompatible as t };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=framework-components-CjshQKHA-Dlp6Leo5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-components-CjshQKHA-Dlp6Leo5.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/framework-components-CjshQKHA.mjs"],"sourcesContent":["import { R as errorConfigValidation } from \"./command-helpers-CAoXqAY9.mjs\";\nimport \"@internal/framework-components/components\";\n//#region src/utils/framework-components.ts\n/**\n* Asserts that all framework components are compatible with the expected family and target.\n*\n* This function validates that each component in the framework components array:\n* - Has kind 'target', 'adapter', 'extension', or 'driver'\n* - Has familyId matching expectedFamilyId\n* - Has targetId matching expectedTargetId\n*\n* This validation happens at the CLI composition boundary, before passing components\n* to typed planner/runner instances. It fills the gap between runtime validation\n* (via `validateConfig()`) and compile-time type enforcement.\n*\n* @param expectedFamilyId - The expected family ID (e.g., 'sql')\n* @param expectedTargetId - The expected target ID (e.g., 'postgres')\n* @param frameworkComponents - Array of framework components to validate\n* @returns The same array typed as TargetBoundComponentDescriptor\n* @throws CliStructuredError if any component is incompatible\n*\n* @example\n* ```ts\n* const config = await loadConfig();\n* const frameworkComponents = [config.target, config.adapter, ...(config.extensions ?? [])];\n*\n* // Validate and type-narrow components before passing to planner\n* const typedComponents = assertFrameworkComponentsCompatible(\n* config.family.familyId,\n* config.target.targetId,\n* frameworkComponents\n* );\n*\n* const planner = target.migrations.createPlanner(familyInstance);\n* planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n* ```\n*/\nfunction assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {\n\tfor (let i = 0; i < frameworkComponents.length; i++) {\n\t\tconst component = frameworkComponents[i];\n\t\tif (typeof component !== \"object\" || component === null) throw errorConfigValidation(\"frameworkComponents[]\", { why: `Framework component at index ${i} must be an object` });\n\t\tconst record = component;\n\t\tif (!Object.hasOwn(record, \"kind\")) throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} must have 'kind' property` });\n\t\tconst kind = record[\"kind\"];\n\t\tif (kind !== \"target\" && kind !== \"adapter\" && kind !== \"extension\" && kind !== \"driver\") throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')` });\n\t\tif (!Object.hasOwn(record, \"familyId\")) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property` });\n\t\tconst familyId = record[\"familyId\"];\n\t\tif (familyId !== expectedFamilyId) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'` });\n\t\tif (!Object.hasOwn(record, \"targetId\")) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property` });\n\t\tconst targetId = record[\"targetId\"];\n\t\tif (targetId !== expectedTargetId) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'` });\n\t}\n\treturn frameworkComponents;\n}\n//#endregion\nexport { assertFrameworkComponentsCompatible as t };\n\n//# sourceMappingURL=framework-components-CjshQKHA.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,oCAAoC,kBAAkB,kBAAkB,qBAAqB;CACrG,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACpD,MAAM,YAAY,oBAAoB;EACtC,IAAI,OAAO,cAAc,YAAY,cAAc,MAAM,MAAM,sBAAsB,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,oBAAoB,CAAC;EAC5K,MAAM,SAAS;EACf,IAAI,CAAC,OAAO,OAAO,QAAQ,MAAM,GAAG,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,4BAA4B,CAAC;EACpK,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAAU,MAAM,sBAAsB,8BAA8B,EAAE,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,IAAI,EAAE,2DAA2D,CAAC;EAC3R,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;EAC3O,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,GAAG,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,iCAAiC,CAAC;EACxM,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBAAkB,MAAM,sBAAsB,kCAAkC,EAAE,KAAK,gCAAgC,EAAE,UAAU,OAAO,IAAI,EAAE,kBAAkB,OAAO,QAAQ,EAAE,kBAAkB,iBAAiB,GAAG,CAAC;CAC5O;CACA,OAAO;AACR"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region ../../../1-framework/3-tooling/cli/dist/global-flags-BpoOYtNZ.d.mts
|
|
2
|
+
//#region src/utils/global-flags.d.ts
|
|
3
|
+
type OutputFormat = 'pretty' | 'json';
|
|
4
|
+
interface GlobalFlags {
|
|
5
|
+
readonly format: OutputFormat;
|
|
6
|
+
readonly explicitFormat: boolean;
|
|
7
|
+
readonly json?: boolean;
|
|
8
|
+
readonly quiet?: boolean;
|
|
9
|
+
readonly verbose?: number;
|
|
10
|
+
readonly color?: boolean;
|
|
11
|
+
readonly interactive?: boolean;
|
|
12
|
+
readonly yes?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Common options parsed by Commander.js for every command.
|
|
16
|
+
* Extend this for command-specific options instead of duplicating these fields.
|
|
17
|
+
*/
|
|
18
|
+
interface CommonCommandOptions {
|
|
19
|
+
readonly format?: string;
|
|
20
|
+
readonly json?: string | boolean;
|
|
21
|
+
readonly quiet?: boolean;
|
|
22
|
+
readonly q?: boolean;
|
|
23
|
+
readonly verbose?: boolean;
|
|
24
|
+
readonly v?: boolean;
|
|
25
|
+
readonly trace?: boolean;
|
|
26
|
+
readonly color?: boolean;
|
|
27
|
+
readonly 'no-color'?: boolean;
|
|
28
|
+
readonly interactive?: boolean;
|
|
29
|
+
readonly 'no-interactive'?: boolean;
|
|
30
|
+
readonly yes?: boolean;
|
|
31
|
+
readonly y?: boolean;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { GlobalFlags as n, CommonCommandOptions as t };
|
|
35
|
+
//# sourceMappingURL=global-flags-BpoOYtNZ-CHZD3fud.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-flags-BpoOYtNZ-CHZD3fud.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/global-flags-BpoOYtNZ.d.mts"],"mappings":";;KACK;UACK;WACC,QAAQ;WACR;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;UAMD;WACC;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region ../../../1-framework/3-tooling/migration/dist/graph-bDjJ4GL9.d.mts
|
|
2
|
+
//#region src/graph.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* An entry in the migration graph. All on-disk migrations are attested,
|
|
5
|
+
* so `migrationHash` is always a string.
|
|
6
|
+
*/
|
|
7
|
+
interface MigrationEdge {
|
|
8
|
+
readonly from: string;
|
|
9
|
+
readonly to: string;
|
|
10
|
+
readonly migrationHash: string;
|
|
11
|
+
readonly dirName: string;
|
|
12
|
+
readonly createdAt: string;
|
|
13
|
+
/**
|
|
14
|
+
* Sorted, deduplicated list of `invariantId`s this edge provides.
|
|
15
|
+
* An empty array means the migration declares no routing-visible
|
|
16
|
+
* data transforms.
|
|
17
|
+
*/
|
|
18
|
+
readonly invariants: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
interface MigrationGraph {
|
|
21
|
+
readonly nodes: ReadonlySet<string>;
|
|
22
|
+
readonly forwardChain: ReadonlyMap<string, readonly MigrationEdge[]>;
|
|
23
|
+
readonly reverseChain: ReadonlyMap<string, readonly MigrationEdge[]>;
|
|
24
|
+
readonly migrationByHash: ReadonlyMap<string, MigrationEdge>;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { MigrationGraph as n, MigrationEdge as t };
|
|
28
|
+
//# sourceMappingURL=graph-bDjJ4GL9-BhFevsJS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-bDjJ4GL9-BhFevsJS.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/graph-bDjJ4GL9.d.mts"],"mappings":";;;;;;UAKU;WACC;WACA;WACA;WACA;WACA;;;;;;WAMA;;UAED;WACC,OAAO;WACP,cAAc,6BAA6B;WAC3C,cAAc,6BAA6B;WAC3C,iBAAiB,oBAAoB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { p as errorHashNotInGraph } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/graph-membership-DW6nnbyQ.mjs
|
|
3
|
+
function isGraphNode(hash, graph) {
|
|
4
|
+
if (hash === "empty") return true;
|
|
5
|
+
return graph.nodes.has(hash);
|
|
6
|
+
}
|
|
7
|
+
function assertHashIsGraphNode(hash, graph) {
|
|
8
|
+
if (isGraphNode(hash, graph)) return;
|
|
9
|
+
throw errorHashNotInGraph(hash, graph);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isGraphNode as n, assertHashIsGraphNode as t };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-membership-DW6nnbyQ-Bp2KcVwR.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/graph-membership-DW6nnbyQ.mjs"],"sourcesContent":["import { p as errorHashNotInGraph } from \"./errors-IpZm1Skp.mjs\";\nimport \"./constants-CM-w38DQ.mjs\";\n//#region src/graph-membership.ts\nfunction isGraphNode(hash, graph) {\n\tif (hash === \"empty\") return true;\n\treturn graph.nodes.has(hash);\n}\nfunction assertHashIsGraphNode(hash, graph) {\n\tif (isGraphNode(hash, graph)) return;\n\tthrow errorHashNotInGraph(hash, graph);\n}\n//#endregion\nexport { isGraphNode as n, assertHashIsGraphNode as t };\n\n//# sourceMappingURL=graph-membership-DW6nnbyQ.mjs.map"],"mappings":";;AAGA,SAAS,YAAY,MAAM,OAAO;CACjC,IAAI,SAAS,SAAS,OAAO;CAC7B,OAAO,MAAM,MAAM,IAAI,IAAI;AAC5B;AACA,SAAS,sBAAsB,MAAM,OAAO;CAC3C,IAAI,YAAY,MAAM,KAAK,GAAG;CAC9B,MAAM,oBAAoB,MAAM,KAAK;AACtC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
3
|
+
//#region ../../../1-framework/3-tooling/migration/dist/hash-DH8hl5Rq.mjs
|
|
4
|
+
function sha256Hex(input) {
|
|
5
|
+
return createHash("sha256").update(input).digest("hex");
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Content-addressed migration hash over (metadata envelope, ops). See
|
|
9
|
+
* ADR 199 — Storage-only migration identity for the rationale: the
|
|
10
|
+
* storage-hash bookends (`from`, `to`) inside the envelope anchor the
|
|
11
|
+
* contract identity by hash. The full contract IRs are not part of the
|
|
12
|
+
* manifest — they live in sibling `*-contract.json` files authored
|
|
13
|
+
* alongside the migration, never inlined here.
|
|
14
|
+
*
|
|
15
|
+
* The integrity check is purely structural, not semantic. The function
|
|
16
|
+
* canonicalizes its inputs via `sortKeys` (recursive) + `JSON.stringify`
|
|
17
|
+
* and hashes the result. Target-specific operation payloads (`step.sql`,
|
|
18
|
+
* Mongo's pipeline AST, …) are hashed verbatim — no per-target
|
|
19
|
+
* normalization is required, because what's being verified is "do the
|
|
20
|
+
* on-disk bytes still produce their recorded hash", not "do two
|
|
21
|
+
* semantically-equivalent migrations hash the same". The latter is an
|
|
22
|
+
* emit-drift concern (ADR 192 step 2).
|
|
23
|
+
*
|
|
24
|
+
* The symmetry across write and read holds because `JSON.parse(
|
|
25
|
+
* JSON.stringify(x))` round-trips JSON-safe values losslessly and
|
|
26
|
+
* `sortKeys` is idempotent and deterministic — write-time and read-time
|
|
27
|
+
* canonicalization produce the same canonical bytes regardless of
|
|
28
|
+
* source-side key ordering or whitespace.
|
|
29
|
+
*
|
|
30
|
+
* The `migrationHash` field on the metadata is stripped before hashing
|
|
31
|
+
* so the function can be used both at write time (when no hash exists
|
|
32
|
+
* yet) and at verify time (rehashing an already-attested record).
|
|
33
|
+
*/
|
|
34
|
+
function computeMigrationHash(metadata, ops) {
|
|
35
|
+
const { migrationHash: _migrationHash, ...strippedMeta } = metadata;
|
|
36
|
+
return sha256Hex(canonicalizeJson([canonicalizeJson(strippedMeta), canonicalizeJson(ops)].map(sha256Hex)));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Re-hash an in-memory migration package and compare against the stored
|
|
40
|
+
* `migrationHash`. See `computeMigrationHash` for the canonicalization rules.
|
|
41
|
+
*
|
|
42
|
+
* Returns `{ ok: true }` when the package is internally consistent, or
|
|
43
|
+
* `{ ok: false, reason: 'mismatch', storedHash, computedHash }` when it is
|
|
44
|
+
* not — typically a sign of FS corruption, partial writes, or a post-emit
|
|
45
|
+
* hand edit.
|
|
46
|
+
*/
|
|
47
|
+
function verifyMigrationHash(pkg) {
|
|
48
|
+
const computed = computeMigrationHash(pkg.metadata, pkg.ops);
|
|
49
|
+
if (pkg.metadata.migrationHash === computed) return {
|
|
50
|
+
ok: true,
|
|
51
|
+
storedHash: pkg.metadata.migrationHash,
|
|
52
|
+
computedHash: computed
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
reason: "mismatch",
|
|
57
|
+
storedHash: pkg.metadata.migrationHash,
|
|
58
|
+
computedHash: computed
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { verifyMigrationHash as n, computeMigrationHash as t };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=hash-DH8hl5Rq-BpM2t3Nu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-DH8hl5Rq-BpM2t3Nu.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/hash-DH8hl5Rq.mjs"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\n//#region src/hash.ts\nfunction sha256Hex(input) {\n\treturn createHash(\"sha256\").update(input).digest(\"hex\");\n}\n/**\n* Content-addressed migration hash over (metadata envelope, ops). See\n* ADR 199 — Storage-only migration identity for the rationale: the\n* storage-hash bookends (`from`, `to`) inside the envelope anchor the\n* contract identity by hash. The full contract IRs are not part of the\n* manifest — they live in sibling `*-contract.json` files authored\n* alongside the migration, never inlined here.\n*\n* The integrity check is purely structural, not semantic. The function\n* canonicalizes its inputs via `sortKeys` (recursive) + `JSON.stringify`\n* and hashes the result. Target-specific operation payloads (`step.sql`,\n* Mongo's pipeline AST, …) are hashed verbatim — no per-target\n* normalization is required, because what's being verified is \"do the\n* on-disk bytes still produce their recorded hash\", not \"do two\n* semantically-equivalent migrations hash the same\". The latter is an\n* emit-drift concern (ADR 192 step 2).\n*\n* The symmetry across write and read holds because `JSON.parse(\n* JSON.stringify(x))` round-trips JSON-safe values losslessly and\n* `sortKeys` is idempotent and deterministic — write-time and read-time\n* canonicalization produce the same canonical bytes regardless of\n* source-side key ordering or whitespace.\n*\n* The `migrationHash` field on the metadata is stripped before hashing\n* so the function can be used both at write time (when no hash exists\n* yet) and at verify time (rehashing an already-attested record).\n*/\nfunction computeMigrationHash(metadata, ops) {\n\tconst { migrationHash: _migrationHash, ...strippedMeta } = metadata;\n\treturn sha256Hex(canonicalizeJson([canonicalizeJson(strippedMeta), canonicalizeJson(ops)].map(sha256Hex)));\n}\n/**\n* Re-hash an in-memory migration package and compare against the stored\n* `migrationHash`. See `computeMigrationHash` for the canonicalization rules.\n*\n* Returns `{ ok: true }` when the package is internally consistent, or\n* `{ ok: false, reason: 'mismatch', storedHash, computedHash }` when it is\n* not — typically a sign of FS corruption, partial writes, or a post-emit\n* hand edit.\n*/\nfunction verifyMigrationHash(pkg) {\n\tconst computed = computeMigrationHash(pkg.metadata, pkg.ops);\n\tif (pkg.metadata.migrationHash === computed) return {\n\t\tok: true,\n\t\tstoredHash: pkg.metadata.migrationHash,\n\t\tcomputedHash: computed\n\t};\n\treturn {\n\t\tok: false,\n\t\treason: \"mismatch\",\n\t\tstoredHash: pkg.metadata.migrationHash,\n\t\tcomputedHash: computed\n\t};\n}\n//#endregion\nexport { verifyMigrationHash as n, computeMigrationHash as t };\n\n//# sourceMappingURL=hash-DH8hl5Rq.mjs.map"],"mappings":";;;AAGA,SAAS,UAAU,OAAO;CACzB,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,KAAK;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,qBAAqB,UAAU,KAAK;CAC5C,MAAM,EAAE,eAAe,gBAAgB,GAAG,iBAAiB;CAC3D,OAAO,UAAU,iBAAiB,CAAC,iBAAiB,YAAY,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;AAC1G;;;;;;;;;;AAUA,SAAS,oBAAoB,KAAK;CACjC,MAAM,WAAW,qBAAqB,IAAI,UAAU,IAAI,GAAG;CAC3D,IAAI,IAAI,SAAS,kBAAkB,UAAU,OAAO;EACnD,IAAI;EACJ,YAAY,IAAI,SAAS;EACzB,cAAc;CACf;CACA,OAAO;EACN,IAAI;EACJ,QAAQ;EACR,YAAY,IAAI,SAAS;EACzB,cAAc;CACf;AACD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
|
|
2
|
+
import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
|
|
3
|
+
//#region ../../../1-framework/3-tooling/migration/dist/exports/hash.d.mts
|
|
4
|
+
//#region src/hash.d.ts
|
|
5
|
+
interface VerifyResult {
|
|
6
|
+
readonly ok: boolean;
|
|
7
|
+
readonly reason?: 'mismatch';
|
|
8
|
+
readonly storedHash: string;
|
|
9
|
+
readonly computedHash: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Content-addressed migration hash over (metadata envelope, ops). See
|
|
13
|
+
* ADR 199 — Storage-only migration identity for the rationale: the
|
|
14
|
+
* storage-hash bookends (`from`, `to`) inside the envelope anchor the
|
|
15
|
+
* contract identity by hash. The full contract IRs are not part of the
|
|
16
|
+
* manifest — they live in sibling `*-contract.json` files authored
|
|
17
|
+
* alongside the migration, never inlined here.
|
|
18
|
+
*
|
|
19
|
+
* The integrity check is purely structural, not semantic. The function
|
|
20
|
+
* canonicalizes its inputs via `sortKeys` (recursive) + `JSON.stringify`
|
|
21
|
+
* and hashes the result. Target-specific operation payloads (`step.sql`,
|
|
22
|
+
* Mongo's pipeline AST, …) are hashed verbatim — no per-target
|
|
23
|
+
* normalization is required, because what's being verified is "do the
|
|
24
|
+
* on-disk bytes still produce their recorded hash", not "do two
|
|
25
|
+
* semantically-equivalent migrations hash the same". The latter is an
|
|
26
|
+
* emit-drift concern (ADR 192 step 2).
|
|
27
|
+
*
|
|
28
|
+
* The symmetry across write and read holds because `JSON.parse(
|
|
29
|
+
* JSON.stringify(x))` round-trips JSON-safe values losslessly and
|
|
30
|
+
* `sortKeys` is idempotent and deterministic — write-time and read-time
|
|
31
|
+
* canonicalization produce the same canonical bytes regardless of
|
|
32
|
+
* source-side key ordering or whitespace.
|
|
33
|
+
*
|
|
34
|
+
* The `migrationHash` field on the metadata is stripped before hashing
|
|
35
|
+
* so the function can be used both at write time (when no hash exists
|
|
36
|
+
* yet) and at verify time (rehashing an already-attested record).
|
|
37
|
+
*/
|
|
38
|
+
declare function computeMigrationHash(metadata: Omit<MigrationMetadata$1, 'migrationHash'> & {
|
|
39
|
+
readonly migrationHash?: string;
|
|
40
|
+
}, ops: MigrationOps): string;
|
|
41
|
+
/**
|
|
42
|
+
* Re-hash an in-memory migration package and compare against the stored
|
|
43
|
+
* `migrationHash`. See `computeMigrationHash` for the canonicalization rules.
|
|
44
|
+
*
|
|
45
|
+
* Returns `{ ok: true }` when the package is internally consistent, or
|
|
46
|
+
* `{ ok: false, reason: 'mismatch', storedHash, computedHash }` when it is
|
|
47
|
+
* not — typically a sign of FS corruption, partial writes, or a post-emit
|
|
48
|
+
* hand edit.
|
|
49
|
+
*/
|
|
50
|
+
declare function verifyMigrationHash(pkg: OnDiskMigrationPackage): VerifyResult;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { computeMigrationHash as n, verifyMigrationHash as r, VerifyResult as t };
|
|
53
|
+
//# sourceMappingURL=hash-XZYYKJ-i.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-XZYYKJ-i.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/hash.d.mts"],"mappings":";;;;UAGU;WACC;WACA;WACA;WACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BM,qBAAqB,UAAU,KAAK;WAC1C;GACR,KAAK;;;;;;;;;;iBAUS,oBAAoB,KAAK,yBAAyB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { r as ShellName, t as ShellDefinition } from "./shells-COHV_Ozf.mjs";
|
|
2
|
+
//#region ../../../0-shared/publish-surface/dist/import-roots.d.mts
|
|
3
|
+
//#region src/import-roots.d.ts
|
|
4
|
+
/** An import root that emitted code cannot express. */
|
|
5
|
+
declare class ImportRootError extends Error {}
|
|
6
|
+
type ImportRootMode = 'internal' | 'facade' | 'platform';
|
|
7
|
+
/**
|
|
8
|
+
* The published packages an application depends on directly, from emission's
|
|
9
|
+
* point of view.
|
|
10
|
+
*
|
|
11
|
+
* - `internal` — the repo's own workspace names. Emitted output is unchanged
|
|
12
|
+
* from before ADR 242; this is the default and stays so until every in-repo
|
|
13
|
+
* consumer imports published names.
|
|
14
|
+
* - `facade` — the application installed one `@prisma/orm-<database>` package.
|
|
15
|
+
* - `platform` — a decomposed install that wires the platform packages itself.
|
|
16
|
+
*/
|
|
17
|
+
type ImportRoot = {
|
|
18
|
+
readonly mode: 'internal';
|
|
19
|
+
} | {
|
|
20
|
+
readonly mode: 'facade';
|
|
21
|
+
readonly facade: ShellName;
|
|
22
|
+
} | {
|
|
23
|
+
readonly mode: 'platform';
|
|
24
|
+
};
|
|
25
|
+
declare const internalImportRoot: Extract<ImportRoot, {
|
|
26
|
+
mode: 'internal';
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Rewrites one module specifier for an import root. Specifiers outside the
|
|
30
|
+
* internal scope — relative paths, `node:` builtins, third-party packages —
|
|
31
|
+
* come back unchanged.
|
|
32
|
+
*/
|
|
33
|
+
type ImportSpecifierResolver = (specifier: string) => string;
|
|
34
|
+
/**
|
|
35
|
+
* The import root an application's own dependency list expresses.
|
|
36
|
+
*
|
|
37
|
+
* Emission has to name packages the application can actually resolve, and the
|
|
38
|
+
* application already states which those are. Reading its manifest keeps the
|
|
39
|
+
* two from drifting and lets consumers move to published names one project at
|
|
40
|
+
* a time instead of behind a repository-wide switch.
|
|
41
|
+
*
|
|
42
|
+
* A project that names exactly one facade is on the facade root; one that
|
|
43
|
+
* names platform shells without a facade is a decomposed install; anything
|
|
44
|
+
* else — including a project with no `@prisma/orm-*` dependency at all — is on
|
|
45
|
+
* the internal root, which emits workspace names unchanged.
|
|
46
|
+
*
|
|
47
|
+
* @throws {ImportRootError} when the project depends on two facades, which no
|
|
48
|
+
* single generated file can be emitted for.
|
|
49
|
+
*/
|
|
50
|
+
declare function importRootForDependencies(dependencies: Iterable<string>): ImportRoot;
|
|
51
|
+
interface OwningShell {
|
|
52
|
+
readonly shell: ShellName;
|
|
53
|
+
readonly entry: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Takes the shell map as an argument rather than closing over `publicShells`
|
|
57
|
+
* so the duplicate-owner guard is reachable from a test: the real map is
|
|
58
|
+
* valid by construction, and a guard nothing can exercise is a guard nobody
|
|
59
|
+
* knows still works.
|
|
60
|
+
*/
|
|
61
|
+
declare function buildOwnerIndex(shells: ReadonlyMap<ShellName, ShellDefinition>): Map<string, OwningShell>;
|
|
62
|
+
/**
|
|
63
|
+
* The shells an application installs directly under this root. Emitted code
|
|
64
|
+
* may name only these: a package manager puts a package's own dependencies in
|
|
65
|
+
* its own `node_modules`, so importing a transitively installed package fails
|
|
66
|
+
* to resolve at run time even though the files are on disk.
|
|
67
|
+
*/
|
|
68
|
+
declare function directDependencyShells(root: ImportRoot): ReadonlySet<ShellName>;
|
|
69
|
+
/**
|
|
70
|
+
* The platform-install name for an internal specifier, with the shell that
|
|
71
|
+
* owns it. The shell build needs both: an import that stays inside the shell
|
|
72
|
+
* being built is bundled rather than externalized.
|
|
73
|
+
*/
|
|
74
|
+
declare function platformEntrypointOf(specifier: string): {
|
|
75
|
+
shell: ShellName;
|
|
76
|
+
id: string;
|
|
77
|
+
};
|
|
78
|
+
declare function resolveImportSpecifier(specifier: string, root: ImportRoot): string;
|
|
79
|
+
declare function createImportSpecifierResolver(root: ImportRoot): ImportSpecifierResolver;
|
|
80
|
+
/**
|
|
81
|
+
* The import roots a scaffolded application can be generated against.
|
|
82
|
+
*
|
|
83
|
+
* `platform` is absent deliberately, and this is a modelling statement rather
|
|
84
|
+
* than a limitation to be lifted: `prisma-next init` writes an application
|
|
85
|
+
* around a per-database facade, and that facade's `runtime` entrypoint is its
|
|
86
|
+
* own wiring code, not a re-export of anything. A decomposed install has no
|
|
87
|
+
* name for it because it has no such module — it wires the platform packages
|
|
88
|
+
* itself. Scaffolding a decomposed project is a different template, not a
|
|
89
|
+
* different import root.
|
|
90
|
+
*/
|
|
91
|
+
type ScaffoldImportRoot = Extract<ImportRoot, {
|
|
92
|
+
mode: 'internal' | 'facade';
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Builds the resolver `prisma-next init` scaffolds with. Identical to
|
|
96
|
+
* {@link createImportSpecifierResolver} except that it will not accept a root
|
|
97
|
+
* a scaffold cannot express, so the impossible case is rejected where the
|
|
98
|
+
* resolver is made rather than when a template happens to hit a name.
|
|
99
|
+
*/
|
|
100
|
+
declare function createScaffoldSpecifierResolver(root: ScaffoldImportRoot): ImportSpecifierResolver;
|
|
101
|
+
/** The module specifiers a generated source file names. */
|
|
102
|
+
declare function importedSpecifiers(source: string): string[];
|
|
103
|
+
/**
|
|
104
|
+
* The specifiers in a generated file that the application would not have as a
|
|
105
|
+
* direct dependency under `root` — the thing no emitted file may contain.
|
|
106
|
+
*
|
|
107
|
+
* Under the `internal` root nothing is reported: those names are the
|
|
108
|
+
* repository's own, and every in-repo consumer resolves them through the
|
|
109
|
+
* workspace.
|
|
110
|
+
*
|
|
111
|
+
* Throws rather than returning `[]` when the source plainly has imports but
|
|
112
|
+
* the scan found none. An audit whose scanner has stopped matching would
|
|
113
|
+
* otherwise report every file as clean, which is the one failure mode that
|
|
114
|
+
* makes the audit worse than not having it.
|
|
115
|
+
*/
|
|
116
|
+
declare function transitiveImports(source: string, root: ImportRoot): string[];
|
|
117
|
+
//#endregion
|
|
118
|
+
export { ScaffoldImportRoot as a, createScaffoldSpecifierResolver as c, importedSpecifiers as d, internalImportRoot as f, transitiveImports as h, ImportSpecifierResolver as i, directDependencyShells as l, resolveImportSpecifier as m, ImportRootError as n, buildOwnerIndex as o, platformEntrypointOf as p, ImportRootMode as r, createImportSpecifierResolver as s, ImportRoot as t, importRootForDependencies as u };
|
|
119
|
+
//# sourceMappingURL=import-roots-B6CtsWXb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-roots-B6CtsWXb.d.mts","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.d.mts"],"mappings":";;;;cAGc,wBAAwB;KACjC;;;;;;;;;;;KAWA;WACM;;WAEA;WACA,QAAQ;;WAER;;cAEG,oBAAoB,QAAQ;EACxC;;;;;;;KAOG,2BAA2B;;;;;;;;;;;;;;;;;iBAiBf,0BAA0B,cAAc,mBAAmB;UAClE;WACC,OAAO;WACP;;;;;;;;iBAQM,gBAAgB,QAAQ,YAAY,WAAW,mBAAmB,YAAY;;;;;;;iBAO9E,uBAAuB,MAAM,aAAa,YAAY;;;;;;iBAMtD,qBAAqB;EACpC,OAAO;EACP;;iBAEe,uBAAuB,mBAAmB,MAAM;iBAChD,8BAA8B,MAAM,aAAa;;;;;;;;;;;;KAY7D,qBAAqB,QAAQ;EAChC;;;;;;;;iBAQe,gCAAgC,MAAM,qBAAqB;;iBAE3D,mBAAmB;;;;;;;;;;;;;;iBAcnB,kBAAkB,gBAAgB,MAAM"}
|