@prisma/orm-family-sql 8.0.0-rc.17-dev.21 → 8.0.0-rc.17-dev.22

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.
Files changed (61) hide show
  1. package/dist/builder.d.mts +3 -2
  2. package/dist/builder__runtime.d.mts +7 -24
  3. package/dist/builder__runtime.d.mts.map +1 -1
  4. package/dist/builder__runtime.mjs +61 -185
  5. package/dist/builder__runtime.mjs.map +1 -1
  6. package/dist/builder__types.d.mts +4 -2
  7. package/dist/{db-DB1FVK1P-DbwoL7vg.d.mts → db-BmrN9nRS-DEogPltL.d.mts} +11 -97
  8. package/dist/db-BmrN9nRS-DEogPltL.d.mts.map +1 -0
  9. package/dist/expression-CNBCbbzU-BG3rv8Wb.d.mts +22 -0
  10. package/dist/expression-CNBCbbzU-BG3rv8Wb.d.mts.map +1 -0
  11. package/dist/{expression-CvXfXCGs.d.mts → expression-Ck1wys3N-RNyviMcU.d.mts} +15 -3
  12. package/dist/expression-Ck1wys3N-RNyviMcU.d.mts.map +1 -0
  13. package/dist/expression-DWcDQHh9.d.mts +2 -0
  14. package/dist/{expression-JOe6lo4g.mjs → expression-impl-B-XNINxr-vYwKVFeP.mjs} +26 -3
  15. package/dist/expression-impl-B-XNINxr-vYwKVFeP.mjs.map +1 -0
  16. package/dist/functions-0YWByawj.mjs +88 -0
  17. package/dist/functions-0YWByawj.mjs.map +1 -0
  18. package/dist/functions-CJ8Yf8uL.d.mts +73 -0
  19. package/dist/functions-CJ8Yf8uL.d.mts.map +1 -0
  20. package/dist/{index-BzAG1PFV.d.mts → index-ZHk0SsBA.d.mts} +5 -5
  21. package/dist/{index-BzAG1PFV.d.mts.map → index-ZHk0SsBA.d.mts.map} +1 -1
  22. package/dist/index-reference-CflkzYSd.d.mts +58 -0
  23. package/dist/index-reference-CflkzYSd.d.mts.map +1 -0
  24. package/dist/index-reference-D693Lu-E.mjs +42 -0
  25. package/dist/index-reference-D693Lu-E.mjs.map +1 -0
  26. package/dist/orm-client.d.mts +96 -26
  27. package/dist/orm-client.d.mts.map +1 -1
  28. package/dist/orm-client.mjs +172 -8
  29. package/dist/orm-client.mjs.map +1 -1
  30. package/dist/{prepared-statement-YtgdlN7e-D4MSU3i0.d.mts → prepared-statement-YtgdlN7e-DqHHwo30.d.mts} +8 -7
  31. package/dist/prepared-statement-YtgdlN7e-DqHHwo30.d.mts.map +1 -0
  32. package/dist/query-lane-context-BsZs5lvB.d.mts +1 -0
  33. package/dist/{query-lane-context-CJoNBspB--ieuKEei.d.mts → query-lane-context-C2AXsoFa-COSQOvZz.d.mts} +7 -2
  34. package/dist/query-lane-context-C2AXsoFa-COSQOvZz.d.mts.map +1 -0
  35. package/dist/relational-core.d.mts +7 -6
  36. package/dist/relational-core.mjs +2 -2
  37. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  38. package/dist/relational-core__codec-descriptor-registry.d.mts +1 -1
  39. package/dist/relational-core__expression.d.mts +4 -2
  40. package/dist/relational-core__expression.mjs +2 -2
  41. package/dist/relational-core__functions.d.mts +2 -0
  42. package/dist/relational-core__functions.mjs +2 -0
  43. package/dist/relational-core__index-reference.d.mts +2 -0
  44. package/dist/relational-core__index-reference.mjs +2 -0
  45. package/dist/relational-core__query-lane-context.d.mts +2 -2
  46. package/dist/relational-core__types.d.mts +2 -2
  47. package/dist/runtime.d.mts +3 -3
  48. package/dist/runtime.mjs +2 -1
  49. package/dist/runtime.mjs.map +1 -1
  50. package/dist/runtime__internal__prepared-query.d.mts +1 -1
  51. package/dist/{types-BJQcLx-8-BHNxJ_df.d.mts → types-D09NAayg-CNrpjo7Z.d.mts} +3 -3
  52. package/dist/{types-BJQcLx-8-BHNxJ_df.d.mts.map → types-D09NAayg-CNrpjo7Z.d.mts.map} +1 -1
  53. package/dist/types-DAkmn9FV.d.mts +1 -0
  54. package/package.json +20 -18
  55. package/dist/db-DB1FVK1P-DbwoL7vg.d.mts.map +0 -1
  56. package/dist/expression-CvXfXCGs.d.mts.map +0 -1
  57. package/dist/expression-JOe6lo4g.mjs.map +0 -1
  58. package/dist/prepared-statement-YtgdlN7e-D4MSU3i0.d.mts.map +0 -1
  59. package/dist/query-lane-context-CJoNBspB--ieuKEei.d.mts.map +0 -1
  60. package/dist/query-lane-context-DNt2DeQu.d.mts +0 -1
  61. package/dist/types-BCPHaykc.d.mts +0 -1
