@twin.org/core 0.0.1-next.5 → 0.0.1-next.50

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 (66) hide show
  1. package/dist/cjs/index.cjs +1401 -736
  2. package/dist/esm/index.mjs +1398 -737
  3. package/dist/types/encoding/base58.d.ts +18 -0
  4. package/dist/types/factories/factory.d.ts +20 -1
  5. package/dist/types/helpers/envHelper.d.ts +16 -0
  6. package/dist/types/helpers/jsonHelper.d.ts +30 -0
  7. package/dist/types/helpers/objectHelper.d.ts +33 -0
  8. package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
  9. package/dist/types/index.d.ts +4 -0
  10. package/dist/types/models/IComponent.d.ts +12 -3
  11. package/dist/types/models/coerceType.d.ts +49 -0
  12. package/dist/types/models/compressionType.d.ts +1 -1
  13. package/dist/types/utils/asyncCache.d.ts +8 -0
  14. package/dist/types/utils/coerce.d.ts +22 -0
  15. package/dist/types/utils/converter.d.ts +12 -0
  16. package/dist/types/utils/guards.d.ts +16 -0
  17. package/dist/types/utils/is.d.ts +12 -0
  18. package/dist/types/utils/validation.d.ts +2 -0
  19. package/docs/changelog.md +8 -1
  20. package/docs/reference/classes/AlreadyExistsError.md +67 -25
  21. package/docs/reference/classes/ArrayHelper.md +6 -2
  22. package/docs/reference/classes/AsyncCache.md +56 -6
  23. package/docs/reference/classes/Base32.md +6 -2
  24. package/docs/reference/classes/Base58.md +61 -0
  25. package/docs/reference/classes/Base64.md +9 -3
  26. package/docs/reference/classes/Base64Url.md +6 -2
  27. package/docs/reference/classes/BaseError.md +65 -23
  28. package/docs/reference/classes/BitString.md +18 -6
  29. package/docs/reference/classes/Coerce.md +104 -8
  30. package/docs/reference/classes/Compression.md +16 -8
  31. package/docs/reference/classes/ConflictError.md +70 -26
  32. package/docs/reference/classes/Converter.md +104 -20
  33. package/docs/reference/classes/EnvHelper.md +43 -0
  34. package/docs/reference/classes/ErrorHelper.md +9 -3
  35. package/docs/reference/classes/Factory.md +78 -10
  36. package/docs/reference/classes/FilenameHelper.md +3 -1
  37. package/docs/reference/classes/GeneralError.md +65 -25
  38. package/docs/reference/classes/GuardError.md +70 -26
  39. package/docs/reference/classes/Guards.md +286 -74
  40. package/docs/reference/classes/HexHelper.md +15 -5
  41. package/docs/reference/classes/I18n.md +42 -16
  42. package/docs/reference/classes/Is.md +160 -44
  43. package/docs/reference/classes/JsonHelper.md +137 -5
  44. package/docs/reference/classes/NotFoundError.md +67 -25
  45. package/docs/reference/classes/NotImplementedError.md +61 -23
  46. package/docs/reference/classes/NotSupportedError.md +64 -24
  47. package/docs/reference/classes/ObjectHelper.md +188 -20
  48. package/docs/reference/classes/RandomHelper.md +3 -1
  49. package/docs/reference/classes/StringHelper.md +51 -17
  50. package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
  51. package/docs/reference/classes/UnauthorizedError.md +64 -24
  52. package/docs/reference/classes/UnprocessableError.md +65 -25
  53. package/docs/reference/classes/Url.md +30 -10
  54. package/docs/reference/classes/Urn.md +54 -18
  55. package/docs/reference/classes/Validation.md +315 -109
  56. package/docs/reference/classes/ValidationError.md +64 -24
  57. package/docs/reference/index.md +5 -0
  58. package/docs/reference/interfaces/IComponent.md +30 -8
  59. package/docs/reference/interfaces/IError.md +1 -1
  60. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  61. package/docs/reference/interfaces/IValidationFailure.md +1 -1
  62. package/docs/reference/type-aliases/CoerceType.md +5 -0
  63. package/docs/reference/variables/CoerceType.md +67 -0
  64. package/docs/reference/variables/CompressionType.md +1 -1
  65. package/locales/en.json +21 -1
  66. package/package.json +6 -6
