@prisma/orm-target-sqlite 8.0.0-rc.1-dev.11 → 8.0.0-rc.1-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-C8clzDxQ-Bu3XOcDJ.mjs → adapter-NeO612zv-B705D3Z8.mjs} +8 -5
- package/dist/adapter-NeO612zv-B705D3Z8.mjs.map +1 -0
- package/dist/adapter.mjs +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +3 -3
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{aggregates-Cy5ovVZD.mjs → aggregates-DWyPO7t6.mjs} +39 -8
- package/dist/aggregates-DWyPO7t6.mjs.map +1 -0
- package/dist/{codecs-d_xAsfTz.mjs → codecs-TyM6tD3U.mjs} +63 -5
- package/dist/codecs-TyM6tD3U.mjs.map +1 -0
- package/dist/{descriptor-meta-DjKgG4z5-DYuZ-AXi.mjs → descriptor-meta-DjKgG4z5-BAKSkr1j.mjs} +3 -3
- package/dist/{descriptor-meta-DjKgG4z5-DYuZ-AXi.mjs.map → descriptor-meta-DjKgG4z5-BAKSkr1j.mjs.map} +1 -1
- package/dist/{migration-DWP33-2M.mjs → migration-BX7YeaQT.mjs} +2 -2
- package/dist/{migration-DWP33-2M.mjs.map → migration-BX7YeaQT.mjs.map} +1 -1
- package/dist/{op-factory-call-BCDGjXmK-D_Q47Yko.mjs → op-factory-call-CsNFRTPS-HuMdWaBX.mjs} +3 -3
- package/dist/{op-factory-call-BCDGjXmK-D_Q47Yko.mjs.map → op-factory-call-CsNFRTPS-HuMdWaBX.mjs.map} +1 -1
- package/dist/{planner-B9A1yTAH-NXeVipfr.mjs → planner-DuW2pz1t-DFhIqgV2.mjs} +5 -5
- package/dist/{planner-B9A1yTAH-NXeVipfr.mjs.map → planner-DuW2pz1t-DFhIqgV2.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-BRxGeP57-Ban7mFdH.mjs → planner-produced-sqlite-migration-DB3xleco-C1ncLSxE.mjs} +3 -3
- package/dist/{planner-produced-sqlite-migration-BRxGeP57-Ban7mFdH.mjs.map → planner-produced-sqlite-migration-DB3xleco-C1ncLSxE.mjs.map} +1 -1
- package/dist/{sqlite-migration-DWl9RerP-X0sf9N80.mjs → sqlite-migration-MGxXxUB4-zfSNsC-a.mjs} +3 -3
- package/dist/{sqlite-migration-DWl9RerP-X0sf9N80.mjs.map → sqlite-migration-MGxXxUB4-zfSNsC-a.mjs.map} +1 -1
- package/dist/target.mjs +7 -7
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codecs.mjs +1 -1
- package/dist/target__control.mjs +2 -2
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner.mjs +1 -1
- package/package.json +9 -9
- package/dist/adapter-C8clzDxQ-Bu3XOcDJ.mjs.map +0 -1
- package/dist/aggregates-Cy5ovVZD.mjs.map +0 -1
- package/dist/codecs-d_xAsfTz.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-B9A1yTAH-NXeVipfr.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-B9A1yTAH.mjs"],"sourcesContent":["import { a as DropColumnCall, d as buildRecreateSummary, h as renderDefaultLiteral, i as DataTransformCall, l as RecreateTableCall, m as buildColumnTypeSql, n as CreateIndexCall, o as DropIndexCall, p as buildColumnDefaultSql, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as buildRecreatePostchecks } from \"./op-factory-call-BCDGjXmK.mjs\";\nimport { t as CONTROL_TABLE_NAMES } from \"./control-tables-D_o8dKRB.mjs\";\nimport { t as TypeScriptRenderableSqliteMigration } from \"./planner-produced-sqlite-migration-BRxGeP57.mjs\";\nimport { DdlColumn, ForeignKeyConstraint, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint } from \"@internal/sql-relational-core/ast\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { buildNativeTypeExpander, contractToSchemaIR, extractCodecControlHooks, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { verifySqlSchemaByDiff } from \"@internal/family-sql/diff\";\nimport { diffSchemas, issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\n//#region src/core/migrations/diff-database-schema.ts\n/** Renders a column default for the SQLite dialect. */\nfunction sqliteRenderDefault(def, _column) {\n\tif (def.kind === \"function\") {\n\t\tif (def.expression === \"now()\") return \"datetime('now')\";\n\t\treturn def.expression;\n\t}\n\treturn renderDefaultLiteral(def.value);\n}\n/**\n* The SQLite expected-side projection: contract → flat relational schema IR.\n*\n* `extras` thread the plan-time derivation input: the native-type expander,\n* so the expected side carries resolved native types (like the verify\n* side). Every expected column also carries its `codecRef` unconditionally\n* (Decision 5) — the planner's op-builders resolve DDL rendering from it at\n* plan time, so no separate render stamper is threaded here.\n*/\nfunction sqliteContractToSchema(contract, extras) {\n\treturn contractToSchemaIR(contract, {\n\t\tannotationNamespace: \"sqlite\",\n\t\trenderDefault: sqliteRenderDefault,\n\t\t...ifDefined(\"expandNativeType\", extras?.expandNativeType)\n\t});\n}\n/**\n* The SQLite schema verify: the full-tree node-diff verdict wrapped in the\n* issue-based result envelope. Used by the runner's post-apply check; the\n* family `verifySchema` runs the same composition via the descriptor hook.\n*/\nfunction verifySqliteDatabaseSchema(input) {\n\treturn verifySqlSchemaByDiff({\n\t\tcontract: input.contract,\n\t\tschema: input.actualSchema,\n\t\tstrict: input.strict,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tdiffSchema: diffSqliteSchema,\n\t\tgranularityOf: relationalNodeGranularity\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject table's declared control policy\n* directly from the contract. SQLite's expected tree is flat, so the issue\n* path carries no namespace segment — `path[1]` is the table name (`path[0]`\n* is the tree root's own id); every contract namespace is searched for that\n* table name (table names are globally unique in the flat tree — duplicates\n* across namespaces are rejected earlier, at `contractToSchemaIR`).\n*/\nfunction resolveControlPolicy(issue, contract) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return void 0;\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst table = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (table !== void 0) return table.control;\n\t}\n}\n/**\n* The SQLite full-tree node diff for the family verify verdict: derive the\n* expected flat tree with resolved leaf values (expander threaded so\n* parameterized types compare expanded; FK nodes born with the flat empty\n* `resolvedReferencedNamespace`), and run the generic differ over the trees\n* as derived. Flat targets need no ownership scoping. The codec `verifyType`\n* hooks run once per contract namespace with tables, each against the sole\n* flat actual root — exactly the legacy per-namespace pairing.\n*/\nfunction diffSqliteSchema(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = input.schema instanceof SqlSchemaIR ? input.schema : blindCast(input.schema);\n\treturn {\n\t\tissues: diffSchemas(expected, actual),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, input.contract),\n\t\tnamespacePairs: Object.values(input.contract.storage.namespaces).filter((ns) => Object.keys(ns.entries.table ?? {}).length > 0).map(() => ({ actual }))\n\t};\n}\n/**\n* The SQLite planner's diff input: the same tree-building\n* `diffSqliteSchema` uses (expander threaded, FK nodes born flat). One differ\n* drives both verify and plan over the trees as derived; this is the plan-side\n* derivation — column DDL resolves from each expected column's `codecRef` at\n* plan time (`column-ddl-rendering.ts`), so no separate render stamping happens here.\n*/\nfunction buildSqlitePlanDiff(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = new SqlSchemaIR(withRecordKeyNames(input.actualSchema));\n\treturn {\n\t\texpected,\n\t\tactual,\n\t\tissues: diffSchemas(expected, actual)\n\t};\n}\n/**\n* Every schema-tree builder in this codebase derives a table's / column's\n* `name` from the record key it's stored under (`contractToSchemaIR`,\n* the SQLite introspection adapter) rather than trusting a redundant\n* embedded field — the record key IS the identity. Mirrors that discipline\n* for the actual/live tree before construction, so `SqlTableIR.id` /\n* `SqlColumnIR.id` (both derived from `.name`) are always correct without\n* requiring every caller to duplicate the key onto the value. A no-op for a\n* tree that already carries matching names (the real introspection adapter\n* always does).\n*/\nfunction withRecordKeyNames(actualSchema) {\n\tconst raw = blindCast(actualSchema);\n\tconst tables = {};\n\tfor (const [tableName, table] of Object.entries(raw.tables ?? {})) {\n\t\tconst rawTable = blindCast(table);\n\t\tconst columns = {};\n\t\tfor (const [columnName, column] of Object.entries(blindCast(table).columns ?? {})) columns[columnName] = {\n\t\t\t...blindCast(column),\n\t\t\tname: columnName\n\t\t};\n\t\ttables[tableName] = {\n\t\t\t...rawTable,\n\t\t\tname: tableName,\n\t\t\tcolumns,\n\t\t\tforeignKeys: rawTable.foreignKeys ?? [],\n\t\t\tuniques: rawTable.uniques ?? [],\n\t\t\tindexes: rawTable.indexes ?? []\n\t\t};\n\t}\n\treturn { tables };\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields `buildColumnTypeSql` /\n* `buildColumnDefaultSql` expect, from a column node's own stamped codec\n* identity (`codecRef` / `codecBaseNativeType`, Decision 5) — never the\n* contract. SQLite's type renderer only uppercases the resolved base type\n* (no parameterized expansion, no named-type quoting), so `typeRef` is\n* deliberately left unset here: setting it would send `buildColumnTypeSql`\n* back through a live `storageTypes` lookup the node's fields have already\n* resolved past, which throws for an unrecognized reference (unlike\n* Postgres's lenient fallback).\n*/\nfunction columnLike(column) {\n\tif (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column \"${column.name}\" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: column.codecBaseNativeType,\n\t\tcodecId: column.codecRef.codecId,\n\t\tnullable: column.nullable,\n\t\t...(column.many ?? column.codecRef.many) !== void 0 ? { many: column.many ?? column.codecRef.many } : {},\n\t\t...column.codecRef.typeParams !== void 0 ? { typeParams: blindCast(column.codecRef.typeParams) } : {},\n\t\t...column.resolvedDefault !== void 0 ? { default: column.resolvedDefault } : {}\n\t};\n}\nfunction sqliteDefaultToDdlColumnDefault(columnDefault) {\n\tif (!columnDefault) return void 0;\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return new LiteralColumnDefault(columnDefault.value);\n\t\tcase \"function\":\n\t\t\tif (columnDefault.expression === \"autoincrement()\") return void 0;\n\t\t\treturn new FunctionColumnDefault(columnDefault.expression);\n\t\tdefault: {\n\t\t\tconst exhaustive = columnDefault;\n\t\t\treturn assertNever(exhaustive, `sqliteDefaultToDdlColumnDefault: unhandled kind \"${blindCast(exhaustive).kind}\"`);\n\t\t}\n\t}\n}\n/**\n* True when the column is rendered inline as `INTEGER PRIMARY KEY\n* AUTOINCREMENT` — the sole member of the table's primary key with an\n* `autoincrement()` default. Node-based sibling of the retired\n* `isInlineAutoincrementPrimaryKey` (which read the raw `StorageTable`);\n* reads the table/column nodes instead.\n*/\nfunction isInlineAutoincrementPrimaryKeyNode(table, column) {\n\tif (table.primaryKey?.columns.length !== 1) return false;\n\tif (table.primaryKey.columns[0] !== column.name) return false;\n\treturn column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\";\n}\n/**\n* Builds the flat `SqliteColumnSpec` `AddColumnCall` / `RecreateTableCall`\n* need, resolved from the column node's codec identity — the same builders\n* the pre-`plan(start, end)` op-path called, so the output is\n* byte-identical.\n*/\nfunction columnSpecFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tconst defaultSql = buildColumnDefaultSql(like.default);\n\treturn {\n\t\tname: column.name,\n\t\ttypeSql,\n\t\tdefaultSql,\n\t\tnullable: column.nullable,\n\t\t...inline ? { inlineAutoincrementPrimaryKey: true } : {}\n\t};\n}\n/**\n* Builds the `DdlColumn` the `CreateTableCall` path needs, resolved from the\n* column node's codec identity.\n*/\nfunction ddlColumnFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tif (inline) return new DdlColumn({\n\t\tname: column.name,\n\t\ttype: `${typeSql} PRIMARY KEY AUTOINCREMENT`\n\t});\n\tconst colDefault = sqliteDefaultToDdlColumnDefault(like.default);\n\treturn new DdlColumn({\n\t\tname: column.name,\n\t\ttype: typeSql,\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...colDefault !== void 0 ? { default: colDefault } : {},\n\t\t...column.codecRef !== void 0 ? { codecRef: column.codecRef } : {}\n\t});\n}\n/**\n* Builds the table-level constraints (PK / unique / FK) for a `CreateTable`\n* path from the table node — the node-sourced sibling of the retired\n* contract-based `tableToDdlParts`'s constraint half.\n*/\nfunction tableConstraintsFromNode(table, hasInlinePk) {\n\tconst constraints = [];\n\tif (table.primaryKey && !hasInlinePk) constraints.push(new PrimaryKeyConstraint({ columns: table.primaryKey.columns }));\n\tfor (const u of table.uniques) constraints.push(new UniqueConstraint({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tfor (const fk of table.foreignKeys) constraints.push(new ForeignKeyConstraint({\n\t\tcolumns: fk.columns,\n\t\trefTable: fk.referencedTable,\n\t\trefColumns: fk.referencedColumns,\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn constraints;\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Classifies a node issue into the operation class a recreate absorbing it\n* would need, or `null` when the strategy doesn't handle this node/reason at\n* all (table/column not-found-or-not-expected, and index issues — those are\n* standalone ops, never folded into a recreate).\n*\n* Column drift is a single `not-equal` issue now (type AND nullability\n* compared together by `SqlColumnIR.isEqualTo`), so this reads both fields\n* off the node pair directly rather than trusting a separate issue kind per\n* attribute: a type change is always destructive; a pure nullability change\n* is destructive when tightening (NOT NULL required) and widening when\n* relaxing.\n*/\nfunction classifyNodeIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return null;\n\tswitch (blindCast(node).nodeKind) {\n\t\tcase RelationalSchemaNodeKind.column: {\n\t\t\tif (issueOutcome(issue) !== \"not-equal\") return null;\n\t\t\tconst expected = blindCast(issue.expected);\n\t\t\tif (columnTypeChanged(expected, blindCast(issue.actual))) return \"destructive\";\n\t\t\treturn expected.nullable ? \"widening\" : \"destructive\";\n\t\t}\n\t\tcase RelationalSchemaNodeKind.columnDefault: return issueOutcome(issue) === \"not-expected\" ? \"destructive\" : \"widening\";\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"destructive\";\n\t\tdefault: return null;\n\t}\n}\n/**\n* Groups recreate-eligible issues by table, decides per-table operation class\n* (destructive wins over widening), and emits one `RecreateTableCall` per\n* table. Returns unchanged-or-smaller issue list — issues the strategy\n* consumed are removed so `mapNodeIssueToCall` doesn't double-handle them.\n*\n* The full desired/live table shapes come from `ctx.expected`/`ctx.actual`\n* directly (keyed by table name — SQLite is a flat, single-namespace target)\n* rather than from any individual issue, since a single drifted attribute's\n* issue only carries that attribute's own node, never the whole table.\n*/\nconst recreateTableStrategy = (issues, ctx) => {\n\tconst byTable = /* @__PURE__ */ new Map();\n\tconst consumed = /* @__PURE__ */ new Set();\n\tfor (const issue of issues) {\n\t\tconst cls = classifyNodeIssue(issue);\n\t\tif (!cls) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tconst entry = byTable.get(tableName);\n\t\tif (entry) {\n\t\t\tentry.issues.push(issue);\n\t\t\tif (cls === \"destructive\") entry.hasDestructive = true;\n\t\t} else byTable.set(tableName, {\n\t\t\tissues: [issue],\n\t\t\thasDestructive: cls === \"destructive\"\n\t\t});\n\t\tconsumed.add(issue);\n\t}\n\tif (byTable.size === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [tableName, entry] of byTable) {\n\t\tconst expectedTable = ctx.expected.tables[tableName];\n\t\tconst actualTable = ctx.actual.tables[tableName];\n\t\tif (!expectedTable || !actualTable) continue;\n\t\tconst operationClass = entry.hasDestructive ? \"destructive\" : \"widening\";\n\t\tconst tableSpec = tableSpecFromNode(expectedTable);\n\t\tconst indexes = expectedTable.indexes.map((idx) => ({\n\t\t\tname: idx.name,\n\t\t\tcolumns: idx.columns ?? []\n\t\t}));\n\t\tcalls.push(new RecreateTableCall({\n\t\t\ttableName,\n\t\t\tcontractTable: tableSpec,\n\t\t\tschemaColumnNames: Object.keys(actualTable.columns),\n\t\t\tindexes,\n\t\t\tsummary: buildRecreateSummary(tableName, entry.issues),\n\t\t\tpostchecks: buildRecreatePostchecks(tableName, entry.issues, tableSpec),\n\t\t\toperationClass\n\t\t}));\n\t}\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !consumed.has(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* When the policy allows `'data'` and the expected tree tightens one or more\n* columns from nullable to NOT NULL, emit a `DataTransformCall` stub per\n* tightened column. The user fills the backfill `UPDATE` in the rendered\n* `migration.ts` before the subsequent `RecreateTableCall` copies data into\n* the tightened schema (whose `INSERT INTO temp SELECT … FROM old` would\n* otherwise fail at runtime if any `NULL`s remain).\n*\n* Does NOT consume the tightening issue — `recreateTableStrategy` still\n* needs it to produce the actual recreate that enforces the NOT NULL at\n* the schema level. The backfill op and the recreate op end up in the\n* recipe slot in strategy order (backfill first, recreate second), which\n* matches the required execution order.\n*\n* Mirrors Postgres's `nullableTighteningCallStrategy` / `'data'`-class\n* gating. When `'data'` is not in the policy (the default `db update` /\n* `db init` path), the strategy short-circuits and the recreate alone\n* runs with its current destructive-class gating — preserving today's\n* behavior where a tightening blows up at runtime if NULLs are present.\n*/\nconst nullabilityTighteningBackfillStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\" || issue.expected === void 0 || issue.actual === void 0) continue;\n\t\tif (blindCast(issue.expected).nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expectedColumn = blindCast(issue.expected);\n\t\tconst actualColumn = blindCast(issue.actual);\n\t\tif (expectedColumn.nullable === actualColumn.nullable) continue;\n\t\tif (expectedColumn.nullable) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tcalls.push(new DataTransformCall(`data_migration.backfill-${tableName}-${expectedColumn.name}`, `Backfill NULLs in \"${tableName}\".\"${expectedColumn.name}\" before NOT NULL tightening`, tableName, expectedColumn.name));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst sqlitePlannerStrategies = [nullabilityTighteningBackfillStrategy, recreateTableStrategy];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree (columns, defaults,\n* constraints, indexes). `CreateTableCall`/`DropTableCall` and\n* `AddColumnCall`/`DropColumnCall` already account for the whole subtree\n* (reading it directly off the table/column node), so the nested issues are\n* redundant — coalescing them is \"the planner's responsibility\" the differ's\n* own contract assigns (`schema-diff.ts`). Drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path.\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) === \"not-found\" || issueOutcome(issue) === \"not-expected\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* Builds the flat `SqliteTableSpec` `RecreateTableCall` needs from the\n* expected table node — the node-sourced equivalent of the retired\n* `toTableSpec` (which read a raw contract `StorageTable`). Every column's\n* spec is resolved from its `codecRef` via `columnSpecFromNode`.\n*/\nfunction tableSpecFromNode(table) {\n\tconst columns = Object.values(table.columns).map((c) => columnSpecFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst uniques = table.uniques.map((u) => ({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tconst foreignKeys = table.foreignKeys.map((fk) => ({\n\t\tcolumns: fk.columns,\n\t\treferences: {\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: fk.referencedColumns\n\t\t},\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn {\n\t\tcolumns,\n\t\t...table.primaryKey ? { primaryKey: { columns: table.primaryKey.columns } } : {},\n\t\tuniques,\n\t\tforeignKeys\n\t};\n}\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction issueLocation(tableName, columnName) {\n\treturn columnName !== void 0 ? {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\tcolumn: columnName\n\t} : {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t};\n}\n/**\n* Conflict kind for a node kind that `recreateTableStrategy` absorbs for\n* every reachable production issue. Reaching `mapNodeIssueToCall` for one of\n* these means the recreate strategy didn't run — mirrors the legacy\n* `conflictKindForIssue` per-kind categorization.\n*/\nfunction absorbedConflictKind(nodeKind) {\n\tswitch (nodeKind) {\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"indexIncompatible\";\n\t\tcase RelationalSchemaNodeKind.foreignKey: return \"foreignKeyConflict\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\n/**\n* Builds the `CreateTableCall` + per-index `CreateIndexCall`s for a\n* newly-expected table. Reads only the table node's own children — indexes\n* (declared + FK-backing, deduped) are already merged and ordered at\n* derivation (`contractToSchemaIR`'s `convertTable`).\n*/\nfunction buildCreateTableCalls(table) {\n\tconst columns = Object.values(table.columns).map((c) => ddlColumnFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst constraints = tableConstraintsFromNode(table, Object.values(table.columns).some((c) => isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst calls = [new CreateTableCall(table.name, columns, constraints.length > 0 ? constraints : void 0)];\n\tfor (const index of table.indexes) {\n\t\tconst indexName = index.name;\n\t\tcalls.push(new CreateIndexCall(table.name, indexName, index.columns ?? []));\n\t}\n\treturn calls;\n}\nfunction mapTableIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCalls(blindCast(issue.expected)));\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst table = blindCast(issue.actual);\n\t\tif (CONTROL_TABLE_NAMES.has(table.name)) return ok([]);\n\t\treturn ok([new DropTableCall(table.name)]);\n\t}\n\treturn notOk(issueConflict(\"unsupportedOperation\", `Unexpected table drift: ${issue.path.join(\"/\")}`));\n}\nfunction mapColumnIssue(issue, ctx) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Column issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\tconst table = ctx.expected.tables[tableName];\n\t\treturn ok([new AddColumnCall(tableName, columnSpecFromNode(column, table !== void 0 && isInlineAutoincrementPrimaryKeyNode(table, column)))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\treturn notOk(issueConflict(columnTypeChanged(expected, blindCast(issue.actual)) ? \"typeMismatch\" : \"nullabilityConflict\", issue.path.join(\"/\"), issueLocation(tableName, expected.name)));\n}\nfunction mapIndexIssue(issue) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Index issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst index = blindCast(issue.expected);\n\t\tconst indexName = index.name;\n\t\treturn ok([new CreateIndexCall(tableName, indexName, index.columns ?? [])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst indexName = blindCast(issue.actual).name;\n\t\treturn ok([new DropIndexCall(tableName, indexName)]);\n\t}\n\treturn notOk(issueConflict(\"indexIncompatible\", issue.path.join(\"/\"), issueLocation(tableName)));\n}\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tswitch (node.nodeKind) {\n\t\tcase RelationalSchemaNodeKind.table: return mapTableIssue(issue);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnIssue(issue, ctx);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexIssue(issue);\n\t\tcase RelationalSchemaNodeKind.columnDefault:\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return notOk(issueConflict(absorbedConflictKind(node.nodeKind), issue.path.join(\"/\")));\n\t\tcase RelationalSchemaNodeKind.check: return notOk(issueConflict(\"unsupportedOperation\", `SQLite does not support CHECK constraint DDL: ${issue.path.join(\"/\")}`));\n\t\tdefault: return notOk(issueConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createTable\": return \"create-table\";\n\t\tcase \"addColumn\": return \"add-column\";\n\t\tcase \"createIndex\": return \"create-index\";\n\t\tcase \"dropColumn\": return \"drop-column\";\n\t\tcase \"dropIndex\": return \"drop-index\";\n\t\tcase \"dropTable\": return \"drop-table\";\n\t\tcase \"recreateTable\": return null;\n\t\tdefault: return null;\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\texpected: options.expected ?? emptySchemaIR(),\n\t\tactual: options.actual ?? emptySchemaIR(),\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? sqlitePlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketableCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketableCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketableCalls;\n\tlet gatedDefault = defaultCalls;\n\tif (policyProvided) {\n\t\tconst sink = (acc) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tacc.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tconst gatedDefaultBucket = [];\n\t\trecipeCalls.forEach(sink(gatedRecipeBucket));\n\t\tbucketableCalls.forEach(sink(gatedBucketableBucket));\n\t\tdefaultCalls.forEach(sink(gatedDefaultBucket));\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t\tgatedDefault = gatedDefaultBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combined = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combined.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"create-table\"),\n\t\t...byCategory(\"add-column\"),\n\t\t...byCategory(\"create-index\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"drop-column\"),\n\t\t...byCategory(\"drop-index\"),\n\t\t...byCategory(\"drop-table\")\n\t] });\n}\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst location = {};\n\tif (\"tableName\" in call) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = call.tableName;\n\t}\n\tif (\"columnName\" in call) location.column = call.columnName;\n\tif (\"indexName\" in call) location.index = call.indexName;\n\treturn Object.keys(location).length > 0 ? location : void 0;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction createSqliteMigrationPlanner(lowerer) {\n\treturn new SqliteMigrationPlanner(lowerer);\n}\n/**\n* SQLite migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the live schema against the target contract via the one\n* differ (`buildSqlitePlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the registered strategies. Strategies\n* absorb groups of related issues into composite recipes (e.g. recreating a\n* table to apply type/nullability/default/constraint changes at once);\n* anything not absorbed by a strategy flows through `mapNodeIssueToCall` in\n* the issue planner as a one-off call.\n*\n* FK-backing indexes are already merged into the expected table node's\n* `indexes` at derivation (`contractToSchemaIR`'s `convertTable`), so\n* `mapNodeIssueToCall` handles them uniformly alongside user-declared\n* indexes — no separate expansion step in the planner.\n*/\nvar SqliteMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(options);\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderableSqliteMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, void 0, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tconst { expected, actual, issues } = this.collectSchemaIssues(options);\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst result = planIssues({\n\t\t\tissues,\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: sqlitePlannerStrategies\n\t\t});\n\t\tif (!result.ok) return plannerFailure(result.failure);\n\t\tconst fieldEventOps = planFieldEventOperations({\n\t\t\tpriorContract: options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks\n\t\t});\n\t\tconst calls = [...result.value.calls, ...fieldEventOps];\n\t\tconst destination = {\n\t\t\tstorageHash: options.contract.storage.storageHash,\n\t\t\t...options.contract.profileHash !== void 0 ? { profileHash: options.contract.profileHash } : {}\n\t\t};\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderableSqliteMigration(calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, destination, this.#lowerer)\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\t/**\n\t* Diffs the target contract against the live schema via the one differ\n\t* (the same tree-building `diffSqliteSchema` uses, plus the\n\t* op-render stamper) and prepares the issue list `planIssues` consumes.\n\t*\n\t* Three passes, in order:\n\t* 1. Subtree coalescing — the differ is total (a missing/extra table also\n\t* emits an issue for every column/constraint under it); those nested\n\t* issues are redundant once the table-level `CreateTable`/`DropTable`\n\t* call already accounts for the whole subtree. Runs FIRST, over the\n\t* complete diff: a sibling-owned extra table's column issues must\n\t* collapse into its one table-level issue before the ownership pass,\n\t* because a bare column node carries no table reference — if coalescing\n\t* ran after ownership dropped the table-level issue, the orphaned column\n\t* issues would survive and the planner would emit drops against a\n\t* sibling space's table.\n\t* 2. Ownership — a live extra is only this plan's to drop when no contract\n\t* space owns it. The differ ran against THIS space's contract, so a\n\t* table a sibling owns surfaces here as `not-expected`; the planner asks\n\t* the ownership oracle (the passive aggregate) whether any space declares\n\t* it and, if so, leaves it alone. A table no space owns stays a genuine\n\t* extra. Ownership lives in the aggregate; the planner only asks. No\n\t* oracle (single-space) keeps every extra.\n\t* 3. Strict-mode extras gating — `not-expected` (extra table/column/\n\t* constraint) issues are dropped entirely outside strict mode, mirroring\n\t* the retired coordinate walk's `if (strict) { ...extra_* } }` guards:\n\t* an additive-only plan must never even consider dropping an unclaimed\n\t* object, not just refuse to emit the drop.\n\t*/\n\tcollectSchemaIssues(options) {\n\t\tconst allowed = options.policy.allowedOperationClasses;\n\t\tconst strict = allowed.includes(\"widening\") || allowed.includes(\"destructive\");\n\t\tconst { expected, actual, issues: rawIssues } = buildSqlitePlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(rawIssues), options.ownership);\n\t\treturn {\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tissues: strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\")\n\t\t};\n\t}\n};\n/**\n* Drops a `not-expected` issue when it is a whole extra TABLE that some\n* contract space owns, asking the ownership oracle per node.\n*\n* The consultation applies ONLY to table-level extras — a live table this\n* space's contract lacks — identified by asking the issue's own node\n* (`nodeKind === table`), never by counting path segments. SQLite is a\n* single-namespace target, so every coordinate is qualified with the shared\n* `UNBOUND_NAMESPACE_ID` sentinel (the same one the aggregate's declared\n* entities carry for this target). `entityKind` is the literal `'table'`:\n* this function only ever asks about a node already confirmed to be\n* `RelationalSchemaNodeKind.table` (checked just above), and that's a\n* diff-tree `nodeKind` spelling (`'sql-table'`) distinct from the storage\n* `entries` vocabulary `elementCoordinates` walks (`'table'`) — the literal\n* is that storage-entries spelling. `declaresEntity` answers over the whole\n* composition (self included), so a positive answer on such a table means\n* another space owns it (a table this space owned would be in its expected\n* tree, never an extra): leave it. A negative answer means no space owns\n* it — a genuine orphan to drop.\n*\n* A DEEPER extra (an extra column/constraint on a table this space DOES own —\n* only the child drifted, so the table is in the expected tree) is this\n* space's own drift and is always kept for dropping; asking the oracle there\n* would wrongly suppress it, because the owned table answers `true`. No oracle\n* ⇒ every extra is kept (single-space plan).\n*/\nfunction retainUnownedExtras(issues, ownership) {\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 || node.nodeKind !== RelationalSchemaNodeKind.table) return true;\n\t\tconst tableName = issue.path[1];\n\t\treturn tableName === void 0 || !ownership.declaresEntity({\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t});\n}\n//#endregion\nexport { verifySqliteDatabaseSchema as a, sqliteContractToSchema as i, createSqliteMigrationPlanner as n, diffSqliteSchema as r, SqliteMigrationPlanner as t };\n\n//# sourceMappingURL=planner-B9A1yTAH.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,oBAAoB,KAAK,SAAS;CAC1C,IAAI,IAAI,SAAS,YAAY;EAC5B,IAAI,IAAI,eAAe,SAAS,OAAO;EACvC,OAAO,IAAI;CACZ;CACA,OAAO,qBAAqB,IAAI,KAAK;AACtC;;;;;;;;;;AAUA,SAAS,uBAAuB,UAAU,QAAQ;CACjD,OAAO,mBAAmB,UAAU;EACnC,qBAAqB;EACrB,eAAe;EACf,GAAG,UAAU,oBAAoB,QAAQ,gBAAgB;CAC1D,CAAC;AACF;;;;;;AAMA,SAAS,2BAA2B,OAAO;CAC1C,OAAO,sBAAsB;EAC5B,UAAU,MAAM;EAChB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,qBAAqB,MAAM;EAC3B,YAAY;EACZ,eAAe;CAChB,CAAC;AACF;;;;;;;;;AASA,SAAS,qBAAqB,OAAO,UAAU;CAC9C,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,KAAK,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,GAAG;EACnE,MAAM,QAAQ,SAAS,SAAS,SAAS;GACxC;GACA,YAAY;GACZ,YAAY;EACb,CAAC;EACD,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;CACpC;AACD;;;;;;;;;;AAUA,SAAS,iBAAiB,OAAO;CAChC,MAAM,mBAAmB,wBAAwB,MAAM,mBAAmB;CAC1E,MAAM,WAAW,uBAAuB,MAAM,UAAU,EAAE,GAAG,UAAU,oBAAoB,gBAAgB,EAAE,CAAC;CAC9G,MAAM,SAAS,MAAM,kBAAkB,cAAc,MAAM,SAAS,UAAU,MAAM,MAAM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gB,OAAO;EACnD,MAAM,OAAO,UAAU,KAAK;EAC5B,IAAI,SAAS,KAAK,KAAK,KAAK,aAAa,yBAAyB,OAAO,OAAO;EAChF,MAAM,YAAY,MAAM,KAAK;EAC7B,OAAO,cAAc,KAAK,KAAK,CAAC,UAAU,eAAe;GACxD,aAAa;GACb,YAAY;GACZ,YAAY;EACb,CAAC;CACF,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"planner-DuW2pz1t-DFhIqgV2.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-DuW2pz1t.mjs"],"sourcesContent":["import { a as DropColumnCall, d as buildRecreateSummary, h as renderDefaultLiteral, i as DataTransformCall, l as RecreateTableCall, m as buildColumnTypeSql, n as CreateIndexCall, o as DropIndexCall, p as buildColumnDefaultSql, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as buildRecreatePostchecks } from \"./op-factory-call-CsNFRTPS.mjs\";\nimport { t as CONTROL_TABLE_NAMES } from \"./control-tables-D_o8dKRB.mjs\";\nimport { t as TypeScriptRenderableSqliteMigration } from \"./planner-produced-sqlite-migration-DB3xleco.mjs\";\nimport { DdlColumn, ForeignKeyConstraint, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint } from \"@internal/sql-relational-core/ast\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { buildNativeTypeExpander, contractToSchemaIR, extractCodecControlHooks, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { verifySqlSchemaByDiff } from \"@internal/family-sql/diff\";\nimport { diffSchemas, issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\n//#region src/core/migrations/diff-database-schema.ts\n/** Renders a column default for the SQLite dialect. */\nfunction sqliteRenderDefault(def, _column) {\n\tif (def.kind === \"function\") {\n\t\tif (def.expression === \"now()\") return \"datetime('now')\";\n\t\treturn def.expression;\n\t}\n\treturn renderDefaultLiteral(def.value);\n}\n/**\n* The SQLite expected-side projection: contract → flat relational schema IR.\n*\n* `extras` thread the plan-time derivation input: the native-type expander,\n* so the expected side carries resolved native types (like the verify\n* side). Every expected column also carries its `codecRef` unconditionally\n* (Decision 5) — the planner's op-builders resolve DDL rendering from it at\n* plan time, so no separate render stamper is threaded here.\n*/\nfunction sqliteContractToSchema(contract, extras) {\n\treturn contractToSchemaIR(contract, {\n\t\tannotationNamespace: \"sqlite\",\n\t\trenderDefault: sqliteRenderDefault,\n\t\t...ifDefined(\"expandNativeType\", extras?.expandNativeType)\n\t});\n}\n/**\n* The SQLite schema verify: the full-tree node-diff verdict wrapped in the\n* issue-based result envelope. Used by the runner's post-apply check; the\n* family `verifySchema` runs the same composition via the descriptor hook.\n*/\nfunction verifySqliteDatabaseSchema(input) {\n\treturn verifySqlSchemaByDiff({\n\t\tcontract: input.contract,\n\t\tschema: input.actualSchema,\n\t\tstrict: input.strict,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tdiffSchema: diffSqliteSchema,\n\t\tgranularityOf: relationalNodeGranularity\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject table's declared control policy\n* directly from the contract. SQLite's expected tree is flat, so the issue\n* path carries no namespace segment — `path[1]` is the table name (`path[0]`\n* is the tree root's own id); every contract namespace is searched for that\n* table name (table names are globally unique in the flat tree — duplicates\n* across namespaces are rejected earlier, at `contractToSchemaIR`).\n*/\nfunction resolveControlPolicy(issue, contract) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return void 0;\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst table = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (table !== void 0) return table.control;\n\t}\n}\n/**\n* The SQLite full-tree node diff for the family verify verdict: derive the\n* expected flat tree with resolved leaf values (expander threaded so\n* parameterized types compare expanded; FK nodes born with the flat empty\n* `resolvedReferencedNamespace`), and run the generic differ over the trees\n* as derived. Flat targets need no ownership scoping. The codec `verifyType`\n* hooks run once per contract namespace with tables, each against the sole\n* flat actual root — exactly the legacy per-namespace pairing.\n*/\nfunction diffSqliteSchema(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = input.schema instanceof SqlSchemaIR ? input.schema : blindCast(input.schema);\n\treturn {\n\t\tissues: diffSchemas(expected, actual),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, input.contract),\n\t\tnamespacePairs: Object.values(input.contract.storage.namespaces).filter((ns) => Object.keys(ns.entries.table ?? {}).length > 0).map(() => ({ actual }))\n\t};\n}\n/**\n* The SQLite planner's diff input: the same tree-building\n* `diffSqliteSchema` uses (expander threaded, FK nodes born flat). One differ\n* drives both verify and plan over the trees as derived; this is the plan-side\n* derivation — column DDL resolves from each expected column's `codecRef` at\n* plan time (`column-ddl-rendering.ts`), so no separate render stamping happens here.\n*/\nfunction buildSqlitePlanDiff(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = new SqlSchemaIR(withRecordKeyNames(input.actualSchema));\n\treturn {\n\t\texpected,\n\t\tactual,\n\t\tissues: diffSchemas(expected, actual)\n\t};\n}\n/**\n* Every schema-tree builder in this codebase derives a table's / column's\n* `name` from the record key it's stored under (`contractToSchemaIR`,\n* the SQLite introspection adapter) rather than trusting a redundant\n* embedded field — the record key IS the identity. Mirrors that discipline\n* for the actual/live tree before construction, so `SqlTableIR.id` /\n* `SqlColumnIR.id` (both derived from `.name`) are always correct without\n* requiring every caller to duplicate the key onto the value. A no-op for a\n* tree that already carries matching names (the real introspection adapter\n* always does).\n*/\nfunction withRecordKeyNames(actualSchema) {\n\tconst raw = blindCast(actualSchema);\n\tconst tables = {};\n\tfor (const [tableName, table] of Object.entries(raw.tables ?? {})) {\n\t\tconst rawTable = blindCast(table);\n\t\tconst columns = {};\n\t\tfor (const [columnName, column] of Object.entries(blindCast(table).columns ?? {})) columns[columnName] = {\n\t\t\t...blindCast(column),\n\t\t\tname: columnName\n\t\t};\n\t\ttables[tableName] = {\n\t\t\t...rawTable,\n\t\t\tname: tableName,\n\t\t\tcolumns,\n\t\t\tforeignKeys: rawTable.foreignKeys ?? [],\n\t\t\tuniques: rawTable.uniques ?? [],\n\t\t\tindexes: rawTable.indexes ?? []\n\t\t};\n\t}\n\treturn { tables };\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields `buildColumnTypeSql` /\n* `buildColumnDefaultSql` expect, from a column node's own stamped codec\n* identity (`codecRef` / `codecBaseNativeType`, Decision 5) — never the\n* contract. SQLite's type renderer only uppercases the resolved base type\n* (no parameterized expansion, no named-type quoting), so `typeRef` is\n* deliberately left unset here: setting it would send `buildColumnTypeSql`\n* back through a live `storageTypes` lookup the node's fields have already\n* resolved past, which throws for an unrecognized reference (unlike\n* Postgres's lenient fallback).\n*/\nfunction columnLike(column) {\n\tif (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column \"${column.name}\" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: column.codecBaseNativeType,\n\t\tcodecId: column.codecRef.codecId,\n\t\tnullable: column.nullable,\n\t\t...(column.many ?? column.codecRef.many) !== void 0 ? { many: column.many ?? column.codecRef.many } : {},\n\t\t...column.codecRef.typeParams !== void 0 ? { typeParams: blindCast(column.codecRef.typeParams) } : {},\n\t\t...column.resolvedDefault !== void 0 ? { default: column.resolvedDefault } : {}\n\t};\n}\nfunction sqliteDefaultToDdlColumnDefault(columnDefault) {\n\tif (!columnDefault) return void 0;\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return new LiteralColumnDefault(columnDefault.value);\n\t\tcase \"function\":\n\t\t\tif (columnDefault.expression === \"autoincrement()\") return void 0;\n\t\t\treturn new FunctionColumnDefault(columnDefault.expression);\n\t\tdefault: {\n\t\t\tconst exhaustive = columnDefault;\n\t\t\treturn assertNever(exhaustive, `sqliteDefaultToDdlColumnDefault: unhandled kind \"${blindCast(exhaustive).kind}\"`);\n\t\t}\n\t}\n}\n/**\n* True when the column is rendered inline as `INTEGER PRIMARY KEY\n* AUTOINCREMENT` — the sole member of the table's primary key with an\n* `autoincrement()` default. Node-based sibling of the retired\n* `isInlineAutoincrementPrimaryKey` (which read the raw `StorageTable`);\n* reads the table/column nodes instead.\n*/\nfunction isInlineAutoincrementPrimaryKeyNode(table, column) {\n\tif (table.primaryKey?.columns.length !== 1) return false;\n\tif (table.primaryKey.columns[0] !== column.name) return false;\n\treturn column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\";\n}\n/**\n* Builds the flat `SqliteColumnSpec` `AddColumnCall` / `RecreateTableCall`\n* need, resolved from the column node's codec identity — the same builders\n* the pre-`plan(start, end)` op-path called, so the output is\n* byte-identical.\n*/\nfunction columnSpecFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tconst defaultSql = buildColumnDefaultSql(like.default);\n\treturn {\n\t\tname: column.name,\n\t\ttypeSql,\n\t\tdefaultSql,\n\t\tnullable: column.nullable,\n\t\t...inline ? { inlineAutoincrementPrimaryKey: true } : {}\n\t};\n}\n/**\n* Builds the `DdlColumn` the `CreateTableCall` path needs, resolved from the\n* column node's codec identity.\n*/\nfunction ddlColumnFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tif (inline) return new DdlColumn({\n\t\tname: column.name,\n\t\ttype: `${typeSql} PRIMARY KEY AUTOINCREMENT`\n\t});\n\tconst colDefault = sqliteDefaultToDdlColumnDefault(like.default);\n\treturn new DdlColumn({\n\t\tname: column.name,\n\t\ttype: typeSql,\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...colDefault !== void 0 ? { default: colDefault } : {},\n\t\t...column.codecRef !== void 0 ? { codecRef: column.codecRef } : {}\n\t});\n}\n/**\n* Builds the table-level constraints (PK / unique / FK) for a `CreateTable`\n* path from the table node — the node-sourced sibling of the retired\n* contract-based `tableToDdlParts`'s constraint half.\n*/\nfunction tableConstraintsFromNode(table, hasInlinePk) {\n\tconst constraints = [];\n\tif (table.primaryKey && !hasInlinePk) constraints.push(new PrimaryKeyConstraint({ columns: table.primaryKey.columns }));\n\tfor (const u of table.uniques) constraints.push(new UniqueConstraint({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tfor (const fk of table.foreignKeys) constraints.push(new ForeignKeyConstraint({\n\t\tcolumns: fk.columns,\n\t\trefTable: fk.referencedTable,\n\t\trefColumns: fk.referencedColumns,\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn constraints;\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Classifies a node issue into the operation class a recreate absorbing it\n* would need, or `null` when the strategy doesn't handle this node/reason at\n* all (table/column not-found-or-not-expected, and index issues — those are\n* standalone ops, never folded into a recreate).\n*\n* Column drift is a single `not-equal` issue now (type AND nullability\n* compared together by `SqlColumnIR.isEqualTo`), so this reads both fields\n* off the node pair directly rather than trusting a separate issue kind per\n* attribute: a type change is always destructive; a pure nullability change\n* is destructive when tightening (NOT NULL required) and widening when\n* relaxing.\n*/\nfunction classifyNodeIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return null;\n\tswitch (blindCast(node).nodeKind) {\n\t\tcase RelationalSchemaNodeKind.column: {\n\t\t\tif (issueOutcome(issue) !== \"not-equal\") return null;\n\t\t\tconst expected = blindCast(issue.expected);\n\t\t\tif (columnTypeChanged(expected, blindCast(issue.actual))) return \"destructive\";\n\t\t\treturn expected.nullable ? \"widening\" : \"destructive\";\n\t\t}\n\t\tcase RelationalSchemaNodeKind.columnDefault: return issueOutcome(issue) === \"not-expected\" ? \"destructive\" : \"widening\";\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"destructive\";\n\t\tdefault: return null;\n\t}\n}\n/**\n* Groups recreate-eligible issues by table, decides per-table operation class\n* (destructive wins over widening), and emits one `RecreateTableCall` per\n* table. Returns unchanged-or-smaller issue list — issues the strategy\n* consumed are removed so `mapNodeIssueToCall` doesn't double-handle them.\n*\n* The full desired/live table shapes come from `ctx.expected`/`ctx.actual`\n* directly (keyed by table name — SQLite is a flat, single-namespace target)\n* rather than from any individual issue, since a single drifted attribute's\n* issue only carries that attribute's own node, never the whole table.\n*/\nconst recreateTableStrategy = (issues, ctx) => {\n\tconst byTable = /* @__PURE__ */ new Map();\n\tconst consumed = /* @__PURE__ */ new Set();\n\tfor (const issue of issues) {\n\t\tconst cls = classifyNodeIssue(issue);\n\t\tif (!cls) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tconst entry = byTable.get(tableName);\n\t\tif (entry) {\n\t\t\tentry.issues.push(issue);\n\t\t\tif (cls === \"destructive\") entry.hasDestructive = true;\n\t\t} else byTable.set(tableName, {\n\t\t\tissues: [issue],\n\t\t\thasDestructive: cls === \"destructive\"\n\t\t});\n\t\tconsumed.add(issue);\n\t}\n\tif (byTable.size === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [tableName, entry] of byTable) {\n\t\tconst expectedTable = ctx.expected.tables[tableName];\n\t\tconst actualTable = ctx.actual.tables[tableName];\n\t\tif (!expectedTable || !actualTable) continue;\n\t\tconst operationClass = entry.hasDestructive ? \"destructive\" : \"widening\";\n\t\tconst tableSpec = tableSpecFromNode(expectedTable);\n\t\tconst indexes = expectedTable.indexes.map((idx) => ({\n\t\t\tname: idx.name,\n\t\t\tcolumns: idx.columns ?? []\n\t\t}));\n\t\tcalls.push(new RecreateTableCall({\n\t\t\ttableName,\n\t\t\tcontractTable: tableSpec,\n\t\t\tschemaColumnNames: Object.keys(actualTable.columns),\n\t\t\tindexes,\n\t\t\tsummary: buildRecreateSummary(tableName, entry.issues),\n\t\t\tpostchecks: buildRecreatePostchecks(tableName, entry.issues, tableSpec),\n\t\t\toperationClass\n\t\t}));\n\t}\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !consumed.has(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* When the policy allows `'data'` and the expected tree tightens one or more\n* columns from nullable to NOT NULL, emit a `DataTransformCall` stub per\n* tightened column. The user fills the backfill `UPDATE` in the rendered\n* `migration.ts` before the subsequent `RecreateTableCall` copies data into\n* the tightened schema (whose `INSERT INTO temp SELECT … FROM old` would\n* otherwise fail at runtime if any `NULL`s remain).\n*\n* Does NOT consume the tightening issue — `recreateTableStrategy` still\n* needs it to produce the actual recreate that enforces the NOT NULL at\n* the schema level. The backfill op and the recreate op end up in the\n* recipe slot in strategy order (backfill first, recreate second), which\n* matches the required execution order.\n*\n* Mirrors Postgres's `nullableTighteningCallStrategy` / `'data'`-class\n* gating. When `'data'` is not in the policy (the default `db update` /\n* `db init` path), the strategy short-circuits and the recreate alone\n* runs with its current destructive-class gating — preserving today's\n* behavior where a tightening blows up at runtime if NULLs are present.\n*/\nconst nullabilityTighteningBackfillStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\" || issue.expected === void 0 || issue.actual === void 0) continue;\n\t\tif (blindCast(issue.expected).nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expectedColumn = blindCast(issue.expected);\n\t\tconst actualColumn = blindCast(issue.actual);\n\t\tif (expectedColumn.nullable === actualColumn.nullable) continue;\n\t\tif (expectedColumn.nullable) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tcalls.push(new DataTransformCall(`data_migration.backfill-${tableName}-${expectedColumn.name}`, `Backfill NULLs in \"${tableName}\".\"${expectedColumn.name}\" before NOT NULL tightening`, tableName, expectedColumn.name));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst sqlitePlannerStrategies = [nullabilityTighteningBackfillStrategy, recreateTableStrategy];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree (columns, defaults,\n* constraints, indexes). `CreateTableCall`/`DropTableCall` and\n* `AddColumnCall`/`DropColumnCall` already account for the whole subtree\n* (reading it directly off the table/column node), so the nested issues are\n* redundant — coalescing them is \"the planner's responsibility\" the differ's\n* own contract assigns (`schema-diff.ts`). Drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path.\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) === \"not-found\" || issueOutcome(issue) === \"not-expected\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* Builds the flat `SqliteTableSpec` `RecreateTableCall` needs from the\n* expected table node — the node-sourced equivalent of the retired\n* `toTableSpec` (which read a raw contract `StorageTable`). Every column's\n* spec is resolved from its `codecRef` via `columnSpecFromNode`.\n*/\nfunction tableSpecFromNode(table) {\n\tconst columns = Object.values(table.columns).map((c) => columnSpecFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst uniques = table.uniques.map((u) => ({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tconst foreignKeys = table.foreignKeys.map((fk) => ({\n\t\tcolumns: fk.columns,\n\t\treferences: {\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: fk.referencedColumns\n\t\t},\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn {\n\t\tcolumns,\n\t\t...table.primaryKey ? { primaryKey: { columns: table.primaryKey.columns } } : {},\n\t\tuniques,\n\t\tforeignKeys\n\t};\n}\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction issueLocation(tableName, columnName) {\n\treturn columnName !== void 0 ? {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\tcolumn: columnName\n\t} : {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t};\n}\n/**\n* Conflict kind for a node kind that `recreateTableStrategy` absorbs for\n* every reachable production issue. Reaching `mapNodeIssueToCall` for one of\n* these means the recreate strategy didn't run — mirrors the legacy\n* `conflictKindForIssue` per-kind categorization.\n*/\nfunction absorbedConflictKind(nodeKind) {\n\tswitch (nodeKind) {\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"indexIncompatible\";\n\t\tcase RelationalSchemaNodeKind.foreignKey: return \"foreignKeyConflict\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\n/**\n* Builds the `CreateTableCall` + per-index `CreateIndexCall`s for a\n* newly-expected table. Reads only the table node's own children — indexes\n* (declared + FK-backing, deduped) are already merged and ordered at\n* derivation (`contractToSchemaIR`'s `convertTable`).\n*/\nfunction buildCreateTableCalls(table) {\n\tconst columns = Object.values(table.columns).map((c) => ddlColumnFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst constraints = tableConstraintsFromNode(table, Object.values(table.columns).some((c) => isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst calls = [new CreateTableCall(table.name, columns, constraints.length > 0 ? constraints : void 0)];\n\tfor (const index of table.indexes) {\n\t\tconst indexName = index.name;\n\t\tcalls.push(new CreateIndexCall(table.name, indexName, index.columns ?? []));\n\t}\n\treturn calls;\n}\nfunction mapTableIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCalls(blindCast(issue.expected)));\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst table = blindCast(issue.actual);\n\t\tif (CONTROL_TABLE_NAMES.has(table.name)) return ok([]);\n\t\treturn ok([new DropTableCall(table.name)]);\n\t}\n\treturn notOk(issueConflict(\"unsupportedOperation\", `Unexpected table drift: ${issue.path.join(\"/\")}`));\n}\nfunction mapColumnIssue(issue, ctx) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Column issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\tconst table = ctx.expected.tables[tableName];\n\t\treturn ok([new AddColumnCall(tableName, columnSpecFromNode(column, table !== void 0 && isInlineAutoincrementPrimaryKeyNode(table, column)))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\treturn notOk(issueConflict(columnTypeChanged(expected, blindCast(issue.actual)) ? \"typeMismatch\" : \"nullabilityConflict\", issue.path.join(\"/\"), issueLocation(tableName, expected.name)));\n}\nfunction mapIndexIssue(issue) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Index issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst index = blindCast(issue.expected);\n\t\tconst indexName = index.name;\n\t\treturn ok([new CreateIndexCall(tableName, indexName, index.columns ?? [])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst indexName = blindCast(issue.actual).name;\n\t\treturn ok([new DropIndexCall(tableName, indexName)]);\n\t}\n\treturn notOk(issueConflict(\"indexIncompatible\", issue.path.join(\"/\"), issueLocation(tableName)));\n}\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tswitch (node.nodeKind) {\n\t\tcase RelationalSchemaNodeKind.table: return mapTableIssue(issue);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnIssue(issue, ctx);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexIssue(issue);\n\t\tcase RelationalSchemaNodeKind.columnDefault:\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return notOk(issueConflict(absorbedConflictKind(node.nodeKind), issue.path.join(\"/\")));\n\t\tcase RelationalSchemaNodeKind.check: return notOk(issueConflict(\"unsupportedOperation\", `SQLite does not support CHECK constraint DDL: ${issue.path.join(\"/\")}`));\n\t\tdefault: return notOk(issueConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createTable\": return \"create-table\";\n\t\tcase \"addColumn\": return \"add-column\";\n\t\tcase \"createIndex\": return \"create-index\";\n\t\tcase \"dropColumn\": return \"drop-column\";\n\t\tcase \"dropIndex\": return \"drop-index\";\n\t\tcase \"dropTable\": return \"drop-table\";\n\t\tcase \"recreateTable\": return null;\n\t\tdefault: return null;\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\texpected: options.expected ?? emptySchemaIR(),\n\t\tactual: options.actual ?? emptySchemaIR(),\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? sqlitePlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketableCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketableCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketableCalls;\n\tlet gatedDefault = defaultCalls;\n\tif (policyProvided) {\n\t\tconst sink = (acc) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tacc.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tconst gatedDefaultBucket = [];\n\t\trecipeCalls.forEach(sink(gatedRecipeBucket));\n\t\tbucketableCalls.forEach(sink(gatedBucketableBucket));\n\t\tdefaultCalls.forEach(sink(gatedDefaultBucket));\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t\tgatedDefault = gatedDefaultBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combined = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combined.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"create-table\"),\n\t\t...byCategory(\"add-column\"),\n\t\t...byCategory(\"create-index\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"drop-column\"),\n\t\t...byCategory(\"drop-index\"),\n\t\t...byCategory(\"drop-table\")\n\t] });\n}\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst location = {};\n\tif (\"tableName\" in call) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = call.tableName;\n\t}\n\tif (\"columnName\" in call) location.column = call.columnName;\n\tif (\"indexName\" in call) location.index = call.indexName;\n\treturn Object.keys(location).length > 0 ? location : void 0;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction createSqliteMigrationPlanner(lowerer) {\n\treturn new SqliteMigrationPlanner(lowerer);\n}\n/**\n* SQLite migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the live schema against the target contract via the one\n* differ (`buildSqlitePlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the registered strategies. Strategies\n* absorb groups of related issues into composite recipes (e.g. recreating a\n* table to apply type/nullability/default/constraint changes at once);\n* anything not absorbed by a strategy flows through `mapNodeIssueToCall` in\n* the issue planner as a one-off call.\n*\n* FK-backing indexes are already merged into the expected table node's\n* `indexes` at derivation (`contractToSchemaIR`'s `convertTable`), so\n* `mapNodeIssueToCall` handles them uniformly alongside user-declared\n* indexes — no separate expansion step in the planner.\n*/\nvar SqliteMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(options);\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderableSqliteMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, void 0, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tconst { expected, actual, issues } = this.collectSchemaIssues(options);\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst result = planIssues({\n\t\t\tissues,\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: sqlitePlannerStrategies\n\t\t});\n\t\tif (!result.ok) return plannerFailure(result.failure);\n\t\tconst fieldEventOps = planFieldEventOperations({\n\t\t\tpriorContract: options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks\n\t\t});\n\t\tconst calls = [...result.value.calls, ...fieldEventOps];\n\t\tconst destination = {\n\t\t\tstorageHash: options.contract.storage.storageHash,\n\t\t\t...options.contract.profileHash !== void 0 ? { profileHash: options.contract.profileHash } : {}\n\t\t};\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderableSqliteMigration(calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, destination, this.#lowerer)\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\t/**\n\t* Diffs the target contract against the live schema via the one differ\n\t* (the same tree-building `diffSqliteSchema` uses, plus the\n\t* op-render stamper) and prepares the issue list `planIssues` consumes.\n\t*\n\t* Three passes, in order:\n\t* 1. Subtree coalescing — the differ is total (a missing/extra table also\n\t* emits an issue for every column/constraint under it); those nested\n\t* issues are redundant once the table-level `CreateTable`/`DropTable`\n\t* call already accounts for the whole subtree. Runs FIRST, over the\n\t* complete diff: a sibling-owned extra table's column issues must\n\t* collapse into its one table-level issue before the ownership pass,\n\t* because a bare column node carries no table reference — if coalescing\n\t* ran after ownership dropped the table-level issue, the orphaned column\n\t* issues would survive and the planner would emit drops against a\n\t* sibling space's table.\n\t* 2. Ownership — a live extra is only this plan's to drop when no contract\n\t* space owns it. The differ ran against THIS space's contract, so a\n\t* table a sibling owns surfaces here as `not-expected`; the planner asks\n\t* the ownership oracle (the passive aggregate) whether any space declares\n\t* it and, if so, leaves it alone. A table no space owns stays a genuine\n\t* extra. Ownership lives in the aggregate; the planner only asks. No\n\t* oracle (single-space) keeps every extra.\n\t* 3. Strict-mode extras gating — `not-expected` (extra table/column/\n\t* constraint) issues are dropped entirely outside strict mode, mirroring\n\t* the retired coordinate walk's `if (strict) { ...extra_* } }` guards:\n\t* an additive-only plan must never even consider dropping an unclaimed\n\t* object, not just refuse to emit the drop.\n\t*/\n\tcollectSchemaIssues(options) {\n\t\tconst allowed = options.policy.allowedOperationClasses;\n\t\tconst strict = allowed.includes(\"widening\") || allowed.includes(\"destructive\");\n\t\tconst { expected, actual, issues: rawIssues } = buildSqlitePlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(rawIssues), options.ownership);\n\t\treturn {\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tissues: strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\")\n\t\t};\n\t}\n};\n/**\n* Drops a `not-expected` issue when it is a whole extra TABLE that some\n* contract space owns, asking the ownership oracle per node.\n*\n* The consultation applies ONLY to table-level extras — a live table this\n* space's contract lacks — identified by asking the issue's own node\n* (`nodeKind === table`), never by counting path segments. SQLite is a\n* single-namespace target, so every coordinate is qualified with the shared\n* `UNBOUND_NAMESPACE_ID` sentinel (the same one the aggregate's declared\n* entities carry for this target). `entityKind` is the literal `'table'`:\n* this function only ever asks about a node already confirmed to be\n* `RelationalSchemaNodeKind.table` (checked just above), and that's a\n* diff-tree `nodeKind` spelling (`'sql-table'`) distinct from the storage\n* `entries` vocabulary `elementCoordinates` walks (`'table'`) — the literal\n* is that storage-entries spelling. `declaresEntity` answers over the whole\n* composition (self included), so a positive answer on such a table means\n* another space owns it (a table this space owned would be in its expected\n* tree, never an extra): leave it. A negative answer means no space owns\n* it — a genuine orphan to drop.\n*\n* A DEEPER extra (an extra column/constraint on a table this space DOES own —\n* only the child drifted, so the table is in the expected tree) is this\n* space's own drift and is always kept for dropping; asking the oracle there\n* would wrongly suppress it, because the owned table answers `true`. No oracle\n* ⇒ every extra is kept (single-space plan).\n*/\nfunction retainUnownedExtras(issues, ownership) {\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 || node.nodeKind !== RelationalSchemaNodeKind.table) return true;\n\t\tconst tableName = issue.path[1];\n\t\treturn tableName === void 0 || !ownership.declaresEntity({\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t});\n}\n//#endregion\nexport { verifySqliteDatabaseSchema as a, sqliteContractToSchema as i, createSqliteMigrationPlanner as n, diffSqliteSchema as r, SqliteMigrationPlanner as t };\n\n//# sourceMappingURL=planner-DuW2pz1t.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,oBAAoB,KAAK,SAAS;CAC1C,IAAI,IAAI,SAAS,YAAY;EAC5B,IAAI,IAAI,eAAe,SAAS,OAAO;EACvC,OAAO,IAAI;CACZ;CACA,OAAO,qBAAqB,IAAI,KAAK;AACtC;;;;;;;;;;AAUA,SAAS,uBAAuB,UAAU,QAAQ;CACjD,OAAO,mBAAmB,UAAU;EACnC,qBAAqB;EACrB,eAAe;EACf,GAAG,UAAU,oBAAoB,QAAQ,gBAAgB;CAC1D,CAAC;AACF;;;;;;AAMA,SAAS,2BAA2B,OAAO;CAC1C,O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;GACN,SAAS;GACT,KAAK;EACN,CAAC,CAAC;EACF,OAAO;CACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BA,oBAAoB,SAAS;EAC5B,MAAM,UAAU,QAAQ,OAAO;EAC/B,MAAM,SAAS,QAAQ,SAAS,UAAU,KAAK,QAAQ,SAAS,aAAa;EAC7E,MAAM,EAAE,UAAU,QAAQ,QAAQ,cAAc,oBAAoB;GACnE,UAAU,QAAQ;GAClB,cAAc,QAAQ;GACtB,qBAAqB,QAAQ;EAC9B,CAAC;EACD,MAAM,QAAQ,oBAAoB,sBAAsB,SAAS,GAAG,QAAQ,SAAS;EACrF,OAAO;GACN;GACA;GACA,QAAQ,SAAS,QAAQ,MAAM,QAAQ,UAAU,aAAa,KAAK,MAAM,cAAc;EACxF;CACD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,oBAAoB,QAAQ,WAAW;CAC/C,IAAI,cAAc,KAAK,GAAG,OAAO;CACjC,OAAO,OAAO,QAAQ,UAAU;EAC/B,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;EACnD,MAAM,OAAO,UAAU,KAAK;EAC5B,IAAI,SAAS,KAAK,KAAK,KAAK,aAAa,yBAAyB,OAAO,OAAO;EAChF,MAAM,YAAY,MAAM,KAAK;EAC7B,OAAO,cAAc,KAAK,KAAK,CAAC,UAAU,eAAe;GACxD,aAAa;GACb,YAAY;GACZ,YAAY;EACb,CAAC;CACF,CAAC;AACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as renderOps } from "./render-ops-DIOn_wOx-D33LOy3b.mjs";
|
|
2
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-MGxXxUB4-zfSNsC-a.mjs";
|
|
3
3
|
import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { renderImports } from "@prisma/orm-framework/ts-render";
|
|
5
5
|
import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
6
6
|
import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
|
|
7
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-
|
|
7
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-DB3xleco.mjs
|
|
8
8
|
/**
|
|
9
9
|
* Polymorphic TypeScript emitter for the SQLite migration IR. Mirrors the
|
|
10
10
|
* Postgres `render-typescript.ts` — different base-class + factory module
|
|
@@ -147,4 +147,4 @@ var TypeScriptRenderableSqliteMigration = class extends SqliteMigration {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
export { TypeScriptRenderableSqliteMigration as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=planner-produced-sqlite-migration-
|
|
150
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-DB3xleco-C1ncLSxE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-produced-sqlite-migration-
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-DB3xleco-C1ncLSxE.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#destination","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-DB3xleco.mjs"],"sourcesContent":["import { t as renderOps } from \"./render-ops-DIOn_wOx.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-MGxXxUB4.mjs\";\nimport { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from \"@internal/framework-components/control\";\nimport { renderImports } from \"@internal/ts-render\";\nimport { resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\n//#region src/core/migrations/render-typescript.ts\n/**\n* Polymorphic TypeScript emitter for the SQLite migration IR. Mirrors the\n* Postgres `render-typescript.ts` — different base-class + factory module\n* specifier, same overall shape.\n*/\n/**\n* Always-present base imports for the rendered scaffold. Both come from\n* `@internal/sqlite/migration` so an authored SQLite\n* `migration.ts` only needs a single dependency for its base class and\n* its CLI entrypoint. Mirrors Postgres's `BASE_IMPORTS`.\n*\n* - `Migration` — the facade re-export fixes the `SqlMigration`\n* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to\n* `'sqlite'`.\n* - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from\n* `@internal/cli/migration-cli`. Loads `prisma-next.config.ts`,\n* assembles a `ControlStack`, and instantiates the migration class.\n*/\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: \"@internal/sqlite/migration\",\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: \"@internal/sqlite/migration\",\n\tsymbol: \"MigrationCLI\"\n}];\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`export default class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\treturn renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));\n}\n/**\n* The committed contract-JSON imports the scaffold reads its from/to identity\n* from, resolved to the deduplicated snapshot store under\n* `meta.snapshotsImportPath`. The end snapshot is always present; the start\n* snapshot is added only for a non-baseline migration (`meta.from !== null`).\n* The matching `Contract` type imports (aliased `Start`/`End`) feed the\n* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n* no start imports — `never` is the honest \"no prior contract\" Start.\n*/\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/migrations/planner-produced-sqlite-migration.ts\nvar TypeScriptRenderableSqliteMigration = class extends SqliteMigration {\n\t#calls;\n\t#meta;\n\t#destination;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, destination, 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.#destination = destination ?? { storageHash: meta.to };\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\tget destination() {\n\t\treturn this.#destination;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from {@link SqlMigrationPlannerPlanOptions.spaceId} so the runner\n\t* keys the marker row by 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 { TypeScriptRenderableSqliteMigration as t };\n\n//# sourceMappingURL=planner-produced-sqlite-migration-DB3xleco.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,eAAe,CAAC;CACrB,iBAAiB;CACjB,QAAQ;AACT,GAAG;CACF,iBAAiB;CACjB,QAAQ;AACT,CAAC;AACD,SAAS,wBAAwB,OAAO,MAAM;CAC7C,MAAM,UAAU,aAAa,OAAO,IAAI;CACxC,MAAM,iBAAiB,MAAM,KAAK,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,KAAK;CACxE,MAAM,WAAW,KAAK,SAAS;CAC/B,MAAM,aAAa,WAAW,CAAC,wDAAwD,IAAI,CAAC;CAC5F,OAAO;EACN,eAAe,sBAAsB,CAAC;EACtC;EACA;EACA,4CAA4C,WAAW,UAAU,QAAQ;EACzE,GAAG;EACH;EACA;EACA;EACA;EACA,OAAO,gBAAgB,CAAC;EACxB;EACA;EACA;EACA;EACA;EACA;CACD,CAAC,CAAC,K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,KAAKC,eAAe,eAAe,EAAE,aAAa,KAAK,GAAG;EAC1D,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKN,QAAQ,KAAKK,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKL;CACb;CACA,IAAI,cAAc;EACjB,OAAO,KAAKG;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKF;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"}
|
package/dist/{sqlite-migration-DWl9RerP-X0sf9N80.mjs → sqlite-migration-MGxXxUB4-zfSNsC-a.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as errorSqliteMigrationStackMissing } from "./errors-CKsaaSnD-BeB4JS8h.mjs";
|
|
2
|
-
import { a as DropColumnCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-
|
|
2
|
+
import { a as DropColumnCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-CsNFRTPS-HuMdWaBX.mjs";
|
|
3
3
|
import { n as SqliteContractView } from "./sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs";
|
|
4
4
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
5
|
import { Migration } from "@prisma/orm-family-sql/family/migration";
|
|
6
6
|
import { MigrationContractViews } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
7
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/sqlite-migration-
|
|
7
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/sqlite-migration-MGxXxUB4.mjs
|
|
8
8
|
/**
|
|
9
9
|
* Target-owned base class for SQLite migrations. Fixes the `SqlMigration`
|
|
10
10
|
* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the
|
|
@@ -91,4 +91,4 @@ var SqliteMigration = class extends Migration {
|
|
|
91
91
|
//#endregion
|
|
92
92
|
export { SqliteMigration as t };
|
|
93
93
|
|
|
94
|
-
//# sourceMappingURL=sqlite-migration-
|
|
94
|
+
//# sourceMappingURL=sqlite-migration-MGxXxUB4-zfSNsC-a.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-migration-
|
|
1
|
+
{"version":3,"file":"sqlite-migration-MGxXxUB4-zfSNsC-a.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/sqlite/dist/sqlite-migration-MGxXxUB4.mjs"],"sourcesContent":["import { t as errorSqliteMigrationStackMissing } from \"./errors-CKsaaSnD.mjs\";\nimport { a as DropColumnCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from \"./op-factory-call-CsNFRTPS.mjs\";\nimport { t as SqliteContractView } from \"./sqlite-contract-view-CnDITHEE.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/sqlite-migration.ts\n/**\n* Target-owned base class for SQLite migrations. Fixes the `SqlMigration`\n* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the\n* SQLite literal, so both user-authored migrations and renderer-generated\n* scaffolds can extend `SqliteMigration` directly without redeclaring\n* target-local identity.\n*\n* The constructor materializes a single SQLite `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected instance methods\n* forward to the corresponding `*Call` with that stored adapter, so user\n* migrations can write `this.createTable({...})` without threading the adapter\n* through every call.\n*\n* Binds the framework base's `Start` / `End` contract generics so a subclass\n* that assigns its snapshot-store `contract.json` imports to\n* `startContractJson` / `endContractJson` gets fully-typed view accessors:\n* `this.endContract` is a `SqliteContractView<End>`\n* (sole namespace unwrapped to the root — `this.endContract.table.<name>`),\n* built lazily from the JSON fields via the shared `MigrationContractViews`\n* helper. Mirrors `MongoMigration`'s view getters; the framework base derives\n* `describe()` from the same JSON.\n*/\nvar SqliteMigration = class extends Migration {\n\ttargetId = \"sqlite\";\n\t/**\n\t* Materialized SQLite control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t#endView = new MigrationContractViews(this, \"SqliteMigration\", (json) => SqliteContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"SqliteMigration\", (json) => SqliteContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorSqliteMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed SQLite view over this migration's end-state contract — sole\n\t* namespace unwrapped to the root, so `this.endContract.table.<name>` etc.\n\t* Throws if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed SQLite view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.table, options.index, options.columns).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\trecreateTable(options) {\n\t\treturn new RecreateTableCall(options).toOp(this.controlAdapterFor(\"recreateTable\"));\n\t}\n};\n//#endregion\nexport { SqliteMigration as t };\n\n//# sourceMappingURL=sqlite-migration-MGxXxUB4.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAI,kBAAkB,cAAc,UAAU;CAC7C,WAAW;;;;;;;CAOX;CACA,WAAW,IAAI,uBAAuB,MAAM,oBAAoB,SAAS,mBAAmB,SAAS,IAAI,CAAC;CAC1G,aAAa,IAAI,uBAAuB,MAAM,oBAAoB,SAAS,mBAAmB,SAAS,IAAI,CAAC;CAC5G,YAAY,OAAO;EAClB,MAAM,KAAK;EACX,KAAK,iBAAiB,OAAO,UAAU,UAAU,MAAM,QAAQ,OAAO,KAAK,CAAC,IAAI,KAAK;CACtF;;;;;;CAMA,kBAAkB,WAAW;EAC5B,IAAI,CAAC,KAAK,gBAAgB,MAAM,iCAAiC,SAAS;EAC1E,OAAO,KAAK;CACb;;;;;;CAMA,IAAI,cAAc;EACjB,OAAO,KAAKA,SAAS;CACtB;;;;;CAKA,IAAI,gBAAgB;EACnB,OAAO,KAAKC,WAAW;CACxB;CACA,YAAY,SAAS;EACpB,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QAAQ,SAAS,QAAQ,WAAW,CAAC,CAAC,KAAK,KAAK,kBAAkB,aAAa,CAAC;CAC3H;CACA,UAAU,SAAS;EAClB,OAAO,IAAI,cAAc,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CACjF;CACA,UAAU,SAAS;EAClB,OAAO,IAAI,cAAc,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CACjG;CACA,WAAW,SAAS;EACnB,OAAO,IAAI,eAAe,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,KAAK,kBAAkB,YAAY,CAAC;CACnG;CACA,YAAY,SAAS;EACpB,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO,CAAC,CAAC,KAAK,KAAK,kBAAkB,aAAa,CAAC;CACrH;CACA,UAAU,SAAS;EAClB,OAAO,IAAI,cAAc,QAAQ,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CAChG;CACA,cAAc,SAAS;EACtB,OAAO,IAAI,kBAAkB,OAAO,CAAC,CAAC,KAAK,KAAK,kBAAkB,eAAe,CAAC;CACnF;AACD"}
|
package/dist/target.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, d as SQL_INT_CODEC_ID, f as SQL_VARCHAR_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, l as SQL_CHAR_CODEC_ID, n as SQLITE_BIGINT_NUMBER_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQL_FLOAT_CODEC_ID } from "./codec-ids-KMliSCRp-BhTbmbGr.mjs";
|
|
2
|
-
import { t as sqliteAggregateDescriptors } from "./aggregates-
|
|
2
|
+
import { t as sqliteAggregateDescriptors } from "./aggregates-DWyPO7t6.mjs";
|
|
3
3
|
import { a as sqliteCodec, i as isSqliteCodecDescriptor, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-B9ru99aI-DTkdKFU5.mjs";
|
|
4
|
-
import { a as sqliteCodecDescriptorRegistry, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBlobColumn, l as sqliteJsonColumn, n as sqliteBigintColumn, o as sqliteCodecRegistry, r as sqliteBigintNumberColumn, s as sqliteDatetimeColumn, t as jsonDocumentRetag, u as sqliteRealColumn } from "./codecs-
|
|
4
|
+
import { a as sqliteCodecDescriptorRegistry, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBlobColumn, l as sqliteJsonColumn, n as sqliteBigintColumn, o as sqliteCodecRegistry, r as sqliteBigintNumberColumn, s as sqliteDatetimeColumn, t as jsonDocumentRetag, u as sqliteRealColumn } from "./codecs-TyM6tD3U.mjs";
|
|
5
5
|
import { n as SqliteDdlNode, t as SqliteCreateTable } from "./nodes-DUZSdX86-BBEEaxXY.mjs";
|
|
6
6
|
import { i as tableExistsAst, n as createTable, r as indexExistsAst, t as columnExistsAst } from "./ddl-CXduXyOT-nlDP6DGx.mjs";
|
|
7
7
|
import { a as jsonText, i as integer, n as buildSignMarkerBootstrapQueries, o as sqliteTable, r as datetime, s as text, t as buildControlTableBootstrapQueries } from "./contract-free-D5cZrgNl.mjs";
|
|
8
8
|
import { n as quoteIdentifier, t as escapeLiteral } from "./sql-utils-DqPXZBMA-Mm27NNjs.mjs";
|
|
9
9
|
import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
|
|
10
10
|
import { t as parseSqliteDefault } from "./default-normalizer-DuoHj9-O-DsK7lJZn.mjs";
|
|
11
|
-
import { a as DropColumnCall, c as RawSqlCall, i as DataTransformCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-
|
|
11
|
+
import { a as DropColumnCall, c as RawSqlCall, i as DataTransformCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-CsNFRTPS-HuMdWaBX.mjs";
|
|
12
12
|
import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAMES } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
|
|
13
13
|
import { t as renderOps } from "./render-ops-DIOn_wOx-D33LOy3b.mjs";
|
|
14
14
|
import { i as sqliteCreateNamespace, n as SqliteContractView, r as SqliteUnboundDatabase, t as SqliteContractSerializer } from "./sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs";
|
|
15
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
16
|
-
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-
|
|
17
|
-
import { n as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-
|
|
18
|
-
import { a as foreignKey, c as primaryKey, i as fn, l as rawSql, n as col, o as lit, r as dataTransform, s as placeholder, t as MigrationCLI, u as unique } from "./migration-
|
|
15
|
+
import { t as SqliteMigration } from "./sqlite-migration-MGxXxUB4-zfSNsC-a.mjs";
|
|
16
|
+
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-DB3xleco-C1ncLSxE.mjs";
|
|
17
|
+
import { n as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-DuW2pz1t-DFhIqgV2.mjs";
|
|
18
|
+
import { a as foreignKey, c as primaryKey, i as fn, l as rawSql, n as col, o as lit, r as dataTransform, s as placeholder, t as MigrationCLI, u as unique } from "./migration-BX7YeaQT.mjs";
|
|
19
19
|
import { t as normalizeSqliteNativeType } from "./native-type-normalizer-GpQMEyN5.mjs";
|
|
20
20
|
export { AddColumnCall, CONTROL_TABLE_NAMES, CreateIndexCall, CreateTableCall, DataTransformCall, DropColumnCall, DropIndexCall, DropTableCall, LEDGER_TABLE_NAME, MARKER_TABLE_NAME, SqliteMigration as Migration, MigrationCLI, RawSqlCall, RecreateTableCall, SQLITE_BIGINT_CODEC_ID, SQLITE_BIGINT_NUMBER_CODEC_ID, SQLITE_BLOB_CODEC_ID, SQLITE_DATETIME_CODEC_ID, SQLITE_INTEGER_CODEC_ID, SQLITE_JSON_CODEC_ID, SQLITE_REAL_CODEC_ID, SQLITE_TEXT_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqliteCodecDescriptor, SqliteContractSerializer, SqliteContractView, SqliteCreateTable, SqliteDdlNode, SqliteMigrationPlanner, SqliteUnboundDatabase, TypeScriptRenderableSqliteMigration, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, buildSqliteCodecDescriptorRegistry, buildTargetDetails, col, columnExistsAst, createSqliteMigrationPlanner, createTable, dataTransform, datetime, defineSqliteCodecs, escapeLiteral, fn, foreignKey, indexExistsAst, integer, isSqliteCodecDescriptor, jsonDocumentRetag, jsonText, lit, normalizeSqliteNativeType, parseSqliteDefault, placeholder, primaryKey, quoteIdentifier, rawSql, renderOps, sqliteAggregateDescriptors, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodec, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteCreateNamespace, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTable, sqliteTextColumn, tableExistsAst, text, unique };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as sqliteAggregateDescriptors } from "./aggregates-
|
|
1
|
+
import { t as sqliteAggregateDescriptors } from "./aggregates-DWyPO7t6.mjs";
|
|
2
2
|
export { sqliteAggregateDescriptors };
|
package/dist/target__codecs.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as sqliteCodecDescriptorRegistry, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBlobColumn, l as sqliteJsonColumn, n as sqliteBigintColumn, o as sqliteCodecRegistry, r as sqliteBigintNumberColumn, s as sqliteDatetimeColumn, t as jsonDocumentRetag, u as sqliteRealColumn } from "./codecs-
|
|
1
|
+
import { a as sqliteCodecDescriptorRegistry, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBlobColumn, l as sqliteJsonColumn, n as sqliteBigintColumn, o as sqliteCodecRegistry, r as sqliteBigintNumberColumn, s as sqliteDatetimeColumn, t as jsonDocumentRetag, u as sqliteRealColumn } from "./codecs-TyM6tD3U.mjs";
|
|
2
2
|
export { jsonDocumentRetag, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
|
package/dist/target__control.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { n as sqliteError } from "./errors-CKsaaSnD-BeB4JS8h.mjs";
|
|
|
2
2
|
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-nORSZfmr-Cw-pzAJr.mjs";
|
|
3
3
|
import { r as MARKER_TABLE_NAME } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
|
|
4
4
|
import { i as sqliteCreateNamespace, r as SqliteUnboundDatabase, t as SqliteContractSerializer } from "./sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs";
|
|
5
|
-
import { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from "./planner-
|
|
5
|
+
import { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from "./planner-DuW2pz1t-DFhIqgV2.mjs";
|
|
6
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
6
7
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
7
8
|
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
8
9
|
import { runnerFailure, runnerSuccess } from "@prisma/orm-family-sql/family/control";
|
|
9
|
-
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
10
|
import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
|
|
11
11
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
12
12
|
import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-CKsaaSnD.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-nORSZfmr.mjs\";\nimport { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from \"./planner-B9A1yTAH.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CnDITHEE.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { runnerFailure, runnerSuccess } from \"@internal/family-sql/control\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\ttypeMetadataRegistry: this.family.typeMetadataRegistry,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation);\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(\"${MARKER_TABLE_NAME}\")`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\tspace,\n\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, _frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract);\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,eAAe,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,mBAAmB;EACvF,IAAI,CAAC,aAAa,I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,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,sBAAsB;GAChD,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,QAAQ;EACvC;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
|
|
1
|
+
{"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-CKsaaSnD.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-nORSZfmr.mjs\";\nimport { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from \"./planner-DuW2pz1t.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CnDITHEE.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { runnerFailure, runnerSuccess } from \"@internal/family-sql/control\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\ttypeMetadataRegistry: this.family.typeMetadataRegistry,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation);\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(\"${MARKER_TABLE_NAME}\")`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\tspace,\n\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, _frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract);\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAA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yBAAyB;CACjD,gBAAgB,IAAI,qBAAqB;CACzC,WAAW,OAAO;EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,sBAAsB;GAChD,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,QAAQ;EACvC;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
2
|
-
import { a as foreignKey, c as primaryKey, i as fn, l as rawSql, n as col, o as lit, r as dataTransform, s as placeholder, t as MigrationCLI, u as unique } from "./migration-
|
|
1
|
+
import { t as SqliteMigration } from "./sqlite-migration-MGxXxUB4-zfSNsC-a.mjs";
|
|
2
|
+
import { a as foreignKey, c as primaryKey, i as fn, l as rawSql, n as col, o as lit, r as dataTransform, s as placeholder, t as MigrationCLI, u as unique } from "./migration-BX7YeaQT.mjs";
|
|
3
3
|
export { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
|