triangle-utils 1.4.73 → 1.4.74
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.
|
@@ -19,6 +19,7 @@ export declare class UtilsDynamoDB {
|
|
|
19
19
|
undefined_attribute_names?: string[];
|
|
20
20
|
defined_attribute_names?: string[];
|
|
21
21
|
attribute_names?: string[];
|
|
22
|
+
max_num_items?: number;
|
|
22
23
|
}): Promise<Record<string, any>[]>;
|
|
23
24
|
query_prefix(table_index_name: string, primary_key: Record<string, any>, secondary_key_prefix: Record<string, string>, options?: {
|
|
24
25
|
reverse?: boolean;
|
|
@@ -27,6 +28,7 @@ export declare class UtilsDynamoDB {
|
|
|
27
28
|
undefined_attribute_names?: string[];
|
|
28
29
|
defined_attribute_names?: string[];
|
|
29
30
|
attribute_names?: string[];
|
|
31
|
+
max_num_items?: number;
|
|
30
32
|
}): Promise<Record<string, any>[]>;
|
|
31
33
|
query_range(table_index_name: string, primary_key: Record<string, any>, secondary_key_range: Record<string, (string | number)[]>, options?: {
|
|
32
34
|
reverse?: boolean;
|
|
@@ -35,6 +37,7 @@ export declare class UtilsDynamoDB {
|
|
|
35
37
|
undefined_attribute_names?: string[];
|
|
36
38
|
defined_attribute_names?: string[];
|
|
37
39
|
attribute_names?: string[];
|
|
40
|
+
max_num_items?: number;
|
|
38
41
|
}): Promise<Record<string, any>[]>;
|
|
39
42
|
set(table_name: string, key: Record<string, any>, attributes: Record<string, any>): Promise<void>;
|
|
40
43
|
append(table_name: string, key: Record<string, any>, attributes: Record<string, any[]>): Promise<void>;
|
|
@@ -227,7 +227,8 @@ export class UtilsDynamoDB {
|
|
|
227
227
|
FilterExpression: filter_expression.length > 0 ? filter_expression : undefined,
|
|
228
228
|
ProjectionExpression: projection_expression.length > 0 ? projection_expression : undefined,
|
|
229
229
|
KeyConditionExpression: Object.keys(primary_key).map(key => "#" + key + " = :" + key).join(" AND "),
|
|
230
|
-
ScanIndexForward: !reverse
|
|
230
|
+
ScanIndexForward: !reverse,
|
|
231
|
+
Limit: options.max_num_items
|
|
231
232
|
};
|
|
232
233
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
233
234
|
// .then(async items => index_name === undefined || !project ? items :
|
|
@@ -287,7 +288,8 @@ export class UtilsDynamoDB {
|
|
|
287
288
|
...Object.keys(primary_key).map(key => "#" + key + " = :" + key),
|
|
288
289
|
...Object.keys(secondary_key_prefix).map(key => "begins_with(#" + key + ", :" + key + ")")
|
|
289
290
|
].join(" AND "),
|
|
290
|
-
ScanIndexForward: !reverse
|
|
291
|
+
ScanIndexForward: !reverse,
|
|
292
|
+
Limit: options.max_num_items
|
|
291
293
|
};
|
|
292
294
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
293
295
|
// .then(async items => index_name === undefined || !project ? items :
|
|
@@ -350,7 +352,8 @@ export class UtilsDynamoDB {
|
|
|
350
352
|
...Object.keys(primary_key).map(key => "#" + key + " = :" + key),
|
|
351
353
|
...Object.keys(secondary_key_range).map(key => "(#" + key + " BETWEEN :" + key + "_min AND :" + key + "_max)")
|
|
352
354
|
].join(" AND "),
|
|
353
|
-
ScanIndexForward: !reverse
|
|
355
|
+
ScanIndexForward: !reverse,
|
|
356
|
+
Limit: options.max_num_items
|
|
354
357
|
};
|
|
355
358
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
356
359
|
// .then(async items => index_name === undefined || !project ? items :
|
package/package.json
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -231,7 +231,8 @@ export class UtilsDynamoDB {
|
|
|
231
231
|
filters? : Record<string, any>,
|
|
232
232
|
undefined_attribute_names? : string[],
|
|
233
233
|
defined_attribute_names? : string[],
|
|
234
|
-
attribute_names? : string[]
|
|
234
|
+
attribute_names? : string[],
|
|
235
|
+
max_num_items? : number
|
|
235
236
|
} = {}
|
|
236
237
|
) : Promise<Record<string, any>[]>{
|
|
237
238
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -275,7 +276,8 @@ export class UtilsDynamoDB {
|
|
|
275
276
|
FilterExpression : filter_expression.length > 0 ? filter_expression : undefined,
|
|
276
277
|
ProjectionExpression : projection_expression.length > 0 ? projection_expression : undefined,
|
|
277
278
|
KeyConditionExpression: Object.keys(primary_key).map(key => "#" + key + " = :" + key).join(" AND "),
|
|
278
|
-
ScanIndexForward : !reverse
|
|
279
|
+
ScanIndexForward : !reverse,
|
|
280
|
+
Limit : options.max_num_items
|
|
279
281
|
}
|
|
280
282
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
281
283
|
// .then(async items => index_name === undefined || !project ? items :
|
|
@@ -300,7 +302,8 @@ export class UtilsDynamoDB {
|
|
|
300
302
|
filters? : Record<string, any>,
|
|
301
303
|
undefined_attribute_names? : string[],
|
|
302
304
|
defined_attribute_names? : string[],
|
|
303
|
-
attribute_names? : string[]
|
|
305
|
+
attribute_names? : string[],
|
|
306
|
+
max_num_items? : number
|
|
304
307
|
} = {}
|
|
305
308
|
) : Promise<Record<string, any>[]>{
|
|
306
309
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -351,7 +354,8 @@ export class UtilsDynamoDB {
|
|
|
351
354
|
...Object.keys(primary_key).map(key => "#" + key + " = :" + key),
|
|
352
355
|
...Object.keys(secondary_key_prefix).map(key => "begins_with(#" + key + ", :" + key + ")")
|
|
353
356
|
].join(" AND "),
|
|
354
|
-
ScanIndexForward : !reverse
|
|
357
|
+
ScanIndexForward : !reverse,
|
|
358
|
+
Limit : options.max_num_items
|
|
355
359
|
}
|
|
356
360
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
357
361
|
// .then(async items => index_name === undefined || !project ? items :
|
|
@@ -376,7 +380,8 @@ export class UtilsDynamoDB {
|
|
|
376
380
|
filters? : Record<string, any>,
|
|
377
381
|
undefined_attribute_names? : string[],
|
|
378
382
|
defined_attribute_names? : string[],
|
|
379
|
-
attribute_names? : string[]
|
|
383
|
+
attribute_names? : string[],
|
|
384
|
+
max_num_items? : number
|
|
380
385
|
} = {}
|
|
381
386
|
) : Promise<Record<string, any>[]>{
|
|
382
387
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -430,7 +435,8 @@ export class UtilsDynamoDB {
|
|
|
430
435
|
...Object.keys(primary_key).map(key => "#" + key + " = :" + key),
|
|
431
436
|
...Object.keys(secondary_key_range).map(key => "(#" + key + " BETWEEN :" + key + "_min AND :" + key + "_max)")
|
|
432
437
|
].join(" AND "),
|
|
433
|
-
ScanIndexForward : !reverse
|
|
438
|
+
ScanIndexForward : !reverse,
|
|
439
|
+
Limit : options.max_num_items
|
|
434
440
|
}
|
|
435
441
|
const items = await compile_pages(request, (request) => this.dynamodb.query(request), compile)
|
|
436
442
|
// .then(async items => index_name === undefined || !project ? items :
|