@nu-art/ts-common 0.204.84 → 0.204.86

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.
@@ -125,9 +125,18 @@ export declare class DontCallThisException extends CustomException {
125
125
  export declare class WhoCallThisException extends CustomException {
126
126
  constructor(message: string, cause?: Error);
127
127
  }
128
+ /**
129
+ * When config for components or modules is missing
130
+ */
128
131
  export declare class ConfigMissingException extends CustomException {
129
132
  constructor(message: string, cause?: Error);
130
133
  }
134
+ /**
135
+ * When a mandatory field is missing in an object when the object is fetched
136
+ */
137
+ export declare class MissingDataException extends CustomException {
138
+ constructor(message: string, cause?: Error);
139
+ }
131
140
  /**
132
141
  * # <ins>AssertionException</ins>
133
142
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "AssertionException",
@@ -20,7 +20,7 @@
20
20
  * Created by TacB0sS on 3/16/17.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.ApiException = exports.AssertionException = exports.ConfigMissingException = exports.WhoCallThisException = exports.DontCallThisException = exports.HasDependenciesException = exports.ThisShouldNotHappenException = exports.NotImplementedYetException = exports.MUSTNeverHappenException = exports.ImplementationMissingException = exports.BadImplementationException = exports.Exception = exports.CustomException = exports.isErrorOfType = void 0;
23
+ exports.ApiException = exports.AssertionException = exports.MissingDataException = exports.ConfigMissingException = exports.WhoCallThisException = exports.DontCallThisException = exports.HasDependenciesException = exports.ThisShouldNotHappenException = exports.NotImplementedYetException = exports.MUSTNeverHappenException = exports.ImplementationMissingException = exports.BadImplementationException = exports.Exception = exports.CustomException = exports.isErrorOfType = void 0;
24
24
  const utils_1 = require("../logger/utils");
25
25
  /**
26
26
  * # <ins>isErrorOfType</ins>
@@ -182,12 +182,24 @@ class WhoCallThisException extends CustomException {
182
182
  }
183
183
  }
184
184
  exports.WhoCallThisException = WhoCallThisException;
185
+ /**
186
+ * When config for components or modules is missing
187
+ */
185
188
  class ConfigMissingException extends CustomException {
186
189
  constructor(message, cause) {
187
190
  super(ConfigMissingException, message, cause);
188
191
  }
189
192
  }
190
193
  exports.ConfigMissingException = ConfigMissingException;
194
+ /**
195
+ * When a mandatory field is missing in an object when the object is fetched
196
+ */
197
+ class MissingDataException extends CustomException {
198
+ constructor(message, cause) {
199
+ super(ConfigMissingException, message, cause);
200
+ }
201
+ }
202
+ exports.MissingDataException = MissingDataException;
191
203
  /**
192
204
  * # <ins>AssertionException</ins>
193
205
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "AssertionException",
package/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export * from './utils/hash-tools';
40
40
  export * from './utils/filter-tools';
41
41
  export * from './utils/ui-tools';
42
42
  export * from './utils/json-tools';
43
+ export * from './utils/promise-tools';
43
44
  export * from './validator/validator-core';
44
45
  export * from './validator/validators';
45
46
  export * from './validator/type-validators';
package/index.js CHANGED
@@ -73,6 +73,7 @@ __exportStar(require("./utils/hash-tools"), exports);
73
73
  __exportStar(require("./utils/filter-tools"), exports);
74
74
  __exportStar(require("./utils/ui-tools"), exports);
75
75
  __exportStar(require("./utils/json-tools"), exports);
76
+ __exportStar(require("./utils/promise-tools"), exports);
76
77
  __exportStar(require("./validator/validator-core"), exports);
77
78
  __exportStar(require("./validator/validators"), exports);
78
79
  __exportStar(require("./validator/type-validators"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/ts-common",
3
- "version": "0.204.84",
3
+ "version": "0.204.86",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -0,0 +1,9 @@
1
+ export type ResolvePromiseFunction<T> = (value: T | PromiseLike<T>) => void;
2
+ export type RejectPromiseFunction = (reason?: any) => void;
3
+ export type PromiseCallbackFunction<T> = (resolve: ResolvePromiseFunction<T>, reject: RejectPromiseFunction) => T;
4
+ /**
5
+ * Promise wrapper for actions
6
+ * use to wrap a action with a promise
7
+ * @param callback The action to run
8
+ */
9
+ export declare const promiseWrapper: <T>(callback: PromiseCallbackFunction<T>) => Promise<T>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promiseWrapper = void 0;
4
+ /**
5
+ * Promise wrapper for actions
6
+ * use to wrap a action with a promise
7
+ * @param callback The action to run
8
+ */
9
+ const promiseWrapper = (callback) => {
10
+ return new Promise((resolve, reject) => callback(resolve, reject));
11
+ };
12
+ exports.promiseWrapper = promiseWrapper;