@twin.org/core 0.0.1-next.6 → 0.0.1-next.60
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.
- package/dist/cjs/index.cjs +1672 -787
- package/dist/esm/index.mjs +1668 -788
- package/dist/types/encoding/base58.d.ts +18 -0
- package/dist/types/errors/baseError.d.ts +2 -1
- package/dist/types/factories/factory.d.ts +20 -1
- package/dist/types/helpers/arrayHelper.d.ts +13 -0
- package/dist/types/helpers/envHelper.d.ts +16 -0
- package/dist/types/helpers/errorHelper.d.ts +2 -1
- package/dist/types/helpers/jsonHelper.d.ts +30 -0
- package/dist/types/helpers/objectHelper.d.ts +33 -0
- package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/models/IComponent.d.ts +12 -3
- package/dist/types/models/II18nShared.d.ts +29 -0
- package/dist/types/models/coerceType.d.ts +49 -0
- package/dist/types/models/compressionType.d.ts +1 -1
- package/dist/types/models/objectOrArray.d.ts +4 -0
- package/dist/types/utils/asyncCache.d.ts +10 -1
- package/dist/types/utils/coerce.d.ts +22 -0
- package/dist/types/utils/converter.d.ts +12 -0
- package/dist/types/utils/guards.d.ts +35 -0
- package/dist/types/utils/is.d.ts +12 -0
- package/dist/types/utils/sharedStore.d.ts +23 -0
- package/dist/types/utils/validation.d.ts +2 -0
- package/docs/changelog.md +79 -1
- package/docs/reference/classes/AlreadyExistsError.md +77 -27
- package/docs/reference/classes/ArrayHelper.md +79 -5
- package/docs/reference/classes/AsyncCache.md +75 -13
- package/docs/reference/classes/Base32.md +9 -5
- package/docs/reference/classes/Base58.md +61 -0
- package/docs/reference/classes/Base64.md +12 -6
- package/docs/reference/classes/Base64Url.md +9 -5
- package/docs/reference/classes/BaseError.md +79 -29
- package/docs/reference/classes/BitString.md +23 -11
- package/docs/reference/classes/Coerce.md +110 -12
- package/docs/reference/classes/Compression.md +19 -11
- package/docs/reference/classes/ConflictError.md +80 -28
- package/docs/reference/classes/Converter.md +110 -26
- package/docs/reference/classes/EnvHelper.md +45 -0
- package/docs/reference/classes/ErrorHelper.md +19 -7
- package/docs/reference/classes/Factory.md +95 -17
- package/docs/reference/classes/FilenameHelper.md +6 -4
- package/docs/reference/classes/GeneralError.md +75 -27
- package/docs/reference/classes/GuardError.md +80 -28
- package/docs/reference/classes/Guards.md +398 -80
- package/docs/reference/classes/HexHelper.md +18 -8
- package/docs/reference/classes/I18n.md +46 -20
- package/docs/reference/classes/Is.md +179 -51
- package/docs/reference/classes/JsonHelper.md +146 -10
- package/docs/reference/classes/NotFoundError.md +77 -27
- package/docs/reference/classes/NotImplementedError.md +71 -25
- package/docs/reference/classes/NotSupportedError.md +74 -26
- package/docs/reference/classes/ObjectHelper.md +225 -35
- package/docs/reference/classes/RandomHelper.md +6 -4
- package/docs/reference/classes/SharedStore.md +94 -0
- package/docs/reference/classes/StringHelper.md +54 -20
- package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
- package/docs/reference/classes/UnauthorizedError.md +74 -26
- package/docs/reference/classes/UnprocessableError.md +75 -27
- package/docs/reference/classes/Url.md +37 -17
- package/docs/reference/classes/Urn.md +63 -27
- package/docs/reference/classes/Validation.md +349 -135
- package/docs/reference/classes/ValidationError.md +74 -26
- package/docs/reference/index.md +8 -0
- package/docs/reference/interfaces/IComponent.md +30 -8
- package/docs/reference/interfaces/IError.md +2 -2
- package/docs/reference/interfaces/II18nShared.md +47 -0
- package/docs/reference/interfaces/IKeyValue.md +3 -1
- package/docs/reference/interfaces/ILabelledValue.md +3 -1
- package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
- package/docs/reference/interfaces/IPatchOperation.md +1 -1
- package/docs/reference/interfaces/IValidationFailure.md +1 -1
- package/docs/reference/type-aliases/CoerceType.md +5 -0
- package/docs/reference/type-aliases/CompressionType.md +1 -1
- package/docs/reference/type-aliases/ObjectOrArray.md +11 -0
- package/docs/reference/variables/CoerceType.md +67 -0
- package/docs/reference/variables/CompressionType.md +1 -1
- package/locales/en.json +23 -1
- package/package.json +6 -6
|
@@ -8,41 +8,51 @@ Class to handle errors which are triggered by data guards.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new GuardError**(`source`, `message`, `propertyName`, `propertyValue`, `propertyOptions
|
|
13
|
+
> **new GuardError**(`source`, `message`, `propertyName`, `propertyValue`, `propertyOptions?`): `GuardError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of GuardError.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### source
|
|
20
|
+
|
|
21
|
+
`string`
|
|
20
22
|
|
|
21
23
|
The source of the error.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### message
|
|
26
|
+
|
|
27
|
+
`string`
|
|
24
28
|
|
|
25
29
|
The message as a code.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
##### propertyName
|
|
32
|
+
|
|
33
|
+
`string`
|
|
28
34
|
|
|
29
35
|
The property which triggered the guard error for the item.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
##### propertyValue
|
|
38
|
+
|
|
39
|
+
`unknown`
|
|
32
40
|
|
|
33
41
|
The property value which triggered the guard error for the item.
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
##### propertyOptions?
|
|
44
|
+
|
|
45
|
+
`string`
|
|
36
46
|
|
|
37
47
|
The property options which might be allowed.
|
|
38
48
|
|
|
39
49
|
#### Returns
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
`GuardError`
|
|
42
52
|
|
|
43
53
|
#### Overrides
|
|
44
54
|
|
|
45
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
55
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
46
56
|
|
|
47
57
|
## Properties
|
|
48
58
|
|
|
@@ -66,7 +76,7 @@ Any additional information for the error.
|
|
|
66
76
|
|
|
67
77
|
#### Index Signature
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
\[`id`: `string`\]: `unknown`
|
|
70
80
|
|
|
71
81
|
#### Inherited from
|
|
72
82
|
|
|
@@ -102,7 +112,9 @@ Construct an error from an existing one.
|
|
|
102
112
|
|
|
103
113
|
#### Parameters
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
##### err
|
|
116
|
+
|
|
117
|
+
`unknown`
|
|
106
118
|
|
|
107
119
|
The existing error.
|
|
108
120
|
|
|
@@ -126,7 +138,9 @@ Flatten an error tree.
|
|
|
126
138
|
|
|
127
139
|
#### Parameters
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
##### err
|
|
142
|
+
|
|
143
|
+
`unknown`
|
|
130
144
|
|
|
131
145
|
The starting error.
|
|
132
146
|
|
|
@@ -150,10 +164,12 @@ Expand an error tree.
|
|
|
150
164
|
|
|
151
165
|
#### Parameters
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
##### errors
|
|
154
168
|
|
|
155
169
|
The list of errors to expand.
|
|
156
170
|
|
|
171
|
+
`undefined` | [`IError`](../interfaces/IError.md)[]
|
|
172
|
+
|
|
157
173
|
#### Returns
|
|
158
174
|
|
|
159
175
|
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
@@ -174,14 +190,18 @@ Test to see if the error has the specified error name.
|
|
|
174
190
|
|
|
175
191
|
#### Parameters
|
|
176
192
|
|
|
177
|
-
|
|
193
|
+
##### error
|
|
194
|
+
|
|
195
|
+
`unknown`
|
|
178
196
|
|
|
179
197
|
The error to test.
|
|
180
198
|
|
|
181
|
-
|
|
199
|
+
##### name
|
|
182
200
|
|
|
183
201
|
The name to check for.
|
|
184
202
|
|
|
203
|
+
`string` | `RegExp`
|
|
204
|
+
|
|
185
205
|
#### Returns
|
|
186
206
|
|
|
187
207
|
`error is BaseError`
|
|
@@ -202,14 +222,18 @@ Test to see if the error has the specified error message.
|
|
|
202
222
|
|
|
203
223
|
#### Parameters
|
|
204
224
|
|
|
205
|
-
|
|
225
|
+
##### error
|
|
226
|
+
|
|
227
|
+
`unknown`
|
|
206
228
|
|
|
207
229
|
The error to test.
|
|
208
230
|
|
|
209
|
-
|
|
231
|
+
##### message
|
|
210
232
|
|
|
211
233
|
The message to check for.
|
|
212
234
|
|
|
235
|
+
`string` | `RegExp`
|
|
236
|
+
|
|
213
237
|
#### Returns
|
|
214
238
|
|
|
215
239
|
`error is BaseError`
|
|
@@ -230,14 +254,18 @@ Test to see if the error has the specified error code.
|
|
|
230
254
|
|
|
231
255
|
#### Parameters
|
|
232
256
|
|
|
233
|
-
|
|
257
|
+
##### error
|
|
258
|
+
|
|
259
|
+
`unknown`
|
|
234
260
|
|
|
235
261
|
The error to test.
|
|
236
262
|
|
|
237
|
-
|
|
263
|
+
##### code
|
|
238
264
|
|
|
239
265
|
The code to check for.
|
|
240
266
|
|
|
267
|
+
`string` | `RegExp`
|
|
268
|
+
|
|
241
269
|
#### Returns
|
|
242
270
|
|
|
243
271
|
`boolean`
|
|
@@ -258,14 +286,18 @@ Test to see if any of the errors or children have the given error name.
|
|
|
258
286
|
|
|
259
287
|
#### Parameters
|
|
260
288
|
|
|
261
|
-
|
|
289
|
+
##### error
|
|
290
|
+
|
|
291
|
+
`unknown`
|
|
262
292
|
|
|
263
293
|
The error to test.
|
|
264
294
|
|
|
265
|
-
|
|
295
|
+
##### name
|
|
266
296
|
|
|
267
297
|
The name to check for.
|
|
268
298
|
|
|
299
|
+
`string` | `RegExp`
|
|
300
|
+
|
|
269
301
|
#### Returns
|
|
270
302
|
|
|
271
303
|
`error is BaseError`
|
|
@@ -286,14 +318,18 @@ Test to see if any of the errors or children have the given error message.
|
|
|
286
318
|
|
|
287
319
|
#### Parameters
|
|
288
320
|
|
|
289
|
-
|
|
321
|
+
##### error
|
|
322
|
+
|
|
323
|
+
`unknown`
|
|
290
324
|
|
|
291
325
|
The error to test.
|
|
292
326
|
|
|
293
|
-
|
|
327
|
+
##### message
|
|
294
328
|
|
|
295
329
|
The message to check for.
|
|
296
330
|
|
|
331
|
+
`string` | `RegExp`
|
|
332
|
+
|
|
297
333
|
#### Returns
|
|
298
334
|
|
|
299
335
|
`error is BaseError`
|
|
@@ -314,11 +350,15 @@ Test to see if any of the errors or children are from a specific class.
|
|
|
314
350
|
|
|
315
351
|
#### Parameters
|
|
316
352
|
|
|
317
|
-
|
|
353
|
+
##### error
|
|
354
|
+
|
|
355
|
+
`unknown`
|
|
318
356
|
|
|
319
357
|
The error to test.
|
|
320
358
|
|
|
321
|
-
|
|
359
|
+
##### cls
|
|
360
|
+
|
|
361
|
+
`string`
|
|
322
362
|
|
|
323
363
|
The class to check for.
|
|
324
364
|
|
|
@@ -342,14 +382,18 @@ Test to see if any of the errors or children have the given error code.
|
|
|
342
382
|
|
|
343
383
|
#### Parameters
|
|
344
384
|
|
|
345
|
-
|
|
385
|
+
##### error
|
|
386
|
+
|
|
387
|
+
`unknown`
|
|
346
388
|
|
|
347
389
|
The error to test.
|
|
348
390
|
|
|
349
|
-
|
|
391
|
+
##### code
|
|
350
392
|
|
|
351
393
|
The code to check for.
|
|
352
394
|
|
|
395
|
+
`string` | `RegExp`
|
|
396
|
+
|
|
353
397
|
#### Returns
|
|
354
398
|
|
|
355
399
|
`error is BaseError`
|
|
@@ -364,10 +408,18 @@ True if the error has the name.
|
|
|
364
408
|
|
|
365
409
|
### toJsonObject()
|
|
366
410
|
|
|
367
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
411
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
368
412
|
|
|
369
413
|
Serialize the error to the error model.
|
|
370
414
|
|
|
415
|
+
#### Parameters
|
|
416
|
+
|
|
417
|
+
##### includeStackTrace?
|
|
418
|
+
|
|
419
|
+
`boolean`
|
|
420
|
+
|
|
421
|
+
Whether to include the error stack in the model, defaults to false.
|
|
422
|
+
|
|
371
423
|
#### Returns
|
|
372
424
|
|
|
373
425
|
[`IError`](../interfaces/IError.md)
|