@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,64 @@
|
|
|
1
|
+
import { d as parseNaming } from "./naming-BwqqVcZy-BgTObIQw.mjs";
|
|
2
|
+
import { o as SqlNode } from "./storage-table-_LWDmPfv-DFhU2dML.mjs";
|
|
3
|
+
import { freezeNode } from "@prisma/orm-framework/components/ir";
|
|
4
|
+
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
5
|
+
//#region ../../../2-sql/1-core/contract/dist/serialized-index-Dp5_EjXD.mjs
|
|
6
|
+
/**
|
|
7
|
+
* SQL Contract IR node for a value-set entry in a namespace's `valueSet`
|
|
8
|
+
* map (`SqlNamespace.entries.valueSet`).
|
|
9
|
+
*
|
|
10
|
+
* A value-set records the ordered set of permitted codec-encoded values for
|
|
11
|
+
* an enum-like column restriction. It does not carry a `codecId` — the
|
|
12
|
+
* column that references it already holds the codec; the value-set holds
|
|
13
|
+
* only the permitted values.
|
|
14
|
+
*
|
|
15
|
+
* The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope
|
|
16
|
+
* carries the discriminator and the serializer hydration walker can
|
|
17
|
+
* dispatch on it. This follows the per-leaf enumerable-kind convention
|
|
18
|
+
* established in the SQL-node comment (future polymorphic dispatch on
|
|
19
|
+
* namespace entries needs the discriminator in JSON).
|
|
20
|
+
*
|
|
21
|
+
* The entry's name is not on the class — value-sets are keyed by name in
|
|
22
|
+
* the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
|
|
23
|
+
*/
|
|
24
|
+
var StorageValueSet = class extends SqlNode {
|
|
25
|
+
kind = "valueSet";
|
|
26
|
+
values;
|
|
27
|
+
constructor(input) {
|
|
28
|
+
super();
|
|
29
|
+
this.values = Object.freeze([...input.values]);
|
|
30
|
+
freezeNode(this);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function isStorageValueSet(value) {
|
|
34
|
+
if (typeof value !== "object" || value === null) return false;
|
|
35
|
+
return "kind" in value && value.kind === "valueSet" && "values" in value;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hydrates one stored index into constructor input. The parameter is typed
|
|
39
|
+
* but the values are whatever the file held, so each field the union depends
|
|
40
|
+
* on is checked here rather than downstream — by the time `Index` sees the
|
|
41
|
+
* data it is already a valid union.
|
|
42
|
+
*/
|
|
43
|
+
function indexInputFromSerialized(flat) {
|
|
44
|
+
if (flat.name === void 0 || flat.name.length === 0) throw new ContractValidationError("Index: every index carries a full physical name; an expression index must be explicitly named (a default name cannot be derived from an expression).", "storage");
|
|
45
|
+
if (flat.columns === void 0 === (flat.expression === void 0)) throw new ContractValidationError(`Index "${flat.name}": exactly one of columns or expression must be set.`, "storage");
|
|
46
|
+
const carried = {
|
|
47
|
+
naming: parseNaming(flat.name, flat.prefix),
|
|
48
|
+
where: flat.where,
|
|
49
|
+
unique: flat.unique,
|
|
50
|
+
type: flat.type,
|
|
51
|
+
options: flat.options
|
|
52
|
+
};
|
|
53
|
+
return flat.expression !== void 0 ? {
|
|
54
|
+
...carried,
|
|
55
|
+
expression: flat.expression
|
|
56
|
+
} : {
|
|
57
|
+
...carried,
|
|
58
|
+
columns: flat.columns ?? []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { indexInputFromSerialized as n, isStorageValueSet as r, StorageValueSet as t };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=serialized-index-Dp5_EjXD-DMsw8jf3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialized-index-Dp5_EjXD-DMsw8jf3.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/serialized-index-Dp5_EjXD.mjs"],"sourcesContent":["import { l as SqlNode } from \"./storage-table-_LWDmPfv.mjs\";\nimport { freezeNode } from \"@internal/framework-components/ir\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { parseNaming } from \"@internal/sql-schema-ir/naming\";\n//#region src/ir/storage-value-set.ts\n/**\n* SQL Contract IR node for a value-set entry in a namespace's `valueSet`\n* map (`SqlNamespace.entries.valueSet`).\n*\n* A value-set records the ordered set of permitted codec-encoded values for\n* an enum-like column restriction. It does not carry a `codecId` — the\n* column that references it already holds the codec; the value-set holds\n* only the permitted values.\n*\n* The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope\n* carries the discriminator and the serializer hydration walker can\n* dispatch on it. This follows the per-leaf enumerable-kind convention\n* established in the SQL-node comment (future polymorphic dispatch on\n* namespace entries needs the discriminator in JSON).\n*\n* The entry's name is not on the class — value-sets are keyed by name in\n* the parent namespace's `valueSet: Record<string, StorageValueSet>` map.\n*/\nvar StorageValueSet = class extends SqlNode {\n\tkind = \"valueSet\";\n\tvalues;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.values = Object.freeze([...input.values]);\n\t\tfreezeNode(this);\n\t}\n};\nfunction isStorageValueSet(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn \"kind\" in value && value.kind === \"valueSet\" && \"values\" in value;\n}\n//#endregion\n//#region src/serialized-index.ts\n/**\n* Hydrates one stored index into constructor input. The parameter is typed\n* but the values are whatever the file held, so each field the union depends\n* on is checked here rather than downstream — by the time `Index` sees the\n* data it is already a valid union.\n*/\nfunction indexInputFromSerialized(flat) {\n\tif (flat.name === void 0 || flat.name.length === 0) throw new ContractValidationError(\"Index: every index carries a full physical name; an expression index must be explicitly named (a default name cannot be derived from an expression).\", \"storage\");\n\tif (flat.columns === void 0 === (flat.expression === void 0)) throw new ContractValidationError(`Index \"${flat.name}\": exactly one of columns or expression must be set.`, \"storage\");\n\tconst carried = {\n\t\tnaming: parseNaming(flat.name, flat.prefix),\n\t\twhere: flat.where,\n\t\tunique: flat.unique,\n\t\ttype: flat.type,\n\t\toptions: flat.options\n\t};\n\treturn flat.expression !== void 0 ? {\n\t\t...carried,\n\t\texpression: flat.expression\n\t} : {\n\t\t...carried,\n\t\tcolumns: flat.columns ?? []\n\t};\n}\n//#endregion\nexport { StorageValueSet as n, isStorageValueSet as r, indexInputFromSerialized as t };\n\n//# sourceMappingURL=serialized-index-Dp5_EjXD.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAI,kBAAkB,cAAc,QAAQ;CAC3C,OAAO;CACP;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,SAAS,OAAO,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC;EAC7C,WAAW,IAAI;CAChB;AACD;AACA,SAAS,kBAAkB,OAAO;CACjC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,OAAO,UAAU,SAAS,MAAM,SAAS,cAAc,YAAY;AACpE;;;;;;;AASA,SAAS,yBAAyB,MAAM;CACvC,IAAI,KAAK,SAAS,KAAK,KAAK,KAAK,KAAK,WAAW,GAAG,MAAM,IAAI,wBAAwB,wJAAwJ,SAAS;CACvP,IAAI,KAAK,YAAY,KAAK,OAAO,KAAK,eAAe,KAAK,IAAI,MAAM,IAAI,wBAAwB,UAAU,KAAK,KAAK,uDAAuD,SAAS;CACpL,MAAM,UAAU;EACf,QAAQ,YAAY,KAAK,MAAM,KAAK,MAAM;EAC1C,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,MAAM,KAAK;EACX,SAAS,KAAK;CACf;CACA,OAAO,KAAK,eAAe,KAAK,IAAI;EACnC,GAAG;EACH,YAAY,KAAK;CAClB,IAAI;EACH,GAAG;EACH,SAAS,KAAK,WAAW,CAAC;CAC3B;AACD"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-DfIc_lOO.mjs";
|
|
2
|
+
import { f as composeSqlEntityKinds } from "./entity-kinds-DKxwKolf-CcsY-iYV.mjs";
|
|
3
|
+
import { a as SqlStorage, s as isMaterializedSqlNamespace } from "./types-CMMQS6aG.mjs";
|
|
4
|
+
import { r as createSqlContractSchema, s as validateSqlContractFully } from "./validators-C4PItWnf.mjs";
|
|
5
|
+
import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
|
|
6
|
+
import { hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
|
|
7
|
+
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
8
|
+
import { type } from "arktype";
|
|
9
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
10
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
11
|
+
import { isPlainRecord as isPlainRecord$1 } from "@prisma/orm-framework/contract/is-plain-record";
|
|
12
|
+
//#region ../../../2-sql/9-family/dist/sql-contract-serializer-2oBWuxTe.mjs
|
|
13
|
+
const NamespaceRawSchema = type({
|
|
14
|
+
id: "string",
|
|
15
|
+
"kind?": "string",
|
|
16
|
+
entries: type({ "+": "ignore" })
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* SQL family `ContractSerializer` abstract base. Carries the SQL-shared
|
|
20
|
+
* deserialization pipeline:
|
|
21
|
+
*
|
|
22
|
+
* 1. `parseSqlContractStructure` validates the on-disk JSON envelope
|
|
23
|
+
* against the SQL contract arktype schema (`validateSqlContractFully`)
|
|
24
|
+
* and returns the validated flat-data shape.
|
|
25
|
+
* 2. `hydrateSqlStorage` walks the validated `storage` subtree and
|
|
26
|
+
* constructs the family-shared SQL Contract IR class hierarchy
|
|
27
|
+
* (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`
|
|
28
|
+
* / …). The rest of the contract envelope is JSON-clean primitive
|
|
29
|
+
* data and passes through unchanged.
|
|
30
|
+
* 3. `constructTargetContract` is the target-specific extension hook;
|
|
31
|
+
* defaults to identity. Targets that need to attach target-only
|
|
32
|
+
* fields (e.g. target-specific derived storage fields) override it.
|
|
33
|
+
*
|
|
34
|
+
* Default `serializeContract` is identity over the contract — concrete
|
|
35
|
+
* SQL targets ship JSON-clean class instances, so the contract value
|
|
36
|
+
* can be stringified directly. The non-enumerable family-level `kind`
|
|
37
|
+
* discriminator on `SqlNode` instances stays out of the persisted
|
|
38
|
+
* envelope automatically. Targets that need to canonicalize on the way
|
|
39
|
+
* out (key ordering, dropping computed-only fields) override
|
|
40
|
+
* `serializeContract` directly.
|
|
41
|
+
*/
|
|
42
|
+
var SqlContractSerializerBase = class {
|
|
43
|
+
entityHydrationRegistry;
|
|
44
|
+
contractSchema;
|
|
45
|
+
entryKinds;
|
|
46
|
+
constructor(entityHydrationRegistry = /* @__PURE__ */ new Map(), packEntityKinds = []) {
|
|
47
|
+
this.entityHydrationRegistry = entityHydrationRegistry;
|
|
48
|
+
this.entryKinds = composeSqlEntityKinds(packEntityKinds);
|
|
49
|
+
this.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;
|
|
50
|
+
}
|
|
51
|
+
deserializeContract(json) {
|
|
52
|
+
const validated = this.parseSqlContractStructure(json);
|
|
53
|
+
const hydrated = this.hydrateSqlStorage(validated);
|
|
54
|
+
return this.constructTargetContract(hydrated);
|
|
55
|
+
}
|
|
56
|
+
serializeContract(contract) {
|
|
57
|
+
return contract;
|
|
58
|
+
}
|
|
59
|
+
shouldPreserveEmpty = sqlContractCanonicalizationHooks.shouldPreserveEmpty;
|
|
60
|
+
sortStorage = sqlContractCanonicalizationHooks.sortStorage;
|
|
61
|
+
parseSqlContractStructure(json) {
|
|
62
|
+
return validateSqlContractFully(json, this.contractSchema !== void 0 ? { contractSchema: this.contractSchema } : void 0);
|
|
63
|
+
}
|
|
64
|
+
hydrateSqlStorage(validated) {
|
|
65
|
+
const types = validated.storage.types;
|
|
66
|
+
const hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;
|
|
67
|
+
const rawNamespaces = validated.storage.namespaces;
|
|
68
|
+
if (rawNamespaces === void 0) throw new ContractValidationError("Contract storage.namespaces is required after structural validation", "structural");
|
|
69
|
+
const hydratedNamespaces = this.hydrateSqlNamespaceMap(blindCast(rawNamespaces));
|
|
70
|
+
return {
|
|
71
|
+
...validated,
|
|
72
|
+
storage: new SqlStorage({
|
|
73
|
+
storageHash: validated.storage.storageHash,
|
|
74
|
+
...ifDefined("types", hydratedTypes),
|
|
75
|
+
namespaces: blindCast(hydratedNamespaces)
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
hydrateSqlNamespaceMap(namespaces) {
|
|
80
|
+
return Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {
|
|
81
|
+
const namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);
|
|
82
|
+
if (!isMaterializedSqlNamespace(namespaceHydrated)) throw sqlFamilyError("CONTRACT.PACK_CONTRIBUTION_INVALID", `Target serializer bug: hydrateSqlNamespaceEntry for namespace "${nsId}" returned a non-NamespaceBase value. Override hydrateSqlNamespaceEntry to produce a target namespace concretion.`, {
|
|
83
|
+
why: "The target contract serializer hydrated a namespace into a value that is not a materialized namespace concretion.",
|
|
84
|
+
fix: "Fix the target package: its hydrateSqlNamespaceEntry override must return a target namespace concretion.",
|
|
85
|
+
meta: { namespaceId: nsId }
|
|
86
|
+
});
|
|
87
|
+
return [nsId, namespaceHydrated];
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
hydrateSqlNamespaceEntry(nsId, raw) {
|
|
91
|
+
const id = typeof raw["id"] === "string" ? raw["id"] : nsId;
|
|
92
|
+
const parsed = NamespaceRawSchema({
|
|
93
|
+
...raw,
|
|
94
|
+
id
|
|
95
|
+
});
|
|
96
|
+
if (parsed instanceof type.errors) throw new ContractValidationError(`Namespace hydration failed: ${parsed.map((p) => p.message).join("; ")}`, "structural");
|
|
97
|
+
const entriesRaw = parsed.entries;
|
|
98
|
+
const rawEntriesMap = isPlainRecord$1(entriesRaw) ? entriesRaw : {};
|
|
99
|
+
const entriesInput = {};
|
|
100
|
+
for (const [key, innerMap] of Object.entries(rawEntriesMap)) entriesInput[key] = isPlainRecord$1(innerMap) ? innerMap : Object.freeze({});
|
|
101
|
+
const entriesOutput = hydrateNamespaceEntities(entriesInput, this.entryKinds, "fail", id);
|
|
102
|
+
if (!Object.hasOwn(entriesOutput, "table")) entriesOutput["table"] = {};
|
|
103
|
+
return blindCast({
|
|
104
|
+
id,
|
|
105
|
+
entries: entriesOutput
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
hydrateStorageTypeEntry(entry) {
|
|
109
|
+
if (typeof entry !== "object" || entry === null) return entry;
|
|
110
|
+
const kind = entry.kind;
|
|
111
|
+
if (typeof kind !== "string") return entry;
|
|
112
|
+
const factory = this.entityHydrationRegistry.get(kind);
|
|
113
|
+
if (factory === void 0) return entry;
|
|
114
|
+
return blindCast(factory(entry));
|
|
115
|
+
}
|
|
116
|
+
constructTargetContract(hydrated) {
|
|
117
|
+
return hydrated;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Serializes a namespace's `entries` dict by walking every enumerable
|
|
121
|
+
* kind — no kind is named here, mirroring the generic hydrate walk in
|
|
122
|
+
* `hydrateSqlNamespaceEntry` above. `table` is the SQL family's one
|
|
123
|
+
* universal base kind (every namespace carries it), so it is always
|
|
124
|
+
* emitted, even when empty; every other kind — target- or
|
|
125
|
+
* pack-contributed — is emitted only when it holds at least one entry.
|
|
126
|
+
* A kind carried non-enumerable on `entries` is excluded here for free,
|
|
127
|
+
* since `Object.entries` honors enumerability.
|
|
128
|
+
*/
|
|
129
|
+
serializeNamespaceEntries(entries) {
|
|
130
|
+
const out = { table: this.serializeEntries(entries["table"] ?? {}) };
|
|
131
|
+
for (const [kind, record] of Object.entries(entries)) {
|
|
132
|
+
if (kind === "table" || record == null || Object.keys(record).length === 0) continue;
|
|
133
|
+
out[kind] = this.serializeEntries(record);
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
serializeEntries(entries) {
|
|
138
|
+
const out = {};
|
|
139
|
+
for (const [name, entry] of Object.entries(entries)) out[name] = this.serializeJsonObject(entry);
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
serializeJsonObject(value) {
|
|
143
|
+
return blindCast(this.serializeJsonValue(value));
|
|
144
|
+
}
|
|
145
|
+
serializeJsonValue(value) {
|
|
146
|
+
return blindCast(JSON.parse(JSON.stringify(value)));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Default SQL family `ContractSerializer` concretion. Inherits the
|
|
151
|
+
* full SQL-shared deserialization pipeline (structural validation +
|
|
152
|
+
* IR-class hydration) without pack-registered `storage.types`
|
|
153
|
+
* hydration factories — targets that emit polymorphic JSON outside the
|
|
154
|
+
* codec-typed envelope wire a target-specific subclass with a populated
|
|
155
|
+
* registry (see Postgres). Family-level call sites instantiate this
|
|
156
|
+
* default directly when no target serializer is supplied.
|
|
157
|
+
*
|
|
158
|
+
* Because this serializer has no target concretion, deserialization of
|
|
159
|
+
* contracts that include namespace entries from JSON will throw unless
|
|
160
|
+
* the caller provides pre-hydrated `NamespaceBase` instances. Production
|
|
161
|
+
* paths always supply a target-specific serializer.
|
|
162
|
+
*/
|
|
163
|
+
var SqlContractSerializer = class extends SqlContractSerializerBase {
|
|
164
|
+
constructor() {
|
|
165
|
+
super(/* @__PURE__ */ new Map());
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
export { SqlContractSerializerBase as n, SqlContractSerializer as t };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-contract-serializer-2oBWuxTe-B9hzBBv1.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/sql-contract-serializer-2oBWuxTe.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { SqlStorage, isMaterializedSqlNamespace } from \"@internal/sql-contract/types\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { isPlainRecord as isPlainRecord$1 } from \"@internal/contract/is-plain-record\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { createSqlContractSchema, validateSqlContractFully } from \"@internal/sql-contract/validators\";\nimport { type } from \"arktype\";\n//#region src/core/ir/sql-contract-serializer-base.ts\nconst NamespaceRawSchema = type({\n\tid: \"string\",\n\t\"kind?\": \"string\",\n\tentries: type({ \"+\": \"ignore\" })\n});\n/**\n* SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n* deserialization pipeline:\n*\n* 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n* against the SQL contract arktype schema (`validateSqlContractFully`)\n* and returns the validated flat-data shape.\n* 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n* constructs the family-shared SQL Contract IR class hierarchy\n* (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n* / …). The rest of the contract envelope is JSON-clean primitive\n* data and passes through unchanged.\n* 3. `constructTargetContract` is the target-specific extension hook;\n* defaults to identity. Targets that need to attach target-only\n* fields (e.g. target-specific derived storage fields) override it.\n*\n* Default `serializeContract` is identity over the contract — concrete\n* SQL targets ship JSON-clean class instances, so the contract value\n* can be stringified directly. The non-enumerable family-level `kind`\n* discriminator on `SqlNode` instances stays out of the persisted\n* envelope automatically. Targets that need to canonicalize on the way\n* out (key ordering, dropping computed-only fields) override\n* `serializeContract` directly.\n*/\nvar SqlContractSerializerBase = class {\n\tentityHydrationRegistry;\n\tcontractSchema;\n\tentryKinds;\n\tconstructor(entityHydrationRegistry = /* @__PURE__ */ new Map(), packEntityKinds = []) {\n\t\tthis.entityHydrationRegistry = entityHydrationRegistry;\n\t\tthis.entryKinds = composeSqlEntityKinds(packEntityKinds);\n\t\tthis.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;\n\t}\n\tdeserializeContract(json) {\n\t\tconst validated = this.parseSqlContractStructure(json);\n\t\tconst hydrated = this.hydrateSqlStorage(validated);\n\t\treturn this.constructTargetContract(hydrated);\n\t}\n\tserializeContract(contract) {\n\t\treturn contract;\n\t}\n\tshouldPreserveEmpty = sqlContractCanonicalizationHooks.shouldPreserveEmpty;\n\tsortStorage = sqlContractCanonicalizationHooks.sortStorage;\n\tparseSqlContractStructure(json) {\n\t\treturn validateSqlContractFully(json, this.contractSchema !== void 0 ? { contractSchema: this.contractSchema } : void 0);\n\t}\n\thydrateSqlStorage(validated) {\n\t\tconst types = validated.storage.types;\n\t\tconst hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;\n\t\tconst rawNamespaces = validated.storage.namespaces;\n\t\tif (rawNamespaces === void 0) throw new ContractValidationError(\"Contract storage.namespaces is required after structural validation\", \"structural\");\n\t\tconst hydratedNamespaces = this.hydrateSqlNamespaceMap(blindCast(rawNamespaces));\n\t\treturn {\n\t\t\t...validated,\n\t\t\tstorage: new SqlStorage({\n\t\t\t\tstorageHash: validated.storage.storageHash,\n\t\t\t\t...ifDefined(\"types\", hydratedTypes),\n\t\t\t\tnamespaces: blindCast(hydratedNamespaces)\n\t\t\t})\n\t\t};\n\t}\n\thydrateSqlNamespaceMap(namespaces) {\n\t\treturn Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {\n\t\t\tconst namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);\n\t\t\tif (!isMaterializedSqlNamespace(namespaceHydrated)) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Target serializer bug: hydrateSqlNamespaceEntry for namespace \"${nsId}\" returned a non-NamespaceBase value. Override hydrateSqlNamespaceEntry to produce a target namespace concretion.`, {\n\t\t\t\twhy: \"The target contract serializer hydrated a namespace into a value that is not a materialized namespace concretion.\",\n\t\t\t\tfix: \"Fix the target package: its hydrateSqlNamespaceEntry override must return a target namespace concretion.\",\n\t\t\t\tmeta: { namespaceId: nsId }\n\t\t\t});\n\t\t\treturn [nsId, namespaceHydrated];\n\t\t}));\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst id = typeof raw[\"id\"] === \"string\" ? raw[\"id\"] : nsId;\n\t\tconst parsed = NamespaceRawSchema({\n\t\t\t...raw,\n\t\t\tid\n\t\t});\n\t\tif (parsed instanceof type.errors) throw new ContractValidationError(`Namespace hydration failed: ${parsed.map((p) => p.message).join(\"; \")}`, \"structural\");\n\t\tconst entriesRaw = parsed.entries;\n\t\tconst rawEntriesMap = isPlainRecord$1(entriesRaw) ? entriesRaw : {};\n\t\tconst entriesInput = {};\n\t\tfor (const [key, innerMap] of Object.entries(rawEntriesMap)) entriesInput[key] = isPlainRecord$1(innerMap) ? innerMap : Object.freeze({});\n\t\tconst entriesOutput = hydrateNamespaceEntities(entriesInput, this.entryKinds, \"fail\", id);\n\t\tif (!Object.hasOwn(entriesOutput, \"table\")) entriesOutput[\"table\"] = {};\n\t\treturn blindCast({\n\t\t\tid,\n\t\t\tentries: entriesOutput\n\t\t});\n\t}\n\thydrateStorageTypeEntry(entry) {\n\t\tif (typeof entry !== \"object\" || entry === null) return entry;\n\t\tconst kind = entry.kind;\n\t\tif (typeof kind !== \"string\") return entry;\n\t\tconst factory = this.entityHydrationRegistry.get(kind);\n\t\tif (factory === void 0) return entry;\n\t\treturn blindCast(factory(entry));\n\t}\n\tconstructTargetContract(hydrated) {\n\t\treturn hydrated;\n\t}\n\t/**\n\t* Serializes a namespace's `entries` dict by walking every enumerable\n\t* kind — no kind is named here, mirroring the generic hydrate walk in\n\t* `hydrateSqlNamespaceEntry` above. `table` is the SQL family's one\n\t* universal base kind (every namespace carries it), so it is always\n\t* emitted, even when empty; every other kind — target- or\n\t* pack-contributed — is emitted only when it holds at least one entry.\n\t* A kind carried non-enumerable on `entries` is excluded here for free,\n\t* since `Object.entries` honors enumerability.\n\t*/\n\tserializeNamespaceEntries(entries) {\n\t\tconst out = { table: this.serializeEntries(entries[\"table\"] ?? {}) };\n\t\tfor (const [kind, record] of Object.entries(entries)) {\n\t\t\tif (kind === \"table\" || record == null || Object.keys(record).length === 0) continue;\n\t\t\tout[kind] = this.serializeEntries(record);\n\t\t}\n\t\treturn out;\n\t}\n\tserializeEntries(entries) {\n\t\tconst out = {};\n\t\tfor (const [name, entry] of Object.entries(entries)) out[name] = this.serializeJsonObject(entry);\n\t\treturn out;\n\t}\n\tserializeJsonObject(value) {\n\t\treturn blindCast(this.serializeJsonValue(value));\n\t}\n\tserializeJsonValue(value) {\n\t\treturn blindCast(JSON.parse(JSON.stringify(value)));\n\t}\n};\n//#endregion\n//#region src/core/ir/sql-contract-serializer.ts\n/**\n* Default SQL family `ContractSerializer` concretion. Inherits the\n* full SQL-shared deserialization pipeline (structural validation +\n* IR-class hydration) without pack-registered `storage.types`\n* hydration factories — targets that emit polymorphic JSON outside the\n* codec-typed envelope wire a target-specific subclass with a populated\n* registry (see Postgres). Family-level call sites instantiate this\n* default directly when no target serializer is supplied.\n*\n* Because this serializer has no target concretion, deserialization of\n* contracts that include namespace entries from JSON will throw unless\n* the caller provides pre-hydrated `NamespaceBase` instances. Production\n* paths always supply a target-specific serializer.\n*/\nvar SqlContractSerializer = class extends SqlContractSerializerBase {\n\tconstructor() {\n\t\tsuper(/* @__PURE__ */ new Map());\n\t}\n};\n//#endregion\nexport { SqlContractSerializerBase as n, SqlContractSerializer as t };\n\n//# sourceMappingURL=sql-contract-serializer-2oBWuxTe.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { p as AnyQueryAst } from "./types-DIBA80mc-wf5wLmON.mjs";
|
|
2
|
+
import { ExecutionPlan } from "@prisma/orm-framework/components/runtime";
|
|
3
|
+
//#region ../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan-CJmsCP7n.d.mts
|
|
4
|
+
//#region src/sql-execution-plan.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* SQL-domain execution plan: a query lowered to the wire-level shape that a
|
|
7
|
+
* SQL driver can run.
|
|
8
|
+
*
|
|
9
|
+
* The plan carries:
|
|
10
|
+
* - `sql` — the rendered SQL text
|
|
11
|
+
* - `params` — the bound parameter list
|
|
12
|
+
* - `ast` — the pre-lowering AST, retained for decoding / telemetry / middleware
|
|
13
|
+
* - `meta` — family-agnostic plan metadata (target, lane, hashes, ...)
|
|
14
|
+
* - `_row` — phantom row type, propagated from the originating `SqlQueryPlan`
|
|
15
|
+
*
|
|
16
|
+
* Extends the framework-level `ExecutionPlan<Row>` marker so generic SPIs
|
|
17
|
+
* (`RuntimeExecutor<SqlExecutionPlan>`, `RuntimeMiddleware<SqlExecutionPlan>`)
|
|
18
|
+
* can be parameterized over it.
|
|
19
|
+
*
|
|
20
|
+
* Co-located with `SqlQueryPlan` (its pre-lowering counterpart) in the lanes
|
|
21
|
+
* layer because lane-level utilities (`RawTemplateFactory`, `RawFactory`,
|
|
22
|
+
* `SqlPlan`) compose against the executable shape and the lanes layer cannot
|
|
23
|
+
* depend on the runtime layer.
|
|
24
|
+
*/
|
|
25
|
+
interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
|
|
26
|
+
readonly sql: string;
|
|
27
|
+
readonly params: readonly unknown[];
|
|
28
|
+
readonly ast: AnyQueryAst;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SqlExecutionPlan as t };
|
|
32
|
+
//# sourceMappingURL=sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-execution-plan-CJmsCP7n-DoEpNn7r.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan-CJmsCP7n.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;UAuBU,iBAAiB,uBAAuB,cAAc;WACrD;WACA;WACA,KAAK"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
|
|
2
|
+
import { n as SqlObjectNaming } from "./naming-jLgdauLi-C84G_UHi.mjs";
|
|
3
|
+
//#region ../../../2-sql/1-core/contract/dist/sql-index-DsI8HAeK.d.mts
|
|
4
|
+
//#region src/ir/sql-index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* An index's element structure — exactly one of a column tuple or an opaque
|
|
7
|
+
* expression, made unrepresentable-otherwise at the type level. No
|
|
8
|
+
* discriminant is stored: the JSON shape stays flat (`columns` or
|
|
9
|
+
* `expression`, never both), and the runtime xor guard in the constructor
|
|
10
|
+
* remains as the backstop for JSON loads that bypass this input type.
|
|
11
|
+
*/
|
|
12
|
+
type IndexElements = {
|
|
13
|
+
/** Column-tuple elements. */
|
|
14
|
+
readonly columns: readonly string[];
|
|
15
|
+
readonly expression?: never;
|
|
16
|
+
} | {
|
|
17
|
+
readonly columns?: never;
|
|
18
|
+
/**
|
|
19
|
+
* Opaque SQL: the entire element list between the parens of CREATE
|
|
20
|
+
* INDEX — one string, never parsed.
|
|
21
|
+
*/
|
|
22
|
+
readonly expression: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Construction input for {@link Index}. Internal seam (built by lowering and
|
|
26
|
+
* FK materialization, not by end users), so every non-element key is
|
|
27
|
+
* required and absence is stated explicitly as `undefined` — matching the
|
|
28
|
+
* `SqlIndexIRInput` convention.
|
|
29
|
+
*/
|
|
30
|
+
type IndexInput = IndexElements & {
|
|
31
|
+
/** The index's identity. Read back off a built node with `namingOf`. */
|
|
32
|
+
readonly naming: SqlObjectNaming;
|
|
33
|
+
/** Opaque SQL: partial-index predicate (WHERE body, without the keyword). */
|
|
34
|
+
readonly where: string | undefined;
|
|
35
|
+
/** Rendered as CREATE UNIQUE INDEX. */
|
|
36
|
+
readonly unique: boolean;
|
|
37
|
+
readonly type: string | undefined;
|
|
38
|
+
readonly options: Record<string, unknown> | undefined;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* SQL Contract IR node for a table-level secondary index, name-identified:
|
|
42
|
+
* `name` is the full physical name; a present `prefix` marks the index as
|
|
43
|
+
* wire-named (`name` is `formatWireName(prefix, <8hex>)`), an absent `prefix`
|
|
44
|
+
* marks it exact (the name is adopted verbatim).
|
|
45
|
+
*
|
|
46
|
+
* `expression`, `where`, and `unique` are genuine SQL-family attributes —
|
|
47
|
+
* functional and partial indexes are standard SQL supported natively by
|
|
48
|
+
* Postgres and SQLite alike, and the family IR must be able to represent
|
|
49
|
+
* anything any SQL target can introspect. A target declining to AUTHOR them
|
|
50
|
+
* (SQLite's rejection at namespace construction) is a capability decision,
|
|
51
|
+
* not evidence of target-specificity.
|
|
52
|
+
*
|
|
53
|
+
* Note that this class shadows the global TypeScript `Index` lib type
|
|
54
|
+
* at the family-shared name; consumer files that need both should
|
|
55
|
+
* alias one (e.g.
|
|
56
|
+
* `import { Index as SqlIndexNode } from '@internal/sql-contract/types'`).
|
|
57
|
+
*/
|
|
58
|
+
declare class Index extends SqlNode {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly unique: boolean;
|
|
61
|
+
/** Derived from the wire naming arm — presence is the naming-mode discriminator in the flat JSON. */
|
|
62
|
+
readonly prefix?: string;
|
|
63
|
+
readonly columns?: readonly string[];
|
|
64
|
+
readonly expression?: string;
|
|
65
|
+
readonly where?: string;
|
|
66
|
+
readonly type?: string;
|
|
67
|
+
readonly options?: Record<string, unknown>;
|
|
68
|
+
constructor(input: IndexInput);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { IndexElements as n, IndexInput as r, Index as t };
|
|
72
|
+
//# sourceMappingURL=sql-index-DsI8HAeK-BJsn-jvD.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-index-DsI8HAeK-BJsn-jvD.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/sql-index-DsI8HAeK.d.mts"],"mappings":";;;;;;;;;;;KAUK;;WAEM;WACA;;WAEA;;;;;WAKA;;;;;;;;KAQN,aAAa;;WAEP,QAAQ;;WAER;;WAEA;WACA;WACA,SAAS;;;;;;;;;;;;;;;;;;;;cAoBN,cAAc;WACjB;WACA;;WAEA;WACA;WACA;WACA;WACA;WACA,UAAU;EACnB,YAAY,OAAO"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IRNodeBase } from "@prisma/orm-framework/components/ir";
|
|
2
|
+
//#region ../../../2-sql/1-core/contract/dist/sql-node-kEz6YFZo.d.mts
|
|
3
|
+
//#region src/ir/sql-node.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
6
|
+
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
7
|
+
*
|
|
8
|
+
* Single family-level discriminator (not per-leaf) reflects the fact that
|
|
9
|
+
* SQL IR has no polymorphic dispatch today — verifiers and serializers
|
|
10
|
+
* walk by structural position (`storage.tables[name].columns[name]`),
|
|
11
|
+
* not by inspecting `kind`. The abstract bar for per-leaf discriminators
|
|
12
|
+
* isn't earned until a future polymorphic consumer arrives.
|
|
13
|
+
*
|
|
14
|
+
* `kind` is installed as a non-enumerable own property on every instance,
|
|
15
|
+
* which keeps three things clean simultaneously:
|
|
16
|
+
*
|
|
17
|
+
* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
|
|
18
|
+
* shape (no `kind` field), so emitted contract.json files and the
|
|
19
|
+
* `validateSqlContractFully` arktype schemas stay unchanged.
|
|
20
|
+
* - Test assertions that use `toEqual({...})` against the pre-lift flat
|
|
21
|
+
* shape continue to pass — only enumerable own properties are
|
|
22
|
+
* compared.
|
|
23
|
+
* - Direct access (`node.kind`) and runtime narrowing
|
|
24
|
+
* (`if (node.kind === 'sql')`) still work, so future polymorphic
|
|
25
|
+
* dispatch can begin reading `kind` without a runtime change.
|
|
26
|
+
*
|
|
27
|
+
* Future per-leaf overrides land cleanly: a class that gains a
|
|
28
|
+
* polymorphic-dispatch consumer (e.g. an enum type instance walked
|
|
29
|
+
* alongside other types) overrides `kind` with its narrower literal
|
|
30
|
+
* at that leaf level. Per-leaf overrides will use enumerable kind
|
|
31
|
+
* (matching the Mongo per-class-discriminator precedent) because they
|
|
32
|
+
* encode dispatch-relevant information that callers need to see in
|
|
33
|
+
* JSON envelopes; the family-level `'sql'` is uniform across all SQL
|
|
34
|
+
* IR and carries no dispatch-relevant information.
|
|
35
|
+
*/
|
|
36
|
+
declare abstract class SqlNode extends IRNodeBase {
|
|
37
|
+
readonly kind?: string;
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { SqlNode as t };
|
|
42
|
+
//# sourceMappingURL=sql-node-kEz6YFZo-v2F7delx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-node-kEz6YFZo-v2F7delx.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/sql-node-kEz6YFZo.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAkCuB,gBAAgB;WAC5B;EACT"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
|
|
2
|
+
import { a as StorageTable } from "./storage-table-BBaAmanc-BwR37LMA.mjs";
|
|
3
|
+
import { t as StorageValueSet } from "./storage-value-set-BGlj5Uus-CvZD--GG.mjs";
|
|
4
|
+
import { Namespace, NamespaceBase, Storage, StorageType } from "@prisma/orm-framework/components/ir";
|
|
5
|
+
import { StorageHashBase } from "@prisma/orm-framework/contract/types";
|
|
6
|
+
import { AuthoringContributions } from "@prisma/orm-framework/components/authoring";
|
|
7
|
+
//#region ../../../2-sql/1-core/contract/dist/sql-storage-B0QwiTg6.d.mts
|
|
8
|
+
//#region src/ir/storage-type-instance.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Sentinel kind for the legacy codec-triple shape persisted under
|
|
11
|
+
* `SqlStorage.types`. Plain JSON-clean object literals carry this
|
|
12
|
+
* discriminator so the polymorphic slot dispatch can route them down
|
|
13
|
+
* the codec path while target-specific IR class instances (e.g. the
|
|
14
|
+
* Postgres enum class) keep their own narrower `kind` literal.
|
|
15
|
+
*/
|
|
16
|
+
declare const CODEC_INSTANCE_KIND: "codec-instance";
|
|
17
|
+
/**
|
|
18
|
+
* Structural sub-interface of {@link StorageType} for codec-typed entries
|
|
19
|
+
* in `SqlStorage.types`. These are plain object literals — there is no
|
|
20
|
+
* runtime IR class, the JSON envelope round-trips through the slot
|
|
21
|
+
* unchanged. The `kind: 'codec-instance'` discriminator is the dispatch
|
|
22
|
+
* key that distinguishes codec-typed entries from any class-instance
|
|
23
|
+
* kinds a target pack contributes to the polymorphic slot.
|
|
24
|
+
*/
|
|
25
|
+
interface StorageTypeInstance extends StorageType {
|
|
26
|
+
readonly kind: typeof CODEC_INSTANCE_KIND;
|
|
27
|
+
readonly codecId: string;
|
|
28
|
+
readonly nativeType: string;
|
|
29
|
+
readonly typeParams: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Construction-time input for a codec-triple entry. Symmetric with the
|
|
33
|
+
* structural runtime shape minus the `kind` discriminator — callers may
|
|
34
|
+
* omit `kind`; the helper {@link toStorageTypeInstance} stamps it on.
|
|
35
|
+
* `typeParams` may be omitted on input; the constructor normalises a
|
|
36
|
+
* missing value to `{}` so the in-memory shape is always present.
|
|
37
|
+
*/
|
|
38
|
+
interface StorageTypeInstanceInput {
|
|
39
|
+
readonly codecId: string;
|
|
40
|
+
readonly nativeType: string;
|
|
41
|
+
readonly typeParams?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stamp the codec-instance `kind` discriminator on a caller-supplied
|
|
45
|
+
* codec triple. Idempotent: input that already carries the discriminator
|
|
46
|
+
* passes through unchanged. Missing `typeParams` is normalised to `{}`.
|
|
47
|
+
*/
|
|
48
|
+
declare function toStorageTypeInstance(input: StorageTypeInstanceInput): StorageTypeInstance;
|
|
49
|
+
/**
|
|
50
|
+
* Type-guard for codec-typed entries on the polymorphic
|
|
51
|
+
* `SqlStorage.types` slot. Distinguishes `StorageTypeInstance` from
|
|
52
|
+
* any class-instance kinds a target pack contributes.
|
|
53
|
+
*/
|
|
54
|
+
declare function isStorageTypeInstance(value: unknown): value is StorageTypeInstance;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/ir/sql-storage.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* Polymorphic value type for document-scoped `SqlStorage.types` entries
|
|
59
|
+
* (codec aliases / parameterised native type registrations).
|
|
60
|
+
*
|
|
61
|
+
* Postgres native enum registrations live under the postgres-specific
|
|
62
|
+
* `entries.type` slot on `PostgresSchema` (target layer), not here.
|
|
63
|
+
*/
|
|
64
|
+
type SqlStorageTypeEntry = StorageTypeInstance | StorageTypeInstanceInput;
|
|
65
|
+
interface SqlNamespaceInput {
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Target-supplied factory that materializes a `Namespace` from a SQL
|
|
71
|
+
* `SqlNamespaceInput` (used to populate `SqlStorage.namespaces`).
|
|
72
|
+
*/
|
|
73
|
+
type SqlNamespaceFactory = (input: SqlNamespaceInput) => Namespace;
|
|
74
|
+
/**
|
|
75
|
+
* SQL-family extension of the framework `AuthoringContributions`. SQL target
|
|
76
|
+
* packs add a `createNamespace` factory so the PSL/TS authoring paths can
|
|
77
|
+
* materialize namespaces (and merge lowered extension-block entities) without
|
|
78
|
+
* each consumer re-specifying it. The factory is SQL-specific, so it lives here
|
|
79
|
+
* rather than on the framework `AuthoringContributions` base.
|
|
80
|
+
*/
|
|
81
|
+
interface SqlAuthoringContributions extends AuthoringContributions {
|
|
82
|
+
readonly createNamespace?: SqlNamespaceFactory;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Narrows framework `AuthoringContributions` to the SQL-family shape by testing
|
|
86
|
+
* for the SQL-specific `createNamespace` capability.
|
|
87
|
+
*/
|
|
88
|
+
declare function isSqlAuthoringContributions(authoring: AuthoringContributions | undefined): authoring is SqlAuthoringContributions;
|
|
89
|
+
interface SqlStorageInput<THash extends string = string> {
|
|
90
|
+
readonly storageHash: StorageHashBase<THash>;
|
|
91
|
+
readonly types?: Record<string, SqlStorageTypeEntry>;
|
|
92
|
+
readonly namespaces: Readonly<Record<string, SqlNamespaceBase>>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* SQL Contract IR root node for the `storage` field.
|
|
96
|
+
*
|
|
97
|
+
* Single concrete family-shared class — both Postgres and SQLite
|
|
98
|
+
* consume this class today. Per-target storage subclasses are
|
|
99
|
+
* introduced when each target's namespace shape earns its
|
|
100
|
+
* target-specific concretion (target-specific derived fields,
|
|
101
|
+
* target-specific storage extensions).
|
|
102
|
+
*
|
|
103
|
+
* Honours the framework `Storage` interface: every SQL IR carries a
|
|
104
|
+
* `namespaces` map keyed by namespace id. Callers must supply fully
|
|
105
|
+
* constructed `Namespace` instances — construction discipline lives
|
|
106
|
+
* in the authoring builders and deserializer hydration paths.
|
|
107
|
+
*
|
|
108
|
+
* The constructor normalises optional `types` into class instances.
|
|
109
|
+
* `types` is polymorphic per Decision 18 Option B: codec-triple inputs
|
|
110
|
+
* are stamped with `kind: 'codec-instance'`; hydration of raw JSON
|
|
111
|
+
* class-instance entries (carrying their narrower `kind` literal) is
|
|
112
|
+
* the per-target serializer's responsibility (so the family base does
|
|
113
|
+
* not import target-specific subclasses).
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* The typed `entries` shape for SQL family namespaces. The open dictionary
|
|
117
|
+
* is intersected with optional known-kind maps so that `ns.entries.table`
|
|
118
|
+
* and `ns.entries.valueSet` resolve without a cast, while unknown pack-
|
|
119
|
+
* contributed kinds remain valid (the `Record` part allows any string key).
|
|
120
|
+
*/
|
|
121
|
+
type SqlNamespaceEntries = Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
|
|
122
|
+
readonly table?: Readonly<Record<string, StorageTable>>;
|
|
123
|
+
readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Structural interface for SQL family namespaces. Generated `.d.ts` contract
|
|
127
|
+
* types satisfy this structurally (no prototype methods). The runtime
|
|
128
|
+
* abstract class `SqlNamespaceBase` extends this.
|
|
129
|
+
*
|
|
130
|
+
* `qualifyTable` and `isUnbound` are optional so JSON-shaped contract types
|
|
131
|
+
* (which carry no methods) are accepted where `SqlNamespace` is required.
|
|
132
|
+
* Hydrated `SqlNamespaceBase` instances always have both.
|
|
133
|
+
*/
|
|
134
|
+
interface SqlNamespace {
|
|
135
|
+
readonly kind: string;
|
|
136
|
+
readonly id: string;
|
|
137
|
+
readonly entries: SqlNamespaceEntries;
|
|
138
|
+
readonly isUnbound?: boolean;
|
|
139
|
+
qualifyTable?(tableName: string): string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Abstract SQL family namespace base class. Target concretions (`PostgresSchema`,
|
|
143
|
+
* `SqliteDatabase`, …) extend this — it is never instantiated directly.
|
|
144
|
+
* `entries` is the open ADR 224 dictionary: `entries[entityKind][entityName]`
|
|
145
|
+
* addresses any entity.
|
|
146
|
+
*/
|
|
147
|
+
declare abstract class SqlNamespaceBase extends NamespaceBase implements SqlNamespace {
|
|
148
|
+
abstract readonly id: string;
|
|
149
|
+
abstract readonly entries: SqlNamespaceEntries;
|
|
150
|
+
abstract qualifyTable(tableName: string): string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Realm-safe guard for hydrated `SqlNamespaceBase` concretions. Checks
|
|
154
|
+
* `qualifyTable` structurally instead of `instanceof NamespaceBase`, so it
|
|
155
|
+
* survives duplicate-module boundaries (e.g. dist e2e where the target and
|
|
156
|
+
* the family carry separate copies of `@internal/framework-components`).
|
|
157
|
+
*
|
|
158
|
+
* Every concrete `SqlNamespaceBase` subclass (`PostgresSchema`, `SqliteDatabase`,
|
|
159
|
+
* `TestSqlNamespace`, …) implements `qualifyTable`. Raw `SqlNamespaceInput`
|
|
160
|
+
* objects (`{ id, entries }`) do not.
|
|
161
|
+
*/
|
|
162
|
+
declare function isMaterializedSqlNamespace(x: unknown): x is SqlNamespaceBase;
|
|
163
|
+
declare class SqlStorage<THash extends string = string> extends SqlNode implements Storage {
|
|
164
|
+
readonly storageHash: StorageHashBase<THash>;
|
|
165
|
+
readonly namespaces: Readonly<Record<string, SqlNamespace>>;
|
|
166
|
+
readonly types?: Readonly<Record<string, StorageTypeInstance>>;
|
|
167
|
+
constructor(input: SqlStorageInput<THash>);
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { SqlNamespaceEntries as a, SqlStorage as c, StorageTypeInstance as d, StorageTypeInstanceInput as f, toStorageTypeInstance as g, isStorageTypeInstance as h, SqlNamespaceBase as i, SqlStorageInput as l, isSqlAuthoringContributions as m, SqlAuthoringContributions as n, SqlNamespaceFactory as o, isMaterializedSqlNamespace as p, SqlNamespace as r, SqlNamespaceInput as s, CODEC_INSTANCE_KIND as t, SqlStorageTypeEntry as u };
|
|
171
|
+
//# sourceMappingURL=sql-storage-B0QwiTg6-B8DVctJm.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-storage-B0QwiTg6-B8DVctJm.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/sql-storage-B0QwiTg6.d.mts"],"mappings":";;;;;;;;;;;;;;;cAcc;;;;;;;;;UASJ,4BAA4B;WAC3B,aAAa;WACb;WACA;WACA,YAAY;;;;;;;;;UASb;WACC;WACA;WACA,aAAa;;;;;;;iBAOP,sBAAsB,OAAO,2BAA2B;;;;;;iBAMxD,sBAAsB,iBAAiB,SAAS;;;;;;;;;;KAU5D,sBAAsB,sBAAsB;UACvC;WACC;WACA,SAAS,SAAS,eAAe,SAAS;;;;;;KAMhD,uBAAuB,OAAO,sBAAsB;;;;;;;;UAQ/C,kCAAkC;WACjC,kBAAkB;;;;;;iBAMZ,4BAA4B,WAAW,qCAAqC,aAAa;UAChG,gBAAgB;WACf,aAAa,gBAAgB;WAC7B,QAAQ,eAAe;WACvB,YAAY,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6B1C,sBAAsB,SAAS,eAAe,SAAS;WACjD,QAAQ,SAAS,eAAe;WAChC,WAAW,SAAS,eAAe;;;;;;;;;;;UAWpC;WACC;WACA;WACA,SAAS;WACT;EACT,cAAc;;;;;;;;uBAQO,yBAAyB,yBAAyB;oBACrD;oBACA,SAAS;WAClB,aAAa;;;;;;;;;;;;iBAYP,2BAA2B,aAAa,KAAK;cAChD,WAAW,uCAAuC,mBAAmB;WACxE,aAAa,gBAAgB;WAC7B,YAAY,SAAS,eAAe;WACpC,QAAQ,SAAS,eAAe;EACzC,YAAY,OAAO,gBAAgB"}
|