joist-core 2.3.0-next.76 → 2.3.0-next.78
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/build/index.cjs +1 -0
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +2 -2
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +2 -2
- package/build/index.d.mts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/query.cjs +237 -15
- package/build/query.cjs.map +1 -1
- package/build/query.d.cts +115 -6
- package/build/query.d.cts.map +1 -1
- package/build/query.d.mts +115 -6
- package/build/query.d.mts.map +1 -1
- package/build/query.js +237 -16
- package/build/query.js.map +1 -1
- package/package.json +2 -2
package/build/query.d.cts
CHANGED
|
@@ -96,6 +96,20 @@ type QuerySource = {
|
|
|
96
96
|
*/
|
|
97
97
|
type QueryJoin = InnerJoin<QuerySource, QueryCondition> | LeftJoin<QuerySource, QueryCondition>;
|
|
98
98
|
type QueryJoins = readonly (QueryJoin | undefined)[];
|
|
99
|
+
/**
|
|
100
|
+
* A CTE declaration: a `query(...)` value with named columns, i.e. a POJO or set-operation select.
|
|
101
|
+
*
|
|
102
|
+
* Entity-mode and scalar `query(...)` shapes are excluded: a CTE must be a table shape, so it needs
|
|
103
|
+
* columns.
|
|
104
|
+
*/
|
|
105
|
+
type WithSource = Subquery<unknown, string>;
|
|
106
|
+
/** One CTE or an array of them; an `undefined` entry prunes, like any other clause. */
|
|
107
|
+
type WithInput = WithSource | readonly (WithSource | undefined)[];
|
|
108
|
+
/** How a recursive CTE combines its two terms: `UNION ALL` keeps every row, `UNION` drops duplicates. */
|
|
109
|
+
interface RecursiveOptions {
|
|
110
|
+
/** Defaults to `"all"`. `"distinct"` emits UNION, which stops a cyclic graph from looping forever. */
|
|
111
|
+
union?: "all" | "distinct";
|
|
112
|
+
}
|
|
99
113
|
/**
|
|
100
114
|
* An expression order-by entry: the direction is the key and the expression is the value, unlike
|
|
101
115
|
* the keyed form's field name and `"ASC" | "DESC"` value. `never` on the other key keeps an
|
|
@@ -142,6 +156,15 @@ type QuerySelect = QuerySource | ExprLike<any> | Record<string, ExprLike<any>>;
|
|
|
142
156
|
* a standalone object use `satisfies Query` (or `satisfies Clauses` for a source-less fragment).
|
|
143
157
|
*/
|
|
144
158
|
interface Clauses<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> {
|
|
159
|
+
/**
|
|
160
|
+
* CTEs to include in a `WITH` clause, declared as `query(...)` values; either a single value or an array.
|
|
161
|
+
*
|
|
162
|
+
* I.e. `{ with: bookStats, from: a, join: [{ left: bookStats, on: ... }], select: { n: bookStats.n } }`.
|
|
163
|
+
*
|
|
164
|
+
* An `undefined` entry is ignored, and a CTE that nothing else in the query references will be pruned,
|
|
165
|
+
* the same pruning `join` gets (see "Pruning"); `pruneJoins: false` keeps every CTE.
|
|
166
|
+
*/
|
|
167
|
+
with?: WithInput;
|
|
145
168
|
join?: J;
|
|
146
169
|
/** A boolean group, an exists/notExists query, or a bare condition such as `a.age.gte(18)`. */
|
|
147
170
|
where?: QueryCondition;
|
|
@@ -163,7 +186,7 @@ interface Clauses<S extends QuerySelect = QuerySelect, J extends QueryJoins = Qu
|
|
|
163
186
|
softDeletes?: "include" | "exclude";
|
|
164
187
|
}
|
|
165
188
|
/** A whole query: `Clauses` plus its source. `query(q)` turns it into a value; `em.query(q)` runs it. */
|
|
166
|
-
interface Query<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> extends Clauses<S, J>, Partial<Record<SetOperation | MutationKey | "
|
|
189
|
+
interface Query<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> extends Clauses<S, J>, Partial<Record<SetOperation | MutationKey | "ctes", never>> {
|
|
167
190
|
from: QuerySource;
|
|
168
191
|
}
|
|
169
192
|
/**
|
|
@@ -202,11 +225,13 @@ type SetOperand = Query<Record<string, ExprLike<unknown>> | Subquery<unknown, st
|
|
|
202
225
|
* This input shape checks direction values; `CheckSetQuery` checks the inferred output keys in orderBy.
|
|
203
226
|
*/
|
|
204
227
|
type SetQuery<Operands extends readonly SetOperand[] = readonly [SetOperand, SetOperand, ...SetOperand[]]> = { [K in SetOperation]: { readonly [P in K]: Operands; } & { readonly [P in Exclude<SetOperation, K>]?: never; }; }[SetOperation] & {
|
|
228
|
+
/** CTEs for the combined query, declared once and in scope for every operand; see `Clauses.with`. */
|
|
229
|
+
readonly with?: WithInput;
|
|
205
230
|
readonly orderBy?: Readonly<Record<string, OrderByDirection | undefined>> | readonly (Readonly<Record<string, OrderByDirection | undefined>> | undefined)[];
|
|
206
231
|
readonly limit?: number;
|
|
207
232
|
readonly offset?: number;
|
|
208
233
|
readonly as?: string;
|
|
209
|
-
} & { readonly [K in "from" | "select" | "join" | "where" | "groupBy" | "having" | "distinct" | "softDeletes" | "pruneJoins" | MutationKey | "
|
|
234
|
+
} & { readonly [K in "from" | "select" | "join" | "where" | "groupBy" | "having" | "distinct" | "softDeletes" | "pruneJoins" | MutationKey | "ctes"]?: never; };
|
|
210
235
|
/**
|
|
211
236
|
* Extracts the operand collection from each possible compound root, ignoring pagination and ordering.
|
|
212
237
|
*
|
|
@@ -323,7 +348,7 @@ type CheckReadQuery<Q> = SetOperand extends Q ? unknown : Q extends readonly unk
|
|
|
323
348
|
} ? { readonly [K in keyof Q]: K extends typeof entityQueryBrand ? unknown : never; } : Q extends {
|
|
324
349
|
readonly from: unknown;
|
|
325
350
|
readonly select: unknown;
|
|
326
|
-
} ? { readonly [K in keyof Q]: K extends keyof Clauses | "from" | "as" ? unknown : never; } : { readonly [K in keyof Q]: K extends SetOperation ? Q[K] extends readonly unknown[] ? CheckReadQuery<Q[K]> : unknown : K extends "orderBy" | "limit" | "offset" | "as" ? unknown : never; };
|
|
351
|
+
} ? { readonly [K in keyof Q]: K extends keyof Clauses | "from" | "as" ? unknown : never; } : { readonly [K in keyof Q]: K extends SetOperation ? Q[K] extends readonly unknown[] ? CheckReadQuery<Q[K]> : unknown : K extends "with" | "orderBy" | "limit" | "offset" | "as" ? unknown : never; };
|
|
327
352
|
/** The type-level name of a table or subquery, i.e. `"Author"` or `"book_stats"`. */
|
|
328
353
|
type NameOf<A> = A extends {
|
|
329
354
|
readonly [tableMgmt]: {
|
|
@@ -488,6 +513,31 @@ declare function query<const Q extends SetQuery<readonly SetOperand[]>, Name ext
|
|
|
488
513
|
as?: Name;
|
|
489
514
|
}): Subquery<SetQueryRow<Q>, Name>;
|
|
490
515
|
declare function query<F extends QuerySource, S extends QuerySelect = never, J extends QueryJoins = [], Name extends string = "?">(q: QueryArg<F, S, J, Name>): QueryValue<S, J, Name>;
|
|
516
|
+
/**
|
|
517
|
+
* Declares a `WITH RECURSIVE` CTE from its two terms, and returns the CTE as a readable value.
|
|
518
|
+
*
|
|
519
|
+
* `base` is the non-recursive term, which seeds the rows and, as in PostgreSQL, supplies the CTE's
|
|
520
|
+
* columns. `step` is the recursive term: it receives the CTE itself, so it can join back to the rows
|
|
521
|
+
* found so far. The two terms are combined with UNION ALL, or UNION when `union: "distinct"` drops
|
|
522
|
+
* duplicates, which is how a cyclic graph is kept from looping forever.
|
|
523
|
+
*
|
|
524
|
+
* ```ts
|
|
525
|
+
* const [a] = tables(Author);
|
|
526
|
+
* const tree = recursiveQuery(
|
|
527
|
+
* "tree",
|
|
528
|
+
* { from: a, where: a.mentor_id.isNull(), select: { id: a.id, mentorId: a.mentor_id } },
|
|
529
|
+
* (self) => ({
|
|
530
|
+
* from: a,
|
|
531
|
+
* join: [{ inner: self, on: a.mentor_id.eq(self.id) }],
|
|
532
|
+
* select: { id: a.id, mentorId: a.mentor_id },
|
|
533
|
+
* }),
|
|
534
|
+
* );
|
|
535
|
+
* const rows = await em.query({ with: tree, from: tree, select: tree });
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* Unlike `query()`, the name is required, because the step term must name it.
|
|
539
|
+
*/
|
|
540
|
+
declare function recursiveQuery<Name extends string, F extends QuerySource, S extends QuerySelect, J extends QueryJoins>(name: Name, base: QueryArg<F, S, J, Name>, step: (self: Subquery<QueryRow<S, J>, Name>) => SetOperand, opts?: RecursiveOptions): Subquery<QueryRow<S, J>, Name>;
|
|
491
541
|
/**
|
|
492
542
|
* Builds a SQL expression from a tagged template.
|
|
493
543
|
*
|
|
@@ -3837,8 +3887,16 @@ interface QueryOutput {
|
|
|
3837
3887
|
}
|
|
3838
3888
|
/** The runtime identity of a `query(...)` value; `Ctx.aliasFor` keys on it, like a table's `TableMgmt`. */
|
|
3839
3889
|
declare class SubqueryHandle {
|
|
3840
|
-
|
|
3841
|
-
|
|
3890
|
+
#private;
|
|
3891
|
+
readonly recursive: boolean;
|
|
3892
|
+
constructor(q: AnyReadQuery, recursive?: boolean);
|
|
3893
|
+
get q(): AnyReadQuery;
|
|
3894
|
+
/**
|
|
3895
|
+
* Gives a recursive CTE its finished body. `recursiveQuery` starts the handle on its base term, so
|
|
3896
|
+
* the step term can read the CTE's columns while the body that will hold that step is still being
|
|
3897
|
+
* built. The base term supplies the CTE's columns either way, PostgreSQL's rule for a recursive WITH.
|
|
3898
|
+
*/
|
|
3899
|
+
setBody(q: AnyReadQuery): void;
|
|
3842
3900
|
get name(): string | undefined;
|
|
3843
3901
|
/** The select keys, for `select: <subquery>` and for reporting unknown columns. */
|
|
3844
3902
|
columnKeys(): string[];
|
|
@@ -3873,9 +3931,60 @@ declare class Ctx implements ExprContext {
|
|
|
3873
3931
|
readonly assigner: AliasAssigner;
|
|
3874
3932
|
private parent;
|
|
3875
3933
|
private aliases;
|
|
3934
|
+
/**
|
|
3935
|
+
* The subset of `aliases` that are CTE names. A `from`/`join` on one of these emits just the name,
|
|
3936
|
+
* i.e. `FROM book_stats`, where an ordinary `query(...)` value emits its whole body inline, i.e.
|
|
3937
|
+
* `FROM (SELECT ...) AS sq`.
|
|
3938
|
+
*/
|
|
3939
|
+
private ctes;
|
|
3940
|
+
/**
|
|
3941
|
+
* `with` entries named but not yet turned into SQL. `registerCtes` names every entry first, then
|
|
3942
|
+
* generates the bodies one at a time, so while one body is being generated the entries after it sit
|
|
3943
|
+
* here. Reading one of those is a forward reference.
|
|
3944
|
+
*/
|
|
3945
|
+
private pendingCtes;
|
|
3946
|
+
/** CTEs already read by this query's `from`/`join`, so a second read fails instead of colliding. */
|
|
3947
|
+
private usedCtes;
|
|
3948
|
+
/** The recursive CTE whose body this query is part of, if any; see `recursiveSelf`. */
|
|
3949
|
+
private ownRecursiveSelf;
|
|
3876
3950
|
readonly outerRefs: Set<string>;
|
|
3877
3951
|
constructor(assigner: AliasAssigner, parent: Ctx | undefined);
|
|
3952
|
+
/**
|
|
3953
|
+
* One handle can hold only one alias per query, so a value used twice must be told apart, not
|
|
3954
|
+
* silently collapsed into the second registration's alias.
|
|
3955
|
+
*/
|
|
3878
3956
|
register(handle: object, alias: string): void;
|
|
3957
|
+
/** Names every `with` entry up front, so a CTE reading a later sibling is reported, not inlined. */
|
|
3958
|
+
declareCte(handle: object, alias: string): void;
|
|
3959
|
+
/** Brings a pending CTE into scope, for the sources and columns that may now read it. */
|
|
3960
|
+
promoteCte(handle: object): void;
|
|
3961
|
+
/**
|
|
3962
|
+
* The CTE name for `handle`, looking in the enclosing queries too, because a CTE is in scope for the
|
|
3963
|
+
* whole statement.
|
|
3964
|
+
*
|
|
3965
|
+
* Unlike `aliasFor`, a hit in an enclosing query is not added to `outerRefs`: reading a CTE by name
|
|
3966
|
+
* is not a correlated reference, so it must not keep an enclosing join alive.
|
|
3967
|
+
*/
|
|
3968
|
+
cteAliasFor(handle: object): string | undefined;
|
|
3969
|
+
/**
|
|
3970
|
+
* The recursive CTE this query's terms belong to, inherited from the enclosing query.
|
|
3971
|
+
*
|
|
3972
|
+
* PostgreSQL requires a recursive term to reference its own CTE, so that reference is not optional
|
|
3973
|
+
* and must survive pruning, unlike an ordinary explicit join that nothing else reads.
|
|
3974
|
+
*/
|
|
3975
|
+
get recursiveSelf(): SubqueryHandle | undefined;
|
|
3976
|
+
setRecursiveSelf(handle: SubqueryHandle): void;
|
|
3977
|
+
/** Whether `handle` is a CTE with no SQL yet, i.e. itself or a later `with` entry. */
|
|
3978
|
+
isPendingCte(handle: object): boolean;
|
|
3979
|
+
/**
|
|
3980
|
+
* Fails if this query already reads `handle`. A `Ctx` maps each handle to a single alias, so two
|
|
3981
|
+
* reads of one CTE value would render as the same name, i.e. `FROM tree JOIN tree`, and neither the
|
|
3982
|
+
* SQL nor a column expression could say which one it meant. Each read needs its own `query(...)`.
|
|
3983
|
+
*
|
|
3984
|
+
* Only this query is checked, not the enclosing ones: a nested subquery has its own FROM, so reading
|
|
3985
|
+
* the same CTE in there is fine.
|
|
3986
|
+
*/
|
|
3987
|
+
useCte(handle: object): void;
|
|
3879
3988
|
aliasFor(handle: object): string;
|
|
3880
3989
|
conditionToSql(cond: SqlCondition): SqlFragment | undefined;
|
|
3881
3990
|
}
|
|
@@ -3899,5 +4008,5 @@ declare function injectedConditions(source: {
|
|
|
3899
4008
|
*/
|
|
3900
4009
|
declare function conditionToSql(cond: QueryCondition | undefined, ctx: Ctx, topLevel: boolean): SqlFragment | undefined;
|
|
3901
4010
|
//#endregion
|
|
3902
|
-
export { CheckReadQuery, CheckScope, CheckSetQuery, Clauses, Ctx, EntityHydrator, EntityQuery, ExistsQuery, MaybeNull, NameOf, NotWidened, OrderByDirection, OrderByKeys, Plan, Query, QueryArg, QueryCondition, QueryJoin, QueryJoins, QueryOrderBy, QueryOutput, QueryRow, QuerySelect, QuerySource, QueryValue, ReadQueryRow, ScalarQuery, SetOperand, SetOperation, SetQuery, SetQueryRow, Subquery, SubqueryBrand, SubqueryHandle, conditionToSql, entityQueryBrand, injectedConditions, isReadQueryValue, parseUserQuery, projectionToSql, query, scalarQueryBrand, sql, subqueryBrand };
|
|
4011
|
+
export { CheckReadQuery, CheckScope, CheckSetQuery, Clauses, Ctx, EntityHydrator, EntityQuery, ExistsQuery, MaybeNull, NameOf, NotWidened, OrderByDirection, OrderByKeys, Plan, Query, QueryArg, QueryCondition, QueryJoin, QueryJoins, QueryOrderBy, QueryOutput, QueryRow, QuerySelect, QuerySource, QueryValue, ReadQueryRow, RecursiveOptions, ScalarQuery, SetOperand, SetOperation, SetQuery, SetQueryRow, Subquery, SubqueryBrand, SubqueryHandle, WithInput, WithSource, conditionToSql, entityQueryBrand, injectedConditions, isReadQueryValue, parseUserQuery, projectionToSql, query, recursiveQuery, scalarQueryBrand, sql, subqueryBrand };
|
|
3903
4012
|
//# sourceMappingURL=query.d.cts.map
|
package/build/query.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.cts","names":[],"sources":["../src/query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgGa;cACA;cACA;;KAGD,cAAc,4BAA4B,YAAY;YAAsB;;;;;;;;;KAS5E,iBACR,eACA;EAEM,KAAK,MAAM;EAA6B;EAAY;EAAgB;;EACpE,IAAI,MAAM;EAA6B;EAAa;EAAgB;;EACpE;;EACJ,QAAQ;EAAyB;EAAmB;EAAa;;EACjE,WAAW;EAAyB;EAAgB;EAAa;;;UAGtD,cAAc,GAAG;WACvB,OAAO;WACP,QAAQ;;;KAIP;YACI,YAAY;;YACZ,gBAAgB;;;;;;;KAOpB,YAAY,UAAU,aAAa,kBAAkB,SAAS,aAAa;KAC3E,uBAAuB
|
|
1
|
+
{"version":3,"file":"query.d.cts","names":[],"sources":["../src/query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgGa;cACA;cACA;;KAGD,cAAc,4BAA4B,YAAY;YAAsB;;;;;;;;;KAS5E,iBACR,eACA;EAEM,KAAK,MAAM;EAA6B;EAAY;EAAgB;;EACpE,IAAI,MAAM;EAA6B;EAAa;EAAgB;;EACpE;;EACJ,QAAQ;EAAyB;EAAmB;EAAa;;EACjE,WAAW;EAAyB;EAAgB;EAAa;;;UAGtD,cAAc,GAAG;WACvB,OAAO;WACP,QAAQ;;;KAIP;YACI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;;;;;;;;;iBA4OtB,mBACd;EAAU,MAAM;EAA4B;GAC5C,qCACC;;;;;;;iBAiKa,eAAe,MAAM,4BAA4B,KAAK,KAAK,oBAAoB"}
|
package/build/query.d.mts
CHANGED
|
@@ -96,6 +96,20 @@ type QuerySource = {
|
|
|
96
96
|
*/
|
|
97
97
|
type QueryJoin = InnerJoin<QuerySource, QueryCondition> | LeftJoin<QuerySource, QueryCondition>;
|
|
98
98
|
type QueryJoins = readonly (QueryJoin | undefined)[];
|
|
99
|
+
/**
|
|
100
|
+
* A CTE declaration: a `query(...)` value with named columns, i.e. a POJO or set-operation select.
|
|
101
|
+
*
|
|
102
|
+
* Entity-mode and scalar `query(...)` shapes are excluded: a CTE must be a table shape, so it needs
|
|
103
|
+
* columns.
|
|
104
|
+
*/
|
|
105
|
+
type WithSource = Subquery<unknown, string>;
|
|
106
|
+
/** One CTE or an array of them; an `undefined` entry prunes, like any other clause. */
|
|
107
|
+
type WithInput = WithSource | readonly (WithSource | undefined)[];
|
|
108
|
+
/** How a recursive CTE combines its two terms: `UNION ALL` keeps every row, `UNION` drops duplicates. */
|
|
109
|
+
interface RecursiveOptions {
|
|
110
|
+
/** Defaults to `"all"`. `"distinct"` emits UNION, which stops a cyclic graph from looping forever. */
|
|
111
|
+
union?: "all" | "distinct";
|
|
112
|
+
}
|
|
99
113
|
/**
|
|
100
114
|
* An expression order-by entry: the direction is the key and the expression is the value, unlike
|
|
101
115
|
* the keyed form's field name and `"ASC" | "DESC"` value. `never` on the other key keeps an
|
|
@@ -142,6 +156,15 @@ type QuerySelect = QuerySource | ExprLike<any> | Record<string, ExprLike<any>>;
|
|
|
142
156
|
* a standalone object use `satisfies Query` (or `satisfies Clauses` for a source-less fragment).
|
|
143
157
|
*/
|
|
144
158
|
interface Clauses<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> {
|
|
159
|
+
/**
|
|
160
|
+
* CTEs to include in a `WITH` clause, declared as `query(...)` values; either a single value or an array.
|
|
161
|
+
*
|
|
162
|
+
* I.e. `{ with: bookStats, from: a, join: [{ left: bookStats, on: ... }], select: { n: bookStats.n } }`.
|
|
163
|
+
*
|
|
164
|
+
* An `undefined` entry is ignored, and a CTE that nothing else in the query references will be pruned,
|
|
165
|
+
* the same pruning `join` gets (see "Pruning"); `pruneJoins: false` keeps every CTE.
|
|
166
|
+
*/
|
|
167
|
+
with?: WithInput;
|
|
145
168
|
join?: J;
|
|
146
169
|
/** A boolean group, an exists/notExists query, or a bare condition such as `a.age.gte(18)`. */
|
|
147
170
|
where?: QueryCondition;
|
|
@@ -163,7 +186,7 @@ interface Clauses<S extends QuerySelect = QuerySelect, J extends QueryJoins = Qu
|
|
|
163
186
|
softDeletes?: "include" | "exclude";
|
|
164
187
|
}
|
|
165
188
|
/** A whole query: `Clauses` plus its source. `query(q)` turns it into a value; `em.query(q)` runs it. */
|
|
166
|
-
interface Query<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> extends Clauses<S, J>, Partial<Record<SetOperation | MutationKey | "
|
|
189
|
+
interface Query<S extends QuerySelect = QuerySelect, J extends QueryJoins = QueryJoins> extends Clauses<S, J>, Partial<Record<SetOperation | MutationKey | "ctes", never>> {
|
|
167
190
|
from: QuerySource;
|
|
168
191
|
}
|
|
169
192
|
/**
|
|
@@ -202,11 +225,13 @@ type SetOperand = Query<Record<string, ExprLike<unknown>> | Subquery<unknown, st
|
|
|
202
225
|
* This input shape checks direction values; `CheckSetQuery` checks the inferred output keys in orderBy.
|
|
203
226
|
*/
|
|
204
227
|
type SetQuery<Operands extends readonly SetOperand[] = readonly [SetOperand, SetOperand, ...SetOperand[]]> = { [K in SetOperation]: { readonly [P in K]: Operands; } & { readonly [P in Exclude<SetOperation, K>]?: never; }; }[SetOperation] & {
|
|
228
|
+
/** CTEs for the combined query, declared once and in scope for every operand; see `Clauses.with`. */
|
|
229
|
+
readonly with?: WithInput;
|
|
205
230
|
readonly orderBy?: Readonly<Record<string, OrderByDirection | undefined>> | readonly (Readonly<Record<string, OrderByDirection | undefined>> | undefined)[];
|
|
206
231
|
readonly limit?: number;
|
|
207
232
|
readonly offset?: number;
|
|
208
233
|
readonly as?: string;
|
|
209
|
-
} & { readonly [K in "from" | "select" | "join" | "where" | "groupBy" | "having" | "distinct" | "softDeletes" | "pruneJoins" | MutationKey | "
|
|
234
|
+
} & { readonly [K in "from" | "select" | "join" | "where" | "groupBy" | "having" | "distinct" | "softDeletes" | "pruneJoins" | MutationKey | "ctes"]?: never; };
|
|
210
235
|
/**
|
|
211
236
|
* Extracts the operand collection from each possible compound root, ignoring pagination and ordering.
|
|
212
237
|
*
|
|
@@ -323,7 +348,7 @@ type CheckReadQuery<Q> = SetOperand extends Q ? unknown : Q extends readonly unk
|
|
|
323
348
|
} ? { readonly [K in keyof Q]: K extends typeof entityQueryBrand ? unknown : never; } : Q extends {
|
|
324
349
|
readonly from: unknown;
|
|
325
350
|
readonly select: unknown;
|
|
326
|
-
} ? { readonly [K in keyof Q]: K extends keyof Clauses | "from" | "as" ? unknown : never; } : { readonly [K in keyof Q]: K extends SetOperation ? Q[K] extends readonly unknown[] ? CheckReadQuery<Q[K]> : unknown : K extends "orderBy" | "limit" | "offset" | "as" ? unknown : never; };
|
|
351
|
+
} ? { readonly [K in keyof Q]: K extends keyof Clauses | "from" | "as" ? unknown : never; } : { readonly [K in keyof Q]: K extends SetOperation ? Q[K] extends readonly unknown[] ? CheckReadQuery<Q[K]> : unknown : K extends "with" | "orderBy" | "limit" | "offset" | "as" ? unknown : never; };
|
|
327
352
|
/** The type-level name of a table or subquery, i.e. `"Author"` or `"book_stats"`. */
|
|
328
353
|
type NameOf<A> = A extends {
|
|
329
354
|
readonly [tableMgmt]: {
|
|
@@ -488,6 +513,31 @@ declare function query<const Q extends SetQuery<readonly SetOperand[]>, Name ext
|
|
|
488
513
|
as?: Name;
|
|
489
514
|
}): Subquery<SetQueryRow<Q>, Name>;
|
|
490
515
|
declare function query<F extends QuerySource, S extends QuerySelect = never, J extends QueryJoins = [], Name extends string = "?">(q: QueryArg<F, S, J, Name>): QueryValue<S, J, Name>;
|
|
516
|
+
/**
|
|
517
|
+
* Declares a `WITH RECURSIVE` CTE from its two terms, and returns the CTE as a readable value.
|
|
518
|
+
*
|
|
519
|
+
* `base` is the non-recursive term, which seeds the rows and, as in PostgreSQL, supplies the CTE's
|
|
520
|
+
* columns. `step` is the recursive term: it receives the CTE itself, so it can join back to the rows
|
|
521
|
+
* found so far. The two terms are combined with UNION ALL, or UNION when `union: "distinct"` drops
|
|
522
|
+
* duplicates, which is how a cyclic graph is kept from looping forever.
|
|
523
|
+
*
|
|
524
|
+
* ```ts
|
|
525
|
+
* const [a] = tables(Author);
|
|
526
|
+
* const tree = recursiveQuery(
|
|
527
|
+
* "tree",
|
|
528
|
+
* { from: a, where: a.mentor_id.isNull(), select: { id: a.id, mentorId: a.mentor_id } },
|
|
529
|
+
* (self) => ({
|
|
530
|
+
* from: a,
|
|
531
|
+
* join: [{ inner: self, on: a.mentor_id.eq(self.id) }],
|
|
532
|
+
* select: { id: a.id, mentorId: a.mentor_id },
|
|
533
|
+
* }),
|
|
534
|
+
* );
|
|
535
|
+
* const rows = await em.query({ with: tree, from: tree, select: tree });
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* Unlike `query()`, the name is required, because the step term must name it.
|
|
539
|
+
*/
|
|
540
|
+
declare function recursiveQuery<Name extends string, F extends QuerySource, S extends QuerySelect, J extends QueryJoins>(name: Name, base: QueryArg<F, S, J, Name>, step: (self: Subquery<QueryRow<S, J>, Name>) => SetOperand, opts?: RecursiveOptions): Subquery<QueryRow<S, J>, Name>;
|
|
491
541
|
/**
|
|
492
542
|
* Builds a SQL expression from a tagged template.
|
|
493
543
|
*
|
|
@@ -3837,8 +3887,16 @@ interface QueryOutput {
|
|
|
3837
3887
|
}
|
|
3838
3888
|
/** The runtime identity of a `query(...)` value; `Ctx.aliasFor` keys on it, like a table's `TableMgmt`. */
|
|
3839
3889
|
declare class SubqueryHandle {
|
|
3840
|
-
|
|
3841
|
-
|
|
3890
|
+
#private;
|
|
3891
|
+
readonly recursive: boolean;
|
|
3892
|
+
constructor(q: AnyReadQuery, recursive?: boolean);
|
|
3893
|
+
get q(): AnyReadQuery;
|
|
3894
|
+
/**
|
|
3895
|
+
* Gives a recursive CTE its finished body. `recursiveQuery` starts the handle on its base term, so
|
|
3896
|
+
* the step term can read the CTE's columns while the body that will hold that step is still being
|
|
3897
|
+
* built. The base term supplies the CTE's columns either way, PostgreSQL's rule for a recursive WITH.
|
|
3898
|
+
*/
|
|
3899
|
+
setBody(q: AnyReadQuery): void;
|
|
3842
3900
|
get name(): string | undefined;
|
|
3843
3901
|
/** The select keys, for `select: <subquery>` and for reporting unknown columns. */
|
|
3844
3902
|
columnKeys(): string[];
|
|
@@ -3873,9 +3931,60 @@ declare class Ctx implements ExprContext {
|
|
|
3873
3931
|
readonly assigner: AliasAssigner;
|
|
3874
3932
|
private parent;
|
|
3875
3933
|
private aliases;
|
|
3934
|
+
/**
|
|
3935
|
+
* The subset of `aliases` that are CTE names. A `from`/`join` on one of these emits just the name,
|
|
3936
|
+
* i.e. `FROM book_stats`, where an ordinary `query(...)` value emits its whole body inline, i.e.
|
|
3937
|
+
* `FROM (SELECT ...) AS sq`.
|
|
3938
|
+
*/
|
|
3939
|
+
private ctes;
|
|
3940
|
+
/**
|
|
3941
|
+
* `with` entries named but not yet turned into SQL. `registerCtes` names every entry first, then
|
|
3942
|
+
* generates the bodies one at a time, so while one body is being generated the entries after it sit
|
|
3943
|
+
* here. Reading one of those is a forward reference.
|
|
3944
|
+
*/
|
|
3945
|
+
private pendingCtes;
|
|
3946
|
+
/** CTEs already read by this query's `from`/`join`, so a second read fails instead of colliding. */
|
|
3947
|
+
private usedCtes;
|
|
3948
|
+
/** The recursive CTE whose body this query is part of, if any; see `recursiveSelf`. */
|
|
3949
|
+
private ownRecursiveSelf;
|
|
3876
3950
|
readonly outerRefs: Set<string>;
|
|
3877
3951
|
constructor(assigner: AliasAssigner, parent: Ctx | undefined);
|
|
3952
|
+
/**
|
|
3953
|
+
* One handle can hold only one alias per query, so a value used twice must be told apart, not
|
|
3954
|
+
* silently collapsed into the second registration's alias.
|
|
3955
|
+
*/
|
|
3878
3956
|
register(handle: object, alias: string): void;
|
|
3957
|
+
/** Names every `with` entry up front, so a CTE reading a later sibling is reported, not inlined. */
|
|
3958
|
+
declareCte(handle: object, alias: string): void;
|
|
3959
|
+
/** Brings a pending CTE into scope, for the sources and columns that may now read it. */
|
|
3960
|
+
promoteCte(handle: object): void;
|
|
3961
|
+
/**
|
|
3962
|
+
* The CTE name for `handle`, looking in the enclosing queries too, because a CTE is in scope for the
|
|
3963
|
+
* whole statement.
|
|
3964
|
+
*
|
|
3965
|
+
* Unlike `aliasFor`, a hit in an enclosing query is not added to `outerRefs`: reading a CTE by name
|
|
3966
|
+
* is not a correlated reference, so it must not keep an enclosing join alive.
|
|
3967
|
+
*/
|
|
3968
|
+
cteAliasFor(handle: object): string | undefined;
|
|
3969
|
+
/**
|
|
3970
|
+
* The recursive CTE this query's terms belong to, inherited from the enclosing query.
|
|
3971
|
+
*
|
|
3972
|
+
* PostgreSQL requires a recursive term to reference its own CTE, so that reference is not optional
|
|
3973
|
+
* and must survive pruning, unlike an ordinary explicit join that nothing else reads.
|
|
3974
|
+
*/
|
|
3975
|
+
get recursiveSelf(): SubqueryHandle | undefined;
|
|
3976
|
+
setRecursiveSelf(handle: SubqueryHandle): void;
|
|
3977
|
+
/** Whether `handle` is a CTE with no SQL yet, i.e. itself or a later `with` entry. */
|
|
3978
|
+
isPendingCte(handle: object): boolean;
|
|
3979
|
+
/**
|
|
3980
|
+
* Fails if this query already reads `handle`. A `Ctx` maps each handle to a single alias, so two
|
|
3981
|
+
* reads of one CTE value would render as the same name, i.e. `FROM tree JOIN tree`, and neither the
|
|
3982
|
+
* SQL nor a column expression could say which one it meant. Each read needs its own `query(...)`.
|
|
3983
|
+
*
|
|
3984
|
+
* Only this query is checked, not the enclosing ones: a nested subquery has its own FROM, so reading
|
|
3985
|
+
* the same CTE in there is fine.
|
|
3986
|
+
*/
|
|
3987
|
+
useCte(handle: object): void;
|
|
3879
3988
|
aliasFor(handle: object): string;
|
|
3880
3989
|
conditionToSql(cond: SqlCondition): SqlFragment | undefined;
|
|
3881
3990
|
}
|
|
@@ -3899,5 +4008,5 @@ declare function injectedConditions(source: {
|
|
|
3899
4008
|
*/
|
|
3900
4009
|
declare function conditionToSql(cond: QueryCondition | undefined, ctx: Ctx, topLevel: boolean): SqlFragment | undefined;
|
|
3901
4010
|
//#endregion
|
|
3902
|
-
export { CheckReadQuery, CheckScope, CheckSetQuery, Clauses, Ctx, EntityHydrator, EntityQuery, ExistsQuery, MaybeNull, NameOf, NotWidened, OrderByDirection, OrderByKeys, Plan, Query, QueryArg, QueryCondition, QueryJoin, QueryJoins, QueryOrderBy, QueryOutput, QueryRow, QuerySelect, QuerySource, QueryValue, ReadQueryRow, ScalarQuery, SetOperand, SetOperation, SetQuery, SetQueryRow, Subquery, SubqueryBrand, SubqueryHandle, conditionToSql, entityQueryBrand, injectedConditions, isReadQueryValue, parseUserQuery, projectionToSql, query, scalarQueryBrand, sql, subqueryBrand };
|
|
4011
|
+
export { CheckReadQuery, CheckScope, CheckSetQuery, Clauses, Ctx, EntityHydrator, EntityQuery, ExistsQuery, MaybeNull, NameOf, NotWidened, OrderByDirection, OrderByKeys, Plan, Query, QueryArg, QueryCondition, QueryJoin, QueryJoins, QueryOrderBy, QueryOutput, QueryRow, QuerySelect, QuerySource, QueryValue, ReadQueryRow, RecursiveOptions, ScalarQuery, SetOperand, SetOperation, SetQuery, SetQueryRow, Subquery, SubqueryBrand, SubqueryHandle, WithInput, WithSource, conditionToSql, entityQueryBrand, injectedConditions, isReadQueryValue, parseUserQuery, projectionToSql, query, recursiveQuery, scalarQueryBrand, sql, subqueryBrand };
|
|
3903
4012
|
//# sourceMappingURL=query.d.mts.map
|
package/build/query.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.mts","names":[],"sources":["../src/query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgGa;cACA;cACA;;KAGD,cAAc,4BAA4B,YAAY;YAAsB;;;;;;;;;KAS5E,iBACR,eACA;EAEM,KAAK,MAAM;EAA6B;EAAY;EAAgB;;EACpE,IAAI,MAAM;EAA6B;EAAa;EAAgB;;EACpE;;EACJ,QAAQ;EAAyB;EAAmB;EAAa;;EACjE,WAAW;EAAyB;EAAgB;EAAa;;;UAGtD,cAAc,GAAG;WACvB,OAAO;WACP,QAAQ;;;KAIP;YACI,YAAY;;YACZ,gBAAgB;;;;;;;KAOpB,YAAY,UAAU,aAAa,kBAAkB,SAAS,aAAa;KAC3E,uBAAuB
|
|
1
|
+
{"version":3,"file":"query.d.mts","names":[],"sources":["../src/query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgGa;cACA;cACA;;KAGD,cAAc,4BAA4B,YAAY;YAAsB;;;;;;;;;KAS5E,iBACR,eACA;EAEM,KAAK,MAAM;EAA6B;EAAY;EAAgB;;EACpE,IAAI,MAAM;EAA6B;EAAa;EAAgB;;EACpE;;EACJ,QAAQ;EAAyB;EAAmB;EAAa;;EACjE,WAAW;EAAyB;EAAgB;EAAa;;;UAGtD,cAAc,GAAG;WACvB,OAAO;WACP,QAAQ;;;KAIP;YACI,YAAY;;YACZ,gBAAgB;;;;;;;KAOpB,YAAY,UAAU,aAAa,kBAAkB,SAAS,aAAa;KAC3E,uBAAuB;;;;;;;KAQvB,aAAa;;KAGb,YAAY,uBAAuB;;UAG9B;;EAEf;;;;;;;;;;;KAYU,aAAa;WACV,KAAK;WAAwB;;WAC7B,MAAM;WAAwB;;WAC9B;oBAA6C,WAAW,2BAErD,KAAK,QAAQ,WAAW;KAE9B;;;;;;;;;KAgBA,YAAY,KAAK;YAAsB;aAAuB,gBAAgB;;IACtF,UAAU,qB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