@nu-art/ts-common 0.104.4 → 0.105.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.
Files changed (148) hide show
  1. package/package.json +8 -4
  2. package/consts/consts.d.ts +0 -1
  3. package/consts/consts.js +0 -22
  4. package/consts/consts.js.map +0 -1
  5. package/core/application.d.ts +0 -5
  6. package/core/application.js +0 -55
  7. package/core/application.js.map +0 -1
  8. package/core/debug-flags.d.ts +0 -25
  9. package/core/debug-flags.js +0 -87
  10. package/core/debug-flags.js.map +0 -1
  11. package/core/dispatcher.d.ts +0 -18
  12. package/core/dispatcher.js +0 -132
  13. package/core/dispatcher.js.map +0 -1
  14. package/core/error-handling.d.ts +0 -14
  15. package/core/error-handling.js +0 -38
  16. package/core/error-handling.js.map +0 -1
  17. package/core/exceptions.d.ts +0 -118
  18. package/core/exceptions.js +0 -214
  19. package/core/exceptions.js.map +0 -1
  20. package/core/logger/BeLogged.d.ts +0 -14
  21. package/core/logger/BeLogged.js +0 -61
  22. package/core/logger/BeLogged.js.map +0 -1
  23. package/core/logger/LogClient.d.ts +0 -14
  24. package/core/logger/LogClient.js +0 -67
  25. package/core/logger/LogClient.js.map +0 -1
  26. package/core/logger/LogClient_BaseRotate.d.ts +0 -19
  27. package/core/logger/LogClient_BaseRotate.js +0 -80
  28. package/core/logger/LogClient_BaseRotate.js.map +0 -1
  29. package/core/logger/LogClient_Browser.d.ts +0 -9
  30. package/core/logger/LogClient_Browser.js +0 -101
  31. package/core/logger/LogClient_Browser.js.map +0 -1
  32. package/core/logger/LogClient_Function.d.ts +0 -8
  33. package/core/logger/LogClient_Function.js +0 -75
  34. package/core/logger/LogClient_Function.js.map +0 -1
  35. package/core/logger/LogClient_MemBuffer.d.ts +0 -9
  36. package/core/logger/LogClient_MemBuffer.js +0 -61
  37. package/core/logger/LogClient_MemBuffer.js.map +0 -1
  38. package/core/logger/LogClient_Terminal.d.ts +0 -9
  39. package/core/logger/LogClient_Terminal.js +0 -75
  40. package/core/logger/LogClient_Terminal.js.map +0 -1
  41. package/core/logger/Logger.d.ts +0 -38
  42. package/core/logger/Logger.js +0 -216
  43. package/core/logger/Logger.js.map +0 -1
  44. package/core/logger/types.d.ts +0 -10
  45. package/core/logger/types.js +0 -36
  46. package/core/logger/types.js.map +0 -1
  47. package/core/logger/utils.d.ts +0 -5
  48. package/core/logger/utils.js +0 -80
  49. package/core/logger/utils.js.map +0 -1
  50. package/core/module-manager.d.ts +0 -18
  51. package/core/module-manager.js +0 -112
  52. package/core/module-manager.js.map +0 -1
  53. package/core/module.d.ts +0 -32
  54. package/core/module.js +0 -126
  55. package/core/module.js.map +0 -1
  56. package/csv.d.ts +0 -1
  57. package/csv.js +0 -35
  58. package/csv.js.map +0 -1
  59. package/index.d.ts +0 -43
  60. package/index.js +0 -77
  61. package/index.js.map +0 -1
  62. package/modules/CSVModule.d.ts +0 -32
  63. package/modules/CSVModule.js +0 -165
  64. package/modules/CSVModule.js.map +0 -1
  65. package/modules/CliParamsModule.d.ts +0 -27
  66. package/modules/CliParamsModule.js +0 -94
  67. package/modules/CliParamsModule.js.map +0 -1
  68. package/modules/csv-serializer.d.ts +0 -11
  69. package/modules/csv-serializer.js +0 -50
  70. package/modules/csv-serializer.js.map +0 -1
  71. package/permissions/permission-group.d.ts +0 -8
  72. package/permissions/permission-group.js +0 -37
  73. package/permissions/permission-group.js.map +0 -1
  74. package/test-index.d.ts +0 -2
  75. package/test-index.js +0 -19
  76. package/test-index.js.map +0 -1
  77. package/testing/consts.d.ts +0 -5
  78. package/testing/consts.js +0 -74
  79. package/testing/consts.js.map +0 -1
  80. package/testing/types.d.ts +0 -16
  81. package/testing/types.js +0 -20
  82. package/testing/types.js.map +0 -1
  83. package/tools/Replacer.d.ts +0 -24
  84. package/tools/Replacer.js +0 -172
  85. package/tools/Replacer.js.map +0 -1
  86. package/tools/get-log-style.d.ts +0 -14
  87. package/tools/get-log-style.js +0 -43
  88. package/tools/get-log-style.js.map +0 -1
  89. package/utils/array-tools.d.ts +0 -85
  90. package/utils/array-tools.js +0 -302
  91. package/utils/array-tools.js.map +0 -1
  92. package/utils/crypto-tools.d.ts +0 -4
  93. package/utils/crypto-tools.js +0 -36
  94. package/utils/crypto-tools.js.map +0 -1
  95. package/utils/date-time-tools.d.ts +0 -28
  96. package/utils/date-time-tools.js +0 -180
  97. package/utils/date-time-tools.js.map +0 -1
  98. package/utils/db-object-tools.d.ts +0 -3
  99. package/utils/db-object-tools.js +0 -9
  100. package/utils/db-object-tools.js.map +0 -1
  101. package/utils/filter-tools.d.ts +0 -137
  102. package/utils/filter-tools.js +0 -217
  103. package/utils/filter-tools.js.map +0 -1
  104. package/utils/hash-tools.d.ts +0 -8
  105. package/utils/hash-tools.js +0 -60
  106. package/utils/hash-tools.js.map +0 -1
  107. package/utils/merge-tools.d.ts +0 -3
  108. package/utils/merge-tools.js +0 -71
  109. package/utils/merge-tools.js.map +0 -1
  110. package/utils/mimetype-tools.d.ts +0 -8
  111. package/utils/mimetype-tools.js +0 -29
  112. package/utils/mimetype-tools.js.map +0 -1
  113. package/utils/number-tools.d.ts +0 -1
  114. package/utils/number-tools.js +0 -26
  115. package/utils/number-tools.js.map +0 -1
  116. package/utils/object-tools.d.ts +0 -13
  117. package/utils/object-tools.js +0 -129
  118. package/utils/object-tools.js.map +0 -1
  119. package/utils/query-params.d.ts +0 -5
  120. package/utils/query-params.js +0 -24
  121. package/utils/query-params.js.map +0 -1
  122. package/utils/queue.d.ts +0 -16
  123. package/utils/queue.js +0 -166
  124. package/utils/queue.js.map +0 -1
  125. package/utils/random-tools.d.ts +0 -2
  126. package/utils/random-tools.js +0 -35
  127. package/utils/random-tools.js.map +0 -1
  128. package/utils/storage-capacity-tools.d.ts +0 -6
  129. package/utils/storage-capacity-tools.js +0 -27
  130. package/utils/storage-capacity-tools.js.map +0 -1
  131. package/utils/string-tools.d.ts +0 -10
  132. package/utils/string-tools.js +0 -100
  133. package/utils/string-tools.js.map +0 -1
  134. package/utils/tools.d.ts +0 -13
  135. package/utils/tools.js +0 -103
  136. package/utils/tools.js.map +0 -1
  137. package/utils/types.d.ts +0 -92
  138. package/utils/types.js +0 -23
  139. package/utils/types.js.map +0 -1
  140. package/utils/version-tools.d.ts +0 -10
  141. package/utils/version-tools.js +0 -51
  142. package/utils/version-tools.js.map +0 -1
  143. package/validator/type-validators.d.ts +0 -29
  144. package/validator/type-validators.js +0 -211
  145. package/validator/type-validators.js.map +0 -1
  146. package/validator/validator-core.d.ts +0 -36
  147. package/validator/validator-core.js +0 -144
  148. package/validator/validator-core.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/ts-common",
3
- "version": "0.104.4",
3
+ "version": "0.105.0",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -18,10 +18,13 @@
18
18
  "type": "git",
19
19
  "url": "git+ssh://git@github.com:nu-art-js/ts-common.git"
20
20
  },
21
+ "files": [
22
+ "dist"
23
+ ],
21
24
  "license": "Apache-2.0",
22
25
  "author": "TacB0sS",
23
- "main": "index.js",
24
- "types": "index.d.ts",
26
+ "main": "dist/index.js",
27
+ "types": "dist/index.d.ts",
25
28
  "scripts": {
26
29
  "build": "tsc",
27
30
  "typedocs": "typedoc --options typedoc.json",
@@ -30,7 +33,8 @@
30
33
  "dependencies": {
31
34
  "export-to-csv": "^0.2.1",
32
35
  "moment": "^2.24.0",
33
- "node-forge": "^1.2.1"
36
+ "node-forge": "^1.2.1",
37
+ "uuid": "^9.0.0"
34
38
  },
35
39
  "devDependencies": {
36
40
  "@types/chai": "^4.3.4",
@@ -1 +0,0 @@
1
- export declare const _U: undefined;
package/consts/consts.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /*
3
- * ts-common is the basic building blocks of our typescript projects
4
- *
5
- * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports._U = void 0;
21
- exports._U = undefined;
22
- //# sourceMappingURL=consts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/main/consts/consts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEU,QAAA,EAAE,GAAG,SAAS,CAAC"}
@@ -1,5 +0,0 @@
1
- import { ModuleManager } from "./module-manager";
2
- export declare class Application extends ModuleManager {
3
- constructor();
4
- build(onStarted?: () => Promise<any>): void;
5
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- /*
3
- * ts-common is the basic building blocks of our typescript projects
4
- *
5
- * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- var __extends = (this && this.__extends) || (function () {
20
- var extendStatics = function (d, b) {
21
- extendStatics = Object.setPrototypeOf ||
22
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24
- return extendStatics(d, b);
25
- };
26
- return function (d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- };
33
- })();
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.Application = void 0;
36
- var module_manager_1 = require("./module-manager");
37
- var Application = /** @class */ (function (_super) {
38
- __extends(Application, _super);
39
- function Application() {
40
- return _super.call(this) || this;
41
- }
42
- Application.prototype.build = function (onStarted) {
43
- var _this = this;
44
- _super.prototype.build.call(this);
45
- onStarted && onStarted()
46
- .then(function (data) {
47
- data && _this.logInfo("data: ", data);
48
- _this.logInfo("Completed");
49
- })
50
- .catch(function (err) { return _this.logError("Error", err); });
51
- };
52
- return Application;
53
- }(module_manager_1.ModuleManager));
54
- exports.Application = Application;
55
- //# sourceMappingURL=application.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/main/core/application.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;AAEH,mDAA+C;AAE/C;IACS,+BAAa;IAErB;eACC,iBAAO;IACR,CAAC;IAED,2BAAK,GAAL,UAAM,SAA8B;QAApC,iBAQC;QAPA,iBAAM,KAAK,WAAE,CAAC;QACd,SAAS,IAAI,SAAS,EAAE;aACtB,IAAI,CAAC,UAAC,IAAI;YACV,IAAI,IAAI,KAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACrC,KAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,GAAG,IAAK,OAAA,KAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,EAA3B,CAA2B,CAAC,CAAC;IAC/C,CAAC;IACF,kBAAC;AAAD,CAAC,AAhBD,CACS,8BAAa,GAerB;AAhBY,kCAAW"}
@@ -1,25 +0,0 @@
1
- import { LogLevel } from './logger/types';
2
- export declare class DebugFlag {
3
- private readonly key;
4
- private minLogLevel;
5
- private constructor();
6
- setMinLevel(minLogLevel: LogLevel): void;
7
- rename(newKey: string): void;
8
- getKey(): string;
9
- enable(enable?: boolean): void;
10
- isEnabled(): boolean;
11
- canLog(level: LogLevel): boolean;
12
- private _enable;
13
- private _disable;
14
- }
15
- export declare class DebugFlags {
16
- static readonly instance: DebugFlags;
17
- readonly AllDebugFlags: {
18
- [k: string]: DebugFlag;
19
- };
20
- readonly ActiveDebugFlags: string[];
21
- private constructor();
22
- static createFlag(key: string, minLogLevel?: LogLevel): any;
23
- static add(flag: DebugFlag): void;
24
- static rename(previousKey: string, newKey: string): void;
25
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /*
3
- * ts-common is the basic building blocks of our typescript projects
4
- *
5
- * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.DebugFlags = exports.DebugFlag = void 0;
21
- var array_tools_1 = require("../utils/array-tools");
22
- var types_1 = require("./logger/types");
23
- var DebugFlag = /** @class */ (function () {
24
- function DebugFlag(key, minLogLevel) {
25
- if (minLogLevel === void 0) { minLogLevel = types_1.LogLevel.Info; }
26
- this.key = key;
27
- this.minLogLevel = minLogLevel;
28
- DebugFlags.add(this);
29
- }
30
- DebugFlag.prototype.setMinLevel = function (minLogLevel) {
31
- this.minLogLevel = minLogLevel;
32
- };
33
- DebugFlag.prototype.rename = function (newKey) {
34
- DebugFlags.rename(this.key, newKey);
35
- };
36
- DebugFlag.prototype.getKey = function () {
37
- return this.key;
38
- };
39
- DebugFlag.prototype.enable = function (enable) {
40
- if (enable === void 0) { enable = true; }
41
- if (this.isEnabled() === enable)
42
- return;
43
- if (enable)
44
- this._enable();
45
- else
46
- this._disable();
47
- };
48
- DebugFlag.prototype.isEnabled = function () {
49
- return DebugFlags.instance.ActiveDebugFlags.includes(this.key);
50
- };
51
- DebugFlag.prototype.canLog = function (level) {
52
- return types_1.LogLevelOrdinal.indexOf(level) >= types_1.LogLevelOrdinal.indexOf(this.minLogLevel);
53
- };
54
- DebugFlag.prototype._enable = function () {
55
- (0, array_tools_1.addItemToArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
56
- };
57
- DebugFlag.prototype._disable = function () {
58
- (0, array_tools_1.removeItemFromArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
59
- };
60
- return DebugFlag;
61
- }());
62
- exports.DebugFlag = DebugFlag;
63
- var DebugFlags = /** @class */ (function () {
64
- function DebugFlags() {
65
- this.AllDebugFlags = {};
66
- this.ActiveDebugFlags = [];
67
- }
68
- DebugFlags.createFlag = function (key, minLogLevel) {
69
- if (minLogLevel === void 0) { minLogLevel = types_1.LogLevel.Info; }
70
- // @ts-ignore
71
- return new DebugFlag(key, minLogLevel);
72
- };
73
- DebugFlags.add = function (flag) {
74
- this.instance.AllDebugFlags[flag.getKey()] = flag;
75
- };
76
- DebugFlags.rename = function (previousKey, newKey) {
77
- var flag = this.instance.AllDebugFlags[previousKey];
78
- if (!flag)
79
- return;
80
- delete this.instance.AllDebugFlags[previousKey];
81
- this.instance.AllDebugFlags[newKey] = flag;
82
- };
83
- DebugFlags.instance = new DebugFlags();
84
- return DebugFlags;
85
- }());
86
- exports.DebugFlags = DebugFlags;
87
- //# sourceMappingURL=debug-flags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-flags.js","sourceRoot":"","sources":["../../src/main/core/debug-flags.ts"],"names":[],"mappings":";A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CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAEF,gBAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,8BAAS;AAoDtB;IAOC;QAHS,kBAAa,GAA+B,EAAE,CAAC;QAC/C,qBAAgB,GAAa,EAAE,CAAC;IAGzC,CAAC;IAEa,qBAAU,GAAxB,UAAyB,GAAW,EAAE,WAA2B;QAA3B,4BAAA,EAAA,cAAc,gBAAQ,CAAC,IAAI;QAChE,aAAa;QACb,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IACxC,CAAC;IAEM,cAAG,GAAV,UAAW,IAAe;QACzB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACnD,CAAC;IAEM,iBAAM,GAAb,UAAc,WAAmB,EAAE,MAAc;QAChD,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI;YACR,OAAO;QAER,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC5C,CAAC;IAxBe,mBAAQ,GAAe,IAAI,UAAU,EAAE,CAAC;IAyBzD,iBAAC;CAAA,AA3BD,IA2BC;AA3BY,gCAAU"}
@@ -1,18 +0,0 @@
1
- import { FunctionKeys, ReturnPromiseType } from '../utils/types';
2
- import { Logger } from './logger/Logger';
3
- export type ParamResolver<T, K extends keyof T> = T[K] extends (...args: any) => any ? Parameters<T[K]> : never;
4
- export type ReturnTypeResolver<T, K extends keyof T> = T[K] extends (...args: any) => any ? ReturnPromiseType<T[K]> : never;
5
- export declare class Processor<T, K extends FunctionKeys<T>> extends Logger {
6
- static modulesResolver: () => any[];
7
- readonly method: K;
8
- protected readonly filter: (listener: any) => boolean;
9
- constructor(method: K);
10
- processModules<R>(processor: (item: T) => R): R[];
11
- processModulesAsync<R>(processor: (item: T) => Promise<R>): Promise<R[]>;
12
- filterModules(): any[];
13
- }
14
- export declare class Dispatcher<T, K extends FunctionKeys<T>, P extends ParamResolver<T, K> = ParamResolver<T, K>, R extends ReturnTypeResolver<T, K> = ReturnTypeResolver<T, K>> extends Processor<T, K> {
15
- constructor(method: K);
16
- dispatchModule(...p: P): R[];
17
- dispatchModuleAsync(...p: P): Promise<R[]>;
18
- }
@@ -1,132 +0,0 @@
1
- "use strict";
2
- /*
3
- * ts-common is the basic building blocks of our typescript projects
4
- *
5
- * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- var __extends = (this && this.__extends) || (function () {
20
- var extendStatics = function (d, b) {
21
- extendStatics = Object.setPrototypeOf ||
22
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24
- return extendStatics(d, b);
25
- };
26
- return function (d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- };
33
- })();
34
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
35
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
36
- return new (P || (P = Promise))(function (resolve, reject) {
37
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
38
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
39
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
40
- step((generator = generator.apply(thisArg, _arguments || [])).next());
41
- });
42
- };
43
- var __generator = (this && this.__generator) || function (thisArg, body) {
44
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
45
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
46
- function verb(n) { return function (v) { return step([n, v]); }; }
47
- function step(op) {
48
- if (f) throw new TypeError("Generator is already executing.");
49
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
50
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
51
- if (y = 0, t) op = [op[0] & 2, t.value];
52
- switch (op[0]) {
53
- case 0: case 1: t = op; break;
54
- case 4: _.label++; return { value: op[1], done: false };
55
- case 5: _.label++; y = op[1]; op = [0]; continue;
56
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
57
- default:
58
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
59
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
60
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
61
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
62
- if (t[2]) _.ops.pop();
63
- _.trys.pop(); continue;
64
- }
65
- op = body.call(thisArg, _);
66
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
67
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
68
- }
69
- };
70
- Object.defineProperty(exports, "__esModule", { value: true });
71
- exports.Dispatcher = exports.Processor = void 0;
72
- var Logger_1 = require("./logger/Logger");
73
- var Processor = /** @class */ (function (_super) {
74
- __extends(Processor, _super);
75
- function Processor(method) {
76
- var _this = _super.call(this, method) || this;
77
- _this.method = method;
78
- _this.filter = function (listener) { return !!listener[_this.method]; };
79
- return _this;
80
- }
81
- Processor.prototype.processModules = function (processor) {
82
- return this.filterModules().filter(this.filter).map(processor);
83
- };
84
- Processor.prototype.processModulesAsync = function (processor) {
85
- return __awaiter(this, void 0, void 0, function () {
86
- return __generator(this, function (_a) {
87
- return [2 /*return*/, Promise.all(this.filterModules().map(processor))];
88
- });
89
- });
90
- };
91
- Processor.prototype.filterModules = function () {
92
- var listeners = Dispatcher.modulesResolver();
93
- return listeners.filter(this.filter);
94
- };
95
- return Processor;
96
- }(Logger_1.Logger));
97
- exports.Processor = Processor;
98
- var Dispatcher = /** @class */ (function (_super) {
99
- __extends(Dispatcher, _super);
100
- function Dispatcher(method) {
101
- return _super.call(this, method) || this;
102
- }
103
- Dispatcher.prototype.dispatchModule = function () {
104
- var _this = this;
105
- var p = [];
106
- for (var _i = 0; _i < arguments.length; _i++) {
107
- p[_i] = arguments[_i];
108
- }
109
- return this.processModules(function (listener) {
110
- // @ts-ignore
111
- return listener[_this.method].apply(listener, p);
112
- });
113
- };
114
- Dispatcher.prototype.dispatchModuleAsync = function () {
115
- var p = [];
116
- for (var _i = 0; _i < arguments.length; _i++) {
117
- p[_i] = arguments[_i];
118
- }
119
- return __awaiter(this, void 0, void 0, function () {
120
- var _this = this;
121
- return __generator(this, function (_a) {
122
- return [2 /*return*/, this.processModulesAsync(function (listener) {
123
- // @ts-ignore
124
- return listener[_this.method].apply(listener, p);
125
- })];
126
- });
127
- });
128
- };
129
- return Dispatcher;
130
- }(Processor));
131
- exports.Dispatcher = Dispatcher;
132
- //# sourceMappingURL=dispatcher.js.map
@@ -1 +0,0 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,KAAI,CAAC,MAAM,CAAC,OAArB,QAAQ,EAAkB,CAAC,EAAE;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;IAEY,wCAAmB,GAAhC;QAAiC,WAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,sBAAO;;;;;gBACvC,sBAAO,IAAI,CAAC,mBAAmB,CAAI,UAAC,QAAW;wBAC9C,aAAa;wBACb,OAAO,QAAQ,CAAC,KAAI,CAAC,MAAM,CAAC,OAArB,QAAQ,EAAiB,CAAC,EAAE;oBACpC,CAAC,CAAC,EAAC;;;KACH;IACF,iBAAC;AAAD,CAAC,AAvBD,CAIS,SAAS,GAmBjB;AAvBY,gCAAU"}
@@ -1,14 +0,0 @@
1
- import { Module } from "./module";
2
- import { Dispatcher } from "./dispatcher";
3
- export declare enum ServerErrorSeverity {
4
- Debug = "Debug",
5
- Info = "Info",
6
- Warning = "Warning",
7
- Error = "Error",
8
- Critical = "Critical"
9
- }
10
- export declare const ServerErrorSeverity_Ordinal: ServerErrorSeverity[];
11
- export interface OnApplicationError {
12
- __processApplicationError(errorLevel: ServerErrorSeverity, module: Module, message: string): Promise<void>;
13
- }
14
- export declare const dispatch_onServerError: Dispatcher<OnApplicationError, "__processApplicationError", [errorLevel: ServerErrorSeverity, module: Module<any, any>, message: string], void>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- /*
3
- * ts-common is the basic building blocks of our typescript projects
4
- *
5
- * Copyright (C) 2020 Adam van der Kruk aka TacB0sS
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.dispatch_onServerError = exports.ServerErrorSeverity_Ordinal = exports.ServerErrorSeverity = void 0;
21
- var dispatcher_1 = require("./dispatcher");
22
- var ServerErrorSeverity;
23
- (function (ServerErrorSeverity) {
24
- ServerErrorSeverity["Debug"] = "Debug";
25
- ServerErrorSeverity["Info"] = "Info";
26
- ServerErrorSeverity["Warning"] = "Warning";
27
- ServerErrorSeverity["Error"] = "Error";
28
- ServerErrorSeverity["Critical"] = "Critical";
29
- })(ServerErrorSeverity = exports.ServerErrorSeverity || (exports.ServerErrorSeverity = {}));
30
- exports.ServerErrorSeverity_Ordinal = [
31
- ServerErrorSeverity.Debug,
32
- ServerErrorSeverity.Info,
33
- ServerErrorSeverity.Warning,
34
- ServerErrorSeverity.Error,
35
- ServerErrorSeverity.Critical
36
- ];
37
- exports.dispatch_onServerError = new dispatcher_1.Dispatcher("__processApplicationError");
38
- //# sourceMappingURL=error-handling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handling.js","sourceRoot":"","sources":["../../src/main/core/error-handling.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAGH,2CAAwC;AAExC,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC9B,sCAAkB,CAAA;IAClB,oCAAiB,CAAA;IACjB,0CAAoB,CAAA;IACpB,sCAAkB,CAAA;IAClB,4CAAqB,CAAA;AACtB,CAAC,EANW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAM9B;AAEY,QAAA,2BAA2B,GAAG;IAC1C,mBAAmB,CAAC,KAAK;IACzB,mBAAmB,CAAC,IAAI;IACxB,mBAAmB,CAAC,OAAO;IAC3B,mBAAmB,CAAC,KAAK;IACzB,mBAAmB,CAAC,QAAQ;CAC5B,CAAC;AAMW,QAAA,sBAAsB,GAAG,IAAI,uBAAU,CAAkD,2BAA2B,CAAC,CAAC"}
@@ -1,118 +0,0 @@
1
- /**
2
- * Created by TacB0sS on 3/16/17.
3
- */
4
- import { Constructor } from '../utils/types';
5
- /**
6
- * # <ins>isErrorOfType</ins>
7
- *
8
- * A function that checks if an error is of a certain type.
9
- *
10
- * @param e The error
11
- * @param _exceptionType The exception class to compare to
12
- *
13
- * @returns
14
- * - T - The error as the type checked if the error was of that type.
15
- * - undefined - otherwise.
16
- *
17
- * #### <ins>Usage:</ins>
18
- * ```js
19
- * try {
20
- * ...
21
- * } catch(e: Error) {
22
- * if(isErrorOfType(e,ThisShouldNotHappenException)) {
23
- * e = new ThisShouldNotHappenException("this should not have happened",e);
24
- * ...
25
- * }
26
- * }
27
- * ```
28
- */
29
- export declare function isErrorOfType<T extends Error>(e: Error, _exceptionType: Constructor<T>): T | undefined;
30
- /**
31
- * # CustomException
32
- *
33
- * ### <ins>Intro</ins>
34
- * An abstract class defining the structure of custom exceptions.<br>
35
- * This class extends the java-script native Error object.<br>
36
- * In addition to collecting the error, this class also collects a message and the exception type, for better
37
- * error handling.<br>
38
- *
39
- * @category Exceptions
40
- */
41
- export declare abstract class CustomException extends Error {
42
- exceptionType: string;
43
- isInstanceOf: (_exceptionType: Function) => boolean;
44
- cause?: Error;
45
- protected constructor(exceptionType: Function, message: string, cause?: Error);
46
- }
47
- /**
48
- * # <ins>Exception</ins>
49
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "Exception",
50
- * @category Exceptions
51
- */
52
- export declare class Exception extends CustomException {
53
- constructor(message: string, cause?: Error);
54
- }
55
- /**
56
- * # <ins>BadImplementationException</ins>
57
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "BadImplementationException",
58
- * @category Exceptions
59
- */
60
- export declare class BadImplementationException extends CustomException {
61
- constructor(message: string, cause?: Error);
62
- }
63
- /**
64
- * # <ins>ImplementationMissingException</ins>
65
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ImplementationMissingException",
66
- * @category Exceptions
67
- */
68
- export declare class ImplementationMissingException extends CustomException {
69
- constructor(message: string, cause?: Error);
70
- }
71
- /**
72
- * # <ins>MUSTNeverHappenException</ins>
73
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "MUSTNeverHappenException",
74
- * @category Exceptions
75
- */
76
- export declare class MUSTNeverHappenException extends CustomException {
77
- constructor(message: string, cause?: Error);
78
- }
79
- /**
80
- * # <ins>NotImplementedYetException</ins>
81
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "NotImplementedYetException",
82
- * @category Exceptions
83
- */
84
- export declare class NotImplementedYetException extends CustomException {
85
- constructor(message: string, cause?: Error);
86
- }
87
- /**
88
- * # <ins>ThisShouldNotHappenException</ins>
89
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ThisShouldNotHappenException",
90
- * @category Exceptions
91
- */
92
- export declare class ThisShouldNotHappenException extends CustomException {
93
- constructor(message: string, cause?: Error);
94
- }
95
- /**
96
- * # <ins>DontCallthisException</ins>
97
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "DontCallthisException",
98
- * @category Exceptions
99
- */
100
- export declare class DontCallthisException extends CustomException {
101
- constructor(message: string, cause?: Error);
102
- }
103
- /**
104
- * # <ins>WhoCallthisException</ins>
105
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "WhoCallthisException",
106
- * @category Exceptions
107
- */
108
- export declare class WhoCallthisException extends CustomException {
109
- constructor(message: string, cause?: Error);
110
- }
111
- /**
112
- * # <ins>AssertionException</ins>
113
- * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "AssertionException",
114
- * @category Exceptions
115
- */
116
- export declare class AssertionException extends CustomException {
117
- constructor(message: string, cause?: Error);
118
- }