@leyyo/common 1.3.8 → 1.3.9

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 (211) hide show
  1. package/dist/base/index.d.ts +3 -3
  2. package/dist/base/index.js +3 -20
  3. package/dist/base/index.types.d.ts +32 -18
  4. package/dist/base/index.types.js +1 -3
  5. package/dist/base/leyyo.d.ts +1 -1
  6. package/dist/base/leyyo.js +35 -26
  7. package/dist/base/leyyo.types.d.ts +3 -3
  8. package/dist/base/leyyo.types.js +1 -3
  9. package/dist/class/index.d.ts +2 -2
  10. package/dist/class/index.js +2 -19
  11. package/dist/class/index.types.d.ts +1 -1
  12. package/dist/class/index.types.js +1 -3
  13. package/dist/class/list.d.ts +1 -1
  14. package/dist/class/list.js +1 -6
  15. package/dist/class/logger.instance.d.ts +5 -5
  16. package/dist/class/logger.instance.js +8 -12
  17. package/dist/common/deploy.common.d.ts +2 -2
  18. package/dist/common/deploy.common.js +14 -16
  19. package/dist/common/enum.pool.d.ts +5 -3
  20. package/dist/common/enum.pool.js +36 -48
  21. package/dist/common/error.common.d.ts +4 -4
  22. package/dist/common/error.common.js +45 -85
  23. package/dist/common/error.pool.d.ts +5 -3
  24. package/dist/common/error.pool.js +12 -23
  25. package/dist/common/event.common.d.ts +2 -2
  26. package/dist/common/event.common.js +25 -28
  27. package/dist/common/index.d.ts +11 -11
  28. package/dist/common/index.js +11 -28
  29. package/dist/common/index.types.d.ts +42 -6
  30. package/dist/common/index.types.js +1 -3
  31. package/dist/common/inert.d.ts +4 -2
  32. package/dist/common/inert.js +97 -110
  33. package/dist/common/lifecycle.common.d.ts +2 -2
  34. package/dist/common/lifecycle.common.js +48 -61
  35. package/dist/common/literal.pool.d.ts +6 -3
  36. package/dist/common/literal.pool.js +37 -48
  37. package/dist/common/log.common.d.ts +4 -4
  38. package/dist/common/log.common.js +63 -60
  39. package/dist/common/repo.common.d.ts +3 -3
  40. package/dist/common/repo.common.js +50 -52
  41. package/dist/const/index.js +26 -30
  42. package/dist/enum/index.d.ts +1 -1
  43. package/dist/enum/index.js +1 -18
  44. package/dist/enum/log-level.js +1 -5
  45. package/dist/error/caused.error.d.ts +2 -2
  46. package/dist/error/caused.error.js +2 -7
  47. package/dist/error/developer.error.d.ts +3 -3
  48. package/dist/error/developer.error.js +9 -9
  49. package/dist/error/http.error.d.ts +2 -2
  50. package/dist/error/http.error.js +9 -15
  51. package/dist/error/index.d.ts +7 -7
  52. package/dist/error/index.js +7 -24
  53. package/dist/error/index.types.d.ts +3 -3
  54. package/dist/error/index.types.js +1 -3
  55. package/dist/error/invalid-value.error.d.ts +1 -1
  56. package/dist/error/invalid-value.error.js +6 -13
  57. package/dist/error/leyyo.error.d.ts +5 -5
  58. package/dist/error/leyyo.error.js +45 -34
  59. package/dist/error/multiple.error.d.ts +2 -2
  60. package/dist/error/multiple.error.js +6 -12
  61. package/dist/function/define-loader.d.ts +1 -1
  62. package/dist/function/define-loader.js +7 -10
  63. package/dist/function/delay.js +2 -6
  64. package/dist/function/delete-prop.js +9 -15
  65. package/dist/function/{empty.fn.js → empty-fn.js} +1 -5
  66. package/dist/function/extended-type.d.ts +1 -1
  67. package/dist/function/extended-type.js +8 -12
  68. package/dist/function/get-fqn.d.ts +1 -1
  69. package/dist/function/get-fqn.js +7 -12
  70. package/dist/function/get-prop.js +10 -16
  71. package/dist/function/has-fqn.d.ts +1 -1
  72. package/dist/function/has-fqn.js +7 -11
  73. package/dist/function/index.d.ts +38 -28
  74. package/dist/function/index.js +38 -45
  75. package/dist/function/index.types.d.ts +2 -2
  76. package/dist/function/index.types.js +1 -3
  77. package/dist/function/is-anonymous-name.js +3 -7
  78. package/dist/function/is-class.d.ts +7 -0
  79. package/dist/function/is-class.js +18 -0
  80. package/dist/function/is-empty.d.ts +12 -0
  81. package/dist/function/is-empty.js +18 -0
  82. package/dist/function/is-filled-arr.d.ts +10 -0
  83. package/dist/function/is-filled-arr.js +12 -0
  84. package/dist/function/is-filled-obj.d.ts +10 -0
  85. package/dist/function/is-filled-obj.js +13 -0
  86. package/dist/function/is-obj.d.ts +9 -0
  87. package/dist/function/is-obj.js +11 -0
  88. package/dist/function/is-test.js +2 -7
  89. package/dist/function/is-text.d.ts +11 -0
  90. package/dist/function/is-text.js +17 -0
  91. package/dist/function/jitter-interval.js +2 -6
  92. package/dist/function/leyyo-fn.d.ts +1 -1
  93. package/dist/function/leyyo-fn.js +2 -7
  94. package/dist/function/on-fqn-set.d.ts +1 -1
  95. package/dist/function/on-fqn-set.js +9 -13
  96. package/dist/function/one-or-more.d.ts +1 -1
  97. package/dist/function/one-or-more.js +1 -5
  98. package/dist/function/opt-add.d.ts +10 -0
  99. package/dist/function/opt-add.js +29 -0
  100. package/dist/function/opt-append.d.ts +9 -0
  101. package/dist/function/opt-append.js +24 -0
  102. package/dist/function/opt-check.d.ts +8 -0
  103. package/dist/function/opt-check.js +31 -0
  104. package/dist/function/opt-clone.d.ts +8 -0
  105. package/dist/function/opt-clone.js +12 -0
  106. package/dist/function/opt-field.d.ts +11 -0
  107. package/dist/function/opt-field.js +31 -0
  108. package/dist/function/opt-fn.d.ts +8 -0
  109. package/dist/function/opt-fn.js +11 -0
  110. package/dist/function/random-test-no.js +1 -5
  111. package/dist/function/remove-fqn.d.ts +1 -1
  112. package/dist/function/remove-fqn.js +10 -14
  113. package/dist/function/run-exporter.d.ts +1 -1
  114. package/dist/function/run-exporter.js +12 -27
  115. package/dist/function/secure-clone.d.ts +1 -1
  116. package/dist/function/secure-clone.js +2 -7
  117. package/dist/function/secure-json.js +6 -12
  118. package/dist/function/set-anonymous-fqn.d.ts +1 -1
  119. package/dist/function/set-anonymous-fqn.js +15 -19
  120. package/dist/function/set-anonymous-name.d.ts +1 -1
  121. package/dist/function/set-anonymous-name.js +23 -26
  122. package/dist/function/set-fqn.d.ts +1 -1
  123. package/dist/function/set-fqn.js +28 -31
  124. package/dist/function/set-prop.js +9 -15
  125. package/dist/function/stamp-loader.d.ts +1 -1
  126. package/dist/function/stamp-loader.js +4 -8
  127. package/dist/function/test-case.js +5 -9
  128. package/dist/function/test-name.js +4 -8
  129. package/dist/function/trigger-fqn.d.ts +1 -1
  130. package/dist/function/trigger-fqn.js +5 -9
  131. package/dist/index.d.ts +19 -19
  132. package/dist/index.foretell.js +10 -88
  133. package/dist/index.js +22 -40
  134. package/dist/index.loader.d.ts +1 -1
  135. package/dist/index.loader.js +6 -43
  136. package/dist/init/index.js +3 -7
  137. package/dist/internal.js +1 -5
  138. package/package.json +26 -16
  139. package/dist/assets/.gitkeep +0 -0
  140. package/dist/base/index.js.map +0 -1
  141. package/dist/base/index.types.js.map +0 -1
  142. package/dist/base/leyyo.js.map +0 -1
  143. package/dist/base/leyyo.types.js.map +0 -1
  144. package/dist/class/index.js.map +0 -1
  145. package/dist/class/index.types.js.map +0 -1
  146. package/dist/class/list.js.map +0 -1
  147. package/dist/class/logger.instance.js.map +0 -1
  148. package/dist/common/deploy.common.js.map +0 -1
  149. package/dist/common/enum.pool.js.map +0 -1
  150. package/dist/common/error.common.js.map +0 -1
  151. package/dist/common/error.pool.js.map +0 -1
  152. package/dist/common/event.common.js.map +0 -1
  153. package/dist/common/index.js.map +0 -1
  154. package/dist/common/index.types.js.map +0 -1
  155. package/dist/common/inert.js.map +0 -1
  156. package/dist/common/lifecycle.common.js.map +0 -1
  157. package/dist/common/literal.pool.js.map +0 -1
  158. package/dist/common/log.common.js.map +0 -1
  159. package/dist/common/repo.common.js.map +0 -1
  160. package/dist/const/index.js.map +0 -1
  161. package/dist/enum/index.js.map +0 -1
  162. package/dist/enum/log-level.js.map +0 -1
  163. package/dist/error/caused.error.js.map +0 -1
  164. package/dist/error/developer.error.js.map +0 -1
  165. package/dist/error/http.error.js.map +0 -1
  166. package/dist/error/index.js.map +0 -1
  167. package/dist/error/index.types.js.map +0 -1
  168. package/dist/error/invalid-value.error.js.map +0 -1
  169. package/dist/error/leyyo.error.js.map +0 -1
  170. package/dist/error/multiple.error.js.map +0 -1
  171. package/dist/function/define-loader.js.map +0 -1
  172. package/dist/function/delay.js.map +0 -1
  173. package/dist/function/delete-prop.js.map +0 -1
  174. package/dist/function/empty.fn.js.map +0 -1
  175. package/dist/function/extended-type.js.map +0 -1
  176. package/dist/function/get-fqn.js.map +0 -1
  177. package/dist/function/get-prop.js.map +0 -1
  178. package/dist/function/has-fqn.js.map +0 -1
  179. package/dist/function/index.js.map +0 -1
  180. package/dist/function/index.types.js.map +0 -1
  181. package/dist/function/is-anonymous-name.js.map +0 -1
  182. package/dist/function/is-test.js.map +0 -1
  183. package/dist/function/is.fn.d.ts +0 -59
  184. package/dist/function/is.fn.js +0 -93
  185. package/dist/function/is.fn.js.map +0 -1
  186. package/dist/function/jitter-interval.js.map +0 -1
  187. package/dist/function/leyyo-fn.js.map +0 -1
  188. package/dist/function/on-fqn-set.js.map +0 -1
  189. package/dist/function/one-or-more.js.map +0 -1
  190. package/dist/function/opt.fn.d.ts +0 -49
  191. package/dist/function/opt.fn.js +0 -142
  192. package/dist/function/opt.fn.js.map +0 -1
  193. package/dist/function/random-test-no.js.map +0 -1
  194. package/dist/function/remove-fqn.js.map +0 -1
  195. package/dist/function/run-exporter.js.map +0 -1
  196. package/dist/function/secure-clone.js.map +0 -1
  197. package/dist/function/secure-json.js.map +0 -1
  198. package/dist/function/set-anonymous-fqn.js.map +0 -1
  199. package/dist/function/set-anonymous-name.js.map +0 -1
  200. package/dist/function/set-fqn.js.map +0 -1
  201. package/dist/function/set-prop.js.map +0 -1
  202. package/dist/function/stamp-loader.js.map +0 -1
  203. package/dist/function/test-case.js.map +0 -1
  204. package/dist/function/test-name.js.map +0 -1
  205. package/dist/function/trigger-fqn.js.map +0 -1
  206. package/dist/index.foretell.js.map +0 -1
  207. package/dist/index.js.map +0 -1
  208. package/dist/index.loader.js.map +0 -1
  209. package/dist/init/index.js.map +0 -1
  210. package/dist/internal.js.map +0 -1
  211. /package/dist/function/{empty.fn.d.ts → empty-fn.d.ts} +0 -0
