electrodb 2.9.3 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.js CHANGED
@@ -1,361 +1,366 @@
1
1
  const KeyTypes = {
2
- pk: "pk",
3
- sk: "sk",
2
+ pk: "pk",
3
+ sk: "sk",
4
4
  };
5
5
 
6
6
  const BatchWriteTypes = {
7
- batch: "batch",
8
- concurrent: "concurrent"
9
- }
7
+ batch: "batch",
8
+ concurrent: "concurrent",
9
+ };
10
10
 
11
11
  const QueryTypes = {
12
- and: "and",
13
- gte: "gte",
14
- gt: "gt",
15
- lte: "lte",
16
- lt: "lt",
17
- eq: "eq",
18
- begins: "begins",
19
- between: "between",
20
- collection: "collection",
21
- clustered_collection: 'clustered_collection',
22
- is: "is"
12
+ and: "and",
13
+ gte: "gte",
14
+ gt: "gt",
15
+ lte: "lte",
16
+ lt: "lt",
17
+ eq: "eq",
18
+ begins: "begins",
19
+ between: "between",
20
+ collection: "collection",
21
+ clustered_collection: "clustered_collection",
22
+ is: "is",
23
23
  };
24
24
 
25
25
  const MethodTypes = {
26
- check: "check",
27
- put: "put",
28
- get: "get",
29
- query: "query",
30
- scan: "scan",
31
- update: "update",
32
- delete: "delete",
33
- remove: "remove",
34
- patch: "patch",
35
- create: "create",
36
- batchGet: "batchGet",
37
- batchWrite: "batchWrite",
38
- upsert: "upsert",
39
- transactWrite: "transactWrite",
40
- transactGet: "transactGet",
26
+ check: "check",
27
+ put: "put",
28
+ get: "get",
29
+ query: "query",
30
+ scan: "scan",
31
+ update: "update",
32
+ delete: "delete",
33
+ remove: "remove",
34
+ patch: "patch",
35
+ create: "create",
36
+ batchGet: "batchGet",
37
+ batchWrite: "batchWrite",
38
+ upsert: "upsert",
39
+ transactWrite: "transactWrite",
40
+ transactGet: "transactGet",
41
41
  };
42
42
 
43
43
  const TransactionMethods = {
44
- transactWrite: MethodTypes.transactWrite,
45
- transactGet: MethodTypes.transactGet,
46
- }
44
+ transactWrite: MethodTypes.transactWrite,
45
+ transactGet: MethodTypes.transactGet,
46
+ };
47
47
 
48
48
  const TransactionOperations = {
49
- [MethodTypes.get]: "Get",
50
- [MethodTypes.check]: "ConditionCheck",
51
- [MethodTypes.put]: "Put",
52
- [MethodTypes.create]: "Put",
53
- [MethodTypes.upsert]: "Update",
54
- [MethodTypes.update]: "Update",
55
- [MethodTypes.patch]: "Update",
56
- [MethodTypes.remove]: "Delete",
57
- [MethodTypes.delete]: "Delete",
58
- }
49
+ [MethodTypes.get]: "Get",
50
+ [MethodTypes.check]: "ConditionCheck",
51
+ [MethodTypes.put]: "Put",
52
+ [MethodTypes.create]: "Put",
53
+ [MethodTypes.upsert]: "Update",
54
+ [MethodTypes.update]: "Update",
55
+ [MethodTypes.patch]: "Update",
56
+ [MethodTypes.remove]: "Delete",
57
+ [MethodTypes.delete]: "Delete",
58
+ };
59
59
 
60
60
  const MethodTypeTranslation = {
61
- put: "put",
62
- get: "get",
63
- query: "query",
64
- scan: "scan",
65
- update: "update",
66
- delete: "delete",
67
- remove: "delete",
68
- patch: "update",
69
- create: "put",
70
- batchGet: "batchGet",
71
- batchWrite: "batchWrite",
72
- upsert: "update",
73
- transactWrite: 'transactWrite',
74
- transactGet: 'transactGet',
75
- }
61
+ put: "put",
62
+ get: "get",
63
+ query: "query",
64
+ scan: "scan",
65
+ update: "update",
66
+ delete: "delete",
67
+ remove: "delete",
68
+ patch: "update",
69
+ create: "put",
70
+ batchGet: "batchGet",
71
+ batchWrite: "batchWrite",
72
+ upsert: "update",
73
+ transactWrite: "transactWrite",
74
+ transactGet: "transactGet",
75
+ };
76
76
 
