@prisma/orm-family-sql 8.0.0-rc.18-dev.21 → 8.0.0-rc.18-dev.23
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/{ast-Dzsat0Zb.d.mts → ast-Cq7uhA86.d.mts} +3 -3
- package/dist/{ast-Dzsat0Zb.d.mts.map → ast-Cq7uhA86.d.mts.map} +1 -1
- package/dist/{attribute-specs-2I2xuKEa.d.mts → attribute-specs-BaasqvID.d.mts} +4 -4
- package/dist/{attribute-specs-2I2xuKEa.d.mts.map → attribute-specs-BaasqvID.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CZ-vdwYS-BpyuSxbj.d.mts → authoring-entity-types-CZ-vdwYS-CLLXZPhj.d.mts} +2 -2
- package/dist/{authoring-entity-types-CZ-vdwYS-BpyuSxbj.d.mts.map → authoring-entity-types-CZ-vdwYS-CLLXZPhj.d.mts.map} +1 -1
- package/dist/{authoring-type-constructors-0Iv2zdwS-BJjO5EnA.mjs → authoring-type-constructors-0Iv2zdwS-CJbLWgCh.mjs} +2 -2
- package/dist/{authoring-type-constructors-0Iv2zdwS-BJjO5EnA.mjs.map → authoring-type-constructors-0Iv2zdwS-CJbLWgCh.mjs.map} +1 -1
- package/dist/builder.d.mts +3 -3
- package/dist/builder__runtime.d.mts +9 -9
- package/dist/builder__types.d.mts +5 -5
- package/dist/{collection-methods-B-tM7OPZ-v8HK9Txa.d.mts → collection-methods-B-tM7OPZ-DzXedZdV.d.mts} +3 -3
- package/dist/{collection-methods-B-tM7OPZ-v8HK9Txa.d.mts.map → collection-methods-B-tM7OPZ-DzXedZdV.d.mts.map} +1 -1
- package/dist/collection-methods-BNAu8vHk.d.mts +1 -0
- package/dist/{config-types-DopEiXtk.mjs → config-types-BFS-ivzi.mjs} +2 -2
- package/dist/{config-types-DopEiXtk.mjs.map → config-types-BFS-ivzi.mjs.map} +1 -1
- package/dist/{config-types-B47kpY4J.d.mts → config-types-DN0IueHY.d.mts} +3 -3
- package/dist/{config-types-B47kpY4J.d.mts.map → config-types-DN0IueHY.d.mts.map} +1 -1
- package/dist/{contract-builder-C1X8KoEM.mjs → contract-builder-CKO_xspE.mjs} +3 -3
- package/dist/{contract-builder-C1X8KoEM.mjs.map → contract-builder-CKO_xspE.mjs.map} +1 -1
- package/dist/{contract-builder-De_fyZGT.d.mts → contract-builder-DkaXfJoe.d.mts} +9 -10
- package/dist/{contract-builder-De_fyZGT.d.mts.map → contract-builder-DkaXfJoe.d.mts.map} +1 -1
- package/dist/contract-emitter.d.mts +1 -2
- package/dist/contract-emitter.d.mts.map +1 -1
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-prisma7__provider.d.mts +1 -1
- package/dist/contract-prisma7__provider.mjs +5 -5
- package/dist/contract-psl.d.mts +2 -2
- 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.d.mts +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- 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 +2 -2
- package/dist/contract__data-type.d.mts +1 -1
- package/dist/contract__data-type.mjs +1 -1
- package/dist/contract__types.d.mts +2 -2
- package/dist/contract__validators.mjs +1 -1
- package/dist/{control-BqS5MMDh.d.mts → control-BLC3fSF4.d.mts} +12 -12
- package/dist/{control-BqS5MMDh.d.mts.map → control-BLC3fSF4.d.mts.map} +1 -1
- package/dist/{control-C7MNvu5Q.mjs → control-BTNIQxYM.mjs} +8 -8
- package/dist/{control-C7MNvu5Q.mjs.map → control-BTNIQxYM.mjs.map} +1 -1
- package/dist/{control-adapter-BCopdpsT-Bou0wWLF.d.mts → control-adapter-BCopdpsT-BpC5YbAf.d.mts} +5 -5
- package/dist/{control-adapter-BCopdpsT-Bou0wWLF.d.mts.map → control-adapter-BCopdpsT-BpC5YbAf.d.mts.map} +1 -1
- package/dist/control-adapter-DVjkUph8.d.mts +1 -0
- package/dist/data-type-DKk8Unnz.mjs.map +1 -1
- package/dist/{data-type-DuzmTpzK.d.mts → data-type-pNwyyJpr.d.mts} +2 -2
- package/dist/{data-type-DuzmTpzK.d.mts.map → data-type-pNwyyJpr.d.mts.map} +1 -1
- package/dist/{db-BmrN9nRS-xynLbnAy.d.mts → db-BmrN9nRS-BzK96yVh.d.mts} +11 -11
- package/dist/{db-BmrN9nRS-xynLbnAy.d.mts.map → db-BmrN9nRS-BzK96yVh.d.mts.map} +1 -1
- package/dist/{ddl-types-CoP6yAw9-BDp3W_5g.d.mts → ddl-types-CoP6yAw9-Cxc2zvi3.d.mts} +3 -3
- package/dist/{ddl-types-CoP6yAw9-BDp3W_5g.d.mts.map → ddl-types-CoP6yAw9-Cxc2zvi3.d.mts.map} +1 -1
- package/dist/{derived-checks-DpPkO6Dt-BMXrIjZy.d.mts → derived-checks-DpPkO6Dt-D-vp9vY3.d.mts} +2 -2
- package/dist/{derived-checks-DpPkO6Dt-BMXrIjZy.d.mts.map → derived-checks-DpPkO6Dt-D-vp9vY3.d.mts.map} +1 -1
- package/dist/{derived-checks-sRZp_gTF-UGwFWkVX.mjs → derived-checks-sRZp_gTF-Dvk3wkm9.mjs} +3 -3
- package/dist/{derived-checks-sRZp_gTF-UGwFWkVX.mjs.map → derived-checks-sRZp_gTF-Dvk3wkm9.mjs.map} +1 -1
- package/dist/{diff-D6PbCUWL.d.mts → diff-Czog35Sk.d.mts} +4 -4
- package/dist/{diff-D6PbCUWL.d.mts.map → diff-Czog35Sk.d.mts.map} +1 -1
- package/dist/{dist-DAHIT4AS.mjs → dist-Bxu8hzMC.mjs} +5 -10
- package/dist/dist-Bxu8hzMC.mjs.map +1 -0
- package/dist/{expression-BzrfOiPC-3NqR8UzK.d.mts → expression-BzrfOiPC-CXjjRKqc.d.mts} +5 -5
- package/dist/{expression-BzrfOiPC-3NqR8UzK.d.mts.map → expression-BzrfOiPC-CXjjRKqc.d.mts.map} +1 -1
- package/dist/expression-CIBqCwC1.d.mts +2 -0
- package/dist/{expression-sOY1120I-DOykEQlw.d.mts → expression-sOY1120I-DMTeGMQP.d.mts} +3 -3
- package/dist/{expression-sOY1120I-DOykEQlw.d.mts.map → expression-sOY1120I-DMTeGMQP.d.mts.map} +1 -1
- package/dist/family.d.mts +10 -10
- package/dist/family.mjs +5 -5
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +3 -3
- package/dist/family__control.mjs +3 -3
- package/dist/family__diff.d.mts +1 -1
- 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 +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-build.d.mts +1 -1
- package/dist/family__psl-build.mjs +1 -1
- package/dist/{functions-Cp8soSAv.d.mts → functions-LyIMc_v9.d.mts} +5 -5
- package/dist/{functions-Cp8soSAv.d.mts.map → functions-LyIMc_v9.d.mts.map} +1 -1
- package/dist/{index-BxlXOVeT.d.mts → index-B0hZw3uT.d.mts} +19 -19
- package/dist/{index-BxlXOVeT.d.mts.map → index-B0hZw3uT.d.mts.map} +1 -1
- package/dist/{index-BXFiad5j.d.mts → index-BRFLss5v.d.mts} +2 -2
- package/dist/{index-BXFiad5j.d.mts.map → index-BRFLss5v.d.mts.map} +1 -1
- package/dist/index-reference-CsxaNof9.d.mts +1 -0
- package/dist/{index-reference-DJaQLZA3-DxmYkkX-.d.mts → index-reference-DJaQLZA3-DS-GPKXs.d.mts} +3 -3
- package/dist/{index-reference-DJaQLZA3-DxmYkkX-.d.mts.map → index-reference-DJaQLZA3-DS-GPKXs.d.mts.map} +1 -1
- package/dist/{interpreter-B9wNACvu-CjrIm-Jo.mjs → interpreter-B9wNACvu-Bk0vkYDs.mjs} +3 -3
- package/dist/{interpreter-B9wNACvu-CjrIm-Jo.mjs.map → interpreter-B9wNACvu-Bk0vkYDs.mjs.map} +1 -1
- package/dist/{ir-DgNo535E.d.mts → ir-qK4wX3D3.d.mts} +2 -2
- package/dist/{ir-DgNo535E.d.mts.map → ir-qK4wX3D3.d.mts.map} +1 -1
- package/dist/middleware-MgGkjEXt.d.mts +1 -0
- package/dist/{middleware-oCT0RWkt-AFlRNCOD.d.mts → middleware-oCT0RWkt-DGav7C8b.d.mts} +2 -2
- package/dist/{middleware-oCT0RWkt-AFlRNCOD.d.mts.map → middleware-oCT0RWkt-DGav7C8b.d.mts.map} +1 -1
- package/dist/{migration-CJ0xK_7n.d.mts → migration-CFMl5iKv.d.mts} +3 -3
- package/dist/{migration-CJ0xK_7n.d.mts.map → migration-CFMl5iKv.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +18 -18
- package/dist/{pack-CyjyMUN0.d.mts → pack-mrYskO6T.d.mts} +3 -3
- package/dist/{pack-CyjyMUN0.d.mts.map → pack-mrYskO6T.d.mts.map} +1 -1
- package/dist/plan-BOyVvttx.d.mts +2 -0
- package/dist/{plan-Cbed2eDu-BZM3geSm.d.mts → plan-Cbed2eDu-3c5s1Aq5.d.mts} +3 -3
- package/dist/{plan-Cbed2eDu-BZM3geSm.d.mts.map → plan-Cbed2eDu-3c5s1Aq5.d.mts.map} +1 -1
- package/dist/{psl-build-ClY62mZM.d.mts → psl-build-CTj6JAX3.d.mts} +2 -2
- package/dist/{psl-build-ClY62mZM.d.mts.map → psl-build-CTj6JAX3.d.mts.map} +1 -1
- package/dist/{psl-build-pU0gKdVI.mjs → psl-build-DB-x01oH.mjs} +2 -2
- package/dist/{psl-build-pU0gKdVI.mjs.map → psl-build-DB-x01oH.mjs.map} +1 -1
- package/dist/{psl-column-resolution-BCkhNzOK-mW_8C9vr.d.mts → psl-column-resolution-BCkhNzOK-DOvdhSCj.d.mts} +2 -2
- package/dist/{psl-column-resolution-BCkhNzOK-mW_8C9vr.d.mts.map → psl-column-resolution-BCkhNzOK-DOvdhSCj.d.mts.map} +1 -1
- package/dist/{psl-field-resolution-BOJPyV5I-0zJJ0fOo.mjs → psl-field-resolution-BOJPyV5I-CQ7I2lbC.mjs} +3 -3
- package/dist/{psl-field-resolution-BOJPyV5I-0zJJ0fOo.mjs.map → psl-field-resolution-BOJPyV5I-CQ7I2lbC.mjs.map} +1 -1
- package/dist/{query-lane-context-BLOPW1rQ-Bn3ugl9a.d.mts → query-lane-context-BLOPW1rQ-4vNq0fxJ.d.mts} +6 -6
- package/dist/{query-lane-context-BLOPW1rQ-Bn3ugl9a.d.mts.map → query-lane-context-BLOPW1rQ-4vNq0fxJ.d.mts.map} +1 -1
- package/dist/query-lane-context-BPJrXopg.d.mts +1 -0
- package/dist/relational-core.d.mts +12 -12
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +3 -3
- package/dist/relational-core__codec-descriptor-registry.d.mts +3 -3
- package/dist/relational-core__collection-methods.d.mts +2 -2
- package/dist/relational-core__contract-free.d.mts +3 -3
- package/dist/relational-core__expression.d.mts +3 -3
- package/dist/relational-core__functions.d.mts +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__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DmP74bB8-GfOUaGGy.d.mts → schema-differ-DmP74bB8-Dn53wZD1.d.mts} +2 -2
- package/dist/{schema-differ-DmP74bB8-GfOUaGGy.d.mts.map → schema-differ-DmP74bB8-Dn53wZD1.d.mts.map} +1 -1
- package/dist/{schema-verify-BwRdzbHb-B9vFrm3T.mjs → schema-verify-BwRdzbHb-CxnJN-Lm.mjs} +2 -2
- package/dist/{schema-verify-BwRdzbHb-B9vFrm3T.mjs.map → schema-verify-BwRdzbHb-CxnJN-Lm.mjs.map} +1 -1
- package/dist/{sql-contract-serializer-sMY3prTx-BKQ4Yh-n.mjs → sql-contract-serializer-sMY3prTx-BDTNHOOy.mjs} +2 -2
- package/dist/{sql-contract-serializer-sMY3prTx-BKQ4Yh-n.mjs.map → sql-contract-serializer-sMY3prTx-BDTNHOOy.mjs.map} +1 -1
- package/dist/{sql-data-type-Dabuwxet-BljsNjBu.mjs → sql-data-type-DwLa_dK9-2eTvrYhA.mjs} +10 -15
- package/dist/sql-data-type-DwLa_dK9-2eTvrYhA.mjs.map +1 -0
- package/dist/{sql-execution-plan-Dam5yMZg-Bc_eneSz.d.mts → sql-execution-plan-Dam5yMZg-bDl_0qHQ.d.mts} +2 -2
- package/dist/{sql-execution-plan-Dam5yMZg-Bc_eneSz.d.mts.map → sql-execution-plan-Dam5yMZg-bDl_0qHQ.d.mts.map} +1 -1
- package/dist/{transaction-state-DR3nKTmH-n_12DsnU.d.mts → transaction-state-DR3nKTmH-DbyhuL-z.d.mts} +9 -9
- package/dist/{transaction-state-DR3nKTmH-n_12DsnU.d.mts.map → transaction-state-DR3nKTmH-DbyhuL-z.d.mts.map} +1 -1
- package/dist/types-B2Dee96w.d.mts +35 -0
- package/dist/types-B2Dee96w.d.mts.map +1 -0
- package/dist/{types-Cv5t6_Ly-CcBWTpfM.d.mts → types-Cv5t6_Ly-BaGc023t.d.mts} +7 -7
- package/dist/{types-Cv5t6_Ly-CcBWTpfM.d.mts.map → types-Cv5t6_Ly-BaGc023t.d.mts.map} +1 -1
- package/dist/{types-DVaVM20q-B-QcMIOa.d.mts → types-DVaVM20q-DrinF7w_.d.mts} +2 -2
- package/dist/{types-DVaVM20q-B-QcMIOa.d.mts.map → types-DVaVM20q-DrinF7w_.d.mts.map} +1 -1
- package/dist/{types-DaYtBAYT-DbsbDMTk.d.mts → types-DaYtBAYT-DFhWS-6u.d.mts} +4 -4
- package/dist/{types-DaYtBAYT-DbsbDMTk.d.mts.map → types-DaYtBAYT-DFhWS-6u.d.mts.map} +1 -1
- package/dist/types-VUCzaDbp.d.mts +1 -0
- package/dist/{validators-V8vN9R85.mjs → validators-Uim8vh59.mjs} +2 -2
- package/dist/{validators-V8vN9R85.mjs.map → validators-Uim8vh59.mjs.map} +1 -1
- package/package.json +18 -18
- package/dist/collection-methods-DQAFcGEB.d.mts +0 -1
- package/dist/control-adapter-CUwBiImd.d.mts +0 -1
- package/dist/dist-DAHIT4AS.mjs.map +0 -1
- package/dist/expression-CeerCjQG.d.mts +0 -2
- package/dist/index-reference-CWppFpUV.d.mts +0 -1
- package/dist/middleware-IqWk9Eff.d.mts +0 -1
- package/dist/plan-BZpZafiQ.d.mts +0 -2
- package/dist/query-lane-context-Dpep1Fzy.d.mts +0 -1
- package/dist/sql-data-type-Dabuwxet-BljsNjBu.mjs.map +0 -1
- package/dist/types-DMfBh16_.d.mts +0 -67
- package/dist/types-DMfBh16_.d.mts.map +0 -1
- package/dist/types-_7TbRpPw.d.mts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators-V8vN9R85.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { d as sqlStorageTypeId } from \"./sql-data-type-Dabuwxet.mjs\";\nimport { a as ColumnDefaultFunctionSchema, c as ForeignKeyReferenceSchema, d as IndexSchema, f as ReferentialActionSchema, i as CheckConstraintSchema, l as ForeignKeySchema, m as StorageValueSetSchema, o as ColumnDefaultLiteralSchema, p as StorageTableSchema, s as ColumnDefaultSchema, t as composeSqlEntityKinds, u as ForeignKeySourceSchema } from \"./entity-kinds-CQ_jwgYv.mjs\";\nimport { a as sameColumns$1, s as startsWithColumns } from \"./index-equivalence-DswCiq5l.mjs\";\nimport { computeCheckContentHash, computeIndexContentHash } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { DATA_TYPE_ID_PATTERN, createDataTypeLookup } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { type } from \"arktype\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { ContractExecutionSectionSchema, CrossReferenceSchema } from \"@internal/contract/types\";\nimport { validateContractDomain } from \"@internal/contract/validate-domain\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\n//#region src/default-sql-text.ts\nconst UNSAFE_DEFAULT_TEXT = /;|--|\\/\\*|\\$\\$|\\bSELECT\\b/i;\n/** Returns undefined when the text may be rendered as `DEFAULT (<text>)`, else the reason. */\nfunction checkSqlDefaultText(text) {\n\treturn UNSAFE_DEFAULT_TEXT.test(text) ? \"Default SQL must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.\" : void 0;\n}\n/**\n* Names the Prisma default function that raw SQL text is exactly, ignoring surrounding whitespace. The planners treat the contract expressions `now()` and `autoincrement()` as those functions, so raw SQL with that text would not be used as written.\n*/\nfunction reservedSqlDefaultText(text) {\n\tswitch (text.trim()) {\n\t\tcase \"now()\": return \"now\";\n\t\tcase \"autoincrement()\": return \"autoincrement\";\n\t\tdefault: return;\n\t}\n}\n//#endregion\n//#region src/relation-storage.ts\nfunction sameColumns(left, right) {\n\treturn left.length === right.length && left.every((column, index) => column === right[index]);\n}\n/**\n* The storage facts behind a same-space to-one relation's nullability: which side owns the\n* foreign key, and whether each local column is nullable.\n*/\nfunction resolveSqlToOneRelationStorage(contract, modelStorage, relation) {\n\tconst table = blindCast(contract.storage.namespaces[modelStorage.namespaceId]?.entries.table?.[modelStorage.table]);\n\tconst columns = relation.on.localFields.map((fieldName) => {\n\t\tconst columnName = modelStorage.fields[fieldName]?.column;\n\t\tconst column = columnName === void 0 ? void 0 : table?.columns[columnName];\n\t\treturn {\n\t\t\tname: columnName ?? fieldName,\n\t\t\tnullable: column?.nullable ?? true\n\t\t};\n\t});\n\tconst columnNames = columns.map((column) => column.name);\n\treturn {\n\t\townsForeignKey: relation.cardinality === \"N:1\" || (table?.foreignKeys ?? []).some((foreignKey) => sameColumns(foreignKey.source.columns, columnNames)),\n\t\tcolumns\n\t};\n}\n//#endregion\n//#region src/validators.ts\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst DomainEnumRefSchema = type({\n\tplane: \"'domain'\",\n\tnamespaceId: \"string\",\n\tentityKind: \"'enum'\",\n\tentityName: \"string\",\n\t\"spaceId?\": \"string\"\n});\n/** Document-scoped `storage.types`: codec triples only. */\nconst DocumentScopedStorageTypeSchema = type.declare().type({\n\tkind: \"'codec-instance'\",\n\tcodecId: \"string\",\n\tdataType: DATA_TYPE_ID_PATTERN,\n\t\"typeParams?\": \"Record<string, unknown>\"\n});\n/**\n* Domain enum entry under `domain.namespaces[id].enum[name]`.\n* Carries the codec id and an ordered `members` array of `{name, value}` pairs.\n*/\nconst ContractEnumSchema = type({\n\t\"+\": \"reject\",\n\tcodecId: \"string\",\n\tmembers: type({\n\t\tname: \"string\",\n\t\tvalue: \"string | number | boolean | null | unknown[] | Record<string, unknown>\"\n\t}).array().readonly()\n});\n/**\n* Derives a schema map from a descriptor map: maps each kind's key to its\n* `schema` field. Used by validation functions to validate entries.\n*/\nfunction schemaViewOf(kinds) {\n\treturn new Map([...kinds].map(([k, d]) => [k, d.schema]));\n}\nconst DEFAULT_SQL_KINDS = composeSqlEntityKinds();\n/**\n* Builds the per-namespace entry schema for `storage.namespaces[id]`.\n*\n* Validation is descriptor-driven: the `kinds` map carries both the schema\n* (used here for structural validation) and the construct function (used at\n* hydration time). An unregistered key fails validation naming the kind and\n* the namespace id, so validation fails closed.\n*/\nfunction createNamespaceEntrySchema(kinds) {\n\tconst schemas = schemaViewOf(kinds);\n\tconst knownKinds = new Set(kinds.keys());\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tid: \"string\",\n\t\t\"kind?\": \"string\",\n\t\tentries: \"object\"\n\t}).narrow((ns, ctx) => {\n\t\tif (!isPlainRecord(ns.entries)) return ctx.mustBe(\"an entries object\");\n\t\tfor (const [key, innerMap] of Object.entries(ns.entries)) {\n\t\t\tif (!knownKinds.has(key)) return ctx.reject({ expected: `entries key \"${key}\" in namespace \"${ns.id}\" is not a registered entity kind` });\n\t\t\tif (!isPlainRecord(innerMap)) return ctx.reject({ expected: `entries[\"${key}\"] in namespace \"${ns.id}\" must be an object` });\n\t\t\tconst entrySchema = blindCast(schemas.get(key));\n\t\t\tfor (const [, value] of Object.entries(innerMap)) {\n\t\t\t\tconst parsed = entrySchema(value);\n\t\t\t\tif (parsed instanceof type.errors) return ctx.reject({ expected: parsed.summary });\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n}\n/**\n* Builds the storage schema. Pack contributions reach the per-namespace\n* entry shape through {@link createNamespaceEntrySchema}; the\n* document-scoped `storage.types` field (codec triples only) and the\n* storage hash stay family-shared.\n*/\nfunction createSqlStorageSchema(kinds) {\n\tconst namespaceEntry = createNamespaceEntrySchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tstorageHash: \"string\",\n\t\t\"types?\": type({ \"[string]\": DocumentScopedStorageTypeSchema }),\n\t\t\"namespaces?\": type({ \"[string]\": namespaceEntry })\n\t});\n}\nconst StorageSchema = createSqlStorageSchema(DEFAULT_SQL_KINDS);\n/** The refusal of a value-object column when the stack declares no value-object storage type. */\nfunction valueObjectStorageTypeMissingMessage(columnPath) {\n\treturn `${columnPath}: a value-object column needs the stack's value-object storage type, and the stack declares none`;\n}\nconst LISTED_REMOVED_KEYS = 5;\nfunction fieldOf(value, key) {\n\treturn isPlainRecord(value) ? value[key] : void 0;\n}\nfunction entriesOf(value) {\n\treturn isPlainRecord(value) ? Object.entries(value) : [];\n}\nfunction storedColumnEntries(storage) {\n\treturn entriesOf(fieldOf(storage, \"namespaces\")).flatMap(([namespaceId, namespace]) => entriesOf(fieldOf(fieldOf(namespace, \"entries\"), \"table\")).flatMap(([tableName, table]) => entriesOf(fieldOf(table, \"columns\")).map(([columnName, column]) => ({\n\t\tpath: `storage.namespaces.${namespaceId}.entries.table.${tableName}.columns.${columnName}`,\n\t\tentry: column\n\t}))));\n}\nfunction pathsHolding(entries, key) {\n\treturn entries.filter(({ entry }) => isPlainRecord(entry) && Object.hasOwn(entry, key)).map(({ path }) => path);\n}\nfunction listedProblems(paths, describe) {\n\tconst listed = paths.slice(0, LISTED_REMOVED_KEYS).map(describe);\n\tconst unlisted = paths.length - listed.length;\n\treturn unlisted > 0 ? [...listed, `and ${unlisted} more ${unlisted === 1 ? \"path\" : \"paths\"} (${paths.length} in all)`] : listed;\n}\n/**\n* Contracts emitted before a column named its data type stored the database type name in `nativeType` on columns and `storage.types` entries. The first five such keys are reported with their paths and the rest are counted, so an old contract is refused with a short message that says what changed.\n*/\nfunction storedTypeNameProblems(storage) {\n\tconst types = entriesOf(fieldOf(storage, \"types\")).map(([typeName, entry]) => ({\n\t\tpath: `storage.types.${typeName}`,\n\t\tentry\n\t}));\n\treturn listedProblems(pathsHolding([...storedColumnEntries(storage), ...types], \"nativeType\"), (path) => `${path}.nativeType: contracts no longer store a column's database type name; the column names its data type in \"dataType\"`);\n}\n/**\n* Contracts emitted before generated checks became mandatory stored the checks a column waived in `noCheck`. One sentence says what to do, followed by the first five such columns and a count of the rest.\n*/\nfunction checkWaiverProblems(storage) {\n\tconst paths = pathsHolding(storedColumnEntries(storage), \"noCheck\");\n\tif (paths.length === 0) return [];\n\tconst listed = paths.slice(0, LISTED_REMOVED_KEYS).map((path) => `${path}.noCheck`);\n\tconst unlisted = paths.length - listed.length;\n\tconst more = unlisted > 0 ? `, and ${unlisted} more (${paths.length} in all)` : \"\";\n\treturn [`contracts no longer store check waivers in \"noCheck\", so re-emit the contract from its source, or rewrite a stored contract such as a migration snapshot with remove-nocheck.ts, which ships in the remove-nocheck scripts of the Prisma 8 upgrade guide. Columns: ${listed.join(\", \")}${more}`];\n}\n/** The removed keys of the oldest format the contract is in: a contract that still stores `nativeType` is refused for that first, since its `noCheck` keys are rewritten at a later step of the upgrade. */\nfunction removedKeyProblems(storage) {\n\tconst storedTypeNames = storedTypeNameProblems(storage);\n\treturn storedTypeNames.length > 0 ? storedTypeNames : checkWaiverProblems(storage);\n}\n/**\n* Any entries entity that declares both a `tableName` and a physical `name`\n* (e.g. a target's RLS policy entities) shares one physical-name space per\n* table: two such entries of one kind on the same table would collide as\n* DDL (`CREATE POLICY \"<name>\" ON <table>` fails on the second), while the\n* same name on different tables is legal. Structural — no entry-kind\n* vocabulary; `table` entries are keyed by name already and are excluded.\n*/\nfunction validateTableScopedEntryNames(storage, errors) {\n\tfor (const [namespaceId, ns] of Object.entries(storage.namespaces)) {\n\t\tif (!isPlainRecord(ns.entries)) continue;\n\t\tfor (const [entriesKind, slot] of Object.entries(ns.entries)) {\n\t\t\tif (entriesKind === \"table\" || !isPlainRecord(slot)) continue;\n\t\t\tconst seen = /* @__PURE__ */ new Map();\n\t\t\tfor (const entity of Object.values(slot)) {\n\t\t\t\tif (typeof entity !== \"object\" || entity === null) continue;\n\t\t\t\tconst record = blindCast(entity);\n\t\t\t\tconst name = record[\"name\"];\n\t\t\t\tconst tableName = record[\"tableName\"];\n\t\t\t\tif (typeof name !== \"string\" || typeof tableName !== \"string\") continue;\n\t\t\t\tconst key = JSON.stringify([tableName, name]);\n\t\t\t\tseen.set(key, (seen.get(key) ?? 0) + 1);\n\t\t\t\tif (seen.get(key) === 2) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": ${entriesKind} \"${name}\" is declared multiple times`);\n\t\t\t}\n\t\t}\n\t}\n}\nfunction eachStorageTable(storage) {\n\treturn Object.entries(storage.namespaces).flatMap(([namespaceId, ns]) => Object.entries(ns.entries[\"table\"] ?? {}).map(([tableName, table]) => ({\n\t\tnamespaceId,\n\t\ttableName,\n\t\ttable\n\t})));\n}\nfunction findDuplicateValue(values) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const value of values) {\n\t\tif (seen.has(value)) return value;\n\t\tseen.add(value);\n\t}\n}\n/** A column may appear at most once in one index's element tuple. */\nfunction rejectRepeatedIndexColumns(indexes, coordinate, errors) {\n\tfor (const index of indexes) {\n\t\tconst duplicateColumn = findDuplicateValue(index.columns ?? []);\n\t\tif (duplicateColumn !== void 0) errors.push(`${coordinate}: index contains duplicate column \"${duplicateColumn}\"`);\n\t}\n}\n/**\n* Two wire-named indexes with the same content are one index written twice —\n* the content hash is their identity, so neither spelling can survive. An\n* exact-named index is identified by its name instead, so content twins under\n* two names are legal and a repeated name is rejected by the named-object\n* check.\n*/\nfunction rejectDuplicateWireNamedIndexContent(indexes, coordinate, errors) {\n\tconst seenContent = /* @__PURE__ */ new Set();\n\tfor (const index of indexes) {\n\t\tif (index.prefix === void 0) continue;\n\t\tconst content = computeIndexContentHash(index);\n\t\tif (seenContent.has(content)) {\n\t\t\terrors.push(`${coordinate}: duplicate index definition on columns [${(index.columns ?? []).join(\", \")}]`);\n\t\t\tcontinue;\n\t\t}\n\t\tseenContent.add(content);\n\t}\n}\n/**\n* Two wire-named checks with the same predicate are one check written twice —\n* the content hash is their identity, so neither spelling can survive, and\n* whitespace variants of one predicate collapse onto the same hash. An\n* exact-named check is identified by its name instead, so content twins under\n* two names are legal (the legacy shape a database adopts from) and a repeated\n* name is rejected by the named-object check.\n*/\nfunction rejectDuplicateWireNamedCheckContent(checks, coordinate, errors) {\n\tconst seenContent = /* @__PURE__ */ new Set();\n\tfor (const check of checks) {\n\t\tif (check.prefix === void 0) continue;\n\t\tconst content = computeCheckContentHash(check.expression);\n\t\tif (seenContent.has(content)) {\n\t\t\terrors.push(`${coordinate}: duplicate check constraint definition (expression \"${check.expression}\")`);\n\t\t\tcontinue;\n\t\t}\n\t\tseenContent.add(content);\n\t}\n}\nfunction isContractFieldType(value) {\n\tif (!isPlainRecord(value)) return false;\n\tconst kind = value[\"kind\"];\n\tif (kind === \"scalar\") {\n\t\tif (typeof value[\"codecId\"] !== \"string\") return false;\n\t\tconst typeParams = value[\"typeParams\"];\n\t\tif (typeParams !== void 0 && !isPlainRecord(typeParams)) return false;\n\t\treturn true;\n\t}\n\tif (kind === \"valueObject\") return typeof value[\"name\"] === \"string\";\n\tif (kind === \"union\") {\n\t\tconst members = value[\"members\"];\n\t\tif (!Array.isArray(members)) return false;\n\t\treturn members.every((m) => isContractFieldType(m));\n\t}\n\treturn false;\n}\nconst ModelFieldSchema = type({\n\t\"+\": \"reject\",\n\tnullable: \"boolean\",\n\ttype: type(\"unknown\").narrow((value, ctx) => isContractFieldType(value) ? true : ctx.mustBe(\"scalar, valueObject, or union field type\")),\n\tmany: type(\"false\").or({\n\t\t\"+\": \"reject\",\n\t\telementNullable: \"boolean\"\n\t}).default(false),\n\t\"dict?\": \"true\",\n\t\"valueSet?\": DomainEnumRefSchema\n});\nconst ModelStorageSchema = type({\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tfields: type({ \"[string]\": type({\n\t\tcolumn: \"string\",\n\t\t\"codecId?\": \"string\",\n\t\t\"nullable?\": \"boolean\"\n\t}) })\n});\nconst ContractRelationThroughSchema = type({\n\t\"+\": \"reject\",\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tparentColumns: type.string.array().readonly(),\n\tchildColumns: type.string.array().readonly(),\n\ttargetColumns: type.string.array().readonly()\n});\nconst ContractRelationOnSchema = type({\n\t\"+\": \"reject\",\n\tlocalFields: type.string.array().readonly(),\n\ttargetFields: type.string.array().readonly()\n});\nconst ContractManyToManyRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'N:M'\",\n\ton: ContractRelationOnSchema,\n\tthrough: ContractRelationThroughSchema\n});\nconst ContractToOneRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | 'N:1'\",\n\t\"nullable?\": \"boolean\",\n\ton: ContractRelationOnSchema\n});\nconst ContractToManyRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:N'\",\n\ton: ContractRelationOnSchema\n});\nconst ContractReferenceRelationSchema = ContractManyToManyRelationSchema.or(ContractToOneRelationSchema).or(ContractToManyRelationSchema);\nconst ContractEmbedRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | '1:N'\"\n});\nconst ContractRelationSchema = ContractReferenceRelationSchema.or(ContractEmbedRelationSchema);\nconst ModelSchema = type({\n\tstorage: ModelStorageSchema,\n\t\"fields?\": type({ \"[string]\": ModelFieldSchema }),\n\t\"relations?\": type({ \"[string]\": ContractRelationSchema }),\n\t\"discriminator?\": type({ field: \"string\" }),\n\t\"variants?\": type({ \"[string]\": CrossReferenceSchema }),\n\t\"base?\": CrossReferenceSchema,\n\t\"owner?\": \"string\"\n});\nconst ContractMetaSchema = type({ \"[string]\": \"unknown\" });\n/**\n* Builds the full SQL contract schema. The storage subtree threads\n* pack contributions through {@link createSqlStorageSchema}; the rest\n* of the contract envelope is family-shared.\n*/\nfunction createSqlContractSchema(kinds) {\n\tconst storage = createSqlStorageSchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\ttarget: \"string\",\n\t\ttargetFamily: \"'sql'\",\n\t\t\"coreHash?\": \"string\",\n\t\tprofileHash: \"string\",\n\t\t\"capabilities?\": \"Record<string, Record<string, boolean>>\",\n\t\t\"extensions?\": \"Record<string, unknown>\",\n\t\t\"meta?\": ContractMetaSchema,\n\t\t\"defaultControlPolicy?\": ControlPolicySchema,\n\t\t\"roots?\": type({ \"[string]\": CrossReferenceSchema }),\n\t\tdomain: type({ namespaces: type({ \"[string]\": type({\n\t\t\tmodels: type({ \"[string]\": ModelSchema }),\n\t\t\t\"valueObjects?\": type({ \"[string]\": type({ fields: type({ \"[string]\": ModelFieldSchema }) }) }),\n\t\t\t\"enum?\": type({ \"[string]\": ContractEnumSchema })\n\t\t}) }) }),\n\t\tstorage,\n\t\t\"execution?\": ContractExecutionSectionSchema\n\t});\n}\nconst SqlContractSchema = createSqlContractSchema(DEFAULT_SQL_KINDS);\n/**\n* Validates the structural shape of SqlStorage using Arktype. Pure\n* structural check: namespace IR is never materialized here (that needs\n* a target concretion via the serializer hydration path), so this throws\n* on invalid input and constructs nothing.\n*\n* @param value - The storage value to validate\n* @throws Error if the storage structure is invalid\n*/\nfunction validateStorage(value) {\n\tconst removedKeys = removedKeyProblems(value);\n\tconst result = StorageSchema(value);\n\tconst errors = removedKeys.length > 0 ? [...removedKeys] : result instanceof type.errors ? result.map((p) => p.message) : [];\n\tif (errors.length > 0) throw contractError(\"CONTRACT.VALIDATION_FAILED\", `Storage validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n}\nfunction validateModel(value) {\n\tconst result = ModelSchema(value);\n\tif (result instanceof type.errors) {\n\t\tconst errors = result.map((p) => p.message);\n\t\tthrow contractError(\"CONTRACT.VALIDATION_FAILED\", `Model validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n\t}\n\treturn result;\n}\n/**\n* Structural arktype validation of an SQL contract envelope. Internal\n* helper for {@link validateSqlContractFully} — exposed only inside\n* this module, since the family seam-of-record is the\n* `SqlContractSerializerBase.deserializeContract` SPI.\n*/\nfunction validateSqlContractStructure(value, contractSchema) {\n\tif (typeof value !== \"object\" || value === null) throw new ContractValidationError(\"Contract structural validation failed: value must be an object\", \"structural\");\n\tconst targetFamily = \"targetFamily\" in value ? value.targetFamily : void 0;\n\tif (targetFamily !== void 0 && targetFamily !== \"sql\") throw new ContractValidationError(`Unsupported target family: ${targetFamily}`, \"structural\");\n\tconst removedKeys = removedKeyProblems(fieldOf(value, \"storage\"));\n\tif (removedKeys.length > 0) throw new ContractValidationError(`Contract structural validation failed: ${removedKeys.join(\"; \")}`, \"structural\");\n\tconst contractResult = contractSchema(value);\n\tif (contractResult instanceof type.errors) throw new ContractValidationError(`Contract structural validation failed: ${contractResult.map((p) => p.message).join(\"; \")}`, \"structural\");\n\treturn blindCast(contractResult);\n}\nfunction foreignKeyBackingError(table, fk) {\n\tconst { index } = fk;\n\tif (index === void 0) return void 0;\n\tconst columns = fk.source.columns;\n\tif (\"name\" in index) {\n\t\tconst named = table.indexes.find((candidate) => candidate.name === index.name);\n\t\tif (named === void 0) return `is indexed by \"${index.name}\", but the table has no index with that name`;\n\t\treturn named.columns !== void 0 && startsWithColumns(named.columns, columns) ? void 0 : `is indexed by \"${index.name}\", but that index does not start with those columns`;\n\t}\n\tif (\"primaryKey\" in index) return table.primaryKey !== void 0 && startsWithColumns(table.primaryKey.columns, columns) ? void 0 : \"is indexed by the primary key, but the table's primary key does not start with those columns\";\n\tconst described = `the unique constraint on [${index.unique.join(\", \")}]`;\n\tif (!table.uniques.some((unique) => sameColumns$1(unique.columns, index.unique))) return `is indexed by ${described}, but the table has no unique constraint on those columns`;\n\treturn startsWithColumns(index.unique, columns) ? void 0 : `is indexed by ${described}, which does not start with those columns`;\n}\n/**\n* Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.\n*\n* Returns an array of human-readable error strings. Empty array = valid.\n*\n* Currently checks:\n* - duplicate named primary key / unique / index / foreign key objects within a table\n* - duplicate unique, index, or foreign key declarations within a table\n* - duplicate columns within primary key / unique / index definitions\n* - nullable columns in primary key definitions\n* - `setNull` referential action on a non-nullable FK column (would fail at runtime)\n* - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)\n* - a foreign key whose `index` is an index, primary key or unique constraint its table does not have\n*/\nfunction validateStorageSemantics(storage) {\n\tconst errors = [];\n\tvalidateTableScopedEntryNames(storage, errors);\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(storage)) {\n\t\tconst table = blindCast(rawTable);\n\t\tconst namedObjects = /* @__PURE__ */ new Map();\n\t\tconst registerNamedObject = (kind, name) => {\n\t\t\tif (!name) return;\n\t\t\tnamedObjects.set(name, [...namedObjects.get(name) ?? [], kind]);\n\t\t};\n\t\tregisterNamedObject(\"primary key\", table.primaryKey?.name);\n\t\tfor (const unique of table.uniques) registerNamedObject(\"unique constraint\", unique.name);\n\t\tfor (const index of table.indexes) registerNamedObject(\"index\", index.name);\n\t\tfor (const fk of table.foreignKeys) registerNamedObject(\"foreign key\", fk.name);\n\t\tfor (const check of table.checks ?? []) registerNamedObject(\"check constraint\", check.name);\n\t\tfor (const [name, kinds] of namedObjects) if (kinds.length > 1) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": named object \"${name}\" is declared multiple times (${kinds.join(\", \")})`);\n\t\tif (table.primaryKey) {\n\t\t\tconst duplicateColumn = findDuplicateValue(table.primaryKey.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tfor (const columnName of table.primaryKey.columns) if (table.columns[columnName]?.nullable === true) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key column \"${columnName}\" is nullable; primary key columns must be NOT NULL`);\n\t\t}\n\t\tconst seenUniqueDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const unique of table.uniques) {\n\t\t\tconst duplicateColumn = findDuplicateValue(unique.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": unique constraint contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tconst signature = JSON.stringify({ columns: unique.columns });\n\t\t\tif (seenUniqueDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate unique constraint definition on columns [${unique.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenUniqueDefinitions.add(signature);\n\t\t}\n\t\tconst tableCoordinate = `Namespace \"${namespaceId}\" table \"${tableName}\"`;\n\t\trejectRepeatedIndexColumns(table.indexes, tableCoordinate, errors);\n\t\trejectDuplicateWireNamedIndexContent(table.indexes, tableCoordinate, errors);\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst error = foreignKeyBackingError(table, fk);\n\t\t\tif (error !== void 0) errors.push(`${tableCoordinate}: foreign key on columns [${fk.source.columns.join(\", \")}] ${error}`);\n\t\t}\n\t\tconst seenForeignKeyDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst signature = JSON.stringify({\n\t\t\t\tsource: fk.source,\n\t\t\t\ttarget: fk.target,\n\t\t\t\tonDelete: fk.onDelete ?? null,\n\t\t\t\tonUpdate: fk.onUpdate ?? null\n\t\t\t});\n\t\t\tif (seenForeignKeyDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate foreign key definition on columns [${fk.source.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenForeignKeyDefinitions.add(signature);\n\t\t}\n\t\tfor (const fk of table.foreignKeys) for (const colName of fk.source.columns) {\n\t\t\tconst column = table.columns[colName];\n\t\t\tif (!column) continue;\n\t\t\tif (fk.onDelete === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onUpdate === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onDelete === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t\tif (fk.onUpdate === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t}\n\t\trejectDuplicateWireNamedCheckContent(table.checks ?? [], tableCoordinate, errors);\n\t}\n\treturn errors;\n}\n/**\n* SQL storage logical-consistency checks: every model.storage.table resolves to a real table, every domain field has a model.storage.fields entry, and every model.storage.fields[*].column resolves to a real column. Throws `ContractValidationError` on the first mismatch.\n*/\nfunction validateModelStorageReferences(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) {\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\tconst storageNamespaceId = modelStorage.namespaceId;\n\t\tif (storageNamespaceId !== namespaceId) throw new ContractValidationError(`Model \"${qualifiedName}\" storage.namespaceId \"${storageNamespaceId}\" does not match domain namespace \"${namespaceId}\"`, \"storage\");\n\t\tconst storageTable = modelStorage.table;\n\t\tconst rawTable = contract.storage.namespaces[storageNamespaceId]?.entries.table?.[storageTable];\n\t\tif (rawTable === void 0) throw new ContractValidationError(`Model \"${qualifiedName}\" references non-existent table \"${storageNamespaceId}.${storageTable}\"`, \"storage\");\n\t\tconst table = blindCast(rawTable);\n\t\tfor (const fieldName of Object.keys(model.fields)) if (!Object.hasOwn(modelStorage.fields, fieldName)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" has no entry in storage.fields, so no column holds it`, \"storage\");\n\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\tfor (const [fieldName, field] of Object.entries(modelStorage.fields)) if (!columnNames.has(field.column)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" references non-existent column \"${field.column}\" in table \"${storageTable}\"`, \"storage\");\n\t}\n}\n/** The names of a model's own fields and of the fields it inherits from its base models. */\nfunction fieldNamesWithInherited(contract, namespaceId, modelName) {\n\tconst names = /* @__PURE__ */ new Set();\n\tconst seen = /* @__PURE__ */ new Set();\n\tlet coordinate = {\n\t\tnamespace: namespaceId,\n\t\tmodel: modelName\n\t};\n\twhile (coordinate !== void 0) {\n\t\tconst key = JSON.stringify([coordinate.namespace, coordinate.model]);\n\t\tif (seen.has(key)) break;\n\t\tseen.add(key);\n\t\tconst model = contract.domain.namespaces[coordinate.namespace]?.models[coordinate.model];\n\t\tif (model === void 0) break;\n\t\tfor (const name of Object.keys(model.fields)) names.add(name);\n\t\tcoordinate = model.base;\n\t}\n\treturn names;\n}\n/**\n* Every relation joins on fields: its local fields are fields of the model that declares it, and its target fields are fields of the target model. The target side of a many-to-many relation names columns of its junction table instead. A cross-space relation's target is in another contract, so its target side is not checked. Throws `ContractValidationError` on the first name that is not a field.\n*/\nfunction validateRelationJoinFields(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations)) {\n\t\tif (!(\"on\" in relation)) continue;\n\t\tconst location = `Relation \"${relationName}\" on model \"${namespaceId}:${modelName}\"`;\n\t\tconst localFields = fieldNamesWithInherited(contract, namespaceId, modelName);\n\t\tfor (const field of relation.on.localFields) if (!localFields.has(field)) throw new ContractValidationError(`${location} joins on \"${field}\", which is not a field of model \"${namespaceId}:${modelName}\"`, \"domain\");\n\t\tif (relation.cardinality === \"N:M\") {\n\t\t\tconst { namespaceId: junctionNamespaceId, table: junctionTable } = relation.through;\n\t\t\tfor (const column of relation.on.targetFields) if (!lookupStorageColumn(contract, junctionNamespaceId, junctionTable, column)) throw new ContractValidationError(`${location} joins on \"${column}\", which is not a column of junction table \"${junctionNamespaceId}.${junctionTable}\"`, \"domain\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (relation.to.space !== void 0) continue;\n\t\tconst targetFields = fieldNamesWithInherited(contract, relation.to.namespace, relation.to.model);\n\t\tfor (const field of relation.on.targetFields) if (!targetFields.has(field)) throw new ContractValidationError(`${location} joins on \"${field}\", which is not a field of model \"${relation.to.namespace}:${relation.to.model}\"`, \"domain\");\n\t}\n}\n/**\n* Every execution default targets a column some model's field maps: an execution default is declared on a field, and it belongs to that field. Throws `ContractValidationError` on the first default on a column no field maps.\n*/\nfunction validateExecutionDefaultsTargetMappedColumns(contract) {\n\tconst mappedColumns = /* @__PURE__ */ new Set();\n\tfor (const namespace of Object.values(contract.domain.namespaces)) for (const model of Object.values(namespace.models)) {\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tfor (const field of Object.values(modelStorage.fields)) mappedColumns.add(JSON.stringify([\n\t\t\tmodelStorage.namespaceId,\n\t\t\tmodelStorage.table,\n\t\t\tfield.column\n\t\t]));\n\t}\n\tfor (const { ref } of contract.execution?.mutations.defaults ?? []) if (!mappedColumns.has(JSON.stringify([\n\t\tref.namespace,\n\t\tref.entry,\n\t\tref.field\n\t]))) throw new ContractValidationError(`Execution default for column \"${ref.field}\" of table \"${ref.namespace}.${ref.entry}\" targets a column no field maps; execution defaults are declared on fields. Give the column a database default instead.`, \"storage\");\n}\n/**\n* Cross-table consistency checks for SQL storage: primary key, unique,\n* index, and foreign key column references resolve to real columns;\n* NOT NULL columns don't carry a literal `null` default; FK column\n* counts match their referenced columns. Throws on the first mismatch.\n*/\nfunction validateSqlStorageConsistency(contract) {\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(contract.storage)) {\n\t\tconst table = blindCast(rawTable);\n\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\tif (table.primaryKey) {\n\t\t\tfor (const colName of table.primaryKey.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" primaryKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t}\n\t\tfor (const unique of table.uniques) for (const colName of unique.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" unique constraint references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const index of table.indexes) for (const colName of index.columns ?? []) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" index references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const [colName, column] of Object.entries(table.columns)) if (!column.nullable && column.default?.kind === \"literal\" && column.default.value === null) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" column \"${colName}\" is NOT NULL but has a literal null default`, \"storage\");\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tif (fk.source.namespaceId !== namespaceId || fk.source.tableName !== tableName) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" contains foreignKey with mismatched source coordinates (${fk.source.namespaceId}.${fk.source.tableName})`, \"storage\");\n\t\t\tfor (const colName of fk.source.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t\tif (fk.target.spaceId === void 0) {\n\t\t\t\tconst referencedRaw = contract.storage.namespaces[fk.target.namespaceId]?.entries.table?.[fk.target.tableName];\n\t\t\t\tif (referencedRaw === void 0) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent table \"${fk.target.namespaceId}.${fk.target.tableName}\"`, \"storage\");\n\t\t\t\tconst referencedTable = blindCast(referencedRaw);\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 new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\" in table \"${fk.target.tableName}\"`, \"storage\");\n\t\t\t}\n\t\t\tif (fk.source.columns.length !== fk.target.columns.length) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey column count (${fk.source.columns.length}) does not match referenced column count (${fk.target.columns.length})`, \"storage\");\n\t\t}\n\t}\n}\n/**\n* Full SQL contract validation: structural (arktype) +\n* framework-shared domain + SQL storage logical-consistency + SQL\n* storage semantic + model ↔ storage reference checks. Throws\n* `ContractValidationError` on the first failure. Returns the\n* validated flat-data shape; IR class hydration happens in the SPI\n* base on top of this helper.\n*/\nfunction validateSqlContractFully(value, options) {\n\tconst validated = validateSqlContractStructure(typeof value === \"object\" && value !== null ? (() => {\n\t\tconst { schemaVersion: _, _generated: _g, ...rest } = blindCast(value);\n\t\treturn rest;\n\t})() : value, options?.contractSchema ?? SqlContractSchema);\n\tvalidateContractDomain({\n\t\troots: validated.roots,\n\t\tdomain: validated.domain\n\t});\n\tvalidateSqlStorageConsistency(validated);\n\tconst semanticErrors = validateStorageSemantics(validated.storage);\n\tif (semanticErrors.length > 0) throw new ContractValidationError(`Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, \"storage\");\n\tvalidateModelStorageReferences(validated);\n\tvalidateExecutionDefaultsTargetMappedColumns(validated);\n\tvalidateRelationJoinFields(validated);\n\tvalidateRelationThroughConsistency(validated, options?.dataTypes ?? createDataTypeLookup([]));\n\tvalidateToOneRelationNullabilityAgainstStorage(validated);\n\treturn validated;\n}\n/**\n* A same-space to-one relation that states `nullable` must agree with its local FK columns:\n* nullable exactly when one of them is nullable (a column that cannot be resolved counts as\n* nullable). A relation without the flag is left to hydration, which derives it the same way.\n*/\nfunction validateToOneRelationNullabilityAgainstStorage(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) {\n\t\tconst storage = blindCast(model.storage);\n\t\tfor (const [relationName, relation] of Object.entries(model.relations)) {\n\t\t\tif (!(\"on\" in relation && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.to.space === void 0) || relation.nullable === void 0) continue;\n\t\t\tconst location = `Relation \"${relationName}\" on model \"${namespaceId}:${modelName}\"`;\n\t\t\tconst { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, storage, relation);\n\t\t\tif (!ownsForeignKey) {\n\t\t\t\tif (relation.nullable) continue;\n\t\t\t\tthrow new ContractValidationError(`${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, \"storage\");\n\t\t\t}\n\t\t\tconst anyNullable = columns.some((column) => column.nullable);\n\t\t\tif (relation.nullable === anyNullable) continue;\n\t\t\tconst columnList = columns.filter((column) => column.nullable !== relation.nullable).map((column) => `\"${column.name}\"`).join(\", \");\n\t\t\tthrow new ContractValidationError(relation.nullable ? `${location} is nullable but every local FK column is NOT NULL (columns ${columnList})` : `${location} is required but a local FK column is nullable (columns ${columnList})`, \"storage\");\n\t\t}\n\t}\n}\n/** Storage column lookup for through-consistency validation. */\nfunction lookupStorageColumn(contract, namespaceId, tableName, columnName) {\n\tconst rawTable = contract.storage.namespaces[namespaceId]?.entries.table?.[tableName];\n\tif (rawTable === void 0) return;\n\treturn blindCast(rawTable).columns[columnName];\n}\n/**\n* Two storage columns share a type when the types their `dataType`s are stored as and their `typeParams` match. `codecId` and\n* `nullable` are not compared: they do not change the database type that governs a join.\n*/\nfunction sameStorageType(a, b, dataTypes) {\n\treturn sqlStorageTypeId(a.dataType, dataTypes) === sqlStorageTypeId(b.dataType, dataTypes) && canonicalizeJson(a.typeParams ?? {}) === canonicalizeJson(b.typeParams ?? {});\n}\nfunction describeColumnType(column) {\n\treturn column.typeParams === void 0 ? column.dataType : `${column.dataType} ${canonicalizeJson(column.typeParams)}`;\n}\n/**\n* Validates one side of an N:M join: the junction columns and the model\n* columns they pair against positionally must be equal in number, exist in\n* their tables, and share the same storage type (`dataType` + `typeParams`).\n* The junction's storage foreign keys already guarantee this for user-declared\n* FK constraints, but `through` is a logical descriptor never tied to them by\n* the rest of validation — and the TS builder accepts explicit join columns\n* without requiring a junction FK at all — so this checks the columns directly\n* against storage, one path regardless of how the junction was authored.\n*\n* Joined columns must be the *same* storage type, not merely compatible:\n* relying on implicit conversion (e.g. `text`↔`character`) is unsafe on writes\n* — `character(n)` space-padding makes such coercions non-associative — and no\n* ADR sanctions heterogeneous junction columns. Equality is the conservative\n* default; it can be relaxed deliberately if a real use case ever appears.\n*/\nfunction validateThroughJoinSide(input) {\n\tconst fail = (detail) => new ContractValidationError(`Many-to-many relation \"${input.qualifiedName}\" ${detail}`, \"storage\");\n\tif (input.junctionColumns.length !== input.modelColumns.length) throw fail(`pairs ${input.junctionColumnsLabel} (${input.junctionColumns.length}) with ${input.modelColumnsLabel} (${input.modelColumns.length}) of differing length; they join positionally and must match.`);\n\tfor (const [index, junctionColumnName] of input.junctionColumns.entries()) {\n\t\tconst modelColumnRef = input.modelColumns[index];\n\t\tif (modelColumnRef === void 0) continue;\n\t\tconst junctionColumn = lookupStorageColumn(input.contract, input.junctionNamespaceId, input.junctionTable, junctionColumnName);\n\t\tif (junctionColumn === void 0) throw fail(`${input.junctionColumnsLabel} references column \"${junctionColumnName}\" absent from junction table \"${input.junctionNamespaceId}.${input.junctionTable}\".`);\n\t\tconst model = input.model;\n\t\tif (model === void 0) continue;\n\t\tlet modelColumnName = modelColumnRef;\n\t\tif (model.fieldToColumn !== void 0) {\n\t\t\tconst mapped = model.fieldToColumn[modelColumnRef];\n\t\t\tif (mapped === void 0) throw fail(`${input.modelColumnsLabel} references field \"${modelColumnRef}\" absent from model on table \"${model.namespaceId}.${model.table}\".`);\n\t\t\tmodelColumnName = mapped.column;\n\t\t}\n\t\tconst modelColumn = lookupStorageColumn(input.contract, model.namespaceId, model.table, modelColumnName);\n\t\tif (modelColumn === void 0) throw fail(`${input.modelColumnsLabel} references column \"${modelColumnName}\" absent from table \"${model.namespaceId}.${model.table}\".`);\n\t\tif (!sameStorageType(junctionColumn, modelColumn, input.dataTypes)) throw fail(`joins \"${input.junctionTable}.${junctionColumnName}\" (${describeColumnType(junctionColumn)}) with \"${model.table}.${modelColumnName}\" (${describeColumnType(modelColumn)}) of differing storage type; junction columns must match the type of the column they reference.`);\n\t}\n}\n/**\n* Validates that every N:M relation's `through` descriptor is consistent with\n* the storage columns it joins: both join sides match in column count,\n* reference columns that exist in their tables, and pair columns of the same\n* storage type. Without this, a `through` that disagrees with storage surfaces\n* as a silently wrong JOIN at query time rather than a validation error here.\n*/\nfunction validateRelationThroughConsistency(contract, dataTypes) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations)) {\n\t\tif (relation.cardinality !== \"N:M\") continue;\n\t\tconst qualifiedName = `${namespaceId}.${modelName}.${relationName}`;\n\t\tconst { on, through } = relation;\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tvalidateThroughJoinSide({\n\t\t\tdataTypes,\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: on.localFields,\n\t\t\tmodelColumnsLabel: \"on.localFields\",\n\t\t\tmodel: {\n\t\t\t\tnamespaceId,\n\t\t\t\ttable: modelStorage.table,\n\t\t\t\tfieldToColumn: modelStorage.fields\n\t\t\t},\n\t\t\tjunctionColumns: through.parentColumns,\n\t\t\tjunctionColumnsLabel: \"through.parentColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t\tconst targetModel = relation.to.space === void 0 ? contract.domain.namespaces[relation.to.namespace]?.models[relation.to.model] : void 0;\n\t\tconst targetModelSide = targetModel === void 0 ? void 0 : {\n\t\t\tnamespaceId: relation.to.namespace,\n\t\t\ttable: blindCast(targetModel.storage).table\n\t\t};\n\t\tvalidateThroughJoinSide({\n\t\t\tdataTypes,\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: through.targetColumns,\n\t\t\tmodelColumnsLabel: \"through.targetColumns\",\n\t\t\t...ifDefined(\"model\", targetModelSide),\n\t\t\tjunctionColumns: through.childColumns,\n\t\t\tjunctionColumnsLabel: \"through.childColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t}\n}\n//#endregion\nexport { CheckConstraintSchema, ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ContractEnumSchema, ForeignKeyReferenceSchema, ForeignKeySchema, ForeignKeySourceSchema, IndexSchema, ReferentialActionSchema, StorageTableSchema, StorageValueSetSchema, checkSqlDefaultText, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, reservedSqlDefaultText, resolveSqlToOneRelationStorage, validateExecutionDefaultsTargetMappedColumns, validateModel, validateModelStorageReferences, validateRelationJoinFields, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics, valueObjectStorageTypeMissingMessage };\n\n//# sourceMappingURL=validators.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;;AAE5B,SAAS,oBAAoB,MAAM;CAClC,OAAO,oBAAoB,KAAK,IAAI,IAAI,gGAAgG,KAAK;AAC9I;;;;AAIA,SAAS,uBAAuB,MAAM;CACrC,QAAQ,KAAK,KAAK,GAAlB;EACC,KAAK,SAAS,OAAO;EACrB,KAAK,mBAAmB,OAAO;EAC/B,SAAS;CACV;AACD;AAGA,SAAS,YAAY,MAAM,OAAO;CACjC,OAAO,KAAK,WAAW,MAAM,UAAU,KAAK,OAAO,QAAQ,UAAU,WAAW,MAAM,MAAM;AAC7F;;;;;AAKA,SAAS,+BAA+B,UAAU,cAAc,UAAU;CACzE,MAAM,QAAQ,UAAU,SAAS,QAAQ,WAAW,aAAa,YAAY,EAAE,QAAQ,QAAQ,aAAa,MAAM;CAClH,MAAM,UAAU,SAAS,GAAG,YAAY,KAAK,cAAc;EAC1D,MAAM,aAAa,aAAa,OAAO,UAAU,EAAE;EACnD,MAAM,SAAS,eAAe,KAAK,IAAI,KAAK,IAAI,OAAO,QAAQ;EAC/D,OAAO;GACN,MAAM,cAAc;GACpB,UAAU,QAAQ,YAAY;EAC/B;CACD,CAAC;CACD,MAAM,cAAc,QAAQ,KAAK,WAAW,OAAO,IAAI;CACvD,OAAO;EACN,gBAAgB,SAAS,gBAAgB,UAAU,OAAO,eAAe,CAAC,EAAA,CAAG,MAAM,eAAe,YAAY,WAAW,OAAO,SAAS,WAAW,CAAC;EACrJ;CACD;AACD;AAGA,MAAM,sBAAsB,KAAK,mDAAmD;AACpF,MAAM,sBAAsB,KAAK;CAChC,OA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;GACA;GACA;GACA,cAAc,GAAG;GACjB,mBAAmB;GACnB,OAAO;IACN;IACA,OAAO,aAAa;IACpB,eAAe,aAAa;GAC7B;GACA,iBAAiB,QAAQ;GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;EACD,MAAM,cAAc,SAAS,GAAG,UAAU,KAAK,IAAI,SAAS,OAAO,WAAW,SAAS,GAAG,UAAU,EAAE,OAAO,SAAS,GAAG,SAAS,KAAK;EACvI,MAAM,kBAAkB,gBAAgB,KAAK,IAAI,KAAK,IAAI;GACzD,aAAa,SAAS,GAAG;GACzB,OAAO,UAAU,YAAY,OAAO,CAAC,CAAC;EACvC;EACA,wBAAwB;GACvB;GACA;GACA;GACA,cAAc,QAAQ;GACtB,mBAAmB;GACnB,GAAG,UAAU,SAAS,eAAe;GACrC,iBAAiB,QAAQ;GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"validators-Uim8vh59.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { d as sqlStorageTypeId } from \"./sql-data-type-DwLa_dK9.mjs\";\nimport { a as ColumnDefaultFunctionSchema, c as ForeignKeyReferenceSchema, d as IndexSchema, f as ReferentialActionSchema, i as CheckConstraintSchema, l as ForeignKeySchema, m as StorageValueSetSchema, o as ColumnDefaultLiteralSchema, p as StorageTableSchema, s as ColumnDefaultSchema, t as composeSqlEntityKinds, u as ForeignKeySourceSchema } from \"./entity-kinds-CQ_jwgYv.mjs\";\nimport { a as sameColumns$1, s as startsWithColumns } from \"./index-equivalence-DswCiq5l.mjs\";\nimport { computeCheckContentHash, computeIndexContentHash } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { DATA_TYPE_ID_PATTERN, createDataTypeLookup } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { type } from \"arktype\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { ContractExecutionSectionSchema, CrossReferenceSchema } from \"@internal/contract/types\";\nimport { validateContractDomain } from \"@internal/contract/validate-domain\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\n//#region src/default-sql-text.ts\nconst UNSAFE_DEFAULT_TEXT = /;|--|\\/\\*|\\$\\$|\\bSELECT\\b/i;\n/** Returns undefined when the text may be rendered as `DEFAULT (<text>)`, else the reason. */\nfunction checkSqlDefaultText(text) {\n\treturn UNSAFE_DEFAULT_TEXT.test(text) ? \"Default SQL must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.\" : void 0;\n}\n/**\n* Names the Prisma default function that raw SQL text is exactly, ignoring surrounding whitespace. The planners treat the contract expressions `now()` and `autoincrement()` as those functions, so raw SQL with that text would not be used as written.\n*/\nfunction reservedSqlDefaultText(text) {\n\tswitch (text.trim()) {\n\t\tcase \"now()\": return \"now\";\n\t\tcase \"autoincrement()\": return \"autoincrement\";\n\t\tdefault: return;\n\t}\n}\n//#endregion\n//#region src/relation-storage.ts\nfunction sameColumns(left, right) {\n\treturn left.length === right.length && left.every((column, index) => column === right[index]);\n}\n/**\n* The storage facts behind a same-space to-one relation's nullability: which side owns the\n* foreign key, and whether each local column is nullable.\n*/\nfunction resolveSqlToOneRelationStorage(contract, modelStorage, relation) {\n\tconst table = blindCast(contract.storage.namespaces[modelStorage.namespaceId]?.entries.table?.[modelStorage.table]);\n\tconst columns = relation.on.localFields.map((fieldName) => {\n\t\tconst columnName = modelStorage.fields[fieldName]?.column;\n\t\tconst column = columnName === void 0 ? void 0 : table?.columns[columnName];\n\t\treturn {\n\t\t\tname: columnName ?? fieldName,\n\t\t\tnullable: column?.nullable ?? true\n\t\t};\n\t});\n\tconst columnNames = columns.map((column) => column.name);\n\treturn {\n\t\townsForeignKey: relation.cardinality === \"N:1\" || (table?.foreignKeys ?? []).some((foreignKey) => sameColumns(foreignKey.source.columns, columnNames)),\n\t\tcolumns\n\t};\n}\n//#endregion\n//#region src/validators.ts\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst DomainEnumRefSchema = type({\n\tplane: \"'domain'\",\n\tnamespaceId: \"string\",\n\tentityKind: \"'enum'\",\n\tentityName: \"string\",\n\t\"spaceId?\": \"string\"\n});\n/** Document-scoped `storage.types`: codec triples only. */\nconst DocumentScopedStorageTypeSchema = type.declare().type({\n\tkind: \"'codec-instance'\",\n\tcodecId: \"string\",\n\tdataType: DATA_TYPE_ID_PATTERN,\n\t\"typeParams?\": \"Record<string, unknown>\"\n});\n/**\n* Domain enum entry under `domain.namespaces[id].enum[name]`.\n* Carries the codec id and an ordered `members` array of `{name, value}` pairs.\n*/\nconst ContractEnumSchema = type({\n\t\"+\": \"reject\",\n\tcodecId: \"string\",\n\tmembers: type({\n\t\tname: \"string\",\n\t\tvalue: \"string | number | boolean | null | unknown[] | Record<string, unknown>\"\n\t}).array().readonly()\n});\n/**\n* Derives a schema map from a descriptor map: maps each kind's key to its\n* `schema` field. Used by validation functions to validate entries.\n*/\nfunction schemaViewOf(kinds) {\n\treturn new Map([...kinds].map(([k, d]) => [k, d.schema]));\n}\nconst DEFAULT_SQL_KINDS = composeSqlEntityKinds();\n/**\n* Builds the per-namespace entry schema for `storage.namespaces[id]`.\n*\n* Validation is descriptor-driven: the `kinds` map carries both the schema\n* (used here for structural validation) and the construct function (used at\n* hydration time). An unregistered key fails validation naming the kind and\n* the namespace id, so validation fails closed.\n*/\nfunction createNamespaceEntrySchema(kinds) {\n\tconst schemas = schemaViewOf(kinds);\n\tconst knownKinds = new Set(kinds.keys());\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tid: \"string\",\n\t\t\"kind?\": \"string\",\n\t\tentries: \"object\"\n\t}).narrow((ns, ctx) => {\n\t\tif (!isPlainRecord(ns.entries)) return ctx.mustBe(\"an entries object\");\n\t\tfor (const [key, innerMap] of Object.entries(ns.entries)) {\n\t\t\tif (!knownKinds.has(key)) return ctx.reject({ expected: `entries key \"${key}\" in namespace \"${ns.id}\" is not a registered entity kind` });\n\t\t\tif (!isPlainRecord(innerMap)) return ctx.reject({ expected: `entries[\"${key}\"] in namespace \"${ns.id}\" must be an object` });\n\t\t\tconst entrySchema = blindCast(schemas.get(key));\n\t\t\tfor (const [, value] of Object.entries(innerMap)) {\n\t\t\t\tconst parsed = entrySchema(value);\n\t\t\t\tif (parsed instanceof type.errors) return ctx.reject({ expected: parsed.summary });\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n}\n/**\n* Builds the storage schema. Pack contributions reach the per-namespace\n* entry shape through {@link createNamespaceEntrySchema}; the\n* document-scoped `storage.types` field (codec triples only) and the\n* storage hash stay family-shared.\n*/\nfunction createSqlStorageSchema(kinds) {\n\tconst namespaceEntry = createNamespaceEntrySchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\tstorageHash: \"string\",\n\t\t\"types?\": type({ \"[string]\": DocumentScopedStorageTypeSchema }),\n\t\t\"namespaces?\": type({ \"[string]\": namespaceEntry })\n\t});\n}\nconst StorageSchema = createSqlStorageSchema(DEFAULT_SQL_KINDS);\n/** The refusal of a value-object column when the stack declares no value-object storage type. */\nfunction valueObjectStorageTypeMissingMessage(columnPath) {\n\treturn `${columnPath}: a value-object column needs the stack's value-object storage type, and the stack declares none`;\n}\nconst LISTED_REMOVED_KEYS = 5;\nfunction fieldOf(value, key) {\n\treturn isPlainRecord(value) ? value[key] : void 0;\n}\nfunction entriesOf(value) {\n\treturn isPlainRecord(value) ? Object.entries(value) : [];\n}\nfunction storedColumnEntries(storage) {\n\treturn entriesOf(fieldOf(storage, \"namespaces\")).flatMap(([namespaceId, namespace]) => entriesOf(fieldOf(fieldOf(namespace, \"entries\"), \"table\")).flatMap(([tableName, table]) => entriesOf(fieldOf(table, \"columns\")).map(([columnName, column]) => ({\n\t\tpath: `storage.namespaces.${namespaceId}.entries.table.${tableName}.columns.${columnName}`,\n\t\tentry: column\n\t}))));\n}\nfunction pathsHolding(entries, key) {\n\treturn entries.filter(({ entry }) => isPlainRecord(entry) && Object.hasOwn(entry, key)).map(({ path }) => path);\n}\nfunction listedProblems(paths, describe) {\n\tconst listed = paths.slice(0, LISTED_REMOVED_KEYS).map(describe);\n\tconst unlisted = paths.length - listed.length;\n\treturn unlisted > 0 ? [...listed, `and ${unlisted} more ${unlisted === 1 ? \"path\" : \"paths\"} (${paths.length} in all)`] : listed;\n}\n/**\n* Contracts emitted before a column named its data type stored the database type name in `nativeType` on columns and `storage.types` entries. The first five such keys are reported with their paths and the rest are counted, so an old contract is refused with a short message that says what changed.\n*/\nfunction storedTypeNameProblems(storage) {\n\tconst types = entriesOf(fieldOf(storage, \"types\")).map(([typeName, entry]) => ({\n\t\tpath: `storage.types.${typeName}`,\n\t\tentry\n\t}));\n\treturn listedProblems(pathsHolding([...storedColumnEntries(storage), ...types], \"nativeType\"), (path) => `${path}.nativeType: contracts no longer store a column's database type name; the column names its data type in \"dataType\"`);\n}\n/**\n* Contracts emitted before generated checks became mandatory stored the checks a column waived in `noCheck`. One sentence says what to do, followed by the first five such columns and a count of the rest.\n*/\nfunction checkWaiverProblems(storage) {\n\tconst paths = pathsHolding(storedColumnEntries(storage), \"noCheck\");\n\tif (paths.length === 0) return [];\n\tconst listed = paths.slice(0, LISTED_REMOVED_KEYS).map((path) => `${path}.noCheck`);\n\tconst unlisted = paths.length - listed.length;\n\tconst more = unlisted > 0 ? `, and ${unlisted} more (${paths.length} in all)` : \"\";\n\treturn [`contracts no longer store check waivers in \"noCheck\", so re-emit the contract from its source, or rewrite a stored contract such as a migration snapshot with remove-nocheck.ts, which ships in the remove-nocheck scripts of the Prisma 8 upgrade guide. Columns: ${listed.join(\", \")}${more}`];\n}\n/** The removed keys of the oldest format the contract is in: a contract that still stores `nativeType` is refused for that first, since its `noCheck` keys are rewritten at a later step of the upgrade. */\nfunction removedKeyProblems(storage) {\n\tconst storedTypeNames = storedTypeNameProblems(storage);\n\treturn storedTypeNames.length > 0 ? storedTypeNames : checkWaiverProblems(storage);\n}\n/**\n* Any entries entity that declares both a `tableName` and a physical `name`\n* (e.g. a target's RLS policy entities) shares one physical-name space per\n* table: two such entries of one kind on the same table would collide as\n* DDL (`CREATE POLICY \"<name>\" ON <table>` fails on the second), while the\n* same name on different tables is legal. Structural — no entry-kind\n* vocabulary; `table` entries are keyed by name already and are excluded.\n*/\nfunction validateTableScopedEntryNames(storage, errors) {\n\tfor (const [namespaceId, ns] of Object.entries(storage.namespaces)) {\n\t\tif (!isPlainRecord(ns.entries)) continue;\n\t\tfor (const [entriesKind, slot] of Object.entries(ns.entries)) {\n\t\t\tif (entriesKind === \"table\" || !isPlainRecord(slot)) continue;\n\t\t\tconst seen = /* @__PURE__ */ new Map();\n\t\t\tfor (const entity of Object.values(slot)) {\n\t\t\t\tif (typeof entity !== \"object\" || entity === null) continue;\n\t\t\t\tconst record = blindCast(entity);\n\t\t\t\tconst name = record[\"name\"];\n\t\t\t\tconst tableName = record[\"tableName\"];\n\t\t\t\tif (typeof name !== \"string\" || typeof tableName !== \"string\") continue;\n\t\t\t\tconst key = JSON.stringify([tableName, name]);\n\t\t\t\tseen.set(key, (seen.get(key) ?? 0) + 1);\n\t\t\t\tif (seen.get(key) === 2) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": ${entriesKind} \"${name}\" is declared multiple times`);\n\t\t\t}\n\t\t}\n\t}\n}\nfunction eachStorageTable(storage) {\n\treturn Object.entries(storage.namespaces).flatMap(([namespaceId, ns]) => Object.entries(ns.entries[\"table\"] ?? {}).map(([tableName, table]) => ({\n\t\tnamespaceId,\n\t\ttableName,\n\t\ttable\n\t})));\n}\nfunction findDuplicateValue(values) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const value of values) {\n\t\tif (seen.has(value)) return value;\n\t\tseen.add(value);\n\t}\n}\n/** A column may appear at most once in one index's element tuple. */\nfunction rejectRepeatedIndexColumns(indexes, coordinate, errors) {\n\tfor (const index of indexes) {\n\t\tconst duplicateColumn = findDuplicateValue(index.columns ?? []);\n\t\tif (duplicateColumn !== void 0) errors.push(`${coordinate}: index contains duplicate column \"${duplicateColumn}\"`);\n\t}\n}\n/**\n* Two wire-named indexes with the same content are one index written twice —\n* the content hash is their identity, so neither spelling can survive. An\n* exact-named index is identified by its name instead, so content twins under\n* two names are legal and a repeated name is rejected by the named-object\n* check.\n*/\nfunction rejectDuplicateWireNamedIndexContent(indexes, coordinate, errors) {\n\tconst seenContent = /* @__PURE__ */ new Set();\n\tfor (const index of indexes) {\n\t\tif (index.prefix === void 0) continue;\n\t\tconst content = computeIndexContentHash(index);\n\t\tif (seenContent.has(content)) {\n\t\t\terrors.push(`${coordinate}: duplicate index definition on columns [${(index.columns ?? []).join(\", \")}]`);\n\t\t\tcontinue;\n\t\t}\n\t\tseenContent.add(content);\n\t}\n}\n/**\n* Two wire-named checks with the same predicate are one check written twice —\n* the content hash is their identity, so neither spelling can survive, and\n* whitespace variants of one predicate collapse onto the same hash. An\n* exact-named check is identified by its name instead, so content twins under\n* two names are legal (the legacy shape a database adopts from) and a repeated\n* name is rejected by the named-object check.\n*/\nfunction rejectDuplicateWireNamedCheckContent(checks, coordinate, errors) {\n\tconst seenContent = /* @__PURE__ */ new Set();\n\tfor (const check of checks) {\n\t\tif (check.prefix === void 0) continue;\n\t\tconst content = computeCheckContentHash(check.expression);\n\t\tif (seenContent.has(content)) {\n\t\t\terrors.push(`${coordinate}: duplicate check constraint definition (expression \"${check.expression}\")`);\n\t\t\tcontinue;\n\t\t}\n\t\tseenContent.add(content);\n\t}\n}\nfunction isContractFieldType(value) {\n\tif (!isPlainRecord(value)) return false;\n\tconst kind = value[\"kind\"];\n\tif (kind === \"scalar\") {\n\t\tif (typeof value[\"codecId\"] !== \"string\") return false;\n\t\tconst typeParams = value[\"typeParams\"];\n\t\tif (typeParams !== void 0 && !isPlainRecord(typeParams)) return false;\n\t\treturn true;\n\t}\n\tif (kind === \"valueObject\") return typeof value[\"name\"] === \"string\";\n\tif (kind === \"union\") {\n\t\tconst members = value[\"members\"];\n\t\tif (!Array.isArray(members)) return false;\n\t\treturn members.every((m) => isContractFieldType(m));\n\t}\n\treturn false;\n}\nconst ModelFieldSchema = type({\n\t\"+\": \"reject\",\n\tnullable: \"boolean\",\n\ttype: type(\"unknown\").narrow((value, ctx) => isContractFieldType(value) ? true : ctx.mustBe(\"scalar, valueObject, or union field type\")),\n\tmany: type(\"false\").or({\n\t\t\"+\": \"reject\",\n\t\telementNullable: \"boolean\"\n\t}).default(false),\n\t\"dict?\": \"true\",\n\t\"valueSet?\": DomainEnumRefSchema\n});\nconst ModelStorageSchema = type({\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tfields: type({ \"[string]\": type({\n\t\tcolumn: \"string\",\n\t\t\"codecId?\": \"string\",\n\t\t\"nullable?\": \"boolean\"\n\t}) })\n});\nconst ContractRelationThroughSchema = type({\n\t\"+\": \"reject\",\n\ttable: \"string\",\n\tnamespaceId: \"string\",\n\tparentColumns: type.string.array().readonly(),\n\tchildColumns: type.string.array().readonly(),\n\ttargetColumns: type.string.array().readonly()\n});\nconst ContractRelationOnSchema = type({\n\t\"+\": \"reject\",\n\tlocalFields: type.string.array().readonly(),\n\ttargetFields: type.string.array().readonly()\n});\nconst ContractManyToManyRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'N:M'\",\n\ton: ContractRelationOnSchema,\n\tthrough: ContractRelationThroughSchema\n});\nconst ContractToOneRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | 'N:1'\",\n\t\"nullable?\": \"boolean\",\n\ton: ContractRelationOnSchema\n});\nconst ContractToManyRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:N'\",\n\ton: ContractRelationOnSchema\n});\nconst ContractReferenceRelationSchema = ContractManyToManyRelationSchema.or(ContractToOneRelationSchema).or(ContractToManyRelationSchema);\nconst ContractEmbedRelationSchema = type({\n\t\"+\": \"reject\",\n\tto: CrossReferenceSchema,\n\tcardinality: \"'1:1' | '1:N'\"\n});\nconst ContractRelationSchema = ContractReferenceRelationSchema.or(ContractEmbedRelationSchema);\nconst ModelSchema = type({\n\tstorage: ModelStorageSchema,\n\t\"fields?\": type({ \"[string]\": ModelFieldSchema }),\n\t\"relations?\": type({ \"[string]\": ContractRelationSchema }),\n\t\"discriminator?\": type({ field: \"string\" }),\n\t\"variants?\": type({ \"[string]\": CrossReferenceSchema }),\n\t\"base?\": CrossReferenceSchema,\n\t\"owner?\": \"string\"\n});\nconst ContractMetaSchema = type({ \"[string]\": \"unknown\" });\n/**\n* Builds the full SQL contract schema. The storage subtree threads\n* pack contributions through {@link createSqlStorageSchema}; the rest\n* of the contract envelope is family-shared.\n*/\nfunction createSqlContractSchema(kinds) {\n\tconst storage = createSqlStorageSchema(kinds);\n\treturn type({\n\t\t\"+\": \"reject\",\n\t\ttarget: \"string\",\n\t\ttargetFamily: \"'sql'\",\n\t\t\"coreHash?\": \"string\",\n\t\tprofileHash: \"string\",\n\t\t\"capabilities?\": \"Record<string, Record<string, boolean>>\",\n\t\t\"extensions?\": \"Record<string, unknown>\",\n\t\t\"meta?\": ContractMetaSchema,\n\t\t\"defaultControlPolicy?\": ControlPolicySchema,\n\t\t\"roots?\": type({ \"[string]\": CrossReferenceSchema }),\n\t\tdomain: type({ namespaces: type({ \"[string]\": type({\n\t\t\tmodels: type({ \"[string]\": ModelSchema }),\n\t\t\t\"valueObjects?\": type({ \"[string]\": type({ fields: type({ \"[string]\": ModelFieldSchema }) }) }),\n\t\t\t\"enum?\": type({ \"[string]\": ContractEnumSchema })\n\t\t}) }) }),\n\t\tstorage,\n\t\t\"execution?\": ContractExecutionSectionSchema\n\t});\n}\nconst SqlContractSchema = createSqlContractSchema(DEFAULT_SQL_KINDS);\n/**\n* Validates the structural shape of SqlStorage using Arktype. Pure\n* structural check: namespace IR is never materialized here (that needs\n* a target concretion via the serializer hydration path), so this throws\n* on invalid input and constructs nothing.\n*\n* @param value - The storage value to validate\n* @throws Error if the storage structure is invalid\n*/\nfunction validateStorage(value) {\n\tconst removedKeys = removedKeyProblems(value);\n\tconst result = StorageSchema(value);\n\tconst errors = removedKeys.length > 0 ? [...removedKeys] : result instanceof type.errors ? result.map((p) => p.message) : [];\n\tif (errors.length > 0) throw contractError(\"CONTRACT.VALIDATION_FAILED\", `Storage validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n}\nfunction validateModel(value) {\n\tconst result = ModelSchema(value);\n\tif (result instanceof type.errors) {\n\t\tconst errors = result.map((p) => p.message);\n\t\tthrow contractError(\"CONTRACT.VALIDATION_FAILED\", `Model validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n\t}\n\treturn result;\n}\n/**\n* Structural arktype validation of an SQL contract envelope. Internal\n* helper for {@link validateSqlContractFully} — exposed only inside\n* this module, since the family seam-of-record is the\n* `SqlContractSerializerBase.deserializeContract` SPI.\n*/\nfunction validateSqlContractStructure(value, contractSchema) {\n\tif (typeof value !== \"object\" || value === null) throw new ContractValidationError(\"Contract structural validation failed: value must be an object\", \"structural\");\n\tconst targetFamily = \"targetFamily\" in value ? value.targetFamily : void 0;\n\tif (targetFamily !== void 0 && targetFamily !== \"sql\") throw new ContractValidationError(`Unsupported target family: ${targetFamily}`, \"structural\");\n\tconst removedKeys = removedKeyProblems(fieldOf(value, \"storage\"));\n\tif (removedKeys.length > 0) throw new ContractValidationError(`Contract structural validation failed: ${removedKeys.join(\"; \")}`, \"structural\");\n\tconst contractResult = contractSchema(value);\n\tif (contractResult instanceof type.errors) throw new ContractValidationError(`Contract structural validation failed: ${contractResult.map((p) => p.message).join(\"; \")}`, \"structural\");\n\treturn blindCast(contractResult);\n}\nfunction foreignKeyBackingError(table, fk) {\n\tconst { index } = fk;\n\tif (index === void 0) return void 0;\n\tconst columns = fk.source.columns;\n\tif (\"name\" in index) {\n\t\tconst named = table.indexes.find((candidate) => candidate.name === index.name);\n\t\tif (named === void 0) return `is indexed by \"${index.name}\", but the table has no index with that name`;\n\t\treturn named.columns !== void 0 && startsWithColumns(named.columns, columns) ? void 0 : `is indexed by \"${index.name}\", but that index does not start with those columns`;\n\t}\n\tif (\"primaryKey\" in index) return table.primaryKey !== void 0 && startsWithColumns(table.primaryKey.columns, columns) ? void 0 : \"is indexed by the primary key, but the table's primary key does not start with those columns\";\n\tconst described = `the unique constraint on [${index.unique.join(\", \")}]`;\n\tif (!table.uniques.some((unique) => sameColumns$1(unique.columns, index.unique))) return `is indexed by ${described}, but the table has no unique constraint on those columns`;\n\treturn startsWithColumns(index.unique, columns) ? void 0 : `is indexed by ${described}, which does not start with those columns`;\n}\n/**\n* Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.\n*\n* Returns an array of human-readable error strings. Empty array = valid.\n*\n* Currently checks:\n* - duplicate named primary key / unique / index / foreign key objects within a table\n* - duplicate unique, index, or foreign key declarations within a table\n* - duplicate columns within primary key / unique / index definitions\n* - nullable columns in primary key definitions\n* - `setNull` referential action on a non-nullable FK column (would fail at runtime)\n* - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)\n* - a foreign key whose `index` is an index, primary key or unique constraint its table does not have\n*/\nfunction validateStorageSemantics(storage) {\n\tconst errors = [];\n\tvalidateTableScopedEntryNames(storage, errors);\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(storage)) {\n\t\tconst table = blindCast(rawTable);\n\t\tconst namedObjects = /* @__PURE__ */ new Map();\n\t\tconst registerNamedObject = (kind, name) => {\n\t\t\tif (!name) return;\n\t\t\tnamedObjects.set(name, [...namedObjects.get(name) ?? [], kind]);\n\t\t};\n\t\tregisterNamedObject(\"primary key\", table.primaryKey?.name);\n\t\tfor (const unique of table.uniques) registerNamedObject(\"unique constraint\", unique.name);\n\t\tfor (const index of table.indexes) registerNamedObject(\"index\", index.name);\n\t\tfor (const fk of table.foreignKeys) registerNamedObject(\"foreign key\", fk.name);\n\t\tfor (const check of table.checks ?? []) registerNamedObject(\"check constraint\", check.name);\n\t\tfor (const [name, kinds] of namedObjects) if (kinds.length > 1) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": named object \"${name}\" is declared multiple times (${kinds.join(\", \")})`);\n\t\tif (table.primaryKey) {\n\t\t\tconst duplicateColumn = findDuplicateValue(table.primaryKey.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tfor (const columnName of table.primaryKey.columns) if (table.columns[columnName]?.nullable === true) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": primary key column \"${columnName}\" is nullable; primary key columns must be NOT NULL`);\n\t\t}\n\t\tconst seenUniqueDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const unique of table.uniques) {\n\t\t\tconst duplicateColumn = findDuplicateValue(unique.columns);\n\t\t\tif (duplicateColumn !== void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": unique constraint contains duplicate column \"${duplicateColumn}\"`);\n\t\t\tconst signature = JSON.stringify({ columns: unique.columns });\n\t\t\tif (seenUniqueDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate unique constraint definition on columns [${unique.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenUniqueDefinitions.add(signature);\n\t\t}\n\t\tconst tableCoordinate = `Namespace \"${namespaceId}\" table \"${tableName}\"`;\n\t\trejectRepeatedIndexColumns(table.indexes, tableCoordinate, errors);\n\t\trejectDuplicateWireNamedIndexContent(table.indexes, tableCoordinate, errors);\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst error = foreignKeyBackingError(table, fk);\n\t\t\tif (error !== void 0) errors.push(`${tableCoordinate}: foreign key on columns [${fk.source.columns.join(\", \")}] ${error}`);\n\t\t}\n\t\tconst seenForeignKeyDefinitions = /* @__PURE__ */ new Set();\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst signature = JSON.stringify({\n\t\t\t\tsource: fk.source,\n\t\t\t\ttarget: fk.target,\n\t\t\t\tonDelete: fk.onDelete ?? null,\n\t\t\t\tonUpdate: fk.onUpdate ?? null\n\t\t\t});\n\t\t\tif (seenForeignKeyDefinitions.has(signature)) {\n\t\t\t\terrors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": duplicate foreign key definition on columns [${fk.source.columns.join(\", \")}]`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenForeignKeyDefinitions.add(signature);\n\t\t}\n\t\tfor (const fk of table.foreignKeys) for (const colName of fk.source.columns) {\n\t\t\tconst column = table.columns[colName];\n\t\t\tif (!column) continue;\n\t\t\tif (fk.onDelete === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onUpdate === \"setNull\" && !column.nullable) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setNull on foreign key column \"${colName}\" which is NOT NULL`);\n\t\t\tif (fk.onDelete === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onDelete setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t\tif (fk.onUpdate === \"setDefault\" && !column.nullable && column.default === void 0) errors.push(`Namespace \"${namespaceId}\" table \"${tableName}\": onUpdate setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`);\n\t\t}\n\t\trejectDuplicateWireNamedCheckContent(table.checks ?? [], tableCoordinate, errors);\n\t}\n\treturn errors;\n}\n/**\n* SQL storage logical-consistency checks: every model.storage.table resolves to a real table, every domain field has a model.storage.fields entry, and every model.storage.fields[*].column resolves to a real column. Throws `ContractValidationError` on the first mismatch.\n*/\nfunction validateModelStorageReferences(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) {\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\tconst storageNamespaceId = modelStorage.namespaceId;\n\t\tif (storageNamespaceId !== namespaceId) throw new ContractValidationError(`Model \"${qualifiedName}\" storage.namespaceId \"${storageNamespaceId}\" does not match domain namespace \"${namespaceId}\"`, \"storage\");\n\t\tconst storageTable = modelStorage.table;\n\t\tconst rawTable = contract.storage.namespaces[storageNamespaceId]?.entries.table?.[storageTable];\n\t\tif (rawTable === void 0) throw new ContractValidationError(`Model \"${qualifiedName}\" references non-existent table \"${storageNamespaceId}.${storageTable}\"`, \"storage\");\n\t\tconst table = blindCast(rawTable);\n\t\tfor (const fieldName of Object.keys(model.fields)) if (!Object.hasOwn(modelStorage.fields, fieldName)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" has no entry in storage.fields, so no column holds it`, \"storage\");\n\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\tfor (const [fieldName, field] of Object.entries(modelStorage.fields)) if (!columnNames.has(field.column)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" references non-existent column \"${field.column}\" in table \"${storageTable}\"`, \"storage\");\n\t}\n}\n/** The names of a model's own fields and of the fields it inherits from its base models. */\nfunction fieldNamesWithInherited(contract, namespaceId, modelName) {\n\tconst names = /* @__PURE__ */ new Set();\n\tconst seen = /* @__PURE__ */ new Set();\n\tlet coordinate = {\n\t\tnamespace: namespaceId,\n\t\tmodel: modelName\n\t};\n\twhile (coordinate !== void 0) {\n\t\tconst key = JSON.stringify([coordinate.namespace, coordinate.model]);\n\t\tif (seen.has(key)) break;\n\t\tseen.add(key);\n\t\tconst model = contract.domain.namespaces[coordinate.namespace]?.models[coordinate.model];\n\t\tif (model === void 0) break;\n\t\tfor (const name of Object.keys(model.fields)) names.add(name);\n\t\tcoordinate = model.base;\n\t}\n\treturn names;\n}\n/**\n* Every relation joins on fields: its local fields are fields of the model that declares it, and its target fields are fields of the target model. The target side of a many-to-many relation names columns of its junction table instead. A cross-space relation's target is in another contract, so its target side is not checked. Throws `ContractValidationError` on the first name that is not a field.\n*/\nfunction validateRelationJoinFields(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations)) {\n\t\tif (!(\"on\" in relation)) continue;\n\t\tconst location = `Relation \"${relationName}\" on model \"${namespaceId}:${modelName}\"`;\n\t\tconst localFields = fieldNamesWithInherited(contract, namespaceId, modelName);\n\t\tfor (const field of relation.on.localFields) if (!localFields.has(field)) throw new ContractValidationError(`${location} joins on \"${field}\", which is not a field of model \"${namespaceId}:${modelName}\"`, \"domain\");\n\t\tif (relation.cardinality === \"N:M\") {\n\t\t\tconst { namespaceId: junctionNamespaceId, table: junctionTable } = relation.through;\n\t\t\tfor (const column of relation.on.targetFields) if (!lookupStorageColumn(contract, junctionNamespaceId, junctionTable, column)) throw new ContractValidationError(`${location} joins on \"${column}\", which is not a column of junction table \"${junctionNamespaceId}.${junctionTable}\"`, \"domain\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (relation.to.space !== void 0) continue;\n\t\tconst targetFields = fieldNamesWithInherited(contract, relation.to.namespace, relation.to.model);\n\t\tfor (const field of relation.on.targetFields) if (!targetFields.has(field)) throw new ContractValidationError(`${location} joins on \"${field}\", which is not a field of model \"${relation.to.namespace}:${relation.to.model}\"`, \"domain\");\n\t}\n}\n/**\n* Every execution default targets a column some model's field maps: an execution default is declared on a field, and it belongs to that field. Throws `ContractValidationError` on the first default on a column no field maps.\n*/\nfunction validateExecutionDefaultsTargetMappedColumns(contract) {\n\tconst mappedColumns = /* @__PURE__ */ new Set();\n\tfor (const namespace of Object.values(contract.domain.namespaces)) for (const model of Object.values(namespace.models)) {\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tfor (const field of Object.values(modelStorage.fields)) mappedColumns.add(JSON.stringify([\n\t\t\tmodelStorage.namespaceId,\n\t\t\tmodelStorage.table,\n\t\t\tfield.column\n\t\t]));\n\t}\n\tfor (const { ref } of contract.execution?.mutations.defaults ?? []) if (!mappedColumns.has(JSON.stringify([\n\t\tref.namespace,\n\t\tref.entry,\n\t\tref.field\n\t]))) throw new ContractValidationError(`Execution default for column \"${ref.field}\" of table \"${ref.namespace}.${ref.entry}\" targets a column no field maps; execution defaults are declared on fields. Give the column a database default instead.`, \"storage\");\n}\n/**\n* Cross-table consistency checks for SQL storage: primary key, unique,\n* index, and foreign key column references resolve to real columns;\n* NOT NULL columns don't carry a literal `null` default; FK column\n* counts match their referenced columns. Throws on the first mismatch.\n*/\nfunction validateSqlStorageConsistency(contract) {\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(contract.storage)) {\n\t\tconst table = blindCast(rawTable);\n\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\tif (table.primaryKey) {\n\t\t\tfor (const colName of table.primaryKey.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" primaryKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t}\n\t\tfor (const unique of table.uniques) for (const colName of unique.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" unique constraint references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const index of table.indexes) for (const colName of index.columns ?? []) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" index references non-existent column \"${colName}\"`, \"storage\");\n\t\tfor (const [colName, column] of Object.entries(table.columns)) if (!column.nullable && column.default?.kind === \"literal\" && column.default.value === null) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" column \"${colName}\" is NOT NULL but has a literal null default`, \"storage\");\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tif (fk.source.namespaceId !== namespaceId || fk.source.tableName !== tableName) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" contains foreignKey with mismatched source coordinates (${fk.source.namespaceId}.${fk.source.tableName})`, \"storage\");\n\t\t\tfor (const colName of fk.source.columns) if (!columnNames.has(colName)) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\"`, \"storage\");\n\t\t\tif (fk.target.spaceId === void 0) {\n\t\t\t\tconst referencedRaw = contract.storage.namespaces[fk.target.namespaceId]?.entries.table?.[fk.target.tableName];\n\t\t\t\tif (referencedRaw === void 0) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent table \"${fk.target.namespaceId}.${fk.target.tableName}\"`, \"storage\");\n\t\t\t\tconst referencedTable = blindCast(referencedRaw);\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 new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey references non-existent column \"${colName}\" in table \"${fk.target.tableName}\"`, \"storage\");\n\t\t\t}\n\t\t\tif (fk.source.columns.length !== fk.target.columns.length) throw new ContractValidationError(`Namespace \"${namespaceId}\" table \"${tableName}\" foreignKey column count (${fk.source.columns.length}) does not match referenced column count (${fk.target.columns.length})`, \"storage\");\n\t\t}\n\t}\n}\n/**\n* Full SQL contract validation: structural (arktype) +\n* framework-shared domain + SQL storage logical-consistency + SQL\n* storage semantic + model ↔ storage reference checks. Throws\n* `ContractValidationError` on the first failure. Returns the\n* validated flat-data shape; IR class hydration happens in the SPI\n* base on top of this helper.\n*/\nfunction validateSqlContractFully(value, options) {\n\tconst validated = validateSqlContractStructure(typeof value === \"object\" && value !== null ? (() => {\n\t\tconst { schemaVersion: _, _generated: _g, ...rest } = blindCast(value);\n\t\treturn rest;\n\t})() : value, options?.contractSchema ?? SqlContractSchema);\n\tvalidateContractDomain({\n\t\troots: validated.roots,\n\t\tdomain: validated.domain\n\t});\n\tvalidateSqlStorageConsistency(validated);\n\tconst semanticErrors = validateStorageSemantics(validated.storage);\n\tif (semanticErrors.length > 0) throw new ContractValidationError(`Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, \"storage\");\n\tvalidateModelStorageReferences(validated);\n\tvalidateExecutionDefaultsTargetMappedColumns(validated);\n\tvalidateRelationJoinFields(validated);\n\tvalidateRelationThroughConsistency(validated, options?.dataTypes ?? createDataTypeLookup([]));\n\tvalidateToOneRelationNullabilityAgainstStorage(validated);\n\treturn validated;\n}\n/**\n* A same-space to-one relation that states `nullable` must agree with its local FK columns:\n* nullable exactly when one of them is nullable (a column that cannot be resolved counts as\n* nullable). A relation without the flag is left to hydration, which derives it the same way.\n*/\nfunction validateToOneRelationNullabilityAgainstStorage(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) {\n\t\tconst storage = blindCast(model.storage);\n\t\tfor (const [relationName, relation] of Object.entries(model.relations)) {\n\t\t\tif (!(\"on\" in relation && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.to.space === void 0) || relation.nullable === void 0) continue;\n\t\t\tconst location = `Relation \"${relationName}\" on model \"${namespaceId}:${modelName}\"`;\n\t\t\tconst { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, storage, relation);\n\t\t\tif (!ownsForeignKey) {\n\t\t\t\tif (relation.nullable) continue;\n\t\t\t\tthrow new ContractValidationError(`${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, \"storage\");\n\t\t\t}\n\t\t\tconst anyNullable = columns.some((column) => column.nullable);\n\t\t\tif (relation.nullable === anyNullable) continue;\n\t\t\tconst columnList = columns.filter((column) => column.nullable !== relation.nullable).map((column) => `\"${column.name}\"`).join(\", \");\n\t\t\tthrow new ContractValidationError(relation.nullable ? `${location} is nullable but every local FK column is NOT NULL (columns ${columnList})` : `${location} is required but a local FK column is nullable (columns ${columnList})`, \"storage\");\n\t\t}\n\t}\n}\n/** Storage column lookup for through-consistency validation. */\nfunction lookupStorageColumn(contract, namespaceId, tableName, columnName) {\n\tconst rawTable = contract.storage.namespaces[namespaceId]?.entries.table?.[tableName];\n\tif (rawTable === void 0) return;\n\treturn blindCast(rawTable).columns[columnName];\n}\n/**\n* Two storage columns share a type when the types their `dataType`s are stored as and their `typeParams` match. `codecId` and\n* `nullable` are not compared: they do not change the database type that governs a join.\n*/\nfunction sameStorageType(a, b, dataTypes) {\n\treturn sqlStorageTypeId(a.dataType, dataTypes) === sqlStorageTypeId(b.dataType, dataTypes) && canonicalizeJson(a.typeParams ?? {}) === canonicalizeJson(b.typeParams ?? {});\n}\nfunction describeColumnType(column) {\n\treturn column.typeParams === void 0 ? column.dataType : `${column.dataType} ${canonicalizeJson(column.typeParams)}`;\n}\n/**\n* Validates one side of an N:M join: the junction columns and the model\n* columns they pair against positionally must be equal in number, exist in\n* their tables, and share the same storage type (`dataType` + `typeParams`).\n* The junction's storage foreign keys already guarantee this for user-declared\n* FK constraints, but `through` is a logical descriptor never tied to them by\n* the rest of validation — and the TS builder accepts explicit join columns\n* without requiring a junction FK at all — so this checks the columns directly\n* against storage, one path regardless of how the junction was authored.\n*\n* Joined columns must be the *same* storage type, not merely compatible:\n* relying on implicit conversion (e.g. `text`↔`character`) is unsafe on writes\n* — `character(n)` space-padding makes such coercions non-associative — and no\n* ADR sanctions heterogeneous junction columns. Equality is the conservative\n* default; it can be relaxed deliberately if a real use case ever appears.\n*/\nfunction validateThroughJoinSide(input) {\n\tconst fail = (detail) => new ContractValidationError(`Many-to-many relation \"${input.qualifiedName}\" ${detail}`, \"storage\");\n\tif (input.junctionColumns.length !== input.modelColumns.length) throw fail(`pairs ${input.junctionColumnsLabel} (${input.junctionColumns.length}) with ${input.modelColumnsLabel} (${input.modelColumns.length}) of differing length; they join positionally and must match.`);\n\tfor (const [index, junctionColumnName] of input.junctionColumns.entries()) {\n\t\tconst modelColumnRef = input.modelColumns[index];\n\t\tif (modelColumnRef === void 0) continue;\n\t\tconst junctionColumn = lookupStorageColumn(input.contract, input.junctionNamespaceId, input.junctionTable, junctionColumnName);\n\t\tif (junctionColumn === void 0) throw fail(`${input.junctionColumnsLabel} references column \"${junctionColumnName}\" absent from junction table \"${input.junctionNamespaceId}.${input.junctionTable}\".`);\n\t\tconst model = input.model;\n\t\tif (model === void 0) continue;\n\t\tlet modelColumnName = modelColumnRef;\n\t\tif (model.fieldToColumn !== void 0) {\n\t\t\tconst mapped = model.fieldToColumn[modelColumnRef];\n\t\t\tif (mapped === void 0) throw fail(`${input.modelColumnsLabel} references field \"${modelColumnRef}\" absent from model on table \"${model.namespaceId}.${model.table}\".`);\n\t\t\tmodelColumnName = mapped.column;\n\t\t}\n\t\tconst modelColumn = lookupStorageColumn(input.contract, model.namespaceId, model.table, modelColumnName);\n\t\tif (modelColumn === void 0) throw fail(`${input.modelColumnsLabel} references column \"${modelColumnName}\" absent from table \"${model.namespaceId}.${model.table}\".`);\n\t\tif (!sameStorageType(junctionColumn, modelColumn, input.dataTypes)) throw fail(`joins \"${input.junctionTable}.${junctionColumnName}\" (${describeColumnType(junctionColumn)}) with \"${model.table}.${modelColumnName}\" (${describeColumnType(modelColumn)}) of differing storage type; junction columns must match the type of the column they reference.`);\n\t}\n}\n/**\n* Validates that every N:M relation's `through` descriptor is consistent with\n* the storage columns it joins: both join sides match in column count,\n* reference columns that exist in their tables, and pair columns of the same\n* storage type. Without this, a `through` that disagrees with storage surfaces\n* as a silently wrong JOIN at query time rather than a validation error here.\n*/\nfunction validateRelationThroughConsistency(contract, dataTypes) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations)) {\n\t\tif (relation.cardinality !== \"N:M\") continue;\n\t\tconst qualifiedName = `${namespaceId}.${modelName}.${relationName}`;\n\t\tconst { on, through } = relation;\n\t\tconst modelStorage = blindCast(model.storage);\n\t\tvalidateThroughJoinSide({\n\t\t\tdataTypes,\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: on.localFields,\n\t\t\tmodelColumnsLabel: \"on.localFields\",\n\t\t\tmodel: {\n\t\t\t\tnamespaceId,\n\t\t\t\ttable: modelStorage.table,\n\t\t\t\tfieldToColumn: modelStorage.fields\n\t\t\t},\n\t\t\tjunctionColumns: through.parentColumns,\n\t\t\tjunctionColumnsLabel: \"through.parentColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t\tconst targetModel = relation.to.space === void 0 ? contract.domain.namespaces[relation.to.namespace]?.models[relation.to.model] : void 0;\n\t\tconst targetModelSide = targetModel === void 0 ? void 0 : {\n\t\t\tnamespaceId: relation.to.namespace,\n\t\t\ttable: blindCast(targetModel.storage).table\n\t\t};\n\t\tvalidateThroughJoinSide({\n\t\t\tdataTypes,\n\t\t\tcontract,\n\t\t\tqualifiedName,\n\t\t\tmodelColumns: through.targetColumns,\n\t\t\tmodelColumnsLabel: \"through.targetColumns\",\n\t\t\t...ifDefined(\"model\", targetModelSide),\n\t\t\tjunctionColumns: through.childColumns,\n\t\t\tjunctionColumnsLabel: \"through.childColumns\",\n\t\t\tjunctionNamespaceId: through.namespaceId,\n\t\t\tjunctionTable: through.table\n\t\t});\n\t}\n}\n//#endregion\nexport { CheckConstraintSchema, ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ContractEnumSchema, ForeignKeyReferenceSchema, ForeignKeySchema, ForeignKeySourceSchema, IndexSchema, ReferentialActionSchema, StorageTableSchema, StorageValueSetSchema, checkSqlDefaultText, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, reservedSqlDefaultText, resolveSqlToOneRelationStorage, validateExecutionDefaultsTargetMappedColumns, validateModel, validateModelStorageReferences, validateRelationJoinFields, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics, valueObjectStorageTypeMissingMessage };\n\n//# sourceMappingURL=validators.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;;AAE5B,SAAS,oBAAoB,MAAM;CAClC,OAAO,oBAAoB,KAAK,IAAI,IAAI,gGAAgG,KAAK;AAC9I;;;;AAIA,SAAS,uBAAuB,MAAM;CACrC,QAAQ,KAAK,KAAK,GAAlB;EACC,KAAK,SAAS,OAAO;EACrB,KAAK,mBAAmB,OAAO;EAC/B,SAAS;CACV;AACD;AAGA,SAAS,YAAY,MAAM,OAAO;CACjC,OAAO,KAAK,WAAW,MAAM,UAAU,KAAK,OAAO,QAAQ,UAAU,WAAW,MAAM,MAAM;AAC7F;;;;;AAKA,SAAS,+BAA+B,UAAU,cAAc,UAAU;CACzE,MAAM,QAAQ,UAAU,SAAS,QAAQ,WAAW,aAAa,YAAY,EAAE,QAAQ,QAAQ,aAAa,MAAM;CAClH,MAAM,UAAU,SAAS,GAAG,YAAY,KAAK,cAAc;EAC1D,MAAM,aAAa,aAAa,OAAO,UAAU,EAAE;EACnD,MAAM,SAAS,eAAe,KAAK,IAAI,KAAK,IAAI,OAAO,QAAQ;EAC/D,OAAO;GACN,MAAM,cAAc;GACpB,UAAU,QAAQ,YAAY;EAC/B;CACD,CAAC;CACD,MAAM,cAAc,QAAQ,KAAK,WAAW,OAAO,IAAI;CACvD,OAAO;EACN,gBAAgB,SAAS,gBAAgB,UAAU,OAAO,eAAe,CAAC,EAAA,CAAG,MAAM,eAAe,YAAY,WAAW,OAAO,SAAS,WAAW,CAAC;EACrJ;CACD;AACD;AAGA,MAAM,sBAAsB,KAAK,mDAAmD;AACpF,MAAM,sBAAsB,KAAK;CAChC,OAAO;CACP,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,YAAY;AACb,CAAC;;AAED,MAAM,kCAAkC,KAAK,QAAQ,CAAC,CAAC,KAAK;CAC3D,MA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GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;EACD,MAAM,cAAc,SAAS,GAAG,UAAU,KAAK,IAAI,SAAS,OAAO,WAAW,SAAS,GAAG,UAAU,EAAE,OAAO,SAAS,GAAG,SAAS,KAAK;EACvI,MAAM,kBAAkB,gBAAgB,KAAK,IAAI,KAAK,IAAI;GACzD,aAAa,SAAS,GAAG;GACzB,OAAO,UAAU,YAAY,OAAO,CAAC,CAAC;EACvC;EACA,wBAAwB;GACvB;GACA;GACA;GACA,cAAc,QAAQ;GACtB,mBAAmB;GACnB,GAAG,UAAU,SAAS,eAAe;GACrC,iBAAiB,QAAQ;GACzB,sBAAsB;GACtB,qBAAqB,QAAQ;GAC7B,eAAe,QAAQ;EACxB,CAAC;CACF;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-family-sql",
|
|
3
|
-
"version": "8.0.0-rc.18-dev.
|
|
3
|
+
"version": "8.0.0-rc.18-dev.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.18-dev.
|
|
13
|
-
"@prisma/orm-toolchain": "8.0.0-rc.18-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.18-dev.23",
|
|
13
|
+
"@prisma/orm-toolchain": "8.0.0-rc.18-dev.23",
|
|
14
14
|
"@standard-schema/spec": "^1.1.0",
|
|
15
15
|
"arktype": "^2.2.2",
|
|
16
16
|
"pathe": "^2.0.3",
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"ts-toolbelt": "^9.6.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@internal/family-sql": "8.0.0-rc.18-dev.
|
|
23
|
-
"@internal/sql-builder": "8.0.0-rc.18-dev.
|
|
24
|
-
"@internal/sql-contract": "8.0.0-rc.18-dev.
|
|
25
|
-
"@internal/sql-contract-emitter": "8.0.0-rc.18-dev.
|
|
26
|
-
"@internal/sql-contract-prisma7": "8.0.0-rc.18-dev.
|
|
27
|
-
"@internal/sql-contract-psl": "8.0.0-rc.18-dev.
|
|
28
|
-
"@internal/sql-contract-ts": "8.0.0-rc.18-dev.
|
|
29
|
-
"@internal/sql-errors": "8.0.0-rc.18-dev.
|
|
30
|
-
"@internal/sql-operations": "8.0.0-rc.18-dev.
|
|
31
|
-
"@internal/sql-orm-client": "8.0.0-rc.18-dev.
|
|
32
|
-
"@internal/sql-relational-core": "8.0.0-rc.18-dev.
|
|
33
|
-
"@internal/sql-runtime": "8.0.0-rc.18-dev.
|
|
34
|
-
"@internal/sql-schema-ir": "8.0.0-rc.18-dev.
|
|
35
|
-
"@repo/tsconfig": "8.0.0-rc.18-dev.
|
|
36
|
-
"@repo/tsdown": "8.0.0-rc.18-dev.
|
|
22
|
+
"@internal/family-sql": "8.0.0-rc.18-dev.23",
|
|
23
|
+
"@internal/sql-builder": "8.0.0-rc.18-dev.23",
|
|
24
|
+
"@internal/sql-contract": "8.0.0-rc.18-dev.23",
|
|
25
|
+
"@internal/sql-contract-emitter": "8.0.0-rc.18-dev.23",
|
|
26
|
+
"@internal/sql-contract-prisma7": "8.0.0-rc.18-dev.23",
|
|
27
|
+
"@internal/sql-contract-psl": "8.0.0-rc.18-dev.23",
|
|
28
|
+
"@internal/sql-contract-ts": "8.0.0-rc.18-dev.23",
|
|
29
|
+
"@internal/sql-errors": "8.0.0-rc.18-dev.23",
|
|
30
|
+
"@internal/sql-operations": "8.0.0-rc.18-dev.23",
|
|
31
|
+
"@internal/sql-orm-client": "8.0.0-rc.18-dev.23",
|
|
32
|
+
"@internal/sql-relational-core": "8.0.0-rc.18-dev.23",
|
|
33
|
+
"@internal/sql-runtime": "8.0.0-rc.18-dev.23",
|
|
34
|
+
"@internal/sql-schema-ir": "8.0.0-rc.18-dev.23",
|
|
35
|
+
"@repo/tsconfig": "8.0.0-rc.18-dev.23",
|
|
36
|
+
"@repo/tsdown": "8.0.0-rc.18-dev.23",
|
|
37
37
|
"tsdown": "0.22.14",
|
|
38
38
|
"typescript": "5.9.3"
|
|
39
39
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./collection-methods-B-tM7OPZ-v8HK9Txa.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./control-adapter-BCopdpsT-Bou0wWLF.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist-DAHIT4AS.mjs","names":[],"sources":["../../../../2-sql/3-tooling/emitter/dist/index.mjs"],"sourcesContent":["import { renderCodecTypeOverride, renderTypeOverridesMap, renderValueSetOverride, serializeNamespaceId, serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { settleAggregateOverloads } from \"@internal/framework-components/components\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { resolvedTypeParams } from \"@internal/sql-contract/types\";\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}\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\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\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\treturn [\n\t\t\t`type ColumnTypeOverrides = ${generateColumnTypeOverridesMap(storage, codecLookup)};`,\n\t\t\t`export type StorageColumnTypes = ${columnTypesExpression(\"output\")};`,\n\t\t\t`export type StorageColumnInputTypes = ${columnTypesExpression(\"input\")};`\n\t\t].join(\"\\n\");\n\t},\n\tfieldTypesExpression(side) {\n\t\treturn `FieldTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ParameterizedOutputTypeFunctions, FieldTypeOverrides, ${serializeValue(side)}>`;\n\t},\n\tgetFamilyImports(resolveImportSpecifier) {\n\t\treturn [\n\t\t\t\"import type {\",\n\t\t\t\" ColumnTypesFromStorage,\",\n\t\t\t\" ContractWithTypeMaps,\",\n\t\t\t\" FieldTypesFromDomain,\",\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 columnTypesExpression(side) {\n\treturn `ColumnTypesFromStorage<ContractBase['storage'], CodecTypes, ParameterizedOutputTypeFunctions, ColumnTypeOverrides, ${serializeValue(side)}>`;\n}\n/** `ColumnTypeOverrides`: per namespace, table and column, the type of each column its codec does not give. */\nfunction generateColumnTypeOverridesMap(storage, codecLookup) {\n\treturn renderTypeOverridesMap(Object.entries(storage.namespaces ?? {}).flatMap(([nsId, ns]) => {\n\t\tconst tables = blindCast(ns.entries.table ?? {});\n\t\treturn Object.entries(tables).flatMap(([tableName, table]) => Object.entries(table.columns).map(([columnName, column]) => [\n\t\t\tnsId,\n\t\t\ttableName,\n\t\t\tcolumnName,\n\t\t\tcolumnTypeOverride(storage, column, codecLookup)\n\t\t]));\n\t}));\n}\nfunction columnTypeOverride(storage, column, codecLookup) {\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\tconst override = valueSet ? renderValueSetOverride(valueSet.values, column.codecId, codecLookup) : void 0;\n\t\tif (override !== void 0) return override;\n\t}\n\treturn renderCodecTypeOverride(column.codecId, resolvedTypeParams(column, storage.types), codecLookup);\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.dataType !== \"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 dataType.\",\n\t\t\tmeta: { type: typeName }\n\t\t});\n\t\tconst codecId = serializeValue(codecInstanceShape.codecId);\n\t\tconst dataType = serializeValue(codecInstanceShape.dataType);\n\t\tconst typeParamsStr = serializeTypeParamsLiteral(codecInstanceShape.typeParams);\n\t\ttypeEntries.push(`readonly ${serializeObjectKey(typeName)}: { readonly kind: \"codec-instance\"; readonly codecId: ${codecId}; readonly dataType: ${dataType}; 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 dataType = serializeValue(col.dataType);\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\tconst manySpec = col.many === false ? \"; readonly many: false\" : `; readonly many: { readonly elementNullable: ${col.many.elementNullable} }`;\n\t\tcolumns.push(`readonly ${serializeObjectKey(colName)}: { readonly dataType: ${dataType}; readonly codecId: ${codecId}; readonly nullable: ${nullable}${defaultSpec}${typeParamsSpec}${typeRefSpec}${manySpec} }`);\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;;;;;;;;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,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AAK,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 +0,0 @@
|
|
|
1
|
-
import "./index-reference-DJaQLZA3-DxmYkkX-.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./middleware-oCT0RWkt-AFlRNCOD.mjs";
|
package/dist/plan-BZpZafiQ.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./query-lane-context-BLOPW1rQ-Bn3ugl9a.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql-data-type-Dabuwxet-BljsNjBu.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/sql-data-type-Dabuwxet.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { dataType, dataTypeParams, objectSchemaKeys, schemaKeysAllowing } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { type } from \"arktype\";\n//#region src/sql-data-type.ts\nconst PLACEHOLDER = /\\{([A-Za-z][A-Za-z0-9]*)\\}/g;\nconst LITERAL_CHARACTERS = /^[a-z0-9_ (),.]*$/;\nconst REGEXP_SPECIAL = /[.*+?^${}()|[\\]\\\\]/g;\nfunction paramKeysOf(id, schema) {\n\tif (schema === void 0) return [];\n\tconst keys = objectSchemaKeys(schema);\n\tif (keys === void 0) refuseDeclaration(id, \"its parameter schema must be an arktype object schema.\");\n\treturn keys;\n}\nfunction placeholdersOf(text) {\n\treturn [...text.matchAll(PLACEHOLDER)].map((match) => match[1] ?? \"\");\n}\nfunction placeholderSetOf(text) {\n\treturn [...placeholdersOf(text)].sort().join(\",\");\n}\nfunction patternOf(text, signedKeys = []) {\n\tconst placeholders = text.replace(REGEXP_SPECIAL, \"\\\\$&\").replace(/\\\\\\{([A-Za-z][A-Za-z0-9]*)\\\\\\}/g, (_, name) => signedKeys.includes(name) ? \"(-?\\\\d+)\" : \"(\\\\d+)\");\n\treturn new RegExp(`^${placeholders}$`);\n}\nfunction refuseDeclaration(id, why) {\n\tthrow new InternalError(`Data type ${id}: ${why}`);\n}\nfunction checkText(id, text, paramKeys) {\n\tconst quoted = JSON.stringify(text.text);\n\tconst refuse = (why) => refuseDeclaration(id, `the text ${quoted} ${why}.`);\n\tif (text.text === \"\") refuse(\"is empty\");\n\tif (text.text !== text.text.trim()) refuse(\"starts or ends with a space\");\n\tif (text.text.includes(\" \")) refuse(\"has two spaces in a row\");\n\tconst literal = text.text.replace(PLACEHOLDER, \"\");\n\tif (literal.includes(\"{\") || literal.includes(\"}\")) refuse(\"has a placeholder that is not written {name}\");\n\tif (!LITERAL_CHARACTERS.test(literal)) refuse(\"must be lower case and contain only letters, digits, spaces, brackets, commas, dots, underscores and placeholders\");\n\tfor (const name of placeholdersOf(text.text)) if (!paramKeys.includes(name)) refuse(`names the parameter {${name}}, which the type does not declare`);\n\tif (text.display === void 0) return;\n\tconst display = JSON.stringify(text.display);\n\tif (text.display.toLowerCase() !== text.text.toLowerCase()) refuse(`has the display ${display}, which differs from it beyond letter case`);\n\tif (placeholdersOf(text.display).join(\",\") !== placeholdersOf(text.text).join(\",\")) refuse(`has the display ${display}, which writes a placeholder differently`);\n}\nfunction checkMarks(id, texts) {\n\tconst marked = /* @__PURE__ */ new Map();\n\tfor (const text of texts) {\n\t\tconst key = placeholderSetOf(text.text);\n\t\tconst entry = marked.get(key) ?? {};\n\t\tfor (const mark of [\"written\", \"catalog\"]) {\n\t\t\tif (text[mark] !== true) continue;\n\t\t\tconst other = entry[mark];\n\t\t\tif (other !== void 0) refuseDeclaration(id, `the texts ${JSON.stringify(other)} and ${JSON.stringify(text.text)} have the same placeholders and are both ${mark}.`);\n\t\t\tentry[mark] = text.text;\n\t\t}\n\t\tmarked.set(key, entry);\n\t}\n}\nfunction checkKindClaim(id, spec) {\n\tif (spec.claimsKind === void 0) {\n\t\tif (spec.render !== void 0) refuseDeclaration(id, \"render is allowed only together with claimsKind.\");\n\t\tif (spec.fromReported !== void 0) refuseDeclaration(id, \"fromReported is allowed only together with claimsKind.\");\n\t\treturn;\n\t}\n\tif (spec.texts !== void 0) refuseDeclaration(id, \"a type that claims a kind declares no texts.\");\n}\nfunction checkStoredAs(id, spec) {\n\tif (spec.storedAs === void 0) return;\n\tif (spec.texts !== void 0) refuseDeclaration(id, \"a type stored as another declares no texts; its name is the name of the type it is stored as.\");\n\tif (spec.claimsKind !== void 0) refuseDeclaration(id, \"a type stored as another claims no kind.\");\n}\nconst identity = (params) => params;\nfunction acceptsParams(type$1, params) {\n\treturn type$1.params === void 0 || !(type$1.params(params) instanceof type.errors);\n}\nfunction checkNormalFormsWritten(type) {\n\tconst written = new Set(type.sql.texts.filter((text) => text.written === true).map((text) => placeholderSetOf(text.text)));\n\tif (written.size === 0) return;\n\tconst probes = [{}, ...type.sql.texts.map((text) => Object.fromEntries(placeholdersOf(text.text).map((name) => [name, 1])))];\n\tfor (const probe of probes) {\n\t\tif (!acceptsParams(type, probe)) continue;\n\t\tconst normalKeys = presentKeys(type.sql.normalize(probe));\n\t\tif (!written.has([...normalKeys].sort().join(\",\"))) refuseDeclaration(type.id, `the parameters ${formatKeys(Object.keys(probe))} have the normal form ${formatKeys(normalKeys)}, which no written text takes.`);\n\t}\n}\n/** Declare a SQL data type, refusing a declaration that breaks a rule of the module. */\nfunction sqlDataType(id, spec) {\n\tconst { params: _untypedParams, ...declared } = dataType(id, spec);\n\tconst texts = spec.texts ?? [];\n\tconst paramKeys = paramKeysOf(declared.id, spec.params);\n\tfor (const text of texts) checkText(declared.id, text, paramKeys);\n\tcheckMarks(declared.id, texts);\n\tcheckKindClaim(declared.id, spec);\n\tcheckStoredAs(declared.id, spec);\n\tconst type = {\n\t\t...declared,\n\t\t...ifDefined(\"params\", spec.params),\n\t\tsql: {\n\t\t\ttexts,\n\t\t\tclaimsKind: spec.claimsKind,\n\t\t\tstoredAs: spec.storedAs,\n\t\t\tnormalize: spec.normalize ?? identity,\n\t\t\trender: spec.render,\n\t\t\tfromReported: spec.fromReported\n\t\t}\n\t};\n\tcheckNormalFormsWritten(type);\n\treturn type;\n}\n/** Whether `type` is a data type a SQL column can have. `sql/expression` is the one data type no column has. */\nfunction isSqlDataType(type) {\n\treturn \"sql\" in type;\n}\nfunction presentKeys(params) {\n\treturn Object.keys(params).filter((key) => params[key] !== void 0);\n}\nfunction formatKeys(keys) {\n\treturn `[${[...keys].sort().join(\", \")}]`;\n}\n/** The parameters, when `type` accepts them; otherwise `CONTRACT.TYPE_PARAMS_INVALID` naming each parameter at fault. */\nfunction validateSqlTypeParams(type$2, params) {\n\tif (type$2.params === void 0) return blindCast(params);\n\tconst result = type$2.params(params);\n\tif (result instanceof type.errors) throw contractError(\"CONTRACT.TYPE_PARAMS_INVALID\", `${type$2.id}: ${result.summary}`, { meta: {\n\t\tdataType: type$2.id,\n\t\tparameters: [...new Set(result.map((error) => error.path.map(String).join(\".\")))]\n\t} });\n\treturn blindCast(params);\n}\nfunction pickText(type, mark, keys) {\n\tconst candidates = type.sql.texts.filter((text) => text[mark] === true);\n\tconst wanted = [...keys].sort().join(\",\");\n\tconst found = candidates.find((text) => placeholderSetOf(text.text) === wanted);\n\tif (found !== void 0) return found;\n\tconst verb = mark === \"written\" ? \"written\" : \"reported\";\n\tconst takes = candidates.length === 0 ? `it is never ${verb}` : `it is ${verb} with ${candidates.map((text) => formatKeys(placeholdersOf(text.text))).join(\", \")}`;\n\tthrow contractError(\"CONTRACT.TYPE_PARAMS_INVALID\", `${type.id} cannot be ${verb} with parameters ${formatKeys(keys)}; ${takes}`, { meta: {\n\t\tdataType: type.id,\n\t\tparameters: [...keys]\n\t} });\n}\nfunction substitute(type, text, params) {\n\treturn (text.display ?? text.text).replace(PLACEHOLDER, (_, name) => {\n\t\tconst value = params[name];\n\t\tif (!Number.isSafeInteger(value)) throw contractError(\"CONTRACT.TYPE_PARAMS_INVALID\", `${type.id}: the parameter ${name} is written into the type name and must be an integer`, { meta: {\n\t\t\tdataType: type.id,\n\t\t\tparameters: [name]\n\t\t} });\n\t\treturn String(value);\n\t});\n}\n/** The name of `type` with no parameters, for places where parameters must not appear. */\nfunction sqlBaseName(type, params) {\n\tif (type.sql.render !== void 0) return type.sql.render(validateSqlTypeParams(type, params));\n\tconst fewest = type.sql.texts.filter((text) => text.written === true).reduce((best, text) => best === void 0 || placeholdersOf(text.text).length < placeholdersOf(best.text).length ? text : best, void 0);\n\tif (fewest === void 0) throw new InternalError(`Data type ${type.id} has no written text and no render, so it has no base name.`);\n\tconst name = fewest.display ?? fewest.text;\n\tif (placeholdersOf(fewest.text).length === 0) return name;\n\tconst bracket = name.indexOf(\"(\");\n\treturn bracket === -1 ? name : name.slice(0, bracket);\n}\n/**\n* The base name of `type` with `params`, unquoted. It differs from {@link sqlBaseName} only for a\n* type that claims a kind: there it is the `typeName` parameter as written (`app.status`), where\n* `sqlBaseName` gives the quoted name `render` writes into SQL (`\"app\".\"status\"`).\n*/\nfunction unquotedSqlBaseName(type, params) {\n\tif (type.sql.claimsKind === void 0) return sqlBaseName(type, params);\n\tconst { typeName } = validateSqlTypeParams(type, params);\n\tif (typeof typeName !== \"string\") throw new InternalError(`Data type ${type.id} claims the kind \"${type.sql.claimsKind}\" but declares no string typeName parameter.`);\n\treturn typeName;\n}\nconst ADD_THE_CODEC_PACK = \"Add the pack that provides the codec, and so declares its data type, to the configuration: to `extensions` in prisma.config or in defineContract.\";\n/** The SQL data type the codec `codecId` represents. */\nfunction sqlDataTypeOfCodec(codecId, lookups) {\n\tconst descriptor = lookups.codecLookup.descriptorFor(codecId);\n\tif (descriptor === void 0) throw contractError(\"CONTRACT.CODEC_DESCRIPTOR_MISSING\", `No codec \"${codecId}\" is registered, so its column type cannot be named.`, {\n\t\tfix: ADD_THE_CODEC_PACK,\n\t\tmeta: { codecId }\n\t});\n\tconst type = lookups.dataTypeLookup.get(descriptor.dataType);\n\tif (type === void 0) throw contractError(\"CONTRACT.DATA_TYPE_UNREGISTERED\", `Codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers.`, {\n\t\tfix: ADD_THE_CODEC_PACK,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\tdataType: descriptor.dataType\n\t\t}\n\t});\n\tif (!isSqlDataType(type)) throw new InternalError(`Data type ${type.id} is not a SQL data type, so it has no type name.`);\n\treturn type;\n}\n/** The type a column of `type` is stored as, whose name DDL writes and the database reports: `type` itself unless it names another. */\nfunction sqlStorageType(type, lookup) {\n\tif (type.sql.storedAs === void 0) return type;\n\tconst storage = lookup.get(type.sql.storedAs);\n\tif (storage === void 0 || !isSqlDataType(storage)) throw contractError(\"CONTRACT.DATA_TYPE_UNREGISTERED\", `Data type \"${type.id}\" is stored as \"${type.sql.storedAs}\", which no component registers as a SQL data type.`, { meta: {\n\t\tdataType: type.sql.storedAs,\n\t\tstoredBy: type.id\n\t} });\n\treturn storage;\n}\n/** The id of the type a column of the data type `dataTypeId` is stored as: {@link sqlStorageType} of it, which refuses a storage type the lookup does not register, or `dataTypeId` itself when the lookup does not know it as a SQL data type. */\nfunction sqlStorageTypeId(dataTypeId, lookup) {\n\tconst type = lookup.get(dataTypeId);\n\treturn type !== void 0 && isSqlDataType(type) ? sqlStorageType(type, lookup).id : dataTypeId;\n}\n/** The type a column of the codec `codecId` is stored as: {@link sqlStorageType} of the data type it represents. */\nfunction sqlStorageTypeOfCodec(codecId, lookups) {\n\treturn sqlStorageType(sqlDataTypeOfCodec(codecId, lookups), lookups.dataTypeLookup);\n}\n/** {@link unquotedSqlBaseName} of the type a column of the codec `codecId` is stored as. */\nfunction unquotedSqlBaseNameOfCodec(codecId, typeParams, lookups) {\n\tconst type = sqlStorageTypeOfCodec(codecId, lookups);\n\treturn unquotedSqlBaseName(type, dataTypeParams(type, typeParams));\n}\n/** The text a migration writes for `type` with the raw `params`. */\nfunction renderSqlTypeName(type, params) {\n\tconst validated = validateSqlTypeParams(type, params);\n\tif (type.sql.render !== void 0) return type.sql.render(validated);\n\tconst normalized = type.sql.normalize(validated);\n\treturn substitute(type, pickText(type, \"written\", presentKeys(params).filter((key) => Object.hasOwn(normalized, key))), params);\n}\n/** The text the database catalog prints for `type` with `params`, in their normal form. */\nfunction renderSqlCatalogText(type, params) {\n\tconst validated = validateSqlTypeParams(type, params);\n\tif (type.sql.claimsKind !== void 0) throw new InternalError(`Data type ${type.id} claims the kind \"${type.sql.claimsKind}\" and has no catalog text.`);\n\tconst normalized = type.sql.normalize(validated);\n\treturn substitute(type, pickText(type, \"catalog\", presentKeys(normalized)), normalized);\n}\nfunction prepareReportedText(text) {\n\tlet prepared = \"\";\n\tlet quoted = false;\n\tlet spacePending = false;\n\tfor (const character of text.trim()) {\n\t\tif (!quoted && /\\s/.test(character)) {\n\t\t\tspacePending = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (spacePending && !/[(,]$/.test(prepared) && character !== \")\") prepared += \" \";\n\t\tspacePending = false;\n\t\tif (character === \"\\\"\") quoted = !quoted;\n\t\tprepared += quoted ? character : character.toLowerCase();\n\t}\n\treturn prepared;\n}\nfunction claims(text) {\n\treturn text.catalog === true || text.written !== true;\n}\nfunction claimingTexts(type) {\n\treturn type.sql.texts.filter(claims).map((text) => text.text);\n}\nfunction textsCollide(a, b) {\n\tconst withOnes = (text) => text.replace(PLACEHOLDER, \"1\");\n\treturn patternOf(a).test(withOnes(b)) || patternOf(b).test(withOnes(a));\n}\nfunction collisionBetween(first, second) {\n\tconst kind = first.sql.claimsKind;\n\tif (kind !== void 0 && kind === second.sql.claimsKind) return {\n\t\tby: \"kind\",\n\t\tkind\n\t};\n\tfor (const a of claimingTexts(first)) {\n\t\tconst b = claimingTexts(second).find((text) => textsCollide(a, text));\n\t\tif (b !== void 0) return {\n\t\t\tby: \"text\",\n\t\t\tfirst: a,\n\t\t\tsecond: b\n\t\t};\n\t}\n}\n/**\n* The first two SQL data types in `types` that would both recognise one reported type: a claiming\n* text of each collides, or both claim the same kind. Two texts collide when either one's pattern\n* matches the other with each placeholder written as 1.\n*/\nfunction findSqlDataTypeCollision(types) {\n\tconst sqlTypes = types.filter(isSqlDataType);\n\tfor (const [index, first] of sqlTypes.entries()) for (const second of sqlTypes.slice(index + 1)) {\n\t\tconst claims = collisionBetween(first, second);\n\t\tif (claims !== void 0) return {\n\t\t\tfirst,\n\t\t\tsecond,\n\t\t\tclaims\n\t\t};\n\t}\n}\n/**\n* The data type that claims a reported type, with its parameters in normal form, or undefined when\n* no type in `dataTypes` claims it or its parameters fail the type's schema.\n*/\nfunction resolveReportedSqlType(reported, dataTypes) {\n\tconst sqlTypes = dataTypes.filter(isSqlDataType);\n\tif (reported.kind !== void 0) {\n\t\tconst claimant = sqlTypes.find((type) => type.sql.claimsKind === reported.kind);\n\t\tif (claimant === void 0) return void 0;\n\t\treturn resolvedWith(claimant, claimant.sql.fromReported?.(reported) ?? {});\n\t}\n\tconst text = prepareReportedText(reported.text);\n\tfor (const type of sqlTypes) for (const candidate of type.sql.texts) {\n\t\tif (!claims(candidate)) continue;\n\t\tconst params = paramsMatching(type, candidate, text);\n\t\tif (params !== void 0) return resolvedWith(type, params);\n\t}\n}\nconst signedParamKeysByType = /* @__PURE__ */ new WeakMap();\n/** The parameters of `type` that may be negative, whose placeholders read a leading minus. */\nfunction signedParamKeys(type) {\n\tconst known = signedParamKeysByType.get(type);\n\tif (known !== void 0) return known;\n\tconst keys = schemaKeysAllowing(type.params, -1) ?? [];\n\tsignedParamKeysByType.set(type, keys);\n\treturn keys;\n}\nfunction paramsMatching(type, candidate, text) {\n\tconst match = patternOf(candidate.text, signedParamKeys(type)).exec(text);\n\tif (match === null) return void 0;\n\treturn Object.fromEntries(placeholdersOf(candidate.text).map((name, index) => [name, Number.parseInt(match[index + 1] ?? \"\", 10)]));\n}\n/**\n* Every data type in `dataTypes` that reads `text` as a migration may write it, with its parameters\n* in normal form: any of a type's texts counts, whether written, printed by the catalog or only\n* claimed. Empty when no type reads it or its parameters fail the type's schema. A type that claims\n* a kind has no texts, so it never reads one.\n*/\nfunction resolveWrittenSqlTypes(text, dataTypes) {\n\tconst prepared = prepareReportedText(text);\n\treturn dataTypes.filter(isSqlDataType).flatMap((type) => {\n\t\tfor (const candidate of type.sql.texts) {\n\t\t\tconst params = paramsMatching(type, candidate, prepared);\n\t\t\tif (params === void 0) continue;\n\t\t\tconst resolved = resolvedWith(type, params);\n\t\t\tif (resolved !== void 0) return [resolved];\n\t\t}\n\t\treturn [];\n\t});\n}\nfunction resolvedWith(type$3, params) {\n\tif (type$3.params !== void 0 && type$3.params(params) instanceof type.errors) return void 0;\n\treturn {\n\t\tdataType: type$3.id,\n\t\ttypeParams: type$3.sql.normalize(params)\n\t};\n}\n//#endregion\nexport { resolveReportedSqlType as a, sqlDataType as c, sqlStorageTypeId as d, sqlStorageTypeOfCodec as f, validateSqlTypeParams as h, renderSqlTypeName as i, sqlDataTypeOfCodec as l, unquotedSqlBaseNameOfCodec as m, isSqlDataType as n, resolveWrittenSqlTypes as o, unquotedSqlBaseName as p, renderSqlCatalogText as r, sqlBaseName as s, findSqlDataTypeCollision as t, sqlStorageType as u };\n\n//# sourceMappingURL=sql-data-type-Dabuwxet.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,cAAc;AACpB,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AACvB,SAAS,YAAY,IAAI,QAAQ;CAChC,IAAI,WAAW,KAAK,GAAG,OAAO,CAAC;CAC/B,MAAM,OAAO,iBAAiB,MAAM;CACpC,IAAI,SAAS,KAAK,GAAG,kBAAkB,IAAI,wDAAwD;CACnG,OAAO;AACR;AACA,SAAS,eAAe,MAAM;CAC7B,OAAO,CAAC,GAAG,KAAK,SAAS,WAAW,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,MAAM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