@indra.ai/deva 1.6.38 → 1.6.40
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 +3 -4
- package/lib/index.js +2 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -43,7 +43,7 @@ class Deva {
|
|
|
43
43
|
this._systems = false; // inherited Systems features.
|
|
44
44
|
this._networks = false; // inherited Systems features.
|
|
45
45
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
46
|
-
this.lib = new lib({pkg
|
|
46
|
+
this.lib = new lib({pkg}); // used for loading library functions
|
|
47
47
|
this.utils = opts.utils || {}; // parse function
|
|
48
48
|
this.devas = opts.devas || {}; // Devas which are loaded
|
|
49
49
|
this.vars = opts.vars || {}; // Variables object
|
|
@@ -1115,6 +1115,7 @@ class Deva {
|
|
|
1115
1115
|
this.action('ready', data.id.uid);
|
|
1116
1116
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
1117
1117
|
|
|
1118
|
+
// Delete previous data hashes
|
|
1118
1119
|
delete data.md5;
|
|
1119
1120
|
delete data.sha256;
|
|
1120
1121
|
delete data.sha512;
|
|
@@ -1127,8 +1128,6 @@ class Deva {
|
|
|
1127
1128
|
|
|
1128
1129
|
const client = this.client();
|
|
1129
1130
|
this.lib.setClient(client.sha256);
|
|
1130
|
-
const agent = this.agent();
|
|
1131
|
-
this.lib.setAgent(agent.sha256);
|
|
1132
1131
|
|
|
1133
1132
|
this.state('ready', data.id.uid);
|
|
1134
1133
|
this.talk(config.events.ready, data);
|
|
@@ -1626,7 +1625,7 @@ class Deva {
|
|
|
1626
1625
|
agent() {
|
|
1627
1626
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1628
1627
|
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1629
|
-
data.md5 = this.lib.hash(data);
|
|
1628
|
+
data.md5 = this.lib.hash(data, 'md5');
|
|
1630
1629
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1631
1630
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1632
1631
|
return data; // return the copy of the agent data.
|
package/lib/index.js
CHANGED
|
@@ -18,10 +18,10 @@ class Node {
|
|
|
18
18
|
class LIB {
|
|
19
19
|
constructor(opts) {
|
|
20
20
|
this.pkg = opts.pkg || {};
|
|
21
|
-
this.agent = false;
|
|
21
|
+
this.agent = opts.agent || false;
|
|
22
22
|
this.client = false;
|
|
23
23
|
this.lang = opts.lang || 'en';
|
|
24
|
-
this.locale = opts.locale || '
|
|
24
|
+
this.locale = opts.locale || 'US';
|
|
25
25
|
this.currency = opts.currency || 'USD';
|
|
26
26
|
this.os = os;
|
|
27
27
|
this.fs = fs;
|
|
@@ -33,9 +33,6 @@ class LIB {
|
|
|
33
33
|
setClient(client) {
|
|
34
34
|
if (!this.client) this.client = client;
|
|
35
35
|
}
|
|
36
|
-
setAgent(agent) {
|
|
37
|
-
if (!this.agent) this.agent = agent;
|
|
38
|
-
}
|
|
39
36
|
|
|
40
37
|
help(msg, help_dir) {
|
|
41
38
|
return new Promise((resolve, reject) => {
|