@indra.ai/deva 1.1.112 → 1.1.113
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 +12 -2
- 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[x] === '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();
|
|
@@ -292,6 +302,7 @@ class Deva {
|
|
|
292
302
|
this.action('Services')
|
|
293
303
|
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
294
304
|
const {services} = features; // set services from features const
|
|
305
|
+
console.log('SETTING UP GLOBA SERVICE FUNCTIONS', services);
|
|
295
306
|
this._services = { // set this_services with data
|
|
296
307
|
id: this.uid(true), // uuid of the services feature
|
|
297
308
|
client_id: id, // client id for reference
|
|
@@ -303,7 +314,6 @@ class Deva {
|
|
|
303
314
|
|
|
304
315
|
// setup any global methods from the services feature
|
|
305
316
|
for (const x in this._services.global) {
|
|
306
|
-
console.log('SETTING UP GLOBA SERVICE FUNCTIONS', x);
|
|
307
317
|
const isFunc = typeof this._services.global[x] === 'function' ? true :false;
|
|
308
318
|
if (isFunc) this.methods[x] = this._services.global[x].bind(this);
|
|
309
319
|
}
|
|
@@ -887,7 +897,7 @@ class Deva {
|
|
|
887
897
|
key: 'init',
|
|
888
898
|
value: agent.key,
|
|
889
899
|
agent,
|
|
890
|
-
client
|
|
900
|
+
client,
|
|
891
901
|
text: this._messages.states.start,
|
|
892
902
|
created: Date.now(),
|
|
893
903
|
}
|