triangle-utils 1.4.94 → 1.4.96
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.d.ts +4 -0
- package/dist/src/UtilsDynamoDB.js +12 -0
- package/package.json +1 -1
- package/src/UtilsDynamoDB.ts +20 -4
|
@@ -12,6 +12,7 @@ export declare class UtilsDynamoDB {
|
|
|
12
12
|
num_segments?: number;
|
|
13
13
|
max_num_items?: number;
|
|
14
14
|
last_key?: Record<string, any>;
|
|
15
|
+
print?: boolean;
|
|
15
16
|
}): Promise<Record<string, any>[]>;
|
|
16
17
|
get(table: string, key: Record<string, any>, options?: {
|
|
17
18
|
consistent?: boolean;
|
|
@@ -26,6 +27,7 @@ export declare class UtilsDynamoDB {
|
|
|
26
27
|
attribute_names?: string[];
|
|
27
28
|
max_num_items?: number;
|
|
28
29
|
last_key?: Record<string, any>;
|
|
30
|
+
print?: boolean;
|
|
29
31
|
}): Promise<Record<string, any>[]>;
|
|
30
32
|
query_prefix(table_index_name: string, primary_key: Record<string, any>, secondary_key_prefix: Record<string, string>, options?: {
|
|
31
33
|
reverse?: boolean;
|
|
@@ -36,6 +38,7 @@ export declare class UtilsDynamoDB {
|
|
|
36
38
|
attribute_names?: string[];
|
|
37
39
|
max_num_items?: number;
|
|
38
40
|
last_key?: Record<string, any>;
|
|
41
|
+
print?: boolean;
|
|
39
42
|
}): Promise<Record<string, any>[]>;
|
|
40
43
|
query_range(table_index_name: string, primary_key: Record<string, any>, secondary_key_range: Record<string, (string | number)[]>, options?: {
|
|
41
44
|
reverse?: boolean;
|
|
@@ -46,6 +49,7 @@ export declare class UtilsDynamoDB {
|
|
|
46
49
|
attribute_names?: string[];
|
|
47
50
|
max_num_items?: number;
|
|
48
51
|
last_key?: Record<string, any>;
|
|
52
|
+
print?: boolean;
|
|
49
53
|
}): Promise<Record<string, any>[]>;
|
|
50
54
|
set(table_name: string, key: Record<string, any>, attributes: Record<string, any>): Promise<void>;
|
|
51
55
|
append(table_name: string, key: Record<string, any>, attributes: Record<string, any[]>): Promise<void>;
|
|
@@ -135,6 +135,9 @@ export class UtilsDynamoDB {
|
|
|
135
135
|
Limit: options.max_num_items,
|
|
136
136
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
137
137
|
};
|
|
138
|
+
if (options.print === true) {
|
|
139
|
+
console.log(request);
|
|
140
|
+
}
|
|
138
141
|
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request), compile));
|
|
139
142
|
}
|
|
140
143
|
const segments = await Promise.all(iterators);
|
|
@@ -235,6 +238,9 @@ export class UtilsDynamoDB {
|
|
|
235
238
|
Limit: options.max_num_items,
|
|
236
239
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
237
240
|
};
|
|
241
|
+
if (options.print === true) {
|
|
242
|
+
console.log(request);
|
|
243
|
+
}
|
|
238
244
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
239
245
|
// .then(async items => index_name === undefined || !project ? items :
|
|
240
246
|
// await Promise.all(items.map(async item => {
|
|
@@ -297,6 +303,9 @@ export class UtilsDynamoDB {
|
|
|
297
303
|
Limit: options.max_num_items,
|
|
298
304
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
299
305
|
};
|
|
306
|
+
if (options.print === true) {
|
|
307
|
+
console.log(request);
|
|
308
|
+
}
|
|
300
309
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
301
310
|
// .then(async items => index_name === undefined || !project ? items :
|
|
302
311
|
// await Promise.all(items.map(async item => {
|
|
@@ -362,6 +371,9 @@ export class UtilsDynamoDB {
|
|
|
362
371
|
Limit: options.max_num_items,
|
|
363
372
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
364
373
|
};
|
|
374
|
+
if (options.print === true) {
|
|
375
|
+
console.log(request);
|
|
376
|
+
}
|
|
365
377
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
366
378
|
// .then(async items => index_name === undefined || !project ? items :
|
|
367
379
|
// await Promise.all(items.map(async item => {
|
package/package.json
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -116,7 +116,8 @@ export class UtilsDynamoDB {
|
|
|
116
116
|
segment_id? : number
|
|
117
117
|
num_segments? : number,
|
|
118
118
|
max_num_items? : number,
|
|
119
|
-
last_key? : Record<string, any
|
|
119
|
+
last_key? : Record<string, any>,
|
|
120
|
+
print? : boolean
|
|
120
121
|
} = {}
|
|
121
122
|
) : Promise<Record<string, any>[]> {
|
|
122
123
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -159,6 +160,9 @@ export class UtilsDynamoDB {
|
|
|
159
160
|
Limit : options.max_num_items,
|
|
160
161
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
161
162
|
}
|
|
163
|
+
if (options.print === true) {
|
|
164
|
+
console.log(request)
|
|
165
|
+
}
|
|
162
166
|
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request), compile))
|
|
163
167
|
}
|
|
164
168
|
const segments = await Promise.all(iterators)
|
|
@@ -242,7 +246,8 @@ export class UtilsDynamoDB {
|
|
|
242
246
|
defined_attribute_names? : string[],
|
|
243
247
|
attribute_names? : string[],
|
|
244
248
|
max_num_items? : number,
|
|
245
|
-
last_key? : Record<string, any
|
|
249
|
+
last_key? : Record<string, any>,
|
|
250
|
+
print? : boolean
|
|
246
251
|
} = {}
|
|
247
252
|
) : Promise<Record<string, any>[]>{
|
|
248
253
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -290,6 +295,9 @@ export class UtilsDynamoDB {
|
|
|
290
295
|
Limit : options.max_num_items,
|
|
291
296
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
292
297
|
}
|
|
298
|
+
if (options.print === true) {
|
|
299
|
+
console.log(request)
|
|
300
|
+
}
|
|
293
301
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
294
302
|
// .then(async items => index_name === undefined || !project ? items :
|
|
295
303
|
// await Promise.all(items.map(async item => {
|
|
@@ -315,7 +323,8 @@ export class UtilsDynamoDB {
|
|
|
315
323
|
defined_attribute_names? : string[],
|
|
316
324
|
attribute_names? : string[],
|
|
317
325
|
max_num_items? : number,
|
|
318
|
-
last_key? : Record<string, any
|
|
326
|
+
last_key? : Record<string, any>,
|
|
327
|
+
print? : boolean
|
|
319
328
|
} = {}
|
|
320
329
|
) : Promise<Record<string, any>[]>{
|
|
321
330
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -370,6 +379,9 @@ export class UtilsDynamoDB {
|
|
|
370
379
|
Limit : options.max_num_items,
|
|
371
380
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
372
381
|
}
|
|
382
|
+
if (options.print === true) {
|
|
383
|
+
console.log(request)
|
|
384
|
+
}
|
|
373
385
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
374
386
|
// .then(async items => index_name === undefined || !project ? items :
|
|
375
387
|
// await Promise.all(items.map(async item => {
|
|
@@ -395,7 +407,8 @@ export class UtilsDynamoDB {
|
|
|
395
407
|
defined_attribute_names? : string[],
|
|
396
408
|
attribute_names? : string[],
|
|
397
409
|
max_num_items? : number,
|
|
398
|
-
last_key? : Record<string, any
|
|
410
|
+
last_key? : Record<string, any>,
|
|
411
|
+
print? : boolean
|
|
399
412
|
} = {}
|
|
400
413
|
) : Promise<Record<string, any>[]>{
|
|
401
414
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -453,6 +466,9 @@ export class UtilsDynamoDB {
|
|
|
453
466
|
Limit : options.max_num_items,
|
|
454
467
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
455
468
|
}
|
|
469
|
+
if (options.print === true) {
|
|
470
|
+
console.log(request)
|
|
471
|
+
}
|
|
456
472
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
457
473
|
// .then(async items => index_name === undefined || !project ? items :
|
|
458
474
|
// await Promise.all(items.map(async item => {
|