@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,130 @@
|
|
|
1
|
+
import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
|
|
2
|
+
import { n as ForeignKeyInput, t as ForeignKey } from "./foreign-key-BSy9u4O4-BnsOe5Nf.mjs";
|
|
3
|
+
import { i as UniqueConstraintInput, n as PrimaryKeyInput, r as UniqueConstraint, t as PrimaryKey } from "./unique-constraint-jQWfH7dg-zLWtFp99.mjs";
|
|
4
|
+
import { r as IndexInput, t as Index } from "./sql-index-DsI8HAeK-BJsn-jvD.mjs";
|
|
5
|
+
import { ColumnDefault, ControlPolicy, ValueSetRef } from "@prisma/orm-framework/contract/types";
|
|
6
|
+
//#region ../../../2-sql/1-core/contract/dist/storage-table-BBaAmanc.d.mts
|
|
7
|
+
//#region src/ir/check-constraint.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Hydration / construction input shape for {@link CheckConstraint}.
|
|
10
|
+
* Mirrors the on-disk storage JSON envelope so the serializer hydration
|
|
11
|
+
* walker can hand a validated literal straight to `new`.
|
|
12
|
+
*/
|
|
13
|
+
interface CheckConstraintInput {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly column: string;
|
|
16
|
+
readonly valueSet: ValueSetRef;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SQL Contract IR node for a table-level check constraint that restricts
|
|
20
|
+
* a column to the permitted values of a value-set.
|
|
21
|
+
*
|
|
22
|
+
* The constraint is **structured** (names a column and a value-set
|
|
23
|
+
* reference), not a raw SQL expression. Each target renders its own DDL
|
|
24
|
+
* from the structured form, keeping the contract target-agnostic.
|
|
25
|
+
*
|
|
26
|
+
* Construction is idempotent: passing an existing `CheckConstraint`
|
|
27
|
+
* instance as input produces a new instance with identical fields.
|
|
28
|
+
* The constructor does not use `instanceof` for input discrimination —
|
|
29
|
+
* it reads plain named properties, which is sufficient since
|
|
30
|
+
* `CheckConstraintInput` is a structural type.
|
|
31
|
+
*/
|
|
32
|
+
declare class CheckConstraint extends SqlNode {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly column: string;
|
|
35
|
+
readonly valueSet: ValueSetRef;
|
|
36
|
+
constructor(input: CheckConstraintInput);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/ir/storage-column.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Hydration / construction input shape for {@link StorageColumn}. Mirrors
|
|
42
|
+
* the on-disk storage JSON envelope exactly so the family-base
|
|
43
|
+
* serializer's hydration walker can hand an arktype-validated literal
|
|
44
|
+
* straight to `new`.
|
|
45
|
+
*
|
|
46
|
+
* `typeParams` and `typeRef` remain mutually exclusive (one or the
|
|
47
|
+
* other, not both); the constructor preserves whichever caller-side
|
|
48
|
+
* choice the input encodes.
|
|
49
|
+
*/
|
|
50
|
+
interface StorageColumnInput {
|
|
51
|
+
readonly nativeType: string;
|
|
52
|
+
readonly codecId: string;
|
|
53
|
+
readonly nullable: boolean;
|
|
54
|
+
readonly many?: boolean;
|
|
55
|
+
readonly typeParams?: Record<string, unknown>;
|
|
56
|
+
readonly typeRef?: string;
|
|
57
|
+
readonly default?: ColumnDefault;
|
|
58
|
+
readonly control?: ControlPolicy;
|
|
59
|
+
readonly valueSet?: ValueSetRef;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* SQL Contract IR node for a single column entry in `StorageTable.columns`.
|
|
63
|
+
*
|
|
64
|
+
* Single concrete family-shared class — every SQL target reads the
|
|
65
|
+
* same column shape today, so there is no per-target subclass. The
|
|
66
|
+
* class type accepts any caller that constructs via
|
|
67
|
+
* `new StorageColumn(input)`; literal construction sites must pass
|
|
68
|
+
* through the constructor or the family-base hydration walker.
|
|
69
|
+
*
|
|
70
|
+
* The column's `name` is not on the class — columns are keyed by name
|
|
71
|
+
* in the parent `StorageTable.columns: Record<string, StorageColumn>`
|
|
72
|
+
* map, so a `name` field would be redundant with the key.
|
|
73
|
+
*/
|
|
74
|
+
declare class StorageColumn extends SqlNode {
|
|
75
|
+
readonly nativeType: string;
|
|
76
|
+
readonly codecId: string;
|
|
77
|
+
readonly nullable: boolean;
|
|
78
|
+
readonly many?: boolean;
|
|
79
|
+
readonly typeParams?: Record<string, unknown>;
|
|
80
|
+
readonly typeRef?: string;
|
|
81
|
+
readonly default?: ColumnDefault;
|
|
82
|
+
readonly control?: ControlPolicy;
|
|
83
|
+
readonly valueSet?: ValueSetRef;
|
|
84
|
+
constructor(input: StorageColumnInput);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/ir/storage-table.d.ts
|
|
88
|
+
interface StorageTableInput {
|
|
89
|
+
readonly columns: Record<string, StorageColumn | StorageColumnInput>;
|
|
90
|
+
readonly primaryKey?: PrimaryKey | PrimaryKeyInput;
|
|
91
|
+
readonly uniques: ReadonlyArray<UniqueConstraint | UniqueConstraintInput>;
|
|
92
|
+
readonly indexes: ReadonlyArray<Index | IndexInput>;
|
|
93
|
+
readonly foreignKeys: ReadonlyArray<ForeignKey | ForeignKeyInput>;
|
|
94
|
+
readonly control?: ControlPolicy;
|
|
95
|
+
readonly checks?: ReadonlyArray<CheckConstraint | CheckConstraintInput>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* SQL Contract IR node for a single table entry in a namespace's
|
|
99
|
+
* `tables` map.
|
|
100
|
+
*
|
|
101
|
+
* The constructor normalises nested IR-class fields (columns, primary
|
|
102
|
+
* key, uniques, indexes, foreign keys) into the appropriate class
|
|
103
|
+
* instances so downstream walks see a uniform AST regardless of whether
|
|
104
|
+
* the input was a JSON literal or an already-constructed class.
|
|
105
|
+
*
|
|
106
|
+
* The table's `name` is not on the class — tables are keyed by name in
|
|
107
|
+
* the parent namespace's `tables: Record<string, StorageTable>` map.
|
|
108
|
+
*/
|
|
109
|
+
declare class StorageTable extends SqlNode {
|
|
110
|
+
readonly columns: Readonly<Record<string, StorageColumn>>;
|
|
111
|
+
readonly uniques: ReadonlyArray<UniqueConstraint>;
|
|
112
|
+
readonly indexes: ReadonlyArray<Index>;
|
|
113
|
+
readonly foreignKeys: ReadonlyArray<ForeignKey>;
|
|
114
|
+
readonly primaryKey?: PrimaryKey;
|
|
115
|
+
readonly control?: ControlPolicy;
|
|
116
|
+
readonly checks?: ReadonlyArray<CheckConstraint>;
|
|
117
|
+
constructor(input: StorageTableInput);
|
|
118
|
+
/**
|
|
119
|
+
* Runtime guard that a namespace `table` entry is really a `StorageTable`.
|
|
120
|
+
* The compiler already types the entry as `StorageTable`, but a
|
|
121
|
+
* freshly-deserialized contract may carry plain JSON at that slot until
|
|
122
|
+
* hydration; this duck-types the structural shape. Accepts `undefined` so
|
|
123
|
+
* optional-chained entry lookups pass straight through.
|
|
124
|
+
*/
|
|
125
|
+
static is(value: StorageTable | undefined): value is StorageTable;
|
|
126
|
+
static assert(value: StorageTable | undefined, coordinate: string): asserts value is StorageTable;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { StorageTable as a, StorageColumnInput as i, CheckConstraintInput as n, StorageTableInput as o, StorageColumn as r, CheckConstraint as t };
|
|
130
|
+
//# sourceMappingURL=storage-table-BBaAmanc-BwR37LMA.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-table-BBaAmanc-BwR37LMA.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/storage-table-BBaAmanc.d.mts"],"mappings":";;;;;;;;;;;;UAWU;WACC;WACA;WACA,UAAU;;;;;;;;;;;;;;;;cAgBP,wBAAwB;WAC3B;WACA;WACA,UAAU;EACnB,YAAY,OAAO;;;;;;;;;;;;;;UAcX;WACC;WACA;WACA;WACA;WACA,aAAa;WACb;WACA,UAAU;WACV,UAAU;WACV,WAAW;;;;;;;;;;;;;;;cAeR,sBAAsB;WACzB;WACA;WACA;WACA;WACA,aAAa;WACb;WACA,UAAU;WACV,UAAU;WACV,WAAW;EACpB,YAAY,OAAO;;;;UAIX;WACC,SAAS,eAAe,gBAAgB;WACxC,aAAa,aAAa;WAC1B,SAAS,cAAc,mBAAmB;WAC1C,SAAS,cAAc,QAAQ;WAC/B,aAAa,cAAc,aAAa;WACxC,UAAU;WACV,SAAS,cAAc,kBAAkB;;;;;;;;;;;;;;cActC,qBAAqB;WACxB,SAAS,SAAS,eAAe;WACjC,SAAS,cAAc;WACvB,SAAS,cAAc;WACvB,aAAa,cAAc;WAC3B,aAAa;WACb,UAAU;WACV,SAAS,cAAc;EAChC,YAAY,OAAO;;;;;;;;SAQZ,GAAG,OAAO,2BAA2B,SAAS;SAC9C,OAAO,OAAO,0BAA0B,6BAA6B,SAAS"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { o as nameOf } from "./naming-BwqqVcZy-BgTObIQw.mjs";
|
|
2
|
+
import { IRNodeBase, freezeNode } from "@prisma/orm-framework/components/ir";
|
|
3
|
+
import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
|
|
4
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
|
+
import { asNamespaceId } from "@prisma/orm-framework/contract/types";
|
|
6
|
+
//#region ../../../2-sql/1-core/contract/dist/storage-table-_LWDmPfv.mjs
|
|
7
|
+
/**
|
|
8
|
+
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
9
|
+
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
10
|
+
*
|
|
11
|
+
* Single family-level discriminator (not per-leaf) reflects the fact that
|
|
12
|
+
* SQL IR has no polymorphic dispatch today — verifiers and serializers
|
|
13
|
+
* walk by structural position (`storage.tables[name].columns[name]`),
|
|
14
|
+
* not by inspecting `kind`. The abstract bar for per-leaf discriminators
|
|
15
|
+
* isn't earned until a future polymorphic consumer arrives.
|
|
16
|
+
*
|
|
17
|
+
* `kind` is installed as a non-enumerable own property on every instance,
|
|
18
|
+
* which keeps three things clean simultaneously:
|
|
19
|
+
*
|
|
20
|
+
* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
|
|
21
|
+
* shape (no `kind` field), so emitted contract.json files and the
|
|
22
|
+
* `validateSqlContractFully` arktype schemas stay unchanged.
|
|
23
|
+
* - Test assertions that use `toEqual({...})` against the pre-lift flat
|
|
24
|
+
* shape continue to pass — only enumerable own properties are
|
|
25
|
+
* compared.
|
|
26
|
+
* - Direct access (`node.kind`) and runtime narrowing
|
|
27
|
+
* (`if (node.kind === 'sql')`) still work, so future polymorphic
|
|
28
|
+
* dispatch can begin reading `kind` without a runtime change.
|
|
29
|
+
*
|
|
30
|
+
* Future per-leaf overrides land cleanly: a class that gains a
|
|
31
|
+
* polymorphic-dispatch consumer (e.g. an enum type instance walked
|
|
32
|
+
* alongside other types) overrides `kind` with its narrower literal
|
|
33
|
+
* at that leaf level. Per-leaf overrides will use enumerable kind
|
|
34
|
+
* (matching the Mongo per-class-discriminator precedent) because they
|
|
35
|
+
* encode dispatch-relevant information that callers need to see in
|
|
36
|
+
* JSON envelopes; the family-level `'sql'` is uniform across all SQL
|
|
37
|
+
* IR and carries no dispatch-relevant information.
|
|
38
|
+
*/
|
|
39
|
+
var SqlNode = class extends IRNodeBase {
|
|
40
|
+
kind;
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
Object.defineProperty(this, "kind", {
|
|
44
|
+
value: "sql",
|
|
45
|
+
writable: false,
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* SQL Contract IR node for a table-level secondary index, name-identified:
|
|
53
|
+
* `name` is the full physical name; a present `prefix` marks the index as
|
|
54
|
+
* wire-named (`name` is `formatWireName(prefix, <8hex>)`), an absent `prefix`
|
|
55
|
+
* marks it exact (the name is adopted verbatim).
|
|
56
|
+
*
|
|
57
|
+
* `expression`, `where`, and `unique` are genuine SQL-family attributes —
|
|
58
|
+
* functional and partial indexes are standard SQL supported natively by
|
|
59
|
+
* Postgres and SQLite alike, and the family IR must be able to represent
|
|
60
|
+
* anything any SQL target can introspect. A target declining to AUTHOR them
|
|
61
|
+
* (SQLite's rejection at namespace construction) is a capability decision,
|
|
62
|
+
* not evidence of target-specificity.
|
|
63
|
+
*
|
|
64
|
+
* Note that this class shadows the global TypeScript `Index` lib type
|
|
65
|
+
* at the family-shared name; consumer files that need both should
|
|
66
|
+
* alias one (e.g.
|
|
67
|
+
* `import { Index as SqlIndexNode } from '@internal/sql-contract/types'`).
|
|
68
|
+
*/
|
|
69
|
+
var Index = class extends SqlNode {
|
|
70
|
+
name;
|
|
71
|
+
unique;
|
|
72
|
+
constructor(input) {
|
|
73
|
+
super();
|
|
74
|
+
const name = nameOf(input.naming);
|
|
75
|
+
if (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");
|
|
76
|
+
if (input.columns === void 0 === (input.expression === void 0)) throw new ContractValidationError(`Index "${name}": exactly one of columns or expression must be set.`, "storage");
|
|
77
|
+
this.name = name;
|
|
78
|
+
this.unique = input.unique;
|
|
79
|
+
if (input.naming.kind === "wire") this.prefix = input.naming.prefix;
|
|
80
|
+
if (input.columns !== void 0) this.columns = input.columns;
|
|
81
|
+
if (input.expression !== void 0) this.expression = input.expression;
|
|
82
|
+
if (input.where !== void 0) this.where = input.where;
|
|
83
|
+
if (input.type !== void 0) this.type = input.type;
|
|
84
|
+
if (input.options !== void 0) this.options = input.options;
|
|
85
|
+
freezeNode(this);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* SQL Contract IR node for a table-level check constraint that restricts
|
|
90
|
+
* a column to the permitted values of a value-set.
|
|
91
|
+
*
|
|
92
|
+
* The constraint is **structured** (names a column and a value-set
|
|
93
|
+
* reference), not a raw SQL expression. Each target renders its own DDL
|
|
94
|
+
* from the structured form, keeping the contract target-agnostic.
|
|
95
|
+
*
|
|
96
|
+
* Construction is idempotent: passing an existing `CheckConstraint`
|
|
97
|
+
* instance as input produces a new instance with identical fields.
|
|
98
|
+
* The constructor does not use `instanceof` for input discrimination —
|
|
99
|
+
* it reads plain named properties, which is sufficient since
|
|
100
|
+
* `CheckConstraintInput` is a structural type.
|
|
101
|
+
*/
|
|
102
|
+
var CheckConstraint = class extends SqlNode {
|
|
103
|
+
name;
|
|
104
|
+
column;
|
|
105
|
+
valueSet;
|
|
106
|
+
constructor(input) {
|
|
107
|
+
super();
|
|
108
|
+
this.name = input.name;
|
|
109
|
+
this.column = input.column;
|
|
110
|
+
this.valueSet = input.valueSet;
|
|
111
|
+
freezeNode(this);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* SQL Contract IR node for one side (source or target) of a foreign-key
|
|
116
|
+
* declaration. Carries the full coordinate: namespace, table, and columns.
|
|
117
|
+
*
|
|
118
|
+
* Cross-space discrimination is based on `spaceId` presence: absent means
|
|
119
|
+
* local (same contract-space); present means cross-space (the referenced
|
|
120
|
+
* table lives in the contract-space identified by `spaceId`).
|
|
121
|
+
*
|
|
122
|
+
* For local references `spaceId` is absent from JSON, keeping the serialized
|
|
123
|
+
* shape byte-identical to contracts authored before cross-space support was
|
|
124
|
+
* added. For cross-space references `spaceId` appears in JSON so round-trips
|
|
125
|
+
* are lossless.
|
|
126
|
+
*
|
|
127
|
+
* Use `UNBOUND_NAMESPACE_ID` from `@internal/framework-components/ir`
|
|
128
|
+
* as the sentinel `namespaceId` for single-namespace (unbound) references.
|
|
129
|
+
*/
|
|
130
|
+
var ForeignKeyReference = class extends SqlNode {
|
|
131
|
+
namespaceId;
|
|
132
|
+
tableName;
|
|
133
|
+
columns;
|
|
134
|
+
constructor(input) {
|
|
135
|
+
super();
|
|
136
|
+
this.namespaceId = asNamespaceId(input.namespaceId);
|
|
137
|
+
this.tableName = input.tableName;
|
|
138
|
+
this.columns = input.columns;
|
|
139
|
+
if (input.spaceId !== void 0) this.spaceId = input.spaceId;
|
|
140
|
+
freezeNode(this);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* SQL Contract IR node for a table-level foreign-key declaration — the
|
|
145
|
+
* referential constraint only (source, target, `onDelete`/`onUpdate`).
|
|
146
|
+
*
|
|
147
|
+
* A persisted `foreignKeys[]` entry always denotes a real constraint: whether
|
|
148
|
+
* to emit the constraint at all, and whether to back it with an index, are
|
|
149
|
+
* authoring-time decisions (PSL `@relation(index:)`, TS `fk({ constraint,
|
|
150
|
+
* index })`) resolved once at `contract emit` — a `constraint: false` FK
|
|
151
|
+
* simply has no entry here, and a backing index (if any) is its own discrete,
|
|
152
|
+
* named entry in the table's `indexes[]`.
|
|
153
|
+
*
|
|
154
|
+
* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
|
|
155
|
+
* coordinates (namespace, table, columns). For single-namespace contracts the
|
|
156
|
+
* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.
|
|
157
|
+
*
|
|
158
|
+
* The nested references are normalised to {@link ForeignKeyReference}
|
|
159
|
+
* instances inside the constructor so downstream walks see a uniform AST
|
|
160
|
+
* regardless of whether the input was a JSON literal or an already-constructed
|
|
161
|
+
* class instance.
|
|
162
|
+
*/
|
|
163
|
+
var ForeignKey = class extends SqlNode {
|
|
164
|
+
source;
|
|
165
|
+
target;
|
|
166
|
+
constructor(input) {
|
|
167
|
+
super();
|
|
168
|
+
this.source = input.source instanceof ForeignKeyReference ? input.source : new ForeignKeyReference(input.source);
|
|
169
|
+
this.target = input.target instanceof ForeignKeyReference ? input.target : new ForeignKeyReference(input.target);
|
|
170
|
+
if (input.name !== void 0) this.name = input.name;
|
|
171
|
+
if (input.onDelete !== void 0) this.onDelete = input.onDelete;
|
|
172
|
+
if (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;
|
|
173
|
+
freezeNode(this);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* SQL Contract IR node for a table's primary-key constraint.
|
|
178
|
+
*/
|
|
179
|
+
var PrimaryKey = class extends SqlNode {
|
|
180
|
+
columns;
|
|
181
|
+
constructor(input) {
|
|
182
|
+
super();
|
|
183
|
+
this.columns = input.columns;
|
|
184
|
+
if (input.name !== void 0) this.name = input.name;
|
|
185
|
+
freezeNode(this);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* SQL Contract IR node for a single column entry in `StorageTable.columns`.
|
|
190
|
+
*
|
|
191
|
+
* Single concrete family-shared class — every SQL target reads the
|
|
192
|
+
* same column shape today, so there is no per-target subclass. The
|
|
193
|
+
* class type accepts any caller that constructs via
|
|
194
|
+
* `new StorageColumn(input)`; literal construction sites must pass
|
|
195
|
+
* through the constructor or the family-base hydration walker.
|
|
196
|
+
*
|
|
197
|
+
* The column's `name` is not on the class — columns are keyed by name
|
|
198
|
+
* in the parent `StorageTable.columns: Record<string, StorageColumn>`
|
|
199
|
+
* map, so a `name` field would be redundant with the key.
|
|
200
|
+
*/
|
|
201
|
+
var StorageColumn = class extends SqlNode {
|
|
202
|
+
nativeType;
|
|
203
|
+
codecId;
|
|
204
|
+
nullable;
|
|
205
|
+
constructor(input) {
|
|
206
|
+
super();
|
|
207
|
+
this.nativeType = input.nativeType;
|
|
208
|
+
this.codecId = input.codecId;
|
|
209
|
+
this.nullable = input.nullable;
|
|
210
|
+
if (input.many !== void 0) this.many = input.many;
|
|
211
|
+
if (input.typeParams !== void 0) this.typeParams = input.typeParams;
|
|
212
|
+
if (input.typeRef !== void 0) this.typeRef = input.typeRef;
|
|
213
|
+
if (input.default !== void 0) this.default = input.default;
|
|
214
|
+
if (input.control !== void 0) this.control = input.control;
|
|
215
|
+
if (input.valueSet !== void 0) this.valueSet = input.valueSet;
|
|
216
|
+
freezeNode(this);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* SQL Contract IR node for a table-level unique constraint.
|
|
221
|
+
*/
|
|
222
|
+
var UniqueConstraint = class extends SqlNode {
|
|
223
|
+
columns;
|
|
224
|
+
constructor(input) {
|
|
225
|
+
super();
|
|
226
|
+
this.columns = input.columns;
|
|
227
|
+
if (input.name !== void 0) this.name = input.name;
|
|
228
|
+
freezeNode(this);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* SQL Contract IR node for a single table entry in a namespace's
|
|
233
|
+
* `tables` map.
|
|
234
|
+
*
|
|
235
|
+
* The constructor normalises nested IR-class fields (columns, primary
|
|
236
|
+
* key, uniques, indexes, foreign keys) into the appropriate class
|
|
237
|
+
* instances so downstream walks see a uniform AST regardless of whether
|
|
238
|
+
* the input was a JSON literal or an already-constructed class.
|
|
239
|
+
*
|
|
240
|
+
* The table's `name` is not on the class — tables are keyed by name in
|
|
241
|
+
* the parent namespace's `tables: Record<string, StorageTable>` map.
|
|
242
|
+
*/
|
|
243
|
+
var StorageTable = class StorageTable extends SqlNode {
|
|
244
|
+
columns;
|
|
245
|
+
uniques;
|
|
246
|
+
indexes;
|
|
247
|
+
foreignKeys;
|
|
248
|
+
constructor(input) {
|
|
249
|
+
super();
|
|
250
|
+
this.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([name, col]) => [name, col instanceof StorageColumn ? col : new StorageColumn(col)])));
|
|
251
|
+
if (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);
|
|
252
|
+
this.uniques = Object.freeze(input.uniques.map((u) => u instanceof UniqueConstraint ? u : new UniqueConstraint(u)));
|
|
253
|
+
this.indexes = Object.freeze(input.indexes.map((i) => i instanceof Index ? i : new Index(i)));
|
|
254
|
+
this.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof ForeignKey ? fk : new ForeignKey(fk)));
|
|
255
|
+
if (input.control !== void 0) this.control = input.control;
|
|
256
|
+
if (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((cc) => new CheckConstraint(cc)));
|
|
257
|
+
freezeNode(this);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Runtime guard that a namespace `table` entry is really a `StorageTable`.
|
|
261
|
+
* The compiler already types the entry as `StorageTable`, but a
|
|
262
|
+
* freshly-deserialized contract may carry plain JSON at that slot until
|
|
263
|
+
* hydration; this duck-types the structural shape. Accepts `undefined` so
|
|
264
|
+
* optional-chained entry lookups pass straight through.
|
|
265
|
+
*/
|
|
266
|
+
static is(value) {
|
|
267
|
+
if (typeof value !== "object" || value === null) return false;
|
|
268
|
+
return "columns" in value && "uniques" in value && "indexes" in value && "foreignKeys" in value;
|
|
269
|
+
}
|
|
270
|
+
static assert(value, coordinate) {
|
|
271
|
+
if (!StorageTable.is(value)) throw new InternalError(`Expected a StorageTable at ${coordinate}`);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
export { PrimaryKey as a, StorageTable as c, Index as i, UniqueConstraint as l, ForeignKey as n, SqlNode as o, ForeignKeyReference as r, StorageColumn as s, CheckConstraint as t };
|
|
276
|
+
|
|
277
|
+
//# sourceMappingURL=storage-table-_LWDmPfv-DFhU2dML.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-table-_LWDmPfv-DFhU2dML.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/storage-table-_LWDmPfv.mjs"],"sourcesContent":["import { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { nameOf } from \"@internal/sql-schema-ir/naming\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { asNamespaceId } from \"@internal/contract/types\";\n//#region src/ir/sql-node.ts\n/**\n* SQL family IR node base. Carries the family-level `kind` discriminator\n* `'sql'` and inherits the framework's `freezeNode` affordance.\n*\n* Single family-level discriminator (not per-leaf) reflects the fact that\n* SQL IR has no polymorphic dispatch today — verifiers and serializers\n* walk by structural position (`storage.tables[name].columns[name]`),\n* not by inspecting `kind`. The abstract bar for per-leaf discriminators\n* isn't earned until a future polymorphic consumer arrives.\n*\n* `kind` is installed as a non-enumerable own property on every instance,\n* which keeps three things clean simultaneously:\n*\n* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope\n* shape (no `kind` field), so emitted contract.json files and the\n* `validateSqlContractFully` arktype schemas stay unchanged.\n* - Test assertions that use `toEqual({...})` against the pre-lift flat\n* shape continue to pass — only enumerable own properties are\n* compared.\n* - Direct access (`node.kind`) and runtime narrowing\n* (`if (node.kind === 'sql')`) still work, so future polymorphic\n* dispatch can begin reading `kind` without a runtime change.\n*\n* Future per-leaf overrides land cleanly: a class that gains a\n* polymorphic-dispatch consumer (e.g. an enum type instance walked\n* alongside other types) overrides `kind` with its narrower literal\n* at that leaf level. Per-leaf overrides will use enumerable kind\n* (matching the Mongo per-class-discriminator precedent) because they\n* encode dispatch-relevant information that callers need to see in\n* JSON envelopes; the family-level `'sql'` is uniform across all SQL\n* IR and carries no dispatch-relevant information.\n*/\nvar SqlNode = class extends IRNodeBase {\n\tkind;\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t}\n};\n//#endregion\n//#region src/ir/sql-index.ts\n/**\n* SQL Contract IR node for a table-level secondary index, name-identified:\n* `name` is the full physical name; a present `prefix` marks the index as\n* wire-named (`name` is `formatWireName(prefix, <8hex>)`), an absent `prefix`\n* marks it exact (the name is adopted verbatim).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL supported natively by\n* Postgres and SQLite alike, and the family IR must be able to represent\n* anything any SQL target can introspect. A target declining to AUTHOR them\n* (SQLite's rejection at namespace construction) is a capability decision,\n* not evidence of target-specificity.\n*\n* Note that this class shadows the global TypeScript `Index` lib type\n* at the family-shared name; consumer files that need both should\n* alias one (e.g.\n* `import { Index as SqlIndexNode } from '@internal/sql-contract/types'`).\n*/\nvar Index = class extends SqlNode {\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (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\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new ContractValidationError(`Index \"${name}\": exactly one of columns or expression must be set.`, \"storage\");\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tif (input.type !== void 0) this.type = input.type;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/check-constraint.ts\n/**\n* SQL Contract IR node for a table-level check constraint that restricts\n* a column to the permitted values of a value-set.\n*\n* The constraint is **structured** (names a column and a value-set\n* reference), not a raw SQL expression. Each target renders its own DDL\n* from the structured form, keeping the contract target-agnostic.\n*\n* Construction is idempotent: passing an existing `CheckConstraint`\n* instance as input produces a new instance with identical fields.\n* The constructor does not use `instanceof` for input discrimination —\n* it reads plain named properties, which is sufficient since\n* `CheckConstraintInput` is a structural type.\n*/\nvar CheckConstraint = class extends SqlNode {\n\tname;\n\tcolumn;\n\tvalueSet;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.column = input.column;\n\t\tthis.valueSet = input.valueSet;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/foreign-key-reference.ts\n/**\n* SQL Contract IR node for one side (source or target) of a foreign-key\n* declaration. Carries the full coordinate: namespace, table, and columns.\n*\n* Cross-space discrimination is based on `spaceId` presence: absent means\n* local (same contract-space); present means cross-space (the referenced\n* table lives in the contract-space identified by `spaceId`).\n*\n* For local references `spaceId` is absent from JSON, keeping the serialized\n* shape byte-identical to contracts authored before cross-space support was\n* added. For cross-space references `spaceId` appears in JSON so round-trips\n* are lossless.\n*\n* Use `UNBOUND_NAMESPACE_ID` from `@internal/framework-components/ir`\n* as the sentinel `namespaceId` for single-namespace (unbound) references.\n*/\nvar ForeignKeyReference = class extends SqlNode {\n\tnamespaceId;\n\ttableName;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.namespaceId = asNamespaceId(input.namespaceId);\n\t\tthis.tableName = input.tableName;\n\t\tthis.columns = input.columns;\n\t\tif (input.spaceId !== void 0) this.spaceId = input.spaceId;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/foreign-key.ts\n/**\n* SQL Contract IR node for a table-level foreign-key declaration — the\n* referential constraint only (source, target, `onDelete`/`onUpdate`).\n*\n* A persisted `foreignKeys[]` entry always denotes a real constraint: whether\n* to emit the constraint at all, and whether to back it with an index, are\n* authoring-time decisions (PSL `@relation(index:)`, TS `fk({ constraint,\n* index })`) resolved once at `contract emit` — a `constraint: false` FK\n* simply has no entry here, and a backing index (if any) is its own discrete,\n* named entry in the table's `indexes[]`.\n*\n* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}\n* coordinates (namespace, table, columns). For single-namespace contracts the\n* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.\n*\n* The nested references are normalised to {@link ForeignKeyReference}\n* instances inside the constructor so downstream walks see a uniform AST\n* regardless of whether the input was a JSON literal or an already-constructed\n* class instance.\n*/\nvar ForeignKey = class extends SqlNode {\n\tsource;\n\ttarget;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.source = input.source instanceof ForeignKeyReference ? input.source : new ForeignKeyReference(input.source);\n\t\tthis.target = input.target instanceof ForeignKeyReference ? input.target : new ForeignKeyReference(input.target);\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* SQL Contract IR node for a table's primary-key constraint.\n*/\nvar PrimaryKey = class extends SqlNode {\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/storage-column.ts\n/**\n* SQL Contract IR node for a single column entry in `StorageTable.columns`.\n*\n* Single concrete family-shared class — every SQL target reads the\n* same column shape today, so there is no per-target subclass. The\n* class type accepts any caller that constructs via\n* `new StorageColumn(input)`; literal construction sites must pass\n* through the constructor or the family-base hydration walker.\n*\n* The column's `name` is not on the class — columns are keyed by name\n* in the parent `StorageTable.columns: Record<string, StorageColumn>`\n* map, so a `name` field would be redundant with the key.\n*/\nvar StorageColumn = class extends SqlNode {\n\tnativeType;\n\tcodecId;\n\tnullable;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.codecId = input.codecId;\n\t\tthis.nullable = input.nullable;\n\t\tif (input.many !== void 0) this.many = input.many;\n\t\tif (input.typeParams !== void 0) this.typeParams = input.typeParams;\n\t\tif (input.typeRef !== void 0) this.typeRef = input.typeRef;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tif (input.valueSet !== void 0) this.valueSet = input.valueSet;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/unique-constraint.ts\n/**\n* SQL Contract IR node for a table-level unique constraint.\n*/\nvar UniqueConstraint = class extends SqlNode {\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/storage-table.ts\n/**\n* SQL Contract IR node for a single table entry in a namespace's\n* `tables` map.\n*\n* The constructor normalises nested IR-class fields (columns, primary\n* key, uniques, indexes, foreign keys) into the appropriate class\n* instances so downstream walks see a uniform AST regardless of whether\n* the input was a JSON literal or an already-constructed class.\n*\n* The table's `name` is not on the class — tables are keyed by name in\n* the parent namespace's `tables: Record<string, StorageTable>` map.\n*/\nvar StorageTable = class StorageTable extends SqlNode {\n\tcolumns;\n\tuniques;\n\tindexes;\n\tforeignKeys;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([name, col]) => [name, col instanceof StorageColumn ? col : new StorageColumn(col)])));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof UniqueConstraint ? u : new UniqueConstraint(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map((i) => i instanceof Index ? i : new Index(i)));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof ForeignKey ? fk : new ForeignKey(fk)));\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((cc) => new CheckConstraint(cc)));\n\t\tfreezeNode(this);\n\t}\n\t/**\n\t* Runtime guard that a namespace `table` entry is really a `StorageTable`.\n\t* The compiler already types the entry as `StorageTable`, but a\n\t* freshly-deserialized contract may carry plain JSON at that slot until\n\t* hydration; this duck-types the structural shape. Accepts `undefined` so\n\t* optional-chained entry lookups pass straight through.\n\t*/\n\tstatic is(value) {\n\t\tif (typeof value !== \"object\" || value === null) return false;\n\t\treturn \"columns\" in value && \"uniques\" in value && \"indexes\" in value && \"foreignKeys\" in value;\n\t}\n\tstatic assert(value, coordinate) {\n\t\tif (!StorageTable.is(value)) throw new InternalError(`Expected a StorageTable at ${coordinate}`);\n\t}\n};\n//#endregion\nexport { ForeignKey as a, Index as c, PrimaryKey as i, SqlNode as l, UniqueConstraint as n, ForeignKeyReference as o, StorageColumn as r, CheckConstraint as s, StorageTable as t };\n\n//# sourceMappingURL=storage-table-_LWDmPfv.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { t as SqlNode } from "./sql-node-kEz6YFZo-v2F7delx.mjs";
|
|
2
|
+
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
//#region ../../../2-sql/1-core/contract/dist/storage-value-set-BGlj5Uus.d.mts
|
|
4
|
+
//#region src/ir/storage-value-set.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Hydration / construction input shape for {@link StorageValueSet}.
|
|
7
|
+
* Mirrors the on-disk storage JSON envelope so the serializer hydration
|
|
8
|
+
* walker can hand a validated literal straight to `new`.
|
|
9
|
+
*/
|
|
10
|
+
interface StorageValueSetInput {
|
|
11
|
+
readonly kind: 'valueSet';
|
|
12
|
+
/** Ordered permitted values, codec-encoded. Declaration order is preserved. */
|
|
13
|
+
readonly values: readonly JsonValue[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* SQL Contract IR node for a value-set entry in a namespace's `valueSet`
|
|
17
|
+
* map (`SqlNamespace.entries.valueSet`).
|
|
18
|
+
*
|
|
19
|
+
* A value-set records the ordered set of permitted codec-encoded values for
|
|
20
|
+
* an enum-like column restriction. It does not carry a `codecId` — the
|
|
21
|
+
* column that references it already holds the codec; the value-set holds
|
|
22
|
+
* only the permitted values.
|
|
23
|
+
*
|
|
24
|
+
* The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope
|
|
25
|
+
* carries the discriminator and the serializer hydration walker can
|
|
26
|
+
* dispatch on it. This follows the per-leaf enumerable-kind convention
|
|
27
|
+
* established in the SQL-node comment (future polymorphic dispatch on
|
|
28
|
+
* namespace entries needs the discriminator in JSON).
|
|
29
|
+
*
|
|
30
|
+
* The entry's name is not on the class — value-sets are keyed by name in
|
|
31
|
+
* the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
|
|
32
|
+
*/
|
|
33
|
+
declare class StorageValueSet extends SqlNode {
|
|
34
|
+
readonly kind: "valueSet";
|
|
35
|
+
readonly values: readonly JsonValue[];
|
|
36
|
+
constructor(input: StorageValueSetInput);
|
|
37
|
+
}
|
|
38
|
+
declare function isStorageValueSet(value: unknown): value is StorageValueSet;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { StorageValueSetInput as n, isStorageValueSet as r, StorageValueSet as t };
|
|
41
|
+
//# sourceMappingURL=storage-value-set-BGlj5Uus-CvZD--GG.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-value-set-BGlj5Uus-CvZD--GG.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/storage-value-set-BGlj5Uus.d.mts"],"mappings":";;;;;;;;;UAQU;WACC;;WAEA,iBAAiB;;;;;;;;;;;;;;;;;;;;cAoBd,wBAAwB;WAC3B;WACA,iBAAiB;EAC1B,YAAY,OAAO;;iBAEJ,kBAAkB,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//#region ../../../2-sql/9-family/dist/timestamp-now-generator-DRXygu32.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Canonical id for the wall-clock-now mutation default generator.
|
|
4
|
+
*
|
|
5
|
+
* Owned by `family-sql` because that's where the generator lives. The
|
|
6
|
+
* id flows out from here to (1) the control-plane descriptor and the
|
|
7
|
+
* temporal field-preset pair below, (2) the runtime-plane sibling
|
|
8
|
+
* `timestamp-now-runtime-generator.ts`, and (3) authoring surfaces
|
|
9
|
+
* (PSL `temporal.updatedAt()`, TS `field.temporal.updatedAt()`) via
|
|
10
|
+
* the descriptor flow. Co-locating the constant with its only owner
|
|
11
|
+
* keeps the framework layer free of concrete generator ids.
|
|
12
|
+
*/
|
|
13
|
+
const TIMESTAMP_NOW_GENERATOR_ID = "timestampNow";
|
|
14
|
+
/**
|
|
15
|
+
* Builds the canonical control-plane descriptor for the wall-clock-now
|
|
16
|
+
* mutation default generator. The descriptor's `id` and `buildPhases`
|
|
17
|
+
* are target-agnostic so PSL `temporal.updatedAt()` and TS
|
|
18
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts.
|
|
19
|
+
*
|
|
20
|
+
* `applicableCodecIds` is omitted: `timestampNow` is preset-only (not
|
|
21
|
+
* reachable via `@default(timestampNow())` lowering), and the codec is
|
|
22
|
+
* co-registered by the preset descriptor itself, so the
|
|
23
|
+
* `@default(...)` compatibility check has no role to play here.
|
|
24
|
+
*/
|
|
25
|
+
function timestampNowControlDescriptor() {
|
|
26
|
+
return {
|
|
27
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
28
|
+
buildPhases: () => ({
|
|
29
|
+
onCreate: {
|
|
30
|
+
kind: "generator",
|
|
31
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
32
|
+
},
|
|
33
|
+
onUpdate: {
|
|
34
|
+
kind: "generator",
|
|
35
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair
|
|
42
|
+
* for a SQL target. `createdAt` lowers to a `now()` storage default;
|
|
43
|
+
* `updatedAt` lowers to the `timestampNow` execution generator on both
|
|
44
|
+
* `onCreate` and `onUpdate` (RD: "last modified time", non-null). Targets
|
|
45
|
+
* supply the codec/native-type pair that matches their timestamp column;
|
|
46
|
+
* everything else is shared so PSL `temporal.updatedAt()` and TS
|
|
47
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts across
|
|
48
|
+
* targets by construction.
|
|
49
|
+
*/
|
|
50
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
51
|
+
function temporalAuthoringPresets(input) {
|
|
52
|
+
const { codecId, nativeType } = input;
|
|
53
|
+
return {
|
|
54
|
+
createdAt: {
|
|
55
|
+
kind: "fieldPreset",
|
|
56
|
+
output: {
|
|
57
|
+
codecId,
|
|
58
|
+
nativeType,
|
|
59
|
+
default: {
|
|
60
|
+
kind: "function",
|
|
61
|
+
expression: "now()"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
updatedAt: {
|
|
66
|
+
kind: "fieldPreset",
|
|
67
|
+
output: {
|
|
68
|
+
codecId,
|
|
69
|
+
nativeType,
|
|
70
|
+
executionDefaults: {
|
|
71
|
+
onCreate: {
|
|
72
|
+
kind: "generator",
|
|
73
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
74
|
+
},
|
|
75
|
+
onUpdate: {
|
|
76
|
+
kind: "generator",
|
|
77
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const TEMPORAL_PRECISION_ARG = {
|
|
85
|
+
name: "precision",
|
|
86
|
+
kind: "number",
|
|
87
|
+
optional: true,
|
|
88
|
+
integer: true,
|
|
89
|
+
minimum: 0
|
|
90
|
+
};
|
|
91
|
+
const TEMPORAL_ON_CREATE_ARG = {
|
|
92
|
+
name: "onCreate",
|
|
93
|
+
kind: "option",
|
|
94
|
+
values: ["now"],
|
|
95
|
+
optional: true
|
|
96
|
+
};
|
|
97
|
+
const TEMPORAL_ON_UPDATE_ARG = {
|
|
98
|
+
name: "onUpdate",
|
|
99
|
+
kind: "option",
|
|
100
|
+
values: ["now"],
|
|
101
|
+
optional: true
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Selects the `timestampNow` generator descriptor for the preset's `now`
|
|
105
|
+
* token. The token is preset vocabulary; the generator id never appears in a
|
|
106
|
+
* user's spelling (ADR 169 — `timestampNow` is preset-only).
|
|
107
|
+
*/
|
|
108
|
+
function temporalPhaseTemplate(index) {
|
|
109
|
+
return {
|
|
110
|
+
kind: "select",
|
|
111
|
+
index,
|
|
112
|
+
cases: { now: {
|
|
113
|
+
kind: "generator",
|
|
114
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
115
|
+
} }
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Builds a `temporal.<codec>` field preset for a codec that takes a precision
|
|
120
|
+
* parameter (`pg/timestamp@1`, `pg/timestamptz@1`). Arguments change field
|
|
121
|
+
* properties only — never the codec, which the caller fixes here.
|
|
122
|
+
*
|
|
123
|
+
* All three arguments are optional: omitting `precision` omits `typeParams`
|
|
124
|
+
* entirely, and omitting a phase omits that phase (both omitted omits
|
|
125
|
+
* `executionDefaults`).
|
|
126
|
+
*/
|
|
127
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
128
|
+
function temporalCodecPresetWithPrecision(input) {
|
|
129
|
+
return {
|
|
130
|
+
kind: "fieldPreset",
|
|
131
|
+
args: [
|
|
132
|
+
TEMPORAL_PRECISION_ARG,
|
|
133
|
+
TEMPORAL_ON_CREATE_ARG,
|
|
134
|
+
TEMPORAL_ON_UPDATE_ARG
|
|
135
|
+
],
|
|
136
|
+
output: {
|
|
137
|
+
codecId: input.codecId,
|
|
138
|
+
nativeType: input.nativeType,
|
|
139
|
+
typeParams: { precision: {
|
|
140
|
+
kind: "arg",
|
|
141
|
+
index: 0
|
|
142
|
+
} },
|
|
143
|
+
executionDefaults: {
|
|
144
|
+
onCreate: temporalPhaseTemplate(1),
|
|
145
|
+
onUpdate: temporalPhaseTemplate(2)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Builds a `temporal.<codec>` field preset for a codec with no type
|
|
152
|
+
* parameters (`sqlite/datetime@1`). As with the precision-bearing variant,
|
|
153
|
+
* both phase arguments are optional and omitting one omits that phase.
|
|
154
|
+
*/
|
|
155
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
156
|
+
function temporalCodecPreset(input) {
|
|
157
|
+
return {
|
|
158
|
+
kind: "fieldPreset",
|
|
159
|
+
args: [TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG],
|
|
160
|
+
output: {
|
|
161
|
+
codecId: input.codecId,
|
|
162
|
+
nativeType: input.nativeType,
|
|
163
|
+
executionDefaults: {
|
|
164
|
+
onCreate: temporalPhaseTemplate(0),
|
|
165
|
+
onUpdate: temporalPhaseTemplate(1)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
export { timestampNowControlDescriptor as a, temporalCodecPresetWithPrecision as i, temporalAuthoringPresets as n, temporalCodecPreset as r, TIMESTAMP_NOW_GENERATOR_ID as t };
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map
|