@prisma/orm-family-sql 8.0.0-rc.14-dev.23 → 8.0.0-rc.14-dev.24

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.
@@ -7,7 +7,7 @@ import { c as SqlSchemaIR, n as RelationalSchemaNodeKind, u as SqlTableIR } from
7
7
  import { a as describeUnsupportedSqlAttribute, b as sqlAttributeSpecs } from "./psl-field-resolution-_o74AUE4-C-vTNklI.mjs";
8
8
  import { t as sqlEmission } from "./dist-BdePIXOu.mjs";
9
9
  import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-DIyheCzv-BSrAEZsD.mjs";
10
- import { n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, s as verifySqlSchemaByDiff, t as classifyDiffEntityKind } from "./schema-verify-DI0aJQ9d-BrQOlutU.mjs";
10
+ import { n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, s as verifySqlSchemaByDiff, t as classifyDiffEntityKind } from "./schema-verify-Xmpe1PGb-Bcd_2avJ.mjs";
11
11
  import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
12
12
  import { t as SqlContractSerializer } from "./sql-contract-serializer-C90xg7_q-C_Okh4NM.mjs";
13
13
  import { t as collectSupportedCodecTypeIds } from "./verify-BVk5bjdH-BXgGLM2U.mjs";
@@ -1534,4 +1534,4 @@ var control_default = new SqlFamilyDescriptor();
1534
1534
  //#endregion
1535
1535
  export { temporalStringAuthoringPresets as S, plannerFailure as _, buildDataTypeResolver as a, runnerSuccess as b, contractToSchemaIR as c, createMigrationPlan as d, detectDestructiveChanges as f, planFieldEventOperations as g, partitionIssuesByControlPolicy as h, assembleAuthoringContributions as i, controlPolicyForCall as l, partitionCallsByControlPolicy as m, TABLE_NAME_CASE_CHANGED_CODE as n, buildNativeTypeExpander as o, detectTableNameCaseChanges as p, applyTableRename as r, contractNamespaceToSchemaIR as s, INIT_ADDITIVE_POLICY as t, control_default as u, plannerSuccess as v, temporalCodecPresetWithPrecision as x, runnerFailure as y };
1536
1536
 
