@twin.org/core 0.0.1-next.4 → 0.0.1-next.40

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 (65) hide show
  1. package/dist/cjs/index.cjs +1379 -738
  2. package/dist/esm/index.mjs +1376 -739
  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 +29 -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/coerce.d.ts +22 -0
  14. package/dist/types/utils/converter.d.ts +12 -0
  15. package/dist/types/utils/guards.d.ts +16 -0
  16. package/dist/types/utils/is.d.ts +12 -0
  17. package/dist/types/utils/validation.d.ts +2 -0
  18. package/docs/changelog.md +1 -1
  19. package/docs/reference/classes/AlreadyExistsError.md +67 -25
  20. package/docs/reference/classes/ArrayHelper.md +6 -2
  21. package/docs/reference/classes/AsyncCache.md +18 -6
  22. package/docs/reference/classes/Base32.md +6 -2
  23. package/docs/reference/classes/Base58.md +61 -0
  24. package/docs/reference/classes/Base64.md +9 -3
  25. package/docs/reference/classes/Base64Url.md +6 -2
  26. package/docs/reference/classes/BaseError.md +65 -23
  27. package/docs/reference/classes/BitString.md +18 -6
  28. package/docs/reference/classes/Coerce.md +104 -8
  29. package/docs/reference/classes/Compression.md +12 -4
  30. package/docs/reference/classes/ConflictError.md +70 -26
  31. package/docs/reference/classes/Converter.md +104 -20
  32. package/docs/reference/classes/EnvHelper.md +43 -0
  33. package/docs/reference/classes/ErrorHelper.md +9 -3
  34. package/docs/reference/classes/Factory.md +78 -10
  35. package/docs/reference/classes/FilenameHelper.md +3 -1
  36. package/docs/reference/classes/GeneralError.md +65 -25
  37. package/docs/reference/classes/GuardError.md +70 -26
  38. package/docs/reference/classes/Guards.md +284 -72
  39. package/docs/reference/classes/HexHelper.md +15 -5
  40. package/docs/reference/classes/I18n.md +42 -16
  41. package/docs/reference/classes/Is.md +156 -40
  42. package/docs/reference/classes/JsonHelper.md +133 -5
  43. package/docs/reference/classes/NotFoundError.md +67 -25
  44. package/docs/reference/classes/NotImplementedError.md +61 -23
  45. package/docs/reference/classes/NotSupportedError.md +64 -24
  46. package/docs/reference/classes/ObjectHelper.md +188 -20
  47. package/docs/reference/classes/RandomHelper.md +3 -1
  48. package/docs/reference/classes/StringHelper.md +51 -17
  49. package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
  50. package/docs/reference/classes/UnauthorizedError.md +64 -24
  51. package/docs/reference/classes/UnprocessableError.md +65 -25
  52. package/docs/reference/classes/Url.md +30 -10
  53. package/docs/reference/classes/Urn.md +54 -18
  54. package/docs/reference/classes/Validation.md +313 -107
  55. package/docs/reference/classes/ValidationError.md +64 -24
  56. package/docs/reference/index.md +5 -0
  57. package/docs/reference/interfaces/IComponent.md +30 -8
  58. package/docs/reference/interfaces/IError.md +1 -1
  59. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  60. package/docs/reference/interfaces/IValidationFailure.md +1 -1
  61. package/docs/reference/type-aliases/CoerceType.md +5 -0
  62. package/docs/reference/variables/CoerceType.md +67 -0
  63. package/docs/reference/variables/CompressionType.md +1 -1
  64. package/locales/en.json +18 -1
  65. package/package.json +6 -6
