@prisma-next/sql-builder 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{db-DkZcNekS.d.mts → db-BDDDtxLg.d.mts} +39 -1
- package/dist/db-BDDDtxLg.d.mts.map +1 -0
- package/dist/exports/types.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.mjs +117 -15
- package/dist/runtime/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/runtime/builder-base.ts +21 -1
- package/src/runtime/mutation-impl.ts +116 -0
- package/src/runtime/query-impl.ts +38 -0
- package/src/types/grouped-query.ts +17 -0
- package/src/types/mutation-query.ts +30 -0
- package/src/types/select-query.ts +17 -0
- package/dist/db-DkZcNekS.d.mts.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnyFromSource, SelectAst } from "@prisma-next/sql-relational-core/ast";
|
|
2
2
|
import { CodecExpression, Expression as Expression$1, ScopeField } from "@prisma-next/sql-relational-core/expression";
|
|
3
|
+
import { AnnotationValue, OperationKind, ValidAnnotations } from "@prisma-next/framework-components/runtime";
|
|
3
4
|
import { ExtractCodecTypes, ExtractFieldInputTypes, ExtractFieldOutputTypes, ExtractQueryOperationTypes, QueryOperationTypesBase, StorageTable, StorageTable as StorageTable$1 } from "@prisma-next/sql-contract/types";
|
|
4
5
|
import { SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
|
|
5
6
|
|
|
@@ -168,15 +169,34 @@ type InsertValues<Table extends StorageTable, CT extends Record<string, {
|
|
|
168
169
|
readonly input: unknown;
|
|
169
170
|
}>> = { [K in keyof Table['columns']]?: Table['columns'][K]['codecId'] extends keyof CT ? CT[Table['columns'][K]['codecId']]['input'] : unknown };
|
|
170
171
|
interface InsertQuery<QC extends QueryContext, AvailableScope extends Scope, RowType extends Record<string, ScopeField>> {
|
|
172
|
+
/**
|
|
173
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
174
|
+
* Annotations declare `applicableTo: ['write']` (or `['read', 'write']`)
|
|
175
|
+
* via `defineAnnotation`; read-only annotations fail to compile here.
|
|
176
|
+
* Annotations are merged into `plan.meta.annotations` at `.build()` time.
|
|
177
|
+
* Chainable in any position; multiple calls compose with last-write-wins
|
|
178
|
+
* on duplicate namespaces.
|
|
179
|
+
*/
|
|
180
|
+
annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(...annotations: As & ValidAnnotations<'write', As>): InsertQuery<QC, AvailableScope, RowType>;
|
|
171
181
|
returning: GatedMethod<QC['capabilities'], ReturningCapability, <Columns extends (keyof AvailableScope['topLevel'] & string)[]>(...columns: Columns) => InsertQuery<QC, AvailableScope, WithFields<EmptyRow, AvailableScope['topLevel'], Columns>>>;
|
|
172
182
|
build(): SqlQueryPlan<ResolveRow<RowType, QC['codecTypes'], QC['resolvedColumnOutputTypes']>>;
|
|
173
183
|
}
|
|
174
184
|
interface UpdateQuery<QC extends QueryContext, AvailableScope extends Scope, RowType extends Record<string, ScopeField>> {
|
|
185
|
+
/**
|
|
186
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
187
|
+
* See `InsertQuery.annotate` for semantics.
|
|
188
|
+
*/
|
|
189
|
+
annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(...annotations: As & ValidAnnotations<'write', As>): UpdateQuery<QC, AvailableScope, RowType>;
|
|
175
190
|
where(expr: ExpressionBuilder<AvailableScope, QC>): UpdateQuery<QC, AvailableScope, RowType>;
|
|
176
191
|
returning: GatedMethod<QC['capabilities'], ReturningCapability, <Columns extends (keyof AvailableScope['topLevel'] & string)[]>(...columns: Columns) => UpdateQuery<QC, AvailableScope, WithFields<EmptyRow, AvailableScope['topLevel'], Columns>>>;
|
|
177
192
|
build(): SqlQueryPlan<ResolveRow<RowType, QC['codecTypes'], QC['resolvedColumnOutputTypes']>>;
|
|
178
193
|
}
|
|
179
194
|
interface DeleteQuery<QC extends QueryContext, AvailableScope extends Scope, RowType extends Record<string, ScopeField>> {
|
|
195
|
+
/**
|
|
196
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
197
|
+
* See `InsertQuery.annotate` for semantics.
|
|
198
|
+
*/
|
|
199
|
+
annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(...annotations: As & ValidAnnotations<'write', As>): DeleteQuery<QC, AvailableScope, RowType>;
|
|
180
200
|
where(expr: ExpressionBuilder<AvailableScope, QC>): DeleteQuery<QC, AvailableScope, RowType>;
|
|
181
201
|
returning: GatedMethod<QC['capabilities'], ReturningCapability, <Columns extends (keyof AvailableScope['topLevel'] & string)[]>(...columns: Columns) => DeleteQuery<QC, AvailableScope, WithFields<EmptyRow, AvailableScope['topLevel'], Columns>>>;
|
|
182
202
|
build(): SqlQueryPlan<ResolveRow<RowType, QC['codecTypes'], QC['resolvedColumnOutputTypes']>>;
|
|
@@ -187,6 +207,15 @@ interface JoinedTables<QC extends QueryContext, AvailableScope extends Scope> ex
|
|
|
187
207
|
//#endregion
|
|
188
208
|
//#region src/types/grouped-query.d.ts
|
|
189
209
|
interface GroupedQuery<QC extends QueryContext, AvailableScope extends Scope, RowType extends Record<string, ScopeField>> extends Subquery<RowType>, WithPagination, WithDistinct, WithAlias<RowType>, WithBuild<QC, RowType> {
|
|
210
|
+
/**
|
|
211
|
+
* Attach one or more read-typed annotations to this query plan.
|
|
212
|
+
* Annotations declare `applicableTo: ['read']` (or `['read', 'write']`)
|
|
213
|
+
* via `defineAnnotation`; write-only annotations fail to compile here.
|
|
214
|
+
* Annotations are merged into `plan.meta.annotations` at `.build()` time.
|
|
215
|
+
* Chainable in any position; multiple calls compose with last-write-wins
|
|
216
|
+
* on duplicate namespaces.
|
|
217
|
+
*/
|
|
218
|
+
annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(...annotations: As & ValidAnnotations<'read', As>): GroupedQuery<QC, AvailableScope, RowType>;
|
|
190
219
|
groupBy(...fields: ((keyof RowType | keyof AvailableScope['topLevel']) & string)[]): GroupedQuery<QC, AvailableScope, RowType>;
|
|
191
220
|
groupBy(expr: (fields: FieldProxy<OrderByScope<AvailableScope, RowType>>, fns: Functions<QC>) => Expression$1<ScopeField>): GroupedQuery<QC, AvailableScope, RowType>;
|
|
192
221
|
having(expr: (fields: FieldProxy<OrderByScope<AvailableScope, RowType>>, fns: AggregateFunctions<QC>) => Expression$1<BooleanCodecType>): GroupedQuery<QC, AvailableScope, RowType>;
|
|
@@ -204,6 +233,15 @@ interface GroupedQuery<QC extends QueryContext, AvailableScope extends Scope, Ro
|
|
|
204
233
|
//#endregion
|
|
205
234
|
//#region src/types/select-query.d.ts
|
|
206
235
|
interface SelectQuery<QC extends QueryContext, AvailableScope extends Scope, RowType extends Record<string, ScopeField>> extends Subquery<RowType>, WithSelect<QC, AvailableScope, RowType>, WithPagination, WithDistinct, WithAlias<RowType>, WithBuild<QC, RowType> {
|
|
236
|
+
/**
|
|
237
|
+
* Attach one or more read-typed annotations to this query plan.
|
|
238
|
+
* Annotations declare `applicableTo: ['read']` (or `['read', 'write']`)
|
|
239
|
+
* via `defineAnnotation`; write-only annotations fail to compile here.
|
|
240
|
+
* Annotations are merged into `plan.meta.annotations` at `.build()` time.
|
|
241
|
+
* Chainable in any position; multiple calls compose with last-write-wins
|
|
242
|
+
* on duplicate namespaces.
|
|
243
|
+
*/
|
|
244
|
+
annotate<As extends readonly AnnotationValue<unknown, OperationKind>[]>(...annotations: As & ValidAnnotations<'read', As>): SelectQuery<QC, AvailableScope, RowType>;
|
|
207
245
|
where(expr: ExpressionBuilder<AvailableScope, QC>): SelectQuery<QC, AvailableScope, RowType>;
|
|
208
246
|
orderBy(field: (keyof RowType | keyof AvailableScope['topLevel']) & string, options?: OrderByOptions): SelectQuery<QC, AvailableScope, RowType>;
|
|
209
247
|
orderBy(expr: (fields: FieldProxy<OrderByScope<AvailableScope, RowType>>, fns: Functions<QC>) => Expression$1<ScopeField>, options?: OrderByOptions): SelectQuery<QC, AvailableScope, RowType>;
|
|
@@ -316,4 +354,4 @@ type TableProxyContract = {
|
|
|
316
354
|
type Db<C extends TableProxyContract> = { [Name in string & keyof C['storage']['tables']]: TableProxy<C, Name> };
|
|
317
355
|
//#endregion
|
|
318
356
|
export { ScopeField as _, GroupedQuery as a, UpdateQuery as c, Expression$1 as d, FieldProxy as f, Scope as g, QueryContext as h, SelectQuery as i, ResolveRow as l, GatedMethod as m, TableProxyContract as n, DeleteQuery as o, Functions as p, TableProxy as r, InsertQuery as s, Db as t, AggregateFunctions as u, Subquery as v };
|
|
319
|
-
//# sourceMappingURL=db-
|
|
357
|
+
//# sourceMappingURL=db-BDDDtxLg.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-BDDDtxLg.d.mts","names":[],"sources":["../src/scope.ts","../src/expression.ts","../src/resolve.ts","../src/types/mutation-query.ts","../src/types/joined-tables.ts","../src/types/grouped-query.ts","../src/types/select-query.ts","../src/types/shared.ts","../src/types/table-proxy.ts","../src/types/db.ts"],"mappings":";;;;;;;KAMY,cAAA,GAAiB,MAAA;EAAA,SAA0B,KAAA;EAAA,SAAyB,MAAA;AAAA;AAAA,KAKpE,WAAA,mCAA8C,YAAA,SAAqB,QAAA,GAC3E,MAAA;AAAA,cAGiB,cAAA;AAAA,cACA,cAAA;AAAA,KAET,MAAA,oBAA0B,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KAChC,QAAA,GAAW,MAAA,QAAc,UAAA;AAAA,KAEzB,UAAA,GAAa,MAAA,SAAe,UAAA;AAAA,KAE5B,KAAA;EACV,QAAA,EAAU,UAAA;EACV,UAAA,EAAY,MAAA,SAAe,UAAA;AAAA;AAAA,KAGjB,UAAA,aAAuB,UAAA;EAAA,UACvB,cAAA;IACR,QAAA,EAAU,GAAA;IACV,UAAA,EAAY,MAAA,CAAO,KAAA,EAAO,GAAA;EAAA;EAG5B,iBAAA,IAAqB,KAAA;EACrB,QAAA,IAAY,aAAA;AAAA;AAAA,KA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W,CAAA,EAAG,IAAA,EAAM,QAAA,EAAU,WAAA,CAAY,cAAA,EAAgB,KAAA,EAAO,QAAA;EAEpE,MAAA,CACE,MAAA,EAAQ,oBAAA,CACN,CAAA,EACA,CAAA,sBAAuB,IAAA,GACvB,IAAA,EACA,EAAA,gBACA,sBAAA,CAAuB,CAAA,KAExB,WAAA,CAAY,EAAA,EAAI,cAAA,EAAgB,QAAA;EAEnC,MAAA,CACE,GAAA,EAAK,oBAAA,CACH,CAAA,EACA,CAAA,sBAAuB,IAAA,GACvB,IAAA,EACA,EAAA,gBACA,sBAAA,CAAuB,CAAA,KAExB,WAAA,CAAY,EAAA,EAAI,cAAA,EAAgB,QAAA;EAEnC,MAAA,IAAU,WAAA,CAAY,EAAA,EAAI,cAAA,EAAgB,QAAA;AAAA;;;KCtJhC,gBAAA,GAAmB,MAAA,SAAe,MAAA;AAAA,KAElC,kBAAA;EAAA,SACD,OAAA;IAAA,SAAoB,MAAA,EAAQ,MAAA,SAAe,YAAA;EAAA;EAAA,SAC3C,YAAA,EAAc,gBAAA;AAAA;AAAA,KAGb,EAAA,WAAa,kBAAA,8BACC,CAAA,wBAAyB,UAAA,CAAW,CAAA,EAAG,IAAA"}
|
package/dist/exports/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as ScopeField, a as GroupedQuery, c as UpdateQuery, d as Expression, g as Scope, h as QueryContext, i as SelectQuery, l as ResolveRow, m as GatedMethod, n as TableProxyContract, o as DeleteQuery, p as Functions, r as TableProxy, s as InsertQuery, t as Db, u as AggregateFunctions, v as Subquery } from "../db-
|
|
1
|
+
import { _ as ScopeField, a as GroupedQuery, c as UpdateQuery, d as Expression, g as Scope, h as QueryContext, i as SelectQuery, l as ResolveRow, m as GatedMethod, n as TableProxyContract, o as DeleteQuery, p as Functions, r as TableProxy, s as InsertQuery, t as Db, u as AggregateFunctions, v as Subquery } from "../db-BDDDtxLg.mjs";
|
|
2
2
|
export { type AggregateFunctions, type Db, type DeleteQuery, type Expression, type Functions, type GatedMethod, type GroupedQuery, type InsertQuery, type QueryContext, type ResolveRow, type Scope, type ScopeField, type SelectQuery, type Subquery, type TableProxy, type TableProxyContract, type UpdateQuery };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as ScopeField, a as GroupedQuery, c as UpdateQuery, d as Expression, g as Scope, h as QueryContext, i as SelectQuery, l as ResolveRow, m as GatedMethod, o as DeleteQuery, p as Functions, r as TableProxy, s as InsertQuery, t as Db, u as AggregateFunctions, v as Subquery } from "./db-
|
|
1
|
+
import { _ as ScopeField, a as GroupedQuery, c as UpdateQuery, d as Expression, g as Scope, h as QueryContext, i as SelectQuery, l as ResolveRow, m as GatedMethod, o as DeleteQuery, p as Functions, r as TableProxy, s as InsertQuery, t as Db, u as AggregateFunctions, v as Subquery } from "./db-BDDDtxLg.mjs";
|
|
2
2
|
export { type AggregateFunctions, type Db, type DeleteQuery, type Expression, type Functions, type GatedMethod, type GroupedQuery, type InsertQuery, type QueryContext, type ResolveRow, type Scope, type ScopeField, type SelectQuery, type Subquery, type TableProxy, type UpdateQuery };
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as ScopeField, f as FieldProxy, g as Scope, h as QueryContext, p as Functions, t as Db, u as AggregateFunctions } from "../db-
|
|
1
|
+
import { _ as ScopeField, f as FieldProxy, g as Scope, h as QueryContext, p as Functions, t as Db, u as AggregateFunctions } from "../db-BDDDtxLg.mjs";
|
|
2
2
|
import { AnyExpression } from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
import { Expression } from "@prisma-next/sql-relational-core/expression";
|
|
4
4
|
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DeleteAst, DerivedTableSource, ExistsExpr, IdentifierRef, InsertAst, JoinAst, ListExpression, LiteralExpr, NullCheckExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SelectAst, SubqueryExpr, TableSource, UpdateAst, collectOrderedParamRefs } from "@prisma-next/sql-relational-core/ast";
|
|
2
2
|
import { codecOf, toExpr } from "@prisma-next/sql-relational-core/expression";
|
|
3
3
|
import { codecRefForStorageColumn } from "@prisma-next/sql-relational-core/codec-descriptor-registry";
|
|
4
|
+
import { assertAnnotationsApplicable } from "@prisma-next/framework-components/runtime";
|
|
4
5
|
//#region src/runtime/expression-impl.ts
|
|
5
6
|
/**
|
|
6
7
|
* 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.
|
|
@@ -156,6 +157,33 @@ function createAggregateFunctions(operations) {
|
|
|
156
157
|
} });
|
|
157
158
|
}
|
|
158
159
|
//#endregion
|
|
160
|
+
//#region ../../../1-framework/0-foundation/utils/dist/defined-BYcWqtXq.mjs
|
|
161
|
+
/**
|
|
162
|
+
* Returns an object with the key/value if value is defined, otherwise an empty object.
|
|
163
|
+
*
|
|
164
|
+
* Use with spread to conditionally include optional properties while satisfying
|
|
165
|
+
* exactOptionalPropertyTypes. This is explicit about which properties are optional
|
|
166
|
+
* and won't inadvertently strip other undefined values.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // Instead of:
|
|
171
|
+
* const obj = {
|
|
172
|
+
* required: 'value',
|
|
173
|
+
* ...(optional ? { optional } : {}),
|
|
174
|
+
* };
|
|
175
|
+
*
|
|
176
|
+
* // Use:
|
|
177
|
+
* const obj = {
|
|
178
|
+
* required: 'value',
|
|
179
|
+
* ...ifDefined('optional', optional),
|
|
180
|
+
* };
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
function ifDefined(key, value) {
|
|
184
|
+
return value !== void 0 ? { [key]: value } : {};
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
159
187
|
//#region src/runtime/builder-base.ts
|
|
160
188
|
var BuilderBase = class {
|
|
161
189
|
ctx;
|
|
@@ -190,7 +218,8 @@ function emptyState(from, scope) {
|
|
|
190
218
|
distinct: void 0,
|
|
191
219
|
distinctOn: void 0,
|
|
192
220
|
scope,
|
|
193
|
-
rowFields: {}
|
|
221
|
+
rowFields: {},
|
|
222
|
+
annotations: /* @__PURE__ */ new Map()
|
|
194
223
|
};
|
|
195
224
|
}
|
|
196
225
|
function cloneState(state, overrides) {
|
|
@@ -221,12 +250,14 @@ function buildSelectAst(state) {
|
|
|
221
250
|
selectAllIntent: void 0
|
|
222
251
|
});
|
|
223
252
|
}
|
|
224
|
-
function buildQueryPlan(ast, ctx) {
|
|
253
|
+
function buildQueryPlan(ast, ctx, annotations) {
|
|
225
254
|
const paramValues = collectOrderedParamRefs(ast).map((r) => r.value);
|
|
255
|
+
const annotationsRecord = annotations !== void 0 && annotations.size > 0 ? Object.freeze(Object.fromEntries(annotations)) : void 0;
|
|
226
256
|
const meta = Object.freeze({
|
|
227
257
|
target: ctx.target,
|
|
228
258
|
storageHash: ctx.storageHash,
|
|
229
|
-
lane: "dsl"
|
|
259
|
+
lane: "dsl",
|
|
260
|
+
...ifDefined("annotations", annotationsRecord)
|
|
230
261
|
});
|
|
231
262
|
return Object.freeze({
|
|
232
263
|
ast,
|
|
@@ -235,7 +266,7 @@ function buildQueryPlan(ast, ctx) {
|
|
|
235
266
|
});
|
|
236
267
|
}
|
|
237
268
|
function buildPlan(state, ctx) {
|
|
238
|
-
return buildQueryPlan(buildSelectAst(state), ctx);
|
|
269
|
+
return buildQueryPlan(buildSelectAst(state), ctx, state.annotations);
|
|
239
270
|
}
|
|
240
271
|
function tableToScope(alias, table, options) {
|
|
241
272
|
const storage = options?.storage;
|
|
@@ -406,6 +437,29 @@ var QueryBase = class extends BuilderBase {
|
|
|
406
437
|
distinct() {
|
|
407
438
|
return this.clone(cloneState(this.state, { distinct: true }));
|
|
408
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Attach one or more annotations to this query plan.
|
|
442
|
+
*
|
|
443
|
+
* Read builders (`SelectQueryImpl`, `GroupedQueryImpl`) accept
|
|
444
|
+
* annotations whose declared `applicableTo` includes `'read'`.
|
|
445
|
+
* The type-level `As & ValidAnnotations<'read', As>` gate rejects
|
|
446
|
+
* write-only annotations at the call site; the runtime check below
|
|
447
|
+
* fails closed for callers that bypass the type gate (cast / `any`).
|
|
448
|
+
*
|
|
449
|
+
* Multiple `.annotate(...)` calls compose; duplicate namespaces use
|
|
450
|
+
* last-write-wins. The accumulated annotations are merged into
|
|
451
|
+
* `plan.meta.annotations` at `.build()` time, alongside any framework-
|
|
452
|
+
* internal metadata under reserved namespaces (e.g. `codecs`).
|
|
453
|
+
*
|
|
454
|
+
* Chainable in any position (before / after `.where`, `.select`,
|
|
455
|
+
* `.limit`, etc.); the returned builder has the same row type.
|
|
456
|
+
*/
|
|
457
|
+
annotate(...annotations) {
|
|
458
|
+
assertAnnotationsApplicable(annotations, "read", "sql-dsl.annotate");
|
|
459
|
+
const next = new Map(this.state.annotations);
|
|
460
|
+
for (const annotation of annotations) next.set(annotation.namespace, annotation);
|
|
461
|
+
return this.clone(cloneState(this.state, { annotations: next }));
|
|
462
|
+
}
|
|
409
463
|
groupBy(...args) {
|
|
410
464
|
const exprs = resolveGroupBy(args, this.state.scope, this.state.rowFields, this.ctx);
|
|
411
465
|
return new GroupedQueryImpl(cloneState(this.state, { groupBy: [...this.state.groupBy, ...exprs] }), this.ctx);
|
|
@@ -549,6 +603,23 @@ var JoinedTablesImpl = class JoinedTablesImpl extends BuilderBase {
|
|
|
549
603
|
};
|
|
550
604
|
//#endregion
|
|
551
605
|
//#region src/runtime/mutation-impl.ts
|
|
606
|
+
/**
|
|
607
|
+
* Validates and merges a variadic annotations call into a builder's
|
|
608
|
+
* accumulated user-annotations map. Used by `.annotate(...)` on each of
|
|
609
|
+
* the three mutation builders (`InsertQueryImpl`, `UpdateQueryImpl`,
|
|
610
|
+
* `DeleteQueryImpl`); the read builders share the same logic via
|
|
611
|
+
* `QueryBase.annotate()` in `./query-impl.ts`.
|
|
612
|
+
*
|
|
613
|
+
* Runs `assertAnnotationsApplicable` at call time (not at `.build()`) so
|
|
614
|
+
* inapplicable annotations forced through casts surface immediately
|
|
615
|
+
* rather than at plan-construction time.
|
|
616
|
+
*/
|
|
617
|
+
function mergeWriteAnnotations(current, annotations) {
|
|
618
|
+
assertAnnotationsApplicable(annotations, "write", "sql-dsl.annotate");
|
|
619
|
+
const next = new Map(current);
|
|
620
|
+
for (const annotation of annotations) next.set(annotation.namespace, annotation);
|
|
621
|
+
return next;
|
|
622
|
+
}
|
|
552
623
|
function buildParamValues(values, table, tableName, op, ctx) {
|
|
553
624
|
const params = {};
|
|
554
625
|
for (const [col, value] of Object.entries(values)) {
|
|
@@ -578,7 +649,8 @@ var InsertQueryImpl = class InsertQueryImpl extends BuilderBase {
|
|
|
578
649
|
#values;
|
|
579
650
|
#returningColumns;
|
|
580
651
|
#rowFields;
|
|
581
|
-
|
|
652
|
+
#annotations;
|
|
653
|
+
constructor(tableName, table, scope, values, ctx, returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {
|
|
582
654
|
super(ctx);
|
|
583
655
|
this.#tableName = tableName;
|
|
584
656
|
this.#table = table;
|
|
@@ -586,6 +658,7 @@ var InsertQueryImpl = class InsertQueryImpl extends BuilderBase {
|
|
|
586
658
|
this.#values = values;
|
|
587
659
|
this.#returningColumns = returningColumns;
|
|
588
660
|
this.#rowFields = rowFields;
|
|
661
|
+
this.#annotations = annotations;
|
|
589
662
|
}
|
|
590
663
|
returning = this._gate({ sql: { returning: true } }, "returning", (...columns) => {
|
|
591
664
|
const newRowFields = {};
|
|
@@ -594,13 +667,23 @@ var InsertQueryImpl = class InsertQueryImpl extends BuilderBase {
|
|
|
594
667
|
if (!field) throw new Error(`Column "${col}" not found in scope`);
|
|
595
668
|
newRowFields[col] = field;
|
|
596
669
|
}
|
|
597
|
-
return new InsertQueryImpl(this.#tableName, this.#table, this.#scope, this.#values, this.ctx, columns, newRowFields);
|
|
670
|
+
return new InsertQueryImpl(this.#tableName, this.#table, this.#scope, this.#values, this.ctx, columns, newRowFields, this.#annotations);
|
|
598
671
|
});
|
|
672
|
+
/**
|
|
673
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
674
|
+
* The type-level `As & ValidAnnotations<'write', As>` gate rejects
|
|
675
|
+
* read-only annotations at the call site; the runtime check fails
|
|
676
|
+
* closed for callers that bypass the type gate. See `QueryBase.annotate`
|
|
677
|
+
* in `./query-impl.ts` for the read-builder counterpart.
|
|
678
|
+
*/
|
|
679
|
+
annotate(...annotations) {
|
|
680
|
+
return new InsertQueryImpl(this.#tableName, this.#table, this.#scope, this.#values, this.ctx, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));
|
|
681
|
+
}
|
|
599
682
|
build() {
|
|
600
683
|
const paramValues = buildParamValues(this.#values, this.#table, this.#tableName, "create", this.ctx);
|
|
601
684
|
let ast = InsertAst.into(TableSource.named(this.#tableName)).withValues(paramValues);
|
|
602
685
|
if (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));
|
|
603
|
-
return buildQueryPlan(ast, this.ctx);
|
|
686
|
+
return buildQueryPlan(ast, this.ctx, this.#annotations);
|
|
604
687
|
}
|
|
605
688
|
};
|
|
606
689
|
var UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {
|
|
@@ -611,7 +694,8 @@ var UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {
|
|
|
611
694
|
#whereCallbacks;
|
|
612
695
|
#returningColumns;
|
|
613
696
|
#rowFields;
|
|
614
|
-
|
|
697
|
+
#annotations;
|
|
698
|
+
constructor(tableName, table, scope, setValues, ctx, whereCallbacks = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {
|
|
615
699
|
super(ctx);
|
|
616
700
|
this.#tableName = tableName;
|
|
617
701
|
this.#table = table;
|
|
@@ -620,9 +704,10 @@ var UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {
|
|
|
620
704
|
this.#whereCallbacks = whereCallbacks;
|
|
621
705
|
this.#returningColumns = returningColumns;
|
|
622
706
|
this.#rowFields = rowFields;
|
|
707
|
+
this.#annotations = annotations;
|
|
623
708
|
}
|
|
624
709
|
where(expr) {
|
|
625
|
-
return new UpdateQueryImpl(this.#tableName, this.#table, this.#scope, this.#setValues, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields);
|
|
710
|
+
return new UpdateQueryImpl(this.#tableName, this.#table, this.#scope, this.#setValues, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields, this.#annotations);
|
|
626
711
|
}
|
|
627
712
|
returning = this._gate({ sql: { returning: true } }, "returning", (...columns) => {
|
|
628
713
|
const newRowFields = {};
|
|
@@ -631,14 +716,22 @@ var UpdateQueryImpl = class UpdateQueryImpl extends BuilderBase {
|
|
|
631
716
|
if (!field) throw new Error(`Column "${col}" not found in scope`);
|
|
632
717
|
newRowFields[col] = field;
|
|
633
718
|
}
|
|
634
|
-
return new UpdateQueryImpl(this.#tableName, this.#table, this.#scope, this.#setValues, this.ctx, this.#whereCallbacks, columns, newRowFields);
|
|
719
|
+
return new UpdateQueryImpl(this.#tableName, this.#table, this.#scope, this.#setValues, this.ctx, this.#whereCallbacks, columns, newRowFields, this.#annotations);
|
|
635
720
|
});
|
|
721
|
+
/**
|
|
722
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
723
|
+
* See `InsertQueryImpl.annotate` for semantics; the runtime check
|
|
724
|
+
* fails closed for callers that bypass the type-level gate.
|
|
725
|
+
*/
|
|
726
|
+
annotate(...annotations) {
|
|
727
|
+
return new UpdateQueryImpl(this.#tableName, this.#table, this.#scope, this.#setValues, this.ctx, this.#whereCallbacks, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));
|
|
728
|
+
}
|
|
636
729
|
build() {
|
|
637
730
|
const setParams = buildParamValues(this.#setValues, this.#table, this.#tableName, "update", this.ctx);
|
|
638
731
|
const whereExpr = combineWhereExprs(this.#whereCallbacks.map((cb) => evaluateWhere(cb, this.#scope, this.ctx.queryOperationTypes)));
|
|
639
732
|
let ast = UpdateAst.table(TableSource.named(this.#tableName)).withSet(setParams).withWhere(whereExpr);
|
|
640
733
|
if (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));
|
|
641
|
-
return buildQueryPlan(ast, this.ctx);
|
|
734
|
+
return buildQueryPlan(ast, this.ctx, this.#annotations);
|
|
642
735
|
}
|
|
643
736
|
};
|
|
644
737
|
var DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {
|
|
@@ -647,16 +740,18 @@ var DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {
|
|
|
647
740
|
#whereCallbacks;
|
|
648
741
|
#returningColumns;
|
|
649
742
|
#rowFields;
|
|
650
|
-
|
|
743
|
+
#annotations;
|
|
744
|
+
constructor(tableName, scope, ctx, whereCallbacks = [], returningColumns = [], rowFields = {}, annotations = /* @__PURE__ */ new Map()) {
|
|
651
745
|
super(ctx);
|
|
652
746
|
this.#tableName = tableName;
|
|
653
747
|
this.#scope = scope;
|
|
654
748
|
this.#whereCallbacks = whereCallbacks;
|
|
655
749
|
this.#returningColumns = returningColumns;
|
|
656
750
|
this.#rowFields = rowFields;
|
|
751
|
+
this.#annotations = annotations;
|
|
657
752
|
}
|
|
658
753
|
where(expr) {
|
|
659
|
-
return new DeleteQueryImpl(this.#tableName, this.#scope, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields);
|
|
754
|
+
return new DeleteQueryImpl(this.#tableName, this.#scope, this.ctx, [...this.#whereCallbacks, expr], this.#returningColumns, this.#rowFields, this.#annotations);
|
|
660
755
|
}
|
|
661
756
|
returning = this._gate({ sql: { returning: true } }, "returning", (...columns) => {
|
|
662
757
|
const newRowFields = {};
|
|
@@ -665,13 +760,20 @@ var DeleteQueryImpl = class DeleteQueryImpl extends BuilderBase {
|
|
|
665
760
|
if (!field) throw new Error(`Column "${col}" not found in scope`);
|
|
666
761
|
newRowFields[col] = field;
|
|
667
762
|
}
|
|
668
|
-
return new DeleteQueryImpl(this.#tableName, this.#scope, this.ctx, this.#whereCallbacks, columns, newRowFields);
|
|
763
|
+
return new DeleteQueryImpl(this.#tableName, this.#scope, this.ctx, this.#whereCallbacks, columns, newRowFields, this.#annotations);
|
|
669
764
|
});
|
|
765
|
+
/**
|
|
766
|
+
* Attach one or more write-typed annotations to this query plan.
|
|
767
|
+
* See `InsertQueryImpl.annotate` for semantics.
|
|
768
|
+
*/
|
|
769
|
+
annotate(...annotations) {
|
|
770
|
+
return new DeleteQueryImpl(this.#tableName, this.#scope, this.ctx, this.#whereCallbacks, this.#returningColumns, this.#rowFields, mergeWriteAnnotations(this.#annotations, annotations));
|
|
771
|
+
}
|
|
670
772
|
build() {
|
|
671
773
|
const whereExpr = combineWhereExprs(this.#whereCallbacks.map((cb) => evaluateWhere(cb, this.#scope, this.ctx.queryOperationTypes)));
|
|
672
774
|
let ast = DeleteAst.from(TableSource.named(this.#tableName)).withWhere(whereExpr);
|
|
673
775
|
if (this.#returningColumns.length > 0) ast = ast.withReturning(buildReturningProjections(this.#tableName, this.#returningColumns, this.#rowFields));
|
|
674
|
-
return buildQueryPlan(ast, this.ctx);
|
|
776
|
+
return buildQueryPlan(ast, this.ctx, this.#annotations);
|
|
675
777
|
}
|
|
676
778
|
};
|
|
677
779
|
//#endregion
|