77
77
  const IndexTypes = {
78
- isolated: 'isolated',
79
- clustered: 'clustered',
80
- }
78
+ isolated: "isolated",
79
+ clustered: "clustered",
80
+ };
81
81
 
82
82
  const Comparisons = {
83
- lte: '<=',
84
- lt: "<",
85
- gte: ">=",
86
- gt: '>'
87
- }
83
+ lte: "<=",
84
+ lt: "<",
85
+ gte: ">=",
86
+ gt: ">",
87
+ };
88
88
 
89
89
  const PartialComparisons = {
90
- lt: "<",
91
- gte: ">=",
92
-
93
- /**
94
- * gt becomes gte and last character of incoming value is shifted up one character code
95
- * example:
96
- * sk > '2020-09-05'
97
- * expected
98
- * - 2020-09-06@05:05_hero
99
- * - 2020-10-05@05:05_hero
100
- * - 2022-02-05@05:05_villian
101
- * - 2022-06-05@05:05_clown
102
- * - 2022-09-06@05:05_clown
103
- * actual (bad - includes all 2020-09-05 records)
104
- * - 2020-09-05@05:05_hero
105
- * - 2020-09-06@05:05_hero
106
- * - 2020-10-05@05:05_hero
107
- * - 2022-02-05@05:05_villian
108
- * - 2022-06-05@05:05_clown
109
- */
110
- gt: ">=",
111
-
112
- /**
113
- * lte becomes lt and last character of incoming value is shifted up one character code
114
- * example:
115
- * sk >= '2020-09-05'
116
- * expected
117
- * - 2012-02-05@05:05_clown
118
- * - 2015-10-05@05:05_hero
119
- * - 2017-02-05@05:05_clown
120
- * - 2017-02-05@05:05_villian
121
- * - 2020-02-05@05:05_clown
122
- * - 2020-02-25@05:05_clown
123
- * - 2020-09-05@05:05_hero
124
- * actual (bad - missing all 2020-09-05 records)
125
- * - 2012-02-05@05:05_clown
126
- * - 2015-10-05@05:05_hero
127
- * - 2017-02-05@05:05_clown
128
- * - 2017-02-05@05:05_villian
129
- * - 2020-02-05@05:05_clown
130
- * - 2020-02-25@05:05_clown
131
- */
132
- lte: "<",
90
+ lt: "<",
91
+ gte: ">=",
92
+
93
+ /**
94
+ * gt becomes gte and last character of incoming value is shifted up one character code
95
+ * example:
96
+ * sk > '2020-09-05'
97
+ * expected
98
+ * - 2020-09-06@05:05_hero
99
+ * - 2020-10-05@05:05_hero
100
+ * - 2022-02-05@05:05_villian
101
+ * - 2022-06-05@05:05_clown
102
+ * - 2022-09-06@05:05_clown
103
+ * actual (bad - includes all 2020-09-05 records)
104
+ * - 2020-09-05@05:05_hero
105
+ * - 2020-09-06@05:05_hero
106
+ * - 2020-10-05@05:05_hero
107
+ * - 2022-02-05@05:05_villian
108
+ * - 2022-06-05@05:05_clown
109
+ */
110
+ gt: ">=",
111
+
112
+ /**
113
+ * lte becomes lt and last character of incoming value is shifted up one character code
114
+ * example:
115
+ * sk >= '2020-09-05'
116
+ * expected
117
+ * - 2012-02-05@05:05_clown
118
+ * - 2015-10-05@05:05_hero
119
+ * - 2017-02-05@05:05_clown
120
+ * - 2017-02-05@05:05_villian
121
+ * - 2020-02-05@05:05_clown
122
+ * - 2020-02-25@05:05_clown
123
+ * - 2020-09-05@05:05_hero
124
+ * actual (bad - missing all 2020-09-05 records)
125
+ * - 2012-02-05@05:05_clown
126
+ * - 2015-10-05@05:05_hero
127
+ * - 2017-02-05@05:05_clown
128
+ * - 2017-02-05@05:05_villian
129
+ * - 2020-02-05@05:05_clown
130
+ * - 2020-02-25@05:05_clown
131
+ */
132
+ lte: "<",
133
133
  };
