@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 @@
|
|
|
1
|
+
{"version":3,"file":"validators-C4PItWnf.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { a as ColumnDefaultFunctionSchema, c as ForeignKeyReferenceSchema, d as IndexSchema, f as ReferentialActionSchema, i as CheckConstraintSchema, l as ForeignKeySchema, m as StorageValueSetSchema, o as ColumnDefaultLiteralSchema, p as StorageTableSchema, s as ColumnDefaultSchema, t as composeSqlEntityKinds, u as ForeignKeySourceSchema } from \"./entity-kinds-DKxwKolf.mjs\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { computeIndexContentHash } from \"@internal/sql-schema-ir/naming\";\nimport { type } from \"arktype\";\nimport { CrossReferenceSchema } from \"@internal/contract/types\";\nimport { validateContractDomain } from \"@internal/contract/validate-domain\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/validators.ts\nconst generatorKindSchema = type(\"'generator'\");\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst ExecutionMutationDefaultValueSchema = type({\n\t\"+\": \"reject\",\n\tkind: generatorKindSchema,\n\tid: type(\"string\").narrow((value, ctx) => {\n\t\treturn /^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value) ? true : ctx.mustBe(\"a flat generator id\");\n\t}),\n\t\"params?\": \"Record<string, unknown>\"\n});\nconst ExecutionSchema = type({\n\t\"+\": \"reject\",\n\texecutionHash: \"string\",\n\tmutations: {\n\t\t\"+\": \"reject\",\n\t\tdefaults: type({\n\t\t\t\"+\": \"reject\",\n\t\t\tref: {\n\t\t\t\t\"+\": \"reject\",\n\t\t\t\tnamespace: \"string\",\n\t\t\t\ttable: \"string\",\n\t\t\t\tcolumn: \"string\"\n\t\t\t},\n\t\t\t\"onCreate?\": ExecutionMutationDefaultValueSchema,\n\t\t\t\"onUpdate?\": ExecutionMutationDefaultValueSchema\n\t\t}).array().readonly()\n\t}\n});\nconst DomainEnumRefSchema = type({\n\tplane: \"'domain'\",\n\tnamespaceId: \"string\",\n\tentityKind: \"'enum'\",\n\tentityName: \"string\",\n\t\"spaceId?\": \"string\"\n});\n/** Document-scoped `storage.types`: codec triples only. */\nconst DocumentScopedStorageTypeSchema = type.declare().type({\n\tkind: \"'codec-instance'\",\n\tcodecId: \"string\",\n\tnativeType: \"string\",\n\t\"typeParams?\": \"Record<string, unknown>\"\n});\n/**\n* Domain enum entry under `domain.namespaces[id].enum[name]`.\n* Carries the codec id and an ordered `members` array of `{name, value}` pairs.\n*/\nconst ContractEnumSchema = type({\n\t\"+\": \"reject\",\n\tcodecId: \"string\",\n\tmembers: type({\n\t\tname: \"string\",\n\t\tvalue: \"string | number | boolean | null | unknown[] | Record<string, unknown>\"\n\t}).array().readonly()\n});\n/**\n* Derives a schema map from a descriptor map: maps each kind's key to its\n* `schema` field. Used by validation functions to validate entries.\n*/\nfunction schemaViewOf(kinds) {\n\treturn new Map([...kinds].map(([k, d]) => [k, d.schema]));\n}\nconst DEFAULT_SQL_KINDS = composeSqlEntityKinds();\n/**\n* Builds the per-namespace entry schema for `storage.namespaces[id]`.\n*\n* Validation is descriptor-driven: the `kinds` map carries both the schema\n* (used here for structural validation) and the construct function (used at\n* hydration time). An unregistered key fails validation naming the kind and\n* the namespace id, so validation fails closed.\n*/\nfunction createNamespaceEntrySchema(kinds) {\n\tconst schemas = schemaViewOf(kinds);\n\tconst knownKinds = new Set(kinds.keys());\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tid: \"string\",\n\t\t\"kind?\": \"string\",\n\t\tentries: \"object\"\n\t}).narrow((ns, ctx) => {\n\t\tif (!isPlainRecord(ns.entries)) return ctx.mustBe(\"an entries object\");\n\t\tfor (const [key, innerMap] of Object.entries(ns.entries)) {\n\t\t\tif (!knownKinds.has(key)) return ctx.reject({ expected: `entries key \"${key}\" in namespace \"${ns.id}\" is not a registered entity kind` });\n\t\t\tif (!isPlainRecord(innerMap)) return ctx.reject({ expected: `entries[\"${key}\"] in namespace \"${ns.id}\" must be an object` });\n\t\t\tconst entrySchema = blindCast(schemas.get(key));\n\t\t\tfor (const [, value] of Object.entries(innerMap)) {\n\t\t\t\tconst parsed = entrySchema(value);\n\t\t\t\tif (parsed instanceof type.errors) return ctx.reject({ expected: parsed.summary });\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n}\n/**\n* Builds the storage schema. Pack contributions reach the per-namespace\n* entry shape through {@link createNamespaceEntrySchema}; the\n* document-scoped `storage.types` field (codec triples only) and the\n* storage hash stay family-shared.\n*/\nfunction createSqlStorageSchema(kinds) {\n\tconst namespaceEntry = createNamespaceEntrySchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tstorageHash: \"string\",\n\t\t\"types?\": type({ \"[string]\": DocumentScopedStorageTypeSchema }),\n\t\t\"namespaces?\": type({ \"[string]\": namespaceEntry })\n\t});\n}\nconst StorageSchema = createSqlStorageSchema(DEFAULT_SQL_KINDS);\n/**\n* Any entries entity that declares both a `tableName` and a physical `name`\n* (e.g. a target's RLS policy entities) shares one physical-name space per\n* table: two such entries of one kind on the same table would collide as\n* DDL (`CREATE POLICY \"<name>\" ON <table>` fails on the second), while the\n* same name on different tables is legal. Structural — no entry-kind\n* vocabulary; `table` entries are keyed by name already and are excluded.\n*/\nfunction validateTableScopedEntryNames(storage, errors) {\n\tfor (const [namespaceId, ns] of Object.entries(storage.namespaces)) {\n\t\tif (!isPlainRecord(ns.entries)) continue;\n\t\tfor (const [entriesKind, slot] of Object.entries(ns.entries)) {\n\t\t\tif (entriesKind === \"table\" || !isPlainRecord(slot)) continue;\n\t\t\tconst seen = /* @__PURE__ */ new Map();\n\t\t\tfor (const entity of Object.values(slot)) {\n\t\t\t\tif (typeof entity !== \"object\" || entity === null) continue;\n\t\t\t\tconst record = blindCast(entity);\n\t\t\t\tconst name = record[\"name\"];\n\t\t\t\tconst tableName = record[\"tableName\"];\n\t\t\t\tif (typeof name !== \"string\" || typeof tableName !== \"string\") continue;\n\t\t\t\tconst key = `${tableName}\u0000${name}`;\n\t\t\t\tseen.set(key, (seen.get(key) ?? 0) + 1);\n\t\t\t\tif (seen.get(key) === 2) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": ${entriesKind} \"${name}\" is declared multiple times`);\n\t\t\t}\n\t\t}\n\t}\n}\nfunction eachStorageTable(storage) {\n\treturn Object.entries(storage.namespaces).flatMap(([namespaceId, ns]) => Object.entries(ns.entries[\"table\"] ?? {}).map(([tableName, table]) => ({\n\t\tnamespaceId,\n\t\ttableName,\n\t\ttable\n\t})));\n}\nfunction findDuplicateValue(values) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const value of values) {\n\t\tif (seen.has(value)) return value;\n\t\tseen.add(value);\n\t}\n}\n/** A column may appear at most once in one index's element tuple. */\nfunction rejectRepeatedIndexColumns(indexes, coordinate, errors) {\n\tfor (const index of indexes) {\n\t\tconst duplicateColumn = findDuplicateValue(index.columns ?? []);\n\t\tif (duplicateColumn !== void 0) errors.push(`${coordinate}: index contains duplicate column \"${duplicateColumn}\"`);\n\t}\n}\n/**\n* Two wire-named indexes with the same content are one index written twice —\n* the content hash is their identity, so neither spelling can survive. An\n* exact-named index is identified by its name instead, so content twins under\n* two names are legal and a repeated name is rejected by the named-object\n* check.\n*/\nfunction rejectDuplicateWireNamedIndexContent(indexes, coordinate, errors) {\n\tconst seenContent = /* @__PURE__ */ new Set();\n\tfor (const index of indexes) {\n\t\tif (index.prefix === void 0) continue;\n\t\tconst content = computeIndexContentHash(index);\n\t\tif (seenContent.has(content)) {\n\t\t\terrors.push(`${coordinate}: duplicate index definition on columns [${(index.columns ?? []).join(\", \")}]`);\n\t\t\tcontinue;\n\t\t}\n\t\tseenContent.add(content);\n\t}\n}\nfunction isContractFieldType(value) {\n\tif (!isPlainRecord(value)) return false;\n\tconst kind = value[\"kind\"];\n\tif (kind === \"scalar\") {\n\t\tif (typeof value[\"codecId\"] !== \"string\") return false;\n\t\tconst typeParams = value[\"typeParams\"];\n\t\tif (typeParams !== void 0 && !isPlainRecord(typeParams)) return false;\n\t\treturn true;\n\t}\n\tif (kind === \"valueObject\") return typeof value[\"name\"] === \"string\";\n\tif (kind === \"union\") {\n\t\tconst members = value[\"members\"];\n\t\tif (!Array.isArray(members)) return false;\n\t\treturn members.every((m) => isContractFieldType(m));\n\t}\n\treturn false;\n}\nconst ModelFieldSchema = type({\n\t\"+\": \"reject\",\n\tnullable: \"boolean\",\n\ttype: type(\"unknown\").narrow((value, ctx) => isContractFieldType(value) ? true : ctx.mustBe(\"scalar, valueObject, or union field type\")),\n\t\"many?\": \"true\",\n\t\"dict?\": \"true\",\n\t\"valueSet?\": DomainEnumRefSchema\n});\nconst ModelStorageSchema = type({\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tfields: type({ \"[string]\": type({\n\t\tcolumn: \"string\",\n\t\t\"codecId?\": \"string\",\n\t\t\"nullable?\": \"boolean\"\n\t}) })\n});\nconst ContractRelationThroughSchema = type({\n\t\"+\": \"reject\",\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tparentColumns: type.string.array().readonly(),\n\tchildColumns: type.string.array().readonly(),\n\ttargetColumns: type.string.array().readonly()\n});\nconst ContractRelationOnSchema = type({\n\t\"+\": \"reject\",\n\tlocalFields: type.string.array().readonly(),\n\ttargetFields: type.string.array().readonly()\n});\nconst ContractManyToManyRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'N:M'\",\n\ton: ContractRelationOnSchema,\n\tthrough: ContractRelationThroughSchema\n});\nconst ContractNonJunctionRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | '1:N' | 'N:1'\",\n\ton: ContractRelationOnSchema\n});\nconst ContractReferenceRelationSchema = ContractManyToManyRelationSchema.or(ContractNonJunctionRelationSchema);\nconst ContractEmbedRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | '1:N'\"\n});\nconst ContractRelationSchema = ContractReferenceRelationSchema.or(ContractEmbedRelationSchema);\nconst ModelSchema = type({\n\tstorage: ModelStorageSchema,\n\t\"fields?\": type({ \"[string]\": ModelFieldSchema }),\n\t\"relations?\": type({ \"[string]\": ContractRelationSchema }),\n\t\"discriminator?\": \"unknown\",\n\t\"variants?\": \"unknown\",\n\t\"base?\": CrossReferenceSchema,\n\t\"owner?\": \"string\"\n});\nconst ContractMetaSchema = type({ \"[string]\": \"unknown\" });\n/**\n* Builds the full SQL contract schema. The storage subtree threads\n* pack contributions through {@link createSqlStorageSchema}; the rest\n* of the contract envelope is family-shared.\n*/\nfunction createSqlContractSchema(kinds) {\n\tconst storage = createSqlStorageSchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\ttarget: \"string\",\n\t\ttargetFamily: \"'sql'\",\n\t\t\"coreHash?\": \"string\",\n\t\tprofileHash: \"string\",\n\t\t\"capabilities?\": \"Record<string, Record<string, boolean>>\",\n\t\t\"extensions?\": \"Record<string, unknown>\",\n\t\t\"meta?\": ContractMetaSchema,\n\t\t\"defaultControlPolicy?\": ControlPolicySchema,\n\t\t\"roots?\": type({ \"[string]\": CrossReferenceSchema }),\n\t\tdomain: type({ namespaces: type({ \"[string]\": type({\n\t\t\tmodels: type({ \"[string]\": ModelSchema }),\n\t\t\t\"valueObjects?\": \"Record<string, unknown>\",\n\t\t\t\"enum?\": type({ \"[string]\": ContractEnumSchema })\n\t\t}) }) }),\n\t\tstorage,\n\t\t\"execution?\": ExecutionSchema\n\t});\n}\nconst SqlContractSchema = createSqlContractSchema(DEFAULT_SQL_KINDS);\n/**\n* Validates the structural shape of SqlStorage using Arktype. Pure\n* structural check: namespace IR is never materialized here (that needs\n* a target concretion via the serializer hydration path), so this throws\n* on invalid input and constructs nothing.\n*\n* @param value - The storage value to validate\n* @throws Error if the storage structure is invalid\n*/\nfunction validateStorage(value) {\n\tconst result = StorageSchema(value);\n\tif (result instanceof type.errors) {\n\t\tconst errors = result.map((p) => p.message);\n\t\tthrow contractError(\"CONTRACT.VALIDATION_FAILED\", `Storage validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n\t}\n}\nfunction validateModel(value) {\n\tconst result = ModelSchema(value);\n\tif (result instanceof type.errors) {\n\t\tconst errors = result.map((p) => p.message);\n\t\tthrow contractError(\"CONTRACT.VALIDATION_FAILED\", `Model validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n\t}\n\treturn result;\n}\n/**\n* Structural arktype validation of an SQL contract envelope. Internal\n* helper for {@link validateSqlContractFully} — exposed only inside\n* this module, since the family seam-of-record is the\n* `SqlContractSerializerBase.deserializeContract` SPI.\n*/\nfunction validateSqlContractStructure(value, contractSchema) {\n\tif (typeof value !== \"object\" || value === null) throw new ContractValidationError(\"Contract structural validation failed: value must be an object\", \"structural\");\n\tconst rawValue = value;\n\tif (rawValue.targetFamily !== void 0 && rawValue.targetFamily !== \"sql\") throw new ContractValidationError(`Unsupported target family: ${rawValue.targetFamily}`, \"structural\");\n\tconst contractResult = contractSchema(value);\n\tif (contractResult instanceof type.errors) throw new ContractValidationError(`Contract structural validation failed: ${contractResult.map((p) => p.message).join(\"; \")}`, \"structural\");\n\treturn contractResult;\n}\n/**\n* Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.\n*\n* Returns an array of human-readable error strings. Empty array = valid.\n*\n* Currently checks:\n* - duplicate named primary key / unique / index / foreign key objects within a table\n* - duplicate unique, index, or foreign key declarations within a table\n* - duplicate columns within primary key / unique / index definitions\n* - nullable columns in primary key definitions\n* - `setNull` referential action on a non-nullable FK column (would fail at runtime)\n* - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)\n*/\nfunction validateStorageSemantics(storage) {\n\tconst errors = [];\n\tvalidateTableScopedEntryNames(storage, errors);\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(storage)) {\n\t\tconst table = rawTable;\n\t\tconst namedObjects = /* @__PURE__ */ new Map();\n\t\tconst registerNamedObject = (kind, name) => {\n\t\t\tif (!name) return;\n\t\t\tnamedObjects.set(name, [...namedObjects.get(name) ?? [], kind]);\n\t\t};\n\t\tregisterNamedObject(\"primary key\", table.primaryKey?.name);\n\t\tfor (const unique of table.uniques) registerNamedObject(\"unique constraint\", unique.name);\n\t\tfor (const index of table.indexes) registerNamedObject(\"index\", index.name);\n\t\tfor (const fk of table.foreignKeys) registerNamedObject(\"foreign key\", fk.name);\n\t\tfor (const check of table.checks ?? []) registerNamedObject(\"check constraint\", check.name);\n\t\tfor (const [name, kinds] of namedObjects) if (kinds.length > 1) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": named object \"${name}\" is declared multiple times (${kinds.join(\", \")})`);\n\t\tif (table.primaryKey) {\n\t\t\tconst duplicateColumn = findDuplicateValue(table.primaryKey.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tfor (const columnName of table.primaryKey.columns) if (table.columns[columnName]?.nullable === true) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key column \"${columnName}\" is nullable; primary key columns must be NOT NULL`);\n\t\t}\n\t\tconst seenUniqueDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const unique of table.uniques) {\n\t\t\tconst duplicateColumn = findDuplicateValue(unique.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": unique constraint contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tconst signature = JSON.stringify({ columns: unique.columns });\n\t\t\tif (seenUniqueDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate unique constraint definition on columns [${unique.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenUniqueDefinitions.add(signature);\n\t\t}\n\t\tconst tableCoordinate = `Namespace \"${namespaceId}\" table \"${tableName}\"`;\n\t\trejectRepeatedIndexColumns(table.indexes, tableCoordinate, errors);\n\t\trejectDuplicateWireNamedIndexContent(table.indexes, tableCoordinate, errors);\n\t\tconst seenForeignKeyDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst signature = JSON.stringify({\n\t\t\t\tsource: fk.source,\n\t\t\t\ttarget: fk.target,\n\t\t\t\tonDelete: fk.onDelete ?? null,\n\t\t\t\tonUpdate: fk.onUpdate ?? null\n\t\t\t});\n\t\t\tif (seenForeignKeyDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate foreign key definition on columns [${fk.source.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenForeignKeyDefinitions.add(signature);\n\t\t}\n\t\tfor (const fk of table.foreignKeys) for (const colName of fk.source.columns) {\n\t\t\tconst column = table.columns[colName];\n\t\t\tif (!column) continue;\n\t\t\tif (fk.onDelete === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onUpdate === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onDelete === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t\tif (fk.onUpdate === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t}\n\t\tconst seenCheckDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const check of table.checks ?? []) {\n\t\t\tconst signature = JSON.stringify({\n\t\t\t\tcolumn: check.column,\n\t\t\t\tvalueSet: check.valueSet\n\t\t\t});\n\t\t\tif (seenCheckDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate check constraint definition on column \"${check.column}\"`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenCheckDefinitions.add(signature);\n\t\t}\n\t}\n\treturn errors;\n}\n/**\n* SQL storage logical-consistency checks: every model.storage.table\n* resolves to a real table, every model.storage.fields[*].column\n* resolves to a real column, and value-object fields land on JSON-native\n* columns. Throws `ContractValidationError` on the first mismatch.\n*/\nfunction validateModelStorageReferences(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst models = namespace.models;\n\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\tconst storageNamespaceId = model.storage.namespaceId;\n\t\t\tif (storageNamespaceId !== namespaceId) throw new ContractValidationError(`Model \"${qualifiedName}\" storage.namespaceId \"${storageNamespaceId}\" does not match domain namespace \"${namespaceId}\"`, \"storage\");\n\t\t\tconst storageTable = model.storage.table;\n\t\t\tconst rawTable = contract.storage.namespaces[storageNamespaceId]?.entries.table?.[storageTable];\n\t\t\tif (rawTable === void 0) throw new ContractValidationError(`Model \"${qualifiedName}\" references non-existent table \"${storageNamespaceId}.${storageTable}\"`, \"storage\");\n\t\t\tconst table = rawTable;\n\t\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\t\tfor (const [fieldName, field] of Object.entries(model.storage.fields)) if (!columnNames.has(field.column)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" references non-existent column \"${field.column}\" in table \"${storageTable}\"`, \"storage\");\n\t\t\tconst JSON_NATIVE_TYPES = /* @__PURE__ */ new Set([\"json\", \"jsonb\"]);\n\t\t\tfor (const [fieldName, domainField] of Object.entries(model.fields ?? {})) {\n\t\t\t\tif (domainField.type?.kind !== \"valueObject\") continue;\n\t\t\t\tconst storageField = model.storage.fields[fieldName];\n\t\t\t\tif (!storageField) continue;\n\t\t\t\tconst column = table.columns[storageField.column];\n\t\t\t\tif (!column) continue;\n\t\t\t\tif (!JSON_NATIVE_TYPES.has(column.nativeType)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" is a value object but storage column \"${storageField.column}\" has nativeType \"${column.nativeType}\" (expected json or jsonb)`, \"storage\");\n\t\t\t}\n\t\t}\n\t}\n}\n/**\n* Cross-table consistency checks for SQL storage: primary key, unique,\n* index, and foreign key column references resolve to real columns;\n* NOT NULL columns don't carry a literal `null` default; FK column\n* counts match their referenced columns. Throws on the first mismatch.\n*/\nfunction validateSqlStorageConsistency(contract) {\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(contract.storage)) {\n\t\tconst table = rawTable;\n\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\tif (table.primaryKey) {\n\t\t\tfor (const colName of table.primaryKey.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" primaryKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t}\n\t\tfor (const unique of table.uniques) for (const colName of unique.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" unique constraint references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const index of table.indexes) for (const colName of index.columns ?? []) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" index references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const check of table.checks ?? []) if (!columnNames.has(check.column)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" check constraint \"${check.name}\" references non-existent column \"${check.column}\"`, \"storage\");\n\t\tfor (const [colName, column] of Object.entries(table.columns)) if (!column.nullable && column.default?.kind === \"literal\" && column.default.value === null) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" column \"${colName}\" is NOT NULL but has a literal null default`, \"storage\");\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tif (fk.source.namespaceId !== namespaceId || fk.source.tableName !== tableName) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" contains foreignKey with mismatched source coordinates (${fk.source.namespaceId}.${fk.source.tableName})`, \"storage\");\n\t\t\tfor (const colName of fk.source.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t\tif (fk.target.spaceId === void 0) {\n\t\t\t\tconst referencedRaw = contract.storage.namespaces[fk.target.namespaceId]?.entries.table?.[fk.target.tableName];\n\t\t\t\tif (referencedRaw === void 0) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent table \"${fk.target.namespaceId}.${fk.target.tableName}\"`, \"storage\");\n\t\t\t\tconst referencedColumnNames = new Set(Object.keys(referencedRaw.columns));\n\t\t\t\tfor (const colName of fk.target.columns) if (!referencedColumnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\" in table \"${fk.target.tableName}\"`, \"storage\");\n\t\t\t}\n\t\t\tif (fk.source.columns.length !== fk.target.columns.length) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey column count (${fk.source.columns.length}) does not match referenced column count (${fk.target.columns.length})`, \"storage\");\n\t\t}\n\t}\n}\n/**\n* Full SQL contract validation: structural (arktype) +\n* framework-shared domain + SQL storage logical-consistency + SQL\n* storage semantic + model ↔ storage reference checks. Throws\n* `ContractValidationError` on the first failure. Returns the\n* validated flat-data shape; IR class hydration happens in the SPI\n* base on top of this helper.\n*/\nfunction validateSqlContractFully(value, options) {\n\tconst validated = validateSqlContractStructure(typeof value === \"object\" && value !== null ? (() => {\n\t\tconst { schemaVersion: _, _generated: _g, ...rest } = value;\n\t\treturn rest;\n\t})() : value, options?.contractSchema ?? SqlContractSchema);\n\tvalidateContractDomain({\n\t\troots: validated.roots,\n\t\tdomain: validated.domain\n\t});\n\tvalidateSqlStorageConsistency(validated);\n\tconst semanticErrors = validateStorageSemantics(validated.storage);\n\tif (semanticErrors.length > 0) throw new ContractValidationError(`Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, \"storage\");\n\tvalidateModelStorageReferences(validated);\n\tvalidateRelationThroughConsistency(validated);\n\treturn validated;\n}\n/** Storage column lookup for through-consistency validation. */\nfunction lookupStorageColumn(contract, namespaceId, tableName, columnName) {\n\tconst rawTable = contract.storage.namespaces[namespaceId]?.entries.table?.[tableName];\n\tif (rawTable === void 0) return;\n\treturn blindCast(rawTable).columns[columnName];\n}\n/**\n* Two storage columns share a type when their `nativeType` and `typeParams`\n* match. The contract is canonicalized, so `typeParams` key order is stable and\n* a JSON comparison is exact. `codecId` and `nullable` are intentionally not\n* compared: they do not change the database-level type that governs a join.\n*/\nfunction sameStorageType(a, b) {\n\treturn a.nativeType === b.nativeType && JSON.stringify(a.typeParams ?? null) === JSON.stringify(b.typeParams ?? null);\n}\nfunction describeColumnType(column) {\n\treturn column.typeParams === void 0 ? column.nativeType : `${column.nativeType} ${JSON.stringify(column.typeParams)}`;\n}\n/**\n* Validates one side of an N:M join: the junction columns and the model\n* columns they pair against positionally must be equal in number, exist in\n* their tables, and share the same storage type (`nativeType` + `typeParams`).\n* The junction's storage foreign keys already guarantee this for user-declared\n* FK constraints, but `through` is a logical descriptor never tied to them by\n* the rest of validation — and the TS builder accepts explicit join columns\n* without requiring a junction FK at all — so this checks the columns directly\n* against storage, one path regardless of how the junction was authored.\n*\n* Joined columns must be the *same* storage type, not merely compatible:\n* relying on implicit conversion (e.g. `text`↔`character`) is unsafe on writes\n* — `character(n)` space-padding makes such coercions non-associative — and no\n* ADR sanctions heterogeneous junction columns. Equality is the conservative\n* default; it can be relaxed deliberately if a real use case ever appears.\n*/\nfunction validateThroughJoinSide(input) {\n\tconst fail = (detail) => new ContractValidationError(`Many-to-many relation \"${input.qualifiedName}\" ${detail}`, \"storage\");\n\tif (input.junctionColumns.length !== input.modelColumns.length) throw fail(`pairs ${input.junctionColumnsLabel} (${input.junctionColumns.length}) with ${input.modelColumnsLabel} (${input.modelColumns.length}) of differing length; they join positionally and must match.`);\n\tfor (const [index, junctionColumnName] of input.junctionColumns.entries()) {\n\t\tconst modelColumnRef = input.modelColumns[index];\n\t\tif (modelColumnRef === void 0) continue;\n\t\tconst junctionColumn = lookupStorageColumn(input.contract, input.junctionNamespaceId, input.junctionTable, junctionColumnName);\n\t\tif (junctionColumn === void 0) throw fail(`${input.junctionColumnsLabel} references column \"${junctionColumnName}\" absent from junction table \"${input.junctionNamespaceId}.${input.junctionTable}\".`);\n\t\tconst model = input.model;\n\t\tif (model === void 0) continue;\n\t\tlet modelColumnName = modelColumnRef;\n\t\tif (model.fieldToColumn !== void 0) {\n\t\t\tconst mapped = model.fieldToColumn[modelColumnRef];\n\t\t\tif (mapped === void 0) throw fail(`${input.modelColumnsLabel} references field \"${modelColumnRef}\" absent from model on table \"${model.namespaceId}.${model.table}\".`);\n\t\t\tmodelColumnName = mapped.column;\n\t\t}\n\t\tconst modelColumn = lookupStorageColumn(input.contract, model.namespaceId, model.table, modelColumnName);\n\t\tif (modelColumn === void 0) throw fail(`${input.modelColumnsLabel} references column \"${modelColumnName}\" absent from table \"${model.namespaceId}.${model.table}\".`);\n\t\tif (!sameStorageType(junctionColumn, modelColumn)) throw fail(`joins \"${input.junctionTable}.${junctionColumnName}\" (${describeColumnType(junctionColumn)}) with \"${model.table}.${modelColumnName}\" (${describeColumnType(modelColumn)}) of differing storage type; junction columns must match the type of the column they reference.`);\n\t}\n}\n/**\n* Validates that every N:M relation's `through` descriptor is consistent with\n* the storage columns it joins: both join sides match in column count,\n* reference columns that exist in their tables, and pair columns of the same\n* storage type. Without this, a `through` that disagrees with storage surfaces\n* as a silently wrong JOIN at query time rather than a validation error here.\n*/\nfunction validateRelationThroughConsistency(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations)) {\n\t\tif (relation.cardinality !== \"N:M\") continue;\n\t\tconst qualifiedName = `${namespaceId}.${modelName}.${relationName}`;\n\t\tconst { on, through } = relation;\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tvalidateThroughJoinSide({\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: on.localFields,\n\t\t\tmodelColumnsLabel: \"on.localFields\",\n\t\t\tmodel: {\n\t\t\t\tnamespaceId,\n\t\t\t\ttable: modelStorage.table,\n\t\t\t\tfieldToColumn: modelStorage.fields\n\t\t\t},\n\t\t\tjunctionColumns: through.parentColumns,\n\t\t\tjunctionColumnsLabel: \"through.parentColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t\tconst targetModel = relation.to.space === void 0 ? contract.domain.namespaces[relation.to.namespace]?.models[relation.to.model] : void 0;\n\t\tconst targetModelSide = targetModel === void 0 ? void 0 : {\n\t\t\tnamespaceId: relation.to.namespace,\n\t\t\ttable: blindCast(targetModel.storage).table\n\t\t};\n\t\tvalidateThroughJoinSide({\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: through.targetColumns,\n\t\t\tmodelColumnsLabel: \"through.targetColumns\",\n\t\t\t...ifDefined(\"model\", targetModelSide),\n\t\t\tjunctionColumns: through.childColumns,\n\t\t\tjunctionColumnsLabel: \"through.childColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t}\n}\n//#endregion\nexport { CheckConstraintSchema, ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ContractEnumSchema, ForeignKeyReferenceSchema, ForeignKeySchema, ForeignKeySourceSchema, IndexSchema, ReferentialActionSchema, StorageTableSchema, StorageValueSetSchema, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, validateModel, validateModelStorageReferences, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics };\n\n//# sourceMappingURL=validators.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,sBAAsB,KAAK,aAAa;AAC9C,MAAM,sBAAsB,KAAK,mDAAmD;AACpF,MAAM,sCAAsC,KAAK;CAChD,KAAK;CACL,MAAM;CACN,IAAI,KAAK,QAAQ,CAAC,CAAC,QAAQ,OAAO,QAAQ;EACzC,OAAO,8BAA8B,KAAK,KAAK,IAAI,OAAO,IAAI,OAAO,qBAAqB;CAC3F,CAAC;CACD,WAAW;AACZ,CAA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AAM,OAAO;EAC5C,wBAAwB;GACvB;GACA;GACA,cAAc,GAAG;GACjB,mBAAmB;GACnB,OAAO;IACN;IACA,OAAO,aAAa;IACpB,eAAe,aAAa;GAC7B;GACA,iBAAiB,QAAQ;GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;EACD,MAAM,cAAc,SAAS,GAAG,UAAU,KAAK,IAAI,SAAS,OAAO,WAAW,SAAS,GAAG,UAAU,EAAE,OAAO,SAAS,GAAG,SAAS,KAAK;EACvI,MAAM,kBAAkB,gBAAgB,KAAK,IAAI,KAAK,IAAI;GACzD,aAAa,SAAS,GAAG;GACzB,OAAO,UAAU,YAAY,OAAO,CAAC,CAAC;EACvC;EACA,wBAAwB;GACvB;GACA;GACA,cAAc,QAAQ;GACtB,mBAAmB;GACnB,GAAG,UAAU,SAAS,eAAe;GACrC,iBAAiB,QAAQ;GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;CACF;AACD"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { a as ReferentialAction, n as ForeignKeyInput } from "./foreign-key-BSy9u4O4-BnsOe5Nf.mjs";
|
|
2
|
+
import { i as UniqueConstraintInput, n as PrimaryKeyInput } from "./unique-constraint-jQWfH7dg-zLWtFp99.mjs";
|
|
3
|
+
import { c as SqlStorage } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
|
|
4
|
+
import "./types-CuDrWc5v-ISVXBmBs.mjs";
|
|
5
|
+
import { AnyEntityKindDescriptor } from "@prisma/orm-framework/components/ir";
|
|
6
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
7
|
+
import { Type } from "arktype";
|
|
8
|
+
//#region ../../../2-sql/1-core/contract/dist/validators.d.mts
|
|
9
|
+
//#region src/ir/storage-entry-schemas.d.ts
|
|
10
|
+
type ColumnDefaultLiteral = {
|
|
11
|
+
readonly kind: 'literal';
|
|
12
|
+
readonly value: string | number | boolean | Record<string, unknown> | unknown[] | null;
|
|
13
|
+
};
|
|
14
|
+
type ColumnDefaultFunction = {
|
|
15
|
+
readonly kind: 'function';
|
|
16
|
+
readonly expression: string;
|
|
17
|
+
};
|
|
18
|
+
declare const ColumnDefaultLiteralSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultLiteral, {}>;
|
|
19
|
+
declare const ColumnDefaultFunctionSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultFunction, {}>;
|
|
20
|
+
declare const ColumnDefaultSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultLiteral | ColumnDefaultFunction, {}>;
|
|
21
|
+
/**
|
|
22
|
+
* Storage value-set entry under `storage.namespaces[id].entries.valueSet[name]`.
|
|
23
|
+
* Carries a `kind: 'valueSet'` discriminator (enumerable, survives JSON) and an
|
|
24
|
+
* ordered `values` array of codec-encoded permitted values.
|
|
25
|
+
*/
|
|
26
|
+
declare const StorageValueSetSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
27
|
+
kind: "valueSet";
|
|
28
|
+
values: readonly (string | number | boolean | Record<string, unknown> | unknown[] | null)[];
|
|
29
|
+
}, {}>;
|
|
30
|
+
declare const IndexSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
31
|
+
name: string;
|
|
32
|
+
unique: boolean;
|
|
33
|
+
prefix?: string;
|
|
34
|
+
columns?: readonly string[];
|
|
35
|
+
expression?: string;
|
|
36
|
+
where?: string;
|
|
37
|
+
type?: string;
|
|
38
|
+
options?: Record<string, unknown>;
|
|
39
|
+
}, {}>;
|
|
40
|
+
declare const ForeignKeyReferenceSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
41
|
+
namespaceId: string;
|
|
42
|
+
tableName: string;
|
|
43
|
+
columns: readonly string[];
|
|
44
|
+
spaceId?: string;
|
|
45
|
+
}, {}>;
|
|
46
|
+
declare const ForeignKeySourceSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
47
|
+
namespaceId: string;
|
|
48
|
+
tableName: string;
|
|
49
|
+
columns: readonly string[];
|
|
50
|
+
}, {}>;
|
|
51
|
+
declare const ReferentialActionSchema: import("arktype/internal/variants/string.ts").StringType<ReferentialAction, {}>;
|
|
52
|
+
declare const ForeignKeySchema: import("arktype/internal/variants/object.ts").ObjectType<ForeignKeyInput, {}>;
|
|
53
|
+
declare const CheckConstraintSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
54
|
+
name: string;
|
|
55
|
+
column: string;
|
|
56
|
+
valueSet: {
|
|
57
|
+
plane: "storage";
|
|
58
|
+
namespaceId: string;
|
|
59
|
+
entityKind: "valueSet";
|
|
60
|
+
entityName: string;
|
|
61
|
+
spaceId?: string;
|
|
62
|
+
};
|
|
63
|
+
}, {}>;
|
|
64
|
+
declare const StorageTableSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
65
|
+
columns: {
|
|
66
|
+
[x: string]: {
|
|
67
|
+
nativeType: string;
|
|
68
|
+
codecId: string;
|
|
69
|
+
nullable: boolean;
|
|
70
|
+
many?: boolean;
|
|
71
|
+
typeParams?: Record<string, unknown>;
|
|
72
|
+
typeRef?: string;
|
|
73
|
+
default?: ColumnDefaultLiteral | ColumnDefaultFunction;
|
|
74
|
+
control?: "managed" | "tolerated" | "external" | "observed";
|
|
75
|
+
valueSet?: {
|
|
76
|
+
plane: "storage";
|
|
77
|
+
namespaceId: string;
|
|
78
|
+
entityKind: "valueSet";
|
|
79
|
+
entityName: string;
|
|
80
|
+
spaceId?: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
uniques: readonly UniqueConstraintInput[];
|
|
85
|
+
indexes: readonly {
|
|
86
|
+
name: string;
|
|
87
|
+
unique: boolean;
|
|
88
|
+
prefix?: string;
|
|
89
|
+
columns?: readonly string[];
|
|
90
|
+
expression?: string;
|
|
91
|
+
where?: string;
|
|
92
|
+
type?: string;
|
|
93
|
+
options?: Record<string, unknown>;
|
|
94
|
+
}[];
|
|
95
|
+
foreignKeys: readonly ForeignKeyInput[];
|
|
96
|
+
primaryKey?: PrimaryKeyInput;
|
|
97
|
+
control?: "managed" | "tolerated" | "external" | "observed";
|
|
98
|
+
checks?: readonly {
|
|
99
|
+
name: string;
|
|
100
|
+
column: string;
|
|
101
|
+
valueSet: {
|
|
102
|
+
plane: "storage";
|
|
103
|
+
namespaceId: string;
|
|
104
|
+
entityKind: "valueSet";
|
|
105
|
+
entityName: string;
|
|
106
|
+
spaceId?: string;
|
|
107
|
+
};
|
|
108
|
+
}[];
|
|
109
|
+
}, {}>;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/validators.d.ts
|
|
112
|
+
/**
|
|
113
|
+
* Domain enum entry under `domain.namespaces[id].enum[name]`.
|
|
114
|
+
* Carries the codec id and an ordered `members` array of `{name, value}` pairs.
|
|
115
|
+
*/
|
|
116
|
+
declare const ContractEnumSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
117
|
+
codecId: string;
|
|
118
|
+
members: readonly {
|
|
119
|
+
name: string;
|
|
120
|
+
value: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
121
|
+
}[];
|
|
122
|
+
}, {}>;
|
|
123
|
+
/**
|
|
124
|
+
* Builds the per-namespace entry schema for `storage.namespaces[id]`.
|
|
125
|
+
*
|
|
126
|
+
* Validation is descriptor-driven: the `kinds` map carries both the schema
|
|
127
|
+
* (used here for structural validation) and the construct function (used at
|
|
128
|
+
* hydration time). An unregistered key fails validation naming the kind and
|
|
129
|
+
* the namespace id, so validation fails closed.
|
|
130
|
+
*/
|
|
131
|
+
declare function createNamespaceEntrySchema(kinds: ReadonlyMap<string, AnyEntityKindDescriptor>): Type<unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* Builds the storage schema. Pack contributions reach the per-namespace
|
|
134
|
+
* entry shape through {@link createNamespaceEntrySchema}; the
|
|
135
|
+
* document-scoped `storage.types` field (codec triples only) and the
|
|
136
|
+
* storage hash stay family-shared.
|
|
137
|
+
*/
|
|
138
|
+
declare function createSqlStorageSchema(kinds: ReadonlyMap<string, AnyEntityKindDescriptor>): Type<unknown>;
|
|
139
|
+
/**
|
|
140
|
+
* Builds the full SQL contract schema. The storage subtree threads
|
|
141
|
+
* pack contributions through {@link createSqlStorageSchema}; the rest
|
|
142
|
+
* of the contract envelope is family-shared.
|
|
143
|
+
*/
|
|
144
|
+
declare function createSqlContractSchema(kinds: ReadonlyMap<string, AnyEntityKindDescriptor>): Type<unknown>;
|
|
145
|
+
/**
|
|
146
|
+
* Validates the structural shape of SqlStorage using Arktype. Pure
|
|
147
|
+
* structural check: namespace IR is never materialized here (that needs
|
|
148
|
+
* a target concretion via the serializer hydration path), so this throws
|
|
149
|
+
* on invalid input and constructs nothing.
|
|
150
|
+
*
|
|
151
|
+
* @param value - The storage value to validate
|
|
152
|
+
* @throws Error if the storage structure is invalid
|
|
153
|
+
*/
|
|
154
|
+
declare function validateStorage(value: unknown): void;
|
|
155
|
+
declare function validateModel(value: unknown): unknown;
|
|
156
|
+
/**
|
|
157
|
+
* Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.
|
|
158
|
+
*
|
|
159
|
+
* Returns an array of human-readable error strings. Empty array = valid.
|
|
160
|
+
*
|
|
161
|
+
* Currently checks:
|
|
162
|
+
* - duplicate named primary key / unique / index / foreign key objects within a table
|
|
163
|
+
* - duplicate unique, index, or foreign key declarations within a table
|
|
164
|
+
* - duplicate columns within primary key / unique / index definitions
|
|
165
|
+
* - nullable columns in primary key definitions
|
|
166
|
+
* - `setNull` referential action on a non-nullable FK column (would fail at runtime)
|
|
167
|
+
* - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)
|
|
168
|
+
*/
|
|
169
|
+
declare function validateStorageSemantics(storage: SqlStorage): string[];
|
|
170
|
+
/**
|
|
171
|
+
* SQL storage logical-consistency checks: every model.storage.table
|
|
172
|
+
* resolves to a real table, every model.storage.fields[*].column
|
|
173
|
+
* resolves to a real column, and value-object fields land on JSON-native
|
|
174
|
+
* columns. Throws `ContractValidationError` on the first mismatch.
|
|
175
|
+
*/
|
|
176
|
+
declare function validateModelStorageReferences(contract: Contract<SqlStorage>): void;
|
|
177
|
+
/**
|
|
178
|
+
* Cross-table consistency checks for SQL storage: primary key, unique,
|
|
179
|
+
* index, and foreign key column references resolve to real columns;
|
|
180
|
+
* NOT NULL columns don't carry a literal `null` default; FK column
|
|
181
|
+
* counts match their referenced columns. Throws on the first mismatch.
|
|
182
|
+
*/
|
|
183
|
+
declare function validateSqlStorageConsistency(contract: Contract<SqlStorage>): void;
|
|
184
|
+
interface ValidateSqlContractFullyOptions {
|
|
185
|
+
/**
|
|
186
|
+
* Precomputed structural schema to validate against. Built once at
|
|
187
|
+
* serializer construction time when the family `ContractSerializer`
|
|
188
|
+
* has folded pack-contributed `validatorSchema` fragments into the
|
|
189
|
+
* per-namespace entry shape; absent for the family-default validator
|
|
190
|
+
* path (no pack contributions). Falls back to the cached default
|
|
191
|
+
* `SqlContractSchema` when omitted.
|
|
192
|
+
*/
|
|
193
|
+
readonly contractSchema?: Type<unknown>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Full SQL contract validation: structural (arktype) +
|
|
197
|
+
* framework-shared domain + SQL storage logical-consistency + SQL
|
|
198
|
+
* storage semantic + model ↔ storage reference checks. Throws
|
|
199
|
+
* `ContractValidationError` on the first failure. Returns the
|
|
200
|
+
* validated flat-data shape; IR class hydration happens in the SPI
|
|
201
|
+
* base on top of this helper.
|
|
202
|
+
*/
|
|
203
|
+
declare function validateSqlContractFully<T extends Contract<SqlStorage>>(value: unknown, options?: ValidateSqlContractFullyOptions): T;
|
|
204
|
+
//#endregion
|
|
205
|
+
export { validateStorageSemantics as S, validateModel as _, ContractEnumSchema as a, validateSqlStorageConsistency as b, ForeignKeySourceSchema as c, StorageTableSchema as d, StorageValueSetSchema as f, createSqlStorageSchema as g, createSqlContractSchema as h, ColumnDefaultSchema as i, IndexSchema as l, createNamespaceEntrySchema as m, ColumnDefaultFunctionSchema as n, ForeignKeyReferenceSchema as o, ValidateSqlContractFullyOptions as p, ColumnDefaultLiteralSchema as r, ForeignKeySchema as s, CheckConstraintSchema as t, ReferentialActionSchema as u, validateModelStorageReferences as v, validateStorage as x, validateSqlContractFully as y };
|
|
206
|
+
//# sourceMappingURL=validators-CxeHhHrf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators-CxeHhHrf.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.d.mts"],"mappings":";;;;;;;;;KAQK;WACM;WACA,mCAAmC;;KAEzC;WACM;WACA;;cAEG,0EAA0E,WAAW;cACrF,2EAA2E,WAAW;cACtF,mEAAmE,WAAW,uBAAuB;;;;;;cAMrG,qEAAqE;EACjF;EACA,8CAA8C;;cAElC,2DAA2D;EACvE;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;cAEE,yEAAyE;EACrF;EACA;EACA;EACA;;cAEY,sEAAsE;EAClF;EACA;EACA;;cAEY,uEAAuE,WAAW;cAClF,gEAAgE,WAAW;cAC3E,qEAAqE;EACjF;EACA;EACA;IACE;IACA;IACA;IACA;IACA;;;cAGU,kEAAkE;EAC9E;KACG;MACC;MACA;MACA;MACA;MACA,aAAa;MACb;MACA,UAAU,uBAAuB;MACjC;MACA;QACE;QACA;QACA;QACA;QACA;;;;EAIN,kBAAkB;EAClB;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;;EAEZ,sBAAsB;EACtB,aAAa;EACb;EACA;IACE;IACA;IACA;MACE;MACA;MACA;MACA;MACA;;;;;;;;;;cAUQ,kEAAkE;EAC9E;EACA;IACE;IACA,+CAA+C;;;;;;;;;;;iBAWlC,2BAA2B,OAAO,oBAAoB,2BAA2B;;;;;;;iBAOjF,uBAAuB,OAAO,oBAAoB,2BAA2B;;;;;;iBAM7E,wBAAwB,OAAO,oBAAoB,2BAA2B;;;;;;;;;;iBAU9E,gBAAgB;iBAChB,cAAc;;;;;;;;;;;;;;iBAcd,yBAAyB,SAAS;;;;;;;iBAOlC,+BAA+B,UAAU,SAAS;;;;;;;iBAOlD,8BAA8B,UAAU,SAAS;UACxD;;;;;;;;;WASC,iBAAiB;;;;;;;;;;iBAUX,yBAAyB,UAAU,SAAS,aAAa,gBAAgB,UAAU,kCAAkC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as StorageValueSetInput } from "./storage-value-set-BGlj5Uus-CvZD--GG.mjs";
|
|
2
|
+
//#region ../../../2-sql/1-core/contract/dist/value-set-derivation-hook.d.mts
|
|
3
|
+
//#region src/value-set-derivation-hook.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* SQL-family extension to the framework entity-type authoring registry: a pack's entity-type
|
|
6
|
+
* `factory` output (framework `AuthoringEntityTypeFactoryOutput`) may derive a value-set from an
|
|
7
|
+
* entity it built (e.g. Postgres's `native_enum` deriving its ordered member values). The generic
|
|
8
|
+
* extension-block lowering pass (`contract-psl`'s interpreter) probes each entity-type descriptor's
|
|
9
|
+
* output for this hook after building the entity, and folds a non-undefined result into the same
|
|
10
|
+
* namespace's `valueSet` slot, keyed by the entity's block name.
|
|
11
|
+
*
|
|
12
|
+
* SQL-family concept — the returned shape ({@link StorageValueSetInput}) is SQL-specific, so this
|
|
13
|
+
* hook lives here instead of on the framework `AuthoringEntityTypeFactoryOutput` itself.
|
|
14
|
+
*/
|
|
15
|
+
interface SqlValueSetDerivingEntityTypeOutput {
|
|
16
|
+
/**
|
|
17
|
+
* TypeScript treats method-syntax declarations bivariantly, so a pack's concretely-typed
|
|
18
|
+
* `deriveValueSet(entity: PostgresNativeEnum) => …` is structurally compatible with this
|
|
19
|
+
* interface's `unknown` parameter — no `never`-parameter contravariance bridge needed.
|
|
20
|
+
*/
|
|
21
|
+
deriveValueSet(entity: unknown): StorageValueSetInput | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** Structural check for {@link SqlValueSetDerivingEntityTypeOutput}: no casts. */
|
|
24
|
+
declare function providesValueSetDerivation(output: unknown): output is SqlValueSetDerivingEntityTypeOutput;
|
|
25
|
+
/**
|
|
26
|
+
* If `output` (an entity-type descriptor's factory output) provides
|
|
27
|
+
* {@link SqlValueSetDerivingEntityTypeOutput.deriveValueSet}, invoke it on `entity` and return the
|
|
28
|
+
* derived value-set; otherwise return `undefined`. `contract-psl`'s generic extension-block
|
|
29
|
+
* lowering pass calls this after building each entity so a value-set-carrying pack entity can
|
|
30
|
+
* contribute its value-set without the pass naming any target discriminator.
|
|
31
|
+
*/
|
|
32
|
+
declare function deriveValueSetFromEntity(output: unknown, entity: unknown): StorageValueSetInput | undefined;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { deriveValueSetFromEntity as n, providesValueSetDerivation as r, SqlValueSetDerivingEntityTypeOutput as t };
|
|
35
|
+
//# sourceMappingURL=value-set-derivation-hook-BhgGVtw0.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-set-derivation-hook-BhgGVtw0.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/value-set-derivation-hook.d.mts"],"mappings":";;;;;;;;;;;;;;UAaU;;;;;;EAMR,eAAe,kBAAkB;;;iBAGlB,2BAA2B,kBAAkB,UAAU;;;;;;;;iBAQvD,yBAAyB,iBAAiB,kBAAkB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region ../../../2-sql/1-core/contract/dist/value-set-derivation-hook.mjs
|
|
2
|
+
/** Structural check for {@link SqlValueSetDerivingEntityTypeOutput}: no casts. */
|
|
3
|
+
function providesValueSetDerivation(output) {
|
|
4
|
+
if (typeof output !== "object" || output === null || !("deriveValueSet" in output)) return false;
|
|
5
|
+
const { deriveValueSet } = output;
|
|
6
|
+
return typeof deriveValueSet === "function";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* If `output` (an entity-type descriptor's factory output) provides
|
|
10
|
+
* {@link SqlValueSetDerivingEntityTypeOutput.deriveValueSet}, invoke it on `entity` and return the
|
|
11
|
+
* derived value-set; otherwise return `undefined`. `contract-psl`'s generic extension-block
|
|
12
|
+
* lowering pass calls this after building each entity so a value-set-carrying pack entity can
|
|
13
|
+
* contribute its value-set without the pass naming any target discriminator.
|
|
14
|
+
*/
|
|
15
|
+
function deriveValueSetFromEntity(output, entity) {
|
|
16
|
+
if (!providesValueSetDerivation(output)) return void 0;
|
|
17
|
+
return output.deriveValueSet(entity);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { providesValueSetDerivation as n, deriveValueSetFromEntity as t };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=value-set-derivation-hook-Di9JZ0X7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-set-derivation-hook-Di9JZ0X7.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/value-set-derivation-hook.mjs"],"sourcesContent":["//#region src/value-set-derivation-hook.ts\n/** Structural check for {@link SqlValueSetDerivingEntityTypeOutput}: no casts. */\nfunction providesValueSetDerivation(output) {\n\tif (typeof output !== \"object\" || output === null || !(\"deriveValueSet\" in output)) return false;\n\tconst { deriveValueSet } = output;\n\treturn typeof deriveValueSet === \"function\";\n}\n/**\n* If `output` (an entity-type descriptor's factory output) provides\n* {@link SqlValueSetDerivingEntityTypeOutput.deriveValueSet}, invoke it on `entity` and return the\n* derived value-set; otherwise return `undefined`. `contract-psl`'s generic extension-block\n* lowering pass calls this after building each entity so a value-set-carrying pack entity can\n* contribute its value-set without the pass naming any target discriminator.\n*/\nfunction deriveValueSetFromEntity(output, entity) {\n\tif (!providesValueSetDerivation(output)) return void 0;\n\treturn output.deriveValueSet(entity);\n}\n//#endregion\nexport { deriveValueSetFromEntity, providesValueSetDerivation };\n\n//# sourceMappingURL=value-set-derivation-hook.mjs.map"],"mappings":";;AAEA,SAAS,2BAA2B,QAAQ;CAC3C,IAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,EAAE,oBAAoB,SAAS,OAAO;CAC3F,MAAM,EAAE,mBAAmB;CAC3B,OAAO,OAAO,mBAAmB;AAClC;;;;;;;;AAQA,SAAS,yBAAyB,QAAQ,QAAQ;CACjD,IAAI,CAAC,2BAA2B,MAAM,GAAG,OAAO,KAAK;CACrD,OAAO,OAAO,eAAe,MAAM;AACpC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
//#region ../../../2-sql/9-family/dist/verify-E6Dd2vYp.mjs
|
|
4
|
+
const MetaSchema = type({ "[string]": "unknown" });
|
|
5
|
+
function parseMeta(meta) {
|
|
6
|
+
if (meta === null || meta === void 0) return {};
|
|
7
|
+
let parsed;
|
|
8
|
+
if (typeof meta === "string") try {
|
|
9
|
+
parsed = JSON.parse(meta);
|
|
10
|
+
} catch {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
else parsed = meta;
|
|
14
|
+
const result = MetaSchema(parsed);
|
|
15
|
+
if (result instanceof type.errors) return {};
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SQLite stores `contract_json` as TEXT, so the wire shape is a JSON string;
|
|
20
|
+
* Postgres uses `jsonb` and returns an already-parsed value. Normalize both
|
|
21
|
+
* here so `ContractMarkerRecord.contractJson` is always the structured form.
|
|
22
|
+
*/
|
|
23
|
+
function parseContractJson(value) {
|
|
24
|
+
if (value === null || value === void 0) return null;
|
|
25
|
+
if (typeof value !== "string") return value;
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(value);
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const ContractMarkerRowSchema = type({
|
|
33
|
+
core_hash: "string",
|
|
34
|
+
profile_hash: "string",
|
|
35
|
+
"contract_json?": "unknown | null",
|
|
36
|
+
"canonical_version?": "number | null",
|
|
37
|
+
"updated_at?": "Date | string",
|
|
38
|
+
"app_tag?": "string | null",
|
|
39
|
+
"meta?": "unknown | null",
|
|
40
|
+
invariants: type("string").array()
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Parses a contract marker row from database query result.
|
|
44
|
+
* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).
|
|
45
|
+
*/
|
|
46
|
+
function parseContractMarkerRow(row) {
|
|
47
|
+
const result = ContractMarkerRowSchema(row);
|
|
48
|
+
if (result instanceof type.errors) {
|
|
49
|
+
const messages = result.map((p) => p.message).join("; ");
|
|
50
|
+
throw sqlFamilyError("CONTRACT.MARKER_ROW_CORRUPT", `Invalid contract marker row: ${messages}`, {
|
|
51
|
+
why: "The contract marker row read from the database does not match the expected marker shape.",
|
|
52
|
+
fix: "Re-sign the database with `prisma-next db sign`, or repair the marker table.",
|
|
53
|
+
meta: { issues: messages }
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const updatedAt = result.updated_at ? result.updated_at instanceof Date ? result.updated_at : new Date(result.updated_at) : /* @__PURE__ */ new Date();
|
|
57
|
+
return {
|
|
58
|
+
storageHash: result.core_hash,
|
|
59
|
+
profileHash: result.profile_hash,
|
|
60
|
+
contractJson: parseContractJson(result.contract_json),
|
|
61
|
+
canonicalVersion: result.canonical_version ?? null,
|
|
62
|
+
updatedAt,
|
|
63
|
+
appTag: result.app_tag ?? null,
|
|
64
|
+
meta: parseMeta(result.meta),
|
|
65
|
+
invariants: result.invariants
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Collects supported codec type IDs from adapter and extension manifests.
|
|
70
|
+
* Returns a sorted, unique array of type IDs that are declared in the manifests.
|
|
71
|
+
* This enables coverage checks by comparing contract column types against supported types.
|
|
72
|
+
*
|
|
73
|
+
* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.
|
|
74
|
+
* The manifests declare which codec types are available, but the actual type IDs
|
|
75
|
+
* are defined in the codec-types TypeScript modules that are imported.
|
|
76
|
+
*
|
|
77
|
+
* For MVP, we return an empty array since extracting type IDs from TypeScript modules
|
|
78
|
+
* would require runtime evaluation or static analysis. This can be enhanced later.
|
|
79
|
+
*/
|
|
80
|
+
function collectSupportedCodecTypeIds(descriptors) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { parseContractMarkerRow as n, collectSupportedCodecTypeIds as t };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=verify-E6Dd2vYp-gYwnlhLm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-E6Dd2vYp-gYwnlhLm.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/verify-E6Dd2vYp.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { type } from \"arktype\";\n//#region src/core/verify.ts\nconst MetaSchema = type({ \"[string]\": \"unknown\" });\nfunction parseMeta(meta) {\n\tif (meta === null || meta === void 0) return {};\n\tlet parsed;\n\tif (typeof meta === \"string\") try {\n\t\tparsed = JSON.parse(meta);\n\t} catch {\n\t\treturn {};\n\t}\n\telse parsed = meta;\n\tconst result = MetaSchema(parsed);\n\tif (result instanceof type.errors) return {};\n\treturn result;\n}\n/**\n* SQLite stores `contract_json` as TEXT, so the wire shape is a JSON string;\n* Postgres uses `jsonb` and returns an already-parsed value. Normalize both\n* here so `ContractMarkerRecord.contractJson` is always the structured form.\n*/\nfunction parseContractJson(value) {\n\tif (value === null || value === void 0) return null;\n\tif (typeof value !== \"string\") return value;\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\nconst ContractMarkerRowSchema = type({\n\tcore_hash: \"string\",\n\tprofile_hash: \"string\",\n\t\"contract_json?\": \"unknown | null\",\n\t\"canonical_version?\": \"number | null\",\n\t\"updated_at?\": \"Date | string\",\n\t\"app_tag?\": \"string | null\",\n\t\"meta?\": \"unknown | null\",\n\tinvariants: type(\"string\").array()\n});\n/**\n* Parses a contract marker row from database query result.\n* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).\n*/\nfunction parseContractMarkerRow(row) {\n\tconst result = ContractMarkerRowSchema(row);\n\tif (result instanceof type.errors) {\n\t\tconst messages = result.map((p) => p.message).join(\"; \");\n\t\tthrow sqlFamilyError(\"CONTRACT.MARKER_ROW_CORRUPT\", `Invalid contract marker row: ${messages}`, {\n\t\t\twhy: \"The contract marker row read from the database does not match the expected marker shape.\",\n\t\t\tfix: \"Re-sign the database with `prisma-next db sign`, or repair the marker table.\",\n\t\t\tmeta: { issues: messages }\n\t\t});\n\t}\n\tconst updatedAt = result.updated_at ? result.updated_at instanceof Date ? result.updated_at : new Date(result.updated_at) : /* @__PURE__ */ new Date();\n\treturn {\n\t\tstorageHash: result.core_hash,\n\t\tprofileHash: result.profile_hash,\n\t\tcontractJson: parseContractJson(result.contract_json),\n\t\tcanonicalVersion: result.canonical_version ?? null,\n\t\tupdatedAt,\n\t\tappTag: result.app_tag ?? null,\n\t\tmeta: parseMeta(result.meta),\n\t\tinvariants: result.invariants\n\t};\n}\n/**\n* Collects supported codec type IDs from adapter and extension manifests.\n* Returns a sorted, unique array of type IDs that are declared in the manifests.\n* This enables coverage checks by comparing contract column types against supported types.\n*\n* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.\n* The manifests declare which codec types are available, but the actual type IDs\n* are defined in the codec-types TypeScript modules that are imported.\n*\n* For MVP, we return an empty array since extracting type IDs from TypeScript modules\n* would require runtime evaluation or static analysis. This can be enhanced later.\n*/\nfunction collectSupportedCodecTypeIds(descriptors) {\n\treturn [];\n}\n//#endregion\nexport { parseContractMarkerRow as n, collectSupportedCodecTypeIds as t };\n\n//# sourceMappingURL=verify-E6Dd2vYp.mjs.map"],"mappings":";;;AAGA,MAAM,aAAa,KAAK,EAAE,YAAY,UAAU,CAAC;AACjD,SAAS,UAAU,MAAM;CACxB,IAAI,SAAS,QAAQ,SA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AAa;CAClD,OAAO,CAAC;AACT"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ContractMarkerRecord } from "@prisma/orm-framework/contract/types";
|
|
2
|
+
//#region ../../../2-sql/9-family/dist/verify.d.mts
|
|
3
|
+
//#region src/core/verify.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Wire shape of a `prisma_contract.marker` row as it comes out of a SQL
|
|
6
|
+
* driver. Snake-cased to match the on-disk column names. Shared by every
|
|
7
|
+
* SQL target's `readMarker` so each runner doesn't redeclare it inline.
|
|
8
|
+
*/
|
|
9
|
+
type ContractMarkerRow = {
|
|
10
|
+
core_hash: string;
|
|
11
|
+
profile_hash: string;
|
|
12
|
+
contract_json: unknown | null;
|
|
13
|
+
canonical_version: number | null;
|
|
14
|
+
updated_at: Date | string;
|
|
15
|
+
app_tag: string | null;
|
|
16
|
+
meta: unknown | null;
|
|
17
|
+
invariants: unknown;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Parses a contract marker row from database query result.
|
|
21
|
+
* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).
|
|
22
|
+
*/
|
|
23
|
+
declare function parseContractMarkerRow(row: unknown): ContractMarkerRecord;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { parseContractMarkerRow as n, ContractMarkerRow as t };
|
|
26
|
+
//# sourceMappingURL=verify-zDRnw0Rn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-zDRnw0Rn.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/verify.d.mts"],"mappings":";;;;;;;;KAOK;EACH;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA;;;;;;iBAMe,uBAAuB,eAAe"}
|