@nu-art/ts-common 0.200.22 → 0.200.24

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 (101) hide show
  1. package/consts/consts.js +0 -1
  2. package/core/application.js +12 -31
  3. package/core/debug-flags.js +32 -38
  4. package/core/dispatcher.js +30 -92
  5. package/core/error-handling.js +1 -2
  6. package/core/exceptions.js +47 -84
  7. package/core/logger/BeLogged.js +19 -26
  8. package/core/logger/LogClient.js +14 -16
  9. package/core/logger/LogClient_BaseRotate.js +20 -42
  10. package/core/logger/LogClient_Browser.js +16 -36
  11. package/core/logger/LogClient_Function.js +14 -34
  12. package/core/logger/LogClient_MemBuffer.js +14 -35
  13. package/core/logger/LogClient_Terminal.js +12 -34
  14. package/core/logger/Logger.js +67 -152
  15. package/core/logger/types.js +0 -1
  16. package/core/logger/utils.js +16 -18
  17. package/core/module-manager.js +33 -61
  18. package/core/module.js +43 -65
  19. package/csv.js +0 -1
  20. package/index.js +0 -1
  21. package/modules/CSVModule.js +50 -110
  22. package/modules/CliParamsModule.js +32 -54
  23. package/modules/csv-serializer.js +10 -22
  24. package/package.json +8 -18
  25. package/permissions/permission-group.js +9 -12
  26. package/test-index.js +0 -1
  27. package/testing/consts.js +18 -54
  28. package/testing/types.js +0 -1
  29. package/tools/Replacer.js +71 -96
  30. package/tools/get-log-style.js +5 -10
  31. package/utils/array-tools.js +63 -127
  32. package/utils/crypto-tools.js +1 -2
  33. package/utils/date-time-tools.js +19 -75
  34. package/utils/db-object-tools.js +0 -1
  35. package/utils/filter-tools.js +37 -43
  36. package/utils/hash-tools.js +4 -8
  37. package/utils/merge-tools.js +4 -5
  38. package/utils/mimetype-tools.js +0 -1
  39. package/utils/number-tools.js +3 -4
  40. package/utils/object-tools.js +16 -20
  41. package/utils/query-params.js +8 -11
  42. package/utils/queue.js +47 -115
  43. package/utils/random-tools.js +2 -3
  44. package/utils/storage-capacity-tools.js +0 -1
  45. package/utils/string-tools.js +16 -18
  46. package/utils/tools.js +11 -42
  47. package/utils/types.js +1 -2
  48. package/utils/ui-tools.js +8 -15
  49. package/utils/version-tools.js +6 -7
  50. package/validator/type-validators.js +65 -84
  51. package/validator/validator-core.js +34 -58
  52. package/consts/consts.js.map +0 -1
  53. package/core/application.js.map +0 -1
  54. package/core/debug-flags.js.map +0 -1
  55. package/core/dispatcher.js.map +0 -1
  56. package/core/error-handling.js.map +0 -1
  57. package/core/exceptions.js.map +0 -1
  58. package/core/logger/BeLogged.js.map +0 -1
  59. package/core/logger/LogClient.js.map +0 -1
  60. package/core/logger/LogClient_BaseRotate.js.map +0 -1
  61. package/core/logger/LogClient_Browser.js.map +0 -1
  62. package/core/logger/LogClient_Function.js.map +0 -1
  63. package/core/logger/LogClient_MemBuffer.js.map +0 -1
  64. package/core/logger/LogClient_Terminal.js.map +0 -1
  65. package/core/logger/Logger.js.map +0 -1
  66. package/core/logger/types.js.map +0 -1
  67. package/core/logger/utils.js.map +0 -1
  68. package/core/module-manager.js.map +0 -1
  69. package/core/module.js.map +0 -1
  70. package/csv.js.map +0 -1
  71. package/index.js.map +0 -1
  72. package/modules/CSVModule.js.map +0 -1
  73. package/modules/CliParamsModule.js.map +0 -1
  74. package/modules/csv-serializer.js.map +0 -1
  75. package/permissions/permission-group.js.map +0 -1
  76. package/test-index.js.map +0 -1
  77. package/testing/consts.js.map +0 -1
  78. package/testing/types.js.map +0 -1
  79. package/tools/Replacer.js.map +0 -1
  80. package/tools/get-log-style.js.map +0 -1
  81. package/utils/array-tools.js.map +0 -1
  82. package/utils/crypto-tools.js.map +0 -1
  83. package/utils/date-time-tools.js.map +0 -1
  84. package/utils/db-object-tools.js.map +0 -1
  85. package/utils/filter-tools.js.map +0 -1
  86. package/utils/hash-tools.js.map +0 -1
  87. package/utils/merge-tools.js.map +0 -1
  88. package/utils/mimetype-tools.js.map +0 -1
  89. package/utils/number-tools.js.map +0 -1
  90. package/utils/object-tools.js.map +0 -1
  91. package/utils/query-params.js.map +0 -1
  92. package/utils/queue.js.map +0 -1
  93. package/utils/random-tools.js.map +0 -1
  94. package/utils/storage-capacity-tools.js.map +0 -1
  95. package/utils/string-tools.js.map +0 -1
  96. package/utils/tools.js.map +0 -1
  97. package/utils/types.js.map +0 -1
  98. package/utils/ui-tools.js.map +0 -1
  99. package/utils/version-tools.js.map +0 -1
  100. package/validator/type-validators.js.map +0 -1
  101. package/validator/validator-core.js.map +0 -1
