@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.
- package/dist/es/encoding/base32.js +75 -0
- package/dist/es/encoding/base32.js.map +1 -0
- package/dist/es/encoding/base58.js +124 -0
- package/dist/es/encoding/base58.js.map +1 -0
- package/dist/es/encoding/base64.js +231 -0
- package/dist/es/encoding/base64.js.map +1 -0
- package/dist/es/encoding/base64Url.js +42 -0
- package/dist/es/encoding/base64Url.js.map +1 -0
- package/dist/es/errors/alreadyExistsError.js +22 -0
- package/dist/es/errors/alreadyExistsError.js.map +1 -0
- package/dist/es/errors/baseError.js +257 -0
- package/dist/es/errors/baseError.js.map +1 -0
- package/dist/es/errors/conflictError.js +23 -0
- package/dist/es/errors/conflictError.js.map +1 -0
- package/dist/es/errors/generalError.js +21 -0
- package/dist/es/errors/generalError.js.map +1 -0
- package/dist/es/errors/guardError.js +27 -0
- package/dist/es/errors/guardError.js.map +1 -0
- package/dist/es/errors/notFoundError.js +22 -0
- package/dist/es/errors/notFoundError.js.map +1 -0
- package/dist/es/errors/notImplementedError.js +24 -0
- package/dist/es/errors/notImplementedError.js.map +1 -0
- package/dist/es/errors/notSupportedError.js +21 -0
- package/dist/es/errors/notSupportedError.js.map +1 -0
- package/dist/es/errors/unauthorizedError.js +21 -0
- package/dist/es/errors/unauthorizedError.js.map +1 -0
- package/dist/es/errors/unprocessableError.js +21 -0
- package/dist/es/errors/unprocessableError.js.map +1 -0
- package/dist/es/errors/validationError.js +23 -0
- package/dist/es/errors/validationError.js.map +1 -0
- package/dist/es/factories/componentFactory.js +9 -0
- package/dist/es/factories/componentFactory.js.map +1 -0
- package/dist/es/factories/factory.js +256 -0
- package/dist/es/factories/factory.js.map +1 -0
- package/dist/es/helpers/arrayHelper.js +44 -0
- package/dist/es/helpers/arrayHelper.js.map +1 -0
- package/dist/es/helpers/envHelper.js +39 -0
- package/dist/es/helpers/envHelper.js.map +1 -0
- package/dist/es/helpers/errorHelper.js +100 -0
- package/dist/es/helpers/errorHelper.js.map +1 -0
- package/dist/es/helpers/filenameHelper.js +32 -0
- package/dist/es/helpers/filenameHelper.js.map +1 -0
- package/dist/es/helpers/hexHelper.js +45 -0
- package/dist/es/helpers/hexHelper.js.map +1 -0
- package/dist/es/helpers/jsonHelper.js +163 -0
- package/dist/es/helpers/jsonHelper.js.map +1 -0
- package/dist/es/helpers/numberHelper.js +30 -0
- package/dist/es/helpers/numberHelper.js.map +1 -0
- package/dist/es/helpers/objectHelper.js +333 -0
- package/dist/es/helpers/objectHelper.js.map +1 -0
- package/dist/es/helpers/randomHelper.js +18 -0
- package/dist/es/helpers/randomHelper.js.map +1 -0
- package/dist/es/helpers/stringHelper.js +241 -0
- package/dist/es/helpers/stringHelper.js.map +1 -0
- package/dist/es/helpers/uint8ArrayHelper.js +26 -0
- package/dist/es/helpers/uint8ArrayHelper.js.map +1 -0
- package/dist/es/index.js +57 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IComponent.js +4 -0
- package/dist/es/models/IComponent.js.map +1 -0
- package/dist/es/models/IError.js +4 -0
- package/dist/es/models/IError.js.map +1 -0
- package/dist/es/models/II18nShared.js +2 -0
- package/dist/es/models/II18nShared.js.map +1 -0
- package/dist/es/models/IKeyValue.js +2 -0
- package/dist/es/models/IKeyValue.js.map +1 -0
- package/dist/es/models/ILabelledValue.js +2 -0
- package/dist/es/models/ILabelledValue.js.map +1 -0
- package/dist/es/models/ILocale.js +2 -0
- package/dist/es/models/ILocale.js.map +1 -0
- package/dist/es/models/ILocaleDictionary.js +4 -0
- package/dist/es/models/ILocaleDictionary.js.map +1 -0
- package/dist/es/models/ILocalesIndex.js +2 -0
- package/dist/es/models/ILocalesIndex.js.map +1 -0
- package/dist/es/models/IPatchOperation.js +4 -0
- package/dist/es/models/IPatchOperation.js.map +1 -0
- package/dist/es/models/IUrlParts.js +4 -0
- package/dist/es/models/IUrlParts.js.map +1 -0
- package/dist/es/models/IValidationFailure.js +2 -0
- package/dist/es/models/IValidationFailure.js.map +1 -0
- package/dist/es/models/coerceType.js +49 -0
- package/dist/es/models/coerceType.js.map +1 -0
- package/dist/es/models/compressionType.js +17 -0
- package/dist/es/models/compressionType.js.map +1 -0
- package/dist/es/models/objectOrArray.js +2 -0
- package/dist/es/models/objectOrArray.js.map +1 -0
- package/dist/es/types/bitString.js +98 -0
- package/dist/es/types/bitString.js.map +1 -0
- package/dist/es/types/url.js +144 -0
- package/dist/es/types/url.js.map +1 -0
- package/dist/es/types/urn.js +212 -0
- package/dist/es/types/urn.js.map +1 -0
- package/dist/es/utils/asyncCache.js +179 -0
- package/dist/es/utils/asyncCache.js.map +1 -0
- package/dist/es/utils/coerce.js +269 -0
- package/dist/es/utils/coerce.js.map +1 -0
- package/dist/es/utils/compression.js +49 -0
- package/dist/es/utils/compression.js.map +1 -0
- package/dist/es/utils/converter.js +256 -0
- package/dist/es/utils/converter.js.map +1 -0
- package/dist/es/utils/guards.js +369 -0
- package/dist/es/utils/guards.js.map +1 -0
- package/dist/es/utils/i18n.js +243 -0
- package/dist/es/utils/i18n.js.map +1 -0
- package/dist/es/utils/is.js +351 -0
- package/dist/es/utils/is.js.map +1 -0
- package/dist/es/utils/sharedStore.js +48 -0
- package/dist/es/utils/sharedStore.js.map +1 -0
- package/dist/es/utils/validation.js +774 -0
- package/dist/es/utils/validation.js.map +1 -0
- package/dist/types/encoding/base32.d.ts +4 -0
- package/dist/types/encoding/base58.d.ts +4 -0
- package/dist/types/encoding/base64.d.ts +4 -0
- package/dist/types/encoding/base64Url.d.ts +4 -0
- package/dist/types/errors/alreadyExistsError.d.ts +5 -2
- package/dist/types/errors/baseError.d.ts +1 -1
- package/dist/types/errors/conflictError.d.ts +5 -2
- package/dist/types/errors/generalError.d.ts +1 -1
- package/dist/types/errors/guardError.d.ts +1 -1
- package/dist/types/errors/notFoundError.d.ts +5 -2
- package/dist/types/errors/notImplementedError.d.ts +6 -2
- package/dist/types/errors/notSupportedError.d.ts +5 -2
- package/dist/types/errors/unauthorizedError.d.ts +5 -2
- package/dist/types/errors/unprocessableError.d.ts +1 -1
- package/dist/types/errors/validationError.d.ts +2 -2
- package/dist/types/factories/componentFactory.d.ts +2 -2
- package/dist/types/factories/factory.d.ts +4 -0
- package/dist/types/helpers/arrayHelper.d.ts +1 -1
- package/dist/types/helpers/errorHelper.d.ts +1 -1
- package/dist/types/helpers/jsonHelper.d.ts +5 -1
- package/dist/types/helpers/numberHelper.d.ts +17 -0
- package/dist/types/helpers/objectHelper.d.ts +14 -0
- package/dist/types/helpers/stringHelper.d.ts +6 -6
- package/dist/types/index.d.ts +54 -53
- package/dist/types/models/IComponent.d.ts +6 -7
- package/dist/types/models/ILocalesIndex.d.ts +1 -1
- package/dist/types/models/IValidationFailure.d.ts +0 -4
- package/dist/types/types/bitString.d.ts +4 -0
- package/dist/types/types/url.d.ts +8 -3
- package/dist/types/types/urn.d.ts +7 -2
- package/dist/types/utils/coerce.d.ts +1 -1
- package/dist/types/utils/compression.d.ts +5 -1
- package/dist/types/utils/guards.d.ts +2 -3
- package/dist/types/utils/i18n.d.ts +16 -1
- package/dist/types/utils/is.d.ts +1 -1
- package/dist/types/utils/validation.d.ts +1 -1
- package/docs/changelog.md +283 -0
- package/docs/reference/classes/AlreadyExistsError.md +8 -4
- package/docs/reference/classes/AsyncCache.md +5 -5
- package/docs/reference/classes/Base32.md +8 -0
- package/docs/reference/classes/Base58.md +8 -0
- package/docs/reference/classes/Base64.md +8 -0
- package/docs/reference/classes/Base64Url.md +8 -0
- package/docs/reference/classes/BaseError.md +3 -3
- package/docs/reference/classes/BitString.md +8 -0
- package/docs/reference/classes/Coerce.md +20 -20
- package/docs/reference/classes/Compression.md +8 -0
- package/docs/reference/classes/ConflictError.md +8 -4
- package/docs/reference/classes/ErrorHelper.md +2 -2
- package/docs/reference/classes/Factory.md +11 -3
- package/docs/reference/classes/GeneralError.md +3 -3
- package/docs/reference/classes/GuardError.md +3 -3
- package/docs/reference/classes/Guards.md +8 -4
- package/docs/reference/classes/I18n.md +54 -2
- package/docs/reference/classes/Is.md +10 -4
- package/docs/reference/classes/JsonHelper.md +8 -0
- package/docs/reference/classes/NotFoundError.md +8 -4
- package/docs/reference/classes/NotImplementedError.md +14 -4
- package/docs/reference/classes/NotSupportedError.md +8 -4
- package/docs/reference/classes/NumberHelper.md +55 -0
- package/docs/reference/classes/ObjectHelper.md +58 -8
- package/docs/reference/classes/SharedStore.md +2 -2
- package/docs/reference/classes/StringHelper.md +8 -8
- package/docs/reference/classes/UnauthorizedError.md +8 -4
- package/docs/reference/classes/UnprocessableError.md +3 -3
- package/docs/reference/classes/Url.md +17 -3
- package/docs/reference/classes/Urn.md +19 -5
- package/docs/reference/classes/Validation.md +2 -2
- package/docs/reference/classes/ValidationError.md +3 -3
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IComponent.md +19 -25
- package/docs/reference/interfaces/IValidationFailure.md +0 -8
- package/locales/.validate-ignore +1 -0
- package/locales/en.json +4 -5
- package/package.json +22 -10
- package/dist/cjs/index.cjs +0 -5175
- package/dist/esm/index.mjs +0 -5133
|
@@ -12,6 +12,14 @@ Class to help with objects.
|
|
|
12
12
|
|
|
13
13
|
`ObjectHelper`
|
|
14
14
|
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
25
|
### toBytes()
|
|
@@ -32,7 +40,7 @@ Convert an object to bytes.
|
|
|
32
40
|
|
|
33
41
|
The object to convert.
|
|
34
42
|
|
|
35
|
-
`
|
|
43
|
+
`T` | `undefined`
|
|
36
44
|
|
|
37
45
|
##### format
|
|
38
46
|
|
|
@@ -66,7 +74,7 @@ Convert a bytes to an object.
|
|
|
66
74
|
|
|
67
75
|
The bytes to convert to an object.
|
|
68
76
|
|
|
69
|
-
`
|
|
77
|
+
`Uint8Array`\<`ArrayBufferLike`\> | `null` | `undefined`
|
|
70
78
|
|
|
71
79
|
#### Returns
|
|
72
80
|
|
|
@@ -188,7 +196,7 @@ True is the objects are equal.
|
|
|
188
196
|
|
|
189
197
|
### propertyGet()
|
|
190
198
|
|
|
191
|
-
> `static` **propertyGet**\<`T`\>(`obj`, `property`): `
|
|
199
|
+
> `static` **propertyGet**\<`T`\>(`obj`, `property`): `T` \| `undefined`
|
|
192
200
|
|
|
193
201
|
Get the property of an unknown object.
|
|
194
202
|
|
|
@@ -214,7 +222,7 @@ The property to get, can be separated by dots for nested path.
|
|
|
214
222
|
|
|
215
223
|
#### Returns
|
|
216
224
|
|
|
217
|
-
`
|
|
225
|
+
`T` \| `undefined`
|
|
218
226
|
|
|
219
227
|
The property.
|
|
220
228
|
|
|
@@ -284,7 +292,7 @@ The property to set
|
|
|
284
292
|
|
|
285
293
|
### extractProperty()
|
|
286
294
|
|
|
287
|
-
> `static` **extractProperty**\<`T`\>(`obj`, `propertyNames`, `removeProperties`): `
|
|
295
|
+
> `static` **extractProperty**\<`T`\>(`obj`, `propertyNames`, `removeProperties`): `T` \| `undefined`
|
|
288
296
|
|
|
289
297
|
Extract a property from the object, providing alternative names.
|
|
290
298
|
|
|
@@ -316,7 +324,7 @@ Remove the properties from the object, defaults to true.
|
|
|
316
324
|
|
|
317
325
|
#### Returns
|
|
318
326
|
|
|
319
|
-
`
|
|
327
|
+
`T` \| `undefined`
|
|
320
328
|
|
|
321
329
|
The property if available.
|
|
322
330
|
|
|
@@ -340,7 +348,7 @@ Pick a subset of properties from an object.
|
|
|
340
348
|
|
|
341
349
|
The object to pick the properties from.
|
|
342
350
|
|
|
343
|
-
`
|
|
351
|
+
`T` | `undefined`
|
|
344
352
|
|
|
345
353
|
##### keys?
|
|
346
354
|
|
|
@@ -374,7 +382,7 @@ Omit a subset of properties from an object.
|
|
|
374
382
|
|
|
375
383
|
The object to omit the properties from.
|
|
376
384
|
|
|
377
|
-
`
|
|
385
|
+
`T` | `undefined`
|
|
378
386
|
|
|
379
387
|
##### keys?
|
|
380
388
|
|
|
@@ -390,6 +398,48 @@ The partial object.
|
|
|
390
398
|
|
|
391
399
|
***
|
|
392
400
|
|
|
401
|
+
### split()
|
|
402
|
+
|
|
403
|
+
> `static` **split**\<`T`\>(`obj`, `keys?`): `object`
|
|
404
|
+
|
|
405
|
+
Split an object into two with the specified keys.
|
|
406
|
+
|
|
407
|
+
#### Type Parameters
|
|
408
|
+
|
|
409
|
+
##### T
|
|
410
|
+
|
|
411
|
+
`T`
|
|
412
|
+
|
|
413
|
+
#### Parameters
|
|
414
|
+
|
|
415
|
+
##### obj
|
|
416
|
+
|
|
417
|
+
The object to split.
|
|
418
|
+
|
|
419
|
+
`T` | `undefined`
|
|
420
|
+
|
|
421
|
+
##### keys?
|
|
422
|
+
|
|
423
|
+
keyof `T`[]
|
|
424
|
+
|
|
425
|
+
The property keys to split.
|
|
426
|
+
|
|
427
|
+
#### Returns
|
|
428
|
+
|
|
429
|
+
`object`
|
|
430
|
+
|
|
431
|
+
The two partial objects.
|
|
432
|
+
|
|
433
|
+
##### picked
|
|
434
|
+
|
|
435
|
+
> **picked**: `Partial`\<`T`\> \| `undefined`
|
|
436
|
+
|
|
437
|
+
##### omitted
|
|
438
|
+
|
|
439
|
+
> **omitted**: `Partial`\<`T`\> \| `undefined`
|
|
440
|
+
|
|
441
|
+
***
|
|
442
|
+
|
|
393
443
|
### toExtended()
|
|
394
444
|
|
|
395
445
|
> `static` **toExtended**(`obj`): `any`
|
|
@@ -17,7 +17,7 @@ instance loads of a packages.
|
|
|
17
17
|
|
|
18
18
|
### get()
|
|
19
19
|
|
|
20
|
-
> `static` **get**\<`T`\>(`prop`): `
|
|
20
|
+
> `static` **get**\<`T`\>(`prop`): `T` \| `undefined`
|
|
21
21
|
|
|
22
22
|
Get a property from the shared store.
|
|
23
23
|
|
|
@@ -37,7 +37,7 @@ The name of the property to get.
|
|
|
37
37
|
|
|
38
38
|
#### Returns
|
|
39
39
|
|
|
40
|
-
`
|
|
40
|
+
`T` \| `undefined`
|
|
41
41
|
|
|
42
42
|
The property if it exists.
|
|
43
43
|
|
|
@@ -18,21 +18,21 @@ Class to help with string.
|
|
|
18
18
|
|
|
19
19
|
> `static` **trimTrailingSlashes**(`value`): `string`
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Implementation signature for trimTrailingSlashes.
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
25
|
##### value
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
`string`
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The value to trim.
|
|
30
30
|
|
|
31
31
|
#### Returns
|
|
32
32
|
|
|
33
33
|
`string`
|
|
34
34
|
|
|
35
|
-
The trimmed
|
|
35
|
+
The trimmed string or the original.
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
@@ -40,21 +40,21 @@ The trimmed value.
|
|
|
40
40
|
|
|
41
41
|
> `static` **trimLeadingSlashes**(`value`): `string`
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Implementation signature for trimLeadingSlashes.
|
|
44
44
|
|
|
45
45
|
#### Parameters
|
|
46
46
|
|
|
47
47
|
##### value
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
`string`
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The value to trim.
|
|
52
52
|
|
|
53
53
|
#### Returns
|
|
54
54
|
|
|
55
55
|
`string`
|
|
56
56
|
|
|
57
|
-
The trimmed
|
|
57
|
+
The trimmed string or the original.
|
|
58
58
|
|
|
59
59
|
***
|
|
60
60
|
|
|
@@ -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`, `cause?`): `UnauthorizedError`
|
|
13
|
+
> **new UnauthorizedError**(`source`, `message`, `properties?`, `cause?`): `UnauthorizedError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of UnauthorizedError.
|
|
16
16
|
|
|
@@ -28,6 +28,10 @@ The source of the error.
|
|
|
28
28
|
|
|
29
29
|
The message as a code.
|
|
30
30
|
|
|
31
|
+
##### properties?
|
|
32
|
+
|
|
33
|
+
Any additional information for the error.
|
|
34
|
+
|
|
31
35
|
##### cause?
|
|
32
36
|
|
|
33
37
|
`unknown`
|
|
@@ -146,7 +150,7 @@ The list of all internal errors.
|
|
|
146
150
|
|
|
147
151
|
### expand()
|
|
148
152
|
|
|
149
|
-
> `static` **expand**(`errors`):
|
|
153
|
+
> `static` **expand**(`errors`): [`IError`](../interfaces/IError.md) \| `undefined`
|
|
150
154
|
|
|
151
155
|
Expand an error tree.
|
|
152
156
|
|
|
@@ -156,11 +160,11 @@ Expand an error tree.
|
|
|
156
160
|
|
|
157
161
|
The list of errors to expand.
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
[`IError`](../interfaces/IError.md)[] | `undefined`
|
|
160
164
|
|
|
161
165
|
#### Returns
|
|
162
166
|
|
|
163
|
-
|
|
167
|
+
[`IError`](../interfaces/IError.md) \| `undefined`
|
|
164
168
|
|
|
165
169
|
The first level error.
|
|
166
170
|
|
|
@@ -150,7 +150,7 @@ The list of all internal errors.
|
|
|
150
150
|
|
|
151
151
|
### expand()
|
|
152
152
|
|
|
153
|
-
> `static` **expand**(`errors`):
|
|
153
|
+
> `static` **expand**(`errors`): [`IError`](../interfaces/IError.md) \| `undefined`
|
|
154
154
|
|
|
155
155
|
Expand an error tree.
|
|
156
156
|
|
|
@@ -160,11 +160,11 @@ Expand an error tree.
|
|
|
160
160
|
|
|
161
161
|
The list of errors to expand.
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
[`IError`](../interfaces/IError.md)[] | `undefined`
|
|
164
164
|
|
|
165
165
|
#### Returns
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
[`IError`](../interfaces/IError.md) \| `undefined`
|
|
168
168
|
|
|
169
169
|
The first level error.
|
|
170
170
|
|
|
@@ -22,11 +22,19 @@ The url string.
|
|
|
22
22
|
|
|
23
23
|
`Url`
|
|
24
24
|
|
|
25
|
+
## Properties
|
|
26
|
+
|
|
27
|
+
### CLASS\_NAME
|
|
28
|
+
|
|
29
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
30
|
+
|
|
31
|
+
Runtime name for the class.
|
|
32
|
+
|
|
25
33
|
## Methods
|
|
26
34
|
|
|
27
35
|
### tryParseExact()
|
|
28
36
|
|
|
29
|
-
> `static` **tryParseExact**(`url`): `
|
|
37
|
+
> `static` **tryParseExact**(`url`): `Url` \| `undefined`
|
|
30
38
|
|
|
31
39
|
Try and parse a string into the url parts.
|
|
32
40
|
|
|
@@ -40,7 +48,7 @@ The url to parse.
|
|
|
40
48
|
|
|
41
49
|
#### Returns
|
|
42
50
|
|
|
43
|
-
`
|
|
51
|
+
`Url` \| `undefined`
|
|
44
52
|
|
|
45
53
|
The formatted url or undefined if the value is not a url.
|
|
46
54
|
|
|
@@ -84,7 +92,7 @@ GuardError If the value does not match the assertion.
|
|
|
84
92
|
|
|
85
93
|
### validate()
|
|
86
94
|
|
|
87
|
-
> `static` **validate**(`property`, `value`, `failures`): `value is Url`
|
|
95
|
+
> `static` **validate**(`property`, `value`, `failures`, `fieldNameResource?`): `value is Url`
|
|
88
96
|
|
|
89
97
|
Validate a string as a Url.
|
|
90
98
|
|
|
@@ -108,6 +116,12 @@ The url to parse.
|
|
|
108
116
|
|
|
109
117
|
The list of failures to add to.
|
|
110
118
|
|
|
119
|
+
##### fieldNameResource?
|
|
120
|
+
|
|
121
|
+
`string`
|
|
122
|
+
|
|
123
|
+
The optional human readable name for the field as an i18 resource.
|
|
124
|
+
|
|
111
125
|
#### Returns
|
|
112
126
|
|
|
113
127
|
`value is Url`
|
|
@@ -28,6 +28,14 @@ The specific part of the namespace.
|
|
|
28
28
|
|
|
29
29
|
`Urn`
|
|
30
30
|
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
### CLASS\_NAME
|
|
34
|
+
|
|
35
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
36
|
+
|
|
37
|
+
Runtime name for the class.
|
|
38
|
+
|
|
31
39
|
## Methods
|
|
32
40
|
|
|
33
41
|
### generateRandom()
|
|
@@ -82,7 +90,7 @@ True if the namespace matches.
|
|
|
82
90
|
|
|
83
91
|
### tryParseExact()
|
|
84
92
|
|
|
85
|
-
> `static` **tryParseExact**(`urn`): `
|
|
93
|
+
> `static` **tryParseExact**(`urn`): `Urn` \| `undefined`
|
|
86
94
|
|
|
87
95
|
Try and parse a string into the urn parts.
|
|
88
96
|
|
|
@@ -96,7 +104,7 @@ The urn to parse.
|
|
|
96
104
|
|
|
97
105
|
#### Returns
|
|
98
106
|
|
|
99
|
-
`
|
|
107
|
+
`Urn` \| `undefined`
|
|
100
108
|
|
|
101
109
|
The formatted urn or undefined if the value is not a urn.
|
|
102
110
|
|
|
@@ -126,7 +134,7 @@ The formatted urn.
|
|
|
126
134
|
|
|
127
135
|
### addPrefix()
|
|
128
136
|
|
|
129
|
-
> `static` **addPrefix**(`urn`): `
|
|
137
|
+
> `static` **addPrefix**(`urn`): `string` \| `undefined`
|
|
130
138
|
|
|
131
139
|
Add a urn: prefix if there isn't one already.
|
|
132
140
|
|
|
@@ -140,7 +148,7 @@ The urn string to add a prefix to.
|
|
|
140
148
|
|
|
141
149
|
#### Returns
|
|
142
150
|
|
|
143
|
-
`
|
|
151
|
+
`string` \| `undefined`
|
|
144
152
|
|
|
145
153
|
The urn with a prefix.
|
|
146
154
|
|
|
@@ -184,7 +192,7 @@ GuardError If the value does not match the assertion.
|
|
|
184
192
|
|
|
185
193
|
### validate()
|
|
186
194
|
|
|
187
|
-
> `static` **validate**(`property`, `value`, `failures`): `value is string`
|
|
195
|
+
> `static` **validate**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
188
196
|
|
|
189
197
|
Validate a string as a Urn.
|
|
190
198
|
|
|
@@ -208,6 +216,12 @@ The urn to parse.
|
|
|
208
216
|
|
|
209
217
|
The list of failures to add to.
|
|
210
218
|
|
|
219
|
+
##### fieldNameResource?
|
|
220
|
+
|
|
221
|
+
`string`
|
|
222
|
+
|
|
223
|
+
The optional human readable name for the field as an i18 resource.
|
|
224
|
+
|
|
211
225
|
#### Returns
|
|
212
226
|
|
|
213
227
|
`value is string`
|
|
@@ -16,7 +16,7 @@ Class to handle validation operations.
|
|
|
16
16
|
|
|
17
17
|
### empty()
|
|
18
18
|
|
|
19
|
-
> `static` **empty**(`property`, `value`, `failures`, `fieldNameResource?`): value is
|
|
19
|
+
> `static` **empty**(`property`, `value`, `failures`, `fieldNameResource?`): value is null \| undefined
|
|
20
20
|
|
|
21
21
|
Is the property null or undefined.
|
|
22
22
|
|
|
@@ -48,7 +48,7 @@ Optional i18n resource of the field name to display in the message.
|
|
|
48
48
|
|
|
49
49
|
#### Returns
|
|
50
50
|
|
|
51
|
-
value is
|
|
51
|
+
value is null \| undefined
|
|
52
52
|
|
|
53
53
|
True if the value is a empty.
|
|
54
54
|
|
|
@@ -146,7 +146,7 @@ The list of all internal errors.
|
|
|
146
146
|
|
|
147
147
|
### expand()
|
|
148
148
|
|
|
149
|
-
> `static` **expand**(`errors`):
|
|
149
|
+
> `static` **expand**(`errors`): [`IError`](../interfaces/IError.md) \| `undefined`
|
|
150
150
|
|
|
151
151
|
Expand an error tree.
|
|
152
152
|
|
|
@@ -156,11 +156,11 @@ Expand an error tree.
|
|
|
156
156
|
|
|
157
157
|
The list of errors to expand.
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
[`IError`](../interfaces/IError.md)[] | `undefined`
|
|
160
160
|
|
|
161
161
|
#### Returns
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
[`IError`](../interfaces/IError.md) \| `undefined`
|
|
164
164
|
|
|
165
165
|
The first level error.
|
|
166
166
|
|
package/docs/reference/index.md
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- [FilenameHelper](classes/FilenameHelper.md)
|
|
25
25
|
- [HexHelper](classes/HexHelper.md)
|
|
26
26
|
- [JsonHelper](classes/JsonHelper.md)
|
|
27
|
+
- [NumberHelper](classes/NumberHelper.md)
|
|
27
28
|
- [ObjectHelper](classes/ObjectHelper.md)
|
|
28
29
|
- [RandomHelper](classes/RandomHelper.md)
|
|
29
30
|
- [StringHelper](classes/StringHelper.md)
|
|
@@ -2,29 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Interface describing a component which can be bootstrapped, started and stopped.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Methods
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### className()
|
|
8
8
|
|
|
9
|
-
>
|
|
9
|
+
> **className**(): `string`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Returns the class name of the component.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
#### Returns
|
|
14
|
+
|
|
15
|
+
`string`
|
|
16
|
+
|
|
17
|
+
The class name of the component.
|
|
18
|
+
|
|
19
|
+
***
|
|
14
20
|
|
|
15
21
|
### bootstrap()?
|
|
16
22
|
|
|
17
|
-
> `optional` **bootstrap**(`nodeLoggingComponentType
|
|
23
|
+
> `optional` **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
18
24
|
|
|
19
25
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
20
26
|
|
|
21
27
|
#### Parameters
|
|
22
28
|
|
|
23
|
-
##### nodeLoggingComponentType
|
|
29
|
+
##### nodeLoggingComponentType?
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
`string`
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
The node logging component type.
|
|
28
34
|
|
|
29
35
|
#### Returns
|
|
30
36
|
|
|
@@ -36,24 +42,18 @@ True if the bootstrapping process was successful.
|
|
|
36
42
|
|
|
37
43
|
### start()?
|
|
38
44
|
|
|
39
|
-
> `optional` **start**(`
|
|
45
|
+
> `optional` **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
40
46
|
|
|
41
47
|
The component needs to be started when the node is initialized.
|
|
42
48
|
|
|
43
49
|
#### Parameters
|
|
44
50
|
|
|
45
|
-
#####
|
|
51
|
+
##### nodeLoggingComponentType?
|
|
46
52
|
|
|
47
53
|
`string`
|
|
48
54
|
|
|
49
|
-
The identity of the node starting the component.
|
|
50
|
-
|
|
51
|
-
##### nodeLoggingComponentType
|
|
52
|
-
|
|
53
55
|
The node logging component type.
|
|
54
56
|
|
|
55
|
-
`undefined` | `string`
|
|
56
|
-
|
|
57
57
|
#### Returns
|
|
58
58
|
|
|
59
59
|
`Promise`\<`void`\>
|
|
@@ -64,24 +64,18 @@ Nothing.
|
|
|
64
64
|
|
|
65
65
|
### stop()?
|
|
66
66
|
|
|
67
|
-
> `optional` **stop**(`
|
|
67
|
+
> `optional` **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
68
68
|
|
|
69
69
|
The component needs to be stopped when the node is closed.
|
|
70
70
|
|
|
71
71
|
#### Parameters
|
|
72
72
|
|
|
73
|
-
#####
|
|
73
|
+
##### nodeLoggingComponentType?
|
|
74
74
|
|
|
75
75
|
`string`
|
|
76
76
|
|
|
77
|
-
The identity of the node stopping the component.
|
|
78
|
-
|
|
79
|
-
##### nodeLoggingComponentType
|
|
80
|
-
|
|
81
77
|
The node logging component type.
|
|
82
78
|
|
|
83
|
-
`undefined` | `string`
|
|
84
|
-
|
|
85
79
|
#### Returns
|
|
86
80
|
|
|
87
81
|
`Promise`\<`void`\>
|
|
@@ -20,14 +20,6 @@ The reason the validation failed as an i18 resource error.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### fieldName?
|
|
24
|
-
|
|
25
|
-
> `optional` **fieldName**: `string`
|
|
26
|
-
|
|
27
|
-
The optional human readable name for the field as an i18 resource.
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
23
|
### properties?
|
|
32
24
|
|
|
33
25
|
> `optional` **properties**: `object`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
^errorNames.*$
|
package/locales/en.json
CHANGED
|
@@ -38,9 +38,7 @@
|
|
|
38
38
|
"beUrn": "{fieldName} must be a correctly formatted urn",
|
|
39
39
|
"beUrl": "{fieldName} must be a correctly formatted url",
|
|
40
40
|
"beJSON": "{fieldName} must be correctly formatted JSON",
|
|
41
|
-
"beEmail": "{fieldName} must be a correctly formatted e-mail address"
|
|
42
|
-
"failed": "Validation failed",
|
|
43
|
-
"failedObject": "Validation of \"{objectName}\" failed"
|
|
41
|
+
"beEmail": "{fieldName} must be a correctly formatted e-mail address"
|
|
44
42
|
},
|
|
45
43
|
"guard": {
|
|
46
44
|
"undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
|
|
@@ -87,7 +85,7 @@
|
|
|
87
85
|
"noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
|
|
88
86
|
},
|
|
89
87
|
"bitString": {
|
|
90
|
-
"outOfRange": "The index should be >= 0 and less than the length of the bit string"
|
|
88
|
+
"outOfRange": "The index should be >= 0 and less than the length of the bit string, the index is \"{index}\" and the number of bit is \"{numberBits}\""
|
|
91
89
|
},
|
|
92
90
|
"base32": {
|
|
93
91
|
"invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
|
|
@@ -112,7 +110,8 @@
|
|
|
112
110
|
"alreadyExistsError": "Already Exists",
|
|
113
111
|
"notImplementedError": "Not Implemented",
|
|
114
112
|
"validationError": "Validation",
|
|
115
|
-
"unprocessableError": "Unprocessable"
|
|
113
|
+
"unprocessableError": "Unprocessable",
|
|
114
|
+
"unauthorizedError": "Unauthorized"
|
|
116
115
|
},
|
|
117
116
|
"validation": {
|
|
118
117
|
"defaultFieldName": "The field"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.2",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,26 +14,38 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/nameof": "0.0.
|
|
18
|
-
"intl-messageformat": "10.7.
|
|
17
|
+
"@twin.org/nameof": "0.0.3-next.2",
|
|
18
|
+
"intl-messageformat": "10.7.18",
|
|
19
19
|
"rfc6902": "5.1.2"
|
|
20
20
|
},
|
|
21
|
-
"main": "./dist/
|
|
22
|
-
"module": "./dist/esm/index.mjs",
|
|
21
|
+
"main": "./dist/es/index.js",
|
|
23
22
|
"types": "./dist/types/index.d.ts",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
25
|
"types": "./dist/types/index.d.ts",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"import": "./dist/es/index.js",
|
|
27
|
+
"default": "./dist/es/index.js"
|
|
29
28
|
},
|
|
30
29
|
"./locales/*.json": "./locales/*.json"
|
|
31
30
|
},
|
|
32
31
|
"files": [
|
|
33
|
-
"dist/
|
|
34
|
-
"dist/esm",
|
|
32
|
+
"dist/es",
|
|
35
33
|
"dist/types",
|
|
36
34
|
"locales",
|
|
37
35
|
"docs"
|
|
38
|
-
]
|
|
36
|
+
],
|
|
37
|
+
"keywords": [
|
|
38
|
+
"twin",
|
|
39
|
+
"trade",
|
|
40
|
+
"iota",
|
|
41
|
+
"framework",
|
|
42
|
+
"blockchain",
|
|
43
|
+
"core",
|
|
44
|
+
"foundation",
|
|
45
|
+
"utilities"
|
|
46
|
+
],
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "git+https://github.com/twinfoundation/framework/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://twindev.org"
|
|
39
51
|
}
|