@leyyo/common 1.3.17 → 1.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/base/index.d.ts +3 -3
  2. package/dist/base/index.js +3 -3
  3. package/dist/base/index.types.d.ts +3 -70
  4. package/dist/base/index.types.js +0 -32
  5. package/dist/base/leyyo.d.ts +0 -3
  6. package/dist/base/leyyo.js +12 -23
  7. package/dist/class/index.d.ts +2 -2
  8. package/dist/class/index.js +2 -2
  9. package/dist/class/index.types.d.ts +0 -20
  10. package/dist/class/list.d.ts +0 -6
  11. package/dist/class/list.js +0 -6
  12. package/dist/class/logger.instance.d.ts +8 -13
  13. package/dist/class/logger.instance.js +13 -27
  14. package/dist/common/deploy.common.d.ts +0 -16
  15. package/dist/common/deploy.common.js +4 -21
  16. package/dist/common/enum.pool.d.ts +5 -13
  17. package/dist/common/enum.pool.js +16 -17
  18. package/dist/common/error.common.d.ts +0 -30
  19. package/dist/common/error.common.js +33 -69
  20. package/dist/common/error.pool.d.ts +1 -10
  21. package/dist/common/error.pool.js +2 -13
  22. package/dist/common/event.common.d.ts +0 -8
  23. package/dist/common/event.common.js +15 -25
  24. package/dist/common/index.d.ts +11 -11
  25. package/dist/common/index.js +11 -11
  26. package/dist/common/index.types.d.ts +12 -435
  27. package/dist/common/index.types.js +0 -1
  28. package/dist/common/inert.d.ts +1 -49
  29. package/dist/common/inert.js +35 -64
  30. package/dist/common/lifecycle.common.d.ts +0 -14
  31. package/dist/common/lifecycle.common.js +13 -29
  32. package/dist/common/literal.pool.d.ts +1 -12
  33. package/dist/common/literal.pool.js +3 -18
  34. package/dist/common/log.common.d.ts +0 -54
  35. package/dist/common/log.common.js +62 -147
  36. package/dist/common/repo.common.d.ts +0 -188
  37. package/dist/common/repo.common.js +23 -239
  38. package/dist/const/index.d.ts +8 -12
  39. package/dist/const/index.js +28 -33
  40. package/dist/enum/index.d.ts +1 -1
  41. package/dist/enum/index.js +1 -1
  42. package/dist/enum/log-level.d.ts +1 -4
  43. package/dist/enum/log-level.js +1 -1
  44. package/dist/error/caused.error.d.ts +0 -10
  45. package/dist/error/caused.error.js +0 -10
  46. package/dist/error/developer.error.d.ts +4 -17
  47. package/dist/error/developer.error.js +11 -33
  48. package/dist/error/http.error.d.ts +0 -13
  49. package/dist/error/http.error.js +1 -8
  50. package/dist/error/index.d.ts +7 -7
  51. package/dist/error/index.js +7 -7
  52. package/dist/error/index.types.d.ts +1 -150
  53. package/dist/error/invalid-value.error.d.ts +0 -3
  54. package/dist/error/invalid-value.error.js +1 -4
  55. package/dist/error/leyyo.error.d.ts +2 -35
  56. package/dist/error/leyyo.error.js +26 -58
  57. package/dist/error/multiple.error.d.ts +0 -6
  58. package/dist/error/multiple.error.js +2 -9
  59. package/dist/function/define-loader.d.ts +0 -6
  60. package/dist/function/define-loader.js +0 -6
  61. package/dist/function/delay.d.ts +0 -8
  62. package/dist/function/delay.js +0 -9
  63. package/dist/function/delete-prop.d.ts +0 -21
  64. package/dist/function/delete-prop.js +6 -28
  65. package/dist/function/empty-fn.d.ts +0 -6
  66. package/dist/function/empty-fn.js +1 -9
  67. package/dist/function/extended-type.d.ts +0 -6
  68. package/dist/function/extended-type.js +18 -24
  69. package/dist/function/get-fqn.d.ts +0 -6
  70. package/dist/function/get-fqn.js +2 -8
  71. package/dist/function/get-prop.d.ts +0 -21
  72. package/dist/function/get-prop.js +5 -26
  73. package/dist/function/get-stat.d.ts +0 -20
  74. package/dist/function/get-stat.js +7 -2
  75. package/dist/function/has-fqn.d.ts +0 -6
  76. package/dist/function/has-fqn.js +2 -8
  77. package/dist/function/index.d.ts +40 -40
  78. package/dist/function/index.js +40 -40
  79. package/dist/function/index.types.d.ts +1 -1
  80. package/dist/function/is-anonymous-name.js +1 -1
  81. package/dist/function/is-class.d.ts +0 -6
  82. package/dist/function/is-class.js +2 -20
  83. package/dist/function/is-empty.d.ts +0 -11
  84. package/dist/function/is-empty.js +1 -12
  85. package/dist/function/is-filled-arr.d.ts +0 -9
  86. package/dist/function/is-filled-arr.js +0 -9
  87. package/dist/function/is-filled-obj.d.ts +0 -9
  88. package/dist/function/is-filled-obj.js +0 -9
  89. package/dist/function/is-obj.d.ts +0 -8
  90. package/dist/function/is-obj.js +1 -9
  91. package/dist/function/is-test.d.ts +0 -8
  92. package/dist/function/is-test.js +3 -19
  93. package/dist/function/is-text.d.ts +0 -10
  94. package/dist/function/is-text.js +1 -11
  95. package/dist/function/jitter-interval.d.ts +0 -9
  96. package/dist/function/jitter-interval.js +2 -18
  97. package/dist/function/load-config.d.ts +0 -19
  98. package/dist/function/load-config.js +10 -61
  99. package/dist/function/on-fqn-set.js +3 -3
  100. package/dist/function/one-or-more.d.ts +0 -6
  101. package/dist/function/one-or-more.js +0 -7
  102. package/dist/function/opt-add.d.ts +0 -8
  103. package/dist/function/opt-add.js +2 -10
  104. package/dist/function/opt-append.d.ts +0 -7
  105. package/dist/function/opt-append.js +0 -7
  106. package/dist/function/opt-check.d.ts +0 -6
  107. package/dist/function/opt-check.js +2 -9
  108. package/dist/function/opt-clone.d.ts +0 -6
  109. package/dist/function/opt-clone.js +0 -7
  110. package/dist/function/opt-field.d.ts +0 -8
  111. package/dist/function/opt-field.js +6 -14
  112. package/dist/function/opt-fn.d.ts +0 -6
  113. package/dist/function/opt-fn.js +0 -7
  114. package/dist/function/random-test-no.d.ts +0 -5
  115. package/dist/function/random-test-no.js +0 -5
  116. package/dist/function/remove-fqn.d.ts +0 -8
  117. package/dist/function/remove-fqn.js +3 -12
  118. package/dist/function/run-exporter.d.ts +0 -5
  119. package/dist/function/run-exporter.js +3 -17
  120. package/dist/function/secure-clone.js +3 -3
  121. package/dist/function/secure-json.d.ts +0 -35
  122. package/dist/function/secure-json.js +12 -54
  123. package/dist/function/set-anonymous-fqn.js +4 -5
  124. package/dist/function/set-anonymous-name.js +14 -14
  125. package/dist/function/set-fqn.d.ts +0 -7
  126. package/dist/function/set-fqn.js +8 -15
  127. package/dist/function/set-prop.d.ts +0 -24
  128. package/dist/function/set-prop.js +6 -30
  129. package/dist/function/stamp-loader.d.ts +0 -6
  130. package/dist/function/stamp-loader.js +1 -7
  131. package/dist/function/test-case.d.ts +0 -7
  132. package/dist/function/test-case.js +3 -10
  133. package/dist/function/test-name.d.ts +0 -7
  134. package/dist/function/test-name.js +2 -9
  135. package/dist/function/trigger-fqn.js +2 -3
  136. package/dist/index.d.ts +10 -10
  137. package/dist/index.foretell.js +7 -10
  138. package/dist/index.js +10 -11
  139. package/dist/index.loader.js +1 -8
  140. package/dist/init/index.js +5 -7
  141. package/dist/sys/index.d.ts +2 -2
  142. package/dist/sys/index.js +2 -2
  143. package/dist/sys/leyyo-storage.d.ts +0 -7
  144. package/dist/sys/leyyo-storage.js +5 -28
  145. package/dist/sys/package-json.js +5 -5
  146. package/package.json +16 -31
@@ -3,8 +3,8 @@ import { LogLevel } from "../enum/index.js";
3
3
  import { LeyyoErrorLike } from "../error/index.js";
4
4
  import { List } from "../class/index.js";
5
5
  import { Opt } from "../function/index.js";
6
- export type InertMode = 'eager' | 'lazy' | 'failed' | 'conflicted';
7
- export type InertStage = 'persistent' | 'fqn-waiting' | 'loading-waiting';
6
+ export type InertMode = "eager" | "lazy" | "failed" | "conflicted";
7
+ export type InertStage = "persistent" | "fqn-waiting" | "loading-waiting";
8
8
  export interface InertBuildOpt {
9
9
  anonymousName?: string;
10
10
  }
@@ -17,149 +17,40 @@ export interface InertRepo<L extends InertItem<T>, T> {
17
17
  pendingLazy: Map<string, L>;
18
18
  }
19
19
  export interface InertItem<T> extends InertOpt<T> {
20
- /**
21
- * Full name of target (FQN)
22
- * */
23
20
  full?: string;
24
- /**
25
- * Lazy mode
26
- * */
27
21
  mode: InertMode;
28
- /**
29
- * Lazy stage
30
- * */
31
22
  stage: InertStage;
32
23
  }
33
24
  export interface InertOpt<T> {
34
- /**
35
- * Name of target
36
- * */
37
25
  name?: string;
38
- /**
39
- * Name of target
40
- * */
41
26
  target?: T;
42
- /**
43
- * Lazy target promise
44
- * */
45
27
  lazyTarget?: Promise<T>;
46
- /**
47
- * Alias for it
48
- * */
49
28
  aliases?: Array<string>;
50
- /**
51
- * Fqn name
52
- * */
53
29
  fqn?: string;
54
30
  }
