@prisma/orm-family-sql 8.0.0-rc.8-dev.11 → 8.0.0-rc.8-dev.12

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.
@@ -2,7 +2,7 @@ import { u as namingOf } from "./naming-DKr4TJd7-Cszhq9RV.mjs";
2
2
  import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-dmXkOR4a.mjs";
3
3
  import { c as StorageTable } from "./storage-table-ZzbR-xzQ-BRoTQE_2.mjs";
4
4
  import { l as isStorageTypeInstance } from "./types-CUsJrvEl.mjs";
5
- import { c as SqlSchemaIR, n as RelationalSchemaNodeKind, u as SqlTableIR } from "./types-4YenawkP-CwaaZSid.mjs";
5
+ import { c as SqlSchemaIR, n as RelationalSchemaNodeKind, u as SqlTableIR } from "./types-BvupgHcG-c8QDupnu.mjs";
6
6
  import { t as sqlEmission } from "./dist-ZK6oeI5e.mjs";
7
7
  import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs";
8
8
  import { n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, s as verifySqlSchemaByDiff, t as classifyDiffEntityKind } from "./schema-verify-C_PEdlAr-Dxxjm6EM.mjs";
@@ -1264,4 +1264,4 @@ var control_default = new SqlFamilyDescriptor();
1264
1264
  //#endregion
1265
1265
  export { contractToSchemaIR as a, createMigrationPlan as c, partitionIssuesByControlPolicy as d, planFieldEventOperations as f, runnerSuccess as g, runnerFailure as h, contractNamespaceToSchemaIR as i, detectDestructiveChanges as l, plannerSuccess as m, assembleAuthoringContributions as n, controlPolicyForCall as o, plannerFailure as p, buildNativeTypeExpander as r, control_default as s, INIT_ADDITIVE_POLICY as t, partitionCallsByControlPolicy as u };
1266
1266
 
1267
- //# sourceMappingURL=control-DSWW6aqp.mjs.map
1267
+ //# sourceMappingURL=control-BUSwZs4O.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-DSWW6aqp.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-Blqoa2Ua.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-C_PEdlAr.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-2oBWuxTe.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-ChiDeTk8.mjs\";\nimport { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from \"./timestamp-now-generator-BZnBo7IC.mjs\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions } from \"@internal/framework-components/control\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { StorageTable, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\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 candidate = operation;\n\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) return false;\n\treturn candidate[\"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 = 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 = 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\tconst result = {\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};\n\tif (options.code) result.code = options.code;\n\tif (options.marker) result.marker = {\n\t\tstorageHash: options.marker.storageHash,\n\t\tprofileHash: options.marker.profileHash\n\t};\n\tif (options.missingCodecs) result.missingCodecs = options.missingCodecs;\n\tif (options.codecCoverageSkipped) result.codecCoverageSkipped = options.codecCoverageSkipped;\n\treturn result;\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\tconst target = stack.target;\n\tconst adapter = stack.adapter;\n\tconst extensions = 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 = target.contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\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, describedContracts);\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\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors\n\t};\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault) {\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 resolvedNativeType = column.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\", column.many),\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\tcodecRef: buildColumnCodecRef(resolved, column.many),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {}\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, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault);\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, 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, 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/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 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 Object.freeze([...value]);\n\treturn 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/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, timestampNowControlDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,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,YAAY;CAClB,IAAI,EAAE,aAAa,cAAc,CAAC,MAAM,QAAQ,UAAU,UAAU,GAAG,OAAO;CAC9E,OAAO,UAAU,UAAU,CAAC,OAAO,SAAS,OAAO,SAAS,YAAY,SAAS,QAAQ,SAAS,IAAI;AACvG;;;;;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;EAC3E,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,gCAAgC,UAAU;CAClD,MAAM,0BAA0B,IAAI,IAAI;CACxC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AAS,CAAC,EAAE,IAAI,CAAC;GAChF,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,SAAS,IAAI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;CACX,CAAC;AACF;AACA,SAAS,eAAe,WAAW;CAClC,OAAO,OAAO,OAAO;EACpB,MAAM;EACN,WAAW,OAAO,OAAO,UAAU,KAAK,aAAa,OAAO,OAAO;GAClE,MAAM,SAAS;GACf,SAAS,SAAS;GAClB,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;GAC3C,GAAG,SAAS,WAAW,EAAE,UAAU,OAAO,OAAO,EAAE,GAAG,SAAS,SAAS,CAAC,EAAE,IAAI,CAAC;GAChF,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,SAAS,IAAI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC;CACJ,CAAC;AACF;;;;AAIA,SAAS,cAAc,OAAO;CAC7B,OAAO,GAAG,OAAO,OAAO;EACvB,mBAAmB,MAAM;EACzB,oBAAoB,MAAM;CAC3B,CAAC,CAAC;AACH;;;;AAIA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,MAAM,OAAO,OAAO;EAC1B;EACA;EACA,GAAG,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;CAC3D,CAAC,CAAC;AACH;;;;AAMA,MAAM,uBAAuB,OAAO,OAAO,EAAE,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAGnG,IAAI,kBAAkB,IAAI,oBAAoB"}
1
+ {"version":3,"file":"control-BUSwZs4O.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-Blqoa2Ua.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-C_PEdlAr.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-2oBWuxTe.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-ChiDeTk8.mjs\";\nimport { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from \"./timestamp-now-generator-BZnBo7IC.mjs\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions } from \"@internal/framework-components/control\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { StorageTable, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\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 candidate = operation;\n\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) return false;\n\treturn candidate[\"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 = 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 = 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\tconst result = {\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};\n\tif (options.code) result.code = options.code;\n\tif (options.marker) result.marker = {\n\t\tstorageHash: options.marker.storageHash,\n\t\tprofileHash: options.marker.profileHash\n\t};\n\tif (options.missingCodecs) result.missingCodecs = options.missingCodecs;\n\tif (options.codecCoverageSkipped) result.codecCoverageSkipped = options.codecCoverageSkipped;\n\treturn result;\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\tconst target = stack.target;\n\tconst adapter = stack.adapter;\n\tconst extensions = 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 = target.contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\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, describedContracts);\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\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors\n\t};\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault) {\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 resolvedNativeType = column.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\", column.many),\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\tcodecRef: buildColumnCodecRef(resolved, column.many),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {}\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, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault);\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, 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, 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/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 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 Object.freeze([...value]);\n\treturn 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/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, timestampNowControlDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;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C,OAAO,OAAO,OAAO;EACpB,MAAM;EACN,WAAW,OAAO,OAAO,UAAU,KAAK,aAAa,OAAO,OAAO;GAClE,MAAM,SAAS;GACf,SAAS,SAAS;GAClB,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;GAC3C,GAAG,SAAS,WAAW,EAAE,UAAU,OAAO,OAAO,EAAE,GAAG,SAAS,SAAS,CAAC,EAAE,IAAI,CAAC;GAChF,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,SAAS,IAAI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC;CACJ,CAAC;AACF;;;;AAIA,SAAS,cAAc,OAAO;CAC7B,OAAO,GAAG,OAAO,OAAO;EACvB,mBAAmB,MAAM;EACzB,oBAAoB,MAAM;CAC3B,CAAC,CAAC;AACH;;;;AAIA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,MAAM,OAAO,OAAO;EAC1B;EACA;EACA,GAAG,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;CAC3D,CAAC,CAAC;AACH;;;;AAMA,MAAM,uBAAuB,OAAO,OAAO,EAAE,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAGnG,IAAI,kBAAkB,IAAI,oBAAoB"}
package/dist/family.mjs CHANGED
@@ -3,7 +3,7 @@ import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classi
3
3
  import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs";
4
4
  import { n as parseContractMarkerRow } from "./verify-ChiDeTk8-HEewdjrM.mjs";
5
5
  import { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from "./timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs";
6
- import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-DSWW6aqp.mjs";
6
+ import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-BUSwZs4O.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 { o as extractCodecControlHooks } from "./schema-verify-C_PEdlAr-Dxxjm6EM.mjs";
2
2
  import { a as temporalStringAuthoringPresets, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, o as timestampNowControlDescriptor, r as temporalCodecPreset } from "./timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs";
3
- import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-DSWW6aqp.mjs";
3
+ import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-BUSwZs4O.mjs";
4
4
  export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, timestampNowControlDescriptor };
@@ -1,2 +1,2 @@
1
- import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-4YenawkP-CwaaZSid.mjs";
1
+ import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-BvupgHcG-c8QDupnu.mjs";
2
2
  export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -1,2 +1,2 @@
1
- import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-4YenawkP-CwaaZSid.mjs";
1
+ import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-BvupgHcG-c8QDupnu.mjs";
2
2
  export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -5,7 +5,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
7
7
  import { isArrayEqual } from "@prisma/orm-framework/utils/array-equal";