@@ -1,25 +1,14 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LiteralPool = void 0;
13
- const inert_1 = require("./inert");
14
- const function_1 = require("../function");
15
- const internal_1 = require("../internal");
16
- const const_1 = require("../const");
17
- const where = `${internal_1.FQN}.LiteralPool`;
1
+ import { Inert } from "./inert.js";
2
+ import { getSymbol, isEmpty, isFilledArr, isFilledObj, isObj, isText, setSymbol, testCase } from "../function/index.js";
3
+ import { FQN } from "../internal.js";
4
+ import { KEY_LITERAL_ALT, KEY_LITERAL_I18N, KEY_LITERAL_NAME } from "../const/index.js";
5
+ const where = `${FQN}.LiteralPool`;
18
6
  // noinspection JSUnusedGlobalSymbols
19
7
  /**
20
8
  * Literal pool for call with name and lazy loading
21
9
  * */
22
- class LiteralPool extends inert_1.Inert {
10
+ export class LiteralPool extends Inert {
11
+ leyyo;
23
12
  constructor(leyyo) {
24
13
  super(leyyo, 'literal', {});
25
14
  this.leyyo = leyyo;
@@ -27,29 +16,26 @@ class LiteralPool extends inert_1.Inert {
27
16
  // region protected
28
17
  /** @inheritDoc */
29
18
  _getName(lit) {
30
- var _a;
31
- return (_a = this.getConfigItem(lit)) === null || _a === void 0 ? void 0 : _a.name;
19
+ return this.getConfigItem(lit)?.name;
32
20
  }
33
21
  /** @inheritDoc */
34
- _nextLoad(item) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (item.target && item.lazyAlt) {
37
- try {
38
- item.alt = yield item.lazyAlt;
39
- delete item.lazyAlt;
40
- this.setConfigItem(item.target, item);
41
- }
42
- catch (e) {
43
- new this.leyyo.developerError('Callback error during loading literal alternate data', (0, function_1.testCase)(internal_1.FQN, 186), where).log(e);
44
- }
22
+ async _nextLoad(item) {
23
+ if (item.target && item.lazyAlt) {
24
+ try {
25
+ item.alt = await item.lazyAlt;
26
+ delete item.lazyAlt;
27
+ this.setConfigItem(item.target, item);
45
28
  }
46
- delete item.lazyAlt;
47
- });
29
+ catch (e) {
30
+ new this.leyyo.developerError('Callback error during loading literal alternate data', testCase(FQN, 186), where).log(e);
31
+ }
32
+ }
33
+ delete item.lazyAlt;
48
34
  }
49
35
  /** @inheritDoc */
50
36
  _setName(lit, name) {
51
- if ((0, function_1.isText)(name)) {
52
- (0, function_1.setSymbol)(lit, const_1.KEY_LITERAL_NAME, name);
37
+ if (isText(name)) {
38
+ setSymbol(lit, KEY_LITERAL_NAME, name);
53
39
  return name;
54
40
  }
55
41
  return undefined;
@@ -66,35 +52,38 @@ class LiteralPool extends inert_1.Inert {
66
52
  }
67
53
  /** @inheritDoc */
68
54
  _validate(lit) {
69
- return (0, function_1.isFilledArr)(lit);
55
+ return isFilledArr(lit);
70
56
  }
71
57
  // endregion protected
72
58
  // region public
73
59
  /** @inheritDoc */
74
60
  setConfigItem(lit, conf) {
75
- if (!(0, function_1.isObj)(conf)) {
61
+ if (!isObj(conf)) {
76
62
  return;
77
63
  }
78
- if ((0, function_1.isText)(conf.name)) {
79
- (0, function_1.setSymbol)(lit, const_1.KEY_LITERAL_NAME, conf.name);
64
+ if (isText(conf.name)) {
65
+ setSymbol(lit, KEY_LITERAL_NAME, conf.name);
80
66
  }
81
- if (!(0, function_1.isEmpty)(conf.i18n)) {
82
- (0, function_1.setSymbol)(lit, const_1.KEY_LITERAL_I18N, conf.i18n);
67
+ if (!isEmpty(conf.i18n)) {
68
+ setSymbol(lit, KEY_LITERAL_I18N, conf.i18n);
83
69
  }
84
- if ((0, function_1.isFilledObj)(conf.alt)) {
85
- (0, function_1.setSymbol)(lit, const_1.KEY_LITERAL_ALT, conf.alt);
70
+ if (isFilledObj(conf.alt)) {
71
+ setSymbol(lit, KEY_LITERAL_ALT, conf.alt);
86
72
  }
87
73
  }
74
+ /** @inheritDoc */
88
75
  getConfigItem(lit) {
89
76
  if (!this._validate(lit)) {
90
77
  return undefined;
91
78
  }
92
79
  return {
93
- name: (0, function_1.getSymbol)(lit, const_1.KEY_LITERAL_NAME),
94
- i18n: (0, function_1.getSymbol)(lit, const_1.KEY_LITERAL_I18N),
95
- alt: (0, function_1.getSymbol)(lit, const_1.KEY_LITERAL_ALT),
80
+ name: getSymbol(lit, KEY_LITERAL_NAME),
81
+ i18n: getSymbol(lit, KEY_LITERAL_I18N),
82
+ alt: getSymbol(lit, KEY_LITERAL_ALT),
96
83
  };
97
84
  }
85
+ /** @inheritDoc */
86
+ define(fqn, name, target, opt) {
87
+ this.register({ ...(opt ?? {}), fqn, name, target });
88
+ }
98
89
  }
99
- exports.LiteralPool = LiteralPool;
100
- //# sourceMappingURL=literal.pool.js.map
@@ -1,7 +1,7 @@
1
- import { ClassLike, Fnc, LeyyoLike, Obj } from "../base";
2
- import { LogLevel } from "../enum";
3
- import { Opt } from "../function";
4
- import { ContextFinderLambda, LogCommonLike, LogFormatterLambda, Logger, LogStylerLambda } from "./index.types";
1
+ import { ClassLike, Fnc, LeyyoLike, Obj } from "../base/index.js";
2
+ import { LogLevel } from "../enum/index.js";
3
+ import { Opt } from "../function/index.js";
4
+ import { ContextFinderLambda, LogCommonLike, LogFormatterLambda, Logger, LogStylerLambda } from "./index.types.js";
5
5
  export declare class LogCommon implements LogCommonLike {
6
6
  private leyyo;
7
7
  /**
@@ -1,35 +1,43 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogCommon = void 0;
4
- const internal_1 = require("../internal");
5
- const function_1 = require("../function");
6
- const const_1 = require("../const");
7
- const where = `${internal_1.FQN}.LogCommon`;
1
+ import { FQN } from "../internal.js";
2
+ import { getFqn, hasFqn, isEmpty, isFilledObj, isObj, onFqnSet, secureJson, testCase } from "../function/index.js";
3
+ import { KEY_LOG_ALREADY } from "../const/index.js";
4
+ const where = `${FQN}.LogCommon`;
8
5
  const emptyWhere = ''.padStart(20);
9
6
  // noinspection JSUnusedGlobalSymbols
10
- class LogCommon {
7
+ export class LogCommon {
8
+ leyyo;
9
+ // region properties
10
+ /**
11
+ * Loggers
12
+ * */
13
+ _loggers;
14
+ /**
15
+ * Local console colors
16
+ *
17
+ * @type {LocalColorLike}
18
+ * */
19
+ _localColor = {
20
+ bold: '\x1b[1m',
21
+ normal: '\x1b[21m',
22
+ end: '\x1b[0m',
23
+ param: '\x1b[90m',
24
+ levels: {
25
+ fatal: [true, '\x1b[31m', '\x1b[91m'], // bold red
26
+ error: [false, '\x1b[31m', '\x1b[91m'], // red
27
+ warn: [false, '\x1b[35m', '\x1b[95m'], // magenta
28
+ info: [false, '\x1b[32m', '\x1b[92m'], // green
29
+ debug: [false, '\x1b[33m', '\x1b[93m'], // yellow
30
+ trace: [false, '\x1b[36m', '\x1b[96m'], // yellow
31
+ }
32
+ };
33
+ _logFormatter;
34
+ _logDeploymentStyler;
35
+ _logLocalStyler;
36
+ _logStyler;
37
+ _contextFinder;
11
38
  // endregion properties
12
39
  constructor(leyyo) {
13
40
  this.leyyo = leyyo;
14
- /**
15
- * Local console colors
16
- *
17
- * @type {LocalColorLike}
18
- * */
19
- this._localColor = {
20
- bold: '\x1b[1m',
21
- normal: '\x1b[21m',
22
- end: '\x1b[0m',
23
- param: '\x1b[90m',
24
- levels: {
25
- fatal: [true, '\x1b[31m', '\x1b[91m'], // bold red
26
- error: [false, '\x1b[31m', '\x1b[91m'], // red
27
- warn: [false, '\x1b[35m', '\x1b[95m'], // magenta
28
- info: [false, '\x1b[32m', '\x1b[92m'], // green
29
- debug: [false, '\x1b[33m', '\x1b[93m'], // yellow
30
- trace: [false, '\x1b[36m', '\x1b[96m'], // yellow
31
- }
32
- };
33
41
  this._loggers = this.leyyo.repoCommon.newMap(`${where}.loggers`);
34
42
  this._defaults();
35
43
  }
@@ -41,7 +49,7 @@ class LogCommon {
41
49
  * */
42
50
  setLogFormatter(fn) {
43
51
  if (typeof fn !== 'function') {
44
- throw new this.leyyo.developerError('Invalid log formatter', (0, function_1.testCase)(internal_1.FQN, 200), where);
52
+ throw new this.leyyo.developerError('Invalid log formatter', testCase(FQN, 200), where);
45
53
  }
46
54
  this._logFormatter = fn;
47
55
  }
@@ -52,7 +60,7 @@ class LogCommon {
52
60
  * */
53
61
  setLogDeploymentStyler(fn) {
54
62
  if (typeof fn !== 'function') {
55
- throw new this.leyyo.developerError('Invalid log styler', (0, function_1.testCase)(internal_1.FQN, 201), where);
63
+ throw new this.leyyo.developerError('Invalid log styler', testCase(FQN, 201), where);
56
64
  }
57
65
  this._logDeploymentStyler = fn;
58
66
  if (process.env['NODE_ENV'] !== 'local') {
@@ -66,7 +74,7 @@ class LogCommon {
66
74
  * */
67
75
  setLogLocalStyler(fn) {
68
76
  if (typeof fn !== 'function') {
69
- throw new this.leyyo.developerError('Invalid log local styler', (0, function_1.testCase)(internal_1.FQN, 202), where);
77
+ throw new this.leyyo.developerError('Invalid log local styler', testCase(FQN, 202), where);
70
78
  }
71
79
  this._logLocalStyler = fn;
72
80
  if (process.env['NODE_ENV'] === 'local') {
@@ -80,7 +88,7 @@ class LogCommon {
80
88
  * */
81
89
  setContextFinder(fn) {
82
90
  if (typeof fn !== 'function') {
83
- throw new this.leyyo.developerError('Invalid log local styler', (0, function_1.testCase)(internal_1.FQN, 202), where);
91
+ throw new this.leyyo.developerError('Invalid log local styler', testCase(FQN, 202), where);
84
92
  }
85
93
  this._contextFinder = fn;
86
94
  }
@@ -93,15 +101,14 @@ class LogCommon {
93
101
  * @param {LogItem} item
94
102
  * */
95
103
  this._logFormatter = (item) => {
96
- var _a, _b;
97
- if (item === null || item === void 0 ? void 0 : item.ctx) {
104
+ if (item?.ctx) {
98
105
  const ctx = item.ctx;
99
106
  item.ctx = {
100
- tid: ctx === null || ctx === void 0 ? void 0 : ctx.id,
101
- cid: ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.req) === null || _a === void 0 ? void 0 : _a.headers) ? (_b = ctx === null || ctx === void 0 ? void 0 : ctx.req) === null || _b === void 0 ? void 0 : _b.headers["correlation-id"] : undefined,
107
+ tid: ctx?.id,
108
+ cid: ctx?.req?.headers ? ctx?.req?.headers["correlation-id"] : undefined,
102
109
  };
103
110
  }
104
- item.paramStr = item.params ? (0, function_1.secureJson)(item.params) : undefined;
111
+ item.paramStr = item.params ? secureJson(item.params) : undefined;
105
112
  delete item.params;
106
113
  if (item.paramStr && ['{}', '[]'].includes(item.paramStr)) {
107
114
  delete item.paramStr;
@@ -115,7 +122,7 @@ class LogCommon {
115
122
  * */
116
123
  this._logDeploymentStyler = (item) => {
117
124
  let message = item.now;
118
- if (item === null || item === void 0 ? void 0 : item.ctx) {
125
+ if (item?.ctx) {
119
126
  if (item.ctx['pid']) {
120
127
  message += ` [p:${item.ctx['pid']}]`;
121
128
  }
@@ -151,11 +158,10 @@ class LogCommon {
151
158
  * @return {string}
152
159
  * */
153
160
  this._logLocalStyler = (item) => {
154
- var _a;
155
161
  const { bold, end, param } = this._localColor;
156
- const [isBold, regular, light] = (_a = this._localColor.levels[item.level]) !== null && _a !== void 0 ? _a : this._localColor.levels.debug;
162
+ const [isBold, regular, light] = this._localColor.levels[item.level] ?? this._localColor.levels.debug;
157
163
  let message = item.now.substring(10, 11) + ` ${param}[p:${process.pid}]${end}`;
158
- if (item === null || item === void 0 ? void 0 : item.ctx) {
164
+ if (item?.ctx) {
159
165
  if (item.ctx['tid']) {
160
166
  message += ` ${regular}[t:${item.ctx['tid']}]`;
161
167
  }
@@ -214,7 +220,7 @@ class LogCommon {
214
220
  * @param {LogItem} item
215
221
  * */
216
222
  _consumeLog(item) {
217
- if (!(0, function_1.isObj)(item)) {
223
+ if (!isObj(item)) {
218
224
  return;
219
225
  }
220
226
  item.where = this._shortenWhere(item.where);
@@ -230,9 +236,9 @@ class LogCommon {
230
236
  catch (e) {
231
237
  }
232
238
  if (typeof message !== 'string') {
233
- message = `${item === null || item === void 0 ? void 0 : item.now} - ${typeof item.message === 'string' ? item.message : (0, function_1.secureJson)(item.message)}`;
239
+ message = `${item?.now} - ${typeof item.message === 'string' ? item.message : secureJson(item.message)}`;
234
240
  if (item.params) {
235
- message += ` ~^~ ${(0, function_1.secureJson)(item.params)}`;
241
+ message += ` ~^~ ${secureJson(item.params)}`;
236
242
  }
237
243
  }
238
244
  console[item.level](message);
@@ -266,12 +272,12 @@ class LogCommon {
266
272
  let fqn;
267
273
  switch (typeof value) {
268
274
  case "function":
269
- fqn = (0, function_1.hasFqn)(value);
270
- name = this._checkLoggerName((0, function_1.getFqn)(value), 0);
275
+ fqn = hasFqn(value);
276
+ name = this._checkLoggerName(getFqn(value), 0);
271
277
  break;
272
278
  case "object":
273
- fqn = (0, function_1.hasFqn)(value);
274
- name = this._checkLoggerName((0, function_1.getFqn)(value), 0);
279
+ fqn = hasFqn(value);
280
+ name = this._checkLoggerName(getFqn(value), 0);
275
281
  break;
276
282
  case "string":
277
283
  fqn = true;
@@ -283,7 +289,7 @@ class LogCommon {
283
289
  }
284
290
  const ins = new this.leyyo.loggerInstance(name);
285
291
  if (!fqn) {
286
- (0, function_1.onFqnSet)(value, f => ins.$secure.$refreshName(f));
292
+ onFqnSet(value, f => ins.$secure.$refreshName(f));
287
293
  }
288
294
  this._loggers.set(name, ins);
289
295
  return ins;
@@ -303,7 +309,6 @@ class LogCommon {
303
309
  }
304
310
  /** @inheritDoc */
305
311
  emitLog(level, where, message, params) {
306
- var _a;
307
312
  const item = {
308
313
  level,
309
314
  where,
@@ -314,10 +319,10 @@ class LogCommon {
314
319
  if (message instanceof Error) {
315
320
  const err = message;
316
321
  try {
317
- if (err[const_1.KEY_LOG_ALREADY]) {
322
+ if (err[KEY_LOG_ALREADY]) {
318
323
  return;
319
324
  }
320
- err[const_1.KEY_LOG_ALREADY] = true;
325
+ err[KEY_LOG_ALREADY] = true;
321
326
  }
322
327
  catch (e) {
323
328
  }
@@ -326,27 +331,27 @@ class LogCommon {
326
331
  }
327
332
  else {
328
333
  if (typeof message !== 'string') {
329
- if ((0, function_1.isEmpty)(message)) {
334
+ if (isEmpty(message)) {
330
335
  message = '??';
331
336
  }
332
337
  else {
333
338
  if (typeof message === 'object') {
334
339
  try {
335
- if (message[const_1.KEY_LOG_ALREADY]) {
340
+ if (message[KEY_LOG_ALREADY]) {
336
341
  return;
337
342
  }
338
- message[const_1.KEY_LOG_ALREADY] = true;
343
+ message[KEY_LOG_ALREADY] = true;
339
344
  }
340
345
  catch (e) {
341
346
  }
342
347
  }
343
- message = (0, function_1.secureJson)(message);
348
+ message = secureJson(message);
344
349
  }
345
350
  }
346
351
  item.message = message;
347
- item.params = (0, function_1.isFilledObj)(params) ? params : {};
352
+ item.params = isFilledObj(params) ? params : {};
348
353
  }
349
- if (!item.where && (params === null || params === void 0 ? void 0 : params.where)) {
354
+ if (!item.where && params?.where) {
350
355
  try {
351
356
  if (typeof params.where === 'string') {
352
357
  item.where = params.where;
@@ -363,7 +368,7 @@ class LogCommon {
363
368
  }
364
369
  if (this._contextFinder) {
365
370
  try {
366
- item.ctx = this._contextFinder((_a = item.params) === null || _a === void 0 ? void 0 : _a.req);
371
+ item.ctx = this._contextFinder(item.params?.req);
367
372
  }
368
373
  catch (e) {
369
374
  }
@@ -371,5 +376,3 @@ class LogCommon {
371
376
  this.leyyo.eventCommon.emit('log', item);
372
377
  }
373
378
  }
374
- exports.LogCommon = LogCommon;
375
- //# sourceMappingURL=log.common.js.map
@@ -1,6 +1,6 @@
1
- import { List } from "../class";
2
- import { RepoCommonLike } from "./index.types";
3
- import { LeyyoLike } from "../base";
1
+ import { List } from "../class/index.js";
2
+ import { RepoCommonLike } from "./index.types.js";
3
+ import { LeyyoLike } from "../base/index.js";
4
4
  export declare class RepoCommon implements RepoCommonLike {
5
5
  private leyyo;
6
6
  private static _created;
@@ -1,51 +1,51 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RepoCommon = void 0;
4
- const internal_1 = require("../internal");
5
- const function_1 = require("../function");
6
- const error_1 = require("../error");
7
- const class_1 = require("../class");
1
+ import { FQN } from "../internal.js";
2
+ import { isText, testCase } from "../function/index.js";
3
+ import { DeveloperError } from "../error/index.js";
4
+ import { List } from "../class/index.js";
8
5
  /**
9
6
  * Identifier of file
10
7
  * */
11
- const where = `${internal_1.FQN}.Repo`;
8
+ const where = `${FQN}.Repo`;
12
9
  // noinspection JSUnusedGlobalSymbols
13
- class RepoCommon {
10
+ export class RepoCommon {
11
+ leyyo;
12
+ // region property
13
+ static _created;
14
+ /**
15
+ * Internal items which stores arrays
16
+ * */
17
+ _arrayItems = new Map();
18
+ /**
19
+ * Internal array volatile repo which could be cleared after lifecycle run
20
+ * */
21
+ _arrayVolatiles = new Set();
22
+ /**
23
+ * Internal items which stores lists
24
+ * */
25
+ _listItems = new Map();
26
+ /**
27
+ * Internal list volatiles repo which could be cleared after lifecycle run
28
+ * */
29
+ _listVolatiles = new Set();
30
+ /**
31
+ * Internal items which stores maps
32
+ * */
33
+ _mapItems = new Map();
34
+ /**
35
+ * Internal map volatile repo which could be cleared after lifecycle run
36
+ * */
37
+ _mapVolatiles = new Set();
38
+ /**
39
+ * Internal items which stores sets
40
+ * */
41
+ _setItems = new Map();
42
+ /**
43
+ * Internal set volatiles repo which could be cleared after lifecycle run
44
+ * */
45
+ _setVolatiles = new Set();
14
46
  // endregion property
15
47
  constructor(leyyo) {
16
48
  this.leyyo = leyyo;
17
- /**
18
- * Internal items which stores arrays
19
- * */
20
- this._arrayItems = new Map();
21
- /**
22
- * Internal array volatile repo which could be cleared after lifecycle run
23
- * */
24
- this._arrayVolatiles = new Set();
25
- /**
26
- * Internal items which stores lists
27
- * */
28
- this._listItems = new Map();
29
- /**
30
- * Internal list volatiles repo which could be cleared after lifecycle run
31
- * */
32
- this._listVolatiles = new Set();
33
- /**
34
- * Internal items which stores maps
35
- * */
36
- this._mapItems = new Map();
37
- /**
38
- * Internal map volatile repo which could be cleared after lifecycle run
39
- * */
40
- this._mapVolatiles = new Set();
41
- /**
42
- * Internal items which stores sets
43
- * */
44
- this._setItems = new Map();
45
- /**
46
- * Internal set volatiles repo which could be cleared after lifecycle run
47
- * */
48
- this._setVolatiles = new Set();
49
49
  if (RepoCommon._created) {
50
50
  throw new Error('ZZZ');
51
51
  }
@@ -60,8 +60,8 @@ class RepoCommon {
60
60
  * @return {Array<any>}
61
61
  * */
62
62
  newArray(name, volatile) {
63
- if (!(0, function_1.isText)(name)) {
64
- throw new error_1.DeveloperError('Invalid repository array name', (0, function_1.testCase)(internal_1.FQN, 140), where);
63
+ if (!isText(name)) {
64
+ throw new DeveloperError('Invalid repository array name', testCase(FQN, 140), where);
65
65
  }
66
66
  const item = [];
67
67
  const code = Symbol.for(name.split('#').join(''));
@@ -156,10 +156,10 @@ class RepoCommon {
156
156
  * @return {List<any>}
157
157
  * */
158
158
  newList(name, volatile) {
159
- if (!(0, function_1.isText)(name)) {
160
- throw new error_1.DeveloperError('Invalid repository list name', (0, function_1.testCase)(internal_1.FQN, 141), where);
159
+ if (!isText(name)) {
160
+ throw new DeveloperError('Invalid repository list name', testCase(FQN, 141), where);
161
161
  }
162
- const item = new class_1.List();
162
+ const item = new List();
163
163
  const code = Symbol.for(name.split('#').join(''));
164
164
  this._listItems.set(code, item);
165
165
  if (volatile) {
@@ -252,8 +252,8 @@ class RepoCommon {
252
252
  * @return {Map<any, any>}
253
253
  * */
254
254
  newMap(name, volatile) {
255
- if (!(0, function_1.isText)(name)) {
256
- throw new error_1.DeveloperError('Invalid repository map name', (0, function_1.testCase)(internal_1.FQN, 142), where);
255
+ if (!isText(name)) {
256
+ throw new DeveloperError('Invalid repository map name', testCase(FQN, 142), where);
257
257
  }
258
258
  const item = new Map();
259
259
  const code = Symbol.for(name.split('#').join(''));
@@ -349,8 +349,8 @@ class RepoCommon {
349
349
  * @return {Set<any>}
350
350
  * */
351
351
  newSet(name, volatile) {
352
- if (!(0, function_1.isText)(name)) {
353
- throw new error_1.DeveloperError('Invalid repository set name', (0, function_1.testCase)(internal_1.FQN, 143), where);
352
+ if (!isText(name)) {
353
+ throw new DeveloperError('Invalid repository set name', testCase(FQN, 143), where);
354
354
  }
355
355
  const item = new Set();
356
356
  const code = Symbol.for(name.split('#').join(''));
@@ -470,5 +470,3 @@ class RepoCommon {
470
470
  };
471
471
  }
472
472
  }
473
- exports.RepoCommon = RepoCommon;
474
- //# sourceMappingURL=repo.common.js.map
@@ -1,37 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KEY_LITERAL_I18N = exports.KEY_LITERAL_ALT = exports.KEY_LITERAL_NAME = exports.KEY_ENUM_I18N = exports.KEY_ENUM_ALT = exports.KEY_ENUM_NAME = exports.KEY_LOG_ALREADY = exports.KEY_LOADER_EMPTY = exports.KEY_LOADER_STAMP = exports.KEY_LOADER_NAME = exports.KEY_ERROR_WHERE = exports.KEY_ERROR_FLAGS = exports.KEY_ERROR_EMITTED = exports.KEY_ERROR_EMIT = exports.KEY_ERROR_I18N = exports.KEY_ERROR_DEFAULT_MESSAGE = exports.VAL_ERROR_UNKNOWN_MESSAGE = exports.VAL_ERROR_UNKNOWN_NAME = exports.KEY_ERROR_HTTP_STATUS = exports.KEY_SECURE_1 = exports.VAL_NAME_ANONYMOUS = exports.EMPTY_VALUES_STR = exports.EMPTY_VALUES = exports.VAL_FQN_ANONYMOUS = exports.KEY_FQN_ON_SET = exports.KEY_FQN_NAME = void 0;
4
- exports.KEY_FQN_NAME = Symbol.for('leyyo:fqn:basic');
5
- exports.KEY_FQN_ON_SET = Symbol.for('leyyo:fqn:on-set');
6
- exports.VAL_FQN_ANONYMOUS = '#Fqn';
1
+ export const KEY_FQN_NAME = Symbol.for('leyyo:fqn:basic');
2
+ export const KEY_FQN_ON_SET = Symbol.for('leyyo:fqn:on-set');
3
+ export const VAL_FQN_ANONYMOUS = '#Fqn';
7
4
  /**
8
5
  * Normal empty values
9
6
  * */
10
- exports.EMPTY_VALUES = [null, undefined];
7
+ export const EMPTY_VALUES = [null, undefined];
11
8
  // noinspection JSUnusedGlobalSymbols
12
9
  /**
13
10
  * Empty values with empty string
14
11
  * */
15
- exports.EMPTY_VALUES_STR = [null, undefined, ''];
16
- exports.VAL_NAME_ANONYMOUS = '~';
17
- exports.KEY_SECURE_1 = Symbol.for('leyyo:secure:1');
18
- exports.KEY_ERROR_HTTP_STATUS = Symbol.for('leyyo:http:status');
19
- exports.VAL_ERROR_UNKNOWN_NAME = 'UnknownError';
20
- exports.VAL_ERROR_UNKNOWN_MESSAGE = 'Unknown error';
21
- exports.KEY_ERROR_DEFAULT_MESSAGE = Symbol.for('leyyo:error:message');
22
- exports.KEY_ERROR_I18N = Symbol.for('leyyo:error:i18n');
23
- exports.KEY_ERROR_EMIT = Symbol.for('leyyo:error:emit');
24
- exports.KEY_ERROR_EMITTED = Symbol.for('leyyo:error:emit');
25
- exports.KEY_ERROR_FLAGS = Symbol.for('leyyo:error:flags');
26
- exports.KEY_ERROR_WHERE = Symbol.for('leyyo:error:where');
27
- exports.KEY_LOADER_NAME = Symbol.for('leyyo:loader:name');
28
- exports.KEY_LOADER_STAMP = Symbol.for('leyyo:loader:stamp');
29
- exports.KEY_LOADER_EMPTY = Symbol.for('leyyo:loader:empty');
30
- exports.KEY_LOG_ALREADY = Symbol.for('leyyo:log:already');
31
- exports.KEY_ENUM_NAME = Symbol.for('leyyo::enum:name');
32
- exports.KEY_ENUM_ALT = Symbol.for('leyyo:enum:alt');
33
- exports.KEY_ENUM_I18N = Symbol.for('leyyo:enum:i18n');
34
- exports.KEY_LITERAL_NAME = Symbol.for('leyyo::literal:name');
35
- exports.KEY_LITERAL_ALT = Symbol.for('leyyo:literal:alt');
36
- exports.KEY_LITERAL_I18N = Symbol.for('leyyo:literal:i18n');
37
- //# sourceMappingURL=index.js.map
12
+ export const EMPTY_VALUES_STR = [null, undefined, ''];
13
+ export const VAL_NAME_ANONYMOUS = '~';
14
+ export const KEY_SECURE_1 = Symbol.for('leyyo:secure:1');
15
+ export const KEY_ERROR_HTTP_STATUS = Symbol.for('leyyo:http:status');
16
+ export const VAL_ERROR_UNKNOWN_NAME = 'UnknownError';
17
+ export const VAL_ERROR_UNKNOWN_MESSAGE = 'Unknown error';
18
+ export const KEY_ERROR_DEFAULT_MESSAGE = Symbol.for('leyyo:error:message');
19
+ export const KEY_ERROR_I18N = Symbol.for('leyyo:error:i18n');
20
+ export const KEY_ERROR_EMIT = Symbol.for('leyyo:error:emit');
21
+ export const KEY_ERROR_EMITTED = Symbol.for('leyyo:error:emit');
22
+ export const KEY_ERROR_FLAGS = Symbol.for('leyyo:error:flags');
23
+ export const KEY_ERROR_WHERE = Symbol.for('leyyo:error:where');
24
+ export const KEY_LOADER_NAME = Symbol.for('leyyo:loader:name');
25
+ export const KEY_LOADER_STAMP = Symbol.for('leyyo:loader:stamp');
26
+ export const KEY_LOADER_EMPTY = Symbol.for('leyyo:loader:empty');
27
+ export const KEY_LOG_ALREADY = Symbol.for('leyyo:log:already');
28
+ export const KEY_ENUM_NAME = Symbol.for('leyyo::enum:name');
29
+ export const KEY_ENUM_ALT = Symbol.for('leyyo:enum:alt');
30
+ export const KEY_ENUM_I18N = Symbol.for('leyyo:enum:i18n');
31
+ export const KEY_LITERAL_NAME = Symbol.for('leyyo::literal:name');
32
+ export const KEY_LITERAL_ALT = Symbol.for('leyyo:literal:alt');
33
+ export const KEY_LITERAL_I18N = Symbol.for('leyyo:literal:i18n');
@@ -1 +1 @@
1
- export * from './log-level';
1
+ export * from './log-level.js';
@@ -1,18 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./log-level"), exports);
18
- //# sourceMappingURL=index.js.map
1
+ export * from './log-level.js';
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogLevelItems = void 0;
4
1
  const literals = ['debug', 'trace', 'info', 'warn', 'error', 'fatal'];
5
- exports.LogLevelItems = literals;
6
- //# sourceMappingURL=log-level.js.map
2
+ export const LogLevelItems = literals;