@prisma/orm-target-postgres 8.0.0-rc.17-dev.11 → 8.0.0-rc.17-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__runtime.mjs +1 -1
- package/dist/{authoring-BsVnEibY-DEWnQRiF.mjs → authoring-kZOSollq-DP0v31A_.mjs} +8 -5
- package/dist/authoring-kZOSollq-DP0v31A_.mjs.map +1 -0
- package/dist/{control-KIoUTWJ_.mjs → control-CM6c5oIC.mjs} +37 -49
- package/dist/control-CM6c5oIC.mjs.map +1 -0
- package/dist/{descriptor-meta-DkzkByC8-WIm-Vvrd.mjs → descriptor-meta-Dekti3e8-DLSepvAq.mjs} +3 -3
- package/dist/{descriptor-meta-DkzkByC8-WIm-Vvrd.mjs.map → descriptor-meta-Dekti3e8-DLSepvAq.mjs.map} +1 -1
- package/dist/{infer-psl-contract-D0iF_YRT-DwW3Imk5.mjs → infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs} +25 -14
- package/dist/infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs.map +1 -0
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{planner-an3B45Ri-2-1c8dYN.mjs → planner-BRKlBIQL-UpgxpNL9.mjs} +4 -4
- package/dist/{planner-an3B45Ri-2-1c8dYN.mjs.map → planner-BRKlBIQL-UpgxpNL9.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-LNElx7_r-B4yTRRyt.mjs → planner-produced-postgres-migration-DYSPvP11-C6kel47a.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-LNElx7_r-B4yTRRyt.mjs.map → planner-produced-postgres-migration-DYSPvP11-C6kel47a.mjs.map} +1 -1
- package/dist/{postgres-contract-view-BpmiHSDZ-C6ntn6T7.mjs → postgres-contract-view-6xGfZyGS-C58Bint3.mjs} +3 -3
- package/dist/{postgres-contract-view-BpmiHSDZ-C6ntn6T7.mjs.map → postgres-contract-view-6xGfZyGS-C58Bint3.mjs.map} +1 -1
- package/dist/{postgres-migration-BtlvhcXs-UjWm8cAb.mjs → postgres-migration-Cg6Rwgok--hvAHrSo.mjs} +3 -3
- package/dist/{postgres-migration-BtlvhcXs-UjWm8cAb.mjs.map → postgres-migration-Cg6Rwgok--hvAHrSo.mjs.map} +1 -1
- package/dist/{prisma7-binding-Dq-vT_9_.mjs → prisma7-binding-DQlvZyAM.mjs} +4 -4
- package/dist/{prisma7-binding-Dq-vT_9_.mjs.map → prisma7-binding-DQlvZyAM.mjs.map} +1 -1
- package/dist/target.mjs +7 -7
- package/dist/target__control.mjs +3 -3
- package/dist/target__migration.mjs +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +2 -2
- package/dist/target__runtime.mjs.map +1 -1
- package/package.json +9 -9
- package/dist/authoring-BsVnEibY-DEWnQRiF.mjs.map +0 -1
- package/dist/control-KIoUTWJ_.mjs.map +0 -1
- package/dist/infer-psl-contract-D0iF_YRT-DwW3Imk5.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-an3B45Ri-2-1c8dYN.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-an3B45Ri.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-b746rtzf.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-CByLrBg6.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-DbDoLxrp.mjs\";\nimport { A as RenameConstraintCall, C as DropNativeEnumTypeCall, E as DropTableCall, M as RenamePostgresRlsPolicyCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from \"./op-factory-call-BfGiIbUO.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { a as renderRenameTableCall, c as pairCheckRenames, i as renameTableByHandStatements, l as pairIndexRenames, n as postgresColumnRenameCall, o as createWorkingSchema, r as postgresTableRenameCall, s as postgresSchemaTables, u as postgresContractToSchema } from \"./postgres-migration-BtlvhcXs.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-LNElx7_r.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventCalls, planStatements, plannerFailure, sqlTypeLookupsOf, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from \"@internal/family-sql/control\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/core/migrations/constraint-name-renames.ts\n/** The constraint of `nextNodes` the diff pairs with `node` and finds unchanged. */\nfunction unchangedIn(node, nextNodes) {\n\treturn nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));\n}\n/**\n* The renames of the primary key, unique constraints and foreign keys of one table that the end tree keeps otherwise unchanged but names differently. A constraint's name is its stated name, or the one the planner derives from its table; a start tree read from the database states every name. A constraint whose start and end names differ is renamed to the end name. The diff never compares constraint names, so without these the database keeps the old name. A database may already have the new name, as when Prisma 7 created it and the contract only now states it; the rename's postcheck then holds before it runs, and the runner skips it.\n*/\nfunction constraintNameRenames(input) {\n\tconst { schemaName, from, to, previous, next } = input;\n\tconst rename = (kind, oldName, unchanged, derivedName) => {\n\t\tif (unchanged === void 0) return [];\n\t\tconst newName = unchanged.name ?? derivedName;\n\t\treturn oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];\n\t};\n\tconst primaryKey = previous.primaryKey === void 0 ? [] : rename(\"primaryKey\", previous.primaryKey.name ?? defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to));\n\tconst uniques = previous.uniques.flatMap((unique) => rename(\"unique\", unique.name ?? defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));\n\tconst foreignKeys = previous.foreignKeys.flatMap((fk) => rename(\"foreignKey\", fk.name ?? defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* The constraint renames of a plan: {@link constraintNameRenames} for every table the start tree and the end contract both have, with the start tree as the plan's rename statements left it. The start tree comes from the start contract for `migration plan` and from the database for `db update`, so a database Prisma 8 created under derived names is renamed too once the contract states other names.\n*/\nfunction plannedConstraintNameRenames(options) {\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return [];\n\tPostgresDatabaseSchemaNode.assert(options.schema);\n\tconst startTablesBySchema = new Map(Object.values(options.schema.namespaces).map((namespace) => [namespace.schemaName, namespace.tables]));\n\tconst contract = options.contract;\n\tconst end = postgresContractToSchema(contract, options.frameworkComponents);\n\treturn Object.values(end.namespaces).flatMap((namespace) => {\n\t\tconst startTables = startTablesBySchema.get(namespace.schemaName) ?? {};\n\t\tconst schemaName = resolveNamespaceIdForDdlSchema(contract, namespace.schemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : namespace.schemaName;\n\t\treturn Object.entries(namespace.tables).flatMap(([tableName, next]) => {\n\t\t\tconst previous = startTables[tableName];\n\t\t\treturn previous === void 0 ? [] : constraintNameRenames({\n\t\t\t\tschemaName,\n\t\t\t\tfrom: tableName,\n\t\t\t\tto: tableName,\n\t\t\t\tprevious,\n\t\t\t\tnext\n\t\t\t});\n\t\t});\n\t});\n}\n//#endregion\n//#region src/core/migrations/operation-subjects.ts\nfunction storageNamespaceId(locator, schemaName) {\n\treturn schemaName === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : resolveNamespaceIdForDdlSchema(locator.contract, schemaName);\n}\nfunction qualified(schemaName, name) {\n\treturn schemaName === UNBOUND_NAMESPACE_ID ? name : `${schemaName}.${name}`;\n}\nfunction target(locator, schemaName, table, column) {\n\treturn {\n\t\tstorageName: qualified(schemaName, column === void 0 ? table : `${table}.${column}`),\n\t\ttable: {\n\t\t\tnamespaceId: storageNamespaceId(locator, schemaName),\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction rawSqlTarget(locator, call) {\n\tconst details = call.op.target.details;\n\tif (details === void 0) return {\n\t\tstorageName: call.op.id,\n\t\ttable: void 0\n\t};\n\tif (details.objectType === \"table\") return target(locator, details.schema, details.name, void 0);\n\tif (details.objectType === \"column\" && details.table !== void 0) return target(locator, details.schema, details.table, details.name);\n\treturn {\n\t\tstorageName: storageNameOfOperation(call.op),\n\t\ttable: void 0\n\t};\n}\nfunction knownTarget(locator, call) {\n\tif (call instanceof DropTableCall) return target(locator, call.schemaName, call.tableName, void 0);\n\tif (call instanceof DropColumnCall || call instanceof AlterColumnTypeCall) return target(locator, call.schemaName, call.tableName, call.columnName);\n\tif (call instanceof RawSqlCall) return rawSqlTarget(locator, call);\n\tconst fieldEvent = locator.fieldEvents.get(call);\n\treturn fieldEvent === void 0 ? void 0 : fieldEventStorage(fieldEvent);\n}\n/**\n* A policy's identity across a replacement: its name, or the prefix of a generated (wire) name,\n* whose hash changes with the policy's body.\n*/\nfunction policyKey(schemaName, tableName, policyName) {\n\treturn JSON.stringify([\n\t\tschemaName,\n\t\ttableName,\n\t\tparseWireName(policyName)?.prefix ?? policyName\n\t]);\n}\n/**\n* The policies the plan creates. A drop of one of them, by name or by generated-name prefix, is\n* half of a replacement, which leaves a policy in place, so it widens no access.\n*/\nfunction createdPolicies(calls) {\n\treturn new Set(calls.flatMap((call) => call instanceof CreatePostgresRlsPolicyCall ? [policyKey(call.schemaName, call.tableName, call.policy.name)] : []));\n}\nfunction accessWideningOf(locator, call, replaced) {\n\tif (call instanceof DisableRowLevelSecurityCall) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: true\n\t}];\n\tif (call instanceof DropPostgresRlsPolicyCall && !replaced.has(policyKey(call.schemaName, call.tableName, call.policyName))) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: false\n\t}];\n\treturn [];\n}\nfunction operationCountOf(call) {\n\treturn \"companions\" in call && Array.isArray(call.companions) ? 1 + call.companions.length : 1;\n}\n/** What each call of a Postgres plan loses, and whose access it widens. */\nfunction postgresCallSubjects(calls, locator) {\n\tconst replaced = createdPolicies(calls);\n\tconst destructive = calls.filter((call) => call.operationClass === \"destructive\");\n\tconst known = new Map(destructive.map((call) => [call, knownTarget(locator, call)]));\n\tconst unknownNames = unknownCallNames(destructive.filter((call) => known.get(call) === void 0));\n\treturn calls.map((call) => {\n\t\tconst lossTarget = known.get(call);\n\t\tconst unknownName = unknownNames.get(call);\n\t\treturn {\n\t\t\toperationCount: operationCountOf(call),\n\t\t\tdataLoss: lossTarget !== void 0 ? [lossTarget] : unknownName !== void 0 ? [{\n\t\t\t\tstorageName: unknownName,\n\t\t\t\ttable: void 0\n\t\t\t}] : [],\n\t\t\taccessWidening: accessWideningOf(locator, call, replaced)\n\t\t};\n\t});\n}\n//#endregion\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction partitionPostgresCallsByControlPolicy(calls, contract) {\n\treturn partitionCallsByControlPolicy({\n\t\tcalls,\n\t\tcontract,\n\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, contract),\n\t\tresolveFactoryName: (call) => call.factoryName\n\t});\n}\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst statements = this.planStatements(options, options.schema);\n\t\tif (!statements.ok) return plannerFailure([statements.failure]);\n\t\tconst { schema } = statements.value;\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\n\t\tconst relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));\n\t\tconst strict = options.policy.allowedOperationClasses.includes(\"widening\") || options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(relationalDiffIssues), options.ownership, options.contract);\n\t\tconst gated = strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\");\n\t\tconst schemaIssues = [...verifyPostgresNamespacePresence({\n\t\t\tcontract: options.contract,\n\t\t\tschema\n\t\t}), ...gated];\n\t\tconst indexRenames = pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst types = sqlTypeLookupsOf(options.frameworkComponents);\n\t\tconst storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(schema, schemaName);\n\t\tconst issuePartition = partitionIssuesByControlPolicy({\n\t\t\tissues: plannableIssues,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t});\n\t\tconst caseChangeConflicts = detectTableNameCaseChanges({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttableOf: (issue) => {\n\t\t\t\tconst node = issueNode(issue);\n\t\t\t\treturn node !== void 0 && PostgresTableSchemaNode.is(node) ? node : void 0;\n\t\t\t},\n\t\t\tnamespaceIdOf: (issue) => resolveNamespaceIdForDdlSchema(options.contract, issueSchemaName(issue) ?? schemaName),\n\t\t\trenameByHandStatements: (rename) => renameTableByHandStatements(options.contract, rename),\n\t\t\trenameTableCall: renderRenameTableCall,\n\t\t\tcontract: options.contract,\n\t\t\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID\n\t\t});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\ttypes,\n\t\t\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\n\t\t});\n\t\tconst schemaDiff = this.planPostgresSchemaDiff(options, policyDiffIssues);\n\t\tif (!result.ok || schemaDiff.conflicts.length > 0) return plannerFailure([...result.ok ? [] : result.failure, ...schemaDiff.conflicts]);\n\t\tconst renamePartition = partitionPostgresCallsByControlPolicy([\n\t\t\t...indexRenames.calls,\n\t\t\t...checkRenames.calls,\n\t\t\t...plannedConstraintNameRenames({\n\t\t\t\t...options,\n\t\t\t\tschema\n\t\t\t})\n\t\t], options.contract);\n\t\tconst schemaDiffPartition = partitionPostgresCallsByControlPolicy(schemaDiff.calls, options.contract);\n\t\tconst fieldEventCalls = planFieldEventCalls({\n\t\t\tpriorContract: options.origin === null ? null : options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks,\n\t\t\ttableRenames: statements.value.tableRenames,\n\t\t\tcolumnRenames: statements.value.columnRenames\n\t\t});\n\t\tconst fieldEventPartition = partitionPostgresCallsByControlPolicy(blindCast(fieldEventCalls.map(({ call }) => call)), options.contract);\n\t\tconst ordered = movePolicyDropsBeforeBlockedDdl(result.value.calls, schemaDiffPartition.kept);\n\t\tconst calls = [\n\t\t\t...statements.value.calls,\n\t\t\t...ordered.structural,\n\t\t\t...renamePartition.kept,\n\t\t\t...ordered.policyCalls,\n\t\t\t...fieldEventPartition.kept\n\t\t];\n\t\tconst seenWarnings = /* @__PURE__ */ new Set();\n\t\tconst warnings = [\n\t\t\t...issuePartition.suppressions,\n\t\t\t...renamePartition.suppressions,\n\t\t\t...schemaDiff.suppressions,\n\t\t\t...schemaDiffPartition.suppressions,\n\t\t\t...fieldEventPartition.suppressions\n\t\t].map((record) => renderPostgresSuppression(record, options.contract)).filter((warning) => {\n\t\t\tconst key = JSON.stringify(warning);\n\t\t\tif (seenWarnings.has(key)) return false;\n\t\t\tseenWarnings.add(key);\n\t\t\treturn true;\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderablePostgresMigration(calls, {\n\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\tappliedStatements: statements.value.appliedStatements,\n\t\t\t...subjectsOfCalls(postgresCallSubjects(calls, {\n\t\t\t\tcontract: options.fromContract ?? options.contract,\n\t\t\t\tfieldEvents: new Map(fieldEventCalls.map((fieldEvent) => [fieldEvent.call, fieldEvent]))\n\t\t\t}), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\tstatements: options.statements\n\t\t\t}),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Maps the RLS policy findings of the one combined tree diff\n\t* (`buildPostgresPlanDiff`, already ownership-filtered) into\n\t* `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops — a\n\t* `not-equal` finding (an exact-named policy whose content drifted)\n\t* becomes drop + create, or a disallowed-call conflict when the policy\n\t* forbids the drop, which is `widening`. It\n\t* does not re-diff — it consumes exactly the policy-node subset of the\n\t* shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE\n\t* ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`\n\t* attribute diff on the relational side.\n\t*\n\t* Rename post-pass (the index pass's structure): hash pairing pairs a\n\t* `not-found` and a `not-expected` policy on the SAME table whose\n\t* wire-name content hashes match but prefixes differ (prefix-only rename);\n\t* content pairing then pairs remaining wire-named-missing policies against remaining\n\t* extras of any name shape by verbatim content (the node-owned `contentEquals` —\n\t* exact→wire adoption). Multi-candidate groups pair deterministically\n\t* by sorted name; leftovers proceed as create/drop; an exact-named\n\t* missing policy never content-pairs.\n\t*\n\t* The pairing runs only when the policy allows `widening` (rename's\n\t* class). Without it (db-init's additive-only set), pairing degrades\n\t* deliberately to the additive half: the new name is CREATEd and the old\n\t* policy survives live until a plan that allows `widening` runs —\n\t* emitting an ungated widening rename would only fail at the runner's\n\t* class re-enforcement.\n\t*/\n\tplanPostgresSchemaDiff(options, filteredDiffIssues) {\n\t\tconst allowsWidening = options.policy.allowedOperationClasses.includes(\"widening\");\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tconst changed = [];\n\t\tfor (const issue of filteredDiffIssues) if (issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tchanged.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-found\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tmissing.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-expected\") {\n\t\t\tconst actual = issue.actual;\n\t\t\tPostgresPolicySchemaNode.assert(actual);\n\t\t\textra.push({\n\t\t\t\tnode: actual,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, actual.namespaceId)\n\t\t\t});\n\t\t}\n\t\tconst calls = [];\n\t\tconst conflicts = [];\n\t\tconst suppressions = [];\n\t\tconst renamedExtras = /* @__PURE__ */ new Set();\n\t\tconst renamedMissing = /* @__PURE__ */ new Set();\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.schemaForTable,\n\t\t\tfinding.node.tableName,\n\t\t\thash\n\t\t]);\n\t\tif (allowsWidening) {\n\t\t\tconst extrasByGroup = /* @__PURE__ */ new Map();\n\t\t\tfor (const finding of extra) {\n\t\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\t\tconst group = extrasByGroup.get(key) ?? [];\n\t\t\t\tgroup.push(finding);\n\t\t\t\textrasByGroup.set(key, group);\n\t\t\t}\n\t\t\tfor (const group of extrasByGroup.values()) group.sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tconst sortedMissing = [...missing].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst candidate = extrasByGroup.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t\tconst sortedExtras = [...extra].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tif (renamedMissing.has(missingFinding)) continue;\n\t\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\t\tconst candidate = sortedExtras.find((extraFinding) => !renamedExtras.has(extraFinding) && extraFinding.schemaForTable === missingFinding.schemaForTable && extraFinding.node.tableName === missingFinding.node.tableName && missingFinding.node.contentEquals(extraFinding.node));\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t}\n\t\tfor (const finding of changed) {\n\t\t\tconst replacement = {\n\t\t\t\tdrop: new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name),\n\t\t\t\tcreate: new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node))\n\t\t\t};\n\t\t\tconst graded = gradePolicyReplacement(replacement, options.contract, options.policy.allowedOperationClasses);\n\t\t\tif (graded.disposition === \"suppress\") {\n\t\t\t\tsuppressions.push(graded.record);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (graded.disposition === \"conflict\") {\n\t\t\t\tconflicts.push(graded.conflict);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcalls.push(replacement.drop);\n\t\t\tcalls.push(replacement.create);\n\t\t}\n\t\tfor (const finding of missing) {\n\t\t\tif (renamedMissing.has(finding)) continue;\n\t\t\tcalls.push(new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node)));\n\t\t}\n\t\tif (allowsWidening) for (const finding of extra) {\n\t\t\tif (renamedExtras.has(finding)) continue;\n\t\t\tcalls.push(new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconflicts,\n\t\t\tsuppressions\n\t\t};\n\t}\n\t/**\n\t* Plans the statements against a working copy of `schema`, in order, so each rename's companions\n\t* are computed against the schema the earlier statements left. The diff then runs on that schema.\n\t*/\n\tplanStatements(options, schema) {\n\t\tconst working = createWorkingSchema(schema);\n\t\tconst planned = planStatements({\n\t\t\tstatements: options.statements,\n\t\t\tfromContract: options.fromContract,\n\t\t\tcontract: options.contract,\n\t\t\tpolicy: options.policy,\n\t\t\ttarget: {\n\t\t\t\ttables: () => postgresSchemaTables(working.current, options.contract),\n\t\t\t\trenameTableCall: (rename) => postgresTableRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\trenameColumnCall: (rename) => postgresColumnRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\tapply: (call) => working.apply(call),\n\t\t\t\trenderTableRename: renderRenameTableCall,\n\t\t\t\ttableRenameByHand: (rename) => renameTableByHandStatements(options.contract, rename)\n\t\t\t}\n\t\t});\n\t\tif (!planned.ok) return planned;\n\t\treturn ok({\n\t\t\t...planned.value,\n\t\t\tschema: working.current\n\t\t});\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n};\n/**\n* A diff issue whose node is an RLS policy — the structural half of the one\n* combined tree diff, routed to `planPostgresSchemaDiff` instead of\n* `planIssues`.\n*/\nfunction isPolicyDiffIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && PostgresPolicySchemaNode.is(node);\n}\n/**\n* Postgres refuses these statements while a policy uses the object they touch:\n* - dropping a column (2BP01) or changing its type (0A000);\n* - dropping a table that a policy on another table uses (2BP01); a table's own policies go with it;\n* - dropping a native enum type (2BP01);\n* - a destructive codec type operation (a `RawSqlCall` on a type), such as dropping or rebuilding\n* the type (2BP01) or changing a composite type's attribute type (0A000). Additive and widening\n* type operations, such as adding an enum value or renaming the type, go through.\n*\n* So every policy drop moves to just before the first structural call that a policy can block.\n* Without such a call, the policy calls keep their place after the structural calls.\n*/\nfunction movePolicyDropsBeforeBlockedDdl(structural, policyCalls) {\n\tconst firstBlockable = structural.findIndex(policyCanBlock);\n\tif (firstBlockable === -1) return {\n\t\tstructural,\n\t\tpolicyCalls\n\t};\n\tconst isPolicyDrop = (call) => call instanceof DropPostgresRlsPolicyCall;\n\treturn {\n\t\tstructural: [\n\t\t\t...structural.slice(0, firstBlockable),\n\t\t\t...policyCalls.filter(isPolicyDrop),\n\t\t\t...structural.slice(firstBlockable)\n\t\t],\n\t\tpolicyCalls: policyCalls.filter((call) => !isPolicyDrop(call))\n\t};\n}\nfunction policyCanBlock(call) {\n\tif (call instanceof RawSqlCall) return call.operationClass === \"destructive\" && call.op.target.details?.objectType === \"type\";\n\treturn call instanceof DropColumnCall || call instanceof AlterColumnTypeCall || call instanceof DropTableCall || call instanceof DropNativeEnumTypeCall;\n}\n/**\n* Drops a `not-expected` issue when it is a whole extra storage entity (a table\n* or a native enum) that some space in the composition owns. Each such node\n* yields its own storage coordinate (see {@link postgresNodeStorageCoordinate}),\n* so `declaresEntity` answers over the whole composition on one uniform\n* coordinate: a positive answer means a sibling owns this entity here — leave\n* it; a negative answer means a genuine orphan — drop it. A node with no storage\n* coordinate (a namespace, or a deeper column/constraint drift on an owned\n* table) is this space's own and is always kept. No oracle ⇒ keep everything.\n*/\nfunction retainUnownedExtras(issues, ownership, contract) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0) return true;\n\t\tconst coordinate = postgresNodeStorageCoordinate(node);\n\t\tif (coordinate === void 0) return true;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\n\t});\n}\n/**\n* Returns the one namespace node the relational strategy layer probes for\n* live-table existence and reads codec-hook context off — the namespace\n* matching the planner's resolved schema name, or the first namespace when\n* none matches. `undefined` when the tree has no namespaces, so the strategy\n* context uses its empty-schema default.\n*\n* The relational strategies key tables by bare name, so they can only probe one\n* namespace at a time; probing across every namespace at once is future work.\n*\n* Returns the real `PostgresNamespaceSchemaNode` reference rather than a\n* projection: `storageTypePlanCallStrategy` hands this same value to codec\n* `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific\n* `nativeEnums` field off it (via `PostgresNamespaceSchemaNode.is`) to decide\n* whether a native enum type already exists — a projection that only copies\n* `tables` would silently drop that signal. `StrategyContext.schema`'s\n* declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't\n* capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`\n* in the family's relational walk already treats a namespace node as a\n* structurally-`SqlSchemaIR`-shaped value.\n*/\nfunction relationalNamespaceNode(schema, schemaName) {\n\tconst namespaceNodes = Object.values(schema.namespaces);\n\tconst namespaceNode = namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];\n\tif (namespaceNode === void 0) return void 0;\n\treturn blindCast(namespaceNode);\n}\n/**\n* Grades a {@link PolicyReplacement} as one unit against the table's\n* control policy, BEFORE the pair becomes calls or a conflict. This runs\n* ahead of `partitionCallsByControlPolicy`, which later re-grades the\n* surviving calls per-call — a no-op here, since only managed units\n* survive this grading.\n*\n* A replacement is deliberately STRICTER than the shared\n* `callAllowedUnderControlPolicy` rule: `tolerated` permits whole-object\n* creation, but a replacement's create is the second half of a repair of\n* an existing object, not a new object — so ANY non-managed control\n* (external, observed, tolerated) suppresses the whole unit. Drift on an\n* object the plan does not manage is reported, never repaired; the\n* suppression subject names the drifted policy (`rlsPolicy`) so the\n* report says which policy drifted, matching the conflict path's\n* `location.rlsPolicy`.\n*/\nfunction gradePolicyReplacement(replacement, contract, allowedOperationClasses) {\n\tconst subject = resolvePostgresCallControlPolicySubject(replacement.drop, contract);\n\tconst controlPolicy = controlPolicyForCall(subject, contract.defaultControlPolicy);\n\tif (controlPolicy !== \"managed\") return {\n\t\tdisposition: \"suppress\",\n\t\trecord: {\n\t\t\tsubject: subject === void 0 ? void 0 : {\n\t\t\t\t...subject,\n\t\t\t\trlsPolicy: replacement.drop.policyName\n\t\t\t},\n\t\t\tpolicy: controlPolicy,\n\t\t\tfactoryName: void 0,\n\t\t\tcreatesNewObject: false\n\t\t}\n\t};\n\tif (!allowedOperationClasses.includes(\"widening\")) return {\n\t\tdisposition: \"conflict\",\n\t\tconflict: conflictForDisallowedCall(replacement.drop, allowedOperationClasses)\n\t};\n\treturn { disposition: \"plan\" };\n}\n/**\n* Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`\n* carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole\n* entity, `namespaceId` included). This reconstructs rather than looking the\n* original up in the contract on purpose: the diff node's `namespaceId` is the\n* *resolved DDL schema* (set when the expected tree was built), which is the\n* value the emitted op must carry; the contract-stored entity holds the raw,\n* pre-resolution coordinate, so a lookup would change the migration output.\n*/\nfunction policyNodeToContractPolicy(node) {\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(node.name, node.prefix),\n\t\ttableName: node.tableName,\n\t\tnamespaceId: node.namespaceId,\n\t\toperation: node.operation,\n\t\troles: [...node.roles],\n\t\tusing: node.using,\n\t\twithCheck: node.withCheck,\n\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AM,uBAAuB;CAC9E;CACA,OAAO,EAAE,aAAa,OAAO;AAC9B;;;;;;;;;;AAUA,SAAS,2BAA2B,MAAM;CACzC,OAAO,IAAI,kBAAkB;EAC5B,QAAQ,SAAS,KAAK,MAAM,KAAK,MAAM;EACvC,WAAW,KAAK;EAChB,aAAa,KAAK;EAClB,WAAW,KAAK;EAChB,OAAO,CAAC,GAAG,KAAK,KAAK;EACrB,OAAO,KAAK;EACZ,WAAW,KAAK;EAChB,YAAY,KAAK;CAClB,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"planner-BRKlBIQL-UpgxpNL9.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-BRKlBIQL.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-b746rtzf.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-CByLrBg6.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-DbDoLxrp.mjs\";\nimport { A as RenameConstraintCall, C as DropNativeEnumTypeCall, E as DropTableCall, M as RenamePostgresRlsPolicyCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from \"./op-factory-call-BfGiIbUO.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { a as renderRenameTableCall, c as pairCheckRenames, i as renameTableByHandStatements, l as pairIndexRenames, n as postgresColumnRenameCall, o as createWorkingSchema, r as postgresTableRenameCall, s as postgresSchemaTables, u as postgresContractToSchema } from \"./postgres-migration-Cg6Rwgok.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-DYSPvP11.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventCalls, planStatements, plannerFailure, sqlTypeLookupsOf, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from \"@internal/family-sql/control\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/core/migrations/constraint-name-renames.ts\n/** The constraint of `nextNodes` the diff pairs with `node` and finds unchanged. */\nfunction unchangedIn(node, nextNodes) {\n\treturn nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));\n}\n/**\n* The renames of the primary key, unique constraints and foreign keys of one table that the end tree keeps otherwise unchanged but names differently. A constraint's name is its stated name, or the one the planner derives from its table; a start tree read from the database states every name. A constraint whose start and end names differ is renamed to the end name. The diff never compares constraint names, so without these the database keeps the old name. A database may already have the new name, as when Prisma 7 created it and the contract only now states it; the rename's postcheck then holds before it runs, and the runner skips it.\n*/\nfunction constraintNameRenames(input) {\n\tconst { schemaName, from, to, previous, next } = input;\n\tconst rename = (kind, oldName, unchanged, derivedName) => {\n\t\tif (unchanged === void 0) return [];\n\t\tconst newName = unchanged.name ?? derivedName;\n\t\treturn oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];\n\t};\n\tconst primaryKey = previous.primaryKey === void 0 ? [] : rename(\"primaryKey\", previous.primaryKey.name ?? defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to));\n\tconst uniques = previous.uniques.flatMap((unique) => rename(\"unique\", unique.name ?? defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));\n\tconst foreignKeys = previous.foreignKeys.flatMap((fk) => rename(\"foreignKey\", fk.name ?? defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* The constraint renames of a plan: {@link constraintNameRenames} for every table the start tree and the end contract both have, with the start tree as the plan's rename statements left it. The start tree comes from the start contract for `migration plan` and from the database for `db update`, so a database Prisma 8 created under derived names is renamed too once the contract states other names.\n*/\nfunction plannedConstraintNameRenames(options) {\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return [];\n\tPostgresDatabaseSchemaNode.assert(options.schema);\n\tconst startTablesBySchema = new Map(Object.values(options.schema.namespaces).map((namespace) => [namespace.schemaName, namespace.tables]));\n\tconst contract = options.contract;\n\tconst end = postgresContractToSchema(contract, options.frameworkComponents);\n\treturn Object.values(end.namespaces).flatMap((namespace) => {\n\t\tconst startTables = startTablesBySchema.get(namespace.schemaName) ?? {};\n\t\tconst schemaName = resolveNamespaceIdForDdlSchema(contract, namespace.schemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : namespace.schemaName;\n\t\treturn Object.entries(namespace.tables).flatMap(([tableName, next]) => {\n\t\t\tconst previous = startTables[tableName];\n\t\t\treturn previous === void 0 ? [] : constraintNameRenames({\n\t\t\t\tschemaName,\n\t\t\t\tfrom: tableName,\n\t\t\t\tto: tableName,\n\t\t\t\tprevious,\n\t\t\t\tnext\n\t\t\t});\n\t\t});\n\t});\n}\n//#endregion\n//#region src/core/migrations/operation-subjects.ts\nfunction storageNamespaceId(locator, schemaName) {\n\treturn schemaName === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : resolveNamespaceIdForDdlSchema(locator.contract, schemaName);\n}\nfunction qualified(schemaName, name) {\n\treturn schemaName === UNBOUND_NAMESPACE_ID ? name : `${schemaName}.${name}`;\n}\nfunction target(locator, schemaName, table, column) {\n\treturn {\n\t\tstorageName: qualified(schemaName, column === void 0 ? table : `${table}.${column}`),\n\t\ttable: {\n\t\t\tnamespaceId: storageNamespaceId(locator, schemaName),\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction rawSqlTarget(locator, call) {\n\tconst details = call.op.target.details;\n\tif (details === void 0) return {\n\t\tstorageName: call.op.id,\n\t\ttable: void 0\n\t};\n\tif (details.objectType === \"table\") return target(locator, details.schema, details.name, void 0);\n\tif (details.objectType === \"column\" && details.table !== void 0) return target(locator, details.schema, details.table, details.name);\n\treturn {\n\t\tstorageName: storageNameOfOperation(call.op),\n\t\ttable: void 0\n\t};\n}\nfunction knownTarget(locator, call) {\n\tif (call instanceof DropTableCall) return target(locator, call.schemaName, call.tableName, void 0);\n\tif (call instanceof DropColumnCall || call instanceof AlterColumnTypeCall) return target(locator, call.schemaName, call.tableName, call.columnName);\n\tif (call instanceof RawSqlCall) return rawSqlTarget(locator, call);\n\tconst fieldEvent = locator.fieldEvents.get(call);\n\treturn fieldEvent === void 0 ? void 0 : fieldEventStorage(fieldEvent);\n}\n/**\n* A policy's identity across a replacement: its name, or the prefix of a generated (wire) name,\n* whose hash changes with the policy's body.\n*/\nfunction policyKey(schemaName, tableName, policyName) {\n\treturn JSON.stringify([\n\t\tschemaName,\n\t\ttableName,\n\t\tparseWireName(policyName)?.prefix ?? policyName\n\t]);\n}\n/**\n* The policies the plan creates. A drop of one of them, by name or by generated-name prefix, is\n* half of a replacement, which leaves a policy in place, so it widens no access.\n*/\nfunction createdPolicies(calls) {\n\treturn new Set(calls.flatMap((call) => call instanceof CreatePostgresRlsPolicyCall ? [policyKey(call.schemaName, call.tableName, call.policy.name)] : []));\n}\nfunction accessWideningOf(locator, call, replaced) {\n\tif (call instanceof DisableRowLevelSecurityCall) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: true\n\t}];\n\tif (call instanceof DropPostgresRlsPolicyCall && !replaced.has(policyKey(call.schemaName, call.tableName, call.policyName))) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: false\n\t}];\n\treturn [];\n}\nfunction operationCountOf(call) {\n\treturn \"companions\" in call && Array.isArray(call.companions) ? 1 + call.companions.length : 1;\n}\n/** What each call of a Postgres plan loses, and whose access it widens. */\nfunction postgresCallSubjects(calls, locator) {\n\tconst replaced = createdPolicies(calls);\n\tconst destructive = calls.filter((call) => call.operationClass === \"destructive\");\n\tconst known = new Map(destructive.map((call) => [call, knownTarget(locator, call)]));\n\tconst unknownNames = unknownCallNames(destructive.filter((call) => known.get(call) === void 0));\n\treturn calls.map((call) => {\n\t\tconst lossTarget = known.get(call);\n\t\tconst unknownName = unknownNames.get(call);\n\t\treturn {\n\t\t\toperationCount: operationCountOf(call),\n\t\t\tdataLoss: lossTarget !== void 0 ? [lossTarget] : unknownName !== void 0 ? [{\n\t\t\t\tstorageName: unknownName,\n\t\t\t\ttable: void 0\n\t\t\t}] : [],\n\t\t\taccessWidening: accessWideningOf(locator, call, replaced)\n\t\t};\n\t});\n}\n//#endregion\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction partitionPostgresCallsByControlPolicy(calls, contract) {\n\treturn partitionCallsByControlPolicy({\n\t\tcalls,\n\t\tcontract,\n\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, contract),\n\t\tresolveFactoryName: (call) => call.factoryName\n\t});\n}\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst statements = this.planStatements(options, options.schema);\n\t\tif (!statements.ok) return plannerFailure([statements.failure]);\n\t\tconst { schema } = statements.value;\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\n\t\tconst relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));\n\t\tconst strict = options.policy.allowedOperationClasses.includes(\"widening\") || options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(relationalDiffIssues), options.ownership, options.contract);\n\t\tconst gated = strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\");\n\t\tconst schemaIssues = [...verifyPostgresNamespacePresence({\n\t\t\tcontract: options.contract,\n\t\t\tschema\n\t\t}), ...gated];\n\t\tconst indexRenames = pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst types = sqlTypeLookupsOf(options.frameworkComponents);\n\t\tconst storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(schema, schemaName);\n\t\tconst issuePartition = partitionIssuesByControlPolicy({\n\t\t\tissues: plannableIssues,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t});\n\t\tconst caseChangeConflicts = detectTableNameCaseChanges({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttableOf: (issue) => {\n\t\t\t\tconst node = issueNode(issue);\n\t\t\t\treturn node !== void 0 && PostgresTableSchemaNode.is(node) ? node : void 0;\n\t\t\t},\n\t\t\tnamespaceIdOf: (issue) => resolveNamespaceIdForDdlSchema(options.contract, issueSchemaName(issue) ?? schemaName),\n\t\t\trenameByHandStatements: (rename) => renameTableByHandStatements(options.contract, rename),\n\t\t\trenameTableCall: renderRenameTableCall,\n\t\t\tcontract: options.contract,\n\t\t\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID\n\t\t});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\ttypes,\n\t\t\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\n\t\t});\n\t\tconst schemaDiff = this.planPostgresSchemaDiff(options, policyDiffIssues);\n\t\tif (!result.ok || schemaDiff.conflicts.length > 0) return plannerFailure([...result.ok ? [] : result.failure, ...schemaDiff.conflicts]);\n\t\tconst renamePartition = partitionPostgresCallsByControlPolicy([\n\t\t\t...indexRenames.calls,\n\t\t\t...checkRenames.calls,\n\t\t\t...plannedConstraintNameRenames({\n\t\t\t\t...options,\n\t\t\t\tschema\n\t\t\t})\n\t\t], options.contract);\n\t\tconst schemaDiffPartition = partitionPostgresCallsByControlPolicy(schemaDiff.calls, options.contract);\n\t\tconst fieldEventCalls = planFieldEventCalls({\n\t\t\tpriorContract: options.origin === null ? null : options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks,\n\t\t\ttableRenames: statements.value.tableRenames,\n\t\t\tcolumnRenames: statements.value.columnRenames\n\t\t});\n\t\tconst fieldEventPartition = partitionPostgresCallsByControlPolicy(blindCast(fieldEventCalls.map(({ call }) => call)), options.contract);\n\t\tconst ordered = movePolicyDropsBeforeBlockedDdl(result.value.calls, schemaDiffPartition.kept);\n\t\tconst calls = [\n\t\t\t...statements.value.calls,\n\t\t\t...ordered.structural,\n\t\t\t...renamePartition.kept,\n\t\t\t...ordered.policyCalls,\n\t\t\t...fieldEventPartition.kept\n\t\t];\n\t\tconst seenWarnings = /* @__PURE__ */ new Set();\n\t\tconst warnings = [\n\t\t\t...issuePartition.suppressions,\n\t\t\t...renamePartition.suppressions,\n\t\t\t...schemaDiff.suppressions,\n\t\t\t...schemaDiffPartition.suppressions,\n\t\t\t...fieldEventPartition.suppressions\n\t\t].map((record) => renderPostgresSuppression(record, options.contract)).filter((warning) => {\n\t\t\tconst key = JSON.stringify(warning);\n\t\t\tif (seenWarnings.has(key)) return false;\n\t\t\tseenWarnings.add(key);\n\t\t\treturn true;\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderablePostgresMigration(calls, {\n\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\tappliedStatements: statements.value.appliedStatements,\n\t\t\t...subjectsOfCalls(postgresCallSubjects(calls, {\n\t\t\t\tcontract: options.fromContract ?? options.contract,\n\t\t\t\tfieldEvents: new Map(fieldEventCalls.map((fieldEvent) => [fieldEvent.call, fieldEvent]))\n\t\t\t}), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\tstatements: options.statements\n\t\t\t}),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Maps the RLS policy findings of the one combined tree diff\n\t* (`buildPostgresPlanDiff`, already ownership-filtered) into\n\t* `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops — a\n\t* `not-equal` finding (an exact-named policy whose content drifted)\n\t* becomes drop + create, or a disallowed-call conflict when the policy\n\t* forbids the drop, which is `widening`. It\n\t* does not re-diff — it consumes exactly the policy-node subset of the\n\t* shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE\n\t* ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`\n\t* attribute diff on the relational side.\n\t*\n\t* Rename post-pass (the index pass's structure): hash pairing pairs a\n\t* `not-found` and a `not-expected` policy on the SAME table whose\n\t* wire-name content hashes match but prefixes differ (prefix-only rename);\n\t* content pairing then pairs remaining wire-named-missing policies against remaining\n\t* extras of any name shape by verbatim content (the node-owned `contentEquals` —\n\t* exact→wire adoption). Multi-candidate groups pair deterministically\n\t* by sorted name; leftovers proceed as create/drop; an exact-named\n\t* missing policy never content-pairs.\n\t*\n\t* The pairing runs only when the policy allows `widening` (rename's\n\t* class). Without it (db-init's additive-only set), pairing degrades\n\t* deliberately to the additive half: the new name is CREATEd and the old\n\t* policy survives live until a plan that allows `widening` runs —\n\t* emitting an ungated widening rename would only fail at the runner's\n\t* class re-enforcement.\n\t*/\n\tplanPostgresSchemaDiff(options, filteredDiffIssues) {\n\t\tconst allowsWidening = options.policy.allowedOperationClasses.includes(\"widening\");\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tconst changed = [];\n\t\tfor (const issue of filteredDiffIssues) if (issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tchanged.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-found\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tmissing.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-expected\") {\n\t\t\tconst actual = issue.actual;\n\t\t\tPostgresPolicySchemaNode.assert(actual);\n\t\t\textra.push({\n\t\t\t\tnode: actual,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, actual.namespaceId)\n\t\t\t});\n\t\t}\n\t\tconst calls = [];\n\t\tconst conflicts = [];\n\t\tconst suppressions = [];\n\t\tconst renamedExtras = /* @__PURE__ */ new Set();\n\t\tconst renamedMissing = /* @__PURE__ */ new Set();\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.schemaForTable,\n\t\t\tfinding.node.tableName,\n\t\t\thash\n\t\t]);\n\t\tif (allowsWidening) {\n\t\t\tconst extrasByGroup = /* @__PURE__ */ new Map();\n\t\t\tfor (const finding of extra) {\n\t\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\t\tconst group = extrasByGroup.get(key) ?? [];\n\t\t\t\tgroup.push(finding);\n\t\t\t\textrasByGroup.set(key, group);\n\t\t\t}\n\t\t\tfor (const group of extrasByGroup.values()) group.sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tconst sortedMissing = [...missing].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst candidate = extrasByGroup.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t\tconst sortedExtras = [...extra].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tif (renamedMissing.has(missingFinding)) continue;\n\t\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\t\tconst candidate = sortedExtras.find((extraFinding) => !renamedExtras.has(extraFinding) && extraFinding.schemaForTable === missingFinding.schemaForTable && extraFinding.node.tableName === missingFinding.node.tableName && missingFinding.node.contentEquals(extraFinding.node));\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t}\n\t\tfor (const finding of changed) {\n\t\t\tconst replacement = {\n\t\t\t\tdrop: new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name),\n\t\t\t\tcreate: new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node))\n\t\t\t};\n\t\t\tconst graded = gradePolicyReplacement(replacement, options.contract, options.policy.allowedOperationClasses);\n\t\t\tif (graded.disposition === \"suppress\") {\n\t\t\t\tsuppressions.push(graded.record);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (graded.disposition === \"conflict\") {\n\t\t\t\tconflicts.push(graded.conflict);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcalls.push(replacement.drop);\n\t\t\tcalls.push(replacement.create);\n\t\t}\n\t\tfor (const finding of missing) {\n\t\t\tif (renamedMissing.has(finding)) continue;\n\t\t\tcalls.push(new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node)));\n\t\t}\n\t\tif (allowsWidening) for (const finding of extra) {\n\t\t\tif (renamedExtras.has(finding)) continue;\n\t\t\tcalls.push(new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconflicts,\n\t\t\tsuppressions\n\t\t};\n\t}\n\t/**\n\t* Plans the statements against a working copy of `schema`, in order, so each rename's companions\n\t* are computed against the schema the earlier statements left. The diff then runs on that schema.\n\t*/\n\tplanStatements(options, schema) {\n\t\tconst working = createWorkingSchema(schema);\n\t\tconst planned = planStatements({\n\t\t\tstatements: options.statements,\n\t\t\tfromContract: options.fromContract,\n\t\t\tcontract: options.contract,\n\t\t\tpolicy: options.policy,\n\t\t\ttarget: {\n\t\t\t\ttables: () => postgresSchemaTables(working.current, options.contract),\n\t\t\t\trenameTableCall: (rename) => postgresTableRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\trenameColumnCall: (rename) => postgresColumnRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\tapply: (call) => working.apply(call),\n\t\t\t\trenderTableRename: renderRenameTableCall,\n\t\t\t\ttableRenameByHand: (rename) => renameTableByHandStatements(options.contract, rename)\n\t\t\t}\n\t\t});\n\t\tif (!planned.ok) return planned;\n\t\treturn ok({\n\t\t\t...planned.value,\n\t\t\tschema: working.current\n\t\t});\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n};\n/**\n* A diff issue whose node is an RLS policy — the structural half of the one\n* combined tree diff, routed to `planPostgresSchemaDiff` instead of\n* `planIssues`.\n*/\nfunction isPolicyDiffIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && PostgresPolicySchemaNode.is(node);\n}\n/**\n* Postgres refuses these statements while a policy uses the object they touch:\n* - dropping a column (2BP01) or changing its type (0A000);\n* - dropping a table that a policy on another table uses (2BP01); a table's own policies go with it;\n* - dropping a native enum type (2BP01);\n* - a destructive codec type operation (a `RawSqlCall` on a type), such as dropping or rebuilding\n* the type (2BP01) or changing a composite type's attribute type (0A000). Additive and widening\n* type operations, such as adding an enum value or renaming the type, go through.\n*\n* So every policy drop moves to just before the first structural call that a policy can block.\n* Without such a call, the policy calls keep their place after the structural calls.\n*/\nfunction movePolicyDropsBeforeBlockedDdl(structural, policyCalls) {\n\tconst firstBlockable = structural.findIndex(policyCanBlock);\n\tif (firstBlockable === -1) return {\n\t\tstructural,\n\t\tpolicyCalls\n\t};\n\tconst isPolicyDrop = (call) => call instanceof DropPostgresRlsPolicyCall;\n\treturn {\n\t\tstructural: [\n\t\t\t...structural.slice(0, firstBlockable),\n\t\t\t...policyCalls.filter(isPolicyDrop),\n\t\t\t...structural.slice(firstBlockable)\n\t\t],\n\t\tpolicyCalls: policyCalls.filter((call) => !isPolicyDrop(call))\n\t};\n}\nfunction policyCanBlock(call) {\n\tif (call instanceof RawSqlCall) return call.operationClass === \"destructive\" && call.op.target.details?.objectType === \"type\";\n\treturn call instanceof DropColumnCall || call instanceof AlterColumnTypeCall || call instanceof DropTableCall || call instanceof DropNativeEnumTypeCall;\n}\n/**\n* Drops a `not-expected` issue when it is a whole extra storage entity (a table\n* or a native enum) that some space in the composition owns. Each such node\n* yields its own storage coordinate (see {@link postgresNodeStorageCoordinate}),\n* so `declaresEntity` answers over the whole composition on one uniform\n* coordinate: a positive answer means a sibling owns this entity here — leave\n* it; a negative answer means a genuine orphan — drop it. A node with no storage\n* coordinate (a namespace, or a deeper column/constraint drift on an owned\n* table) is this space's own and is always kept. No oracle ⇒ keep everything.\n*/\nfunction retainUnownedExtras(issues, ownership, contract) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0) return true;\n\t\tconst coordinate = postgresNodeStorageCoordinate(node);\n\t\tif (coordinate === void 0) return true;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\n\t});\n}\n/**\n* Returns the one namespace node the relational strategy layer probes for\n* live-table existence and reads codec-hook context off — the namespace\n* matching the planner's resolved schema name, or the first namespace when\n* none matches. `undefined` when the tree has no namespaces, so the strategy\n* context uses its empty-schema default.\n*\n* The relational strategies key tables by bare name, so they can only probe one\n* namespace at a time; probing across every namespace at once is future work.\n*\n* Returns the real `PostgresNamespaceSchemaNode` reference rather than a\n* projection: `storageTypePlanCallStrategy` hands this same value to codec\n* `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific\n* `nativeEnums` field off it (via `PostgresNamespaceSchemaNode.is`) to decide\n* whether a native enum type already exists — a projection that only copies\n* `tables` would silently drop that signal. `StrategyContext.schema`'s\n* declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't\n* capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`\n* in the family's relational walk already treats a namespace node as a\n* structurally-`SqlSchemaIR`-shaped value.\n*/\nfunction relationalNamespaceNode(schema, schemaName) {\n\tconst namespaceNodes = Object.values(schema.namespaces);\n\tconst namespaceNode = namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];\n\tif (namespaceNode === void 0) return void 0;\n\treturn blindCast(namespaceNode);\n}\n/**\n* Grades a {@link PolicyReplacement} as one unit against the table's\n* control policy, BEFORE the pair becomes calls or a conflict. This runs\n* ahead of `partitionCallsByControlPolicy`, which later re-grades the\n* surviving calls per-call — a no-op here, since only managed units\n* survive this grading.\n*\n* A replacement is deliberately STRICTER than the shared\n* `callAllowedUnderControlPolicy` rule: `tolerated` permits whole-object\n* creation, but a replacement's create is the second half of a repair of\n* an existing object, not a new object — so ANY non-managed control\n* (external, observed, tolerated) suppresses the whole unit. Drift on an\n* object the plan does not manage is reported, never repaired; the\n* suppression subject names the drifted policy (`rlsPolicy`) so the\n* report says which policy drifted, matching the conflict path's\n* `location.rlsPolicy`.\n*/\nfunction gradePolicyReplacement(replacement, contract, allowedOperationClasses) {\n\tconst subject = resolvePostgresCallControlPolicySubject(replacement.drop, contract);\n\tconst controlPolicy = controlPolicyForCall(subject, contract.defaultControlPolicy);\n\tif (controlPolicy !== \"managed\") return {\n\t\tdisposition: \"suppress\",\n\t\trecord: {\n\t\t\tsubject: subject === void 0 ? void 0 : {\n\t\t\t\t...subject,\n\t\t\t\trlsPolicy: replacement.drop.policyName\n\t\t\t},\n\t\t\tpolicy: controlPolicy,\n\t\t\tfactoryName: void 0,\n\t\t\tcreatesNewObject: false\n\t\t}\n\t};\n\tif (!allowedOperationClasses.includes(\"widening\")) return {\n\t\tdisposition: \"conflict\",\n\t\tconflict: conflictForDisallowedCall(replacement.drop, allowedOperationClasses)\n\t};\n\treturn { disposition: \"plan\" };\n}\n/**\n* Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`\n* carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole\n* entity, `namespaceId` included). This reconstructs rather than looking the\n* original up in the contract on purpose: the diff node's `namespaceId` is the\n* *resolved DDL schema* (set when the expected tree was built), which is the\n* value the emitted op must carry; the contract-stored entity holds the raw,\n* pre-resolution coordinate, so a lookup would change the migration output.\n*/\nfunction policyNodeToContractPolicy(node) {\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(node.name, node.prefix),\n\t\ttableName: node.tableName,\n\t\tnamespaceId: node.namespaceId,\n\t\toperation: node.operation,\n\t\troles: [...node.roles],\n\t\tusing: node.using,\n\t\twithCheck: node.withCheck,\n\t\tpermissive: node.permissive\n\t});\n}\n//#endregion\nexport { createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-BRKlBIQL.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,YAAY,MAAM,WAAW;CACrC,OAAO,UAAU,MAAM,SAAS,KAAK,OAAO,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAC5E;;;;AAIA,SAAS,sBAAsB,OAAO;CACrC,MAAM,EAAE,YAAY,MAAM,IAAI,UAAU,SAAS;CACjD,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB;EACzD,IAAI,cAAc,KAAK,GAAG,OAAO,CAAC;EAClC,MAAM,UAAU,UAAU,QA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,cAAc,+BAA+B,UAAU,aAAa;EAC1E,OAAO,CAAC,UAAU,eAAe;GAChC;GACA,GAAG;EACJ,CAAC;CACF,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,wBAAwB,QAAQ,YAAY;CACpD,MAAM,iBAAiB,OAAO,OAAO,OAAO,UAAU;CACtD,MAAM,gBAAgB,eAAe,MAAM,SAAS,KAAK,eAAe,UAAU,KAAK,eAAe;CACtG,IAAI,kBAAkB,KAAK,GAAG,OAAO,KAAK;CAC1C,OAAO,UAAU,aAAa;AAC/B;;;;;;;;;;;;;;;;;;AAkBA,SAAS,uBAAuB,aAAa,UAAU,yBAAyB;CAC/E,MAAM,UAAU,wCAAwC,YAAY,MAAM,QAAQ;CAClF,MAAM,gBAAgB,qBAAqB,SAAS,SAAS,oBAAoB;CACjF,IAAI,kBAAkB,WAAW,OAAO;EACvC,aAAa;EACb,QAAQ;GACP,SAAS,YAAY,KAAK,IAAI,KAAK,IAAI;IACtC,GAAG;IACH,WAAW,YAAY,KAAK;GAC7B;GACA,QAAQ;GACR,aAAa,KAAK;GAClB,kBAAkB;EACnB;CACD;CACA,IAAI,CAAC,wBAAwB,SAAS,UAAU,GAAG,OAAO;EACzD,aAAa;EACb,UAAU,0BAA0B,YAAY,MAAM,uBAAuB;CAC9E;CACA,OAAO,EAAE,aAAa,OAAO;AAC9B;;;;;;;;;;AAUA,SAAS,2BAA2B,MAAM;CACzC,OAAO,IAAI,kBAAkB;EAC5B,QAAQ,SAAS,KAAK,MAAM,KAAK,MAAM;EACvC,WAAW,KAAK;EAChB,aAAa,KAAK;EAClB,WAAW,KAAK;EAChB,OAAO,CAAC,GAAG,KAAK,KAAK;EACrB,OAAO,KAAK;EACZ,WAAW,KAAK;EAChB,YAAY,KAAK;CAClB,CAAC;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as PostgresMigration } from "./postgres-migration-
|
|
1
|
+
import { t as PostgresMigration } from "./postgres-migration-Cg6Rwgok--hvAHrSo.mjs";
|
|
2
2
|
import { t as renderOps } from "./render-ops-DjsYroU7-Nqqlj8co.mjs";
|
|
3
3
|
import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B128r1qw.mjs";
|
|
4
|
-
//#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-DYSPvP11.mjs
|
|
5
5
|
var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
|
|
6
6
|
#calls;
|
|
7
7
|
#meta;
|
|
@@ -44,4 +44,4 @@ var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
|
|
|
44
44
|
//#endregion
|
|
45
45
|
export { TypeScriptRenderablePostgresMigration as t };
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=planner-produced-postgres-migration-
|
|
47
|
+
//# sourceMappingURL=planner-produced-postgres-migration-DYSPvP11-C6kel47a.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-produced-postgres-migration-
|
|
1
|
+
{"version":3,"file":"planner-produced-postgres-migration-DYSPvP11-C6kel47a.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-DYSPvP11.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-Cg6Rwgok.mjs\";\nimport { t as renderOps } from \"./render-ops-DjsYroU7.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-DYSPvP11.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
|
|
@@ -4,7 +4,7 @@ import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-CKBDkxX7
|
|
|
4
4
|
import { a as assertFullTextIndexes } from "./full-text-index-definition-D-QC3DO2-DXbQitDn.mjs";
|
|
5
5
|
import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-DIaAgaL6-Dmqzjbu5.mjs";
|
|
6
6
|
import { t as postgresCodecTraitsOf } from "./postgres-codec-traits-BUygtI9N-CB-uwvY1.mjs";
|
|
7
|
-
import { c as postgresAuthoringEntityTypes } from "./authoring-
|
|
7
|
+
import { c as postgresAuthoringEntityTypes } from "./authoring-kZOSollq-DP0v31A_.mjs";
|
|
8
8
|
import { requiredSchemaKeys } from "@prisma/orm-framework/components/codec";
|
|
9
9
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
10
10
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
@@ -14,7 +14,7 @@ import { buildSqlSchemaQualifiedView } from "@prisma/orm-family-sql/contract/con
|
|
|
14
14
|
import { createPreserveEmptyPredicate } from "@prisma/orm-framework/contract/hashing-utils";
|
|
15
15
|
import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
|
|
16
16
|
import { sqlContractCanonicalizationHooks } from "@prisma/orm-family-sql/contract/canonicalization-hooks";
|
|
17
|
-
//#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-
|
|
17
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-6xGfZyGS.mjs
|
|
18
18
|
const POSTGRES_AUTHORING_CTX = {
|
|
19
19
|
family: "sql",
|
|
20
20
|
target: "postgres",
|
|
@@ -147,4 +147,4 @@ const PostgresContractView = {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
export { PostgresContractView as n, PostgresContractSerializer as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=postgres-contract-view-
|
|
150
|
+
//# sourceMappingURL=postgres-contract-view-6xGfZyGS-C58Bint3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-contract-view-
|
|
1
|
+
{"version":3,"file":"postgres-contract-view-6xGfZyGS-C58Bint3.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-6xGfZyGS.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID, _ as PG_INT_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { t as createPostgresBuiltinDataTypeLookup } from \"./data-types-DRkmmE9S.mjs\";\nimport { r as createPostgresBuiltinCodecLookup } from \"./codec-registry-CKBDkxX7.mjs\";\nimport { n as assertFullTextIndexes } from \"./full-text-index-definition-D-QC3DO2.mjs\";\nimport { n as postgresAuthoringEntityTypes } from \"./authoring-kZOSollq.mjs\";\nimport { t as postgresCodecTraitsOf } from \"./postgres-codec-traits-BUygtI9N.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { requiredSchemaKeys } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tcodecLookup: createPostgresBuiltinCodecLookup(),\n\tdataTypeLookup: createPostgresBuiltinDataTypeLookup(),\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction requiredKeysOf(schema) {\n\tconst keys = requiredSchemaKeys(schema);\n\tif (keys === void 0) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn keys;\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\tconst schema = new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t\tfor (const table of Object.values(schema.table)) assertFullTextIndexes(table, postgresCodecTraitsOf);\n\t\treturn schema;\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-6xGfZyGS.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,aAAa,iCAAiC;CAC9C,gBAAgB,oCAAoC;CACpD,qBAAqB;EACpB,MAAM;EACN,KAAK;CACN;AACD;AACA,SAAS,mCAAmC,QAAQ;CACnD,OAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,aAAa,UAAU,OAAO,OAAO,YAAY;AAC1G;;;;;;;AAOA,SAAS,6BAA6B,WAAW;CAChD,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,SAAS;EACtB,KAAK,MAAM,SAAS,OAAO,OAAO,IAAI,GAAG;GACxC,IAAI,gCAAgC,KAAK,GAAG;IAC3C,IAAI,mCAAmC,MAAM,MAAM,GAAG;KACrD,MAAM,EAAE,YAAY,MAAM;KAC1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AAQ,YAAY,CAAC;IAC5B,GAAG,eAAe,EAAE,UAAU,aAAa,IAAI,CAAC;GACjD;EACD,CAAC;EACD,KAAK,MAAM,SAAS,OAAO,OAAO,OAAO,KAAK,GAAG,sBAAsB,OAAO,qBAAqB;EACnG,OAAO;CACR;CACA,kBAAkB,UAAU;EAC3B,MAAM,EAAE,SAAS,GAAG,SAAS;EAC7B,MAAM,iBAAiB,CAAC;EACxB,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,QAAQ,UAAU,GAAG;GAC5D,MAAM,gBAAgB,GAAG,OAAO;GAChC,eAAe,QAAQ;IACtB,IAAI,GAAG;IACP,MAAM,gBAAgB,4BAA4B;IAClD,SAAS,KAAK,0BAA0B,GAAG,OAAO;GACnD;EACD;EACA,MAAM,aAAa;GAClB,aAAa,OAAO,QAAQ,WAAW;GACvC,YAAY;EACb;EACA,IAAI,QAAQ,UAAU,KAAK,GAAG;GAC7B,MAAM,WAAW,CAAC;GAClB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG,SAAS,QAAQ,KAAK,oBAAoB,KAAK;GAC1G,WAAW,WAAW;EACvB;EACA,OAAO,UAAU;GAChB,GAAG;GACH,SAAS;EACV,CAAC;CACF;AACD;AAGA,MAAM,uBAAuB;;CAE5B,KAAK,UAAU;EACd,OAAO,4BAA4B,QAAQ;CAC5C;;CAEA,SAAS,MAAM;EACd,OAAO,4BAA4B,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,IAAI,CAAC;CAC9F;AACD"}
|
package/dist/{postgres-migration-BtlvhcXs-UjWm8cAb.mjs → postgres-migration-Cg6Rwgok--hvAHrSo.mjs}
RENAMED
|
@@ -10,7 +10,7 @@ import { A as RenameConstraintCall, C as DropNativeEnumTypeCall, D as EnableRowL
|
|
|
10
10
|
import { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from "./default-constraint-names-CtcRXhV8-nz3ff6b8.mjs";
|
|
11
11
|
import { l as resolveNamespaceIdForDdlSchema, r as issueNode } from "./control-policy-DbDoLxrp-OpWBtviT.mjs";
|
|
12
12
|
import { n as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from "./diff-database-schema-CByLrBg6-BLLJDUpg.mjs";
|
|
13
|
-
import { n as PostgresContractView } from "./postgres-contract-view-
|
|
13
|
+
import { n as PostgresContractView } from "./postgres-contract-view-6xGfZyGS-C58Bint3.mjs";
|
|
14
14
|
import { t as dataTransform } from "./data-transform-Bo32KRbq-BLn1_UG-.mjs";
|
|
15
15
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
16
16
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
@@ -24,7 +24,7 @@ import { isArrayEqual } from "@prisma/orm-framework/utils/array-equal";
|
|
|
24
24
|
import { errorMigrationOperationOptionRemoved } from "@prisma/orm-framework/errors/migration";
|
|
25
25
|
import { Migration } from "@prisma/orm-family-sql/family/migration";
|
|
26
26
|
import { MigrationContractViews } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
27
|
-
//#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-
|
|
27
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-Cg6Rwgok.mjs
|
|
28
28
|
function postgresRenderDefault(def, column, type) {
|
|
29
29
|
if (def.kind === "function") return def.expression;
|
|
30
30
|
return renderDefaultLiteral(def.value, {
|
|
@@ -1072,4 +1072,4 @@ function refuseEarlierSetDefaultOptions(options) {
|
|
|
1072
1072
|
//#endregion
|
|
1073
1073
|
export { postgresColumnRenameCall as a, postgresSchemaTables as c, renderRenameTableCall as d, pairIndexRenames as i, postgresTableRenameCall as l, createWorkingSchema as n, postgresContractToSchema as o, pairCheckRenames as r, postgresRenderDefault as s, PostgresMigration as t, renameTableByHandStatements as u };
|
|
1074
1074
|
|
|
1075
|
-
//# sourceMappingURL=postgres-migration-
|
|
1075
|
+
//# sourceMappingURL=postgres-migration-Cg6Rwgok--hvAHrSo.mjs.map
|