@prisma/orm-toolchain 0.16.0
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-DcwUnadt-B6Qoh0ot.mjs +597 -0
- package/dist/migration-check-DcwUnadt-B6Qoh0ot.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-CE7cQLDq-B1jDVmqG.mjs +444 -0
- package/dist/migration-status-CE7cQLDq-B1jDVmqG.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-CfGSxH5b-BSjB3nZS.d.mts +192 -0
- package/dist/schemas-CfGSxH5b-BSjB3nZS.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 +122 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { t as isSafeTypeExpression } from "./type-expression-safety-CgHTWypx.mjs";
|
|
2
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
4
|
+
import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
5
|
+
import { renderImports } from "@prisma/orm-framework/ts-render";
|
|
6
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-DAn9y5d2.mjs
|
|
7
|
+
function emitterError(code, message, options) {
|
|
8
|
+
return structuredError(code, message, options);
|
|
9
|
+
}
|
|
10
|
+
function serializeValue(value) {
|
|
11
|
+
if (value === null) return "null";
|
|
12
|
+
if (value === void 0) return "undefined";
|
|
13
|
+
if (typeof value === "string") return `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
14
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
15
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
16
|
+
if (Array.isArray(value)) return `readonly [${value.map((v) => serializeValue(v)).join(", ")}]`;
|
|
17
|
+
if (typeof value === "object") {
|
|
18
|
+
const entries = [];
|
|
19
|
+
for (const [k, v] of Object.entries(value)) entries.push(`readonly ${serializeObjectKey(k)}: ${serializeValue(v)}`);
|
|
20
|
+
return `{ ${entries.join("; ")} }`;
|
|
21
|
+
}
|
|
22
|
+
return "unknown";
|
|
23
|
+
}
|
|
24
|
+
function serializeObjectKey(key) {
|
|
25
|
+
if (/^[$A-Z_a-z][$\w]*$/.test(key)) return key;
|
|
26
|
+
return serializeValue(key);
|
|
27
|
+
}
|
|
28
|
+
function serializeNamespaceId(value) {
|
|
29
|
+
return `${serializeValue(value)} & NamespaceId`;
|
|
30
|
+
}
|
|
31
|
+
function serializeCrossReference(ref) {
|
|
32
|
+
return `{ readonly namespace: ${serializeNamespaceId(String(ref.namespace))}; readonly model: ${serializeValue(ref.model)}${ref.space !== void 0 ? `; readonly space: ${serializeValue(ref.space)}` : ""} }`;
|
|
33
|
+
}
|
|
34
|
+
function generateRootsType(roots) {
|
|
35
|
+
if (!roots || Object.keys(roots).length === 0) return "Record<string, never>";
|
|
36
|
+
return `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join("; ")} }`;
|
|
37
|
+
}
|
|
38
|
+
function contractFieldModifierSuffix(field) {
|
|
39
|
+
return (field.many === true ? "; readonly many: true" : "") + (field.dict === true ? "; readonly dict: true" : "");
|
|
40
|
+
}
|
|
41
|
+
function generateModelFieldEntry(fieldName, field) {
|
|
42
|
+
const mods = contractFieldModifierSuffix(field);
|
|
43
|
+
const { nullable, type } = field;
|
|
44
|
+
if (type.kind === "scalar") {
|
|
45
|
+
const typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : "";
|
|
46
|
+
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: 'scalar'; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;
|
|
47
|
+
}
|
|
48
|
+
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: 'valueObject'; readonly name: ${serializeValue(type.name)} }${mods} }`;
|
|
49
|
+
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;
|
|
50
|
+
}
|
|
51
|
+
function generateModelFieldsType(fields) {
|
|
52
|
+
const fieldEntries = [];
|
|
53
|
+
for (const [fieldName, field] of Object.entries(fields)) fieldEntries.push(generateModelFieldEntry(fieldName, field));
|
|
54
|
+
return fieldEntries.length > 0 ? `{ ${fieldEntries.join("; ")} }` : "Record<string, never>";
|
|
55
|
+
}
|
|
56
|
+
function generateModelRelationsType(relations) {
|
|
57
|
+
const relationEntries = [];
|
|
58
|
+
for (const [relName, rel] of Object.entries(relations)) {
|
|
59
|
+
if (typeof rel !== "object" || rel === null) continue;
|
|
60
|
+
const relObj = rel;
|
|
61
|
+
const toRef = relObj["to"];
|
|
62
|
+
if (toRef !== null && typeof toRef === "object" && "space" in toRef && toRef.space !== void 0) {
|
|
63
|
+
relationEntries.push(`readonly ${serializeObjectKey(relName)}: never`);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const parts = [];
|
|
67
|
+
if (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);
|
|
68
|
+
if (relObj["cardinality"]) parts.push(`readonly cardinality: ${serializeValue(relObj["cardinality"])}`);
|
|
69
|
+
const on = relObj["on"];
|
|
70
|
+
if (on && (!on.localFields || !on.targetFields)) throw emitterError("CONTRACT.RELATION_INVALID", `Relation "${relName}" has an "on" block but is missing localFields or targetFields`, { meta: { relation: relName } });
|
|
71
|
+
if (on?.localFields && on.targetFields) {
|
|
72
|
+
const localFields = on.localFields.map((f) => serializeValue(f)).join(", ");
|
|
73
|
+
const targetFields = on.targetFields.map((f) => serializeValue(f)).join(", ");
|
|
74
|
+
parts.push(`readonly on: { readonly localFields: readonly [${localFields}]; readonly targetFields: readonly [${targetFields}] }`);
|
|
75
|
+
}
|
|
76
|
+
if (relObj["cardinality"] === "N:M") {
|
|
77
|
+
const { through } = blindCast(relObj);
|
|
78
|
+
const table = serializeValue(through.table);
|
|
79
|
+
const namespaceId = serializeValue(through.namespaceId);
|
|
80
|
+
const parentColumns = through.parentColumns.map((c) => serializeValue(c)).join(", ");
|
|
81
|
+
const childColumns = through.childColumns.map((c) => serializeValue(c)).join(", ");
|
|
82
|
+
const targetColumns = through.targetColumns.map((c) => serializeValue(c)).join(", ");
|
|
83
|
+
parts.push(`readonly through: { readonly table: ${table}; readonly namespaceId: ${namespaceId}; readonly parentColumns: readonly [${parentColumns}]; readonly childColumns: readonly [${childColumns}]; readonly targetColumns: readonly [${targetColumns}] }`);
|
|
84
|
+
}
|
|
85
|
+
if (parts.length > 0) relationEntries.push(`readonly ${serializeObjectKey(relName)}: { ${parts.join("; ")} }`);
|
|
86
|
+
}
|
|
87
|
+
if (relationEntries.length === 0) return "Record<string, never>";
|
|
88
|
+
return `{ ${relationEntries.join("; ")} }`;
|
|
89
|
+
}
|
|
90
|
+
function generateModelsType(models, generateModelStorage) {
|
|
91
|
+
if (!models || Object.keys(models).length === 0) return "Record<string, never>";
|
|
92
|
+
const modelTypes = [];
|
|
93
|
+
for (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {
|
|
94
|
+
const fieldsType = generateModelFieldsType(model.fields);
|
|
95
|
+
const relationsType = generateModelRelationsType(model.relations);
|
|
96
|
+
const storageType = generateModelStorage(modelName, model);
|
|
97
|
+
const modelParts = [
|
|
98
|
+
`readonly fields: ${fieldsType}`,
|
|
99
|
+
`readonly relations: ${relationsType}`,
|
|
100
|
+
`readonly storage: ${storageType}`
|
|
101
|
+
];
|
|
102
|
+
if (model.owner) modelParts.push(`readonly owner: ${serializeValue(model.owner)}`);
|
|
103
|
+
if (model.discriminator) modelParts.push(`readonly discriminator: ${serializeValue(model.discriminator)}`);
|
|
104
|
+
if (model.variants) modelParts.push(`readonly variants: ${serializeValue(model.variants)}`);
|
|
105
|
+
if (model.base) modelParts.push(`readonly base: ${serializeCrossReference(model.base)}`);
|
|
106
|
+
modelTypes.push(`readonly ${modelName}: { ${modelParts.join("; ")} }`);
|
|
107
|
+
}
|
|
108
|
+
return `{ ${modelTypes.join("; ")} }`;
|
|
109
|
+
}
|
|
110
|
+
function deduplicateImports(imports) {
|
|
111
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
112
|
+
const result = [];
|
|
113
|
+
for (const imp of imports) {
|
|
114
|
+
const key = `${imp.package}::${imp.named}`;
|
|
115
|
+
if (!seenKeys.has(key)) {
|
|
116
|
+
seenKeys.add(key);
|
|
117
|
+
result.push(imp);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
function generateImportLines(imports, resolveImportSpecifier = keepInternalSpecifiers) {
|
|
123
|
+
const rendered = renderImports(imports.map((imp) => ({
|
|
124
|
+
moduleSpecifier: resolveImportSpecifier(imp.package),
|
|
125
|
+
symbol: imp.named,
|
|
126
|
+
alias: imp.alias,
|
|
127
|
+
typeOnly: true
|
|
128
|
+
})));
|
|
129
|
+
return rendered === "" ? [] : rendered.split("\n");
|
|
130
|
+
}
|
|
131
|
+
function generateCodecTypeIntersection(imports, named) {
|
|
132
|
+
return imports.filter((imp) => imp.named === named).map((imp) => imp.alias).join(" & ") || "Record<string, never>";
|
|
133
|
+
}
|
|
134
|
+
function serializeExecutionType(execution) {
|
|
135
|
+
const parts = ["readonly executionHash: ExecutionHash"];
|
|
136
|
+
for (const [key, value] of Object.entries(execution)) {
|
|
137
|
+
if (key === "executionHash") continue;
|
|
138
|
+
parts.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);
|
|
139
|
+
}
|
|
140
|
+
return `{ ${parts.join("; ")} }`;
|
|
141
|
+
}
|
|
142
|
+
function generateHashTypeAliases(hashes) {
|
|
143
|
+
const executionHashType = hashes.executionHash ? `ExecutionHashBase<'${hashes.executionHash}'>` : "ExecutionHashBase<string>";
|
|
144
|
+
return [
|
|
145
|
+
`export type StorageHash = StorageHashBase<'${hashes.storageHash}'>;`,
|
|
146
|
+
`export type ExecutionHash = ${executionHashType};`,
|
|
147
|
+
`export type ProfileHash = ProfileHashBase<'${hashes.profileHash}'>;`
|
|
148
|
+
].join("\n");
|
|
149
|
+
}
|
|
150
|
+
function applyModifiers(base, field) {
|
|
151
|
+
let result = base;
|
|
152
|
+
if (field.many === true) result = `ReadonlyArray<${result}>`;
|
|
153
|
+
if (field.dict === true) result = `Readonly<Record<string, ${result}>>`;
|
|
154
|
+
if (field.nullable) result = `${result} | null`;
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by
|
|
159
|
+
* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not
|
|
160
|
+
* a generic serializer. `side`: `output` = read type, `input` = create/update type.
|
|
161
|
+
*
|
|
162
|
+
* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when
|
|
163
|
+
* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value
|
|
164
|
+
* isn't literal-expressible. A caller that needs column and field types to agree shares this so both
|
|
165
|
+
* compute the union identically.
|
|
166
|
+
*/
|
|
167
|
+
function renderValueSetType(values, codecId, side, codecLookup) {
|
|
168
|
+
if (values.length === 0 || codecLookup?.renderValueLiteralFor === void 0) return void 0;
|
|
169
|
+
const literals = [];
|
|
170
|
+
for (const value of values) {
|
|
171
|
+
const lit = codecLookup.renderValueLiteralFor(codecId, value, side);
|
|
172
|
+
if (lit === void 0 || !isSafeTypeExpression(lit)) return void 0;
|
|
173
|
+
literals.push(lit);
|
|
174
|
+
}
|
|
175
|
+
return literals.join(" | ");
|
|
176
|
+
}
|
|
177
|
+
function resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet) {
|
|
178
|
+
const { type } = field;
|
|
179
|
+
switch (type.kind) {
|
|
180
|
+
case "scalar": {
|
|
181
|
+
if (resolvedValueSet) {
|
|
182
|
+
const output = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, "output", codecLookup);
|
|
183
|
+
const input = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, "input", codecLookup);
|
|
184
|
+
if (output !== void 0 && input !== void 0) return {
|
|
185
|
+
output: applyModifiers(output, field),
|
|
186
|
+
input: applyModifiers(input, field)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
let outputResolved;
|
|
190
|
+
let inputResolved;
|
|
191
|
+
const effectiveTypeParams = (type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0) ?? resolvedTypeParams;
|
|
192
|
+
if (codecLookup && effectiveTypeParams && Object.keys(effectiveTypeParams).length > 0) {
|
|
193
|
+
const rendered = codecLookup.renderOutputTypeFor(type.codecId, effectiveTypeParams);
|
|
194
|
+
if (rendered && isSafeTypeExpression(rendered)) outputResolved = rendered;
|
|
195
|
+
const renderedInput = codecLookup.renderInputTypeFor?.(type.codecId, effectiveTypeParams);
|
|
196
|
+
if (renderedInput && isSafeTypeExpression(renderedInput)) inputResolved = renderedInput;
|
|
197
|
+
}
|
|
198
|
+
const codecAccessor = `CodecTypes[${serializeValue(type.codecId)}]`;
|
|
199
|
+
return {
|
|
200
|
+
output: applyModifiers(outputResolved ?? `${codecAccessor}['output']`, field),
|
|
201
|
+
input: applyModifiers(inputResolved ?? `${codecAccessor}['input']`, field)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
case "valueObject": return {
|
|
205
|
+
output: applyModifiers(`${type.name}Output`, field),
|
|
206
|
+
input: applyModifiers(`${type.name}Input`, field)
|
|
207
|
+
};
|
|
208
|
+
case "union": {
|
|
209
|
+
const outputMembers = type.members.map((m) => m.kind === "scalar" ? `CodecTypes[${serializeValue(m.codecId)}]['output']` : `${m.name}Output`);
|
|
210
|
+
const inputMembers = type.members.map((m) => m.kind === "scalar" ? `CodecTypes[${serializeValue(m.codecId)}]['input']` : `${m.name}Input`);
|
|
211
|
+
return {
|
|
212
|
+
output: applyModifiers(outputMembers.join(" | "), field),
|
|
213
|
+
input: applyModifiers(inputMembers.join(" | "), field)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
default: return {
|
|
217
|
+
output: applyModifiers("unknown", field),
|
|
218
|
+
input: applyModifiers("unknown", field)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function generateFieldResolvedType(field, codecLookup, side = "output") {
|
|
223
|
+
return resolveFieldType(field, codecLookup)[side];
|
|
224
|
+
}
|
|
225
|
+
function generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {
|
|
226
|
+
if (!models || Object.keys(models).length === 0) return {
|
|
227
|
+
output: "Record<string, never>",
|
|
228
|
+
input: "Record<string, never>"
|
|
229
|
+
};
|
|
230
|
+
const outputModelEntries = [];
|
|
231
|
+
const inputModelEntries = [];
|
|
232
|
+
for (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {
|
|
233
|
+
if (!model) continue;
|
|
234
|
+
const outputFieldEntries = [];
|
|
235
|
+
const inputFieldEntries = [];
|
|
236
|
+
for (const [fieldName, field] of Object.entries(model.fields)) {
|
|
237
|
+
const resolvedTypeParams = (field.type.kind === "scalar" && field.type.typeParams && Object.keys(field.type.typeParams).length > 0 ? field.type.typeParams : void 0) ?? resolveFieldTypeParams?.(modelName, fieldName, model);
|
|
238
|
+
const resolvedValueSet = resolveFieldValueSet?.(modelName, fieldName, model);
|
|
239
|
+
const resolved = resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet);
|
|
240
|
+
const key = `readonly ${serializeObjectKey(fieldName)}`;
|
|
241
|
+
outputFieldEntries.push(`${key}: ${resolved.output}`);
|
|
242
|
+
inputFieldEntries.push(`${key}: ${resolved.input}`);
|
|
243
|
+
}
|
|
244
|
+
const outputFields = outputFieldEntries.length > 0 ? `{ ${outputFieldEntries.join("; ")} }` : "Record<string, never>";
|
|
245
|
+
const inputFields = inputFieldEntries.length > 0 ? `{ ${inputFieldEntries.join("; ")} }` : "Record<string, never>";
|
|
246
|
+
const modelKey = `readonly ${serializeObjectKey(modelName)}`;
|
|
247
|
+
outputModelEntries.push(`${modelKey}: ${outputFields}`);
|
|
248
|
+
inputModelEntries.push(`${modelKey}: ${inputFields}`);
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
output: `{ ${outputModelEntries.join("; ")} }`,
|
|
252
|
+
input: `{ ${inputModelEntries.join("; ")} }`
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function generateFieldTypesMapsByNamespace(namespaceModels, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {
|
|
256
|
+
if (namespaceModels.length === 0) return {
|
|
257
|
+
output: "Record<string, never>",
|
|
258
|
+
input: "Record<string, never>"
|
|
259
|
+
};
|
|
260
|
+
const outputNamespaceEntries = [];
|
|
261
|
+
const inputNamespaceEntries = [];
|
|
262
|
+
for (const [nsId, models] of namespaceModels) {
|
|
263
|
+
const inner = generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet);
|
|
264
|
+
const nsKey = `readonly ${serializeObjectKey(nsId)}`;
|
|
265
|
+
outputNamespaceEntries.push(`${nsKey}: ${inner.output}`);
|
|
266
|
+
inputNamespaceEntries.push(`${nsKey}: ${inner.input}`);
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
output: `{ ${outputNamespaceEntries.join("; ")} }`,
|
|
270
|
+
input: `{ ${inputNamespaceEntries.join("; ")} }`
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function generateFieldOutputTypesMap(models, codecLookup, resolveFieldTypeParams) {
|
|
274
|
+
return generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).output;
|
|
275
|
+
}
|
|
276
|
+
function generateFieldInputTypesMap(models, codecLookup, resolveFieldTypeParams) {
|
|
277
|
+
return generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).input;
|
|
278
|
+
}
|
|
279
|
+
function generateValueObjectType(_voName, vo, _valueObjects, side = "output", codecLookup) {
|
|
280
|
+
return resolveValueObjectType(_voName, vo, _valueObjects, codecLookup)[side];
|
|
281
|
+
}
|
|
282
|
+
function resolveValueObjectType(_voName, vo, _valueObjects, codecLookup) {
|
|
283
|
+
const outputEntries = [];
|
|
284
|
+
const inputEntries = [];
|
|
285
|
+
for (const [fieldName, field] of Object.entries(vo.fields)) {
|
|
286
|
+
const resolved = resolveFieldType(field, codecLookup);
|
|
287
|
+
const key = `readonly ${serializeObjectKey(fieldName)}`;
|
|
288
|
+
outputEntries.push(`${key}: ${resolved.output}`);
|
|
289
|
+
inputEntries.push(`${key}: ${resolved.input}`);
|
|
290
|
+
}
|
|
291
|
+
const empty = "Record<string, never>";
|
|
292
|
+
return {
|
|
293
|
+
output: outputEntries.length > 0 ? `{ ${outputEntries.join("; ")} }` : empty,
|
|
294
|
+
input: inputEntries.length > 0 ? `{ ${inputEntries.join("; ")} }` : empty
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function generateContractFieldDescriptor(fieldName, field) {
|
|
298
|
+
const mods = [];
|
|
299
|
+
if (field.many === true) mods.push("; readonly many: true");
|
|
300
|
+
if (field.dict === true) mods.push("; readonly dict: true");
|
|
301
|
+
const modStr = mods.join("");
|
|
302
|
+
const { type } = field;
|
|
303
|
+
if (type.kind === "scalar") {
|
|
304
|
+
const typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : "";
|
|
305
|
+
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: 'scalar'; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;
|
|
306
|
+
}
|
|
307
|
+
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: 'valueObject'; readonly name: ${serializeValue(type.name)} }${modStr} }`;
|
|
308
|
+
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;
|
|
309
|
+
}
|
|
310
|
+
function generateValueObjectsDescriptorType(valueObjects) {
|
|
311
|
+
if (!valueObjects || Object.keys(valueObjects).length === 0) return "Record<string, never>";
|
|
312
|
+
const voEntries = [];
|
|
313
|
+
for (const [voName, vo] of Object.entries(valueObjects)) {
|
|
314
|
+
const fieldEntries = [];
|
|
315
|
+
for (const [fieldName, field] of Object.entries(vo.fields)) fieldEntries.push(generateContractFieldDescriptor(fieldName, field));
|
|
316
|
+
const fieldsType = fieldEntries.length > 0 ? `{ ${fieldEntries.join("; ")} }` : "Record<string, never>";
|
|
317
|
+
voEntries.push(`readonly ${serializeObjectKey(voName)}: { readonly fields: ${fieldsType} }`);
|
|
318
|
+
}
|
|
319
|
+
return `{ ${voEntries.join("; ")} }`;
|
|
320
|
+
}
|
|
321
|
+
function generateValueObjectTypeAliases(valueObjects, codecLookup) {
|
|
322
|
+
if (!valueObjects || Object.keys(valueObjects).length === 0) return "";
|
|
323
|
+
const aliases = [];
|
|
324
|
+
for (const [voName, vo] of Object.entries(valueObjects)) {
|
|
325
|
+
const resolved = resolveValueObjectType(voName, vo, valueObjects, codecLookup);
|
|
326
|
+
aliases.push(`export type ${voName}Output = ${resolved.output};`);
|
|
327
|
+
aliases.push(`export type ${voName}Input = ${resolved.input};`);
|
|
328
|
+
}
|
|
329
|
+
return aliases.join("\n");
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
export { serializeCrossReference as C, serializeValue as D, serializeObjectKey as E, resolveValueObjectType as S, serializeNamespaceId as T, generateValueObjectType as _, generateContractFieldDescriptor as a, renderValueSetType as b, generateFieldResolvedType as c, generateImportLines as d, generateModelFieldEntry as f, generateRootsType as g, generateModelsType as h, generateCodecTypeIntersection as i, generateFieldTypesMapsByNamespace as l, generateModelRelationsType as m, emitterError as n, generateFieldInputTypesMap as o, generateModelFieldsType as p, generateBothFieldTypesMaps as r, generateFieldOutputTypesMap as s, deduplicateImports as t, generateHashTypeAliases as u, generateValueObjectTypeAliases as v, serializeExecutionType as w, resolveFieldType as x, generateValueObjectsDescriptorType as y };
|
|
333
|
+
|
|
334
|
+
//# sourceMappingURL=domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-DAn9y5d2-BgoT5uKI.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-DAn9y5d2.mjs"],"sourcesContent":["import { isSafeTypeExpression } from \"./type-expression-safety.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { renderImports } from \"@internal/ts-render\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/emitter-errors.ts\nfunction emitterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/domain-type-generation.ts\nfunction serializeValue(value) {\n\tif (value === null) return \"null\";\n\tif (value === void 0) return \"undefined\";\n\tif (typeof value === \"string\") return `'${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/'/g, \"\\\\'\")}'`;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (Array.isArray(value)) return `readonly [${value.map((v) => serializeValue(v)).join(\", \")}]`;\n\tif (typeof value === \"object\") {\n\t\tconst entries = [];\n\t\tfor (const [k, v] of Object.entries(value)) entries.push(`readonly ${serializeObjectKey(k)}: ${serializeValue(v)}`);\n\t\treturn `{ ${entries.join(\"; \")} }`;\n\t}\n\treturn \"unknown\";\n}\nfunction serializeObjectKey(key) {\n\tif (/^[$A-Z_a-z][$\\w]*$/.test(key)) return key;\n\treturn serializeValue(key);\n}\nfunction serializeNamespaceId(value) {\n\treturn `${serializeValue(value)} & NamespaceId`;\n}\nfunction serializeCrossReference(ref) {\n\treturn `{ readonly namespace: ${serializeNamespaceId(String(ref.namespace))}; readonly model: ${serializeValue(ref.model)}${ref.space !== void 0 ? `; readonly space: ${serializeValue(ref.space)}` : \"\"} }`;\n}\nfunction generateRootsType(roots) {\n\tif (!roots || Object.keys(roots).length === 0) return \"Record<string, never>\";\n\treturn `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join(\"; \")} }`;\n}\nfunction contractFieldModifierSuffix(field) {\n\treturn (field.many === true ? \"; readonly many: true\" : \"\") + (field.dict === true ? \"; readonly dict: true\" : \"\");\n}\nfunction generateModelFieldEntry(fieldName, field) {\n\tconst mods = contractFieldModifierSuffix(field);\n\tconst { nullable, type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: 'scalar'; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: 'valueObject'; readonly name: ${serializeValue(type.name)} }${mods} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;\n}\nfunction generateModelFieldsType(fields) {\n\tconst fieldEntries = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) fieldEntries.push(generateModelFieldEntry(fieldName, field));\n\treturn fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n}\nfunction generateModelRelationsType(relations) {\n\tconst relationEntries = [];\n\tfor (const [relName, rel] of Object.entries(relations)) {\n\t\tif (typeof rel !== \"object\" || rel === null) continue;\n\t\tconst relObj = rel;\n\t\tconst toRef = relObj[\"to\"];\n\t\tif (toRef !== null && typeof toRef === \"object\" && \"space\" in toRef && toRef.space !== void 0) {\n\t\t\trelationEntries.push(`readonly ${serializeObjectKey(relName)}: never`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst parts = [];\n\t\tif (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);\n\t\tif (relObj[\"cardinality\"]) parts.push(`readonly cardinality: ${serializeValue(relObj[\"cardinality\"])}`);\n\t\tconst on = relObj[\"on\"];\n\t\tif (on && (!on.localFields || !on.targetFields)) throw emitterError(\"CONTRACT.RELATION_INVALID\", `Relation \"${relName}\" has an \"on\" block but is missing localFields or targetFields`, { meta: { relation: relName } });\n\t\tif (on?.localFields && on.targetFields) {\n\t\t\tconst localFields = on.localFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tconst targetFields = on.targetFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tparts.push(`readonly on: { readonly localFields: readonly [${localFields}]; readonly targetFields: readonly [${targetFields}] }`);\n\t\t}\n\t\tif (relObj[\"cardinality\"] === \"N:M\") {\n\t\t\tconst { through } = blindCast(relObj);\n\t\t\tconst table = serializeValue(through.table);\n\t\t\tconst namespaceId = serializeValue(through.namespaceId);\n\t\t\tconst parentColumns = through.parentColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst childColumns = through.childColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst targetColumns = through.targetColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tparts.push(`readonly through: { readonly table: ${table}; readonly namespaceId: ${namespaceId}; readonly parentColumns: readonly [${parentColumns}]; readonly childColumns: readonly [${childColumns}]; readonly targetColumns: readonly [${targetColumns}] }`);\n\t\t}\n\t\tif (parts.length > 0) relationEntries.push(`readonly ${serializeObjectKey(relName)}: { ${parts.join(\"; \")} }`);\n\t}\n\tif (relationEntries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${relationEntries.join(\"; \")} }`;\n}\nfunction generateModelsType(models, generateModelStorage) {\n\tif (!models || Object.keys(models).length === 0) return \"Record<string, never>\";\n\tconst modelTypes = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst fieldsType = generateModelFieldsType(model.fields);\n\t\tconst relationsType = generateModelRelationsType(model.relations);\n\t\tconst storageType = generateModelStorage(modelName, model);\n\t\tconst modelParts = [\n\t\t\t`readonly fields: ${fieldsType}`,\n\t\t\t`readonly relations: ${relationsType}`,\n\t\t\t`readonly storage: ${storageType}`\n\t\t];\n\t\tif (model.owner) modelParts.push(`readonly owner: ${serializeValue(model.owner)}`);\n\t\tif (model.discriminator) modelParts.push(`readonly discriminator: ${serializeValue(model.discriminator)}`);\n\t\tif (model.variants) modelParts.push(`readonly variants: ${serializeValue(model.variants)}`);\n\t\tif (model.base) modelParts.push(`readonly base: ${serializeCrossReference(model.base)}`);\n\t\tmodelTypes.push(`readonly ${modelName}: { ${modelParts.join(\"; \")} }`);\n\t}\n\treturn `{ ${modelTypes.join(\"; \")} }`;\n}\nfunction deduplicateImports(imports) {\n\tconst seenKeys = /* @__PURE__ */ new Set();\n\tconst result = [];\n\tfor (const imp of imports) {\n\t\tconst key = `${imp.package}::${imp.named}`;\n\t\tif (!seenKeys.has(key)) {\n\t\t\tseenKeys.add(key);\n\t\t\tresult.push(imp);\n\t\t}\n\t}\n\treturn result;\n}\nfunction generateImportLines(imports, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst rendered = renderImports(imports.map((imp) => ({\n\t\tmoduleSpecifier: resolveImportSpecifier(imp.package),\n\t\tsymbol: imp.named,\n\t\talias: imp.alias,\n\t\ttypeOnly: true\n\t})));\n\treturn rendered === \"\" ? [] : rendered.split(\"\\n\");\n}\nfunction generateCodecTypeIntersection(imports, named) {\n\treturn imports.filter((imp) => imp.named === named).map((imp) => imp.alias).join(\" & \") || \"Record<string, never>\";\n}\nfunction serializeExecutionType(execution) {\n\tconst parts = [\"readonly executionHash: ExecutionHash\"];\n\tfor (const [key, value] of Object.entries(execution)) {\n\t\tif (key === \"executionHash\") continue;\n\t\tparts.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nfunction generateHashTypeAliases(hashes) {\n\tconst executionHashType = hashes.executionHash ? `ExecutionHashBase<'${hashes.executionHash}'>` : \"ExecutionHashBase<string>\";\n\treturn [\n\t\t`export type StorageHash = StorageHashBase<'${hashes.storageHash}'>;`,\n\t\t`export type ExecutionHash = ${executionHashType};`,\n\t\t`export type ProfileHash = ProfileHashBase<'${hashes.profileHash}'>;`\n\t].join(\"\\n\");\n}\nfunction applyModifiers(base, field) {\n\tlet result = base;\n\tif (field.many === true) result = `ReadonlyArray<${result}>`;\n\tif (field.dict === true) result = `Readonly<Record<string, ${result}>>`;\n\tif (field.nullable) result = `${result} | null`;\n\treturn result;\n}\n/**\n* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by\n* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not\n* a generic serializer. `side`: `output` = read type, `input` = create/update type.\n*\n* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when\n* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value\n* isn't literal-expressible. A caller that needs column and field types to agree shares this so both\n* compute the union identically.\n*/\nfunction renderValueSetType(values, codecId, side, codecLookup) {\n\tif (values.length === 0 || codecLookup?.renderValueLiteralFor === void 0) return void 0;\n\tconst literals = [];\n\tfor (const value of values) {\n\t\tconst lit = codecLookup.renderValueLiteralFor(codecId, value, side);\n\t\tif (lit === void 0 || !isSafeTypeExpression(lit)) return void 0;\n\t\tliterals.push(lit);\n\t}\n\treturn literals.join(\" | \");\n}\nfunction resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet) {\n\tconst { type } = field;\n\tswitch (type.kind) {\n\t\tcase \"scalar\": {\n\t\t\tif (resolvedValueSet) {\n\t\t\t\tconst output = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"output\", codecLookup);\n\t\t\t\tconst input = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"input\", codecLookup);\n\t\t\t\tif (output !== void 0 && input !== void 0) return {\n\t\t\t\t\toutput: applyModifiers(output, field),\n\t\t\t\t\tinput: applyModifiers(input, field)\n\t\t\t\t};\n\t\t\t}\n\t\t\tlet outputResolved;\n\t\t\tlet inputResolved;\n\t\t\tconst effectiveTypeParams = (type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0) ?? resolvedTypeParams;\n\t\t\tif (codecLookup && effectiveTypeParams && Object.keys(effectiveTypeParams).length > 0) {\n\t\t\t\tconst rendered = codecLookup.renderOutputTypeFor(type.codecId, effectiveTypeParams);\n\t\t\t\tif (rendered && isSafeTypeExpression(rendered)) outputResolved = rendered;\n\t\t\t\tconst renderedInput = codecLookup.renderInputTypeFor?.(type.codecId, effectiveTypeParams);\n\t\t\t\tif (renderedInput && isSafeTypeExpression(renderedInput)) inputResolved = renderedInput;\n\t\t\t}\n\t\t\tconst codecAccessor = `CodecTypes[${serializeValue(type.codecId)}]`;\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(outputResolved ?? `${codecAccessor}['output']`, field),\n\t\t\t\tinput: applyModifiers(inputResolved ?? `${codecAccessor}['input']`, field)\n\t\t\t};\n\t\t}\n\t\tcase \"valueObject\": return {\n\t\t\toutput: applyModifiers(`${type.name}Output`, field),\n\t\t\tinput: applyModifiers(`${type.name}Input`, field)\n\t\t};\n\t\tcase \"union\": {\n\t\t\tconst outputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}]['output']` : `${m.name}Output`);\n\t\t\tconst inputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}]['input']` : `${m.name}Input`);\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(outputMembers.join(\" | \"), field),\n\t\t\t\tinput: applyModifiers(inputMembers.join(\" | \"), field)\n\t\t\t};\n\t\t}\n\t\tdefault: return {\n\t\t\toutput: applyModifiers(\"unknown\", field),\n\t\t\tinput: applyModifiers(\"unknown\", field)\n\t\t};\n\t}\n}\nfunction generateFieldResolvedType(field, codecLookup, side = \"output\") {\n\treturn resolveFieldType(field, codecLookup)[side];\n}\nfunction generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {\n\tif (!models || Object.keys(models).length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst outputModelEntries = [];\n\tconst inputModelEntries = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tif (!model) continue;\n\t\tconst outputFieldEntries = [];\n\t\tconst inputFieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(model.fields)) {\n\t\t\tconst resolvedTypeParams = (field.type.kind === \"scalar\" && field.type.typeParams && Object.keys(field.type.typeParams).length > 0 ? field.type.typeParams : void 0) ?? resolveFieldTypeParams?.(modelName, fieldName, model);\n\t\t\tconst resolvedValueSet = resolveFieldValueSet?.(modelName, fieldName, model);\n\t\t\tconst resolved = resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet);\n\t\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\t\toutputFieldEntries.push(`${key}: ${resolved.output}`);\n\t\t\tinputFieldEntries.push(`${key}: ${resolved.input}`);\n\t\t}\n\t\tconst outputFields = outputFieldEntries.length > 0 ? `{ ${outputFieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tconst inputFields = inputFieldEntries.length > 0 ? `{ ${inputFieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tconst modelKey = `readonly ${serializeObjectKey(modelName)}`;\n\t\toutputModelEntries.push(`${modelKey}: ${outputFields}`);\n\t\tinputModelEntries.push(`${modelKey}: ${inputFields}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputModelEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputModelEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldTypesMapsByNamespace(namespaceModels, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {\n\tif (namespaceModels.length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst outputNamespaceEntries = [];\n\tconst inputNamespaceEntries = [];\n\tfor (const [nsId, models] of namespaceModels) {\n\t\tconst inner = generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet);\n\t\tconst nsKey = `readonly ${serializeObjectKey(nsId)}`;\n\t\toutputNamespaceEntries.push(`${nsKey}: ${inner.output}`);\n\t\tinputNamespaceEntries.push(`${nsKey}: ${inner.input}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputNamespaceEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputNamespaceEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldOutputTypesMap(models, codecLookup, resolveFieldTypeParams) {\n\treturn generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).output;\n}\nfunction generateFieldInputTypesMap(models, codecLookup, resolveFieldTypeParams) {\n\treturn generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams).input;\n}\nfunction generateValueObjectType(_voName, vo, _valueObjects, side = \"output\", codecLookup) {\n\treturn resolveValueObjectType(_voName, vo, _valueObjects, codecLookup)[side];\n}\nfunction resolveValueObjectType(_voName, vo, _valueObjects, codecLookup) {\n\tconst outputEntries = [];\n\tconst inputEntries = [];\n\tfor (const [fieldName, field] of Object.entries(vo.fields)) {\n\t\tconst resolved = resolveFieldType(field, codecLookup);\n\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\toutputEntries.push(`${key}: ${resolved.output}`);\n\t\tinputEntries.push(`${key}: ${resolved.input}`);\n\t}\n\tconst empty = \"Record<string, never>\";\n\treturn {\n\t\toutput: outputEntries.length > 0 ? `{ ${outputEntries.join(\"; \")} }` : empty,\n\t\tinput: inputEntries.length > 0 ? `{ ${inputEntries.join(\"; \")} }` : empty\n\t};\n}\nfunction generateContractFieldDescriptor(fieldName, field) {\n\tconst mods = [];\n\tif (field.many === true) mods.push(\"; readonly many: true\");\n\tif (field.dict === true) mods.push(\"; readonly dict: true\");\n\tconst modStr = mods.join(\"\");\n\tconst { type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: 'scalar'; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: 'valueObject'; readonly name: ${serializeValue(type.name)} }${modStr} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;\n}\nfunction generateValueObjectsDescriptorType(valueObjects) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"Record<string, never>\";\n\tconst voEntries = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst fieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(vo.fields)) fieldEntries.push(generateContractFieldDescriptor(fieldName, field));\n\t\tconst fieldsType = fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tvoEntries.push(`readonly ${serializeObjectKey(voName)}: { readonly fields: ${fieldsType} }`);\n\t}\n\treturn `{ ${voEntries.join(\"; \")} }`;\n}\nfunction generateValueObjectTypeAliases(valueObjects, codecLookup) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"\";\n\tconst aliases = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst resolved = resolveValueObjectType(voName, vo, valueObjects, codecLookup);\n\t\taliases.push(`export type ${voName}Output = ${resolved.output};`);\n\t\taliases.push(`export type ${voName}Input = ${resolved.input};`);\n\t}\n\treturn aliases.join(\"\\n\");\n}\n//#endregion\nexport { serializeExecutionType as C, emitterError as D, serializeValue as E, serializeCrossReference as S, serializeObjectKey as T, generateValueObjectTypeAliases as _, generateFieldInputTypesMap as a, resolveFieldType as b, generateFieldTypesMapsByNamespace as c, generateModelFieldEntry as d, generateModelFieldsType as f, generateValueObjectType as g, generateRootsType as h, generateContractFieldDescriptor as i, generateHashTypeAliases as l, generateModelsType as m, generateBothFieldTypesMaps as n, generateFieldOutputTypesMap as o, generateModelRelationsType as p, generateCodecTypeIntersection as r, generateFieldResolvedType as s, deduplicateImports as t, generateImportLines as u, generateValueObjectsDescriptorType as v, serializeNamespaceId as w, resolveValueObjectType as x, renderValueSetType as y };\n\n//# sourceMappingURL=domain-type-generation-DAn9y5d2.mjs.map"],"mappings":";;;;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IAAI,cAAc,WAAW;EAC7E,QAAQ,KAAK,eAAe,OAAO,WAAW,SAAS,OAAO,EAAE;EAChE,QAAQ,KAAK,eAAe,OAAO,UAAU,SAAS,MAAM,EAAE;CAC/D;CACA,OAAO,QAAQ,KAAK,IAAI;AACzB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
2
|
+
import { ContractField, ContractModelBase, ContractValueObject, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
4
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-PkAb39ob.d.mts
|
|
5
|
+
//#region src/domain-type-generation.d.ts
|
|
6
|
+
declare function serializeValue(value: unknown): string;
|
|
7
|
+
declare function serializeObjectKey(key: string): string;
|
|
8
|
+
declare function serializeNamespaceId(value: string): string;
|
|
9
|
+
declare function serializeCrossReference(ref: CrossReference): string;
|
|
10
|
+
declare function generateRootsType(roots: Record<string, CrossReference> | undefined): string;
|
|
11
|
+
declare function generateModelFieldEntry(fieldName: string, field: ContractField): string;
|
|
12
|
+
declare function generateModelFieldsType(fields: Record<string, ContractField>): string;
|
|
13
|
+
declare function generateModelRelationsType(relations: Record<string, unknown>): string;
|
|
14
|
+
declare function generateModelsType(models: Record<string, ContractModelBase>, generateModelStorage: (modelName: string, model: ContractModelBase) => string): string;
|
|
15
|
+
declare function deduplicateImports(imports: TypesImportSpec[]): TypesImportSpec[];
|
|
16
|
+
declare function generateImportLines(imports: TypesImportSpec[], resolveImportSpecifier?: ImportSpecifierResolver): string[];
|
|
17
|
+
declare function generateCodecTypeIntersection(imports: ReadonlyArray<TypesImportSpec>, named: string): string;
|
|
18
|
+
declare function serializeExecutionType(execution: Record<string, unknown>): string;
|
|
19
|
+
declare function generateHashTypeAliases(hashes: {
|
|
20
|
+
readonly storageHash: string;
|
|
21
|
+
readonly executionHash?: string;
|
|
22
|
+
readonly profileHash: string;
|
|
23
|
+
}): string;
|
|
24
|
+
type ResolvedFieldType = {
|
|
25
|
+
readonly input: string;
|
|
26
|
+
readonly output: string;
|
|
27
|
+
};
|
|
28
|
+
type FieldTypeParamsResolver = (modelName: string, fieldName: string, model: ContractModelBase) => Record<string, unknown> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* A field's permitted values (codec-encoded) plus the codec that types them, as supplied by the
|
|
31
|
+
* family-specific {@link EmissionSpi.resolveFieldValueSet}. The framework renders these into a TS
|
|
32
|
+
* literal union through the codec seam ({@link renderValueSetType}).
|
|
33
|
+
*/
|
|
34
|
+
type ResolvedFieldValueSet = {
|
|
35
|
+
readonly encodedValues: readonly JsonValue[];
|
|
36
|
+
readonly codecId: string;
|
|
37
|
+
};
|
|
38
|
+
type FieldValueSetResolver = (modelName: string, fieldName: string, model: ContractModelBase) => ResolvedFieldValueSet | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by
|
|
41
|
+
* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not
|
|
42
|
+
* a generic serializer. `side`: `output` = read type, `input` = create/update type.
|
|
43
|
+
*
|
|
44
|
+
* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when
|
|
45
|
+
* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value
|
|
46
|
+
* isn't literal-expressible. A caller that needs column and field types to agree shares this so both
|
|
47
|
+
* compute the union identically.
|
|
48
|
+
*/
|
|
49
|
+
declare function renderValueSetType(values: readonly JsonValue[], codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
|
|
50
|
+
declare function resolveFieldType(field: ContractField, codecLookup?: CodecLookup, resolvedTypeParams?: Record<string, unknown>, resolvedValueSet?: ResolvedFieldValueSet): ResolvedFieldType;
|
|
51
|
+
declare function generateFieldResolvedType(field: ContractField, codecLookup?: CodecLookup, side?: 'input' | 'output'): string;
|
|
52
|
+
declare function generateBothFieldTypesMaps(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
53
|
+
declare function generateFieldTypesMapsByNamespace(namespaceModels: ReadonlyArray<readonly [string, Record<string, ContractModelBase>]>, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
54
|
+
declare function generateFieldOutputTypesMap(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver): string;
|
|
55
|
+
declare function generateFieldInputTypesMap(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver): string;
|
|
56
|
+
declare function generateValueObjectType(_voName: string, vo: ContractValueObject, _valueObjects: Record<string, ContractValueObject>, side?: 'input' | 'output', codecLookup?: CodecLookup): string;
|
|
57
|
+
declare function resolveValueObjectType(_voName: string, vo: ContractValueObject, _valueObjects: Record<string, ContractValueObject>, codecLookup?: CodecLookup): ResolvedFieldType;
|
|
58
|
+
declare function generateContractFieldDescriptor(fieldName: string, field: ContractField): string;
|
|
59
|
+
declare function generateValueObjectsDescriptorType(valueObjects: Record<string, ContractValueObject> | undefined): string;
|
|
60
|
+
declare function generateValueObjectTypeAliases(valueObjects: Record<string, ContractValueObject> | undefined, codecLookup?: CodecLookup): string;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { serializeValue as A, renderValueSetType as C, serializeExecutionType as D, serializeCrossReference as E, serializeNamespaceId as O, generateValueObjectsDescriptorType as S, resolveValueObjectType as T, generateModelRelationsType as _, deduplicateImports as a, generateValueObjectType as b, generateContractFieldDescriptor as c, generateFieldResolvedType as d, generateFieldTypesMapsByNamespace as f, generateModelFieldsType as g, generateModelFieldEntry as h, ResolvedFieldValueSet as i, serializeObjectKey as k, generateFieldInputTypesMap as l, generateImportLines as m, FieldValueSetResolver as n, generateBothFieldTypesMaps as o, generateHashTypeAliases as p, ResolvedFieldType as r, generateCodecTypeIntersection as s, FieldTypeParamsResolver as t, generateFieldOutputTypesMap as u, generateModelsType as v, resolveFieldType as w, generateValueObjectTypeAliases as x, generateRootsType as y };
|
|
63
|
+
//# sourceMappingURL=domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-PkAb39ob-Ct8AGqow.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-PkAb39ob.d.mts"],"mappings":";;;;;iBAIiB,eAAe;iBACf,mBAAmB;iBACnB,qBAAqB;iBACrB,wBAAwB,KAAK;iBAC7B,kBAAkB,OAAO,eAAe;iBACxC,wBAAwB,mBAAmB,OAAO;iBAClD,wBAAwB,QAAQ,eAAe;iBAC/C,2BAA2B,WAAW;iBACtC,mBAAmB,QAAQ,eAAe,oBAAoB,uBAAuB,mBAAmB,OAAO;iBAC/G,mBAAmB,SAAS,oBAAoB;iBAChD,oBAAoB,SAAS,mBAAmB,yBAAyB;iBACzE,8BAA8B,SAAS,cAAc,kBAAkB;iBACvE,uBAAuB,WAAW;iBAClC,wBAAwB;WAC9B;WACA;WACA;;KAEN;WACM;WACA;;KAEN,2BAA2B,mBAAmB,mBAAmB,OAAO,sBAAsB;;;;;;KAM9F;WACM,wBAAwB;WACxB;;KAEN,yBAAyB,mBAAmB,mBAAmB,OAAO,sBAAsB;;;;;;;;;;;iBAWhF,mBAAmB,iBAAiB,aAAa,iBAAiB,0BAA0B,aAAa;iBACzG,iBAAiB,OAAO,eAAe,cAAc,aAAa,qBAAqB,yBAAyB,mBAAmB,wBAAwB;iBAC3J,0BAA0B,OAAO,eAAe,cAAc,aAAa;iBAC3E,2BAA2B,QAAQ,eAAe,gCAAgC,cAAc,aAAa,yBAAyB,yBAAyB,uBAAuB,wBAAwB;iBAC9M,kCAAkC,iBAAiB,gCAAgC,eAAe,sBAAsB,cAAc,aAAa,yBAAyB,yBAAyB,uBAAuB,wBAAwB;iBACpP,4BAA4B,QAAQ,eAAe,gCAAgC,cAAc,aAAa,yBAAyB;iBACvI,2BAA2B,QAAQ,eAAe,gCAAgC,cAAc,aAAa,yBAAyB;iBACtI,wBAAwB,iBAAiB,IAAI,qBAAqB,eAAe,eAAe,sBAAsB,2BAA2B,cAAc;iBAC/J,uBAAuB,iBAAiB,IAAI,qBAAqB,eAAe,eAAe,sBAAsB,cAAc,cAAc;iBACjJ,gCAAgC,mBAAmB,OAAO;iBAC1D,mCAAmC,cAAc,eAAe;iBAChE,+BAA+B,cAAc,eAAe,kCAAkC,cAAc"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { A as serializeValue, _ as generateModelRelationsType, a as deduplicateImports, k as serializeObjectKey, m as generateImportLines, p as generateHashTypeAliases, s as generateCodecTypeIntersection, u as generateFieldOutputTypesMap, y as generateRootsType } from "./domain-type-generation-PkAb39ob-Ct8AGqow.mjs";
|
|
2
|
+
import { PreserveEmptyPredicate, SerializeContract, StorageSort } from "@prisma/orm-framework/contract/hashing";
|
|
3
|
+
import { EmissionSpi, GenerateContractTypesOptions, ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
4
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
5
|
+
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
6
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/index-FmLW1eUx.d.mts
|
|
7
|
+
//#region src/artifact-paths.d.ts
|
|
8
|
+
interface EmittedArtifactPaths {
|
|
9
|
+
readonly jsonPath: string;
|
|
10
|
+
readonly dtsPath: string;
|
|
11
|
+
}
|
|
12
|
+
declare function getEmittedArtifactPaths(outputJsonPath: string): EmittedArtifactPaths;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/emit-types.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* The subset of ControlStack that emit() reads.
|
|
17
|
+
* All fields are optional so tests can pass minimal objects.
|
|
18
|
+
* A full ControlStack satisfies this via structural typing.
|
|
19
|
+
*/
|
|
20
|
+
interface EmitStackInput {
|
|
21
|
+
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
22
|
+
readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
23
|
+
readonly extensionIds?: ReadonlyArray<string>;
|
|
24
|
+
readonly codecLookup?: CodecLookup;
|
|
25
|
+
}
|
|
26
|
+
interface EmitOptions {
|
|
27
|
+
readonly outputJsonPath?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Per-target serializer that converts the in-memory contract into its
|
|
30
|
+
* canonical on-disk JsonObject shape before the framework's
|
|
31
|
+
* key-ordering / default-omission walk runs. Threaded from the
|
|
32
|
+
* descriptor (`descriptor.contractSerializer.serializeContract`) at
|
|
33
|
+
* the CLI / control-API call site so target classes decide what
|
|
34
|
+
* appears in the JSON envelope rather than the framework guessing
|
|
35
|
+
* via property enumerability.
|
|
36
|
+
*/
|
|
37
|
+
readonly serializeContract: SerializeContract;
|
|
38
|
+
/**
|
|
39
|
+
* Optional family-contributed preserve-empty predicate. Threaded from
|
|
40
|
+
* `descriptor.contractSerializer.shouldPreserveEmpty` when present.
|
|
41
|
+
*/
|
|
42
|
+
readonly shouldPreserveEmpty?: PreserveEmptyPredicate;
|
|
43
|
+
/**
|
|
44
|
+
* Optional family-contributed storage sort hook. Threaded from
|
|
45
|
+
* `descriptor.contractSerializer.sortStorage` when present.
|
|
46
|
+
*/
|
|
47
|
+
readonly sortStorage?: StorageSort;
|
|
48
|
+
/**
|
|
49
|
+
* Rewrites the package names the generated `contract.d.ts` imports from, for
|
|
50
|
+
* the import root the consuming application installed. Defaults to leaving
|
|
51
|
+
* every specifier as authored, which is what the repository itself needs
|
|
52
|
+
* while its own code still imports workspace names.
|
|
53
|
+
*/
|
|
54
|
+
readonly resolveImportSpecifier?: ImportSpecifierResolver;
|
|
55
|
+
}
|
|
56
|
+
interface EmitResult {
|
|
57
|
+
readonly contractJson: string;
|
|
58
|
+
readonly contractDts: string;
|
|
59
|
+
readonly storageHash: string;
|
|
60
|
+
readonly executionHash?: string;
|
|
61
|
+
readonly profileHash: string;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/emit.d.ts
|
|
65
|
+
declare function emit(contract: Contract, stack: EmitStackInput, targetFamily: EmissionSpi, options: EmitOptions): Promise<EmitResult>;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/generate-contract-dts.d.ts
|
|
68
|
+
declare function generateContractDts(contract: Contract, emitter: EmissionSpi, codecTypeImports: ReadonlyArray<TypesImportSpec>, hashes: {
|
|
69
|
+
readonly storageHash: string;
|
|
70
|
+
readonly executionHash?: string;
|
|
71
|
+
readonly profileHash: string;
|
|
72
|
+
}, options?: GenerateContractTypesOptions, codecLookup?: CodecLookup, resolveImportSpecifier?: ImportSpecifierResolver): string;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { type EmitOptions, type EmitResult, type EmitStackInput, type EmittedArtifactPaths, deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|
|
75
|
+
//# sourceMappingURL=emitter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/index-FmLW1eUx.d.mts"],"mappings":";;;;;;;UAMU;WACC;WACA;;iBAEM,wBAAwB,yBAAyB;;;;;;;;UAQxD;WACC,mBAAmB,cAAc;WACjC,4BAA4B,cAAc;WAC1C,eAAe;WACf,cAAc;;UAEf;WACC;;;;;;;;;;WAUA,mBAAmB;;;;;WAKnB,sBAAsB;;;;;WAKtB,cAAc;;;;;;;WAOd,yBAAyB;;UAE1B;WACC;WACA;WACA;WACA;WACA;;;;iBAIM,KAAK,UAAU,UAAU,OAAO,gBAAgB,cAAc,aAAa,SAAS,cAAc,QAAQ;;;iBAG1G,oBAAoB,UAAU,UAAU,SAAS,aAAa,kBAAkB,cAAc,kBAAkB;WACtH;WACA;WACA;GACR,UAAU,8BAA8B,cAAc,aAAa,yBAAyB"}
|
package/dist/emitter.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { D as serializeValue, E as serializeObjectKey, d as generateImportLines, g as generateRootsType, i as generateCodecTypeIntersection, m as generateModelRelationsType, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases } from "./domain-type-generation-DAn9y5d2-BgoT5uKI.mjs";
|
|
2
|
+
import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-D3-NwrMA-CadaBGQ3.mjs";
|
|
3
|
+
export { deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as serializeValue, C as renderValueSetType, D as serializeExecutionType, E as serializeCrossReference, O as serializeNamespaceId, S as generateValueObjectsDescriptorType, T as resolveValueObjectType, _ as generateModelRelationsType, a as deduplicateImports, b as generateValueObjectType, c as generateContractFieldDescriptor, d as generateFieldResolvedType, f as generateFieldTypesMapsByNamespace, g as generateModelFieldsType, h as generateModelFieldEntry, i as ResolvedFieldValueSet, k as serializeObjectKey, l as generateFieldInputTypesMap, m as generateImportLines, n as FieldValueSetResolver, o as generateBothFieldTypesMaps, p as generateHashTypeAliases, r as ResolvedFieldType, s as generateCodecTypeIntersection, t as FieldTypeParamsResolver, u as generateFieldOutputTypesMap, v as generateModelsType, w as resolveFieldType, x as generateValueObjectTypeAliases, y as generateRootsType } from "./domain-type-generation-PkAb39ob-Ct8AGqow.mjs";
|
|
2
|
+
export { FieldTypeParamsResolver, FieldValueSetResolver, ResolvedFieldType, ResolvedFieldValueSet, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as serializeCrossReference, D as serializeValue, E as serializeObjectKey, S as resolveValueObjectType, T as serializeNamespaceId, _ as generateValueObjectType, a as generateContractFieldDescriptor, b as renderValueSetType, c as generateFieldResolvedType, d as generateImportLines, f as generateModelFieldEntry, g as generateRootsType, h as generateModelsType, i as generateCodecTypeIntersection, l as generateFieldTypesMapsByNamespace, m as generateModelRelationsType, o as generateFieldInputTypesMap, p as generateModelFieldsType, r as generateBothFieldTypesMaps, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases, v as generateValueObjectTypeAliases, w as serializeExecutionType, x as resolveFieldType, y as generateValueObjectsDescriptorType } from "./domain-type-generation-DAn9y5d2-BgoT5uKI.mjs";
|
|
2
|
+
export { deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/type-expression-safety.d.mts
|
|
2
|
+
//#region src/type-expression-safety.d.ts
|
|
3
|
+
declare function isSafeTypeExpression(expr: string): boolean;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { isSafeTypeExpression };
|
|
6
|
+
//# sourceMappingURL=emitter__type-expression-safety.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter__type-expression-safety.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/type-expression-safety.d.mts"],"mappings":";;iBACiB,qBAAqB"}
|