@@ -22,15 +22,21 @@ Is the property defined.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **source**: `string`
25
+ ##### source
26
+
27
+ `string`
26
28
 
27
29
  The source of the error.
28
30
 
29
- **property**: `string`
31
+ ##### property
32
+
33
+ `string`
30
34
 
31
35
  The name of the property.
32
36
 
33
- **value**: `unknown`
37
+ ##### value
38
+
39
+ `unknown`
34
40
 
35
41
  The value to test.
36
42
 
@@ -52,15 +58,21 @@ Is the property a string.
52
58
 
53
59
  #### Parameters
54
60
 
55
- **source**: `string`
61
+ ##### source
62
+
63
+ `string`
56
64
 
57
65
  The source of the error.
58
66
 
59
- **property**: `string`
67
+ ##### property
68
+
69
+ `string`
60
70
 
61
71
  The name of the property.
62
72
 
63
- **value**: `unknown`
73
+ ##### value
74
+
75
+ `unknown`
64
76
 
65
77
  The value to test.
66
78
 
@@ -82,15 +94,57 @@ Is the property a string with a value.
82
94
 
83
95
  #### Parameters
84
96
 
85
- **source**: `string`
97
+ ##### source
98
+
99
+ `string`
100
+
101
+ The source of the error.
102
+
103
+ ##### property
104
+
105
+ `string`
106
+
107
+ The name of the property.
108
+
109
+ ##### value
110
+
111
+ `unknown`
112
+
113
+ The value to test.
114
+
115
+ #### Returns
116
+
117
+ `asserts value is string`
118
+
119
+ #### Throws
120
+
121
+ GuardError If the value does not match the assertion.
122
+
123
+ ***
124
+
125
+ ### json()
126
+
127
+ > `static` **json**(`source`, `property`, `value`): `asserts value is string`
128
+
129
+ Is the property a JSON value.
130
+
131
+ #### Parameters
132
+
133
+ ##### source
134
+
135
+ `string`
86
136
 
87
137
  The source of the error.
88
138
 
89
- **property**: `string`
139
+ ##### property
140
+
141
+ `string`
90
142
 
91
143
  The name of the property.
92
144
 
93
- **value**: `unknown`
145
+ ##### value
146
+
147
+ `unknown`
94
148
 
95
149
  The value to test.
96
150
 
@@ -112,15 +166,21 @@ Is the property a base64 string.
112
166
 
113
167
  #### Parameters
114
168
 
115
- **source**: `string`
169
+ ##### source
170
+
171
+ `string`
116
172
 
117
173
  The source of the error.
118
174
 
119
- **property**: `string`
175
+ ##### property
176
+
177
+ `string`
120
178
 
121
179
  The name of the property.
122
180
 
123
- **value**: `unknown`
181
+ ##### value
182
+
183
+ `unknown`
124
184
 
125
185
  The value to test.
126
186
 
@@ -142,15 +202,57 @@ Is the property a base64 url string.
142
202
 
143
203
  #### Parameters
144
204
 
145
- **source**: `string`
205
+ ##### source
206
+
207
+ `string`
208
+
209
+ The source of the error.
210
+
211
+ ##### property
212
+
213
+ `string`
214
+
215
+ The name of the property.
216
+
217
+ ##### value
218
+
219
+ `unknown`
220
+
221
+ The value to test.
222
+
223
+ #### Returns
224
+
225
+ `asserts value is string`
226
+
227
+ #### Throws
228
+
229
+ GuardError If the value does not match the assertion.
230
+
231
+ ***
232
+
233
+ ### stringBase58()
234
+
235
+ > `static` **stringBase58**(`source`, `property`, `value`): `asserts value is string`
236
+
237
+ Is the property a base58 string.
238
+
239
+ #### Parameters
240
+
241
+ ##### source
242
+
243
+ `string`
146
244
 
147
245
  The source of the error.
148
246
 
149
- **property**: `string`
247
+ ##### property
248
+
249
+ `string`
150
250
 
151
251
  The name of the property.
152
252
 
