@prisma/orm-toolchain 8.0.0-rc.1-dev.45 → 8.0.0-rc.10
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/README.md +3 -7
- package/dist/{aggregate-BBsCbXgJ.mjs → aggregate-B4HKshLQ.mjs} +11 -11
- package/dist/aggregate-B4HKshLQ.mjs.map +1 -0
- package/dist/{aggregate-CA6bJ8UO.d.mts → aggregate-D_eX4zoo.d.mts} +5 -5
- package/dist/{aggregate-CA6bJ8UO.d.mts.map → aggregate-D_eX4zoo.d.mts.map} +1 -1
- package/dist/cli-telemetry.d.mts +27 -12
- package/dist/cli-telemetry.d.mts.map +1 -1
- package/dist/cli-telemetry.mjs +286 -9
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +7 -13
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +4871 -567
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +314 -34
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -19
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__control-api__testing.mjs.map +1 -1
- package/dist/cli__init-output.d.mts +0 -1
- package/dist/cli__init-output.d.mts.map +1 -1
- package/dist/cli__init-output.mjs +1 -1
- package/dist/cli__migration-cli.mjs +10 -10
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs} +5 -5
- package/dist/{contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs.map → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map} +1 -1
- package/dist/{cli-errors-iquUoY6O-BFboxglv.d.mts → db-verify-Yih5kWtB-B1kv76ec.d.mts} +84 -84
- package/dist/db-verify-Yih5kWtB-B1kv76ec.d.mts.map +1 -0
- package/dist/{domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs → domain-type-generation-CR9ECUau-DOlKbcaE.mjs} +20 -6
- package/dist/domain-type-generation-CR9ECUau-DOlKbcaE.mjs.map +1 -0
- package/dist/{domain-type-generation-PkAb39ob-Ct8AGqow.d.mts → domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts} +14 -3
- package/dist/domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts.map +1 -0
- package/dist/emitter.d.mts +2 -2
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.d.mts +2 -2
- package/dist/emitter__domain-type-generation.mjs +2 -2
- package/dist/{errors-KWM8yBAL.d.mts → errors-D59OCpoI.d.mts} +2 -2
- package/dist/{errors-KWM8yBAL.d.mts.map → errors-D59OCpoI.d.mts.map} +1 -1
- package/dist/{errors-CXbGUWGu-BQi6YS-H.mjs → errors-SoLLYLtw-DMxVbVs9.mjs} +10 -10
- package/dist/errors-SoLLYLtw-DMxVbVs9.mjs.map +1 -0
- package/dist/{exports-BZLNbtkY.mjs → exports-BXXeNWlj.mjs} +42 -36
- package/dist/exports-BXXeNWlj.mjs.map +1 -0
- package/dist/exports-CE6OD63o-4Qpqr2W7.mjs +398 -0
- package/dist/exports-CE6OD63o-4Qpqr2W7.mjs.map +1 -0
- package/dist/{exports-B3xY_FHp.mjs → exports-CYa2di3d.mjs} +386 -26
- package/dist/exports-CYa2di3d.mjs.map +1 -0
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs → graph-membership-DY1Onbc3-CwBd6wuB.mjs} +3 -3
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs.map → graph-membership-DY1Onbc3-CwBd6wuB.mjs.map} +1 -1
- package/dist/{import-roots-B6CtsWXb.d.mts → import-roots-ARK1wjzc.d.mts} +4 -4
- package/dist/{import-roots-B6CtsWXb.d.mts.map → import-roots-ARK1wjzc.d.mts.map} +1 -1
- package/dist/{import-roots-NDOIEDVj.mjs → import-roots-BHOrDJbI.mjs} +13 -6
- package/dist/import-roots-BHOrDJbI.mjs.map +1 -0
- package/dist/{index-CnOyYxmv.d.mts → index-D217lbiW.d.mts} +8 -4
- package/dist/index-D217lbiW.d.mts.map +1 -0
- package/dist/{index-mCsi_ND5.d.mts → index-u5RdrumF.d.mts} +2 -11
- package/dist/index-u5RdrumF.d.mts.map +1 -0
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs → invariants-Cww4bv0v-BEiFxmbX.mjs} +3 -3
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs.map → invariants-Cww4bv0v-BEiFxmbX.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D94PxRc-.mjs → io-BmWQNxRP-DQqbcPsS.mjs} +5 -5
- package/dist/{io-635GlNx1-D94PxRc-.mjs.map → io-BmWQNxRP-DQqbcPsS.mjs.map} +1 -1
- package/dist/{migration-gubSSeMk.mjs → migration-B9w-7dKe.mjs} +3 -3
- package/dist/{migration-gubSSeMk.mjs.map → migration-B9w-7dKe.mjs.map} +1 -1
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs → migration-graph-CW4bMmTz-B5xFtFVB.mjs} +3 -3
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs.map → migration-graph-CW4bMmTz-B5xFtFVB.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +5 -5
- package/dist/migration-tools.mjs +13 -13
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.d.mts +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration-ts.mjs +1 -1
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.d.mts +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.d.mts +2 -2
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{migration-ts-BoHxxGvi.mjs → migration-ts-DdVm0rws.mjs} +2 -2
- package/dist/{migration-ts-BoHxxGvi.mjs.map → migration-ts-DdVm0rws.mjs.map} +1 -1
- package/dist/{output-DP3woAjV-BxCr9nHA.mjs → output-D83nTTpC-XlvN30yS.mjs} +5 -47
- package/dist/output-D83nTTpC-XlvN30yS.mjs.map +1 -0
- package/dist/publish-surface.d.mts +2 -2
- package/dist/publish-surface.mjs +2 -2
- package/dist/publish-surface__import-roots.d.mts +1 -1
- package/dist/publish-surface__import-roots.mjs +1 -1
- package/dist/publish-surface__shells.d.mts +1 -1
- package/dist/publish-surface__shells.mjs +1 -1
- package/dist/quick-reference-mongo.md +21 -18
- package/dist/quick-reference-postgres.md +20 -17
- package/dist/readme-mongo.md +7 -7
- package/dist/readme-postgres.md +7 -7
- package/dist/ref-DcqFmceq-QaUjgZeM.mjs +4789 -0
- package/dist/ref-DcqFmceq-QaUjgZeM.mjs.map +1 -0
- package/dist/{ref-resolution-sGcINe7o.mjs → ref-resolution-BWpwb8_b.mjs} +9 -2
- package/dist/ref-resolution-BWpwb8_b.mjs.map +1 -0
- package/dist/{ref-resolution-COGOSL57.d.mts → ref-resolution-CaHQJXE0.d.mts} +11 -1
- package/dist/ref-resolution-CaHQJXE0.d.mts.map +1 -0
- package/dist/{refs-WK86uYYp-B6EZkmmT.mjs → refs-BpSpzdYB-BcDelHGt.mjs} +9 -9
- package/dist/refs-BpSpzdYB-BcDelHGt.mjs.map +1 -0
- package/dist/{shells-BenrJHp2.mjs → shells-BIdFZwUY.mjs} +13 -19
- package/dist/shells-BIdFZwUY.mjs.map +1 -0
- package/dist/{shells-COHV_Ozf.d.mts → shells-CIUmT4u4.d.mts} +14 -20
- package/dist/shells-CIUmT4u4.d.mts.map +1 -0
- package/dist/{spaces-tWQi7CUv.d.mts → spaces-B20bgxF9.d.mts} +3 -3
- package/dist/{spaces-tWQi7CUv.d.mts.map → spaces-B20bgxF9.d.mts.map} +1 -1
- package/dist/{spaces-BG2w0P8d.mjs → spaces-BCZiAZQn.mjs} +8 -8
- package/dist/spaces-BCZiAZQn.mjs.map +1 -0
- package/dist/{verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts → verify-contract-spaces-C3PiFBk3-DfomYyOE.d.mts} +3 -3
- package/dist/{verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map → verify-contract-spaces-C3PiFBk3-DfomYyOE.d.mts.map} +1 -1
- package/dist/{verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs} +8 -8
- package/dist/{verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs.map → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +3 -3
- package/dist/vite-plugin-contract-emit.mjs +10 -10
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +16 -40
- package/dist/aggregate-BBsCbXgJ.mjs.map +0 -1
- package/dist/bin__prisma-next.mjs +0 -512
- package/dist/bin__prisma-next.mjs.map +0 -1
- package/dist/caught-errors-BZo7zcRc-C-pIEasG.mjs +0 -14
- package/dist/caught-errors-BZo7zcRc-C-pIEasG.mjs.map +0 -1
- package/dist/cli-errors-B4zTLaqQ-CXgjO9t4.mjs +0 -347
- package/dist/cli-errors-B4zTLaqQ-CXgjO9t4.mjs.map +0 -1
- package/dist/cli-errors-iquUoY6O-BFboxglv.d.mts.map +0 -1
- package/dist/cli__commands__contract-emit.d.mts +0 -2
- package/dist/cli__commands__contract-emit.mjs +0 -2
- package/dist/cli__commands__contract-infer.d.mts +0 -7
- package/dist/cli__commands__contract-infer.d.mts.map +0 -1
- package/dist/cli__commands__contract-infer.mjs +0 -2
- package/dist/cli__commands__db-init.d.mts +0 -7
- package/dist/cli__commands__db-init.d.mts.map +0 -1
- package/dist/cli__commands__db-init.mjs +0 -2
- package/dist/cli__commands__db-schema.d.mts +0 -7
- package/dist/cli__commands__db-schema.d.mts.map +0 -1
- package/dist/cli__commands__db-schema.mjs +0 -2
- package/dist/cli__commands__db-sign.d.mts +0 -7
- package/dist/cli__commands__db-sign.d.mts.map +0 -1
- package/dist/cli__commands__db-sign.mjs +0 -2
- package/dist/cli__commands__db-update.d.mts +0 -7
- package/dist/cli__commands__db-update.d.mts.map +0 -1
- package/dist/cli__commands__db-update.mjs +0 -2
- package/dist/cli__commands__db-verify.d.mts +0 -7
- package/dist/cli__commands__db-verify.d.mts.map +0 -1
- package/dist/cli__commands__db-verify.mjs +0 -2
- package/dist/cli__commands__migrate.d.mts +0 -57
- package/dist/cli__commands__migrate.d.mts.map +0 -1
- package/dist/cli__commands__migrate.mjs +0 -2
- package/dist/cli__commands__migration-check.d.mts +0 -8
- package/dist/cli__commands__migration-check.d.mts.map +0 -1
- package/dist/cli__commands__migration-check.mjs +0 -3
- package/dist/cli__commands__migration-graph.d.mts +0 -38
- package/dist/cli__commands__migration-graph.d.mts.map +0 -1
- package/dist/cli__commands__migration-graph.mjs +0 -2
- package/dist/cli__commands__migration-list.d.mts +0 -39
- package/dist/cli__commands__migration-list.d.mts.map +0 -1
- package/dist/cli__commands__migration-list.mjs +0 -2
- package/dist/cli__commands__migration-log.d.mts +0 -20
- package/dist/cli__commands__migration-log.d.mts.map +0 -1
- package/dist/cli__commands__migration-log.mjs +0 -2
- package/dist/cli__commands__migration-new.d.mts +0 -7
- package/dist/cli__commands__migration-new.d.mts.map +0 -1
- package/dist/cli__commands__migration-new.mjs +0 -2
- package/dist/cli__commands__migration-plan.d.mts +0 -34
- package/dist/cli__commands__migration-plan.d.mts.map +0 -1
- package/dist/cli__commands__migration-plan.mjs +0 -2
- package/dist/cli__commands__migration-show.d.mts +0 -27
- package/dist/cli__commands__migration-show.d.mts.map +0 -1
- package/dist/cli__commands__migration-show.mjs +0 -2
- package/dist/cli__commands__migration-status.d.mts +0 -55
- package/dist/cli__commands__migration-status.d.mts.map +0 -1
- package/dist/cli__commands__migration-status.mjs +0 -3
- package/dist/cli__commands__ref.d.mts +0 -7
- package/dist/cli__commands__ref.d.mts.map +0 -1
- package/dist/cli__commands__ref.mjs +0 -2
- package/dist/cli__commands__telemetry.d.mts +0 -7
- package/dist/cli__commands__telemetry.d.mts.map +0 -1
- package/dist/cli__commands__telemetry.mjs +0 -2
- package/dist/client-C6Qp5ujC-Dxb7r79B.mjs +0 -1653
- package/dist/client-C6Qp5ujC-Dxb7r79B.mjs.map +0 -1
- package/dist/code-templates-C-jirr19-DDQB0WGo.mjs +0 -295
- package/dist/code-templates-C-jirr19-DDQB0WGo.mjs.map +0 -1
- package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs +0 -65
- package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs.map +0 -1
- package/dist/command-helpers-BCgwcqTe-lNCtppzM.mjs +0 -776
- package/dist/command-helpers-BCgwcqTe-lNCtppzM.mjs.map +0 -1
- package/dist/contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs +0 -44
- package/dist/contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs.map +0 -1
- package/dist/contract-emit-BG7KL4zk-_a0J310Z.mjs +0 -331
- package/dist/contract-emit-BG7KL4zk-_a0J310Z.mjs.map +0 -1
- package/dist/contract-emit-BkEj3siG-C8M-IyvS.mjs +0 -2
- package/dist/contract-emit-CvwNE4R1-DEn1V1Zo.d.mts +0 -7
- package/dist/contract-emit-CvwNE4R1-DEn1V1Zo.d.mts.map +0 -1
- package/dist/contract-emit-GknCmgn_-BSWdFprC.mjs +0 -154
- package/dist/contract-emit-GknCmgn_-BSWdFprC.mjs.map +0 -1
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +0 -56
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +0 -1
- package/dist/contract-infer-BwIDGl7v-CZrdWXAr.mjs +0 -74
- package/dist/contract-infer-BwIDGl7v-CZrdWXAr.mjs.map +0 -1
- package/dist/contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs +0 -82
- package/dist/contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs +0 -303
- package/dist/contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs.map +0 -1
- package/dist/db-init-BolXrKAI-CwG-zEDW.mjs +0 -109
- package/dist/db-init-BolXrKAI-CwG-zEDW.mjs.map +0 -1
- package/dist/db-init-failure-B5cQML4A-5zr-99Ek.mjs +0 -44
- package/dist/db-init-failure-B5cQML4A-5zr-99Ek.mjs.map +0 -1
- package/dist/db-schema-DvdLBdEY-Dl6e1d_Y.mjs +0 -48
- package/dist/db-schema-DvdLBdEY-Dl6e1d_Y.mjs.map +0 -1
- package/dist/db-sign-DCp4c8CA-B3tun-kh.mjs +0 -172
- package/dist/db-sign-DCp4c8CA-B3tun-kh.mjs.map +0 -1
- package/dist/db-update-CfayE8WE-CPhQyDaZ.mjs +0 -171
- package/dist/db-update-CfayE8WE-CPhQyDaZ.mjs.map +0 -1
- package/dist/db-verify-BN7IrOAL-kEzRNJUl.mjs +0 -358
- package/dist/db-verify-BN7IrOAL-kEzRNJUl.mjs.map +0 -1
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +0 -1
- package/dist/domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs.map +0 -1
- package/dist/errors-CXbGUWGu-BQi6YS-H.mjs.map +0 -1
- package/dist/exports-B3xY_FHp.mjs.map +0 -1
- package/dist/exports-BCLg4CiV-05kuwcb0.mjs +0 -160
- package/dist/exports-BCLg4CiV-05kuwcb0.mjs.map +0 -1
- package/dist/exports-BZLNbtkY.mjs.map +0 -1
- package/dist/exports-CqNUihkI.mjs +0 -276
- package/dist/exports-CqNUihkI.mjs.map +0 -1
- package/dist/format-Ca7dUE6B-BMFqrc6D.mjs +0 -110
- package/dist/format-Ca7dUE6B-BMFqrc6D.mjs.map +0 -1
- package/dist/framework-components-Bau7o1-J-DTp6AUoq.mjs +0 -60
- package/dist/framework-components-Bau7o1-J-DTp6AUoq.mjs.map +0 -1
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +0 -35
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +0 -1
- package/dist/import-roots-NDOIEDVj.mjs.map +0 -1
- package/dist/index-CnOyYxmv.d.mts.map +0 -1
- package/dist/index-mCsi_ND5.d.mts.map +0 -1
- package/dist/init-DC7zPKka-BSiUrPw3.mjs +0 -800
- package/dist/init-DC7zPKka-BSiUrPw3.mjs.map +0 -1
- package/dist/inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs +0 -95
- package/dist/inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs.map +0 -1
- package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs +0 -115
- package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs.map +0 -1
- package/dist/invariants-Bltd8DyA-Cg_1Lu0q.mjs +0 -53
- package/dist/invariants-Bltd8DyA-Cg_1Lu0q.mjs.map +0 -1
- package/dist/legend-DGv9e2_0-BtetgRz4.mjs +0 -22
- package/dist/legend-DGv9e2_0-BtetgRz4.mjs.map +0 -1
- package/dist/migrate-BXATUjYE-Do79Imf-.mjs +0 -343
- package/dist/migrate-BXATUjYE-Do79Imf-.mjs.map +0 -1
- package/dist/migrate-failure-D4NvkoCk-0bttmQs2.mjs +0 -96
- package/dist/migrate-failure-D4NvkoCk-0bttmQs2.mjs.map +0 -1
- package/dist/migrate-show-B8UJ9dmb-C4RTPbDk.d.mts +0 -63
- package/dist/migrate-show-B8UJ9dmb-C4RTPbDk.d.mts.map +0 -1
- package/dist/migrate-show-C_9xR4Qt-B-Y0PGKw.mjs +0 -199
- package/dist/migrate-show-C_9xR4Qt-B-Y0PGKw.mjs.map +0 -1
- package/dist/migration-check-Bbdw7t-r-C2VTMK61.mjs +0 -358
- package/dist/migration-check-Bbdw7t-r-C2VTMK61.mjs.map +0 -1
- package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs +0 -163
- package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs.map +0 -1
- package/dist/migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs +0 -121
- package/dist/migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs.map +0 -1
- package/dist/migration-graph-B8WxW_tm-qGNf7jQh.mjs +0 -35
- package/dist/migration-graph-B8WxW_tm-qGNf7jQh.mjs.map +0 -1
- package/dist/migration-graph-BOwu76mF-kOTWFvfV.mjs +0 -144
- package/dist/migration-graph-BOwu76mF-kOTWFvfV.mjs.map +0 -1
- package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs +0 -2127
- package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map +0 -1
- package/dist/migration-graph-sections-BBHPOFN--COKyUKQ4.mjs +0 -69
- package/dist/migration-graph-sections-BBHPOFN--COKyUKQ4.mjs.map +0 -1
- package/dist/migration-list-CKuYcMQq-CubZzE9i.mjs +0 -130
- package/dist/migration-list-CKuYcMQq-CubZzE9i.mjs.map +0 -1
- package/dist/migration-list-CY08bD8I-PoXuv94c.mjs +0 -102
- package/dist/migration-list-CY08bD8I-PoXuv94c.mjs.map +0 -1
- package/dist/migration-log-CUbGla-9-BLIrWjwN.mjs +0 -123
- package/dist/migration-log-CUbGla-9-BLIrWjwN.mjs.map +0 -1
- package/dist/migration-log-table-eES9lPjv-BCFm8qJr.mjs +0 -116
- package/dist/migration-log-table-eES9lPjv-BCFm8qJr.mjs.map +0 -1
- package/dist/migration-new-ChvZjf5X-BFhEM0BF.mjs +0 -70
- package/dist/migration-new-ChvZjf5X-BFhEM0BF.mjs.map +0 -1
- package/dist/migration-new-DXMvJdbB-BkrpDfcr.mjs +0 -130
- package/dist/migration-new-DXMvJdbB-BkrpDfcr.mjs.map +0 -1
- package/dist/migration-path-target-JDWqF9kj-B7zoMq6X.mjs +0 -38
- package/dist/migration-path-target-JDWqF9kj-B7zoMq6X.mjs.map +0 -1
- package/dist/migration-plan-BV9f5Xjq-DiyscOMc.d.mts +0 -164
- package/dist/migration-plan-BV9f5Xjq-DiyscOMc.d.mts.map +0 -1
- package/dist/migration-plan-Bz1hOTHF-CFCtPuOv.mjs +0 -192
- package/dist/migration-plan-Bz1hOTHF-CFCtPuOv.mjs.map +0 -1
- package/dist/migration-plan-Cfz0efEL-DMNFq5b2.mjs +0 -621
- package/dist/migration-plan-Cfz0efEL-DMNFq5b2.mjs.map +0 -1
- package/dist/migration-show-BGdR1xnT-Cg3M0FPh.mjs +0 -178
- package/dist/migration-show-BGdR1xnT-Cg3M0FPh.mjs.map +0 -1
- package/dist/migration-status-BIrAJ5af-D-_mMBUA.mjs +0 -427
- package/dist/migration-status-BIrAJ5af-D-_mMBUA.mjs.map +0 -1
- package/dist/output-DP3woAjV-BxCr9nHA.mjs.map +0 -1
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +0 -43
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +0 -1
- package/dist/project-import-root-B4nM-VWX-D__g0hTb.mjs +0 -101
- package/dist/project-import-root-B4nM-VWX-D__g0hTb.mjs.map +0 -1
- package/dist/redact-secrets-DuKoiMax-Cfe2XVhc.mjs +0 -1476
- package/dist/redact-secrets-DuKoiMax-Cfe2XVhc.mjs.map +0 -1
- package/dist/ref-4x6BGSsd-ClaoZIQh.mjs +0 -95
- package/dist/ref-4x6BGSsd-ClaoZIQh.mjs.map +0 -1
- package/dist/ref-WXLIR9Xm-12IUtoBU.mjs +0 -104
- package/dist/ref-WXLIR9Xm-12IUtoBU.mjs.map +0 -1
- package/dist/ref-advancement-DaZBzm7m-WoqnFAyr.mjs +0 -96
- package/dist/ref-advancement-DaZBzm7m-WoqnFAyr.mjs.map +0 -1
- package/dist/ref-resolution-BSN1amKm-C6-TTM2N.mjs +0 -16
- package/dist/ref-resolution-BSN1amKm-C6-TTM2N.mjs.map +0 -1
- package/dist/ref-resolution-COGOSL57.d.mts.map +0 -1
- package/dist/ref-resolution-sGcINe7o.mjs.map +0 -1
- package/dist/refs-WK86uYYp-B6EZkmmT.mjs.map +0 -1
- package/dist/refs-fQLFcMoq-aTBeUU9H.mjs +0 -47
- package/dist/refs-fQLFcMoq-aTBeUU9H.mjs.map +0 -1
- package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts +0 -206
- package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts.map +0 -1
- package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs +0 -119
- package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs.map +0 -1
- package/dist/shells-BenrJHp2.mjs.map +0 -1
- package/dist/shells-COHV_Ozf.d.mts.map +0 -1
- package/dist/spaces-BG2w0P8d.mjs.map +0 -1
- package/dist/telemetry-BD52LETE-Cqeb7ebh.mjs +0 -121
- package/dist/telemetry-BD52LETE-Cqeb7ebh.mjs.map +0 -1
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +0 -133
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +0 -1
- package/dist/terminal-ui-Cqz4LVL7-B0mcVdLy.mjs +0 -676
- package/dist/terminal-ui-Cqz4LVL7-B0mcVdLy.mjs.map +0 -1
- package/dist/verify-Cogr_Fj9-D3lCWA6t.mjs +0 -283
- package/dist/verify-Cogr_Fj9-D3lCWA6t.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { loadConfigForSections } from \"@internal/config-loader\";\nimport { CliStructuredError, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { dirname, join } from \"pathe\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma-next migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma-next.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the project's `prisma-next.config.ts` via the same\n* `loadConfigForSections` the CLI commands use, walking up from the\n* migration file's directory.\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma-next.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma-next.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (CliStructuredError.is(err)) writeStructuredError(ctx.stderr, err);\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationDir = dirname(fileURLToPath(importMetaUrl));\n\tconst configResult = await loadConfigForSections(parsed.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\"\n\t]);\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,cAAc;CACnB;CACA;CACA;AACD;;;;;;;;AAQA,IAAI,uBAAuB,cAAc,QAAQ;CAChD,OAAO,QAAQ,CAAC,QAAQ,OAAO;CAC/B,OAAO,QAAQ,QAAQ,MAAM;EAC5B,aAAa;EACb,SAAS;;;;;EAKT,UAAU;GACT,CAAC,4DAA4D,IAAI;GACjE,CAAC,iCAAiC,cAAc;GAChD,CAAC,iCAAiC,gCAAgC;EACnE;CACD,CAAC;CACD,SAAS,OAAO,QAAQ,aAAa,OAAO,EAAE,aAAa,mDAAmD,CAAC;CAC/G,SAAS,OAAO,OAAO,YAAY,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,GAAG;EAC3B;CACD;CACA,cAAc,KAAK,cAAc,UAAU,GAAG,OAAO;CACrD,cAAc,cAAc,YAAY;CACxC,OAAO,MAAM,sCAAsC,aAAa,GAAG;AACpE;;;;;;;;;AASA,eAAe,aAAa,eAAe,gBAAgB,QAAQ,KAAK;CACvE,MAAM,eAAe,QAAQ,cAAc,aAAa,CAAC;CACzD,MAAM,eAAe,MAAM,sBAAsB,OAAO,QAAQ;EAC/D;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,MAAM,aAAa;CACzC,MAAM,SAAS,aAAa;CAC5B,MAAM,QAAQ,IAAI,eAAe;CACjC,IAAI,MAAM,aAAa,OAAO,OAAO,UAAU,MAAM,6BAA6B;EACjF,mBAAmB,MAAM;EACzB,gBAAgB,OAAO,OAAO;CAC/B,CAAC;CACD,MAAM,yBAAyB,IAAI,eAAe,mBAAmB,MAAM,CAAC,GAAG,cAAc,OAAO,QAAQ,IAAI,MAAM;CACtH,IAAI;AACL"}
|
|
1
|
+
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { CliStructuredError, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { dirname, join } from \"pathe\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the project's `prisma.config.ts` via the same\n* `loadConfigForSections` the CLI commands use, walking up from the\n* migration file's directory.\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (CliStructuredError.is(err)) writeStructuredError(ctx.stderr, err);\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationDir = dirname(fileURLToPath(importMetaUrl));\n\tconst configResult = await loadConfigForSections(parsed.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\"\n\t]);\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,cAAc;CACnB;CACA;CACA;AACD;;;;;;;;AAQA,IAAI,uBAAuB,cAAc,QAAQ;CAChD,OAAO,QAAQ,CAAC,QAAQ,OAAO;CAC/B,OAAO,QAAQ,QAAQ,MAAM;EAC5B,aAAa;EACb,SAAS;;;;;EAKT,UAAU;GACT,CAAC,4DAA4D,IAAI;GACjE,CAAC,iCAAiC,cAAc;GAChD,CAAC,iCAAiC,gCAAgC;EACnE;CACD,CAAC;CACD,SAAS,OAAO,QAAQ,aAAa,OAAO,EAAE,aAAa,mDAAmD,CAAC;CAC/G,SAAS,OAAO,OAAO,YAAY,EAAE,aAAa,2BAA2B,CAAC;;;;;;;;;CAS9E,MAAM,UAAU;EACf,OAAO;CACR;AACD;;;;;;;;;;;;;AAaA,IAAI,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAwBxB,aAAa,IAAI,eAAe,gBAAgB,UAAU,CAAC,GAAG;EAC7D,IAAI,CAAC,eAAe,OAAO;EAC3B,MAAM,OAAO,QAAQ,QAAQ,QAAQ;EACrC,MAAM,SAAS,QAAQ,UAAU,QAAQ;EACzC,MAAM,SAAS,QAAQ,UAAU,QAAQ;EACzC,IAAI,CAAC,mBAAmB,eAAe,IAAI,GAAG,OAAO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Q,IAAI,eAAe;CACjC,IAAI,MAAM,aAAa,OAAO,OAAO,UAAU,MAAM,6BAA6B;EACjF,mBAAmB,MAAM;EACzB,gBAAgB,OAAO,OAAO;CAC/B,CAAC;CACD,MAAM,yBAAyB,IAAI,eAAe,mBAAmB,MAAM,CAAC,GAAG,cAAc,OAAO,QAAQ,IAAI,MAAM;CACtH,IAAI;AACL"}
|
package/dist/config-loader.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as findNearestConfigPathForFile, c as loadConfigForSections, i as finalizeConfig, l as requireConfigSections, n as LoadedConfig, o as loadConfig, r as PrismaNextConfig, s as loadConfigForFile, t as ConfigSection } from "./index-
|
|
1
|
+
import { a as findNearestConfigPathForFile, c as loadConfigForSections, i as finalizeConfig, l as requireConfigSections, n as LoadedConfig, o as loadConfig, r as PrismaNextConfig, s as loadConfigForFile, t as ConfigSection } from "./index-u5RdrumF.mjs";
|
|
2
2
|
export { type ConfigSection, type LoadedConfig, type PrismaNextConfig, finalizeConfig, findNearestConfigPathForFile, loadConfig, loadConfigForFile, loadConfigForSections, requireConfigSections };
|
package/dist/config-loader.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as loadConfigForSections, i as loadConfigForFile, n as findNearestConfigPathForFile, o as requireConfigSections, r as loadConfig, t as finalizeConfig } from "./exports-BXXeNWlj.mjs";
|
|
2
2
|
export { finalizeConfig, findNearestConfigPathForFile, loadConfig, loadConfigForFile, loadConfigForSections, requireConfigSections };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, o as errorContractSnapshotMissing } from "./errors-
|
|
2
|
-
import { join, relative } from "pathe";
|
|
1
|
+
import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, o as errorContractSnapshotMissing } from "./errors-SoLLYLtw-DMxVbVs9.mjs";
|
|
3
2
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
4
|
-
import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
3
|
import { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from "@prisma/orm-framework/components/control";
|
|
4
|
+
import { join, relative } from "pathe";
|
|
5
|
+
import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
7
7
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
8
|
-
//#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-
|
|
8
|
+
//#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-qGrwlGmt.mjs
|
|
9
9
|
const CONTRACT_JSON_FILE = "contract.json";
|
|
10
10
|
const CONTRACT_DTS_FILE = "contract.d.ts";
|
|
11
11
|
function hasErrnoCode(error, code) {
|
|
@@ -115,4 +115,4 @@ function snapshotsImportPathFrom(packageDir, migrationsDir) {
|
|
|
115
115
|
//#endregion
|
|
116
116
|
export { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, readContractSnapshotDts as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };
|
|
117
117
|
|
|
118
|
-
//# sourceMappingURL=contract-snapshot-store-
|
|
118
|
+
//# sourceMappingURL=contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-snapshot-store-
|
|
1
|
+
{"version":3,"file":"contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-qGrwlGmt.mjs"],"sourcesContent":["import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, o as errorContractSnapshotMissing } from \"./errors-SoLLYLtw.mjs\";\nimport { join, relative } from \"pathe\";\nimport { mkdir, readFile, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from \"@internal/framework-components/control\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/contract-snapshot-store.ts\nconst CONTRACT_JSON_FILE = \"contract.json\";\nconst CONTRACT_DTS_FILE = \"contract.d.ts\";\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && blindCast(error).code === code;\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\nfunction contractSnapshotDir(migrationsDir, storageHash) {\n\treturn join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex(storageHash));\n}\nasync function writeContractSnapshot(migrationsDir, storageHash, input) {\n\tconst dir = contractSnapshotDir(migrationsDir, storageHash);\n\tconst actualStorageHash = blindCast(input.contractJson).storage?.storageHash;\n\tif (actualStorageHash !== storageHash) throw errorContractSnapshotHashMismatch(storageHash, typeof actualStorageHash === \"string\" ? actualStorageHash : String(actualStorageHash), dir);\n\tif (await directoryExists(dir)) return {\n\t\twritten: false,\n\t\tdir\n\t};\n\tconst tmpDir = join(join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME), `.tmp-${storageHashHex(storageHash)}-${Date.now()}-${randomBytes(4).toString(\"hex\")}`);\n\tawait mkdir(tmpDir, { recursive: true });\n\tconst jsonContent = `${canonicalizeJson(input.contractJson)}\\n`;\n\tconst dtsContent = input.contractDts.endsWith(\"\\n\") ? input.contractDts : `${input.contractDts}\\n`;\n\ttry {\n\t\tawait writeFile(join(tmpDir, CONTRACT_JSON_FILE), jsonContent);\n\t\tawait writeFile(join(tmpDir, CONTRACT_DTS_FILE), dtsContent);\n\t\tawait rename(tmpDir, dir);\n\t} catch (error) {\n\t\tawait rm(tmpDir, {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tif (hasErrnoCode(error, \"EEXIST\") || hasErrnoCode(error, \"ENOTEMPTY\")) return {\n\t\t\twritten: false,\n\t\t\tdir\n\t\t};\n\t\tthrow error;\n\t}\n\treturn {\n\t\twritten: true,\n\t\tdir\n\t};\n}\nasync function readContractSnapshotJson(migrationsDir, storageHash) {\n\tconst jsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorContractSnapshotMissing(storageHash, jsonPath);\n\t\tthrow error;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(jsonPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Tolerant read: a missing store entry (ENOENT), an unparseable\n* `contract.json`, the JSON literal `null`, or a `storageHash` that isn't a\n* well-formed 64-hex value all resolve to `undefined` rather than\n* throwing — parity with the catch-all tolerance of the pre-store\n* `readEndContractJson` (`io.ts`), which never validated the hash it was\n* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-\n* unreadable file) propagates rather than silently loading a contract-less\n* package.\n*/\nasync function readContractSnapshotJsonTolerant(migrationsDir, storageHash) {\n\tlet jsonPath;\n\ttry {\n\t\tjsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\t} catch {\n\t\treturn;\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return;\n\t\tthrow error;\n\t}\n\ttry {\n\t\tconst parsed = JSON.parse(raw);\n\t\treturn parsed === null ? void 0 : parsed;\n\t} catch {\n\t\treturn;\n\t}\n}\nasync function readContractSnapshotDts(migrationsDir, storageHash) {\n\tconst dtsPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_DTS_FILE);\n\ttry {\n\t\treturn await readFile(dtsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorContractSnapshotMissing(storageHash, dtsPath);\n\t\tthrow error;\n\t}\n}\nfunction snapshotsImportPathFrom(packageDir, migrationsDir) {\n\treturn relative(packageDir, join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME)).split(\"\\\\\").join(\"/\");\n}\n//#endregion\nexport { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, readContractSnapshotDts as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };\n\n//# sourceMappingURL=contract-snapshot-store-qGrwlGmt.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,UAAU,KAAK,CAAC,CAAC,SAAS;AAC5D;AACA,eAAe,gBAAgB,GAAG;CACjC,IAAI;EACH,QAAQ,MAAM,KAAK,CAAC,EAAA,CAAG,YAAY;CACpC,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,OAAO;EAC1C,MAAM;CACP;AACD;AACA,SAAS,oBAAoB,eAAe,aAAa;CACxD,OAAO,KAAK,eAAe,4BAA4B,eAAe,WAAW,CAAC;AACnF;AACA,eAAe,sBAAsB,eAAe,aAAa,OAAO;CACvE,MAAM,MAAM,oBAAoB,eAAe,WAAW;CAC1D,MAAM,oBAAoB,UAAU,MAAM,YAAY,CAAC,CAAC,SAAS;CACjE,IAAI,sBAAsB,aAAa,MAAM,kCAAkC,aAAa,OAAO,sBAAsB,WAAW,oBAAoB,OAAO,iBAAiB,GAAG,GAAG;CACtL,IAAI,MAAM,gBAAgB,GAAG,GAAG,OAAO;EACtC,SAAS;EACT;CACD;CACA,MAAM,SAAS,KAAK,KAAK,eAAe,0BAA0B,GAAG,QAAQ,eAAe,WAAW,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,YAAY,CA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AM;CACP;CACA,IAAI;EACH,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,OAAO,WAAW,OAAO,KAAK,IAAI;CACnC,QAAQ;EACP;CACD;AACD;AACA,eAAe,wBAAwB,eAAe,aAAa;CAClE,MAAM,UAAU,KAAK,oBAAoB,eAAe,WAAW,GAAG,iBAAiB;CACvF,IAAI;EACH,OAAO,MAAM,SAAS,SAAS,OAAO;CACvC,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,6BAA6B,aAAa,OAAO;EAC1F,MAAM;CACP;AACD;AACA,SAAS,wBAAwB,YAAY,eAAe;CAC3D,OAAO,SAAS,YAAY,KAAK,eAAe,0BAA0B,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;AAClG"}
|
|
@@ -1,89 +1,16 @@
|
|
|
1
|
-
import "./ref-resolution-
|
|
1
|
+
import "./ref-resolution-CaHQJXE0.mjs";
|
|
2
2
|
import { CliStructuredError as CliStructuredError$2 } from "@prisma/orm-framework/errors/control";
|
|
3
|
-
import "@prisma/orm-framework/errors/execution";
|
|
4
|
-
import "@prisma/orm-framework/errors/migration";
|
|
5
|
-
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
6
3
|
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
7
4
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
8
|
-
import {
|
|
5
|
+
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
6
|
+
import "@prisma/orm-framework/errors/execution";
|
|
7
|
+
import "@prisma/orm-framework/errors/migration";
|
|
9
8
|
import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
10
9
|
import "@prisma/cli-engine/protocol";
|
|
10
|
+
import { ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
11
11
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
12
12
|
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
13
|
-
//#region ../../../1-framework/3-tooling/cli/dist/
|
|
14
|
-
//#region src/control-api/operations/db-verify.d.ts
|
|
15
|
-
/**
|
|
16
|
-
* Inputs for the aggregate `db verify` operation.
|
|
17
|
-
*
|
|
18
|
-
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
19
|
-
* boundary) builds a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate};
|
|
20
|
-
* the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
|
|
21
|
-
* (each contract space verified against the full schema; extras stripped to its own view).
|
|
22
|
-
* `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
|
|
23
|
-
*/
|
|
24
|
-
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
25
|
-
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
26
|
-
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
27
|
-
readonly contract: Contract;
|
|
28
|
-
readonly migrationsDir: string;
|
|
29
|
-
readonly targetId: TTargetId;
|
|
30
|
-
readonly extensions: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
31
|
-
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
32
|
-
readonly mode: 'strict' | 'lenient';
|
|
33
|
-
readonly skipSchema: boolean;
|
|
34
|
-
readonly skipMarker: boolean;
|
|
35
|
-
readonly onProgress?: OnControlProgress;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Result of the aggregate verify operation.
|
|
39
|
-
*
|
|
40
|
-
* Marker drift keeps the envelope shape the legacy
|
|
41
|
-
* `runContractSpaceVerifierMarkerCheck` emitted, but rides the success value
|
|
42
|
-
* as {@link ExecuteDbVerifySuccess.markerDrift}: the check ran to completion,
|
|
43
|
-
* so drift is a finding for the caller to settle, not a failure to run.
|
|
44
|
-
*
|
|
45
|
-
* On success, the per-space verify results are returned for the CLI to
|
|
46
|
-
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
47
|
-
* is empty.
|
|
48
|
-
*/
|
|
49
|
-
interface ExecuteDbVerifySuccess {
|
|
50
|
-
readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult>;
|
|
51
|
-
/**
|
|
52
|
-
* Live element names no contract space declares, deduplicated and reported
|
|
53
|
-
* once for the whole database (never per space). Strict mode fails on a
|
|
54
|
-
* non-empty list; lenient mode surfaces it informationally.
|
|
55
|
-
*/
|
|
56
|
-
readonly unclaimed: readonly string[];
|
|
57
|
-
readonly spaceOrder: readonly string[];
|
|
58
|
-
readonly appSpaceId: string;
|
|
59
|
-
/**
|
|
60
|
-
* Per-space marker drift the verifier found — a hash mismatch, missing
|
|
61
|
-
* invariants, an orphan marker row — as the violation envelope. The check
|
|
62
|
-
* completed and this is its verdict, so it rides the success value: callers
|
|
63
|
-
* settle it as a finding, while the failure lane stays reserved for a check
|
|
64
|
-
* that could not run (loader violations, introspection failure).
|
|
65
|
-
*/
|
|
66
|
-
readonly markerDrift: CliStructuredError$2 | null;
|
|
67
|
-
}
|
|
68
|
-
type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$2>;
|
|
69
|
-
/**
|
|
70
|
-
* Loader → verifier pipeline shared by `db verify` modes (`full`,
|
|
71
|
-
* `marker-only`, `schema-only`).
|
|
72
|
-
*
|
|
73
|
-
* 1. **Load**: build a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate}
|
|
74
|
-
* from descriptors + on-disk on-disk artefacts. Layout / drift /
|
|
75
|
-
* integrity / disjointness violations short-circuit with a
|
|
76
|
-
* structured CLI error.
|
|
77
|
-
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
78
|
-
* schema introspection.
|
|
79
|
-
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
80
|
-
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
81
|
-
* then scoped to its own contract space). Marker drift is returned as the
|
|
82
|
-
* success value's `markerDrift` envelope for callers to settle as a
|
|
83
|
-
* finding. Verify results are returned to the caller verbatim.
|
|
84
|
-
*/
|
|
85
|
-
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
86
|
-
//#endregion
|
|
13
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-verify-Yih5kWtB.d.mts
|
|
87
14
|
//#region src/control-api/types.d.ts
|
|
88
15
|
/**
|
|
89
16
|
* Options for creating a control client.
|
|
@@ -720,7 +647,7 @@ type MigrateResult = Result<MigrateSuccess, MigrateFailure>;
|
|
|
720
647
|
* Options for the standalone executeContractEmit function.
|
|
721
648
|
*
|
|
722
649
|
* `executeContractEmit` is the canonical publication path for both the
|
|
723
|
-
* `prisma
|
|
650
|
+
* `prisma contract emit` CLI command and the `@internal/vite-plugin-contract-emit`
|
|
724
651
|
* Vite plugin. Do not duplicate the load → emit → publish dance elsewhere; if a
|
|
725
652
|
* caller needs additional behavior, extend this options shape and update the
|
|
726
653
|
* single implementation rather than building a parallel publication path.
|
|
@@ -734,7 +661,7 @@ interface ContractEmitOptions {
|
|
|
734
661
|
/** Directory the caller was invoked from. */
|
|
735
662
|
readonly cwd: string;
|
|
736
663
|
/**
|
|
737
|
-
* Path to the prisma
|
|
664
|
+
* Path to the prisma.config.ts file. Used to find the project manifest
|
|
738
665
|
* whose dependencies decide the import specifiers in emitted files; the
|
|
739
666
|
* config itself is never read from it. Omit it and the manifest is looked up
|
|
740
667
|
* from the directory the artifacts are written to, which is the package that
|
|
@@ -782,7 +709,7 @@ interface ContractEmitResult {
|
|
|
782
709
|
readonly validationWarning?: string;
|
|
783
710
|
}
|
|
784
711
|
/**
|
|
785
|
-
* Programmatic control client for Prisma
|
|
712
|
+
* Programmatic control client for Prisma ORM operations.
|
|
786
713
|
*
|
|
787
714
|
* Lifecycle: `connect(connection)` before operations, `close()` when done.
|
|
788
715
|
* Both `init()` and `connect()` are auto-called by operations if needed,
|
|
@@ -959,5 +886,78 @@ interface ControlClient {
|
|
|
959
886
|
emit(options: EmitOptions): Promise<EmitResult>;
|
|
960
887
|
}
|
|
961
888
|
//#endregion
|
|
962
|
-
|
|
963
|
-
|
|
889
|
+
//#region src/control-api/operations/db-verify.d.ts
|
|
890
|
+
/**
|
|
891
|
+
* Inputs for the aggregate `db verify` operation.
|
|
892
|
+
*
|
|
893
|
+
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
894
|
+
* boundary) builds a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate};
|
|
895
|
+
* the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
|
|
896
|
+
* (each contract space verified against the full schema; extras stripped to its own view).
|
|
897
|
+
* `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
|
|
898
|
+
*/
|
|
899
|
+
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
900
|
+
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
901
|
+
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
902
|
+
readonly contract: Contract;
|
|
903
|
+
readonly migrationsDir: string;
|
|
904
|
+
readonly targetId: TTargetId;
|
|
905
|
+
readonly extensions: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
906
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
907
|
+
readonly mode: 'strict' | 'lenient';
|
|
908
|
+
readonly skipSchema: boolean;
|
|
909
|
+
readonly skipMarker: boolean;
|
|
910
|
+
readonly onProgress?: OnControlProgress;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Result of the aggregate verify operation.
|
|
914
|
+
*
|
|
915
|
+
* Marker drift keeps the envelope shape the legacy
|
|
916
|
+
* `runContractSpaceVerifierMarkerCheck` emitted, but rides the success value
|
|
917
|
+
* as {@link ExecuteDbVerifySuccess.markerDrift}: the check ran to completion,
|
|
918
|
+
* so drift is a finding for the caller to settle, not a failure to run.
|
|
919
|
+
*
|
|
920
|
+
* On success, the per-space verify results are returned for the CLI to
|
|
921
|
+
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
922
|
+
* is empty.
|
|
923
|
+
*/
|
|
924
|
+
interface ExecuteDbVerifySuccess {
|
|
925
|
+
readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult>;
|
|
926
|
+
/**
|
|
927
|
+
* Live element names no contract space declares, deduplicated and reported
|
|
928
|
+
* once for the whole database (never per space). Strict mode fails on a
|
|
929
|
+
* non-empty list; lenient mode surfaces it informationally.
|
|
930
|
+
*/
|
|
931
|
+
readonly unclaimed: readonly string[];
|
|
932
|
+
readonly spaceOrder: readonly string[];
|
|
933
|
+
readonly appSpaceId: string;
|
|
934
|
+
/**
|
|
935
|
+
* Per-space marker drift the verifier found — a hash mismatch, missing
|
|
936
|
+
* invariants, an orphan marker row — as the violation envelope. The check
|
|
937
|
+
* completed and this is its verdict, so it rides the success value: callers
|
|
938
|
+
* settle it as a finding, while the failure lane stays reserved for a check
|
|
939
|
+
* that could not run (loader violations, introspection failure).
|
|
940
|
+
*/
|
|
941
|
+
readonly markerDrift: CliStructuredError$2 | null;
|
|
942
|
+
}
|
|
943
|
+
type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$2>;
|
|
944
|
+
/**
|
|
945
|
+
* Loader → verifier pipeline shared by `db verify` modes (`full`,
|
|
946
|
+
* `marker-only`, `schema-only`).
|
|
947
|
+
*
|
|
948
|
+
* 1. **Load**: build a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate}
|
|
949
|
+
* from descriptors + on-disk on-disk artefacts. Layout / drift /
|
|
950
|
+
* integrity / disjointness violations short-circuit with a
|
|
951
|
+
* structured CLI error.
|
|
952
|
+
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
953
|
+
* schema introspection.
|
|
954
|
+
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
955
|
+
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
956
|
+
* then scoped to its own contract space). Marker drift is returned as the
|
|
957
|
+
* success value's `markerDrift` envelope for callers to settle as a
|
|
958
|
+
* finding. Verify results are returned to the caller verbatim.
|
|
959
|
+
*/
|
|
960
|
+
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
961
|
+
//#endregion
|
|
962
|
+
export { SchemaVerifyOptions as A, EmitResult as C, IntrospectOptions as D, ExecuteDbVerifyResult as E, VerifyOptions as M, executeDbVerify as N, MigrateResult as O, EmitOptions as S, ExecuteDbVerifyOptions as T, DbUpdateResult as _, ControlClient as a, EmitFailure as b, CreateControlClient as c, DbInitOptions as d, DbInitResult as f, DbUpdateOptions as g, DbUpdateFailureCode as h, ControlActionName as i, SignOptions as j, OnControlProgress as k, DbInitFailure as l, DbUpdateFailure as m, ContractEmitOptions as n, ControlClientOptions as o, DbInitSuccess as p, ContractEmitResult as r, ControlProgressEvent as s, CliStructuredError$2 as t, DbInitFailureCode as u, DbUpdateSuccess as v, EmitSuccess as w, EmitFailureCode as x, EmitContractConfig as y };
|
|
963
|
+
//# sourceMappingURL=db-verify-Yih5kWtB-B1kv76ec.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-verify-Y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AQR;;;;;;;;;;;;EAYA,QAAQ,uBAAuB;;;;;;EAM/B,SAAS;;;;;;;;EAQT,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;;EAQxC,aAAa,SAAS,sBAAsB,QAAQ;;;;;;;;;EASpD,KAAK,SAAS,cAAc,QAAQ;;;;;;;;;EASpC,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;;;;EAUxC,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;;;;;;;;EAc5C,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;EAO5C,cAAc,QAAQ;;;;;;EAMtB,kBAAkB,QAAQ,oBAAoB;;;;;;EAM9C,WAAW,iBAAiB,iBAAiB;;;;;;;;;;;;;;EAc7C,QAAQ,SAAS,iBAAiB,QAAQ;;;;;;;EAO1C,WAAW,UAAU,oBAAoB;;;;;;;;EAQzC,aAAa,oBAAoB;;;;;;;;EAQjC,iBAAiB,oBAAoB;;;;;;;;EAQrC,0BAA0B;;;;;;;;;EAS1B,mBAAmB,qBAAqB,2BAA2B;;;;;;;;EAQnE,KAAK,SAAS,cAAc,QAAQ;;;;;;;;;;;;;UAa5B,uBAAuB,0BAA0B;WAChD,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;WACtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E;WACA;WACA;WACA,aAAa;;;;;;;;;;;;;;UAcd;WACC,eAAe,oBAAoB;;;;;;WAMnC;WACA;WACA;;;;;;;;WAQA,aAAa;;KAEnB,wBAAwB,OAAO,wBAAwB;;;;;;;;;;;;;;;;;iBAiB3C,gBAAgB,0BAA0B,0BAA0B,SAAS,uBAAuB,WAAW,aAAa,QAAQ"}
|
|
@@ -3,7 +3,7 @@ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
|
3
3
|
import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
4
4
|
import { renderImports, tsStringLiteral } from "@prisma/orm-framework/ts-render";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
|
-
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-
|
|
6
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-CR9ECUau.mjs
|
|
7
7
|
function emitterError(code, message, options) {
|
|
8
8
|
return structuredError(code, message, options);
|
|
9
9
|
}
|
|
@@ -66,6 +66,7 @@ function generateModelRelationsType(relations) {
|
|
|
66
66
|
const parts = [];
|
|
67
67
|
if (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);
|
|
68
68
|
if (relObj["cardinality"]) parts.push(`readonly cardinality: ${serializeValue(relObj["cardinality"])}`);
|
|
69
|
+
if (typeof relObj["nullable"] === "boolean") parts.push(`readonly nullable: ${relObj["nullable"]}`);
|
|
69
70
|
const on = relObj["on"];
|
|
70
71
|
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
72
|
if (on?.localFields && on.targetFields) {
|
|
@@ -222,11 +223,26 @@ function resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueS
|
|
|
222
223
|
function generateFieldResolvedType(field, codecLookup, side = "output") {
|
|
223
224
|
return resolveFieldType(field, codecLookup)[side];
|
|
224
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Resolves one model field's input and output types the way `FieldOutputTypes` /
|
|
228
|
+
* `FieldInputTypes` do: inline type params win over the family resolver, and a family-resolved
|
|
229
|
+
* value set renders as a literal union.
|
|
230
|
+
*/
|
|
231
|
+
function resolveModelFieldType(modelName, fieldName, field, model, resolvers) {
|
|
232
|
+
const resolvedTypeParams = (field.type.kind === "scalar" && field.type.typeParams && Object.keys(field.type.typeParams).length > 0 ? field.type.typeParams : void 0) ?? resolvers.resolveFieldTypeParams?.(modelName, fieldName, model);
|
|
233
|
+
const resolvedValueSet = resolvers.resolveFieldValueSet?.(modelName, fieldName, model);
|
|
234
|
+
return resolveFieldType(field, resolvers.codecLookup, resolvedTypeParams, resolvedValueSet);
|
|
235
|
+
}
|
|
225
236
|
function generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams, resolveFieldValueSet) {
|
|
226
237
|
if (!models || Object.keys(models).length === 0) return {
|
|
227
238
|
output: "Record<string, never>",
|
|
228
239
|
input: "Record<string, never>"
|
|
229
240
|
};
|
|
241
|
+
const resolvers = {
|
|
242
|
+
codecLookup,
|
|
243
|
+
resolveFieldTypeParams,
|
|
244
|
+
resolveFieldValueSet
|
|
245
|
+
};
|
|
230
246
|
const outputModelEntries = [];
|
|
231
247
|
const inputModelEntries = [];
|
|
232
248
|
for (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {
|
|
@@ -234,9 +250,7 @@ function generateBothFieldTypesMaps(models, codecLookup, resolveFieldTypeParams,
|
|
|
234
250
|
const outputFieldEntries = [];
|
|
235
251
|
const inputFieldEntries = [];
|
|
236
252
|
for (const [fieldName, field] of Object.entries(model.fields)) {
|
|
237
|
-
const
|
|
238
|
-
const resolvedValueSet = resolveFieldValueSet?.(modelName, fieldName, model);
|
|
239
|
-
const resolved = resolveFieldType(field, codecLookup, resolvedTypeParams, resolvedValueSet);
|
|
253
|
+
const resolved = resolveModelFieldType(modelName, fieldName, field, model, resolvers);
|
|
240
254
|
const key = `readonly ${serializeObjectKey(fieldName)}`;
|
|
241
255
|
outputFieldEntries.push(`${key}: ${resolved.output}`);
|
|
242
256
|
inputFieldEntries.push(`${key}: ${resolved.input}`);
|
|
@@ -329,6 +343,6 @@ function generateValueObjectTypeAliases(valueObjects, codecLookup) {
|
|
|
329
343
|
return aliases.join("\n");
|
|
330
344
|
}
|
|
331
345
|
//#endregion
|
|
332
|
-
export {
|
|
346
|
+
export { resolveValueObjectType as C, serializeObjectKey as D, serializeNamespaceId as E, serializeValue as O, resolveModelFieldType as S, serializeExecutionType 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, serializeCrossReference as w, resolveFieldType as x, generateValueObjectsDescriptorType as y };
|
|
333
347
|
|
|
334
|
-
//# sourceMappingURL=domain-type-generation-
|
|
348
|
+
//# sourceMappingURL=domain-type-generation-CR9ECUau-DOlKbcaE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-CR9ECUau-DOlKbcaE.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-CR9ECUau.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, tsStringLiteral } 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 tsStringLiteral(value);\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\tif (typeof relObj[\"nullable\"] === \"boolean\") parts.push(`readonly nullable: ${relObj[\"nullable\"]}`);\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 ${serializeObjectKey(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<${serializeValue(hashes.executionHash)}>` : \"ExecutionHashBase<string>\";\n\treturn [\n\t\t`export type StorageHash = StorageHashBase<${serializeValue(hashes.storageHash)}>;`,\n\t\t`export type ExecutionHash = ${executionHashType};`,\n\t\t`export type ProfileHash = ProfileHashBase<${serializeValue(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}\n/**\n* Resolves one model field's input and output types the way `FieldOutputTypes` /\n* `FieldInputTypes` do: inline type params win over the family resolver, and a family-resolved\n* value set renders as a literal union.\n*/\nfunction resolveModelFieldType(modelName, fieldName, field, model, resolvers) {\n\tconst resolvedTypeParams = (field.type.kind === \"scalar\" && field.type.typeParams && Object.keys(field.type.typeParams).length > 0 ? field.type.typeParams : void 0) ?? resolvers.resolveFieldTypeParams?.(modelName, fieldName, model);\n\tconst resolvedValueSet = resolvers.resolveFieldValueSet?.(modelName, fieldName, model);\n\treturn resolveFieldType(field, resolvers.codecLookup, resolvedTypeParams, resolvedValueSet);\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 resolvers = {\n\t\tcodecLookup,\n\t\tresolveFieldTypeParams,\n\t\tresolveFieldValueSet\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 resolved = resolveModelFieldType(modelName, fieldName, field, model, resolvers);\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 { serializeCrossReference as C, serializeValue as D, serializeObjectKey as E, emitterError as O, resolveValueObjectType as S, serializeNamespaceId 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, serializeExecutionType as w, resolveModelFieldType as x, renderValueSetType as y };\n\n//# sourceMappingURL=domain-type-generation-CR9ECUau.mjs.map"],"mappings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AI,EAAE;AAClC;AACA,SAAS,+BAA+B,cAAc,aAAa;CAClE,IAAI,CAAC,gBAAgB,OAAO,KAAK,YAAY,CAAC,CAAC,WAAW,GAAG,OAAO;CACpE,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,QAAQ,OAAO,OAAO,QAAQ,YAAY,GAAG;EACxD,MAAM,WAAW,uBAAuB,QAAQ,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
2
2
|
import { ContractField, ContractModelBase, ContractValueObject, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
3
3
|
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
4
|
-
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-X6-AaL1U.d.mts
|
|
5
5
|
//#region src/domain-type-generation.d.ts
|
|
6
6
|
declare function serializeValue(value: unknown): string;
|
|
7
7
|
declare function serializeObjectKey(key: string): string;
|
|
@@ -49,6 +49,17 @@ type FieldValueSetResolver = (modelName: string, fieldName: string, model: Contr
|
|
|
49
49
|
declare function renderValueSetType(values: readonly JsonValue[], codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
|
|
50
50
|
declare function resolveFieldType(field: ContractField, codecLookup?: CodecLookup, resolvedTypeParams?: Record<string, unknown>, resolvedValueSet?: ResolvedFieldValueSet): ResolvedFieldType;
|
|
51
51
|
declare function generateFieldResolvedType(field: ContractField, codecLookup?: CodecLookup, side?: 'input' | 'output'): string;
|
|
52
|
+
type ModelFieldTypeResolvers = {
|
|
53
|
+
readonly codecLookup: CodecLookup | undefined;
|
|
54
|
+
readonly resolveFieldTypeParams: FieldTypeParamsResolver | undefined;
|
|
55
|
+
readonly resolveFieldValueSet: FieldValueSetResolver | undefined;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolves one model field's input and output types the way `FieldOutputTypes` /
|
|
59
|
+
* `FieldInputTypes` do: inline type params win over the family resolver, and a family-resolved
|
|
60
|
+
* value set renders as a literal union.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveModelFieldType(modelName: string, fieldName: string, field: ContractField, model: ContractModelBase, resolvers: ModelFieldTypeResolvers): ResolvedFieldType;
|
|
52
63
|
declare function generateBothFieldTypesMaps(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
53
64
|
declare function generateFieldTypesMapsByNamespace(namespaceModels: ReadonlyArray<readonly [string, Record<string, ContractModelBase>]>, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
54
65
|
declare function generateFieldOutputTypesMap(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver): string;
|
|
@@ -59,5 +70,5 @@ declare function generateContractFieldDescriptor(fieldName: string, field: Contr
|
|
|
59
70
|
declare function generateValueObjectsDescriptorType(valueObjects: Record<string, ContractValueObject> | undefined): string;
|
|
60
71
|
declare function generateValueObjectTypeAliases(valueObjects: Record<string, ContractValueObject> | undefined, codecLookup?: CodecLookup): string;
|
|
61
72
|
//#endregion
|
|
62
|
-
export {
|
|
63
|
-
//# sourceMappingURL=domain-type-generation-
|
|
73
|
+
export { serializeNamespaceId as A, generateValueObjectsDescriptorType as C, resolveValueObjectType as D, resolveModelFieldType as E, serializeValue as M, serializeCrossReference as O, generateValueObjectTypeAliases as S, resolveFieldType as T, generateModelFieldsType as _, ResolvedFieldValueSet as a, generateRootsType as b, generateCodecTypeIntersection as c, generateFieldOutputTypesMap as d, generateFieldResolvedType as f, generateModelFieldEntry as g, generateImportLines as h, ResolvedFieldType as i, serializeObjectKey as j, serializeExecutionType as k, generateContractFieldDescriptor as l, generateHashTypeAliases as m, FieldValueSetResolver as n, deduplicateImports as o, generateFieldTypesMapsByNamespace as p, ModelFieldTypeResolvers as r, generateBothFieldTypesMaps as s, FieldTypeParamsResolver as t, generateFieldInputTypesMap as u, generateModelRelationsType as v, renderValueSetType as w, generateValueObjectType as x, generateModelsType as y };
|
|
74
|
+
//# sourceMappingURL=domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-X6-AaL1U.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;KACvF;WACM,aAAa;WACb,wBAAwB;WACxB,sBAAsB;;;;;;;iBAOhB,sBAAsB,mBAAmB,mBAAmB,OAAO,eAAe,OAAO,mBAAmB,WAAW,0BAA0B;iBACjJ,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"}
|
package/dist/emitter.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-
|
|
1
|
+
import { M as serializeValue, b as generateRootsType, c as generateCodecTypeIntersection, d as generateFieldOutputTypesMap, h as generateImportLines, j as serializeObjectKey, m as generateHashTypeAliases, o as deduplicateImports, v as generateModelRelationsType } from "./domain-type-generation-X6-AaL1U-DHEoRf_y.mjs";
|
|
2
|
+
import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-D217lbiW.mjs";
|
|
3
3
|
export { type EmitOptions, type EmitResult, type EmitStackInput, type EmittedArtifactPaths, deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|
package/dist/emitter.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-
|
|
1
|
+
import { D as serializeObjectKey, O as serializeValue, 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-CR9ECUau-DOlKbcaE.mjs";
|
|
2
|
+
import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-CE6OD63o-4Qpqr2W7.mjs";
|
|
3
3
|
export { deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|