@twin.org/core 0.0.2-next.9 → 0.0.3-next.2

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 (187) hide show
  1. package/dist/es/encoding/base32.js +75 -0
  2. package/dist/es/encoding/base32.js.map +1 -0
  3. package/dist/es/encoding/base58.js +124 -0
  4. package/dist/es/encoding/base58.js.map +1 -0
  5. package/dist/es/encoding/base64.js +231 -0
  6. package/dist/es/encoding/base64.js.map +1 -0
  7. package/dist/es/encoding/base64Url.js +42 -0
  8. package/dist/es/encoding/base64Url.js.map +1 -0
  9. package/dist/es/errors/alreadyExistsError.js +22 -0
  10. package/dist/es/errors/alreadyExistsError.js.map +1 -0
  11. package/dist/es/errors/baseError.js +257 -0
  12. package/dist/es/errors/baseError.js.map +1 -0
  13. package/dist/es/errors/conflictError.js +23 -0
  14. package/dist/es/errors/conflictError.js.map +1 -0
  15. package/dist/es/errors/generalError.js +21 -0
  16. package/dist/es/errors/generalError.js.map +1 -0
  17. package/dist/es/errors/guardError.js +27 -0
  18. package/dist/es/errors/guardError.js.map +1 -0
  19. package/dist/es/errors/notFoundError.js +22 -0
  20. package/dist/es/errors/notFoundError.js.map +1 -0
  21. package/dist/es/errors/notImplementedError.js +24 -0
  22. package/dist/es/errors/notImplementedError.js.map +1 -0
  23. package/dist/es/errors/notSupportedError.js +21 -0
  24. package/dist/es/errors/notSupportedError.js.map +1 -0
  25. package/dist/es/errors/unauthorizedError.js +21 -0
  26. package/dist/es/errors/unauthorizedError.js.map +1 -0
  27. package/dist/es/errors/unprocessableError.js +21 -0
  28. package/dist/es/errors/unprocessableError.js.map +1 -0
  29. package/dist/es/errors/validationError.js +23 -0
  30. package/dist/es/errors/validationError.js.map +1 -0
  31. package/dist/es/factories/componentFactory.js +9 -0
  32. package/dist/es/factories/componentFactory.js.map +1 -0
  33. package/dist/es/factories/factory.js +256 -0
  34. package/dist/es/factories/factory.js.map +1 -0
  35. package/dist/es/helpers/arrayHelper.js +44 -0
  36. package/dist/es/helpers/arrayHelper.js.map +1 -0
  37. package/dist/es/helpers/envHelper.js +39 -0
  38. package/dist/es/helpers/envHelper.js.map +1 -0
  39. package/dist/es/helpers/errorHelper.js +100 -0
  40. package/dist/es/helpers/errorHelper.js.map +1 -0
  41. package/dist/es/helpers/filenameHelper.js +32 -0
  42. package/dist/es/helpers/filenameHelper.js.map +1 -0
  43. package/dist/es/helpers/hexHelper.js +45 -0
  44. package/dist/es/helpers/hexHelper.js.map +1 -0
  45. package/dist/es/helpers/jsonHelper.js +163 -0
  46. package/dist/es/helpers/jsonHelper.js.map +1 -0
  47. package/dist/es/helpers/numberHelper.js +30 -0
  48. package/dist/es/helpers/numberHelper.js.map +1 -0
  49. package/dist/es/helpers/objectHelper.js +333 -0
  50. package/dist/es/helpers/objectHelper.js.map +1 -0
  51. package/dist/es/helpers/randomHelper.js +18 -0
  52. package/dist/es/helpers/randomHelper.js.map +1 -0
  53. package/dist/es/helpers/stringHelper.js +241 -0
  54. package/dist/es/helpers/stringHelper.js.map +1 -0
  55. package/dist/es/helpers/uint8ArrayHelper.js +26 -0
  56. package/dist/es/helpers/uint8ArrayHelper.js.map +1 -0
  57. package/dist/es/index.js +57 -0
  58. package/dist/es/index.js.map +1 -0
  59. package/dist/es/models/IComponent.js +4 -0
  60. package/dist/es/models/IComponent.js.map +1 -0
  61. package/dist/es/models/IError.js +4 -0
  62. package/dist/es/models/IError.js.map +1 -0
  63. package/dist/es/models/II18nShared.js +2 -0
  64. package/dist/es/models/II18nShared.js.map +1 -0
  65. package/dist/es/models/IKeyValue.js +2 -0
  66. package/dist/es/models/IKeyValue.js.map +1 -0
  67. package/dist/es/models/ILabelledValue.js +2 -0
  68. package/dist/es/models/ILabelledValue.js.map +1 -0
  69. package/dist/es/models/ILocale.js +2 -0
  70. package/dist/es/models/ILocale.js.map +1 -0
  71. package/dist/es/models/ILocaleDictionary.js +4 -0
  72. package/dist/es/models/ILocaleDictionary.js.map +1 -0
  73. package/dist/es/models/ILocalesIndex.js +2 -0
  74. package/dist/es/models/ILocalesIndex.js.map +1 -0
  75. package/dist/es/models/IPatchOperation.js +4 -0
  76. package/dist/es/models/IPatchOperation.js.map +1 -0
  77. package/dist/es/models/IUrlParts.js +4 -0
  78. package/dist/es/models/IUrlParts.js.map +1 -0
  79. package/dist/es/models/IValidationFailure.js +2 -0
  80. package/dist/es/models/IValidationFailure.js.map +1 -0
  81. package/dist/es/models/coerceType.js +49 -0
  82. package/dist/es/models/coerceType.js.map +1 -0
  83. package/dist/es/models/compressionType.js +17 -0
  84. package/dist/es/models/compressionType.js.map +1 -0
  85. package/dist/es/models/objectOrArray.js +2 -0
  86. package/dist/es/models/objectOrArray.js.map +1 -0
  87. package/dist/es/types/bitString.js +98 -0
  88. package/dist/es/types/bitString.js.map +1 -0
  89. package/dist/es/types/url.js +144 -0
  90. package/dist/es/types/url.js.map +1 -0
  91. package/dist/es/types/urn.js +212 -0
  92. package/dist/es/types/urn.js.map +1 -0
  93. package/dist/es/utils/asyncCache.js +179 -0
  94. package/dist/es/utils/asyncCache.js.map +1 -0
  95. package/dist/es/utils/coerce.js +269 -0
  96. package/dist/es/utils/coerce.js.map +1 -0
  97. package/dist/es/utils/compression.js +49 -0
  98. package/dist/es/utils/compression.js.map +1 -0
  99. package/dist/es/utils/converter.js +256 -0
  100. package/dist/es/utils/converter.js.map +1 -0
  101. package/dist/es/utils/guards.js +369 -0
  102. package/dist/es/utils/guards.js.map +1 -0
  103. package/dist/es/utils/i18n.js +243 -0
  104. package/dist/es/utils/i18n.js.map +1 -0
  105. package/dist/es/utils/is.js +351 -0
  106. package/dist/es/utils/is.js.map +1 -0
  107. package/dist/es/utils/sharedStore.js +48 -0
  108. package/dist/es/utils/sharedStore.js.map +1 -0
  109. package/dist/es/utils/validation.js +774 -0
  110. package/dist/es/utils/validation.js.map +1 -0
  111. package/dist/types/encoding/base32.d.ts +4 -0
  112. package/dist/types/encoding/base58.d.ts +4 -0
  113. package/dist/types/encoding/base64.d.ts +4 -0
  114. package/dist/types/encoding/base64Url.d.ts +4 -0
  115. package/dist/types/errors/alreadyExistsError.d.ts +5 -2
  116. package/dist/types/errors/baseError.d.ts +1 -1
  117. package/dist/types/errors/conflictError.d.ts +5 -2
  118. package/dist/types/errors/generalError.d.ts +1 -1
  119. package/dist/types/errors/guardError.d.ts +1 -1
  120. package/dist/types/errors/notFoundError.d.ts +5 -2
  121. package/dist/types/errors/notImplementedError.d.ts +6 -2
  122. package/dist/types/errors/notSupportedError.d.ts +5 -2
  123. package/dist/types/errors/unauthorizedError.d.ts +5 -2
  124. package/dist/types/errors/unprocessableError.d.ts +1 -1
  125. package/dist/types/errors/validationError.d.ts +2 -2
  126. package/dist/types/factories/componentFactory.d.ts +2 -2
  127. package/dist/types/factories/factory.d.ts +4 -0
  128. package/dist/types/helpers/arrayHelper.d.ts +1 -1
  129. package/dist/types/helpers/errorHelper.d.ts +1 -1
  130. package/dist/types/helpers/jsonHelper.d.ts +5 -1
  131. package/dist/types/helpers/numberHelper.d.ts +17 -0
  132. package/dist/types/helpers/objectHelper.d.ts +14 -0
  133. package/dist/types/helpers/stringHelper.d.ts +6 -6
  134. package/dist/types/index.d.ts +54 -53
  135. package/dist/types/models/IComponent.d.ts +6 -7
  136. package/dist/types/models/ILocalesIndex.d.ts +1 -1
  137. package/dist/types/models/IValidationFailure.d.ts +0 -4
  138. package/dist/types/types/bitString.d.ts +4 -0
  139. package/dist/types/types/url.d.ts +8 -3
  140. package/dist/types/types/urn.d.ts +7 -2
  141. package/dist/types/utils/coerce.d.ts +1 -1
  142. package/dist/types/utils/compression.d.ts +5 -1
  143. package/dist/types/utils/guards.d.ts +2 -3
  144. package/dist/types/utils/i18n.d.ts +16 -1
  145. package/dist/types/utils/is.d.ts +1 -1
  146. package/dist/types/utils/validation.d.ts +1 -1
  147. package/docs/changelog.md +283 -0
  148. package/docs/reference/classes/AlreadyExistsError.md +8 -4
  149. package/docs/reference/classes/AsyncCache.md +5 -5
  150. package/docs/reference/classes/Base32.md +8 -0
  151. package/docs/reference/classes/Base58.md +8 -0
  152. package/docs/reference/classes/Base64.md +8 -0
  153. package/docs/reference/classes/Base64Url.md +8 -0
  154. package/docs/reference/classes/BaseError.md +3 -3
  155. package/docs/reference/classes/BitString.md +8 -0
  156. package/docs/reference/classes/Coerce.md +20 -20
  157. package/docs/reference/classes/Compression.md +8 -0
  158. package/docs/reference/classes/ConflictError.md +8 -4
  159. package/docs/reference/classes/ErrorHelper.md +2 -2
  160. package/docs/reference/classes/Factory.md +11 -3
  161. package/docs/reference/classes/GeneralError.md +3 -3
  162. package/docs/reference/classes/GuardError.md +3 -3
  163. package/docs/reference/classes/Guards.md +8 -4
  164. package/docs/reference/classes/I18n.md +54 -2
  165. package/docs/reference/classes/Is.md +10 -4
  166. package/docs/reference/classes/JsonHelper.md +8 -0
  167. package/docs/reference/classes/NotFoundError.md +8 -4
  168. package/docs/reference/classes/NotImplementedError.md +14 -4
  169. package/docs/reference/classes/NotSupportedError.md +8 -4
  170. package/docs/reference/classes/NumberHelper.md +55 -0
  171. package/docs/reference/classes/ObjectHelper.md +58 -8
  172. package/docs/reference/classes/SharedStore.md +2 -2
  173. package/docs/reference/classes/StringHelper.md +8 -8
  174. package/docs/reference/classes/UnauthorizedError.md +8 -4
  175. package/docs/reference/classes/UnprocessableError.md +3 -3
  176. package/docs/reference/classes/Url.md +17 -3
  177. package/docs/reference/classes/Urn.md +19 -5
  178. package/docs/reference/classes/Validation.md +2 -2
  179. package/docs/reference/classes/ValidationError.md +3 -3
  180. package/docs/reference/index.md +1 -0
  181. package/docs/reference/interfaces/IComponent.md +19 -25
  182. package/docs/reference/interfaces/IValidationFailure.md +0 -8
  183. package/locales/.validate-ignore +1 -0
  184. package/locales/en.json +4 -5
  185. package/package.json +22 -10
  186. package/dist/cjs/index.cjs +0 -5175
  187. package/dist/esm/index.mjs +0 -5133