153
- **value**: `unknown`
253
+ ##### value
254
+
255
+ `unknown`
154
256
 
155
257
  The value to test.
156
258
 
@@ -172,19 +274,27 @@ Is the property a string with a hex value.
172
274
 
173
275
  #### Parameters
174
276
 
175
- **source**: `string`
277
+ ##### source
278
+
279
+ `string`
176
280
 
177
281
  The source of the error.
178
282
 
179
- **property**: `string`
283
+ ##### property
284
+
285
+ `string`
180
286
 
181
287
  The name of the property.
182
288
 
183
- **value**: `unknown`
289
+ ##### value
290
+
291
+ `unknown`
184
292
 
185
293
  The value to test.
186
294
 
187
- **allowPrefix**: `boolean` = `false`
295
+ ##### allowPrefix
296
+
297
+ `boolean` = `false`
188
298
 
189
299
  Allow the hex to have the 0x prefix.
190
300
 
@@ -206,23 +316,33 @@ Is the property a string with a hex value with fixed length.
206
316
 
207
317
  #### Parameters
208
318
 
209
- **source**: `string`
319
+ ##### source
320
+
321
+ `string`
210
322
 
211
323
  The source of the error.
212
324
 
213
- **property**: `string`
325
+ ##### property
326
+
327
+ `string`
214
328
 
215
329
  The name of the property.
216
330
 
217
- **value**: `unknown`
331
+ ##### value
332
+
333
+ `unknown`
218
334
 
219
335
  The value to test.
220
336
 
221
- **length**: `number`
337
+ ##### length
338
+
339
+ `number`
222
340
 
223
341
  The length of the string to match.
224
342
 
225
- **allowPrefix**: `boolean` = `false`
343
+ ##### allowPrefix
344
+
345
+ `boolean` = `false`
226
346
 
227
347
  Allow the hex to have the 0x prefix.
228
348
 
@@ -244,15 +364,21 @@ Is the property a number.
244
364
 
245
365
  #### Parameters
246
366
 
247
- **source**: `string`
367
+ ##### source
368
+
369
+ `string`
248
370
 
249
371
  The source of the error.
250
372
 
251
- **property**: `string`
373
+ ##### property
374
+
375
+ `string`
252
376
 
253
377
  The name of the property.
254
378
 
255
- **value**: `unknown`
379
+ ##### value
380
+
381
+ `unknown`
256
382
 
257
383
  The value to test.
258
384
 
@@ -274,15 +400,21 @@ Is the property an integer.
274
400
 
275
401
  #### Parameters
276
402
 
277
- **source**: `string`
403
+ ##### source
404
+
405
+ `string`
278
406
 
279
407
  The source of the error.
280
408
 
281
- **property**: `string`
409
+ ##### property
410
+
411
+ `string`
282
412
 
283
413
  The name of the property.
284
414
 
285
- **value**: `unknown`
415
+ ##### value
416
+
417
+ `unknown`
286
418
 
287
419
  The value to test.
288
420
 
@@ -304,15 +436,21 @@ Is the property a bigint.
304
436
 
305
437
  #### Parameters
306
438
 
307
- **source**: `string`
439
+ ##### source
440
+
441
+ `string`
308
442
 
309
443
  The source of the error.
310
444
 
311
- **property**: `string`
445
+ ##### property
446
+
447
+ `string`
312
448
 
313
449
  The name of the property.
314
450
 
315
- **value**: `unknown`
451
+ ##### value
452
+
453
+ `unknown`
316
454
 
317
455
  The value to test.
318
456
 
@@ -334,15 +472,21 @@ Is the property a boolean.
334
472
 
335
473
  #### Parameters
336
474
 
337
- **source**: `string`
475
+ ##### source
476
+
477
+ `string`
338
478
 
339
479
  The source of the error.
340
480
 
341
- **property**: `string`
481
+ ##### property
482
+
483
+ `string`
342
484
 
343
485
  The name of the property.
344
486
 
345
- **value**: `unknown`
487
+ ##### value
488
+
489
+ `unknown`
346
490
 
347
491
  The value to test.
348
492
 
@@ -364,15 +508,21 @@ Is the property a date.
364
508
 
365
509
  #### Parameters
