@indra.ai/deva 1.64.44 → 1.64.46

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 +8 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -58,6 +58,7 @@ class Deva {
58
58
 
59
59
  this._inherit = config.inherit; // set inherit from config data.
60
60
  this._bind = config.bind; // set the bind from the config data.
61
+ this._binding = new Map(); // set the binding map
61
62
 
62
63
  this._uid = config.uid; // set the uid options
63
64
 
@@ -145,8 +146,12 @@ class Deva {
145
146
  try {
146
147
  this._bind.forEach(bind => { // loop over the bind items func, method, listener...
147
148
  if (this[bind]) for (let x in this[bind]) { // if the root has a bind func, method, listener
148
- if (typeof this[bind][x] === 'function') { // check to make sure object is a fucntion
149
- this[bind][x] = this[bind][x].bind(this); // bind the item from the bind object
149
+ // check to make sure the binding is a function.
150
+ if (typeof this[bind][x] === 'function') {
151
+ // check to make sure object is a fucntion
152
+ if (!this._binding.has(bind)) this._binding.set(bind, {});
153
+ this._binding.get(bind)[x] = this[bind][x].toString();
154
+ this[bind][x] = this[bind][x].bind(this);
150
155
  }
151
156
  }
152
157
  });
@@ -1216,9 +1221,9 @@ class Deva {
1216
1221
  this.state('loop', `${key}:config:ready:hash:${data.id.uid}`);
1217
1222
  for (let item of this._config.ready_hash) {
1218
1223
  if (this[item]) {
1219
- const this_item = this[item];
1220
1224
  this.action('hash', `${agent.key}:config:${item}:${data.id.uid}`);
1221
1225
  // manually build hash for the config hash object for each agent key.
1226
+ const this_item = this._binding.get(item) || this[item];
1222
1227
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1223
1228
  }
1224
1229
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "31711622713594414221",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.64.44",
4
+ "version": "1.64.46",
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:31711622713594414221 LICENSE.md",