@twin.org/core 0.0.1 → 0.0.2-next.10

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 (40) hide show
  1. package/dist/cjs/index.cjs +915 -849
  2. package/dist/esm/index.mjs +915 -849
  3. package/dist/types/errors/alreadyExistsError.d.ts +2 -2
  4. package/dist/types/errors/baseError.d.ts +23 -4
  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/dist/types/utils/is.d.ts +6 -0
  16. package/docs/changelog.md +212 -0
  17. package/docs/reference/classes/AlreadyExistsError.md +91 -7
  18. package/docs/reference/classes/ArrayHelper.md +0 -8
  19. package/docs/reference/classes/BaseError.md +83 -7
  20. package/docs/reference/classes/ConflictError.md +91 -7
  21. package/docs/reference/classes/EnvHelper.md +1 -1
  22. package/docs/reference/classes/ErrorHelper.md +3 -3
  23. package/docs/reference/classes/Factory.md +2 -2
  24. package/docs/reference/classes/GeneralError.md +91 -7
  25. package/docs/reference/classes/GuardError.md +88 -4
  26. package/docs/reference/classes/Guards.md +2 -2
  27. package/docs/reference/classes/I18n.md +2 -2
  28. package/docs/reference/classes/Is.md +30 -2
  29. package/docs/reference/classes/NotFoundError.md +91 -7
  30. package/docs/reference/classes/NotImplementedError.md +88 -4
  31. package/docs/reference/classes/NotSupportedError.md +91 -7
  32. package/docs/reference/classes/UnauthorizedError.md +91 -7
  33. package/docs/reference/classes/UnprocessableError.md +91 -7
  34. package/docs/reference/classes/Validation.md +1 -1
  35. package/docs/reference/classes/ValidationError.md +88 -4
  36. package/docs/reference/interfaces/IComponent.md +9 -21
  37. package/docs/reference/interfaces/IError.md +3 -3
  38. package/docs/reference/variables/CoerceType.md +1 -1
  39. package/docs/reference/variables/CompressionType.md +1 -1
  40. package/package.json +2 -2
@@ -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
 
@@ -400,6 +400,90 @@ True if the error has the name.
400
400
 
401
401
  ***
402
402
 
403
+ ### isEmpty()
404
+
405
+ > `static` **isEmpty**(`err`): `boolean`
406
+
407
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
408
+
409
+ #### Parameters
410
+
411
+ ##### err
412
+
413
+ [`IError`](../interfaces/IError.md)
414
+
415
+ The error to check for being empty.
416
+
417
+ #### Returns
418
+
419
+ `boolean`
420
+
421
+ True if the error is empty.
422
+
423
+ #### Inherited from
424
+
425
+ [`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
426
+
427
+ ***
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
+
403
487
  ### toJsonObject()
404
488
 
405
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
 
@@ -388,6 +388,90 @@ True if the error has the name.
388
388
 
389
389
  ***
390
390
 
391
+ ### isEmpty()
392
+
393
+ > `static` **isEmpty**(`err`): `boolean`
394
+
395
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
396
+
397
+ #### Parameters
398
+
399
+ ##### err
400
+
401
+ [`IError`](../interfaces/IError.md)
402
+
403
+ The error to check for being empty.
404
+
405
+ #### Returns
406
+
407
+ `boolean`
408
+
409
+ True if the error is empty.
410
+
411
+ #### Inherited from
412
+
413
+ [`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
414
+
415
+ ***
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
+
391
475
  ### toJsonObject()
392
476
 
393
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
 
@@ -394,6 +394,90 @@ True if the error has the name.
394
394
 
395
395
  ***
396
396
 
397
+ ### isEmpty()
398
+
399
+ > `static` **isEmpty**(`err`): `boolean`
400
+
401
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
402
+
403
+ #### Parameters
404
+
405
+ ##### err
406
+
407
+ [`IError`](../interfaces/IError.md)
408
+
409
+ The error to check for being empty.
410
+
411
+ #### Returns
412
+
413
+ `boolean`
414
+
415
+ True if the error is empty.
416
+
417
+ #### Inherited from
418
+
419
+ [`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
420
+
421
+ ***
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
+
397
481
  ### toJsonObject()
398
482
 
399
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
 
@@ -394,6 +394,90 @@ True if the error has the name.
394
394
 
395
395
  ***
396
396
 
397
+ ### isEmpty()
398
+
399
+ > `static` **isEmpty**(`err`): `boolean`
400
+
401
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
402
+
403
+ #### Parameters
404
+
405
+ ##### err
406
+
407
+ [`IError`](../interfaces/IError.md)
408
+
409
+ The error to check for being empty.
410
+
411
+ #### Returns
412
+
413
+ `boolean`
414
+
415
+ True if the error is empty.
416
+
417
+ #### Inherited from
418
+
419
+ [`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
420
+
421
+ ***
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
+
397
481
  ### toJsonObject()
398
482
 
399
483
  > **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
@@ -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?`, `inner?`): `UnprocessableError`
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
- ##### 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
 
@@ -398,6 +398,90 @@ True if the error has the name.
398
398
 
399
399
  ***
400
400
 
401
+ ### isEmpty()
402
+
403
+ > `static` **isEmpty**(`err`): `boolean`
404
+
405
+ Is the error empty, i.e. does it have no message, source, properties, or cause?
406
+
407
+ #### Parameters
408
+
409
+ ##### err
410
+
411
+ [`IError`](../interfaces/IError.md)
412
+
413
+ The error to check for being empty.
414
+
415
+ #### Returns
416
+
417
+ `boolean`
418
+
419
+ True if the error is empty.
420
+
421
+ #### Inherited from
422
+
423
+ [`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
424
+
425
+ ***
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
+
401
485
  ### toJsonObject()
402
486
 
403
487
  > **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
@@ -670,7 +670,7 @@ Is the property an object.
670
670
 
671
671
  ##### T
672
672
 
673
- `T` = \{[`id`: `string`]: `unknown`; \}
673
+ `T` = \{\[`id`: `string`\]: `unknown`; \}
674
674
 
675
675
  #### Parameters
676
676