366
510
 
367
- **source**: `string`
511
+ ##### source
512
+
513
+ `string`
368
514
 
369
515
  The source of the error.
370
516
 
371
- **property**: `string`
517
+ ##### property
518
+
519
+ `string`
372
520
 
373
521
  The name of the property.
374
522
 
375
- **value**: `unknown`
523
+ ##### value
524
+
525
+ `unknown`
376
526
 
377
527
  The value to test.
378
528
 
@@ -394,15 +544,21 @@ Is the property a timestamp in milliseconds.
394
544
 
395
545
  #### Parameters
396
546
 
397
- **source**: `string`
547
+ ##### source
548
+
549
+ `string`
398
550
 
399
551
  The source of the error.
400
552
 
401
- **property**: `string`
553
+ ##### property
554
+
555
+ `string`
402
556
 
403
557
  The name of the property.
404
558
 
405
- **value**: `unknown`
559
+ ##### value
560
+
561
+ `unknown`
406
562
 
407
563
  The value to test.
408
564
 
@@ -424,15 +580,21 @@ Is the property a timestamp in seconds.
424
580
 
425
581
  #### Parameters
426
582
 
427
- **source**: `string`
583
+ ##### source
584
+
585
+ `string`
428
586
 
429
587
  The source of the error.
430
588
 
431
- **property**: `string`
589
+ ##### property
590
+
591
+ `string`
432
592
 
433
593
  The name of the property.
434
594
 
435
- **value**: `unknown`
595
+ ##### value
596
+
597
+ `unknown`
436
598
 
437
599
  The value to test.
438
600
 
@@ -454,19 +616,25 @@ Is the property an object.
454
616
 
455
617
  #### Type Parameters
456
618
 
457
- • **T** = `object`
619
+ • **T** = \{\}
458
620
 
459
621
  #### Parameters
460
622
 
461
- **source**: `string`
623
+ ##### source
624
+
625
+ `string`
462
626
 
463
627
  The source of the error.
464
628
 
465
- **property**: `string`
629
+ ##### property
630
+
631
+ `string`
466
632
 
467
633
  The name of the property.
468
634
 
469
- **value**: `unknown`
635
+ ##### value
636
+
637
+ `unknown`
470
638
 
471
639
  The value to test.
472
640
 
@@ -488,19 +656,25 @@ Is the property is an object with at least one property.
488
656
 
489
657
  #### Type Parameters
490
658
 
491
- • **T** = `object`
659
+ • **T** = \{\}
492
660
 
493
661
  #### Parameters
494
662
 
495
- **source**: `string`
663
+ ##### source
664
+
665
+ `string`
496
666
 
497
667
  The source of the error.
498
668
 
499
- **property**: `string`
669
+ ##### property
670
+
671
+ `string`
500
672
 
501
673
  The name of the property.
502
674
 
503
- **value**: `unknown`
675
+ ##### value
676
+
677
+ `unknown`
504
678
 
505
679
  The value to test.
506
680
 
@@ -526,15 +700,21 @@ Is the property is an array.
526
700
 
527
701
  #### Parameters
528
702
 
529
- **source**: `string`
703
+ ##### source
704
+
705
+ `string`
530
706
 
531
707
  The source of the error.
532
708
 
533
- **property**: `string`
709
+ ##### property
710
+
711
+ `string`
534
712
 
535
713
  The name of the property.
536
714
 
537
- **value**: `unknown`
715
+ ##### value
716
+
717
+ `unknown`
538
718
 
539
719
  The value to test.
540
720
 
@@ -560,15 +740,21 @@ Is the property is an array with at least one item.
560
740
 
561
741
  #### Parameters
562
742
 
563
- **source**: `string`
743
+ ##### source
744
+
745
+ `string`
564
746
 
565
747
  The source of the error.
566
748
 
567
- **property**: `string`
749
+ ##### property
750
+
751
+ `string`
568
752
 
569
753
  The name of the property.
570
754
 
571
- **value**: `unknown`
755
+ ##### value
756
+
757
+ `unknown`
572
758
 
573
759
  The value to test.
574
760
 
@@ -594,19 +780,27 @@ Is the property one of a list of items.
594
780
 