1537
- //# sourceMappingURL=control-D0iVJugI.mjs.map
1537
+ //# sourceMappingURL=control-BYOcSVih.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-D0iVJugI.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/control.mjs"],"sourcesContent":["import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from \"./authoring-type-constructors-DIyheCzv.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-DI0aJQ9d.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-C90xg7_q.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-BVk5bjdH.mjs\";\nimport { SQL_EXPRESSION_DATA_TYPE_ID, assertNothingCastsFromSqlExpression, sqlExpressionAuthoringEntry, sqlExpressionDataType } from \"@internal/sql-contract/sql-expression\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { describeUnsupportedSqlAttribute, sqlAttributeSpecs } from \"@internal/sql-contract-psl/attribute-specs\";\nimport { TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG, TIMESTAMP_NOW_GENERATOR_ID, temporalAuthoringPresets, temporalPhaseTemplate } from \"@internal/framework-components/authoring\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleDataTypes, extractCodecLookup, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID, isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { ForeignKey, SqlStorage, StorageTable, isMaterializedSqlNamespace, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { checkSqlDefaultBody } from \"@internal/sql-contract/validators\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/operation-preview.ts\nfunction isDdlStatement(sqlStatement) {\n\tconst trimmed = sqlStatement.trim().toLowerCase();\n\treturn trimmed.startsWith(\"create \") || trimmed.startsWith(\"alter \") || trimmed.startsWith(\"drop \");\n}\nfunction hasExecuteSteps(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tif (!Array.isArray(execute)) return false;\n\treturn execute.every((step) => typeof step === \"object\" && step !== null && \"sql\" in step);\n}\n/**\n* Extracts a best-effort SQL DDL preview for CLI plan output.\n* Presentation-only: never used to decide migration correctness.\n*/\nfunction extractSqlDdl(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tif (!hasExecuteSteps(operation)) continue;\n\t\tfor (const step of operation.execute) if (typeof step.sql === \"string\" && isDdlStatement(step.sql)) statements.push(step.sql.trim());\n\t}\n\treturn statements;\n}\n/**\n* Wraps `extractSqlDdl` into the family-agnostic `OperationPreview` shape.\n* Each statement carries `language: 'sql'`.\n*/\nfunction sqlOperationsToPreview(operations) {\n\treturn { statements: extractSqlDdl(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"sql\"\n\t})) };\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction missingDescriptorOperationError(targetId, operation) {\n\treturn sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `SQL target \"${targetId}\" is missing the required ${operation} descriptor operation`, {\n\t\twhy: `The target descriptor does not contribute the ${operation} operation the SQL family requires for this call.`,\n\t\tfix: `Use a target package whose control descriptor implements ${operation}.`,\n\t\tmeta: {\n\t\t\ttargetId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction extractCodecTypeIdsFromContract(contract) {\n\tconst typeIds = /* @__PURE__ */ new Set();\n\tif (typeof contract === \"object\" && contract !== null && \"storage\" in contract && typeof contract.storage === \"object\" && contract.storage !== null && \"namespaces\" in contract.storage && typeof contract.storage.namespaces === \"object\" && contract.storage.namespaces !== null) {\n\t\tconst namespaces = blindCast(contract.storage.namespaces);\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tconst tbls = ns.entries[\"table\"];\n\t\t\tif (typeof tbls !== \"object\" || tbls === null) continue;\n\t\t\tfor (const table of Object.values(tbls)) if (typeof table === \"object\" && table !== null && \"columns\" in table && typeof table.columns === \"object\" && table.columns !== null) {\n\t\t\t\tconst columns = blindCast(table.columns);\n\t\t\t\tfor (const column of Object.values(columns)) if (column && typeof column === \"object\" && \"codecId\" in column && typeof column.codecId === \"string\") typeIds.add(column.codecId);\n\t\t\t}\n\t\t}\n\t}\n\treturn Array.from(typeIds).sort();\n}\nfunction createVerifyResult(options) {\n\tconst contract = { storageHash: options.contractStorageHash };\n\tif (options.contractProfileHash) contract.profileHash = options.contractProfileHash;\n\tconst target = { expected: options.expectedTargetId };\n\tif (options.actualTargetId) target.actual = options.actualTargetId;\n\tconst meta = { contractPath: options.contractPath };\n\tif (options.configPath) meta.configPath = options.configPath;\n\treturn {\n\t\tok: options.ok,\n\t\tsummary: options.summary,\n\t\tcontract,\n\t\ttarget,\n\t\tmeta,\n\t\ttimings: { total: options.totalTime },\n\t\t...ifDefined(\"code\", options.code),\n\t\t...options.marker ? { marker: {\n\t\t\tstorageHash: options.marker.storageHash,\n\t\t\tprofileHash: options.marker.profileHash\n\t\t} } : {},\n\t\t...ifDefined(\"missingCodecs\", options.missingCodecs),\n\t\t...ifDefined(\"codecCoverageSkipped\", options.codecCoverageSkipped)\n\t};\n}\nfunction buildSqlTypeMetadataRegistry(options) {\n\tconst { target, adapter, extensions } = options;\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst targetId = adapter.targetId;\n\tconst descriptors = [\n\t\ttarget,\n\t\tadapter,\n\t\t...extensions\n\t];\n\tfor (const descriptor of descriptors) {\n\t\tconst storageTypes = descriptor.types?.storage;\n\t\tif (!storageTypes) continue;\n\t\tfor (const storageType of storageTypes) if (storageType.familyId === \"sql\" && storageType.targetId === targetId) registry.set(storageType.typeId, {\n\t\t\ttypeId: storageType.typeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: storageType.targetId,\n\t\t\t...storageType.nativeType !== void 0 ? { nativeType: storageType.nativeType } : {}\n\t\t});\n\t}\n\treturn registry;\n}\n/**\n* Builds a map from each extension id to the set of extension ids it\n* transitively depends on. Uses the same declared-dependency data that\n* `buildExtensionLoadOrder` in control-stack uses.\n*/\nfunction buildTransitiveDependsOnMap(extensions) {\n\tconst directDeps = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tconst packs = ext.contractSpace?.contractJson?.extensions;\n\t\tconst deps = packs !== null && typeof packs === \"object\" ? Object.keys(packs) : [];\n\t\tdirectDeps.set(ext.id, deps);\n\t}\n\tconst result = /* @__PURE__ */ new Map();\n\tconst resolve = (id, visiting) => {\n\t\tconst cached = result.get(id);\n\t\tif (cached !== void 0) return cached;\n\t\tconst set = /* @__PURE__ */ new Set();\n\t\tresult.set(id, set);\n\t\tfor (const depId of directDeps.get(id) ?? []) {\n\t\t\tset.add(depId);\n\t\t\tif (!visiting.has(depId)) {\n\t\t\t\tvisiting.add(depId);\n\t\t\t\tfor (const transitive of resolve(depId, visiting)) set.add(transitive);\n\t\t\t\tvisiting.delete(depId);\n\t\t\t}\n\t\t}\n\t\treturn set;\n\t};\n\tfor (const ext of extensions) resolve(ext.id, /* @__PURE__ */ new Set([ext.id]));\n\treturn result;\n}\n/**\n* Asserts that no cross-space FK in any extension points against the\n* dependency direction.\n*\n* A cross-space FK (target.spaceId present) from extension A pointing at\n* space B is a violation when B depends on A (directly or transitively),\n* because that means A is pointing \"upward\" against the dependency arrows\n* established by the extension load order.\n*\n* Throws with a diagnostic naming the violating extension (source), the\n* target space, and the direction violation.\n*/\nfunction isObjectRecord(v) {\n\treturn typeof v === \"object\" && v !== null;\n}\nfunction assertNoCrossSpaceFkReverseReferences(extensions) {\n\tconst dependsOnMap = buildTransitiveDependsOnMap(extensions);\n\tfor (const ext of extensions) {\n\t\tconst namespaces = ext.contractSpace?.contractJson?.storage?.namespaces;\n\t\tif (!isObjectRecord(namespaces)) continue;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tif (!isObjectRecord(ns)) continue;\n\t\t\tconst entries = ns[\"entries\"];\n\t\t\tif (!isObjectRecord(entries)) continue;\n\t\t\tfor (const slot of Object.values(entries)) {\n\t\t\t\tif (!isObjectRecord(slot)) continue;\n\t\t\t\tfor (const table of Object.values(slot)) {\n\t\t\t\t\tif (!isObjectRecord(table)) continue;\n\t\t\t\t\tconst foreignKeys = table[\"foreignKeys\"];\n\t\t\t\t\tif (!Array.isArray(foreignKeys)) continue;\n\t\t\t\t\tfor (const fk of foreignKeys) {\n\t\t\t\t\t\tif (!isObjectRecord(fk)) continue;\n\t\t\t\t\t\tconst target = fk[\"target\"];\n\t\t\t\t\t\tif (!isObjectRecord(target)) continue;\n\t\t\t\t\t\tif (target[\"spaceId\"] === void 0) continue;\n\t\t\t\t\t\tconst targetSpaceId = target[\"spaceId\"];\n\t\t\t\t\t\tif (typeof targetSpaceId !== \"string\") continue;\n\t\t\t\t\t\tif (dependsOnMap.get(targetSpaceId)?.has(ext.id)) throw sqlFamilyError(\"CONTRACT.FOREIGN_KEY_INVALID\", `Cross-space FK reverse-reference detected: extension \"${ext.id}\" has a cross-space FK targeting space \"${targetSpaceId}\", but \"${targetSpaceId}\" depends on \"${ext.id}\". Cross-space FKs must follow the dependency direction (a space can only reference spaces it depends on, not spaces that depend on it).`, {\n\t\t\t\t\t\t\twhy: \"The foreign key points against the contract-space dependency direction.\",\n\t\t\t\t\t\t\tfix: \"Move the foreign key to the depending space, or restructure the extension dependencies so the referencing space depends on the referenced one.\",\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\textensionId: ext.id,\n\t\t\t\t\t\t\t\ttargetSpaceId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nfunction createSqlFamilyInstance(stack) {\n\tif (!stack.adapter) throw new InternalError(\"SQL family requires an adapter descriptor in ControlStack\");\n\tassertNothingCastsFromSqlExpression(stack.declaredDataTypes);\n\tconst target = blindCast(stack.target);\n\tconst adapter = blindCast(stack.adapter);\n\tconst extensions = blindCast(stack.extensions);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...sqlContractCanonicalizationHooks\n\t\t});\n\t}\n\tassertNoCrossSpaceFkReverseReferences(extensions);\n\tconst { codecTypeImports, extensionIds } = stack;\n\tconst typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t});\n\tlet controlAdapter;\n\tconst getControlAdapter = () => controlAdapter ??= adapter.create(stack);\n\tconst targetSerializer = blindCast(target).contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\n\tconst pslBuildContext = {\n\t\tauthoringContributions: stack.authoringContributions,\n\t\tcodecLookup: stack.codecLookup,\n\t\tdataTypeLookup: stack.dataTypeLookup\n\t};\n\tconst targetBuildPslContract = blindCast(target).buildPslContract;\n\tconst diffSchema = blindCast(target).diffSchema;\n\tconst targetGranularityOf = blindCast(target).classifySubjectGranularity;\n\tconst targetEntityKindOf = blindCast(target).classifyEntityKind;\n\tconst describedContracts = extensions.flatMap((extension) => extension.contractSpace ? [{\n\t\tspaceId: extension.id,\n\t\tcontract: extension.contractSpace.contractJson\n\t}] : []);\n\tconst deserializeWithTargetSerializer = (contractOrJson) => {\n\t\tconst serializer = targetSerializer ?? new SqlContractSerializer();\n\t\tconst json = targetSerializer !== void 0 && !isPlainRecord(contractOrJson) ? targetSerializer.serializeContract(blindCast(contractOrJson)) : contractOrJson;\n\t\treturn serializer.deserializeContract(json);\n\t};\n\treturn {\n\t\tfamilyId: \"sql\",\n\t\tcodecTypeImports,\n\t\textensionIds,\n\t\ttypeMetadataRegistry,\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn deserializeWithTargetSerializer(contractJson);\n\t\t},\n\t\tasync verify(verifyOptions) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = verifyOptions;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst marker = await getControlAdapter().readMarker(driver, APP_SPACE_ID);\n\t\t\tlet missingCodecs;\n\t\t\tlet codecCoverageSkipped = false;\n\t\t\tconst supportedTypeIds = collectSupportedCodecTypeIds([\n\t\t\t\tadapter,\n\t\t\t\ttarget,\n\t\t\t\t...extensions\n\t\t\t]);\n\t\t\tif (supportedTypeIds.length === 0) codecCoverageSkipped = true;\n\t\t\telse {\n\t\t\t\tconst supportedSet = new Set(supportedTypeIds);\n\t\t\t\tconst missing = extractCodecTypeIdsFromContract(contract).filter((id) => !supportedSet.has(id));\n\t\t\t\tif (missing.length > 0) missingCodecs = missing;\n\t\t\t}\n\t\t\tif (!marker) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractTarget !== expectedTargetId) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\treturn createVerifyResult({\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\tconst contract = deserializeWithTargetSerializer(options.contract);\n\t\t\tif (!diffSchema) throw missingDescriptorOperationError(target.targetId, \"diffSchema\");\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn verifySqlSchemaByDiff({\n\t\t\t\tcontract,\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\tdiffSchema,\n\t\t\t\tgranularityOf: targetGranularityOf\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject granularity on demand, by resolving\n\t\t* its node's `nodeKind` through the target's classifier — the\n\t\t* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability. Framework consumers spanning contract spaces (the\n\t\t* migration aggregate's unclaimed-elements sweep) detect and call this\n\t\t* instead of reaching into the concrete schema-IR node, which they\n\t\t* cannot read; nothing is stamped on the issue or the node.\n\t\t*/\n\t\tclassifySubjectGranularity(issue) {\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn classifyDiffSubjectGranularity(issue, targetGranularityOf);\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject storage `entityKind` on demand, by\n\t\t* resolving its node's `nodeKind` through the target's classifier —\n\t\t* the sibling of `classifySubjectGranularity` above, and part of the\n\t\t* same {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability.\n\t\t*/\n\t\tclassifyEntityKind(issue) {\n\t\t\tif (!targetEntityKindOf) throw missingDescriptorOperationError(target.targetId, \"classifyEntityKind\");\n\t\t\treturn classifyDiffEntityKind(issue, targetEntityKindOf);\n\t\t},\n\t\tasync sign(options) {\n\t\t\tconst { driver, contract: contractInput, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(contractInput);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = \"profileHash\" in contract && typeof contract.profileHash === \"string\" ? contract.profileHash : contractStorageHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst controlAdapter = getControlAdapter();\n\t\t\tconst lowererContext = { contract };\n\t\t\tfor (const query of controlAdapter.bootstrapSignMarkerQueries()) {\n\t\t\t\tconst lowered = await controlAdapter.lowerToExecuteRequest(query, lowererContext);\n\t\t\t\tawait driver.query(lowered.sql, lowered.params);\n\t\t\t}\n\t\t\tconst existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.insertMarker(driver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst existingStorageHash = existingMarker.storageHash;\n\t\t\t\tconst existingProfileHash = existingMarker.profileHash;\n\t\t\t\tif (!(existingStorageHash === contractStorageHash) || !(existingProfileHash === contractProfileHash)) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingStorageHash,\n\t\t\t\t\t\tprofileHash: existingProfileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(driver, APP_SPACE_ID, existingStorageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw sqlFamilyError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\", {\n\t\t\t\t\t\twhy: \"Another process updated the contract marker between the read and the compare-and-swap write.\",\n\t\t\t\t\t\tfix: \"Re-run the sign command; if it keeps failing, make sure only one migration process runs at a time.\",\n\t\t\t\t\t\tmeta: { space: APP_SPACE_ID }\n\t\t\t\t\t});\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\tconst totalTime = Date.now() - startTime;\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contractTarget,\n\t\t\t\t\tactual: contractTarget\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...previousHashes ? { previous: previousHashes } : {}\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t\t},\n\t\t\t\ttimings: { total: totalTime }\n\t\t\t};\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(options.driver, options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(options.driver);\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(options.driver, options.space);\n\t\t},\n\t\tasync initMarker(options) {\n\t\t\treturn getControlAdapter().initMarker(options.driver, options.space, options.destination);\n\t\t},\n\t\tasync updateMarker(options) {\n\t\t\treturn getControlAdapter().updateMarker(options.driver, options.space, options.expectedFrom, options.destination);\n\t\t},\n\t\tasync writeLedgerEntry(options) {\n\t\t\treturn getControlAdapter().writeLedgerEntry(options.driver, options.space, options.entry);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspect(options.driver, options.contract);\n\t\t},\n\t\tinferPslContract(schemaIR) {\n\t\t\tif (!targetInferPslContract) throw sqlFamilyError(\"CONTRACT.INFER_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract infer (no inferPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the inferPslContract hook, so a PSL contract cannot be inferred from the database schema.\",\n\t\t\t\tfix: \"Use a target package that supports contract infer, or author the contract instead of inferring it.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn targetInferPslContract(schemaIR, pslBuildContext, describedContracts);\n\t\t},\n\t\tbuildPslContract(contract) {\n\t\t\tif (!targetBuildPslContract) throw sqlFamilyError(\"CONTRACT.PRINT_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract print (no buildPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the buildPslContract hook, so the contract cannot be printed as a Prisma 8 PSL file.\",\n\t\t\t\tfix: \"Use a target whose descriptor provides buildPslContract, or write the Prisma 8 PSL file by hand.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdocument: targetBuildPslContract(contract, pslBuildContext),\n\t\t\t\tsourceSettings: ifDefined(\"defaultControlPolicy\", contract.defaultControlPolicy)\n\t\t\t};\n\t\t},\n\t\tlowerAst(ast, context) {\n\t\t\treturn getControlAdapter().lowerToExecuteRequest(ast, context);\n\t\t},\n\t\tbootstrapControlTableQueries() {\n\t\t\treturn getControlAdapter().bootstrapControlTableQueries();\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn sqlOperationsToPreview(operations);\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\tconst root = blindCast(schema);\n\t\t\tconst namespaceEntries = root.namespaces !== void 0 ? Object.entries(root.namespaces).map(([namespaceKey, namespace]) => [namespaceKey, namespace.tables]) : [[void 0, root.tables ?? {}]];\n\t\t\tconst qualify = namespaceEntries.length > 1;\n\t\t\tconst tableNodes = namespaceEntries.flatMap(([namespaceKey, tables]) => Object.entries(tables).map(([tableName, table]) => [\n\t\t\t\tqualify && namespaceKey !== void 0 ? `${namespaceKey}.${tableName}` : tableName,\n\t\t\t\ttableName,\n\t\t\t\ttable\n\t\t\t])).map(([displayName, tableName, table]) => {\n\t\t\t\tconst children = [];\n\t\t\t\tconst columnNodes = [];\n\t\t\t\tfor (const [columnName, column] of Object.entries(table.columns)) {\n\t\t\t\t\tconst label = `${columnName}: ${column.nativeType} (${column.nullable ? \"nullable\" : \"not nullable\"})`;\n\t\t\t\t\tcolumnNodes.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"field\",\n\t\t\t\t\t\tid: `column-${displayName}-${columnName}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tnativeType: column.nativeType,\n\t\t\t\t\t\t\tnullable: column.nullable,\n\t\t\t\t\t\t\t...ifDefined(\"default\", column.default)\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tif (columnNodes.length > 0) children.push(new SchemaTreeNode({\n\t\t\t\t\tkind: \"collection\",\n\t\t\t\t\tid: `columns-${displayName}`,\n\t\t\t\t\tlabel: \"columns\",\n\t\t\t\t\tchildren: columnNodes\n\t\t\t\t}));\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\tconst pkColumns = table.primaryKey.columns.join(\", \");\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `primary-key-${displayName}`,\n\t\t\t\t\t\tlabel: `primary key: ${pkColumns}`,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t\t\t\t\t...table.primaryKey.name ? { name: table.primaryKey.name } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const unique of table.uniques) {\n\t\t\t\t\tconst name = unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_unique`;\n\t\t\t\t\tconst label = `unique ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `unique-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: unique.columns,\n\t\t\t\t\t\t\tunique: true\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const index of table.indexes) {\n\t\t\t\t\tconst name = index.name;\n\t\t\t\t\tconst label = index.unique ? `unique index ${name}` : `index ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `index-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: index.columns,\n\t\t\t\t\t\t\tunique: index.unique\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tconst tableMeta = {};\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\ttableMeta[\"primaryKey\"] = table.primaryKey.columns;\n\t\t\t\t\tif (table.primaryKey.name) tableMeta[\"primaryKeyName\"] = table.primaryKey.name;\n\t\t\t\t}\n\t\t\t\tif (table.foreignKeys.length > 0) tableMeta[\"foreignKeys\"] = table.foreignKeys.map((fk) => ({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\t...fk.name ? { name: fk.name } : {}\n\t\t\t\t}));\n\t\t\t\treturn new SchemaTreeNode({\n\t\t\t\t\tkind: \"entity\",\n\t\t\t\t\tid: `table-${displayName}`,\n\t\t\t\t\tlabel: `table ${displayName}`,\n\t\t\t\t\t...Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {},\n\t\t\t\t\t...children.length > 0 ? { children } : {}\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn { root: new SchemaTreeNode({\n\t\t\t\tkind: \"root\",\n\t\t\t\tid: \"sql-schema\",\n\t\t\t\tlabel: \"database\",\n\t\t\t\t...tableNodes.length > 0 ? { children: tableNodes } : {}\n\t\t\t}) };\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst sqlFamilyDescribeUnsupportedAttribute = describeUnsupportedSqlAttribute;\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tdataTypes = [sqlExpressionDataType];\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors,\n\t\tattributeSpecs: sqlAttributeSpecs,\n\t\tdataTypes: { [SQL_EXPRESSION_DATA_TYPE_ID]: sqlExpressionAuthoringEntry }\n\t};\n\tpslDiagnostics = { describeUnsupportedAttribute: sqlFamilyDescribeUnsupportedAttribute };\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/apply-table-rename.ts\nconst TABLE_RENAME_UNMATCHED_CODE = \"MIGRATION.TABLE_RENAME_UNMATCHED\";\nfunction tableLabel(namespaceId, tableName) {\n\treturn namespaceId === void 0 || namespaceId === UNBOUND_NAMESPACE_ID ? tableName : `${namespaceId}.${tableName}`;\n}\nfunction namespacesDeclaring(contract, tableName) {\n\treturn Object.values(contract.storage.namespaces).filter((namespace) => Object.hasOwn(namespace.entries.table ?? {}, tableName)).map((namespace) => namespace.id);\n}\nfunction declares(contract, namespaceId, tableName) {\n\treturn Object.hasOwn(contract.storage.namespaces[namespaceId]?.entries.table ?? {}, tableName);\n}\nfunction unmatched(rename, reason) {\n\treturn sqlFamilyError(TABLE_RENAME_UNMATCHED_CODE, `renameTable \"${tableLabel(rename.namespaceId, rename.from)}\" to \"${rename.to}\" does not match the migration's contracts: ${reason}.`, {\n\t\twhy: \"renameTable must name a table of the migration's start contract and a new name that the end contract has and the start contract does not. Make the rename its own schema change, so the migration's start contract is the schema before the rename and its end contract the schema after it, and check the spelling and the namespace.\",\n\t\tmeta: {\n\t\t\tfrom: rename.from,\n\t\t\tto: rename.to\n\t\t}\n\t});\n}\nfunction resolveTableRename(rename, startContract, endContract) {\n\tconst namespaceIds = rename.namespaceId === void 0 ? namespacesDeclaring(startContract, rename.from) : declares(startContract, rename.namespaceId, rename.from) ? [rename.namespaceId] : [];\n\tconst [namespaceId, ...others] = namespaceIds;\n\tif (namespaceId === void 0) return notOk(unmatched(rename, `table \"${tableLabel(rename.namespaceId, rename.from)}\" does not exist in the start contract`));\n\tif (others.length > 0) return notOk(unmatched(rename, `table \"${rename.from}\" is declared in more than one namespace (${namespaceIds.join(\", \")}); name its namespace`));\n\tif (declares(startContract, namespaceId, rename.to)) return notOk(unmatched(rename, `table \"${tableLabel(namespaceId, rename.to)}\" already exists in the start contract`));\n\tif (!declares(endContract, namespaceId, rename.to)) return notOk(unmatched(rename, `table \"${tableLabel(namespaceId, rename.to)}\" does not exist in the end contract`));\n\treturn ok({\n\t\tnamespaceId,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n}\nfunction renamedReference(reference, rename) {\n\tif (!(reference.spaceId === void 0) || reference.namespaceId !== rename.namespaceId || reference.tableName !== rename.from) return reference;\n\treturn {\n\t\t...reference,\n\t\ttableName: rename.to\n\t};\n}\nfunction renameForeignKeys(table, rename) {\n\tif (!table.foreignKeys.some((fk) => renamedReference(fk.source, rename) !== fk.source || renamedReference(fk.target, rename) !== fk.target)) return table;\n\treturn new StorageTable({\n\t\t...table,\n\t\tforeignKeys: table.foreignKeys.map((fk) => new ForeignKey({\n\t\t\t...fk,\n\t\t\tsource: renamedReference(fk.source, rename),\n\t\t\ttarget: renamedReference(fk.target, rename)\n\t\t}))\n\t});\n}\n/**\n* The same namespace instance with only `entries` replaced: every own\n* property, including the non-enumerable `kind`, is carried over onto the\n* same prototype, so the target's namespace class (its `qualifyTable`,\n* `ddlSchemaName`, entity getters) keeps working on the copy. This is the\n* one place a frozen contract node is rebuilt without its constructor: the\n* constructors re-hydrate `entries` from raw input, which the already\n* hydrated entities here do not need.\n*/\nfunction withEntries(namespace, entries) {\n\tconst copy = Object.create(Object.getPrototypeOf(namespace), {\n\t\t...Object.getOwnPropertyDescriptors(namespace),\n\t\tentries: {\n\t\t\tvalue: Object.freeze(entries),\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t\tconfigurable: false\n\t\t}\n\t});\n\treturn Object.freeze(copy);\n}\nfunction renameTableInNamespace(namespace, rename, renameTableReferences) {\n\tconst ownsTable = rename.namespaceId === namespace.id;\n\tconst tables = Object.entries(namespace.entries.table ?? {}).map(([name, table]) => [ownsTable && name === rename.from ? rename.to : name, renameForeignKeys(table, rename)]);\n\tif (tables.every(([name, table]) => namespace.entries.table?.[name] === table)) return namespace;\n\tif (!isMaterializedSqlNamespace(namespace)) throw new InternalError(`applyTableRename: namespace \"${namespace.id}\" is not a materialized SQL namespace`);\n\tconst renamedTables = {\n\t\t...namespace.entries,\n\t\ttable: Object.fromEntries(tables)\n\t};\n\treturn withEntries(namespace, renameTableReferences === void 0 || !ownsTable ? renamedTables : renameTableReferences(renamedTables, rename));\n}\nfunction renameTableInContract(contract, rename, renameTableReferences) {\n\tconst namespaces = Object.fromEntries(Object.entries(contract.storage.namespaces).map(([id, namespace]) => [id, renameTableInNamespace(namespace, rename, renameTableReferences)]));\n\tconst materialized = {};\n\tfor (const [id, namespace] of Object.entries(namespaces)) {\n\t\tif (!isMaterializedSqlNamespace(namespace)) throw new InternalError(`applyTableRename: namespace \"${id}\" is not a materialized SQL namespace`);\n\t\tmaterialized[id] = namespace;\n\t}\n\treturn {\n\t\t...contract,\n\t\tstorage: new SqlStorage({\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...contract.storage.types === void 0 ? {} : { types: contract.storage.types },\n\t\t\tnamespaces: materialized\n\t\t})\n\t};\n}\n/**\n* Resolves the table a migration renames against its start and end contracts and returns the start contract with that table under its new name, so a diff against the end contract sees the table under one name. The table must exist in the start contract (in exactly one namespace when the namespace is not given), and the new name must exist in the end contract and not in the start contract; otherwise the rename is refused with `MIGRATION.TABLE_RENAME_UNMATCHED`.\n*\n* Foreign keys that name the renamed table on either side are retargeted. Index, unique, check and primary-key names are carried unchanged. Target entity kinds that name the table are renamed by the target's `renameTableReferences`.\n*/\nfunction applyTableRename(input) {\n\tif (input.startContract === null) return notOk(unmatched(input.rename, \"the migration has no start contract\"));\n\tconst resolved = resolveTableRename(input.rename, input.startContract, input.endContract);\n\tif (!resolved.ok) return resolved;\n\treturn ok({\n\t\tcontract: renameTableInContract(input.startContract, resolved.value, input.renameTableReferences),\n\t\trename: resolved.value\n\t});\n}\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst baseNativeType = expandNativeType ? expandNativeType({\n\t\tnativeType: resolved.nativeType,\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams)\n\t}) : resolved.nativeType;\n\tconst nativeType = baseNativeType;\n\tconst many = column.many !== void 0 && column.many !== false;\n\tconst resolvedNativeType = many ? `${baseNativeType}[]` : baseNativeType;\n\tconst rawColumnDefault = column.default ?? void 0;\n\tconst resolvedColumnDefault = rawColumnDefault !== void 0 && resolveDefault ? resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;\n\treturn {\n\t\tname,\n\t\tnativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", many ? true : void 0),\n\t\t...ifDefined(\"default\", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0),\n\t\tresolvedNativeType,\n\t\t...ifDefined(\"resolvedDefault\", resolvedColumnDefault),\n\t\t...ifDefined(\"authoredDefault\", rawColumnDefault),\n\t\tcodecRef: buildColumnCodecRef(resolved, many ? true : void 0),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {},\n\t\t...ifDefined(\"dataType\", dataTypeOf?.(resolved.codecId))\n\t};\n}\n/**\n* Builds the column's `CodecRef` from its resolved (post-`typeRef`) codec\n* identity — the same construction the query AST and the migration DDL\n* renderer already use (TML-2456, TML-2918).\n*/\nfunction buildColumnCodecRef(resolved, many) {\n\treturn {\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams !== void 0 ? blindCast(resolved.typeParams) : void 0),\n\t\t...ifDefined(\"many\", many)\n\t};\n}\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referenced = storageTypes[column.typeRef];\n\tif (!referenced) throw sqlFamilyError(\"CONTRACT.TYPE_UNKNOWN\", `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`, {\n\t\twhy: \"The column typeRef does not resolve to any entry in the contract storage.types map.\",\n\t\tfix: \"Regenerate the contract from its authoring source; do not hand-edit contract JSON.\",\n\t\tmeta: { typeRef: column.typeRef }\n\t});\n\tif (isStorageTypeInstance(referenced)) return {\n\t\tcodecId: referenced.codecId,\n\t\tnativeType: referenced.nativeType,\n\t\ttypeParams: referenced.typeParams\n\t};\n\tthrow new InternalError(`Storage type \"${column.typeRef}\" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`);\n}\nfunction convertCheck(check, tableName, tableColumns) {\n\treturn {\n\t\tnaming: namingOf(check.name, check.prefix),\n\t\texpression: check.expression,\n\t\tdependsOn: flatColumnDependsOn(tableName, tableColumns)\n\t};\n}\nfunction convertUnique(unique, tableName) {\n\treturn {\n\t\tcolumns: unique.columns,\n\t\t...ifDefined(\"name\", unique.name),\n\t\tdependsOn: flatColumnDependsOn(tableName, unique.columns)\n\t};\n}\nfunction convertIndex(index, tableName, tableColumns) {\n\tconst base = {\n\t\tnaming: namingOf(index.name, index.prefix),\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.where !== void 0,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: void 0,\n\t\tdependsOn: flatColumnDependsOn(tableName, index.columns ?? tableColumns)\n\t};\n\treturn index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: index.columns ?? []\n\t};\n}\n/**\n* The referenced table's chain in the flat (single-schema) tree\n* `contractToSchemaIR`/`contractNamespaceToSchemaIR` build: the root\n* (`SqlSchemaIR`, fixed `'database'` id) followed by the table's own id.\n* Postgres discards this when it re-derives the FK against its own\n* multi-schema tree shape (`contractToPostgresDatabaseSchemaNode`); SQLite's\n* flat tree uses it as-is.\n*/\nfunction flatSchemaDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the flat tree. Dropping\n* a covered column auto-drops the object, so the object's drop must precede\n* the column's; the graph derives that direction from these edges.\n*/\nfunction flatColumnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\t\tid: \"database\"\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\t\tid: `column:${column}`\n\t\t}\n\t]);\n}\n/**\n* The FK's referenced-namespace identity comes from the target's namespace\n* node, not the raw namespace-id string. An unbound target namespace stamps\n* no `referencedSchema` at all — the FK node's id renders the absence as the\n* empty segment, which is what flat (single-schema) introspection produces,\n* so both diff sides' FK ids meet by construction. A bound namespace (or a\n* cross-space target whose namespace lives in another contract's storage)\n* stamps its coordinate verbatim; namespaced targets (Postgres) resolve the\n* real DDL schema downstream.\n*\n* `dependsOn` carries the referenced table (created before the FK, dropped\n* after it) plus the FK's own columns (dropped after the FK, since dropping a\n* column auto-drops the FK built on it).\n*/\nfunction convertForeignKey(fk, storage) {\n\tconst targetIsUnbound = storage.namespaces[fk.target.namespaceId]?.isUnbound === true;\n\treturn {\n\t\tcolumns: fk.source.columns,\n\t\treferencedTable: fk.target.tableName,\n\t\t...targetIsUnbound ? {} : { referencedSchema: fk.target.namespaceId },\n\t\treferencedColumns: fk.target.columns,\n\t\t...ifDefined(\"name\", fk.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\tdependsOn: [flatSchemaDependsOn(fk.target.tableName), ...flatColumnDependsOn(fk.source.tableName, fk.source.columns)]\n\t};\n}\nfunction convertTable(name, table, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf);\n\tconst checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, name, Object.keys(table.columns))) : void 0;\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey !== void 0 ? {\n\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t...ifDefined(\"name\", table.primaryKey.name),\n\t\t\tdependsOn: flatColumnDependsOn(name, table.primaryKey.columns)\n\t\t} : void 0),\n\t\tforeignKeys: table.foreignKeys.map((fk) => convertForeignKey(fk, storage)),\n\t\tuniques: table.uniques.map((u) => convertUnique(u, name)),\n\t\tindexes: table.indexes.map((i) => convertIndex(i, name, Object.keys(table.columns))),\n\t\t...ifDefined(\"checks\", checks)\n\t});\n}\n/**\n* Detects destructive changes between two contract storages.\n*\n* The additive-only planner silently ignores removals (tables, columns).\n* This function detects those removals so callers can report them as conflicts\n* rather than silently producing an empty plan.\n*\n* Returns an empty array if no destructive changes are found.\n*/\nfunction detectDestructiveChanges(from, to) {\n\tif (!from) return [];\n\tconst hasOwn = (value, key) => Object.hasOwn(value, key);\n\tconst conflicts = [];\n\tconst namespaceIds = [.../* @__PURE__ */ new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)])].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst fromNs = from.namespaces[namespaceId];\n\t\tconst toNs = to.namespaces[namespaceId];\n\t\tconst fromTables = fromNs?.entries.table;\n\t\tif (!fromTables) continue;\n\t\tfor (const tableName of Object.keys(fromTables)) {\n\t\t\tconst toTableRaw = toNs?.entries.table?.[tableName];\n\t\t\tif (!StorageTable.is(toTableRaw)) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tkind: \"tableRemoved\",\n\t\t\t\t\tsummary: `Table \"${tableName}\" was removed`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst toTable = toTableRaw;\n\t\t\tconst fromTableRaw = fromTables[tableName];\n\t\t\tif (!StorageTable.is(fromTableRaw)) continue;\n\t\t\tconst fromTable = fromTableRaw;\n\t\t\tfor (const columnName of Object.keys(fromTable.columns)) if (!hasOwn(toTable.columns, columnName)) conflicts.push({\n\t\t\t\tkind: \"columnRemoved\",\n\t\t\t\tsummary: `Column \"${tableName}\".\"${columnName}\" was removed`\n\t\t\t});\n\t\t}\n\t}\n\treturn conflicts;\n}\n/**\n* Converts a `Contract` to `SqlSchemaIR`.\n*\n* Reads `contract.storage` for tables and `contract.storage.types` for type\n* annotations. Storage-type annotations are written under\n* `options.annotationNamespace`.\n*\n* Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n* structural information. When `expandNativeType` is provided, parameterized types\n* are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n* resulting IR compares correctly against the \"to\" contract during planning.\n*\n* Returns an empty schema IR when `contract` is `null` (new project).\n*/\n/**\n* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by\n* table name within that namespace. Unlike {@link contractToSchemaIR}, which\n* flattens every namespace's tables into one bare-keyed record (and throws on a\n* cross-namespace name collision), this scopes the table iteration to one\n* namespace so the same table name can exist in two schemas.\n*\n* The full `storage` is still passed to `convertTable`, so value-set / enum /\n* type resolution that legitimately spans namespaces is unaffected. Foreign\n* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace\n* FKs survive per-namespace conversion. The `annotations` block (storage-type\n* derived) is omitted here — the per-namespace tree consumer reads only the\n* per-table fields.\n*/\nfunction contractNamespaceToSchemaIR(storage, namespaceId, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (!namespace) return new SqlSchemaIR({ tables: {} });\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);\n\t\ttables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, options.dataTypeOf, storage);\n\t}\n\treturn new SqlSchemaIR({ tables });\n}\nfunction contractToSchemaIR(contract, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tif (!contract) return new SqlSchemaIR({ tables: {} });\n\tconst storage = contract.storage;\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);\n\t\tconst tableDef = tableDefRaw;\n\t\tif (tables[tableName] !== void 0) throw sqlFamilyError(\"CONTRACT.TABLE_AMBIGUOUS\", `contractToSchemaIR: duplicate SQL table name \"${tableName}\" across namespaces (ambiguous for flat SqlSchemaIR.tables).`, {\n\t\t\twhy: \"Two namespaces declare a table with the same name, which is ambiguous for the flat schema-IR table map.\",\n\t\t\tfix: \"Rename one of the tables so every table name is unique across namespaces.\",\n\t\t\tmeta: { table: tableName }\n\t\t});\n\t\ttables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, options.dataTypeOf, storage);\n\t}\n\treturn new SqlSchemaIR({\n\t\ttables,\n\t\t...ifDefined(\"annotations\", deriveAnnotations(storage, options.annotationNamespace, options.resolveEnumNamespaceSchema))\n\t});\n}\nfunction deriveAnnotations(storage, annotationNamespace, _resolveEnumNamespaceSchema) {\n\tconst storageTypes = {};\n\tfor (const typeInstance of Object.values(storage.types ?? {})) if (isStorageTypeInstance(typeInstance)) storageTypes[typeInstance.nativeType] = typeInstance;\n\tconst envelope = { ...Object.keys(storageTypes).length > 0 ? { storageTypes } : {} };\n\tif (Object.keys(envelope).length === 0) return void 0;\n\treturn { [annotationNamespace]: envelope };\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* The control policy that governs a single call. The `external` default is an\n* un-overridable namespace floor: when the contract default is `external`, no\n* per-object `managed` override can escalate DDL above the floor, so the\n* policy is forced to `external` regardless of the node's own declaration.\n* Every other default defers to the node's effective control policy.\n*/\nfunction controlPolicyForCall(subject, defaultControlPolicy) {\n\tif (defaultControlPolicy === \"external\") return \"external\";\n\treturn effectiveControlPolicy(subject?.explicitNodeControlPolicy, defaultControlPolicy);\n}\n/**\n* Whether a call is allowed to emit under a given control policy.\n*\n* - `managed` — full lifecycle, every op allowed.\n* - `tolerated` — create-if-absent only: allowed iff the call creates a whole\n* new top-level object (and its subject was positively resolved). Anything\n* that modifies an existing object, and anything whose subject could not be\n* resolved, is suppressed.\n* - `external` / `observed` — no DDL at all.\n*/\nfunction callAllowedUnderControlPolicy(policy, subject) {\n\tswitch (policy) {\n\t\tcase \"managed\": return true;\n\t\tcase \"tolerated\": return subject?.createsNewObject === true;\n\t\tcase \"external\":\n\t\tcase \"observed\": return false;\n\t}\n}\n/**\n* Partition the calls produced for a single set of subjects into those the\n* effective control policy permits (`kept`) and a list of\n* {@link SuppressionRecord}s describing the suppressed calls.\n*\n* **Prefer {@link partitionIssuesByControlPolicy}** for the schema-issue\n* pipeline: it filters subjects out of the planner's *input* so the planner\n* never has to reason about un-modeled state on `external`/`observed`\n* subjects. This call-level helper remains for paths that bypass the issue\n* pipeline — currently the codec-emitted field-event ops, which originate\n* from declared contract fields rather than from introspected schema state\n* and therefore cannot trip the diff engine.\n*/\nfunction partitionCallsByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst kept = [];\n\tconst suppressions = [];\n\tfor (const call of options.calls) {\n\t\tconst subject = options.resolveControlPolicySubject(call);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tif (callAllowedUnderControlPolicy(policy, subject)) kept.push(call);\n\t\telse suppressions.push({\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\tfactoryName: options.resolveFactoryName(call),\n\t\t\tcreatesNewObject: subject?.createsNewObject ?? false\n\t\t});\n\t}\n\treturn Object.freeze({\n\t\tkept: Object.freeze(kept),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\n/**\n* Partition a list of schema-issue-shaped inputs by the effective control\n* policy of each issue's subject *before* the planner is invoked.\n*\n* `plannable` is the list of issues whose subject's effective policy permits\n* the planner to act on them (`managed`, or `tolerated` for whole-object\n* creation issues only). Issues for `external`/`observed` subjects, and\n* non-creation issues for `tolerated` subjects, are dropped from the planner's\n* input entirely — they never enter introspection-driven planning, never feed\n* the diff engine, and never produce DDL calls that would have to be\n* post-filtered. This sidesteps a class of failure where the diff engine\n* cannot reason about the live shape of a subject the user marked as\n* out-of-scope (`external`).\n*\n* `suppressions` is one {@link SuppressionRecord} per suppressed subject (not\n* per suppressed issue). Its `factoryName` is the creation factory name when any\n* of the subject's issues is whole-object creation (e.g. `createTable`), else\n* `undefined` — the family never invents a modification verb for an op that\n* produced no call; the target renders the message.\n*\n* Unresolved-subject issues (`resolveControlPolicySubject` returns\n* `undefined`) emit one record each; they cannot be deduplicated because they\n* carry no subject coordinate.\n*/\nfunction partitionIssuesByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst plannable = [];\n\tconst suppressedSubjects = /* @__PURE__ */ new Map();\n\tconst unresolvedSuppressions = [];\n\tfor (const issue of options.issues) {\n\t\tconst subject = options.resolveControlPolicySubject(issue);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tconst creationFactoryName = options.resolveCreationFactoryName(issue);\n\t\tif (policy === \"managed\") {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (policy === \"tolerated\" && subject !== void 0 && creationFactoryName !== void 0 && subject.createsNewObject) {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject === void 0) {\n\t\t\tunresolvedSuppressions.push({\n\t\t\t\tsubject: void 0,\n\t\t\t\tpolicy,\n\t\t\t\tfactoryName: creationFactoryName,\n\t\t\t\tcreatesNewObject: false\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst key = subjectKey(subject);\n\t\tconst existing = suppressedSubjects.get(key);\n\t\tif (existing) {\n\t\t\tif (existing.creationFactoryName === void 0 && creationFactoryName !== void 0) existing.creationFactoryName = creationFactoryName;\n\t\t} else suppressedSubjects.set(key, {\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\t...ifDefined(\"creationFactoryName\", creationFactoryName)\n\t\t});\n\t}\n\tconst suppressions = [...unresolvedSuppressions];\n\tfor (const entry of suppressedSubjects.values()) suppressions.push({\n\t\tsubject: entry.subject,\n\t\tpolicy: entry.policy,\n\t\tfactoryName: entry.creationFactoryName,\n\t\tcreatesNewObject: entry.subject.createsNewObject\n\t});\n\treturn Object.freeze({\n\t\tplannable: Object.freeze(plannable),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\nfunction subjectKey(subject) {\n\treturn `${subject.namespaceId}\\u0000${subject.entityKind ?? \"\"}\\u0000${subject.entityName ?? \"\"}\\u0000${subject.rlsPolicy ?? \"\"}`;\n}\n//#endregion\n//#region src/core/migrations/data-type-resolver.ts\n/**\n* Builds the resolver the contract→IR derivation uses to give each column its data type (ADR 254):\n* the codec's descriptor names the type, and the composed components register it. Codecs and\n* data types from extension packs are found the same way as the target's own, and a codec id two\n* components contribute is refused, as everywhere else in the stack. Returns `undefined` when no\n* framework components are supplied, so callers can omit the option.\n*/\nfunction buildDataTypeResolver(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst dataTypes = assembleDataTypes(frameworkComponents).lookup;\n\tconst codecs = extractCodecLookup(frameworkComponents);\n\treturn (codecId) => {\n\t\tconst dataTypeId = codecs.descriptorFor(codecId)?.dataType;\n\t\treturn dataTypeId === void 0 ? void 0 : dataTypes.get(dataTypeId);\n\t};\n}\n//#endregion\n//#region src/core/migrations/field-event-planner.ts\nfunction planFieldEventOperations(options) {\n\tconst priorContract = options.priorContract;\n\tconst newContract = options.newContract;\n\tconst added = [];\n\tconst dropped = [];\n\tconst altered = [];\n\tconst namespaceIds = unionSorted(priorContract ? Object.keys(priorContract.storage.namespaces) : [], Object.keys(newContract.storage.namespaces));\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst priorNs = priorContract?.storage.namespaces[namespaceId];\n\t\tconst newNs = newContract.storage.namespaces[namespaceId];\n\t\tconst priorTables = priorNs?.entries.table;\n\t\tconst newTables = newNs?.entries.table;\n\t\tconst tableNames = unionSorted(priorTables ? Object.keys(priorTables) : [], newTables ? Object.keys(newTables) : []);\n\t\tfor (const tableName of tableNames) {\n\t\t\tconst priorTableRaw = priorTables?.[tableName];\n\t\t\tconst newTableRaw = newTables?.[tableName];\n\t\t\tconst priorTable = StorageTable.is(priorTableRaw) ? priorTableRaw : void 0;\n\t\t\tconst newTable = StorageTable.is(newTableRaw) ? newTableRaw : void 0;\n\t\t\tconst fieldNames = unionSorted(priorTable ? Object.keys(priorTable.columns) : [], newTable ? Object.keys(newTable.columns) : []);\n\t\t\tfor (const fieldName of fieldNames) {\n\t\t\t\tconst priorField = priorTable?.columns[fieldName];\n\t\t\t\tconst newField = newTable?.columns[fieldName];\n\t\t\t\tconst entry = {\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\ttableName,\n\t\t\t\t\tfieldName,\n\t\t\t\t\tpriorTable,\n\t\t\t\t\tnewTable,\n\t\t\t\t\tpriorField,\n\t\t\t\t\tnewField\n\t\t\t\t};\n\t\t\t\tif (priorField === void 0 && newField !== void 0) added.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField === void 0) dropped.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField !== void 0) {\n\t\t\t\t\tif (isAlteration(priorField, newField)) altered.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tconst calls = [];\n\tappendCalls(\"added\", added, options.codecHooks, calls, (e) => e.newField?.codecId);\n\tappendCalls(\"dropped\", dropped, options.codecHooks, calls, (e) => e.priorField?.codecId);\n\tappendCalls(\"altered\", altered, options.codecHooks, calls, (e) => e.newField?.codecId);\n\treturn calls;\n}\nfunction appendCalls(event, entries, codecHooks, calls, pickCodecId) {\n\tfor (const entry of entries) {\n\t\tconst codecId = pickCodecId(entry);\n\t\tif (codecId === void 0) continue;\n\t\tconst hook = codecHooks.get(codecId);\n\t\tif (!hook?.onFieldEvent) continue;\n\t\tconst ctx = buildContext(event, entry);\n\t\tconst emitted = hook.onFieldEvent(event, ctx);\n\t\tfor (const call of emitted) calls.push(call);\n\t}\n}\n/**\n* The context's prior/new sides are scoped to the event:\n*\n* - `'added'` — only `newTable` / `newField` populated.\n* - `'dropped'` — only `priorTable` / `priorField` populated.\n* - `'altered'` — both sides populated.\n*/\nfunction buildContext(event, entry) {\n\tconst base = {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttableName: entry.tableName,\n\t\tfieldName: entry.fieldName\n\t};\n\tif (event === \"added\") return {\n\t\t...base,\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n\tif (event === \"dropped\") return {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {}\n\t};\n\treturn {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n}\n/**\n* `'altered'` predicate. Returns `false` whenever `codecId` differs —\n* any codec change suppresses the `altered` event entirely, including\n* cases where another property also differs in the same diff. Codec\n* rotation is a v1 non-goal; avoiding the mixed event keeps the\n* migration semantics for codec changes explicit rather than smuggling\n* them through as `altered`.\n*\n* For non-`codecId` diffs, returns `true` iff any other column property\n* differs.\n*/\nfunction isAlteration(prior, current) {\n\tif (prior.codecId !== current.codecId) return false;\n\treturn !sameStorageColumn(prior, current);\n}\nfunction sameStorageColumn(a, b) {\n\tif (a === b) return true;\n\tif (a.nativeType !== b.nativeType) return false;\n\tif (a.nullable !== b.nullable) return false;\n\tif (a.typeRef !== b.typeRef) return false;\n\tif (!sameJson(a.typeParams, b.typeParams)) return false;\n\tif (!sameJson(a.default, b.default)) return false;\n\treturn true;\n}\nfunction sameJson(a, b) {\n\tif (a === b) return true;\n\tif (a === void 0 || b === void 0) return false;\n\treturn JSON.stringify(a) === JSON.stringify(b);\n}\nfunction unionSorted(a, b) {\n\tconst set = /* @__PURE__ */ new Set();\n\tfor (const name of a) set.add(name);\n\tfor (const name of b) set.add(name);\n\treturn [...set].sort((x, y) => x < y ? -1 : x > y ? 1 : 0);\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* Builds the codec-hook-composed `expandNativeType` callback the contract→IR\n* derivation uses to expand parameterized native types (e.g. `character` +\n* `{ length: 36 }` → `character(36)`). Returns `undefined` when no framework\n* components are supplied, so callers can omit the option entirely.\n*/\nfunction buildNativeTypeExpander(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst codecHooks = extractCodecControlHooks(frameworkComponents);\n\treturn (input) => {\n\t\tif (!input.typeParams) return input.nativeType;\n\t\tif (!input.codecId) return input.nativeType;\n\t\tconst hooks = codecHooks.get(input.codecId);\n\t\tif (!hooks?.expandNativeType) return input.nativeType;\n\t\treturn hooks.expandNativeType(input);\n\t};\n}\n//#endregion\n//#region src/core/migrations/plan-helpers.ts\nconst readOnlyEmptyObject = Object.freeze({});\nfunction cloneRecord(value) {\n\tif (value === readOnlyEmptyObject) return value;\n\treturn blindCast(Object.freeze({ ...value }));\n}\nfunction freezeSteps(steps) {\n\tif (steps.length === 0) return Object.freeze([]);\n\treturn Object.freeze(steps.map((step) => Object.freeze({\n\t\tdescription: step.description,\n\t\tsql: step.sql,\n\t\t...step.params ? { params: Object.freeze([...step.params]) } : {},\n\t\t...step.meta ? { meta: cloneRecord(step.meta) } : {}\n\t})));\n}\nfunction freezeDetailsValue(value) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\") return value;\n\tif (Array.isArray(value)) return blindCast(Object.freeze([...value]));\n\treturn blindCast(Object.freeze({ ...value }));\n}\nfunction freezeTargetDetails(target) {\n\treturn Object.freeze({\n\t\tid: target.id,\n\t\t...target.details !== void 0 ? { details: freezeDetailsValue(target.details) } : {}\n\t});\n}\nfunction freezeOperation(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...operation.summary ? { summary: operation.summary } : {},\n\t\toperationClass: operation.operationClass,\n\t\t...operation.invariantId ? { invariantId: operation.invariantId } : {},\n\t\ttarget: freezeTargetDetails(operation.target),\n\t\tprecheck: freezeSteps(operation.precheck),\n\t\texecute: freezeSteps(operation.execute),\n\t\tpostcheck: freezeSteps(operation.postcheck),\n\t\t...operation.meta ? { meta: cloneRecord(operation.meta) } : {}\n\t});\n}\nfunction freezeOperations(operations) {\n\tif (operations.length === 0) return Object.freeze([]);\n\treturn Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\nfunction createMigrationPlan(options) {\n\treturn Object.freeze({\n\t\ttargetId: options.targetId,\n\t\tspaceId: options.spaceId,\n\t\t...options.origin !== void 0 ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null } : {},\n\t\tdestination: Object.freeze({ ...options.destination }),\n\t\toperations: freezeOperations(options.operations),\n\t\tprovidedInvariants: Object.freeze([...options.providedInvariants]),\n\t\t...options.meta ? { meta: cloneRecord(options.meta) } : {}\n\t});\n}\nfunction plannerSuccess(plan, warnings) {\n\treturn Object.freeze({\n\t\tkind: \"success\",\n\t\tplan,\n\t\t...warnings && warnings.length > 0 ? { warnings: Object.freeze(warnings.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t}))) } : {}\n\t});\n}\nfunction plannerFailure(conflicts) {\n\treturn Object.freeze({\n\t\tkind: \"failure\",\n\t\tconflicts: Object.freeze(conflicts.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t})))\n\t});\n}\n/**\n* Creates a successful migration runner result.\n*/\nfunction runnerSuccess(value) {\n\treturn ok(Object.freeze({\n\t\toperationsPlanned: value.operationsPlanned,\n\t\toperationsExecuted: value.operationsExecuted\n\t}));\n}\n/**\n* Creates a failed migration runner result.\n*/\nfunction runnerFailure(code, summary, options) {\n\treturn notOk(Object.freeze({\n\t\tcode,\n\t\tsummary,\n\t\t...options?.why ? { why: options.why } : {},\n\t\t...options?.meta ? { meta: cloneRecord(options.meta) } : {}\n\t}));\n}\n//#endregion\n//#region src/core/migrations/policies.ts\n/**\n* Policy used by `db init`: additive-only operations, no widening/destructive steps.\n*/\nconst INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.freeze([\"additive\"]) });\n//#endregion\n//#region src/core/migrations/table-name-case-guard.ts\nconst TABLE_NAME_CASE_CHANGED_CODE = \"MIGRATION.TABLE_NAME_CASE_CHANGED\";\nfunction lowerFirst(value) {\n\treturn value.charAt(0).toLowerCase() + value.slice(1);\n}\nfunction plannedTable(node, namespaceId) {\n\treturn {\n\t\tnamespaceId,\n\t\ttableName: node.name\n\t};\n}\nfunction renameNeedsNamespace(drop, dropped, contract, defaultNamespaceId) {\n\tif (drop.namespaceId !== UNBOUND_NAMESPACE_ID && drop.namespaceId !== defaultNamespaceId) return true;\n\tconst declaredElsewhere = (namespaceId, tableName) => namespaceId !== drop.namespaceId && tableName === drop.tableName;\n\treturn dropped.some((other) => declaredElsewhere(other.namespaceId, other.tableName)) || Object.values(contract.storage.namespaces).some((namespace) => Object.keys(namespace.entries.table ?? {}).some((tableName) => declaredElsewhere(namespace.id, tableName)));\n}\n/**\n* Finds every (drop `X`, create `Y`) pair in the same namespace where `X` is\n* `Y` with its first letter lowered. That shape is the signature of a schema\n* upgraded across the release in which a model with no `@@map` stopped\n* lowering the first letter of its table name: planning it would drop the\n* user's table and recreate it empty. Columns are deliberately not compared,\n* so a user who also changed a field in the same upgrade is still protected.\n*\n* Returns one conflict per pair, carrying `MIGRATION.TABLE_NAME_CASE_CHANGED`\n* in `meta.code`, or an empty array when the plan has no such pair.\n*/\nfunction detectTableNameCaseChanges(input) {\n\tconst dropped = [];\n\tconst created = [];\n\tfor (const issue of input.issues) {\n\t\tconst outcome = issueOutcome(issue);\n\t\tif (outcome === \"not-equal\") continue;\n\t\tconst table = input.tableOf(issue);\n\t\tif (table === void 0) continue;\n\t\t(outcome === \"not-expected\" ? dropped : created).push(plannedTable(table, input.namespaceIdOf(issue)));\n\t}\n\tconst conflicts = [];\n\tfor (const create of created) {\n\t\tconst drop = dropped.find((candidate) => candidate.namespaceId === create.namespaceId && candidate.tableName === lowerFirst(create.tableName));\n\t\tif (drop === void 0) continue;\n\t\tconst renameCall = input.renameTableCall({\n\t\t\tnamespaceId: renameNeedsNamespace(drop, dropped, input.contract, input.defaultNamespaceId) ? drop.namespaceId : void 0,\n\t\t\tfrom: drop.tableName,\n\t\t\tto: create.tableName\n\t\t});\n\t\tconflicts.push({\n\t\t\tkind: \"tableNameCaseChanged\",\n\t\t\tsummary: `${TABLE_NAME_CASE_CHANGED_CODE}: table \"${create.tableName}\" would be created and table \"${drop.tableName}\" dropped. Prisma 8 changed the default table name: a model with no @@map now names its table verbatim, so model ${create.tableName} points at \"${create.tableName}\" instead of \"${drop.tableName}\".`,\n\t\t\twhy: `To keep table \"${drop.tableName}\" and its rows, add @@map(\"${drop.tableName}\") to model ${create.tableName} (or run the add-model-map codemod over the schema) and plan again. To rename the table and keep its rows instead: in a project with migration history, make the rename its own schema change, create its migration with prisma migration new --from <hash of the migration the database is at>, and add ${renameCall} to the migration's operations, which renames the table and the objects named after it; in a project that uses db update, rename it by hand with ${input.renameByHandStatements({\n\t\t\t\tnamespaceId: create.namespaceId,\n\t\t\t\tfrom: drop.tableName,\n\t\t\t\tto: create.tableName\n\t\t\t}).join(\"; \")}, then run db update again.`,\n\t\t\tlocation: {\n\t\t\t\tnamespaceId: create.namespaceId,\n\t\t\t\tentityKind: \"table\",\n\t\t\t\tentityName: create.tableName\n\t\t\t},\n\t\t\tmeta: {\n\t\t\t\tcode: TABLE_NAME_CASE_CHANGED_CODE,\n\t\t\t\tdroppedTable: drop.tableName,\n\t\t\t\tcreatedTable: create.tableName\n\t\t\t}\n\t\t});\n\t}\n\treturn conflicts;\n}\n//#endregion\n//#region src/core/timestamp-now-generator.ts\nfunction temporalStringAuthoringPresets(input) {\n\tconst presets = temporalAuthoringPresets(input);\n\treturn {\n\t\tcreatedAtString: presets.createdAt,\n\t\tupdatedAtString: presets.updatedAt\n\t};\n}\nconst TEMPORAL_PRECISION_ARG = {\n\tname: \"precision\",\n\tkind: \"number\",\n\toptional: true,\n\tinteger: true,\n\tminimum: 0\n};\n/**\n* Builds a `temporal.<codec>` field preset for a codec that takes a precision\n* parameter (`pg/timestamp-temporal@1`, `pg/timestamptz-temporal@1`). Arguments change field\n* properties only — never the codec, which the caller fixes here.\n*\n* All three arguments are optional: omitting `precision` omits `typeParams`\n* entirely, and omitting a phase omits that phase (both omitted omits\n* `executionDefaults`).\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction temporalCodecPresetWithPrecision(input) {\n\tconst generatorId = input.generatorId ?? TIMESTAMP_NOW_GENERATOR_ID;\n\treturn {\n\t\tkind: \"fieldPreset\",\n\t\targs: [\n\t\t\tTEMPORAL_PRECISION_ARG,\n\t\t\tTEMPORAL_ON_CREATE_ARG,\n\t\t\tTEMPORAL_ON_UPDATE_ARG\n\t\t],\n\t\toutput: {\n\t\t\tcodecId: input.codecId,\n\t\t\tnativeType: input.nativeType,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} },\n\t\t\texecutionDefaults: {\n\t\t\t\tonCreate: temporalPhaseTemplate(1, generatorId),\n\t\t\t\tonUpdate: temporalPhaseTemplate(2, generatorId)\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, TABLE_NAME_CASE_CHANGED_CODE, applyTableRename, assembleAuthoringContributions, buildDataTypeResolver, buildNativeTypeExpander, checkSqlDefaultBody, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,eAAe,cAAc;CACrC,MAAM,UAAU,aAAa,KAAK,CAAC,CAAC,YAAY;CAChD,OAAO,QAAQ,WAAW,SAAS,KAAK,QAAQ,WAAW,QAAQ,KAAK,QAAQ,WAAW,OAAO;AACnG;AACA,SAAS,gBAAgB,WAAW;CACnC,MAAM,UAAU,QAAQ,IAAI,WAAW,SAAS;CAChD,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG,OAAO;CACpC,OAAO,QAAQ,OAAO,SAAS,OAAO,SAAS,YAAY,SAAS,QAAQ,SAAS,IAAI;AAC1F;;;;;AAKA,SAAS,cAAc,YAAY;CAClC,MAAM,aAAa,CAAC;CACpB,KAAK,MAAM,aAAa,YAAY;EACnC,IAAI,CAAC,gBAAgB,SAAS,GAAG;EACjC,KAAK,MAAM,QAAQ,UAAU,SAAS,IAAI,OAAO,KAAK,QAAQ,YAAY,eAAe,KAAK,GAAG,GAAG,WAAW,KAAK,KAAK,IAAI,KAAK,CAAC;CACpI;CACA,OAAO;AACR;;;;;AAKA,SAAS,uBAAuB,YAAY;CAC3C,OAAO,EAAE,YAAY,cAAc,UAAU,CAAC,CAAC,KAAK,UAAU;EAC7D;EACA,UAAU;CACX,EAAE,EAAE;AACL;AAGA,SAAS,gCAAgC,UAAU,WAAW;CAC7D,OAAO,eAAe,sCAAsC,eAAe,SAAS,4BAA4B,UAAU,wBAAwB;EACjJ,KAAK,iDAAiD,UAAU;EAChE,KAAK,4DAA4D,UAAU;E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X,IAAI,OAAO;EACZ,CAAC;EACD,UAAU,KAAK;GACd,MAAM;GACN,SAAS,GAAG,6BAA6B,WAAW,OAAO,UAAU,gCAAgC,KAAK,UAAU,mHAAmH,OAAO,UAAU,cAAc,OAAO,UAAU,gBAAgB,KAAK,UAAU;GACtT,KAAK,kBAAkB,KAAK,UAAU,6BAA6B,KAAK,UAAU,cAAc,OAAO,UAAU,2SAA2S,WAAW,mJAAmJ,MAAM,uBAAuB;IACtlB,aAAa,OAAO;IACpB,MAAM,KAAK;IACX,IAAI,OAAO;GACZ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;GACd,UAAU;IACT,aAAa,OAAO;IACpB,YAAY;IACZ,YAAY,OAAO;GACpB;GACA,MAAM;IACL,MAAM;IACN,cAAc,KAAK;IACnB,cAAc,OAAO;GACtB;EACD,CAAC;CACF;CACA,OAAO;AACR;AAGA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,UAAU,yBAAyB,KAAK;CAC9C,OAAO;EACN,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ;CAC1B;AACD;AACA,MAAM,yBAAyB;CAC9B,MAAM;CACN,MAAM;CACN,UAAU;CACV,SAAS;CACT,SAAS;AACV;;;;;;;;;;;AAWA,SAAS,iCAAiC,OAAO;CAChD,MAAM,cAAc,MAAM,eAAe;CACzC,OAAO;EACN,MAAM;EACN,MAAM;GACL;GACA;GACA;EACD;EACA,QAAQ;GACP,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,YAAY,EAAE,WAAW;IACxB,MAAM;IACN,OAAO;GACR,EAAE;GACF,mBAAmB;IAClB,UAAU,sBAAsB,GAAG,WAAW;IAC9C,UAAU,sBAAsB,GAAG,WAAW;GAC/C;EACD;CACD;AACD;AAGA,IAAI,kBAAkB,IAAI,oBAAoB"}
1
+ {"version":3,"file":"control-BYOcSVih.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/control.mjs"],"sourcesContent":["import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from \"./authoring-type-constructors-DIyheCzv.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-Xmpe1PGb.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-C90xg7_q.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-BVk5bjdH.mjs\";\nimport { SQL_EXPRESSION_DATA_TYPE_ID, assertNothingCastsFromSqlExpression, sqlExpressionAuthoringEntry, sqlExpressionDataType } from \"@internal/sql-contract/sql-expression\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { describeUnsupportedSqlAttribute, sqlAttributeSpecs } from \"@internal/sql-contract-psl/attribute-specs\";\nimport { TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG, TIMESTAMP_NOW_GENERATOR_ID, temporalAuthoringPresets, temporalPhaseTemplate } from \"@internal/framework-components/authoring\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions, assembleDataTypes, extractCodecLookup, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID, isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { ForeignKey, SqlStorage, StorageTable, isMaterializedSqlNamespace, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { checkSqlDefaultBody } from \"@internal/sql-contract/validators\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/operation-preview.ts\nfunction isDdlStatement(sqlStatement) {\n\tconst trimmed = sqlStatement.trim().toLowerCase();\n\treturn trimmed.startsWith(\"create \") || trimmed.startsWith(\"alter \") || trimmed.startsWith(\"drop \");\n}\nfunction hasExecuteSteps(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tif (!Array.isArray(execute)) return false;\n\treturn execute.every((step) => typeof step === \"object\" && step !== null && \"sql\" in step);\n}\n/**\n* Extracts a best-effort SQL DDL preview for CLI plan output.\n* Presentation-only: never used to decide migration correctness.\n*/\nfunction extractSqlDdl(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tif (!hasExecuteSteps(operation)) continue;\n\t\tfor (const step of operation.execute) if (typeof step.sql === \"string\" && isDdlStatement(step.sql)) statements.push(step.sql.trim());\n\t}\n\treturn statements;\n}\n/**\n* Wraps `extractSqlDdl` into the family-agnostic `OperationPreview` shape.\n* Each statement carries `language: 'sql'`.\n*/\nfunction sqlOperationsToPreview(operations) {\n\treturn { statements: extractSqlDdl(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"sql\"\n\t})) };\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction missingDescriptorOperationError(targetId, operation) {\n\treturn sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `SQL target \"${targetId}\" is missing the required ${operation} descriptor operation`, {\n\t\twhy: `The target descriptor does not contribute the ${operation} operation the SQL family requires for this call.`,\n\t\tfix: `Use a target package whose control descriptor implements ${operation}.`,\n\t\tmeta: {\n\t\t\ttargetId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction extractCodecTypeIdsFromContract(contract) {\n\tconst typeIds = /* @__PURE__ */ new Set();\n\tif (typeof contract === \"object\" && contract !== null && \"storage\" in contract && typeof contract.storage === \"object\" && contract.storage !== null && \"namespaces\" in contract.storage && typeof contract.storage.namespaces === \"object\" && contract.storage.namespaces !== null) {\n\t\tconst namespaces = blindCast(contract.storage.namespaces);\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tconst tbls = ns.entries[\"table\"];\n\t\t\tif (typeof tbls !== \"object\" || tbls === null) continue;\n\t\t\tfor (const table of Object.values(tbls)) if (typeof table === \"object\" && table !== null && \"columns\" in table && typeof table.columns === \"object\" && table.columns !== null) {\n\t\t\t\tconst columns = blindCast(table.columns);\n\t\t\t\tfor (const column of Object.values(columns)) if (column && typeof column === \"object\" && \"codecId\" in column && typeof column.codecId === \"string\") typeIds.add(column.codecId);\n\t\t\t}\n\t\t}\n\t}\n\treturn Array.from(typeIds).sort();\n}\nfunction createVerifyResult(options) {\n\tconst contract = { storageHash: options.contractStorageHash };\n\tif (options.contractProfileHash) contract.profileHash = options.contractProfileHash;\n\tconst target = { expected: options.expectedTargetId };\n\tif (options.actualTargetId) target.actual = options.actualTargetId;\n\tconst meta = { contractPath: options.contractPath };\n\tif (options.configPath) meta.configPath = options.configPath;\n\treturn {\n\t\tok: options.ok,\n\t\tsummary: options.summary,\n\t\tcontract,\n\t\ttarget,\n\t\tmeta,\n\t\ttimings: { total: options.totalTime },\n\t\t...ifDefined(\"code\", options.code),\n\t\t...options.marker ? { marker: {\n\t\t\tstorageHash: options.marker.storageHash,\n\t\t\tprofileHash: options.marker.profileHash\n\t\t} } : {},\n\t\t...ifDefined(\"missingCodecs\", options.missingCodecs),\n\t\t...ifDefined(\"codecCoverageSkipped\", options.codecCoverageSkipped)\n\t};\n}\nfunction buildSqlTypeMetadataRegistry(options) {\n\tconst { target, adapter, extensions } = options;\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst targetId = adapter.targetId;\n\tconst descriptors = [\n\t\ttarget,\n\t\tadapter,\n\t\t...extensions\n\t];\n\tfor (const descriptor of descriptors) {\n\t\tconst storageTypes = descriptor.types?.storage;\n\t\tif (!storageTypes) continue;\n\t\tfor (const storageType of storageTypes) if (storageType.familyId === \"sql\" && storageType.targetId === targetId) registry.set(storageType.typeId, {\n\t\t\ttypeId: storageType.typeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: storageType.targetId,\n\t\t\t...storageType.nativeType !== void 0 ? { nativeType: storageType.nativeType } : {}\n\t\t});\n\t}\n\treturn registry;\n}\n/**\n* Builds a map from each extension id to the set of extension ids it\n* transitively depends on. Uses the same declared-dependency data that\n* `buildExtensionLoadOrder` in control-stack uses.\n*/\nfunction buildTransitiveDependsOnMap(extensions) {\n\tconst directDeps = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tconst packs = ext.contractSpace?.contractJson?.extensions;\n\t\tconst deps = packs !== null && typeof packs === \"object\" ? Object.keys(packs) : [];\n\t\tdirectDeps.set(ext.id, deps);\n\t}\n\tconst result = /* @__PURE__ */ new Map();\n\tconst resolve = (id, visiting) => {\n\t\tconst cached = result.get(id);\n\t\tif (cached !== void 0) return cached;\n\t\tconst set = /* @__PURE__ */ new Set();\n\t\tresult.set(id, set);\n\t\tfor (const depId of directDeps.get(id) ?? []) {\n\t\t\tset.add(depId);\n\t\t\tif (!visiting.has(depId)) {\n\t\t\t\tvisiting.add(depId);\n\t\t\t\tfor (const transitive of resolve(depId, visiting)) set.add(transitive);\n\t\t\t\tvisiting.delete(depId);\n\t\t\t}\n\t\t}\n\t\treturn set;\n\t};\n\tfor (const ext of extensions) resolve(ext.id, /* @__PURE__ */ new Set([ext.id]));\n\treturn result;\n}\n/**\n* Asserts that no cross-space FK in any extension points against the\n* dependency direction.\n*\n* A cross-space FK (target.spaceId present) from extension A pointing at\n* space B is a violation when B depends on A (directly or transitively),\n* because that means A is pointing \"upward\" against the dependency arrows\n* established by the extension load order.\n*\n* Throws with a diagnostic naming the violating extension (source), the\n* target space, and the direction violation.\n*/\nfunction isObjectRecord(v) {\n\treturn typeof v === \"object\" && v !== null;\n}\nfunction assertNoCrossSpaceFkReverseReferences(extensions) {\n\tconst dependsOnMap = buildTransitiveDependsOnMap(extensions);\n\tfor (const ext of extensions) {\n\t\tconst namespaces = ext.contractSpace?.contractJson?.storage?.namespaces;\n\t\tif (!isObjectRecord(namespaces)) continue;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tif (!isObjectRecord(ns)) continue;\n\t\t\tconst entries = ns[\"entries\"];\n\t\t\tif (!isObjectRecord(entries)) continue;\n\t\t\tfor (const slot of Object.values(entries)) {\n\t\t\t\tif (!isObjectRecord(slot)) continue;\n\t\t\t\tfor (const table of Object.values(slot)) {\n\t\t\t\t\tif (!isObjectRecord(table)) continue;\n\t\t\t\t\tconst foreignKeys = table[\"foreignKeys\"];\n\t\t\t\t\tif (!Array.isArray(foreignKeys)) continue;\n\t\t\t\t\tfor (const fk of foreignKeys) {\n\t\t\t\t\t\tif (!isObjectRecord(fk)) continue;\n\t\t\t\t\t\tconst target = fk[\"target\"];\n\t\t\t\t\t\tif (!isObjectRecord(target)) continue;\n\t\t\t\t\t\tif (target[\"spaceId\"] === void 0) continue;\n\t\t\t\t\t\tconst targetSpaceId = target[\"spaceId\"];\n\t\t\t\t\t\tif (typeof targetSpaceId !== \"string\") continue;\n\t\t\t\t\t\tif (dependsOnMap.get(targetSpaceId)?.has(ext.id)) throw sqlFamilyError(\"CONTRACT.FOREIGN_KEY_INVALID\", `Cross-space FK reverse-reference detected: extension \"${ext.id}\" has a cross-space FK targeting space \"${targetSpaceId}\", but \"${targetSpaceId}\" depends on \"${ext.id}\". Cross-space FKs must follow the dependency direction (a space can only reference spaces it depends on, not spaces that depend on it).`, {\n\t\t\t\t\t\t\twhy: \"The foreign key points against the contract-space dependency direction.\",\n\t\t\t\t\t\t\tfix: \"Move the foreign key to the depending space, or restructure the extension dependencies so the referencing space depends on the referenced one.\",\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\textensionId: ext.id,\n\t\t\t\t\t\t\t\ttargetSpaceId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nfunction createSqlFamilyInstance(stack) {\n\tif (!stack.adapter) throw new InternalError(\"SQL family requires an adapter descriptor in ControlStack\");\n\tassertNothingCastsFromSqlExpression(stack.declaredDataTypes);\n\tconst target = blindCast(stack.target);\n\tconst adapter = blindCast(stack.adapter);\n\tconst extensions = blindCast(stack.extensions);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...sqlContractCanonicalizationHooks\n\t\t});\n\t}\n\tassertNoCrossSpaceFkReverseReferences(extensions);\n\tconst { codecTypeImports, extensionIds } = stack;\n\tconst typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t});\n\tlet controlAdapter;\n\tconst getControlAdapter = () => controlAdapter ??= adapter.create(stack);\n\tconst targetSerializer = blindCast(target).contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\n\tconst pslBuildContext = {\n\t\tauthoringContributions: stack.authoringContributions,\n\t\tcodecLookup: stack.codecLookup,\n\t\tdataTypeLookup: stack.dataTypeLookup\n\t};\n\tconst targetBuildPslContract = blindCast(target).buildPslContract;\n\tconst diffSchema = blindCast(target).diffSchema;\n\tconst targetGranularityOf = blindCast(target).classifySubjectGranularity;\n\tconst targetEntityKindOf = blindCast(target).classifyEntityKind;\n\tconst describedContracts = extensions.flatMap((extension) => extension.contractSpace ? [{\n\t\tspaceId: extension.id,\n\t\tcontract: extension.contractSpace.contractJson\n\t}] : []);\n\tconst deserializeWithTargetSerializer = (contractOrJson) => {\n\t\tconst serializer = targetSerializer ?? new SqlContractSerializer();\n\t\tconst json = targetSerializer !== void 0 && !isPlainRecord(contractOrJson) ? targetSerializer.serializeContract(blindCast(contractOrJson)) : contractOrJson;\n\t\treturn serializer.deserializeContract(json);\n\t};\n\treturn {\n\t\tfamilyId: \"sql\",\n\t\tcodecTypeImports,\n\t\textensionIds,\n\t\ttypeMetadataRegistry,\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn deserializeWithTargetSerializer(contractJson);\n\t\t},\n\t\tasync verify(verifyOptions) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = verifyOptions;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst marker = await getControlAdapter().readMarker(driver, APP_SPACE_ID);\n\t\t\tlet missingCodecs;\n\t\t\tlet codecCoverageSkipped = false;\n\t\t\tconst supportedTypeIds = collectSupportedCodecTypeIds([\n\t\t\t\tadapter,\n\t\t\t\ttarget,\n\t\t\t\t...extensions\n\t\t\t]);\n\t\t\tif (supportedTypeIds.length === 0) codecCoverageSkipped = true;\n\t\t\telse {\n\t\t\t\tconst supportedSet = new Set(supportedTypeIds);\n\t\t\t\tconst missing = extractCodecTypeIdsFromContract(contract).filter((id) => !supportedSet.has(id));\n\t\t\t\tif (missing.length > 0) missingCodecs = missing;\n\t\t\t}\n\t\t\tif (!marker) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractTarget !== expectedTargetId) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\treturn createVerifyResult({\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\tconst contract = deserializeWithTargetSerializer(options.contract);\n\t\t\tif (!diffSchema) throw missingDescriptorOperationError(target.targetId, \"diffSchema\");\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn verifySqlSchemaByDiff({\n\t\t\t\tcontract,\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\tdiffSchema,\n\t\t\t\tgranularityOf: targetGranularityOf\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject granularity on demand, by resolving\n\t\t* its node's `nodeKind` through the target's classifier — the\n\t\t* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability. Framework consumers spanning contract spaces (the\n\t\t* migration aggregate's unclaimed-elements sweep) detect and call this\n\t\t* instead of reaching into the concrete schema-IR node, which they\n\t\t* cannot read; nothing is stamped on the issue or the node.\n\t\t*/\n\t\tclassifySubjectGranularity(issue) {\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn classifyDiffSubjectGranularity(issue, targetGranularityOf);\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject storage `entityKind` on demand, by\n\t\t* resolving its node's `nodeKind` through the target's classifier —\n\t\t* the sibling of `classifySubjectGranularity` above, and part of the\n\t\t* same {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability.\n\t\t*/\n\t\tclassifyEntityKind(issue) {\n\t\t\tif (!targetEntityKindOf) throw missingDescriptorOperationError(target.targetId, \"classifyEntityKind\");\n\t\t\treturn classifyDiffEntityKind(issue, targetEntityKindOf);\n\t\t},\n\t\tasync sign(options) {\n\t\t\tconst { driver, contract: contractInput, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(contractInput);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = \"profileHash\" in contract && typeof contract.profileHash === \"string\" ? contract.profileHash : contractStorageHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst controlAdapter = getControlAdapter();\n\t\t\tconst lowererContext = { contract };\n\t\t\tfor (const query of controlAdapter.bootstrapSignMarkerQueries()) {\n\t\t\t\tconst lowered = await controlAdapter.lowerToExecuteRequest(query, lowererContext);\n\t\t\t\tawait driver.query(lowered.sql, lowered.params);\n\t\t\t}\n\t\t\tconst existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.insertMarker(driver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst existingStorageHash = existingMarker.storageHash;\n\t\t\t\tconst existingProfileHash = existingMarker.profileHash;\n\t\t\t\tif (!(existingStorageHash === contractStorageHash) || !(existingProfileHash === contractProfileHash)) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingStorageHash,\n\t\t\t\t\t\tprofileHash: existingProfileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(driver, APP_SPACE_ID, existingStorageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw sqlFamilyError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\", {\n\t\t\t\t\t\twhy: \"Another process updated the contract marker between the read and the compare-and-swap write.\",\n\t\t\t\t\t\tfix: \"Re-run the sign command; if it keeps failing, make sure only one migration process runs at a time.\",\n\t\t\t\t\t\tmeta: { space: APP_SPACE_ID }\n\t\t\t\t\t});\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\tconst totalTime = Date.now() - startTime;\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contractTarget,\n\t\t\t\t\tactual: contractTarget\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...previousHashes ? { previous: previousHashes } : {}\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t\t},\n\t\t\t\ttimings: { total: totalTime }\n\t\t\t};\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(options.driver, options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(options.driver);\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(options.driver, options.space);\n\t\t},\n\t\tasync initMarker(options) {\n\t\t\treturn getControlAdapter().initMarker(options.driver, options.space, options.destination);\n\t\t},\n\t\tasync updateMarker(options) {\n\t\t\treturn getControlAdapter().updateMarker(options.driver, options.space, options.expectedFrom, options.destination);\n\t\t},\n\t\tasync writeLedgerEntry(options) {\n\t\t\treturn getControlAdapter().writeLedgerEntry(options.driver, options.space, options.entry);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspect(options.driver, options.contract);\n\t\t},\n\t\tinferPslContract(schemaIR) {\n\t\t\tif (!targetInferPslContract) throw sqlFamilyError(\"CONTRACT.INFER_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract infer (no inferPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the inferPslContract hook, so a PSL contract cannot be inferred from the database schema.\",\n\t\t\t\tfix: \"Use a target package that supports contract infer, or author the contract instead of inferring it.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn targetInferPslContract(schemaIR, pslBuildContext, describedContracts);\n\t\t},\n\t\tbuildPslContract(contract) {\n\t\t\tif (!targetBuildPslContract) throw sqlFamilyError(\"CONTRACT.PRINT_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract print (no buildPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the buildPslContract hook, so the contract cannot be printed as a Prisma 8 PSL file.\",\n\t\t\t\tfix: \"Use a target whose descriptor provides buildPslContract, or write the Prisma 8 PSL file by hand.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdocument: targetBuildPslContract(contract, pslBuildContext),\n\t\t\t\tsourceSettings: ifDefined(\"defaultControlPolicy\", contract.defaultControlPolicy)\n\t\t\t};\n\t\t},\n\t\tlowerAst(ast, context) {\n\t\t\treturn getControlAdapter().lowerToExecuteRequest(ast, context);\n\t\t},\n\t\tbootstrapControlTableQueries() {\n\t\t\treturn getControlAdapter().bootstrapControlTableQueries();\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn sqlOperationsToPreview(operations);\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\tconst root = blindCast(schema);\n\t\t\tconst namespaceEntries = root.namespaces !== void 0 ? Object.entries(root.namespaces).map(([namespaceKey, namespace]) => [namespaceKey, namespace.tables]) : [[void 0, root.tables ?? {}]];\n\t\t\tconst qualify = namespaceEntries.length > 1;\n\t\t\tconst tableNodes = namespaceEntries.flatMap(([namespaceKey, tables]) => Object.entries(tables).map(([tableName, table]) => [\n\t\t\t\tqualify && namespaceKey !== void 0 ? `${namespaceKey}.${tableName}` : tableName,\n\t\t\t\ttableName,\n\t\t\t\ttable\n\t\t\t])).map(([displayName, tableName, table]) => {\n\t\t\t\tconst children = [];\n\t\t\t\tconst columnNodes = [];\n\t\t\t\tfor (const [columnName, column] of Object.entries(table.columns)) {\n\t\t\t\t\tconst label = `${columnName}: ${column.nativeType} (${column.nullable ? \"nullable\" : \"not nullable\"})`;\n\t\t\t\t\tcolumnNodes.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"field\",\n\t\t\t\t\t\tid: `column-${displayName}-${columnName}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tnativeType: column.nativeType,\n\t\t\t\t\t\t\tnullable: column.nullable,\n\t\t\t\t\t\t\t...ifDefined(\"default\", column.default)\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tif (columnNodes.length > 0) children.push(new SchemaTreeNode({\n\t\t\t\t\tkind: \"collection\",\n\t\t\t\t\tid: `columns-${displayName}`,\n\t\t\t\t\tlabel: \"columns\",\n\t\t\t\t\tchildren: columnNodes\n\t\t\t\t}));\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\tconst pkColumns = table.primaryKey.columns.join(\", \");\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `primary-key-${displayName}`,\n\t\t\t\t\t\tlabel: `primary key: ${pkColumns}`,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t\t\t\t\t...table.primaryKey.name ? { name: table.primaryKey.name } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const unique of table.uniques) {\n\t\t\t\t\tconst name = unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_unique`;\n\t\t\t\t\tconst label = `unique ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `unique-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: unique.columns,\n\t\t\t\t\t\t\tunique: true\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const index of table.indexes) {\n\t\t\t\t\tconst name = index.name;\n\t\t\t\t\tconst label = index.unique ? `unique index ${name}` : `index ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `index-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: index.columns,\n\t\t\t\t\t\t\tunique: index.unique\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tconst tableMeta = {};\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\ttableMeta[\"primaryKey\"] = table.primaryKey.columns;\n\t\t\t\t\tif (table.primaryKey.name) tableMeta[\"primaryKeyName\"] = table.primaryKey.name;\n\t\t\t\t}\n\t\t\t\tif (table.foreignKeys.length > 0) tableMeta[\"foreignKeys\"] = table.foreignKeys.map((fk) => ({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\t...fk.name ? { name: fk.name } : {}\n\t\t\t\t}));\n\t\t\t\treturn new SchemaTreeNode({\n\t\t\t\t\tkind: \"entity\",\n\t\t\t\t\tid: `table-${displayName}`,\n\t\t\t\t\tlabel: `table ${displayName}`,\n\t\t\t\t\t...Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {},\n\t\t\t\t\t...children.length > 0 ? { children } : {}\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn { root: new SchemaTreeNode({\n\t\t\t\tkind: \"root\",\n\t\t\t\tid: \"sql-schema\",\n\t\t\t\tlabel: \"database\",\n\t\t\t\t...tableNodes.length > 0 ? { children: tableNodes } : {}\n\t\t\t}) };\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst sqlFamilyDescribeUnsupportedAttribute = describeUnsupportedSqlAttribute;\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tdataTypes = [sqlExpressionDataType];\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors,\n\t\tattributeSpecs: sqlAttributeSpecs,\n\t\tdataTypes: { [SQL_EXPRESSION_DATA_TYPE_ID]: sqlExpressionAuthoringEntry }\n\t};\n\tpslDiagnostics = { describeUnsupportedAttribute: sqlFamilyDescribeUnsupportedAttribute };\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/apply-table-rename.ts\nconst TABLE_RENAME_UNMATCHED_CODE = \"MIGRATION.TABLE_RENAME_UNMATCHED\";\nfunction tableLabel(namespaceId, tableName) {\n\treturn namespaceId === void 0 || namespaceId === UNBOUND_NAMESPACE_ID ? tableName : `${namespaceId}.${tableName}`;\n}\nfunction namespacesDeclaring(contract, tableName) {\n\treturn Object.values(contract.storage.namespaces).filter((namespace) => Object.hasOwn(namespace.entries.table ?? {}, tableName)).map((namespace) => namespace.id);\n}\nfunction declares(contract, namespaceId, tableName) {\n\treturn Object.hasOwn(contract.storage.namespaces[namespaceId]?.entries.table ?? {}, tableName);\n}\nfunction unmatched(rename, reason) {\n\treturn sqlFamilyError(TABLE_RENAME_UNMATCHED_CODE, `renameTable \"${tableLabel(rename.namespaceId, rename.from)}\" to \"${rename.to}\" does not match the migration's contracts: ${reason}.`, {\n\t\twhy: \"renameTable must name a table of the migration's start contract and a new name that the end contract has and the start contract does not. Make the rename its own schema change, so the migration's start contract is the schema before the rename and its end contract the schema after it, and check the spelling and the namespace.\",\n\t\tmeta: {\n\t\t\tfrom: rename.from,\n\t\t\tto: rename.to\n\t\t}\n\t});\n}\nfunction resolveTableRename(rename, startContract, endContract) {\n\tconst namespaceIds = rename.namespaceId === void 0 ? namespacesDeclaring(startContract, rename.from) : declares(startContract, rename.namespaceId, rename.from) ? [rename.namespaceId] : [];\n\tconst [namespaceId, ...others] = namespaceIds;\n\tif (namespaceId === void 0) return notOk(unmatched(rename, `table \"${tableLabel(rename.namespaceId, rename.from)}\" does not exist in the start contract`));\n\tif (others.length > 0) return notOk(unmatched(rename, `table \"${rename.from}\" is declared in more than one namespace (${namespaceIds.join(\", \")}); name its namespace`));\n\tif (declares(startContract, namespaceId, rename.to)) return notOk(unmatched(rename, `table \"${tableLabel(namespaceId, rename.to)}\" already exists in the start contract`));\n\tif (!declares(endContract, namespaceId, rename.to)) return notOk(unmatched(rename, `table \"${tableLabel(namespaceId, rename.to)}\" does not exist in the end contract`));\n\treturn ok({\n\t\tnamespaceId,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n}\nfunction renamedReference(reference, rename) {\n\tif (!(reference.spaceId === void 0) || reference.namespaceId !== rename.namespaceId || reference.tableName !== rename.from) return reference;\n\treturn {\n\t\t...reference,\n\t\ttableName: rename.to\n\t};\n}\nfunction renameForeignKeys(table, rename) {\n\tif (!table.foreignKeys.some((fk) => renamedReference(fk.source, rename) !== fk.source || renamedReference(fk.target, rename) !== fk.target)) return table;\n\treturn new StorageTable({\n\t\t...table,\n\t\tforeignKeys: table.foreignKeys.map((fk) => new ForeignKey({\n\t\t\t...fk,\n\t\t\tsource: renamedReference(fk.source, rename),\n\t\t\ttarget: renamedReference(fk.target, rename)\n\t\t}))\n\t});\n}\n/**\n* The same namespace instance with only `entries` replaced: every own\n* property, including the non-enumerable `kind`, is carried over onto the\n* same prototype, so the target's namespace class (its `qualifyTable`,\n* `ddlSchemaName`, entity getters) keeps working on the copy. This is the\n* one place a frozen contract node is rebuilt without its constructor: the\n* constructors re-hydrate `entries` from raw input, which the already\n* hydrated entities here do not need.\n*/\nfunction withEntries(namespace, entries) {\n\tconst copy = Object.create(Object.getPrototypeOf(namespace), {\n\t\t...Object.getOwnPropertyDescriptors(namespace),\n\t\tentries: {\n\t\t\tvalue: Object.freeze(entries),\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t\tconfigurable: false\n\t\t}\n\t});\n\treturn Object.freeze(copy);\n}\nfunction renameTableInNamespace(namespace, rename, renameTableReferences) {\n\tconst ownsTable = rename.namespaceId === namespace.id;\n\tconst tables = Object.entries(namespace.entries.table ?? {}).map(([name, table]) => [ownsTable && name === rename.from ? rename.to : name, renameForeignKeys(table, rename)]);\n\tif (tables.every(([name, table]) => namespace.entries.table?.[name] === table)) return namespace;\n\tif (!isMaterializedSqlNamespace(namespace)) throw new InternalError(`applyTableRename: namespace \"${namespace.id}\" is not a materialized SQL namespace`);\n\tconst renamedTables = {\n\t\t...namespace.entries,\n\t\ttable: Object.fromEntries(tables)\n\t};\n\treturn withEntries(namespace, renameTableReferences === void 0 || !ownsTable ? renamedTables : renameTableReferences(renamedTables, rename));\n}\nfunction renameTableInContract(contract, rename, renameTableReferences) {\n\tconst namespaces = Object.fromEntries(Object.entries(contract.storage.namespaces).map(([id, namespace]) => [id, renameTableInNamespace(namespace, rename, renameTableReferences)]));\n\tconst materialized = {};\n\tfor (const [id, namespace] of Object.entries(namespaces)) {\n\t\tif (!isMaterializedSqlNamespace(namespace)) throw new InternalError(`applyTableRename: namespace \"${id}\" is not a materialized SQL namespace`);\n\t\tmaterialized[id] = namespace;\n\t}\n\treturn {\n\t\t...contract,\n\t\tstorage: new SqlStorage({\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...contract.storage.types === void 0 ? {} : { types: contract.storage.types },\n\t\t\tnamespaces: materialized\n\t\t})\n\t};\n}\n/**\n* Resolves the table a migration renames against its start and end contracts and returns the start contract with that table under its new name, so a diff against the end contract sees the table under one name. The table must exist in the start contract (in exactly one namespace when the namespace is not given), and the new name must exist in the end contract and not in the start contract; otherwise the rename is refused with `MIGRATION.TABLE_RENAME_UNMATCHED`.\n*\n* Foreign keys that name the renamed table on either side are retargeted. Index, unique, check and primary-key names are carried unchanged. Target entity kinds that name the table are renamed by the target's `renameTableReferences`.\n*/\nfunction applyTableRename(input) {\n\tif (input.startContract === null) return notOk(unmatched(input.rename, \"the migration has no start contract\"));\n\tconst resolved = resolveTableRename(input.rename, input.startContract, input.endContract);\n\tif (!resolved.ok) return resolved;\n\treturn ok({\n\t\tcontract: renameTableInContract(input.startContract, resolved.value, input.renameTableReferences),\n\t\trename: resolved.value\n\t});\n}\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst baseNativeType = expandNativeType ? expandNativeType({\n\t\tnativeType: resolved.nativeType,\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams)\n\t}) : resolved.nativeType;\n\tconst nativeType = baseNativeType;\n\tconst many = column.many !== void 0 && column.many !== false;\n\tconst resolvedNativeType = many ? `${baseNativeType}[]` : baseNativeType;\n\tconst rawColumnDefault = column.default ?? void 0;\n\tconst resolvedColumnDefault = rawColumnDefault !== void 0 && resolveDefault ? resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;\n\treturn {\n\t\tname,\n\t\tnativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", many ? true : void 0),\n\t\t...ifDefined(\"default\", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0),\n\t\tresolvedNativeType,\n\t\t...ifDefined(\"resolvedDefault\", resolvedColumnDefault),\n\t\t...ifDefined(\"authoredDefault\", rawColumnDefault),\n\t\tcodecRef: buildColumnCodecRef(resolved, many ? true : void 0),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {},\n\t\t...ifDefined(\"dataType\", dataTypeOf?.(resolved.codecId))\n\t};\n}\n/**\n* Builds the column's `CodecRef` from its resolved (post-`typeRef`) codec\n* identity — the same construction the query AST and the migration DDL\n* renderer already use (TML-2456, TML-2918).\n*/\nfunction buildColumnCodecRef(resolved, many) {\n\treturn {\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams !== void 0 ? blindCast(resolved.typeParams) : void 0),\n\t\t...ifDefined(\"many\", many)\n\t};\n}\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referenced = storageTypes[column.typeRef];\n\tif (!referenced) throw sqlFamilyError(\"CONTRACT.TYPE_UNKNOWN\", `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`, {\n\t\twhy: \"The column typeRef does not resolve to any entry in the contract storage.types map.\",\n\t\tfix: \"Regenerate the contract from its authoring source; do not hand-edit contract JSON.\",\n\t\tmeta: { typeRef: column.typeRef }\n\t});\n\tif (isStorageTypeInstance(referenced)) return {\n\t\tcodecId: referenced.codecId,\n\t\tnativeType: referenced.nativeType,\n\t\ttypeParams: referenced.typeParams\n\t};\n\tthrow new InternalError(`Storage type \"${column.typeRef}\" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`);\n}\nfunction convertCheck(check, tableName, tableColumns) {\n\treturn {\n\t\tnaming: namingOf(check.name, check.prefix),\n\t\texpression: check.expression,\n\t\tdependsOn: flatColumnDependsOn(tableName, tableColumns)\n\t};\n}\nfunction convertUnique(unique, tableName) {\n\treturn {\n\t\tcolumns: unique.columns,\n\t\t...ifDefined(\"name\", unique.name),\n\t\tdependsOn: flatColumnDependsOn(tableName, unique.columns)\n\t};\n}\nfunction convertIndex(index, tableName, tableColumns) {\n\tconst base = {\n\t\tnaming: namingOf(index.name, index.prefix),\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.where !== void 0,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: void 0,\n\t\tdependsOn: flatColumnDependsOn(tableName, index.columns ?? tableColumns)\n\t};\n\treturn index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: index.columns ?? []\n\t};\n}\n/**\n* The referenced table's chain in the flat (single-schema) tree\n* `contractToSchemaIR`/`contractNamespaceToSchemaIR` build: the root\n* (`SqlSchemaIR`, fixed `'database'` id) followed by the table's own id.\n* Postgres discards this when it re-derives the FK against its own\n* multi-schema tree shape (`contractToPostgresDatabaseSchemaNode`); SQLite's\n* flat tree uses it as-is.\n*/\nfunction flatSchemaDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the flat tree. Dropping\n* a covered column auto-drops the object, so the object's drop must precede\n* the column's; the graph derives that direction from these edges.\n*/\nfunction flatColumnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\t\tid: \"database\"\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\t\tid: `column:${column}`\n\t\t}\n\t]);\n}\n/**\n* The FK's referenced-namespace identity comes from the target's namespace\n* node, not the raw namespace-id string. An unbound target namespace stamps\n* no `referencedSchema` at all — the FK node's id renders the absence as the\n* empty segment, which is what flat (single-schema) introspection produces,\n* so both diff sides' FK ids meet by construction. A bound namespace (or a\n* cross-space target whose namespace lives in another contract's storage)\n* stamps its coordinate verbatim; namespaced targets (Postgres) resolve the\n* real DDL schema downstream.\n*\n* `dependsOn` carries the referenced table (created before the FK, dropped\n* after it) plus the FK's own columns (dropped after the FK, since dropping a\n* column auto-drops the FK built on it).\n*/\nfunction convertForeignKey(fk, storage) {\n\tconst targetIsUnbound = storage.namespaces[fk.target.namespaceId]?.isUnbound === true;\n\treturn {\n\t\tcolumns: fk.source.columns,\n\t\treferencedTable: fk.target.tableName,\n\t\t...targetIsUnbound ? {} : { referencedSchema: fk.target.namespaceId },\n\t\treferencedColumns: fk.target.columns,\n\t\t...ifDefined(\"name\", fk.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\tdependsOn: [flatSchemaDependsOn(fk.target.tableName), ...flatColumnDependsOn(fk.source.tableName, fk.source.columns)]\n\t};\n}\nfunction convertTable(name, table, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault, dataTypeOf);\n\tconst checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, name, Object.keys(table.columns))) : void 0;\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey !== void 0 ? {\n\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t...ifDefined(\"name\", table.primaryKey.name),\n\t\t\tdependsOn: flatColumnDependsOn(name, table.primaryKey.columns)\n\t\t} : void 0),\n\t\tforeignKeys: table.foreignKeys.map((fk) => convertForeignKey(fk, storage)),\n\t\tuniques: table.uniques.map((u) => convertUnique(u, name)),\n\t\tindexes: table.indexes.map((i) => convertIndex(i, name, Object.keys(table.columns))),\n\t\t...ifDefined(\"checks\", checks)\n\t});\n}\n/**\n* Detects destructive changes between two contract storages.\n*\n* The additive-only planner silently ignores removals (tables, columns).\n* This function detects those removals so callers can report them as conflicts\n* rather than silently producing an empty plan.\n*\n* Returns an empty array if no destructive changes are found.\n*/\nfunction detectDestructiveChanges(from, to) {\n\tif (!from) return [];\n\tconst hasOwn = (value, key) => Object.hasOwn(value, key);\n\tconst conflicts = [];\n\tconst namespaceIds = [.../* @__PURE__ */ new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)])].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst fromNs = from.namespaces[namespaceId];\n\t\tconst toNs = to.namespaces[namespaceId];\n\t\tconst fromTables = fromNs?.entries.table;\n\t\tif (!fromTables) continue;\n\t\tfor (const tableName of Object.keys(fromTables)) {\n\t\t\tconst toTableRaw = toNs?.entries.table?.[tableName];\n\t\t\tif (!StorageTable.is(toTableRaw)) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tkind: \"tableRemoved\",\n\t\t\t\t\tsummary: `Table \"${tableName}\" was removed`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst toTable = toTableRaw;\n\t\t\tconst fromTableRaw = fromTables[tableName];\n\t\t\tif (!StorageTable.is(fromTableRaw)) continue;\n\t\t\tconst fromTable = fromTableRaw;\n\t\t\tfor (const columnName of Object.keys(fromTable.columns)) if (!hasOwn(toTable.columns, columnName)) conflicts.push({\n\t\t\t\tkind: \"columnRemoved\",\n\t\t\t\tsummary: `Column \"${tableName}\".\"${columnName}\" was removed`\n\t\t\t});\n\t\t}\n\t}\n\treturn conflicts;\n}\n/**\n* Converts a `Contract` to `SqlSchemaIR`.\n*\n* Reads `contract.storage` for tables and `contract.storage.types` for type\n* annotations. Storage-type annotations are written under\n* `options.annotationNamespace`.\n*\n* Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n* structural information. When `expandNativeType` is provided, parameterized types\n* are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n* resulting IR compares correctly against the \"to\" contract during planning.\n*\n* Returns an empty schema IR when `contract` is `null` (new project).\n*/\n/**\n* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by\n* table name within that namespace. Unlike {@link contractToSchemaIR}, which\n* flattens every namespace's tables into one bare-keyed record (and throws on a\n* cross-namespace name collision), this scopes the table iteration to one\n* namespace so the same table name can exist in two schemas.\n*\n* The full `storage` is still passed to `convertTable`, so value-set / enum /\n* type resolution that legitimately spans namespaces is unaffected. Foreign\n* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace\n* FKs survive per-namespace conversion. The `annotations` block (storage-type\n* derived) is omitted here — the per-namespace tree consumer reads only the\n* per-table fields.\n*/\nfunction contractNamespaceToSchemaIR(storage, namespaceId, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (!namespace) return new SqlSchemaIR({ tables: {} });\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);\n\t\ttables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, options.dataTypeOf, storage);\n\t}\n\treturn new SqlSchemaIR({ tables });\n}\nfunction contractToSchemaIR(contract, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tif (!contract) return new SqlSchemaIR({ tables: {} });\n\tconst storage = contract.storage;\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);\n\t\tconst tableDef = tableDefRaw;\n\t\tif (tables[tableName] !== void 0) throw sqlFamilyError(\"CONTRACT.TABLE_AMBIGUOUS\", `contractToSchemaIR: duplicate SQL table name \"${tableName}\" across namespaces (ambiguous for flat SqlSchemaIR.tables).`, {\n\t\t\twhy: \"Two namespaces declare a table with the same name, which is ambiguous for the flat schema-IR table map.\",\n\t\t\tfix: \"Rename one of the tables so every table name is unique across namespaces.\",\n\t\t\tmeta: { table: tableName }\n\t\t});\n\t\ttables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, options.dataTypeOf, storage);\n\t}\n\treturn new SqlSchemaIR({\n\t\ttables,\n\t\t...ifDefined(\"annotations\", deriveAnnotations(storage, options.annotationNamespace, options.resolveEnumNamespaceSchema))\n\t});\n}\nfunction deriveAnnotations(storage, annotationNamespace, _resolveEnumNamespaceSchema) {\n\tconst storageTypes = {};\n\tfor (const typeInstance of Object.values(storage.types ?? {})) if (isStorageTypeInstance(typeInstance)) storageTypes[typeInstance.nativeType] = typeInstance;\n\tconst envelope = { ...Object.keys(storageTypes).length > 0 ? { storageTypes } : {} };\n\tif (Object.keys(envelope).length === 0) return void 0;\n\treturn { [annotationNamespace]: envelope };\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* The control policy that governs a single call. The `external` default is an\n* un-overridable namespace floor: when the contract default is `external`, no\n* per-object `managed` override can escalate DDL above the floor, so the\n* policy is forced to `external` regardless of the node's own declaration.\n* Every other default defers to the node's effective control policy.\n*/\nfunction controlPolicyForCall(subject, defaultControlPolicy) {\n\tif (defaultControlPolicy === \"external\") return \"external\";\n\treturn effectiveControlPolicy(subject?.explicitNodeControlPolicy, defaultControlPolicy);\n}\n/**\n* Whether a call is allowed to emit under a given control policy.\n*\n* - `managed` — full lifecycle, every op allowed.\n* - `tolerated` — create-if-absent only: allowed iff the call creates a whole\n* new top-level object (and its subject was positively resolved). Anything\n* that modifies an existing object, and anything whose subject could not be\n* resolved, is suppressed.\n* - `external` / `observed` — no DDL at all.\n*/\nfunction callAllowedUnderControlPolicy(policy, subject) {\n\tswitch (policy) {\n\t\tcase \"managed\": return true;\n\t\tcase \"tolerated\": return subject?.createsNewObject === true;\n\t\tcase \"external\":\n\t\tcase \"observed\": return false;\n\t}\n}\n/**\n* Partition the calls produced for a single set of subjects into those the\n* effective control policy permits (`kept`) and a list of\n* {@link SuppressionRecord}s describing the suppressed calls.\n*\n* **Prefer {@link partitionIssuesByControlPolicy}** for the schema-issue\n* pipeline: it filters subjects out of the planner's *input* so the planner\n* never has to reason about un-modeled state on `external`/`observed`\n* subjects. This call-level helper remains for paths that bypass the issue\n* pipeline — currently the codec-emitted field-event ops, which originate\n* from declared contract fields rather than from introspected schema state\n* and therefore cannot trip the diff engine.\n*/\nfunction partitionCallsByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst kept = [];\n\tconst suppressions = [];\n\tfor (const call of options.calls) {\n\t\tconst subject = options.resolveControlPolicySubject(call);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tif (callAllowedUnderControlPolicy(policy, subject)) kept.push(call);\n\t\telse suppressions.push({\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\tfactoryName: options.resolveFactoryName(call),\n\t\t\tcreatesNewObject: subject?.createsNewObject ?? false\n\t\t});\n\t}\n\treturn Object.freeze({\n\t\tkept: Object.freeze(kept),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\n/**\n* Partition a list of schema-issue-shaped inputs by the effective control\n* policy of each issue's subject *before* the planner is invoked.\n*\n* `plannable` is the list of issues whose subject's effective policy permits\n* the planner to act on them (`managed`, or `tolerated` for whole-object\n* creation issues only). Issues for `external`/`observed` subjects, and\n* non-creation issues for `tolerated` subjects, are dropped from the planner's\n* input entirely — they never enter introspection-driven planning, never feed\n* the diff engine, and never produce DDL calls that would have to be\n* post-filtered. This sidesteps a class of failure where the diff engine\n* cannot reason about the live shape of a subject the user marked as\n* out-of-scope (`external`).\n*\n* `suppressions` is one {@link SuppressionRecord} per suppressed subject (not\n* per suppressed issue). Its `factoryName` is the creation factory name when any\n* of the subject's issues is whole-object creation (e.g. `createTable`), else\n* `undefined` — the family never invents a modification verb for an op that\n* produced no call; the target renders the message.\n*\n* Unresolved-subject issues (`resolveControlPolicySubject` returns\n* `undefined`) emit one record each; they cannot be deduplicated because they\n* carry no subject coordinate.\n*/\nfunction partitionIssuesByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst plannable = [];\n\tconst suppressedSubjects = /* @__PURE__ */ new Map();\n\tconst unresolvedSuppressions = [];\n\tfor (const issue of options.issues) {\n\t\tconst subject = options.resolveControlPolicySubject(issue);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tconst creationFactoryName = options.resolveCreationFactoryName(issue);\n\t\tif (policy === \"managed\") {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (policy === \"tolerated\" && subject !== void 0 && creationFactoryName !== void 0 && subject.createsNewObject) {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject === void 0) {\n\t\t\tunresolvedSuppressions.push({\n\t\t\t\tsubject: void 0,\n\t\t\t\tpolicy,\n\t\t\t\tfactoryName: creationFactoryName,\n\t\t\t\tcreatesNewObject: false\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst key = subjectKey(subject);\n\t\tconst existing = suppressedSubjects.get(key);\n\t\tif (existing) {\n\t\t\tif (existing.creationFactoryName === void 0 && creationFactoryName !== void 0) existing.creationFactoryName = creationFactoryName;\n\t\t} else suppressedSubjects.set(key, {\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\t...ifDefined(\"creationFactoryName\", creationFactoryName)\n\t\t});\n\t}\n\tconst suppressions = [...unresolvedSuppressions];\n\tfor (const entry of suppressedSubjects.values()) suppressions.push({\n\t\tsubject: entry.subject,\n\t\tpolicy: entry.policy,\n\t\tfactoryName: entry.creationFactoryName,\n\t\tcreatesNewObject: entry.subject.createsNewObject\n\t});\n\treturn Object.freeze({\n\t\tplannable: Object.freeze(plannable),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\nfunction subjectKey(subject) {\n\treturn `${subject.namespaceId}\\u0000${subject.entityKind ?? \"\"}\\u0000${subject.entityName ?? \"\"}\\u0000${subject.rlsPolicy ?? \"\"}`;\n}\n//#endregion\n//#region src/core/migrations/data-type-resolver.ts\n/**\n* Builds the resolver the contract→IR derivation uses to give each column its data type (ADR 254):\n* the codec's descriptor names the type, and the composed components register it. Codecs and\n* data types from extension packs are found the same way as the target's own, and a codec id two\n* components contribute is refused, as everywhere else in the stack. Returns `undefined` when no\n* framework components are supplied, so callers can omit the option.\n*/\nfunction buildDataTypeResolver(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst dataTypes = assembleDataTypes(frameworkComponents).lookup;\n\tconst codecs = extractCodecLookup(frameworkComponents);\n\treturn (codecId) => {\n\t\tconst dataTypeId = codecs.descriptorFor(codecId)?.dataType;\n\t\treturn dataTypeId === void 0 ? void 0 : dataTypes.get(dataTypeId);\n\t};\n}\n//#endregion\n//#region src/core/migrations/field-event-planner.ts\nfunction planFieldEventOperations(options) {\n\tconst priorContract = options.priorContract;\n\tconst newContract = options.newContract;\n\tconst added = [];\n\tconst dropped = [];\n\tconst altered = [];\n\tconst namespaceIds = unionSorted(priorContract ? Object.keys(priorContract.storage.namespaces) : [], Object.keys(newContract.storage.namespaces));\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst priorNs = priorContract?.storage.namespaces[namespaceId];\n\t\tconst newNs = newContract.storage.namespaces[namespaceId];\n\t\tconst priorTables = priorNs?.entries.table;\n\t\tconst newTables = newNs?.entries.table;\n\t\tconst tableNames = unionSorted(priorTables ? Object.keys(priorTables) : [], newTables ? Object.keys(newTables) : []);\n\t\tfor (const tableName of tableNames) {\n\t\t\tconst priorTableRaw = priorTables?.[tableName];\n\t\t\tconst newTableRaw = newTables?.[tableName];\n\t\t\tconst priorTable = StorageTable.is(priorTableRaw) ? priorTableRaw : void 0;\n\t\t\tconst newTable = StorageTable.is(newTableRaw) ? newTableRaw : void 0;\n\t\t\tconst fieldNames = unionSorted(priorTable ? Object.keys(priorTable.columns) : [], newTable ? Object.keys(newTable.columns) : []);\n\t\t\tfor (const fieldName of fieldNames) {\n\t\t\t\tconst priorField = priorTable?.columns[fieldName];\n\t\t\t\tconst newField = newTable?.columns[fieldName];\n\t\t\t\tconst entry = {\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\ttableName,\n\t\t\t\t\tfieldName,\n\t\t\t\t\tpriorTable,\n\t\t\t\t\tnewTable,\n\t\t\t\t\tpriorField,\n\t\t\t\t\tnewField\n\t\t\t\t};\n\t\t\t\tif (priorField === void 0 && newField !== void 0) added.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField === void 0) dropped.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField !== void 0) {\n\t\t\t\t\tif (isAlteration(priorField, newField)) altered.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tconst calls = [];\n\tappendCalls(\"added\", added, options.codecHooks, calls, (e) => e.newField?.codecId);\n\tappendCalls(\"dropped\", dropped, options.codecHooks, calls, (e) => e.priorField?.codecId);\n\tappendCalls(\"altered\", altered, options.codecHooks, calls, (e) => e.newField?.codecId);\n\treturn calls;\n}\nfunction appendCalls(event, entries, codecHooks, calls, pickCodecId) {\n\tfor (const entry of entries) {\n\t\tconst codecId = pickCodecId(entry);\n\t\tif (codecId === void 0) continue;\n\t\tconst hook = codecHooks.get(codecId);\n\t\tif (!hook?.onFieldEvent) continue;\n\t\tconst ctx = buildContext(event, entry);\n\t\tconst emitted = hook.onFieldEvent(event, ctx);\n\t\tfor (const call of emitted) calls.push(call);\n\t}\n}\n/**\n* The context's prior/new sides are scoped to the event:\n*\n* - `'added'` — only `newTable` / `newField` populated.\n* - `'dropped'` — only `priorTable` / `priorField` populated.\n* - `'altered'` — both sides populated.\n*/\nfunction buildContext(event, entry) {\n\tconst base = {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttableName: entry.tableName,\n\t\tfieldName: entry.fieldName\n\t};\n\tif (event === \"added\") return {\n\t\t...base,\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n\tif (event === \"dropped\") return {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {}\n\t};\n\treturn {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n}\n/**\n* `'altered'` predicate. Returns `false` whenever `codecId` differs —\n* any codec change suppresses the `altered` event entirely, including\n* cases where another property also differs in the same diff. Codec\n* rotation is a v1 non-goal; avoiding the mixed event keeps the\n* migration semantics for codec changes explicit rather than smuggling\n* them through as `altered`.\n*\n* For non-`codecId` diffs, returns `true` iff any other column property\n* differs.\n*/\nfunction isAlteration(prior, current) {\n\tif (prior.codecId !== current.codecId) return false;\n\treturn !sameStorageColumn(prior, current);\n}\nfunction sameStorageColumn(a, b) {\n\tif (a === b) return true;\n\tif (a.nativeType !== b.nativeType) return false;\n\tif (a.nullable !== b.nullable) return false;\n\tif (a.typeRef !== b.typeRef) return false;\n\tif (!sameJson(a.typeParams, b.typeParams)) return false;\n\tif (!sameJson(a.default, b.default)) return false;\n\treturn true;\n}\nfunction sameJson(a, b) {\n\tif (a === b) return true;\n\tif (a === void 0 || b === void 0) return false;\n\treturn JSON.stringify(a) === JSON.stringify(b);\n}\nfunction unionSorted(a, b) {\n\tconst set = /* @__PURE__ */ new Set();\n\tfor (const name of a) set.add(name);\n\tfor (const name of b) set.add(name);\n\treturn [...set].sort((x, y) => x < y ? -1 : x > y ? 1 : 0);\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* Builds the codec-hook-composed `expandNativeType` callback the contract→IR\n* derivation uses to expand parameterized native types (e.g. `character` +\n* `{ length: 36 }` → `character(36)`). Returns `undefined` when no framework\n* components are supplied, so callers can omit the option entirely.\n*/\nfunction buildNativeTypeExpander(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst codecHooks = extractCodecControlHooks(frameworkComponents);\n\treturn (input) => {\n\t\tif (!input.typeParams) return input.nativeType;\n\t\tif (!input.codecId) return input.nativeType;\n\t\tconst hooks = codecHooks.get(input.codecId);\n\t\tif (!hooks?.expandNativeType) return input.nativeType;\n\t\treturn hooks.expandNativeType(input);\n\t};\n}\n//#endregion\n//#region src/core/migrations/plan-helpers.ts\nconst readOnlyEmptyObject = Object.freeze({});\nfunction cloneRecord(value) {\n\tif (value === readOnlyEmptyObject) return value;\n\treturn blindCast(Object.freeze({ ...value }));\n}\nfunction freezeSteps(steps) {\n\tif (steps.length === 0) return Object.freeze([]);\n\treturn Object.freeze(steps.map((step) => Object.freeze({\n\t\tdescription: step.description,\n\t\tsql: step.sql,\n\t\t...step.params ? { params: Object.freeze([...step.params]) } : {},\n\t\t...step.meta ? { meta: cloneRecord(step.meta) } : {}\n\t})));\n}\nfunction freezeDetailsValue(value) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\") return value;\n\tif (Array.isArray(value)) return blindCast(Object.freeze([...value]));\n\treturn blindCast(Object.freeze({ ...value }));\n}\nfunction freezeTargetDetails(target) {\n\treturn Object.freeze({\n\t\tid: target.id,\n\t\t...target.details !== void 0 ? { details: freezeDetailsValue(target.details) } : {}\n\t});\n}\nfunction freezeOperation(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...operation.summary ? { summary: operation.summary } : {},\n\t\toperationClass: operation.operationClass,\n\t\t...operation.invariantId ? { invariantId: operation.invariantId } : {},\n\t\ttarget: freezeTargetDetails(operation.target),\n\t\tprecheck: freezeSteps(operation.precheck),\n\t\texecute: freezeSteps(operation.execute),\n\t\tpostcheck: freezeSteps(operation.postcheck),\n\t\t...operation.meta ? { meta: cloneRecord(operation.meta) } : {}\n\t});\n}\nfunction freezeOperations(operations) {\n\tif (operations.length === 0) return Object.freeze([]);\n\treturn Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\nfunction createMigrationPlan(options) {\n\treturn Object.freeze({\n\t\ttargetId: options.targetId,\n\t\tspaceId: options.spaceId,\n\t\t...options.origin !== void 0 ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null } : {},\n\t\tdestination: Object.freeze({ ...options.destination }),\n\t\toperations: freezeOperations(options.operations),\n\t\tprovidedInvariants: Object.freeze([...options.providedInvariants]),\n\t\t...options.meta ? { meta: cloneRecord(options.meta) } : {}\n\t});\n}\nfunction plannerSuccess(plan, warnings) {\n\treturn Object.freeze({\n\t\tkind: \"success\",\n\t\tplan,\n\t\t...warnings && warnings.length > 0 ? { warnings: Object.freeze(warnings.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t}))) } : {}\n\t});\n}\nfunction plannerFailure(conflicts) {\n\treturn Object.freeze({\n\t\tkind: \"failure\",\n\t\tconflicts: Object.freeze(conflicts.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t})))\n\t});\n}\n/**\n* Creates a successful migration runner result.\n*/\nfunction runnerSuccess(value) {\n\treturn ok(Object.freeze({\n\t\toperationsPlanned: value.operationsPlanned,\n\t\toperationsExecuted: value.operationsExecuted\n\t}));\n}\n/**\n* Creates a failed migration runner result.\n*/\nfunction runnerFailure(code, summary, options) {\n\treturn notOk(Object.freeze({\n\t\tcode,\n\t\tsummary,\n\t\t...options?.why ? { why: options.why } : {},\n\t\t...options?.meta ? { meta: cloneRecord(options.meta) } : {}\n\t}));\n}\n//#endregion\n//#region src/core/migrations/policies.ts\n/**\n* Policy used by `db init`: additive-only operations, no widening/destructive steps.\n*/\nconst INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.freeze([\"additive\"]) });\n//#endregion\n//#region src/core/migrations/table-name-case-guard.ts\nconst TABLE_NAME_CASE_CHANGED_CODE = \"MIGRATION.TABLE_NAME_CASE_CHANGED\";\nfunction lowerFirst(value) {\n\treturn value.charAt(0).toLowerCase() + value.slice(1);\n}\nfunction plannedTable(node, namespaceId) {\n\treturn {\n\t\tnamespaceId,\n\t\ttableName: node.name\n\t};\n}\nfunction renameNeedsNamespace(drop, dropped, contract, defaultNamespaceId) {\n\tif (drop.namespaceId !== UNBOUND_NAMESPACE_ID && drop.namespaceId !== defaultNamespaceId) return true;\n\tconst declaredElsewhere = (namespaceId, tableName) => namespaceId !== drop.namespaceId && tableName === drop.tableName;\n\treturn dropped.some((other) => declaredElsewhere(other.namespaceId, other.tableName)) || Object.values(contract.storage.namespaces).some((namespace) => Object.keys(namespace.entries.table ?? {}).some((tableName) => declaredElsewhere(namespace.id, tableName)));\n}\n/**\n* Finds every (drop `X`, create `Y`) pair in the same namespace where `X` is\n* `Y` with its first letter lowered. That shape is the signature of a schema\n* upgraded across the release in which a model with no `@@map` stopped\n* lowering the first letter of its table name: planning it would drop the\n* user's table and recreate it empty. Columns are deliberately not compared,\n* so a user who also changed a field in the same upgrade is still protected.\n*\n* Returns one conflict per pair, carrying `MIGRATION.TABLE_NAME_CASE_CHANGED`\n* in `meta.code`, or an empty array when the plan has no such pair.\n*/\nfunction detectTableNameCaseChanges(input) {\n\tconst dropped = [];\n\tconst created = [];\n\tfor (const issue of input.issues) {\n\t\tconst outcome = issueOutcome(issue);\n\t\tif (outcome === \"not-equal\") continue;\n\t\tconst table = input.tableOf(issue);\n\t\tif (table === void 0) continue;\n\t\t(outcome === \"not-expected\" ? dropped : created).push(plannedTable(table, input.namespaceIdOf(issue)));\n\t}\n\tconst conflicts = [];\n\tfor (const create of created) {\n\t\tconst drop = dropped.find((candidate) => candidate.namespaceId === create.namespaceId && candidate.tableName === lowerFirst(create.tableName));\n\t\tif (drop === void 0) continue;\n\t\tconst renameCall = input.renameTableCall({\n\t\t\tnamespaceId: renameNeedsNamespace(drop, dropped, input.contract, input.defaultNamespaceId) ? drop.namespaceId : void 0,\n\t\t\tfrom: drop.tableName,\n\t\t\tto: create.tableName\n\t\t});\n\t\tconflicts.push({\n\t\t\tkind: \"tableNameCaseChanged\",\n\t\t\tsummary: `${TABLE_NAME_CASE_CHANGED_CODE}: table \"${create.tableName}\" would be created and table \"${drop.tableName}\" dropped. Prisma 8 changed the default table name: a model with no @@map now names its table verbatim, so model ${create.tableName} points at \"${create.tableName}\" instead of \"${drop.tableName}\".`,\n\t\t\twhy: `To keep table \"${drop.tableName}\" and its rows, add @@map(\"${drop.tableName}\") to model ${create.tableName} (or run the add-model-map codemod over the schema) and plan again. To rename the table and keep its rows instead: in a project with migration history, make the rename its own schema change, create its migration with prisma migration new --from <hash of the migration the database is at>, and add ${renameCall} to the migration's operations, which renames the table and the objects named after it; in a project that uses db update, rename it by hand with ${input.renameByHandStatements({\n\t\t\t\tnamespaceId: create.namespaceId,\n\t\t\t\tfrom: drop.tableName,\n\t\t\t\tto: create.tableName\n\t\t\t}).join(\"; \")}, then run db update again.`,\n\t\t\tlocation: {\n\t\t\t\tnamespaceId: create.namespaceId,\n\t\t\t\tentityKind: \"table\",\n\t\t\t\tentityName: create.tableName\n\t\t\t},\n\t\t\tmeta: {\n\t\t\t\tcode: TABLE_NAME_CASE_CHANGED_CODE,\n\t\t\t\tdroppedTable: drop.tableName,\n\t\t\t\tcreatedTable: create.tableName\n\t\t\t}\n\t\t});\n\t}\n\treturn conflicts;\n}\n//#endregion\n//#region src/core/timestamp-now-generator.ts\nfunction temporalStringAuthoringPresets(input) {\n\tconst presets = temporalAuthoringPresets(input);\n\treturn {\n\t\tcreatedAtString: presets.createdAt,\n\t\tupdatedAtString: presets.updatedAt\n\t};\n}\nconst TEMPORAL_PRECISION_ARG = {\n\tname: \"precision\",\n\tkind: \"number\",\n\toptional: true,\n\tinteger: true,\n\tminimum: 0\n};\n/**\n* Builds a `temporal.<codec>` field preset for a codec that takes a precision\n* parameter (`pg/timestamp-temporal@1`, `pg/timestamptz-temporal@1`). Arguments change field\n* properties only — never the codec, which the caller fixes here.\n*\n* All three arguments are optional: omitting `precision` omits `typeParams`\n* entirely, and omitting a phase omits that phase (both omitted omits\n* `executionDefaults`).\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction temporalCodecPresetWithPrecision(input) {\n\tconst generatorId = input.generatorId ?? TIMESTAMP_NOW_GENERATOR_ID;\n\treturn {\n\t\tkind: \"fieldPreset\",\n\t\targs: [\n\t\t\tTEMPORAL_PRECISION_ARG,\n\t\t\tTEMPORAL_ON_CREATE_ARG,\n\t\t\tTEMPORAL_ON_UPDATE_ARG\n\t\t],\n\t\toutput: {\n\t\t\tcodecId: input.codecId,\n\t\t\tnativeType: input.nativeType,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} },\n\t\t\texecutionDefaults: {\n\t\t\t\tonCreate: temporalPhaseTemplate(1, generatorId),\n\t\t\t\tonUpdate: temporalPhaseTemplate(2, generatorId)\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, TABLE_NAME_CASE_CHANGED_CODE, applyTableRename, assembleAuthoringContributions, buildDataTypeResolver, buildNativeTypeExpander, checkSqlDefaultBody, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;A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,KAAK;IACX,IAAI,OAAO;GACZ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;GACd,UAAU;IACT,aAAa,OAAO;IACpB,YAAY;IACZ,YAAY,OAAO;GACpB;GACA,MAAM;IACL,MAAM;IACN,cAAc,KAAK;IACnB,cAAc,OAAO;GACtB;EACD,CAAC;CACF;CACA,OAAO;AACR;AAGA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,UAAU,yBAAyB,KAAK;CAC9C,OAAO;EACN,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ;CAC1B;AACD;AACA,MAAM,yBAAyB;CAC9B,MAAM;CACN,MAAM;CACN,UAAU;CACV,SAAS;CACT,SAAS;AACV;;;;;;;;;;;AAWA,SAAS,iCAAiC,OAAO;CAChD,MAAM,cAAc,MAAM,eAAe;CACzC,OAAO;EACN,MAAM;EACN,MAAM;GACL;GACA;GACA;EACD;EACA,QAAQ;GACP,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,YAAY,EAAE,WAAW;IACxB,MAAM;IACN,OAAO;GACR,EAAE;GACF,mBAAmB;IAClB,UAAU,sBAAsB,GAAG,WAAW;IAC9C,UAAU,sBAAsB,GAAG,WAAW;GAC/C;EACD;CACD;AACD;AAGA,IAAI,kBAAkB,IAAI,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"diff-B16bL_IR.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/diff.mjs"],"sourcesContent":["import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, r as classifySqlDiffIssue } from \"./schema-verify-DI0aJQ9d.mjs\";\n//#region src/core/diff/sql-schema-diff.ts\n/**\n* Compares two arrays of strings for equality (order-sensitive).\n*/\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\n//#endregion\nexport { arraysEqual, classifyDiffSubjectGranularity, classifySqlDiffIssue, computeSqlDiffVerdict, computeStorageTypeVerdict, verifySqlSchemaByDiff };\n\n//# sourceMappingURL=diff.mjs.map"],"mappings":";;;;AAKA,SAAS,YAAY,GAAG,GAAG;CAC1B,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;CAClC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,IAAI,EAAE,OAAO,EAAE,IAAI,OAAO;CAC7D,OAAO;AACR"}
1
+ {"version":3,"file":"diff-B16bL_IR.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/diff.mjs"],"sourcesContent":["import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, r as classifySqlDiffIssue } from \"./schema-verify-Xmpe1PGb.mjs\";\n//#region src/core/diff/sql-schema-diff.ts\n/**\n* Compares two arrays of strings for equality (order-sensitive).\n*/\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\n//#endregion\nexport { arraysEqual, classifyDiffSubjectGranularity, classifySqlDiffIssue, computeSqlDiffVerdict, computeStorageTypeVerdict, verifySqlSchemaByDiff };\n\n//# sourceMappingURL=diff.mjs.map"],"mappings":";;;;AAKA,SAAS,YAAY,GAAG,GAAG;CAC1B,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;CAClC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,IAAI,EAAE,OAAO,EAAE,IAAI,OAAO;CAC7D,OAAO;AACR"}
package/dist/family.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
2
2
  import { n as checkSqlDefaultBody } from "./validators-Cx6UXIBf.mjs";