8
- //#region ../../../2-sql/1-core/schema-ir/dist/types-4YenawkP.mjs
8
+ //#region ../../../2-sql/1-core/schema-ir/dist/types-BvupgHcG.mjs
9
9
  /**
10
10
  * The `nodeKind` discriminant for each relational schema-diff leaf node.
11
11
  * Each node carries a unique value; the differ pairs siblings by `id`, and
@@ -224,12 +224,13 @@ var SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {
224
224
  * Structural equality for two resolved column defaults, ported from the
225
225
  * relational walk's `columnDefaultsEqual` normalized branch: kinds must
226
226
  * match; literal values are normalized (Date and temporal-typed strings to
227
- * ISO instants) then compared canonically (JSON objects match their
228
- * canonical string form); function expressions compare case- and
227
+ * ISO instants, and a 64-bit-integer native type's safe-integer number to
228
+ * its decimal-text spelling) then compared canonically (JSON objects match
229
+ * their canonical string form); function expressions compare case- and
229
230
  * whitespace-insensitively.
230
231
  *
231
- * `nativeType` provides the temporal-normalization context (the actual
232
- * side's resolved native type in a diff comparison).
232
+ * `nativeType` provides the temporal- and int64-normalization context (the
233
+ * actual side's resolved native type in a diff comparison).
233
234
  */