55
31
  export interface InertLike<L extends InertItem<T>, T, O extends InertOpt<T>> {
56
- /**
57
- * Define an inert as eager
58
- *
59
- * @param {InertOpt} options - options
60
- * */
61
32
  register(options: O): void;
62
- /**
63
- * Define an inert as eager
64
- *
65
- * @param {string} fqn - package name
66
- * @param {string} name - name
67
- * @param {Promise} lazyTarget
68
- * @param {InertOpt?} opt
69
- * */
70
- lazy(fqn: string, name: string, lazyTarget: Promise<T>, opt?: Omit<O, 'name' | 'target' | 'lazyTarget' | 'fqn'>): void;
71
- /**
72
- * Check inert defined as lazy, by name
73
- * Note:
74
- * - Inert mode will be shifted lazy to eager after loaded
75
- *
76
- * @param {string} name - target name
77
- * @return {boolean}
78
- * */
33
+ lazy(fqn: string, name: string, lazyTarget: Promise<T>, opt?: Omit<O, "name" | "target" | "lazyTarget" | "fqn">): void;
79
34
  isLazy(name: string): boolean;
80
- /**
81
- * Check inert failed or conflicted, by name
82
- *
83
- * @param {string} name - target name
84
- * @return {boolean}
85
- * */
86
35
  isInvalid(name: string): boolean;
87
- /**
88
- * Check inert failed or conflicted, by name
89
- *
90
- * @param {string} name - target name
91
- * @return {boolean}
92
- * */
93
36
  isFailed(name: string): boolean;
94
- /**
95
- * Check inert failed or conflicted, by name
96
- *
97
- * @param {string} name - target name
98
- * @return {boolean}
99
- * */
100
37
  isConflicted(name: string): boolean;
101
- /**
102
- * Check inert defined as eager, by name
103
- *
104
- * @param {string} name - target name
105
- * @return {boolean}
106
- * */
107
38
  isEager(name: string): boolean;
108
- /**
109
- * Check inert defined or not, by name
110
- *
111
- * @param {string} name - target name
112
- * @return {boolean}
113
- * */
114
39
  has(name: string): boolean;
115
- /**
116
- * Get inert by name
117
- *
118
- * @param {string} name - target name
119
- * @return {InertItem}
120
- * */
121
40
  get(name: string): L;
122
- /**
123
- * Load lazy inert by name
124
- * Note:
125
- * - Target must be exported as `foretell`
126
- *
127
- * @param {string} name - target name
128
- * @return {Promise<InertItem>}
129
- * @async
130
- * */
131
41
  load(name: string): Promise<L>;
132
42
  }