134
134
 
135
135
  const CastTypes = ["string", "number"];
136
136
 
137
137
  const AttributeTypes = {
138
- string: "string",
139
- number: "number",
140
- boolean: "boolean",
141
- enum: "enum",
142
- map: "map",
143
- set: "set",
144
- // enumSet: "enumSet",
145
- list: "list",
146
- any: "any",
147
- custom: "custom",
148
- static: "static",
138
+ string: "string",
139
+ number: "number",
140
+ boolean: "boolean",
141
+ enum: "enum",
142
+ map: "map",
143
+ set: "set",
144
+ // enumSet: "enumSet",
145
+ list: "list",
146
+ any: "any",
147
+ custom: "custom",
148
+ static: "static",
149
149
  };
150
150
 
151
151
  const PathTypes = {
152
- ...AttributeTypes,
153
- item: "item"
152
+ ...AttributeTypes,
153
+ item: "item",
154
154
  };
155
155
 
156
-
157
156
  const ExpressionTypes = {
158
- ConditionExpression: "ConditionExpression",
159
- FilterExpression: "FilterExpression"
157
+ ConditionExpression: "ConditionExpression",
158
+ FilterExpression: "FilterExpression",
160
159
  };
161
160
 
162
161
  const ElectroInstance = {
163
- entity: Symbol("entity"),
164
- service: Symbol("service"),
165
- electro: Symbol("electro"),
162
+ entity: Symbol("entity"),
163
+ service: Symbol("service"),
164
+ electro: Symbol("electro"),
166
165
  };
167
166
 
168
167
  const ElectroInstanceTypes = {
169
- electro: "electro",
170
- service: "service",
171
- entity: "entity",
172
- model: "model"
168
+ electro: "electro",
169
+ service: "service",
170
+ entity: "entity",
171
+ model: "model",
173
172
  };
174
173
 
175
174
  const ModelVersions = {
176
- beta: "beta",
177
- v1: "v1",
178
- v2: "v2"
175
+ beta: "beta",
176
+ v1: "v1",
177
+ v2: "v2",
179
178
  };
180
179
 
181
180
  const EntityVersions = {
182
- v1: "v1"
181
+ v1: "v1",
183
182
  };
184
183
 
185
184
  const ServiceVersions = {
186
- v1: "v1"
185
+ v1: "v1",
187
186
  };
188
187
 
189
188
  const MaxBatchItems = {
190
- [MethodTypes.batchGet]: 100,
191
- [MethodTypes.batchWrite]: 25
189
+ [MethodTypes.batchGet]: 100,
190
+ [MethodTypes.batchWrite]: 25,
192
191
  };
193
192
 
194
193
  const AttributeMutationMethods = {
195
- get: "get",
196
- set: "set"
194
+ get: "get",
195
+ set: "set",
197
196
  };
198
197
 
199
198
  const Pager = {
200
- raw: "raw",
201
- named: "named",
202
- item: "item",
203
- cursor: "cursor"
204
- }
199
+ raw: "raw",
200
+ named: "named",
201
+ item: "item",
202
+ cursor: "cursor",
203
+ };
205
204
 
206
205
  const UnprocessedTypes = {
207
- raw: "raw",
208
- item: "item"
206
+ raw: "raw",
207
+ item: "item",
209
208
  };
210
209
 
211
210
  const AttributeWildCard = "*";
212
211
 
