@wooksjs/event-core 0.4.29 → 0.4.31

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/index.cjs CHANGED
@@ -112,6 +112,10 @@ function _getCtxHelpers(cc) {
112
112
  store,
113
113
  getStore: get,
114
114
  setStore: set,
115
+ setParentCtx: (parentCtx) => {
116
+ cc.parentCtx = parentCtx;
117
+ },
118
+ restoreParentCtx: () => (currentContext = cc.parentCtx || null),
115
119
  };
116
120
  }
117
121
 
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ interface TEventOptions {
21
21
  interface TGenericContextStore<CustomEventType = TEmpty> {
22
22
  event: CustomEventType & TGenericEvent;
23
23
  options: TEventOptions;
24
+ parentCtx?: TGenericContextStore;
24
25
  routeParams?: Record<string, string | string[]>;
25
26
  }
26
27
  /**
@@ -49,6 +50,8 @@ declare function createEventContext<S = TEmpty, EventTypeToCreate = TEmpty>(data
49
50
  };
50
51
  getStore: <K_1 extends keyof S | keyof TGenericContextStore<EventTypeToCreate>>(key: K_1) => (S & TGenericContextStore<EventTypeToCreate>)[K_1];
51
52
  setStore: <K_2 extends keyof S | keyof TGenericContextStore<EventTypeToCreate>>(key: K_2, v: (S & TGenericContextStore<EventTypeToCreate>)[K_2]) => void;
53
+ setParentCtx: (parentCtx: unknown) => void;
54
+ restoreParentCtx: () => TGenericContextStore<TEmpty> | null;
52
55
  };
53
56
  /**
54
57
  * Use existing event context
@@ -77,6 +80,8 @@ declare function useEventContext<S = TEmpty, EventType = TEmpty>(expectedTypes?:
77
80
  };
78
81
  getStore: <K_1 extends keyof S | keyof TGenericContextStore<EventType>>(key: K_1) => (S & TGenericContextStore<EventType>)[K_1];
79
82
  setStore: <K_2 extends keyof S | keyof TGenericContextStore<EventType>>(key: K_2, v: (S & TGenericContextStore<EventType>)[K_2]) => void;
83
+ setParentCtx: (parentCtx: unknown) => void;
84
+ restoreParentCtx: () => TGenericContextStore<TEmpty> | null;
80
85
  };
81
86
 
82
87
  interface TEventLoggerData {
package/dist/index.mjs CHANGED
@@ -110,6 +110,10 @@ function _getCtxHelpers(cc) {
110
110
  store,
111
111
  getStore: get,
112
112
  setStore: set,
113
+ setParentCtx: (parentCtx) => {
114
+ cc.parentCtx = parentCtx;
115
+ },
116
+ restoreParentCtx: () => (currentContext = cc.parentCtx || null),
113
117
  };
114
118
  }
115
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-core",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "description": "@wooksjs/event-core",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",