@prisma/orm-family-sql 8.0.0-rc.9-dev.5 → 8.0.0-rc.9-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BEvfamnI.mjs} +2 -2
- package/dist/{authored-check-naming-Hf9990DV.mjs.map → authored-check-naming-BEvfamnI.mjs.map} +1 -1
- package/dist/{authoring-type-constructors-BD-XuavC-Dh-K7Ocl.mjs → authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs} +2 -2
- package/dist/{authoring-type-constructors-BD-XuavC-Dh-K7Ocl.mjs.map → authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map} +1 -1
- package/dist/builder__runtime.mjs +1 -1
- package/dist/builder__runtime.mjs.map +1 -1
- package/dist/{config-types-AbijI3Ys.mjs → config-types-BNJgLUUQ.mjs} +2 -2
- package/dist/{config-types-AbijI3Ys.mjs.map → config-types-BNJgLUUQ.mjs.map} +1 -1
- package/dist/{contract-builder-DYDnIGyM.mjs → contract-builder-BOmEsrRi.mjs} +2 -2
- package/dist/{contract-builder-DYDnIGyM.mjs.map → contract-builder-BOmEsrRi.mjs.map} +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.mjs +3 -3
- package/dist/contract__authored-check-naming.mjs +1 -1
- package/dist/contract__foreign-key-materialization.mjs +1 -1
- package/dist/contract__index-naming.mjs +1 -1
- package/dist/{control-BJ9sRUe-.mjs → control-BIIMOKMy.mjs} +2 -2
- package/dist/{control-BJ9sRUe-.mjs.map → control-BIIMOKMy.mjs.map} +1 -1
- package/dist/{derived-checks-D_-1X7be-lGe8VdId.mjs → derived-checks-DGjY5t7S-B3txNm7X.mjs} +6 -6
- package/dist/{derived-checks-D_-1X7be-lGe8VdId.mjs.map → derived-checks-DGjY5t7S-B3txNm7X.mjs.map} +1 -1
- package/dist/family.mjs +2 -2
- package/dist/family__control.mjs +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs → foreign-key-materialization-0TrwfShD.mjs} +2 -2
- package/dist/{foreign-key-materialization-Cu7-7LHl.mjs.map → foreign-key-materialization-0TrwfShD.mjs.map} +1 -1
- package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-fQMLqyC4-4FzPVtCR.mjs} +4 -4
- package/dist/index-naming-fQMLqyC4-4FzPVtCR.mjs.map +1 -0
- package/dist/{interpreter-CZ_iVQV4-BERgkqtm.mjs → interpreter-CZ_iVQV4-CJ6COgSE.mjs} +2 -2
- package/dist/{interpreter-CZ_iVQV4-BERgkqtm.mjs.map → interpreter-CZ_iVQV4-CJ6COgSE.mjs.map} +1 -1
- package/dist/orm-client.mjs +12 -26
- package/dist/orm-client.mjs.map +1 -1
- package/dist/{psl-infer-Dk5kgKre.mjs → psl-infer-TBwKfKgU.mjs} +2 -2
- package/dist/{psl-infer-Dk5kgKre.mjs.map → psl-infer-TBwKfKgU.mjs.map} +1 -1
- package/package.json +18 -18
- package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
package/dist/{derived-checks-D_-1X7be-lGe8VdId.mjs.map → derived-checks-DGjY5t7S-B3txNm7X.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derived-checks-D_-1X7be-lGe8VdId.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/derived-checks-D_-1X7be.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { computeExecutionHash, computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { asNamespaceId, coreHash, crossRef, effectiveControlPolicy } from \"@internal/contract/types\";\nimport { mergeCapabilityMatrices, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { flushAuthoringWarnings, isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { lowerAuthoredCheck } from \"@internal/sql-contract/authored-check-naming\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { tableEntityKind, valueSetEntityKind } from \"@internal/sql-contract/entity-kinds\";\nimport { materializeForeignKeysAndIndexes } from \"@internal/sql-contract/foreign-key-materialization\";\nimport { lowerAuthoredIndex } from \"@internal/sql-contract/index-naming\";\nimport { validateIndexTypes } from \"@internal/sql-contract/index-type-validation\";\nimport { createIndexTypeRegistry } from \"@internal/sql-contract/index-types\";\nimport { CheckConstraint, Index, SqlStorage, StorageTable, applyFkDefaults, checkConstraintInputFromSerialized, isMaterializedSqlNamespace, toStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { validateStorageSemantics } from \"@internal/sql-contract/validators\";\nimport { deriveValueSetFromEntity } from \"@internal/sql-contract/value-set-derivation-hook\";\nimport { composeCheckWirePrefix, computeCheckContentHash, derivedCheckPrefixes } from \"@internal/sql-schema-ir/naming\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/to-one-nullability-message.ts\nfunction toOneNullabilityContradictionMessage(location, contradiction) {\n\treturn contradiction === \"declared-optional\" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`;\n}\n//#endregion\n//#region src/build-contract.ts\nfunction encodeViaCodec(value, codecId, codecLookup) {\n\tconst codec = codecLookup?.get(codecId);\n\tif (codec) return codec.encodeJson(value);\n\treturn blindCast(value);\n}\nfunction encodeColumnDefault(defaultInput, codecId, codecLookup, many = false) {\n\tif (defaultInput.kind === \"function\") return {\n\t\tkind: \"function\",\n\t\texpression: defaultInput.expression\n\t};\n\tif (many) {\n\t\tif (!Array.isArray(defaultInput.value)) throw new InternalError(`Literal default on a list column must be an array; received ${typeof defaultInput.value}. A scalar default on a list field must be rejected at the authoring surface.`);\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: defaultInput.value.map((element) => encodeViaCodec(element, codecId, codecLookup))\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: encodeViaCodec(defaultInput.value, codecId, codecLookup)\n\t};\n}\nfunction assertStorageSemantics(definition, contract) {\n\tconst semanticErrors = validateStorageSemantics(contract.storage);\n\tif (semanticErrors.length > 0) throw contractError(\"CONTRACT.VALIDATION_FAILED\", `Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, { meta: { errors: semanticErrors } });\n\tconst indexTypeRegistry = createIndexTypeRegistry();\n\tconst packsToRegister = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const pack of packsToRegister) {\n\t\tconst registration = pack.indexTypes;\n\t\tif (registration === void 0) continue;\n\t\tif (typeof registration !== \"object\" || registration === null || !Array.isArray(registration.entries)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack \"${pack.id ?? \"<unknown>\"}\" declares \"indexTypes\" but its value is not an IndexTypeRegistration (expected an object with an \"entries\" array; got ${typeof registration}).`, { meta: {\n\t\t\tpackId: pack.id,\n\t\t\tcontribution: \"indexTypes\",\n\t\t\treason: \"invalid-shape\"\n\t\t} });\n\t\tfor (const entry of registration.entries) indexTypeRegistry.register(entry);\n\t}\n\tvalidateIndexTypes(contract, indexTypeRegistry);\n}\nfunction assertKnownTargetModel(modelsByName, modelsByCoordinate, sourceModelName, targetModelName, targetNamespaceId, context) {\n\tconst targetModel = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? modelsByCoordinate.get(`${targetNamespaceId}:${targetModelName}`) : modelsByName.get(targetModelName);\n\tif (!targetModel) {\n\t\tconst qualified = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? `${targetNamespaceId}.${targetModelName}` : targetModelName;\n\t\tthrow contractError(\"CONTRACT.MODEL_UNKNOWN\", `${context} on model \"${sourceModelName}\" references unknown model \"${qualified}\"`, { meta: {\n\t\t\tsourceModel: sourceModelName,\n\t\t\ttargetModel: qualified,\n\t\t\tcontext\n\t\t} });\n\t}\n\treturn targetModel;\n}\nfunction assertTargetTableMatches(sourceModelName, targetModel, referencedTableName, context) {\n\tif (targetModel.tableName !== referencedTableName) throw contractError(\"CONTRACT.TABLE_MISMATCH\", `${context} on model \"${sourceModelName}\" references table \"${referencedTableName}\" but model \"${targetModel.modelName}\" maps to \"${targetModel.tableName}\"`, { meta: {\n\t\tsourceModel: sourceModelName,\n\t\treferencedTable: referencedTableName,\n\t\tmappedTable: targetModel.tableName,\n\t\tcontext\n\t} });\n}\nfunction isValueObjectField(field) {\n\treturn \"valueObjectName\" in field;\n}\n/**\n* Resolves a deferred entity-ref column descriptor (e.g. a `pg.enum(handle)`\n* column) against the field's now-known owning namespace: attaches the\n* storage `valueSet` ref the collected entity's derived value-set is stored\n* under. `nativeType` / `typeParams.typeName` stay bare here — schema\n* qualification (e.g. `auth.aal_level`) is a target concern applied in the\n* next step, `qualifyColumnDescriptor`. A descriptor with no `entityRef` (the\n* ordinary case) passes through unchanged.\n*/\nfunction resolveEntityRefDescriptor(descriptor, namespaceId) {\n\tconst entityRef = descriptor.entityRef;\n\tif (entityRef === void 0) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tvalueSet: {\n\t\t\tplane: \"storage\",\n\t\t\tentityKind: \"valueSet\",\n\t\t\tnamespaceId,\n\t\t\tentityName: entityRef.entityName\n\t\t}\n\t};\n}\n/**\n* Structural check for a target that contributes a `qualifyColumnType` hook\n* on its authoring contributions. Duck-typed (mirroring\n* `contract-psl`'s `hasColumnFromEntityHook`) so the SQL family stays blind\n* to the target's qualification logic and no framework/family interface has\n* to name the hook.\n*/\nfunction hasColumnTypeQualifier(authoring) {\n\treturn \"qualifyColumnType\" in authoring && typeof authoring.qualifyColumnType === \"function\";\n}\n/**\n* Structural check for a target that contributes a `renderCheckExpressions`\n* hook, duck-typed for the same reason {@link hasColumnTypeQualifier} is: the\n* SQL family stays blind to the target's predicate syntax.\n*/\nfunction hasCheckExpressionRenderer(authoring) {\n\treturn \"renderCheckExpressions\" in authoring && typeof authoring.renderCheckExpressions === \"function\";\n}\nfunction resolveCheckExpressionRenderer(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasCheckExpressionRenderer(authoring) ? authoring.renderCheckExpressions : void 0;\n}\n/**\n* The member values a membership check must enforce, encoded exactly as the\n* column stores them. Membership predicates support strings and finite numbers.\n*/\nfunction checkMemberValues(handle, codecLookup) {\n\tconst encoded = handle.values.map((value) => encodeViaCodec(value, handle.codecId, codecLookup));\n\tconst values = [];\n\tfor (const value of encoded) {\n\t\tif (typeof value !== \"string\" && !(typeof value === \"number\" && Number.isFinite(value))) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to strings or finite numbers.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"unsupported-member-value\"\n\t\t} });\n\t\tif (typeof value !== typeof encoded[0]) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to the same primitive type; mixed strings and numbers are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"mixed-member-types\"\n\t\t} });\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\n/**\n* Resolves a field's authored `noCheck` kinds against its column shape:\n* the bare form (`[]`) becomes every kind the shape derives, and a named\n* kind that can never apply to the shape is an authoring error\n* (`CONTRACT.CHECK_OPTOUT_INVALID`). Returns the concrete kinds in\n* canonical ascending order — the only form the contract persists.\n*/\nfunction resolveNoCheckKinds(input) {\n\tconst derivable = [];\n\tif (input.many) derivable.push(\"elementNotNull\");\n\tif (input.isDomainEnum) derivable.push(\"membership\");\n\tconst subject = `Field \"${input.modelName}.${input.fieldName}\"`;\n\tconst meta = {\n\t\tmodelName: input.modelName,\n\t\tfieldName: input.fieldName\n\t};\n\tif (input.kinds.length === 0) {\n\t\tif (derivable.length === 0) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck() waives nothing — this column's shape derives no generated checks.`, { meta: {\n\t\t\t...meta,\n\t\t\treason: \"no-derivable-checks\"\n\t\t} });\n\t\treturn derivable;\n\t}\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const kind of input.kinds) {\n\t\tif (seen.has(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") names the same kind twice.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"duplicate-kind\"\n\t\t} });\n\t\tseen.add(kind);\n\t\tif (!derivable.includes(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") does not apply — ${kind === \"membership\" ? \"membership checks are derived only from enumType() value sets\" : \"element-non-null checks are derived only for list columns\"}.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"inapplicable-kind\"\n\t\t} });\n\t}\n\treturn [...input.kinds].sort();\n}\n/**\n* Names the target's rendered checks and lowers them into contract entities.\n*\n* Naming is composed family-side ({@link composeCheckWirePrefix}) rather than\n* by the target, and suffixed with the predicate's content hash. Composing\n* family-side is what makes the truncation safe — two prefixes that truncate\n* alike still differ in their hashes, and the family can see that the\n* (table, column, kind) triple they were built from is unique per table,\n* rather than having to assume something about SQL text it declares itself\n* unable to read.\n*/\nfunction lowerRenderedChecks(tableName, candidates) {\n\treturn candidates.map((candidate) => new CheckConstraint({\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix: composeCheckWirePrefix(tableName, candidate.columnName, candidate.kind),\n\t\t\thash: computeCheckContentHash(candidate.expression)\n\t\t},\n\t\texpression: candidate.expression\n\t}));\n}\nfunction resolveColumnTypeQualifier(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasColumnTypeQualifier(authoring) ? authoring.qualifyColumnType : void 0;\n}\n/**\n* Applies the target's `qualifyColumnType` hook to a scalar column descriptor\n* at construction, so the storage column and the domain field (which derives\n* its `type.typeParams` from the storage column) are both built already\n* qualified in a single pass. A descriptor whose codec the target leaves\n* unchanged passes through untouched.\n*/\nfunction qualifyColumnDescriptor(descriptor, namespaceId, qualify) {\n\tif (qualify === void 0) return descriptor;\n\tconst qualified = qualify({\n\t\tcodecId: descriptor.codecId,\n\t\tnativeType: descriptor.nativeType,\n\t\t...ifDefined(\"typeParams\", descriptor.typeParams)\n\t}, namespaceId);\n\tif (qualified.nativeType === descriptor.nativeType && qualified.typeParams === descriptor.typeParams) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tnativeType: qualified.nativeType,\n\t\t...ifDefined(\"typeParams\", qualified.typeParams)\n\t};\n}\n/**\n* Records a deferred column's entity-ref into the namespace-scoped collection\n* accumulator (`namespaceId → entityKind → entityName`) — folded into the same\n* namespace assembly `deriveEntityValueSets`/`entries.<kind>` step as the\n* entities-channel attachments, so a column-collected entity gets its\n* value-set the same way an entities-channel one does.\n*\n* The same handle reused by many columns in one namespace is normal (a native\n* enum type backs any number of columns) and records the identical entity once.\n* Two *different* entity instances sharing a name+kind in one namespace is a\n* name collision — the emitted `entries.valueSet.<name>` could only reflect one\n* of them, silently mismatching the other column's type/cast. PSL hard-errors\n* on the equivalent (`PSL_DUPLICATE_DECLARATION`); the TS path rejects it too.\n*/\nfunction collectEntityFromColumn(collected, namespaceId, entityRef) {\n\tconst forNs = collected[namespaceId] ?? {};\n\tconst forKind = forNs[entityRef.entityKind] ?? {};\n\tconst existing = forKind[entityRef.entityName];\n\tif (existing !== void 0 && existing !== entityRef.entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${entityRef.entityKind}\" entities named \"${entityRef.entityName}\" in namespace \"${namespaceId}\" — pack-entity names must be unique per namespace.`, { meta: {\n\t\tkind: entityRef.entityKind,\n\t\tname: entityRef.entityName,\n\t\tnamespaceId\n\t} });\n\tforKind[entityRef.entityName] = entityRef.entity;\n\tforNs[entityRef.entityKind] = forKind;\n\tcollected[namespaceId] = forNs;\n}\n/**\n* Merges a namespace's entities-channel attachments (lowered from the\n* `entities` handle list, carried on `ContractDefinition.attachedEntities`)\n* with the entities collected from that namespace's deferred entity-ref\n* columns. A column-collected entity that shadows a *different* attached\n* entity of the same kind+name (or vice-versa) is the same name-collision bug\n* `collectEntityFromColumn` guards against across columns, so it is rejected\n* the same way — by entity identity, so the same handle attached and used by\n* a column does not throw.\n*/\nfunction mergeColumnAndAttachedEntities(namespaceId, attached, columnCollected) {\n\tif (attached === void 0) return columnCollected;\n\tif (columnCollected === void 0) return attached;\n\tconst kinds = /* @__PURE__ */ new Set([...Object.keys(attached), ...Object.keys(columnCollected)]);\n\tconst result = {};\n\tfor (const kind of kinds) {\n\t\tconst attachedForKind = attached[kind];\n\t\tconst columnForKind = columnCollected[kind];\n\t\tfor (const [name, entity] of Object.entries(columnForKind ?? {})) {\n\t\t\tconst existing = attachedForKind?.[name];\n\t\t\tif (existing !== void 0 && existing !== entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${kind}\" entities named \"${name}\" in namespace \"${namespaceId}\" — a column-referenced entity conflicts with an attached one; pack-entity names must be unique per namespace.`, { meta: {\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t}\n\t\tresult[kind] = {\n\t\t\t...attachedForKind,\n\t\t\t...columnForKind\n\t\t};\n\t}\n\treturn result;\n}\nconst JSONB_CODEC_ID = \"pg/jsonb@1\";\nconst JSONB_NATIVE_TYPE = \"jsonb\";\nfunction resolveModelNamespaceId(model, modelNameToNamespaceId, defaultNamespaceId) {\n\tif (model.namespaceId !== void 0 && model.namespaceId.length > 0) return model.namespaceId;\n\treturn modelNameToNamespaceId.get(model.modelName) ?? defaultNamespaceId;\n}\nfunction toOneRelationNullable(semanticModel, relation) {\n\tconst location = `Relation \"${semanticModel.modelName}.${relation.fieldName}\"`;\n\tif (relation.nullable === void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", `${location} with cardinality \"${relation.cardinality}\" must state whether it is nullable`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-missing\"\n\t} });\n\tconst localColumns = relation.on.parentColumns;\n\tconst { contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relation.nullable,\n\t\tlocalFieldNullability: semanticModel.fields.filter((field) => localColumns.includes(field.columnName)).map((field) => field.nullable),\n\t\townsReference: relation.cardinality === \"N:1\"\n\t});\n\tif (contradiction !== void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", relation.cardinality === \"N:1\" ? toOneNullabilityContradictionMessage(location, contradiction) : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-mismatch\"\n\t} });\n\treturn relation.nullable;\n}\nfunction buildThroughDescriptor(through, tableNamespaceByName, targetModel, modelName, fieldName, defaultNamespaceId) {\n\tif (!tableNamespaceByName.has(through.table)) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `buildSqlContractFromDefinition: junction table \"${through.table}\" for relation \"${modelName}.${fieldName}\" is not a declared model.`, { meta: {\n\t\tsourceModel: modelName,\n\t\trelationName: fieldName,\n\t\tjunctionTable: through.table\n\t} });\n\tconst namespaceId = through.namespaceId ?? defaultNamespaceId;\n\treturn {\n\t\ttable: through.table,\n\t\tnamespaceId,\n\t\tparentColumns: through.parentColumns,\n\t\tchildColumns: through.childColumns,\n\t\ttargetColumns: targetColumnsForJunction(targetModel, fieldName)\n\t};\n}\nfunction targetColumnsForJunction(targetModel, fieldName) {\n\tconst primaryKeyColumns = targetModel.id?.columns;\n\tif (primaryKeyColumns && primaryKeyColumns.length > 0) return primaryKeyColumns;\n\tconst firstUnique = targetModel.uniques?.find((u) => u.columns.length > 0);\n\tif (firstUnique) return firstUnique.columns;\n\tthrow contractError(\"CONTRACT.IDENTITY_INVALID\", `M:N target model \"${targetModel.modelName}\" (relation field \"${fieldName}\") has no primary id or unique key to derive junction targetColumns.`, { meta: {\n\t\tmodelName: targetModel.modelName,\n\t\treason: \"no-key-for-junction-target-columns\"\n\t} });\n}\nfunction buildStorageColumn(field, storageValueSetRef, codecLookup) {\n\tif (isValueObjectField(field)) {\n\t\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, JSONB_CODEC_ID, codecLookup) : void 0;\n\t\treturn {\n\t\t\tnativeType: JSONB_NATIVE_TYPE,\n\t\t\tcodecId: JSONB_CODEC_ID,\n\t\t\tnullable: field.nullable,\n\t\t\t...ifDefined(\"default\", encodedDefault)\n\t\t};\n\t}\n\tconst codecId = field.descriptor.codecId;\n\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, codecId, codecLookup, field.many === true) : void 0;\n\tconst valueSet = storageValueSetRef ?? field.descriptor.valueSet;\n\treturn {\n\t\tnativeType: field.descriptor.nativeType,\n\t\tcodecId,\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...field.noCheck !== void 0 ? { noCheck: [...field.noCheck].sort() } : {},\n\t\t...ifDefined(\"typeParams\", field.descriptor.typeParams),\n\t\t...ifDefined(\"default\", encodedDefault),\n\t\t...ifDefined(\"typeRef\", field.descriptor.typeRef),\n\t\t...ifDefined(\"valueSet\", valueSet)\n\t};\n}\nfunction buildDomainField(field, column, domainValueSetRef) {\n\tif (isValueObjectField(field)) return {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: field.valueObjectName\n\t\t},\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {}\n\t};\n\treturn {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: column.codecId,\n\t\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t\t},\n\t\tnullable: column.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...ifDefined(\"valueSet\", domainValueSetRef)\n\t};\n}\nfunction collectStorageNamespaceCoordinateIds(definition) {\n\tconst ids = /* @__PURE__ */ new Set();\n\tids.add(definition.target.defaultNamespaceId);\n\tfor (const id of definition.namespaces ?? []) if (id.length > 0) ids.add(id);\n\tfor (const model of definition.models) if (model.namespaceId !== void 0 && model.namespaceId.length > 0) ids.add(model.namespaceId);\n\tfor (const id of Object.keys(definition.attachedEntities ?? {})) if (id.length > 0) ids.add(id);\n\treturn ids;\n}\n/**\n* Entry kinds the framework assembler itself manages (`table` from models,\n* `valueSet` from `enums` and attached-entity value-set derivation). A\n* pack-attached entity claiming one of these would silently clobber or be\n* clobbered by the managed slot, so it is rejected outright.\n*/\nconst MANAGED_ENTRY_KINDS = /* @__PURE__ */ new Set([tableEntityKind.kind, valueSetEntityKind.kind]);\nfunction assertNoManagedEntityKinds(namespaceId, entitiesForNs) {\n\tif (entitiesForNs === void 0) return;\n\tfor (const kind of Object.keys(entitiesForNs)) if (MANAGED_ENTRY_KINDS.has(kind)) throw contractError(\"CONTRACT.ENTITY_KIND_INVALID\", `buildSqlContractFromDefinition: attached entity in namespace \"${namespaceId}\" declares entry kind \"${kind}\", which is managed by the framework (table/valueSet) and cannot be attached.`, { meta: {\n\t\tentityKind: kind,\n\t\tnamespaceId\n\t} });\n}\n/**\n* Walks the flat `entityTypes` namespace tree contributed by the target pack\n* and every extension pack, indexing descriptors by their `discriminator` —\n* the same string a pack entity's entries-map key (`entries.<kind>`) uses.\n* Mirrors `contract-psl`'s `buildEntityTypesByDiscriminator`, recomposed here\n* from the packs `ContractDefinition` already carries (`target` +\n* `extensions`) since the TS assembler has no single pre-merged\n* `AuthoringContributions` input to read the way the PSL interpreter does.\n*/\nfunction collectEntityTypeDescriptorsByDiscriminator(definition) {\n\tconst result = /* @__PURE__ */ new Map();\n\tconst walk = (namespace) => {\n\t\tfor (const value of Object.values(namespace)) if (isAuthoringEntityTypeDescriptor(value)) result.set(value.discriminator, value);\n\t\telse walk(value);\n\t};\n\tconst components = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const component of components) {\n\t\tconst entityTypes = component.authoring?.entityTypes;\n\t\tif (entityTypes !== void 0) walk(entityTypes);\n\t}\n\treturn result;\n}\n/**\n* Derives value-sets for every pack entity declared in one namespace,\n* reusing the same `SqlValueSetDerivingEntityTypeOutput.deriveValueSet` hook\n* `contract-psl`'s `lowerExtensionBlocksForNamespace` folds into\n* `entries.valueSet` on the PSL path — so a TS-attached entity (e.g. a\n* native enum) gets its value-set the same way. Entity kinds with no\n* registered descriptor, or whose descriptor output doesn't derive a\n* value-set, contribute nothing.\n*/\nfunction deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator) {\n\tif (entitiesForNs === void 0) return void 0;\n\tlet result;\n\tfor (const [kind, entitiesByName] of Object.entries(entitiesForNs)) {\n\t\tconst descriptor = entityTypesByDiscriminator.get(kind);\n\t\tif (descriptor === void 0) continue;\n\t\tfor (const [name, entity] of Object.entries(entitiesByName)) {\n\t\t\tconst derivedValueSet = deriveValueSetFromEntity(descriptor.output, entity);\n\t\t\tif (derivedValueSet === void 0) continue;\n\t\t\tresult ??= {};\n\t\t\tresult[name] = derivedValueSet;\n\t\t}\n\t}\n\treturn result;\n}\n/**\n* Merges a namespace's `enumType()`-derived value-sets with its pack-entity-\n* derived value-sets. Both land in the same `entries.valueSet[name]` slot —\n* which drives value-set → codec typing and the domain-enum CHECK — so a\n* same-named entry in both would let one silently overwrite the other and\n* corrupt whichever column resolves against it. The same collision class the\n* `mergeColumnAndAttachedEntities` guard rejects; the PSL path already hard-errors\n* on the equivalent (`interpretPslDocumentToSqlContract`). Reject it here too.\n*/\nfunction mergeNamespaceValueSets(namespaceId, enumValueSets, packValueSets) {\n\tif (enumValueSets !== void 0 && packValueSets !== void 0) {\n\t\tfor (const name of Object.keys(packValueSets)) if (Object.hasOwn(enumValueSets, name)) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: value-set \"${name}\" in namespace \"${namespaceId}\" is derived from both an enum and a pack entity — names must be unique per namespace.`, { meta: {\n\t\t\tkind: \"valueSet\",\n\t\t\tname,\n\t\t\tnamespaceId\n\t\t} });\n\t}\n\treturn {\n\t\t...enumValueSets,\n\t\t...packValueSets\n\t};\n}\nfunction ensureUnboundNamespaceSlot(namespaces, createNamespace) {\n\tif (Object.hasOwn(namespaces, UNBOUND_NAMESPACE_ID)) return namespaces;\n\tconst unbound = createNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: { table: {} }\n\t});\n\treturn {\n\t\t[UNBOUND_NAMESPACE_ID]: unbound,\n\t\t...namespaces\n\t};\n}\nconst DERIVABLE_CHECK_KINDS = [\"membership\", \"elementNotNull\"];\n/**\n* Which of `columnNames` could have produced `prefix` for some\n* {@link CheckKind} — the reverse of {@link derivedCheckPrefixes}, used only\n* to name the collision in `CONTRACT.CHECK_NAME_RESERVED`'s message. Callers\n* already know `prefix` is a member of `derivedCheckPrefixes(tableName,\n* columnNames)`, so the result is never empty.\n*/\nfunction columnsProducingCheckPrefix(tableName, columnNames, prefix) {\n\treturn columnNames.filter((columnName) => DERIVABLE_CHECK_KINDS.some((kind) => composeCheckWirePrefix(tableName, columnName, kind) === prefix));\n}\nfunction buildSqlContractFromDefinition(definition, codecLookup) {\n\tconst target = definition.target.targetId;\n\tconst defaultNamespaceId = definition.target.defaultNamespaceId;\n\tconst qualifyColumnType = resolveColumnTypeQualifier(definition.target);\n\tconst renderCheckExpressions = resolveCheckExpressionRenderer(definition.target);\n\tconst targetFamily = \"sql\";\n\tconst resolveNamespaceId = (m) => m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId;\n\tconst modelsByName = new Map(definition.models.map((m) => [m.modelName, m]));\n\tconst tableNamespaceByName = new Map(definition.models.map((m) => [m.tableName, m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId]));\n\tconst modelsByCoordinate = new Map(definition.models.map((m) => [`${resolveNamespaceId(m)}:${m.modelName}`, m]));\n\tconst tablesByNamespace = {};\n\tconst authoringWarnings = [...definition.warnings ?? []];\n\tconst modelNameToNamespaceId = /* @__PURE__ */ new Map();\n\tconst executionDefaults = [];\n\tconst modelsByNamespace = {};\n\tconst collectedColumnEntities = {};\n\tconst rootEntries = [];\n\tfor (const semanticModel of definition.models) {\n\t\tconst tableName = semanticModel.tableName;\n\t\tconst namespaceId = semanticModel.namespaceId !== void 0 && semanticModel.namespaceId.length > 0 ? semanticModel.namespaceId : defaultNamespaceId;\n\t\tmodelNameToNamespaceId.set(semanticModel.modelName, namespaceId);\n\t\tif (!semanticModel.sharesBaseTable) rootEntries.push({\n\t\t\ttableName,\n\t\t\tnamespaceId,\n\t\t\tref: crossRef(semanticModel.modelName, namespaceId)\n\t\t});\n\t\tconst columns = {};\n\t\tconst fieldToColumn = {};\n\t\tconst domainFields = {};\n\t\tconst domainFieldRefs = {};\n\t\tconst checksForTable = [];\n\t\tconst derivesChecks = effectiveControlPolicy(semanticModel.control, definition.defaultControlPolicy) === \"managed\";\n\t\tfor (const field of semanticModel.fields) {\n\t\t\tconst executionDefaultPhases = field.executionDefaults?.onCreate || field.executionDefaults?.onUpdate ? field.executionDefaults : void 0;\n\t\t\tif (executionDefaultPhases) {\n\t\t\t\tif (field.default !== void 0) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot define both default and executionDefaults.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"default-and-executionDefaults\"\n\t\t\t\t} });\n\t\t\t\tif (field.nullable) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot be nullable when executionDefaults are present.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"nullable-with-executionDefaults\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tconst enumHandle = !isValueObjectField(field) ? field.enumTypeHandle : void 0;\n\t\t\tconst storageValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"storage\",\n\t\t\t\tentityKind: \"valueSet\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tconst domainValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"domain\",\n\t\t\t\tentityKind: \"enum\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tlet resolvedField = field;\n\t\t\tif (!isValueObjectField(field)) {\n\t\t\t\tlet descriptor = field.descriptor;\n\t\t\t\tconst entityRef = descriptor.entityRef;\n\t\t\t\tif (entityRef !== void 0) {\n\t\t\t\t\tcollectEntityFromColumn(collectedColumnEntities, namespaceId, entityRef);\n\t\t\t\t\tdescriptor = resolveEntityRefDescriptor(descriptor, namespaceId);\n\t\t\t\t}\n\t\t\t\tdescriptor = qualifyColumnDescriptor(descriptor, namespaceId, qualifyColumnType);\n\t\t\t\tif (descriptor !== field.descriptor) resolvedField = {\n\t\t\t\t\t...field,\n\t\t\t\t\tdescriptor\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!isValueObjectField(resolvedField) && resolvedField.noCheck !== void 0) {\n\t\t\t\tconst { noCheck: authoredNoCheck, ...withoutNoCheck } = resolvedField;\n\t\t\t\tresolvedField = derivesChecks ? {\n\t\t\t\t\t...withoutNoCheck,\n\t\t\t\t\tnoCheck: resolveNoCheckKinds({\n\t\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\t\tkinds: authoredNoCheck,\n\t\t\t\t\t\tmany: resolvedField.many === true,\n\t\t\t\t\t\tisDomainEnum: enumHandle !== void 0\n\t\t\t\t\t})\n\t\t\t\t} : withoutNoCheck;\n\t\t\t}\n\t\t\tconst column = buildStorageColumn(resolvedField, storageValueSetRef, codecLookup);\n\t\t\tcolumns[field.columnName] = column;\n\t\t\tfieldToColumn[field.fieldName] = field.columnName;\n\t\t\tif (renderCheckExpressions !== void 0 && derivesChecks) {\n\t\t\t\tconst waivedKinds = !isValueObjectField(resolvedField) ? resolvedField.noCheck : void 0;\n\t\t\t\tchecksForTable.push(...lowerRenderedChecks(tableName, renderCheckExpressions({\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumnName: field.columnName,\n\t\t\t\t\tmany: column.many === true,\n\t\t\t\t\tmemberValues: enumHandle !== void 0 ? checkMemberValues(enumHandle, codecLookup) : void 0\n\t\t\t\t}).filter((candidate) => !(waivedKinds?.includes(candidate.kind) ?? false))));\n\t\t\t}\n\t\t\tdomainFields[field.fieldName] = buildDomainField(field, column, domainValueSetRef);\n\t\t\tif (isValueObjectField(field)) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: field.valueObjectName,\n\t\t\t\t...field.many ? { many: true } : {}\n\t\t\t};\n\t\t\telse if (field.many) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tmany: true\n\t\t\t};\n\t\t\tif (executionDefaultPhases) executionDefaults.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: namespaceId,\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: field.columnName\n\t\t\t\t},\n\t\t\t\t...ifDefined(\"onCreate\", executionDefaultPhases.onCreate),\n\t\t\t\t...ifDefined(\"onUpdate\", executionDefaultPhases.onUpdate)\n\t\t\t});\n\t\t}\n\t\tconst authoringForeignKeys = (semanticModel.foreignKeys ?? []).map((fk) => {\n\t\t\tif (fk.references.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? defaultNamespaceId;\n\t\t\t\treturn {\n\t\t\t\t\tsource: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\t\ttableName,\n\t\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t\t},\n\t\t\t\t\ttarget: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\t\tcolumns: fk.references.columns,\n\t\t\t\t\t\tspaceId: fk.references.spaceId\n\t\t\t\t\t},\n\t\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, fk.references.model, fk.references.namespaceId, \"Foreign key\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, fk.references.table, \"Foreign key\");\n\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? (targetModel.namespaceId !== void 0 && targetModel.namespaceId.length > 0 ? targetModel.namespaceId : defaultNamespaceId);\n\t\t\treturn {\n\t\t\t\tsource: {\n\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\tcolumns: fk.references.columns\n\t\t\t\t},\n\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t};\n\t\t});\n\t\tif (semanticModel.sharesBaseTable && semanticModel.checks && semanticModel.checks.length > 0) throw contractError(\"CONTRACT.CHECK_ON_STI_VARIANT\", `Model \"${semanticModel.modelName}\" declares a check constraint but shares its base model's storage table (single-table inheritance) and has no table of its own to declare it on. Declare the check on the base model instead.`, { meta: {\n\t\t\ttableName,\n\t\t\tmodelName: semanticModel.modelName\n\t\t} });\n\t\tif (!semanticModel.sharesBaseTable) {\n\t\t\tconst uniques = (semanticModel.uniques ?? []).map((u) => ({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name)\n\t\t\t}));\n\t\t\tconst declaredIndexes = (semanticModel.indexes ?? []).map((i) => lowerAuthoredIndex(tableName, blindCast({\n\t\t\t\t...ifDefined(\"columns\", i.columns),\n\t\t\t\t...ifDefined(\"expression\", i.expression),\n\t\t\t\twhere: i.where,\n\t\t\t\tunique: i.unique,\n\t\t\t\tmap: i.map,\n\t\t\t\tname: i.name,\n\t\t\t\ttype: i.type,\n\t\t\t\toptions: i.options\n\t\t\t}), authoringWarnings));\n\t\t\tif (semanticModel.checks !== void 0 && semanticModel.checks.length > 0) {\n\t\t\t\tconst tableColumnNames = Object.keys(columns);\n\t\t\t\tconst reservedCheckPrefixes = derivedCheckPrefixes(tableName, tableColumnNames);\n\t\t\t\tfor (const authoredCheck of semanticModel.checks) {\n\t\t\t\t\tconst lowered = lowerAuthoredCheck(tableName, authoredCheck, authoringWarnings);\n\t\t\t\t\tif (lowered.naming.kind === \"wire\" && reservedCheckPrefixes.has(lowered.naming.prefix)) {\n\t\t\t\t\t\tconst collidingColumns = columnsProducingCheckPrefix(tableName, tableColumnNames, lowered.naming.prefix);\n\t\t\t\t\t\tconst columnList = collidingColumns.map((name) => `\"${name}\"`).join(\", \");\n\t\t\t\t\t\tthrow contractError(\"CONTRACT.CHECK_NAME_RESERVED\", `Check \"${lowered.naming.prefix}\" on table \"${tableName}\": this name's prefix matches the shape a derived enforcement check would use for column${collidingColumns.length === 1 ? \"\" : \"s\"} ${columnList} of this table, so it can't be told apart from one. Choose a different name.`, { meta: {\n\t\t\t\t\t\t\ttableName,\n\t\t\t\t\t\t\tprefix: lowered.naming.prefix,\n\t\t\t\t\t\t\tcollidingColumns\n\t\t\t\t\t\t} });\n\t\t\t\t\t}\n\t\t\t\t\tchecksForTable.push(new CheckConstraint(lowered));\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst primaryKey = semanticModel.id ? {\n\t\t\t\tcolumns: semanticModel.id.columns,\n\t\t\t\t...ifDefined(\"name\", semanticModel.id.name)\n\t\t\t} : void 0;\n\t\t\tconst { foreignKeys, indexes } = materializeForeignKeysAndIndexes(tableName, authoringForeignKeys, declaredIndexes, uniques, primaryKey);\n\t\t\tconst tableInput = {\n\t\t\t\tcolumns,\n\t\t\t\t...ifDefined(\"control\", semanticModel.control),\n\t\t\t\tuniques,\n\t\t\t\tindexes: indexes.map((i) => new Index(i)),\n\t\t\t\tforeignKeys,\n\t\t\t\t...primaryKey ? { primaryKey } : {},\n\t\t\t\t...checksForTable.length > 0 ? { checks: checksForTable } : {}\n\t\t\t};\n\t\t\tlet nsTables = tablesByNamespace[namespaceId];\n\t\t\tif (nsTables === void 0) {\n\t\t\t\tnsTables = {};\n\t\t\t\ttablesByNamespace[namespaceId] = nsTables;\n\t\t\t}\n\t\t\tif (nsTables[tableName] !== void 0) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: duplicate table \"${tableName}\" in namespace \"${namespaceId}\".`, { meta: {\n\t\t\t\tkind: \"table\",\n\t\t\t\tname: tableName,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t\tnsTables[tableName] = tableInput;\n\t\t}\n\t\tconst storageFields = {};\n\t\tfor (const [fieldName, columnName] of Object.entries(fieldToColumn)) storageFields[fieldName] = { column: columnName };\n\t\tconst columnToField = new Map(Object.entries(fieldToColumn).map(([field, col]) => [col, field]));\n\t\tconst modelRelations = {};\n\t\tfor (const relation of semanticModel.relations ?? []) {\n\t\t\tif (relation.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = relation.namespaceId ?? defaultNamespaceId;\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto: crossRef(relation.toModel, targetNamespaceId, relation.spaceId),\n\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\t\ton: {\n\t\t\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\t\t\ttargetFields: relation.on.childColumns\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, relation.toModel, relation.toNamespaceId, \"Relation\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, relation.toTable, \"Relation\");\n\t\t\tconst targetColumnToField = new Map(targetModel.fields.map((f) => [f.columnName, f.fieldName]));\n\t\t\tconst to = crossRef(relation.toModel, relation.toNamespaceId !== void 0 && relation.toNamespaceId.length > 0 ? relation.toNamespaceId : resolveModelNamespaceId(targetModel, modelNameToNamespaceId, defaultNamespaceId));\n\t\t\tconst on = {\n\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\ttargetFields: relation.on.childColumns.map((col) => targetColumnToField.get(col) ?? col)\n\t\t\t};\n\t\t\tif (relation.cardinality === \"N:M\") {\n\t\t\t\tif (!relation.through) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${semanticModel.modelName}.${relation.fieldName}\" with cardinality \"N:M\" requires through metadata`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\trelationName: relation.fieldName,\n\t\t\t\t\treason: \"many-to-many-missing-through\"\n\t\t\t\t} });\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto,\n\t\t\t\t\tcardinality: \"N:M\",\n\t\t\t\t\ton,\n\t\t\t\t\tthrough: buildThroughDescriptor(relation.through, tableNamespaceByName, targetModel, semanticModel.modelName, relation.fieldName, defaultNamespaceId)\n\t\t\t\t};\n\t\t\t} else if (relation.cardinality === \"1:N\") modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: \"1:N\",\n\t\t\t\ton\n\t\t\t};\n\t\t\telse modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: relation.cardinality,\n\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\ton\n\t\t\t};\n\t\t}\n\t\tlet namespaceModels = modelsByNamespace[namespaceId];\n\t\tif (namespaceModels === void 0) {\n\t\t\tnamespaceModels = {};\n\t\t\tmodelsByNamespace[namespaceId] = namespaceModels;\n\t\t}\n\t\tnamespaceModels[semanticModel.modelName] = {\n\t\t\tstorage: {\n\t\t\t\ttable: tableName,\n\t\t\t\tnamespaceId,\n\t\t\t\tfields: storageFields\n\t\t\t},\n\t\t\tfields: domainFields,\n\t\t\trelations: modelRelations\n\t\t};\n\t}\n\tconst rootTableNameCounts = /* @__PURE__ */ new Map();\n\tfor (const entry of rootEntries) rootTableNameCounts.set(entry.tableName, (rootTableNameCounts.get(entry.tableName) ?? 0) + 1);\n\tconst roots = {};\n\tfor (const entry of rootEntries) {\n\t\tconst key = (rootTableNameCounts.get(entry.tableName) ?? 0) > 1 ? `${entry.namespaceId}.${entry.tableName}` : entry.tableName;\n\t\troots[key] = entry.ref;\n\t}\n\tconst rawStorageTypes = definition.storageTypes ?? {};\n\tconst documentTypes = Object.fromEntries(Object.entries(rawStorageTypes).map(([name, entry]) => {\n\t\tif (entry.kind === \"codec-instance\") return [name, entry];\n\t\treturn [name, toStorageTypeInstance({\n\t\t\tcodecId: entry.codecId,\n\t\t\tnativeType: entry.nativeType,\n\t\t\ttypeParams: entry.typeParams ?? {}\n\t\t})];\n\t}));\n\tconst namespaceCoordinateIds = collectStorageNamespaceCoordinateIds(definition);\n\tconst domainEnumsByNs = {};\n\tconst storageValueSetsByNs = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tif (enumName !== handle.enumName) throw contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${enumName}\" must match enumType name \"${handle.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tdeclarationKey: enumName,\n\t\t\treason: \"key-name-mismatch\"\n\t\t} });\n\t\tconst nsId = defaultNamespaceId;\n\t\tlet domainSlot = domainEnumsByNs[nsId];\n\t\tif (domainSlot === void 0) {\n\t\t\tdomainSlot = {};\n\t\t\tdomainEnumsByNs[nsId] = domainSlot;\n\t\t}\n\t\tdomainSlot[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: encodeViaCodec(m.value, handle.codecId, codecLookup)\n\t\t\t}))\n\t\t};\n\t\tlet storageSlot = storageValueSetsByNs[nsId];\n\t\tif (storageSlot === void 0) {\n\t\t\tstorageSlot = {};\n\t\t\tstorageValueSetsByNs[nsId] = storageSlot;\n\t\t}\n\t\tstorageSlot[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: handle.values.map((v) => encodeViaCodec(v, handle.codecId, codecLookup))\n\t\t};\n\t}\n\tconst { createNamespace } = definition;\n\tconst entityTypesByDiscriminator = collectEntityTypeDescriptorsByDiscriminator(definition);\n\tconst namespaces = Object.fromEntries([...namespaceCoordinateIds].sort().map((id) => {\n\t\tconst entitiesForNs = mergeColumnAndAttachedEntities(id, definition.attachedEntities?.[id], collectedColumnEntities[id]);\n\t\tassertNoManagedEntityKinds(id, entitiesForNs);\n\t\tconst enumValueSetEntries = storageValueSetsByNs[id];\n\t\tconst packValueSetEntries = deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator);\n\t\tconst valueSetEntries = enumValueSetEntries !== void 0 || packValueSetEntries !== void 0 ? mergeNamespaceValueSets(id, enumValueSetEntries, packValueSetEntries) : void 0;\n\t\tconst nsInput = {\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\ttable: tablesByNamespace[id] ?? {},\n\t\t\t\t...entitiesForNs,\n\t\t\t\t...valueSetEntries !== void 0 && Object.keys(valueSetEntries).length > 0 ? { valueSet: valueSetEntries } : {}\n\t\t\t}\n\t\t};\n\t\treturn [id, createNamespace(nsInput)];\n\t}));\n\tconst storageWithoutHash = {\n\t\t...Object.keys(documentTypes).length > 0 ? { types: documentTypes } : {},\n\t\tnamespaces: defaultNamespaceId === UNBOUND_NAMESPACE_ID ? ensureUnboundNamespaceSlot(namespaces, createNamespace) : namespaces\n\t};\n\tconst storageHash = definition.storageHash ? coreHash(definition.storageHash) : computeStorageHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...sqlContractCanonicalizationHooks\n\t});\n\tconst storage = new SqlStorage({\n\t\t...storageWithoutHash,\n\t\tstorageHash\n\t});\n\tconst executionSection = executionDefaults.length > 0 ? { mutations: { defaults: executionDefaults.sort((a, b) => {\n\t\tconst tableCompare = a.ref.table.localeCompare(b.ref.table);\n\t\tif (tableCompare !== 0) return tableCompare;\n\t\treturn a.ref.column.localeCompare(b.ref.column);\n\t}) } } : void 0;\n\tconst extensionNamespaces = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.id) : void 0;\n\tconst extensions = { ...definition.extensions || {} };\n\tif (extensionNamespaces) {\n\t\tfor (const namespace of extensionNamespaces) if (!Object.hasOwn(extensions, namespace)) extensions[namespace] = {};\n\t}\n\tconst extensionPackCapabilitySources = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.capabilities) : [];\n\tconst capabilities = mergeCapabilityMatrices(definition.target.capabilities, ...extensionPackCapabilitySources);\n\tconst profileHash = computeProfileHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tcapabilities: {}\n\t});\n\tconst executionWithHash = executionSection ? {\n\t\t...executionSection,\n\t\texecutionHash: computeExecutionHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\texecution: executionSection\n\t\t})\n\t} : void 0;\n\tconst valueObjects = definition.valueObjects && definition.valueObjects.length > 0 ? Object.fromEntries(definition.valueObjects.map((vo) => [vo.name, { fields: Object.fromEntries(vo.fields.map((f) => [f.fieldName, isValueObjectField(f) ? {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: f.valueObjectName\n\t\t},\n\t\tnullable: f.nullable,\n\t\t...f.many ? { many: true } : {}\n\t} : {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: f.descriptor.codecId,\n\t\t\t...ifDefined(\"typeParams\", f.descriptor.typeParams)\n\t\t},\n\t\tnullable: f.nullable\n\t}])) }])) : void 0;\n\tconst domainNamespaceIds = new Set(Object.keys(modelsByNamespace));\n\tif (domainNamespaceIds.size === 0) domainNamespaceIds.add(defaultNamespaceId);\n\tif (valueObjects !== void 0) domainNamespaceIds.add(defaultNamespaceId);\n\tfor (const nsId of Object.keys(domainEnumsByNs)) domainNamespaceIds.add(nsId);\n\tconst domainNamespaces = Object.fromEntries([...domainNamespaceIds].sort().map((namespaceId) => {\n\t\tconst modelsInNs = modelsByNamespace[namespaceId] ?? {};\n\t\tconst enumsInNs = domainEnumsByNs[namespaceId];\n\t\treturn [namespaceId, {\n\t\t\tmodels: modelsInNs,\n\t\t\t...namespaceId === defaultNamespaceId && valueObjects !== void 0 ? { valueObjects } : {},\n\t\t\t...enumsInNs !== void 0 && Object.keys(enumsInNs).length > 0 ? { enum: enumsInNs } : {}\n\t\t}];\n\t}));\n\tconst contract = {\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\tdomain: { namespaces: domainNamespaces },\n\t\troots,\n\t\tstorage,\n\t\t...executionWithHash ? { execution: executionWithHash } : {},\n\t\textensions,\n\t\tcapabilities,\n\t\tprofileHash,\n\t\tmeta: {}\n\t};\n\tassertStorageSemantics(definition, contract);\n\tflushAuthoringWarnings(authoringWarnings);\n\treturn contract;\n}\n//#endregion\n//#region src/derived-checks.ts\n/**\n* The one step every SQL contract specifier funnels its loaded contract\n* through: stamp the specifier's default control policy, then strip derived\n* checks from every table the stamped policy leaves non-managed. Composing the\n* two here is what keeps the managed-only consequence from being skipped on\n* any specifier route.\n*/\nfunction applySqlSpecifierControlPolicy(contract, defaultControlPolicy, createNamespace) {\n\treturn stripDerivedChecksFromNonManagedTables(applySpecifierDefaultControlPolicy(contract, defaultControlPolicy), createNamespace);\n}\n/**\n* Removes generated enforcement checks from every table whose effective\n* control policy is not `managed`.\n*\n* A check is derived iff its wire prefix is one derivation would produce for\n* some column of its table — {@link derivedCheckPrefixes} enumerates that\n* set. Wire-naming alone no longer identifies derivation: an authored\n* `name:` check (`@@check` / `check()`) is wire-named too, so a bare\n* `check.prefix === undefined` test would delete an author's own constraint\n* from every non-`managed` table. The prefix-shape rule tests against the\n* table's own columns instead of the naming mode, so an authored check with\n* an unrelated prefix survives.\n*\n* The rule is weaker than recomputing the content hash `contract infer`\n* uses: that needs `postgresRenderCheckExpressions` to know what a kind\n* renders, and this funnel has no target descriptor to reach it through. It\n* can only ask whether some column could have produced a prefix of this\n* shape, not whether this exact column produced this exact check. The gap\n* that opens — an authored name that collides with a derived-prefix shape —\n* is closed at authoring time instead: such a name is rejected\n* (`CONTRACT.CHECK_NAME_RESERVED`) before it ever reaches storage.\n*\n* Why derivation stops at the namespace boundary: the contract *describes* an\n* external schema, it does not *prescribe* enforcement for it. Deriving a check\n* for a table Prisma Next never creates declares a constraint the live database\n* has no reason to carry, and `external` fails verify on a declared shape the\n* database lacks — an unfixable failure, since no plan may emit DDL there\n* either.\n*\n* This is the post-build half of the rule. Authoring skips derivation for a\n* table whose policy is known in the source; this pass catches the policy a\n* contract *specifier* applies after the contract is already built, which is\n* the only signal a pack like the Supabase extension gives. Specifiers reach\n* it through `applySqlSpecifierControlPolicy` above.\n*\n* Returns the contract unchanged (same reference) when nothing is stripped.\n* When something is, the storage hash is recomputed — the stripped contract\n* describes different storage.\n*/\nfunction stripDerivedChecksFromNonManagedTables(contract, createNamespace) {\n\tconst storage = contract.storage;\n\tif (!isSqlStorageShaped(storage)) return contract;\n\tlet anyStripped = false;\n\tconst namespaces = {};\n\tfor (const [namespaceId, namespace] of Object.entries(storage.namespaces)) {\n\t\tif (!isMaterializedSqlNamespace(namespace)) return contract;\n\t\tconst tables = namespace.entries[\"table\"];\n\t\tif (tables === void 0) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tlet namespaceStripped = false;\n\t\tconst nextTables = {};\n\t\tfor (const [tableName, table] of Object.entries(tables)) {\n\t\t\tconst stripped = StorageTable.is(table) ? withoutDerivedChecks(tableName, table, contract.defaultControlPolicy) : table;\n\t\t\tif (stripped !== table) namespaceStripped = true;\n\t\t\tnextTables[tableName] = stripped;\n\t\t}\n\t\tif (!namespaceStripped) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tanyStripped = true;\n\t\tnamespaces[namespaceId] = createNamespace({\n\t\t\tid: namespace.id,\n\t\t\tentries: {\n\t\t\t\t...namespace.entries,\n\t\t\t\ttable: nextTables\n\t\t\t}\n\t\t});\n\t}\n\tif (!anyStripped) return contract;\n\tconst storageWithoutHash = {\n\t\tnamespaces,\n\t\t...ifDefined(\"types\", storage.types)\n\t};\n\treturn {\n\t\t...contract,\n\t\tstorage: new SqlStorage({\n\t\t\t...storageWithoutHash,\n\t\t\tstorageHash: computeStorageHash({\n\t\t\t\ttarget: contract.target,\n\t\t\t\ttargetFamily: contract.targetFamily,\n\t\t\t\tstorage: storageWithoutHash,\n\t\t\t\t...sqlContractCanonicalizationHooks\n\t\t\t})\n\t\t})\n\t};\n}\n/**\n* Structural stand-in for `instanceof SqlStorage`: like the checks it wraps, a\n* storage instance can arrive from a realm whose IR classes are a separate\n* copy (the dist e2e shape), where an `instanceof` test would miss.\n*/\nfunction isSqlStorageShaped(x) {\n\tif (typeof x !== \"object\" || x === null || !(\"namespaces\" in x)) return false;\n\treturn typeof x.namespaces === \"object\" && x.namespaces !== null;\n}\n/** The table itself when it keeps every check, a rebuilt one when it does not. */\nfunction withoutDerivedChecks(tableName, table, contractDefault) {\n\tconst checks = table.checks;\n\tif (checks === void 0 || checks.length === 0) return table;\n\tif (effectiveControlPolicy(table.control, contractDefault) === \"managed\") return table;\n\tconst columnNames = Object.keys(table.columns);\n\tinvariant(columnNames.length > 0, `withoutDerivedChecks: table \"${tableName}\" carries checks but its column map is empty. The caller must pass the table's real, complete column set — an empty or partial map makes every check misclassify as non-derived and survive the strip.`);\n\tconst derivedPrefixes = derivedCheckPrefixes(tableName, columnNames);\n\tconst kept = checks.filter((check) => check.prefix === void 0 || !derivedPrefixes.has(check.prefix));\n\tif (kept.length === checks.length) return table;\n\treturn new StorageTable({\n\t\tcolumns: table.columns,\n\t\tuniques: table.uniques,\n\t\tindexes: table.indexes,\n\t\tforeignKeys: table.foreignKeys,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey),\n\t\t...ifDefined(\"control\", table.control),\n\t\t...kept.length > 0 ? { checks: kept.map((check) => checkConstraintInputFromSerialized({\n\t\t\tname: check.name,\n\t\t\t...ifDefined(\"prefix\", check.prefix),\n\t\t\texpression: check.expression\n\t\t})) } : {}\n\t});\n}\n//#endregion\nexport { contractError as i, buildSqlContractFromDefinition as n, toOneNullabilityContradictionMessage as r, applySqlSpecifierControlPolicy as t };\n\n//# sourceMappingURL=derived-checks-D_-1X7be.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qCAAqC,UAAU,eAAe;CACtE,OAAO,kBAAkB,sBAAsB,GAAG,SAAS,8DAA8D,GAAG,SAAS;AACtI;AAGA,SAAS,eAAe,OAAO,SAAS,aAAa;CACpD,MAAM,QAAQ,aAAa,IAAI,OAAO;CACtC,IAAI,OAAO,OAAO,MAAM,WAAW,KAAK;CACxC,OAAO,UAAU,KAAK;AACvB;AACA,SAAS,oBAAoB,cAAc,SAAS,aAAa,OAAO,OAAO;CAC9E,IAAI,aAAa,SAAS,YAAY,OAAO;EAC5C,MAAM;EACN,YAAY,aAAa;CAC1B;CACA,IAAI,MAAM;EACT,IAAI,CAAC,MAAM,QAAQ,aAAa,KAAK,GAAG,MAAM,IAAI,cAAc,+DAA+D,OAAO,aAAa,MAAM,8EAA8E;EACvO,OAAO;GACN,MAAM;GACN,OAAO,aAAa,MAAM,KAAK,YAAY,eAAe,SAAS,SAAS,WAAW,CAAC;EACzF;CACD;CACA,OAAO;EACN,MAAM;EACN,OAAO,eAAe,aAAa,OAAO,SAAS,WAAW;CAC/D;AACD;AACA,SAAS,uBAAuB,YAAY,UAAU;CACrD,MAAM,iBAAiB,yBAAyB,SAAS,OAAO;CAChE,IAAI,eAAe,SAAS,GAAG,MAAM,cAAc,8BAA8B,wCAAwC,eAAe,KAAK,IAAI,KAAK,EAAE,MAAM,EAAE,QAAQ,eAAe,EAAE,CAAC;CAC1L,MAAM,oBAAoB,wBAAwB;CAClD,MAAM,kBAAkB,CAAC,WAAW,QAAQ,GAAG,OAAO,OAA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C,OAAO,IAAI,aAAa;EACvB,SAAS,MAAM;EACf,SAAS,MAAM;EACf,SAAS,MAAM;EACf,aAAa,MAAM;EACnB,GAAG,UAAU,cAAc,MAAM,UAAU;EAC3C,GAAG,UAAU,WAAW,MAAM,OAAO;EACrC,GAAG,KAAK,SAAS,IAAI,EAAE,QAAQ,KAAK,KAAK,UAAU,mCAAmC;GACrF,MAAM,MAAM;GACZ,GAAG,UAAU,UAAU,MAAM,MAAM;GACnC,YAAY,MAAM;EACnB,CAAC,CAAC,EAAE,IAAI,CAAC;CACV,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"derived-checks-DGjY5t7S-B3txNm7X.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-ts/dist/derived-checks-DGjY5t7S.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { computeExecutionHash, computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { asNamespaceId, coreHash, crossRef, effectiveControlPolicy } from \"@internal/contract/types\";\nimport { mergeCapabilityMatrices, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { flushAuthoringWarnings, isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { lowerAuthoredCheck } from \"@internal/sql-contract/authored-check-naming\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { tableEntityKind, valueSetEntityKind } from \"@internal/sql-contract/entity-kinds\";\nimport { materializeForeignKeysAndIndexes } from \"@internal/sql-contract/foreign-key-materialization\";\nimport { lowerAuthoredIndex } from \"@internal/sql-contract/index-naming\";\nimport { validateIndexTypes } from \"@internal/sql-contract/index-type-validation\";\nimport { createIndexTypeRegistry } from \"@internal/sql-contract/index-types\";\nimport { CheckConstraint, Index, SqlStorage, StorageTable, applyFkDefaults, checkConstraintInputFromSerialized, isMaterializedSqlNamespace, toStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { validateStorageSemantics } from \"@internal/sql-contract/validators\";\nimport { deriveValueSetFromEntity } from \"@internal/sql-contract/value-set-derivation-hook\";\nimport { composeCheckWirePrefix, computeCheckContentHash, derivedCheckPrefixes } from \"@internal/sql-schema-ir/naming\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/contract-errors.ts\nfunction contractError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/to-one-nullability-message.ts\nfunction toOneNullabilityContradictionMessage(location, contradiction) {\n\treturn contradiction === \"declared-optional\" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`;\n}\n//#endregion\n//#region src/build-contract.ts\nfunction encodeViaCodec(value, codecId, codecLookup) {\n\tconst codec = codecLookup?.get(codecId);\n\tif (codec) return codec.encodeJson(value);\n\treturn blindCast(value);\n}\nfunction encodeColumnDefault(defaultInput, codecId, codecLookup, many = false) {\n\tif (defaultInput.kind === \"function\") return {\n\t\tkind: \"function\",\n\t\texpression: defaultInput.expression\n\t};\n\tif (many) {\n\t\tif (!Array.isArray(defaultInput.value)) throw new InternalError(`Literal default on a list column must be an array; received ${typeof defaultInput.value}. A scalar default on a list field must be rejected at the authoring surface.`);\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: defaultInput.value.map((element) => encodeViaCodec(element, codecId, codecLookup))\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: encodeViaCodec(defaultInput.value, codecId, codecLookup)\n\t};\n}\nfunction assertStorageSemantics(definition, contract) {\n\tconst semanticErrors = validateStorageSemantics(contract.storage);\n\tif (semanticErrors.length > 0) throw contractError(\"CONTRACT.VALIDATION_FAILED\", `Contract semantic validation failed: ${semanticErrors.join(\"; \")}`, { meta: { errors: semanticErrors } });\n\tconst indexTypeRegistry = createIndexTypeRegistry();\n\tconst packsToRegister = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const pack of packsToRegister) {\n\t\tconst registration = pack.indexTypes;\n\t\tif (registration === void 0) continue;\n\t\tif (typeof registration !== \"object\" || registration === null || !Array.isArray(registration.entries)) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack \"${pack.id ?? \"<unknown>\"}\" declares \"indexTypes\" but its value is not an IndexTypeRegistration (expected an object with an \"entries\" array; got ${typeof registration}).`, { meta: {\n\t\t\tpackId: pack.id,\n\t\t\tcontribution: \"indexTypes\",\n\t\t\treason: \"invalid-shape\"\n\t\t} });\n\t\tfor (const entry of registration.entries) indexTypeRegistry.register(entry);\n\t}\n\tvalidateIndexTypes(contract, indexTypeRegistry);\n}\nfunction assertKnownTargetModel(modelsByName, modelsByCoordinate, sourceModelName, targetModelName, targetNamespaceId, context) {\n\tconst targetModel = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? modelsByCoordinate.get(`${targetNamespaceId}:${targetModelName}`) : modelsByName.get(targetModelName);\n\tif (!targetModel) {\n\t\tconst qualified = targetNamespaceId !== void 0 && targetNamespaceId.length > 0 ? `${targetNamespaceId}.${targetModelName}` : targetModelName;\n\t\tthrow contractError(\"CONTRACT.MODEL_UNKNOWN\", `${context} on model \"${sourceModelName}\" references unknown model \"${qualified}\"`, { meta: {\n\t\t\tsourceModel: sourceModelName,\n\t\t\ttargetModel: qualified,\n\t\t\tcontext\n\t\t} });\n\t}\n\treturn targetModel;\n}\nfunction assertTargetTableMatches(sourceModelName, targetModel, referencedTableName, context) {\n\tif (targetModel.tableName !== referencedTableName) throw contractError(\"CONTRACT.TABLE_MISMATCH\", `${context} on model \"${sourceModelName}\" references table \"${referencedTableName}\" but model \"${targetModel.modelName}\" maps to \"${targetModel.tableName}\"`, { meta: {\n\t\tsourceModel: sourceModelName,\n\t\treferencedTable: referencedTableName,\n\t\tmappedTable: targetModel.tableName,\n\t\tcontext\n\t} });\n}\nfunction isValueObjectField(field) {\n\treturn \"valueObjectName\" in field;\n}\n/**\n* Resolves a deferred entity-ref column descriptor (e.g. a `pg.enum(handle)`\n* column) against the field's now-known owning namespace: attaches the\n* storage `valueSet` ref the collected entity's derived value-set is stored\n* under. `nativeType` / `typeParams.typeName` stay bare here — schema\n* qualification (e.g. `auth.aal_level`) is a target concern applied in the\n* next step, `qualifyColumnDescriptor`. A descriptor with no `entityRef` (the\n* ordinary case) passes through unchanged.\n*/\nfunction resolveEntityRefDescriptor(descriptor, namespaceId) {\n\tconst entityRef = descriptor.entityRef;\n\tif (entityRef === void 0) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tvalueSet: {\n\t\t\tplane: \"storage\",\n\t\t\tentityKind: \"valueSet\",\n\t\t\tnamespaceId,\n\t\t\tentityName: entityRef.entityName\n\t\t}\n\t};\n}\n/**\n* Structural check for a target that contributes a `qualifyColumnType` hook\n* on its authoring contributions. Duck-typed (mirroring\n* `contract-psl`'s `hasColumnFromEntityHook`) so the SQL family stays blind\n* to the target's qualification logic and no framework/family interface has\n* to name the hook.\n*/\nfunction hasColumnTypeQualifier(authoring) {\n\treturn \"qualifyColumnType\" in authoring && typeof authoring.qualifyColumnType === \"function\";\n}\n/**\n* Structural check for a target that contributes a `renderCheckExpressions`\n* hook, duck-typed for the same reason {@link hasColumnTypeQualifier} is: the\n* SQL family stays blind to the target's predicate syntax.\n*/\nfunction hasCheckExpressionRenderer(authoring) {\n\treturn \"renderCheckExpressions\" in authoring && typeof authoring.renderCheckExpressions === \"function\";\n}\nfunction resolveCheckExpressionRenderer(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasCheckExpressionRenderer(authoring) ? authoring.renderCheckExpressions : void 0;\n}\n/**\n* The member values a membership check must enforce, encoded exactly as the\n* column stores them. Membership predicates support strings and finite numbers.\n*/\nfunction checkMemberValues(handle, codecLookup) {\n\tconst encoded = handle.values.map((value) => encodeViaCodec(value, handle.codecId, codecLookup));\n\tconst values = [];\n\tfor (const value of encoded) {\n\t\tif (typeof value !== \"string\" && !(typeof value === \"number\" && Number.isFinite(value))) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to strings or finite numbers.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"unsupported-member-value\"\n\t\t} });\n\t\tif (typeof value !== typeof encoded[0]) throw contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): CHECK constraint members must encode to the same primitive type; mixed strings and numbers are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\treason: \"mixed-member-types\"\n\t\t} });\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\n/**\n* Resolves a field's authored `noCheck` kinds against its column shape:\n* the bare form (`[]`) becomes every kind the shape derives, and a named\n* kind that can never apply to the shape is an authoring error\n* (`CONTRACT.CHECK_OPTOUT_INVALID`). Returns the concrete kinds in\n* canonical ascending order — the only form the contract persists.\n*/\nfunction resolveNoCheckKinds(input) {\n\tconst derivable = [];\n\tif (input.many) derivable.push(\"elementNotNull\");\n\tif (input.isDomainEnum) derivable.push(\"membership\");\n\tconst subject = `Field \"${input.modelName}.${input.fieldName}\"`;\n\tconst meta = {\n\t\tmodelName: input.modelName,\n\t\tfieldName: input.fieldName\n\t};\n\tif (input.kinds.length === 0) {\n\t\tif (derivable.length === 0) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck() waives nothing — this column's shape derives no generated checks.`, { meta: {\n\t\t\t...meta,\n\t\t\treason: \"no-derivable-checks\"\n\t\t} });\n\t\treturn derivable;\n\t}\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const kind of input.kinds) {\n\t\tif (seen.has(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") names the same kind twice.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"duplicate-kind\"\n\t\t} });\n\t\tseen.add(kind);\n\t\tif (!derivable.includes(kind)) throw contractError(\"CONTRACT.CHECK_OPTOUT_INVALID\", `${subject}: noCheck(\"${kind}\") does not apply — ${kind === \"membership\" ? \"membership checks are derived only from enumType() value sets\" : \"element-non-null checks are derived only for list columns\"}.`, { meta: {\n\t\t\t...meta,\n\t\t\tkind,\n\t\t\treason: \"inapplicable-kind\"\n\t\t} });\n\t}\n\treturn [...input.kinds].sort();\n}\n/**\n* Names the target's rendered checks and lowers them into contract entities.\n*\n* Naming is composed family-side ({@link composeCheckWirePrefix}) rather than\n* by the target, and suffixed with the predicate's content hash. Composing\n* family-side is what makes the truncation safe — two prefixes that truncate\n* alike still differ in their hashes, and the family can see that the\n* (table, column, kind) triple they were built from is unique per table,\n* rather than having to assume something about SQL text it declares itself\n* unable to read.\n*/\nfunction lowerRenderedChecks(tableName, candidates) {\n\treturn candidates.map((candidate) => new CheckConstraint({\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix: composeCheckWirePrefix(tableName, candidate.columnName, candidate.kind),\n\t\t\thash: computeCheckContentHash(candidate.expression)\n\t\t},\n\t\texpression: candidate.expression\n\t}));\n}\nfunction resolveColumnTypeQualifier(target) {\n\tconst authoring = target.authoring;\n\tif (authoring === void 0) return void 0;\n\treturn hasColumnTypeQualifier(authoring) ? authoring.qualifyColumnType : void 0;\n}\n/**\n* Applies the target's `qualifyColumnType` hook to a scalar column descriptor\n* at construction, so the storage column and the domain field (which derives\n* its `type.typeParams` from the storage column) are both built already\n* qualified in a single pass. A descriptor whose codec the target leaves\n* unchanged passes through untouched.\n*/\nfunction qualifyColumnDescriptor(descriptor, namespaceId, qualify) {\n\tif (qualify === void 0) return descriptor;\n\tconst qualified = qualify({\n\t\tcodecId: descriptor.codecId,\n\t\tnativeType: descriptor.nativeType,\n\t\t...ifDefined(\"typeParams\", descriptor.typeParams)\n\t}, namespaceId);\n\tif (qualified.nativeType === descriptor.nativeType && qualified.typeParams === descriptor.typeParams) return descriptor;\n\treturn {\n\t\t...descriptor,\n\t\tnativeType: qualified.nativeType,\n\t\t...ifDefined(\"typeParams\", qualified.typeParams)\n\t};\n}\n/**\n* Records a deferred column's entity-ref into the namespace-scoped collection\n* accumulator (`namespaceId → entityKind → entityName`) — folded into the same\n* namespace assembly `deriveEntityValueSets`/`entries.<kind>` step as the\n* entities-channel attachments, so a column-collected entity gets its\n* value-set the same way an entities-channel one does.\n*\n* The same handle reused by many columns in one namespace is normal (a native\n* enum type backs any number of columns) and records the identical entity once.\n* Two *different* entity instances sharing a name+kind in one namespace is a\n* name collision — the emitted `entries.valueSet.<name>` could only reflect one\n* of them, silently mismatching the other column's type/cast. PSL hard-errors\n* on the equivalent (`PSL_DUPLICATE_DECLARATION`); the TS path rejects it too.\n*/\nfunction collectEntityFromColumn(collected, namespaceId, entityRef) {\n\tconst forNs = collected[namespaceId] ?? {};\n\tconst forKind = forNs[entityRef.entityKind] ?? {};\n\tconst existing = forKind[entityRef.entityName];\n\tif (existing !== void 0 && existing !== entityRef.entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${entityRef.entityKind}\" entities named \"${entityRef.entityName}\" in namespace \"${namespaceId}\" — pack-entity names must be unique per namespace.`, { meta: {\n\t\tkind: entityRef.entityKind,\n\t\tname: entityRef.entityName,\n\t\tnamespaceId\n\t} });\n\tforKind[entityRef.entityName] = entityRef.entity;\n\tforNs[entityRef.entityKind] = forKind;\n\tcollected[namespaceId] = forNs;\n}\n/**\n* Merges a namespace's entities-channel attachments (lowered from the\n* `entities` handle list, carried on `ContractDefinition.attachedEntities`)\n* with the entities collected from that namespace's deferred entity-ref\n* columns. A column-collected entity that shadows a *different* attached\n* entity of the same kind+name (or vice-versa) is the same name-collision bug\n* `collectEntityFromColumn` guards against across columns, so it is rejected\n* the same way — by entity identity, so the same handle attached and used by\n* a column does not throw.\n*/\nfunction mergeColumnAndAttachedEntities(namespaceId, attached, columnCollected) {\n\tif (attached === void 0) return columnCollected;\n\tif (columnCollected === void 0) return attached;\n\tconst kinds = /* @__PURE__ */ new Set([...Object.keys(attached), ...Object.keys(columnCollected)]);\n\tconst result = {};\n\tfor (const kind of kinds) {\n\t\tconst attachedForKind = attached[kind];\n\t\tconst columnForKind = columnCollected[kind];\n\t\tfor (const [name, entity] of Object.entries(columnForKind ?? {})) {\n\t\t\tconst existing = attachedForKind?.[name];\n\t\t\tif (existing !== void 0 && existing !== entity) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: two different \"${kind}\" entities named \"${name}\" in namespace \"${namespaceId}\" — a column-referenced entity conflicts with an attached one; pack-entity names must be unique per namespace.`, { meta: {\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t}\n\t\tresult[kind] = {\n\t\t\t...attachedForKind,\n\t\t\t...columnForKind\n\t\t};\n\t}\n\treturn result;\n}\nconst JSONB_CODEC_ID = \"pg/jsonb@1\";\nconst JSONB_NATIVE_TYPE = \"jsonb\";\nfunction resolveModelNamespaceId(model, modelNameToNamespaceId, defaultNamespaceId) {\n\tif (model.namespaceId !== void 0 && model.namespaceId.length > 0) return model.namespaceId;\n\treturn modelNameToNamespaceId.get(model.modelName) ?? defaultNamespaceId;\n}\nfunction toOneRelationNullable(semanticModel, relation) {\n\tconst location = `Relation \"${semanticModel.modelName}.${relation.fieldName}\"`;\n\tif (relation.nullable === void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", `${location} with cardinality \"${relation.cardinality}\" must state whether it is nullable`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-missing\"\n\t} });\n\tconst localColumns = relation.on.parentColumns;\n\tconst { contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relation.nullable,\n\t\tlocalFieldNullability: semanticModel.fields.filter((field) => localColumns.includes(field.columnName)).map((field) => field.nullable),\n\t\townsReference: relation.cardinality === \"N:1\"\n\t});\n\tif (contradiction !== void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", relation.cardinality === \"N:1\" ? toOneNullabilityContradictionMessage(location, contradiction) : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related row exists`, { meta: {\n\t\tmodelName: semanticModel.modelName,\n\t\trelationName: relation.fieldName,\n\t\treason: \"to-one-nullability-mismatch\"\n\t} });\n\treturn relation.nullable;\n}\nfunction buildThroughDescriptor(through, tableNamespaceByName, targetModel, modelName, fieldName, defaultNamespaceId) {\n\tif (!tableNamespaceByName.has(through.table)) throw contractError(\"CONTRACT.MODEL_UNKNOWN\", `buildSqlContractFromDefinition: junction table \"${through.table}\" for relation \"${modelName}.${fieldName}\" is not a declared model.`, { meta: {\n\t\tsourceModel: modelName,\n\t\trelationName: fieldName,\n\t\tjunctionTable: through.table\n\t} });\n\tconst namespaceId = through.namespaceId ?? defaultNamespaceId;\n\treturn {\n\t\ttable: through.table,\n\t\tnamespaceId,\n\t\tparentColumns: through.parentColumns,\n\t\tchildColumns: through.childColumns,\n\t\ttargetColumns: targetColumnsForJunction(targetModel, fieldName)\n\t};\n}\nfunction targetColumnsForJunction(targetModel, fieldName) {\n\tconst primaryKeyColumns = targetModel.id?.columns;\n\tif (primaryKeyColumns && primaryKeyColumns.length > 0) return primaryKeyColumns;\n\tconst firstUnique = targetModel.uniques?.find((u) => u.columns.length > 0);\n\tif (firstUnique) return firstUnique.columns;\n\tthrow contractError(\"CONTRACT.IDENTITY_INVALID\", `M:N target model \"${targetModel.modelName}\" (relation field \"${fieldName}\") has no primary id or unique key to derive junction targetColumns.`, { meta: {\n\t\tmodelName: targetModel.modelName,\n\t\treason: \"no-key-for-junction-target-columns\"\n\t} });\n}\nfunction buildStorageColumn(field, storageValueSetRef, codecLookup) {\n\tif (isValueObjectField(field)) {\n\t\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, JSONB_CODEC_ID, codecLookup) : void 0;\n\t\treturn {\n\t\t\tnativeType: JSONB_NATIVE_TYPE,\n\t\t\tcodecId: JSONB_CODEC_ID,\n\t\t\tnullable: field.nullable,\n\t\t\t...ifDefined(\"default\", encodedDefault)\n\t\t};\n\t}\n\tconst codecId = field.descriptor.codecId;\n\tconst encodedDefault = field.default !== void 0 ? encodeColumnDefault(field.default, codecId, codecLookup, field.many === true) : void 0;\n\tconst valueSet = storageValueSetRef ?? field.descriptor.valueSet;\n\treturn {\n\t\tnativeType: field.descriptor.nativeType,\n\t\tcodecId,\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...field.noCheck !== void 0 ? { noCheck: [...field.noCheck].sort() } : {},\n\t\t...ifDefined(\"typeParams\", field.descriptor.typeParams),\n\t\t...ifDefined(\"default\", encodedDefault),\n\t\t...ifDefined(\"typeRef\", field.descriptor.typeRef),\n\t\t...ifDefined(\"valueSet\", valueSet)\n\t};\n}\nfunction buildDomainField(field, column, domainValueSetRef) {\n\tif (isValueObjectField(field)) return {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: field.valueObjectName\n\t\t},\n\t\tnullable: field.nullable,\n\t\t...field.many ? { many: true } : {}\n\t};\n\treturn {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: column.codecId,\n\t\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t\t},\n\t\tnullable: column.nullable,\n\t\t...field.many ? { many: true } : {},\n\t\t...ifDefined(\"valueSet\", domainValueSetRef)\n\t};\n}\nfunction collectStorageNamespaceCoordinateIds(definition) {\n\tconst ids = /* @__PURE__ */ new Set();\n\tids.add(definition.target.defaultNamespaceId);\n\tfor (const id of definition.namespaces ?? []) if (id.length > 0) ids.add(id);\n\tfor (const model of definition.models) if (model.namespaceId !== void 0 && model.namespaceId.length > 0) ids.add(model.namespaceId);\n\tfor (const id of Object.keys(definition.attachedEntities ?? {})) if (id.length > 0) ids.add(id);\n\treturn ids;\n}\n/**\n* Entry kinds the framework assembler itself manages (`table` from models,\n* `valueSet` from `enums` and attached-entity value-set derivation). A\n* pack-attached entity claiming one of these would silently clobber or be\n* clobbered by the managed slot, so it is rejected outright.\n*/\nconst MANAGED_ENTRY_KINDS = /* @__PURE__ */ new Set([tableEntityKind.kind, valueSetEntityKind.kind]);\nfunction assertNoManagedEntityKinds(namespaceId, entitiesForNs) {\n\tif (entitiesForNs === void 0) return;\n\tfor (const kind of Object.keys(entitiesForNs)) if (MANAGED_ENTRY_KINDS.has(kind)) throw contractError(\"CONTRACT.ENTITY_KIND_INVALID\", `buildSqlContractFromDefinition: attached entity in namespace \"${namespaceId}\" declares entry kind \"${kind}\", which is managed by the framework (table/valueSet) and cannot be attached.`, { meta: {\n\t\tentityKind: kind,\n\t\tnamespaceId\n\t} });\n}\n/**\n* Walks the flat `entityTypes` namespace tree contributed by the target pack\n* and every extension pack, indexing descriptors by their `discriminator` —\n* the same string a pack entity's entries-map key (`entries.<kind>`) uses.\n* Mirrors `contract-psl`'s `buildEntityTypesByDiscriminator`, recomposed here\n* from the packs `ContractDefinition` already carries (`target` +\n* `extensions`) since the TS assembler has no single pre-merged\n* `AuthoringContributions` input to read the way the PSL interpreter does.\n*/\nfunction collectEntityTypeDescriptorsByDiscriminator(definition) {\n\tconst result = /* @__PURE__ */ new Map();\n\tconst walk = (namespace) => {\n\t\tfor (const value of Object.values(namespace)) if (isAuthoringEntityTypeDescriptor(value)) result.set(value.discriminator, value);\n\t\telse walk(value);\n\t};\n\tconst components = [definition.target, ...Object.values(definition.extensions ?? {})];\n\tfor (const component of components) {\n\t\tconst entityTypes = component.authoring?.entityTypes;\n\t\tif (entityTypes !== void 0) walk(entityTypes);\n\t}\n\treturn result;\n}\n/**\n* Derives value-sets for every pack entity declared in one namespace,\n* reusing the same `SqlValueSetDerivingEntityTypeOutput.deriveValueSet` hook\n* `contract-psl`'s `lowerExtensionBlocksForNamespace` folds into\n* `entries.valueSet` on the PSL path — so a TS-attached entity (e.g. a\n* native enum) gets its value-set the same way. Entity kinds with no\n* registered descriptor, or whose descriptor output doesn't derive a\n* value-set, contribute nothing.\n*/\nfunction deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator) {\n\tif (entitiesForNs === void 0) return void 0;\n\tlet result;\n\tfor (const [kind, entitiesByName] of Object.entries(entitiesForNs)) {\n\t\tconst descriptor = entityTypesByDiscriminator.get(kind);\n\t\tif (descriptor === void 0) continue;\n\t\tfor (const [name, entity] of Object.entries(entitiesByName)) {\n\t\t\tconst derivedValueSet = deriveValueSetFromEntity(descriptor.output, entity);\n\t\t\tif (derivedValueSet === void 0) continue;\n\t\t\tresult ??= {};\n\t\t\tresult[name] = derivedValueSet;\n\t\t}\n\t}\n\treturn result;\n}\n/**\n* Merges a namespace's `enumType()`-derived value-sets with its pack-entity-\n* derived value-sets. Both land in the same `entries.valueSet[name]` slot —\n* which drives value-set → codec typing and the domain-enum CHECK — so a\n* same-named entry in both would let one silently overwrite the other and\n* corrupt whichever column resolves against it. The same collision class the\n* `mergeColumnAndAttachedEntities` guard rejects; the PSL path already hard-errors\n* on the equivalent (`interpretPslDocumentToSqlContract`). Reject it here too.\n*/\nfunction mergeNamespaceValueSets(namespaceId, enumValueSets, packValueSets) {\n\tif (enumValueSets !== void 0 && packValueSets !== void 0) {\n\t\tfor (const name of Object.keys(packValueSets)) if (Object.hasOwn(enumValueSets, name)) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: value-set \"${name}\" in namespace \"${namespaceId}\" is derived from both an enum and a pack entity — names must be unique per namespace.`, { meta: {\n\t\t\tkind: \"valueSet\",\n\t\t\tname,\n\t\t\tnamespaceId\n\t\t} });\n\t}\n\treturn {\n\t\t...enumValueSets,\n\t\t...packValueSets\n\t};\n}\nfunction ensureUnboundNamespaceSlot(namespaces, createNamespace) {\n\tif (Object.hasOwn(namespaces, UNBOUND_NAMESPACE_ID)) return namespaces;\n\tconst unbound = createNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: { table: {} }\n\t});\n\treturn {\n\t\t[UNBOUND_NAMESPACE_ID]: unbound,\n\t\t...namespaces\n\t};\n}\nconst DERIVABLE_CHECK_KINDS = [\"membership\", \"elementNotNull\"];\n/**\n* Which of `columnNames` could have produced `prefix` for some\n* {@link CheckKind} — the reverse of {@link derivedCheckPrefixes}, used only\n* to name the collision in `CONTRACT.CHECK_NAME_RESERVED`'s message. Callers\n* already know `prefix` is a member of `derivedCheckPrefixes(tableName,\n* columnNames)`, so the result is never empty.\n*/\nfunction columnsProducingCheckPrefix(tableName, columnNames, prefix) {\n\treturn columnNames.filter((columnName) => DERIVABLE_CHECK_KINDS.some((kind) => composeCheckWirePrefix(tableName, columnName, kind) === prefix));\n}\nfunction buildSqlContractFromDefinition(definition, codecLookup) {\n\tconst target = definition.target.targetId;\n\tconst defaultNamespaceId = definition.target.defaultNamespaceId;\n\tconst qualifyColumnType = resolveColumnTypeQualifier(definition.target);\n\tconst renderCheckExpressions = resolveCheckExpressionRenderer(definition.target);\n\tconst targetFamily = \"sql\";\n\tconst resolveNamespaceId = (m) => m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId;\n\tconst modelsByName = new Map(definition.models.map((m) => [m.modelName, m]));\n\tconst tableNamespaceByName = new Map(definition.models.map((m) => [m.tableName, m.namespaceId !== void 0 && m.namespaceId.length > 0 ? m.namespaceId : defaultNamespaceId]));\n\tconst modelsByCoordinate = new Map(definition.models.map((m) => [`${resolveNamespaceId(m)}:${m.modelName}`, m]));\n\tconst tablesByNamespace = {};\n\tconst authoringWarnings = [...definition.warnings ?? []];\n\tconst modelNameToNamespaceId = /* @__PURE__ */ new Map();\n\tconst executionDefaults = [];\n\tconst modelsByNamespace = {};\n\tconst collectedColumnEntities = {};\n\tconst rootEntries = [];\n\tfor (const semanticModel of definition.models) {\n\t\tconst tableName = semanticModel.tableName;\n\t\tconst namespaceId = semanticModel.namespaceId !== void 0 && semanticModel.namespaceId.length > 0 ? semanticModel.namespaceId : defaultNamespaceId;\n\t\tmodelNameToNamespaceId.set(semanticModel.modelName, namespaceId);\n\t\tif (!semanticModel.sharesBaseTable) rootEntries.push({\n\t\t\ttableName,\n\t\t\tnamespaceId,\n\t\t\tref: crossRef(semanticModel.modelName, namespaceId)\n\t\t});\n\t\tconst columns = {};\n\t\tconst fieldToColumn = {};\n\t\tconst domainFields = {};\n\t\tconst domainFieldRefs = {};\n\t\tconst checksForTable = [];\n\t\tconst derivesChecks = effectiveControlPolicy(semanticModel.control, definition.defaultControlPolicy) === \"managed\";\n\t\tfor (const field of semanticModel.fields) {\n\t\t\tconst executionDefaultPhases = field.executionDefaults?.onCreate || field.executionDefaults?.onUpdate ? field.executionDefaults : void 0;\n\t\t\tif (executionDefaultPhases) {\n\t\t\t\tif (field.default !== void 0) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot define both default and executionDefaults.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"default-and-executionDefaults\"\n\t\t\t\t} });\n\t\t\t\tif (field.nullable) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${semanticModel.modelName}.${field.fieldName}\" cannot be nullable when executionDefaults are present.`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\treason: \"nullable-with-executionDefaults\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tconst enumHandle = !isValueObjectField(field) ? field.enumTypeHandle : void 0;\n\t\t\tconst storageValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"storage\",\n\t\t\t\tentityKind: \"valueSet\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tconst domainValueSetRef = enumHandle !== void 0 ? {\n\t\t\t\tplane: \"domain\",\n\t\t\t\tentityKind: \"enum\",\n\t\t\t\tnamespaceId: defaultNamespaceId,\n\t\t\t\tentityName: enumHandle.enumName\n\t\t\t} : void 0;\n\t\t\tlet resolvedField = field;\n\t\t\tif (!isValueObjectField(field)) {\n\t\t\t\tlet descriptor = field.descriptor;\n\t\t\t\tconst entityRef = descriptor.entityRef;\n\t\t\t\tif (entityRef !== void 0) {\n\t\t\t\t\tcollectEntityFromColumn(collectedColumnEntities, namespaceId, entityRef);\n\t\t\t\t\tdescriptor = resolveEntityRefDescriptor(descriptor, namespaceId);\n\t\t\t\t}\n\t\t\t\tdescriptor = qualifyColumnDescriptor(descriptor, namespaceId, qualifyColumnType);\n\t\t\t\tif (descriptor !== field.descriptor) resolvedField = {\n\t\t\t\t\t...field,\n\t\t\t\t\tdescriptor\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!isValueObjectField(resolvedField) && resolvedField.noCheck !== void 0) {\n\t\t\t\tconst { noCheck: authoredNoCheck, ...withoutNoCheck } = resolvedField;\n\t\t\t\tresolvedField = derivesChecks ? {\n\t\t\t\t\t...withoutNoCheck,\n\t\t\t\t\tnoCheck: resolveNoCheckKinds({\n\t\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\t\tfieldName: field.fieldName,\n\t\t\t\t\t\tkinds: authoredNoCheck,\n\t\t\t\t\t\tmany: resolvedField.many === true,\n\t\t\t\t\t\tisDomainEnum: enumHandle !== void 0\n\t\t\t\t\t})\n\t\t\t\t} : withoutNoCheck;\n\t\t\t}\n\t\t\tconst column = buildStorageColumn(resolvedField, storageValueSetRef, codecLookup);\n\t\t\tcolumns[field.columnName] = column;\n\t\t\tfieldToColumn[field.fieldName] = field.columnName;\n\t\t\tif (renderCheckExpressions !== void 0 && derivesChecks) {\n\t\t\t\tconst waivedKinds = !isValueObjectField(resolvedField) ? resolvedField.noCheck : void 0;\n\t\t\t\tchecksForTable.push(...lowerRenderedChecks(tableName, renderCheckExpressions({\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumnName: field.columnName,\n\t\t\t\t\tmany: column.many === true,\n\t\t\t\t\tmemberValues: enumHandle !== void 0 ? checkMemberValues(enumHandle, codecLookup) : void 0\n\t\t\t\t}).filter((candidate) => !(waivedKinds?.includes(candidate.kind) ?? false))));\n\t\t\t}\n\t\t\tdomainFields[field.fieldName] = buildDomainField(field, column, domainValueSetRef);\n\t\t\tif (isValueObjectField(field)) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: field.valueObjectName,\n\t\t\t\t...field.many ? { many: true } : {}\n\t\t\t};\n\t\t\telse if (field.many) domainFieldRefs[field.fieldName] = {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tmany: true\n\t\t\t};\n\t\t\tif (executionDefaultPhases) executionDefaults.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: namespaceId,\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: field.columnName\n\t\t\t\t},\n\t\t\t\t...ifDefined(\"onCreate\", executionDefaultPhases.onCreate),\n\t\t\t\t...ifDefined(\"onUpdate\", executionDefaultPhases.onUpdate)\n\t\t\t});\n\t\t}\n\t\tconst authoringForeignKeys = (semanticModel.foreignKeys ?? []).map((fk) => {\n\t\t\tif (fk.references.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? defaultNamespaceId;\n\t\t\t\treturn {\n\t\t\t\t\tsource: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\t\ttableName,\n\t\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t\t},\n\t\t\t\t\ttarget: {\n\t\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\t\tcolumns: fk.references.columns,\n\t\t\t\t\t\tspaceId: fk.references.spaceId\n\t\t\t\t\t},\n\t\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, fk.references.model, fk.references.namespaceId, \"Foreign key\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, fk.references.table, \"Foreign key\");\n\t\t\tconst targetNamespaceId = fk.references.namespaceId ?? (targetModel.namespaceId !== void 0 && targetModel.namespaceId.length > 0 ? targetModel.namespaceId : defaultNamespaceId);\n\t\t\treturn {\n\t\t\t\tsource: {\n\t\t\t\t\tnamespaceId: asNamespaceId(namespaceId),\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumns: fk.columns\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaceId: asNamespaceId(targetNamespaceId),\n\t\t\t\t\ttableName: fk.references.table,\n\t\t\t\t\tcolumns: fk.references.columns\n\t\t\t\t},\n\t\t\t\t...applyFkDefaults({\n\t\t\t\t\t...ifDefined(\"constraint\", fk.constraint),\n\t\t\t\t\t...ifDefined(\"index\", fk.index)\n\t\t\t\t}, definition.foreignKeyDefaults),\n\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t\t\t};\n\t\t});\n\t\tif (semanticModel.sharesBaseTable && semanticModel.checks && semanticModel.checks.length > 0) throw contractError(\"CONTRACT.CHECK_ON_STI_VARIANT\", `Model \"${semanticModel.modelName}\" declares a check constraint but shares its base model's storage table (single-table inheritance) and has no table of its own to declare it on. Declare the check on the base model instead.`, { meta: {\n\t\t\ttableName,\n\t\t\tmodelName: semanticModel.modelName\n\t\t} });\n\t\tif (!semanticModel.sharesBaseTable) {\n\t\t\tconst uniques = (semanticModel.uniques ?? []).map((u) => ({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name)\n\t\t\t}));\n\t\t\tconst declaredIndexes = (semanticModel.indexes ?? []).map((i) => lowerAuthoredIndex(tableName, blindCast({\n\t\t\t\t...ifDefined(\"columns\", i.columns),\n\t\t\t\t...ifDefined(\"expression\", i.expression),\n\t\t\t\twhere: i.where,\n\t\t\t\tunique: i.unique,\n\t\t\t\tmap: i.map,\n\t\t\t\tname: i.name,\n\t\t\t\ttype: i.type,\n\t\t\t\toptions: i.options\n\t\t\t}), authoringWarnings));\n\t\t\tif (semanticModel.checks !== void 0 && semanticModel.checks.length > 0) {\n\t\t\t\tconst tableColumnNames = Object.keys(columns);\n\t\t\t\tconst reservedCheckPrefixes = derivedCheckPrefixes(tableName, tableColumnNames);\n\t\t\t\tfor (const authoredCheck of semanticModel.checks) {\n\t\t\t\t\tconst lowered = lowerAuthoredCheck(tableName, authoredCheck, authoringWarnings);\n\t\t\t\t\tif (lowered.naming.kind === \"wire\" && reservedCheckPrefixes.has(lowered.naming.prefix)) {\n\t\t\t\t\t\tconst collidingColumns = columnsProducingCheckPrefix(tableName, tableColumnNames, lowered.naming.prefix);\n\t\t\t\t\t\tconst columnList = collidingColumns.map((name) => `\"${name}\"`).join(\", \");\n\t\t\t\t\t\tthrow contractError(\"CONTRACT.CHECK_NAME_RESERVED\", `Check \"${lowered.naming.prefix}\" on table \"${tableName}\": this name's prefix matches the shape a derived enforcement check would use for column${collidingColumns.length === 1 ? \"\" : \"s\"} ${columnList} of this table, so it can't be told apart from one. Choose a different name.`, { meta: {\n\t\t\t\t\t\t\ttableName,\n\t\t\t\t\t\t\tprefix: lowered.naming.prefix,\n\t\t\t\t\t\t\tcollidingColumns\n\t\t\t\t\t\t} });\n\t\t\t\t\t}\n\t\t\t\t\tchecksForTable.push(new CheckConstraint(lowered));\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst primaryKey = semanticModel.id ? {\n\t\t\t\tcolumns: semanticModel.id.columns,\n\t\t\t\t...ifDefined(\"name\", semanticModel.id.name)\n\t\t\t} : void 0;\n\t\t\tconst { foreignKeys, indexes } = materializeForeignKeysAndIndexes(tableName, authoringForeignKeys, declaredIndexes, uniques, primaryKey);\n\t\t\tconst tableInput = {\n\t\t\t\tcolumns,\n\t\t\t\t...ifDefined(\"control\", semanticModel.control),\n\t\t\t\tuniques,\n\t\t\t\tindexes: indexes.map((i) => new Index(i)),\n\t\t\t\tforeignKeys,\n\t\t\t\t...primaryKey ? { primaryKey } : {},\n\t\t\t\t...checksForTable.length > 0 ? { checks: checksForTable } : {}\n\t\t\t};\n\t\t\tlet nsTables = tablesByNamespace[namespaceId];\n\t\t\tif (nsTables === void 0) {\n\t\t\t\tnsTables = {};\n\t\t\t\ttablesByNamespace[namespaceId] = nsTables;\n\t\t\t}\n\t\t\tif (nsTables[tableName] !== void 0) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `buildSqlContractFromDefinition: duplicate table \"${tableName}\" in namespace \"${namespaceId}\".`, { meta: {\n\t\t\t\tkind: \"table\",\n\t\t\t\tname: tableName,\n\t\t\t\tnamespaceId\n\t\t\t} });\n\t\t\tnsTables[tableName] = tableInput;\n\t\t}\n\t\tconst storageFields = {};\n\t\tfor (const [fieldName, columnName] of Object.entries(fieldToColumn)) storageFields[fieldName] = { column: columnName };\n\t\tconst columnToField = new Map(Object.entries(fieldToColumn).map(([field, col]) => [col, field]));\n\t\tconst modelRelations = {};\n\t\tfor (const relation of semanticModel.relations ?? []) {\n\t\t\tif (relation.spaceId !== void 0) {\n\t\t\t\tconst targetNamespaceId = relation.namespaceId ?? defaultNamespaceId;\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto: crossRef(relation.toModel, targetNamespaceId, relation.spaceId),\n\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\t\ton: {\n\t\t\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\t\t\ttargetFields: relation.on.childColumns\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst targetModel = assertKnownTargetModel(modelsByName, modelsByCoordinate, semanticModel.modelName, relation.toModel, relation.toNamespaceId, \"Relation\");\n\t\t\tassertTargetTableMatches(semanticModel.modelName, targetModel, relation.toTable, \"Relation\");\n\t\t\tconst targetColumnToField = new Map(targetModel.fields.map((f) => [f.columnName, f.fieldName]));\n\t\t\tconst to = crossRef(relation.toModel, relation.toNamespaceId !== void 0 && relation.toNamespaceId.length > 0 ? relation.toNamespaceId : resolveModelNamespaceId(targetModel, modelNameToNamespaceId, defaultNamespaceId));\n\t\t\tconst on = {\n\t\t\t\tlocalFields: relation.on.parentColumns.map((col) => columnToField.get(col) ?? col),\n\t\t\t\ttargetFields: relation.on.childColumns.map((col) => targetColumnToField.get(col) ?? col)\n\t\t\t};\n\t\t\tif (relation.cardinality === \"N:M\") {\n\t\t\t\tif (!relation.through) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${semanticModel.modelName}.${relation.fieldName}\" with cardinality \"N:M\" requires through metadata`, { meta: {\n\t\t\t\t\tmodelName: semanticModel.modelName,\n\t\t\t\t\trelationName: relation.fieldName,\n\t\t\t\t\treason: \"many-to-many-missing-through\"\n\t\t\t\t} });\n\t\t\t\tmodelRelations[relation.fieldName] = {\n\t\t\t\t\tto,\n\t\t\t\t\tcardinality: \"N:M\",\n\t\t\t\t\ton,\n\t\t\t\t\tthrough: buildThroughDescriptor(relation.through, tableNamespaceByName, targetModel, semanticModel.modelName, relation.fieldName, defaultNamespaceId)\n\t\t\t\t};\n\t\t\t} else if (relation.cardinality === \"1:N\") modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: \"1:N\",\n\t\t\t\ton\n\t\t\t};\n\t\t\telse modelRelations[relation.fieldName] = {\n\t\t\t\tto,\n\t\t\t\tcardinality: relation.cardinality,\n\t\t\t\tnullable: toOneRelationNullable(semanticModel, relation),\n\t\t\t\ton\n\t\t\t};\n\t\t}\n\t\tlet namespaceModels = modelsByNamespace[namespaceId];\n\t\tif (namespaceModels === void 0) {\n\t\t\tnamespaceModels = {};\n\t\t\tmodelsByNamespace[namespaceId] = namespaceModels;\n\t\t}\n\t\tnamespaceModels[semanticModel.modelName] = {\n\t\t\tstorage: {\n\t\t\t\ttable: tableName,\n\t\t\t\tnamespaceId,\n\t\t\t\tfields: storageFields\n\t\t\t},\n\t\t\tfields: domainFields,\n\t\t\trelations: modelRelations\n\t\t};\n\t}\n\tconst rootTableNameCounts = /* @__PURE__ */ new Map();\n\tfor (const entry of rootEntries) rootTableNameCounts.set(entry.tableName, (rootTableNameCounts.get(entry.tableName) ?? 0) + 1);\n\tconst roots = {};\n\tfor (const entry of rootEntries) {\n\t\tconst key = (rootTableNameCounts.get(entry.tableName) ?? 0) > 1 ? `${entry.namespaceId}.${entry.tableName}` : entry.tableName;\n\t\troots[key] = entry.ref;\n\t}\n\tconst rawStorageTypes = definition.storageTypes ?? {};\n\tconst documentTypes = Object.fromEntries(Object.entries(rawStorageTypes).map(([name, entry]) => {\n\t\tif (entry.kind === \"codec-instance\") return [name, entry];\n\t\treturn [name, toStorageTypeInstance({\n\t\t\tcodecId: entry.codecId,\n\t\t\tnativeType: entry.nativeType,\n\t\t\ttypeParams: entry.typeParams ?? {}\n\t\t})];\n\t}));\n\tconst namespaceCoordinateIds = collectStorageNamespaceCoordinateIds(definition);\n\tconst domainEnumsByNs = {};\n\tconst storageValueSetsByNs = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tif (enumName !== handle.enumName) throw contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${enumName}\" must match enumType name \"${handle.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tdeclarationKey: enumName,\n\t\t\treason: \"key-name-mismatch\"\n\t\t} });\n\t\tconst nsId = defaultNamespaceId;\n\t\tlet domainSlot = domainEnumsByNs[nsId];\n\t\tif (domainSlot === void 0) {\n\t\t\tdomainSlot = {};\n\t\t\tdomainEnumsByNs[nsId] = domainSlot;\n\t\t}\n\t\tdomainSlot[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: encodeViaCodec(m.value, handle.codecId, codecLookup)\n\t\t\t}))\n\t\t};\n\t\tlet storageSlot = storageValueSetsByNs[nsId];\n\t\tif (storageSlot === void 0) {\n\t\t\tstorageSlot = {};\n\t\t\tstorageValueSetsByNs[nsId] = storageSlot;\n\t\t}\n\t\tstorageSlot[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: handle.values.map((v) => encodeViaCodec(v, handle.codecId, codecLookup))\n\t\t};\n\t}\n\tconst { createNamespace } = definition;\n\tconst entityTypesByDiscriminator = collectEntityTypeDescriptorsByDiscriminator(definition);\n\tconst namespaces = Object.fromEntries([...namespaceCoordinateIds].sort().map((id) => {\n\t\tconst entitiesForNs = mergeColumnAndAttachedEntities(id, definition.attachedEntities?.[id], collectedColumnEntities[id]);\n\t\tassertNoManagedEntityKinds(id, entitiesForNs);\n\t\tconst enumValueSetEntries = storageValueSetsByNs[id];\n\t\tconst packValueSetEntries = deriveEntityValueSets(entitiesForNs, entityTypesByDiscriminator);\n\t\tconst valueSetEntries = enumValueSetEntries !== void 0 || packValueSetEntries !== void 0 ? mergeNamespaceValueSets(id, enumValueSetEntries, packValueSetEntries) : void 0;\n\t\tconst nsInput = {\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\ttable: tablesByNamespace[id] ?? {},\n\t\t\t\t...entitiesForNs,\n\t\t\t\t...valueSetEntries !== void 0 && Object.keys(valueSetEntries).length > 0 ? { valueSet: valueSetEntries } : {}\n\t\t\t}\n\t\t};\n\t\treturn [id, createNamespace(nsInput)];\n\t}));\n\tconst storageWithoutHash = {\n\t\t...Object.keys(documentTypes).length > 0 ? { types: documentTypes } : {},\n\t\tnamespaces: defaultNamespaceId === UNBOUND_NAMESPACE_ID ? ensureUnboundNamespaceSlot(namespaces, createNamespace) : namespaces\n\t};\n\tconst storageHash = definition.storageHash ? coreHash(definition.storageHash) : computeStorageHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tstorage: storageWithoutHash,\n\t\t...sqlContractCanonicalizationHooks\n\t});\n\tconst storage = new SqlStorage({\n\t\t...storageWithoutHash,\n\t\tstorageHash\n\t});\n\tconst executionSection = executionDefaults.length > 0 ? { mutations: { defaults: executionDefaults.sort((a, b) => {\n\t\tconst tableCompare = a.ref.table.localeCompare(b.ref.table);\n\t\tif (tableCompare !== 0) return tableCompare;\n\t\treturn a.ref.column.localeCompare(b.ref.column);\n\t}) } } : void 0;\n\tconst extensionNamespaces = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.id) : void 0;\n\tconst extensions = { ...definition.extensions || {} };\n\tif (extensionNamespaces) {\n\t\tfor (const namespace of extensionNamespaces) if (!Object.hasOwn(extensions, namespace)) extensions[namespace] = {};\n\t}\n\tconst extensionPackCapabilitySources = definition.extensions ? Object.values(definition.extensions).map((pack) => pack.capabilities) : [];\n\tconst capabilities = mergeCapabilityMatrices(definition.target.capabilities, ...extensionPackCapabilitySources);\n\tconst profileHash = computeProfileHash({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tcapabilities: {}\n\t});\n\tconst executionWithHash = executionSection ? {\n\t\t...executionSection,\n\t\texecutionHash: computeExecutionHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\texecution: executionSection\n\t\t})\n\t} : void 0;\n\tconst valueObjects = definition.valueObjects && definition.valueObjects.length > 0 ? Object.fromEntries(definition.valueObjects.map((vo) => [vo.name, { fields: Object.fromEntries(vo.fields.map((f) => [f.fieldName, isValueObjectField(f) ? {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: f.valueObjectName\n\t\t},\n\t\tnullable: f.nullable,\n\t\t...f.many ? { many: true } : {}\n\t} : {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: f.descriptor.codecId,\n\t\t\t...ifDefined(\"typeParams\", f.descriptor.typeParams)\n\t\t},\n\t\tnullable: f.nullable\n\t}])) }])) : void 0;\n\tconst domainNamespaceIds = new Set(Object.keys(modelsByNamespace));\n\tif (domainNamespaceIds.size === 0) domainNamespaceIds.add(defaultNamespaceId);\n\tif (valueObjects !== void 0) domainNamespaceIds.add(defaultNamespaceId);\n\tfor (const nsId of Object.keys(domainEnumsByNs)) domainNamespaceIds.add(nsId);\n\tconst domainNamespaces = Object.fromEntries([...domainNamespaceIds].sort().map((namespaceId) => {\n\t\tconst modelsInNs = modelsByNamespace[namespaceId] ?? {};\n\t\tconst enumsInNs = domainEnumsByNs[namespaceId];\n\t\treturn [namespaceId, {\n\t\t\tmodels: modelsInNs,\n\t\t\t...namespaceId === defaultNamespaceId && valueObjects !== void 0 ? { valueObjects } : {},\n\t\t\t...enumsInNs !== void 0 && Object.keys(enumsInNs).length > 0 ? { enum: enumsInNs } : {}\n\t\t}];\n\t}));\n\tconst contract = {\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\tdomain: { namespaces: domainNamespaces },\n\t\troots,\n\t\tstorage,\n\t\t...executionWithHash ? { execution: executionWithHash } : {},\n\t\textensions,\n\t\tcapabilities,\n\t\tprofileHash,\n\t\tmeta: {}\n\t};\n\tassertStorageSemantics(definition, contract);\n\tflushAuthoringWarnings(authoringWarnings);\n\treturn contract;\n}\n//#endregion\n//#region src/derived-checks.ts\n/**\n* The one step every SQL contract specifier funnels its loaded contract\n* through: stamp the specifier's default control policy, then strip derived\n* checks from every table the stamped policy leaves non-managed. Composing the\n* two here is what keeps the managed-only consequence from being skipped on\n* any specifier route.\n*/\nfunction applySqlSpecifierControlPolicy(contract, defaultControlPolicy, createNamespace) {\n\treturn stripDerivedChecksFromNonManagedTables(applySpecifierDefaultControlPolicy(contract, defaultControlPolicy), createNamespace);\n}\n/**\n* Removes generated enforcement checks from every table whose effective\n* control policy is not `managed`.\n*\n* A check is derived iff its wire prefix is one derivation would produce for\n* some column of its table — {@link derivedCheckPrefixes} enumerates that\n* set. Wire-naming alone no longer identifies derivation: an authored\n* `name:` check (`@@check` / `check()`) is wire-named too, so a bare\n* `check.prefix === undefined` test would delete an author's own constraint\n* from every non-`managed` table. The prefix-shape rule tests against the\n* table's own columns instead of the naming mode, so an authored check with\n* an unrelated prefix survives.\n*\n* The rule is weaker than recomputing the content hash `contract infer`\n* uses: that needs `postgresRenderCheckExpressions` to know what a kind\n* renders, and this funnel has no target descriptor to reach it through. It\n* can only ask whether some column could have produced a prefix of this\n* shape, not whether this exact column produced this exact check. The gap\n* that opens — an authored name that collides with a derived-prefix shape —\n* is closed at authoring time instead: such a name is rejected\n* (`CONTRACT.CHECK_NAME_RESERVED`) before it ever reaches storage.\n*\n* Why derivation stops at the namespace boundary: the contract *describes* an\n* external schema, it does not *prescribe* enforcement for it. Deriving a check\n* for a table Prisma 8 never creates declares a constraint the live database\n* has no reason to carry, and `external` fails verify on a declared shape the\n* database lacks — an unfixable failure, since no plan may emit DDL there\n* either.\n*\n* This is the post-build half of the rule. Authoring skips derivation for a\n* table whose policy is known in the source; this pass catches the policy a\n* contract *specifier* applies after the contract is already built, which is\n* the only signal a pack like the Supabase extension gives. Specifiers reach\n* it through `applySqlSpecifierControlPolicy` above.\n*\n* Returns the contract unchanged (same reference) when nothing is stripped.\n* When something is, the storage hash is recomputed — the stripped contract\n* describes different storage.\n*/\nfunction stripDerivedChecksFromNonManagedTables(contract, createNamespace) {\n\tconst storage = contract.storage;\n\tif (!isSqlStorageShaped(storage)) return contract;\n\tlet anyStripped = false;\n\tconst namespaces = {};\n\tfor (const [namespaceId, namespace] of Object.entries(storage.namespaces)) {\n\t\tif (!isMaterializedSqlNamespace(namespace)) return contract;\n\t\tconst tables = namespace.entries[\"table\"];\n\t\tif (tables === void 0) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tlet namespaceStripped = false;\n\t\tconst nextTables = {};\n\t\tfor (const [tableName, table] of Object.entries(tables)) {\n\t\t\tconst stripped = StorageTable.is(table) ? withoutDerivedChecks(tableName, table, contract.defaultControlPolicy) : table;\n\t\t\tif (stripped !== table) namespaceStripped = true;\n\t\t\tnextTables[tableName] = stripped;\n\t\t}\n\t\tif (!namespaceStripped) {\n\t\t\tnamespaces[namespaceId] = namespace;\n\t\t\tcontinue;\n\t\t}\n\t\tanyStripped = true;\n\t\tnamespaces[namespaceId] = createNamespace({\n\t\t\tid: namespace.id,\n\t\t\tentries: {\n\t\t\t\t...namespace.entries,\n\t\t\t\ttable: nextTables\n\t\t\t}\n\t\t});\n\t}\n\tif (!anyStripped) return contract;\n\tconst storageWithoutHash = {\n\t\tnamespaces,\n\t\t...ifDefined(\"types\", storage.types)\n\t};\n\treturn {\n\t\t...contract,\n\t\tstorage: new SqlStorage({\n\t\t\t...storageWithoutHash,\n\t\t\tstorageHash: computeStorageHash({\n\t\t\t\ttarget: contract.target,\n\t\t\t\ttargetFamily: contract.targetFamily,\n\t\t\t\tstorage: storageWithoutHash,\n\t\t\t\t...sqlContractCanonicalizationHooks\n\t\t\t})\n\t\t})\n\t};\n}\n/**\n* Structural stand-in for `instanceof SqlStorage`: like the checks it wraps, a\n* storage instance can arrive from a realm whose IR classes are a separate\n* copy (the dist e2e shape), where an `instanceof` test would miss.\n*/\nfunction isSqlStorageShaped(x) {\n\tif (typeof x !== \"object\" || x === null || !(\"namespaces\" in x)) return false;\n\treturn typeof x.namespaces === \"object\" && x.namespaces !== null;\n}\n/** The table itself when it keeps every check, a rebuilt one when it does not. */\nfunction withoutDerivedChecks(tableName, table, contractDefault) {\n\tconst checks = table.checks;\n\tif (checks === void 0 || checks.length === 0) return table;\n\tif (effectiveControlPolicy(table.control, contractDefault) === \"managed\") return table;\n\tconst columnNames = Object.keys(table.columns);\n\tinvariant(columnNames.length > 0, `withoutDerivedChecks: table \"${tableName}\" carries checks but its column map is empty. The caller must pass the table's real, complete column set — an empty or partial map makes every check misclassify as non-derived and survive the strip.`);\n\tconst derivedPrefixes = derivedCheckPrefixes(tableName, columnNames);\n\tconst kept = checks.filter((check) => check.prefix === void 0 || !derivedPrefixes.has(check.prefix));\n\tif (kept.length === checks.length) return table;\n\treturn new StorageTable({\n\t\tcolumns: table.columns,\n\t\tuniques: table.uniques,\n\t\tindexes: table.indexes,\n\t\tforeignKeys: table.foreignKeys,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey),\n\t\t...ifDefined(\"control\", table.control),\n\t\t...kept.length > 0 ? { checks: kept.map((check) => checkConstraintInputFromSerialized({\n\t\t\tname: check.name,\n\t\t\t...ifDefined(\"prefix\", check.prefix),\n\t\t\texpression: check.expression\n\t\t})) } : {}\n\t});\n}\n//#endregion\nexport { contractError as i, buildSqlContractFromDefinition as n, toOneNullabilityContradictionMessage as r, applySqlSpecifierControlPolicy as t };\n\n//# sourceMappingURL=derived-checks-DGjY5t7S.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qCAAqC,UAAU,eAAe;CACtE,OAAO,kBAAkB,sBAAsB,GAAG,SAAS,8DAA8D,GAAG,SAAS;AACtI;AAGA,SAAS,eAAe,OAAO,SAAS,aAAa;CACpD,MAAM,QAAQ,aAAa,IAAI,OAAO;CACtC,IAAI,OAAO,OAAO,MAAM,WAAW,KAAK;CACxC,OAAO,UAAU,KAAK;AACvB;AACA,SAAS,oBAAoB,cAAc,SAAS,aAAa,OAAO,OAAO;CAC9E,I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EACF,CAAC;CACF;AACD;;;;;;AAMA,SAAS,mBAAmB,GAAG;CAC9B,IAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,EAAE,gBAAgB,IAAI,OAAO;CACxE,OAAO,OAAO,EAAE,eAAe,YAAY,EAAE,eAAe;AAC7D;;AAEA,SAAS,qBAAqB,WAAW,OAAO,iBAAiB;CAChE,MAAM,SAAS,MAAM;CACrB,IAAI,WAAW,KAAK,KAAK,OAAO,WAAW,GAAG,OAAO;CACrD,IAAI,uBAAuB,MAAM,SAAS,eAAe,MAAM,WAAW,OAAO;CACjF,MAAM,cAAc,OAAO,KAAK,MAAM,OAAO;CAC7C,UAAU,YAAY,SAAS,GAAG,gCAAgC,UAAU,uMAAuM;CACnR,MAAM,kBAAkB,qBAAqB,WAAW,WAAW;CACnE,MAAM,OAAO,OAAO,QAAQ,UAAU,MAAM,WAAW,KAAK,KAAK,CAAC,gBAAgB,IAAI,MAAM,MAAM,CAAC;CACnG,IAAI,KAAK,WAAW,OAAO,QAAQ,OAAO;CAC1C,OAAO,IAAI,aAAa;EACvB,SAAS,MAAM;EACf,SAAS,MAAM;EACf,SAAS,MAAM;EACf,aAAa,MAAM;EACnB,GAAG,UAAU,cAAc,MAAM,UAAU;EAC3C,GAAG,UAAU,WAAW,MAAM,OAAO;EACrC,GAAG,KAAK,SAAS,IAAI,EAAE,QAAQ,KAAK,KAAK,UAAU,mCAAmC;GACrF,MAAM,MAAM;GACZ,GAAG,UAAU,UAAU,MAAM,MAAM;GACnC,YAAY,MAAM;EACnB,CAAC,CAAC,EAAE,IAAI,CAAC;CACV,CAAC;AACF"}
|
package/dist/family.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classi
|
|
|
3
3
|
import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs";
|
|
4
4
|
import { n as parseContractMarkerRow } from "./verify-ChiDeTk8-HEewdjrM.mjs";
|
|
5
5
|
import { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from "./timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs";
|
|
6
|
-
import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-
|
|
6
|
+
import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-BIIMOKMy.mjs";
|
|
7
7
|
import { t as arraysEqual } from "./diff-B16bL_IR.mjs";
|
|
8
8
|
import { t as SqlSchemaVerifierBase } from "./ir-I-xciGUH.mjs";
|
|
9
9
|
import { t as SqlMigration } from "./migration-CK4oePIo.mjs";
|
|
10
|
-
import { a as mapDefault, c as toEnumMemberName, d as toModelName, i as inferRelations, l as toEnumName, n as deriveBackRelationFieldName, o as parseRawDefault, r as deriveRelationFieldName, s as pluralize, t as buildChildRelationField, u as toFieldName } from "./psl-infer-
|
|
10
|
+
import { a as mapDefault, c as toEnumMemberName, d as toModelName, i as inferRelations, l as toEnumName, n as deriveBackRelationFieldName, o as parseRawDefault, r as deriveRelationFieldName, s as pluralize, t as buildChildRelationField, u as toFieldName } from "./psl-infer-TBwKfKgU.mjs";
|
|
11
11
|
import { i as timestampNowRuntimeGenerator, n as resolveDomainModel, t as UNBOUND_DOMAIN_NAMESPACE_ID } from "./runtime-PknWErjr.mjs";
|
|
12
12
|
export { INIT_ADDITIVE_POLICY, SqlMigration as Migration, SqlContractSerializer, SqlContractSerializerBase, SqlSchemaVerifierBase, UNBOUND_DOMAIN_NAMESPACE_ID, arraysEqual, assembleAuthoringContributions, buildChildRelationField, buildNativeTypeExpander, classifyDiffSubjectGranularity, classifySqlDiffIssue, computeSqlDiffVerdict, computeStorageTypeVerdict, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, deriveBackRelationFieldName, deriveRelationFieldName, detectDestructiveChanges, extractCodecControlHooks, inferRelations, mapDefault, parseContractMarkerRow, parseRawDefault, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, pluralize, resolveDomainModel, resolveStorageTable, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, timestampNowControlDescriptor, timestampNowRuntimeGenerator, toEnumMemberName, toEnumName, toFieldName, toModelName, verifySqlSchemaByDiff };
|
package/dist/family__control.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { o as extractCodecControlHooks } from "./schema-verify-C_PEdlAr-CmXrFuW1.mjs";
|
|
2
2
|
import { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from "./timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs";
|
|
3
|
-
import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-
|
|
3
|
+
import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-BIIMOKMy.mjs";
|
|
4
4
|
export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, timestampNowControlDescriptor };
|
package/dist/family__pack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as sqlAttributeSpecs } from "./sql-attribute-specs-CG0yitvD-CG-0eW98.mjs";
|
|
2
|
-
import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-BD-XuavC-
|
|
2
|
+
import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs";
|
|
3
3
|
//#region ../../../2-sql/9-family/dist/pack.mjs
|
|
4
4
|
const sqlFamilyPack = {
|
|
5
5
|
kind: "family",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as mapDefault, c as toEnumMemberName, d as toModelName, i as inferRelations, l as toEnumName, n as deriveBackRelationFieldName, o as parseRawDefault, r as deriveRelationFieldName, s as pluralize, t as buildChildRelationField, u as toFieldName } from "./psl-infer-
|
|
1
|
+
import { a as mapDefault, c as toEnumMemberName, d as toModelName, i as inferRelations, l as toEnumName, n as deriveBackRelationFieldName, o as parseRawDefault, r as deriveRelationFieldName, s as pluralize, t as buildChildRelationField, u as toFieldName } from "./psl-infer-TBwKfKgU.mjs";
|
|
2
2
|
export { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };
|
package/dist/{foreign-key-materialization-Cu7-7LHl.mjs → foreign-key-materialization-0TrwfShD.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as truncateToWireNamePrefixBytes, o as defaultIndexName } from "./naming-DKr4TJd7-Cszhq9RV.mjs";
|
|
2
|
-
import { n as lowerAuthoredIndex } from "./index-naming-
|
|
2
|
+
import { n as lowerAuthoredIndex } from "./index-naming-fQMLqyC4-4FzPVtCR.mjs";
|
|
3
3
|
//#region ../../../2-sql/1-core/contract/dist/foreign-key-materialization.mjs
|
|
4
4
|
/**
|
|
5
5
|
* The column-list keys (`"colA,colB"`, order preserved) a table's own
|
|
@@ -70,4 +70,4 @@ function materializeForeignKeysAndIndexes(tableName, foreignKeys, declaredIndexe
|
|
|
70
70
|
//#endregion
|
|
71
71
|
export { isBackedByColumnKeys as n, materializeForeignKeysAndIndexes as r, backingIndexColumnKeys as t };
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=foreign-key-materialization-
|
|
73
|
+
//# sourceMappingURL=foreign-key-materialization-0TrwfShD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign-key-materialization-
|
|
1
|
+
{"version":3,"file":"foreign-key-materialization-0TrwfShD.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/foreign-key-materialization.mjs"],"sourcesContent":["import { n as lowerAuthoredIndex } from \"./index-naming-fQMLqyC4.mjs\";\nimport { defaultIndexName, truncateToWireNamePrefixBytes } from \"@internal/sql-schema-ir/naming\";\n//#region src/foreign-key-materialization.ts\n/**\n* The column-list keys (`\"colA,colB\"`, order preserved) a table's own\n* indexes, unique constraints, and primary key already back. A foreign key\n* whose source columns join to one of these keys needs no separately\n* derived backing index.\n*\n* Shared by {@link isBackedByColumnKeys}'s callers: `materializeForeignKeysAndIndexes`\n* (deriving the discrete backing-index entities persisted at `contract emit`)\n* and the postgres PSL inferrer (deciding whether an introspected relation\n* needs an explicit `index: false`).\n*/\nfunction backingIndexColumnKeys(table) {\n\treturn [\n\t\t...table.indexes.flatMap((index) => index.columns !== void 0 ? [index.columns.join(\",\")] : []),\n\t\t...table.uniques.map((unique) => unique.columns.join(\",\")),\n\t\t...table.primaryKey ? [table.primaryKey.columns.join(\",\")] : []\n\t];\n}\n/**\n* Whether `columns`, in order, matches one of `backingKeys` (see\n* {@link backingIndexColumnKeys}). Order-sensitive: `(a, b)` does not\n* satisfy a backing index declared as `(b, a)`.\n*/\nfunction isBackedByColumnKeys(columns, backingKeys) {\n\treturn backingKeys.includes(columns.join(\",\"));\n}\n/**\n* Lowers a table's authored foreign keys into the discrete entities\n* `contract.json` persists: a `constraint: false` FK contributes no\n* `foreignKeys[]` entry, and an `index: true` FK whose columns aren't already\n* backed by a declared index/unique/primary-key contributes a wire-named\n* `indexes[]` entry (byte-budgeted default prefix + content-hash wire name).\n* Declared indexes always survive unchanged; a second FK sharing an already\n* synthesized backing index does not mint a duplicate.\n*/\nfunction materializeForeignKeysAndIndexes(tableName, foreignKeys, declaredIndexes, uniques, primaryKey) {\n\tconst satisfiedIndexColumns = new Set(backingIndexColumnKeys({\n\t\tindexes: declaredIndexes,\n\t\tuniques,\n\t\tprimaryKey\n\t}));\n\tconst synthesizedIndexes = [];\n\tconst materializedForeignKeys = [];\n\tfor (const { constraint, index, ...reference } of foreignKeys) {\n\t\tif (constraint !== false) materializedForeignKeys.push(reference);\n\t\tif (index !== false) {\n\t\t\tconst key = reference.source.columns.join(\",\");\n\t\t\tif (!satisfiedIndexColumns.has(key)) {\n\t\t\t\tsynthesizedIndexes.push(lowerAuthoredIndex(tableName, {\n\t\t\t\t\tcolumns: reference.source.columns,\n\t\t\t\t\twhere: void 0,\n\t\t\t\t\tunique: void 0,\n\t\t\t\t\tmap: void 0,\n\t\t\t\t\tname: truncateToWireNamePrefixBytes(defaultIndexName(tableName, reference.source.columns)),\n\t\t\t\t\ttype: void 0,\n\t\t\t\t\toptions: void 0\n\t\t\t\t}));\n\t\t\t\tsatisfiedIndexColumns.add(key);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tforeignKeys: materializedForeignKeys,\n\t\tindexes: [...declaredIndexes, ...synthesizedIndexes]\n\t};\n}\n//#endregion\nexport { backingIndexColumnKeys, isBackedByColumnKeys, materializeForeignKeysAndIndexes };\n\n//# sourceMappingURL=foreign-key-materialization.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,GAAG,MAAM,QAAQ,SAAS,UAAU,MAAM,YAAY,KAAK,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;EAC7F,GAAG,MAAM,QAAQ,KAAK,WAAW,OAAO,QAAQ,KAAK,GAAG,CAAC;EACzD,GAAG,MAAM,aAAa,CAAC,MAAM,WAAW,QAAQ,KAAK,GAAG,CAAC,IAAI,CAAC;CAC/D;AACD;;;;;;AAMA,SAAS,qBAAqB,SAAS,aAAa;CACnD,OAAO,YAAY,SAAS,QAAQ,KAAK,GAAG,CAAC;AAC9C;;;;;;;;;;AAUA,SAAS,iCAAiC,WAAW,aAAa,iBAAiB,SAAS,YAAY;CACvG,MAAM,wBAAwB,IAAI,IAAI,uBAAuB;EAC5D,SAAS;EACT;EACA;CACD,CAAC,CAAC;CACF,MAAM,qBAAqB,CAAC;CAC5B,MAAM,0BAA0B,CAAC;CACjC,KAAK,MAAM,EAAE,YAAY,OAAO,GAAG,eAAe,aAAa;EAC9D,IAAI,eAAe,OAAO,wBAAwB,KAAK,SAAS;EAChE,IAAI,UAAU,OAAO;GACpB,MAAM,MAAM,UAAU,OAAO,QAAQ,KAAK,GAAG;GAC7C,IAAI,CAAC,sBAAsB,IAAI,GAAG,GAAG;IACpC,mBAAmB,KAAK,mBAAmB,WAAW;KACrD,SAAS,UAAU,OAAO;KAC1B,OAAO,KAAK;KACZ,QAAQ,KAAK;KACb,KAAK,KAAK;KACV,MAAM,8BAA8B,iBAAiB,WAAW,UAAU,OAAO,OAAO,CAAC;KACzF,MAAM,KAAK;KACX,SAAS,KAAK;IACf,CAAC,CAAC;IACF,sBAAsB,IAAI,GAAG;GAC9B;EACD;CACD;CACA,OAAO;EACN,aAAa;EACb,SAAS,CAAC,GAAG,iBAAiB,GAAG,kBAAkB;CACpD;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as contractError } from "./contract-errors-BCN6RVI5-5IHBF_lg.mjs";
|
|
2
2
|
import { a as computeIndexContentHash, n as assertWireNamePrefixLength, o as defaultIndexName } from "./naming-DKr4TJd7-Cszhq9RV.mjs";
|
|
3
3
|
import { flushAuthoringWarnings } from "@prisma/orm-framework/components/authoring";
|
|
4
|
-
//#region ../../../2-sql/1-core/contract/dist/index-naming-
|
|
4
|
+
//#region ../../../2-sql/1-core/contract/dist/index-naming-fQMLqyC4.mjs
|
|
5
5
|
const EXACT_NAME_BODY_PREAMBLE = "Drift detection compares the authored SQL text byte-for-byte against Postgres's reprinted form, which is only reliable when the text was captured by contract infer.";
|
|
6
6
|
/**
|
|
7
7
|
* Per-subject remediation: an index or check moves to wire naming via
|
|
@@ -9,9 +9,9 @@ const EXACT_NAME_BODY_PREAMBLE = "Drift detection compares the authored SQL text
|
|
|
9
9
|
* block's head the wire prefix.
|
|
10
10
|
*/
|
|
11
11
|
const EXACT_NAME_BODY_REMEDIATION = {
|
|
12
|
-
index: "For hand-authored definitions, use name: and let Prisma
|
|
12
|
+
index: "For hand-authored definitions, use name: and let Prisma 8 manage the physical name; to migrate an adopted object to wire naming, replace map: with name: (keeping the body text unchanged) and apply the resulting rename migration.",
|
|
13
13
|
policy: "For hand-authored definitions, drop @@map and let the policy block's head name the policy; to migrate an adopted policy to wire naming, remove @@map (keeping the body text unchanged) and apply the resulting rename migration.",
|
|
14
|
-
check: "For hand-authored definitions, use name: and let Prisma
|
|
14
|
+
check: "For hand-authored definitions, use name: and let Prisma 8 manage the physical name; to migrate an adopted check to wire naming, replace map: with name: (keeping the body text unchanged) and apply the resulting rename migration."
|
|
15
15
|
};
|
|
16
16
|
/** What the user actually wrote, per subject: index and check `map:`, policy `@@map`. */
|
|
17
17
|
const EXACT_NAME_FEATURE = {
|
|
@@ -107,4 +107,4 @@ function lowerAuthoredIndex(tableName, authored, warnings) {
|
|
|
107
107
|
//#endregion
|
|
108
108
|
export { lowerAuthoredIndex as n, exactNameBodyWarning as t };
|
|
109
109
|
|
|
110
|
-
//# sourceMappingURL=index-naming-
|
|
110
|
+
//# sourceMappingURL=index-naming-fQMLqyC4-4FzPVtCR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-naming-fQMLqyC4-4FzPVtCR.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/index-naming-fQMLqyC4.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { flushAuthoringWarnings } from \"@internal/framework-components/authoring\";\nimport { assertWireNamePrefixLength, computeIndexContentHash, defaultIndexName } from \"@internal/sql-schema-ir/naming\";\n//#region src/index-naming.ts\nconst EXACT_NAME_BODY_PREAMBLE = \"Drift detection compares the authored SQL text byte-for-byte against Postgres's reprinted form, which is only reliable when the text was captured by contract infer.\";\n/**\n* Per-subject remediation: an index or check moves to wire naming via\n* `name:`; a policy has no such parameter — dropping `@@map` makes the\n* block's head the wire prefix.\n*/\nconst EXACT_NAME_BODY_REMEDIATION = {\n\tindex: \"For hand-authored definitions, use name: and let Prisma 8 manage the physical name; to migrate an adopted object to wire naming, replace map: with name: (keeping the body text unchanged) and apply the resulting rename migration.\",\n\tpolicy: \"For hand-authored definitions, drop @@map and let the policy block's head name the policy; to migrate an adopted policy to wire naming, remove @@map (keeping the body text unchanged) and apply the resulting rename migration.\",\n\tcheck: \"For hand-authored definitions, use name: and let Prisma 8 manage the physical name; to migrate an adopted check to wire naming, replace map: with name: (keeping the body text unchanged) and apply the resulting rename migration.\"\n};\n/** What the user actually wrote, per subject: index and check `map:`, policy `@@map`. */\nconst EXACT_NAME_FEATURE = {\n\tindex: \"map:\",\n\tpolicy: \"@@map\",\n\tcheck: \"map:\"\n};\nconst EXACT_NAME_BODY_WARNING_CODE = \"PN_EXACT_NAME_BODY_COMPARISON\";\n/**\n* Mints the exact-name body-comparison warning for a `map:`-named object\n* carrying a hand-authorable SQL body — fully formed, so the transport and\n* the flush stay generic. `subject` distinguishes the index, policy, and\n* check callers that mint this same warning; the feature name and the\n* remediation are subject-specific end to end, so a batched summary\n* (grouped on code + summary) is true of every object it covers.\n*/\nfunction exactNameBodyWarning(subject, exactName) {\n\tconst item = `${subject} \"${exactName}\"`;\n\tconst feature = EXACT_NAME_FEATURE[subject];\n\tconst tail = `with a SQL body. ${EXACT_NAME_BODY_PREAMBLE} ${EXACT_NAME_BODY_REMEDIATION[subject]}`;\n\treturn {\n\t\tcode: EXACT_NAME_BODY_WARNING_CODE,\n\t\tmessage: `${item} uses ${feature} ${tail}`,\n\t\titem,\n\t\tsummary: `objects use ${feature} ${tail}`\n\t};\n}\n/**\n* Lowers an authored index into the name-identified entity `contract.json`\n* persists: exact mode adopts `map` verbatim (no prefix, no hash); wire\n* mode appends the content-hash suffix to the authored or default prefix.\n* The cross-field guards are the shared enforcement backstop for both\n* authoring surfaces (PSL pre-empts them with span-anchored diagnostics).\n*/\nfunction lowerAuthoredIndex(tableName, authored, warnings) {\n\tif (authored.columns === void 0 === (authored.expression === void 0)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Index on table \"${tableName}\": an index takes either fields (columns) or an expression — exactly one, not both.`);\n\tif (authored.map !== void 0 && authored.name !== void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Index \"${authored.map}\" on table \"${tableName}\": map and name are mutually exclusive — map adopts an exact physical name, name is a wire prefix.`);\n\tif (authored.expression !== void 0 && authored.name === void 0 && authored.map === void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Index on table \"${tableName}\": an expression index requires an explicit name (name:) or exact physical name (map:) — a default name cannot be derived from an expression.`);\n\tif (authored.options !== void 0 && authored.type === void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Index on table \"${tableName}\": options requires an explicit type — an index with options but no type cannot round-trip through contract infer (the emitted type: would change the wire name).`);\n\tconst unique = authored.unique ?? false;\n\tif (authored.map !== void 0) {\n\t\tif (authored.expression !== void 0 || authored.where !== void 0) {\n\t\t\tconst warning = exactNameBodyWarning(\"index\", authored.map);\n\t\t\tif (warnings !== void 0) warnings.push(warning);\n\t\t\telse flushAuthoringWarnings([warning]);\n\t\t}\n\t\tconst carried = {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: authored.map\n\t\t\t},\n\t\t\twhere: authored.where,\n\t\t\tunique,\n\t\t\ttype: authored.type,\n\t\t\toptions: authored.options\n\t\t};\n\t\treturn authored.expression !== void 0 ? {\n\t\t\t...carried,\n\t\t\texpression: authored.expression\n\t\t} : {\n\t\t\t...carried,\n\t\t\tcolumns: authored.columns ?? []\n\t\t};\n\t}\n\tconst prefix = authored.name ?? defaultIndexName(tableName, authored.columns ?? []);\n\tassertWireNamePrefixLength(prefix, \"index prefix\");\n\tconst carried = {\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix,\n\t\t\thash: computeIndexContentHash({\n\t\t\t\t...authored.columns !== void 0 && { columns: authored.columns },\n\t\t\t\t...authored.expression !== void 0 && { expression: authored.expression },\n\t\t\t\t...authored.where !== void 0 && { where: authored.where },\n\t\t\t\tunique,\n\t\t\t\t...authored.type !== void 0 && { type: authored.type },\n\t\t\t\t...authored.options !== void 0 && { options: authored.options }\n\t\t\t})\n\t\t},\n\t\twhere: authored.where,\n\t\tunique,\n\t\ttype: authored.type,\n\t\toptions: authored.options\n\t};\n\treturn authored.expression !== void 0 ? {\n\t\t...carried,\n\t\texpression: authored.expression\n\t} : {\n\t\t...carried,\n\t\tcolumns: authored.columns ?? []\n\t};\n}\n//#endregion\nexport { lowerAuthoredIndex as n, exactNameBodyWarning as t };\n\n//# sourceMappingURL=index-naming-fQMLqyC4.mjs.map"],"mappings":";;;;AAIA,MAAM,2BAA2B;;;;;;AAMjC,MAAM,8BAA8B;CACnC,OAAO;CACP,QAAQ;CACR,OAAO;AACR;;AAEA,MAAM,qBAAqB;CAC1B,OAAO;CACP,QAAQ;CACR,OAAO;AACR;AACA,MAAM,+BAA+B;;;;;;;;;AASrC,SAAS,qBAAqB,SAAS,WAAW;CACjD,MAAM,OAAO,GAAG,QAAQ,IAAI,UAAU;CACtC,MAAM,UAAU,mBAAmB;CACnC,MAAM,OAAO,oBAAoB,yBAAyB,GAAG,4BAA4B;CACzF,OAAO;EACN,MAAM;EACN,SAAS,GAAG,KAAK,QAAQ,QAAQ,GAAG;EACpC;EACA,SAAS,eAAe,QAAQ,GAAG;CACpC;AACD;;;;;;;;AAQA,SAAS,mBAAmB,WAAW,UAAU,UAAU;CAC1D,IAAI,SAAS,YAAY,KAAK,OAAO,SAAS,eAAe,KAAK,IAAI,MAAM,cAAc,6BAA6B,mBAAmB,UAAU,oFAAoF;CACxO,IAAI,SAAS,QAAQ,KAAK,KAAK,SAAS,SAAS,KAAK,GAAG,MAAM,cAAc,6BAA6B,UAAU,SAAS,IAAI,cAAc,UAAU,mGAAmG;CAC5P,IAAI,SAAS,eAAe,KAAK,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,QAAQ,KAAK,GAAG,MAAM,cAAc,6BAA6B,mBAAmB,UAAU,8IAA8I;CACvT,IAAI,SAAS,YAAY,KAAK,KAAK,SAAS,SAA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W,CAAC;CAC/B;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-Di9JZ0X7.mjs";
|
|
2
2
|
import { a as interpretFieldAttribute, i as findModelAttributeNode, n as fieldSpecContext, o as interpretModelAttribute, r as findFieldAttributeNode, s as sqlAttributeSpecs, t as PSL_CHECK_ON_STI_VARIANT } from "./sql-attribute-specs-CG0yitvD-CG-0eW98.mjs";
|
|
3
|
-
import { n as buildSqlContractFromDefinition } from "./derived-checks-
|
|
3
|
+
import { n as buildSqlContractFromDefinition } from "./derived-checks-DGjY5t7S-B3txNm7X.mjs";
|
|
4
4
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
5
5
|
import { hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
|
|
6
6
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
@@ -3498,4 +3498,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3498
3498
|
//#endregion
|
|
3499
3499
|
export { interpretPslDocumentToSqlContract as t };
|
|
3500
3500
|
|
|
3501
|
-
//# sourceMappingURL=interpreter-CZ_iVQV4-
|
|
3501
|
+
//# sourceMappingURL=interpreter-CZ_iVQV4-CJ6COgSE.mjs.map
|