3
- import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, r as classifySqlDiffIssue, s as verifySqlSchemaByDiff } from "./schema-verify-DI0aJQ9d-BrQOlutU.mjs";
3
+ import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, r as classifySqlDiffIssue, s as verifySqlSchemaByDiff } from "./schema-verify-Xmpe1PGb-Bcd_2avJ.mjs";
4
4
  import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-C90xg7_q-C_Okh4NM.mjs";
5
5
  import { n as parseContractMarkerRow } from "./verify-BVk5bjdH-BXgGLM2U.mjs";
6
- import { S as temporalStringAuthoringPresets, _ as plannerFailure, a as buildDataTypeResolver, b as runnerSuccess, c as contractToSchemaIR, d as createMigrationPlan, f as detectDestructiveChanges, g as planFieldEventOperations, h as partitionIssuesByControlPolicy, i as assembleAuthoringContributions, l as controlPolicyForCall, m as partitionCallsByControlPolicy, n as TABLE_NAME_CASE_CHANGED_CODE, o as buildNativeTypeExpander, p as detectTableNameCaseChanges, r as applyTableRename, s as contractNamespaceToSchemaIR, t as INIT_ADDITIVE_POLICY, v as plannerSuccess, x as temporalCodecPresetWithPrecision, y as runnerFailure } from "./control-D0iVJugI.mjs";
6
+ import { S as temporalStringAuthoringPresets, _ as plannerFailure, a as buildDataTypeResolver, b as runnerSuccess, c as contractToSchemaIR, d as createMigrationPlan, f as detectDestructiveChanges, g as planFieldEventOperations, h as partitionIssuesByControlPolicy, i as assembleAuthoringContributions, l as controlPolicyForCall, m as partitionCallsByControlPolicy, n as TABLE_NAME_CASE_CHANGED_CODE, o as buildNativeTypeExpander, p as detectTableNameCaseChanges, r as applyTableRename, s as contractNamespaceToSchemaIR, t as INIT_ADDITIVE_POLICY, v as plannerSuccess, x as temporalCodecPresetWithPrecision, y as runnerFailure } from "./control-BYOcSVih.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";
@@ -1,4 +1,4 @@
1
1
  import { n as checkSqlDefaultBody } from "./validators-Cx6UXIBf.mjs";
