@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.
- 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,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CausedError = void 0;
|
|
4
|
-
const leyyo_error_1 = require("./leyyo.error");
|
|
1
|
+
import { LeyyoError } from "./leyyo.error.js";
|
|
5
2
|
/**
|
|
6
3
|
* Caused error
|
|
7
4
|
* */
|
|
8
|
-
class CausedError extends
|
|
5
|
+
export class CausedError extends LeyyoError {
|
|
9
6
|
/**
|
|
10
7
|
* Cast a native error to caused error
|
|
11
8
|
*
|
|
@@ -20,5 +17,3 @@ class CausedError extends leyyo_error_1.LeyyoError {
|
|
|
20
17
|
return err;
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.CausedError = CausedError;
|
|
24
|
-
//# sourceMappingURL=caused.error.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KEY_SECURE_1 } from "../const";
|
|
2
|
-
import { LeyyoLike } from "../base";
|
|
3
|
-
import { DeveloperErrorLike, ErrorStackLine } from "./index.types";
|
|
1
|
+
import { KEY_SECURE_1 } from "../const/index.js";
|
|
2
|
+
import { LeyyoLike } from "../base/index.js";
|
|
3
|
+
import { DeveloperErrorLike, ErrorStackLine } from "./index.types.js";
|
|
4
4
|
declare const LY_DEVELOPER_MESSAGE: unique symbol;
|
|
5
5
|
declare const LY_DEVELOPER_CASE: unique symbol;
|
|
6
6
|
declare const LY_DEVELOPER_WHERE: unique symbol;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeveloperError = void 0;
|
|
4
|
-
const const_1 = require("../const");
|
|
1
|
+
import { KEY_SECURE_1 } from "../const/index.js";
|
|
5
2
|
// region properties
|
|
6
3
|
const LY_DEVELOPER_MESSAGE = Symbol.for('leyyo/developer.message');
|
|
7
4
|
const LY_DEVELOPER_CASE = Symbol.for('leyyo/developer.case');
|
|
@@ -9,14 +6,19 @@ const LY_DEVELOPER_WHERE = Symbol.for('leyyo/developer.where');
|
|
|
9
6
|
let _leyyo;
|
|
10
7
|
// endregion properties
|
|
11
8
|
/** Developer error */
|
|
12
|
-
class DeveloperError extends Error {
|
|
9
|
+
export class DeveloperError extends Error {
|
|
10
|
+
[LY_DEVELOPER_MESSAGE];
|
|
11
|
+
[LY_DEVELOPER_CASE];
|
|
12
|
+
[LY_DEVELOPER_WHERE];
|
|
13
|
+
/** @inheritDoc */
|
|
14
|
+
stackTrace;
|
|
13
15
|
/**
|
|
14
16
|
* @param {string} message - error message
|
|
15
17
|
* @param {string} issue - test case
|
|
16
18
|
* @param {string} where - where
|
|
17
19
|
* */
|
|
18
20
|
constructor(message, issue, where) {
|
|
19
|
-
message = message
|
|
21
|
+
message = message ?? 'Developer error';
|
|
20
22
|
const pureMessage = message;
|
|
21
23
|
if (typeof issue === 'string') {
|
|
22
24
|
message += ` [case:${issue}]`;
|
|
@@ -34,7 +36,7 @@ class DeveloperError extends Error {
|
|
|
34
36
|
}
|
|
35
37
|
_leyyo.errorCommon.buildStack(this);
|
|
36
38
|
}
|
|
37
|
-
static [
|
|
39
|
+
static [KEY_SECURE_1](leyyo) {
|
|
38
40
|
if (!_leyyo) {
|
|
39
41
|
_leyyo = leyyo;
|
|
40
42
|
}
|
|
@@ -47,5 +49,3 @@ class DeveloperError extends Error {
|
|
|
47
49
|
_leyyo.logCommon.emitLog('fatal', this[LY_DEVELOPER_WHERE], this, _leyyo.errorCommon.toJsonBasic(this, { testCase: this[LY_DEVELOPER_CASE] }));
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
exports.DeveloperError = DeveloperError;
|
|
51
|
-
//# sourceMappingURL=developer.error.js.map
|
package/dist/error/http.error.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.HttpError = void 0;
|
|
5
|
-
const leyyo_error_1 = require("./leyyo.error");
|
|
6
|
-
const const_1 = require("../const");
|
|
1
|
+
import { LeyyoError } from "./leyyo.error.js";
|
|
2
|
+
import { KEY_ERROR_DEFAULT_MESSAGE, KEY_ERROR_HTTP_STATUS } from "../const/index.js";
|
|
7
3
|
/**
|
|
8
4
|
* Http error
|
|
9
5
|
* */
|
|
10
|
-
class HttpError extends
|
|
6
|
+
export class HttpError extends LeyyoError {
|
|
7
|
+
status;
|
|
11
8
|
/**
|
|
12
9
|
* @param {(string|Opt)} p1 - error message or error parameters
|
|
13
10
|
* @param {Opt?} p2 - error parameters
|
|
@@ -15,17 +12,14 @@ class HttpError extends leyyo_error_1.LeyyoError {
|
|
|
15
12
|
constructor(p1, p2) {
|
|
16
13
|
super(p1, p2);
|
|
17
14
|
const clazz = this.constructor;
|
|
18
|
-
if (Number.isSafeInteger(clazz[
|
|
19
|
-
this.status = clazz[
|
|
15
|
+
if (Number.isSafeInteger(clazz[KEY_ERROR_HTTP_STATUS])) {
|
|
16
|
+
this.status = clazz[KEY_ERROR_HTTP_STATUS];
|
|
20
17
|
}
|
|
21
18
|
else {
|
|
22
19
|
this.status = 400;
|
|
23
20
|
}
|
|
24
21
|
}
|
|
22
|
+
static {
|
|
23
|
+
this[KEY_ERROR_DEFAULT_MESSAGE] = 'Http error';
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
|
-
exports.HttpError = HttpError;
|
|
27
|
-
_a = HttpError;
|
|
28
|
-
(() => {
|
|
29
|
-
_a[const_1.KEY_ERROR_DEFAULT_MESSAGE] = 'Http error';
|
|
30
|
-
})();
|
|
31
|
-
//# sourceMappingURL=http.error.js.map
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './caused.error';
|
|
3
|
-
export * from './developer.error';
|
|
4
|
-
export * from './http.error';
|
|
5
|
-
export * from './invalid-value.error';
|
|
6
|
-
export * from './leyyo.error';
|
|
7
|
-
export * from './multiple.error';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './caused.error.js';
|
|
3
|
+
export * from './developer.error.js';
|
|
4
|
+
export * from './http.error.js';
|
|
5
|
+
export * from './invalid-value.error.js';
|
|
6
|
+
export * from './leyyo.error.js';
|
|
7
|
+
export * from './multiple.error.js';
|
package/dist/error/index.js
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./caused.error"), exports);
|
|
19
|
-
__exportStar(require("./developer.error"), exports);
|
|
20
|
-
__exportStar(require("./http.error"), exports);
|
|
21
|
-
__exportStar(require("./invalid-value.error"), exports);
|
|
22
|
-
__exportStar(require("./leyyo.error"), exports);
|
|
23
|
-
__exportStar(require("./multiple.error"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './caused.error.js';
|
|
3
|
+
export * from './developer.error.js';
|
|
4
|
+
export * from './http.error.js';
|
|
5
|
+
export * from './invalid-value.error.js';
|
|
6
|
+
export * from './leyyo.error.js';
|
|
7
|
+
export * from './multiple.error.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassLike, Obj, OneOrMore, ShiftMain, ShiftSecure } from "../base";
|
|
2
|
-
import { Opt } from "../function";
|
|
3
|
-
import { Logger } from "../common";
|
|
1
|
+
import { ClassLike, Obj, OneOrMore, ShiftMain, ShiftSecure } from "../base/index.js";
|
|
2
|
+
import { Opt } from "../function/index.js";
|
|
3
|
+
import { Logger } from "../common/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* {@link LeyyoError}
|
|
6
6
|
* */
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.InvalidValueError = void 0;
|
|
5
|
-
const leyyo_error_1 = require("./leyyo.error");
|
|
6
|
-
const const_1 = require("../const");
|
|
1
|
+
import { LeyyoError } from "./leyyo.error.js";
|
|
2
|
+
import { KEY_ERROR_DEFAULT_MESSAGE } from "../const/index.js";
|
|
7
3
|
/**
|
|
8
4
|
* Invalid value error
|
|
9
5
|
* */
|
|
10
|
-
class InvalidValueError extends
|
|
6
|
+
export class InvalidValueError extends LeyyoError {
|
|
7
|
+
static {
|
|
8
|
+
this[KEY_ERROR_DEFAULT_MESSAGE] = 'Invalid value';
|
|
9
|
+
}
|
|
11
10
|
}
|
|
12
|
-
exports.InvalidValueError = InvalidValueError;
|
|
13
|
-
_a = InvalidValueError;
|
|
14
|
-
(() => {
|
|
15
|
-
_a[const_1.KEY_ERROR_DEFAULT_MESSAGE] = 'Invalid value';
|
|
16
|
-
})();
|
|
17
|
-
//# sourceMappingURL=invalid-value.error.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Logger } from "../common";
|
|
2
|
-
import { ErrorStackLine, LeyyoErrorLike, LeyyoErrorSecure, LeyyoErrorTag } from "./index.types";
|
|
3
|
-
import { ClassLike, LeyyoLike, Obj, OneOrMore } from "../base";
|
|
4
|
-
import { Opt } from "../function";
|
|
5
|
-
import { KEY_ERROR_FLAGS, KEY_SECURE_1 } from "../const";
|
|
1
|
+
import { Logger } from "../common/index.js";
|
|
2
|
+
import { ErrorStackLine, LeyyoErrorLike, LeyyoErrorSecure, LeyyoErrorTag } from "./index.types.js";
|
|
3
|
+
import { ClassLike, LeyyoLike, Obj, OneOrMore } from "../base/index.js";
|
|
4
|
+
import { Opt } from "../function/index.js";
|
|
5
|
+
import { KEY_ERROR_FLAGS, KEY_SECURE_1 } from "../const/index.js";
|
|
6
6
|
type T2 = LeyyoErrorTag;
|
|
7
7
|
/**
|
|
8
8
|
* Leyyo base error
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.LeyyoError = void 0;
|
|
4
|
-
const function_1 = require("../function");
|
|
5
|
-
const const_1 = require("../const");
|
|
1
|
+
import { getFqn, getSymbol, isFilledObj, isObj, optAdd, optAppend, setSymbol } from "../function/index.js";
|
|
2
|
+
import { KEY_ERROR_FLAGS, KEY_ERROR_WHERE, KEY_SECURE_1, VAL_ERROR_UNKNOWN_MESSAGE } from "../const/index.js";
|
|
6
3
|
let _leyyo;
|
|
7
4
|
// region property
|
|
8
5
|
const _errorField = ['name', 'message', 'stack'];
|
|
@@ -11,7 +8,23 @@ const _leyyoErrorFields = [..._errorField, 'params', 'causedBy', 'stackTrace'];
|
|
|
11
8
|
/**
|
|
12
9
|
* Leyyo base error
|
|
13
10
|
* */
|
|
14
|
-
class LeyyoError extends Error {
|
|
11
|
+
export class LeyyoError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* Error flags
|
|
14
|
+
* */
|
|
15
|
+
[KEY_ERROR_FLAGS];
|
|
16
|
+
/**
|
|
17
|
+
* Error parameters
|
|
18
|
+
* */
|
|
19
|
+
params;
|
|
20
|
+
/**
|
|
21
|
+
* Caused by error
|
|
22
|
+
* */
|
|
23
|
+
causedBy;
|
|
24
|
+
/**
|
|
25
|
+
* Stack trace
|
|
26
|
+
* */
|
|
27
|
+
stackTrace;
|
|
15
28
|
/**
|
|
16
29
|
* @param {(string|Opt)?} p1 - error message or error parameters
|
|
17
30
|
* @param {Opt?} p2 - error parameters
|
|
@@ -24,23 +37,23 @@ class LeyyoError extends Error {
|
|
|
24
37
|
params = p2;
|
|
25
38
|
}
|
|
26
39
|
else {
|
|
27
|
-
message =
|
|
40
|
+
message = VAL_ERROR_UNKNOWN_MESSAGE;
|
|
28
41
|
params = p1;
|
|
29
42
|
}
|
|
30
43
|
super(message);
|
|
31
44
|
const clazz = this.constructor;
|
|
32
45
|
if (!message) {
|
|
33
46
|
const conf = _leyyo.errorCommon.getConfigItem(clazz);
|
|
34
|
-
this.message = conf
|
|
47
|
+
this.message = conf?.message;
|
|
35
48
|
}
|
|
36
49
|
if (params && typeof params === 'object' && !Array.isArray(params)) {
|
|
37
50
|
this.params = params;
|
|
38
51
|
}
|
|
39
|
-
this.name =
|
|
52
|
+
this.name = getFqn(clazz);
|
|
40
53
|
_leyyo.errorCommon.buildStack(this);
|
|
41
54
|
_leyyo.errorCommon.emit(this);
|
|
42
55
|
}
|
|
43
|
-
static [
|
|
56
|
+
static [KEY_SECURE_1](leyyo) {
|
|
44
57
|
if (!_leyyo) {
|
|
45
58
|
_leyyo = leyyo;
|
|
46
59
|
}
|
|
@@ -65,10 +78,10 @@ class LeyyoError extends Error {
|
|
|
65
78
|
}
|
|
66
79
|
where(p1, fqn) {
|
|
67
80
|
if (typeof p1 === 'function') {
|
|
68
|
-
|
|
81
|
+
setSymbol(this, KEY_ERROR_WHERE, getFqn(p1));
|
|
69
82
|
}
|
|
70
83
|
else if (p1 && typeof p1 === 'object') {
|
|
71
|
-
|
|
84
|
+
setSymbol(this, KEY_ERROR_WHERE, getFqn(p1));
|
|
72
85
|
}
|
|
73
86
|
else if (p1 && typeof p1 === 'string' && p1.trim()) {
|
|
74
87
|
if (typeof fqn === 'string') {
|
|
@@ -78,7 +91,7 @@ class LeyyoError extends Error {
|
|
|
78
91
|
else {
|
|
79
92
|
fqn = '';
|
|
80
93
|
}
|
|
81
|
-
|
|
94
|
+
setSymbol(this, KEY_ERROR_WHERE, fqn + p1.trim());
|
|
82
95
|
}
|
|
83
96
|
return this;
|
|
84
97
|
}
|
|
@@ -121,42 +134,42 @@ class LeyyoError extends Error {
|
|
|
121
134
|
// endregion log
|
|
122
135
|
// region flags
|
|
123
136
|
get $where() {
|
|
124
|
-
return
|
|
137
|
+
return getSymbol(this, KEY_ERROR_WHERE);
|
|
125
138
|
}
|
|
126
139
|
$list() {
|
|
127
|
-
if (this[
|
|
140
|
+
if (this[KEY_ERROR_FLAGS] === undefined) {
|
|
128
141
|
return [];
|
|
129
142
|
}
|
|
130
|
-
return Array.from(this[
|
|
143
|
+
return Array.from(this[KEY_ERROR_FLAGS].values());
|
|
131
144
|
}
|
|
132
145
|
$append(key) {
|
|
133
|
-
if (this[
|
|
134
|
-
this[
|
|
146
|
+
if (this[KEY_ERROR_FLAGS] === undefined) {
|
|
147
|
+
this[KEY_ERROR_FLAGS] = new Set();
|
|
135
148
|
}
|
|
136
|
-
else if (this[
|
|
149
|
+
else if (this[KEY_ERROR_FLAGS].has(key)) {
|
|
137
150
|
return false;
|
|
138
151
|
}
|
|
139
|
-
this[
|
|
152
|
+
this[KEY_ERROR_FLAGS].add(key);
|
|
140
153
|
return true;
|
|
141
154
|
}
|
|
142
155
|
$remove(key) {
|
|
143
|
-
if (this[
|
|
156
|
+
if (this[KEY_ERROR_FLAGS] === undefined) {
|
|
144
157
|
return false;
|
|
145
158
|
}
|
|
146
|
-
if (!this[
|
|
159
|
+
if (!this[KEY_ERROR_FLAGS].has(key)) {
|
|
147
160
|
return false;
|
|
148
161
|
}
|
|
149
|
-
this[
|
|
150
|
-
if (this[
|
|
151
|
-
delete this[
|
|
162
|
+
this[KEY_ERROR_FLAGS].delete(key);
|
|
163
|
+
if (this[KEY_ERROR_FLAGS].size === 0) {
|
|
164
|
+
delete this[KEY_ERROR_FLAGS];
|
|
152
165
|
}
|
|
153
166
|
return true;
|
|
154
167
|
}
|
|
155
168
|
$has(key) {
|
|
156
|
-
if (this[
|
|
169
|
+
if (this[KEY_ERROR_FLAGS] === undefined) {
|
|
157
170
|
return false;
|
|
158
171
|
}
|
|
159
|
-
return this[
|
|
172
|
+
return this[KEY_ERROR_FLAGS].has(key);
|
|
160
173
|
}
|
|
161
174
|
// endregion flags
|
|
162
175
|
// region methods
|
|
@@ -165,23 +178,23 @@ class LeyyoError extends Error {
|
|
|
165
178
|
if (!(source instanceof Error)) {
|
|
166
179
|
return;
|
|
167
180
|
}
|
|
168
|
-
if (!
|
|
181
|
+
if (!isObj(this.params)) {
|
|
169
182
|
this.params = {};
|
|
170
183
|
}
|
|
171
184
|
if (source instanceof LeyyoError) {
|
|
172
185
|
for (const [k, v] of Object.entries(source)) {
|
|
173
186
|
if (!_leyyoErrorFields.includes(k) && (typeof k === 'string') && !['symbol', 'function', 'undefined'].includes(typeof v)) {
|
|
174
|
-
|
|
187
|
+
optAdd(this.params, k, v);
|
|
175
188
|
}
|
|
176
|
-
if (
|
|
177
|
-
|
|
189
|
+
if (isFilledObj(source.params)) {
|
|
190
|
+
optAppend(this.params, source.params);
|
|
178
191
|
}
|
|
179
192
|
}
|
|
180
193
|
}
|
|
181
194
|
else {
|
|
182
195
|
for (const [k, v] of Object.entries(source)) {
|
|
183
196
|
if (!_errorField.includes(k) && (typeof k === 'string') && !['symbol', 'function', 'undefined'].includes(typeof v)) {
|
|
184
|
-
|
|
197
|
+
optAdd(this.params, k, v);
|
|
185
198
|
}
|
|
186
199
|
}
|
|
187
200
|
}
|
|
@@ -195,5 +208,3 @@ class LeyyoError extends Error {
|
|
|
195
208
|
return this;
|
|
196
209
|
}
|
|
197
210
|
}
|
|
198
|
-
exports.LeyyoError = LeyyoError;
|
|
199
|
-
//# sourceMappingURL=leyyo.error.js.map
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.MultipleError = void 0;
|
|
4
|
-
const leyyo_error_1 = require("./leyyo.error");
|
|
5
|
-
const caused_error_1 = require("./caused.error");
|
|
1
|
+
import { LeyyoError } from "./leyyo.error.js";
|
|
2
|
+
import { CausedError } from "./caused.error.js";
|
|
6
3
|
// noinspection Annotator
|
|
7
4
|
/**
|
|
8
5
|
* Multiple error which manages multiple errors
|
|
9
6
|
* */
|
|
10
|
-
class MultipleError extends
|
|
7
|
+
export class MultipleError extends LeyyoError {
|
|
11
8
|
/**
|
|
12
9
|
* @param {...Error[]} errors
|
|
13
10
|
* */
|
|
14
11
|
constructor(...errors) {
|
|
15
|
-
var _a;
|
|
16
12
|
const first = errors.length > 0 ? errors[0] : undefined;
|
|
17
|
-
super(
|
|
13
|
+
super(first?.message ?? 'Multiple error', {});
|
|
18
14
|
this.causedBy = [];
|
|
19
15
|
this.push(...errors);
|
|
20
16
|
}
|
|
@@ -23,15 +19,13 @@ class MultipleError extends leyyo_error_1.LeyyoError {
|
|
|
23
19
|
if (e instanceof MultipleError) {
|
|
24
20
|
this.causedBy.push(...e.causedBy);
|
|
25
21
|
}
|
|
26
|
-
else if (e instanceof
|
|
22
|
+
else if (e instanceof LeyyoError) {
|
|
27
23
|
this.causedBy.push(e);
|
|
28
24
|
}
|
|
29
25
|
else {
|
|
30
|
-
this.causedBy.push(
|
|
26
|
+
this.causedBy.push(CausedError.of(e));
|
|
31
27
|
}
|
|
32
28
|
});
|
|
33
29
|
return this;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
exports.MultipleError = MultipleError;
|
|
37
|
-
//# sourceMappingURL=multiple.error.js.map
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const is_fn_1 = require("./is.fn");
|
|
5
|
-
const const_1 = require("../const");
|
|
1
|
+
import { isFilledArr } from "./is-filled-arr.js";
|
|
2
|
+
import { isText } from "./is-text.js";
|
|
3
|
+
import { KEY_LOADER_NAME } from "../const/index.js";
|
|
6
4
|
/**
|
|
7
5
|
* Set name of a loader
|
|
8
6
|
*
|
|
9
7
|
* @param {string} fqn - component name
|
|
10
8
|
* @param {...LoaderItem[]} items - items
|
|
11
9
|
* */
|
|
12
|
-
function defineLoader(fqn, ...items) {
|
|
13
|
-
if (!
|
|
10
|
+
export function defineLoader(fqn, ...items) {
|
|
11
|
+
if (!isText(fqn)) {
|
|
14
12
|
fqn = `leyyo/@${Date.now()}`;
|
|
15
13
|
}
|
|
16
|
-
if (!
|
|
14
|
+
if (!isFilledArr(items)) {
|
|
17
15
|
items = [];
|
|
18
16
|
}
|
|
19
17
|
const loader = [...items];
|
|
20
|
-
loader[
|
|
18
|
+
loader[KEY_LOADER_NAME] = fqn;
|
|
21
19
|
return loader;
|
|
22
20
|
}
|
|
23
|
-
//# sourceMappingURL=define-loader.js.map
|
package/dist/function/delay.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.delay = delay;
|
|
4
1
|
// noinspection JSUnusedGlobalSymbols
|
|
5
2
|
/**
|
|
6
3
|
* Delay or sleep n msec
|
|
@@ -10,13 +7,12 @@ exports.delay = delay;
|
|
|
10
7
|
* @return {any}
|
|
11
8
|
* @async
|
|
12
9
|
* */
|
|
13
|
-
function delay(waiting, response) {
|
|
10
|
+
export function delay(waiting, response) {
|
|
14
11
|
if (typeof waiting !== "number" || waiting < 10) {
|
|
15
|
-
waiting = Math.round(Math.random() *
|
|
12
|
+
waiting = Math.round(Math.random() * 1_000);
|
|
16
13
|
}
|
|
17
14
|
else if (!Number.isSafeInteger(waiting)) {
|
|
18
15
|
waiting = Math.round(waiting);
|
|
19
16
|
}
|
|
20
17
|
return new Promise(() => setTimeout(() => response, waiting));
|
|
21
18
|
}
|
|
22
|
-
//# sourceMappingURL=delay.js.map
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.deleteProp = deleteProp;
|
|
6
|
-
const internal_1 = require("../internal");
|
|
7
|
-
const test_case_1 = require("./test-case");
|
|
8
|
-
const leyyo_fn_1 = require("./leyyo-fn");
|
|
9
|
-
const where = `${internal_1.FQN}.DeleteProp`;
|
|
1
|
+
import { FQN } from "../internal.js";
|
|
2
|
+
import { testCase } from "./test-case.js";
|
|
3
|
+
import { $$get_leyyo_fn } from "./leyyo-fn.js";
|
|
4
|
+
const where = `${FQN}.DeleteProp`;
|
|
10
5
|
let _leyyo;
|
|
11
6
|
/**
|
|
12
7
|
* Delete target property
|
|
@@ -15,7 +10,7 @@ let _leyyo;
|
|
|
15
10
|
* @param {string} key - key
|
|
16
11
|
* @return {boolean} - is deleted?
|
|
17
12
|
* */
|
|
18
|
-
function deleteKey(target, key) {
|
|
13
|
+
export function deleteKey(target, key) {
|
|
19
14
|
if (typeof key !== 'string') {
|
|
20
15
|
return false;
|
|
21
16
|
}
|
|
@@ -28,7 +23,7 @@ function deleteKey(target, key) {
|
|
|
28
23
|
* @param {symbol} key - hidden key
|
|
29
24
|
* @return {boolean} - is deleted?
|
|
30
25
|
* */
|
|
31
|
-
function deleteSymbol(target, key) {
|
|
26
|
+
export function deleteSymbol(target, key) {
|
|
32
27
|
if (typeof key !== 'symbol') {
|
|
33
28
|
return false;
|
|
34
29
|
}
|
|
@@ -41,7 +36,7 @@ function deleteSymbol(target, key) {
|
|
|
41
36
|
* @param {(symbol|string)} key - key
|
|
42
37
|
* @return {boolean} - is deleted?
|
|
43
38
|
* */
|
|
44
|
-
function deleteProp(target, key) {
|
|
39
|
+
export function deleteProp(target, key) {
|
|
45
40
|
if (!['symbol', 'string'].includes(typeof key)) {
|
|
46
41
|
return false;
|
|
47
42
|
}
|
|
@@ -67,10 +62,9 @@ function deleteProp(target, key) {
|
|
|
67
62
|
}
|
|
68
63
|
catch (e) {
|
|
69
64
|
if (!_leyyo) {
|
|
70
|
-
_leyyo =
|
|
65
|
+
_leyyo = $$get_leyyo_fn();
|
|
71
66
|
}
|
|
72
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`,
|
|
67
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, 'ZZZ'), where).log(e);
|
|
73
68
|
return false;
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
|
-
//# sourceMappingURL=delete-prop.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emptyFn = emptyFn;
|
|
4
1
|
// noinspection JSUnusedGlobalSymbols
|
|
5
2
|
/**
|
|
6
3
|
* Empty function, it can be more useful sometimes
|
|
@@ -8,6 +5,5 @@ exports.emptyFn = emptyFn;
|
|
|
8
5
|
* @param {Arr} _args - insignificant parameters
|
|
9
6
|
* @return {any}
|
|
10
7
|
* */
|
|
11
|
-
function emptyFn(..._args) {
|
|
8
|
+
export function emptyFn(..._args) {
|
|
12
9
|
}
|
|
13
|
-
//# sourceMappingURL=empty.fn.js.map
|