133
43
  export interface ErrorItemConfig {
134
- /**
135
- * Default error message
136
- * */
137
44
  message?: string;
138
- /**
139
- * Will be error emitted?
140
- * */
141
45
  emit?: unknown;
142
- /**
143
- * Will be the error decorated for context language?
144
- * */
145
46
  i18n?: unknown;
146
47
  }
147
48
  export type ErrorPoolOpt = InertOpt<ClassLike> & ErrorItemConfig;
148
49
  export type ErrorPoolItem = InertItem<ClassLike> & ErrorPoolOpt;
149
50
  export interface ErrorPoolLike extends InertLike<InertItem<ClassLike>, ClassLike, ErrorPoolOpt> {
150
- /**
151
- * Define an error
152
- *
153
- * @param {string} fqn - package name
154
- * @param {any} clazz
155
- * @param {InertOpt?} opt
156
- * */
157
- define(fqn: string, clazz: ClassLike, opt?: Omit<ErrorPoolOpt, 'name' | 'target' | 'lazyTarget' | 'fqn'>): void;
51
+ define(fqn: string, clazz: ClassLike, opt?: Omit<ErrorPoolOpt, "name" | "target" | "lazyTarget" | "fqn">): void;
158
52
  }
159
- /**
160
- * Bare omit error without any property
161
- * */
162
- export type OmitError = Omit<Error, 'name' | 'message' | 'stack'>;
53
+ export type OmitError = Omit<Error, "name" | "message" | "stack">;
163
54
  export interface ErrorCtor extends Fnc {
164
55
  new (...args: Array<unknown>): OmitError;
165
56
  }
@@ -168,120 +59,22 @@ export interface ErrorObject {
168
59
  message: string;
169
60
  }