@@ -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","#alias","#fromSource","#indexes","#indexReferences","#ambiguousIndexName","#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, LockingClause, NullCheckExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SelectAst, SubqueryExpr, TableSource, UpdateAst, collectOrderedParamRefs, isAggregateFn, isAggregateProjection, isOrderByDirection, isOrderByNulls, lockIncompatible, lockOptionCapabilities, lockStrengthCapabilities, lockWaitPolicyOf } from \"@internal/sql-relational-core/ast\";\nimport { codecOf, createRawSql, isExpression, 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* `returnType.codec` records the column-bound codec ref 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\tconstructor(ast, returnType, projectionAst) {\n\t\tthis.ast = ast;\n\t\tthis.returnType = returnType;\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, 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(blindCast({}), { 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);\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);\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/internal-error-ChGYPVpq.mjs\n/**\n* A bug in Prisma 8, 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 (isExpression(operand)) return operand.buildAst();\n\treturn toExpr(operand, otherCodec);\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 (isExpression(value)) 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, 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(blindCast({}), { get(_target, prop) {\n\t\tif (Object.hasOwn(builtins, prop)) return blindCast(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(blindCast({}), { get(_target, prop) {\n\t\tif (Object.hasOwn(aggregates, prop)) return aggregates[prop];\n\t\treturn blindCast(baseFns)[prop];\n\t} });\n}\n//#endregion\n//#region src/runtime/raw-lane.ts\n/**\n* Builds the raw lane a client exposes as `db.raw`.\n*\n* The tag binds the adapter's codec inferer and the contract here, once. An\n* authoring site then carries only its template, its row spec, and a\n* terminator.\n*\n* The row type is phantom: no value holds it. The target-agnostic tag types it\n* as `unknown`, and the contract says what each declared column decodes to.\n*/\nfunction createRawLane(options) {\n\tconst tag = blindCast(createRawSql(options.rawCodecInferer, { contract: options.context.contract }));\n\treturn Object.freeze({ sql: tag });\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/column-scope.ts\nconst NOTHING = {\n\tcolumns: [],\n\tsubqueries: []\n};\n/** The columns an expression reads itself, and the subqueries inside it, which read their own sources. */\nfunction readsOf(expression) {\n\treturn expression.fold({\n\t\tempty: NOTHING,\n\t\tcombine: (a, b) => ({\n\t\t\tcolumns: [...a.columns, ...b.columns],\n\t\t\tsubqueries: [...a.subqueries, ...b.subqueries]\n\t\t}),\n\t\tcolumnRef: (columnRef) => ({\n\t\t\tcolumns: [columnRef],\n\t\t\tsubqueries: []\n\t\t}),\n\t\tselect: (subquery) => ({\n\t\t\tcolumns: [],\n\t\t\tsubqueries: [subquery]\n\t\t})\n\t});\n}\nfunction aliasOf(source) {\n\treturn source.kind === \"table-source\" ? source.alias ?? source.name : source.alias;\n}\nfunction assertReadsIn(expressions, visible) {\n\tfor (const expression of expressions) {\n\t\tconst { columns, subqueries } = readsOf(expression);\n\t\tfor (const column of columns) if (!visible.has(column.table)) throw columnOutsideQuery(column, visible);\n\t\tfor (const subquery of subqueries) assertSelectReads(subquery, visible);\n\t}\n}\nfunction assertSelectReads(select, outer) {\n\tconst sources = [select.from, ...(select.joins ?? []).map((join) => join.source)].filter((source) => source !== void 0);\n\tconst visible = /* @__PURE__ */ new Set([...outer, ...sources.map(aliasOf).filter((alias) => alias !== void 0)]);\n\tfor (const source of sources) {\n\t\tif (source.kind === \"derived-table-source\") assertSelectReads(source.query, visible);\n\t\tif (source.kind === \"function-source\") assertReadsIn(source.args, visible);\n\t}\n\tassertReadsIn([\n\t\t...select.projection.map((item) => item.expr),\n\t\t...select.where === void 0 ? [] : [select.where],\n\t\t...(select.orderBy ?? []).map((item) => item.expr),\n\t\t...select.groupBy ?? [],\n\t\t...select.having === void 0 ? [] : [select.having],\n\t\t...select.distinctOn ?? [],\n\t\t...(select.joins ?? []).flatMap((join) => join.on.kind === \"eq-col-join-on\" ? [join.on.left, join.on.right] : [join.on])\n\t], visible);\n}\n/**\n* Refuses a statement that reads a column of an alias none of its sources, or of the queries around it, has. An expression built outside the query's callbacks, such as an index read from `table.as('other').indexes`, can name any alias.\n*/\nfunction assertColumnsInScope(ast) {\n\tswitch (ast.kind) {\n\t\tcase \"select\":\n\t\t\tassertSelectReads(ast, /* @__PURE__ */ new Set());\n\t\t\treturn;\n\t\tcase \"update\":\n\t\t\tassertReadsIn([...Object.values(ast.set), ...ast.where === void 0 ? [] : [ast.where]], /* @__PURE__ */ new Set([aliasOf(ast.table) ?? ast.table.name]));\n\t\t\treturn;\n\t\tcase \"delete\":\n\t\t\tassertReadsIn(ast.where === void 0 ? [] : [ast.where], /* @__PURE__ */ new Set([aliasOf(ast.table) ?? ast.table.name]));\n\t\t\treturn;\n\t\tdefault: return;\n\t}\n}\nfunction columnOutsideQuery(column, visible) {\n\tconst sources = [...visible];\n\treturn structuredError(\"ORM.ARGUMENT_INVALID\", `The query reads column \"${column.column}\" of \"${column.table}\", which is not one of its sources (${sources.map((source) => `\"${source}\"`).join(\", \")}).`, {\n\t\tfix: \"Read the column, or the index, from a table the query selects from or joins, under the alias it has in the query.\",\n\t\tmeta: {\n\t\t\talias: column.table,\n\t\t\tcolumn: column.column,\n\t\t\tsources\n\t\t}\n\t});\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\tlocking: 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}\nconst lockConflictKinds = [\n\t\"distinct\",\n\t\"distinctOn\",\n\t\"groupBy\",\n\t\"having\"\n];\nfunction lockConflictOf(state) {\n\tconst conflicts = {\n\t\tdistinct: state.distinct !== void 0,\n\t\tdistinctOn: state.distinctOn !== void 0 && state.distinctOn.length > 0,\n\t\tgroupBy: state.groupBy.length > 0,\n\t\thaving: state.having !== void 0\n\t};\n\treturn lockConflictKinds.find((conflict) => conflicts[conflict]);\n}\nfunction assertLockable(state) {\n\tif (state.locking === void 0) return;\n\tconst conflict = lockConflictOf(state);\n\tif (conflict !== void 0) throw lockIncompatible(conflict, `A locking clause cannot be combined with ${conflict}`);\n\tconst item = state.projections.find(isAggregateProjection);\n\tif (item !== void 0) throw lockIncompatible(\"aggregate\", `A locking clause cannot be combined with an aggregate or window function in the projection (column \"${item.alias}\")`);\n}\nfunction assertNotLocked(state) {\n\tif (state.locking !== void 0) throw lockIncompatible(\"subquery\", \"A locked select cannot be used as a subquery\");\n}\nfunction buildSelectAst(state) {\n\tassertLockable(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\tlocking: state.locking,\n\t\tselectAllIntent: void 0\n\t});\n}\nfunction buildQueryPlan(ast, ctx, annotations) {\n\tassertColumnsInScope(ast);\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 codecRefOf(field, ctx) {\n\tif (field.codec !== void 0) return field.codec;\n\treturn ctx.materializesWithoutTypeParams(field.codecId) ? { codecId: field.codecId } : void 0;\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), codecRefOf(field, ctx)));\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), codecRefOf(field, ctx)));\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), codecRefOf(field, ctx)));\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 direction = options?.direction ?? \"asc\";\n\tconst nulls = options?.nulls;\n\tif (!isOrderByDirection(direction)) throw structuredError(\"ORM.ARGUMENT_INVALID\", \"orderBy direction must be \\\"asc\\\" or \\\"desc\\\"\", { meta: { direction: String(direction) } });\n\tif (nulls !== void 0 && !isOrderByNulls(nulls)) throw structuredError(\"ORM.ARGUMENT_INVALID\", \"orderBy nulls must be \\\"first\\\" or \\\"last\\\"\", { meta: { nulls: String(nulls) } });\n\tconst toOrderByItem = (expr) => new OrderByItem(expr, direction, nulls);\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\treturn toOrderByItem(IdentifierRef.of(arg));\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\treturn toOrderByItem(arg(createFieldProxy(combined), fns).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\tassertNotLocked(this.state);\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\tassertNotLocked(this.state);\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\tforUpdate = this._gate(lockStrengthCapabilities.forUpdate, \"forUpdate\", (options) => this.lock(\"forUpdate\", options));\n\tforNoKeyUpdate = this._gate(lockStrengthCapabilities.forNoKeyUpdate, \"forNoKeyUpdate\", (options) => this.lock(\"forNoKeyUpdate\", options));\n\tforShare = this._gate(lockStrengthCapabilities.forShare, \"forShare\", (options) => this.lock(\"forShare\", options));\n\tforKeyShare = this._gate(lockStrengthCapabilities.forKeyShare, \"forKeyShare\", (options) => this.lock(\"forKeyShare\", options));\n\tlock(strength, options) {\n\t\tconst of = options?.of !== void 0 && options.of.length > 0 ? options.of : void 0;\n\t\tif (of !== void 0) assertCapability(this.ctx, lockOptionCapabilities.of, strength);\n\t\tconst waitPolicy = lockWaitPolicyOf(strength, options);\n\t\tif (waitPolicy !== void 0) assertCapability(this.ctx, lockOptionCapabilities[waitPolicy], strength);\n\t\tconst clause = LockingClause.of(strength, {\n\t\t\t...ifDefined(\"of\", of),\n\t\t\t...ifDefined(\"waitPolicy\", waitPolicy)\n\t\t});\n\t\treturn this.clone(cloneState(this.state, { locking: [...this.state.locking ?? [], clause] }));\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\tentry: tableName,\n\t\tvalues\n\t})) {\n\t\tconst codec = table.columns[def.field] ? codecRefFor(ctx, namespaceId, tableName, def.field) : void 0;\n\t\tparams[def.field] = ParamRef.of(def.value, codec ? { codec } : void 0);\n\t}\n\treturn params;\n}\nfunction buildReturningProjections(tableName, columns, rowFields, ctx) {\n\treturn columns.map((col) => {\n\t\tconst field = rowFields[col];\n\t\treturn ProjectionItem.of(col, ColumnRef.of(tableName, col), field === void 0 ? void 0 : codecRefOf(field, ctx));\n\t});\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\tentry: tableName,\n\t\tvalues: exprs\n\t})) if (!(def.field in set)) {\n\t\tconst codec = table.columns[def.field] ? codecRefFor(ctx, namespaceId, tableName, def.field) : void 0;\n\t\tset[def.field] = 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, this.ctx));\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, this.ctx));\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, this.ctx));\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#alias;\n\t#table;\n\t#namespaceId;\n\t#fromSource;\n\t#scope;\n\t#indexes;\n\tconstructor(tableName, table, alias, ctx, namespaceId) {\n\t\tsuper(ctx);\n\t\tthis.#tableName = tableName;\n\t\tthis.#alias = alias;\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\t/**\n\t* The table's columns, each as the codec descriptor a raw row spec reads.\n\t* The declared type resolves each column's output through the contract; the\n\t* value carries what the storage table states.\n\t*/\n\tget columns() {\n\t\tconst refs = Object.fromEntries(Object.entries(this.#table.columns).map(([name, column]) => [name, {\n\t\t\tcodecId: column.codecId,\n\t\t\tnullable: column.nullable\n\t\t}]));\n\t\treturn blindCast(Object.freeze(refs));\n\t}\n\t/**\n\t* The table's indexes, keyed by the name the contract source gave each. An index's columns are this table's columns under its alias, so `post.as('p').indexes.post_search` reads `p`'s columns. A name more than one index shares is refused when it is read.\n\t*/\n\tget indexes() {\n\t\tthis.#indexes ??= this.#indexReferences();\n\t\treturn this.#indexes;\n\t}\n\t#indexReferences() {\n\t\tconst fields = this.#scope.namespaces[this.#alias];\n\t\tassertDefined(fields, \"a table proxy scopes its own alias\");\n\t\tconst byName = /* @__PURE__ */ new Map();\n\t\tfor (const index of this.#table.indexes) {\n\t\t\tconst authoredName = index.prefix ?? index.name;\n\t\t\tconst columns = Object.fromEntries((index.columns ?? []).map((column) => {\n\t\t\t\tconst field = fields[column];\n\t\t\t\tassertDefined(field, `index \"${index.name}\" covers a column of its table`);\n\t\t\t\treturn [column, new ExpressionImpl(ColumnRef.of(this.#alias, column), field)];\n\t\t\t}));\n\t\t\tconst reference = Object.freeze({\n\t\t\t\tcolumns: Object.freeze(columns),\n\t\t\t\ttype: index.type,\n\t\t\t\toptions: index.options\n\t\t\t});\n\t\t\tbyName.set(authoredName, [...byName.get(authoredName) ?? [], reference]);\n\t\t}\n\t\tconst references = {};\n\t\tfor (const [authoredName, [reference, ...others]] of byName) Object.defineProperty(references, authoredName, {\n\t\t\tenumerable: true,\n\t\t\tget: () => {\n\t\t\t\tif (others.length > 0) throw this.#ambiguousIndexName(authoredName);\n\t\t\t\treturn reference;\n\t\t\t}\n\t\t});\n\t\treturn blindCast(Object.freeze(references));\n\t}\n\t#ambiguousIndexName(authoredName) {\n\t\treturn structuredError(\"ORM.ARGUMENT_INVALID\", `Table \"${this.#tableName}\" has more than one index named \"${authoredName}\".`, {\n\t\t\twhy: \"An index is read by the name its contract source gave it, and these indexes share that name.\",\n\t\t\tfix: `Give each of these indexes of table \"${this.#tableName}\" its own name in the contract source.`,\n\t\t\tmeta: {\n\t\t\t\tnamespaceId: this.#namespaceId,\n\t\t\t\ttableName: this.#tableName,\n\t\t\t\tindex: authoredName\n\t\t\t}\n\t\t});\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 descriptorMaterializesWithoutTypeParams(descriptor) {\n\tif (descriptor === void 0) return false;\n\tconst schema = descriptor.paramsSchema;\n\tif (schema === void 0) return true;\n\tconst result = schema[\"~standard\"].validate({});\n\treturn !(result instanceof Promise) && result.issues === void 0;\n}\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\tmaterializesWithoutTypeParams: (codecId) => descriptorMaterializesWithoutTypeParams(context.codecDescriptors.descriptorFor(codecId))\n\t};\n\tconst { storage } = context.contract;\n\treturn new Proxy(blindCast({}), { 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, createRawLane, 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,CAAC,IAAI,IAAI,MAAM,OAAO;CAC1G,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B;EACA,GAAG,UAAU,OAAO,SAAS,GAAG;EAChC,GAAG,UAAU,OAAO,SAAS,GAAG;EAChC,GAAG,UAAU,eAAe,SAAS,WAAW;EAChD,GAAG,UAAU,SAAS,SAAS,KAAK;EACpC,GAAG,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S,MAAM;EACpD,IAAI,OAAO,SAAS,UAAU;EAC9B,IAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,IAAI,GAAG;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":["ExpressionImpl$1","createFunctions$1","#state","#buildLateral","#addLateralJoin","#addJoin","#tableSource","#tableName","#namespaceId","#table","#scope","#rows","#returningColumns","#rowFields","#annotations","#setExpressions","#whereExprs","#whereCallbacks","#alias","#fromSource","#indexes","#indexReferences","#toJoined"],"sources":["../../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs"],"sourcesContent":["import { ExpressionImpl, ExpressionImpl as ExpressionImpl$1, createRawSql, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { createFunctions, createFunctions as createFunctions$1 } from \"@internal/sql-relational-core/functions\";\nimport { AggregateExpr, AndExpr, ColumnRef, DeleteAst, DerivedTableSource, IdentifierRef, InsertAst, JoinAst, LockingClause, OrderByItem, ParamRef, ProjectionItem, SelectAst, TableSource, UpdateAst, collectOrderedParamRefs, isAggregateFn, isAggregateProjection, isOrderByDirection, isOrderByNulls, lockIncompatible, lockOptionCapabilities, lockStrengthCapabilities, lockWaitPolicyOf } from \"@internal/sql-relational-core/ast\";\nimport { createIndexReferences } from \"@internal/sql-relational-core/index-reference\";\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 src/runtime/field-proxy.ts\nfunction createFieldProxy(scope) {\n\treturn new Proxy(blindCast({}), { 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$1(IdentifierRef.of(prop), topField);\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$1(ColumnRef.of(namespaceName, prop), field);\n\t\t}\n\t} });\n}\n//#endregion\n//#region ../../../1-framework/0-foundation/utils/dist/internal-error-ChGYPVpq.mjs\n/**\n* A bug in Prisma 8, 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 ../../../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* 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$1 {\n\toperation;\n\tconstructor(operation, lowered, returnType) {\n\t\tsuper(lowered, returnType, 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$1 ? expr.buildProjectionAst() : expr.buildAst();\n}\n//#endregion\n//#region src/runtime/functions.ts\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$1(ast, returnType, projectionAst);\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 createAggregateFunctions(operations, rawCodecInferer, aggregateRegistry) {\n\tconst baseFns = createFunctions$1(operations, rawCodecInferer);\n\tconst aggregates = createAggregateOnlyFunctions(aggregateRegistry);\n\treturn new Proxy(blindCast({}), { get(_target, prop) {\n\t\tif (Object.hasOwn(aggregates, prop)) return aggregates[prop];\n\t\treturn blindCast(baseFns)[prop];\n\t} });\n}\n//#endregion\n//#region src/runtime/raw-lane.ts\n/**\n* Builds the raw lane a client exposes as `db.raw`.\n*\n* The tag binds the adapter's codec inferer and the contract here, once. An\n* authoring site then carries only its template, its row spec, and a\n* terminator.\n*\n* The row type is phantom: no value holds it. The target-agnostic tag types it\n* as `unknown`, and the contract says what each declared column decodes to.\n*/\nfunction createRawLane(options) {\n\tconst tag = blindCast(createRawSql(options.rawCodecInferer, { contract: options.context.contract }));\n\treturn Object.freeze({ sql: tag });\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/column-scope.ts\nconst NOTHING = {\n\tcolumns: [],\n\tsubqueries: []\n};\n/** The columns an expression reads itself, and the subqueries inside it, which read their own sources. */\nfunction readsOf(expression) {\n\treturn expression.fold({\n\t\tempty: NOTHING,\n\t\tcombine: (a, b) => ({\n\t\t\tcolumns: [...a.columns, ...b.columns],\n\t\t\tsubqueries: [...a.subqueries, ...b.subqueries]\n\t\t}),\n\t\tcolumnRef: (columnRef) => ({\n\t\t\tcolumns: [columnRef],\n\t\t\tsubqueries: []\n\t\t}),\n\t\tselect: (subquery) => ({\n\t\t\tcolumns: [],\n\t\t\tsubqueries: [subquery]\n\t\t})\n\t});\n}\nfunction aliasOf(source) {\n\treturn source.kind === \"table-source\" ? source.alias ?? source.name : source.alias;\n}\nfunction assertReadsIn(expressions, visible) {\n\tfor (const expression of expressions) {\n\t\tconst { columns, subqueries } = readsOf(expression);\n\t\tfor (const column of columns) if (!visible.has(column.table)) throw columnOutsideQuery(column, visible);\n\t\tfor (const subquery of subqueries) assertSelectReads(subquery, visible);\n\t}\n}\nfunction assertSelectReads(select, outer) {\n\tconst sources = [select.from, ...(select.joins ?? []).map((join) => join.source)].filter((source) => source !== void 0);\n\tconst visible = /* @__PURE__ */ new Set([...outer, ...sources.map(aliasOf).filter((alias) => alias !== void 0)]);\n\tfor (const source of sources) {\n\t\tif (source.kind === \"derived-table-source\") assertSelectReads(source.query, visible);\n\t\tif (source.kind === \"function-source\") assertReadsIn(source.args, visible);\n\t}\n\tassertReadsIn([\n\t\t...select.projection.map((item) => item.expr),\n\t\t...select.where === void 0 ? [] : [select.where],\n\t\t...(select.orderBy ?? []).map((item) => item.expr),\n\t\t...select.groupBy ?? [],\n\t\t...select.having === void 0 ? [] : [select.having],\n\t\t...select.distinctOn ?? [],\n\t\t...(select.joins ?? []).flatMap((join) => join.on.kind === \"eq-col-join-on\" ? [join.on.left, join.on.right] : [join.on])\n\t], visible);\n}\n/**\n* Refuses a statement that reads a column of an alias none of its sources, or of the queries around it, has. An expression built outside the query's callbacks, such as an index read from `table.as('other').indexes`, can name any alias.\n*/\nfunction assertColumnsInScope(ast) {\n\tswitch (ast.kind) {\n\t\tcase \"select\":\n\t\t\tassertSelectReads(ast, /* @__PURE__ */ new Set());\n\t\t\treturn;\n\t\tcase \"update\":\n\t\t\tassertReadsIn([...Object.values(ast.set), ...ast.where === void 0 ? [] : [ast.where]], /* @__PURE__ */ new Set([aliasOf(ast.table) ?? ast.table.name]));\n\t\t\treturn;\n\t\tcase \"delete\":\n\t\t\tassertReadsIn(ast.where === void 0 ? [] : [ast.where], /* @__PURE__ */ new Set([aliasOf(ast.table) ?? ast.table.name]));\n\t\t\treturn;\n\t\tdefault: return;\n\t}\n}\nfunction columnOutsideQuery(column, visible) {\n\tconst sources = [...visible];\n\treturn structuredError(\"ORM.ARGUMENT_INVALID\", `The query reads column \"${column.column}\" of \"${column.table}\", which is not one of its sources (${sources.map((source) => `\"${source}\"`).join(\", \")}).`, {\n\t\tfix: \"Read the column, or the index, from a table the query selects from or joins, under the alias it has in the query.\",\n\t\tmeta: {\n\t\t\talias: column.table,\n\t\t\tcolumn: column.column,\n\t\t\tsources\n\t\t}\n\t});\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\tlocking: 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}\nconst lockConflictKinds = [\n\t\"distinct\",\n\t\"distinctOn\",\n\t\"groupBy\",\n\t\"having\"\n];\nfunction lockConflictOf(state) {\n\tconst conflicts = {\n\t\tdistinct: state.distinct !== void 0,\n\t\tdistinctOn: state.distinctOn !== void 0 && state.distinctOn.length > 0,\n\t\tgroupBy: state.groupBy.length > 0,\n\t\thaving: state.having !== void 0\n\t};\n\treturn lockConflictKinds.find((conflict) => conflicts[conflict]);\n}\nfunction assertLockable(state) {\n\tif (state.locking === void 0) return;\n\tconst conflict = lockConflictOf(state);\n\tif (conflict !== void 0) throw lockIncompatible(conflict, `A locking clause cannot be combined with ${conflict}`);\n\tconst item = state.projections.find(isAggregateProjection);\n\tif (item !== void 0) throw lockIncompatible(\"aggregate\", `A locking clause cannot be combined with an aggregate or window function in the projection (column \"${item.alias}\")`);\n}\nfunction assertNotLocked(state) {\n\tif (state.locking !== void 0) throw lockIncompatible(\"subquery\", \"A locked select cannot be used as a subquery\");\n}\nfunction buildSelectAst(state) {\n\tassertLockable(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\tlocking: state.locking,\n\t\tselectAllIntent: void 0\n\t});\n}\nfunction buildQueryPlan(ast, ctx, annotations) {\n\tassertColumnsInScope(ast);\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 codecRefOf(field, ctx) {\n\tif (field.codec !== void 0) return field.codec;\n\treturn ctx.materializesWithoutTypeParams(field.codecId) ? { codecId: field.codecId } : void 0;\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), codecRefOf(field, ctx)));\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), codecRefOf(field, ctx)));\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), codecRefOf(field, ctx)));\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 direction = options?.direction ?? \"asc\";\n\tconst nulls = options?.nulls;\n\tif (!isOrderByDirection(direction)) throw structuredError(\"ORM.ARGUMENT_INVALID\", \"orderBy direction must be \\\"asc\\\" or \\\"desc\\\"\", { meta: { direction: String(direction) } });\n\tif (nulls !== void 0 && !isOrderByNulls(nulls)) throw structuredError(\"ORM.ARGUMENT_INVALID\", \"orderBy nulls must be \\\"first\\\" or \\\"last\\\"\", { meta: { nulls: String(nulls) } });\n\tconst toOrderByItem = (expr) => new OrderByItem(expr, direction, nulls);\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\treturn toOrderByItem(IdentifierRef.of(arg));\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$1(ctx.queryOperationTypes, ctx.rawCodecInferer);\n\t\treturn toOrderByItem(arg(createFieldProxy(combined), fns).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$1(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$1(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\tassertNotLocked(this.state);\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\tassertNotLocked(this.state);\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$1(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\tforUpdate = this._gate(lockStrengthCapabilities.forUpdate, \"forUpdate\", (options) => this.lock(\"forUpdate\", options));\n\tforNoKeyUpdate = this._gate(lockStrengthCapabilities.forNoKeyUpdate, \"forNoKeyUpdate\", (options) => this.lock(\"forNoKeyUpdate\", options));\n\tforShare = this._gate(lockStrengthCapabilities.forShare, \"forShare\", (options) => this.lock(\"forShare\", options));\n\tforKeyShare = this._gate(lockStrengthCapabilities.forKeyShare, \"forKeyShare\", (options) => this.lock(\"forKeyShare\", options));\n\tlock(strength, options) {\n\t\tconst of = options?.of !== void 0 && options.of.length > 0 ? options.of : void 0;\n\t\tif (of !== void 0) assertCapability(this.ctx, lockOptionCapabilities.of, strength);\n\t\tconst waitPolicy = lockWaitPolicyOf(strength, options);\n\t\tif (waitPolicy !== void 0) assertCapability(this.ctx, lockOptionCapabilities[waitPolicy], strength);\n\t\tconst clause = LockingClause.of(strength, {\n\t\t\t...ifDefined(\"of\", of),\n\t\t\t...ifDefined(\"waitPolicy\", waitPolicy)\n\t\t});\n\t\treturn this.clone(cloneState(this.state, { locking: [...this.state.locking ?? [], clause] }));\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$1(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\tentry: tableName,\n\t\tvalues\n\t})) {\n\t\tconst codec = table.columns[def.field] ? codecRefFor(ctx, namespaceId, tableName, def.field) : void 0;\n\t\tparams[def.field] = ParamRef.of(def.value, codec ? { codec } : void 0);\n\t}\n\treturn params;\n}\nfunction buildReturningProjections(tableName, columns, rowFields, ctx) {\n\treturn columns.map((col) => {\n\t\tconst field = rowFields[col];\n\t\treturn ProjectionItem.of(col, ColumnRef.of(tableName, col), field === void 0 ? void 0 : codecRefOf(field, ctx));\n\t});\n}\nfunction evaluateWhere(whereCallback, scope, queryOperationTypes, rawCodecInferer) {\n\treturn whereCallback(createFieldProxy(scope), createFunctions$1(queryOperationTypes, rawCodecInferer)).buildAst();\n}\nfunction evaluateUpdateCallback(callback, scope, queryOperationTypes, rawCodecInferer) {\n\tconst result = callback(createFieldProxy(scope), createFunctions$1(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\tentry: tableName,\n\t\tvalues: exprs\n\t})) if (!(def.field in set)) {\n\t\tconst codec = table.columns[def.field] ? codecRefFor(ctx, namespaceId, tableName, def.field) : void 0;\n\t\tset[def.field] = 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, this.ctx));\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$1(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, this.ctx));\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, this.ctx));\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#alias;\n\t#table;\n\t#namespaceId;\n\t#fromSource;\n\t#scope;\n\t#indexes;\n\tconstructor(tableName, table, alias, ctx, namespaceId) {\n\t\tsuper(ctx);\n\t\tthis.#tableName = tableName;\n\t\tthis.#alias = alias;\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\t/**\n\t* The table's columns, each as the codec descriptor a raw row spec reads.\n\t* The declared type resolves each column's output through the contract; the\n\t* value carries what the storage table states.\n\t*/\n\tget columns() {\n\t\tconst refs = Object.fromEntries(Object.entries(this.#table.columns).map(([name, column]) => [name, {\n\t\t\tcodecId: column.codecId,\n\t\t\tnullable: column.nullable\n\t\t}]));\n\t\treturn blindCast(Object.freeze(refs));\n\t}\n\t/**\n\t* The table's indexes, keyed by the name the contract source gave each. An index's columns are this table's columns under its alias, so `post.as('p').indexes.post_search` reads `p`'s columns. A name more than one index shares is refused when it is read.\n\t*/\n\tget indexes() {\n\t\tthis.#indexes ??= this.#indexReferences();\n\t\treturn this.#indexes;\n\t}\n\t#indexReferences() {\n\t\tconst fields = this.#scope.namespaces[this.#alias];\n\t\tassertDefined(fields, \"a table proxy scopes its own alias\");\n\t\treturn blindCast(createIndexReferences({\n\t\t\tnamespaceId: this.#namespaceId,\n\t\t\ttableName: this.#tableName,\n\t\t\ttable: this.#table,\n\t\t\tcolumn: (column) => {\n\t\t\t\tconst field = fields[column];\n\t\t\t\tassertDefined(field, `an index covers a column of table \"${this.#tableName}\"`);\n\t\t\t\treturn new ExpressionImpl$1(ColumnRef.of(this.#alias, column), field);\n\t\t\t}\n\t\t}));\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 descriptorMaterializesWithoutTypeParams(descriptor) {\n\tif (descriptor === void 0) return false;\n\tconst schema = descriptor.paramsSchema;\n\tif (schema === void 0) return true;\n\tconst result = schema[\"~standard\"].validate({});\n\treturn !(result instanceof Promise) && result.issues === void 0;\n}\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\tmaterializesWithoutTypeParams: (codecId) => descriptorMaterializesWithoutTypeParams(context.codecDescriptors.descriptorFor(codecId))\n\t};\n\tconst { storage } = context.contract;\n\treturn new Proxy(blindCast({}), { 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, createRawLane, sql };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;AAGA,SAAS,iBAAiB,OAAO;CAChC,OAAO,IAAI,MAAM,UAAU,CAAC,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM;EACpD,IAAI,OAAO,OAAO,MAAM,UAAU,IAAI,GAAG;GACxC,MAAM,WAAW,MAAM,SAAS;GAChC,IAAI,UAAU,OAAO,IAAIA,eAAiB,cAAc,GAAG,IAAI,GAAG,QAAQ;EAC3E;EACA,IAAI,OAAO,OAAO,MAAM,YAAY,IAAI,GAAG;GAC1C,MAAM,WAAW,MAAM,WAAW;GAClC,IAAI,UAAU,OAAO,qBAAqB,MAAM,QAAQ;EACzD;CACD,EAAE,CAAC;AACJ;AACA,SAAS,qBAAqB,eAAe,QAAQ;CACpD,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM;EACzC,IAAI,OAAO,OAAO,QAAQ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,CAAC;CACpI;CACA,MAAM,EAAE,YAAY,QAAQ;CAC5B,OAAO,IAAI,MAAM,UAAU,CAAC,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM;EACpD,IAAI,OAAO,SAAS,UAAU;EAC9B,IAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,IAAI,GAAG;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,3 +1,5 @@
1
- import { o as Expression, x as ScopeField } from "./expression-CvXfXCGs.mjs";
2
- import { C as TableProxy, D as WhereFilter, E as UpdateQuery, S as TableNamesAcrossNamespaces, T as UnboundTables, _ as ResolveRow, a as DeleteQuery, b as Subquery, c as GatedMethod, d as IndexReferences, f as InsertQuery, g as RawTagFor, h as RawLane, i as Db, l as GroupedQuery, m as QueryContext, n as BooleanCodecType, p as Namespace, r as ContractRawTag, s as Functions, t as AggregateFunctions, u as IndexReference, v as Scope, w as TableProxyContract, x as TableInAnyNamespace, y as SelectQuery } from "./db-DB1FVK1P-DbwoL7vg.mjs";
1
+ import { o as Expression, x as ScopeField } from "./expression-Ck1wys3N-RNyviMcU.mjs";
2
+ import { a as Subquery, r as Functions, t as BooleanCodecType } from "./functions-CJ8Yf8uL.mjs";
3
+ import { t as IndexReference } from "./index-reference-CflkzYSd.mjs";
4
+ import { C as WhereFilter, S as UpdateQuery, _ as TableInAnyNamespace, b as TableProxyContract, c as IndexReferences, d as QueryContext, f as RawLane, g as SelectQuery, h as Scope, i as DeleteQuery, l as InsertQuery, m as ResolveRow, n as ContractRawTag, o as GatedMethod, p as RawTagFor, r as Db, s as GroupedQuery, t as AggregateFunctions, u as Namespace, v as TableNamesAcrossNamespaces, x as UnboundTables, y as TableProxy } from "./db-BmrN9nRS-DEogPltL.mjs";
3
5
  export type { AggregateFunctions, BooleanCodecType, ContractRawTag, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, IndexReference, IndexReferences, InsertQuery, Namespace, QueryContext, RawLane, RawTagFor, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableInAnyNamespace, TableNamesAcrossNamespaces, TableProxy, TableProxyContract, UnboundTables, UpdateQuery, WhereFilter };
