@jspreddy/torq 0.1.32 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/module.d.ts +137 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +1105 -1138
- package/dist/module.js.map +1 -1
- package/package.json +14 -10
- package/tsdown.config.ts +15 -0
- package/dist/types.d.ts +0 -113
- package/dist/types.d.ts.map +0 -1
package/dist/module.js
CHANGED
|
@@ -1,1149 +1,1116 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// picked up from https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
//#region src/core/dynamo_reserved_words.ts
|
|
6
4
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
5
|
+
* These words are reserved in dynamodb and can not be used as part of expressions.
|
|
6
|
+
* If we need to use these words, then we will have to use expression attribute names concept.
|
|
7
|
+
*
|
|
8
|
+
* CASE INSENSITIVE
|
|
9
|
+
*/
|
|
10
|
+
const reserved = [
|
|
11
|
+
"ABORT",
|
|
12
|
+
"ABSOLUTE",
|
|
13
|
+
"ACTION",
|
|
14
|
+
"ADD",
|
|
15
|
+
"AFTER",
|
|
16
|
+
"AGENT",
|
|
17
|
+
"AGGREGATE",
|
|
18
|
+
"ALL",
|
|
19
|
+
"ALLOCATE",
|
|
20
|
+
"ALTER",
|
|
21
|
+
"ANALYZE",
|
|
22
|
+
"AND",
|
|
23
|
+
"ANY",
|
|
24
|
+
"ARCHIVE",
|
|
25
|
+
"ARE",
|
|
26
|
+
"ARRAY",
|
|
27
|
+
"AS",
|
|
28
|
+
"ASC",
|
|
29
|
+
"ASCII",
|
|
30
|
+
"ASENSITIVE",
|
|
31
|
+
"ASSERTION",
|
|
32
|
+
"ASYMMETRIC",
|
|
33
|
+
"AT",
|
|
34
|
+
"ATOMIC",
|
|
35
|
+
"ATTACH",
|
|
36
|
+
"ATTRIBUTE",
|
|
37
|
+
"AUTH",
|
|
38
|
+
"AUTHORIZATION",
|
|
39
|
+
"AUTHORIZE",
|
|
40
|
+
"AUTO",
|
|
41
|
+
"AVG",
|
|
42
|
+
"BACK",
|
|
43
|
+
"BACKUP",
|
|
44
|
+
"BASE",
|
|
45
|
+
"BATCH",
|
|
46
|
+
"BEFORE",
|
|
47
|
+
"BEGIN",
|
|
48
|
+
"BETWEEN",
|
|
49
|
+
"BIGINT",
|
|
50
|
+
"BINARY",
|
|
51
|
+
"BIT",
|
|
52
|
+
"BLOB",
|
|
53
|
+
"BLOCK",
|
|
54
|
+
"BOOLEAN",
|
|
55
|
+
"BOTH",
|
|
56
|
+
"BREADTH",
|
|
57
|
+
"BUCKET",
|
|
58
|
+
"BULK",
|
|
59
|
+
"BY",
|
|
60
|
+
"BYTE",
|
|
61
|
+
"CALL",
|
|
62
|
+
"CALLED",
|
|
63
|
+
"CALLING",
|
|
64
|
+
"CAPACITY",
|
|
65
|
+
"CASCADE",
|
|
66
|
+
"CASCADED",
|
|
67
|
+
"CASE",
|
|
68
|
+
"CAST",
|
|
69
|
+
"CATALOG",
|
|
70
|
+
"CHAR",
|
|
71
|
+
"CHARACTER",
|
|
72
|
+
"CHECK",
|
|
73
|
+
"CLASS",
|
|
74
|
+
"CLOB",
|
|
75
|
+
"CLOSE",
|
|
76
|
+
"CLUSTER",
|
|
77
|
+
"CLUSTERED",
|
|
78
|
+
"CLUSTERING",
|
|
79
|
+
"CLUSTERS",
|
|
80
|
+
"COALESCE",
|
|
81
|
+
"COLLATE",
|
|
82
|
+
"COLLATION",
|
|
83
|
+
"COLLECTION",
|
|
84
|
+
"COLUMN",
|
|
85
|
+
"COLUMNS",
|
|
86
|
+
"COMBINE",
|
|
87
|
+
"COMMENT",
|
|
88
|
+
"COMMIT",
|
|
89
|
+
"COMPACT",
|
|
90
|
+
"COMPILE",
|
|
91
|
+
"COMPRESS",
|
|
92
|
+
"CONDITION",
|
|
93
|
+
"CONFLICT",
|
|
94
|
+
"CONNECT",
|
|
95
|
+
"CONNECTION",
|
|
96
|
+
"CONSISTENCY",
|
|
97
|
+
"CONSISTENT",
|
|
98
|
+
"CONSTRAINT",
|
|
99
|
+
"CONSTRAINTS",
|
|
100
|
+
"CONSTRUCTOR",
|
|
101
|
+
"CONSUMED",
|
|
102
|
+
"CONTINUE",
|
|
103
|
+
"CONVERT",
|
|
104
|
+
"COPY",
|
|
105
|
+
"CORRESPONDING",
|
|
106
|
+
"COUNT",
|
|
107
|
+
"COUNTER",
|
|
108
|
+
"CREATE",
|
|
109
|
+
"CROSS",
|
|
110
|
+
"CUBE",
|
|
111
|
+
"CURRENT",
|
|
112
|
+
"CURSOR",
|
|
113
|
+
"CYCLE",
|
|
114
|
+
"DATA",
|
|
115
|
+
"DATABASE",
|
|
116
|
+
"DATE",
|
|
117
|
+
"DATETIME",
|
|
118
|
+
"DAY",
|
|
119
|
+
"DEALLOCATE",
|
|
120
|
+
"DEC",
|
|
121
|
+
"DECIMAL",
|
|
122
|
+
"DECLARE",
|
|
123
|
+
"DEFAULT",
|
|
124
|
+
"DEFERRABLE",
|
|
125
|
+
"DEFERRED",
|
|
126
|
+
"DEFINE",
|
|
127
|
+
"DEFINED",
|
|
128
|
+
"DEFINITION",
|
|
129
|
+
"DELETE",
|
|
130
|
+
"DELIMITED",
|
|
131
|
+
"DEPTH",
|
|
132
|
+
"DEREF",
|
|
133
|
+
"DESC",
|
|
134
|
+
"DESCRIBE",
|
|
135
|
+
"DESCRIPTOR",
|
|
136
|
+
"DETACH",
|
|
137
|
+
"DETERMINISTIC",
|
|
138
|
+
"DIAGNOSTICS",
|
|
139
|
+
"DIRECTORIES",
|
|
140
|
+
"DISABLE",
|
|
141
|
+
"DISCONNECT",
|
|
142
|
+
"DISTINCT",
|
|
143
|
+
"DISTRIBUTE",
|
|
144
|
+
"DO",
|
|
145
|
+
"DOMAIN",
|
|
146
|
+
"DOUBLE",
|
|
147
|
+
"DROP",
|
|
148
|
+
"DUMP",
|
|
149
|
+
"DURATION",
|
|
150
|
+
"DYNAMIC",
|
|
151
|
+
"EACH",
|
|
152
|
+
"ELEMENT",
|
|
153
|
+
"ELSE",
|
|
154
|
+
"ELSEIF",
|
|
155
|
+
"EMPTY",
|
|
156
|
+
"ENABLE",
|
|
157
|
+
"END",
|
|
158
|
+
"EQUAL",
|
|
159
|
+
"EQUALS",
|
|
160
|
+
"ERROR",
|
|
161
|
+
"ESCAPE",
|
|
162
|
+
"ESCAPED",
|
|
163
|
+
"EVAL",
|
|
164
|
+
"EVALUATE",
|
|
165
|
+
"EXCEEDED",
|
|
166
|
+
"EXCEPT",
|
|
167
|
+
"EXCEPTION",
|
|
168
|
+
"EXCEPTIONS",
|
|
169
|
+
"EXCLUSIVE",
|
|
170
|
+
"EXEC",
|
|
171
|
+
"EXECUTE",
|
|
172
|
+
"EXISTS",
|
|
173
|
+
"EXIT",
|
|
174
|
+
"EXPLAIN",
|
|
175
|
+
"EXPLODE",
|
|
176
|
+
"EXPORT",
|
|
177
|
+
"EXPRESSION",
|
|
178
|
+
"EXTENDED",
|
|
179
|
+
"EXTERNAL",
|
|
180
|
+
"EXTRACT",
|
|
181
|
+
"FAIL",
|
|
182
|
+
"FALSE",
|
|
183
|
+
"FAMILY",
|
|
184
|
+
"FETCH",
|
|
185
|
+
"FIELDS",
|
|
186
|
+
"FILE",
|
|
187
|
+
"FILTER",
|
|
188
|
+
"FILTERING",
|
|
189
|
+
"FINAL",
|
|
190
|
+
"FINISH",
|
|
191
|
+
"FIRST",
|
|
192
|
+
"FIXED",
|
|
193
|
+
"FLATTERN",
|
|
194
|
+
"FLOAT",
|
|
195
|
+
"FOR",
|
|
196
|
+
"FORCE",
|
|
197
|
+
"FOREIGN",
|
|
198
|
+
"FORMAT",
|
|
199
|
+
"FORWARD",
|
|
200
|
+
"FOUND",
|
|
201
|
+
"FREE",
|
|
202
|
+
"FROM",
|
|
203
|
+
"FULL",
|
|
204
|
+
"FUNCTION",
|
|
205
|
+
"FUNCTIONS",
|
|
206
|
+
"GENERAL",
|
|
207
|
+
"GENERATE",
|
|
208
|
+
"GET",
|
|
209
|
+
"GLOB",
|
|
210
|
+
"GLOBAL",
|
|
211
|
+
"GO",
|
|
212
|
+
"GOTO",
|
|
213
|
+
"GRANT",
|
|
214
|
+
"GREATER",
|
|
215
|
+
"GROUP",
|
|
216
|
+
"GROUPING",
|
|
217
|
+
"HANDLER",
|
|
218
|
+
"HASH",
|
|
219
|
+
"HAVE",
|
|
220
|
+
"HAVING",
|
|
221
|
+
"HEAP",
|
|
222
|
+
"HIDDEN",
|
|
223
|
+
"HOLD",
|
|
224
|
+
"HOUR",
|
|
225
|
+
"IDENTIFIED",
|
|
226
|
+
"IDENTITY",
|
|
227
|
+
"IF",
|
|
228
|
+
"IGNORE",
|
|
229
|
+
"IMMEDIATE",
|
|
230
|
+
"IMPORT",
|
|
231
|
+
"IN",
|
|
232
|
+
"INCLUDING",
|
|
233
|
+
"INCLUSIVE",
|
|
234
|
+
"INCREMENT",
|
|
235
|
+
"INCREMENTAL",
|
|
236
|
+
"INDEX",
|
|
237
|
+
"INDEXED",
|
|
238
|
+
"INDEXES",
|
|
239
|
+
"INDICATOR",
|
|
240
|
+
"INFINITE",
|
|
241
|
+
"INITIALLY",
|
|
242
|
+
"INLINE",
|
|
243
|
+
"INNER",
|
|
244
|
+
"INNTER",
|
|
245
|
+
"INOUT",
|
|
246
|
+
"INPUT",
|
|
247
|
+
"INSENSITIVE",
|
|
248
|
+
"INSERT",
|
|
249
|
+
"INSTEAD",
|
|
250
|
+
"INT",
|
|
251
|
+
"INTEGER",
|
|
252
|
+
"INTERSECT",
|
|
253
|
+
"INTERVAL",
|
|
254
|
+
"INTO",
|
|
255
|
+
"INVALIDATE",
|
|
256
|
+
"IS",
|
|
257
|
+
"ISOLATION",
|
|
258
|
+
"ITEM",
|
|
259
|
+
"ITEMS",
|
|
260
|
+
"ITERATE",
|
|
261
|
+
"JOIN",
|
|
262
|
+
"KEY",
|
|
263
|
+
"KEYS",
|
|
264
|
+
"LAG",
|
|
265
|
+
"LANGUAGE",
|
|
266
|
+
"LARGE",
|
|
267
|
+
"LAST",
|
|
268
|
+
"LATERAL",
|
|
269
|
+
"LEAD",
|
|
270
|
+
"LEADING",
|
|
271
|
+
"LEAVE",
|
|
272
|
+
"LEFT",
|
|
273
|
+
"LENGTH",
|
|
274
|
+
"LESS",
|
|
275
|
+
"LEVEL",
|
|
276
|
+
"LIKE",
|
|
277
|
+
"LIMIT",
|
|
278
|
+
"LIMITED",
|
|
279
|
+
"LINES",
|
|
280
|
+
"LIST",
|
|
281
|
+
"LOAD",
|
|
282
|
+
"LOCAL",
|
|
283
|
+
"LOCALTIME",
|
|
284
|
+
"LOCALTIMESTAMP",
|
|
285
|
+
"LOCATION",
|
|
286
|
+
"LOCATOR",
|
|
287
|
+
"LOCK",
|
|
288
|
+
"LOCKS",
|
|
289
|
+
"LOG",
|
|
290
|
+
"LOGED",
|
|
291
|
+
"LONG",
|
|
292
|
+
"LOOP",
|
|
293
|
+
"LOWER",
|
|
294
|
+
"MAP",
|
|
295
|
+
"MATCH",
|
|
296
|
+
"MATERIALIZED",
|
|
297
|
+
"MAX",
|
|
298
|
+
"MAXLEN",
|
|
299
|
+
"MEMBER",
|
|
300
|
+
"MERGE",
|
|
301
|
+
"METHOD",
|
|
302
|
+
"METRICS",
|
|
303
|
+
"MIN",
|
|
304
|
+
"MINUS",
|
|
305
|
+
"MINUTE",
|
|
306
|
+
"MISSING",
|
|
307
|
+
"MOD",
|
|
308
|
+
"MODE",
|
|
309
|
+
"MODIFIES",
|
|
310
|
+
"MODIFY",
|
|
311
|
+
"MODULE",
|
|
312
|
+
"MONTH",
|
|
313
|
+
"MULTI",
|
|
314
|
+
"MULTISET",
|
|
315
|
+
"NAME",
|
|
316
|
+
"NAMES",
|
|
317
|
+
"NATIONAL",
|
|
318
|
+
"NATURAL",
|
|
319
|
+
"NCHAR",
|
|
320
|
+
"NCLOB",
|
|
321
|
+
"NEW",
|
|
322
|
+
"NEXT",
|
|
323
|
+
"NO",
|
|
324
|
+
"NONE",
|
|
325
|
+
"NOT",
|
|
326
|
+
"NULL",
|
|
327
|
+
"NULLIF",
|
|
328
|
+
"NUMBER",
|
|
329
|
+
"NUMERIC",
|
|
330
|
+
"OBJECT",
|
|
331
|
+
"OF",
|
|
332
|
+
"OFFLINE",
|
|
333
|
+
"OFFSET",
|
|
334
|
+
"OLD",
|
|
335
|
+
"ON",
|
|
336
|
+
"ONLINE",
|
|
337
|
+
"ONLY",
|
|
338
|
+
"OPAQUE",
|
|
339
|
+
"OPEN",
|
|
340
|
+
"OPERATOR",
|
|
341
|
+
"OPTION",
|
|
342
|
+
"OR",
|
|
343
|
+
"ORDER",
|
|
344
|
+
"ORDINALITY",
|
|
345
|
+
"OTHER",
|
|
346
|
+
"OTHERS",
|
|
347
|
+
"OUT",
|
|
348
|
+
"OUTER",
|
|
349
|
+
"OUTPUT",
|
|
350
|
+
"OVER",
|
|
351
|
+
"OVERLAPS",
|
|
352
|
+
"OVERRIDE",
|
|
353
|
+
"OWNER",
|
|
354
|
+
"PAD",
|
|
355
|
+
"PARALLEL",
|
|
356
|
+
"PARAMETER",
|
|
357
|
+
"PARAMETERS",
|
|
358
|
+
"PARTIAL",
|
|
359
|
+
"PARTITION",
|
|
360
|
+
"PARTITIONED",
|
|
361
|
+
"PARTITIONS",
|
|
362
|
+
"PATH",
|
|
363
|
+
"PERCENT",
|
|
364
|
+
"PERCENTILE",
|
|
365
|
+
"PERMISSION",
|
|
366
|
+
"PERMISSIONS",
|
|
367
|
+
"PIPE",
|
|
368
|
+
"PIPELINED",
|
|
369
|
+
"PLAN",
|
|
370
|
+
"POOL",
|
|
371
|
+
"POSITION",
|
|
372
|
+
"PRECISION",
|
|
373
|
+
"PREPARE",
|
|
374
|
+
"PRESERVE",
|
|
375
|
+
"PRIMARY",
|
|
376
|
+
"PRIOR",
|
|
377
|
+
"PRIVATE",
|
|
378
|
+
"PRIVILEGES",
|
|
379
|
+
"PROCEDURE",
|
|
380
|
+
"PROCESSED",
|
|
381
|
+
"PROJECT",
|
|
382
|
+
"PROJECTION",
|
|
383
|
+
"PROPERTY",
|
|
384
|
+
"PROVISIONING",
|
|
385
|
+
"PUBLIC",
|
|
386
|
+
"PUT",
|
|
387
|
+
"QUERY",
|
|
388
|
+
"QUIT",
|
|
389
|
+
"QUORUM",
|
|
390
|
+
"RAISE",
|
|
391
|
+
"RANDOM",
|
|
392
|
+
"RANGE",
|
|
393
|
+
"RANK",
|
|
394
|
+
"RAW",
|
|
395
|
+
"READ",
|
|
396
|
+
"READS",
|
|
397
|
+
"REAL",
|
|
398
|
+
"REBUILD",
|
|
399
|
+
"RECORD",
|
|
400
|
+
"RECURSIVE",
|
|
401
|
+
"REDUCE",
|
|
402
|
+
"REF",
|
|
403
|
+
"REFERENCE",
|
|
404
|
+
"REFERENCES",
|
|
405
|
+
"REFERENCING",
|
|
406
|
+
"REGEXP",
|
|
407
|
+
"REGION",
|
|
408
|
+
"REINDEX",
|
|
409
|
+
"RELATIVE",
|
|
410
|
+
"RELEASE",
|
|
411
|
+
"REMAINDER",
|
|
412
|
+
"RENAME",
|
|
413
|
+
"REPEAT",
|
|
414
|
+
"REPLACE",
|
|
415
|
+
"REQUEST",
|
|
416
|
+
"RESET",
|
|
417
|
+
"RESIGNAL",
|
|
418
|
+
"RESOURCE",
|
|
419
|
+
"RESPONSE",
|
|
420
|
+
"RESTORE",
|
|
421
|
+
"RESTRICT",
|
|
422
|
+
"RESULT",
|
|
423
|
+
"RETURN",
|
|
424
|
+
"RETURNING",
|
|
425
|
+
"RETURNS",
|
|
426
|
+
"REVERSE",
|
|
427
|
+
"REVOKE",
|
|
428
|
+
"RIGHT",
|
|
429
|
+
"ROLE",
|
|
430
|
+
"ROLES",
|
|
431
|
+
"ROLLBACK",
|
|
432
|
+
"ROLLUP",
|
|
433
|
+
"ROUTINE",
|
|
434
|
+
"ROW",
|
|
435
|
+
"ROWS",
|
|
436
|
+
"RULE",
|
|
437
|
+
"RULES",
|
|
438
|
+
"SAMPLE",
|
|
439
|
+
"SATISFIES",
|
|
440
|
+
"SAVE",
|
|
441
|
+
"SAVEPOINT",
|
|
442
|
+
"SCAN",
|
|
443
|
+
"SCHEMA",
|
|
444
|
+
"SCOPE",
|
|
445
|
+
"SCROLL",
|
|
446
|
+
"SEARCH",
|
|
447
|
+
"SECOND",
|
|
448
|
+
"SECTION",
|
|
449
|
+
"SEGMENT",
|
|
450
|
+
"SEGMENTS",
|
|
451
|
+
"SELECT",
|
|
452
|
+
"SELF",
|
|
453
|
+
"SEMI",
|
|
454
|
+
"SENSITIVE",
|
|
455
|
+
"SEPARATE",
|
|
456
|
+
"SEQUENCE",
|
|
457
|
+
"SERIALIZABLE",
|
|
458
|
+
"SESSION",
|
|
459
|
+
"SET",
|
|
460
|
+
"SETS",
|
|
461
|
+
"SHARD",
|
|
462
|
+
"SHARE",
|
|
463
|
+
"SHARED",
|
|
464
|
+
"SHORT",
|
|
465
|
+
"SHOW",
|
|
466
|
+
"SIGNAL",
|
|
467
|
+
"SIMILAR",
|
|
468
|
+
"SIZE",
|
|
469
|
+
"SKEWED",
|
|
470
|
+
"SMALLINT",
|
|
471
|
+
"SNAPSHOT",
|
|
472
|
+
"SOME",
|
|
473
|
+
"SOURCE",
|
|
474
|
+
"SPACE",
|
|
475
|
+
"SPACES",
|
|
476
|
+
"SPARSE",
|
|
477
|
+
"SPECIFIC",
|
|
478
|
+
"SPECIFICTYPE",
|
|
479
|
+
"SPLIT",
|
|
480
|
+
"SQL",
|
|
481
|
+
"SQLCODE",
|
|
482
|
+
"SQLERROR",
|
|
483
|
+
"SQLEXCEPTION",
|
|
484
|
+
"SQLSTATE",
|
|
485
|
+
"SQLWARNING",
|
|
486
|
+
"START",
|
|
487
|
+
"STATE",
|
|
488
|
+
"STATIC",
|
|
489
|
+
"STATUS",
|
|
490
|
+
"STORAGE",
|
|
491
|
+
"STORE",
|
|
492
|
+
"STORED",
|
|
493
|
+
"STREAM",
|
|
494
|
+
"STRING",
|
|
495
|
+
"STRUCT",
|
|
496
|
+
"STYLE",
|
|
497
|
+
"SUB",
|
|
498
|
+
"SUBMULTISET",
|
|
499
|
+
"SUBPARTITION",
|
|
500
|
+
"SUBSTRING",
|
|
501
|
+
"SUBTYPE",
|
|
502
|
+
"SUM",
|
|
503
|
+
"SUPER",
|
|
504
|
+
"SYMMETRIC",
|
|
505
|
+
"SYNONYM",
|
|
506
|
+
"SYSTEM",
|
|
507
|
+
"TABLE",
|
|
508
|
+
"TABLESAMPLE",
|
|
509
|
+
"TEMP",
|
|
510
|
+
"TEMPORARY",
|
|
511
|
+
"TERMINATED",
|
|
512
|
+
"TEXT",
|
|
513
|
+
"THAN",
|
|
514
|
+
"THEN",
|
|
515
|
+
"THROUGHPUT",
|
|
516
|
+
"TIME",
|
|
517
|
+
"TIMESTAMP",
|
|
518
|
+
"TIMEZONE",
|
|
519
|
+
"TINYINT",
|
|
520
|
+
"TO",
|
|
521
|
+
"TOKEN",
|
|
522
|
+
"TOTAL",
|
|
523
|
+
"TOUCH",
|
|
524
|
+
"TRAILING",
|
|
525
|
+
"TRANSACTION",
|
|
526
|
+
"TRANSFORM",
|
|
527
|
+
"TRANSLATE",
|
|
528
|
+
"TRANSLATION",
|
|
529
|
+
"TREAT",
|
|
530
|
+
"TRIGGER",
|
|
531
|
+
"TRIM",
|
|
532
|
+
"TRUE",
|
|
533
|
+
"TRUNCATE",
|
|
534
|
+
"TTL",
|
|
535
|
+
"TUPLE",
|
|
536
|
+
"TYPE",
|
|
537
|
+
"UNDER",
|
|
538
|
+
"UNDO",
|
|
539
|
+
"UNION",
|
|
540
|
+
"UNIQUE",
|
|
541
|
+
"UNIT",
|
|
542
|
+
"UNKNOWN",
|
|
543
|
+
"UNLOGGED",
|
|
544
|
+
"UNNEST",
|
|
545
|
+
"UNPROCESSED",
|
|
546
|
+
"UNSIGNED",
|
|
547
|
+
"UNTIL",
|
|
548
|
+
"UPDATE",
|
|
549
|
+
"UPPER",
|
|
550
|
+
"URL",
|
|
551
|
+
"USAGE",
|
|
552
|
+
"USE",
|
|
553
|
+
"USER",
|
|
554
|
+
"USERS",
|
|
555
|
+
"USING",
|
|
556
|
+
"UUID",
|
|
557
|
+
"VACUUM",
|
|
558
|
+
"VALUE",
|
|
559
|
+
"VALUED",
|
|
560
|
+
"VALUES",
|
|
561
|
+
"VARCHAR",
|
|
562
|
+
"VARIABLE",
|
|
563
|
+
"VARIANCE",
|
|
564
|
+
"VARINT",
|
|
565
|
+
"VARYING",
|
|
566
|
+
"VIEW",
|
|
567
|
+
"VIEWS",
|
|
568
|
+
"VIRTUAL",
|
|
569
|
+
"VOID",
|
|
570
|
+
"WAIT",
|
|
571
|
+
"WHEN",
|
|
572
|
+
"WHENEVER",
|
|
573
|
+
"WHERE",
|
|
574
|
+
"WHILE",
|
|
575
|
+
"WINDOW",
|
|
576
|
+
"WITH",
|
|
577
|
+
"WITHIN",
|
|
578
|
+
"WITHOUT",
|
|
579
|
+
"WORK",
|
|
580
|
+
"WRAPPED",
|
|
581
|
+
"WRITE",
|
|
582
|
+
"YEAR",
|
|
583
|
+
"ZONE"
|
|
585
584
|
];
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/core/Query.ts
|
|
587
|
+
/**
|
|
588
|
+
* Type of attributes accepted by dynamo db.
|
|
589
|
+
*/
|
|
590
|
+
let DdbType = /* @__PURE__ */ function(DdbType) {
|
|
591
|
+
DdbType["String"] = "S";
|
|
592
|
+
DdbType["StringSet"] = "SS";
|
|
593
|
+
DdbType["Number"] = "N";
|
|
594
|
+
DdbType["NumberSet"] = "NS";
|
|
595
|
+
DdbType["Binary"] = "B";
|
|
596
|
+
DdbType["BinarySet"] = "BS";
|
|
597
|
+
DdbType["Boolean"] = "BOOL";
|
|
598
|
+
DdbType["Null"] = "NULL";
|
|
599
|
+
DdbType["List"] = "L";
|
|
600
|
+
DdbType["Map"] = "M";
|
|
601
|
+
return DdbType;
|
|
601
602
|
}({});
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
603
|
+
let Operation = /* @__PURE__ */ function(Operation) {
|
|
604
|
+
Operation["Eq"] = "=";
|
|
605
|
+
Operation["NotEq"] = "<>";
|
|
606
|
+
Operation["Gt"] = ">";
|
|
607
|
+
Operation["GtEq"] = ">=";
|
|
608
|
+
Operation["Lt"] = "<";
|
|
609
|
+
Operation["LtEq"] = "<=";
|
|
610
|
+
return Operation;
|
|
610
611
|
}({});
|
|
611
|
-
class
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
ReturnConsumedCapacity: this._consumedCapacity
|
|
892
|
-
}, (0, $6B8p2$lodash).isNil);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
const $1ced42141bbfde9c$var$isReserved = (name)=>{
|
|
896
|
-
// Does the upper cased "name" exists in the reserved words list.
|
|
897
|
-
return (0, $6B8p2$lodash).indexOf((0, $8377f7c5fcf1cce8$export$e46d647da3214494), (0, $6B8p2$lodash).toUpper(name)) != -1;
|
|
612
|
+
var Query = class Query {
|
|
613
|
+
static {
|
|
614
|
+
this.DEFAULT_LIMIT = 25;
|
|
615
|
+
}
|
|
616
|
+
get state() {
|
|
617
|
+
return {
|
|
618
|
+
tableName: this._tableName,
|
|
619
|
+
hashKey: this._hashKey,
|
|
620
|
+
rangeKey: this._rangeKey,
|
|
621
|
+
mode: this._mode,
|
|
622
|
+
selections: this._selections,
|
|
623
|
+
keys: this._keys,
|
|
624
|
+
filters: this._filters,
|
|
625
|
+
index: this._index,
|
|
626
|
+
scanForward: this._scanForward,
|
|
627
|
+
limit: this._limit,
|
|
628
|
+
count: this._count,
|
|
629
|
+
startAfter: this._startAfter,
|
|
630
|
+
consumedCapacity: this._consumedCapacity
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
constructor(table) {
|
|
634
|
+
this._limit = Query.DEFAULT_LIMIT;
|
|
635
|
+
this._count = false;
|
|
636
|
+
this._tableName = table.name;
|
|
637
|
+
this._hashKey = table.hashKey;
|
|
638
|
+
this._rangeKey = table.rangeKey;
|
|
639
|
+
this._filters = [];
|
|
640
|
+
this._keys = [];
|
|
641
|
+
this._selections = [];
|
|
642
|
+
this._rawFilters = [];
|
|
643
|
+
}
|
|
644
|
+
select(cols) {
|
|
645
|
+
throwIfModeExists(this._mode);
|
|
646
|
+
this._selections = cols;
|
|
647
|
+
this._mode = "select";
|
|
648
|
+
return this;
|
|
649
|
+
}
|
|
650
|
+
scan(cols) {
|
|
651
|
+
throwIfModeExists(this._mode);
|
|
652
|
+
this._selections = cols;
|
|
653
|
+
this._mode = "scan";
|
|
654
|
+
return this;
|
|
655
|
+
}
|
|
656
|
+
count() {
|
|
657
|
+
throwIfModeExists(this._mode);
|
|
658
|
+
this._count = true;
|
|
659
|
+
this._mode = "count";
|
|
660
|
+
return this;
|
|
661
|
+
}
|
|
662
|
+
get where() {
|
|
663
|
+
assert(this._mode !== "scan", "Query.where: Cannot use \"where\" clause with scan(), use \"filter\" instead.");
|
|
664
|
+
const pushRangeKey = (val, type) => {
|
|
665
|
+
if (_.isNil(this._index)) {
|
|
666
|
+
assert(_.isString(this._rangeKey) && _.size(this._rangeKey) > 0, "Query.where.range: Table does not have a rangeKey");
|
|
667
|
+
this._keys.push({
|
|
668
|
+
key: this._rangeKey,
|
|
669
|
+
val,
|
|
670
|
+
type
|
|
671
|
+
});
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
assert(_.isString(this._index.rangeKey) && _.size(this._index.rangeKey) > 0, "Query.where.range: Provided Index does not have a rangeKey");
|
|
675
|
+
this._keys.push({
|
|
676
|
+
key: this._index.rangeKey,
|
|
677
|
+
val,
|
|
678
|
+
type
|
|
679
|
+
});
|
|
680
|
+
};
|
|
681
|
+
return {
|
|
682
|
+
hash: { eq: (val) => {
|
|
683
|
+
if (_.isNil(this._index)) {
|
|
684
|
+
this._keys.push({
|
|
685
|
+
key: this._hashKey,
|
|
686
|
+
val,
|
|
687
|
+
type: "hash-eq"
|
|
688
|
+
});
|
|
689
|
+
return this;
|
|
690
|
+
}
|
|
691
|
+
assert(_.isString(this._index?.hashKey) && _.size(this._index.hashKey) > 0, "Query.where.hash: Provided Index does not have a hashKey");
|
|
692
|
+
this._keys.push({
|
|
693
|
+
key: this._index.hashKey,
|
|
694
|
+
val,
|
|
695
|
+
type: "hash-eq"
|
|
696
|
+
});
|
|
697
|
+
return this;
|
|
698
|
+
} },
|
|
699
|
+
range: {
|
|
700
|
+
eq: (val) => {
|
|
701
|
+
pushRangeKey(val, "eq");
|
|
702
|
+
return this;
|
|
703
|
+
},
|
|
704
|
+
beginsWith: (val) => {
|
|
705
|
+
pushRangeKey(val, "begins_with");
|
|
706
|
+
return this;
|
|
707
|
+
},
|
|
708
|
+
gt: (val) => {
|
|
709
|
+
pushRangeKey(val, "gt");
|
|
710
|
+
return this;
|
|
711
|
+
},
|
|
712
|
+
gtEq: (val) => {
|
|
713
|
+
pushRangeKey(val, "gtEq");
|
|
714
|
+
return this;
|
|
715
|
+
},
|
|
716
|
+
lt: (val) => {
|
|
717
|
+
pushRangeKey(val, "lt");
|
|
718
|
+
return this;
|
|
719
|
+
},
|
|
720
|
+
ltEq: (val) => {
|
|
721
|
+
pushRangeKey(val, "ltEq");
|
|
722
|
+
return this;
|
|
723
|
+
},
|
|
724
|
+
between: (start, end) => {
|
|
725
|
+
pushRangeKey({
|
|
726
|
+
start,
|
|
727
|
+
end
|
|
728
|
+
}, "between");
|
|
729
|
+
return this;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
get filter() {
|
|
735
|
+
return {
|
|
736
|
+
eq: (key, val) => {
|
|
737
|
+
this._filters.push({
|
|
738
|
+
key,
|
|
739
|
+
val,
|
|
740
|
+
type: "eq"
|
|
741
|
+
});
|
|
742
|
+
return this;
|
|
743
|
+
},
|
|
744
|
+
notEq: (key, val) => {
|
|
745
|
+
this._filters.push({
|
|
746
|
+
key,
|
|
747
|
+
val,
|
|
748
|
+
type: "notEq"
|
|
749
|
+
});
|
|
750
|
+
return this;
|
|
751
|
+
},
|
|
752
|
+
gt: (key, val) => {
|
|
753
|
+
this._filters.push({
|
|
754
|
+
key,
|
|
755
|
+
val,
|
|
756
|
+
type: "gt"
|
|
757
|
+
});
|
|
758
|
+
return this;
|
|
759
|
+
},
|
|
760
|
+
gtEq: (key, val) => {
|
|
761
|
+
this._filters.push({
|
|
762
|
+
key,
|
|
763
|
+
val,
|
|
764
|
+
type: "gtEq"
|
|
765
|
+
});
|
|
766
|
+
return this;
|
|
767
|
+
},
|
|
768
|
+
lt: (key, val) => {
|
|
769
|
+
this._filters.push({
|
|
770
|
+
key,
|
|
771
|
+
val,
|
|
772
|
+
type: "lt"
|
|
773
|
+
});
|
|
774
|
+
return this;
|
|
775
|
+
},
|
|
776
|
+
ltEq: (key, val) => {
|
|
777
|
+
this._filters.push({
|
|
778
|
+
key,
|
|
779
|
+
val,
|
|
780
|
+
type: "ltEq"
|
|
781
|
+
});
|
|
782
|
+
return this;
|
|
783
|
+
},
|
|
784
|
+
beginsWith: (key, val) => {
|
|
785
|
+
this._filters.push({
|
|
786
|
+
key,
|
|
787
|
+
val,
|
|
788
|
+
type: "begins_with"
|
|
789
|
+
});
|
|
790
|
+
return this;
|
|
791
|
+
},
|
|
792
|
+
attributeExists: (key) => {
|
|
793
|
+
this._filters.push({
|
|
794
|
+
key,
|
|
795
|
+
type: "attribute_exists"
|
|
796
|
+
});
|
|
797
|
+
return this;
|
|
798
|
+
},
|
|
799
|
+
attributeNotExists: (key) => {
|
|
800
|
+
this._filters.push({
|
|
801
|
+
key,
|
|
802
|
+
type: "attribute_not_exists"
|
|
803
|
+
});
|
|
804
|
+
return this;
|
|
805
|
+
},
|
|
806
|
+
attributeType: (key, val) => {
|
|
807
|
+
this._filters.push({
|
|
808
|
+
key,
|
|
809
|
+
val,
|
|
810
|
+
type: "attribute_type"
|
|
811
|
+
});
|
|
812
|
+
return this;
|
|
813
|
+
},
|
|
814
|
+
contains: (key, val) => {
|
|
815
|
+
this._filters.push({
|
|
816
|
+
key,
|
|
817
|
+
val,
|
|
818
|
+
type: "contains"
|
|
819
|
+
});
|
|
820
|
+
return this;
|
|
821
|
+
},
|
|
822
|
+
size: (key, op, val) => {
|
|
823
|
+
this._filters.push({
|
|
824
|
+
key,
|
|
825
|
+
val: {
|
|
826
|
+
val,
|
|
827
|
+
op
|
|
828
|
+
},
|
|
829
|
+
type: "size"
|
|
830
|
+
});
|
|
831
|
+
return this;
|
|
832
|
+
},
|
|
833
|
+
between: (key, start, end) => {
|
|
834
|
+
this._filters.push({
|
|
835
|
+
key,
|
|
836
|
+
val: {
|
|
837
|
+
start,
|
|
838
|
+
end
|
|
839
|
+
},
|
|
840
|
+
type: "between"
|
|
841
|
+
});
|
|
842
|
+
return this;
|
|
843
|
+
},
|
|
844
|
+
raw: (filterCondition, replacements) => {
|
|
845
|
+
this._rawFilters.push({
|
|
846
|
+
condition: filterCondition,
|
|
847
|
+
replacements
|
|
848
|
+
});
|
|
849
|
+
return this;
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
using(index, scanForward = void 0) {
|
|
854
|
+
assert(typeof scanForward === "boolean" || _.isNil(scanForward), "Query.using(): scanForward must be a boolean or undefined");
|
|
855
|
+
this._index = index;
|
|
856
|
+
this._scanForward = scanForward;
|
|
857
|
+
return this;
|
|
858
|
+
}
|
|
859
|
+
limit(l) {
|
|
860
|
+
this._limit = l ?? Query.DEFAULT_LIMIT;
|
|
861
|
+
return this;
|
|
862
|
+
}
|
|
863
|
+
startAfter(lastEvaluatedKey) {
|
|
864
|
+
this._startAfter = lastEvaluatedKey;
|
|
865
|
+
return this;
|
|
866
|
+
}
|
|
867
|
+
withConsumedCapacity(capacityType = "TOTAL") {
|
|
868
|
+
assert(capacityType === "INDEXES" || capacityType === "TOTAL" || capacityType === "NONE", "Query.withConsumedCapacity(): capacity type must be INDEXES, TOTAL, or NONE");
|
|
869
|
+
if (capacityType === "NONE") return this;
|
|
870
|
+
this._consumedCapacity = capacityType;
|
|
871
|
+
return this;
|
|
872
|
+
}
|
|
873
|
+
toDynamo() {
|
|
874
|
+
const [keyCond, keyAttribVals, keyAttribNames] = formatKeyCondition(this._keys);
|
|
875
|
+
const [filterCond, filterAttribVals, filterAttribNames] = formatFilterCondition(this._filters, this._rawFilters);
|
|
876
|
+
const [projection, projectionAttribNames] = formatProjectionExpression(this._selections);
|
|
877
|
+
return _.omitBy({
|
|
878
|
+
TableName: this._tableName,
|
|
879
|
+
Select: this._count ? "COUNT" : void 0,
|
|
880
|
+
...projection,
|
|
881
|
+
...keyCond,
|
|
882
|
+
...filterCond,
|
|
883
|
+
..._.merge(keyAttribNames, filterAttribNames, projectionAttribNames),
|
|
884
|
+
..._.merge(keyAttribVals, filterAttribVals),
|
|
885
|
+
Limit: this._limit,
|
|
886
|
+
IndexName: this._index?.name,
|
|
887
|
+
ScanIndexForward: this._scanForward,
|
|
888
|
+
ExclusiveStartKey: this._startAfter,
|
|
889
|
+
ReturnConsumedCapacity: this._consumedCapacity
|
|
890
|
+
}, _.isNil);
|
|
891
|
+
}
|
|
898
892
|
};
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
if ($1ced42141bbfde9c$var$isReserved(cond.key)) return {
|
|
902
|
-
...cond,
|
|
903
|
-
key: `#${cond.key}`,
|
|
904
|
-
actualName: cond.key
|
|
905
|
-
};
|
|
906
|
-
if ((0, $6B8p2$lodash).startsWith(cond.key, "_")) return {
|
|
907
|
-
...cond,
|
|
908
|
-
key: `#${cond.key}`,
|
|
909
|
-
actualName: cond.key
|
|
910
|
-
};
|
|
911
|
-
return cond;
|
|
912
|
-
});
|
|
893
|
+
const isReserved = (name) => {
|
|
894
|
+
return _.indexOf(reserved, _.toUpper(name)) != -1;
|
|
913
895
|
};
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
case "gt":
|
|
929
|
-
conditionParts.push(`${key} > ${valRef}`);
|
|
930
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, val);
|
|
931
|
-
break;
|
|
932
|
-
case "gtEq":
|
|
933
|
-
conditionParts.push(`${key} >= ${valRef}`);
|
|
934
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, val);
|
|
935
|
-
break;
|
|
936
|
-
case "lt":
|
|
937
|
-
conditionParts.push(`${key} < ${valRef}`);
|
|
938
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, val);
|
|
939
|
-
break;
|
|
940
|
-
case "ltEq":
|
|
941
|
-
conditionParts.push(`${key} <= ${valRef}`);
|
|
942
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, val);
|
|
943
|
-
break;
|
|
944
|
-
case "between":
|
|
945
|
-
{
|
|
946
|
-
const valRefStart = `${valRef}_start`;
|
|
947
|
-
const valRefEnd = `${valRef}_end`;
|
|
948
|
-
const between = val;
|
|
949
|
-
conditionParts.push(`${key} BETWEEN ${valRefStart} AND ${valRefEnd}`);
|
|
950
|
-
(0, $6B8p2$lodash).set(attribVals, valRefStart, between.start);
|
|
951
|
-
(0, $6B8p2$lodash).set(attribVals, valRefEnd, between.end);
|
|
952
|
-
break;
|
|
953
|
-
}
|
|
954
|
-
case "begins_with":
|
|
955
|
-
conditionParts.push(`begins_with(${key}, ${valRef})`);
|
|
956
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, val);
|
|
957
|
-
break;
|
|
958
|
-
}
|
|
959
|
-
if (actualName) (0, $6B8p2$lodash).set(attribNames, key, actualName);
|
|
960
|
-
});
|
|
961
|
-
return [
|
|
962
|
-
{
|
|
963
|
-
KeyConditionExpression: (0, $6B8p2$lodash).isEmpty(conditionParts) ? undefined : (0, $6B8p2$lodash).join(conditionParts, " and ")
|
|
964
|
-
},
|
|
965
|
-
{
|
|
966
|
-
ExpressionAttributeValues: (0, $6B8p2$lodash).isEmpty(attribVals) ? undefined : attribVals
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
ExpressionAttributeNames: (0, $6B8p2$lodash).isEmpty(attribNames) ? undefined : attribNames
|
|
970
|
-
}
|
|
971
|
-
];
|
|
896
|
+
const replaceReservedNames = (conditions) => {
|
|
897
|
+
return _.map(conditions, (cond) => {
|
|
898
|
+
if (isReserved(cond.key)) return {
|
|
899
|
+
...cond,
|
|
900
|
+
key: `#${cond.key}`,
|
|
901
|
+
actualName: cond.key
|
|
902
|
+
};
|
|
903
|
+
if (_.startsWith(cond.key, "_")) return {
|
|
904
|
+
...cond,
|
|
905
|
+
key: `#${cond.key}`,
|
|
906
|
+
actualName: cond.key
|
|
907
|
+
};
|
|
908
|
+
return cond;
|
|
909
|
+
});
|
|
972
910
|
};
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
break;
|
|
1025
|
-
case 'attribute_type':
|
|
1026
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, f.val);
|
|
1027
|
-
filterParts.push(`attribute_type(${f.key}, ${valRef})`);
|
|
1028
|
-
break;
|
|
1029
|
-
case 'contains':
|
|
1030
|
-
(0, $6B8p2$lodash).set(attribVals, valRef, f.val);
|
|
1031
|
-
filterParts.push(`contains(${f.key}, ${valRef})`);
|
|
1032
|
-
break;
|
|
1033
|
-
case 'size':
|
|
1034
|
-
{
|
|
1035
|
-
const sizeVal = f.val;
|
|
1036
|
-
const newValRef = `:size_${(0, $6B8p2$lodash).trim(valRef, ':')}`;
|
|
1037
|
-
(0, $6B8p2$lodash).set(attribVals, newValRef, sizeVal.val);
|
|
1038
|
-
filterParts.push(`size(${f.key}) ${sizeVal.op} ${newValRef}`);
|
|
1039
|
-
break;
|
|
1040
|
-
}
|
|
1041
|
-
case 'between':
|
|
1042
|
-
{
|
|
1043
|
-
const valRefStart = `${valRef}_start`;
|
|
1044
|
-
const valRefEnd = `${valRef}_end`;
|
|
1045
|
-
const between = f.val;
|
|
1046
|
-
filterParts.push(`${f.key} BETWEEN ${valRefStart} AND ${valRefEnd}`);
|
|
1047
|
-
(0, $6B8p2$lodash).set(attribVals, valRefStart, between.start);
|
|
1048
|
-
(0, $6B8p2$lodash).set(attribVals, valRefEnd, between.end);
|
|
1049
|
-
break;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
if (f.actualName) (0, $6B8p2$lodash).set(attribNames, f.key, f.actualName);
|
|
1053
|
-
});
|
|
1054
|
-
let filterExp = (0, $6B8p2$lodash).join(filterParts, ' and ');
|
|
1055
|
-
if (rawFilters.length > 0) {
|
|
1056
|
-
const rawFilterCondition = (0, $6B8p2$lodash).chain(rawFilters).map((f)=>f ? `(${f.condition})` : undefined).compact().join(' and ').value();
|
|
1057
|
-
if ((0, $6B8p2$lodash).isEmpty(filterExp)) filterExp = rawFilterCondition;
|
|
1058
|
-
else filterExp = (0, $6B8p2$lodash).join([
|
|
1059
|
-
filterExp,
|
|
1060
|
-
rawFilterCondition
|
|
1061
|
-
], ' and ');
|
|
1062
|
-
(0, $6B8p2$lodash).merge(attribVals, (0, $6B8p2$lodash).chain(rawFilters).map((f)=>f?.replacements.vals).compact().reduce((0, $6B8p2$lodash).merge, {}).value());
|
|
1063
|
-
(0, $6B8p2$lodash).merge(attribNames, (0, $6B8p2$lodash).chain(rawFilters).map((f)=>f?.replacements.keys).compact().reduce((0, $6B8p2$lodash).merge, {}).value());
|
|
1064
|
-
}
|
|
1065
|
-
return [
|
|
1066
|
-
{
|
|
1067
|
-
FilterExpression: (0, $6B8p2$lodash).isEmpty(filterExp) ? undefined : filterExp
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
ExpressionAttributeValues: (0, $6B8p2$lodash).isEmpty(attribVals) ? undefined : attribVals
|
|
1071
|
-
},
|
|
1072
|
-
{
|
|
1073
|
-
ExpressionAttributeNames: (0, $6B8p2$lodash).isEmpty(attribNames) ? undefined : attribNames
|
|
1074
|
-
}
|
|
1075
|
-
];
|
|
911
|
+
const formatKeyCondition = (conditions) => {
|
|
912
|
+
const updatedConditions = replaceReservedNames(conditions);
|
|
913
|
+
const conditionParts = [];
|
|
914
|
+
const attribVals = {};
|
|
915
|
+
const attribNames = {};
|
|
916
|
+
_.each(updatedConditions, (cond) => {
|
|
917
|
+
const { key, val, type, actualName } = cond;
|
|
918
|
+
const valRef = `:${_.trim(key, "#")}`;
|
|
919
|
+
switch (type) {
|
|
920
|
+
case "hash-eq":
|
|
921
|
+
case "eq":
|
|
922
|
+
conditionParts.push(`${key} = ${valRef}`);
|
|
923
|
+
_.set(attribVals, valRef, val);
|
|
924
|
+
break;
|
|
925
|
+
case "gt":
|
|
926
|
+
conditionParts.push(`${key} > ${valRef}`);
|
|
927
|
+
_.set(attribVals, valRef, val);
|
|
928
|
+
break;
|
|
929
|
+
case "gtEq":
|
|
930
|
+
conditionParts.push(`${key} >= ${valRef}`);
|
|
931
|
+
_.set(attribVals, valRef, val);
|
|
932
|
+
break;
|
|
933
|
+
case "lt":
|
|
934
|
+
conditionParts.push(`${key} < ${valRef}`);
|
|
935
|
+
_.set(attribVals, valRef, val);
|
|
936
|
+
break;
|
|
937
|
+
case "ltEq":
|
|
938
|
+
conditionParts.push(`${key} <= ${valRef}`);
|
|
939
|
+
_.set(attribVals, valRef, val);
|
|
940
|
+
break;
|
|
941
|
+
case "between": {
|
|
942
|
+
const valRefStart = `${valRef}_start`;
|
|
943
|
+
const valRefEnd = `${valRef}_end`;
|
|
944
|
+
const between = val;
|
|
945
|
+
conditionParts.push(`${key} BETWEEN ${valRefStart} AND ${valRefEnd}`);
|
|
946
|
+
_.set(attribVals, valRefStart, between.start);
|
|
947
|
+
_.set(attribVals, valRefEnd, between.end);
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
case "begins_with":
|
|
951
|
+
conditionParts.push(`begins_with(${key}, ${valRef})`);
|
|
952
|
+
_.set(attribVals, valRef, val);
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
if (actualName) _.set(attribNames, key, actualName);
|
|
956
|
+
});
|
|
957
|
+
return [
|
|
958
|
+
{ KeyConditionExpression: _.isEmpty(conditionParts) ? void 0 : _.join(conditionParts, " and ") },
|
|
959
|
+
{ ExpressionAttributeValues: _.isEmpty(attribVals) ? void 0 : attribVals },
|
|
960
|
+
{ ExpressionAttributeNames: _.isEmpty(attribNames) ? void 0 : attribNames }
|
|
961
|
+
];
|
|
1076
962
|
};
|
|
1077
|
-
const
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
963
|
+
const formatFilterCondition = (filters, rawFilters) => {
|
|
964
|
+
const updatedFilters = replaceReservedNames(filters);
|
|
965
|
+
const filterParts = [];
|
|
966
|
+
const attribVals = {};
|
|
967
|
+
const attribNames = {};
|
|
968
|
+
const usedValRefs = /* @__PURE__ */ new Set();
|
|
969
|
+
_.each(updatedFilters, (f) => {
|
|
970
|
+
let valRef = `:${_.trim(f.key, "#")}`;
|
|
971
|
+
if (usedValRefs.has(valRef)) {
|
|
972
|
+
let counter = 1;
|
|
973
|
+
while (usedValRefs.has(`${valRef}_${counter}`)) counter++;
|
|
974
|
+
valRef = `${valRef}_${counter}`;
|
|
975
|
+
}
|
|
976
|
+
usedValRefs.add(valRef);
|
|
977
|
+
switch (f.type) {
|
|
978
|
+
case "eq":
|
|
979
|
+
_.set(attribVals, valRef, f.val);
|
|
980
|
+
filterParts.push(`${f.key} = ${valRef}`);
|
|
981
|
+
break;
|
|
982
|
+
case "notEq":
|
|
983
|
+
_.set(attribVals, valRef, f.val);
|
|
984
|
+
filterParts.push(`${f.key} <> ${valRef}`);
|
|
985
|
+
break;
|
|
986
|
+
case "gt":
|
|
987
|
+
_.set(attribVals, valRef, f.val);
|
|
988
|
+
filterParts.push(`${f.key} > ${valRef}`);
|
|
989
|
+
break;
|
|
990
|
+
case "gtEq":
|
|
991
|
+
_.set(attribVals, valRef, f.val);
|
|
992
|
+
filterParts.push(`${f.key} >= ${valRef}`);
|
|
993
|
+
break;
|
|
994
|
+
case "lt":
|
|
995
|
+
_.set(attribVals, valRef, f.val);
|
|
996
|
+
filterParts.push(`${f.key} < ${valRef}`);
|
|
997
|
+
break;
|
|
998
|
+
case "ltEq":
|
|
999
|
+
_.set(attribVals, valRef, f.val);
|
|
1000
|
+
filterParts.push(`${f.key} <= ${valRef}`);
|
|
1001
|
+
break;
|
|
1002
|
+
case "begins_with":
|
|
1003
|
+
_.set(attribVals, valRef, f.val);
|
|
1004
|
+
filterParts.push(`begins_with(${f.key}, ${valRef})`);
|
|
1005
|
+
break;
|
|
1006
|
+
case "attribute_exists":
|
|
1007
|
+
_.set(attribVals, valRef, f.val);
|
|
1008
|
+
filterParts.push(`attribute_exists(${f.key})`);
|
|
1009
|
+
break;
|
|
1010
|
+
case "attribute_not_exists":
|
|
1011
|
+
_.set(attribVals, valRef, f.val);
|
|
1012
|
+
filterParts.push(`attribute_not_exists(${f.key})`);
|
|
1013
|
+
break;
|
|
1014
|
+
case "attribute_type":
|
|
1015
|
+
_.set(attribVals, valRef, f.val);
|
|
1016
|
+
filterParts.push(`attribute_type(${f.key}, ${valRef})`);
|
|
1017
|
+
break;
|
|
1018
|
+
case "contains":
|
|
1019
|
+
_.set(attribVals, valRef, f.val);
|
|
1020
|
+
filterParts.push(`contains(${f.key}, ${valRef})`);
|
|
1021
|
+
break;
|
|
1022
|
+
case "size": {
|
|
1023
|
+
const sizeVal = f.val;
|
|
1024
|
+
const newValRef = `:size_${_.trim(valRef, ":")}`;
|
|
1025
|
+
_.set(attribVals, newValRef, sizeVal.val);
|
|
1026
|
+
filterParts.push(`size(${f.key}) ${sizeVal.op} ${newValRef}`);
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
case "between": {
|
|
1030
|
+
const valRefStart = `${valRef}_start`;
|
|
1031
|
+
const valRefEnd = `${valRef}_end`;
|
|
1032
|
+
const between = f.val;
|
|
1033
|
+
filterParts.push(`${f.key} BETWEEN ${valRefStart} AND ${valRefEnd}`);
|
|
1034
|
+
_.set(attribVals, valRefStart, between.start);
|
|
1035
|
+
_.set(attribVals, valRefEnd, between.end);
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
if (f.actualName) _.set(attribNames, f.key, f.actualName);
|
|
1040
|
+
});
|
|
1041
|
+
let filterExp = _.join(filterParts, " and ");
|
|
1042
|
+
if (rawFilters.length > 0) {
|
|
1043
|
+
const rawFilterCondition = _.chain(rawFilters).map((f) => f ? `(${f.condition})` : void 0).compact().join(" and ").value();
|
|
1044
|
+
if (_.isEmpty(filterExp)) filterExp = rawFilterCondition;
|
|
1045
|
+
else filterExp = _.join([filterExp, rawFilterCondition], " and ");
|
|
1046
|
+
_.merge(attribVals, _.chain(rawFilters).map((f) => f?.replacements.vals).compact().reduce(_.merge, {}).value());
|
|
1047
|
+
_.merge(attribNames, _.chain(rawFilters).map((f) => f?.replacements.keys).compact().reduce(_.merge, {}).value());
|
|
1048
|
+
}
|
|
1049
|
+
return [
|
|
1050
|
+
{ FilterExpression: _.isEmpty(filterExp) ? void 0 : filterExp },
|
|
1051
|
+
{ ExpressionAttributeValues: _.isEmpty(attribVals) ? void 0 : attribVals },
|
|
1052
|
+
{ ExpressionAttributeNames: _.isEmpty(attribNames) ? void 0 : attribNames }
|
|
1053
|
+
];
|
|
1099
1054
|
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1119
|
-
get hashKey() {
|
|
1120
|
-
return this._hashKey;
|
|
1121
|
-
}
|
|
1122
|
-
get rangeKey() {
|
|
1123
|
-
return this._rangeKey;
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
class $bfdbbc60df8720b8$export$cf17b003b6192af3 {
|
|
1127
|
-
constructor(name, hashKey, rangeKey){
|
|
1128
|
-
(0, $6B8p2$assert)((0, $6B8p2$lodash).isString(name) && (0, $6B8p2$lodash).size(name) > 0, 'Index.constructor(): name must be provided');
|
|
1129
|
-
(0, $6B8p2$assert)((0, $6B8p2$lodash).isString(hashKey) && (0, $6B8p2$lodash).size(hashKey) > 0, 'Index.constructor(): hashKey must be provided');
|
|
1130
|
-
this._name = name;
|
|
1131
|
-
this._hashKey = hashKey;
|
|
1132
|
-
this._rangeKey = rangeKey;
|
|
1133
|
-
}
|
|
1134
|
-
get name() {
|
|
1135
|
-
return this._name;
|
|
1136
|
-
}
|
|
1137
|
-
get hashKey() {
|
|
1138
|
-
return this._hashKey;
|
|
1139
|
-
}
|
|
1140
|
-
get rangeKey() {
|
|
1141
|
-
return this._rangeKey;
|
|
1142
|
-
}
|
|
1055
|
+
const formatProjectionExpression = (proj) => {
|
|
1056
|
+
const attribNames = {};
|
|
1057
|
+
const projection = _.map(proj, (col) => {
|
|
1058
|
+
const attribRef = `#${_.trim(col)}`;
|
|
1059
|
+
if (isReserved(col)) {
|
|
1060
|
+
_.set(attribNames, attribRef, col);
|
|
1061
|
+
return attribRef;
|
|
1062
|
+
}
|
|
1063
|
+
if (_.startsWith(col, "_")) {
|
|
1064
|
+
_.set(attribNames, attribRef, col);
|
|
1065
|
+
return attribRef;
|
|
1066
|
+
}
|
|
1067
|
+
return col;
|
|
1068
|
+
});
|
|
1069
|
+
return [{ ProjectionExpression: _.isEmpty(projection) ? void 0 : _.join(projection, ", ") }, { ExpressionAttributeNames: _.isEmpty(attribNames) ? void 0 : attribNames }];
|
|
1070
|
+
};
|
|
1071
|
+
function throwIfModeExists(mode) {
|
|
1072
|
+
assert(_.isEmpty(mode), "Query: Cannot use more than one mode (select, count, scan) at the same time.");
|
|
1143
1073
|
}
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/core/Structure.ts
|
|
1076
|
+
var Table = class {
|
|
1077
|
+
constructor(name, hashKey, rangeKey = void 0) {
|
|
1078
|
+
assert(_.isString(name) && _.size(name) > 0, "Table.constructor(): name must be provided");
|
|
1079
|
+
assert(_.isString(hashKey) && _.size(hashKey) > 0, "Table.constructor(): hashKey must be provided");
|
|
1080
|
+
assert(_.isNil(rangeKey) || _.isString(rangeKey) && _.size(rangeKey) > 0, "Table.constructor(): rangeKey is invalid");
|
|
1081
|
+
this._name = name;
|
|
1082
|
+
this._hashKey = hashKey;
|
|
1083
|
+
this._rangeKey = rangeKey;
|
|
1084
|
+
}
|
|
1085
|
+
get name() {
|
|
1086
|
+
return this._name;
|
|
1087
|
+
}
|
|
1088
|
+
get hashKey() {
|
|
1089
|
+
return this._hashKey;
|
|
1090
|
+
}
|
|
1091
|
+
get rangeKey() {
|
|
1092
|
+
return this._rangeKey;
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
var Index = class {
|
|
1096
|
+
constructor(name, hashKey, rangeKey) {
|
|
1097
|
+
assert(_.isString(name) && _.size(name) > 0, "Index.constructor(): name must be provided");
|
|
1098
|
+
assert(_.isString(hashKey) && _.size(hashKey) > 0, "Index.constructor(): hashKey must be provided");
|
|
1099
|
+
this._name = name;
|
|
1100
|
+
this._hashKey = hashKey;
|
|
1101
|
+
this._rangeKey = rangeKey;
|
|
1102
|
+
}
|
|
1103
|
+
get name() {
|
|
1104
|
+
return this._name;
|
|
1105
|
+
}
|
|
1106
|
+
get hashKey() {
|
|
1107
|
+
return this._hashKey;
|
|
1108
|
+
}
|
|
1109
|
+
get rangeKey() {
|
|
1110
|
+
return this._rangeKey;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
//#endregion
|
|
1114
|
+
export { DdbType, Index, Operation, Query, Table };
|
|
1144
1115
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
export {$1ced42141bbfde9c$export$62297b13309008b2 as Query, $1ced42141bbfde9c$export$99a24bd46fd1f406 as DdbType, $1ced42141bbfde9c$export$ab5aad00225c5662 as Operation, $bfdbbc60df8720b8$export$cf17b003b6192af3 as Index, $bfdbbc60df8720b8$export$54ec01a60f47d33d as Table};
|
|
1149
|
-
//# sourceMappingURL=module.js.map
|
|
1116
|
+
//# sourceMappingURL=module.js.map
|