@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
@@ -1,79 +1,470 @@
1
- import { Leyyo } from "../leyyo";
2
- import { Arr, OneOrMore, ShiftMain, ShiftSecure } from "../aliases";
3
- import { TypeOpt } from "../to";
1
+ import { Arr, AssertionCallback, AssertionOpt, InitLike, ShiftMain, ShiftSecure, ToTypeOpt } from "../shared";
2
+ /**
3
+ * Basic assertions to easy use
4
+ * */
4
5
  export interface CommonAssertion extends ShiftSecure<CommonAssertionSecure> {
5
- raise(opt: string, value?: any, indicator?: string, def?: string): void;
6
- raise(opt: AssertionCallback, value?: any, indicator?: string, def?: string): void;
6
+ /**
7
+ * Raises an error with given parameters
8
+ *
9
+ * @param {string} message - error message
10
+ * @param {any?} value
11
+ * @param {string?} indicator - developer indicator
12
+ * @param {string?} def - default error message
13
+ * */
14
+ raise(message: string, value?: any, indicator?: string, def?: string): void;
15
+ /**
16
+ * Raises an error with given parameters
17
+ *
18
+ * @param {AssertionCallback} fn - callback which should return {@link AssertionOpt}
19
+ * @param {any?} value
20
+ * @param {string?} indicator - developer indicator
21
+ * @param {string?} def - default error message
22
+ * */
23
+ raise(fn: AssertionCallback, value?: any, indicator?: string, def?: string): void;
24
+ /**
25
+ * Raises an error with given parameters
26
+ *
27
+ * @param {AssertionOpt} opt - options
28
+ * @param {any?} value
29
+ * @param {string?} indicator - developer indicator
30
+ * @param {string?} def - default error message
31
+ * */
7
32
  raise(opt: AssertionOpt, value?: any, indicator?: string, def?: string): void;
33
+ /**
34
+ * Empty function, it can be more useful sometimes
35
+ *
36
+ * @param {Arr} params - insignificant parameters
37
+ * */
8
38
  emptyFn(...params: Arr): void;
9
- secureJson<E = unknown>(value: unknown): E;
10
- realNumber(value: number, opt?: TypeOpt): number;
11
- notEmpty(value: unknown, message?: string): void;
12
- notEmpty(value: unknown, fn?: AssertionCallback): void;
13
- notEmpty(value: unknown, opt?: AssertionOpt): void;
14
- primitive(value: unknown, message?: string): void;
15
- primitive(value: unknown, fn?: AssertionCallback): void;
16
- primitive(value: unknown, opt?: AssertionOpt): void;
17
- value(value: unknown, message?: string): void;
18
- value(value: unknown, fn?: AssertionCallback): void;
19
- value(value: unknown, opt?: AssertionOpt): void;
20
- key(value: unknown, message?: string): void;
21
- key(value: unknown, fn?: AssertionCallback): void;
22
- key(value: unknown, opt?: AssertionOpt): void;
23
- object(value: unknown, message?: string): void;
24
- object(value: unknown, fn?: AssertionCallback): void;
25
- object(value: unknown, opt?: AssertionOpt): void;
26
- array(value: unknown, message?: string): void;
27
- array(value: unknown, fn?: AssertionCallback): void;
28
- array(value: unknown, opt?: AssertionOpt): void;
29
- func(value: unknown, message?: string): void;
30
- func(value: unknown, fn?: AssertionCallback): void;
31
- func(value: unknown, opt?: AssertionOpt): void;
32
- number(value: unknown, message?: string): void;
33
- number(value: unknown, fn?: AssertionCallback): void;
34
- number(value: unknown, opt?: AssertionOpt): void;
35
- positiveNumber(value: unknown, message?: string): void;
36
- positiveNumber(value: unknown, fn?: AssertionCallback): void;
37
- positiveNumber(value: unknown, opt?: AssertionOpt): void;
38
- integer(value: unknown, message?: string): void;
39
- integer(value: unknown, fn?: AssertionCallback): void;
40
- integer(value: unknown, opt?: AssertionOpt): void;
41
- positiveInteger(value: unknown, message?: string): void;
42
- positiveInteger(value: unknown, fn?: AssertionCallback): void;
43
- positiveInteger(value: unknown, opt?: AssertionOpt): void;
44
- string(value: unknown, message?: string): void;
45
- string(value: unknown, fn?: AssertionCallback): void;
46
- string(value: unknown, opt?: AssertionOpt): void;
47
- text(value: unknown, message?: string): string;
48
- text(value: unknown, fn?: AssertionCallback): string;
49
- text(value: unknown, opt?: AssertionOpt): string;
50
- clazz(value: unknown, message?: string): void;
51
- clazz(value: unknown, fn?: AssertionCallback): void;
52
- clazz(value: unknown, opt?: AssertionOpt): void;
53
- date(value: unknown, message?: string): void;
54
- date(value: unknown, fn?: AssertionCallback): void;
55
- date(value: unknown, opt?: AssertionOpt): void;
56
- boolean(value: unknown, message?: string): void;
57
- boolean(value: unknown, fn?: AssertionCallback): void;
58
- boolean(value: unknown, opt?: AssertionOpt): void;
39
+ /**
40
+ * Converts ant value secure json value
41
+ *
42
+ * Controls:
43
+ * - circular dependency
44
+ * - depth control
45
+ * - handling function and symbol values
46
+ *
47
+ * @param {any} value
48
+ * @returns {any} - it based on generic
49
+ * */
50
+ secureJson<E = unknown>(value: any): E;
51
+ /**
52
+ * Validates value is real number
53
+ *
54
+ * Real number means: !NaN and isFinite
55
+ *
56
+ * @param {any} value
57
+ * @param {ToTypeOpt} opt
58
+ * @returns {number}
59
+ * */
60
+ realNumber(value: number, opt?: ToTypeOpt): number;
61
+ /**
62
+ * Asserts value is not empty
63
+ * @see CommonIs#empty
64
+ *
65
+ * @param {any} value
66
+ * @param {string?} message
67
+ * */
68
+ notEmpty(value: any, message?: string): void;
69
+ /**
70
+ * Asserts value is not empty
71
+ * @see CommonIs#empty
72
+ *
73
+ * @param {any} value
74
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
75
+ * */
76
+ notEmpty(value: any, fn?: AssertionCallback): void;
77
+ /**
78
+ * Asserts value is not empty
79
+ * @see CommonIs#empty
80
+ *
81
+ * @param {any} value
82
+ * @param {AssertionOpt?} opt
83
+ * */
84
+ notEmpty(value: any, opt?: AssertionOpt): void;
85
+ /**
86
+ * Asserts value is a primitive
87
+ * @see CommonIs#primitive
88
+ *
89
+ * @param {any} value
90
+ * @param {string?} message
91
+ * */
92
+ primitive(value: any, message?: string): void;
93
+ /**
94
+ * Asserts value is a primitive
95
+ * @see CommonIs#primitive
96
+ *
97
+ * @param {any} value
98
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
99
+ * */
100
+ primitive(value: any, fn?: AssertionCallback): void;
101
+ /**
102
+ * Asserts value is a primitive
103
+ * @see CommonIs#primitive
104
+ *
105
+ * @param {any} value
106
+ * @param {AssertionOpt?} opt
107
+ * */
108
+ primitive(value: any, opt?: AssertionOpt): void;
109
+ /**
110
+ * Asserts value is a real value
111
+ * @see CommonIs#realValue
112
+ *
113
+ * @param {any} value
114
+ * @param {string?} message
115
+ * */
116
+ realValue(value: any, message?: string): void;
117
+ /**
118
+ * Asserts value is a real value
119
+ * @see CommonIs#realValue
120
+ *
121
+ * @param {any} value
122
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
123
+ * */
124
+ realValue(value: any, fn?: AssertionCallback): void;
125
+ /**
126
+ * Asserts value is a real value
127
+ * @see CommonIs#realValue
128
+ *
129
+ * @param {any} value
130
+ * @param {AssertionOpt?} opt
131
+ * */
132
+ realValue(value: any, opt?: AssertionOpt): void;
133
+ /**
134
+ * Asserts value is a key
135
+ * @see CommonIs#key
136
+ *
137
+ * @param {any} value
138
+ * @param {string?} message
139
+ * */
140
+ key(value: any, message?: string): void;
141
+ /**
142
+ * Asserts value is a key
143
+ * @see CommonIs#key
144
+ *
145
+ * @param {any} value
146
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
147
+ * */
148
+ key(value: any, fn?: AssertionCallback): void;
149
+ /**
150
+ * Asserts value is a key
151
+ * @see CommonIs#key
152
+ *
153
+ * @param {any} value
154
+ * @param {AssertionOpt?} opt
155
+ * */
156
+ key(value: any, opt?: AssertionOpt): void;
157
+ /**
158
+ * Asserts value is an object
159
+ * @see CommonIs#object
160
+ *
161
+ * @param {any} value
162
+ * @param {string?} message
163
+ * */
164
+ object(value: any, message?: string): void;
165
+ /**
166
+ * Asserts value is an object
167
+ * @see CommonIs#object
168
+ *
169
+ * @param {any} value
170
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
171
+ * */
172
+ object(value: any, fn?: AssertionCallback): void;
173
+ /**
174
+ * Asserts value is an object
175
+ * @see CommonIs#object
176
+ *
177
+ * @param {any} value
178
+ * @param {AssertionOpt?} opt
179
+ * */
180
+ object(value: any, opt?: AssertionOpt): void;
181
+ /**
182
+ * Asserts value is an array
183
+ * @see CommonIs#empty
184
+ *
185
+ * @param {any} value
186
+ * @param {string?} message
187
+ * */
188
+ array(value: any, message?: string): void;
189
+ /**
190
+ * Asserts value is an array
191
+ * @see CommonIs#array
192
+ *
193
+ * @param {any} value
194
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
195
+ * */
196
+ array(value: any, fn?: AssertionCallback): void;
197
+ /**
198
+ * Asserts value is an array
199
+ * @see CommonIs#array
200
+ *
201
+ * @param {any} value
202
+ * @param {AssertionOpt?} opt
203
+ * */
204
+ array(value: any, opt?: AssertionOpt): void;
205
+ /**
206
+ * Asserts value is a function
207
+ * @see CommonIs#func
208
+ *
209
+ * @param {any} value
210
+ * @param {string?} message
211
+ * */
212
+ func(value: any, message?: string): void;
213
+ /**
214
+ * Asserts value is a function
215
+ * @see CommonIs#func
216
+ *
217
+ * @param {any} value
218
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
219
+ * */
220
+ func(value: any, fn?: AssertionCallback): void;
221
+ /**
222
+ * Asserts value is a function
223
+ * @see CommonIs#func
224
+ *
225
+ * @param {any} value
226
+ * @param {AssertionOpt?} opt
227
+ * */
228
+ func(value: any, opt?: AssertionOpt): void;
229
+ /**
230
+ * Asserts value is a number
231
+ * @see CommonIs#number
232
+ *
233
+ * @param {any} value
234
+ * @param {string?} message
235
+ * */
236
+ number(value: any, message?: string): void;
237
+ /**
238
+ * Asserts value is a number
239
+ * @see CommonIs#number
240
+ *
241
+ * @param {any} value
242
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
243
+ * */
244
+ number(value: any, fn?: AssertionCallback): void;
245
+ /**
246
+ * Asserts value is a number
247
+ * @see CommonIs#number
248
+ *
249
+ * @param {any} value
250
+ * @param {AssertionOpt?} opt
251
+ * */
252
+ number(value: any, opt?: AssertionOpt): void;
253
+ /**
254
+ * Asserts value is a positive number
255
+ * @see CommonIs#number
256
+ *
257
+ * @param {any} value
258
+ * @param {string?} message
259
+ * */
260
+ positiveNumber(value: any, message?: string): void;
261
+ /**
262
+ * Asserts value is a positive number
263
+ * @see CommonIs#number
264
+ *
265
+ * @param {any} value
266
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
267
+ * */
268
+ positiveNumber(value: any, fn?: AssertionCallback): void;
269
+ /**
270
+ * Asserts value is a positive number
271
+ * @see CommonIs#number
272
+ *
273
+ * @param {any} value
274
+ * @param {AssertionOpt?} opt
275
+ * */
276
+ positiveNumber(value: any, opt?: AssertionOpt): void;
277
+ /**
278
+ * Asserts value is an integer
279
+ * @see CommonIs#integer
280
+ *
281
+ * @param {any} value
282
+ * @param {string?} message
283
+ * */
284
+ integer(value: any, message?: string): void;
285
+ /**
286
+ * Asserts value is an integer
287
+ * @see CommonIs#integer
288
+ *
289
+ * @param {any} value
290
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
291
+ * */
292
+ integer(value: any, fn?: AssertionCallback): void;
293
+ /**
294
+ * Asserts value is an integer
295
+ * @see CommonIs#integer
296
+ *
297
+ * @param {any} value
298
+ * @param {AssertionOpt?} opt
299
+ * */
300
+ integer(value: any, opt?: AssertionOpt): void;
301
+ /**
302
+ * Asserts value is a safe integer
303
+ * @see CommonIs#safeInteger
304
+ *
305
+ * @param {any} value
306
+ * @param {string?} message
307
+ * */
308
+ safeInteger(value: any, message?: string): void;
309
+ /**
310
+ * Asserts value is a safe integer
311
+ * @see CommonIs#safeInteger
312
+ *
313
+ * @param {any} value
314
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
315
+ * */
316
+ safeInteger(value: any, fn?: AssertionCallback): void;
317
+ /**
318
+ * Asserts value is a safe integer
319
+ * @see CommonIs#safeInteger
320
+ *
321
+ * @param {any} value
322
+ * @param {AssertionOpt?} opt
323
+ * */
324
+ safeInteger(value: any, opt?: AssertionOpt): void;
325
+ /**
326
+ * Asserts value is a positive integer
327
+ * @see CommonIs#integer
328
+ *
329
+ * @param {any} value
330
+ * @param {string?} message
331
+ * */
332
+ positiveInteger(value: any, message?: string): void;
333
+ /**
334
+ * Asserts value is a positive integer
335
+ * @see CommonIs#integer
336
+ *
337
+ * @param {any} value
338
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
339
+ * */
340
+ positiveInteger(value: any, fn?: AssertionCallback): void;
341
+ /**
342
+ * Asserts value is a positive integer
343
+ * @see CommonIs#integer
344
+ *
345
+ * @param {any} value
346
+ * @param {AssertionOpt?} opt
347
+ * */
348
+ positiveInteger(value: any, opt?: AssertionOpt): void;
349
+ /**
350
+ * Asserts value is a string
351
+ * @see CommonIs#string
352
+ *
353
+ * @param {any} value
354
+ * @param {string?} message
355
+ * */
356
+ string(value: any, message?: string): void;
357
+ /**
358
+ * Asserts value is a string
359
+ * @see CommonIs#string
360
+ *
361
+ * @param {any} value
362
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
363
+ * */
364
+ string(value: any, fn?: AssertionCallback): void;
365
+ /**
366
+ * Asserts value is a string
367
+ * @see CommonIs#string
368
+ *
369
+ * @param {any} value
370
+ * @param {AssertionOpt?} opt
371
+ * */
372
+ string(value: any, opt?: AssertionOpt): void;
373
+ /**
374
+ * Asserts value is a text
375
+ * @see CommonIs#text
376
+ *
377
+ * @param {any} value
378
+ * @param {string?} message
379
+ * */
380
+ text(value: any, message?: string): string;
381
+ /**
382
+ * Asserts value is a text
383
+ * @see CommonIs#text
384
+ *
385
+ * @param {any} value
386
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
387
+ * */
388
+ text(value: any, fn?: AssertionCallback): string;
389
+ /**
390
+ * Asserts value is a text
391
+ * @see CommonIs#text
392
+ *
393
+ * @param {any} value
394
+ * @param {AssertionOpt?} opt
395
+ * */
396
+ text(value: any, opt?: AssertionOpt): string;
397
+ /**
398
+ * Asserts value is a possible class
399
+ * @see CommonIs#clazz
400
+ *
401
+ * @param {any} value
402
+ * @param {string?} message
403
+ * */
404
+ clazz(value: any, message?: string): void;
405
+ /**
406
+ * Asserts value is a possible class
407
+ * @see CommonIs#clazz
408
+ *
409
+ * @param {any} value
410
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
411
+ * */
412
+ clazz(value: any, fn?: AssertionCallback): void;
413
+ /**
414
+ * Asserts value is a possible class
415
+ * @see CommonIs#clazz
416
+ *
417
+ * @param {any} value
418
+ * @param {AssertionOpt?} opt
419
+ * */
420
+ clazz(value: any, opt?: AssertionOpt): void;
421
+ /**
422
+ * Asserts value is a date
423
+ *
424
+ * @param {any} value
425
+ * @param {string?} message
426
+ * */
427
+ date(value: any, message?: string): void;
428
+ /**
429
+ * Asserts value is a date
430
+ *
431
+ * @param {any} value
432
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
433
+ * */
434
+ date(value: any, fn?: AssertionCallback): void;
435
+ /**
436
+ * Asserts value is a date
437
+ *
438
+ * @param {any} value
439
+ * @param {AssertionOpt?} opt
440
+ * */
441
+ date(value: any, opt?: AssertionOpt): void;
442
+ /**
443
+ * Asserts value is a boolean
444
+ * @see CommonIs#boolean
445
+ *
446
+ * @param {any} value
447
+ * @param {string?} message
448
+ * */
449
+ boolean(value: any, message?: string): void;
450
+ /**
451
+ * Asserts value is a boolean
452
+ * @see CommonIs#boolean
453
+ *
454
+ * @param {any} value
455
+ * @param {AssertionCallback?} fn - it should return {@link AssertionOpt}
456
+ * */
457
+ boolean(value: any, fn?: AssertionCallback): void;
458
+ /**
459
+ * Asserts value is a boolean
460
+ * @see CommonIs#boolean
461
+ *
462
+ * @param {any} value
463
+ * @param {AssertionOpt?} opt
464
+ * */
465
+ boolean(value: any, opt?: AssertionOpt): void;
59
466
  }
