@indra.ai/deva 1.1.112 → 1.1.114
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.
- package/index.js +11 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -208,6 +208,16 @@ class Deva {
|
|
|
208
208
|
***************/
|
|
209
209
|
Client(client) {
|
|
210
210
|
this.action('Client');
|
|
211
|
+
|
|
212
|
+
// setup any custom methods for the features
|
|
213
|
+
for (const x in client.features) {
|
|
214
|
+
const methods = client.features[x].methods || false;
|
|
215
|
+
if (methods) for (const y in methods) {
|
|
216
|
+
const isMethod = typeof methods[y] === 'function' && !this.methods[y];
|
|
217
|
+
if (isMethod) this.methods[y] = methods[y].bind(this);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// console.log('CLINET BEFORE COPY', client);
|
|
211
221
|
const _client = this.copy(client); // copy the client parameter
|
|
212
222
|
this._client = _client; // set local _client to this scope
|
|
213
223
|
return Promise.resolve();
|
|
@@ -300,14 +310,6 @@ class Deva {
|
|
|
300
310
|
global: services.global, // the global policies for client
|
|
301
311
|
personal: services.devas[this._agent.key], // Client personal features and rules.
|
|
302
312
|
};
|
|
303
|
-
|
|
304
|
-
// setup any global methods from the services feature
|
|
305
|
-
for (const x in this._services.global) {
|
|
306
|
-
console.log('SETTING UP GLOBA SERVICE FUNCTIONS', x);
|
|
307
|
-
const isFunc = typeof this._services.global[x] === 'function' ? true :false;
|
|
308
|
-
if (isFunc) this.methods[x] = this._services.global[x].bind(this);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
313
|
delete this._client.features.services // delete the services key for isolation
|
|
312
314
|
return this.Systems() // go to Systems when done
|
|
313
315
|
}
|
|
@@ -887,7 +889,7 @@ class Deva {
|
|
|
887
889
|
key: 'init',
|
|
888
890
|
value: agent.key,
|
|
889
891
|
agent,
|
|
890
|
-
client
|
|
892
|
+
client,
|
|
891
893
|
text: this._messages.states.start,
|
|
892
894
|
created: Date.now(),
|
|
893
895
|
}
|