@leyyo/common 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/assertion/common-assertion-impl.d.ts +38 -7
  2. package/dist/assertion/common-assertion-impl.js +64 -26
  3. package/dist/assertion/index-types.d.ts +466 -75
  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 -54
  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 +11 -0
  20. package/dist/fqn/common-fqn-impl.js +47 -0
  21. package/dist/fqn/index-types.d.ts +6 -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.d.ts +36 -15
  34. package/dist/is/common-is-impl.js +35 -10
  35. package/dist/is/index-types.d.ts +142 -20
  36. package/dist/leyyo/index-types.d.ts +4 -2
  37. package/dist/leyyo/leyyo-impl.d.ts +4 -2
  38. package/dist/leyyo/leyyo-impl.js +37 -29
  39. package/dist/literal/country-code.d.ts +8 -0
  40. package/dist/literal/country-code.js +17 -0
  41. package/dist/literal/environment.d.ts +8 -0
  42. package/dist/literal/environment.js +7 -0
  43. package/dist/literal/http-method.d.ts +8 -0
  44. package/dist/literal/http-method.js +7 -0
  45. package/dist/literal/http-place.d.ts +8 -0
  46. package/dist/literal/http-place.js +7 -0
  47. package/dist/literal/index-types.d.ts +6 -0
  48. package/dist/literal/index-types.js +2 -0
  49. package/dist/literal/index.d.ts +14 -0
  50. package/dist/literal/index.js +30 -0
  51. package/dist/literal/key-value.d.ts +4 -0
  52. package/dist/literal/key-value.js +7 -0
  53. package/dist/literal/language-code.d.ts +8 -0
  54. package/dist/literal/language-code.js +12 -0
  55. package/dist/literal/locale-code.d.ts +10 -0
  56. package/dist/literal/locale-code.js +17 -0
  57. package/dist/literal/primitive.d.ts +8 -0
  58. package/dist/literal/primitive.js +7 -0
  59. package/dist/literal/real-value.d.ts +8 -0
  60. package/dist/literal/real-value.js +7 -0
  61. package/dist/literal/severity.d.ts +8 -0
  62. package/dist/literal/severity.js +7 -0
  63. package/dist/literal/storage-type.d.ts +8 -0
  64. package/dist/literal/storage-type.js +7 -0
  65. package/dist/literal/weak-false.d.ts +8 -0
  66. package/dist/literal/weak-false.js +7 -0
  67. package/dist/literal/weak-true.d.ts +8 -0
  68. package/dist/literal/weak-true.js +7 -0
  69. package/dist/log/common-log-impl.d.ts +3 -2
  70. package/dist/log/common-log-impl.js +6 -6
  71. package/dist/log/index-types.d.ts +2 -55
  72. package/dist/log/index-types.js +0 -1
  73. package/dist/log/index.d.ts +1 -1
  74. package/dist/log/index.js +1 -1
  75. package/dist/log/logger-impl.d.ts +4 -3
  76. package/dist/log/logger-impl.js +7 -6
  77. package/dist/{assertion → shared}/assert.js +1 -0
  78. package/dist/{aliases.d.ts → shared/index-aliases.d.ts} +32 -4
  79. package/dist/shared/index-types.d.ts +141 -0
  80. package/dist/shared/index-types.js +3 -0
  81. package/dist/shared/index.d.ts +5 -0
  82. package/dist/shared/index.js +21 -0
  83. package/dist/storage/common-storage-impl.d.ts +3 -2
  84. package/dist/storage/common-storage-impl.js +3 -3
  85. package/dist/storage/index-types.d.ts +3 -18
  86. package/dist/storage/index.d.ts +0 -1
  87. package/dist/storage/index.js +0 -1
  88. package/dist/to/common-to-impl.d.ts +19 -19
  89. package/dist/to/common-to-impl.js +11 -11
  90. package/dist/to/index-types.d.ts +18 -48
  91. package/package.json +1 -1
  92. package/dist/callback/common-callback-impl.d.ts +0 -31
  93. package/dist/callback/common-callback-impl.js +0 -134
  94. package/dist/callback/index-types.d.ts +0 -75
  95. package/dist/callback/index.d.ts +0 -2
  96. package/dist/literals.d.ts +0 -98
  97. package/dist/literals.js +0 -77
  98. package/dist/{error → exception}/assertion-exception.js +0 -0
  99. package/dist/{error → exception}/caused-exception.js +0 -0
  100. package/dist/{error → exception}/developer-exception.js +0 -0
  101. package/dist/{callback → exception}/index-types.js +0 -0
  102. package/dist/{error → exception}/multiple-exception.d.ts +1 -1
  103. package/dist/{error → exception}/multiple-exception.js +0 -0
  104. package/dist/{assertion → shared}/assert.d.ts +1 -1
  105. /package/dist/{aliases.js → shared/index-aliases.js} +0 -0
  106. /package/dist/{constants.d.ts → shared/index-constants.d.ts} +0 -0
  107. /package/dist/{constants.js → shared/index-constants.js} +0 -0
  108. /package/dist/{storage → shared}/list.d.ts +0 -0
  109. /package/dist/{storage → shared}/list.js +0 -0
