orange-orm 4.7.10-beta.0 → 4.7.10-beta.2
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/index.browser.mjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
- package/src/index.js +1 -0
- package/src/indexBrowser.js +1 -0
- package/src/map.d.ts +22 -886
- package/src/map2.d.ts +103 -48
- package/src/cyclic.d.ts +0 -132
package/src/map.d.ts
CHANGED
|
@@ -3,30 +3,24 @@ import type { PGliteOptions } from './pglite.d.ts';
|
|
|
3
3
|
import type { ConnectionConfiguration } from 'tedious';
|
|
4
4
|
import type { D1Database } from '@cloudflare/workers-types';
|
|
5
5
|
import type { PoolAttributes } from 'oracledb';
|
|
6
|
-
import type { AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
7
6
|
import type { DBClient } from './map2';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//todo
|
|
12
8
|
export type MergeProperties<T, V> = {
|
|
13
9
|
[K in keyof T | keyof V]:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
K extends keyof T
|
|
11
|
+
? T[K] extends MappedTableDef<infer M>
|
|
12
|
+
? K extends keyof V
|
|
13
|
+
? V[K] extends MappedTableDef<infer N>
|
|
14
|
+
? MappedTableDef<M & N & TableAlias<K>>
|
|
15
|
+
: V[K]
|
|
16
|
+
: T[K]
|
|
17
|
+
: T[K]
|
|
18
|
+
: K extends keyof V
|
|
19
|
+
? V[K] extends MappedTableDef<infer N>
|
|
20
|
+
? MappedTableDef<N & TableAlias<K>>
|
|
21
|
+
: V[K]
|
|
22
|
+
: never;
|
|
23
|
+
};
|
|
30
24
|
|
|
31
25
|
export type DbMapper<T> = {
|
|
32
26
|
table(tableName: string): MappedTableDefInit<{}>;
|
|
@@ -88,50 +82,6 @@ export interface PoolOptions {
|
|
|
88
82
|
size?: number;
|
|
89
83
|
}
|
|
90
84
|
|
|
91
|
-
type MappedDbInstance<T> = {
|
|
92
|
-
[K in keyof T]: T[K] extends MappedTableDef<infer U>
|
|
93
|
-
? MappedTable<T[K]>
|
|
94
|
-
: never;
|
|
95
|
-
} & {
|
|
96
|
-
close(): Promise<void>;
|
|
97
|
-
filter: Filter;
|
|
98
|
-
and(filter: Filter | RawFilter[], ...filters: RawFilter[]): Filter;
|
|
99
|
-
or(filter: Filter | RawFilter[], ...filters: RawFilter[]): Filter;
|
|
100
|
-
not(): Filter;
|
|
101
|
-
query(filter: RawFilter | string): Promise<unknown[]>;
|
|
102
|
-
query<T>(filter: RawFilter | string): Promise<T[]>;
|
|
103
|
-
createPatch(original: any[], modified: any[]): JsonPatch;
|
|
104
|
-
createPatch(original: any, modified: any): JsonPatch;
|
|
105
|
-
<O extends DbOptions<T>>(concurrency: O): MappedDbInstance<T>;
|
|
106
|
-
transaction(
|
|
107
|
-
fn: (db: MappedDbInstance<T>) => Promise<unknown>
|
|
108
|
-
): Promise<void>;
|
|
109
|
-
saveChanges(arraysOrRow: { saveChanges(): Promise<void> }): Promise<void>;
|
|
110
|
-
express(): import('express').RequestHandler;
|
|
111
|
-
express(config: ExpressConfig<T>): import('express').RequestHandler;
|
|
112
|
-
readonly metaData: DbConcurrency<T>;
|
|
113
|
-
interceptors: WithInterceptors;
|
|
114
|
-
} & DbConnectable<T> & WithInterceptors;
|
|
115
|
-
|
|
116
|
-
interface WithInterceptors {
|
|
117
|
-
request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
|
|
118
|
-
response: AxiosInterceptorManager<AxiosResponse>;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
type ExpressConfig<T> = {
|
|
123
|
-
[K in keyof T]?: T[K] extends MappedTableDef<infer U>
|
|
124
|
-
? ExpressTableConfig<T>
|
|
125
|
-
: never;
|
|
126
|
-
} & {
|
|
127
|
-
db?: Pool | ((connectors: Connectors) => Pool | Promise<Pool>);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
type ExpressTableConfig<T> = {
|
|
131
|
-
baseFilter?: RawFilter | ((db: MappedDbInstance<T>, req: import('express').Request, res: import('express').Response) => RawFilter);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
85
|
type JsonPatch = Array<{
|
|
136
86
|
op: 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test';
|
|
137
87
|
path: string;
|
|
@@ -141,399 +91,10 @@ type JsonPatch = Array<{
|
|
|
141
91
|
|
|
142
92
|
type ToJsonType<M> = M extends JsonOf<infer N> ? N : JsonType;
|
|
143
93
|
|
|
144
|
-
type PrimaryRowFilter<T> = StrategyToRowDataPrimary<ExtractPrimary<T>>;
|
|
145
|
-
type StrategyToRowDataPrimary<T> = {
|
|
146
|
-
[K in keyof T]: T[K] extends StringColumnSymbol
|
|
147
|
-
? string
|
|
148
|
-
: T[K] extends UuidColumnSymbol
|
|
149
|
-
? string
|
|
150
|
-
: T[K] extends NumericColumnSymbol
|
|
151
|
-
? number
|
|
152
|
-
: T[K] extends DateColumnSymbol
|
|
153
|
-
? string | Date
|
|
154
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
155
|
-
? string | Date
|
|
156
|
-
: T[K] extends BinaryColumnSymbol
|
|
157
|
-
? string
|
|
158
|
-
: T[K] extends BooleanColumnSymbol
|
|
159
|
-
? boolean
|
|
160
|
-
: T[K] extends JSONColumnType<infer M>
|
|
161
|
-
? ToJsonType<M>
|
|
162
|
-
: never;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
type ExpandedFetchingStrategy<T> = {
|
|
167
|
-
[K in keyof T &
|
|
168
|
-
keyof RemoveNever<
|
|
169
|
-
AllowedColumnsAndTablesStrategy<T>
|
|
170
|
-
>]?: T[K] extends ColumnSymbols
|
|
171
|
-
? true
|
|
172
|
-
: ExpandedFetchingStrategy<T[K]>;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
type ExpandedMappedTable<T, FL = ExpandedFetchingStrategy<T>> = {
|
|
176
|
-
getOne(
|
|
177
|
-
filter?: Filter | PrimaryRowFilter<T>
|
|
178
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
179
|
-
getOne<FS extends FetchingStrategy<T>>(
|
|
180
|
-
filter?: Filter | PrimaryRowFilter<T>,
|
|
181
|
-
fetchingStrategy?: FS
|
|
182
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
183
|
-
|
|
184
|
-
update(
|
|
185
|
-
values: StrategyToUpdateRowData<T>,
|
|
186
|
-
where: FetchingStrategy<T>
|
|
187
|
-
): Promise<void>;
|
|
188
|
-
|
|
189
|
-
update<FS extends FetchingStrategy<T>>(
|
|
190
|
-
values: StrategyToUpdateRowData<T>,
|
|
191
|
-
where: FetchingStrategy<T>,
|
|
192
|
-
strategy: FS
|
|
193
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
194
|
-
|
|
195
|
-
replace(
|
|
196
|
-
row: StrategyToInsertRowData<T> | StrategyToInsertRowData<T>[]
|
|
197
|
-
): Promise<void>;
|
|
198
|
-
|
|
199
|
-
replace<FS extends FetchingStrategy<T>>(
|
|
200
|
-
row: StrategyToInsertRowData<T>,
|
|
201
|
-
strategy: FS
|
|
202
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
203
|
-
|
|
204
|
-
replace<FS extends FetchingStrategy<T>>(
|
|
205
|
-
rows: StrategyToInsertRowData<T>[],
|
|
206
|
-
strategy: FS
|
|
207
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
updateChanges(
|
|
211
|
-
row: StrategyToInsertRowData<T>,
|
|
212
|
-
originalRow: StrategyToInsertRowData<T>
|
|
213
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
214
|
-
|
|
215
|
-
updateChanges(
|
|
216
|
-
rows: StrategyToInsertRowData<T>[],
|
|
217
|
-
originalRows: StrategyToInsertRowData<T>[]
|
|
218
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
219
|
-
|
|
220
|
-
updateChanges<FS extends FetchingStrategy<T>>(
|
|
221
|
-
row: StrategyToInsertRowData<T>,
|
|
222
|
-
originalRow: StrategyToInsertRowData<T>,
|
|
223
|
-
strategy: FS
|
|
224
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
225
|
-
|
|
226
|
-
updateChanges<FS extends FetchingStrategy<T>>(
|
|
227
|
-
rows: StrategyToInsertRowData<T>[],
|
|
228
|
-
originalRows: StrategyToInsertRowData<T>[],
|
|
229
|
-
strategy: FS
|
|
230
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
231
|
-
|
|
232
|
-
insert(
|
|
233
|
-
row: StrategyToInsertRowData<T>
|
|
234
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
235
|
-
|
|
236
|
-
insert(
|
|
237
|
-
rows: StrategyToInsertRowData<T>[]
|
|
238
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
239
|
-
|
|
240
|
-
insert<FS extends FetchingStrategy<T>>(
|
|
241
|
-
row: StrategyToInsertRowData<T>,
|
|
242
|
-
strategy: FS
|
|
243
|
-
): Promise<StrategyToRow<FetchedProperties<T, FL>, T>>;
|
|
244
|
-
|
|
245
|
-
insert<FS extends FetchingStrategy<T>>(
|
|
246
|
-
rows: StrategyToInsertRowData<T>[],
|
|
247
|
-
strategy: FS
|
|
248
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
249
|
-
|
|
250
|
-
insertAndForget(
|
|
251
|
-
row: StrategyToRowData<T>
|
|
252
|
-
): Promise<void>;
|
|
253
|
-
|
|
254
|
-
insertAndForget(
|
|
255
|
-
row: StrategyToRowData<T>[]
|
|
256
|
-
): Promise<void>;
|
|
257
|
-
|
|
258
|
-
getMany(
|
|
259
|
-
filter?: Filter | PrimaryRowFilter<T>[]
|
|
260
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
261
|
-
getMany<FS extends FetchingStrategy<T>>(
|
|
262
|
-
filter?: Filter | PrimaryRowFilter<T>[],
|
|
263
|
-
fetchingStrategy?: FS
|
|
264
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
265
|
-
getAll(): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
266
|
-
getAll<FS extends FetchingStrategy<T>>(
|
|
267
|
-
fetchingStrategy: FS
|
|
268
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FL>, T>>;
|
|
269
|
-
aggregate<FS extends AggregateStrategy<T>>(
|
|
270
|
-
fetchingStrategy: FS
|
|
271
|
-
): Promise<StrategyToRowData<FetchedAggregateProperties<T, FL>>[]>;
|
|
272
|
-
count(filter?: Filter | PrimaryRowFilter<T>[]): Promise<number>;
|
|
273
|
-
delete(filter?: Filter | PrimaryRowFilter<T>[]): Promise<void>;
|
|
274
|
-
deleteCascade(filter?: Filter | PrimaryRowFilter<T>[]): Promise<void>;
|
|
275
|
-
|
|
276
|
-
proxify(
|
|
277
|
-
row: StrategyToInsertRowData<T>
|
|
278
|
-
): StrategyToRow<FetchedProperties<T, FL>, T>;
|
|
279
|
-
|
|
280
|
-
proxify(
|
|
281
|
-
row: StrategyToInsertRowData<T>[]
|
|
282
|
-
): StrategyToRowArray<FetchedProperties<T, FL>, T>;
|
|
283
|
-
|
|
284
|
-
proxify<FS extends FetchingStrategy<T>>(
|
|
285
|
-
row: StrategyToInsertRowData<T>,
|
|
286
|
-
strategy: FS
|
|
287
|
-
): StrategyToRow<FetchedProperties<T, FL>, T>;
|
|
288
|
-
|
|
289
|
-
proxify<FS extends FetchingStrategy<T>>(
|
|
290
|
-
row: StrategyToInsertRowData<T>[],
|
|
291
|
-
strategy: FS
|
|
292
|
-
): StrategyToRowArray<FetchedProperties<T, FL>, T>;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
patch<C extends Concurrency<T>>(
|
|
296
|
-
patch: JsonPatch,
|
|
297
|
-
concurrency?: C
|
|
298
|
-
): Promise<void>;
|
|
299
|
-
|
|
300
|
-
tsType<FS extends FetchingStrategy<T>>(
|
|
301
|
-
strategy: FS
|
|
302
|
-
): StrategyToRowData<FetchedProperties<T, FS>>;
|
|
303
|
-
tsType(
|
|
304
|
-
): StrategyToRowData<FetchedProperties<T, FL>>;
|
|
305
|
-
|
|
306
|
-
readonly metaData: Concurrency<T>;
|
|
307
|
-
} & MappedColumnsAndRelations<T> &
|
|
308
|
-
GetById<T, CountProperties<ExtractPrimary<T>>>;
|
|
309
|
-
|
|
310
94
|
type ReturnArrayOrObj<W, V1, V2> =
|
|
311
95
|
W extends any[] ? V2 :
|
|
312
96
|
V1;
|
|
313
97
|
|
|
314
|
-
type MappedTable<T> = {
|
|
315
|
-
expand(): ExpandedMappedTable<T>
|
|
316
|
-
getOne(
|
|
317
|
-
filter?: Filter | PrimaryRowFilter<T>
|
|
318
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
319
|
-
getOne<FS extends FetchingStrategy<T>>(
|
|
320
|
-
filter?: Filter | PrimaryRowFilter<T>,
|
|
321
|
-
fetchingStrategy?: FS
|
|
322
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
323
|
-
|
|
324
|
-
update(
|
|
325
|
-
values: StrategyToUpdateRowData<T>,
|
|
326
|
-
where: FetchingStrategy<T>
|
|
327
|
-
): Promise<void>;
|
|
328
|
-
|
|
329
|
-
update<FS extends FetchingStrategy<T>>(
|
|
330
|
-
values: StrategyToUpdateRowData<T>,
|
|
331
|
-
where: FetchingStrategy<T>,
|
|
332
|
-
strategy: FS
|
|
333
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
334
|
-
|
|
335
|
-
replace(
|
|
336
|
-
row: StrategyToInsertRowData<T> | StrategyToInsertRowData<T>[]
|
|
337
|
-
): Promise<void>;
|
|
338
|
-
|
|
339
|
-
replace<FS extends FetchingStrategy<T>>(
|
|
340
|
-
row: StrategyToInsertRowData<T>,
|
|
341
|
-
strategy: FS
|
|
342
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
343
|
-
|
|
344
|
-
replace<FS extends FetchingStrategy<T>>(
|
|
345
|
-
rows: StrategyToInsertRowData<T>[],
|
|
346
|
-
strategy: FS
|
|
347
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
348
|
-
|
|
349
|
-
updateChanges(
|
|
350
|
-
modifiedRow: StrategyToInsertRowData<T>,
|
|
351
|
-
originalRow: StrategyToInsertRowData<T>
|
|
352
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
updateChanges(
|
|
356
|
-
modifiedRows: StrategyToInsertRowData<T>[],
|
|
357
|
-
originalRows: StrategyToInsertRowData<T>[]
|
|
358
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, {}>, T>>;
|
|
359
|
-
|
|
360
|
-
updateChanges<FS extends FetchingStrategy<T>>(
|
|
361
|
-
modifiedRow: StrategyToInsertRowData<T>,
|
|
362
|
-
originalRow: StrategyToInsertRowData<T>,
|
|
363
|
-
strategy: FS
|
|
364
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
365
|
-
|
|
366
|
-
updateChanges<FS extends FetchingStrategy<T>>(
|
|
367
|
-
modifiedRows: StrategyToInsertRowData<T>[],
|
|
368
|
-
originalRows: StrategyToInsertRowData<T>[],
|
|
369
|
-
strategy: FS
|
|
370
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
371
|
-
|
|
372
|
-
insert(
|
|
373
|
-
row: StrategyToInsertRowData<T>
|
|
374
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
375
|
-
|
|
376
|
-
insert(
|
|
377
|
-
rows: StrategyToInsertRowData<T>[]
|
|
378
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, {}>, T>>;
|
|
379
|
-
|
|
380
|
-
insert<FS extends FetchingStrategy<T>>(
|
|
381
|
-
row: StrategyToInsertRowData<T>,
|
|
382
|
-
strategy: FS
|
|
383
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
384
|
-
|
|
385
|
-
insert<FS extends FetchingStrategy<T>>(
|
|
386
|
-
rows: StrategyToInsertRowData<T>[],
|
|
387
|
-
strategy: FS
|
|
388
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
389
|
-
|
|
390
|
-
insertAndForget<TRow extends StrategyToInsertRowData<T> | StrategyToInsertRowData<T>[]>(
|
|
391
|
-
row: TRow
|
|
392
|
-
): Promise<void>;
|
|
393
|
-
getMany(
|
|
394
|
-
filter?: Filter | PrimaryRowFilter<T>[]
|
|
395
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, {}>, T>>;
|
|
396
|
-
getMany<FS extends FetchingStrategy<T>>(
|
|
397
|
-
filter?: Filter | PrimaryRowFilter<T>[],
|
|
398
|
-
fetchingStrategy?: FS
|
|
399
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
400
|
-
getAll(): Promise<StrategyToRowArray<FetchedProperties<T, {}>, T>>;
|
|
401
|
-
getAll<FS extends FetchingStrategy<T>>(
|
|
402
|
-
fetchingStrategy: FS
|
|
403
|
-
): Promise<StrategyToRowArray<FetchedProperties<T, FS>, T>>;
|
|
404
|
-
|
|
405
|
-
aggregate<FS extends AggregateStrategy<T>>(
|
|
406
|
-
fetchingStrategy: FS
|
|
407
|
-
): Promise<StrategyToRowData<FetchedAggregateProperties<T, FS>>[]>;
|
|
408
|
-
|
|
409
|
-
count(filter?: Filter | PrimaryRowFilter<T>[]): Promise<number>;
|
|
410
|
-
delete(filter?: Filter | PrimaryRowFilter<T>[]): Promise<void>;
|
|
411
|
-
deleteCascade(filter?: Filter | PrimaryRowFilter<T>[]): Promise<void>;
|
|
412
|
-
|
|
413
|
-
proxify(
|
|
414
|
-
row: StrategyToInsertRowData<T>
|
|
415
|
-
): StrategyToRow<FetchedProperties<T, {}>, T>;
|
|
416
|
-
|
|
417
|
-
proxify(
|
|
418
|
-
row: StrategyToInsertRowData<T>[]
|
|
419
|
-
): StrategyToRowArray<FetchedProperties<T, {}>, T>;
|
|
420
|
-
|
|
421
|
-
proxify<FS extends FetchingStrategy<T>>(
|
|
422
|
-
row: StrategyToInsertRowData<T>,
|
|
423
|
-
strategy: FS
|
|
424
|
-
): StrategyToRow<FetchedProperties<T, FS>, T>;
|
|
425
|
-
|
|
426
|
-
proxify<FS extends FetchingStrategy<T>>(
|
|
427
|
-
row: StrategyToInsertRowData<T>[],
|
|
428
|
-
strategy: FS
|
|
429
|
-
): StrategyToRowArray<FetchedProperties<T, FS>, T>;
|
|
430
|
-
|
|
431
|
-
patch<C extends Concurrency<T>>(
|
|
432
|
-
patch: JsonPatch,
|
|
433
|
-
concurrency?: C
|
|
434
|
-
): Promise<void>;
|
|
435
|
-
|
|
436
|
-
tsType<FS extends FetchingStrategy<T>>(
|
|
437
|
-
strategy: FS
|
|
438
|
-
): StrategyToRowData<FetchedProperties<T, FS>>;
|
|
439
|
-
tsType(
|
|
440
|
-
): StrategyToRowData<FetchedProperties<T, {}>>;
|
|
441
|
-
|
|
442
|
-
readonly metaData: Concurrency<T>;
|
|
443
|
-
} & MappedColumnsAndRelations<T> &
|
|
444
|
-
GetById<T, CountProperties<ExtractPrimary<T>>>;
|
|
445
|
-
|
|
446
|
-
type GetById<T, Count extends number> = Count extends 1
|
|
447
|
-
? {
|
|
448
|
-
getById(
|
|
449
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>
|
|
450
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
451
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
452
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
453
|
-
fetchingStrategy: FS
|
|
454
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
455
|
-
}
|
|
456
|
-
: Count extends 2
|
|
457
|
-
? {
|
|
458
|
-
getById(
|
|
459
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
460
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>
|
|
461
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
462
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
463
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
464
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
465
|
-
fetchingStrategy: FS
|
|
466
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
467
|
-
}
|
|
468
|
-
: Count extends 3
|
|
469
|
-
? {
|
|
470
|
-
getById(
|
|
471
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
472
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
473
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>
|
|
474
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
475
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
476
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
477
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
478
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
479
|
-
fetchingStrategy: FS
|
|
480
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
481
|
-
}
|
|
482
|
-
: Count extends 4
|
|
483
|
-
? {
|
|
484
|
-
getById(
|
|
485
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
486
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
487
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
488
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>
|
|
489
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
490
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
491
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
492
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
493
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
494
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>,
|
|
495
|
-
fetchingStrategy: FS
|
|
496
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
497
|
-
}
|
|
498
|
-
: Count extends 5
|
|
499
|
-
? {
|
|
500
|
-
getById(
|
|
501
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
502
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
503
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
504
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>,
|
|
505
|
-
id5: ColumnToType<PickPropertyValue5<PickTypesOf<T, IsPrimary>>>
|
|
506
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
507
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
508
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
509
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
510
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
511
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>,
|
|
512
|
-
id5: ColumnToType<PickPropertyValue5<PickTypesOf<T, IsPrimary>>>,
|
|
513
|
-
fetchingStrategy: FS
|
|
514
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
515
|
-
}
|
|
516
|
-
: Count extends 6
|
|
517
|
-
? {
|
|
518
|
-
getById(
|
|
519
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
520
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
521
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
522
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>,
|
|
523
|
-
id5: ColumnToType<PickPropertyValue5<PickTypesOf<T, IsPrimary>>>,
|
|
524
|
-
id6: ColumnToType<PickPropertyValue6<PickTypesOf<T, IsPrimary>>>
|
|
525
|
-
): Promise<StrategyToRow<FetchedProperties<T, {}>, T>>;
|
|
526
|
-
getById<FS extends FetchingStrategy<T>>(
|
|
527
|
-
id: ColumnToType<PickPropertyValue1<PickTypesOf<T, IsPrimary>>>,
|
|
528
|
-
id2: ColumnToType<PickPropertyValue2<PickTypesOf<T, IsPrimary>>>,
|
|
529
|
-
id3: ColumnToType<PickPropertyValue3<PickTypesOf<T, IsPrimary>>>,
|
|
530
|
-
id4: ColumnToType<PickPropertyValue4<PickTypesOf<T, IsPrimary>>>,
|
|
531
|
-
id5: ColumnToType<PickPropertyValue5<PickTypesOf<T, IsPrimary>>>,
|
|
532
|
-
id6: ColumnToType<PickPropertyValue6<PickTypesOf<T, IsPrimary>>>,
|
|
533
|
-
fetchingStrategy: FS
|
|
534
|
-
): Promise<StrategyToRow<FetchedProperties<T, FS>, T>>;
|
|
535
|
-
}
|
|
536
|
-
: never;
|
|
537
98
|
|
|
538
99
|
type ColumnToType<T> = T extends UuidColumnSymbol
|
|
539
100
|
? string
|
|
@@ -555,44 +116,6 @@ type ColumnToType<T> = T extends UuidColumnSymbol
|
|
|
555
116
|
? JsonType
|
|
556
117
|
: never;
|
|
557
118
|
|
|
558
|
-
type MappedColumnsAndRelations<T> = RemoveNeverFlat<{
|
|
559
|
-
[K in keyof T]: T[K] extends StringColumnTypeDef<infer M>
|
|
560
|
-
? StringColumnType<M>
|
|
561
|
-
: T[K] extends UuidColumnTypeDef<infer M>
|
|
562
|
-
? UuidColumnType<M>
|
|
563
|
-
: T[K] extends NumericColumnTypeDef<infer M>
|
|
564
|
-
? NumericColumnType<M>
|
|
565
|
-
: T[K] extends DateColumnTypeDef<infer M>
|
|
566
|
-
? DateColumnType<M>
|
|
567
|
-
: T[K] extends DateWithTimeZoneColumnTypeDef<infer M>
|
|
568
|
-
? DateWithTimeZoneColumnType<M>
|
|
569
|
-
: T[K] extends BinaryColumnTypeDef<infer M>
|
|
570
|
-
? BinaryColumnType<M>
|
|
571
|
-
: T[K] extends BooleanColumnTypeDef<infer M>
|
|
572
|
-
? BooleanColumnType<M>
|
|
573
|
-
: T[K] extends JSONColumnTypeDef<infer M>
|
|
574
|
-
? JSONColumnType<M>
|
|
575
|
-
: T[K] extends ManyRelation
|
|
576
|
-
? MappedColumnsAndRelations<T[K]> &
|
|
577
|
-
ManyTable<T[K]> & OneOrJoinTable<T[K]>
|
|
578
|
-
: T[K] extends RelatedTable
|
|
579
|
-
? MappedColumnsAndRelations<T[K]> & OneOrJoinTable<T[K]>
|
|
580
|
-
: never;
|
|
581
|
-
}>;
|
|
582
|
-
|
|
583
|
-
type OneOrJoinTable<T> = ((
|
|
584
|
-
fn: (table: MappedColumnsAndRelations<T>) => RawFilter
|
|
585
|
-
) => Filter) & {
|
|
586
|
-
exists: () => Filter;
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
type ManyTable<T> = ((
|
|
590
|
-
) => Filter) & {
|
|
591
|
-
all(selector: (table: MappedColumnsAndRelations<T>) => RawFilter): Filter;
|
|
592
|
-
any(selector: (table: MappedColumnsAndRelations<T>) => RawFilter): Filter;
|
|
593
|
-
none(selector: (table: MappedColumnsAndRelations<T>) => RawFilter): Filter;
|
|
594
|
-
};
|
|
595
|
-
|
|
596
119
|
export type AllowedDbMap<T> = {
|
|
597
120
|
[P in keyof T]: T[P] extends MappedTableDef<infer U> ? T[P] : never;
|
|
598
121
|
};
|
|
@@ -605,64 +128,6 @@ type AllowedColumnsAndTablesConcurrency<T> = {
|
|
|
605
128
|
};
|
|
606
129
|
|
|
607
130
|
|
|
608
|
-
type FetchingStrategy<T> = FetchingStrategyBase<T> | AggType<T>
|
|
609
|
-
|
|
610
|
-
type AggregateStrategy<T> = AggregateStrategyBase<T> | AggType<T>
|
|
611
|
-
|
|
612
|
-
type AggType<T> = {
|
|
613
|
-
[name: string]: AggregationFunction<T>;
|
|
614
|
-
} & {
|
|
615
|
-
where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
type AggregateStrategyBase<T> =
|
|
619
|
-
{
|
|
620
|
-
limit?: number;
|
|
621
|
-
offset?: number;
|
|
622
|
-
where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
type FetchingStrategyBase<T, IsMany = true> =
|
|
627
|
-
{
|
|
628
|
-
[K in keyof T &
|
|
629
|
-
keyof RemoveNever<
|
|
630
|
-
AllowedColumnsAndTablesStrategy<T>
|
|
631
|
-
>]?: T[K] extends ColumnSymbols
|
|
632
|
-
? boolean
|
|
633
|
-
: boolean | FetchingStrategyBase<T[K], T[K] extends ManyRelation ? true: false> | AggType<T[K]>;
|
|
634
|
-
} &
|
|
635
|
-
(IsMany extends true ? {
|
|
636
|
-
limit?: number;
|
|
637
|
-
offset?: number;
|
|
638
|
-
orderBy?:
|
|
639
|
-
| OrderBy<Extract<keyof AllowedColumns<T>, string>>[]
|
|
640
|
-
| OrderBy<Extract<keyof AllowedColumns<T>, string>>;
|
|
641
|
-
where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
|
|
642
|
-
}
|
|
643
|
-
: {
|
|
644
|
-
where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
type ExtractAggregates<Agg> = {
|
|
648
|
-
[K in keyof Agg as
|
|
649
|
-
Required<Agg>[K] extends (agg: Aggregate<infer V>) => ColumnSymbols
|
|
650
|
-
? K extends 'where' ? never : K
|
|
651
|
-
: never
|
|
652
|
-
]: Agg[K] extends (agg: Aggregate<infer V>) => infer R ? R : never;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
type AggregationFunction<T> = (agg: Aggregate<T>) => ColumnSymbols;
|
|
656
|
-
|
|
657
|
-
type Aggregate<T> =
|
|
658
|
-
RelatedColumns<T> &
|
|
659
|
-
{
|
|
660
|
-
sum(fn: (x: AggregateColumns<T>) => NumericColumnSymbol): NumericColumnSymbol & NotNull;
|
|
661
|
-
avg(fn: (x: AggregateColumns<T>) => NumericColumnSymbol): NumericColumnSymbol & NotNull;
|
|
662
|
-
min(fn: (x: AggregateColumns<T>) => NumericColumnSymbol): NumericColumnSymbol & NotNull;
|
|
663
|
-
max(fn: (x: AggregateColumns<T>) => NumericColumnSymbol): NumericColumnSymbol & NotNull;
|
|
664
|
-
count(fn: (x: AggregateColumns<T>) => NumericColumnSymbol): NumericColumnSymbol & NotNull;
|
|
665
|
-
}
|
|
666
131
|
|
|
667
132
|
type RelatedColumns<T> = RemoveNeverFlat<{
|
|
668
133
|
[K in keyof T]:
|
|
@@ -738,8 +203,6 @@ type DbConcurrency<T> = {
|
|
|
738
203
|
type ConcurrencyValues = 'optimistic' | 'skipOnConflict' | 'overwrite';
|
|
739
204
|
|
|
740
205
|
|
|
741
|
-
type OrderBy<T extends string> = `${T} ${'asc' | 'desc'}` | T;
|
|
742
|
-
|
|
743
206
|
type RelatedTable = {
|
|
744
207
|
[' relatedTable']: boolean;
|
|
745
208
|
};
|
|
@@ -979,7 +442,6 @@ type MappedTableDefInit<T> = {
|
|
|
979
442
|
): MappedTableDef<T & V>;
|
|
980
443
|
} & T;
|
|
981
444
|
|
|
982
|
-
//todo
|
|
983
445
|
type MappedTableDef<T> = {
|
|
984
446
|
map<V extends AllowedColumnsAndTablesMap<V>>(
|
|
985
447
|
callback: (mapper: ColumnMapper<T>) => V
|
|
@@ -1017,33 +479,6 @@ type NullInsertProperties<T> = Pick<
|
|
|
1017
479
|
type ColumnTypes = ColumnSymbols;
|
|
1018
480
|
type ColumnAndTableTypes = ColumnSymbols | RelatedTable;
|
|
1019
481
|
|
|
1020
|
-
type StrategyToRow<T, U> = StrategyToRowData<T> & {
|
|
1021
|
-
saveChanges(): Promise<void>;
|
|
1022
|
-
saveChanges<C extends Concurrency<U>>(concurrency?: C): Promise<void>;
|
|
1023
|
-
acceptChanges(): void;
|
|
1024
|
-
clearChanges(): void;
|
|
1025
|
-
refresh(): Promise<void>;
|
|
1026
|
-
refresh<FS extends FetchingStrategy<U>>(
|
|
1027
|
-
fetchingStrategy?: FS
|
|
1028
|
-
): Promise<StrategyToRow<FetchedProperties<U, FS>, U>>;
|
|
1029
|
-
delete(): Promise<void>;
|
|
1030
|
-
delete(concurrency: Concurrency<U>): Promise<void>;
|
|
1031
|
-
};
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
type StrategyToRowArray<T, U> = StrategyToRowData<T>[] & {
|
|
1035
|
-
saveChanges(): Promise<void>;
|
|
1036
|
-
saveChanges<C extends Concurrency<U>>(concurrency?: C): Promise<void>;
|
|
1037
|
-
acceptChanges(): void;
|
|
1038
|
-
clearChanges(): void;
|
|
1039
|
-
refresh(): Promise<void>;
|
|
1040
|
-
refresh<FS extends FetchingStrategy<U>>(
|
|
1041
|
-
fetchingStrategy?: FS
|
|
1042
|
-
): Promise<StrategyToRowArray<FetchedProperties<U, FS>, U>>;
|
|
1043
|
-
delete(): Promise<void>;
|
|
1044
|
-
delete(concurrency: Concurrency<U>): Promise<void>;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
482
|
type JsonValue = null | boolean | number | string | JsonArray | JsonObject;
|
|
1048
483
|
|
|
1049
484
|
interface JsonArray extends Array<JsonValue> { }
|
|
@@ -1102,176 +537,6 @@ type ExtractColumnBools<T, TStrategy> = RemoveNever<{
|
|
|
1102
537
|
|
|
1103
538
|
type NegotiateNotNull<T> = T extends NotNull ? NotNull : {};
|
|
1104
539
|
|
|
1105
|
-
type FetchedProperties<T, TStrategy> = FetchedColumnProperties<T, TStrategy> & FetchedRelationProperties<T, TStrategy> & ExtractAggregates<TStrategy>
|
|
1106
|
-
type FetchedAggregateProperties<T, TStrategy> = ExtractAggregates<TStrategy>;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
type FetchedRelationProperties<T, TStrategy> = RemoveNeverFlat<{
|
|
1110
|
-
[K in keyof T]: K extends keyof TStrategy
|
|
1111
|
-
? TStrategy[K] extends true
|
|
1112
|
-
? T[K] extends ColumnSymbols
|
|
1113
|
-
? never
|
|
1114
|
-
: T[K] extends ManyRelation
|
|
1115
|
-
? FetchedProperties<T[K], {}> & ManyRelation
|
|
1116
|
-
: FetchedProperties<T[K], {}> & NegotiateNotNull<T[K]>
|
|
1117
|
-
: TStrategy[K] extends false
|
|
1118
|
-
? never
|
|
1119
|
-
: T[K] extends ManyRelation
|
|
1120
|
-
? FetchedProperties<T[K], TStrategy[K]> & ManyRelation
|
|
1121
|
-
: FetchedProperties<T[K], TStrategy[K]> & NegotiateNotNull<T[K]>
|
|
1122
|
-
: never;
|
|
1123
|
-
}>;
|
|
1124
|
-
|
|
1125
|
-
type FetchedColumnProperties<T, TStrategy> = RemoveNeverFlat<
|
|
1126
|
-
AtLeastOneTrue<ExtractColumnBools<T, TStrategy>> extends true
|
|
1127
|
-
? {
|
|
1128
|
-
[K in keyof T]: K extends keyof TStrategy
|
|
1129
|
-
? TStrategy[K] extends true
|
|
1130
|
-
? T[K] extends ColumnSymbols
|
|
1131
|
-
? T[K]
|
|
1132
|
-
: never
|
|
1133
|
-
: never
|
|
1134
|
-
: never;
|
|
1135
|
-
}
|
|
1136
|
-
: {
|
|
1137
|
-
[K in keyof T]: K extends keyof TStrategy
|
|
1138
|
-
? TStrategy[K] extends true
|
|
1139
|
-
? T[K] extends ColumnSymbols
|
|
1140
|
-
? T[K]
|
|
1141
|
-
: never
|
|
1142
|
-
: never
|
|
1143
|
-
: NegotiateDefaultStrategy<T[K]>;
|
|
1144
|
-
}
|
|
1145
|
-
>;
|
|
1146
|
-
|
|
1147
|
-
type StrategyToRowData<T> = {
|
|
1148
|
-
[K in keyof RemoveNever<
|
|
1149
|
-
NotNullProperties<T>
|
|
1150
|
-
>]: T[K] extends StringColumnSymbol
|
|
1151
|
-
? string
|
|
1152
|
-
: T[K] extends UuidColumnSymbol
|
|
1153
|
-
? string
|
|
1154
|
-
: T[K] extends NumericColumnSymbol
|
|
1155
|
-
? number
|
|
1156
|
-
: T[K] extends DateColumnSymbol
|
|
1157
|
-
? string | Date
|
|
1158
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
1159
|
-
? string | Date
|
|
1160
|
-
: T[K] extends BinaryColumnSymbol
|
|
1161
|
-
? string
|
|
1162
|
-
: T[K] extends BooleanColumnSymbol
|
|
1163
|
-
? boolean
|
|
1164
|
-
: T[K] extends JsonOf<infer M>
|
|
1165
|
-
? M
|
|
1166
|
-
: T[K] extends JSONColumnSymbol
|
|
1167
|
-
? JsonType
|
|
1168
|
-
: T[K] extends ManyRelation
|
|
1169
|
-
? StrategyToRowData<T[K]>[]
|
|
1170
|
-
: StrategyToRowData<T[K]>;
|
|
1171
|
-
} & {
|
|
1172
|
-
[K in keyof RemoveNever<
|
|
1173
|
-
NullProperties<T>
|
|
1174
|
-
>]?: T[K] extends StringColumnSymbol
|
|
1175
|
-
? string | null
|
|
1176
|
-
: T[K] extends UuidColumnSymbol
|
|
1177
|
-
? string | null
|
|
1178
|
-
: T[K] extends NumericColumnSymbol
|
|
1179
|
-
? number | null
|
|
1180
|
-
: T[K] extends DateColumnSymbol
|
|
1181
|
-
? string | Date | null
|
|
1182
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
1183
|
-
? string | Date | null
|
|
1184
|
-
: T[K] extends BinaryColumnSymbol
|
|
1185
|
-
? string | null
|
|
1186
|
-
: T[K] extends BooleanColumnSymbol
|
|
1187
|
-
? boolean | null
|
|
1188
|
-
: T[K] extends JsonOf<infer M>
|
|
1189
|
-
? M | null
|
|
1190
|
-
: T[K] extends JSONColumnSymbol
|
|
1191
|
-
? JsonType | null
|
|
1192
|
-
: T[K] extends ManyRelation
|
|
1193
|
-
? StrategyToRowData<T[K]>[]
|
|
1194
|
-
: StrategyToRowData<T[K]>;
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
type StrategyToUpdateRowData<T> = Omit<{
|
|
1198
|
-
[K in keyof T]?: T[K] extends StringColumnSymbol
|
|
1199
|
-
? string
|
|
1200
|
-
: T[K] extends UuidColumnSymbol
|
|
1201
|
-
? string
|
|
1202
|
-
: T[K] extends NumericColumnSymbol
|
|
1203
|
-
? number
|
|
1204
|
-
: T[K] extends DateColumnSymbol
|
|
1205
|
-
? string | Date
|
|
1206
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
1207
|
-
? string | Date
|
|
1208
|
-
: T[K] extends BinaryColumnSymbol
|
|
1209
|
-
? string
|
|
1210
|
-
: T[K] extends BooleanColumnSymbol
|
|
1211
|
-
? boolean
|
|
1212
|
-
: T[K] extends JsonOf<infer M>
|
|
1213
|
-
? M
|
|
1214
|
-
: T[K] extends JSONColumnSymbol
|
|
1215
|
-
? JsonType
|
|
1216
|
-
: T[K] extends ManyRelation
|
|
1217
|
-
? StrategyToInsertRowData<T[K]>[]
|
|
1218
|
-
: StrategyToInsertRowData<T[K]>;
|
|
1219
|
-
}, 'formulaDiscriminators' | 'columnDiscriminators' | ' notNull' | ' notNullExceptInsert' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1220
|
-
;
|
|
1221
|
-
|
|
1222
|
-
type StrategyToInsertRowData<T> = Omit<{
|
|
1223
|
-
[K in keyof RemoveNever<
|
|
1224
|
-
NotNullInsertProperties<T>
|
|
1225
|
-
>]: T[K] extends StringColumnSymbol
|
|
1226
|
-
? string
|
|
1227
|
-
: T[K] extends UuidColumnSymbol
|
|
1228
|
-
? string
|
|
1229
|
-
: T[K] extends NumericColumnSymbol
|
|
1230
|
-
? number
|
|
1231
|
-
: T[K] extends DateColumnSymbol
|
|
1232
|
-
? string | Date
|
|
1233
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
1234
|
-
? string | Date
|
|
1235
|
-
: T[K] extends BinaryColumnSymbol
|
|
1236
|
-
? string
|
|
1237
|
-
: T[K] extends BooleanColumnSymbol
|
|
1238
|
-
? boolean
|
|
1239
|
-
: T[K] extends JsonOf<infer M>
|
|
1240
|
-
? M
|
|
1241
|
-
: T[K] extends JSONColumnSymbol
|
|
1242
|
-
? JsonType
|
|
1243
|
-
: T[K] extends ManyRelation
|
|
1244
|
-
? StrategyToInsertRowData<T[K]>[]
|
|
1245
|
-
: StrategyToInsertRowData<T[K]>;
|
|
1246
|
-
} & {
|
|
1247
|
-
[K in keyof RemoveNever<
|
|
1248
|
-
NullInsertProperties<T>
|
|
1249
|
-
>]?: T[K] extends StringColumnSymbol
|
|
1250
|
-
? string | null
|
|
1251
|
-
: T[K] extends UuidColumnSymbol
|
|
1252
|
-
? string | null
|
|
1253
|
-
: T[K] extends NumericColumnSymbol
|
|
1254
|
-
? number | null
|
|
1255
|
-
: T[K] extends DateColumnSymbol
|
|
1256
|
-
? string | Date | null
|
|
1257
|
-
: T[K] extends DateWithTimeZoneColumnSymbol
|
|
1258
|
-
? string | Date | null
|
|
1259
|
-
: T[K] extends BinaryColumnSymbol
|
|
1260
|
-
? string | null
|
|
1261
|
-
: T[K] extends BooleanColumnSymbol
|
|
1262
|
-
? boolean | null
|
|
1263
|
-
: T[K] extends JsonOf<infer M>
|
|
1264
|
-
? M | null
|
|
1265
|
-
: T[K] extends JSONColumnSymbol
|
|
1266
|
-
? JsonType | null
|
|
1267
|
-
: T[K] extends ManyRelation
|
|
1268
|
-
? StrategyToInsertRowData<T[K]>[]
|
|
1269
|
-
: StrategyToInsertRowData<T[K]>;
|
|
1270
|
-
}, 'formulaDiscriminators' | 'columnDiscriminators' | ' notNull' | ' notNullExceptInsert' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1271
|
-
;
|
|
1272
|
-
|
|
1273
|
-
type NegotiateDefaultStrategy<T> = T extends ColumnSymbols ? T : never;
|
|
1274
|
-
|
|
1275
540
|
type RemoveNever<T> = {
|
|
1276
541
|
[K in keyof T as T[K] extends never ? never : K]: T[K] extends object
|
|
1277
542
|
? RemoveNever<T[K]>
|
|
@@ -1285,183 +550,54 @@ type RemoveNeverFlat<T> = {
|
|
|
1285
550
|
type UuidColumnSymbol = {
|
|
1286
551
|
[' isUuid']: true;
|
|
1287
552
|
};
|
|
1288
|
-
type UuidColumnType<M> =
|
|
1289
|
-
equal(value: string | null | undefined): Filter;
|
|
1290
|
-
eq(value: string | null | undefined): Filter;
|
|
1291
|
-
notEqual(value: string | null | undefined): Filter;
|
|
1292
|
-
ne(value: string | null | undefined): Filter;
|
|
1293
|
-
lessThan(value: string | null | undefined): Filter;
|
|
1294
|
-
lt(value: string | null | undefined): Filter;
|
|
1295
|
-
lessThanOrEqual(value: string | null | undefined): Filter;
|
|
1296
|
-
le(value: string | null | undefined): Filter;
|
|
1297
|
-
greaterThan(value: string | null | undefined): Filter;
|
|
1298
|
-
gt(value: string | null | undefined): Filter;
|
|
1299
|
-
greaterThanOrEqual(value: string | null | undefined): Filter;
|
|
1300
|
-
ge(value: string | null | undefined): Filter;
|
|
1301
|
-
between(from: string | null | undefined, to: string | null | undefined): Filter;
|
|
1302
|
-
in(values: Array<string | null | undefined>): Filter;
|
|
1303
|
-
} & M &
|
|
553
|
+
type UuidColumnType<M> = M &
|
|
1304
554
|
UuidColumnSymbol;
|
|
1305
555
|
|
|
1306
556
|
type BinaryColumnSymbol = {
|
|
1307
557
|
[' isBinary']: true;
|
|
1308
558
|
};
|
|
1309
|
-
type BinaryColumnType<M> =
|
|
1310
|
-
equal(value: string | null | undefined): Filter;
|
|
1311
|
-
eq(value: string | null | undefined): Filter;
|
|
1312
|
-
notEqual(value: string | null | undefined): Filter;
|
|
1313
|
-
ne(value: string | null | undefined): Filter;
|
|
1314
|
-
lessThan(value: string | null | undefined): Filter;
|
|
1315
|
-
lt(value: string | null | undefined): Filter;
|
|
1316
|
-
lessThanOrEqual(value: string | null | undefined): Filter;
|
|
1317
|
-
le(value: string | null | undefined): Filter;
|
|
1318
|
-
greaterThan(value: string | null | undefined): Filter;
|
|
1319
|
-
gt(value: string | null | undefined): Filter;
|
|
1320
|
-
greaterThanOrEqual(value: string | null | undefined): Filter;
|
|
1321
|
-
ge(value: string | null | undefined): Filter;
|
|
1322
|
-
between(from: string | null | undefined, to: string | null | undefined): Filter;
|
|
1323
|
-
in(values: Array<string | null | undefined>): Filter;
|
|
1324
|
-
} & M &
|
|
559
|
+
type BinaryColumnType<M> = M &
|
|
1325
560
|
BinaryColumnSymbol;
|
|
1326
561
|
|
|
1327
562
|
type BooleanColumnSymbol = {
|
|
1328
563
|
[' isBoolean']: true;
|
|
1329
564
|
};
|
|
1330
565
|
|
|
1331
|
-
type BooleanColumnType<M> =
|
|
1332
|
-
equal(value: boolean | null | undefined): Filter;
|
|
1333
|
-
eq(value: boolean | null | undefined): Filter;
|
|
1334
|
-
notEqual(value: boolean | null | undefined): Filter;
|
|
1335
|
-
ne(value: boolean | null | undefined): Filter;
|
|
1336
|
-
lessThan(value: boolean | null | undefined): Filter;
|
|
1337
|
-
lt(value: boolean | null | undefined): Filter;
|
|
1338
|
-
lessThanOrEqual(value: boolean | null | undefined): Filter;
|
|
1339
|
-
le(value: boolean | null | undefined): Filter;
|
|
1340
|
-
greaterThan(value: boolean | null | undefined): Filter;
|
|
1341
|
-
gt(value: boolean | null | undefined): Filter;
|
|
1342
|
-
greaterThanOrEqual(value: boolean | null | undefined): Filter;
|
|
1343
|
-
ge(value: boolean | null | undefined): Filter;
|
|
1344
|
-
between(from: boolean | null | undefined, to: boolean | null | undefined): Filter;
|
|
1345
|
-
in(values: Array<boolean | null | undefined>): Filter;
|
|
1346
|
-
} & M &
|
|
566
|
+
type BooleanColumnType<M> = M &
|
|
1347
567
|
BooleanColumnSymbol;
|
|
1348
568
|
|
|
1349
569
|
type DateColumnSymbol = {
|
|
1350
570
|
[' isDate']: true;
|
|
1351
571
|
};
|
|
1352
572
|
|
|
1353
|
-
type DateColumnType<M> =
|
|
1354
|
-
equal(value: string | Date | null | undefined): Filter;
|
|
1355
|
-
eq(value: string | Date | null | undefined): Filter;
|
|
1356
|
-
notEqual(value: string | Date | null | undefined): Filter;
|
|
1357
|
-
ne(value: string | Date | null | undefined): Filter;
|
|
1358
|
-
lessThan(value: string | Date | null | undefined): Filter;
|
|
1359
|
-
lt(value: string | Date | null | undefined): Filter;
|
|
1360
|
-
lessThanOrEqual(value: string | Date | null | undefined): Filter;
|
|
1361
|
-
le(value: string | Date | null | undefined): Filter;
|
|
1362
|
-
greaterThan(value: string | Date | null | undefined): Filter;
|
|
1363
|
-
gt(value: string | Date | null | undefined): Filter;
|
|
1364
|
-
greaterThanOrEqual(value: string | Date | null | undefined): Filter;
|
|
1365
|
-
ge(value: string | Date | null | undefined): Filter;
|
|
1366
|
-
between(from: string | Date, to: string | Date | null | undefined): Filter;
|
|
1367
|
-
in(values: Array<string | Date | null | undefined>): Filter;
|
|
1368
|
-
} & M &
|
|
573
|
+
type DateColumnType<M> = M &
|
|
1369
574
|
DateColumnSymbol;
|
|
1370
575
|
|
|
1371
576
|
type DateWithTimeZoneColumnSymbol = {
|
|
1372
577
|
[' isDateTimeZone']: true;
|
|
1373
578
|
};
|
|
1374
579
|
|
|
1375
|
-
type DateWithTimeZoneColumnType<M> =
|
|
1376
|
-
equal(value: string | Date | null | undefined): Filter;
|
|
1377
|
-
eq(value: string | Date | null | undefined): Filter;
|
|
1378
|
-
notEqual(value: string | Date | null | undefined): Filter;
|
|
1379
|
-
ne(value: string | Date | null | undefined): Filter;
|
|
1380
|
-
lessThan(value: string | Date | null | undefined): Filter;
|
|
1381
|
-
lt(value: string | Date | null | undefined): Filter;
|
|
1382
|
-
lessThanOrEqual(value: string | Date | null | undefined): Filter;
|
|
1383
|
-
le(value: string | Date | null | undefined): Filter;
|
|
1384
|
-
greaterThan(value: string | Date | null | undefined): Filter;
|
|
1385
|
-
gt(value: string | Date | null | undefined): Filter;
|
|
1386
|
-
greaterThanOrEqual(value: string | Date | null | undefined): Filter;
|
|
1387
|
-
ge(value: string | Date | null | undefined): Filter;
|
|
1388
|
-
between(from: string | Date, to: string | Date | null | undefined): Filter;
|
|
1389
|
-
in(values: Array<string | Date | null | undefined>): Filter;
|
|
1390
|
-
} & M &
|
|
580
|
+
type DateWithTimeZoneColumnType<M> = M &
|
|
1391
581
|
DateWithTimeZoneColumnSymbol;
|
|
1392
582
|
|
|
1393
583
|
type StringColumnSymbol = {
|
|
1394
584
|
[' isString']: true;
|
|
1395
585
|
};
|
|
1396
586
|
|
|
1397
|
-
type StringColumnType<M> =
|
|
1398
|
-
equal(value: string | null | undefined): Filter;
|
|
1399
|
-
eq(value: string | null | undefined): Filter;
|
|
1400
|
-
notEqual(value: string | null | undefined): Filter;
|
|
1401
|
-
ne(value: string | null | undefined): Filter;
|
|
1402
|
-
lessThan(value: string | null | undefined): Filter;
|
|
1403
|
-
lt(value: string | null | undefined): Filter;
|
|
1404
|
-
lessThanOrEqual(value: string | null | undefined): Filter;
|
|
1405
|
-
le(value: string | null | undefined): Filter;
|
|
1406
|
-
greaterThan(value: string | null | undefined): Filter;
|
|
1407
|
-
gt(value: string | null | undefined): Filter;
|
|
1408
|
-
greaterThanOrEqual(value: string | null | undefined): Filter;
|
|
1409
|
-
ge(value: string | null | undefined): Filter;
|
|
1410
|
-
between(from: string | null | undefined, to: string | null | undefined): Filter;
|
|
1411
|
-
in(values: Array<string | null | undefined>): Filter;
|
|
1412
|
-
|
|
1413
|
-
startsWith(value: string | null | undefined): Filter;
|
|
1414
|
-
endsWith(value: string | null | undefined): Filter;
|
|
1415
|
-
contains(value: string | null | undefined): Filter;
|
|
1416
|
-
iStartsWith(value: string | null | undefined): Filter;
|
|
1417
|
-
iEndsWith(value: string | null | undefined): Filter;
|
|
1418
|
-
iContains(value: string | null | undefined): Filter;
|
|
1419
|
-
iEqual(value: string | null | undefined): Filter;
|
|
1420
|
-
ieq(value: string | null | undefined): Filter;
|
|
1421
|
-
} & M &
|
|
587
|
+
type StringColumnType<M> = M &
|
|
1422
588
|
StringColumnSymbol;
|
|
1423
589
|
|
|
1424
590
|
type NumericColumnSymbol = {
|
|
1425
591
|
[' isNumeric']: true;
|
|
1426
592
|
};
|
|
1427
|
-
type NumericColumnType<M> =
|
|
1428
|
-
equal(value: number | null | undefined): Filter;
|
|
1429
|
-
eq(value: number | null | undefined): Filter;
|
|
1430
|
-
notEqual(value: number | null | undefined): Filter;
|
|
1431
|
-
ne(value: number | null | undefined): Filter;
|
|
1432
|
-
lessThan(value: number | null | undefined): Filter;
|
|
1433
|
-
lt(value: number | null | undefined): Filter;
|
|
1434
|
-
lessThanOrEqual(value: number | null | undefined): Filter;
|
|
1435
|
-
le(value: number | null | undefined): Filter;
|
|
1436
|
-
greaterThan(value: number | null | undefined): Filter;
|
|
1437
|
-
gt(value: number | null | undefined): Filter;
|
|
1438
|
-
greaterThanOrEqual(value: number | null | undefined): Filter;
|
|
1439
|
-
ge(value: number | null | undefined): Filter;
|
|
1440
|
-
between(from: number, to: number | null | undefined): Filter;
|
|
1441
|
-
in(values: Array<number | null | undefined>): Filter;
|
|
1442
|
-
} & M &
|
|
593
|
+
type NumericColumnType<M> = M &
|
|
1443
594
|
NumericColumnSymbol;
|
|
1444
595
|
|
|
1445
596
|
type JSONColumnSymbol = {
|
|
1446
597
|
[' isJSON']: true;
|
|
1447
598
|
};
|
|
1448
599
|
|
|
1449
|
-
type JSONColumnType<M> =
|
|
1450
|
-
equal(value: ToJsonType<M> | null | undefined): Filter;
|
|
1451
|
-
eq(value: ToJsonType<M> | null | undefined): Filter;
|
|
1452
|
-
notEqual(value: ToJsonType<M> | null | undefined): Filter;
|
|
1453
|
-
ne(value: ToJsonType<M> | null | undefined): Filter;
|
|
1454
|
-
lessThan(value: ToJsonType<M> | null | undefined): Filter;
|
|
1455
|
-
lt(value: ToJsonType<M> | null | undefined): Filter;
|
|
1456
|
-
lessThanOrEqual(value: ToJsonType<M> | null | undefined): Filter;
|
|
1457
|
-
le(value: ToJsonType<M> | null | undefined): Filter;
|
|
1458
|
-
greaterThan(value: ToJsonType<M> | null | undefined): Filter;
|
|
1459
|
-
gt(value: ToJsonType<M> | null | undefined): Filter;
|
|
1460
|
-
greaterThanOrEqual(value: ToJsonType<M> | null | undefined): Filter;
|
|
1461
|
-
ge(value: ToJsonType<M> | null | undefined): Filter;
|
|
1462
|
-
between(from: ToJsonType<M>, to: ToJsonType<M> | null | undefined): Filter;
|
|
1463
|
-
in(values: Array<ToJsonType<M> | null | undefined>): Filter;
|
|
1464
|
-
} & M &
|
|
600
|
+
type JSONColumnType<M> = M &
|
|
1465
601
|
JSONColumnSymbol;
|
|
1466
602
|
|
|
1467
603
|
interface IsPrimary {
|