electrodb 2.10.0 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.js CHANGED
@@ -1,370 +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",
221
220
  };
222
221
 
223
222
  const UpsertOperations = {
224
- "set": "set",
225
- "add": "add",
226
- "subtract": "subtract",
227
- "append": "append",
228
- "ifNotExists": "ifNotExists"
223
+ set: "set",
224
+ add: "add",
225
+ subtract: "subtract",
226
+ append: "append",
227
+ ifNotExists: "ifNotExists",
229
228
  };
230
229
 
231
230
  const AttributeProxySymbol = Symbol("attribute_proxy");
232
- const TransactionCommitSymbol = Symbol('transaction_commit');
231
+ const TransactionCommitSymbol = Symbol("transaction_commit");
233
232
 
234
233
  const BuilderTypes = {
235
- update: "update",
236
- filter: "filter"
234
+ update: "update",
235
+ filter: "filter",
237
236
  };
238
237
 
239
238
  const ValueTypes = {
240
- string: "string",
241
- boolean: "boolean",
242
- number: "number",
243
- array: "array",
244
- set: "set",
245
- aws_set: "aws_set",
246
- object: "object",
247
- map: "map",
248
- null: "null",
249
- undefined: "undefined",
250
- 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",
251
250
  };
252
251
 
253
252
  const TraverserIndexes = {
254
- readonly: "readonly",
255
- required: "required",
256
- getters: "getters",
257
- setters: "setters"
258
- }
253
+ readonly: "readonly",
254
+ required: "required",
255
+ getters: "getters",
256
+ setters: "setters",
257
+ };
259
258
 
260
259
  const ReturnValues = {
261
- 'default': 'default',
262
- 'none': 'none',
263
- 'all_old': 'all_old',
264
- 'updated_old': 'updated_old',
265
- 'all_new': 'all_new',
266
- '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",
267
266
  };
268
267
 
269
268
  const FormatToReturnValues = {
270
- 'none': 'NONE',
271
- 'default': 'NONE',
272
- 'all_old': 'ALL_OLD',
273
- 'updated_old': 'UPDATED_OLD',
274
- 'all_new': 'ALL_NEW',
275
- '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",
276
275
  };
277
276
 
278
277
  const TableIndex = "";
279
278
 
280
279
  const KeyCasing = {
281
- none: "none",
282
- upper: "upper",
283
- lower: "lower",
284
- default: "default",
280
+ none: "none",
281
+ upper: "upper",
282
+ lower: "lower",
283
+ default: "default",
285
284
  };
286
285
 
287
- const EventSubscriptionTypes = [
288
- "query",
289
- "results"
290
- ];
286
+ const EventSubscriptionTypes = ["query", "results"];
291
287
 
292
288
  const TerminalOperation = {
293
- go: 'go',
294
- page: 'page',
295
- }
289
+ go: "go",
290
+ page: "page",
291
+ };
296
292
 
297
- const AllPages = 'all';
293
+ const AllPages = "all";
298
294
 
299
295
  const ResultOrderOption = {
300
- 'asc': true,
301
- 'desc': false
296
+ asc: true,
297
+ desc: false,
302
298
  };
303
299
 
304
- const ResultOrderParam = 'ScanIndexForward';
300
+ const ResultOrderParam = "ScanIndexForward";
305
301
 
306
302
  const DynamoDBAttributeTypes = Object.entries({
307
- string: 'S',
308
- stringSet: 'SS',
309
- number: 'N',
310
- numberSet: 'NS',
311
- binary: 'B',
312
- binarySet: 'BS',
313
- boolean: 'BOOL',
314
- null: 'NULL',
315
- list: 'L',
316
- 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",
317
313
  }).reduce((obj, [name, type]) => {
318
- obj[name] = type;
319
- obj[type] = type;
320
- return obj;
314
+ obj[name] = type;
315
+ obj[type] = type;
316
+ return obj;
321
317
  }, {});
322
318
 
323
319
  const CastKeyOptions = {
324
- string: 'string',
325
- number: 'number',
326
- }
320
+ string: "string",
321
+ number: "number",
322
+ };
327
323
 
328
324
  module.exports = {
329
- Pager,
330
- KeyTypes,
331
- CastTypes,
332
- KeyCasing,
333
- PathTypes,
334
- IndexTypes,
335
- QueryTypes,
336
- ValueTypes,
337
- TableIndex,
338
- MethodTypes,
339
- Comparisons,
340
- BuilderTypes,
341
- ReturnValues,
342
- MaxBatchItems,
343
- ModelVersions,
344
- ItemOperations,
345
- AttributeTypes,
346
- EntityVersions,
347
- CastKeyOptions,
348
- ServiceVersions,
349
- ExpressionTypes,
350
- ElectroInstance,
351
- TraverserIndexes,
352
- UnprocessedTypes,
353
- AttributeWildCard,
354
- TerminalOperation,
355
- PartialComparisons,
356
- FormatToReturnValues,
357
- AttributeProxySymbol,
358
- ElectroInstanceTypes,
359
- MethodTypeTranslation,
360
- EventSubscriptionTypes,
361
- DynamoDBAttributeTypes,
362
- AttributeMutationMethods,
363
- AllPages,
364
- ResultOrderOption,
365
- ResultOrderParam,
366
- TransactionCommitSymbol,
367
- TransactionOperations,
368
- TransactionMethods,
369
- UpsertOperations,
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,
370
366
  };