@leyyo/common 1.3.18 → 1.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/index.d.ts +3 -3
- package/dist/base/index.js +3 -3
- package/dist/base/index.types.d.ts +3 -70
- package/dist/base/index.types.js +0 -32
- package/dist/base/leyyo.d.ts +0 -3
- package/dist/base/leyyo.js +8 -19
- package/dist/class/index.d.ts +2 -2
- package/dist/class/index.js +2 -2
- package/dist/class/index.types.d.ts +0 -20
- package/dist/class/list.d.ts +0 -6
- package/dist/class/list.js +0 -6
- package/dist/class/logger.instance.d.ts +6 -11
- package/dist/class/logger.instance.js +11 -25
- package/dist/common/deploy.common.d.ts +0 -16
- package/dist/common/deploy.common.js +4 -21
- package/dist/common/enum.pool.d.ts +5 -13
- package/dist/common/enum.pool.js +16 -17
- package/dist/common/error.common.d.ts +0 -30
- package/dist/common/error.common.js +33 -69
- package/dist/common/error.pool.d.ts +1 -10
- package/dist/common/error.pool.js +2 -13
- package/dist/common/event.common.d.ts +0 -8
- package/dist/common/event.common.js +15 -25
- package/dist/common/index.d.ts +11 -11
- package/dist/common/index.js +11 -11
- package/dist/common/index.types.d.ts +12 -435
- package/dist/common/index.types.js +0 -1
- package/dist/common/inert.d.ts +1 -49
- package/dist/common/inert.js +35 -64
- package/dist/common/lifecycle.common.d.ts +0 -14
- package/dist/common/lifecycle.common.js +13 -29
- package/dist/common/literal.pool.d.ts +1 -12
- package/dist/common/literal.pool.js +3 -18
- package/dist/common/log.common.d.ts +0 -54
- package/dist/common/log.common.js +62 -147
- package/dist/common/repo.common.d.ts +0 -188
- package/dist/common/repo.common.js +23 -239
- package/dist/const/index.d.ts +0 -7
- package/dist/const/index.js +28 -36
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -1
- package/dist/enum/log-level.d.ts +1 -4
- package/dist/enum/log-level.js +1 -1
- package/dist/error/caused.error.d.ts +0 -10
- package/dist/error/caused.error.js +0 -10
- package/dist/error/developer.error.d.ts +1 -10
- package/dist/error/developer.error.js +6 -25
- package/dist/error/http.error.d.ts +0 -13
- package/dist/error/http.error.js +1 -8
- package/dist/error/index.d.ts +7 -7
- package/dist/error/index.js +7 -7
- package/dist/error/index.types.d.ts +1 -150
- package/dist/error/invalid-value.error.d.ts +0 -3
- package/dist/error/invalid-value.error.js +1 -4
- package/dist/error/leyyo.error.d.ts +0 -33
- package/dist/error/leyyo.error.js +25 -57
- package/dist/error/multiple.error.d.ts +0 -6
- package/dist/error/multiple.error.js +2 -9
- package/dist/function/define-loader.d.ts +0 -6
- package/dist/function/define-loader.js +0 -6
- package/dist/function/delay.d.ts +0 -8
- package/dist/function/delay.js +0 -9
- package/dist/function/delete-prop.d.ts +0 -21
- package/dist/function/delete-prop.js +6 -28
- package/dist/function/empty-fn.d.ts +0 -6
- package/dist/function/empty-fn.js +1 -9
- package/dist/function/extended-type.d.ts +0 -6
- package/dist/function/extended-type.js +18 -24
- package/dist/function/get-fqn.d.ts +0 -6
- package/dist/function/get-fqn.js +2 -8
- package/dist/function/get-prop.d.ts +0 -21
- package/dist/function/get-prop.js +5 -26
- package/dist/function/get-stat.d.ts +0 -20
- package/dist/function/get-stat.js +7 -2
- package/dist/function/has-fqn.d.ts +0 -6
- package/dist/function/has-fqn.js +2 -8
- package/dist/function/index.d.ts +40 -40
- package/dist/function/index.js +40 -40
- package/dist/function/index.types.d.ts +1 -1
- package/dist/function/is-anonymous-name.js +1 -1
- package/dist/function/is-class.d.ts +0 -6
- package/dist/function/is-class.js +2 -20
- package/dist/function/is-empty.d.ts +0 -11
- package/dist/function/is-empty.js +1 -12
- package/dist/function/is-filled-arr.d.ts +0 -9
- package/dist/function/is-filled-arr.js +0 -9
- package/dist/function/is-filled-obj.d.ts +0 -9
- package/dist/function/is-filled-obj.js +0 -9
- package/dist/function/is-obj.d.ts +0 -8
- package/dist/function/is-obj.js +1 -9
- package/dist/function/is-test.d.ts +0 -8
- package/dist/function/is-test.js +3 -19
- package/dist/function/is-text.d.ts +0 -10
- package/dist/function/is-text.js +1 -11
- package/dist/function/jitter-interval.d.ts +0 -9
- package/dist/function/jitter-interval.js +2 -18
- package/dist/function/load-config.d.ts +0 -19
- package/dist/function/load-config.js +10 -61
- package/dist/function/on-fqn-set.js +3 -3
- package/dist/function/one-or-more.d.ts +0 -6
- package/dist/function/one-or-more.js +0 -7
- package/dist/function/opt-add.d.ts +0 -8
- package/dist/function/opt-add.js +2 -10
- package/dist/function/opt-append.d.ts +0 -7
- package/dist/function/opt-append.js +0 -7
- package/dist/function/opt-check.d.ts +0 -6
- package/dist/function/opt-check.js +2 -9
- package/dist/function/opt-clone.d.ts +0 -6
- package/dist/function/opt-clone.js +0 -7
- package/dist/function/opt-field.d.ts +0 -8
- package/dist/function/opt-field.js +6 -14
- package/dist/function/opt-fn.d.ts +0 -6
- package/dist/function/opt-fn.js +0 -7
- package/dist/function/random-test-no.d.ts +0 -5
- package/dist/function/random-test-no.js +0 -5
- package/dist/function/remove-fqn.d.ts +0 -8
- package/dist/function/remove-fqn.js +3 -12
- package/dist/function/run-exporter.d.ts +0 -5
- package/dist/function/run-exporter.js +3 -17
- package/dist/function/secure-clone.js +3 -3
- package/dist/function/secure-json.d.ts +0 -35
- package/dist/function/secure-json.js +12 -54
- package/dist/function/set-anonymous-fqn.js +4 -5
- package/dist/function/set-anonymous-name.js +14 -14
- package/dist/function/set-fqn.d.ts +0 -7
- package/dist/function/set-fqn.js +8 -15
- package/dist/function/set-prop.d.ts +0 -24
- package/dist/function/set-prop.js +6 -30
- package/dist/function/stamp-loader.d.ts +0 -6
- package/dist/function/stamp-loader.js +1 -7
- package/dist/function/test-case.d.ts +0 -7
- package/dist/function/test-case.js +3 -10
- package/dist/function/test-name.d.ts +0 -7
- package/dist/function/test-name.js +2 -9
- package/dist/function/trigger-fqn.js +2 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.foretell.js +7 -10
- package/dist/index.js +10 -11
- package/dist/index.loader.js +1 -8
- package/dist/init/index.js +5 -7
- package/dist/sys/index.d.ts +2 -2
- package/dist/sys/index.js +2 -2
- package/dist/sys/leyyo-storage.d.ts +0 -7
- package/dist/sys/leyyo-storage.js +5 -28
- package/dist/sys/package-json.js +5 -5
- package/package.json +16 -31
package/dist/base/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./leyyo.types.js";
|
|
3
|
+
export * from "./leyyo.js";
|
package/dist/base/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./leyyo.types.js";
|
|
3
|
+
export * from "./leyyo.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type HttpStatus = number;
|
|
2
|
-
export type BasicType =
|
|
3
|
-
export type ExtendedType = BasicType |
|
|
2
|
+
export type BasicType = "undefined" | "string" | "object" | "number" | "boolean" | "function" | "symbol" | "bigint";
|
|
3
|
+
export type ExtendedType = BasicType | "array" | "null" | "enum-map" | "literal-items" | "class" | "empty" | "text" | "nan" | "integer" | "date" | "map" | "set" | "list";
|
|
4
4
|
export type KeyValue = string | number;
|
|
5
5
|
export type AnyKey = string | number | symbol;
|
|
6
|
-
export type Obj =
|
|
6
|
+
export type Obj = object & {};
|
|
7
7
|
export type Dict<T = unknown> = Record<KeyValue, T>;
|
|
8
8
|
export type Arr<T = unknown> = Array<T>;
|
|
9
9
|
export type LangLike = string;
|
|
@@ -65,22 +65,10 @@ export type TypeOfMethod<T, M extends keyof T> = T[M] extends Function ? T[M] :
|
|
|
65
65
|
export type TypeOfFnc<F extends Fnc> = F extends (...args: Arr) => infer R ? R : never;
|
|
66
66
|
export type TypeOfAsync<F extends Async> = TypeOfPromise<TypeOfFnc<F>>;
|
|
67
67
|
export type TypeOfPromise<P> = P extends Promise<infer R> ? R : P;
|
|
68
|
-
/**
|
|
69
|
-
* String keys of an interface
|
|
70
|
-
* - Note: keyof keywords returns string|number|symbol, but it's ignore number and symbol keys
|
|
71
|
-
* */
|
|
72
68
|
export type StrKey<T> = Extract<keyof T, string>;
|
|
73
|
-
/**
|
|
74
|
-
* Serialized version of another type
|
|
75
|
-
*/
|
|
76
69
|
export type Serialized<T> = {
|
|
77
70
|
[P in keyof T]: T[P];
|
|
78
71
|
};
|
|
79
|
-
/**
|
|
80
|
-
* Makes mutable an interface
|
|
81
|
-
*
|
|
82
|
-
* @see Readonly
|
|
83
|
-
* */
|
|
84
72
|
export type Mutable<A> = {
|
|
85
73
|
-readonly [K in keyof A]: A[K];
|
|
86
74
|
};
|
|
@@ -90,44 +78,16 @@ export type ValueOf<T> = T[KeyOf<T>];
|
|
|
90
78
|
export type Values<T> = Array<T[KeyOf<T>]>;
|
|
91
79
|
export type OneOrMore<T> = T | Array<T>;
|
|
92
80
|
export type SetOrMore<T> = T | Set<T>;
|
|
93
|
-
/**
|
|
94
|
-
* An interface which contains secure mode members and provides to shift to main mode
|
|
95
|
-
* */
|
|
96
81
|
export interface ShiftSecure<S extends ShiftMain<any>> {
|
|
97
|
-
/**
|
|
98
|
-
* Shifts to secure mode
|
|
99
|
-
* */
|
|
100
82
|
get $secure(): S;
|
|
101
83
|
}
|
|
102
|
-
/**
|
|
103
|
-
* An interface which contains main mode members and provides to shift to secure mode
|
|
104
|
-
*
|
|
105
|
-
* IT's so useful to hide some public members
|
|
106
|
-
* - to see clean auto-completed members in IDE
|
|
107
|
-
* - to indicated that secure mode members should be used in special cases
|
|
108
|
-
* */
|
|
109
84
|
export interface ShiftMain<M extends ShiftSecure<any>> {
|
|
110
|
-
/**
|
|
111
|
-
* Shifts to main mode
|
|
112
|
-
* */
|
|
113
85
|
get $back(): M;
|
|
114
86
|
}
|
|
115
|
-
/**
|
|
116
|
-
* An interface which provides to flat generic interfaces/classes to prevent verbose casting commands
|
|
117
|
-
* */
|
|
118
87
|
export interface ShiftFlat<D> {
|
|
119
|
-
/**
|
|
120
|
-
* Flats current classes, or eliminate generic parameters
|
|
121
|
-
* */
|
|
122
88
|
get $flat(): D;
|
|
123
89
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Useful interface which provides initialization state for instances
|
|
126
|
-
* */
|
|
127
90
|
export interface InitLike {
|
|
128
|
-
/**
|
|
129
|
-
* Initializes the instance
|
|
130
|
-
* */
|
|
131
91
|
$init(...args: Arr): void;
|
|
132
92
|
}
|
|
133
93
|
export type IgnoreFieldsByType<T, I> = {
|
|
@@ -178,37 +138,10 @@ export type IsoDatetime = string;
|
|
|
178
138
|
export type IsoDate = string;
|
|
179
139
|
export type IsoTime = string;
|
|
180
140
|
export type JsonText<T = unknown> = string;
|
|
181
|
-
/**
|
|
182
|
-
* JSON Object, record of `JsonValue`
|
|
183
|
-
*
|
|
184
|
-
* @see #JsonValue
|
|
185
|
-
*/
|
|
186
141
|
export type JsonObject = {
|
|
187
142
|
[K in string]?: JsonValue;
|
|
188
143
|
};
|
|
189
|
-
/**
|
|
190
|
-
* JSON Array, array of `JsonValue`
|
|
191
|
-
*
|
|
192
|
-
* @see #JsonValue
|
|
193
|
-
*/
|
|
194
144
|
export type JsonArray = Array<JsonValue>;
|
|
195
|
-
/**
|
|
196
|
-
* JSON Primitive
|
|
197
|
-
*
|
|
198
|
-
* `OneOf`
|
|
199
|
-
* @see `string`
|
|
200
|
-
* @see `number`
|
|
201
|
-
* @see `boolean`
|
|
202
|
-
* @see `null`
|
|
203
|
-
*/
|
|
204
145
|
export type JsonPrimitive = string | number | boolean | null;
|
|
205
|
-
/**
|
|
206
|
-
* JSON Value
|
|
207
|
-
*
|
|
208
|
-
* `OneOf`
|
|
209
|
-
* @see #JsonPrimitive
|
|
210
|
-
* @see #JsonObject
|
|
211
|
-
* @see #JsonArray
|
|
212
|
-
*/
|
|
213
146
|
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
214
147
|
export {};
|
package/dist/base/index.types.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
// endregion json
|
|
3
|
-
/*
|
|
4
|
-
|
|
5
|
-
// export type StrObject<T> = {
|
|
6
|
-
// [K in keyof T ]: K extends string ? K : never;
|
|
7
|
-
// };
|
|
8
|
-
// export type StrKey<T> = keyof StrObject<T>;
|
|
9
|
-
|
|
10
|
-
interface _BaseFunc {
|
|
11
|
-
readonly name?: string;
|
|
12
|
-
readonly length?: number;
|
|
13
|
-
bind(thisArg: unknown, ...args: Array<unknown>): unknown;
|
|
14
|
-
|
|
15
|
-
apply(thisArg: unknown, args: Array<unknown>): unknown;
|
|
16
|
-
|
|
17
|
-
call(thisArg: unknown, ...args: Array<unknown>): unknown;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface _SyncFnc<R> extends _BaseFunc {
|
|
21
|
-
(...args: Array<unknown>): R;
|
|
22
|
-
}
|
|
23
|
-
interface _AsyncFnc<R> extends _BaseFunc {
|
|
24
|
-
(...args: Array<unknown>): Promise<R>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// export type ClassOrName = ClassLike | string;
|
|
28
|
-
// export type FuncOrName = Function | string;
|
|
29
|
-
// export type ClassOrFuncOrName = ClassLike | Function | string;
|
|
30
|
-
// export type ClassLike<T = {}> = (_BaseFunc & _Type<T>) | _SyncFnc<T>;
|
|
31
|
-
// export type AnyFnc<R = unknown> = Fnc<R> | Async<R>;
|
|
32
|
-
|
|
33
|
-
*/
|
package/dist/base/leyyo.d.ts
CHANGED
package/dist/base/leyyo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeployCommon, EnumPool, ErrorCommon, ErrorPool, EventCommon, LifecycleCommon, LiteralPool, LogCommon, RepoCommon } from "../common/index.js";
|
|
1
|
+
import { DeployCommon, EnumPool, ErrorCommon, ErrorPool, EventCommon, LifecycleCommon, LiteralPool, LogCommon, RepoCommon, } from "../common/index.js";
|
|
2
2
|
import { DeveloperError, LeyyoError } from "../error/index.js";
|
|
3
3
|
import { LoggerInstance } from "../class/logger.instance.js";
|
|
4
4
|
import { KEY_LEYYO_SECURE } from "../const/index.js";
|
|
@@ -18,7 +18,6 @@ class Leyyo {
|
|
|
18
18
|
_logCommon;
|
|
19
19
|
_logger;
|
|
20
20
|
constructor() {
|
|
21
|
-
// region binding
|
|
22
21
|
$$set_leyyo_fn(this);
|
|
23
22
|
this._developerError = DeveloperError;
|
|
24
23
|
this._developerError[KEY_LEYYO_SECURE](this);
|
|
@@ -26,24 +25,17 @@ class Leyyo {
|
|
|
26
25
|
this._leyyoError[KEY_LEYYO_SECURE](this);
|
|
27
26
|
this._loggerInstance = LoggerInstance;
|
|
28
27
|
this._loggerInstance[KEY_LEYYO_SECURE](this);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this._lifecycleCommon = new LifecycleCommon(this); // repo
|
|
37
|
-
this._enumPool = new EnumPool(this); // complex
|
|
28
|
+
this._repoCommon = new RepoCommon(this);
|
|
29
|
+
this._errorCommon = new ErrorCommon(this);
|
|
30
|
+
this._logCommon = new LogCommon(this);
|
|
31
|
+
this._eventCommon = new EventCommon(this);
|
|
32
|
+
this._deployCommon = new DeployCommon(this);
|
|
33
|
+
this._lifecycleCommon = new LifecycleCommon(this);
|
|
34
|
+
this._enumPool = new EnumPool(this);
|
|
38
35
|
this._errorPool = new ErrorPool(this);
|
|
39
36
|
this._literalPool = new LiteralPool(this);
|
|
40
|
-
// endregion instances
|
|
41
|
-
// region instance-ops
|
|
42
37
|
this._logger = this._logCommon.of(Leyyo);
|
|
43
|
-
// endregion instance-ops
|
|
44
|
-
// region final
|
|
45
38
|
this._startToConsume();
|
|
46
|
-
// endregion final
|
|
47
39
|
}
|
|
48
40
|
_startToConsume() {
|
|
49
41
|
this.logCommon.initConsume();
|
|
@@ -88,7 +80,4 @@ class Leyyo {
|
|
|
88
80
|
return this._logger;
|
|
89
81
|
}
|
|
90
82
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Leyyo common instance
|
|
93
|
-
* */
|
|
94
83
|
export const leyyo = new Leyyo();
|
package/dist/class/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./list.js";
|
package/dist/class/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./list.js";
|
|
@@ -2,29 +2,9 @@ import { Logger } from "../common/index.js";
|
|
|
2
2
|
export interface LoggerInstanceCtor {
|
|
3
3
|
new (name: string): Logger;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Extended array interface, ie: Clearable arrays
|
|
7
|
-
* */
|
|
8
5
|
export interface ListLike<T = unknown> extends Array<T> {
|
|
9
|
-
/**
|
|
10
|
-
* Clears array items, to align all iteration repositories, like Set, Map etc
|
|
11
|
-
*
|
|
12
|
-
* @return {number} - returns deleted count
|
|
13
|
-
* */
|
|
14
6
|
clear(): number;
|
|
15
|
-
/**
|
|
16
|
-
* Deletes given item
|
|
17
|
-
*
|
|
18
|
-
* @param {any} value - will be deleted record
|
|
19
|
-
* @return {boolean} - is deleted?
|
|
20
|
-
* */
|
|
21
7
|
delete(value: T): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Deletes by given predicate
|
|
24
|
-
*
|
|
25
|
-
* @param {function} predicate - lambda expression
|
|
26
|
-
* @return {boolean} - is deleted?
|
|
27
|
-
* */
|
|
28
8
|
deleteByLambda(predicate: ListPredicate<T>): boolean;
|
|
29
9
|
}
|
|
30
10
|
export type ListPredicate<T = unknown> = (value: T, index?: number, arr?: Array<T>) => T;
|
package/dist/class/list.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { ListLike, ListPredicate } from "./index.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Extended array class, ie: Clearable arrays
|
|
4
|
-
* */
|
|
5
2
|
export declare class List<T = unknown> extends Array<T> implements ListLike<T> {
|
|
6
3
|
constructor(...items: Array<T>);
|
|
7
|
-
/** @inheritDoc */
|
|
8
4
|
clear(): number;
|
|
9
|
-
/** @inheritDoc */
|
|
10
5
|
delete(value: T): boolean;
|
|
11
|
-
/** @inheritDoc */
|
|
12
6
|
deleteByLambda(predicate: ListPredicate<T>): boolean;
|
|
13
7
|
}
|
package/dist/class/list.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extended array class, ie: Clearable arrays
|
|
3
|
-
* */
|
|
4
1
|
export class List extends Array {
|
|
5
2
|
constructor(...items) {
|
|
6
3
|
super(...items);
|
|
7
4
|
}
|
|
8
|
-
/** @inheritDoc */
|
|
9
5
|
clear() {
|
|
10
6
|
const size = this.length;
|
|
11
7
|
this.splice(0, this.length);
|
|
12
8
|
return size;
|
|
13
9
|
}
|
|
14
|
-
/** @inheritDoc */
|
|
15
10
|
delete(value) {
|
|
16
11
|
const index = this.indexOf(value);
|
|
17
12
|
if (index >= 0) {
|
|
@@ -20,7 +15,6 @@ export class List extends Array {
|
|
|
20
15
|
}
|
|
21
16
|
return false;
|
|
22
17
|
}
|
|
23
|
-
/** @inheritDoc */
|
|
24
18
|
deleteByLambda(predicate) {
|
|
25
19
|
const index = this.findIndex(predicate);
|
|
26
20
|
if (index >= 0) {
|
|
@@ -7,20 +7,15 @@ export declare class LoggerInstance implements Logger, LoggerSecure {
|
|
|
7
7
|
private _name;
|
|
8
8
|
constructor(name: string);
|
|
9
9
|
static [KEY_LEYYO_SECURE](leyyo: LeyyoLike): void;
|
|
10
|
-
debug(message:
|
|
11
|
-
trace(message:
|
|
12
|
-
info(message:
|
|
13
|
-
warn(message:
|
|
14
|
-
error(message:
|
|
15
|
-
fatal(message:
|
|
16
|
-
/** @inheritDoc */
|
|
10
|
+
debug(message: unknown, params?: unknown | Opt): void;
|
|
11
|
+
trace(message: unknown, params?: unknown | Opt): void;
|
|
12
|
+
info(message: unknown, params?: unknown | Opt): void;
|
|
13
|
+
warn(message: unknown, params?: unknown | Opt): void;
|
|
14
|
+
error(message: unknown, params?: unknown | Opt): void;
|
|
15
|
+
fatal(message: unknown, params?: unknown | Opt): void;
|
|
17
16
|
get $back(): Logger;
|
|
18
|
-
/** @inheritDoc */
|
|
19
17
|
get $secure(): LoggerSecure;
|
|
20
|
-
/** @inheritDoc */
|
|
21
18
|
get $name(): string;
|
|
22
|
-
/** @inheritDoc */
|
|
23
19
|
$refreshName(name: string): void;
|
|
24
|
-
/** @inheritDoc */
|
|
25
20
|
$refreshLevels(level: LogLevel): void;
|
|
26
21
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { isText } from "../function/index.js";
|
|
2
2
|
import { KEY_LEYYO_SECURE } from "../const/index.js";
|
|
3
|
-
// region property
|
|
4
3
|
let _leyyo;
|
|
5
|
-
// endregion property
|
|
6
|
-
// noinspection JSUnusedLocalSymbols
|
|
7
4
|
export class LoggerInstance {
|
|
8
5
|
_name;
|
|
9
6
|
constructor(name) {
|
|
@@ -12,54 +9,44 @@ export class LoggerInstance {
|
|
|
12
9
|
}
|
|
13
10
|
this._name = name;
|
|
14
11
|
}
|
|
15
|
-
// region static
|
|
16
12
|
static [KEY_LEYYO_SECURE](leyyo) {
|
|
17
13
|
if (!_leyyo) {
|
|
18
14
|
_leyyo = leyyo;
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
|
-
// endregion static
|
|
22
|
-
// region levels
|
|
23
17
|
debug(message, params) {
|
|
24
|
-
_leyyo.logCommon.emitLog(
|
|
18
|
+
_leyyo.logCommon.emitLog("debug", this._name, message, params);
|
|
25
19
|
}
|
|
26
20
|
trace(message, params) {
|
|
27
|
-
_leyyo.logCommon.emitLog(
|
|
21
|
+
_leyyo.logCommon.emitLog("trace", this._name, message, params);
|
|
28
22
|
}
|
|
29
23
|
info(message, params) {
|
|
30
|
-
_leyyo.logCommon.emitLog(
|
|
24
|
+
_leyyo.logCommon.emitLog("info", this._name, message, params);
|
|
31
25
|
}
|
|
32
26
|
warn(message, params) {
|
|
33
|
-
_leyyo.logCommon.emitLog(
|
|
27
|
+
_leyyo.logCommon.emitLog("warn", this._name, message, params);
|
|
34
28
|
}
|
|
35
29
|
error(message, params) {
|
|
36
|
-
_leyyo.logCommon.emitLog(
|
|
30
|
+
_leyyo.logCommon.emitLog("error", this._name, message, params);
|
|
37
31
|
}
|
|
38
32
|
fatal(message, params) {
|
|
39
|
-
_leyyo.logCommon.emitLog(
|
|
33
|
+
_leyyo.logCommon.emitLog("fatal", this._name, message, params);
|
|
40
34
|
}
|
|
41
|
-
// endregion levels
|
|
42
|
-
// region secure
|
|
43
|
-
/** @inheritDoc */
|
|
44
35
|
get $back() {
|
|
45
36
|
return this;
|
|
46
37
|
}
|
|
47
|
-
/** @inheritDoc */
|
|
48
38
|
get $secure() {
|
|
49
39
|
return this;
|
|
50
40
|
}
|
|
51
|
-
/** @inheritDoc */
|
|
52
41
|
get $name() {
|
|
53
42
|
return this._name;
|
|
54
43
|
}
|
|
55
|
-
/** @inheritDoc */
|
|
56
44
|
$refreshName(name) {
|
|
57
45
|
if (!isText(name)) {
|
|
58
46
|
return;
|
|
59
47
|
}
|
|
60
48
|
this._name = name;
|
|
61
49
|
}
|
|
62
|
-
/** @inheritDoc */
|
|
63
50
|
$refreshLevels(level) {
|
|
64
51
|
if (!isText(level)) {
|
|
65
52
|
return;
|
|
@@ -73,22 +60,22 @@ export class LoggerInstance {
|
|
|
73
60
|
fatal: true,
|
|
74
61
|
};
|
|
75
62
|
switch (level) {
|
|
76
|
-
case
|
|
63
|
+
case "debug":
|
|
77
64
|
rec.debug = true;
|
|
78
65
|
rec.trace = true;
|
|
79
66
|
rec.info = true;
|
|
80
67
|
rec.warn = true;
|
|
81
68
|
break;
|
|
82
|
-
case
|
|
69
|
+
case "trace":
|
|
83
70
|
rec.trace = true;
|
|
84
71
|
rec.info = true;
|
|
85
72
|
rec.warn = true;
|
|
86
73
|
break;
|
|
87
|
-
case
|
|
74
|
+
case "info":
|
|
88
75
|
rec.info = true;
|
|
89
76
|
rec.warn = true;
|
|
90
77
|
break;
|
|
91
|
-
case
|
|
78
|
+
case "warn":
|
|
92
79
|
rec.warn = true;
|
|
93
80
|
break;
|
|
94
81
|
default:
|
|
@@ -99,8 +86,7 @@ export class LoggerInstance {
|
|
|
99
86
|
this[k] = (message, params) => _leyyo.logCommon.emitLog(k, this._name, message, params);
|
|
100
87
|
}
|
|
101
88
|
else {
|
|
102
|
-
this[k] = (_message, _params) => {
|
|
103
|
-
};
|
|
89
|
+
this[k] = (_message, _params) => { };
|
|
104
90
|
}
|
|
105
91
|
}
|
|
106
92
|
}
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import { Fnc, LeyyoLike } from "../base/index.js";
|
|
2
2
|
import { DeployCommonLike } from "./index.types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Deploy common interface
|
|
5
|
-
* */
|
|
6
3
|
export declare class DeployCommon implements DeployCommonLike {
|
|
7
4
|
private leyyo;
|
|
8
5
|
private _waitingCallbacks;
|
|
9
6
|
private _alreadyDeployed;
|
|
10
7
|
constructor(leyyo: LeyyoLike);
|
|
11
|
-
/**
|
|
12
|
-
* Wait deploy of a component
|
|
13
|
-
*
|
|
14
|
-
* @param {string} name - name of component
|
|
15
|
-
* @param {function} callback - callback for creator of component, if it completes it, this callback will be called
|
|
16
|
-
* */
|
|
17
8
|
wait(name: string, callback: Fnc): void;
|
|
18
|
-
/**
|
|
19
|
-
* Complete deploy of a component
|
|
20
|
-
* - It should be called by owner of component
|
|
21
|
-
*
|
|
22
|
-
* @param {string} name - name of component
|
|
23
|
-
* @param {...Array} values - They will be sent to callback of waiting component, {@link #wait}
|
|
24
|
-
* */
|
|
25
9
|
complete(name: string, ...values: Array<unknown>): void;
|
|
26
10
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { FQN } from "../internal.js";
|
|
2
2
|
import { isText, testCase } from "../function/index.js";
|
|
3
3
|
const where = `${FQN}.DeployCommon`;
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
/**
|
|
6
|
-
* Deploy common interface
|
|
7
|
-
* */
|
|
8
4
|
export class DeployCommon {
|
|
9
5
|
leyyo;
|
|
10
6
|
_waitingCallbacks;
|
|
@@ -14,17 +10,11 @@ export class DeployCommon {
|
|
|
14
10
|
this._waitingCallbacks = this.leyyo.repoCommon.newMap(`${where}.waitingCallbacks`);
|
|
15
11
|
this._alreadyDeployed = this.leyyo.repoCommon.newMap(`${where}.alreadyDeployed`);
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Wait deploy of a component
|
|
19
|
-
*
|
|
20
|
-
* @param {string} name - name of component
|
|
21
|
-
* @param {function} callback - callback for creator of component, if it completes it, this callback will be called
|
|
22
|
-
* */
|
|
23
13
|
wait(name, callback) {
|
|
24
14
|
if (!isText(name)) {
|
|
25
|
-
throw new this.leyyo.developerError(
|
|
15
|
+
throw new this.leyyo.developerError("Invalid component name", testCase(FQN, 120), where);
|
|
26
16
|
}
|
|
27
|
-
if (typeof callback !==
|
|
17
|
+
if (typeof callback !== "function") {
|
|
28
18
|
throw new this.leyyo.developerError(`Invalid caller callback [${name}]`, testCase(FQN, 121), where);
|
|
29
19
|
}
|
|
30
20
|
if (this._alreadyDeployed.has(name)) {
|
|
@@ -41,16 +31,9 @@ export class DeployCommon {
|
|
|
41
31
|
}
|
|
42
32
|
this._waitingCallbacks.get(name).push(callback);
|
|
43
33
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Complete deploy of a component
|
|
46
|
-
* - It should be called by owner of component
|
|
47
|
-
*
|
|
48
|
-
* @param {string} name - name of component
|
|
49
|
-
* @param {...Array} values - They will be sent to callback of waiting component, {@link #wait}
|
|
50
|
-
* */
|
|
51
34
|
complete(name, ...values) {
|
|
52
35
|
if (!isText(name)) {
|
|
53
|
-
throw new this.leyyo.developerError(
|
|
36
|
+
throw new this.leyyo.developerError("Invalid component name", testCase(FQN, 123), where);
|
|
54
37
|
}
|
|
55
38
|
const isNew = !this._alreadyDeployed.has(name);
|
|
56
39
|
this._alreadyDeployed.set(name, values);
|
|
@@ -58,7 +41,7 @@ export class DeployCommon {
|
|
|
58
41
|
if (this._waitingCallbacks.has(name)) {
|
|
59
42
|
const callbacks = this._waitingCallbacks.get(name);
|
|
60
43
|
this._waitingCallbacks.delete(name);
|
|
61
|
-
callbacks.forEach(callback => {
|
|
44
|
+
callbacks.forEach((callback) => {
|
|
62
45
|
try {
|
|
63
46
|
callback(...values);
|
|
64
47
|
}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { Inert } from "./inert.js";
|
|
2
|
-
import { Enum, EnumItemConfig, EnumPoolItem, EnumPoolLike, EnumPoolOpt } from "./index.types.js";
|
|
3
|
-
import { LeyyoLike } from "../base/index.js";
|
|
4
|
-
/**
|
|
5
|
-
* Enum pool for call with name and lazy loading
|
|
6
|
-
* */
|
|
2
|
+
import { Enum, EnumItemConfig, EnumNonFunctional, EnumPoolItem, EnumPoolLike, EnumPoolOpt } from "./index.types.js";
|
|
3
|
+
import { KeyValue, LeyyoLike } from "../base/index.js";
|
|
7
4
|
export declare class EnumPool extends Inert<EnumPoolItem, Enum, EnumPoolOpt> implements EnumPoolLike {
|
|
8
5
|
protected leyyo: LeyyoLike;
|
|
9
6
|
constructor(leyyo: LeyyoLike);
|
|
10
|
-
/** @inheritDoc */
|
|
11
7
|
protected _getName(enm: Enum): string;
|
|
12
|
-
/** @inheritDoc */
|
|
13
8
|
protected _nextLoad(item: EnumPoolItem): Promise<void>;
|
|
14
|
-
/** @inheritDoc */
|
|
15
9
|
protected _setName(enm: Enum, name: string): string;
|
|
16
|
-
/** @inheritDoc */
|
|
17
10
|
protected _afterTargetFound(item: EnumPoolItem): void;
|
|
18
|
-
/** @inheritDoc */
|
|
19
11
|
protected _validate(enm: Enum): boolean;
|
|
20
|
-
/** @inheritDoc */
|
|
21
12
|
setConfigItem(enm: Enum, conf: EnumItemConfig): void;
|
|
22
13
|
getConfigItem(enm: Enum): EnumItemConfig;
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
define(fqn: string, name: string, target: Enum, opt?: Omit<EnumPoolOpt, "name" | "target" | "lazyTarget" | "fqn">): void;
|
|
15
|
+
toLiteral<E extends KeyValue = KeyValue>(enm: Enum<E>): ReadonlyArray<EnumNonFunctional<E>>;
|
|
16
|
+
merge<N>(...maps: Enum[]): N;
|
|
25
17
|
}
|
package/dist/common/enum.pool.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { Inert } from "./inert.js";
|
|
2
|
-
import { getSymbol, isEmpty, isFilledObj, isObj, isText, setSymbol, testCase } from "../function/index.js";
|
|
2
|
+
import { getSymbol, isEmpty, isFilledObj, isObj, isText, setSymbol, testCase, } from "../function/index.js";
|
|
3
3
|
import { FQN } from "../internal.js";
|
|
4
4
|
import { KEY_ENUM_ALT, KEY_ENUM_I18N, KEY_ENUM_NAME } from "../const/index.js";
|
|
5
5
|
const where = `${FQN}.EnumPool`;
|
|
6
|
-
// noinspection JSUnusedGlobalSymbols
|
|
7
|
-
/**
|
|
8
|
-
* Enum pool for call with name and lazy loading
|
|
9
|
-
* */
|
|
10
6
|
export class EnumPool extends Inert {
|
|
11
7
|
leyyo;
|
|
12
8
|
constructor(leyyo) {
|
|
13
|
-
super(leyyo,
|
|
9
|
+
super(leyyo, "enum", {});
|
|
14
10
|
this.leyyo = leyyo;
|
|
15
11
|
}
|
|
16
|
-
// region protected
|
|
17
|
-
/** @inheritDoc */
|
|
18
12
|
_getName(enm) {
|
|
19
13
|
return this.getConfigItem(enm)?.name;
|
|
20
14
|
}
|
|
21
|
-
/** @inheritDoc */
|
|
22
15
|
async _nextLoad(item) {
|
|
23
16
|
if (item.target && item.lazyAlt) {
|
|
24
17
|
try {
|
|
@@ -27,12 +20,11 @@ export class EnumPool extends Inert {
|
|
|
27
20
|
this.setConfigItem(item.target, item);
|
|
28
21
|
}
|
|
29
22
|
catch (e) {
|
|
30
|
-
new this.leyyo.developerError(
|
|
23
|
+
new this.leyyo.developerError("Callback error during loading enum alternate data", testCase(FQN, 186), where).log(e);
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
26
|
delete item.lazyAlt;
|
|
34
27
|
}
|
|
35
|
-
/** @inheritDoc */
|
|
36
28
|
_setName(enm, name) {
|
|
37
29
|
if (isText(name)) {
|
|
38
30
|
setSymbol(enm, KEY_ENUM_NAME, name);
|
|
@@ -40,7 +32,6 @@ export class EnumPool extends Inert {
|
|
|
40
32
|
}
|
|
41
33
|
return undefined;
|
|
42
34
|
}
|
|
43
|
-
/** @inheritDoc */
|
|
44
35
|
_afterTargetFound(item) {
|
|
45
36
|
if (item.lazyTarget) {
|
|
46
37
|
delete item.lazyTarget;
|
|
@@ -50,13 +41,9 @@ export class EnumPool extends Inert {
|
|
|
50
41
|
}
|
|
51
42
|
this.setConfigItem(item.target, item);
|
|
52
43
|
}
|
|
53
|
-
/** @inheritDoc */
|
|
54
44
|
_validate(enm) {
|
|
55
45
|
return isFilledObj(enm);
|
|
56
46
|
}
|
|
57
|
-
// endregion protected
|
|
58
|
-
// region public
|
|
59
|
-
/** @inheritDoc */
|
|
60
47
|
setConfigItem(enm, conf) {
|
|
61
48
|
if (!isObj(conf)) {
|
|
62
49
|
return;
|
|
@@ -81,8 +68,20 @@ export class EnumPool extends Inert {
|
|
|
81
68
|
alt: getSymbol(enm, KEY_ENUM_ALT),
|
|
82
69
|
};
|
|
83
70
|
}
|
|
84
|
-
/** @inheritDoc */
|
|
85
71
|
define(fqn, name, target, opt) {
|
|
86
72
|
this.register({ ...(opt ?? {}), fqn, name, target });
|
|
87
73
|
}
|
|
74
|
+
toLiteral(enm) {
|
|
75
|
+
return Object.keys(enm)
|
|
76
|
+
.filter((key) => isNaN(Number(key)))
|
|
77
|
+
.map((key) => enm[key])
|
|
78
|
+
.filter((val) => ["number", "string"].includes(typeof val));
|
|
79
|
+
}
|
|
80
|
+
merge(...maps) {
|
|
81
|
+
let result = {};
|
|
82
|
+
maps.forEach((item) => {
|
|
83
|
+
result = { ...result, ...item };
|
|
84
|
+
});
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
88
87
|
}
|