@travetto/context 3.0.0-rc.2 → 3.0.0-rc.4
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/package.json +2 -2
- package/src/service.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/context",
|
|
3
3
|
"displayName": "Async Context",
|
|
4
|
-
"version": "3.0.0-rc.
|
|
4
|
+
"version": "3.0.0-rc.4",
|
|
5
5
|
"description": "Async-aware state management, maintaining context across asynchronous calls.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"async-hooks",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"directory": "module/context"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/di": "^3.0.0-rc.
|
|
30
|
+
"@travetto/di": "^3.0.0-rc.4"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
package/src/service.ts
CHANGED
|
@@ -67,7 +67,7 @@ export class AsyncContext {
|
|
|
67
67
|
/**
|
|
68
68
|
* Run an async function and ensure the context is available during execution
|
|
69
69
|
*/
|
|
70
|
-
async run<T = unknown>(fn: () => Promise<T
|
|
70
|
+
async run<T = unknown>(fn: () => Promise<T> | T, init: Ctx = {}): Promise<T> {
|
|
71
71
|
if (this.alStorage.getStore()) {
|
|
72
72
|
init = { ...this.#store(), ...init };
|
|
73
73
|
}
|