@leyyo/common 1.3.7 → 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.
- package/dist/base/index.d.ts +3 -3
- package/dist/base/index.js +3 -20
- package/dist/base/index.types.d.ts +32 -18
- package/dist/base/index.types.js +1 -3
- package/dist/base/leyyo.d.ts +1 -1
- package/dist/base/leyyo.js +35 -26
- package/dist/base/leyyo.types.d.ts +3 -3
- package/dist/base/leyyo.types.js +1 -3
- package/dist/class/index.d.ts +2 -2
- package/dist/class/index.js +2 -19
- package/dist/class/index.types.d.ts +1 -1
- package/dist/class/index.types.js +1 -3
- package/dist/class/list.d.ts +1 -1
- package/dist/class/list.js +1 -6
- package/dist/class/logger.instance.d.ts +5 -5
- package/dist/class/logger.instance.js +8 -12
- package/dist/common/deploy.common.d.ts +2 -2
- package/dist/common/deploy.common.js +14 -16
- package/dist/common/enum.pool.d.ts +5 -3
- package/dist/common/enum.pool.js +36 -48
- package/dist/common/error.common.d.ts +4 -4
- package/dist/common/error.common.js +45 -85
- package/dist/common/error.pool.d.ts +5 -3
- package/dist/common/error.pool.js +12 -23
- package/dist/common/event.common.d.ts +2 -2
- package/dist/common/event.common.js +25 -28
- package/dist/common/index.d.ts +11 -11
- package/dist/common/index.js +11 -28
- package/dist/common/index.types.d.ts +42 -6
- package/dist/common/index.types.js +1 -3
- package/dist/common/inert.d.ts +4 -2
- package/dist/common/inert.js +97 -110
- package/dist/common/lifecycle.common.d.ts +2 -2
- package/dist/common/lifecycle.common.js +48 -61
- package/dist/common/literal.pool.d.ts +6 -3
- package/dist/common/literal.pool.js +37 -48
- package/dist/common/log.common.d.ts +4 -4
- package/dist/common/log.common.js +63 -60
- package/dist/common/repo.common.d.ts +3 -3
- package/dist/common/repo.common.js +50 -52
- package/dist/const/index.js +26 -30
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -18
- package/dist/enum/log-level.js +1 -5
- package/dist/error/caused.error.d.ts +2 -2
- package/dist/error/caused.error.js +2 -7
- package/dist/error/developer.error.d.ts +3 -3
- package/dist/error/developer.error.js +9 -9
- package/dist/error/http.error.d.ts +2 -2
- package/dist/error/http.error.js +9 -15
- package/dist/error/index.d.ts +7 -7
- package/dist/error/index.js +7 -24
- package/dist/error/index.types.d.ts +3 -3
- package/dist/error/index.types.js +1 -3
- package/dist/error/invalid-value.error.d.ts +1 -1
- package/dist/error/invalid-value.error.js +6 -13
- package/dist/error/leyyo.error.d.ts +5 -5
- package/dist/error/leyyo.error.js +45 -34
- package/dist/error/multiple.error.d.ts +2 -2
- package/dist/error/multiple.error.js +6 -12
- package/dist/function/define-loader.d.ts +1 -1
- package/dist/function/define-loader.js +7 -10
- package/dist/function/delay.js +2 -6
- package/dist/function/delete-prop.js +9 -15
- package/dist/function/{empty.fn.js → empty-fn.js} +1 -5
- package/dist/function/extended-type.d.ts +1 -1
- package/dist/function/extended-type.js +8 -12
- package/dist/function/get-fqn.d.ts +1 -1
- package/dist/function/get-fqn.js +7 -12
- package/dist/function/get-prop.js +10 -16
- package/dist/function/has-fqn.d.ts +1 -1
- package/dist/function/has-fqn.js +7 -11
- package/dist/function/index.d.ts +38 -28
- package/dist/function/index.js +38 -45
- package/dist/function/index.types.d.ts +2 -2
- package/dist/function/index.types.js +1 -3
- package/dist/function/is-anonymous-name.js +3 -7
- package/dist/function/is-class.d.ts +7 -0
- package/dist/function/is-class.js +18 -0
- package/dist/function/is-empty.d.ts +12 -0
- package/dist/function/is-empty.js +18 -0
- package/dist/function/is-filled-arr.d.ts +10 -0
- package/dist/function/is-filled-arr.js +12 -0
- package/dist/function/is-filled-obj.d.ts +10 -0
- package/dist/function/is-filled-obj.js +13 -0
- package/dist/function/is-obj.d.ts +9 -0
- package/dist/function/is-obj.js +11 -0
- package/dist/function/is-test.js +2 -7
- package/dist/function/is-text.d.ts +11 -0
- package/dist/function/is-text.js +17 -0
- package/dist/function/jitter-interval.js +2 -6
- package/dist/function/leyyo-fn.d.ts +1 -1
- package/dist/function/leyyo-fn.js +2 -7
- package/dist/function/on-fqn-set.d.ts +1 -1
- package/dist/function/on-fqn-set.js +9 -13
- package/dist/function/one-or-more.d.ts +1 -1
- package/dist/function/one-or-more.js +1 -5
- package/dist/function/opt-add.d.ts +10 -0
- package/dist/function/opt-add.js +29 -0
- package/dist/function/opt-append.d.ts +9 -0
- package/dist/function/opt-append.js +24 -0
- package/dist/function/opt-check.d.ts +8 -0
- package/dist/function/opt-check.js +31 -0
- package/dist/function/opt-clone.d.ts +8 -0
- package/dist/function/opt-clone.js +12 -0
- package/dist/function/opt-field.d.ts +11 -0
- package/dist/function/opt-field.js +31 -0
- package/dist/function/opt-fn.d.ts +8 -0
- package/dist/function/opt-fn.js +11 -0
- package/dist/function/random-test-no.js +1 -5
- package/dist/function/remove-fqn.d.ts +1 -1
- package/dist/function/remove-fqn.js +10 -14
- package/dist/function/run-exporter.d.ts +1 -1
- package/dist/function/run-exporter.js +12 -27
- package/dist/function/secure-clone.d.ts +1 -1
- package/dist/function/secure-clone.js +2 -7
- package/dist/function/secure-json.js +6 -12
- package/dist/function/set-anonymous-fqn.d.ts +1 -1
- package/dist/function/set-anonymous-fqn.js +15 -19
- package/dist/function/set-anonymous-name.d.ts +1 -1
- package/dist/function/set-anonymous-name.js +23 -26
- package/dist/function/set-fqn.d.ts +1 -1
- package/dist/function/set-fqn.js +28 -31
- package/dist/function/set-prop.js +9 -15
- package/dist/function/stamp-loader.d.ts +1 -1
- package/dist/function/stamp-loader.js +4 -8
- package/dist/function/test-case.js +5 -9
- package/dist/function/test-name.js +4 -8
- package/dist/function/trigger-fqn.d.ts +1 -1
- package/dist/function/trigger-fqn.js +5 -9
- package/dist/index.d.ts +19 -19
- package/dist/index.foretell.js +10 -88
- package/dist/index.js +22 -40
- package/dist/index.loader.d.ts +1 -1
- package/dist/index.loader.js +6 -43
- package/dist/init/index.js +3 -7
- package/dist/internal.js +1 -5
- package/package.json +26 -16
- package/dist/assets/.gitkeep +0 -0
- package/dist/base/index.js.map +0 -1
- package/dist/base/index.types.js.map +0 -1
- package/dist/base/leyyo.js.map +0 -1
- package/dist/base/leyyo.types.js.map +0 -1
- package/dist/class/index.js.map +0 -1
- package/dist/class/index.types.js.map +0 -1
- package/dist/class/list.js.map +0 -1
- package/dist/class/logger.instance.js.map +0 -1
- package/dist/common/deploy.common.js.map +0 -1
- package/dist/common/enum.pool.js.map +0 -1
- package/dist/common/error.common.js.map +0 -1
- package/dist/common/error.pool.js.map +0 -1
- package/dist/common/event.common.js.map +0 -1
- package/dist/common/index.js.map +0 -1
- package/dist/common/index.types.js.map +0 -1
- package/dist/common/inert.js.map +0 -1
- package/dist/common/lifecycle.common.js.map +0 -1
- package/dist/common/literal.pool.js.map +0 -1
- package/dist/common/log.common.js.map +0 -1
- package/dist/common/repo.common.js.map +0 -1
- package/dist/const/index.js.map +0 -1
- package/dist/enum/index.js.map +0 -1
- package/dist/enum/log-level.js.map +0 -1
- package/dist/error/caused.error.js.map +0 -1
- package/dist/error/developer.error.js.map +0 -1
- package/dist/error/http.error.js.map +0 -1
- package/dist/error/index.js.map +0 -1
- package/dist/error/index.types.js.map +0 -1
- package/dist/error/invalid-value.error.js.map +0 -1
- package/dist/error/leyyo.error.js.map +0 -1
- package/dist/error/multiple.error.js.map +0 -1
- package/dist/function/define-loader.js.map +0 -1
- package/dist/function/delay.js.map +0 -1
- package/dist/function/delete-prop.js.map +0 -1
- package/dist/function/empty.fn.js.map +0 -1
- package/dist/function/extended-type.js.map +0 -1
- package/dist/function/get-fqn.js.map +0 -1
- package/dist/function/get-prop.js.map +0 -1
- package/dist/function/has-fqn.js.map +0 -1
- package/dist/function/index.js.map +0 -1
- package/dist/function/index.types.js.map +0 -1
- package/dist/function/is-anonymous-name.js.map +0 -1
- package/dist/function/is-test.js.map +0 -1
- package/dist/function/is.fn.d.ts +0 -59
- package/dist/function/is.fn.js +0 -93
- package/dist/function/is.fn.js.map +0 -1
- package/dist/function/jitter-interval.js.map +0 -1
- package/dist/function/leyyo-fn.js.map +0 -1
- package/dist/function/on-fqn-set.js.map +0 -1
- package/dist/function/one-or-more.js.map +0 -1
- package/dist/function/opt.fn.d.ts +0 -49
- package/dist/function/opt.fn.js +0 -142
- package/dist/function/opt.fn.js.map +0 -1
- package/dist/function/random-test-no.js.map +0 -1
- package/dist/function/remove-fqn.js.map +0 -1
- package/dist/function/run-exporter.js.map +0 -1
- package/dist/function/secure-clone.js.map +0 -1
- package/dist/function/secure-json.js.map +0 -1
- package/dist/function/set-anonymous-fqn.js.map +0 -1
- package/dist/function/set-anonymous-name.js.map +0 -1
- package/dist/function/set-fqn.js.map +0 -1
- package/dist/function/set-prop.js.map +0 -1
- package/dist/function/stamp-loader.js.map +0 -1
- package/dist/function/test-case.js.map +0 -1
- package/dist/function/test-name.js.map +0 -1
- package/dist/function/trigger-fqn.js.map +0 -1
- package/dist/index.foretell.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.loader.js.map +0 -1
- package/dist/init/index.js.map +0 -1
- package/dist/internal.js.map +0 -1
- /package/dist/function/{empty.fn.d.ts → empty-fn.d.ts} +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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[
|
|
14
|
+
if (target[KEY_LITERAL_NAME]) {
|
|
18
15
|
return _item(target, callback);
|
|
19
16
|
}
|
|
20
17
|
return false;
|
|
21
18
|
}
|
|
22
|
-
if (target[
|
|
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[
|
|
31
|
-
callback(target[
|
|
27
|
+
if (target[KEY_FQN_NAME]) {
|
|
28
|
+
callback(target[KEY_FQN_NAME]);
|
|
32
29
|
return true;
|
|
33
30
|
}
|
|
34
|
-
if (!target[
|
|
35
|
-
target[
|
|
31
|
+
if (!target[KEY_FQN_ON_SET]) {
|
|
32
|
+
target[KEY_FQN_ON_SET] = [];
|
|
36
33
|
}
|
|
37
|
-
target[
|
|
34
|
+
target[KEY_FQN_ON_SET].push(callback);
|
|
38
35
|
return false;
|
|
39
36
|
}
|
|
40
|
-
//# sourceMappingURL=on-fqn-set.js.map
|
|
@@ -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,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,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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[
|
|
24
|
-
return _item(target, target[
|
|
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[
|
|
29
|
-
return _item(target, target[
|
|
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[
|
|
38
|
-
delete target[
|
|
39
|
-
|
|
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,16 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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,8 +1,4 @@
|
|
|
1
|
-
|
|
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 <${
|
|
15
|
+
return `#circular <${value?.constructor?.name}>`;
|
|
21
16
|
}
|
|
22
17
|
if (depth >= 10) {
|
|
23
|
-
return `#depth <${
|
|
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 (
|
|
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 <${
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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[
|
|
22
|
-
return _item(target, target[
|
|
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[
|
|
27
|
-
return _item(target, target[
|
|
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[
|
|
32
|
+
if (!target[KEY_FQN_NAME]) {
|
|
36
33
|
_count++;
|
|
37
|
-
const full = `${
|
|
38
|
-
target[
|
|
39
|
-
|
|
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[
|
|
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;
|