@prisma/orm-family-sql 8.0.0-rc.24-dev.28 → 8.0.0-rc.24-dev.30
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/dist/{aggregate-descriptor-registry-DM1hmlq-.mjs → aggregate-descriptor-registry-oSsBuRHQ.mjs} +2 -2
- package/dist/{aggregate-descriptor-registry-DM1hmlq-.mjs.map → aggregate-descriptor-registry-oSsBuRHQ.mjs.map} +1 -1
- package/dist/{ast-BO3Wgbrl.mjs → ast-BpFfUmb_.mjs} +2 -2
- package/dist/{ast-BO3Wgbrl.mjs.map → ast-BpFfUmb_.mjs.map} +1 -1
- package/dist/{ast-D0yJ7Yf0.d.mts → ast-DvD53wSW.d.mts} +3 -3
- package/dist/{ast-D0yJ7Yf0.d.mts.map → ast-DvD53wSW.d.mts.map} +1 -1
- package/dist/{attribute-specs-DL1btx0j.d.mts → attribute-specs-DgYb4op9.d.mts} +3 -3
- package/dist/{attribute-specs-DL1btx0j.d.mts.map → attribute-specs-DgYb4op9.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CgKIgWq5-BqNs-56x.d.mts → authoring-entity-types-CgKIgWq5-C3GyB8Hj.d.mts} +2 -2
- package/dist/{authoring-entity-types-CgKIgWq5-BqNs-56x.d.mts.map → authoring-entity-types-CgKIgWq5-C3GyB8Hj.d.mts.map} +1 -1
- package/dist/builder.d.mts +3 -3
- package/dist/builder__runtime.d.mts +7 -7
- package/dist/builder__runtime.mjs +26 -12
- package/dist/builder__runtime.mjs.map +1 -1
- package/dist/builder__types.d.mts +5 -5
- package/dist/{collection-methods-CN0GIWWR-BSJvP4Kc.d.mts → collection-methods-As4pXm7B-3xgTSoyU.d.mts} +3 -3
- package/dist/{collection-methods-CN0GIWWR-BSJvP4Kc.d.mts.map → collection-methods-As4pXm7B-3xgTSoyU.d.mts.map} +1 -1
- package/dist/collection-methods-CS1e16Ij.d.mts +1 -0
- package/dist/config-types-CGDhWE3o.mjs +147 -0
- package/dist/config-types-CGDhWE3o.mjs.map +1 -0
- package/dist/{config-types-Ce1tAJ0B.d.mts → config-types-DVRid5jV.d.mts} +15 -3
- package/dist/config-types-DVRid5jV.d.mts.map +1 -0
- package/dist/{contract-builder-Dbo5LeXs.mjs → contract-builder-BqswyknO.mjs} +3 -3
- package/dist/contract-builder-BqswyknO.mjs.map +1 -0
- package/dist/{contract-builder-BfPC4mQK.d.mts → contract-builder-fyzIdWqX.d.mts} +77 -2
- package/dist/{contract-builder-BfPC4mQK.d.mts.map → contract-builder-fyzIdWqX.d.mts.map} +1 -1
- package/dist/contract-emitter.d.mts +3 -2
- package/dist/contract-emitter.d.mts.map +1 -1
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-prisma7__provider.mjs +6 -6
- package/dist/contract-psl.d.mts +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__provider.mjs +22 -19
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +3 -3
- package/dist/contract-ts.mjs +4 -4
- package/dist/contract-ts__config-types.d.mts +2 -2
- package/dist/contract-ts__config-types.mjs +2 -2
- package/dist/contract-ts__contract-builder.d.mts +2 -2
- package/dist/contract-ts__contract-builder.mjs +3 -3
- package/dist/contract.d.mts +3 -3
- package/dist/contract.mjs +4 -4
- package/dist/contract__foreign-key-materialization.d.mts +2 -2
- package/dist/contract__foreign-key-materialization.mjs +3 -3
- package/dist/contract__validators.d.mts +1 -1
- package/dist/contract__validators.mjs +1 -1
- package/dist/{control-Cb6YoQ8j.d.mts → control-BwL5tCj4.d.mts} +159 -43
- package/dist/control-BwL5tCj4.d.mts.map +1 -0
- package/dist/{control-kHFMtE8A.mjs → control-DUbuxp4j.mjs} +2117 -1315
- package/dist/control-DUbuxp4j.mjs.map +1 -0
- package/dist/{control-adapter-0z3ce44U-CLj4kqLI.d.mts → control-adapter-0z3ce44U-BQ26ercw.d.mts} +4 -4
- package/dist/{control-adapter-0z3ce44U-CLj4kqLI.d.mts.map → control-adapter-0z3ce44U-BQ26ercw.d.mts.map} +1 -1
- package/dist/{control-adapter-DIwBUSs6.d.mts → control-adapter-DRLco_j0.d.mts} +2 -2
- package/dist/{control-adapter-DIwBUSs6.d.mts.map → control-adapter-DRLco_j0.d.mts.map} +1 -1
- package/dist/{db-DfYeGVcu-B99ycjaC.d.mts → db-by-MuHF2-B7uz_0VW.d.mts} +27 -18
- package/dist/db-by-MuHF2-B7uz_0VW.d.mts.map +1 -0
- package/dist/{ddl-types-D22OYeFy-Be5-W-5z.d.mts → ddl-types-D93zTpm9-DhSkpX0K.d.mts} +3 -3
- package/dist/{ddl-types-D22OYeFy-Be5-W-5z.d.mts.map → ddl-types-D93zTpm9-DhSkpX0K.d.mts.map} +1 -1
- package/dist/{derived-checks-BWg0DOyz-7O0x1Tgn.mjs → derived-checks-BoHNzt-a-4Vi-QMdx.mjs} +228 -10
- package/dist/derived-checks-BoHNzt-a-4Vi-QMdx.mjs.map +1 -0
- package/dist/{diff-DbkXUf4C.d.mts → diff-DZHlisyY.d.mts} +2 -2
- package/dist/{diff-DbkXUf4C.d.mts.map → diff-DZHlisyY.d.mts.map} +1 -1
- package/dist/{dist-BJjqJT_M.mjs → dist-C-Gi4VUC.mjs} +20 -14
- package/dist/dist-C-Gi4VUC.mjs.map +1 -0
- package/dist/{exports-BR5ctYYI-C_-aedbr.mjs → exports-kqOXg2OT-D3lo7jnX.mjs} +168 -162
- package/dist/exports-kqOXg2OT-D3lo7jnX.mjs.map +1 -0
- package/dist/expression-Bz8uEh8W.d.mts +2 -0
- package/dist/{expression-D8c3t2Dx-CCHt1OdT.d.mts → expression-DYRYmkMl-BMKxN8Wf.d.mts} +64 -43
- package/dist/expression-DYRYmkMl-BMKxN8Wf.d.mts.map +1 -0
- package/dist/{expression-DL7L8You-C9BAeM2d.d.mts → expression-VJWwxbUB-BtNDaTCt.d.mts} +5 -5
- package/dist/expression-VJWwxbUB-BtNDaTCt.d.mts.map +1 -0
- package/dist/{expression-impl-DHdjzqE3-Cd9gP7oC.mjs → expression-impl-C5Ha-fXs-CxXn8gDo.mjs} +7 -5
- package/dist/expression-impl-C5Ha-fXs-CxXn8gDo.mjs.map +1 -0
- package/dist/family.d.mts +9 -9
- package/dist/family.mjs +6 -6
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +4 -4
- package/dist/family__control.mjs +3 -3
- package/dist/family__diff.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 +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/{foreign-key-materialization-C53nVQuD.d.mts → foreign-key-materialization-Dntzsl64.d.mts} +8 -2
- package/dist/foreign-key-materialization-Dntzsl64.d.mts.map +1 -0
- package/dist/{foreign-key-materialization-CCHAR789.mjs → foreign-key-materialization-pYirysH0.mjs} +2 -2
- package/dist/foreign-key-materialization-pYirysH0.mjs.map +1 -0
- package/dist/{functions-Cl_egJ2w.mjs → functions-DGketpiK.mjs} +3 -3
- package/dist/{functions-Cl_egJ2w.mjs.map → functions-DGketpiK.mjs.map} +1 -1
- package/dist/functions-gl3PL1so.d.mts +1 -0
- package/dist/{generator-functions-Bze9nVHL-Cetbgui3.mjs → generator-functions-Bze9nVHL-Bg9PVsti.mjs} +3 -3
- package/dist/{generator-functions-Bze9nVHL-Cetbgui3.mjs.map → generator-functions-Bze9nVHL-Bg9PVsti.mjs.map} +1 -1
- package/dist/{index-equivalence-DswCiq5l-9GNm8oG9.mjs → index-equivalence-eC2jGpOp-SkExsiy1.mjs} +3 -3
- package/dist/{index-equivalence-DswCiq5l-9GNm8oG9.mjs.map → index-equivalence-eC2jGpOp-SkExsiy1.mjs.map} +1 -1
- package/dist/{index-DA1EEz4y.d.mts → index-nW0rAUTr.d.mts} +28 -30
- package/dist/index-nW0rAUTr.d.mts.map +1 -0
- package/dist/{index-reference-CSrhOgZL-PIYy9LTA.d.mts → index-reference-CjvRzUh1-CG0Ouv6i.d.mts} +3 -3
- package/dist/{index-reference-CSrhOgZL-PIYy9LTA.d.mts.map → index-reference-CjvRzUh1-CG0Ouv6i.d.mts.map} +1 -1
- package/dist/index-reference-X_kA2mV8.d.mts +1 -0
- package/dist/{interpreter-CVd521dx-wWck8W93.mjs → interpreter-DoQwVOyS-BMiOIZcg.mjs} +209 -29
- package/dist/interpreter-DoQwVOyS-BMiOIZcg.mjs.map +1 -0
- package/dist/middleware-CcDThETr.d.mts +1 -0
- package/dist/{middleware-4P5tDL8a-C1UaoUUN.d.mts → middleware-DzFPUERE-C6RrGmcp.d.mts} +3 -3
- package/dist/{middleware-4P5tDL8a-C1UaoUUN.d.mts.map → middleware-DzFPUERE-C6RrGmcp.d.mts.map} +1 -1
- package/dist/{migration-DctFInNJ.d.mts → migration-BUWF9_Tx.d.mts} +2 -2
- package/dist/{migration-DctFInNJ.d.mts.map → migration-BUWF9_Tx.d.mts.map} +1 -1
- package/dist/orm-client.d.mts +113 -69
- package/dist/orm-client.d.mts.map +1 -1
- package/dist/orm-client.mjs +391 -121
- package/dist/orm-client.mjs.map +1 -1
- package/dist/{pack-BBsFyTEv.d.mts → pack-CbYm5Bfz.d.mts} +3 -3
- package/dist/{pack-BBsFyTEv.d.mts.map → pack-CbYm5Bfz.d.mts.map} +1 -1
- package/dist/plan-BjX90QC6.d.mts +2 -0
- package/dist/{plan-49sl7WSN-C22ZPSE9.d.mts → plan-Dv6v5_y4-CGWEjfCv.d.mts} +3 -3
- package/dist/{plan-49sl7WSN-C22ZPSE9.d.mts.map → plan-Dv6v5_y4-CGWEjfCv.d.mts.map} +1 -1
- package/dist/{psl-column-resolution-Bv_-TDHZ-Cuu5X_9o.d.mts → psl-column-resolution-Bv_-TDHZ-C9foRNXV.d.mts} +2 -2
- package/dist/{psl-column-resolution-Bv_-TDHZ-Cuu5X_9o.d.mts.map → psl-column-resolution-Bv_-TDHZ-C9foRNXV.d.mts.map} +1 -1
- package/dist/{psl-field-resolution-GN4iup8d-DjlZymdL.mjs → psl-field-resolution-CpxUePg1-tvt3yqqs.mjs} +9 -5
- package/dist/psl-field-resolution-CpxUePg1-tvt3yqqs.mjs.map +1 -0
- package/dist/{psl-infer-C9kVS9ma.mjs → psl-infer-Ckg3t4Kr.mjs} +2 -2
- package/dist/{psl-infer-C9kVS9ma.mjs.map → psl-infer-Ckg3t4Kr.mjs.map} +1 -1
- package/dist/{query-lane-context-DIJU7Owj-CAZQq4AD.d.mts → query-lane-context-BetHj4j--D3S5nucp.d.mts} +5 -5
- package/dist/{query-lane-context-DIJU7Owj-CAZQq4AD.d.mts.map → query-lane-context-BetHj4j--D3S5nucp.d.mts.map} +1 -1
- package/dist/query-lane-context-DgxWaKr-.d.mts +1 -0
- package/dist/relational-core.d.mts +13 -13
- package/dist/relational-core.mjs +3 -3
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
- package/dist/relational-core__ast.d.mts +3 -3
- package/dist/relational-core__ast.mjs +2 -2
- package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
- package/dist/relational-core__collection-methods.d.mts +2 -2
- package/dist/relational-core__contract-free.d.mts +2 -2
- package/dist/relational-core__contract-free.mjs +1 -1
- package/dist/relational-core__contract-free.mjs.map +1 -1
- package/dist/relational-core__expression.d.mts +4 -4
- package/dist/relational-core__expression.mjs +1 -1
- package/dist/relational-core__functions.d.mts +2 -2
- package/dist/relational-core__functions.mjs +1 -1
- package/dist/relational-core__index-reference.d.mts +2 -2
- 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.d.mts +4 -4
- package/dist/runtime.mjs +1 -1
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{sql-contract-serializer-sMY3prTx-D_K7uFJk.mjs → sql-contract-serializer-sMY3prTx-hb9EW6FW.mjs} +2 -2
- package/dist/{sql-contract-serializer-sMY3prTx-D_K7uFJk.mjs.map → sql-contract-serializer-sMY3prTx-hb9EW6FW.mjs.map} +1 -1
- package/dist/{sql-execution-plan-BeuM3CeD-DIzyMDsA.d.mts → sql-execution-plan-4OFBeONp-CLkDqMdz.d.mts} +3 -3
- package/dist/sql-execution-plan-4OFBeONp-CLkDqMdz.d.mts.map +1 -0
- package/dist/{transaction-state-CEe4TlC1-C8vX6Ror.d.mts → transaction-state-B4FVsvO7-DpvKYHSB.d.mts} +12 -10
- package/dist/{transaction-state-CEe4TlC1-C8vX6Ror.d.mts.map → transaction-state-B4FVsvO7-DpvKYHSB.d.mts.map} +1 -1
- package/dist/types-BFCrGkhG.d.mts +1 -0
- package/dist/{types-C6r7Myrr-3WL0WDKF.d.mts → types-CGr02DOy-CQsUdKCe.d.mts} +6 -6
- package/dist/{types-C6r7Myrr-3WL0WDKF.d.mts.map → types-CGr02DOy-CQsUdKCe.d.mts.map} +1 -1
- package/dist/{types-CWvmfrfd-DLQYhSUx.d.mts → types-CWvmfrfd-HPIh55bi.d.mts} +2 -2
- package/dist/{types-CWvmfrfd-DLQYhSUx.d.mts.map → types-CWvmfrfd-HPIh55bi.d.mts.map} +1 -1
- package/dist/{types-DeimCJiI-CVQS7KCu.d.mts → types-DEbNJhyS-CY7Ye2vN.d.mts} +5 -5
- package/dist/{types-DeimCJiI-CVQS7KCu.d.mts.map → types-DEbNJhyS-CY7Ye2vN.d.mts.map} +1 -1
- package/dist/{types-wn1bXh0b-CJPAJi22.mjs → types-DzQmUrUm-ColHE4Av.mjs} +18 -5
- package/dist/types-DzQmUrUm-ColHE4Av.mjs.map +1 -0
- package/dist/{validators-CWcdf_jZ.mjs → validators-CcR6gGf_.mjs} +13 -3
- package/dist/validators-CcR6gGf_.mjs.map +1 -0
- package/dist/{validators-Dt-19ywK.d.mts → validators-Dq7g7udF.d.mts} +10 -2
- package/dist/validators-Dq7g7udF.d.mts.map +1 -0
- package/package.json +19 -19
- package/dist/collection-methods-B-md3Mu9.d.mts +0 -1
- package/dist/config-types-BVAADwjp.mjs +0 -68
- package/dist/config-types-BVAADwjp.mjs.map +0 -1
- package/dist/config-types-Ce1tAJ0B.d.mts.map +0 -1
- package/dist/contract-builder-Dbo5LeXs.mjs.map +0 -1
- package/dist/control-Cb6YoQ8j.d.mts.map +0 -1
- package/dist/control-kHFMtE8A.mjs.map +0 -1
- package/dist/db-DfYeGVcu-B99ycjaC.d.mts.map +0 -1
- package/dist/derived-checks-BWg0DOyz-7O0x1Tgn.mjs.map +0 -1
- package/dist/dist-BJjqJT_M.mjs.map +0 -1
- package/dist/exports-BR5ctYYI-C_-aedbr.mjs.map +0 -1
- package/dist/expression-D8c3t2Dx-CCHt1OdT.d.mts.map +0 -1
- package/dist/expression-DL7L8You-C9BAeM2d.d.mts.map +0 -1
- package/dist/expression-Voyb-zN0.d.mts +0 -2
- package/dist/expression-impl-DHdjzqE3-Cd9gP7oC.mjs.map +0 -1
- package/dist/foreign-key-materialization-C53nVQuD.d.mts.map +0 -1
- package/dist/foreign-key-materialization-CCHAR789.mjs.map +0 -1
- package/dist/functions-zPzQYOjW.d.mts +0 -1
- package/dist/index-DA1EEz4y.d.mts.map +0 -1
- package/dist/index-reference-DuQ-0Da9.d.mts +0 -1
- package/dist/interpreter-CVd521dx-wWck8W93.mjs.map +0 -1
- package/dist/middleware-DDOdMwm4.d.mts +0 -1
- package/dist/plan-BEnXVtn1.d.mts +0 -2
- package/dist/psl-field-resolution-GN4iup8d-DjlZymdL.mjs.map +0 -1
- package/dist/query-lane-context-Dm5f9VAQ.d.mts +0 -1
- package/dist/sql-execution-plan-BeuM3CeD-DIzyMDsA.d.mts.map +0 -1
- package/dist/types-ChjF67Fc.d.mts +0 -1
- package/dist/types-wn1bXh0b-CJPAJi22.mjs.map +0 -1
- package/dist/validators-CWcdf_jZ.mjs.map +0 -1
- package/dist/validators-Dt-19ywK.d.mts.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as isAuthoredIndexInput } from "./index-naming-BOcJT1B3-D-49owHA.mjs";
|
|
2
2
|
import { u as sqlCodecColumnLength } from "./sql-data-type-LVBldu1a-Bq203xWX.mjs";
|
|
3
3
|
import { n as providesPslEntityPlacement, r as requiresNameUniqueAcrossNamespaces } from "./entity-handle-lowering-hook-3KYrW-BT.mjs";
|
|
4
|
-
import "./foreign-key-materialization-
|
|
4
|
+
import "./foreign-key-materialization-pYirysH0.mjs";
|
|
5
5
|
import { p as sqlTextFromStored } from "./sql-expression-CKgKznXS.mjs";
|
|
6
6
|
import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-HVaxhALD.mjs";
|
|
7
|
-
import { n as buildSqlContractFromDefinition } from "./derived-checks-
|
|
8
|
-
import { o as composedExtensionPackRefs } from "./contract-builder-
|
|
7
|
+
import { n as buildSqlContractFromDefinition, o as mergeSharedTable, r as columnsPhrase } from "./derived-checks-BoHNzt-a-4Vi-QMdx.mjs";
|
|
8
|
+
import { o as composedExtensionPackRefs } from "./contract-builder-BqswyknO.mjs";
|
|
9
9
|
import { c as storageName, i as mapFieldNamesToColumns, n as getAttribute, o as renamedTypeConstructorsOf, r as getNamedArgument, s as reportFieldDbAttributes, t as formatDbAttributeMigrationMessage } from "./psl-attribute-parsing-DrRPFOVh-U_SqMtcb.mjs";
|
|
10
|
-
import { _ as
|
|
10
|
+
import { S as sqlAttributeSpecs, _ as modelAttributeSpecsFrom, a as contractError, c as fieldSpecContext, d as instantiatePslTypeConstructor, f as interpretFieldAttribute, g as lowerTypeGenerators, h as lowerTypeDefault, i as collectResolvedFields, l as getAuthoringEntity, m as lowerEnumDefault, n as PSL_FOREIGN_KEY_CONFLICT_ON_STI_VARIANT, p as interpretModelAttribute, r as PSL_UNSCOPED_INDEX_ON_STI_VARIANT, t as PSL_CHECK_ON_STI_VARIANT, v as modelCoordinateKey, x as resolveFieldTypeDescriptor, y as modelSpecContext } from "./psl-field-resolution-CpxUePg1-tvt3yqqs.mjs";
|
|
11
11
|
import { t as defaultTableName } from "./default-table-name-BfFY8qYR-CWZFDX6v.mjs";
|
|
12
12
|
import { t as compareStrings } from "./compare-strings-BVf3BgCV-CefXnrMB.mjs";
|
|
13
13
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
@@ -24,7 +24,7 @@ import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl
|
|
|
24
24
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
25
25
|
import { contributedTypeAliasOf, createPslDiagnosticCollector, diagnosticSource, findBlockDescriptor, interpretExtensionBlocks, mapPslDiagnostics, nodePslSpan, resolveTypeAliases, typeAliasAttributeNames, typeAliasSpecContext, typeReferenceNode } from "@prisma/orm-framework/psl-parser";
|
|
26
26
|
import { claimedBlockKeywords, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslTypeChoice, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
27
|
-
//#region ../../../2-sql-family/2-authoring/contract-psl/dist/interpreter-
|
|
27
|
+
//#region ../../../2-sql-family/2-authoring/contract-psl/dist/interpreter-DoQwVOyS.mjs
|
|
28
28
|
/**
|
|
29
29
|
* Reports `PSL_DEPRECATED_SCALAR_NAME` at the type of a field or `types {}` alias whose type constructor is a deprecated alias, naming the replacement. The alias gives the same codec, so the contract does not change. ADR 257.
|
|
30
30
|
*/
|
|
@@ -837,10 +837,26 @@ function buildModelNodeFromPsl(input) {
|
|
|
837
837
|
field,
|
|
838
838
|
relation: getAttribute(field.attributes, "relation")
|
|
839
839
|
})).filter((entry) => Boolean(entry.relation));
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
840
|
+
const constraintSites = /* @__PURE__ */ new Map();
|
|
841
|
+
const sited = (node, site) => {
|
|
842
|
+
constraintSites.set(node, site);
|
|
843
|
+
return node;
|
|
844
|
+
};
|
|
845
|
+
const uniqueConstraints = resolvedFields.filter((field) => field.isUnique).map((resolved) => {
|
|
846
|
+
const attribute = getAttribute(resolved.field.attributes, "unique");
|
|
847
|
+
return sited({
|
|
848
|
+
columns: [resolved.columnName],
|
|
849
|
+
...ifDefined("name", resolved.uniqueName)
|
|
850
|
+
}, {
|
|
851
|
+
label: "@unique",
|
|
852
|
+
location: source.at(attribute?.span ?? resolved.field.span),
|
|
853
|
+
indexArguments: [
|
|
854
|
+
`[${resolved.field.name}]`,
|
|
855
|
+
"unique: true",
|
|
856
|
+
...writtenArguments(attribute?.args ?? [])
|
|
857
|
+
]
|
|
858
|
+
});
|
|
859
|
+
});
|
|
844
860
|
const indexNodes = [];
|
|
845
861
|
const checkNodes = [];
|
|
846
862
|
const foreignKeyNodes = [];
|
|
@@ -951,10 +967,19 @@ function buildModelNodeFromPsl(input) {
|
|
|
951
967
|
entityLabel: attributeLabel
|
|
952
968
|
});
|
|
953
969
|
if (!columnNames) continue;
|
|
954
|
-
|
|
970
|
+
const [writtenFields, ...rest] = writtenArguments(modelAttribute.args);
|
|
971
|
+
uniqueConstraints.push(sited({
|
|
955
972
|
columns: columnNames,
|
|
956
973
|
...ifDefined("name", parsed.map)
|
|
957
|
-
}
|
|
974
|
+
}, {
|
|
975
|
+
label: "@@unique",
|
|
976
|
+
location: source.at(modelAttribute.span),
|
|
977
|
+
indexArguments: [
|
|
978
|
+
...writtenFields === void 0 ? [] : [writtenFields],
|
|
979
|
+
"unique: true",
|
|
980
|
+
...rest
|
|
981
|
+
]
|
|
982
|
+
}));
|
|
958
983
|
continue;
|
|
959
984
|
}
|
|
960
985
|
if (modelAttribute.name === "index") {
|
|
@@ -983,7 +1008,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
983
1008
|
if (!mapped) continue;
|
|
984
1009
|
columnNames = mapped;
|
|
985
1010
|
}
|
|
986
|
-
indexNodes.push(blindCast({
|
|
1011
|
+
indexNodes.push(sited(blindCast({
|
|
987
1012
|
...ifDefined("columns", columnNames),
|
|
988
1013
|
...ifDefined("expression", parsed.expression === void 0 ? void 0 : sqlTextFromStored(parsed.expression.value.value)),
|
|
989
1014
|
where: parsed.where === void 0 ? void 0 : sqlTextFromStored(parsed.where.value.value),
|
|
@@ -992,6 +1017,10 @@ function buildModelNodeFromPsl(input) {
|
|
|
992
1017
|
map: parsed.map,
|
|
993
1018
|
type: parsed.type,
|
|
994
1019
|
options: parsed.options
|
|
1020
|
+
}), {
|
|
1021
|
+
label: "@@index",
|
|
1022
|
+
location: source.at(modelAttribute.span),
|
|
1023
|
+
indexArguments: writtenArguments(modelAttribute.args)
|
|
995
1024
|
}));
|
|
996
1025
|
continue;
|
|
997
1026
|
}
|
|
@@ -1071,7 +1100,10 @@ function buildModelNodeFromPsl(input) {
|
|
|
1071
1100
|
attribute: modelAttribute.name,
|
|
1072
1101
|
modelName: model.name
|
|
1073
1102
|
} });
|
|
1074
|
-
indexNodes.push(lowered.index
|
|
1103
|
+
indexNodes.push(sited(lowered.index, {
|
|
1104
|
+
label: `@@${modelAttribute.name}`,
|
|
1105
|
+
location: source.at(modelAttribute.span)
|
|
1106
|
+
}));
|
|
1075
1107
|
continue;
|
|
1076
1108
|
}
|
|
1077
1109
|
const slot = modelAttributeEntities[contributedModelAttribute.attribute] ?? {};
|
|
@@ -1175,7 +1207,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1175
1207
|
continue;
|
|
1176
1208
|
}
|
|
1177
1209
|
const crossTargetTableName = resolvedTable;
|
|
1178
|
-
foreignKeyNodes.push({
|
|
1210
|
+
foreignKeyNodes.push(sited({
|
|
1179
1211
|
columns: localColumns,
|
|
1180
1212
|
references: {
|
|
1181
1213
|
model: fieldTypeName,
|
|
@@ -1188,7 +1220,10 @@ function buildModelNodeFromPsl(input) {
|
|
|
1188
1220
|
...ifDefined("onDelete", onDelete),
|
|
1189
1221
|
...ifDefined("onUpdate", onUpdate),
|
|
1190
1222
|
...ifDefined("index", parsedRelation.index)
|
|
1191
|
-
}
|
|
1223
|
+
}, {
|
|
1224
|
+
label: "@relation",
|
|
1225
|
+
location: source.at(relationAttribute.relation.span)
|
|
1226
|
+
}));
|
|
1192
1227
|
if (typeof parsedRelation.index === "string") relationIndexLocations.push({
|
|
1193
1228
|
namespaceId: modelNamespaceId,
|
|
1194
1229
|
tableName,
|
|
@@ -1290,7 +1325,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1290
1325
|
const onDelete = parsedRelation.onDelete ? normalizeReferentialAction(parsedRelation.onDelete) : void 0;
|
|
1291
1326
|
const onUpdate = parsedRelation.onUpdate ? normalizeReferentialAction(parsedRelation.onUpdate) : void 0;
|
|
1292
1327
|
const targetTableName = storageName(targetModel, input.physicalNames);
|
|
1293
|
-
foreignKeyNodes.push({
|
|
1328
|
+
foreignKeyNodes.push(sited({
|
|
1294
1329
|
columns: localColumns,
|
|
1295
1330
|
references: {
|
|
1296
1331
|
model: targetModel.name,
|
|
@@ -1302,7 +1337,10 @@ function buildModelNodeFromPsl(input) {
|
|
|
1302
1337
|
...ifDefined("onDelete", onDelete),
|
|
1303
1338
|
...ifDefined("onUpdate", onUpdate),
|
|
1304
1339
|
...ifDefined("index", parsedRelation.index)
|
|
1305
|
-
}
|
|
1340
|
+
}, {
|
|
1341
|
+
label: "@relation",
|
|
1342
|
+
location: source.at(relationAttribute.relation.span)
|
|
1343
|
+
}));
|
|
1306
1344
|
if (typeof parsedRelation.index === "string") relationIndexLocations.push({
|
|
1307
1345
|
namespaceId: modelNamespaceId,
|
|
1308
1346
|
tableName,
|
|
@@ -1356,6 +1394,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1356
1394
|
...ifDefined("control", controlPolicy)
|
|
1357
1395
|
},
|
|
1358
1396
|
fkRelationMetadata: resultFkRelationMetadata,
|
|
1397
|
+
constraintSites,
|
|
1359
1398
|
relationIndexLocations,
|
|
1360
1399
|
invalidFkPairings: resultInvalidFkPairings,
|
|
1361
1400
|
crossSpaceRelations: resultCrossSpaceRelations,
|
|
@@ -1779,11 +1818,13 @@ function materializeMtiVariantStorageLinks(modelNodes, baseDeclarations, stiVari
|
|
|
1779
1818
|
function materializeStiVariantStorageColumns(modelNodes, baseDeclarations, stiVariantKeys, defaultNamespaceId) {
|
|
1780
1819
|
if (stiVariantKeys.size === 0) return {
|
|
1781
1820
|
modelNodes: [...modelNodes],
|
|
1782
|
-
stiBaseFieldsByBase: /* @__PURE__ */ new Map()
|
|
1821
|
+
stiBaseFieldsByBase: /* @__PURE__ */ new Map(),
|
|
1822
|
+
refusals: []
|
|
1783
1823
|
};
|
|
1784
1824
|
const keyOf = (node) => modelCoordinateKey(node.namespaceId ?? defaultNamespaceId, node.modelName);
|
|
1785
1825
|
const nodeByModel = new Map(modelNodes.map((node) => [keyOf(node), node]));
|
|
1786
1826
|
const stiColumnsByBase = /* @__PURE__ */ new Map();
|
|
1827
|
+
const variantsByBase = /* @__PURE__ */ new Map();
|
|
1787
1828
|
for (const variantKey of stiVariantKeys) {
|
|
1788
1829
|
const variantNode = nodeByModel.get(variantKey);
|
|
1789
1830
|
const baseDecl = baseDeclarations.get(variantKey);
|
|
@@ -1802,23 +1843,77 @@ function materializeStiVariantStorageColumns(modelNodes, baseDeclarations, stiVa
|
|
|
1802
1843
|
});
|
|
1803
1844
|
}
|
|
1804
1845
|
stiColumnsByBase.set(baseDecl.base.key, claimed);
|
|
1846
|
+
variantsByBase.set(baseDecl.base.key, [...variantsByBase.get(baseDecl.base.key) ?? [], variantNode]);
|
|
1847
|
+
}
|
|
1848
|
+
const mergedByBase = /* @__PURE__ */ new Map();
|
|
1849
|
+
const refusals = [];
|
|
1850
|
+
for (const [baseKey, variants] of variantsByBase) {
|
|
1851
|
+
const baseNode = nodeByModel.get(baseKey);
|
|
1852
|
+
if (baseNode === void 0) continue;
|
|
1853
|
+
const merged = mergeSharedTable({
|
|
1854
|
+
tableName: baseNode.tableName,
|
|
1855
|
+
base: tableSharerOf(baseNode),
|
|
1856
|
+
variants: variants.map((variant) => ({
|
|
1857
|
+
...tableSharerOf(variant),
|
|
1858
|
+
uniques: variant.uniques ?? []
|
|
1859
|
+
})),
|
|
1860
|
+
viewOf: foreignKeyNodeView
|
|
1861
|
+
});
|
|
1862
|
+
mergedByBase.set(baseKey, merged);
|
|
1863
|
+
refusals.push(...merged.refusals.map((refusal) => ({
|
|
1864
|
+
baseKey,
|
|
1865
|
+
refusal
|
|
1866
|
+
})));
|
|
1805
1867
|
}
|
|
1806
1868
|
const stiBaseFieldsByBase = /* @__PURE__ */ new Map();
|
|
1807
1869
|
for (const [baseName, columns] of stiColumnsByBase) stiBaseFieldsByBase.set(baseName, columns.map((field) => field.fieldName));
|
|
1808
1870
|
return {
|
|
1809
1871
|
modelNodes: modelNodes.map((node) => {
|
|
1810
|
-
if (stiVariantKeys.has(keyOf(node)))
|
|
1811
|
-
...node
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1872
|
+
if (stiVariantKeys.has(keyOf(node))) {
|
|
1873
|
+
const { uniques: _uniques, indexes: _indexes, foreignKeys: _foreignKeys, ...variant } = node;
|
|
1874
|
+
return {
|
|
1875
|
+
...variant,
|
|
1876
|
+
sharesBaseTable: true
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1879
|
+
const merged = mergedByBase.get(keyOf(node));
|
|
1880
|
+
if (merged === void 0) return node;
|
|
1881
|
+
const { indexes, foreignKeys } = merged;
|
|
1816
1882
|
return {
|
|
1817
1883
|
...node,
|
|
1818
|
-
fields: [...node.fields, ...
|
|
1884
|
+
fields: [...node.fields, ...stiColumnsByBase.get(keyOf(node)) ?? []],
|
|
1885
|
+
...indexes.length > 0 ? { indexes } : {},
|
|
1886
|
+
...foreignKeys.length > 0 ? { foreignKeys } : {}
|
|
1819
1887
|
};
|
|
1820
1888
|
}),
|
|
1821
|
-
stiBaseFieldsByBase
|
|
1889
|
+
stiBaseFieldsByBase,
|
|
1890
|
+
refusals
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
function tableSharerOf(node) {
|
|
1894
|
+
return {
|
|
1895
|
+
modelName: node.modelName,
|
|
1896
|
+
columns: new Set(node.fields.map((field) => field.columnName)),
|
|
1897
|
+
defaultedColumns: new Set(node.fields.filter((field) => field.default !== void 0).map((field) => field.columnName)),
|
|
1898
|
+
foreignKeys: node.foreignKeys ?? [],
|
|
1899
|
+
indexes: node.indexes ?? []
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
function foreignKeyNodeView(foreignKey) {
|
|
1903
|
+
const { columns, references, constraint, index, ...rest } = foreignKey;
|
|
1904
|
+
const { columns: targetColumns, ...target } = references;
|
|
1905
|
+
return {
|
|
1906
|
+
columns,
|
|
1907
|
+
targetColumns,
|
|
1908
|
+
rest: {
|
|
1909
|
+
...rest,
|
|
1910
|
+
target,
|
|
1911
|
+
constraint: constraint ?? true,
|
|
1912
|
+
index: index ?? true
|
|
1913
|
+
},
|
|
1914
|
+
constraint: constraint !== false,
|
|
1915
|
+
derivesIndex: index === void 0 || index === true,
|
|
1916
|
+
namedIndex: typeof index === "string" ? index : void 0
|
|
1822
1917
|
};
|
|
1823
1918
|
}
|
|
1824
1919
|
/**
|
|
@@ -1872,6 +1967,62 @@ function relationIndexRefusal(error, locations) {
|
|
|
1872
1967
|
message: error.fix === void 0 ? error.message : `${error.message} ${error.fix}`
|
|
1873
1968
|
};
|
|
1874
1969
|
}
|
|
1970
|
+
/** The discriminator column of a variant's base, as a `where` condition names it. */
|
|
1971
|
+
function discriminatorColumnOf(baseDecl, discriminatorDeclarations, physicalNames) {
|
|
1972
|
+
const fieldName = discriminatorDeclarations.get(baseDecl.base.key)?.fieldName;
|
|
1973
|
+
const field = fieldName === void 0 ? void 0 : baseDecl.base.model.fields[fieldName];
|
|
1974
|
+
return field === void 0 ? void 0 : physicalNames.get(field);
|
|
1975
|
+
}
|
|
1976
|
+
function writtenArguments(args) {
|
|
1977
|
+
return args.map((arg) => arg.kind === "named" ? `${arg.name}: ${arg.value}` : arg.value);
|
|
1978
|
+
}
|
|
1979
|
+
/** A column as `sql` template text names it: bare when it is a plain lower-case identifier, otherwise in double quotes, which every SQL target reads as a quoted identifier. */
|
|
1980
|
+
function sqlColumnReference(column) {
|
|
1981
|
+
return /^[a-z_][a-z0-9_]*$/.test(column) ? column : `"${column.replaceAll("\"", "\"\"")}"`;
|
|
1982
|
+
}
|
|
1983
|
+
/**
|
|
1984
|
+
* The diagnostic for a refusal of what an STI variant declares on its base's table. An index or unique is reported only while the base's discriminator is known, since its advice is an index scoped to the variant's discriminator value; otherwise the missing discriminator is reported instead.
|
|
1985
|
+
*/
|
|
1986
|
+
function stiRefusalDiagnostic({ refusal }, context) {
|
|
1987
|
+
const { baseDecl, site, discriminatorColumn } = context;
|
|
1988
|
+
const variant = baseDecl.model.name;
|
|
1989
|
+
const base = baseDecl.base.model.name;
|
|
1990
|
+
const at = site?.location ?? baseDecl.source.at(baseDecl.span);
|
|
1991
|
+
if (refusal.kind === "defaultedForeignKey") return {
|
|
1992
|
+
code: PSL_FOREIGN_KEY_CONFLICT_ON_STI_VARIANT,
|
|
1993
|
+
message: `Model "${variant}" declares a foreign key on (${refusal.foreignKey.columns.join(", ")}), but ${columnsPhrase(refusal.columns)} has a default, which the rows of the other variants of "${base}" get too (single-table inheritance). Remove the default.`,
|
|
1994
|
+
...at
|
|
1995
|
+
};
|
|
1996
|
+
if (refusal.kind === "foreignKey") {
|
|
1997
|
+
const columns = refusal.columns.join(", ");
|
|
1998
|
+
const declared = refusal.foreignKey.columns.join(", ");
|
|
1999
|
+
const shared = columnsPhrase(refusal.columns);
|
|
2000
|
+
return {
|
|
2001
|
+
code: PSL_FOREIGN_KEY_CONFLICT_ON_STI_VARIANT,
|
|
2002
|
+
message: !refusal.otherDeclaresOne ? refusal.otherIsBase ? `Model "${variant}" declares a foreign key on (${declared}), but its base model "${base}" also maps ${shared} without it (single-table inheritance). Every row of "${base}" would have to satisfy it; give the field of "${variant}" its own column with @map.` : `Model "${variant}" declares a foreign key on (${declared}), but "${refusal.other}" also maps ${shared} in the table of "${base}" without it (single-table inheritance). Every "${refusal.other}" row would have to satisfy it; give the field of "${variant}" its own column with @map.` : refusal.otherIsBase ? `Model "${variant}" shares the table of its base model "${base}" (single-table inheritance) and declares a foreign key on (${columns}) that differs from the one "${base}" declares there. Every row would have to satisfy both; keep only one of the two relations.` : `Models "${variant}" and "${refusal.other}" share the table of their base model "${base}" (single-table inheritance) and declare different foreign keys on (${columns}). Every row would have to satisfy both; give each variant its own column.`,
|
|
2003
|
+
...at
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
if (discriminatorColumn === void 0 || baseDecl.value === void 0) return void 0;
|
|
2007
|
+
const label = site?.label ?? (refusal.kind === "unique" ? "@@unique" : "@@index");
|
|
2008
|
+
const shared = `Model "${variant}" shares the table of its base model "${base}" (single-table inheritance)`;
|
|
2009
|
+
if (refusal.kind === "index" && refusal.namedDifferentlyBy !== void 0) return {
|
|
2010
|
+
code: PSL_UNSCOPED_INDEX_ON_STI_VARIANT,
|
|
2011
|
+
message: `${shared}, and "${refusal.namedDifferentlyBy}" already declares this index there under another name. Give both the same name.`,
|
|
2012
|
+
...at
|
|
2013
|
+
};
|
|
2014
|
+
if (refusal.kind === "unique" && context.backsSingularRelation(refusal.unique.columns)) return {
|
|
2015
|
+
code: PSL_UNSCOPED_INDEX_ON_STI_VARIANT,
|
|
2016
|
+
message: `${shared}, so "${label}" cannot be stored there, and a one-to-one relation from a single-table variant is not supported yet.`,
|
|
2017
|
+
...at
|
|
2018
|
+
};
|
|
2019
|
+
const condition = `where: sql\`${sqlColumnReference(discriminatorColumn)} = '${baseDecl.value.replaceAll("'", "''")}'\``;
|
|
2020
|
+
return {
|
|
2021
|
+
code: PSL_UNSCOPED_INDEX_ON_STI_VARIANT,
|
|
2022
|
+
message: `${shared}, so "${label}" would also cover the rows of other variants. Without a condition, only the backing index of one of its own relations is accepted. ${site?.indexArguments === void 0 ? `Limit it to this variant's rows with ${condition.replace("where: ", "")} if the attribute takes a condition, or give its field a column of its own.` : `Scope it to this variant instead: @@index(${[...site.indexArguments, condition].join(", ")})`}`,
|
|
2023
|
+
...at
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
1875
2026
|
function interpretPslDocumentToSqlContract(input) {
|
|
1876
2027
|
if (!input.target) throw new InternalError("PSL interpretation requires an explicit target context from composition.");
|
|
1877
2028
|
if (!input.scalarColumnDescriptors) throw new InternalError("PSL interpretation requires composed scalar type descriptors.");
|
|
@@ -2143,6 +2294,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2143
2294
|
const modelNodes = /* @__PURE__ */ new Map();
|
|
2144
2295
|
const fkRelationMetadata = [];
|
|
2145
2296
|
const relationIndexLocations = [];
|
|
2297
|
+
const constraintSites = /* @__PURE__ */ new Map();
|
|
2146
2298
|
const invalidFkPairings = [];
|
|
2147
2299
|
const backrelationCandidates = [];
|
|
2148
2300
|
const crossSpaceRelationsByModel = /* @__PURE__ */ new Map();
|
|
@@ -2203,6 +2355,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2203
2355
|
});
|
|
2204
2356
|
fkRelationMetadata.push(...result.fkRelationMetadata);
|
|
2205
2357
|
relationIndexLocations.push(...result.relationIndexLocations);
|
|
2358
|
+
for (const [node, site] of result.constraintSites) constraintSites.set(node, site);
|
|
2206
2359
|
invalidFkPairings.push(...result.invalidFkPairings);
|
|
2207
2360
|
backrelationCandidates.push(...result.backrelationCandidates);
|
|
2208
2361
|
if (result.crossSpaceRelations.length > 0) {
|
|
@@ -2305,7 +2458,31 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2305
2458
|
...model,
|
|
2306
2459
|
...modelRelations.has(symbol) ? { relations: [...modelRelations.get(symbol) ?? []].sort((left, right) => compareStrings(left.fieldName, right.fieldName)) } : {}
|
|
2307
2460
|
})), baseDeclarations, stiVariantKeys, defaultNamespaceId);
|
|
2308
|
-
const { modelNodes: stiColumnModelNodes, stiBaseFieldsByBase } = materializeStiVariantStorageColumns(mtiLinkedModelNodes, baseDeclarations, stiVariantKeys, defaultNamespaceId);
|
|
2461
|
+
const { modelNodes: stiColumnModelNodes, stiBaseFieldsByBase, refusals: stiRefusals } = materializeStiVariantStorageColumns(mtiLinkedModelNodes, baseDeclarations, stiVariantKeys, defaultNamespaceId);
|
|
2462
|
+
const stiBaseTables = /* @__PURE__ */ new Map();
|
|
2463
|
+
for (const variantKey of stiVariantKeys) {
|
|
2464
|
+
const baseDecl = baseDeclarations.get(variantKey);
|
|
2465
|
+
const nodeOf = (key) => mtiLinkedModelNodes.find((node) => modelCoordinateKey(node.namespaceId ?? defaultNamespaceId, node.modelName) === key);
|
|
2466
|
+
const variantNode = nodeOf(variantKey);
|
|
2467
|
+
const baseNode = nodeOf(baseDecl?.base.key);
|
|
2468
|
+
if (variantNode === void 0 || baseNode === void 0) continue;
|
|
2469
|
+
stiBaseTables.set(`${variantNode.namespaceId ?? defaultNamespaceId}\0${variantNode.tableName}`, baseNode.tableName);
|
|
2470
|
+
}
|
|
2471
|
+
const oneToOneRelations = [...modelRelations.values()].flat().filter((relation) => relation.cardinality === "1:1");
|
|
2472
|
+
for (const stiRefusal of stiRefusals) {
|
|
2473
|
+
const { refusal } = stiRefusal;
|
|
2474
|
+
const variantKey = [...stiVariantKeys].find((key) => baseDeclarations.get(key)?.base.key === stiRefusal.baseKey && baseDeclarations.get(key)?.model.name === refusal.variant);
|
|
2475
|
+
const baseDecl = variantKey === void 0 ? void 0 : baseDeclarations.get(variantKey);
|
|
2476
|
+
invariant(baseDecl !== void 0, "a shared-table refusal names one of the base's variants");
|
|
2477
|
+
const node = refusal.kind === "foreignKey" || refusal.kind === "defaultedForeignKey" ? refusal.foreignKey : refusal.kind === "unique" ? refusal.unique : refusal.index;
|
|
2478
|
+
const diagnostic = stiRefusalDiagnostic(stiRefusal, {
|
|
2479
|
+
baseDecl,
|
|
2480
|
+
site: constraintSites.get(node),
|
|
2481
|
+
discriminatorColumn: discriminatorColumnOf(baseDecl, discriminatorDeclarations, physicalNames),
|
|
2482
|
+
backsSingularRelation: (columns) => oneToOneRelations.some((relation) => relation.toModel === refusal.variant && relation.on.childColumns.length === columns.length && relation.on.childColumns.every((column) => columns.includes(column)))
|
|
2483
|
+
});
|
|
2484
|
+
if (diagnostic !== void 0) diagnostics.push(diagnostic);
|
|
2485
|
+
}
|
|
2309
2486
|
if (diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0 || droppedFields.size > 0) return notOk({
|
|
2310
2487
|
summary: "PSL to SQL contract interpretation failed",
|
|
2311
2488
|
diagnostics: [...input.seedDiagnostics ?? [], ...diagnostics.toExternal()]
|
|
@@ -2356,7 +2533,10 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2356
2533
|
models: withPolymorphism(stiColumnModelNodes, polymorphism, defaultNamespaceId)
|
|
2357
2534
|
}, input.codecLookup, input.dataTypes.lookup);
|
|
2358
2535
|
} catch (error) {
|
|
2359
|
-
const refusal = relationIndexRefusal(error, relationIndexLocations)
|
|
2536
|
+
const refusal = relationIndexRefusal(error, relationIndexLocations.map((location) => ({
|
|
2537
|
+
...location,
|
|
2538
|
+
tableName: stiBaseTables.get(`${location.namespaceId}\0${location.tableName}`) ?? location.tableName
|
|
2539
|
+
})));
|
|
2360
2540
|
if (refusal === void 0) throw error;
|
|
2361
2541
|
diagnostics.push({
|
|
2362
2542
|
code: "PSL_INVALID_RELATION_ATTRIBUTE",
|
|
@@ -2388,4 +2568,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2388
2568
|
//#endregion
|
|
2389
2569
|
export { normalizeReferentialAction as a, interpretPslDocumentToSqlContract as i, buildEntityTypesByDiscriminator as n, indexFkRelations as r, applyBackrelationCandidates as t };
|
|
2390
2570
|
|
|
2391
|
-
//# sourceMappingURL=interpreter-
|
|
2571
|
+
//# sourceMappingURL=interpreter-DoQwVOyS-BMiOIZcg.mjs.map
|