linkgress-orm 0.0.1
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/LICENSE +21 -0
- package/README.md +196 -0
- package/dist/database/database-client.interface.d.ts +45 -0
- package/dist/database/database-client.interface.d.ts.map +1 -0
- package/dist/database/database-client.interface.js +20 -0
- package/dist/database/database-client.interface.js.map +1 -0
- package/dist/database/index.d.ts +5 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +10 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/pg-client.d.ts +30 -0
- package/dist/database/pg-client.d.ts.map +1 -0
- package/dist/database/pg-client.js +76 -0
- package/dist/database/pg-client.js.map +1 -0
- package/dist/database/postgres-client.d.ts +44 -0
- package/dist/database/postgres-client.d.ts.map +1 -0
- package/dist/database/postgres-client.js +111 -0
- package/dist/database/postgres-client.js.map +1 -0
- package/dist/database/types.d.ts +200 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +8 -0
- package/dist/database/types.js.map +1 -0
- package/dist/entity/base-entity.d.ts +21 -0
- package/dist/entity/base-entity.d.ts.map +1 -0
- package/dist/entity/base-entity.js +27 -0
- package/dist/entity/base-entity.js.map +1 -0
- package/dist/entity/db-column.d.ts +61 -0
- package/dist/entity/db-column.d.ts.map +1 -0
- package/dist/entity/db-column.js +35 -0
- package/dist/entity/db-column.js.map +1 -0
- package/dist/entity/db-context.d.ts +665 -0
- package/dist/entity/db-context.d.ts.map +1 -0
- package/dist/entity/db-context.js +1463 -0
- package/dist/entity/db-context.js.map +1 -0
- package/dist/entity/entity-base.d.ts +76 -0
- package/dist/entity/entity-base.d.ts.map +1 -0
- package/dist/entity/entity-base.js +42 -0
- package/dist/entity/entity-base.js.map +1 -0
- package/dist/entity/entity-builder.d.ts +171 -0
- package/dist/entity/entity-builder.d.ts.map +1 -0
- package/dist/entity/entity-builder.js +376 -0
- package/dist/entity/entity-builder.js.map +1 -0
- package/dist/entity/model-config.d.ts +18 -0
- package/dist/entity/model-config.d.ts.map +1 -0
- package/dist/entity/model-config.js +157 -0
- package/dist/entity/model-config.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -0
- package/dist/migration/db-schema-manager.d.ts +228 -0
- package/dist/migration/db-schema-manager.d.ts.map +1 -0
- package/dist/migration/db-schema-manager.js +1055 -0
- package/dist/migration/db-schema-manager.js.map +1 -0
- package/dist/migration/enum-migrator.d.ts +29 -0
- package/dist/migration/enum-migrator.d.ts.map +1 -0
- package/dist/migration/enum-migrator.js +137 -0
- package/dist/migration/enum-migrator.js.map +1 -0
- package/dist/query/collection-strategy.factory.d.ts +16 -0
- package/dist/query/collection-strategy.factory.d.ts.map +1 -0
- package/dist/query/collection-strategy.factory.js +37 -0
- package/dist/query/collection-strategy.factory.js.map +1 -0
- package/dist/query/collection-strategy.interface.d.ts +146 -0
- package/dist/query/collection-strategy.interface.d.ts.map +1 -0
- package/dist/query/collection-strategy.interface.js +3 -0
- package/dist/query/collection-strategy.interface.js.map +1 -0
- package/dist/query/conditions.d.ts +222 -0
- package/dist/query/conditions.d.ts.map +1 -0
- package/dist/query/conditions.js +446 -0
- package/dist/query/conditions.js.map +1 -0
- package/dist/query/cte-builder.d.ts +95 -0
- package/dist/query/cte-builder.d.ts.map +1 -0
- package/dist/query/cte-builder.js +172 -0
- package/dist/query/cte-builder.js.map +1 -0
- package/dist/query/grouped-query.d.ts +186 -0
- package/dist/query/grouped-query.d.ts.map +1 -0
- package/dist/query/grouped-query.js +588 -0
- package/dist/query/grouped-query.js.map +1 -0
- package/dist/query/join-builder.d.ts +106 -0
- package/dist/query/join-builder.d.ts.map +1 -0
- package/dist/query/join-builder.js +275 -0
- package/dist/query/join-builder.js.map +1 -0
- package/dist/query/query-builder.d.ts +543 -0
- package/dist/query/query-builder.d.ts.map +1 -0
- package/dist/query/query-builder.js +2649 -0
- package/dist/query/query-builder.js.map +1 -0
- package/dist/query/strategies/jsonb-collection-strategy.d.ts +51 -0
- package/dist/query/strategies/jsonb-collection-strategy.d.ts.map +1 -0
- package/dist/query/strategies/jsonb-collection-strategy.js +210 -0
- package/dist/query/strategies/jsonb-collection-strategy.js.map +1 -0
- package/dist/query/strategies/temptable-collection-strategy.d.ts +95 -0
- package/dist/query/strategies/temptable-collection-strategy.d.ts.map +1 -0
- package/dist/query/strategies/temptable-collection-strategy.js +456 -0
- package/dist/query/strategies/temptable-collection-strategy.js.map +1 -0
- package/dist/query/subquery.d.ts +152 -0
- package/dist/query/subquery.d.ts.map +1 -0
- package/dist/query/subquery.js +206 -0
- package/dist/query/subquery.js.map +1 -0
- package/dist/schema/column-builder.d.ts +127 -0
- package/dist/schema/column-builder.d.ts.map +1 -0
- package/dist/schema/column-builder.js +184 -0
- package/dist/schema/column-builder.js.map +1 -0
- package/dist/schema/inference.d.ts +26 -0
- package/dist/schema/inference.d.ts.map +1 -0
- package/dist/schema/inference.js +3 -0
- package/dist/schema/inference.js.map +1 -0
- package/dist/schema/navigation.d.ts +215 -0
- package/dist/schema/navigation.d.ts.map +1 -0
- package/dist/schema/navigation.js +233 -0
- package/dist/schema/navigation.js.map +1 -0
- package/dist/schema/row-type.d.ts +26 -0
- package/dist/schema/row-type.d.ts.map +1 -0
- package/dist/schema/row-type.js +3 -0
- package/dist/schema/row-type.js.map +1 -0
- package/dist/schema/sequence-builder.d.ts +87 -0
- package/dist/schema/sequence-builder.d.ts.map +1 -0
- package/dist/schema/sequence-builder.js +123 -0
- package/dist/schema/sequence-builder.js.map +1 -0
- package/dist/schema/table-builder.d.ts +122 -0
- package/dist/schema/table-builder.d.ts.map +1 -0
- package/dist/schema/table-builder.js +132 -0
- package/dist/schema/table-builder.js.map +1 -0
- package/dist/schema/typed-schema.d.ts +22 -0
- package/dist/schema/typed-schema.d.ts.map +1 -0
- package/dist/schema/typed-schema.js +28 -0
- package/dist/schema/typed-schema.js.map +1 -0
- package/dist/types/column-types.d.ts +20 -0
- package/dist/types/column-types.d.ts.map +1 -0
- package/dist/types/column-types.js +14 -0
- package/dist/types/column-types.js.map +1 -0
- package/dist/types/custom-types.d.ts +85 -0
- package/dist/types/custom-types.d.ts.map +1 -0
- package/dist/types/custom-types.js +132 -0
- package/dist/types/custom-types.js.map +1 -0
- package/dist/types/enum-builder.d.ts +31 -0
- package/dist/types/enum-builder.d.ts.map +1 -0
- package/dist/types/enum-builder.js +46 -0
- package/dist/types/enum-builder.js.map +1 -0
- package/dist/types/metadata.d.ts +67 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +57 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/type-mapper.d.ts +49 -0
- package/dist/types/type-mapper.d.ts.map +1 -0
- package/dist/types/type-mapper.js +49 -0
- package/dist/types/type-mapper.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { Condition, SqlFragment, FieldRef } from './conditions';
|
|
2
|
+
import { TableSchema } from '../schema/table-builder';
|
|
3
|
+
import type { QueryExecutor, CollectionStrategyType } from '../entity/db-context';
|
|
4
|
+
import type { DatabaseClient } from '../database/database-client.interface';
|
|
5
|
+
import { Subquery } from './subquery';
|
|
6
|
+
import { GroupedQueryBuilder } from './grouped-query';
|
|
7
|
+
import { DbCte } from './cte-builder';
|
|
8
|
+
/**
|
|
9
|
+
* Join type
|
|
10
|
+
*/
|
|
11
|
+
export type JoinType = 'INNER' | 'LEFT';
|
|
12
|
+
/**
|
|
13
|
+
* Manual join definition
|
|
14
|
+
*/
|
|
15
|
+
export interface ManualJoinDefinition {
|
|
16
|
+
type: JoinType;
|
|
17
|
+
table: string;
|
|
18
|
+
alias: string;
|
|
19
|
+
schema: TableSchema;
|
|
20
|
+
condition: Condition;
|
|
21
|
+
cte?: DbCte<any>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Query context for tracking CTEs and aliases
|
|
25
|
+
*/
|
|
26
|
+
export interface QueryContext {
|
|
27
|
+
ctes: Map<string, {
|
|
28
|
+
sql: string;
|
|
29
|
+
params: any[];
|
|
30
|
+
}>;
|
|
31
|
+
cteCounter: number;
|
|
32
|
+
paramCounter: number;
|
|
33
|
+
allParams: any[];
|
|
34
|
+
collectionStrategy?: CollectionStrategyType;
|
|
35
|
+
executor?: QueryExecutor;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Query builder for a table
|
|
39
|
+
*/
|
|
40
|
+
export declare class QueryBuilder<TSchema extends TableSchema, TRow = any> {
|
|
41
|
+
private schema;
|
|
42
|
+
private client;
|
|
43
|
+
private whereCond?;
|
|
44
|
+
private selection?;
|
|
45
|
+
private limitValue?;
|
|
46
|
+
private offsetValue?;
|
|
47
|
+
private orderByFields;
|
|
48
|
+
private executor?;
|
|
49
|
+
private manualJoins;
|
|
50
|
+
private joinCounter;
|
|
51
|
+
private collectionStrategy?;
|
|
52
|
+
private _cachedMockRow?;
|
|
53
|
+
constructor(schema: TSchema, client: DatabaseClient, whereCond?: Condition, limit?: number, offset?: number, orderBy?: Array<{
|
|
54
|
+
field: string;
|
|
55
|
+
direction: 'ASC' | 'DESC';
|
|
56
|
+
}>, executor?: QueryExecutor, manualJoins?: ManualJoinDefinition[], joinCounter?: number, collectionStrategy?: CollectionStrategyType);
|
|
57
|
+
/**
|
|
58
|
+
* Get qualified table name with schema prefix if specified
|
|
59
|
+
*/
|
|
60
|
+
private getQualifiedTableName;
|
|
61
|
+
/**
|
|
62
|
+
* Define the selection with support for nested queries
|
|
63
|
+
*/
|
|
64
|
+
select<TSelection>(selector: (row: TRow) => TSelection): SelectQueryBuilder<TSelection>;
|
|
65
|
+
/**
|
|
66
|
+
* Add WHERE condition
|
|
67
|
+
*/
|
|
68
|
+
where(condition: (row: TRow) => Condition): this;
|
|
69
|
+
/**
|
|
70
|
+
* Create mock row for analysis
|
|
71
|
+
*/
|
|
72
|
+
private createMockRow;
|
|
73
|
+
/**
|
|
74
|
+
* Add a LEFT JOIN to the query with a selector (supports both tables and subqueries)
|
|
75
|
+
*/
|
|
76
|
+
leftJoin<TRight, TSelection>(rightTable: {
|
|
77
|
+
_getSchema: () => TableSchema;
|
|
78
|
+
} | Subquery<TRight, 'table'>, condition: (left: TRow, right: TRight) => Condition, selector: (left: TRow, right: TRight) => TSelection, alias?: string): SelectQueryBuilder<TSelection>;
|
|
79
|
+
/**
|
|
80
|
+
* Add an INNER JOIN to the query with a selector (supports both tables and subqueries)
|
|
81
|
+
*/
|
|
82
|
+
innerJoin<TRight, TSelection>(rightTable: {
|
|
83
|
+
_getSchema: () => TableSchema;
|
|
84
|
+
} | Subquery<TRight, 'table'>, condition: (left: TRow, right: TRight) => Condition, selector: (left: TRow, right: TRight) => TSelection, alias?: string): SelectQueryBuilder<TSelection>;
|
|
85
|
+
/**
|
|
86
|
+
* Create mock row for a specific table/alias (for joins)
|
|
87
|
+
*/
|
|
88
|
+
private createMockRowForTable;
|
|
89
|
+
/**
|
|
90
|
+
* Limit results
|
|
91
|
+
*/
|
|
92
|
+
limit(count: number): this;
|
|
93
|
+
/**
|
|
94
|
+
* Offset results
|
|
95
|
+
*/
|
|
96
|
+
offset(count: number): this;
|
|
97
|
+
/**
|
|
98
|
+
* Order by field(s)
|
|
99
|
+
* @example
|
|
100
|
+
* .orderBy(p => p.colName)
|
|
101
|
+
* .orderBy(p => [p.colName, p.otherCol])
|
|
102
|
+
* .orderBy(p => [[p.colName, 'ASC'], [p.otherCol, 'DESC']])
|
|
103
|
+
*/
|
|
104
|
+
orderBy(selector: (row: TRow) => any): this;
|
|
105
|
+
orderBy(selector: (row: TRow) => any[]): this;
|
|
106
|
+
orderBy(selector: (row: TRow) => Array<[any, 'ASC' | 'DESC']>): this;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Select query builder with nested collection support
|
|
110
|
+
*/
|
|
111
|
+
export declare class SelectQueryBuilder<TSelection> {
|
|
112
|
+
private schema;
|
|
113
|
+
private client;
|
|
114
|
+
private selector;
|
|
115
|
+
private whereCond?;
|
|
116
|
+
private limitValue?;
|
|
117
|
+
private offsetValue?;
|
|
118
|
+
private orderByFields;
|
|
119
|
+
private executor?;
|
|
120
|
+
private manualJoins;
|
|
121
|
+
private joinCounter;
|
|
122
|
+
private isDistinct;
|
|
123
|
+
private schemaRegistry?;
|
|
124
|
+
private ctes;
|
|
125
|
+
private collectionStrategy?;
|
|
126
|
+
/**
|
|
127
|
+
* Get qualified table name with schema prefix if specified
|
|
128
|
+
*/
|
|
129
|
+
private getQualifiedTableName;
|
|
130
|
+
constructor(schema: TableSchema, client: DatabaseClient, selector: (row: any) => TSelection, whereCond?: Condition, limit?: number, offset?: number, orderBy?: Array<{
|
|
131
|
+
field: string;
|
|
132
|
+
direction: 'ASC' | 'DESC';
|
|
133
|
+
}>, executor?: QueryExecutor, manualJoins?: ManualJoinDefinition[], joinCounter?: number, isDistinct?: boolean, schemaRegistry?: Map<string, TableSchema>, ctes?: DbCte<any>[], collectionStrategy?: CollectionStrategyType);
|
|
134
|
+
/**
|
|
135
|
+
* Transform the selection with a new selector
|
|
136
|
+
*/
|
|
137
|
+
select<TNewSelection>(selector: (row: TSelection) => TNewSelection): SelectQueryBuilder<TNewSelection>;
|
|
138
|
+
/**
|
|
139
|
+
* Add WHERE condition
|
|
140
|
+
* Note: The row parameter represents the selected shape (after select())
|
|
141
|
+
*/
|
|
142
|
+
where(condition: (row: any) => Condition): this;
|
|
143
|
+
/**
|
|
144
|
+
* Attach one or more CTEs to this query
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const result = await db.users
|
|
148
|
+
* .where(u => eq(u.id, 1))
|
|
149
|
+
* .with(activeUsersCte.cte)
|
|
150
|
+
* .leftJoin(activeUsersCte.cte, ...)
|
|
151
|
+
* .toList();
|
|
152
|
+
*/
|
|
153
|
+
with(...ctes: DbCte<any>[]): this;
|
|
154
|
+
/**
|
|
155
|
+
* Limit results
|
|
156
|
+
*/
|
|
157
|
+
limit(count: number): this;
|
|
158
|
+
/**
|
|
159
|
+
* Offset results
|
|
160
|
+
*/
|
|
161
|
+
offset(count: number): this;
|
|
162
|
+
/**
|
|
163
|
+
* Order by field(s)
|
|
164
|
+
* @example
|
|
165
|
+
* .orderBy(p => p.colName)
|
|
166
|
+
* .orderBy(p => [p.colName, p.otherCol])
|
|
167
|
+
* .orderBy(p => [[p.colName, 'ASC'], [p.otherCol, 'DESC']])
|
|
168
|
+
*/
|
|
169
|
+
orderBy(selector: (row: TSelection) => any): this;
|
|
170
|
+
orderBy(selector: (row: TSelection) => any[]): this;
|
|
171
|
+
orderBy(selector: (row: TSelection) => Array<[any, 'ASC' | 'DESC']>): this;
|
|
172
|
+
/**
|
|
173
|
+
* Group by fields - returns a GroupedQueryBuilder for type-safe aggregations
|
|
174
|
+
* @param selector Function that selects the grouping key from the current selection
|
|
175
|
+
* @example
|
|
176
|
+
* db.users
|
|
177
|
+
* .select(u => ({ id: u.id, street: u.address.street, name: u.name }))
|
|
178
|
+
* .groupBy(p => ({ street: p.street }))
|
|
179
|
+
* .select(g => ({ street: g.key.street, count: g.count() }))
|
|
180
|
+
*/
|
|
181
|
+
groupBy<TGroupingKey>(selector: (row: TSelection) => TGroupingKey): GroupedQueryBuilder<TSelection, TGroupingKey>;
|
|
182
|
+
/**
|
|
183
|
+
* Add a LEFT JOIN with a subquery
|
|
184
|
+
* @param subquery The subquery to join (must be 'table' mode)
|
|
185
|
+
* @param alias Alias for the subquery in the FROM clause
|
|
186
|
+
* @param condition Join condition
|
|
187
|
+
* @param selector Result selector
|
|
188
|
+
*/
|
|
189
|
+
leftJoinSubquery<TSubqueryResult, TNewSelection>(subquery: Subquery<TSubqueryResult, 'table'>, alias: string, condition: (left: TSelection, right: TSubqueryResult) => Condition, selector: (left: TSelection, right: TSubqueryResult) => TNewSelection): SelectQueryBuilder<TNewSelection>;
|
|
190
|
+
/**
|
|
191
|
+
* Add a LEFT JOIN to the query with a selector
|
|
192
|
+
* Note: After select(), the left parameter in the join will be the selected shape (TSelection)
|
|
193
|
+
*/
|
|
194
|
+
leftJoin<TRight extends Record<string, any>, TNewSelection>(rightTable: {
|
|
195
|
+
_getSchema: () => TableSchema;
|
|
196
|
+
} | Subquery<TRight, 'table'> | DbCte<TRight>, condition: (left: TSelection, right: TRight) => Condition, selector: (left: TSelection, right: TRight) => TNewSelection, alias?: string): SelectQueryBuilder<TNewSelection>;
|
|
197
|
+
/**
|
|
198
|
+
* Add a LEFT JOIN with a CTE
|
|
199
|
+
*/
|
|
200
|
+
private leftJoinCte;
|
|
201
|
+
/**
|
|
202
|
+
* Add an INNER JOIN with a subquery
|
|
203
|
+
* @param subquery The subquery to join (must be 'table' mode)
|
|
204
|
+
* @param alias Alias for the subquery in the FROM clause
|
|
205
|
+
* @param condition Join condition
|
|
206
|
+
* @param selector Result selector
|
|
207
|
+
*/
|
|
208
|
+
innerJoinSubquery<TSubqueryResult, TNewSelection>(subquery: Subquery<TSubqueryResult, 'table'>, alias: string, condition: (left: TSelection, right: TSubqueryResult) => Condition, selector: (left: TSelection, right: TSubqueryResult) => TNewSelection): SelectQueryBuilder<TNewSelection>;
|
|
209
|
+
/**
|
|
210
|
+
* Add an INNER JOIN to the query with a selector
|
|
211
|
+
* Note: After select(), the left parameter in the join will be the selected shape (TSelection)
|
|
212
|
+
*/
|
|
213
|
+
innerJoin<TRight, TNewSelection>(rightTable: {
|
|
214
|
+
_getSchema: () => TableSchema;
|
|
215
|
+
} | Subquery<TRight, 'table'>, condition: (left: TSelection, right: TRight) => Condition, selector: (left: TSelection, right: TRight) => TNewSelection, alias?: string): SelectQueryBuilder<TNewSelection>;
|
|
216
|
+
/**
|
|
217
|
+
* Create mock row for a specific table/alias (for joins)
|
|
218
|
+
*/
|
|
219
|
+
private createMockRowForTable;
|
|
220
|
+
/**
|
|
221
|
+
* Create mock row for a subquery result (for subquery joins)
|
|
222
|
+
* The subquery result type defines the shape - we create FieldRefs for each property
|
|
223
|
+
*/
|
|
224
|
+
private createMockRowForSubquery;
|
|
225
|
+
/**
|
|
226
|
+
* Create a mock row for CTE columns
|
|
227
|
+
*/
|
|
228
|
+
private createMockRowForCte;
|
|
229
|
+
/**
|
|
230
|
+
* Select distinct rows
|
|
231
|
+
*/
|
|
232
|
+
selectDistinct<TNewSelection>(selector: (row: TSelection) => TNewSelection): SelectQueryBuilder<TNewSelection>;
|
|
233
|
+
/**
|
|
234
|
+
* Get minimum value from the query
|
|
235
|
+
*/
|
|
236
|
+
min<TResult = TSelection>(selector?: (row: TSelection) => TResult): Promise<TResult | null>;
|
|
237
|
+
/**
|
|
238
|
+
* Get maximum value from the query
|
|
239
|
+
*/
|
|
240
|
+
max<TResult = TSelection>(selector?: (row: TSelection) => TResult): Promise<TResult | null>;
|
|
241
|
+
/**
|
|
242
|
+
* Get sum of values from the query
|
|
243
|
+
*/
|
|
244
|
+
sum<TResult = TSelection>(selector?: (row: TSelection) => TResult): Promise<TResult | null>;
|
|
245
|
+
/**
|
|
246
|
+
* Get count of rows from the query
|
|
247
|
+
*/
|
|
248
|
+
count(): Promise<number>;
|
|
249
|
+
/**
|
|
250
|
+
* Execute query and return results as array
|
|
251
|
+
* Collection results are automatically resolved to arrays
|
|
252
|
+
*/
|
|
253
|
+
toList(): Promise<ResolveCollectionResults<TSelection>[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Execute query using single-phase approach (JSONB/CTE strategy)
|
|
256
|
+
*/
|
|
257
|
+
private executeSinglePhase;
|
|
258
|
+
/**
|
|
259
|
+
* Execute query using two-phase approach (temp table strategy)
|
|
260
|
+
*/
|
|
261
|
+
private executeWithTempTables;
|
|
262
|
+
/**
|
|
263
|
+
* Execute using fully optimized single-query approach (PostgresClient only)
|
|
264
|
+
* Combines base query + all collections into ONE multi-statement query
|
|
265
|
+
*/
|
|
266
|
+
private executeFullyOptimized;
|
|
267
|
+
/**
|
|
268
|
+
* Detect collections in the selection result
|
|
269
|
+
*/
|
|
270
|
+
private detectCollections;
|
|
271
|
+
/**
|
|
272
|
+
* Build base selection excluding collections but including necessary foreign keys
|
|
273
|
+
*/
|
|
274
|
+
private buildBaseSelection;
|
|
275
|
+
/**
|
|
276
|
+
* Build collection aggregation config from CollectionQueryBuilder
|
|
277
|
+
*/
|
|
278
|
+
private buildCollectionConfig;
|
|
279
|
+
/**
|
|
280
|
+
* Extract array field from collection builder for array aggregations
|
|
281
|
+
*/
|
|
282
|
+
private extractArrayField;
|
|
283
|
+
/**
|
|
284
|
+
* Get default value string for aggregation type
|
|
285
|
+
*/
|
|
286
|
+
private getDefaultValueString;
|
|
287
|
+
/**
|
|
288
|
+
* Get default value for collection based on aggregation type
|
|
289
|
+
*/
|
|
290
|
+
private getDefaultValueForCollection;
|
|
291
|
+
/**
|
|
292
|
+
* Execute query and return first result or null
|
|
293
|
+
*/
|
|
294
|
+
first(): Promise<ResolveCollectionResults<TSelection> | null>;
|
|
295
|
+
/**
|
|
296
|
+
* Execute query and return first result or null (alias for first)
|
|
297
|
+
*/
|
|
298
|
+
firstOrDefault(): Promise<ResolveCollectionResults<TSelection> | null>;
|
|
299
|
+
/**
|
|
300
|
+
* Execute query and return first result or throw
|
|
301
|
+
*/
|
|
302
|
+
firstOrThrow(): Promise<ResolveCollectionResults<TSelection>>;
|
|
303
|
+
/**
|
|
304
|
+
* Create mock row for analysis
|
|
305
|
+
*/
|
|
306
|
+
private createMockRow;
|
|
307
|
+
/**
|
|
308
|
+
* Detect navigation property references in selection and add necessary JOINs
|
|
309
|
+
*/
|
|
310
|
+
private detectAndAddJoinsFromSelection;
|
|
311
|
+
/**
|
|
312
|
+
* Build SQL query
|
|
313
|
+
*/
|
|
314
|
+
private buildQuery;
|
|
315
|
+
/**
|
|
316
|
+
* Transform database results
|
|
317
|
+
*/
|
|
318
|
+
private transformResults;
|
|
319
|
+
/**
|
|
320
|
+
* Convert database values: null to undefined, numeric strings to numbers
|
|
321
|
+
*/
|
|
322
|
+
private convertValue;
|
|
323
|
+
/**
|
|
324
|
+
* Transform collection items applying fromDriver mappers
|
|
325
|
+
*/
|
|
326
|
+
private transformCollectionItems;
|
|
327
|
+
/**
|
|
328
|
+
* Build aggregation query (MIN, MAX, SUM)
|
|
329
|
+
*/
|
|
330
|
+
private buildAggregationQuery;
|
|
331
|
+
/**
|
|
332
|
+
* Build count query
|
|
333
|
+
*/
|
|
334
|
+
private buildCountQuery;
|
|
335
|
+
/**
|
|
336
|
+
* Convert this query to a subquery that can be used in WHERE, SELECT, JOIN, or FROM clauses
|
|
337
|
+
*
|
|
338
|
+
* @template TMode - 'scalar' for single value, 'array' for column list, 'table' for full rows
|
|
339
|
+
* @returns Subquery that maintains type safety
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* // Scalar subquery (returns single value)
|
|
343
|
+
* const avgAge = db.users.select(u => u.age).asSubquery('scalar');
|
|
344
|
+
*
|
|
345
|
+
* // Array subquery (returns list of values for IN clause)
|
|
346
|
+
* const activeUserIds = db.users
|
|
347
|
+
* .where(u => eq(u.isActive, true))
|
|
348
|
+
* .select(u => u.id)
|
|
349
|
+
* .asSubquery('array');
|
|
350
|
+
*
|
|
351
|
+
* // Table subquery (returns rows for FROM or JOIN)
|
|
352
|
+
* const activeUsers = db.users
|
|
353
|
+
* .where(u => eq(u.isActive, true))
|
|
354
|
+
* .select(u => ({ id: u.id, name: u.username }))
|
|
355
|
+
* .asSubquery('table');
|
|
356
|
+
*/
|
|
357
|
+
asSubquery<TMode extends 'scalar' | 'array' | 'table' = 'table'>(mode?: TMode): Subquery<TMode extends 'scalar' ? ResolveFieldRefs<TSelection> : TMode extends 'array' ? ResolveFieldRefs<TSelection>[] : ResolveCollectionResults<TSelection>, TMode>;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Marker interface for collection results - signals that this will be an array at runtime
|
|
361
|
+
*/
|
|
362
|
+
export interface CollectionResult<TItem> {
|
|
363
|
+
readonly __collectionResult: true;
|
|
364
|
+
readonly __itemType: TItem;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Type helper to resolve all FieldRef and SqlFragment types to their value types
|
|
368
|
+
* Recursively processes nested objects and arrays
|
|
369
|
+
*/
|
|
370
|
+
export type ResolveFieldRefs<T> = T extends FieldRef<any, infer V> ? V : T extends SqlFragment<infer V> ? V : T extends CollectionResult<any> ? T : T extends Array<infer U> ? Array<ResolveFieldRefs<U>> : T extends object ? {
|
|
371
|
+
[K in keyof T]: ResolveFieldRefs<T[K]>;
|
|
372
|
+
} : T;
|
|
373
|
+
/**
|
|
374
|
+
* Type helper to resolve collection results to arrays
|
|
375
|
+
* Transforms CollectionResult<T> to T[] and resolves FieldRef to their value types
|
|
376
|
+
*/
|
|
377
|
+
export type ResolveCollectionResults<T> = {
|
|
378
|
+
[K in keyof T]: T[K] extends CollectionResult<infer TItem> ? ResolveFieldRefs<TItem>[] : ResolveFieldRefs<T[K]>;
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* Reference query builder for single navigation (many-to-one, one-to-one)
|
|
382
|
+
*/
|
|
383
|
+
export declare class ReferenceQueryBuilder<TItem = any> {
|
|
384
|
+
private relationName;
|
|
385
|
+
private targetTable;
|
|
386
|
+
private targetTableSchema?;
|
|
387
|
+
private foreignKeys;
|
|
388
|
+
private matches;
|
|
389
|
+
private isMandatory;
|
|
390
|
+
private schemaRegistry?;
|
|
391
|
+
constructor(relationName: string, targetTable: string, foreignKeys: string[], matches: string[], isMandatory: boolean, targetTableSchema?: TableSchema, schemaRegistry?: Map<string, TableSchema>);
|
|
392
|
+
/**
|
|
393
|
+
* Get the alias to use for this reference in the query
|
|
394
|
+
*/
|
|
395
|
+
getAlias(): string;
|
|
396
|
+
/**
|
|
397
|
+
* Get target table name
|
|
398
|
+
*/
|
|
399
|
+
getTargetTable(): string;
|
|
400
|
+
/**
|
|
401
|
+
* Get foreign keys
|
|
402
|
+
*/
|
|
403
|
+
getForeignKeys(): string[];
|
|
404
|
+
/**
|
|
405
|
+
* Get matches
|
|
406
|
+
*/
|
|
407
|
+
getMatches(): string[];
|
|
408
|
+
/**
|
|
409
|
+
* Is this a mandatory relation (INNER JOIN vs LEFT JOIN)
|
|
410
|
+
*/
|
|
411
|
+
getIsMandatory(): boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Get target table schema
|
|
414
|
+
*/
|
|
415
|
+
getTargetTableSchema(): TableSchema | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* Create a mock object that exposes the target table's columns
|
|
418
|
+
* This allows accessing related fields like: p.user.username
|
|
419
|
+
*/
|
|
420
|
+
createMockTargetRow(): any;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Collection query builder for nested queries
|
|
424
|
+
*/
|
|
425
|
+
export declare class CollectionQueryBuilder<TItem = any> {
|
|
426
|
+
private relationName;
|
|
427
|
+
private targetTable;
|
|
428
|
+
private targetTableSchema?;
|
|
429
|
+
private foreignKey;
|
|
430
|
+
private sourceTable;
|
|
431
|
+
private selector?;
|
|
432
|
+
private whereCond?;
|
|
433
|
+
private limitValue?;
|
|
434
|
+
private offsetValue?;
|
|
435
|
+
private orderByFields;
|
|
436
|
+
private asName?;
|
|
437
|
+
private isMarkedAsList;
|
|
438
|
+
private isDistinct;
|
|
439
|
+
private aggregationType?;
|
|
440
|
+
private flattenResultType?;
|
|
441
|
+
private schemaRegistry?;
|
|
442
|
+
private _cachedMockItem?;
|
|
443
|
+
constructor(relationName: string, targetTable: string, foreignKey: string, sourceTable: string, targetTableSchema?: TableSchema, schemaRegistry?: Map<string, TableSchema>);
|
|
444
|
+
/**
|
|
445
|
+
* Select specific fields from collection items
|
|
446
|
+
*/
|
|
447
|
+
select<TSelection>(selector: (item: TItem) => TSelection): CollectionQueryBuilder<TSelection>;
|
|
448
|
+
/**
|
|
449
|
+
* Select distinct fields from collection items
|
|
450
|
+
*/
|
|
451
|
+
selectDistinct<TSelection>(selector: (item: TItem) => TSelection): CollectionQueryBuilder<TSelection>;
|
|
452
|
+
/**
|
|
453
|
+
* Filter collection items
|
|
454
|
+
*/
|
|
455
|
+
where(condition: (item: TItem) => Condition): this;
|
|
456
|
+
/**
|
|
457
|
+
* Create a mock item for the target table with proper typing
|
|
458
|
+
*/
|
|
459
|
+
private createMockItem;
|
|
460
|
+
/**
|
|
461
|
+
* Limit collection items
|
|
462
|
+
*/
|
|
463
|
+
limit(count: number): this;
|
|
464
|
+
/**
|
|
465
|
+
* Offset collection items
|
|
466
|
+
*/
|
|
467
|
+
offset(count: number): this;
|
|
468
|
+
/**
|
|
469
|
+
* Order collection items
|
|
470
|
+
* @example
|
|
471
|
+
* .orderBy(p => p.colName)
|
|
472
|
+
* .orderBy(p => [p.colName, p.otherCol])
|
|
473
|
+
* .orderBy(p => [[p.colName, 'ASC'], [p.otherCol, 'DESC']])
|
|
474
|
+
*/
|
|
475
|
+
orderBy(selector: (item: TItem) => any): this;
|
|
476
|
+
orderBy(selector: (item: TItem) => any[]): this;
|
|
477
|
+
orderBy(selector: (item: TItem) => Array<[any, 'ASC' | 'DESC']>): this;
|
|
478
|
+
/**
|
|
479
|
+
* Get minimum value (supports magic SQL in selector)
|
|
480
|
+
*/
|
|
481
|
+
/**
|
|
482
|
+
* Get minimum value (supports magic SQL in selector)
|
|
483
|
+
* Returns SqlFragment for automatic type resolution in selectors
|
|
484
|
+
*/
|
|
485
|
+
min<TSelection>(selector?: (item: TItem) => TSelection): SqlFragment<number | null>;
|
|
486
|
+
/**
|
|
487
|
+
* Get maximum value (supports magic SQL in selector)
|
|
488
|
+
* Returns SqlFragment for automatic type resolution in selectors
|
|
489
|
+
*/
|
|
490
|
+
max<TSelection>(selector?: (item: TItem) => TSelection): SqlFragment<number | null>;
|
|
491
|
+
/**
|
|
492
|
+
* Get sum value (supports magic SQL in selector)
|
|
493
|
+
* Returns SqlFragment for automatic type resolution in selectors
|
|
494
|
+
*/
|
|
495
|
+
sum<TSelection>(selector?: (item: TItem) => TSelection): SqlFragment<number | null>;
|
|
496
|
+
/**
|
|
497
|
+
* Get count of items
|
|
498
|
+
* Returns SqlFragment for automatic type resolution in selectors
|
|
499
|
+
*/
|
|
500
|
+
count(): SqlFragment<number>;
|
|
501
|
+
/**
|
|
502
|
+
* Flatten result to number array (for single-column selections)
|
|
503
|
+
*/
|
|
504
|
+
toNumberList(name?: string): CollectionResult<number>;
|
|
505
|
+
/**
|
|
506
|
+
* Flatten result to string array (for single-column selections)
|
|
507
|
+
*/
|
|
508
|
+
toStringList(name?: string): CollectionResult<string>;
|
|
509
|
+
/**
|
|
510
|
+
* Specify the property name for the collection in the result
|
|
511
|
+
* Marks this collection to be resolved as an array in the final result
|
|
512
|
+
*/
|
|
513
|
+
toList(name?: string): CollectionResult<TItem>;
|
|
514
|
+
/**
|
|
515
|
+
* Get target table schema
|
|
516
|
+
*/
|
|
517
|
+
getTargetTableSchema(): TableSchema | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* Check if this collection uses array aggregation (for flattened results)
|
|
520
|
+
*/
|
|
521
|
+
isArrayAggregation(): boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Check if this is a scalar aggregation (count, sum, max, min)
|
|
524
|
+
*/
|
|
525
|
+
isScalarAggregation(): boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Get the aggregation type
|
|
528
|
+
*/
|
|
529
|
+
getAggregationType(): 'MIN' | 'MAX' | 'SUM' | 'COUNT' | undefined;
|
|
530
|
+
/**
|
|
531
|
+
* Get the flatten result type (for determining PostgreSQL array type)
|
|
532
|
+
*/
|
|
533
|
+
getFlattenResultType(): 'number' | 'string' | undefined;
|
|
534
|
+
/**
|
|
535
|
+
* Build CTE for this collection query
|
|
536
|
+
* Now delegates to collection strategy pattern
|
|
537
|
+
*/
|
|
538
|
+
buildCTE(context: QueryContext, client?: DatabaseClient, parentIds?: any[]): {
|
|
539
|
+
sql: string;
|
|
540
|
+
params: any[];
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
//# sourceMappingURL=query-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-builder.d.ts","s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