@prisma/orm-family-sql 8.0.0-rc.1-dev.28 → 8.0.0-rc.1-dev.30

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.
@@ -77,6 +77,7 @@ function structuredError(code, message, options) {
77
77
  code,
78
78
  ...ifDefined("why", options?.why),
79
79
  ...ifDefined("fix", options?.fix),
80
+ ...ifDefined("nextActions", options?.nextActions),
80
81
  ...ifDefined("where", options?.where),
81
82
  ...ifDefined("severity", options?.severity),
82
83
  ...ifDefined("meta", options?.meta),
@@ -1 +1 @@
1
- {"version":3,"file":"builder__runtime.mjs","names":["#state","#buildLateral","#addLateralJoin","#addJoin","#tableSource","#tableName","#namespaceId","#table","#scope","#rows","#returningColumns","#rowFields","#annotations","#setExpressions","#whereExprs","#whereCallbacks","#fromSource","#toJoined"],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs"],"sourcesContent":["import { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DeleteAst, DerivedTableSource, ExistsExpr, IdentifierRef, InsertAst, JoinAst, ListExpression, LiteralExpr, NullCheckExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SelectAst, SubqueryExpr, TableSource, UpdateAst, collectOrderedParamRefs, isAggregateFn } from \"@internal/sql-relational-core/ast\";\nimport { codecOf, createRawSql, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { codecRefForStorageColumn } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { assertAnnotationsApplicable } from \"@internal/framework-components/runtime\";\n//#region ../../../1-framework/0-foundation/utils/dist/casts-DpaahrlC.mjs\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/defined-BQWA85QH.mjs\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/structured-error.mjs\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\n//#endregion\n//#region src/runtime/expression-impl.ts\n/**\n* Runtime wrapper around a relational-core AST expression node. Carries ScopeField metadata (codecId, nullable) so aggregate-like combinators can propagate the input codec onto their result.\n*\n* `codec` records the column-bound {@link CodecRef} when the field-proxy knows the binding — both the namespaced form (`f.user.email` → `ColumnRef`) and the top-level shortcut (`f.email` → `IdentifierRef`) stamp the ref derived from contract storage. `codecOf(expression)` exposes it for operation implementations forwarding the ref to `toExpr`.\n*\n* `projectionAst` carries the descriptor-lowered rendering of the expression, where a target declares one (e.g. SQLite's `CAST(count(*) AS TEXT)`). Lowering exists to carry the value across the driver boundary, so only the projection site consumes it — predicate and ordering positions (`buildAst()`) keep the plain form, where the rendering would change SQL semantics.\n*/\nvar ExpressionImpl = class {\n\tast;\n\tprojectionAst;\n\treturnType;\n\tcodec;\n\tconstructor(ast, returnType, codec, projectionAst) {\n\t\tthis.ast = ast;\n\t\tthis.returnType = returnType;\n\t\tthis.codec = codec;\n\t\tthis.projectionAst = projectionAst;\n\t}\n\tbuildAst() {\n\t\treturn this.ast;\n\t}\n\tbuildProjectionAst() {\n\t\treturn this.projectionAst ?? this.ast;\n\t}\n};\n/**\n* An aggregate whose operation lies outside the SQL aggregate alphabet: the expression exists only in its descriptor-lowered form, so only the projection may consume it.\n*\n* Predicate and ordering positions build the plain form through `buildAst()` and are refused at authoring time — the lowered rendering exists to carry the value across the driver boundary, and comparing or sorting by it inside the database would change SQL semantics (a textual rendering compares lexicographically).\n*/\nvar ProjectionOnlyExpressionImpl = class extends ExpressionImpl {\n\toperation;\n\tconstructor(operation, lowered, returnType) {\n\t\tsuper(lowered, returnType, void 0, lowered);\n\t\tthis.operation = operation;\n\t}\n\tbuildAst() {\n\t\tthrow structuredError(\"ORM.AGGREGATE_PROJECTION_ONLY\", `Aggregate operation '${this.operation}' is projection-only: it has no plain SQL form for HAVING, ORDER BY, or comparison positions.`, {\n\t\t\twhy: \"An operation outside the SQL aggregate alphabet reaches SQL only through its descriptor's lowering hook — a rendering for the driver boundary. HAVING and ORDER BY compare the value inside the database, where that rendering would change SQL semantics.\",\n\t\t\tfix: `Project '${this.operation}' in a select and filter or order on the projected value, or use an operation from the SQL aggregate alphabet.`,\n\t\t\tmeta: { operation: this.operation }\n\t\t});\n\t}\n};\n/**\n* The AST to project for an expression: the descriptor-lowered form when the expression carries one, the plain form otherwise. `resolveSelectArgs` calls this where a lane expression becomes a `ProjectionItem` — the one place the value crosses the driver boundary.\n*/\nfunction projectionAstOf(expr) {\n\treturn expr instanceof ExpressionImpl ? expr.buildProjectionAst() : expr.buildAst();\n}\n//#endregion\n//#region src/runtime/field-proxy.ts\nfunction createFieldProxy(scope) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(scope.topLevel, prop)) {\n\t\t\tconst topField = scope.topLevel[prop];\n\t\t\tif (topField) return new ExpressionImpl(IdentifierRef.of(prop), topField, topField.codec);\n\t\t}\n\t\tif (Object.hasOwn(scope.namespaces, prop)) {\n\t\t\tconst nsFields = scope.namespaces[prop];\n\t\t\tif (nsFields) return createNamespaceProxy(prop, nsFields);\n\t\t}\n\t} });\n}\nfunction createNamespaceProxy(namespaceName, fields) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(fields, prop)) {\n\t\t\tconst field = fields[prop];\n\t\t\tif (field) return new ExpressionImpl(ColumnRef.of(namespaceName, prop), field, field.codec);\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/internal-error-BIc-ehme.mjs\n/**\n* A bug in Prisma Next, not a user error. Never catch this except at the\n* outermost boundary for crash reporting — an InternalError means an invariant\n* broke and the process cannot reliably continue. User-facing failures use\n* `structuredError` with a dotted code instead.\n*/\nvar InternalError = class extends Error {\n\tisPrismaInternalError = true;\n\tconstructor(message, options) {\n\t\tsuper(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"InternalError\";\n\t}\n};\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/assertions.mjs\n/**\n* Asserts that a value is defined (not null or undefined).\n* Use for invariants where the value should always exist at runtime.\n*\n* @throws Error if value is null or undefined\n*\n* @example\n* ```typescript\n* const table = storage.namespaces[namespaceId].entries.table[tableName];\n* assertDefined(table, `Table \"${tableName}\" not found`);\n* // table is now narrowed to non-nullable\n* ```\n*/\nfunction assertDefined(value, message) {\n\tif (value === null || value === void 0) throw new InternalError(message);\n}\n//#endregion\n//#region src/runtime/functions.ts\nconst BOOL_FIELD = {\n\tcodecId: \"pg/bool@1\",\n\tnullable: false\n};\nconst resolve = toExpr;\n/**\n* Resolve a binary-comparison operand into an AST expression, threading the column-bound side's {@link CodecRef} to the raw-value side.\n*\n* For `fns.eq(f.email, 'alice@example.com')`, `f.email` is the column-bound expression carrying a `ColumnRef` AST and a `CodecRef` derived from contract storage; the raw string operand has no codec context. By deriving the codec context from the column-bound side and forwarding it via `toExpr(value, codec)`, the resulting `ParamRef` carries the `CodecRef` that encode-side dispatch needs to materialise the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).\n*/\nfunction resolveOperand(operand, otherCodec) {\n\tif (isExpressionLike(operand)) return operand.buildAst();\n\treturn toExpr(operand, otherCodec);\n}\nfunction isExpressionLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\";\n}\n/**\n* Resolves an Expression via `buildAst()`, or wraps a raw value as a `LiteralExpr` — an SQL literal inlined into the query text, not a bound parameter.\n*\n* Used for `and` / `or` operands. The usual operand is an `Expression<bool>` (e.g. the result of `fns.eq`), which this function passes through by calling `buildAst()`. The only time the raw-value branch fires is when the caller writes `fns.and(true, x)` or similar — inlining `TRUE`/`FALSE` literals lets the SQL planner statically simplify `TRUE AND x` to `x`, which it cannot do for an opaque `ParamRef`.\n*/\nfunction toLiteralExpr(value) {\n\tif (typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\") return value.buildAst();\n\treturn new LiteralExpr(value);\n}\nfunction boolExpr(astNode) {\n\treturn new ExpressionImpl(astNode, BOOL_FIELD);\n}\nfunction binaryWithSharedCodec(a, b, build) {\n\tconst aCodec = codecOf(a);\n\treturn build(resolveOperand(a, codecOf(b)), resolveOperand(b, aCodec));\n}\nfunction eq(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"eq\", l, r)));\n}\nfunction ne(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNotNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNotNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"neq\", l, r)));\n}\nfunction comparison(a, b, op) {\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(op, l, r)));\n}\nfunction inOrNotIn(expr, valuesOrSubquery, op) {\n\tconst left = expr.buildAst();\n\tconst leftCodec = codecOf(expr);\n\tconst binaryFn = op === \"in\" ? BinaryExpr.in : BinaryExpr.notIn;\n\tif (Array.isArray(valuesOrSubquery)) {\n\t\tconst refs = valuesOrSubquery.map((v) => resolveOperand(v, leftCodec));\n\t\treturn boolExpr(binaryFn(left, ListExpression.of(refs)));\n\t}\n\treturn boolExpr(binaryFn(left, SubqueryExpr.of(valuesOrSubquery.buildAst())));\n}\n/**\n* Build an aggregate through the target's own answer for it.\n*\n* What an aggregate returns is neither the input's codec nor a fixed id: a\n* target widens `sum` over small integers, takes `avg` somewhere else again,\n* and may want the result rendered a particular way. All three come from the\n* registry, and the result carries the codec it declared so decoding resolves\n* through the ordinary path.\n*\n* The declared rendering (`lower`) exists to carry the value across the driver\n* boundary — a projection concern. It is carried beside the plain form so only\n* the projection site consumes it; HAVING and ORDER BY compare the value inside\n* the database, where the rendering would change SQL semantics (SQLite's\n* `CAST(count(*) AS TEXT)` compares and sorts lexicographically).\n*\n* A pair the target declares no overload for is rejected outright. The typed\n* surface already makes it inexpressible; this backs that up for dynamic\n* invocation, instead of executing SQL whose result no declaration types or\n* decodes — SQLite's `sum` over text, which reads whatever leading numbers the\n* rows happened to hold, is the shape of value that path would hand back.\n*\n* An operation outside the SQL aggregate alphabet has no plain form at all:\n* its whole expression is what the lowering hook builds, so the result is\n* projection-only and refuses predicate and ordering positions.\n*/\nfunction aggregate(aggregates, operation, expr) {\n\tconst field = expr?.returnType;\n\tconst inputCodec = field === void 0 ? void 0 : field.codec ?? { codecId: field.codecId };\n\tconst resolved = aggregates.resolve(operation, inputCodec);\n\tif (resolved === void 0) throw structuredError(\"ORM.AGGREGATE_UNSUPPORTED\", inputCodec === void 0 ? `The composed target declares no '${operation}' aggregate for a call without an input.` : `The composed target declares no '${operation}' aggregate over codec '${inputCodec.codecId}'.`, {\n\t\twhy: \"An aggregate result decodes through the codec its target declares; an undeclared pair has no declared result to type or decode.\",\n\t\tfix: `Aggregate an input the target declares '${operation}' for, or contribute an aggregate descriptor for this pair.`,\n\t\tmeta: {\n\t\t\toperation,\n\t\t\t...ifDefined(\"inputCodecId\", inputCodec?.codecId)\n\t\t}\n\t});\n\tconst inputAst = expr?.buildAst();\n\tconst returnType = {\n\t\tcodecId: resolved.output.codecId,\n\t\tnullable: resolved.nullable,\n\t\tcodec: resolved.output\n\t};\n\tif (!isAggregateFn(operation)) {\n\t\tassertDefined(resolved.lower, `registry resolved '${operation}' outside the SQL aggregate alphabet without a lowering hook`);\n\t\treturn new ProjectionOnlyExpressionImpl(operation, resolved.lower({\n\t\t\texpr: inputAst,\n\t\t\tinputCodec\n\t\t}), returnType);\n\t}\n\tconst ast = new AggregateExpr(operation, inputAst);\n\tconst projectionAst = resolved.lower?.({\n\t\texpr: inputAst,\n\t\tinputCodec\n\t});\n\treturn new ExpressionImpl(ast, returnType, void 0, projectionAst);\n}\nfunction createBuiltinFunctions(rawCodecInferer) {\n\treturn {\n\t\teq: (a, b) => eq(a, b),\n\t\tne: (a, b) => ne(a, b),\n\t\tgt: (a, b) => comparison(a, b, \"gt\"),\n\t\tgte: (a, b) => comparison(a, b, \"gte\"),\n\t\tlt: (a, b) => comparison(a, b, \"lt\"),\n\t\tlte: (a, b) => comparison(a, b, \"lte\"),\n\t\tand: (...exprs) => boolExpr(AndExpr.of(exprs.map(toLiteralExpr))),\n\t\tor: (...exprs) => boolExpr(OrExpr.of(exprs.map(toLiteralExpr))),\n\t\texists: (subquery) => boolExpr(ExistsExpr.exists(subquery.buildAst())),\n\t\tnotExists: (subquery) => boolExpr(ExistsExpr.notExists(subquery.buildAst())),\n\t\tin: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"in\"),\n\t\tnotIn: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"notIn\"),\n\t\traw: createRawSql(rawCodecInferer)\n\t};\n}\n/**\n* The aggregate implementations, one per operation the registry contributes,\n* erased.\n*\n* The method set is the registry's operation vocabulary — the runtime mirror\n* of the contract's emitted aggregate map, both settled from the same\n* contributed descriptors. What each returns is the contract's answer — a\n* function of the target's map and the input's codec — which no runtime value\n* can state. The typed surface is `AggregateFunctions<QC>`, applied where\n* these are handed out.\n*/\nfunction createAggregateOnlyFunctions(aggregates) {\n\tconst methods = /* @__PURE__ */ new Map();\n\tfor (const { operation } of aggregates.values()) {\n\t\tif (methods.has(operation)) continue;\n\t\tmethods.set(operation, (expr) => aggregate(aggregates, operation, expr));\n\t}\n\treturn Object.fromEntries(methods);\n}\nfunction createFunctions(operations, rawCodecInferer) {\n\tconst builtins = createBuiltinFunctions(rawCodecInferer);\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(builtins, prop)) return builtins[prop];\n\t\tconst op = operations[prop];\n\t\tif (op) return op.impl;\n\t} });\n}\nfunction createAggregateFunctions(operations, rawCodecInferer, aggregateRegistry) {\n\tconst baseFns = createFunctions(operations, rawCodecInferer);\n\tconst aggregates = createAggregateOnlyFunctions(aggregateRegistry);\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(aggregates, prop)) return aggregates[prop];\n\t\treturn baseFns[prop];\n\t} });\n}\n//#endregion\n//#region src/runtime/resolve-table.ts\nfunction resolveTableInNamespace(storage, namespaceId, tableName) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (namespace === void 0) return void 0;\n\tconst tables = namespace.entries.table;\n\tif (tables === void 0 || !Object.hasOwn(tables, tableName)) return void 0;\n\treturn tables[tableName];\n}\n//#endregion\n//#region src/runtime/builder-base.ts\nvar BuilderBase = class {\n\tctx;\n\tconstructor(ctx) {\n\t\tthis.ctx = ctx;\n\t}\n\t_gate(required, methodName, method) {\n\t\treturn ((...args) => {\n\t\t\tassertCapability(this.ctx, required, methodName);\n\t\t\treturn method(...args);\n\t\t});\n\t}\n};\n/**\n* Derive the canonical {@link CodecRef} for a `(table, column)` from the builder context's storage. Returns `undefined` when the builder context has no storage attached or when the column is unknown to the contract.\n*/\nfunction codecRefFor(ctx, namespaceId, tableName, columnName) {\n\tif (!ctx.storage) return void 0;\n\treturn codecRefForStorageColumn(ctx.storage, namespaceId, tableName, columnName);\n}\nfunction emptyState(from, scope) {\n\treturn {\n\t\tfrom,\n\t\tjoins: [],\n\t\tprojections: [],\n\t\twhere: [],\n\t\torderBy: [],\n\t\tgroupBy: [],\n\t\thaving: void 0,\n\t\tlimit: void 0,\n\t\toffset: void 0,\n\t\tdistinct: void 0,\n\t\tdistinctOn: void 0,\n\t\tscope,\n\t\trowFields: {},\n\t\tannotations: /* @__PURE__ */ new Map()\n\t};\n}\nfunction cloneState(state, overrides) {\n\treturn {\n\t\t...state,\n\t\t...overrides\n\t};\n}\nfunction combineWhereExprs(exprs) {\n\tif (exprs.length === 0) return void 0;\n\tif (exprs.length === 1) return exprs[0];\n\treturn AndExpr.of(exprs);\n}\nfunction buildSelectAst(state) {\n\tconst where = combineWhereExprs(state.where);\n\treturn new SelectAst({\n\t\tfrom: state.from,\n\t\tjoins: state.joins.length > 0 ? state.joins : void 0,\n\t\tprojection: state.projections,\n\t\twhere,\n\t\torderBy: state.orderBy.length > 0 ? state.orderBy : void 0,\n\t\tdistinct: state.distinct,\n\t\tdistinctOn: state.distinctOn && state.distinctOn.length > 0 ? state.distinctOn : void 0,\n\t\tgroupBy: state.groupBy.length > 0 ? state.groupBy : void 0,\n\t\thaving: state.having,\n\t\tlimit: state.limit,\n\t\toffset: state.offset,\n\t\tselectAllIntent: void 0\n\t});\n}\nfunction buildQueryPlan(ast, ctx, annotations) {\n\tconst paramValues = collectOrderedParamRefs(ast).map((r) => r.kind === \"param-ref\" ? r.value : void 0);\n\tconst annotationsRecord = annotations !== void 0 && annotations.size > 0 ? Object.freeze(Object.fromEntries(annotations)) : void 0;\n\tconst meta = Object.freeze({\n\t\ttarget: ctx.target,\n\t\tstorageHash: ctx.storageHash,\n\t\tlane: \"dsl\",\n\t\t...ifDefined(\"annotations\", annotationsRecord)\n\t});\n\treturn Object.freeze({\n\t\tast,\n\t\tparams: paramValues,\n\t\tmeta\n\t});\n}\nfunction buildPlan(state, ctx) {\n\treturn buildQueryPlan(buildSelectAst(state), ctx, state.annotations);\n}\nfunction tableToScope(alias, table, options) {\n\tconst storage = options?.storage;\n\tconst lookupName = options?.tableName;\n\tconst namespaceId = options?.namespaceId;\n\tconst fields = {};\n\tfor (const [colName, col] of Object.entries(table.columns)) {\n\t\tconst codec = storage && lookupName && namespaceId !== void 0 ? codecRefForStorageColumn(storage, namespaceId, lookupName, colName) : void 0;\n\t\tfields[colName] = {\n\t\t\tcodecId: col.codecId,\n\t\t\tnullable: col.nullable,\n\t\t\t...col.many ? { many: true } : {},\n\t\t\t...codec !== void 0 ? { codec } : {}\n\t\t};\n\t}\n\treturn {\n\t\ttopLevel: { ...fields },\n\t\tnamespaces: { [alias]: fields }\n\t};\n}\nfunction mergeScopes(a, b) {\n\tconst topLevel = {};\n\tfor (const [k, v] of Object.entries(a.topLevel)) if (!(k in b.topLevel)) topLevel[k] = v;\n\tfor (const [k, v] of Object.entries(b.topLevel)) if (!(k in a.topLevel)) topLevel[k] = v;\n\treturn {\n\t\ttopLevel,\n\t\tnamespaces: {\n\t\t\t...a.namespaces,\n\t\t\t...b.namespaces\n\t\t}\n\t};\n}\nfunction nullableScope(scope) {\n\tconst mkNullable = (tbl) => {\n\t\tconst result = {};\n\t\tfor (const [k, v] of Object.entries(tbl)) result[k] = {\n\t\t\tcodecId: v.codecId,\n\t\t\tnullable: true,\n\t\t\t...v.codec !== void 0 ? { codec: v.codec } : {}\n\t\t};\n\t\treturn result;\n\t};\n\tconst namespaces = {};\n\tfor (const [k, v] of Object.entries(scope.namespaces)) namespaces[k] = mkNullable(v);\n\treturn {\n\t\ttopLevel: mkNullable(scope.topLevel),\n\t\tnamespaces\n\t};\n}\nfunction orderByScopeOf(scope, rowFields) {\n\treturn {\n\t\ttopLevel: {\n\t\t\t...scope.topLevel,\n\t\t\t...rowFields\n\t\t},\n\t\tnamespaces: scope.namespaces\n\t};\n}\nfunction assertCapability(ctx, required, methodName) {\n\tfor (const [ns, keys] of Object.entries(required)) for (const key of Object.keys(keys)) if (!ctx.capabilities[ns]?.[key]) throw structuredError(\"ORM.CAPABILITY_MISSING\", `${methodName}() requires capability ${ns}.${key}`, { meta: {\n\t\tmethod: methodName,\n\t\tcapability: `${ns}.${key}`\n\t} });\n}\nfunction resolveSelectArgs(args, scope, ctx) {\n\tconst projections = [];\n\tconst newRowFields = {};\n\tif (args.length === 0) return {\n\t\tprojections,\n\t\tnewRowFields\n\t};\n\tif (typeof args[0] === \"string\" && (args.length === 1 || typeof args[1] !== \"function\")) {\n\t\tfor (const colName of args) {\n\t\t\tconst field = scope.topLevel[colName];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope`, { meta: { column: colName } });\n\t\t\tprojections.push(ProjectionItem.of(colName, IdentifierRef.of(colName), field.codec));\n\t\t\tnewRowFields[colName] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"string\" && typeof args[1] === \"function\") {\n\t\tconst alias = args[0];\n\t\tconst exprFn = args[1];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates);\n\t\tconst result = exprFn(createFieldProxy(scope), fns);\n\t\tconst field = result.returnType;\n\t\tprojections.push(ProjectionItem.of(alias, projectionAstOf(result), field.codec));\n\t\tnewRowFields[alias] = field;\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst callbackFn = args[0];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates);\n\t\tconst record = callbackFn(createFieldProxy(scope), fns);\n\t\tfor (const [key, expr] of Object.entries(record)) {\n\t\t\tconst field = expr.returnType;\n\t\t\tprojections.push(ProjectionItem.of(key, projectionAstOf(expr), field.codec));\n\t\t\tnewRowFields[key] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid .select() arguments\");\n}\nfunction resolveOrderBy(arg, options, scope, rowFields, ctx, useAggregateFns) {\n\tconst dir = options?.direction ?? \"asc\";\n\tif (typeof arg === \"string\") {\n\t\tif (!(arg in orderByScopeOf(scope, rowFields).topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${arg}\" not found in scope for orderBy`, { meta: { column: arg } });\n\t\tconst expr = IdentifierRef.of(arg);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(expr) : OrderByItem.desc(expr);\n\t}\n\tif (typeof arg === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = useAggregateFns ? createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates) : createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\tconst result = arg(createFieldProxy(combined), fns);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(result.buildAst()) : OrderByItem.desc(result.buildAst());\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid orderBy argument\");\n}\nfunction resolveGroupBy(args, scope, rowFields, ctx) {\n\tif (typeof args[0] === \"string\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\treturn args.map((colName) => {\n\t\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for groupBy`, { meta: { column: colName } });\n\t\t\treturn IdentifierRef.of(colName);\n\t\t});\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid groupBy arguments\");\n}\nfunction resolveDistinctOn(args, scope, rowFields, ctx) {\n\tif (args.length === 1 && typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tconst combined = orderByScopeOf(scope, rowFields);\n\treturn args.map((colName) => {\n\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for distinctOn`, { meta: { column: colName } });\n\t\treturn IdentifierRef.of(colName);\n\t});\n}\n//#endregion\n//#region src/runtime/query-impl.ts\nvar QueryBase = class extends BuilderBase {\n\tstate;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.state = state;\n\t}\n\tdistinctOn = this._gate({ postgres: { distinctOn: true } }, \"distinctOn\", (...args) => {\n\t\tconst exprs = resolveDistinctOn(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn this.clone(cloneState(this.state, { distinctOn: [...this.state.distinctOn ?? [], ...exprs] }));\n\t});\n\tlimit(count) {\n\t\tconst limit = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { limit }));\n\t}\n\toffset(count) {\n\t\tconst offset = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { offset }));\n\t}\n\tdistinct() {\n\t\treturn this.clone(cloneState(this.state, { distinct: true }));\n\t}\n\t/**\n\t* Attach one or more annotations to this query plan.\n\t*\n\t* Read builders (`SelectQueryImpl`, `GroupedQueryImpl`) accept\n\t* annotations whose declared `applicableTo` includes `'read'`.\n\t* The type-level `As & ValidAnnotations<'read', As>` gate rejects\n\t* write-only annotations at the call site; the runtime check below\n\t* fails closed for callers that bypass the type gate (cast / `any`).\n\t*\n\t* Multiple `.annotate(...)` calls compose; duplicate namespaces use\n\t* last-write-wins. The accumulated annotations are merged into\n\t* `plan.meta.annotations` at `.build()` time, alongside any framework-\n\t* internal metadata under reserved namespaces (e.g. `codecs`).\n\t*\n\t* Chainable in any position (before / after `.where`, `.select`,\n\t* `.limit`, etc.); the returned builder has the same row type.\n\t*/\n\tannotate(...annotations) {\n\t\tassertAnnotationsApplicable(annotations, \"read\", \"sql-dsl.annotate\");\n\t\tconst next = new Map(this.state.annotations);\n\t\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\t\treturn this.clone(cloneState(this.state, { annotations: next }));\n\t}\n\tgroupBy(...args) {\n\t\tconst exprs = resolveGroupBy(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { groupBy: [...this.state.groupBy, ...exprs] }), this.ctx);\n\t}\n\tas(alias) {\n\t\tconst ast = buildSelectAst(this.state);\n\t\tconst derivedSource = DerivedTableSource.as(alias, ast);\n\t\tconst scope = {\n\t\t\ttopLevel: this.state.rowFields,\n\t\t\tnamespaces: { [alias]: this.state.rowFields }\n\t\t};\n\t\treturn {\n\t\t\tgetJoinOuterScope: () => scope,\n\t\t\tbuildAst: () => derivedSource\n\t\t};\n\t}\n\tgetRowFields() {\n\t\treturn this.state.rowFields;\n\t}\n\tbuildAst() {\n\t\treturn buildSelectAst(this.state);\n\t}\n\tbuild() {\n\t\treturn buildPlan(this.state, this.ctx);\n\t}\n};\nvar SelectQueryImpl = class SelectQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new SelectQueryImpl(state, this.ctx);\n\t}\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.state, {\n\t\t\tprojections: [...this.state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.state.scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new SelectQueryImpl(cloneState(this.state, { where: [...this.state.where, result.buildAst()] }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, false);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\nvar GroupedQueryImpl = class GroupedQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new GroupedQueryImpl(state, this.ctx);\n\t}\n\thaving(expr) {\n\t\tconst combined = orderByScopeOf(this.state.scope, this.state.rowFields);\n\t\tconst fns = createAggregateFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer, this.ctx.aggregates);\n\t\tconst result = expr(createFieldProxy(combined), fns);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { having: result.buildAst() }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, true);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\n//#endregion\n//#region src/runtime/joined-tables-impl.ts\nvar JoinedTablesImpl = class JoinedTablesImpl extends BuilderBase {\n\t#state;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.#state = state;\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, lateralScope);\n\t\treturn this.#addLateralJoin(\"inner\", resultScope, derivedSource);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, nullableScope(lateralScope));\n\t\treturn this.#addLateralJoin(\"left\", resultScope, derivedSource);\n\t});\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.#state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.#state, {\n\t\t\tprojections: [...this.#state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.#state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\tinnerJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"inner\", targetScope, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"left\", targetScope, on);\n\t}\n\touterRightJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"right\", targetScope, on);\n\t}\n\touterFullJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"full\", targetScope, on);\n\t}\n\t#addJoin(other, joinType, resultScope, onExpr) {\n\t\tconst onResult = onExpr(createFieldProxy(mergeScopes(this.#state.scope, other.getJoinOuterScope())), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\tconst joinAst = new JoinAst(joinType, other.buildAst(), onResult.buildAst());\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n\t#buildLateral(alias, builderFn) {\n\t\tconst subquery = builderFn({ from: (other) => {\n\t\t\tconst otherScope = other.getJoinOuterScope();\n\t\t\tconst parentMerged = mergeScopes(this.#state.scope, otherScope);\n\t\t\treturn new SelectQueryImpl(emptyState(other.buildAst(), parentMerged), this.ctx);\n\t\t} });\n\t\tconst subqueryAst = subquery.buildAst();\n\t\tconst derivedSource = DerivedTableSource.as(alias, subqueryAst);\n\t\tconst subqueryRowFields = subquery.getRowFields();\n\t\treturn {\n\t\t\tderivedSource,\n\t\t\tlateralScope: {\n\t\t\t\ttopLevel: subqueryRowFields,\n\t\t\t\tnamespaces: { [alias]: subqueryRowFields }\n\t\t\t}\n\t\t};\n\t}\n\t#addLateralJoin(joinType, resultScope, derivedSource) {\n\t\tconst joinAst = new JoinAst(joinType, derivedSource, AndExpr.of([]), true);\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/mutation-impl.ts\n/**\n* Validates and merges a variadic annotations call into a builder's\n* accumulated user-annotations map. Used by `.annotate(...)` on each of\n* the three mutation builders (`InsertQueryImpl`, `UpdateQueryImpl`,\n* `DeleteQueryImpl`); the read builders share the same logic via\n* `QueryBase.annotate()` in `./query-impl.ts`.\n*\n* Runs `assertAnnotationsApplicable` at call time (not at `.build()`) so\n* inapplicable annotations forced through casts surface immediately\n* rather than at plan-construction time.\n*/\nfunction mergeWriteAnnotations(current, annotations) {\n\tassertAnnotationsApplicable(annotations, \"write\", \"sql-dsl.annotate\");\n\tconst next = new Map(current);\n\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\treturn next;\n}\nfunction buildParamValues(values, namespaceId, table, tableName, op, ctx) {\n\tconst params = {};\n\tfor (const [col, value] of Object.entries(values)) {\n\t\tconst codec = table.columns[col] ? codecRefFor(ctx, namespaceId, tableName, col) : void 0;\n\t\tparams[col] = ParamRef.of(value, codec ? { codec } : void 0);\n\t}\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues\n\t})) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tparams[def.column] = ParamRef.of(def.value, codec ? { codec } : void 0);\n\t}\n\treturn params;\n}\nfunction buildReturningProjections(tableName, columns, rowFields) {\n\treturn columns.map((col) => ProjectionItem.of(col, ColumnRef.of(tableName, col), rowFields[col]?.codec));\n}\nfunction evaluateWhere(whereCallback, scope, queryOperationTypes, rawCodecInferer) {\n\treturn whereCallback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer)).buildAst();\n}\nfunction evaluateUpdateCallback(callback, scope, queryOperationTypes, rawCodecInferer) {\n\tconst result = callback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer));\n\tconst set = {};\n\tfor (const [col, expr] of Object.entries(result)) if (expr !== void 0) set[col] = expr.buildAst();\n\treturn set;\n}\nfunction buildSetExpressions(exprs, namespaceId, table, tableName, op, ctx) {\n\tconst set = { ...exprs };\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues: exprs\n\t})) if (!(def.column in set)) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tset[def.column] = ParamRef.of(def.value, ifDefined(\"codec\", codec));\n\t}\n\treturn set;\n}\nvar InsertQueryImpl = class InsertQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#namespaceId;\n\t#table;\n\t#scope;\n\t#rows;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, namespaceId, table, scope, rows, ctx, returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#table = table;\n\t\tthis.#scope = scope;\n\t\tthis.#rows = rows;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* The type-level `As & ValidAnnotations<'write', As>` gate rejects\n\t* read-only annotations at the call site; the runtime check fails\n\t* closed for callers that bypass the type gate. See `QueryBase.annotate`\n\t* in `./query-impl.ts` for the read-builder counterpart.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tif (this.#rows.length === 0) throw structuredError(\"ORM.MUTATION_DATA_MISSING\", \"insert() called with an empty row array — at least one row is required\");\n\t\tconst paramRows = this.#rows.map((rowValues) => buildParamValues(rowValues, this.#namespaceId, this.#table, this.#tableName, \"create\", this.ctx));\n\t\tlet ast = InsertAst.into(this.#tableSource).withRows(paramRows);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#setExpressions;\n\t#whereExprs;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, setExpressions, ctx, whereExprs = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#setExpressions = setExpressions;\n\t\tthis.#whereExprs = whereExprs;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.#scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, [...this.#whereExprs, result.buildAst()], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics; the runtime check\n\t* fails closed for callers that bypass the type-level gate.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tlet ast = UpdateAst.table(this.#tableSource).withSet(this.#setExpressions).withWhere(combineWhereExprs(this.#whereExprs));\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#whereCallbacks;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, ctx, whereCallbacks = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#whereCallbacks = whereCallbacks;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tconst whereExpr = combineWhereExprs(this.#whereCallbacks.map((cb) => evaluateWhere(cb, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer)));\n\t\tlet ast = DeleteAst.from(this.#tableSource).withWhere(whereExpr);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\n//#endregion\n//#region src/runtime/table-source-for-proxy.ts\nfunction tableSourceForProxy(tableName, alias, namespaceId) {\n\treturn TableSource.named(tableName, alias !== tableName ? alias : void 0, namespaceId);\n}\n//#endregion\n//#region src/runtime/table-proxy-impl.ts\nvar TableProxyImpl = class TableProxyImpl extends BuilderBase {\n\t#tableName;\n\t#table;\n\t#namespaceId;\n\t#fromSource;\n\t#scope;\n\tconstructor(tableName, table, alias, ctx, namespaceId) {\n\t\tsuper(ctx);\n\t\tthis.#tableName = tableName;\n\t\tthis.#table = table;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#scope = tableToScope(alias, table, {\n\t\t\tstorage: ctx.storage,\n\t\t\ttableName,\n\t\t\tnamespaceId\n\t\t});\n\t\tthis.#fromSource = tableSourceForProxy(tableName, alias, namespaceId);\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().lateralJoin(alias, builder);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().outerLateralJoin(alias, builder);\n\t});\n\tgetJoinOuterScope() {\n\t\treturn this.#scope;\n\t}\n\tbuildAst() {\n\t\treturn this.#fromSource;\n\t}\n\tas(newAlias) {\n\t\treturn new TableProxyImpl(this.#tableName, this.#table, newAlias, this.ctx, this.#namespaceId);\n\t}\n\tselect(...args) {\n\t\treturn new SelectQueryImpl(emptyState(this.#fromSource, this.#scope), this.ctx).select(...args);\n\t}\n\tinnerJoin(other, on) {\n\t\treturn this.#toJoined().innerJoin(other, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\treturn this.#toJoined().outerLeftJoin(other, on);\n\t}\n\touterRightJoin(other, on) {\n\t\treturn this.#toJoined().outerRightJoin(other, on);\n\t}\n\touterFullJoin(other, on) {\n\t\treturn this.#toJoined().outerFullJoin(other, on);\n\t}\n\tinsert(rows) {\n\t\treturn new InsertQueryImpl(this.#fromSource, this.#namespaceId, this.#table, this.#scope, rows, this.ctx);\n\t}\n\tupdate(setOrCallback) {\n\t\tif (typeof setOrCallback === \"function\") {\n\t\t\tconst setExpressions = buildSetExpressions(evaluateUpdateCallback(setOrCallback, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer), this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t\t}\n\t\tconst setExpressions = buildParamValues(setOrCallback, this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t}\n\tdelete() {\n\t\treturn new DeleteQueryImpl(this.#fromSource, this.#scope, this.ctx);\n\t}\n\t#toJoined() {\n\t\treturn new JoinedTablesImpl(emptyState(this.#fromSource, this.#scope), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/sql.ts\nfunction sql(options) {\n\tconst { context, rawCodecInferer } = options;\n\tconst ctx = {\n\t\tcapabilities: context.contract.capabilities,\n\t\tqueryOperationTypes: context.queryOperations.entries(),\n\t\ttarget: context.contract.target ?? \"unknown\",\n\t\tstorageHash: context.contract.storage.storageHash ?? \"unknown\",\n\t\tstorage: context.contract.storage,\n\t\tapplyMutationDefaults: (options) => context.applyMutationDefaults(options),\n\t\trawCodecInferer,\n\t\taggregates: context.aggregateDescriptors\n\t};\n\tconst { storage } = context.contract;\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (typeof prop !== \"string\") return;\n\t\tif (!Object.hasOwn(storage.namespaces, prop)) return;\n\t\tconst namespaceId = prop;\n\t\treturn new Proxy({}, { get(_facetTarget, tableName) {\n\t\t\tif (typeof tableName !== \"string\") return;\n\t\t\tconst table = resolveTableInNamespace(storage, namespaceId, tableName);\n\t\t\tif (table) return new TableProxyImpl(tableName, table, tableName, ctx, namespaceId);\n\t\t} });\n\t} });\n}\n//#endregion\nexport { ExpressionImpl, createAggregateFunctions, createFieldProxy, createFunctions, sql };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,UAAU,KAAK,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;AAC1D;AAGA,SAAS,gBAAgB,MAAM,SAAS,SAAS;CAChD,MAAM,QAAQ,SAAS,U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;EAC9C,MAAM,cAAc;EACpB,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,cAAc,WAAW;GACnD,IAAI,OAAO,cAAc,UAAU;GACnC,MAAM,QAAQ,wBAAwB,SAAS,aAAa,SAAS;GACrE,IAAI,OAAO,OAAO,IAAI,eAAe,WAAW,OAAO,WAAW,KAAK,WAAW;EACnF,EAAE,CAAC;CACJ,EAAE,CAAC;AACJ"}
1
+ {"version":3,"file":"builder__runtime.mjs","names":["#state","#buildLateral","#addLateralJoin","#addJoin","#tableSource","#tableName","#namespaceId","#table","#scope","#rows","#returningColumns","#rowFields","#annotations","#setExpressions","#whereExprs","#whereCallbacks","#fromSource","#toJoined"],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs"],"sourcesContent":["import { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DeleteAst, DerivedTableSource, ExistsExpr, IdentifierRef, InsertAst, JoinAst, ListExpression, LiteralExpr, NullCheckExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SelectAst, SubqueryExpr, TableSource, UpdateAst, collectOrderedParamRefs, isAggregateFn } from \"@internal/sql-relational-core/ast\";\nimport { codecOf, createRawSql, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { codecRefForStorageColumn } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { assertAnnotationsApplicable } from \"@internal/framework-components/runtime\";\n//#region ../../../1-framework/0-foundation/utils/dist/casts-DpaahrlC.mjs\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/defined-BQWA85QH.mjs\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/structured-error.mjs\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"nextActions\", options?.nextActions),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\n//#endregion\n//#region src/runtime/expression-impl.ts\n/**\n* Runtime wrapper around a relational-core AST expression node. Carries ScopeField metadata (codecId, nullable) so aggregate-like combinators can propagate the input codec onto their result.\n*\n* `codec` records the column-bound {@link CodecRef} when the field-proxy knows the binding — both the namespaced form (`f.user.email` → `ColumnRef`) and the top-level shortcut (`f.email` → `IdentifierRef`) stamp the ref derived from contract storage. `codecOf(expression)` exposes it for operation implementations forwarding the ref to `toExpr`.\n*\n* `projectionAst` carries the descriptor-lowered rendering of the expression, where a target declares one (e.g. SQLite's `CAST(count(*) AS TEXT)`). Lowering exists to carry the value across the driver boundary, so only the projection site consumes it — predicate and ordering positions (`buildAst()`) keep the plain form, where the rendering would change SQL semantics.\n*/\nvar ExpressionImpl = class {\n\tast;\n\tprojectionAst;\n\treturnType;\n\tcodec;\n\tconstructor(ast, returnType, codec, projectionAst) {\n\t\tthis.ast = ast;\n\t\tthis.returnType = returnType;\n\t\tthis.codec = codec;\n\t\tthis.projectionAst = projectionAst;\n\t}\n\tbuildAst() {\n\t\treturn this.ast;\n\t}\n\tbuildProjectionAst() {\n\t\treturn this.projectionAst ?? this.ast;\n\t}\n};\n/**\n* An aggregate whose operation lies outside the SQL aggregate alphabet: the expression exists only in its descriptor-lowered form, so only the projection may consume it.\n*\n* Predicate and ordering positions build the plain form through `buildAst()` and are refused at authoring time — the lowered rendering exists to carry the value across the driver boundary, and comparing or sorting by it inside the database would change SQL semantics (a textual rendering compares lexicographically).\n*/\nvar ProjectionOnlyExpressionImpl = class extends ExpressionImpl {\n\toperation;\n\tconstructor(operation, lowered, returnType) {\n\t\tsuper(lowered, returnType, void 0, lowered);\n\t\tthis.operation = operation;\n\t}\n\tbuildAst() {\n\t\tthrow structuredError(\"ORM.AGGREGATE_PROJECTION_ONLY\", `Aggregate operation '${this.operation}' is projection-only: it has no plain SQL form for HAVING, ORDER BY, or comparison positions.`, {\n\t\t\twhy: \"An operation outside the SQL aggregate alphabet reaches SQL only through its descriptor's lowering hook — a rendering for the driver boundary. HAVING and ORDER BY compare the value inside the database, where that rendering would change SQL semantics.\",\n\t\t\tfix: `Project '${this.operation}' in a select and filter or order on the projected value, or use an operation from the SQL aggregate alphabet.`,\n\t\t\tmeta: { operation: this.operation }\n\t\t});\n\t}\n};\n/**\n* The AST to project for an expression: the descriptor-lowered form when the expression carries one, the plain form otherwise. `resolveSelectArgs` calls this where a lane expression becomes a `ProjectionItem` — the one place the value crosses the driver boundary.\n*/\nfunction projectionAstOf(expr) {\n\treturn expr instanceof ExpressionImpl ? expr.buildProjectionAst() : expr.buildAst();\n}\n//#endregion\n//#region src/runtime/field-proxy.ts\nfunction createFieldProxy(scope) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(scope.topLevel, prop)) {\n\t\t\tconst topField = scope.topLevel[prop];\n\t\t\tif (topField) return new ExpressionImpl(IdentifierRef.of(prop), topField, topField.codec);\n\t\t}\n\t\tif (Object.hasOwn(scope.namespaces, prop)) {\n\t\t\tconst nsFields = scope.namespaces[prop];\n\t\t\tif (nsFields) return createNamespaceProxy(prop, nsFields);\n\t\t}\n\t} });\n}\nfunction createNamespaceProxy(namespaceName, fields) {\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(fields, prop)) {\n\t\t\tconst field = fields[prop];\n\t\t\tif (field) return new ExpressionImpl(ColumnRef.of(namespaceName, prop), field, field.codec);\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/internal-error-BIc-ehme.mjs\n/**\n* A bug in Prisma Next, not a user error. Never catch this except at the\n* outermost boundary for crash reporting — an InternalError means an invariant\n* broke and the process cannot reliably continue. User-facing failures use\n* `structuredError` with a dotted code instead.\n*/\nvar InternalError = class extends Error {\n\tisPrismaInternalError = true;\n\tconstructor(message, options) {\n\t\tsuper(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"InternalError\";\n\t}\n};\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/assertions.mjs\n/**\n* Asserts that a value is defined (not null or undefined).\n* Use for invariants where the value should always exist at runtime.\n*\n* @throws Error if value is null or undefined\n*\n* @example\n* ```typescript\n* const table = storage.namespaces[namespaceId].entries.table[tableName];\n* assertDefined(table, `Table \"${tableName}\" not found`);\n* // table is now narrowed to non-nullable\n* ```\n*/\nfunction assertDefined(value, message) {\n\tif (value === null || value === void 0) throw new InternalError(message);\n}\n//#endregion\n//#region src/runtime/functions.ts\nconst BOOL_FIELD = {\n\tcodecId: \"pg/bool@1\",\n\tnullable: false\n};\nconst resolve = toExpr;\n/**\n* Resolve a binary-comparison operand into an AST expression, threading the column-bound side's {@link CodecRef} to the raw-value side.\n*\n* For `fns.eq(f.email, 'alice@example.com')`, `f.email` is the column-bound expression carrying a `ColumnRef` AST and a `CodecRef` derived from contract storage; the raw string operand has no codec context. By deriving the codec context from the column-bound side and forwarding it via `toExpr(value, codec)`, the resulting `ParamRef` carries the `CodecRef` that encode-side dispatch needs to materialise the per-instance codec for parameterized codec ids (`vector(1024)` vs. `vector(1536)`).\n*/\nfunction resolveOperand(operand, otherCodec) {\n\tif (isExpressionLike(operand)) return operand.buildAst();\n\treturn toExpr(operand, otherCodec);\n}\nfunction isExpressionLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\";\n}\n/**\n* Resolves an Expression via `buildAst()`, or wraps a raw value as a `LiteralExpr` — an SQL literal inlined into the query text, not a bound parameter.\n*\n* Used for `and` / `or` operands. The usual operand is an `Expression<bool>` (e.g. the result of `fns.eq`), which this function passes through by calling `buildAst()`. The only time the raw-value branch fires is when the caller writes `fns.and(true, x)` or similar — inlining `TRUE`/`FALSE` literals lets the SQL planner statically simplify `TRUE AND x` to `x`, which it cannot do for an opaque `ParamRef`.\n*/\nfunction toLiteralExpr(value) {\n\tif (typeof value === \"object\" && value !== null && \"buildAst\" in value && typeof value.buildAst === \"function\") return value.buildAst();\n\treturn new LiteralExpr(value);\n}\nfunction boolExpr(astNode) {\n\treturn new ExpressionImpl(astNode, BOOL_FIELD);\n}\nfunction binaryWithSharedCodec(a, b, build) {\n\tconst aCodec = codecOf(a);\n\treturn build(resolveOperand(a, codecOf(b)), resolveOperand(b, aCodec));\n}\nfunction eq(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"eq\", l, r)));\n}\nfunction ne(a, b) {\n\tif (b === null) return boolExpr(NullCheckExpr.isNotNull(resolve(a)));\n\tif (a === null) return boolExpr(NullCheckExpr.isNotNull(resolve(b)));\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(\"neq\", l, r)));\n}\nfunction comparison(a, b, op) {\n\treturn boolExpr(binaryWithSharedCodec(a, b, (l, r) => new BinaryExpr(op, l, r)));\n}\nfunction inOrNotIn(expr, valuesOrSubquery, op) {\n\tconst left = expr.buildAst();\n\tconst leftCodec = codecOf(expr);\n\tconst binaryFn = op === \"in\" ? BinaryExpr.in : BinaryExpr.notIn;\n\tif (Array.isArray(valuesOrSubquery)) {\n\t\tconst refs = valuesOrSubquery.map((v) => resolveOperand(v, leftCodec));\n\t\treturn boolExpr(binaryFn(left, ListExpression.of(refs)));\n\t}\n\treturn boolExpr(binaryFn(left, SubqueryExpr.of(valuesOrSubquery.buildAst())));\n}\n/**\n* Build an aggregate through the target's own answer for it.\n*\n* What an aggregate returns is neither the input's codec nor a fixed id: a\n* target widens `sum` over small integers, takes `avg` somewhere else again,\n* and may want the result rendered a particular way. All three come from the\n* registry, and the result carries the codec it declared so decoding resolves\n* through the ordinary path.\n*\n* The declared rendering (`lower`) exists to carry the value across the driver\n* boundary — a projection concern. It is carried beside the plain form so only\n* the projection site consumes it; HAVING and ORDER BY compare the value inside\n* the database, where the rendering would change SQL semantics (SQLite's\n* `CAST(count(*) AS TEXT)` compares and sorts lexicographically).\n*\n* A pair the target declares no overload for is rejected outright. The typed\n* surface already makes it inexpressible; this backs that up for dynamic\n* invocation, instead of executing SQL whose result no declaration types or\n* decodes — SQLite's `sum` over text, which reads whatever leading numbers the\n* rows happened to hold, is the shape of value that path would hand back.\n*\n* An operation outside the SQL aggregate alphabet has no plain form at all:\n* its whole expression is what the lowering hook builds, so the result is\n* projection-only and refuses predicate and ordering positions.\n*/\nfunction aggregate(aggregates, operation, expr) {\n\tconst field = expr?.returnType;\n\tconst inputCodec = field === void 0 ? void 0 : field.codec ?? { codecId: field.codecId };\n\tconst resolved = aggregates.resolve(operation, inputCodec);\n\tif (resolved === void 0) throw structuredError(\"ORM.AGGREGATE_UNSUPPORTED\", inputCodec === void 0 ? `The composed target declares no '${operation}' aggregate for a call without an input.` : `The composed target declares no '${operation}' aggregate over codec '${inputCodec.codecId}'.`, {\n\t\twhy: \"An aggregate result decodes through the codec its target declares; an undeclared pair has no declared result to type or decode.\",\n\t\tfix: `Aggregate an input the target declares '${operation}' for, or contribute an aggregate descriptor for this pair.`,\n\t\tmeta: {\n\t\t\toperation,\n\t\t\t...ifDefined(\"inputCodecId\", inputCodec?.codecId)\n\t\t}\n\t});\n\tconst inputAst = expr?.buildAst();\n\tconst returnType = {\n\t\tcodecId: resolved.output.codecId,\n\t\tnullable: resolved.nullable,\n\t\tcodec: resolved.output\n\t};\n\tif (!isAggregateFn(operation)) {\n\t\tassertDefined(resolved.lower, `registry resolved '${operation}' outside the SQL aggregate alphabet without a lowering hook`);\n\t\treturn new ProjectionOnlyExpressionImpl(operation, resolved.lower({\n\t\t\texpr: inputAst,\n\t\t\tinputCodec\n\t\t}), returnType);\n\t}\n\tconst ast = new AggregateExpr(operation, inputAst);\n\tconst projectionAst = resolved.lower?.({\n\t\texpr: inputAst,\n\t\tinputCodec\n\t});\n\treturn new ExpressionImpl(ast, returnType, void 0, projectionAst);\n}\nfunction createBuiltinFunctions(rawCodecInferer) {\n\treturn {\n\t\teq: (a, b) => eq(a, b),\n\t\tne: (a, b) => ne(a, b),\n\t\tgt: (a, b) => comparison(a, b, \"gt\"),\n\t\tgte: (a, b) => comparison(a, b, \"gte\"),\n\t\tlt: (a, b) => comparison(a, b, \"lt\"),\n\t\tlte: (a, b) => comparison(a, b, \"lte\"),\n\t\tand: (...exprs) => boolExpr(AndExpr.of(exprs.map(toLiteralExpr))),\n\t\tor: (...exprs) => boolExpr(OrExpr.of(exprs.map(toLiteralExpr))),\n\t\texists: (subquery) => boolExpr(ExistsExpr.exists(subquery.buildAst())),\n\t\tnotExists: (subquery) => boolExpr(ExistsExpr.notExists(subquery.buildAst())),\n\t\tin: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"in\"),\n\t\tnotIn: (expr, valuesOrSubquery) => inOrNotIn(expr, valuesOrSubquery, \"notIn\"),\n\t\traw: createRawSql(rawCodecInferer)\n\t};\n}\n/**\n* The aggregate implementations, one per operation the registry contributes,\n* erased.\n*\n* The method set is the registry's operation vocabulary — the runtime mirror\n* of the contract's emitted aggregate map, both settled from the same\n* contributed descriptors. What each returns is the contract's answer — a\n* function of the target's map and the input's codec — which no runtime value\n* can state. The typed surface is `AggregateFunctions<QC>`, applied where\n* these are handed out.\n*/\nfunction createAggregateOnlyFunctions(aggregates) {\n\tconst methods = /* @__PURE__ */ new Map();\n\tfor (const { operation } of aggregates.values()) {\n\t\tif (methods.has(operation)) continue;\n\t\tmethods.set(operation, (expr) => aggregate(aggregates, operation, expr));\n\t}\n\treturn Object.fromEntries(methods);\n}\nfunction createFunctions(operations, rawCodecInferer) {\n\tconst builtins = createBuiltinFunctions(rawCodecInferer);\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(builtins, prop)) return builtins[prop];\n\t\tconst op = operations[prop];\n\t\tif (op) return op.impl;\n\t} });\n}\nfunction createAggregateFunctions(operations, rawCodecInferer, aggregateRegistry) {\n\tconst baseFns = createFunctions(operations, rawCodecInferer);\n\tconst aggregates = createAggregateOnlyFunctions(aggregateRegistry);\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (Object.hasOwn(aggregates, prop)) return aggregates[prop];\n\t\treturn baseFns[prop];\n\t} });\n}\n//#endregion\n//#region src/runtime/resolve-table.ts\nfunction resolveTableInNamespace(storage, namespaceId, tableName) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (namespace === void 0) return void 0;\n\tconst tables = namespace.entries.table;\n\tif (tables === void 0 || !Object.hasOwn(tables, tableName)) return void 0;\n\treturn tables[tableName];\n}\n//#endregion\n//#region src/runtime/builder-base.ts\nvar BuilderBase = class {\n\tctx;\n\tconstructor(ctx) {\n\t\tthis.ctx = ctx;\n\t}\n\t_gate(required, methodName, method) {\n\t\treturn ((...args) => {\n\t\t\tassertCapability(this.ctx, required, methodName);\n\t\t\treturn method(...args);\n\t\t});\n\t}\n};\n/**\n* Derive the canonical {@link CodecRef} for a `(table, column)` from the builder context's storage. Returns `undefined` when the builder context has no storage attached or when the column is unknown to the contract.\n*/\nfunction codecRefFor(ctx, namespaceId, tableName, columnName) {\n\tif (!ctx.storage) return void 0;\n\treturn codecRefForStorageColumn(ctx.storage, namespaceId, tableName, columnName);\n}\nfunction emptyState(from, scope) {\n\treturn {\n\t\tfrom,\n\t\tjoins: [],\n\t\tprojections: [],\n\t\twhere: [],\n\t\torderBy: [],\n\t\tgroupBy: [],\n\t\thaving: void 0,\n\t\tlimit: void 0,\n\t\toffset: void 0,\n\t\tdistinct: void 0,\n\t\tdistinctOn: void 0,\n\t\tscope,\n\t\trowFields: {},\n\t\tannotations: /* @__PURE__ */ new Map()\n\t};\n}\nfunction cloneState(state, overrides) {\n\treturn {\n\t\t...state,\n\t\t...overrides\n\t};\n}\nfunction combineWhereExprs(exprs) {\n\tif (exprs.length === 0) return void 0;\n\tif (exprs.length === 1) return exprs[0];\n\treturn AndExpr.of(exprs);\n}\nfunction buildSelectAst(state) {\n\tconst where = combineWhereExprs(state.where);\n\treturn new SelectAst({\n\t\tfrom: state.from,\n\t\tjoins: state.joins.length > 0 ? state.joins : void 0,\n\t\tprojection: state.projections,\n\t\twhere,\n\t\torderBy: state.orderBy.length > 0 ? state.orderBy : void 0,\n\t\tdistinct: state.distinct,\n\t\tdistinctOn: state.distinctOn && state.distinctOn.length > 0 ? state.distinctOn : void 0,\n\t\tgroupBy: state.groupBy.length > 0 ? state.groupBy : void 0,\n\t\thaving: state.having,\n\t\tlimit: state.limit,\n\t\toffset: state.offset,\n\t\tselectAllIntent: void 0\n\t});\n}\nfunction buildQueryPlan(ast, ctx, annotations) {\n\tconst paramValues = collectOrderedParamRefs(ast).map((r) => r.kind === \"param-ref\" ? r.value : void 0);\n\tconst annotationsRecord = annotations !== void 0 && annotations.size > 0 ? Object.freeze(Object.fromEntries(annotations)) : void 0;\n\tconst meta = Object.freeze({\n\t\ttarget: ctx.target,\n\t\tstorageHash: ctx.storageHash,\n\t\tlane: \"dsl\",\n\t\t...ifDefined(\"annotations\", annotationsRecord)\n\t});\n\treturn Object.freeze({\n\t\tast,\n\t\tparams: paramValues,\n\t\tmeta\n\t});\n}\nfunction buildPlan(state, ctx) {\n\treturn buildQueryPlan(buildSelectAst(state), ctx, state.annotations);\n}\nfunction tableToScope(alias, table, options) {\n\tconst storage = options?.storage;\n\tconst lookupName = options?.tableName;\n\tconst namespaceId = options?.namespaceId;\n\tconst fields = {};\n\tfor (const [colName, col] of Object.entries(table.columns)) {\n\t\tconst codec = storage && lookupName && namespaceId !== void 0 ? codecRefForStorageColumn(storage, namespaceId, lookupName, colName) : void 0;\n\t\tfields[colName] = {\n\t\t\tcodecId: col.codecId,\n\t\t\tnullable: col.nullable,\n\t\t\t...col.many ? { many: true } : {},\n\t\t\t...codec !== void 0 ? { codec } : {}\n\t\t};\n\t}\n\treturn {\n\t\ttopLevel: { ...fields },\n\t\tnamespaces: { [alias]: fields }\n\t};\n}\nfunction mergeScopes(a, b) {\n\tconst topLevel = {};\n\tfor (const [k, v] of Object.entries(a.topLevel)) if (!(k in b.topLevel)) topLevel[k] = v;\n\tfor (const [k, v] of Object.entries(b.topLevel)) if (!(k in a.topLevel)) topLevel[k] = v;\n\treturn {\n\t\ttopLevel,\n\t\tnamespaces: {\n\t\t\t...a.namespaces,\n\t\t\t...b.namespaces\n\t\t}\n\t};\n}\nfunction nullableScope(scope) {\n\tconst mkNullable = (tbl) => {\n\t\tconst result = {};\n\t\tfor (const [k, v] of Object.entries(tbl)) result[k] = {\n\t\t\tcodecId: v.codecId,\n\t\t\tnullable: true,\n\t\t\t...v.codec !== void 0 ? { codec: v.codec } : {}\n\t\t};\n\t\treturn result;\n\t};\n\tconst namespaces = {};\n\tfor (const [k, v] of Object.entries(scope.namespaces)) namespaces[k] = mkNullable(v);\n\treturn {\n\t\ttopLevel: mkNullable(scope.topLevel),\n\t\tnamespaces\n\t};\n}\nfunction orderByScopeOf(scope, rowFields) {\n\treturn {\n\t\ttopLevel: {\n\t\t\t...scope.topLevel,\n\t\t\t...rowFields\n\t\t},\n\t\tnamespaces: scope.namespaces\n\t};\n}\nfunction assertCapability(ctx, required, methodName) {\n\tfor (const [ns, keys] of Object.entries(required)) for (const key of Object.keys(keys)) if (!ctx.capabilities[ns]?.[key]) throw structuredError(\"ORM.CAPABILITY_MISSING\", `${methodName}() requires capability ${ns}.${key}`, { meta: {\n\t\tmethod: methodName,\n\t\tcapability: `${ns}.${key}`\n\t} });\n}\nfunction resolveSelectArgs(args, scope, ctx) {\n\tconst projections = [];\n\tconst newRowFields = {};\n\tif (args.length === 0) return {\n\t\tprojections,\n\t\tnewRowFields\n\t};\n\tif (typeof args[0] === \"string\" && (args.length === 1 || typeof args[1] !== \"function\")) {\n\t\tfor (const colName of args) {\n\t\t\tconst field = scope.topLevel[colName];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope`, { meta: { column: colName } });\n\t\t\tprojections.push(ProjectionItem.of(colName, IdentifierRef.of(colName), field.codec));\n\t\t\tnewRowFields[colName] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"string\" && typeof args[1] === \"function\") {\n\t\tconst alias = args[0];\n\t\tconst exprFn = args[1];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates);\n\t\tconst result = exprFn(createFieldProxy(scope), fns);\n\t\tconst field = result.returnType;\n\t\tprojections.push(ProjectionItem.of(alias, projectionAstOf(result), field.codec));\n\t\tnewRowFields[alias] = field;\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst callbackFn = args[0];\n\t\tconst fns = createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates);\n\t\tconst record = callbackFn(createFieldProxy(scope), fns);\n\t\tfor (const [key, expr] of Object.entries(record)) {\n\t\t\tconst field = expr.returnType;\n\t\t\tprojections.push(ProjectionItem.of(key, projectionAstOf(expr), field.codec));\n\t\t\tnewRowFields[key] = field;\n\t\t}\n\t\treturn {\n\t\t\tprojections,\n\t\t\tnewRowFields\n\t\t};\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid .select() arguments\");\n}\nfunction resolveOrderBy(arg, options, scope, rowFields, ctx, useAggregateFns) {\n\tconst dir = options?.direction ?? \"asc\";\n\tif (typeof arg === \"string\") {\n\t\tif (!(arg in orderByScopeOf(scope, rowFields).topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${arg}\" not found in scope for orderBy`, { meta: { column: arg } });\n\t\tconst expr = IdentifierRef.of(arg);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(expr) : OrderByItem.desc(expr);\n\t}\n\tif (typeof arg === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = useAggregateFns ? createAggregateFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer, ctx.aggregates) : createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\tconst result = arg(createFieldProxy(combined), fns);\n\t\treturn dir === \"asc\" ? OrderByItem.asc(result.buildAst()) : OrderByItem.desc(result.buildAst());\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid orderBy argument\");\n}\nfunction resolveGroupBy(args, scope, rowFields, ctx) {\n\tif (typeof args[0] === \"string\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\treturn args.map((colName) => {\n\t\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for groupBy`, { meta: { column: colName } });\n\t\t\treturn IdentifierRef.of(colName);\n\t\t});\n\t}\n\tif (typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tthrow structuredError(\"ORM.ARGUMENT_INVALID\", \"Invalid groupBy arguments\");\n}\nfunction resolveDistinctOn(args, scope, rowFields, ctx) {\n\tif (args.length === 1 && typeof args[0] === \"function\") {\n\t\tconst combined = orderByScopeOf(scope, rowFields);\n\t\tconst fns = createFunctions(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn [args[0](createFieldProxy(combined), fns).buildAst()];\n\t}\n\tconst combined = orderByScopeOf(scope, rowFields);\n\treturn args.map((colName) => {\n\t\tif (!(colName in combined.topLevel)) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${colName}\" not found in scope for distinctOn`, { meta: { column: colName } });\n\t\treturn IdentifierRef.of(colName);\n\t});\n}\n//#endregion\n//#region src/runtime/query-impl.ts\nvar QueryBase = class extends BuilderBase {\n\tstate;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.state = state;\n\t}\n\tdistinctOn = this._gate({ postgres: { distinctOn: true } }, \"distinctOn\", (...args) => {\n\t\tconst exprs = resolveDistinctOn(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn this.clone(cloneState(this.state, { distinctOn: [...this.state.distinctOn ?? [], ...exprs] }));\n\t});\n\tlimit(count) {\n\t\tconst limit = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { limit }));\n\t}\n\toffset(count) {\n\t\tconst offset = typeof count === \"number\" ? count : toExpr(count);\n\t\treturn this.clone(cloneState(this.state, { offset }));\n\t}\n\tdistinct() {\n\t\treturn this.clone(cloneState(this.state, { distinct: true }));\n\t}\n\t/**\n\t* Attach one or more annotations to this query plan.\n\t*\n\t* Read builders (`SelectQueryImpl`, `GroupedQueryImpl`) accept\n\t* annotations whose declared `applicableTo` includes `'read'`.\n\t* The type-level `As & ValidAnnotations<'read', As>` gate rejects\n\t* write-only annotations at the call site; the runtime check below\n\t* fails closed for callers that bypass the type gate (cast / `any`).\n\t*\n\t* Multiple `.annotate(...)` calls compose; duplicate namespaces use\n\t* last-write-wins. The accumulated annotations are merged into\n\t* `plan.meta.annotations` at `.build()` time, alongside any framework-\n\t* internal metadata under reserved namespaces (e.g. `codecs`).\n\t*\n\t* Chainable in any position (before / after `.where`, `.select`,\n\t* `.limit`, etc.); the returned builder has the same row type.\n\t*/\n\tannotate(...annotations) {\n\t\tassertAnnotationsApplicable(annotations, \"read\", \"sql-dsl.annotate\");\n\t\tconst next = new Map(this.state.annotations);\n\t\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\t\treturn this.clone(cloneState(this.state, { annotations: next }));\n\t}\n\tgroupBy(...args) {\n\t\tconst exprs = resolveGroupBy(args, this.state.scope, this.state.rowFields, this.ctx);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { groupBy: [...this.state.groupBy, ...exprs] }), this.ctx);\n\t}\n\tas(alias) {\n\t\tconst ast = buildSelectAst(this.state);\n\t\tconst derivedSource = DerivedTableSource.as(alias, ast);\n\t\tconst scope = {\n\t\t\ttopLevel: this.state.rowFields,\n\t\t\tnamespaces: { [alias]: this.state.rowFields }\n\t\t};\n\t\treturn {\n\t\t\tgetJoinOuterScope: () => scope,\n\t\t\tbuildAst: () => derivedSource\n\t\t};\n\t}\n\tgetRowFields() {\n\t\treturn this.state.rowFields;\n\t}\n\tbuildAst() {\n\t\treturn buildSelectAst(this.state);\n\t}\n\tbuild() {\n\t\treturn buildPlan(this.state, this.ctx);\n\t}\n};\nvar SelectQueryImpl = class SelectQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new SelectQueryImpl(state, this.ctx);\n\t}\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.state, {\n\t\t\tprojections: [...this.state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.state.scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new SelectQueryImpl(cloneState(this.state, { where: [...this.state.where, result.buildAst()] }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, false);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\nvar GroupedQueryImpl = class GroupedQueryImpl extends QueryBase {\n\tclone(state) {\n\t\treturn new GroupedQueryImpl(state, this.ctx);\n\t}\n\thaving(expr) {\n\t\tconst combined = orderByScopeOf(this.state.scope, this.state.rowFields);\n\t\tconst fns = createAggregateFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer, this.ctx.aggregates);\n\t\tconst result = expr(createFieldProxy(combined), fns);\n\t\treturn new GroupedQueryImpl(cloneState(this.state, { having: result.buildAst() }), this.ctx);\n\t}\n\torderBy(arg, options) {\n\t\tconst item = resolveOrderBy(arg, options, this.state.scope, this.state.rowFields, this.ctx, true);\n\t\treturn this.clone(cloneState(this.state, { orderBy: [...this.state.orderBy, item] }));\n\t}\n};\n//#endregion\n//#region src/runtime/joined-tables-impl.ts\nvar JoinedTablesImpl = class JoinedTablesImpl extends BuilderBase {\n\t#state;\n\tconstructor(state, ctx) {\n\t\tsuper(ctx);\n\t\tthis.#state = state;\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, lateralScope);\n\t\treturn this.#addLateralJoin(\"inner\", resultScope, derivedSource);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\tconst { derivedSource, lateralScope } = this.#buildLateral(alias, builder);\n\t\tconst resultScope = mergeScopes(this.#state.scope, nullableScope(lateralScope));\n\t\treturn this.#addLateralJoin(\"left\", resultScope, derivedSource);\n\t});\n\tselect(...args) {\n\t\tconst { projections, newRowFields } = resolveSelectArgs(args, this.#state.scope, this.ctx);\n\t\treturn new SelectQueryImpl(cloneState(this.#state, {\n\t\t\tprojections: [...this.#state.projections, ...projections],\n\t\t\trowFields: {\n\t\t\t\t...this.#state.rowFields,\n\t\t\t\t...newRowFields\n\t\t\t}\n\t\t}), this.ctx);\n\t}\n\tinnerJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"inner\", targetScope, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\tconst targetScope = mergeScopes(this.#state.scope, nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"left\", targetScope, on);\n\t}\n\touterRightJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), other.getJoinOuterScope());\n\t\treturn this.#addJoin(other, \"right\", targetScope, on);\n\t}\n\touterFullJoin(other, on) {\n\t\tconst targetScope = mergeScopes(nullableScope(this.#state.scope), nullableScope(other.getJoinOuterScope()));\n\t\treturn this.#addJoin(other, \"full\", targetScope, on);\n\t}\n\t#addJoin(other, joinType, resultScope, onExpr) {\n\t\tconst onResult = onExpr(createFieldProxy(mergeScopes(this.#state.scope, other.getJoinOuterScope())), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\tconst joinAst = new JoinAst(joinType, other.buildAst(), onResult.buildAst());\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n\t#buildLateral(alias, builderFn) {\n\t\tconst subquery = builderFn({ from: (other) => {\n\t\t\tconst otherScope = other.getJoinOuterScope();\n\t\t\tconst parentMerged = mergeScopes(this.#state.scope, otherScope);\n\t\t\treturn new SelectQueryImpl(emptyState(other.buildAst(), parentMerged), this.ctx);\n\t\t} });\n\t\tconst subqueryAst = subquery.buildAst();\n\t\tconst derivedSource = DerivedTableSource.as(alias, subqueryAst);\n\t\tconst subqueryRowFields = subquery.getRowFields();\n\t\treturn {\n\t\t\tderivedSource,\n\t\t\tlateralScope: {\n\t\t\t\ttopLevel: subqueryRowFields,\n\t\t\t\tnamespaces: { [alias]: subqueryRowFields }\n\t\t\t}\n\t\t};\n\t}\n\t#addLateralJoin(joinType, resultScope, derivedSource) {\n\t\tconst joinAst = new JoinAst(joinType, derivedSource, AndExpr.of([]), true);\n\t\treturn new JoinedTablesImpl(cloneState(this.#state, {\n\t\t\tjoins: [...this.#state.joins, joinAst],\n\t\t\tscope: resultScope\n\t\t}), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/mutation-impl.ts\n/**\n* Validates and merges a variadic annotations call into a builder's\n* accumulated user-annotations map. Used by `.annotate(...)` on each of\n* the three mutation builders (`InsertQueryImpl`, `UpdateQueryImpl`,\n* `DeleteQueryImpl`); the read builders share the same logic via\n* `QueryBase.annotate()` in `./query-impl.ts`.\n*\n* Runs `assertAnnotationsApplicable` at call time (not at `.build()`) so\n* inapplicable annotations forced through casts surface immediately\n* rather than at plan-construction time.\n*/\nfunction mergeWriteAnnotations(current, annotations) {\n\tassertAnnotationsApplicable(annotations, \"write\", \"sql-dsl.annotate\");\n\tconst next = new Map(current);\n\tfor (const annotation of annotations) next.set(annotation.namespace, annotation);\n\treturn next;\n}\nfunction buildParamValues(values, namespaceId, table, tableName, op, ctx) {\n\tconst params = {};\n\tfor (const [col, value] of Object.entries(values)) {\n\t\tconst codec = table.columns[col] ? codecRefFor(ctx, namespaceId, tableName, col) : void 0;\n\t\tparams[col] = ParamRef.of(value, codec ? { codec } : void 0);\n\t}\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues\n\t})) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tparams[def.column] = ParamRef.of(def.value, codec ? { codec } : void 0);\n\t}\n\treturn params;\n}\nfunction buildReturningProjections(tableName, columns, rowFields) {\n\treturn columns.map((col) => ProjectionItem.of(col, ColumnRef.of(tableName, col), rowFields[col]?.codec));\n}\nfunction evaluateWhere(whereCallback, scope, queryOperationTypes, rawCodecInferer) {\n\treturn whereCallback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer)).buildAst();\n}\nfunction evaluateUpdateCallback(callback, scope, queryOperationTypes, rawCodecInferer) {\n\tconst result = callback(createFieldProxy(scope), createFunctions(queryOperationTypes, rawCodecInferer));\n\tconst set = {};\n\tfor (const [col, expr] of Object.entries(result)) if (expr !== void 0) set[col] = expr.buildAst();\n\treturn set;\n}\nfunction buildSetExpressions(exprs, namespaceId, table, tableName, op, ctx) {\n\tconst set = { ...exprs };\n\tfor (const def of ctx.applyMutationDefaults({\n\t\top,\n\t\tnamespace: namespaceId,\n\t\ttable: tableName,\n\t\tvalues: exprs\n\t})) if (!(def.column in set)) {\n\t\tconst codec = table.columns[def.column] ? codecRefFor(ctx, namespaceId, tableName, def.column) : void 0;\n\t\tset[def.column] = ParamRef.of(def.value, ifDefined(\"codec\", codec));\n\t}\n\treturn set;\n}\nvar InsertQueryImpl = class InsertQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#namespaceId;\n\t#table;\n\t#scope;\n\t#rows;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, namespaceId, table, scope, rows, ctx, returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#table = table;\n\t\tthis.#scope = scope;\n\t\tthis.#rows = rows;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* The type-level `As & ValidAnnotations<'write', As>` gate rejects\n\t* read-only annotations at the call site; the runtime check fails\n\t* closed for callers that bypass the type gate. See `QueryBase.annotate`\n\t* in `./query-impl.ts` for the read-builder counterpart.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new InsertQueryImpl(this.#tableSource, this.#namespaceId, this.#table, this.#scope, this.#rows, this.ctx, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tif (this.#rows.length === 0) throw structuredError(\"ORM.MUTATION_DATA_MISSING\", \"insert() called with an empty row array — at least one row is required\");\n\t\tconst paramRows = this.#rows.map((rowValues) => buildParamValues(rowValues, this.#namespaceId, this.#table, this.#tableName, \"create\", this.ctx));\n\t\tlet ast = InsertAst.into(this.#tableSource).withRows(paramRows);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#setExpressions;\n\t#whereExprs;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, setExpressions, ctx, whereExprs = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#setExpressions = setExpressions;\n\t\tthis.#whereExprs = whereExprs;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\tconst result = expr(createFieldProxy(this.#scope), createFunctions(this.ctx.queryOperationTypes, this.ctx.rawCodecInferer));\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, [...this.#whereExprs, result.buildAst()], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics; the runtime check\n\t* fails closed for callers that bypass the type-level gate.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new UpdateQueryImpl(this.#tableSource, this.#scope, this.#setExpressions, this.ctx, this.#whereExprs, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tlet ast = UpdateAst.table(this.#tableSource).withSet(this.#setExpressions).withWhere(combineWhereExprs(this.#whereExprs));\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\nvar DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {\n\t#tableSource;\n\t#tableName;\n\t#scope;\n\t#whereCallbacks;\n\t#returningColumns;\n\t#rowFields;\n\t#annotations;\n\tconstructor(tableSource, scope, ctx, whereCallbacks = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {\n\t\tsuper(ctx);\n\t\tthis.#tableSource = tableSource;\n\t\tthis.#tableName = tableSource.name;\n\t\tthis.#scope = scope;\n\t\tthis.#whereCallbacks = whereCallbacks;\n\t\tthis.#returningColumns = returningColumns;\n\t\tthis.#rowFields = rowFields;\n\t\tthis.#annotations = annotations;\n\t}\n\twhere(expr) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields, this.#annotations);\n\t}\n\treturning = this._gate({ sql: { returning: true } }, \"returning\", (...columns) => {\n\t\tconst newRowFields = {};\n\t\tfor (const col of columns) {\n\t\t\tconst field = this.#scope.topLevel[col];\n\t\t\tif (!field) throw structuredError(\"ORM.COLUMN_UNKNOWN\", `Column \"${col}\" not found in scope`, { meta: { column: col } });\n\t\t\tnewRowFields[col] = field;\n\t\t}\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, columns, newRowFields, this.#annotations);\n\t});\n\t/**\n\t* Attach one or more write-typed annotations to this query plan.\n\t* See `InsertQueryImpl.annotate` for semantics.\n\t*/\n\tannotate(...annotations) {\n\t\treturn new DeleteQueryImpl(this.#tableSource, this.#scope, this.ctx, this.#whereCallbacks, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));\n\t}\n\tbuild() {\n\t\tconst whereExpr = combineWhereExprs(this.#whereCallbacks.map((cb) => evaluateWhere(cb, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer)));\n\t\tlet ast = DeleteAst.from(this.#tableSource).withWhere(whereExpr);\n\t\tif (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));\n\t\treturn buildQueryPlan(ast, this.ctx, this.#annotations);\n\t}\n};\n//#endregion\n//#region src/runtime/table-source-for-proxy.ts\nfunction tableSourceForProxy(tableName, alias, namespaceId) {\n\treturn TableSource.named(tableName, alias !== tableName ? alias : void 0, namespaceId);\n}\n//#endregion\n//#region src/runtime/table-proxy-impl.ts\nvar TableProxyImpl = class TableProxyImpl extends BuilderBase {\n\t#tableName;\n\t#table;\n\t#namespaceId;\n\t#fromSource;\n\t#scope;\n\tconstructor(tableName, table, alias, ctx, namespaceId) {\n\t\tsuper(ctx);\n\t\tthis.#tableName = tableName;\n\t\tthis.#table = table;\n\t\tthis.#namespaceId = namespaceId;\n\t\tthis.#scope = tableToScope(alias, table, {\n\t\t\tstorage: ctx.storage,\n\t\t\ttableName,\n\t\t\tnamespaceId\n\t\t});\n\t\tthis.#fromSource = tableSourceForProxy(tableName, alias, namespaceId);\n\t}\n\tlateralJoin = this._gate({ sql: { lateral: true } }, \"lateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().lateralJoin(alias, builder);\n\t});\n\touterLateralJoin = this._gate({ sql: { lateral: true } }, \"outerLateralJoin\", (alias, builder) => {\n\t\treturn this.#toJoined().outerLateralJoin(alias, builder);\n\t});\n\tgetJoinOuterScope() {\n\t\treturn this.#scope;\n\t}\n\tbuildAst() {\n\t\treturn this.#fromSource;\n\t}\n\tas(newAlias) {\n\t\treturn new TableProxyImpl(this.#tableName, this.#table, newAlias, this.ctx, this.#namespaceId);\n\t}\n\tselect(...args) {\n\t\treturn new SelectQueryImpl(emptyState(this.#fromSource, this.#scope), this.ctx).select(...args);\n\t}\n\tinnerJoin(other, on) {\n\t\treturn this.#toJoined().innerJoin(other, on);\n\t}\n\touterLeftJoin(other, on) {\n\t\treturn this.#toJoined().outerLeftJoin(other, on);\n\t}\n\touterRightJoin(other, on) {\n\t\treturn this.#toJoined().outerRightJoin(other, on);\n\t}\n\touterFullJoin(other, on) {\n\t\treturn this.#toJoined().outerFullJoin(other, on);\n\t}\n\tinsert(rows) {\n\t\treturn new InsertQueryImpl(this.#fromSource, this.#namespaceId, this.#table, this.#scope, rows, this.ctx);\n\t}\n\tupdate(setOrCallback) {\n\t\tif (typeof setOrCallback === \"function\") {\n\t\t\tconst setExpressions = buildSetExpressions(evaluateUpdateCallback(setOrCallback, this.#scope, this.ctx.queryOperationTypes, this.ctx.rawCodecInferer), this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t\t}\n\t\tconst setExpressions = buildParamValues(setOrCallback, this.#namespaceId, this.#table, this.#tableName, \"update\", this.ctx);\n\t\treturn new UpdateQueryImpl(this.#fromSource, this.#scope, setExpressions, this.ctx);\n\t}\n\tdelete() {\n\t\treturn new DeleteQueryImpl(this.#fromSource, this.#scope, this.ctx);\n\t}\n\t#toJoined() {\n\t\treturn new JoinedTablesImpl(emptyState(this.#fromSource, this.#scope), this.ctx);\n\t}\n};\n//#endregion\n//#region src/runtime/sql.ts\nfunction sql(options) {\n\tconst { context, rawCodecInferer } = options;\n\tconst ctx = {\n\t\tcapabilities: context.contract.capabilities,\n\t\tqueryOperationTypes: context.queryOperations.entries(),\n\t\ttarget: context.contract.target ?? \"unknown\",\n\t\tstorageHash: context.contract.storage.storageHash ?? \"unknown\",\n\t\tstorage: context.contract.storage,\n\t\tapplyMutationDefaults: (options) => context.applyMutationDefaults(options),\n\t\trawCodecInferer,\n\t\taggregates: context.aggregateDescriptors\n\t};\n\tconst { storage } = context.contract;\n\treturn new Proxy({}, { get(_target, prop) {\n\t\tif (typeof prop !== \"string\") return;\n\t\tif (!Object.hasOwn(storage.namespaces, prop)) return;\n\t\tconst namespaceId = prop;\n\t\treturn new Proxy({}, { get(_facetTarget, tableName) {\n\t\t\tif (typeof tableName !== \"string\") return;\n\t\t\tconst table = resolveTableInNamespace(storage, namespaceId, tableName);\n\t\t\tif (table) return new TableProxyImpl(tableName, table, tableName, ctx, namespaceId);\n\t\t} });\n\t} });\n}\n//#endregion\nexport { ExpressionImpl, createAggregateFunctions, createFieldProxy, createFunctions, sql };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,UAAU,KAAK,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;AAC1D;AAGA,SAAS,gBAAgB,MAAM,SAAS,SAAS;CAChD,MAAM,QAAQ,SAAS,UAAU,KAAK,IAAI,IAAI,MAAM,SAAS,EAAE,OAAO,QAAQ,MAAM,C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,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,cAAc,WAAW;GACnD,IAAI,OAAO,cAAc,UAAU;GACnC,MAAM,QAAQ,wBAAwB,SAAS,aAAa,SAAS;GACrE,IAAI,OAAO,OAAO,IAAI,eAAe,WAAW,OAAO,WAAW,KAAK,WAAW;EACnF,EAAE,CAAC;CACJ,EAAE,CAAC;AACJ"}
@@ -8,7 +8,7 @@ import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as s
8
8
  import { n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, s as verifySqlSchemaByDiff, t as classifyDiffEntityKind } from "./schema-verify-C_PEdlAr-U3MX28Zu.mjs";
9
9
  import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
10
10
  import { t as SqlContractSerializer } from "./sql-contract-serializer-2oBWuxTe-US2zhmuA.mjs";
11
- import { t as collectSupportedCodecTypeIds } from "./verify-E6Dd2vYp-gYwnlhLm.mjs";
11
+ import { t as collectSupportedCodecTypeIds } from "./verify-u0UTdZgD-DSAaz9rW.mjs";
12
12
  import { isPlainRecord } from "@prisma/orm-framework/components/ir";
13
13
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
14
14
  import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
@@ -1264,4 +1264,4 @@ var control_default = new SqlFamilyDescriptor();
1264
1264
  //#endregion
1265
1265
  export { contractToSchemaIR as a, createMigrationPlan as c, partitionIssuesByControlPolicy as d, planFieldEventOperations as f, runnerSuccess as g, runnerFailure as h, contractNamespaceToSchemaIR as i, detectDestructiveChanges as l, plannerSuccess as m, assembleAuthoringContributions as n, controlPolicyForCall as o, plannerFailure as p, buildNativeTypeExpander as r, control_default as s, INIT_ADDITIVE_POLICY as t, partitionCallsByControlPolicy as u };
1266
1266
 
1267
- //# sourceMappingURL=control-DC3tc4EF.mjs.map
1267
+ //# sourceMappingURL=control-f9B6b5c2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-DC3tc4EF.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/control.mjs"],"sourcesContent":["import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from \"./authoring-type-constructors-Blqoa2Ua.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-C_PEdlAr.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-2oBWuxTe.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-E6Dd2vYp.mjs\";\nimport { a as timestampNowControlDescriptor, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, r as temporalCodecPreset } from \"./timestamp-now-generator-DRXygu32.mjs\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions } from \"@internal/framework-components/control\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { StorageTable, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/core/operation-preview.ts\nfunction isDdlStatement(sqlStatement) {\n\tconst trimmed = sqlStatement.trim().toLowerCase();\n\treturn trimmed.startsWith(\"create \") || trimmed.startsWith(\"alter \") || trimmed.startsWith(\"drop \");\n}\nfunction hasExecuteSteps(operation) {\n\tconst candidate = operation;\n\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) return false;\n\treturn candidate[\"execute\"].every((step) => typeof step === \"object\" && step !== null && \"sql\" in step);\n}\n/**\n* Extracts a best-effort SQL DDL preview for CLI plan output.\n* Presentation-only: never used to decide migration correctness.\n*/\nfunction extractSqlDdl(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tif (!hasExecuteSteps(operation)) continue;\n\t\tfor (const step of operation.execute) if (typeof step.sql === \"string\" && isDdlStatement(step.sql)) statements.push(step.sql.trim());\n\t}\n\treturn statements;\n}\n/**\n* Wraps `extractSqlDdl` into the family-agnostic `OperationPreview` shape.\n* Each statement carries `language: 'sql'`.\n*/\nfunction sqlOperationsToPreview(operations) {\n\treturn { statements: extractSqlDdl(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"sql\"\n\t})) };\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction missingDescriptorOperationError(targetId, operation) {\n\treturn sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `SQL target \"${targetId}\" is missing the required ${operation} descriptor operation`, {\n\t\twhy: `The target descriptor does not contribute the ${operation} operation the SQL family requires for this call.`,\n\t\tfix: `Use a target package whose control descriptor implements ${operation}.`,\n\t\tmeta: {\n\t\t\ttargetId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction extractCodecTypeIdsFromContract(contract) {\n\tconst typeIds = /* @__PURE__ */ new Set();\n\tif (typeof contract === \"object\" && contract !== null && \"storage\" in contract && typeof contract.storage === \"object\" && contract.storage !== null && \"namespaces\" in contract.storage && typeof contract.storage.namespaces === \"object\" && contract.storage.namespaces !== null) {\n\t\tconst namespaces = contract.storage.namespaces;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tconst tbls = ns.entries[\"table\"];\n\t\t\tif (typeof tbls !== \"object\" || tbls === null) continue;\n\t\t\tfor (const table of Object.values(tbls)) if (typeof table === \"object\" && table !== null && \"columns\" in table && typeof table.columns === \"object\" && table.columns !== null) {\n\t\t\t\tconst columns = table.columns;\n\t\t\t\tfor (const column of Object.values(columns)) if (column && typeof column === \"object\" && \"codecId\" in column && typeof column.codecId === \"string\") typeIds.add(column.codecId);\n\t\t\t}\n\t\t}\n\t}\n\treturn Array.from(typeIds).sort();\n}\nfunction createVerifyResult(options) {\n\tconst contract = { storageHash: options.contractStorageHash };\n\tif (options.contractProfileHash) contract.profileHash = options.contractProfileHash;\n\tconst target = { expected: options.expectedTargetId };\n\tif (options.actualTargetId) target.actual = options.actualTargetId;\n\tconst meta = { contractPath: options.contractPath };\n\tif (options.configPath) meta.configPath = options.configPath;\n\tconst result = {\n\t\tok: options.ok,\n\t\tsummary: options.summary,\n\t\tcontract,\n\t\ttarget,\n\t\tmeta,\n\t\ttimings: { total: options.totalTime }\n\t};\n\tif (options.code) result.code = options.code;\n\tif (options.marker) result.marker = {\n\t\tstorageHash: options.marker.storageHash,\n\t\tprofileHash: options.marker.profileHash\n\t};\n\tif (options.missingCodecs) result.missingCodecs = options.missingCodecs;\n\tif (options.codecCoverageSkipped) result.codecCoverageSkipped = options.codecCoverageSkipped;\n\treturn result;\n}\nfunction buildSqlTypeMetadataRegistry(options) {\n\tconst { target, adapter, extensions } = options;\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst targetId = adapter.targetId;\n\tconst descriptors = [\n\t\ttarget,\n\t\tadapter,\n\t\t...extensions\n\t];\n\tfor (const descriptor of descriptors) {\n\t\tconst storageTypes = descriptor.types?.storage;\n\t\tif (!storageTypes) continue;\n\t\tfor (const storageType of storageTypes) if (storageType.familyId === \"sql\" && storageType.targetId === targetId) registry.set(storageType.typeId, {\n\t\t\ttypeId: storageType.typeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: storageType.targetId,\n\t\t\t...storageType.nativeType !== void 0 ? { nativeType: storageType.nativeType } : {}\n\t\t});\n\t}\n\treturn registry;\n}\n/**\n* Builds a map from each extension id to the set of extension ids it\n* transitively depends on. Uses the same declared-dependency data that\n* `buildExtensionLoadOrder` in control-stack uses.\n*/\nfunction buildTransitiveDependsOnMap(extensions) {\n\tconst directDeps = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tconst packs = ext.contractSpace?.contractJson?.extensions;\n\t\tconst deps = packs !== null && typeof packs === \"object\" ? Object.keys(packs) : [];\n\t\tdirectDeps.set(ext.id, deps);\n\t}\n\tconst result = /* @__PURE__ */ new Map();\n\tconst resolve = (id, visiting) => {\n\t\tconst cached = result.get(id);\n\t\tif (cached !== void 0) return cached;\n\t\tconst set = /* @__PURE__ */ new Set();\n\t\tresult.set(id, set);\n\t\tfor (const depId of directDeps.get(id) ?? []) {\n\t\t\tset.add(depId);\n\t\t\tif (!visiting.has(depId)) {\n\t\t\t\tvisiting.add(depId);\n\t\t\t\tfor (const transitive of resolve(depId, visiting)) set.add(transitive);\n\t\t\t\tvisiting.delete(depId);\n\t\t\t}\n\t\t}\n\t\treturn set;\n\t};\n\tfor (const ext of extensions) resolve(ext.id, /* @__PURE__ */ new Set([ext.id]));\n\treturn result;\n}\n/**\n* Asserts that no cross-space FK in any extension points against the\n* dependency direction.\n*\n* A cross-space FK (target.spaceId present) from extension A pointing at\n* space B is a violation when B depends on A (directly or transitively),\n* because that means A is pointing \"upward\" against the dependency arrows\n* established by the extension load order.\n*\n* Throws with a diagnostic naming the violating extension (source), the\n* target space, and the direction violation.\n*/\nfunction isObjectRecord(v) {\n\treturn typeof v === \"object\" && v !== null;\n}\nfunction assertNoCrossSpaceFkReverseReferences(extensions) {\n\tconst dependsOnMap = buildTransitiveDependsOnMap(extensions);\n\tfor (const ext of extensions) {\n\t\tconst namespaces = ext.contractSpace?.contractJson?.storage?.namespaces;\n\t\tif (!isObjectRecord(namespaces)) continue;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tif (!isObjectRecord(ns)) continue;\n\t\t\tconst entries = ns[\"entries\"];\n\t\t\tif (!isObjectRecord(entries)) continue;\n\t\t\tfor (const slot of Object.values(entries)) {\n\t\t\t\tif (!isObjectRecord(slot)) continue;\n\t\t\t\tfor (const table of Object.values(slot)) {\n\t\t\t\t\tif (!isObjectRecord(table)) continue;\n\t\t\t\t\tconst foreignKeys = table[\"foreignKeys\"];\n\t\t\t\t\tif (!Array.isArray(foreignKeys)) continue;\n\t\t\t\t\tfor (const fk of foreignKeys) {\n\t\t\t\t\t\tif (!isObjectRecord(fk)) continue;\n\t\t\t\t\t\tconst target = fk[\"target\"];\n\t\t\t\t\t\tif (!isObjectRecord(target)) continue;\n\t\t\t\t\t\tif (target[\"spaceId\"] === void 0) continue;\n\t\t\t\t\t\tconst targetSpaceId = target[\"spaceId\"];\n\t\t\t\t\t\tif (typeof targetSpaceId !== \"string\") continue;\n\t\t\t\t\t\tif (dependsOnMap.get(targetSpaceId)?.has(ext.id)) throw sqlFamilyError(\"CONTRACT.FOREIGN_KEY_INVALID\", `Cross-space FK reverse-reference detected: extension \"${ext.id}\" has a cross-space FK targeting space \"${targetSpaceId}\", but \"${targetSpaceId}\" depends on \"${ext.id}\". Cross-space FKs must follow the dependency direction (a space can only reference spaces it depends on, not spaces that depend on it).`, {\n\t\t\t\t\t\t\twhy: \"The foreign key points against the contract-space dependency direction.\",\n\t\t\t\t\t\t\tfix: \"Move the foreign key to the depending space, or restructure the extension dependencies so the referencing space depends on the referenced one.\",\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\textensionId: ext.id,\n\t\t\t\t\t\t\t\ttargetSpaceId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nfunction createSqlFamilyInstance(stack) {\n\tif (!stack.adapter) throw new InternalError(\"SQL family requires an adapter descriptor in ControlStack\");\n\tconst target = stack.target;\n\tconst adapter = stack.adapter;\n\tconst extensions = stack.extensions;\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...sqlContractCanonicalizationHooks\n\t\t});\n\t}\n\tassertNoCrossSpaceFkReverseReferences(extensions);\n\tconst { codecTypeImports, extensionIds } = stack;\n\tconst typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t});\n\tlet controlAdapter;\n\tconst getControlAdapter = () => controlAdapter ??= adapter.create(stack);\n\tconst targetSerializer = target.contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\n\tconst diffSchema = blindCast(target).diffSchema;\n\tconst targetGranularityOf = blindCast(target).classifySubjectGranularity;\n\tconst targetEntityKindOf = blindCast(target).classifyEntityKind;\n\tconst describedContracts = extensions.flatMap((extension) => extension.contractSpace ? [{\n\t\tspaceId: extension.id,\n\t\tcontract: extension.contractSpace.contractJson\n\t}] : []);\n\tconst deserializeWithTargetSerializer = (contractOrJson) => {\n\t\tconst serializer = targetSerializer ?? new SqlContractSerializer();\n\t\tconst json = targetSerializer !== void 0 && !isPlainRecord(contractOrJson) ? targetSerializer.serializeContract(blindCast(contractOrJson)) : contractOrJson;\n\t\treturn serializer.deserializeContract(json);\n\t};\n\treturn {\n\t\tfamilyId: \"sql\",\n\t\tcodecTypeImports,\n\t\textensionIds,\n\t\ttypeMetadataRegistry,\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn deserializeWithTargetSerializer(contractJson);\n\t\t},\n\t\tasync verify(verifyOptions) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = verifyOptions;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst marker = await getControlAdapter().readMarker(driver, APP_SPACE_ID);\n\t\t\tlet missingCodecs;\n\t\t\tlet codecCoverageSkipped = false;\n\t\t\tconst supportedTypeIds = collectSupportedCodecTypeIds([\n\t\t\t\tadapter,\n\t\t\t\ttarget,\n\t\t\t\t...extensions\n\t\t\t]);\n\t\t\tif (supportedTypeIds.length === 0) codecCoverageSkipped = true;\n\t\t\telse {\n\t\t\t\tconst supportedSet = new Set(supportedTypeIds);\n\t\t\t\tconst missing = extractCodecTypeIdsFromContract(contract).filter((id) => !supportedSet.has(id));\n\t\t\t\tif (missing.length > 0) missingCodecs = missing;\n\t\t\t}\n\t\t\tif (!marker) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractTarget !== expectedTargetId) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\treturn createVerifyResult({\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\tconst contract = deserializeWithTargetSerializer(options.contract);\n\t\t\tif (!diffSchema) throw missingDescriptorOperationError(target.targetId, \"diffSchema\");\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn verifySqlSchemaByDiff({\n\t\t\t\tcontract,\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\tdiffSchema,\n\t\t\t\tgranularityOf: targetGranularityOf\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject granularity on demand, by resolving\n\t\t* its node's `nodeKind` through the target's classifier — the\n\t\t* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability. Framework consumers spanning contract spaces (the\n\t\t* migration aggregate's unclaimed-elements sweep) detect and call this\n\t\t* instead of reaching into the concrete schema-IR node, which they\n\t\t* cannot read; nothing is stamped on the issue or the node.\n\t\t*/\n\t\tclassifySubjectGranularity(issue) {\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn classifyDiffSubjectGranularity(issue, targetGranularityOf);\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject storage `entityKind` on demand, by\n\t\t* resolving its node's `nodeKind` through the target's classifier —\n\t\t* the sibling of `classifySubjectGranularity` above, and part of the\n\t\t* same {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability.\n\t\t*/\n\t\tclassifyEntityKind(issue) {\n\t\t\tif (!targetEntityKindOf) throw missingDescriptorOperationError(target.targetId, \"classifyEntityKind\");\n\t\t\treturn classifyDiffEntityKind(issue, targetEntityKindOf);\n\t\t},\n\t\tasync sign(options) {\n\t\t\tconst { driver, contract: contractInput, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(contractInput);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = \"profileHash\" in contract && typeof contract.profileHash === \"string\" ? contract.profileHash : contractStorageHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst controlAdapter = getControlAdapter();\n\t\t\tconst lowererContext = { contract };\n\t\t\tfor (const query of controlAdapter.bootstrapSignMarkerQueries()) {\n\t\t\t\tconst lowered = await controlAdapter.lowerToExecuteRequest(query, lowererContext);\n\t\t\t\tawait driver.query(lowered.sql, lowered.params);\n\t\t\t}\n\t\t\tconst existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.insertMarker(driver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst existingStorageHash = existingMarker.storageHash;\n\t\t\t\tconst existingProfileHash = existingMarker.profileHash;\n\t\t\t\tif (!(existingStorageHash === contractStorageHash) || !(existingProfileHash === contractProfileHash)) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingStorageHash,\n\t\t\t\t\t\tprofileHash: existingProfileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(driver, APP_SPACE_ID, existingStorageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw sqlFamilyError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\", {\n\t\t\t\t\t\twhy: \"Another process updated the contract marker between the read and the compare-and-swap write.\",\n\t\t\t\t\t\tfix: \"Re-run the sign command; if it keeps failing, make sure only one migration process runs at a time.\",\n\t\t\t\t\t\tmeta: { space: APP_SPACE_ID }\n\t\t\t\t\t});\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\tconst totalTime = Date.now() - startTime;\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contractTarget,\n\t\t\t\t\tactual: contractTarget\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...previousHashes ? { previous: previousHashes } : {}\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t\t},\n\t\t\t\ttimings: { total: totalTime }\n\t\t\t};\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(options.driver, options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(options.driver);\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(options.driver, options.space);\n\t\t},\n\t\tasync initMarker(options) {\n\t\t\treturn getControlAdapter().initMarker(options.driver, options.space, options.destination);\n\t\t},\n\t\tasync updateMarker(options) {\n\t\t\treturn getControlAdapter().updateMarker(options.driver, options.space, options.expectedFrom, options.destination);\n\t\t},\n\t\tasync writeLedgerEntry(options) {\n\t\t\treturn getControlAdapter().writeLedgerEntry(options.driver, options.space, options.entry);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspect(options.driver, options.contract);\n\t\t},\n\t\tinferPslContract(schemaIR) {\n\t\t\tif (!targetInferPslContract) throw sqlFamilyError(\"CONTRACT.INFER_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract infer (no inferPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the inferPslContract hook, so a PSL contract cannot be inferred from the database schema.\",\n\t\t\t\tfix: \"Use a target package that supports contract infer, or author the contract instead of inferring it.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn targetInferPslContract(schemaIR, describedContracts);\n\t\t},\n\t\tlowerAst(ast, context) {\n\t\t\treturn getControlAdapter().lowerToExecuteRequest(ast, context);\n\t\t},\n\t\tbootstrapControlTableQueries() {\n\t\t\treturn getControlAdapter().bootstrapControlTableQueries();\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn sqlOperationsToPreview(operations);\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\tconst root = blindCast(schema);\n\t\t\tconst namespaceEntries = root.namespaces !== void 0 ? Object.entries(root.namespaces).map(([namespaceKey, namespace]) => [namespaceKey, namespace.tables]) : [[void 0, root.tables ?? {}]];\n\t\t\tconst qualify = namespaceEntries.length > 1;\n\t\t\tconst tableNodes = namespaceEntries.flatMap(([namespaceKey, tables]) => Object.entries(tables).map(([tableName, table]) => [\n\t\t\t\tqualify && namespaceKey !== void 0 ? `${namespaceKey}.${tableName}` : tableName,\n\t\t\t\ttableName,\n\t\t\t\ttable\n\t\t\t])).map(([displayName, tableName, table]) => {\n\t\t\t\tconst children = [];\n\t\t\t\tconst columnNodes = [];\n\t\t\t\tfor (const [columnName, column] of Object.entries(table.columns)) {\n\t\t\t\t\tconst label = `${columnName}: ${column.nativeType} (${column.nullable ? \"nullable\" : \"not nullable\"})`;\n\t\t\t\t\tcolumnNodes.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"field\",\n\t\t\t\t\t\tid: `column-${displayName}-${columnName}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tnativeType: column.nativeType,\n\t\t\t\t\t\t\tnullable: column.nullable,\n\t\t\t\t\t\t\t...ifDefined(\"default\", column.default)\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tif (columnNodes.length > 0) children.push(new SchemaTreeNode({\n\t\t\t\t\tkind: \"collection\",\n\t\t\t\t\tid: `columns-${displayName}`,\n\t\t\t\t\tlabel: \"columns\",\n\t\t\t\t\tchildren: columnNodes\n\t\t\t\t}));\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\tconst pkColumns = table.primaryKey.columns.join(\", \");\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `primary-key-${displayName}`,\n\t\t\t\t\t\tlabel: `primary key: ${pkColumns}`,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t\t\t\t\t...table.primaryKey.name ? { name: table.primaryKey.name } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const unique of table.uniques) {\n\t\t\t\t\tconst name = unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_unique`;\n\t\t\t\t\tconst label = `unique ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `unique-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: unique.columns,\n\t\t\t\t\t\t\tunique: true\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const index of table.indexes) {\n\t\t\t\t\tconst name = index.name;\n\t\t\t\t\tconst label = index.unique ? `unique index ${name}` : `index ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `index-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: index.columns,\n\t\t\t\t\t\t\tunique: index.unique\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tconst tableMeta = {};\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\ttableMeta[\"primaryKey\"] = table.primaryKey.columns;\n\t\t\t\t\tif (table.primaryKey.name) tableMeta[\"primaryKeyName\"] = table.primaryKey.name;\n\t\t\t\t}\n\t\t\t\tif (table.foreignKeys.length > 0) tableMeta[\"foreignKeys\"] = table.foreignKeys.map((fk) => ({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\t...fk.name ? { name: fk.name } : {}\n\t\t\t\t}));\n\t\t\t\treturn new SchemaTreeNode({\n\t\t\t\t\tkind: \"entity\",\n\t\t\t\t\tid: `table-${displayName}`,\n\t\t\t\t\tlabel: `table ${displayName}`,\n\t\t\t\t\t...Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {},\n\t\t\t\t\t...children.length > 0 ? { children } : {}\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn { root: new SchemaTreeNode({\n\t\t\t\tkind: \"root\",\n\t\t\t\tid: \"sql-schema\",\n\t\t\t\tlabel: \"database\",\n\t\t\t\t...tableNodes.length > 0 ? { children: tableNodes } : {}\n\t\t\t}) };\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors\n\t};\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst baseNativeType = expandNativeType ? expandNativeType({\n\t\tnativeType: resolved.nativeType,\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams)\n\t}) : resolved.nativeType;\n\tconst nativeType = baseNativeType;\n\tconst resolvedNativeType = column.many ? `${baseNativeType}[]` : baseNativeType;\n\tconst rawColumnDefault = column.default ?? void 0;\n\tconst resolvedColumnDefault = rawColumnDefault !== void 0 && resolveDefault ? resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;\n\treturn {\n\t\tname,\n\t\tnativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", column.many),\n\t\t...ifDefined(\"default\", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0),\n\t\tresolvedNativeType,\n\t\t...ifDefined(\"resolvedDefault\", resolvedColumnDefault),\n\t\tcodecRef: buildColumnCodecRef(resolved, column.many),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {}\n\t};\n}\n/**\n* Builds the column's `CodecRef` from its resolved (post-`typeRef`) codec\n* identity — the same construction the query AST and the migration DDL\n* renderer already use (TML-2456, TML-2918).\n*/\nfunction buildColumnCodecRef(resolved, many) {\n\treturn {\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams !== void 0 ? blindCast(resolved.typeParams) : void 0),\n\t\t...ifDefined(\"many\", many)\n\t};\n}\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referenced = storageTypes[column.typeRef];\n\tif (!referenced) throw sqlFamilyError(\"CONTRACT.TYPE_UNKNOWN\", `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`, {\n\t\twhy: \"The column typeRef does not resolve to any entry in the contract storage.types map.\",\n\t\tfix: \"Regenerate the contract from its authoring source; do not hand-edit contract JSON.\",\n\t\tmeta: { typeRef: column.typeRef }\n\t});\n\tif (isStorageTypeInstance(referenced)) return {\n\t\tcodecId: referenced.codecId,\n\t\tnativeType: referenced.nativeType,\n\t\ttypeParams: referenced.typeParams\n\t};\n\tthrow new InternalError(`Storage type \"${column.typeRef}\" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`);\n}\nfunction convertCheck(check, tableName, tableColumns) {\n\treturn {\n\t\tnaming: namingOf(check.name, check.prefix),\n\t\texpression: check.expression,\n\t\tdependsOn: flatColumnDependsOn(tableName, tableColumns)\n\t};\n}\nfunction convertUnique(unique, tableName) {\n\treturn {\n\t\tcolumns: unique.columns,\n\t\t...ifDefined(\"name\", unique.name),\n\t\tdependsOn: flatColumnDependsOn(tableName, unique.columns)\n\t};\n}\nfunction convertIndex(index, tableName, tableColumns) {\n\tconst base = {\n\t\tnaming: namingOf(index.name, index.prefix),\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.where !== void 0,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: void 0,\n\t\tdependsOn: flatColumnDependsOn(tableName, index.columns ?? tableColumns)\n\t};\n\treturn index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: index.columns ?? []\n\t};\n}\n/**\n* The referenced table's chain in the flat (single-schema) tree\n* `contractToSchemaIR`/`contractNamespaceToSchemaIR` build: the root\n* (`SqlSchemaIR`, fixed `'database'` id) followed by the table's own id.\n* Postgres discards this when it re-derives the FK against its own\n* multi-schema tree shape (`contractToPostgresDatabaseSchemaNode`); SQLite's\n* flat tree uses it as-is.\n*/\nfunction flatSchemaDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the flat tree. Dropping\n* a covered column auto-drops the object, so the object's drop must precede\n* the column's; the graph derives that direction from these edges.\n*/\nfunction flatColumnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\t\tid: \"database\"\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\t\tid: `column:${column}`\n\t\t}\n\t]);\n}\n/**\n* The FK's referenced-namespace identity comes from the target's namespace\n* node, not the raw namespace-id string. An unbound target namespace stamps\n* no `referencedSchema` at all — the FK node's id renders the absence as the\n* empty segment, which is what flat (single-schema) introspection produces,\n* so both diff sides' FK ids meet by construction. A bound namespace (or a\n* cross-space target whose namespace lives in another contract's storage)\n* stamps its coordinate verbatim; namespaced targets (Postgres) resolve the\n* real DDL schema downstream.\n*\n* `dependsOn` carries the referenced table (created before the FK, dropped\n* after it) plus the FK's own columns (dropped after the FK, since dropping a\n* column auto-drops the FK built on it).\n*/\nfunction convertForeignKey(fk, storage) {\n\tconst targetIsUnbound = storage.namespaces[fk.target.namespaceId]?.isUnbound === true;\n\treturn {\n\t\tcolumns: fk.source.columns,\n\t\treferencedTable: fk.target.tableName,\n\t\t...targetIsUnbound ? {} : { referencedSchema: fk.target.namespaceId },\n\t\treferencedColumns: fk.target.columns,\n\t\t...ifDefined(\"name\", fk.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\tdependsOn: [flatSchemaDependsOn(fk.target.tableName), ...flatColumnDependsOn(fk.source.tableName, fk.source.columns)]\n\t};\n}\nfunction convertTable(name, table, storageTypes, expandNativeType, renderDefault, resolveDefault, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault);\n\tconst checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, name, Object.keys(table.columns))) : void 0;\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey !== void 0 ? {\n\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t...ifDefined(\"name\", table.primaryKey.name),\n\t\t\tdependsOn: flatColumnDependsOn(name, table.primaryKey.columns)\n\t\t} : void 0),\n\t\tforeignKeys: table.foreignKeys.map((fk) => convertForeignKey(fk, storage)),\n\t\tuniques: table.uniques.map((u) => convertUnique(u, name)),\n\t\tindexes: table.indexes.map((i) => convertIndex(i, name, Object.keys(table.columns))),\n\t\t...ifDefined(\"checks\", checks)\n\t});\n}\n/**\n* Detects destructive changes between two contract storages.\n*\n* The additive-only planner silently ignores removals (tables, columns).\n* This function detects those removals so callers can report them as conflicts\n* rather than silently producing an empty plan.\n*\n* Returns an empty array if no destructive changes are found.\n*/\nfunction detectDestructiveChanges(from, to) {\n\tif (!from) return [];\n\tconst hasOwn = (value, key) => Object.hasOwn(value, key);\n\tconst conflicts = [];\n\tconst namespaceIds = [.../* @__PURE__ */ new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)])].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst fromNs = from.namespaces[namespaceId];\n\t\tconst toNs = to.namespaces[namespaceId];\n\t\tconst fromTables = fromNs?.entries.table;\n\t\tif (!fromTables) continue;\n\t\tfor (const tableName of Object.keys(fromTables)) {\n\t\t\tconst toTableRaw = toNs?.entries.table?.[tableName];\n\t\t\tif (!StorageTable.is(toTableRaw)) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tkind: \"tableRemoved\",\n\t\t\t\t\tsummary: `Table \"${tableName}\" was removed`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst toTable = toTableRaw;\n\t\t\tconst fromTableRaw = fromTables[tableName];\n\t\t\tif (!StorageTable.is(fromTableRaw)) continue;\n\t\t\tconst fromTable = fromTableRaw;\n\t\t\tfor (const columnName of Object.keys(fromTable.columns)) if (!hasOwn(toTable.columns, columnName)) conflicts.push({\n\t\t\t\tkind: \"columnRemoved\",\n\t\t\t\tsummary: `Column \"${tableName}\".\"${columnName}\" was removed`\n\t\t\t});\n\t\t}\n\t}\n\treturn conflicts;\n}\n/**\n* Converts a `Contract` to `SqlSchemaIR`.\n*\n* Reads `contract.storage` for tables and `contract.storage.types` for type\n* annotations. Storage-type annotations are written under\n* `options.annotationNamespace`.\n*\n* Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n* structural information. When `expandNativeType` is provided, parameterized types\n* are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n* resulting IR compares correctly against the \"to\" contract during planning.\n*\n* Returns an empty schema IR when `contract` is `null` (new project).\n*/\n/**\n* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by\n* table name within that namespace. Unlike {@link contractToSchemaIR}, which\n* flattens every namespace's tables into one bare-keyed record (and throws on a\n* cross-namespace name collision), this scopes the table iteration to one\n* namespace so the same table name can exist in two schemas.\n*\n* The full `storage` is still passed to `convertTable`, so value-set / enum /\n* type resolution that legitimately spans namespaces is unaffected. Foreign\n* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace\n* FKs survive per-namespace conversion. The `annotations` block (storage-type\n* derived) is omitted here — the per-namespace tree consumer reads only the\n* per-table fields.\n*/\nfunction contractNamespaceToSchemaIR(storage, namespaceId, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (!namespace) return new SqlSchemaIR({ tables: {} });\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);\n\t\ttables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, storage);\n\t}\n\treturn new SqlSchemaIR({ tables });\n}\nfunction contractToSchemaIR(contract, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tif (!contract) return new SqlSchemaIR({ tables: {} });\n\tconst storage = contract.storage;\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);\n\t\tconst tableDef = tableDefRaw;\n\t\tif (tables[tableName] !== void 0) throw sqlFamilyError(\"CONTRACT.TABLE_AMBIGUOUS\", `contractToSchemaIR: duplicate SQL table name \"${tableName}\" across namespaces (ambiguous for flat SqlSchemaIR.tables).`, {\n\t\t\twhy: \"Two namespaces declare a table with the same name, which is ambiguous for the flat schema-IR table map.\",\n\t\t\tfix: \"Rename one of the tables so every table name is unique across namespaces.\",\n\t\t\tmeta: { table: tableName }\n\t\t});\n\t\ttables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, storage);\n\t}\n\treturn new SqlSchemaIR({\n\t\ttables,\n\t\t...ifDefined(\"annotations\", deriveAnnotations(storage, options.annotationNamespace, options.resolveEnumNamespaceSchema))\n\t});\n}\nfunction deriveAnnotations(storage, annotationNamespace, _resolveEnumNamespaceSchema) {\n\tconst storageTypes = {};\n\tfor (const typeInstance of Object.values(storage.types ?? {})) if (isStorageTypeInstance(typeInstance)) storageTypes[typeInstance.nativeType] = typeInstance;\n\tconst envelope = { ...Object.keys(storageTypes).length > 0 ? { storageTypes } : {} };\n\tif (Object.keys(envelope).length === 0) return void 0;\n\treturn { [annotationNamespace]: envelope };\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* The control policy that governs a single call. The `external` default is an\n* un-overridable namespace floor: when the contract default is `external`, no\n* per-object `managed` override can escalate DDL above the floor, so the\n* policy is forced to `external` regardless of the node's own declaration.\n* Every other default defers to the node's effective control policy.\n*/\nfunction controlPolicyForCall(subject, defaultControlPolicy) {\n\tif (defaultControlPolicy === \"external\") return \"external\";\n\treturn effectiveControlPolicy(subject?.explicitNodeControlPolicy, defaultControlPolicy);\n}\n/**\n* Whether a call is allowed to emit under a given control policy.\n*\n* - `managed` — full lifecycle, every op allowed.\n* - `tolerated` — create-if-absent only: allowed iff the call creates a whole\n* new top-level object (and its subject was positively resolved). Anything\n* that modifies an existing object, and anything whose subject could not be\n* resolved, is suppressed.\n* - `external` / `observed` — no DDL at all.\n*/\nfunction callAllowedUnderControlPolicy(policy, subject) {\n\tswitch (policy) {\n\t\tcase \"managed\": return true;\n\t\tcase \"tolerated\": return subject?.createsNewObject === true;\n\t\tcase \"external\":\n\t\tcase \"observed\": return false;\n\t}\n}\n/**\n* Partition the calls produced for a single set of subjects into those the\n* effective control policy permits (`kept`) and a list of\n* {@link SuppressionRecord}s describing the suppressed calls.\n*\n* **Prefer {@link partitionIssuesByControlPolicy}** for the schema-issue\n* pipeline: it filters subjects out of the planner's *input* so the planner\n* never has to reason about un-modeled state on `external`/`observed`\n* subjects. This call-level helper remains for paths that bypass the issue\n* pipeline — currently the codec-emitted field-event ops, which originate\n* from declared contract fields rather than from introspected schema state\n* and therefore cannot trip the diff engine.\n*/\nfunction partitionCallsByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst kept = [];\n\tconst suppressions = [];\n\tfor (const call of options.calls) {\n\t\tconst subject = options.resolveControlPolicySubject(call);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tif (callAllowedUnderControlPolicy(policy, subject)) kept.push(call);\n\t\telse suppressions.push({\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\tfactoryName: options.resolveFactoryName(call),\n\t\t\tcreatesNewObject: subject?.createsNewObject ?? false\n\t\t});\n\t}\n\treturn Object.freeze({\n\t\tkept: Object.freeze(kept),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\n/**\n* Partition a list of schema-issue-shaped inputs by the effective control\n* policy of each issue's subject *before* the planner is invoked.\n*\n* `plannable` is the list of issues whose subject's effective policy permits\n* the planner to act on them (`managed`, or `tolerated` for whole-object\n* creation issues only). Issues for `external`/`observed` subjects, and\n* non-creation issues for `tolerated` subjects, are dropped from the planner's\n* input entirely — they never enter introspection-driven planning, never feed\n* the diff engine, and never produce DDL calls that would have to be\n* post-filtered. This sidesteps a class of failure where the diff engine\n* cannot reason about the live shape of a subject the user marked as\n* out-of-scope (`external`).\n*\n* `suppressions` is one {@link SuppressionRecord} per suppressed subject (not\n* per suppressed issue). Its `factoryName` is the creation factory name when any\n* of the subject's issues is whole-object creation (e.g. `createTable`), else\n* `undefined` — the family never invents a modification verb for an op that\n* produced no call; the target renders the message.\n*\n* Unresolved-subject issues (`resolveControlPolicySubject` returns\n* `undefined`) emit one record each; they cannot be deduplicated because they\n* carry no subject coordinate.\n*/\nfunction partitionIssuesByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst plannable = [];\n\tconst suppressedSubjects = /* @__PURE__ */ new Map();\n\tconst unresolvedSuppressions = [];\n\tfor (const issue of options.issues) {\n\t\tconst subject = options.resolveControlPolicySubject(issue);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tconst creationFactoryName = options.resolveCreationFactoryName(issue);\n\t\tif (policy === \"managed\") {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (policy === \"tolerated\" && subject !== void 0 && creationFactoryName !== void 0 && subject.createsNewObject) {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject === void 0) {\n\t\t\tunresolvedSuppressions.push({\n\t\t\t\tsubject: void 0,\n\t\t\t\tpolicy,\n\t\t\t\tfactoryName: creationFactoryName,\n\t\t\t\tcreatesNewObject: false\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst key = subjectKey(subject);\n\t\tconst existing = suppressedSubjects.get(key);\n\t\tif (existing) {\n\t\t\tif (existing.creationFactoryName === void 0 && creationFactoryName !== void 0) existing.creationFactoryName = creationFactoryName;\n\t\t} else suppressedSubjects.set(key, {\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\t...ifDefined(\"creationFactoryName\", creationFactoryName)\n\t\t});\n\t}\n\tconst suppressions = [...unresolvedSuppressions];\n\tfor (const entry of suppressedSubjects.values()) suppressions.push({\n\t\tsubject: entry.subject,\n\t\tpolicy: entry.policy,\n\t\tfactoryName: entry.creationFactoryName,\n\t\tcreatesNewObject: entry.subject.createsNewObject\n\t});\n\treturn Object.freeze({\n\t\tplannable: Object.freeze(plannable),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\nfunction subjectKey(subject) {\n\treturn `${subject.namespaceId}\\u0000${subject.entityKind ?? \"\"}\\u0000${subject.entityName ?? \"\"}\\u0000${subject.rlsPolicy ?? \"\"}`;\n}\n//#endregion\n//#region src/core/migrations/field-event-planner.ts\nfunction planFieldEventOperations(options) {\n\tconst priorContract = options.priorContract;\n\tconst newContract = options.newContract;\n\tconst added = [];\n\tconst dropped = [];\n\tconst altered = [];\n\tconst namespaceIds = unionSorted(priorContract ? Object.keys(priorContract.storage.namespaces) : [], Object.keys(newContract.storage.namespaces));\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst priorNs = priorContract?.storage.namespaces[namespaceId];\n\t\tconst newNs = newContract.storage.namespaces[namespaceId];\n\t\tconst priorTables = priorNs?.entries.table;\n\t\tconst newTables = newNs?.entries.table;\n\t\tconst tableNames = unionSorted(priorTables ? Object.keys(priorTables) : [], newTables ? Object.keys(newTables) : []);\n\t\tfor (const tableName of tableNames) {\n\t\t\tconst priorTableRaw = priorTables?.[tableName];\n\t\t\tconst newTableRaw = newTables?.[tableName];\n\t\t\tconst priorTable = StorageTable.is(priorTableRaw) ? priorTableRaw : void 0;\n\t\t\tconst newTable = StorageTable.is(newTableRaw) ? newTableRaw : void 0;\n\t\t\tconst fieldNames = unionSorted(priorTable ? Object.keys(priorTable.columns) : [], newTable ? Object.keys(newTable.columns) : []);\n\t\t\tfor (const fieldName of fieldNames) {\n\t\t\t\tconst priorField = priorTable?.columns[fieldName];\n\t\t\t\tconst newField = newTable?.columns[fieldName];\n\t\t\t\tconst entry = {\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\ttableName,\n\t\t\t\t\tfieldName,\n\t\t\t\t\tpriorTable,\n\t\t\t\t\tnewTable,\n\t\t\t\t\tpriorField,\n\t\t\t\t\tnewField\n\t\t\t\t};\n\t\t\t\tif (priorField === void 0 && newField !== void 0) added.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField === void 0) dropped.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField !== void 0) {\n\t\t\t\t\tif (isAlteration(priorField, newField)) altered.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tconst calls = [];\n\tappendCalls(\"added\", added, options.codecHooks, calls, (e) => e.newField?.codecId);\n\tappendCalls(\"dropped\", dropped, options.codecHooks, calls, (e) => e.priorField?.codecId);\n\tappendCalls(\"altered\", altered, options.codecHooks, calls, (e) => e.newField?.codecId);\n\treturn calls;\n}\nfunction appendCalls(event, entries, codecHooks, calls, pickCodecId) {\n\tfor (const entry of entries) {\n\t\tconst codecId = pickCodecId(entry);\n\t\tif (codecId === void 0) continue;\n\t\tconst hook = codecHooks.get(codecId);\n\t\tif (!hook?.onFieldEvent) continue;\n\t\tconst ctx = buildContext(event, entry);\n\t\tconst emitted = hook.onFieldEvent(event, ctx);\n\t\tfor (const call of emitted) calls.push(call);\n\t}\n}\n/**\n* The context's prior/new sides are scoped to the event:\n*\n* - `'added'` — only `newTable` / `newField` populated.\n* - `'dropped'` — only `priorTable` / `priorField` populated.\n* - `'altered'` — both sides populated.\n*/\nfunction buildContext(event, entry) {\n\tconst base = {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttableName: entry.tableName,\n\t\tfieldName: entry.fieldName\n\t};\n\tif (event === \"added\") return {\n\t\t...base,\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n\tif (event === \"dropped\") return {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {}\n\t};\n\treturn {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n}\n/**\n* `'altered'` predicate. Returns `false` whenever `codecId` differs —\n* any codec change suppresses the `altered` event entirely, including\n* cases where another property also differs in the same diff. Codec\n* rotation is a v1 non-goal; avoiding the mixed event keeps the\n* migration semantics for codec changes explicit rather than smuggling\n* them through as `altered`.\n*\n* For non-`codecId` diffs, returns `true` iff any other column property\n* differs.\n*/\nfunction isAlteration(prior, current) {\n\tif (prior.codecId !== current.codecId) return false;\n\treturn !sameStorageColumn(prior, current);\n}\nfunction sameStorageColumn(a, b) {\n\tif (a === b) return true;\n\tif (a.nativeType !== b.nativeType) return false;\n\tif (a.nullable !== b.nullable) return false;\n\tif (a.typeRef !== b.typeRef) return false;\n\tif (!sameJson(a.typeParams, b.typeParams)) return false;\n\tif (!sameJson(a.default, b.default)) return false;\n\treturn true;\n}\nfunction sameJson(a, b) {\n\tif (a === b) return true;\n\tif (a === void 0 || b === void 0) return false;\n\treturn JSON.stringify(a) === JSON.stringify(b);\n}\nfunction unionSorted(a, b) {\n\tconst set = /* @__PURE__ */ new Set();\n\tfor (const name of a) set.add(name);\n\tfor (const name of b) set.add(name);\n\treturn [...set].sort((x, y) => x < y ? -1 : x > y ? 1 : 0);\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* Builds the codec-hook-composed `expandNativeType` callback the contract→IR\n* derivation uses to expand parameterized native types (e.g. `character` +\n* `{ length: 36 }` → `character(36)`). Returns `undefined` when no framework\n* components are supplied, so callers can omit the option entirely.\n*/\nfunction buildNativeTypeExpander(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst codecHooks = extractCodecControlHooks(frameworkComponents);\n\treturn (input) => {\n\t\tif (!input.typeParams) return input.nativeType;\n\t\tif (!input.codecId) return input.nativeType;\n\t\tconst hooks = codecHooks.get(input.codecId);\n\t\tif (!hooks?.expandNativeType) return input.nativeType;\n\t\treturn hooks.expandNativeType(input);\n\t};\n}\n//#endregion\n//#region src/core/migrations/plan-helpers.ts\nconst readOnlyEmptyObject = Object.freeze({});\nfunction cloneRecord(value) {\n\tif (value === readOnlyEmptyObject) return value;\n\treturn Object.freeze({ ...value });\n}\nfunction freezeSteps(steps) {\n\tif (steps.length === 0) return Object.freeze([]);\n\treturn Object.freeze(steps.map((step) => Object.freeze({\n\t\tdescription: step.description,\n\t\tsql: step.sql,\n\t\t...step.params ? { params: Object.freeze([...step.params]) } : {},\n\t\t...step.meta ? { meta: cloneRecord(step.meta) } : {}\n\t})));\n}\nfunction freezeDetailsValue(value) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\") return value;\n\tif (Array.isArray(value)) return Object.freeze([...value]);\n\treturn Object.freeze({ ...value });\n}\nfunction freezeTargetDetails(target) {\n\treturn Object.freeze({\n\t\tid: target.id,\n\t\t...target.details !== void 0 ? { details: freezeDetailsValue(target.details) } : {}\n\t});\n}\nfunction freezeOperation(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...operation.summary ? { summary: operation.summary } : {},\n\t\toperationClass: operation.operationClass,\n\t\t...operation.invariantId ? { invariantId: operation.invariantId } : {},\n\t\ttarget: freezeTargetDetails(operation.target),\n\t\tprecheck: freezeSteps(operation.precheck),\n\t\texecute: freezeSteps(operation.execute),\n\t\tpostcheck: freezeSteps(operation.postcheck),\n\t\t...operation.meta ? { meta: cloneRecord(operation.meta) } : {}\n\t});\n}\nfunction freezeOperations(operations) {\n\tif (operations.length === 0) return Object.freeze([]);\n\treturn Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\nfunction createMigrationPlan(options) {\n\treturn Object.freeze({\n\t\ttargetId: options.targetId,\n\t\tspaceId: options.spaceId,\n\t\t...options.origin !== void 0 ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null } : {},\n\t\tdestination: Object.freeze({ ...options.destination }),\n\t\toperations: freezeOperations(options.operations),\n\t\tprovidedInvariants: Object.freeze([...options.providedInvariants]),\n\t\t...options.meta ? { meta: cloneRecord(options.meta) } : {}\n\t});\n}\nfunction plannerSuccess(plan, warnings) {\n\treturn Object.freeze({\n\t\tkind: \"success\",\n\t\tplan,\n\t\t...warnings && warnings.length > 0 ? { warnings: Object.freeze(warnings.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t}))) } : {}\n\t});\n}\nfunction plannerFailure(conflicts) {\n\treturn Object.freeze({\n\t\tkind: \"failure\",\n\t\tconflicts: Object.freeze(conflicts.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t})))\n\t});\n}\n/**\n* Creates a successful migration runner result.\n*/\nfunction runnerSuccess(value) {\n\treturn ok(Object.freeze({\n\t\toperationsPlanned: value.operationsPlanned,\n\t\toperationsExecuted: value.operationsExecuted\n\t}));\n}\n/**\n* Creates a failed migration runner result.\n*/\nfunction runnerFailure(code, summary, options) {\n\treturn notOk(Object.freeze({\n\t\tcode,\n\t\tsummary,\n\t\t...options?.why ? { why: options.why } : {},\n\t\t...options?.meta ? { meta: cloneRecord(options.meta) } : {}\n\t}));\n}\n//#endregion\n//#region src/core/migrations/policies.ts\n/**\n* Policy used by `db init`: additive-only operations, no widening/destructive steps.\n*/\nconst INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.freeze([\"additive\"]) });\n//#endregion\n//#region src/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, timestampNowControlDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe,cAAc;CACrC,MAAM,UAAU,aAAa,KAAK,CAAC,CAAC,YAAY;CAChD,OAAO,QAAQ,WAAW,SAAS,KAAK,QAAQ,WAAW,QAAQ,KAAK,QAAQ,WAAW,OAAO;AACnG;AACA,SAAS,gBAAgB,WAAW;CACnC,MAAM,YAAY;CAClB,IAAI,EAAE,aAAa,cAAc,CAAC,MAAM,QAAQ,UAAU,UAAU,GAAG,OAAO;CAC9E,OAAO,UAAU,UAAU,CAAC,OAAO,SAAS,OAAO,SAAS,YAAY,SAAS,QAAQ,SAAS,IAAI;AACvG;;;;;AAKA,SAAS,cAAc,YAAY;CAClC,MAAM,aAAa,CAAC;CACpB,KAAK,MAAM,aAAa,YAAY;EACnC,IAAI,CAAC,gBAAgB,SAAS,GAAG;EACjC,KAAK,MAAM,QAAQ,UAAU,SAAS,IAAI,OAAO,KAAK,QAAQ,YAAY,eAAe,KAAK,GAAG,GAAG,WAAW,KAAK,KAAK,IAAI,KAAK,CAAC;CACpI;CACA,OAAO;AACR;;;;;AAKA,SAAS,uBAAuB,YAAY;CAC3C,OAAO,EAAE,YAAY,cAAc,UAAU,CAAC,CAAC,KAAK,UAAU;EAC7D;EACA,UAAU;CACX,EAAE,EAAE;AACL;AAGA,SAAS,gCAAgC,UAAU,WAAW;CAC7D,OAAO,eAAe,sCAAsC,eAAe,SAAS,4BAA4B,UAAU,wBAAwB;EACjJ,KAAK,iDAAiD,UAAU;EAChE,KAAK,4DAA4D,UAAU;EAC3E,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,gCAAgC,UAAU;CAClD,MAAM,0BAA0B,IAAI,IAAI;CACxC,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,aAAa,YAAY,OAAO,SAAS,YAAY,YAAY,SAAS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AI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;CACX,CAAC;AACF;AACA,SAAS,eAAe,WAAW;CAClC,OAAO,OAAO,OAAO;EACpB,MAAM;EACN,WAAW,OAAO,OAAO,UAAU,KAAK,aAAa,OAAO,OAAO;GAClE,MAAM,SAAS;GACf,SAAS,SAAS;GAClB,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;GAC3C,GAAG,SAAS,WAAW,EAAE,UAAU,OAAO,OAAO,EAAE,GAAG,SAAS,SAAS,CAAC,EAAE,IAAI,CAAC;GAChF,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,SAAS,IAAI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC;CACJ,CAAC;AACF;;;;AAIA,SAAS,cAAc,OAAO;CAC7B,OAAO,GAAG,OAAO,OAAO;EACvB,mBAAmB,MAAM;EACzB,oBAAoB,MAAM;CAC3B,CAAC,CAAC;AACH;;;;AAIA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,MAAM,OAAO,OAAO;EAC1B;EACA;EACA,GAAG,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;CAC3D,CAAC,CAAC;AACH;;;;AAMA,MAAM,uBAAuB,OAAO,OAAO,EAAE,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAGnG,IAAI,kBAAkB,IAAI,oBAAoB"}
1
+ {"version":3,"file":"control-f9B6b5c2.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/control.mjs"],"sourcesContent":["import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from \"./authoring-type-constructors-Blqoa2Ua.mjs\";\nimport { n as classifyDiffSubjectGranularity, o as verifySqlSchemaByDiff, s as extractCodecControlHooks, t as classifyDiffEntityKind } from \"./schema-verify-C_PEdlAr.mjs\";\nimport { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { t as SqlContractSerializer } from \"./sql-contract-serializer-2oBWuxTe.mjs\";\nimport { t as collectSupportedCodecTypeIds } from \"./verify-u0UTdZgD.mjs\";\nimport { a as timestampNowControlDescriptor, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, r as temporalCodecPreset } from \"./timestamp-now-generator-DRXygu32.mjs\";\nimport { sqlEmission } from \"@internal/sql-contract-emitter\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions } from \"@internal/framework-components/control\";\nimport { isPlainRecord } from \"@internal/framework-components/ir\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { StorageTable, isStorageTypeInstance } from \"@internal/sql-contract/types\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/core/operation-preview.ts\nfunction isDdlStatement(sqlStatement) {\n\tconst trimmed = sqlStatement.trim().toLowerCase();\n\treturn trimmed.startsWith(\"create \") || trimmed.startsWith(\"alter \") || trimmed.startsWith(\"drop \");\n}\nfunction hasExecuteSteps(operation) {\n\tconst candidate = operation;\n\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) return false;\n\treturn candidate[\"execute\"].every((step) => typeof step === \"object\" && step !== null && \"sql\" in step);\n}\n/**\n* Extracts a best-effort SQL DDL preview for CLI plan output.\n* Presentation-only: never used to decide migration correctness.\n*/\nfunction extractSqlDdl(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tif (!hasExecuteSteps(operation)) continue;\n\t\tfor (const step of operation.execute) if (typeof step.sql === \"string\" && isDdlStatement(step.sql)) statements.push(step.sql.trim());\n\t}\n\treturn statements;\n}\n/**\n* Wraps `extractSqlDdl` into the family-agnostic `OperationPreview` shape.\n* Each statement carries `language: 'sql'`.\n*/\nfunction sqlOperationsToPreview(operations) {\n\treturn { statements: extractSqlDdl(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"sql\"\n\t})) };\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction missingDescriptorOperationError(targetId, operation) {\n\treturn sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `SQL target \"${targetId}\" is missing the required ${operation} descriptor operation`, {\n\t\twhy: `The target descriptor does not contribute the ${operation} operation the SQL family requires for this call.`,\n\t\tfix: `Use a target package whose control descriptor implements ${operation}.`,\n\t\tmeta: {\n\t\t\ttargetId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction extractCodecTypeIdsFromContract(contract) {\n\tconst typeIds = /* @__PURE__ */ new Set();\n\tif (typeof contract === \"object\" && contract !== null && \"storage\" in contract && typeof contract.storage === \"object\" && contract.storage !== null && \"namespaces\" in contract.storage && typeof contract.storage.namespaces === \"object\" && contract.storage.namespaces !== null) {\n\t\tconst namespaces = contract.storage.namespaces;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tconst tbls = ns.entries[\"table\"];\n\t\t\tif (typeof tbls !== \"object\" || tbls === null) continue;\n\t\t\tfor (const table of Object.values(tbls)) if (typeof table === \"object\" && table !== null && \"columns\" in table && typeof table.columns === \"object\" && table.columns !== null) {\n\t\t\t\tconst columns = table.columns;\n\t\t\t\tfor (const column of Object.values(columns)) if (column && typeof column === \"object\" && \"codecId\" in column && typeof column.codecId === \"string\") typeIds.add(column.codecId);\n\t\t\t}\n\t\t}\n\t}\n\treturn Array.from(typeIds).sort();\n}\nfunction createVerifyResult(options) {\n\tconst contract = { storageHash: options.contractStorageHash };\n\tif (options.contractProfileHash) contract.profileHash = options.contractProfileHash;\n\tconst target = { expected: options.expectedTargetId };\n\tif (options.actualTargetId) target.actual = options.actualTargetId;\n\tconst meta = { contractPath: options.contractPath };\n\tif (options.configPath) meta.configPath = options.configPath;\n\tconst result = {\n\t\tok: options.ok,\n\t\tsummary: options.summary,\n\t\tcontract,\n\t\ttarget,\n\t\tmeta,\n\t\ttimings: { total: options.totalTime }\n\t};\n\tif (options.code) result.code = options.code;\n\tif (options.marker) result.marker = {\n\t\tstorageHash: options.marker.storageHash,\n\t\tprofileHash: options.marker.profileHash\n\t};\n\tif (options.missingCodecs) result.missingCodecs = options.missingCodecs;\n\tif (options.codecCoverageSkipped) result.codecCoverageSkipped = options.codecCoverageSkipped;\n\treturn result;\n}\nfunction buildSqlTypeMetadataRegistry(options) {\n\tconst { target, adapter, extensions } = options;\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst targetId = adapter.targetId;\n\tconst descriptors = [\n\t\ttarget,\n\t\tadapter,\n\t\t...extensions\n\t];\n\tfor (const descriptor of descriptors) {\n\t\tconst storageTypes = descriptor.types?.storage;\n\t\tif (!storageTypes) continue;\n\t\tfor (const storageType of storageTypes) if (storageType.familyId === \"sql\" && storageType.targetId === targetId) registry.set(storageType.typeId, {\n\t\t\ttypeId: storageType.typeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: storageType.targetId,\n\t\t\t...storageType.nativeType !== void 0 ? { nativeType: storageType.nativeType } : {}\n\t\t});\n\t}\n\treturn registry;\n}\n/**\n* Builds a map from each extension id to the set of extension ids it\n* transitively depends on. Uses the same declared-dependency data that\n* `buildExtensionLoadOrder` in control-stack uses.\n*/\nfunction buildTransitiveDependsOnMap(extensions) {\n\tconst directDeps = /* @__PURE__ */ new Map();\n\tfor (const ext of extensions) {\n\t\tconst packs = ext.contractSpace?.contractJson?.extensions;\n\t\tconst deps = packs !== null && typeof packs === \"object\" ? Object.keys(packs) : [];\n\t\tdirectDeps.set(ext.id, deps);\n\t}\n\tconst result = /* @__PURE__ */ new Map();\n\tconst resolve = (id, visiting) => {\n\t\tconst cached = result.get(id);\n\t\tif (cached !== void 0) return cached;\n\t\tconst set = /* @__PURE__ */ new Set();\n\t\tresult.set(id, set);\n\t\tfor (const depId of directDeps.get(id) ?? []) {\n\t\t\tset.add(depId);\n\t\t\tif (!visiting.has(depId)) {\n\t\t\t\tvisiting.add(depId);\n\t\t\t\tfor (const transitive of resolve(depId, visiting)) set.add(transitive);\n\t\t\t\tvisiting.delete(depId);\n\t\t\t}\n\t\t}\n\t\treturn set;\n\t};\n\tfor (const ext of extensions) resolve(ext.id, /* @__PURE__ */ new Set([ext.id]));\n\treturn result;\n}\n/**\n* Asserts that no cross-space FK in any extension points against the\n* dependency direction.\n*\n* A cross-space FK (target.spaceId present) from extension A pointing at\n* space B is a violation when B depends on A (directly or transitively),\n* because that means A is pointing \"upward\" against the dependency arrows\n* established by the extension load order.\n*\n* Throws with a diagnostic naming the violating extension (source), the\n* target space, and the direction violation.\n*/\nfunction isObjectRecord(v) {\n\treturn typeof v === \"object\" && v !== null;\n}\nfunction assertNoCrossSpaceFkReverseReferences(extensions) {\n\tconst dependsOnMap = buildTransitiveDependsOnMap(extensions);\n\tfor (const ext of extensions) {\n\t\tconst namespaces = ext.contractSpace?.contractJson?.storage?.namespaces;\n\t\tif (!isObjectRecord(namespaces)) continue;\n\t\tfor (const ns of Object.values(namespaces)) {\n\t\t\tif (!isObjectRecord(ns)) continue;\n\t\t\tconst entries = ns[\"entries\"];\n\t\t\tif (!isObjectRecord(entries)) continue;\n\t\t\tfor (const slot of Object.values(entries)) {\n\t\t\t\tif (!isObjectRecord(slot)) continue;\n\t\t\t\tfor (const table of Object.values(slot)) {\n\t\t\t\t\tif (!isObjectRecord(table)) continue;\n\t\t\t\t\tconst foreignKeys = table[\"foreignKeys\"];\n\t\t\t\t\tif (!Array.isArray(foreignKeys)) continue;\n\t\t\t\t\tfor (const fk of foreignKeys) {\n\t\t\t\t\t\tif (!isObjectRecord(fk)) continue;\n\t\t\t\t\t\tconst target = fk[\"target\"];\n\t\t\t\t\t\tif (!isObjectRecord(target)) continue;\n\t\t\t\t\t\tif (target[\"spaceId\"] === void 0) continue;\n\t\t\t\t\t\tconst targetSpaceId = target[\"spaceId\"];\n\t\t\t\t\t\tif (typeof targetSpaceId !== \"string\") continue;\n\t\t\t\t\t\tif (dependsOnMap.get(targetSpaceId)?.has(ext.id)) throw sqlFamilyError(\"CONTRACT.FOREIGN_KEY_INVALID\", `Cross-space FK reverse-reference detected: extension \"${ext.id}\" has a cross-space FK targeting space \"${targetSpaceId}\", but \"${targetSpaceId}\" depends on \"${ext.id}\". Cross-space FKs must follow the dependency direction (a space can only reference spaces it depends on, not spaces that depend on it).`, {\n\t\t\t\t\t\t\twhy: \"The foreign key points against the contract-space dependency direction.\",\n\t\t\t\t\t\t\tfix: \"Move the foreign key to the depending space, or restructure the extension dependencies so the referencing space depends on the referenced one.\",\n\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\textensionId: ext.id,\n\t\t\t\t\t\t\t\ttargetSpaceId\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nfunction createSqlFamilyInstance(stack) {\n\tif (!stack.adapter) throw new InternalError(\"SQL family requires an adapter descriptor in ControlStack\");\n\tconst target = stack.target;\n\tconst adapter = stack.adapter;\n\tconst extensions = stack.extensions;\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...sqlContractCanonicalizationHooks\n\t\t});\n\t}\n\tassertNoCrossSpaceFkReverseReferences(extensions);\n\tconst { codecTypeImports, extensionIds } = stack;\n\tconst typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t});\n\tlet controlAdapter;\n\tconst getControlAdapter = () => controlAdapter ??= adapter.create(stack);\n\tconst targetSerializer = target.contractSerializer;\n\tconst targetInferPslContract = blindCast(target).inferPslContract;\n\tconst diffSchema = blindCast(target).diffSchema;\n\tconst targetGranularityOf = blindCast(target).classifySubjectGranularity;\n\tconst targetEntityKindOf = blindCast(target).classifyEntityKind;\n\tconst describedContracts = extensions.flatMap((extension) => extension.contractSpace ? [{\n\t\tspaceId: extension.id,\n\t\tcontract: extension.contractSpace.contractJson\n\t}] : []);\n\tconst deserializeWithTargetSerializer = (contractOrJson) => {\n\t\tconst serializer = targetSerializer ?? new SqlContractSerializer();\n\t\tconst json = targetSerializer !== void 0 && !isPlainRecord(contractOrJson) ? targetSerializer.serializeContract(blindCast(contractOrJson)) : contractOrJson;\n\t\treturn serializer.deserializeContract(json);\n\t};\n\treturn {\n\t\tfamilyId: \"sql\",\n\t\tcodecTypeImports,\n\t\textensionIds,\n\t\ttypeMetadataRegistry,\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn deserializeWithTargetSerializer(contractJson);\n\t\t},\n\t\tasync verify(verifyOptions) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = verifyOptions;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst marker = await getControlAdapter().readMarker(driver, APP_SPACE_ID);\n\t\t\tlet missingCodecs;\n\t\t\tlet codecCoverageSkipped = false;\n\t\t\tconst supportedTypeIds = collectSupportedCodecTypeIds([\n\t\t\t\tadapter,\n\t\t\t\ttarget,\n\t\t\t\t...extensions\n\t\t\t]);\n\t\t\tif (supportedTypeIds.length === 0) codecCoverageSkipped = true;\n\t\t\telse {\n\t\t\t\tconst supportedSet = new Set(supportedTypeIds);\n\t\t\t\tconst missing = extractCodecTypeIdsFromContract(contract).filter((id) => !supportedSet.has(id));\n\t\t\t\tif (missing.length > 0) missingCodecs = missing;\n\t\t\t}\n\t\t\tif (!marker) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractTarget !== expectedTargetId) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return createVerifyResult({\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t\treturn createVerifyResult({\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tcontractStorageHash,\n\t\t\t\tmarker,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\ttotalTime: Date.now() - startTime,\n\t\t\t\t...contractProfileHash ? { contractProfileHash } : {},\n\t\t\t\t...missingCodecs ? { missingCodecs } : {},\n\t\t\t\t...codecCoverageSkipped ? { codecCoverageSkipped } : {},\n\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\tconst contract = deserializeWithTargetSerializer(options.contract);\n\t\t\tif (!diffSchema) throw missingDescriptorOperationError(target.targetId, \"diffSchema\");\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn verifySqlSchemaByDiff({\n\t\t\t\tcontract,\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\tdiffSchema,\n\t\t\t\tgranularityOf: targetGranularityOf\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject granularity on demand, by resolving\n\t\t* its node's `nodeKind` through the target's classifier — the\n\t\t* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability. Framework consumers spanning contract spaces (the\n\t\t* migration aggregate's unclaimed-elements sweep) detect and call this\n\t\t* instead of reaching into the concrete schema-IR node, which they\n\t\t* cannot read; nothing is stamped on the issue or the node.\n\t\t*/\n\t\tclassifySubjectGranularity(issue) {\n\t\t\tif (!targetGranularityOf) throw missingDescriptorOperationError(target.targetId, \"classifySubjectGranularity\");\n\t\t\treturn classifyDiffSubjectGranularity(issue, targetGranularityOf);\n\t\t},\n\t\t/**\n\t\t* Classifies a diff issue's subject storage `entityKind` on demand, by\n\t\t* resolving its node's `nodeKind` through the target's classifier —\n\t\t* the sibling of `classifySubjectGranularity` above, and part of the\n\t\t* same {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n\t\t* capability.\n\t\t*/\n\t\tclassifyEntityKind(issue) {\n\t\t\tif (!targetEntityKindOf) throw missingDescriptorOperationError(target.targetId, \"classifyEntityKind\");\n\t\t\treturn classifyDiffEntityKind(issue, targetEntityKindOf);\n\t\t},\n\t\tasync sign(options) {\n\t\t\tconst { driver, contract: contractInput, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = deserializeWithTargetSerializer(contractInput);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = \"profileHash\" in contract && typeof contract.profileHash === \"string\" ? contract.profileHash : contractStorageHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst controlAdapter = getControlAdapter();\n\t\t\tconst lowererContext = { contract };\n\t\t\tfor (const query of controlAdapter.bootstrapSignMarkerQueries()) {\n\t\t\t\tconst lowered = await controlAdapter.lowerToExecuteRequest(query, lowererContext);\n\t\t\t\tawait driver.query(lowered.sql, lowered.params);\n\t\t\t}\n\t\t\tconst existingMarker = await controlAdapter.readMarker(driver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.insertMarker(driver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst existingStorageHash = existingMarker.storageHash;\n\t\t\t\tconst existingProfileHash = existingMarker.profileHash;\n\t\t\t\tif (!(existingStorageHash === contractStorageHash) || !(existingProfileHash === contractProfileHash)) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingStorageHash,\n\t\t\t\t\t\tprofileHash: existingProfileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(driver, APP_SPACE_ID, existingStorageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw sqlFamilyError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\", {\n\t\t\t\t\t\twhy: \"Another process updated the contract marker between the read and the compare-and-swap write.\",\n\t\t\t\t\t\tfix: \"Re-run the sign command; if it keeps failing, make sure only one migration process runs at a time.\",\n\t\t\t\t\t\tmeta: { space: APP_SPACE_ID }\n\t\t\t\t\t});\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\tconst totalTime = Date.now() - startTime;\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contractTarget,\n\t\t\t\t\tactual: contractTarget\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...previousHashes ? { previous: previousHashes } : {}\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...configPath ? { configPath } : {}\n\t\t\t\t},\n\t\t\t\ttimings: { total: totalTime }\n\t\t\t};\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(options.driver, options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(options.driver);\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(options.driver, options.space);\n\t\t},\n\t\tasync initMarker(options) {\n\t\t\treturn getControlAdapter().initMarker(options.driver, options.space, options.destination);\n\t\t},\n\t\tasync updateMarker(options) {\n\t\t\treturn getControlAdapter().updateMarker(options.driver, options.space, options.expectedFrom, options.destination);\n\t\t},\n\t\tasync writeLedgerEntry(options) {\n\t\t\treturn getControlAdapter().writeLedgerEntry(options.driver, options.space, options.entry);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspect(options.driver, options.contract);\n\t\t},\n\t\tinferPslContract(schemaIR) {\n\t\t\tif (!targetInferPslContract) throw sqlFamilyError(\"CONTRACT.INFER_UNSUPPORTED\", `Target \"${target.targetId}\" does not support contract infer (no inferPslContract on its descriptor).`, {\n\t\t\t\twhy: \"The target descriptor does not provide the inferPslContract hook, so a PSL contract cannot be inferred from the database schema.\",\n\t\t\t\tfix: \"Use a target package that supports contract infer, or author the contract instead of inferring it.\",\n\t\t\t\tmeta: { targetId: target.targetId }\n\t\t\t});\n\t\t\treturn targetInferPslContract(schemaIR, describedContracts);\n\t\t},\n\t\tlowerAst(ast, context) {\n\t\t\treturn getControlAdapter().lowerToExecuteRequest(ast, context);\n\t\t},\n\t\tbootstrapControlTableQueries() {\n\t\t\treturn getControlAdapter().bootstrapControlTableQueries();\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn sqlOperationsToPreview(operations);\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\tconst root = blindCast(schema);\n\t\t\tconst namespaceEntries = root.namespaces !== void 0 ? Object.entries(root.namespaces).map(([namespaceKey, namespace]) => [namespaceKey, namespace.tables]) : [[void 0, root.tables ?? {}]];\n\t\t\tconst qualify = namespaceEntries.length > 1;\n\t\t\tconst tableNodes = namespaceEntries.flatMap(([namespaceKey, tables]) => Object.entries(tables).map(([tableName, table]) => [\n\t\t\t\tqualify && namespaceKey !== void 0 ? `${namespaceKey}.${tableName}` : tableName,\n\t\t\t\ttableName,\n\t\t\t\ttable\n\t\t\t])).map(([displayName, tableName, table]) => {\n\t\t\t\tconst children = [];\n\t\t\t\tconst columnNodes = [];\n\t\t\t\tfor (const [columnName, column] of Object.entries(table.columns)) {\n\t\t\t\t\tconst label = `${columnName}: ${column.nativeType} (${column.nullable ? \"nullable\" : \"not nullable\"})`;\n\t\t\t\t\tcolumnNodes.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"field\",\n\t\t\t\t\t\tid: `column-${displayName}-${columnName}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tnativeType: column.nativeType,\n\t\t\t\t\t\t\tnullable: column.nullable,\n\t\t\t\t\t\t\t...ifDefined(\"default\", column.default)\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tif (columnNodes.length > 0) children.push(new SchemaTreeNode({\n\t\t\t\t\tkind: \"collection\",\n\t\t\t\t\tid: `columns-${displayName}`,\n\t\t\t\t\tlabel: \"columns\",\n\t\t\t\t\tchildren: columnNodes\n\t\t\t\t}));\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\tconst pkColumns = table.primaryKey.columns.join(\", \");\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `primary-key-${displayName}`,\n\t\t\t\t\t\tlabel: `primary key: ${pkColumns}`,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t\t\t\t\t...table.primaryKey.name ? { name: table.primaryKey.name } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const unique of table.uniques) {\n\t\t\t\t\tconst name = unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_unique`;\n\t\t\t\t\tconst label = `unique ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `unique-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: unique.columns,\n\t\t\t\t\t\t\tunique: true\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tfor (const index of table.indexes) {\n\t\t\t\t\tconst name = index.name;\n\t\t\t\t\tconst label = index.unique ? `unique index ${name}` : `index ${name}`;\n\t\t\t\t\tchildren.push(new SchemaTreeNode({\n\t\t\t\t\t\tkind: \"index\",\n\t\t\t\t\t\tid: `index-${displayName}-${name}`,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tcolumns: index.columns,\n\t\t\t\t\t\t\tunique: index.unique\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tconst tableMeta = {};\n\t\t\t\tif (table.primaryKey) {\n\t\t\t\t\ttableMeta[\"primaryKey\"] = table.primaryKey.columns;\n\t\t\t\t\tif (table.primaryKey.name) tableMeta[\"primaryKeyName\"] = table.primaryKey.name;\n\t\t\t\t}\n\t\t\t\tif (table.foreignKeys.length > 0) tableMeta[\"foreignKeys\"] = table.foreignKeys.map((fk) => ({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\t...fk.name ? { name: fk.name } : {}\n\t\t\t\t}));\n\t\t\t\treturn new SchemaTreeNode({\n\t\t\t\t\tkind: \"entity\",\n\t\t\t\t\tid: `table-${displayName}`,\n\t\t\t\t\tlabel: `table ${displayName}`,\n\t\t\t\t\t...Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {},\n\t\t\t\t\t...children.length > 0 ? { children } : {}\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn { root: new SchemaTreeNode({\n\t\t\t\tkind: \"root\",\n\t\t\t\tid: \"sql-schema\",\n\t\t\t\tlabel: \"database\",\n\t\t\t\t...tableNodes.length > 0 ? { children: tableNodes } : {}\n\t\t\t}) };\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nvar SqlFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"sql\";\n\tfamilyId = \"sql\";\n\tversion = \"0.0.1\";\n\temission = sqlEmission;\n\tauthoring = {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors\n\t};\n\tcreate(stack) {\n\t\treturn createSqlFamilyInstance(stack);\n\t}\n};\n//#endregion\n//#region src/core/migrations/contract-to-schema-ir.ts\nfunction convertColumn(name, column, storageTypes, expandNativeType, renderDefault, resolveDefault) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst baseNativeType = expandNativeType ? expandNativeType({\n\t\tnativeType: resolved.nativeType,\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams)\n\t}) : resolved.nativeType;\n\tconst nativeType = baseNativeType;\n\tconst resolvedNativeType = column.many ? `${baseNativeType}[]` : baseNativeType;\n\tconst rawColumnDefault = column.default ?? void 0;\n\tconst resolvedColumnDefault = rawColumnDefault !== void 0 && resolveDefault ? resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;\n\treturn {\n\t\tname,\n\t\tnativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", column.many),\n\t\t...ifDefined(\"default\", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0),\n\t\tresolvedNativeType,\n\t\t...ifDefined(\"resolvedDefault\", resolvedColumnDefault),\n\t\tcodecRef: buildColumnCodecRef(resolved, column.many),\n\t\tcodecBaseNativeType: resolved.nativeType,\n\t\t...column.typeRef !== void 0 ? { codecNamedType: true } : {}\n\t};\n}\n/**\n* Builds the column's `CodecRef` from its resolved (post-`typeRef`) codec\n* identity — the same construction the query AST and the migration DDL\n* renderer already use (TML-2456, TML-2918).\n*/\nfunction buildColumnCodecRef(resolved, many) {\n\treturn {\n\t\tcodecId: resolved.codecId,\n\t\t...ifDefined(\"typeParams\", resolved.typeParams !== void 0 ? blindCast(resolved.typeParams) : void 0),\n\t\t...ifDefined(\"many\", many)\n\t};\n}\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referenced = storageTypes[column.typeRef];\n\tif (!referenced) throw sqlFamilyError(\"CONTRACT.TYPE_UNKNOWN\", `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`, {\n\t\twhy: \"The column typeRef does not resolve to any entry in the contract storage.types map.\",\n\t\tfix: \"Regenerate the contract from its authoring source; do not hand-edit contract JSON.\",\n\t\tmeta: { typeRef: column.typeRef }\n\t});\n\tif (isStorageTypeInstance(referenced)) return {\n\t\tcodecId: referenced.codecId,\n\t\tnativeType: referenced.nativeType,\n\t\ttypeParams: referenced.typeParams\n\t};\n\tthrow new InternalError(`Storage type \"${column.typeRef}\" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`);\n}\nfunction convertCheck(check, tableName, tableColumns) {\n\treturn {\n\t\tnaming: namingOf(check.name, check.prefix),\n\t\texpression: check.expression,\n\t\tdependsOn: flatColumnDependsOn(tableName, tableColumns)\n\t};\n}\nfunction convertUnique(unique, tableName) {\n\treturn {\n\t\tcolumns: unique.columns,\n\t\t...ifDefined(\"name\", unique.name),\n\t\tdependsOn: flatColumnDependsOn(tableName, unique.columns)\n\t};\n}\nfunction convertIndex(index, tableName, tableColumns) {\n\tconst base = {\n\t\tnaming: namingOf(index.name, index.prefix),\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.where !== void 0,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: void 0,\n\t\tdependsOn: flatColumnDependsOn(tableName, index.columns ?? tableColumns)\n\t};\n\treturn index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: index.columns ?? []\n\t};\n}\n/**\n* The referenced table's chain in the flat (single-schema) tree\n* `contractToSchemaIR`/`contractNamespaceToSchemaIR` build: the root\n* (`SqlSchemaIR`, fixed `'database'` id) followed by the table's own id.\n* Postgres discards this when it re-derives the FK against its own\n* multi-schema tree shape (`contractToPostgresDatabaseSchemaNode`); SQLite's\n* flat tree uses it as-is.\n*/\nfunction flatSchemaDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the flat tree. Dropping\n* a covered column auto-drops the object, so the object's drop must precede\n* the column's; the graph derives that direction from these edges.\n*/\nfunction flatColumnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\t\tid: \"database\"\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t},\n\t\t{\n\t\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\t\tid: `column:${column}`\n\t\t}\n\t]);\n}\n/**\n* The FK's referenced-namespace identity comes from the target's namespace\n* node, not the raw namespace-id string. An unbound target namespace stamps\n* no `referencedSchema` at all — the FK node's id renders the absence as the\n* empty segment, which is what flat (single-schema) introspection produces,\n* so both diff sides' FK ids meet by construction. A bound namespace (or a\n* cross-space target whose namespace lives in another contract's storage)\n* stamps its coordinate verbatim; namespaced targets (Postgres) resolve the\n* real DDL schema downstream.\n*\n* `dependsOn` carries the referenced table (created before the FK, dropped\n* after it) plus the FK's own columns (dropped after the FK, since dropping a\n* column auto-drops the FK built on it).\n*/\nfunction convertForeignKey(fk, storage) {\n\tconst targetIsUnbound = storage.namespaces[fk.target.namespaceId]?.isUnbound === true;\n\treturn {\n\t\tcolumns: fk.source.columns,\n\t\treferencedTable: fk.target.tableName,\n\t\t...targetIsUnbound ? {} : { referencedSchema: fk.target.namespaceId },\n\t\treferencedColumns: fk.target.columns,\n\t\t...ifDefined(\"name\", fk.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\tdependsOn: [flatSchemaDependsOn(fk.target.tableName), ...flatColumnDependsOn(fk.source.tableName, fk.source.columns)]\n\t};\n}\nfunction convertTable(name, table, storageTypes, expandNativeType, renderDefault, resolveDefault, storage) {\n\tconst columns = {};\n\tfor (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault, resolveDefault);\n\tconst checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, name, Object.keys(table.columns))) : void 0;\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", table.primaryKey !== void 0 ? {\n\t\t\tcolumns: table.primaryKey.columns,\n\t\t\t...ifDefined(\"name\", table.primaryKey.name),\n\t\t\tdependsOn: flatColumnDependsOn(name, table.primaryKey.columns)\n\t\t} : void 0),\n\t\tforeignKeys: table.foreignKeys.map((fk) => convertForeignKey(fk, storage)),\n\t\tuniques: table.uniques.map((u) => convertUnique(u, name)),\n\t\tindexes: table.indexes.map((i) => convertIndex(i, name, Object.keys(table.columns))),\n\t\t...ifDefined(\"checks\", checks)\n\t});\n}\n/**\n* Detects destructive changes between two contract storages.\n*\n* The additive-only planner silently ignores removals (tables, columns).\n* This function detects those removals so callers can report them as conflicts\n* rather than silently producing an empty plan.\n*\n* Returns an empty array if no destructive changes are found.\n*/\nfunction detectDestructiveChanges(from, to) {\n\tif (!from) return [];\n\tconst hasOwn = (value, key) => Object.hasOwn(value, key);\n\tconst conflicts = [];\n\tconst namespaceIds = [.../* @__PURE__ */ new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)])].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst fromNs = from.namespaces[namespaceId];\n\t\tconst toNs = to.namespaces[namespaceId];\n\t\tconst fromTables = fromNs?.entries.table;\n\t\tif (!fromTables) continue;\n\t\tfor (const tableName of Object.keys(fromTables)) {\n\t\t\tconst toTableRaw = toNs?.entries.table?.[tableName];\n\t\t\tif (!StorageTable.is(toTableRaw)) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tkind: \"tableRemoved\",\n\t\t\t\t\tsummary: `Table \"${tableName}\" was removed`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst toTable = toTableRaw;\n\t\t\tconst fromTableRaw = fromTables[tableName];\n\t\t\tif (!StorageTable.is(fromTableRaw)) continue;\n\t\t\tconst fromTable = fromTableRaw;\n\t\t\tfor (const columnName of Object.keys(fromTable.columns)) if (!hasOwn(toTable.columns, columnName)) conflicts.push({\n\t\t\t\tkind: \"columnRemoved\",\n\t\t\t\tsummary: `Column \"${tableName}\".\"${columnName}\" was removed`\n\t\t\t});\n\t\t}\n\t}\n\treturn conflicts;\n}\n/**\n* Converts a `Contract` to `SqlSchemaIR`.\n*\n* Reads `contract.storage` for tables and `contract.storage.types` for type\n* annotations. Storage-type annotations are written under\n* `options.annotationNamespace`.\n*\n* Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n* structural information. When `expandNativeType` is provided, parameterized types\n* are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n* resulting IR compares correctly against the \"to\" contract during planning.\n*\n* Returns an empty schema IR when `contract` is `null` (new project).\n*/\n/**\n* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by\n* table name within that namespace. Unlike {@link contractToSchemaIR}, which\n* flattens every namespace's tables into one bare-keyed record (and throws on a\n* cross-namespace name collision), this scopes the table iteration to one\n* namespace so the same table name can exist in two schemas.\n*\n* The full `storage` is still passed to `convertTable`, so value-set / enum /\n* type resolution that legitimately spans namespaces is unaffected. Foreign\n* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace\n* FKs survive per-namespace conversion. The `annotations` block (storage-type\n* derived) is omitted here — the per-namespace tree consumer reads only the\n* per-table fields.\n*/\nfunction contractNamespaceToSchemaIR(storage, namespaceId, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (!namespace) return new SqlSchemaIR({ tables: {} });\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);\n\t\ttables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, storage);\n\t}\n\treturn new SqlSchemaIR({ tables });\n}\nfunction contractToSchemaIR(contract, options) {\n\tif (options.annotationNamespace.length === 0) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", \"annotationNamespace must be a non-empty string\", {\n\t\twhy: \"The calling target pack passed an empty annotationNamespace to the contract-to-schema-IR projection.\",\n\t\tfix: \"Fix the target pack to pass its non-empty annotation namespace (e.g. \\\"pg\\\").\",\n\t\tmeta: { option: \"annotationNamespace\" }\n\t});\n\tif (!contract) return new SqlSchemaIR({ tables: {} });\n\tconst storage = contract.storage;\n\tconst storageTypes = { ...storage.types ?? {} };\n\tconst tables = {};\n\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {\n\t\tStorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);\n\t\tconst tableDef = tableDefRaw;\n\t\tif (tables[tableName] !== void 0) throw sqlFamilyError(\"CONTRACT.TABLE_AMBIGUOUS\", `contractToSchemaIR: duplicate SQL table name \"${tableName}\" across namespaces (ambiguous for flat SqlSchemaIR.tables).`, {\n\t\t\twhy: \"Two namespaces declare a table with the same name, which is ambiguous for the flat schema-IR table map.\",\n\t\t\tfix: \"Rename one of the tables so every table name is unique across namespaces.\",\n\t\t\tmeta: { table: tableName }\n\t\t});\n\t\ttables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault, options.resolveDefault, storage);\n\t}\n\treturn new SqlSchemaIR({\n\t\ttables,\n\t\t...ifDefined(\"annotations\", deriveAnnotations(storage, options.annotationNamespace, options.resolveEnumNamespaceSchema))\n\t});\n}\nfunction deriveAnnotations(storage, annotationNamespace, _resolveEnumNamespaceSchema) {\n\tconst storageTypes = {};\n\tfor (const typeInstance of Object.values(storage.types ?? {})) if (isStorageTypeInstance(typeInstance)) storageTypes[typeInstance.nativeType] = typeInstance;\n\tconst envelope = { ...Object.keys(storageTypes).length > 0 ? { storageTypes } : {} };\n\tif (Object.keys(envelope).length === 0) return void 0;\n\treturn { [annotationNamespace]: envelope };\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* The control policy that governs a single call. The `external` default is an\n* un-overridable namespace floor: when the contract default is `external`, no\n* per-object `managed` override can escalate DDL above the floor, so the\n* policy is forced to `external` regardless of the node's own declaration.\n* Every other default defers to the node's effective control policy.\n*/\nfunction controlPolicyForCall(subject, defaultControlPolicy) {\n\tif (defaultControlPolicy === \"external\") return \"external\";\n\treturn effectiveControlPolicy(subject?.explicitNodeControlPolicy, defaultControlPolicy);\n}\n/**\n* Whether a call is allowed to emit under a given control policy.\n*\n* - `managed` — full lifecycle, every op allowed.\n* - `tolerated` — create-if-absent only: allowed iff the call creates a whole\n* new top-level object (and its subject was positively resolved). Anything\n* that modifies an existing object, and anything whose subject could not be\n* resolved, is suppressed.\n* - `external` / `observed` — no DDL at all.\n*/\nfunction callAllowedUnderControlPolicy(policy, subject) {\n\tswitch (policy) {\n\t\tcase \"managed\": return true;\n\t\tcase \"tolerated\": return subject?.createsNewObject === true;\n\t\tcase \"external\":\n\t\tcase \"observed\": return false;\n\t}\n}\n/**\n* Partition the calls produced for a single set of subjects into those the\n* effective control policy permits (`kept`) and a list of\n* {@link SuppressionRecord}s describing the suppressed calls.\n*\n* **Prefer {@link partitionIssuesByControlPolicy}** for the schema-issue\n* pipeline: it filters subjects out of the planner's *input* so the planner\n* never has to reason about un-modeled state on `external`/`observed`\n* subjects. This call-level helper remains for paths that bypass the issue\n* pipeline — currently the codec-emitted field-event ops, which originate\n* from declared contract fields rather than from introspected schema state\n* and therefore cannot trip the diff engine.\n*/\nfunction partitionCallsByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst kept = [];\n\tconst suppressions = [];\n\tfor (const call of options.calls) {\n\t\tconst subject = options.resolveControlPolicySubject(call);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tif (callAllowedUnderControlPolicy(policy, subject)) kept.push(call);\n\t\telse suppressions.push({\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\tfactoryName: options.resolveFactoryName(call),\n\t\t\tcreatesNewObject: subject?.createsNewObject ?? false\n\t\t});\n\t}\n\treturn Object.freeze({\n\t\tkept: Object.freeze(kept),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\n/**\n* Partition a list of schema-issue-shaped inputs by the effective control\n* policy of each issue's subject *before* the planner is invoked.\n*\n* `plannable` is the list of issues whose subject's effective policy permits\n* the planner to act on them (`managed`, or `tolerated` for whole-object\n* creation issues only). Issues for `external`/`observed` subjects, and\n* non-creation issues for `tolerated` subjects, are dropped from the planner's\n* input entirely — they never enter introspection-driven planning, never feed\n* the diff engine, and never produce DDL calls that would have to be\n* post-filtered. This sidesteps a class of failure where the diff engine\n* cannot reason about the live shape of a subject the user marked as\n* out-of-scope (`external`).\n*\n* `suppressions` is one {@link SuppressionRecord} per suppressed subject (not\n* per suppressed issue). Its `factoryName` is the creation factory name when any\n* of the subject's issues is whole-object creation (e.g. `createTable`), else\n* `undefined` — the family never invents a modification verb for an op that\n* produced no call; the target renders the message.\n*\n* Unresolved-subject issues (`resolveControlPolicySubject` returns\n* `undefined`) emit one record each; they cannot be deduplicated because they\n* carry no subject coordinate.\n*/\nfunction partitionIssuesByControlPolicy(options) {\n\tconst defaultControlPolicy = options.contract.defaultControlPolicy;\n\tconst plannable = [];\n\tconst suppressedSubjects = /* @__PURE__ */ new Map();\n\tconst unresolvedSuppressions = [];\n\tfor (const issue of options.issues) {\n\t\tconst subject = options.resolveControlPolicySubject(issue);\n\t\tconst policy = controlPolicyForCall(subject, defaultControlPolicy);\n\t\tconst creationFactoryName = options.resolveCreationFactoryName(issue);\n\t\tif (policy === \"managed\") {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (policy === \"tolerated\" && subject !== void 0 && creationFactoryName !== void 0 && subject.createsNewObject) {\n\t\t\tplannable.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject === void 0) {\n\t\t\tunresolvedSuppressions.push({\n\t\t\t\tsubject: void 0,\n\t\t\t\tpolicy,\n\t\t\t\tfactoryName: creationFactoryName,\n\t\t\t\tcreatesNewObject: false\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst key = subjectKey(subject);\n\t\tconst existing = suppressedSubjects.get(key);\n\t\tif (existing) {\n\t\t\tif (existing.creationFactoryName === void 0 && creationFactoryName !== void 0) existing.creationFactoryName = creationFactoryName;\n\t\t} else suppressedSubjects.set(key, {\n\t\t\tsubject,\n\t\t\tpolicy,\n\t\t\t...ifDefined(\"creationFactoryName\", creationFactoryName)\n\t\t});\n\t}\n\tconst suppressions = [...unresolvedSuppressions];\n\tfor (const entry of suppressedSubjects.values()) suppressions.push({\n\t\tsubject: entry.subject,\n\t\tpolicy: entry.policy,\n\t\tfactoryName: entry.creationFactoryName,\n\t\tcreatesNewObject: entry.subject.createsNewObject\n\t});\n\treturn Object.freeze({\n\t\tplannable: Object.freeze(plannable),\n\t\tsuppressions: Object.freeze(suppressions)\n\t});\n}\nfunction subjectKey(subject) {\n\treturn `${subject.namespaceId}\\u0000${subject.entityKind ?? \"\"}\\u0000${subject.entityName ?? \"\"}\\u0000${subject.rlsPolicy ?? \"\"}`;\n}\n//#endregion\n//#region src/core/migrations/field-event-planner.ts\nfunction planFieldEventOperations(options) {\n\tconst priorContract = options.priorContract;\n\tconst newContract = options.newContract;\n\tconst added = [];\n\tconst dropped = [];\n\tconst altered = [];\n\tconst namespaceIds = unionSorted(priorContract ? Object.keys(priorContract.storage.namespaces) : [], Object.keys(newContract.storage.namespaces));\n\tfor (const namespaceId of namespaceIds) {\n\t\tconst priorNs = priorContract?.storage.namespaces[namespaceId];\n\t\tconst newNs = newContract.storage.namespaces[namespaceId];\n\t\tconst priorTables = priorNs?.entries.table;\n\t\tconst newTables = newNs?.entries.table;\n\t\tconst tableNames = unionSorted(priorTables ? Object.keys(priorTables) : [], newTables ? Object.keys(newTables) : []);\n\t\tfor (const tableName of tableNames) {\n\t\t\tconst priorTableRaw = priorTables?.[tableName];\n\t\t\tconst newTableRaw = newTables?.[tableName];\n\t\t\tconst priorTable = StorageTable.is(priorTableRaw) ? priorTableRaw : void 0;\n\t\t\tconst newTable = StorageTable.is(newTableRaw) ? newTableRaw : void 0;\n\t\t\tconst fieldNames = unionSorted(priorTable ? Object.keys(priorTable.columns) : [], newTable ? Object.keys(newTable.columns) : []);\n\t\t\tfor (const fieldName of fieldNames) {\n\t\t\t\tconst priorField = priorTable?.columns[fieldName];\n\t\t\t\tconst newField = newTable?.columns[fieldName];\n\t\t\t\tconst entry = {\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\ttableName,\n\t\t\t\t\tfieldName,\n\t\t\t\t\tpriorTable,\n\t\t\t\t\tnewTable,\n\t\t\t\t\tpriorField,\n\t\t\t\t\tnewField\n\t\t\t\t};\n\t\t\t\tif (priorField === void 0 && newField !== void 0) added.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField === void 0) dropped.push(entry);\n\t\t\t\telse if (priorField !== void 0 && newField !== void 0) {\n\t\t\t\t\tif (isAlteration(priorField, newField)) altered.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tconst calls = [];\n\tappendCalls(\"added\", added, options.codecHooks, calls, (e) => e.newField?.codecId);\n\tappendCalls(\"dropped\", dropped, options.codecHooks, calls, (e) => e.priorField?.codecId);\n\tappendCalls(\"altered\", altered, options.codecHooks, calls, (e) => e.newField?.codecId);\n\treturn calls;\n}\nfunction appendCalls(event, entries, codecHooks, calls, pickCodecId) {\n\tfor (const entry of entries) {\n\t\tconst codecId = pickCodecId(entry);\n\t\tif (codecId === void 0) continue;\n\t\tconst hook = codecHooks.get(codecId);\n\t\tif (!hook?.onFieldEvent) continue;\n\t\tconst ctx = buildContext(event, entry);\n\t\tconst emitted = hook.onFieldEvent(event, ctx);\n\t\tfor (const call of emitted) calls.push(call);\n\t}\n}\n/**\n* The context's prior/new sides are scoped to the event:\n*\n* - `'added'` — only `newTable` / `newField` populated.\n* - `'dropped'` — only `priorTable` / `priorField` populated.\n* - `'altered'` — both sides populated.\n*/\nfunction buildContext(event, entry) {\n\tconst base = {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttableName: entry.tableName,\n\t\tfieldName: entry.fieldName\n\t};\n\tif (event === \"added\") return {\n\t\t...base,\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n\tif (event === \"dropped\") return {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {}\n\t};\n\treturn {\n\t\t...base,\n\t\t...entry.priorTable !== void 0 ? { priorTable: entry.priorTable } : {},\n\t\t...entry.newTable !== void 0 ? { newTable: entry.newTable } : {},\n\t\t...entry.priorField !== void 0 ? { priorField: entry.priorField } : {},\n\t\t...entry.newField !== void 0 ? { newField: entry.newField } : {}\n\t};\n}\n/**\n* `'altered'` predicate. Returns `false` whenever `codecId` differs —\n* any codec change suppresses the `altered` event entirely, including\n* cases where another property also differs in the same diff. Codec\n* rotation is a v1 non-goal; avoiding the mixed event keeps the\n* migration semantics for codec changes explicit rather than smuggling\n* them through as `altered`.\n*\n* For non-`codecId` diffs, returns `true` iff any other column property\n* differs.\n*/\nfunction isAlteration(prior, current) {\n\tif (prior.codecId !== current.codecId) return false;\n\treturn !sameStorageColumn(prior, current);\n}\nfunction sameStorageColumn(a, b) {\n\tif (a === b) return true;\n\tif (a.nativeType !== b.nativeType) return false;\n\tif (a.nullable !== b.nullable) return false;\n\tif (a.typeRef !== b.typeRef) return false;\n\tif (!sameJson(a.typeParams, b.typeParams)) return false;\n\tif (!sameJson(a.default, b.default)) return false;\n\treturn true;\n}\nfunction sameJson(a, b) {\n\tif (a === b) return true;\n\tif (a === void 0 || b === void 0) return false;\n\treturn JSON.stringify(a) === JSON.stringify(b);\n}\nfunction unionSorted(a, b) {\n\tconst set = /* @__PURE__ */ new Set();\n\tfor (const name of a) set.add(name);\n\tfor (const name of b) set.add(name);\n\treturn [...set].sort((x, y) => x < y ? -1 : x > y ? 1 : 0);\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* Builds the codec-hook-composed `expandNativeType` callback the contract→IR\n* derivation uses to expand parameterized native types (e.g. `character` +\n* `{ length: 36 }` → `character(36)`). Returns `undefined` when no framework\n* components are supplied, so callers can omit the option entirely.\n*/\nfunction buildNativeTypeExpander(frameworkComponents) {\n\tif (!frameworkComponents) return;\n\tconst codecHooks = extractCodecControlHooks(frameworkComponents);\n\treturn (input) => {\n\t\tif (!input.typeParams) return input.nativeType;\n\t\tif (!input.codecId) return input.nativeType;\n\t\tconst hooks = codecHooks.get(input.codecId);\n\t\tif (!hooks?.expandNativeType) return input.nativeType;\n\t\treturn hooks.expandNativeType(input);\n\t};\n}\n//#endregion\n//#region src/core/migrations/plan-helpers.ts\nconst readOnlyEmptyObject = Object.freeze({});\nfunction cloneRecord(value) {\n\tif (value === readOnlyEmptyObject) return value;\n\treturn Object.freeze({ ...value });\n}\nfunction freezeSteps(steps) {\n\tif (steps.length === 0) return Object.freeze([]);\n\treturn Object.freeze(steps.map((step) => Object.freeze({\n\t\tdescription: step.description,\n\t\tsql: step.sql,\n\t\t...step.params ? { params: Object.freeze([...step.params]) } : {},\n\t\t...step.meta ? { meta: cloneRecord(step.meta) } : {}\n\t})));\n}\nfunction freezeDetailsValue(value) {\n\tif (value === null || value === void 0) return value;\n\tif (typeof value !== \"object\") return value;\n\tif (Array.isArray(value)) return Object.freeze([...value]);\n\treturn Object.freeze({ ...value });\n}\nfunction freezeTargetDetails(target) {\n\treturn Object.freeze({\n\t\tid: target.id,\n\t\t...target.details !== void 0 ? { details: freezeDetailsValue(target.details) } : {}\n\t});\n}\nfunction freezeOperation(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...operation.summary ? { summary: operation.summary } : {},\n\t\toperationClass: operation.operationClass,\n\t\t...operation.invariantId ? { invariantId: operation.invariantId } : {},\n\t\ttarget: freezeTargetDetails(operation.target),\n\t\tprecheck: freezeSteps(operation.precheck),\n\t\texecute: freezeSteps(operation.execute),\n\t\tpostcheck: freezeSteps(operation.postcheck),\n\t\t...operation.meta ? { meta: cloneRecord(operation.meta) } : {}\n\t});\n}\nfunction freezeOperations(operations) {\n\tif (operations.length === 0) return Object.freeze([]);\n\treturn Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\nfunction createMigrationPlan(options) {\n\treturn Object.freeze({\n\t\ttargetId: options.targetId,\n\t\tspaceId: options.spaceId,\n\t\t...options.origin !== void 0 ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null } : {},\n\t\tdestination: Object.freeze({ ...options.destination }),\n\t\toperations: freezeOperations(options.operations),\n\t\tprovidedInvariants: Object.freeze([...options.providedInvariants]),\n\t\t...options.meta ? { meta: cloneRecord(options.meta) } : {}\n\t});\n}\nfunction plannerSuccess(plan, warnings) {\n\treturn Object.freeze({\n\t\tkind: \"success\",\n\t\tplan,\n\t\t...warnings && warnings.length > 0 ? { warnings: Object.freeze(warnings.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t}))) } : {}\n\t});\n}\nfunction plannerFailure(conflicts) {\n\treturn Object.freeze({\n\t\tkind: \"failure\",\n\t\tconflicts: Object.freeze(conflicts.map((conflict) => Object.freeze({\n\t\t\tkind: conflict.kind,\n\t\t\tsummary: conflict.summary,\n\t\t\t...conflict.why ? { why: conflict.why } : {},\n\t\t\t...conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {},\n\t\t\t...conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}\n\t\t})))\n\t});\n}\n/**\n* Creates a successful migration runner result.\n*/\nfunction runnerSuccess(value) {\n\treturn ok(Object.freeze({\n\t\toperationsPlanned: value.operationsPlanned,\n\t\toperationsExecuted: value.operationsExecuted\n\t}));\n}\n/**\n* Creates a failed migration runner result.\n*/\nfunction runnerFailure(code, summary, options) {\n\treturn notOk(Object.freeze({\n\t\tcode,\n\t\tsummary,\n\t\t...options?.why ? { why: options.why } : {},\n\t\t...options?.meta ? { meta: cloneRecord(options.meta) } : {}\n\t}));\n}\n//#endregion\n//#region src/core/migrations/policies.ts\n/**\n* Policy used by `db init`: additive-only operations, no widening/destructive steps.\n*/\nconst INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.freeze([\"additive\"]) });\n//#endregion\n//#region src/exports/control.ts\nvar control_default = new SqlFamilyDescriptor();\n//#endregion\nexport { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, timestampNowControlDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe,cAAc;CACrC,MAAM,UAAU,aAAa,KAAK,CAAC,CAAC,YAAY;CAChD,OAAO,QAAQ,WAAW,SAAS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S;GAClB,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;GAC3C,GAAG,SAAS,WAAW,EAAE,UAAU,OAAO,OAAO,EAAE,GAAG,SAAS,SAAS,CAAC,EAAE,IAAI,CAAC;GAChF,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,SAAS,IAAI,EAAE,IAAI,CAAC;EAC5D,CAAC,CAAC,CAAC;CACJ,CAAC;AACF;;;;AAIA,SAAS,cAAc,OAAO;CAC7B,OAAO,GAAG,OAAO,OAAO;EACvB,mBAAmB,MAAM;EACzB,oBAAoB,MAAM;CAC3B,CAAC,CAAC;AACH;;;;AAIA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,MAAM,OAAO,OAAO;EAC1B;EACA;EACA,GAAG,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAG,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;CAC3D,CAAC,CAAC;AACH;;;;AAMA,MAAM,uBAAuB,OAAO,OAAO,EAAE,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAGnG,IAAI,kBAAkB,IAAI,oBAAoB"}
package/dist/family.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
2
2
  import { a as computeStorageTypeVerdict, i as computeSqlDiffVerdict, n as classifyDiffSubjectGranularity, o as extractCodecControlHooks, r as classifySqlDiffIssue, s as verifySqlSchemaByDiff } from "./schema-verify-C_PEdlAr-U3MX28Zu.mjs";
3
3
  import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-2oBWuxTe-US2zhmuA.mjs";
4
- import { n as parseContractMarkerRow } from "./verify-E6Dd2vYp-gYwnlhLm.mjs";
4
+ import { n as parseContractMarkerRow } from "./verify-u0UTdZgD-DSAaz9rW.mjs";
5
5
  import { a as timestampNowControlDescriptor, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, r as temporalCodecPreset } from "./timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs";
6
- import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-DC3tc4EF.mjs";
6
+ import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-f9B6b5c2.mjs";
7
7
  import { t as arraysEqual } from "./diff-B16bL_IR.mjs";
8
8
  import { t as SqlSchemaVerifierBase } from "./ir-I-xciGUH.mjs";
9
9
  import { t as SqlMigration } from "./migration-CK4oePIo.mjs";
@@ -1,4 +1,4 @@
1
1
  import { o as extractCodecControlHooks } from "./schema-verify-C_PEdlAr-U3MX28Zu.mjs";
2
2
  import { a as timestampNowControlDescriptor, i as temporalCodecPresetWithPrecision, n as temporalAuthoringPresets, r as temporalCodecPreset } from "./timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs";
3
- import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-DC3tc4EF.mjs";
3
+ import { a as contractToSchemaIR, c as createMigrationPlan, d as partitionIssuesByControlPolicy, f as planFieldEventOperations, g as runnerSuccess, h as runnerFailure, i as contractNamespaceToSchemaIR, l as detectDestructiveChanges, m as plannerSuccess, n as assembleAuthoringContributions, o as controlPolicyForCall, p as plannerFailure, r as buildNativeTypeExpander, s as control_default, t as INIT_ADDITIVE_POLICY, u as partitionCallsByControlPolicy } from "./control-f9B6b5c2.mjs";
4
4
  export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, buildNativeTypeExpander, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, temporalCodecPreset, temporalCodecPresetWithPrecision, timestampNowControlDescriptor };
@@ -1,2 +1,2 @@
1
- import { n as parseContractMarkerRow } from "./verify-E6Dd2vYp-gYwnlhLm.mjs";
1
+ import { n as parseContractMarkerRow } from "./verify-u0UTdZgD-DSAaz9rW.mjs";
2
2
  export { parseContractMarkerRow };
@@ -1,6 +1,6 @@
1
1
  import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
2
2
  import { type } from "arktype";
3
- //#region ../../../2-sql/9-family/dist/verify-E6Dd2vYp.mjs
3
+ //#region ../../../2-sql/9-family/dist/verify-u0UTdZgD.mjs
4
4
  const MetaSchema = type({ "[string]": "unknown" });
5
5
  function parseMeta(meta) {
6
6
  if (meta === null || meta === void 0) return {};
@@ -50,6 +50,15 @@ function parseContractMarkerRow(row) {
50
50
  throw sqlFamilyError("CONTRACT.MARKER_ROW_CORRUPT", `Invalid contract marker row: ${messages}`, {
51
51
  why: "The contract marker row read from the database does not match the expected marker shape.",
52
52
  fix: "Re-sign the database with `prisma-next db sign`, or repair the marker table.",
53
+ nextActions: [{
54
+ kind: "run-command",
55
+ label: "Re-sign the database",
56
+ command: "{bin} db sign"
57
+ }, {
58
+ kind: "user-choice",
59
+ label: "Repair the marker table by hand",
60
+ reason: messages
61
+ }],
53
62
  meta: { issues: messages }
54
63
  });
55
64
  }
@@ -83,4 +92,4 @@ function collectSupportedCodecTypeIds(descriptors) {
83
92
  //#endregion
84
93
  export { parseContractMarkerRow as n, collectSupportedCodecTypeIds as t };
85
94
 
86
- //# sourceMappingURL=verify-E6Dd2vYp-gYwnlhLm.mjs.map
95
+ //# sourceMappingURL=verify-u0UTdZgD-DSAaz9rW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-u0UTdZgD-DSAaz9rW.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/verify-u0UTdZgD.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { type } from \"arktype\";\n//#region src/core/verify.ts\nconst MetaSchema = type({ \"[string]\": \"unknown\" });\nfunction parseMeta(meta) {\n\tif (meta === null || meta === void 0) return {};\n\tlet parsed;\n\tif (typeof meta === \"string\") try {\n\t\tparsed = JSON.parse(meta);\n\t} catch {\n\t\treturn {};\n\t}\n\telse parsed = meta;\n\tconst result = MetaSchema(parsed);\n\tif (result instanceof type.errors) return {};\n\treturn result;\n}\n/**\n* SQLite stores `contract_json` as TEXT, so the wire shape is a JSON string;\n* Postgres uses `jsonb` and returns an already-parsed value. Normalize both\n* here so `ContractMarkerRecord.contractJson` is always the structured form.\n*/\nfunction parseContractJson(value) {\n\tif (value === null || value === void 0) return null;\n\tif (typeof value !== \"string\") return value;\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\nconst ContractMarkerRowSchema = type({\n\tcore_hash: \"string\",\n\tprofile_hash: \"string\",\n\t\"contract_json?\": \"unknown | null\",\n\t\"canonical_version?\": \"number | null\",\n\t\"updated_at?\": \"Date | string\",\n\t\"app_tag?\": \"string | null\",\n\t\"meta?\": \"unknown | null\",\n\tinvariants: type(\"string\").array()\n});\n/**\n* Parses a contract marker row from database query result.\n* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).\n*/\nfunction parseContractMarkerRow(row) {\n\tconst result = ContractMarkerRowSchema(row);\n\tif (result instanceof type.errors) {\n\t\tconst messages = result.map((p) => p.message).join(\"; \");\n\t\tthrow sqlFamilyError(\"CONTRACT.MARKER_ROW_CORRUPT\", `Invalid contract marker row: ${messages}`, {\n\t\t\twhy: \"The contract marker row read from the database does not match the expected marker shape.\",\n\t\t\tfix: \"Re-sign the database with `prisma-next db sign`, or repair the marker table.\",\n\t\t\tnextActions: [{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: \"Re-sign the database\",\n\t\t\t\tcommand: \"{bin} db sign\"\n\t\t\t}, {\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"Repair the marker table by hand\",\n\t\t\t\treason: messages\n\t\t\t}],\n\t\t\tmeta: { issues: messages }\n\t\t});\n\t}\n\tconst updatedAt = result.updated_at ? result.updated_at instanceof Date ? result.updated_at : new Date(result.updated_at) : /* @__PURE__ */ new Date();\n\treturn {\n\t\tstorageHash: result.core_hash,\n\t\tprofileHash: result.profile_hash,\n\t\tcontractJson: parseContractJson(result.contract_json),\n\t\tcanonicalVersion: result.canonical_version ?? null,\n\t\tupdatedAt,\n\t\tappTag: result.app_tag ?? null,\n\t\tmeta: parseMeta(result.meta),\n\t\tinvariants: result.invariants\n\t};\n}\n/**\n* Collects supported codec type IDs from adapter and extension manifests.\n* Returns a sorted, unique array of type IDs that are declared in the manifests.\n* This enables coverage checks by comparing contract column types against supported types.\n*\n* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.\n* The manifests declare which codec types are available, but the actual type IDs\n* are defined in the codec-types TypeScript modules that are imported.\n*\n* For MVP, we return an empty array since extracting type IDs from TypeScript modules\n* would require runtime evaluation or static analysis. This can be enhanced later.\n*/\nfunction collectSupportedCodecTypeIds(descriptors) {\n\treturn [];\n}\n//#endregion\nexport { parseContract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Aa,IAAI,KAAK,OAAO,UAAU,oBAAoB,IAAI,KAAK;CACrJ,OAAO;EACN,aAAa,OAAO;EACpB,aAAa,OAAO;EACpB,cAAc,kBAAkB,OAAO,aAAa;EACpD,kBAAkB,OAAO,qBAAqB;EAC9C;EACA,QAAQ,OAAO,WAAW;EAC1B,MAAM,UAAU,OAAO,IAAI;EAC3B,YAAY,OAAO;CACpB;AACD;;;;;;;;;;;;;AAaA,SAAS,6BAA6B,aAAa;CAClD,OAAO,CAAC;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-sql",
3
- "version": "8.0.0-rc.1-dev.28",
3
+ "version": "8.0.0-rc.1-dev.30",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,8 +9,8 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.1-dev.28",
13
- "@prisma/orm-toolchain": "8.0.0-rc.1-dev.28",
12
+ "@prisma/orm-framework": "8.0.0-rc.1-dev.30",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.1-dev.30",
14
14
  "@standard-schema/spec": "^1.1.0",
15
15
  "arktype": "^2.2.2",
16
16
  "pathe": "^2.0.3",
@@ -18,21 +18,21 @@
18
18
  "ts-toolbelt": "^9.6.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@internal/family-sql": "8.0.0-rc.1-dev.28",
22
- "@internal/sql-builder": "8.0.0-rc.1-dev.28",
23
- "@internal/sql-contract": "8.0.0-rc.1-dev.28",
24
- "@internal/sql-contract-emitter": "8.0.0-rc.1-dev.28",
25
- "@internal/sql-contract-psl": "8.0.0-rc.1-dev.28",
26
- "@internal/sql-contract-ts": "8.0.0-rc.1-dev.28",
27
- "@internal/sql-errors": "8.0.0-rc.1-dev.28",
28
- "@internal/sql-lane-query-builder": "8.0.0-rc.1-dev.28",
29
- "@internal/sql-operations": "8.0.0-rc.1-dev.28",
30
- "@internal/sql-orm-client": "8.0.0-rc.1-dev.28",
31
- "@internal/sql-relational-core": "8.0.0-rc.1-dev.28",
32
- "@internal/sql-runtime": "8.0.0-rc.1-dev.28",
33
- "@internal/sql-schema-ir": "8.0.0-rc.1-dev.28",
34
- "@repo/tsconfig": "8.0.0-rc.1-dev.28",
35
- "@repo/tsdown": "8.0.0-rc.1-dev.28",
21
+ "@internal/family-sql": "8.0.0-rc.1-dev.30",
22
+ "@internal/sql-builder": "8.0.0-rc.1-dev.30",
23
+ "@internal/sql-contract": "8.0.0-rc.1-dev.30",
24
+ "@internal/sql-contract-emitter": "8.0.0-rc.1-dev.30",
25
+ "@internal/sql-contract-psl": "8.0.0-rc.1-dev.30",
26
+ "@internal/sql-contract-ts": "8.0.0-rc.1-dev.30",
27
+ "@internal/sql-errors": "8.0.0-rc.1-dev.30",
28
+ "@internal/sql-lane-query-builder": "8.0.0-rc.1-dev.30",
29
+ "@internal/sql-operations": "8.0.0-rc.1-dev.30",
30
+ "@internal/sql-orm-client": "8.0.0-rc.1-dev.30",
31
+ "@internal/sql-relational-core": "8.0.0-rc.1-dev.30",
32
+ "@internal/sql-runtime": "8.0.0-rc.1-dev.30",
33
+ "@internal/sql-schema-ir": "8.0.0-rc.1-dev.30",
34
+ "@repo/tsconfig": "8.0.0-rc.1-dev.30",
35
+ "@repo/tsdown": "8.0.0-rc.1-dev.30",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"verify-E6Dd2vYp-gYwnlhLm.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/verify-E6Dd2vYp.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { type } from \"arktype\";\n//#region src/core/verify.ts\nconst MetaSchema = type({ \"[string]\": \"unknown\" });\nfunction parseMeta(meta) {\n\tif (meta === null || meta === void 0) return {};\n\tlet parsed;\n\tif (typeof meta === \"string\") try {\n\t\tparsed = JSON.parse(meta);\n\t} catch {\n\t\treturn {};\n\t}\n\telse parsed = meta;\n\tconst result = MetaSchema(parsed);\n\tif (result instanceof type.errors) return {};\n\treturn result;\n}\n/**\n* SQLite stores `contract_json` as TEXT, so the wire shape is a JSON string;\n* Postgres uses `jsonb` and returns an already-parsed value. Normalize both\n* here so `ContractMarkerRecord.contractJson` is always the structured form.\n*/\nfunction parseContractJson(value) {\n\tif (value === null || value === void 0) return null;\n\tif (typeof value !== \"string\") return value;\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\nconst ContractMarkerRowSchema = type({\n\tcore_hash: \"string\",\n\tprofile_hash: \"string\",\n\t\"contract_json?\": \"unknown | null\",\n\t\"canonical_version?\": \"number | null\",\n\t\"updated_at?\": \"Date | string\",\n\t\"app_tag?\": \"string | null\",\n\t\"meta?\": \"unknown | null\",\n\tinvariants: type(\"string\").array()\n});\n/**\n* Parses a contract marker row from database query result.\n* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).\n*/\nfunction parseContractMarkerRow(row) {\n\tconst result = ContractMarkerRowSchema(row);\n\tif (result instanceof type.errors) {\n\t\tconst messages = result.map((p) => p.message).join(\"; \");\n\t\tthrow sqlFamilyError(\"CONTRACT.MARKER_ROW_CORRUPT\", `Invalid contract marker row: ${messages}`, {\n\t\t\twhy: \"The contract marker row read from the database does not match the expected marker shape.\",\n\t\t\tfix: \"Re-sign the database with `prisma-next db sign`, or repair the marker table.\",\n\t\t\tmeta: { issues: messages }\n\t\t});\n\t}\n\tconst updatedAt = result.updated_at ? result.updated_at instanceof Date ? result.updated_at : new Date(result.updated_at) : /* @__PURE__ */ new Date();\n\treturn {\n\t\tstorageHash: result.core_hash,\n\t\tprofileHash: result.profile_hash,\n\t\tcontractJson: parseContractJson(result.contract_json),\n\t\tcanonicalVersion: result.canonical_version ?? null,\n\t\tupdatedAt,\n\t\tappTag: result.app_tag ?? null,\n\t\tmeta: parseMeta(result.meta),\n\t\tinvariants: result.invariants\n\t};\n}\n/**\n* Collects supported codec type IDs from adapter and extension manifests.\n* Returns a sorted, unique array of type IDs that are declared in the manifests.\n* This enables coverage checks by comparing contract column types against supported types.\n*\n* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.\n* The manifests declare which codec types are available, but the actual type IDs\n* are defined in the codec-types TypeScript modules that are imported.\n*\n* For MVP, we return an empty array since extracting type IDs from TypeScript modules\n* would require runtime evaluation or static analysis. This can be enhanced later.\n*/\nfunction collectSupportedCodecTypeIds(descriptors) {\n\treturn [];\n}\n//#endregion\nexport { parseContractMarkerRow as n, collectSupportedCodecTypeIds as t };\n\n//# sourceMappingURL=verify-E6Dd2vYp.mjs.map"],"mappings":";;;AAGA,MAAM,aAAa,KAAK,EAAE,YAAY,UAAU,CAAC;AACjD,SAAS,UAAU,MAAM;CACxB,IAAI,SAAS,QAAQ,SAAS,KAAK,GAAG,OAAO,CAAC;CAC9C,IAAI;CACJ,IAAI,OAAO,SAAS,UAAU,IAAI;EACjC,SAAS,KAAK,MAAM,IAAI;CACzB,QAAQ;EACP,OAAO,CAAC;CACT;MACK,SAAS;CACd,MAAM,SAAS,WAAW,MAAM;CAChC,IAAI,kBAAkB,KAAK,QAAQ,OAAO,CAAC;CAC3C,OAAO;AACR;;;;;;AAMA,SAAS,kBAAkB,OAAO;CACjC,IAAI,UAAU,QAAQ,UAAU,KAAK,GAAG,OAAO;CAC/C,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI;EACH,OAAO,KAAK,MAAM,KAAK;CACxB,QAAQ;EACP,OAAO;CACR;AACD;AACA,MAAM,0BAA0B,KAAK;CACpC,WAAW;CACX,cAAc;CACd,kBAAkB;CAClB,sBAAsB;CACtB,eAAe;CACf,YAAY;CACZ,SAAS;CACT,YAAY,KAAK,QAAQ,CAAC,CAAC,MAAM;AAClC,CAAC;;;;;AAKD,SAAS,uBAAuB,KAAK;CACpC,MAAM,SAAS,wBAAwB,GAAG;CAC1C,IAAI,kB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