@leyyo/common 1.0.13 → 1.2.2
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/deploy/deploy.common.d.ts +12 -7
- package/dist/deploy/deploy.common.js +29 -10
- package/dist/deploy/deploy.common.js.map +1 -1
- package/dist/deploy/index.types.d.ts +12 -8
- package/dist/error/error.common.d.ts +12 -20
- package/dist/error/error.common.js +151 -85
- package/dist/error/error.common.js.map +1 -1
- package/dist/error/http-error.map.d.ts +6 -0
- package/dist/error/http-error.map.js +25 -0
- package/dist/error/http-error.map.js.map +1 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +2 -0
- package/dist/error/index.js.map +1 -1
- package/dist/error/index.types.d.ts +35 -36
- package/dist/error/items/bad-request.error.d.ts +10 -0
- package/dist/error/items/bad-request.error.js +16 -0
- package/dist/error/items/bad-request.error.js.map +1 -0
- package/dist/error/items/caused.error.d.ts +8 -0
- package/dist/error/items/caused.error.js +16 -0
- package/dist/error/items/caused.error.js.map +1 -0
- package/dist/error/items/conflict.error.d.ts +10 -0
- package/dist/error/items/conflict.error.js +16 -0
- package/dist/error/items/conflict.error.js.map +1 -0
- package/dist/error/items/content-too-large.error.d.ts +10 -0
- package/dist/error/items/content-too-large.error.js +16 -0
- package/dist/error/items/content-too-large.error.js.map +1 -0
- package/dist/error/items/developer.error.d.ts +4 -0
- package/dist/error/items/developer.error.js +9 -0
- package/dist/error/items/developer.error.js.map +1 -0
- package/dist/error/items/forbidden.error.d.ts +10 -0
- package/dist/error/items/forbidden.error.js +16 -0
- package/dist/error/items/forbidden.error.js.map +1 -0
- package/dist/error/items/gone.error.d.ts +10 -0
- package/dist/error/items/gone.error.js +16 -0
- package/dist/error/items/gone.error.js.map +1 -0
- package/dist/error/items/http.error.d.ts +15 -0
- package/dist/error/items/http.error.js +21 -0
- package/dist/error/items/http.error.js.map +1 -0
- package/dist/error/items/index.d.ts +21 -0
- package/dist/error/items/index.js +38 -0
- package/dist/error/items/index.js.map +1 -0
- package/dist/error/items/invalid-value.error.d.ts +6 -0
- package/dist/error/items/invalid-value.error.js +11 -0
- package/dist/error/items/invalid-value.error.js.map +1 -0
- package/dist/error/items/length-required.error.d.ts +10 -0
- package/dist/error/items/length-required.error.js +16 -0
- package/dist/error/items/length-required.error.js.map +1 -0
- package/dist/error/items/leyyo.error.d.ts +50 -0
- package/dist/error/items/leyyo.error.js +98 -0
- package/dist/error/items/leyyo.error.js.map +1 -0
- package/dist/error/items/method-not-allowed.error.d.ts +10 -0
- package/dist/error/items/method-not-allowed.error.js +16 -0
- package/dist/error/items/method-not-allowed.error.js.map +1 -0
- package/dist/error/items/multiple.error.d.ts +11 -0
- package/dist/error/items/multiple.error.js +34 -0
- package/dist/error/items/multiple.error.js.map +1 -0
- package/dist/error/items/not-acceptable.error.d.ts +10 -0
- package/dist/error/items/not-acceptable.error.js +16 -0
- package/dist/error/items/not-acceptable.error.js.map +1 -0
- package/dist/error/items/not-found.error.d.ts +10 -0
- package/dist/error/items/not-found.error.js +16 -0
- package/dist/error/items/not-found.error.js.map +1 -0
- package/dist/error/items/payment-required.error.d.ts +10 -0
- package/dist/error/items/payment-required.error.js +16 -0
- package/dist/error/items/payment-required.error.js.map +1 -0
- package/dist/error/items/precondition-failed.error.d.ts +10 -0
- package/dist/error/items/precondition-failed.error.js +16 -0
- package/dist/error/items/precondition-failed.error.js.map +1 -0
- package/dist/error/items/proxy-authentication-required.error.d.ts +10 -0
- package/dist/error/items/proxy-authentication-required.error.js +16 -0
- package/dist/error/items/proxy-authentication-required.error.js.map +1 -0
- package/dist/error/items/request-timeout.error.d.ts +10 -0
- package/dist/error/items/request-timeout.error.js +16 -0
- package/dist/error/items/request-timeout.error.js.map +1 -0
- package/dist/error/items/silent.error.d.ts +11 -0
- package/dist/error/items/silent.error.js +19 -0
- package/dist/error/items/silent.error.js.map +1 -0
- package/dist/error/items/unauthorized.error.d.ts +10 -0
- package/dist/error/items/unauthorized.error.js +16 -0
- package/dist/error/items/unauthorized.error.js.map +1 -0
- package/dist/event/event.common.d.ts +77 -0
- package/dist/event/event.common.js +308 -0
- package/dist/event/event.common.js.map +1 -0
- package/dist/event/event.error.d.ts +3 -0
- package/dist/event/event.error.js +8 -0
- package/dist/event/event.error.js.map +1 -0
- package/dist/event/index.js.map +1 -0
- package/dist/event/index.types.d.ts +261 -0
- package/dist/{hook → event}/index.types.js.map +1 -1
- package/dist/hub/hub.channel.d.ts +27 -0
- package/dist/hub/hub.channel.js +83 -0
- package/dist/hub/hub.channel.js.map +1 -0
- package/dist/hub/hub.common.d.ts +27 -0
- package/dist/hub/hub.common.js +92 -0
- package/dist/hub/hub.common.js.map +1 -0
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/index.types.d.ts +105 -0
- package/dist/{to → hub}/index.types.js.map +1 -1
- package/dist/index.d.ts +5 -23
- package/dist/index.js +7 -25
- package/dist/index.js.map +1 -1
- package/dist/leyyo/index.d.ts +0 -1
- package/dist/leyyo/index.js +0 -1
- package/dist/leyyo/index.js.map +1 -1
- package/dist/leyyo/index.types.d.ts +4 -22
- package/dist/leyyo/leyyo.d.ts +4 -22
- package/dist/leyyo/leyyo.js +12 -39
- package/dist/leyyo/leyyo.js.map +1 -1
- package/dist/log/index.types.d.ts +19 -26
- package/dist/log/log.common.d.ts +1 -1
- package/dist/log/log.common.js +24 -49
- package/dist/log/log.common.js.map +1 -1
- package/dist/log/logger.error.d.ts +3 -0
- package/dist/log/logger.error.js +8 -0
- package/dist/log/logger.error.js.map +1 -0
- package/dist/log/logger.instance.d.ts +7 -9
- package/dist/log/logger.instance.js +40 -50
- package/dist/log/logger.instance.js.map +1 -1
- package/dist/name/index.types.d.ts +1 -1
- package/dist/name/name.common.js +64 -37
- package/dist/name/name.common.js.map +1 -1
- package/dist/name/name.error.d.ts +3 -0
- package/dist/name/name.error.js +8 -0
- package/dist/name/name.error.js.map +1 -0
- package/dist/opt/index.js.map +1 -0
- package/dist/opt/index.types.d.ts +33 -0
- package/dist/{fqn → opt}/index.types.js.map +1 -1
- package/dist/opt/opt.common.d.ts +15 -0
- package/dist/opt/opt.common.js +93 -0
- package/dist/opt/opt.common.js.map +1 -0
- package/dist/repo/index.types.d.ts +1 -19
- package/dist/repo/repo.common.d.ts +0 -6
- package/dist/repo/repo.common.js +0 -20
- package/dist/repo/repo.common.js.map +1 -1
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.enum.d.ts +7 -0
- package/dist/{exception/index.types.js → shared/index.enum.js} +1 -1
- package/dist/shared/index.enum.js.map +1 -0
- package/dist/shared/index.fqn.d.ts +3 -0
- package/dist/shared/index.fqn.js +3 -0
- package/dist/shared/index.fqn.js.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.json.d.ts +33 -0
- package/dist/shared/index.json.js +3 -0
- package/dist/shared/index.json.js.map +1 -0
- package/dist/shared/index.types.d.ts +78 -100
- package/dist/shared/index.types.js +31 -0
- package/dist/shared/index.types.js.map +1 -1
- package/dist/util/delay.d.ts +9 -0
- package/dist/util/delay.js +21 -0
- package/dist/util/delay.js.map +1 -0
- package/dist/util/empty.fn.d.ts +8 -0
- package/dist/util/empty.fn.js +11 -0
- package/dist/util/empty.fn.js.map +1 -0
- package/dist/util/index.d.ts +5 -0
- package/dist/{developer → util}/index.js +5 -2
- package/dist/util/index.js.map +1 -0
- package/dist/util/one-or-more.d.ts +8 -0
- package/dist/util/one-or-more.js +19 -0
- package/dist/util/one-or-more.js.map +1 -0
- package/dist/util/secure-clone.d.ts +3 -0
- package/dist/util/secure-clone.js +38 -0
- package/dist/util/secure-clone.js.map +1 -0
- package/dist/util/secure-json.d.ts +37 -0
- package/dist/util/secure-json.js +126 -0
- package/dist/util/secure-json.js.map +1 -0
- package/package.json +2 -2
- package/dist/assertion/assertion.common.d.ts +0 -183
- package/dist/assertion/assertion.common.js +0 -663
- package/dist/assertion/assertion.common.js.map +0 -1
- package/dist/assertion/index.js.map +0 -1
- package/dist/assertion/index.types.d.ts +0 -661
- package/dist/assertion/index.types.js.map +0 -1
- package/dist/descriptor/descriptor.common.d.ts +0 -22
- package/dist/descriptor/descriptor.common.js +0 -117
- package/dist/descriptor/descriptor.common.js.map +0 -1
- package/dist/descriptor/index.js.map +0 -1
- package/dist/descriptor/index.types.d.ts +0 -23
- package/dist/descriptor/index.types.js.map +0 -1
- package/dist/developer/developer.common.d.ts +0 -32
- package/dist/developer/developer.common.js +0 -245
- package/dist/developer/developer.common.js.map +0 -1
- package/dist/developer/index.d.ts +0 -2
- package/dist/developer/index.errors.d.ts +0 -13
- package/dist/developer/index.errors.js +0 -24
- package/dist/developer/index.errors.js.map +0 -1
- package/dist/developer/index.js.map +0 -1
- package/dist/developer/index.types.d.ts +0 -85
- package/dist/developer/index.types.js.map +0 -1
- package/dist/exception/assertion.exception.d.ts +0 -5
- package/dist/exception/assertion.exception.js +0 -12
- package/dist/exception/assertion.exception.js.map +0 -1
- package/dist/exception/caused.exception.d.ts +0 -5
- package/dist/exception/caused.exception.js +0 -13
- package/dist/exception/caused.exception.js.map +0 -1
- package/dist/exception/developer.exception.d.ts +0 -5
- package/dist/exception/developer.exception.js +0 -12
- package/dist/exception/developer.exception.js.map +0 -1
- package/dist/exception/exception.d.ts +0 -32
- package/dist/exception/exception.js +0 -117
- package/dist/exception/exception.js.map +0 -1
- package/dist/exception/index.d.ts +0 -7
- package/dist/exception/index.js +0 -24
- package/dist/exception/index.js.map +0 -1
- package/dist/exception/index.types.d.ts +0 -30
- package/dist/exception/index.types.js.map +0 -1
- package/dist/exception/invalid-value.exception.d.ts +0 -5
- package/dist/exception/invalid-value.exception.js +0 -12
- package/dist/exception/invalid-value.exception.js.map +0 -1
- package/dist/exception/multiple.exception.d.ts +0 -8
- package/dist/exception/multiple.exception.js +0 -34
- package/dist/exception/multiple.exception.js.map +0 -1
- package/dist/fqn/fqn.common.d.ts +0 -20
- package/dist/fqn/fqn.common.js +0 -123
- package/dist/fqn/fqn.common.js.map +0 -1
- package/dist/fqn/index.js.map +0 -1
- package/dist/fqn/index.types.d.ts +0 -20
- package/dist/fqn/index.types.js +0 -3
- package/dist/hook/hook.common.d.ts +0 -25
- package/dist/hook/hook.common.js +0 -95
- package/dist/hook/hook.common.js.map +0 -1
- package/dist/hook/index.d.ts +0 -1
- package/dist/hook/index.js +0 -18
- package/dist/hook/index.js.map +0 -1
- package/dist/hook/index.types.d.ts +0 -72
- package/dist/hook/index.types.js +0 -3
- package/dist/is/index.d.ts +0 -1
- package/dist/is/index.js +0 -18
- package/dist/is/index.js.map +0 -1
- package/dist/is/index.types.d.ts +0 -240
- package/dist/is/index.types.js +0 -3
- package/dist/is/index.types.js.map +0 -1
- package/dist/is/is.common.d.ts +0 -71
- package/dist/is/is.common.js +0 -177
- package/dist/is/is.common.js.map +0 -1
- package/dist/leyyo/leyyo-hook.common.d.ts +0 -10
- package/dist/leyyo/leyyo-hook.common.js +0 -18
- package/dist/leyyo/leyyo-hook.common.js.map +0 -1
- package/dist/mixin/index.d.ts +0 -1
- package/dist/mixin/index.js +0 -18
- package/dist/mixin/index.js.map +0 -1
- package/dist/mixin/index.types.d.ts +0 -19
- package/dist/mixin/index.types.js +0 -3
- package/dist/mixin/index.types.js.map +0 -1
- package/dist/mixin/mixin.common.d.ts +0 -22
- package/dist/mixin/mixin.common.js +0 -165
- package/dist/mixin/mixin.common.js.map +0 -1
- package/dist/system/country-code.d.ts +0 -10
- package/dist/system/country-code.js +0 -19
- package/dist/system/country-code.js.map +0 -1
- package/dist/system/environment.d.ts +0 -7
- package/dist/system/environment.js +0 -6
- package/dist/system/environment.js.map +0 -1
- package/dist/system/index.d.ts +0 -7
- package/dist/system/index.js +0 -24
- package/dist/system/index.js.map +0 -1
- package/dist/system/index.types.d.ts +0 -6
- package/dist/system/index.types.js +0 -3
- package/dist/system/index.types.js.map +0 -1
- package/dist/system/language-code.d.ts +0 -7
- package/dist/system/language-code.js +0 -11
- package/dist/system/language-code.js.map +0 -1
- package/dist/system/locale-code.d.ts +0 -9
- package/dist/system/locale-code.js +0 -16
- package/dist/system/locale-code.js.map +0 -1
- package/dist/system/sys-class.d.ts +0 -4
- package/dist/system/sys-class.js +0 -21
- package/dist/system/sys-class.js.map +0 -1
- package/dist/system/sys-function.d.ts +0 -4
- package/dist/system/sys-function.js +0 -8
- package/dist/system/sys-function.js.map +0 -1
- package/dist/system/system.common.d.ts +0 -11
- package/dist/system/system.common.js +0 -64
- package/dist/system/system.common.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.js +0 -19
- package/dist/test/index.js.map +0 -1
- package/dist/test/index.types.d.ts +0 -9
- package/dist/test/index.types.js +0 -3
- package/dist/test/index.types.js.map +0 -1
- package/dist/test/test.common.d.ts +0 -14
- package/dist/test/test.common.js +0 -48
- package/dist/test/test.common.js.map +0 -1
- package/dist/test/tested.d.ts +0 -1
- package/dist/test/tested.js +0 -9
- package/dist/test/tested.js.map +0 -1
- package/dist/to/index.d.ts +0 -7
- package/dist/to/index.js +0 -24
- package/dist/to/index.js.map +0 -1
- package/dist/to/index.types.d.ts +0 -76
- package/dist/to/index.types.js +0 -3
- package/dist/to/key-value.d.ts +0 -4
- package/dist/to/key-value.js +0 -8
- package/dist/to/key-value.js.map +0 -1
- package/dist/to/list.d.ts +0 -20
- package/dist/to/list.js +0 -38
- package/dist/to/list.js.map +0 -1
- package/dist/to/primitive.d.ts +0 -7
- package/dist/to/primitive.js +0 -6
- package/dist/to/primitive.js.map +0 -1
- package/dist/to/real-value.d.ts +0 -7
- package/dist/to/real-value.js +0 -6
- package/dist/to/real-value.js.map +0 -1
- package/dist/to/to.common.d.ts +0 -77
- package/dist/to/to.common.js +0 -1079
- package/dist/to/to.common.js.map +0 -1
- package/dist/to/weak-false.d.ts +0 -7
- package/dist/to/weak-false.js +0 -6
- package/dist/to/weak-false.js.map +0 -1
- package/dist/to/weak-true.d.ts +0 -7
- package/dist/to/weak-true.js +0 -9
- package/dist/to/weak-true.js.map +0 -1
- package/dist/wrapper/index.d.ts +0 -2
- package/dist/wrapper/index.js +0 -19
- package/dist/wrapper/index.js.map +0 -1
- package/dist/wrapper/index.types.d.ts +0 -29
- package/dist/wrapper/index.types.js +0 -3
- package/dist/wrapper/index.types.js.map +0 -1
- package/dist/wrapper/wrap.d.ts +0 -7
- package/dist/wrapper/wrap.js +0 -11
- package/dist/wrapper/wrap.js.map +0 -1
- package/dist/wrapper/wrapper.common.d.ts +0 -26
- package/dist/wrapper/wrapper.common.js +0 -82
- package/dist/wrapper/wrapper.common.js.map +0 -1
- /package/dist/{assertion → event}/index.d.ts +0 -0
- /package/dist/{assertion → event}/index.js +0 -0
- /package/dist/{assertion → event}/index.types.js +0 -0
- /package/dist/{descriptor → hub}/index.d.ts +0 -0
- /package/dist/{descriptor → hub}/index.js +0 -0
- /package/dist/{descriptor → hub}/index.types.js +0 -0
- /package/dist/{fqn → opt}/index.d.ts +0 -0
- /package/dist/{fqn → opt}/index.js +0 -0
- /package/dist/{developer → opt}/index.types.js +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { DeployCommonLike, DeployCommonSecure, DeployType } from "./index.types";
|
|
2
2
|
import type { LeyyoLike } from "../leyyo";
|
|
3
3
|
import type { Logger } from "../log";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Opt } from "../opt";
|
|
5
5
|
export declare class DeployCommon implements DeployCommonLike, DeployCommonSecure {
|
|
6
6
|
private lyy;
|
|
7
7
|
private _types;
|
|
8
8
|
private _logger;
|
|
9
9
|
private _lines;
|
|
10
|
+
private _is;
|
|
10
11
|
constructor(lyy: LeyyoLike);
|
|
11
12
|
private _add;
|
|
12
13
|
private _get;
|
|
@@ -15,15 +16,19 @@ export declare class DeployCommon implements DeployCommonLike, DeployCommonSecur
|
|
|
15
16
|
clearMessages(): void;
|
|
16
17
|
logger(logger: Logger): DeployCommonSecure;
|
|
17
18
|
has(pck: string, testCase: number | string): DeployType;
|
|
18
|
-
debug(pck: string, deleteSelected?: boolean): Array<
|
|
19
|
-
info(pck: string, deleteSelected?: boolean): Array<
|
|
20
|
-
warn(pck: string, deleteSelected?: boolean): Array<
|
|
19
|
+
debug(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
20
|
+
info(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
21
|
+
warn(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
21
22
|
printAll(v1: Logger | string): void;
|
|
23
|
+
title(testCase: string | number, title: string): string;
|
|
24
|
+
code(pck: string, testCase: string | number): string;
|
|
25
|
+
get isTest(): boolean;
|
|
26
|
+
$ok(): void;
|
|
22
27
|
get $secure(): DeployCommonSecure;
|
|
23
28
|
get $back(): DeployCommonLike;
|
|
24
29
|
$init(): void;
|
|
25
|
-
$debug(pck: string, testCase: number | string, opt:
|
|
26
|
-
$info(pck: string, testCase: number | string, opt:
|
|
27
|
-
$warn(pck: string, testCase: number | string, opt:
|
|
30
|
+
$debug(pck: string, testCase: number | string, opt: Opt): void;
|
|
31
|
+
$info(pck: string, testCase: number | string, opt: Opt): void;
|
|
32
|
+
$warn(pck: string, testCase: number | string, opt: Opt): void;
|
|
28
33
|
$printAll(): void;
|
|
29
34
|
}
|
|
@@ -10,7 +10,7 @@ class DeployCommon {
|
|
|
10
10
|
}
|
|
11
11
|
// region private
|
|
12
12
|
_add(type, pck, testCase, opt) {
|
|
13
|
-
const item = { opt: Object.assign({ case: this.
|
|
13
|
+
const item = { opt: Object.assign({ case: this.code(pck, testCase) }, opt), logger: this._logger, type };
|
|
14
14
|
this._lines.push(item);
|
|
15
15
|
return item;
|
|
16
16
|
}
|
|
@@ -36,18 +36,15 @@ class DeployCommon {
|
|
|
36
36
|
}
|
|
37
37
|
_printAll(v1) {
|
|
38
38
|
const logger = ((typeof v1 === 'string') ? this._logger : (v1 !== null && v1 !== void 0 ? v1 : this._logger));
|
|
39
|
-
const dev = this.lyy.dev;
|
|
40
39
|
this._types.forEach(type => {
|
|
41
40
|
this._get(type, v1, true)
|
|
42
41
|
.forEach(opt => {
|
|
43
|
-
|
|
44
|
-
logger[type](message, opt2);
|
|
42
|
+
logger[type](opt.issue, opt);
|
|
45
43
|
});
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
_print(item) {
|
|
49
|
-
|
|
50
|
-
item.logger[item.type](message, opt);
|
|
47
|
+
item.logger[item.type](item.opt.issue, item.opt); // todo
|
|
51
48
|
}
|
|
52
49
|
// endregion private
|
|
53
50
|
clearMessages() {
|
|
@@ -58,7 +55,7 @@ class DeployCommon {
|
|
|
58
55
|
return this;
|
|
59
56
|
}
|
|
60
57
|
has(pck, testCase) {
|
|
61
|
-
const code = this.
|
|
58
|
+
const code = this.code(pck, testCase);
|
|
62
59
|
const filtered = this._lines.filter(d => d.opt.case === code);
|
|
63
60
|
if (filtered.length < 1) {
|
|
64
61
|
return undefined;
|
|
@@ -77,6 +74,31 @@ class DeployCommon {
|
|
|
77
74
|
printAll(v1) {
|
|
78
75
|
this._printAll(v1);
|
|
79
76
|
}
|
|
77
|
+
title(testCase, title) {
|
|
78
|
+
return `${testCase} >> ${title}`;
|
|
79
|
+
}
|
|
80
|
+
code(pck, testCase) {
|
|
81
|
+
pck = (['string', 'number'].includes(typeof pck)) ? pck : internal_1.FQN;
|
|
82
|
+
testCase = (['string', 'number'].includes(typeof testCase)) ? testCase : 'XXX';
|
|
83
|
+
return `${pck}#${testCase}`;
|
|
84
|
+
}
|
|
85
|
+
get isTest() {
|
|
86
|
+
return this._is;
|
|
87
|
+
}
|
|
88
|
+
$ok() {
|
|
89
|
+
this._is = true;
|
|
90
|
+
if (global) {
|
|
91
|
+
if (!global.leyyo_is_testing) {
|
|
92
|
+
global.leyyo_is_testing = true;
|
|
93
|
+
['log', 'warn', 'info', 'debug', 'trace', 'error', 'native'].forEach(name => {
|
|
94
|
+
global.console[name] = () => {
|
|
95
|
+
};
|
|
96
|
+
console[name] = () => {
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
80
102
|
// region secure
|
|
81
103
|
get $secure() {
|
|
82
104
|
return this;
|
|
@@ -85,9 +107,6 @@ class DeployCommon {
|
|
|
85
107
|
return this;
|
|
86
108
|
}
|
|
87
109
|
$init() {
|
|
88
|
-
this.lyy.$secure.$lazyRun(() => {
|
|
89
|
-
this.lyy.fqn.register(null, DeployCommon, 'class', internal_1.FQN);
|
|
90
|
-
});
|
|
91
110
|
}
|
|
92
111
|
$debug(pck, testCase, opt) {
|
|
93
112
|
this._print(this._add('debug', pck, testCase, opt));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.common.js","sourceRoot":"","sources":["../../src/deploy/deploy.common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"deploy.common.js","sourceRoot":"","sources":["../../src/deploy/deploy.common.ts"],"names":[],"mappings":";;;AAIA,0CAAgC;AAEhC,MAAa,YAAY;IAMrB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;QAL1B,WAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAsB,CAAC;QAExD,WAAM,GAAsB,EAAE,CAAC;IAIvC,CAAC;IAED,iBAAiB;IACT,IAAI,CAAC,IAAgB,EAAE,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAC3E,MAAM,IAAI,GAAG,EAAC,GAAG,kBAAG,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAK,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,CAAC;QACzF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,IAAI,CAAC,IAAgB,EAAE,EAAmB,EAAE,cAAuB;QACvE,MAAM,KAAK,GAAG,EAAuB,CAAC;QACtC,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YACzB,M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,IAAI,CAAC,GAAG,GAAS,EAAE;oBAClC,CAAC,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,GAAG,GAAS,EAAE;oBAC3B,CAAC,CAAC;gBACN,CAAC,CAAC,CAAC;YAEP,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IAEhB,IAAI,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK;IACL,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,SAAS;QACL,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CAEJ;AA9ID,oCA8IC"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import type { InitLike, ShiftMain, ShiftSecure } from "../shared";
|
|
2
2
|
import type { Logger } from "../log";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Opt } from "../opt";
|
|
4
4
|
export interface DeployCommonLike extends ShiftSecure<DeployCommonSecure> {
|
|
5
5
|
clearMessages(): void;
|
|
6
6
|
logger(logger: Logger): DeployCommonSecure;
|
|
7
7
|
printAll(pck: string): void;
|
|
8
8
|
printAll(logger: Logger): void;
|
|
9
9
|
has(pck: string, testCase: number | string): DeployType;
|
|
10
|
-
debug(pck: string, deleteSelected?: boolean): Array<
|
|
11
|
-
info(pck: string, deleteSelected?: boolean): Array<
|
|
12
|
-
warn(pck: string, deleteSelected?: boolean): Array<
|
|
10
|
+
debug(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
11
|
+
info(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
12
|
+
warn(pck: string, deleteSelected?: boolean): Array<Opt>;
|
|
13
|
+
title(testCase: string | number, title: string): string;
|
|
14
|
+
code(pck: string, testCase: string | number): string;
|
|
15
|
+
get isTest(): boolean;
|
|
13
16
|
}
|
|
14
17
|
export interface DeployCommonSecure extends ShiftMain<DeployCommonLike>, InitLike {
|
|
15
|
-
$debug(pck: string, testCase: number | string, opt:
|
|
16
|
-
$info(pck: string, testCase: number | string, opt:
|
|
17
|
-
$warn(pck: string, testCase: number | string, opt:
|
|
18
|
+
$debug(pck: string, testCase: number | string, opt: Opt): void;
|
|
19
|
+
$info(pck: string, testCase: number | string, opt: Opt): void;
|
|
20
|
+
$warn(pck: string, testCase: number | string, opt: Opt): void;
|
|
18
21
|
$printAll(): void;
|
|
22
|
+
$ok(): void;
|
|
19
23
|
}
|
|
20
24
|
export interface DeployItem {
|
|
21
25
|
logger: Logger;
|
|
22
26
|
type: DeployType;
|
|
23
|
-
opt:
|
|
27
|
+
opt: Opt;
|
|
24
28
|
}
|
|
25
29
|
export type DeployType = 'debug' | 'info' | 'warn';
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import type { ErrorCommonLike, ErrorCommonSecure } from "./index.types";
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
1
|
+
import type { ErrorCastType, ErrorCommonLike, ErrorCommonSecure, LeyyoErrorLike } from "./index.types";
|
|
2
|
+
import type { LeyyoLike } from "../leyyo";
|
|
3
|
+
import type { ClassLike } from "../shared";
|
|
4
|
+
import type { Opt } from "../opt";
|
|
5
5
|
export declare class ErrorCommon implements ErrorCommonLike, ErrorCommonSecure {
|
|
6
6
|
private lyy;
|
|
7
|
+
private _knownPackages;
|
|
7
8
|
constructor(lyy: LeyyoLike);
|
|
9
|
+
register(cls: ClassLike, fqn?: string): void;
|
|
10
|
+
protected _copyProperties(err: LeyyoErrorLike, e: Error): void;
|
|
11
|
+
castForClass<E extends LeyyoErrorLike>(clazz: ClassLike<E>, e: Error, opt?: Opt): E;
|
|
12
|
+
cast(e: Error, o?: Opt, type?: ErrorCastType): LeyyoErrorLike;
|
|
13
|
+
addKnownPackage(packageName: string, shortName: string): void;
|
|
14
|
+
logText(e: Error): string;
|
|
15
|
+
stack(source: LeyyoErrorLike, force?: boolean): void;
|
|
8
16
|
get $back(): ErrorCommonLike;
|
|
9
17
|
$init(): void;
|
|
10
18
|
get $secure(): ErrorCommonSecure;
|
|
11
|
-
addOmit(clz: Function, ...properties: Array<string>): boolean;
|
|
12
|
-
addSign(err: Error, ...keys: Array<string>): boolean;
|
|
13
|
-
afterCreate(e: ExceptionLike): void;
|
|
14
|
-
register(cls: Function): void;
|
|
15
|
-
build(e: Error | string): ExceptionLike;
|
|
16
|
-
buildStack(e: Error): void;
|
|
17
|
-
copyStack(exception: ExceptionLike, error: Error): void;
|
|
18
|
-
causedBy(e: Error | string): ExceptionLike;
|
|
19
|
-
getOmit(clz: Function): Array<string>;
|
|
20
|
-
getSign(err: Error): Array<string>;
|
|
21
|
-
hasSign(err: Error, key: string): boolean;
|
|
22
|
-
inheritOmit(clz: Function): Array<string>;
|
|
23
|
-
initOmit(clz: Function): boolean;
|
|
24
|
-
initSign(err: Error): boolean;
|
|
25
|
-
removeSign(err: Error, ...keys: Array<string>): boolean;
|
|
26
|
-
toObject(e: Error, ...omittedFields: Array<string>): Dict;
|
|
27
19
|
}
|
|
@@ -1,108 +1,174 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ErrorCommon = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
37
|
+
const items_1 = require("./items");
|
|
38
|
+
const items_2 = require("./items");
|
|
39
|
+
const items_3 = require("./items");
|
|
40
|
+
const stackTraceParser = __importStar(require("stacktrace-parser"));
|
|
6
41
|
const internal_1 = require("../internal");
|
|
7
42
|
// noinspection JSUnusedLocalSymbols
|
|
8
43
|
class ErrorCommon {
|
|
9
44
|
constructor(lyy) {
|
|
10
45
|
this.lyy = lyy;
|
|
11
46
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
$init() {
|
|
16
|
-
this.lyy.$secure
|
|
17
|
-
.$earlyRun(() => {
|
|
18
|
-
exception_1.Exception.$setLeyyo(this.lyy);
|
|
19
|
-
})
|
|
20
|
-
.$lazyRun(() => {
|
|
21
|
-
const fields = ['build', 'afterCreate', 'causedBy', 'toObject', 'buildStack', 'copyStack',
|
|
22
|
-
'initSign', 'addSign', 'getSign', 'removeSign', 'hasSign',
|
|
23
|
-
'initOmit', 'addOmit', 'getOmit', 'inheritOmit'];
|
|
24
|
-
const rec = { proper: false };
|
|
25
|
-
fields.forEach(field => {
|
|
26
|
-
rec[field] = this[field];
|
|
27
|
-
});
|
|
28
|
-
// define itself temporarily for error operations
|
|
29
|
-
this.lyy.hook.defineProvider(leyyo_1.LeyyoHookCommon.errorAttached, ErrorCommon, rec);
|
|
30
|
-
// when new error provider is defined, replace all common methods
|
|
31
|
-
this.lyy.hook.whenProviderDefined(leyyo_1.LeyyoHookCommon.errorAttached, ErrorCommon, (ins) => {
|
|
32
|
-
fields.forEach(field => {
|
|
33
|
-
if (typeof ins[field] === 'function') {
|
|
34
|
-
this[field] = ins[field];
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
})
|
|
39
|
-
.$lazyRun(() => {
|
|
40
|
-
this.lyy.fqn.register(null, ErrorCommon, 'class', internal_1.FQN);
|
|
41
|
-
[exception_1.Exception, exception_1.AssertionException, exception_1.CausedException, exception_1.DeveloperException, exception_1.MultipleException, exception_1.InvalidValueException].forEach(cls => {
|
|
42
|
-
this.lyy.fqn.register(null, cls, 'class', internal_1.FQN);
|
|
43
|
-
this.lyy.error.register(cls);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
get $secure() {
|
|
48
|
-
return this;
|
|
47
|
+
register(cls, fqn) {
|
|
48
|
+
this.lyy.event.emit('ly:error:register', cls, fqn);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
_copyProperties(err, e) {
|
|
51
|
+
for (const [k, v] of Object.entries(e)) {
|
|
52
|
+
if (!['name', 'message', 'stack'].includes(k) && (typeof k === 'string') && !['symbol', 'function', 'undefined'].includes(typeof v)) {
|
|
53
|
+
this.lyy.opt.add(err.params, k, v);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
castForClass(clazz, e, opt) {
|
|
58
|
+
const err = new clazz(e.message, opt);
|
|
59
|
+
this._copyProperties(err, e);
|
|
60
|
+
err.params = this.lyy.opt.append(err.params, opt);
|
|
61
|
+
err.causedBy = e;
|
|
62
|
+
return err;
|
|
63
|
+
}
|
|
64
|
+
cast(e, o = {}, type = 'leyyo') {
|
|
65
|
+
let err;
|
|
66
|
+
if (!(e instanceof items_1.LeyyoError)) {
|
|
67
|
+
switch (type) {
|
|
68
|
+
case "caused":
|
|
69
|
+
err = new items_3.CausedError(e.message, o, e);
|
|
70
|
+
break;
|
|
71
|
+
case "silent":
|
|
72
|
+
err = new items_2.SilentError(e, o);
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
err = new items_1.LeyyoError(e.message, o);
|
|
76
|
+
err.causedBy = e;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
this._copyProperties(err, e);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
err = e;
|
|
83
|
+
err.params = this.lyy.opt.append(err.params, o);
|
|
84
|
+
}
|
|
85
|
+
return err;
|
|
55
86
|
}
|
|
56
|
-
|
|
57
|
-
|
|
87
|
+
addKnownPackage(packageName, shortName) {
|
|
88
|
+
if (typeof packageName !== 'string' || packageName.trim() !== packageName || packageName.trim() === '') {
|
|
89
|
+
throw new items_1.LeyyoError('Invalid package name', { where: `${internal_1.FQN}.ErrorCommon`, method: 'addKnownPackage', value: packageName, field: 'packageName' });
|
|
90
|
+
}
|
|
91
|
+
if (typeof shortName !== 'string' || shortName.trim() !== shortName || shortName.trim() === '') {
|
|
92
|
+
throw new items_1.LeyyoError('Invalid short name', { where: `${internal_1.FQN}.ErrorCommon`, method: 'addKnownPackage', value: shortName, field: 'shortName' });
|
|
93
|
+
}
|
|
94
|
+
this._knownPackages.set(packageName, shortName);
|
|
58
95
|
}
|
|
59
|
-
|
|
60
|
-
|
|
96
|
+
logText(e) {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
if (!(e instanceof Error)) {
|
|
99
|
+
return '';
|
|
100
|
+
}
|
|
101
|
+
return `[${(_a = e.name) !== null && _a !== void 0 ? _a : 'UnknownError'}] => ${(_b = e.message) !== null && _b !== void 0 ? _b : 'Unknown message'}`;
|
|
61
102
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
103
|
+
stack(source, force) {
|
|
104
|
+
var _a;
|
|
105
|
+
if (!force && Array.isArray(source.stackTrace)) {
|
|
106
|
+
return;
|
|
65
107
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
source.stackTrace = [];
|
|
109
|
+
try {
|
|
110
|
+
let causedBy;
|
|
111
|
+
if (source.causedBy) {
|
|
112
|
+
if (Array.isArray(source.causedBy) && source.causedBy.length > 0) {
|
|
113
|
+
causedBy = source.causedBy[0];
|
|
114
|
+
}
|
|
115
|
+
else if (source.causedBy instanceof Error) {
|
|
116
|
+
causedBy = source.causedBy;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const original = (_a = causedBy === null || causedBy === void 0 ? void 0 : causedBy.stack) !== null && _a !== void 0 ? _a : source.stack;
|
|
120
|
+
if (original) {
|
|
121
|
+
const frames = stackTraceParser.parse(original);
|
|
122
|
+
if (Array.isArray(frames)) {
|
|
123
|
+
frames.forEach(frame => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
if (['<unknown>', 'Object.<anonymous>'].includes(frame.methodName)) {
|
|
126
|
+
frame.methodName = undefined;
|
|
127
|
+
}
|
|
128
|
+
if (frame.file) {
|
|
129
|
+
if (frame.file.startsWith('node:')) {
|
|
130
|
+
frame.file = `@` + frame.file.substring(5);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
for (const [pck, short] of this._knownPackages.entries()) {
|
|
134
|
+
const index = frame.file.indexOf(pck);
|
|
135
|
+
if (index >= 0) {
|
|
136
|
+
frame.file = `#${short}` + frame.file.substring(index);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (frame.file.endsWith('.js') || frame.file.endsWith('.ts')) {
|
|
141
|
+
frame.file.substring(0, frame.file.length - 3);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
source.stackTrace.push({
|
|
145
|
+
file: frame.file,
|
|
146
|
+
method: frame.methodName,
|
|
147
|
+
pos: `${(_a = frame.lineNumber) !== null && _a !== void 0 ? _a : ''}:${(_b = frame.column) !== null && _b !== void 0 ? _b : ''}`
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
70
152
|
}
|
|
71
|
-
|
|
72
|
-
|
|
153
|
+
catch (e) {
|
|
154
|
+
// none
|
|
73
155
|
}
|
|
74
|
-
return new exception_1.Exception(`Unknown error`, Object.assign(Object.assign({}, this.toObject(e)), { type: typeof e }));
|
|
75
156
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
causedBy(e) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
getOmit(clz) {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
getSign(err) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
hasSign(err, key) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
inheritOmit(clz) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
initOmit(clz) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
initSign(err) {
|
|
99
|
-
return false;
|
|
157
|
+
// region secure
|
|
158
|
+
// noinspection JSUnusedGlobalSymbols
|
|
159
|
+
get $back() {
|
|
160
|
+
return this;
|
|
100
161
|
}
|
|
101
|
-
|
|
102
|
-
|
|
162
|
+
$init() {
|
|
163
|
+
this._knownPackages = this.lyy.repo.newMap(`${internal_1.FQN}.ErrorCommon.knownPackages`);
|
|
164
|
+
this._knownPackages.set('@leyyo', 'l');
|
|
165
|
+
this.lyy.$secure
|
|
166
|
+
.$earlyRun(() => {
|
|
167
|
+
items_1.LeyyoError.$setLeyyo(this.lyy);
|
|
168
|
+
});
|
|
103
169
|
}
|
|
104
|
-
|
|
105
|
-
return
|
|
170
|
+
get $secure() {
|
|
171
|
+
return this;
|
|
106
172
|
}
|
|
107
173
|
}
|
|
108
174
|
exports.ErrorCommon = ErrorCommon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.common.js","sourceRoot":"","sources":["../../src/error/error.common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.common.js","sourceRoot":"","sources":["../../src/error/error.common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mCAAmC;AACnC,mCAAoC;AACpC,mCAAoC;AACpC,oEAAsD;AACtD,0CAAgC;AAEhC,oCAAoC;AACpC,MAAa,WAAW;IAGpB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAClC,CAAC;IAED,QAAQ,CAAC,GAAc,EAAE,GAAY;QACjC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC;IAES,eAAe,CA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,EAAE;yBACzD,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO;QACX,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,qCAAqC;IACrC,IAAI,KAAK;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAiB,GAAG,cAAG,4BAA4B,CAAC,CAAC;QAC/F,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAEvC,IAAI,CAAC,GAAG,CAAC,OAAO;aACX,SAAS,CAAC,GAAG,EAAE;YACZ,kBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AAvID,kCAuIC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpErrorMap = void 0;
|
|
4
|
+
const items_1 = require("./items");
|
|
5
|
+
// noinspection JSUnusedGlobalSymbols
|
|
6
|
+
/**
|
|
7
|
+
* Http error map to use easy
|
|
8
|
+
* */
|
|
9
|
+
exports.HttpErrorMap = {
|
|
10
|
+
400: items_1.BadRequestError,
|
|
11
|
+
401: items_1.UnauthorizedError,
|
|
12
|
+
402: items_1.PaymentRequiredError,
|
|
13
|
+
403: items_1.ForbiddenError,
|
|
14
|
+
404: items_1.NotFoundError,
|
|
15
|
+
405: items_1.MethodNotAllowedError,
|
|
16
|
+
406: items_1.NotAcceptableError,
|
|
17
|
+
407: items_1.ProxyAuthenticationRequiredError,
|
|
18
|
+
408: items_1.RequestTimeoutError,
|
|
19
|
+
409: items_1.ConflictError,
|
|
20
|
+
410: items_1.GoneError,
|
|
21
|
+
411: items_1.LengthRequiredError,
|
|
22
|
+
412: items_1.PreconditionFailedError,
|
|
23
|
+
413: items_1.ContentTooLargeError,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=http-error.map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-error.map.js","sourceRoot":"","sources":["../../src/error/http-error.map.ts"],"names":[],"mappings":";;;AACA,mCASiB;AAEjB,qCAAqC;AACrC;;KAEK;AACQ,QAAA,YAAY,GAAyC;IAC9D,GAAG,EAAE,uBAAe;IACpB,GAAG,EAAE,yBAAiB;IACtB,GAAG,EAAE,4BAAoB;IACzB,GAAG,EAAE,sBAAc;IACnB,GAAG,EAAE,qBAAa;IAClB,GAAG,EAAE,6BAAqB;IAC1B,GAAG,EAAE,0BAAkB;IACvB,GAAG,EAAE,wCAAgC;IACrC,GAAG,EAAE,2BAAmB;IACxB,GAAG,EAAE,qBAAa;IAClB,GAAG,EAAE,iBAAS;IACd,GAAG,EAAE,2BAAmB;IACxB,GAAG,EAAE,+BAAuB;IAC5B,GAAG,EAAE,4BAAoB;CAC5B,CAAA"}
|
package/dist/error/index.d.ts
CHANGED
package/dist/error/index.js
CHANGED
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./index.types"), exports);
|
|
18
|
+
__exportStar(require("./items"), exports);
|
|
19
|
+
__exportStar(require("./http-error.map"), exports);
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/error/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,0CAAwB;AACxB,mDAAiC"}
|