@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
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,248 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.2-next.10](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.9...core-v0.9.2-next.10) (2026-08-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add lru and lft cache ([#449](https://github.com/iotaledger/twin-framework/issues/449)) ([67d741e](https://github.com/iotaledger/twin-framework/commit/67d741eab3b89556e3c55053b5a473a4c1592fed))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/nameof bumped from 0.9.2-next.9 to 0.9.2-next.10
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.9 to 0.9.2-next.10
|
|
18
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.9 to 0.9.2-next.10
|
|
19
|
+
|
|
20
|
+
## [0.9.2-next.9](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.8...core-v0.9.2-next.9) (2026-08-10)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* number coercion wrongly accepts alpha ([c04c1af](https://github.com/iotaledger/twin-framework/commit/c04c1af24697b6c92a180a71c0722c5673313360))
|
|
26
|
+
* number coercion wrongly accepts alpha ([dd5b193](https://github.com/iotaledger/twin-framework/commit/dd5b193c2501f6d30ca94aa0fc30a6edfe405e6f))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* The following workspace dependencies were updated
|
|
32
|
+
* dependencies
|
|
33
|
+
* @twin.org/nameof bumped from 0.9.2-next.8 to 0.9.2-next.9
|
|
34
|
+
* devDependencies
|
|
35
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.8 to 0.9.2-next.9
|
|
36
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.8 to 0.9.2-next.9
|
|
37
|
+
|
|
38
|
+
## [0.9.2-next.8](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.7...core-v0.9.2-next.8) (2026-08-10)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* optimistic locking version property for schemas ([#443](https://github.com/iotaledger/twin-framework/issues/443)) ([1b90987](https://github.com/iotaledger/twin-framework/commit/1b909875dc915a0ec133d8424d013ae7e4ddfb48))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Dependencies
|
|
47
|
+
|
|
48
|
+
* The following workspace dependencies were updated
|
|
49
|
+
* dependencies
|
|
50
|
+
* @twin.org/nameof bumped from 0.9.2-next.7 to 0.9.2-next.8
|
|
51
|
+
* devDependencies
|
|
52
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.7 to 0.9.2-next.8
|
|
53
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.7 to 0.9.2-next.8
|
|
54
|
+
|
|
55
|
+
## [0.9.2-next.7](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.6...core-v0.9.2-next.7) (2026-08-07)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Features
|
|
59
|
+
|
|
60
|
+
* linting and dependency update ([1c428ef](https://github.com/iotaledger/twin-framework/commit/1c428efe0391c52632962847d8dad68bd8e5dd00))
|
|
61
|
+
* linting and dependency update ([676b4e9](https://github.com/iotaledger/twin-framework/commit/676b4e9d9bce158065200bbf875bb31da81d166d))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Dependencies
|
|
65
|
+
|
|
66
|
+
* The following workspace dependencies were updated
|
|
67
|
+
* dependencies
|
|
68
|
+
* @twin.org/nameof bumped from 0.9.2-next.6 to 0.9.2-next.7
|
|
69
|
+
* devDependencies
|
|
70
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.6 to 0.9.2-next.7
|
|
71
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.6 to 0.9.2-next.7
|
|
72
|
+
|
|
73
|
+
## [0.9.2-next.6](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.5...core-v0.9.2-next.6) (2026-08-04)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **core:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/nameof bumped from 0.9.2-next.5 to 0.9.2-next.6
|
|
86
|
+
* devDependencies
|
|
87
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.5 to 0.9.2-next.6
|
|
88
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.5 to 0.9.2-next.6
|
|
89
|
+
|
|
90
|
+
## [0.9.2-next.5](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.4...core-v0.9.2-next.5) (2026-08-03)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Features
|
|
94
|
+
|
|
95
|
+
* move health support to api repo ([#435](https://github.com/iotaledger/twin-framework/issues/435)) ([867f766](https://github.com/iotaledger/twin-framework/commit/867f766afc86607bec6b5cf9c3ab5bd5c41d0b3c))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Dependencies
|
|
99
|
+
|
|
100
|
+
* The following workspace dependencies were updated
|
|
101
|
+
* dependencies
|
|
102
|
+
* @twin.org/nameof bumped from 0.9.2-next.4 to 0.9.2-next.5
|
|
103
|
+
* devDependencies
|
|
104
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.4 to 0.9.2-next.5
|
|
105
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.4 to 0.9.2-next.5
|
|
106
|
+
|
|
107
|
+
## [0.9.2-next.4](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.3...core-v0.9.2-next.4) (2026-07-31)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Miscellaneous Chores
|
|
111
|
+
|
|
112
|
+
* **core:** Synchronize repo versions
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### Dependencies
|
|
116
|
+
|
|
117
|
+
* The following workspace dependencies were updated
|
|
118
|
+
* dependencies
|
|
119
|
+
* @twin.org/nameof bumped from 0.9.2-next.3 to 0.9.2-next.4
|
|
120
|
+
* devDependencies
|
|
121
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.3 to 0.9.2-next.4
|
|
122
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.3 to 0.9.2-next.4
|
|
123
|
+
|
|
124
|
+
## [0.9.2-next.3](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.2...core-v0.9.2-next.3) (2026-07-30)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Bug Fixes
|
|
128
|
+
|
|
129
|
+
* coerce and includes ([#429](https://github.com/iotaledger/twin-framework/issues/429)) ([98c9132](https://github.com/iotaledger/twin-framework/commit/98c9132316c0393ede9d6e634bbae9e5ece2d6b9))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Dependencies
|
|
133
|
+
|
|
134
|
+
* The following workspace dependencies were updated
|
|
135
|
+
* dependencies
|
|
136
|
+
* @twin.org/nameof bumped from 0.9.2-next.2 to 0.9.2-next.3
|
|
137
|
+
* devDependencies
|
|
138
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.2 to 0.9.2-next.3
|
|
139
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.2 to 0.9.2-next.3
|
|
140
|
+
|
|
141
|
+
## [0.9.2-next.2](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.1...core-v0.9.2-next.2) (2026-07-29)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Miscellaneous Chores
|
|
145
|
+
|
|
146
|
+
* **core:** Synchronize repo versions
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Dependencies
|
|
150
|
+
|
|
151
|
+
* The following workspace dependencies were updated
|
|
152
|
+
* dependencies
|
|
153
|
+
* @twin.org/nameof bumped from 0.9.2-next.1 to 0.9.2-next.2
|
|
154
|
+
* devDependencies
|
|
155
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.1 to 0.9.2-next.2
|
|
156
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.1 to 0.9.2-next.2
|
|
157
|
+
|
|
158
|
+
## [0.9.2-next.1](https://github.com/iotaledger/twin-framework/compare/core-v0.9.2-next.0...core-v0.9.2-next.1) (2026-07-28)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Features
|
|
162
|
+
|
|
163
|
+
* add context id features ([#206](https://github.com/iotaledger/twin-framework/issues/206)) ([ef0d4ee](https://github.com/iotaledger/twin-framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
|
|
164
|
+
* add duration support ([#362](https://github.com/iotaledger/twin-framework/issues/362)) ([24dbe8b](https://github.com/iotaledger/twin-framework/commit/24dbe8b208eb127a52024cb219d31d27731e9ae3))
|
|
165
|
+
* add factory.createIfExists ([aad5a53](https://github.com/iotaledger/twin-framework/commit/aad5a53cef1b1c2e04344ea46244d41e371dff9b))
|
|
166
|
+
* add Factory.getFactory ([ad6cd2d](https://github.com/iotaledger/twin-framework/commit/ad6cd2d30351c145c70212f8cce1b66d5e8a5235))
|
|
167
|
+
* add guard.dateString ([#335](https://github.com/iotaledger/twin-framework/issues/335)) ([a26a166](https://github.com/iotaledger/twin-framework/commit/a26a166eb1f62ece05b2432730cb7354feacecfc))
|
|
168
|
+
* add health method to components ([a88016d](https://github.com/iotaledger/twin-framework/commit/a88016d90d172413e5bc5238dc1b3e35f82fcc2c))
|
|
169
|
+
* add Is.class method ([4988205](https://github.com/iotaledger/twin-framework/commit/498820543e256a130b4888c958fe1d87ca865d7f))
|
|
170
|
+
* add isDefault option to factory registration ([a8a700b](https://github.com/iotaledger/twin-framework/commit/a8a700bb8ddaf7dd5097869a358b8fc5f7c40ce7))
|
|
171
|
+
* add mutex ([#316](https://github.com/iotaledger/twin-framework/issues/316)) ([1027e5a](https://github.com/iotaledger/twin-framework/commit/1027e5ac77aa9804178b4253abdeefd6f1c3d521))
|
|
172
|
+
* add objectHelper.split ([386830a](https://github.com/iotaledger/twin-framework/commit/386830a77f8e842a5b119be0983708e042c3b14b))
|
|
173
|
+
* add partial second support ([39bf087](https://github.com/iotaledger/twin-framework/commit/39bf087ddc113a9bf73e0d0e99f738f6f60c2f2d))
|
|
174
|
+
* add rsa cipher support ([7af6cc6](https://github.com/iotaledger/twin-framework/commit/7af6cc67512d3363bd4a2f2e87bd7733c2800147))
|
|
175
|
+
* add single occurrence array type ([e890e43](https://github.com/iotaledger/twin-framework/commit/e890e4399e75ae5097f3ad8b1007321cbb1ed4ac))
|
|
176
|
+
* add single occurrence array type ([#245](https://github.com/iotaledger/twin-framework/issues/245)) ([771dc78](https://github.com/iotaledger/twin-framework/commit/771dc78025b5546c9c9681be9494a76ab71171c6))
|
|
177
|
+
* add support for health i18n validation ([7a286dd](https://github.com/iotaledger/twin-framework/commit/7a286ddb0c1bfa498bf3a77126cd589042bad6de))
|
|
178
|
+
* add teardown to IComponent interface ([32c173c](https://github.com/iotaledger/twin-framework/commit/32c173cda115c20d3b4cee14b8a29cdc08e91555))
|
|
179
|
+
* add teardown to IComponent interface ([98ce864](https://github.com/iotaledger/twin-framework/commit/98ce8648e709310c4435de334825b381fb4e32cb))
|
|
180
|
+
* add typeName method to factory ([699fcbd](https://github.com/iotaledger/twin-framework/commit/699fcbd1168228401ddb81fdacb959b8cdc4206a))
|
|
181
|
+
* add uuidv7 support ([#219](https://github.com/iotaledger/twin-framework/issues/219)) ([916c657](https://github.com/iotaledger/twin-framework/commit/916c657d270ce99fafe554233739fdd9ca28635b))
|
|
182
|
+
* add wildcard support to the envhelper ([c064d46](https://github.com/iotaledger/twin-framework/commit/c064d46d36bbee8022a741b985d2b64c8f9572e4))
|
|
183
|
+
* adding link header helper ([#225](https://github.com/iotaledger/twin-framework/issues/225)) ([703c072](https://github.com/iotaledger/twin-framework/commit/703c0725aceac6b6ec0c4fa729ef832d12fb3fd7))
|
|
184
|
+
* additional nameof operators ([a5aab60](https://github.com/iotaledger/twin-framework/commit/a5aab60bf66a86f1b7ff8af7c4f044cb03706d50))
|
|
185
|
+
* additional RSA methods and async ([1fceee2](https://github.com/iotaledger/twin-framework/commit/1fceee2d1248a24a7620846025fcf906495c07f4))
|
|
186
|
+
* bump version ([c5354fa](https://github.com/iotaledger/twin-framework/commit/c5354fa906f4493c70f2642a9175a66780a10636))
|
|
187
|
+
* concurrency in SharedStore ([#388](https://github.com/iotaledger/twin-framework/issues/388)) ([0610198](https://github.com/iotaledger/twin-framework/commit/0610198ba482273c3f6ba918e34f5875a3659571))
|
|
188
|
+
* configurable timeout for mutex ([2087e04](https://github.com/iotaledger/twin-framework/commit/2087e04464a110a3f009fbc8b066696ed6784fc2))
|
|
189
|
+
* env helper conversion methods ([e8c607e](https://github.com/iotaledger/twin-framework/commit/e8c607e59f6f79d4b1d562e9313babe348778835))
|
|
190
|
+
* eslint migration to flat config ([74427d7](https://github.com/iotaledger/twin-framework/commit/74427d78d342167f7850e49ab87269326355befe))
|
|
191
|
+
* expand error params to accept properties ([032e9fd](https://github.com/iotaledger/twin-framework/commit/032e9fd1388e457cde32ca1005dfe014a5a9c077))
|
|
192
|
+
* factory create and integrity ([#235](https://github.com/iotaledger/twin-framework/issues/235)) ([9f98b99](https://github.com/iotaledger/twin-framework/commit/9f98b99daf46eb365346fae49cc4ffba63e74cb3))
|
|
193
|
+
* health status grouping ([5007c29](https://github.com/iotaledger/twin-framework/commit/5007c29fe4123fe56f754450b993dbe5dc32a057))
|
|
194
|
+
* improve async cache edge cases ([4e57a6e](https://github.com/iotaledger/twin-framework/commit/4e57a6ec4113533b0ea903eae7d469200fa1348c))
|
|
195
|
+
* improve error formatting ([#313](https://github.com/iotaledger/twin-framework/issues/313)) ([5a19623](https://github.com/iotaledger/twin-framework/commit/5a196231bcbf088bf9ba92a93b7478d3b8c5593f))
|
|
196
|
+
* improve Is.function and ModuleHelper.getModuleMethod signatures ([ecf968b](https://github.com/iotaledger/twin-framework/commit/ecf968b02934b3676be4bf7cd2d1e7f8e7af6ce2))
|
|
197
|
+
* improve Is.function definition to retain types ([f20b6b0](https://github.com/iotaledger/twin-framework/commit/f20b6b0dd16e74b75dc359be72b05989305c6410))
|
|
198
|
+
* improve signatures ([45a7d58](https://github.com/iotaledger/twin-framework/commit/45a7d58baa5b6abc8c0735656f393d402fabb4ad))
|
|
199
|
+
* improve signatures ([cdd24be](https://github.com/iotaledger/twin-framework/commit/cdd24be6fb898d33955b6f2f93c3ddbd73582269))
|
|
200
|
+
* improve signatures ([2041ae2](https://github.com/iotaledger/twin-framework/commit/2041ae214cbd8d472d5e8be8d3403cd06a114040))
|
|
201
|
+
* improve signatures ([d8a0ee1](https://github.com/iotaledger/twin-framework/commit/d8a0ee16542134a3f8b0653065239f42045125b4))
|
|
202
|
+
* improve signatures ([1d084c5](https://github.com/iotaledger/twin-framework/commit/1d084c58c7eb41ae50b0ce80ce57e48a22dd3102))
|
|
203
|
+
* improve signatures ([#287](https://github.com/iotaledger/twin-framework/issues/287)) ([c9f38f0](https://github.com/iotaledger/twin-framework/commit/c9f38f00e1cea8759e1105b41872a650c66c00f4))
|
|
204
|
+
* improved coercion ([fcc7d98](https://github.com/iotaledger/twin-framework/commit/fcc7d9826f5405be5e3b5414ea53be42f974f9d5))
|
|
205
|
+
* is and coerce accept duration object ([51dffa1](https://github.com/iotaledger/twin-framework/commit/51dffa18066eb86a14c700d90d3c1bd8b322c0fc))
|
|
206
|
+
* locales validation ([#197](https://github.com/iotaledger/twin-framework/issues/197)) ([55fdadb](https://github.com/iotaledger/twin-framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
|
|
207
|
+
* mutex safe usage in browser ([#339](https://github.com/iotaledger/twin-framework/issues/339)) ([02d409f](https://github.com/iotaledger/twin-framework/commit/02d409f211e91267964208d58a27f29791715086))
|
|
208
|
+
* nodeIdentity optional in IComponent methods ([c78dc17](https://github.com/iotaledger/twin-framework/commit/c78dc17f4357d3e1ae40e415f468d3eae13e81f4))
|
|
209
|
+
* shared object buffer ([#355](https://github.com/iotaledger/twin-framework/issues/355)) ([70d82ea](https://github.com/iotaledger/twin-framework/commit/70d82ea8f43f01aa840ae90ee0b1f23b064a07c6))
|
|
210
|
+
* simplify factory options ([7f85a85](https://github.com/iotaledger/twin-framework/commit/7f85a8553dd3008364e8e1104f2e6f6b6595d77e))
|
|
211
|
+
* simplify StringHelper signature ([0390403](https://github.com/iotaledger/twin-framework/commit/039040344952f91ee3c671249bc0e1c8f3b38e17))
|
|
212
|
+
* typescript 6 update ([1d10f31](https://github.com/iotaledger/twin-framework/commit/1d10f31e6516ec622773f45e88af82fe749b384a))
|
|
213
|
+
* update dependencies ([4da77ab](https://github.com/iotaledger/twin-framework/commit/4da77ab30f499e52825ac5a76f51436ceb59c26e))
|
|
214
|
+
* update dependencies ([f3bd015](https://github.com/iotaledger/twin-framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
|
|
215
|
+
* urn and header helper extensions ([#395](https://github.com/iotaledger/twin-framework/issues/395)) ([5976756](https://github.com/iotaledger/twin-framework/commit/5976756886d22e5063671052abc4dfa04ce23a53))
|
|
216
|
+
* urn random switched to using uuidv7 ([606c9a2](https://github.com/iotaledger/twin-framework/commit/606c9a2ed68a10fc7fc2bc5f93388c1b71033154))
|
|
217
|
+
* urn random switched to using uuidv7 ([6a29f8b](https://github.com/iotaledger/twin-framework/commit/6a29f8bd573d06992b7eaa027b1daf4c2a2e1e85))
|
|
218
|
+
* use cause instead of inner for errors ([1f4acc4](https://github.com/iotaledger/twin-framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
### Bug Fixes
|
|
222
|
+
|
|
223
|
+
* async thread lock ([97a96a5](https://github.com/iotaledger/twin-framework/commit/97a96a57f60c7b45a0ccbbfa1c43199b6e7512f9))
|
|
224
|
+
* ensure __decorate is defined for decorators ([103a563](https://github.com/iotaledger/twin-framework/commit/103a563ce01ebdef6240d2e590e7b026e8692684))
|
|
225
|
+
* improve exception handling in asyncCache ([c81b29b](https://github.com/iotaledger/twin-framework/commit/c81b29b660b152d2f0757d323430287e6491bf59))
|
|
226
|
+
* improve jsdoc comments ([f7c8e43](https://github.com/iotaledger/twin-framework/commit/f7c8e43fab9803dffa6461950d5b9979e25bcd24))
|
|
227
|
+
* iso 8601 checks ([#409](https://github.com/iotaledger/twin-framework/issues/409)) ([4427101](https://github.com/iotaledger/twin-framework/commit/442710109b63ec67ca5ee7cb948df742500d0151))
|
|
228
|
+
* linting ([b77511d](https://github.com/iotaledger/twin-framework/commit/b77511de8781707088b1beb4c92f12d7d6e0fd5f))
|
|
229
|
+
* mutex locking ([d5af3c1](https://github.com/iotaledger/twin-framework/commit/d5af3c1e66070f86408ba1410809689c6d22958b))
|
|
230
|
+
* pick non iterable keys ([399399a](https://github.com/iotaledger/twin-framework/commit/399399abfb8947c4eb235df527532ffe186986b3))
|
|
231
|
+
* prevent TOCTOU race in Mutex.getOrFetchLock for concurrent async callers ([#343](https://github.com/iotaledger/twin-framework/issues/343)) ([5238ad1](https://github.com/iotaledger/twin-framework/commit/5238ad1a68e24c69162204b02030c6686c15e9f4))
|
|
232
|
+
* remove misleading undefined from AsyncCache return type ([05b3291](https://github.com/iotaledger/twin-framework/commit/05b32914e03a63c7daf7b77952a2ebedb7ca7f6b))
|
|
233
|
+
* settle AsyncCache waiters correctly when a request resolves undefined or null ([#401](https://github.com/iotaledger/twin-framework/issues/401)) ([6ae3f8a](https://github.com/iotaledger/twin-framework/commit/6ae3f8aca688ca76d93ec3964178a3b1a8895453))
|
|
234
|
+
* time coercion ([8ac43f8](https://github.com/iotaledger/twin-framework/commit/8ac43f85fbd521ff54786d92df3e432d7f738b0c))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
### Dependencies
|
|
238
|
+
|
|
239
|
+
* The following workspace dependencies were updated
|
|
240
|
+
* dependencies
|
|
241
|
+
* @twin.org/nameof bumped from 0.9.2-next.0 to 0.9.2-next.1
|
|
242
|
+
* devDependencies
|
|
243
|
+
* @twin.org/nameof-transformer bumped from 0.9.2-next.0 to 0.9.2-next.1
|
|
244
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.9.2-next.0 to 0.9.2-next.1
|
|
245
|
+
|
|
3
246
|
## [0.9.1](https://github.com/iotaledger/twin-framework/compare/core-v0.9.1...core-v0.9.1) (2026-07-26)
|
|
4
247
|
|
|
5
248
|
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Class: LfuCache\<T\>
|
|
2
|
+
|
|
3
|
+
A fixed-capacity LFU cache with time-to-idle eviction.
|
|
4
|
+
|
|
5
|
+
Entries are removed in two ways:
|
|
6
|
+
- Capacity eviction: when the cache is full the least-frequently-used entry is removed first.
|
|
7
|
+
Ties in frequency are broken by recency the least-recently-used entry among those with the
|
|
8
|
+
minimum frequency is evicted.
|
|
9
|
+
- TTI eviction: a background timer sweeps idle entries every ttiMs milliseconds.
|
|
10
|
+
The timer only runs while there are entries; it stops automatically when the cache empties.
|
|
11
|
+
|
|
12
|
+
`get` and `set` increment an entry's access frequency and reset its idle timer.
|
|
13
|
+
`has` and `keys` are pure peeks they evict idle entries but do not affect frequency or TTI.
|
|
14
|
+
Call `destroy` when the cache is no longer needed to stop the background timer.
|
|
15
|
+
|
|
16
|
+
## Type Parameters
|
|
17
|
+
|
|
18
|
+
### T
|
|
19
|
+
|
|
20
|
+
`T`
|
|
21
|
+
|
|
22
|
+
## Constructors
|
|
23
|
+
|
|
24
|
+
### Constructor
|
|
25
|
+
|
|
26
|
+
> **new LfuCache**\<`T`\>(`options?`): `LfuCache`\<`T`\>
|
|
27
|
+
|
|
28
|
+
Create a new instance of LfuCache.
|
|
29
|
+
|
|
30
|
+
#### Parameters
|
|
31
|
+
|
|
32
|
+
##### options?
|
|
33
|
+
|
|
34
|
+
The cache options.
|
|
35
|
+
|
|
36
|
+
###### capacity?
|
|
37
|
+
|
|
38
|
+
`number`
|
|
39
|
+
|
|
40
|
+
Maximum number of entries. Defaults to 1000. Must be a positive integer.
|
|
41
|
+
|
|
42
|
+
###### ttiMs?
|
|
43
|
+
|
|
44
|
+
`number`
|
|
45
|
+
|
|
46
|
+
Time-to-idle in milliseconds. Defaults to 10000. Must be a positive integer.
|
|
47
|
+
|
|
48
|
+
###### mutexTimeoutMs?
|
|
49
|
+
|
|
50
|
+
`number`
|
|
51
|
+
|
|
52
|
+
Maximum time in milliseconds to wait for getOrSet mutex acquisition.
|
|
53
|
+
|
|
54
|
+
#### Returns
|
|
55
|
+
|
|
56
|
+
`LfuCache`\<`T`\>
|
|
57
|
+
|
|
58
|
+
#### Throws
|
|
59
|
+
|
|
60
|
+
ValidationError if capacity or ttiMs is not a positive integer.
|
|
61
|
+
|
|
62
|
+
## Properties
|
|
63
|
+
|
|
64
|
+
### CLASS\_NAME {#class_name}
|
|
65
|
+
|
|
66
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
67
|
+
|
|
68
|
+
Runtime name for the class.
|
|
69
|
+
|
|
70
|
+
***
|
|
71
|
+
|
|
72
|
+
### DEFAULT\_CAPACITY {#default_capacity}
|
|
73
|
+
|
|
74
|
+
> `readonly` `static` **DEFAULT\_CAPACITY**: `1000` = `1000`
|
|
75
|
+
|
|
76
|
+
Default capacity.
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### DEFAULT\_TTI\_MS {#default_tti_ms}
|
|
81
|
+
|
|
82
|
+
> `readonly` `static` **DEFAULT\_TTI\_MS**: `10000` = `10000`
|
|
83
|
+
|
|
84
|
+
Default time-to-idle in milliseconds.
|
|
85
|
+
|
|
86
|
+
## Methods
|
|
87
|
+
|
|
88
|
+
### count() {#count}
|
|
89
|
+
|
|
90
|
+
> **count**(): `number`
|
|
91
|
+
|
|
92
|
+
The number of entries currently held in the cache.
|
|
93
|
+
|
|
94
|
+
#### Returns
|
|
95
|
+
|
|
96
|
+
`number`
|
|
97
|
+
|
|
98
|
+
The number of entries in the cache.
|
|
99
|
+
|
|
100
|
+
***
|
|
101
|
+
|
|
102
|
+
### get() {#get}
|
|
103
|
+
|
|
104
|
+
> **get**(`key`): `T` \| `undefined`
|
|
105
|
+
|
|
106
|
+
Get a value from the cache.
|
|
107
|
+
Returns undefined if the key is absent or the entry has idled out.
|
|
108
|
+
A successful hit increments the entry's frequency and resets its idle timer.
|
|
109
|
+
|
|
110
|
+
#### Parameters
|
|
111
|
+
|
|
112
|
+
##### key
|
|
113
|
+
|
|
114
|
+
`string`
|
|
115
|
+
|
|
116
|
+
The key to retrieve.
|
|
117
|
+
|
|
118
|
+
#### Returns
|
|
119
|
+
|
|
120
|
+
`T` \| `undefined`
|
|
121
|
+
|
|
122
|
+
The cached value, or undefined on a miss or idle eviction.
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
### set() {#set}
|
|
127
|
+
|
|
128
|
+
> **set**(`key`, `value`): `void`
|
|
129
|
+
|
|
130
|
+
Store a value in the cache.
|
|
131
|
+
If the key already exists its value and frequency are updated.
|
|
132
|
+
When the cache is at capacity, idle entries are swept first; if it is still full the
|
|
133
|
+
least-frequently-used entry is evicted (LRU among ties).
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
##### key
|
|
138
|
+
|
|
139
|
+
`string`
|
|
140
|
+
|
|
141
|
+
The key to store.
|
|
142
|
+
|
|
143
|
+
##### value
|
|
144
|
+
|
|
145
|
+
`T`
|
|
146
|
+
|
|
147
|
+
The value to cache.
|
|
148
|
+
|
|
149
|
+
#### Returns
|
|
150
|
+
|
|
151
|
+
`void`
|
|
152
|
+
|
|
153
|
+
***
|
|
154
|
+
|
|
155
|
+
### getOrSet() {#getorset}
|
|
156
|
+
|
|
157
|
+
> **getOrSet**(`key`, `valueFactory`): `Promise`\<`T`\>
|
|
158
|
+
|
|
159
|
+
Atomically get an existing value or create and store it once using an async factory.
|
|
160
|
+
Concurrent calls for the same key are serialized via a mutex.
|
|
161
|
+
|
|
162
|
+
#### Parameters
|
|
163
|
+
|
|
164
|
+
##### key
|
|
165
|
+
|
|
166
|
+
`string`
|
|
167
|
+
|
|
168
|
+
The key to get or create.
|
|
169
|
+
|
|
170
|
+
##### valueFactory
|
|
171
|
+
|
|
172
|
+
() => `Promise`\<`T`\>
|
|
173
|
+
|
|
174
|
+
Async callback used to build a value when the key is absent.
|
|
175
|
+
|
|
176
|
+
#### Returns
|
|
177
|
+
|
|
178
|
+
`Promise`\<`T`\>
|
|
179
|
+
|
|
180
|
+
The existing or newly created value.
|
|
181
|
+
|
|
182
|
+
***
|
|
183
|
+
|
|
184
|
+
### has() {#has}
|
|
185
|
+
|
|
186
|
+
> **has**(`key`): `boolean`
|
|
187
|
+
|
|
188
|
+
Check whether a key exists in the cache and has not idled out.
|
|
189
|
+
Idle entries are evicted on peek, but a live entry's frequency and TTI are not updated.
|
|
190
|
+
|
|
191
|
+
#### Parameters
|
|
192
|
+
|
|
193
|
+
##### key
|
|
194
|
+
|
|
195
|
+
`string`
|
|
196
|
+
|
|
197
|
+
The key to test.
|
|
198
|
+
|
|
199
|
+
#### Returns
|
|
200
|
+
|
|
201
|
+
`boolean`
|
|
202
|
+
|
|
203
|
+
True if the key is present and not idle.
|
|
204
|
+
|
|
205
|
+
***
|
|
206
|
+
|
|
207
|
+
### keys() {#keys}
|
|
208
|
+
|
|
209
|
+
> **keys**(): `string`[]
|
|
210
|
+
|
|
211
|
+
Return all keys for entries that have not idled out.
|
|
212
|
+
Idle entries encountered during iteration are evicted.
|
|
213
|
+
Keys are returned in ascending frequency order; within the same frequency, LRU first.
|
|
214
|
+
|
|
215
|
+
#### Returns
|
|
216
|
+
|
|
217
|
+
`string`[]
|
|
218
|
+
|
|
219
|
+
An array of live keys ordered from least-frequently-used to most-frequently-used.
|
|
220
|
+
|
|
221
|
+
***
|
|
222
|
+
|
|
223
|
+
### delete() {#delete}
|
|
224
|
+
|
|
225
|
+
> **delete**(`key`): `void`
|
|
226
|
+
|
|
227
|
+
Remove an entry from the cache.
|
|
228
|
+
Cancels the background timer if the cache becomes empty.
|
|
229
|
+
|
|
230
|
+
#### Parameters
|
|
231
|
+
|
|
232
|
+
##### key
|
|
233
|
+
|
|
234
|
+
`string`
|
|
235
|
+
|
|
236
|
+
The key to remove.
|
|
237
|
+
|
|
238
|
+
#### Returns
|
|
239
|
+
|
|
240
|
+
`void`
|
|
241
|
+
|
|
242
|
+
***
|
|
243
|
+
|
|
244
|
+
### clear() {#clear}
|
|
245
|
+
|
|
246
|
+
> **clear**(): `void`
|
|
247
|
+
|
|
248
|
+
Remove all entries from the cache and cancel the background timer.
|
|
249
|
+
|
|
250
|
+
#### Returns
|
|
251
|
+
|
|
252
|
+
`void`
|
|
253
|
+
|
|
254
|
+
***
|
|
255
|
+
|
|
256
|
+
### destroy() {#destroy}
|
|
257
|
+
|
|
258
|
+
> **destroy**(): `void`
|
|
259
|
+
|
|
260
|
+
Stop the background idle-sweep timer and release all entries.
|
|
261
|
+
The cache must not be used after this call.
|
|
262
|
+
|
|
263
|
+
#### Returns
|
|
264
|
+
|
|
265
|
+
`void`
|