@indra.ai/deva 1.5.12 → 1.5.14

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 +9 -5
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -409,7 +409,9 @@ class Deva {
409
409
  ***************/
410
410
  talk(evt, packet=false) {
411
411
  this.action('talk', `${evt}:${packet.id}`);
412
- return this.events.emit(evt, packet);
412
+ this.state('talk', `${evt}:${packet.id}`);
413
+ this.events.emit(evt, packet);
414
+ return packet;
413
415
  }
414
416
 
415
417
  /**************
@@ -716,7 +718,7 @@ class Deva {
716
718
  this._active = Date.now();
717
719
  const agent = this.agent();
718
720
 
719
- const _data = {
721
+ const data = {
720
722
  id: this.lib.uid(),
721
723
  key: 'init',
722
724
  value: agent.key,
@@ -725,7 +727,7 @@ class Deva {
725
727
  text: this._messages.init,
726
728
  created: Date.now(),
727
729
  }
728
- _data.hash = this.lib.hash(_data);
730
+ data.hash = this.lib.hash(data);
729
731
  return new Promise((resolve, reject) => {
730
732
  this.events.setMaxListeners(this.maxListeners);
731
733
  this._assignInherit().then(() => {
@@ -762,8 +764,10 @@ class Deva {
762
764
  return this.Done(resolve, reject);
763
765
  }).then(() => {
764
766
  const hasOnInit = this.onInit && typeof this.onInit === 'function';
765
- return hasOnInit ? this.onInit(_data, resolve) : this.start(_data, resolve);
767
+ this.state('return', `init:${data.id}`);
768
+ return hasOnInit ? this.onInit(data, resolve) : this.start(data, resolve);
766
769
  }).catch(err => {
770
+ this.state('catch', `init:${data.id}`);
767
771
  return this.error(err, client, reject);
768
772
  });
769
773
  });
@@ -1093,7 +1097,7 @@ class Deva {
1093
1097
  ***************/
1094
1098
  action(value=false, extra=false) {
1095
1099
  const id = this.lib.uid();
1096
- this.state('try', `action:${value}:${id}`);
1100
+ this.state('try', `${value}:${id}`);
1097
1101
  try {
1098
1102
  if (!value || !this._actions[value] || value === this._action) return;
1099
1103
  this._action = value; // set the local action variable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.5.12",
3
+ "version": "1.5.14",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",
@@ -182,7 +182,8 @@
182
182
  "view": "👓 View",
183
183
  "insert": "👉 Insert",
184
184
  "update": "👆 Update",
185
- "delete": "🗑️ Delete"
185
+ "delete": "🗑️ Delete",
186
+ "return": "🤿 Return"
186
187
  },
187
188
  "action": false,
188
189
  "actions": {