170
61
  export interface ErrorCommonLike {
171
- /**
172
- * Config error class
173
- *
174
- * @param {ClassLike} clazz - error class
175
- * @param {ErrorItemConfig} conf - configuration
176
- * */
177
62
  setConfigItem(clazz: ClassLike, conf: ErrorItemConfig): void;
178
- /**
179
- * Get config of error class
180
- *
181
- * @param {ClassLike} clazz - error class
182
- * @return {ErrorItemConfig} - configuration
183
- * */
184
63
  getConfigItem(clazz: ClassLike): ErrorItemConfig;
185
- /**
186
- * It will be called when an error raised
187
- * */
188
64
  emit(err: Error): void;
189
- /**
190
- * Build error stack
191
- *
192
- * @param {Error} source
193
- * @param {boolean?} force
194
- * */
195
65
  buildStack(source: Error, force?: boolean): void;
196
- /**
197
- * Transform error as a bare object without name and message
198
- *
199
- * @param {Error} err - error instance
200
- * @param {Opt} existing - existing parameters
201
- * @return {Opt?} - bare error object
202
- * */
203
66
  toJsonBasic(err: Error, existing?: Opt): Opt;
204
- /**
205
- * Transform error as a bare object with name and message
206
- *
207
- * @param {Error} err - error instance
208
- * @param {Opt} existing - existing parameters
209
- * @return {Opt?} - bare error object
210
- * */
211
67
  toJsonFull(err: Error, existing: Opt): Opt;
212
- /**
213
- * Cast a native error to leyyo error
214
- *
215
- * @param {Error} e - native error instance
216
- * @param {Opt?} params - params for error
217
- * @return {LeyyoErrorLike} - new error instance
218
- * */
219
68
  cast<E extends LeyyoErrorLike>(e: Error, params?: Opt): E;
220
- /**
221
- * Cast a native error by given error class
222
- *
223
- * @param {function} clazz - new error class
224
- * @param {Error} e - native error instance
225
- * @param {Opt?} params - params for error
226
- * @return {LeyyoErrorLike} - new error instance
227
- * */
228
69
  forcedCast<E extends LeyyoErrorLike>(clazz: ClassLike, e: Error, params?: Opt): E;
229
- /** @inheritDoc */
230
70
  addKnownPackage(packageName: string, shortName: string): void;
231
- /**
232
- * Build a standard error text
233
- *
234
- * @param {Error} err - error instance
235
- * @return {string} - error text
236
- * */
237
71
  bareObj(err: Error): ErrorObject;
238
- /**
239
- * Build a standard error text
240
- * - if parts: `<info> [err:error.name] => [error.message]`
241
- * - else: `[err:error.name] => [error.message]`
242
- *
243
- * @param {Error} err - error instance
244
- * @param {...Array<string|number>} parts - parts for info
245
- * @return {string} - error text
246
- * */
247
72
  text(err: Error, ...parts: Array<string | number>): string;
248
- /**
249
- * Add error statistics with instance
250
- *
251
- * @param {Error} error
252
- * @return {number} - total raised count
253
- * */
254
73
  addStat(error: Error): number;
255
- /**
256
- * Add error statistics
257
- *
258
- * @param {ErrorCtor} clazz
259
- * @return {number} - total raised count
260
- * */
261
74
  addStat(clazz: ErrorCtor): number;
262
- /**
263
- * Get error statistics with instance
264
- *
265
- * @param {Error} error
266
- * @return {number} - total raised count
267
- * */
268
75
  getStat(error: Error): number;
269
- /**
270
- * Get error statistics
271
- *
272
- * @param {ErrorCtor} clazz
273
- * @return {number} - total raised count
274
- * */
275
76
  getStat(clazz: ErrorCtor): number;
276
- /**
277
- * Clear statistics
278
- * */
279
77
  clearStats(): void;
280
- /**
281
- * List statistics
282
- *
283
- * @return {Record} - as {[error-name]: number}
284
- * */
285
78
  listStats(): Record<string, number>;
286
79
  }