60
- export interface CommonAssertionSecure extends ShiftMain<CommonAssertion> {
61
- $init(leyyo: Leyyo): void;
62
- }
63
- export interface AssertionOpt {
64
- indicator?: AssertionReason | string;
65
- param?: string;
66
- where?: string;
67
- value?: any;
68
- expected?: OneOrMore<string>;
69
- current?: string;
70
- type?: string;
71
- [k: string]: any;
72
- }
73
- type AssertionReason = 'invalid.type' | 'not.found' | 'duplicated' | 'empty';
74
- export type AssertionCallback = () => string | AssertionOpt;
75
- export interface AssertionBuiltResult {
76
- message?: string;
77
- params: AssertionOpt;
78
- }
79
- export {};
467
+ /**
468
+ * Secure assertion methods
469
+ * */
470
+ export type CommonAssertionSecure = ShiftMain<CommonAssertion> & InitLike;
@@ -1,3 +1,2 @@
1
1
  export * from './index-types';
2
2
  export * from './common-assertion-impl';
3
- export * from './assert';
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./index-types"), exports);
18
18
  __exportStar(require("./common-assertion-impl"), exports);
19
- __exportStar(require("./assert"), exports);
@@ -1,17 +1,19 @@
1
- import { CommonError, CommonErrorSecure, ExceptionLike } from "./index-types";
1
+ import { CommonError, CommonErrorSecure } from "./index-types";
2
2
  import { Leyyo } from "../leyyo";
