@indra.ai/deva 1.5.29 → 1.5.31
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 +14 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -929,11 +929,11 @@ class Deva {
|
|
|
929
929
|
this.stop()
|
|
930
930
|
***************/
|
|
931
931
|
stop() {
|
|
932
|
+
const id = this.lib.uid();
|
|
932
933
|
this.zone('stop', id);
|
|
933
934
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
934
935
|
|
|
935
936
|
this.action('stop', id);
|
|
936
|
-
const id = this.lib.uid();
|
|
937
937
|
const hasOnStop = this.onStop && typeof this.onStop === 'function';
|
|
938
938
|
|
|
939
939
|
const data = { // build the stop data
|
|
@@ -963,11 +963,12 @@ class Deva {
|
|
|
963
963
|
function.
|
|
964
964
|
***************/
|
|
965
965
|
exit() {
|
|
966
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
967
966
|
const id = this.lib.uid();
|
|
968
|
-
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
969
967
|
this.zone('exit', id);
|
|
968
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
969
|
+
|
|
970
970
|
this.action('exit', id);
|
|
971
|
+
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
971
972
|
|
|
972
973
|
const data = {
|
|
973
974
|
id,
|
|
@@ -1192,6 +1193,7 @@ class Deva {
|
|
|
1192
1193
|
describe: return a list of features that are available to the system.
|
|
1193
1194
|
***************/
|
|
1194
1195
|
features() {
|
|
1196
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1195
1197
|
const id = this.lib.uid();
|
|
1196
1198
|
this.action('features', id);
|
|
1197
1199
|
const data = {
|
|
@@ -1215,6 +1217,7 @@ class Deva {
|
|
|
1215
1217
|
describe
|
|
1216
1218
|
***************/
|
|
1217
1219
|
context(value=false, extra=false) {
|
|
1220
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1218
1221
|
const id = this.lib.uid();
|
|
1219
1222
|
try {
|
|
1220
1223
|
if (!value) return;
|
|
@@ -1241,6 +1244,7 @@ class Deva {
|
|
|
1241
1244
|
}
|
|
1242
1245
|
|
|
1243
1246
|
contexts() {
|
|
1247
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1244
1248
|
const id = this.lib.uid();
|
|
1245
1249
|
this.action('contexts', id);
|
|
1246
1250
|
if (!this._active) return this._messages.offline; // check the active status
|
|
@@ -1457,9 +1461,9 @@ class Deva {
|
|
|
1457
1461
|
describe: return core data.
|
|
1458
1462
|
***************/
|
|
1459
1463
|
core() {
|
|
1464
|
+
if (!this._active) return this._messages.offline;
|
|
1460
1465
|
const id = this.lib.uid();
|
|
1461
1466
|
this.action('core', id);
|
|
1462
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1463
1467
|
|
|
1464
1468
|
// check the active status
|
|
1465
1469
|
const data = this.lib.copy(this._core);
|
|
@@ -1476,9 +1480,9 @@ class Deva {
|
|
|
1476
1480
|
describe: return info data.
|
|
1477
1481
|
***************/
|
|
1478
1482
|
info() {
|
|
1483
|
+
if (!this._active) return this._messages.offline;
|
|
1479
1484
|
const id = this.lib.uid();
|
|
1480
1485
|
this.action('info', id);
|
|
1481
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1482
1486
|
|
|
1483
1487
|
const data = this.lib.copy(this._info);
|
|
1484
1488
|
data.id = id;
|
|
@@ -1500,10 +1504,10 @@ class Deva {
|
|
|
1500
1504
|
usage: this.status('msg')
|
|
1501
1505
|
***************/
|
|
1502
1506
|
status() {
|
|
1507
|
+
if (!this._active) return this._messages.offline;
|
|
1503
1508
|
const id = this.lib.uid();
|
|
1504
1509
|
this.action('status', id);
|
|
1505
1510
|
// check the active status
|
|
1506
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1507
1511
|
|
|
1508
1512
|
// format the date since active for output.
|
|
1509
1513
|
const dateFormat = this.lib.formatDate(this._active, 'long', true);
|
|
@@ -1524,13 +1528,13 @@ class Deva {
|
|
|
1524
1528
|
***************/
|
|
1525
1529
|
help(msg, help_dir) {
|
|
1526
1530
|
return new Promise((resolve, reject) => {
|
|
1527
|
-
const id = this.lib.uid();
|
|
1528
|
-
this.context('help', id);
|
|
1529
1531
|
this.zone('help', id);
|
|
1532
|
+
if (!this._active) return resolve(this._messages.offline);
|
|
1533
|
+
const id = this.lib.uid();
|
|
1530
1534
|
this.feature('help', id);
|
|
1531
1535
|
this.action('help', id);
|
|
1532
1536
|
this.state('help', id);
|
|
1533
|
-
|
|
1537
|
+
this.context('help', id);
|
|
1534
1538
|
const params = msg.split(' '); // split the msg into an array by spaces.
|
|
1535
1539
|
let helpFile = 'main'; // set default help file
|
|
1536
1540
|
if (params[0]) helpFile = params[0]; // check the msg for a help file
|
|
@@ -1567,10 +1571,10 @@ class Deva {
|
|
|
1567
1571
|
***************/
|
|
1568
1572
|
error(err,data=false,reject=false) {
|
|
1569
1573
|
const id = this.lib.uid();
|
|
1570
|
-
this.context('error', id);
|
|
1571
1574
|
this.zone('error', id);
|
|
1572
1575
|
this.action('error', id);
|
|
1573
1576
|
this.state('error', id);
|
|
1577
|
+
this.context('error', id);
|
|
1574
1578
|
|
|
1575
1579
|
const agent = this.agent();
|
|
1576
1580
|
const client = this.client();
|