@leyyo/common 1.0.1 → 1.0.3
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/assertion/common-assertion-impl.d.ts +3 -4
- package/dist/assertion/common-assertion-impl.js +9 -8
- package/dist/assertion/index-types.d.ts +6 -22
- package/dist/assertion/index.d.ts +0 -1
- package/dist/assertion/index.js +0 -1
- package/dist/error/common-error-impl.d.ts +6 -4
- package/dist/error/common-error-impl.js +8 -4
- package/dist/error/index-types.d.ts +5 -52
- package/dist/error/index.d.ts +0 -5
- package/dist/error/index.js +0 -5
- package/dist/{error → exception}/assertion-exception.d.ts +1 -1
- package/dist/{error → exception}/caused-exception.d.ts +1 -1
- package/dist/{error → exception}/developer-exception.d.ts +1 -1
- package/dist/{error → exception}/exception.d.ts +4 -3
- package/dist/{error → exception}/exception.js +4 -4
- package/dist/exception/index-types.d.ts +30 -0
- package/dist/exception/index.d.ts +6 -0
- package/dist/exception/index.js +22 -0
- package/dist/fqn/common-fqn-impl.d.ts +18 -0
- package/dist/fqn/common-fqn-impl.js +121 -0
- package/dist/fqn/index-types.d.ts +9 -0
- package/dist/fqn/index-types.js +2 -0
- package/dist/fqn/index.d.ts +2 -0
- package/dist/{callback → fqn}/index.js +1 -1
- package/dist/hook/common-hook-impl.d.ts +30 -0
- package/dist/hook/common-hook-impl.js +111 -0
- package/dist/hook/index-types.d.ts +56 -0
- package/dist/hook/index-types.js +2 -0
- package/dist/hook/index.d.ts +2 -0
- package/dist/hook/index.js +18 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +19 -6
- package/dist/is/common-is-impl.js +6 -6
- package/dist/is/index-types.d.ts +2 -3
- package/dist/leyyo/index-types.d.ts +4 -2
- package/dist/leyyo/leyyo-impl.d.ts +4 -2
- package/dist/leyyo/leyyo-impl.js +53 -30
- package/dist/literal/country-code.d.ts +8 -0
- package/dist/literal/country-code.js +17 -0
- package/dist/literal/environment.d.ts +8 -0
- package/dist/literal/environment.js +7 -0
- package/dist/literal/http-method.d.ts +8 -0
- package/dist/literal/http-method.js +7 -0
- package/dist/literal/http-place.d.ts +8 -0
- package/dist/literal/http-place.js +7 -0
- package/dist/literal/index-types.d.ts +6 -0
- package/dist/literal/index-types.js +2 -0
- package/dist/literal/index.d.ts +16 -0
- package/dist/literal/index.js +32 -0
- package/dist/literal/key-value.d.ts +4 -0
- package/dist/literal/key-value.js +7 -0
- package/dist/literal/language-code.d.ts +8 -0
- package/dist/literal/language-code.js +12 -0
- package/dist/literal/locale-code.d.ts +10 -0
- package/dist/literal/locale-code.js +17 -0
- package/dist/literal/primitive.d.ts +8 -0
- package/dist/literal/primitive.js +7 -0
- package/dist/literal/real-value.d.ts +8 -0
- package/dist/literal/real-value.js +7 -0
- package/dist/literal/severity.d.ts +8 -0
- package/dist/literal/severity.js +7 -0
- package/dist/literal/storage-type.d.ts +8 -0
- package/dist/literal/storage-type.js +7 -0
- package/dist/literal/sys-class.d.ts +2 -0
- package/dist/literal/sys-class.js +19 -0
- package/dist/literal/sys-function.d.ts +2 -0
- package/dist/literal/sys-function.js +6 -0
- package/dist/literal/weak-false.d.ts +8 -0
- package/dist/literal/weak-false.js +7 -0
- package/dist/literal/weak-true.d.ts +8 -0
- package/dist/literal/weak-true.js +7 -0
- package/dist/log/common-log-impl.d.ts +3 -2
- package/dist/log/common-log-impl.js +6 -6
- package/dist/log/index-types.d.ts +2 -52
- package/dist/log/index-types.js +0 -1
- package/dist/log/index.d.ts +1 -1
- package/dist/log/index.js +1 -1
- package/dist/log/logger-impl.d.ts +3 -4
- package/dist/log/logger-impl.js +11 -8
- package/dist/{assertion → shared}/assert.js +1 -0
- package/dist/{aliases.d.ts → shared/index-aliases.d.ts} +1 -1
- package/dist/{constants.d.ts → shared/index-constants.d.ts} +1 -0
- package/dist/{constants.js → shared/index-constants.js} +2 -1
- package/dist/shared/index-types.d.ts +142 -0
- package/dist/shared/index-types.js +3 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +21 -0
- package/dist/storage/common-storage-impl.d.ts +3 -3
- package/dist/storage/common-storage-impl.js +3 -3
- package/dist/storage/index-types.d.ts +3 -13
- package/dist/storage/index.d.ts +0 -1
- package/dist/storage/index.js +0 -1
- package/dist/to/common-to-impl.d.ts +3 -3
- package/dist/to/common-to-impl.js +11 -11
- package/dist/to/index-types.d.ts +1 -30
- package/package.json +1 -1
- package/dist/callback/common-callback-impl.d.ts +0 -31
- package/dist/callback/common-callback-impl.js +0 -134
- package/dist/callback/index-types.d.ts +0 -73
- package/dist/callback/index.d.ts +0 -2
- package/dist/literals.d.ts +0 -106
- package/dist/literals.js +0 -81
- package/dist/{error → exception}/assertion-exception.js +0 -0
- package/dist/{error → exception}/caused-exception.js +0 -0
- package/dist/{error → exception}/developer-exception.js +0 -0
- package/dist/{callback → exception}/index-types.js +0 -0
- package/dist/{error → exception}/multiple-exception.d.ts +1 -1
- package/dist/{error → exception}/multiple-exception.js +0 -0
- package/dist/{assertion → shared}/assert.d.ts +1 -1
- /package/dist/{aliases.js → shared/index-aliases.js} +0 -0
- /package/dist/{storage → shared}/list.d.ts +0 -0
- /package/dist/{storage → shared}/list.js +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language code items
|
|
3
|
+
* */
|
|
4
|
+
export declare const LanguageCodeItems: readonly ["af", "an", "ar", "as", "ast", "az", "be", "bg", "bn", "br", "bs", "ca", "ce", "ch", "co", "cr", "cs", "cv", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fa", "fi", "fj", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gu", "he", "hi", "hr", "hsb", "ht", "hu", "hy", "id", "is", "it", "iu", "ja", "ji", "ka", "kk", "km", "kn", "ko", "ks", "ky", "la", "lb", "lt", "lv", "mi", "mk", "ml", "mo", "mr", "ms", "mt", "my", "nb", "ne", "ng", "nl", "nn", "no", "nv", "oc", "om", "or", "pa", "pl", "pt", "qu", "rm", "ro", "ru", "sa", "sb", "sc", "sd", "sg", "si", "sk", "sl", "so", "sq", "sr", "sv", "sw", "sx", "sz", "ta", "te", "th", "tig", "tk", "tlh", "tn", "tr", "ts", "tt", "uk", "ur", "ve", "vi", "vo", "wa", "xh", "zh", "zu"];
|
|
5
|
+
/**
|
|
6
|
+
* Language codes
|
|
7
|
+
* */
|
|
8
|
+
export type LanguageCode = typeof LanguageCodeItems[number];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguageCodeItems = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Language code items
|
|
6
|
+
* */
|
|
7
|
+
exports.LanguageCodeItems = ['af', 'an', 'ar', 'as', 'ast', 'az', 'be', 'bg', 'bn', 'br', 'bs', 'ca', 'ce', 'ch', 'co', 'cr', 'cs',
|
|
8
|
+
'cv', 'cy', 'da', 'de', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fj', 'fo', 'fr', 'fur', 'fy', 'ga', 'gd', 'gl', 'gu', 'he', 'hi',
|
|
9
|
+
'hr', 'hsb', 'ht', 'hu', 'hy', 'id', 'is', 'it', 'iu', 'ja', 'ji', 'ka', 'kk', 'km', 'kn', 'ko', 'ks', 'ky', 'la', 'lb', 'lt', 'lv', 'mi',
|
|
10
|
+
'mk', 'ml', 'mo', 'mr', 'ms', 'mt', 'my', 'nb', 'ne', 'ng', 'nl', 'nn', 'no', 'nv', 'oc', 'om', 'or', 'pa', 'pl', 'pt', 'qu', 'rm', 'ro',
|
|
11
|
+
'ru', 'sa', 'sb', 'sc', 'sd', 'sg', 'si', 'sk', 'sl', 'so', 'sq', 'sr', 'sv', 'sw', 'sx', 'sz', 'ta', 'te', 'th', 'tig', 'tk', 'tlh',
|
|
12
|
+
'tn', 'tr', 'ts', 'tt', 'uk', 'ur', 've', 'vi', 'vo', 'wa', 'xh', 'zh', 'zu'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale code items
|
|
3
|
+
* */
|
|
4
|
+
export declare const LocaleCodeItems: readonly ["af", "an", "ar", "ar-ae", "ar-bh", "ar-dz", "ar-eg", "ar-iq", "ar-jo", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-om", "ar-qa", "ar-sa", "ar-sy", "ar-tn", "ar-ye", "as", "ast", "az", "be", "bg", "bn", "br", "bs", "ca", "ce", "ch", "co", "cr", "cs", "cv", "cy", "da", "de", "de-at", "de-ch", "de-de", "de-li", "de-lu", "el", "en", "en-au", "en-bz", "en-ca", "en-gb", "en-ie", "en-jm", "en-nz", "en-ph", "en-tt", "en-us", "en-za", "en-zw", "eo", "es", "es-ar", "es-bo", "es-cl", "es-co", "es-cr", "es-do", "es-ec", "es-es", "es-gt", "es-hn", "es-mx", "es-ni", "es-pa", "es-pe", "es-pr", "es-py", "es-sv", "es-uy", "es-ve", "et", "eu", "fa", "fa-ir", "fi", "fj", "fo", "fr", "fr-be", "fr-ca", "fr-ch", "fr-fr", "fr-lu", "fr-mc", "fur", "fy", "ga", "gd", "gd-ie", "gl", "gu", "he", "hi", "hr", "hsb", "ht", "hu", "hy", "id", "is", "it", "it-ch", "iu", "ja", "ji", "ka", "kk", "km", "kn", "ko", "ko-kp", "ko-kr", "ks", "ky", "la", "lb", "lt", "lv", "mi", "mk", "ml", "mo", "mr", "ms", "mt", "my", "nb", "ne", "ng", "nl", "nl-be", "nn", "no", "nv", "oc", "om", "or", "pa", "pa-in", "pa-pk", "pl", "pt", "pt-br", "qu", "rm", "ro", "ro-mo", "ru", "ru-mo", "sa", "sb", "sc", "sd", "sg", "si", "sk", "sl", "so", "sq", "sr", "sv", "sv-fi", "sv-sv", "sw", "sx", "sz", "ta", "te", "th", "tig", "tk", "tlh", "tn", "tr", "ts", "tt", "uk", "ur", "ve", "vi", "vo", "wa", "xh", "zh", "zh-cn", "zh-hk", "zh-sg", "zh-tw", "zu"];
|
|
5
|
+
/**
|
|
6
|
+
* Locale codes
|
|
7
|
+
*
|
|
8
|
+
* Pattern: [Language Code]-[Country Code]
|
|
9
|
+
* */
|
|
10
|
+
export type LocaleCode = typeof LocaleCodeItems[number];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocaleCodeItems = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Locale code items
|
|
6
|
+
* */
|
|
7
|
+
exports.LocaleCodeItems = ['af', 'an', 'ar', 'ar-ae', 'ar-bh', 'ar-dz', 'ar-eg', 'ar-iq', 'ar-jo', 'ar-kw', 'ar-lb', 'ar-ly',
|
|
8
|
+
'ar-ma', 'ar-om', 'ar-qa', 'ar-sa', 'ar-sy', 'ar-tn', 'ar-ye', 'as', 'ast', 'az', 'be', 'bg', 'bn', 'br', 'bs', 'ca', 'ce', 'ch',
|
|
9
|
+
'co', 'cr', 'cs', 'cv', 'cy', 'da', 'de', 'de-at', 'de-ch', 'de-de', 'de-li', 'de-lu', 'el', 'en', 'en-au', 'en-bz', 'en-ca',
|
|
10
|
+
'en-gb', 'en-ie', 'en-jm', 'en-nz', 'en-ph', 'en-tt', 'en-us', 'en-za', 'en-zw', 'eo', 'es', 'es-ar', 'es-bo', 'es-cl', 'es-co',
|
|
11
|
+
'es-cr', 'es-do', 'es-ec', 'es-es', 'es-gt', 'es-hn', 'es-mx', 'es-ni', 'es-pa', 'es-pe', 'es-pr', 'es-py', 'es-sv', 'es-uy',
|
|
12
|
+
'es-ve', 'et', 'eu', 'fa', 'fa-ir', 'fi', 'fj', 'fo', 'fr', 'fr-be', 'fr-ca', 'fr-ch', 'fr-fr', 'fr-lu', 'fr-mc', 'fur', 'fy', 'ga',
|
|
13
|
+
'gd', 'gd-ie', 'gl', 'gu', 'he', 'hi', 'hr', 'hsb', 'ht', 'hu', 'hy', 'id', 'is', 'it', 'it-ch', 'iu', 'ja', 'ji', 'ka', 'kk', 'km',
|
|
14
|
+
'kn', 'ko', 'ko-kp', 'ko-kr', 'ks', 'ky', 'la', 'lb', 'lt', 'lv', 'mi', 'mk', 'ml', 'mo', 'mr', 'ms', 'mt', 'my', 'nb', 'ne', 'ng', 'nl',
|
|
15
|
+
'nl-be', 'nn', 'no', 'nv', 'oc', 'om', 'or', 'pa', 'pa-in', 'pa-pk', 'pl', 'pt', 'pt-br', 'qu', 'rm', 'ro', 'ro-mo', 'ru', 'ru-mo',
|
|
16
|
+
'sa', 'sb', 'sc', 'sd', 'sg', 'si', 'sk', 'sl', 'so', 'sq', 'sr', 'sv', 'sv-fi', 'sv-sv', 'sw', 'sx', 'sz', 'ta', 'te', 'th', 'tig',
|
|
17
|
+
'tk', 'tlh', 'tn', 'tr', 'ts', 'tt', 'uk', 'ur', 've', 'vi', 'vo', 'wa', 'xh', 'zh', 'zh-cn', 'zh-hk', 'zh-sg', 'zh-tw', 'zu'];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SysClassItems: readonly ["Function", "Object", "Boolean", "Symbol", "Error", "AggregateError", "EvalError", "InternalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Number", "BigInt", "Math", "Date", "String", "RegExp", "Array", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array", "Map", "Set", "WeakMap", "WeakSet", "ArrayBuffer", "SharedArrayBuffer", "Atomics", "DataView", "JSON", "Promise", "Generator", "GeneratorFunction", "AsyncFunction", "AsyncGenerator", "AsyncGeneratorFunction", "Reflect", "Proxy", "Intl", "Intl.Collator", "Intl.DateTimeFormat", "Intl.ListFormat", "Intl.NumberFormat", "Intl.PluralRules", "Intl.RelativeTimeFormat", "Intl.Locale", "WebAssembly", "WebAssembly.Module", "WebAssembly.Instance", "WebAssembly.Memory", "WebAssembly.Table", "WebAssembly.CompileError", "WebAssembly.LinkError", "WebAssembly.RuntimeError"];
|
|
2
|
+
export type SysClass = typeof SysClassItems[number];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SysClassItems = void 0;
|
|
4
|
+
exports.SysClassItems = [
|
|
5
|
+
'Function', 'Object', 'Boolean', 'Symbol',
|
|
6
|
+
'Error', 'AggregateError', 'EvalError', 'InternalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
|
|
7
|
+
`Number`, `BigInt`, `Math`, `Date`,
|
|
8
|
+
'String', 'RegExp',
|
|
9
|
+
'Array', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array',
|
|
10
|
+
'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array',
|
|
11
|
+
'Map', 'Set', 'WeakMap', 'WeakSet',
|
|
12
|
+
'ArrayBuffer', 'SharedArrayBuffer', 'Atomics', 'DataView', 'JSON',
|
|
13
|
+
'Promise', 'Generator', 'GeneratorFunction', 'AsyncFunction', 'AsyncGenerator', 'AsyncGeneratorFunction',
|
|
14
|
+
'Reflect', 'Proxy',
|
|
15
|
+
'Intl', 'Intl.Collator', 'Intl.DateTimeFormat', 'Intl.ListFormat', 'Intl.NumberFormat',
|
|
16
|
+
'Intl.PluralRules', 'Intl.RelativeTimeFormat', 'Intl.Locale',
|
|
17
|
+
'WebAssembly', 'WebAssembly.Module', 'WebAssembly.Instance', 'WebAssembly.Memory', 'WebAssembly.Table',
|
|
18
|
+
'WebAssembly.CompileError', 'WebAssembly.LinkError', 'WebAssembly.RuntimeError'
|
|
19
|
+
];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SysFunctionItems: readonly ["constructor", "__defineGetter__", "__defineSetter__", "hasOwnProperty", "__lookupGetter__", "__lookupSetter__", "isPrototypeOf", "propertyIsEnumerable", "toString", "valueOf", "__proto__", "toLocaleString", "toJSON", "__esModule"];
|
|
2
|
+
export type SysFunction = typeof SysFunctionItems[number];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SysFunctionItems = void 0;
|
|
4
|
+
exports.SysFunctionItems = ['constructor', '__defineGetter__', '__defineSetter__', 'hasOwnProperty',
|
|
5
|
+
'__lookupGetter__', '__lookupSetter__', 'isPrototypeOf', 'propertyIsEnumerable',
|
|
6
|
+
'toString', 'valueOf', '__proto__', 'toLocaleString', 'toJSON', '__esModule'];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Leyyo } from "../leyyo";
|
|
2
|
-
import { CommonLog, CommonLogSecure
|
|
2
|
+
import { CommonLog, CommonLogSecure } from "./index-types";
|
|
3
|
+
import { Logger, LogLine } from "../shared";
|
|
3
4
|
export declare class CommonLogImpl implements CommonLog, CommonLogSecure {
|
|
4
|
-
private
|
|
5
|
+
private hook;
|
|
5
6
|
constructor();
|
|
6
7
|
get $secure(): CommonLogSecure;
|
|
7
8
|
$init(leyyo: Leyyo): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommonLogImpl = void 0;
|
|
4
4
|
const logger_impl_1 = require("./logger-impl");
|
|
5
|
-
const
|
|
6
|
-
// noinspection JSUnusedLocalSymbols
|
|
5
|
+
const shared_1 = require("../shared");
|
|
6
|
+
// noinspection JSUnusedLocalSymbols,JSUnusedGlobalSymbols
|
|
7
7
|
class CommonLogImpl {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.create.bind(this);
|
|
@@ -15,16 +15,16 @@ class CommonLogImpl {
|
|
|
15
15
|
throw this;
|
|
16
16
|
}
|
|
17
17
|
$init(leyyo) {
|
|
18
|
-
this.
|
|
18
|
+
this.hook = leyyo.hook;
|
|
19
19
|
const fields = ['create', 'apply', 'check', 'print'];
|
|
20
20
|
const rec = { proper: false };
|
|
21
21
|
fields.forEach(field => {
|
|
22
22
|
rec[field] = this[field];
|
|
23
23
|
});
|
|
24
24
|
// define itself temporarily for log operations
|
|
25
|
-
this.
|
|
25
|
+
this.hook.defineProvider(shared_1.LY_ATTACHED_LOG, CommonLogImpl, rec);
|
|
26
26
|
// when new log provider is defined, replace all common methods
|
|
27
|
-
this.
|
|
27
|
+
this.hook.whenProviderDefined(shared_1.LY_ATTACHED_LOG, CommonLogImpl, (ins) => {
|
|
28
28
|
fields.forEach(field => {
|
|
29
29
|
if (typeof ins[field] === 'function') {
|
|
30
30
|
this[field] = ins[field];
|
|
@@ -34,7 +34,7 @@ class CommonLogImpl {
|
|
|
34
34
|
}
|
|
35
35
|
create(clazz) {
|
|
36
36
|
const ins = new logger_impl_1.LoggerImpl(clazz);
|
|
37
|
-
this.
|
|
37
|
+
this.hook.queueForCallback(shared_1.LY_PENDING_LOG_REGISTER, ins, clazz);
|
|
38
38
|
return ins;
|
|
39
39
|
}
|
|
40
40
|
apply(line) {
|
|
@@ -1,55 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Dict, InitLike, ShiftMain, ShiftSecure } from "../aliases";
|
|
3
|
-
import { CommonCallbackDefined } from "../callback";
|
|
1
|
+
import { InitLike, LogConsumer, Logger, ShiftMain, ShiftSecure } from "../shared";
|
|
4
2
|
export interface CommonLog extends ShiftSecure<CommonLogSecure>, LogConsumer {
|
|
5
3
|
create(clazz: Object | Function | string): Logger;
|
|
6
4
|
}
|
|
7
|
-
export
|
|
8
|
-
create?(clazz: Object | Function | string): Logger;
|
|
9
|
-
apply?(line: LogLine): void;
|
|
10
|
-
check?<T>(line: LogLineEnhanced<T>): void;
|
|
11
|
-
print<T>(line: LogLineEnhanced<T>): void;
|
|
12
|
-
}
|
|
13
|
-
export interface CommonLogSecure extends ShiftMain<CommonLog>, InitLike {
|
|
14
|
-
}
|
|
15
|
-
export interface LogConsumer {
|
|
16
|
-
apply(line: LogLine): void;
|
|
17
|
-
}
|
|
18
|
-
export interface LogLine {
|
|
19
|
-
severity: Severity;
|
|
20
|
-
message: string | Error;
|
|
21
|
-
holder?: string;
|
|
22
|
-
params?: Dict;
|
|
23
|
-
}
|
|
24
|
-
export interface LogLineEnhanced<L = Dict> extends LogLine {
|
|
25
|
-
time?: Date;
|
|
26
|
-
locals?: L;
|
|
27
|
-
}
|
|
28
|
-
export interface Logger extends ShiftSecure<LoggerSecure> {
|
|
29
|
-
error(message: string, params?: any): void;
|
|
30
|
-
error(error: Error, params?: any): void;
|
|
31
|
-
error(whatever: any, params?: any): void;
|
|
32
|
-
warn(message: string, params?: any): void;
|
|
33
|
-
warn(error: Error, params?: any): void;
|
|
34
|
-
warn(whatever: any, params?: any): void;
|
|
35
|
-
info(message: string, params?: any): void;
|
|
36
|
-
info(error: Error, params?: any): void;
|
|
37
|
-
info(whatever: any, params?: any): void;
|
|
38
|
-
log(message: string, params?: any): void;
|
|
39
|
-
log(error: Error, params?: any): void;
|
|
40
|
-
log(whatever: any, params?: any): void;
|
|
41
|
-
trace(message: string, params?: any): void;
|
|
42
|
-
trace(error: Error, params?: any): void;
|
|
43
|
-
trace(whatever: any, params?: any): void;
|
|
44
|
-
debug(message: string, params?: any): void;
|
|
45
|
-
debug(error: Error, params?: any): void;
|
|
46
|
-
debug(whatever: any, params?: any): void;
|
|
47
|
-
}
|
|
48
|
-
export interface LoggerSecure extends ShiftMain<Logger> {
|
|
49
|
-
get $clazz(): Function;
|
|
50
|
-
get $name(): string;
|
|
51
|
-
$assert(error: Error, indicator: string, params?: unknown): void;
|
|
52
|
-
$setName(name: string): void;
|
|
53
|
-
$setMethod(method: Severity, lambda?: LoggerLambda): void;
|
|
54
|
-
}
|
|
55
|
-
export type LoggerLambda = (whatever: any, params?: any) => void;
|
|
5
|
+
export type CommonLogSecure = ShiftMain<CommonLog> & InitLike;
|
package/dist/log/index-types.js
CHANGED
package/dist/log/index.d.ts
CHANGED
package/dist/log/index.js
CHANGED
|
@@ -15,5 +15,5 @@ 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("./logger-impl"), exports);
|
|
19
18
|
__exportStar(require("./common-log-impl"), exports);
|
|
19
|
+
__exportStar(require("./logger-impl"), exports);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Logger, LoggerLambda, LoggerSecure } from "./index-types";
|
|
2
1
|
import { Leyyo } from "../leyyo";
|
|
3
|
-
import { Severity } from "../
|
|
2
|
+
import { Severity } from "../literal";
|
|
3
|
+
import { Logger, LoggerLambda, LoggerSecure } from "../shared";
|
|
4
4
|
export declare class LoggerImpl implements Logger, LoggerSecure {
|
|
5
5
|
private readonly _clazz;
|
|
6
6
|
private _name;
|
|
7
|
-
private static
|
|
7
|
+
private static _fqn;
|
|
8
8
|
private static _log;
|
|
9
9
|
constructor(value: Object | Function | string);
|
|
10
10
|
debug(message: any, params?: any): void;
|
|
@@ -18,7 +18,6 @@ export declare class LoggerImpl implements Logger, LoggerSecure {
|
|
|
18
18
|
get $clazz(): Function;
|
|
19
19
|
get $name(): string;
|
|
20
20
|
static $setLeyyo(leyyo: Leyyo): void;
|
|
21
|
-
$setName(name: string): void;
|
|
22
21
|
$setMethod(method: Severity, lambda?: LoggerLambda): void;
|
|
23
22
|
$assert(error: Error, indicator: string, params?: unknown): void;
|
|
24
23
|
}
|
package/dist/log/logger-impl.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoggerImpl = void 0;
|
|
4
|
-
const
|
|
4
|
+
const exception_1 = require("../exception");
|
|
5
5
|
// noinspection JSUnusedLocalSymbols
|
|
6
6
|
class LoggerImpl {
|
|
7
7
|
constructor(value) {
|
|
8
8
|
switch (typeof value) {
|
|
9
9
|
case "function":
|
|
10
10
|
this._clazz = value;
|
|
11
|
-
this._name = LoggerImpl.
|
|
11
|
+
this._name = LoggerImpl._fqn.name(value);
|
|
12
12
|
break;
|
|
13
13
|
case "object":
|
|
14
14
|
this._clazz = value.constructor;
|
|
15
|
-
this._name = LoggerImpl.
|
|
15
|
+
this._name = LoggerImpl._fqn.name(value);
|
|
16
16
|
break;
|
|
17
17
|
case "string":
|
|
18
18
|
this._name = value;
|
|
19
19
|
break;
|
|
20
20
|
default:
|
|
21
|
-
throw new
|
|
21
|
+
throw new exception_1.DeveloperException('invalid.logger.name', { type: typeof value });
|
|
22
|
+
}
|
|
23
|
+
// when this object is signed by FQN, then refresh logger name
|
|
24
|
+
if (!LoggerImpl._fqn.exists(value)) {
|
|
25
|
+
LoggerImpl._fqn.addHook(value, (name) => {
|
|
26
|
+
this._name = name;
|
|
27
|
+
});
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
debug(message, params) {
|
|
@@ -53,12 +59,9 @@ class LoggerImpl {
|
|
|
53
59
|
return this._name;
|
|
54
60
|
}
|
|
55
61
|
static $setLeyyo(leyyo) {
|
|
56
|
-
this.
|
|
62
|
+
this._fqn = leyyo.fqn;
|
|
57
63
|
this._log = leyyo.log;
|
|
58
64
|
}
|
|
59
|
-
$setName(name) {
|
|
60
|
-
this._name = name;
|
|
61
|
-
}
|
|
62
65
|
$setMethod(method, lambda) {
|
|
63
66
|
if (typeof lambda === 'function') {
|
|
64
67
|
this[method] = lambda;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageCode, LocaleCode } from "
|
|
1
|
+
import { LanguageCode, LocaleCode } from "../literal";
|
|
2
2
|
export type BasicType = 'undefined' | 'string' | 'object' | 'number' | 'boolean' | 'function' | 'symbol' | 'bigint';
|
|
3
3
|
export type Dict<T = any> = Record<KeyValue, T>;
|
|
4
4
|
export type Arr<T = any> = Array<T>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const LY_ATTACHED_ERROR = "#lyy.attached.error";
|
|
2
2
|
export declare const LY_PENDING_ERROR_REGISTER = "#lyy.pending.error.register";
|
|
3
3
|
export declare const LY_PENDING_ENUM_REGISTER = "#lyy.pending.enum.register";
|
|
4
|
+
export declare const LY_SIGN_FQN_HOOK: unique symbol;
|
|
4
5
|
export declare const LY_ATTACHED_FQN = "#lyy.attached.fqn";
|
|
5
6
|
export declare const LY_PENDING_FQN_REGISTER = "#lyy.pending.fqn.register";
|
|
6
7
|
export declare const LY_ATTACHED_LOG = "#lyy.attached.log";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LY_PENDING_LOG_REGISTER = exports.LY_ATTACHED_LOG = exports.LY_PENDING_FQN_REGISTER = exports.LY_ATTACHED_FQN = exports.LY_PENDING_ENUM_REGISTER = exports.LY_PENDING_ERROR_REGISTER = exports.LY_ATTACHED_ERROR = void 0;
|
|
3
|
+
exports.LY_PENDING_LOG_REGISTER = exports.LY_ATTACHED_LOG = exports.LY_PENDING_FQN_REGISTER = exports.LY_ATTACHED_FQN = exports.LY_SIGN_FQN_HOOK = exports.LY_PENDING_ENUM_REGISTER = exports.LY_PENDING_ERROR_REGISTER = exports.LY_ATTACHED_ERROR = void 0;
|
|
4
4
|
exports.LY_ATTACHED_ERROR = '#lyy.attached.error';
|
|
5
5
|
exports.LY_PENDING_ERROR_REGISTER = '#lyy.pending.error.register';
|
|
6
6
|
exports.LY_PENDING_ENUM_REGISTER = '#lyy.pending.enum.register';
|
|
7
|
+
exports.LY_SIGN_FQN_HOOK = Symbol.for(`#lyy.fqn.h`);
|
|
7
8
|
exports.LY_ATTACHED_FQN = '#lyy.attached.fqn';
|
|
8
9
|
exports.LY_PENDING_FQN_REGISTER = '#lyy.pending.fqn.register';
|
|
9
10
|
exports.LY_ATTACHED_LOG = '#lyy.attached.log';
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Dict, KeyValue, OneOrMore, ShiftMain, ShiftSecure } from "./index-aliases";
|
|
2
|
+
import { Exception, ExceptionLike } from "../exception";
|
|
3
|
+
import { Severity, StorageType } from "../literal";
|
|
4
|
+
export interface AssertionOpt {
|
|
5
|
+
indicator?: AssertionReason | string;
|
|
6
|
+
param?: string;
|
|
7
|
+
where?: string;
|
|
8
|
+
value?: any;
|
|
9
|
+
expected?: OneOrMore<string>;
|
|
10
|
+
current?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
[k: string]: any;
|
|
13
|
+
}
|
|
14
|
+
type AssertionReason = 'invalid.type' | 'not.found' | 'duplicated' | 'empty';
|
|
15
|
+
export type AssertionCallback = () => string | AssertionOpt;
|
|
16
|
+
export interface AssertionBuiltResult {
|
|
17
|
+
message?: string;
|
|
18
|
+
params: AssertionOpt;
|
|
19
|
+
}
|
|
20
|
+
export interface HookAttachedCallback {
|
|
21
|
+
initialization?: true;
|
|
22
|
+
fn: Function;
|
|
23
|
+
}
|
|
24
|
+
export interface $HookDefinedProvider extends HookDefinedProvider {
|
|
25
|
+
producer: Function;
|
|
26
|
+
}
|
|
27
|
+
export interface HookDefinedProvider {
|
|
28
|
+
proper: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface HookWaitingProviderItem {
|
|
31
|
+
consumer: Function;
|
|
32
|
+
callback: HookDefinedProviderLambda;
|
|
33
|
+
}
|
|
34
|
+
export type HookDefinedProviderLambda<T extends HookDefinedProvider = HookDefinedProvider> = (instance: T) => void;
|
|
35
|
+
export interface FqnDefinedProvider extends HookDefinedProvider {
|
|
36
|
+
exists(target: any): boolean;
|
|
37
|
+
name(target: any): string;
|
|
38
|
+
register(name: string, target: any, type: FqnStereoType, pckName: string): void;
|
|
39
|
+
}
|
|
40
|
+
export type FqnStereoType = 'class' | 'function' | 'enum' | 'literal';
|
|
41
|
+
export type CommonFqnHook = (name: string) => void;
|
|
42
|
+
export interface ErrorDefinedProvider extends HookDefinedProvider {
|
|
43
|
+
register(exception: ExceptionLike): void;
|
|
44
|
+
build?(e: Error | string): ExceptionLike;
|
|
45
|
+
afterCreate?(e: ExceptionLike): void;
|
|
46
|
+
causedBy?(e: Error | string): ExceptionLike;
|
|
47
|
+
initSign?(err: Error): boolean;
|
|
48
|
+
addSign?(err: Error, ...keys: Array<string>): boolean;
|
|
49
|
+
getSign?(err: Error): Array<string>;
|
|
50
|
+
removeSign?(err: Error, ...keys: Array<string>): boolean;
|
|
51
|
+
hasSign?(err: Error, key: string): boolean;
|
|
52
|
+
toObject?(e: Error, ...omittedFields: Array<string>): Dict;
|
|
53
|
+
buildStack?(e: Error): void;
|
|
54
|
+
copyStack?(exception: Exception, error: Error): void;
|
|
55
|
+
initOmit?(clz: Function): boolean;
|
|
56
|
+
addOmit?(clz: Function, ...properties: Array<string>): boolean;
|
|
57
|
+
getOmit?(clz: Function): Array<string>;
|
|
58
|
+
inheritOmit?(clz: Function): Array<string>;
|
|
59
|
+
}
|
|
60
|
+
export interface LogDefinedProvider extends HookDefinedProvider {
|
|
61
|
+
create?(clazz: Object | Function | string): Logger;
|
|
62
|
+
apply?(line: LogLine): void;
|
|
63
|
+
check?<T>(line: LogLineEnhanced<T>): void;
|
|
64
|
+
print<T>(line: LogLineEnhanced<T>): void;
|
|
65
|
+
}
|
|
66
|
+
export interface LogConsumer {
|
|
67
|
+
apply(line: LogLine): void;
|
|
68
|
+
}
|
|
69
|
+
export interface LogLine {
|
|
70
|
+
severity: Severity;
|
|
71
|
+
message: string | Error;
|
|
72
|
+
holder?: string;
|
|
73
|
+
params?: Dict;
|
|
74
|
+
}
|
|
75
|
+
export interface LogLineEnhanced<L = Dict> extends LogLine {
|
|
76
|
+
time?: Date;
|
|
77
|
+
locals?: L;
|
|
78
|
+
}
|
|
79
|
+
export interface Logger extends ShiftSecure<LoggerSecure> {
|
|
80
|
+
error(message: string, params?: any): void;
|
|
81
|
+
error(error: Error, params?: any): void;
|
|
82
|
+
error(whatever: any, params?: any): void;
|
|
83
|
+
warn(message: string, params?: any): void;
|
|
84
|
+
warn(error: Error, params?: any): void;
|
|
85
|
+
warn(whatever: any, params?: any): void;
|
|
86
|
+
info(message: string, params?: any): void;
|
|
87
|
+
info(error: Error, params?: any): void;
|
|
88
|
+
info(whatever: any, params?: any): void;
|
|
89
|
+
log(message: string, params?: any): void;
|
|
90
|
+
log(error: Error, params?: any): void;
|
|
91
|
+
log(whatever: any, params?: any): void;
|
|
92
|
+
trace(message: string, params?: any): void;
|
|
93
|
+
trace(error: Error, params?: any): void;
|
|
94
|
+
trace(whatever: any, params?: any): void;
|
|
95
|
+
debug(message: string, params?: any): void;
|
|
96
|
+
debug(error: Error, params?: any): void;
|
|
97
|
+
debug(whatever: any, params?: any): void;
|
|
98
|
+
}
|
|
99
|
+
export interface LoggerSecure extends ShiftMain<Logger> {
|
|
100
|
+
get $clazz(): Function;
|
|
101
|
+
get $name(): string;
|
|
102
|
+
$assert(error: Error, indicator: string, params?: unknown): void;
|
|
103
|
+
$setMethod(method: Severity, lambda?: LoggerLambda): void;
|
|
104
|
+
}
|
|
105
|
+
export type LoggerLambda = (whatever: any, params?: any) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Storage size dictionary which in corresponding type
|
|
108
|
+
* */
|
|
109
|
+
export type StorageItem = Dict<number>;
|
|
110
|
+
/**
|
|
111
|
+
* Storage export dictionary which includes items
|
|
112
|
+
* */
|
|
113
|
+
export type StorageDetail = Record<StorageType, StorageItem>;
|
|
114
|
+
export interface ToTypeOpt extends AssertionOpt {
|
|
115
|
+
silent?: true;
|
|
116
|
+
children?: unknown;
|
|
117
|
+
}
|
|
118
|
+
export type ToTypeFnLambda<T = unknown, O extends ToTypeOpt = ToTypeOpt> = (value: unknown, opt?: O) => T;
|
|
119
|
+
export interface ToTypeChildOpt<T = unknown> extends ToTypeOpt {
|
|
120
|
+
fn?: ToTypeFnLambda<T>;
|
|
121
|
+
}
|
|
122
|
+
export interface ToTypeArrayChildOpt<V extends ToTypeChildOpt = ToTypeChildOpt> extends Dict<ToTypeChildOpt> {
|
|
123
|
+
value?: V;
|
|
124
|
+
}
|
|
125
|
+
export interface ToTypeArrayOpt<V extends ToTypeChildOpt = ToTypeChildOpt> extends ToTypeOpt {
|
|
126
|
+
children?: ToTypeArrayChildOpt<V>;
|
|
127
|
+
}
|
|
128
|
+
export interface ToTypeDictChildOpt<K extends ToTypeChildOpt = ToTypeChildOpt, V extends ToTypeChildOpt = ToTypeChildOpt> extends Record<string, ToTypeChildOpt> {
|
|
129
|
+
key?: K;
|
|
130
|
+
value?: V;
|
|
131
|
+
}
|
|
132
|
+
export interface ToTypeObjectOpt<K extends ToTypeChildOpt = ToTypeChildOpt, V extends ToTypeChildOpt = ToTypeChildOpt> extends ToTypeOpt {
|
|
133
|
+
children?: ToTypeDictChildOpt<K, V>;
|
|
134
|
+
}
|
|
135
|
+
export interface ToTypeEnumOpt<E extends KeyValue = KeyValue> extends ToTypeOpt {
|
|
136
|
+
map: EnumerationMap<E> | EnumerationArray<E>;
|
|
137
|
+
alt?: EnumerationAlt<E>;
|
|
138
|
+
}
|
|
139
|
+
export type EnumerationMap<E extends KeyValue = KeyValue> = Dict<E>;
|
|
140
|
+
export type EnumerationAlt<E extends KeyValue = KeyValue> = Dict<E>;
|
|
141
|
+
export type EnumerationArray<E extends KeyValue = KeyValue> = Array<E>;
|
|
142
|
+
export {};
|