@leyyo/common 1.3.18 → 1.3.19

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 (146) hide show
  1. package/dist/base/index.d.ts +3 -3
  2. package/dist/base/index.js +3 -3
  3. package/dist/base/index.types.d.ts +3 -70
  4. package/dist/base/index.types.js +0 -32
  5. package/dist/base/leyyo.d.ts +0 -3
  6. package/dist/base/leyyo.js +8 -19
  7. package/dist/class/index.d.ts +2 -2
  8. package/dist/class/index.js +2 -2
  9. package/dist/class/index.types.d.ts +0 -20
  10. package/dist/class/list.d.ts +0 -6
  11. package/dist/class/list.js +0 -6
  12. package/dist/class/logger.instance.d.ts +6 -11
  13. package/dist/class/logger.instance.js +11 -25
  14. package/dist/common/deploy.common.d.ts +0 -16
  15. package/dist/common/deploy.common.js +4 -21
  16. package/dist/common/enum.pool.d.ts +5 -13
  17. package/dist/common/enum.pool.js +16 -17
  18. package/dist/common/error.common.d.ts +0 -30
  19. package/dist/common/error.common.js +33 -69
  20. package/dist/common/error.pool.d.ts +1 -10
  21. package/dist/common/error.pool.js +2 -13
  22. package/dist/common/event.common.d.ts +0 -8
  23. package/dist/common/event.common.js +15 -25
  24. package/dist/common/index.d.ts +11 -11
  25. package/dist/common/index.js +11 -11
  26. package/dist/common/index.types.d.ts +12 -435
  27. package/dist/common/index.types.js +0 -1
  28. package/dist/common/inert.d.ts +1 -49
  29. package/dist/common/inert.js +35 -64
  30. package/dist/common/lifecycle.common.d.ts +0 -14
  31. package/dist/common/lifecycle.common.js +13 -29
  32. package/dist/common/literal.pool.d.ts +1 -12
  33. package/dist/common/literal.pool.js +3 -18
  34. package/dist/common/log.common.d.ts +0 -54
  35. package/dist/common/log.common.js +62 -147
  36. package/dist/common/repo.common.d.ts +0 -188
  37. package/dist/common/repo.common.js +23 -239
  38. package/dist/const/index.d.ts +0 -7
  39. package/dist/const/index.js +28 -36
  40. package/dist/enum/index.d.ts +1 -1
  41. package/dist/enum/index.js +1 -1
  42. package/dist/enum/log-level.d.ts +1 -4
  43. package/dist/enum/log-level.js +1 -1
  44. package/dist/error/caused.error.d.ts +0 -10
  45. package/dist/error/caused.error.js +0 -10
  46. package/dist/error/developer.error.d.ts +1 -10
  47. package/dist/error/developer.error.js +6 -25
  48. package/dist/error/http.error.d.ts +0 -13
  49. package/dist/error/http.error.js +1 -8
  50. package/dist/error/index.d.ts +7 -7
  51. package/dist/error/index.js +7 -7
  52. package/dist/error/index.types.d.ts +1 -150
  53. package/dist/error/invalid-value.error.d.ts +0 -3
  54. package/dist/error/invalid-value.error.js +1 -4
  55. package/dist/error/leyyo.error.d.ts +0 -33
  56. package/dist/error/leyyo.error.js +25 -57
  57. package/dist/error/multiple.error.d.ts +0 -6
  58. package/dist/error/multiple.error.js +2 -9
  59. package/dist/function/define-loader.d.ts +0 -6
  60. package/dist/function/define-loader.js +0 -6
  61. package/dist/function/delay.d.ts +0 -8
  62. package/dist/function/delay.js +0 -9
  63. package/dist/function/delete-prop.d.ts +0 -21
  64. package/dist/function/delete-prop.js +6 -28
  65. package/dist/function/empty-fn.d.ts +0 -6
  66. package/dist/function/empty-fn.js +1 -9
  67. package/dist/function/extended-type.d.ts +0 -6
  68. package/dist/function/extended-type.js +18 -24
  69. package/dist/function/get-fqn.d.ts +0 -6
  70. package/dist/function/get-fqn.js +2 -8
  71. package/dist/function/get-prop.d.ts +0 -21
  72. package/dist/function/get-prop.js +5 -26
  73. package/dist/function/get-stat.d.ts +0 -20
  74. package/dist/function/get-stat.js +7 -2
  75. package/dist/function/has-fqn.d.ts +0 -6
  76. package/dist/function/has-fqn.js +2 -8
  77. package/dist/function/index.d.ts +40 -40
  78. package/dist/function/index.js +40 -40
  79. package/dist/function/index.types.d.ts +1 -1
  80. package/dist/function/is-anonymous-name.js +1 -1
  81. package/dist/function/is-class.d.ts +0 -6
  82. package/dist/function/is-class.js +2 -20
  83. package/dist/function/is-empty.d.ts +0 -11
  84. package/dist/function/is-empty.js +1 -12
  85. package/dist/function/is-filled-arr.d.ts +0 -9
  86. package/dist/function/is-filled-arr.js +0 -9
  87. package/dist/function/is-filled-obj.d.ts +0 -9
  88. package/dist/function/is-filled-obj.js +0 -9
  89. package/dist/function/is-obj.d.ts +0 -8
  90. package/dist/function/is-obj.js +1 -9
  91. package/dist/function/is-test.d.ts +0 -8
  92. package/dist/function/is-test.js +3 -19
  93. package/dist/function/is-text.d.ts +0 -10
  94. package/dist/function/is-text.js +1 -11
  95. package/dist/function/jitter-interval.d.ts +0 -9
  96. package/dist/function/jitter-interval.js +2 -18
  97. package/dist/function/load-config.d.ts +0 -19
  98. package/dist/function/load-config.js +10 -61
  99. package/dist/function/on-fqn-set.js +3 -3
  100. package/dist/function/one-or-more.d.ts +0 -6
  101. package/dist/function/one-or-more.js +0 -7
  102. package/dist/function/opt-add.d.ts +0 -8
  103. package/dist/function/opt-add.js +2 -10
  104. package/dist/function/opt-append.d.ts +0 -7
  105. package/dist/function/opt-append.js +0 -7
  106. package/dist/function/opt-check.d.ts +0 -6
  107. package/dist/function/opt-check.js +2 -9
  108. package/dist/function/opt-clone.d.ts +0 -6
  109. package/dist/function/opt-clone.js +0 -7
  110. package/dist/function/opt-field.d.ts +0 -8
  111. package/dist/function/opt-field.js +6 -14
  112. package/dist/function/opt-fn.d.ts +0 -6
  113. package/dist/function/opt-fn.js +0 -7
  114. package/dist/function/random-test-no.d.ts +0 -5
  115. package/dist/function/random-test-no.js +0 -5
  116. package/dist/function/remove-fqn.d.ts +0 -8
  117. package/dist/function/remove-fqn.js +3 -12
  118. package/dist/function/run-exporter.d.ts +0 -5
  119. package/dist/function/run-exporter.js +3 -17
  120. package/dist/function/secure-clone.js +3 -3
  121. package/dist/function/secure-json.d.ts +0 -35
  122. package/dist/function/secure-json.js +12 -54
  123. package/dist/function/set-anonymous-fqn.js +4 -5
  124. package/dist/function/set-anonymous-name.js +14 -14
  125. package/dist/function/set-fqn.d.ts +0 -7
  126. package/dist/function/set-fqn.js +8 -15
  127. package/dist/function/set-prop.d.ts +0 -24
  128. package/dist/function/set-prop.js +6 -30
  129. package/dist/function/stamp-loader.d.ts +0 -6
  130. package/dist/function/stamp-loader.js +1 -7
  131. package/dist/function/test-case.d.ts +0 -7
  132. package/dist/function/test-case.js +3 -10
  133. package/dist/function/test-name.d.ts +0 -7
  134. package/dist/function/test-name.js +2 -9
  135. package/dist/function/trigger-fqn.js +2 -3
  136. package/dist/index.d.ts +10 -10
  137. package/dist/index.foretell.js +7 -10
  138. package/dist/index.js +10 -11
  139. package/dist/index.loader.js +1 -8
  140. package/dist/init/index.js +5 -7
  141. package/dist/sys/index.d.ts +2 -2
  142. package/dist/sys/index.js +2 -2
  143. package/dist/sys/leyyo-storage.d.ts +0 -7
  144. package/dist/sys/leyyo-storage.js +5 -28
  145. package/dist/sys/package-json.js +5 -5
  146. package/package.json +16 -31
