@wooksjs/event-cli 0.4.34 → 0.4.36

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
@@ -95,7 +95,7 @@ class WooksCli extends wooks.WooksAdapterBase {
95
95
  const parsedFlags = minimist(argv, _opts);
96
96
  const pathParams = parsedFlags._;
97
97
  const path = `/${pathParams.map(v => encodeURI(v).replace(/\//g, '%2F')).join('/')}`;
98
- const { restoreCtx, clearCtx, store } = createCliContext({
98
+ const { restoreCtx, endEvent, store } = createCliContext({
99
99
  opts: _opts,
100
100
  argv,
101
101
  pathParams,
@@ -133,11 +133,11 @@ class WooksCli extends wooks.WooksAdapterBase {
133
133
  catch (error) {
134
134
  this.onError(error);
135
135
  }
136
- clearCtx();
136
+ endEvent();
137
137
  }
138
138
  else {
139
139
  this.onUnknownCommand(pathParams);
140
- clearCtx();
140
+ endEvent('Unknown command');
141
141
  }
142
142
  }
143
143
  onError(e) {
package/dist/index.d.ts CHANGED
@@ -215,6 +215,7 @@ declare function createCliContext(data: Omit<TCliEventData, 'type'>, options: TE
215
215
  getCtx: () => TCliContextStore & _wooksjs_event_core.TGenericContextStore<TCliEventData>;
216
216
  restoreCtx: () => _wooksjs_event_core.TGenericContextStore<TEmpty>;
217
217
  clearCtx: () => null;
218
+ endEvent: (abortReason?: string | undefined) => void;
218
219
  store: <K extends "flags" | keyof _wooksjs_event_core.TGenericContextStore<TCliEventData>>(key: K) => {
219
220
  value: (TCliContextStore & _wooksjs_event_core.TGenericContextStore<TCliEventData>)[K];
220
221
  hook: <K2 extends keyof Required<TCliContextStore & _wooksjs_event_core.TGenericContextStore<TCliEventData>>[K]>(key2: K2) => {
@@ -243,6 +244,7 @@ declare function useCliContext<T extends TEmpty>(): {
243
244
  getCtx: () => TCliContextStore & T & _wooksjs_event_core.TGenericContextStore<TCliEventData>;
244
245
  restoreCtx: () => _wooksjs_event_core.TGenericContextStore<TEmpty>;
245
246
  clearCtx: () => null;
247
+ endEvent: (abortReason?: string | undefined) => void;
246
248
  store: <K extends "flags" | keyof _wooksjs_event_core.TGenericContextStore<TCliEventData> | keyof T>(key: K) => {
247
249
  value: (TCliContextStore & T & _wooksjs_event_core.TGenericContextStore<TCliEventData>)[K];
248
250
  hook: <K2 extends keyof Required<TCliContextStore & T & _wooksjs_event_core.TGenericContextStore<TCliEventData>>[K]>(key2: K2) => {
package/dist/index.mjs CHANGED
@@ -93,7 +93,7 @@ class WooksCli extends WooksAdapterBase {
93
93
  const parsedFlags = minimist(argv, _opts);
94
94
  const pathParams = parsedFlags._;
95
95
  const path = `/${pathParams.map(v => encodeURI(v).replace(/\//g, '%2F')).join('/')}`;
96
- const { restoreCtx, clearCtx, store } = createCliContext({
96
+ const { restoreCtx, endEvent, store } = createCliContext({
97
97
  opts: _opts,
98
98
  argv,
99
99
  pathParams,
@@ -131,11 +131,11 @@ class WooksCli extends WooksAdapterBase {
131
131
  catch (error) {
132
132
  this.onError(error);
133
133
  }
134
- clearCtx();
134
+ endEvent();
135
135
  }
136
136
  else {
137
137
  this.onUnknownCommand(pathParams);
138
- clearCtx();
138
+ endEvent('Unknown command');
139
139
  }
140
140
  }
141
141
  onError(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-cli",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "@wooksjs/event-cli",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -39,8 +39,8 @@
39
39
  "url": "https://github.com/wooksjs/wooksjs/issues"
40
40
  },
41
41
  "peerDependencies": {
42
- "wooks": "0.4.34",
43
- "@wooksjs/event-core": "0.4.34"
42
+ "wooks": "0.4.36",
43
+ "@wooksjs/event-core": "0.4.36"
44
44
  },
45
45
  "dependencies": {
46
46
  "minimist": "^1.2.6",