@indra.ai/deva 1.5.28 → 1.5.29

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 +16 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -784,12 +784,14 @@ class Deva {
784
784
  start(data, resolve) {
785
785
  this.zone('start', data.id);
786
786
  if (!this._active) return resolve(this._messages.offline);
787
+
787
788
  this.action('start', data.id);
788
789
  const id = this.lib.uid();
789
790
  delete data.hash;
790
791
  data.value = 'start';
791
792
  data.hash = this.lib.hash(data);
792
793
  const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
794
+
793
795
  this.state('start', data.id);
794
796
  return hasOnStart ? this.onStart(data, resolve) : this.enter(data, resolve)
795
797
  }
@@ -808,11 +810,13 @@ class Deva {
808
810
  enter(data, resolve) {
809
811
  this.zone('enter', data.id);
810
812
  if (!this._active) return resolve(this._messages.offline);
813
+
811
814
  this.action('enter', data.id);
812
815
  const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
813
816
  delete data.hash;
814
817
  data.value = 'enter';
815
818
  data.hash = this.lib.hash(data);
819
+
816
820
  this.state('enter', data.id);
817
821
  return hasOnEnter ? this.onEnter(data, resolve) : this.done(data, resolve)
818
822
  }
@@ -831,11 +835,13 @@ class Deva {
831
835
  done(data, resolve) {
832
836
  this.zone('done', data.id);
833
837
  if (!this._active) return resolve(this._messages.offline);
838
+
834
839
  this.action('done', data.id);
835
840
  const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
836
841
  delete data.hash;
837
842
  data.value = 'done';
838
843
  data.hash = this.lib.hash(data);
844
+
839
845
  this.state('done', data.id);
840
846
  return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
841
847
  }
@@ -851,11 +857,13 @@ class Deva {
851
857
  ready(data, resolve) {
852
858
  this.zone('ready', data.id);
853
859
  if (!this._active) return resolve(this._messages.offline);
860
+
854
861
  this.action('ready', data.id);
855
862
  const hasOnReady = this.onReady && typeof this.onReady === 'function';
856
863
  delete data.hash;
857
864
  data.value = 'ready';
858
865
  data.hash = this.lib.hash(data);// hash the entire data before completeing.
866
+
859
867
  this.state('ready', data.id);
860
868
  return hasOnReady ? this.onReady(data, resolve) : resolve(data);
861
869
  }
@@ -873,11 +881,13 @@ class Deva {
873
881
  finish(packet, resolve) {
874
882
  this.zone('finish', packet.id); // enter finish zone
875
883
  if (!this._active) return resolve(this._messages.offline); //
884
+
876
885
  this.action('finish', packet.id); // start finish action
877
886
  const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
878
887
  delete packet.hash; // delete packet hash to update for finish time
879
888
  packet.finish = Date.now(); // set the finish timestamp
880
889
  packet.hash = this.lib.hash(packet); // rehash the packet;
890
+
881
891
  this.state('finish', packet.id); // set finish state
882
892
  return hasOnFinish ? this.onFinish(packet, resolve) : this.complete(packet, resolve);
883
893
  }
@@ -894,11 +904,13 @@ class Deva {
894
904
  complete(packet, resolve) {
895
905
  this.zone('complete', packet.id);
896
906
  if (!this._active) return Promise.resolve(this._messages.offline);
907
+
897
908
  this.action('complete', packet.id);
898
909
  const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
899
910
  delete packet.hash;
900
911
  packet.complete = Date.now();// set the complete date on the whole packet.
901
912
  packet.hash = this.lib.hash(packet);// hash the entire packet before complete.
913
+
902
914
  this.state('complete', packet.id);
903
915
  return hasOnComplete ? this.onComplete(packet, resolve) : resolve(packet);
904
916
  }
@@ -917,12 +929,12 @@ class Deva {
917
929
  this.stop()
918
930
  ***************/
919
931
  stop() {
932
+ this.zone('stop', id);
920
933
  if (!this._active) return Promise.resolve(this._messages.offline);
934
+
935
+ this.action('stop', id);
921
936
  const id = this.lib.uid();
922
937
  const hasOnStop = this.onStop && typeof this.onStop === 'function';
923
- this.zone('stop', id);
924
- this.action('stop', id);
925
- this.state('stop', id); // set the state to stop
926
938
 
927
939
  const data = { // build the stop data
928
940
  id, // set the id
@@ -935,6 +947,7 @@ class Deva {
935
947
  data.hash = this.lib.hash(data);
936
948
  // has stop function then set hasOnStop variable
937
949
  // if: has on stop then run on stop function or return exit function.
950
+ this.state('stop', id); // set the state to stop
938
951
  return hasOnStop ? this.onStop(data) : this.exit()
939
952
  }
940
953
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.5.28",
3
+ "version": "1.5.29",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",