@indra.ai/deva 1.4.12 → 1.4.14

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.
Files changed (2) hide show
  1. package/index.js +26 -24
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -182,6 +182,23 @@ class Deva {
182
182
  return packet;
183
183
  }
184
184
 
185
+ _getFeature(key, value) {
186
+ if (!this._active) return this._messages.offline; // check the active status
187
+ this.zone(key);
188
+ this.feature(key); // set the security state
189
+ try {
190
+ const data = this.lib.copy(value);
191
+ data.id = this.lib.uid();
192
+ data.hash = this.lib.hash(value);
193
+ data.created = Date.now();
194
+ this.state('return', key); // set the security state
195
+ return data; // return the security feature
196
+ } catch (e) {
197
+ return this.error(e);
198
+ }
199
+ }
200
+
201
+
185
202
  /**************
186
203
  func: Client
187
204
  params: client - client provided data.
@@ -1211,21 +1228,6 @@ class Deva {
1211
1228
  return agent_copy; // return the copy of the agent data.
1212
1229
  }
1213
1230
 
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.id = this.lib.uid();
1221
- data.hash = this.lib.hash(value);
1222
- data.created = Date.now();
1223
- this.state('return', key); // set the security state
1224
- return data; // return the security feature
1225
- } catch (e) {
1226
- return this.error(e);
1227
- }
1228
- }
1229
1231
  // FEATURE FUNCTIONS
1230
1232
  /**************
1231
1233
  func: security
@@ -1234,7 +1236,7 @@ class Deva {
1234
1236
  usage: this.security()
1235
1237
  ***************/
1236
1238
  security() {
1237
- return this._feature('security', this._security);
1239
+ return this._getFeature('security', this._security);
1238
1240
  }
1239
1241
 
1240
1242
  /**************
@@ -1244,7 +1246,7 @@ class Deva {
1244
1246
  usage: this.defense()
1245
1247
  ***************/
1246
1248
  defense() {
1247
- return this._feature('defense', this._defense);
1249
+ return this._getFeature('defense', this._defense);
1248
1250
  }
1249
1251
 
1250
1252
  /**************
@@ -1254,7 +1256,7 @@ class Deva {
1254
1256
  usage: this.support()
1255
1257
  ***************/
1256
1258
  support() {
1257
- return this._feature('support', this._support);
1259
+ return this._getFeature('support', this._support);
1258
1260
  }
1259
1261
 
1260
1262
  /**************
@@ -1264,7 +1266,7 @@ class Deva {
1264
1266
  usage: this.services()
1265
1267
  ***************/
1266
1268
  services() {
1267
- return this._feature('services', this._services);
1269
+ return this._getFeature('services', this._services);
1268
1270
  }
1269
1271
 
1270
1272
  /**************
@@ -1274,7 +1276,7 @@ class Deva {
1274
1276
  usage: this.systems()
1275
1277
  ***************/
1276
1278
  systems() {
1277
- return this._feature('systems', this._systems);
1279
+ return this._getFeature('systems', this._systems);
1278
1280
  }
1279
1281
 
1280
1282
  /**************
@@ -1284,7 +1286,7 @@ class Deva {
1284
1286
  usage: this.networks()
1285
1287
  ***************/
1286
1288
  networks() {
1287
- return this._feature('networks', this._networks);
1289
+ return this._getFeature('networks', this._networks);
1288
1290
  }
1289
1291
 
1290
1292
  /**************
@@ -1294,7 +1296,7 @@ class Deva {
1294
1296
  usage: this.systems()
1295
1297
  ***************/
1296
1298
  legal() {
1297
- return this._feature('legal', this._legal);
1299
+ return this._getFeature('legal', this._legal);
1298
1300
  }
1299
1301
 
1300
1302
  /**************
@@ -1304,7 +1306,7 @@ class Deva {
1304
1306
  usage: this.systems()
1305
1307
  ***************/
1306
1308
  justice() {
1307
- return this._feature('legal', this._legal);
1309
+ return this._getFeature('legal', this._legal);
1308
1310
  }
1309
1311
 
1310
1312
  /**************
@@ -1314,7 +1316,7 @@ class Deva {
1314
1316
  usage: this.systems()
1315
1317
  ***************/
1316
1318
  authority() {
1317
- return this._feature('authority', this._authority);
1319
+ return this._getFeature('authority', this._authority);
1318
1320
  }
1319
1321
 
1320
1322
  /**************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "type": "module",