@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.
Files changed (112) hide show
  1. package/dist/assertion/common-assertion-impl.d.ts +3 -4
  2. package/dist/assertion/common-assertion-impl.js +9 -8
  3. package/dist/assertion/index-types.d.ts +6 -22
  4. package/dist/assertion/index.d.ts +0 -1
  5. package/dist/assertion/index.js +0 -1
  6. package/dist/error/common-error-impl.d.ts +6 -4
  7. package/dist/error/common-error-impl.js +8 -4
  8. package/dist/error/index-types.d.ts +5 -52
  9. package/dist/error/index.d.ts +0 -5
  10. package/dist/error/index.js +0 -5
  11. package/dist/{error → exception}/assertion-exception.d.ts +1 -1
  12. package/dist/{error → exception}/caused-exception.d.ts +1 -1
  13. package/dist/{error → exception}/developer-exception.d.ts +1 -1
  14. package/dist/{error → exception}/exception.d.ts +4 -3
  15. package/dist/{error → exception}/exception.js +4 -4
  16. package/dist/exception/index-types.d.ts +30 -0
  17. package/dist/exception/index.d.ts +6 -0
  18. package/dist/exception/index.js +22 -0
  19. package/dist/fqn/common-fqn-impl.d.ts +18 -0
  20. package/dist/fqn/common-fqn-impl.js +121 -0
  21. package/dist/fqn/index-types.d.ts +9 -0
  22. package/dist/fqn/index-types.js +2 -0
  23. package/dist/fqn/index.d.ts +2 -0
  24. package/dist/{callback → fqn}/index.js +1 -1
  25. package/dist/hook/common-hook-impl.d.ts +30 -0
  26. package/dist/hook/common-hook-impl.js +111 -0
  27. package/dist/hook/index-types.d.ts +56 -0
  28. package/dist/hook/index-types.js +2 -0
  29. package/dist/hook/index.d.ts +2 -0
  30. package/dist/hook/index.js +18 -0
  31. package/dist/index.d.ts +11 -5
  32. package/dist/index.js +19 -6
  33. package/dist/is/common-is-impl.js +6 -6
  34. package/dist/is/index-types.d.ts +2 -3
  35. package/dist/leyyo/index-types.d.ts +4 -2
  36. package/dist/leyyo/leyyo-impl.d.ts +4 -2
  37. package/dist/leyyo/leyyo-impl.js +53 -30
  38. package/dist/literal/country-code.d.ts +8 -0
  39. package/dist/literal/country-code.js +17 -0
  40. package/dist/literal/environment.d.ts +8 -0
  41. package/dist/literal/environment.js +7 -0
  42. package/dist/literal/http-method.d.ts +8 -0
  43. package/dist/literal/http-method.js +7 -0
  44. package/dist/literal/http-place.d.ts +8 -0
  45. package/dist/literal/http-place.js +7 -0
  46. package/dist/literal/index-types.d.ts +6 -0
  47. package/dist/literal/index-types.js +2 -0
  48. package/dist/literal/index.d.ts +16 -0
  49. package/dist/literal/index.js +32 -0
  50. package/dist/literal/key-value.d.ts +4 -0
  51. package/dist/literal/key-value.js +7 -0
  52. package/dist/literal/language-code.d.ts +8 -0
  53. package/dist/literal/language-code.js +12 -0
  54. package/dist/literal/locale-code.d.ts +10 -0
  55. package/dist/literal/locale-code.js +17 -0
  56. package/dist/literal/primitive.d.ts +8 -0
  57. package/dist/literal/primitive.js +7 -0
  58. package/dist/literal/real-value.d.ts +8 -0
  59. package/dist/literal/real-value.js +7 -0
  60. package/dist/literal/severity.d.ts +8 -0
  61. package/dist/literal/severity.js +7 -0
  62. package/dist/literal/storage-type.d.ts +8 -0
  63. package/dist/literal/storage-type.js +7 -0
  64. package/dist/literal/sys-class.d.ts +2 -0
  65. package/dist/literal/sys-class.js +19 -0
  66. package/dist/literal/sys-function.d.ts +2 -0
  67. package/dist/literal/sys-function.js +6 -0
  68. package/dist/literal/weak-false.d.ts +8 -0
  69. package/dist/literal/weak-false.js +7 -0
  70. package/dist/literal/weak-true.d.ts +8 -0
  71. package/dist/literal/weak-true.js +7 -0
  72. package/dist/log/common-log-impl.d.ts +3 -2
  73. package/dist/log/common-log-impl.js +6 -6
  74. package/dist/log/index-types.d.ts +2 -52
  75. package/dist/log/index-types.js +0 -1
  76. package/dist/log/index.d.ts +1 -1
  77. package/dist/log/index.js +1 -1
  78. package/dist/log/logger-impl.d.ts +3 -4
  79. package/dist/log/logger-impl.js +11 -8
  80. package/dist/{assertion → shared}/assert.js +1 -0
  81. package/dist/{aliases.d.ts → shared/index-aliases.d.ts} +1 -1
  82. package/dist/{constants.d.ts → shared/index-constants.d.ts} +1 -0
  83. package/dist/{constants.js → shared/index-constants.js} +2 -1
  84. package/dist/shared/index-types.d.ts +142 -0
  85. package/dist/shared/index-types.js +3 -0
  86. package/dist/shared/index.d.ts +5 -0
  87. package/dist/shared/index.js +21 -0
  88. package/dist/storage/common-storage-impl.d.ts +3 -3
  89. package/dist/storage/common-storage-impl.js +3 -3
  90. package/dist/storage/index-types.d.ts +3 -13
  91. package/dist/storage/index.d.ts +0 -1
  92. package/dist/storage/index.js +0 -1
  93. package/dist/to/common-to-impl.d.ts +3 -3
  94. package/dist/to/common-to-impl.js +11 -11
  95. package/dist/to/index-types.d.ts +1 -30
  96. package/package.json +1 -1
  97. package/dist/callback/common-callback-impl.d.ts +0 -31
  98. package/dist/callback/common-callback-impl.js +0 -134
  99. package/dist/callback/index-types.d.ts +0 -73
  100. package/dist/callback/index.d.ts +0 -2
  101. package/dist/literals.d.ts +0 -106
  102. package/dist/literals.js +0 -81
  103. package/dist/{error → exception}/assertion-exception.js +0 -0
  104. package/dist/{error → exception}/caused-exception.js +0 -0
  105. package/dist/{error → exception}/developer-exception.js +0 -0
  106. package/dist/{callback → exception}/index-types.js +0 -0
  107. package/dist/{error → exception}/multiple-exception.d.ts +1 -1
  108. package/dist/{error → exception}/multiple-exception.js +0 -0
  109. package/dist/{assertion → shared}/assert.d.ts +1 -1
  110. /package/dist/{aliases.js → shared/index-aliases.js} +0 -0
  111. /package/dist/{storage → shared}/list.d.ts +0 -0
  112. /package/dist/{storage → shared}/list.js +0 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyValueItems = void 0;
