@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,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onFqnSet = onFqnSet;
4
- const const_1 = require("../const");
5
- function onFqnSet(target, callback) {
1
+ import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_FQN_ON_SET, KEY_LITERAL_NAME } from "../const/index.js";
2
+ export function onFqnSet(target, callback) {
6
3
  if (!target) {
7
4
  return false;
8
5
  }
@@ -14,12 +11,12 @@ function onFqnSet(target, callback) {
14
11
  }
15
12
  else if (typeof target === 'object') {
16
13
  if (Array.isArray(target)) {
17
- if (target[const_1.KEY_LITERAL_NAME]) {
14
+ if (target[KEY_LITERAL_NAME]) {
18
15
  return _item(target, callback);
19
16
  }
20
17
  return false;
21
18
  }
22
- if (target[const_1.KEY_ENUM_NAME]) {
19
+ if (target[KEY_ENUM_NAME]) {
23
20
  return _item(target, callback);
24
21
  }
25
22
  return target.constructor !== Object ? onFqnSet(target.constructor, callback) : false;
@@ -27,14 +24,13 @@ function onFqnSet(target, callback) {
27
24
  return false;
28
25
  }
29
26
  function _item(target, callback) {
30
- if (target[const_1.KEY_FQN_NAME]) {
31
- callback(target[const_1.KEY_FQN_NAME]);
27
+ if (target[KEY_FQN_NAME]) {
28
+ callback(target[KEY_FQN_NAME]);
32
29
  return true;
33
30
  }
34
- if (!target[const_1.KEY_FQN_ON_SET]) {
35
- target[const_1.KEY_FQN_ON_SET] = [];
31
+ if (!target[KEY_FQN_ON_SET]) {
32
+ target[KEY_FQN_ON_SET] = [];
36
33
  }
37
- target[const_1.KEY_FQN_ON_SET].push(callback);
34
+ target[KEY_FQN_ON_SET].push(callback);
38
35
  return false;
39
36
  }
40
- //# sourceMappingURL=on-fqn-set.js.map
@@ -1,4 +1,4 @@
1
- import { OneOrMore } from "../base";
1
+ import { OneOrMore } from "../base/index.js";
2
2
  /**
3
3
  * Return array value from one or more type
4
4
  *
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oneOrMore = oneOrMore;
4
1
  // noinspection JSUnusedGlobalSymbols
5
2
  /**
6
3
  * Return array value from one or more type
@@ -8,7 +5,7 @@ exports.oneOrMore = oneOrMore;
8
5
  * @param {OneOrMore} value - it can be one value or array value
9
6
  * @return {Array}
10
7
  * */
11
- function oneOrMore(value) {
8
+ export function oneOrMore(value) {
12
9
  if (Array.isArray(value)) {
13
10
  return value;
14
11
  }
@@ -17,4 +14,3 @@ function oneOrMore(value) {
17
14
  }
18
15
  return [value];
19
16
  }
20
- //# sourceMappingURL=one-or-more.js.map
@@ -0,0 +1,10 @@
1
+ import { Opt } from "./index.types.js";
2
+ /**
3
+ * Add key=value into options
4
+ *
5
+ * @param {Opt} options - source options
6
+ * @param {string} key - key
7
+ * @param {any} value - value
8
+ * @return {Opt} - added options
9
+ * */
10
+ export declare function optAdd<O extends Opt = Opt>(options: O | Opt, key: keyof O | string, value: unknown): O;
@@ -0,0 +1,29 @@
1
+ import { optField } from "./opt-field.js";
2
+ import { isObj } from "./is-obj.js";
3
+ /**
4
+ * Add key=value into options
5
+ *
6
+ * @param {Opt} options - source options
7
+ * @param {string} key - key
8
+ * @param {any} value - value
9
+ * @return {Opt} - added options
10
+ * */
11
+ export function optAdd(options, key, value) {
12
+ const o = (isObj(options) ? options : {});
13
+ if (value === undefined || typeof key !== 'string') {
14
+ return o;
15
+ }
16
+ if (key === 'field') {
17
+ return optField(o, value);
18
+ }
19
+ if (o[key] === undefined) {
20
+ o[key] = value;
21
+ }
22
+ else if (o[key] instanceof Set) {
23
+ o[key].add(value);
24
+ }
25
+ else {
26
+ o[key] = new Set([o[key], value]);
27
+ }
28
+ return o;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { Opt } from "./index.types.js";
2
+ /**
3
+ * Merge two options
4
+ *
5
+ * @param {Opt} options - source options
6
+ * @param {Opt} appended - appended options
7
+ * @return {Opt} - merged options
8
+ * */
9
+ export declare function optAppend<O extends Opt = Opt>(options: O | Opt, appended: O | Opt): O;
@@ -0,0 +1,24 @@
1
+ import { isObj } from "./is-obj.js";
2
+ import { optAdd } from "./opt-add.js";
3
+ /**
4
+ * Merge two options
5
+ *
6
+ * @param {Opt} options - source options
7
+ * @param {Opt} appended - appended options
8
+ * @return {Opt} - merged options
9
+ * */
10
+ export function optAppend(options, appended) {
11
+ const o = (isObj(options) ? options : {});
12
+ if (!isObj(appended)) {
13
+ return o;
14
+ }
15
+ for (const [k, v] of Object.entries(appended)) {
16
+ if (o[k] === undefined) {
17
+ o[k] = v;
18
+ }
19
+ else {
20
+ optAdd(o, k, v);
21
+ }
22
+ }
23
+ return o;
24
+ }
@@ -0,0 +1,8 @@
1
+ import { Opt, OptFn } from "./index.types.js";
2
+ /**
3
+ * Check option, if it's invalid, create empty options
4
+ *
5
+ * @param {(Opt|OptFn)} options - options or options callback
6
+ * @return {Opt} - checked options
7
+ * */
8
+ export declare function optCheck<O extends Opt = Opt>(options: O | OptFn<O> | Opt): O;
@@ -0,0 +1,31 @@
1
+ // noinspection JSUnusedGlobalSymbols
2
+ import { $$get_leyyo_fn } from "./leyyo-fn.js";
3
+ import { isObj } from "./is-obj.js";
4
+ import { FQN } from "../internal.js";
5
+ let _leyyo;
6
+ const where = `${FQN}.optCheck`;
7
+ /**
8
+ * Check option, if it's invalid, create empty options
9
+ *
10
+ * @param {(Opt|OptFn)} options - options or options callback
11
+ * @return {Opt} - checked options
12
+ * */
13
+ export function optCheck(options) {
14
+ let o = options;
15
+ if (typeof options === 'function') {
16
+ try {
17
+ o = options();
18
+ }
19
+ catch (e) {
20
+ o = {};
21
+ if (!_leyyo) {
22
+ _leyyo = $$get_leyyo_fn();
23
+ }
24
+ new _leyyo.developerError('Raised callback run', 'optCheck#01', where).log(e);
25
+ }
26
+ }
27
+ else if (!isObj(options)) {
28
+ o = {};
29
+ }
30
+ return o;
31
+ }
@@ -0,0 +1,8 @@
1
+ import { Opt } from "./index.types.js";
2
+ /**
3
+ * Clone existing option
4
+ *
5
+ * @param {Opt} options - source options
6
+ * @return {Opt} - cloned options
7
+ * */
8
+ export declare function optClone<O extends Opt = Opt>(options: O | Opt): O;
@@ -0,0 +1,12 @@
1
+ // noinspection JSUnusedGlobalSymbols
2
+ import { isObj } from "./is-obj.js";
3
+ import { secureClone } from "./secure-clone.js";
4
+ /**
5
+ * Clone existing option
6
+ *
7
+ * @param {Opt} options - source options
8
+ * @return {Opt} - cloned options
9
+ * */
10
+ export function optClone(options) {
11
+ return (isObj(options) ? secureClone(options) : {});
12
+ }
@@ -0,0 +1,11 @@
1
+ import { Opt } from "./index.types.js";
2
+ import { KeyValue } from "../base/index.js";
3
+ /**
4
+ * Add field into options
5
+ * Note: field could not be multiple in option
6
+ *
7
+ * @param {Opt} options - source options
8
+ * @param {KeyValue} field - value
9
+ * @return {Opt} - added options
10
+ * */
11
+ export declare function optField<O extends Opt = Opt>(options: O | Opt, field: KeyValue): O;
@@ -0,0 +1,31 @@
1
+ import { isObj } from "./is-obj.js";
2
+ /**
3
+ * Add field into options
4
+ * Note: field could not be multiple in option
5
+ *
6
+ * @param {Opt} options - source options
7
+ * @param {KeyValue} field - value
8
+ * @return {Opt} - added options
9
+ * */
10
+ export function optField(options, field) {
11
+ const o = (isObj(options) ? options : {});
12
+ const t = typeof field;
13
+ if (!['string', 'number'].includes(t)) {
14
+ return o;
15
+ }
16
+ if (o.field !== undefined) {
17
+ if (typeof o.field !== 'string') {
18
+ o.field = '';
19
+ }
20
+ }
21
+ else {
22
+ o.field = '';
23
+ }
24
+ if (!o.field) {
25
+ o.field = (t === 'string') ? field : `$.[${field}]`;
26
+ }
27
+ else {
28
+ o.field += (t === 'string') ? `.${field}` : `[${field}]`;
29
+ }
30
+ return o;
31
+ }
@@ -0,0 +1,8 @@
1
+ import { Opt } from "./index.types.js";
2
+ /**
3
+ * It's used to easy arrow function usage for lazy evaluation of options
4
+ *
5
+ * @param {Opt} options - options
6
+ * @return {Opt} - options
7
+ * */
8
+ export declare function optFn<O extends Opt = Opt>(options: O | Opt): O;
@@ -0,0 +1,11 @@
1
+ import { isObj } from "./is-obj.js";
2
+ // noinspection JSUnusedGlobalSymbols
3
+ /**
4
+ * It's used to easy arrow function usage for lazy evaluation of options
5
+ *
6
+ * @param {Opt} options - options
7
+ * @return {Opt} - options
8
+ * */
9
+ export function optFn(options) {
10
+ return (isObj(options) ? options : {});
11
+ }
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomTestNo = randomTestNo;
4
1
  /**
5
2
  * Generate random test no
6
3
  *
7
4
  * @return {string}
8
5
  * */
9
- function randomTestNo() {
6
+ export function randomTestNo() {
10
7
  return (Math.floor(Math.random() * 999) + 100).toString(10);
11
8
  }
12
- //# sourceMappingURL=random-test-no.js.map
@@ -1,4 +1,4 @@
1
- import { FqnTarget } from "./index.types";
1
+ import { FqnTarget } from "./index.types.js";
2
2
  /**
3
3
  * Remove fqn name
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeFqn = removeFqn;
4
- const const_1 = require("../const");
5
- const trigger_fqn_1 = require("./trigger-fqn");
1
+ import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
2
+ import { triggerFqn } from "./trigger-fqn.js";
6
3
  /**
7
4
  * Remove fqn name
8
5
  *
@@ -11,7 +8,7 @@ const trigger_fqn_1 = require("./trigger-fqn");
11
8
  *
12
9
  * Note: if it returns `undefined`, means that it could not find valid target
13
10
  * */
14
- function removeFqn(target) {
11
+ export function removeFqn(target) {
15
12
  if (!target) {
16
13
  return false;
17
14
  }
@@ -20,13 +17,13 @@ function removeFqn(target) {
20
17
  }
21
18
  else if (typeof target === 'object') {
22
19
  if (Array.isArray(target)) {
23
- if (target[const_1.KEY_LITERAL_NAME]) {
24
- return _item(target, target[const_1.KEY_LITERAL_NAME]);
20
+ if (target[KEY_LITERAL_NAME]) {
21
+ return _item(target, target[KEY_LITERAL_NAME]);
25
22
  }
26
23
  return false; // normal array
27
24
  }
28
- if (target[const_1.KEY_ENUM_NAME]) {
29
- return _item(target, target[const_1.KEY_ENUM_NAME]);
25
+ if (target[KEY_ENUM_NAME]) {
26
+ return _item(target, target[KEY_ENUM_NAME]);
30
27
  }
31
28
  // instance
32
29
  return false;
@@ -34,11 +31,10 @@ function removeFqn(target) {
34
31
  return false;
35
32
  }
36
33
  function _item(target, name) {
37
- if (target[const_1.KEY_FQN_NAME]) {
38
- delete target[const_1.KEY_FQN_NAME];
39
- (0, trigger_fqn_1.triggerFqn)(target, name);
34
+ if (target[KEY_FQN_NAME]) {
35
+ delete target[KEY_FQN_NAME];
36
+ triggerFqn(target, name);
40
37
  return true;
41
38
  }
42
39
  return false;
43
40
  }
44
- //# sourceMappingURL=remove-fqn.js.map
@@ -1,4 +1,4 @@
1
- import { ExporterData } from "./index.types";
1
+ import { ExporterData } from "./index.types.js";
2
2
  /**
3
3
  * Run exporter
4
4
  *
@@ -1,16 +1,4 @@
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.runExporter = runExporter;
13
- const leyyo_fn_1 = require("./leyyo-fn");
1
+ import { $$get_leyyo_fn } from "./leyyo-fn.js";
14
2
  let _leyyo;
15
3
  // noinspection JSUnusedGlobalSymbols
16
4
  /**
@@ -18,20 +6,18 @@ let _leyyo;
18
6
  *
19
7
  * @return {Promise<ExporterData>}
20
8
  * */
21
- function runExporter() {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const data = {};
24
- const depot = {
25
- add(name, value) {
26
- append(data, name, value, 0);
27
- }
28
- };
29
- if (!_leyyo) {
30
- _leyyo = (0, leyyo_fn_1.$$get_leyyo_fn)();
9
+ export async function runExporter() {
10
+ const data = {};
11
+ const depot = {
12
+ add(name, value) {
13
+ append(data, name, value, 0);
31
14
  }
32
- yield _leyyo.lifecycleCommon.runStage('print', depot);
33
- return data;
34
- });
15
+ };
16
+ if (!_leyyo) {
17
+ _leyyo = $$get_leyyo_fn();
18
+ }
19
+ await _leyyo.lifecycleCommon.runStage('print', depot);
20
+ return data;
35
21
  }
36
22
  /**
37
23
  * Append to exporter with preventing overridden keys
@@ -50,4 +36,3 @@ const append = (data, name, value, duplicated) => {
50
36
  append(data, name, value, duplicated + 1);
51
37
  }
52
38
  };
53
- //# sourceMappingURL=run-exporter.js.map
@@ -1,3 +1,3 @@
1
- import { Obj } from "../base";
1
+ import { Obj } from "../base/index.js";
2
2
  export declare function _secureClone<T>(value: T, weakSet: WeakSet<Obj>): T;
3
3
  export declare function secureClone<T>(value: T): T;
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._secureClone = _secureClone;
4
- exports.secureClone = secureClone;
5
- function _secureClone(value, weakSet) {
1
+ export function _secureClone(value, weakSet) {
6
2
  if (value === undefined || value === null) {
7
3
  return value;
8
4
  }
@@ -32,7 +28,6 @@ function _secureClone(value, weakSet) {
32
28
  }
33
29
  return newObj;
34
30
  }
35
- function secureClone(value) {
31
+ export function secureClone(value) {
36
32
  return _secureClone(value, new WeakSet());
37
33
  }
38
- //# sourceMappingURL=secure-clone.js.map
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.secureObject = secureObject;
4
- exports.secureJson = secureJson;
5
1
  /**
6
2
  * Inner secure json function, it will be used after creating weak set
7
3
  *
@@ -10,17 +6,16 @@ exports.secureJson = secureJson;
10
6
  * @param {WeakSet} set
11
7
  * */
12
8
  function _secureObject(value, depth, set) {
13
- var _a, _b, _c;
14
9
  if ([null, undefined].includes(value)) {
15
10
  return value;
16
11
  }
17
12
  switch (typeof value) {
18
13
  case 'object':
19
14
  if (set.has(value)) {
20
- return `#circular <${(_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name}>`;
15
+ return `#circular <${value?.constructor?.name}>`;
21
16
  }
22
17
  if (depth >= 10) {
23
- return `#depth <${(_b = value === null || value === void 0 ? void 0 : value.constructor) === null || _b === void 0 ? void 0 : _b.name}>`;
18
+ return `#depth <${value?.constructor?.name}>`;
24
19
  }
25
20
  set.add(value);
26
21
  if (Array.isArray(value)) {
@@ -37,7 +32,7 @@ function _secureObject(value, depth, set) {
37
32
  }
38
33
  }
39
34
  }
40
- else if ((value === null || value === void 0 ? void 0 : value.constructor) === Object) {
35
+ else if (value?.constructor === Object) {
41
36
  for (const [k, v] of Object.entries(value)) {
42
37
  if (typeof k === 'string') {
43
38
  obj[k] = _secureObject(v, depth + 1, set);
@@ -57,7 +52,7 @@ function _secureObject(value, depth, set) {
57
52
  return JSON.parse(JSON.stringify(value));
58
53
  }
59
54
  catch (e) {
60
- return `#parse <${(_c = value === null || value === void 0 ? void 0 : value.constructor) === null || _c === void 0 ? void 0 : _c.name}>`;
55
+ return `#parse <${value?.constructor?.name}>`;
61
56
  }
62
57
  }
63
58
  }
@@ -86,7 +81,7 @@ function _secureObject(value, depth, set) {
86
81
  * @param {any} value
87
82
  * @return {any}
88
83
  * */
89
- function secureObject(value) {
84
+ export function secureObject(value) {
90
85
  try {
91
86
  return _secureObject(value, 0, new WeakSet());
92
87
  }
@@ -114,7 +109,7 @@ function secureObject(value) {
114
109
  * @param {any} value
115
110
  * @return {string}
116
111
  * */
117
- function secureJson(value) {
112
+ export function secureJson(value) {
118
113
  try {
119
114
  const json = _secureObject(value, 0, new WeakSet());
120
115
  return (typeof json === 'string') ? json : JSON.stringify(json);
@@ -123,4 +118,3 @@ function secureJson(value) {
123
118
  return `#error <${e.name}> (message: ${e.message})`;
124
119
  }
125
120
  }
126
- //# sourceMappingURL=secure-json.js.map
@@ -1,2 +1,2 @@
1
- import { FqnTarget } from "./index.types";
1
+ import { FqnTarget } from "./index.types.js";
2
2
  export declare function setAnonymousFqn(target: FqnTarget): string;
@@ -1,30 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setAnonymousFqn = setAnonymousFqn;
4
- const const_1 = require("../const");
5
- const trigger_fqn_1 = require("./trigger-fqn");
6
- const set_anonymous_name_1 = require("./set-anonymous-name");
7
- const is_fn_1 = require("./is.fn");
1
+ import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME, VAL_FQN_ANONYMOUS } from "../const/index.js";
2
+ import { triggerFqn } from "./trigger-fqn.js";
3
+ import { setAnonymousName } from "./set-anonymous-name.js";
4
+ import { isClass } from "./is-class.js";
8
5
  let _count = 0;
9
- function setAnonymousFqn(target) {
6
+ export function setAnonymousFqn(target) {
10
7
  if (!target) {
11
8
  return undefined;
12
9
  }
13
10
  if (typeof target === 'function') { // function, class
14
11
  if (!target.name) {
15
- (0, set_anonymous_name_1.setAnonymousName)(target, (0, is_fn_1.isClass)(target) ? 'Class' : 'function');
12
+ setAnonymousName(target, isClass(target) ? 'Class' : 'function');
16
13
  }
17
14
  return _item(target, target.name);
18
15
  }
19
16
  else if (typeof target === 'object') {
20
17
  if (Array.isArray(target)) {
21
- if (target[const_1.KEY_LITERAL_NAME]) {
22
- return _item(target, target[const_1.KEY_LITERAL_NAME]);
18
+ if (target[KEY_LITERAL_NAME]) {
19
+ return _item(target, target[KEY_LITERAL_NAME]);
23
20
  }
24
21
  return undefined;
25
22
  }
26
- if (target[const_1.KEY_ENUM_NAME]) {
27
- return _item(target, target[const_1.KEY_ENUM_NAME]);
23
+ if (target[KEY_ENUM_NAME]) {
24
+ return _item(target, target[KEY_ENUM_NAME]);
28
25
  }
29
26
  // instance
30
27
  return undefined;
@@ -32,13 +29,12 @@ function setAnonymousFqn(target) {
32
29
  return undefined;
33
30
  }
34
31
  function _item(target, name) {
35
- if (!target[const_1.KEY_FQN_NAME]) {
32
+ if (!target[KEY_FQN_NAME]) {
36
33
  _count++;
37
- const full = `${const_1.VAL_FQN_ANONYMOUS}#${_count}.${name}`;
38
- target[const_1.KEY_FQN_NAME] = full;
39
- (0, trigger_fqn_1.triggerFqn)(target, full);
34
+ const full = `${VAL_FQN_ANONYMOUS}#${_count}.${name}`;
35
+ target[KEY_FQN_NAME] = full;
36
+ triggerFqn(target, full);
40
37
  return full;
41
38
  }
42
- return target[const_1.KEY_FQN_NAME];
39
+ return target[KEY_FQN_NAME];
43
40
  }
44
- //# sourceMappingURL=set-anonymous-fqn.js.map
@@ -1,2 +1,2 @@
1
- import { ClassLike, Fnc } from "../base";
1
+ import { ClassLike, Fnc } from "../base/index.js";
2
2
  export declare function setAnonymousName(target: Fnc | ClassLike, prefix?: string): string;