213
212
  const ItemOperations = {
214
- "set": "set",
215
- "delete": "delete",
216
- "remove": "remove",
217
- "add": "add",
218
- "subtract": "subtract",
219
- "append": "append",
220
- "ifNotExists": "ifNotExists"
213
+ set: "set",
214
+ delete: "delete",
215
+ remove: "remove",
216
+ add: "add",
217
+ subtract: "subtract",
218
+ append: "append",
219
+ ifNotExists: "ifNotExists",
220
+ };
221
+
222
+ const UpsertOperations = {
223
+ set: "set",
224
+ add: "add",
225
+ subtract: "subtract",
226
+ append: "append",
227
+ ifNotExists: "ifNotExists",
221
228
  };
222
229
 
223
230
  const AttributeProxySymbol = Symbol("attribute_proxy");
224
- const TransactionCommitSymbol = Symbol('transaction_commit');
231
+ const TransactionCommitSymbol = Symbol("transaction_commit");
225
232
 
226
233
  const BuilderTypes = {
227
- update: "update",
228
- filter: "filter"
234
+ update: "update",
235
+ filter: "filter",
229
236
  };
230
237
 
231
238
  const ValueTypes = {
232
- string: "string",
233
- boolean: "boolean",
234
- number: "number",
235
- array: "array",
236
- set: "set",
237
- aws_set: "aws_set",
238
- object: "object",
239
- map: "map",
240
- null: "null",
241
- undefined: "undefined",
242
- unknown: "unknown",
239
+ string: "string",
240
+ boolean: "boolean",
241
+ number: "number",
242
+ array: "array",
243
+ set: "set",
244
+ aws_set: "aws_set",
245
+ object: "object",
246
+ map: "map",
247
+ null: "null",
248
+ undefined: "undefined",
249
+ unknown: "unknown",
243
250
  };
244
251
 
245
252
  const TraverserIndexes = {
246
- readonly: "readonly",
247
- required: "required",
248
- getters: "getters",
249
- setters: "setters"
250
- }
253
+ readonly: "readonly",
254
+ required: "required",
255
+ getters: "getters",
256
+ setters: "setters",
257
+ };
251
258
 
252
259
  const ReturnValues = {
253
- 'default': 'default',
254
- 'none': 'none',
255
- 'all_old': 'all_old',
256
- 'updated_old': 'updated_old',
257
- 'all_new': 'all_new',
258
- 'updated_new': 'updated_new',
260
+ default: "default",
261
+ none: "none",
262
+ all_old: "all_old",
263
+ updated_old: "updated_old",
264
+ all_new: "all_new",
265
+ updated_new: "updated_new",
259
266
  };
260
267
 
261
268
  const FormatToReturnValues = {
262
- 'none': 'NONE',
263
- 'default': 'NONE',
264
- 'all_old': 'ALL_OLD',
265
- 'updated_old': 'UPDATED_OLD',
266
- 'all_new': 'ALL_NEW',
267
- 'updated_new': 'UPDATED_NEW'
269
+ none: "NONE",
270
+ default: "NONE",
271
+ all_old: "ALL_OLD",
272
+ updated_old: "UPDATED_OLD",
273
+ all_new: "ALL_NEW",
274
+ updated_new: "UPDATED_NEW",
268
275
  };
269
276
 
270
277
  const TableIndex = "";
271
278
 
272
279
  const KeyCasing = {
273
- none: "none",
274
- upper: "upper",
275
- lower: "lower",
276
- default: "default",
280
+ none: "none",
281
+ upper: "upper",
282
+ lower: "lower",
283
+ default: "default",
277
284
  };
278
285
 
279
- const EventSubscriptionTypes = [
280
- "query",
281
- "results"
282
- ];
286
+ const EventSubscriptionTypes = ["query", "results"];
283
287
 
284
288
  const TerminalOperation = {
285
- go: 'go',
286
- page: 'page',
287
- }
289
+ go: "go",
290
+ page: "page",
291
+ };
288
292
 
289
- const AllPages = 'all';
293
+ const AllPages = "all";
290
294
 
