@indra.ai/deva 1.3.12 → 1.3.14
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 +52 -55
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -348,11 +348,10 @@ class Deva {
|
|
|
348
348
|
describe: The end of the workflow Client Feature Workflow
|
|
349
349
|
***************/
|
|
350
350
|
Done(resolve, reject) {
|
|
351
|
-
this.action('done'
|
|
351
|
+
this.action('done');
|
|
352
352
|
try {
|
|
353
|
-
this.state('
|
|
353
|
+
this.state('Done');
|
|
354
354
|
delete this._client.features; // delete the features key when done.
|
|
355
|
-
this.state('resolve', 'init');
|
|
356
355
|
return resolve(this.client()); // resolve an empty pr
|
|
357
356
|
} catch (e) {
|
|
358
357
|
this.state('reject', 'Done');
|
|
@@ -687,45 +686,23 @@ class Deva {
|
|
|
687
686
|
this.action('init');
|
|
688
687
|
this.state('init');
|
|
689
688
|
return this.Client(client, resolve, reject);
|
|
690
|
-
}).then(
|
|
691
|
-
this.state('done', 'client');
|
|
692
|
-
this.action('done', 'client');
|
|
689
|
+
}).then(() => {
|
|
693
690
|
return this.Security(resolve, reject);
|
|
694
|
-
}).then(
|
|
695
|
-
this.state('done', 'security');
|
|
696
|
-
this.action('done', 'security');
|
|
691
|
+
}).then(() => {
|
|
697
692
|
return this.Support(resolve, reject);
|
|
698
693
|
}).then(() => {
|
|
699
|
-
this.state('done', 'support');
|
|
700
|
-
this.action('done', 'support');
|
|
701
694
|
return this.Services(resolve, reject);
|
|
702
695
|
}).then(() => {
|
|
703
|
-
this.state('done', 'services');
|
|
704
|
-
this.action('done', 'services');
|
|
705
696
|
return this.Systems(resolve, reject);
|
|
706
697
|
}).then(() => {
|
|
707
|
-
this.state('done', 'systems');
|
|
708
|
-
this.action('done', 'systems');
|
|
709
698
|
return this.Networks(resolve, reject);
|
|
710
699
|
}).then(() => {
|
|
711
|
-
this.state('done', 'networks');
|
|
712
|
-
this.action('done', 'networks');
|
|
713
700
|
return this.Legal(resolve, reject);
|
|
714
701
|
}).then(() => {
|
|
715
|
-
this.state('done', 'legal');
|
|
716
|
-
this.action('done', 'legal');
|
|
717
|
-
return this.Authority(resolve, reject);
|
|
718
|
-
}).then(() => {
|
|
719
|
-
this.state('done', 'authority');
|
|
720
|
-
this.action('done', 'authority');
|
|
721
702
|
return this.Justice(resolve, reject);
|
|
722
703
|
}).then(() => {
|
|
723
|
-
this.
|
|
724
|
-
this.action('done', 'justice');
|
|
725
|
-
return this.Defense(resolve, reject);
|
|
704
|
+
return this.Authority(resolve, reject);
|
|
726
705
|
}).then(() => {
|
|
727
|
-
this.state('done', 'defense');
|
|
728
|
-
this.action('done', 'defense');
|
|
729
706
|
return this.Done(resolve, reject);
|
|
730
707
|
}).then(() => {
|
|
731
708
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
@@ -770,7 +747,7 @@ class Deva {
|
|
|
770
747
|
usage: this.enter('msg')
|
|
771
748
|
***************/
|
|
772
749
|
enter(data, resolve) {
|
|
773
|
-
this.zone('
|
|
750
|
+
this.zone('deva');
|
|
774
751
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
775
752
|
this.action('enter');
|
|
776
753
|
data.value = 'enter';
|
|
@@ -800,9 +777,35 @@ class Deva {
|
|
|
800
777
|
data.hash = this.lib.hash(data);
|
|
801
778
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
802
779
|
this.state('done');
|
|
803
|
-
return hasOnDone ? this.onDone(data, resolve) : this.
|
|
780
|
+
return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
|
|
804
781
|
}
|
|
805
782
|
|
|
783
|
+
/**************
|
|
784
|
+
func: ready
|
|
785
|
+
params:
|
|
786
|
+
- packet: the data to pass to the resolve
|
|
787
|
+
- resolve: the complete resolve to pass back
|
|
788
|
+
describe: This function is use to relay the Agent ito a complete state when
|
|
789
|
+
resolving a question or data.
|
|
790
|
+
usage: this.complete(data, resolve)
|
|
791
|
+
***************/
|
|
792
|
+
ready(packet, resolve) {
|
|
793
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
794
|
+
this.action('ready'); // set the complete action
|
|
795
|
+
|
|
796
|
+
packet.hash = this.lib.hash(packet);// hash the entire packet before completeing.
|
|
797
|
+
// check for agent on complete function in agent
|
|
798
|
+
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
799
|
+
|
|
800
|
+
// if: agent has on complete then return on complete
|
|
801
|
+
this.state('ready'); // set the finish state
|
|
802
|
+
|
|
803
|
+
// return the provided resolve function or a promise resolve.
|
|
804
|
+
return hasOnReady ? this.onReady(packet, resolve) : resolve(packet);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
806
809
|
/**************
|
|
807
810
|
func: finish
|
|
808
811
|
params:
|
|
@@ -846,33 +849,9 @@ class Deva {
|
|
|
846
849
|
// if: agent has on complete then return on complete
|
|
847
850
|
this.state('complete'); // set the finish state
|
|
848
851
|
// return the provided resolve function or a promise resolve.
|
|
849
|
-
return hasOnComplete ? this.onComplete(packet) :
|
|
852
|
+
return hasOnComplete ? this.onComplete(packet) : resolve(packet);
|
|
850
853
|
}
|
|
851
854
|
|
|
852
|
-
/**************
|
|
853
|
-
func: ready
|
|
854
|
-
params:
|
|
855
|
-
- packet: the data to pass to the resolve
|
|
856
|
-
- resolve: the complete resolve to pass back
|
|
857
|
-
describe: This function is use to relay the Agent ito a complete state when
|
|
858
|
-
resolving a question or data.
|
|
859
|
-
usage: this.complete(data, resolve)
|
|
860
|
-
***************/
|
|
861
|
-
ready(packet, resolve) {
|
|
862
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
863
|
-
this.action('ready'); // set the complete action
|
|
864
|
-
|
|
865
|
-
packet.hash = this.lib.hash(packet);// hash the entire packet before completeing.
|
|
866
|
-
// check for agent on complete function in agent
|
|
867
|
-
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
868
|
-
|
|
869
|
-
// if: agent has on complete then return on complete
|
|
870
|
-
this.state('ready'); // set the finish state
|
|
871
|
-
|
|
872
|
-
// return the provided resolve function or a promise resolve.
|
|
873
|
-
return hasOnReady ? this.onReady(packet, resolve) : resolve(packet);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
855
|
/**************
|
|
877
856
|
func: stop
|
|
878
857
|
params:
|
|
@@ -1286,6 +1265,24 @@ class Deva {
|
|
|
1286
1265
|
}
|
|
1287
1266
|
}
|
|
1288
1267
|
|
|
1268
|
+
/**************
|
|
1269
|
+
func: networks
|
|
1270
|
+
params: none
|
|
1271
|
+
describe: basic networks features available in a Deva.
|
|
1272
|
+
usage: this.networks()
|
|
1273
|
+
***************/
|
|
1274
|
+
networks() {
|
|
1275
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1276
|
+
this.zone('networks');
|
|
1277
|
+
this.feature('networks'); // set the support state
|
|
1278
|
+
try {
|
|
1279
|
+
this.state('return', 'networks'); // set the networks state
|
|
1280
|
+
return this.lib.copy(this._networks); // return the networks feature
|
|
1281
|
+
} catch (e) {
|
|
1282
|
+
return this.error(e); // return this.error when error catch
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1289
1286
|
/**************
|
|
1290
1287
|
func: legal
|
|
1291
1288
|
params: none
|