@twin.org/core 0.0.2-next.3 → 0.0.2-next.5
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 +893 -852
- package/dist/esm/index.mjs +893 -852
- package/dist/types/errors/alreadyExistsError.d.ts +2 -2
- package/dist/types/errors/baseError.d.ts +18 -5
- package/dist/types/errors/conflictError.d.ts +2 -2
- package/dist/types/errors/generalError.d.ts +2 -2
- package/dist/types/errors/notFoundError.d.ts +2 -2
- package/dist/types/errors/notSupportedError.d.ts +2 -2
- package/dist/types/errors/unauthorizedError.d.ts +2 -2
- package/dist/types/errors/unprocessableError.d.ts +2 -2
- package/dist/types/factories/factory.d.ts +1 -1
- package/dist/types/helpers/errorHelper.d.ts +3 -3
- package/dist/types/models/IComponent.d.ts +6 -15
- package/dist/types/models/IError.d.ts +2 -2
- package/docs/changelog.md +34 -0
- package/docs/reference/classes/AlreadyExistsError.md +66 -8
- package/docs/reference/classes/BaseError.md +62 -8
- package/docs/reference/classes/ConflictError.md +66 -8
- package/docs/reference/classes/EnvHelper.md +1 -1
- package/docs/reference/classes/ErrorHelper.md +3 -3
- package/docs/reference/classes/Factory.md +2 -2
- package/docs/reference/classes/GeneralError.md +66 -8
- package/docs/reference/classes/GuardError.md +63 -5
- package/docs/reference/classes/Guards.md +2 -2
- package/docs/reference/classes/I18n.md +2 -2
- package/docs/reference/classes/Is.md +2 -2
- package/docs/reference/classes/NotFoundError.md +66 -8
- package/docs/reference/classes/NotImplementedError.md +63 -5
- package/docs/reference/classes/NotSupportedError.md +66 -8
- package/docs/reference/classes/UnauthorizedError.md +66 -8
- package/docs/reference/classes/UnprocessableError.md +66 -8
- package/docs/reference/classes/Validation.md +1 -1
- package/docs/reference/classes/ValidationError.md +63 -5
- package/docs/reference/interfaces/IComponent.md +9 -21
- package/docs/reference/interfaces/IError.md +3 -3
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ Class to handle errors when some data can not be processed.
|
|
|
10
10
|
|
|
11
11
|
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new UnprocessableError**(`source`, `message`, `properties?`, `
|
|
13
|
+
> **new UnprocessableError**(`source`, `message`, `properties?`, `cause?`): `UnprocessableError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of UnprocessableError.
|
|
16
16
|
|
|
@@ -32,11 +32,11 @@ The message as a code.
|
|
|
32
32
|
|
|
33
33
|
Any additional information for the error.
|
|
34
34
|
|
|
35
|
-
#####
|
|
35
|
+
##### cause?
|
|
36
36
|
|
|
37
37
|
`unknown`
|
|
38
38
|
|
|
39
|
-
The
|
|
39
|
+
The cause of the error if we have wrapped another error.
|
|
40
40
|
|
|
41
41
|
#### Returns
|
|
42
42
|
|
|
@@ -76,15 +76,15 @@ Any additional information for the error.
|
|
|
76
76
|
|
|
77
77
|
***
|
|
78
78
|
|
|
79
|
-
###
|
|
79
|
+
### cause?
|
|
80
80
|
|
|
81
|
-
> `optional` **
|
|
81
|
+
> `optional` **cause**: [`IError`](../interfaces/IError.md)
|
|
82
82
|
|
|
83
|
-
The
|
|
83
|
+
The cause of the error.
|
|
84
84
|
|
|
85
85
|
#### Inherited from
|
|
86
86
|
|
|
87
|
-
[`BaseError`](BaseError.md).[`
|
|
87
|
+
[`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
|
|
88
88
|
|
|
89
89
|
***
|
|
90
90
|
|
|
@@ -402,7 +402,7 @@ True if the error has the name.
|
|
|
402
402
|
|
|
403
403
|
> `static` **isEmpty**(`err`): `boolean`
|
|
404
404
|
|
|
405
|
-
Is the error empty.
|
|
405
|
+
Is the error empty, i.e. does it have no message, source, properties, or cause?
|
|
406
406
|
|
|
407
407
|
#### Parameters
|
|
408
408
|
|
|
@@ -424,6 +424,64 @@ True if the error is empty.
|
|
|
424
424
|
|
|
425
425
|
***
|
|
426
426
|
|
|
427
|
+
### isAggregateError()
|
|
428
|
+
|
|
429
|
+
> `static` **isAggregateError**(`err`): `err is AggregateError`
|
|
430
|
+
|
|
431
|
+
Is the error an aggregate error.
|
|
432
|
+
|
|
433
|
+
#### Parameters
|
|
434
|
+
|
|
435
|
+
##### err
|
|
436
|
+
|
|
437
|
+
`unknown`
|
|
438
|
+
|
|
439
|
+
The error to check for being an aggregate error.
|
|
440
|
+
|
|
441
|
+
#### Returns
|
|
442
|
+
|
|
443
|
+
`err is AggregateError`
|
|
444
|
+
|
|
445
|
+
True if the error is an aggregate error.
|
|
446
|
+
|
|
447
|
+
#### Inherited from
|
|
448
|
+
|
|
449
|
+
[`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
|
|
450
|
+
|
|
451
|
+
***
|
|
452
|
+
|
|
453
|
+
### fromAggregate()
|
|
454
|
+
|
|
455
|
+
> `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
|
|
456
|
+
|
|
457
|
+
Convert the aggregate error to an array of errors.
|
|
458
|
+
|
|
459
|
+
#### Parameters
|
|
460
|
+
|
|
461
|
+
##### err
|
|
462
|
+
|
|
463
|
+
`unknown`
|
|
464
|
+
|
|
465
|
+
The error to convert.
|
|
466
|
+
|
|
467
|
+
##### includeStackTrace?
|
|
468
|
+
|
|
469
|
+
`boolean`
|
|
470
|
+
|
|
471
|
+
Whether to include the error stack in the model, defaults to false.
|
|
472
|
+
|
|
473
|
+
#### Returns
|
|
474
|
+
|
|
475
|
+
[`IError`](../interfaces/IError.md)[]
|
|
476
|
+
|
|
477
|
+
The array of errors.
|
|
478
|
+
|
|
479
|
+
#### Inherited from
|
|
480
|
+
|
|
481
|
+
[`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
|
|
482
|
+
|
|
483
|
+
***
|
|
484
|
+
|
|
427
485
|
### toJsonObject()
|
|
428
486
|
|
|
429
487
|
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
@@ -72,15 +72,15 @@ Any additional information for the error.
|
|
|
72
72
|
|
|
73
73
|
***
|
|
74
74
|
|
|
75
|
-
###
|
|
75
|
+
### cause?
|
|
76
76
|
|
|
77
|
-
> `optional` **
|
|
77
|
+
> `optional` **cause**: [`IError`](../interfaces/IError.md)
|
|
78
78
|
|
|
79
|
-
The
|
|
79
|
+
The cause of the error.
|
|
80
80
|
|
|
81
81
|
#### Inherited from
|
|
82
82
|
|
|
83
|
-
[`BaseError`](BaseError.md).[`
|
|
83
|
+
[`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
|
|
84
84
|
|
|
85
85
|
***
|
|
86
86
|
|
|
@@ -398,7 +398,7 @@ True if the error has the name.
|
|
|
398
398
|
|
|
399
399
|
> `static` **isEmpty**(`err`): `boolean`
|
|
400
400
|
|
|
401
|
-
Is the error empty.
|
|
401
|
+
Is the error empty, i.e. does it have no message, source, properties, or cause?
|
|
402
402
|
|
|
403
403
|
#### Parameters
|
|
404
404
|
|
|
@@ -420,6 +420,64 @@ True if the error is empty.
|
|
|
420
420
|
|
|
421
421
|
***
|
|
422
422
|
|
|
423
|
+
### isAggregateError()
|
|
424
|
+
|
|
425
|
+
> `static` **isAggregateError**(`err`): `err is AggregateError`
|
|
426
|
+
|
|
427
|
+
Is the error an aggregate error.
|
|
428
|
+
|
|
429
|
+
#### Parameters
|
|
430
|
+
|
|
431
|
+
##### err
|
|
432
|
+
|
|
433
|
+
`unknown`
|
|
434
|
+
|
|
435
|
+
The error to check for being an aggregate error.
|
|
436
|
+
|
|
437
|
+
#### Returns
|
|
438
|
+
|
|
439
|
+
`err is AggregateError`
|
|
440
|
+
|
|
441
|
+
True if the error is an aggregate error.
|
|
442
|
+
|
|
443
|
+
#### Inherited from
|
|
444
|
+
|
|
445
|
+
[`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
|
|
446
|
+
|
|
447
|
+
***
|
|
448
|
+
|
|
449
|
+
### fromAggregate()
|
|
450
|
+
|
|
451
|
+
> `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
|
|
452
|
+
|
|
453
|
+
Convert the aggregate error to an array of errors.
|
|
454
|
+
|
|
455
|
+
#### Parameters
|
|
456
|
+
|
|
457
|
+
##### err
|
|
458
|
+
|
|
459
|
+
`unknown`
|
|
460
|
+
|
|
461
|
+
The error to convert.
|
|
462
|
+
|
|
463
|
+
##### includeStackTrace?
|
|
464
|
+
|
|
465
|
+
`boolean`
|
|
466
|
+
|
|
467
|
+
Whether to include the error stack in the model, defaults to false.
|
|
468
|
+
|
|
469
|
+
#### Returns
|
|
470
|
+
|
|
471
|
+
[`IError`](../interfaces/IError.md)[]
|
|
472
|
+
|
|
473
|
+
The array of errors.
|
|
474
|
+
|
|
475
|
+
#### Inherited from
|
|
476
|
+
|
|
477
|
+
[`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
|
|
478
|
+
|
|
479
|
+
***
|
|
480
|
+
|
|
423
481
|
### toJsonObject()
|
|
424
482
|
|
|
425
483
|
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
@@ -14,22 +14,18 @@ The name of the component.
|
|
|
14
14
|
|
|
15
15
|
### bootstrap()?
|
|
16
16
|
|
|
17
|
-
> `optional` **bootstrap**(`
|
|
17
|
+
> `optional` **bootstrap**(`nodeLoggingComponentType`): `Promise`\<`boolean`\>
|
|
18
18
|
|
|
19
19
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
23
|
-
#####
|
|
23
|
+
##### nodeLoggingComponentType
|
|
24
24
|
|
|
25
|
-
The node logging
|
|
25
|
+
The node logging component type.
|
|
26
26
|
|
|
27
27
|
`undefined` | `string`
|
|
28
28
|
|
|
29
|
-
##### componentState?
|
|
30
|
-
|
|
31
|
-
A persistent state which can be modified by the method.
|
|
32
|
-
|
|
33
29
|
#### Returns
|
|
34
30
|
|
|
35
31
|
`Promise`\<`boolean`\>
|
|
@@ -40,7 +36,7 @@ True if the bootstrapping process was successful.
|
|
|
40
36
|
|
|
41
37
|
### start()?
|
|
42
38
|
|
|
43
|
-
> `optional` **start**(`nodeIdentity`, `
|
|
39
|
+
> `optional` **start**(`nodeIdentity`, `nodeLoggingComponentType`): `Promise`\<`void`\>
|
|
44
40
|
|
|
45
41
|
The component needs to be started when the node is initialized.
|
|
46
42
|
|
|
@@ -52,16 +48,12 @@ The component needs to be started when the node is initialized.
|
|
|
52
48
|
|
|
53
49
|
The identity of the node starting the component.
|
|
54
50
|
|
|
55
|
-
#####
|
|
51
|
+
##### nodeLoggingComponentType
|
|
56
52
|
|
|
57
|
-
The node logging
|
|
53
|
+
The node logging component type.
|
|
58
54
|
|
|
59
55
|
`undefined` | `string`
|
|
60
56
|
|
|
61
|
-
##### componentState?
|
|
62
|
-
|
|
63
|
-
A persistent state which can be modified by the method.
|
|
64
|
-
|
|
65
57
|
#### Returns
|
|
66
58
|
|
|
67
59
|
`Promise`\<`void`\>
|
|
@@ -72,7 +64,7 @@ Nothing.
|
|
|
72
64
|
|
|
73
65
|
### stop()?
|
|
74
66
|
|
|
75
|
-
> `optional` **stop**(`nodeIdentity`, `
|
|
67
|
+
> `optional` **stop**(`nodeIdentity`, `nodeLoggingComponentType`): `Promise`\<`void`\>
|
|
76
68
|
|
|
77
69
|
The component needs to be stopped when the node is closed.
|
|
78
70
|
|
|
@@ -84,16 +76,12 @@ The component needs to be stopped when the node is closed.
|
|
|
84
76
|
|
|
85
77
|
The identity of the node stopping the component.
|
|
86
78
|
|
|
87
|
-
#####
|
|
79
|
+
##### nodeLoggingComponentType
|
|
88
80
|
|
|
89
|
-
The node logging
|
|
81
|
+
The node logging component type.
|
|
90
82
|
|
|
91
83
|
`undefined` | `string`
|
|
92
84
|
|
|
93
|
-
##### componentState?
|
|
94
|
-
|
|
95
|
-
A persistent state which can be modified by the method.
|
|
96
|
-
|
|
97
85
|
#### Returns
|
|
98
86
|
|
|
99
87
|
`Promise`\<`void`\>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.5",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/nameof": "0.0.2-next.
|
|
17
|
+
"@twin.org/nameof": "0.0.2-next.5",
|
|
18
18
|
"intl-messageformat": "10.7.16",
|
|
19
19
|
"rfc6902": "5.1.2"
|
|
20
20
|
},
|