@indra.ai/deva 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/index.js +13 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -323,7 +323,7 @@ class Deva {
323
323
  so the event is specific to the talk.
324
324
  ***************/
325
325
  ask(packet) {
326
- if (!this.active) return Promise.resolve(this.messages.offline);
326
+ if (!this._active) return Promise.resolve(this.messages.offline);
327
327
 
328
328
  this.state('ask');
329
329
 
@@ -384,7 +384,7 @@ class Deva {
384
384
  describe:
385
385
  ***************/
386
386
  question(TEXT=false, DATA=false) {
387
- if (!this.active) return Promise.resolve(this.messages.offline);
387
+ if (!this._active) return Promise.resolve(this.messages.offline);
388
388
 
389
389
  this.state('question'); // set the state to question.
390
390
 
@@ -415,7 +415,7 @@ class Deva {
415
415
  return new Promise((resolve, reject) => {
416
416
  if (!TEXT) return reject(this.messages.notext);
417
417
  try {
418
- if (!this.active) return reject(this.messages.offline);
418
+ if (!this._active) return reject(this.messages.offline);
419
419
 
420
420
  // *: send just a string of text
421
421
  // !: send a command to the local agent
@@ -515,7 +515,7 @@ class Deva {
515
515
  7. If there is an error the init function rejects the call.
516
516
  ***************/
517
517
  init() {
518
- this.active = Date.now();
518
+ this._active = Date.now();
519
519
  // set client
520
520
  return new Promise((resolve, reject) => {
521
521
  this.events.setMaxListeners(this.maxListeners);
@@ -554,7 +554,7 @@ class Deva {
554
554
  function or running the system enter function.
555
555
  ***************/
556
556
  start() {
557
- if (!this.active) return;
557
+ if (!this._active) return;
558
558
  this.state('start');
559
559
  return this.onStart && typeof this.onStart === 'function' ? this.onStart() : this.enter();
560
560
  }
@@ -570,9 +570,9 @@ class Deva {
570
570
  If the deva is offline it will return the offline message.
571
571
  ***************/
572
572
  stop() {
573
- if (!this.active) return Promise.resolve(this.messages.offline);
573
+ if (!this._active) return Promise.resolve(this.messages.offline);
574
574
  this.state('stop');
575
- this.active = false;
575
+ this._active = false;
576
576
  return this.onStop && typeof this.onStop === 'function' ? this.onStop() : this.exit();
577
577
  }
578
578
 
@@ -586,7 +586,7 @@ class Deva {
586
586
  If the Deva is offline it will return the offline message.
587
587
  ***************/
588
588
  enter() {
589
- if (!this.active) return Promise.resolve(this.messages.offline);
589
+ if (!this._active) return Promise.resolve(this.messages.offline);
590
590
  this.state('enter');
591
591
  return this.onEnter && typeof this.onEnter === 'function' ? this.onEnter() : this.done(this.state)
592
592
  }
@@ -604,9 +604,9 @@ class Deva {
604
604
  If the deva is offline it will return the offline message.
605
605
  ***************/
606
606
  exit() {
607
- if (!this.active) return Promise.resolve(this.messages.offline);
607
+ if (!this._active) return Promise.resolve(this.messages.offline);
608
608
  this.state('exit');
609
- this.active = false;
609
+ this._active = false;
610
610
  return this.onExit && typeof this.onExit === 'function' ? this.onExit() : Promise.resolve(this._state)
611
611
  }
612
612
 
@@ -621,7 +621,7 @@ class Deva {
621
621
  If the deva is offline it will return the offline message.
622
622
  ***************/
623
623
  done(msg=false) {
624
- if (!this.active) return Promise.resolve(this.messages.offline);
624
+ if (!this._active) return Promise.resolve(this.messages.offline);
625
625
  this.state('done');
626
626
  msg = msg ? msg : this._state;
627
627
  return this.onDone && typeof this.onDone === 'function' ? this.onDone() : Promise.resolve(this._state)
@@ -638,9 +638,9 @@ class Deva {
638
638
  If the deva is offline it will return the offline message.
639
639
  ***************/
640
640
  status(addto=false) {
641
- if (!this.active) return Promise.resolve(this.messages.offline);
641
+ if (!this._active) return Promise.resolve(this.messages.offline);
642
642
  const id = this.uid();
643
- const dateFormat = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium', timeStyle: 'medium' }).format(this.active);
643
+ const dateFormat = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium', timeStyle: 'medium' }).format(this._active);
644
644
  let text = `${this.agent.name} is ONLINE since ${dateFormat}`;
645
645
  if (addto) text = text + `\n${addto}`;
646
646
  return Promise.resolve({text});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {