@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":"contract-builder-YjMQcvZ1.mjs","names":["#handle"],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/contract-builder.mjs"],"sourcesContent":["import { n as contractError, t as buildSqlContractFromDefinition } from \"./build-contract-DBCz_YSs.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isColumnDefault } from \"@internal/contract/types\";\nimport { bindEnumType, createEntityHelpersFromNamespace, enumType, isEnumTypeHandle, member } from \"@internal/contract-authoring\";\nimport { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, validateAuthoringHelperArguments } from \"@internal/framework-components/authoring\";\nimport { toStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { providesEntityHandleLowering } from \"@internal/sql-contract/entity-handle-lowering-hook\";\n//#region src/authoring-helper-runtime.ts\nfunction isNamedConstraintOptionsLike(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n\tif (Object.keys(value).some((key) => key !== \"name\")) return false;\n\tconst name = value.name;\n\treturn name === void 0 || typeof name === \"string\";\n}\nconst blockedSegments = /* @__PURE__ */ new Set([\n\t\"__proto__\",\n\t\"constructor\",\n\t\"prototype\"\n]);\nfunction assertSafeHelperKey(key, path) {\n\tif (blockedSegments.has(key)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Invalid authoring helper \"${[...path, key].join(\".\")}\". Helper path segments must not use \"${key}\".`, { meta: {\n\t\thelperPath: [...path, key].join(\".\"),\n\t\tsegment: key\n\t} });\n}\nfunction createTypeHelpersFromNamespace(namespace, path = []) {\n\tconst helpers = {};\n\tfor (const [key, value] of Object.entries(namespace)) {\n\t\tassertSafeHelperKey(key, path);\n\t\tconst currentPath = [...path, key];\n\t\tif (isAuthoringTypeConstructorDescriptor(value)) {\n\t\t\tconst helperPath = currentPath.join(\".\");\n\t\t\thelpers[key] = (...args) => {\n\t\t\t\tvalidateAuthoringHelperArguments(helperPath, value.args, args);\n\t\t\t\tconst triple = instantiateAuthoringTypeConstructor(value, args);\n\t\t\t\treturn toStorageTypeInstance({\n\t\t\t\t\tcodecId: triple.codecId,\n\t\t\t\t\tnativeType: triple.nativeType,\n\t\t\t\t\ttypeParams: triple.typeParams ?? {}\n\t\t\t\t});\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\thelpers[key] = createTypeHelpersFromNamespace(value, currentPath);\n\t}\n\treturn helpers;\n}\nfunction createFieldPresetHelper(options) {\n\treturn (...rawArgs) => {\n\t\tconst acceptsNamedConstraintOptions = options.descriptor.output.id === true || options.descriptor.output.unique === true;\n\t\tconst declaredArguments = options.descriptor.args ?? [];\n\t\tif (acceptsNamedConstraintOptions && rawArgs.length > declaredArguments.length + 1) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${options.helperPath} expects at most ${declaredArguments.length + 1} argument(s), received ${rawArgs.length}`, { meta: {\n\t\t\thelperPath: options.helperPath,\n\t\t\texpected: declaredArguments.length + 1,\n\t\t\treceived: rawArgs.length\n\t\t} });\n\t\tlet args = rawArgs;\n\t\tlet namedConstraintOptions;\n\t\tif (acceptsNamedConstraintOptions && rawArgs.length === declaredArguments.length + 1) {\n\t\t\tconst maybeNamedConstraintOptions = rawArgs.at(-1);\n\t\t\tif (!isNamedConstraintOptionsLike(maybeNamedConstraintOptions)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `${options.helperPath} accepts an optional trailing { name?: string } constraint options object`, { meta: { helperPath: options.helperPath } });\n\t\t\tnamedConstraintOptions = maybeNamedConstraintOptions;\n\t\t\targs = rawArgs.slice(0, -1);\n\t\t}\n\t\tvalidateAuthoringHelperArguments(options.helperPath, options.descriptor.args, args);\n\t\treturn options.build({\n\t\t\targs,\n\t\t\t...namedConstraintOptions ? { namedConstraintOptions } : {}\n\t\t});\n\t};\n}\nfunction createFieldHelpersFromNamespace(namespace, createLeafHelper, path = []) {\n\tconst helpers = {};\n\tfor (const [key, value] of Object.entries(namespace)) {\n\t\tassertSafeHelperKey(key, path);\n\t\tconst currentPath = [...path, key];\n\t\tif (isAuthoringFieldPresetDescriptor(value)) {\n\t\t\thelpers[key] = createLeafHelper({\n\t\t\t\thelperPath: currentPath.join(\".\"),\n\t\t\t\tdescriptor: value\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\thelpers[key] = createFieldHelpersFromNamespace(value, createLeafHelper, currentPath);\n\t}\n\treturn helpers;\n}\n//#endregion\n//#region src/contract-dsl.ts\nfunction toColumnDefault(value) {\n\tif (isColumnDefault(value)) return value;\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue\n\t};\n}\nvar ScalarFieldBuilder = class ScalarFieldBuilder {\n\tstate;\n\tconstructor(state) {\n\t\tthis.state = state;\n\t}\n\t/**\n\t* Returns the physical column name when `.column(name)` was called, or\n\t* `undefined` when the field uses the default (logical field name) mapping.\n\t* Used by cross-space FK lowering to stamp the physical column name onto\n\t* `TargetFieldRef.columnName` so FK target columns are resolved correctly.\n\t*/\n\tget physicalColumnName() {\n\t\treturn this.state.columnName;\n\t}\n\toptional() {\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\tnullable: true\n\t\t}));\n\t}\n\tcolumn(name) {\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\tcolumnName: name\n\t\t}));\n\t}\n\tmany() {\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\tmany: true\n\t\t}));\n\t}\n\tdefault(value) {\n\t\treturn new ScalarFieldBuilder({\n\t\t\t...this.state,\n\t\t\tdefault: toColumnDefault(value)\n\t\t});\n\t}\n\tdefaultSql(expression) {\n\t\treturn new ScalarFieldBuilder({\n\t\t\t...this.state,\n\t\t\tdefault: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression\n\t\t\t}\n\t\t});\n\t}\n\tid(options) {\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\tid: options?.name ? { name: options.name } : {}\n\t\t}));\n\t}\n\tunique(options) {\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\tunique: options?.name ? { name: options.name } : {}\n\t\t}));\n\t}\n\tsql(spec) {\n\t\tconst idSpec = \"id\" in spec ? spec.id : void 0;\n\t\tconst uniqueSpec = \"unique\" in spec ? spec.unique : void 0;\n\t\tif (idSpec && !this.state.id) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"field.sql({ id }) requires an existing inline .id(...) declaration.\");\n\t\tif (uniqueSpec && !this.state.unique) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"field.sql({ unique }) requires an existing inline .unique(...) declaration.\");\n\t\treturn new ScalarFieldBuilder(blindCast({\n\t\t\t...this.state,\n\t\t\t...spec.column ? { columnName: spec.column } : {},\n\t\t\t...idSpec ? { id: { name: idSpec.name } } : {},\n\t\t\t...uniqueSpec ? { unique: { name: uniqueSpec.name } } : {}\n\t\t}));\n\t}\n\tbuild() {\n\t\treturn this.state;\n\t}\n};\nvar EnumScalarFieldBuilder = class EnumScalarFieldBuilder extends ScalarFieldBuilder {\n\t#handle;\n\tconstructor(state, handle) {\n\t\tsuper(state);\n\t\tthis.#handle = handle;\n\t}\n\tdefault(value) {\n\t\treturn blindCast(new EnumScalarFieldBuilder({\n\t\t\t...this.build(),\n\t\t\tdefault: {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue\n\t\t\t}\n\t\t}, this.#handle));\n\t}\n\tdefaultSql(_expression) {\n\t\tthrow contractError(\"CONTRACT.DEFAULT_INVALID\", \"defaultSql is not available on an enum field; use .default(members.X) instead\", { meta: { reason: \"defaultSql-on-enum-field\" } });\n\t}\n};\nfunction columnField(descriptor) {\n\treturn new ScalarFieldBuilder({\n\t\tkind: \"scalar\",\n\t\tdescriptor,\n\t\tnullable: false\n\t});\n}\nfunction generatedField(spec) {\n\treturn new ScalarFieldBuilder({\n\t\tkind: \"scalar\",\n\t\tdescriptor: {\n\t\t\t...spec.type,\n\t\t\t...spec.typeParams ? { typeParams: spec.typeParams } : {}\n\t\t},\n\t\tnullable: false,\n\t\texecutionDefaults: { onCreate: spec.generated }\n\t});\n}\nfunction namedTypeField(typeRef) {\n\tif (isEnumTypeHandle(typeRef)) return new EnumScalarFieldBuilder(blindCast({\n\t\tkind: \"scalar\",\n\t\ttypeRef,\n\t\tnullable: false\n\t}), typeRef);\n\treturn new ScalarFieldBuilder({\n\t\tkind: \"scalar\",\n\t\ttypeRef,\n\t\tnullable: false\n\t});\n}\nfunction buildFieldPreset(descriptor, args, namedConstraintOptions) {\n\tconst preset = instantiateAuthoringFieldPreset(descriptor, args);\n\treturn new ScalarFieldBuilder({\n\t\tkind: \"scalar\",\n\t\tdescriptor: preset.descriptor,\n\t\tnullable: preset.nullable,\n\t\t...ifDefined(\"default\", preset.default),\n\t\t...ifDefined(\"executionDefaults\", preset.executionDefaults),\n\t\t...preset.id ? { id: namedConstraintOptions?.name ? { name: namedConstraintOptions.name } : {} } : {},\n\t\t...preset.unique ? { unique: namedConstraintOptions?.name ? { name: namedConstraintOptions.name } : {} } : {}\n\t});\n}\nvar RelationBuilder = class RelationBuilder {\n\tstate;\n\tconstructor(state) {\n\t\tthis.state = state;\n\t}\n\tsql(spec) {\n\t\tif (this.state.kind !== \"belongsTo\") throw contractError(\"CONTRACT.RELATION_INVALID\", \"relation.sql(...) is only supported for belongsTo relations.\", { meta: { relationKind: this.state.kind } });\n\t\treturn new RelationBuilder({\n\t\t\t...this.state,\n\t\t\tsql: spec\n\t\t});\n\t}\n\tbuild() {\n\t\treturn this.state;\n\t}\n};\nfunction normalizeFieldRefInput(input) {\n\treturn (Array.isArray(input) ? input : [input]).map((ref) => ref.fieldName);\n}\nfunction normalizeTargetFieldRefInput(input) {\n\tconst refs = Array.isArray(input) ? input : [input];\n\tconst [first] = refs;\n\tif (!first) throw contractError(\"CONTRACT.FOREIGN_KEY_INVALID\", \"Expected at least one target ref\", { meta: { reason: \"empty-target-refs\" } });\n\tif (refs.some((ref) => ref.modelName !== first.modelName)) throw contractError(\"CONTRACT.FOREIGN_KEY_INVALID\", \"All target refs in a foreign key must point to the same model\", { meta: {\n\t\tmismatch: \"modelName\",\n\t\tmodels: refs.map((ref) => ref.modelName)\n\t} });\n\tif (refs.some((ref) => ref.spaceId !== first.spaceId)) throw contractError(\"CONTRACT.FOREIGN_KEY_INVALID\", `All target refs in a compound foreign key must share the same spaceId (found mismatch: \"${first.spaceId ?? \"<local>\"}\" vs \"${refs.find((r) => r.spaceId !== first.spaceId)?.spaceId ?? \"<local>\"}\")`, { meta: {\n\t\tmismatch: \"spaceId\",\n\t\tfirst: first.spaceId,\n\t\tsecond: refs.find((r) => r.spaceId !== first.spaceId)?.spaceId\n\t} });\n\tif (refs.some((ref) => ref.namespaceId !== first.namespaceId)) throw contractError(\"CONTRACT.FOREIGN_KEY_INVALID\", \"All target refs in a compound foreign key must share the same namespaceId (found mismatch)\", { meta: { mismatch: \"namespaceId\" } });\n\tif (refs.some((ref) => ref.tableName !== first.tableName)) throw contractError(\"CONTRACT.FOREIGN_KEY_INVALID\", \"All target refs in a compound foreign key must share the same tableName (found mismatch)\", { meta: { mismatch: \"tableName\" } });\n\treturn {\n\t\tmodelName: first.modelName,\n\t\tfieldNames: refs.map((ref) => ref.columnName ?? ref.fieldName),\n\t\tsource: refs.some((ref) => ref.source === \"string\") ? \"string\" : \"token\",\n\t\tspaceId: first.spaceId,\n\t\tnamespaceId: first.namespaceId,\n\t\ttableName: first.tableName\n\t};\n}\nfunction createConstraintsDsl() {\n\tfunction ref(modelName, fieldName) {\n\t\treturn {\n\t\t\tkind: \"targetFieldRef\",\n\t\t\tsource: \"string\",\n\t\t\tmodelName,\n\t\t\tfieldName\n\t\t};\n\t}\n\tfunction id(fieldOrFields, options) {\n\t\treturn {\n\t\t\tkind: \"id\",\n\t\t\tfields: normalizeFieldRefInput(fieldOrFields),\n\t\t\t...options?.name ? { name: options.name } : {}\n\t\t};\n\t}\n\tfunction unique(fieldOrFields, options) {\n\t\treturn {\n\t\t\tkind: \"unique\",\n\t\t\tfields: normalizeFieldRefInput(fieldOrFields),\n\t\t\t...options?.name ? { name: options.name } : {}\n\t\t};\n\t}\n\tfunction index(fieldsOrOptions, options) {\n\t\tconst isExpressionForm = !Array.isArray(fieldsOrOptions) && typeof fieldsOrOptions === \"object\" && \"expression\" in fieldsOrOptions;\n\t\tconst opts = isExpressionForm ? fieldsOrOptions : options;\n\t\tconst carried = {\n\t\t\tkind: \"index\",\n\t\t\t...opts?.name !== void 0 ? { name: opts.name } : {},\n\t\t\t...opts?.map !== void 0 ? { map: opts.map } : {},\n\t\t\t...opts?.where !== void 0 ? { where: opts.where } : {},\n\t\t\t...opts?.unique !== void 0 ? { unique: opts.unique } : {},\n\t\t\t...opts?.type !== void 0 ? { type: opts.type } : {},\n\t\t\t...opts?.options !== void 0 ? { options: blindCast(opts.options) } : {}\n\t\t};\n\t\treturn isExpressionForm ? {\n\t\t\t...carried,\n\t\t\texpression: fieldsOrOptions.expression\n\t\t} : {\n\t\t\t...carried,\n\t\t\tfields: normalizeFieldRefInput(fieldsOrOptions)\n\t\t};\n\t}\n\tfunction foreignKey(fieldOrFields, target, options) {\n\t\tconst normalizedTarget = normalizeTargetFieldRefInput(target);\n\t\treturn {\n\t\t\tkind: \"fk\",\n\t\t\tfields: normalizeFieldRefInput(fieldOrFields),\n\t\t\ttargetModel: normalizedTarget.modelName,\n\t\t\ttargetFields: normalizedTarget.fieldNames,\n\t\t\ttargetSource: normalizedTarget.source,\n\t\t\t...normalizedTarget.spaceId !== void 0 ? { targetSpaceId: normalizedTarget.spaceId } : {},\n\t\t\t...normalizedTarget.namespaceId !== void 0 ? { targetNamespaceId: normalizedTarget.namespaceId } : {},\n\t\t\t...normalizedTarget.tableName !== void 0 ? { targetTableName: normalizedTarget.tableName } : {},\n\t\t\t...options?.name ? { name: options.name } : {},\n\t\t\t...options?.onDelete ? { onDelete: options.onDelete } : {},\n\t\t\t...options?.onUpdate ? { onUpdate: options.onUpdate } : {},\n\t\t\t...options?.constraint !== void 0 ? { constraint: options.constraint } : {},\n\t\t\t...options?.index !== void 0 ? { index: options.index } : {}\n\t\t};\n\t}\n\treturn {\n\t\tref,\n\t\tid,\n\t\tunique,\n\t\tindex,\n\t\tforeignKey\n\t};\n}\nfunction createFieldRefs(fields) {\n\tconst refs = {};\n\tfor (const fieldName of Object.keys(fields)) refs[fieldName] = {\n\t\tkind: \"columnRef\",\n\t\tfieldName\n\t};\n\treturn refs;\n}\nfunction createModelTokenRefs(modelName, fields, crossSpaceCoordinate) {\n\tconst refs = {};\n\tfor (const [fieldName, fieldBuilder] of Object.entries(fields)) {\n\t\tconst physicalColumn = crossSpaceCoordinate !== void 0 ? fieldBuilder.physicalColumnName : void 0;\n\t\trefs[fieldName] = {\n\t\t\tkind: \"targetFieldRef\",\n\t\t\tsource: \"token\",\n\t\t\tmodelName,\n\t\t\tfieldName,\n\t\t\t...crossSpaceCoordinate !== void 0 ? {\n\t\t\t\tspaceId: crossSpaceCoordinate.spaceId,\n\t\t\t\t...crossSpaceCoordinate.namespaceId !== void 0 ? { namespaceId: crossSpaceCoordinate.namespaceId } : {},\n\t\t\t\t...crossSpaceCoordinate.tableName !== void 0 ? { tableName: crossSpaceCoordinate.tableName } : {},\n\t\t\t\t...physicalColumn !== void 0 ? { columnName: physicalColumn } : {}\n\t\t\t} : {}\n\t\t};\n\t}\n\treturn refs;\n}\nfunction buildStageSpec(stageInput, context) {\n\tif (typeof stageInput === \"function\") return stageInput(context);\n\treturn stageInput;\n}\nfunction createAttributeConstraintsDsl() {\n\tconst constraints = createConstraintsDsl();\n\treturn {\n\t\tid: constraints.id,\n\t\tunique: constraints.unique\n\t};\n}\nfunction createSqlConstraintsDsl() {\n\tconst constraints = createConstraintsDsl();\n\treturn {\n\t\tindex: constraints.index,\n\t\tforeignKey: constraints.foreignKey,\n\t\tref: constraints.ref\n\t};\n}\nfunction createColumnRefs(fields) {\n\treturn createFieldRefs(fields);\n}\nfunction findDuplicateRelationName(existingRelations, nextRelations) {\n\treturn Object.keys(nextRelations).find((relationName) => Object.hasOwn(existingRelations, relationName));\n}\nvar ContractModelBuilder = class ContractModelBuilder {\n\tstageOne;\n\tattributesFactory;\n\tsqlFactory;\n\tspaceId;\n\ttableName;\n\trefs;\n\tconstructor(stageOne, attributesFactory, sqlFactory, spaceId, tableName) {\n\t\tthis.stageOne = stageOne;\n\t\tthis.attributesFactory = attributesFactory;\n\t\tthis.sqlFactory = sqlFactory;\n\t\tthis.spaceId = spaceId;\n\t\tthis.tableName = tableName;\n\t\tconst crossSpaceCoordinate = spaceId !== void 0 ? {\n\t\t\tspaceId,\n\t\t\t...stageOne.namespace !== void 0 ? { namespaceId: stageOne.namespace } : {},\n\t\t\t...tableName !== void 0 ? { tableName } : {}\n\t\t} : void 0;\n\t\tthis.refs = blindCast(stageOne.modelName ? createModelTokenRefs(stageOne.modelName, stageOne.fields, crossSpaceCoordinate) : void 0);\n\t}\n\tref(fieldName) {\n\t\tconst modelName = this.stageOne.modelName;\n\t\tif (!modelName) throw contractError(\"CONTRACT.MODEL_TOKEN_INVALID\", \"Model tokens require model(\\\"ModelName\\\", ...) before calling .ref(...)\");\n\t\treturn {\n\t\t\tkind: \"targetFieldRef\",\n\t\t\tsource: \"token\",\n\t\t\tmodelName,\n\t\t\tfieldName\n\t\t};\n\t}\n\trelations(relations) {\n\t\tconst duplicateRelationName = findDuplicateRelationName(this.stageOne.relations, relations);\n\t\tif (duplicateRelationName) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Model \"${this.stageOne.modelName ?? \"<anonymous>\"}\" already defines relation \"${duplicateRelationName}\".`, { meta: {\n\t\t\tkind: \"relation\",\n\t\t\tname: duplicateRelationName,\n\t\t\tmodelName: this.stageOne.modelName\n\t\t} });\n\t\treturn new ContractModelBuilder({\n\t\t\t...this.stageOne,\n\t\t\trelations: {\n\t\t\t\t...this.stageOne.relations,\n\t\t\t\t...relations\n\t\t\t}\n\t\t}, this.attributesFactory, this.sqlFactory, this.spaceId, this.tableName);\n\t}\n\tattributes(specOrFactory) {\n\t\treturn new ContractModelBuilder(this.stageOne, specOrFactory, this.sqlFactory, this.spaceId, this.tableName);\n\t}\n\tsql(specOrFactory) {\n\t\tconst nextTableName = typeof specOrFactory !== \"function\" ? specOrFactory.table : this.tableName;\n\t\treturn blindCast(new ContractModelBuilder(this.stageOne, this.attributesFactory, specOrFactory, this.spaceId, nextTableName));\n\t}\n\tbuildAttributesSpec() {\n\t\tif (!this.attributesFactory) return;\n\t\treturn buildStageSpec(this.attributesFactory, {\n\t\t\tfields: createFieldRefs(this.stageOne.fields),\n\t\t\tconstraints: createAttributeConstraintsDsl()\n\t\t});\n\t}\n\tbuildSqlSpec() {\n\t\tif (!this.sqlFactory) return;\n\t\treturn buildStageSpec(this.sqlFactory, {\n\t\t\tcols: createColumnRefs(this.stageOne.fields),\n\t\t\tconstraints: createSqlConstraintsDsl()\n\t\t});\n\t}\n};\nfunction isLazyRelationModelName(value) {\n\treturn typeof value === \"object\" && value !== null && \"kind\" in value && value.kind === \"lazyRelationModelName\" && \"resolve\" in value && typeof value.resolve === \"function\";\n}\nfunction resolveNamedModelTokenName(token) {\n\tconst modelName = token.stageOne.modelName;\n\tif (!modelName) throw contractError(\"CONTRACT.MODEL_TOKEN_INVALID\", \"Relation targets require named model tokens. Use model(\\\"ModelName\\\", ...) before passing a token to rel.*(...).\");\n\treturn modelName;\n}\nfunction normalizeRelationModelSource(target) {\n\tif (typeof target === \"string\") return {\n\t\tkind: \"relationModelName\",\n\t\tsource: \"string\",\n\t\tmodelName: target\n\t};\n\tif (typeof target === \"function\") return {\n\t\tkind: \"lazyRelationModelName\",\n\t\tsource: \"lazyToken\",\n\t\tresolve: () => resolveNamedModelTokenName(target())\n\t};\n\treturn {\n\t\tkind: \"relationModelName\",\n\t\tsource: \"token\",\n\t\tmodelName: resolveNamedModelTokenName(target)\n\t};\n}\nfunction model(modelNameOrInput, maybeInput) {\n\tconst input = typeof modelNameOrInput === \"string\" ? maybeInput : modelNameOrInput;\n\tif (!input) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"model(\\\"ModelName\\\", ...) requires a model definition.\");\n\treturn new ContractModelBuilder({\n\t\t...typeof modelNameOrInput === \"string\" ? { modelName: modelNameOrInput } : {},\n\t\t...input.namespace !== void 0 ? { namespace: input.namespace } : {},\n\t\tfields: input.fields,\n\t\trelations: input.relations ?? {}\n\t});\n}\n/**\n* Factory for building a standalone branded extension model handle.\n*\n* Use this instead of `new ContractModelBuilder(…)` when constructing handles\n* for models that live in a foreign contract space (e.g. a Supabase extension\n* model referenced by a user's contract). The `spaceId` brands the returned\n* handle so `refs.<field>.spaceId` carries the foreign space identifier.\n*\n* @param name - The domain model name as declared in the foreign contract\n* (e.g. `'AuthUser'`, not a bare table alias like `'User'`).\n* @param input.namespace - The namespace within the foreign space (e.g. `'auth'`).\n* @param input.fields - Field definitions (use `field.column(…)`).\n* @param input.table - The physical table name in the foreign schema.\n* @param spaceId - The extension space identifier (e.g. `'supabase'`).\n*/\nfunction extensionModel(name, input, spaceId) {\n\treturn new ContractModelBuilder({\n\t\tmodelName: name,\n\t\tnamespace: input.namespace,\n\t\tfields: input.fields,\n\t\trelations: {}\n\t}, void 0, void 0, spaceId, input.table);\n}\nfunction isCrossSpaceHandle(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst rec = blindCast(value);\n\treturn typeof rec[\"spaceId\"] === \"string\" && typeof rec[\"stageOne\"] === \"object\" && rec[\"stageOne\"] !== null;\n}\nfunction belongsTo(toModel, options) {\n\tconst resolvedModel = typeof toModel === \"function\" ? toModel() : toModel;\n\tconst crossSpaceCoordinate = isCrossSpaceHandle(resolvedModel) ? {\n\t\tspaceId: resolvedModel.spaceId,\n\t\t...resolvedModel.tableName !== void 0 ? { tableName: resolvedModel.tableName } : {},\n\t\t...resolvedModel.stageOne.namespace !== void 0 ? { namespaceId: resolvedModel.stageOne.namespace } : {}\n\t} : void 0;\n\treturn new RelationBuilder({\n\t\tkind: \"belongsTo\",\n\t\ttoModel: normalizeRelationModelSource(toModel),\n\t\tfrom: options.from,\n\t\tto: options.to,\n\t\t...crossSpaceCoordinate !== void 0 ? crossSpaceCoordinate : {}\n\t});\n}\nfunction hasMany(toModel, options) {\n\treturn new RelationBuilder({\n\t\tkind: \"hasMany\",\n\t\ttoModel: normalizeRelationModelSource(toModel),\n\t\tby: options.by\n\t});\n}\nfunction hasOne(toModel, options) {\n\treturn new RelationBuilder({\n\t\tkind: \"hasOne\",\n\t\ttoModel: normalizeRelationModelSource(toModel),\n\t\tby: options.by\n\t});\n}\nfunction manyToMany(toModel, options) {\n\treturn new RelationBuilder({\n\t\tkind: \"manyToMany\",\n\t\ttoModel: normalizeRelationModelSource(toModel),\n\t\tthrough: normalizeRelationModelSource(options.through),\n\t\tfrom: options.from,\n\t\tto: options.to\n\t});\n}\nconst rel = {\n\tbelongsTo,\n\thasMany,\n\thasOne,\n\tmanyToMany\n};\nconst field = {\n\tcolumn: columnField,\n\tgenerated: generatedField,\n\tnamedType: namedTypeField\n};\nfunction isContractInput(value) {\n\tif (typeof value !== \"object\" || value === null || !(\"target\" in value) || !(\"family\" in value)) return false;\n\tconst target = value.target;\n\tconst family = value.family;\n\treturn typeof target === \"object\" && target !== null && \"kind\" in target && target.kind === \"target\" && typeof family === \"object\" && family !== null && \"kind\" in family && family.kind === \"family\";\n}\nfunction isRelationFieldArray(value) {\n\treturn Array.isArray(value);\n}\nfunction normalizeRelationFieldNames(value) {\n\tif (isRelationFieldArray(value)) return value;\n\treturn [value];\n}\nfunction resolveRelationModelName(value) {\n\tif (isLazyRelationModelName(value)) return value.resolve();\n\treturn value.modelName;\n}\nfunction applyNaming(name, strategy) {\n\tif (!strategy || strategy === \"identity\") return name;\n\tlet result = \"\";\n\tfor (let index = 0; index < name.length; index += 1) {\n\t\tconst char = name[index];\n\t\tif (!char) continue;\n\t\tconst lower = char.toLowerCase();\n\t\tif (char !== lower && index > 0) {\n\t\t\tconst prev = name[index - 1];\n\t\t\tconst next = name[index + 1];\n\t\t\tconst prevIsLower = !!prev && prev === prev.toLowerCase();\n\t\t\tconst nextIsLower = !!next && next === next.toLowerCase();\n\t\t\tif (prevIsLower || nextIsLower) result += \"_\";\n\t\t}\n\t\tresult += lower;\n\t}\n\treturn result;\n}\n//#endregion\n//#region src/composed-authoring-helpers.ts\nfunction extractTypeNamespace(pack) {\n\treturn pack.authoring?.type ?? {};\n}\nfunction extractFieldNamespace(pack) {\n\treturn pack.authoring?.field ?? {};\n}\nfunction extractEntitiesNamespace(pack) {\n\treturn pack.authoring?.entityTypes ?? {};\n}\nfunction composeTypeNamespace(components) {\n\tconst merged = {};\n\tfor (const component of components) {\n\t\tconst ns = extractTypeNamespace(component);\n\t\tif (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], \"typeConstructor\", \"type\");\n\t}\n\treturn merged;\n}\nfunction composeFieldNamespace(components) {\n\tconst merged = {};\n\tfor (const component of components) {\n\t\tconst ns = extractFieldNamespace(component);\n\t\tif (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], \"fieldPreset\", \"field\");\n\t}\n\treturn merged;\n}\nfunction composeEntityNamespace(components) {\n\tconst merged = {};\n\tfor (const component of components) {\n\t\tconst ns = extractEntitiesNamespace(component);\n\t\tif (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], \"entity\", \"entity\");\n\t}\n\treturn merged;\n}\n/**\n* Reserved top-level keys on the composed helpers surface — the\n* built-in `model` / `rel` helpers, the `field` / `type` namespace\n* objects. Pack-contributed entity types are flattened to the same\n* top-level shape (e.g. `helpers.enum({...})`), so a pack cannot\n* contribute an entity type whose name collides with one of these\n* reserved keys without silently overwriting at runtime. Detect the\n* collision at compose time and fail loudly with a guidance message.\n*/\nconst RESERVED_HELPER_KEYS = [\n\t\"field\",\n\t\"model\",\n\t\"rel\",\n\t\"type\"\n];\nfunction assertNoBuiltInEntityCollisions(namespace) {\n\tconst collisions = Object.keys(namespace).filter((name) => RESERVED_HELPER_KEYS.includes(name));\n\tif (collisions.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack-contributed entity type(s) ${collisions.map((c) => `\"${c}\"`).join(\", \")} collide with the reserved built-in helper key(s) on the composed helpers surface. Reserved keys: ${RESERVED_HELPER_KEYS.map((k) => `\"${k}\"`).join(\", \")}.`, { meta: {\n\t\tcollisions,\n\t\treservedKeys: RESERVED_HELPER_KEYS\n\t} });\n}\nfunction createComposedFieldHelpers(fieldNamespace) {\n\tconst helperNamespace = createFieldHelpersFromNamespace(fieldNamespace, ({ helperPath, descriptor }) => createFieldPresetHelper({\n\t\thelperPath,\n\t\tdescriptor,\n\t\tbuild: ({ args, namedConstraintOptions }) => buildFieldPreset(descriptor, args, namedConstraintOptions)\n\t}));\n\tconst coreFieldHelpers = {\n\t\tcolumn: field.column,\n\t\tgenerated: field.generated,\n\t\tnamedType: field.namedType\n\t};\n\tconst coreHelperNames = new Set(Object.keys(coreFieldHelpers));\n\tfor (const helperName of Object.keys(helperNamespace)) if (coreHelperNames.has(helperName)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Duplicate authoring field helper \"${helperName}\". Core field helpers reserve that name.`, { meta: { helperName } });\n\treturn {\n\t\t...coreFieldHelpers,\n\t\t...helperNamespace\n\t};\n}\nfunction createComposedAuthoringHelpers(options) {\n\tconst extensionValues = Object.values(options.extensions ?? {});\n\tconst components = [\n\t\toptions.family,\n\t\toptions.target,\n\t\t...extensionValues\n\t];\n\tconst typeNamespace = composeTypeNamespace(components);\n\tconst fieldNamespace = composeFieldNamespace(components);\n\tconst entityNamespace = composeEntityNamespace(components);\n\tassertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityNamespace);\n\tassertNoBuiltInEntityCollisions(entityNamespace);\n\treturn {\n\t\t...createEntityHelpersFromNamespace(entityNamespace, { ctx: {\n\t\t\tfamily: options.family.familyId,\n\t\t\ttarget: options.target.targetId\n\t\t} }),\n\t\tfield: createComposedFieldHelpers(fieldNamespace),\n\t\tmodel,\n\t\trel,\n\t\ttype: createTypeHelpersFromNamespace(typeNamespace)\n\t};\n}\n//#endregion\n//#region src/contract-warnings.ts\nfunction hasNamedModelToken(models, modelName) {\n\treturn models[modelName]?.stageOne.modelName === modelName;\n}\nfunction formatFieldSelection(fieldNames) {\n\tif (fieldNames.length === 1) return `'${fieldNames[0]}'`;\n\treturn `[${fieldNames.map((fieldName) => `'${fieldName}'`).join(\", \")}]`;\n}\nfunction formatTokenFieldSelection(modelName, fieldNames) {\n\tif (fieldNames.length === 1) return `${modelName}.refs.${fieldNames[0]}`;\n\treturn `[${fieldNames.map((fieldName) => `${modelName}.refs.${fieldName}`).join(\", \")}]`;\n}\nfunction formatConstraintsRefCall(modelName, fieldNames) {\n\tif (fieldNames.length === 1) return `constraints.ref('${modelName}', '${fieldNames[0]}')`;\n\treturn `[${fieldNames.map((fieldName) => `constraints.ref('${modelName}', '${fieldName}')`).join(\", \")}]`;\n}\nfunction formatRelationModelDisplay(relationModel) {\n\tif (relationModel.kind === \"lazyRelationModelName\") return `() => ${relationModel.resolve()}`;\n\treturn relationModel.source === \"string\" ? `'${relationModel.modelName}'` : relationModel.modelName;\n}\nfunction formatRelationCall(relation, targetModelDisplay) {\n\tif (relation.kind === \"belongsTo\") return `rel.belongsTo(${targetModelDisplay}, { from: ${formatFieldSelection(normalizeRelationFieldNames(relation.from))}, to: ${formatFieldSelection(normalizeRelationFieldNames(relation.to))} })`;\n\tif (relation.kind === \"hasMany\" || relation.kind === \"hasOne\") {\n\t\tconst by = formatFieldSelection(normalizeRelationFieldNames(relation.by));\n\t\treturn `rel.${relation.kind}(${targetModelDisplay}, { by: ${by} })`;\n\t}\n\treturn `rel.manyToMany(${targetModelDisplay}, { through: ${formatRelationModelDisplay(relation.through)}, from: ${formatFieldSelection(normalizeRelationFieldNames(relation.from))}, to: ${formatFieldSelection(normalizeRelationFieldNames(relation.to))} })`;\n}\nfunction formatManyToManyCallWithThrough(relation, throughDisplay) {\n\treturn `rel.manyToMany(${formatRelationModelDisplay(relation.toModel)}, { through: ${throughDisplay}, from: ${formatFieldSelection(normalizeRelationFieldNames(relation.from))}, to: ${formatFieldSelection(normalizeRelationFieldNames(relation.to))} })`;\n}\nconst WARNING_BATCH_THRESHOLD = 5;\nfunction flushWarnings(warnings) {\n\tif (warnings.length === 0) return;\n\tif (warnings.length <= WARNING_BATCH_THRESHOLD) {\n\t\tfor (const message of warnings) process.emitWarning(message, { code: \"PN_CONTRACT_TYPED_FALLBACK_AVAILABLE\" });\n\t\treturn;\n\t}\n\tprocess.emitWarning(`${warnings.length} contract references use string fallbacks where typed alternatives are available. Use named model tokens and typed storage type refs for autocomplete and type safety.\n` + warnings.map((w) => ` - ${w}`).join(\"\\n\"), { code: \"PN_CONTRACT_TYPED_FALLBACK_AVAILABLE\" });\n}\nfunction formatFallbackWarning(location, current, suggested) {\n\treturn `Contract ${location} uses ${current}. Use ${suggested} when the named model token is available in the same contract to keep typed relation targets and model refs.`;\n}\nfunction emitTypedNamedTypeFallbackWarnings(models, storageTypes) {\n\tconst warnings = [];\n\tconst warnedFields = /* @__PURE__ */ new Set();\n\tfor (const [modelName, modelDefinition] of Object.entries(models)) for (const [fieldName, fieldBuilder] of Object.entries(modelDefinition.stageOne.fields)) {\n\t\tconst fieldState = fieldBuilder.build();\n\t\tif (typeof fieldState.typeRef !== \"string\" || !(fieldState.typeRef in storageTypes)) continue;\n\t\tconst warningKey = `${modelName}.${fieldName}`;\n\t\tif (warnedFields.has(warningKey)) continue;\n\t\twarnedFields.add(warningKey);\n\t\twarnings.push(`Contract field \"${modelName}.${fieldName}\" uses field.namedType('${fieldState.typeRef}'). Use field.namedType(types.${fieldState.typeRef}) when the storage type is declared in the same contract to keep autocomplete and typed local refs.`);\n\t}\n\tflushWarnings(warnings);\n}\nfunction emitTypedCrossModelFallbackWarnings(collection) {\n\tconst warnings = [];\n\tconst warnedKeys = /* @__PURE__ */ new Set();\n\tfor (const spec of collection.modelSpecs.values()) {\n\t\tfor (const [relationName, relationBuilder] of Object.entries(spec.relations)) {\n\t\t\tconst relation = relationBuilder.build();\n\t\t\tif (relation.toModel.kind === \"relationModelName\" && relation.toModel.source === \"string\" && hasNamedModelToken(collection.models, relation.toModel.modelName)) {\n\t\t\t\tconst warningKey = `${spec.modelName}.${relationName}.toModel`;\n\t\t\t\tif (!warnedKeys.has(warningKey)) {\n\t\t\t\t\twarnedKeys.add(warningKey);\n\t\t\t\t\tconst current = formatRelationCall(relation, `'${relation.toModel.modelName}'`);\n\t\t\t\t\tconst suggested = formatRelationCall(relation, relation.toModel.modelName);\n\t\t\t\t\twarnings.push(formatFallbackWarning(`relation \"${spec.modelName}.${relationName}\"`, current, suggested));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (relation.kind === \"manyToMany\" && relation.through.kind === \"relationModelName\" && relation.through.source === \"string\" && hasNamedModelToken(collection.models, relation.through.modelName)) {\n\t\t\t\tconst warningKey = `${spec.modelName}.${relationName}.through`;\n\t\t\t\tif (!warnedKeys.has(warningKey)) {\n\t\t\t\t\twarnedKeys.add(warningKey);\n\t\t\t\t\tconst current = formatManyToManyCallWithThrough(relation, `'${relation.through.modelName}'`);\n\t\t\t\t\tconst suggested = formatManyToManyCallWithThrough(relation, relation.through.modelName);\n\t\t\t\t\twarnings.push(formatFallbackWarning(`relation \"${spec.modelName}.${relationName}\"`, current, suggested));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const [foreignKeyIndex, foreignKey] of (spec.sqlSpec?.foreignKeys ?? []).entries()) {\n\t\t\tif (foreignKey.targetSource !== \"string\" || !hasNamedModelToken(collection.models, foreignKey.targetModel)) continue;\n\t\t\tconst warningKey = `${spec.modelName}.sql.foreignKeys.${foreignKeyIndex}`;\n\t\t\tif (warnedKeys.has(warningKey)) continue;\n\t\t\twarnedKeys.add(warningKey);\n\t\t\tconst current = formatConstraintsRefCall(foreignKey.targetModel, foreignKey.targetFields);\n\t\t\tconst suggested = formatTokenFieldSelection(foreignKey.targetModel, foreignKey.targetFields);\n\t\t\twarnings.push(formatFallbackWarning(`model \"${spec.modelName}\"`, `${current} in .sql(...)`, suggested));\n\t\t}\n\t}\n\tflushWarnings(warnings);\n}\n//#endregion\n//#region src/contract-lowering.ts\nfunction buildStorageTypeReverseLookup(storageTypes) {\n\tconst lookup = /* @__PURE__ */ new Map();\n\tfor (const [key, instance] of Object.entries(storageTypes)) lookup.set(instance, key);\n\treturn lookup;\n}\nfunction resolveFieldDescriptor(modelName, fieldName, fieldState, storageTypes, storageTypeReverseLookup) {\n\tif (\"descriptor\" in fieldState && fieldState.descriptor) return fieldState.descriptor;\n\tif (\"typeRef\" in fieldState && fieldState.typeRef) {\n\t\tif (isEnumTypeHandle(fieldState.typeRef)) return {\n\t\t\tcodecId: fieldState.typeRef.codecId,\n\t\t\tnativeType: fieldState.typeRef.nativeType\n\t\t};\n\t\tconst typeRef = typeof fieldState.typeRef === \"string\" ? fieldState.typeRef : storageTypeReverseLookup.get(fieldState.typeRef);\n\t\tif (!typeRef) throw contractError(\"CONTRACT.TYPE_UNKNOWN\", `Field \"${modelName}.${fieldName}\" references a storage type instance that is not present in definition.types`, { meta: {\n\t\t\tmodelName,\n\t\t\tfieldName,\n\t\t\treason: \"instance-not-in-definition-types\"\n\t\t} });\n\t\tconst referencedType = storageTypes[typeRef];\n\t\tif (!referencedType) throw contractError(\"CONTRACT.TYPE_UNKNOWN\", `Field \"${modelName}.${fieldName}\" references unknown storage type \"${typeRef}\"`, { meta: {\n\t\t\tmodelName,\n\t\t\tfieldName,\n\t\t\ttypeRef\n\t\t} });\n\t\treturn {\n\t\t\tcodecId: referencedType.codecId,\n\t\t\tnativeType: referencedType.nativeType,\n\t\t\ttypeRef\n\t\t};\n\t}\n\tthrow contractError(\"CONTRACT.TYPE_UNKNOWN\", `Field \"${modelName}.${fieldName}\" does not resolve to a storage descriptor`, { meta: {\n\t\tmodelName,\n\t\tfieldName,\n\t\treason: \"unresolved-storage-descriptor\"\n\t} });\n}\nfunction mapFieldNamesToColumnNames(modelName, fieldNames, fieldToColumn) {\n\treturn fieldNames.map((fieldName) => {\n\t\tconst columnName = fieldToColumn[fieldName];\n\t\tif (!columnName) throw contractError(\"CONTRACT.FIELD_UNKNOWN\", `Unknown field \"${modelName}.${fieldName}\" in contract definition`, { meta: {\n\t\t\tmodelName,\n\t\t\tfieldName\n\t\t} });\n\t\treturn columnName;\n\t});\n}\nfunction assertRelationFieldArity(params) {\n\tif (params.leftFields.length === params.rightFields.length) return;\n\tthrow contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${params.modelName}.${params.relationName}\" maps ${params.leftFields.length} ${params.leftLabel} field(s) to ${params.rightFields.length} ${params.rightLabel} field(s).`, { meta: {\n\t\tmodelName: params.modelName,\n\t\trelationName: params.relationName,\n\t\treason: \"field-count-mismatch\"\n\t} });\n}\nfunction resolveInlineIdConstraint(spec) {\n\tconst inlineIdFields = [];\n\tlet idName;\n\tfor (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) {\n\t\tconst fieldState = fieldBuilder.build();\n\t\tif (!fieldState.id) continue;\n\t\tinlineIdFields.push(fieldName);\n\t\tif (fieldState.id.name) idName = fieldState.id.name;\n\t}\n\tif (inlineIdFields.length === 0) return;\n\tif (inlineIdFields.length > 1) throw contractError(\"CONTRACT.IDENTITY_INVALID\", `Model \"${spec.modelName}\" marks multiple fields with .id(). Use .attributes(...) for compound identities.`, { meta: {\n\t\tmodelName: spec.modelName,\n\t\treason: \"multiple-inline-ids\",\n\t\tfields: inlineIdFields\n\t} });\n\tconst [inlineIdField] = inlineIdFields;\n\tif (!inlineIdField) return;\n\treturn {\n\t\tkind: \"id\",\n\t\tfields: [inlineIdField],\n\t\t...idName ? { name: idName } : {}\n\t};\n}\nfunction collectInlineUniqueConstraints(spec) {\n\tconst constraints = [];\n\tfor (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) {\n\t\tconst fieldState = fieldBuilder.build();\n\t\tif (!fieldState.unique) continue;\n\t\tconstraints.push({\n\t\t\tkind: \"unique\",\n\t\t\tfields: [fieldName],\n\t\t\t...fieldState.unique.name ? { name: fieldState.unique.name } : {}\n\t\t});\n\t}\n\treturn constraints;\n}\nfunction resolveModelIdConstraint(spec) {\n\tconst inlineId = resolveInlineIdConstraint(spec);\n\tconst attributeId = spec.attributesSpec?.id;\n\tif (inlineId && attributeId) throw contractError(\"CONTRACT.IDENTITY_INVALID\", `Model \"${spec.modelName}\" defines identity both inline and in .attributes(...). Pick one identity style.`, { meta: {\n\t\tmodelName: spec.modelName,\n\t\treason: \"inline-and-attributes\"\n\t} });\n\tconst resolvedId = attributeId ?? inlineId;\n\tif (resolvedId && resolvedId.fields.length === 0) throw contractError(\"CONTRACT.IDENTITY_INVALID\", `Model \"${spec.modelName}\" defines an empty identity. Add at least one field.`, { meta: {\n\t\tmodelName: spec.modelName,\n\t\treason: \"empty-identity\"\n\t} });\n\treturn resolvedId;\n}\nfunction resolveModelUniqueConstraints(spec) {\n\tconst attributeUniques = spec.attributesSpec?.uniques ?? [];\n\tfor (const unique of attributeUniques) if (unique.fields.length === 0) throw contractError(\"CONTRACT.CONSTRAINT_INVALID\", `Model \"${spec.modelName}\" defines an empty unique constraint. Add at least one field.`, { meta: { modelName: spec.modelName } });\n\treturn [...collectInlineUniqueConstraints(spec), ...attributeUniques];\n}\nfunction resolveRelationForeignKeys(spec, allSpecs) {\n\tconst foreignKeys = [];\n\tfor (const [relationName, relationBuilder] of Object.entries(spec.relations)) {\n\t\tconst relation = relationBuilder.build();\n\t\tif (relation.kind !== \"belongsTo\" || !relation.sql?.fk) continue;\n\t\tconst targetModelName = resolveRelationModelName(relation.toModel);\n\t\tif (relation.spaceId !== void 0) {\n\t\t\tconst fields = normalizeRelationFieldNames(relation.from);\n\t\t\tconst targetFields = normalizeRelationFieldNames(relation.to);\n\t\t\tassertRelationFieldArity({\n\t\t\t\tmodelName: spec.modelName,\n\t\t\t\trelationName,\n\t\t\t\tleftLabel: \"source\",\n\t\t\t\tleftFields: fields,\n\t\t\t\trightLabel: \"target\",\n\t\t\t\trightFields: targetFields\n\t\t\t});\n\t\t\tforeignKeys.push({\n\t\t\t\tkind: \"fk\",\n\t\t\t\tfields,\n\t\t\t\ttargetModel: targetModelName,\n\t\t\t\ttargetFields,\n\t\t\t\ttargetSpaceId: relation.spaceId,\n\t\t\t\t...relation.namespaceId !== void 0 ? { targetNamespaceId: relation.namespaceId } : {},\n\t\t\t\t...relation.tableName !== void 0 ? { targetTableName: relation.tableName } : {},\n\t\t\t\t...relation.sql.fk.name ? { name: relation.sql.fk.name } : {},\n\t\t\t\t...relation.sql.fk.onDelete ? { onDelete: relation.sql.fk.onDelete } : {},\n\t\t\t\t...relation.sql.fk.onUpdate ? { onUpdate: relation.sql.fk.onUpdate } : {},\n\t\t\t\t...relation.sql.fk.constraint !== void 0 ? { constraint: relation.sql.fk.constraint } : {},\n\t\t\t\t...relation.sql.fk.index !== void 0 ? { index: relation.sql.fk.index } : {}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!allSpecs.has(targetModelName)) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Relation \"${spec.modelName}.${relationName}\" references unknown model \"${targetModelName}\"`, { meta: {\n\t\t\tsourceModel: spec.modelName,\n\t\t\trelationName,\n\t\t\ttargetModel: targetModelName\n\t\t} });\n\t\tconst fields = normalizeRelationFieldNames(relation.from);\n\t\tconst targetFields = normalizeRelationFieldNames(relation.to);\n\t\tassertRelationFieldArity({\n\t\t\tmodelName: spec.modelName,\n\t\t\trelationName,\n\t\t\tleftLabel: \"source\",\n\t\t\tleftFields: fields,\n\t\t\trightLabel: \"target\",\n\t\t\trightFields: targetFields\n\t\t});\n\t\tforeignKeys.push({\n\t\t\tkind: \"fk\",\n\t\t\tfields,\n\t\t\ttargetModel: targetModelName,\n\t\t\ttargetFields,\n\t\t\t...relation.sql.fk.name ? { name: relation.sql.fk.name } : {},\n\t\t\t...relation.sql.fk.onDelete ? { onDelete: relation.sql.fk.onDelete } : {},\n\t\t\t...relation.sql.fk.onUpdate ? { onUpdate: relation.sql.fk.onUpdate } : {},\n\t\t\t...relation.sql.fk.constraint !== void 0 ? { constraint: relation.sql.fk.constraint } : {},\n\t\t\t...relation.sql.fk.index !== void 0 ? { index: relation.sql.fk.index } : {}\n\t\t});\n\t}\n\treturn foreignKeys;\n}\nfunction resolveRelationAnchorFields(spec) {\n\tconst idFields = spec.idConstraint?.fields;\n\tif (idFields && idFields.length > 0) return idFields;\n\tif (\"id\" in spec.fieldToColumn) return [\"id\"];\n\tthrow contractError(\"CONTRACT.IDENTITY_INVALID\", `Model \"${spec.modelName}\" needs an explicit id or an \"id\" field to anchor non-owning relations`, { meta: {\n\t\tmodelName: spec.modelName,\n\t\treason: \"missing-anchor-id\"\n\t} });\n}\nfunction lowerBelongsToRelation(relationName, relation, currentSpec, allSpecs, extensions) {\n\tconst targetModelName = resolveRelationModelName(relation.toModel);\n\tconst fromFields = normalizeRelationFieldNames(relation.from);\n\tconst toFields = normalizeRelationFieldNames(relation.to);\n\tassertRelationFieldArity({\n\t\tmodelName: currentSpec.modelName,\n\t\trelationName,\n\t\tleftLabel: \"source\",\n\t\tleftFields: fromFields,\n\t\trightLabel: \"target\",\n\t\trightFields: toFields\n\t});\n\tif (relation.spaceId !== void 0) {\n\t\tassertKnownExtensionPack(extensions, relation.spaceId, `Relation \"${currentSpec.modelName}.${relationName}\"`);\n\t\tconst targetTable = relation.tableName ?? targetModelName.toLowerCase();\n\t\tconst parentColumns = mapFieldNamesToColumnNames(currentSpec.modelName, fromFields, currentSpec.fieldToColumn);\n\t\treturn {\n\t\t\tfieldName: relationName,\n\t\t\ttoModel: targetModelName,\n\t\t\ttoTable: targetTable,\n\t\t\tcardinality: \"N:1\",\n\t\t\tspaceId: relation.spaceId,\n\t\t\t...relation.namespaceId !== void 0 ? { namespaceId: relation.namespaceId } : {},\n\t\t\ton: {\n\t\t\t\tparentTable: currentSpec.tableName,\n\t\t\t\tparentColumns,\n\t\t\t\tchildTable: targetTable,\n\t\t\t\tchildColumns: toFields\n\t\t\t}\n\t\t};\n\t}\n\tconst targetSpec = allSpecs.get(targetModelName);\n\tif (!targetSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Relation \"${currentSpec.modelName}.${relationName}\" references unknown model \"${targetModelName}\"`, { meta: {\n\t\tsourceModel: currentSpec.modelName,\n\t\trelationName,\n\t\ttargetModel: targetModelName\n\t} });\n\treturn {\n\t\tfieldName: relationName,\n\t\ttoModel: targetModelName,\n\t\ttoTable: targetSpec.tableName,\n\t\tcardinality: \"N:1\",\n\t\ton: {\n\t\t\tparentTable: currentSpec.tableName,\n\t\t\tparentColumns: mapFieldNamesToColumnNames(currentSpec.modelName, fromFields, currentSpec.fieldToColumn),\n\t\t\tchildTable: targetSpec.tableName,\n\t\t\tchildColumns: mapFieldNamesToColumnNames(targetSpec.modelName, toFields, targetSpec.fieldToColumn)\n\t\t}\n\t};\n}\nfunction lowerHasOwnershipRelation(relationName, relation, currentSpec, allSpecs) {\n\tconst targetModelName = resolveRelationModelName(relation.toModel);\n\tconst targetSpec = allSpecs.get(targetModelName);\n\tif (!targetSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Relation \"${currentSpec.modelName}.${relationName}\" references unknown model \"${targetModelName}\"`, { meta: {\n\t\tsourceModel: currentSpec.modelName,\n\t\trelationName,\n\t\ttargetModel: targetModelName\n\t} });\n\tconst parentFields = resolveRelationAnchorFields(currentSpec);\n\tconst childFields = normalizeRelationFieldNames(relation.by);\n\tassertRelationFieldArity({\n\t\tmodelName: currentSpec.modelName,\n\t\trelationName,\n\t\tleftLabel: \"anchor\",\n\t\tleftFields: parentFields,\n\t\trightLabel: \"child\",\n\t\trightFields: childFields\n\t});\n\treturn {\n\t\tfieldName: relationName,\n\t\ttoModel: targetModelName,\n\t\ttoTable: targetSpec.tableName,\n\t\tcardinality: relation.kind === \"hasMany\" ? \"1:N\" : \"1:1\",\n\t\ton: {\n\t\t\tparentTable: currentSpec.tableName,\n\t\t\tparentColumns: mapFieldNamesToColumnNames(currentSpec.modelName, parentFields, currentSpec.fieldToColumn),\n\t\t\tchildTable: targetSpec.tableName,\n\t\t\tchildColumns: mapFieldNamesToColumnNames(targetSpec.modelName, childFields, targetSpec.fieldToColumn)\n\t\t}\n\t};\n}\nfunction lowerManyToManyRelation(relationName, relation, currentSpec, allSpecs) {\n\tconst targetModelName = resolveRelationModelName(relation.toModel);\n\tconst targetSpec = allSpecs.get(targetModelName);\n\tif (!targetSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Relation \"${currentSpec.modelName}.${relationName}\" references unknown model \"${targetModelName}\"`, { meta: {\n\t\tsourceModel: currentSpec.modelName,\n\t\trelationName,\n\t\ttargetModel: targetModelName\n\t} });\n\tconst throughModelName = resolveRelationModelName(relation.through);\n\tconst throughSpec = allSpecs.get(throughModelName);\n\tif (!throughSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Relation \"${currentSpec.modelName}.${relationName}\" references unknown through model \"${throughModelName}\"`, { meta: {\n\t\tsourceModel: currentSpec.modelName,\n\t\trelationName,\n\t\ttargetModel: throughModelName\n\t} });\n\tconst currentAnchorFields = resolveRelationAnchorFields(currentSpec);\n\tconst targetAnchorFields = resolveRelationAnchorFields(targetSpec);\n\tconst throughFromFields = normalizeRelationFieldNames(relation.from);\n\tconst throughToFields = normalizeRelationFieldNames(relation.to);\n\tif (currentAnchorFields.length !== throughFromFields.length || targetAnchorFields.length !== throughToFields.length) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${currentSpec.modelName}.${relationName}\" has mismatched many-to-many field counts.`, { meta: {\n\t\tmodelName: currentSpec.modelName,\n\t\trelationName,\n\t\treason: \"many-to-many-field-count-mismatch\"\n\t} });\n\treturn {\n\t\tfieldName: relationName,\n\t\ttoModel: targetModelName,\n\t\ttoTable: targetSpec.tableName,\n\t\tcardinality: \"N:M\",\n\t\tthrough: {\n\t\t\ttable: throughSpec.tableName,\n\t\t\t...ifDefined(\"namespaceId\", throughSpec.namespace),\n\t\t\tparentColumns: mapFieldNamesToColumnNames(throughSpec.modelName, throughFromFields, throughSpec.fieldToColumn),\n\t\t\tchildColumns: mapFieldNamesToColumnNames(throughSpec.modelName, throughToFields, throughSpec.fieldToColumn)\n\t\t},\n\t\ton: {\n\t\t\tparentTable: currentSpec.tableName,\n\t\t\tparentColumns: mapFieldNamesToColumnNames(currentSpec.modelName, currentAnchorFields, currentSpec.fieldToColumn),\n\t\t\tchildTable: throughSpec.tableName,\n\t\t\tchildColumns: mapFieldNamesToColumnNames(throughSpec.modelName, throughFromFields, throughSpec.fieldToColumn)\n\t\t}\n\t};\n}\nfunction resolveRelationNode(relationName, relation, currentSpec, allSpecs, extensions) {\n\tif (relation.kind === \"belongsTo\") return lowerBelongsToRelation(relationName, relation, currentSpec, allSpecs, extensions);\n\tif (relation.kind === \"hasMany\" || relation.kind === \"hasOne\") return lowerHasOwnershipRelation(relationName, relation, currentSpec, allSpecs);\n\treturn lowerManyToManyRelation(relationName, relation, currentSpec, allSpecs);\n}\nfunction lowerLocalForeignKeyNode(spec, targetSpec, foreignKey) {\n\treturn {\n\t\tcolumns: mapFieldNamesToColumnNames(spec.modelName, foreignKey.fields, spec.fieldToColumn),\n\t\treferences: {\n\t\t\tmodel: targetSpec.modelName,\n\t\t\ttable: targetSpec.tableName,\n\t\t\tcolumns: mapFieldNamesToColumnNames(targetSpec.modelName, foreignKey.targetFields, targetSpec.fieldToColumn)\n\t\t},\n\t\t...foreignKey.name ? { name: foreignKey.name } : {},\n\t\t...foreignKey.onDelete ? { onDelete: foreignKey.onDelete } : {},\n\t\t...foreignKey.onUpdate ? { onUpdate: foreignKey.onUpdate } : {},\n\t\t...foreignKey.constraint !== void 0 ? { constraint: foreignKey.constraint } : {},\n\t\t...foreignKey.index !== void 0 ? { index: foreignKey.index } : {}\n\t};\n}\nfunction lowerCrossSpaceForeignKeyNode(spec, foreignKey) {\n\treturn {\n\t\tcolumns: mapFieldNamesToColumnNames(spec.modelName, foreignKey.fields, spec.fieldToColumn),\n\t\treferences: {\n\t\t\tmodel: foreignKey.targetModel,\n\t\t\ttable: foreignKey.targetTableName ?? foreignKey.targetModel.toLowerCase(),\n\t\t\tcolumns: foreignKey.targetFields,\n\t\t\t...foreignKey.targetNamespaceId !== void 0 ? { namespaceId: foreignKey.targetNamespaceId } : {},\n\t\t\tspaceId: foreignKey.targetSpaceId\n\t\t},\n\t\t...foreignKey.name ? { name: foreignKey.name } : {},\n\t\t...foreignKey.onDelete ? { onDelete: foreignKey.onDelete } : {},\n\t\t...foreignKey.onUpdate ? { onUpdate: foreignKey.onUpdate } : {},\n\t\t...foreignKey.constraint !== void 0 ? { constraint: foreignKey.constraint } : {},\n\t\t...foreignKey.index !== void 0 ? { index: foreignKey.index } : {}\n\t};\n}\nfunction assertKnownExtensionPack(extensions, spaceId, context) {\n\tif (extensions !== void 0 && Object.hasOwn(extensions, spaceId)) return;\n\tthrow contractError(\"CONTRACT.PACK_MISSING\", `${context} references contract space \"${spaceId}\" but \"${spaceId}\" is not declared in extensions. Add the pack to extensions.`, { meta: {\n\t\tspaceId,\n\t\tcontext\n\t} });\n}\nfunction resolveForeignKeyNodes(spec, allSpecs, extensions) {\n\tconst relationForeignKeys = resolveRelationForeignKeys(spec, allSpecs).map((foreignKey) => {\n\t\tif (foreignKey.targetSpaceId !== void 0) {\n\t\t\tassertKnownExtensionPack(extensions, foreignKey.targetSpaceId, `Relation-derived foreign key on \"${spec.modelName}\"`);\n\t\t\treturn lowerCrossSpaceForeignKeyNode(spec, {\n\t\t\t\t...foreignKey,\n\t\t\t\ttargetSpaceId: foreignKey.targetSpaceId\n\t\t\t});\n\t\t}\n\t\tconst targetSpec = allSpecs.get(foreignKey.targetModel);\n\t\tif (!targetSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Foreign key on \"${spec.modelName}\" references unknown model \"${foreignKey.targetModel}\"`, { meta: {\n\t\t\tsourceModel: spec.modelName,\n\t\t\ttargetModel: foreignKey.targetModel\n\t\t} });\n\t\treturn lowerLocalForeignKeyNode(spec, targetSpec, foreignKey);\n\t});\n\tconst sqlForeignKeys = (spec.sqlSpec?.foreignKeys ?? []).map((foreignKey) => {\n\t\tif (foreignKey.targetSpaceId !== void 0) {\n\t\t\tassertKnownExtensionPack(extensions, foreignKey.targetSpaceId, `Foreign key on \"${spec.modelName}\"`);\n\t\t\treturn lowerCrossSpaceForeignKeyNode(spec, {\n\t\t\t\t...foreignKey,\n\t\t\t\ttargetSpaceId: foreignKey.targetSpaceId\n\t\t\t});\n\t\t}\n\t\tconst targetSpec = allSpecs.get(foreignKey.targetModel);\n\t\tif (!targetSpec) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `Foreign key on \"${spec.modelName}\" references unknown model \"${foreignKey.targetModel}\"`, { meta: {\n\t\t\tsourceModel: spec.modelName,\n\t\t\ttargetModel: foreignKey.targetModel\n\t\t} });\n\t\treturn lowerLocalForeignKeyNode(spec, targetSpec, foreignKey);\n\t});\n\treturn [...relationForeignKeys, ...sqlForeignKeys];\n}\nfunction resolveModelNode(spec, allSpecs, storageTypes, storageTypeReverseLookup, extensions) {\n\tconst fields = [];\n\tfor (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) {\n\t\tconst fieldState = fieldBuilder.build();\n\t\tconst descriptor = resolveFieldDescriptor(spec.modelName, fieldName, fieldState, storageTypes, storageTypeReverseLookup);\n\t\tconst columnName = spec.fieldToColumn[fieldName];\n\t\tif (!columnName) throw new InternalError(`Column name resolution failed for \"${spec.modelName}.${fieldName}\"`);\n\t\tconst enumHandle = \"typeRef\" in fieldState && isEnumTypeHandle(fieldState.typeRef) ? fieldState.typeRef : void 0;\n\t\tfields.push({\n\t\t\tfieldName,\n\t\t\tcolumnName,\n\t\t\tdescriptor,\n\t\t\tnullable: fieldState.nullable,\n\t\t\t...fieldState.many === true ? { many: true } : {},\n\t\t\t...fieldState.default ? { default: fieldState.default } : {},\n\t\t\t...fieldState.executionDefaults ? { executionDefaults: fieldState.executionDefaults } : {},\n\t\t\t...enumHandle !== void 0 ? { enumTypeHandle: enumHandle } : {}\n\t\t});\n\t}\n\tconst { idConstraint } = spec;\n\tconst uniques = resolveModelUniqueConstraints(spec).map((unique) => ({\n\t\tcolumns: mapFieldNamesToColumnNames(spec.modelName, unique.fields, spec.fieldToColumn),\n\t\t...unique.name ? { name: unique.name } : {}\n\t}));\n\tconst indexes = (spec.sqlSpec?.indexes ?? []).map((index) => {\n\t\tconst method = blindCast({\n\t\t\ttype: index.type,\n\t\t\toptions: index.options\n\t\t});\n\t\tconst carried = {\n\t\t\twhere: index.where,\n\t\t\tunique: index.unique,\n\t\t\tname: index.name,\n\t\t\tmap: index.map,\n\t\t\t...method\n\t\t};\n\t\treturn index.expression !== void 0 ? {\n\t\t\t...carried,\n\t\t\texpression: index.expression\n\t\t} : {\n\t\t\t...carried,\n\t\t\tcolumns: mapFieldNamesToColumnNames(spec.modelName, index.fields ?? [], spec.fieldToColumn)\n\t\t};\n\t});\n\tconst foreignKeys = resolveForeignKeyNodes(spec, allSpecs, extensions);\n\tconst relations = Object.entries(spec.relations).map(([relationName, relationBuilder]) => resolveRelationNode(relationName, relationBuilder.build(), spec, allSpecs, extensions));\n\treturn {\n\t\tmodelName: spec.modelName,\n\t\ttableName: spec.tableName,\n\t\t...spec.namespace !== void 0 ? { namespaceId: spec.namespace } : {},\n\t\tfields,\n\t\t...idConstraint ? { id: {\n\t\t\tcolumns: mapFieldNamesToColumnNames(spec.modelName, idConstraint.fields, spec.fieldToColumn),\n\t\t\t...idConstraint.name ? { name: idConstraint.name } : {}\n\t\t} } : {},\n\t\t...uniques.length > 0 ? { uniques } : {},\n\t\t...indexes.length > 0 ? { indexes } : {},\n\t\t...foreignKeys.length > 0 ? { foreignKeys } : {},\n\t\t...relations.length > 0 ? { relations } : {},\n\t\t...ifDefined(\"control\", spec.sqlSpec?.control)\n\t};\n}\nfunction collectRuntimeModelSpecs(definition) {\n\tconst storageTypes = { ...definition.types ?? {} };\n\tconst models = { ...definition.models ?? {} };\n\temitTypedNamedTypeFallbackWarnings(models, storageTypes);\n\tconst modelSpecs = /* @__PURE__ */ new Map();\n\tconst tableOwners = /* @__PURE__ */ new Map();\n\tfor (const [modelName, modelDefinition] of Object.entries(models)) {\n\t\tconst tokenModelName = modelDefinition.stageOne.modelName;\n\t\tif (tokenModelName && tokenModelName !== modelName) throw contractError(\"CONTRACT.MODEL_TOKEN_INVALID\", `Model token \"${tokenModelName}\" must be assigned to models.${tokenModelName}. Received models.${modelName}.`, { meta: {\n\t\t\ttokenModelName,\n\t\t\tassignedKey: modelName\n\t\t} });\n\t\tconst attributesSpec = modelDefinition.buildAttributesSpec();\n\t\tconst sqlSpec = modelDefinition.buildSqlSpec();\n\t\tconst tableName = sqlSpec?.table ?? applyNaming(modelName, definition.naming?.tables);\n\t\tconst namespaceId = modelDefinition.stageOne.namespace ?? definition.target.defaultNamespaceId;\n\t\tconst tableKey = JSON.stringify([namespaceId, tableName]);\n\t\tconst existingModel = tableOwners.get(tableKey);\n\t\tif (existingModel) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Models \"${existingModel}\" and \"${modelName}\" both map to table \"${tableName}\".`, { meta: {\n\t\t\tkind: \"table\",\n\t\t\tname: tableName,\n\t\t\tfirst: existingModel,\n\t\t\tsecond: modelName\n\t\t} });\n\t\ttableOwners.set(tableKey, modelName);\n\t\tconst fieldToColumn = {};\n\t\tconst columnOwners = /* @__PURE__ */ new Map();\n\t\tfor (const [fieldName, fieldBuilder] of Object.entries(modelDefinition.stageOne.fields)) {\n\t\t\tconst columnName = fieldBuilder.build().columnName ?? applyNaming(fieldName, definition.naming?.columns);\n\t\t\tconst existingField = columnOwners.get(columnName);\n\t\t\tif (existingField) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Model \"${modelName}\" maps both \"${existingField}\" and \"${fieldName}\" to column \"${columnName}\".`, { meta: {\n\t\t\t\tkind: \"column\",\n\t\t\t\tname: columnName,\n\t\t\t\tfirst: existingField,\n\t\t\t\tsecond: fieldName\n\t\t\t} });\n\t\t\tcolumnOwners.set(columnName, fieldName);\n\t\t\tfieldToColumn[fieldName] = columnName;\n\t\t}\n\t\tconst fieldBuilders = modelDefinition.stageOne.fields;\n\t\tconst idConstraint = resolveModelIdConstraint({\n\t\t\tmodelName,\n\t\t\tfieldBuilders,\n\t\t\tattributesSpec\n\t\t});\n\t\tmodelSpecs.set(modelName, {\n\t\t\tmodelName,\n\t\t\ttableName,\n\t\t\tnamespace: modelDefinition.stageOne.namespace,\n\t\t\tfieldBuilders,\n\t\t\tfieldToColumn,\n\t\t\trelations: modelDefinition.stageOne.relations,\n\t\t\tattributesSpec,\n\t\t\tsqlSpec,\n\t\t\tidConstraint\n\t\t});\n\t}\n\treturn {\n\t\tstorageTypes,\n\t\tmodels,\n\t\tmodelSpecs\n\t};\n}\nfunction lowerModels(collection, extensions) {\n\temitTypedCrossModelFallbackWarnings(collection);\n\tconst storageTypeReverseLookup = buildStorageTypeReverseLookup(collection.storageTypes);\n\treturn Array.from(collection.modelSpecs.values()).map((spec) => resolveModelNode(spec, collection.modelSpecs, collection.storageTypes, storageTypeReverseLookup, extensions));\n}\n/**\n* Kind-agnostic walk over the author-declared `entities` handle list:\n*\n* 1. Index the bound packs' `entityTypes` contributions by discriminator so\n* each handle's `entityKind` maps to the pack that registered it; a\n* handle whose kind no composed pack registers is an error naming the\n* kind.\n* 2. Resolve each handle's declared model refs (`handle.refs`, actual\n* model-handle objects) to storage table coordinates — identity against\n* the contract's `models` record first, then the handle's declared model\n* name against the build's model specs; never by re-deriving a table\n* name. A cross-space (extensionModel) handle resolves to its own\n* coordinate annotated with `spaceId`.\n* 3. Call each owning pack's batch lowering hook once with all of its\n* claimed handles, and fold the returned rows into the namespace-scoped\n* attachments (namespace → kind → key), rejecting two different entities\n* in one slot. The result becomes `ContractDefinition.attachedEntities`.\n*\n* No entity kind is named anywhere in this walk.\n*/\nfunction lowerPackEntityHandles(definition, modelSpecs) {\n\tconst entities = definition.entities;\n\tif (entities === void 0 || entities.length === 0) return void 0;\n\tconst components = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tconst owningComponent = /* @__PURE__ */ new Map();\n\tconst walkEntityTypes = (namespace, component) => {\n\t\tfor (const value of Object.values(namespace)) if (isAuthoringEntityTypeDescriptor(value)) owningComponent.set(value.discriminator, component);\n\t\telse walkEntityTypes(value, component);\n\t};\n\tfor (const component of components) {\n\t\tconst entityTypes = component.authoring?.entityTypes;\n\t\tif (entityTypes !== void 0) walkEntityTypes(entityTypes, component);\n\t}\n\tconst defaultNamespaceId = definition.target.defaultNamespaceId;\n\tconst modelNamesByIdentity = /* @__PURE__ */ new Map();\n\tfor (const [modelName, modelBuilder] of Object.entries(definition.models ?? {})) modelNamesByIdentity.set(modelBuilder, modelName);\n\tconst coordinateOf = (modelName) => {\n\t\tconst spec = modelSpecs.get(modelName);\n\t\tif (spec === void 0) return void 0;\n\t\treturn {\n\t\t\tkind: \"resolved\",\n\t\t\tnamespaceId: spec.namespace ?? defaultNamespaceId,\n\t\t\ttableName: spec.tableName,\n\t\t\tmodelName\n\t\t};\n\t};\n\tconst declaredModelName = (value) => {\n\t\tif (typeof value !== \"object\" || value === null || !(\"stageOne\" in value)) return void 0;\n\t\tconst stageOne = value.stageOne;\n\t\tif (typeof stageOne !== \"object\" || stageOne === null || !(\"modelName\" in stageOne)) return;\n\t\treturn typeof stageOne.modelName === \"string\" ? stageOne.modelName : void 0;\n\t};\n\tconst resolveRef = (value) => {\n\t\tconst modelName = declaredModelName(value);\n\t\tif (isCrossSpaceHandle(value)) {\n\t\t\tconst tableName = value.tableName;\n\t\t\tconst namespaceId = value.stageOne.namespace;\n\t\t\tif (tableName !== void 0 && namespaceId !== void 0) return {\n\t\t\t\tkind: \"cross-space\",\n\t\t\t\tspaceId: value.spaceId,\n\t\t\t\tnamespaceId,\n\t\t\t\ttableName,\n\t\t\t\t...ifDefined(\"modelName\", modelName)\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tkind: \"unresolved\",\n\t\t\t\t...ifDefined(\"modelName\", modelName)\n\t\t\t};\n\t\t}\n\t\tconst identityName = modelNamesByIdentity.get(value);\n\t\treturn (identityName !== void 0 ? coordinateOf(identityName) : void 0) ?? (modelName !== void 0 ? coordinateOf(modelName) : void 0) ?? {\n\t\t\tkind: \"unresolved\",\n\t\t\t...ifDefined(\"modelName\", modelName)\n\t\t};\n\t};\n\tconst claimed = /* @__PURE__ */ new Map();\n\tfor (const handle of entities) {\n\t\tconst component = owningComponent.get(handle.entityKind);\n\t\tif (component === void 0) throw contractError(\"CONTRACT.ENTITY_KIND_UNKNOWN\", `defineContract: entities contains a handle with entityKind \"${handle.entityKind}\", which no composed pack registers. Compose a pack whose entityTypes contribution claims \"${handle.entityKind}\", or remove the handle.`, { meta: { entityKind: handle.entityKind } });\n\t\tconst refs = {};\n\t\tfor (const [refName, refValue] of Object.entries(handle.refs ?? {})) refs[refName] = resolveRef(refValue);\n\t\tconst forComponent = claimed.get(component) ?? [];\n\t\tforComponent.push({\n\t\t\thandle,\n\t\t\trefs\n\t\t});\n\t\tclaimed.set(component, forComponent);\n\t}\n\tconst pack = {};\n\tfor (const [component, handles] of claimed) {\n\t\tconst authoring = component.authoring;\n\t\tif (!providesEntityHandleLowering(authoring)) {\n\t\t\tconst kinds = [...new Set(handles.map((entry) => entry.handle.entityKind))].sort();\n\t\t\tthrow contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `defineContract: entityKind(s) ${kinds.map((kind) => `\"${kind}\"`).join(\", \")} are registered by a pack that does not implement entity-handle lowering (no lowerEntityHandles on its authoring contributions).`, { meta: {\n\t\t\t\tentityKinds: kinds,\n\t\t\t\treason: \"missing-lowerEntityHandles\"\n\t\t\t} });\n\t\t}\n\t\tfor (const row of authoring.lowerEntityHandles({\n\t\t\thandles,\n\t\t\tdefaultNamespaceId\n\t\t})) {\n\t\t\tconst forNamespace = pack[row.namespaceId] ?? {};\n\t\t\tpack[row.namespaceId] = forNamespace;\n\t\t\tconst forKind = forNamespace[row.entityKind] ?? {};\n\t\t\tforNamespace[row.entityKind] = forKind;\n\t\t\tconst existing = forKind[row.key];\n\t\t\tif (existing !== void 0 && existing !== row.entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `defineContract: two different \"${row.entityKind}\" entities named \"${row.key}\" in namespace \"${row.namespaceId}\" — pack-entity names must be unique per namespace.`, { meta: {\n\t\t\t\tkind: row.entityKind,\n\t\t\t\tname: row.key,\n\t\t\t\tnamespaceId: row.namespaceId\n\t\t\t} });\n\t\t\tforKind[row.key] = row.entity;\n\t\t}\n\t}\n\treturn pack;\n}\nfunction buildContractDefinition(definition) {\n\tconst collection = collectRuntimeModelSpecs(definition);\n\tconst models = lowerModels(collection, definition.extensions);\n\tconst attachedEntities = lowerPackEntityHandles(definition, collection.modelSpecs);\n\treturn {\n\t\ttarget: definition.target,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\t...definition.extensions ? { extensions: definition.extensions } : {},\n\t\t...definition.storageHash ? { storageHash: definition.storageHash } : {},\n\t\t...definition.foreignKeyDefaults ? { foreignKeyDefaults: definition.foreignKeyDefaults } : {},\n\t\t...Object.keys(collection.storageTypes).length > 0 ? { storageTypes: collection.storageTypes } : {},\n\t\t...definition.namespaces ? { namespaces: definition.namespaces } : {},\n\t\twarnings: void 0,\n\t\tcreateNamespace: definition.createNamespace,\n\t\t...definition.enums && Object.keys(definition.enums).length > 0 ? { enums: definition.enums } : {},\n\t\t...attachedEntities && Object.keys(attachedEntities).length > 0 ? { attachedEntities } : {},\n\t\tmodels\n\t};\n}\n//#endregion\n//#region src/contract-builder.ts\nfunction validateTargetPackRef(family, target) {\n\tif (family.familyId !== \"sql\") throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `defineContract only accepts SQL family packs. Received family \"${family.familyId}\".`, { meta: {\n\t\tpackId: family.id,\n\t\tpackFamilyId: family.familyId,\n\t\tcontractFamilyId: \"sql\"\n\t} });\n\tif (target.familyId !== family.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `target pack \"${target.id}\" targets family \"${target.familyId}\" but contract family is \"${family.familyId}\".`, { meta: {\n\t\tpackId: target.id,\n\t\tpackFamilyId: target.familyId,\n\t\tcontractFamilyId: family.familyId\n\t} });\n}\n/**\n* Per-target reserved namespace names enforced by `defineContract` for\n* SQL family contracts. Two categories:\n*\n* 1. **IR sentinels** (`__unbound__`, `__unspecified__`) — reserved on\n* every SQL target. The double-underscore decoration marks them as\n* framework-reserved coordinates; user code must not declare them\n* explicitly.\n* 2. **Target-specific PSL keywords** — Postgres reserves the bare\n* `unbound` identifier for the late-binding opt-in\n* (`namespace unbound { … }`) so the TS surface must reject it from\n* `defineContract({ namespaces })` lists. SQLite has no schema\n* concept and rejects every non-empty namespaces list outright;\n* callers should declare `namespaces: []` or omit the field.\n*/\nfunction validateNamespaceDeclarations(target, namespaces) {\n\tif (!namespaces) return;\n\tif (target.targetId === \"sqlite\" && namespaces.length > 0) throw contractError(\"CONTRACT.NAMESPACE_UNSUPPORTED\", `defineContract: SQLite contracts cannot declare namespaces (SQLite has no schema concept; emitted DDL is always unqualified). Received namespaces: [${namespaces.map((name) => `\"${name}\"`).join(\", \")}].`, { meta: {\n\t\tnamespaces,\n\t\ttargetId: target.targetId\n\t} });\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const namespace of namespaces) {\n\t\tif (namespace.length === 0) throw contractError(\"CONTRACT.NAMESPACE_INVALID\", \"defineContract: namespace names cannot be empty.\", { meta: {\n\t\t\tnamespace,\n\t\t\treason: \"empty\"\n\t\t} });\n\t\tif (namespace.trim().length === 0) throw contractError(\"CONTRACT.NAMESPACE_INVALID\", `defineContract: namespace name \"${namespace}\" cannot be whitespace-only.`, { meta: {\n\t\t\tnamespace,\n\t\t\treason: \"whitespace-only\"\n\t\t} });\n\t\tif (namespace === \"__unbound__\" || namespace === \"__unspecified__\") throw contractError(\"CONTRACT.NAMESPACE_INVALID\", `defineContract: namespace name \"${namespace}\" is a reserved IR sentinel and cannot appear in the declared namespaces list.`, { meta: {\n\t\t\tnamespace,\n\t\t\treason: \"reserved-ir-sentinel\"\n\t\t} });\n\t\tif (target.targetId === \"postgres\" && namespace === \"unbound\") throw contractError(\"CONTRACT.NAMESPACE_INVALID\", `defineContract: namespace name \"unbound\" is reserved by Postgres for the late-binding opt-in (use \\`namespace unbound { … }\\` in PSL instead of declaring it as a regular schema).`, { meta: {\n\t\t\tnamespace,\n\t\t\treason: \"reserved-by-postgres\"\n\t\t} });\n\t\tif (seen.has(namespace)) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `defineContract: namespaces list contains duplicate entry \"${namespace}\".`, { meta: {\n\t\t\tkind: \"namespace\",\n\t\t\tname: namespace\n\t\t} });\n\t\tseen.add(namespace);\n\t}\n}\n/**\n* Per-model `namespace` validation paired with\n* {@link validateNamespaceDeclarations}. Mirrors the reserved-name\n* rules so the per-model surface stays consistent with the contract-\n* level surface:\n*\n* - `__unbound__` / `__unspecified__` — reserved IR sentinels on\n* every SQL target.\n* - `unbound` on Postgres — reserved for the PSL\n* `namespace unbound { … }` opt-in.\n*\n* Additionally enforces that each per-model `namespace` either\n* references an entry in the contract's declared `namespaces` list or\n* names the Postgres late-binding keyword (`unbound`) — the latter is\n* not a \"declared namespace\" but is a legal opt-in only via PSL today,\n* so the TS surface also rejects it on the per-model side and points\n* authors at the PSL `namespace unbound { … }` block.\n*\n* The SQLite per-model `namespace` field is rejected outright (SQLite\n* has no schema concept).\n*/\nfunction validatePerModelNamespaces(target, namespaces, models) {\n\tconst declaredNamespaces = new Set(namespaces ?? []);\n\tfor (const [modelKey, modelBuilder] of Object.entries(models)) {\n\t\tconst perModelNamespace = modelBuilder.stageOne.namespace;\n\t\tif (perModelNamespace === void 0) continue;\n\t\tif (target.targetId === \"sqlite\") throw contractError(\"CONTRACT.NAMESPACE_UNSUPPORTED\", `defineContract: model \"${modelKey}\" sets \\`namespace: \"${perModelNamespace}\"\\` but the target is SQLite (SQLite has no schema concept; remove the per-model \\`namespace\\` field).`, { meta: {\n\t\t\tmodelKey,\n\t\t\tnamespace: perModelNamespace,\n\t\t\ttargetId: target.targetId\n\t\t} });\n\t\tif (perModelNamespace === \"__unbound__\" || perModelNamespace === \"__unspecified__\") throw contractError(\"CONTRACT.NAMESPACE_INVALID\", `defineContract: model \"${modelKey}\" sets \\`namespace: \"${perModelNamespace}\"\\` but that name is a reserved IR sentinel and cannot appear in user code.`, { meta: {\n\t\t\tmodelKey,\n\t\t\tnamespace: perModelNamespace,\n\t\t\treason: \"reserved-ir-sentinel\"\n\t\t} });\n\t\tif (target.targetId === \"postgres\" && perModelNamespace === \"unbound\") throw contractError(\"CONTRACT.NAMESPACE_INVALID\", `defineContract: model \"${modelKey}\" sets \\`namespace: \"unbound\"\\` but that name is reserved by Postgres for the late-binding opt-in (use \\`namespace unbound { … }\\` in PSL instead — there is no equivalent surface in the TS builder today).`, { meta: {\n\t\t\tmodelKey,\n\t\t\tnamespace: perModelNamespace,\n\t\t\treason: \"reserved-by-postgres\"\n\t\t} });\n\t\tif (!declaredNamespaces.has(perModelNamespace)) throw contractError(\"CONTRACT.NAMESPACE_UNKNOWN\", `defineContract: model \"${modelKey}\" references namespace \"${perModelNamespace}\" but that name does not appear in the contract's declared \\`namespaces\\` list.${declaredNamespaces.size > 0 ? ` Declared namespaces: [${[...declaredNamespaces].map((name) => `\"${name}\"`).join(\", \")}].` : \" The contract does not declare any namespaces; add `namespaces: [\\\"…\\\"]` to `defineContract` first.\"}`, { meta: {\n\t\t\tmodelKey,\n\t\t\tnamespace: perModelNamespace,\n\t\t\tdeclared: [...declaredNamespaces]\n\t\t} });\n\t}\n}\nfunction validateExtensionPackRefs(target, extensions) {\n\tif (!extensions) return;\n\tfor (const packRef of Object.values(extensions)) {\n\t\tif (packRef.kind !== \"extension\") throw contractError(\"CONTRACT.PACK_REF_INVALID\", `defineContract only accepts extension pack refs in extensions. Received kind \"${packRef.kind}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tkind: packRef.kind\n\t\t} });\n\t\tif (packRef.familyId !== target.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `extension pack \"${packRef.id}\" targets family \"${packRef.familyId}\" but contract target family is \"${target.familyId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackFamilyId: packRef.familyId,\n\t\t\tcontractFamilyId: target.familyId\n\t\t} });\n\t\tif (packRef.targetId && packRef.targetId !== target.targetId) throw contractError(\"CONTRACT.PACK_TARGET_MISMATCH\", `extension pack \"${packRef.id}\" targets \"${packRef.targetId}\" but contract target is \"${target.targetId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackTargetId: packRef.targetId,\n\t\t\tcontractTargetId: target.targetId\n\t\t} });\n\t}\n}\nfunction buildContractFromDsl(definition) {\n\tvalidateTargetPackRef(definition.family, definition.target);\n\tvalidateExtensionPackRefs(definition.target, definition.extensions);\n\tvalidateNamespaceDeclarations(definition.target, definition.namespaces);\n\tvalidatePerModelNamespaces(definition.target, definition.namespaces, definition.models ?? {});\n\treturn blindCast(buildSqlContractFromDefinition(buildContractDefinition(definition), definition.codecLookup));\n}\n/** Implementation. */\nfunction buildBoundContract(family, target, definition, factory) {\n\tconst full = {\n\t\t...definition,\n\t\tfamily,\n\t\ttarget\n\t};\n\tif (factory !== void 0) {\n\t\tconst built = factory(createComposedAuthoringHelpers({\n\t\t\tfamily,\n\t\t\ttarget,\n\t\t\textensions: definition.extensions\n\t\t}));\n\t\tconst mergedEnums = {\n\t\t\t...definition.enums ?? {},\n\t\t\t...built.enums\n\t\t};\n\t\tconst mergedEntities = [...definition.entities ?? [], ...built.entities ?? []];\n\t\treturn buildContractFromDsl({\n\t\t\t...full,\n\t\t\t...ifDefined(\"types\", built.types),\n\t\t\t...ifDefined(\"models\", built.models),\n\t\t\t...ifDefined(\"enums\", Object.keys(mergedEnums).length > 0 ? mergedEnums : void 0),\n\t\t\t...ifDefined(\"entities\", mergedEntities.length > 0 ? mergedEntities : void 0)\n\t\t});\n\t}\n\treturn buildContractFromDsl(full);\n}\nfunction defineContract(definition, factory) {\n\tif (!isContractInput(definition)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"defineContract expects a contract definition object. Define your contract with defineContract({ family, target, models, ... }).\");\n\tif (factory !== void 0) return buildBoundContract(definition.family, definition.target, definition, factory);\n\treturn buildBoundContract(definition.family, definition.target, definition);\n}\n//#endregion\nexport { bindEnumType, buildBoundContract, buildContractDefinition, buildSqlContractFromDefinition, defineContract, enumType, extensionModel, field, member, model, rel };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,6BAA6B,OAAO;CAC5C,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO;CAChF,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM,QAAQ,QAAQ,MAAM,GAAG,OAAO;CAC7D,MAAM,OAAO,MAAM;CACnB,OAAO,SAAS,KAAK,KAAK,OAAO,SAAS;AAC3C;AACA,MAAM,kCAAkC,IAAI,IAAI;CAC/C;CACA;CACA;AACD,CAAC;AACD,SAAS,oBAAoB,KAAK,MAAM;CACvC,IAAI,gBAAgB,IAAI,GAAG,GAAG,MAAM,cAAc,sCAAsC,6BAA6B,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,wCAAwC,IAAI,KAAK,EAAE,MAAM;EACtM,YAAY,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;EACnC,SAAS;CACV,EAAE,CAAC;AACJ;AACA,SAAS,+BAA+B,WAAW,OAAO,CAAC,GAAG;CAC7D,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,GAAG;EACrD,oBAAoB,KAAK,IAAI;EAC7B,MAAM,cAAc,CAAC,GAAG,MAAM,GAAG;EACjC,IAAI,qCAAqC,KAAK,GAAG;GAChD,MAAM,aAAa,YAAY,KAAK,GAAG;GACvC,QAAQ,QAAQ,GAAG,SAAS;IAC3B,iCAAiC,YAAY,MAAM,MAAM,IAAI;IAC7D,MAAM,SAAS,oCAAoC,OAAO,IAAI;IAC9D,OAAO,sBAAsB;KAC5B,SAAS,OAAO;KAChB,YAAY,OAAO;KACnB,YAAY,OAAO,cAAc,CAAC;IACnC,CAAC;GACF;GACA;EACD;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"@prisma/orm-framework/contract/types";
|
|
2
|
+
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
3
|
+
import { GenerateContractTypesOptions, ImportSpecifierResolver, ValidationContext } from "@prisma/orm-framework/components/emission";
|
|
4
|
+
//#region ../../../2-sql/3-tooling/emitter/dist/index.d.mts
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
declare const sqlEmission: {
|
|
7
|
+
readonly id: "sql";
|
|
8
|
+
readonly validateTypes: (contract: Contract, _ctx: ValidationContext) => void;
|
|
9
|
+
readonly validateStructure: (contract: Contract) => void;
|
|
10
|
+
readonly generateStorageType: (contract: Contract, storageHashTypeName: string) => string;
|
|
11
|
+
readonly generateModelStorageType: (_modelName: string, model: ContractModelBase) => string;
|
|
12
|
+
readonly resolveFieldTypeParams: (_modelName: string, fieldName: string, model: ContractModelBase, contract: Contract) => Record<string, unknown> | undefined;
|
|
13
|
+
readonly resolveFieldValueSet: (_modelName: string, fieldName: string, model: ContractModelBase, contract: Contract) => {
|
|
14
|
+
readonly encodedValues: readonly JsonValue[];
|
|
15
|
+
readonly codecId: string;
|
|
16
|
+
} | undefined;
|
|
17
|
+
readonly getStorageTypeExports: (contract: Contract, codecLookup?: CodecLookup) => string | undefined;
|
|
18
|
+
readonly getFamilyImports: (resolveImportSpecifier: ImportSpecifierResolver) => string[];
|
|
19
|
+
readonly getFamilyTypeAliases: (options?: GenerateContractTypesOptions) => string;
|
|
20
|
+
readonly getTypeMapsExpression: () => string;
|
|
21
|
+
readonly getContractWrapper: (contractBaseName: string, typeMapsName: string) => string;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { sqlEmission };
|
|
25
|
+
//# sourceMappingURL=contract-emitter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-emitter.d.mts","names":[],"sources":["../../../../2-sql/3-tooling/emitter/dist/index.d.mts"],"mappings":";;;;;cAIc;WACH;WACA,gBAAgB,UAAU,UAAU,MAAM;WAC1C,oBAAoB,UAAU;WAC9B,sBAAsB,UAAU,UAAU;WAC1C,2BAA2B,oBAAoB,OAAO;WACtD,yBAAyB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU,aAAa;WACjH,uBAAuB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU;aAChG,wBAAwB;aACxB;;WAEF,wBAAwB,UAAU,UAAU,cAAc;WAC1D,mBAAmB,wBAAwB;WAC3C,uBAAuB,UAAU;WACjC;WACA,qBAAqB,0BAA0B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
//#region ../../../2-sql/1-core/contract/dist/contract-errors-BCN6RVI5.mjs
|
|
3
|
+
function contractError(code, message, options) {
|
|
4
|
+
return structuredError(code, message, options);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { contractError as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=contract-errors-BCN6RVI5-5IHBF_lg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-errors-BCN6RVI5-5IHBF_lg.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/contract-errors-BCN6RVI5.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\nexport { contractError as t };\n\n//# sourceMappingURL=contract-errors-BCN6RVI5.mjs.map"],"mappings":";;AAEA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { i as SqlNamespaceBase, s as SqlNamespaceInput } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
|
|
2
|
+
import "./types-BchwQpmO.mjs";
|
|
3
|
+
import { Contract, ValueSetRef } from "@prisma/orm-framework/contract/types";
|
|
4
|
+
import { AuthoringContributions } from "@prisma/orm-framework/components/authoring";
|
|
5
|
+
import { SymbolTable } from "@prisma/orm-framework/psl-parser";
|
|
6
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
7
|
+
import { SourceFile } from "@prisma/orm-framework/psl-parser/syntax";
|
|
8
|
+
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
9
|
+
import { CapabilityMatrix, ExtensionPackRef, TargetPackRef } from "@prisma/orm-framework/components/components";
|
|
10
|
+
import { ControlMutationDefaults, ControlMutationDefaults as ControlMutationDefaults$1, DefaultFunctionLoweringContext, MutationDefaultGeneratorDescriptor } from "@prisma/orm-framework/components/control";
|
|
11
|
+
import { ContractSourceDiagnostic, ContractSourceDiagnostics } from "@prisma/orm-framework/config/config-types";
|
|
12
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/index.d.mts
|
|
13
|
+
//#region src/psl-column-resolution.d.ts
|
|
14
|
+
type ColumnDescriptor = {
|
|
15
|
+
readonly codecId: string;
|
|
16
|
+
readonly nativeType: string;
|
|
17
|
+
readonly typeRef?: string;
|
|
18
|
+
readonly typeParams?: Record<string, unknown> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Storage-plane value-set ref, set only by an entity-ref type constructor
|
|
21
|
+
* (e.g. `pg.enum(Ref)`) resolving `Ref` against a document-local
|
|
22
|
+
* value-set-deriving entity. Threaded straight onto the `StorageColumn` —
|
|
23
|
+
* this is what drives value-set → codec typing (`computeColumnType`
|
|
24
|
+
* gating on `column.valueSet`); every other resolution path leaves it
|
|
25
|
+
* unset.
|
|
26
|
+
*/
|
|
27
|
+
readonly valueSet?: ValueSetRef;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/interpreter.d.ts
|
|
31
|
+
interface InterpretPslDocumentToSqlContractInput {
|
|
32
|
+
readonly symbolTable: SymbolTable;
|
|
33
|
+
readonly sourceFile: SourceFile;
|
|
34
|
+
readonly sourceId: string;
|
|
35
|
+
readonly target: TargetPackRef<'sql', string>;
|
|
36
|
+
readonly scalarColumnDescriptors: ReadonlyMap<string, ColumnDescriptor>;
|
|
37
|
+
readonly composedExtensions?: readonly string[];
|
|
38
|
+
readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', string>[];
|
|
39
|
+
readonly controlMutationDefaults?: ControlMutationDefaults$1;
|
|
40
|
+
readonly authoringContributions?: AuthoringContributions;
|
|
41
|
+
/**
|
|
42
|
+
* Extension contracts keyed by space ID. Required for cross-space FK
|
|
43
|
+
* resolution. A composed space must have an entry here; if the space ID
|
|
44
|
+
* appears in `composedExtensions` but is absent from this map, the
|
|
45
|
+
* interpreter emits `PSL_UNKNOWN_CONTRACT_SPACE` and fails fast — there
|
|
46
|
+
* is no silent fallback. If a space's contract is present but the
|
|
47
|
+
* referenced model or namespace is not found in it, the interpreter
|
|
48
|
+
* emits `PSL_UNKNOWN_CROSS_SPACE_TARGET`.
|
|
49
|
+
*/
|
|
50
|
+
readonly composedExtensionContracts: ReadonlyMap<string, Contract>;
|
|
51
|
+
/** Target-supplied factory that materialises a `SqlNamespaceBase` concretion for each namespace coordinate. */
|
|
52
|
+
readonly createNamespace: (input: SqlNamespaceInput) => SqlNamespaceBase;
|
|
53
|
+
readonly codecLookup?: CodecLookup;
|
|
54
|
+
readonly seedDiagnostics?: readonly ContractSourceDiagnostic[];
|
|
55
|
+
/** The target's default codec ids for an `enum` block that omits `@@type`. */
|
|
56
|
+
readonly enumInferenceCodecs?: {
|
|
57
|
+
readonly text: string;
|
|
58
|
+
readonly int: string;
|
|
59
|
+
};
|
|
60
|
+
readonly capabilities: CapabilityMatrix;
|
|
61
|
+
}
|
|
62
|
+
declare function interpretPslDocumentToSqlContract(input: InterpretPslDocumentToSqlContractInput): Result<Contract, ContractSourceDiagnostics>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { type ControlMutationDefaults, type DefaultFunctionLoweringContext, type InterpretPslDocumentToSqlContractInput, type MutationDefaultGeneratorDescriptor, interpretPslDocumentToSqlContract };
|
|
65
|
+
//# sourceMappingURL=contract-psl.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-psl.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;KAWK;WACM;WACA;WACA;WACA,aAAa;;;;;;;;;WASb,WAAW;;;;UAIZ;WACC,aAAa;WACb,YAAY;WACZ;WACA,QAAQ;WACR,yBAAyB,oBAAoB;WAC7C;WACA,qCAAqC;WACrC,0BAA0B;WAC1B,yBAAyB;;;;;;;;;;WAUzB,4BAA4B,oBAAoB;;WAEhD,kBAAkB,OAAO,sBAAsB;WAC/C,cAAc;WACd,2BAA2B;;WAE3B;aACE;aACA;;WAEF,cAAc;;iBAER,kCAAkC,OAAO,yCAAyC,OAAO,UAAU"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { i as SqlNamespaceBase, s as SqlNamespaceInput } from "./sql-storage-B0QwiTg6-B8DVctJm.mjs";
|
|
2
|
+
import "./types-BchwQpmO.mjs";
|
|
3
|
+
import { ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
4
|
+
import { ExtensionPackRef, TargetPackRef } from "@prisma/orm-framework/components/components";
|
|
5
|
+
import { ContractConfig } from "@prisma/orm-framework/config/config-types";
|
|
6
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/provider.d.mts
|
|
7
|
+
//#region src/provider.d.ts
|
|
8
|
+
interface PrismaContractOptions {
|
|
9
|
+
readonly output?: string;
|
|
10
|
+
readonly target: TargetPackRef<'sql', string>;
|
|
11
|
+
readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', string>[];
|
|
12
|
+
readonly createNamespace: (input: SqlNamespaceInput) => SqlNamespaceBase;
|
|
13
|
+
readonly defaultControlPolicy?: ControlPolicy;
|
|
14
|
+
/** The target's default codec ids for an `enum` block that omits `@@type`. */
|
|
15
|
+
readonly enumInferenceCodecs?: {
|
|
16
|
+
readonly text: string;
|
|
17
|
+
readonly int: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare function prismaContract(schemaPath: string, options: PrismaContractOptions): ContractConfig;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type PrismaContractOptions, prismaContract };
|
|
23
|
+
//# sourceMappingURL=contract-psl__provider.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-psl__provider.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/provider.d.mts"],"mappings":";;;;;;;UAKU;WACC;WACA,QAAQ;WACR,qCAAqC;WACrC,kBAAkB,OAAO,sBAAsB;WAC/C,uBAAuB;;WAEvB;aACE;aACA;;;iBAGI,eAAe,oBAAoB,SAAS,wBAAwB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-5WgpL-ax-_nqHLUTr.mjs";
|
|
2
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
3
|
+
import { collectScalarTypeConstructors } from "@prisma/orm-framework/components/authoring";
|
|
4
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
5
|
+
import { buildSymbolTable, rangeToPslSpan } from "@prisma/orm-framework/psl-parser";
|
|
6
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
7
|
+
import { readFile } from "node:fs/promises";
|
|
8
|
+
import { applySpecifierDefaultControlPolicy } from "@prisma/orm-framework/contract/apply-specifier-default-control-policy";
|
|
9
|
+
import { withSeedDiagnostics } from "@prisma/orm-framework/psl-parser/interpret";
|
|
10
|
+
import { parse } from "@prisma/orm-framework/psl-parser/syntax";
|
|
11
|
+
import { basename, extname } from "pathe";
|
|
12
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/provider.mjs
|
|
13
|
+
/**
|
|
14
|
+
* Derives the emit output path from the schema input path so artefacts land
|
|
15
|
+
* colocated with the source (e.g. `src/contract/schema.prisma` →
|
|
16
|
+
* `src/contract/contract.json`). The provider owns this because it is the
|
|
17
|
+
* only layer that knows the input path; the upstream `normalizeContractConfig`
|
|
18
|
+
* default is a last-resort fallback for providers that don't carry one.
|
|
19
|
+
*/
|
|
20
|
+
function defaultOutputFromSchemaPath(schemaPath) {
|
|
21
|
+
const ext = extname(schemaPath);
|
|
22
|
+
if (ext.length === 0) return `${schemaPath}.json`;
|
|
23
|
+
const base = schemaPath.slice(0, -ext.length);
|
|
24
|
+
if (basename(base) === "schema") return `${base.slice(0, -6)}contract.json`;
|
|
25
|
+
return `${base}.json`;
|
|
26
|
+
}
|
|
27
|
+
function mapParseDiagnostics(diagnostics, sourceFile, sourceId) {
|
|
28
|
+
return diagnostics.map((diagnostic) => ({
|
|
29
|
+
code: diagnostic.code,
|
|
30
|
+
message: diagnostic.message,
|
|
31
|
+
sourceId,
|
|
32
|
+
span: rangeToPslSpan(diagnostic.range, sourceFile)
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
function prismaContract(schemaPath, options) {
|
|
36
|
+
return {
|
|
37
|
+
source: {
|
|
38
|
+
format: "psl",
|
|
39
|
+
inputs: [schemaPath],
|
|
40
|
+
interpret(input, context) {
|
|
41
|
+
const scalarColumnDescriptors = collectScalarTypeConstructors(context.authoringContributions.type);
|
|
42
|
+
return interpretPslDocumentToSqlContract({
|
|
43
|
+
symbolTable: input.symbolTable,
|
|
44
|
+
sourceFile: input.sourceFile,
|
|
45
|
+
sourceId: input.sourceId,
|
|
46
|
+
seedDiagnostics: [],
|
|
47
|
+
target: options.target,
|
|
48
|
+
authoringContributions: context.authoringContributions,
|
|
49
|
+
scalarColumnDescriptors,
|
|
50
|
+
...ifDefined("composedExtensions", context.composedExtensions.length > 0 ? [...context.composedExtensions] : void 0),
|
|
51
|
+
composedExtensionContracts: context.composedExtensionContracts,
|
|
52
|
+
...ifDefined("composedExtensionPackRefs", options.composedExtensionPackRefs?.length ? options.composedExtensionPackRefs : void 0),
|
|
53
|
+
controlMutationDefaults: context.controlMutationDefaults,
|
|
54
|
+
createNamespace: options.createNamespace,
|
|
55
|
+
capabilities: context.capabilities,
|
|
56
|
+
codecLookup: context.codecLookup,
|
|
57
|
+
...ifDefined("enumInferenceCodecs", options.enumInferenceCodecs)
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
async load(context) {
|
|
61
|
+
const [absoluteSchemaPath] = context.resolvedInputs;
|
|
62
|
+
if (absoluteSchemaPath === void 0) throw new InternalError("prismaContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.");
|
|
63
|
+
let schema;
|
|
64
|
+
try {
|
|
65
|
+
schema = await readFile(absoluteSchemaPath, "utf-8");
|
|
66
|
+
} catch (error) {
|
|
67
|
+
const message = String(error);
|
|
68
|
+
return notOk({
|
|
69
|
+
summary: `Failed to read Prisma schema at "${schemaPath}"`,
|
|
70
|
+
diagnostics: [{
|
|
71
|
+
code: "PSL_SCHEMA_READ_FAILED",
|
|
72
|
+
message,
|
|
73
|
+
sourceId: schemaPath
|
|
74
|
+
}],
|
|
75
|
+
meta: {
|
|
76
|
+
schemaPath,
|
|
77
|
+
absoluteSchemaPath,
|
|
78
|
+
cause: message
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const { document, sourceFile, diagnostics: parseDiagnostics } = parse(schema);
|
|
83
|
+
const { table: symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({
|
|
84
|
+
document,
|
|
85
|
+
sourceFile,
|
|
86
|
+
pslBlockDescriptors: context.authoringContributions.pslBlockDescriptors
|
|
87
|
+
});
|
|
88
|
+
const seedDiagnostics = [...mapParseDiagnostics(parseDiagnostics, sourceFile, schemaPath), ...mapParseDiagnostics(symbolTableDiagnostics, sourceFile, schemaPath)];
|
|
89
|
+
const interpreted = withSeedDiagnostics(this.interpret({
|
|
90
|
+
document,
|
|
91
|
+
sourceFile,
|
|
92
|
+
symbolTable,
|
|
93
|
+
sourceId: schemaPath
|
|
94
|
+
}, context), seedDiagnostics);
|
|
95
|
+
if (!interpreted.ok) return interpreted;
|
|
96
|
+
return ok(applySpecifierDefaultControlPolicy(interpreted.value, options.defaultControlPolicy));
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
output: options.output ?? defaultOutputFromSchemaPath(schemaPath)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { prismaContract };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=contract-psl__provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToSqlContract } from \"./interpreter-5WgpL-ax.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, rangeToPslSpan } from \"@internal/psl-parser\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { readFile } from \"node:fs/promises\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { basename, extname } from \"pathe\";\n//#region src/provider.ts\n/**\n* Derives the emit output path from the schema input path so artefacts land\n* colocated with the source (e.g. `src/contract/schema.prisma` →\n* `src/contract/contract.json`). The provider owns this because it is the\n* only layer that knows the input path; the upstream `normalizeContractConfig`\n* default is a last-resort fallback for providers that don't carry one.\n*/\nfunction defaultOutputFromSchemaPath(schemaPath) {\n\tconst ext = extname(schemaPath);\n\tif (ext.length === 0) return `${schemaPath}.json`;\n\tconst base = schemaPath.slice(0, -ext.length);\n\tif (basename(base) === \"schema\") return `${base.slice(0, -6)}contract.json`;\n\treturn `${base}.json`;\n}\nfunction mapParseDiagnostics(diagnostics, sourceFile, sourceId) {\n\treturn diagnostics.map((diagnostic) => ({\n\t\tcode: diagnostic.code,\n\t\tmessage: diagnostic.message,\n\t\tsourceId,\n\t\tspan: rangeToPslSpan(diagnostic.range, sourceFile)\n\t}));\n}\nfunction prismaContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\tconst scalarColumnDescriptors = collectScalarTypeConstructors(context.authoringContributions.type);\n\t\t\t\treturn interpretPslDocumentToSqlContract({\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsourceFile: input.sourceFile,\n\t\t\t\t\tsourceId: input.sourceId,\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\tscalarColumnDescriptors,\n\t\t\t\t\t...ifDefined(\"composedExtensions\", context.composedExtensions.length > 0 ? [...context.composedExtensions] : void 0),\n\t\t\t\t\tcomposedExtensionContracts: context.composedExtensionContracts,\n\t\t\t\t\t...ifDefined(\"composedExtensionPackRefs\", options.composedExtensionPackRefs?.length ? options.composedExtensionPackRefs : void 0),\n\t\t\t\t\tcontrolMutationDefaults: context.controlMutationDefaults,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tcapabilities: context.capabilities,\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options.enumInferenceCodecs)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst [absoluteSchemaPath] = context.resolvedInputs;\n\t\t\t\tif (absoluteSchemaPath === void 0) throw new InternalError(\"prismaContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tlet schema;\n\t\t\t\ttry {\n\t\t\t\t\tschema = await readFile(absoluteSchemaPath, \"utf-8\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error);\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: `Failed to read Prisma schema at \"${schemaPath}\"`,\n\t\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}],\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tschemaPath,\n\t\t\t\t\t\t\tabsoluteSchemaPath,\n\t\t\t\t\t\t\tcause: message\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst { document, sourceFile, diagnostics: parseDiagnostics } = parse(schema);\n\t\t\t\tconst { table: symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tpslBlockDescriptors: context.authoringContributions.pslBlockDescriptors\n\t\t\t\t});\n\t\t\t\tconst seedDiagnostics = [...mapParseDiagnostics(parseDiagnostics, sourceFile, schemaPath), ...mapParseDiagnostics(symbolTableDiagnostics, sourceFile, schemaPath)];\n\t\t\t\tconst interpreted = withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t}, context), seedDiagnostics);\n\t\t\t\tif (!interpreted.ok) return interpreted;\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(interpreted.value, options.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\toutput: options.output ?? defaultOutputFromSchemaPath(schemaPath)\n\t};\n}\n//#endregion\nexport { prismaContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,4BAA4B,YAAY;CAChD,MAAM,MAAM,QAAQ,UAAU;CAC9B,IAAI,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AAK;KAC5B,OAAO,MAAM;MACZ,SAAS,oCAAoC,WAAW;MACxD,aAAa,CAAC;OACb,MAAM;OACN;OACA,UAAU;MACX,CAAC;MACD,MAAM;OACL;OACA;OACA,OAAO;MACR;KACD,CAAC;IACF;IACA,MAAM,EAAE,UAAU,YAAY,aAAa,qBAAqB,MAAM,MAAM;IAC5E,MAAM,EAAE,OAAO,aAAa,aAAa,2BAA2B,iBAAiB;KACpF;KACA;KACA,qBAAqB,QAAQ,uBAAuB;IACrD,CAAC;IACD,MAAM,kBAAkB,CAAC,GAAG,oBAAoB,kBAAkB,YAAY,UAAU,GAAG,GAAG,oBAAoB,wBAAwB,YAAY,UAAU,CAAC;IACjK,MAAM,cAAc,oBAAoB,KAAK,UAAU;KACtD;KACA;KACA;KACA,UAAU;IACX,GAAG,OAAO,GAAG,eAAe;IAC5B,IAAI,CAAC,YAAY,IAAI,OAAO;IAC5B,OAAO,GAAG,mCAAmC,YAAY,OAAO,QAAQ,oBAAoB,CAAC;GAC9F;EACD;EACA,QAAQ,QAAQ,UAAU,4BAA4B,UAAU;CACjE;AACD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as typescriptContractFromPath, n as emptyContract, r as typescriptContract, t as ContractConfig } from "./config-types-47qB33rW.mjs";
|
|
2
|
+
import { A as field, C as bindEnumType, D as defineContract, E as buildSqlContractFromDefinition, M as model, N as rel, O as enumType, S as UniqueConstraintNode, T as buildContractDefinition, _ as ModelNode, a as ComposedAuthoringHelpers, b as ScalarFieldBuilder, c as ContractModelBuilder, d as ExtractCodecTypesFromPack, f as FieldNode, g as ModelLike, h as MergeEnums, i as CodecTypeMap, j as member, k as extensionModel, l as EnumMember, m as IndexNode, n as BoundEnumType, o as ContractDefinition, p as ForeignKeyNode, r as CodecInput, s as ContractInput, t as AttachedEntities, u as EnumTypeHandle, v as PrimaryKeyNode, w as buildBoundContract, x as TargetFieldRef, y as RelationNode } from "./contract-builder-MvJJrQ-5.mjs";
|
|
3
|
+
export { type AttachedEntities, type BoundEnumType, type CodecInput, type CodecTypeMap, type ComposedAuthoringHelpers, type ContractConfig, type ContractDefinition, type ContractInput, type ContractModelBuilder, type EnumMember, type EnumTypeHandle, type ExtractCodecTypesFromPack, type FieldNode, type ForeignKeyNode, type IndexNode, type MergeEnums, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type TargetFieldRef, type UniqueConstraintNode, bindEnumType, buildBoundContract, buildContractDefinition, buildSqlContractFromDefinition, defineContract, emptyContract, enumType, extensionModel, field, member, model, rel, typescriptContract, typescriptContractFromPath };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as buildSqlContractFromDefinition } from "./build-contract-DBCz_YSs-DO0wMHai.mjs";
|
|
2
|
+
import { a as enumType, c as member, i as defineContract, l as model, n as buildBoundContract, o as extensionModel, r as buildContractDefinition, s as field, t as bindEnumType, u as rel } from "./contract-builder-YjMQcvZ1.mjs";
|
|
3
|
+
import { n as typescriptContract, r as typescriptContractFromPath, t as emptyContract } from "./config-types-N7PJc6VN.mjs";
|
|
4
|
+
export { bindEnumType, buildBoundContract, buildContractDefinition, buildSqlContractFromDefinition, defineContract, emptyContract, enumType, extensionModel, field, member, model, rel, typescriptContract, typescriptContractFromPath };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as field, C as bindEnumType, D as defineContract, E as buildSqlContractFromDefinition, M as model, N as rel, O as enumType, S as UniqueConstraintNode, T as buildContractDefinition, _ as ModelNode, a as ComposedAuthoringHelpers, b as ScalarFieldBuilder, c as ContractModelBuilder, d as ExtractCodecTypesFromPack, f as FieldNode, g as ModelLike, h as MergeEnums, i as CodecTypeMap, j as member, k as extensionModel, l as EnumMember, m as IndexNode, n as BoundEnumType, o as ContractDefinition, p as ForeignKeyNode, r as CodecInput, s as ContractInput, t as AttachedEntities, u as EnumTypeHandle, v as PrimaryKeyNode, w as buildBoundContract, x as TargetFieldRef, y as RelationNode } from "./contract-builder-MvJJrQ-5.mjs";
|
|
2
|
+
export { type AttachedEntities, type BoundEnumType, type CodecInput, type CodecTypeMap, type ComposedAuthoringHelpers, type ContractDefinition, type ContractInput, type ContractModelBuilder, type EnumMember, type EnumTypeHandle, type ExtractCodecTypesFromPack, type FieldNode, type ForeignKeyNode, type IndexNode, type MergeEnums, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type TargetFieldRef, type UniqueConstraintNode, bindEnumType, buildBoundContract, buildContractDefinition, buildSqlContractFromDefinition, defineContract, enumType, extensionModel, field, member, model, rel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { t as buildSqlContractFromDefinition } from "./build-contract-DBCz_YSs-DO0wMHai.mjs";
|
|
2
|
+
import { a as enumType, c as member, i as defineContract, l as model, n as buildBoundContract, o as extensionModel, r as buildContractDefinition, s as field, t as bindEnumType, u as rel } from "./contract-builder-YjMQcvZ1.mjs";
|
|
3
|
+
export { bindEnumType, buildBoundContract, buildContractDefinition, buildSqlContractFromDefinition, defineContract, enumType, extensionModel, field, member, model, rel };
|