@indra.ai/deva 1.6.37 → 1.6.39
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 +7 -5
- package/lib/index.js +5 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -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;
|
|
@@ -1126,15 +1127,16 @@ class Deva {
|
|
|
1126
1127
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1127
1128
|
|
|
1128
1129
|
const client = this.client();
|
|
1129
|
-
|
|
1130
|
-
|
|
1130
|
+
this.lib.setClient(client.sha256);
|
|
1131
|
+
|
|
1132
|
+
const agent = this.agent();
|
|
1133
|
+
this.lib.setAgent(agent.sha256);
|
|
1134
|
+
|
|
1131
1135
|
this.state('ready', data.id.uid);
|
|
1132
1136
|
this.talk(config.events.ready, data);
|
|
1133
1137
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
1134
1138
|
}
|
|
1135
1139
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
1140
|
/**************
|
|
1139
1141
|
func: finish
|
|
1140
1142
|
params:
|
|
@@ -1626,7 +1628,7 @@ class Deva {
|
|
|
1626
1628
|
agent() {
|
|
1627
1629
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1628
1630
|
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1629
|
-
data.md5 = this.lib.hash(data);
|
|
1631
|
+
data.md5 = this.lib.hash(data, 'md5');
|
|
1630
1632
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1631
1633
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1632
1634
|
return data; // return the copy of the agent data.
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ class Node {
|
|
|
18
18
|
class LIB {
|
|
19
19
|
constructor(opts) {
|
|
20
20
|
this.pkg = opts.pkg || {};
|
|
21
|
-
this.agent =
|
|
21
|
+
this.agent = false;
|
|
22
22
|
this.client = false;
|
|
23
23
|
this.lang = opts.lang || 'en';
|
|
24
24
|
this.locale = opts.locale || 'en-US';
|
|
@@ -31,9 +31,11 @@ class LIB {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
setClient(client) {
|
|
34
|
-
console.log('lib set client');
|
|
35
34
|
if (!this.client) this.client = client;
|
|
36
35
|
}
|
|
36
|
+
setAgent(agent) {
|
|
37
|
+
if (!this.agent) this.agent = agent;
|
|
38
|
+
}
|
|
37
39
|
|
|
38
40
|
help(msg, help_dir) {
|
|
39
41
|
return new Promise((resolve, reject) => {
|
|
@@ -67,7 +69,6 @@ class LIB {
|
|
|
67
69
|
uid(guid=false) {
|
|
68
70
|
const time = Date.now(); // set time to local constant
|
|
69
71
|
const date = this.formatDate(time, 'long', true); // set date to local constant
|
|
70
|
-
const agent_hash = this.hash(this.agent, 'sha256');
|
|
71
72
|
const machine = {
|
|
72
73
|
arch: os.arch(),
|
|
73
74
|
hostname: os.hostname(),
|
|
@@ -88,7 +89,7 @@ class LIB {
|
|
|
88
89
|
uid: false,
|
|
89
90
|
time,
|
|
90
91
|
date,
|
|
91
|
-
agent:
|
|
92
|
+
agent: this.agent,
|
|
92
93
|
client: this.client,
|
|
93
94
|
pkg: pkg_hash,
|
|
94
95
|
machine: machine_hash,
|