triangle-utils 1.4.62 → 1.4.64
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/UtilsBee.js
CHANGED
|
@@ -7,8 +7,8 @@ export declare class UtilsDynamoDB {
|
|
|
7
7
|
undefined_attribute_names?: string[];
|
|
8
8
|
defined_attribute_names?: string[];
|
|
9
9
|
attribute_names?: string[];
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
segment_id?: number;
|
|
11
|
+
num_segments?: number;
|
|
12
12
|
}): Promise<Record<string, any>[]>;
|
|
13
13
|
get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
|
|
14
14
|
get_max(table_index_name: string, primary_key: Record<string, string | number>): Promise<Record<string, any> | undefined>;
|
|
@@ -104,11 +104,11 @@ export class UtilsDynamoDB {
|
|
|
104
104
|
const filters = options.filters !== undefined ? options.filters : {};
|
|
105
105
|
const undefined_attribute_names = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : [];
|
|
106
106
|
const defined_attribute_names = options.defined_attribute_names !== undefined ? options.defined_attribute_names : [];
|
|
107
|
-
const
|
|
107
|
+
const num_segments = options.num_segments !== undefined ? options.num_segments : 1;
|
|
108
108
|
const attribute_names = options.attribute_names !== undefined ? options.attribute_names : [];
|
|
109
109
|
const iterators = [];
|
|
110
|
-
for (let i = 0; i <
|
|
111
|
-
if (options.
|
|
110
|
+
for (let i = 0; i < num_segments; i++) {
|
|
111
|
+
if (options.segment_id !== undefined && i !== options.segment_id) {
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
114
|
const expression_attribute_names = Object.fromEntries([...Object.keys(filters), ...attribute_names, ...undefined_attribute_names, ...defined_attribute_names]
|
|
@@ -130,7 +130,7 @@ export class UtilsDynamoDB {
|
|
|
130
130
|
FilterExpression: filter_expression.length > 0 ? filter_expression : undefined,
|
|
131
131
|
ProjectionExpression: projection_expression.length > 0 ? projection_expression : undefined,
|
|
132
132
|
Segment: i,
|
|
133
|
-
TotalSegments:
|
|
133
|
+
TotalSegments: num_segments
|
|
134
134
|
};
|
|
135
135
|
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request)));
|
|
136
136
|
}
|
package/package.json
CHANGED
package/src/UtilsBee.ts
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -112,8 +112,8 @@ export class UtilsDynamoDB {
|
|
|
112
112
|
undefined_attribute_names? : string[],
|
|
113
113
|
defined_attribute_names? : string[],
|
|
114
114
|
attribute_names? : string[],
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
segment_id? : number
|
|
116
|
+
num_segments? : number
|
|
117
117
|
} = {}
|
|
118
118
|
) : Promise<Record<string, any>[]> {
|
|
119
119
|
const table_name : string = table_index_name.split(":")[0]
|
|
@@ -121,11 +121,11 @@ export class UtilsDynamoDB {
|
|
|
121
121
|
const filters = options.filters !== undefined ? options.filters : {}
|
|
122
122
|
const undefined_attribute_names : string[] = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : []
|
|
123
123
|
const defined_attribute_names : string[] = options.defined_attribute_names !== undefined ? options.defined_attribute_names : []
|
|
124
|
-
const
|
|
124
|
+
const num_segments : number = options.num_segments !== undefined ? options.num_segments : 1
|
|
125
125
|
const attribute_names : string[] = options.attribute_names !== undefined ? options.attribute_names : []
|
|
126
126
|
const iterators = []
|
|
127
|
-
for (let i = 0; i <
|
|
128
|
-
if (options.
|
|
127
|
+
for (let i = 0; i < num_segments; i++) {
|
|
128
|
+
if (options.segment_id !== undefined && i !== options.segment_id) {
|
|
129
129
|
continue
|
|
130
130
|
}
|
|
131
131
|
const expression_attribute_names = Object.fromEntries(
|
|
@@ -151,7 +151,7 @@ export class UtilsDynamoDB {
|
|
|
151
151
|
FilterExpression : filter_expression.length > 0 ? filter_expression : undefined,
|
|
152
152
|
ProjectionExpression : projection_expression.length > 0 ? projection_expression : undefined,
|
|
153
153
|
Segment : i,
|
|
154
|
-
TotalSegments :
|
|
154
|
+
TotalSegments : num_segments
|
|
155
155
|
}
|
|
156
156
|
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request)))
|
|
157
157
|
}
|