@twin.org/core 0.0.1 → 0.0.2-next.11
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 +915 -849
- package/dist/esm/index.mjs +915 -849
- package/dist/types/errors/alreadyExistsError.d.ts +2 -2
- package/dist/types/errors/baseError.d.ts +23 -4
- 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/dist/types/utils/is.d.ts +6 -0
- package/docs/changelog.md +229 -0
- package/docs/reference/classes/AlreadyExistsError.md +91 -7
- package/docs/reference/classes/ArrayHelper.md +0 -8
- package/docs/reference/classes/BaseError.md +83 -7
- package/docs/reference/classes/ConflictError.md +91 -7
- 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 +91 -7
- package/docs/reference/classes/GuardError.md +88 -4
- package/docs/reference/classes/Guards.md +2 -2
- package/docs/reference/classes/I18n.md +2 -2
- package/docs/reference/classes/Is.md +30 -2
- package/docs/reference/classes/NotFoundError.md +91 -7
- package/docs/reference/classes/NotImplementedError.md +88 -4
- package/docs/reference/classes/NotSupportedError.md +91 -7
- package/docs/reference/classes/UnauthorizedError.md +91 -7
- package/docs/reference/classes/UnprocessableError.md +91 -7
- package/docs/reference/classes/Validation.md +1 -1
- package/docs/reference/classes/ValidationError.md +88 -4
- package/docs/reference/interfaces/IComponent.md +9 -21
- package/docs/reference/interfaces/IError.md +3 -3
- package/docs/reference/variables/CoerceType.md +1 -1
- package/docs/reference/variables/CompressionType.md +1 -1
- package/package.json +2 -2
|
@@ -12,7 +12,7 @@ export declare class AlreadyExistsError extends BaseError {
|
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
14
|
* @param existingId The id for the item.
|
|
15
|
-
* @param
|
|
15
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
16
16
|
*/
|
|
17
|
-
constructor(source: string, message: string, existingId?: string,
|
|
17
|
+
constructor(source: string, message: string, existingId?: string, cause?: unknown);
|
|
18
18
|
}
|
|
@@ -14,20 +14,20 @@ export declare class BaseError extends Error implements IError {
|
|
|
14
14
|
[id: string]: unknown;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* The
|
|
17
|
+
* The cause of the error.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
cause?: IError;
|
|
20
20
|
/**
|
|
21
21
|
* Create a new instance of BaseError.
|
|
22
22
|
* @param name The name of the error.
|
|
23
23
|
* @param source The source of the error.
|
|
24
24
|
* @param message The message as a code.
|
|
25
25
|
* @param properties Any additional information for the error.
|
|
26
|
-
* @param
|
|
26
|
+
* @param cause The cause of error if we have wrapped another error.
|
|
27
27
|
*/
|
|
28
28
|
constructor(name: string, source: string, message: string, properties?: {
|
|
29
29
|
[id: string]: unknown;
|
|
30
|
-
},
|
|
30
|
+
}, cause?: unknown);
|
|
31
31
|
/**
|
|
32
32
|
* Construct an error from an existing one.
|
|
33
33
|
* @param err The existing error.
|
|
@@ -95,6 +95,25 @@ export declare class BaseError extends Error implements IError {
|
|
|
95
95
|
* @returns True if the error has the name.
|
|
96
96
|
*/
|
|
97
97
|
static someErrorCode(error: unknown, code: string | RegExp): error is BaseError;
|
|
98
|
+
/**
|
|
99
|
+
* Is the error empty, i.e. does it have no message, source, properties, or cause?
|
|
100
|
+
* @param err The error to check for being empty.
|
|
101
|
+
* @returns True if the error is empty.
|
|
102
|
+
*/
|
|
103
|
+
static isEmpty(err: IError): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Is the error an aggregate error.
|
|
106
|
+
* @param err The error to check for being an aggregate error.
|
|
107
|
+
* @returns True if the error is an aggregate error.
|
|
108
|
+
*/
|
|
109
|
+
static isAggregateError(err: unknown): err is AggregateError;
|
|
110
|
+
/**
|
|
111
|
+
* Convert the aggregate error to an array of errors.
|
|
112
|
+
* @param err The error to convert.
|
|
113
|
+
* @param includeStackTrace Whether to include the error stack in the model, defaults to false.
|
|
114
|
+
* @returns The array of errors.
|
|
115
|
+
*/
|
|
116
|
+
static fromAggregate(err: unknown, includeStackTrace?: boolean): IError[];
|
|
98
117
|
/**
|
|
99
118
|
* Serialize the error to the error model.
|
|
100
119
|
* @param includeStackTrace Whether to include the error stack in the model, defaults to false.
|
|
@@ -13,7 +13,7 @@ export declare class ConflictError extends BaseError {
|
|
|
13
13
|
* @param message The message as a code.
|
|
14
14
|
* @param conflictId The id that has conflicts.
|
|
15
15
|
* @param conflicts The conflicts that occurred.
|
|
16
|
-
* @param
|
|
16
|
+
* @param cause The cause or the error if we have wrapped another error.
|
|
17
17
|
*/
|
|
18
|
-
constructor(source: string, message: string, conflictId?: string, conflicts?: string[],
|
|
18
|
+
constructor(source: string, message: string, conflictId?: string, conflicts?: string[], cause?: unknown);
|
|
19
19
|
}
|
|
@@ -12,9 +12,9 @@ export declare class GeneralError extends BaseError {
|
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
14
|
* @param properties Any additional information for the error.
|
|
15
|
-
* @param
|
|
15
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
16
16
|
*/
|
|
17
17
|
constructor(source: string, message: string, properties?: {
|
|
18
18
|
[id: string]: unknown;
|
|
19
|
-
},
|
|
19
|
+
}, cause?: unknown);
|
|
20
20
|
}
|
|
@@ -12,7 +12,7 @@ export declare class NotFoundError extends BaseError {
|
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
14
|
* @param notFoundId The id for the item.
|
|
15
|
-
* @param
|
|
15
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
16
16
|
*/
|
|
17
|
-
constructor(source: string, message: string, notFoundId?: string,
|
|
17
|
+
constructor(source: string, message: string, notFoundId?: string, cause?: unknown);
|
|
18
18
|
}
|
|
@@ -11,7 +11,7 @@ export declare class NotSupportedError extends BaseError {
|
|
|
11
11
|
* Create a new instance of NotSupportedError.
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
|
-
* @param
|
|
14
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
15
15
|
*/
|
|
16
|
-
constructor(source: string, message: string,
|
|
16
|
+
constructor(source: string, message: string, cause?: unknown);
|
|
17
17
|
}
|
|
@@ -11,7 +11,7 @@ export declare class UnauthorizedError extends BaseError {
|
|
|
11
11
|
* Create a new instance of UnauthorizedError.
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
|
-
* @param
|
|
14
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
15
15
|
*/
|
|
16
|
-
constructor(source: string, message: string,
|
|
16
|
+
constructor(source: string, message: string, cause?: unknown);
|
|
17
17
|
}
|
|
@@ -12,9 +12,9 @@ export declare class UnprocessableError extends BaseError {
|
|
|
12
12
|
* @param source The source of the error.
|
|
13
13
|
* @param message The message as a code.
|
|
14
14
|
* @param properties Any additional information for the error.
|
|
15
|
-
* @param
|
|
15
|
+
* @param cause The cause of the error if we have wrapped another error.
|
|
16
16
|
*/
|
|
17
17
|
constructor(source: string, message: string, properties?: {
|
|
18
18
|
[id: string]: unknown;
|
|
19
|
-
},
|
|
19
|
+
}, cause?: unknown);
|
|
20
20
|
}
|
|
@@ -51,7 +51,7 @@ export declare class Factory<T> {
|
|
|
51
51
|
* @param name The name of the instance to generate.
|
|
52
52
|
* @returns An instance of the item or undefined if it does not exist.
|
|
53
53
|
*/
|
|
54
|
-
getIfExists<U extends T>(name
|
|
54
|
+
getIfExists<U extends T>(name?: string): U | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* Remove all the instances and leave the generators intact.
|
|
57
57
|
*/
|
|
@@ -7,17 +7,17 @@ export declare class ErrorHelper {
|
|
|
7
7
|
* Format Errors and returns just their messages.
|
|
8
8
|
* @param error The error to format.
|
|
9
9
|
* @param includeDetails Whether to include error details, defaults to false.
|
|
10
|
-
* @returns The error formatted including any
|
|
10
|
+
* @returns The error formatted including any causes errors.
|
|
11
11
|
*/
|
|
12
12
|
static formatErrors(error: unknown, includeDetails?: boolean): string[];
|
|
13
13
|
/**
|
|
14
|
-
* Localize the content of an error and any
|
|
14
|
+
* Localize the content of an error and any causes.
|
|
15
15
|
* @param error The error to format.
|
|
16
16
|
* @returns The localized version of the errors flattened.
|
|
17
17
|
*/
|
|
18
18
|
static localizeErrors(error: unknown): IError[];
|
|
19
19
|
/**
|
|
20
|
-
* Localize the content of an error and any
|
|
20
|
+
* Localize the content of an error and any causes.
|
|
21
21
|
* @param error The error to format.
|
|
22
22
|
* @returns The localized version of the errors flattened.
|
|
23
23
|
*/
|
|
@@ -8,31 +8,22 @@ export interface IComponent {
|
|
|
8
8
|
readonly CLASS_NAME: string;
|
|
9
9
|
/**
|
|
10
10
|
* Bootstrap the component by creating and initializing any resources it needs.
|
|
11
|
-
* @param
|
|
12
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
11
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
13
12
|
* @returns True if the bootstrapping process was successful.
|
|
14
13
|
*/
|
|
15
|
-
bootstrap?(
|
|
16
|
-
[id: string]: unknown;
|
|
17
|
-
}): Promise<boolean>;
|
|
14
|
+
bootstrap?(nodeLoggingComponentType: string | undefined): Promise<boolean>;
|
|
18
15
|
/**
|
|
19
16
|
* The component needs to be started when the node is initialized.
|
|
20
17
|
* @param nodeIdentity The identity of the node starting the component.
|
|
21
|
-
* @param
|
|
22
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
18
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
23
19
|
* @returns Nothing.
|
|
24
20
|
*/
|
|
25
|
-
start?(nodeIdentity: string,
|
|
26
|
-
[id: string]: unknown;
|
|
27
|
-
}): Promise<void>;
|
|
21
|
+
start?(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
|
|
28
22
|
/**
|
|
29
23
|
* The component needs to be stopped when the node is closed.
|
|
30
24
|
* @param nodeIdentity The identity of the node stopping the component.
|
|
31
|
-
* @param
|
|
32
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
25
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
33
26
|
* @returns Nothing.
|
|
34
27
|
*/
|
|
35
|
-
stop?(nodeIdentity: string,
|
|
36
|
-
[id: string]: unknown;
|
|
37
|
-
}): Promise<void>;
|
|
28
|
+
stop?(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
|
|
38
29
|
}
|
package/dist/types/utils/is.d.ts
CHANGED
|
@@ -214,4 +214,10 @@ export declare class Is {
|
|
|
214
214
|
* @returns True if the value is a regexp.
|
|
215
215
|
*/
|
|
216
216
|
static regexp(value: unknown): value is RegExp;
|
|
217
|
+
/**
|
|
218
|
+
* Is the provided object a class constructor.
|
|
219
|
+
* @param obj The object to check.
|
|
220
|
+
* @returns True if the object is a class, false otherwise.
|
|
221
|
+
*/
|
|
222
|
+
static class<T = unknown>(obj: unknown): obj is new (...args: any[]) => T;
|
|
217
223
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,234 @@
|
|
|
1
1
|
# @twin.org/core - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.11](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.10...core-v0.0.2-next.11) (2025-09-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **core:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/nameof bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
18
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
19
|
+
|
|
20
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.9...core-v0.0.2-next.10) (2025-09-11)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Miscellaneous Chores
|
|
24
|
+
|
|
25
|
+
* **core:** Synchronize repo versions
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* The following workspace dependencies were updated
|
|
31
|
+
* dependencies
|
|
32
|
+
* @twin.org/nameof bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
33
|
+
* devDependencies
|
|
34
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
35
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
36
|
+
|
|
37
|
+
## [0.0.2-next.9](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.8...core-v0.0.2-next.9) (2025-09-08)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Miscellaneous Chores
|
|
41
|
+
|
|
42
|
+
* **core:** Synchronize repo versions
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Dependencies
|
|
46
|
+
|
|
47
|
+
* The following workspace dependencies were updated
|
|
48
|
+
* dependencies
|
|
49
|
+
* @twin.org/nameof bumped from 0.0.2-next.8 to 0.0.2-next.9
|
|
50
|
+
* devDependencies
|
|
51
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.8 to 0.0.2-next.9
|
|
52
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.8 to 0.0.2-next.9
|
|
53
|
+
|
|
54
|
+
## [0.0.2-next.8](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.7...core-v0.0.2-next.8) (2025-09-05)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* add Is.class method ([4988205](https://github.com/twinfoundation/framework/commit/498820543e256a130b4888c958fe1d87ca865d7f))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Dependencies
|
|
63
|
+
|
|
64
|
+
* The following workspace dependencies were updated
|
|
65
|
+
* dependencies
|
|
66
|
+
* @twin.org/nameof bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
67
|
+
* devDependencies
|
|
68
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
69
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
70
|
+
|
|
71
|
+
## [0.0.2-next.7](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.6...core-v0.0.2-next.7) (2025-08-29)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Features
|
|
75
|
+
|
|
76
|
+
* eslint migration to flat config ([74427d7](https://github.com/twinfoundation/framework/commit/74427d78d342167f7850e49ab87269326355befe))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### Dependencies
|
|
80
|
+
|
|
81
|
+
* The following workspace dependencies were updated
|
|
82
|
+
* dependencies
|
|
83
|
+
* @twin.org/nameof bumped from 0.0.2-next.6 to 0.0.2-next.7
|
|
84
|
+
* devDependencies
|
|
85
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.6 to 0.0.2-next.7
|
|
86
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.6 to 0.0.2-next.7
|
|
87
|
+
|
|
88
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.5...core-v0.0.2-next.6) (2025-08-27)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Miscellaneous Chores
|
|
92
|
+
|
|
93
|
+
* **core:** Synchronize repo versions
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Dependencies
|
|
97
|
+
|
|
98
|
+
* The following workspace dependencies were updated
|
|
99
|
+
* dependencies
|
|
100
|
+
* @twin.org/nameof bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
101
|
+
* devDependencies
|
|
102
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
103
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
104
|
+
|
|
105
|
+
## [0.0.2-next.5](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.4...core-v0.0.2-next.5) (2025-08-19)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
* use cause instead of inner for errors ([1f4acc4](https://github.com/twinfoundation/framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Dependencies
|
|
114
|
+
|
|
115
|
+
* The following workspace dependencies were updated
|
|
116
|
+
* dependencies
|
|
117
|
+
* @twin.org/nameof bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
118
|
+
* devDependencies
|
|
119
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
120
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
121
|
+
|
|
122
|
+
## [0.0.2-next.4](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.3...core-v0.0.2-next.4) (2025-08-15)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* additional RSA methods and async ([1fceee2](https://github.com/twinfoundation/framework/commit/1fceee2d1248a24a7620846025fcf906495c07f4))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Dependencies
|
|
131
|
+
|
|
132
|
+
* The following workspace dependencies were updated
|
|
133
|
+
* dependencies
|
|
134
|
+
* @twin.org/nameof bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
135
|
+
* devDependencies
|
|
136
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
137
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
138
|
+
|
|
139
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.2...core-v0.0.2-next.3) (2025-08-06)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### Features
|
|
143
|
+
|
|
144
|
+
* add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
|
|
145
|
+
* add ObjectOrArray and ArrayHelper methods ([0ac9077](https://github.com/twinfoundation/framework/commit/0ac907764d64b38ad1b04b0e9c3027055b527559))
|
|
146
|
+
* add rsa cipher support ([7af6cc6](https://github.com/twinfoundation/framework/commit/7af6cc67512d3363bd4a2f2e87bd7733c2800147))
|
|
147
|
+
* add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
|
|
148
|
+
* add zlib/deflate mime types detection ([72c472b](https://github.com/twinfoundation/framework/commit/72c472b5a35a973e7109336f5b6cdd84dbb8bbcb))
|
|
149
|
+
* async cache don't cache failures unless requested ([658ec4b](https://github.com/twinfoundation/framework/commit/658ec4b67a58a075de4702a3886d151e25ad3ddc))
|
|
150
|
+
* improve base error data extraction ([dccc933](https://github.com/twinfoundation/framework/commit/dccc93361a1544b41db0e7c126ff90e858d87960))
|
|
151
|
+
* improve error display in CLI ([94b6ca8](https://github.com/twinfoundation/framework/commit/94b6ca8bdcfe3ca7671c4095b436ea7bddaae98e))
|
|
152
|
+
* propagate includeStackTrace on error conversion ([8471cbb](https://github.com/twinfoundation/framework/commit/8471cbb71f8fc98247a0e92126c438c1a8b04d9b))
|
|
153
|
+
* propagate includeStackTrace on error conversion ([818337d](https://github.com/twinfoundation/framework/commit/818337d50d14bf5a7e8b3204649aa7527115cca9))
|
|
154
|
+
* relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
|
|
155
|
+
* simplify async set ([#121](https://github.com/twinfoundation/framework/issues/121)) ([2693c32](https://github.com/twinfoundation/framework/commit/2693c325266fd1a0aede6f1336c8b254c981a9ca))
|
|
156
|
+
* support indexed properties set in objects ([b9c001d](https://github.com/twinfoundation/framework/commit/b9c001dc4614f6ff7486f4370735a553613d823a))
|
|
157
|
+
* update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
|
|
158
|
+
* use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Dependencies
|
|
162
|
+
|
|
163
|
+
* The following workspace dependencies were updated
|
|
164
|
+
* dependencies
|
|
165
|
+
* @twin.org/nameof bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
166
|
+
* devDependencies
|
|
167
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
168
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
169
|
+
|
|
170
|
+
## [0.0.2-next.2](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.1...core-v0.0.2-next.2) (2025-08-06)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
### Features
|
|
174
|
+
|
|
175
|
+
* add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
|
|
176
|
+
* add ObjectOrArray and ArrayHelper methods ([0ac9077](https://github.com/twinfoundation/framework/commit/0ac907764d64b38ad1b04b0e9c3027055b527559))
|
|
177
|
+
* add rsa cipher support ([7af6cc6](https://github.com/twinfoundation/framework/commit/7af6cc67512d3363bd4a2f2e87bd7733c2800147))
|
|
178
|
+
* add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
|
|
179
|
+
* add zlib/deflate mime types detection ([72c472b](https://github.com/twinfoundation/framework/commit/72c472b5a35a973e7109336f5b6cdd84dbb8bbcb))
|
|
180
|
+
* async cache don't cache failures unless requested ([658ec4b](https://github.com/twinfoundation/framework/commit/658ec4b67a58a075de4702a3886d151e25ad3ddc))
|
|
181
|
+
* improve base error data extraction ([dccc933](https://github.com/twinfoundation/framework/commit/dccc93361a1544b41db0e7c126ff90e858d87960))
|
|
182
|
+
* improve error display in CLI ([94b6ca8](https://github.com/twinfoundation/framework/commit/94b6ca8bdcfe3ca7671c4095b436ea7bddaae98e))
|
|
183
|
+
* propagate includeStackTrace on error conversion ([8471cbb](https://github.com/twinfoundation/framework/commit/8471cbb71f8fc98247a0e92126c438c1a8b04d9b))
|
|
184
|
+
* propagate includeStackTrace on error conversion ([818337d](https://github.com/twinfoundation/framework/commit/818337d50d14bf5a7e8b3204649aa7527115cca9))
|
|
185
|
+
* relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
|
|
186
|
+
* simplify async set ([#121](https://github.com/twinfoundation/framework/issues/121)) ([2693c32](https://github.com/twinfoundation/framework/commit/2693c325266fd1a0aede6f1336c8b254c981a9ca))
|
|
187
|
+
* support indexed properties set in objects ([b9c001d](https://github.com/twinfoundation/framework/commit/b9c001dc4614f6ff7486f4370735a553613d823a))
|
|
188
|
+
* update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
|
|
189
|
+
* use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Dependencies
|
|
193
|
+
|
|
194
|
+
* The following workspace dependencies were updated
|
|
195
|
+
* dependencies
|
|
196
|
+
* @twin.org/nameof bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
197
|
+
* devDependencies
|
|
198
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
199
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
200
|
+
|
|
201
|
+
## [0.0.2-next.1](https://github.com/twinfoundation/framework/compare/core-v0.0.2-next.0...core-v0.0.2-next.1) (2025-08-06)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Features
|
|
205
|
+
|
|
206
|
+
* add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
|
|
207
|
+
* add ObjectOrArray and ArrayHelper methods ([0ac9077](https://github.com/twinfoundation/framework/commit/0ac907764d64b38ad1b04b0e9c3027055b527559))
|
|
208
|
+
* add rsa cipher support ([7af6cc6](https://github.com/twinfoundation/framework/commit/7af6cc67512d3363bd4a2f2e87bd7733c2800147))
|
|
209
|
+
* add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
|
|
210
|
+
* add zlib/deflate mime types detection ([72c472b](https://github.com/twinfoundation/framework/commit/72c472b5a35a973e7109336f5b6cdd84dbb8bbcb))
|
|
211
|
+
* async cache don't cache failures unless requested ([658ec4b](https://github.com/twinfoundation/framework/commit/658ec4b67a58a075de4702a3886d151e25ad3ddc))
|
|
212
|
+
* improve base error data extraction ([dccc933](https://github.com/twinfoundation/framework/commit/dccc93361a1544b41db0e7c126ff90e858d87960))
|
|
213
|
+
* improve error display in CLI ([94b6ca8](https://github.com/twinfoundation/framework/commit/94b6ca8bdcfe3ca7671c4095b436ea7bddaae98e))
|
|
214
|
+
* propagate includeStackTrace on error conversion ([8471cbb](https://github.com/twinfoundation/framework/commit/8471cbb71f8fc98247a0e92126c438c1a8b04d9b))
|
|
215
|
+
* propagate includeStackTrace on error conversion ([818337d](https://github.com/twinfoundation/framework/commit/818337d50d14bf5a7e8b3204649aa7527115cca9))
|
|
216
|
+
* relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
|
|
217
|
+
* simplify async set ([#121](https://github.com/twinfoundation/framework/issues/121)) ([2693c32](https://github.com/twinfoundation/framework/commit/2693c325266fd1a0aede6f1336c8b254c981a9ca))
|
|
218
|
+
* support indexed properties set in objects ([b9c001d](https://github.com/twinfoundation/framework/commit/b9c001dc4614f6ff7486f4370735a553613d823a))
|
|
219
|
+
* update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
|
|
220
|
+
* use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
### Dependencies
|
|
224
|
+
|
|
225
|
+
* The following workspace dependencies were updated
|
|
226
|
+
* dependencies
|
|
227
|
+
* @twin.org/nameof bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
228
|
+
* devDependencies
|
|
229
|
+
* @twin.org/nameof-transformer bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
230
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
231
|
+
|
|
3
232
|
## 0.0.1 (2025-07-03)
|
|
4
233
|
|
|
5
234
|
|
|
@@ -10,7 +10,7 @@ Class to handle errors which are triggered by data already existing.
|
|
|
10
10
|
|
|
11
11
|
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new AlreadyExistsError**(`source`, `message`, `existingId?`, `
|
|
13
|
+
> **new AlreadyExistsError**(`source`, `message`, `existingId?`, `cause?`): `AlreadyExistsError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of AlreadyExistsError.
|
|
16
16
|
|
|
@@ -34,11 +34,11 @@ The message as a code.
|
|
|
34
34
|
|
|
35
35
|
The id for the item.
|
|
36
36
|
|
|
37
|
-
#####
|
|
37
|
+
##### cause?
|
|
38
38
|
|
|
39
39
|
`unknown`
|
|
40
40
|
|
|
41
|
-
The
|
|
41
|
+
The cause of the error if we have wrapped another error.
|
|
42
42
|
|
|
43
43
|
#### Returns
|
|
44
44
|
|
|
@@ -86,15 +86,15 @@ Any additional information for the error.
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
###
|
|
89
|
+
### cause?
|
|
90
90
|
|
|
91
|
-
> `optional` **
|
|
91
|
+
> `optional` **cause**: [`IError`](../interfaces/IError.md)
|
|
92
92
|
|
|
93
|
-
The
|
|
93
|
+
The cause of the error.
|
|
94
94
|
|
|
95
95
|
#### Inherited from
|
|
96
96
|
|
|
97
|
-
[`BaseError`](BaseError.md).[`
|
|
97
|
+
[`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
|
|
98
98
|
|
|
99
99
|
## Methods
|
|
100
100
|
|
|
@@ -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)
|
|
@@ -76,10 +76,6 @@ The object or array to convert.
|
|
|
76
76
|
|
|
77
77
|
The array.
|
|
78
78
|
|
|
79
|
-
##### Param
|
|
80
|
-
|
|
81
|
-
The object or array to convert.
|
|
82
|
-
|
|
83
79
|
#### Call Signature
|
|
84
80
|
|
|
85
81
|
> `static` **fromObjectOrArray**\<`T`\>(`value`): `T`[]
|
|
@@ -105,7 +101,3 @@ The object or array to convert.
|
|
|
105
101
|
`T`[]
|
|
106
102
|
|
|
107
103
|
The array.
|
|
108
|
-
|
|
109
|
-
##### Param
|
|
110
|
-
|
|
111
|
-
The object or array to convert.
|