4
+ /**
5
+ * Key Value items
6
+ * */
7
+ exports.KeyValueItems = ['string', 'number'];
@@ -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,8 @@
1
+ /**
2
+ * Primitive items
3
+ * */
4
+ export declare const PrimitiveItems: readonly ["string", "number", "boolean"];
5
+ /**
6
+ * Primitive
7
+ * */
8
+ export type Primitive = typeof PrimitiveItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrimitiveItems = void 0;
4
+ /**
5
+ * Primitive items
6
+ * */
7
+ exports.PrimitiveItems = ['string', 'number', 'boolean'];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Real Value items
3
+ * */
4
+ export declare const RealValueItems: readonly ["string", "number", "bigint", "boolean", "object", "function"];
5
+ /**
6
+ * Real Value
7
+ * */
8
+ export type RealValue = typeof RealValueItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RealValueItems = void 0;
4
+ /**
5
+ * Real Value items
6
+ * */
7
+ exports.RealValueItems = ['string', 'number', 'bigint', 'boolean', 'object', 'function'];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Severity items
3
+ * */
4
+ export declare const SeverityItems: readonly ["debug", "error", "fatal", "info", "log", "trace", "warn"];
5
+ /**
6
+ * Severity for log and errors
7
+ * */
8
+ export type Severity = typeof SeverityItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SeverityItems = void 0;
4
+ /**
5
+ * Severity items
6
+ * */
7
+ exports.SeverityItems = ['debug', 'error', 'fatal', 'info', 'log', 'trace', 'warn'];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Weak True items
3
+ * */
4
+ export declare const StorageTypeItems: readonly ["array", "list", "map", "set"];
5
+ /**
6
+ * Storage type literal, as an enum
7
+ * */
8
+ export type StorageType = typeof StorageTypeItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageTypeItems = void 0;
4
+ /**
5
+ * Weak True items
6
+ * */
7
+ exports.StorageTypeItems = ['array', 'list', 'map', 'set'];
@@ -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'];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Weak False items
3
+ * */
4
+ export declare const WeakFalseItems: readonly ["0", "-1", "false", "f", "no", "n", "off"];
5
+ /**
6
+ * Weak False
7
+ * */
8
+ export type WeakFalse = typeof WeakFalseItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WeakFalseItems = void 0;
4
+ /**
5
+ * Weak False items
6
+ * */
7
+ exports.WeakFalseItems = ['0', '-1', 'false', 'f', 'no', 'n', 'off'];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Weak True items
3
+ * */
4
+ export declare const WeakTrueItems: readonly ["1", "true", "t", "yes", "y", "on"];
5
+ /**
6
+ * Weak True
7
+ * */
8
+ export type WeakTrue = typeof WeakTrueItems[number];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WeakTrueItems = void 0;
4
+ /**
5
+ * Weak True items
6
+ * */
7
+ exports.WeakTrueItems = ['1', 'true', 't', 'yes', 'y', 'on'];
@@ -1,7 +1,8 @@
1
1
  import { Leyyo } from "../leyyo";