@@ -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,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,58 +1,5 @@
1
- import { Leyyo } from "../leyyo";
2
- import { Severity } from "../literals";
3
- import { Dict, ShiftMain, ShiftSecure } from "../aliases";
4
- import { CommonCallbackDefined } from "../callback";
1
+ import { InitLike, LogConsumer, Logger, ShiftMain, ShiftSecure } from "../shared";
5
2
  export interface CommonLog extends ShiftSecure<CommonLogSecure>, LogConsumer {
6
3
  create(clazz: Object | Function | string): Logger;
7
4
  }
8
- export interface CommonLogCb extends CommonCallbackDefined {
9
- create?(clazz: Object | Function | string): Logger;
10
- apply?(line: LogLine): void;
11
- check?<T>(line: LogLineEnhanced<T>): void;
12
- print<T>(line: LogLineEnhanced<T>): void;
13
- }
14
- export interface CommonLogSecure extends ShiftMain<CommonLog> {
15
- $init(leyyo: Leyyo): void;
16
- }
17
- export interface LogConsumer {
18
- apply(line: LogLine): void;
19
- }
20
- export interface LogLine {
21
- severity: Severity;
22
- message: string | Error;
23
- holder?: string;
24
- params?: Dict;
25
- }
26
- export interface LogLineEnhanced<L = Dict> extends LogLine {
27
- time?: Date;
28
- locals?: L;
29
- }
30
- export interface Logger extends ShiftSecure<LoggerSecure> {
31
- error(message: string, params?: any): void;
32
- error(error: Error, params?: any): void;
33
- error(whatever: any, params?: any): void;
34
- warn(message: string, params?: any): void;
35
- warn(error: Error, params?: any): void;
36
- warn(whatever: any, params?: any): void;
37
- info(message: string, params?: any): void;
38
- info(error: Error, params?: any): void;
39
- info(whatever: any, params?: any): void;
40
- log(message: string, params?: any): void;
41
- log(error: Error, params?: any): void;
42
- log(whatever: any, params?: any): void;
43
- trace(message: string, params?: any): void;
44
- trace(error: Error, params?: any): void;
45
- trace(whatever: any, params?: any): void;
46
- debug(message: string, params?: any): void;
47
- debug(error: Error, params?: any): void;
48
- debug(whatever: any, params?: any): void;
49
- }
50
- export type LogMethod = 'error' | 'warn' | 'info' | 'log' | 'trace' | 'debug';
51
- export interface LoggerSecure extends ShiftMain<Logger> {
52
- get $clazz(): Function;
53
- get $name(): string;
54
- $assert(error: Error, indicator: string, params?: unknown): void;
55
- $setName(name: string): void;
56
- $setMethod(method: LogMethod, lambda?: LoggerLambda): void;
57
- }
58
- 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,9 +1,10 @@
1
- import { Logger, LoggerLambda, LoggerSecure, LogMethod } from "./index-types";
2
1
  import { Leyyo } from "../leyyo";