@@ -3,87 +3,38 @@ import { isText, testCase } from "../function/index.js";
3
3
  import { DeveloperError } from "../error/index.js";
4
4
  import { List } from "../class/index.js";
5
5
  import { getRootStorage } from "../sys/index.js";
6
- /**
7
- * Identifier of file
8
- * */
9
6
  const where = `${FQN}.Repo`;
10
- const _NAME = '$$leyyo.repo';
11
- // noinspection JSUnusedGlobalSymbols
7
+ const _NAME = "$$leyyo.repo";
12
8
  export class RepoCommon {
13
9
  leyyo;
14
- // region property
15
10
  static _created;
16
- /**
17
- * Internal items which stores arrays
18
- * */
19
11
  _arrayItems = getRootStorage(_NAME, new Map());
20
- /**
21
- * Internal array volatile repo which could be cleared after lifecycle run
22
- * */
23
12
  _arrayVolatiles = getRootStorage(_NAME, new Set());
24
- /**
25
- * Internal items which stores lists
26
- * */
27
13
  _listItems = getRootStorage(_NAME, new Map());
28
- /**
29
- * Internal list volatiles repo which could be cleared after lifecycle run
30
- * */
31
14
  _listVolatiles = getRootStorage(_NAME, new Set());
32
- /**
33
- * Internal items which stores maps
34
- * */
35
15
  _mapItems = getRootStorage(_NAME, new Map());
36
- /**
37
- * Internal map volatile repo which could be cleared after lifecycle run
38
- * */
39
16
  _mapVolatiles = getRootStorage(_NAME, new Set());
40
- /**
41
- * Internal items which stores sets
42
- * */
43
17
  _setItems = getRootStorage(_NAME, new Map());
44
- /**
45
- * Internal set volatiles repo which could be cleared after lifecycle run
46
- * */
47
18
  _setVolatiles = getRootStorage(_NAME, new Set());
48
- // endregion property
49
19
  constructor(leyyo) {
50
20
  this.leyyo = leyyo;
51
21
  if (RepoCommon._created) {
52
- throw new Error('ZZZ');
22
+ throw new Error("ZZZ");
53
23
  }
54
24
  RepoCommon._created = true;
55
25
  }
56
- // region array
57
- /**
58
- * Create new array
59
- *
60
- * @param {string} name - name of collection
61
- * @param {boolean} volatile - if yes: it will be removed after lifecycle run
62
- * @return {Array<any>}
63
- * */
64
26
  newArray(name, volatile) {
65
27
  if (!isText(name)) {
66
- throw new DeveloperError('Invalid repository array name', testCase(FQN, 140), where);
28
+ throw new DeveloperError("Invalid repository array name", testCase(FQN, 140), where);
67
29
  }
68
30
  const item = [];
69
- const code = Symbol.for(name.split('#').join(''));
31
+ const code = Symbol.for(name.split("#").join(""));
70
32
  this._arrayItems.set(code, item);
71
33
  if (volatile) {
72
34
  this._arrayVolatiles.add(code);
73
35
  }
74
36
  return item;
75
37
  }
76
- /**
77
- * Remove array by given key
78
- *
79
- * @param {symbol} key - key of collection
80
- * @return {number}
81
- *
82
- * Return possibilities:
83
- * - `-2`: key is not valid symbol
84
- * - `-1`: key does not exist
85
- * - `>= 0`: length of removed items in collection
86
- * */
87
38
  removeArray(key) {
88
39
  const cleared = this.clearArray(key);
89
40
  if (cleared >= 0) {
@@ -94,19 +45,8 @@ export class RepoCommon {
94
45
  }
95
46
  return cleared;
96
47
  }
97
- /**
98
- * Clear array by given key
99
- *
100
- * @param {symbol} key - key of collection
101
- * @return {number}
102
- *
103
- * Return possibilities:
104
- * - `-2`: key is not valid symbol
105
- * - `-1`: key does not exist
106
- * - `>= 0`: length of cleared items in collection
107
- * */
108
48
  clearArray(key) {
109
- if (typeof key !== 'symbol') {
49
+ if (typeof key !== "symbol") {
110
50
  return -2;
111
51
  }
112
52
  if (!this._arrayItems.has(key)) {
@@ -117,21 +57,9 @@ export class RepoCommon {
117
57
  item.splice(0, length);
118
58
  return length;
119
59
  }
120
- /**
121
- * List all array keys
122
- *
123
- * @return {Array<symbol>}
124
- * */
125
60
  listArrays() {
126
61
  return Array.from(this._arrayItems.keys());
127
62
  }
128
- /**
129
- * Print all arrays
130
- *
131
- * @return {Record} - as {key: length of collection}
132
- *
133
- * Note: if stringified symbol is duplicated, add index postfix with `#` symbol
134
- * */
135
63
  printArrays() {
136
64
  const result = {};
137
65
  let index = 0;
@@ -148,38 +76,18 @@ export class RepoCommon {
148
76
  }
149
77
  return result;
150
78
  }
151
- // endregion array
152
- // region list
153
- /**
154
- * Create new list
155
- *
156
- * @param {string} name - name of collection
157
- * @param {boolean} volatile - if yes: it will be removed after lifecycle run
158
- * @return {List<any>}
159
- * */
160
79
  newList(name, volatile) {
161
80
  if (!isText(name)) {
162
- throw new DeveloperError('Invalid repository list name', testCase(FQN, 141), where);
81
+ throw new DeveloperError("Invalid repository list name", testCase(FQN, 141), where);
163
82
  }
164
83
  const item = new List();
165
- const code = Symbol.for(name.split('#').join(''));
84
+ const code = Symbol.for(name.split("#").join(""));
166
85
  this._listItems.set(code, item);
167
86
  if (volatile) {
168
87
  this._listVolatiles.add(code);
169
88
  }
170
89
  return item;
171
90
  }
172
- /**
173
- * Remove list by given key
174
- *
175
- * @param {symbol} key - key of collection
176
- * @return {number}
177
- *
178
- * Return possibilities:
179
- * - `-2`: key is not valid symbol
180
- * - `-1`: key does not exist
181
- * - `>= 0`: length of removed items in collection
182
- * */
183
91
  removeList(key) {
184
92
  const cleared = this.clearList(key);
185
93
  if (cleared >= 0) {
@@ -190,19 +98,8 @@ export class RepoCommon {
190
98
  }
191
99
  return cleared;
192
100
  }
193
- /**
194
- * Clear list by given key
195
- *
196
- * @param {symbol} key - key of collection
197
- * @return {number}
198
- *
199
- * Return possibilities:
200
- * - `-2`: key is not valid symbol
201
- * - `-1`: key does not exist
202
- * - `>= 0`: length of cleared items in collection
203
- * */
204
101
  clearList(key) {
205
- if (typeof key !== 'symbol') {
102
+ if (typeof key !== "symbol") {
206
103
  return -2;
207
104
  }
208
105
  if (!this._listItems.has(key)) {
@@ -213,21 +110,9 @@ export class RepoCommon {
213
110
  item.clear();
214
111
  return length;
215
112
  }
216
- /**
217
- * List all list keys
218
- *
219
- * @return {Array<symbol>}
220
- * */
221
113
  listLists() {
222
114
  return Array.from(this._listItems.keys());
223
115
  }
224
- /**
225
- * Print all lists
226
- *
227
- * @return {Record} - as {key: length of collection}
228
- *
229
- * Note: if stringified symbol is duplicated, add index postfix with `#` symbol
230
- * */
231
116
  printLists() {
232
117
  const result = {};
233
118
  let index = 0;
@@ -244,38 +129,18 @@ export class RepoCommon {
244
129
  }
245
130
  return result;
246
131
  }
247
- // endregion list
248
- // region map
249
- /**
250
- * Create new map
251
- *
252
- * @param {string} name - name of collection
253
- * @param {boolean} volatile - if yes: it will be removed after lifecycle run
254
- * @return {Map<any, any>}
255
- * */
256
132
  newMap(name, volatile) {
257
133
  if (!isText(name)) {
258
- throw new DeveloperError('Invalid repository map name', testCase(FQN, 142), where);
134
+ throw new DeveloperError("Invalid repository map name", testCase(FQN, 142), where);
259
135
  }
260
136
  const item = new Map();
261
- const code = Symbol.for(name.split('#').join(''));
137
+ const code = Symbol.for(name.split("#").join(""));
262
138
  this._mapItems.set(code, item);
263
139
  if (volatile) {
264
140
  this._mapVolatiles.add(code);
265
141
  }
266
142
  return item;
267
143
  }
268
- /**
269
- * Remove map by given key
270
- *
271
- * @param {symbol} key - key of collection
272
- * @return {number}
273
- *
274
- * Return possibilities:
275
- * - `-2`: key is not valid symbol
276
- * - `-1`: key does not exist
277
- * - `>= 0`: length of removed items in collection
278
- * */
279
144
  removeMap(key) {
280
145
  const cleared = this.clearMap(key);
281
146
  if (cleared >= 0) {
@@ -286,19 +151,8 @@ export class RepoCommon {
286
151
  }
287
152
  return cleared;
288
153
  }
289
- /**
290
- * Clear map by given key
291
- *
292
- * @param {symbol} key - key of collection
293
- * @return {number}
294
- *
295
- * Return possibilities:
296
- * - `-2`: key is not valid symbol
297
- * - `-1`: key does not exist
298
- * - `>= 0`: length of cleared items in collection
299
- * */
300
154
  clearMap(key) {
301
- if (typeof key !== 'symbol') {
155
+ if (typeof key !== "symbol") {
302
156
  return -2;
303
157
  }
304
158
  if (!this._mapItems.has(key)) {
@@ -309,22 +163,9 @@ export class RepoCommon {
309
163
  item.clear();
310
164
  return length;
311
165
  }
312
- /**
313
- * List all map keys
314
- *
315
- * @return {Array<symbol>}
316
- * */
317
166
  listMaps() {
318
167
  return Array.from(this._mapItems.keys());
319
168
  }
320
- // noinspection JSUnusedGlobalSymbols
321
- /**
322
- * Print all maps
323
- *
324
- * @return {Record} - as {key: length of collection}
325
- *
326
- * Note: if stringified symbol is duplicated, add index postfix with `#` symbol
327
- * */
328
169
  printMaps() {
329
170
  const result = {};
330
171
  let index = 0;
@@ -341,39 +182,18 @@ export class RepoCommon {
341
182
  }
342
183
  return result;
343
184
  }
344
- // endregion map
345
- // region set
346
- /**
347
- * Create new set
348
- *
349
- * @param {string} name - name of collection
350
- * @param {boolean} volatile - if yes: it will be removed after lifecycle run
351
- * @return {Set<any>}
352
- * */
353
185
  newSet(name, volatile) {
354
186
  if (!isText(name)) {
355
- throw new DeveloperError('Invalid repository set name', testCase(FQN, 143), where);
187
+ throw new DeveloperError("Invalid repository set name", testCase(FQN, 143), where);
356
188
  }
357
189
  const item = new Set();
358
- const code = Symbol.for(name.split('#').join(''));
190
+ const code = Symbol.for(name.split("#").join(""));
359
191
  this._setItems.set(code, item);
360
192
  if (volatile) {
361
193
  this._setVolatiles.add(code);
362
194
  }
363
195
  return item;
364
196
  }
365
- // noinspection JSUnusedGlobalSymbols
366
- /**
367
- * Remove set by given key
368
- *
369
- * @param {symbol} key - key of collection
370
- * @return {number}
371
- *
372
- * Return possibilities:
373
- * - `-2`: key is not valid symbol
374
- * - `-1`: key does not exist
375
- * - `>= 0`: length of removed items in collection
376
- * */
377
197
  removeSet(key) {
378
198
  const cleared = this.clearSet(key);
379
199
  if (cleared >= 0) {
@@ -384,19 +204,8 @@ export class RepoCommon {
384
204
  }
385
205
  return cleared;
386
206
  }
387
- /**
388
- * Clear set by given key
389
- *
390
- * @param {symbol} key - key of collection
391
- * @return {number}
392
- *
393
- * Return possibilities:
394
- * - `-2`: key is not valid symbol
395
- * - `-1`: key does not exist
396
- * - `>= 0`: length of cleared items in collection
397
- * */
398
207
  clearSet(key) {
399
- if (typeof key !== 'symbol') {
208
+ if (typeof key !== "symbol") {
400
209
  return -2;
401
210
  }
402
211
  if (!this._setItems.has(key)) {
@@ -407,23 +216,9 @@ export class RepoCommon {
407
216
  item.clear();
408
217
  return length;
409
218
  }
410
- // noinspection JSUnusedGlobalSymbols
411
- /**
412
- * List all set keys
413
- *
414
- * @return {Array<symbol>}
415
- * */
416
219
  listSets() {
417
220
  return Array.from(this._setItems.keys());
418
221
  }
419
- // noinspection JSUnusedGlobalSymbols
420
- /**
421
- * Print all sets
422
- *
423
- * @return {Record} - as {key: length of collection}
424
- *
425
- * Note: if stringified symbol is duplicated, add index postfix with `#` symbol
426
- * */
427
222
  printSets() {
428
223
  const result = {};
429
224
  let index = 0;
@@ -440,35 +235,24 @@ export class RepoCommon {
440
235
  }
441
236
  return result;
442
237
  }
443
- // endregion set
444
- // region secure
445
238
  init() {
446
239
  const lifecycle = this.leyyo.lifecycleCommon;
447
- // clear volatile arrays
448
- lifecycle.addStage('clear', 'repo.array', () => {
449
- Array.from(this._arrayVolatiles.values())
450
- .forEach(key => this._arrayItems.delete(key));
240
+ lifecycle.addStage("clear", "repo.array", () => {
241
+ Array.from(this._arrayVolatiles.values()).forEach((key) => this._arrayItems.delete(key));
451
242
  this._arrayVolatiles.clear();
452
243
  });
453
- // clear volatile lists
454
- lifecycle.addStage('clear', 'repo.list', () => {
455
- Array.from(this._listVolatiles.values())
456
- .forEach(key => this._listItems.delete(key));
244
+ lifecycle.addStage("clear", "repo.list", () => {
245
+ Array.from(this._listVolatiles.values()).forEach((key) => this._listItems.delete(key));
457
246
  this._listVolatiles.clear();
458
247
  });
459
- // clear volatile maps
460
- lifecycle.addStage('clear', 'repo.map', () => {
461
- Array.from(this._mapVolatiles.values())
462
- .forEach(key => this._mapItems.delete(key));
248
+ lifecycle.addStage("clear", "repo.map", () => {
249
+ Array.from(this._mapVolatiles.values()).forEach((key) => this._mapItems.delete(key));
463
250
  this._mapVolatiles.clear();
464
251
  });
465
- // clear volatile sets
466
- lifecycle.addStage('clear', 'repo.set', () => {
467
- Array.from(this._setVolatiles.values())
468
- .forEach(key => this._setItems.delete(key));
252
+ lifecycle.addStage("clear", "repo.set", () => {
253
+ Array.from(this._setVolatiles.values()).forEach((key) => this._setItems.delete(key));
469
254
  this._setVolatiles.clear();
470
255
  });
471
- this.init = () => {
472
- };
256
+ this.init = () => { };
473
257
  }
474
258
  }
@@ -1,11 +1,5 @@
1
1
  export declare const VAL_FQN_ANONYMOUS = "#Fqn";
2
- /**
3
- * Normal empty values
4
- * */
5
2
  export declare const EMPTY_VALUES: any[];
6
- /**
7
- * Empty values with empty string
8
- * */
9
3
  export declare const EMPTY_VALUES_STR: Array<unknown>;
10
4
  export declare const VAL_NAME_ANONYMOUS: string;
11
5
  export declare const VAL_ERROR_UNKNOWN_NAME: string;
@@ -31,6 +25,5 @@ export declare const KEY_ENUM_I18N: unique symbol;
31
25
  export declare const KEY_LITERAL_NAME: unique symbol;
32
26
  export declare const KEY_LITERAL_ALT: unique symbol;
33
27
  export declare const KEY_LITERAL_I18N: unique symbol;
34
- export declare const KEY_DEVELOPER_MESSAGE: unique symbol;
35
28
  export declare const KEY_DEVELOPER_CASE: unique symbol;
36
29
  export declare const KEY_DEVELOPER_WHERE: unique symbol;
@@ -1,37 +1,29 @@
1
- export const VAL_FQN_ANONYMOUS = '#Fqn';
2
- /**
3
- * Normal empty values
4
- * */
1
+ export const VAL_FQN_ANONYMOUS = "#Fqn";
5
2
  export const EMPTY_VALUES = [null, undefined];
6
- // noinspection JSUnusedGlobalSymbols
7
- /**
8
- * Empty values with empty string
9
- * */
10
- export const EMPTY_VALUES_STR = [null, undefined, ''];
11
- export const VAL_NAME_ANONYMOUS = '~';
12
- export const VAL_ERROR_UNKNOWN_NAME = 'UnknownError';
13
- export const VAL_ERROR_UNKNOWN_MESSAGE = 'Unknown error';
14
- export const KEY_FQN_NAME = Symbol.for('leyyo:fqn:basic');
15
- export const KEY_FQN_ON_SET = Symbol.for('leyyo:fqn:on-set');
16
- export const KEY_LEYYO_SECURE = Symbol.for('leyyo:secure');
17
- export const KEY_ERROR_HTTP_STATUS = Symbol.for('leyyo:error:http-status');
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_RAISED = Symbol.for('leyyo:error:raised');
22
- export const KEY_ERROR_EMITTED = Symbol.for('leyyo:error:emitted');
23
- export const KEY_ERROR_FLAGS = Symbol.for('leyyo:error:flags');
24
- export const KEY_ERROR_WHERE = Symbol.for('leyyo:error:where');
25
- export const KEY_LOADER_NAME = Symbol.for('leyyo:loader:name');
26
- export const KEY_LOADER_STAMP = Symbol.for('leyyo:loader:stamp');
27
- export const KEY_LOADER_EMPTY = Symbol.for('leyyo:loader:empty');
28
- export const KEY_LOG_ALREADY = Symbol.for('leyyo:log:already');
29
- export const KEY_ENUM_NAME = Symbol.for('leyyo:enum:name');
30
- export const KEY_ENUM_ALT = Symbol.for('leyyo:enum:alt');
31
- export const KEY_ENUM_I18N = Symbol.for('leyyo:enum:i18n');
32
- export const KEY_LITERAL_NAME = Symbol.for('leyyo:literal:name');
33
- export const KEY_LITERAL_ALT = Symbol.for('leyyo:literal:alt');
34
- export const KEY_LITERAL_I18N = Symbol.for('leyyo:literal:i18n');
35
- export const KEY_DEVELOPER_MESSAGE = Symbol.for('leyyo:developer:message');
36
- export const KEY_DEVELOPER_CASE = Symbol.for('leyyo:developer:case');
37
- export const KEY_DEVELOPER_WHERE = Symbol.for('leyyo:developer:where');
3
+ export const EMPTY_VALUES_STR = [null, undefined, ""];
4
+ export const VAL_NAME_ANONYMOUS = "~";
5
+ export const VAL_ERROR_UNKNOWN_NAME = "UnknownError";
6
+ export const VAL_ERROR_UNKNOWN_MESSAGE = "Unknown error";
7
+ export const KEY_FQN_NAME = Symbol.for("leyyo:fqn:basic");
8
+ export const KEY_FQN_ON_SET = Symbol.for("leyyo:fqn:on-set");
9
+ export const KEY_LEYYO_SECURE = Symbol.for("leyyo:secure");
10
+ export const KEY_ERROR_HTTP_STATUS = Symbol.for("leyyo:error:http-status");
11
+ export const KEY_ERROR_DEFAULT_MESSAGE = Symbol.for("leyyo:error:message");
12
+ export const KEY_ERROR_I18N = Symbol.for("leyyo:error:i18n");
13
+ export const KEY_ERROR_EMIT = Symbol.for("leyyo:error:emit");
14
+ export const KEY_ERROR_RAISED = Symbol.for("leyyo:error:raised");
15
+ export const KEY_ERROR_EMITTED = Symbol.for("leyyo:error:emitted");
16
+ export const KEY_ERROR_FLAGS = Symbol.for("leyyo:error:flags");
17
+ export const KEY_ERROR_WHERE = Symbol.for("leyyo:error:where");
18
+ export const KEY_LOADER_NAME = Symbol.for("leyyo:loader:name");
19
+ export const KEY_LOADER_STAMP = Symbol.for("leyyo:loader:stamp");
20
+ export const KEY_LOADER_EMPTY = Symbol.for("leyyo:loader:empty");
21
+ export const KEY_LOG_ALREADY = Symbol.for("leyyo:log:already");
22
+ export const KEY_ENUM_NAME = Symbol.for("leyyo:enum:name");
23
+ export const KEY_ENUM_ALT = Symbol.for("leyyo:enum:alt");
24
+ export const KEY_ENUM_I18N = Symbol.for("leyyo:enum:i18n");
25
+ export const KEY_LITERAL_NAME = Symbol.for("leyyo:literal:name");
26
+ export const KEY_LITERAL_ALT = Symbol.for("leyyo:literal:alt");
27
+ export const KEY_LITERAL_I18N = Symbol.for("leyyo:literal:i18n");
28
+ export const KEY_DEVELOPER_CASE = Symbol.for("leyyo:developer:case");
29
+ export const KEY_DEVELOPER_WHERE = Symbol.for("leyyo:developer:where");
@@ -1 +1 @@
1
- export * from './log-level.js';
1
+ export * from "./log-level.js";
@@ -1 +1 @@
1
- export * from './log-level.js';
1
+ export * from "./log-level.js";
@@ -1,7 +1,4 @@
1
1
  declare const literals: readonly ["debug", "trace", "info", "warn", "error", "fatal"];
2
- /**
3
- * Log Level
4
- * */
5
- export type LogLevel = typeof literals[number];
2
+ export type LogLevel = (typeof literals)[number];
6
3
  export declare const LogLevelItems: ReadonlyArray<LogLevel>;
7
4
  export {};
@@ -1,2 +1,2 @@
1
- const literals = ['debug', 'trace', 'info', 'warn', 'error', 'fatal'];
1
+ const literals = ["debug", "trace", "info", "warn", "error", "fatal"];
2
2
  export const LogLevelItems = literals;
@@ -1,15 +1,5 @@
1
1
  import { LeyyoError } from "./leyyo.error.js";
2
2
  import { Opt } from "../function/index.js";
3
- /**
4
- * Caused error
5
- * */
6
3
  export declare class CausedError extends LeyyoError {
7
- /**
8
- * Cast a native error to caused error
9
- *
10
- * @param {Error} e - native error instance
11
- * @param {Opt?} params - params for error
12
- * @return {CausedError} - new caused error instance
13
- * */
14
4
  static of(e: Error, params?: Opt): CausedError;
15
5
  }
@@ -1,15 +1,5 @@
1
1
  import { LeyyoError } from "./leyyo.error.js";
2
- /**
3
- * Caused error
4
- * */
5
2
  export class CausedError extends LeyyoError {
6
- /**
7
- * Cast a native error to caused error
8
- *
9
- * @param {Error} e - native error instance
10
- * @param {Opt?} params - params for error
11
- * @return {CausedError} - new caused error instance
12
- * */
13
3
  static of(e, params) {
14
4
  const err = new CausedError(e.message, params);
15
5
  err.causedBy = e;
@@ -1,20 +1,11 @@
1
- import { KEY_DEVELOPER_CASE, KEY_DEVELOPER_MESSAGE, KEY_DEVELOPER_WHERE, KEY_LEYYO_SECURE } from "../const/index.js";
1
+ import { KEY_DEVELOPER_CASE, KEY_DEVELOPER_WHERE, KEY_LEYYO_SECURE } from "../const/index.js";
2
2
  import { LeyyoLike } from "../base/index.js";
3
3
  import { DeveloperErrorLike, ErrorStackLine } from "./index.types.js";
4
- /** Developer error */
5
4
  export declare class DeveloperError extends Error implements DeveloperErrorLike {
6
- protected [KEY_DEVELOPER_MESSAGE]: string;
7
5
  protected [KEY_DEVELOPER_CASE]: string;
8
6
  protected [KEY_DEVELOPER_WHERE]: string;
9
- /** @inheritDoc */
10
7
  stackTrace?: Array<ErrorStackLine>;
11
- /**
12
- * @param {string} message - error message
13
- * @param {string} issue - test case
14
- * @param {string} where - where
15
- * */
16
8
  constructor(message: string, issue?: string, where?: string);
17
9
  static [KEY_LEYYO_SECURE](leyyo: LeyyoLike): void;
18
- /** @inheritDoc */
19
10
  log(err?: Error): void;
20
11
  }
@@ -1,34 +1,16 @@
1
- import { KEY_DEVELOPER_CASE, KEY_DEVELOPER_MESSAGE, KEY_DEVELOPER_WHERE, KEY_LEYYO_SECURE } from "../const/index.js";
2
- // region properties
1
+ import { KEY_DEVELOPER_CASE, KEY_DEVELOPER_WHERE, KEY_LEYYO_SECURE } from "../const/index.js";
3
2
  let _leyyo;
4
- // endregion properties
5
- /** Developer error */
6
3
  export class DeveloperError extends Error {
7
- [KEY_DEVELOPER_MESSAGE];
8
4
  [KEY_DEVELOPER_CASE];
9
5
  [KEY_DEVELOPER_WHERE];
10
- /** @inheritDoc */
11
6
  stackTrace;
12
- /**
13
- * @param {string} message - error message
14
- * @param {string} issue - test case
15
- * @param {string} where - where
16
- * */
17
7
  constructor(message, issue, where) {
18
- message = message ?? 'Developer error';
19
- const pureMessage = message;
20
- if (typeof issue === 'string') {
21
- message += ` [case:${issue}]`;
22
- }
23
- if (typeof where === 'string') {
24
- message += ` [w:${where}]`;
25
- }
8
+ message = message ?? "Developer error";
26
9
  super(message);
27
- this[KEY_DEVELOPER_MESSAGE] = pureMessage;
28
- if (typeof issue === 'string') {
10
+ if (typeof issue === "string") {
29
11
  this[KEY_DEVELOPER_CASE] = issue;
30
12
  }
31
- if (typeof where === 'string') {
13
+ if (typeof where === "string") {
32
14
  this[KEY_DEVELOPER_WHERE] = where;
33
15
  }
34
16
  _leyyo.errorCommon.buildStack(this);
@@ -38,11 +20,10 @@ export class DeveloperError extends Error {
38
20
  _leyyo = leyyo;
39
21
  }
40
22
  }
41
- /** @inheritDoc */
42
23
  log(err) {
43
24
  if (err instanceof Error) {
44
- this['causedBy'] = err;
25
+ this["causedBy"] = err;
45
26
  }
46
- _leyyo.logCommon.emitLog('fatal', this[KEY_DEVELOPER_WHERE], this, _leyyo.errorCommon.toJsonBasic(this, { testCase: this[KEY_DEVELOPER_CASE] }));
27
+ _leyyo.logCommon.emitLog("fatal", this[KEY_DEVELOPER_WHERE], this, _leyyo.errorCommon.toJsonBasic(this, { testCase: this[KEY_DEVELOPER_CASE] }));
47
28
  }
48
29
  }
@@ -1,21 +1,8 @@
1
1
  import { LeyyoError } from "./leyyo.error.js";
2
2
  import { Opt } from "../function/index.js";
3
- /**
4
- * Http error
5
- * */
6
3
  export declare class HttpError extends LeyyoError {
7
4
  status: number;
8
- /**
9
- * @param {string} message - error message
10
- * */
11
5
  constructor(message: string);
12
- /**
13
- * @param {Opt} params - error parameters
14
- * */
15
6
  constructor(params: Opt);
16
- /**
17
- * @param {string} message - error message
18
- * @param {Opt} params - error parameters
19
- * */
20
7
  constructor(message: string, params: Opt);
21
8
  }