@indra.ai/deva 1.29.14 → 1.29.16

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 +14 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -313,7 +313,7 @@ class Deva {
313
313
  async _invoke(opts) {
314
314
  if (!this._active) return resolve(this._messages.offline);
315
315
  const {key, data, resolve} = opts;
316
- const {prev_key, next_key, onfunc, clear} = config.invoke[key];
316
+ const {prev_key, next_key, onfunc, clear, load} = config.invoke[key];
317
317
  this.action('invoke', `${key}:${data.id.uid}`);
318
318
  this.context(key, data.id.uid);
319
319
  this.zone(key, data.id.uid);
@@ -360,13 +360,13 @@ class Deva {
360
360
  this.action('return', `${onfunc}:${data.id.uid}`); // action return
361
361
  this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
362
362
  this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
363
- return this[onfunc](data, resolve);
363
+ return await this[onfunc](data, resolve);
364
364
  }
365
365
 
366
366
  this.action('return', `${key}:${data.id.uid}`); // return action complete
367
367
  this.state('valid', `${key}:${data.id.uid}`); // return state valid
368
368
  this.intent('good', `${key}:${data.id.uid}`); // return intent good
369
- return next_key ? this[next_key](data, resolve) : resolve(data);
369
+ return next_key ? await this[next_key](data, resolve) : resolve(data);
370
370
  }
371
371
 
372
372
  /**************
@@ -1378,21 +1378,22 @@ class Deva {
1378
1378
  If the deva is offline it will return the offline message.
1379
1379
  usage: this.done('msg')
1380
1380
  ***************/
1381
- done(data, resolve) {
1381
+ async done(data, resolve) {
1382
1382
  if (!this._active) return resolve(this._messages.offline);
1383
1383
 
1384
1384
  if (this.devas && Object.keys(this.devas).length) {
1385
1385
  for (let deva in this.devas) {
1386
- setImmediate(async () => {
1387
- await this.load(deva, data.client);
1388
- // after the deva loads talk the event to set asset directory.
1389
- const id = this.uid();
1390
- const {dir} = this.devas[deva].info();
1391
- const {key} = this.devas[deva].agent();
1392
- this.talk(`deva:dir`, {id, key,dir});
1393
- });
1386
+ await this.load(deva, data.client);
1387
+ // after the deva loads talk the event to set asset directory.
1388
+ const id = this.uid();
1389
+ const {dir} = this.devas[deva].info();
1390
+ const {key} = this.devas[deva].agent();
1391
+ this.talk(`deva:dir`, {id, key,dir});
1394
1392
  }
1395
- return this._invoke({key:'done',data,resolve});
1393
+ // return immedate on async
1394
+ return setImmediate(() => {
1395
+ return this._invoke({key:'done',data,resolve});
1396
+ });
1396
1397
  }
1397
1398
  else {
1398
1399
  return this._invoke({key:'done',data,resolve});
@@ -1426,7 +1427,6 @@ class Deva {
1426
1427
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1427
1428
  }
1428
1429
  }
1429
-
1430
1430
  return this._invoke({key,data,resolve});
1431
1431
  }
1432
1432
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "38159520729793885324",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.29.14",
4
+ "version": "1.29.16",
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",