@prisma/orm-family-sql 8.0.0-rc.11-dev.28 → 8.0.0-rc.11-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ast-BAsreJBG.d.mts → ast-D7JjbK8E.d.mts} +3 -3
- package/dist/{ast-BAsreJBG.d.mts.map → ast-D7JjbK8E.d.mts.map} +1 -1
- package/dist/{authoring-type-constructors-C1ogrr_x-DZtwhqV-.mjs → authoring-type-constructors-C1ogrr_x-BziNu7gs.mjs} +2 -2
- package/dist/{authoring-type-constructors-C1ogrr_x-DZtwhqV-.mjs.map → authoring-type-constructors-C1ogrr_x-BziNu7gs.mjs.map} +1 -1
- package/dist/builder.d.mts +2 -2
- package/dist/builder__runtime.d.mts +8 -8
- package/dist/builder__types.d.mts +2 -2
- package/dist/{config-types-Bd3ud-mX.d.mts → config-types-C-rrJ_8P.d.mts} +3 -3
- package/dist/{config-types-Bd3ud-mX.d.mts.map → config-types-C-rrJ_8P.d.mts.map} +1 -1
- package/dist/{config-types-tDX8p7v3.mjs → config-types-jBPoHm6t.mjs} +2 -2
- package/dist/{config-types-tDX8p7v3.mjs.map → config-types-jBPoHm6t.mjs.map} +1 -1
- package/dist/{contract-builder-Bwe2diF2.d.mts → contract-builder-C8uKThYB.d.mts} +23 -5
- package/dist/contract-builder-C8uKThYB.d.mts.map +1 -0
- package/dist/{contract-builder-D1f6k8r4.mjs → contract-builder-CkT67-Wq.mjs} +50 -3
- package/dist/contract-builder-CkT67-Wq.mjs.map +1 -0
- package/dist/contract-prisma7__provider.d.mts +1 -1
- package/dist/contract-prisma7__provider.mjs +3 -3
- package/dist/contract-psl.d.mts +4 -4
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +3 -3
- package/dist/contract-psl__attribute-specs.d.mts.map +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-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +4 -4
- package/dist/contract-ts.mjs +4 -4
- 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 +3 -3
- package/dist/contract-ts__contract-builder.mjs +3 -3
- package/dist/contract.d.mts +6 -6
- package/dist/contract.mjs +2 -2
- package/dist/contract__factories.d.mts +1 -1
- package/dist/contract__index-type-validation.d.mts +1 -1
- package/dist/contract__types.d.mts +2 -2
- package/dist/contract__validators.d.mts +2 -2
- package/dist/contract__validators.mjs +2 -2
- package/dist/{control-D7OmKjH2.d.mts → control-CuiTzy6O.d.mts} +25 -16
- package/dist/control-CuiTzy6O.d.mts.map +1 -0
- package/dist/{control-adapter-C99J7aEF-BLc1Uog8.d.mts → control-adapter-C99J7aEF-QiVMjPGA.d.mts} +8 -8
- package/dist/{control-adapter-C99J7aEF-BLc1Uog8.d.mts.map → control-adapter-C99J7aEF-QiVMjPGA.d.mts.map} +1 -1
- package/dist/control-adapter-DjoDaUzQ.d.mts +1 -0
- package/dist/{control-DCVNWLzt.mjs → control-dqbsNN69.mjs} +45 -7
- package/dist/control-dqbsNN69.mjs.map +1 -0
- package/dist/{db-BhQdL6Za-817R9elv.d.mts → db-BhQdL6Za-CnAcF6Zh.d.mts} +8 -8
- package/dist/{db-BhQdL6Za-817R9elv.d.mts.map → db-BhQdL6Za-CnAcF6Zh.d.mts.map} +1 -1
- package/dist/{ddl-types-CA-aj1rO-B_BdxyXC.d.mts → ddl-types-CA-aj1rO-_giNpXNM.d.mts} +3 -3
- package/dist/{ddl-types-CA-aj1rO-B_BdxyXC.d.mts.map → ddl-types-CA-aj1rO-_giNpXNM.d.mts.map} +1 -1
- package/dist/{derived-checks-DGjY5t7S-CzJmkeZR.mjs → derived-checks-DGjY5t7S-DofD5V_2.mjs} +2 -2
- package/dist/{derived-checks-DGjY5t7S-CzJmkeZR.mjs.map → derived-checks-DGjY5t7S-DofD5V_2.mjs.map} +1 -1
- package/dist/{derived-checks-DPdD01O0-DNBs1ZDA.d.mts → derived-checks-DPdD01O0-DCKdvxNK.d.mts} +2 -2
- package/dist/{derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map → derived-checks-DPdD01O0-DCKdvxNK.d.mts.map} +1 -1
- package/dist/{diff-DkowDnsu.d.mts → diff-BB4zE5J1.d.mts} +8 -8
- package/dist/{diff-DkowDnsu.d.mts.map → diff-BB4zE5J1.d.mts.map} +1 -1
- package/dist/{expression-BtebKpK2.d.mts → expression-C7JqFgwS.d.mts} +6 -6
- package/dist/{expression-BtebKpK2.d.mts.map → expression-C7JqFgwS.d.mts.map} +1 -1
- package/dist/{factories-P3qBQhO-.d.mts → factories-B9PfKd5k.d.mts} +2 -2
- package/dist/{factories-P3qBQhO-.d.mts.map → factories-B9PfKd5k.d.mts.map} +1 -1
- package/dist/family.d.mts +12 -11
- package/dist/family.mjs +4 -3
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +5 -4
- package/dist/family__control.mjs +3 -2
- package/dist/family__diff.d.mts +2 -2
- 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.d.mts.map +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-infer.d.mts +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/{index-CLAshwKN.d.mts → index-C6_--MKi.d.mts} +3 -3
- package/dist/{index-CLAshwKN.d.mts.map → index-C6_--MKi.d.mts.map} +1 -1
- package/dist/{index-BR7KsOHN.d.mts → index-DfRCPDMK.d.mts} +10 -10
- package/dist/{index-BR7KsOHN.d.mts.map → index-DfRCPDMK.d.mts.map} +1 -1
- package/dist/{index-type-validation-CZ5L2lli.d.mts → index-type-validation-BFiTwZub.d.mts} +2 -2
- package/dist/{index-type-validation-CZ5L2lli.d.mts.map → index-type-validation-BFiTwZub.d.mts.map} +1 -1
- package/dist/{interpreter-9qyRPSGy-ufALmXNY.mjs → interpreter-CRJpMQRR-BjjPK_dV.mjs} +68 -17
- package/dist/interpreter-CRJpMQRR-BjjPK_dV.mjs.map +1 -0
- package/dist/{ir-R9GE8gsm.d.mts → ir-BLgW_h-1.d.mts} +2 -2
- package/dist/{ir-R9GE8gsm.d.mts.map → ir-BLgW_h-1.d.mts.map} +1 -1
- package/dist/middleware-Bef0uiio.d.mts +1 -0
- package/dist/{middleware-CAQqWuBd-pOZt5VBK.d.mts → middleware-CAQqWuBd-D-9cpkrQ.d.mts} +2 -2
- package/dist/{middleware-CAQqWuBd-pOZt5VBK.d.mts.map → middleware-CAQqWuBd-D-9cpkrQ.d.mts.map} +1 -1
- package/dist/{migration-CYCOGLPS.d.mts → migration-ClbaU5Om.d.mts} +3 -3
- package/dist/{migration-CYCOGLPS.d.mts.map → migration-ClbaU5Om.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +13 -13
- package/dist/plan-BcpzUEU8.d.mts +2 -0
- package/dist/{plan-oIjoMLQN-Cgljp0gc.d.mts → plan-oIjoMLQN-VIXmqAKW.d.mts} +3 -3
- package/dist/{plan-oIjoMLQN-Cgljp0gc.d.mts.map → plan-oIjoMLQN-VIXmqAKW.d.mts.map} +1 -1
- package/dist/{prepared-statement-DZtymlzd-De0k07Cc.d.mts → prepared-statement-DZtymlzd-D_INawdF.d.mts} +15 -15
- package/dist/{prepared-statement-DZtymlzd-De0k07Cc.d.mts.map → prepared-statement-DZtymlzd-D_INawdF.d.mts.map} +1 -1
- package/dist/{psl-infer-tLt9U1UP.d.mts → psl-infer-CLZsT2Hz.d.mts} +3 -3
- package/dist/{psl-infer-tLt9U1UP.d.mts.map → psl-infer-CLZsT2Hz.d.mts.map} +1 -1
- package/dist/query-lane-context-C708TwHD.d.mts +1 -0
- package/dist/{query-lane-context-cqWxvUWZ-DU48PEoC.d.mts → query-lane-context-cqWxvUWZ-Cl8U5ljU.d.mts} +4 -4
- package/dist/{query-lane-context-cqWxvUWZ-DU48PEoC.d.mts.map → query-lane-context-cqWxvUWZ-Cl8U5ljU.d.mts.map} +1 -1
- package/dist/relational-core.d.mts +11 -11
- 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__contract-free.d.mts +3 -3
- package/dist/relational-core__expression.d.mts +1 -1
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__plan.d.mts +3 -3
- package/dist/relational-core__query-lane-context.d.mts +2 -2
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/{runtime-CFokmlux.d.mts → runtime-C-gasTpn.d.mts} +3 -3
- package/dist/{runtime-CFokmlux.d.mts.map → runtime-C-gasTpn.d.mts.map} +1 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-CLds_Z0t.d.mts → schema-differ-DpG_gnur-DrAcUO68.d.mts} +5 -5
- package/dist/{schema-differ-DpG_gnur-CLds_Z0t.d.mts.map → schema-differ-DpG_gnur-DrAcUO68.d.mts.map} +1 -1
- package/dist/schema-ir.d.mts +1 -1
- package/dist/schema-ir.mjs +1 -1
- package/dist/schema-ir__types.d.mts +2 -2
- package/dist/schema-ir__types.mjs +1 -1
- package/dist/{sql-attribute-specs-DWUP6JTq-5-fgijvM.mjs → sql-attribute-specs-CHSP1wKs-D5T2TZQ8.mjs} +14 -7
- package/dist/sql-attribute-specs-CHSP1wKs-D5T2TZQ8.mjs.map +1 -0
- package/dist/{sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs → sql-contract-serializer-Bxu4a5oQ-CNy5ONMn.mjs} +2 -2
- package/dist/{sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs.map → sql-contract-serializer-Bxu4a5oQ-CNy5ONMn.mjs.map} +1 -1
- package/dist/{sql-execution-plan-2C68q5Jo-5sJRnbj0.d.mts → sql-execution-plan-2C68q5Jo-BCQaqOt4.d.mts} +2 -2
- package/dist/{sql-execution-plan-2C68q5Jo-5sJRnbj0.d.mts.map → sql-execution-plan-2C68q5Jo-BCQaqOt4.d.mts.map} +1 -1
- package/dist/{types-BDUG29Df-LE85dIXP.d.mts → types-BDUG29Df-DRoC4zw1.d.mts} +2 -2
- package/dist/{types-BDUG29Df-LE85dIXP.d.mts.map → types-BDUG29Df-DRoC4zw1.d.mts.map} +1 -1
- package/dist/{types-BFPRCYGW-BmBCa10J.d.mts → types-BFPRCYGW-Cmlh0DI_.d.mts} +8 -8
- package/dist/{types-BFPRCYGW-BmBCa10J.d.mts.map → types-BFPRCYGW-Cmlh0DI_.d.mts.map} +1 -1
- package/dist/{types-C36_3E6_.d.mts → types-BmgtemBx.d.mts} +2 -2
- package/dist/{types-C36_3E6_.d.mts.map → types-BmgtemBx.d.mts.map} +1 -1
- package/dist/{types-C6k9x_Je-DkvHNHEX.d.mts → types-CHOgKgHg-DMlDrQz6.d.mts} +15 -3
- package/dist/types-CHOgKgHg-DMlDrQz6.d.mts.map +1 -0
- package/dist/types-D3XRY_cO.d.mts +1 -0
- package/dist/{types-DhYcyD0K-Brj7SwFA.d.mts → types-DhYcyD0K-DImmT7YD.d.mts} +2 -2
- package/dist/{types-DhYcyD0K-Brj7SwFA.d.mts.map → types-DhYcyD0K-DImmT7YD.d.mts.map} +1 -1
- package/dist/{types-CZn-8Rsg-Bv6arhpI.mjs → types-DvrIPGUN-wxavfzyJ.mjs} +5 -2
- package/dist/types-DvrIPGUN-wxavfzyJ.mjs.map +1 -0
- package/dist/types-ZDEZdGgX.d.mts +1 -0
- package/dist/{types-thCvr3t--BKg5flQM.d.mts → types-thCvr3t--B9fvzq0z.d.mts} +8 -8
- package/dist/{types-thCvr3t--BKg5flQM.d.mts.map → types-thCvr3t--B9fvzq0z.d.mts.map} +1 -1
- package/dist/{validators-CbqMxQfW.d.mts → validators-DvtOcB04.d.mts} +11 -3
- package/dist/validators-DvtOcB04.d.mts.map +1 -0
- package/dist/{validators-DD98VrpC.mjs → validators-y6eLjhcb.mjs} +0 -0
- package/dist/validators-y6eLjhcb.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/contract-builder-Bwe2diF2.d.mts.map +0 -1
- package/dist/contract-builder-D1f6k8r4.mjs.map +0 -1
- package/dist/control-D7OmKjH2.d.mts.map +0 -1
- package/dist/control-DCVNWLzt.mjs.map +0 -1
- package/dist/control-adapter-DfLKiViv.d.mts +0 -1
- package/dist/interpreter-9qyRPSGy-ufALmXNY.mjs.map +0 -1
- package/dist/middleware-ERea8Bpj.d.mts +0 -1
- package/dist/plan-DT6ur9_C.d.mts +0 -2
- package/dist/query-lane-context-Dra2wgIo.d.mts +0 -1
- package/dist/sql-attribute-specs-DWUP6JTq-5-fgijvM.mjs.map +0 -1
- package/dist/types-9RtQn3mX.d.mts +0 -1
- package/dist/types-C6k9x_Je-DkvHNHEX.d.mts.map +0 -1
- package/dist/types-CZn-8Rsg-Bv6arhpI.mjs.map +0 -1
- package/dist/types-DL0mGtxm.d.mts +0 -1
- package/dist/validators-CbqMxQfW.d.mts.map +0 -1
- package/dist/validators-DD98VrpC.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql-attribute-specs-DWUP6JTq-5-fgijvM.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-DWUP6JTq.mjs"],"sourcesContent":["import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, numLiteral, oneOf, optional, record, referencedFieldRef, str } from \"@internal/psl-parser\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/sql-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction validateMappedName(value, ctx, attributeNode) {\n\treturn value.name === \"\" ? [leafDiagnostic(ctx, attributeNode, \"Mapped name must not be empty\")] : [];\n}\nconst mapModelSpec = modelAttribute(\"map\", {\n\tdocumentation: \"Maps this model to a database table name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The nonempty database table name.\"\n\t}],\n\trefine: validateMappedName\n});\nconst mapFieldSpec = fieldAttribute(\"map\", {\n\tdocumentation: \"Maps this field to a database column name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The nonempty database column name.\"\n\t}],\n\trefine: validateMappedName\n});\nfunction scalarDefaultArms(isList, registry) {\n\tconst literal = () => oneOf(str(), numLiteral(), bool());\n\tconst funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));\n\treturn isList ? [list(literal()), ...funcArms] : [\n\t\tstr(),\n\t\tnumLiteral(),\n\t\tbool(),\n\t\t...funcArms\n\t];\n}\nfunction noEnumMember() {\n\treturn {\n\t\tkind: \"rejecting\",\n\t\tlabel: \"enum member\",\n\t\tmessage: \"Enum declares no members\",\n\t\tparse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, \"Enum declares no members\")])\n\t};\n}\nfunction enumMemberNames(ctx) {\n\tconst block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];\n\tif (block === void 0 || block.keyword !== \"enum\") return void 0;\n\treturn Object.keys(block.block.parameters);\n}\nfunction enumDefaultArms(members, enumName) {\n\tconst [first, ...rest] = members;\n\tif (first === void 0) return [noEnumMember()];\n\tconst member = (name) => identifier(name, { documentation: `The \\`${name}\\` member of enum \\`${enumName}\\`.` });\n\treturn [member(first), ...rest.map(member)];\n}\nfunction defaultFieldSpec(ctx) {\n\tconst members = enumMemberNames(ctx);\n\treturn fieldAttribute(\"default\", {\n\t\tdocumentation: \"Supplies a default value when this field is omitted from a mutation.\",\n\t\tpositional: [{\n\t\t\tkey: \"value\",\n\t\t\ttype: oneOf(...members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members, ctx.field.typeName)),\n\t\t\tdocumentation: \"A literal, enum member, or registered default function compatible with this field.\"\n\t\t}]\n\t});\n}\nconst idFieldSpec = fieldAttribute(\"id\", {\n\tdocumentation: \"Makes this field the primary key of the table.\",\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database primary-key constraint name.\"\n\t} }\n});\nconst uniqueFieldSpec = fieldAttribute(\"unique\", {\n\tdocumentation: \"Requires values in this field to be unique.\",\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database unique-constraint name.\"\n\t} }\n});\nconst noCheckKindArgument = () => oneOf(identifier(\"membership\", { documentation: \"Waives the generated check that values belong to the declared domain enum.\" }), identifier(\"elementNotNull\", { documentation: \"Waives the generated check that scalar-list elements are non-null.\" }));\n/**\n* `@noCheck` waives generated CHECK constraints on one column: bare for every\n* kind the column's shape derives, or naming concrete kinds. Two optional\n* positional slots cover the whole kind vocabulary; a third argument is\n* necessarily a duplicate and fails as excess arity.\n*/\nconst noCheckFieldSpec = fieldAttribute(\"noCheck\", {\n\tdocumentation: \"Waives generated CHECK constraints for this column. With no arguments, waives every generated kind.\",\n\tpositional: [{\n\t\tkey: \"first\",\n\t\ttype: optional(noCheckKindArgument()),\n\t\tdocumentation: \"The first generated check kind to waive: `membership` or `elementNotNull`.\"\n\t}, {\n\t\tkey: \"second\",\n\t\ttype: optional(noCheckKindArgument()),\n\t\tdocumentation: \"A second, distinct generated check kind to waive.\"\n\t}],\n\trefine: (value, ctx, attributeNode) => {\n\t\tif (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, \"`@noCheck` names the same kind twice\")];\n\t\treturn [];\n\t}\n});\nconst idModelSpec = modelAttribute(\"id\", {\n\tdocumentation: \"Declares a compound primary key for this table.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}),\n\t\tdocumentation: \"The ordered, nonempty list of distinct primary-key fields.\"\n\t}],\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database primary-key constraint name.\"\n\t} }\n});\nconst uniqueModelSpec = modelAttribute(\"unique\", {\n\tdocumentation: \"Requires the combination of these fields to be unique.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}),\n\t\tdocumentation: \"The ordered, nonempty list of distinct fields in the unique constraint.\"\n\t}],\n\tnamed: { map: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The database unique-constraint name.\"\n\t} }\n});\nconst PSL_INDEX_FIELDS_XOR_EXPRESSION = \"PSL_INDEX_FIELDS_XOR_EXPRESSION\";\nconst PSL_INDEX_EXPRESSION_REQUIRES_NAME = \"PSL_INDEX_EXPRESSION_REQUIRES_NAME\";\nconst PSL_INDEX_NAME_XOR_MAP = \"PSL_INDEX_NAME_XOR_MAP\";\nconst indexModelSpec = modelAttribute(\"index\", {\n\tdocumentation: \"Declares a database index over fields or a SQL expression, optionally restricted by a predicate.\",\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\tdocumentation: \"The ordered list of distinct indexed fields. Mutually exclusive with `expression`.\"\n\t}],\n\tnamed: {\n\t\texpression: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The SQL index expression. Requires `name` or `map` and cannot be combined with a fields list.\"\n\t\t},\n\t\twhere: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The SQL predicate restricting rows included in a partial index.\"\n\t\t},\n\t\tunique: {\n\t\t\ttype: optional(bool()),\n\t\t\tdocumentation: \"Whether the index enforces uniqueness.\"\n\t\t},\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The index name. Mutually exclusive with `map`.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database index name. Mutually exclusive with `name`.\"\n\t\t},\n\t\ttype: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The target-specific index access method.\"\n\t\t},\n\t\toptions: {\n\t\t\ttype: optional(record(str())),\n\t\t\tdocumentation: \"Target-specific index options. Requires an explicit `type`.\"\n\t\t}\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` requires exactly one of a fields list or an `expression` argument\", PSL_INDEX_FIELDS_XOR_EXPRESSION));\n\t\tif (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)\", PSL_INDEX_EXPRESSION_REQUIRES_NAME));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` takes at most one of `name` and `map`\", PSL_INDEX_NAME_XOR_MAP));\n\t\tif (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` options argument requires a type argument\"));\n\t\treturn diagnostics;\n\t}\n});\nconst PSL_CHECK_REQUIRES_NAME_OR_MAP = \"PSL_CHECK_REQUIRES_NAME_OR_MAP\";\nconst PSL_CHECK_NAME_XOR_MAP = \"PSL_CHECK_NAME_XOR_MAP\";\nconst PSL_CHECK_EXPRESSION_EMPTY = \"PSL_CHECK_EXPRESSION_EMPTY\";\n/**\n* A single-table-inheritance variant (`@@base` with no own `@@map`) shares\n* its base model's storage table and has no table of its own to declare a\n* check on — raised from {@link interpretPslDocumentToSqlContract}, not from\n* this spec's own `refine`, because the rule needs the model's `@@base`\n* declaration, which a single attribute's `refine` cannot see.\n*/\nconst PSL_CHECK_ON_STI_VARIANT = \"PSL_CHECK_ON_STI_VARIANT\";\nconst checkModelSpec = modelAttribute(\"check\", {\n\tdocumentation: \"Declares a named database CHECK constraint on this table.\",\n\tnamed: {\n\t\texpression: {\n\t\t\ttype: str(),\n\t\t\tdocumentation: \"The nonempty SQL predicate checked for each row.\"\n\t\t},\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The constraint name. Exactly one of `name` and `map` is required.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database constraint name. Exactly one of `name` and `map` is required.\"\n\t\t}\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` expression must not be empty — an empty predicate is not a constraint\", PSL_CHECK_EXPRESSION_EMPTY));\n\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)\", PSL_CHECK_REQUIRES_NAME_OR_MAP));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` takes at most one of `name` and `map`\", PSL_CHECK_NAME_XOR_MAP));\n\t\treturn diagnostics;\n\t}\n});\nconst controlModelSpec = modelAttribute(\"control\", {\n\tdocumentation: \"Sets how schema management treats this model’s storage.\",\n\tpositional: [{\n\t\tkey: \"policy\",\n\t\tdocumentation: \"The storage control policy: `managed`, `tolerated`, `external`, or `observed`.\",\n\t\ttype: oneOf(identifier(\"managed\", { documentation: \"Verifies the declared shape strictly and allows migrations to create, alter, or drop the storage object.\" }), identifier(\"tolerated\", { documentation: \"Verifies declared columns while allowing extra columns. Migrations may create missing storage, but never alter or drop existing storage.\" }), identifier(\"external\", { documentation: \"Verifies declared storage without creating, altering, or dropping it.\" }), identifier(\"observed\", { documentation: \"Reports storage differences as warnings rather than verification failures and never emits migration operations.\" }))\n\t}]\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", {\n\tdocumentation: \"Selects the field that identifies inheritance variants of this model.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The discriminator field on this model.\"\n\t}]\n});\nconst baseModelSpec = modelAttribute(\"base\", {\n\tdocumentation: \"Declares this model as a variant of a base model.\",\n\tpositional: [{\n\t\tkey: \"base\",\n\t\ttype: entityRef(),\n\t\tdocumentation: \"The base model to inherit from.\"\n\t}, {\n\t\tkey: \"value\",\n\t\ttype: str(),\n\t\tdocumentation: \"The discriminator value identifying this variant.\"\n\t}]\n});\nfunction relationAttributeSpan(ctx) {\n\tconst node = findFieldAttributeNode(ctx.field, \"relation\");\n\tif (node !== void 0) return nodePslSpan(node.syntax, ctx.sourceFile);\n\treturn ctx.field.span;\n}\nfunction relationInvariants(parsed, ctx) {\n\tif (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_SYNTAX\",\n\t\tmessage: `Relation field \"${ctx.selfModel.name}.${ctx.field.name}\" requires fields and references arguments`,\n\t\tsourceId: ctx.sourceId,\n\t\tspan: relationAttributeSpan(ctx)\n\t}];\n\treturn [];\n}\nconst referentialActionArgument = () => oneOf(identifier(\"NoAction\", { documentation: \"Rejects a change that would violate the foreign key when the constraint is checked; checking may be deferred when supported and configured.\" }), identifier(\"Restrict\", { documentation: \"Rejects deleting or updating a referenced row while referencing rows remain, without deferring the check.\" }), identifier(\"Cascade\", { documentation: \"Propagates deletion or key updates of a referenced row to its referencing rows.\" }), identifier(\"SetNull\", { documentation: \"Sets referencing foreign-key fields to null when the referenced row is deleted or its key changes. The fields must allow null.\" }), identifier(\"SetDefault\", { documentation: \"Sets referencing foreign-key fields to their defaults when the referenced row is deleted or its key changes. The resulting values must satisfy the foreign key.\" }));\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tdocumentation: \"Defines the relation name, foreign-key fields, and referential actions for this relation.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The relation name used to pair both sides. May also be supplied by name.\"\n\t}],\n\tnamed: {\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The relation name used to pair both sides. Cannot also be supplied positionally.\"\n\t\t},\n\t\tfields: {\n\t\t\ttype: optional(list(fieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The ordered local foreign-key fields. Must be supplied together with `references`.\"\n\t\t},\n\t\treferences: {\n\t\t\ttype: optional(list(referencedFieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The corresponding fields on the referenced model. Must be supplied together with `fields`.\"\n\t\t},\n\t\tmap: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The database foreign-key constraint name.\"\n\t\t},\n\t\tonDelete: {\n\t\t\ttype: optional(referentialActionArgument()),\n\t\t\tdocumentation: \"The referential action when a referenced row is deleted.\"\n\t\t},\n\t\tonUpdate: {\n\t\t\ttype: optional(referentialActionArgument()),\n\t\t\tdocumentation: \"The referential action when a referenced key is updated.\"\n\t\t},\n\t\tindex: {\n\t\t\ttype: optional(bool()),\n\t\t\tdocumentation: \"Whether to create an index for the relation’s foreign-key fields.\"\n\t\t}\n\t},\n\trefine: relationInvariants\n});\nfunction fieldSpecContext(input) {\n\treturn {\n\t\tsymbols: input.symbols,\n\t\tmodel: input.model,\n\t\tfield: input.field,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t};\n}\nconst sqlAttributeSpecs = {\n\tmodel: {\n\t\tmap: () => mapModelSpec,\n\t\tid: () => idModelSpec,\n\t\tunique: () => uniqueModelSpec,\n\t\tindex: () => indexModelSpec,\n\t\tcheck: () => checkModelSpec,\n\t\tcontrol: () => controlModelSpec,\n\t\tdiscriminator: () => discriminatorModelSpec,\n\t\tbase: () => baseModelSpec\n\t},\n\tfield: {\n\t\tmap: () => mapFieldSpec,\n\t\tid: () => idFieldSpec,\n\t\tunique: () => uniqueFieldSpec,\n\t\tnoCheck: () => noCheckFieldSpec,\n\t\trelation: () => relationFieldSpec,\n\t\tdefault: defaultFieldSpec\n\t}\n};\n//#endregion\nexport { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };\n\n//# sourceMappingURL=sql-attribute-specs-DWUP6JTq.mjs.map"],"mappings":";;;;AAIA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;CAClB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,wBAAwB,MAAM,iCAAiC,KAAK;EACpE,OAAO,MAAM;CACd;AACD;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,SAAS,mBAAmB,MAAM,MAAM,MAAM,MAAM,uBAAuB;EAChF,WAAW,MAAM;EACjB,YAAY,MAAM;EAClB,UAAU,MAAM;CACjB,CAAC,CAAC;CACF,IAAI,CAAC,OAAO,IAAI;EACf,KAAK,MAAM,WAAW,OAAO,SAAS,MAAM,YAAY,KAAK,OAAO;EACpE;CACD;CACA,OAAO,OAAO;AACf;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,SAAS,mBAAmB,MAAM,MAAM,MAAM,MAAM,uBAAuB;EAChF,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,UAAU,MAAM;EAChB,wBAAwB,MAAM;CAC/B,CAAC,CAAC;CACF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Q;;;;;;;;EAQ1C,UAAU,OAAO;;;;;;;;;;;;;;;;;;;;;;EAsBjB,cAAc,OAAO,YAAY;aACtB;aACA;;;;;UAKH;WACC;WACA;WACA,cAAc;;;;;;WAMd,qBAAqB;;;;;;;;;;;;;cAalB,oBAAoB,2BAA2B;WAClD;WACA;WACA;WACA,cAAc;;WAEd,qBAAqB;EAC9B,YAAY,OAAO;MACf;EACJ,qBAAqB;SACd,GAAG,MAAM,kBAAkB,QAAQ;EAC1C,UAAU,OAAO;;;;UAIT;WACC;WACA,SAAS,eAAe,cAAc;WACtC,aAAa,cAAc,kBAAkB;WAC7C,SAAS,cAAc,cAAc;WACrC,SAAS,cAAc,aAAa;WACpC,aAAa,aAAa;WAC1B,cAAc;;WAEd,SAAS,cAAc,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;cAuB3C,mBAAmB,2BAA2B;WACjD;WACA;WACA,SAAS,SAAS,eAAe;WACjC,aAAa,cAAc;WAC3B,SAAS,cAAc;WACvB,SAAS,cAAc;WACvB,aAAa;WACb,cAAc;WACd,SAAS,cAAc;EAChC,YAAY,OAAO;MACf;EACJ,UAAU,OAAO;EACjB,qBAAqB;;;;UAIb;WACC,QAAQ,eAAe,aAAa;WACpC,cAAc;;;;;;;;;;;;;;;;;cAiBX,oBAAoB,2BAA2B;WAClD;WACA,QAAQ,SAAS,eAAe;WAChC,cAAc;EACvB,YAAY,OAAO;MACf;EACJ,UAAU,OAAO;EACjB,qBAAqB;;;;;;;;;UASb;;WAEC;;WAEA;;;;;WAKA;;;;;;UAMD;EACR,UAAU,iBAAiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-CZn-8Rsg-Bv6arhpI.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/types-CZn-8Rsg.mjs"],"sourcesContent":["import { f as normalizeIndexOptionValue, l as nameOf } from \"./naming-DKr4TJd7.mjs\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\n//#region src/ir/schema-node-kinds.ts\n/**\n* The `nodeKind` discriminant for each relational schema-diff leaf node.\n* Each node carries a unique value; the differ pairs siblings by `id`, and\n* these kinds distinguish the node types that appear as `PostgresTableSchemaNode`\n* children (columns, primary key, foreign keys, uniques, indexes, checks) from\n* each other and from the RLS policy/role kinds a target defines separately.\n*/\nconst RelationalSchemaNodeKind = {\n\tschema: \"sql-schema\",\n\ttable: \"sql-table\",\n\tcolumn: \"sql-column\",\n\tcolumnDefault: \"sql-column-default\",\n\tprimaryKey: \"sql-primary-key\",\n\tforeignKey: \"sql-foreign-key\",\n\tunique: \"sql-unique\",\n\tindex: \"sql-index\",\n\tcheck: \"sql-check-constraint\"\n};\n/**\n* The one real map from a relational `nodeKind` to the framework-neutral\n* {@link DiffSubjectGranularity} its diff issues carry — the SQL family's\n* post-diff filters (issue category, strict-mode gating) and the framework\n* aggregate's unclaimed-elements sweep key on the granularity, never on the\n* `nodeKind` spelling and never on anything stamped on the node. Resolution\n* is by `nodeKind` equality against this map, not a suffix string match.\n* Target-specific node kinds (Postgres namespace/table/policy/role) are\n* outside this family layer's vocabulary and map their own kinds directly.\n*/\nconst RELATIONAL_NODE_GRANULARITY = {\n\t[RelationalSchemaNodeKind.schema]: \"structural\",\n\t[RelationalSchemaNodeKind.table]: \"entity\",\n\t[RelationalSchemaNodeKind.column]: \"field\",\n\t[RelationalSchemaNodeKind.columnDefault]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.primaryKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.foreignKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.unique]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.index]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.check]: \"auxiliary\"\n};\nfunction isRelationalSchemaNodeKind(nodeKind) {\n\treturn Object.hasOwn(RELATIONAL_NODE_GRANULARITY, nodeKind);\n}\n/**\n* Looks up the subject granularity for a relational `nodeKind`. Throws for a\n* `nodeKind` outside this map (a target-specific kind, e.g. Postgres's\n* namespace/table/policy/role) — those map their own kinds directly rather\n* than through this family-level map.\n*/\nfunction relationalNodeGranularity(nodeKind) {\n\tif (!isRelationalSchemaNodeKind(nodeKind)) throw new InternalError(`relationalNodeGranularity: unrecognized relational node kind \"${nodeKind}\"`);\n\treturn RELATIONAL_NODE_GRANULARITY[nodeKind];\n}\n/**\n* The one real map from a relational `nodeKind` to its storage `entityKind`\n* — the same vocabulary the contract storage's `entries` dictionary keys use\n* (`elementCoordinates` walks it). Only the whole-table kind has an entity of\n* its own; every other relational node (a column, an index, …) is nested\n* under one and maps to nothing here.\n*/\nconst RELATIONAL_NODE_ENTITY_KIND = { [RelationalSchemaNodeKind.table]: \"table\" };\n/**\n* Looks up the storage `entityKind` for a relational `nodeKind` — sibling of\n* {@link relationalNodeGranularity}, resolved by `nodeKind` equality against\n* {@link RELATIONAL_NODE_ENTITY_KIND}. `undefined` for a target-specific kind\n* (targets map their own kinds directly) or a relational kind with no entity\n* of its own.\n*/\nfunction relationalNodeEntityKind(nodeKind) {\n\treturn isRelationalSchemaNodeKind(nodeKind) ? RELATIONAL_NODE_ENTITY_KIND[nodeKind] : void 0;\n}\n//#endregion\n//#region src/ir/sql-schema-ir-node.ts\n/**\n* SQL Schema IR node base. Carries the family-level\n* `kind = 'sql-schema-ir'` discriminator and inherits the framework's\n* `freezeNode` affordance.\n*\n* SQL Schema IR represents the actual database state as discovered by\n* introspection (the parallel to SQL Contract IR, which represents the\n* desired state).\n*\n* The discriminator is installed as a non-enumerable own property,\n* matching the SqlNode pattern. This keeps `JSON.stringify(node)`\n* canonical (no `kind` field), keeps `toEqual({...})` test assertions\n* against pre-lift flat shapes passing, and keeps `node.kind` readable\n* for dispatch.\n*\n* Both `kind` and `nodeKind` are required: every concrete leaf is a node\n* the generic differ can pair and compare, so every leaf must declare which\n* node it is. `nodeKind` has no default here — every direct subclass sets its\n* own literal value (the relational leaves via `RelationalSchemaNodeKind`,\n* target concretions via their own vocabulary, e.g. `PostgresSchemaNodeKind`).\n*/\nvar SqlSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n};\n/**\n* Asserts `node` matches `predicate`, narrowing its type to `T`. The one\n* shared implementation every node class's `static assert` and `isEqualTo`\n* reach for, instead of each hand-writing its own throw: the message names\n* the class the caller expected.\n*/\nfunction assertNode(node, className, predicate) {\n\tif (node === void 0 || !predicate(node)) throw new InternalError(`Expected a ${className} but got nodeKind=${node?.nodeKind ?? \"undefined\"}`);\n}\n/**\n* Defines a non-enumerable own property, the same treatment `kind` gets\n* above: a derivation-time render-support field stays out of\n* `JSON.stringify`, `toEqual({...})` structural assertions, and spreads,\n* while remaining directly readable (`node.field`) for the one consumer\n* that resolves it at plan time. A no-op when `value` is `undefined` — the\n* property is simply absent, matching every other optional field on these\n* nodes.\n*/\nfunction defineNonEnumerable(target, key, value) {\n\tif (value === void 0) return;\n\tObject.defineProperty(target, key, {\n\t\tvalue,\n\t\tenumerable: false,\n\t\twritable: false,\n\t\tconfigurable: false\n\t});\n}\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* Primary-key Schema IR node. Mirrors the Contract IR `PrimaryKey`\n* shape (same `columns` + optional `name`) so verification can compare\n* intent and actual structurally. Defined here independently to avoid\n* a sql-schema-ir -> sql-contract dependency.\n*\n* Implements `DiffableNode` so a primary key is directly a table's diff-tree\n* child. `id` is a fixed sentinel — a table has at most one primary key, so\n* there is never a sibling to disambiguate against. `isEqualTo` compares the\n* column tuple; the PK's own `name` is a database-assigned label with no\n* semantic weight, so it is not compared (mirrors the policy node's\n* name-insensitivity to non-identifying detail).\n*/\nvar PrimaryKey = class PrimaryKey extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.primaryKey;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"primary-key\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof PrimaryKey ? value : new PrimaryKey(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.primaryKey;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"PrimaryKey\", PrimaryKey.is);\n\t\treturn this.columns.length === node.columns.length && this.columns.every((c, i) => c === node.columns[i]);\n\t}\n};\n//#endregion\n//#region src/ir/sql-check-constraint-ir.ts\n/**\n* Schema IR node for a table-level check constraint, carried as an opaque\n* predicate. The expression is never parsed — a database reprints predicates\n* in its own normalized form, so any structured reading of it would drift.\n*\n* Implements `DiffableNode` so a check is directly a table's diff-tree child;\n* `id` is `check:<name>`. `isEqualTo` is mode-selected by the receiver's\n* `prefix` (the differ always calls `expected.isEqualTo(actual)`): a\n* wire-named receiver compares ids only — the wire name's hash already\n* commits to the predicate — while an exact-named receiver byte-compares the\n* expression, which is reliable precisely when both sides came from the same\n* reprint.\n*/\nvar SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.check;\n\tname;\n\texpression;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.expression = input.expression;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `check:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlCheckConstraintIR ? value : new SqlCheckConstraintIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.check;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlCheckConstraintIR\", SqlCheckConstraintIR.is);\n\t\tif (this.prefix !== void 0) return this.id === node.id;\n\t\treturn this.expression === node.expression;\n\t}\n};\n//#endregion\n//#region src/ir/resolved-default-equality.ts\n/**\n* Structural equality for two resolved column defaults, ported from the relational walk's\n* `columnDefaultsEqual` normalized branch: kinds must match; literal values are normalized (Date\n* and temporal-typed strings to ISO instants, with a timestamp that has no zone read as UTC; a\n* 64-bit-integer native type's safe-integer number to its decimal-text spelling; a numeric native\n* type's number to its decimal text, and when the type has a modifier, its decimal text to its\n* digits without zeros that do not change the value; a list element by element under its element\n* type) then compared canonically (JSON objects match their canonical string form); function\n* expressions compare case- and whitespace-insensitively.\n*\n* `nativeType` provides the normalization context (the actual side's resolved native type in a diff\n* comparison). A target that reads a raw expression as a literal does so before this comparison,\n* through its `resolveDefault` hook.\n*/\nfunction resolvedDefaultsEqual(expected, actual, nativeType) {\n\tif (expected.kind !== actual.kind) return false;\n\tif (expected.kind === \"literal\" && actual.kind === \"literal\") return literalValuesEqual(normalizeLiteralValue(expected.value, nativeType), normalizeLiteralValue(actual.value, nativeType));\n\tif (expected.kind === \"function\" && actual.kind === \"function\") return normalizeFunctionExpression(expected.expression) === normalizeFunctionExpression(actual.expression);\n\treturn false;\n}\nfunction normalizeFunctionExpression(expression) {\n\treturn expression.toLowerCase().replace(/\\s+/g, \"\");\n}\nfunction isTemporalNativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized.includes(\"timestamp\") || normalized === \"date\";\n}\nfunction isInt64NativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized === \"int8\" || normalized === \"bigint\";\n}\n/**\n* A numeric type with a modifier (`numeric(10,2)`) stores every value at its scale, so zeros that\n* do not change the value do not count. Without one, the value keeps the scale it was written with.\n*/\nconst DECIMAL_NATIVE_TYPE = /^(?:numeric|decimal)(\\(\\d+(?:,\\s*\\d+)?\\))?$/i;\nconst DECIMAL_NUMERAL = /^(-?)(\\d+)(?:\\.(\\d+))?$/;\nconst EXPONENT_NUMERAL = /^(-?)(\\d+)(?:\\.(\\d+))?[eE]([+-]?\\d+)$/;\n/**\n* The plain decimal spelling of a value, so that a number JavaScript prints as `1e-7` or `1e+21`\n* can be compared with the decimal text a numeric column stores. No digit is added or dropped;\n* only the decimal point moves.\n*/\nfunction decimalText(value) {\n\tconst text = String(value);\n\tconst numeral = EXPONENT_NUMERAL.exec(text);\n\tif (numeral === null) return text;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\", exponent = \"0\"] = numeral;\n\tconst digits = `${whole}${fraction}`;\n\tconst point = whole.length + Number(exponent);\n\tif (point <= 0) return `${sign}0.${\"0\".repeat(-point)}${digits}`;\n\tif (point >= digits.length) return `${sign}${digits}${\"0\".repeat(point - digits.length)}`;\n\treturn `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;\n}\nfunction decimalDigits(value) {\n\tconst numeral = DECIMAL_NUMERAL.exec(decimalText(value));\n\tif (numeral === null) return value;\n\tconst whole = (numeral[2] ?? \"\").replace(/^0+(?=\\d)/, \"\");\n\tconst fraction = (numeral[3] ?? \"\").replace(/0+$/, \"\");\n\tconst digits = fraction === \"\" ? whole : `${whole}.${fraction}`;\n\treturn digits === \"0\" ? digits : `${numeral[1] ?? \"\"}${digits}`;\n}\n/**\n* A timestamp as Postgres prints it, with or without an offset: `2024-01-01 00:00:00`,\n* `0001-01-01 00:00:00+00`, `2024-01-02 03:04:05+05:30`. It is rebuilt as an ISO string before\n* `Date` reads it, because `Date` reads this spelling without a zone as host-local time and reads a\n* year below 100 as 19xx or 20xx. A value without a zone is a wall-clock time, and the contract\n* spells the same wall time as an ISO instant, so it is read as UTC.\n*/\nconst POSTGRES_TIMESTAMP = /^(\\d{4}-\\d{2}-\\d{2})[ T](\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?)(?:([+-]\\d{2})(?::?(\\d{2}))?)?$/;\nfunction parseTemporal(value) {\n\tconst timestamp = POSTGRES_TIMESTAMP.exec(value);\n\tif (timestamp === null) return new Date(value);\n\tconst [, date, time, offsetHours, offsetMinutes = \"00\"] = timestamp;\n\tconst zone = offsetHours === void 0 ? \"Z\" : `${offsetHours}:${offsetMinutes}`;\n\treturn /* @__PURE__ */ new Date(`${date}T${time}${zone}`);\n}\nfunction normalizeLiteralValue(value, nativeType) {\n\tif (Array.isArray(value) && nativeType?.endsWith(\"[]\")) {\n\t\tconst elementType = nativeType.slice(0, -2);\n\t\treturn value.map((element) => normalizeLiteralValue(element, elementType));\n\t}\n\tif (value instanceof Date) return value.toISOString();\n\tif (typeof value === \"string\" && isTemporalNativeType(nativeType)) {\n\t\tconst parsed = parseTemporal(value);\n\t\tif (!Number.isNaN(parsed.getTime())) return parsed.toISOString();\n\t}\n\tif (typeof value === \"number\" && Number.isSafeInteger(value) && isInt64NativeType(nativeType)) return String(value);\n\tconst decimalType = nativeType === void 0 ? null : DECIMAL_NATIVE_TYPE.exec(nativeType);\n\tif ((typeof value === \"number\" || typeof value === \"string\") && decimalType !== null) return decimalType[1] === void 0 ? decimalText(value) : decimalDigits(value);\n\treturn value;\n}\nfunction literalValuesEqual(a, b) {\n\tif (a === b) return true;\n\tif (typeof a === \"object\" && a !== null && typeof b === \"object\" && b !== null) return canonicalStringify(a) === canonicalStringify(b);\n\tif (typeof a === \"object\" && a !== null && typeof b === \"string\") try {\n\t\treturn canonicalStringify(a) === canonicalStringify(JSON.parse(b));\n\t} catch {\n\t\treturn false;\n\t}\n\tif (typeof a === \"string\" && typeof b === \"object\" && b !== null) try {\n\t\treturn canonicalStringify(JSON.parse(a)) === canonicalStringify(b);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/ir/sql-column-default-ir.ts\n/**\n* Schema-diff node for a column's default value. The default is the one\n* column attribute with an extra/missing/drift lifecycle of its own, so it\n* is a child node of the column rather than a compared attribute: an\n* undeclared live default surfaces as `not-expected`, a declared default the\n* database lacks as `not-found`, and a divergent value as `not-equal` — the\n* three reasons cover the legacy `extra_default` / `default_missing` /\n* `default_mismatch` vocabulary with no attribute inspection.\n*\n* `id` is a fixed sentinel — a column has at most one default. Built\n* transiently by `SqlColumnIR.children()` from the column's own fields;\n* never constructed by derivation or introspection directly.\n*/\nvar SqlColumnDefaultIR = class SqlColumnDefaultIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.columnDefault;\n\tconstructor(input) {\n\t\tsuper();\n\t\tif (input.resolved !== void 0) this.resolved = input.resolved;\n\t\tif (input.raw !== void 0) this.raw = input.raw;\n\t\tif (input.nativeTypeContext !== void 0) this.nativeTypeContext = input.nativeTypeContext;\n\t\tdefineNonEnumerable(this, \"many\", input.many);\n\t\tdefineNonEnumerable(this, \"codecRef\", input.codecRef);\n\t\tdefineNonEnumerable(this, \"codecBaseNativeType\", input.codecBaseNativeType);\n\t\tdefineNonEnumerable(this, \"codecNamedType\", input.codecNamedType);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"default\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.columnDefault;\n\t}\n\t/**\n\t* Structured comparison with `this` as the expected side: both sides\n\t* resolved compare per the relational walk's `columnDefaultsEqual`\n\t* semantics; a declared expected default against an unparseable actual\n\t* (raw present, no resolved parse) is a mismatch; two raw-only nodes fall\n\t* back to raw string equality.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnDefaultIR\", SqlColumnDefaultIR.is);\n\t\tif (this.resolved !== void 0 && node.resolved !== void 0) return resolvedDefaultsEqual(this.resolved, node.resolved, node.nativeTypeContext ?? this.nativeTypeContext);\n\t\tif (this.resolved !== void 0 || node.resolved !== void 0) return false;\n\t\treturn this.raw === node.raw;\n\t}\n};\n//#endregion\n//#region src/ir/sql-column-ir.ts\n/**\n* Schema IR node for a single column on a table, as observed by\n* introspection. Unlike the Contract IR `StorageColumn`, this carries\n* the column's `name` (Schema IR columns are returned as arrays from\n* introspection queries; the parent table re-keys them into a record\n* for downstream consumers).\n*\n* Implements `DiffableNode` so a column is directly a table's diff-tree\n* child: `id` is the column name (unique among a table's columns); `isEqualTo`\n* compares this column's own attributes only — never children, since a\n* column is a leaf. When both sides carry `resolvedNativeType` (stamped at\n* derivation/introspection), the comparison uses the resolved values —\n* resolved native type, nullability, and structured default equality per\n* the relational walk's `columnDefaultsEqual` semantics, with `this` as the\n* expected side. Otherwise it falls back to comparing raw fields.\n*/\nvar SqlColumnIR = class SqlColumnIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.column;\n\tname;\n\tnativeType;\n\tnullable;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.nullable = input.nullable;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.many !== void 0) this.many = input.many;\n\t\tif (input.resolvedNativeType !== void 0) this.resolvedNativeType = input.resolvedNativeType;\n\t\tif (input.resolvedDefault !== void 0) this.resolvedDefault = input.resolvedDefault;\n\t\tdefineNonEnumerable(this, \"codecRef\", input.codecRef);\n\t\tdefineNonEnumerable(this, \"codecBaseNativeType\", input.codecBaseNativeType);\n\t\tdefineNonEnumerable(this, \"codecNamedType\", input.codecNamedType);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `column:${this.name}`;\n\t}\n\t/**\n\t* The column's default, when declared/present, is the column's one child\n\t* node — it has an extra/missing/drift lifecycle of its own, so the differ\n\t* recurses to it rather than `isEqualTo` comparing it. Built transiently\n\t* from this column's own fields.\n\t*/\n\tchildren() {\n\t\tif (this.resolvedDefault === void 0 && this.default === void 0) return [];\n\t\treturn [new SqlColumnDefaultIR({\n\t\t\t...ifDefined(\"resolved\", this.resolvedDefault),\n\t\t\t...ifDefined(\"raw\", this.default),\n\t\t\t...ifDefined(\"nativeTypeContext\", this.resolvedNativeType),\n\t\t\t...ifDefined(\"many\", this.many ?? this.codecRef?.many),\n\t\t\t...ifDefined(\"codecRef\", this.codecRef),\n\t\t\t...ifDefined(\"codecBaseNativeType\", this.codecBaseNativeType),\n\t\t\t...ifDefined(\"codecNamedType\", this.codecNamedType)\n\t\t})];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.column;\n\t}\n\t/**\n\t* Compares the column's own attributes only — the default lives on the\n\t* child node. When both sides carry `resolvedNativeType`, the resolved\n\t* value governs (array-ness rides on its `[]` suffix); otherwise raw\n\t* fields compare.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnIR\", SqlColumnIR.is);\n\t\tif (this.resolvedNativeType !== void 0 && node.resolvedNativeType !== void 0) return this.resolvedNativeType === node.resolvedNativeType && this.nullable === node.nullable;\n\t\treturn this.nativeType === node.nativeType && this.nullable === node.nullable && Boolean(this.many) === Boolean(node.many);\n\t}\n};\n//#endregion\n//#region src/ir/sql-foreign-key-ir.ts\n/**\n* Schema IR node for a foreign-key constraint as observed by\n* introspection. The `referencedTable` / `referencedColumns` field\n* names match the introspection vocabulary (`pg_constraint.confkey`,\n* etc.) and intentionally differ from the Contract IR's nested\n* `references: { table, columns }` shape so that the verifier's\n* structural comparison stays explicit about which side it's reading.\n*\n* Implements `DiffableNode` so a foreign key is directly a table's diff-tree\n* child. Foreign keys are frequently unnamed (introspection may not carry a\n* constraint name, and the contract side never invents one), so `id` is\n* derived from the referencing/referenced coordinates rather than `name` —\n* the same tuple that makes two FK constraints the same constraint. This\n* also serves as the comparison key: two FKs with the same coordinates are\n* paired by the differ, and `isEqualTo` then compares the remaining\n* attribute — the referential actions.\n*/\nvar SqlForeignKeyIR = class SqlForeignKeyIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.foreignKey;\n\tcolumns;\n\treferencedTable;\n\treferencedColumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tthis.referencedTable = input.referencedTable;\n\t\tthis.referencedColumns = input.referencedColumns;\n\t\tif (input.referencedSchema !== void 0) this.referencedSchema = input.referencedSchema;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tconst resolvedReferencedNamespace = input.resolvedReferencedNamespace ?? input.referencedSchema;\n\t\tif (resolvedReferencedNamespace !== void 0) this.resolvedReferencedNamespace = resolvedReferencedNamespace;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\tconst referencedNamespace = this.resolvedReferencedNamespace ?? \"\";\n\t\treturn `foreign-key:${this.columns.join(\",\")}->${referencedNamespace}.${this.referencedTable}(${this.referencedColumns.join(\",\")})`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.foreignKey;\n\t}\n\t/**\n\t* Referential-action comparison with `this` as the expected side, matching\n\t* the relational walk's `getReferentialActionMismatches`: `noAction` is the\n\t* database default and equivalent to an undeclared action, and drift is\n\t* flagged only when the expected side declares a (normalized) action.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlForeignKeyIR\", SqlForeignKeyIR.is);\n\t\treturn referentialActionMatches(this.onDelete, node.onDelete) && referentialActionMatches(this.onUpdate, node.onUpdate);\n\t}\n};\nfunction referentialActionMatches(expected, actual) {\n\tconst normalizedExpected = expected === \"noAction\" ? void 0 : expected;\n\tif (normalizedExpected === void 0) return true;\n\treturn normalizedExpected === (actual === \"noAction\" ? void 0 : actual);\n}\n//#endregion\n//#region src/ir/sql-index-ir.ts\n/**\n* Schema IR node for a secondary index as observed by introspection.\n* Unlike the Contract IR `Index`, the Schema IR carries an explicit\n* `unique` field — introspection sees the underlying index regardless\n* of whether the user expressed it as `@@index` or `@@unique`, and the\n* verifier needs to distinguish them when comparing to the Contract.\n*\n* Implements `DiffableNode` so an index is directly a table's diff-tree\n* child. Indexes are name-identified: every index — contract-derived or\n* introspected — carries its full physical name, and `id` is that name.\n* Names are catalog-unique per schema, so two indexes legitimately sharing\n* one column tuple (a unique index beside a redundant plain index) are two\n* distinct siblings, and expression indexes need no column tuple at all.\n*\n* `isEqualTo` is selected by the receiver (the differ always calls\n* `expected.isEqualTo(actual)`) and delegates to {@link contentEquals} —\n* the single node-owned content relation: both modes compare `unique`\n* strict, `type` and option values through the named normalization seams,\n* and `columns` ordered-strict when both sides carry them; an exact-named\n* receiver (`prefix === undefined`) additionally byte-compares\n* `expression`/`where` (both sides are reprints in the supported flow —\n* normalizing would only mask real drift); a wire-named receiver never\n* compares bodies (the wire-name hash already commits to them).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL that any SQL target may\n* introspect, so the family node must represent them; a target declining\n* to author them is a capability decision, not target-specificity.\n*/\nvar SqlIndexIR = class SqlIndexIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.index;\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new InternalError(`SqlIndexIR \"${name}\": exactly one of columns or expression must be set.`);\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tconst normalizedType = normalizeIndexType(input.type);\n\t\tif (normalizedType !== void 0) this.type = normalizedType;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tdefineNonEnumerable(this, \"partial\", input.partial);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `index:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlIndexIR ? value : new SqlIndexIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.index;\n\t}\n\t/**\n\t* Mode-selected structural equality — see the class doc. Delegates to the\n\t* single node-owned relation: `columns` compare ordered-strict when both\n\t* sides carry them; an exact receiver (`prefix === undefined`)\n\t* byte-compares `expression ?? ''` and `where ?? ''`; a wire-named receiver\n\t* never compares bodies (the wire-name hash already commits to them).\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlIndexIR\", SqlIndexIR.is);\n\t\treturn this.contentEquals(node, {\n\t\t\tcolumnPresence: \"when-both-defined\",\n\t\t\tbodies: this.prefix !== void 0 ? \"ignored\" : \"verbatim\"\n\t\t});\n\t}\n\t/**\n\t* The single index content-equality relation — every comparer (the differ\n\t* via {@link isEqualTo}, the planner's rename content-pairing) calls this\n\t* with its mode-appropriate strictness rather than growing a parallel\n\t* relation:\n\t*\n\t* - `columnPresence: 'when-both-defined'` (the differ's rule) compares\n\t* the tuples ordered-strict only when both sides carry them — a paired\n\t* node's identity already agreed, so a column node meeting an\n\t* expression node skips the tuple.\n\t* - `columnPresence: 'matching'` (the rename-pairing rule) additionally\n\t* requires presence to agree: a column index never pairs an expression\n\t* index.\n\t* - `bodies: 'verbatim'` byte-compares `expression ?? ''` / `where ?? ''`\n\t* (absent ≡ empty, no normalization — both sides are reprints in the\n\t* supported flow); `bodies: 'ignored'` skips them (wire identity —\n\t* the wire-name hash commits to the content).\n\t*\n\t* `unique` compares strictly; `type` and option VALUES compare through\n\t* the named normalization seams below.\n\t*/\n\tcontentEquals(other, strictness) {\n\t\tconst columnsEqual = strictness.columnPresence === \"matching\" ? this.columns === void 0 === (other.columns === void 0) && (this.columns === void 0 || isArrayEqual(this.columns, other.columns ?? [])) : this.columns === void 0 || other.columns === void 0 || isArrayEqual(this.columns, other.columns);\n\t\tif (!(this.unique === other.unique && normalizeIndexType(this.type) === normalizeIndexType(other.type) && indexOptionsEqual(this.options, other.options) && columnsEqual)) return false;\n\t\tif (strictness.bodies === \"ignored\") return true;\n\t\treturn (this.expression ?? \"\") === (other.expression ?? \"\") && (this.where ?? \"\") === (other.where ?? \"\");\n\t}\n};\n/**\n* The btree-default normalization seam: the default access method (`btree`\n* in every supported SQL target) normalizes to absent. Applied at\n* construction — every derivation path (contract tree, introspection, flat\n* family tree) builds through the class, so both compare sides are\n* symmetric by definition — and again inside\n* {@link SqlIndexIR.contentEquals} so the relation holds for any input.\n* The contract JSON and the wire-name content hash keep the authored\n* spelling: `@@index([a], type: \"btree\")` and `@@index([a])` are distinct\n* wire names — but content-equal after normalization, so a spelling change\n* between them converges as a rename via the planner's content\n* pairing (the hashes differ, so hash pairing never pairs them).\n*/\nfunction normalizeIndexType(type) {\n\treturn type === \"btree\" ? void 0 : type;\n}\n/**\n* Option-bag equality: same key set, values compared through\n* {@link normalizeIndexOptionValue} — Postgres introspection returns\n* reloptions values as catalog-reprint strings (`'70'`, `'on'`) while\n* contract option leaves are typed (number, boolean, string).\n*/\nfunction indexOptionsEqual(a, b) {\n\tconst aKeys = a ? Object.keys(a).sort() : [];\n\tconst bKeys = b ? Object.keys(b).sort() : [];\n\tif (aKeys.length !== bKeys.length) return false;\n\tfor (let i = 0; i < aKeys.length; i += 1) if (aKeys[i] !== bKeys[i]) return false;\n\tif (aKeys.length === 0) return true;\n\tfor (const key of aKeys) if (normalizeIndexOptionValue(a?.[key]) !== normalizeIndexOptionValue(b?.[key])) return false;\n\treturn true;\n}\n//#endregion\n//#region src/ir/sql-unique-ir.ts\n/**\n* Schema IR node for a table-level unique constraint as observed by\n* introspection.\n*\n* Implements `DiffableNode` so a unique constraint is directly a table's\n* diff-tree child. Unique constraints are frequently unnamed, so `id` is\n* derived from the column tuple rather than `name` — the column tuple is\n* also what makes two unique constraints the same constraint, so it doubles\n* as the pairing key. There are no further attributes to compare once\n* columns are equal (the differ pairs on `id`), so `isEqualTo` is identity.\n*/\nvar SqlUniqueIR = class SqlUniqueIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.unique;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = [...input.columns];\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `unique:${this.columns.join(\",\")}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.unique;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlUniqueIR\", SqlUniqueIR.is);\n\t\treturn this.id === node.id;\n\t}\n};\n//#endregion\n//#region src/ir/sql-table-ir.ts\n/**\n* Schema IR node for a single table as observed by introspection.\n*\n* Unlike the Contract IR `StorageTable`, this carries the table's\n* `name` — introspection queries return tables as arrays and the\n* verifier keys them into `SqlSchemaIR.tables` afterwards, so the name\n* stays on the table object for downstream call sites that walk\n* `Object.values(schema.tables)`.\n*\n* The constructor normalises nested IR-class fields so downstream\n* walks see a uniform AST regardless of whether the input was a\n* plain-data literal (from introspection) or already-constructed\n* class instances.\n*\n* Implements `DiffableNode` so a flat (single-schema) tree is directly\n* diffable: `id` is the table name; `isEqualTo` is identity (the table's\n* structural drift is entirely expressed by its children); `children()`\n* yields every column, the primary key (when present), every foreign key,\n* unique, index, and check constraint — the same composition and order as\n* the Postgres table node, minus policies.\n*/\nvar SqlTableIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.table;\n\tname;\n\tcolumns;\n\tforeignKeys;\n\tuniques;\n\tindexes;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map(SqlIndexIR.from));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = PrimaryKey.from(input.primaryKey);\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map(SqlCheckConstraintIR.from));\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [\n\t\t\t...Object.values(this.columns),\n\t\t\t...this.primaryKey ? [this.primaryKey] : [],\n\t\t\t...this.foreignKeys,\n\t\t\t...this.uniques,\n\t\t\t...this.indexes,\n\t\t\t...this.checks ?? []\n\t\t];\n\t}\n};\n//#endregion\n//#region src/ir/sql-schema-ir.ts\n/**\n* Root Schema IR node representing the complete database schema as\n* observed by introspection. Target-agnostic; used by both verifiers\n* (compare against intended Contract storage) and migration planners\n* (derive operations needed to reconcile).\n*\n* The constructor normalises nested `SqlTableIR` instances so\n* downstream walks see a uniform AST regardless of whether the input\n* was a plain-data literal or already-constructed class instances.\n*\n* Implements `DiffableNode` as the root of a flat (single-schema) diff\n* tree: `id` is the fixed sentinel `'database'` (roots have no siblings),\n* `isEqualTo` is identity (a container has no own attributes), and\n* `children()` yields the table nodes.\n*/\nvar SqlSchemaIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.schema;\n\ttables;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tables = Object.freeze(Object.fromEntries(Object.entries(input.tables).map(([key, t]) => [key, t instanceof SqlTableIR ? t : new SqlTableIR(t)])));\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"database\";\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn Object.values(this.tables);\n\t}\n};\n//#endregion\nexport { SqlForeignKeyIR as a, SqlCheckConstraintIR as c, assertNode as d, defineNonEnumerable as f, relationalNodeGranularity as h, SqlIndexIR as i, PrimaryKey as l, relationalNodeEntityKind as m, SqlTableIR as n, SqlColumnIR as o, RelationalSchemaNodeKind as p, SqlUniqueIR as r, SqlColumnDefaultIR as s, SqlSchemaIR as t, SqlSchemaIRNode as u };\n\n//# sourceMappingURL=types-CZn-8Rsg.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,2BAA2B;CAChC,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,OAAO;AACR;;;;;;;;;;;AAWA,MAAM,8BAA8B;EAClC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,SAAS;EAClC,yBAAyB,gBAAgB;EACzC,yB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N,KAAK,SAAS,OAAO,OAAO,OAAO,YAAY,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,aAAa,aAAa,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;EACtJ,IAAI,MAAM,gBAAgB,KAAK,GAAG,KAAK,cAAc,MAAM;EAC3D,WAAW,IAAI;CAChB;CACA,IAAI,KAAK;EACR,OAAO;CACR;CACA,UAAU,OAAO;EAChB,OAAO,KAAK,OAAO,MAAM;CAC1B;CACA,WAAW;EACV,OAAO,OAAO,OAAO,KAAK,MAAM;CACjC;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./types-thCvr3t--BKg5flQM.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators-CbqMxQfW.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.d.mts"],"mappings":";;;;;;;;;KAQK;;;;;WAKM;;WAEA;aACE;aACA;;;;;;;iBAOI,+BAA+B,UAAU,SAAS,aAAa,cAAc,iBAAiB,UAAU,wBAAwB;;;KAG5I;WACM;WACA,mCAAmC;;KAEzC;WACM;WACA;;cAEG,0EAA0E,WAAW;cACrF,2EAA2E,WAAW;cACtF,mEAAmE,WAAW,uBAAuB;;;;;;cAMrG,qEAAqE;EACjF;EACA,8CAA8C;;cAElC,2DAA2D;EACvE;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;;cAEE,yEAAyE;EACrF;EACA;EACA;EACA;;cAEY,sEAAsE;EAClF;EACA;EACA;;cAEY,uEAAuE,WAAW;cAClF,gEAAgE,WAAW;cAC3E,qEAAqE;EACjF;EACA;EACA;;cAEY,kEAAkE;EAC9E;KACG;MACC;MACA;MACA;MACA;MACA,aAAa;MACb;MACA,UAAU,uBAAuB;MACjC;MACA;QACE;QACA;QACA;QACA;QACA;;MAEF;;;EAGJ,kBAAkB;EAClB;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;;EAEZ,sBAAsB;EACtB,aAAa;EACb;EACA;IACE;IACA;IACA;;;;;;;;;cASU,kEAAkE;EAC9E;EACA;IACE;IACA,+CAA+C;;;;;;;;;;;iBAWlC,2BAA2B,OAAO,oBAAoB,2BAA2B;;;;;;;iBAOjF,uBAAuB,OAAO,oBAAoB,2BAA2B;;;;;;iBAM7E,wBAAwB,OAAO,oBAAoB,2BAA2B;;;;;;;;;;iBAU9E,gBAAgB;iBAChB,cAAc;;;;;;;;;;;;;;iBAcd,yBAAyB,SAAS;;;;;;;iBAOlC,+BAA+B,UAAU,SAAS;;;;;;;iBAOlD,8BAA8B,UAAU,SAAS;UACxD;;;;;;;;;WASC,iBAAiB;;;;;;;;;;iBAUX,yBAAyB,UAAU,SAAS,aAAa,gBAAgB,UAAU,kCAAkC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators-DD98VrpC.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/validators.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.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-D7vwoN_T.mjs\";\nimport { computeCheckContentHash, computeIndexContentHash } from \"@internal/sql-schema-ir/naming\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { type } from \"arktype\";\nimport { CrossReferenceSchema } from \"@internal/contract/types\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { validateContractDomain } from \"@internal/contract/validate-domain\";\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 generatorKindSchema = type(\"'generator'\");\nconst ControlPolicySchema = type(\"'managed' | 'tolerated' | 'external' | 'observed'\");\nconst ExecutionMutationDefaultValueSchema = type({\n\t\"+\": \"reject\",\n\tkind: generatorKindSchema,\n\tid: type(\"string\").narrow((value, ctx) => {\n\t\treturn /^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value) ? true : ctx.mustBe(\"a flat generator id\");\n\t}),\n\t\"params?\": \"Record<string, unknown>\"\n});\nconst ExecutionSchema = type({\n\t\"+\": \"reject\",\n\texecutionHash: \"string\",\n\tmutations: {\n\t\t\"+\": \"reject\",\n\t\tdefaults: type({\n\t\t\t\"+\": \"reject\",\n\t\t\tref: {\n\t\t\t\t\"+\": \"reject\",\n\t\t\t\tnamespace: \"string\",\n\t\t\t\ttable: \"string\",\n\t\t\t\tcolumn: \"string\"\n\t\t\t},\n\t\t\t\"onCreate?\": ExecutionMutationDefaultValueSchema,\n\t\t\t\"onUpdate?\": ExecutionMutationDefaultValueSchema\n\t\t}).array().readonly()\n\t}\n});\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\tnativeType: \"string\",\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/**\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 = `${tableName}\u0000${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\t\"many?\": \"true\",\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?\": \"unknown\",\n\t\"variants?\": \"unknown\",\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?\": \"Record<string, unknown>\",\n\t\t\t\"enum?\": type({ \"[string]\": ContractEnumSchema })\n\t\t}) }) }),\n\t\tstorage,\n\t\t\"execution?\": ExecutionSchema\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 result = StorageSchema(value);\n\tif (result instanceof type.errors) {\n\t\tconst errors = result.map((p) => p.message);\n\t\tthrow contractError(\"CONTRACT.VALIDATION_FAILED\", `Storage validation failed: ${errors.join(\"; \")}`, { meta: { errors } });\n\t}\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 rawValue = value;\n\tif (rawValue.targetFamily !== void 0 && rawValue.targetFamily !== \"sql\") throw new ContractValidationError(`Unsupported target family: ${rawValue.targetFamily}`, \"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 contractResult;\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*/\nfunction validateStorageSemantics(storage) {\n\tconst errors = [];\n\tvalidateTableScopedEntryNames(storage, errors);\n\tfor (const { namespaceId, tableName, table: rawTable } of eachStorageTable(storage)) {\n\t\tconst table = 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\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\n* resolves to a real table, every model.storage.fields[*].column\n* resolves to a real column, and value-object fields land on JSON-native\n* columns. Throws `ContractValidationError` on the first mismatch.\n*/\nfunction validateModelStorageReferences(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst models = namespace.models;\n\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\tconst storageNamespaceId = model.storage.namespaceId;\n\t\t\tif (storageNamespaceId !== namespaceId) throw new ContractValidationError(`Model \"${qualifiedName}\" storage.namespaceId \"${storageNamespaceId}\" does not match domain namespace \"${namespaceId}\"`, \"storage\");\n\t\t\tconst storageTable = model.storage.table;\n\t\t\tconst rawTable = contract.storage.namespaces[storageNamespaceId]?.entries.table?.[storageTable];\n\t\t\tif (rawTable === void 0) throw new ContractValidationError(`Model \"${qualifiedName}\" references non-existent table \"${storageNamespaceId}.${storageTable}\"`, \"storage\");\n\t\t\tconst table = rawTable;\n\t\t\tconst columnNames = new Set(Object.keys(table.columns));\n\t\t\tfor (const [fieldName, field] of Object.entries(model.storage.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\t\tconst JSON_NATIVE_TYPES = /* @__PURE__ */ new Set([\"json\", \"jsonb\"]);\n\t\t\tfor (const [fieldName, domainField] of Object.entries(model.fields ?? {})) {\n\t\t\t\tif (domainField.type?.kind !== \"valueObject\") continue;\n\t\t\t\tconst storageField = model.storage.fields[fieldName];\n\t\t\t\tif (!storageField) continue;\n\t\t\t\tconst column = table.columns[storageField.column];\n\t\t\t\tif (!column) continue;\n\t\t\t\tif (!JSON_NATIVE_TYPES.has(column.nativeType)) throw new ContractValidationError(`Model \"${qualifiedName}\" field \"${fieldName}\" is a value object but storage column \"${storageField.column}\" has nativeType \"${column.nativeType}\" (expected json or jsonb)`, \"storage\");\n\t\t\t}\n\t\t}\n\t}\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 = 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 referencedColumnNames = new Set(Object.keys(referencedRaw.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 } = 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\tvalidateRelationThroughConsistency(validated);\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 their `nativeType` and `typeParams`\n* match. The contract is canonicalized, so `typeParams` key order is stable and\n* a JSON comparison is exact. `codecId` and `nullable` are intentionally not\n* compared: they do not change the database-level type that governs a join.\n*/\nfunction sameStorageType(a, b) {\n\treturn a.nativeType === b.nativeType && JSON.stringify(a.typeParams ?? null) === JSON.stringify(b.typeParams ?? null);\n}\nfunction describeColumnType(column) {\n\treturn column.typeParams === void 0 ? column.nativeType : `${column.nativeType} ${JSON.stringify(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 (`nativeType` + `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)) 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) {\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\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\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, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, resolveSqlToOneRelationStorage, validateModel, validateModelStorageReferences, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics };\n\n//# source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