package/consts/consts.js CHANGED
@@ -19,4 +19,3 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports._U = void 0;
21
21
  exports._U = undefined;
22
- //# sourceMappingURL=consts.js.map
@@ -16,40 +16,21 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
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
19
  Object.defineProperty(exports, "__esModule", { value: true });
35
20
  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;
21
+ const module_manager_1 = require("./module-manager");
22
+ class Application extends module_manager_1.ModuleManager {
23
+ constructor() {
24
+ super();
41
25
  }
42
- Application.prototype.build = function (onStarted) {
43
- var _this = this;
44
- _super.prototype.build.call(this);
26
+ build(onStarted) {
27
+ super.build();
45
28
  onStarted && onStarted()
46
- .then(function (data) {
47
- data && _this.logInfo("data: ", data);
48
- _this.logInfo("Completed");
29
+ .then((data) => {
30
+ data && this.logInfo("data: ", data);
31
+ this.logInfo("Completed");
49
32
  })
50
- .catch(function (err) { return _this.logError("Error", err); });
51
- };
52
- return Application;
53
- }(module_manager_1.ModuleManager));
33
+ .catch((err) => this.logError("Error", err));
34
+ }
35
+ }
54
36
  exports.Application = Application;
55
- //# sourceMappingURL=application.js.map
@@ -18,70 +18,64 @@
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
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; }
21
+ const array_tools_1 = require("../utils/array-tools");
22
+ const types_1 = require("./logger/types");
23
+ class DebugFlag {
24
+ constructor(key, minLogLevel = types_1.LogLevel.Info) {
26
25
  this.key = key;
27
26
  this.minLogLevel = minLogLevel;
28
27
  DebugFlags.add(this);
29
28
  }
30
- DebugFlag.prototype.setMinLevel = function (minLogLevel) {
29
+ setMinLevel(minLogLevel) {
31
30
  this.minLogLevel = minLogLevel;
32
- };
33
- DebugFlag.prototype.rename = function (newKey) {
31
+ }
32
+ rename(newKey) {
34
33
  DebugFlags.rename(this.key, newKey);
35
- };
36
- DebugFlag.prototype.getKey = function () {
34
+ }
35
+ getKey() {
37
36
  return this.key;
38
- };
39
- DebugFlag.prototype.enable = function (enable) {
40
- if (enable === void 0) { enable = true; }
37
+ }
38
+ enable(enable = true) {
41
39
  if (this.isEnabled() === enable)
42
40
  return;
43
41
  if (enable)
44
42
  this._enable();
45
43
  else
46
44
  this._disable();
47
- };
48
- DebugFlag.prototype.isEnabled = function () {
45
+ }
46
+ isEnabled() {
49
47
  return DebugFlags.instance.ActiveDebugFlags.includes(this.key);
50
- };
51
- DebugFlag.prototype.canLog = function (level) {
48
+ }
49
+ canLog(level) {
52
50
  return types_1.LogLevelOrdinal.indexOf(level) >= types_1.LogLevelOrdinal.indexOf(this.minLogLevel);
53
- };
54
- DebugFlag.prototype._enable = function () {
51
+ }
52
+ _enable() {
55
53
  (0, array_tools_1.addItemToArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
56
- };
57
- DebugFlag.prototype._disable = function () {
54
+ }
55
+ _disable() {
58
56
  (0, array_tools_1.removeItemFromArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
59
- };
60
- return DebugFlag;
61
- }());
57
+ }
58
+ }
62
59
  exports.DebugFlag = DebugFlag;
