@prisma/orm-toolchain 8.0.0-rc.1-dev.44 → 8.0.0-rc.1-dev.46
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 -3
- package/dist/{aggregate-BBsCbXgJ.mjs → aggregate-CPZB020V.mjs} +9 -9
- package/dist/{aggregate-BBsCbXgJ.mjs.map → aggregate-CPZB020V.mjs.map} +1 -1
- package/dist/{aggregate-CA6bJ8UO.d.mts → aggregate-DLUJLq5Y.d.mts} +3 -3
- package/dist/{aggregate-CA6bJ8UO.d.mts.map → aggregate-DLUJLq5Y.d.mts.map} +1 -1
- package/dist/cli-telemetry.d.mts +19 -5
- package/dist/cli-telemetry.d.mts.map +1 -1
- package/dist/cli-telemetry.mjs +287 -8
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +11 -13
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +5382 -1095
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +298 -27
- 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 +9 -9
- 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-B0G1Fw_F-CHc4QfKb.mjs} +4 -4
- package/dist/{contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs.map → contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map} +1 -1
- package/dist/{cli-errors-iquUoY6O-BFboxglv.d.mts → db-verify-BwgNK50T-DGvKgFCK.d.mts} +81 -81
- package/dist/db-verify-BwgNK50T-DGvKgFCK.d.mts.map +1 -0
- package/dist/emitter.d.mts +1 -1
- package/dist/{errors-CXbGUWGu-BQi6YS-H.mjs → errors-CXbGUWGu-CstQHPh6.mjs} +2 -2
- package/dist/{errors-CXbGUWGu-BQi6YS-H.mjs.map → errors-CXbGUWGu-CstQHPh6.mjs.map} +1 -1
- 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/{exports-B3xY_FHp.mjs → exports-8ZUN43ve.mjs} +6 -6
- package/dist/exports-8ZUN43ve.mjs.map +1 -0
- package/dist/{exports-BZLNbtkY.mjs → exports-BZaG8_w_.mjs} +64 -36
- package/dist/exports-BZaG8_w_.mjs.map +1 -0
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs → graph-membership-BViWUMpP-C4lYYJdU.mjs} +2 -2
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs.map → graph-membership-BViWUMpP-C4lYYJdU.mjs.map} +1 -1
- package/dist/{import-roots-NDOIEDVj.mjs → import-roots-CNFBPAT1.mjs} +10 -3
- package/dist/{import-roots-NDOIEDVj.mjs.map → import-roots-CNFBPAT1.mjs.map} +1 -1
- package/dist/{import-roots-B6CtsWXb.d.mts → import-roots-CfoYgejL.d.mts} +2 -2
- package/dist/{import-roots-B6CtsWXb.d.mts.map → import-roots-CfoYgejL.d.mts.map} +1 -1
- package/dist/{index-mCsi_ND5.d.mts → index-DRs7L6N0.d.mts} +11 -3
- package/dist/index-DRs7L6N0.d.mts.map +1 -0
- package/dist/{index-CnOyYxmv.d.mts → index-Dgwl8Tzs.d.mts} +2 -2
- package/dist/{index-CnOyYxmv.d.mts.map → index-Dgwl8Tzs.d.mts.map} +1 -1
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs → invariants-CTHy88OP-CYI2a8IO.mjs} +2 -2
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs.map → invariants-CTHy88OP-CYI2a8IO.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D94PxRc-.mjs → io-635GlNx1-D3zrw2qu.mjs} +4 -4
- package/dist/{io-635GlNx1-D94PxRc-.mjs.map → io-635GlNx1-D3zrw2qu.mjs.map} +1 -1
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs → migration-graph-_SJImD5V-BURyY1KM.mjs} +2 -2
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs.map → migration-graph-_SJImD5V-BURyY1KM.mjs.map} +1 -1
- package/dist/{migration-gubSSeMk.mjs → migration-hspPIEeV.mjs} +4 -4
- package/dist/{migration-gubSSeMk.mjs.map → migration-hspPIEeV.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +4 -4
- 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.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-CovTDY14-CUoAqLML.mjs} +3 -45
- package/dist/output-CovTDY14-CUoAqLML.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 +12 -9
- package/dist/quick-reference-postgres.md +12 -9
- package/dist/readme-mongo.md +2 -2
- package/dist/readme-postgres.md +2 -2
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs +4686 -0
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs.map +1 -0
- package/dist/{ref-resolution-sGcINe7o.mjs → ref-resolution-HeNBXW53.mjs} +2 -2
- package/dist/{ref-resolution-sGcINe7o.mjs.map → ref-resolution-HeNBXW53.mjs.map} +1 -1
- package/dist/{refs-WK86uYYp-B6EZkmmT.mjs → refs-WK86uYYp-gM8tvWQP.mjs} +2 -2
- package/dist/{refs-WK86uYYp-B6EZkmmT.mjs.map → refs-WK86uYYp-gM8tvWQP.mjs.map} +1 -1
- package/dist/{shells-BenrJHp2.mjs → shells-C4HbRAr5.mjs} +13 -14
- package/dist/shells-C4HbRAr5.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-BG2w0P8d.mjs → spaces-4qMOAYE9.mjs} +7 -7
- package/dist/{spaces-BG2w0P8d.mjs.map → spaces-4qMOAYE9.mjs.map} +1 -1
- package/dist/{spaces-tWQi7CUv.d.mts → spaces-Dj65JrwZ.d.mts} +2 -2
- package/dist/{spaces-tWQi7CUv.d.mts.map → spaces-Dj65JrwZ.d.mts.map} +1 -1
- 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-DhJTb0zM-B62maCfE.mjs} +4 -4
- package/dist/{verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs.map → verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +2 -2
- package/dist/vite-plugin-contract-emit.mjs +5 -5
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +14 -38
- 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-D_sGnEF6-DRLPzlq8.mjs +0 -295
- package/dist/code-templates-D_sGnEF6-DRLPzlq8.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/exports-B3xY_FHp.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/index-mCsi_ND5.d.mts.map +0 -1
- package/dist/init-B86mXFNC-C2HAUCRn.mjs +0 -800
- package/dist/init-B86mXFNC-C2HAUCRn.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-ojVi2cpy-CLyiSDk5.mjs +0 -1476
- package/dist/redact-secrets-ojVi2cpy-CLyiSDk5.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/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/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":"verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-DhJTb0zM.mjs"],"sourcesContent":["import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from \"./errors-CXbGUWGu.mjs\";\nimport { t as MANIFEST_FILE } from \"./io-635GlNx1.mjs\";\nimport { join } from \"pathe\";\nimport { readFile, readdir, stat } from \"node:fs/promises\";\nimport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME } from \"@internal/framework-components/control\";\n//#region src/space-layout.ts\n/**\n* Pattern a contract-space identifier must match. The constraint is\n* filesystem-friendly: lowercase letters / digits / hyphen / underscore,\n* starts with a letter, max 64 characters.\n*/\nconst SPACE_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;\nfunction isValidSpaceId(spaceId) {\n\treturn SPACE_ID_PATTERN.test(spaceId);\n}\nfunction assertValidSpaceId(spaceId) {\n\tif (!isValidSpaceId(spaceId)) throw errorInvalidSpaceId(spaceId);\n}\n/**\n* Resolve the migrations subdirectory for a given contract space.\n*\n* Every contract space — including the app space (default `'app'`) —\n* lands under `<projectMigrationsDir>/<spaceId>/`. The space id is\n* validated against {@link SPACE_ID_PATTERN} because it becomes a\n* filesystem directory name verbatim.\n*\n* `projectMigrationsDir` is the project's top-level `migrations/`\n* directory; the helper does not assume anything about its absolute /\n* relative shape and is symmetric with `pathe.join`.\n*/\nfunction spaceMigrationDirectory(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\treturn join(projectMigrationsDir, spaceId);\n}\n/**\n* Per-space subdirectory name reserved for the ref store\n* (`migrations/<space>/<SPACE_REFS_DIRNAME>/*.json`). Single source of\n* truth: every helper that composes a per-space refs path imports this\n* constant, and the enumerator uses it (via\n* {@link RESERVED_SPACE_SUBDIR_NAMES}) to exclude reserved names from\n* the contract-space candidate list.\n*/\nconst SPACE_REFS_DIRNAME = \"refs\";\n/**\n* Names reserved under `migrations/` that must never be enumerated as a\n* phantom contract space: `SPACE_REFS_DIRNAME` (e.g. a top-level\n* `migrations/refs/` left in the wrong place) and\n* `CONTRACT_SNAPSHOTS_DIRNAME` (the migrations-root-wide contract\n* snapshot store, `migrations/snapshots/`).\n*/\nconst RESERVED_SPACE_SUBDIR_NAMES = /* @__PURE__ */ new Set([SPACE_REFS_DIRNAME, CONTRACT_SNAPSHOTS_DIRNAME]);\n/**\n* Resolve the per-space refs directory for `spaceMigrationsDir`\n* (typically the value returned by {@link spaceMigrationDirectory}).\n* Composes the canonical {@link SPACE_REFS_DIRNAME} so callers do not\n* hard-code the literal.\n*/\nfunction spaceRefsDirectory(spaceMigrationsDir) {\n\treturn join(spaceMigrationsDir, SPACE_REFS_DIRNAME);\n}\n//#endregion\n//#region src/read-contract-space-head-ref.ts\nfunction hasErrnoCode$1(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* Read the head ref (`hash` + `invariants`) for a contract space from\n* `<projectMigrationsDir>/<spaceId>/refs/head.json`.\n*\n* Returns `null` when the file does not exist (first emit). Surfaces\n* `MIGRATION.INVALID_JSON` / `MIGRATION.INVALID_REF_FILE` on a corrupt\n* `refs/head.json` so callers can distinguish \"no head ref on disk\"\n* (returns `null`) from \"head ref present but unreadable\" (throws).\n*\n* Validates the space id against `[a-z][a-z0-9_-]{0,63}` for the same\n* filesystem-safety reasons as the rest of the per-space helpers. The\n* helper is uniform across the app and extension spaces.\n*/\nasync function readContractSpaceHeadRef(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\tconst filePath = join(spaceRefsDirectory(spaceMigrationDirectory(projectMigrationsDir, spaceId)), \"head.json\");\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode$1(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(filePath, e instanceof Error ? e.message : String(e));\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null) throw errorInvalidRefFile(filePath, \"expected an object\");\n\tconst obj = parsed;\n\tif (typeof obj.hash !== \"string\") throw errorInvalidRefFile(filePath, \"expected an object with a string `hash` field\");\n\tif (!Array.isArray(obj.invariants) || obj.invariants.some((value) => typeof value !== \"string\")) throw errorInvalidRefFile(filePath, \"expected an object with an `invariants` array of strings\");\n\treturn {\n\t\thash: obj.hash,\n\t\tinvariants: obj.invariants\n\t};\n}\n//#endregion\n//#region src/verify-contract-spaces.ts\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* List the per-space subdirectories under\n* `<projectRoot>/migrations/`. Returns space-id directory names (sorted\n* alphabetically) — i.e. any non-dot-prefixed, non-reserved\n* ({@link RESERVED_SPACE_SUBDIR_NAMES}) subdirectory whose root does\n* **not** contain a `migration.json` manifest. The manifest is the\n* structural marker of a user-authored migration directory (see\n* `readMigrationsDir` in `./io`); directory names themselves belong to\n* the user and are not part of the contract. The reserved-name filter\n* keeps `migrations/snapshots/` (the contract snapshot store) from ever\n* being enumerated as a phantom contract space.\n*\n* Returns `[]` if the migrations directory does not exist (greenfield\n* project).\n*\n* Reads only the user's repo. **No descriptor import.** The caller\n* (verifier) feeds the result into {@link verifyContractSpaces} alongside\n* the loaded-space set and the marker rows.\n*/\nasync function listContractSpaceDirectories(projectMigrationsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = (await readdir(projectMigrationsDir, { withFileTypes: true })).map((d) => ({\n\t\t\tname: d.name,\n\t\t\tisDirectory: d.isDirectory()\n\t\t}));\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return [];\n\t\tthrow error;\n\t}\n\tconst namedCandidates = entries.filter((e) => e.isDirectory).map((e) => e.name).filter((name) => !name.startsWith(\".\")).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).sort();\n\treturn (await Promise.all(namedCandidates.map(async (name) => {\n\t\ttry {\n\t\t\tawait stat(join(projectMigrationsDir, name, MANIFEST_FILE));\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: true\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: false\n\t\t\t};\n\t\t\tthrow error;\n\t\t}\n\t}))).filter((c) => !c.isMigrationDir).map((c) => c.name);\n}\n/**\n* Pure structural verifier for the per-space mechanism. Aggregates the\n* three orphan / missing checks plus per-space hash and invariant\n* comparison.\n*\n* Algorithm:\n*\n* - For every extension space declared in `loadedSpaces` (`'app'`\n* excluded — the per-space verifier is scoped to extension spaces;\n* the app is verified through the aggregate path):\n* - If no contract-space dir on disk → `declaredButUnmigrated`.\n* - Else if `markerRowsBySpace` lacks an entry → no violation here;\n* the live-DB compare done outside this helper is where the\n* absence shows up.\n* - Else compare marker hash / invariants vs. on-disk head hash /\n* invariants → `hashMismatch` / `invariantsMismatch` on drift.\n* - For every contract-space dir on disk that is not in `loadedSpaces` →\n* `orphanSpaceDir`.\n* - For every marker row whose `space` is not in `loadedSpaces` →\n* `orphanMarker`. The app-space marker is always loaded (`'app'` is\n* in `loadedSpaces` by definition).\n*\n* Output is deterministic: violations are sorted first by `kind`\n* (`declaredButUnmigrated` → `orphanMarker` → `orphanSpaceDir` →\n* `hashMismatch` → `invariantsMismatch`) then by `spaceId`. Two callers\n* passing equivalent inputs see byte-identical violation lists.\n*\n* Synchronous, pure, no I/O. **Does not import the extension descriptor**\n* (the inputs are pre-resolved by the caller); the verifier reads only\n* the user repo, not `node_modules`.\n*/\nfunction verifyContractSpaces(inputs) {\n\tconst violations = [];\n\tfor (const spaceId of [...inputs.loadedSpaces].sort()) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tif (!inputs.spaceDirsOnDisk.includes(spaceId)) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"declaredButUnmigrated\",\n\t\t\t\tspaceId,\n\t\t\t\tremediation: `Extension '${spaceId}' is declared in extensions but has not been emitted; run \\`prisma-next migrate\\`.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst head = inputs.headRefsBySpace.get(spaceId);\n\t\tconst marker = inputs.markerRowsBySpace.get(spaceId);\n\t\tif (!head || !marker) continue;\n\t\tif (head.hash !== marker.hash) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tspaceId,\n\t\t\t\tpriorHeadHash: head.hash,\n\t\t\t\tmarkerHash: marker.hash,\n\t\t\t\tremediation: `Marker row for space '${spaceId}' is keyed at ${marker.hash}, but the on-disk ${join(\"migrations\", spaceId, \"contract.json\")} resolves to ${head.hash}. Run \\`prisma-next db update\\` to advance the database, or \\`prisma-next migrate\\` if the descriptor was bumped without re-emitting.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst onDiskInvariants = [...head.invariants].sort();\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = onDiskInvariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) violations.push({\n\t\t\tkind: \"invariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tonDiskInvariants,\n\t\t\tmarkerInvariants: [...marker.invariants].sort(),\n\t\t\tremediation: `Marker row for space '${spaceId}' is missing invariants [${missing.map((s) => JSON.stringify(s)).join(\", \")}]. Run \\`prisma-next db update\\` to apply the corresponding data-transform migrations.`\n\t\t});\n\t}\n\tfor (const dir of [...inputs.spaceDirsOnDisk].sort()) if (!inputs.loadedSpaces.has(dir)) violations.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: dir,\n\t\tremediation: `Orphan contract-space directory \\`${join(\"migrations\", dir)}/\\` for an extension not in extensions; remove the directory or re-add the extension.`\n\t});\n\tfor (const space of [...inputs.markerRowsBySpace.keys()].sort()) if (!inputs.loadedSpaces.has(space)) violations.push({\n\t\tkind: \"orphanMarker\",\n\t\tspaceId: space,\n\t\tremediation: `Orphan marker row for space '${space}' (no longer in extensions); remediation: manually delete the row from \\`prisma_contract.marker\\`.`\n\t});\n\tif (violations.length === 0) return { ok: true };\n\tconst kindOrder = {\n\t\tdeclaredButUnmigrated: 0,\n\t\torphanMarker: 1,\n\t\torphanSpaceDir: 2,\n\t\thashMismatch: 3,\n\t\tinvariantsMismatch: 4\n\t};\n\tviolations.sort((a, b) => {\n\t\tconst k = kindOrder[a.kind] - kindOrder[b.kind];\n\t\tif (k !== 0) return k;\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t});\n\treturn {\n\t\tok: false,\n\t\tviolations\n\t};\n}\n//#endregion\nexport { RESERVED_SPACE_SUBDIR_NAMES as a, isValidSpaceId as c, APP_SPACE_ID as i, spaceMigrationDirectory as l, verifyContractSpaces as n, SPACE_REFS_DIRNAME as o, readContractSpaceHeadRef as r, assertValidSpaceId as s, listContractSpaceDirectories as t, spaceRefsDirectory as u };\n\n//# sourceMappingURL=verify-contract-spaces-DhJTb0zM.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,mBAAmB;AACzB,SAAS,eAAe,SAAS;CAChC,OAAO,iBAAiB,KAAK,OAAO;AACrC;AACA,SAAS,mBAAmB,SAAS;CACpC,IAAI,CAAC,eAAe,OAAO,GAAG,MAAM,oBAAoB,OAAO;AAChE;;;;;;;;;;;;;AAaA,SAAS,wBAAwB,sBAAsB,SAAS;CAC/D,mBAAmB,OAAO;CAC1B,OAAO,KAAK,sBAAsB,OAAO;AAC1C;;;;;;;;;AASA,MAAM,qBAAqB;;;;;;;;AAQ3B,MAAM,8CAA8C,IAAI,IAAI,CAAC,oBAAoB,0BAA0B,CA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AAE,UAAU,EAAE,SAAS,OAAO;EAClC,OAAO;CACR,CAAC;CACD,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"verify-contract-spaces-DhJTb0zM-B62maCfE.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-DhJTb0zM.mjs"],"sourcesContent":["import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from \"./errors-CXbGUWGu.mjs\";\nimport { t as MANIFEST_FILE } from \"./io-635GlNx1.mjs\";\nimport { join } from \"pathe\";\nimport { readFile, readdir, stat } from \"node:fs/promises\";\nimport { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME } from \"@internal/framework-components/control\";\n//#region src/space-layout.ts\n/**\n* Pattern a contract-space identifier must match. The constraint is\n* filesystem-friendly: lowercase letters / digits / hyphen / underscore,\n* starts with a letter, max 64 characters.\n*/\nconst SPACE_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;\nfunction isValidSpaceId(spaceId) {\n\treturn SPACE_ID_PATTERN.test(spaceId);\n}\nfunction assertValidSpaceId(spaceId) {\n\tif (!isValidSpaceId(spaceId)) throw errorInvalidSpaceId(spaceId);\n}\n/**\n* Resolve the migrations subdirectory for a given contract space.\n*\n* Every contract space — including the app space (default `'app'`) —\n* lands under `<projectMigrationsDir>/<spaceId>/`. The space id is\n* validated against {@link SPACE_ID_PATTERN} because it becomes a\n* filesystem directory name verbatim.\n*\n* `projectMigrationsDir` is the project's top-level `migrations/`\n* directory; the helper does not assume anything about its absolute /\n* relative shape and is symmetric with `pathe.join`.\n*/\nfunction spaceMigrationDirectory(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\treturn join(projectMigrationsDir, spaceId);\n}\n/**\n* Per-space subdirectory name reserved for the ref store\n* (`migrations/<space>/<SPACE_REFS_DIRNAME>/*.json`). Single source of\n* truth: every helper that composes a per-space refs path imports this\n* constant, and the enumerator uses it (via\n* {@link RESERVED_SPACE_SUBDIR_NAMES}) to exclude reserved names from\n* the contract-space candidate list.\n*/\nconst SPACE_REFS_DIRNAME = \"refs\";\n/**\n* Names reserved under `migrations/` that must never be enumerated as a\n* phantom contract space: `SPACE_REFS_DIRNAME` (e.g. a top-level\n* `migrations/refs/` left in the wrong place) and\n* `CONTRACT_SNAPSHOTS_DIRNAME` (the migrations-root-wide contract\n* snapshot store, `migrations/snapshots/`).\n*/\nconst RESERVED_SPACE_SUBDIR_NAMES = /* @__PURE__ */ new Set([SPACE_REFS_DIRNAME, CONTRACT_SNAPSHOTS_DIRNAME]);\n/**\n* Resolve the per-space refs directory for `spaceMigrationsDir`\n* (typically the value returned by {@link spaceMigrationDirectory}).\n* Composes the canonical {@link SPACE_REFS_DIRNAME} so callers do not\n* hard-code the literal.\n*/\nfunction spaceRefsDirectory(spaceMigrationsDir) {\n\treturn join(spaceMigrationsDir, SPACE_REFS_DIRNAME);\n}\n//#endregion\n//#region src/read-contract-space-head-ref.ts\nfunction hasErrnoCode$1(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* Read the head ref (`hash` + `invariants`) for a contract space from\n* `<projectMigrationsDir>/<spaceId>/refs/head.json`.\n*\n* Returns `null` when the file does not exist (first emit). Surfaces\n* `MIGRATION.INVALID_JSON` / `MIGRATION.INVALID_REF_FILE` on a corrupt\n* `refs/head.json` so callers can distinguish \"no head ref on disk\"\n* (returns `null`) from \"head ref present but unreadable\" (throws).\n*\n* Validates the space id against `[a-z][a-z0-9_-]{0,63}` for the same\n* filesystem-safety reasons as the rest of the per-space helpers. The\n* helper is uniform across the app and extension spaces.\n*/\nasync function readContractSpaceHeadRef(projectMigrationsDir, spaceId) {\n\tassertValidSpaceId(spaceId);\n\tconst filePath = join(spaceRefsDirectory(spaceMigrationDirectory(projectMigrationsDir, spaceId)), \"head.json\");\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode$1(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(filePath, e instanceof Error ? e.message : String(e));\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null) throw errorInvalidRefFile(filePath, \"expected an object\");\n\tconst obj = parsed;\n\tif (typeof obj.hash !== \"string\") throw errorInvalidRefFile(filePath, \"expected an object with a string `hash` field\");\n\tif (!Array.isArray(obj.invariants) || obj.invariants.some((value) => typeof value !== \"string\")) throw errorInvalidRefFile(filePath, \"expected an object with an `invariants` array of strings\");\n\treturn {\n\t\thash: obj.hash,\n\t\tinvariants: obj.invariants\n\t};\n}\n//#endregion\n//#region src/verify-contract-spaces.ts\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\n/**\n* List the per-space subdirectories under\n* `<projectRoot>/migrations/`. Returns space-id directory names (sorted\n* alphabetically) — i.e. any non-dot-prefixed, non-reserved\n* ({@link RESERVED_SPACE_SUBDIR_NAMES}) subdirectory whose root does\n* **not** contain a `migration.json` manifest. The manifest is the\n* structural marker of a user-authored migration directory (see\n* `readMigrationsDir` in `./io`); directory names themselves belong to\n* the user and are not part of the contract. The reserved-name filter\n* keeps `migrations/snapshots/` (the contract snapshot store) from ever\n* being enumerated as a phantom contract space.\n*\n* Returns `[]` if the migrations directory does not exist (greenfield\n* project).\n*\n* Reads only the user's repo. **No descriptor import.** The caller\n* (verifier) feeds the result into {@link verifyContractSpaces} alongside\n* the loaded-space set and the marker rows.\n*/\nasync function listContractSpaceDirectories(projectMigrationsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = (await readdir(projectMigrationsDir, { withFileTypes: true })).map((d) => ({\n\t\t\tname: d.name,\n\t\t\tisDirectory: d.isDirectory()\n\t\t}));\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return [];\n\t\tthrow error;\n\t}\n\tconst namedCandidates = entries.filter((e) => e.isDirectory).map((e) => e.name).filter((name) => !name.startsWith(\".\")).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).sort();\n\treturn (await Promise.all(namedCandidates.map(async (name) => {\n\t\ttry {\n\t\t\tawait stat(join(projectMigrationsDir, name, MANIFEST_FILE));\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: true\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\t\tname,\n\t\t\t\tisMigrationDir: false\n\t\t\t};\n\t\t\tthrow error;\n\t\t}\n\t}))).filter((c) => !c.isMigrationDir).map((c) => c.name);\n}\n/**\n* Pure structural verifier for the per-space mechanism. Aggregates the\n* three orphan / missing checks plus per-space hash and invariant\n* comparison.\n*\n* Algorithm:\n*\n* - For every extension space declared in `loadedSpaces` (`'app'`\n* excluded — the per-space verifier is scoped to extension spaces;\n* the app is verified through the aggregate path):\n* - If no contract-space dir on disk → `declaredButUnmigrated`.\n* - Else if `markerRowsBySpace` lacks an entry → no violation here;\n* the live-DB compare done outside this helper is where the\n* absence shows up.\n* - Else compare marker hash / invariants vs. on-disk head hash /\n* invariants → `hashMismatch` / `invariantsMismatch` on drift.\n* - For every contract-space dir on disk that is not in `loadedSpaces` →\n* `orphanSpaceDir`.\n* - For every marker row whose `space` is not in `loadedSpaces` →\n* `orphanMarker`. The app-space marker is always loaded (`'app'` is\n* in `loadedSpaces` by definition).\n*\n* Output is deterministic: violations are sorted first by `kind`\n* (`declaredButUnmigrated` → `orphanMarker` → `orphanSpaceDir` →\n* `hashMismatch` → `invariantsMismatch`) then by `spaceId`. Two callers\n* passing equivalent inputs see byte-identical violation lists.\n*\n* Synchronous, pure, no I/O. **Does not import the extension descriptor**\n* (the inputs are pre-resolved by the caller); the verifier reads only\n* the user repo, not `node_modules`.\n*/\nfunction verifyContractSpaces(inputs) {\n\tconst violations = [];\n\tfor (const spaceId of [...inputs.loadedSpaces].sort()) {\n\t\tif (spaceId === APP_SPACE_ID) continue;\n\t\tif (!inputs.spaceDirsOnDisk.includes(spaceId)) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"declaredButUnmigrated\",\n\t\t\t\tspaceId,\n\t\t\t\tremediation: `Extension '${spaceId}' is declared in extensions but has not been emitted; run \\`prisma-next migrate\\`.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst head = inputs.headRefsBySpace.get(spaceId);\n\t\tconst marker = inputs.markerRowsBySpace.get(spaceId);\n\t\tif (!head || !marker) continue;\n\t\tif (head.hash !== marker.hash) {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tspaceId,\n\t\t\t\tpriorHeadHash: head.hash,\n\t\t\t\tmarkerHash: marker.hash,\n\t\t\t\tremediation: `Marker row for space '${spaceId}' is keyed at ${marker.hash}, but the on-disk ${join(\"migrations\", spaceId, \"contract.json\")} resolves to ${head.hash}. Run \\`prisma-next db update\\` to advance the database, or \\`prisma-next migrate\\` if the descriptor was bumped without re-emitting.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst onDiskInvariants = [...head.invariants].sort();\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = onDiskInvariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) violations.push({\n\t\t\tkind: \"invariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tonDiskInvariants,\n\t\t\tmarkerInvariants: [...marker.invariants].sort(),\n\t\t\tremediation: `Marker row for space '${spaceId}' is missing invariants [${missing.map((s) => JSON.stringify(s)).join(\", \")}]. Run \\`prisma-next db update\\` to apply the corresponding data-transform migrations.`\n\t\t});\n\t}\n\tfor (const dir of [...inputs.spaceDirsOnDisk].sort()) if (!inputs.loadedSpaces.has(dir)) violations.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: dir,\n\t\tremediation: `Orphan contract-space directory \\`${join(\"migrations\", dir)}/\\` for an extension not in extensions; remove the directory or re-add the extension.`\n\t});\n\tfor (const space of [...inputs.markerRowsBySpace.keys()].sort()) if (!inputs.loadedSpaces.has(space)) violations.push({\n\t\tkind: \"orphanMarker\",\n\t\tspaceId: space,\n\t\tremediation: `Orphan marker row for space '${space}' (no longer in extensions); remediation: manually delete the row from \\`prisma_contract.marker\\`.`\n\t});\n\tif (violations.length === 0) return { ok: true };\n\tconst kindOrder = {\n\t\tdeclaredButUnmigrated: 0,\n\t\torphanMarker: 1,\n\t\torphanSpaceDir: 2,\n\t\thashMismatch: 3,\n\t\tinvariantsMismatch: 4\n\t};\n\tviolations.sort((a, b) => {\n\t\tconst k = kindOrder[a.kind] - kindOrder[b.kind];\n\t\tif (k !== 0) return k;\n\t\tif (a.spaceId < b.spaceId) return -1;\n\t\tif (a.spaceId > b.spaceId) return 1;\n\t\treturn 0;\n\t});\n\treturn {\n\t\tok: false,\n\t\tviolations\n\t};\n}\n//#endregion\nexport { RESERVED_SPACE_SUBDIR_NAMES as a, isValidSpaceId as c, APP_SPACE_ID as i, spaceMigrationDirectory as l, verifyContractSpaces as n, SPACE_REFS_DIRNAME as o, readContractSpaceHeadRef as r, assertValidSpaceId as s, listContractSpaceDirectories as t, spaceRefsDirectory as u };\n\n//# sourceMappingURL=verify-contract-spaces-DhJTb0zM.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,mBAAmB;AACzB,SAAS,eAAe,SAAS;CAChC,OAAO,iBAAiB,KAAK,OAAO;AACrC;AACA,SAAS,mBAAmB,SAAS;CACpC,IAAI,CAAC,eAAe,OAAO,GAAG,MAAM,oBAAoB,OAAO;AAChE;;;;;;;;;;;;;AAaA,SAAS,wBAAwB,sBAAsB,SAAS;CAC/D,mBAAmB,OAAO;CAC1B,OAAO,KAAK,sBAAsB,OAAO;AAC1C;;;;;;;;;AASA,MAAM,qBAAqB;;;;;;;;AAQ3B,MAAM,8CAA8C,IAAI,IAAI,CAAC,oBAAoB,0BAA0B,CAAC;;;;;;;AAO5G,SAAS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OAAO;EAClC,OAAO;CACR,CAAC;CACD,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
@@ -28,7 +28,7 @@ interface PrismaVitePluginOptions {
|
|
|
28
28
|
* re-emitting contract artifacts on changes with debounce while serializing
|
|
29
29
|
* overlapping emits into a single follow-up run.
|
|
30
30
|
*
|
|
31
|
-
* @param configPath - Path to prisma
|
|
31
|
+
* @param configPath - Path to prisma.config.ts (relative or absolute). Defaults to 'prisma.config.ts'
|
|
32
32
|
* @param options - Optional plugin configuration
|
|
33
33
|
* @returns Vite plugin
|
|
34
34
|
*
|
|
@@ -44,7 +44,7 @@ interface PrismaVitePluginOptions {
|
|
|
44
44
|
*
|
|
45
45
|
* // Or specify a custom path
|
|
46
46
|
* export default defineConfig({
|
|
47
|
-
* plugins: [prismaVitePlugin('custom/prisma
|
|
47
|
+
* plugins: [prismaVitePlugin('custom/prisma.config.ts')],
|
|
48
48
|
* });
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { o as loadConfigForSections } from "./exports-BZLNbtkY.mjs";
|
|
2
1
|
import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-05kuwcb0.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { R as executeContractEmit, h as disposeEmitQueue } from "./ref-h6InR6dO-rGfl18Jv.mjs";
|
|
3
|
+
import { a as loadConfigForSections } from "./exports-BZaG8_w_.mjs";
|
|
4
4
|
import { extname, resolve } from "pathe";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs
|
|
6
6
|
const PLUGIN_NAME = "prisma-vite-plugin-contract-emit";
|
|
7
7
|
const DEFAULT_DEBOUNCE_MS = 150;
|
|
8
|
-
const DEFAULT_CONFIG_PATH = "prisma
|
|
8
|
+
const DEFAULT_CONFIG_PATH = "prisma.config.ts";
|
|
9
9
|
const MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
10
10
|
".js",
|
|
11
11
|
".jsx",
|
|
@@ -23,7 +23,7 @@ const MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
23
23
|
* re-emitting contract artifacts on changes with debounce while serializing
|
|
24
24
|
* overlapping emits into a single follow-up run.
|
|
25
25
|
*
|
|
26
|
-
* @param configPath - Path to prisma
|
|
26
|
+
* @param configPath - Path to prisma.config.ts (relative or absolute). Defaults to 'prisma.config.ts'
|
|
27
27
|
* @param options - Optional plugin configuration
|
|
28
28
|
* @returns Vite plugin
|
|
29
29
|
*
|
|
@@ -39,7 +39,7 @@ const MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
39
39
|
*
|
|
40
40
|
* // Or specify a custom path
|
|
41
41
|
* export default defineConfig({
|
|
42
|
-
* plugins: [prismaVitePlugin('custom/prisma
|
|
42
|
+
* plugins: [prismaVitePlugin('custom/prisma.config.ts')],
|
|
43
43
|
* });
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma-next.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma Next contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma-next.config.ts (relative or absolute). Defaults to 'prisma-next.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma-next.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\n\t\t\t\t\"contract\",\n\t\t\t\t\"family\",\n\t\t\t\t\"target\",\n\t\t\t\t\"adapter\",\n\t\t\t\t\"extensions\"\n\t\t\t]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfig: configResult.value,\n\t\t\t\tcwd: process.cwd(),\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\"contract\"]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst config = configResult.value;\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma Next config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BD,SAAS,iBAAiB,aAAa,qBAAqB,SAAS;CACpE,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,WAAW,SAAS,YAAY;CACtC,IAAI;CACJ,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,uCAAuC,IAAI,IAAI;CACrD,IAAI,gBAAgB;CACpB,IAAI,2BAA2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AAM;IACzB,KAAK,MAAM,kBAAkB,sBAAsB,iBAAiB,cAAc;IAClF,qBAAqB,MAAM;IAC3B,6BAA6B;IAC7B,SAAS;IACT,aAAa,MAAM;IACnB,IAAI,uCAAuC,OAAO;GACnD;GACA,WAAW,YAAY,GAAG,SAAS,OAAO;GAC1C,WAAW,SAAS,KAAK,SAAS,OAAO;GACzC,WAAW,QAAQ,GAAG,UAAU,qBAAqB;GACrD,WAAW,QAAQ,GAAG,OAAO,qBAAqB;GAClD,WAAW,QAAQ,GAAG,UAAU,qBAAqB;GACrD,MAAM,sBAAsB,MAAM,oBAAoB,UAAU;GAChE,KAAK,MAAM,QAAQ,qBAAqB,aAAa,IAAI,IAAI;GAC7D,KAAK,MAAM,QAAQ,cAAc,WAAW,QAAQ,IAAI,IAAI;GAC5D,IAAI,aAAa,SAAS,GAAG;IAC5B,MAAM,eAAe,gDAAgD,mBAAmB;IACxF,SAAS,YAAY;IACrB,WAAW,GAAG,KAAK;KAClB,MAAM;KACN,KAAK;MACJ,SAAS,iBAAiB;MAC1B,OAAO;MACP,QAAQ;KACT;IACD,CAAC;GACF,OAAO;IACN,IAAI,YAAY,aAAa,KAAK,SAAS,OAAO;IAClD,IAAI,aAAa,SAAS,KAAK,MAAM,QAAQ,cAAc,IAAI,KAAK,QAAQ,OAAO;GACpF;GACA,MAAM,YAAY,EAAE,qBAAqB,MAAM,CAAC;EACjD;EACA,gBAAgB,KAAK;GACpB,wBAAwB,IAAI,IAAI;EACjC;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma Next contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma.config.ts (relative or absolute). Defaults to 'prisma.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\n\t\t\t\t\"contract\",\n\t\t\t\t\"family\",\n\t\t\t\t\"target\",\n\t\t\t\t\"adapter\",\n\t\t\t\t\"extensions\"\n\t\t\t]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfig: configResult.value,\n\t\t\t\tcwd: process.cwd(),\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\"contract\"]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst config = configResult.value;\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma Next config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;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GED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-toolchain",
|
|
3
|
-
"version": "8.0.0-rc.1-dev.
|
|
3
|
+
"version": "8.0.0-rc.1-dev.46",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"description": "Prisma Next dev/build tooling:
|
|
7
|
+
"description": "Prisma Next dev/build tooling: the ORM command family, emitter, config-loader, language server, telemetry, vite plugin",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
-
"bin": {
|
|
12
|
-
"prisma-next": "./dist/bin__prisma-next.mjs"
|
|
13
|
-
},
|
|
14
11
|
"dependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@prisma/cli-engine": "0.0.9",
|
|
17
|
-
"@prisma/orm-framework": "8.0.0-rc.1-dev.44",
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.1-dev.46",
|
|
18
13
|
"@vercel/detect-agent": "^1.2.4",
|
|
19
14
|
"arktype": "^2.2.2",
|
|
20
15
|
"c12": "^3.3.4",
|
|
@@ -22,7 +17,6 @@
|
|
|
22
17
|
"clipanion": "4.0.0-rc.4",
|
|
23
18
|
"closest-match": "^1.3.3",
|
|
24
19
|
"colorette": "^2.0.20",
|
|
25
|
-
"commander": "^15.0.0",
|
|
26
20
|
"esbuild": "^0.28.1",
|
|
27
21
|
"jsonc-parser": "^3.3.1",
|
|
28
22
|
"package-manager-detector": "^1.8.0",
|
|
@@ -35,20 +29,21 @@
|
|
|
35
29
|
"wrap-ansi": "^10.0.0"
|
|
36
30
|
},
|
|
37
31
|
"devDependencies": {
|
|
38
|
-
"@internal/cli": "8.0.0-rc.1-dev.
|
|
39
|
-
"@internal/cli-telemetry": "8.0.0-rc.1-dev.
|
|
40
|
-
"@internal/config-loader": "8.0.0-rc.1-dev.
|
|
41
|
-
"@internal/emitter": "8.0.0-rc.1-dev.
|
|
42
|
-
"@internal/language-server": "8.0.0-rc.1-dev.
|
|
43
|
-
"@internal/migration-tools": "8.0.0-rc.1-dev.
|
|
44
|
-
"@internal/publish-surface": "8.0.0-rc.1-dev.
|
|
45
|
-
"@repo/tsconfig": "8.0.0-rc.1-dev.
|
|
46
|
-
"@repo/tsdown": "8.0.0-rc.1-dev.
|
|
47
|
-
"@internal/vite-plugin-contract-emit": "8.0.0-rc.1-dev.
|
|
32
|
+
"@internal/cli": "8.0.0-rc.1-dev.46",
|
|
33
|
+
"@internal/cli-telemetry": "8.0.0-rc.1-dev.46",
|
|
34
|
+
"@internal/config-loader": "8.0.0-rc.1-dev.46",
|
|
35
|
+
"@internal/emitter": "8.0.0-rc.1-dev.46",
|
|
36
|
+
"@internal/language-server": "8.0.0-rc.1-dev.46",
|
|
37
|
+
"@internal/migration-tools": "8.0.0-rc.1-dev.46",
|
|
38
|
+
"@internal/publish-surface": "8.0.0-rc.1-dev.46",
|
|
39
|
+
"@repo/tsconfig": "8.0.0-rc.1-dev.46",
|
|
40
|
+
"@repo/tsdown": "8.0.0-rc.1-dev.46",
|
|
41
|
+
"@internal/vite-plugin-contract-emit": "8.0.0-rc.1-dev.46",
|
|
48
42
|
"tsdown": "0.22.14",
|
|
49
43
|
"typescript": "5.9.3"
|
|
50
44
|
},
|
|
51
45
|
"peerDependencies": {
|
|
46
|
+
"@prisma/cli-engine": "0.0.9",
|
|
52
47
|
"typescript": ">=5.9",
|
|
53
48
|
"vite": "^7.0.0 || ^8.0.0"
|
|
54
49
|
},
|
|
@@ -61,26 +56,7 @@
|
|
|
61
56
|
}
|
|
62
57
|
},
|
|
63
58
|
"exports": {
|
|
64
|
-
"./bin/prisma-next": "./dist/bin__prisma-next.mjs",
|
|
65
59
|
"./cli": "./dist/cli.mjs",
|
|
66
|
-
"./cli/commands/contract-emit": "./dist/cli__commands__contract-emit.mjs",
|
|
67
|
-
"./cli/commands/contract-infer": "./dist/cli__commands__contract-infer.mjs",
|
|
68
|
-
"./cli/commands/db-init": "./dist/cli__commands__db-init.mjs",
|
|
69
|
-
"./cli/commands/db-schema": "./dist/cli__commands__db-schema.mjs",
|
|
70
|
-
"./cli/commands/db-sign": "./dist/cli__commands__db-sign.mjs",
|
|
71
|
-
"./cli/commands/db-update": "./dist/cli__commands__db-update.mjs",
|
|
72
|
-
"./cli/commands/db-verify": "./dist/cli__commands__db-verify.mjs",
|
|
73
|
-
"./cli/commands/migrate": "./dist/cli__commands__migrate.mjs",
|
|
74
|
-
"./cli/commands/migration-check": "./dist/cli__commands__migration-check.mjs",
|
|
75
|
-
"./cli/commands/migration-graph": "./dist/cli__commands__migration-graph.mjs",
|
|
76
|
-
"./cli/commands/migration-list": "./dist/cli__commands__migration-list.mjs",
|
|
77
|
-
"./cli/commands/migration-log": "./dist/cli__commands__migration-log.mjs",
|
|
78
|
-
"./cli/commands/migration-new": "./dist/cli__commands__migration-new.mjs",
|
|
79
|
-
"./cli/commands/migration-plan": "./dist/cli__commands__migration-plan.mjs",
|
|
80
|
-
"./cli/commands/migration-show": "./dist/cli__commands__migration-show.mjs",
|
|
81
|
-
"./cli/commands/migration-status": "./dist/cli__commands__migration-status.mjs",
|
|
82
|
-
"./cli/commands/ref": "./dist/cli__commands__ref.mjs",
|
|
83
|
-
"./cli/commands/telemetry": "./dist/cli__commands__telemetry.mjs",
|
|
84
60
|
"./cli/config-types": "./dist/cli__config-types.mjs",
|
|
85
61
|
"./cli/control-api": "./dist/cli__control-api.mjs",
|
|
86
62
|
"./cli/control-api/testing": "./dist/cli__control-api__testing.mjs",
|