async-queue-runner 0.18.0 → 0.19.0

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/_cjs/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.util = exports.Delay = void 0;
3
+ exports.util = exports.Abort = exports.Delay = void 0;
4
4
  const action_js_1 = require("./action.js");
5
5
  class Delay extends action_js_1.Action {
6
6
  async execute() {
@@ -10,6 +10,12 @@ class Delay extends action_js_1.Action {
10
10
  }
11
11
  }
12
12
  exports.Delay = Delay;
13
+ class Abort extends action_js_1.Action {
14
+ async execute(context) {
15
+ context.abort();
16
+ }
17
+ }
18
+ exports.Abort = Abort;
13
19
  exports.util = {
14
20
  delay(timeout) {
15
21
  return new Delay({ delay: timeout });
@@ -39,4 +45,5 @@ exports.util = {
39
45
  }
40
46
  return new Validator();
41
47
  },
48
+ abort: new Abort(),
42
49
  };
package/_esm/utils.js CHANGED
@@ -6,6 +6,11 @@ export class Delay extends Action {
6
6
  });
7
7
  }
8
8
  }
9
+ export class Abort extends Action {
10
+ async execute(context) {
11
+ context.abort();
12
+ }
13
+ }
9
14
  export const util = {
10
15
  delay(timeout) {
11
16
  return new Delay({ delay: timeout });
@@ -35,4 +40,5 @@ export const util = {
35
40
  }
36
41
  return new Validator();
37
42
  },
43
+ abort: new Abort(),
38
44
  };
package/_types/utils.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { Action } from "./action.js";
2
- import { Branches, IAction } from "./types.js";
2
+ import { Branches, QueueContext, IAction } from "./types.js";
3
3
  export declare class Delay extends Action<null> {
4
4
  execute(): Promise<void>;
5
5
  }
6
+ export declare class Abort extends Action<null> {
7
+ execute(context: QueueContext): Promise<void>;
8
+ }
6
9
  export declare const util: {
7
10
  delay(timeout: number): Delay;
8
11
  if<C>(condition: (context: C) => Promise<boolean> | boolean, branches: Branches): IAction;
9
12
  valid<C_1>(validator: (context: C_1) => Promise<boolean> | boolean, actions: IAction[]): IAction;
13
+ abort: Abort;
10
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "async-queue-runner",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Library to run in parallel extendable queue of tasks",
5
5
  "scripts": {
6
6
  "compile": "tsc --project ./tsconfig.json",