ag-common 0.0.346 → 0.0.347

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.
@@ -320,15 +320,21 @@ const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* ()
320
320
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
321
321
  // @ts-ignore
322
322
  let keyHash = infoV.Table.KeySchema.find((k) => k.KeyType === 'HASH').AttributeName;
323
- let all = yield dbRaw
324
- .scan({
323
+ const params = {
325
324
  TableName: tableName,
326
- })
327
- .promise();
328
- (0, log_1.warn)(`will delete ${(_h = all === null || all === void 0 ? void 0 : all.Items) === null || _h === void 0 ? void 0 : _h.length} items from ${tableName}`);
325
+ ExclusiveStartKey: undefined,
326
+ };
327
+ let all = [];
328
+ let working;
329
+ do {
330
+ working = yield dbRaw.scan(params).promise();
331
+ (_h = working.Items) === null || _h === void 0 ? void 0 : _h.forEach((item) => all.push(item));
332
+ params.ExclusiveStartKey = working.LastEvaluatedKey;
333
+ } while (typeof working.LastEvaluatedKey !== 'undefined');
334
+ (0, log_1.warn)(`will delete ${all === null || all === void 0 ? void 0 : all.length} items from ${tableName}`);
329
335
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
330
336
  // @ts-ignore
331
- const datagr = (0, array_1.chunk)(all.Items, 25);
337
+ const datagr = (0, array_1.chunk)(all, 25);
332
338
  let res = yield Promise.all(datagr.map((group) => dbRaw
333
339
  .batchWriteItem({
334
340
  RequestItems: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.346",
3
+ "version": "0.0.347",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",