@twin.org/core 0.9.2-next.1 → 0.9.2-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/helpers/objectHelper.js +17 -10
- package/dist/es/helpers/objectHelper.js.map +1 -1
- package/dist/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IComponent.js +2 -0
- package/dist/es/models/IComponent.js.map +1 -1
- package/dist/es/utils/coerce.js +7 -5
- package/dist/es/utils/coerce.js.map +1 -1
- package/dist/es/utils/lfuCache.js +380 -0
- package/dist/es/utils/lfuCache.js.map +1 -0
- package/dist/es/utils/lruCache.js +271 -0
- package/dist/es/utils/lruCache.js.map +1 -0
- package/dist/types/helpers/objectHelper.d.ts +6 -6
- package/dist/types/index.d.ts +2 -2
- package/dist/types/models/IComponent.d.ts +0 -6
- package/dist/types/utils/lfuCache.d.ts +100 -0
- package/dist/types/utils/lruCache.d.ts +97 -0
- package/docs/changelog.md +155 -0
- package/docs/reference/classes/LfuCache.md +265 -0
- package/docs/reference/classes/LruCache.md +262 -0
- package/docs/reference/classes/ObjectHelper.md +6 -6
- package/docs/reference/index.md +2 -3
- package/docs/reference/interfaces/IComponent.md +0 -14
- package/package.json +4 -4
- package/dist/es/models/IHealth.js +0 -2
- package/dist/es/models/IHealth.js.map +0 -1
- package/dist/es/models/healthStatus.js +0 -21
- package/dist/es/models/healthStatus.js.map +0 -1
- package/dist/types/models/IHealth.d.ts +0 -32
- package/dist/types/models/healthStatus.d.ts +0 -21
- package/docs/reference/interfaces/IHealth.md +0 -55
- package/docs/reference/type-aliases/HealthStatus.md +0 -5
- package/docs/reference/variables/HealthStatus.md +0 -25
|
@@ -196,7 +196,7 @@ True is the objects are equal.
|
|
|
196
196
|
|
|
197
197
|
### propertyGet() {#propertyget}
|
|
198
198
|
|
|
199
|
-
> `static` **propertyGet**\<`T`\>(`
|
|
199
|
+
> `static` **propertyGet**\<`T`\>(`object`, `property`): `T` \| `undefined`
|
|
200
200
|
|
|
201
201
|
Get the property of an unknown object.
|
|
202
202
|
|
|
@@ -208,7 +208,7 @@ Get the property of an unknown object.
|
|
|
208
208
|
|
|
209
209
|
#### Parameters
|
|
210
210
|
|
|
211
|
-
#####
|
|
211
|
+
##### object
|
|
212
212
|
|
|
213
213
|
`unknown`
|
|
214
214
|
|
|
@@ -230,13 +230,13 @@ The property.
|
|
|
230
230
|
|
|
231
231
|
### propertySet() {#propertyset}
|
|
232
232
|
|
|
233
|
-
> `static` **propertySet**(`
|
|
233
|
+
> `static` **propertySet**(`object`, `property`, `value`): `void`
|
|
234
234
|
|
|
235
235
|
Set the property of an unknown object.
|
|
236
236
|
|
|
237
237
|
#### Parameters
|
|
238
238
|
|
|
239
|
-
#####
|
|
239
|
+
##### object
|
|
240
240
|
|
|
241
241
|
`unknown`
|
|
242
242
|
|
|
@@ -266,13 +266,13 @@ GeneralError if the property target is not an object.
|
|
|
266
266
|
|
|
267
267
|
### propertyDelete() {#propertydelete}
|
|
268
268
|
|
|
269
|
-
> `static` **propertyDelete**(`
|
|
269
|
+
> `static` **propertyDelete**(`object`, `property`): `void`
|
|
270
270
|
|
|
271
271
|
Delete the property of an unknown object.
|
|
272
272
|
|
|
273
273
|
#### Parameters
|
|
274
274
|
|
|
275
|
-
#####
|
|
275
|
+
##### object
|
|
276
276
|
|
|
277
277
|
`unknown`
|
|
278
278
|
|
package/docs/reference/index.md
CHANGED
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
- [Guards](classes/Guards.md)
|
|
41
41
|
- [I18n](classes/I18n.md)
|
|
42
42
|
- [Is](classes/Is.md)
|
|
43
|
+
- [LfuCache](classes/LfuCache.md)
|
|
44
|
+
- [LruCache](classes/LruCache.md)
|
|
43
45
|
- [Mutex](classes/Mutex.md)
|
|
44
46
|
- [SharedObjectBuffer](classes/SharedObjectBuffer.md)
|
|
45
47
|
- [SharedStore](classes/SharedStore.md)
|
|
@@ -50,7 +52,6 @@
|
|
|
50
52
|
- [IComponent](interfaces/IComponent.md)
|
|
51
53
|
- [IDuration](interfaces/IDuration.md)
|
|
52
54
|
- [IError](interfaces/IError.md)
|
|
53
|
-
- [IHealth](interfaces/IHealth.md)
|
|
54
55
|
- [II18nShared](interfaces/II18nShared.md)
|
|
55
56
|
- [IKeyValue](interfaces/IKeyValue.md)
|
|
56
57
|
- [ILabelledValue](interfaces/ILabelledValue.md)
|
|
@@ -68,7 +69,6 @@
|
|
|
68
69
|
|
|
69
70
|
- [CoerceType](type-aliases/CoerceType.md)
|
|
70
71
|
- [CompressionType](type-aliases/CompressionType.md)
|
|
71
|
-
- [HealthStatus](type-aliases/HealthStatus.md)
|
|
72
72
|
- [MutexMessageTypes](type-aliases/MutexMessageTypes.md)
|
|
73
73
|
- [SharedObjectBufferMessageTypes](type-aliases/SharedObjectBufferMessageTypes.md)
|
|
74
74
|
- [ObjectOrArray](type-aliases/ObjectOrArray.md)
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
- [ComponentFactory](variables/ComponentFactory.md)
|
|
81
81
|
- [CoerceType](variables/CoerceType.md)
|
|
82
82
|
- [CompressionType](variables/CompressionType.md)
|
|
83
|
-
- [HealthStatus](variables/HealthStatus.md)
|
|
84
83
|
- [MutexMessageTypes](variables/MutexMessageTypes.md)
|
|
85
84
|
- [SharedObjectBufferMessageTypes](variables/SharedObjectBufferMessageTypes.md)
|
|
86
85
|
- [DURATION\_REG\_EXP](variables/DURATION_REG_EXP.md)
|
|
@@ -103,17 +103,3 @@ The node logging component type.
|
|
|
103
103
|
`Promise`\<`void`\>
|
|
104
104
|
|
|
105
105
|
A promise that resolves when the component has stopped.
|
|
106
|
-
|
|
107
|
-
***
|
|
108
|
-
|
|
109
|
-
### health()? {#health}
|
|
110
|
-
|
|
111
|
-
> `optional` **health**(): `Promise`\<[`IHealth`](IHealth.md)[]\>
|
|
112
|
-
|
|
113
|
-
Returns the health status of the component.
|
|
114
|
-
|
|
115
|
-
#### Returns
|
|
116
|
-
|
|
117
|
-
`Promise`\<[`IHealth`](IHealth.md)[]\>
|
|
118
|
-
|
|
119
|
-
The health status of the component, can return multiple entries for elements within the component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.9.2-next.
|
|
3
|
+
"version": "0.9.2-next.10",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/nameof": "0.9.2-next.
|
|
18
|
-
"intl-messageformat": "11.2.
|
|
19
|
-
"rfc6902": "5.
|
|
17
|
+
"@twin.org/nameof": "0.9.2-next.10",
|
|
18
|
+
"intl-messageformat": "11.2.13",
|
|
19
|
+
"rfc6902": "5.3.0"
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/es/index.js",
|
|
22
22
|
"types": "./dist/types/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IHealth.js","sourceRoot":"","sources":["../../../src/models/IHealth.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HealthStatus } from \"./healthStatus.js\";\n\n/**\n * Provides health information for a component.\n */\nexport interface IHealth {\n\t/**\n\t * The source of the health information.\n\t */\n\tsource: string;\n\n\t/**\n\t * The description of the component as an i18n key.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * The overall status of the component, the entries can also report their own health.\n\t */\n\tstatus: HealthStatus;\n\n\t/**\n\t * The message for the status if there are further details to provide as an i18n key.\n\t */\n\tmessage?: string;\n\n\t/**\n\t * Data to substitute in the i18n key for the message.\n\t */\n\tdata?: { [id: string]: unknown };\n\n\t/**\n\t * The grouped child components, if any.\n\t */\n\tgrouped?: IHealth[];\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
/**
|
|
4
|
-
* The health status of the component.
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
-
export const HealthStatus = {
|
|
8
|
-
/**
|
|
9
|
-
* OK.
|
|
10
|
-
*/
|
|
11
|
-
Ok: "ok",
|
|
12
|
-
/**
|
|
13
|
-
* Warning.
|
|
14
|
-
*/
|
|
15
|
-
Warning: "warning",
|
|
16
|
-
/**
|
|
17
|
-
* Error.
|
|
18
|
-
*/
|
|
19
|
-
Error: "error"
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=healthStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healthStatus.js","sourceRoot":"","sources":["../../../src/models/healthStatus.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B;;OAEG;IACH,EAAE,EAAE,IAAI;IAER;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,KAAK,EAAE,OAAO;CACL,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The health status of the component.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const HealthStatus = {\n\t/**\n\t * OK.\n\t */\n\tOk: \"ok\",\n\n\t/**\n\t * Warning.\n\t */\n\tWarning: \"warning\",\n\n\t/**\n\t * Error.\n\t */\n\tError: \"error\"\n} as const;\n\n/**\n * The health status of the component.\n */\nexport type HealthStatus = (typeof HealthStatus)[keyof typeof HealthStatus];\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { HealthStatus } from "./healthStatus.js";
|
|
2
|
-
/**
|
|
3
|
-
* Provides health information for a component.
|
|
4
|
-
*/
|
|
5
|
-
export interface IHealth {
|
|
6
|
-
/**
|
|
7
|
-
* The source of the health information.
|
|
8
|
-
*/
|
|
9
|
-
source: string;
|
|
10
|
-
/**
|
|
11
|
-
* The description of the component as an i18n key.
|
|
12
|
-
*/
|
|
13
|
-
description?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The overall status of the component, the entries can also report their own health.
|
|
16
|
-
*/
|
|
17
|
-
status: HealthStatus;
|
|
18
|
-
/**
|
|
19
|
-
* The message for the status if there are further details to provide as an i18n key.
|
|
20
|
-
*/
|
|
21
|
-
message?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Data to substitute in the i18n key for the message.
|
|
24
|
-
*/
|
|
25
|
-
data?: {
|
|
26
|
-
[id: string]: unknown;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The grouped child components, if any.
|
|
30
|
-
*/
|
|
31
|
-
grouped?: IHealth[];
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The health status of the component.
|
|
3
|
-
*/
|
|
4
|
-
export declare const HealthStatus: {
|
|
5
|
-
/**
|
|
6
|
-
* OK.
|
|
7
|
-
*/
|
|
8
|
-
readonly Ok: "ok";
|
|
9
|
-
/**
|
|
10
|
-
* Warning.
|
|
11
|
-
*/
|
|
12
|
-
readonly Warning: "warning";
|
|
13
|
-
/**
|
|
14
|
-
* Error.
|
|
15
|
-
*/
|
|
16
|
-
readonly Error: "error";
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The health status of the component.
|
|
20
|
-
*/
|
|
21
|
-
export type HealthStatus = (typeof HealthStatus)[keyof typeof HealthStatus];
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Interface: IHealth
|
|
2
|
-
|
|
3
|
-
Provides health information for a component.
|
|
4
|
-
|
|
5
|
-
## Properties
|
|
6
|
-
|
|
7
|
-
### source {#source}
|
|
8
|
-
|
|
9
|
-
> **source**: `string`
|
|
10
|
-
|
|
11
|
-
The source of the health information.
|
|
12
|
-
|
|
13
|
-
***
|
|
14
|
-
|
|
15
|
-
### description? {#description}
|
|
16
|
-
|
|
17
|
-
> `optional` **description?**: `string`
|
|
18
|
-
|
|
19
|
-
The description of the component as an i18n key.
|
|
20
|
-
|
|
21
|
-
***
|
|
22
|
-
|
|
23
|
-
### status {#status}
|
|
24
|
-
|
|
25
|
-
> **status**: [`HealthStatus`](../type-aliases/HealthStatus.md)
|
|
26
|
-
|
|
27
|
-
The overall status of the component, the entries can also report their own health.
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### message? {#message}
|
|
32
|
-
|
|
33
|
-
> `optional` **message?**: `string`
|
|
34
|
-
|
|
35
|
-
The message for the status if there are further details to provide as an i18n key.
|
|
36
|
-
|
|
37
|
-
***
|
|
38
|
-
|
|
39
|
-
### data? {#data}
|
|
40
|
-
|
|
41
|
-
> `optional` **data?**: `object`
|
|
42
|
-
|
|
43
|
-
Data to substitute in the i18n key for the message.
|
|
44
|
-
|
|
45
|
-
#### Index Signature
|
|
46
|
-
|
|
47
|
-
\[`id`: `string`\]: `unknown`
|
|
48
|
-
|
|
49
|
-
***
|
|
50
|
-
|
|
51
|
-
### grouped? {#grouped}
|
|
52
|
-
|
|
53
|
-
> `optional` **grouped?**: `IHealth`[]
|
|
54
|
-
|
|
55
|
-
The grouped child components, if any.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Variable: HealthStatus
|
|
2
|
-
|
|
3
|
-
> `const` **HealthStatus**: `object`
|
|
4
|
-
|
|
5
|
-
The health status of the component.
|
|
6
|
-
|
|
7
|
-
## Type Declaration
|
|
8
|
-
|
|
9
|
-
### Ok {#ok}
|
|
10
|
-
|
|
11
|
-
> `readonly` **Ok**: `"ok"` = `"ok"`
|
|
12
|
-
|
|
13
|
-
OK.
|
|
14
|
-
|
|
15
|
-
### Warning {#warning}
|
|
16
|
-
|
|
17
|
-
> `readonly` **Warning**: `"warning"` = `"warning"`
|
|
18
|
-
|
|
19
|
-
Warning.
|
|
20
|
-
|
|
21
|
-
### Error {#error}
|
|
22
|
-
|
|
23
|
-
> `readonly` **Error**: `"error"` = `"error"`
|
|
24
|
-
|
|
25
|
-
Error.
|