@twin.org/context 0.0.3-next.2 → 0.0.3-next.21

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.
@@ -1,4 +1,2 @@
1
- // Copyright 2024 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
1
  export {};
4
2
  //# sourceMappingURL=IContextIdHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IContextIdHandler.js","sourceRoot":"","sources":["../../../src/models/IContextIdHandler.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing a context ID handler.\n */\nexport interface IContextIdHandler {\n\t/**\n\t * The short form version of the context ID, should be unique enough to partition data.\n\t * @param value The full context ID value.\n\t * @returns The short form version of the context ID.\n\t */\n\tshort?(value: string): string;\n\n\t/**\n\t * Performs a runtime guard on the provided context ID value.\n\t * @param value The context ID value to guard.\n\t * @throws Guard error if the value is invalid.\n\t */\n\tguard?(value: string): void;\n}\n"]}
1
+ {"version":3,"file":"IContextIdHandler.js","sourceRoot":"","sources":["../../../src/models/IContextIdHandler.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface describing a context ID handler.\n */\nexport interface IContextIdHandler extends IComponent {\n\t/**\n\t * The short form version of the context ID, should be unique enough to partition data.\n\t * @param value The full context ID value.\n\t * @returns The short form version of the context ID.\n\t */\n\tshort?(value: string): string;\n\n\t/**\n\t * Performs a runtime guard on the provided context ID value.\n\t * @param value The context ID value to guard.\n\t * @throws Guard error if the value is invalid.\n\t */\n\tguard?(value: string): void;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { BaseError, GeneralError } from "@twin.org/core";
1
+ import { BaseError, GeneralError, Is, SharedStore } from "@twin.org/core";
2
2
  /**
3
3
  * Class to maintain context ids and execute an async method.
4
4
  */
@@ -7,10 +7,6 @@ export class ContextIdStore {
7
7
  * Runtime name for the class.
8
8
  */
9
9
  static CLASS_NAME = "ContextIdStore";
10
- /**
11
- * The async local storage for the context ids.
12
- */
13
- static _storage;
14
10
  /**
15
11
  * Execute the method wrapped in the context.
16
12
  * @param contextIds The context IDs.
@@ -18,32 +14,37 @@ export class ContextIdStore {
18
14
  * @returns Nothing.
19
15
  */
20
16
  static async run(contextIds, asyncMethod) {
21
- return (await ContextIdStore.createStorage()).run(contextIds, asyncMethod);
17
+ const storage = await ContextIdStore.getStorage();
18
+ return storage.run(contextIds, asyncMethod);
22
19
  }
23
20
  /**
24
21
  * Get the context IDs.
25
22
  * @returns The context IDs.
26
23
  */
27
24
  static async getContextIds() {
28
- return (await ContextIdStore.createStorage()).getStore();
25
+ const storage = await ContextIdStore.getStorage();
26
+ return storage.getStore();
29
27
  }
30
28
  /**
31
- * Create the storage if it doesn't exist.
29
+ * Get the storage and create it if it doesn't exist.
32
30
  * @returns The storage.
33
31
  */
34
- static async createStorage() {
35
- if (!ContextIdStore._storage) {
32
+ static async getStorage() {
33
+ let asyncHooksStore = SharedStore.get("asyncHooks");
34
+ if (Is.empty(asyncHooksStore?.contextIds)) {
36
35
  try {
37
36
  const hooks = await import("node:async_hooks");
38
- ContextIdStore._storage = new hooks.AsyncLocalStorage({
37
+ asyncHooksStore = asyncHooksStore ?? {};
38
+ asyncHooksStore.contextIds = new hooks.AsyncLocalStorage({
39
39
  name: "AsyncContextIdsStorage"
40
40
  });
41
41
  }
42
42
  catch (err) {
43
43
  throw new GeneralError(ContextIdStore.CLASS_NAME, "asyncHooksNotAvailable", undefined, BaseError.fromError(err));
44
44
  }
45
+ SharedStore.set("asyncHooks", asyncHooksStore);
45
46
  }
46
- return ContextIdStore._storage;
47
+ return asyncHooksStore.contextIds;
47
48
  }
48
49
  }
49
50
  //# sourceMappingURL=contextIdStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contextIdStore.js","sourceRoot":"","sources":["../../../src/utils/contextIdStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B;;OAEG;IACI,MAAM,CAAU,UAAU,oBAAoC;IAErE;;OAEG;IACK,MAAM,CAAC,QAAQ,CAAiC;IAExD;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAc,UAAuB,EAAE,WAAoB;QACjF,OAAO,CAAC,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAI,UAAU,EAAE,WAAW,CAAC,CAAC;IAC/E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa;QAChC,OAAO,CAAC,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,KAAK,CAAC,aAAa;QACjC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACJ,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;gBAC/C,cAAc,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAAc;oBAClE,IAAI,EAAE,wBAAwB;iBAC9B,CAAC,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,IAAI,YAAY,CACrB,cAAc,CAAC,UAAU,EACzB,wBAAwB,EACxB,SAAS,EACT,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CACxB,CAAC;YACH,CAAC;QACF,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IAChC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { AsyncLocalStorage } from \"node:async_hooks\";\nimport { BaseError, GeneralError } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IContextIds } from \"../models/IContextIds.js\";\n\n/**\n * Class to maintain context ids and execute an async method.\n */\nexport class ContextIdStore {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ContextIdStore>();\n\n\t/**\n\t * The async local storage for the context ids.\n\t */\n\tprivate static _storage: AsyncLocalStorage<IContextIds>;\n\n\t/**\n\t * Execute the method wrapped in the context.\n\t * @param contextIds The context IDs.\n\t * @param asyncMethod The async method to run.\n\t * @returns Nothing.\n\t */\n\tpublic static async run<T = unknown>(contextIds: IContextIds, asyncMethod: () => T): Promise<T> {\n\t\treturn (await ContextIdStore.createStorage()).run<T>(contextIds, asyncMethod);\n\t}\n\n\t/**\n\t * Get the context IDs.\n\t * @returns The context IDs.\n\t */\n\tpublic static async getContextIds(): Promise<IContextIds | undefined> {\n\t\treturn (await ContextIdStore.createStorage()).getStore();\n\t}\n\n\t/**\n\t * Create the storage if it doesn't exist.\n\t * @returns The storage.\n\t */\n\tprivate static async createStorage(): Promise<AsyncLocalStorage<IContextIds>> {\n\t\tif (!ContextIdStore._storage) {\n\t\t\ttry {\n\t\t\t\tconst hooks = await import(\"node:async_hooks\");\n\t\t\t\tContextIdStore._storage = new hooks.AsyncLocalStorage<IContextIds>({\n\t\t\t\t\tname: \"AsyncContextIdsStorage\"\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tContextIdStore.CLASS_NAME,\n\t\t\t\t\t\"asyncHooksNotAvailable\",\n\t\t\t\t\tundefined,\n\t\t\t\t\tBaseError.fromError(err)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn ContextIdStore._storage;\n\t}\n}\n"]}
1
+ {"version":3,"file":"contextIdStore.js","sourceRoot":"","sources":["../../../src/utils/contextIdStore.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI1E;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B;;OAEG;IACI,MAAM,CAAU,UAAU,oBAAoC;IAErE;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAc,UAAuB,EAAE,WAAoB;QACjF,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,GAAG,CAAI,UAAU,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa;QAChC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;QAC7B,IAAI,eAAe,GAAG,WAAW,CAAC,GAAG,CACpC,YAAY,CACZ,CAAC;QAEF,IAAI,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACJ,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;gBAC/C,eAAe,GAAG,eAAe,IAAI,EAAE,CAAC;gBACxC,eAAe,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAAc;oBACrE,IAAI,EAAE,wBAAwB;iBAC9B,CAAC,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,IAAI,YAAY,CACrB,cAAc,CAAC,UAAU,EACzB,wBAAwB,EACxB,SAAS,EACT,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CACxB,CAAC;YACH,CAAC;YACD,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,eAAe,CAAC,UAAU,CAAC;IACnC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { AsyncLocalStorage } from \"node:async_hooks\";\nimport { BaseError, GeneralError, Is, SharedStore } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IContextIds } from \"../models/IContextIds.js\";\n\n/**\n * Class to maintain context ids and execute an async method.\n */\nexport class ContextIdStore {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ContextIdStore>();\n\n\t/**\n\t * Execute the method wrapped in the context.\n\t * @param contextIds The context IDs.\n\t * @param asyncMethod The async method to run.\n\t * @returns Nothing.\n\t */\n\tpublic static async run<T = unknown>(contextIds: IContextIds, asyncMethod: () => T): Promise<T> {\n\t\tconst storage = await ContextIdStore.getStorage();\n\t\treturn storage.run<T>(contextIds, asyncMethod);\n\t}\n\n\t/**\n\t * Get the context IDs.\n\t * @returns The context IDs.\n\t */\n\tpublic static async getContextIds(): Promise<IContextIds | undefined> {\n\t\tconst storage = await ContextIdStore.getStorage();\n\t\treturn storage.getStore();\n\t}\n\n\t/**\n\t * Get the storage and create it if it doesn't exist.\n\t * @returns The storage.\n\t */\n\tpublic static async getStorage(): Promise<AsyncLocalStorage<IContextIds>> {\n\t\tlet asyncHooksStore = SharedStore.get<{ contextIds?: AsyncLocalStorage<IContextIds> }>(\n\t\t\t\"asyncHooks\"\n\t\t);\n\n\t\tif (Is.empty(asyncHooksStore?.contextIds)) {\n\t\t\ttry {\n\t\t\t\tconst hooks = await import(\"node:async_hooks\");\n\t\t\t\tasyncHooksStore = asyncHooksStore ?? {};\n\t\t\t\tasyncHooksStore.contextIds = new hooks.AsyncLocalStorage<IContextIds>({\n\t\t\t\t\tname: \"AsyncContextIdsStorage\"\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tthrow new GeneralError(\n\t\t\t\t\tContextIdStore.CLASS_NAME,\n\t\t\t\t\t\"asyncHooksNotAvailable\",\n\t\t\t\t\tundefined,\n\t\t\t\t\tBaseError.fromError(err)\n\t\t\t\t);\n\t\t\t}\n\t\t\tSharedStore.set(\"asyncHooks\", asyncHooksStore);\n\t\t}\n\t\treturn asyncHooksStore.contextIds;\n\t}\n}\n"]}
@@ -1,7 +1,8 @@
1
+ import type { IComponent } from "@twin.org/core";
1
2
  /**
2
3
  * Interface describing a context ID handler.
3
4
  */
4
- export interface IContextIdHandler {
5
+ export interface IContextIdHandler extends IComponent {
5
6
  /**
6
7
  * The short form version of the context ID, should be unique enough to partition data.
7
8
  * @param value The full context ID value.
@@ -1,3 +1,4 @@
1
+ import type { AsyncLocalStorage } from "node:async_hooks";
1
2
  import type { IContextIds } from "../models/IContextIds.js";
2
3
  /**
3
4
  * Class to maintain context ids and execute an async method.
@@ -7,10 +8,6 @@ export declare class ContextIdStore {
7
8
  * Runtime name for the class.
8
9
  */
9
10
  static readonly CLASS_NAME: string;
10
- /**
11
- * The async local storage for the context ids.
12
- */
13
- private static _storage;
14
11
  /**
15
12
  * Execute the method wrapped in the context.
16
13
  * @param contextIds The context IDs.
@@ -24,8 +21,8 @@ export declare class ContextIdStore {
24
21
  */
25
22
  static getContextIds(): Promise<IContextIds | undefined>;
26
23
  /**
27
- * Create the storage if it doesn't exist.
24
+ * Get the storage and create it if it doesn't exist.
28
25
  * @returns The storage.
29
26
  */
30
- private static createStorage;
27
+ static getStorage(): Promise<AsyncLocalStorage<IContextIds>>;
31
28
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,381 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.20...context-v0.0.3-next.21) (2026-02-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#206](https://github.com/twinfoundation/framework/issues/206)) ([ef0d4ee](https://github.com/twinfoundation/framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
9
+ * context id handler derives from component ([c868ec2](https://github.com/twinfoundation/framework/commit/c868ec21d3a576d4faa222bf130270a21936e50e))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * use singleton pattern for context storage ([c69f358](https://github.com/twinfoundation/framework/commit/c69f358e45361b45d4e46f19846cd5b8c99b0ccd))
15
+ * use singleton pattern for context storage ([5cc706a](https://github.com/twinfoundation/framework/commit/5cc706a2bbfc601fa3d00f3efd8b764052e9f91d))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * The following workspace dependencies were updated
21
+ * dependencies
22
+ * @twin.org/core bumped from 0.0.3-next.20 to 0.0.3-next.21
23
+ * @twin.org/nameof bumped from 0.0.3-next.20 to 0.0.3-next.21
24
+ * devDependencies
25
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.20 to 0.0.3-next.21
26
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.20 to 0.0.3-next.21
27
+ * @twin.org/validate-locales bumped from 0.0.3-next.20 to 0.0.3-next.21
28
+
29
+ ## [0.0.3-next.20](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.19...context-v0.0.3-next.20) (2026-02-26)
30
+
31
+
32
+ ### Miscellaneous Chores
33
+
34
+ * **context:** Synchronize repo versions
35
+
36
+
37
+ ### Dependencies
38
+
39
+ * The following workspace dependencies were updated
40
+ * dependencies
41
+ * @twin.org/core bumped from 0.0.3-next.19 to 0.0.3-next.20
42
+ * @twin.org/nameof bumped from 0.0.3-next.19 to 0.0.3-next.20
43
+ * devDependencies
44
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.19 to 0.0.3-next.20
45
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.19 to 0.0.3-next.20
46
+ * @twin.org/validate-locales bumped from 0.0.3-next.19 to 0.0.3-next.20
47
+
48
+ ## [0.0.3-next.19](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.18...context-v0.0.3-next.19) (2026-02-26)
49
+
50
+
51
+ ### Miscellaneous Chores
52
+
53
+ * **context:** Synchronize repo versions
54
+
55
+
56
+ ### Dependencies
57
+
58
+ * The following workspace dependencies were updated
59
+ * dependencies
60
+ * @twin.org/core bumped from 0.0.3-next.18 to 0.0.3-next.19
61
+ * @twin.org/nameof bumped from 0.0.3-next.18 to 0.0.3-next.19
62
+ * devDependencies
63
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.18 to 0.0.3-next.19
64
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.18 to 0.0.3-next.19
65
+ * @twin.org/validate-locales bumped from 0.0.3-next.18 to 0.0.3-next.19
66
+
67
+ ## [0.0.3-next.18](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.17...context-v0.0.3-next.18) (2026-02-23)
68
+
69
+
70
+ ### Miscellaneous Chores
71
+
72
+ * **context:** Synchronize repo versions
73
+
74
+
75
+ ### Dependencies
76
+
77
+ * The following workspace dependencies were updated
78
+ * dependencies
79
+ * @twin.org/core bumped from 0.0.3-next.17 to 0.0.3-next.18
80
+ * @twin.org/nameof bumped from 0.0.3-next.17 to 0.0.3-next.18
81
+ * devDependencies
82
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.17 to 0.0.3-next.18
83
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.17 to 0.0.3-next.18
84
+ * @twin.org/validate-locales bumped from 0.0.3-next.17 to 0.0.3-next.18
85
+
86
+ ## [0.0.3-next.17](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.16...context-v0.0.3-next.17) (2026-02-09)
87
+
88
+
89
+ ### Miscellaneous Chores
90
+
91
+ * **context:** Synchronize repo versions
92
+
93
+
94
+ ### Dependencies
95
+
96
+ * The following workspace dependencies were updated
97
+ * dependencies
98
+ * @twin.org/core bumped from 0.0.3-next.16 to 0.0.3-next.17
99
+ * @twin.org/nameof bumped from 0.0.3-next.16 to 0.0.3-next.17
100
+ * devDependencies
101
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.16 to 0.0.3-next.17
102
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.16 to 0.0.3-next.17
103
+ * @twin.org/validate-locales bumped from 0.0.3-next.16 to 0.0.3-next.17
104
+
105
+ ## [0.0.3-next.16](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.15...context-v0.0.3-next.16) (2026-02-06)
106
+
107
+
108
+ ### Miscellaneous Chores
109
+
110
+ * **context:** Synchronize repo versions
111
+
112
+
113
+ ### Dependencies
114
+
115
+ * The following workspace dependencies were updated
116
+ * dependencies
117
+ * @twin.org/core bumped from 0.0.3-next.15 to 0.0.3-next.16
118
+ * @twin.org/nameof bumped from 0.0.3-next.15 to 0.0.3-next.16
119
+ * devDependencies
120
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.15 to 0.0.3-next.16
121
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.15 to 0.0.3-next.16
122
+ * @twin.org/validate-locales bumped from 0.0.3-next.15 to 0.0.3-next.16
123
+
124
+ ## [0.0.3-next.15](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.14...context-v0.0.3-next.15) (2026-01-29)
125
+
126
+
127
+ ### Miscellaneous Chores
128
+
129
+ * **context:** Synchronize repo versions
130
+
131
+
132
+ ### Dependencies
133
+
134
+ * The following workspace dependencies were updated
135
+ * dependencies
136
+ * @twin.org/core bumped from 0.0.3-next.14 to 0.0.3-next.15
137
+ * @twin.org/nameof bumped from 0.0.3-next.14 to 0.0.3-next.15
138
+ * devDependencies
139
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.14 to 0.0.3-next.15
140
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.14 to 0.0.3-next.15
141
+ * @twin.org/validate-locales bumped from 0.0.3-next.14 to 0.0.3-next.15
142
+
143
+ ## [0.0.3-next.14](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.13...context-v0.0.3-next.14) (2026-01-22)
144
+
145
+
146
+ ### Miscellaneous Chores
147
+
148
+ * **context:** Synchronize repo versions
149
+
150
+
151
+ ### Dependencies
152
+
153
+ * The following workspace dependencies were updated
154
+ * dependencies
155
+ * @twin.org/core bumped from 0.0.3-next.13 to 0.0.3-next.14
156
+ * @twin.org/nameof bumped from 0.0.3-next.13 to 0.0.3-next.14
157
+ * devDependencies
158
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.13 to 0.0.3-next.14
159
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.13 to 0.0.3-next.14
160
+ * @twin.org/validate-locales bumped from 0.0.3-next.13 to 0.0.3-next.14
161
+
162
+ ## [0.0.3-next.13](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.12...context-v0.0.3-next.13) (2026-01-08)
163
+
164
+
165
+ ### Miscellaneous Chores
166
+
167
+ * **context:** Synchronize repo versions
168
+
169
+
170
+ ### Dependencies
171
+
172
+ * The following workspace dependencies were updated
173
+ * dependencies
174
+ * @twin.org/core bumped from 0.0.3-next.12 to 0.0.3-next.13
175
+ * @twin.org/nameof bumped from 0.0.3-next.12 to 0.0.3-next.13
176
+ * devDependencies
177
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.12 to 0.0.3-next.13
178
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.12 to 0.0.3-next.13
179
+ * @twin.org/validate-locales bumped from 0.0.3-next.12 to 0.0.3-next.13
180
+
181
+ ## [0.0.3-next.12](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.11...context-v0.0.3-next.12) (2026-01-08)
182
+
183
+
184
+ ### Miscellaneous Chores
185
+
186
+ * **context:** Synchronize repo versions
187
+
188
+
189
+ ### Dependencies
190
+
191
+ * The following workspace dependencies were updated
192
+ * dependencies
193
+ * @twin.org/core bumped from 0.0.3-next.11 to 0.0.3-next.12
194
+ * @twin.org/nameof bumped from 0.0.3-next.11 to 0.0.3-next.12
195
+ * devDependencies
196
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.11 to 0.0.3-next.12
197
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.11 to 0.0.3-next.12
198
+ * @twin.org/validate-locales bumped from 0.0.3-next.11 to 0.0.3-next.12
199
+
200
+ ## [0.0.3-next.11](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.10...context-v0.0.3-next.11) (2026-01-07)
201
+
202
+
203
+ ### Miscellaneous Chores
204
+
205
+ * **context:** Synchronize repo versions
206
+
207
+
208
+ ### Dependencies
209
+
210
+ * The following workspace dependencies were updated
211
+ * dependencies
212
+ * @twin.org/core bumped from 0.0.3-next.10 to 0.0.3-next.11
213
+ * @twin.org/nameof bumped from 0.0.3-next.10 to 0.0.3-next.11
214
+ * devDependencies
215
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.10 to 0.0.3-next.11
216
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.10 to 0.0.3-next.11
217
+ * @twin.org/validate-locales bumped from 0.0.3-next.10 to 0.0.3-next.11
218
+
219
+ ## [0.0.3-next.10](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.9...context-v0.0.3-next.10) (2026-01-07)
220
+
221
+
222
+ ### Miscellaneous Chores
223
+
224
+ * **context:** Synchronize repo versions
225
+
226
+
227
+ ### Dependencies
228
+
229
+ * The following workspace dependencies were updated
230
+ * dependencies
231
+ * @twin.org/core bumped from 0.0.3-next.9 to 0.0.3-next.10
232
+ * @twin.org/nameof bumped from 0.0.3-next.9 to 0.0.3-next.10
233
+ * devDependencies
234
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.9 to 0.0.3-next.10
235
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.9 to 0.0.3-next.10
236
+ * @twin.org/validate-locales bumped from 0.0.3-next.9 to 0.0.3-next.10
237
+
238
+ ## [0.0.3-next.9](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.8...context-v0.0.3-next.9) (2026-01-05)
239
+
240
+
241
+ ### Miscellaneous Chores
242
+
243
+ * **context:** Synchronize repo versions
244
+
245
+
246
+ ### Dependencies
247
+
248
+ * The following workspace dependencies were updated
249
+ * dependencies
250
+ * @twin.org/core bumped from 0.0.3-next.8 to 0.0.3-next.9
251
+ * @twin.org/nameof bumped from 0.0.3-next.8 to 0.0.3-next.9
252
+ * devDependencies
253
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.8 to 0.0.3-next.9
254
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.8 to 0.0.3-next.9
255
+ * @twin.org/validate-locales bumped from 0.0.3-next.8 to 0.0.3-next.9
256
+
257
+ ## [0.0.3-next.8](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.7...context-v0.0.3-next.8) (2025-11-26)
258
+
259
+
260
+ ### Miscellaneous Chores
261
+
262
+ * **context:** Synchronize repo versions
263
+
264
+
265
+ ### Dependencies
266
+
267
+ * The following workspace dependencies were updated
268
+ * dependencies
269
+ * @twin.org/core bumped from 0.0.3-next.7 to 0.0.3-next.8
270
+ * @twin.org/nameof bumped from 0.0.3-next.7 to 0.0.3-next.8
271
+ * devDependencies
272
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.7 to 0.0.3-next.8
273
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.7 to 0.0.3-next.8
274
+ * @twin.org/validate-locales bumped from 0.0.3-next.7 to 0.0.3-next.8
275
+
276
+ ## [0.0.3-next.7](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.6...context-v0.0.3-next.7) (2025-11-25)
277
+
278
+
279
+ ### Features
280
+
281
+ * add context id features ([#206](https://github.com/twinfoundation/framework/issues/206)) ([ef0d4ee](https://github.com/twinfoundation/framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
282
+ * context id handler derives from component ([c868ec2](https://github.com/twinfoundation/framework/commit/c868ec21d3a576d4faa222bf130270a21936e50e))
283
+
284
+
285
+ ### Bug Fixes
286
+
287
+ * use singleton pattern for context storage ([c69f358](https://github.com/twinfoundation/framework/commit/c69f358e45361b45d4e46f19846cd5b8c99b0ccd))
288
+ * use singleton pattern for context storage ([5cc706a](https://github.com/twinfoundation/framework/commit/5cc706a2bbfc601fa3d00f3efd8b764052e9f91d))
289
+
290
+
291
+ ### Dependencies
292
+
293
+ * The following workspace dependencies were updated
294
+ * dependencies
295
+ * @twin.org/core bumped from 0.0.3-next.6 to 0.0.3-next.7
296
+ * @twin.org/nameof bumped from 0.0.3-next.6 to 0.0.3-next.7
297
+ * devDependencies
298
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.6 to 0.0.3-next.7
299
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.6 to 0.0.3-next.7
300
+ * @twin.org/validate-locales bumped from 0.0.3-next.6 to 0.0.3-next.7
301
+
302
+ ## [0.0.3-next.6](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.5...context-v0.0.3-next.6) (2025-11-25)
303
+
304
+
305
+ ### Miscellaneous Chores
306
+
307
+ * **context:** Synchronize repo versions
308
+
309
+
310
+ ### Dependencies
311
+
312
+ * The following workspace dependencies were updated
313
+ * dependencies
314
+ * @twin.org/core bumped from 0.0.3-next.5 to 0.0.3-next.6
315
+ * @twin.org/nameof bumped from 0.0.3-next.5 to 0.0.3-next.6
316
+ * devDependencies
317
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.5 to 0.0.3-next.6
318
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.5 to 0.0.3-next.6
319
+ * @twin.org/validate-locales bumped from 0.0.3-next.5 to 0.0.3-next.6
320
+
321
+ ## [0.0.3-next.5](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.4...context-v0.0.3-next.5) (2025-11-20)
322
+
323
+
324
+ ### Features
325
+
326
+ * context id handler derives from component ([c868ec2](https://github.com/twinfoundation/framework/commit/c868ec21d3a576d4faa222bf130270a21936e50e))
327
+
328
+
329
+ ### Dependencies
330
+
331
+ * The following workspace dependencies were updated
332
+ * dependencies
333
+ * @twin.org/core bumped from 0.0.3-next.4 to 0.0.3-next.5
334
+ * @twin.org/nameof bumped from 0.0.3-next.4 to 0.0.3-next.5
335
+ * devDependencies
336
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.4 to 0.0.3-next.5
337
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.4 to 0.0.3-next.5
338
+ * @twin.org/validate-locales bumped from 0.0.3-next.4 to 0.0.3-next.5
339
+
340
+ ## [0.0.3-next.4](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.3...context-v0.0.3-next.4) (2025-11-13)
341
+
342
+
343
+ ### Bug Fixes
344
+
345
+ * use singleton pattern for context storage ([c69f358](https://github.com/twinfoundation/framework/commit/c69f358e45361b45d4e46f19846cd5b8c99b0ccd))
346
+ * use singleton pattern for context storage ([5cc706a](https://github.com/twinfoundation/framework/commit/5cc706a2bbfc601fa3d00f3efd8b764052e9f91d))
347
+
348
+
349
+ ### Dependencies
350
+
351
+ * The following workspace dependencies were updated
352
+ * dependencies
353
+ * @twin.org/core bumped from 0.0.3-next.3 to 0.0.3-next.4
354
+ * @twin.org/nameof bumped from 0.0.3-next.3 to 0.0.3-next.4
355
+ * devDependencies
356
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.3 to 0.0.3-next.4
357
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.3 to 0.0.3-next.4
358
+ * @twin.org/validate-locales bumped from 0.0.3-next.3 to 0.0.3-next.4
359
+
360
+ ## [0.0.3-next.3](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.2...context-v0.0.3-next.3) (2025-11-12)
361
+
362
+
363
+ ### Miscellaneous Chores
364
+
365
+ * **context:** Synchronize repo versions
366
+
367
+
368
+ ### Dependencies
369
+
370
+ * The following workspace dependencies were updated
371
+ * dependencies
372
+ * @twin.org/core bumped from 0.0.3-next.2 to 0.0.3-next.3
373
+ * @twin.org/nameof bumped from 0.0.3-next.2 to 0.0.3-next.3
374
+ * devDependencies
375
+ * @twin.org/nameof-transformer bumped from 0.0.3-next.2 to 0.0.3-next.3
376
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.2 to 0.0.3-next.3
377
+ * @twin.org/validate-locales bumped from 0.0.3-next.2 to 0.0.3-next.3
378
+
3
379
  ## [0.0.3-next.2](https://github.com/twinfoundation/framework/compare/context-v0.0.3-next.1...context-v0.0.3-next.2) (2025-11-12)
4
380
 
5
381
 
@@ -67,3 +67,17 @@ Get the context IDs.
67
67
  `Promise`\<[`IContextIds`](../interfaces/IContextIds.md) \| `undefined`\>
68
68
 
69
69
  The context IDs.
70
+
71
+ ***
72
+
73
+ ### getStorage()
74
+
75
+ > `static` **getStorage**(): `Promise`\<`AsyncLocalStorage`\<[`IContextIds`](../interfaces/IContextIds.md)\>\>
76
+
77
+ Get the storage and create it if it doesn't exist.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`AsyncLocalStorage`\<[`IContextIds`](../interfaces/IContextIds.md)\>\>
82
+
83
+ The storage.
@@ -2,6 +2,10 @@
2
2
 
3
3
  Interface describing a context ID handler.
4
4
 
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
5
9
  ## Methods
6
10
 
7
11
  ### short()?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/context",
3
- "version": "0.0.3-next.2",
3
+ "version": "0.0.3-next.21",
4
4
  "description": "Helper methods/classes for context handling",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.3-next.2",
18
- "@twin.org/nameof": "0.0.3-next.2"
17
+ "@twin.org/core": "0.0.3-next.21",
18
+ "@twin.org/nameof": "0.0.3-next.21"
19
19
  },
20
20
  "main": "./dist/es/index.js",
21
21
  "types": "./dist/types/index.d.ts",