appwrite-utils-cli 0.0.18 → 0.0.19

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.
@@ -322,13 +322,17 @@ export class ImportController {
322
322
  for (const action of this.postImportActionsQueue) {
323
323
  actionQueue.push(this.importDataActions.executeAfterImportActions(action.finalItem, action.attributeMappings, action.context));
324
324
  }
325
- const results = await Promise.allSettled(actionQueue);
326
- results.forEach((result) => {
327
- if (result.status === "rejected") {
328
- console.error("An action promise was rejected:", result.reason);
329
- logger.error(`An action promise was rejected: ${result.reason} -- ${JSON.stringify(result)}`);
330
- }
331
- });
325
+ const BATCH_LIMIT = 20;
326
+ const splitQueue = _.chunk(actionQueue, BATCH_LIMIT);
327
+ for (const queue of splitQueue) {
328
+ const results = await Promise.allSettled(queue);
329
+ results.forEach((result) => {
330
+ if (result.status === "rejected") {
331
+ console.error("An action promise was rejected:", result.reason);
332
+ logger.error(`An action promise was rejected: ${result.reason} -- ${JSON.stringify(result)}`);
333
+ }
334
+ });
335
+ }
332
336
  // const collectionActionsPromises = [];
333
337
  // for (const collection of this.config.collections) {
334
338
  // collectionActionsPromises.push(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "appwrite-utils-cli",
3
3
  "description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -522,17 +522,21 @@ export class ImportController {
522
522
  )
523
523
  );
524
524
  }
525
- const results = await Promise.allSettled(actionQueue);
526
- results.forEach((result) => {
527
- if (result.status === "rejected") {
528
- console.error("An action promise was rejected:", result.reason);
529
- logger.error(
530
- `An action promise was rejected: ${result.reason} -- ${JSON.stringify(
531
- result
532
- )}`
533
- );
534
- }
535
- });
525
+ const BATCH_LIMIT = 20;
526
+ const splitQueue = _.chunk(actionQueue, BATCH_LIMIT);
527
+ for (const queue of splitQueue) {
528
+ const results = await Promise.allSettled(queue);
529
+ results.forEach((result) => {
530
+ if (result.status === "rejected") {
531
+ console.error("An action promise was rejected:", result.reason);
532
+ logger.error(
533
+ `An action promise was rejected: ${
534
+ result.reason
535
+ } -- ${JSON.stringify(result)}`
536
+ );
537
+ }
538
+ });
539
+ }
536
540
  // const collectionActionsPromises = [];
537
541
  // for (const collection of this.config.collections) {
538
542
  // collectionActionsPromises.push(