2
- import { CommonLog, CommonLogSecure, Logger, LogLine } from "./index-types";
2
+ import { CommonLog, CommonLogSecure } from "./index-types";
3
+ import { Logger, LogLine } from "../shared";
3
4
  export declare class CommonLogImpl implements CommonLog, CommonLogSecure {
4
- private callback;
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 constants_1 = require("../constants");
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.callback = leyyo.callback;
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.callback.defineProvider(constants_1.LY_ATTACHED_LOG, CommonLogImpl, rec);
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.callback.whenProviderDefined(constants_1.LY_ATTACHED_LOG, CommonLogImpl, (ins) => {
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.callback.queueForCallback(constants_1.LY_PENDING_LOG_REGISTER, ins, clazz);
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 { Severity } from "../literals";
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 interface CommonLogCb extends CommonCallbackDefined {
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;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // endregion logger
@@ -1,3 +1,3 @@
1
1
  export * from './index-types';
2
- export * from './logger-impl';
3
2
  export * from './common-log-impl';
3
+ export * from './logger-impl';
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 "../literals";
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 _callback;
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
  }
@@ -1,24 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoggerImpl = void 0;
4
- const error_1 = require("../error");
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._callback.fqnName(value);
11
+ this._name = LoggerImpl._fqn.name(value);
12
12
  break;
13
13
  case "object":
14
14
  this._clazz = value.constructor;
15
- this._name = LoggerImpl._callback.fqnName(value);
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 error_1.DeveloperException('invalid.logger.name', { type: typeof value });
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._callback = leyyo.callback;
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,5 @@
1
1
  "use strict";
2
+ // noinspection JSUnusedGlobalSymbols
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.assert = assert;
4
5
  exports.$$setLeyyo = $$setLeyyo;
@@ -1,4 +1,4 @@
1
- import { LanguageCode, LocaleCode } from "./literals";
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 {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // endregion to
@@ -0,0 +1,5 @@
1
+ export * from './index-aliases';
2
+ export * from './index-constants';
3
+ export * from './index-types';
4
+ export * from './assert';
5
+ export * from './list';