ismx-nexo-node-app 0.4.32 → 0.4.33

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.
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -11,14 +20,14 @@ class BusinessThread extends Business_1.default {
11
20
  init() {
12
21
  var _a, _b;
13
22
  this.timeoutId = setTimeout(() => {
14
- this.intervalId = setInterval(() => {
23
+ this.intervalId = setInterval(() => __awaiter(this, void 0, void 0, function* () {
15
24
  try {
16
- this.run();
25
+ yield this.run();
17
26
  }
18
27
  catch (err) {
19
28
  this.onError(err);
20
29
  }
21
- }, this.interval());
30
+ }), this.interval());
22
31
  }, (_b = (_a = this.delay) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : 0);
23
32
  }
24
33
  terminate() {
@@ -5,7 +5,7 @@ export default abstract class BusinessThread extends Business {
5
5
  constructor();
6
6
  init(): void;
7
7
  terminate(): void;
8
- abstract run(): void;
8
+ abstract run(): Promise<void>;
9
9
  abstract interval(): number;
10
10
  abstract delay?(): number;
11
11
  onError(err: Error): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.32",
3
+ "version": "0.4.33",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -11,8 +11,8 @@ export default abstract class BusinessThread extends Business
11
11
 
12
12
  init() {
13
13
  this.timeoutId = setTimeout(() => {
14
- this.intervalId = setInterval(() => {
15
- try { this.run() }
14
+ this.intervalId = setInterval(async () => {
15
+ try { await this.run() }
16
16
  catch (err) { this.onError(err as Error) }
17
17
  }, this.interval());
18
18
  }, this.delay?.() ?? 0);
@@ -23,7 +23,7 @@ export default abstract class BusinessThread extends Business
23
23
  clearTimeout(this.timeoutId);
24
24
  }
25
25
 
26
- abstract run(): void
26
+ abstract run(): Promise<void>
27
27
  abstract interval(): number
28
28
  abstract delay?(): number
29
29
  onError(err: Error) {}