@@ -1,17 +1,19 @@
1
1
  import { r as StorageTable } from "./storage-table-WXeVNycx-BCwDhdq5.mjs";
2
2
  import { T as QueryOperationTypesBase, h as ExtractStorageColumnTypes, l as ExtractAggregateTypes, m as ExtractStorageColumnInputTypes, p as ExtractQueryOperationTypes, r as AggregateTypesBase, u as ExtractCodecTypes } from "./types-DFZhLz18-Msi8wwig.mjs";
3
3
  import { o as StorageColumnMapAt } from "./types-Uv3oTMAb.mjs";
4
- import { Mt as SelectAst, St as OrderByNulls, l as AnyFromSource } from "./types-Sh5HuaZE-CqThc46M.mjs";
5
- import { c as LockOptionCapabilities, l as LockStrengthCapabilities, u as LockWaitOptions } from "./ast-Dp6lQXUX.mjs";
4
+ import { St as OrderByNulls, l as AnyFromSource } from "./types-Sh5HuaZE-CqThc46M.mjs";
6
5
  import { n as SqlQueryPlan } from "./plan-cGEaSXHv-j0w37mVT.mjs";
7
- import { S as TraitExpression, c as RawAffectedCountQuery, f as RawRowQuery, g as RawSqlInterpolation, h as RawSqlBuilder, i as CodecTypesBase, o as Expression, r as CodecExpression, s as NoReservedRowColumn, x as ScopeField, y as RawSqlTag } from "./expression-CvXfXCGs.mjs";
6
+ import { C as TraitExpression, S as StorageColumnScopeField, c as RawAffectedCountQuery, f as RawRowQuery, g as RawSqlInterpolation, h as RawSqlBuilder, i as CodecTypesBase, o as Expression, s as NoReservedRowColumn, x as ScopeField } from "./expression-Ck1wys3N-RNyviMcU.mjs";
7
+ import "./expression-DWcDQHh9.mjs";
8
+ import { a as Subquery, r as Functions, t as BooleanCodecType } from "./functions-CJ8Yf8uL.mjs";
9
+ import { c as LockOptionCapabilities, l as LockStrengthCapabilities, u as LockWaitOptions } from "./ast-Dp6lQXUX.mjs";
10
+ import { r as TableIndexReferences } from "./index-reference-CflkzYSd.mjs";
8
11
  import "./plan-_8dKi13Q.mjs";
