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