triangle-utils 1.4.77 → 1.4.78
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.
|
@@ -3,12 +3,14 @@ export declare class UtilsDynamoDB {
|
|
|
3
3
|
constructor(region: string);
|
|
4
4
|
get_table_key_names(table_name: string): Promise<string[] | undefined>;
|
|
5
5
|
scan(table_index_name: string, options?: {
|
|
6
|
+
compile?: boolean;
|
|
6
7
|
filters?: Record<string, any>;
|
|
7
8
|
undefined_attribute_names?: string[];
|
|
8
9
|
defined_attribute_names?: string[];
|
|
9
10
|
attribute_names?: string[];
|
|
10
11
|
segment_id?: number;
|
|
11
12
|
num_segments?: number;
|
|
13
|
+
max_num_items?: number;
|
|
12
14
|
last_key?: Record<string, any>;
|
|
13
15
|
}): Promise<Record<string, any>[]>;
|
|
14
16
|
get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
|
|
@@ -101,6 +101,7 @@ export class UtilsDynamoDB {
|
|
|
101
101
|
async scan(table_index_name, options = {}) {
|
|
102
102
|
const table_name = table_index_name.split(":")[0];
|
|
103
103
|
const index_name = table_index_name.split(":")[1];
|
|
104
|
+
const compile = options.compile !== undefined ? options.compile : true;
|
|
104
105
|
const filters = options.filters !== undefined ? options.filters : {};
|
|
105
106
|
const undefined_attribute_names = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : [];
|
|
106
107
|
const defined_attribute_names = options.defined_attribute_names !== undefined ? options.defined_attribute_names : [];
|
|
@@ -131,9 +132,10 @@ export class UtilsDynamoDB {
|
|
|
131
132
|
ProjectionExpression: projection_expression.length > 0 ? projection_expression : undefined,
|
|
132
133
|
Segment: i,
|
|
133
134
|
TotalSegments: num_segments,
|
|
135
|
+
Limit: options.max_num_items,
|
|
134
136
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
135
137
|
};
|
|
136
|
-
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request)));
|
|
138
|
+
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request), compile));
|
|
137
139
|
}
|
|
138
140
|
const segments = await Promise.all(iterators);
|
|
139
141
|
const items = segments.flat().filter(is_item);
|
package/package.json
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -108,17 +108,20 @@ export class UtilsDynamoDB {
|
|
|
108
108
|
async scan(
|
|
109
109
|
table_index_name : string,
|
|
110
110
|
options : {
|
|
111
|
+
compile? : boolean,
|
|
111
112
|
filters? : Record<string, any>,
|
|
112
113
|
undefined_attribute_names? : string[],
|
|
113
114
|
defined_attribute_names? : string[],
|
|
114
115
|
attribute_names? : string[],
|
|
115
116
|
segment_id? : number
|
|
116
117
|
num_segments? : number,
|
|
118
|
+
max_num_items? : number,
|
|
117
119
|
last_key? : Record<string, any>
|
|
118
120
|
} = {}
|
|
119
121
|
) : Promise<Record<string, any>[]> {
|
|
120
122
|
const table_name : string = table_index_name.split(":")[0]
|
|
121
123
|
const index_name : string | undefined = table_index_name.split(":")[1]
|
|
124
|
+
const compile = options.compile !== undefined ? options.compile : true
|
|
122
125
|
const filters = options.filters !== undefined ? options.filters : {}
|
|
123
126
|
const undefined_attribute_names : string[] = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : []
|
|
124
127
|
const defined_attribute_names : string[] = options.defined_attribute_names !== undefined ? options.defined_attribute_names : []
|
|
@@ -153,9 +156,10 @@ export class UtilsDynamoDB {
|
|
|
153
156
|
ProjectionExpression : projection_expression.length > 0 ? projection_expression : undefined,
|
|
154
157
|
Segment : i,
|
|
155
158
|
TotalSegments : num_segments,
|
|
159
|
+
Limit : options.max_num_items,
|
|
156
160
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
157
161
|
}
|
|
158
|
-
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request)))
|
|
162
|
+
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request), compile))
|
|
159
163
|
}
|
|
160
164
|
const segments = await Promise.all(iterators)
|
|
161
165
|
const items = segments.flat().filter(is_item)
|