9
12
  import { AnnotationValue, OperationKind, ValidAnnotations } from "@prisma/orm-framework/components/runtime";
10
- //#region ../../../2-sql/4-lanes/sql-builder/dist/db-DB1FVK1P.d.mts
13
+ //#region ../../../2-sql/4-lanes/sql-builder/dist/db-BmrN9nRS.d.mts
11
14
  //#region src/scope.d.ts
12
15
  type GatedMethod<Capabilities, Required, Method> = Capabilities extends Required ? Method : never;
13
16
  declare const JoinOuterScope: unique symbol;
14
- declare const SubqueryMarker: unique symbol;
15
17
  type Expand<T> = { [K in keyof T]: T[K]; } & unknown;
16
18
  type EmptyRow = Record<never, ScopeField>;
17
19
  type ScopeTable = Record<string, ScopeField>;
@@ -31,14 +33,7 @@ type DefaultScope<Name extends string, Table extends StorageTable> = {
31
33
  topLevel: StorageTableToScopeTable<Table>;
32
34
  namespaces: { [K in Name]: StorageTableToScopeTable<Table>; };
33
35
  };
34
- type StorageTableToScopeTable<T extends StorageTable> = { [K in keyof T['columns']]: {
35
- codecId: T['columns'][K]['codecId'];
36
- nullable: T['columns'][K]['nullable'];
37
- } & (T['columns'][K] extends {
38
- many: true;
39
- } ? {
40
- many: true;
41
- } : Record<never, never>); };
36
+ type StorageTableToScopeTable<T extends StorageTable> = { [K in keyof T['columns']]: StorageColumnScopeField<T['columns'][K]>; };
42
37
  type MergeScopes<A extends Scope, B extends Scope> = {
43
38
  topLevel: Expand<Omit<A['topLevel'], keyof B['topLevel']> & Omit<B['topLevel'], keyof A['topLevel']>>;
44
39
  namespaces: Expand<A['namespaces'] & B['namespaces']>;
@@ -55,11 +50,6 @@ type NullableScope<S extends Scope> = {
55
50
  topLevel: NullableScopeTable<S['topLevel']>;
56
51
  namespaces: { [TableName in keyof S['namespaces']]: NullableScopeTable<S['namespaces'][TableName]>; };
57
52
  };
58
- type Subquery<RowType extends Record<string, ScopeField>> = {
59
- [SubqueryMarker]: RowType;
60
- buildAst(): SelectAst;
61
- getRowFields(): Record<string, ScopeField>;
62
- };
63
53
  type QueryContext = {
64
54
  readonly codecTypes: CodecTypesBase;
65
55
  readonly capabilities: Record<string, Record<string, boolean>>;
@@ -70,10 +60,6 @@ type QueryContext = {
70
60
  };
71
61
  //#endregion
72
62
  //#region src/expression.d.ts
73
- type BooleanCodecType = {
74
- codecId: 'pg/bool@1';
75
- nullable: boolean;
76
- };
77
63
  type WithField<Source, Field extends ScopeField, Alias extends string> = Expand<Source & { [K in Alias]: Field; }>;
78
64
  type WithFields<Source, FromScope extends ScopeTable, Columns extends readonly (keyof FromScope)[]> = Expand<Source & Pick<FromScope, Columns[number]>>;
79
65
  type ExtractScopeFields<T extends Record<string, Expression<ScopeField>>> = { [K in keyof T]: T[K] extends Expression<infer F extends ScopeField> ? F : never; };
@@ -88,49 +74,6 @@ type OrderByScope<AvailableScope extends Scope, RowType extends Record<string, S
88
74
  topLevel: Expand<AvailableScope['topLevel'] & RowType>;
89
75
  namespaces: AvailableScope['namespaces'];
90
76
  };
91
- type DeriveExtFunctions<OT extends QueryOperationTypesBase> = { [K in keyof OT]: OT[K]['impl']; };
92
- type BuiltinFunctions<CT extends Record<string, {
93
- readonly input: unknown;
94
- }>> = {
95
- eq: <CodecId extends string>(a: CodecExpression<CodecId, boolean, CT> | null, b: CodecExpression<CodecId, boolean, CT> | null) => Expression<BooleanCodecType>;
96
- ne: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT> | null, b: CodecExpression<CodecId, N, CT> | null) => Expression<BooleanCodecType>;
97
- gt: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
98
- gte: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
99
- lt: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
100
- lte: <CodecId extends string, N extends boolean>(a: CodecExpression<CodecId, N, CT>, b: CodecExpression<CodecId, N, CT>) => Expression<BooleanCodecType>;
101
- and: (...ands: CodecExpression<'pg/bool@1', boolean, CT>[]) => Expression<BooleanCodecType>;
102
- or: (...ors: CodecExpression<'pg/bool@1', boolean, CT>[]) => Expression<BooleanCodecType>;
103
- exists: (subquery: Subquery<Record<string, ScopeField>>) => Expression<BooleanCodecType>;
104
- notExists: (subquery: Subquery<Record<string, ScopeField>>) => Expression<BooleanCodecType>;
105
- in: {
106
- <CodecId extends string>(expr: Expression<{
107
- codecId: CodecId;
108
- nullable: boolean;
109
- }>, subquery: Subquery<Record<string, {
110
- codecId: CodecId;
111
- nullable: boolean;
112
- }>>): Expression<BooleanCodecType>;
113
- <CodecId extends string>(expr: Expression<{
114
- codecId: CodecId;
115
- nullable: boolean;
116
- }>, values: Array<CodecExpression<CodecId, boolean, CT>>): Expression<BooleanCodecType>;
117
- };
118
- notIn: {
119
- <CodecId extends string>(expr: Expression<{
120
- codecId: CodecId;
121
- nullable: boolean;
122
- }>, subquery: Subquery<Record<string, {
123
- codecId: CodecId;
124
- nullable: boolean;
125
- }>>): Expression<BooleanCodecType>;
126
- <CodecId extends string>(expr: Expression<{
127
- codecId: CodecId;
128
- nullable: boolean;
129
- }>, values: Array<CodecExpression<CodecId, boolean, CT>>): Expression<BooleanCodecType>;
130
- };
131
- readonly raw: RawSqlTag;
132
- };
133
- type Functions<QC extends QueryContext> = BuiltinFunctions<QC['codecTypes']> & DeriveExtFunctions<QC['queryOperationTypes']>;
134
77
  /**
135
78
  * The field an aggregate produces, read from the contract's emitted aggregate map.
136
79
  *
@@ -214,39 +157,10 @@ type ResolveRow<Row extends Record<string, ScopeField>, CodecTypes extends Recor
214
157
  }>, PreResolved extends Record<string, unknown> = Record<string, never>> = Expand<{ -readonly [K in keyof Row]: string extends keyof PreResolved ? ResolveField<Row[K], CodecTypes> : K extends keyof PreResolved ? ApplyNullable<NonNullable<PreResolved[K & keyof PreResolved]>, Row[K]> : ResolveField<Row[K], CodecTypes>; }>;
215
158
  //#endregion
216
159
  //#region src/types/index-reference.d.ts
217
- /**
218
- * An index of a table as a query reads it: its columns, bound to the table's alias, its type and its options. A query operation that searches what an index covers, such as Postgres's `fullTextMatches`, takes it in place of the columns and settings the index was built with.
219
- */
220
- interface IndexReference<Columns extends Readonly<Record<string, Expression<ScopeField>>> = Readonly<Record<string, Expression<ScopeField>>>, Type extends string | undefined = string | undefined, Options extends Readonly<Record<string, unknown>> | undefined = Readonly<Record<string, unknown>> | undefined> {
221
- /** The index's columns by name, each the column of the aliased table; empty for an expression index. */
222
- readonly columns: Columns;
223
- readonly type: Type;
224
- readonly options: Options;
225
- }
226
- /** The name the contract source gave an index: the prefix of a wire name, or an exact (`map:`) name. */
227
- type AuthoredIndexName<I> = I extends {
228
- readonly prefix: infer Prefix extends string;
229
- } ? Prefix : I extends {
230
- readonly name: infer Name extends string;
231
- } ? Name : never;
232
- type IndexColumnExpressions<Fields, I> = I extends {
233
- readonly columns: infer Columns extends readonly string[];
234
- } ? { readonly [Column in Columns[number]]: Column extends keyof Fields ? Fields[Column] extends ScopeField ? Expression<Fields[Column]> : never : never; } : Record<never, never>;
235
- type IndexTypeOf<I> = I extends {
236
- readonly type: infer Type extends string;
237
- } ? Type : undefined;
238
- type IndexOptionsOf<I> = I extends {
239
- readonly options: infer Options extends Record<string, unknown>;
240
- } ? Options : undefined;
241
- /** The indexes of `I` whose authored name is `Key`. */
242
- type IndexesNamed<I, Key> = I extends unknown ? AuthoredIndexName<I> extends Key ? I : never : never;
243
- type IsUnion<T, Whole = T> = T extends unknown ? ([Whole] extends [T] ? false : true) : never;
244
160
  /**
245
161
  * A table's indexes, keyed by the name the contract source gave each: the `name:` prefix, or the `map:` name. An unnamed index, such as a derived foreign-key backing index, appears under its default prefix. A name that more than one index shares is left out, as reading it is refused at runtime.
246
162
  */