2
- import { o as extractCodecControlHooks } from "./schema-verify-DI0aJQ9d-BrQOlutU.mjs";
3
- import { S as temporalStringAuthoringPresets, _ as plannerFailure, a as buildDataTypeResolver, b as runnerSuccess, c as contractToSchemaIR, d as createMigrationPlan, f as detectDestructiveChanges, g as planFieldEventOperations, h as partitionIssuesByControlPolicy, i as assembleAuthoringContributions, l as controlPolicyForCall, m as partitionCallsByControlPolicy, n as TABLE_NAME_CASE_CHANGED_CODE, o as buildNativeTypeExpander, p as detectTableNameCaseChanges, r as applyTableRename, s as contractNamespaceToSchemaIR, t as INIT_ADDITIVE_POLICY, u as control_default, v as plannerSuccess, x as temporalCodecPresetWithPrecision, y as runnerFailure } from "./control-D0iVJugI.mjs";
2
+ import { o as extractCodecControlHooks } from "./schema-verify-Xmpe1PGb-Bcd_2avJ.mjs";
3
+ import { S as temporalStringAuthoringPresets, _ as plannerFailure, a as buildDataTypeResolver, b as runnerSuccess, c as contractToSchemaIR, d as createMigrationPlan, f as detectDestructiveChanges, g as planFieldEventOperations, h as partitionIssuesByControlPolicy, i as assembleAuthoringContributions, l as controlPolicyForCall, m as partitionCallsByControlPolicy, n as TABLE_NAME_CASE_CHANGED_CODE, o as buildNativeTypeExpander, p as detectTableNameCaseChanges, r as applyTableRename, s as contractNamespaceToSchemaIR, t as INIT_ADDITIVE_POLICY, u as control_default, v as plannerSuccess, x as temporalCodecPresetWithPrecision, y as runnerFailure } from "./control-BYOcSVih.mjs";
4
4
  export { INIT_ADDITIVE_POLICY, TABLE_NAME_CASE_CHANGED_CODE, applyTableRename, assembleAuthoringContributions, buildDataTypeResolver, buildNativeTypeExpander, checkSqlDefaultBody, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets };
@@ -1,3 +1,3 @@
1
- import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, r as classifySqlDiffIssue, s as verifySqlSchemaByDiff } from "./schema-verify-DI0aJQ9d-BrQOlutU.mjs";
1
+ import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, r as classifySqlDiffIssue, s as verifySqlSchemaByDiff } from "./schema-verify-Xmpe1PGb-Bcd_2avJ.mjs";
2
2
  import { t as arraysEqual } from "./diff-B16bL_IR.mjs";
3
3
  export { arraysEqual, classifyDiffSubjectGranularity, classifySqlDiffIssue, computeSqlDiffVerdict, computeStorageTypeVerdict, verifySqlSchemaByDiff };
@@ -2,8 +2,8 @@ import { u as isStorageTypeInstance } from "./types-Z-l6gAVD.mjs";
2
2
  import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
- import { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from "@prisma/orm-framework/components/control";
6
- //#region ../../../2-sql/9-family/dist/schema-verify-DI0aJQ9d.mjs
5
+ import { VERIFY_CODE_SCHEMA_FAILURE, assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from "@prisma/orm-framework/components/control";
6
+ //#region ../../../2-sql/9-family/dist/schema-verify-Xmpe1PGb.mjs
7
7
  function hasCodecControlHooks(descriptor) {
8
8
  if (typeof descriptor !== "object" || descriptor === null) return false;
9
9
  const hooks = blindCast(descriptor).types?.codecTypes?.controlPlaneHooks;
@@ -196,7 +196,7 @@ function verifySqlSchemaByDiff(input) {
196
196
  const profileHash = "profileHash" in input.contract && typeof input.contract.profileHash === "string" ? input.contract.profileHash : void 0;
197
197
  return {
198
198
  ok,
199
- ...ok ? {} : { code: "CONTRACT.SCHEMA_VERIFICATION_FAILED" },
199
+ ...ok ? {} : { code: VERIFY_CODE_SCHEMA_FAILURE },
200
200
  summary: ok ? "Database schema satisfies contract" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? "" : "s"})`,
201
201
  contract: {
202
202
  storageHash: input.contract.storage.storageHash,
@@ -217,4 +217,4 @@ function verifySqlSchemaByDiff(input) {
217
217
  //#endregion
218
218
  export { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, extractCodecControlHooks as o, classifySqlDiffIssue as r, verifySqlSchemaByDiff as s, classifyDiffEntityKind as t };
219
219
 
220
- //# sourceMappingURL=schema-verify-DI0aJQ9d-BrQOlutU.mjs.map
220
+ //# sourceMappingURL=schema-verify-Xmpe1PGb-Bcd_2avJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-verify-Xmpe1PGb-Bcd_2avJ.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-Xmpe1PGb.mjs"],"sourcesContent":["import { VERIFY_CODE_SCHEMA_FAILURE, assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = blindCast(descriptor).types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: VERIFY_CODE_SCHEMA_FAILURE },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-Xmpe1PGb.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,UAAU,UAAU,CAAC,CAAC,OAAO,YAAY;CACvD,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAAI,CAAC,qBAAqB,UAAU,GAAG;EACvC,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAChE,uBAAuB;IACtB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACvB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,IAAI,SAAS,WAAW,EAAE;EAClC;CACD;CACA,OAAO;AACR;;;;;;;AASA,SAAS,6BAA6B,OAAO;CAC5C,IAAI,aAAa,KAAK,MAAM,aAAa,OAAO;CAChD,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;CACnD,OAAO;AACR;AACA,SAAS,oBAAoB,eAAe,OAAO;CAClD,OAAO,uBAAuB,eAAe,6BAA6B,KAAK,CAAC;AACjF;AAGA,SAAS,UAAU,OAAO;CACzB,MAAM,OAAO,MAAM,YAAY,MAAM;CACrC,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK;CACjC,OAAO,UAAU,IAA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AAM,SAAS,gBAAgB,WAAW,MAAM,SAAS,cAAc,KAAK;CAC1I,OAAO;EACN;EACA,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,2BAA2B;EAChD,SAAS,KAAK,uCAAuC,8CAA8C,UAAU,UAAU,cAAc,IAAI,KAAK,IAAI;EAClJ,UAAU;GACT,aAAa,MAAM,SAAS,QAAQ;GACpC,GAAG,UAAU,eAAe,WAAW;EACxC;EACA,QAAQ;GACP,UAAU,MAAM,SAAS;GACzB,QAAQ,MAAM,SAAS;EACxB;EACA,QAAQ;GACP,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ;GAChE,UAAU,EAAE,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ,EAAE;EAC/E;EACA,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-sql",
3
- "version": "8.0.0-rc.14-dev.23",
3
+ "version": "8.0.0-rc.14-dev.24",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,8 +9,8 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.14-dev.23",
13
- "@prisma/orm-toolchain": "8.0.0-rc.14-dev.23",
12
+ "@prisma/orm-framework": "8.0.0-rc.14-dev.24",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.14-dev.24",
14
14
  "@standard-schema/spec": "^1.1.0",
15
15
  "arktype": "^2.2.2",
16
16
  "pathe": "^2.0.3",
@@ -19,21 +19,21 @@
19
19
  "ts-toolbelt": "^9.6.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@internal/family-sql": "8.0.0-rc.14-dev.23",
23
- "@internal/sql-builder": "8.0.0-rc.14-dev.23",
24
- "@internal/sql-contract": "8.0.0-rc.14-dev.23",
25
- "@internal/sql-contract-emitter": "8.0.0-rc.14-dev.23",
26
- "@internal/sql-contract-prisma7": "8.0.0-rc.14-dev.23",
27
- "@internal/sql-contract-psl": "8.0.0-rc.14-dev.23",
28
- "@internal/sql-contract-ts": "8.0.0-rc.14-dev.23",
29
- "@internal/sql-errors": "8.0.0-rc.14-dev.23",
30
- "@internal/sql-operations": "8.0.0-rc.14-dev.23",
31
- "@internal/sql-orm-client": "8.0.0-rc.14-dev.23",
32
- "@internal/sql-relational-core": "8.0.0-rc.14-dev.23",
33
- "@internal/sql-runtime": "8.0.0-rc.14-dev.23",
34
- "@internal/sql-schema-ir": "8.0.0-rc.14-dev.23",
35
- "@repo/tsconfig": "8.0.0-rc.14-dev.23",
36
- "@repo/tsdown": "8.0.0-rc.14-dev.23",
22
+ "@internal/family-sql": "8.0.0-rc.14-dev.24",
23
+ "@internal/sql-builder": "8.0.0-rc.14-dev.24",
24
+ "@internal/sql-contract": "8.0.0-rc.14-dev.24",
25
+ "@internal/sql-contract-emitter": "8.0.0-rc.14-dev.24",
26
+ "@internal/sql-contract-prisma7": "8.0.0-rc.14-dev.24",
27
+ "@internal/sql-contract-psl": "8.0.0-rc.14-dev.24",
28
+ "@internal/sql-contract-ts": "8.0.0-rc.14-dev.24",
29
+ "@internal/sql-errors": "8.0.0-rc.14-dev.24",
30
+ "@internal/sql-operations": "8.0.0-rc.14-dev.24",
31
+ "@internal/sql-orm-client": "8.0.0-rc.14-dev.24",
32
+ "@internal/sql-relational-core": "8.0.0-rc.14-dev.24",
33
+ "@internal/sql-runtime": "8.0.0-rc.14-dev.24",
34
+ "@internal/sql-schema-ir": "8.0.0-rc.14-dev.24",
35
+ "@repo/tsconfig": "8.0.0-rc.14-dev.24",
36
+ "@repo/tsdown": "8.0.0-rc.14-dev.24",
37
37
  "tsdown": "0.22.14",
38
38
  "typescript": "5.9.3"
39
39
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-verify-DI0aJQ9d-BrQOlutU.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-DI0aJQ9d.mjs"],"sourcesContent":["import { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = blindCast(descriptor).types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: \"CONTRACT.SCHEMA_VERIFICATION_FAILED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-DI0aJQ9d.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,UAAU,UAAU,CAAC,CAAC,OAAO,YAAY;CACvD,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAA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