@prisma/orm-toolchain 0.16.0-dev.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +28 -0
- package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
- package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
- package/dist/aggregate-BflrjWPO.d.mts +803 -0
- package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
- package/dist/bin__prisma-next.mjs +800 -0
- package/dist/bin__prisma-next.mjs.map +1 -0
- package/dist/cli-telemetry.d.mts +367 -0
- package/dist/cli-telemetry.d.mts.map +1 -0
- package/dist/cli-telemetry.mjs +48 -0
- package/dist/cli-telemetry.mjs.map +1 -0
- package/dist/cli-telemetry__sender.d.mts +1 -0
- package/dist/cli-telemetry__sender.mjs +1 -0
- package/dist/cli.d.mts +31 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +180 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/cli__commands__contract-emit.d.mts +2 -0
- package/dist/cli__commands__contract-emit.mjs +2 -0
- package/dist/cli__commands__contract-infer.d.mts +7 -0
- package/dist/cli__commands__contract-infer.d.mts.map +1 -0
- package/dist/cli__commands__contract-infer.mjs +2 -0
- package/dist/cli__commands__db-init.d.mts +7 -0
- package/dist/cli__commands__db-init.d.mts.map +1 -0
- package/dist/cli__commands__db-init.mjs +2 -0
- package/dist/cli__commands__db-schema.d.mts +7 -0
- package/dist/cli__commands__db-schema.d.mts.map +1 -0
- package/dist/cli__commands__db-schema.mjs +2 -0
- package/dist/cli__commands__db-sign.d.mts +7 -0
- package/dist/cli__commands__db-sign.d.mts.map +1 -0
- package/dist/cli__commands__db-sign.mjs +2 -0
- package/dist/cli__commands__db-update.d.mts +7 -0
- package/dist/cli__commands__db-update.d.mts.map +1 -0
- package/dist/cli__commands__db-update.mjs +2 -0
- package/dist/cli__commands__db-verify.d.mts +7 -0
- package/dist/cli__commands__db-verify.d.mts.map +1 -0
- package/dist/cli__commands__db-verify.mjs +2 -0
- package/dist/cli__commands__migrate.d.mts +66 -0
- package/dist/cli__commands__migrate.d.mts.map +1 -0
- package/dist/cli__commands__migrate.mjs +2 -0
- package/dist/cli__commands__migration-check.d.mts +64 -0
- package/dist/cli__commands__migration-check.d.mts.map +1 -0
- package/dist/cli__commands__migration-check.mjs +3 -0
- package/dist/cli__commands__migration-graph.d.mts +36 -0
- package/dist/cli__commands__migration-graph.d.mts.map +1 -0
- package/dist/cli__commands__migration-graph.mjs +2 -0
- package/dist/cli__commands__migration-list.d.mts +79 -0
- package/dist/cli__commands__migration-list.d.mts.map +1 -0
- package/dist/cli__commands__migration-list.mjs +2 -0
- package/dist/cli__commands__migration-log.d.mts +20 -0
- package/dist/cli__commands__migration-log.d.mts.map +1 -0
- package/dist/cli__commands__migration-log.mjs +2 -0
- package/dist/cli__commands__migration-new.d.mts +7 -0
- package/dist/cli__commands__migration-new.d.mts.map +1 -0
- package/dist/cli__commands__migration-new.mjs +2 -0
- package/dist/cli__commands__migration-plan.d.mts +79 -0
- package/dist/cli__commands__migration-plan.d.mts.map +1 -0
- package/dist/cli__commands__migration-plan.mjs +2 -0
- package/dist/cli__commands__migration-show.d.mts +27 -0
- package/dist/cli__commands__migration-show.d.mts.map +1 -0
- package/dist/cli__commands__migration-show.mjs +2 -0
- package/dist/cli__commands__migration-status.d.mts +55 -0
- package/dist/cli__commands__migration-status.d.mts.map +1 -0
- package/dist/cli__commands__migration-status.mjs +3 -0
- package/dist/cli__commands__ref.d.mts +34 -0
- package/dist/cli__commands__ref.d.mts.map +1 -0
- package/dist/cli__commands__ref.mjs +2 -0
- package/dist/cli__commands__telemetry.d.mts +7 -0
- package/dist/cli__commands__telemetry.d.mts.map +1 -0
- package/dist/cli__commands__telemetry.mjs +2 -0
- package/dist/cli__config-types.d.mts +2 -0
- package/dist/cli__config-types.mjs +2 -0
- package/dist/cli__control-api.d.mts +141 -0
- package/dist/cli__control-api.d.mts.map +1 -0
- package/dist/cli__control-api.mjs +4 -0
- package/dist/cli__init-output.d.mts +37 -0
- package/dist/cli__init-output.d.mts.map +1 -0
- package/dist/cli__init-output.mjs +2 -0
- package/dist/cli__migration-cli.d.mts +79 -0
- package/dist/cli__migration-cli.d.mts.map +1 -0
- package/dist/cli__migration-cli.mjs +407 -0
- package/dist/cli__migration-cli.mjs.map +1 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
- package/dist/config-loader.d.mts +18 -0
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +2 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
- package/dist/constants-Dkcn8Qu4.d.mts +10 -0
- package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
- package/dist/contract-emit-B65_UiFn.d.mts +7 -0
- package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
- package/dist/db-init-Vbkb_TKZ.mjs +153 -0
- package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
- package/dist/db-schema-ClQCu3xY.mjs +47 -0
- package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
- package/dist/db-sign-jjXDgQ1u.mjs +175 -0
- package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
- package/dist/db-update-BQlrqtDD.mjs +183 -0
- package/dist/db-update-BQlrqtDD.mjs.map +1 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
- package/dist/emitter.d.mts +75 -0
- package/dist/emitter.d.mts.map +1 -0
- package/dist/emitter.mjs +3 -0
- package/dist/emitter__domain-type-generation.d.mts +2 -0
- package/dist/emitter__domain-type-generation.mjs +2 -0
- package/dist/emitter__type-expression-safety.d.mts +6 -0
- package/dist/emitter__type-expression-safety.d.mts.map +1 -0
- package/dist/emitter__type-expression-safety.mjs +2 -0
- package/dist/errors--qsXZUtL.d.mts +72 -0
- package/dist/errors--qsXZUtL.d.mts.map +1 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
- package/dist/exports-BN0vFTxG.mjs +276 -0
- package/dist/exports-BN0vFTxG.mjs.map +1 -0
- package/dist/exports-B_xhKZmC.mjs +1436 -0
- package/dist/exports-B_xhKZmC.mjs.map +1 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
- package/dist/exports-Dl2aGAk7.mjs +119 -0
- package/dist/exports-Dl2aGAk7.mjs.map +1 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
- package/dist/hash-XZYYKJ-i.d.mts +53 -0
- package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
- package/dist/import-roots-B6CtsWXb.d.mts +119 -0
- package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
- package/dist/import-roots-NDOIEDVj.mjs +217 -0
- package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
- package/dist/invariants-B5wLrgQS.d.mts +39 -0
- package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
- package/dist/io-DYfeLJxR.d.mts +1 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
- package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
- package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
- package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
- package/dist/metadata-BtscDay2.d.mts +1 -0
- package/dist/migrate-Cb_iv264.mjs +500 -0
- package/dist/migrate-Cb_iv264.mjs.map +1 -0
- package/dist/migration-B2ljMJim.d.mts +155 -0
- package/dist/migration-B2ljMJim.d.mts.map +1 -0
- package/dist/migration-BuUmO7It.mjs +209 -0
- package/dist/migration-BuUmO7It.mjs.map +1 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs +597 -0
- package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +1 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
- package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
- package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
- package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
- package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
- package/dist/migration-new-BurCjyaQ.mjs +168 -0
- package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
- package/dist/migration-show-Bx5I5aW9.mjs +171 -0
- package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs +444 -0
- package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +1 -0
- package/dist/migration-tools.d.mts +23 -0
- package/dist/migration-tools.mjs +17 -0
- package/dist/migration-tools__aggregate.d.mts +2 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__constants.d.mts +2 -0
- package/dist/migration-tools__constants.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__errors.d.mts +2 -0
- package/dist/migration-tools__errors.mjs +2 -0
- package/dist/migration-tools__graph.d.mts +2 -0
- package/dist/migration-tools__graph.mjs +1 -0
- package/dist/migration-tools__hash.d.mts +2 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__invariants.d.mts +2 -0
- package/dist/migration-tools__invariants.mjs +2 -0
- package/dist/migration-tools__io.d.mts +3 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__ledger-origin.d.mts +2 -0
- package/dist/migration-tools__ledger-origin.mjs +2 -0
- package/dist/migration-tools__metadata.d.mts +3 -0
- package/dist/migration-tools__metadata.mjs +1 -0
- package/dist/migration-tools__migration-graph.d.mts +3 -0
- package/dist/migration-tools__migration-graph.mjs +3 -0
- package/dist/migration-tools__migration-ts.d.mts +2 -0
- package/dist/migration-tools__migration-ts.mjs +2 -0
- package/dist/migration-tools__migration.d.mts +2 -0
- package/dist/migration-tools__migration.mjs +2 -0
- package/dist/migration-tools__package.d.mts +3 -0
- package/dist/migration-tools__package.mjs +1 -0
- package/dist/migration-tools__ref-resolution.d.mts +2 -0
- package/dist/migration-tools__ref-resolution.mjs +2 -0
- package/dist/migration-tools__refs.d.mts +2 -0
- package/dist/migration-tools__refs.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +3 -0
- package/dist/migration-tools__spaces.mjs +3 -0
- package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
- package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
- package/dist/migration-ts-FyF55c4M.mjs +67 -0
- package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
- package/dist/package-N9PPdFV_.d.mts +3 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
- package/dist/publish-surface.d.mts +3 -0
- package/dist/publish-surface.mjs +3 -0
- package/dist/publish-surface__import-roots.d.mts +2 -0
- package/dist/publish-surface__import-roots.mjs +2 -0
- package/dist/publish-surface__shells.d.mts +2 -0
- package/dist/publish-surface__shells.mjs +2 -0
- package/dist/quick-reference-mongo.md +114 -0
- package/dist/quick-reference-postgres.md +93 -0
- package/dist/readme-mongo.md +35 -0
- package/dist/readme-postgres.md +34 -0
- package/dist/ref-B6cTthTi.mjs +171 -0
- package/dist/ref-B6cTthTi.mjs.map +1 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
- package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
- package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
- package/dist/ref-resolution-COGOSL57.d.mts +127 -0
- package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts +192 -0
- package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts.map +1 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
- package/dist/shells-BenrJHp2.mjs +602 -0
- package/dist/shells-BenrJHp2.mjs.map +1 -0
- package/dist/shells-COHV_Ozf.d.mts +135 -0
- package/dist/shells-COHV_Ozf.d.mts.map +1 -0
- package/dist/spaces-C27bA-xc.mjs +267 -0
- package/dist/spaces-C27bA-xc.mjs.map +1 -0
- package/dist/spaces-DxFj5y8l.d.mts +415 -0
- package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
- package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
- package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.d.mts +54 -0
- package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +303 -0
- package/dist/vite-plugin-contract-emit.mjs.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DZWEs4si-D8UlyJI0.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/types-DZWEs4si.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UAuBU,uBAAuB,0BAA0B;WAChD,QAAQ,sBAAsB,WAAW;WACzC,gBA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;;;;;;;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"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { F as formatDim, X as isVerbose, a as createColorFormatter } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
2
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
|
+
import { issueOutcome } from "@prisma/orm-framework/components/control";
|
|
4
|
+
import { bold, cyan, dim, green, magenta, red, yellow } from "colorette";
|
|
5
|
+
//#region ../../../1-framework/3-tooling/cli/dist/verify-DnVNjc5C.mjs
|
|
6
|
+
/** Human-readable label for each outcome, prefixed onto an issue's message for display. */
|
|
7
|
+
const OUTCOME_LABEL = {
|
|
8
|
+
"not-found": "missing",
|
|
9
|
+
"not-expected": "extra",
|
|
10
|
+
"not-equal": "mismatch"
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The issue's display text: its own path, prefixed with a human label for
|
|
14
|
+
* why it's flagged. Turning the presence-derived outcome (and the path) into
|
|
15
|
+
* prose is this formatter's job, not the differ's — the differ's issue is
|
|
16
|
+
* data (`path` + nodes), not prose.
|
|
17
|
+
*/
|
|
18
|
+
function formatIssueMessage(issue) {
|
|
19
|
+
return `${OUTCOME_LABEL[issueOutcome(issue)]}: ${issue.path.join("/")}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Formats human-readable output for database verify.
|
|
23
|
+
*/
|
|
24
|
+
function formatVerifyOutput(result, flags) {
|
|
25
|
+
if (flags.quiet) return "";
|
|
26
|
+
const lines = [];
|
|
27
|
+
const useColor = flags.color !== false;
|
|
28
|
+
const formatGreen = createColorFormatter(useColor, green);
|
|
29
|
+
const formatYellow = createColorFormatter(useColor, yellow);
|
|
30
|
+
const formatDimText = (text) => formatDim(useColor, text);
|
|
31
|
+
const verificationMode = result.mode === "full" ? `marker + schema${result.schema?.strict ? " (strict)" : " (tolerant)"}` : "marker only (--marker-only)";
|
|
32
|
+
lines.push(`${formatGreen("✔")} ${result.summary}`);
|
|
33
|
+
lines.push(`${formatDimText(` verification: ${verificationMode}`)}`);
|
|
34
|
+
lines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);
|
|
35
|
+
if (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);
|
|
36
|
+
if (result.schema?.warnings && result.schema.warnings.length > 0) {
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push(formatYellow("Schema warnings:"));
|
|
39
|
+
for (const message of result.schema.warnings) lines.push(` ${formatYellow("⚠")} ${message}`);
|
|
40
|
+
}
|
|
41
|
+
if (result.unclaimed && result.unclaimed.length > 0) {
|
|
42
|
+
lines.push("");
|
|
43
|
+
lines.push(formatYellow("Unclaimed elements (declared by no contract):"));
|
|
44
|
+
for (const name of result.unclaimed) lines.push(` ${formatYellow("⚠")} ${name}`);
|
|
45
|
+
}
|
|
46
|
+
if (result.warning) {
|
|
47
|
+
lines.push("");
|
|
48
|
+
lines.push(`${formatYellow("⚠")} ${result.warning}`);
|
|
49
|
+
}
|
|
50
|
+
if (isVerbose(flags, 1)) {
|
|
51
|
+
if (result.codecCoverageSkipped) lines.push(`${formatDimText(" Codec coverage check skipped (helper returned no supported types)")}`);
|
|
52
|
+
lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
|
|
53
|
+
}
|
|
54
|
+
return lines.join("\n");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Formats JSON output for database verify.
|
|
58
|
+
*/
|
|
59
|
+
function formatVerifyJson(result) {
|
|
60
|
+
const output = {
|
|
61
|
+
ok: result.ok,
|
|
62
|
+
summary: result.summary,
|
|
63
|
+
mode: result.mode,
|
|
64
|
+
contract: result.contract,
|
|
65
|
+
...ifDefined("marker", result.marker),
|
|
66
|
+
target: result.target,
|
|
67
|
+
...ifDefined("missingCodecs", result.missingCodecs),
|
|
68
|
+
...ifDefined("codecCoverageSkipped", result.codecCoverageSkipped),
|
|
69
|
+
...ifDefined("schema", result.schema),
|
|
70
|
+
unclaimed: result.unclaimed ?? [],
|
|
71
|
+
...ifDefined("warning", result.warning),
|
|
72
|
+
...ifDefined("meta", result.meta),
|
|
73
|
+
timings: result.timings
|
|
74
|
+
};
|
|
75
|
+
return JSON.stringify(output, null, 2);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Formats JSON output for database introspection.
|
|
79
|
+
*/
|
|
80
|
+
function formatIntrospectJson(result) {
|
|
81
|
+
return JSON.stringify(result, null, 2);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Renders a schema tree structure from CoreSchemaView.
|
|
85
|
+
* Status-glyph tree styling shared with the retired verification-tree renderer.
|
|
86
|
+
*/
|
|
87
|
+
function renderSchemaTree(node, flags, options) {
|
|
88
|
+
const { isLast, prefix, useColor, formatDimText, isRoot = false } = options;
|
|
89
|
+
const lines = [];
|
|
90
|
+
let formattedLabel = node.label;
|
|
91
|
+
if (useColor) switch (node.kind) {
|
|
92
|
+
case "root":
|
|
93
|
+
formattedLabel = bold(node.label);
|
|
94
|
+
break;
|
|
95
|
+
case "entity": {
|
|
96
|
+
const tableMatch = node.label.match(/^table\s+(.+)$/);
|
|
97
|
+
if (tableMatch?.[1]) {
|
|
98
|
+
const tableName = tableMatch[1];
|
|
99
|
+
formattedLabel = `${dim("table")} ${cyan(tableName)}`;
|
|
100
|
+
} else formattedLabel = cyan(node.label);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case "collection":
|
|
104
|
+
formattedLabel = dim(node.label);
|
|
105
|
+
break;
|
|
106
|
+
case "field": {
|
|
107
|
+
const columnMatch = node.label.match(/^([^:]+):\s*(.+)$/);
|
|
108
|
+
if (columnMatch?.[1] && columnMatch[2]) {
|
|
109
|
+
const columnName = columnMatch[1];
|
|
110
|
+
const rest = columnMatch[2];
|
|
111
|
+
const typeMatch = rest.match(/^([^\s(]+)\s*(\([^)]+\))$/);
|
|
112
|
+
if (typeMatch?.[1] && typeMatch[2]) {
|
|
113
|
+
const typeDisplay = typeMatch[1];
|
|
114
|
+
const nullability = typeMatch[2];
|
|
115
|
+
formattedLabel = `${cyan(columnName)}: ${typeDisplay} ${dim(nullability)}`;
|
|
116
|
+
} else formattedLabel = `${cyan(columnName)}: ${rest}`;
|
|
117
|
+
} else formattedLabel = node.label;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "index": {
|
|
121
|
+
const pkMatch = node.label.match(/^primary key:\s*(.+)$/);
|
|
122
|
+
if (pkMatch?.[1]) {
|
|
123
|
+
const columnNames = pkMatch[1];
|
|
124
|
+
formattedLabel = `${dim("primary key")}: ${cyan(columnNames)}`;
|
|
125
|
+
} else {
|
|
126
|
+
const uniqueMatch = node.label.match(/^unique\s+(.+)$/);
|
|
127
|
+
if (uniqueMatch?.[1]) {
|
|
128
|
+
const name = uniqueMatch[1];
|
|
129
|
+
formattedLabel = `${dim("unique")} ${cyan(name)}`;
|
|
130
|
+
} else {
|
|
131
|
+
const indexMatch = node.label.match(/^(unique\s+)?index\s+(.+)$/);
|
|
132
|
+
if (indexMatch?.[2]) {
|
|
133
|
+
const indexPrefix = indexMatch[1] ? `${dim("unique")} ` : "";
|
|
134
|
+
const name = indexMatch[2];
|
|
135
|
+
formattedLabel = `${indexPrefix}${dim("index")} ${cyan(name)}`;
|
|
136
|
+
} else formattedLabel = dim(node.label);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "dependency": {
|
|
142
|
+
const extMatch = node.label.match(/^([^\s]+)\s+(extension is enabled)$/);
|
|
143
|
+
if (extMatch?.[1] && extMatch[2]) {
|
|
144
|
+
const extName = extMatch[1];
|
|
145
|
+
const rest = extMatch[2];
|
|
146
|
+
formattedLabel = `${cyan(extName)} ${dim(rest)}`;
|
|
147
|
+
} else formattedLabel = magenta(node.label);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
default:
|
|
151
|
+
formattedLabel = node.label;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
if (isRoot) lines.push(formattedLabel);
|
|
155
|
+
else {
|
|
156
|
+
const treePrefix = `${formatDimText(isLast ? "└" : "├")}─ `;
|
|
157
|
+
lines.push(`${prefix}${treePrefix}${formattedLabel}`);
|
|
158
|
+
}
|
|
159
|
+
if (node.children && node.children.length > 0) {
|
|
160
|
+
const childPrefix = isRoot ? "" : `${prefix}${isLast ? " " : `${formatDimText("│")} `}`;
|
|
161
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
162
|
+
const child = node.children[i];
|
|
163
|
+
if (!child) continue;
|
|
164
|
+
const childLines = renderSchemaTree(child, flags, {
|
|
165
|
+
isLast: i === node.children.length - 1,
|
|
166
|
+
prefix: childPrefix,
|
|
167
|
+
useColor,
|
|
168
|
+
formatDimText,
|
|
169
|
+
isRoot: false
|
|
170
|
+
});
|
|
171
|
+
lines.push(...childLines);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return lines;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Formats human-readable output for database introspection.
|
|
178
|
+
*/
|
|
179
|
+
function formatIntrospectOutput(result, schemaView, flags) {
|
|
180
|
+
if (flags.quiet) return "";
|
|
181
|
+
const lines = [];
|
|
182
|
+
const useColor = flags.color !== false;
|
|
183
|
+
const formatDimText = (text) => formatDim(useColor, text);
|
|
184
|
+
if (schemaView) {
|
|
185
|
+
const treeLines = renderSchemaTree(schemaView.root, flags, {
|
|
186
|
+
isLast: true,
|
|
187
|
+
prefix: "",
|
|
188
|
+
useColor,
|
|
189
|
+
formatDimText,
|
|
190
|
+
isRoot: true
|
|
191
|
+
});
|
|
192
|
+
lines.push(...treeLines);
|
|
193
|
+
} else {
|
|
194
|
+
lines.push(`✔ ${result.summary}`);
|
|
195
|
+
if (isVerbose(flags, 1)) {
|
|
196
|
+
lines.push(` Target: ${result.target.familyId}/${result.target.id}`);
|
|
197
|
+
if (result.meta?.dbUrl) lines.push(` Database: ${result.meta.dbUrl}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
|
|
201
|
+
return lines.join("\n");
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Formats human-readable output for database schema verification.
|
|
205
|
+
*/
|
|
206
|
+
function formatSchemaVerifyOutput(result, flags, unclaimed = []) {
|
|
207
|
+
if (flags.quiet) return "";
|
|
208
|
+
const lines = [];
|
|
209
|
+
const useColor = flags.color !== false;
|
|
210
|
+
const formatGreen = createColorFormatter(useColor, green);
|
|
211
|
+
const formatRed = createColorFormatter(useColor, red);
|
|
212
|
+
const formatYellow = createColorFormatter(useColor, yellow);
|
|
213
|
+
const formatDimText = (text) => formatDim(useColor, text);
|
|
214
|
+
const issueMessages = result.schema.issues.map(formatIssueMessage);
|
|
215
|
+
if (issueMessages.length > 0) {
|
|
216
|
+
lines.push(formatRed("Schema issues:"));
|
|
217
|
+
for (const message of issueMessages) lines.push(` ${formatRed("✖")} ${message}`);
|
|
218
|
+
}
|
|
219
|
+
const warningMessages = (result.schema.warnings?.issues ?? []).map(formatIssueMessage);
|
|
220
|
+
if (warningMessages.length > 0) {
|
|
221
|
+
if (lines.length > 0) lines.push("");
|
|
222
|
+
lines.push(formatYellow("Schema warnings:"));
|
|
223
|
+
for (const message of warningMessages) lines.push(` ${formatYellow("⚠")} ${message}`);
|
|
224
|
+
}
|
|
225
|
+
if (unclaimed.length > 0) {
|
|
226
|
+
const strict = result.meta?.strict ?? false;
|
|
227
|
+
if (lines.length > 0) lines.push("");
|
|
228
|
+
lines.push((strict ? formatRed : formatYellow)("Unclaimed elements (declared by no contract):"));
|
|
229
|
+
for (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? "✖" : "⚠")} ${name}`);
|
|
230
|
+
}
|
|
231
|
+
if (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
|
|
232
|
+
if (lines.length > 0) lines.push("");
|
|
233
|
+
if (result.ok) lines.push(`${formatGreen("✔")} ${result.summary}`);
|
|
234
|
+
else {
|
|
235
|
+
const codeText = result.code ? ` (${result.code})` : "";
|
|
236
|
+
lines.push(`${formatRed("✖")} ${result.summary}${codeText}`);
|
|
237
|
+
}
|
|
238
|
+
return lines.join("\n");
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Formats JSON output for database schema verification. The unclaimed-elements
|
|
242
|
+
* list is a top-level field alongside the combined result, reported once for
|
|
243
|
+
* the whole database.
|
|
244
|
+
*/
|
|
245
|
+
function formatSchemaVerifyJson(result, unclaimed = []) {
|
|
246
|
+
return JSON.stringify({
|
|
247
|
+
...result,
|
|
248
|
+
unclaimed
|
|
249
|
+
}, null, 2);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Formats human-readable output for database sign.
|
|
253
|
+
*/
|
|
254
|
+
function formatSignOutput(result, flags) {
|
|
255
|
+
if (flags.quiet) return "";
|
|
256
|
+
const lines = [];
|
|
257
|
+
const useColor = flags.color !== false;
|
|
258
|
+
const formatGreen = createColorFormatter(useColor, green);
|
|
259
|
+
const formatDimText = (text) => formatDim(useColor, text);
|
|
260
|
+
if (result.ok) {
|
|
261
|
+
lines.push(`${formatGreen("✔")} Database signed`);
|
|
262
|
+
const previousHash = result.marker.previous?.storageHash ?? "none";
|
|
263
|
+
const currentHash = result.contract.storageHash;
|
|
264
|
+
lines.push(`${formatDimText(` from: ${previousHash}`)}`);
|
|
265
|
+
lines.push(`${formatDimText(` to: ${currentHash}`)}`);
|
|
266
|
+
if (isVerbose(flags, 1)) {
|
|
267
|
+
if (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);
|
|
268
|
+
if (result.marker.previous?.profileHash) lines.push(`${formatDimText(` previous profileHash: ${result.marker.previous.profileHash}`)}`);
|
|
269
|
+
lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return lines.join("\n");
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Formats JSON output for database sign.
|
|
276
|
+
*/
|
|
277
|
+
function formatSignJson(result) {
|
|
278
|
+
return JSON.stringify(result, null, 2);
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
export { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };
|
|
282
|
+
|
|
283
|
+
//# sourceMappingURL=verify-DnVNjc5C-BGdsblBK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-DnVNjc5C-BGdsblBK.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/verify-DnVNjc5C.mjs"],"sourcesContent":["import { M as createColorFormatter, N as formatDim, P as isVerbose } from \"./command-helpers-CAoXqAY9.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { bold, cyan, dim, green, magenta, red, yellow } from \"colorette\";\n//#region src/utils/formatters/verify.ts\n/** Human-readable label for each outcome, prefixed onto an issue's message for display. */\nconst OUTCOME_LABEL = {\n\t\"not-found\": \"missing\",\n\t\"not-expected\": \"extra\",\n\t\"not-equal\": \"mismatch\"\n};\n/**\n* The issue's display text: its own path, prefixed with a human label for\n* why it's flagged. Turning the presence-derived outcome (and the path) into\n* prose is this formatter's job, not the differ's — the differ's issue is\n* data (`path` + nodes), not prose.\n*/\nfunction formatIssueMessage(issue) {\n\treturn `${OUTCOME_LABEL[issueOutcome(issue)]}: ${issue.path.join(\"/\")}`;\n}\n/**\n* Formats human-readable output for database verify.\n*/\nfunction formatVerifyOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst verificationMode = result.mode === \"full\" ? `marker + schema${result.schema?.strict ? \" (strict)\" : \" (tolerant)\"}` : \"marker only (--marker-only)\";\n\tlines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\tlines.push(`${formatDimText(` verification: ${verificationMode}`)}`);\n\tlines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);\n\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\tif (result.schema?.warnings && result.schema.warnings.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of result.schema.warnings) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (result.unclaimed && result.unclaimed.length > 0) {\n\t\tlines.push(\"\");\n\t\tlines.push(formatYellow(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of result.unclaimed) lines.push(` ${formatYellow(\"⚠\")} ${name}`);\n\t}\n\tif (result.warning) {\n\t\tlines.push(\"\");\n\t\tlines.push(`${formatYellow(\"⚠\")} ${result.warning}`);\n\t}\n\tif (isVerbose(flags, 1)) {\n\t\tif (result.codecCoverageSkipped) lines.push(`${formatDimText(\" Codec coverage check skipped (helper returned no supported types)\")}`);\n\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database verify.\n*/\nfunction formatVerifyJson(result) {\n\tconst output = {\n\t\tok: result.ok,\n\t\tsummary: result.summary,\n\t\tmode: result.mode,\n\t\tcontract: result.contract,\n\t\t...ifDefined(\"marker\", result.marker),\n\t\ttarget: result.target,\n\t\t...ifDefined(\"missingCodecs\", result.missingCodecs),\n\t\t...ifDefined(\"codecCoverageSkipped\", result.codecCoverageSkipped),\n\t\t...ifDefined(\"schema\", result.schema),\n\t\tunclaimed: result.unclaimed ?? [],\n\t\t...ifDefined(\"warning\", result.warning),\n\t\t...ifDefined(\"meta\", result.meta),\n\t\ttimings: result.timings\n\t};\n\treturn JSON.stringify(output, null, 2);\n}\n/**\n* Formats JSON output for database introspection.\n*/\nfunction formatIntrospectJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n/**\n* Renders a schema tree structure from CoreSchemaView.\n* Status-glyph tree styling shared with the retired verification-tree renderer.\n*/\nfunction renderSchemaTree(node, flags, options) {\n\tconst { isLast, prefix, useColor, formatDimText, isRoot = false } = options;\n\tconst lines = [];\n\tlet formattedLabel = node.label;\n\tif (useColor) switch (node.kind) {\n\t\tcase \"root\":\n\t\t\tformattedLabel = bold(node.label);\n\t\t\tbreak;\n\t\tcase \"entity\": {\n\t\t\tconst tableMatch = node.label.match(/^table\\s+(.+)$/);\n\t\t\tif (tableMatch?.[1]) {\n\t\t\t\tconst tableName = tableMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"table\")} ${cyan(tableName)}`;\n\t\t\t} else formattedLabel = cyan(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"collection\":\n\t\t\tformattedLabel = dim(node.label);\n\t\t\tbreak;\n\t\tcase \"field\": {\n\t\t\tconst columnMatch = node.label.match(/^([^:]+):\\s*(.+)$/);\n\t\t\tif (columnMatch?.[1] && columnMatch[2]) {\n\t\t\t\tconst columnName = columnMatch[1];\n\t\t\t\tconst rest = columnMatch[2];\n\t\t\t\tconst typeMatch = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n\t\t\t\tif (typeMatch?.[1] && typeMatch[2]) {\n\t\t\t\t\tconst typeDisplay = typeMatch[1];\n\t\t\t\t\tconst nullability = typeMatch[2];\n\t\t\t\t\tformattedLabel = `${cyan(columnName)}: ${typeDisplay} ${dim(nullability)}`;\n\t\t\t\t} else formattedLabel = `${cyan(columnName)}: ${rest}`;\n\t\t\t} else formattedLabel = node.label;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"index\": {\n\t\t\tconst pkMatch = node.label.match(/^primary key:\\s*(.+)$/);\n\t\t\tif (pkMatch?.[1]) {\n\t\t\t\tconst columnNames = pkMatch[1];\n\t\t\t\tformattedLabel = `${dim(\"primary key\")}: ${cyan(columnNames)}`;\n\t\t\t} else {\n\t\t\t\tconst uniqueMatch = node.label.match(/^unique\\s+(.+)$/);\n\t\t\t\tif (uniqueMatch?.[1]) {\n\t\t\t\t\tconst name = uniqueMatch[1];\n\t\t\t\t\tformattedLabel = `${dim(\"unique\")} ${cyan(name)}`;\n\t\t\t\t} else {\n\t\t\t\t\tconst indexMatch = node.label.match(/^(unique\\s+)?index\\s+(.+)$/);\n\t\t\t\t\tif (indexMatch?.[2]) {\n\t\t\t\t\t\tconst indexPrefix = indexMatch[1] ? `${dim(\"unique\")} ` : \"\";\n\t\t\t\t\t\tconst name = indexMatch[2];\n\t\t\t\t\t\tformattedLabel = `${indexPrefix}${dim(\"index\")} ${cyan(name)}`;\n\t\t\t\t\t} else formattedLabel = dim(node.label);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"dependency\": {\n\t\t\tconst extMatch = node.label.match(/^([^\\s]+)\\s+(extension is enabled)$/);\n\t\t\tif (extMatch?.[1] && extMatch[2]) {\n\t\t\t\tconst extName = extMatch[1];\n\t\t\t\tconst rest = extMatch[2];\n\t\t\t\tformattedLabel = `${cyan(extName)} ${dim(rest)}`;\n\t\t\t} else formattedLabel = magenta(node.label);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tformattedLabel = node.label;\n\t\t\tbreak;\n\t}\n\tif (isRoot) lines.push(formattedLabel);\n\telse {\n\t\tconst treePrefix = `${formatDimText(isLast ? \"└\" : \"├\")}─ `;\n\t\tlines.push(`${prefix}${treePrefix}${formattedLabel}`);\n\t}\n\tif (node.children && node.children.length > 0) {\n\t\tconst childPrefix = isRoot ? \"\" : `${prefix}${isLast ? \" \" : `${formatDimText(\"│\")} `}`;\n\t\tfor (let i = 0; i < node.children.length; i++) {\n\t\t\tconst child = node.children[i];\n\t\t\tif (!child) continue;\n\t\t\tconst childLines = renderSchemaTree(child, flags, {\n\t\t\t\tisLast: i === node.children.length - 1,\n\t\t\t\tprefix: childPrefix,\n\t\t\t\tuseColor,\n\t\t\t\tformatDimText,\n\t\t\t\tisRoot: false\n\t\t\t});\n\t\t\tlines.push(...childLines);\n\t\t}\n\t}\n\treturn lines;\n}\n/**\n* Formats human-readable output for database introspection.\n*/\nfunction formatIntrospectOutput(result, schemaView, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (schemaView) {\n\t\tconst treeLines = renderSchemaTree(schemaView.root, flags, {\n\t\t\tisLast: true,\n\t\t\tprefix: \"\",\n\t\t\tuseColor,\n\t\t\tformatDimText,\n\t\t\tisRoot: true\n\t\t});\n\t\tlines.push(...treeLines);\n\t} else {\n\t\tlines.push(`✔ ${result.summary}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tlines.push(` Target: ${result.target.familyId}/${result.target.id}`);\n\t\t\tif (result.meta?.dbUrl) lines.push(` Database: ${result.meta.dbUrl}`);\n\t\t}\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats human-readable output for database schema verification.\n*/\nfunction formatSchemaVerifyOutput(result, flags, unclaimed = []) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatRed = createColorFormatter(useColor, red);\n\tconst formatYellow = createColorFormatter(useColor, yellow);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tconst issueMessages = result.schema.issues.map(formatIssueMessage);\n\tif (issueMessages.length > 0) {\n\t\tlines.push(formatRed(\"Schema issues:\"));\n\t\tfor (const message of issueMessages) lines.push(` ${formatRed(\"✖\")} ${message}`);\n\t}\n\tconst warningMessages = (result.schema.warnings?.issues ?? []).map(formatIssueMessage);\n\tif (warningMessages.length > 0) {\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push(formatYellow(\"Schema warnings:\"));\n\t\tfor (const message of warningMessages) lines.push(` ${formatYellow(\"⚠\")} ${message}`);\n\t}\n\tif (unclaimed.length > 0) {\n\t\tconst strict = result.meta?.strict ?? false;\n\t\tif (lines.length > 0) lines.push(\"\");\n\t\tlines.push((strict ? formatRed : formatYellow)(\"Unclaimed elements (declared by no contract):\"));\n\t\tfor (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? \"✖\" : \"⚠\")} ${name}`);\n\t}\n\tif (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\tif (lines.length > 0) lines.push(\"\");\n\tif (result.ok) lines.push(`${formatGreen(\"✔\")} ${result.summary}`);\n\telse {\n\t\tconst codeText = result.code ? ` (${result.code})` : \"\";\n\t\tlines.push(`${formatRed(\"✖\")} ${result.summary}${codeText}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database schema verification. The unclaimed-elements\n* list is a top-level field alongside the combined result, reported once for\n* the whole database.\n*/\nfunction formatSchemaVerifyJson(result, unclaimed = []) {\n\treturn JSON.stringify({\n\t\t...result,\n\t\tunclaimed\n\t}, null, 2);\n}\n/**\n* Formats human-readable output for database sign.\n*/\nfunction formatSignOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst lines = [];\n\tconst useColor = flags.color !== false;\n\tconst formatGreen = createColorFormatter(useColor, green);\n\tconst formatDimText = (text) => formatDim(useColor, text);\n\tif (result.ok) {\n\t\tlines.push(`${formatGreen(\"✔\")} Database signed`);\n\t\tconst previousHash = result.marker.previous?.storageHash ?? \"none\";\n\t\tconst currentHash = result.contract.storageHash;\n\t\tlines.push(`${formatDimText(` from: ${previousHash}`)}`);\n\t\tlines.push(`${formatDimText(` to: ${currentHash}`)}`);\n\t\tif (isVerbose(flags, 1)) {\n\t\t\tif (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n\t\t\tif (result.marker.previous?.profileHash) lines.push(`${formatDimText(` previous profileHash: ${result.marker.previous.profileHash}`)}`);\n\t\t\tlines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Formats JSON output for database sign.\n*/\nfunction formatSignJson(result) {\n\treturn JSON.stringify(result, null, 2);\n}\n//#endregion\nexport { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };\n\n//# sourceMappingURL=verify-DnVNjc5C.mjs.map"],"mappings":";;;;;;AAMA,MAAM,gBAAgB;CACrB,aAAa;CACb,gBA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AAG,cAAc,iBAAiB,OAAO,QAAQ,MAAM,GAAG,GAAG;EACzE;CACD;CACA,OAAO,MAAM,KAAK,IAAI;AACvB;;;;AAIA,SAAS,eAAe,QAAQ;CAC/B,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACtC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
import { t as MANIFEST_FILE } from "./io-C8TdyBKt-DloEBi70.mjs";
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
5
|
+
import { APP_SPACE_ID as APP_SPACE_ID$1, CONTRACT_SNAPSHOTS_DIRNAME } from "@prisma/orm-framework/components/control";
|
|
6
|
+
//#region ../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-BZDcJsuA.mjs
|
|
7
|
+
/**
|
|
8
|
+
* Pattern a contract-space identifier must match. The constraint is
|
|
9
|
+
* filesystem-friendly: lowercase letters / digits / hyphen / underscore,
|
|
10
|
+
* starts with a letter, max 64 characters.
|
|
11
|
+
*/
|
|
12
|
+
const SPACE_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
13
|
+
function isValidSpaceId(spaceId) {
|
|
14
|
+
return SPACE_ID_PATTERN.test(spaceId);
|
|
15
|
+
}
|
|
16
|
+
function assertValidSpaceId(spaceId) {
|
|
17
|
+
if (!isValidSpaceId(spaceId)) throw errorInvalidSpaceId(spaceId);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the migrations subdirectory for a given contract space.
|
|
21
|
+
*
|
|
22
|
+
* Every contract space — including the app space (default `'app'`) —
|
|
23
|
+
* lands under `<projectMigrationsDir>/<spaceId>/`. The space id is
|
|
24
|
+
* validated against {@link SPACE_ID_PATTERN} because it becomes a
|
|
25
|
+
* filesystem directory name verbatim.
|
|
26
|
+
*
|
|
27
|
+
* `projectMigrationsDir` is the project's top-level `migrations/`
|
|
28
|
+
* directory; the helper does not assume anything about its absolute /
|
|
29
|
+
* relative shape and is symmetric with `pathe.join`.
|
|
30
|
+
*/
|
|
31
|
+
function spaceMigrationDirectory(projectMigrationsDir, spaceId) {
|
|
32
|
+
assertValidSpaceId(spaceId);
|
|
33
|
+
return join(projectMigrationsDir, spaceId);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Per-space subdirectory name reserved for the ref store
|
|
37
|
+
* (`migrations/<space>/<SPACE_REFS_DIRNAME>/*.json`). Single source of
|
|
38
|
+
* truth: every helper that composes a per-space refs path imports this
|
|
39
|
+
* constant, and the enumerator uses it (via
|
|
40
|
+
* {@link RESERVED_SPACE_SUBDIR_NAMES}) to exclude reserved names from
|
|
41
|
+
* the contract-space candidate list.
|
|
42
|
+
*/
|
|
43
|
+
const SPACE_REFS_DIRNAME = "refs";
|
|
44
|
+
/**
|
|
45
|
+
* Names reserved under `migrations/` that must never be enumerated as a
|
|
46
|
+
* phantom contract space: `SPACE_REFS_DIRNAME` (e.g. a top-level
|
|
47
|
+
* `migrations/refs/` left in the wrong place) and
|
|
48
|
+
* `CONTRACT_SNAPSHOTS_DIRNAME` (the migrations-root-wide contract
|
|
49
|
+
* snapshot store, `migrations/snapshots/`).
|
|
50
|
+
*/
|
|
51
|
+
const RESERVED_SPACE_SUBDIR_NAMES = /* @__PURE__ */ new Set([SPACE_REFS_DIRNAME, CONTRACT_SNAPSHOTS_DIRNAME]);
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the per-space refs directory for `spaceMigrationsDir`
|
|
54
|
+
* (typically the value returned by {@link spaceMigrationDirectory}).
|
|
55
|
+
* Composes the canonical {@link SPACE_REFS_DIRNAME} so callers do not
|
|
56
|
+
* hard-code the literal.
|
|
57
|
+
*/
|
|
58
|
+
function spaceRefsDirectory(spaceMigrationsDir) {
|
|
59
|
+
return join(spaceMigrationsDir, SPACE_REFS_DIRNAME);
|
|
60
|
+
}
|
|
61
|
+
function hasErrnoCode$1(error, code) {
|
|
62
|
+
return error instanceof Error && error.code === code;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read the head ref (`hash` + `invariants`) for a contract space from
|
|
66
|
+
* `<projectMigrationsDir>/<spaceId>/refs/head.json`.
|
|
67
|
+
*
|
|
68
|
+
* Returns `null` when the file does not exist (first emit). Surfaces
|
|
69
|
+
* `MIGRATION.INVALID_JSON` / `MIGRATION.INVALID_REF_FILE` on a corrupt
|
|
70
|
+
* `refs/head.json` so callers can distinguish "no head ref on disk"
|
|
71
|
+
* (returns `null`) from "head ref present but unreadable" (throws).
|
|
72
|
+
*
|
|
73
|
+
* Validates the space id against `[a-z][a-z0-9_-]{0,63}` for the same
|
|
74
|
+
* filesystem-safety reasons as the rest of the per-space helpers. The
|
|
75
|
+
* helper is uniform across the app and extension spaces.
|
|
76
|
+
*/
|
|
77
|
+
async function readContractSpaceHeadRef(projectMigrationsDir, spaceId) {
|
|
78
|
+
assertValidSpaceId(spaceId);
|
|
79
|
+
const filePath = join(spaceRefsDirectory(spaceMigrationDirectory(projectMigrationsDir, spaceId)), "head.json");
|
|
80
|
+
let raw;
|
|
81
|
+
try {
|
|
82
|
+
raw = await readFile(filePath, "utf-8");
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (hasErrnoCode$1(error, "ENOENT")) return null;
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
let parsed;
|
|
88
|
+
try {
|
|
89
|
+
parsed = JSON.parse(raw);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
throw errorInvalidJson(filePath, e instanceof Error ? e.message : String(e));
|
|
92
|
+
}
|
|
93
|
+
if (typeof parsed !== "object" || parsed === null) throw errorInvalidRefFile(filePath, "expected an object");
|
|
94
|
+
const obj = parsed;
|
|
95
|
+
if (typeof obj.hash !== "string") throw errorInvalidRefFile(filePath, "expected an object with a string `hash` field");
|
|
96
|
+
if (!Array.isArray(obj.invariants) || obj.invariants.some((value) => typeof value !== "string")) throw errorInvalidRefFile(filePath, "expected an object with an `invariants` array of strings");
|
|
97
|
+
return {
|
|
98
|
+
hash: obj.hash,
|
|
99
|
+
invariants: obj.invariants
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function hasErrnoCode(error, code) {
|
|
103
|
+
return error instanceof Error && error.code === code;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* List the per-space subdirectories under
|
|
107
|
+
* `<projectRoot>/migrations/`. Returns space-id directory names (sorted
|
|
108
|
+
* alphabetically) — i.e. any non-dot-prefixed, non-reserved
|
|
109
|
+
* ({@link RESERVED_SPACE_SUBDIR_NAMES}) subdirectory whose root does
|
|
110
|
+
* **not** contain a `migration.json` manifest. The manifest is the
|
|
111
|
+
* structural marker of a user-authored migration directory (see
|
|
112
|
+
* `readMigrationsDir` in `./io`); directory names themselves belong to
|
|
113
|
+
* the user and are not part of the contract. The reserved-name filter
|
|
114
|
+
* keeps `migrations/snapshots/` (the contract snapshot store) from ever
|
|
115
|
+
* being enumerated as a phantom contract space.
|
|
116
|
+
*
|
|
117
|
+
* Returns `[]` if the migrations directory does not exist (greenfield
|
|
118
|
+
* project).
|
|
119
|
+
*
|
|
120
|
+
* Reads only the user's repo. **No descriptor import.** The caller
|
|
121
|
+
* (verifier) feeds the result into {@link verifyContractSpaces} alongside
|
|
122
|
+
* the loaded-space set and the marker rows.
|
|
123
|
+
*/
|
|
124
|
+
async function listContractSpaceDirectories(projectMigrationsDir) {
|
|
125
|
+
let entries;
|
|
126
|
+
try {
|
|
127
|
+
entries = (await readdir(projectMigrationsDir, { withFileTypes: true })).map((d) => ({
|
|
128
|
+
name: d.name,
|
|
129
|
+
isDirectory: d.isDirectory()
|
|
130
|
+
}));
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (hasErrnoCode(error, "ENOENT")) return [];
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
const namedCandidates = entries.filter((e) => e.isDirectory).map((e) => e.name).filter((name) => !name.startsWith(".")).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).sort();
|
|
136
|
+
return (await Promise.all(namedCandidates.map(async (name) => {
|
|
137
|
+
try {
|
|
138
|
+
await stat(join(projectMigrationsDir, name, MANIFEST_FILE));
|
|
139
|
+
return {
|
|
140
|
+
name,
|
|
141
|
+
isMigrationDir: true
|
|
142
|
+
};
|
|
143
|
+
} catch (error) {
|
|
144
|
+
if (hasErrnoCode(error, "ENOENT")) return {
|
|
145
|
+
name,
|
|
146
|
+
isMigrationDir: false
|
|
147
|
+
};
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}))).filter((c) => !c.isMigrationDir).map((c) => c.name);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Pure structural verifier for the per-space mechanism. Aggregates the
|
|
154
|
+
* three orphan / missing checks plus per-space hash and invariant
|
|
155
|
+
* comparison.
|
|
156
|
+
*
|
|
157
|
+
* Algorithm:
|
|
158
|
+
*
|
|
159
|
+
* - For every extension space declared in `loadedSpaces` (`'app'`
|
|
160
|
+
* excluded — the per-space verifier is scoped to extension spaces;
|
|
161
|
+
* the app is verified through the aggregate path):
|
|
162
|
+
* - If no contract-space dir on disk → `declaredButUnmigrated`.
|
|
163
|
+
* - Else if `markerRowsBySpace` lacks an entry → no violation here;
|
|
164
|
+
* the live-DB compare done outside this helper is where the
|
|
165
|
+
* absence shows up.
|
|
166
|
+
* - Else compare marker hash / invariants vs. on-disk head hash /
|
|
167
|
+
* invariants → `hashMismatch` / `invariantsMismatch` on drift.
|
|
168
|
+
* - For every contract-space dir on disk that is not in `loadedSpaces` →
|
|
169
|
+
* `orphanSpaceDir`.
|
|
170
|
+
* - For every marker row whose `space` is not in `loadedSpaces` →
|
|
171
|
+
* `orphanMarker`. The app-space marker is always loaded (`'app'` is
|
|
172
|
+
* in `loadedSpaces` by definition).
|
|
173
|
+
*
|
|
174
|
+
* Output is deterministic: violations are sorted first by `kind`
|
|
175
|
+
* (`declaredButUnmigrated` → `orphanMarker` → `orphanSpaceDir` →
|
|
176
|
+
* `hashMismatch` → `invariantsMismatch`) then by `spaceId`. Two callers
|
|
177
|
+
* passing equivalent inputs see byte-identical violation lists.
|
|
178
|
+
*
|
|
179
|
+
* Synchronous, pure, no I/O. **Does not import the extension descriptor**
|
|
180
|
+
* (the inputs are pre-resolved by the caller); the verifier reads only
|
|
181
|
+
* the user repo, not `node_modules`.
|
|
182
|
+
*/
|
|
183
|
+
function verifyContractSpaces(inputs) {
|
|
184
|
+
const violations = [];
|
|
185
|
+
for (const spaceId of [...inputs.loadedSpaces].sort()) {
|
|
186
|
+
if (spaceId === APP_SPACE_ID$1) continue;
|
|
187
|
+
if (!inputs.spaceDirsOnDisk.includes(spaceId)) {
|
|
188
|
+
violations.push({
|
|
189
|
+
kind: "declaredButUnmigrated",
|
|
190
|
+
spaceId,
|
|
191
|
+
remediation: `Extension '${spaceId}' is declared in extensions but has not been emitted; run \`prisma-next migrate\`.`
|
|
192
|
+
});
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const head = inputs.headRefsBySpace.get(spaceId);
|
|
196
|
+
const marker = inputs.markerRowsBySpace.get(spaceId);
|
|
197
|
+
if (!head || !marker) continue;
|
|
198
|
+
if (head.hash !== marker.hash) {
|
|
199
|
+
violations.push({
|
|
200
|
+
kind: "hashMismatch",
|
|
201
|
+
spaceId,
|
|
202
|
+
priorHeadHash: head.hash,
|
|
203
|
+
markerHash: marker.hash,
|
|
204
|
+
remediation: `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.`
|
|
205
|
+
});
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const onDiskInvariants = [...head.invariants].sort();
|
|
209
|
+
const markerInvariants = new Set(marker.invariants);
|
|
210
|
+
const missing = onDiskInvariants.filter((id) => !markerInvariants.has(id));
|
|
211
|
+
if (missing.length > 0) violations.push({
|
|
212
|
+
kind: "invariantsMismatch",
|
|
213
|
+
spaceId,
|
|
214
|
+
onDiskInvariants,
|
|
215
|
+
markerInvariants: [...marker.invariants].sort(),
|
|
216
|
+
remediation: `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.`
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
for (const dir of [...inputs.spaceDirsOnDisk].sort()) if (!inputs.loadedSpaces.has(dir)) violations.push({
|
|
220
|
+
kind: "orphanSpaceDir",
|
|
221
|
+
spaceId: dir,
|
|
222
|
+
remediation: `Orphan contract-space directory \`${join("migrations", dir)}/\` for an extension not in extensions; remove the directory or re-add the extension.`
|
|
223
|
+
});
|
|
224
|
+
for (const space of [...inputs.markerRowsBySpace.keys()].sort()) if (!inputs.loadedSpaces.has(space)) violations.push({
|
|
225
|
+
kind: "orphanMarker",
|
|
226
|
+
spaceId: space,
|
|
227
|
+
remediation: `Orphan marker row for space '${space}' (no longer in extensions); remediation: manually delete the row from \`prisma_contract.marker\`.`
|
|
228
|
+
});
|
|
229
|
+
if (violations.length === 0) return { ok: true };
|
|
230
|
+
const kindOrder = {
|
|
231
|
+
declaredButUnmigrated: 0,
|
|
232
|
+
orphanMarker: 1,
|
|
233
|
+
orphanSpaceDir: 2,
|
|
234
|
+
hashMismatch: 3,
|
|
235
|
+
invariantsMismatch: 4
|
|
236
|
+
};
|
|
237
|
+
violations.sort((a, b) => {
|
|
238
|
+
const k = kindOrder[a.kind] - kindOrder[b.kind];
|
|
239
|
+
if (k !== 0) return k;
|
|
240
|
+
if (a.spaceId < b.spaceId) return -1;
|
|
241
|
+
if (a.spaceId > b.spaceId) return 1;
|
|
242
|
+
return 0;
|
|
243
|
+
});
|
|
244
|
+
return {
|
|
245
|
+
ok: false,
|
|
246
|
+
violations
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
export { isValidSpaceId as a, spaceMigrationDirectory as c, assertValidSpaceId as i, spaceRefsDirectory as l, RESERVED_SPACE_SUBDIR_NAMES as n, listContractSpaceDirectories as o, SPACE_REFS_DIRNAME as r, readContractSpaceHeadRef as s, APP_SPACE_ID$1 as t, verifyContractSpaces as u };
|
|
251
|
+
|
|
252
|
+
//# sourceMappingURL=verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/verify-contract-spaces-BZDcJsuA.mjs"],"sourcesContent":["import { C as errorInvalidSpaceId, g as errorInvalidJson, y as errorInvalidRefFile } from \"./errors-IpZm1Skp.mjs\";\nimport { t as MANIFEST_FILE } from \"./io-C8TdyBKt.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-BZDcJsuA.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,GAA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