@indra.ai/deva 1.29.1 → 1.29.3

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.
Files changed (2) hide show
  1. package/index.js +19 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -310,7 +310,7 @@ class Deva {
310
310
  init, start, enter, done ready, finish, complete
311
311
  usage: this.complete(data, resolve)
312
312
  ***************/
313
- _invoke(opts) {
313
+ async _invoke(opts) {
314
314
  if (!this._active) return resolve(this._messages.offline);
315
315
  const {key, data, resolve} = opts;
316
316
  const {prev_key, next_key, onfunc, clear} = config.invoke[key];
@@ -355,18 +355,22 @@ class Deva {
355
355
  // determine if there is an onComplete function for the entity.
356
356
  const hasOnFunc = this[onfunc] && typeof this[onfunc] === 'function';
357
357
  if (hasOnFunc) {
358
- this.action('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // action onfunc
359
- this.state('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // state onfunc
360
- this.action('return', `${onfunc}:${data.id.uid}`); // action return
361
- this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
362
- this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
363
- return this[onfunc](data, resolve);
358
+ setImmediate(() => {
359
+ this.action('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // action onfunc
360
+ this.state('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // state onfunc
361
+ this.action('return', `${onfunc}:${data.id.uid}`); // action return
362
+ this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
363
+ this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
364
+ return this[onfunc](data, resolve);
365
+ });
364
366
  }
365
-
366
- this.action('return', `${key}:${data.id.uid}`); // return action complete
367
- this.state('valid', `${key}:${data.id.uid}`); // return state valid
368
- this.intent('good', `${key}:${data.id.uid}`); // return intent good
369
- return next_key ? this[next_key](data, resolve) : resolve(data);
367
+
368
+ setImmediate(() => {
369
+ this.action('return', `${key}:${data.id.uid}`); // return action complete
370
+ this.state('valid', `${key}:${data.id.uid}`); // return state valid
371
+ this.intent('good', `${key}:${data.id.uid}`); // return intent good
372
+ return next_key ? this[next_key](data, resolve) : resolve(data);
373
+ });
370
374
  }
371
375
 
372
376
  /**************
@@ -1429,7 +1433,9 @@ class Deva {
1429
1433
  }
1430
1434
  finally {
1431
1435
  // return the invoke in a set immediate so it runs after the loop
1432
- return this._invoke({key,data,resolve});
1436
+ setImmediate(() => {
1437
+ return this._invoke({key,data,resolve});
1438
+ });
1433
1439
  }
1434
1440
  }
1435
1441
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "38159520729793885324",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.29.1",
4
+ "version": "1.29.3",
5
5
  "description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
6
6
  "main": "index.js",
7
7
  "license": "VLA:38159520729793885324 LICENSE.md",