@twin.org/core 0.9.2 → 0.9.3-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/factories/facadeFactory.js +9 -0
- package/dist/es/factories/facadeFactory.js.map +1 -0
- package/dist/es/factories/factory.js +137 -6
- package/dist/es/factories/factory.js.map +1 -1
- package/dist/es/helpers/timeoutHelper.js +46 -0
- package/dist/es/helpers/timeoutHelper.js.map +1 -0
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IFacade.js +4 -0
- package/dist/es/models/IFacade.js.map +1 -0
- package/dist/es/models/IMutexWaiter.js +4 -0
- package/dist/es/models/IMutexWaiter.js.map +1 -0
- package/dist/es/utils/is.js +3 -3
- package/dist/es/utils/is.js.map +1 -1
- package/dist/es/utils/lfuCache.js +91 -13
- package/dist/es/utils/lfuCache.js.map +1 -1
- package/dist/es/utils/lruCache.js +83 -10
- package/dist/es/utils/lruCache.js.map +1 -1
- package/dist/es/utils/mutex.js +170 -23
- package/dist/es/utils/mutex.js.map +1 -1
- package/dist/types/factories/facadeFactory.d.ts +6 -0
- package/dist/types/factories/factory.d.ts +22 -2
- package/dist/types/helpers/timeoutHelper.d.ts +17 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/models/IFacade.d.ts +12 -0
- package/dist/types/models/IMutexWaiter.d.ts +17 -0
- package/dist/types/utils/lfuCache.d.ts +8 -2
- package/dist/types/utils/lruCache.d.ts +8 -2
- package/dist/types/utils/mutex.d.ts +9 -0
- package/docs/changelog.md +245 -0
- package/docs/examples.md +38 -1
- package/docs/reference/classes/Factory.md +80 -2
- package/docs/reference/classes/LfuCache.md +18 -2
- package/docs/reference/classes/LruCache.md +18 -2
- package/docs/reference/classes/Mutex.md +9 -0
- package/docs/reference/classes/TimeoutHelper.md +57 -0
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IFacade.md +32 -0
- package/docs/reference/interfaces/IMutexWaiter.md +37 -0
- package/docs/reference/variables/FacadeFactory.md +5 -0
- package/locales/en.json +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Interface: IFacade\<T\>
|
|
2
|
+
|
|
3
|
+
A facade wraps a component so a cross cutting concern can be applied to it without the
|
|
4
|
+
component being modified. The wrapped component is returned in place of the original.
|
|
5
|
+
|
|
6
|
+
## Type Parameters
|
|
7
|
+
|
|
8
|
+
### T
|
|
9
|
+
|
|
10
|
+
`T` = `unknown`
|
|
11
|
+
|
|
12
|
+
## Methods
|
|
13
|
+
|
|
14
|
+
### wrap() {#wrap}
|
|
15
|
+
|
|
16
|
+
> **wrap**(`target`): `T`
|
|
17
|
+
|
|
18
|
+
Wrap the target, returning a replacement.
|
|
19
|
+
|
|
20
|
+
#### Parameters
|
|
21
|
+
|
|
22
|
+
##### target
|
|
23
|
+
|
|
24
|
+
`T`
|
|
25
|
+
|
|
26
|
+
The component to wrap.
|
|
27
|
+
|
|
28
|
+
#### Returns
|
|
29
|
+
|
|
30
|
+
`T`
|
|
31
|
+
|
|
32
|
+
The wrapped component.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Interface: IMutexWaiter
|
|
2
|
+
|
|
3
|
+
A caller queued on a mutex key, waiting to be handed the lock.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### settled {#settled}
|
|
8
|
+
|
|
9
|
+
> **settled**: `boolean`
|
|
10
|
+
|
|
11
|
+
Has the waiter already been granted the lock or given up waiting.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### resolve? {#resolve}
|
|
16
|
+
|
|
17
|
+
> `optional` **resolve?**: (`granted`) => `void`
|
|
18
|
+
|
|
19
|
+
Resolves the queued caller, true when it now owns the lock.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
##### granted
|
|
24
|
+
|
|
25
|
+
`boolean`
|
|
26
|
+
|
|
27
|
+
#### Returns
|
|
28
|
+
|
|
29
|
+
`void`
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### timer? {#timer}
|
|
34
|
+
|
|
35
|
+
> `optional` **timer?**: `Timeout`
|
|
36
|
+
|
|
37
|
+
Timer which enforces the waiter's deadline.
|
package/locales/en.json
CHANGED
|
@@ -91,7 +91,10 @@
|
|
|
91
91
|
"factory": {
|
|
92
92
|
"noUnregister": "There is no {typeName} registered with the name \"{name}\"",
|
|
93
93
|
"noGet": "The requested {typeName} \"{name}\" does not exist in the factory",
|
|
94
|
-
"noCreate": "The requested {typeName} \"{name}\" cannot be created by the factory, with params \"{params}\""
|
|
94
|
+
"noCreate": "The requested {typeName} \"{name}\" cannot be created by the factory, with params \"{params}\"",
|
|
95
|
+
"noFacade": "The requested facade \"{name}\" is not registered, so it cannot be applied to the {typeName} factory",
|
|
96
|
+
"noFacadeOnFacades": "Facades cannot be applied to the facade factory itself",
|
|
97
|
+
"noFacadeWrap": "The facade \"{name}\" did not return a wrapped instance for the {typeName} factory"
|
|
95
98
|
},
|
|
96
99
|
"bitString": {
|
|
97
100
|
"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}\""
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
"mutex": {
|
|
112
115
|
"lockNotFound": "The key \"{key}\" has no active lock",
|
|
113
116
|
"lockAlreadyReleased": "The key \"{key}\" is not currently locked",
|
|
114
|
-
"lockTimeout": "Failed to acquire lock for key \"{key}\" within the timeout of {
|
|
117
|
+
"lockTimeout": "Failed to acquire lock for key \"{key}\" within the timeout of {timeoutMs} milliseconds",
|
|
115
118
|
"bufferFetchFailed": "Failed to retrieve shared buffer for key \"{key}\" from the main thread",
|
|
116
119
|
"invalidTimeout": "The timeout value \"{timeoutMs}\" is invalid, it must be a non-negative integer"
|
|
117
120
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3-next.10",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/nameof": "
|
|
17
|
+
"@twin.org/nameof": "0.9.3-next.10",
|
|
18
18
|
"intl-messageformat": "11.2.13",
|
|
19
19
|
"rfc6902": "5.3.0"
|
|
20
20
|
},
|