63
- var DebugFlags = /** @class */ (function () {
64
- function DebugFlags() {
60
+ class DebugFlags {
61
+ constructor() {
65
62
  this.AllDebugFlags = {};
66
63
  this.ActiveDebugFlags = [];
67
64
  }
68
- DebugFlags.createFlag = function (key, minLogLevel) {
69
- if (minLogLevel === void 0) { minLogLevel = types_1.LogLevel.Info; }
65
+ static createFlag(key, minLogLevel = types_1.LogLevel.Info) {
70
66
  // @ts-ignore
71
67
  return new DebugFlag(key, minLogLevel);
72
- };
73
- DebugFlags.add = function (flag) {
68
+ }
69
+ static add(flag) {
74
70
  this.instance.AllDebugFlags[flag.getKey()] = flag;
75
- };
76
- DebugFlags.rename = function (previousKey, newKey) {
77
- var flag = this.instance.AllDebugFlags[previousKey];
71
+ }
72
+ static rename(previousKey, newKey) {
73
+ const flag = this.instance.AllDebugFlags[previousKey];
78
74
  if (!flag)
79
75
  return;
80
76
  delete this.instance.AllDebugFlags[previousKey];
81
77
  this.instance.AllDebugFlags[newKey] = flag;
82
- };
83
- DebugFlags.instance = new DebugFlags();
84
- return DebugFlags;
85
- }());
78
+ }
79
+ }
80
+ DebugFlags.instance = new DebugFlags();
86
81
  exports.DebugFlags = DebugFlags;
87
- //# sourceMappingURL=debug-flags.js.map
@@ -16,21 +16,6 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
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
19
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
35
20
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
36
21
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -40,93 +25,46 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
40
25
  step((generator = generator.apply(thisArg, _arguments || [])).next());
41
26
  });
42
27
  };
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
28
  Object.defineProperty(exports, "__esModule", { value: true });
71
29
  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;
30
+ const Logger_1 = require("./logger/Logger");
31
+ class Processor extends Logger_1.Logger {
32
+ constructor(method) {
33
+ super(method);
34
+ this.method = method;
35
+ this.filter = (listener) => !!listener[this.method];
80
36
  }
81
- Processor.prototype.processModules = function (processor) {
37
+ processModules(processor) {
82
38
  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
- });
39
+ }
40
+ processModulesAsync(processor) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ return Promise.all(this.filterModules().map(processor));
89
43
  });
90
- };
91
- Processor.prototype.filterModules = function () {
92
- var listeners = Dispatcher.modulesResolver();
44
+ }
45
+ filterModules() {
46
+ const listeners = Dispatcher.modulesResolver();
93
47
  return listeners.filter(this.filter);
94
- };
95
- return Processor;
96
- }(Logger_1.Logger));
48
+ }
49
+ }
97
50
  exports.Processor = Processor;