234
235
  function resolvedDefaultsEqual(expected, actual, nativeType) {
235
236
  if (expected.kind !== actual.kind) return false;
@@ -245,12 +246,18 @@ function isTemporalNativeType(nativeType) {
245
246
  const normalized = nativeType.toLowerCase();
246
247
  return normalized.includes("timestamp") || normalized === "date";
247
248
  }
249
+ function isInt64NativeType(nativeType) {
250
+ if (!nativeType) return false;
251
+ const normalized = nativeType.toLowerCase();
252
+ return normalized === "int8" || normalized === "bigint";
253
+ }
248
254
  function normalizeLiteralValue(value, nativeType) {
249
255
  if (value instanceof Date) return value.toISOString();
250
256
  if (typeof value === "string" && isTemporalNativeType(nativeType)) {
251
257
  const parsed = new Date(value);
252
258
  if (!Number.isNaN(parsed.getTime())) return parsed.toISOString();
253
259
  }
260
+ if (typeof value === "number" && Number.isSafeInteger(value) && isInt64NativeType(nativeType)) return String(value);
254
261
  return value;
255
262
  }
256
263
  function literalValuesEqual(a, b) {
@@ -717,4 +724,4 @@ var SqlSchemaIR = class extends SqlSchemaIRNode {
717
724
  //#endregion
718
725
  export { SqlColumnIR as a, SqlSchemaIR as c, SqlUniqueIR as d, assertNode as f, relationalNodeGranularity as h, SqlColumnDefaultIR as i, SqlSchemaIRNode as l, relationalNodeEntityKind as m, RelationalSchemaNodeKind as n, SqlForeignKeyIR as o, defineNonEnumerable as p, SqlCheckConstraintIR as r, SqlIndexIR as s, PrimaryKey as t, SqlTableIR as u };
719
726
 
720
- //# sourceMappingURL=types-4YenawkP-CwaaZSid.mjs.map
727
+ //# sourceMappingURL=types-BvupgHcG-c8QDupnu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BvupgHcG-c8QDupnu.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/types-BvupgHcG.mjs"],"sourcesContent":["import { f as normalizeIndexOptionValue, l as nameOf } from \"./naming-DKr4TJd7.mjs\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\n//#region src/ir/schema-node-kinds.ts\n/**\n* The `nodeKind` discriminant for each relational schema-diff leaf node.\n* Each node carries a unique value; the differ pairs siblings by `id`, and\n* these kinds distinguish the node types that appear as `PostgresTableSchemaNode`\n* children (columns, primary key, foreign keys, uniques, indexes, checks) from\n* each other and from the RLS policy/role kinds a target defines separately.\n*/\nconst RelationalSchemaNodeKind = {\n\tschema: \"sql-schema\",\n\ttable: \"sql-table\",\n\tcolumn: \"sql-column\",\n\tcolumnDefault: \"sql-column-default\",\n\tprimaryKey: \"sql-primary-key\",\n\tforeignKey: \"sql-foreign-key\",\n\tunique: \"sql-unique\",\n\tindex: \"sql-index\",\n\tcheck: \"sql-check-constraint\"\n};\n/**\n* The one real map from a relational `nodeKind` to the framework-neutral\n* {@link DiffSubjectGranularity} its diff issues carry — the SQL family's\n* post-diff filters (issue category, strict-mode gating) and the framework\n* aggregate's unclaimed-elements sweep key on the granularity, never on the\n* `nodeKind` spelling and never on anything stamped on the node. Resolution\n* is by `nodeKind` equality against this map, not a suffix string match.\n* Target-specific node kinds (Postgres namespace/table/policy/role) are\n* outside this family layer's vocabulary and map their own kinds directly.\n*/\nconst RELATIONAL_NODE_GRANULARITY = {\n\t[RelationalSchemaNodeKind.schema]: \"structural\",\n\t[RelationalSchemaNodeKind.table]: \"entity\",\n\t[RelationalSchemaNodeKind.column]: \"field\",\n\t[RelationalSchemaNodeKind.columnDefault]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.primaryKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.foreignKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.unique]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.index]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.check]: \"auxiliary\"\n};\nfunction isRelationalSchemaNodeKind(nodeKind) {\n\treturn Object.hasOwn(RELATIONAL_NODE_GRANULARITY, nodeKind);\n}\n/**\n* Looks up the subject granularity for a relational `nodeKind`. Throws for a\n* `nodeKind` outside this map (a target-specific kind, e.g. Postgres's\n* namespace/table/policy/role) — those map their own kinds directly rather\n* than through this family-level map.\n*/\nfunction relationalNodeGranularity(nodeKind) {\n\tif (!isRelationalSchemaNodeKind(nodeKind)) throw new InternalError(`relationalNodeGranularity: unrecognized relational node kind \"${nodeKind}\"`);\n\treturn RELATIONAL_NODE_GRANULARITY[nodeKind];\n}\n/**\n* The one real map from a relational `nodeKind` to its storage `entityKind`\n* — the same vocabulary the contract storage's `entries` dictionary keys use\n* (`elementCoordinates` walks it). Only the whole-table kind has an entity of\n* its own; every other relational node (a column, an index, …) is nested\n* under one and maps to nothing here.\n*/\nconst RELATIONAL_NODE_ENTITY_KIND = { [RelationalSchemaNodeKind.table]: \"table\" };\n/**\n* Looks up the storage `entityKind` for a relational `nodeKind` — sibling of\n* {@link relationalNodeGranularity}, resolved by `nodeKind` equality against\n* {@link RELATIONAL_NODE_ENTITY_KIND}. `undefined` for a target-specific kind\n* (targets map their own kinds directly) or a relational kind with no entity\n* of its own.\n*/\nfunction relationalNodeEntityKind(nodeKind) {\n\treturn isRelationalSchemaNodeKind(nodeKind) ? RELATIONAL_NODE_ENTITY_KIND[nodeKind] : void 0;\n}\n//#endregion\n//#region src/ir/sql-schema-ir-node.ts\n/**\n* SQL Schema IR node base. Carries the family-level\n* `kind = 'sql-schema-ir'` discriminator and inherits the framework's\n* `freezeNode` affordance.\n*\n* SQL Schema IR represents the actual database state as discovered by\n* introspection (the parallel to SQL Contract IR, which represents the\n* desired state).\n*\n* The discriminator is installed as a non-enumerable own property,\n* matching the SqlNode pattern. This keeps `JSON.stringify(node)`\n* canonical (no `kind` field), keeps `toEqual({...})` test assertions\n* against pre-lift flat shapes passing, and keeps `node.kind` readable\n* for dispatch.\n*\n* Both `kind` and `nodeKind` are required: every concrete leaf is a node\n* the generic differ can pair and compare, so every leaf must declare which\n* node it is. `nodeKind` has no default here — every direct subclass sets its\n* own literal value (the relational leaves via `RelationalSchemaNodeKind`,\n* target concretions via their own vocabulary, e.g. `PostgresSchemaNodeKind`).\n*/\nvar SqlSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n};\n/**\n* Asserts `node` matches `predicate`, narrowing its type to `T`. The one\n* shared implementation every node class's `static assert` and `isEqualTo`\n* reach for, instead of each hand-writing its own throw: the message names\n* the class the caller expected.\n*/\nfunction assertNode(node, className, predicate) {\n\tif (node === void 0 || !predicate(node)) throw new InternalError(`Expected a ${className} but got nodeKind=${node?.nodeKind ?? \"undefined\"}`);\n}\n/**\n* Defines a non-enumerable own property, the same treatment `kind` gets\n* above: a derivation-time render-support field stays out of\n* `JSON.stringify`, `toEqual({...})` structural assertions, and spreads,\n* while remaining directly readable (`node.field`) for the one consumer\n* that resolves it at plan time. A no-op when `value` is `undefined` — the\n* property is simply absent, matching every other optional field on these\n* nodes.\n*/\nfunction defineNonEnumerable(target, key, value) {\n\tif (value === void 0) return;\n\tObject.defineProperty(target, key, {\n\t\tvalue,\n\t\tenumerable: false,\n\t\twritable: false,\n\t\tconfigurable: false\n\t});\n}\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* Primary-key Schema IR node. Mirrors the Contract IR `PrimaryKey`\n* shape (same `columns` + optional `name`) so verification can compare\n* intent and actual structurally. Defined here independently to avoid\n* a sql-schema-ir -> sql-contract dependency.\n*\n* Implements `DiffableNode` so a primary key is directly a table's diff-tree\n* child. `id` is a fixed sentinel — a table has at most one primary key, so\n* there is never a sibling to disambiguate against. `isEqualTo` compares the\n* column tuple; the PK's own `name` is a database-assigned label with no\n* semantic weight, so it is not compared (mirrors the policy node's\n* name-insensitivity to non-identifying detail).\n*/\nvar PrimaryKey = class PrimaryKey extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.primaryKey;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"primary-key\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof PrimaryKey ? value : new PrimaryKey(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.primaryKey;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"PrimaryKey\", PrimaryKey.is);\n\t\treturn this.columns.length === node.columns.length && this.columns.every((c, i) => c === node.columns[i]);\n\t}\n};\n//#endregion\n//#region src/ir/sql-check-constraint-ir.ts\n/**\n* Schema IR node for a table-level check constraint, carried as an opaque\n* predicate. The expression is never parsed — a database reprints predicates\n* in its own normalized form, so any structured reading of it would drift.\n*\n* Implements `DiffableNode` so a check is directly a table's diff-tree child;\n* `id` is `check:<name>`. `isEqualTo` is mode-selected by the receiver's\n* `prefix` (the differ always calls `expected.isEqualTo(actual)`): a\n* wire-named receiver compares ids only — the wire name's hash already\n* commits to the predicate — while an exact-named receiver byte-compares the\n* expression, which is reliable precisely when both sides came from the same\n* reprint.\n*/\nvar SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.check;\n\tname;\n\texpression;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.expression = input.expression;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `check:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlCheckConstraintIR ? value : new SqlCheckConstraintIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.check;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlCheckConstraintIR\", SqlCheckConstraintIR.is);\n\t\tif (this.prefix !== void 0) return this.id === node.id;\n\t\treturn this.expression === node.expression;\n\t}\n};\n//#endregion\n//#region src/ir/resolved-default-equality.ts\n/**\n* Structural equality for two resolved column defaults, ported from the\n* relational walk's `columnDefaultsEqual` normalized branch: kinds must\n* match; literal values are normalized (Date and temporal-typed strings to\n* ISO instants, and a 64-bit-integer native type's safe-integer number to\n* its decimal-text spelling) then compared canonically (JSON objects match\n* their canonical string form); function expressions compare case- and\n* whitespace-insensitively.\n*\n* `nativeType` provides the temporal- and int64-normalization context (the\n* actual side's resolved native type in a diff comparison).\n*/\nfunction resolvedDefaultsEqual(expected, actual, nativeType) {\n\tif (expected.kind !== actual.kind) return false;\n\tif (expected.kind === \"literal\" && actual.kind === \"literal\") return literalValuesEqual(normalizeLiteralValue(expected.value, nativeType), normalizeLiteralValue(actual.value, nativeType));\n\tif (expected.kind === \"function\" && actual.kind === \"function\") return normalizeFunctionExpression(expected.expression) === normalizeFunctionExpression(actual.expression);\n\treturn false;\n}\nfunction normalizeFunctionExpression(expression) {\n\treturn expression.toLowerCase().replace(/\\s+/g, \"\");\n}\nfunction isTemporalNativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized.includes(\"timestamp\") || normalized === \"date\";\n}\nfunction isInt64NativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized === \"int8\" || normalized === \"bigint\";\n}\nfunction normalizeLiteralValue(value, nativeType) {\n\tif (value instanceof Date) return value.toISOString();\n\tif (typeof value === \"string\" && isTemporalNativeType(nativeType)) {\n\t\tconst parsed = new Date(value);\n\t\tif (!Number.isNaN(parsed.getTime())) return parsed.toISOString();\n\t}\n\tif (typeof value === \"number\" && Number.isSafeInteger(value) && isInt64NativeType(nativeType)) return String(value);\n\treturn value;\n}\nfunction literalValuesEqual(a, b) {\n\tif (a === b) return true;\n\tif (typeof a === \"object\" && a !== null && typeof b === \"object\" && b !== null) return canonicalStringify(a) === canonicalStringify(b);\n\tif (typeof a === \"object\" && a !== null && typeof b === \"string\") try {\n\t\treturn canonicalStringify(a) === canonicalStringify(JSON.parse(b));\n\t} catch {\n\t\treturn false;\n\t}\n\tif (typeof a === \"string\" && typeof b === \"object\" && b !== null) try {\n\t\treturn canonicalStringify(JSON.parse(a)) === canonicalStringify(b);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/ir/sql-column-default-ir.ts\n/**\n* Schema-diff node for a column's default value. The default is the one\n* column attribute with an extra/missing/drift lifecycle of its own, so it\n* is a child node of the column rather than a compared attribute: an\n* undeclared live default surfaces as `not-expected`, a declared default the\n* database lacks as `not-found`, and a divergent value as `not-equal` — the\n* three reasons cover the legacy `extra_default` / `default_missing` /\n* `default_mismatch` vocabulary with no attribute inspection.\n*\n* `id` is a fixed sentinel — a column has at most one default. Built\n* transiently by `SqlColumnIR.children()` from the column's own fields;\n* never constructed by derivation or introspection directly.\n*/\nvar SqlColumnDefaultIR = class SqlColumnDefaultIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.columnDefault;\n\tconstructor(input) {\n\t\tsuper();\n\t\tif (input.resolved !== void 0) this.resolved = input.resolved;\n\t\tif (input.raw !== void 0) this.raw = input.raw;\n\t\tif (input.nativeTypeContext !== void 0) this.nativeTypeContext = input.nativeTypeContext;\n\t\tdefineNonEnumerable(this, \"many\", input.many);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"default\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.columnDefault;\n\t}\n\t/**\n\t* Structured comparison with `this` as the expected side: both sides\n\t* resolved compare per the relational walk's `columnDefaultsEqual`\n\t* semantics; a declared expected default against an unparseable actual\n\t* (raw present, no resolved parse) is a mismatch; two raw-only nodes fall\n\t* back to raw string equality.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnDefaultIR\", SqlColumnDefaultIR.is);\n\t\tif (this.resolved !== void 0 && node.resolved !== void 0) return resolvedDefaultsEqual(this.resolved, node.resolved, node.nativeTypeContext ?? this.nativeTypeContext);\n\t\tif (this.resolved !== void 0 || node.resolved !== void 0) return false;\n\t\treturn this.raw === node.raw;\n\t}\n};\n//#endregion\n//#region src/ir/sql-column-ir.ts\n/**\n* Schema IR node for a single column on a table, as observed by\n* introspection. Unlike the Contract IR `StorageColumn`, this carries\n* the column's `name` (Schema IR columns are returned as arrays from\n* introspection queries; the parent table re-keys them into a record\n* for downstream consumers).\n*\n* Implements `DiffableNode` so a column is directly a table's diff-tree\n* child: `id` is the column name (unique among a table's columns); `isEqualTo`\n* compares this column's own attributes only — never children, since a\n* column is a leaf. When both sides carry `resolvedNativeType` (stamped at\n* derivation/introspection), the comparison uses the resolved values —\n* resolved native type, nullability, and structured default equality per\n* the relational walk's `columnDefaultsEqual` semantics, with `this` as the\n* expected side. Otherwise it falls back to comparing raw fields.\n*/\nvar SqlColumnIR = class SqlColumnIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.column;\n\tname;\n\tnativeType;\n\tnullable;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.nullable = input.nullable;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.many !== void 0) this.many = input.many;\n\t\tif (input.resolvedNativeType !== void 0) this.resolvedNativeType = input.resolvedNativeType;\n\t\tif (input.resolvedDefault !== void 0) this.resolvedDefault = input.resolvedDefault;\n\t\tdefineNonEnumerable(this, \"codecRef\", input.codecRef);\n\t\tdefineNonEnumerable(this, \"codecBaseNativeType\", input.codecBaseNativeType);\n\t\tdefineNonEnumerable(this, \"codecNamedType\", input.codecNamedType);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `column:${this.name}`;\n\t}\n\t/**\n\t* The column's default, when declared/present, is the column's one child\n\t* node — it has an extra/missing/drift lifecycle of its own, so the differ\n\t* recurses to it rather than `isEqualTo` comparing it. Built transiently\n\t* from this column's own fields.\n\t*/\n\tchildren() {\n\t\tif (this.resolvedDefault === void 0 && this.default === void 0) return [];\n\t\treturn [new SqlColumnDefaultIR({\n\t\t\t...ifDefined(\"resolved\", this.resolvedDefault),\n\t\t\t...ifDefined(\"raw\", this.default),\n\t\t\t...ifDefined(\"nativeTypeContext\", this.resolvedNativeType),\n\t\t\t...ifDefined(\"many\", this.many ?? this.codecRef?.many)\n\t\t})];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.column;\n\t}\n\t/**\n\t* Compares the column's own attributes only — the default lives on the\n\t* child node. When both sides carry `resolvedNativeType`, the resolved\n\t* value governs (array-ness rides on its `[]` suffix); otherwise raw\n\t* fields compare.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnIR\", SqlColumnIR.is);\n\t\tif (this.resolvedNativeType !== void 0 && node.resolvedNativeType !== void 0) return this.resolvedNativeType === node.resolvedNativeType && this.nullable === node.nullable;\n\t\treturn this.nativeType === node.nativeType && this.nullable === node.nullable && Boolean(this.many) === Boolean(node.many);\n\t}\n};\n//#endregion\n//#region src/ir/sql-foreign-key-ir.ts\n/**\n* Schema IR node for a foreign-key constraint as observed by\n* introspection. The `referencedTable` / `referencedColumns` field\n* names match the introspection vocabulary (`pg_constraint.confkey`,\n* etc.) and intentionally differ from the Contract IR's nested\n* `references: { table, columns }` shape so that the verifier's\n* structural comparison stays explicit about which side it's reading.\n*\n* Implements `DiffableNode` so a foreign key is directly a table's diff-tree\n* child. Foreign keys are frequently unnamed (introspection may not carry a\n* constraint name, and the contract side never invents one), so `id` is\n* derived from the referencing/referenced coordinates rather than `name` —\n* the same tuple that makes two FK constraints the same constraint. This\n* also serves as the comparison key: two FKs with the same coordinates are\n* paired by the differ, and `isEqualTo` then compares the remaining\n* attribute — the referential actions.\n*/\nvar SqlForeignKeyIR = class SqlForeignKeyIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.foreignKey;\n\tcolumns;\n\treferencedTable;\n\treferencedColumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tthis.referencedTable = input.referencedTable;\n\t\tthis.referencedColumns = input.referencedColumns;\n\t\tif (input.referencedSchema !== void 0) this.referencedSchema = input.referencedSchema;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tconst resolvedReferencedNamespace = input.resolvedReferencedNamespace ?? input.referencedSchema;\n\t\tif (resolvedReferencedNamespace !== void 0) this.resolvedReferencedNamespace = resolvedReferencedNamespace;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\tconst referencedNamespace = this.resolvedReferencedNamespace ?? \"\";\n\t\treturn `foreign-key:${this.columns.join(\",\")}->${referencedNamespace}.${this.referencedTable}(${this.referencedColumns.join(\",\")})`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.foreignKey;\n\t}\n\t/**\n\t* Referential-action comparison with `this` as the expected side, matching\n\t* the relational walk's `getReferentialActionMismatches`: `noAction` is the\n\t* database default and equivalent to an undeclared action, and drift is\n\t* flagged only when the expected side declares a (normalized) action.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlForeignKeyIR\", SqlForeignKeyIR.is);\n\t\treturn referentialActionMatches(this.onDelete, node.onDelete) && referentialActionMatches(this.onUpdate, node.onUpdate);\n\t}\n};\nfunction referentialActionMatches(expected, actual) {\n\tconst normalizedExpected = expected === \"noAction\" ? void 0 : expected;\n\tif (normalizedExpected === void 0) return true;\n\treturn normalizedExpected === (actual === \"noAction\" ? void 0 : actual);\n}\n//#endregion\n//#region src/ir/sql-index-ir.ts\n/**\n* Schema IR node for a secondary index as observed by introspection.\n* Unlike the Contract IR `Index`, the Schema IR carries an explicit\n* `unique` field — introspection sees the underlying index regardless\n* of whether the user expressed it as `@@index` or `@@unique`, and the\n* verifier needs to distinguish them when comparing to the Contract.\n*\n* Implements `DiffableNode` so an index is directly a table's diff-tree\n* child. Indexes are name-identified: every index — contract-derived or\n* introspected — carries its full physical name, and `id` is that name.\n* Names are catalog-unique per schema, so two indexes legitimately sharing\n* one column tuple (a unique index beside a redundant plain index) are two\n* distinct siblings, and expression indexes need no column tuple at all.\n*\n* `isEqualTo` is selected by the receiver (the differ always calls\n* `expected.isEqualTo(actual)`) and delegates to {@link contentEquals} —\n* the single node-owned content relation: both modes compare `unique`\n* strict, `type` and option values through the named normalization seams,\n* and `columns` ordered-strict when both sides carry them; an exact-named\n* receiver (`prefix === undefined`) additionally byte-compares\n* `expression`/`where` (both sides are reprints in the supported flow —\n* normalizing would only mask real drift); a wire-named receiver never\n* compares bodies (the wire-name hash already commits to them).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL that any SQL target may\n* introspect, so the family node must represent them; a target declining\n* to author them is a capability decision, not target-specificity.\n*/\nvar SqlIndexIR = class SqlIndexIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.index;\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new InternalError(`SqlIndexIR \"${name}\": exactly one of columns or expression must be set.`);\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tconst normalizedType = normalizeIndexType(input.type);\n\t\tif (normalizedType !== void 0) this.type = normalizedType;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tdefineNonEnumerable(this, \"partial\", input.partial);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `index:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlIndexIR ? value : new SqlIndexIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.index;\n\t}\n\t/**\n\t* Mode-selected structural equality — see the class doc. Delegates to the\n\t* single node-owned relation: `columns` compare ordered-strict when both\n\t* sides carry them; an exact receiver (`prefix === undefined`)\n\t* byte-compares `expression ?? ''` and `where ?? ''`; a wire-named receiver\n\t* never compares bodies (the wire-name hash already commits to them).\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlIndexIR\", SqlIndexIR.is);\n\t\treturn this.contentEquals(node, {\n\t\t\tcolumnPresence: \"when-both-defined\",\n\t\t\tbodies: this.prefix !== void 0 ? \"ignored\" : \"verbatim\"\n\t\t});\n\t}\n\t/**\n\t* The single index content-equality relation — every comparer (the differ\n\t* via {@link isEqualTo}, the planner's rename content-pairing) calls this\n\t* with its mode-appropriate strictness rather than growing a parallel\n\t* relation:\n\t*\n\t* - `columnPresence: 'when-both-defined'` (the differ's rule) compares\n\t* the tuples ordered-strict only when both sides carry them — a paired\n\t* node's identity already agreed, so a column node meeting an\n\t* expression node skips the tuple.\n\t* - `columnPresence: 'matching'` (the rename-pairing rule) additionally\n\t* requires presence to agree: a column index never pairs an expression\n\t* index.\n\t* - `bodies: 'verbatim'` byte-compares `expression ?? ''` / `where ?? ''`\n\t* (absent ≡ empty, no normalization — both sides are reprints in the\n\t* supported flow); `bodies: 'ignored'` skips them (wire identity —\n\t* the wire-name hash commits to the content).\n\t*\n\t* `unique` compares strictly; `type` and option VALUES compare through\n\t* the named normalization seams below.\n\t*/\n\tcontentEquals(other, strictness) {\n\t\tconst columnsEqual = strictness.columnPresence === \"matching\" ? this.columns === void 0 === (other.columns === void 0) && (this.columns === void 0 || isArrayEqual(this.columns, other.columns ?? [])) : this.columns === void 0 || other.columns === void 0 || isArrayEqual(this.columns, other.columns);\n\t\tif (!(this.unique === other.unique && normalizeIndexType(this.type) === normalizeIndexType(other.type) && indexOptionsEqual(this.options, other.options) && columnsEqual)) return false;\n\t\tif (strictness.bodies === \"ignored\") return true;\n\t\treturn (this.expression ?? \"\") === (other.expression ?? \"\") && (this.where ?? \"\") === (other.where ?? \"\");\n\t}\n};\n/**\n* The btree-default normalization seam: the default access method (`btree`\n* in every supported SQL target) normalizes to absent. Applied at\n* construction — every derivation path (contract tree, introspection, flat\n* family tree) builds through the class, so both compare sides are\n* symmetric by definition — and again inside\n* {@link SqlIndexIR.contentEquals} so the relation holds for any input.\n* The contract JSON and the wire-name content hash keep the authored\n* spelling: `@@index([a], type: \"btree\")` and `@@index([a])` are distinct\n* wire names — but content-equal after normalization, so a spelling change\n* between them converges as a rename via the planner's content\n* pairing (the hashes differ, so hash pairing never pairs them).\n*/\nfunction normalizeIndexType(type) {\n\treturn type === \"btree\" ? void 0 : type;\n}\n/**\n* Option-bag equality: same key set, values compared through\n* {@link normalizeIndexOptionValue} — Postgres introspection returns\n* reloptions values as catalog-reprint strings (`'70'`, `'on'`) while\n* contract option leaves are typed (number, boolean, string).\n*/\nfunction indexOptionsEqual(a, b) {\n\tconst aKeys = a ? Object.keys(a).sort() : [];\n\tconst bKeys = b ? Object.keys(b).sort() : [];\n\tif (aKeys.length !== bKeys.length) return false;\n\tfor (let i = 0; i < aKeys.length; i += 1) if (aKeys[i] !== bKeys[i]) return false;\n\tif (aKeys.length === 0) return true;\n\tfor (const key of aKeys) if (normalizeIndexOptionValue(a?.[key]) !== normalizeIndexOptionValue(b?.[key])) return false;\n\treturn true;\n}\n//#endregion\n//#region src/ir/sql-unique-ir.ts\n/**\n* Schema IR node for a table-level unique constraint as observed by\n* introspection.\n*\n* Implements `DiffableNode` so a unique constraint is directly a table's\n* diff-tree child. Unique constraints are frequently unnamed, so `id` is\n* derived from the column tuple rather than `name` — the column tuple is\n* also what makes two unique constraints the same constraint, so it doubles\n* as the pairing key. There are no further attributes to compare once\n* columns are equal (the differ pairs on `id`), so `isEqualTo` is identity.\n*/\nvar SqlUniqueIR = class SqlUniqueIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.unique;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = [...input.columns];\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `unique:${this.columns.join(\",\")}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.unique;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlUniqueIR\", SqlUniqueIR.is);\n\t\treturn this.id === node.id;\n\t}\n};\n//#endregion\n//#region src/ir/sql-table-ir.ts\n/**\n* Schema IR node for a single table as observed by introspection.\n*\n* Unlike the Contract IR `StorageTable`, this carries the table's\n* `name` — introspection queries return tables as arrays and the\n* verifier keys them into `SqlSchemaIR.tables` afterwards, so the name\n* stays on the table object for downstream call sites that walk\n* `Object.values(schema.tables)`.\n*\n* The constructor normalises nested IR-class fields so downstream\n* walks see a uniform AST regardless of whether the input was a\n* plain-data literal (from introspection) or already-constructed\n* class instances.\n*\n* Implements `DiffableNode` so a flat (single-schema) tree is directly\n* diffable: `id` is the table name; `isEqualTo` is identity (the table's\n* structural drift is entirely expressed by its children); `children()`\n* yields every column, the primary key (when present), every foreign key,\n* unique, index, and check constraint — the same composition and order as\n* the Postgres table node, minus policies.\n*/\nvar SqlTableIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.table;\n\tname;\n\tcolumns;\n\tforeignKeys;\n\tuniques;\n\tindexes;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map(SqlIndexIR.from));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = PrimaryKey.from(input.primaryKey);\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map(SqlCheckConstraintIR.from));\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [\n\t\t\t...Object.values(this.columns),\n\t\t\t...this.primaryKey ? [this.primaryKey] : [],\n\t\t\t...this.foreignKeys,\n\t\t\t...this.uniques,\n\t\t\t...this.indexes,\n\t\t\t...this.checks ?? []\n\t\t];\n\t}\n};\n//#endregion\n//#region src/ir/sql-schema-ir.ts\n/**\n* Root Schema IR node representing the complete database schema as\n* observed by introspection. Target-agnostic; used by both verifiers\n* (compare against intended Contract storage) and migration planners\n* (derive operations needed to reconcile).\n*\n* The constructor normalises nested `SqlTableIR` instances so\n* downstream walks see a uniform AST regardless of whether the input\n* was a plain-data literal or already-constructed class instances.\n*\n* Implements `DiffableNode` as the root of a flat (single-schema) diff\n* tree: `id` is the fixed sentinel `'database'` (roots have no siblings),\n* `isEqualTo` is identity (a container has no own attributes), and\n* `children()` yields the table nodes.\n*/\nvar SqlSchemaIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.schema;\n\ttables;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tables = Object.freeze(Object.fromEntries(Object.entries(input.tables).map(([key, t]) => [key, t instanceof SqlTableIR ? t : new SqlTableIR(t)])));\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"database\";\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn Object.values(this.tables);\n\t}\n};\n//#endregion\nexport { SqlForeignKeyIR as a, SqlCheckConstraintIR as c, assertNode as d, defineNonEnumerable as f, relationalNodeGranularity as h, SqlIndexIR as i, PrimaryKey as l, relationalNodeEntityKind as m, SqlTableIR as n, SqlColumnIR as o, RelationalSchemaNodeKind as p, SqlUniqueIR as r, SqlColumnDefaultIR as s, SqlSchemaIR as t, SqlSchemaIRNode as u };\n\n//# sourceMappingURL=types-BvupgHcG.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,2BAA2B;CAChC,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,OAAO;AACR;;;;;;;;;;;AAWA,MAAM,8BAA8B;EAClC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,SAAS;EAClC,yBAAyB,gBAAgB;EACzC,yBAAyB,aAAa;EACtC,yBAAyB,aAAa;EACtC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,QAAQ;AACnC;AACA,SAAS,2BAA2B,UAAU;CAC7C,OAAO,OAAO,OAAO,6BAA6B,QAAQ;AAC3D;;;;;;;AAOA,SAAS,0BAA0B,UAAU;CAC5C,IAAI,CAAC,2BAA2B,QAAQ,GAAG,MAAM,IAAI,cAAc,iEAAiE,SAAS,EAAE;CAC/I,OAAO,4BAA4B;AACpC;;;;;;;;AAQA,MAAM,8BAA8B,GAAG,yBAAyB,QAAQ,QAAQ;;;;;;;;AAQhF,SAAS,yBAAyB,UAAU;CAC3C,OAAO,2BAA2B,QAAQ,IAAI,4BAA4B,YAAY,KAAK;AAC5F;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,kBAAkB,cAAc,WAAW;CAC9C,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;CACF;AACD;;;;;;;AAOA,SAAS,WAAW,MAAM,WAAW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AC,KAAK,OAAO,CAAC,KAAK,aAAa,aAAa,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;EACtJ,IAAI,MAAM,gBAAgB,KAAK,GAAG,KAAK,cAAc,MAAM;EAC3D,WAAW,IAAI;CAChB;CACA,IAAI,KAAK;EACR,OAAO;CACR;CACA,UAAU,OAAO;EAChB,OAAO,KAAK,OAAO,MAAM;CAC1B;CACA,WAAW;EACV,OAAO,OAAO,OAAO,KAAK,MAAM;CACjC;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-sql",
3
- "version": "8.0.0-rc.8-dev.11",
3
+ "version": "8.0.0-rc.8-dev.12",
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.8-dev.11",
13
- "@prisma/orm-toolchain": "8.0.0-rc.8-dev.11",
12
+ "@prisma/orm-framework": "8.0.0-rc.8-dev.12",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.8-dev.12",
14
14
  "@standard-schema/spec": "^1.1.0",
15
15
  "arktype": "^2.2.2",
16
16
  "pathe": "^2.0.3",
@@ -18,20 +18,20 @@
18
18
  "ts-toolbelt": "^9.6.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@internal/family-sql": "8.0.0-rc.8-dev.11",
22
- "@internal/sql-builder": "8.0.0-rc.8-dev.11",
23
- "@internal/sql-contract": "8.0.0-rc.8-dev.11",
24
- "@internal/sql-contract-emitter": "8.0.0-rc.8-dev.11",
25
- "@internal/sql-contract-psl": "8.0.0-rc.8-dev.11",
26
- "@internal/sql-contract-ts": "8.0.0-rc.8-dev.11",
27
- "@internal/sql-errors": "8.0.0-rc.8-dev.11",
28
- "@internal/sql-operations": "8.0.0-rc.8-dev.11",
29
- "@internal/sql-orm-client": "8.0.0-rc.8-dev.11",
30
- "@internal/sql-relational-core": "8.0.0-rc.8-dev.11",
31
- "@internal/sql-runtime": "8.0.0-rc.8-dev.11",
32
- "@internal/sql-schema-ir": "8.0.0-rc.8-dev.11",
33
- "@repo/tsconfig": "8.0.0-rc.8-dev.11",
34
- "@repo/tsdown": "8.0.0-rc.8-dev.11",
21
+ "@internal/family-sql": "8.0.0-rc.8-dev.12",
22
+ "@internal/sql-builder": "8.0.0-rc.8-dev.12",
23
+ "@internal/sql-contract": "8.0.0-rc.8-dev.12",
24
+ "@internal/sql-contract-emitter": "8.0.0-rc.8-dev.12",
25
+ "@internal/sql-contract-psl": "8.0.0-rc.8-dev.12",
26
+ "@internal/sql-contract-ts": "8.0.0-rc.8-dev.12",
27
+ "@internal/sql-errors": "8.0.0-rc.8-dev.12",
28
+ "@internal/sql-operations": "8.0.0-rc.8-dev.12",
29
+ "@internal/sql-orm-client": "8.0.0-rc.8-dev.12",
30
+ "@internal/sql-relational-core": "8.0.0-rc.8-dev.12",
31
+ "@internal/sql-runtime": "8.0.0-rc.8-dev.12",
32
+ "@internal/sql-schema-ir": "8.0.0-rc.8-dev.12",
33
+ "@repo/tsconfig": "8.0.0-rc.8-dev.12",
34
+ "@repo/tsdown": "8.0.0-rc.8-dev.12",
35
35
  "tsdown": "0.22.14",
36
36
  "typescript": "5.9.3"
37
37
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-4YenawkP-CwaaZSid.mjs","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/types-4YenawkP.mjs"],"sourcesContent":["import { f as normalizeIndexOptionValue, l as nameOf } from \"./naming-DKr4TJd7.mjs\";\nimport { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\n//#region src/ir/schema-node-kinds.ts\n/**\n* The `nodeKind` discriminant for each relational schema-diff leaf node.\n* Each node carries a unique value; the differ pairs siblings by `id`, and\n* these kinds distinguish the node types that appear as `PostgresTableSchemaNode`\n* children (columns, primary key, foreign keys, uniques, indexes, checks) from\n* each other and from the RLS policy/role kinds a target defines separately.\n*/\nconst RelationalSchemaNodeKind = {\n\tschema: \"sql-schema\",\n\ttable: \"sql-table\",\n\tcolumn: \"sql-column\",\n\tcolumnDefault: \"sql-column-default\",\n\tprimaryKey: \"sql-primary-key\",\n\tforeignKey: \"sql-foreign-key\",\n\tunique: \"sql-unique\",\n\tindex: \"sql-index\",\n\tcheck: \"sql-check-constraint\"\n};\n/**\n* The one real map from a relational `nodeKind` to the framework-neutral\n* {@link DiffSubjectGranularity} its diff issues carry — the SQL family's\n* post-diff filters (issue category, strict-mode gating) and the framework\n* aggregate's unclaimed-elements sweep key on the granularity, never on the\n* `nodeKind` spelling and never on anything stamped on the node. Resolution\n* is by `nodeKind` equality against this map, not a suffix string match.\n* Target-specific node kinds (Postgres namespace/table/policy/role) are\n* outside this family layer's vocabulary and map their own kinds directly.\n*/\nconst RELATIONAL_NODE_GRANULARITY = {\n\t[RelationalSchemaNodeKind.schema]: \"structural\",\n\t[RelationalSchemaNodeKind.table]: \"entity\",\n\t[RelationalSchemaNodeKind.column]: \"field\",\n\t[RelationalSchemaNodeKind.columnDefault]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.primaryKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.foreignKey]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.unique]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.index]: \"auxiliary\",\n\t[RelationalSchemaNodeKind.check]: \"auxiliary\"\n};\nfunction isRelationalSchemaNodeKind(nodeKind) {\n\treturn Object.hasOwn(RELATIONAL_NODE_GRANULARITY, nodeKind);\n}\n/**\n* Looks up the subject granularity for a relational `nodeKind`. Throws for a\n* `nodeKind` outside this map (a target-specific kind, e.g. Postgres's\n* namespace/table/policy/role) — those map their own kinds directly rather\n* than through this family-level map.\n*/\nfunction relationalNodeGranularity(nodeKind) {\n\tif (!isRelationalSchemaNodeKind(nodeKind)) throw new InternalError(`relationalNodeGranularity: unrecognized relational node kind \"${nodeKind}\"`);\n\treturn RELATIONAL_NODE_GRANULARITY[nodeKind];\n}\n/**\n* The one real map from a relational `nodeKind` to its storage `entityKind`\n* — the same vocabulary the contract storage's `entries` dictionary keys use\n* (`elementCoordinates` walks it). Only the whole-table kind has an entity of\n* its own; every other relational node (a column, an index, …) is nested\n* under one and maps to nothing here.\n*/\nconst RELATIONAL_NODE_ENTITY_KIND = { [RelationalSchemaNodeKind.table]: \"table\" };\n/**\n* Looks up the storage `entityKind` for a relational `nodeKind` — sibling of\n* {@link relationalNodeGranularity}, resolved by `nodeKind` equality against\n* {@link RELATIONAL_NODE_ENTITY_KIND}. `undefined` for a target-specific kind\n* (targets map their own kinds directly) or a relational kind with no entity\n* of its own.\n*/\nfunction relationalNodeEntityKind(nodeKind) {\n\treturn isRelationalSchemaNodeKind(nodeKind) ? RELATIONAL_NODE_ENTITY_KIND[nodeKind] : void 0;\n}\n//#endregion\n//#region src/ir/sql-schema-ir-node.ts\n/**\n* SQL Schema IR node base. Carries the family-level\n* `kind = 'sql-schema-ir'` discriminator and inherits the framework's\n* `freezeNode` affordance.\n*\n* SQL Schema IR represents the actual database state as discovered by\n* introspection (the parallel to SQL Contract IR, which represents the\n* desired state).\n*\n* The discriminator is installed as a non-enumerable own property,\n* matching the SqlNode pattern. This keeps `JSON.stringify(node)`\n* canonical (no `kind` field), keeps `toEqual({...})` test assertions\n* against pre-lift flat shapes passing, and keeps `node.kind` readable\n* for dispatch.\n*\n* Both `kind` and `nodeKind` are required: every concrete leaf is a node\n* the generic differ can pair and compare, so every leaf must declare which\n* node it is. `nodeKind` has no default here — every direct subclass sets its\n* own literal value (the relational leaves via `RelationalSchemaNodeKind`,\n* target concretions via their own vocabulary, e.g. `PostgresSchemaNodeKind`).\n*/\nvar SqlSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"sql-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n};\n/**\n* Asserts `node` matches `predicate`, narrowing its type to `T`. The one\n* shared implementation every node class's `static assert` and `isEqualTo`\n* reach for, instead of each hand-writing its own throw: the message names\n* the class the caller expected.\n*/\nfunction assertNode(node, className, predicate) {\n\tif (node === void 0 || !predicate(node)) throw new InternalError(`Expected a ${className} but got nodeKind=${node?.nodeKind ?? \"undefined\"}`);\n}\n/**\n* Defines a non-enumerable own property, the same treatment `kind` gets\n* above: a derivation-time render-support field stays out of\n* `JSON.stringify`, `toEqual({...})` structural assertions, and spreads,\n* while remaining directly readable (`node.field`) for the one consumer\n* that resolves it at plan time. A no-op when `value` is `undefined` — the\n* property is simply absent, matching every other optional field on these\n* nodes.\n*/\nfunction defineNonEnumerable(target, key, value) {\n\tif (value === void 0) return;\n\tObject.defineProperty(target, key, {\n\t\tvalue,\n\t\tenumerable: false,\n\t\twritable: false,\n\t\tconfigurable: false\n\t});\n}\n//#endregion\n//#region src/ir/primary-key.ts\n/**\n* Primary-key Schema IR node. Mirrors the Contract IR `PrimaryKey`\n* shape (same `columns` + optional `name`) so verification can compare\n* intent and actual structurally. Defined here independently to avoid\n* a sql-schema-ir -> sql-contract dependency.\n*\n* Implements `DiffableNode` so a primary key is directly a table's diff-tree\n* child. `id` is a fixed sentinel — a table has at most one primary key, so\n* there is never a sibling to disambiguate against. `isEqualTo` compares the\n* column tuple; the PK's own `name` is a database-assigned label with no\n* semantic weight, so it is not compared (mirrors the policy node's\n* name-insensitivity to non-identifying detail).\n*/\nvar PrimaryKey = class PrimaryKey extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.primaryKey;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"primary-key\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof PrimaryKey ? value : new PrimaryKey(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.primaryKey;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"PrimaryKey\", PrimaryKey.is);\n\t\treturn this.columns.length === node.columns.length && this.columns.every((c, i) => c === node.columns[i]);\n\t}\n};\n//#endregion\n//#region src/ir/sql-check-constraint-ir.ts\n/**\n* Schema IR node for a table-level check constraint, carried as an opaque\n* predicate. The expression is never parsed — a database reprints predicates\n* in its own normalized form, so any structured reading of it would drift.\n*\n* Implements `DiffableNode` so a check is directly a table's diff-tree child;\n* `id` is `check:<name>`. `isEqualTo` is mode-selected by the receiver's\n* `prefix` (the differ always calls `expected.isEqualTo(actual)`): a\n* wire-named receiver compares ids only — the wire name's hash already\n* commits to the predicate — while an exact-named receiver byte-compares the\n* expression, which is reliable precisely when both sides came from the same\n* reprint.\n*/\nvar SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.check;\n\tname;\n\texpression;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.expression = input.expression;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `check:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlCheckConstraintIR ? value : new SqlCheckConstraintIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.check;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlCheckConstraintIR\", SqlCheckConstraintIR.is);\n\t\tif (this.prefix !== void 0) return this.id === node.id;\n\t\treturn this.expression === node.expression;\n\t}\n};\n//#endregion\n//#region src/ir/resolved-default-equality.ts\n/**\n* Structural equality for two resolved column defaults, ported from the\n* relational walk's `columnDefaultsEqual` normalized branch: kinds must\n* match; literal values are normalized (Date and temporal-typed strings to\n* ISO instants) then compared canonically (JSON objects match their\n* canonical string form); function expressions compare case- and\n* whitespace-insensitively.\n*\n* `nativeType` provides the temporal-normalization context (the actual\n* side's resolved native type in a diff comparison).\n*/\nfunction resolvedDefaultsEqual(expected, actual, nativeType) {\n\tif (expected.kind !== actual.kind) return false;\n\tif (expected.kind === \"literal\" && actual.kind === \"literal\") return literalValuesEqual(normalizeLiteralValue(expected.value, nativeType), normalizeLiteralValue(actual.value, nativeType));\n\tif (expected.kind === \"function\" && actual.kind === \"function\") return normalizeFunctionExpression(expected.expression) === normalizeFunctionExpression(actual.expression);\n\treturn false;\n}\nfunction normalizeFunctionExpression(expression) {\n\treturn expression.toLowerCase().replace(/\\s+/g, \"\");\n}\nfunction isTemporalNativeType(nativeType) {\n\tif (!nativeType) return false;\n\tconst normalized = nativeType.toLowerCase();\n\treturn normalized.includes(\"timestamp\") || normalized === \"date\";\n}\nfunction normalizeLiteralValue(value, nativeType) {\n\tif (value instanceof Date) return value.toISOString();\n\tif (typeof value === \"string\" && isTemporalNativeType(nativeType)) {\n\t\tconst parsed = new Date(value);\n\t\tif (!Number.isNaN(parsed.getTime())) return parsed.toISOString();\n\t}\n\treturn value;\n}\nfunction literalValuesEqual(a, b) {\n\tif (a === b) return true;\n\tif (typeof a === \"object\" && a !== null && typeof b === \"object\" && b !== null) return canonicalStringify(a) === canonicalStringify(b);\n\tif (typeof a === \"object\" && a !== null && typeof b === \"string\") try {\n\t\treturn canonicalStringify(a) === canonicalStringify(JSON.parse(b));\n\t} catch {\n\t\treturn false;\n\t}\n\tif (typeof a === \"string\" && typeof b === \"object\" && b !== null) try {\n\t\treturn canonicalStringify(JSON.parse(a)) === canonicalStringify(b);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/ir/sql-column-default-ir.ts\n/**\n* Schema-diff node for a column's default value. The default is the one\n* column attribute with an extra/missing/drift lifecycle of its own, so it\n* is a child node of the column rather than a compared attribute: an\n* undeclared live default surfaces as `not-expected`, a declared default the\n* database lacks as `not-found`, and a divergent value as `not-equal` — the\n* three reasons cover the legacy `extra_default` / `default_missing` /\n* `default_mismatch` vocabulary with no attribute inspection.\n*\n* `id` is a fixed sentinel — a column has at most one default. Built\n* transiently by `SqlColumnIR.children()` from the column's own fields;\n* never constructed by derivation or introspection directly.\n*/\nvar SqlColumnDefaultIR = class SqlColumnDefaultIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.columnDefault;\n\tconstructor(input) {\n\t\tsuper();\n\t\tif (input.resolved !== void 0) this.resolved = input.resolved;\n\t\tif (input.raw !== void 0) this.raw = input.raw;\n\t\tif (input.nativeTypeContext !== void 0) this.nativeTypeContext = input.nativeTypeContext;\n\t\tdefineNonEnumerable(this, \"many\", input.many);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"default\";\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.columnDefault;\n\t}\n\t/**\n\t* Structured comparison with `this` as the expected side: both sides\n\t* resolved compare per the relational walk's `columnDefaultsEqual`\n\t* semantics; a declared expected default against an unparseable actual\n\t* (raw present, no resolved parse) is a mismatch; two raw-only nodes fall\n\t* back to raw string equality.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnDefaultIR\", SqlColumnDefaultIR.is);\n\t\tif (this.resolved !== void 0 && node.resolved !== void 0) return resolvedDefaultsEqual(this.resolved, node.resolved, node.nativeTypeContext ?? this.nativeTypeContext);\n\t\tif (this.resolved !== void 0 || node.resolved !== void 0) return false;\n\t\treturn this.raw === node.raw;\n\t}\n};\n//#endregion\n//#region src/ir/sql-column-ir.ts\n/**\n* Schema IR node for a single column on a table, as observed by\n* introspection. Unlike the Contract IR `StorageColumn`, this carries\n* the column's `name` (Schema IR columns are returned as arrays from\n* introspection queries; the parent table re-keys them into a record\n* for downstream consumers).\n*\n* Implements `DiffableNode` so a column is directly a table's diff-tree\n* child: `id` is the column name (unique among a table's columns); `isEqualTo`\n* compares this column's own attributes only — never children, since a\n* column is a leaf. When both sides carry `resolvedNativeType` (stamped at\n* derivation/introspection), the comparison uses the resolved values —\n* resolved native type, nullability, and structured default equality per\n* the relational walk's `columnDefaultsEqual` semantics, with `this` as the\n* expected side. Otherwise it falls back to comparing raw fields.\n*/\nvar SqlColumnIR = class SqlColumnIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.column;\n\tname;\n\tnativeType;\n\tnullable;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.nativeType = input.nativeType;\n\t\tthis.nullable = input.nullable;\n\t\tif (input.default !== void 0) this.default = input.default;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.many !== void 0) this.many = input.many;\n\t\tif (input.resolvedNativeType !== void 0) this.resolvedNativeType = input.resolvedNativeType;\n\t\tif (input.resolvedDefault !== void 0) this.resolvedDefault = input.resolvedDefault;\n\t\tdefineNonEnumerable(this, \"codecRef\", input.codecRef);\n\t\tdefineNonEnumerable(this, \"codecBaseNativeType\", input.codecBaseNativeType);\n\t\tdefineNonEnumerable(this, \"codecNamedType\", input.codecNamedType);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `column:${this.name}`;\n\t}\n\t/**\n\t* The column's default, when declared/present, is the column's one child\n\t* node — it has an extra/missing/drift lifecycle of its own, so the differ\n\t* recurses to it rather than `isEqualTo` comparing it. Built transiently\n\t* from this column's own fields.\n\t*/\n\tchildren() {\n\t\tif (this.resolvedDefault === void 0 && this.default === void 0) return [];\n\t\treturn [new SqlColumnDefaultIR({\n\t\t\t...ifDefined(\"resolved\", this.resolvedDefault),\n\t\t\t...ifDefined(\"raw\", this.default),\n\t\t\t...ifDefined(\"nativeTypeContext\", this.resolvedNativeType),\n\t\t\t...ifDefined(\"many\", this.many ?? this.codecRef?.many)\n\t\t})];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.column;\n\t}\n\t/**\n\t* Compares the column's own attributes only — the default lives on the\n\t* child node. When both sides carry `resolvedNativeType`, the resolved\n\t* value governs (array-ness rides on its `[]` suffix); otherwise raw\n\t* fields compare.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlColumnIR\", SqlColumnIR.is);\n\t\tif (this.resolvedNativeType !== void 0 && node.resolvedNativeType !== void 0) return this.resolvedNativeType === node.resolvedNativeType && this.nullable === node.nullable;\n\t\treturn this.nativeType === node.nativeType && this.nullable === node.nullable && Boolean(this.many) === Boolean(node.many);\n\t}\n};\n//#endregion\n//#region src/ir/sql-foreign-key-ir.ts\n/**\n* Schema IR node for a foreign-key constraint as observed by\n* introspection. The `referencedTable` / `referencedColumns` field\n* names match the introspection vocabulary (`pg_constraint.confkey`,\n* etc.) and intentionally differ from the Contract IR's nested\n* `references: { table, columns }` shape so that the verifier's\n* structural comparison stays explicit about which side it's reading.\n*\n* Implements `DiffableNode` so a foreign key is directly a table's diff-tree\n* child. Foreign keys are frequently unnamed (introspection may not carry a\n* constraint name, and the contract side never invents one), so `id` is\n* derived from the referencing/referenced coordinates rather than `name` —\n* the same tuple that makes two FK constraints the same constraint. This\n* also serves as the comparison key: two FKs with the same coordinates are\n* paired by the differ, and `isEqualTo` then compares the remaining\n* attribute — the referential actions.\n*/\nvar SqlForeignKeyIR = class SqlForeignKeyIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.foreignKey;\n\tcolumns;\n\treferencedTable;\n\treferencedColumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = input.columns;\n\t\tthis.referencedTable = input.referencedTable;\n\t\tthis.referencedColumns = input.referencedColumns;\n\t\tif (input.referencedSchema !== void 0) this.referencedSchema = input.referencedSchema;\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.onDelete !== void 0) this.onDelete = input.onDelete;\n\t\tif (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tconst resolvedReferencedNamespace = input.resolvedReferencedNamespace ?? input.referencedSchema;\n\t\tif (resolvedReferencedNamespace !== void 0) this.resolvedReferencedNamespace = resolvedReferencedNamespace;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\tconst referencedNamespace = this.resolvedReferencedNamespace ?? \"\";\n\t\treturn `foreign-key:${this.columns.join(\",\")}->${referencedNamespace}.${this.referencedTable}(${this.referencedColumns.join(\",\")})`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.foreignKey;\n\t}\n\t/**\n\t* Referential-action comparison with `this` as the expected side, matching\n\t* the relational walk's `getReferentialActionMismatches`: `noAction` is the\n\t* database default and equivalent to an undeclared action, and drift is\n\t* flagged only when the expected side declares a (normalized) action.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlForeignKeyIR\", SqlForeignKeyIR.is);\n\t\treturn referentialActionMatches(this.onDelete, node.onDelete) && referentialActionMatches(this.onUpdate, node.onUpdate);\n\t}\n};\nfunction referentialActionMatches(expected, actual) {\n\tconst normalizedExpected = expected === \"noAction\" ? void 0 : expected;\n\tif (normalizedExpected === void 0) return true;\n\treturn normalizedExpected === (actual === \"noAction\" ? void 0 : actual);\n}\n//#endregion\n//#region src/ir/sql-index-ir.ts\n/**\n* Schema IR node for a secondary index as observed by introspection.\n* Unlike the Contract IR `Index`, the Schema IR carries an explicit\n* `unique` field — introspection sees the underlying index regardless\n* of whether the user expressed it as `@@index` or `@@unique`, and the\n* verifier needs to distinguish them when comparing to the Contract.\n*\n* Implements `DiffableNode` so an index is directly a table's diff-tree\n* child. Indexes are name-identified: every index — contract-derived or\n* introspected — carries its full physical name, and `id` is that name.\n* Names are catalog-unique per schema, so two indexes legitimately sharing\n* one column tuple (a unique index beside a redundant plain index) are two\n* distinct siblings, and expression indexes need no column tuple at all.\n*\n* `isEqualTo` is selected by the receiver (the differ always calls\n* `expected.isEqualTo(actual)`) and delegates to {@link contentEquals} —\n* the single node-owned content relation: both modes compare `unique`\n* strict, `type` and option values through the named normalization seams,\n* and `columns` ordered-strict when both sides carry them; an exact-named\n* receiver (`prefix === undefined`) additionally byte-compares\n* `expression`/`where` (both sides are reprints in the supported flow —\n* normalizing would only mask real drift); a wire-named receiver never\n* compares bodies (the wire-name hash already commits to them).\n*\n* `expression`, `where`, and `unique` are genuine SQL-family attributes —\n* functional and partial indexes are standard SQL that any SQL target may\n* introspect, so the family node must represent them; a target declining\n* to author them is a capability decision, not target-specificity.\n*/\nvar SqlIndexIR = class SqlIndexIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.index;\n\tname;\n\tunique;\n\tconstructor(input) {\n\t\tsuper();\n\t\tconst name = nameOf(input.naming);\n\t\tif (input.columns === void 0 === (input.expression === void 0)) throw new InternalError(`SqlIndexIR \"${name}\": exactly one of columns or expression must be set.`);\n\t\tthis.name = name;\n\t\tthis.unique = input.unique;\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tif (input.columns !== void 0) this.columns = input.columns;\n\t\tif (input.expression !== void 0) this.expression = input.expression;\n\t\tif (input.where !== void 0) this.where = input.where;\n\t\tconst normalizedType = normalizeIndexType(input.type);\n\t\tif (normalizedType !== void 0) this.type = normalizedType;\n\t\tif (input.options !== void 0) this.options = input.options;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tdefineNonEnumerable(this, \"partial\", input.partial);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `index:${this.name}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic from(value) {\n\t\treturn value instanceof SqlIndexIR ? value : new SqlIndexIR(value);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.index;\n\t}\n\t/**\n\t* Mode-selected structural equality — see the class doc. Delegates to the\n\t* single node-owned relation: `columns` compare ordered-strict when both\n\t* sides carry them; an exact receiver (`prefix === undefined`)\n\t* byte-compares `expression ?? ''` and `where ?? ''`; a wire-named receiver\n\t* never compares bodies (the wire-name hash already commits to them).\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlIndexIR\", SqlIndexIR.is);\n\t\treturn this.contentEquals(node, {\n\t\t\tcolumnPresence: \"when-both-defined\",\n\t\t\tbodies: this.prefix !== void 0 ? \"ignored\" : \"verbatim\"\n\t\t});\n\t}\n\t/**\n\t* The single index content-equality relation — every comparer (the differ\n\t* via {@link isEqualTo}, the planner's rename content-pairing) calls this\n\t* with its mode-appropriate strictness rather than growing a parallel\n\t* relation:\n\t*\n\t* - `columnPresence: 'when-both-defined'` (the differ's rule) compares\n\t* the tuples ordered-strict only when both sides carry them — a paired\n\t* node's identity already agreed, so a column node meeting an\n\t* expression node skips the tuple.\n\t* - `columnPresence: 'matching'` (the rename-pairing rule) additionally\n\t* requires presence to agree: a column index never pairs an expression\n\t* index.\n\t* - `bodies: 'verbatim'` byte-compares `expression ?? ''` / `where ?? ''`\n\t* (absent ≡ empty, no normalization — both sides are reprints in the\n\t* supported flow); `bodies: 'ignored'` skips them (wire identity —\n\t* the wire-name hash commits to the content).\n\t*\n\t* `unique` compares strictly; `type` and option VALUES compare through\n\t* the named normalization seams below.\n\t*/\n\tcontentEquals(other, strictness) {\n\t\tconst columnsEqual = strictness.columnPresence === \"matching\" ? this.columns === void 0 === (other.columns === void 0) && (this.columns === void 0 || isArrayEqual(this.columns, other.columns ?? [])) : this.columns === void 0 || other.columns === void 0 || isArrayEqual(this.columns, other.columns);\n\t\tif (!(this.unique === other.unique && normalizeIndexType(this.type) === normalizeIndexType(other.type) && indexOptionsEqual(this.options, other.options) && columnsEqual)) return false;\n\t\tif (strictness.bodies === \"ignored\") return true;\n\t\treturn (this.expression ?? \"\") === (other.expression ?? \"\") && (this.where ?? \"\") === (other.where ?? \"\");\n\t}\n};\n/**\n* The btree-default normalization seam: the default access method (`btree`\n* in every supported SQL target) normalizes to absent. Applied at\n* construction — every derivation path (contract tree, introspection, flat\n* family tree) builds through the class, so both compare sides are\n* symmetric by definition — and again inside\n* {@link SqlIndexIR.contentEquals} so the relation holds for any input.\n* The contract JSON and the wire-name content hash keep the authored\n* spelling: `@@index([a], type: \"btree\")` and `@@index([a])` are distinct\n* wire names — but content-equal after normalization, so a spelling change\n* between them converges as a rename via the planner's content\n* pairing (the hashes differ, so hash pairing never pairs them).\n*/\nfunction normalizeIndexType(type) {\n\treturn type === \"btree\" ? void 0 : type;\n}\n/**\n* Option-bag equality: same key set, values compared through\n* {@link normalizeIndexOptionValue} — Postgres introspection returns\n* reloptions values as catalog-reprint strings (`'70'`, `'on'`) while\n* contract option leaves are typed (number, boolean, string).\n*/\nfunction indexOptionsEqual(a, b) {\n\tconst aKeys = a ? Object.keys(a).sort() : [];\n\tconst bKeys = b ? Object.keys(b).sort() : [];\n\tif (aKeys.length !== bKeys.length) return false;\n\tfor (let i = 0; i < aKeys.length; i += 1) if (aKeys[i] !== bKeys[i]) return false;\n\tif (aKeys.length === 0) return true;\n\tfor (const key of aKeys) if (normalizeIndexOptionValue(a?.[key]) !== normalizeIndexOptionValue(b?.[key])) return false;\n\treturn true;\n}\n//#endregion\n//#region src/ir/sql-unique-ir.ts\n/**\n* Schema IR node for a table-level unique constraint as observed by\n* introspection.\n*\n* Implements `DiffableNode` so a unique constraint is directly a table's\n* diff-tree child. Unique constraints are frequently unnamed, so `id` is\n* derived from the column tuple rather than `name` — the column tuple is\n* also what makes two unique constraints the same constraint, so it doubles\n* as the pairing key. There are no further attributes to compare once\n* columns are equal (the differ pairs on `id`), so `isEqualTo` is identity.\n*/\nvar SqlUniqueIR = class SqlUniqueIR extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.unique;\n\tcolumns;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.columns = [...input.columns];\n\t\tif (input.name !== void 0) this.name = input.name;\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `unique:${this.columns.join(\",\")}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === RelationalSchemaNodeKind.unique;\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tassertNode(node, \"SqlUniqueIR\", SqlUniqueIR.is);\n\t\treturn this.id === node.id;\n\t}\n};\n//#endregion\n//#region src/ir/sql-table-ir.ts\n/**\n* Schema IR node for a single table as observed by introspection.\n*\n* Unlike the Contract IR `StorageTable`, this carries the table's\n* `name` — introspection queries return tables as arrays and the\n* verifier keys them into `SqlSchemaIR.tables` afterwards, so the name\n* stays on the table object for downstream call sites that walk\n* `Object.values(schema.tables)`.\n*\n* The constructor normalises nested IR-class fields so downstream\n* walks see a uniform AST regardless of whether the input was a\n* plain-data literal (from introspection) or already-constructed\n* class instances.\n*\n* Implements `DiffableNode` so a flat (single-schema) tree is directly\n* diffable: `id` is the table name; `isEqualTo` is identity (the table's\n* structural drift is entirely expressed by its children); `children()`\n* yields every column, the primary key (when present), every foreign key,\n* unique, index, and check constraint — the same composition and order as\n* the Postgres table node, minus policies.\n*/\nvar SqlTableIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.table;\n\tname;\n\tcolumns;\n\tforeignKeys;\n\tuniques;\n\tindexes;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map(SqlIndexIR.from));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = PrimaryKey.from(input.primaryKey);\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map(SqlCheckConstraintIR.from));\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [\n\t\t\t...Object.values(this.columns),\n\t\t\t...this.primaryKey ? [this.primaryKey] : [],\n\t\t\t...this.foreignKeys,\n\t\t\t...this.uniques,\n\t\t\t...this.indexes,\n\t\t\t...this.checks ?? []\n\t\t];\n\t}\n};\n//#endregion\n//#region src/ir/sql-schema-ir.ts\n/**\n* Root Schema IR node representing the complete database schema as\n* observed by introspection. Target-agnostic; used by both verifiers\n* (compare against intended Contract storage) and migration planners\n* (derive operations needed to reconcile).\n*\n* The constructor normalises nested `SqlTableIR` instances so\n* downstream walks see a uniform AST regardless of whether the input\n* was a plain-data literal or already-constructed class instances.\n*\n* Implements `DiffableNode` as the root of a flat (single-schema) diff\n* tree: `id` is the fixed sentinel `'database'` (roots have no siblings),\n* `isEqualTo` is identity (a container has no own attributes), and\n* `children()` yields the table nodes.\n*/\nvar SqlSchemaIR = class extends SqlSchemaIRNode {\n\tnodeKind = RelationalSchemaNodeKind.schema;\n\ttables;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tables = Object.freeze(Object.fromEntries(Object.entries(input.tables).map(([key, t]) => [key, t instanceof SqlTableIR ? t : new SqlTableIR(t)])));\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"database\";\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn Object.values(this.tables);\n\t}\n};\n//#endregion\nexport { SqlForeignKeyIR as a, SqlCheckConstraintIR as c, assertNode as d, defineNonEnumerable as f, relationalNodeGranularity as h, SqlIndexIR as i, PrimaryKey as l, relationalNodeEntityKind as m, SqlTableIR as n, SqlColumnIR as o, RelationalSchemaNodeKind as p, SqlUniqueIR as r, SqlColumnDefaultIR as s, SqlSchemaIR as t, SqlSchemaIRNode as u };\n\n//# sourceMappingURL=types-4YenawkP.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,2BAA2B;CAChC,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,OAAO;AACR;;;;;;;;;;;AAWA,MAAM,8BAA8B;EAClC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,SAAS;EAClC,yBAAyB,gBAAgB;EACzC,yBAAyB,aAAa;EACtC,yBAAyB,aAAa;EACtC,yBAAyB,SAAS;EAClC,yBAAyB,QAAQ;EACjC,yBAAyB,QAAQ;AACnC;AACA,SAAS,2BAA2B,UAAU;CAC7C,OAAO,OAAO,OAAO,6BAA6B,QAAQ;AAC3D;;;;;;;AAOA,SAAS,0BAA0B,UAAU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