595
781
  #### Parameters
596
782
 
597
- **source**: `string`
783
+ ##### source
784
+
785
+ `string`
598
786
 
599
787
  The source of the error.
600
788
 
601
- **property**: `string`
789
+ ##### property
790
+
791
+ `string`
602
792
 
603
793
  The name of the property.
604
794
 
605
- **value**: `T`
795
+ ##### value
796
+
797
+ `T`
606
798
 
607
799
  The value to test.
608
800
 
609
- **options**: `T`[]
801
+ ##### options
802
+
803
+ `T`[]
610
804
 
611
805
  The options the value must be one of.
612
806
 
@@ -622,27 +816,33 @@ GuardError If the value does not match the assertion.
622
816
 
623
817
  ### uint8Array()
624
818
 
625
- > `static` **uint8Array**(`source`, `property`, `value`): `asserts value is Uint8Array`
819
+ > `static` **uint8Array**(`source`, `property`, `value`): `asserts value is Uint8Array<ArrayBufferLike>`
626
820
 
627
821
  Is the property a Uint8Array.
628
822
 
629
823
  #### Parameters
630
824
 
631
- **source**: `string`
825
+ ##### source
826
+
827
+ `string`
632
828
 
633
829
  The source of the error.
634
830
 
635
- **property**: `string`
831
+ ##### property
832
+
833
+ `string`
636
834
 
637
835
  The name of the property.
638
836
 
639
- **value**: `unknown`
837
+ ##### value
838
+
839
+ `unknown`
640
840
 
641
841
  The value to test.
642
842
 
643
843
  #### Returns
644
844
 
645
- `asserts value is Uint8Array`
845
+ `asserts value is Uint8Array<ArrayBufferLike>`
646
846
 
647
847
  #### Throws
648
848
 
@@ -658,15 +858,21 @@ Is the property a function.
658
858
 
659
859
  #### Parameters
660
860
 
661
- **source**: `string`
861
+ ##### source
862
+
863
+ `string`
662
864
 
663
865
  The source of the error.
664
866
 
665
- **property**: `string`
867
+ ##### property
868
+
869
+ `string`
666
870
 
667
871
  The name of the property.
668
872
 
669
- **value**: `unknown`
873
+ ##### value
874
+
875
+ `unknown`
670
876
 
671
877
  The value to test.
672
878
 
@@ -690,15 +896,21 @@ Is the property a string formatted as an email address.
690
896
 
691
897
  #### Parameters
692
898
 
693
- **source**: `string`
899
+ ##### source
900
+
901
+ `string`
694
902
 
695
903
  The source of the error.
696
904
 
697
- **property**: `string`
905
+ ##### property
906
+
907
+ `string`
698
908
 
699
909
  The name of the property.
700
910
 
701
- **value**: `unknown`
911
+ ##### value
912
+
913
+ `unknown`
702
914
 
703
915
  The value to test.
704
916
 
@@ -22,7 +22,9 @@ Strip the 0x prefix if it exists.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **hex**: `string`
25
+ ##### hex
26
+
27
+ `string`
26
28
 
27
29
  The hex value to strip.
28
30
 
@@ -42,7 +44,9 @@ Add the 0x prefix if it does not exist.
42
44
 
43
45
  #### Parameters
44
46
 
45
- **hex**: `string`
47
+ ##### hex
48
+
49
+ `string`
46
50
 
47
51
  The hex value to add the prefix to.
48
52
 
@@ -62,7 +66,9 @@ Does the hex string have the prefix.
62
66
 
63
67
  #### Parameters
64
68
 
65
- **hex**: `string`
69
+ ##### hex
70
+
71
+ `string`
66
72
 
67
73
  The hex value to check for the prefix.
68
74
 
@@ -82,11 +88,15 @@ Is the data hex format.
82
88
 
83
89
  #### Parameters
84
90
 
85
- **value**: `string`
91
+ ##### value
92
+
93
+ `string`
86
94
 
87
95
  The value to test.
88
96
 
89
- **allowPrefix**: `boolean` = `false`
97
+ ##### allowPrefix
98
+
99
+ `boolean` = `false`
90
100
 
91
101
  Allow the hex to have the 0x prefix.
92
102