@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,250 @@
|
|
|
1
|
+
import { l as validateRefName } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
|
|
2
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
3
|
+
//#region ../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.mjs
|
|
4
|
+
const FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;
|
|
5
|
+
const HEX_PREFIX_PATTERN = /^[0-9a-f]{6,}$/;
|
|
6
|
+
function isFullHash(input) {
|
|
7
|
+
return FULL_HASH_PATTERN.test(input);
|
|
8
|
+
}
|
|
9
|
+
function isHexPrefix(input) {
|
|
10
|
+
return HEX_PREFIX_PATTERN.test(input);
|
|
11
|
+
}
|
|
12
|
+
function findEdgeByDirName(graph, dirName) {
|
|
13
|
+
for (const edges of graph.forwardChain.values()) for (const edge of edges) if (edge.dirName === dirName) return edge;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a user-supplied string to a contract hash using the unified
|
|
17
|
+
* contract-reference grammar.
|
|
18
|
+
*
|
|
19
|
+
* Accepted forms:
|
|
20
|
+
* - `@contract` — the on-disk working contract hash (offline; requires
|
|
21
|
+
* `ctx.contractHash` to be set)
|
|
22
|
+
* - `@db` — the live database marker (connection-required); callers MUST
|
|
23
|
+
* check `result.value.provenance.kind === 'reserved-db'` and resolve the
|
|
24
|
+
* actual hash via `readAllMarkers()` before using `result.value.hash`
|
|
25
|
+
* - Full storage hash (64 hex chars or `empty`)
|
|
26
|
+
* - Hex prefix (6+ hex chars, must uniquely identify one contract)
|
|
27
|
+
* - Ref name (looked up in the refs index)
|
|
28
|
+
* - Migration directory name (resolves to the migration's `to`-contract)
|
|
29
|
+
* - `<dir>^` (resolves to the migration's `from`-contract)
|
|
30
|
+
*/
|
|
31
|
+
function parseContractRef(input, ctx) {
|
|
32
|
+
if (!input) return notOk({
|
|
33
|
+
kind: "invalid-format",
|
|
34
|
+
input,
|
|
35
|
+
reason: "Reference cannot be empty"
|
|
36
|
+
});
|
|
37
|
+
if (input === "@contract") {
|
|
38
|
+
if (ctx.contractHash === void 0) return notOk({
|
|
39
|
+
kind: "not-found",
|
|
40
|
+
input,
|
|
41
|
+
grammar: "contract"
|
|
42
|
+
});
|
|
43
|
+
return ok({
|
|
44
|
+
hash: ctx.contractHash,
|
|
45
|
+
provenance: { kind: "reserved-contract" }
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (input === "@db") return ok({
|
|
49
|
+
hash: "",
|
|
50
|
+
provenance: { kind: "reserved-db" }
|
|
51
|
+
});
|
|
52
|
+
if (isFullHash(input)) {
|
|
53
|
+
if (ctx.graph.nodes.has(input)) return ok({
|
|
54
|
+
hash: input,
|
|
55
|
+
provenance: {
|
|
56
|
+
kind: "hash",
|
|
57
|
+
input
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return notOk({
|
|
61
|
+
kind: "not-found",
|
|
62
|
+
input,
|
|
63
|
+
grammar: "contract"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (input.endsWith("^")) {
|
|
67
|
+
const dirName = input.slice(0, -1);
|
|
68
|
+
if (!dirName) return notOk({
|
|
69
|
+
kind: "invalid-format",
|
|
70
|
+
input,
|
|
71
|
+
reason: "Missing directory name before ^"
|
|
72
|
+
});
|
|
73
|
+
const edge = findEdgeByDirName(ctx.graph, dirName);
|
|
74
|
+
if (edge) return ok({
|
|
75
|
+
hash: edge.from,
|
|
76
|
+
provenance: {
|
|
77
|
+
kind: "migration-from",
|
|
78
|
+
dirName
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return notOk({
|
|
82
|
+
kind: "not-found",
|
|
83
|
+
input,
|
|
84
|
+
grammar: "contract"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const candidates = [];
|
|
88
|
+
if (validateRefName(input) && Object.hasOwn(ctx.refs, input)) {
|
|
89
|
+
const ref = ctx.refs[input];
|
|
90
|
+
if (ref) candidates.push({
|
|
91
|
+
hash: ref.hash,
|
|
92
|
+
provenance: {
|
|
93
|
+
kind: "ref",
|
|
94
|
+
refName: input
|
|
95
|
+
},
|
|
96
|
+
label: `ref "${input}"`
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const edge = findEdgeByDirName(ctx.graph, input);
|
|
100
|
+
if (edge) candidates.push({
|
|
101
|
+
hash: edge.to,
|
|
102
|
+
provenance: {
|
|
103
|
+
kind: "migration-to",
|
|
104
|
+
dirName: input
|
|
105
|
+
},
|
|
106
|
+
label: `migration directory "${input}"`
|
|
107
|
+
});
|
|
108
|
+
if (isHexPrefix(input)) {
|
|
109
|
+
const matches = [...ctx.graph.nodes].filter((n) => n.startsWith(input));
|
|
110
|
+
const [firstMatch] = matches;
|
|
111
|
+
if (matches.length === 1 && firstMatch !== void 0) candidates.push({
|
|
112
|
+
hash: firstMatch,
|
|
113
|
+
provenance: {
|
|
114
|
+
kind: "hash",
|
|
115
|
+
input
|
|
116
|
+
},
|
|
117
|
+
label: `hash prefix "${input}"`
|
|
118
|
+
});
|
|
119
|
+
else if (matches.length > 1) return notOk({
|
|
120
|
+
kind: "ambiguous",
|
|
121
|
+
input,
|
|
122
|
+
candidates: matches,
|
|
123
|
+
grammar: "contract"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const [firstCandidate] = candidates;
|
|
127
|
+
if (candidates.length === 1 && firstCandidate !== void 0) return ok({
|
|
128
|
+
hash: firstCandidate.hash,
|
|
129
|
+
provenance: firstCandidate.provenance
|
|
130
|
+
});
|
|
131
|
+
if (candidates.length > 1) return notOk({
|
|
132
|
+
kind: "ambiguous",
|
|
133
|
+
input,
|
|
134
|
+
candidates: candidates.map((c) => c.label),
|
|
135
|
+
grammar: "contract"
|
|
136
|
+
});
|
|
137
|
+
return notOk({
|
|
138
|
+
kind: "not-found",
|
|
139
|
+
input,
|
|
140
|
+
grammar: "contract"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Resolve a user-supplied string to a migration using the migration-reference
|
|
145
|
+
* grammar.
|
|
146
|
+
*
|
|
147
|
+
* Accepted forms:
|
|
148
|
+
* - Migration directory name (e.g. `20260101-add-users`)
|
|
149
|
+
* - Migration hash (full or 6+ hex prefix)
|
|
150
|
+
*
|
|
151
|
+
* Wrong-grammar diagnostics are produced when the input matches a
|
|
152
|
+
* contract-grammar form (ref name, `<dir>^`, contract-only hash) so the
|
|
153
|
+
* user gets a targeted hint rather than a generic "not found".
|
|
154
|
+
*/
|
|
155
|
+
function parseMigrationRef(input, ctx) {
|
|
156
|
+
if (!input) return notOk({
|
|
157
|
+
kind: "invalid-format",
|
|
158
|
+
input,
|
|
159
|
+
reason: "Reference cannot be empty"
|
|
160
|
+
});
|
|
161
|
+
if (input.endsWith("^")) return notOk({
|
|
162
|
+
kind: "wrong-grammar",
|
|
163
|
+
input,
|
|
164
|
+
expectedGrammar: "migration",
|
|
165
|
+
message: "`^` syntax addresses contracts, not migrations",
|
|
166
|
+
fix: "Pass the migration directory name without `^`, or use a contract-accepting flag like `--to` or `--from`."
|
|
167
|
+
});
|
|
168
|
+
if (validateRefName(input) && Object.hasOwn(ctx.refs, input)) return notOk({
|
|
169
|
+
kind: "wrong-grammar",
|
|
170
|
+
input,
|
|
171
|
+
expectedGrammar: "migration",
|
|
172
|
+
message: `"${input}" is a ref name, not a migration`,
|
|
173
|
+
fix: "Refs point at contracts, not migrations. Use a migration directory name or migration hash."
|
|
174
|
+
});
|
|
175
|
+
const edge = findEdgeByDirName(ctx.graph, input);
|
|
176
|
+
if (edge) return ok({
|
|
177
|
+
dirName: edge.dirName,
|
|
178
|
+
migrationHash: edge.migrationHash,
|
|
179
|
+
from: edge.from,
|
|
180
|
+
to: edge.to,
|
|
181
|
+
provenance: {
|
|
182
|
+
kind: "dir-name",
|
|
183
|
+
dirName: input
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
if (isFullHash(input)) {
|
|
187
|
+
const migEdge = ctx.graph.migrationByHash.get(input);
|
|
188
|
+
if (migEdge) return ok({
|
|
189
|
+
dirName: migEdge.dirName,
|
|
190
|
+
migrationHash: migEdge.migrationHash,
|
|
191
|
+
from: migEdge.from,
|
|
192
|
+
to: migEdge.to,
|
|
193
|
+
provenance: {
|
|
194
|
+
kind: "hash",
|
|
195
|
+
input
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (ctx.graph.nodes.has(input)) return notOk({
|
|
199
|
+
kind: "wrong-grammar",
|
|
200
|
+
input,
|
|
201
|
+
expectedGrammar: "migration",
|
|
202
|
+
message: "Hash matched a contract but not a migration",
|
|
203
|
+
fix: "Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration."
|
|
204
|
+
});
|
|
205
|
+
return notOk({
|
|
206
|
+
kind: "not-found",
|
|
207
|
+
input,
|
|
208
|
+
grammar: "migration"
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
if (isHexPrefix(input)) {
|
|
212
|
+
const migMatches = [...ctx.graph.migrationByHash.entries()].filter(([hash]) => hash.startsWith(input));
|
|
213
|
+
const [firstMigMatch] = migMatches;
|
|
214
|
+
if (migMatches.length === 1 && firstMigMatch !== void 0) {
|
|
215
|
+
const [, matchedEdge] = firstMigMatch;
|
|
216
|
+
return ok({
|
|
217
|
+
dirName: matchedEdge.dirName,
|
|
218
|
+
migrationHash: matchedEdge.migrationHash,
|
|
219
|
+
from: matchedEdge.from,
|
|
220
|
+
to: matchedEdge.to,
|
|
221
|
+
provenance: {
|
|
222
|
+
kind: "hash",
|
|
223
|
+
input
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (migMatches.length > 1) return notOk({
|
|
228
|
+
kind: "ambiguous",
|
|
229
|
+
input,
|
|
230
|
+
candidates: migMatches.map(([hash]) => hash),
|
|
231
|
+
grammar: "migration"
|
|
232
|
+
});
|
|
233
|
+
if ([...ctx.graph.nodes].filter((n) => n.startsWith(input)).length > 0) return notOk({
|
|
234
|
+
kind: "wrong-grammar",
|
|
235
|
+
input,
|
|
236
|
+
expectedGrammar: "migration",
|
|
237
|
+
message: "Hash matched a contract but not a migration",
|
|
238
|
+
fix: "Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration."
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return notOk({
|
|
242
|
+
kind: "not-found",
|
|
243
|
+
input,
|
|
244
|
+
grammar: "migration"
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { parseContractRef as n, parseMigrationRef as r, findEdgeByDirName as t };
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=ref-resolution-BjJBWPjX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref-resolution-BjJBWPjX.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.mjs"],"sourcesContent":["import { l as validateRefName } from \"../refs-BDbB9BRB.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/refs/types.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nconst HEX_PREFIX_PATTERN = /^[0-9a-f]{6,}$/;\nfunction isFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction isHexPrefix(input) {\n\treturn HEX_PREFIX_PATTERN.test(input);\n}\nfunction findEdgeByDirName(graph, dirName) {\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) if (edge.dirName === dirName) return edge;\n}\n//#endregion\n//#region src/refs/contract-ref.ts\n/**\n* Resolve a user-supplied string to a contract hash using the unified\n* contract-reference grammar.\n*\n* Accepted forms:\n* - `@contract` — the on-disk working contract hash (offline; requires\n* `ctx.contractHash` to be set)\n* - `@db` — the live database marker (connection-required); callers MUST\n* check `result.value.provenance.kind === 'reserved-db'` and resolve the\n* actual hash via `readAllMarkers()` before using `result.value.hash`\n* - Full storage hash (64 hex chars or `empty`)\n* - Hex prefix (6+ hex chars, must uniquely identify one contract)\n* - Ref name (looked up in the refs index)\n* - Migration directory name (resolves to the migration's `to`-contract)\n* - `<dir>^` (resolves to the migration's `from`-contract)\n*/\nfunction parseContractRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input === \"@contract\") {\n\t\tif (ctx.contractHash === void 0) return notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t\treturn ok({\n\t\t\thash: ctx.contractHash,\n\t\t\tprovenance: { kind: \"reserved-contract\" }\n\t\t});\n\t}\n\tif (input === \"@db\") return ok({\n\t\thash: \"\",\n\t\tprovenance: { kind: \"reserved-db\" }\n\t});\n\tif (isFullHash(input)) {\n\t\tif (ctx.graph.nodes.has(input)) return ok({\n\t\t\thash: input,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tif (input.endsWith(\"^\")) {\n\t\tconst dirName = input.slice(0, -1);\n\t\tif (!dirName) return notOk({\n\t\t\tkind: \"invalid-format\",\n\t\t\tinput,\n\t\t\treason: \"Missing directory name before ^\"\n\t\t});\n\t\tconst edge = findEdgeByDirName(ctx.graph, dirName);\n\t\tif (edge) return ok({\n\t\t\thash: edge.from,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"migration-from\",\n\t\t\t\tdirName\n\t\t\t}\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst candidates = [];\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) {\n\t\tconst ref = ctx.refs[input];\n\t\tif (ref) candidates.push({\n\t\t\thash: ref.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: input\n\t\t\t},\n\t\t\tlabel: `ref \"${input}\"`\n\t\t});\n\t}\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) candidates.push({\n\t\thash: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"migration-to\",\n\t\t\tdirName: input\n\t\t},\n\t\tlabel: `migration directory \"${input}\"`\n\t});\n\tif (isHexPrefix(input)) {\n\t\tconst matches = [...ctx.graph.nodes].filter((n) => n.startsWith(input));\n\t\tconst [firstMatch] = matches;\n\t\tif (matches.length === 1 && firstMatch !== void 0) candidates.push({\n\t\t\thash: firstMatch,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t},\n\t\t\tlabel: `hash prefix \"${input}\"`\n\t\t});\n\t\telse if (matches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: matches,\n\t\t\tgrammar: \"contract\"\n\t\t});\n\t}\n\tconst [firstCandidate] = candidates;\n\tif (candidates.length === 1 && firstCandidate !== void 0) return ok({\n\t\thash: firstCandidate.hash,\n\t\tprovenance: firstCandidate.provenance\n\t});\n\tif (candidates.length > 1) return notOk({\n\t\tkind: \"ambiguous\",\n\t\tinput,\n\t\tcandidates: candidates.map((c) => c.label),\n\t\tgrammar: \"contract\"\n\t});\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"contract\"\n\t});\n}\n//#endregion\n//#region src/refs/migration-ref.ts\n/**\n* Resolve a user-supplied string to a migration using the migration-reference\n* grammar.\n*\n* Accepted forms:\n* - Migration directory name (e.g. `20260101-add-users`)\n* - Migration hash (full or 6+ hex prefix)\n*\n* Wrong-grammar diagnostics are produced when the input matches a\n* contract-grammar form (ref name, `<dir>^`, contract-only hash) so the\n* user gets a targeted hint rather than a generic \"not found\".\n*/\nfunction parseMigrationRef(input, ctx) {\n\tif (!input) return notOk({\n\t\tkind: \"invalid-format\",\n\t\tinput,\n\t\treason: \"Reference cannot be empty\"\n\t});\n\tif (input.endsWith(\"^\")) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: \"`^` syntax addresses contracts, not migrations\",\n\t\tfix: \"Pass the migration directory name without `^`, or use a contract-accepting flag like `--to` or `--from`.\"\n\t});\n\tif (validateRefName(input) && Object.hasOwn(ctx.refs, input)) return notOk({\n\t\tkind: \"wrong-grammar\",\n\t\tinput,\n\t\texpectedGrammar: \"migration\",\n\t\tmessage: `\"${input}\" is a ref name, not a migration`,\n\t\tfix: \"Refs point at contracts, not migrations. Use a migration directory name or migration hash.\"\n\t});\n\tconst edge = findEdgeByDirName(ctx.graph, input);\n\tif (edge) return ok({\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tprovenance: {\n\t\t\tkind: \"dir-name\",\n\t\t\tdirName: input\n\t\t}\n\t});\n\tif (isFullHash(input)) {\n\t\tconst migEdge = ctx.graph.migrationByHash.get(input);\n\t\tif (migEdge) return ok({\n\t\t\tdirName: migEdge.dirName,\n\t\t\tmigrationHash: migEdge.migrationHash,\n\t\t\tfrom: migEdge.from,\n\t\t\tto: migEdge.to,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"hash\",\n\t\t\t\tinput\n\t\t\t}\n\t\t});\n\t\tif (ctx.graph.nodes.has(input)) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t\treturn notOk({\n\t\t\tkind: \"not-found\",\n\t\t\tinput,\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t}\n\tif (isHexPrefix(input)) {\n\t\tconst migMatches = [...ctx.graph.migrationByHash.entries()].filter(([hash]) => hash.startsWith(input));\n\t\tconst [firstMigMatch] = migMatches;\n\t\tif (migMatches.length === 1 && firstMigMatch !== void 0) {\n\t\t\tconst [, matchedEdge] = firstMigMatch;\n\t\t\treturn ok({\n\t\t\t\tdirName: matchedEdge.dirName,\n\t\t\t\tmigrationHash: matchedEdge.migrationHash,\n\t\t\t\tfrom: matchedEdge.from,\n\t\t\t\tto: matchedEdge.to,\n\t\t\t\tprovenance: {\n\t\t\t\t\tkind: \"hash\",\n\t\t\t\t\tinput\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (migMatches.length > 1) return notOk({\n\t\t\tkind: \"ambiguous\",\n\t\t\tinput,\n\t\t\tcandidates: migMatches.map(([hash]) => hash),\n\t\t\tgrammar: \"migration\"\n\t\t});\n\t\tif ([...ctx.graph.nodes].filter((n) => n.startsWith(input)).length > 0) return notOk({\n\t\t\tkind: \"wrong-grammar\",\n\t\t\tinput,\n\t\t\texpectedGrammar: \"migration\",\n\t\t\tmessage: \"Hash matched a contract but not a migration\",\n\t\t\tfix: \"Use a contract-accepting flag like `--to` or `--from` to reference contracts by hash. Pass `migration show <dir>` for a specific migration.\"\n\t\t});\n\t}\n\treturn notOk({\n\t\tkind: \"not-found\",\n\t\tinput,\n\t\tgrammar: \"migration\"\n\t});\n}\n//#endregion\nexport { findEdgeByDirName, parseContractRef, parseMigrationRef };\n\n//# sourceMappingURL=ref-resolution.mjs.map"],"mappings":";;;AAGA,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,SAAS,WAAW,OAAO;CAC1B,OAAO,kBAAkB,KAAK,KAAK;AACpC;AACA,SAAS,YAAY,OAAO;CAC3B,OAAO,mBAAmB,KAAK,KAAK;AACrC;AACA,SAAS,kBAAkB,OAAO,SAAS;CAC1C,KAAK,MAAM,SAAS,MAAM,aAAa,OAAO,GAAG,KAAK,MAAM,QAAQ,OAAO,IAAI,KAAK,YAAY,SAAS,OAAO;AACjH;;;;;;;;;;;;;;;;;AAmBA,SAAS,iBAAiB,OAAO,KAAK;CACrC,IAAI,CAAC,OAAO,OAAO,MAAM;EACxB,MAAM;EACN;EACA,QAAQ;CACT,CAAC;CACD,IAAI,UAAU,aAAa;EAC1B,IAAI,IAAI,iBAAiB,KAA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|
|
|
1
|
+
import { i as Refs } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
|
|
2
|
+
import { n as MigrationGraph, t as MigrationEdge } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
3
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
4
|
+
//#region ../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.d.mts
|
|
5
|
+
//#region src/refs/types.d.ts
|
|
6
|
+
/** Context required to resolve a contract or migration reference. */
|
|
7
|
+
interface RefResolutionContext {
|
|
8
|
+
readonly graph: MigrationGraph;
|
|
9
|
+
readonly refs: Refs;
|
|
10
|
+
/**
|
|
11
|
+
* Hash of the on-disk contract (`contract.json`). Required to resolve the
|
|
12
|
+
* `@contract` reserved token, which is an offline-resolvable alias for
|
|
13
|
+
* "the working contract the app carries."
|
|
14
|
+
*/
|
|
15
|
+
readonly contractHash?: string;
|
|
16
|
+
}
|
|
17
|
+
type ContractRefProvenance = {
|
|
18
|
+
readonly kind: 'hash';
|
|
19
|
+
readonly input: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'ref';
|
|
22
|
+
readonly refName: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'migration-to';
|
|
25
|
+
readonly dirName: string;
|
|
26
|
+
} | {
|
|
27
|
+
readonly kind: 'migration-from';
|
|
28
|
+
readonly dirName: string;
|
|
29
|
+
} |
|
|
30
|
+
/**
|
|
31
|
+
* Resolved from the `@contract` reserved token — the hash of the on-disk
|
|
32
|
+
* working contract (`contract.json`). Offline-resolvable.
|
|
33
|
+
*/
|
|
34
|
+
{
|
|
35
|
+
readonly kind: 'reserved-contract';
|
|
36
|
+
} |
|
|
37
|
+
/**
|
|
38
|
+
* Resolved from the `@db` reserved token — the live database marker.
|
|
39
|
+
* The `hash` field is a placeholder; callers must resolve the actual hash
|
|
40
|
+
* via `readAllMarkers()` before using it. Check `provenance.kind ===
|
|
41
|
+
* 'reserved-db'` to detect this case and perform the DB lookup.
|
|
42
|
+
*/
|
|
43
|
+
{
|
|
44
|
+
readonly kind: 'reserved-db';
|
|
45
|
+
};
|
|
46
|
+
/** A resolved contract reference: the target hash and how it was derived. */
|
|
47
|
+
interface ContractRef {
|
|
48
|
+
readonly hash: string;
|
|
49
|
+
readonly provenance: ContractRefProvenance;
|
|
50
|
+
}
|
|
51
|
+
type MigrationRefProvenance = {
|
|
52
|
+
readonly kind: 'dir-name';
|
|
53
|
+
readonly dirName: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'hash';
|
|
56
|
+
readonly input: string;
|
|
57
|
+
};
|
|
58
|
+
/** A resolved migration reference. */
|
|
59
|
+
interface MigrationRef {
|
|
60
|
+
readonly dirName: string;
|
|
61
|
+
readonly migrationHash: string;
|
|
62
|
+
readonly from: string;
|
|
63
|
+
readonly to: string;
|
|
64
|
+
readonly provenance: MigrationRefProvenance;
|
|
65
|
+
}
|
|
66
|
+
interface RefResolutionNotFound {
|
|
67
|
+
readonly kind: 'not-found';
|
|
68
|
+
readonly input: string;
|
|
69
|
+
readonly grammar: 'contract' | 'migration';
|
|
70
|
+
}
|
|
71
|
+
interface RefResolutionAmbiguous {
|
|
72
|
+
readonly kind: 'ambiguous';
|
|
73
|
+
readonly input: string;
|
|
74
|
+
readonly candidates: readonly string[];
|
|
75
|
+
readonly grammar: 'contract' | 'migration';
|
|
76
|
+
}
|
|
77
|
+
interface RefResolutionWrongGrammar {
|
|
78
|
+
readonly kind: 'wrong-grammar';
|
|
79
|
+
readonly input: string;
|
|
80
|
+
readonly expectedGrammar: 'contract' | 'migration';
|
|
81
|
+
readonly message: string;
|
|
82
|
+
readonly fix: string;
|
|
83
|
+
}
|
|
84
|
+
interface RefResolutionInvalidFormat {
|
|
85
|
+
readonly kind: 'invalid-format';
|
|
86
|
+
readonly input: string;
|
|
87
|
+
readonly reason: string;
|
|
88
|
+
}
|
|
89
|
+
type RefResolutionError = RefResolutionNotFound | RefResolutionAmbiguous | RefResolutionWrongGrammar | RefResolutionInvalidFormat;
|
|
90
|
+
declare function findEdgeByDirName(graph: MigrationGraph, dirName: string): MigrationEdge | undefined;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/refs/contract-ref.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a user-supplied string to a contract hash using the unified
|
|
95
|
+
* contract-reference grammar.
|
|
96
|
+
*
|
|
97
|
+
* Accepted forms:
|
|
98
|
+
* - `@contract` — the on-disk working contract hash (offline; requires
|
|
99
|
+
* `ctx.contractHash` to be set)
|
|
100
|
+
* - `@db` — the live database marker (connection-required); callers MUST
|
|
101
|
+
* check `result.value.provenance.kind === 'reserved-db'` and resolve the
|
|
102
|
+
* actual hash via `readAllMarkers()` before using `result.value.hash`
|
|
103
|
+
* - Full storage hash (64 hex chars or `empty`)
|
|
104
|
+
* - Hex prefix (6+ hex chars, must uniquely identify one contract)
|
|
105
|
+
* - Ref name (looked up in the refs index)
|
|
106
|
+
* - Migration directory name (resolves to the migration's `to`-contract)
|
|
107
|
+
* - `<dir>^` (resolves to the migration's `from`-contract)
|
|
108
|
+
*/
|
|
109
|
+
declare function parseContractRef(input: string, ctx: RefResolutionContext): Result<ContractRef, RefResolutionError>;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/refs/migration-ref.d.ts
|
|
112
|
+
/**
|
|
113
|
+
* Resolve a user-supplied string to a migration using the migration-reference
|
|
114
|
+
* grammar.
|
|
115
|
+
*
|
|
116
|
+
* Accepted forms:
|
|
117
|
+
* - Migration directory name (e.g. `20260101-add-users`)
|
|
118
|
+
* - Migration hash (full or 6+ hex prefix)
|
|
119
|
+
*
|
|
120
|
+
* Wrong-grammar diagnostics are produced when the input matches a
|
|
121
|
+
* contract-grammar form (ref name, `<dir>^`, contract-only hash) so the
|
|
122
|
+
* user gets a targeted hint rather than a generic "not found".
|
|
123
|
+
*/
|
|
124
|
+
declare function parseMigrationRef(input: string, ctx: RefResolutionContext): Result<MigrationRef, RefResolutionError>;
|
|
125
|
+
//#endregion
|
|
126
|
+
export { RefResolutionAmbiguous as a, RefResolutionInvalidFormat as c, findEdgeByDirName as d, parseContractRef as f, MigrationRefProvenance as i, RefResolutionNotFound as l, ContractRefProvenance as n, RefResolutionContext as o, parseMigrationRef as p, MigrationRef as r, RefResolutionError as s, ContractRef as t, RefResolutionWrongGrammar as u };
|
|
127
|
+
//# sourceMappingURL=ref-resolution-COGOSL57.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref-resolution-COGOSL57.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/ref-resolution.d.mts"],"mappings":";;;;;;UAKU;WACC,OAAO;WACP,MAAM;;;;;;WAMN;;KAEN;WACM;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;WACA;;;;;;;WAOA;;;;;;;;;WASA;;;UAGD;WACC;WACA,YAAY;;KAElB;WACM;WACA;;WAEA;WACA;;;UAGD;WACC;WACA;WACA;WACA;WACA,YAAY;;UAEb;WACC;WACA;WACA;;UAED;WACC;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;;KAEN,qBAAqB,wBAAwB,yBAAyB,4BAA4B;iBACtF,kBAAkB,OAAO,gBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;;iBAmB3D,iBAAiB,eAAe,KAAK,uBAAuB,OAAO,aAAa;;;;;;;;;;;;;;;iBAehF,kBAAkB,eAAe,KAAK,uBAAuB,OAAO,cAAc"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { b as errorInvalidRefName, t as MigrationToolsError, x as errorInvalidRefValue, y as errorInvalidRefFile } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
import { dirname, join, relative } from "pathe";
|
|
3
|
+
import { mkdir, readFile, readdir, rename, rmdir, unlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import { type } from "arktype";
|
|
5
|
+
//#region ../../../1-framework/3-tooling/migration/dist/refs-BDbB9BRB.mjs
|
|
6
|
+
/**
|
|
7
|
+
* The system head ref lives at `refs/head.json`. It is read (and its
|
|
8
|
+
* corruption judged) through `readContractSpaceHeadRef`, not as a
|
|
9
|
+
* user-authored ref, so {@link readRefsTolerant} excludes it.
|
|
10
|
+
*/
|
|
11
|
+
const HEAD_REF_NAME = "head";
|
|
12
|
+
const REF_NAME_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\/[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;
|
|
13
|
+
const REF_VALUE_PATTERN = /^(empty|[0-9a-f]{64})$/;
|
|
14
|
+
function validateRefName(name) {
|
|
15
|
+
if (name.length === 0) return false;
|
|
16
|
+
if (name.includes("..")) return false;
|
|
17
|
+
if (name.includes("//")) return false;
|
|
18
|
+
if (name.startsWith(".")) return false;
|
|
19
|
+
return REF_NAME_PATTERN.test(name);
|
|
20
|
+
}
|
|
21
|
+
function validateRefValue(value) {
|
|
22
|
+
return REF_VALUE_PATTERN.test(value);
|
|
23
|
+
}
|
|
24
|
+
const RefEntrySchema = type({
|
|
25
|
+
hash: "string",
|
|
26
|
+
invariants: "string[]"
|
|
27
|
+
}).narrow((entry, ctx) => {
|
|
28
|
+
if (!validateRefValue(entry.hash)) return ctx.mustBe(`a valid contract hash (got "${entry.hash}")`);
|
|
29
|
+
return true;
|
|
30
|
+
});
|
|
31
|
+
function refFilePath(refsDir, name) {
|
|
32
|
+
return join(refsDir, `${name}.json`);
|
|
33
|
+
}
|
|
34
|
+
function refNameFromPath(refsDir, filePath) {
|
|
35
|
+
return relative(refsDir, filePath).replace(/\.json$/, "");
|
|
36
|
+
}
|
|
37
|
+
async function readRef(refsDir, name) {
|
|
38
|
+
if (!validateRefName(name)) throw errorInvalidRefName(name);
|
|
39
|
+
const filePath = refFilePath(refsDir, name);
|
|
40
|
+
let raw;
|
|
41
|
+
try {
|
|
42
|
+
raw = await readFile(filePath, "utf-8");
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (error instanceof Error && error.code === "ENOENT") throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
|
|
45
|
+
why: `No ref file found at "${filePath}".`,
|
|
46
|
+
fix: `Create the ref with: prisma-next ref set ${name} <hash>`,
|
|
47
|
+
details: {
|
|
48
|
+
refName: name,
|
|
49
|
+
filePath
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = JSON.parse(raw);
|
|
57
|
+
} catch {
|
|
58
|
+
throw errorInvalidRefFile(filePath, "Failed to parse as JSON");
|
|
59
|
+
}
|
|
60
|
+
const result = RefEntrySchema(parsed);
|
|
61
|
+
if (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
async function readRefs(refsDir) {
|
|
65
|
+
let entries;
|
|
66
|
+
try {
|
|
67
|
+
entries = await readdir(refsDir, {
|
|
68
|
+
recursive: true,
|
|
69
|
+
encoding: "utf-8"
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (error instanceof Error && error.code === "ENOENT") return {};
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
const jsonFiles = entries.filter((entry) => entry.endsWith(".json") && !entry.endsWith(".contract.json"));
|
|
76
|
+
const refs = {};
|
|
77
|
+
for (const jsonFile of jsonFiles) {
|
|
78
|
+
const filePath = join(refsDir, jsonFile);
|
|
79
|
+
const name = refNameFromPath(refsDir, filePath);
|
|
80
|
+
let raw;
|
|
81
|
+
try {
|
|
82
|
+
raw = await readFile(filePath, "utf-8");
|
|
83
|
+
} catch (error) {
|
|
84
|
+
const code = error instanceof Error ? error.code : void 0;
|
|
85
|
+
if (code === "ENOENT" || code === "EISDIR") continue;
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
let parsed;
|
|
89
|
+
try {
|
|
90
|
+
parsed = JSON.parse(raw);
|
|
91
|
+
} catch {
|
|
92
|
+
throw errorInvalidRefFile(filePath, "Failed to parse as JSON");
|
|
93
|
+
}
|
|
94
|
+
const result = RefEntrySchema(parsed);
|
|
95
|
+
if (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);
|
|
96
|
+
refs[name] = result;
|
|
97
|
+
}
|
|
98
|
+
return refs;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Read a space's user-authored refs without ever throwing on disk
|
|
102
|
+
* content. A ref whose JSON is unparseable or whose shape fails
|
|
103
|
+
* {@link RefEntrySchema} is omitted from `refs` and reported as a
|
|
104
|
+
* {@link RefLoadProblem}; the remaining well-formed refs are still
|
|
105
|
+
* returned. A missing `refs/` directory yields no refs and no problems.
|
|
106
|
+
*
|
|
107
|
+
* `refs/head.json` is deliberately skipped here: the system head ref is
|
|
108
|
+
* read through `readContractSpaceHeadRef` (which validates head-ref
|
|
109
|
+
* shape, distinct from the strict user-ref hash grammar), so it is judged
|
|
110
|
+
* there and never doubles as a user ref. Genuine I/O faults (EACCES, EIO,
|
|
111
|
+
* …) still propagate — only parse / schema problems are made tolerant.
|
|
112
|
+
*/
|
|
113
|
+
async function readRefsTolerant(refsDir) {
|
|
114
|
+
let entries;
|
|
115
|
+
try {
|
|
116
|
+
entries = await readdir(refsDir, {
|
|
117
|
+
recursive: true,
|
|
118
|
+
encoding: "utf-8"
|
|
119
|
+
});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (error instanceof Error && error.code === "ENOENT") return {
|
|
122
|
+
refs: {},
|
|
123
|
+
problems: []
|
|
124
|
+
};
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
const jsonFiles = entries.filter((entry) => entry.endsWith(".json") && !entry.endsWith(".contract.json") && entry !== `head.json`);
|
|
128
|
+
const refs = {};
|
|
129
|
+
const problems = [];
|
|
130
|
+
for (const jsonFile of jsonFiles) {
|
|
131
|
+
const filePath = join(refsDir, jsonFile);
|
|
132
|
+
const name = refNameFromPath(refsDir, filePath);
|
|
133
|
+
let raw;
|
|
134
|
+
try {
|
|
135
|
+
raw = await readFile(filePath, "utf-8");
|
|
136
|
+
} catch (error) {
|
|
137
|
+
const code = error instanceof Error ? error.code : void 0;
|
|
138
|
+
if (code === "ENOENT" || code === "EISDIR") continue;
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
let parsed;
|
|
142
|
+
try {
|
|
143
|
+
parsed = JSON.parse(raw);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
problems.push({
|
|
146
|
+
refName: name,
|
|
147
|
+
detail: e instanceof Error ? e.message : String(e)
|
|
148
|
+
});
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const result = RefEntrySchema(parsed);
|
|
152
|
+
if (result instanceof type.errors) {
|
|
153
|
+
problems.push({
|
|
154
|
+
refName: name,
|
|
155
|
+
detail: result.summary
|
|
156
|
+
});
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
refs[name] = result;
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
refs,
|
|
163
|
+
problems
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function writeRef(refsDir, name, entry) {
|
|
167
|
+
if (!validateRefName(name)) throw errorInvalidRefName(name);
|
|
168
|
+
if (!validateRefValue(entry.hash)) throw errorInvalidRefValue(entry.hash);
|
|
169
|
+
const filePath = refFilePath(refsDir, name);
|
|
170
|
+
const dir = dirname(filePath);
|
|
171
|
+
await mkdir(dir, { recursive: true });
|
|
172
|
+
const tmpPath = join(dir, `.${name.split("/").pop()}.json.${Date.now()}.tmp`);
|
|
173
|
+
await writeFile(tmpPath, `${JSON.stringify({
|
|
174
|
+
hash: entry.hash,
|
|
175
|
+
invariants: [...entry.invariants]
|
|
176
|
+
}, null, 2)}\n`);
|
|
177
|
+
await rename(tmpPath, filePath);
|
|
178
|
+
}
|
|
179
|
+
async function deleteRef(refsDir, name) {
|
|
180
|
+
if (!validateRefName(name)) throw errorInvalidRefName(name);
|
|
181
|
+
const filePath = refFilePath(refsDir, name);
|
|
182
|
+
try {
|
|
183
|
+
await unlink(filePath);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (error instanceof Error && error.code === "ENOENT") throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
|
|
186
|
+
why: `No ref file found at "${filePath}".`,
|
|
187
|
+
fix: "Run `prisma-next ref list` to see available refs.",
|
|
188
|
+
details: {
|
|
189
|
+
refName: name,
|
|
190
|
+
filePath
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
let dir = dirname(filePath);
|
|
196
|
+
while (dir !== refsDir && dir.startsWith(refsDir)) try {
|
|
197
|
+
await rmdir(dir);
|
|
198
|
+
dir = dirname(dir);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
const code = error instanceof Error ? error.code : void 0;
|
|
201
|
+
if (code === "ENOTEMPTY" || code === "EEXIST" || code === "ENOENT") break;
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Index user-authored refs by the contract hash each ref points at.
|
|
207
|
+
* Each bucket is sorted lex-asc for deterministic output.
|
|
208
|
+
*/
|
|
209
|
+
function refsByContractHash(refs) {
|
|
210
|
+
const byHash = /* @__PURE__ */ new Map();
|
|
211
|
+
for (const [name, entry] of Object.entries(refs)) {
|
|
212
|
+
const bucket = byHash.get(entry.hash);
|
|
213
|
+
if (bucket) bucket.push(name);
|
|
214
|
+
else byHash.set(entry.hash, [name]);
|
|
215
|
+
}
|
|
216
|
+
for (const bucket of byHash.values()) bucket.sort();
|
|
217
|
+
return byHash;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Read `migrations/<space>/refs/*.json` and index by destination hash.
|
|
221
|
+
* Returns an empty map when the refs directory does not exist.
|
|
222
|
+
*/
|
|
223
|
+
async function resolveRefsByContractHash(refsDir) {
|
|
224
|
+
return refsByContractHash(await readRefs(refsDir));
|
|
225
|
+
}
|
|
226
|
+
function resolveRef(refs, name) {
|
|
227
|
+
if (!validateRefName(name)) throw errorInvalidRefName(name);
|
|
228
|
+
if (!Object.hasOwn(refs, name)) throw new MigrationToolsError("MIGRATION.UNKNOWN_REF", `Unknown ref "${name}"`, {
|
|
229
|
+
why: `No ref named "${name}" exists.`,
|
|
230
|
+
fix: `Available refs: ${Object.keys(refs).join(", ") || "(none)"}. Create a ref with: prisma-next ref set ${name} <hash>`,
|
|
231
|
+
details: {
|
|
232
|
+
refName: name,
|
|
233
|
+
availableRefs: Object.keys(refs)
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return refs[name];
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { readRefsTolerant as a, resolveRefsByContractHash as c, writeRef as d, readRefs as i, validateRefName as l, deleteRef as n, refsByContractHash as o, readRef as r, resolveRef as s, HEAD_REF_NAME as t, validateRefValue as u };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=refs-BDbB9BRB-D6Za3Q49.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs-BDbB9BRB-D6Za3Q49.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/refs-BDbB9BRB.mjs"],"sourcesContent":["import { b as errorInvalidRefName, t as MigrationToolsError, x as errorInvalidRefValue, y as errorInvalidRefFile } from \"./errors-IpZm1Skp.mjs\";\nimport { dirname, join, relative } from \"pathe\";\nimport { mkdir, readFile, readdir, rename, rmdir, unlink, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/refs.ts\n/**\n* The system head ref lives at `refs/head.json`. It is read (and its\n* corruption judged) through `readContractSpaceHeadRef`, not as a\n* user-authored ref, so {@link readRefsTolerant} excludes it.\n*/\nconst HEAD_REF_NAME = \"head\";\nconst REF_NAME_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\/[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;\nconst REF_VALUE_PATTERN = /^(empty|[0-9a-f]{64})$/;\nfunction validateRefName(name) {\n\tif (name.length === 0) return false;\n\tif (name.includes(\"..\")) return false;\n\tif (name.includes(\"//\")) return false;\n\tif (name.startsWith(\".\")) return false;\n\treturn REF_NAME_PATTERN.test(name);\n}\nfunction validateRefValue(value) {\n\treturn REF_VALUE_PATTERN.test(value);\n}\nconst RefEntrySchema = type({\n\thash: \"string\",\n\tinvariants: \"string[]\"\n}).narrow((entry, ctx) => {\n\tif (!validateRefValue(entry.hash)) return ctx.mustBe(`a valid contract hash (got \"${entry.hash}\")`);\n\treturn true;\n});\nfunction refFilePath(refsDir, name) {\n\treturn join(refsDir, `${name}.json`);\n}\nfunction refNameFromPath(refsDir, filePath) {\n\treturn relative(refsDir, filePath).replace(/\\.json$/, \"\");\n}\nasync function readRef(refsDir, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tconst filePath = refFilePath(refsDir, name);\n\tlet raw;\n\ttry {\n\t\traw = await readFile(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\t\twhy: `No ref file found at \"${filePath}\".`,\n\t\t\tfix: `Create the ref with: prisma-next ref set ${name} <hash>`,\n\t\t\tdetails: {\n\t\t\t\trefName: name,\n\t\t\t\tfilePath\n\t\t\t}\n\t\t});\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\tthrow errorInvalidRefFile(filePath, \"Failed to parse as JSON\");\n\t}\n\tconst result = RefEntrySchema(parsed);\n\tif (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);\n\treturn result;\n}\nasync function readRefs(refsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(refsDir, {\n\t\t\trecursive: true,\n\t\t\tencoding: \"utf-8\"\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return {};\n\t\tthrow error;\n\t}\n\tconst jsonFiles = entries.filter((entry) => entry.endsWith(\".json\") && !entry.endsWith(\".contract.json\"));\n\tconst refs = {};\n\tfor (const jsonFile of jsonFiles) {\n\t\tconst filePath = join(refsDir, jsonFile);\n\t\tconst name = refNameFromPath(refsDir, filePath);\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = await readFile(filePath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\t\tif (code === \"ENOENT\" || code === \"EISDIR\") continue;\n\t\t\tthrow error;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch {\n\t\t\tthrow errorInvalidRefFile(filePath, \"Failed to parse as JSON\");\n\t\t}\n\t\tconst result = RefEntrySchema(parsed);\n\t\tif (result instanceof type.errors) throw errorInvalidRefFile(filePath, result.summary);\n\t\trefs[name] = result;\n\t}\n\treturn refs;\n}\n/**\n* Read a space's user-authored refs without ever throwing on disk\n* content. A ref whose JSON is unparseable or whose shape fails\n* {@link RefEntrySchema} is omitted from `refs` and reported as a\n* {@link RefLoadProblem}; the remaining well-formed refs are still\n* returned. A missing `refs/` directory yields no refs and no problems.\n*\n* `refs/head.json` is deliberately skipped here: the system head ref is\n* read through `readContractSpaceHeadRef` (which validates head-ref\n* shape, distinct from the strict user-ref hash grammar), so it is judged\n* there and never doubles as a user ref. Genuine I/O faults (EACCES, EIO,\n* …) still propagate — only parse / schema problems are made tolerant.\n*/\nasync function readRefsTolerant(refsDir) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(refsDir, {\n\t\t\trecursive: true,\n\t\t\tencoding: \"utf-8\"\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return {\n\t\t\trefs: {},\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst jsonFiles = entries.filter((entry) => entry.endsWith(\".json\") && !entry.endsWith(\".contract.json\") && entry !== `head.json`);\n\tconst refs = {};\n\tconst problems = [];\n\tfor (const jsonFile of jsonFiles) {\n\t\tconst filePath = join(refsDir, jsonFile);\n\t\tconst name = refNameFromPath(refsDir, filePath);\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = await readFile(filePath, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\t\tif (code === \"ENOENT\" || code === \"EISDIR\") continue;\n\t\t\tthrow error;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch (e) {\n\t\t\tproblems.push({\n\t\t\t\trefName: name,\n\t\t\t\tdetail: e instanceof Error ? e.message : String(e)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst result = RefEntrySchema(parsed);\n\t\tif (result instanceof type.errors) {\n\t\t\tproblems.push({\n\t\t\t\trefName: name,\n\t\t\t\tdetail: result.summary\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\trefs[name] = result;\n\t}\n\treturn {\n\t\trefs,\n\t\tproblems\n\t};\n}\nasync function writeRef(refsDir, name, entry) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tif (!validateRefValue(entry.hash)) throw errorInvalidRefValue(entry.hash);\n\tconst filePath = refFilePath(refsDir, name);\n\tconst dir = dirname(filePath);\n\tawait mkdir(dir, { recursive: true });\n\tconst tmpPath = join(dir, `.${name.split(\"/\").pop()}.json.${Date.now()}.tmp`);\n\tawait writeFile(tmpPath, `${JSON.stringify({\n\t\thash: entry.hash,\n\t\tinvariants: [...entry.invariants]\n\t}, null, 2)}\\n`);\n\tawait rename(tmpPath, filePath);\n}\nasync function deleteRef(refsDir, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tconst filePath = refFilePath(refsDir, name);\n\ttry {\n\t\tawait unlink(filePath);\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\t\twhy: `No ref file found at \"${filePath}\".`,\n\t\t\tfix: \"Run `prisma-next ref list` to see available refs.\",\n\t\t\tdetails: {\n\t\t\t\trefName: name,\n\t\t\t\tfilePath\n\t\t\t}\n\t\t});\n\t\tthrow error;\n\t}\n\tlet dir = dirname(filePath);\n\twhile (dir !== refsDir && dir.startsWith(refsDir)) try {\n\t\tawait rmdir(dir);\n\t\tdir = dirname(dir);\n\t} catch (error) {\n\t\tconst code = error instanceof Error ? error.code : void 0;\n\t\tif (code === \"ENOTEMPTY\" || code === \"EEXIST\" || code === \"ENOENT\") break;\n\t\tthrow error;\n\t}\n}\n/**\n* Index user-authored refs by the contract hash each ref points at.\n* Each bucket is sorted lex-asc for deterministic output.\n*/\nfunction refsByContractHash(refs) {\n\tconst byHash = /* @__PURE__ */ new Map();\n\tfor (const [name, entry] of Object.entries(refs)) {\n\t\tconst bucket = byHash.get(entry.hash);\n\t\tif (bucket) bucket.push(name);\n\t\telse byHash.set(entry.hash, [name]);\n\t}\n\tfor (const bucket of byHash.values()) bucket.sort();\n\treturn byHash;\n}\n/**\n* Read `migrations/<space>/refs/*.json` and index by destination hash.\n* Returns an empty map when the refs directory does not exist.\n*/\nasync function resolveRefsByContractHash(refsDir) {\n\treturn refsByContractHash(await readRefs(refsDir));\n}\nfunction resolveRef(refs, name) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tif (!Object.hasOwn(refs, name)) throw new MigrationToolsError(\"MIGRATION.UNKNOWN_REF\", `Unknown ref \"${name}\"`, {\n\t\twhy: `No ref named \"${name}\" exists.`,\n\t\tfix: `Available refs: ${Object.keys(refs).join(\", \") || \"(none)\"}. Create a ref with: prisma-next ref set ${name} <hash>`,\n\t\tdetails: {\n\t\t\trefName: name,\n\t\t\tavailableRefs: Object.keys(refs)\n\t\t}\n\t});\n\treturn refs[name];\n}\n//#endregion\nexport { readRefsTolerant as a, resolveRefsByContractHash as c, writeRef as d, readRefs as i, validateRefName as l, deleteRef as n, refsByContractHash as o, readRef as r, resolveRef as s, HEAD_REF_NAME as t, validateRefValue as u };\n\n//# sourceMappingURL=refs-BDbB9BRB.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,SAAS,gBAAgB,MAAM;CAC9B,IAAI,KAAK,WAAW,GAAG,OAAO;CAC9B,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;CAChC,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;CAChC,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO;CACjC,OAAO,iBAAiB,KAAK,IAAI;AAClC;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO,kBAAkB,KAAK,KAAK;AACpC;AACA,MAAM,iBAAiB,KAAK;CAC3B,MAAM;CACN,YAAY;AACb,CAAC,CAAC,CAAC,QAAQ,OAAO,QAAQ;CACzB,IAAI,CAAC,iBAAiB,MAAM,IAAI,GAAG,OAAO,IAAI,OAAO,+BAA+B,MAAM,KAAK,GAAG;CAClG,OAAO;AACR,CAAC;AACD,SAAS,YAAY,SAAS,MAAM;CACnC,OAAO,KAAK,SAAS,GAAG,KAAK,MAAM;AACpC;AACA,SAAS,gBAAgB,SAAS,UAAU;CAC3C,OAAO,SAAS,SAAS,QAAQ,CAAC,CAAC,QAAQ,WAAW,EAAE;AACzD;AACA,eAAe,QAAQ,SAAS,MAAM;CACrC,IAAI,CAAC,gBAAgB,IAAI,GAAG,MAAM,oBAAoB,IAAI;CAC1D,MAAM,WAAW,YAAY,SAAS,IAAI;CAC1C,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,SAAS,UAAU,OAAO;CACvC,SAAS,OAAO;EACf,IAAI,iBAAiB,SAAS,MAAM,SAAS,UAAU,MAAM,IAAI,oBAAoB,yBAA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