triangle-utils 1.4.95 → 1.4.97
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/src/UtilsDynamoDB.js +16 -5
- package/package.json +1 -1
- package/src/UtilsDynamoDB.ts +16 -6
|
@@ -27,7 +27,10 @@ function is_item(x) {
|
|
|
27
27
|
return typeof x === "object" && Object.keys(x).filter(key => typeof key !== "string").length === 0 && !Array.isArray(x);
|
|
28
28
|
}
|
|
29
29
|
function convert_input(input) {
|
|
30
|
-
if (
|
|
30
|
+
if (input === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
else if (typeof input === "string") {
|
|
31
34
|
return { S: input };
|
|
32
35
|
}
|
|
33
36
|
else if (typeof input === "boolean") {
|
|
@@ -135,7 +138,9 @@ export class UtilsDynamoDB {
|
|
|
135
138
|
Limit: options.max_num_items,
|
|
136
139
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
137
140
|
};
|
|
138
|
-
|
|
141
|
+
if (options.print === true) {
|
|
142
|
+
console.log(request);
|
|
143
|
+
}
|
|
139
144
|
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request), compile));
|
|
140
145
|
}
|
|
141
146
|
const segments = await Promise.all(iterators);
|
|
@@ -236,7 +241,9 @@ export class UtilsDynamoDB {
|
|
|
236
241
|
Limit: options.max_num_items,
|
|
237
242
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
238
243
|
};
|
|
239
|
-
|
|
244
|
+
if (options.print === true) {
|
|
245
|
+
console.log(request);
|
|
246
|
+
}
|
|
240
247
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
241
248
|
// .then(async items => index_name === undefined || !project ? items :
|
|
242
249
|
// await Promise.all(items.map(async item => {
|
|
@@ -299,7 +306,9 @@ export class UtilsDynamoDB {
|
|
|
299
306
|
Limit: options.max_num_items,
|
|
300
307
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
301
308
|
};
|
|
302
|
-
|
|
309
|
+
if (options.print === true) {
|
|
310
|
+
console.log(request);
|
|
311
|
+
}
|
|
303
312
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
304
313
|
// .then(async items => index_name === undefined || !project ? items :
|
|
305
314
|
// await Promise.all(items.map(async item => {
|
|
@@ -365,7 +374,9 @@ export class UtilsDynamoDB {
|
|
|
365
374
|
Limit: options.max_num_items,
|
|
366
375
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
367
376
|
};
|
|
368
|
-
|
|
377
|
+
if (options.print === true) {
|
|
378
|
+
console.log(request);
|
|
379
|
+
}
|
|
369
380
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
370
381
|
// .then(async items => index_name === undefined || !project ? items :
|
|
371
382
|
// await Promise.all(items.map(async item => {
|
package/package.json
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -25,8 +25,10 @@ function is_item(x : any): x is Record<string, any> {
|
|
|
25
25
|
return typeof x === "object" && Object.keys(x).filter(key => typeof key !== "string").length === 0 && !Array.isArray(x)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function convert_input(input : string | boolean | number | any[] | Set<any> | Record<string, any>) : AttributeValue | undefined {
|
|
29
|
-
if (
|
|
28
|
+
function convert_input(input : string | boolean | number | any[] | Set<any> | Record<string, any> | undefined) : AttributeValue | undefined {
|
|
29
|
+
if (input === undefined) {
|
|
30
|
+
return undefined
|
|
31
|
+
} else if (typeof input === "string") {
|
|
30
32
|
return { S : input }
|
|
31
33
|
} else if (typeof input === "boolean") {
|
|
32
34
|
return { BOOL : input }
|
|
@@ -160,7 +162,9 @@ export class UtilsDynamoDB {
|
|
|
160
162
|
Limit : options.max_num_items,
|
|
161
163
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
162
164
|
}
|
|
163
|
-
|
|
165
|
+
if (options.print === true) {
|
|
166
|
+
console.log(request)
|
|
167
|
+
}
|
|
164
168
|
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request), compile))
|
|
165
169
|
}
|
|
166
170
|
const segments = await Promise.all(iterators)
|
|
@@ -293,7 +297,9 @@ export class UtilsDynamoDB {
|
|
|
293
297
|
Limit : options.max_num_items,
|
|
294
298
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
295
299
|
}
|
|
296
|
-
|
|
300
|
+
if (options.print === true) {
|
|
301
|
+
console.log(request)
|
|
302
|
+
}
|
|
297
303
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
298
304
|
// .then(async items => index_name === undefined || !project ? items :
|
|
299
305
|
// await Promise.all(items.map(async item => {
|
|
@@ -375,7 +381,9 @@ export class UtilsDynamoDB {
|
|
|
375
381
|
Limit : options.max_num_items,
|
|
376
382
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
377
383
|
}
|
|
378
|
-
|
|
384
|
+
if (options.print === true) {
|
|
385
|
+
console.log(request)
|
|
386
|
+
}
|
|
379
387
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
380
388
|
// .then(async items => index_name === undefined || !project ? items :
|
|
381
389
|
// await Promise.all(items.map(async item => {
|
|
@@ -460,7 +468,9 @@ export class UtilsDynamoDB {
|
|
|
460
468
|
Limit : options.max_num_items,
|
|
461
469
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
462
470
|
}
|
|
463
|
-
|
|
471
|
+
if (options.print === true) {
|
|
472
|
+
console.log(request)
|
|
473
|
+
}
|
|
464
474
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
465
475
|
// .then(async items => index_name === undefined || !project ? items :
|
|
466
476
|
// await Promise.all(items.map(async item => {
|