@prisma/orm-family-sql 8.0.0-rc.1-dev.46 → 8.0.0-rc.10-dev.1
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/README.md +2 -6
- package/dist/{ast-Lbl4VwqP.mjs → ast-5tg0fGPQ.mjs} +2 -58
- package/dist/ast-5tg0fGPQ.mjs.map +1 -0
- package/dist/{ast-HFcfQZr-.d.mts → ast-DuLukI6f.d.mts} +4 -36
- package/dist/ast-DuLukI6f.d.mts.map +1 -0
- package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BEvfamnI.mjs} +2 -2
- package/dist/{authored-check-naming-Hf9990DV.mjs.map → authored-check-naming-BEvfamnI.mjs.map} +1 -1
- package/dist/{authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs → authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs} +10 -4
- package/dist/authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map +1 -0
- package/dist/builder.d.mts +3 -3
- package/dist/builder__runtime.d.mts +26 -9
- package/dist/builder__runtime.d.mts.map +1 -1
- package/dist/builder__runtime.mjs +18 -9
- package/dist/builder__runtime.mjs.map +1 -1
- package/dist/builder__types.d.mts +3 -3
- package/dist/{codec-descriptor-registry-N0dhtKaH.mjs → codec-descriptor-registry-ECZ4ohtG.mjs} +2 -2
- package/dist/{codec-descriptor-registry-N0dhtKaH.mjs.map → codec-descriptor-registry-ECZ4ohtG.mjs.map} +1 -1
- package/dist/{config-types-gAm54C_v.mjs → config-types-BNJgLUUQ.mjs} +2 -2
- package/dist/{config-types-gAm54C_v.mjs.map → config-types-BNJgLUUQ.mjs.map} +1 -1
- package/dist/{config-types-D9fdKG3g.d.mts → config-types-Bd3ud-mX.d.mts} +3 -3
- package/dist/{config-types-D9fdKG3g.d.mts.map → config-types-Bd3ud-mX.d.mts.map} +1 -1
- package/dist/{contract-builder-D4a5dT7j.mjs → contract-builder-BOmEsrRi.mjs} +24 -5
- package/dist/contract-builder-BOmEsrRi.mjs.map +1 -0
- package/dist/{contract-builder-CG_tGDbB.d.mts → contract-builder-De_sioHE.d.mts} +15 -3
- package/dist/contract-builder-De_sioHE.d.mts.map +1 -0
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-psl.d.mts +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +77 -0
- package/dist/contract-psl__attribute-specs.d.mts.map +1 -0
- package/dist/contract-psl__attribute-specs.mjs +2 -0
- package/dist/contract-psl__provider.d.mts +1 -1
- package/dist/contract-psl__provider.mjs +3 -3
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +3 -3
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.d.mts +1 -1
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +2 -2
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +3 -3
- package/dist/contract.mjs +6 -6
- package/dist/contract__authored-check-naming.mjs +1 -1
- package/dist/contract__foreign-key-materialization.mjs +1 -1
- package/dist/contract__index-naming.mjs +1 -1
- package/dist/contract__types.d.mts +2 -2
- package/dist/contract__types.mjs +2 -2
- package/dist/contract__validators.d.mts +2 -2
- package/dist/contract__validators.mjs +2 -2
- package/dist/{control-D3cB5YQp.mjs → control-BIIMOKMy.mjs} +11 -9
- package/dist/control-BIIMOKMy.mjs.map +1 -0
- package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts → control-adapter-C99J7aEF-GODO43Ai.d.mts} +5 -5
- package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts.map → control-adapter-C99J7aEF-GODO43Ai.d.mts.map} +1 -1
- package/dist/control-adapter-DzTFiMaG.d.mts +1 -0
- package/dist/{control-DTLJ1WtZ.d.mts → control-b-6t8eI_.d.mts} +138 -19
- package/dist/control-b-6t8eI_.d.mts.map +1 -0
- package/dist/{db-D18PrXKW-DvTv4JFn.d.mts → db-BhQdL6Za-DubRGJvv.d.mts} +86 -62
- package/dist/{db-D18PrXKW-DvTv4JFn.d.mts.map → db-BhQdL6Za-DubRGJvv.d.mts.map} +1 -1
- package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts → ddl-types-CXx4vPz6-Dko-GTTj.d.mts} +3 -3
- package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts.map → ddl-types-CXx4vPz6-Dko-GTTj.d.mts.map} +1 -1
- package/dist/{derived-checks-DFMRmiAu-DGfB8aS4.mjs → derived-checks-DGjY5t7S-B3txNm7X.mjs} +48 -15
- package/dist/derived-checks-DGjY5t7S-B3txNm7X.mjs.map +1 -0
- package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DPdD01O0-DNBs1ZDA.d.mts} +2 -2
- package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts.map → derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map} +1 -1
- package/dist/{diff-DbTNVm2f.d.mts → diff-CN1ou7vM.d.mts} +5 -5
- package/dist/{diff-DbTNVm2f.d.mts.map → diff-CN1ou7vM.d.mts.map} +1 -1
- package/dist/{dist-ZK6oeI5e.mjs → dist-D5__KJs-.mjs} +2 -1
- package/dist/dist-D5__KJs-.mjs.map +1 -0
- package/dist/{expression-CX5mTA-z.mjs → expression-B2Ox7zKM.mjs} +6 -2
- package/dist/expression-B2Ox7zKM.mjs.map +1 -0
- package/dist/{expression-FJK6Ar-d.d.mts → expression-mku9I7Ue.d.mts} +16 -7
- package/dist/{expression-FJK6Ar-d.d.mts.map → expression-mku9I7Ue.d.mts.map} +1 -1
- package/dist/family.d.mts +10 -10
- package/dist/family.mjs +8 -8
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +4 -4
- package/dist/family__control.mjs +4 -4
- package/dist/family__diff.d.mts +2 -2
- package/dist/family__diff.mjs +1 -1
- package/dist/family__ir.d.mts +1 -1
- package/dist/family__ir.mjs +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +72 -0
- package/dist/family__pack.d.mts.map +1 -1
- package/dist/family__pack.mjs +4 -2
- package/dist/family__pack.mjs.map +1 -1
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/family__runtime.mjs +1 -1
- package/dist/family__verify.mjs +1 -1
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs → foreign-key-materialization-0TrwfShD.mjs} +2 -2
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs.map → foreign-key-materialization-0TrwfShD.mjs.map} +1 -1
- package/dist/{index-C5I8D-MB.d.mts → index-CLAshwKN.d.mts} +2 -2
- package/dist/{index-C5I8D-MB.d.mts.map → index-CLAshwKN.d.mts.map} +1 -1
- package/dist/{index-C-vQOMY_.d.mts → index-DzBzeTAy.d.mts} +10 -10
- package/dist/{index-C-vQOMY_.d.mts.map → index-DzBzeTAy.d.mts.map} +1 -1
- package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-fQMLqyC4-4FzPVtCR.mjs} +4 -4
- package/dist/index-naming-fQMLqyC4-4FzPVtCR.mjs.map +1 -0
- package/dist/{interpreter-DyiUUAWh-DYdjIpiE.mjs → interpreter-CZ_iVQV4-CJ6COgSE.mjs} +123 -302
- package/dist/interpreter-CZ_iVQV4-CJ6COgSE.mjs.map +1 -0
- package/dist/ir-I-xciGUH.mjs.map +1 -1
- package/dist/{ir-Bghjt-FG.d.mts → ir-R9GE8gsm.d.mts} +2 -2
- package/dist/{ir-Bghjt-FG.d.mts.map → ir-R9GE8gsm.d.mts.map} +1 -1
- package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts → middleware-AhTz1BOW-CtQWS4mb.d.mts} +2 -2
- package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts.map → middleware-AhTz1BOW-CtQWS4mb.d.mts.map} +1 -1
- package/dist/middleware-Cev-ZFyS.d.mts +1 -0
- package/dist/{migration-CjDRZNep.d.mts → migration-Bhce5i_m.d.mts} +3 -3
- package/dist/{migration-CjDRZNep.d.mts.map → migration-Bhce5i_m.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +131 -95
- package/dist/orm-client.d.mts.map +1 -1
- package/dist/orm-client.mjs +1021 -942
- package/dist/orm-client.mjs.map +1 -1
- package/dist/plan-C7VP7jOh.d.mts +2 -0
- package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts → plan-CDxduYaN-B2kMLIQQ.d.mts} +3 -3
- package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts.map → plan-CDxduYaN-B2kMLIQQ.d.mts.map} +1 -1
- package/dist/{prepared-statement-9QpkE6JG-C430V3MO.d.mts → prepared-statement-9QpkE6JG-B9xqBu5T.d.mts} +16 -16
- package/dist/{prepared-statement-9QpkE6JG-C430V3MO.d.mts.map → prepared-statement-9QpkE6JG-B9xqBu5T.d.mts.map} +1 -1
- package/dist/{psl-infer-Dk5kgKre.mjs → psl-infer-TBwKfKgU.mjs} +2 -2
- package/dist/{psl-infer-Dk5kgKre.mjs.map → psl-infer-TBwKfKgU.mjs.map} +1 -1
- package/dist/query-lane-context-CGdMIEuv.d.mts +1 -0
- package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts} +4 -4
- package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts.map} +1 -1
- package/dist/relational-core.d.mts +12 -12
- package/dist/relational-core.mjs +3 -3
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +4 -4
- package/dist/relational-core__ast.mjs +2 -2
- package/dist/relational-core__codec-descriptor-registry.d.mts +3 -3
- package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
- package/dist/relational-core__contract-free.d.mts +3 -3
- package/dist/relational-core__expression.d.mts +1 -1
- package/dist/relational-core__expression.mjs +1 -1
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__plan.d.mts +3 -3
- package/dist/relational-core__query-lane-context.d.mts +2 -2
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/{runtime-DpKF2Yu2.d.mts → runtime-CzCx0TKe.d.mts} +3 -3
- package/dist/{runtime-DpKF2Yu2.d.mts.map → runtime-CzCx0TKe.d.mts.map} +1 -1
- package/dist/{runtime-tIHpGCcG.mjs → runtime-PknWErjr.mjs} +2 -2
- package/dist/{runtime-tIHpGCcG.mjs.map → runtime-PknWErjr.mjs.map} +1 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +2 -2
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts → schema-differ-DpG_gnur-BICVtTHY.d.mts} +2 -2
- package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts.map → schema-differ-DpG_gnur-BICVtTHY.d.mts.map} +1 -1
- package/dist/schema-ir.mjs +1 -1
- package/dist/schema-ir__types.mjs +1 -1
- package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs → schema-verify-C_PEdlAr-CmXrFuW1.mjs} +2 -2
- package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map → schema-verify-C_PEdlAr-CmXrFuW1.mjs.map} +1 -1
- package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs +275 -0
- package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs.map +1 -0
- package/dist/{sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs → sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs} +24 -5
- package/dist/sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs.map +1 -0
- package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts → sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts} +2 -2
- package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts.map → sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts.map} +1 -1
- package/dist/{timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs → timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs} +27 -19
- package/dist/timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs.map +1 -0
- package/dist/{types-4YenawkP-CwaaZSid.mjs → types-BvupgHcG-c8QDupnu.mjs} +13 -6
- package/dist/types-BvupgHcG-c8QDupnu.mjs.map +1 -0
- package/dist/{types-UcHa2cTe.d.mts → types-C36_3E6_.d.mts} +3 -2
- package/dist/types-C36_3E6_.d.mts.map +1 -0
- package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts → types-CyxGtOOh-BJnoWm0f.d.mts} +8 -8
- package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts.map → types-CyxGtOOh-BJnoWm0f.d.mts.map} +1 -1
- package/dist/{types-CUsJrvEl.mjs → types-D0B65hip.mjs} +3 -2
- package/dist/types-D0B65hip.mjs.map +1 -0
- package/dist/types-DvsoMNLs.d.mts +1 -0
- package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts → types-IqZMLrFC-BIRftuU7.d.mts} +4 -4
- package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts.map → types-IqZMLrFC-BIRftuU7.d.mts.map} +1 -1
- package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts → types-v3qxLLxo-Clw_yBAh.d.mts} +2 -2
- package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts.map → types-v3qxLLxo-Clw_yBAh.d.mts.map} +1 -1
- package/dist/{validators-Belo8QqM.d.mts → validators-CbqMxQfW.d.mts} +23 -4
- package/dist/validators-CbqMxQfW.d.mts.map +1 -0
- package/dist/{validators-CrWD6bSP.mjs → validators-DD98VrpC.mjs} +0 -0
- package/dist/validators-DD98VrpC.mjs.map +1 -0
- package/dist/{verify-u0UTdZgD-DSAaz9rW.mjs → verify-ChiDeTk8-HEewdjrM.mjs} +3 -3
- package/dist/verify-ChiDeTk8-HEewdjrM.mjs.map +1 -0
- package/package.json +20 -21
- package/dist/ast-HFcfQZr-.d.mts.map +0 -1
- package/dist/ast-Lbl4VwqP.mjs.map +0 -1
- package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs.map +0 -1
- package/dist/contract-builder-CG_tGDbB.d.mts.map +0 -1
- package/dist/contract-builder-D4a5dT7j.mjs.map +0 -1
- package/dist/control-D3cB5YQp.mjs.map +0 -1
- package/dist/control-DTLJ1WtZ.d.mts.map +0 -1
- package/dist/control-adapter-MZJQiwcE.d.mts +0 -1
- package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs.map +0 -1
- package/dist/dist-ZK6oeI5e.mjs.map +0 -1
- package/dist/expression-CX5mTA-z.mjs.map +0 -1
- package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
- package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +0 -1
- package/dist/lane-query-builder.d.mts +0 -236
- package/dist/lane-query-builder.d.mts.map +0 -1
- package/dist/lane-query-builder.mjs +0 -67
- package/dist/lane-query-builder.mjs.map +0 -1
- package/dist/middleware--TtoxUiW.d.mts +0 -1
- package/dist/plan-BHLdb0Z7.d.mts +0 -2
- package/dist/query-lane-context-XMvk7fmY.d.mts +0 -1
- package/dist/sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map +0 -1
- package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +0 -1
- package/dist/types-4YenawkP-CwaaZSid.mjs.map +0 -1
- package/dist/types-B0msOnBM.d.mts +0 -1
- package/dist/types-CUsJrvEl.mjs.map +0 -1
- package/dist/types-UcHa2cTe.d.mts.map +0 -1
- package/dist/validators-Belo8QqM.d.mts.map +0 -1
- package/dist/validators-CrWD6bSP.mjs.map +0 -1
- package/dist/verify-u0UTdZgD-DSAaz9rW.mjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as computeCheckContentHash, r as composeCheckWirePrefix, s as derivedCheckPrefixes } from "./naming-DKr4TJd7-Cszhq9RV.mjs";
|
|
2
|
-
import { n as lowerAuthoredIndex } from "./index-naming-
|
|
3
|
-
import { t as lowerAuthoredCheck } from "./authored-check-naming-
|
|
2
|
+
import { n as lowerAuthoredIndex } from "./index-naming-fQMLqyC4-4FzPVtCR.mjs";
|
|
3
|
+
import { t as lowerAuthoredCheck } from "./authored-check-naming-BEvfamnI.mjs";
|
|
4
4
|
import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-dmXkOR4a.mjs";
|
|
5
5
|
import { c as StorageTable, i as Index, t as CheckConstraint } from "./storage-table-ZzbR-xzQ-BRoTQE_2.mjs";
|
|
6
6
|
import { n as checkConstraintInputFromSerialized } from "./serialized-index-nBTwanKy-_ddEK4tk.mjs";
|
|
7
7
|
import { m as valueSetEntityKind, p as tableEntityKind } from "./entity-kinds-D7vwoN_T-CCBwFJy0.mjs";
|
|
8
|
-
import { r as materializeForeignKeysAndIndexes } from "./foreign-key-materialization-
|
|
8
|
+
import { r as materializeForeignKeysAndIndexes } from "./foreign-key-materialization-0TrwfShD.mjs";
|
|
9
9
|
import { t as validateIndexTypes } from "./index-type-validation-COH4d78M.mjs";
|
|
10
10
|
import { t as createIndexTypeRegistry } from "./index-types-DJQ_xwaE.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { c as isMaterializedSqlNamespace, d as toStorageTypeInstance, o as SqlStorage, s as applyFkDefaults } from "./types-D0B65hip.mjs";
|
|
12
|
+
import { d as validateStorageSemantics } from "./validators-DD98VrpC.mjs";
|
|
13
13
|
import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-Di9JZ0X7.mjs";
|
|
14
14
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
15
15
|
import { flushAuthoringWarnings, isAuthoringEntityTypeDescriptor } from "@prisma/orm-framework/components/authoring";
|
|
@@ -18,14 +18,17 @@ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
|
18
18
|
import { asNamespaceId, coreHash, crossRef, effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
19
19
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
20
20
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
21
|
+
import { mergeCapabilityMatrices, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
|
|
21
22
|
import { computeExecutionHash, computeProfileHash, computeStorageHash } from "@prisma/orm-framework/contract/hashing";
|
|
22
|
-
import { mergeCapabilityMatrices } from "@prisma/orm-framework/contract-authoring";
|
|
23
23
|
import { applySpecifierDefaultControlPolicy } from "@prisma/orm-framework/contract/apply-specifier-default-control-policy";
|
|
24
24
|
import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
25
|
-
//#region ../../../2-sql/2-authoring/contract-ts/dist/derived-checks-
|
|
25
|
+
//#region ../../../2-sql/2-authoring/contract-ts/dist/derived-checks-DGjY5t7S.mjs
|
|
26
26
|
function contractError(code, message, options) {
|
|
27
27
|
return structuredError(code, message, options);
|
|
28
28
|
}
|
|
29
|
+
function toOneNullabilityContradictionMessage(location, contradiction) {
|
|
30
|
+
return contradiction === "declared-optional" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`;
|
|
31
|
+
}
|
|
29
32
|
function encodeViaCodec(value, codecId, codecLookup) {
|
|
30
33
|
const codec = codecLookup?.get(codecId);
|
|
31
34
|
if (codec) return codec.encodeJson(value);
|
|
@@ -135,16 +138,19 @@ function resolveCheckExpressionRenderer(target) {
|
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
140
|
* The member values a membership check must enforce, encoded exactly as the
|
|
138
|
-
* column stores them.
|
|
139
|
-
* numeric enum fails here rather than emitting a wrong text-shaped check.
|
|
141
|
+
* column stores them. Membership predicates support strings and finite numbers.
|
|
140
142
|
*/
|
|
141
143
|
function checkMemberValues(handle, codecLookup) {
|
|
142
144
|
const encoded = handle.values.map((value) => encodeViaCodec(value, handle.codecId, codecLookup));
|
|
143
145
|
const values = [];
|
|
144
146
|
for (const value of encoded) {
|
|
145
|
-
if (typeof value !== "string") throw contractError("CONTRACT.ENUM_INVALID", `enumType("${handle.enumName}"):
|
|
147
|
+
if (typeof value !== "string" && !(typeof value === "number" && Number.isFinite(value))) throw contractError("CONTRACT.ENUM_INVALID", `enumType("${handle.enumName}"): CHECK constraint members must encode to strings or finite numbers.`, { meta: {
|
|
148
|
+
enumName: handle.enumName,
|
|
149
|
+
reason: "unsupported-member-value"
|
|
150
|
+
} });
|
|
151
|
+
if (typeof value !== typeof encoded[0]) throw contractError("CONTRACT.ENUM_INVALID", `enumType("${handle.enumName}"): CHECK constraint members must encode to the same primitive type; mixed strings and numbers are not supported.`, { meta: {
|
|
146
152
|
enumName: handle.enumName,
|
|
147
|
-
reason: "
|
|
153
|
+
reason: "mixed-member-types"
|
|
148
154
|
} });
|
|
149
155
|
values.push(value);
|
|
150
156
|
}
|
|
@@ -302,6 +308,26 @@ function resolveModelNamespaceId(model, modelNameToNamespaceId, defaultNamespace
|
|
|
302
308
|
if (model.namespaceId !== void 0 && model.namespaceId.length > 0) return model.namespaceId;
|
|
303
309
|
return modelNameToNamespaceId.get(model.modelName) ?? defaultNamespaceId;
|
|
304
310
|
}
|
|
311
|
+
function toOneRelationNullable(semanticModel, relation) {
|
|
312
|
+
const location = `Relation "${semanticModel.modelName}.${relation.fieldName}"`;
|
|
313
|
+
if (relation.nullable === void 0) throw contractError("CONTRACT.RELATION_INVALID", `${location} with cardinality "${relation.cardinality}" must state whether it is nullable`, { meta: {
|
|
314
|
+
modelName: semanticModel.modelName,
|
|
315
|
+
relationName: relation.fieldName,
|
|
316
|
+
reason: "to-one-nullability-missing"
|
|
317
|
+
} });
|
|
318
|
+
const localColumns = relation.on.parentColumns;
|
|
319
|
+
const { contradiction } = resolveToOneRelationNullable({
|
|
320
|
+
declaredNullable: relation.nullable,
|
|
321
|
+
localFieldNullability: semanticModel.fields.filter((field) => localColumns.includes(field.columnName)).map((field) => field.nullable),
|
|
322
|
+
ownsReference: relation.cardinality === "N:1"
|
|
323
|
+
});
|
|
324
|
+
if (contradiction !== void 0) throw contractError("CONTRACT.RELATION_INVALID", relation.cardinality === "N:1" ? toOneNullabilityContradictionMessage(location, contradiction) : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, { meta: {
|
|
325
|
+
modelName: semanticModel.modelName,
|
|
326
|
+
relationName: relation.fieldName,
|
|
327
|
+
reason: "to-one-nullability-mismatch"
|
|
328
|
+
} });
|
|
329
|
+
return relation.nullable;
|
|
330
|
+
}
|
|
305
331
|
function buildThroughDescriptor(through, tableNamespaceByName, targetModel, modelName, fieldName, defaultNamespaceId) {
|
|
306
332
|
if (!tableNamespaceByName.has(through.table)) throw contractError("CONTRACT.MODEL_UNKNOWN", `buildSqlContractFromDefinition: junction table "${through.table}" for relation "${modelName}.${fieldName}" is not a declared model.`, { meta: {
|
|
307
333
|
sourceModel: modelName,
|
|
@@ -721,6 +747,7 @@ function buildSqlContractFromDefinition(definition, codecLookup) {
|
|
|
721
747
|
modelRelations[relation.fieldName] = {
|
|
722
748
|
to: crossRef(relation.toModel, targetNamespaceId, relation.spaceId),
|
|
723
749
|
cardinality: "N:1",
|
|
750
|
+
nullable: toOneRelationNullable(semanticModel, relation),
|
|
724
751
|
on: {
|
|
725
752
|
localFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),
|
|
726
753
|
targetFields: relation.on.childColumns
|
|
@@ -748,9 +775,15 @@ function buildSqlContractFromDefinition(definition, codecLookup) {
|
|
|
748
775
|
on,
|
|
749
776
|
through: buildThroughDescriptor(relation.through, tableNamespaceByName, targetModel, semanticModel.modelName, relation.fieldName, defaultNamespaceId)
|
|
750
777
|
};
|
|
751
|
-
} else modelRelations[relation.fieldName] = {
|
|
778
|
+
} else if (relation.cardinality === "1:N") modelRelations[relation.fieldName] = {
|
|
779
|
+
to,
|
|
780
|
+
cardinality: "1:N",
|
|
781
|
+
on
|
|
782
|
+
};
|
|
783
|
+
else modelRelations[relation.fieldName] = {
|
|
752
784
|
to,
|
|
753
785
|
cardinality: relation.cardinality,
|
|
786
|
+
nullable: toOneRelationNullable(semanticModel, relation),
|
|
754
787
|
on
|
|
755
788
|
};
|
|
756
789
|
}
|
|
@@ -953,7 +986,7 @@ function applySqlSpecifierControlPolicy(contract, defaultControlPolicy, createNa
|
|
|
953
986
|
*
|
|
954
987
|
* Why derivation stops at the namespace boundary: the contract *describes* an
|
|
955
988
|
* external schema, it does not *prescribe* enforcement for it. Deriving a check
|
|
956
|
-
* for a table Prisma
|
|
989
|
+
* for a table Prisma 8 never creates declares a constraint the live database
|
|
957
990
|
* has no reason to carry, and `external` fails verify on a declared shape the
|
|
958
991
|
* database lacks — an unfixable failure, since no plan may emit DDL there
|
|
959
992
|
* either.
|
|
@@ -1052,6 +1085,6 @@ function withoutDerivedChecks(tableName, table, contractDefault) {
|
|
|
1052
1085
|
});
|
|
1053
1086
|
}
|
|
1054
1087
|
//#endregion
|
|
1055
|
-
export { buildSqlContractFromDefinition as n, contractError as r, applySqlSpecifierControlPolicy as t };
|
|
1088
|
+
export { toOneNullabilityContradictionMessage as i, buildSqlContractFromDefinition as n, contractError as r, applySqlSpecifierControlPolicy as t };
|
|
1056
1089
|
|
|
1057
|
-
//# sourceMappingURL=derived-checks-
|
|
1090
|
+
//# sourceMappingURL=derived-checks-DGjY5t7S-B3txNm7X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-checks-DGjY5t7S-B3txNm7X.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/derived-checks-DGjY5t7S.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { computeExecutionHash, computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { asNamespaceId, coreHash, crossRef, effectiveControlPolicy } from \"@internal/contract/types\";\nimport { mergeCapabilityMatrices, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { flushAuthoringWarnings, isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { lowerAuthoredCheck } from \"@internal/sql-contract/authored-check-naming\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { tableEntityKind, valueSetEntityKind } from \"@internal/sql-contract/entity-kinds\";\nimport { materializeForeignKeysAndIndexes } from \"@internal/sql-contract/foreign-key-materialization\";\nimport { lowerAuthoredIndex } from \"@internal/sql-contract/index-naming\";\nimport { validateIndexTypes } from \"@internal/sql-contract/index-type-validation\";\nimport { createIndexTypeRegistry } from \"@internal/sql-contract/index-types\";\nimport { CheckConstraint, Index, SqlStorage, StorageTable, applyFkDefaults, checkConstraintInputFromSerialized, isMaterializedSqlNamespace, toStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { validateStorageSemantics } from \"@internal/sql-contract/validators\";\nimport { deriveValueSetFromEntity } from \"@internal/sql-contract/value-set-derivation-hook\";\nimport { composeCheckWirePrefix, computeCheckContentHash, derivedCheckPrefixes } from \"@internal/sql-schema-ir/naming\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/to-one-nullability-message.ts\nfunction toOneNullabilityContradictionMessage(location, contradiction) {\n\treturn contradiction === \"declared-optional\" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`;\n}\n//#endregion\n//#region src/build-contract.ts\nfunction encodeViaCodec(value, codecId, codecLookup) {\n\tconst codec = codecLookup?.get(codecId);\n\tif (codec) return codec.encodeJson(value);\n\treturn blindCast(value);\n}\nfunction encodeColumnDefault(defaultInput, codecId, codecLookup, many = false) {\n\tif (defaultInput.kind === \"function\") return {\n\t\tkind: \"function\",\n\t\texpression: defaultInput.expression\n\t};\n\tif (many) {\n\t\tif (!Array.isArray(defaultInput.value)) throw new InternalError(`Literal default on a list column must be an array; received ${typeof defaultInput.value}. A scalar default on a list field must be rejected at the authoring surface.`);\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: defaultInput.value.map((element) => encodeViaCodec(element, codecId, codecLookup))\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: encodeViaCodec(defaultInput.value, codecId, codecLookup)\n\t};\n}\nfunction assertStorageSemantics(definition, contract) {\n\tconst semanticErrors = validateStorageSemantics(contract.storage);\n\tif (semanticErrors.length > 0) throw contractError(\"CONTRACT.VALIDATION_FAILED\", `Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, { meta: { errors: semanticErrors } });\n\tconst indexTypeRegistry = createIndexTypeRegistry();\n\tconst packsToRegister = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const pack of packsToRegister) {\n\t\tconst registration = pack.indexTypes;\n\t\tif (registration === void 0) continue;\n\t\tif (typeof registration !== \"object\" || registration === null || !Array.isArray(registration.entries)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack \"${pack.id ?? \"<unknown>\"}\" declares \"indexTypes\" but its value is not an IndexTypeRegistration (expected an object with an \"entries\" array; got ${typeof registration}).`, { meta: {\n\t\t\tpackId: pack.id,\n\t\t\tcontribution: \"indexTypes\",\n\t\t\treason: \"invalid-shape\"\n\t\t} });\n\t\tfor (const entry of registration.entries) indexTypeRegistry.register(entry);\n\t}\n\tvalidateIndexTypes(contract, indexTypeRegistry);\n}\nfunction assertKnownTargetModel(modelsByName, modelsByCoordinate, sourceModelName, targetModelName, targetNamespaceId, context) {\n\tconst targetModel = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? modelsByCoordinate.get(`${targetNamespaceId}:${targetModelName}`) : modelsByName.get(targetModelName);\n\tif (!targetModel) {\n\t\tconst qualified = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? `${targetNamespaceId}.${targetModelName}` : targetModelName;\n\t\tthrow contractError(\"CONTRACT.MODEL_UNKNOWN\", `${context} on model \"${sourceModelName}\" references unknown model \"${qualified}\"`, { meta: {\n\t\t\tsourceModel: sourceModelName,\n\t\t\ttargetModel: qualified,\n\t\t\tcontext\n\t\t} });\n\t}\n\treturn targetModel;\n}\nfunction assertTargetTableMatches(sourceModelName, targetModel, referencedTableName, context) {\n\tif (targetModel.tableName !== referencedTableName) throw contractError(\"CONTRACT.TABLE_MISMATCH\", `${context} on model \"${sourceModelName}\" references table \"${referencedTableName}\" but model \"${targetModel.modelName}\" maps to \"${targetModel.tableName}\"`, { meta: {\n\t\tsourceModel: sourceModelName,\n\t\treferencedTable: referencedTableName,\n\t\tmappedTable: targetModel.tableName,\n\t\tcontext\n\t} });\n}\nfunction isValueObjectField(field) {\n\treturn \"valueObjectName\" in field;\n}\n/**\n* Resolves a deferred entity-ref column descriptor (e.g. a `pg.enum(handle)`\n* column) against the field's now-known owning namespace: attaches the\n* storage `valueSet` ref the collected entity's derived value-set is stored\n* under. `nativeType` / `typeParams.typeName` stay bare here — schema\n* qualification (e.g. `auth.aal_level`) is a target concern applied in the\n* next step, `qualifyColumnDescriptor`. A descriptor with no `entityRef` (the\n* ordinary case) passes through unchanged.\n*/\nfunction resolveEntityRefDescriptor(descriptor, namespaceId) {\n\tconst entityRef = descriptor.entityRef;\n\tif (entityRef === void 0) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tvalueSet: {\n\t\t\tplane: \"storage\",\n\t\t\tentityKind: \"valueSet\",\n\t\t\tnamespaceId,\n\t\t\tentityName: entityRef.entityName\n\t\t}\n\t};\n}\n/**\n* Structural check for a target that contributes a `qualifyColumnType` hook\n* on its authoring contributions. Duck-typed (mirroring\n* `contract-psl`'s `hasColumnFromEntityHook`) so the SQL family stays blind\n* to the target's qualification logic and no framework/family interface has\n* to name the hook.\n*/\nfunction hasColumnTypeQualifier(authoring) {\n\treturn \"qualifyColumnType\" in authoring && typeof authoring.qualifyColumnType === \"function\";\n}\n/**\n* Structural check for a target that contributes a `renderCheckExpressions`\n* hook, duck-typed for the same reason {@link hasColumnTypeQualifier} is: the\n* SQL family stays blind to the target's predicate syntax.\n*/\nfunction hasCheckExpressionRenderer(authoring) {\n\treturn \"renderCheckExpressions\" in authoring && typeof authoring.renderCheckExpressions === \"function\";\n}\nfunction resolveCheckExpressionRenderer(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasCheckExpressionRenderer(authoring) ? authoring.renderCheckExpressions : void 0;\n}\n/**\n* The member values a membership check must enforce, encoded exactly as the\n* column stores them. Membership predicates support strings and finite numbers.\n*/\nfunction checkMemberValues(handle, codecLookup) {\n\tconst encoded = handle.values.map((value) => encodeViaCodec(value, handle.codecId, codecLookup));\n\tconst values = [];\n\tfor (const value of encoded) {\n\t\tif (typeof value !== \"string\" && !(typeof value === \"number\" && Number.isFinite(value))) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to strings or finite numbers.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"unsupported-member-value\"\n\t\t} });\n\t\tif (typeof value !== typeof encoded[0]) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to the same primitive type; mixed strings and numbers are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"mixed-member-types\"\n\t\t} });\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\n/**\n* Resolves a field's authored `noCheck` kinds against its column shape:\n* the bare form (`[]`) becomes every kind the shape derives, and a named\n* kind that can never apply to the shape is an authoring error\n* (`CONTRACT.CHECK_OPTOUT_INVALID`). Returns the concrete kinds in\n* canonical ascending order — the only form the contract persists.\n*/\nfunction resolveNoCheckKinds(input) {\n\tconst derivable = [];\n\tif (input.many) derivable.push(\"elementNotNull\");\n\tif (input.isDomainEnum) derivable.push(\"membership\");\n\tconst subject = `Field \"${input.modelName}.${input.fieldName}\"`;\n\tconst meta = {\n\t\tmodelName: input.modelName,\n\t\tfieldName: input.fieldName\n\t};\n\tif (input.kinds.length === 0) {\n\t\tif (derivable.length === 0) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck() waives nothing — this column's shape derives no generated checks.`, { meta: {\n\t\t\t...meta,\n\t\t\treason: \"no-derivable-checks\"\n\t\t} });\n\t\treturn derivable;\n\t}\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const kind of input.kinds) {\n\t\tif (seen.has(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") names the same kind twice.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"duplicate-kind\"\n\t\t} });\n\t\tseen.add(kind);\n\t\tif (!derivable.includes(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") does not apply — ${kind === \"membership\" ? \"membership checks are derived only from enumType() value sets\" : \"element-non-null checks are derived only for list columns\"}.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"inapplicable-kind\"\n\t\t} });\n\t}\n\treturn [...input.kinds].sort();\n}\n/**\n* Names the target's rendered checks and lowers them into contract entities.\n*\n* Naming is composed family-side ({@link composeCheckWirePrefix}) rather than\n* by the target, and suffixed with the predicate's content hash. Composing\n* family-side is what makes the truncation safe — two prefixes that truncate\n* alike still differ in their hashes, and the family can see that the\n* (table, column, kind) triple they were built from is unique per table,\n* rather than having to assume something about SQL text it declares itself\n* unable to read.\n*/\nfunction lowerRenderedChecks(tableName, candidates) {\n\treturn candidates.map((candidate) => new CheckConstraint({\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix: composeCheckWirePrefix(tableName, candidate.columnName, candidate.kind),\n\t\t\thash: computeCheckContentHash(candidate.expression)\n\t\t},\n\t\texpression: candidate.expression\n\t}));\n}\nfunction resolveColumnTypeQualifier(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasColumnTypeQualifier(authoring) ? authoring.qualifyColumnType : void 0;\n}\n/**\n* Applies the target's `qualifyColumnType` hook to a scalar column descriptor\n* at construction, so the storage column and the domain field (which derives\n* its `type.typeParams` from the storage column) are both built already\n* qualified in a single pass. A descriptor whose codec the target leaves\n* unchanged passes through untouched.\n*/\nfunction qualifyColumnDescriptor(descriptor, namespaceId, qualify) {\n\tif (qualify === void 0) return descriptor;\n\tconst qualified = qualify({\n\t\tcodecId: descriptor.codecId,\n\t\tnativeType: descriptor.nativeType,\n\t\t...ifDefined(\"typeParams\", descriptor.typeParams)\n\t}, namespaceId);\n\tif (qualified.nativeType === descriptor.nativeType && qualified.typeParams === descriptor.typeParams) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tnativeType: qualified.nativeType,\n\t\t...ifDefined(\"typeParams\", qualified.typeParams)\n\t};\n}\n/**\n* Records a deferred column's entity-ref into the namespace-scoped collection\n* accumulator (`namespaceId → entityKind → entityName`) — folded into the same\n* namespace assembly `deriveEntityValueSets`/`entries.<kind>` step as the\n* entities-channel attachments, so a column-collected entity gets its\n* value-set the same way an entities-channel one does.\n*\n* The same handle reused by many columns in one namespace is normal (a native\n* enum type backs any number of columns) and records the identical entity once.\n* Two *different* entity instances sharing a name+kind in one namespace is a\n* name collision — the emitted `entries.valueSet.<name>` could only reflect one\n* of them, silently mismatching the other column's type/cast. PSL hard-errors\n* on the equivalent (`PSL_DUPLICATE_DECLARATION`); the TS path rejects it too.\n*/\nfunction collectEntityFromColumn(collected, namespaceId, entityRef) {\n\tconst forNs = collected[namespaceId] ?? {};\n\tconst forKind = forNs[entityRef.entityKind] ?? {};\n\tconst existing = forKind[entityRef.entityName];\n\tif (existing !== void 0 && existing !== entityRef.entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${entityRef.entityKind}\" entities named \"${entityRef.entityName}\" in namespace \"${namespaceId}\" — pack-entity names must be unique per namespace.`, { meta: {\n\t\tkind: entityRef.entityKind,\n\t\tname: entityRef.entityName,\n\t\tnamespaceId\n\t} });\n\tforKind[entityRef.entityName] = entityRef.entity;\n\tforNs[entityRef.entityKind] = forKind;\n\tcollected[namespaceId] = forNs;\n}\n/**\n* Merges a namespace's entities-channel attachments (lowered from the\n* `entities` handle list, carried on `ContractDefinition.attachedEntities`)\n* with the entities collected from that namespace's deferred entity-ref\n* columns. A column-collected entity that shadows a *different* attached\n* entity of the same kind+name (or vice-versa) is the same name-collision bug\n* `collectEntityFromColumn` guards against across columns, so it is rejected\n* the same way — by entity identity, so the same handle attached and used by\n* a column does not throw.\n*/\nfunction mergeColumnAndAttachedEntities(namespaceId, attached, columnCollected) {\n\tif (attached === void 0) return columnCollected;\n\tif (columnCollected === void 0) return attached;\n\tconst kinds = /* @__PURE__ */ new Set([...Object.keys(attached), ...Object.keys(columnCollected)]);\n\tconst result = {};\n\tfor (const kind of kinds) {\n\t\tconst attachedForKind = attached[kind];\n\t\tconst columnForKind = columnCollected[kind];\n\t\tfor (const [name, entity] of Object.entries(columnForKind ?? {})) {\n\t\t\tconst existing = attachedForKind?.[name];\n\t\t\tif (existing !== void 0 && existing !== entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${kind}\" entities named \"${name}\" in namespace \"${namespaceId}\" — a column-referenced entity conflicts with an attached one; pack-entity names must be unique per namespace.`, { meta: {\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t}\n\t\tresult[kind] = {\n\t\t\t...attachedForKind,\n\t\t\t...columnForKind\n\t\t};\n\t}\n\treturn result;\n}\nconst JSONB_CODEC_ID = \"pg/jsonb@1\";\nconst JSONB_NATIVE_TYPE = \"jsonb\";\nfunction resolveModelNamespaceId(model, modelNameToNamespaceId, defaultNamespaceId) {\n\tif (model.namespaceId !== void 0 && model.namespaceId.length > 0) return model.namespaceId;\n\treturn modelNameToNamespaceId.get(model.modelName) ?? defaultNamespaceId;\n}\nfunction toOneRelationNullable(semanticModel, relation) {\n\tconst location = `Relation \"${semanticModel.modelName}.${relation.fieldName}\"`;\n\tif (relation.nullable === void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", `${location} with cardinality \"${relation.cardinality}\" must state whether it is nullable`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-missing\"\n\t} });\n\tconst localColumns = relation.on.parentColumns;\n\tconst { contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relation.nullable,\n\t\tlocalFieldNullability: semanticModel.fields.filter((field) => localColumns.includes(field.columnName)).map((field) => field.nullable),\n\t\townsReference: relation.cardinality === \"N:1\"\n\t});\n\tif (contradiction !== void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", relation.cardinality === \"N:1\" ? toOneNullabilityContradictionMessage(location, contradiction) : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-mismatch\"\n\t} });\n\treturn relation.nullable;\n}\nfunction buildThroughDescriptor(through, tableNamespaceByName, targetModel, modelName, fieldName, defaultNamespaceId) {\n\tif (!tableNamespaceByName.has(through.table)) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `buildSqlContractFromDefinition: junction table \"${through.table}\" for relation \"${modelName}.${fieldName}\" is not a declared model.`, { meta: {\n\t\tsourceModel: modelName,\n\t\trelationName: fieldName,\n\t\tjunctionTable: through.table\n\t} });\n\tconst namespaceId = through.namespaceId ?? defaultNamespaceId;\n\treturn {\n\t\ttable: through.table,\n\t\tnamespaceId,\n\t\tparentColumns: through.parentColumns,\n\t\tchildColumns: through.childColumns,\n\t\ttargetColumns: targetColumnsForJunction(targetModel, fieldName)\n\t};\n}\nfunction targetColumnsForJunction(targetModel, fieldName) {\n\tconst primaryKeyColumns = targetModel.id?.columns;\n\tif (primaryKeyColumns && primaryKeyColumns.length > 0) return primaryKeyColumns;\n\tconst firstUnique = targetModel.uniques?.find((u) => u.columns.length > 0);\n\tif (firstUnique) return firstUnique.columns;\n\tthrow contractError(\"CONTRACT.IDENTITY_INVALID\", `M:N target model \"${targetModel.modelName}\" (relation field \"${fieldName}\") has no primary id or unique key to derive junction targetColumns.`, { meta: {\n\t\tmodelName: targetModel.modelName,\n\t\treason: \"no-key-for-junction-target-columns\"\n\t} });\n}\nfunction buildStorageColumn(field, storageValueSetRef, codecLookup) {\n\tif (isValueObjectField(field)) {\n\t\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, JSONB_CODEC_ID, codecLookup) : void 0;\n\t\treturn {\n\t\t\tnativeType: JSONB_NATIVE_TYPE,\n\t\t\tcodecId: JSONB_CODEC_ID,\n\t\t\tnullable: field.nullable,\n\t\t\t...ifDefined(\"default\", encodedDefault)\n\t\t};\n\t}\n\tconst codecId = field.descriptor.codecId;\n\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, codecId, codecLookup, field.many === true) : void 0;\n\tconst valueSet = storageValueSetRef ?? field.descriptor.valueSet;\n\treturn {\n\t\tnativeType: field.descriptor.nativeType,\n\t\tcodecId,\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...field.noCheck !== void 0 ? { noCheck: [...field.noCheck].sort() } : {},\n\t\t...ifDefined(\"typeParams\", field.descriptor.typeParams),\n\t\t...ifDefined(\"default\", encodedDefault),\n\t\t...ifDefined(\"typeRef\", field.descriptor.typeRef),\n\t\t...ifDefined(\"valueSet\", valueSet)\n\t};\n}\nfunction buildDomainField(field, column, domainValueSetRef) {\n\tif (isValueObjectField(field)) return {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: field.valueObjectName\n\t\t},\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {}\n\t};\n\treturn {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: column.codecId,\n\t\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t\t},\n\t\tnullable: column.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...ifDefined(\"valueSet\", domainValueSetRef)\n\t};\n}\nfunction collectStorageNamespaceCoordinateIds(definition) {\n\tconst ids = /* @__PURE__ */ new Set();\n\tids.add(definition.target.defaultNamespaceId);\n\tfor (const id of definition.namespaces ?? []) if (id.length > 0) ids.add(id);\n\tfor (const model of definition.models) if (model.namespaceId !== void 0 && model.namespaceId.length > 0) ids.add(model.namespaceId);\n\tfor (const id of Object.keys(definition.attachedEntities ?? {})) if (id.length > 0) ids.add(id);\n\treturn ids;\n}\n/**\n* Entry kinds the framework assembler itself manages (`table` from models,\n* `valueSet` from `enums` and attached-entity value-set derivation). A\n* pack-attached entity claiming one of these would silently clobber or be\n* clobbered by the managed slot, so it is rejected outright.\n*/\nconst MANAGED_ENTRY_KINDS = /* @__PURE__ */ new Set([tableEntityKind.kind, valueSetEntityKind.kind]);\nfunction assertNoManagedEntityKinds(namespaceId, entitiesForNs) {\n\tif (entitiesForNs === void 0) return;\n\tfor (const kind of Object.keys(entitiesForNs)) if (MANAGED_ENTRY_KINDS.has(kind)) throw contractError(\"CONTRACT.ENTITY_KIND_INVALID\", `buildSqlContractFromDefinition: attached entity in namespace \"${namespaceId}\" declares entry kind \"${kind}\", which is managed by the framework (table/valueSet) and cannot be attached.`, { meta: {\n\t\tentityKind: kind,\n\t\tnamespaceId\n\t} });\n}\n/**\n* Walks the flat `entityTypes` namespace tree contributed by the target pack\n* and every extension pack, indexing descriptors by their `discriminator` —\n* the same string a pack entity's entries-map key (`entries.<kind>`) uses.\n* Mirrors `contract-psl`'s `buildEntityTypesByDiscriminator`, recomposed here\n* from the packs `ContractDefinition` already carries (`target` +\n* `extensions`) since the TS assembler has no single pre-merged\n* `AuthoringContributions` input to read the way the PSL interpreter does.\n*/\nfunction collectEntityTypeDescriptorsByDiscriminator(definition) {\n\tconst result = /* @__PURE__ */ new Map();\n\tconst walk = (namespace) => {\n\t\tfor (const value of Object.values(namespace)) if (isAuthoringEntityTypeDescriptor(value)) result.set(value.discriminator, value);\n\t\telse walk(value);\n\t};\n\tconst components = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const component of components) {\n\t\tconst entityTypes = component.authoring?.entityTypes;\n\t\tif (entityTypes !== void 0) walk(entityTypes);\n\t}\n\treturn result;\n}\n/**\n* Derives value-sets for every pack entity declared in one namespace,\n* reusing the same `SqlValueSetDerivingEntityTypeOutput.deriveValueSet` hook\n* `contract-psl`'s `lowerExtensionBlocksForNamespace` folds into\n* `entries.valueSet` on the PSL path — so a TS-attached entity (e.g. a\n* native enum) gets its value-set the same way. Entity kinds with no\n* registered descriptor, or whose descriptor output doesn't derive a\n* value-set, contribute nothing.\n*/\nfunction deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator) {\n\tif (entitiesForNs === void 0) return void 0;\n\tlet result;\n\tfor (const [kind, entitiesByName] of Object.entries(entitiesForNs)) {\n\t\tconst descriptor = entityTypesByDiscriminator.get(kind);\n\t\tif (descriptor === void 0) continue;\n\t\tfor (const [name, entity] of Object.entries(entitiesByName)) {\n\t\t\tconst derivedValueSet = deriveValueSetFromEntity(descriptor.output, entity);\n\t\t\tif (derivedValueSet === void 0) continue;\n\t\t\tresult ??= {};\n\t\t\tresult[name] = derivedValueSet;\n\t\t}\n\t}\n\treturn result;\n}\n/**\n* Merges a namespace's `enumType()`-derived value-sets with its pack-entity-\n* derived value-sets. Both land in the same `entries.valueSet[name]` slot —\n* which drives value-set → codec typing and the domain-enum CHECK — so a\n* same-named entry in both would let one silently overwrite the other and\n* corrupt whichever column resolves against it. The same collision class the\n* `mergeColumnAndAttachedEntities` guard rejects; the PSL path already hard-errors\n* on the equivalent (`interpretPslDocumentToSqlContract`). Reject it here too.\n*/\nfunction mergeNamespaceValueSets(namespaceId, enumValueSets, packValueSets) {\n\tif (enumValueSets !== void 0 && packValueSets !== void 0) {\n\t\tfor (const name of Object.keys(packValueSets)) if (Object.hasOwn(enumValueSets, name)) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: value-set \"${name}\" in namespace \"${namespaceId}\" is derived from both an enum and a pack entity — names must be unique per namespace.`, { meta: {\n\t\t\tkind: \"valueSet\",\n\t\t\tname,\n\t\t\tnamespaceId\n\t\t} });\n\t}\n\treturn {\n\t\t...enumValueSets,\n\t\t...packValueSets\n\t};\n}\nfunction ensureUnboundNamespaceSlot(namespaces, createNamespace) {\n\tif (Object.hasOwn(namespaces, UNBOUND_NAMESPACE_ID)) return namespaces;\n\tconst unbound = createNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: { table: {} }\n\t});\n\treturn {\n\t\t[UNBOUND_NAMESPACE_ID]: unbound,\n\t\t...namespaces\n\t};\n}\nconst DERIVABLE_CHECK_KINDS = [\"membership\", \"elementNotNull\"];\n/**\n* Which of `columnNames` could have produced `prefix` for some\n* {@link CheckKind} — the reverse of {@link derivedCheckPrefixes}, used only\n* to name the collision in `CONTRACT.CHECK_NAME_RESERVED`'s message. Callers\n* already know `prefix` is a member of `derivedCheckPrefixes(tableName,\n* columnNames)`, so the result is never empty.\n*/\nfunction columnsProducingCheckPrefix(tableName, columnNames, prefix) {\n\treturn columnNames.filter((columnName) => DERIVABLE_CHECK_KINDS.some((kind) => composeCheckWirePrefix(tableName, columnName, kind) === prefix));\n}\nfunction buildSqlContractFromDefinition(definition, codecLookup) {\n\tconst target = definition.target.targetId;\n\tconst defaultNamespaceId = definition.target.defaultNamespaceId;\n\tconst qualifyColumnType = resolveColumnTypeQualifier(definition.target);\n\tconst renderCheckExpressions = resolveCheckExpressionRenderer(definition.target);\n\tconst targetFamily = \"sql\";\n\tconst resolveNamespaceId = (m) => m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId;\n\tconst modelsByName = new Map(definition.models.map((m) => [m.modelName, m]));\n\tconst tableNamespaceByName = new Map(definition.models.map((m) => [m.tableName, m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId]));\n\tconst modelsByCoordinate = new Map(definition.models.map((m) => [`${resolveNamespaceId(m)}:${m.modelName}`, m]));\n\tconst tablesByNamespace = {};\n\tconst authoringWarnings = [...definition.warnings ?? []];\n\tconst modelNameToNamespaceId = /* @__PURE__ */ new Map();\n\tconst executionDefaults = [];\n\tconst modelsByNamespace = {};\n\tconst collectedColumnEntities = {};\n\tconst rootEntries = [];\n\tfor (const semanticModel of definition.models) {\n\t\tconst tableName = semanticModel.tableName;\n\t\tconst namespaceId = semanticModel.namespaceId !== void 0 && semanticModel.namespaceId.length > 0 ? semanticModel.namespaceId : defaultNamespaceId;\n\t\tmodelNameToNamespaceId.set(semanticModel.modelName, namespaceId);\n\t\tif (!semanticModel.sharesBaseTable) rootEntries.push({\n\t\t\ttableName,\n\t\t\tnamespaceId,\n\t\t\tref: crossRef(semanticModel.modelName, namespaceId)\n\t\t});\n\t\tconst columns = {};\n\t\tconst fieldToColumn = {};\n\t\tconst domainFields = {};\n\t\tconst domainFieldRefs = {};\n\t\tconst checksForTable = [];\n\t\tconst derivesChecks = effectiveControlPolicy(semanticModel.control, definition.defaultControlPolicy) === \"managed\";\n\t\tfor (const field of semanticModel.fields) {\n\t\t\tconst executionDefaultPhases = field.executionDefaults?.onCreate || field.executionDefaults?.onUpdate ? field.executionDefaults : void 0;\n\t\t\tif (executionDefaultPhases) {\n\t\t\t\tif (field.default !== void 0) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot define both default and executionDefaults.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"default-and-executionDefaults\"\n\t\t\t\t} });\n\t\t\t\tif (field.nullable) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot be nullable when executionDefaults are present.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"nullable-with-executionDefaults\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tconst enumHandle = !isValueObjectField(field) ? field.enumTypeHandle : void 0;\n\t\t\tconst storageValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"storage\",\n\t\t\t\tentityKind: \"valueSet\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tconst domainValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"domain\",\n\t\t\t\tentityKind: \"enum\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tlet resolvedField = field;\n\t\t\tif (!isValueObjectField(field)) {\n\t\t\t\tlet descriptor = field.descriptor;\n\t\t\t\tconst entityRef = descriptor.entityRef;\n\t\t\t\tif (entityRef !== void 0) {\n\t\t\t\t\tcollectEntityFromColumn(collectedColumnEntities, namespaceId, entityRef);\n\t\t\t\t\tdescriptor = resolveEntityRefDescriptor(descriptor, namespaceId);\n\t\t\t\t}\n\t\t\t\tdescriptor = qualifyColumnDescriptor(descriptor, namespaceId, qualifyColumnType);\n\t\t\t\tif (descriptor !== field.descriptor) resolvedField = {\n\t\t\t\t\t...field,\n\t\t\t\t\tdescriptor\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!isValueObjectField(resolvedField) && resolvedField.noCheck !== void 0) {\n\t\t\t\tconst { noCheck: authoredNoCheck, ...withoutNoCheck } = resolvedField;\n\t\t\t\tresolvedField = derivesChecks ? {\n\t\t\t\t\t...withoutNoCheck,\n\t\t\t\t\tnoCheck: resolveNoCheckKinds({\n\t\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\t\tkinds: authoredNoCheck,\n\t\t\t\t\t\tmany: resolvedField.many === true,\n\t\t\t\t\t\tisDomainEnum: enumHandle !== void 0\n\t\t\t\t\t})\n\t\t\t\t} : withoutNoCheck;\n\t\t\t}\n\t\t\tconst column = buildStorageColumn(resolvedField, storageValueSetRef, codecLookup);\n\t\t\tcolumns[field.columnName] = column;\n\t\t\tfieldToColumn[field.fieldName] = field.columnName;\n\t\t\tif (renderCheckExpressions !== void 0 && derivesChecks) {\n\t\t\t\tconst waivedKinds = !isValueObjectField(resolvedField) ? resolvedField.noCheck : void 0;\n\t\t\t\tchecksForTable.push(...lowerRenderedChecks(tableName, renderCheckExpressions({\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumnName: field.columnName,\n\t\t\t\t\tmany: column.many === true,\n\t\t\t\t\tmemberValues: enumHandle !== void 0 ? checkMemberValues(enumHandle, codecLookup) : void 0\n\t\t\t\t}).filter((candidate) => !(waivedKinds?.includes(candidate.kind) ?? false))));\n\t\t\t}\n\t\t\tdomainFields[field.fieldName] = buildDomainField(field, column, domainValueSetRef);\n\t\t\tif (isValueObjectField(field)) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: field.valueObjectName,\n\t\t\t\t...field.many ? { many: true } : {}\n\t\t\t};\n\t\t\telse if (field.many) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tmany: true\n\t\t\t};\n\t\t\tif (executionDefaultPhases) executionDefaults.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: namespaceId,\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: field.columnName\n\t\t\t\t},\n\t\t\t\t...ifDefined(\"onCreate\", executionDefaultPhases.onCreate),\n\t\t\t\t...ifDefined(\"onUpdate\", executionDefaultPhases.onUpdate)\n\t\t\t});\n\t\t}\n\t\tconst authoringForeignKeys = (semanticModel.foreignKeys ?? []).map((fk) => {\n\t\t\tif (fk.references.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? defaultNamespaceId;\n\t\t\t\treturn {\n\t\t\t\t\tsource: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\t\ttableName,\n\t\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t\t},\n\t\t\t\t\ttarget: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\t\tcolumns: fk.references.columns,\n\t\t\t\t\t\tspaceId: fk.references.spaceId\n\t\t\t\t\t},\n\t\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, fk.references.model, fk.references.namespaceId, \"Foreign key\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, fk.references.table, \"Foreign key\");\n\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? (targetModel.namespaceId !== void 0 && targetModel.namespaceId.length > 0 ? targetModel.namespaceId : defaultNamespaceId);\n\t\t\treturn {\n\t\t\t\tsource: {\n\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\tcolumns: fk.references.columns\n\t\t\t\t},\n\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t};\n\t\t});\n\t\tif (semanticModel.sharesBaseTable && semanticModel.checks && semanticModel.checks.length > 0) throw contractError(\"CONTRACT.CHECK_ON_STI_VARIANT\", `Model \"${semanticModel.modelName}\" declares a check constraint but shares its base model's storage table (single-table inheritance) and has no table of its own to declare it on. Declare the check on the base model instead.`, { meta: {\n\t\t\ttableName,\n\t\t\tmodelName: semanticModel.modelName\n\t\t} });\n\t\tif (!semanticModel.sharesBaseTable) {\n\t\t\tconst uniques = (semanticModel.uniques ?? []).map((u) => ({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name)\n\t\t\t}));\n\t\t\tconst declaredIndexes = (semanticModel.indexes ?? []).map((i) => lowerAuthoredIndex(tableName, blindCast({\n\t\t\t\t...ifDefined(\"columns\", i.columns),\n\t\t\t\t...ifDefined(\"expression\", i.expression),\n\t\t\t\twhere: i.where,\n\t\t\t\tunique: i.unique,\n\t\t\t\tmap: i.map,\n\t\t\t\tname: i.name,\n\t\t\t\ttype: i.type,\n\t\t\t\toptions: i.options\n\t\t\t}), authoringWarnings));\n\t\t\tif (semanticModel.checks !== void 0 && semanticModel.checks.length > 0) {\n\t\t\t\tconst tableColumnNames = Object.keys(columns);\n\t\t\t\tconst reservedCheckPrefixes = derivedCheckPrefixes(tableName, tableColumnNames);\n\t\t\t\tfor (const authoredCheck of semanticModel.checks) {\n\t\t\t\t\tconst lowered = lowerAuthoredCheck(tableName, authoredCheck, authoringWarnings);\n\t\t\t\t\tif (lowered.naming.kind === \"wire\" && reservedCheckPrefixes.has(lowered.naming.prefix)) {\n\t\t\t\t\t\tconst collidingColumns = columnsProducingCheckPrefix(tableName, tableColumnNames, lowered.naming.prefix);\n\t\t\t\t\t\tconst columnList = collidingColumns.map((name) => `\"${name}\"`).join(\", \");\n\t\t\t\t\t\tthrow contractError(\"CONTRACT.CHECK_NAME_RESERVED\", `Check \"${lowered.naming.prefix}\" on table \"${tableName}\": this name's prefix matches the shape a derived enforcement check would use for column${collidingColumns.length === 1 ? \"\" : \"s\"} ${columnList} of this table, so it can't be told apart from one. Choose a different name.`, { meta: {\n\t\t\t\t\t\t\ttableName,\n\t\t\t\t\t\t\tprefix: lowered.naming.prefix,\n\t\t\t\t\t\t\tcollidingColumns\n\t\t\t\t\t\t} });\n\t\t\t\t\t}\n\t\t\t\t\tchecksForTable.push(new CheckConstraint(lowered));\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst primaryKey = semanticModel.id ? {\n\t\t\t\tcolumns: semanticModel.id.columns,\n\t\t\t\t...ifDefined(\"name\", semanticModel.id.name)\n\t\t\t} : void 0;\n\t\t\tconst { foreignKeys, indexes } = materializeForeignKeysAndIndexes(tableName, authoringForeignKeys, declaredIndexes, uniques, primaryKey);\n\t\t\tconst tableInput = {\n\t\t\t\tcolumns,\n\t\t\t\t...ifDefined(\"control\", semanticModel.control),\n\t\t\t\tuniques,\n\t\t\t\tindexes: indexes.map((i) => new Index(i)),\n\t\t\t\tforeignKeys,\n\t\t\t\t...primaryKey ? { primaryKey } : {},\n\t\t\t\t...checksForTable.length > 0 ? { checks: checksForTable } : {}\n\t\t\t};\n\t\t\tlet nsTables = tablesByNamespace[namespaceId];\n\t\t\tif (nsTables === void 0) {\n\t\t\t\tnsTables = {};\n\t\t\t\ttablesByNamespace[namespaceId] = nsTables;\n\t\t\t}\n\t\t\tif (nsTables[tableName] !== void 0) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: duplicate table \"${tableName}\" in namespace \"${namespaceId}\".`, { meta: {\n\t\t\t\tkind: \"table\",\n\t\t\t\tname: tableName,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t\tnsTables[tableName] = tableInput;\n\t\t}\n\t\tconst storageFields = {};\n\t\tfor (const [fieldName, columnName] of Object.entries(fieldToColumn)) storageFields[fieldName] = { column: columnName };\n\t\tconst columnToField = new Map(Object.entries(fieldToColumn).map(([field, col]) => [col, field]));\n\t\tconst modelRelations = {};\n\t\tfor (const relation of semanticModel.relations ?? []) {\n\t\t\tif (relation.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = relation.namespaceId ?? defaultNamespaceId;\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto: crossRef(relation.toModel, targetNamespaceId, relation.spaceId),\n\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\t\ton: {\n\t\t\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\t\t\ttargetFields: relation.on.childColumns\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, relation.toModel, relation.toNamespaceId, \"Relation\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, relation.toTable, \"Relation\");\n\t\t\tconst targetColumnToField = new Map(targetModel.fields.map((f) => [f.columnName, f.fieldName]));\n\t\t\tconst to = crossRef(relation.toModel, relation.toNamespaceId !== void 0 && relation.toNamespaceId.length > 0 ? relation.toNamespaceId : resolveModelNamespaceId(targetModel, modelNameToNamespaceId, defaultNamespaceId));\n\t\t\tconst on = {\n\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\ttargetFields: relation.on.childColumns.map((col) => targetColumnToField.get(col) ?? col)\n\t\t\t};\n\t\t\tif (relation.cardinality === \"N:M\") {\n\t\t\t\tif (!relation.through) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${semanticModel.modelName}.${relation.fieldName}\" with cardinality \"N:M\" requires through metadata`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\trelationName: relation.fieldName,\n\t\t\t\t\treason: \"many-to-many-missing-through\"\n\t\t\t\t} });\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto,\n\t\t\t\t\tcardinality: \"N:M\",\n\t\t\t\t\ton,\n\t\t\t\t\tthrough: buildThroughDescriptor(relation.through, tableNamespaceByName, targetModel, semanticModel.modelName, relation.fieldName, defaultNamespaceId)\n\t\t\t\t};\n\t\t\t} else if (relation.cardinality === \"1:N\") modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: \"1:N\",\n\t\t\t\ton\n\t\t\t};\n\t\t\telse modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: relation.cardinality,\n\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\ton\n\t\t\t};\n\t\t}\n\t\tlet namespaceModels = modelsByNamespace[namespaceId];\n\t\tif (namespaceModels === void 0) {\n\t\t\tnamespaceModels = {};\n\t\t\tmodelsByNamespace[namespaceId] = namespaceModels;\n\t\t}\n\t\tnamespaceModels[semanticModel.modelName] = {\n\t\t\tstorage: {\n\t\t\t\ttable: tableName,\n\t\t\t\tnamespaceId,\n\t\t\t\tfields: storageFields\n\t\t\t},\n\t\t\tfields: domainFields,\n\t\t\trelations: modelRelations\n\t\t};\n\t}\n\tconst rootTableNameCounts = /* @__PURE__ */ new Map();\n\tfor (const entry of rootEntries) rootTableNameCounts.set(entry.tableName, (rootTableNameCounts.get(entry.tableName) ?? 0) + 1);\n\tconst roots = {};\n\tfor (const entry of rootEntries) {\n\t\tconst key = (rootTableNameCounts.get(entry.tableName) ?? 0) > 1 ? `${entry.namespaceId}.${entry.tableName}` : entry.tableName;\n\t\troots[key] = entry.ref;\n\t}\n\tconst rawStorageTypes = definition.storageTypes ?? {};\n\tconst documentTypes = Object.fromEntries(Object.entries(rawStorageTypes).map(([name, entry]) => {\n\t\tif (entry.kind === \"codec-instance\") return [name, entry];\n\t\treturn [name, toStorageTypeInstance({\n\t\t\tcodecId: entry.codecId,\n\t\t\tnativeType: entry.nativeType,\n\t\t\ttypeParams: entry.typeParams ?? {}\n\t\t})];\n\t}));\n\tconst namespaceCoordinateIds = collectStorageNamespaceCoordinateIds(definition);\n\tconst domainEnumsByNs = {};\n\tconst storageValueSetsByNs = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tif (enumName !== handle.enumName) throw contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${enumName}\" must match enumType name \"${handle.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tdeclarationKey: enumName,\n\t\t\treason: \"key-name-mismatch\"\n\t\t} });\n\t\tconst nsId = defaultNamespaceId;\n\t\tlet domainSlot = domainEnumsByNs[nsId];\n\t\tif (domainSlot === void 0) {\n\t\t\tdomainSlot = {};\n\t\t\tdomainEnumsByNs[nsId] = domainSlot;\n\t\t}\n\t\tdomainSlot[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: encodeViaCodec(m.value, handle.codecId, codecLookup)\n\t\t\t}))\n\t\t};\n\t\tlet storageSlot = storageValueSetsByNs[nsId];\n\t\tif (storageSlot === void 0) {\n\t\t\tstorageSlot = {};\n\t\t\tstorageValueSetsByNs[nsId] = storageSlot;\n\t\t}\n\t\tstorageSlot[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: handle.values.map((v) => encodeViaCodec(v, handle.codecId, codecLookup))\n\t\t};\n\t}\n\tconst { createNamespace } = definition;\n\tconst entityTypesByDiscriminator = collectEntityTypeDescriptorsByDiscriminator(definition);\n\tconst namespaces = Object.fromEntries([...namespaceCoordinateIds].sort().map((id) => {\n\t\tconst entitiesForNs = mergeColumnAndAttachedEntities(id, definition.attachedEntities?.[id], collectedColumnEntities[id]);\n\t\tassertNoManagedEntityKinds(id, entitiesForNs);\n\t\tconst enumValueSetEntries = storageValueSetsByNs[id];\n\t\tconst packValueSetEntries = deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator);\n\t\tconst valueSetEntries = enumValueSetEntries !== void 0 || packValueSetEntries !== void 0 ? mergeNamespaceValueSets(id, enumValueSetEntries, packValueSetEntries) : void 0;\n\t\tconst nsInput = {\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\ttable: tablesByNamespace[id] ?? {},\n\t\t\t\t...entitiesForNs,\n\t\t\t\t...valueSetEntries !== void 0 && Object.keys(valueSetEntries).length > 0 ? { valueSet: valueSetEntries } : {}\n\t\t\t}\n\t\t};\n\t\treturn [id, createNamespace(nsInput)];\n\t}));\n\tconst storageWithoutHash = {\n\t\t...Object.keys(documentTypes).length > 0 ? { types: documentTypes } : {},\n\t\tnamespaces: defaultNamespaceId === UNBOUND_NAMESPACE_ID ? ensureUnboundNamespaceSlot(namespaces, createNamespace) : namespaces\n\t};\n\tconst storageHash = definition.storageHash ? coreHash(definition.storageHash) : computeStorageHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...sqlContractCanonicalizationHooks\n\t});\n\tconst storage = new SqlStorage({\n\t\t...storageWithoutHash,\n\t\tstorageHash\n\t});\n\tconst executionSection = executionDefaults.length > 0 ? { mutations: { defaults: executionDefaults.sort((a, b) => {\n\t\tconst tableCompare = a.ref.table.localeCompare(b.ref.table);\n\t\tif (tableCompare !== 0) return tableCompare;\n\t\treturn a.ref.column.localeCompare(b.ref.column);\n\t}) } } : void 0;\n\tconst extensionNamespaces = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.id) : void 0;\n\tconst extensions = { ...definition.extensions || {} };\n\tif (extensionNamespaces) {\n\t\tfor (const namespace of extensionNamespaces) if (!Object.hasOwn(extensions, namespace)) extensions[namespace] = {};\n\t}\n\tconst extensionPackCapabilitySources = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.capabilities) : [];\n\tconst capabilities = mergeCapabilityMatrices(definition.target.capabilities, ...extensionPackCapabilitySources);\n\tconst profileHash = computeProfileHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tcapabilities: {}\n\t});\n\tconst executionWithHash = executionSection ? {\n\t\t...executionSection,\n\t\texecutionHash: computeExecutionHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\texecution: executionSection\n\t\t})\n\t} : void 0;\n\tconst valueObjects = definition.valueObjects && definition.valueObjects.length > 0 ? Object.fromEntries(definition.valueObjects.map((vo) => [vo.name, { fields: Object.fromEntries(vo.fields.map((f) => [f.fieldName, isValueObjectField(f) ? {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: f.valueObjectName\n\t\t},\n\t\tnullable: f.nullable,\n\t\t...f.many ? { many: true } : {}\n\t} : {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: f.descriptor.codecId,\n\t\t\t...ifDefined(\"typeParams\", f.descriptor.typeParams)\n\t\t},\n\t\tnullable: f.nullable\n\t}])) }])) : void 0;\n\tconst domainNamespaceIds = new Set(Object.keys(modelsByNamespace));\n\tif (domainNamespaceIds.size === 0) domainNamespaceIds.add(defaultNamespaceId);\n\tif (valueObjects !== void 0) domainNamespaceIds.add(defaultNamespaceId);\n\tfor (const nsId of Object.keys(domainEnumsByNs)) domainNamespaceIds.add(nsId);\n\tconst domainNamespaces = Object.fromEntries([...domainNamespaceIds].sort().map((namespaceId) => {\n\t\tconst modelsInNs = modelsByNamespace[namespaceId] ?? {};\n\t\tconst enumsInNs = domainEnumsByNs[namespaceId];\n\t\treturn [namespaceId, {\n\t\t\tmodels: modelsInNs,\n\t\t\t...namespaceId === defaultNamespaceId && valueObjects !== void 0 ? { valueObjects } : {},\n\t\t\t...enumsInNs !== void 0 && Object.keys(enumsInNs).length > 0 ? { enum: enumsInNs } : {}\n\t\t}];\n\t}));\n\tconst contract = {\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\tdomain: { namespaces: domainNamespaces },\n\t\troots,\n\t\tstorage,\n\t\t...executionWithHash ? { execution: executionWithHash } : {},\n\t\textensions,\n\t\tcapabilities,\n\t\tprofileHash,\n\t\tmeta: {}\n\t};\n\tassertStorageSemantics(definition, contract);\n\tflushAuthoringWarnings(authoringWarnings);\n\treturn contract;\n}\n//#endregion\n//#region src/derived-checks.ts\n/**\n* The one step every SQL contract specifier funnels its loaded contract\n* through: stamp the specifier's default control policy, then strip derived\n* checks from every table the stamped policy leaves non-managed. Composing the\n* two here is what keeps the managed-only consequence from being skipped on\n* any specifier route.\n*/\nfunction applySqlSpecifierControlPolicy(contract, defaultControlPolicy, createNamespace) {\n\treturn stripDerivedChecksFromNonManagedTables(applySpecifierDefaultControlPolicy(contract, defaultControlPolicy), createNamespace);\n}\n/**\n* Removes generated enforcement checks from every table whose effective\n* control policy is not `managed`.\n*\n* A check is derived iff its wire prefix is one derivation would produce for\n* some column of its table — {@link derivedCheckPrefixes} enumerates that\n* set. Wire-naming alone no longer identifies derivation: an authored\n* `name:` check (`@@check` / `check()`) is wire-named too, so a bare\n* `check.prefix === undefined` test would delete an author's own constraint\n* from every non-`managed` table. The prefix-shape rule tests against the\n* table's own columns instead of the naming mode, so an authored check with\n* an unrelated prefix survives.\n*\n* The rule is weaker than recomputing the content hash `contract infer`\n* uses: that needs `postgresRenderCheckExpressions` to know what a kind\n* renders, and this funnel has no target descriptor to reach it through. It\n* can only ask whether some column could have produced a prefix of this\n* shape, not whether this exact column produced this exact check. The gap\n* that opens — an authored name that collides with a derived-prefix shape —\n* is closed at authoring time instead: such a name is rejected\n* (`CONTRACT.CHECK_NAME_RESERVED`) before it ever reaches storage.\n*\n* Why derivation stops at the namespace boundary: the contract *describes* an\n* external schema, it does not *prescribe* enforcement for it. Deriving a check\n* for a table Prisma 8 never creates declares a constraint the live database\n* has no reason to carry, and `external` fails verify on a declared shape the\n* database lacks — an unfixable failure, since no plan may emit DDL there\n* either.\n*\n* This is the post-build half of the rule. Authoring skips derivation for a\n* table whose policy is known in the source; this pass catches the policy a\n* contract *specifier* applies after the contract is already built, which is\n* the only signal a pack like the Supabase extension gives. Specifiers reach\n* it through `applySqlSpecifierControlPolicy` above.\n*\n* Returns the contract unchanged (same reference) when nothing is stripped.\n* When something is, the storage hash is recomputed — the stripped contract\n* describes different storage.\n*/\nfunction stripDerivedChecksFromNonManagedTables(contract, createNamespace) {\n\tconst storage = contract.storage;\n\tif (!isSqlStorageShaped(storage)) return contract;\n\tlet anyStripped = false;\n\tconst namespaces = {};\n\tfor (const [namespaceId, namespace] of Object.entries(storage.namespaces)) {\n\t\tif (!isMaterializedSqlNamespace(namespace)) return contract;\n\t\tconst tables = namespace.entries[\"table\"];\n\t\tif (tables === void 0) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tlet namespaceStripped = false;\n\t\tconst nextTables = {};\n\t\tfor (const [tableName, table] of Object.entries(tables)) {\n\t\t\tconst stripped = StorageTable.is(table) ? withoutDerivedChecks(tableName, table, contract.defaultControlPolicy) : table;\n\t\t\tif (stripped !== table) namespaceStripped = true;\n\t\t\tnextTables[tableName] = stripped;\n\t\t}\n\t\tif (!namespaceStripped) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tanyStripped = true;\n\t\tnamespaces[namespaceId] = createNamespace({\n\t\t\tid: namespace.id,\n\t\t\tentries: {\n\t\t\t\t...namespace.entries,\n\t\t\t\ttable: nextTables\n\t\t\t}\n\t\t});\n\t}\n\tif (!anyStripped) return contract;\n\tconst storageWithoutHash = {\n\t\tnamespaces,\n\t\t...ifDefined(\"types\", storage.types)\n\t};\n\treturn {\n\t\t...contract,\n\t\tstorage: new SqlStorage({\n\t\t\t...storageWithoutHash,\n\t\t\tstorageHash: computeStorageHash({\n\t\t\t\ttarget: contract.target,\n\t\t\t\ttargetFamily: contract.targetFamily,\n\t\t\t\tstorage: storageWithoutHash,\n\t\t\t\t...sqlContractCanonicalizationHooks\n\t\t\t})\n\t\t})\n\t};\n}\n/**\n* Structural stand-in for `instanceof SqlStorage`: like the checks it wraps, a\n* storage instance can arrive from a realm whose IR classes are a separate\n* copy (the dist e2e shape), where an `instanceof` test would miss.\n*/\nfunction isSqlStorageShaped(x) {\n\tif (typeof x !== \"object\" || x === null || !(\"namespaces\" in x)) return false;\n\treturn typeof x.namespaces === \"object\" && x.namespaces !== null;\n}\n/** The table itself when it keeps every check, a rebuilt one when it does not. */\nfunction withoutDerivedChecks(tableName, table, contractDefault) {\n\tconst checks = table.checks;\n\tif (checks === void 0 || checks.length === 0) return table;\n\tif (effectiveControlPolicy(table.control, contractDefault) === \"managed\") return table;\n\tconst columnNames = Object.keys(table.columns);\n\tinvariant(columnNames.length > 0, `withoutDerivedChecks: table \"${tableName}\" carries checks but its column map is empty. The caller must pass the table's real, complete column set — an empty or partial map makes every check misclassify as non-derived and survive the strip.`);\n\tconst derivedPrefixes = derivedCheckPrefixes(tableName, columnNames);\n\tconst kept = checks.filter((check) => check.prefix === void 0 || !derivedPrefixes.has(check.prefix));\n\tif (kept.length === checks.length) return table;\n\treturn new StorageTable({\n\t\tcolumns: table.columns,\n\t\tuniques: table.uniques,\n\t\tindexes: table.indexes,\n\t\tforeignKeys: table.foreignKeys,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey),\n\t\t...ifDefined(\"control\", table.control),\n\t\t...kept.length > 0 ? { checks: kept.map((check) => checkConstraintInputFromSerialized({\n\t\t\tname: check.name,\n\t\t\t...ifDefined(\"prefix\", check.prefix),\n\t\t\texpression: check.expression\n\t\t})) } : {}\n\t});\n}\n//#endregion\nexport { contractError as i, buildSqlContractFromDefinition as n, toOneNullabilityContradictionMessage as r, applySqlSpecifierControlPolicy as t };\n\n//# sourceMappingURL=derived-checks-DGjY5t7S.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qCAAqC,UAAU,eAAe;CACtE,OAAO,kBAAkB,sBAAsB,GAAG,SAAS,8DAA8D,GAAG,SAAS;AACtI;AAGA,SAAS,eAAe,OAAO,SAAS,aAAa;CACpD,MAAM,QAAQ,aAAa,IAAI,OAAO;CACtC,IAAI,OAAO,OAAO,MAAM,WAAW,KAAK;CACxC,OAAO,UAAU,KAAK;AACvB;AACA,SAAS,oBAAoB,cAAc,SAAS,aAAa,OAAO,OAAO;CAC9E,IAAI,aAAa,SAAS,YAAY,OAAO;EAC5C,MAAM;EACN,YAAY,aAAa;CAC1B;CACA,IAAI,MAAM;EACT,IAAI,CAAC,MAAM,QAAQ,aAAa,KAAK,GAAG,MAAM,IAAI,cAAc,+DAA+D,OAAO,aAAa,MAAM,8EAA8E;EACvO,OAAO;GACN,MAAM;GACN,OAAO,aAAa,MAAM,KAAK,YAAY,eAAe,SAAS,SAAS,WAAW,CAAC;EACzF;CACD;CACA,OAAO;EACN,MAAM;EACN,OAAO,eAAe,aAAa,OAAO,SAAS,WAAW;CAC/D;AACD;AACA,SAAS,uBAAuB,YAAY,UAAU;CACrD,MAAM,iBAAiB,yBAAyB,SAAS,OAAO;CAChE,IAAI,eAAe,SAAS,GAAG,MAAM,cAAc,8BAA8B,wCAAwC,eAAe,KAAK,IAAI,KAAK,EAAE,MAAM,EAAE,QAAQ,eAAe,EAAE,CAAC;CAC1L,MAAM,oBAAoB,wBAAwB;CAClD,MAAM,kBAAkB,CAAC,WAAW,QAAQ,GAAG,OAAO,OAAO,WAAW,cAAc,CAA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a;EACvB,SAAS,MAAM;EACf,SAAS,MAAM;EACf,SAAS,MAAM;EACf,aAAa,MAAM;EACnB,GAAG,UAAU,cAAc,MAAM,UAAU;EAC3C,GAAG,UAAU,WAAW,MAAM,OAAO;EACrC,GAAG,KAAK,SAAS,IAAI,EAAE,QAAQ,KAAK,KAAK,UAAU,mCAAmC;GACrF,MAAM,MAAM;GACZ,GAAG,UAAU,UAAU,MAAM,MAAM;GACnC,YAAY,MAAM;EACnB,CAAC,CAAC,EAAE,IAAI,CAAC;CACV,CAAC;AACF"}
|
package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DPdD01O0-DNBs1ZDA.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as SqlNamespaceBase, s as SqlNamespaceInput } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
|
-
import "./types-
|
|
2
|
+
import "./types-C36_3E6_.mjs";
|
|
3
3
|
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
4
4
|
//#region ../../../2-sql/2-authoring/contract-ts/dist/derived-checks-DPdD01O0.d.mts
|
|
5
5
|
//#region src/derived-checks.d.ts
|
|
@@ -18,4 +18,4 @@ type SqlNamespaceFactory = (input: SqlNamespaceInput) => SqlNamespaceBase;
|
|
|
18
18
|
declare function applySqlSpecifierControlPolicy(contract: Contract, defaultControlPolicy: ControlPolicy | undefined, createNamespace: SqlNamespaceFactory): Contract;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { applySqlSpecifierControlPolicy as n, SqlNamespaceFactory as t };
|
|
21
|
-
//# sourceMappingURL=derived-checks-DPdD01O0-
|
|
21
|
+
//# sourceMappingURL=derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derived-checks-DPdD01O0-
|
|
1
|
+
{"version":3,"file":"derived-checks-DPdD01O0-DNBs1ZDA.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/derived-checks-DPdD01O0.d.mts"],"mappings":";;;;;;;;;KAOK,uBAAuB,OAAO,sBAAsB;;;;;;;;iBAQxC,+BAA+B,UAAU,UAAU,sBAAsB,2BAA2B,iBAAiB,sBAAsB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
|
-
import "./types-
|
|
2
|
+
import "./types-C36_3E6_.mjs";
|
|
3
3
|
import { v as SqlSchemaIRNode } from "./types-YStFFkKs-D9UAmnON.mjs";
|
|
4
4
|
import "./types-Dwcw0F8X.mjs";
|
|
5
|
-
import "./control-adapter-C99J7aEF-
|
|
6
|
-
import { n as CodecControlHooks } from "./types-IqZMLrFC-
|
|
7
|
-
import { t as SqlSchemaDiffFn } from "./schema-differ-DpG_gnur-
|
|
5
|
+
import "./control-adapter-C99J7aEF-GODO43Ai.mjs";
|
|
6
|
+
import { n as CodecControlHooks } from "./types-IqZMLrFC-BIRftuU7.mjs";
|
|
7
|
+
import { t as SqlSchemaDiffFn } from "./schema-differ-DpG_gnur-BICVtTHY.mjs";
|
|
8
8
|
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
9
9
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
10
10
|
import { DiffSubjectGranularity, SchemaDiffIssue, VerifierIssueCategory, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
@@ -101,4 +101,4 @@ interface VerifySqlSchemaByDiffInput {
|
|
|
101
101
|
declare function verifySqlSchemaByDiff(input: VerifySqlSchemaByDiffInput): VerifyDatabaseSchemaResult;
|
|
102
102
|
//#endregion
|
|
103
103
|
export { VerifySqlSchemaByDiffInput as a, computeSqlDiffVerdict as c, StorageTypeVerdictInput as i, computeStorageTypeVerdict as l, SqlDiffVerdictInput as n, classifyDiffSubjectGranularity as o, StorageTypeVerdict as r, classifySqlDiffIssue as s, SqlDiffVerdict as t, verifySqlSchemaByDiff as u };
|
|
104
|
-
//# sourceMappingURL=diff-
|
|
104
|
+
//# sourceMappingURL=diff-CN1ou7vM.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-
|
|
1
|
+
{"version":3,"file":"diff-CN1ou7vM.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/diff.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAmBiB,+BAA+B,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;;;;;;;;;;;;;iBAarH,qBAAqB,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;UAClH;;WAEC,iBAAiB;;WAEjB,uBAAuB,OAAO,oBAAoB;WAClD;WACA,sBAAsB;;WAEtB,gBAAgB,qBAAqB;;UAEtC;WACC,mBAAmB;WACnB,mBAAmB;;;;;;;;;iBASb,sBAAsB,OAAO,sBAAsB;UAC1D;WACC,UAAU,SAAS;;;;;;;WAOnB,gBAAgB;aACd,QAAQ;;WAEV,YAAY,oBAAoB;;;;;;;;;UASjC;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,0BAA0B,OAAO,0BAA0B;UAClE;WACC,UAAU,SAAS;WACnB,QAAQ;WACR;WACA,qBAAqB,cAAc;;WAEnC,YAAY;;WAEZ,gBAAgB,qBAAqB;;;;;;;;;iBAS/B,sBAAsB,OAAO,6BAA6B"}
|
|
@@ -275,6 +275,7 @@ const sqlEmission = {
|
|
|
275
275
|
return [
|
|
276
276
|
"import type {",
|
|
277
277
|
" ContractWithTypeMaps,",
|
|
278
|
+
" RelationKeys,",
|
|
278
279
|
" TypeMaps as TypeMapsType,",
|
|
279
280
|
`} from '${resolveImportSpecifier("@internal/sql-contract/types")}';`
|
|
280
281
|
];
|
|
@@ -464,4 +465,4 @@ function generateStorageNamespacesType(namespaces) {
|
|
|
464
465
|
//#endregion
|
|
465
466
|
export { sqlEmission as t };
|
|
466
467
|
|
|
467
|
-
//# sourceMappingURL=dist-
|
|
468
|
+
//# sourceMappingURL=dist-D5__KJs-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-D5__KJs-.mjs","names":[],"sources":["../../../../2-sql/3-tooling/emitter/dist/index.mjs"],"sourcesContent":["import { renderValueSetType, serializeNamespaceId, serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { isSafeTypeExpression } from \"@internal/emitter/type-expression-safety\";\nimport { settleAggregateOverloads } from \"@internal/framework-components/components\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/errors.ts\nfunction sqlEmitterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\nfunction sqlEmitterValidationError(message, meta) {\n\treturn sqlEmitterError(\"CONTRACT.VALIDATION_FAILED\", message, {\n\t\twhy: \"The contract given to the SQL emitter failed structural validation.\",\n\t\tfix: \"Regenerate the contract from its authoring source; do not hand-edit contract JSON.\",\n\t\tmeta\n\t});\n}\n//#endregion\n//#region src/index.ts\n/**\n* Render the aggregate result map from the overloads the stack contributes, settled against the codecs it contributes.\n*\n* Every emitted row is keyed by a contributed codec, whichever rung settled it. Trait fallbacks reach only the contributed codecs to begin with, and an exact overload naming an uncontributed codec is dropped here — settling keeps such a row, because naming a codec id is a claim that stands on its own and the runtime honours it for whatever ref reaches it, but a target may register codecs its adapter withholds, and an emitted type over one of those would advertise availability no contract can use.\n*\n* Only the two rungs that name a codec are materialized; the input-agnostic overload stays a single row, which a consumer reads when no per-codec row claims its input.\n*/\nfunction generateAggregateTypes(options) {\n\tconst descriptors = options?.aggregateDescriptors ?? [];\n\tconst codecs = options?.codecDescriptors ?? [];\n\tif (descriptors.length === 0) return \"Record<string, never>\";\n\tconst contributedIds = new Set(codecs.map((codec) => codec.codecId));\n\tconst settled = settleAggregateOverloads(descriptors, codecs);\n\tconst ambiguity = settled.ambiguities[0];\n\tif (ambiguity !== void 0) throw sqlEmitterError(\"CONTRACT.AGGREGATE_DESCRIPTOR_AMBIGUOUS\", `Aggregate '${ambiguity.operation}' has no single result type over codec '${ambiguity.codecId}': traits ${ambiguity.traits.join(\", \")} all claim it.`, {\n\t\twhy: \"Emitted result types must name one codec per aggregate and input.\",\n\t\tfix: `Contribute an exact descriptor for '${ambiguity.operation}' over '${ambiguity.codecId}', or narrow the overlapping trait contributions.`,\n\t\tmeta: {\n\t\t\toperation: ambiguity.operation,\n\t\t\tcodecId: ambiguity.codecId,\n\t\t\ttraits: ambiguity.traits\n\t\t}\n\t});\n\treturn `{ ${[...settled.operations].sort(([left], [right]) => left.localeCompare(right)).map(([operation, entry]) => {\n\t\tconst members = [`readonly byCodec: { ${[...entry.byCodecId].filter(([codecId]) => contributedIds.has(codecId)).sort(([left], [right]) => left.localeCompare(right)).map(([codecId, descriptor]) => {\n\t\t\treturn `readonly ${serializeObjectKey(codecId)}: ${renderAggregateResult(descriptor, codecId, contributedIds)}`;\n\t\t}).join(\"; \")} }`];\n\t\tconst withoutInput = entry.noInput ?? entry.anyInput;\n\t\tif (withoutInput !== void 0) members.push(`readonly withoutInput: ${renderAggregateResult(withoutInput, void 0, contributedIds)}`);\n\t\tif (entry.anyInput !== void 0) members.push(`readonly anyInput: ${renderAggregateResult(entry.anyInput, void 0, contributedIds)}`);\n\t\treturn `readonly ${serializeObjectKey(operation)}: { ${members.join(\"; \")} }`;\n\t}).join(\"; \")} }`;\n}\n/** One row of the map: the codec the result carries, and whether it can be null. A `self` result carries the codec of the input it was resolved for. */\nfunction renderAggregateResult(descriptor, inputCodecId, contributedIds) {\n\tconst output = descriptor.output.kind === \"self\" ? inputCodecId : descriptor.output.codecId;\n\tif (output === void 0) throw sqlEmitterError(\"CONTRACT.AGGREGATE_DESCRIPTOR_AMBIGUOUS\", `Aggregate '${descriptor.operation}' declares its own input's codec as its result but answers calls that carry no input.`, {\n\t\twhy: \"A result that reuses its input needs an input to reuse.\",\n\t\tfix: \"Name the result codec on the descriptor.\",\n\t\tmeta: { operation: descriptor.operation }\n\t});\n\tif (!contributedIds.has(output)) throw sqlEmitterError(\"CONTRACT.AGGREGATE_OUTPUT_CODEC_MISSING\", `Aggregate '${descriptor.operation}' names result codec '${output}', which the stack does not contribute.`, {\n\t\twhy: \"An emitted result type names a codec in the contract codec map; a codec the stack does not contribute has no emitted type to name.\",\n\t\tfix: \"Contribute the codec, or declare a result codec the stack contributes.\",\n\t\tmeta: {\n\t\t\toperation: descriptor.operation,\n\t\t\toutputCodecId: output\n\t\t}\n\t});\n\treturn `{ readonly output: ${serializeValue(output)}; readonly nullable: ${descriptor.nullable} }`;\n}\nfunction serializeTypeParamsLiteral(params) {\n\tif (!params || Object.keys(params).length === 0) return \"Record<string, never>\";\n\tconst entries = [];\n\tfor (const [key, value] of Object.entries(params)) entries.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);\n\treturn `{ ${entries.join(\"; \")} }`;\n}\nconst sqlEmission = {\n\tid: \"sql\",\n\tvalidateTypes(contract, _ctx) {\n\t\tconst storage = contract.storage;\n\t\tif (!storage?.namespaces) return;\n\t\tconst typeIdRegex = /^([^/]+)\\/([^@]+)@(\\d+)$/;\n\t\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const [colName, colUnknown] of Object.entries(table.columns)) {\n\t\t\tconst codecId = colUnknown.codecId;\n\t\t\tif (!codecId) throw sqlEmitterValidationError(`Column \"${colName}\" in table \"${tableName}\" is missing codecId`, {\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn: colName\n\t\t\t});\n\t\t\tif (!codecId.match(typeIdRegex)?.[1]) throw sqlEmitterValidationError(`Column \"${colName}\" in table \"${tableName}\" has invalid codec ID format \"${codecId}\". Expected format: ns/name@version`, {\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn: colName,\n\t\t\t\tcodecId\n\t\t\t});\n\t\t}\n\t},\n\tvalidateStructure(contract) {\n\t\tif (contract.targetFamily !== \"sql\") throw sqlEmitterValidationError(`Expected targetFamily \"sql\", got \"${contract.targetFamily}\"`, { targetFamily: contract.targetFamily });\n\t\tconst storage = contract.storage;\n\t\tif (!storage?.namespaces) throw sqlEmitterValidationError(\"SQL contract must have storage.namespaces\", {});\n\t\tconst tableNamesSeenAcrossNamespaces = /* @__PURE__ */ new Map();\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) for (const tableName of Object.keys(ns.entries.table ?? {})) {\n\t\t\tconst existingNs = tableNamesSeenAcrossNamespaces.get(tableName);\n\t\t\tif (existingNs !== void 0 && existingNs !== nsId) throw sqlEmitterError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate table name \"${tableName}\" in namespaces \"${existingNs}\" and \"${nsId}\"`, {\n\t\t\t\twhy: \"Two SQL namespaces declare a table with the same name, which is ambiguous for emission.\",\n\t\t\t\tfix: \"Rename one of the tables so every table name is unique across namespaces.\",\n\t\t\t\tmeta: {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tnamespaces: [existingNs, nsId]\n\t\t\t\t}\n\t\t\t});\n\t\t\ttableNamesSeenAcrossNamespaces.set(tableName, nsId);\n\t\t}\n\t\tconst tableNames = /* @__PURE__ */ new Set();\n\t\tfor (const ns of Object.values(storage.namespaces)) for (const t of Object.keys(ns.entries.table ?? {})) tableNames.add(t);\n\t\tfor (const [namespaceId, domainNs] of Object.entries(contract.domain.namespaces)) {\n\t\t\tconst models = domainNs.models;\n\t\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\t\tif (!model.storage?.table) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" is missing storage.table`, { model: qualifiedName });\n\t\t\t\tif (!model.storage.namespaceId) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" is missing storage.namespaceId`, { model: qualifiedName });\n\t\t\t\tif (model.storage.namespaceId !== namespaceId) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" storage.namespaceId \"${model.storage.namespaceId}\" does not match domain namespace \"${namespaceId}\"`, {\n\t\t\t\t\tmodel: qualifiedName,\n\t\t\t\t\tstorageNamespaceId: model.storage.namespaceId,\n\t\t\t\t\tdomainNamespaceId: namespaceId\n\t\t\t\t});\n\t\t\t\tconst tableName = model.storage.table;\n\t\t\t\tconst table = entityAt(storage, {\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\tentityKind: \"table\",\n\t\t\t\t\tentityName: tableName\n\t\t\t\t});\n\t\t\t\tif (!table) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" references non-existent table \"${namespaceId}.${tableName}\"`, {\n\t\t\t\t\tmodel: qualifiedName,\n\t\t\t\t\ttable: `${namespaceId}.${tableName}`\n\t\t\t\t});\n\t\t\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\t\t\tconst storageFields = model.storage.fields;\n\t\t\t\tif (!storageFields || Object.keys(storageFields).length === 0) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" is missing storage.fields`, { model: qualifiedName });\n\t\t\t\tfor (const [fieldName, field] of Object.entries(storageFields)) {\n\t\t\t\t\tif (!field.column) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" is missing column property`, {\n\t\t\t\t\t\tmodel: qualifiedName,\n\t\t\t\t\t\tfield: fieldName\n\t\t\t\t\t});\n\t\t\t\t\tif (!columnNames.has(field.column)) throw sqlEmitterValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" references non-existent column \"${field.column}\" in table \"${tableName}\"`, {\n\t\t\t\t\t\tmodel: qualifiedName,\n\t\t\t\t\t\tfield: fieldName,\n\t\t\t\t\t\tcolumn: field.column,\n\t\t\t\t\t\ttable: tableName\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (!model.relations || typeof model.relations !== \"object\") throw sqlEmitterValidationError(`Model \"${qualifiedName}\" is missing required field \"relations\" (must be an object)`, { model: qualifiedName });\n\t\t\t}\n\t\t}\n\t\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) {\n\t\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\t\tif (!Array.isArray(table.uniques)) throw sqlEmitterValidationError(`Table \"${tableName}\" is missing required field \"uniques\" (must be an array)`, { table: tableName });\n\t\t\tif (!Array.isArray(table.indexes)) throw sqlEmitterValidationError(`Table \"${tableName}\" is missing required field \"indexes\" (must be an array)`, { table: tableName });\n\t\t\tif (!Array.isArray(table.foreignKeys)) throw sqlEmitterValidationError(`Table \"${tableName}\" is missing required field \"foreignKeys\" (must be an array)`, { table: tableName });\n\t\t\tif (table.primaryKey) {\n\t\t\t\tfor (const colName of table.primaryKey.columns) if (!columnNames.has(colName)) throw sqlEmitterValidationError(`Table \"${tableName}\" primaryKey references non-existent column \"${colName}\"`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: colName\n\t\t\t\t});\n\t\t\t}\n\t\t\tfor (const unique of table.uniques) for (const colName of unique.columns) if (!columnNames.has(colName)) throw sqlEmitterValidationError(`Table \"${tableName}\" unique constraint references non-existent column \"${colName}\"`, {\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn: colName\n\t\t\t});\n\t\t\tfor (const index of table.indexes) for (const colName of index.columns) if (!columnNames.has(colName)) throw sqlEmitterValidationError(`Table \"${tableName}\" index references non-existent column \"${colName}\"`, {\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn: colName\n\t\t\t});\n\t\t\tfor (const fk of table.foreignKeys) {\n\t\t\t\tfor (const colName of fk.source.columns) if (!columnNames.has(colName)) throw sqlEmitterValidationError(`Table \"${tableName}\" foreignKey references non-existent column \"${colName}\"`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: colName\n\t\t\t\t});\n\t\t\t\tconst referencedTable = entityAt(storage, {\n\t\t\t\t\tnamespaceId: fk.target.namespaceId,\n\t\t\t\t\tentityKind: \"table\",\n\t\t\t\t\tentityName: fk.target.tableName\n\t\t\t\t});\n\t\t\t\tif (!referencedTable) throw sqlEmitterValidationError(`Table \"${tableName}\" foreignKey references non-existent table \"${fk.target.tableName}\" in namespace \"${fk.target.namespaceId}\"`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\ttargetTable: fk.target.tableName,\n\t\t\t\t\ttargetNamespace: fk.target.namespaceId\n\t\t\t\t});\n\t\t\t\tconst referencedColumnNames = new Set(Object.keys(referencedTable.columns));\n\t\t\t\tfor (const colName of fk.target.columns) if (!referencedColumnNames.has(colName)) throw sqlEmitterValidationError(`Table \"${tableName}\" foreignKey references non-existent column \"${colName}\" in table \"${fk.target.tableName}\"`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: colName,\n\t\t\t\t\ttargetTable: fk.target.tableName\n\t\t\t\t});\n\t\t\t\tif (fk.source.columns.length !== fk.target.columns.length) throw sqlEmitterValidationError(`Table \"${tableName}\" foreignKey column count (${fk.source.columns.length}) does not match referenced column count (${fk.target.columns.length})`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tsourceColumnCount: fk.source.columns.length,\n\t\t\t\t\ttargetColumnCount: fk.target.columns.length\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t},\n\tgenerateStorageType(contract, storageHashTypeName) {\n\t\tconst storage = contract.storage;\n\t\tconst namespacesType = generateStorageNamespacesType(storage.namespaces);\n\t\tconst docTypes = generateDocumentScopedStorageTypesType(storage.types);\n\t\treturn `{ readonly namespaces: ${namespacesType}${docTypes === void 0 ? \"\" : `; readonly types: ${docTypes}`}; readonly storageHash: ${storageHashTypeName} }`;\n\t},\n\tgenerateModelStorageType(_modelName, model) {\n\t\tconst sqlModel = model;\n\t\tconst tableName = sqlModel.storage.table;\n\t\tconst storageFields = sqlModel.storage.fields;\n\t\tconst storageParts = [`readonly table: ${serializeValue(tableName)}`, `readonly namespaceId: ${serializeValue(sqlModel.storage.namespaceId)}`];\n\t\tif (Object.keys(storageFields).length > 0) {\n\t\t\tconst fieldParts = [];\n\t\t\tfor (const [fieldName, field] of Object.entries(storageFields)) fieldParts.push(`readonly ${serializeObjectKey(fieldName)}: { readonly column: ${serializeValue(field.column)} }`);\n\t\t\tstorageParts.push(`readonly fields: { ${fieldParts.join(\"; \")} }`);\n\t\t}\n\t\treturn `{ ${storageParts.join(\"; \")} }`;\n\t},\n\tresolveFieldTypeParams(_modelName, fieldName, model, contract) {\n\t\tconst sqlModel = model;\n\t\tconst storageField = sqlModel.storage?.fields?.[fieldName];\n\t\tif (!storageField) return void 0;\n\t\tconst storage = contract.storage;\n\t\tif (!storage) return void 0;\n\t\tconst tableName = sqlModel.storage.table;\n\t\tconst storageNamespaceId = sqlModel.storage.namespaceId;\n\t\tif (!storageNamespaceId) return void 0;\n\t\tconst table = entityAt(storage, {\n\t\t\tnamespaceId: storageNamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (!table) return void 0;\n\t\tconst column = table.columns[storageField.column];\n\t\tif (!column) return void 0;\n\t\tif (column.typeRef) {\n\t\t\tconst typeInstance = storage.types?.[column.typeRef];\n\t\t\tif (typeInstance === void 0) return void 0;\n\t\t\treturn typeInstance.typeParams;\n\t\t}\n\t\treturn column.typeParams;\n\t},\n\tresolveFieldValueSet(_modelName, fieldName, model, contract) {\n\t\tconst sqlModel = blindCast(model);\n\t\tconst storageField = sqlModel.storage?.fields?.[fieldName];\n\t\tif (!storageField) return void 0;\n\t\tconst storage = blindCast(contract.storage);\n\t\tif (!storage) return void 0;\n\t\tconst storageNamespaceId = sqlModel.storage.namespaceId;\n\t\tif (!storageNamespaceId) return void 0;\n\t\tconst column = entityAt(storage, {\n\t\t\tnamespaceId: storageNamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: sqlModel.storage.table\n\t\t})?.columns[storageField.column];\n\t\tif (!column?.valueSet) return void 0;\n\t\tconst valueSet = entityAt(storage, {\n\t\t\tnamespaceId: column.valueSet.namespaceId,\n\t\t\tentityKind: column.valueSet.entityKind,\n\t\t\tentityName: column.valueSet.entityName\n\t\t});\n\t\tif (!valueSet) return void 0;\n\t\treturn {\n\t\t\tencodedValues: valueSet.values,\n\t\t\tcodecId: column.codecId\n\t\t};\n\t},\n\tgetStorageTypeExports(contract, codecLookup) {\n\t\tconst storage = blindCast(contract.storage);\n\t\tif (!storage?.namespaces) return void 0;\n\t\tconst outputMap = generateStorageColumnTypesMap(storage, \"output\", codecLookup);\n\t\tconst inputMap = generateStorageColumnTypesMap(storage, \"input\", codecLookup);\n\t\treturn [`export type StorageColumnTypes = ${outputMap};`, `export type StorageColumnInputTypes = ${inputMap};`].join(\"\\n\");\n\t},\n\tgetFamilyImports(resolveImportSpecifier) {\n\t\treturn [\n\t\t\t\"import type {\",\n\t\t\t\" ContractWithTypeMaps,\",\n\t\t\t\" RelationKeys,\",\n\t\t\t\" TypeMaps as TypeMapsType,\",\n\t\t\t`} from '${resolveImportSpecifier(\"@internal/sql-contract/types\")}';`\n\t\t];\n\t},\n\tgetFamilyTypeAliases(options) {\n\t\tconst queryOperationAliases = (options?.queryOperationTypeImports ?? []).filter((imp) => imp.named === \"QueryOperationTypes\").map((imp) => `${imp.alias}<CodecTypes>`);\n\t\treturn [\n\t\t\t\"export type LaneCodecTypes = CodecTypes;\",\n\t\t\t`export type QueryOperationTypes = ${queryOperationAliases.length > 0 ? queryOperationAliases.join(\" & \") : \"Record<string, never>\"};`,\n\t\t\t`export type AggregateTypes = ${generateAggregateTypes(options)};`,\n\t\t\t\"type DefaultLiteralValue<CodecId extends string, Encoded> =\",\n\t\t\t\" CodecId extends keyof CodecTypes\",\n\t\t\t\" ? Encoded extends CodecTypes[CodecId][\\\"json\\\"]\",\n\t\t\t\" ? Encoded\",\n\t\t\t\" : CodecTypes[CodecId][\\\"json\\\"]\",\n\t\t\t\" : Encoded;\"\n\t\t].join(\"\\n\");\n\t},\n\tgetTypeMapsExpression() {\n\t\treturn \"TypeMapsType<CodecTypes, QueryOperationTypes, FieldOutputTypes, FieldInputTypes, StorageColumnTypes, StorageColumnInputTypes, AggregateTypes>\";\n\t},\n\tgetContractWrapper(contractBaseName, typeMapsName) {\n\t\treturn [\n\t\t\t`export type Contract = ContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`,\n\t\t\t\"\",\n\t\t\t\"export type Namespaces = Contract['storage']['namespaces'];\"\n\t\t].join(\"\\n\");\n\t}\n};\nfunction columnTypeParams(storage, column) {\n\tif (column.typeRef) {\n\t\tconst typeInstance = storage.types?.[column.typeRef];\n\t\tif (typeInstance === void 0) return void 0;\n\t\treturn blindCast(typeInstance).typeParams;\n\t}\n\treturn column.typeParams;\n}\nfunction renderRefinedCodecType(column, side, params, codecLookup) {\n\tif (codecLookup && params && Object.keys(params).length > 0) {\n\t\tconst rendered = side === \"output\" ? codecLookup.renderOutputTypeFor(column.codecId, params) : codecLookup.renderInputTypeFor?.(column.codecId, params);\n\t\tif (rendered && isSafeTypeExpression(rendered)) return rendered;\n\t}\n\treturn `CodecTypes[${serializeValue(column.codecId)}][${serializeValue(side)}]`;\n}\nfunction computeColumnType(storage, column, side, codecLookup) {\n\tlet base;\n\tif (column.valueSet) {\n\t\tconst valueSet = entityAt(storage, {\n\t\t\tnamespaceId: column.valueSet.namespaceId,\n\t\t\tentityKind: column.valueSet.entityKind,\n\t\t\tentityName: column.valueSet.entityName\n\t\t});\n\t\tbase = valueSet ? renderValueSetType(valueSet.values, column.codecId, side, codecLookup) : void 0;\n\t}\n\tif (base === void 0) base = renderRefinedCodecType(column, side, columnTypeParams(storage, column), codecLookup);\n\tif (column.many === true) base = `ReadonlyArray<${base}>`;\n\treturn column.nullable ? `${base} | null` : base;\n}\nfunction generateStorageColumnTypesMap(storage, side, codecLookup) {\n\tconst namespaceEntries = Object.entries(storage.namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\tif (namespaceEntries.length === 0) return \"Record<string, never>\";\n\tconst nsParts = [];\n\tfor (const [nsId, ns] of namespaceEntries) {\n\t\tconst tables = blindCast(ns.entries.table ?? {});\n\t\tconst tableEntries = Object.entries(tables).sort(([a], [b]) => a.localeCompare(b));\n\t\tconst tableParts = [];\n\t\tfor (const [tableName, table] of tableEntries) {\n\t\t\tconst colEntries = Object.entries(table.columns).sort(([a], [b]) => a.localeCompare(b));\n\t\t\tconst colParts = [];\n\t\t\tfor (const [colName, col] of colEntries) {\n\t\t\t\tconst colType = computeColumnType(storage, col, side, codecLookup);\n\t\t\t\tcolParts.push(`readonly ${serializeObjectKey(colName)}: ${colType}`);\n\t\t\t}\n\t\t\tconst colMap = colParts.length > 0 ? `{ ${colParts.join(\"; \")} }` : \"{}\";\n\t\t\ttableParts.push(`readonly ${serializeObjectKey(tableName)}: ${colMap}`);\n\t\t}\n\t\tconst tableMap = tableParts.length > 0 ? `{ ${tableParts.join(\"; \")} }` : \"{}\";\n\t\tnsParts.push(`readonly ${serializeObjectKey(nsId)}: ${tableMap}`);\n\t}\n\treturn `{ ${nsParts.join(\"; \")} }`;\n}\nfunction generateDocumentScopedStorageTypesType(types) {\n\tif (!types || Object.keys(types).length === 0) return;\n\tconst typeEntries = [];\n\tfor (const [typeName, typeInstance] of Object.entries(types)) {\n\t\tconst codecInstanceShape = typeInstance;\n\t\tif (typeof codecInstanceShape.codecId !== \"string\" || typeof codecInstanceShape.nativeType !== \"string\") throw sqlEmitterError(\"CONTRACT.TYPE_UNKNOWN\", `Unknown storage type kind for \"${typeName}\" in document-scoped storage.types; expected a codec-instance triple.`, {\n\t\t\twhy: \"A storage.types entry is not a codec-instance triple, so its column type cannot be emitted.\",\n\t\t\tfix: \"Regenerate the contract from its authoring source; storage.types entries must carry codecId and nativeType.\",\n\t\t\tmeta: { type: typeName }\n\t\t});\n\t\tconst codecId = serializeValue(codecInstanceShape.codecId);\n\t\tconst nativeType = serializeValue(codecInstanceShape.nativeType);\n\t\tconst typeParamsStr = serializeTypeParamsLiteral(codecInstanceShape.typeParams);\n\t\ttypeEntries.push(`readonly ${serializeObjectKey(typeName)}: { readonly kind: \"codec-instance\"; readonly codecId: ${codecId}; readonly nativeType: ${nativeType}; readonly typeParams: ${typeParamsStr} }`);\n\t}\n\treturn `{ ${typeEntries.join(\"; \")} }`;\n}\n/**\n* Literalizes the `valueSet` entries slot — a core SQL entity kind (alongside\n* `table`), not a pack-contributed one, so naming it here isn't a\n* family→target layering leak. This is the only non-`table` entries slot with\n* a type-level consumer (`db.nativeEnums`, `packages/3-extensions/postgres`):\n* pack-contributed slots (`role`, `policy`, `native_enum`, …) have none and\n* are not emitted.\n*/\nfunction generateValueSetBlockType(valueSets) {\n\treturn `{ ${Object.entries(valueSets).sort(([a], [b]) => a.localeCompare(b)).map(([name, valueSet]) => `readonly ${serializeObjectKey(name)}: ${serializeValue(valueSet)}`).join(\"; \")} }`;\n}\nfunction namespaceSerializedKind(ns) {\n\tconst kind = ns.kind;\n\tif (kind === \"schema\") return `readonly kind: \"${ns.id === UNBOUND_NAMESPACE_ID ? \"postgres-unbound-schema\" : \"postgres-schema\"}\"`;\n\tif (typeof kind === \"string\") return `readonly kind: ${serializeValue(kind)}`;\n\tthrow sqlEmitterError(\"CONTRACT.NAMESPACE_INVALID\", `Namespace '${ns.id}' has no string kind — all namespaces must be target concretions with a defined kind property.`, {\n\t\twhy: \"The namespace is not a target concretion, so the emitter cannot serialize its kind.\",\n\t\tfix: \"Regenerate the contract with a target pack that materializes every namespace as a target concretion.\",\n\t\tmeta: { namespace: ns.id }\n\t});\n}\nfunction generateTableLiteralType(table) {\n\tconst columns = [];\n\tfor (const [colName, col] of Object.entries(table.columns)) {\n\t\tconst nullable = col.nullable ? \"true\" : \"false\";\n\t\tconst nativeType = serializeValue(col.nativeType);\n\t\tconst codecId = serializeValue(col.codecId);\n\t\tconst defaultSpec = col.default ? col.default.kind === \"literal\" ? `; readonly default: { readonly kind: \"literal\"; readonly value: DefaultLiteralValue<${codecId}, ${serializeValue(col.default.value)}> }` : `; readonly default: { readonly kind: \"function\"; readonly expression: ${serializeValue(col.default.expression)} }` : \"\";\n\t\tconst typeParamsSpec = col.typeParams && Object.keys(col.typeParams).length > 0 ? `; readonly typeParams: ${serializeTypeParamsLiteral(col.typeParams)}` : \"\";\n\t\tconst typeRefSpec = col.typeRef ? `; readonly typeRef: ${serializeValue(col.typeRef)}` : \"\";\n\t\tcolumns.push(`readonly ${serializeObjectKey(colName)}: { readonly nativeType: ${nativeType}; readonly codecId: ${codecId}; readonly nullable: ${nullable}${defaultSpec}${typeParamsSpec}${typeRefSpec} }`);\n\t}\n\tconst tableParts = [`columns: { ${columns.join(\"; \")} }`];\n\tif (table.primaryKey) {\n\t\tconst pkParts = [`readonly columns: readonly [${table.primaryKey.columns.map((c) => serializeValue(c)).join(\", \")}]`];\n\t\tif (table.primaryKey.name) pkParts.push(`readonly name: ${serializeValue(table.primaryKey.name)}`);\n\t\ttableParts.push(`primaryKey: { ${pkParts.join(\"; \")} }`);\n\t}\n\tconst uniques = table.uniques.map((u) => {\n\t\tconst parts = [`readonly columns: readonly [${u.columns.map((c) => serializeValue(c)).join(\", \")}]`];\n\t\tif (u.name) parts.push(`readonly name: ${serializeValue(u.name)}`);\n\t\treturn `{ ${parts.join(\"; \")} }`;\n\t}).join(\", \");\n\ttableParts.push(`uniques: readonly [${uniques}]`);\n\tconst indexes = table.indexes.map((i) => {\n\t\tconst parts = [`readonly name: ${serializeValue(i.name)}`];\n\t\tif (i.prefix !== void 0) parts.push(`readonly prefix: ${serializeValue(i.prefix)}`);\n\t\tif (i.columns !== void 0) parts.push(`readonly columns: readonly [${i.columns.map((c) => serializeValue(c)).join(\", \")}]`);\n\t\tif (i.expression !== void 0) parts.push(`readonly expression: ${serializeValue(i.expression)}`);\n\t\tif (i.where !== void 0) parts.push(`readonly where: ${serializeValue(i.where)}`);\n\t\tparts.push(`readonly unique: ${i.unique}`);\n\t\tif (i.type !== void 0) parts.push(`readonly type: ${serializeValue(i.type)}`);\n\t\tif (i.options !== void 0) parts.push(`readonly options: ${serializeValue(i.options)}`);\n\t\treturn `{ ${parts.join(\"; \")} }`;\n\t}).join(\", \");\n\ttableParts.push(`indexes: readonly [${indexes}]`);\n\tconst fks = table.foreignKeys.map((fk) => {\n\t\tconst srcCols = fk.source.columns.map((c) => serializeValue(c)).join(\", \");\n\t\tconst tgtCols = fk.target.columns.map((c) => serializeValue(c)).join(\", \");\n\t\tconst srcRef = `{ readonly namespaceId: ${serializeNamespaceId(String(fk.source.namespaceId))}; readonly tableName: ${serializeValue(fk.source.tableName)}; readonly columns: readonly [${srcCols}] }`;\n\t\tconst tgtRef = `{ readonly namespaceId: ${serializeNamespaceId(String(fk.target.namespaceId))}; readonly tableName: ${serializeValue(fk.target.tableName)}; readonly columns: readonly [${tgtCols}] }`;\n\t\tconst parts = [`readonly source: ${srcRef}`, `readonly target: ${tgtRef}`];\n\t\tif (fk.name) parts.push(`readonly name: ${serializeValue(fk.name)}`);\n\t\treturn `{ ${parts.join(\"; \")} }`;\n\t}).join(\", \");\n\ttableParts.push(`foreignKeys: readonly [${fks}]`);\n\treturn `{ ${tableParts.join(\"; \")} }`;\n}\nfunction generateTablesMapType(tables) {\n\tconst tableEntries = [];\n\tfor (const [tableName, table] of Object.entries(tables).sort(([a], [b]) => a.localeCompare(b))) tableEntries.push(`readonly ${serializeObjectKey(tableName)}: ${generateTableLiteralType(table)}`);\n\tif (tableEntries.length === 0) return \"{}\";\n\treturn `{ ${tableEntries.join(\"; \")} }`;\n}\nfunction generateStorageNamespacesType(namespaces) {\n\tconst entries = Object.entries(namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\tif (entries.length === 0) return \"Record<string, never>\";\n\tconst parts = [];\n\tfor (const [name, ns] of entries) {\n\t\tconst kindSuffix = `; ${namespaceSerializedKind(ns)}`;\n\t\tconst entriesParts = [`readonly table: ${generateTablesMapType(ns.entries.table ?? {})}`];\n\t\tconst valueSetEntries = ns.entries.valueSet;\n\t\tif (valueSetEntries !== void 0 && Object.keys(valueSetEntries).length > 0) entriesParts.push(`readonly valueSet: ${generateValueSetBlockType(valueSetEntries)}`);\n\t\tconst entriesType = `{ ${entriesParts.join(\"; \")} }`;\n\t\tparts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}${kindSuffix}; readonly entries: ${entriesType} }`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\n//#endregion\nexport { sqlEmission };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,gBAAgB,MAAM,SAAS,SAAS;CAChD,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AACA,SAAS,0BAA0B,SAAS,MAAM;CACjD,OAAO,gBAAgB,8BAA8B,SAAS;EAC7D,KAAK;EACL,KAAK;EACL;CACD,CAAC;AACF;;;;;;;;AAUA,SAAS,uBAAuB,SAAS;CACxC,MAAM,cAAc,SAAS,wBAAwB,CAAC;CACtD,MAAM,SAAS,SAAS,oBAAoB,CAAC;CAC7C,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,MAAM,iBAAiB,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC;CACnE,MAAM,UAAU,yBAAyB,aAAa,MAAM;CAC5D,MAAM,YAAY,QAAQ,YAAY;CACtC,IAAI,cAAc,KAAK,GAAG,MAAM,gBAAgB,2CAA2C,cAAc,UAAU,UAAU,0CAA0C,UAAU,QAAQ,YAAY,UAAU,OAAO,KAAK,IAAI,EAAE,iBAAiB;EACjP,KAAK;EACL,KAAK,uCAAuC,UAAU,UAAU,UAAU,UAAU,QAAQ;EAC5F,MAAM;GACL,WAAW,UAAU;GACrB,SAAS,UAAU;GACnB,QAAQ,UAAU;EACnB;CACD,CAAC;CACD,OAAO,KAAK,CAAC,GAAG,QAAQ,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW;EACpH,MAAM,UAAU,CAAC,uBAAuB,CAAC,GAAG,MAAM,SAAS,CAAC,CAA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,WAAW,GAAG,OAAO;CACtC,OAAO,KAAK,aAAa,KAAK,IAAI,EAAE;AACrC;AACA,SAAS,8BAA8B,YAAY;CAClD,MAAM,UAAU,OAAO,QAAQ,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;CACtF,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,CAAC,MAAM,OAAO,SAAS;EACjC,MAAM,aAAa,KAAK,wBAAwB,EAAE;EAClD,MAAM,eAAe,CAAC,mBAAmB,sBAAsB,GAAG,QAAQ,SAAS,CAAC,CAAC,GAAG;EACxF,MAAM,kBAAkB,GAAG,QAAQ;EACnC,IAAI,oBAAoB,KAAK,KAAK,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS,GAAG,aAAa,KAAK,sBAAsB,0BAA0B,eAAe,GAAG;EAC/J,MAAM,cAAc,KAAK,aAAa,KAAK,IAAI,EAAE;EACjD,MAAM,KAAK,YAAY,mBAAmB,IAAI,EAAE,mBAAmB,eAAe,GAAG,EAAE,IAAI,WAAW,sBAAsB,YAAY,GAAG;CAC5I;CACA,OAAO,KAAK,MAAM,KAAK,IAAI,EAAE;AAC9B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { E as OperationExpr, M as RawExpr, N as RawQueryAst, k as ParamRef } from "./types-Dt4e_jC--COeP8xzN.mjs";
|
|
2
2
|
import { t as planFromAst } from "./plan-Dh0LbYIv-Crx5-ThG.mjs";
|
|
3
3
|
import { runtimeError } from "@prisma/orm-framework/components/runtime";
|
|
4
|
+
import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
4
5
|
//#region ../../../2-sql/4-lanes/relational-core/dist/exports/expression.mjs
|
|
5
6
|
/**
|
|
6
7
|
* Resolve a raw value or an Expression into an AST expression node.
|
|
@@ -15,7 +16,7 @@ function toExpr(value, codec) {
|
|
|
15
16
|
return ParamRef.of(value, { codec });
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz@1' })`.
|
|
19
|
+
* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz-temporal@1' })`.
|
|
19
20
|
*/
|
|
20
21
|
function param(value, opts) {
|
|
21
22
|
return ParamRef.of(value, { codec: { codecId: opts.codecId } });
|
|
@@ -129,7 +130,10 @@ var RawSqlStatementBuilderImpl = class extends RawSqlBuilderImpl {
|
|
|
129
130
|
}
|
|
130
131
|
returnsRow(spec) {
|
|
131
132
|
const node = RawQueryAst.rows(this.parts, resolveRowSpec(spec));
|
|
133
|
+
const result = node.result;
|
|
134
|
+
invariant(result.kind === "rows", "RawQueryAst.rows built a non-rows result");
|
|
132
135
|
return {
|
|
136
|
+
returns: result.columns,
|
|
133
137
|
buildAst: () => node,
|
|
134
138
|
build: () => this.planFor(node)
|
|
135
139
|
};
|
|
@@ -145,4 +149,4 @@ var RawSqlStatementBuilderImpl = class extends RawSqlBuilderImpl {
|
|
|
145
149
|
//#endregion
|
|
146
150
|
export { toExpr as a, param as i, codecOf as n, createRawSql as r, buildOperation as t };
|
|
147
151
|
|
|
148
|
-
//# sourceMappingURL=expression-
|
|
152
|
+
//# sourceMappingURL=expression-B2Ox7zKM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression-B2Ox7zKM.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/expression.mjs"],"sourcesContent":["import { E as OperationExpr, M as RawExpr, N as RawQueryAst, k as ParamRef } from \"../types-Dt4e_jC-.mjs\";\nimport { t as planFromAst } from \"../plan-Dh0LbYIv.mjs\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/expression.ts\n/**\n* Resolve a raw value or an Expression into an AST expression node.\n*\n* When `value` is an Expression (duck-typed by its `buildAst` method), the AST it wraps is returned. Otherwise the value is embedded as a ParamRef tagged with the caller-supplied {@link CodecRef} (when known). The runtime resolves the ref via `contractCodecs.forCodecRef(codec)`; content-keyed memoisation collapses repeated lookups for the same logical column onto one shared codec.\n*\n* Operation implementations that compare a column-bound expression to a user value derive the column's {@link CodecRef} from the column-bound side (via {@link codecOf}) and forward it here so encode-side dispatch resolves to the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).\n*/\nfunction toExpr(value, codec) {\n\tif (isExpressionLike(value)) return value.buildAst();\n\tif (codec === void 0) throw runtimeError(\"RUNTIME.PARAM_REF_CODEC_REQUIRED\", `Cannot construct a ParamRef for a ${value === null ? \"null\" : typeof value} value without an explicit codec. Provide a CodecRef at the call site or use a column-bound builder path.`);\n\treturn ParamRef.of(value, { codec });\n}\n/**\n* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz-temporal@1' })`.\n*/\nfunction param(value, opts) {\n\treturn ParamRef.of(value, { codec: { codecId: opts.codecId } });\n}\n/**\n* Derive the {@link CodecRef} carried by an expression-like value.\n*\n* Resolution order:\n* 1. `wrapper.codec` — explicit column-bound {@link CodecRef} stamped at field-proxy time.\n* 2. `wrapper.returnType.codec` — scope-level codec when the scope was built from contract storage.\n* 3. `{ codecId: wrapper.returnType.codecId }` — minimal ref derived from the expression's declared codec id (covers synthetic expressions like `count()` whose returnType has a known codec id but no explicit column binding).\n*\n* Returns `undefined` for raw scalar values (non-expression-like).\n*/\nfunction codecOf(value) {\n\tif (!isExpressionLike(value)) return void 0;\n\tconst wrapper = value;\n\tif (wrapper.codec) return wrapper.codec;\n\tif (wrapper.returnType?.codec) return wrapper.returnType.codec;\n\tif (wrapper.returnType?.codecId) return { codecId: wrapper.returnType.codecId };\n}\nfunction isExpressionLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\";\n}\n/**\n* Construct an OperationExpr AST node and wrap it as a typed Expression. Operation implementations use this to turn their user-facing arguments into the AST node the compilation pipeline eventually lowers to SQL.\n*/\nfunction buildOperation(spec) {\n\tconst [self, ...rest] = spec.args;\n\tconst op = new OperationExpr({\n\t\tmethod: spec.method,\n\t\tself,\n\t\targs: rest.length > 0 ? rest : void 0,\n\t\treturns: spec.returns,\n\t\tlowering: spec.lowering\n\t});\n\treturn {\n\t\treturnType: spec.returns,\n\t\tbuildAst: () => op\n\t};\n}\nfunction resolveInterpolation(adapter, value) {\n\tif (isExpressionLike(value)) return value.buildAst();\n\tif (value instanceof ParamRef) return value;\n\tif (typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"string\" || typeof value === \"boolean\" || value instanceof Uint8Array) return ParamRef.of(value, { codec: { codecId: adapter.inferCodec(value) } });\n\tthrow runtimeError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec\");\n}\nfunction isRawRowQuery(value) {\n\treturn typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\" && \"build\" in value && typeof value.build === \"function\";\n}\nfunction templateParts(adapter, strings, values) {\n\tconst parts = [strings[0] ?? \"\"];\n\tvalues.forEach((value, i) => {\n\t\tif (isRawRowQuery(value)) parts.push(...value.buildAst().parts);\n\t\telse parts.push(resolveInterpolation(adapter, value));\n\t\tparts.push(strings[i + 1] ?? \"\");\n\t});\n\treturn parts;\n}\n/**\n* Normalizes each authored entry to a {@link RawQueryColumn}. The record is\n* assembled with `Object.fromEntries`, which defines each key as an own\n* property: a spec built at runtime with a `__proto__` key reaches the AST,\n* which refuses it by name, rather than silently setting the record's\n* prototype and leaving the column to vanish.\n*/\nfunction resolveRowSpec(spec) {\n\treturn Object.fromEntries(Object.entries(spec).map(([name, entry]) => [name, typeof entry === \"string\" ? {\n\t\tcodecId: entry,\n\t\tnullable: false\n\t} : {\n\t\tcodecId: entry.codecId,\n\t\tnullable: entry.nullable ?? false\n\t}]));\n}\nfunction createRawSql(adapter, planContext) {\n\tif (planContext === void 0) return (strings, ...values) => new RawSqlBuilderImpl(templateParts(adapter, strings, values));\n\tconst context = planContext;\n\treturn (strings, ...values) => new RawSqlStatementBuilderImpl(templateParts(adapter, strings, values), context);\n}\nvar RawSqlBuilderImpl = class {\n\tparts;\n\tconstructor(parts) {\n\t\tthis.parts = parts;\n\t}\n\treturns(spec) {\n\t\tconst codecId = typeof spec === \"string\" ? spec : spec.codecId;\n\t\tconst nullable = typeof spec === \"string\" ? false : spec.nullable ?? false;\n\t\tconst paramSpec = {\n\t\t\tcodecId,\n\t\t\tnullable\n\t\t};\n\t\tconst node = new RawExpr({\n\t\t\tparts: this.parts,\n\t\t\treturns: paramSpec\n\t\t});\n\t\treturn {\n\t\t\treturnType: {\n\t\t\t\tcodecId,\n\t\t\t\tnullable\n\t\t\t},\n\t\t\tbuildAst: () => node\n\t\t};\n\t}\n};\nvar RawSqlStatementBuilderImpl = class extends RawSqlBuilderImpl {\n\tplanContext;\n\tconstructor(parts, planContext) {\n\t\tsuper(parts);\n\t\tthis.planContext = planContext;\n\t}\n\treturnsRow(spec) {\n\t\tconst node = RawQueryAst.rows(this.parts, resolveRowSpec(spec));\n\t\tconst result = node.result;\n\t\tinvariant(result.kind === \"rows\", \"RawQueryAst.rows built a non-rows result\");\n\t\treturn {\n\t\t\treturns: result.columns,\n\t\t\tbuildAst: () => node,\n\t\t\tbuild: () => this.planFor(node)\n\t\t};\n\t}\n\taffectedCount() {\n\t\tconst node = RawQueryAst.affectedCount(this.parts);\n\t\treturn { build: () => this.planFor(node) };\n\t}\n\tplanFor(node) {\n\t\treturn planFromAst(node, this.planContext.contract, this.planContext.laneId);\n\t}\n};\n//#endregion\nexport { buildOperation, codecOf, createRawSql, param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AAO,KAAK;EACvD,MAAM,WAAW,OAAO,SAAS,WAAW,QAAQ,KAAK,YAAY;EACrE,MAAM,YAAY;GACjB;GACA;EACD;EACA,MAAM,OAAO,IAAI,QAAQ;GACxB,OAAO,KAAK;GACZ,SAAS;EACV,CAAC;EACD,OAAO;GACN,YAAY;IACX;IACA;GACD;GACA,gBAAgB;EACjB;CACD;AACD;AACA,IAAI,6BAA6B,cAAc,kBAAkB;CAChE;CACA,YAAY,OAAO,aAAa;EAC/B,MAAM,KAAK;EACX,KAAK,cAAc;CACpB;CACA,WAAW,MAAM;EAChB,MAAM,OAAO,YAAY,KAAK,KAAK,OAAO,eAAe,IAAI,CAAC;EAC9D,MAAM,SAAS,KAAK;EACpB,UAAU,OAAO,SAAS,QAAQ,0CAA0C;EAC5E,OAAO;GACN,SAAS,OAAO;GAChB,gBAAgB;GAChB,aAAa,KAAK,QAAQ,IAAI;EAC/B;CACD;CACA,gBAAgB;EACf,MAAM,OAAO,YAAY,cAAc,KAAK,KAAK;EACjD,OAAO,EAAE,aAAa,KAAK,QAAQ,IAAI,EAAE;CAC1C;CACA,QAAQ,MAAM;EACb,OAAO,YAAY,MAAM,KAAK,YAAY,UAAU,KAAK,YAAY,MAAM;CAC5E;AACD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
2
|
import { S as QueryOperationReturn } from "./types-BDUG29Df-LE85dIXP.mjs";
|
|
3
|
-
import "./types-
|
|
4
|
-
import { t as SqlLoweringSpec } from "./index-
|
|
5
|
-
import { St as RawQueryAst, T as CodecRef$1, Tt as RawSqlLiteral, _t as ParamRef, s as AnyExpression } from "./types-v3qxLLxo-
|
|
3
|
+
import "./types-C36_3E6_.mjs";
|
|
4
|
+
import { t as SqlLoweringSpec } from "./index-CLAshwKN.mjs";
|
|
5
|
+
import { Ct as RawQueryColumn, St as RawQueryAst, T as CodecRef$1, Tt as RawSqlLiteral, _t as ParamRef, s as AnyExpression } from "./types-v3qxLLxo-Clw_yBAh.mjs";
|
|
6
6
|
import { l as SqlStatementStats } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
|
|
7
|
-
import { t as SqlQueryPlan } from "./plan-CDxduYaN-
|
|
7
|
+
import { t as SqlQueryPlan } from "./plan-CDxduYaN-B2kMLIQQ.mjs";
|
|
8
8
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
9
9
|
import { ParamSpec } from "@prisma/orm-framework/operations";
|
|
10
10
|
//#region ../../../2-sql/4-lanes/relational-core/dist/exports/expression.d.mts
|
|
@@ -98,7 +98,7 @@ type TraitExpression<Traits extends readonly string[], Nullable extends boolean,
|
|
|
98
98
|
*/
|
|
99
99
|
declare function toExpr(value: unknown, codec?: CodecRef$1): AnyExpression;
|
|
100
100
|
/**
|
|
101
|
-
* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz@1' })`.
|
|
101
|
+
* Construct a `ParamRef` for a value whose codec identity is known at call time. Use this when interpolating a value into a raw SQL expression and the codec cannot be inferred from context — e.g. `param(myDate, { codecId: 'pg/timestamptz-temporal@1' })`.
|
|
102
102
|
*/
|
|
103
103
|
declare function param<T>(value: T, opts: {
|
|
104
104
|
codecId: string;
|
|
@@ -200,7 +200,16 @@ interface RawPlanContext {
|
|
|
200
200
|
* (including data-modifying CTEs, whose `RETURNING` is what earns them a row
|
|
201
201
|
* spec) expressible.
|
|
202
202
|
*/
|
|
203
|
-
interface RawRowQuery<Row = unknown
|
|
203
|
+
interface RawRowQuery<Row = unknown, Refs extends Readonly<Record<string, RawQueryColumn>> = Readonly<Record<string, RawQueryColumn>>> {
|
|
204
|
+
/**
|
|
205
|
+
* What this statement declared. Each spec key gets one entry naming the
|
|
206
|
+
* codec that decodes the column and whether it may be null.
|
|
207
|
+
*
|
|
208
|
+
* Those entries are row-spec entries themselves. An outer statement that
|
|
209
|
+
* embeds this one can inherit a declaration instead of restating its codec
|
|
210
|
+
* id.
|
|
211
|
+
*/
|
|
212
|
+
readonly returns: Refs;
|
|
204
213
|
buildAst(): RawQueryAst;
|
|
205
214
|
build(): SqlQueryPlan<Row>;
|
|
206
215
|
}
|
|
@@ -254,4 +263,4 @@ declare function createRawSql(adapter: RawCodecInferer, planContext: RawPlanCont
|
|
|
254
263
|
declare function createRawSql(adapter: RawCodecInferer): RawSqlTag;
|
|
255
264
|
//#endregion
|
|
256
265
|
export { buildOperation as C, toExpr as D, param as E, TraitExpression as S, createRawSql as T, RawSqlStatementBuilder as _, CodecValue as a, ScalarListExpression as b, RawAffectedCountQuery as c, RawRow as d, RawRowQuery as f, RawSqlInterpolation as g, RawSqlBuilder as h, CodecTypesBase as i, RawCodecInferer as l, RawRowSpecEntry as m, BuildOperationSpec as n, Expression as o, RawRowSpec as p, CodecExpression as r, NoReservedRowColumn as s, AffectedCount as t, RawPlanContext as u, RawSqlStatementTag as v, codecOf as w, ScopeField as x, RawSqlTag as y };
|
|
257
|
-
//# sourceMappingURL=expression-
|
|
266
|
+
//# sourceMappingURL=expression-mku9I7Ue.d.mts.map
|