2
+ import { Severity } from "../literal";
3
+ import { Logger, LoggerLambda, LoggerSecure } from "../shared";
3
4
  export declare class LoggerImpl implements Logger, LoggerSecure {
4
5
  private readonly _clazz;
5
6
  private _name;
6
- private static _callback;
7
+ private static _fqn;
7
8
  private static _log;
8
9
  constructor(value: Object | Function | string);
9
10
  debug(message: any, params?: any): void;
@@ -18,6 +19,6 @@ export declare class LoggerImpl implements Logger, LoggerSecure {
18
19
  get $name(): string;
19
20
  static $setLeyyo(leyyo: Leyyo): void;
20
21
  $setName(name: string): void;
21
- $setMethod(method: LogMethod, lambda?: LoggerLambda): void;
22
+ $setMethod(method: Severity, lambda?: LoggerLambda): void;
22
23
  $assert(error: Error, indicator: string, params?: unknown): void;
23
24
  }
@@ -1,24 +1,24 @@
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
22
  }
23
23
  }
24
24
  debug(message, params) {
@@ -53,7 +53,7 @@ class LoggerImpl {
53
53
  return this._name;
54
54
  }
55
55
  static $setLeyyo(leyyo) {
56
- this._callback = leyyo.callback;
56
+ this._fqn = leyyo.fqn;
57
57
  this._log = leyyo.log;
58
58
  }
59
59
  $setName(name) {
@@ -64,7 +64,8 @@ class LoggerImpl {
64
64
  this[method] = lambda;
65
65
  }
66
66
  else {
67
- this[method] = () => { };
67
+ this[method] = () => {
68
+ };
68
69
  }
69
70
  }
70
71
  $assert(error, indicator, params) {
@@ -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>;
@@ -91,16 +91,44 @@ type OneOfByKey<T> = {
91
91
  type XorIn<T> = {
92
92
  [K in keyof T]: T[K];
93
93
  } & unknown;
94
+ /**
95
+ * An interface which contains secure mode members and provides to shift to main mode
96
+ * */
94
97
  export interface ShiftSecure<S extends ShiftMain<any>> {
98
+ /**
99
+ * Shifts to secure mode
100
+ * */
95
101
  get $secure(): S;
96
102
  }
97
- export interface ShiftFlat<D> {
98
- get $flat(): D;
99
- }
103
+ /**
104
+ * An interface which contains main mode members and provides to shift to secure mode
105
+ *
106
+ * IT's so useful to hide some public members
107
+ * - to see clean auto-completed members in IDE
108
+ * - to indicated that secure mode members should be used in special cases
109
+ * */
100
110
  export interface ShiftMain<M extends ShiftSecure<any>> {
111
+ /**
112
+ * Shifts to main mode
113
+ * */
101
114
  get $back(): M;
102
115
  }
116
+ /**
117
+ * An interface which provides to flat generic interfaces/classes to prevent verbose casting commands
118
+ * */
119
+ export interface ShiftFlat<D> {
120
+ /**
121
+ * Flats current classes, or eliminate generic parameters
122
+ * */
123
+ get $flat(): D;
124
+ }
125
+ /**
126
+ * Useful interface which provides initialization state for instances
127
+ * */
103
128
  export interface InitLike {
129
+ /**
130
+ * Initializes the instance
131
+ * */
104
132
  $init(...args: Arr): void;
105
133
  }
106
134
  /**
@@ -0,0 +1,141 @@
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
+ name(value: any): string;
37
+ register(value: any, type: FqnStereoType, pckName: string): void;
38
+ }
39
+ export type FqnStereoType = 'class' | 'function' | 'enum' | 'literal';
40
+ export interface ErrorDefinedProvider extends HookDefinedProvider {
41
+ register(exception: ExceptionLike): void;
42
+ build?(e: Error | string): ExceptionLike;
43
+ afterCreate?(e: ExceptionLike): void;
44
+ causedBy?(e: Error | string): ExceptionLike;
45
+ initSign?(err: Error): boolean;
46
+ addSign?(err: Error, ...keys: Array<string>): boolean;
47
+ getSign?(err: Error): Array<string>;
48
+ removeSign?(err: Error, ...keys: Array<string>): boolean;
49
+ hasSign?(err: Error, key: string): boolean;
50
+ toObject?(e: Error, ...omittedFields: Array<string>): Dict;
51
+ buildStack?(e: Error): void;
52
+ copyStack?(exception: Exception, error: Error): void;
53
+ initOmit?(clz: Function): boolean;
54
+ addOmit?(clz: Function, ...properties: Array<string>): boolean;
55
+ getOmit?(clz: Function): Array<string>;
56
+ inheritOmit?(clz: Function): Array<string>;
57
+ }
58
+ export interface LogDefinedProvider extends HookDefinedProvider {
59
+ create?(clazz: Object | Function | string): Logger;
60
+ apply?(line: LogLine): void;
61
+ check?<T>(line: LogLineEnhanced<T>): void;
62
+ print<T>(line: LogLineEnhanced<T>): void;
63
+ }
64
+ export interface LogConsumer {
65
+ apply(line: LogLine): void;
66
+ }
67
+ export interface LogLine {
68
+ severity: Severity;
69
+ message: string | Error;
70
+ holder?: string;
71
+ params?: Dict;
72
+ }
73
+ export interface LogLineEnhanced<L = Dict> extends LogLine {
74
+ time?: Date;
75
+ locals?: L;
76
+ }
77
+ export interface Logger extends ShiftSecure<LoggerSecure> {
78
+ error(message: string, params?: any): void;
79
+ error(error: Error, params?: any): void;
80
+ error(whatever: any, params?: any): void;
81
+ warn(message: string, params?: any): void;
82
+ warn(error: Error, params?: any): void;
83
+ warn(whatever: any, params?: any): void;
84
+ info(message: string, params?: any): void;
85
+ info(error: Error, params?: any): void;
86
+ info(whatever: any, params?: any): void;
87
+ log(message: string, params?: any): void;
88
+ log(error: Error, params?: any): void;
89
+ log(whatever: any, params?: any): void;
90
+ trace(message: string, params?: any): void;
91
+ trace(error: Error, params?: any): void;
92
+ trace(whatever: any, params?: any): void;
93
+ debug(message: string, params?: any): void;
94
+ debug(error: Error, params?: any): void;
95
+ debug(whatever: any, params?: any): void;
96
+ }
97
+ export interface LoggerSecure extends ShiftMain<Logger> {
98
+ get $clazz(): Function;
99
+ get $name(): string;
100
+ $assert(error: Error, indicator: string, params?: unknown): void;
101
+ $setName(name: string): void;
102
+ $setMethod(method: Severity, lambda?: LoggerLambda): void;
103
+ }
104
+ export type LoggerLambda = (whatever: any, params?: any) => void;
105
+ /**
106
+ * Storage size dictionary which in corresponding type
107
+ * */
108
+ export type StorageItem = Dict<number>;
109
+ /**
110
+ * Storage export dictionary which includes items
111
+ * */
112
+ export type StorageDetail = Record<StorageType, StorageItem>;
113
+ export interface ToTypeOpt extends AssertionOpt {
114
+ silent?: true;
115
+ children?: unknown;
116
+ }
117
+ export type ToTypeFnLambda<T = unknown, O extends ToTypeOpt = ToTypeOpt> = (value: unknown, opt?: O) => T;
118
+ export interface ToTypeChildOpt<T = unknown> extends ToTypeOpt {
119
+ fn?: ToTypeFnLambda<T>;
120
+ }
121
+ export interface ToTypeArrayChildOpt<V extends ToTypeChildOpt = ToTypeChildOpt> extends Dict<ToTypeChildOpt> {
122
+ value?: V;
123
+ }
124
+ export interface ToTypeArrayOpt<V extends ToTypeChildOpt = ToTypeChildOpt> extends ToTypeOpt {
125
+ children?: ToTypeArrayChildOpt<V>;
126
+ }
127
+ export interface ToTypeDictChildOpt<K extends ToTypeChildOpt = ToTypeChildOpt, V extends ToTypeChildOpt = ToTypeChildOpt> extends Record<string, ToTypeChildOpt> {
128
+ key?: K;
129
+ value?: V;
130
+ }
131
+ export interface ToTypeObjectOpt<K extends ToTypeChildOpt = ToTypeChildOpt, V extends ToTypeChildOpt = ToTypeChildOpt> extends ToTypeOpt {
132
+ children?: ToTypeDictChildOpt<K, V>;
133
+ }
134
+ export interface ToTypeEnumOpt<E extends KeyValue = KeyValue> extends ToTypeOpt {
135
+ map: EnumerationMap<E> | EnumerationArray<E>;
136
+ alt?: EnumerationAlt<E>;
137
+ }
138
+ export type EnumerationMap<E extends KeyValue = KeyValue> = Dict<E>;
139
+ export type EnumerationAlt<E extends KeyValue = KeyValue> = Dict<E>;
140
+ export type EnumerationArray<E extends KeyValue = KeyValue> = Array<E>;
141
+ 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';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./index-aliases"), exports);
18
+ __exportStar(require("./index-constants"), exports);
19
+ __exportStar(require("./index-types"), exports);
20
+ __exportStar(require("./assert"), exports);
21
+ __exportStar(require("./list"), exports);
@@ -1,6 +1,7 @@
1
- import { List } from "./list";
2
- import { CommonStorage, CommonStorageSecure, StorageDetail, StorageItem, StorageType } from "./index-types";
1
+ import { List, StorageDetail, StorageItem } from "../shared";
2
+ import { CommonStorage, CommonStorageSecure } from "./index-types";
3
3
  import { Leyyo } from "../leyyo";
4
+ import { StorageType } from "../literal";
4
5
  /** @inheritDoc */
5
6
  export declare class CommonStorageImpl implements CommonStorage, CommonStorageSecure {
6
7
  private readonly _lists;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommonStorageImpl = void 0;
4
- const list_1 = require("./list");
5
- // noinspection JSUnusedLocalSymbols
4
+ const shared_1 = require("../shared");
5
+ // noinspection JSUnusedLocalSymbols,JSUnusedGlobalSymbols
6
6
  /** @inheritDoc */
7
7
  class CommonStorageImpl {
8
8
  /**
@@ -80,7 +80,7 @@ class CommonStorageImpl {
80
80
  // region list
81
81
  /** @inheritDoc */
82
82
  newList(name) {
83
- const list = new list_1.List();
83
+ const list = new shared_1.List();
84
84
  this._lists.set(name, list);
85
85
  return list;
86
86
  }
@@ -1,6 +1,5 @@
1
- import { List } from "./list";
2
- import { Dict, ShiftMain, ShiftSecure } from "../aliases";
3
- import { Leyyo } from "../leyyo";
1
+ import { InitLike, List, ShiftMain, ShiftSecure, StorageDetail } from "../shared";
2
+ import { StorageType } from "../literal";
4
3
  /**
5
4
  * Storage factory
6
5
  *
@@ -85,18 +84,4 @@ export interface CommonStorage extends ShiftSecure<CommonStorageSecure> {
85
84
  * */
86
85
  details(type?: StorageType, name?: string): StorageDetail;
87
86
  }
88
- export interface CommonStorageSecure extends ShiftMain<CommonStorage> {
89
- $init(leyyo: Leyyo): void;
90
- }
91
- /**
92
- * Storage type literal, as an enum
93
- * */
94
- export type StorageType = 'array' | 'list' | 'map' | 'set';
95
- /**
96
- * Storage size dictionary which in corresponding type
97
- * */
98
- export type StorageItem = Dict<number>;
99
- /**
100
- * Storage export dictionary which includes items
101
- * */
102
- export type StorageDetail = Record<StorageType, StorageItem>;
87
+ export type CommonStorageSecure = ShiftMain<CommonStorage> & InitLike;
@@ -1,3 +1,2 @@
1
1
  export * from './index-types';
2
- export * from './list';
3
2
  export * from './common-storage-impl';
@@ -15,5 +15,4 @@ 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("./list"), exports);
19
18
  __exportStar(require("./common-storage-impl"), exports);