@indra.ai/deva 1.4.10 → 1.4.11
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 +27 -81
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1192,6 +1192,8 @@ class Deva {
|
|
|
1192
1192
|
client() {
|
|
1193
1193
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1194
1194
|
const client_copy = this.lib.copy(this._client); // create a copy of the client data
|
|
1195
|
+
client_copy.hash = this.lib.hash(client_copy);
|
|
1196
|
+
client_copy.created = Date.now();
|
|
1195
1197
|
return client_copy; // return the copy of the client data.
|
|
1196
1198
|
}
|
|
1197
1199
|
|
|
@@ -1204,9 +1206,25 @@ class Deva {
|
|
|
1204
1206
|
agent() {
|
|
1205
1207
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1206
1208
|
const agent_copy = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1209
|
+
agent_copy.hash = this.lib.hash(agent_copy);
|
|
1210
|
+
agent_copy.created = Date.now();
|
|
1207
1211
|
return agent_copy; // return the copy of the agent data.
|
|
1208
1212
|
}
|
|
1209
1213
|
|
|
1214
|
+
_feature(key, value) {
|
|
1215
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1216
|
+
this.zone(key);
|
|
1217
|
+
this.feature(key); // set the security state
|
|
1218
|
+
try {
|
|
1219
|
+
const data = this.lib.copy(value);
|
|
1220
|
+
data.hash = this.lib.hash(value);
|
|
1221
|
+
data.created = Date.now();
|
|
1222
|
+
this.state('return', key); // set the security state
|
|
1223
|
+
return data; // return the security feature
|
|
1224
|
+
} catch (e) {
|
|
1225
|
+
return this.error(e);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1210
1228
|
// FEATURE FUNCTIONS
|
|
1211
1229
|
/**************
|
|
1212
1230
|
func: security
|
|
@@ -1215,15 +1233,7 @@ class Deva {
|
|
|
1215
1233
|
usage: this.security()
|
|
1216
1234
|
***************/
|
|
1217
1235
|
security() {
|
|
1218
|
-
|
|
1219
|
-
this.zone('security');
|
|
1220
|
-
this.feature('security'); // set the security state
|
|
1221
|
-
try {
|
|
1222
|
-
this.state('return', 'security'); // set the security state
|
|
1223
|
-
return this.lib.copy(this._security); // return the security feature
|
|
1224
|
-
} catch (e) {
|
|
1225
|
-
return this.error(e);
|
|
1226
|
-
}
|
|
1236
|
+
return this._feature('security', this._security);
|
|
1227
1237
|
}
|
|
1228
1238
|
|
|
1229
1239
|
/**************
|
|
@@ -1233,15 +1243,7 @@ class Deva {
|
|
|
1233
1243
|
usage: this.defense()
|
|
1234
1244
|
***************/
|
|
1235
1245
|
defense() {
|
|
1236
|
-
|
|
1237
|
-
this.zone('defense');
|
|
1238
|
-
this.feature('defense'); // set the defense state
|
|
1239
|
-
try {
|
|
1240
|
-
this.state('return', 'defense'); // set the defense state
|
|
1241
|
-
return this.lib.copy(this._defense); // return the defense feature
|
|
1242
|
-
} catch (e) {
|
|
1243
|
-
return this.error(e);
|
|
1244
|
-
}
|
|
1246
|
+
return this._feature('defense', this._defense);
|
|
1245
1247
|
}
|
|
1246
1248
|
|
|
1247
1249
|
/**************
|
|
@@ -1251,15 +1253,7 @@ class Deva {
|
|
|
1251
1253
|
usage: this.support()
|
|
1252
1254
|
***************/
|
|
1253
1255
|
support() {
|
|
1254
|
-
|
|
1255
|
-
this.zone('support');
|
|
1256
|
-
this.feature('support'); // set the support state
|
|
1257
|
-
try {
|
|
1258
|
-
this.state('return', 'support'); // set the action to support.
|
|
1259
|
-
return this.lib.copy(this._support); // return the support feature
|
|
1260
|
-
} catch (e) {
|
|
1261
|
-
return this.error(e); // return this.error when error catch
|
|
1262
|
-
}
|
|
1256
|
+
return this._feature('support', this._support);
|
|
1263
1257
|
}
|
|
1264
1258
|
|
|
1265
1259
|
/**************
|
|
@@ -1269,15 +1263,7 @@ class Deva {
|
|
|
1269
1263
|
usage: this.services()
|
|
1270
1264
|
***************/
|
|
1271
1265
|
services() {
|
|
1272
|
-
|
|
1273
|
-
this.zone('services');
|
|
1274
|
-
this.feature('services'); // set the support state
|
|
1275
|
-
try {
|
|
1276
|
-
this.state('return', 'services'); // set the services state
|
|
1277
|
-
return this.lib.copy(this._services); // return the services feature
|
|
1278
|
-
} catch (e) {
|
|
1279
|
-
return this.error(e); // return this.error when error catch
|
|
1280
|
-
}
|
|
1266
|
+
return this._feature('services', this._services);
|
|
1281
1267
|
}
|
|
1282
1268
|
|
|
1283
1269
|
/**************
|
|
@@ -1287,15 +1273,7 @@ class Deva {
|
|
|
1287
1273
|
usage: this.systems()
|
|
1288
1274
|
***************/
|
|
1289
1275
|
systems() {
|
|
1290
|
-
|
|
1291
|
-
this.zone('systems');
|
|
1292
|
-
this.feature('systems'); // set the support state
|
|
1293
|
-
try {
|
|
1294
|
-
this.state('return', 'systems'); // set the systems state
|
|
1295
|
-
return this.lib.copy(this._systems); // return the systems feature
|
|
1296
|
-
} catch (e) {
|
|
1297
|
-
return this.error(e); // return this.error when error catch
|
|
1298
|
-
}
|
|
1276
|
+
return this._feature('systems', this._systems);
|
|
1299
1277
|
}
|
|
1300
1278
|
|
|
1301
1279
|
/**************
|
|
@@ -1305,15 +1283,7 @@ class Deva {
|
|
|
1305
1283
|
usage: this.networks()
|
|
1306
1284
|
***************/
|
|
1307
1285
|
networks() {
|
|
1308
|
-
|
|
1309
|
-
this.zone('networks');
|
|
1310
|
-
this.feature('networks'); // set the support state
|
|
1311
|
-
try {
|
|
1312
|
-
this.state('return', 'networks'); // set the networks state
|
|
1313
|
-
return this.lib.copy(this._networks); // return the networks feature
|
|
1314
|
-
} catch (e) {
|
|
1315
|
-
return this.error(e); // return this.error when error catch
|
|
1316
|
-
}
|
|
1286
|
+
return this._feature('networks', this._networks);
|
|
1317
1287
|
}
|
|
1318
1288
|
|
|
1319
1289
|
/**************
|
|
@@ -1323,15 +1293,7 @@ class Deva {
|
|
|
1323
1293
|
usage: this.systems()
|
|
1324
1294
|
***************/
|
|
1325
1295
|
legal() {
|
|
1326
|
-
|
|
1327
|
-
this.zone('legal');
|
|
1328
|
-
this.feature('legal'); // set the support state
|
|
1329
|
-
try {
|
|
1330
|
-
this.state('return', 'legal'); // set the systems state
|
|
1331
|
-
return this.lib.copy(this._legal); // return the systems feature
|
|
1332
|
-
} catch (e) {
|
|
1333
|
-
return this.error(e); // return this.error when error catch
|
|
1334
|
-
}
|
|
1296
|
+
return this._feature('legal', this._legal);
|
|
1335
1297
|
}
|
|
1336
1298
|
|
|
1337
1299
|
/**************
|
|
@@ -1341,15 +1303,7 @@ class Deva {
|
|
|
1341
1303
|
usage: this.systems()
|
|
1342
1304
|
***************/
|
|
1343
1305
|
justice() {
|
|
1344
|
-
|
|
1345
|
-
this.zone('justice');
|
|
1346
|
-
this.feature('justice'); // set the support state
|
|
1347
|
-
try {
|
|
1348
|
-
this.state('return', 'justice'); // set the systems state
|
|
1349
|
-
return this.lib.copy(this._justice); // return the systems feature
|
|
1350
|
-
} catch (e) {
|
|
1351
|
-
return this.error(e); // return this.error when error catch
|
|
1352
|
-
}
|
|
1306
|
+
return this._feature('legal', this._legal);
|
|
1353
1307
|
}
|
|
1354
1308
|
|
|
1355
1309
|
/**************
|
|
@@ -1359,15 +1313,7 @@ class Deva {
|
|
|
1359
1313
|
usage: this.systems()
|
|
1360
1314
|
***************/
|
|
1361
1315
|
authority() {
|
|
1362
|
-
|
|
1363
|
-
this.zone('authority');
|
|
1364
|
-
this.feature('authority'); // set the support state
|
|
1365
|
-
try {
|
|
1366
|
-
this.state('return', 'authority'); // set the systems state
|
|
1367
|
-
return this.lib.copy(this._authority); // return the systems feature
|
|
1368
|
-
} catch (e) {
|
|
1369
|
-
return this.error(e); // return this.error when error catch
|
|
1370
|
-
}
|
|
1316
|
+
return this._feature('authority', this._authority);
|
|
1371
1317
|
}
|
|
1372
1318
|
|
|
1373
1319
|
/**************
|