@indra.ai/deva 1.5.3 → 1.5.5
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
|
@@ -1191,8 +1191,10 @@ class Deva {
|
|
|
1191
1191
|
describe
|
|
1192
1192
|
***************/
|
|
1193
1193
|
context(value=false, extra=false) {
|
|
1194
|
+
this.state('try', `context:${value}`);
|
|
1194
1195
|
try {
|
|
1195
1196
|
if (!value) return;
|
|
1197
|
+
this.state('set', `context:${value}`);
|
|
1196
1198
|
this._context = value;
|
|
1197
1199
|
const lookup = this.vars.context[value] || value;
|
|
1198
1200
|
const text = extra ? `${lookup} ${extra}` : lookup;
|
|
@@ -1208,9 +1210,11 @@ class Deva {
|
|
|
1208
1210
|
};
|
|
1209
1211
|
data.hash = this.lib.hash(data);
|
|
1210
1212
|
this.talk(config.events.context, data);
|
|
1213
|
+
this.state('return', `context:${value}:${data.id}`);
|
|
1211
1214
|
return data;
|
|
1212
1215
|
} catch (e) {
|
|
1213
|
-
|
|
1216
|
+
this.state('catch', `context:${value}`);
|
|
1217
|
+
return this.error(e, value);
|
|
1214
1218
|
}
|
|
1215
1219
|
}
|
|
1216
1220
|
|
|
@@ -1392,7 +1396,6 @@ class Deva {
|
|
|
1392
1396
|
});
|
|
1393
1397
|
}
|
|
1394
1398
|
|
|
1395
|
-
|
|
1396
1399
|
/**************
|
|
1397
1400
|
func: prompt
|
|
1398
1401
|
params:
|
|
@@ -1419,11 +1422,6 @@ class Deva {
|
|
|
1419
1422
|
return this.talk(config.events.prompt, _data);
|
|
1420
1423
|
}
|
|
1421
1424
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
1425
|
/**************
|
|
1428
1426
|
func: core
|
|
1429
1427
|
params: none
|
|
@@ -1501,10 +1499,10 @@ class Deva {
|
|
|
1501
1499
|
this.state('try', `help:${helpFile}`);
|
|
1502
1500
|
try {
|
|
1503
1501
|
const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
|
|
1504
|
-
if (!helpExists) return
|
|
1502
|
+
if (!helpExists) return resolve(this._messages.help_not_found);
|
|
1505
1503
|
const helpDoc = this.lib.fs.readFileSync(helpPath, 'utf8');
|
|
1506
|
-
this.state('
|
|
1507
|
-
return
|
|
1504
|
+
this.state('resolve', `help:${helpFile}`);
|
|
1505
|
+
return resolve(helpDoc);
|
|
1508
1506
|
} catch (e) {
|
|
1509
1507
|
this.state('catch', `help:${helpFile}`);
|
|
1510
1508
|
return this.error(e, msg, reject);
|