@devrev/ts-adaas 1.5.0 → 1.5.1

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.
@@ -11,3 +11,4 @@ export declare const AIRDROP_DEFAULT_ITEM_TYPES: {
11
11
  SSOR_ATTACHMENT: string;
12
12
  };
13
13
  export declare const LIBRARY_VERSION: any;
14
+ export declare const DEFAULT_SLEEP_DELAY_MS = 180000;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LIBRARY_VERSION = exports.AIRDROP_DEFAULT_ITEM_TYPES = exports.MAX_DEVREV_ARTIFACT_SIZE = exports.ARTIFACT_BATCH_SIZE = exports.ALLOWED_EVENT_TYPES = exports.ALLOWED_LOADING_EVENT_TYPES = exports.ALLOWED_EXTRACTION_EVENT_TYPES = exports.STATELESS_EVENT_TYPES = void 0;
3
+ exports.DEFAULT_SLEEP_DELAY_MS = exports.LIBRARY_VERSION = exports.AIRDROP_DEFAULT_ITEM_TYPES = exports.MAX_DEVREV_ARTIFACT_SIZE = exports.ARTIFACT_BATCH_SIZE = exports.ALLOWED_EVENT_TYPES = exports.ALLOWED_LOADING_EVENT_TYPES = exports.ALLOWED_EXTRACTION_EVENT_TYPES = exports.STATELESS_EVENT_TYPES = void 0;
4
4
  const extraction_1 = require("../types/extraction");
5
5
  const helpers_1 = require("./helpers");
6
6
  exports.STATELESS_EVENT_TYPES = [
@@ -39,3 +39,4 @@ exports.AIRDROP_DEFAULT_ITEM_TYPES = {
39
39
  SSOR_ATTACHMENT: 'ssor_attachment',
40
40
  };
41
41
  exports.LIBRARY_VERSION = (0, helpers_1.getLibraryVersion)();
42
+ exports.DEFAULT_SLEEP_DELAY_MS = 180000; // 3 minutes
@@ -16,3 +16,4 @@ export declare function addReportToLoaderReport({ loaderReports, report, }: {
16
16
  }): LoaderReport[];
17
17
  export declare function getCircularReplacer(): (key: any, value: any) => any;
18
18
  export declare function getLibraryVersion(): any;
19
+ export declare function sleep(ms: number): Promise<unknown>;
@@ -39,6 +39,7 @@ exports.getFilesToLoad = getFilesToLoad;
39
39
  exports.addReportToLoaderReport = addReportToLoaderReport;
40
40
  exports.getCircularReplacer = getCircularReplacer;
41
41
  exports.getLibraryVersion = getLibraryVersion;
42
+ exports.sleep = sleep;
42
43
  const extraction_1 = require("../types/extraction");
43
44
  const loading_1 = require("../types/loading");
44
45
  const fs_1 = require("fs");
@@ -176,3 +177,7 @@ function getLibraryVersion() {
176
177
  return '';
177
178
  }
178
179
  }
180
+ function sleep(ms) {
181
+ console.log(`Sleeping for ${ms}ms.`);
182
+ return new Promise((resolve) => setTimeout(resolve, ms));
183
+ }
@@ -15,6 +15,7 @@ const mappers_1 = require("../mappers/mappers");
15
15
  const uploader_1 = require("../uploader/uploader");
16
16
  const logger_1 = require("../logger/logger");
17
17
  const mappers_interface_1 = require("../mappers/mappers.interface");
18
+ const helpers_2 = require("../common/helpers");
18
19
  function createWorkerAdapter({ event, adapterState, options, }) {
19
20
  return new WorkerAdapter({
20
21
  event,
@@ -91,6 +92,10 @@ class WorkerAdapter {
91
92
  }
92
93
  // Loop through the batches of attachments
93
94
  for (let i = lastProcessedBatchIndex; i < reducedAttachments.length; i++) {
95
+ // Check if we hit timeout
96
+ if (adapter.isTimeout) {
97
+ await (0, helpers_2.sleep)(constants_1.DEFAULT_SLEEP_DELAY_MS);
98
+ }
94
99
  const attachmentsBatch = reducedAttachments[i];
95
100
  // Create a list of promises for parallel processing
96
101
  const promises = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",