@twin.org/core 0.0.2-next.4 → 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.
Files changed (36) hide show
  1. package/dist/cjs/index.cjs +76 -46
  2. package/dist/esm/index.mjs +76 -46
  3. package/dist/types/errors/alreadyExistsError.d.ts +2 -2
  4. package/dist/types/errors/baseError.d.ts +18 -5
  5. package/dist/types/errors/conflictError.d.ts +2 -2
  6. package/dist/types/errors/generalError.d.ts +2 -2
  7. package/dist/types/errors/notFoundError.d.ts +2 -2
  8. package/dist/types/errors/notSupportedError.d.ts +2 -2
  9. package/dist/types/errors/unauthorizedError.d.ts +2 -2
  10. package/dist/types/errors/unprocessableError.d.ts +2 -2
  11. package/dist/types/factories/factory.d.ts +1 -1
  12. package/dist/types/helpers/errorHelper.d.ts +3 -3
  13. package/dist/types/models/IComponent.d.ts +6 -15
  14. package/dist/types/models/IError.d.ts +2 -2
  15. package/docs/changelog.md +17 -0
  16. package/docs/reference/classes/AlreadyExistsError.md +66 -8
  17. package/docs/reference/classes/BaseError.md +62 -8
  18. package/docs/reference/classes/ConflictError.md +66 -8
  19. package/docs/reference/classes/EnvHelper.md +1 -1
  20. package/docs/reference/classes/ErrorHelper.md +3 -3
  21. package/docs/reference/classes/Factory.md +2 -2
  22. package/docs/reference/classes/GeneralError.md +66 -8
  23. package/docs/reference/classes/GuardError.md +63 -5
  24. package/docs/reference/classes/Guards.md +2 -2
  25. package/docs/reference/classes/I18n.md +2 -2
  26. package/docs/reference/classes/Is.md +2 -2
  27. package/docs/reference/classes/NotFoundError.md +66 -8
  28. package/docs/reference/classes/NotImplementedError.md +63 -5
  29. package/docs/reference/classes/NotSupportedError.md +66 -8
  30. package/docs/reference/classes/UnauthorizedError.md +66 -8
  31. package/docs/reference/classes/UnprocessableError.md +66 -8
  32. package/docs/reference/classes/Validation.md +1 -1
  33. package/docs/reference/classes/ValidationError.md +63 -5
  34. package/docs/reference/interfaces/IComponent.md +9 -21
  35. package/docs/reference/interfaces/IError.md +3 -3
  36. package/package.json +2 -2
@@ -72,15 +72,15 @@ Any additional information for the error.
72
72
 
73
73
  ***
74
74
 
75
- ### inner?
75
+ ### cause?
76
76
 
77
- > `optional` **inner**: [`IError`](../interfaces/IError.md)
77
+ > `optional` **cause**: [`IError`](../interfaces/IError.md)
78
78
 
79
- The inner error if there was one.
79
+ The cause of the error.
80
80
 
81
81
  #### Inherited from
82
82
 
83
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
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**(`nodeLoggingConnectorType`, `componentState?`): `Promise`\<`boolean`\>
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
- ##### nodeLoggingConnectorType
23
+ ##### nodeLoggingComponentType
24
24
 
25
- The node logging connector type, defaults to "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`, `nodeLoggingConnectorType`, `componentState?`): `Promise`\<`void`\>
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
- ##### nodeLoggingConnectorType
51
+ ##### nodeLoggingComponentType
56
52
 
57
- The node logging connector type, defaults to "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`, `nodeLoggingConnectorType`, `componentState?`): `Promise`\<`void`\>
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
- ##### nodeLoggingConnectorType
79
+ ##### nodeLoggingComponentType
88
80
 
89
- The node logging connector type, defaults to "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`\>
@@ -48,8 +48,8 @@ The stack trace for the error.
48
48
 
49
49
  ***
50
50
 
51
- ### inner?
51
+ ### cause?
52
52
 
53
- > `optional` **inner**: `IError`
53
+ > `optional` **cause**: `IError`
54
54
 
55
- The inner error if there was one.
55
+ The cause of the error if there was one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/core",
3
- "version": "0.0.2-next.4",
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.4",
17
+ "@twin.org/nameof": "0.0.2-next.5",
18
18
  "intl-messageformat": "10.7.16",
19
19
  "rfc6902": "5.1.2"
20
20
  },