@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.
Files changed (36) hide show
  1. package/dist/cjs/index.cjs +893 -852
  2. package/dist/esm/index.mjs +893 -852
  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 +34 -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
@@ -10,7 +10,7 @@ Class to handle errors.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new GeneralError**(`source`, `message`, `properties?`, `inner?`): `GeneralError`
13
+ > **new GeneralError**(`source`, `message`, `properties?`, `cause?`): `GeneralError`
14
14
 
15
15
  Create a new instance of GeneralError.
16
16
 
@@ -32,11 +32,11 @@ The message as a code.
32
32
 
33
33
  Any additional information for the error.
34
34
 
35
- ##### inner?
35
+ ##### cause?
36
36
 
37
37
  `unknown`
38
38
 
39
- The inner error if we have wrapped another error.
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
- ### inner?
79
+ ### cause?
80
80
 
81
- > `optional` **inner**: [`IError`](../interfaces/IError.md)
81
+ > `optional` **cause**: [`IError`](../interfaces/IError.md)
82
82
 
83
- The inner error if there was one.
83
+ The cause of the error.
84
84
 
85
85
  #### Inherited from
86
86
 
87
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
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)
@@ -84,15 +84,15 @@ Any additional information for the error.
84
84
 
85
85
  ***
86
86
 
87
- ### inner?
87
+ ### cause?
88
88
 
89
- > `optional` **inner**: [`IError`](../interfaces/IError.md)
89
+ > `optional` **cause**: [`IError`](../interfaces/IError.md)
90
90
 
91
- The inner error if there was one.
91
+ The cause of the error.
92
92
 
93
93
  #### Inherited from
94
94
 
