@indra.ai/deva 1.6.90 → 1.6.91
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 +41 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1169,11 +1169,12 @@ class Deva {
|
|
|
1169
1169
|
usage: this.ready(data, resolve)
|
|
1170
1170
|
***************/
|
|
1171
1171
|
ready(data, resolve) {
|
|
1172
|
+
if (!this._active) return resolve(this._messages.offline);
|
|
1172
1173
|
this.context('ready', data.id.uid);
|
|
1173
1174
|
this.zone('ready', data.id.uid);
|
|
1174
|
-
if (!this._active) return resolve(this._messages.offline);
|
|
1175
|
-
|
|
1176
1175
|
this.action('ready', data.id.uid);
|
|
1176
|
+
this.state('ready', data.id.uid);
|
|
1177
|
+
|
|
1177
1178
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
1178
1179
|
|
|
1179
1180
|
// Delete previous data hashes
|
|
@@ -1187,9 +1188,9 @@ class Deva {
|
|
|
1187
1188
|
data.sha256 = this.hash(data, 'sha256');
|
|
1188
1189
|
data.sha512 = this.hash(data, 'sha512');
|
|
1189
1190
|
|
|
1190
|
-
this.state('ready', data.id.uid);
|
|
1191
1191
|
this.talk(this._events.ready, data);
|
|
1192
|
-
|
|
1192
|
+
|
|
1193
|
+
this.action('return', `ready:${data.id.uid}`); // return action ready
|
|
1193
1194
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
1194
1195
|
}
|
|
1195
1196
|
|
|
@@ -1205,22 +1206,35 @@ class Deva {
|
|
|
1205
1206
|
if (!this._active) return resolve(this._messages.offline); //
|
|
1206
1207
|
this.context('finish', data.id.uid);
|
|
1207
1208
|
this.zone('finish', data.id.uid); // enter finish zone
|
|
1208
|
-
|
|
1209
1209
|
this.action('finish', data.id.uid); // start finish action
|
|
1210
|
-
|
|
1210
|
+
this.state('finish', data.id.uid); // set finish state
|
|
1211
1211
|
|
|
1212
|
+
this.action('delete', `answer:md5:${data.id.uid}`);
|
|
1212
1213
|
delete data.md5;
|
|
1214
|
+
this.action('delete', `answer:sha256:${data.id.uid}`);
|
|
1213
1215
|
delete data.sha256;
|
|
1216
|
+
this.action('delete', `answer:sha512:${data.id.uid}`);
|
|
1214
1217
|
delete data.sha512;
|
|
1215
1218
|
|
|
1216
1219
|
data.finish = Date.now(); // set the finish timestamp
|
|
1220
|
+
this.state('set', `data:finish:${data.finish}:${data.id.uid}`)
|
|
1217
1221
|
|
|
1222
|
+
this.action('hash', `finish:md5:${data.id.uid}`);
|
|
1218
1223
|
data.md5 = this.hash(data);
|
|
1224
|
+
this.action('hash', `finish:sha256:${data.id.uid}`)
|
|
1219
1225
|
data.sha256 = this.hash(data, 'sha256');
|
|
1226
|
+
|
|
1227
|
+
this.action('hash', `finish:sha512:${data.id.uid}`)
|
|
1220
1228
|
data.sha512 = this.hash(data, 'sha512');
|
|
1221
1229
|
|
|
1222
|
-
this.
|
|
1223
|
-
this.
|
|
1230
|
+
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
|
|
1231
|
+
if (hasOnFinish) this.state('set', `hasOnFinish:${data.id.uid}`); // state set to watch OnFinish
|
|
1232
|
+
|
|
1233
|
+
// setup the finish talk event
|
|
1234
|
+
this.action('talk', `${this._events.finish}:${data.id.uid}`);
|
|
1235
|
+
this.talk(this._events.finish, data);
|
|
1236
|
+
|
|
1237
|
+
this.action('return', `finish:${data.id.uid}`); // return action finish
|
|
1224
1238
|
return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
|
|
1225
1239
|
}
|
|
1226
1240
|
|
|
@@ -1237,21 +1251,36 @@ class Deva {
|
|
|
1237
1251
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1238
1252
|
this.context('complete', data.id.uid);
|
|
1239
1253
|
this.zone('complete', data.id.uid);
|
|
1240
|
-
|
|
1241
1254
|
this.action('complete', data.id.uid);
|
|
1242
|
-
|
|
1255
|
+
this.state('complete', data.id.uid);
|
|
1243
1256
|
|
|
1257
|
+
this.action('delete', `finish:md5:${data.id.uid}`);
|
|
1244
1258
|
delete data.md5;
|
|
1259
|
+
this.action('delete', `finish:sha256:${data.id.uid}`);
|
|
1245
1260
|
delete data.sha256;
|
|
1261
|
+
this.action('delete', `finish:sha512:${data.id.uid}`);
|
|
1246
1262
|
delete data.sha512;
|
|
1247
1263
|
|
|
1248
1264
|
data.complete = Date.now();// set the complete date on the whole data.
|
|
1265
|
+
this.state('set', `data:complete:${data.complete}:${data.id.uid}`)
|
|
1266
|
+
|
|
1267
|
+
this.action('hash', `complete:md5:${data.id.uid}`);
|
|
1249
1268
|
data.md5 = this.hash(data);
|
|
1269
|
+
this.action('hash', `complete:sha256:${data.id.uid}`)
|
|
1250
1270
|
data.sha256 = this.hash(data, 'sha256');
|
|
1271
|
+
|
|
1272
|
+
this.action('hash', `complete:sha512:${data.id.uid}`)
|
|
1251
1273
|
data.sha512 = this.hash(data, 'sha512');
|
|
1252
1274
|
|
|
1253
|
-
|
|
1254
|
-
this.
|
|
1275
|
+
// determine if there is an onComplete function for the entity.
|
|
1276
|
+
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
1277
|
+
if (hasOnComplete) this.state('set', `hasOnComplete:${data.id.uid}`); // state set to watch OnFinish
|
|
1278
|
+
|
|
1279
|
+
// setup the complete talk event
|
|
1280
|
+
this.action('talk', `${this._events.complete}:${data.id.uid}`); // action talk for the event.
|
|
1281
|
+
this.talk(this._events.complete, data); // talk the complete event
|
|
1282
|
+
|
|
1283
|
+
this.action('return', `complete:${data.id.uid}`); // return action complete
|
|
1255
1284
|
return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
|
|
1256
1285
|
}
|
|
1257
1286
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "44091450722329207445",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.91",
|
|
5
5
|
"description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:44091450722329207445 LICENSE.md",
|