@indra.ai/deva 1.5.7 → 1.5.9
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 +8 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -188,12 +188,10 @@ class Deva {
|
|
|
188
188
|
this.feature(key); // set the security state
|
|
189
189
|
try {
|
|
190
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
191
|
this.state('return', key); // set the security state
|
|
195
192
|
return data; // return the security feature
|
|
196
193
|
} catch (e) {
|
|
194
|
+
this.state('catch', key);
|
|
197
195
|
return this.error(e);
|
|
198
196
|
}
|
|
199
197
|
}
|
|
@@ -242,20 +240,20 @@ class Deva {
|
|
|
242
240
|
client presented data.
|
|
243
241
|
***************/
|
|
244
242
|
Feature(feature, resolve, reject) {
|
|
245
|
-
const
|
|
246
|
-
this.feature(feature,
|
|
247
|
-
this.zone(feature,
|
|
243
|
+
const _id = this.lib.uid();
|
|
244
|
+
this.feature(feature, _id);
|
|
245
|
+
this.zone(feature, _id);
|
|
248
246
|
const _cl = this.client(); // set local copy of client data
|
|
249
247
|
try {
|
|
250
248
|
if (!_cl.features[feature]) return resolve(); // if no security feature goto Support
|
|
251
249
|
else {
|
|
252
|
-
this.action(feature,
|
|
250
|
+
this.action(feature, _id); // set action to feature
|
|
253
251
|
const _fe = `_${feature}`;
|
|
254
252
|
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
255
253
|
const data = features[feature]; // make a copy the clinet data.
|
|
256
254
|
this.state('set', `feature:${id}`);
|
|
257
255
|
this[_fe] = { // set this_security with data
|
|
258
|
-
id, // uuid of the security feature
|
|
256
|
+
id: _id, // uuid of the security feature
|
|
259
257
|
client_id: id, // client id for reference
|
|
260
258
|
client_name: profile.name, // client name for personalization
|
|
261
259
|
concerns: data.concerns, // any concerns for client
|
|
@@ -263,11 +261,11 @@ class Deva {
|
|
|
263
261
|
personal: data.devas[this._agent.key], // Client personal features and rules.
|
|
264
262
|
};
|
|
265
263
|
delete this._client.features[feature]; // make a copy the clinet data.
|
|
266
|
-
this.state('resolve', `${feature}:${
|
|
264
|
+
this.state('resolve', `${feature}:${_id}`);
|
|
267
265
|
return resolve(feature); // resolve when done
|
|
268
266
|
}
|
|
269
267
|
} catch (e) {
|
|
270
|
-
this.state('catch', `${feature}:${
|
|
268
|
+
this.state('catch', `${feature}:${_id}`);
|
|
271
269
|
return this.error(e, feature, reject); // run error handling if an error is caught
|
|
272
270
|
}
|
|
273
271
|
}
|