95
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
95
+ [`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
96
96
 
97
97
  ***
98
98
 
@@ -410,7 +410,7 @@ True if the error has the name.
410
410
 
411
411
  > `static` **isEmpty**(`err`): `boolean`
412
412
 
413
- Is the error empty.
413
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
414
414
 
415
415
  #### Parameters
416
416
 
@@ -432,6 +432,64 @@ True if the error is empty.
432
432
 
433
433
  ***
434
434
 
435
+ ### isAggregateError()
436
+
437
+ > `static` **isAggregateError**(`err`): `err is AggregateError`
438
+
439
+ Is the error an aggregate error.
440
+
441
+ #### Parameters
442
+
443
+ ##### err
444
+
445
+ `unknown`
446
+
447
+ The error to check for being an aggregate error.
448
+
449
+ #### Returns
450
+
451
+ `err is AggregateError`
452
+
453
+ True if the error is an aggregate error.
454
+
455
+ #### Inherited from
456
+
457
+ [`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
458
+
459
+ ***
460
+
461
+ ### fromAggregate()
462
+
463
+ > `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
464
+
465
+ Convert the aggregate error to an array of errors.
466
+
467
+ #### Parameters
468
+
469
+ ##### err
470
+
471
+ `unknown`
472
+
473
+ The error to convert.
474
+
475
+ ##### includeStackTrace?
476
+
477
+ `boolean`
478
+
479
+ Whether to include the error stack in the model, defaults to false.
480
+
481
+ #### Returns
482
+
483
+ [`IError`](../interfaces/IError.md)[]
484
+
485
+ The array of errors.
486
+
487
+ #### Inherited from
488
+
489
+ [`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
490
+
491
+ ***
492
+
435
493
  ### toJsonObject()
436
494
 
437
495
  > **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
@@ -618,7 +618,7 @@ Is the property an object.
618
618
 
619
619
  ##### T
620
620
 
621
- `T` = \{[`id`: `string`]: `unknown`; \}
621
+ `T` = \{\[`id`: `string`\]: `unknown`; \}
622
622
 
623
623
  #### Parameters
624
624
 
@@ -660,7 +660,7 @@ Is the property is an object with at least one property.
660
660
 
661
661
  ##### T
662
662
 
663
- `T` = \{[`id`: `string`]: `unknown`; \}
663
+ `T` = \{\[`id`: `string`\]: `unknown`; \}
664
664
 
665
665
  #### Parameters
666
666
 
@@ -84,7 +84,7 @@ The dictionary to add.
84
84
 
85
85
  ### getDictionary()
86
86
 
87
- > `static` **getDictionary**(`locale`): `undefined` \| \{[`key`: `string`]: `string`; \}
87
+ > `static` **getDictionary**(`locale`): `undefined` \| \{\[`key`: `string`\]: `string`; \}
88
88
 
89
89
  Get a locale dictionary.
90
90
 
@@ -98,7 +98,7 @@ The locale.
98
98
 
99
99
  #### Returns
100
100
 
101
- `undefined` \| \{[`key`: `string`]: `string`; \}
101
+ `undefined` \| \{\[`key`: `string`\]: `string`; \}
102
102
 
103
103
  The dictionary of undefined if it does not exist.
104
104
 
@@ -548,7 +548,7 @@ Is the value an object.
548
548
 
549
549
  ##### T
550
550
 
551
- `T` = \{[`id`: `string`]: `unknown`; \}
551
+ `T` = \{\[`id`: `string`\]: `unknown`; \}
552
552
 
553
553
  #### Parameters
554
554
 
@@ -576,7 +576,7 @@ Is the value an object with at least one property.
576
576
 
577
577
  ##### T
578
578
 
579
- `T` = \{[`id`: `string`]: `unknown`; \}
579
+ `T` = \{\[`id`: `string`\]: `unknown`; \}
580
580
 
581
581
  #### Parameters
582
582
 
@@ -10,7 +10,7 @@ Class to handle errors which are triggered by data not being found.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new NotFoundError**(`source`, `message`, `notFoundId?`, `inner?`): `NotFoundError`
13
+ > **new NotFoundError**(`source`, `message`, `notFoundId?`, `cause?`): `NotFoundError`
14
14
 
15
15
  Create a new instance of NotFoundError.
16
16
 
@@ -34,11 +34,11 @@ The message as a code.
34
34
 
35
35
  The id for the item.
36
36
 
37
- ##### inner?
37
+ ##### cause?
38
38
 
39
39
  `unknown`
40
40
 
41
- The inner error if we have wrapped another error.
41
+ The cause of the error if we have wrapped another error.
42
42
 
43
43
  #### Returns
44
44
 
@@ -78,15 +78,15 @@ Any additional information for the error.
78
78
 
79
79
  ***
80
80
 
81
- ### inner?
81
+ ### cause?
82
82
 
83
- > `optional` **inner**: [`IError`](../interfaces/IError.md)
83
+ > `optional` **cause**: [`IError`](../interfaces/IError.md)
84
84
 
85
- The inner error if there was one.
85
+ The cause of the error.
86
86
 
87
87
  #### Inherited from
88
88
 
89
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
89
+ [`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
90
90
 
91
91
  ***
92
92
 
@@ -404,7 +404,7 @@ True if the error has the name.
404
404
 
405
405
  > `static` **isEmpty**(`err`): `boolean`
406
406
 
407
- Is the error empty.
407
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
408
408
 
409
409
  #### Parameters
410
410
 
@@ -426,6 +426,64 @@ True if the error is empty.
426
426
 
427
427
  ***
428
428
 
429
+ ### isAggregateError()
430
+
431
+ > `static` **isAggregateError**(`err`): `err is AggregateError`
432
+
433
+ Is the error an aggregate error.
434
+
435
+ #### Parameters
436
+
437
+ ##### err
438
+
439
+ `unknown`
440
+
441
+ The error to check for being an aggregate error.
442
+
443
+ #### Returns
444
+
445
+ `err is AggregateError`
446
+
447
+ True if the error is an aggregate error.
448
+
449
+ #### Inherited from
450
+
451
+ [`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
452
+
453
+ ***
454
+
455
+ ### fromAggregate()
456
+
457
+ > `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
458
+
459
+ Convert the aggregate error to an array of errors.
460
+
461
+ #### Parameters
462
+
463
+ ##### err
464
+
465
+ `unknown`
466
+
467
+ The error to convert.
468
+
469
+ ##### includeStackTrace?
470
+
471
+ `boolean`
472
+
473
+ Whether to include the error stack in the model, defaults to false.
474
+
475
+ #### Returns
476
+
477
+ [`IError`](../interfaces/IError.md)[]
478
+
479
+ The array of errors.
480
+
481
+ #### Inherited from
482
+
483
+ [`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
484
+
485
+ ***
486
+
429
487
  ### toJsonObject()
430
488
 
431
489
  > **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
@@ -66,15 +66,15 @@ Any additional information for the error.
66
66
 
67
67
  ***
68
68
 
69
- ### inner?
69
+ ### cause?
70
70
 
71
- > `optional` **inner**: [`IError`](../interfaces/IError.md)
71
+ > `optional` **cause**: [`IError`](../interfaces/IError.md)
72
72
 
73
- The inner error if there was one.
73
+ The cause of the error.
74
74
 
75
75
  #### Inherited from
76
76
 
77
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
77
+ [`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
78
78
 
79
79
  ***
80
80
 
@@ -392,7 +392,7 @@ True if the error has the name.
392
392
 
393
393
  > `static` **isEmpty**(`err`): `boolean`
394
394
 
395
- Is the error empty.
395
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
396
396
 
397
397
  #### Parameters
398
398
 
@@ -414,6 +414,64 @@ True if the error is empty.
414
414
 
415
415
  ***
416
416
 
417
+ ### isAggregateError()
418
+
419
+ > `static` **isAggregateError**(`err`): `err is AggregateError`
420
+
421
+ Is the error an aggregate error.
422
+
423
+ #### Parameters
424
+
425
+ ##### err
426
+
427
+ `unknown`
428
+
429
+ The error to check for being an aggregate error.
430
+
431
+ #### Returns
432
+
433
+ `err is AggregateError`
434
+
435
+ True if the error is an aggregate error.
436
+
437
+ #### Inherited from
438
+
439
+ [`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
440
+
441
+ ***
442
+
443
+ ### fromAggregate()
444
+
445
+ > `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
446
+
447
+ Convert the aggregate error to an array of errors.
448
+
449
+ #### Parameters
450
+
451
+ ##### err
452
+
453
+ `unknown`
454
+
455
+ The error to convert.
456
+
457
+ ##### includeStackTrace?
458
+
459
+ `boolean`
460
+
461
+ Whether to include the error stack in the model, defaults to false.
462
+
463
+ #### Returns
464
+
465
+ [`IError`](../interfaces/IError.md)[]
466
+
467
+ The array of errors.
468
+
469
+ #### Inherited from
470
+
471
+ [`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
472
+
473
+ ***
474
+
417
475
  ### toJsonObject()
418
476
 
419
477
  > **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
@@ -10,7 +10,7 @@ Class to handle errors when a feature is unsupported.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new NotSupportedError**(`source`, `message`, `inner?`): `NotSupportedError`
13
+ > **new NotSupportedError**(`source`, `message`, `cause?`): `NotSupportedError`
14
14
 
15
15
  Create a new instance of NotSupportedError.
16
16
 
@@ -28,11 +28,11 @@ The source of the error.
28
28
 
29
29
  The message as a code.
30
30
 
31
- ##### inner?
31
+ ##### cause?
32
32
 
33
33
  `unknown`
34
34
 
35
- The inner error if we have wrapped another error.
35
+ The cause of the error if we have wrapped another error.
36
36
 
37
37
  #### Returns
38
38
 
@@ -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)
@@ -10,7 +10,7 @@ Class to handle errors which are triggered by access not being unauthorized.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new UnauthorizedError**(`source`, `message`, `inner?`): `UnauthorizedError`
13
+ > **new UnauthorizedError**(`source`, `message`, `cause?`): `UnauthorizedError`
14
14
 
15
15
  Create a new instance of UnauthorizedError.
16
16
 
@@ -28,11 +28,11 @@ The source of the error.
28
28
 
29
29
  The message as a code.
30
30
 
31
- ##### inner?
31
+ ##### cause?
32
32
 
33
33
  `unknown`
34
34
 
35
- The inner error if we have wrapped another error.
35
+ The cause of the error if we have wrapped another error.
36
36
 
37
37
  #### Returns
38
38
 
@@ -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)