98
- var Dispatcher = /** @class */ (function (_super) {
99
- __extends(Dispatcher, _super);
100
- function Dispatcher(method) {
101
- return _super.call(this, method) || this;
51
+ class Dispatcher extends Processor {
52
+ constructor(method) {
53
+ super(method);
102
54
  }
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) {
55
+ dispatchModule(...p) {
56
+ return this.processModules((listener) => {
110
57
  // @ts-ignore
111
- return listener[_this.method].apply(listener, p);
58
+ return (listener[this.method])(...p);
112
59
  });
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
- })];
60
+ }
61
+ dispatchModuleAsync(...p) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ return this.processModulesAsync((listener) => {
64
+ // @ts-ignore
65
+ return listener[this.method](...p);
126
66
  });
127
67
  });
128
- };
129
- return Dispatcher;
130
- }(Processor));
68
+ }
69
+ }
131
70
  exports.Dispatcher = Dispatcher;
132
- //# sourceMappingURL=dispatcher.js.map
@@ -18,7 +18,7 @@
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.dispatch_onServerError = exports.ServerErrorSeverity_Ordinal = exports.ServerErrorSeverity = void 0;
21
- var dispatcher_1 = require("./dispatcher");
21
+ const dispatcher_1 = require("./dispatcher");
22
22
  var ServerErrorSeverity;
23
23
  (function (ServerErrorSeverity) {
24
24
  ServerErrorSeverity["Debug"] = "Debug";
@@ -35,4 +35,3 @@ exports.ServerErrorSeverity_Ordinal = [
35
35
  ServerErrorSeverity.Critical
36
36
  ];
37
37
  exports.dispatch_onServerError = new dispatcher_1.Dispatcher("__processApplicationError");
38
- //# sourceMappingURL=error-handling.js.map
@@ -19,21 +19,6 @@
19
19
  /**
20
20
  * Created by TacB0sS on 3/16/17.
21
21
  */
22
- var __extends = (this && this.__extends) || (function () {
23
- var extendStatics = function (d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
- return function (d, b) {
30
- if (typeof b !== "function" && b !== null)
31
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
32
- extendStatics(d, b);
33
- function __() { this.constructor = d; }
34
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35
- };
36
- })();
37
22
  Object.defineProperty(exports, "__esModule", { value: true });
38
23
  exports.AssertionException = exports.WhoCallthisException = exports.DontCallthisException = exports.ThisShouldNotHappenException = exports.NotImplementedYetException = exports.MUSTNeverHappenException = exports.ImplementationMissingException = exports.BadImplementationException = exports.Exception = exports.CustomException = exports.isErrorOfType = void 0;
39
24
  /**
@@ -62,7 +47,7 @@ exports.AssertionException = exports.WhoCallthisException = exports.DontCallthis
62
47
  */
63
48
  function isErrorOfType(e, _exceptionType) {
64
49
  var _a;
65
- var _e = e;
50
+ const _e = e;
66
51
  if ((_a = _e.isInstanceOf) === null || _a === void 0 ? void 0 : _a.call(_e, _exceptionType))
67
52
  return e;
68
53
  }
@@ -78,137 +63,115 @@ exports.isErrorOfType = isErrorOfType;
78
63
  *
79
64
  * @category Exceptions
80
65
  */
81
- var CustomException = /** @class */ (function (_super) {
82
- __extends(CustomException, _super);
83
- function CustomException(exceptionType, message, cause) {
84
- var _this = _super.call(this, message) || this;
85
- _this.message = message;
86
- _this.stack = (new Error(message)).stack;
87
- _this.cause = cause;
88
- _this.exceptionType = exceptionType.name;
89
- _this.isInstanceOf = function (_exceptionType) {
90
- return _this.exceptionType === _exceptionType.name;
66
+ class CustomException extends Error {
67
+ constructor(exceptionType, message, cause) {
68
+ super(message);
69
+ this.message = message;
70
+ this.stack = (new Error(message)).stack;
71
+ this.cause = cause;
72
+ this.exceptionType = exceptionType.name;
73
+ this.isInstanceOf = (_exceptionType) => {
74
+ return this.exceptionType === _exceptionType.name;
91
75
  };
92
- return _this;
93
76
  }
94
- return CustomException;
95
- }(Error));
77
+ }
96
78
  exports.CustomException = CustomException;
97
79
  /**
98
80
  * # <ins>Exception</ins>
99
81
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "Exception",
100
82
  * @category Exceptions
101
83
  */
102
- var Exception = /** @class */ (function (_super) {
103
- __extends(Exception, _super);
104
- function Exception(message, cause) {
105
- return _super.call(this, Exception, message, cause) || this;
84
+ class Exception extends CustomException {
85
+ constructor(message, cause) {
86
+ super(Exception, message, cause);
106
87
  }
107
- return Exception;
108
- }(CustomException));
88
+ }
109
89
  exports.Exception = Exception;
110
90
  /**
111
91
  * # <ins>BadImplementationException</ins>
112
92
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "BadImplementationException",
113
93
  * @category Exceptions
114
94
  */
115
- var BadImplementationException = /** @class */ (function (_super) {
116
- __extends(BadImplementationException, _super);
117
- function BadImplementationException(message, cause) {
118
- return _super.call(this, BadImplementationException, message, cause) || this;
95
+ class BadImplementationException extends CustomException {
96
+ constructor(message, cause) {
97
+ super(BadImplementationException, message, cause);
119
98
  }
120
- return BadImplementationException;
121
- }(CustomException));
99
+ }
122
100
  exports.BadImplementationException = BadImplementationException;
123
101
  /**
124
102
  * # <ins>ImplementationMissingException</ins>
125
103
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ImplementationMissingException",
126
104
  * @category Exceptions
127
105
  */
128
- var ImplementationMissingException = /** @class */ (function (_super) {
129
- __extends(ImplementationMissingException, _super);
130
- function ImplementationMissingException(message, cause) {
131
- return _super.call(this, ImplementationMissingException, message, cause) || this;
106
+ class ImplementationMissingException extends CustomException {
107
+ constructor(message, cause) {
108
+ super(ImplementationMissingException, message, cause);
132
109
  }
133
- return ImplementationMissingException;
134
- }(CustomException));
110
+ }
135
111
  exports.ImplementationMissingException = ImplementationMissingException;
136
112
  /**
137
113
  * # <ins>MUSTNeverHappenException</ins>
138
114
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "MUSTNeverHappenException",
139
115
  * @category Exceptions
140
116
  */
141
- var MUSTNeverHappenException = /** @class */ (function (_super) {
142
- __extends(MUSTNeverHappenException, _super);
143
- function MUSTNeverHappenException(message, cause) {
144
- return _super.call(this, MUSTNeverHappenException, message, cause) || this;
117
+ class MUSTNeverHappenException extends CustomException {
118
+ constructor(message, cause) {
119
+ super(MUSTNeverHappenException, message, cause);
145
120
  }
146
- return MUSTNeverHappenException;
147
- }(CustomException));
121
+ }
148
122
  exports.MUSTNeverHappenException = MUSTNeverHappenException;
149
123
  /**
150
124
  * # <ins>NotImplementedYetException</ins>
151
125
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "NotImplementedYetException",
152
126
  * @category Exceptions
153
127
  */
154
- var NotImplementedYetException = /** @class */ (function (_super) {
155
- __extends(NotImplementedYetException, _super);
156
- function NotImplementedYetException(message, cause) {
157
- return _super.call(this, NotImplementedYetException, message, cause) || this;
128
+ class NotImplementedYetException extends CustomException {
129
+ constructor(message, cause) {
130
+ super(NotImplementedYetException, message, cause);
158
131
  }
159
- return NotImplementedYetException;
160
- }(CustomException));
132
+ }
161
133
  exports.NotImplementedYetException = NotImplementedYetException;
162
134
  /**
163
135
  * # <ins>ThisShouldNotHappenException</ins>
164
136
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ThisShouldNotHappenException",
165
137
  * @category Exceptions
166
138
  */
167
- var ThisShouldNotHappenException = /** @class */ (function (_super) {
168
- __extends(ThisShouldNotHappenException, _super);
169
- function ThisShouldNotHappenException(message, cause) {
170
- return _super.call(this, ThisShouldNotHappenException, message, cause) || this;
139
+ class ThisShouldNotHappenException extends CustomException {
140
+ constructor(message, cause) {
141
+ super(ThisShouldNotHappenException, message, cause);
171
142
  }
172
- return ThisShouldNotHappenException;
173
- }(CustomException));
143
+ }
174
144
  exports.ThisShouldNotHappenException = ThisShouldNotHappenException;
175
145
  /**
176
146
  * # <ins>DontCallthisException</ins>
177
147
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "DontCallthisException",
178
148
  * @category Exceptions
179
149
  */
180
- var DontCallthisException = /** @class */ (function (_super) {
181
- __extends(DontCallthisException, _super);
182
- function DontCallthisException(message, cause) {
183
- return _super.call(this, DontCallthisException, message, cause) || this;
150
+ class DontCallthisException extends CustomException {
151
+ constructor(message, cause) {
152
+ super(DontCallthisException, message, cause);
184
153
  }
185
- return DontCallthisException;
186
- }(CustomException));
154
+ }
187
155
  exports.DontCallthisException = DontCallthisException;
188
156
  /**
189
157
  * # <ins>WhoCallthisException</ins>
190
158
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "WhoCallthisException",
191
159
  * @category Exceptions
192
160
  */
193
- var WhoCallthisException = /** @class */ (function (_super) {
194
- __extends(WhoCallthisException, _super);
195
- function WhoCallthisException(message, cause) {
196
- return _super.call(this, WhoCallthisException, message, cause) || this;
161
+ class WhoCallthisException extends CustomException {
162
+ constructor(message, cause) {
163
+ super(WhoCallthisException, message, cause);
197
164
  }
198
- return WhoCallthisException;
199
- }(CustomException));
165
+ }
200
166
  exports.WhoCallthisException = WhoCallthisException;
201
167
  /**
202
168
  * # <ins>AssertionException</ins>
203
169
  * This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "AssertionException",
204
170
  * @category Exceptions
205
171
  */
206
- var AssertionException = /** @class */ (function (_super) {
207
- __extends(AssertionException, _super);
208
- function AssertionException(message, cause) {
209
- return _super.call(this, AssertionException, message, cause) || this;
172
+ class AssertionException extends CustomException {
173
+ constructor(message, cause) {
174
+ super(AssertionException, message, cause);
210
175
  }
211
- return AssertionException;
212
- }(CustomException));
176
+ }
213
177
  exports.AssertionException = AssertionException;
214
- //# sourceMappingURL=exceptions.js.map
@@ -18,44 +18,37 @@
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.BeLogged = void 0;
21
- var array_tools_1 = require("../../utils/array-tools");
22
- var BeLogged_Class = /** @class */ (function () {
23
- function BeLogged_Class() {
21
+ const array_tools_1 = require("../../utils/array-tools");
22
+ class BeLogged_Class {
23
+ constructor() {
24
24
  this.clients = [];
25
25
  this.lineCount = 0;
26
26
  }
27
- BeLogged_Class.prototype.addClient = function (client) {
27
+ addClient(client) {
28
28
  if (this.clients.indexOf(client) !== -1)
29
29
  return;
30
30
  this.clients.push(client);
31
- };
32
- BeLogged_Class.prototype.removeConsole = function (client) {
31
+ }
32
+ removeConsole(client) {
33
33
  if (this.clients.indexOf(client) === -1)
34
34
  return;
35
35
  (0, array_tools_1.removeItemFromArray)(this.clients, client);
36
- };
37
- BeLogged_Class.prototype.log = function (tag, level, bold) {
38
- var toLog = [];
39
- for (var _i = 3; _i < arguments.length; _i++) {
40
- toLog[_i - 3] = arguments[_i];
41
- }
36
+ }
37
+ log(tag, level, bold, ...toLog) {
42
38
  this.logImpl(tag, level, bold, toLog);
43
- };
44
- BeLogged_Class.prototype.logImpl = function (tag, level, bold, toLog) {
45
- for (var _i = 0, _a = this.clients; _i < _a.length; _i++) {
46
- var client = _a[_i];
39
+ }
40
+ logImpl(tag, level, bold, toLog) {
41
+ for (const client of this.clients) {
47
42
  client.log(tag, level, bold, toLog);
48
43
  }
49
- };
50
- BeLogged_Class.prototype.clearFooter = function () {
51
- for (var i = 0; i < this.lineCount + 3; i++) {
52
- process.stdout.write("\n");
44
+ }
45
+ clearFooter() {
46
+ for (let i = 0; i < this.lineCount + 3; i++) {
47
+ process.stdout.write(`\n`);
53
48
  }
54
- };
55
- BeLogged_Class.prototype.rewriteConsole = function (lineCount) {
49
+ }
50
+ rewriteConsole(lineCount) {
56
51
  this.lineCount = lineCount;
57
- };
58
- return BeLogged_Class;
59
- }());
52
+ }
53
+ }
60
54
  exports.BeLogged = new BeLogged_Class();
61
- //# sourceMappingURL=BeLogged.js.map
@@ -18,26 +18,25 @@
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.DefaultLogPrefixComposer = exports._logger_getPrefix = exports._logger_finalDate = exports._logger_timezoneOffset = exports.LogClient = void 0;
21
- var types_1 = require("./types");
22
- var LogClient = /** @class */ (function () {
23
- function LogClient() {
21
+ const types_1 = require("./types");
22
+ class LogClient {
23
+ constructor() {
24
24
  this.prefixComposer = exports.DefaultLogPrefixComposer;
25
- this.filter = function () { return true; };
25
+ this.filter = () => true;
26
26
  }
27
- LogClient.prototype.setComposer = function (logComposer) {
27
+ setComposer(logComposer) {
28
28
  this.prefixComposer = logComposer;
29
- };
30
- LogClient.prototype.setFilter = function (filter) {
29
+ }
30
+ setFilter(filter) {
31
31
  this.filter = filter;
32
32
  return this;
33
- };
34
- LogClient.prototype.log = function (tag, level, bold, toLog) {
33
+ }
34
+ log(tag, level, bold, toLog) {
35
35
  if (!this.filter(level, tag))
36
36
  return;
37
37
  this.logMessage(level, bold, this.prefixComposer(tag, level), toLog);
38
- };
39
- return LogClient;
40
- }());
38
+ }
39
+ }
41
40
  exports.LogClient = LogClient;
42
41
  exports._logger_timezoneOffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
43
42
  exports._logger_finalDate = new Date();
@@ -58,10 +57,9 @@ function _logger_getPrefix(level) {
58
57
  }
59
58
  }
60
59
  exports._logger_getPrefix = _logger_getPrefix;
61
- var DefaultLogPrefixComposer = function (tag, level) {
60
+ const DefaultLogPrefixComposer = (tag, level) => {
62
61
  exports._logger_finalDate.setTime(Date.now() - exports._logger_timezoneOffset);
63
- var date = exports._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23);
64
- return " ".concat(date, " ").concat(_logger_getPrefix(level), " ").concat(tag, ": ");
62
+ const date = exports._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23);
63
+ return ` ${date} ${_logger_getPrefix(level)} ${tag}: `;
65
64
  };
66
65
  exports.DefaultLogPrefixComposer = DefaultLogPrefixComposer;
67
- //# sourceMappingURL=LogClient.js.map