@@ -0,0 +1,35 @@
1
+ # Class: Uint8ArrayHelper
2
+
3
+ Class to help with uint8 arrays.
4
+
5
+ ## Constructors
6
+
7
+ ### new Uint8ArrayHelper()
8
+
9
+ > **new Uint8ArrayHelper**(): [`Uint8ArrayHelper`](Uint8ArrayHelper.md)
10
+
11
+ #### Returns
12
+
13
+ [`Uint8ArrayHelper`](Uint8ArrayHelper.md)
14
+
15
+ ## Methods
16
+
17
+ ### concat()
18
+
19
+ > `static` **concat**(`arrays`): `Uint8Array`
20
+
21
+ Concatenate multiple arrays.
22
+
23
+ #### Parameters
24
+
25
+ ##### arrays
26
+
27
+ `Uint8Array`[]
28
+
29
+ The array to concatenate.
30
+
31
+ #### Returns
32
+
33
+ `Uint8Array`
34
+
35
+ The combined array.
@@ -16,15 +16,21 @@ Create a new instance of UnauthorizedError.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **source**: `string`
19
+ ##### source
20
+
21
+ `string`
20
22
 
21
23
  The source of the error.
22
24
 
23
- **message**: `string`
25
+ ##### message
26
+
27
+ `string`
24
28
 
25
29
  The message as a code.
26
30
 
27
- **inner?**: `unknown`
31
+ ##### inner?
32
+
33
+ `unknown`
28
34
 
29
35
  The inner error if we have wrapped another error.
30
36
 
@@ -46,7 +52,7 @@ The source of the error.
46
52
 
47
53
  #### Inherited from
48
54
 