287
80
  export type Enum<E extends KeyValue = KeyValue> = {
@@ -289,266 +82,65 @@ export type Enum<E extends KeyValue = KeyValue> = {
289
82
  };
290
83
  export type EnumAlt<E extends KeyValue = KeyValue> = Dict<E>;
291
84
  export interface EnumItemConfig {
292
- /**
293
- * Enum name
294
- * */
295
85
  name?: string;
296
- /**
297
- * Will be the error decorated for context language?
298
- * */
299
86
  i18n?: unknown;
300
- /**
301
- * Alternative map
302
- * */
303
87
  alt?: EnumAlt;
304
88
  }
305
89
  export interface EnumPoolOpt extends InertOpt<Enum>, EnumItemConfig {
306
- /**
307
- * Alternative map path
308
- * */
309
90
  lazyAlt?: Promise<EnumAlt>;
310
91
  }
311
92
  export type EnumPoolItem = InertItem<Enum> & EnumPoolOpt;
93
+ export type EnumNonFunctional<T> = T extends Fnc ? never : T;
312
94
  export interface EnumPoolLike extends InertLike<InertItem<Enum>, Enum, EnumPoolOpt> {
313
- /**
314
- * Config enum
315
- *
316
- * @param {Enum} enm - enum
317
- * @param {EnumItemConfig} conf - configuration
318
- * */
319
95
  setConfigItem(enm: Enum, conf: EnumItemConfig): void;
320
- /**
321
- * Config enum
322
- *
323
- * @param {Enum} enm - enum
324
- * @return {EnumItemConfig} - configuration
325
- * */
326
96
  getConfigItem(enm: Enum): EnumItemConfig;
327
- /**
328
- * Define an enumeration
329
- *
330
- * @param {string} fqn - package name
331
- * @param {string} name - enum name
332
- * @param {Enum} enm
333
- * @param {InertOpt?} opt
334
- * */
335
- define(fqn: string, name: string, enm: Enum, opt?: Omit<EnumPoolOpt, 'name' | 'target' | 'lazyTarget' | 'fqn'>): void;
97
+ define(fqn: string, name: string, enm: Enum, opt?: Omit<EnumPoolOpt, "name" | "target" | "lazyTarget" | "fqn">): void;
98
+ toLiteral<E>(enm: E): ReadonlyArray<EnumNonFunctional<E[keyof E]>>;
99
+ merge<N>(...maps: Enum[]): N;
336
100
  }
337
101
  export type Literal<E extends KeyValue = KeyValue> = Array<E> | ReadonlyArray<E>;
338
102
  export type LiteralAlt<E extends KeyValue = KeyValue> = Dict<E>;
339
103
  export interface LiteralItemConfig {
340
- /**
341
- * Literal name
342
- * */
343
104
  name?: string;
344
- /**
345
- * Will be the error decorated for context language?
346
- * */
347
105
  i18n?: unknown;
348
- /**
349
- * Alternative map
350
- * */
351
106
  alt?: EnumAlt;
352
107
  }
353
108
  export interface LiteralPoolOpt extends InertOpt<Literal>, LiteralItemConfig {
354
- /**
355
- * Alternative map path
356
- * */
357
109
  lazyAlt?: Promise<EnumAlt>;
358
110
  }
359
111
  export type LiteralPoolItem = InertItem<Literal> & LiteralPoolOpt;
360
112
  export interface LiteralPoolLike extends InertLike<InertItem<Literal>, Literal, LiteralPoolOpt> {
361
- /**
362
- * Config literal
363
- *
364
- * @param {Literal} lit - literal
365
- * @param {LiteralItemConfig} conf - configuration
366
- * */
367
113
  setConfigItem(lit: Literal, conf: LiteralItemConfig): void;
368
- /**
369
- * Config literal
370
- *
371
- * @param {Literal} lit - literal
372
- * @return {LiteralItemConfig} - configuration
373
- * */
374
114
  getConfigItem(lit: Literal): LiteralItemConfig;
375
- /**
376
- * Define an literal
377
- *
378
- * @param {string} fqn - package name
379
- * @param {string} name - literal name
380
- * @param {Literal} items
381
- * @param {InertOpt?} opt
382
- * */
383
- define(fqn: string, name: string, items: Literal, opt?: Omit<LiteralPoolOpt, 'name' | 'target' | 'lazyTarget' | 'fqn'>): void;
115
+ define(fqn: string, name: string, items: Literal, opt?: Omit<LiteralPoolOpt, "name" | "target" | "lazyTarget" | "fqn">): void;
384
116
  }
385
- /**
386
- * Deploy common interface
387
- * */
388
117
  export interface DeployCommonLike {
389
- /**
390
- * Wait deploy of a component
391
- *
392
- * @param {string} name - name of component
393
- * @param {function} callback - callback for creator of component, if it completes it, this callback will be called
394
- * */
395
118
  wait(name: string, callback: Fnc): void;
396
- /**
397
- * Complete deploy of a component
398
- * - It should be called by owner of component
399
- *
400
- * @param {string} name - name of component
401
- * @param {Array} values - They will be sent to callback of waiting component, {@link #wait}
402
- * */
403
119
  complete(name: string, ...values: Array<unknown>): void;
404
120
  }
405
- /**
406
- * Default event types
407
- * */
408
- export type EventType = 'log' | 'error:emit' | 'context:set-finder';
409
- /**
410
- * Event common interface
411
- * */
121
+ export type EventType = "log" | "error:emit" | "context:set-finder";
412
122
  export interface EventCommonLike<T extends string> {
413
- /**
414
- * Fork event common with different event types
415
- *
416
- * @return {EventCommonLike}
417
- * */
418
123
  fork<F extends string>(): EventCommonLike<T | F>;
419
- /**
420
- * Emit (fire) an event
421
- *
422
- * @param {string} name - event name
423
- * @param {...Array} values - They will be used for callback of listener
424
- * @return {boolean} - message is emitted correctly
425
- *
426
- * Note:
427
- * - If there is not any listener for this event yet, events will be collected
428
- * */
429
124
  emit(name: T, ...values: Array<unknown>): boolean;
430
- /**
431
- * Listen an event
432
- *
433
- * @param {string} name - event name
434
- * @param {function} callback - callback for emitted event
435
- *
436
- * Note:
437
- * - If there are previous emitted events, it will listen them immediately (lazy event driven)
438
- * */
439
125
  listen<T extends string = string>(name: EventType | T, callback: Fnc): void;
440
- /**
441
- * Deactivate an event
442
- *
443
- * Means:
444
- * - If there is no any listener then;
445
- * - - emitted messages will be ignored
446
- * - - collected message will be cleared
447
- *
448
- * @param {string} name - event name
449
- * @return {boolean} - if it is previously activated (default) then true
450
- * */
451
126
  deactivate(name: string): boolean;
452
- /**
453
- * Activate an event
454
- *
455
- * Means:
456
- * - If there is no any listener then;
457
- * - - emitted messages will be collected till listener comes in
458
- *
459
- * @param {string} name - event name
460
- * @return {boolean} - if it is previously deactivated then true
461
- * */
462
127
  activate(name: string): boolean;
463
128
  }
464
- /**
465
- * Lifecycle stages
466
- * */
467
- export type LifecycleStage = 'initialize' | 'print' | 'validate' | 'process' | 'clear' | 'ota-before' | 'ota-after' | 'kill';
468
- /**
469
- * Lifecycle tuple as [name, callbacks]
470
- * */
129
+ export type LifecycleStage = "initialize" | "print" | "validate" | "process" | "clear" | "ota-before" | "ota-after" | "kill";
471
130
  export type LifecycleTuple = [string, Array<Fnc>];
472
- /**
473
- * Lifecycle order lambda by stage
474
- *
475
- * @param {Map<string, Array<Fnc>>} map - as Map<name, callbacks>
476
- * @return {Array<LifecycleTuple>}
477
- * */
478
131
  export type LifecycleSortLambda = (map: Map<string, Array<Fnc>>) => Array<LifecycleTuple>;
479
- /**
480
- * Lifecycle common interface
481
- * */
482
132
  export interface LifecycleCommonLike {
483
- /**
484
- * Add lifecycle by stage
485
- *
486
- * @param {LifecycleStage} stage - stage
487
- * @param {string} name - your callback name
488
- * @param {function} callback - it will be called on {@link #runStage}
489
- * */
490
133
  addStage(stage: LifecycleStage, name: string, callback: Fnc): void;
491
- /**
492
- * Run lifecycle by stage
493
- *
494
- * @param {LifecycleStage} stage
495
- * @param {...Array} params
496
- * @return {number} - called callbacks number
497
- * */
498
134
  runStage(stage: LifecycleStage, ...params: Array<unknown>): Promise<number>;
499
- /**
500
- * Set lifecycle sort lambda by stage
501
- *
502
- * @param {LifecycleStage} stage
503
- * @param {LifecycleSortLambda} lambda - function that sorts map items
504
- * */
505
135
  setOrderLambda(stage: LifecycleStage, lambda: LifecycleSortLambda): void;
506
136
  }
507
137
  export interface LogCommonLike {
508
- /**
509
- * Create new logger with class name
510
- *
511
- * @param {string} className - name of class
512
- * @return {Logger} - logger instance
513
- * */
514
138
  of(className: string): Logger;
515
- /**
516
- * Create new logger with class name
517
- *
518
- * @param {object} instance - instance
519
- * @return {Logger} - logger instance
520
- * */
521
139
  of(instance: Obj): Logger;
522
- /**
523
- * Create new logger with class
524
- *
525
- * @param {function} clazz - class
526
- * @return {Logger} - logger instance
527
- * */
528
140
  of(clazz: ClassLike | Fnc): Logger;
529
- /**
530
- * Set formatter
531
- *
532
- * @param {function} fn - lambda for formatter
533
- * */
534
141
  setLogFormatter(fn: LogFormatterLambda): void;
535
- /**
536
- * Set deployment styler
537
- *
538
- * @param {function} fn - lambda for styler
539
- * */
540
142
  setLogDeploymentStyler(fn: LogStylerLambda): void;
541
- /**
542
- * Set local style
543
- *
544
- * @param {function} fn - lambda for styler
545
- * */
546
143
  setLogLocalStyler(fn: LogStylerLambda): void;
547
- /**
548
- * Set local style
549
- *
550
- * @param {function} fn - lambda for styler
551
- * */
552
144
  setContextFinder(fn: ContextFinderLambda): void;
553
145
  initConsume(): void;
554
146
  emitLog(level: LogLevel, where: string, message: any, params?: any | Opt): void;
@@ -574,23 +166,8 @@ export interface Logger extends ShiftSecure<LoggerSecure> {
574
166
  fatal(whatever: any, params?: any | Opt): void;
575
167
  }
576
168
  export interface LoggerSecure extends ShiftMain<Logger> {
577
- /**
578
- * Return name of logger
579
- *
580
- * @return {string}
581
- * */
582
169
  get $name(): string;
583
- /**
584
- * Refresh name of logger
585
- *
586
- * @param {string} name - new name
587
- * */
588
170
  $refreshName(name: string): void;
589
- /**
590
- * Refresh log levels
591
- *
592
- * @param {LogLevel} level - max level
593
- * */
594
171
  $refreshLevels(level: LogLevel): void;
595
172
  }
596
173
  export interface LogItem {
@@ -1,2 +1 @@
1
1
  export {};
2
- // endregion context
@@ -6,71 +6,23 @@ export declare abstract class Inert<L extends InertItem<T>, T, O extends InertOp
6
6
  protected options: InertBuildOpt;
7
7
  private readonly _repo;
8
8
  private static _pool;
9
- /**
10
- * Constructor
11
- *
12
- * @param {LeyyoLike} leyyo
13
- * @param {string} cluster
14
- * @param {InertBuildOpt} options
15
- * */
16
9
  protected constructor(leyyo: LeyyoLike, cluster: string, options: InertBuildOpt);
17
10
  protected _inFqnStage(item: L): boolean;
18
11
  protected _afterFqnSet(full: string): void;
19
12
  protected _onFqnCompleted(item: L): void;
20
- /** @inheritDoc */
21
13
  register(options: InertOpt<T>): void;
22
- /** @inheritDoc */
23
- lazy(fqn: string, name: string, lazyTarget: Promise<T>, opt?: Omit<O, 'name' | 'target' | 'lazyTarget' | 'fqn'>): void;
24
- /** @inheritDoc */
14
+ lazy(fqn: string, name: string, lazyTarget: Promise<T>, opt?: Omit<O, "name" | "target" | "lazyTarget" | "fqn">): void;
25
15
  isLazy(name: string): boolean;
26
- /** @inheritDoc */
27
16
  isInvalid(name: string): boolean;
28
- /** @inheritDoc */
29
17
  isFailed(name: string): boolean;
30
- /** @inheritDoc */
31
18
  isConflicted(name: string): boolean;
32
- /** @inheritDoc */
33
19
  isEager(name: string): boolean;
34
- /** @inheritDoc */
35
20
  has(name: string): boolean;
36
- /** @inheritDoc */
37
21
  get(name: string): L;
38
- /** @inheritDoc */
39
22
  load(name: string): Promise<L>;
40
- /**
41
- * Validate target
42
- *
43
- * @param {any} target
44
- * @return {boolean}
45
- * */
46
23
  protected abstract _validate(target: T): boolean;
47
- /**
48
- * Get name of target
49
- *
50
- * @param {any} target
51
- * @return {string}
52
- * */
53
24
  protected abstract _getName(target: T): string;
54
- /**
55
- * Set name of target
56
- *
57
- * @param {any} target
58
- * @param {string} name
59
- * @return {string}
60
- * */
61
25
  protected abstract _setName(target: T, name: string): string;
62
- /**
63
- * Stamp lambda, todo
64
- *
65
- * @param {InertItem} item
66
- * */
67
26
  protected abstract _afterTargetFound(item: L): void;
68
- /**
69
- * custom operations after load
70
- *
71
- * @param {InertItem} item
72
- * @return {Promise}
73
- * @async
74
- * */
75
27
  protected abstract _nextLoad(item: L): Promise<void>;
76
28
  }