247
- type IndexReferences<C extends TableProxyContract, NsId extends string, Name extends string, Table = NamespaceTable<C, NsId, Name>, Fields = StorageTableToScopeTable<NamespaceTable<C, NsId, Name>>> = Table extends {
248
- readonly indexes: readonly (infer I)[];
249
- } ? { readonly [Key in AuthoredIndexName<I> as true extends IsUnion<IndexesNamed<I, Key>> ? never : Key]: IndexReference<IndexColumnExpressions<Fields, IndexesNamed<I, Key>>, IndexTypeOf<IndexesNamed<I, Key>>, IndexOptionsOf<IndexesNamed<I, Key>>>; } : never;
163
+ type IndexReferences<C extends TableProxyContract, NsId extends string, Name extends string> = TableIndexReferences<NamespaceTable<C, NsId, Name>>;
250
164
  //#endregion
251
165
  //#region src/types/mutation-query.d.ts
252
166
  type ReturningCapability = {
@@ -615,5 +529,5 @@ type Namespace<C extends TableProxyContract, NsId extends string & keyof C['stor
615
529
  */
616
530
  type Db<C extends TableProxyContract> = { readonly [Ns in keyof C['storage']['namespaces'] & string]: Namespace<C, Ns>; };
617
531
  //#endregion
618
- export { TableProxy as C, WhereFilter as D, UpdateQuery as E, TableNamesAcrossNamespaces as S, UnboundTables as T, ResolveRow as _, DeleteQuery as a, Subquery as b, GatedMethod as c, IndexReferences as d, InsertQuery as f, RawTagFor as g, RawLane as h, Db as i, GroupedQuery as l, QueryContext as m, BooleanCodecType as n, FieldProxy as o, Namespace as p, ContractRawTag as r, Functions as s, AggregateFunctions as t, IndexReference as u, Scope as v, TableProxyContract as w, TableInAnyNamespace as x, SelectQuery as y };
619
- //# sourceMappingURL=db-DB1FVK1P-DbwoL7vg.d.mts.map
532
+ export { WhereFilter as C, UpdateQuery as S, TableInAnyNamespace as _, FieldProxy as a, TableProxyContract as b, IndexReferences as c, QueryContext as d, RawLane as f, SelectQuery as g, Scope as h, DeleteQuery as i, InsertQuery as l, ResolveRow as m, ContractRawTag as n, GatedMethod as o, RawTagFor as p, Db as r, GroupedQuery as s, AggregateFunctions as t, Namespace as u, TableNamesAcrossNamespaces as v, UnboundTables as x, TableProxy as y };
533
+ //# sourceMappingURL=db-BmrN9nRS-DEogPltL.d.mts.map