@indra.ai/deva 1.5.12 → 1.5.13
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 +5 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -716,7 +716,7 @@ class Deva {
|
|
|
716
716
|
this._active = Date.now();
|
|
717
717
|
const agent = this.agent();
|
|
718
718
|
|
|
719
|
-
const
|
|
719
|
+
const data = {
|
|
720
720
|
id: this.lib.uid(),
|
|
721
721
|
key: 'init',
|
|
722
722
|
value: agent.key,
|
|
@@ -725,7 +725,7 @@ class Deva {
|
|
|
725
725
|
text: this._messages.init,
|
|
726
726
|
created: Date.now(),
|
|
727
727
|
}
|
|
728
|
-
|
|
728
|
+
data.hash = this.lib.hash(data);
|
|
729
729
|
return new Promise((resolve, reject) => {
|
|
730
730
|
this.events.setMaxListeners(this.maxListeners);
|
|
731
731
|
this._assignInherit().then(() => {
|
|
@@ -762,8 +762,10 @@ class Deva {
|
|
|
762
762
|
return this.Done(resolve, reject);
|
|
763
763
|
}).then(() => {
|
|
764
764
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
765
|
-
|
|
765
|
+
this.state('return', `init:${data.id}`);
|
|
766
|
+
return hasOnInit ? this.onInit(data, resolve) : this.start(data, resolve);
|
|
766
767
|
}).catch(err => {
|
|
768
|
+
this.state('catch', `init:${data.id}`);
|
|
767
769
|
return this.error(err, client, reject);
|
|
768
770
|
});
|
|
769
771
|
});
|