@vida-global/core 1.1.10 → 1.1.12

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.
@@ -182,13 +182,20 @@ class VidaServerController {
182
182
  async #runCallbacks(callbacksList, actionName) {
183
183
  for (const { callback, options } of callbacksList) {
184
184
  if (!this.#shouldRunCallback(actionName, options)) continue;
185
- if (await this[callback]() === false) return false;
185
+ const result = await this.#runCallback(callback)
186
+ if (result === false) return false;
186
187
  }
187
188
 
188
189
  return true;
189
190
  }
190
191
 
191
192
 
193
+ async #runCallback(callback) {
194
+ if (typeof callback == 'function') return await callback.call(this);
195
+ return await this[callback]();
196
+ }
197
+
198
+
192
199
  #shouldRunCallback(actionName, options) {
193
200
  if (options.only) {
194
201
  if (Array.isArray(options.only)) return options.only.includes(actionName);
@@ -250,7 +257,9 @@ class VidaServerController {
250
257
 
251
258
 
252
259
  validateIsEnum(value, options) {
253
- if (!options.enums.includes(value)) return options.error;
260
+ if (!options.enums.includes(value)) {
261
+ return options.error || `must be one of [${options.enums.filter(Boolean).join(', ')}]`;
262
+ }
254
263
  }
255
264
 
256
265
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vida-global/core",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Core libraries for supporting Vida development",
5
5
  "author": "",
6
6
  "license": "ISC",