3
- import { Dict } from "../aliases";
4
- import { Exception } from "./exception";
3
+ import { Dict } from "../shared";
4
+ import { ExceptionLike } from "../exception";
5
5
  export declare class CommonErrorImpl implements CommonError, CommonErrorSecure {
6
+ private hook;
6
7
  get $back(): CommonError;
7
8
  $init(leyyo: Leyyo): void;
8
9
  get $secure(): CommonErrorSecure;
9
10
  addOmit(clz: Function, ...properties: Array<string>): boolean;
10
11
  addSign(err: Error, ...keys: Array<string>): boolean;
11
12
  afterCreate(e: ExceptionLike): void;
13
+ register(cls: Function): void;
12
14
  build(e: Error | string): ExceptionLike;
13
15
  buildStack(e: Error): void;
14
- copyStack(exception: Exception, error: Error): void;
16
+ copyStack(exception: ExceptionLike, error: Error): void;
15
17
  causedBy(e: Error | string): ExceptionLike;
16
18
  getOmit(clz: Function): Array<string>;
17
19
  getSign(err: Error): Array<string>;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommonErrorImpl = void 0;
4
- const exception_1 = require("./exception");
5
- const constants_1 = require("../constants");
4
+ const shared_1 = require("../shared");
5
+ const exception_1 = require("../exception");
6
6
  // noinspection JSUnusedLocalSymbols
7
7
  class CommonErrorImpl {
8
8
  get $back() {
9
9
  return this;
10
10
  }
11
11
  $init(leyyo) {
12
+ this.hook = leyyo.hook;
12
13
  const fields = ['build', 'afterCreate', 'causedBy', 'toObject', 'buildStack', 'copyStack',
13
14
  'initSign', 'addSign', 'getSign', 'removeSign', 'hasSign',
14
15
  'initOmit', 'addOmit', 'getOmit', 'inheritOmit'];
@@ -17,9 +18,9 @@ class CommonErrorImpl {
17
18
  rec[field] = this[field];
18
19
  });
19
20
  // define itself temporarily for error operations
20
- leyyo.callback.defineProvider(constants_1.LY_ATTACHED_ERROR, CommonErrorImpl, rec);
21
+ this.hook.defineProvider(shared_1.LY_ATTACHED_ERROR, CommonErrorImpl, rec);
21
22
  // when new error provider is defined, replace all common methods
22
- leyyo.callback.whenProviderDefined(constants_1.LY_ATTACHED_ERROR, CommonErrorImpl, (ins) => {
23
+ this.hook.whenProviderDefined(shared_1.LY_ATTACHED_ERROR, CommonErrorImpl, (ins) => {
23
24
  fields.forEach(field => {
24
25
  if (typeof ins[field] === 'function') {
25
26
  this[field] = ins[field];
@@ -39,6 +40,9 @@ class CommonErrorImpl {
39
40
  afterCreate(e) {
40
41
  e.$secure.$setName(e.constructor.name);
41
42
  }
43
+ register(cls) {
44
+ this.hook.queueForCallback(shared_1.LY_PENDING_ERROR_REGISTER, cls);
45
+ }
42
46
  build(e) {
43
47
  if (e instanceof exception_1.Exception) {
44
48
  return e;