idea-aws 3.7.5 → 3.7.6
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/dynamoDB.js +9 -6
- package/package.json +1 -1
package/dist/src/dynamoDB.js
CHANGED
|
@@ -157,12 +157,14 @@ class DynamoDB {
|
|
|
157
157
|
(0, idea_toolbox_1.logger)(`BATCH GET ${table}`, null, 'No elements to get');
|
|
158
158
|
return [];
|
|
159
159
|
}
|
|
160
|
-
await this.batchGetHelper(table, keys, [], Boolean(ignoreErr));
|
|
160
|
+
return await this.batchGetHelper(table, keys, [], Boolean(ignoreErr));
|
|
161
161
|
}
|
|
162
162
|
async batchGetHelper(table, keys, resultElements, ignoreErr, currentChunk = 0, chunkSize = 100) {
|
|
163
|
-
const batch = {
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
const batch = {
|
|
164
|
+
RequestItems: {
|
|
165
|
+
[table]: { Keys: keys.slice(currentChunk, currentChunk + chunkSize) }
|
|
166
|
+
}
|
|
167
|
+
};
|
|
166
168
|
(0, idea_toolbox_1.logger)(`BATCH GET ${table}`, null, `${currentChunk} of ${keys.length}`);
|
|
167
169
|
let result;
|
|
168
170
|
try {
|
|
@@ -176,9 +178,10 @@ class DynamoDB {
|
|
|
176
178
|
resultElements = resultElements.concat(result.Responses[table]);
|
|
177
179
|
// if there are still chunks to manage, go on recursively
|
|
178
180
|
if (currentChunk + chunkSize < keys.length)
|
|
179
|
-
await this.batchGetHelper(table, keys, resultElements, ignoreErr, currentChunk + chunkSize, chunkSize);
|
|
181
|
+
return await this.batchGetHelper(table, keys, resultElements, ignoreErr, currentChunk + chunkSize, chunkSize);
|
|
180
182
|
// no more chunks to manage: we're done
|
|
181
|
-
|
|
183
|
+
else
|
|
184
|
+
return resultElements;
|
|
182
185
|
}
|
|
183
186
|
/**
|
|
184
187
|
* Put an array of items in a DynamoDb table, avoiding the limits of DynamoDB's BatchWriteItem.
|