291
295
  const ResultOrderOption = {
292
- 'asc': true,
293
- 'desc': false
296
+ asc: true,
297
+ desc: false,
294
298
  };
295
299
 
296
- const ResultOrderParam = 'ScanIndexForward';
300
+ const ResultOrderParam = "ScanIndexForward";
297
301
 
298
302
  const DynamoDBAttributeTypes = Object.entries({
299
- string: 'S',
300
- stringSet: 'SS',
301
- number: 'N',
302
- numberSet: 'NS',
303
- binary: 'B',
304
- binarySet: 'BS',
305
- boolean: 'BOOL',
306
- null: 'NULL',
307
- list: 'L',
308
- map: 'M',
303
+ string: "S",
304
+ stringSet: "SS",
305
+ number: "N",
306
+ numberSet: "NS",
307
+ binary: "B",
308
+ binarySet: "BS",
309
+ boolean: "BOOL",
310
+ null: "NULL",
311
+ list: "L",
312
+ map: "M",
309
313
  }).reduce((obj, [name, type]) => {
310
- obj[name] = type;
311
- obj[type] = type;
312
- return obj;
314
+ obj[name] = type;
315
+ obj[type] = type;
316
+ return obj;
313
317
  }, {});
314
318
 
315
319
  const CastKeyOptions = {
316
- string: 'string',
317
- number: 'number',
318
- }
320
+ string: "string",
321
+ number: "number",
322
+ };
319
323
 
320
324
  module.exports = {
321
- Pager,
322
- KeyTypes,
323
- CastTypes,
324
- KeyCasing,
325
- PathTypes,
326
- IndexTypes,
327
- QueryTypes,
328
- ValueTypes,
329
- TableIndex,
330
- MethodTypes,
331
- Comparisons,
332
- BuilderTypes,
333
- ReturnValues,
334
- MaxBatchItems,
335
- ModelVersions,
336
- ItemOperations,
337
- AttributeTypes,
338
- EntityVersions,
339
- CastKeyOptions,
340
- ServiceVersions,
341
- ExpressionTypes,
342
- ElectroInstance,
343
- TraverserIndexes,
344
- UnprocessedTypes,
345
- AttributeWildCard,
346
- TerminalOperation,
347
- PartialComparisons,
348
- FormatToReturnValues,
349
- AttributeProxySymbol,
350
- ElectroInstanceTypes,
351
- MethodTypeTranslation,
352
- EventSubscriptionTypes,
353
- DynamoDBAttributeTypes,
354
- AttributeMutationMethods,
355
- AllPages,
356
- ResultOrderOption,
357
- ResultOrderParam,
358
- TransactionCommitSymbol,
359
- TransactionOperations,
360
- TransactionMethods,
325
+ Pager,
326
+ KeyTypes,
327
+ CastTypes,
328
+ KeyCasing,
329
+ PathTypes,
330
+ IndexTypes,
331
+ QueryTypes,
332
+ ValueTypes,
333
+ TableIndex,
334
+ MethodTypes,
335
+ Comparisons,
336
+ BuilderTypes,
337
+ ReturnValues,
338
+ MaxBatchItems,
339
+ ModelVersions,
340
+ ItemOperations,
341
+ AttributeTypes,
342
+ EntityVersions,
343
+ CastKeyOptions,
344
+ ServiceVersions,
345
+ ExpressionTypes,
346
+ ElectroInstance,
347
+ TraverserIndexes,
348
+ UnprocessedTypes,
349
+ AttributeWildCard,
350
+ TerminalOperation,
351
+ PartialComparisons,
352
+ FormatToReturnValues,
353
+ AttributeProxySymbol,
354
+ ElectroInstanceTypes,
355
+ MethodTypeTranslation,
356
+ EventSubscriptionTypes,
357
+ DynamoDBAttributeTypes,
358
+ AttributeMutationMethods,
359
+ AllPages,
360
+ ResultOrderOption,
361
+ ResultOrderParam,
362
+ TransactionCommitSymbol,
363
+ TransactionOperations,
364
+ TransactionMethods,
365
+ UpsertOperations,
361
366
  };