ultravisor-beacon 0.0.3 → 0.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultravisor-beacon",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Ultravisor Beacon: lightweight beacon client and Fable service for remote task execution",
5
5
  "main": "source/Ultravisor-Beacon-Service.cjs",
6
6
  "scripts": {
@@ -22,7 +22,8 @@
22
22
  "author": "Steven Velozo <steven@velozo.com>",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "fable-serviceproviderbase": "^3.0.19"
25
+ "fable-serviceproviderbase": "^3.0.19",
26
+ "ws": "^8.20.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "quackage": "^1.0.65"
@@ -70,20 +70,35 @@ class UltravisorBeaconCapabilityAdapter extends libCapabilityProvider
70
70
  let tmpDescriptorActions = (this._Descriptor && this._Descriptor.actions) ? this._Descriptor.actions : {};
71
71
  let tmpActionDef = tmpDescriptorActions[pAction];
72
72
 
73
- if (!tmpActionDef || typeof tmpActionDef.Handler !== 'function')
73
+ // Per-action Handler takes priority
74
+ if (tmpActionDef && typeof tmpActionDef.Handler === 'function')
74
75
  {
75
- return fCallback(new Error(
76
- `CapabilityAdapter "${this.Name}" has no Handler for action "${pAction}".`));
76
+ try
77
+ {
78
+ return tmpActionDef.Handler(pWorkItem, pContext, fCallback, fReportProgress);
79
+ }
80
+ catch (pError)
81
+ {
82
+ return fCallback(pError);
83
+ }
77
84
  }
78
85
 
79
- try
86
+ // Fall back to descriptor-level execute method (Provider pattern —
87
+ // a single execute() that routes actions internally)
88
+ if (typeof this._Descriptor.execute === 'function')
80
89
  {
81
- tmpActionDef.Handler(pWorkItem, pContext, fCallback, fReportProgress);
82
- }
83
- catch (pError)
84
- {
85
- return fCallback(pError);
90
+ try
91
+ {
92
+ return this._Descriptor.execute(pAction, pWorkItem, pContext, fCallback, fReportProgress);
93
+ }
94
+ catch (pError)
95
+ {
96
+ return fCallback(pError);
97
+ }
86
98
  }
99
+
100
+ return fCallback(new Error(
101
+ `CapabilityAdapter "${this.Name}" has no Handler for action "${pAction}".`));
87
102
  }
88
103
 
89
104
  /**