@indra.ai/deva 1.3.6 โ 1.3.7
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 +67 -62
- package/index.js +48 -170
- package/package.json +1 -1
- package/tests/index.js +8 -7
package/config.json
CHANGED
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"zones": {
|
|
33
33
|
"load": "๐ Load",
|
|
34
34
|
"unload": "๐ป Unload",
|
|
35
|
-
"init": "๐
|
|
35
|
+
"init": "๐ Init",
|
|
36
36
|
"start": "๐๏ธ Start",
|
|
37
37
|
"stop": "๐ Stop",
|
|
38
38
|
"enter": "๐ก Enter",
|
|
39
39
|
"exit": "๐ช Exit",
|
|
40
40
|
"finish": "๐ Finish",
|
|
41
41
|
"deva": "โก๏ธ Deva",
|
|
42
|
-
"client": "
|
|
42
|
+
"client": "๐จ Client",
|
|
43
43
|
"agent": "๐ค Agent",
|
|
44
44
|
"security": "๐ Security",
|
|
45
45
|
"support": "๐ Support",
|
|
@@ -47,55 +47,55 @@
|
|
|
47
47
|
"systems": "๐ Systems",
|
|
48
48
|
"legal": "๐๏ธ Legal",
|
|
49
49
|
"authority": "๐ Authority",
|
|
50
|
-
"justice": "โ๏ธ
|
|
50
|
+
"justice": "โ๏ธ Justice",
|
|
51
51
|
"help": "๐ Help",
|
|
52
52
|
"error": "โ Error!"
|
|
53
53
|
},
|
|
54
54
|
"state": "offline",
|
|
55
55
|
"states": {
|
|
56
|
-
"online": "๐คฉ
|
|
57
|
-
"offline": "๐ด
|
|
58
|
-
"active": "๐
|
|
59
|
-
"inactive": "๐ซฅ
|
|
60
|
-
"idle": "๐
|
|
61
|
-
"talk": "๐ข
|
|
62
|
-
"listen": "๐
|
|
63
|
-
"ask": "๐ฃ๏ธ
|
|
64
|
-
"question": "๐ฌ
|
|
65
|
-
"cmd": "๐ช
|
|
66
|
-
"answer": "๐ก
|
|
67
|
-
"ready": "๐
|
|
68
|
-
"wait": "โณ
|
|
69
|
-
"pause": "โธ๏ธ
|
|
70
|
-
"resume": "๐
|
|
71
|
-
"connect": "๐ณ
|
|
72
|
-
"disconnect": "๐ด
|
|
73
|
-
"send": "๐ฌ
|
|
74
|
-
"receive": "๐ช
|
|
75
|
-
"init": "๐
|
|
76
|
-
"forward": "โญ๏ธ
|
|
77
|
-
"backward": "โฎ๏ธ
|
|
78
|
-
"start": "๐
|
|
79
|
-
"stop": "โน๏ธ
|
|
80
|
-
"open": "๐ฅซ
|
|
81
|
-
"close": "๐ฆ
|
|
82
|
-
"enter": "๐ก
|
|
83
|
-
"exit": "๐ช
|
|
84
|
-
"begin": "๐บ๏ธ
|
|
85
|
-
"end": "๐ฌ
|
|
86
|
-
"load": "๐
|
|
87
|
-
"unload": "๐ป
|
|
88
|
-
"resolve": "
|
|
89
|
-
"reject": "๐งฑ
|
|
90
|
-
"done": "๐
|
|
91
|
-
"data": "๐ก
|
|
92
|
-
"finish": "๐
|
|
93
|
-
"complete": "
|
|
94
|
-
"create": "๐จ
|
|
95
|
-
"destroy": "๐ฃ
|
|
96
|
-
"write": "๐
|
|
97
|
-
"save": "๐พ
|
|
98
|
-
"delete": "๐งจ
|
|
56
|
+
"online": "๐คฉ Online",
|
|
57
|
+
"offline": "๐ด Offline",
|
|
58
|
+
"active": "๐ Active",
|
|
59
|
+
"inactive": "๐ซฅ Inactive",
|
|
60
|
+
"idle": "๐ Idle",
|
|
61
|
+
"talk": "๐ข Talk",
|
|
62
|
+
"listen": "๐ Listen",
|
|
63
|
+
"ask": "๐ฃ๏ธ Ask",
|
|
64
|
+
"question": "๐ฌ Question",
|
|
65
|
+
"cmd": "๐ช Command",
|
|
66
|
+
"answer": "๐ก Answer",
|
|
67
|
+
"ready": "๐ Ready",
|
|
68
|
+
"wait": "โณ Waiting",
|
|
69
|
+
"pause": "โธ๏ธ Pause",
|
|
70
|
+
"resume": "๐ Resume",
|
|
71
|
+
"connect": "๐ณ Connect",
|
|
72
|
+
"disconnect": "๐ด Disconnect",
|
|
73
|
+
"send": "๐ฌ Send",
|
|
74
|
+
"receive": "๐ช Receive",
|
|
75
|
+
"init": "๐ Init",
|
|
76
|
+
"forward": "โญ๏ธ Forward",
|
|
77
|
+
"backward": "โฎ๏ธ Backward",
|
|
78
|
+
"start": "๐ Start",
|
|
79
|
+
"stop": "โน๏ธ Stop",
|
|
80
|
+
"open": "๐ฅซ Open",
|
|
81
|
+
"close": "๐ฆ Close",
|
|
82
|
+
"enter": "๐ก Enter",
|
|
83
|
+
"exit": "๐ช Exit",
|
|
84
|
+
"begin": "๐บ๏ธ Begin",
|
|
85
|
+
"end": "๐ฌ End",
|
|
86
|
+
"load": "๐ Load",
|
|
87
|
+
"unload": "๐ป Unload",
|
|
88
|
+
"resolve": "๐ค Resolve",
|
|
89
|
+
"reject": "๐งฑ Reject",
|
|
90
|
+
"done": "๐ Done",
|
|
91
|
+
"data": "๐ก Data",
|
|
92
|
+
"finish": "๐ Finish",
|
|
93
|
+
"complete": "โ
Complete",
|
|
94
|
+
"create": "๐จ Create",
|
|
95
|
+
"destroy": "๐ฃ Destroy",
|
|
96
|
+
"write": "๐ Write",
|
|
97
|
+
"save": "๐พ Save",
|
|
98
|
+
"delete": "๐งจ Delete",
|
|
99
99
|
"set": "๐ Set",
|
|
100
100
|
"get": "๐ซด Get",
|
|
101
101
|
"put": "๐ค Put",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"abort": "๐ ABORT!",
|
|
110
110
|
"error": "โ ERROR!",
|
|
111
111
|
"help": "๐ Help",
|
|
112
|
-
"authorized": "๐
|
|
113
|
-
"unauthorized": "๐ดโโ ๏ธ
|
|
112
|
+
"authorized": "๐ Authorized",
|
|
113
|
+
"unauthorized": "๐ดโโ ๏ธ Unauthorized",
|
|
114
114
|
"Done": "โ๏ธ Done",
|
|
115
115
|
"glitch": "๐ก Glitch",
|
|
116
116
|
"intruder": "๐ฆนโโ๏ธ Intruder",
|
|
@@ -125,20 +125,19 @@
|
|
|
125
125
|
},
|
|
126
126
|
"action": false,
|
|
127
127
|
"actions": {
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"question": "๐ question",
|
|
128
|
+
"init": "๐ Init",
|
|
129
|
+
"wait": "โณ Waiting",
|
|
130
|
+
"start": "๐ฌ Start",
|
|
131
|
+
"enter": "๐ก Enter",
|
|
132
|
+
"exit": "๐ช Exit",
|
|
133
|
+
"stop": "๐ Stop",
|
|
134
|
+
"load": "๐ฆ Load",
|
|
135
|
+
"unload": "๐ฅก Unload",
|
|
136
|
+
"finish": "๐ Finish",
|
|
137
|
+
"complete": "โ
Complete",
|
|
138
|
+
"done": "โ๏ธ Done",
|
|
139
|
+
"ready": "๐ข Ready",
|
|
140
|
+
"question": "๐ Question",
|
|
142
141
|
"talk": "๐ข talk",
|
|
143
142
|
"context": "๐ context",
|
|
144
143
|
"prompt": "๐ prompt",
|
|
@@ -173,6 +172,7 @@
|
|
|
173
172
|
"ask": "๐ฃ Ask",
|
|
174
173
|
|
|
175
174
|
"client": "๐จ Client",
|
|
175
|
+
"agent": "๐ต๏ธโโ๏ธ Agent",
|
|
176
176
|
"security": "๐ Security",
|
|
177
177
|
"support": "๐ฉน Support",
|
|
178
178
|
"services": "๐ ๏ธ Services",
|
|
@@ -203,10 +203,15 @@
|
|
|
203
203
|
},
|
|
204
204
|
"feature": false,
|
|
205
205
|
"features": {
|
|
206
|
+
"client": "๐จ Client",
|
|
207
|
+
"init": "๐ Init",
|
|
206
208
|
"security": "๐ Security",
|
|
207
209
|
"support": "๐ผ Support",
|
|
208
210
|
"services": "๐ ๏ธ Services",
|
|
209
211
|
"systems": "๐ฅ๏ธ๏ธ Systems",
|
|
212
|
+
"legal": "๐๏ธ๏ธ๏ธ Legal",
|
|
213
|
+
"justice": "๐๏ธ๏ธ Justice",
|
|
214
|
+
"authority": "๐๏ธ๏ธ Authority",
|
|
210
215
|
"cipher": "๐ Cipher",
|
|
211
216
|
"decipher": "๐ Decipher",
|
|
212
217
|
"promp": "๐ชต Prompt",
|
package/index.js
CHANGED
|
@@ -192,6 +192,8 @@ class Deva {
|
|
|
192
192
|
this.Client = {data}
|
|
193
193
|
***************/
|
|
194
194
|
Client(client, resolve, reject) {
|
|
195
|
+
this.feature('client');
|
|
196
|
+
this.zone('client');
|
|
195
197
|
this.action('client');
|
|
196
198
|
// setup any custom methods for the features
|
|
197
199
|
try {
|
|
@@ -205,7 +207,9 @@ class Deva {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
const _client = this.lib.copy(client); // copy the client parameter
|
|
210
|
+
this.state('set', 'client');
|
|
208
211
|
this._client = _client; // set local _client to this scope
|
|
212
|
+
this.state('resolve', 'client');
|
|
209
213
|
return resolve();
|
|
210
214
|
} catch (e) {
|
|
211
215
|
return this.error(e, false, reject);
|
|
@@ -213,41 +217,53 @@ class Deva {
|
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
/**************
|
|
216
|
-
func:
|
|
220
|
+
func: Feature
|
|
217
221
|
params: client: false
|
|
218
222
|
describe:
|
|
219
223
|
The Security feature sets the correct variables and necessary rules for the
|
|
220
224
|
client presented data.
|
|
221
225
|
***************/
|
|
222
|
-
|
|
223
|
-
this.
|
|
224
|
-
this.
|
|
226
|
+
Feature(feature, resolve, reject) {
|
|
227
|
+
this.feature(feature);
|
|
228
|
+
this.zone(feature);
|
|
225
229
|
const _cl = this.client(); // set local copy of client data
|
|
226
230
|
try {
|
|
227
|
-
if (!_cl.features
|
|
231
|
+
if (!_cl.features[feature]) return resolve(); // if no security feature goto Support
|
|
228
232
|
else {
|
|
229
|
-
this.
|
|
233
|
+
this.action(feature); // set action to feature
|
|
234
|
+
const _fe = `_${feature}`;
|
|
230
235
|
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
231
|
-
const
|
|
232
|
-
this.
|
|
236
|
+
const data = features[feature]; // make a copy the clinet data.
|
|
237
|
+
this.state('set', feature);
|
|
238
|
+
this[_fe] = { // set this_security with data
|
|
233
239
|
id: this.lib.uid(true), // uuid of the security feature
|
|
234
240
|
client_id: id, // client id for reference
|
|
235
241
|
client_name: profile.name, // client name for personalization
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
global: security.global, // the global policies for client
|
|
240
|
-
personal: security.devas[this._agent.key], // Client personal features and rules.
|
|
242
|
+
concerns: data.concerns, // any concerns for client
|
|
243
|
+
global: data.global, // the global policies for client
|
|
244
|
+
personal: data.devas[this._agent.key], // Client personal features and rules.
|
|
241
245
|
};
|
|
242
|
-
delete this._client.features
|
|
243
|
-
|
|
246
|
+
delete this._client.features[feature]; // make a copy the clinet data.
|
|
247
|
+
this.state('resolve', feature);
|
|
248
|
+
return resolve(feature); // resolve when done
|
|
244
249
|
}
|
|
245
250
|
} catch (e) {
|
|
246
|
-
this.state('reject',
|
|
247
|
-
return this.error(e); // run error handling if an error is caught
|
|
251
|
+
this.state('reject', feature);
|
|
252
|
+
return this.error(e, feature, reject); // run error handling if an error is caught
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
255
|
|
|
256
|
+
/**************
|
|
257
|
+
func: Security
|
|
258
|
+
params: client: false
|
|
259
|
+
describe:
|
|
260
|
+
The Security feature sets the correct variables and necessary rules for the
|
|
261
|
+
client presented data.
|
|
262
|
+
***************/
|
|
263
|
+
Security(resolve, reject) {
|
|
264
|
+
return this.Feature('security', resolve, reject);
|
|
265
|
+
}
|
|
266
|
+
|
|
251
267
|
/**************
|
|
252
268
|
func: Support
|
|
253
269
|
params: client: false
|
|
@@ -256,30 +272,7 @@ class Deva {
|
|
|
256
272
|
client presented data.
|
|
257
273
|
***************/
|
|
258
274
|
Support(resolve, reject) {
|
|
259
|
-
this.
|
|
260
|
-
this.action('support');
|
|
261
|
-
const _cl = this.client(); // set the local client variable
|
|
262
|
-
try {
|
|
263
|
-
if (!_cl.features.support) return resolve() // move to Services if no support feature
|
|
264
|
-
else {
|
|
265
|
-
this.state('set', 'Support');
|
|
266
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
267
|
-
const {support} = features; // set support from features const
|
|
268
|
-
this._support = { // set this_support with data
|
|
269
|
-
id: this.lib.uid(true), // uuid of the support feature
|
|
270
|
-
client_id: id, // client id for reference
|
|
271
|
-
client_name: profile.name, // client name for personalization
|
|
272
|
-
concerns: support.concerns, // any concerns for client
|
|
273
|
-
global: support.global, // the global policies for client
|
|
274
|
-
personal: support.devas[this._agent.key], // Client personalSecurity features and rules.
|
|
275
|
-
};
|
|
276
|
-
delete this._client.features.support; // delete the support key from the client
|
|
277
|
-
return resolve(); // when done move to Services
|
|
278
|
-
}
|
|
279
|
-
} catch (e) {
|
|
280
|
-
this.state('reject', 'Services');
|
|
281
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
282
|
-
}
|
|
275
|
+
return this.Feature('support', resolve, reject);
|
|
283
276
|
}
|
|
284
277
|
|
|
285
278
|
/**************
|
|
@@ -290,30 +283,7 @@ class Deva {
|
|
|
290
283
|
client presented data.
|
|
291
284
|
***************/
|
|
292
285
|
Services(resolve, reject) {
|
|
293
|
-
this.
|
|
294
|
-
this.action('services');
|
|
295
|
-
const _cl = this.client(); // set local client
|
|
296
|
-
try {
|
|
297
|
-
if (!_cl.features.services) return resolve(); // move to Done if no Services feature
|
|
298
|
-
else {
|
|
299
|
-
this.state('set', 'Services');
|
|
300
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
301
|
-
const {services} = features; // set services from features const
|
|
302
|
-
this._services = { // set this_services with data
|
|
303
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
304
|
-
client_id: id, // client id for reference
|
|
305
|
-
client_name: profile.name, // client name for personalization
|
|
306
|
-
concerns: services.concerns, // any concerns for client
|
|
307
|
-
global: services.global, // the global policies for client
|
|
308
|
-
personal: services.devas[this._agent.key], // Client personal features and rules.
|
|
309
|
-
};
|
|
310
|
-
delete this._client.features.services; // delete the services key for isolation
|
|
311
|
-
return resolve(); // go to Done
|
|
312
|
-
}
|
|
313
|
-
} catch (e) {
|
|
314
|
-
this.state('reject', 'Services');
|
|
315
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
316
|
-
}
|
|
286
|
+
return this.Feature('services', resolve, reject);
|
|
317
287
|
}
|
|
318
288
|
|
|
319
289
|
/**************
|
|
@@ -324,30 +294,7 @@ class Deva {
|
|
|
324
294
|
client presented data.
|
|
325
295
|
***************/
|
|
326
296
|
Systems(resolve, reject) {
|
|
327
|
-
this.
|
|
328
|
-
this.action('systems');
|
|
329
|
-
const _cl = this.client(); // set local client
|
|
330
|
-
try {
|
|
331
|
-
if (!_cl.features.systems) return resolve(); // move to Done if no Systems feature
|
|
332
|
-
else {
|
|
333
|
-
this.state('set', 'Systems');
|
|
334
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
335
|
-
const {systems} = features; // set systems from features const
|
|
336
|
-
this._systems = { // set this_systems with data
|
|
337
|
-
id: this.lib.uid(true), // uuid of the systems feature
|
|
338
|
-
client_id: id, // client id for reference
|
|
339
|
-
client_name: profile.name, // client name for personalization
|
|
340
|
-
concerns: systems.concerns, // any concerns for client
|
|
341
|
-
global: systems.global, // the global policies for client
|
|
342
|
-
personal: systems.devas[this._agent.key], // Client personal features and rules.
|
|
343
|
-
};
|
|
344
|
-
delete this._client.features.systems; // delete the services key for isolation
|
|
345
|
-
return resolve(); // go to Done
|
|
346
|
-
}
|
|
347
|
-
} catch (e) {
|
|
348
|
-
this.state('reject', 'Systems');
|
|
349
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
350
|
-
}
|
|
297
|
+
return this.Feature('systems', resolve, reject);
|
|
351
298
|
}
|
|
352
299
|
|
|
353
300
|
/**************
|
|
@@ -358,30 +305,7 @@ class Deva {
|
|
|
358
305
|
client presented data.
|
|
359
306
|
***************/
|
|
360
307
|
Legal(resolve, reject) {
|
|
361
|
-
this.
|
|
362
|
-
this.action('legal');
|
|
363
|
-
const _cl = this.client(); // set local client
|
|
364
|
-
try {
|
|
365
|
-
if (!_cl.features.legal) return resolve(); // move to Done if no Systems feature
|
|
366
|
-
else {
|
|
367
|
-
this.state('set', 'Legal');
|
|
368
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
369
|
-
const {legal} = features; // set services from features const
|
|
370
|
-
this._legal = { // set this_services with data
|
|
371
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
372
|
-
client_id: id, // client id for reference
|
|
373
|
-
client_name: profile.name, // client name for personalization
|
|
374
|
-
concerns: legal.concerns, // any concerns for client
|
|
375
|
-
global: legal.global, // the global policies for client
|
|
376
|
-
personal: legal.devas[this._agent.key], // Client personal features and rules.
|
|
377
|
-
};
|
|
378
|
-
delete this._client.features.legal; // delete the services key for isolation
|
|
379
|
-
return resolve(); // go to Done
|
|
380
|
-
}
|
|
381
|
-
} catch (e) {
|
|
382
|
-
this.state('reject', 'Legal');
|
|
383
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
384
|
-
}
|
|
308
|
+
return this.Feature('legal', resolve, reject);
|
|
385
309
|
}
|
|
386
310
|
|
|
387
311
|
/**************
|
|
@@ -392,30 +316,7 @@ class Deva {
|
|
|
392
316
|
client presented data.
|
|
393
317
|
***************/
|
|
394
318
|
Justice(resolve, reject) {
|
|
395
|
-
this.
|
|
396
|
-
this.action('justice');
|
|
397
|
-
const _cl = this.client(); // set local client
|
|
398
|
-
try {
|
|
399
|
-
if (!_cl.features.justice) return resolve(); // move to Done if no Systems feature
|
|
400
|
-
else {
|
|
401
|
-
this.state('set', 'Justice');
|
|
402
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
403
|
-
const {justice} = features; // set services from features const
|
|
404
|
-
this._justice = { // set this_services with data
|
|
405
|
-
id: this.lib.uid(true), // uuid of the services feature
|
|
406
|
-
client_id: id, // client id for reference
|
|
407
|
-
client_name: profile.name, // client name for personalization
|
|
408
|
-
concerns: justice.concerns, // any concerns for client
|
|
409
|
-
global: justice.global, // the global policies for client
|
|
410
|
-
personal: justice.devas[this._agent.key], // Client personal features and rules.
|
|
411
|
-
};
|
|
412
|
-
delete this._client.features.justice; // delete the services key for isolation
|
|
413
|
-
return resolve(); // go to Done
|
|
414
|
-
}
|
|
415
|
-
} catch (e) {
|
|
416
|
-
this.state('reject', 'Justice');
|
|
417
|
-
return this.error(e, false, reject); // run error handling if an error is caught
|
|
418
|
-
}
|
|
319
|
+
return this.Feature('justice', resolve, reject);
|
|
419
320
|
}
|
|
420
321
|
|
|
421
322
|
/**************
|
|
@@ -426,30 +327,7 @@ class Deva {
|
|
|
426
327
|
client presented data.
|
|
427
328
|
***************/
|
|
428
329
|
Authority(resolve, reject) {
|
|
429
|
-
this.
|
|
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
|
-
}
|
|
330
|
+
return this.Feature('authority', resolve, reject);
|
|
453
331
|
}
|
|
454
332
|
|
|
455
333
|
/**************
|
|
@@ -791,13 +669,17 @@ class Deva {
|
|
|
791
669
|
}).then(() => {
|
|
792
670
|
return this._assignListeners();
|
|
793
671
|
}).then(() => {
|
|
672
|
+
this.feature('init');
|
|
673
|
+
this.zone('init');
|
|
674
|
+
this.action('init');
|
|
675
|
+
this.state('init');
|
|
794
676
|
return this.Client(client, resolve, reject);
|
|
795
677
|
}).then(() => {
|
|
796
678
|
return this.Security(resolve, reject);
|
|
797
|
-
}).then(() => {
|
|
798
|
-
return this.Services(resolve, reject);
|
|
799
679
|
}).then(() => {
|
|
800
680
|
return this.Support(resolve, reject);
|
|
681
|
+
}).then(() => {
|
|
682
|
+
return this.Services(resolve, reject);
|
|
801
683
|
}).then(() => {
|
|
802
684
|
return this.Systems(resolve, reject);
|
|
803
685
|
}).then(() => {
|
|
@@ -809,7 +691,6 @@ class Deva {
|
|
|
809
691
|
}).then(() => {
|
|
810
692
|
return this.Done(resolve, reject);
|
|
811
693
|
}).then(() => {
|
|
812
|
-
this.zone('init');
|
|
813
694
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
814
695
|
return hasOnInit ? this.onInit(_data, resolve) : this.start(_data, resolve);
|
|
815
696
|
}).catch(err => {
|
|
@@ -1191,7 +1072,6 @@ class Deva {
|
|
|
1191
1072
|
feature(value=false, extra=false) {
|
|
1192
1073
|
try {
|
|
1193
1074
|
if (!value || !this._features[value]) return; // check feature value
|
|
1194
|
-
this._feature = value; // set local feature variable
|
|
1195
1075
|
|
|
1196
1076
|
const lookup = this._features[value]; // set the lookup value
|
|
1197
1077
|
const text = extra ? `${lookup} ${extra}` : lookup; // set the text value
|
|
@@ -1312,7 +1192,9 @@ class Deva {
|
|
|
1312
1192
|
try {
|
|
1313
1193
|
this.state('return', 'security'); // set the security state
|
|
1314
1194
|
return this.lib.copy(this._security); // return the security feature
|
|
1315
|
-
} catch (e) {
|
|
1195
|
+
} catch (e) {
|
|
1196
|
+
return this.error(e);
|
|
1197
|
+
}
|
|
1316
1198
|
}
|
|
1317
1199
|
|
|
1318
1200
|
/**************
|
|
@@ -1470,7 +1352,6 @@ class Deva {
|
|
|
1470
1352
|
usage: this.prompt('text')
|
|
1471
1353
|
***************/
|
|
1472
1354
|
prompt(text) {
|
|
1473
|
-
this.feature('prompt');
|
|
1474
1355
|
// Talk a global prompt event for the client
|
|
1475
1356
|
const agent = this.agent();
|
|
1476
1357
|
const client = this.client();
|
|
@@ -1499,7 +1380,6 @@ class Deva {
|
|
|
1499
1380
|
info() {
|
|
1500
1381
|
// check the active status
|
|
1501
1382
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1502
|
-
this.feature('info');
|
|
1503
1383
|
return this._info;
|
|
1504
1384
|
}
|
|
1505
1385
|
|
|
@@ -1517,7 +1397,6 @@ class Deva {
|
|
|
1517
1397
|
status() {
|
|
1518
1398
|
// check the active status
|
|
1519
1399
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1520
|
-
this.feature('status');
|
|
1521
1400
|
|
|
1522
1401
|
// format the date since active for output.
|
|
1523
1402
|
const dateFormat = this.lib.formatDate(this._active, 'long', true);
|
|
@@ -1540,7 +1419,6 @@ class Deva {
|
|
|
1540
1419
|
this.zone('help');
|
|
1541
1420
|
|
|
1542
1421
|
if (!this._active) return resolve(this._messages.offline);
|
|
1543
|
-
this.feature('help');
|
|
1544
1422
|
|
|
1545
1423
|
const params = msg.split(' ');
|
|
1546
1424
|
let helpFile = 'main';
|
package/package.json
CHANGED
package/tests/index.js
CHANGED
|
@@ -31,27 +31,28 @@ const HelloWorld = new Deva({
|
|
|
31
31
|
vars: agent.vars,
|
|
32
32
|
listeners: {
|
|
33
33
|
'devacore:prompt'(packet) {
|
|
34
|
-
console.log(`๐
|
|
34
|
+
console.log(`๐ prompt: ${packet.text}`);
|
|
35
35
|
},
|
|
36
36
|
'devacore:question'(packet) {
|
|
37
|
-
console.log(`๐โโ๏ธ๏ธ
|
|
37
|
+
console.log(`๐โโ๏ธ๏ธ question: ${packet.text}`);
|
|
38
38
|
},
|
|
39
39
|
'devacore:answer'(packet) {
|
|
40
|
-
console.log(`๐จโ๐ฌ
|
|
40
|
+
console.log(`๐จโ๐ฌ answer: ${packet.text}`);
|
|
41
41
|
},
|
|
42
42
|
'devacore:ask'(packet) {
|
|
43
|
-
console.log(`๐ค
|
|
43
|
+
console.log(`๐ค ask: ${packet.text}`);
|
|
44
44
|
},
|
|
45
45
|
'devacore:state'(packet) {
|
|
46
|
-
console.log(`๐ช
|
|
46
|
+
console.log(`๐ช state: ${packet.text}`);
|
|
47
47
|
},
|
|
48
48
|
'devacore:zone'(packet) {
|
|
49
|
-
console.log(`๐บ๏ธ
|
|
49
|
+
console.log(`๐บ๏ธ zone: ${packet.text}`);
|
|
50
50
|
},
|
|
51
51
|
'devacore:action'(packet) {
|
|
52
|
-
console.log(`๐ฅ
|
|
52
|
+
console.log(`๐ฅ action: ${packet.text}`);
|
|
53
53
|
},
|
|
54
54
|
'devacore:feature'(packet) {
|
|
55
|
+
console.log(`---`);
|
|
55
56
|
console.log(`๐ฟ feature: ${packet.text}`);
|
|
56
57
|
},
|
|
57
58
|
'devacore:error'(packet) {
|