@indra.ai/deva 1.1.17 → 1.1.18

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 +11 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -560,7 +560,7 @@ class Deva {
560
560
  return this._assignListeners();
561
561
  }).then(() => {
562
562
  this.state('init');
563
- return this.onInit && typeof this.onInit === 'function' ? this.onInit() : this.start(this._messages.init);
563
+ return this.onInit && typeof this.onInit === 'function' ? this.onInit() : this.start();
564
564
  }).then(started => {
565
565
  return resolve(started)
566
566
  }).catch(err => {
@@ -588,15 +588,15 @@ class Deva {
588
588
  the active to the current datetime and then checking for a custom onStart
589
589
  function or running the system enter function.
590
590
  ***************/
591
- start() {
592
- if (!this._active) return;
591
+ start(msg=false) {
592
+ if (!this._active) return Promise.resolve(this._messages.offline);
593
593
  this.state('start');
594
594
  return this.onStart && typeof this.onStart === 'function' ? this.onStart() : this.enter(this._messages.start);
595
595
  }
596
596
 
597
597
  /**************
598
598
  func: stop
599
- params: none
599
+ params: msg - hte message from the caller incase need to use in calls
600
600
  describe:
601
601
  The stop function will stop the Deva by setting the active status to false,
602
602
  and the state to stop. From here it will check for a custom onStop function
@@ -604,7 +604,7 @@ class Deva {
604
604
 
605
605
  If the deva is offline it will return the offline message.
606
606
  ***************/
607
- stop() {
607
+ stop(msg=false) {
608
608
  if (!this._active) return Promise.resolve(this._messages.offline);
609
609
  this.state('stop');
610
610
  this._active = false;
@@ -613,14 +613,14 @@ class Deva {
613
613
 
614
614
  /**************
615
615
  func: enter
616
- params: none
616
+ params: msg - hte message from the caller incase need to use in calls
617
617
  describe:
618
618
  The ener function will check the actie status of the Deva and set it to
619
619
  offline or enter.
620
620
 
621
621
  If the Deva is offline it will return the offline message.
622
622
  ***************/
623
- enter() {
623
+ enter(msg=false) {
624
624
  if (!this._active) return Promise.resolve(this._messages.offline);
625
625
  this.state('enter');
626
626
  return this.onEnter && typeof this.onEnter === 'function' ? this.onEnter() : this.done(this._messages.enter)
@@ -628,7 +628,7 @@ class Deva {
628
628
 
629
629
  /**************
630
630
  func: exit
631
- params: none
631
+ params: msg - hte message from the caller incase need to use in calls
632
632
  describe:
633
633
  The exit state function is triggered when the Deva is exiting it's online
634
634
  status and setting the state to exit for things like security check.
@@ -638,7 +638,7 @@ class Deva {
638
638
 
639
639
  If the deva is offline it will return the offline message.
640
640
  ***************/
641
- exit() {
641
+ exit(msg=false) {
642
642
  if (!this._active) return Promise.resolve(this._messages.offline);
643
643
  this.state('exit');
644
644
  this._active = false;
@@ -672,12 +672,12 @@ class Deva {
672
672
 
673
673
  If the deva is offline it will return the offline message.
674
674
  ***************/
675
- status(addto=false) {
675
+ status(ammend=false) {
676
676
  if (!this._active) return Promise.resolve(this._messages.offline);
677
677
  const id = this.uid();
678
678
  const dateFormat = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium', timeStyle: 'medium' }).format(this._active);
679
679
  let text = `${this.agent.name} is ONLINE since ${dateFormat}`;
680
- if (addto) text = text + `\n${addto}`;
680
+ if (ammend) text = text + `\n${ammend}`;
681
681
  return Promise.resolve({text});
682
682
  }
683
683
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {