@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,92 @@
|
|
|
1
|
+
//#region ../../../2-sql/1-core/contract/dist/entity-handle-lowering-hook.d.mts
|
|
2
|
+
//#region src/entity-handle-lowering-hook.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* SQL-family extension to the pack authoring contributions: a pack whose
|
|
5
|
+
* `entityTypes` registers entity kinds may implement a batch lowering hook
|
|
6
|
+
* that turns author-declared pack-entity handles (the generic `entities`
|
|
7
|
+
* list on the TS contract input) into `entries` rows.
|
|
8
|
+
*
|
|
9
|
+
* The generic contract build (`contract-ts`) owns the kind-agnostic walk: it
|
|
10
|
+
* groups handles by the pack that registered each `entityKind`, resolves
|
|
11
|
+
* each handle's declared model refs to storage table coordinates using the
|
|
12
|
+
* same model→table maps the relation lowering uses, and calls the owning
|
|
13
|
+
* pack's hook once with all of its claimed handles — batch, so the hook's
|
|
14
|
+
* diagnostics can see sibling handles. Neither the walk nor these types name
|
|
15
|
+
* any specific entity kind.
|
|
16
|
+
*
|
|
17
|
+
* SQL-family concept — the resolved-ref shape is a table coordinate, so the
|
|
18
|
+
* hook lives here beside {@link ../value-set-derivation-hook} instead of on
|
|
19
|
+
* the framework contributions type.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* An authored pack-entity handle: branded by the `entityKind` its owning
|
|
23
|
+
* pack registered, optionally declaring model refs under `refs` (actual
|
|
24
|
+
* model-handle objects, resolved by the generic walk before lowering).
|
|
25
|
+
*/
|
|
26
|
+
interface PackEntityHandle {
|
|
27
|
+
readonly entityKind: string;
|
|
28
|
+
readonly refs?: Readonly<Record<string, unknown>>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A declared model ref after the generic walk resolved it: a storage table
|
|
32
|
+
* coordinate for a model of this contract, the coordinate plus `spaceId` for
|
|
33
|
+
* a cross-space (extensionModel) handle, or `unresolved` when the handle
|
|
34
|
+
* does not correspond to any model in the contract. `modelName` is carried
|
|
35
|
+
* for diagnostics where the handle declares one.
|
|
36
|
+
*/
|
|
37
|
+
type ResolvedEntityHandleRef = {
|
|
38
|
+
readonly kind: 'resolved';
|
|
39
|
+
readonly namespaceId: string;
|
|
40
|
+
readonly tableName: string;
|
|
41
|
+
readonly modelName?: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'cross-space';
|
|
44
|
+
readonly spaceId: string;
|
|
45
|
+
readonly namespaceId: string;
|
|
46
|
+
readonly tableName: string;
|
|
47
|
+
readonly modelName?: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'unresolved';
|
|
50
|
+
readonly modelName?: string;
|
|
51
|
+
};
|
|
52
|
+
/** One claimed handle paired with its resolved declared refs. */
|
|
53
|
+
interface ResolvedPackEntityHandle {
|
|
54
|
+
readonly handle: PackEntityHandle;
|
|
55
|
+
readonly refs: Readonly<Record<string, ResolvedEntityHandleRef>>;
|
|
56
|
+
}
|
|
57
|
+
interface EntityHandleLoweringInput {
|
|
58
|
+
/** Every handle in the `entities` list whose `entityKind` this pack registered, in authored order. */
|
|
59
|
+
readonly handles: readonly ResolvedPackEntityHandle[];
|
|
60
|
+
readonly defaultNamespaceId: string;
|
|
61
|
+
}
|
|
62
|
+
/** One lowered entity row: filed into `storage.namespaces[namespaceId].entries[entityKind][key]`. */
|
|
63
|
+
interface LoweredPackEntity {
|
|
64
|
+
readonly namespaceId: string;
|
|
65
|
+
readonly entityKind: string;
|
|
66
|
+
readonly key: string;
|
|
67
|
+
readonly entity: unknown;
|
|
68
|
+
}
|
|
69
|
+
interface SqlEntityHandleLoweringContribution {
|
|
70
|
+
/**
|
|
71
|
+
* Method syntax keeps the declaration bivariant, so a pack's concretely
|
|
72
|
+
* typed implementation stays structurally compatible (the same convention
|
|
73
|
+
* as `SqlValueSetDerivingEntityTypeOutput.deriveValueSet`).
|
|
74
|
+
*/
|
|
75
|
+
lowerEntityHandles(input: EntityHandleLoweringInput): readonly LoweredPackEntity[];
|
|
76
|
+
}
|
|
77
|
+
/** Structural check for {@link SqlEntityHandleLoweringContribution}: no casts. */
|
|
78
|
+
declare function providesEntityHandleLowering(authoring: unknown): authoring is SqlEntityHandleLoweringContribution;
|
|
79
|
+
/**
|
|
80
|
+
* PSL-side twin of {@link ResolvedEntityHandleRef}: the family interpreter
|
|
81
|
+
* resolves an extension block's descriptor-declared model ref parameters
|
|
82
|
+
* (`{ kind: 'ref', refKind: 'model' }`) to storage table names and annotates
|
|
83
|
+
* the block with this map (keyed by parameter name) before invoking the
|
|
84
|
+
* entity factory. An unresolved required ref is the interpreter's
|
|
85
|
+
* diagnostic; a factory never sees one.
|
|
86
|
+
*/
|
|
87
|
+
type ResolvedPslModelRefs = Readonly<Record<string, {
|
|
88
|
+
readonly tableName: string;
|
|
89
|
+
}>>;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { ResolvedPackEntityHandle as a, providesEntityHandleLowering as c, ResolvedEntityHandleRef as i, LoweredPackEntity as n, ResolvedPslModelRefs as o, PackEntityHandle as r, SqlEntityHandleLoweringContribution as s, EntityHandleLoweringInput as t };
|
|
92
|
+
//# sourceMappingURL=entity-handle-lowering-hook-CIvRKBfa.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-handle-lowering-hook-CIvRKBfa.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/entity-handle-lowering-hook.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;UAwBU;WACC;WACA,OAAO,SAAS;;;;;;;;;KAStB;WACM;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;WACA;;;UAGD;WACC,QAAQ;WACR,MAAM,SAAS,eAAe;;UAE/B;;WAEC,kBAAkB;WAClB;;;UAGD;WACC;WACA;WACA;WACA;;UAED;;;;;;EAMR,mBAAmB,OAAO,qCAAqC;;;iBAGhD,6BAA6B,qBAAqB,aAAa;;;;;;;;;KAS3E,uBAAuB,SAAS;WAC1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region ../../../2-sql/1-core/contract/dist/entity-handle-lowering-hook.mjs
|
|
2
|
+
/** Structural check for {@link SqlEntityHandleLoweringContribution}: no casts. */
|
|
3
|
+
function providesEntityHandleLowering(authoring) {
|
|
4
|
+
if (typeof authoring !== "object" || authoring === null || !("lowerEntityHandles" in authoring)) return false;
|
|
5
|
+
const { lowerEntityHandles } = authoring;
|
|
6
|
+
return typeof lowerEntityHandles === "function";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { providesEntityHandleLowering as t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=entity-handle-lowering-hook-DwLIKNiS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-handle-lowering-hook-DwLIKNiS.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/entity-handle-lowering-hook.mjs"],"sourcesContent":["//#region src/entity-handle-lowering-hook.ts\n/** Structural check for {@link SqlEntityHandleLoweringContribution}: no casts. */\nfunction providesEntityHandleLowering(authoring) {\n\tif (typeof authoring !== \"object\" || authoring === null || !(\"lowerEntityHandles\" in authoring)) return false;\n\tconst { lowerEntityHandles } = authoring;\n\treturn typeof lowerEntityHandles === \"function\";\n}\n//#endregion\nexport { providesEntityHandleLowering };\n\n//# sourceMappingURL=entity-handle-lowering-hook.mjs.map"],"mappings":";;AAEA,SAAS,6BAA6B,WAAW;CAChD,IAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,EAAE,wBAAwB,YAAY,OAAO;CACxG,MAAM,EAAE,uBAAuB;CAC/B,OAAO,OAAO,uBAAuB;AACtC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { t as contractError } from "./contract-errors-BCN6RVI5-5IHBF_lg.mjs";
|
|
2
|
+
import { c as StorageTable, i as Index } from "./storage-table-_LWDmPfv-DFhU2dML.mjs";
|
|
3
|
+
import { n as indexInputFromSerialized, t as StorageValueSet } from "./serialized-index-Dp5_EjXD-DMsw8jf3.mjs";
|
|
4
|
+
import { type } from "arktype";
|
|
5
|
+
//#region ../../../2-sql/1-core/contract/dist/entity-kinds-DKxwKolf.mjs
|
|
6
|
+
const literalKindSchema = type("'literal'");
|
|
7
|
+
const functionKindSchema = type("'function'");
|
|
8
|
+
const ControlPolicySchema = type("'managed' | 'tolerated' | 'external' | 'observed'");
|
|
9
|
+
const ColumnDefaultLiteralSchema = type.declare().type({
|
|
10
|
+
kind: literalKindSchema,
|
|
11
|
+
value: "string | number | boolean | null | unknown[] | Record<string, unknown>"
|
|
12
|
+
});
|
|
13
|
+
const ColumnDefaultFunctionSchema = type.declare().type({
|
|
14
|
+
kind: functionKindSchema,
|
|
15
|
+
expression: "string"
|
|
16
|
+
});
|
|
17
|
+
const ColumnDefaultSchema = ColumnDefaultLiteralSchema.or(ColumnDefaultFunctionSchema);
|
|
18
|
+
const StorageValueSetRefSchema = type({
|
|
19
|
+
plane: "'storage'",
|
|
20
|
+
namespaceId: "string",
|
|
21
|
+
entityKind: "'valueSet'",
|
|
22
|
+
entityName: "string",
|
|
23
|
+
"spaceId?": "string"
|
|
24
|
+
});
|
|
25
|
+
const StorageColumnSchema = type({
|
|
26
|
+
"+": "reject",
|
|
27
|
+
nativeType: "string",
|
|
28
|
+
codecId: "string",
|
|
29
|
+
nullable: "boolean",
|
|
30
|
+
"many?": "boolean",
|
|
31
|
+
"typeParams?": "Record<string, unknown>",
|
|
32
|
+
"typeRef?": "string",
|
|
33
|
+
"default?": ColumnDefaultSchema,
|
|
34
|
+
"control?": ControlPolicySchema,
|
|
35
|
+
"valueSet?": StorageValueSetRefSchema
|
|
36
|
+
}).narrow((col, ctx) => {
|
|
37
|
+
if (col.typeParams !== void 0 && col.typeRef !== void 0) return ctx.mustBe("a column with either typeParams or typeRef, not both");
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Storage value-set entry under `storage.namespaces[id].entries.valueSet[name]`.
|
|
42
|
+
* Carries a `kind: 'valueSet'` discriminator (enumerable, survives JSON) and an
|
|
43
|
+
* ordered `values` array of codec-encoded permitted values.
|
|
44
|
+
*/
|
|
45
|
+
const StorageValueSetSchema = type({
|
|
46
|
+
kind: "'valueSet'",
|
|
47
|
+
values: type("string | number | boolean | null | unknown[] | Record<string, unknown>").array().readonly()
|
|
48
|
+
});
|
|
49
|
+
const PrimaryKeySchema = type.declare().type({
|
|
50
|
+
columns: type.string.array().readonly(),
|
|
51
|
+
"name?": "string"
|
|
52
|
+
});
|
|
53
|
+
const UniqueConstraintSchema = type.declare().type({
|
|
54
|
+
columns: type.string.array().readonly(),
|
|
55
|
+
"name?": "string"
|
|
56
|
+
});
|
|
57
|
+
const IndexSchema = type({
|
|
58
|
+
name: "string",
|
|
59
|
+
"prefix?": "string",
|
|
60
|
+
"columns?": type.string.array().readonly(),
|
|
61
|
+
"expression?": "string",
|
|
62
|
+
"where?": "string",
|
|
63
|
+
unique: "boolean",
|
|
64
|
+
"type?": "string",
|
|
65
|
+
"options?": "Record<string, unknown>"
|
|
66
|
+
});
|
|
67
|
+
const ForeignKeyReferenceSchema = type({
|
|
68
|
+
"+": "reject",
|
|
69
|
+
namespaceId: "string",
|
|
70
|
+
tableName: "string",
|
|
71
|
+
columns: type.string.array().readonly(),
|
|
72
|
+
"spaceId?": "string"
|
|
73
|
+
});
|
|
74
|
+
const ForeignKeySourceSchema = type({
|
|
75
|
+
"+": "reject",
|
|
76
|
+
namespaceId: "string",
|
|
77
|
+
tableName: "string",
|
|
78
|
+
columns: type.string.array().readonly()
|
|
79
|
+
});
|
|
80
|
+
const ReferentialActionSchema = type.declare().type("'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault'");
|
|
81
|
+
const ForeignKeySchema = type.declare().type({
|
|
82
|
+
source: ForeignKeySourceSchema,
|
|
83
|
+
target: ForeignKeyReferenceSchema,
|
|
84
|
+
"name?": "string",
|
|
85
|
+
"onDelete?": ReferentialActionSchema,
|
|
86
|
+
"onUpdate?": ReferentialActionSchema
|
|
87
|
+
});
|
|
88
|
+
const CheckConstraintSchema = type({
|
|
89
|
+
"+": "reject",
|
|
90
|
+
name: "string",
|
|
91
|
+
column: "string",
|
|
92
|
+
valueSet: StorageValueSetRefSchema
|
|
93
|
+
});
|
|
94
|
+
const StorageTableSchema = type({
|
|
95
|
+
"+": "reject",
|
|
96
|
+
columns: type({ "[string]": StorageColumnSchema }),
|
|
97
|
+
"primaryKey?": PrimaryKeySchema,
|
|
98
|
+
uniques: UniqueConstraintSchema.array().readonly(),
|
|
99
|
+
indexes: IndexSchema.array().readonly(),
|
|
100
|
+
foreignKeys: ForeignKeySchema.array().readonly(),
|
|
101
|
+
"control?": ControlPolicySchema,
|
|
102
|
+
"checks?": CheckConstraintSchema.array().readonly()
|
|
103
|
+
});
|
|
104
|
+
const tableEntityKind = {
|
|
105
|
+
kind: "table",
|
|
106
|
+
schema: StorageTableSchema,
|
|
107
|
+
construct: (input) => new StorageTable({
|
|
108
|
+
...input,
|
|
109
|
+
indexes: input.indexes.map((i) => i instanceof Index ? i : indexInputFromSerialized(i))
|
|
110
|
+
})
|
|
111
|
+
};
|
|
112
|
+
const valueSetEntityKind = {
|
|
113
|
+
kind: "valueSet",
|
|
114
|
+
schema: StorageValueSetSchema,
|
|
115
|
+
construct: (input) => new StorageValueSet(input)
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Assembles the `kind → descriptor` registry for SQL namespaces: the built-in
|
|
119
|
+
* `table` and `valueSet` kinds plus any target `packKinds`. This builds the
|
|
120
|
+
* lookup table — it does not touch contract data. `hydrateNamespaceEntities`
|
|
121
|
+
* later consumes this registry to turn a namespace's raw entries into IR
|
|
122
|
+
* instances, and `createSqlContractSchema` derives validation from the same
|
|
123
|
+
* registry. Throws on a duplicate kind.
|
|
124
|
+
*/
|
|
125
|
+
function composeSqlEntityKinds(packKinds = []) {
|
|
126
|
+
const kinds = /* @__PURE__ */ new Map([["table", tableEntityKind], ["valueSet", valueSetEntityKind]]);
|
|
127
|
+
for (const descriptor of packKinds) {
|
|
128
|
+
if (kinds.has(descriptor.kind)) throw contractError("CONTRACT.PACK_CONTRIBUTION_INVALID", `composeSqlEntityKinds: duplicate entity kind "${descriptor.kind}" — each kind may be registered only once`, { meta: { entityKind: descriptor.kind } });
|
|
129
|
+
kinds.set(descriptor.kind, descriptor);
|
|
130
|
+
}
|
|
131
|
+
return kinds;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { ForeignKeyReferenceSchema as a, IndexSchema as c, StorageValueSetSchema as d, composeSqlEntityKinds as f, ColumnDefaultSchema as i, ReferentialActionSchema as l, valueSetEntityKind as m, ColumnDefaultFunctionSchema as n, ForeignKeySchema as o, tableEntityKind as p, ColumnDefaultLiteralSchema as r, ForeignKeySourceSchema as s, CheckConstraintSchema as t, StorageTableSchema as u };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=entity-kinds-DKxwKolf-CcsY-iYV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-kinds-DKxwKolf-CcsY-iYV.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/entity-kinds-DKxwKolf.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { c as Index, t as StorageTable } from \"./storage-table-_LWDmPfv.mjs\";\nimport { n as StorageValueSet, t as indexInputFromSerialized } from \"./serialized-index-Dp5_EjXD.mjs\";\nimport { type } from \"arktype\";\n//#region src/ir/storage-entry-schemas.ts\nconst literalKindSchema = type(\"'literal'\");\nconst functionKindSchema = type(\"'function'\");\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst ColumnDefaultLiteralSchema = type.declare().type({\n\tkind: literalKindSchema,\n\tvalue: \"string | number | boolean | null | unknown[] | Record<string, unknown>\"\n});\nconst ColumnDefaultFunctionSchema = type.declare().type({\n\tkind: functionKindSchema,\n\texpression: \"string\"\n});\nconst ColumnDefaultSchema = ColumnDefaultLiteralSchema.or(ColumnDefaultFunctionSchema);\nconst StorageValueSetRefSchema = type({\n\tplane: \"'storage'\",\n\tnamespaceId: \"string\",\n\tentityKind: \"'valueSet'\",\n\tentityName: \"string\",\n\t\"spaceId?\": \"string\"\n});\nconst StorageColumnSchema = type({\n\t\"+\": \"reject\",\n\tnativeType: \"string\",\n\tcodecId: \"string\",\n\tnullable: \"boolean\",\n\t\"many?\": \"boolean\",\n\t\"typeParams?\": \"Record<string, unknown>\",\n\t\"typeRef?\": \"string\",\n\t\"default?\": ColumnDefaultSchema,\n\t\"control?\": ControlPolicySchema,\n\t\"valueSet?\": StorageValueSetRefSchema\n}).narrow((col, ctx) => {\n\tif (col.typeParams !== void 0 && col.typeRef !== void 0) return ctx.mustBe(\"a column with either typeParams or typeRef, not both\");\n\treturn true;\n});\n/**\n* Storage value-set entry under `storage.namespaces[id].entries.valueSet[name]`.\n* Carries a `kind: 'valueSet'` discriminator (enumerable, survives JSON) and an\n* ordered `values` array of codec-encoded permitted values.\n*/\nconst StorageValueSetSchema = type({\n\tkind: \"'valueSet'\",\n\tvalues: type(\"string | number | boolean | null | unknown[] | Record<string, unknown>\").array().readonly()\n});\nconst PrimaryKeySchema = type.declare().type({\n\tcolumns: type.string.array().readonly(),\n\t\"name?\": \"string\"\n});\nconst UniqueConstraintSchema = type.declare().type({\n\tcolumns: type.string.array().readonly(),\n\t\"name?\": \"string\"\n});\nconst IndexSchema = type({\n\tname: \"string\",\n\t\"prefix?\": \"string\",\n\t\"columns?\": type.string.array().readonly(),\n\t\"expression?\": \"string\",\n\t\"where?\": \"string\",\n\tunique: \"boolean\",\n\t\"type?\": \"string\",\n\t\"options?\": \"Record<string, unknown>\"\n});\nconst ForeignKeyReferenceSchema = type({\n\t\"+\": \"reject\",\n\tnamespaceId: \"string\",\n\ttableName: \"string\",\n\tcolumns: type.string.array().readonly(),\n\t\"spaceId?\": \"string\"\n});\nconst ForeignKeySourceSchema = type({\n\t\"+\": \"reject\",\n\tnamespaceId: \"string\",\n\ttableName: \"string\",\n\tcolumns: type.string.array().readonly()\n});\nconst ReferentialActionSchema = type.declare().type(\"'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault'\");\nconst ForeignKeySchema = type.declare().type({\n\tsource: ForeignKeySourceSchema,\n\ttarget: ForeignKeyReferenceSchema,\n\t\"name?\": \"string\",\n\t\"onDelete?\": ReferentialActionSchema,\n\t\"onUpdate?\": ReferentialActionSchema\n});\nconst CheckConstraintSchema = type({\n\t\"+\": \"reject\",\n\tname: \"string\",\n\tcolumn: \"string\",\n\tvalueSet: StorageValueSetRefSchema\n});\nconst StorageTableSchema = type({\n\t\"+\": \"reject\",\n\tcolumns: type({ \"[string]\": StorageColumnSchema }),\n\t\"primaryKey?\": PrimaryKeySchema,\n\tuniques: UniqueConstraintSchema.array().readonly(),\n\tindexes: IndexSchema.array().readonly(),\n\tforeignKeys: ForeignKeySchema.array().readonly(),\n\t\"control?\": ControlPolicySchema,\n\t\"checks?\": CheckConstraintSchema.array().readonly()\n});\n//#endregion\n//#region src/entity-kinds.ts\nconst tableEntityKind = {\n\tkind: \"table\",\n\tschema: StorageTableSchema,\n\tconstruct: (input) => new StorageTable({\n\t\t...input,\n\t\tindexes: input.indexes.map((i) => i instanceof Index ? i : indexInputFromSerialized(i))\n\t})\n};\nconst valueSetEntityKind = {\n\tkind: \"valueSet\",\n\tschema: StorageValueSetSchema,\n\tconstruct: (input) => new StorageValueSet(input)\n};\n/**\n* Assembles the `kind → descriptor` registry for SQL namespaces: the built-in\n* `table` and `valueSet` kinds plus any target `packKinds`. This builds the\n* lookup table — it does not touch contract data. `hydrateNamespaceEntities`\n* later consumes this registry to turn a namespace's raw entries into IR\n* instances, and `createSqlContractSchema` derives validation from the same\n* registry. Throws on a duplicate kind.\n*/\nfunction composeSqlEntityKinds(packKinds = []) {\n\tconst kinds = /* @__PURE__ */ new Map([[\"table\", tableEntityKind], [\"valueSet\", valueSetEntityKind]]);\n\tfor (const descriptor of packKinds) {\n\t\tif (kinds.has(descriptor.kind)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `composeSqlEntityKinds: duplicate entity kind \"${descriptor.kind}\" — each kind may be registered only once`, { meta: { entityKind: descriptor.kind } });\n\t\tkinds.set(descriptor.kind, descriptor);\n\t}\n\treturn kinds;\n}\n//#endregion\nexport { ColumnDefaultFunctionSchema as a, ForeignKeyReferenceSchema as c, IndexSchema as d, ReferentialActionSchema as f, CheckConstraintSchema as i, ForeignKeySchema as l, StorageValueSetSchema as m, tableEntityKind as n, ColumnDefaultLiteralSchema as o, StorageTableSchema as p, valueSetEntityKind as r, ColumnDefaultSchema as s, composeSqlEntityKinds as t, ForeignKeySourceSchema as u };\n\n//# sourceMappingURL=entity-kinds-DKxwKolf.mjs.map"],"mappings":";;;;;AAKA,MAAM,oBAAoB,KAAK,WAAW;AAC1C,MAAM,qBAAqB,KAAK,YAAY;AAC5C,MAAM,sBAAsB,KAAK,mDAAmD;AACpF,MAAM,6BAA6B,KAAK,QAAQ,CAAC,CAAC,KAAK;CACtD,MAAM;CACN,OAAO;AACR,CAAC;AACD,MAAM,8BAA8B,KAAK,QAAQ,CAAC,CAAC,KAAK;CACvD,MAAM;CACN,YAAY;AACb,CAAC;AACD,MAAM,sBAAsB,2BAA2B,GAAG,2BAA2B;AACrF,MAAM,2BAA2B,KAAK;CACrC,OAAO;CACP,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,YAAY;AACb,CAAC;AACD,MAAM,sBAAsB,KAAK;CAChC,KAAK;CACL,YAAY;CACZ,SAAS;CACT,UAAU;CACV,SAAS;CACT,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,aAAa;AACd,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ;CACvB,IAAI,IAAI,eAAe,KAAK,KAAK,IAAI,YAAY,KAAK,GAAG,OAAO,IAAI,OAAO,sDAAsD;CACjI,OAAO;AACR,CAAC;;;;;;AAMD,MAAM,wBAAwB,KAAK;CAClC,MAAM;CACN,QAAQ,KAAK,wEAAwE,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS;AACzG,CAAC;AACD,MAAM,mBAAmB,KAAK,QAAQ,CAAC,CAAC,KAAK;CAC5C,SAAS,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS;CACtC,SAAS;AACV,CAAC;AACD,MAAM,yBAAyB,KAAK,QAAQ,CAAC,CAAC,KAAK;CAClD,SAAS,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS;CACtC,SAAS;AACV,CAAC;AACD,MAAM,cAAc,KAAK;CACxB,MAAM;CACN,WAAW;CACX,YAAY,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS;CACzC,eAAe;CACf,UAAU;CACV,QAAQ;CACR,SAAS;CACT,YAAY;AACb,CAAC;AACD,MAAM,4BAA4B,KAAK;CACtC,KAAK;CACL,aAAa;CACb,WAAW;CACX,SAAS,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS;CACtC,YAAY;AACb,CAAC;AACD,MAAM,yBAAyB,KAAK;CACnC,KAAK;CACL,aAAa;CACb,WAAW;CACX,SAAS,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS;AACvC,CAAC;AACD,MAAM,0BAA0B,KAAK,QAAQ,CAAC,CAAC,KAAK,gEAAgE;AACpH,MAAM,mBAAmB,KAAK,QAAQ,CAAC,CAAC,KAAK;CAC5C,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,aAAa;CACb,aAAa;AACd,CAAC;AACD,MAAM,wBAAwB,KAAK;CAClC,KAAK;CACL,MAAM;CACN,QAAQ;CACR,UAAU;AACX,CAAC;AACD,MAAM,qBAAqB,KAAK;CAC/B,KAAK;CACL,SAAS,KAAK,EAAE,YAAY,oBAAoB,CAAC;CACjD,eAAe;CACf,SAAS,uBAAuB,MAAM,CAAC,CAAC,SAAS;CACjD,SAAS,YAAY,MAAM,CAAC,CAAC,SAAS;CACtC,aAAa,iBAAiB,MAAM,CAAC,CAAC,SAAS;CAC/C,YAAY;CACZ,WAAW,sBAAsB,MAAM,CAAC,CAAC,SAAS;AACnD,CAAC;AAGD,MAAM,kBAAkB;CACvB,MAAM;CACN,QAAQ;CACR,YAAY,UAAU,IAAI,aAAa;EACtC,GAAG;EACH,SAAS,MAAM,QAAQ,KAAK,MAAM,aAAa,QAAQ,IAAI,yBAAyB,CAAC,CAAC;CACvF,CAAC;AACF;AACA,MAAM,qBAAqB;CAC1B,MAAM;CACN,QAAQ;CACR,YAAY,UAAU,IAAI,gBAAgB,KAAK;AAChD;;;;;;;;;AASA,SAAS,sBAAsB,YAAY,CAAC,GAAG;CAC9C,MAAM,wBAAwB,IAAI,IAAI,CAAC,CAAC,SAAS,eAAe,GAAG,CAAC,YAAY,kBAAkB,CAAC,CAAC;CACpG,KAAK,MAAM,cAAc,WAAW;EACnC,IAAI,MAAM,IAAI,WAAW,IAAI,GAAG,MAAM,cAAc,sCAAsC,iDAAiD,WAAW,KAAK,4CAA4C,EAAE,MAAM,EAAE,YAAY,WAAW,KAAK,EAAE,CAAC;EAChP,MAAM,IAAI,WAAW,MAAM,UAAU;CACtC;CACA,OAAO;AACR"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as Index } from "./sql-index-DsI8HAeK-BJsn-jvD.mjs";
|
|
2
|
+
import { a as StorageTable, o as StorageTableInput } from "./storage-table-BBaAmanc-BwR37LMA.mjs";
|
|
3
|
+
import { n as StorageValueSetInput, t as StorageValueSet } from "./storage-value-set-BGlj5Uus-CvZD--GG.mjs";
|
|
4
|
+
import { t as SerializedIndex } from "./serialized-index-B96AwqtU-DcqcB4q_.mjs";
|
|
5
|
+
import { AnyEntityKindDescriptor, EntityKindDescriptor } from "@prisma/orm-framework/components/ir";
|
|
6
|
+
//#region ../../../2-sql/1-core/contract/dist/entity-kinds.d.mts
|
|
7
|
+
//#region src/entity-kinds.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* A table entry as it reaches hydration: from `contract.json` its indexes are
|
|
10
|
+
* still the stored flat records, from authoring they are already `Index`
|
|
11
|
+
* nodes.
|
|
12
|
+
*/
|
|
13
|
+
type HydratableStorageTable = Omit<StorageTableInput, 'indexes'> & {
|
|
14
|
+
readonly indexes: ReadonlyArray<Index | SerializedIndex>;
|
|
15
|
+
};
|
|
16
|
+
declare const tableEntityKind: EntityKindDescriptor<HydratableStorageTable, StorageTable>;
|
|
17
|
+
declare const valueSetEntityKind: EntityKindDescriptor<StorageValueSetInput, StorageValueSet>;
|
|
18
|
+
/**
|
|
19
|
+
* Assembles the `kind → descriptor` registry for SQL namespaces: the built-in
|
|
20
|
+
* `table` and `valueSet` kinds plus any target `packKinds`. This builds the
|
|
21
|
+
* lookup table — it does not touch contract data. `hydrateNamespaceEntities`
|
|
22
|
+
* later consumes this registry to turn a namespace's raw entries into IR
|
|
23
|
+
* instances, and `createSqlContractSchema` derives validation from the same
|
|
24
|
+
* registry. Throws on a duplicate kind.
|
|
25
|
+
*/
|
|
26
|
+
declare function composeSqlEntityKinds(packKinds?: readonly AnyEntityKindDescriptor[]): ReadonlyMap<string, AnyEntityKindDescriptor>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { tableEntityKind as n, valueSetEntityKind as r, composeSqlEntityKinds as t };
|
|
29
|
+
//# sourceMappingURL=entity-kinds-Dh6VH4uK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-kinds-Dh6VH4uK.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/entity-kinds.d.mts"],"mappings":";;;;;;;;;;;;KAWK,yBAAyB,KAAK;WACxB,SAAS,cAAc,QAAQ;;cAE5B,iBAAiB,qBAAqB,wBAAwB;cAC9D,oBAAoB,qBAAqB,sBAAsB;;;;;;;;;iBAS5D,sBAAsB,qBAAqB,4BAA4B,oBAAoB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
//#region ../../../2-sql/9-family/dist/errors-B5g0xWro.mjs
|
|
3
|
+
function sqlFamilyError(code, message, options) {
|
|
4
|
+
return structuredError(code, message, options);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { sqlFamilyError as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=errors-B5g0xWro-mWH2C07F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-B5g0xWro-mWH2C07F.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/errors-B5g0xWro.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/errors.ts\nfunction sqlFamilyError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\nexport { sqlFamilyError as t };\n\n//# sourceMappingURL=errors-B5g0xWro.mjs.map"],"mappings":";;AAEA,SAAS,eAAe,MAAM,SAAS,SAAS;CAC/C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region ../../../2-sql/1-core/errors/dist/index.d.mts
|
|
2
|
+
//#region src/errors.d.ts
|
|
3
|
+
interface SqlDriverError<Kind extends string> {
|
|
4
|
+
readonly kind: Kind;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* SQL query error for query-related failures (syntax errors, constraint violations, permissions).
|
|
8
|
+
*/
|
|
9
|
+
declare class SqlQueryError extends Error implements SqlDriverError<'sql_query'> {
|
|
10
|
+
static readonly ERROR_NAME: "SqlQueryError";
|
|
11
|
+
readonly kind: "sql_query";
|
|
12
|
+
readonly sqlState: string | undefined;
|
|
13
|
+
readonly constraint: string | undefined;
|
|
14
|
+
readonly table: string | undefined;
|
|
15
|
+
readonly column: string | undefined;
|
|
16
|
+
readonly detail: string | undefined;
|
|
17
|
+
constructor(message: string, options?: {
|
|
18
|
+
readonly cause?: Error;
|
|
19
|
+
readonly sqlState?: string;
|
|
20
|
+
readonly constraint?: string;
|
|
21
|
+
readonly table?: string;
|
|
22
|
+
readonly column?: string;
|
|
23
|
+
readonly detail?: string;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Type predicate to check if an error is a SqlQueryError.
|
|
27
|
+
*/
|
|
28
|
+
static is(error: unknown): error is SqlQueryError;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* SQLSTATE for a unique-constraint / primary-key violation — the SQL-standard
|
|
32
|
+
* `unique_violation` class. Drivers normalize their target-specific codes (e.g.
|
|
33
|
+
* Postgres `23505`, SQLite `SQLITE_CONSTRAINT_UNIQUE`/`PRIMARYKEY`) onto this
|
|
34
|
+
* value on {@link SqlQueryError.sqlState}, so consumers classify violations
|
|
35
|
+
* without knowing any target-specific error shape.
|
|
36
|
+
*/
|
|
37
|
+
declare const UNIQUE_VIOLATION_SQLSTATE = "23505";
|
|
38
|
+
/**
|
|
39
|
+
* Whether an error is a unique-constraint (or primary-key) violation, decided
|
|
40
|
+
* solely from the driver-normalized {@link SqlQueryError.sqlState}. Raw driver
|
|
41
|
+
* errors that were never normalized are not classified — callers run behind the
|
|
42
|
+
* driver, which always normalizes before the error escapes.
|
|
43
|
+
*/
|
|
44
|
+
declare function isUniqueConstraintViolation(error: unknown): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* SQL connection error (timeouts, connection resets, etc.).
|
|
47
|
+
*/
|
|
48
|
+
declare class SqlConnectionError extends Error implements SqlDriverError<'sql_connection'> {
|
|
49
|
+
static readonly ERROR_NAME: "SqlConnectionError";
|
|
50
|
+
readonly kind: "sql_connection";
|
|
51
|
+
readonly transient: boolean | undefined;
|
|
52
|
+
constructor(message: string, options?: {
|
|
53
|
+
readonly cause?: Error;
|
|
54
|
+
readonly transient?: boolean;
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Type predicate to check if an error is a SqlConnectionError.
|
|
58
|
+
*/
|
|
59
|
+
static is(error: unknown): error is SqlConnectionError;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { SqlConnectionError, SqlQueryError, UNIQUE_VIOLATION_SQLSTATE, isUniqueConstraintViolation };
|
|
63
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../../../2-sql/1-core/errors/dist/index.d.mts"],"mappings":";;UACU,eAAe;WACd,MAAM;;;;;cAKH,sBAAsB,iBAAiB;kBACnC;WACP;WACA;WACA;WACA;WACA;WACA;EACT,YAAY,iBAAiB;aAClB,QAAQ;aACR;aACA;aACA;aACA;aACA;;;;;SAKJ,GAAG,iBAAiB,SAAS;;;;;;;;;cASxB;;;;;;;iBAOG,4BAA4B;;;;cAI/B,2BAA2B,iBAAiB;kBACxC;WACP;WACA;EACT,YAAY,iBAAiB;aAClB,QAAQ;aACR;;;;;SAKJ,GAAG,iBAAiB,SAAS"}
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { a as CodecRef$1 } from "./codec-types-MOaceoPi-C5eL2sao.mjs";
|
|
2
|
+
import { _ as QueryOperationReturn } from "./types-CuDrWc5v-ISVXBmBs.mjs";
|
|
3
|
+
import "./types-BchwQpmO.mjs";
|
|
4
|
+
import { t as SqlLoweringSpec } from "./index-BgaTJRxj.mjs";
|
|
5
|
+
import { at as ParamRef, dt as RawSqlLiteral, o as AnyExpression } from "./types-DIBA80mc-wf5wLmON.mjs";
|
|
6
|
+
import { ParamSpec } from "@prisma/orm-framework/operations";
|
|
7
|
+
//#region ../../../2-sql/4-lanes/relational-core/dist/exports/expression.d.mts
|
|
8
|
+
//#region src/expression.d.ts
|
|
9
|
+
type ScopeField = {
|
|
10
|
+
codecId: string;
|
|
11
|
+
nullable: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Marks a list-typed (scalar-array) field. When `true`, the field is an
|
|
14
|
+
* array of `codecId`-typed elements; list operations target it and the
|
|
15
|
+
* element type is `codecId`. Absent/`false` for scalar fields. Carried so
|
|
16
|
+
* `X` and `X[]` stay distinct at the type level (a list expression is not
|
|
17
|
+
* assignable to a scalar `CodecExpression` slot).
|
|
18
|
+
*/
|
|
19
|
+
many?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional {@link CodecRef} derived from contract storage at scope construction time. Builder paths that mint column-bound `ParamRef` / `ProjectionItem` nodes stamp this slot onto the AST so encode/decode dispatch resolves through `contractCodecs.forCodecRef`. Leave `undefined` when the scope was built without contract storage (rare — tests, ad-hoc scopes).
|
|
22
|
+
*/
|
|
23
|
+
codec?: CodecRef$1;
|
|
24
|
+
};
|
|
25
|
+
type CodecTypesBase = Record<string, {
|
|
26
|
+
readonly input: unknown;
|
|
27
|
+
readonly output: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* A typed SQL expression. Identity is carried by the `returnType` descriptor (inherited from `QueryOperationReturn` and narrowed to `T`) — distinct `T` makes distinct Expression types structurally. `buildAst()` materialises the underlying AST node.
|
|
31
|
+
*/
|
|
32
|
+
type Expression<T extends ScopeField> = QueryOperationReturn & {
|
|
33
|
+
readonly returnType: T;
|
|
34
|
+
buildAst(): AnyExpression;
|
|
35
|
+
};
|
|
36
|
+
type CodecIdsWithTrait<CT extends Record<string, {
|
|
37
|
+
readonly input: unknown;
|
|
38
|
+
}>, RequiredTraits extends readonly string[]> = { [K in keyof CT & string]: CT[K] extends {
|
|
39
|
+
readonly traits: infer T;
|
|
40
|
+
} ? [RequiredTraits[number]] extends [T] ? K : never : never; }[keyof CT & string];
|
|
41
|
+
type NullSuffix<N> = N extends true ? null : never;
|
|
42
|
+
/**
|
|
43
|
+
* Runtime value type for a slot bound to `CodecId` with the given
|
|
44
|
+
* nullability — `CT[CodecId]['input']`, plus `null` when `Nullable` is true.
|
|
45
|
+
*/
|
|
46
|
+
type CodecValue<CodecId extends string, Nullable extends boolean, CT extends Record<string, {
|
|
47
|
+
readonly input: unknown;
|
|
48
|
+
}>> = (CodecId extends keyof CT ? CT[CodecId]['input'] : never) | NullSuffix<Nullable>;
|
|
49
|
+
/**
|
|
50
|
+
* An expression or literal value targeting a specific codec.
|
|
51
|
+
*
|
|
52
|
+
* Accepts any of:
|
|
53
|
+
* - An `Expression` whose codec matches exactly
|
|
54
|
+
* - A raw JS value of the codec's `input` type
|
|
55
|
+
* - `null` when `Nullable` is true
|
|
56
|
+
*
|
|
57
|
+
* `many?: never` makes this a *scalar* slot: a list expression (whose
|
|
58
|
+
* `returnType` carries `many: true`) is rejected here, while scalar
|
|
59
|
+
* expressions — which carry no `many` key at all — pass unchanged. The
|
|
60
|
+
* discriminant lives on this operand slot, so scalar expression and scope
|
|
61
|
+
* types never have to spell out `many: false`.
|
|
62
|
+
*/
|
|
63
|
+
type CodecExpression<CodecId extends string, Nullable extends boolean, CT extends Record<string, {
|
|
64
|
+
readonly input: unknown;
|
|
65
|
+
}>> = Expression<{
|
|
66
|
+
codecId: CodecId;
|
|
67
|
+
nullable: Nullable;
|
|
68
|
+
many?: never;
|
|
69
|
+
}> | CodecValue<CodecId, Nullable, CT>;
|
|
70
|
+
/**
|
|
71
|
+
* A list-typed expression: an {@link Expression} whose element codec is
|
|
72
|
+
* `CodecId` and whose `returnType` carries `many: true`. The element identity
|
|
73
|
+
* is the codec id, so list operations stay generic over the element type while
|
|
74
|
+
* tying any element argument back to this list's `CodecId`.
|
|
75
|
+
*/
|
|
76
|
+
type ScalarListExpression<CodecId extends string, Nullable extends boolean> = Expression<{
|
|
77
|
+
codecId: CodecId;
|
|
78
|
+
nullable: Nullable;
|
|
79
|
+
many: true;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* An expression or literal value targeting any codec whose trait set contains all the required traits.
|
|
83
|
+
*
|
|
84
|
+
* Resolves the trait set to the union of matching codec identities via `CodecIdsWithTrait`, then reuses `CodecExpression` for the codec-id form.
|
|
85
|
+
*/
|
|
86
|
+
type TraitExpression<Traits extends readonly string[], Nullable extends boolean, CT extends Record<string, {
|
|
87
|
+
readonly input: unknown;
|
|
88
|
+
}>> = CodecExpression<CodecIdsWithTrait<CT, Traits>, Nullable, CT>;
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a raw value or an Expression into an AST expression node.
|
|
91
|
+
*
|
|
92
|
+
* When `value` is an Expression (duck-typed by its `buildAst` method), the AST it wraps is returned. Otherwise the value is embedded as a ParamRef tagged with the caller-supplied {@link CodecRef} (when known). The runtime resolves the ref via `contractCodecs.forCodecRef(codec)`; content-keyed memoisation collapses repeated lookups for the same logical column onto one shared codec.
|
|
93
|
+
*
|
|
94
|
+
* Operation implementations that compare a column-bound expression to a user value derive the column's {@link CodecRef} from the column-bound side (via {@link codecOf}) and forward it here so encode-side dispatch resolves to the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).
|
|
95
|
+
*/
|
|
96
|
+
declare function toExpr(value: unknown, codec?: CodecRef$1): AnyExpression;
|
|
97
|
+
/**
|
|
98
|
+
* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz@1' })`.
|
|
99
|
+
*/
|
|
100
|
+
declare function param<T>(value: T, opts: {
|
|
101
|
+
codecId: string;
|
|
102
|
+
}): ParamRef;
|
|
103
|
+
/**
|
|
104
|
+
* Derive the {@link CodecRef} carried by an expression-like value.
|
|
105
|
+
*
|
|
106
|
+
* Resolution order:
|
|
107
|
+
* 1. `wrapper.codec` — explicit column-bound {@link CodecRef} stamped at field-proxy time.
|
|
108
|
+
* 2. `wrapper.returnType.codec` — scope-level codec when the scope was built from contract storage.
|
|
109
|
+
* 3. `{ codecId: wrapper.returnType.codecId }` — minimal ref derived from the expression's declared codec id (covers synthetic expressions like `count()` whose returnType has a known codec id but no explicit column binding).
|
|
110
|
+
*
|
|
111
|
+
* Returns `undefined` for raw scalar values (non-expression-like).
|
|
112
|
+
*/
|
|
113
|
+
declare function codecOf(value: unknown): CodecRef$1 | undefined;
|
|
114
|
+
interface BuildOperationSpec<R extends ScopeField> {
|
|
115
|
+
readonly method: string;
|
|
116
|
+
/**
|
|
117
|
+
* The operation's arguments. The first element is the self argument (the value the operation is being applied to); the rest are the remaining user-supplied arguments.
|
|
118
|
+
*/
|
|
119
|
+
readonly args: readonly [AnyExpression, ...AnyExpression[]];
|
|
120
|
+
readonly returns: R & ParamSpec;
|
|
121
|
+
readonly lowering: SqlLoweringSpec;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Construct an OperationExpr AST node and wrap it as a typed Expression. Operation implementations use this to turn their user-facing arguments into the AST node the compilation pipeline eventually lowers to SQL.
|
|
125
|
+
*/
|
|
126
|
+
declare function buildOperation<R extends ScopeField>(spec: BuildOperationSpec<R>): Expression<R>;
|
|
127
|
+
/**
|
|
128
|
+
* Resolves a codec id for a bare JavaScript value interpolated into a raw-SQL
|
|
129
|
+
* template — e.g. `` rawSql`SELECT ${42}` `` calls `inferCodec(42)` to pick
|
|
130
|
+
* the codec id (`pg/int4`, `sqlite/integer@1`, etc.) that will encode the
|
|
131
|
+
* value as a bound parameter.
|
|
132
|
+
*
|
|
133
|
+
* Targets implement this once per dialect: examine the JS value's runtime
|
|
134
|
+
* shape (number, bigint, string, boolean, `Uint8Array`) and return a codec
|
|
135
|
+
* id known to the target's codec registry. Throw when the value falls
|
|
136
|
+
* outside the supported set — callers should wrap such values with
|
|
137
|
+
* `param(value, { codecId })` to declare the codec explicitly.
|
|
138
|
+
*/
|
|
139
|
+
interface RawCodecInferer {
|
|
140
|
+
inferCodec(value: RawSqlLiteral): string;
|
|
141
|
+
}
|
|
142
|
+
/** The one-method builder returned by a `RawSqlTag` template call before `.returns()` is called. */
|
|
143
|
+
interface RawSqlBuilder {
|
|
144
|
+
returns<S extends string>(spec: S): Expression<{
|
|
145
|
+
codecId: S;
|
|
146
|
+
nullable: false;
|
|
147
|
+
}>;
|
|
148
|
+
returns<S extends string, N extends boolean = false>(spec: {
|
|
149
|
+
readonly codecId: S;
|
|
150
|
+
readonly nullable?: N;
|
|
151
|
+
}): Expression<{
|
|
152
|
+
codecId: S;
|
|
153
|
+
nullable: N;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
/** Tagged-template function returned by {@link createRawSql}. */
|
|
157
|
+
type RawSqlTag = (strings: TemplateStringsArray, ...values: RawSqlInterpolation[]) => RawSqlBuilder;
|
|
158
|
+
type RawSqlInterpolation = Expression<ScopeField> | ParamRef | RawSqlLiteral;
|
|
159
|
+
/**
|
|
160
|
+
* Create a tagged-template builder for raw SQL expressions. The returned tag accepts SQL string fragments interleaved with typed {@link Expression}, {@link ParamRef}, or bare {@link RawSqlLiteral} interpolations. Call `.returns(spec)` on the result to obtain a typed {@link Expression} whose AST is a {@link RawExpr}.
|
|
161
|
+
*
|
|
162
|
+
* Bare {@link RawSqlLiteral} interpolations are wrapped as `ParamRef` nodes with the codec resolved via `adapter.inferCodec(value)`. Use {@link param} when the codec cannot be inferred from the value alone (e.g. `Date`).
|
|
163
|
+
*/
|
|
164
|
+
declare function createRawSql(adapter: RawCodecInferer): RawSqlTag;
|
|
165
|
+
//#endregion
|
|
166
|
+
export { Expression as a, RawSqlTag as c, TraitExpression as d, buildOperation as f, toExpr as g, param as h, CodecValue as i, ScalarListExpression as l, createRawSql as m, CodecExpression as n, RawCodecInferer as o, codecOf as p, CodecTypesBase as r, RawSqlBuilder as s, BuildOperationSpec as t, ScopeField as u };
|
|
167
|
+
//# sourceMappingURL=expression-DIf8F4Mc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression-DIf8F4Mc.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/expression.d.mts"],"mappings":";;;;;;;;KAMK;EACH;EACA;;;;;;;;EAQA;;;;EAIA,QAAQ;;KAEL,iBAAiB;WACX;WACA;;;;;KAKN,WAAW,UAAU,cAAc;WAC7B,YAAY;EACrB,YAAY;;KAET,kBAAkB,WAAW;WACvB;IACP,+CAA+C,WAAW,cAAc,GAAG;WACpE,cAAc;KACpB,iCAAiC,KAAK,2BAA2B;KACjE,WAAW,KAAK;;;;;KAKhB,WAAW,wBAAwB,0BAA0B,WAAW;WAClE;OACJ,sBAAsB,KAAK,GAAG,6BAA6B,WAAW;;;;;;;;;;;;;;;KAexE,gBAAgB,wBAAwB,0BAA0B,WAAW;WACvE;MACL;EACJ,SAAS;EACT,UAAU;EACV;KACG,WAAW,SAAS,UAAU;;;;;;;KAO9B,qBAAqB,wBAAwB,4BAA4B;EAC5E,SAAS;EACT,UAAU;EACV;;;;;;;KAOG,gBAAgB,kCAAkC,0BAA0B,WAAW;WACjF;MACL,gBAAgB,kBAAkB,IAAI,SAAS,UAAU;;;;;;;;iBAQ9C,OAAO,gBAAgB,QAAQ,aAAW;;;;iBAI1C,MAAM,GAAG,OAAO,GAAG;EAClC;IACE;;;;;;;;;;;iBAWa,QAAQ,iBAAiB;UAChC,mBAAmB,UAAU;WAC5B;;;;WAIA,gBAAgB,kBAAkB;WAClC,SAAS,IAAI;WACb,UAAU;;;;;iBAKJ,eAAe,UAAU,YAAY,MAAM,mBAAmB,KAAK,WAAW;;;;;;;;;;;;;UAarF;EACR,WAAW,OAAO;;;UAGV;EACR,QAAQ,kBAAkB,MAAM,IAAI;IAClC,SAAS;IACT;;EAEF,QAAQ,kBAAkB,2BAA2B;aAC1C,SAAS;aACT,WAAW;MAClB;IACF,SAAS;IACT,UAAU;;;;KAIT,aAAa,SAAS,yBAAyB,QAAQ,0BAA0B;KACjF,sBAAsB,WAAW,cAAc,WAAW;;;;;;iBAM9C,aAAa,SAAS,kBAAkB"}
|