@indra.ai/deva 1.3.5 → 1.3.6
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/config.json +10 -10
- package/index.js +55 -0
- package/package.json +1 -1
package/config.json
CHANGED
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"client": "👨💼 Client",
|
|
43
43
|
"agent": "🤖 Agent",
|
|
44
44
|
"security": "🔐 Security",
|
|
45
|
-
"support": "
|
|
46
|
-
"services": "
|
|
47
|
-
"systems": "
|
|
45
|
+
"support": "🚑 Support",
|
|
46
|
+
"services": "🚚 Services",
|
|
47
|
+
"systems": "🚛 Systems",
|
|
48
48
|
"legal": "🏛️ Legal",
|
|
49
|
-
"authority": "
|
|
49
|
+
"authority": "🚔 Authority",
|
|
50
50
|
"justice": "⚖️ Justice",
|
|
51
51
|
"help": "💚 Help",
|
|
52
52
|
"error": "❌ Error!"
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"abort": "💔 ABORT!",
|
|
110
110
|
"error": "❌ ERROR!",
|
|
111
111
|
"help": "💙 Help",
|
|
112
|
-
"authorized": "
|
|
112
|
+
"authorized": "🔑 authorized",
|
|
113
113
|
"unauthorized": "🏴☠️ unauthorized",
|
|
114
114
|
"Done": "☑️ Done",
|
|
115
115
|
"glitch": "😡 Glitch",
|
|
@@ -173,13 +173,13 @@
|
|
|
173
173
|
"ask": "📣 Ask",
|
|
174
174
|
|
|
175
175
|
"client": "👨 Client",
|
|
176
|
-
"security": "
|
|
177
|
-
"support": "
|
|
178
|
-
"services": "
|
|
179
|
-
"systems": "
|
|
176
|
+
"security": "🔐 Security",
|
|
177
|
+
"support": "🩹 Support",
|
|
178
|
+
"services": "🛠️ Services",
|
|
179
|
+
"systems": "📡 Systems",
|
|
180
180
|
"legal": "🗃️ Legal",
|
|
181
181
|
"justice": "🗄️ Justice",
|
|
182
|
-
"authority": "
|
|
182
|
+
"authority": "👮 Authority",
|
|
183
183
|
|
|
184
184
|
"invalid": "❌ Invalid",
|
|
185
185
|
"states": "🛻 States",
|
package/index.js
CHANGED
|
@@ -23,6 +23,7 @@ class Deva {
|
|
|
23
23
|
this._systems = false; // inherited Systems features.
|
|
24
24
|
this._legal = false; // inherited Legal features.
|
|
25
25
|
this._justice = false; // inherited Justice features.
|
|
26
|
+
this._authority = false; // inherited Justice features.
|
|
26
27
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
27
28
|
this.lib = new lib({}); // used for loading library functions
|
|
28
29
|
this.utils = opts.utils || {}; // parse function
|
|
@@ -417,6 +418,40 @@ class Deva {
|
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
420
|
|
|
421
|
+
/**************
|
|
422
|
+
func: Authority
|
|
423
|
+
params: client: false
|
|
424
|
+
describe:
|
|
425
|
+
The Authority feature sets the correct variables and necessary rules for the
|
|
426
|
+
client presented data.
|
|
427
|
+
***************/
|
|
428
|
+
Authority(resolve, reject) {
|
|
429
|
+
this.zone('authority')
|
|
430
|
+
this.action('authority');
|
|
431
|
+
const _cl = this.client(); // set local client
|
|
432
|
+
try {
|
|
433
|
+
if (!_cl.features.authority) return resolve(); // move to Done if no Systems feature
|
|
434
|
+
else {
|
|
435
|
+
this.state('set', 'Authority');
|
|
436
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
437
|
+
const {authority} = features; // set services from features const
|
|
438
|
+
this._authority = { // set this_services with data
|
|
439
|
+
id: this.lib.uid(true), // uuid of the services feature
|
|
440
|
+
client_id: id, // client id for reference
|
|
441
|
+
client_name: profile.name, // client name for personalization
|
|
442
|
+
concerns: authority.concerns, // any concerns for client
|
|
443
|
+
global: authority.global, // the global policies for client
|
|
444
|
+
personal: authority.devas[this._agent.key], // Client personal features and rules.
|
|
445
|
+
};
|
|
446
|
+
delete this._client.features.authority; // delete the services key for isolation
|
|
447
|
+
return resolve(); // go to Done
|
|
448
|
+
}
|
|
449
|
+
} catch (e) {
|
|
450
|
+
this.state('reject', 'Authority');
|
|
451
|
+
return this.error(e, false, reject); // run error handling if an error is caught
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
420
455
|
/**************
|
|
421
456
|
func: Done
|
|
422
457
|
params: none
|
|
@@ -769,6 +804,8 @@ class Deva {
|
|
|
769
804
|
return this.Legal(resolve, reject);
|
|
770
805
|
}).then(() => {
|
|
771
806
|
return this.Justice(resolve, reject);
|
|
807
|
+
}).then(() => {
|
|
808
|
+
return this.Authority(resolve, reject);
|
|
772
809
|
}).then(() => {
|
|
773
810
|
return this.Done(resolve, reject);
|
|
774
811
|
}).then(() => {
|
|
@@ -1368,6 +1405,24 @@ class Deva {
|
|
|
1368
1405
|
}
|
|
1369
1406
|
}
|
|
1370
1407
|
|
|
1408
|
+
/**************
|
|
1409
|
+
func: authority
|
|
1410
|
+
params: none
|
|
1411
|
+
describe: basic authority features available in a Deva.
|
|
1412
|
+
usage: this.systems()
|
|
1413
|
+
***************/
|
|
1414
|
+
authority() {
|
|
1415
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1416
|
+
this.zone('authority');
|
|
1417
|
+
this.feature('authority'); // set the support state
|
|
1418
|
+
try {
|
|
1419
|
+
this.state('return', 'authority'); // set the systems state
|
|
1420
|
+
return this.lib.copy(this._authority); // return the systems feature
|
|
1421
|
+
} catch (e) {
|
|
1422
|
+
return this.error(e); // return this.error when error catch
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1371
1426
|
/**************
|
|
1372
1427
|
func: load
|
|
1373
1428
|
params:
|