@indra.ai/deva 1.5.48 → 1.5.50
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 +20 -9
- package/lib/index.js +3 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -172,20 +172,31 @@ class Deva {
|
|
|
172
172
|
This will return a not found text string preventing any furhter processing.
|
|
173
173
|
***************/
|
|
174
174
|
_methodNotFound(packet) {
|
|
175
|
+
const id = this.lib.uid();
|
|
176
|
+
const agent = this.agent() || false;
|
|
177
|
+
const client = this.client() || false;
|
|
178
|
+
const {meta, params} = packet.q;
|
|
179
|
+
const text = `${this._messages.method_not_found} ${agent.key} ${meta.method}`
|
|
175
180
|
packet.a = {
|
|
176
|
-
id
|
|
177
|
-
agent
|
|
178
|
-
client
|
|
179
|
-
text
|
|
181
|
+
id,
|
|
182
|
+
agent,
|
|
183
|
+
client,
|
|
184
|
+
text,
|
|
180
185
|
meta: {
|
|
181
|
-
key:
|
|
182
|
-
method:
|
|
186
|
+
key: agent.key,
|
|
187
|
+
method: meta.method,
|
|
183
188
|
},
|
|
184
189
|
created: Date.now(),
|
|
185
190
|
};
|
|
186
|
-
packet.a.
|
|
187
|
-
|
|
188
|
-
packet.
|
|
191
|
+
packet.a.md5 = this.lib.hash(packet.a, 'md5');
|
|
192
|
+
packet.a.sha256 = this.lib.hash(packet.a, 'sha256');
|
|
193
|
+
packet.a.sha512 = this.lib.hash(packet.a, 'sha512');
|
|
194
|
+
|
|
195
|
+
delete packet.md5;
|
|
196
|
+
delete packet.sha256;
|
|
197
|
+
delete packet.sha512;
|
|
198
|
+
|
|
199
|
+
packet.md5 = this.lib.hash(packet, 'md5');
|
|
189
200
|
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
190
201
|
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
191
202
|
|
package/lib/index.js
CHANGED
|
@@ -59,9 +59,9 @@ class LIB {
|
|
|
59
59
|
id = randomUUID()
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
const min = Math.floor(Date.now() - (Date.now() / Math.PI))
|
|
63
|
-
const max = Math.
|
|
64
|
-
id = Math.floor(Math.random() * (max - min)) + min;
|
|
62
|
+
const min = `${Math.floor(Date.now() - (Date.now() / Math.PI))}00000`;
|
|
63
|
+
const max = `${Math.ceil(Date.now() + (Date.now() * Math.PI))}99999`;
|
|
64
|
+
id = Math.floor(Math.random() * (Number(max) - Number(min))) + Number(min);
|
|
65
65
|
}
|
|
66
66
|
return id;
|
|
67
67
|
}
|