@prisma/orm-family-sql 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/ast-BstHjAoG.mjs +325 -0
- package/dist/ast-BstHjAoG.mjs.map +1 -0
- package/dist/ast-DSuzmsWn.d.mts +287 -0
- package/dist/ast-DSuzmsWn.d.mts.map +1 -0
- package/dist/authoring-type-constructors-Blqoa2Ua-DyCmD6mp.mjs +316 -0
- package/dist/authoring-type-constructors-Blqoa2Ua-DyCmD6mp.mjs.map +1 -0
- package/dist/build-contract-DBCz_YSs-DO0wMHai.mjs +778 -0
- package/dist/build-contract-DBCz_YSs-DO0wMHai.mjs.map +1 -0
- package/dist/builder.d.mts +3 -0
- package/dist/builder.mjs +1 -0
- package/dist/builder__runtime.d.mts +42 -0
- package/dist/builder__runtime.d.mts.map +1 -0
- package/dist/builder__runtime.mjs +955 -0
- package/dist/builder__runtime.mjs.map +1 -0
- package/dist/builder__types.d.mts +3 -0
- package/dist/builder__types.mjs +1 -0
- package/dist/canonicalization-hooks-CYnW_sGn.d.mts +10 -0
- package/dist/canonicalization-hooks-CYnW_sGn.d.mts.map +1 -0
- package/dist/canonicalization-hooks-DfIc_lOO.mjs +87 -0
- package/dist/canonicalization-hooks-DfIc_lOO.mjs.map +1 -0
- package/dist/codec-descriptor-registry-BJVJRftS.mjs +96 -0
- package/dist/codec-descriptor-registry-BJVJRftS.mjs.map +1 -0
- package/dist/codec-types-MOaceoPi-C5eL2sao.d.mts +116 -0
- package/dist/codec-types-MOaceoPi-C5eL2sao.d.mts.map +1 -0
- package/dist/config-types-47qB33rW.d.mts +21 -0
- package/dist/config-types-47qB33rW.d.mts.map +1 -0
- package/dist/config-types-N7PJc6VN.mjs +65 -0
- package/dist/config-types-N7PJc6VN.mjs.map +1 -0
- package/dist/contract-builder-MvJJrQ-5.d.mts +1306 -0
- package/dist/contract-builder-MvJJrQ-5.d.mts.map +1 -0
- package/dist/contract-builder-YjMQcvZ1.mjs +1615 -0
- package/dist/contract-builder-YjMQcvZ1.mjs.map +1 -0
- package/dist/contract-emitter.d.mts +25 -0
- package/dist/contract-emitter.d.mts.map +1 -0
- package/dist/contract-emitter.mjs +2 -0
- package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs +9 -0
- package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs.map +1 -0
- package/dist/contract-psl.d.mts +65 -0
- package/dist/contract-psl.d.mts.map +1 -0
- package/dist/contract-psl.mjs +2 -0
- package/dist/contract-psl__provider.d.mts +23 -0
- package/dist/contract-psl__provider.d.mts.map +1 -0
- package/dist/contract-psl__provider.mjs +105 -0
- package/dist/contract-psl__provider.mjs.map +1 -0
- package/dist/contract-ts.d.mts +3 -0
- package/dist/contract-ts.mjs +4 -0
- package/dist/contract-ts__config-types.d.mts +2 -0
- package/dist/contract-ts__config-types.mjs +2 -0
- package/dist/contract-ts__contract-builder.d.mts +2 -0
- package/dist/contract-ts__contract-builder.mjs +3 -0
- package/dist/contract-view-BMR5IWk4.mjs +39 -0
- package/dist/contract-view-BMR5IWk4.mjs.map +1 -0
- package/dist/contract-view-BbWQp6r4.d.mts +61 -0
- package/dist/contract-view-BbWQp6r4.d.mts.map +1 -0
- package/dist/contract.d.mts +26 -0
- package/dist/contract.mjs +17 -0
- package/dist/contract__canonicalization-hooks.d.mts +2 -0
- package/dist/contract__canonicalization-hooks.mjs +2 -0
- package/dist/contract__contract-view.d.mts +2 -0
- package/dist/contract__contract-view.mjs +2 -0
- package/dist/contract__entity-handle-lowering-hook.d.mts +2 -0
- package/dist/contract__entity-handle-lowering-hook.mjs +2 -0
- package/dist/contract__entity-kinds.d.mts +2 -0
- package/dist/contract__entity-kinds.mjs +2 -0
- package/dist/contract__factories.d.mts +2 -0
- package/dist/contract__factories.mjs +2 -0
- package/dist/contract__foreign-key-materialization.d.mts +2 -0
- package/dist/contract__foreign-key-materialization.mjs +2 -0
- package/dist/contract__index-naming.d.mts +2 -0
- package/dist/contract__index-naming.mjs +2 -0
- package/dist/contract__index-type-validation.d.mts +2 -0
- package/dist/contract__index-type-validation.mjs +2 -0
- package/dist/contract__index-types.d.mts +3 -0
- package/dist/contract__index-types.mjs +2 -0
- package/dist/contract__pack-types.d.mts +2 -0
- package/dist/contract__pack-types.mjs +1 -0
- package/dist/contract__referential-action-sql.d.mts +2 -0
- package/dist/contract__referential-action-sql.mjs +2 -0
- package/dist/contract__resolve-storage-table.d.mts +2 -0
- package/dist/contract__resolve-storage-table.mjs +2 -0
- package/dist/contract__types.d.mts +11 -0
- package/dist/contract__types.mjs +4 -0
- package/dist/contract__validators.d.mts +2 -0
- package/dist/contract__validators.mjs +3 -0
- package/dist/contract__value-set-derivation-hook.d.mts +2 -0
- package/dist/contract__value-set-derivation-hook.mjs +2 -0
- package/dist/control-B7iS4jv4.mjs +1326 -0
- package/dist/control-B7iS4jv4.mjs.map +1 -0
- package/dist/control-BHmsZudH.d.mts +948 -0
- package/dist/control-BHmsZudH.d.mts.map +1 -0
- package/dist/control-adapter-4y1O8Ps3.d.mts +1 -0
- package/dist/control-adapter-C99J7aEF-C-17lFY8.d.mts +191 -0
- package/dist/control-adapter-C99J7aEF-C-17lFY8.d.mts.map +1 -0
- package/dist/db-DhMsmBS--DKENDi3l.d.mts +365 -0
- package/dist/db-DhMsmBS--DKENDi3l.d.mts.map +1 -0
- package/dist/ddl-types-BMp2bWVS-D1waZJ4n.mjs +153 -0
- package/dist/ddl-types-BMp2bWVS-D1waZJ4n.mjs.map +1 -0
- package/dist/ddl-types-rrMsf77U-DGctYf-T.d.mts +149 -0
- package/dist/ddl-types-rrMsf77U-DGctYf-T.d.mts.map +1 -0
- package/dist/diff-B16bL_IR.mjs +13 -0
- package/dist/diff-B16bL_IR.mjs.map +1 -0
- package/dist/diff-DhlzHOMD.d.mts +104 -0
- package/dist/diff-DhlzHOMD.d.mts.map +1 -0
- package/dist/dist-C_q1_QR9.mjs +9 -0
- package/dist/dist-C_q1_QR9.mjs.map +1 -0
- package/dist/dist-DrScXbhq.mjs +414 -0
- package/dist/dist-DrScXbhq.mjs.map +1 -0
- package/dist/dist-x6jvtkKM.mjs +68 -0
- package/dist/dist-x6jvtkKM.mjs.map +1 -0
- package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts +92 -0
- package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts.map +1 -0
- package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs +11 -0
- package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs.map +1 -0
- package/dist/entity-kinds-DKxwKolf-CcsY-iYV.mjs +136 -0
- package/dist/entity-kinds-DKxwKolf-CcsY-iYV.mjs.map +1 -0
- package/dist/entity-kinds-Dh6VH4uK.d.mts +29 -0
- package/dist/entity-kinds-Dh6VH4uK.d.mts.map +1 -0
- package/dist/errors-B5g0xWro-mWH2C07F.mjs +9 -0
- package/dist/errors-B5g0xWro-mWH2C07F.mjs.map +1 -0
- package/dist/errors.d.mts +63 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +2 -0
- package/dist/expression-DIf8F4Mc.d.mts +167 -0
- package/dist/expression-DIf8F4Mc.d.mts.map +1 -0
- package/dist/expression-RUO52bJB.mjs +109 -0
- package/dist/expression-RUO52bJB.mjs.map +1 -0
- package/dist/factories-B7tA4y9D.d.mts +39 -0
- package/dist/factories-B7tA4y9D.d.mts.map +1 -0
- package/dist/factories-CDG9zBxC.mjs +77 -0
- package/dist/factories-CDG9zBxC.mjs.map +1 -0
- package/dist/family.d.mts +13 -0
- package/dist/family.mjs +12 -0
- package/dist/family__control-adapter.d.mts +3 -0
- package/dist/family__control-adapter.mjs +1 -0
- package/dist/family__control.d.mts +4 -0
- package/dist/family__control.mjs +4 -0
- package/dist/family__diff.d.mts +3 -0
- package/dist/family__diff.mjs +3 -0
- package/dist/family__ir.d.mts +2 -0
- package/dist/family__ir.mjs +3 -0
- package/dist/family__migration.d.mts +2 -0
- package/dist/family__migration.mjs +2 -0
- package/dist/family__pack.d.mts +249 -0
- package/dist/family__pack.d.mts.map +1 -0
- package/dist/family__pack.mjs +18 -0
- package/dist/family__pack.mjs.map +1 -0
- package/dist/family__psl-infer.d.mts +2 -0
- package/dist/family__psl-infer.mjs +2 -0
- package/dist/family__runtime.d.mts +3 -0
- package/dist/family__runtime.mjs +3 -0
- package/dist/family__verify.d.mts +2 -0
- package/dist/family__verify.mjs +2 -0
- package/dist/foreign-key-BSy9u4O4-BnsOe5Nf.d.mts +85 -0
- package/dist/foreign-key-BSy9u4O4-BnsOe5Nf.d.mts.map +1 -0
- package/dist/foreign-key-materialization-Ca-wRbmj.d.mts +65 -0
- package/dist/foreign-key-materialization-Ca-wRbmj.d.mts.map +1 -0
- package/dist/foreign-key-materialization-HI7BIQrG.mjs +72 -0
- package/dist/foreign-key-materialization-HI7BIQrG.mjs.map +1 -0
- package/dist/index-Bb9U36N4.d.mts +511 -0
- package/dist/index-Bb9U36N4.d.mts.map +1 -0
- package/dist/index-BgaTJRxj.d.mts +25 -0
- package/dist/index-BgaTJRxj.d.mts.map +1 -0
- package/dist/index-naming-BZWoh45T.d.mts +62 -0
- package/dist/index-naming-BZWoh45T.d.mts.map +1 -0
- package/dist/index-naming-BoGBcMmI-DiJAr66H.mjs +108 -0
- package/dist/index-naming-BoGBcMmI-DiJAr66H.mjs.map +1 -0
- package/dist/index-type-validation-COH4d78M.mjs +17 -0
- package/dist/index-type-validation-COH4d78M.mjs.map +1 -0
- package/dist/index-type-validation-DN0L2mqm.d.mts +10 -0
- package/dist/index-type-validation-DN0L2mqm.d.mts.map +1 -0
- package/dist/index-types-CNhHgKHi.d.mts +1 -0
- package/dist/index-types-DJQ_xwaE.mjs +40 -0
- package/dist/index-types-DJQ_xwaE.mjs.map +1 -0
- package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts +31 -0
- package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts.map +1 -0
- package/dist/interpreter-5WgpL-ax-_nqHLUTr.mjs +3526 -0
- package/dist/interpreter-5WgpL-ax-_nqHLUTr.mjs.map +1 -0
- package/dist/ir-B3bKMnGQ.d.mts +123 -0
- package/dist/ir-B3bKMnGQ.d.mts.map +1 -0
- package/dist/ir-I-xciGUH.mjs +36 -0
- package/dist/ir-I-xciGUH.mjs.map +1 -0
- package/dist/lane-query-builder.d.mts +236 -0
- package/dist/lane-query-builder.d.mts.map +1 -0
- package/dist/lane-query-builder.mjs +67 -0
- package/dist/lane-query-builder.mjs.map +1 -0
- package/dist/middleware-B4XbF4d4-tfwBl6mX.d.mts +119 -0
- package/dist/middleware-B4XbF4d4-tfwBl6mX.d.mts.map +1 -0
- package/dist/middleware-ByRsXxxq.d.mts +1 -0
- package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs +80 -0
- package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs.map +1 -0
- package/dist/migration-CK4oePIo.mjs +44 -0
- package/dist/migration-CK4oePIo.mjs.map +1 -0
- package/dist/migration-CW0ZJLxP.d.mts +44 -0
- package/dist/migration-CW0ZJLxP.d.mts.map +1 -0
- package/dist/naming-BwqqVcZy-BgTObIQw.mjs +177 -0
- package/dist/naming-BwqqVcZy-BgTObIQw.mjs.map +1 -0
- package/dist/naming-jLgdauLi-C84G_UHi.d.mts +133 -0
- package/dist/naming-jLgdauLi-C84G_UHi.d.mts.map +1 -0
- package/dist/operations.d.mts +2 -0
- package/dist/operations.mjs +2 -0
- package/dist/orm-client.d.mts +1316 -0
- package/dist/orm-client.d.mts.map +1 -0
- package/dist/orm-client.mjs +4544 -0
- package/dist/orm-client.mjs.map +1 -0
- package/dist/pack-types-BcLTpwbv.d.mts +14 -0
- package/dist/pack-types-BcLTpwbv.d.mts.map +1 -0
- package/dist/plan-BTD8xFfa-Dd_K-A1R.d.mts +45 -0
- package/dist/plan-BTD8xFfa-Dd_K-A1R.d.mts.map +1 -0
- package/dist/plan-CkpcgUaM.mjs +34 -0
- package/dist/plan-CkpcgUaM.mjs.map +1 -0
- package/dist/plan-Cm4jaoNM.d.mts +2 -0
- package/dist/psl-infer-6je61Z6J.d.mts +119 -0
- package/dist/psl-infer-6je61Z6J.d.mts.map +1 -0
- package/dist/psl-infer-DGftl-HW.mjs +362 -0
- package/dist/psl-infer-DGftl-HW.mjs.map +1 -0
- package/dist/query-lane-context-Bz8XJZ45.d.mts +1 -0
- package/dist/query-lane-context-DtdVMqoz-C2Tj5QHA.d.mts +94 -0
- package/dist/query-lane-context-DtdVMqoz-C2Tj5QHA.d.mts.map +1 -0
- package/dist/referential-action-sql-Csd6dA8G.d.mts +12 -0
- package/dist/referential-action-sql-Csd6dA8G.d.mts.map +1 -0
- package/dist/referential-action-sql-DSqkrySN.mjs +17 -0
- package/dist/referential-action-sql-DSqkrySN.mjs.map +1 -0
- package/dist/relational-core.d.mts +13 -0
- package/dist/relational-core.mjs +8 -0
- package/dist/relational-core__ast.d.mts +5 -0
- package/dist/relational-core__ast.mjs +5 -0
- package/dist/relational-core__codec-descriptor-registry.d.mts +39 -0
- package/dist/relational-core__codec-descriptor-registry.d.mts.map +1 -0
- package/dist/relational-core__codec-descriptor-registry.mjs +2 -0
- package/dist/relational-core__contract-free.d.mts +220 -0
- package/dist/relational-core__contract-free.d.mts.map +1 -0
- package/dist/relational-core__contract-free.mjs +393 -0
- package/dist/relational-core__contract-free.mjs.map +1 -0
- package/dist/relational-core__expression.d.mts +2 -0
- package/dist/relational-core__expression.mjs +2 -0
- package/dist/relational-core__middleware.d.mts +3 -0
- package/dist/relational-core__middleware.mjs +2 -0
- package/dist/relational-core__plan.d.mts +4 -0
- package/dist/relational-core__plan.mjs +2 -0
- package/dist/relational-core__query-lane-context.d.mts +3 -0
- package/dist/relational-core__query-lane-context.mjs +1 -0
- package/dist/relational-core__types.d.mts +3 -0
- package/dist/relational-core__types.mjs +1 -0
- package/dist/resolve-storage-table-DUwyRJmP.d.mts +21 -0
- package/dist/resolve-storage-table-DUwyRJmP.d.mts.map +1 -0
- package/dist/resolve-storage-table-DZsfnzeW.mjs +46 -0
- package/dist/resolve-storage-table-DZsfnzeW.mjs.map +1 -0
- package/dist/runtime-DNewRuec.d.mts +46 -0
- package/dist/runtime-DNewRuec.d.mts.map +1 -0
- package/dist/runtime-tIHpGCcG.mjs +55 -0
- package/dist/runtime-tIHpGCcG.mjs.map +1 -0
- package/dist/runtime.d.mts +4 -0
- package/dist/runtime.mjs +1606 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/schema-differ-DpG_gnur-g5_iks8G.d.mts +47 -0
- package/dist/schema-differ-DpG_gnur-g5_iks8G.d.mts.map +1 -0
- package/dist/schema-ir.d.mts +2 -0
- package/dist/schema-ir.mjs +2 -0
- package/dist/schema-ir__naming.d.mts +2 -0
- package/dist/schema-ir__naming.mjs +2 -0
- package/dist/schema-ir__types.d.mts +3 -0
- package/dist/schema-ir__types.mjs +2 -0
- package/dist/schema-verify-vtFZbmGq-BNfTr6fU.mjs +222 -0
- package/dist/schema-verify-vtFZbmGq-BNfTr6fU.mjs.map +1 -0
- package/dist/serialized-index-B96AwqtU-DcqcB4q_.d.mts +26 -0
- package/dist/serialized-index-B96AwqtU-DcqcB4q_.d.mts.map +1 -0
- package/dist/serialized-index-Dp5_EjXD-DMsw8jf3.mjs +64 -0
- package/dist/serialized-index-Dp5_EjXD-DMsw8jf3.mjs.map +1 -0
- package/dist/sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs +171 -0
- package/dist/sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs.map +1 -0
- package/dist/sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts +32 -0
- package/dist/sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts.map +1 -0
- package/dist/sql-index-DsI8HAeK-BJsn-jvD.d.mts +72 -0
- package/dist/sql-index-DsI8HAeK-BJsn-jvD.d.mts.map +1 -0
- package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts +42 -0
- package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts.map +1 -0
- package/dist/sql-storage-B0QwiTg6-B8DVctJm.d.mts +171 -0
- package/dist/sql-storage-B0QwiTg6-B8DVctJm.d.mts.map +1 -0
- package/dist/storage-table-BBaAmanc-BwR37LMA.d.mts +130 -0
- package/dist/storage-table-BBaAmanc-BwR37LMA.d.mts.map +1 -0
- package/dist/storage-table-_LWDmPfv-DFhU2dML.mjs +277 -0
- package/dist/storage-table-_LWDmPfv-DFhU2dML.mjs.map +1 -0
- package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts +41 -0
- package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts.map +1 -0
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs +173 -0
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +1 -0
- package/dist/types-BchwQpmO.d.mts +16 -0
- package/dist/types-BchwQpmO.d.mts.map +1 -0
- package/dist/types-BgkZru_1-H7yfikSQ.mjs +1444 -0
- package/dist/types-BgkZru_1-H7yfikSQ.mjs.map +1 -0
- package/dist/types-CMMQS6aG.mjs +111 -0
- package/dist/types-CMMQS6aG.mjs.map +1 -0
- package/dist/types-CuDrWc5v-ISVXBmBs.d.mts +134 -0
- package/dist/types-CuDrWc5v-ISVXBmBs.d.mts.map +1 -0
- package/dist/types-CvbBw1Jo-3KQdErJY.d.mts +688 -0
- package/dist/types-CvbBw1Jo-3KQdErJY.d.mts.map +1 -0
- package/dist/types-DIBA80mc-wf5wLmON.d.mts +723 -0
- package/dist/types-DIBA80mc-wf5wLmON.d.mts.map +1 -0
- package/dist/types-DMxc5KZa.d.mts +1 -0
- package/dist/types-Dl20lxky-DC_jdA0T.d.mts +247 -0
- package/dist/types-Dl20lxky-DC_jdA0T.d.mts.map +1 -0
- package/dist/types-DmhUVq4u-BpqqjPJx.mjs +719 -0
- package/dist/types-DmhUVq4u-BpqqjPJx.mjs.map +1 -0
- package/dist/types-IqZMLrFC-DtdJNICr.d.mts +426 -0
- package/dist/types-IqZMLrFC-DtdJNICr.d.mts.map +1 -0
- package/dist/types-TvBZ2Ne9.d.mts +1 -0
- package/dist/unique-constraint-jQWfH7dg-zLWtFp99.d.mts +32 -0
- package/dist/unique-constraint-jQWfH7dg-zLWtFp99.d.mts.map +1 -0
- package/dist/util-DQQgv2j1-D6INZaRG.mjs +34 -0
- package/dist/util-DQQgv2j1-D6INZaRG.mjs.map +1 -0
- package/dist/validators-C4PItWnf.mjs +0 -0
- package/dist/validators-C4PItWnf.mjs.map +1 -0
- package/dist/validators-CxeHhHrf.d.mts +206 -0
- package/dist/validators-CxeHhHrf.d.mts.map +1 -0
- package/dist/value-set-derivation-hook-BhgGVtw0.d.mts +35 -0
- package/dist/value-set-derivation-hook-BhgGVtw0.d.mts.map +1 -0
- package/dist/value-set-derivation-hook-Di9JZ0X7.mjs +22 -0
- package/dist/value-set-derivation-hook-Di9JZ0X7.mjs.map +1 -0
- package/dist/verify-E6Dd2vYp-gYwnlhLm.mjs +86 -0
- package/dist/verify-E6Dd2vYp-gYwnlhLm.mjs.map +1 -0
- package/dist/verify-zDRnw0Rn.d.mts +26 -0
- package/dist/verify-zDRnw0Rn.d.mts.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
|
|
2
|
+
//#region ../../../2-sql/4-lanes/relational-core/dist/middleware-CMr4CHNz.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Build a {@link SqlParamRefMutatorInternal} for the given lowered plan.
|
|
5
|
+
*
|
|
6
|
+
* The mutator captures `plan.params` by reference and walks
|
|
7
|
+
* `plan.ast` (via `collectOrderedParamRefs`) on demand to build
|
|
8
|
+
* entries. Mutations write to a lazily-allocated working copy so the
|
|
9
|
+
* fast path (no mutation) preserves bit-for-bit reference identity to
|
|
10
|
+
* the original `plan.params`.
|
|
11
|
+
*
|
|
12
|
+
* Threading: `plan.ast` carries the canonical `ParamRef` ordering used
|
|
13
|
+
* by every consumer (renderer's `$N` index map, encode-side metadata
|
|
14
|
+
* walk, etc.). The mutator's `entries()` yields the same order so
|
|
15
|
+
* middleware that filters by codec id sees ParamRefs in the order the
|
|
16
|
+
* runtime will encode them.
|
|
17
|
+
*/
|
|
18
|
+
function createSqlParamRefMutator(plan) {
|
|
19
|
+
const originalParams = plan.params;
|
|
20
|
+
const refs = plan.ast ? collectOrderedParamRefs(plan.ast) : [];
|
|
21
|
+
let workingParams;
|
|
22
|
+
const indexOfRef = (handle) => {
|
|
23
|
+
return refs.indexOf(handle);
|
|
24
|
+
};
|
|
25
|
+
const ensureWorkingParams = () => {
|
|
26
|
+
if (!workingParams) workingParams = [...originalParams];
|
|
27
|
+
return workingParams;
|
|
28
|
+
};
|
|
29
|
+
const writeAt = (index, value) => {
|
|
30
|
+
const buffer = ensureWorkingParams();
|
|
31
|
+
buffer[index] = value;
|
|
32
|
+
};
|
|
33
|
+
function* entries() {
|
|
34
|
+
const view = workingParams ?? originalParams;
|
|
35
|
+
for (let i = 0; i < refs.length; i++) {
|
|
36
|
+
const ref = refs[i];
|
|
37
|
+
if (!ref) continue;
|
|
38
|
+
const handle = ref;
|
|
39
|
+
let value;
|
|
40
|
+
let codecId;
|
|
41
|
+
if (ref.kind === "param-ref") {
|
|
42
|
+
value = i < view.length ? view[i] : ref.value;
|
|
43
|
+
codecId = ref.codec?.codecId;
|
|
44
|
+
} else {
|
|
45
|
+
value = i < view.length ? view[i] : void 0;
|
|
46
|
+
codecId = ref.codec.codecId;
|
|
47
|
+
}
|
|
48
|
+
yield {
|
|
49
|
+
ref: handle,
|
|
50
|
+
value,
|
|
51
|
+
codecId
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function replaceValue(handle, newValue) {
|
|
56
|
+
const index = indexOfRef(handle);
|
|
57
|
+
if (index < 0) return;
|
|
58
|
+
writeAt(index, newValue);
|
|
59
|
+
}
|
|
60
|
+
function replaceValues(updates) {
|
|
61
|
+
for (const { ref, newValue } of updates) {
|
|
62
|
+
const index = indexOfRef(ref);
|
|
63
|
+
if (index < 0) continue;
|
|
64
|
+
writeAt(index, newValue);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
entries,
|
|
69
|
+
replaceValue,
|
|
70
|
+
replaceValues,
|
|
71
|
+
currentParams() {
|
|
72
|
+
if (!workingParams) return originalParams;
|
|
73
|
+
return Object.freeze([...workingParams]);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { createSqlParamRefMutator as t };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=middleware-CMr4CHNz-DHIUdxlm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-CMr4CHNz-DHIUdxlm.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/middleware-CMr4CHNz.mjs"],"sourcesContent":["import { t as collectOrderedParamRefs } from \"./util-DQQgv2j1.mjs\";\n//#region src/middleware/param-ref-mutator.ts\n/**\n* Build a {@link SqlParamRefMutatorInternal} for the given lowered plan.\n*\n* The mutator captures `plan.params` by reference and walks\n* `plan.ast` (via `collectOrderedParamRefs`) on demand to build\n* entries. Mutations write to a lazily-allocated working copy so the\n* fast path (no mutation) preserves bit-for-bit reference identity to\n* the original `plan.params`.\n*\n* Threading: `plan.ast` carries the canonical `ParamRef` ordering used\n* by every consumer (renderer's `$N` index map, encode-side metadata\n* walk, etc.). The mutator's `entries()` yields the same order so\n* middleware that filters by codec id sees ParamRefs in the order the\n* runtime will encode them.\n*/\nfunction createSqlParamRefMutator(plan) {\n\tconst originalParams = plan.params;\n\tconst refs = plan.ast ? collectOrderedParamRefs(plan.ast) : [];\n\tlet workingParams;\n\tconst indexOfRef = (handle) => {\n\t\treturn refs.indexOf(handle);\n\t};\n\tconst ensureWorkingParams = () => {\n\t\tif (!workingParams) workingParams = [...originalParams];\n\t\treturn workingParams;\n\t};\n\tconst writeAt = (index, value) => {\n\t\tconst buffer = ensureWorkingParams();\n\t\tbuffer[index] = value;\n\t};\n\tfunction* entries() {\n\t\tconst view = workingParams ?? originalParams;\n\t\tfor (let i = 0; i < refs.length; i++) {\n\t\t\tconst ref = refs[i];\n\t\t\tif (!ref) continue;\n\t\t\tconst handle = ref;\n\t\t\tlet value;\n\t\t\tlet codecId;\n\t\t\tif (ref.kind === \"param-ref\") {\n\t\t\t\tvalue = i < view.length ? view[i] : ref.value;\n\t\t\t\tcodecId = ref.codec?.codecId;\n\t\t\t} else {\n\t\t\t\tvalue = i < view.length ? view[i] : void 0;\n\t\t\t\tcodecId = ref.codec.codecId;\n\t\t\t}\n\t\t\tyield {\n\t\t\t\tref: handle,\n\t\t\t\tvalue,\n\t\t\t\tcodecId\n\t\t\t};\n\t\t}\n\t}\n\tfunction replaceValue(handle, newValue) {\n\t\tconst index = indexOfRef(handle);\n\t\tif (index < 0) return;\n\t\twriteAt(index, newValue);\n\t}\n\tfunction replaceValues(updates) {\n\t\tfor (const { ref, newValue } of updates) {\n\t\t\tconst index = indexOfRef(ref);\n\t\t\tif (index < 0) continue;\n\t\t\twriteAt(index, newValue);\n\t\t}\n\t}\n\treturn {\n\t\tentries,\n\t\treplaceValue,\n\t\treplaceValues,\n\t\tcurrentParams() {\n\t\t\tif (!workingParams) return originalParams;\n\t\t\treturn Object.freeze([...workingParams]);\n\t\t}\n\t};\n}\n//#endregion\nexport { createSqlParamRefMutator as t };\n\n//# sourceMappingURL=middleware-CMr4CHNz.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,yBAAyB,MAAM;CACvC,MAAM,iBAAiB,KAAK;CAC5B,MAAM,OAAO,KAAK,MAAM,wBAAwB,KAAK,GAAG,IAAI,CAAC;CAC7D,IAAI;CACJ,MAAM,cAAc,WAAW;EAC9B,OAAO,KAAK,QAAQ,MAAM;CAC3B;CACA,MAAM,4BAA4B;EACjC,IAAI,CAAC,eAAe,gBAAgB,CAAC,GAAG,cAAc;EACtD,OAAO;CACR;CACA,MAAM,WAAW,OAAO,UAAU;EACjC,MAAM,SAAS,oBAAoB;EACnC,OAAO,SAAS;CACjB;CACA,UAAU,UAAU;EACnB,MAAM,OAAO,iBAAiB;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACrC,MAAM,MAAM,KAAK;GACjB,IAAI,CAAC,KAAK;GACV,MAAM,SAAS;GACf,IAAI;GACJ,IAAI;GACJ,IAAI,IAAI,SAAS,aAAa;IAC7B,QAAQ,IAAI,KAAK,SAAS,KAAK,KAAK,IAAI;IACxC,UAAU,IAAI,OAAO;GACtB,OAAO;IACN,QAAQ,IAAI,KAAK,SAAS,KAAK,KAAK,KAAK;IACzC,UAAU,IAAI,MAAM;GACrB;GACA,MAAM;IACL,KAAK;IACL;IACA;GACD;EACD;CACD;CACA,SAAS,aAAa,QAAQ,UAAU;EACvC,MAAM,QAAQ,WAAW,MAAM;EAC/B,IAAI,QAAQ,GAAG;EACf,QAAQ,OAAO,QAAQ;CACxB;CACA,SAAS,cAAc,SAAS;EAC/B,KAAK,MAAM,EAAE,KAAK,cAAc,SAAS;GACxC,MAAM,QAAQ,WAAW,GAAG;GAC5B,IAAI,QAAQ,GAAG;GACf,QAAQ,OAAO,QAAQ;EACxB;CACD;CACA,OAAO;EACN;EACA;EACA;EACA,gBAAgB;GACf,IAAI,CAAC,eAAe,OAAO;GAC3B,OAAO,OAAO,OAAO,CAAC,GAAG,aAAa,CAAC;EACxC;CACD;AACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { deriveProvidedInvariants } from "@prisma/orm-toolchain/migration-tools/invariants";
|
|
2
|
+
import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
3
|
+
import { isThenable } from "@prisma/orm-framework/utils/promise";
|
|
4
|
+
//#region ../../../2-sql/9-family/dist/migration.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Family-owned base class for SQL migrations.
|
|
7
|
+
*
|
|
8
|
+
* Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)
|
|
9
|
+
* and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).
|
|
10
|
+
*
|
|
11
|
+
* Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and
|
|
12
|
+
* a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the
|
|
13
|
+
* fully concrete operation shape. Target-free code in SQL family / tooling
|
|
14
|
+
* parameterises over `TDetails` (and usually `TTargetId = string`).
|
|
15
|
+
*
|
|
16
|
+
* The `Start` / `End` contract generics are forwarded to the framework
|
|
17
|
+
* `Migration` base so the derived `describe()` and the per-target view getters
|
|
18
|
+
* (`PostgresMigration` / `SqliteMigration`) carry each migration's precise
|
|
19
|
+
* contract types. The view getters themselves live on the per-target bases
|
|
20
|
+
* because the SQL ContractView shapes differ per target (SQLite unwraps its
|
|
21
|
+
* sole namespace to the root; Postgres is schema-qualified).
|
|
22
|
+
*
|
|
23
|
+
* Keeps target-free contract/runtime features in the family layer while
|
|
24
|
+
* letting adapters own target shape.
|
|
25
|
+
*/
|
|
26
|
+
var SqlMigration = class extends Migration {
|
|
27
|
+
/**
|
|
28
|
+
* Sorted, deduplicated invariant ids declared by this migration's
|
|
29
|
+
* data-transform ops. Derived from `this.operations` so the field remains
|
|
30
|
+
* consistent with the operation list — planner-built plans (`db init`,
|
|
31
|
+
* `db update`) yield `[]` because they emit no data-transform ops.
|
|
32
|
+
*
|
|
33
|
+
* Required by `SqlMigrationPlan.providedInvariants` (tightened from
|
|
34
|
+
* optional at the SQL-family layer); the framework-level
|
|
35
|
+
* `MigrationPlan.providedInvariants?` stays optional.
|
|
36
|
+
*/
|
|
37
|
+
get providedInvariants() {
|
|
38
|
+
return deriveProvidedInvariants(this.operations.filter((op) => !isThenable(op)));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { SqlMigration as t };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=migration-CK4oePIo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-CK4oePIo.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/migration.mjs"],"sourcesContent":["import { deriveProvidedInvariants } from \"@internal/migration-tools/invariants\";\nimport { Migration } from \"@internal/migration-tools/migration\";\nimport { isThenable } from \"@internal/utils/promise\";\n//#region src/core/sql-migration.ts\n/**\n* Family-owned base class for SQL migrations.\n*\n* Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)\n* and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).\n*\n* Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and\n* a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the\n* fully concrete operation shape. Target-free code in SQL family / tooling\n* parameterises over `TDetails` (and usually `TTargetId = string`).\n*\n* The `Start` / `End` contract generics are forwarded to the framework\n* `Migration` base so the derived `describe()` and the per-target view getters\n* (`PostgresMigration` / `SqliteMigration`) carry each migration's precise\n* contract types. The view getters themselves live on the per-target bases\n* because the SQL ContractView shapes differ per target (SQLite unwraps its\n* sole namespace to the root; Postgres is schema-qualified).\n*\n* Keeps target-free contract/runtime features in the family layer while\n* letting adapters own target shape.\n*/\nvar SqlMigration = class extends Migration {\n\t/**\n\t* Sorted, deduplicated invariant ids declared by this migration's\n\t* data-transform ops. Derived from `this.operations` so the field remains\n\t* consistent with the operation list — planner-built plans (`db init`,\n\t* `db update`) yield `[]` because they emit no data-transform ops.\n\t*\n\t* Required by `SqlMigrationPlan.providedInvariants` (tightened from\n\t* optional at the SQL-family layer); the framework-level\n\t* `MigrationPlan.providedInvariants?` stays optional.\n\t*/\n\tget providedInvariants() {\n\t\treturn deriveProvidedInvariants(this.operations.filter((op) => !isThenable(op)));\n\t}\n};\n//#endregion\nexport { SqlMigration as Migration };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAI,eAAe,cAAc,UAAU;;;;;;;;;;;CAW1C,IAAI,qBAAqB;EACxB,OAAO,yBAAyB,KAAK,WAAW,QAAQ,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAChF;AACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { c as SqlStorage } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
|
|
2
|
+
import "./types-BchwQpmO.mjs";
|
|
3
|
+
import { f as SqlMigrationPlanOperation, w as SqlPlanTargetDetails } from "./types-IqZMLrFC-DtdJNICr.mjs";
|
|
4
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
5
|
+
import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
6
|
+
//#region ../../../2-sql/9-family/dist/migration.d.mts
|
|
7
|
+
//#region src/core/sql-migration.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Family-owned base class for SQL migrations.
|
|
10
|
+
*
|
|
11
|
+
* Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)
|
|
12
|
+
* and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).
|
|
13
|
+
*
|
|
14
|
+
* Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and
|
|
15
|
+
* a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the
|
|
16
|
+
* fully concrete operation shape. Target-free code in SQL family / tooling
|
|
17
|
+
* parameterises over `TDetails` (and usually `TTargetId = string`).
|
|
18
|
+
*
|
|
19
|
+
* The `Start` / `End` contract generics are forwarded to the framework
|
|
20
|
+
* `Migration` base so the derived `describe()` and the per-target view getters
|
|
21
|
+
* (`PostgresMigration` / `SqliteMigration`) carry each migration's precise
|
|
22
|
+
* contract types. The view getters themselves live on the per-target bases
|
|
23
|
+
* because the SQL ContractView shapes differ per target (SQLite unwraps its
|
|
24
|
+
* sole namespace to the root; Postgres is schema-qualified).
|
|
25
|
+
*
|
|
26
|
+
* Keeps target-free contract/runtime features in the family layer while
|
|
27
|
+
* letting adapters own target shape.
|
|
28
|
+
*/
|
|
29
|
+
declare abstract class SqlMigration<TDetails extends SqlPlanTargetDetails, TTargetId extends string = string, Start extends Contract<SqlStorage> = Contract<SqlStorage>, End extends Contract<SqlStorage> = Contract<SqlStorage>> extends Migration<SqlMigrationPlanOperation<TDetails>, 'sql', TTargetId, Start, End> {
|
|
30
|
+
/**
|
|
31
|
+
* Sorted, deduplicated invariant ids declared by this migration's
|
|
32
|
+
* data-transform ops. Derived from `this.operations` so the field remains
|
|
33
|
+
* consistent with the operation list — planner-built plans (`db init`,
|
|
34
|
+
* `db update`) yield `[]` because they emit no data-transform ops.
|
|
35
|
+
*
|
|
36
|
+
* Required by `SqlMigrationPlan.providedInvariants` (tightened from
|
|
37
|
+
* optional at the SQL-family layer); the framework-level
|
|
38
|
+
* `MigrationPlan.providedInvariants?` stays optional.
|
|
39
|
+
*/
|
|
40
|
+
get providedInvariants(): readonly string[];
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { SqlMigration as t };
|
|
44
|
+
//# sourceMappingURL=migration-CW0ZJLxP.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-CW0ZJLxP.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/migration.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BuB,aAAa,iBAAiB,sBAAsB,mCAAmC,cAAc,SAAS,cAAc,SAAS,aAAa,YAAY,SAAS,cAAc,SAAS,qBAAqB,UAAU,0BAA0B,kBAAkB,WAAW,OAAO;;;;;;;;;;;MAW5S"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
//#region ../../../2-sql/1-core/schema-ir/dist/naming-BwqqVcZy.mjs
|
|
5
|
+
function defaultIndexName(tableName, columns) {
|
|
6
|
+
return `${tableName}_${columns.join("_")}_idx`;
|
|
7
|
+
}
|
|
8
|
+
/** The flat name the union describes. Inverse of {@link namingOf}. */
|
|
9
|
+
function nameOf(naming) {
|
|
10
|
+
return naming.kind === "wire" ? formatWireName(naming.prefix, naming.hash) : naming.name;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The naming a name-identified node was built with, read back off the flat
|
|
14
|
+
* pair it stores. Inverse of {@link nameOf}, and total for that
|
|
15
|
+
* reason: the constructor derived `name` from the union, so the two agree.
|
|
16
|
+
* Flat data arriving from outside the process goes through
|
|
17
|
+
* {@link parseNaming} instead.
|
|
18
|
+
*/
|
|
19
|
+
function namingOf(name, prefix) {
|
|
20
|
+
if (prefix === void 0) return {
|
|
21
|
+
kind: "exact",
|
|
22
|
+
name
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
kind: "wire",
|
|
26
|
+
prefix,
|
|
27
|
+
hash: name.slice(prefix.length + 1)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads naming out of flat stored data — deserialized contract JSON and the
|
|
32
|
+
* literals a user may hand-edit, the one place a name and a prefix can still
|
|
33
|
+
* disagree. Throws when a declared prefix does not parse back out of the name.
|
|
34
|
+
*/
|
|
35
|
+
function parseNaming(name, prefix) {
|
|
36
|
+
if (prefix === void 0) return {
|
|
37
|
+
kind: "exact",
|
|
38
|
+
name
|
|
39
|
+
};
|
|
40
|
+
const parsed = parseWireName(name);
|
|
41
|
+
if (parsed === void 0 || parsed.prefix !== prefix) throw new ContractValidationError(`"${name}": prefix "${prefix}" does not match the wire name (expected "${formatWireName(prefix, "<8hex>")}").`, "storage");
|
|
42
|
+
return {
|
|
43
|
+
kind: "wire",
|
|
44
|
+
prefix: parsed.prefix,
|
|
45
|
+
hash: parsed.hash
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The naming an object read out of a live catalog has: a wire-shaped name
|
|
50
|
+
* gets the wire arm so the rename pass can pair it by prefix, and every
|
|
51
|
+
* other name is exact.
|
|
52
|
+
*
|
|
53
|
+
* The wire answer is a claim about the name's SHAPE only — the hash is
|
|
54
|
+
* deliberately not recomputed from the object's content here. Nothing
|
|
55
|
+
* downstream reads it as more than that: the differ always asks the
|
|
56
|
+
* contract-derived side to choose the comparison, so a shape-only wire
|
|
57
|
+
* claim on the introspected side never suppresses a body comparison, and
|
|
58
|
+
* `contract infer` recomputes the hash independently before it will emit an
|
|
59
|
+
* index as wire-named.
|
|
60
|
+
*/
|
|
61
|
+
function namingOfLiveName(name) {
|
|
62
|
+
const wire = parseWireName(name);
|
|
63
|
+
return wire === void 0 ? {
|
|
64
|
+
kind: "exact",
|
|
65
|
+
name
|
|
66
|
+
} : {
|
|
67
|
+
kind: "wire",
|
|
68
|
+
prefix: wire.prefix,
|
|
69
|
+
hash: wire.hash
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const WIRE_NAME_PATTERN = /^(.+)_([0-9a-f]{8})$/;
|
|
73
|
+
/**
|
|
74
|
+
* Assembles a wire name from its user-supplied prefix and its 8-hex
|
|
75
|
+
* content-hash suffix. This module owns the `<prefix>_<hash>` format on both
|
|
76
|
+
* sides — construction here and parsing in {@link parseWireName} — so the two
|
|
77
|
+
* never drift.
|
|
78
|
+
*/
|
|
79
|
+
function formatWireName(prefix, hash) {
|
|
80
|
+
return `${prefix}_${hash}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Splits a wire name (`<prefix>_<8hex>`) into its prefix and content-hash
|
|
84
|
+
* suffix. Returns `undefined` when the name does not follow the wire-name
|
|
85
|
+
* shape (e.g. an object created outside the toolchain) — callers treat such
|
|
86
|
+
* names as all-prefix. Consumed by introspection (prefix extraction) and by
|
|
87
|
+
* rename pairing (same hash, different prefix).
|
|
88
|
+
*/
|
|
89
|
+
function parseWireName(name) {
|
|
90
|
+
const match = WIRE_NAME_PATTERN.exec(name);
|
|
91
|
+
const prefix = match?.[1];
|
|
92
|
+
const hash = match?.[2];
|
|
93
|
+
if (prefix === void 0 || hash === void 0) return void 0;
|
|
94
|
+
return {
|
|
95
|
+
prefix,
|
|
96
|
+
hash
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Stabilizes an authored SQL body (index expression, partial-index predicate,
|
|
101
|
+
* RLS policy predicate) for hashing: trim, and collapse runs of internal
|
|
102
|
+
* whitespace to a single space.
|
|
103
|
+
*
|
|
104
|
+
* This is deliberately minimal. The content hash is the equivalence relation
|
|
105
|
+
* for a wire-named object, and the wire name (prefix + hash) is the only
|
|
106
|
+
* thing ever compared — the hash is never recomputed from an introspected
|
|
107
|
+
* body, so there is no need to match the database's reprinted form. Minimal
|
|
108
|
+
* normalization also protects the no-collision property: aggressive rewriting
|
|
109
|
+
* (lowercasing, paren-stripping, cast-alias folding) risks collapsing two
|
|
110
|
+
* distinct bodies onto one hash.
|
|
111
|
+
*
|
|
112
|
+
* The normalizer is a stability commitment: any change re-suffixes all wire names.
|
|
113
|
+
*/
|
|
114
|
+
function normalizeSqlBody(sql) {
|
|
115
|
+
return sql.replace(/\s+/g, " ").trim();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the first 8 lowercase hex characters of the SHA-256 digest over the
|
|
119
|
+
* canonical content tuple for an index:
|
|
120
|
+
*
|
|
121
|
+
* [normalizeSqlBody(expression), normalizeSqlBody(where), columns, unique, type, sortedOptions]
|
|
122
|
+
*
|
|
123
|
+
* Columns hash in authored order — column order is semantic in an index.
|
|
124
|
+
* Option values are `String()`-coerced (matching the loose option equality
|
|
125
|
+
* used for diffing) so a hash computed from typed contract values agrees with
|
|
126
|
+
* one recomputed from introspected reloptions strings. The prefix, schema,
|
|
127
|
+
* and table are excluded (they are orthogonal to index equivalence).
|
|
128
|
+
*
|
|
129
|
+
* The tuple order and encoding are a stability commitment with the same
|
|
130
|
+
* status as the RLS tuple: any change re-suffixes every wire name.
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* Canonicalizes one index option VALUE to the `on`/`off` boolean spelling:
|
|
134
|
+
* JS booleans and the common catalog spellings (`pg_class.reloptions`
|
|
135
|
+
* stores whatever spelling the DDL used, so a live index may carry
|
|
136
|
+
* `'true'`/`'false'` or `'on'`/`'off'`) all map to one form; everything
|
|
137
|
+
* else via `String()` (fully specified for numbers, so no platform
|
|
138
|
+
* variance). Shared by the wire-name hash tuple, the node's option
|
|
139
|
+
* equality, and the DDL renderer, so an authored `{ fastupdate: true }`
|
|
140
|
+
* agrees with a live index created under any boolean spelling.
|
|
141
|
+
*/
|
|
142
|
+
function normalizeIndexOptionValue(value) {
|
|
143
|
+
if (value === true || value === "true" || value === "on") return "on";
|
|
144
|
+
if (value === false || value === "false" || value === "off") return "off";
|
|
145
|
+
return String(value);
|
|
146
|
+
}
|
|
147
|
+
function computeIndexContentHash(parts) {
|
|
148
|
+
const sortedOptions = Object.entries(parts.options ?? {}).map(([key, value]) => [key, normalizeIndexOptionValue(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
149
|
+
const tuple = JSON.stringify([
|
|
150
|
+
normalizeSqlBody(parts.expression ?? ""),
|
|
151
|
+
normalizeSqlBody(parts.where ?? ""),
|
|
152
|
+
parts.columns ?? [],
|
|
153
|
+
parts.unique,
|
|
154
|
+
parts.type ?? "",
|
|
155
|
+
sortedOptions
|
|
156
|
+
]);
|
|
157
|
+
return createHash("sha256").update(tuple).digest("hex").slice(0, 8);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Postgres identifiers cap at 63 characters and the wire name appends a
|
|
161
|
+
* 9-character `_<8hex>` suffix, so an authored prefix is bounded at 54.
|
|
162
|
+
*/
|
|
163
|
+
const WIRE_NAME_PREFIX_MAX_LENGTH = 54;
|
|
164
|
+
/**
|
|
165
|
+
* Rejects a wire-name prefix over {@link WIRE_NAME_PREFIX_MAX_LENGTH}.
|
|
166
|
+
* `subject` opens the error message (e.g. `defineContract: policy prefix`).
|
|
167
|
+
*/
|
|
168
|
+
function assertWireNamePrefixLength(prefix, subject) {
|
|
169
|
+
if (prefix.length > 54) throw structuredError("CONTRACT.WIRE_NAME_PREFIX_TOO_LONG", `${subject} "${prefix}" exceeds the 54-character maximum (Postgres identifiers cap at 63 characters and the wire name appends a 9-character hash suffix).`, { meta: {
|
|
170
|
+
prefix,
|
|
171
|
+
maxLength: 54
|
|
172
|
+
} });
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { formatWireName as a, namingOfLiveName as c, parseNaming as d, parseWireName as f, defaultIndexName as i, normalizeIndexOptionValue as l, assertWireNamePrefixLength as n, nameOf as o, computeIndexContentHash as r, namingOf as s, WIRE_NAME_PREFIX_MAX_LENGTH as t, normalizeSqlBody as u };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=naming-BwqqVcZy-BgTObIQw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-BwqqVcZy-BgTObIQw.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/naming-BwqqVcZy.mjs"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/naming.ts\nfunction defaultIndexName(tableName, columns) {\n\treturn `${tableName}_${columns.join(\"_\")}_idx`;\n}\n/** The flat name the union describes. Inverse of {@link namingOf}. */\nfunction nameOf(naming) {\n\treturn naming.kind === \"wire\" ? formatWireName(naming.prefix, naming.hash) : naming.name;\n}\n/**\n* The naming a name-identified node was built with, read back off the flat\n* pair it stores. Inverse of {@link nameOf}, and total for that\n* reason: the constructor derived `name` from the union, so the two agree.\n* Flat data arriving from outside the process goes through\n* {@link parseNaming} instead.\n*/\nfunction namingOf(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix,\n\t\thash: name.slice(prefix.length + 1)\n\t};\n}\n/**\n* Reads naming out of flat stored data — deserialized contract JSON and the\n* literals a user may hand-edit, the one place a name and a prefix can still\n* disagree. Throws when a declared prefix does not parse back out of the name.\n*/\nfunction parseNaming(name, prefix) {\n\tif (prefix === void 0) return {\n\t\tkind: \"exact\",\n\t\tname\n\t};\n\tconst parsed = parseWireName(name);\n\tif (parsed === void 0 || parsed.prefix !== prefix) throw new ContractValidationError(`\"${name}\": prefix \"${prefix}\" does not match the wire name (expected \"${formatWireName(prefix, \"<8hex>\")}\").`, \"storage\");\n\treturn {\n\t\tkind: \"wire\",\n\t\tprefix: parsed.prefix,\n\t\thash: parsed.hash\n\t};\n}\n/**\n* The naming an object read out of a live catalog has: a wire-shaped name\n* gets the wire arm so the rename pass can pair it by prefix, and every\n* other name is exact.\n*\n* The wire answer is a claim about the name's SHAPE only — the hash is\n* deliberately not recomputed from the object's content here. Nothing\n* downstream reads it as more than that: the differ always asks the\n* contract-derived side to choose the comparison, so a shape-only wire\n* claim on the introspected side never suppresses a body comparison, and\n* `contract infer` recomputes the hash independently before it will emit an\n* index as wire-named.\n*/\nfunction namingOfLiveName(name) {\n\tconst wire = parseWireName(name);\n\treturn wire === void 0 ? {\n\t\tkind: \"exact\",\n\t\tname\n\t} : {\n\t\tkind: \"wire\",\n\t\tprefix: wire.prefix,\n\t\thash: wire.hash\n\t};\n}\nconst WIRE_NAME_PATTERN = /^(.+)_([0-9a-f]{8})$/;\n/**\n* Assembles a wire name from its user-supplied prefix and its 8-hex\n* content-hash suffix. This module owns the `<prefix>_<hash>` format on both\n* sides — construction here and parsing in {@link parseWireName} — so the two\n* never drift.\n*/\nfunction formatWireName(prefix, hash) {\n\treturn `${prefix}_${hash}`;\n}\n/**\n* Splits a wire name (`<prefix>_<8hex>`) into its prefix and content-hash\n* suffix. Returns `undefined` when the name does not follow the wire-name\n* shape (e.g. an object created outside the toolchain) — callers treat such\n* names as all-prefix. Consumed by introspection (prefix extraction) and by\n* rename pairing (same hash, different prefix).\n*/\nfunction parseWireName(name) {\n\tconst match = WIRE_NAME_PATTERN.exec(name);\n\tconst prefix = match?.[1];\n\tconst hash = match?.[2];\n\tif (prefix === void 0 || hash === void 0) return void 0;\n\treturn {\n\t\tprefix,\n\t\thash\n\t};\n}\n/**\n* Stabilizes an authored SQL body (index expression, partial-index predicate,\n* RLS policy predicate) for hashing: trim, and collapse runs of internal\n* whitespace to a single space.\n*\n* This is deliberately minimal. The content hash is the equivalence relation\n* for a wire-named object, and the wire name (prefix + hash) is the only\n* thing ever compared — the hash is never recomputed from an introspected\n* body, so there is no need to match the database's reprinted form. Minimal\n* normalization also protects the no-collision property: aggressive rewriting\n* (lowercasing, paren-stripping, cast-alias folding) risks collapsing two\n* distinct bodies onto one hash.\n*\n* The normalizer is a stability commitment: any change re-suffixes all wire names.\n*/\nfunction normalizeSqlBody(sql) {\n\treturn sql.replace(/\\s+/g, \" \").trim();\n}\n/**\n* Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n* canonical content tuple for an index:\n*\n* [normalizeSqlBody(expression), normalizeSqlBody(where), columns, unique, type, sortedOptions]\n*\n* Columns hash in authored order — column order is semantic in an index.\n* Option values are `String()`-coerced (matching the loose option equality\n* used for diffing) so a hash computed from typed contract values agrees with\n* one recomputed from introspected reloptions strings. The prefix, schema,\n* and table are excluded (they are orthogonal to index equivalence).\n*\n* The tuple order and encoding are a stability commitment with the same\n* status as the RLS tuple: any change re-suffixes every wire name.\n*/\n/**\n* Canonicalizes one index option VALUE to the `on`/`off` boolean spelling:\n* JS booleans and the common catalog spellings (`pg_class.reloptions`\n* stores whatever spelling the DDL used, so a live index may carry\n* `'true'`/`'false'` or `'on'`/`'off'`) all map to one form; everything\n* else via `String()` (fully specified for numbers, so no platform\n* variance). Shared by the wire-name hash tuple, the node's option\n* equality, and the DDL renderer, so an authored `{ fastupdate: true }`\n* agrees with a live index created under any boolean spelling.\n*/\nfunction normalizeIndexOptionValue(value) {\n\tif (value === true || value === \"true\" || value === \"on\") return \"on\";\n\tif (value === false || value === \"false\" || value === \"off\") return \"off\";\n\treturn String(value);\n}\nfunction computeIndexContentHash(parts) {\n\tconst sortedOptions = Object.entries(parts.options ?? {}).map(([key, value]) => [key, normalizeIndexOptionValue(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);\n\tconst tuple = JSON.stringify([\n\t\tnormalizeSqlBody(parts.expression ?? \"\"),\n\t\tnormalizeSqlBody(parts.where ?? \"\"),\n\t\tparts.columns ?? [],\n\t\tparts.unique,\n\t\tparts.type ?? \"\",\n\t\tsortedOptions\n\t]);\n\treturn createHash(\"sha256\").update(tuple).digest(\"hex\").slice(0, 8);\n}\n/**\n* Postgres identifiers cap at 63 characters and the wire name appends a\n* 9-character `_<8hex>` suffix, so an authored prefix is bounded at 54.\n*/\nconst WIRE_NAME_PREFIX_MAX_LENGTH = 54;\n/**\n* Rejects a wire-name prefix over {@link WIRE_NAME_PREFIX_MAX_LENGTH}.\n* `subject` opens the error message (e.g. `defineContract: policy prefix`).\n*/\nfunction assertWireNamePrefixLength(prefix, subject) {\n\tif (prefix.length > 54) throw structuredError(\"CONTRACT.WIRE_NAME_PREFIX_TOO_LONG\", `${subject} \"${prefix}\" exceeds the 54-character maximum (Postgres identifiers cap at 63 characters and the wire name appends a 9-character hash suffix).`, { meta: {\n\t\tprefix,\n\t\tmaxLength: 54\n\t} });\n}\n//#endregion\nexport { formatWireName as a, namingOfLiveName as c, parseNaming as d, parseWireName as f, defaultIndexName as i, normalizeIndexOptionValue as l, assertWireNamePrefixLength as n, nameOf as o, computeIndexContentHash as r, namingOf as s, WIRE_NAME_PREFIX_MAX_LENGTH as t, normalizeSqlBody as u };\n\n//# sourceMappingURL=naming-BwqqVcZy.mjs.map"],"mappings":";;;;AAIA,SAAS,iBAAiB,WAAW,SAAS;CAC7C,OAAO,GAAG,UAAU,GAAG,QAAQ,KAAK,GAAG,EAAE;AAC1C;;AAEA,SAAS,OAAO,QAAQ;CACvB,OAAO,OAAO,SAAS,SAAS,eAAe,OAAO,QAAQ,OAAO,IAAI,IAAI,OAAO;AACrF;;;;;;;;AAQA,SAAS,SAAS,MAAM,QAAQ;CAC/B,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,OAAO;EACN,MAAM;EACN;EACA,MAAM,KAAK,MAAM,OAAO,SAAS,CAAC;CACnC;AACD;;;;;;AAMA,SAAS,YAAY,MAAM,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,MAAM,SAAS,cAAc,IAAI;CACjC,IAAI,WAAW,KAAK,KAAK,OAAO,WAAW,QAAQ,MAAM,IAAI,wBAAwB,IAAI,KAAK,aAAa,OAAO,4CAA4C,eAAe,QAAQ,QAAQ,EAAE,MAAM,SAAS;CAC9M,OAAO;EACN,MAAM;EACN,QAAQ,OAAO;EACf,MAAM,OAAO;CACd;AACD;;;;;;;;;;;;;;AAcA,SAAS,iBAAiB,MAAM;CAC/B,MAAM,OAAO,cAAc,IAAI;CAC/B,OAAO,SAAS,KAAK,IAAI;EACxB,MAAM;EACN;CACD,IAAI;EACH,MAAM;EACN,QAAQ,KAAK;EACb,MAAM,KAAK;CACZ;AACD;AACA,MAAM,oBAAoB;;;;;;;AAO1B,SAAS,eAAe,QAAQ,MAAM;CACrC,OAAO,GAAG,OAAO,GAAG;AACrB;;;;;;;;AAQA,SAAS,cAAc,MAAM;CAC5B,MAAM,QAAQ,kBAAkB,KAAK,IAAI;CACzC,MAAM,SAAS,QAAQ;CACvB,MAAM,OAAO,QAAQ;CACrB,IAAI,WAAW,KAAK,KAAK,SAAS,KAAK,GAAG,OAAO,KAAK;CACtD,OAAO;EACN;EACA;CACD;AACD;;;;;;;;;;;;;;;;AAgBA,SAAS,iBAAiB,KAAK;CAC9B,OAAO,IAAI,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;AACtC;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,0BAA0B,OAAO;CACzC,IAAI,UAAU,QAAQ,UAAU,UAAU,UAAU,MAAM,OAAO;CACjE,IAAI,UAAU,SAAS,UAAU,WAAW,UAAU,OAAO,OAAO;CACpE,OAAO,OAAO,KAAK;AACpB;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,gBAAgB,OAAO,QAAQ,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,0BAA0B,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC;CACtK,MAAM,QAAQ,KAAK,UAAU;EAC5B,iBAAiB,MAAM,cAAc,EAAE;EACvC,iBAAiB,MAAM,SAAS,EAAE;EAClC,MAAM,WAAW,CAAC;EAClB,MAAM;EACN,MAAM,QAAQ;EACd;CACD,CAAC;CACD,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AACnE;;;;;AAKA,MAAM,8BAA8B;;;;;AAKpC,SAAS,2BAA2B,QAAQ,SAAS;CACpD,IAAI,OAAO,SAAS,IAAI,MAAM,gBAAgB,sCAAsC,GAAG,QAAQ,IAAI,OAAO,sIAAsI,EAAE,MAAM;EACvP;EACA,WAAW;CACZ,EAAE,CAAC;AACJ"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//#region ../../../2-sql/1-core/schema-ir/dist/naming-jLgdauLi.d.mts
|
|
2
|
+
//#region src/naming.d.ts
|
|
3
|
+
declare function defaultIndexName(tableName: string, columns: readonly string[]): string;
|
|
4
|
+
interface WireName {
|
|
5
|
+
/** The user-supplied part before the `_<8hex>` suffix. */
|
|
6
|
+
readonly prefix: string;
|
|
7
|
+
/** The 8-lowercase-hex content-hash suffix. */
|
|
8
|
+
readonly hash: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Where a name-identified object's name comes from: `wire` means the
|
|
12
|
+
* toolchain derives it as `formatWireName(prefix, hash)`; `exact` means the
|
|
13
|
+
* author owns it verbatim. Because the wire arm carries only the prefix
|
|
14
|
+
* and the hash, a name that disagrees with its prefix is unrepresentable.
|
|
15
|
+
*
|
|
16
|
+
* Storage and JSON stay flat (`name` plus an optional `prefix`);
|
|
17
|
+
* {@link parseNaming} is the way back in.
|
|
18
|
+
*/
|
|
19
|
+
type SqlObjectNaming = {
|
|
20
|
+
readonly kind: 'exact';
|
|
21
|
+
readonly name: string;
|
|
22
|
+
} | ({
|
|
23
|
+
readonly kind: 'wire';
|
|
24
|
+
} & WireName);
|
|
25
|
+
/** The flat name the union describes. Inverse of {@link namingOf}. */
|
|
26
|
+
declare function nameOf(naming: SqlObjectNaming): string;
|
|
27
|
+
/**
|
|
28
|
+
* The naming a name-identified node was built with, read back off the flat
|
|
29
|
+
* pair it stores. Inverse of {@link nameOf}, and total for that
|
|
30
|
+
* reason: the constructor derived `name` from the union, so the two agree.
|
|
31
|
+
* Flat data arriving from outside the process goes through
|
|
32
|
+
* {@link parseNaming} instead.
|
|
33
|
+
*/
|
|
34
|
+
declare function namingOf(name: string, prefix: string | undefined): SqlObjectNaming;
|
|
35
|
+
/**
|
|
36
|
+
* Reads naming out of flat stored data — deserialized contract JSON and the
|
|
37
|
+
* literals a user may hand-edit, the one place a name and a prefix can still
|
|
38
|
+
* disagree. Throws when a declared prefix does not parse back out of the name.
|
|
39
|
+
*/
|
|
40
|
+
declare function parseNaming(name: string, prefix: string | undefined): SqlObjectNaming;
|
|
41
|
+
/**
|
|
42
|
+
* The naming an object read out of a live catalog has: a wire-shaped name
|
|
43
|
+
* gets the wire arm so the rename pass can pair it by prefix, and every
|
|
44
|
+
* other name is exact.
|
|
45
|
+
*
|
|
46
|
+
* The wire answer is a claim about the name's SHAPE only — the hash is
|
|
47
|
+
* deliberately not recomputed from the object's content here. Nothing
|
|
48
|
+
* downstream reads it as more than that: the differ always asks the
|
|
49
|
+
* contract-derived side to choose the comparison, so a shape-only wire
|
|
50
|
+
* claim on the introspected side never suppresses a body comparison, and
|
|
51
|
+
* `contract infer` recomputes the hash independently before it will emit an
|
|
52
|
+
* index as wire-named.
|
|
53
|
+
*/
|
|
54
|
+
declare function namingOfLiveName(name: string): SqlObjectNaming;
|
|
55
|
+
/**
|
|
56
|
+
* Assembles a wire name from its user-supplied prefix and its 8-hex
|
|
57
|
+
* content-hash suffix. This module owns the `<prefix>_<hash>` format on both
|
|
58
|
+
* sides — construction here and parsing in {@link parseWireName} — so the two
|
|
59
|
+
* never drift.
|
|
60
|
+
*/
|
|
61
|
+
declare function formatWireName(prefix: string, hash: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Splits a wire name (`<prefix>_<8hex>`) into its prefix and content-hash
|
|
64
|
+
* suffix. Returns `undefined` when the name does not follow the wire-name
|
|
65
|
+
* shape (e.g. an object created outside the toolchain) — callers treat such
|
|
66
|
+
* names as all-prefix. Consumed by introspection (prefix extraction) and by
|
|
67
|
+
* rename pairing (same hash, different prefix).
|
|
68
|
+
*/
|
|
69
|
+
declare function parseWireName(name: string): WireName | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Stabilizes an authored SQL body (index expression, partial-index predicate,
|
|
72
|
+
* RLS policy predicate) for hashing: trim, and collapse runs of internal
|
|
73
|
+
* whitespace to a single space.
|
|
74
|
+
*
|
|
75
|
+
* This is deliberately minimal. The content hash is the equivalence relation
|
|
76
|
+
* for a wire-named object, and the wire name (prefix + hash) is the only
|
|
77
|
+
* thing ever compared — the hash is never recomputed from an introspected
|
|
78
|
+
* body, so there is no need to match the database's reprinted form. Minimal
|
|
79
|
+
* normalization also protects the no-collision property: aggressive rewriting
|
|
80
|
+
* (lowercasing, paren-stripping, cast-alias folding) risks collapsing two
|
|
81
|
+
* distinct bodies onto one hash.
|
|
82
|
+
*
|
|
83
|
+
* The normalizer is a stability commitment: any change re-suffixes all wire names.
|
|
84
|
+
*/
|
|
85
|
+
declare function normalizeSqlBody(sql: string): string;
|
|
86
|
+
interface IndexContentHashParts {
|
|
87
|
+
readonly expression?: string;
|
|
88
|
+
readonly where?: string;
|
|
89
|
+
readonly columns?: readonly string[];
|
|
90
|
+
readonly unique: boolean;
|
|
91
|
+
readonly type?: string;
|
|
92
|
+
readonly options?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns the first 8 lowercase hex characters of the SHA-256 digest over the
|
|
96
|
+
* canonical content tuple for an index:
|
|
97
|
+
*
|
|
98
|
+
* [normalizeSqlBody(expression), normalizeSqlBody(where), columns, unique, type, sortedOptions]
|
|
99
|
+
*
|
|
100
|
+
* Columns hash in authored order — column order is semantic in an index.
|
|
101
|
+
* Option values are `String()`-coerced (matching the loose option equality
|
|
102
|
+
* used for diffing) so a hash computed from typed contract values agrees with
|
|
103
|
+
* one recomputed from introspected reloptions strings. The prefix, schema,
|
|
104
|
+
* and table are excluded (they are orthogonal to index equivalence).
|
|
105
|
+
*
|
|
106
|
+
* The tuple order and encoding are a stability commitment with the same
|
|
107
|
+
* status as the RLS tuple: any change re-suffixes every wire name.
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* Canonicalizes one index option VALUE to the `on`/`off` boolean spelling:
|
|
111
|
+
* JS booleans and the common catalog spellings (`pg_class.reloptions`
|
|
112
|
+
* stores whatever spelling the DDL used, so a live index may carry
|
|
113
|
+
* `'true'`/`'false'` or `'on'`/`'off'`) all map to one form; everything
|
|
114
|
+
* else via `String()` (fully specified for numbers, so no platform
|
|
115
|
+
* variance). Shared by the wire-name hash tuple, the node's option
|
|
116
|
+
* equality, and the DDL renderer, so an authored `{ fastupdate: true }`
|
|
117
|
+
* agrees with a live index created under any boolean spelling.
|
|
118
|
+
*/
|
|
119
|
+
declare function normalizeIndexOptionValue(value: unknown): string;
|
|
120
|
+
declare function computeIndexContentHash(parts: IndexContentHashParts): string;
|
|
121
|
+
/**
|
|
122
|
+
* Postgres identifiers cap at 63 characters and the wire name appends a
|
|
123
|
+
* 9-character `_<8hex>` suffix, so an authored prefix is bounded at 54.
|
|
124
|
+
*/
|
|
125
|
+
declare const WIRE_NAME_PREFIX_MAX_LENGTH = 54;
|
|
126
|
+
/**
|
|
127
|
+
* Rejects a wire-name prefix over {@link WIRE_NAME_PREFIX_MAX_LENGTH}.
|
|
128
|
+
* `subject` opens the error message (e.g. `defineContract: policy prefix`).
|
|
129
|
+
*/
|
|
130
|
+
declare function assertWireNamePrefixLength(prefix: string, subject: string): void;
|
|
131
|
+
//#endregion
|
|
132
|
+
export { assertWireNamePrefixLength as a, formatWireName as c, namingOfLiveName as d, normalizeIndexOptionValue as f, parseWireName as h, WireName as i, nameOf as l, parseNaming as m, SqlObjectNaming as n, computeIndexContentHash as o, normalizeSqlBody as p, WIRE_NAME_PREFIX_MAX_LENGTH as r, defaultIndexName as s, IndexContentHashParts as t, namingOf as u };
|
|
133
|
+
//# sourceMappingURL=naming-jLgdauLi-C84G_UHi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-jLgdauLi-C84G_UHi.d.mts","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/naming-jLgdauLi.d.mts"],"mappings":";;iBACiB,iBAAiB,mBAAmB;UAC3C;;WAEC;;WAEA;;;;;;;;;;;KAWN;WACM;WACA;;WAEA;IACP;;iBAEa,OAAO,QAAQ;;;;;;;;iBAQf,SAAS,cAAc,6BAA6B;;;;;;iBAMpD,YAAY,cAAc,6BAA6B;;;;;;;;;;;;;;iBAcvD,iBAAiB,eAAe;;;;;;;iBAOhC,eAAe,gBAAgB;;;;;;;;iBAQ/B,cAAc,eAAe;;;;;;;;;;;;;;;;iBAgB7B,iBAAiB;UACxB;WACC;WACA;WACA;WACA;WACA;WACA,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BJ,0BAA0B;iBAC1B,wBAAwB,OAAO;;;;;cAKlC;;;;;iBAKG,2BAA2B,gBAAgB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as SqlOperationRegistry, i as SqlOperationEntry, n as SqlOperationDescriptor, o as createSqlOperationRegistry, r as SqlOperationDescriptors, t as SqlLoweringSpec } from "./index-BgaTJRxj.mjs";
|
|
2
|
+
export { SqlLoweringSpec, SqlOperationDescriptor, SqlOperationDescriptors, SqlOperationEntry, SqlOperationRegistry, createSqlOperationRegistry };
|