@@ -0,0 +1,257 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { StringHelper } from "../helpers/stringHelper.js";
4
+ import { Is } from "../utils/is.js";
5
+ /**
6
+ * Class to handle errors.
7
+ */
8
+ export class BaseError extends Error {
9
+ /**
10
+ * The source of the error.
11
+ */
12
+ source;
13
+ /**
14
+ * Any additional information for the error.
15
+ */
16
+ properties;
17
+ /**
18
+ * The cause of the error.
19
+ */
20
+ cause;
21
+ /**
22
+ * Create a new instance of BaseError.
23
+ * @param name The name of the error.
24
+ * @param source The source of the error.
25
+ * @param message The message as a code.
26
+ * @param properties Any additional information for the error.
27
+ * @param cause The cause of error if we have wrapped another error.
28
+ */
29
+ constructor(name, source, message, properties, cause) {
30
+ super(message);
31
+ this.name = name;
32
+ this.source = source;
33
+ this.cause = Is.notEmpty(cause) ? BaseError.fromError(cause).toJsonObject(true) : undefined;
34
+ this.properties = properties;
35
+ // If the message is camel case but has no namespace then prefix it
36
+ // with the source name in camel case.
37
+ if (Is.stringValue(source) &&
38
+ Is.stringValue(message) &&
39
+ !message.includes(".") &&
40
+ // This comparison checks that it is most likely a camel case name
41
+ // and not a free text error with a dot in it
42
+ StringHelper.camelCase(message) === message) {
43
+ this.message = `${StringHelper.camelCase(source)}.${message}`;
44
+ }
45
+ }
46
+ /**
47
+ * Construct an error from an existing one.
48
+ * @param err The existing error.
49
+ * @returns The new instance.
50
+ */
51
+ static fromError(err) {
52
+ let name = "Base";
53
+ let message;
54
+ let source;
55
+ let properties;
56
+ let cause;
57
+ let stack;
58
+ if (Is.object(err) && Is.stringValue(err.error)) {
59
+ message = err.error;
60
+ }
61
+ else if (Is.object(err)) {
62
+ if (Is.stringValue(err.name)) {
63
+ name = err.name;
64
+ }
65
+ if (Is.stringValue(err.source)) {
66
+ source = err.source;
67
+ }
68
+ if (Is.stringValue(err.message)) {
69
+ message = err.message;
70
+ }
71
+ if (Is.notEmpty(err.properties)) {
72
+ properties = err.properties;
73
+ }
74
+ if (BaseError.isAggregateError(err)) {
75
+ properties ??= {};
76
+ properties.errors = err.errors;
77
+ }
78
+ if (Is.notEmpty(err.cause)) {
79
+ cause = err.cause;
80
+ }
81
+ if (Is.notEmpty(err.stack)) {
82
+ stack = err.stack;
83
+ }
84
+ }
85
+ else if (Is.stringValue(err)) {
86
+ message = err;
87
+ }
88
+ else {
89
+ message = JSON.stringify(err);
90
+ }
91
+ const baseError = new BaseError(name, source ?? "", message ?? "", properties, cause);
92
+ baseError.stack = stack;
93
+ return baseError;
94
+ }
95
+ /**
96
+ * Flatten an error tree.
97
+ * @param err The starting error.
98
+ * @returns The list of all internal errors.
99
+ */
100
+ static flatten(err) {
101
+ const flattened = [];
102
+ let e = BaseError.fromError(err).toJsonObject(true);
103
+ while (e) {
104
+ const cause = e.cause;
105
+ e.cause = undefined;
106
+ flattened.push(e);
107
+ e = cause;
108
+ }
109
+ return flattened;
110
+ }
111
+ /**
112
+ * Expand an error tree.
113
+ * @param errors The list of errors to expand.
114
+ * @returns The first level error.
115
+ */
116
+ static expand(errors) {
117
+ let first;
118
+ if (Is.arrayValue(errors)) {
119
+ first = errors[0];
120
+ let current = first;
121
+ for (let i = 1; i < errors.length; i++) {
122
+ current.cause = errors[i];
123
+ current = current.cause;
124
+ }
125
+ }
126
+ return first;
127
+ }
128
+ /**
129
+ * Test to see if the error has the specified error name.
130
+ * @param error The error to test.
131
+ * @param name The name to check for.
132
+ * @returns True if the error has the name.
133
+ */
134
+ static isErrorName(error, name) {
135
+ return (Is.object(error) &&
136
+ (Is.string(name) ? error.name === name : name.test(error.name)));
137
+ }
138
+ /**
139
+ * Test to see if the error has the specified error message.
140
+ * @param error The error to test.
141
+ * @param message The message to check for.
142
+ * @returns True if the error has the name.
143
+ */
144
+ static isErrorMessage(error, message) {
145
+ return (Is.object(error) &&
146
+ (Is.string(message) ? error.message === message : message.test(error.message)));
147
+ }
148
+ /**
149
+ * Test to see if the error has the specified error code.
150
+ * @param error The error to test.
151
+ * @param code The code to check for.
152
+ * @returns True if the error has the code.
153
+ */
154
+ static isErrorCode(error, code) {
155
+ return (Is.object(error) &&
156
+ (Is.string(code) ? error.code === code : code.test(error.code)));
157
+ }
158
+ /**
159
+ * Test to see if any of the errors or children have the given error name.
160
+ * @param error The error to test.
161
+ * @param name The name to check for.
162
+ * @returns True if the error has the name.
163
+ */
164
+ static someErrorName(error, name) {
165
+ return BaseError.flatten(error).some(e => BaseError.isErrorName(e, name));
166
+ }
167
+ /**
168
+ * Test to see if any of the errors or children have the given error message.
169
+ * @param error The error to test.
170
+ * @param message The message to check for.
171
+ * @returns True if the error has the name.
172
+ */
173
+ static someErrorMessage(error, message) {
174
+ return BaseError.flatten(error).some(e => BaseError.isErrorMessage(e, message));
175
+ }
176
+ /**
177
+ * Test to see if any of the errors or children are from a specific class.
178
+ * @param error The error to test.
179
+ * @param cls The class to check for.
180
+ * @returns True if the error has the specific class.
181
+ */
182
+ static someErrorClass(error, cls) {
183
+ const errorClass = StringHelper.camelCase(cls);
184
+ const regExp = new RegExp(`^${errorClass}\\.`);
185
+ return BaseError.flatten(error).some(e => BaseError.isErrorMessage(e, regExp));
186
+ }
187
+ /**
188
+ * Test to see if any of the errors or children have the given error code.
189
+ * @param error The error to test.
190
+ * @param code The code to check for.
191
+ * @returns True if the error has the name.
192
+ */
193
+ static someErrorCode(error, code) {
194
+ return BaseError.flatten(error).some(e => BaseError.isErrorCode(e, code));
195
+ }
196
+ /**
197
+ * Is the error empty, i.e. does it have no message, source, properties, or cause?
198
+ * @param err The error to check for being empty.
199
+ * @returns True if the error is empty.
200
+ */
201
+ static isEmpty(err) {
202
+ return (!Is.stringValue(err.message) &&
203
+ !Is.stringValue(err.source) &&
204
+ !Is.objectValue(err.properties) &&
205
+ Is.empty(err.cause));
206
+ }
207
+ /**
208
+ * Is the error an aggregate error.
209
+ * @param err The error to check for being an aggregate error.
210
+ * @returns True if the error is an aggregate error.
211
+ */
212
+ static isAggregateError(err) {
213
+ // This is the only way we can reliably check for AggregateError
214
+ // eslint-disable-next-line no-restricted-syntax
215
+ return err instanceof AggregateError;
216
+ }
217
+ /**
218
+ * Convert the aggregate error to an array of errors.
219
+ * @param err The error to convert.
220
+ * @param includeStackTrace Whether to include the error stack in the model, defaults to false.
221
+ * @returns The array of errors.
222
+ */
223
+ static fromAggregate(err, includeStackTrace) {
224
+ if (BaseError.isAggregateError(err)) {
225
+ return err.errors.map(e => BaseError.fromError(e).toJsonObject(includeStackTrace));
226
+ }
227
+ return [BaseError.fromError(err).toJsonObject(includeStackTrace)];
228
+ }
229
+ /**
230
+ * Serialize the error to the error model.
231
+ * @param includeStackTrace Whether to include the error stack in the model, defaults to false.
232
+ * @returns The error model.
233
+ */
234
+ toJsonObject(includeStackTrace) {
235
+ const err = {};
236
+ if (Is.stringValue(this.name)) {
237
+ err.name = this.name;
238
+ }
239
+ if (Is.stringValue(this.source)) {
240
+ err.source = this.source;
241
+ }
242
+ if (Is.stringValue(this.message)) {
243
+ err.message = this.message;
244
+ }
245
+ if (Is.object(this.properties)) {
246
+ err.properties = this.properties;
247
+ }
248
+ if ((includeStackTrace ?? false) && Is.stringValue(this.stack)) {
249
+ err.stack = this.stack;
250
+ }
251
+ if (Is.notEmpty(this.cause)) {
252
+ err.cause = BaseError.fromError(this.cause).toJsonObject(includeStackTrace);
253
+ }
254
+ return err;
255
+ }
256
+ }
257
+ //# sourceMappingURL=baseError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseError.js","sourceRoot":"","sources":["../../../src/errors/baseError.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IACnC;;OAEG;IACI,MAAM,CAAU;IAEvB;;OAEG;IACI,UAAU,CAA6B;IAE9C;;OAEG;IACI,KAAK,CAAU;IAEtB;;;;;;;OAOG;IACH,YACC,IAAY,EACZ,MAAc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0.\nimport { StringHelper } from \"../helpers/stringHelper.js\";\nimport type { IError } from \"../models/IError.js\";\nimport { Is } from \"../utils/is.js\";\n\n/**\n * Class to handle errors.\n */\nexport class BaseError extends Error implements IError {\n\t/**\n\t * The source of the error.\n\t */\n\tpublic source?: string;\n\n\t/**\n\t * Any additional information for the error.\n\t */\n\tpublic properties?: { [id: string]: unknown };\n\n\t/**\n\t * The cause of the error.\n\t */\n\tpublic cause?: IError;\n\n\t/**\n\t * Create a new instance of BaseError.\n\t * @param name The name of the error.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tname: string,\n\t\tsource: string,\n\t\tmessage: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(message);\n\t\tthis.name = name;\n\t\tthis.source = source;\n\t\tthis.cause = Is.notEmpty(cause) ? BaseError.fromError(cause).toJsonObject(true) : undefined;\n\t\tthis.properties = properties;\n\n\t\t// If the message is camel case but has no namespace then prefix it\n\t\t// with the source name in camel case.\n\t\tif (\n\t\t\tIs.stringValue(source) &&\n\t\t\tIs.stringValue(message) &&\n\t\t\t!message.includes(\".\") &&\n\t\t\t// This comparison checks that it is most likely a camel case name\n\t\t\t// and not a free text error with a dot in it\n\t\t\tStringHelper.camelCase(message) === message\n\t\t) {\n\t\t\tthis.message = `${StringHelper.camelCase(source)}.${message}`;\n\t\t}\n\t}\n\n\t/**\n\t * Construct an error from an existing one.\n\t * @param err The existing error.\n\t * @returns The new instance.\n\t */\n\tpublic static fromError(err: unknown): BaseError {\n\t\tlet name = \"Base\";\n\t\tlet message;\n\t\tlet source;\n\t\tlet properties;\n\t\tlet cause;\n\t\tlet stack;\n\n\t\tif (Is.object<{ error: string }>(err) && Is.stringValue(err.error)) {\n\t\t\tmessage = err.error;\n\t\t} else if (Is.object<BaseError>(err)) {\n\t\t\tif (Is.stringValue(err.name)) {\n\t\t\t\tname = err.name;\n\t\t\t}\n\t\t\tif (Is.stringValue(err.source)) {\n\t\t\t\tsource = err.source;\n\t\t\t}\n\t\t\tif (Is.stringValue(err.message)) {\n\t\t\t\tmessage = err.message;\n\t\t\t}\n\t\t\tif (Is.notEmpty(err.properties)) {\n\t\t\t\tproperties = err.properties;\n\t\t\t}\n\t\t\tif (BaseError.isAggregateError(err)) {\n\t\t\t\tproperties ??= {};\n\t\t\t\tproperties.errors = err.errors;\n\t\t\t}\n\t\t\tif (Is.notEmpty(err.cause)) {\n\t\t\t\tcause = err.cause;\n\t\t\t}\n\t\t\tif (Is.notEmpty(err.stack)) {\n\t\t\t\tstack = err.stack;\n\t\t\t}\n\t\t} else if (Is.stringValue(err)) {\n\t\t\tmessage = err;\n\t\t} else {\n\t\t\tmessage = JSON.stringify(err);\n\t\t}\n\n\t\tconst baseError = new BaseError(name, source ?? \"\", message ?? \"\", properties, cause);\n\n\t\tbaseError.stack = stack;\n\n\t\treturn baseError;\n\t}\n\n\t/**\n\t * Flatten an error tree.\n\t * @param err The starting error.\n\t * @returns The list of all internal errors.\n\t */\n\tpublic static flatten(err: unknown): IError[] {\n\t\tconst flattened: IError[] = [];\n\n\t\tlet e: IError | undefined = BaseError.fromError(err).toJsonObject(true);\n\n\t\twhile (e) {\n\t\t\tconst cause: IError | undefined = e.cause;\n\t\t\te.cause = undefined;\n\t\t\tflattened.push(e);\n\t\t\te = cause;\n\t\t}\n\n\t\treturn flattened;\n\t}\n\n\t/**\n\t * Expand an error tree.\n\t * @param errors The list of errors to expand.\n\t * @returns The first level error.\n\t */\n\tpublic static expand(errors: IError[] | undefined): IError | undefined {\n\t\tlet first: IError | undefined;\n\n\t\tif (Is.arrayValue(errors)) {\n\t\t\tfirst = errors[0];\n\t\t\tlet current = first;\n\t\t\tfor (let i = 1; i < errors.length; i++) {\n\t\t\t\tcurrent.cause = errors[i];\n\t\t\t\tcurrent = current.cause;\n\t\t\t}\n\t\t}\n\n\t\treturn first;\n\t}\n\n\t/**\n\t * Test to see if the error has the specified error name.\n\t * @param error The error to test.\n\t * @param name The name to check for.\n\t * @returns True if the error has the name.\n\t */\n\tpublic static isErrorName(error: unknown, name: string | RegExp): error is BaseError {\n\t\treturn (\n\t\t\tIs.object<{ name: string }>(error) &&\n\t\t\t(Is.string(name) ? error.name === name : name.test(error.name))\n\t\t);\n\t}\n\n\t/**\n\t * Test to see if the error has the specified error message.\n\t * @param error The error to test.\n\t * @param message The message to check for.\n\t * @returns True if the error has the name.\n\t */\n\tpublic static isErrorMessage(error: unknown, message: string | RegExp): error is BaseError {\n\t\treturn (\n\t\t\tIs.object<{ message: string }>(error) &&\n\t\t\t(Is.string(message) ? error.message === message : message.test(error.message))\n\t\t);\n\t}\n\n\t/**\n\t * Test to see if the error has the specified error code.\n\t * @param error The error to test.\n\t * @param code The code to check for.\n\t * @returns True if the error has the code.\n\t */\n\tpublic static isErrorCode(error: unknown, code: string | RegExp): boolean {\n\t\treturn (\n\t\t\tIs.object<{ code: string }>(error) &&\n\t\t\t(Is.string(code) ? error.code === code : code.test(error.code))\n\t\t);\n\t}\n\n\t/**\n\t * Test to see if any of the errors or children have the given error name.\n\t * @param error The error to test.\n\t * @param name The name to check for.\n\t * @returns True if the error has the name.\n\t */\n\tpublic static someErrorName(error: unknown, name: string | RegExp): error is BaseError {\n\t\treturn BaseError.flatten(error).some(e => BaseError.isErrorName(e, name));\n\t}\n\n\t/**\n\t * Test to see if any of the errors or children have the given error message.\n\t * @param error The error to test.\n\t * @param message The message to check for.\n\t * @returns True if the error has the name.\n\t */\n\tpublic static someErrorMessage(error: unknown, message: string | RegExp): error is BaseError {\n\t\treturn BaseError.flatten(error).some(e => BaseError.isErrorMessage(e, message));\n\t}\n\n\t/**\n\t * Test to see if any of the errors or children are from a specific class.\n\t * @param error The error to test.\n\t * @param cls The class to check for.\n\t * @returns True if the error has the specific class.\n\t */\n\tpublic static someErrorClass(error: unknown, cls: string): error is BaseError {\n\t\tconst errorClass = StringHelper.camelCase(cls);\n\t\tconst regExp = new RegExp(`^${errorClass}\\\\.`);\n\t\treturn BaseError.flatten(error).some(e => BaseError.isErrorMessage(e, regExp));\n\t}\n\n\t/**\n\t * Test to see if any of the errors or children have the given error code.\n\t * @param error The error to test.\n\t * @param code The code to check for.\n\t * @returns True if the error has the name.\n\t */\n\tpublic static someErrorCode(error: unknown, code: string | RegExp): error is BaseError {\n\t\treturn BaseError.flatten(error).some(e => BaseError.isErrorCode(e, code));\n\t}\n\n\t/**\n\t * Is the error empty, i.e. does it have no message, source, properties, or cause?\n\t * @param err The error to check for being empty.\n\t * @returns True if the error is empty.\n\t */\n\tpublic static isEmpty(err: IError): boolean {\n\t\treturn (\n\t\t\t!Is.stringValue(err.message) &&\n\t\t\t!Is.stringValue(err.source) &&\n\t\t\t!Is.objectValue(err.properties) &&\n\t\t\tIs.empty(err.cause)\n\t\t);\n\t}\n\n\t/**\n\t * Is the error an aggregate error.\n\t * @param err The error to check for being an aggregate error.\n\t * @returns True if the error is an aggregate error.\n\t */\n\tpublic static isAggregateError(err: unknown): err is AggregateError {\n\t\t// This is the only way we can reliably check for AggregateError\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn err instanceof AggregateError;\n\t}\n\n\t/**\n\t * Convert the aggregate error to an array of errors.\n\t * @param err The error to convert.\n\t * @param includeStackTrace Whether to include the error stack in the model, defaults to false.\n\t * @returns The array of errors.\n\t */\n\tpublic static fromAggregate(err: unknown, includeStackTrace?: boolean): IError[] {\n\t\tif (BaseError.isAggregateError(err)) {\n\t\t\treturn err.errors.map(e => BaseError.fromError(e).toJsonObject(includeStackTrace));\n\t\t}\n\t\treturn [BaseError.fromError(err).toJsonObject(includeStackTrace)];\n\t}\n\n\t/**\n\t * Serialize the error to the error model.\n\t * @param includeStackTrace Whether to include the error stack in the model, defaults to false.\n\t * @returns The error model.\n\t */\n\tpublic toJsonObject(includeStackTrace?: boolean): IError {\n\t\tconst err: Partial<IError> = {};\n\t\tif (Is.stringValue(this.name)) {\n\t\t\terr.name = this.name;\n\t\t}\n\t\tif (Is.stringValue(this.source)) {\n\t\t\terr.source = this.source;\n\t\t}\n\t\tif (Is.stringValue(this.message)) {\n\t\t\terr.message = this.message;\n\t\t}\n\t\tif (Is.object(this.properties)) {\n\t\t\terr.properties = this.properties;\n\t\t}\n\t\tif ((includeStackTrace ?? false) && Is.stringValue(this.stack)) {\n\t\t\terr.stack = this.stack;\n\t\t}\n\t\tif (Is.notEmpty(this.cause)) {\n\t\t\terr.cause = BaseError.fromError(this.cause).toJsonObject(includeStackTrace);\n\t\t}\n\t\treturn err as IError;\n\t}\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors which are triggered by conflicting data.
4
+ */
5
+ export class ConflictError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "ConflictError";
10
+ /**
11
+ * Create a new instance of ConflictError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param conflictId The id that has conflicts.
15
+ * @param conflicts The conflicts that occurred.
16
+ * @param properties Any additional information for the error.
17
+ * @param cause The cause or the error if we have wrapped another error.
18
+ */
19
+ constructor(source, message, conflictId, conflicts, properties, cause) {
20
+ super(ConflictError.CLASS_NAME, source, message, { conflictId, conflicts, ...properties }, cause);
21
+ }
22
+ }
23
+ //# sourceMappingURL=conflictError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conflictError.js","sourceRoot":"","sources":["../../../src/errors/conflictError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC3C;;OAEG;IACI,MAAM,CAAU,UAAU,mBAAmC;IAEpE;;;;;;;;OAQG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAmB,EACnB,SAAoB,EACpB,UAAsC,EACtC,KAAe;QAEf,KAAK,CACJ,aAAa,CAAC,UAAU,EACxB,MAAM,EACN,OAAO,EACP,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,EACxC,KAAK,CACL,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors which are triggered by conflicting data.\n */\nexport class ConflictError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ConflictError>();\n\n\t/**\n\t * Create a new instance of ConflictError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param conflictId The id that has conflicts.\n\t * @param conflicts The conflicts that occurred.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause or the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tconflictId?: string,\n\t\tconflicts?: string[],\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(\n\t\t\tConflictError.CLASS_NAME,\n\t\t\tsource,\n\t\t\tmessage,\n\t\t\t{ conflictId, conflicts, ...properties },\n\t\t\tcause\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors.
4
+ */
5
+ export class GeneralError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "GeneralError";
10
+ /**
11
+ * Create a new instance of GeneralError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source, message, properties, cause) {
18
+ super(GeneralError.CLASS_NAME, source, message, properties, cause);
19
+ }
20
+ }
21
+ //# sourceMappingURL=generalError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalError.js","sourceRoot":"","sources":["../../../src/errors/generalError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IAC1C;;OAEG;IACI,MAAM,CAAU,UAAU,kBAAkC;IAEnE;;;;;;OAMG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAsC,EACtC,KAAe;QAEf,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors.\n */\nexport class GeneralError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<GeneralError>();\n\n\t/**\n\t * Create a new instance of GeneralError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(GeneralError.CLASS_NAME, source, message, properties, cause);\n\t}\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { BaseError } from "./baseError.js";
2
+ import { Is } from "../utils/is.js";
3
+ /**
4
+ * Class to handle errors which are triggered by data guards.
5
+ */
6
+ export class GuardError extends BaseError {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static CLASS_NAME = "GuardError";
11
+ /**
12
+ * Create a new instance of GuardError.
13
+ * @param source The source of the error.
14
+ * @param message The message as a code.
15
+ * @param propertyName The property which triggered the guard error for the item.
16
+ * @param propertyValue The property value which triggered the guard error for the item.
17
+ * @param propertyOptions The property options which might be allowed.
18
+ */
19
+ constructor(source, message, propertyName, propertyValue, propertyOptions) {
20
+ super(GuardError.CLASS_NAME, source, message, {
21
+ property: propertyName ?? "property",
22
+ value: Is.undefined(propertyValue) ? "undefined" : propertyValue,
23
+ options: propertyOptions
24
+ });
25
+ }
26
+ }
27
+ //# sourceMappingURL=guardError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardError.js","sourceRoot":"","sources":["../../../src/errors/guardError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IACxC;;OAEG;IACI,MAAM,CAAU,UAAU,gBAAgC;IAEjE;;;;;;;OAOG;IACH,YACC,MAAc,EACd,OAAe,EACf,YAAoB,EACpB,aAAsB,EACtB,eAAwB;QAExB,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE;YAC7C,QAAQ,EAAE,YAAY,IAAI,UAAU;YACpC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;YAChE,OAAO,EAAE,eAAe;SACxB,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\nimport { Is } from \"../utils/is.js\";\n\n/**\n * Class to handle errors which are triggered by data guards.\n */\nexport class GuardError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<GuardError>();\n\n\t/**\n\t * Create a new instance of GuardError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param propertyName The property which triggered the guard error for the item.\n\t * @param propertyValue The property value which triggered the guard error for the item.\n\t * @param propertyOptions The property options which might be allowed.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tpropertyName: string,\n\t\tpropertyValue: unknown,\n\t\tpropertyOptions?: string\n\t) {\n\t\tsuper(GuardError.CLASS_NAME, source, message, {\n\t\t\tproperty: propertyName ?? \"property\",\n\t\t\tvalue: Is.undefined(propertyValue) ? \"undefined\" : propertyValue,\n\t\t\toptions: propertyOptions\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors which are triggered by data not being found.
4
+ */
5
+ export class NotFoundError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "NotFoundError";
10
+ /**
11
+ * Create a new instance of NotFoundError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param notFoundId The id for the item.
15
+ * @param properties Any additional information for the error.
16
+ * @param cause The cause of the error if we have wrapped another error.
17
+ */
18
+ constructor(source, message, notFoundId, properties, cause) {
19
+ super(NotFoundError.CLASS_NAME, source, message, { notFoundId, ...properties }, cause);
20
+ }
21
+ }
22
+ //# sourceMappingURL=notFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notFoundError.js","sourceRoot":"","sources":["../../../src/errors/notFoundError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC3C;;OAEG;IACI,MAAM,CAAU,UAAU,mBAAmC;IAEpE;;;;;;;OAOG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAmB,EACnB,UAAsC,EACtC,KAAe;QAEf,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;IACxF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors which are triggered by data not being found.\n */\nexport class NotFoundError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NotFoundError>();\n\n\t/**\n\t * Create a new instance of NotFoundError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param notFoundId The id for the item.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tnotFoundId?: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(NotFoundError.CLASS_NAME, source, message, { notFoundId, ...properties }, cause);\n\t}\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors.
4
+ */
5
+ export class NotImplementedError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "NotImplementedError";
10
+ /**
11
+ * Create a new instance of NotImplementedError.
12
+ * @param source The source of the error.
13
+ * @param method The method for the error.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source, method, properties, cause) {
18
+ super(NotImplementedError.CLASS_NAME, source, "common.notImplementedMethod", {
19
+ method,
20
+ ...properties
21
+ }, cause);
22
+ }
23
+ }
24
+ //# sourceMappingURL=notImplementedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notImplementedError.js","sourceRoot":"","sources":["../../../src/errors/notImplementedError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IACjD;;OAEG;IACI,MAAM,CAAU,UAAU,yBAAyC;IAE1E;;;;;;OAMG;IACH,YACC,MAAc,EACd,MAAc,EACd,UAAsC,EACtC,KAAe;QAEf,KAAK,CACJ,mBAAmB,CAAC,UAAU,EAC9B,MAAM,EACN,6BAA6B,EAC7B;YACC,MAAM;YACN,GAAG,UAAU;SACb,EACD,KAAK,CACL,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors.\n */\nexport class NotImplementedError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NotImplementedError>();\n\n\t/**\n\t * Create a new instance of NotImplementedError.\n\t * @param source The source of the error.\n\t * @param method The method for the error.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmethod: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(\n\t\t\tNotImplementedError.CLASS_NAME,\n\t\t\tsource,\n\t\t\t\"common.notImplementedMethod\",\n\t\t\t{\n\t\t\t\tmethod,\n\t\t\t\t...properties\n\t\t\t},\n\t\t\tcause\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors when a feature is unsupported.
4
+ */
5
+ export class NotSupportedError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "NotSupportedError";
10
+ /**
11
+ * Create a new instance of NotSupportedError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source, message, properties, cause) {
18
+ super(NotSupportedError.CLASS_NAME, source, message, properties, cause);
19
+ }
20
+ }
21
+ //# sourceMappingURL=notSupportedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notSupportedError.js","sourceRoot":"","sources":["../../../src/errors/notSupportedError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC/C;;OAEG;IACI,MAAM,CAAU,UAAU,uBAAuC;IAExE;;;;;;OAMG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAsC,EACtC,KAAe;QAEf,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors when a feature is unsupported.\n */\nexport class NotSupportedError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NotSupportedError>();\n\n\t/**\n\t * Create a new instance of NotSupportedError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(NotSupportedError.CLASS_NAME, source, message, properties, cause);\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors which are triggered by access not being unauthorized.
4
+ */
5
+ export class UnauthorizedError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "UnauthorizedError";
10
+ /**
11
+ * Create a new instance of UnauthorizedError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source, message, properties, cause) {
18
+ super(UnauthorizedError.CLASS_NAME, source, message, properties, cause);
19
+ }
20
+ }
21
+ //# sourceMappingURL=unauthorizedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthorizedError.js","sourceRoot":"","sources":["../../../src/errors/unauthorizedError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC/C;;OAEG;IACI,MAAM,CAAU,UAAU,uBAAuC;IAExE;;;;;;OAMG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAsC,EACtC,KAAe;QAEf,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors which are triggered by access not being unauthorized.\n */\nexport class UnauthorizedError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<UnauthorizedError>();\n\n\t/**\n\t * Create a new instance of UnauthorizedError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(UnauthorizedError.CLASS_NAME, source, message, properties, cause);\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors when some data can not be processed.
4
+ */
5
+ export class UnprocessableError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static CLASS_NAME = "UnprocessableError";
10
+ /**
11
+ * Create a new instance of UnprocessableError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source, message, properties, cause) {
18
+ super(UnprocessableError.CLASS_NAME, source, message, properties, cause);
19
+ }
20
+ }
21
+ //# sourceMappingURL=unprocessableError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unprocessableError.js","sourceRoot":"","sources":["../../../src/errors/unprocessableError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAChD;;OAEG;IACI,MAAM,CAAU,UAAU,wBAAwC;IAEzE;;;;;;OAMG;IACH,YACC,MAAc,EACd,OAAe,EACf,UAAsC,EACtC,KAAe;QAEf,KAAK,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\n\n/**\n * Class to handle errors when some data can not be processed.\n */\nexport class UnprocessableError extends BaseError {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<UnprocessableError>();\n\n\t/**\n\t * Create a new instance of UnprocessableError.\n\t * @param source The source of the error.\n\t * @param message The message as a code.\n\t * @param properties Any additional information for the error.\n\t * @param cause The cause of the error if we have wrapped another error.\n\t */\n\tconstructor(\n\t\tsource: string,\n\t\tmessage: string,\n\t\tproperties?: { [id: string]: unknown },\n\t\tcause?: unknown\n\t) {\n\t\tsuper(UnprocessableError.CLASS_NAME, source, message, properties, cause);\n\t}\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { BaseError } from "./baseError.js";
2
+ /**
3
+ * Class to handle errors which are triggered by entity validation.
4
+ */
5
+ export class ValidationError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.s
8
+ */
9
+ static CLASS_NAME = "ValidationError";
10
+ /**
11
+ * Create a new instance of ValidationError.
12
+ * @param source The source of the error.
13
+ * @param validationObject The object that failed validation.
14
+ * @param validationFailures The validation failures.
15
+ */
16
+ constructor(source, validationObject, validationFailures) {
17
+ super(ValidationError.CLASS_NAME, source, "common.validation", {
18
+ validationObject,
19
+ validationFailures
20
+ });
21
+ }
22
+ }
23
+ //# sourceMappingURL=validationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationError.js","sourceRoot":"","sources":["../../../src/errors/validationError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC7C;;OAEG;IACI,MAAM,CAAU,UAAU,qBAAqC;IAEtE;;;;;OAKG;IACH,YAAY,MAAc,EAAE,gBAAwB,EAAE,kBAAwC;QAC7F,KAAK,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,EAAE;YAC9D,gBAAgB;YAChB,kBAAkB;SAClB,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { nameof } from \"@twin.org/nameof\";\nimport { BaseError } from \"./baseError.js\";\nimport type { IValidationFailure } from \"../models/IValidationFailure.js\";\n\n/**\n * Class to handle errors which are triggered by entity validation.\n */\nexport class ValidationError extends BaseError {\n\t/**\n\t * Runtime name for the class.s\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ValidationError>();\n\n\t/**\n\t * Create a new instance of ValidationError.\n\t * @param source The source of the error.\n\t * @param validationObject The object that failed validation.\n\t * @param validationFailures The validation failures.\n\t */\n\tconstructor(source: string, validationObject: string, validationFailures: IValidationFailure[]) {\n\t\tsuper(ValidationError.CLASS_NAME, source, \"common.validation\", {\n\t\t\tvalidationObject,\n\t\t\tvalidationFailures\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "./factory.js";
4
+ /**
5
+ * Factory for creating implementation of component types.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const ComponentFactory = Factory.createFactory("component");
9
+ //# sourceMappingURL=componentFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentFactory.js","sourceRoot":"","sources":["../../../src/factories/componentFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAa,WAAW,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"./factory.js\";\nimport type { IComponent } from \"../models/IComponent.js\";\n\n/**\n * Factory for creating implementation of component types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ComponentFactory = Factory.createFactory<IComponent>(\"component\");\n"]}