@twin.org/core 0.9.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 +243 -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
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Class: LruCache\<T\>
|
|
2
|
+
|
|
3
|
+
A fixed-capacity LRU cache with time-to-idle eviction.
|
|
4
|
+
|
|
5
|
+
Entries are removed in two ways:
|
|
6
|
+
- Capacity eviction: when the cache is full the least-recently-used entry is removed first.
|
|
7
|
+
- TTI eviction: a background timer sweeps idle entries every ttiMs milliseconds.
|
|
8
|
+
The timer only runs while there are entries; it stops automatically when the cache empties.
|
|
9
|
+
|
|
10
|
+
`get` and `set` both update an entry's LRU position and reset its idle timer.
|
|
11
|
+
`has` is a pure peek it evicts idle entries but does not refresh a live entry's TTI.
|
|
12
|
+
Call `destroy` when the cache is no longer needed to stop the background timer.
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
### T
|
|
17
|
+
|
|
18
|
+
`T` = `unknown`
|
|
19
|
+
|
|
20
|
+
## Constructors
|
|
21
|
+
|
|
22
|
+
### Constructor
|
|
23
|
+
|
|
24
|
+
> **new LruCache**\<`T`\>(`options?`): `LruCache`\<`T`\>
|
|
25
|
+
|
|
26
|
+
Create a new instance of LruCache.
|
|
27
|
+
|
|
28
|
+
#### Parameters
|
|
29
|
+
|
|
30
|
+
##### options?
|
|
31
|
+
|
|
32
|
+
The cache options.
|
|
33
|
+
|
|
34
|
+
###### capacity?
|
|
35
|
+
|
|
36
|
+
`number`
|
|
37
|
+
|
|
38
|
+
Maximum number of entries. Defaults to 1000. Must be a positive integer.
|
|
39
|
+
|
|
40
|
+
###### ttiMs?
|
|
41
|
+
|
|
42
|
+
`number`
|
|
43
|
+
|
|
44
|
+
Time-to-idle in milliseconds. Defaults to 10000. Must be a positive integer.
|
|
45
|
+
|
|
46
|
+
###### mutexTimeoutMs?
|
|
47
|
+
|
|
48
|
+
`number`
|
|
49
|
+
|
|
50
|
+
Maximum time in milliseconds to wait for getOrSet mutex acquisition.
|
|
51
|
+
|
|
52
|
+
#### Returns
|
|
53
|
+
|
|
54
|
+
`LruCache`\<`T`\>
|
|
55
|
+
|
|
56
|
+
#### Throws
|
|
57
|
+
|
|
58
|
+
ValidationError if capacity or ttiMs is not a positive integer.
|
|
59
|
+
|
|
60
|
+
## Properties
|
|
61
|
+
|
|
62
|
+
### CLASS\_NAME {#class_name}
|
|
63
|
+
|
|
64
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
65
|
+
|
|
66
|
+
Runtime name for the class.
|
|
67
|
+
|
|
68
|
+
***
|
|
69
|
+
|
|
70
|
+
### DEFAULT\_CAPACITY {#default_capacity}
|
|
71
|
+
|
|
72
|
+
> `readonly` `static` **DEFAULT\_CAPACITY**: `1000` = `1000`
|
|
73
|
+
|
|
74
|
+
Default capacity.
|
|
75
|
+
|
|
76
|
+
***
|
|
77
|
+
|
|
78
|
+
### DEFAULT\_TTI\_MS {#default_tti_ms}
|
|
79
|
+
|
|
80
|
+
> `readonly` `static` **DEFAULT\_TTI\_MS**: `10000` = `10000`
|
|
81
|
+
|
|
82
|
+
Default time-to-idle in milliseconds.
|
|
83
|
+
|
|
84
|
+
## Methods
|
|
85
|
+
|
|
86
|
+
### count() {#count}
|
|
87
|
+
|
|
88
|
+
> **count**(): `number`
|
|
89
|
+
|
|
90
|
+
The number of entries currently held in the cache.
|
|
91
|
+
|
|
92
|
+
#### Returns
|
|
93
|
+
|
|
94
|
+
`number`
|
|
95
|
+
|
|
96
|
+
The number of entries in the cache.
|
|
97
|
+
|
|
98
|
+
***
|
|
99
|
+
|
|
100
|
+
### get() {#get}
|
|
101
|
+
|
|
102
|
+
> **get**(`key`): `T` \| `undefined`
|
|
103
|
+
|
|
104
|
+
Get a value from the cache.
|
|
105
|
+
Returns undefined if the key is absent or the entry has idled out.
|
|
106
|
+
A successful hit resets the entry's idle timer and moves it to most-recently-used.
|
|
107
|
+
|
|
108
|
+
#### Parameters
|
|
109
|
+
|
|
110
|
+
##### key
|
|
111
|
+
|
|
112
|
+
`string`
|
|
113
|
+
|
|
114
|
+
The key to retrieve.
|
|
115
|
+
|
|
116
|
+
#### Returns
|
|
117
|
+
|
|
118
|
+
`T` \| `undefined`
|
|
119
|
+
|
|
120
|
+
The cached value, or undefined on a miss or idle eviction.
|
|
121
|
+
|
|
122
|
+
***
|
|
123
|
+
|
|
124
|
+
### set() {#set}
|
|
125
|
+
|
|
126
|
+
> **set**(`key`, `value`): `void`
|
|
127
|
+
|
|
128
|
+
Store a value in the cache.
|
|
129
|
+
If the key already exists its value and idle timer are refreshed.
|
|
130
|
+
When the cache is at capacity, idle entries are swept first; if it is still full the
|
|
131
|
+
least-recently-used entry is evicted.
|
|
132
|
+
|
|
133
|
+
#### Parameters
|
|
134
|
+
|
|
135
|
+
##### key
|
|
136
|
+
|
|
137
|
+
`string`
|
|
138
|
+
|
|
139
|
+
The key to store.
|
|
140
|
+
|
|
141
|
+
##### value
|
|
142
|
+
|
|
143
|
+
`T`
|
|
144
|
+
|
|
145
|
+
The value to cache.
|
|
146
|
+
|
|
147
|
+
#### Returns
|
|
148
|
+
|
|
149
|
+
`void`
|
|
150
|
+
|
|
151
|
+
***
|
|
152
|
+
|
|
153
|
+
### getOrSet() {#getorset}
|
|
154
|
+
|
|
155
|
+
> **getOrSet**(`key`, `valueFactory`): `Promise`\<`T`\>
|
|
156
|
+
|
|
157
|
+
Atomically get an existing value or create and store it once using an async factory.
|
|
158
|
+
Concurrent calls for the same key are serialized via a mutex.
|
|
159
|
+
|
|
160
|
+
#### Parameters
|
|
161
|
+
|
|
162
|
+
##### key
|
|
163
|
+
|
|
164
|
+
`string`
|
|
165
|
+
|
|
166
|
+
The key to get or create.
|
|
167
|
+
|
|
168
|
+
##### valueFactory
|
|
169
|
+
|
|
170
|
+
() => `Promise`\<`T`\>
|
|
171
|
+
|
|
172
|
+
Async callback used to build a value when the key is absent.
|
|
173
|
+
|
|
174
|
+
#### Returns
|
|
175
|
+
|
|
176
|
+
`Promise`\<`T`\>
|
|
177
|
+
|
|
178
|
+
The existing or newly created value.
|
|
179
|
+
|
|
180
|
+
***
|
|
181
|
+
|
|
182
|
+
### has() {#has}
|
|
183
|
+
|
|
184
|
+
> **has**(`key`): `boolean`
|
|
185
|
+
|
|
186
|
+
Check whether a key exists in the cache and has not idled out.
|
|
187
|
+
Idle entries are evicted on peek, but a live entry's TTI is not reset.
|
|
188
|
+
|
|
189
|
+
#### Parameters
|
|
190
|
+
|
|
191
|
+
##### key
|
|
192
|
+
|
|
193
|
+
`string`
|
|
194
|
+
|
|
195
|
+
The key to test.
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
|
|
199
|
+
`boolean`
|
|
200
|
+
|
|
201
|
+
True if the key is present and not idle.
|
|
202
|
+
|
|
203
|
+
***
|
|
204
|
+
|
|
205
|
+
### keys() {#keys}
|
|
206
|
+
|
|
207
|
+
> **keys**(): `string`[]
|
|
208
|
+
|
|
209
|
+
Return all keys for entries that have not idled out.
|
|
210
|
+
Idle entries encountered during iteration are evicted.
|
|
211
|
+
|
|
212
|
+
#### Returns
|
|
213
|
+
|
|
214
|
+
`string`[]
|
|
215
|
+
|
|
216
|
+
An array of live keys in least-recently-used to most-recently-used order.
|
|
217
|
+
|
|
218
|
+
***
|
|
219
|
+
|
|
220
|
+
### delete() {#delete}
|
|
221
|
+
|
|
222
|
+
> **delete**(`key`): `void`
|
|
223
|
+
|
|
224
|
+
Remove an entry from the cache.
|
|
225
|
+
Cancels the background timer if the cache becomes empty.
|
|
226
|
+
|
|
227
|
+
#### Parameters
|
|
228
|
+
|
|
229
|
+
##### key
|
|
230
|
+
|
|
231
|
+
`string`
|
|
232
|
+
|
|
233
|
+
The key to remove.
|
|
234
|
+
|
|
235
|
+
#### Returns
|
|
236
|
+
|
|
237
|
+
`void`
|
|
238
|
+
|
|
239
|
+
***
|
|
240
|
+
|
|
241
|
+
### clear() {#clear}
|
|
242
|
+
|
|
243
|
+
> **clear**(): `void`
|
|
244
|
+
|
|
245
|
+
Remove all entries from the cache and cancel the background timer.
|
|
246
|
+
|
|
247
|
+
#### Returns
|
|
248
|
+
|
|
249
|
+
`void`
|
|
250
|
+
|
|
251
|
+
***
|
|
252
|
+
|
|
253
|
+
### destroy() {#destroy}
|
|
254
|
+
|
|
255
|
+
> **destroy**(): `void`
|
|
256
|
+
|
|
257
|
+
Stop the background idle-sweep timer and release all entries.
|
|
258
|
+
The cache must not be used after this call.
|
|
259
|
+
|
|
260
|
+
#### Returns
|
|
261
|
+
|
|
262
|
+
`void`
|
|
@@ -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.
|
|
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": "
|
|
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.
|