@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,359 @@
|
|
|
1
|
+
import { O as errorRuntime$1, u as errorContractConfigMissing$1 } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-CjshQKHA-Dlp6Leo5.mjs";
|
|
3
|
+
import { t as createProjectSpecifierResolver } from "./project-import-root-CpwLCDLY-DkVwAnWj.mjs";
|
|
4
|
+
import { t as enrichContract } from "./contract-enrichment-DrMvvY2A-DxNGeF4d.mjs";
|
|
5
|
+
import { r as getEmittedArtifactPaths, t as emit } from "./exports-D3-NwrMA-CadaBGQ3.mjs";
|
|
6
|
+
import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
9
|
+
import { basename, dirname, join } from "pathe";
|
|
10
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
11
|
+
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
12
|
+
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var __defProp$1 = Object.defineProperty;
|
|
15
|
+
var __exportAll$1 = (all, no_symbols) => {
|
|
16
|
+
let target = {};
|
|
17
|
+
for (var name in all) __defProp$1(target, name, {
|
|
18
|
+
get: all[name],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
|
|
22
|
+
return target;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../../../1-framework/3-tooling/cli/dist/contract-emit-B6odMoem.mjs
|
|
26
|
+
var contract_emit_B6odMoem_exports = /* @__PURE__ */ __exportAll$1({
|
|
27
|
+
n: () => executeContractEmit,
|
|
28
|
+
r: () => disposeEmitQueue,
|
|
29
|
+
t: () => contract_emit_exports
|
|
30
|
+
});
|
|
31
|
+
var __defProp = Object.defineProperty;
|
|
32
|
+
var __exportAll = (all, no_symbols) => {
|
|
33
|
+
let target = {};
|
|
34
|
+
for (var name in all) __defProp(target, name, {
|
|
35
|
+
get: all[name],
|
|
36
|
+
enumerable: true
|
|
37
|
+
});
|
|
38
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
39
|
+
return target;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Per-output FIFO queue for `executeContractEmit`.
|
|
43
|
+
*
|
|
44
|
+
* Ensures that at most one emit (load → resolve source → emit bytes → publish)
|
|
45
|
+
* runs per output JSON path at a time. Concurrent calls for the same path
|
|
46
|
+
* line up behind the in-flight one and run in submission order; the user-visible
|
|
47
|
+
* outcome is "last submission wins on disk" without any supersession bookkeeping.
|
|
48
|
+
*
|
|
49
|
+
* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`
|
|
50
|
+
* when they stop publishing to a path, otherwise the module-global `Map`
|
|
51
|
+
* accumulates one entry per unique output path for the lifetime of the process.
|
|
52
|
+
*/
|
|
53
|
+
const emitQueues = /* @__PURE__ */ new Map();
|
|
54
|
+
function queueEmitByOutput(outputJsonPath, action) {
|
|
55
|
+
const next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);
|
|
56
|
+
emitQueues.set(outputJsonPath, next);
|
|
57
|
+
return next;
|
|
58
|
+
}
|
|
59
|
+
function disposeEmitQueue(outputJsonPath) {
|
|
60
|
+
emitQueues.delete(outputJsonPath);
|
|
61
|
+
}
|
|
62
|
+
function isRecord$1(value) {
|
|
63
|
+
return typeof value === "object" && value !== null;
|
|
64
|
+
}
|
|
65
|
+
function createTempArtifactPath(path, publicationToken, phase) {
|
|
66
|
+
return join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);
|
|
67
|
+
}
|
|
68
|
+
async function readExistingArtifact(path) {
|
|
69
|
+
try {
|
|
70
|
+
return { content: await readFile(path, "utf-8") };
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (isRecord$1(error) && error["code"] === "ENOENT") return "remove";
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function restoreArtifact(path, previous, publicationToken) {
|
|
77
|
+
if (previous === "remove") {
|
|
78
|
+
await rm(path, { force: true });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const restorePath = createTempArtifactPath(path, publicationToken, "rollback");
|
|
82
|
+
await writeFile(restorePath, previous.content, "utf-8");
|
|
83
|
+
try {
|
|
84
|
+
await rename(restorePath, path);
|
|
85
|
+
} finally {
|
|
86
|
+
await rm(restorePath, { force: true });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function withRollbackFailureCause(error, rollbackFailures) {
|
|
90
|
+
const rollbackCause = new AggregateError(rollbackFailures, "Failed to restore published artifacts");
|
|
91
|
+
if (error instanceof Error) {
|
|
92
|
+
Object.defineProperty(error, "cause", {
|
|
93
|
+
value: rollbackCause,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true
|
|
96
|
+
});
|
|
97
|
+
return error;
|
|
98
|
+
}
|
|
99
|
+
return new Error(String(error), { cause: rollbackCause });
|
|
100
|
+
}
|
|
101
|
+
async function publishPairWithRollback(entries, publicationToken) {
|
|
102
|
+
const replaced = [];
|
|
103
|
+
try {
|
|
104
|
+
for (const entry of entries) {
|
|
105
|
+
await rename(entry.tempPath, entry.outputPath);
|
|
106
|
+
replaced.push(entry);
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
110
|
+
if (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {
|
|
115
|
+
const tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, "next");
|
|
116
|
+
const tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, "next");
|
|
117
|
+
try {
|
|
118
|
+
await writeFile(tempJsonPath, contractJson, "utf-8");
|
|
119
|
+
await writeFile(tempDtsPath, contractDts, "utf-8");
|
|
120
|
+
if (await beforePublish?.() === false) return false;
|
|
121
|
+
const previousJson = await readExistingArtifact(outputJsonPath);
|
|
122
|
+
await publishPairWithRollback([{
|
|
123
|
+
tempPath: tempDtsPath,
|
|
124
|
+
outputPath: outputDtsPath,
|
|
125
|
+
previous: await readExistingArtifact(outputDtsPath)
|
|
126
|
+
}, {
|
|
127
|
+
tempPath: tempJsonPath,
|
|
128
|
+
outputPath: outputJsonPath,
|
|
129
|
+
previous: previousJson
|
|
130
|
+
}], publicationToken);
|
|
131
|
+
return true;
|
|
132
|
+
} finally {
|
|
133
|
+
await Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const IMPORT_PATTERN = /import\s+type\s+.*?\s+from\s+['"](@[^/]+\/[^/'"]+)/g;
|
|
137
|
+
function extractPackageSpecifiers(dtsContent) {
|
|
138
|
+
const packages = /* @__PURE__ */ new Set();
|
|
139
|
+
for (const match of dtsContent.matchAll(IMPORT_PATTERN)) {
|
|
140
|
+
const pkg = match[1];
|
|
141
|
+
if (pkg) packages.add(pkg);
|
|
142
|
+
}
|
|
143
|
+
return [...packages];
|
|
144
|
+
}
|
|
145
|
+
function validateContractDeps(dtsContent, projectRoot) {
|
|
146
|
+
const packages = extractPackageSpecifiers(dtsContent);
|
|
147
|
+
const resolve = createRequire(`${projectRoot}/package.json`);
|
|
148
|
+
const missing = [];
|
|
149
|
+
for (const pkg of packages) try {
|
|
150
|
+
resolve.resolve(`${pkg}/package.json`);
|
|
151
|
+
} catch {
|
|
152
|
+
missing.push(pkg);
|
|
153
|
+
}
|
|
154
|
+
if (missing.length === 0) return { missing };
|
|
155
|
+
return {
|
|
156
|
+
missing,
|
|
157
|
+
warning: [
|
|
158
|
+
"contract.d.ts imports types from packages that are not installed:",
|
|
159
|
+
missing.map((p) => ` - ${p}`).join("\n"),
|
|
160
|
+
"",
|
|
161
|
+
"Install them with your package manager:",
|
|
162
|
+
...missing.map((p) => ` ${p}`)
|
|
163
|
+
].join("\n")
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
var contract_emit_exports = /* @__PURE__ */ __exportAll({ executeContractEmit: () => executeContractEmit });
|
|
167
|
+
const EMIT_ACTION = "emit";
|
|
168
|
+
function isRecord(value) {
|
|
169
|
+
return typeof value === "object" && value !== null;
|
|
170
|
+
}
|
|
171
|
+
function startSpan(onProgress, spanId, label) {
|
|
172
|
+
onProgress?.({
|
|
173
|
+
action: EMIT_ACTION,
|
|
174
|
+
kind: "spanStart",
|
|
175
|
+
spanId,
|
|
176
|
+
label
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function endSpan(onProgress, spanId, outcome) {
|
|
180
|
+
onProgress?.({
|
|
181
|
+
action: EMIT_ACTION,
|
|
182
|
+
kind: "spanEnd",
|
|
183
|
+
spanId,
|
|
184
|
+
outcome
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function failedToResolveContractSource(why, fix, meta) {
|
|
188
|
+
return errorRuntime$1("Failed to resolve contract source", {
|
|
189
|
+
why,
|
|
190
|
+
fix,
|
|
191
|
+
...ifDefined("meta", meta)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function diagnosticLocationSuffix(diagnostic) {
|
|
195
|
+
const sourceId = typeof diagnostic["sourceId"] === "string" ? diagnostic["sourceId"] : void 0;
|
|
196
|
+
const span = isRecord(diagnostic["span"]) ? diagnostic["span"] : void 0;
|
|
197
|
+
const start = span && isRecord(span["start"]) ? span["start"] : void 0;
|
|
198
|
+
const line = start && typeof start["line"] === "number" ? start["line"] : void 0;
|
|
199
|
+
const column = start && typeof start["column"] === "number" ? start["column"] : void 0;
|
|
200
|
+
if (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;
|
|
201
|
+
if (sourceId) return ` (${sourceId})`;
|
|
202
|
+
return "";
|
|
203
|
+
}
|
|
204
|
+
function mapDiagnosticsToIssues(diagnostics) {
|
|
205
|
+
const issues = [];
|
|
206
|
+
for (const raw of diagnostics) {
|
|
207
|
+
if (!isRecord(raw)) continue;
|
|
208
|
+
const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
|
|
209
|
+
const message = typeof raw["message"] === "string" ? raw["message"] : "";
|
|
210
|
+
issues.push({
|
|
211
|
+
kind: code,
|
|
212
|
+
message: `${message}${diagnosticLocationSuffix(raw)}`
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return issues;
|
|
216
|
+
}
|
|
217
|
+
function validateProviderResult(providerResult) {
|
|
218
|
+
if (!isRecord(providerResult) || typeof providerResult["ok"] !== "boolean") return {
|
|
219
|
+
ok: false,
|
|
220
|
+
error: failedToResolveContractSource("Contract source provider returned malformed result shape.", "Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).")
|
|
221
|
+
};
|
|
222
|
+
if (providerResult["ok"]) {
|
|
223
|
+
if (!("value" in providerResult)) return {
|
|
224
|
+
ok: false,
|
|
225
|
+
error: failedToResolveContractSource("Contract source provider returned malformed success result: missing value.", "Ensure contract.source.load success payload is ok(Contract).")
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
ok: true,
|
|
229
|
+
value: providerResult["value"]
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
const failure = providerResult["failure"];
|
|
233
|
+
if (!isRecord(failure) || typeof failure["summary"] !== "string" || !Array.isArray(failure["diagnostics"])) return {
|
|
234
|
+
ok: false,
|
|
235
|
+
error: failedToResolveContractSource("Contract source provider returned malformed failure result: expected summary and diagnostics.", "Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).")
|
|
236
|
+
};
|
|
237
|
+
return {
|
|
238
|
+
ok: false,
|
|
239
|
+
error: failedToResolveContractSource(String(failure["summary"]), "Fix contract source diagnostics and return ok(Contract).", {
|
|
240
|
+
diagnostics: failure["diagnostics"],
|
|
241
|
+
issues: mapDiagnosticsToIssues(failure["diagnostics"]),
|
|
242
|
+
...ifDefined("providerMeta", failure["meta"])
|
|
243
|
+
})
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Canonical contract emit operation.
|
|
248
|
+
*
|
|
249
|
+
* This is the SINGLE publication path used by both the CLI command
|
|
250
|
+
* (`prisma-next contract emit`) and the Vite plugin
|
|
251
|
+
* (`@internal/vite-plugin-contract-emit`). New callers must go through this
|
|
252
|
+
* function rather than re-implementing load → emit → publish.
|
|
253
|
+
*
|
|
254
|
+
* The whole flow (load config → resolve source → emit bytes → atomic publish)
|
|
255
|
+
* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls
|
|
256
|
+
* for the same output line up FIFO; the user-visible outcome is "last
|
|
257
|
+
* submission wins on disk" without any supersession bookkeeping. Within a
|
|
258
|
+
* single emit, `publishContractArtifactPair` stages temp files, renames
|
|
259
|
+
* `contract.d.ts` before `contract.json`, and attempts to restore the previous
|
|
260
|
+
* pair if either rename fails — so type-only consumers never observe a
|
|
261
|
+
* mismatched pair.
|
|
262
|
+
*
|
|
263
|
+
* @throws {CliStructuredError} on config/source/validation problems
|
|
264
|
+
* @throws {DOMException} `AbortError` if cancelled via `signal`
|
|
265
|
+
*/
|
|
266
|
+
async function executeContractEmit(options) {
|
|
267
|
+
const { configPath, outputPath, signal = new AbortController().signal, onProgress } = options;
|
|
268
|
+
const unlessAborted = abortable(signal);
|
|
269
|
+
const config = await unlessAborted(loadConfig(configPath));
|
|
270
|
+
if (!config.contract) throw errorContractConfigMissing$1({ why: "Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }" });
|
|
271
|
+
const contractConfig = config.contract;
|
|
272
|
+
const effectiveOutput = outputPath !== void 0 ? join(outputPath, "contract.json") : contractConfig.output;
|
|
273
|
+
if (!effectiveOutput) throw errorContractConfigMissing$1({ why: "Contract config must have output path. This should not happen if defineConfig() was used." });
|
|
274
|
+
if (typeof contractConfig.source?.load !== "function") throw errorContractConfigMissing$1({ why: "Contract config must include a valid source provider object" });
|
|
275
|
+
let outputPaths;
|
|
276
|
+
try {
|
|
277
|
+
outputPaths = getEmittedArtifactPaths(effectiveOutput);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
throw errorContractConfigMissing$1({ why: error instanceof Error ? error.message : String(error) });
|
|
280
|
+
}
|
|
281
|
+
const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;
|
|
282
|
+
return queueEmitByOutput(outputJsonPath, async () => {
|
|
283
|
+
const stack = createControlStack(config);
|
|
284
|
+
const sourceContext = {
|
|
285
|
+
composedExtensions: stack.extensions.map((p) => p.id),
|
|
286
|
+
composedExtensionContracts: stack.extensionContracts,
|
|
287
|
+
authoringContributions: stack.authoringContributions,
|
|
288
|
+
codecLookup: stack.codecLookup,
|
|
289
|
+
controlMutationDefaults: stack.controlMutationDefaults,
|
|
290
|
+
resolvedInputs: contractConfig.source.inputs ?? [],
|
|
291
|
+
capabilities: stack.capabilities
|
|
292
|
+
};
|
|
293
|
+
startSpan(onProgress, "resolveSource", "Resolving contract source...");
|
|
294
|
+
let providerResult;
|
|
295
|
+
try {
|
|
296
|
+
providerResult = await unlessAborted(contractConfig.source.load(sourceContext));
|
|
297
|
+
} catch (error) {
|
|
298
|
+
endSpan(onProgress, "resolveSource", "error");
|
|
299
|
+
if (signal.aborted || isRecord(error) && error["name"] === "AbortError") throw error;
|
|
300
|
+
throw failedToResolveContractSource(error instanceof Error ? error.message : String(error), "Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.");
|
|
301
|
+
}
|
|
302
|
+
const validatedContract = validateProviderResult(providerResult);
|
|
303
|
+
if (!validatedContract.ok) {
|
|
304
|
+
endSpan(onProgress, "resolveSource", "error");
|
|
305
|
+
throw validatedContract.error;
|
|
306
|
+
}
|
|
307
|
+
endSpan(onProgress, "resolveSource", "ok");
|
|
308
|
+
startSpan(onProgress, "emit", "Emitting contract...");
|
|
309
|
+
let emitResult;
|
|
310
|
+
try {
|
|
311
|
+
const familyInstance = config.family.create(stack);
|
|
312
|
+
const rawComponents = [
|
|
313
|
+
config.target,
|
|
314
|
+
config.adapter,
|
|
315
|
+
...config.extensions ?? []
|
|
316
|
+
];
|
|
317
|
+
const frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);
|
|
318
|
+
const enrichedIR = enrichContract(validatedContract.value, frameworkComponents);
|
|
319
|
+
const rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);
|
|
320
|
+
const deserializedContract = familyInstance.deserializeContract(rawContractJson);
|
|
321
|
+
const { contractSerializer } = config.target;
|
|
322
|
+
const serializeContract = (c) => contractSerializer.serializeContract(c);
|
|
323
|
+
emitResult = await unlessAborted(emit(deserializedContract, stack, config.family.emission, {
|
|
324
|
+
outputJsonPath,
|
|
325
|
+
serializeContract,
|
|
326
|
+
resolveImportSpecifier: createProjectSpecifierResolver(configPath),
|
|
327
|
+
...ifDefined("shouldPreserveEmpty", contractSerializer.shouldPreserveEmpty),
|
|
328
|
+
...ifDefined("sortStorage", contractSerializer.sortStorage)
|
|
329
|
+
}));
|
|
330
|
+
} catch (error) {
|
|
331
|
+
endSpan(onProgress, "emit", "error");
|
|
332
|
+
throw error;
|
|
333
|
+
}
|
|
334
|
+
endSpan(onProgress, "emit", "ok");
|
|
335
|
+
await unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));
|
|
336
|
+
await publishContractArtifactPair({
|
|
337
|
+
outputJsonPath,
|
|
338
|
+
outputDtsPath,
|
|
339
|
+
contractJson: emitResult.contractJson,
|
|
340
|
+
contractDts: emitResult.contractDts,
|
|
341
|
+
publicationToken: String(process.hrtime.bigint())
|
|
342
|
+
});
|
|
343
|
+
const validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;
|
|
344
|
+
return {
|
|
345
|
+
storageHash: emitResult.storageHash,
|
|
346
|
+
...ifDefined("executionHash", emitResult.executionHash),
|
|
347
|
+
profileHash: emitResult.profileHash,
|
|
348
|
+
files: {
|
|
349
|
+
json: outputJsonPath,
|
|
350
|
+
dts: outputDtsPath
|
|
351
|
+
},
|
|
352
|
+
...ifDefined("validationWarning", validationWarning)
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
export { disposeEmitQueue as n, executeContractEmit as r, contract_emit_B6odMoem_exports as t };
|
|
358
|
+
|
|
359
|
+
//# sourceMappingURL=contract-emit-B6odMoem-CK3diBPk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-emit-B6odMoem-CK3diBPk.mjs","names":["errorRuntime","errorContractConfigMissing"],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-emit-B6odMoem.mjs"],"sourcesContent":["import { rt as errorRuntime, z as errorContractConfigMissing } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-CjshQKHA.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-CpwLCDLY.mjs\";\nimport { t as enrichContract } from \"./contract-enrichment-DrMvvY2A.mjs\";\nimport { createRequire } from \"node:module\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { emit, getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join } from \"pathe\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { abortable } from \"@internal/utils/abortable\";\n//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\n//#region src/utils/emit-queue.ts\n/**\n* Per-output FIFO queue for `executeContractEmit`.\n*\n* Ensures that at most one emit (load → resolve source → emit bytes → publish)\n* runs per output JSON path at a time. Concurrent calls for the same path\n* line up behind the in-flight one and run in submission order; the user-visible\n* outcome is \"last submission wins on disk\" without any supersession bookkeeping.\n*\n* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`\n* when they stop publishing to a path, otherwise the module-global `Map`\n* accumulates one entry per unique output path for the lifetime of the process.\n*/\nconst emitQueues = /* @__PURE__ */ new Map();\nfunction queueEmitByOutput(outputJsonPath, action) {\n\tconst next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);\n\temitQueues.set(outputJsonPath, next);\n\treturn next;\n}\nfunction disposeEmitQueue(outputJsonPath) {\n\temitQueues.delete(outputJsonPath);\n}\n//#endregion\n//#region src/utils/publish-contract-artifact-pair.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction createTempArtifactPath(path, publicationToken, phase) {\n\treturn join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);\n}\nasync function readExistingArtifact(path) {\n\ttry {\n\t\treturn { content: await readFile(path, \"utf-8\") };\n\t} catch (error) {\n\t\tif (isRecord$1(error) && error[\"code\"] === \"ENOENT\") return \"remove\";\n\t\tthrow error;\n\t}\n}\nasync function restoreArtifact(path, previous, publicationToken) {\n\tif (previous === \"remove\") {\n\t\tawait rm(path, { force: true });\n\t\treturn;\n\t}\n\tconst restorePath = createTempArtifactPath(path, publicationToken, \"rollback\");\n\tawait writeFile(restorePath, previous.content, \"utf-8\");\n\ttry {\n\t\tawait rename(restorePath, path);\n\t} finally {\n\t\tawait rm(restorePath, { force: true });\n\t}\n}\nfunction withRollbackFailureCause(error, rollbackFailures) {\n\tconst rollbackCause = new AggregateError(rollbackFailures, \"Failed to restore published artifacts\");\n\tif (error instanceof Error) {\n\t\tObject.defineProperty(error, \"cause\", {\n\t\t\tvalue: rollbackCause,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t\treturn error;\n\t}\n\treturn new Error(String(error), { cause: rollbackCause });\n}\nasync function publishPairWithRollback(entries, publicationToken) {\n\tconst replaced = [];\n\ttry {\n\t\tfor (const entry of entries) {\n\t\t\tawait rename(entry.tempPath, entry.outputPath);\n\t\t\treplaced.push(entry);\n\t\t}\n\t} catch (error) {\n\t\tconst rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === \"rejected\" ? [result.reason] : []);\n\t\tif (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);\n\t\tthrow error;\n\t}\n}\nasync function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {\n\tconst tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, \"next\");\n\tconst tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, \"next\");\n\ttry {\n\t\tawait writeFile(tempJsonPath, contractJson, \"utf-8\");\n\t\tawait writeFile(tempDtsPath, contractDts, \"utf-8\");\n\t\tif (await beforePublish?.() === false) return false;\n\t\tconst previousJson = await readExistingArtifact(outputJsonPath);\n\t\tawait publishPairWithRollback([{\n\t\t\ttempPath: tempDtsPath,\n\t\t\toutputPath: outputDtsPath,\n\t\t\tprevious: await readExistingArtifact(outputDtsPath)\n\t\t}, {\n\t\t\ttempPath: tempJsonPath,\n\t\t\toutputPath: outputJsonPath,\n\t\t\tprevious: previousJson\n\t\t}], publicationToken);\n\t\treturn true;\n\t} finally {\n\t\tawait Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);\n\t}\n}\n//#endregion\n//#region src/utils/validate-contract-deps.ts\nconst IMPORT_PATTERN = /import\\s+type\\s+.*?\\s+from\\s+['\"](@[^/]+\\/[^/'\"]+)/g;\nfunction extractPackageSpecifiers(dtsContent) {\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const match of dtsContent.matchAll(IMPORT_PATTERN)) {\n\t\tconst pkg = match[1];\n\t\tif (pkg) packages.add(pkg);\n\t}\n\treturn [...packages];\n}\nfunction validateContractDeps(dtsContent, projectRoot) {\n\tconst packages = extractPackageSpecifiers(dtsContent);\n\tconst resolve = createRequire(`${projectRoot}/package.json`);\n\tconst missing = [];\n\tfor (const pkg of packages) try {\n\t\tresolve.resolve(`${pkg}/package.json`);\n\t} catch {\n\t\tmissing.push(pkg);\n\t}\n\tif (missing.length === 0) return { missing };\n\treturn {\n\t\tmissing,\n\t\twarning: [\n\t\t\t\"contract.d.ts imports types from packages that are not installed:\",\n\t\t\tmissing.map((p) => ` - ${p}`).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"Install them with your package manager:\",\n\t\t\t...missing.map((p) => ` ${p}`)\n\t\t].join(\"\\n\")\n\t};\n}\n//#endregion\n//#region src/control-api/operations/contract-emit.ts\nvar contract_emit_exports = /* @__PURE__ */ __exportAll({ executeContractEmit: () => executeContractEmit });\nconst EMIT_ACTION = \"emit\";\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction startSpan(onProgress, spanId, label) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanStart\",\n\t\tspanId,\n\t\tlabel\n\t});\n}\nfunction endSpan(onProgress, spanId, outcome) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanEnd\",\n\t\tspanId,\n\t\toutcome\n\t});\n}\nfunction failedToResolveContractSource(why, fix, meta) {\n\treturn errorRuntime(\"Failed to resolve contract source\", {\n\t\twhy,\n\t\tfix,\n\t\t...ifDefined(\"meta\", meta)\n\t});\n}\nfunction diagnosticLocationSuffix(diagnostic) {\n\tconst sourceId = typeof diagnostic[\"sourceId\"] === \"string\" ? diagnostic[\"sourceId\"] : void 0;\n\tconst span = isRecord(diagnostic[\"span\"]) ? diagnostic[\"span\"] : void 0;\n\tconst start = span && isRecord(span[\"start\"]) ? span[\"start\"] : void 0;\n\tconst line = start && typeof start[\"line\"] === \"number\" ? start[\"line\"] : void 0;\n\tconst column = start && typeof start[\"column\"] === \"number\" ? start[\"column\"] : void 0;\n\tif (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;\n\tif (sourceId) return ` (${sourceId})`;\n\treturn \"\";\n}\nfunction mapDiagnosticsToIssues(diagnostics) {\n\tconst issues = [];\n\tfor (const raw of diagnostics) {\n\t\tif (!isRecord(raw)) continue;\n\t\tconst code = typeof raw[\"code\"] === \"string\" ? raw[\"code\"] : \"diagnostic\";\n\t\tconst message = typeof raw[\"message\"] === \"string\" ? raw[\"message\"] : \"\";\n\t\tissues.push({\n\t\t\tkind: code,\n\t\t\tmessage: `${message}${diagnosticLocationSuffix(raw)}`\n\t\t});\n\t}\n\treturn issues;\n}\nfunction validateProviderResult(providerResult) {\n\tif (!isRecord(providerResult) || typeof providerResult[\"ok\"] !== \"boolean\") return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed result shape.\", \"Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).\")\n\t};\n\tif (providerResult[\"ok\"]) {\n\t\tif (!(\"value\" in providerResult)) return {\n\t\t\tok: false,\n\t\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed success result: missing value.\", \"Ensure contract.source.load success payload is ok(Contract).\")\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalue: providerResult[\"value\"]\n\t\t};\n\t}\n\tconst failure = providerResult[\"failure\"];\n\tif (!isRecord(failure) || typeof failure[\"summary\"] !== \"string\" || !Array.isArray(failure[\"diagnostics\"])) return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed failure result: expected summary and diagnostics.\", \"Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).\")\n\t};\n\treturn {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(String(failure[\"summary\"]), \"Fix contract source diagnostics and return ok(Contract).\", {\n\t\t\tdiagnostics: failure[\"diagnostics\"],\n\t\t\tissues: mapDiagnosticsToIssues(failure[\"diagnostics\"]),\n\t\t\t...ifDefined(\"providerMeta\", failure[\"meta\"])\n\t\t})\n\t};\n}\n/**\n* Canonical contract emit operation.\n*\n* This is the SINGLE publication path used by both the CLI command\n* (`prisma-next contract emit`) and the Vite plugin\n* (`@internal/vite-plugin-contract-emit`). New callers must go through this\n* function rather than re-implementing load → emit → publish.\n*\n* The whole flow (load config → resolve source → emit bytes → atomic publish)\n* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls\n* for the same output line up FIFO; the user-visible outcome is \"last\n* submission wins on disk\" without any supersession bookkeeping. Within a\n* single emit, `publishContractArtifactPair` stages temp files, renames\n* `contract.d.ts` before `contract.json`, and attempts to restore the previous\n* pair if either rename fails — so type-only consumers never observe a\n* mismatched pair.\n*\n* @throws {CliStructuredError} on config/source/validation problems\n* @throws {DOMException} `AbortError` if cancelled via `signal`\n*/\nasync function executeContractEmit(options) {\n\tconst { configPath, outputPath, signal = new AbortController().signal, onProgress } = options;\n\tconst unlessAborted = abortable(signal);\n\tconst config = await unlessAborted(loadConfig(configPath));\n\tif (!config.contract) throw errorContractConfigMissing({ why: \"Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }\" });\n\tconst contractConfig = config.contract;\n\tconst effectiveOutput = outputPath !== void 0 ? join(outputPath, \"contract.json\") : contractConfig.output;\n\tif (!effectiveOutput) throw errorContractConfigMissing({ why: \"Contract config must have output path. This should not happen if defineConfig() was used.\" });\n\tif (typeof contractConfig.source?.load !== \"function\") throw errorContractConfigMissing({ why: \"Contract config must include a valid source provider object\" });\n\tlet outputPaths;\n\ttry {\n\t\toutputPaths = getEmittedArtifactPaths(effectiveOutput);\n\t} catch (error) {\n\t\tthrow errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) });\n\t}\n\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;\n\treturn queueEmitByOutput(outputJsonPath, async () => {\n\t\tconst stack = createControlStack(config);\n\t\tconst sourceContext = {\n\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\tcodecLookup: stack.codecLookup,\n\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\tcapabilities: stack.capabilities\n\t\t};\n\t\tstartSpan(onProgress, \"resolveSource\", \"Resolving contract source...\");\n\t\tlet providerResult;\n\t\ttry {\n\t\t\tproviderResult = await unlessAborted(contractConfig.source.load(sourceContext));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tif (signal.aborted || isRecord(error) && error[\"name\"] === \"AbortError\") throw error;\n\t\t\tthrow failedToResolveContractSource(error instanceof Error ? error.message : String(error), \"Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.\");\n\t\t}\n\t\tconst validatedContract = validateProviderResult(providerResult);\n\t\tif (!validatedContract.ok) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tthrow validatedContract.error;\n\t\t}\n\t\tendSpan(onProgress, \"resolveSource\", \"ok\");\n\t\tstartSpan(onProgress, \"emit\", \"Emitting contract...\");\n\t\tlet emitResult;\n\t\ttry {\n\t\t\tconst familyInstance = config.family.create(stack);\n\t\t\tconst rawComponents = [\n\t\t\t\tconfig.target,\n\t\t\t\tconfig.adapter,\n\t\t\t\t...config.extensions ?? []\n\t\t\t];\n\t\t\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);\n\t\t\tconst enrichedIR = enrichContract(validatedContract.value, frameworkComponents);\n\t\t\tconst rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tconst deserializedContract = familyInstance.deserializeContract(rawContractJson);\n\t\t\tconst { contractSerializer } = config.target;\n\t\t\tconst serializeContract = (c) => contractSerializer.serializeContract(c);\n\t\t\temitResult = await unlessAborted(emit(deserializedContract, stack, config.family.emission, {\n\t\t\t\toutputJsonPath,\n\t\t\t\tserializeContract,\n\t\t\t\tresolveImportSpecifier: createProjectSpecifierResolver(configPath),\n\t\t\t\t...ifDefined(\"shouldPreserveEmpty\", contractSerializer.shouldPreserveEmpty),\n\t\t\t\t...ifDefined(\"sortStorage\", contractSerializer.sortStorage)\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"emit\", \"error\");\n\t\t\tthrow error;\n\t\t}\n\t\tendSpan(onProgress, \"emit\", \"ok\");\n\t\tawait unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));\n\t\tawait publishContractArtifactPair({\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath,\n\t\t\tcontractJson: emitResult.contractJson,\n\t\t\tcontractDts: emitResult.contractDts,\n\t\t\tpublicationToken: String(process.hrtime.bigint())\n\t\t});\n\t\tconst validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;\n\t\treturn {\n\t\t\tstorageHash: emitResult.storageHash,\n\t\t\t...ifDefined(\"executionHash\", emitResult.executionHash),\n\t\t\tprofileHash: emitResult.profileHash,\n\t\t\tfiles: {\n\t\t\t\tjson: outputJsonPath,\n\t\t\t\tdts: outputDtsPath\n\t\t\t},\n\t\t\t...ifDefined(\"validationWarning\", validationWarning)\n\t\t};\n\t});\n}\n//#endregion\nexport { executeContractEmit as n, disposeEmitQueue as r, contract_emit_exports as t };\n\n//# sourceMappingURL=contract-emit-B6odMoem.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAI,YAAY,OAAO;AACvB,IAAI,eAAe,KAAK,eAAe;CACtC,IAAI,SAAS,CAAC;CACd,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;CACD,IAAI,CAAC,YAAY,UAAU,QAAQ,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC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AY,QAAQ,IAAI;EAChC,MAAM,cAAc,MAAM,QAAQ,cAAc,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC;EACvE,MAAM,4BAA4B;GACjC;GACA;GACA,cAAc,WAAW;GACzB,aAAa,WAAW;GACxB,kBAAkB,OAAO,QAAQ,OAAO,OAAO,CAAC;EACjD,CAAC;EACD,MAAM,oBAAoB,qBAAqB,WAAW,aAAa,QAAQ,aAAa,CAAC,CAAC,CAAC;EAC/F,OAAO;GACN,aAAa,WAAW;GACxB,GAAG,UAAU,iBAAiB,WAAW,aAAa;GACtD,aAAa,WAAW;GACxB,OAAO;IACN,MAAM;IACN,KAAK;GACN;GACA,GAAG,UAAU,qBAAqB,iBAAiB;EACpD;CACD,CAAC;AACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mergeCapabilityMatrices } from "@prisma/orm-framework/components/components";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/cli/dist/contract-enrichment-DrMvvY2A.mjs
|
|
3
|
+
function isPlainObject(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function sortDeep(value) {
|
|
7
|
+
if (Array.isArray(value)) return value.map(sortDeep);
|
|
8
|
+
if (!isPlainObject(value)) return value;
|
|
9
|
+
const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
|
|
10
|
+
const next = {};
|
|
11
|
+
for (const [key, child] of entries) next[key] = sortDeep(child);
|
|
12
|
+
return next;
|
|
13
|
+
}
|
|
14
|
+
function sortDeepTyped(value) {
|
|
15
|
+
return sortDeep(value);
|
|
16
|
+
}
|
|
17
|
+
function extractExtensionPackMeta(component) {
|
|
18
|
+
const { kind, id, version, capabilities, types } = component;
|
|
19
|
+
const base = {
|
|
20
|
+
kind,
|
|
21
|
+
id,
|
|
22
|
+
familyId: component.familyId,
|
|
23
|
+
targetId: component.targetId,
|
|
24
|
+
version
|
|
25
|
+
};
|
|
26
|
+
if (capabilities) base["capabilities"] = capabilities;
|
|
27
|
+
if (types) if (types.codecTypes) {
|
|
28
|
+
const { controlPlaneHooks: _, codecDescriptors: _cd, ...cleanedCodecTypes } = types.codecTypes;
|
|
29
|
+
base["types"] = {
|
|
30
|
+
...types,
|
|
31
|
+
codecTypes: cleanedCodecTypes
|
|
32
|
+
};
|
|
33
|
+
} else base["types"] = types;
|
|
34
|
+
return base;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Enriches a raw contract with framework-derived metadata: capabilities from all component descriptors and extension pack metadata from extension descriptors. Produces deterministically sorted output.
|
|
38
|
+
*/
|
|
39
|
+
function enrichContract(ir, components) {
|
|
40
|
+
const mergedCapabilities = mergeCapabilityMatrices(ir.capabilities, components);
|
|
41
|
+
const extensionsMeta = {};
|
|
42
|
+
for (const component of components) if (component.kind === "extension") extensionsMeta[component.id] = extractExtensionPackMeta(component);
|
|
43
|
+
const extensions = Object.keys(extensionsMeta).length > 0 ? {
|
|
44
|
+
...ir.extensions,
|
|
45
|
+
...extensionsMeta
|
|
46
|
+
} : ir.extensions;
|
|
47
|
+
return {
|
|
48
|
+
...ir,
|
|
49
|
+
capabilities: sortDeepTyped(mergedCapabilities),
|
|
50
|
+
extensions: sortDeepTyped(extensions)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { enrichContract as t };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-enrichment-DrMvvY2A-DxNGeF4d.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-enrichment-DrMvvY2A.mjs"],"sourcesContent":["import { mergeCapabilityMatrices } from \"@internal/framework-components/components\";\n//#region src/control-api/contract-enrichment.ts\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction sortDeep(value) {\n\tif (Array.isArray(value)) return value.map(sortDeep);\n\tif (!isPlainObject(value)) return value;\n\tconst entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));\n\tconst next = {};\n\tfor (const [key, child] of entries) next[key] = sortDeep(child);\n\treturn next;\n}\nfunction sortDeepTyped(value) {\n\treturn sortDeep(value);\n}\nfunction extractExtensionPackMeta(component) {\n\tconst { kind, id, version, capabilities, types } = component;\n\tconst base = {\n\t\tkind,\n\t\tid,\n\t\tfamilyId: component.familyId,\n\t\ttargetId: component.targetId,\n\t\tversion\n\t};\n\tif (capabilities) base[\"capabilities\"] = capabilities;\n\tif (types) if (types.codecTypes) {\n\t\tconst { controlPlaneHooks: _, codecDescriptors: _cd, ...cleanedCodecTypes } = types.codecTypes;\n\t\tbase[\"types\"] = {\n\t\t\t...types,\n\t\t\tcodecTypes: cleanedCodecTypes\n\t\t};\n\t} else base[\"types\"] = types;\n\treturn base;\n}\n/**\n* Enriches a raw contract with framework-derived metadata: capabilities from all component descriptors and extension pack metadata from extension descriptors. Produces deterministically sorted output.\n*/\nfunction enrichContract(ir, components) {\n\tconst mergedCapabilities = mergeCapabilityMatrices(ir.capabilities, components);\n\tconst extensionsMeta = {};\n\tfor (const component of components) if (component.kind === \"extension\") extensionsMeta[component.id] = extractExtensionPackMeta(component);\n\tconst extensions = Object.keys(extensionsMeta).length > 0 ? {\n\t\t...ir.extensions,\n\t\t...extensionsMeta\n\t} : ir.extensions;\n\treturn {\n\t\t...ir,\n\t\tcapabilities: sortDeepTyped(mergedCapabilities),\n\t\textensions: sortDeepTyped(extensions)\n\t};\n}\n//#endregion\nexport { enrichContract as t };\n\n//# sourceMappingURL=contract-enrichment-DrMvvY2A.mjs.map"],"mappings":";;AAEA,SAAS,cAAc,OAAO;CAC7B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC3E;AACA,SAAS,SAAS,OAAO;CACxB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,QAAQ;CACnD,IAAI,CAAC,cAAc,KAAK,GAAG,OAAO;CAClC,MAAM,UAAU,OAAO,QAAQ,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;CAC3E,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,KAAK,UAAU,SAAS,KAAK,OAAO,SAAS,KAAK;CAC9D,OAAO;AACR;AACA,SAAS,cAAc,OAAO;CAC7B,OAAO,SAAS,KAAK;AACtB;AACA,SAAS,yBAAyB,WAAW;CAC5C,MAAM,EAAE,MAAM,IAAI,SAAS,cAAc,UAAU;CACnD,MAAM,OAAO;EACZ;EACA;EACA,UAAU,UAAU;EACpB,UAAU,UAAU;EACpB;CACD;CACA,IAAI,cAAc,KAAK,kBAAkB;CACzC,IAAI,OAAO,IAAI,MAAM,YAAY;EAChC,MAAM,EAAE,mBAAmB,GAAG,kBAAkB,KAAK,GAAG,sBAAsB,MAAM;EACpF,KAAK,WAAW;GACf,GAAG;GACH,YAAY;EACb;CACD,OAAO,KAAK,WAAW;CACvB,OAAO;AACR;;;;AAIA,SAAS,eAAe,IAAI,YAAY;CACvC,MAAM,qBAAqB,wBAAwB,GAAG,cAAc,UAAU;CAC9E,MAAM,iBAAiB,CAAC;CACxB,KAAK,MAAM,aAAa,YAAY,IAAI,UAAU,SAAS,aAAa,eAAe,UAAU,MAAM,yBAAyB,SAAS;CACzI,MAAM,aAAa,OAAO,KAAK,cAAc,CAAC,CAAC,SAAS,IAAI;EAC3D,GAAG,GAAG;EACN,GAAG;CACJ,IAAI,GAAG;CACP,OAAO;EACN,GAAG;EACH,cAAc,cAAc,kBAAkB;EAC9C,YAAY,cAAc,UAAU;CACrC;AACD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ct as setCommandExamples, o as createTerminalUI, q as handleResult, r as addGlobalOptions, st as setCommandDescriptions, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import { t as inspectLiveSchema } from "./inspect-live-schema-CnwYTRZ0-BErPHMni.mjs";
|
|
3
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
4
|
+
import { dirname, relative, resolve } from "pathe";
|
|
5
|
+
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import { printPsl } from "@prisma/orm-framework/psl-printer";
|
|
9
|
+
//#region ../../../1-framework/3-tooling/cli/dist/contract-infer-BnkqpftN.mjs
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the output path for the inferred PSL contract.
|
|
12
|
+
*
|
|
13
|
+
* Priority:
|
|
14
|
+
* 1. --output <path> flag (resolved relative to cwd)
|
|
15
|
+
* 2. contract.prisma next to config.contract.output
|
|
16
|
+
* 3. Canonical default: contract.prisma in the config directory
|
|
17
|
+
*/
|
|
18
|
+
function resolveContractInferOutputPath(options, contractOutput) {
|
|
19
|
+
const configDir = options.config ? dirname(resolve(process.cwd(), options.config)) : process.cwd();
|
|
20
|
+
if (options.output) return resolve(process.cwd(), options.output);
|
|
21
|
+
if (contractOutput) return resolve(dirname(resolve(configDir, contractOutput)), "contract.prisma");
|
|
22
|
+
return resolve(configDir, "contract.prisma");
|
|
23
|
+
}
|
|
24
|
+
async function executeContractInferCommand(options, flags, ui, startTime) {
|
|
25
|
+
const inspectResult = await inspectLiveSchema(options, flags, ui, startTime, {
|
|
26
|
+
commandName: "contract infer",
|
|
27
|
+
description: "Infer a PSL contract from the live database schema",
|
|
28
|
+
url: "https://pris.ly/contract-infer"
|
|
29
|
+
});
|
|
30
|
+
if (!inspectResult.ok) return inspectResult;
|
|
31
|
+
const { config, target, meta, pslContractAst, pslBlockDescriptors } = inspectResult.value;
|
|
32
|
+
if (!pslContractAst) return notOk(errorRuntime("contract infer is not supported for this family", {
|
|
33
|
+
why: "The configured family does not implement the PslContractInferCapable capability, so an inferred PSL contract cannot be produced from the live database schema.",
|
|
34
|
+
fix: "Use a family that supports contract inference (e.g. SQL/Postgres)."
|
|
35
|
+
}));
|
|
36
|
+
const outputPath = resolveContractInferOutputPath(options, config.contract?.output);
|
|
37
|
+
const pslContent = printPsl(pslContractAst, { pslBlockDescriptors });
|
|
38
|
+
if (existsSync(outputPath) && !flags.json && !flags.quiet) ui.stderr(`\u26A0 Overwriting existing file: ${relative(process.cwd(), outputPath)}`);
|
|
39
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
40
|
+
writeFileSync(outputPath, pslContent, "utf-8");
|
|
41
|
+
const pslPath = relative(process.cwd(), outputPath);
|
|
42
|
+
if (!flags.json && !flags.quiet) ui.stderr(`\u2714 Contract written to ${pslPath}`);
|
|
43
|
+
return ok({
|
|
44
|
+
ok: true,
|
|
45
|
+
summary: "Contract inferred successfully",
|
|
46
|
+
target,
|
|
47
|
+
psl: { path: pslPath },
|
|
48
|
+
meta,
|
|
49
|
+
timings: { total: Date.now() - startTime }
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function createContractInferCommand() {
|
|
53
|
+
const command = new Command("infer");
|
|
54
|
+
setCommandDescriptions(command, "Infer a PSL contract from the live database schema", "Reads the live database schema and writes an inferred PSL contract to disk.\nThis command stops at `contract.prisma`; follow it with `contract emit` and\n`db sign` as separate steps.");
|
|
55
|
+
setCommandExamples(command, [
|
|
56
|
+
"prisma-next contract infer --db $DATABASE_URL",
|
|
57
|
+
"prisma-next contract infer --db $DATABASE_URL --output ./src/prisma/contract.prisma",
|
|
58
|
+
"prisma-next contract infer --db $DATABASE_URL --json"
|
|
59
|
+
]);
|
|
60
|
+
addGlobalOptions(command).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--output <path>", "Write the inferred PSL contract to the specified path").action(async (options) => {
|
|
61
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
62
|
+
const ui = createTerminalUI(flags);
|
|
63
|
+
const exitCode = handleResult(await executeContractInferCommand(options, flags, ui, Date.now()), flags, ui, (value) => {
|
|
64
|
+
if (flags.json) ui.output(JSON.stringify(value, null, 2));
|
|
65
|
+
});
|
|
66
|
+
process.exit(exitCode);
|
|
67
|
+
});
|
|
68
|
+
return command;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { createContractInferCommand as t };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=contract-infer-BnkqpftN-DVM2eKJ3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-infer-BnkqpftN-DVM2eKJ3.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/contract-infer-BnkqpftN.mjs"],"sourcesContent":["import { _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { t as inspectLiveSchema } from \"./inspect-live-schema-CnwYTRZ0.mjs\";\nimport { Command } from \"commander\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dirname, relative, resolve } from \"pathe\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { printPsl } from \"@internal/psl-printer\";\n//#region src/commands/contract-infer-paths.ts\n/**\n* Resolves the output path for the inferred PSL contract.\n*\n* Priority:\n* 1. --output <path> flag (resolved relative to cwd)\n* 2. contract.prisma next to config.contract.output\n* 3. Canonical default: contract.prisma in the config directory\n*/\nfunction resolveContractInferOutputPath(options, contractOutput) {\n\tconst configDir = options.config ? dirname(resolve(process.cwd(), options.config)) : process.cwd();\n\tif (options.output) return resolve(process.cwd(), options.output);\n\tif (contractOutput) return resolve(dirname(resolve(configDir, contractOutput)), \"contract.prisma\");\n\treturn resolve(configDir, \"contract.prisma\");\n}\n//#endregion\n//#region src/commands/contract-infer.ts\nasync function executeContractInferCommand(options, flags, ui, startTime) {\n\tconst inspectResult = await inspectLiveSchema(options, flags, ui, startTime, {\n\t\tcommandName: \"contract infer\",\n\t\tdescription: \"Infer a PSL contract from the live database schema\",\n\t\turl: \"https://pris.ly/contract-infer\"\n\t});\n\tif (!inspectResult.ok) return inspectResult;\n\tconst { config, target, meta, pslContractAst, pslBlockDescriptors } = inspectResult.value;\n\tif (!pslContractAst) return notOk(errorRuntime(\"contract infer is not supported for this family\", {\n\t\twhy: \"The configured family does not implement the PslContractInferCapable capability, so an inferred PSL contract cannot be produced from the live database schema.\",\n\t\tfix: \"Use a family that supports contract inference (e.g. SQL/Postgres).\"\n\t}));\n\tconst outputPath = resolveContractInferOutputPath(options, config.contract?.output);\n\tconst pslContent = printPsl(pslContractAst, { pslBlockDescriptors });\n\tif (existsSync(outputPath) && !flags.json && !flags.quiet) ui.stderr(`\\u26A0 Overwriting existing file: ${relative(process.cwd(), outputPath)}`);\n\tmkdirSync(dirname(outputPath), { recursive: true });\n\twriteFileSync(outputPath, pslContent, \"utf-8\");\n\tconst pslPath = relative(process.cwd(), outputPath);\n\tif (!flags.json && !flags.quiet) ui.stderr(`\\u2714 Contract written to ${pslPath}`);\n\treturn ok({\n\t\tok: true,\n\t\tsummary: \"Contract inferred successfully\",\n\t\ttarget,\n\t\tpsl: { path: pslPath },\n\t\tmeta,\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n}\nfunction createContractInferCommand() {\n\tconst command = new Command(\"infer\");\n\tsetCommandDescriptions(command, \"Infer a PSL contract from the live database schema\", \"Reads the live database schema and writes an inferred PSL contract to disk.\\nThis command stops at `contract.prisma`; follow it with `contract emit` and\\n`db sign` as separate steps.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next contract infer --db $DATABASE_URL\",\n\t\t\"prisma-next contract infer --db $DATABASE_URL --output ./src/prisma/contract.prisma\",\n\t\t\"prisma-next contract infer --db $DATABASE_URL --json\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--output <path>\", \"Write the inferred PSL contract to the specified path\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeContractInferCommand(options, flags, ui, Date.now()), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createContractInferCommand as t };\n\n//# sourceMappingURL=contract-infer-BnkqpftN.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,+BAA+B,SAAS,gBAAgB;CAChE,MAAM,YAAY,QAAQ,SAAS,QAAQ,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM,CAAC,IAAI,QAAQ,IAAI;CACjG,IAAI,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,MAAM;CAChE,IAAI,gBAAgB,OAAO,QAAQ,QAAQ,QAAQ,WAAW,cAAc,CAAC,GAAG,iBAAiB;CACjG,OAAO,QAAQ,WAAW,iBAAiB;AAC5C;AAGA,eAAe,4BAA4B,SAAS,OAAO,IAAI,WAAW;CACzE,MAAM,gBAAgB,MAAM,kBAAkB,SAAS,OAAO,IAAI,WAAW;EAC5E,aAAa;EACb,aAAa;EACb,KAAK;CACN,CAAC;CACD,IAAI,CAAC,cAAc,IAAI,OAAO;CAC9B,MAAM,EAAE,QAAQ,QAAQ,MAAM,gBAAgB,wBAAwB,cAAc;CACpF,IAAI,CAAC,gBAAgB,OAAO,MAAM,aAAa,mDAAmD;EACjG,KAAK;EACL,KAAK;CACN,CAAC,CAAC;CACF,MAAM,aAAa,+BAA+B,SAAS,OAAO,UAAU,MAAM;CAClF,MAAM,aAAa,SAAS,gBAAgB,EAAE,oBAAoB,CAAC;CACnE,IAAI,WAAW,UAAU,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,qCAAqC,SAAS,QAAQ,IAAI,GAAG,UAAU,GAAG;CAC/I,UAAU,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;CAClD,cAAc,YAAY,YAAY,OAAO;CAC7C,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,UAAU;CAClD,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,8BAA8B,SAAS;CAClF,OAAO,GAAG;EACT,IAAI;EACJ,SAAS;EACT;EACA,KAAK,EAAE,MAAM,QAAQ;EACrB;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C,CAAC;AACF;AACA,SAAS,6BAA6B;CACrC,MAAM,UAAU,IAAI,QAAQ,OAAO;CACnC,uBAAuB,SAAS,sDAAsD,wLAAwL;CAC9Q,mBAAmB,SAAS;EAC3B;EACA;EACA;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,mBAAmB,uDAAuD,CAAC,CAAC,OAAO,OAAO,YAAY;EACpP,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,4BAA4B,SAAS,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,OAAO,KAAK,UAAU;GACtH,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;EACzD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region ../../../1-framework/3-tooling/migration/dist/exports/contract-snapshot-store.d.mts
|
|
2
|
+
//#region src/contract-snapshot-store.d.ts
|
|
3
|
+
declare function contractSnapshotDir(migrationsDir: string, storageHash: string): string;
|
|
4
|
+
interface ContractSnapshotInput {
|
|
5
|
+
readonly contractJson: unknown;
|
|
6
|
+
readonly contractDts: string;
|
|
7
|
+
}
|
|
8
|
+
declare function writeContractSnapshot(migrationsDir: string, storageHash: string, input: ContractSnapshotInput): Promise<{
|
|
9
|
+
readonly written: boolean;
|
|
10
|
+
readonly dir: string;
|
|
11
|
+
}>;
|
|
12
|
+
declare function readContractSnapshotJson(migrationsDir: string, storageHash: string): Promise<unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Tolerant read: a missing store entry (ENOENT), an unparseable
|
|
15
|
+
* `contract.json`, the JSON literal `null`, or a `storageHash` that isn't a
|
|
16
|
+
* well-formed 64-hex value all resolve to `undefined` rather than
|
|
17
|
+
* throwing — parity with the catch-all tolerance of the pre-store
|
|
18
|
+
* `readEndContractJson` (`io.ts`), which never validated the hash it was
|
|
19
|
+
* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-
|
|
20
|
+
* unreadable file) propagates rather than silently loading a contract-less
|
|
21
|
+
* package.
|
|
22
|
+
*/
|
|
23
|
+
declare function readContractSnapshotJsonTolerant(migrationsDir: string, storageHash: string): Promise<unknown | undefined>;
|
|
24
|
+
declare function readContractSnapshotDts(migrationsDir: string, storageHash: string): Promise<string>;
|
|
25
|
+
declare function snapshotsImportPathFrom(packageDir: string, migrationsDir: string): string;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { readContractSnapshotJsonTolerant as a, readContractSnapshotJson as i, contractSnapshotDir as n, snapshotsImportPathFrom as o, readContractSnapshotDts as r, writeContractSnapshot as s, ContractSnapshotInput as t };
|
|
28
|
+
//# sourceMappingURL=contract-snapshot-store-CbqynbtE.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-snapshot-store-CbqynbtE.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/contract-snapshot-store.d.mts"],"mappings":";;iBACiB,oBAAoB,uBAAuB;UAClD;WACC;WACA;;iBAEM,sBAAsB,uBAAuB,qBAAqB,OAAO,wBAAwB;WACvG;WACA;;iBAEM,yBAAyB,uBAAuB,sBAAsB;;;;;;;;;;;iBAWtE,iCAAiC,uBAAuB,sBAAsB;iBAC9E,wBAAwB,uBAAuB,sBAAsB;iBACrE,wBAAwB,oBAAoB"}
|