@atomiqlabs/base 13.1.2 → 13.1.4

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/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./events/types/swap/RefundEvent";
14
14
  export * from "./events/types/swap/SwapEvent";
15
15
  export * from "./lockable/Lockable";
16
16
  export * from "./storage/IStorageManager";
17
+ export * from "./storage/VoidStorageManager";
17
18
  export * from "./storage/StorageObject";
18
19
  export * from "./swaps/SwapContract";
19
20
  export * from "./swaps/SwapData";
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ __exportStar(require("./events/types/swap/RefundEvent"), exports);
30
30
  __exportStar(require("./events/types/swap/SwapEvent"), exports);
31
31
  __exportStar(require("./lockable/Lockable"), exports);
32
32
  __exportStar(require("./storage/IStorageManager"), exports);
33
+ __exportStar(require("./storage/VoidStorageManager"), exports);
33
34
  __exportStar(require("./storage/StorageObject"), exports);
34
35
  __exportStar(require("./swaps/SwapContract"), exports);
35
36
  __exportStar(require("./swaps/SwapData"), exports);
@@ -0,0 +1,33 @@
1
+ import { IStorageManager } from "./IStorageManager";
2
+ /**
3
+ * A dummy storage manager that doesn't store anything, and should be only used as a placeholder
4
+ *
5
+ * @category Storage
6
+ * @internal
7
+ */
8
+ export declare class VoidStorageManager implements IStorageManager<any> {
9
+ /**
10
+ * @inheritDoc
11
+ */
12
+ data: {
13
+ [p: string]: any;
14
+ };
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ init(): Promise<void>;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ loadData(type: {
23
+ new (data: any): any;
24
+ }): Promise<any[]>;
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ removeData(hash: string): Promise<void>;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ saveData(hash: string, object: any): Promise<void>;
33
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VoidStorageManager = void 0;
4
+ /**
5
+ * A dummy storage manager that doesn't store anything, and should be only used as a placeholder
6
+ *
7
+ * @category Storage
8
+ * @internal
9
+ */
10
+ class VoidStorageManager {
11
+ constructor() {
12
+ /**
13
+ * @inheritDoc
14
+ */
15
+ this.data = {};
16
+ }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ init() {
21
+ return Promise.resolve();
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ loadData(type) {
27
+ return Promise.resolve([]);
28
+ }
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ removeData(hash) {
33
+ return Promise.resolve();
34
+ }
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ saveData(hash, object) {
39
+ return Promise.resolve();
40
+ }
41
+ }
42
+ exports.VoidStorageManager = VoidStorageManager;
@@ -55,7 +55,7 @@ async function tryWithRetries(func, retryPolicy, errorAllowed, abortSignal) {
55
55
  if (errorAllowed != null && checkError(e, errorAllowed))
56
56
  throw e;
57
57
  err = e;
58
- logger.warn("tryWithRetries(): Error on try number: " + i, e);
58
+ logger.debug("tryWithRetries(): Error on try number: " + i, e);
59
59
  }
60
60
  if (abortSignal != null && abortSignal.aborted)
61
61
  throw (abortSignal.reason || new Error("Aborted"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/base",
3
- "version": "13.1.2",
3
+ "version": "13.1.4",
4
4
  "description": "Base classes and interfaces for atomiq protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./events/types/swap/RefundEvent";
14
14
  export * from "./events/types/swap/SwapEvent";
15
15
  export * from "./lockable/Lockable";
16
16
  export * from "./storage/IStorageManager";
17
+ export * from "./storage/VoidStorageManager";
17
18
  export * from "./storage/StorageObject";
18
19
  export * from "./swaps/SwapContract";
19
20
  export * from "./swaps/SwapData";
@@ -0,0 +1,42 @@
1
+ import {IStorageManager} from "./IStorageManager";
2
+
3
+ /**
4
+ * A dummy storage manager that doesn't store anything, and should be only used as a placeholder
5
+ *
6
+ * @category Storage
7
+ * @internal
8
+ */
9
+ export class VoidStorageManager implements IStorageManager<any> {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ data: { [p: string]: any } = {};
14
+
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ init(): Promise<void> {
19
+ return Promise.resolve();
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ loadData(type: { new(data: any): any }): Promise<any[]> {
26
+ return Promise.resolve([]);
27
+ }
28
+
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ removeData(hash: string): Promise<void> {
33
+ return Promise.resolve();
34
+ }
35
+
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ saveData(hash: string, object: any): Promise<void> {
40
+ return Promise.resolve();
41
+ }
42
+ }
@@ -61,7 +61,7 @@ export async function tryWithRetries<T>(func: (retryCount: number) => Promise<T>
61
61
  } catch (e) {
62
62
  if (errorAllowed != null && checkError(e, errorAllowed)) throw e;
63
63
  err = e;
64
- logger.warn("tryWithRetries(): Error on try number: " + i, e);
64
+ logger.debug("tryWithRetries(): Error on try number: " + i, e);
65
65
  }
66
66
  if (abortSignal != null && abortSignal.aborted) throw (abortSignal.reason || new Error("Aborted"));
67
67
  if (i !== retryPolicy.maxRetries - 1) {