49
- [`BaseError`](BaseError.md).[`source`](BaseError.md#source)
55
+ [`BaseError`](BaseError.md).[`source`](BaseError.md#source-1)
50
56
 
51
57
  ***
52
58
 
@@ -58,11 +64,11 @@ Any additional information for the error.
58
64
 
59
65
  #### Index Signature
60
66
 
61
- \[`id`: `string`\]: `unknown`
67
+ \[`id`: `string`\]: `unknown`
62
68
 
63
69
  #### Inherited from
64
70
 
65
- [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties)
71
+ [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties-1)
66
72
 
67
73
  ***
68
74
 
@@ -74,7 +80,7 @@ The inner error if there was one.
74
80
 
75
81
  #### Inherited from
76
82
 
77
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
83
+ [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner-1)
78
84
 
79
85
  ***
80
86
 
@@ -94,7 +100,9 @@ Construct an error from an existing one.
94
100
 
95
101
  #### Parameters
96
102
 
97
- **err**: `unknown`
103
+ ##### err
104
+
105
+ `unknown`
98
106
 
99
107
  The existing error.
100
108
 
@@ -118,7 +126,9 @@ Flatten an error tree.
118
126
 
119
127
  #### Parameters
120
128
 
121
- **err**: `unknown`
129
+ ##### err
130
+
131
+ `unknown`
122
132
 
123
133
  The starting error.
124
134
 
@@ -142,10 +152,12 @@ Expand an error tree.
142
152
 
143
153
  #### Parameters
144
154
 
145
- **errors**: `undefined` \| [`IError`](../interfaces/IError.md)[]
155
+ ##### errors
146
156
 
147
157
  The list of errors to expand.
148
158
 
159
+ `undefined` | [`IError`](../interfaces/IError.md)[]
160
+
149
161
  #### Returns
150
162
 
151
163
  `undefined` \| [`IError`](../interfaces/IError.md)
@@ -166,14 +178,18 @@ Test to see if the error has the specified error name.
166
178
 
167
179
  #### Parameters
168
180
 
169
- **error**: `unknown`
181
+ ##### error
182
+
183
+ `unknown`
170
184
 
171
185
  The error to test.
172
186
 
173
- **name**: `string` \| `RegExp`
187
+ ##### name
174
188
 
175
189
  The name to check for.
176
190
 
191
+ `string` | `RegExp`
192
+
177
193
  #### Returns
178
194
 
179
195
  `error is BaseError`
@@ -194,14 +210,18 @@ Test to see if the error has the specified error message.
194
210
 
195
211
  #### Parameters
196
212
 
197
- **error**: `unknown`
213
+ ##### error
214
+
215
+ `unknown`
198
216
 
199
217
  The error to test.
200
218
 
201
- **message**: `string` \| `RegExp`
219
+ ##### message
202
220
 
203
221
  The message to check for.
204
222
 
223
+ `string` | `RegExp`
224
+
205
225
  #### Returns
206
226
 
207
227
  `error is BaseError`
@@ -222,14 +242,18 @@ Test to see if the error has the specified error code.
222
242
 
223
243
  #### Parameters
224
244
 
225
- **error**: `unknown`
245
+ ##### error
246
+
247
+ `unknown`
226
248
 
227
249
  The error to test.
228
250
 
229
- **code**: `string` \| `RegExp`
251
+ ##### code
230
252
 
231
253
  The code to check for.
232
254
 
255
+ `string` | `RegExp`
256
+
233
257
  #### Returns
234
258
 
235
259
  `boolean`
@@ -250,14 +274,18 @@ Test to see if any of the errors or children have the given error name.
250
274
 
251
275
  #### Parameters
252
276
 
253
- **error**: `unknown`
277
+ ##### error
278
+
279
+ `unknown`
254
280
 
255
281
  The error to test.
256
282
 
257
- **name**: `string` \| `RegExp`
283
+ ##### name
258
284
 
259
285
  The name to check for.
260
286
 
287
+ `string` | `RegExp`
288
+
261
289
  #### Returns
262
290
 
263
291
  `error is BaseError`
@@ -278,14 +306,18 @@ Test to see if any of the errors or children have the given error message.
278
306
 
279
307
  #### Parameters
280
308
 
281
- **error**: `unknown`
309
+ ##### error
310
+
311
+ `unknown`
282
312
 
283
313
  The error to test.
284
314
 
285
- **message**: `string` \| `RegExp`
315
+ ##### message
286
316
 
287
317
  The message to check for.
288
318
 
319
+ `string` | `RegExp`
320
+
289
321
  #### Returns
290
322
 
291
323
  `error is BaseError`
@@ -306,11 +338,15 @@ Test to see if any of the errors or children are from a specific class.
306
338
 
307
339
  #### Parameters
308
340
 
309
- **error**: `unknown`
341
+ ##### error
342
+
343
+ `unknown`
310
344
 
311
345
  The error to test.
312
346
 
313
- **cls**: `string`
347
+ ##### cls
348
+
349
+ `string`
314
350
 
315
351
  The class to check for.
316
352
 
@@ -334,14 +370,18 @@ Test to see if any of the errors or children have the given error code.
334
370
 
335
371
  #### Parameters
336
372
 
337
- **error**: `unknown`
373
+ ##### error
374
+
375
+ `unknown`
338
376
 
339
377
  The error to test.
340
378
 
341
- **code**: `string` \| `RegExp`
379
+ ##### code
342
380
 
343
381
  The code to check for.
344
382
 
383
+ `string` | `RegExp`
384
+
345
385
  #### Returns
346
386
 
347
387
  `error is BaseError`
@@ -16,19 +16,25 @@ Create a new instance of UnprocessableError.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **source**: `string`
19
+ ##### source
20
+
21
+ `string`
20
22
 
21
23
  The source of the error.
22
24
 
23
- **message**: `string`
25
+ ##### message
26
+
27
+ `string`
24
28
 
25
29
  The message as a code.
26
30
 
27
- **properties?**
31
+ ##### properties?
28
32
 
29
33
  Any additional information for the error.
30
34
 
31
- **inner?**: `unknown`
35
+ ##### inner?
36
+
37
+ `unknown`
32
38
 
33
39
  The inner error if we have wrapped another error.
34
40
 
@@ -50,7 +56,7 @@ The source of the error.
50
56
 
51
57
  #### Inherited from
52
58
 
53
- [`BaseError`](BaseError.md).[`source`](BaseError.md#source)
59
+ [`BaseError`](BaseError.md).[`source`](BaseError.md#source-1)
54
60
 
55
61
  ***
56
62
 
@@ -62,11 +68,11 @@ Any additional information for the error.
62
68
 
63
69
  #### Index Signature
64
70
 
65
- \[`id`: `string`\]: `unknown`
71
+ \[`id`: `string`\]: `unknown`
66
72
 
67
73
  #### Inherited from
68
74
 
69
- [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties)
75
+ [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties-1)
70
76
 
71
77
  ***
72
78
 
@@ -78,7 +84,7 @@ The inner error if there was one.
78
84
 
79
85
  #### Inherited from
80
86
 
81
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
87
+ [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner-1)
82
88
 
83
89
  ***
84
90
 
@@ -98,7 +104,9 @@ Construct an error from an existing one.
98
104
 
99
105
  #### Parameters
100
106
 
101
- **err**: `unknown`
107
+ ##### err
108
+
109
+ `unknown`
102
110
 
103
111
  The existing error.
104
112
 
@@ -122,7 +130,9 @@ Flatten an error tree.
122
130
 
123
131
  #### Parameters
124
132
 
125
- **err**: `unknown`
133
+ ##### err
134
+
135
+ `unknown`
126
136
 
127
137
  The starting error.
128
138
 
@@ -146,10 +156,12 @@ Expand an error tree.
146
156
 
147
157
  #### Parameters
148
158
 
149
- **errors**: `undefined` \| [`IError`](../interfaces/IError.md)[]
159
+ ##### errors
150
160
 
151
161
  The list of errors to expand.
152
162
 
163
+ `undefined` | [`IError`](../interfaces/IError.md)[]
164
+
153
165
  #### Returns
154
166
 
155
167
  `undefined` \| [`IError`](../interfaces/IError.md)
@@ -170,14 +182,18 @@ Test to see if the error has the specified error name.
170
182
 
171
183
  #### Parameters
172
184
 
173
- **error**: `unknown`
185
+ ##### error
186
+
187
+ `unknown`
174
188
 
175
189
  The error to test.
176
190
 
177
- **name**: `string` \| `RegExp`
191
+ ##### name
178
192
 
179
193
  The name to check for.
180
194
 
195
+ `string` | `RegExp`
196
+
181
197
  #### Returns
182
198
 
183
199
  `error is BaseError`
@@ -198,14 +214,18 @@ Test to see if the error has the specified error message.
198
214
 
199
215
  #### Parameters
200
216
 
201
- **error**: `unknown`
217
+ ##### error
218
+
219
+ `unknown`
202
220
 
203
221
  The error to test.
204
222
 
205
- **message**: `string` \| `RegExp`
223
+ ##### message
206
224
 
207
225
  The message to check for.
208
226
 
227
+ `string` | `RegExp`
228
+
209
229
  #### Returns
210
230
 
211
231
  `error is BaseError`
@@ -226,14 +246,18 @@ Test to see if the error has the specified error code.
226
246
 
227
247
  #### Parameters
228
248
 
229
- **error**: `unknown`
249
+ ##### error
250
+
251
+ `unknown`
230
252
 
231
253
  The error to test.
232
254
 
233
- **code**: `string` \| `RegExp`
255
+ ##### code
234
256
 
235
257
  The code to check for.
236
258
 
259
+ `string` | `RegExp`
260
+
237
261
  #### Returns
238
262
 
239
263
  `boolean`
@@ -254,14 +278,18 @@ Test to see if any of the errors or children have the given error name.
254
278
 
255
279
  #### Parameters
256
280
 
257
- **error**: `unknown`
281
+ ##### error
282
+
283
+ `unknown`
258
284
 
259
285
  The error to test.
260
286
 
261
- **name**: `string` \| `RegExp`
287
+ ##### name
262
288
 
263
289
  The name to check for.
264
290
 
291
+ `string` | `RegExp`
292
+
265
293
  #### Returns
266
294
 
267
295
  `error is BaseError`
@@ -282,14 +310,18 @@ Test to see if any of the errors or children have the given error message.
282
310
 
283
311
  #### Parameters
284
312
 
285
- **error**: `unknown`
313
+ ##### error
314
+
315
+ `unknown`
286
316
 
287
317
  The error to test.
288
318
 
289
- **message**: `string` \| `RegExp`
319
+ ##### message
290
320
 
291
321
  The message to check for.
292
322
 
323
+ `string` | `RegExp`
324
+
293
325
  #### Returns
294
326
 
295
327
  `error is BaseError`
@@ -310,11 +342,15 @@ Test to see if any of the errors or children are from a specific class.
310
342
 
311
343
  #### Parameters
312
344
 
313
- **error**: `unknown`
345
+ ##### error
346
+
347
+ `unknown`
314
348
 
315
349
  The error to test.
316
350
 
317
- **cls**: `string`
351
+ ##### cls
352
+
353
+ `string`
318
354
 
319
355
  The class to check for.
320
356
 
@@ -338,14 +374,18 @@ Test to see if any of the errors or children have the given error code.
338
374
 
339
375
  #### Parameters
340
376
 
341
- **error**: `unknown`
377
+ ##### error
378
+
379
+ `unknown`
342
380
 
343
381
  The error to test.
344
382
 
345
- **code**: `string` \| `RegExp`
383
+ ##### code
346
384
 
347
385
  The code to check for.
348
386
 
387
+ `string` | `RegExp`
388
+
349
389
  #### Returns
350
390
 
351
391
  `error is BaseError`
@@ -12,7 +12,9 @@ Create a new instance of Url.
12
12
 
13
13
  #### Parameters
14
14
 
15
- **url**: `string`
15
+ ##### url
16
+
17
+ `string`
16
18
 
17
19
  The url string.
18
20
 
@@ -30,7 +32,9 @@ Try and parse a string into the url parts.
30
32
 
31
33
  #### Parameters
32
34
 
33
- **url**: `unknown`
35
+ ##### url
36
+
37
+ `unknown`
34
38
 
35
39
  The url to parse.
36
40
 
@@ -50,15 +54,21 @@ Parse a string into the url parts.
50
54
 
51
55
  #### Parameters
52
56
 
53
- **source**: `string`
57
+ ##### source
58
+
59
+ `string`
54
60
 
55
61
  The source of the error.
56
62
 
57
- **property**: `string`
63
+ ##### property
64
+
65
+ `string`
58
66
 
59
67
  The name of the property.
60
68
 
61
- **value**: `unknown`
69
+ ##### value
70
+
71
+ `unknown`
62
72
 
63
73
  The url to parse.
64
74
 
@@ -80,15 +90,21 @@ Validate a string as a Url.
80
90
 
81
91
  #### Parameters
82
92
 
83
- **property**: `string`
93
+ ##### property
94
+
95
+ `string`
84
96
 
85
97
  Throw an exception if the url property is invalid.
86
98
 
87
- **value**: `unknown`
99
+ ##### value
100
+
101
+ `unknown`
88
102
 
89
103
  The url to parse.
90
104
 
91
- **failures**: [`IValidationFailure`](../interfaces/IValidationFailure.md)[]
105
+ ##### failures
106
+
107
+ [`IValidationFailure`](../interfaces/IValidationFailure.md)[]
92
108
 
93
109
  The list of failures to add to.
94
110
 
@@ -108,7 +124,9 @@ Construct a url from a URL.
108
124
 
109
125
  #### Parameters
110
126
 
111
- **url**: `URL`
127
+ ##### url
128
+
129
+ `URL`
112
130
 
113
131
  The url to construct from.
114
132
 
@@ -128,7 +146,9 @@ Construct a url from valid parts.
128
146
 
129
147
  #### Parameters
130
148
 
131
- **urlParts**: [`IUrlParts`](../interfaces/IUrlParts.md)
149
+ ##### urlParts
150
+
151
+ [`IUrlParts`](../interfaces/IUrlParts.md)
132
152
 
133
153
  The url to create the parts from.
134
154