@indra.ai/deva 1.5.54 → 1.5.56
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 +136 -89
- package/lib/index.js +21 -5
- package/package.json +21 -11
- package/tests/agent.json +5 -67
- package/tests/client.json +11 -1
- package/tests/index.js +11 -11
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@ class Deva {
|
|
|
19
19
|
this._active = false; // the active/birth date.
|
|
20
20
|
this._vector = false; // inherited Vector features.
|
|
21
21
|
this._veda = false; // inherited Veda features.
|
|
22
|
+
this._god = false; // inherited God features.
|
|
22
23
|
this._king = false; // inherited King features.
|
|
23
24
|
this._treasury = false; // inherited Vector features.
|
|
24
25
|
this._security = false; // inherited Security features.
|
|
@@ -34,7 +35,7 @@ class Deva {
|
|
|
34
35
|
this._systems = false; // inherited Systems features.
|
|
35
36
|
this._networks = false; // inherited Systems features.
|
|
36
37
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
37
|
-
this.lib = new lib({}); // used for loading library functions
|
|
38
|
+
this.lib = new lib({config}); // used for loading library functions
|
|
38
39
|
this.utils = opts.utils || {}; // parse function
|
|
39
40
|
this.devas = opts.devas || {}; // Devas which are loaded
|
|
40
41
|
this.vars = opts.vars || {}; // Variables object
|
|
@@ -204,7 +205,7 @@ class Deva {
|
|
|
204
205
|
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
205
206
|
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
206
207
|
|
|
207
|
-
this.state('invalid', `${meta.method}:${packet.id}`);
|
|
208
|
+
this.state('invalid', `${meta.method}:${packet.id.uid}`);
|
|
208
209
|
return packet;
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -267,19 +268,19 @@ class Deva {
|
|
|
267
268
|
***************/
|
|
268
269
|
Feature(feature, resolve, reject) {
|
|
269
270
|
const _id = this.lib.uid();
|
|
270
|
-
this.feature(feature, _id);
|
|
271
|
-
this.zone(feature, _id);
|
|
271
|
+
this.feature(feature, _id.uid);
|
|
272
|
+
this.zone(feature, _id.uid);
|
|
272
273
|
const _cl = this.client(); // set local copy of client data
|
|
273
274
|
try {
|
|
274
275
|
if (!_cl.features[feature]) return resolve(); // if no security feature goto Support
|
|
275
276
|
else {
|
|
276
|
-
this.action(feature, _id); // set action to feature
|
|
277
|
+
this.action(feature, _id.uid); // set action to feature
|
|
277
278
|
const _fe = `_${feature}`;
|
|
278
279
|
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
279
280
|
const data = features[feature]; // make a copy the clinet data.
|
|
280
|
-
this.state('set',
|
|
281
|
-
this[_fe] = { // set
|
|
282
|
-
id: _id, //
|
|
281
|
+
this.state('set', `${feature}:${_id.uid}`);
|
|
282
|
+
this[_fe] = { // set this feature with data
|
|
283
|
+
id: _id, // uid of the feature
|
|
283
284
|
client_id: id, // client id for reference
|
|
284
285
|
client_name: profile.name, // client name for personalization
|
|
285
286
|
concerns: data.concerns, // any concerns for client
|
|
@@ -288,11 +289,11 @@ class Deva {
|
|
|
288
289
|
created: Date.now(),
|
|
289
290
|
};
|
|
290
291
|
delete this._client.features[feature]; // make a copy the clinet data.
|
|
291
|
-
this.state('resolve', `${feature}:${_id}`);
|
|
292
|
+
this.state('resolve', `${feature}:${_id.uid}`);
|
|
292
293
|
return resolve(feature); // resolve when done
|
|
293
294
|
}
|
|
294
295
|
} catch (e) {
|
|
295
|
-
this.state('catch', `${feature}:${_id}`);
|
|
296
|
+
this.state('catch', `${feature}:${_id.uid}`);
|
|
296
297
|
return this.error(e, feature, reject); // run error handling if an error is caught
|
|
297
298
|
}
|
|
298
299
|
}
|
|
@@ -319,6 +320,17 @@ class Deva {
|
|
|
319
320
|
return this.Feature('veda', resolve, reject);
|
|
320
321
|
}
|
|
321
322
|
|
|
323
|
+
/**************
|
|
324
|
+
func: God
|
|
325
|
+
params: resolve, reject
|
|
326
|
+
describe:
|
|
327
|
+
The God feature sets the correct variables and necessary rules for the
|
|
328
|
+
client presented data.
|
|
329
|
+
***************/
|
|
330
|
+
God(resolve, reject) {
|
|
331
|
+
return this.Feature('god', resolve, reject);
|
|
332
|
+
}
|
|
333
|
+
|
|
322
334
|
/**************
|
|
323
335
|
func: King
|
|
324
336
|
params: resolve, reject
|
|
@@ -330,6 +342,17 @@ class Deva {
|
|
|
330
342
|
return this.Feature('king', resolve, reject);
|
|
331
343
|
}
|
|
332
344
|
|
|
345
|
+
/**************
|
|
346
|
+
func: Owner
|
|
347
|
+
params: resolve, reject
|
|
348
|
+
describe:
|
|
349
|
+
The Owner feature sets the correct variables and necessary rules for the
|
|
350
|
+
client presented data.
|
|
351
|
+
***************/
|
|
352
|
+
Owner(resolve, reject) {
|
|
353
|
+
return this.Feature('owner', resolve, reject);
|
|
354
|
+
}
|
|
355
|
+
|
|
333
356
|
/**************
|
|
334
357
|
func: Treasury
|
|
335
358
|
params: resolve, reject
|
|
@@ -510,7 +533,7 @@ class Deva {
|
|
|
510
533
|
to create seamless collaboration between Devas.
|
|
511
534
|
***************/
|
|
512
535
|
talk(evt, packet=false) {
|
|
513
|
-
this.action('talk', `${evt}:${packet.id}`);
|
|
536
|
+
this.action('talk', `${evt}:${packet.id.uid}`);
|
|
514
537
|
return this.events.emit(evt, packet);
|
|
515
538
|
}
|
|
516
539
|
|
|
@@ -637,14 +660,14 @@ class Deva {
|
|
|
637
660
|
if (isAsk) { // isAsk check if the question isAsk and talk
|
|
638
661
|
// if: isAsk wait for the once event which is key'd to the packet ID for specified responses
|
|
639
662
|
this.talk(`${key}:ask`, packet);
|
|
640
|
-
this.once(`${key}:ask:${packet.id}`, answer => {
|
|
663
|
+
this.once(`${key}:ask:${packet.id.uid}`, answer => {
|
|
641
664
|
this.talk(config.events.ask, this.lib.copy(answer));
|
|
642
|
-
this.state('return', `${key}:ask:${id}`);
|
|
665
|
+
this.state('return', `${key}:ask:${packet.id.uid}`);
|
|
643
666
|
return this.finish(answer, resolve); // if:isAsk resolve the answer from the call
|
|
644
667
|
});
|
|
645
668
|
}
|
|
646
669
|
else { // else: answer the question locally
|
|
647
|
-
this.state('answer', `${method}:${id}`); //set the answer state to the method
|
|
670
|
+
this.state('answer', `${method}:${id.uid}`); //set the answer state to the method
|
|
648
671
|
return this.answer(packet, resolve, reject);
|
|
649
672
|
}
|
|
650
673
|
}
|
|
@@ -673,14 +696,14 @@ class Deva {
|
|
|
673
696
|
const client = this.client();
|
|
674
697
|
// check if method exists and is of type function
|
|
675
698
|
const {method,params} = packet.q.meta;
|
|
676
|
-
this.action('answer', `${method}:${id}`);
|
|
699
|
+
this.action('answer', `${method}:${id.uid}`);
|
|
677
700
|
|
|
678
|
-
this.state('try', `answer:${method}:${id}`);
|
|
701
|
+
this.state('try', `answer:${method}:${id.uid}`);
|
|
679
702
|
try {
|
|
680
703
|
const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
|
|
681
704
|
if (!isMethod) return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
|
|
682
705
|
|
|
683
|
-
this.action('method', `answer:${method}:${id}`);
|
|
706
|
+
this.action('method', `answer:${method}:${id.uid}`);
|
|
684
707
|
this.methods[method](packet).then(result => {
|
|
685
708
|
// check the result for the text, html, and data object. // this is for when answers are returned from nested Devas.
|
|
686
709
|
const text = typeof result === 'object' ? result.text : result;
|
|
@@ -688,7 +711,7 @@ class Deva {
|
|
|
688
711
|
// if the data passed is NOT an object it will FALSE
|
|
689
712
|
const data = typeof result === 'object' ? result.data : false;
|
|
690
713
|
|
|
691
|
-
this.state('set', `answer:${method}:packet_answer:${id}`);
|
|
714
|
+
this.state('set', `answer:${method}:packet_answer:${id.uid}`);
|
|
692
715
|
const packet_answer = { // setup the packet.a container
|
|
693
716
|
id,
|
|
694
717
|
agent, // set the agent who answered the question
|
|
@@ -711,14 +734,14 @@ class Deva {
|
|
|
711
734
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
712
735
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
713
736
|
|
|
714
|
-
this.state('return', `answer:${method}:${id}`); // set the state resolve answer
|
|
737
|
+
this.state('return', `answer:${method}:${id.uid}`); // set the state resolve answer
|
|
715
738
|
return this.finish(packet, resolve); // resolve the packet to the caller.
|
|
716
739
|
}).catch(err => { // catch any errors in the method
|
|
717
|
-
this.state('catch', `answer:${method}:${id}`); // set the state reject answer
|
|
740
|
+
this.state('catch', `answer:${method}:${id.uid}`); // set the state reject answer
|
|
718
741
|
return this.error(err, packet, reject); // return this.error with err, packet, reject
|
|
719
742
|
});
|
|
720
743
|
} catch (e) {
|
|
721
|
-
this.state('catch', `answer:${method}:${id}`);
|
|
744
|
+
this.state('catch', `answer:${method}:${id.uid}`);
|
|
722
745
|
return this.error(e, packet, reject);
|
|
723
746
|
}
|
|
724
747
|
}
|
|
@@ -743,18 +766,18 @@ class Deva {
|
|
|
743
766
|
const agent = this.agent();
|
|
744
767
|
const client = this.client();
|
|
745
768
|
const {method, params} = packet.q.meta;
|
|
746
|
-
this.zone('ask', `${method}:${packet.id}`);
|
|
747
|
-
this.action('ask', `${method}:${packet.id}`);
|
|
769
|
+
this.zone('ask', `${method}:${packet.id.uid}`);
|
|
770
|
+
this.action('ask', `${method}:${packet.id.uid}`);
|
|
748
771
|
// build the answer packet from this model
|
|
749
|
-
this.state('try', `ask:${method}:${packet.id}`);
|
|
772
|
+
this.state('try', `ask:${method}:${packet.id.uid}`);
|
|
750
773
|
try {
|
|
751
774
|
if (typeof this.methods[method] !== 'function') {
|
|
752
775
|
return setImmediate(() => {
|
|
753
|
-
this.talk(`${this._agent.key}:ask:${packet.id}`, this._methodNotFound(packet));
|
|
776
|
+
this.talk(`${this._agent.key}:ask:${packet.id.uid}`, this._methodNotFound(packet));
|
|
754
777
|
});
|
|
755
778
|
}
|
|
756
779
|
|
|
757
|
-
this.state('set', `ask:${method}:packet_answer:${packet.id}`);
|
|
780
|
+
this.state('set', `ask:${method}:packet_answer:${packet.id.uid}`);
|
|
758
781
|
const packet_answer = {
|
|
759
782
|
id: this.lib.uid(),
|
|
760
783
|
agent,
|
|
@@ -787,16 +810,16 @@ class Deva {
|
|
|
787
810
|
|
|
788
811
|
packet.a = packet_answer;
|
|
789
812
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
790
|
-
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
813
|
+
this.talk(`${agent.key}:ask:${packet.id.uid}`, packet);
|
|
791
814
|
}).catch(err => {
|
|
792
|
-
this.talk(`${agent.key}:ask:${packet.id}`, {error:err});
|
|
793
|
-
this.state('catch', `ask:${method}:${packet.id}`);
|
|
815
|
+
this.talk(`${agent.key}:ask:${packet.id.uid}`, {error:err});
|
|
816
|
+
this.state('catch', `ask:${method}:${packet.id.uid}`);
|
|
794
817
|
return this.error(err, packet);
|
|
795
818
|
})
|
|
796
819
|
}
|
|
797
820
|
catch (e) {
|
|
798
|
-
this.state('catch', `ask:${method}:${packet.id}`);
|
|
799
|
-
this.talk(`${agent.key}:ask:${packet.id}`, {error:e});
|
|
821
|
+
this.state('catch', `ask:${method}:${packet.id.uid}`);
|
|
822
|
+
this.talk(`${agent.key}:ask:${packet.id.uid}`, {error:e});
|
|
800
823
|
return this.error(e, packet)
|
|
801
824
|
}
|
|
802
825
|
// now when we ask the meta params[0] should be the method
|
|
@@ -852,8 +875,12 @@ class Deva {
|
|
|
852
875
|
return this.Vector(resolve, reject);
|
|
853
876
|
}).then(() => {
|
|
854
877
|
return this.Veda(resolve, reject);
|
|
878
|
+
}).then(() => {
|
|
879
|
+
return this.God(resolve, reject);
|
|
855
880
|
}).then(() => {
|
|
856
881
|
return this.King(resolve, reject);
|
|
882
|
+
}).then(() => {
|
|
883
|
+
return this.Owner(resolve, reject);
|
|
857
884
|
}).then(() => {
|
|
858
885
|
return this.Treasury(resolve, reject);
|
|
859
886
|
}).then(() => {
|
|
@@ -886,10 +913,10 @@ class Deva {
|
|
|
886
913
|
return this.Done(resolve, reject);
|
|
887
914
|
}).then(() => {
|
|
888
915
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
889
|
-
this.state('return', `init:${data.id}`);
|
|
916
|
+
this.state('return', `init:${data.id.uid}`);
|
|
890
917
|
return hasOnInit ? this.onInit(data, resolve) : this.start(data, resolve);
|
|
891
918
|
}).catch(err => {
|
|
892
|
-
this.state('catch', `init:${data.id}`);
|
|
919
|
+
this.state('catch', `init:${data.id.uid}`);
|
|
893
920
|
return this.error(err, client, reject);
|
|
894
921
|
});
|
|
895
922
|
});
|
|
@@ -906,10 +933,10 @@ class Deva {
|
|
|
906
933
|
usage: this.start('msg')
|
|
907
934
|
***************/
|
|
908
935
|
start(data, resolve) {
|
|
909
|
-
this.zone('start', data.id);
|
|
936
|
+
this.zone('start', data.id.uid);
|
|
910
937
|
if (!this._active) return resolve(this._messages.offline);
|
|
911
938
|
|
|
912
|
-
this.action('start', data.id);
|
|
939
|
+
this.action('start', data.id.uid);
|
|
913
940
|
const id = this.lib.uid();
|
|
914
941
|
|
|
915
942
|
delete data.md5;
|
|
@@ -924,7 +951,7 @@ class Deva {
|
|
|
924
951
|
|
|
925
952
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
926
953
|
|
|
927
|
-
this.state('start', data.id);
|
|
954
|
+
this.state('start', data.id.uid);
|
|
928
955
|
this.talk(config.events.start, data);
|
|
929
956
|
return hasOnStart ? this.onStart(data, resolve) : this.enter(data, resolve)
|
|
930
957
|
}
|
|
@@ -941,10 +968,10 @@ class Deva {
|
|
|
941
968
|
usage: this.enter('msg')
|
|
942
969
|
***************/
|
|
943
970
|
enter(data, resolve) {
|
|
944
|
-
this.zone('enter', data.id);
|
|
971
|
+
this.zone('enter', data.id.uid);
|
|
945
972
|
if (!this._active) return resolve(this._messages.offline);
|
|
946
973
|
|
|
947
|
-
this.action('enter', data.id);
|
|
974
|
+
this.action('enter', data.id.uid);
|
|
948
975
|
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
949
976
|
|
|
950
977
|
delete data.md5;
|
|
@@ -957,7 +984,7 @@ class Deva {
|
|
|
957
984
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
958
985
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
959
986
|
|
|
960
|
-
this.state('enter', data.id);
|
|
987
|
+
this.state('enter', data.id.uid);
|
|
961
988
|
this.talk(config.events.enter, data);
|
|
962
989
|
return hasOnEnter ? this.onEnter(data, resolve) : this.done(data, resolve)
|
|
963
990
|
}
|
|
@@ -974,10 +1001,10 @@ class Deva {
|
|
|
974
1001
|
usage: this.done('msg')
|
|
975
1002
|
***************/
|
|
976
1003
|
done(data, resolve) {
|
|
977
|
-
this.zone('done', data.id);
|
|
1004
|
+
this.zone('done', data.id.uid);
|
|
978
1005
|
if (!this._active) return resolve(this._messages.offline);
|
|
979
1006
|
|
|
980
|
-
this.action('done', data.id);
|
|
1007
|
+
this.action('done', data.id.uid);
|
|
981
1008
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
982
1009
|
|
|
983
1010
|
delete data.md5;
|
|
@@ -990,7 +1017,7 @@ class Deva {
|
|
|
990
1017
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
991
1018
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
992
1019
|
|
|
993
|
-
this.state('done', data.id);
|
|
1020
|
+
this.state('done', data.id.uid);
|
|
994
1021
|
this.talk(config.events.done, data);
|
|
995
1022
|
return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
|
|
996
1023
|
}
|
|
@@ -1004,10 +1031,10 @@ class Deva {
|
|
|
1004
1031
|
usage: this.ready(data, resolve)
|
|
1005
1032
|
***************/
|
|
1006
1033
|
ready(data, resolve) {
|
|
1007
|
-
this.zone('ready', data.id);
|
|
1034
|
+
this.zone('ready', data.id.uid);
|
|
1008
1035
|
if (!this._active) return resolve(this._messages.offline);
|
|
1009
1036
|
|
|
1010
|
-
this.action('ready', data.id);
|
|
1037
|
+
this.action('ready', data.id.uid);
|
|
1011
1038
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
1012
1039
|
|
|
1013
1040
|
delete data.md5;
|
|
@@ -1020,7 +1047,7 @@ class Deva {
|
|
|
1020
1047
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1021
1048
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1022
1049
|
|
|
1023
|
-
this.state('ready', data.id);
|
|
1050
|
+
this.state('ready', data.id.uid);
|
|
1024
1051
|
this.talk(config.events.ready, data);
|
|
1025
1052
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
1026
1053
|
}
|
|
@@ -1036,10 +1063,10 @@ class Deva {
|
|
|
1036
1063
|
usage: this.finish(data, resolve)
|
|
1037
1064
|
***************/
|
|
1038
1065
|
finish(data, resolve) {
|
|
1039
|
-
this.zone('finish', data.id); // enter finish zone
|
|
1066
|
+
this.zone('finish', data.id.uid); // enter finish zone
|
|
1040
1067
|
if (!this._active) return resolve(this._messages.offline); //
|
|
1041
1068
|
|
|
1042
|
-
this.action('finish', data.id); // start finish action
|
|
1069
|
+
this.action('finish', data.id.uid); // start finish action
|
|
1043
1070
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
|
|
1044
1071
|
|
|
1045
1072
|
delete data.md5;
|
|
@@ -1052,7 +1079,7 @@ class Deva {
|
|
|
1052
1079
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1053
1080
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1054
1081
|
|
|
1055
|
-
this.state('finish', data.id); // set finish state
|
|
1082
|
+
this.state('finish', data.id.uid); // set finish state
|
|
1056
1083
|
this.talk(config.events.finish, data);
|
|
1057
1084
|
return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
|
|
1058
1085
|
}
|
|
@@ -1067,10 +1094,10 @@ class Deva {
|
|
|
1067
1094
|
usage: this.complete(data, resolve)
|
|
1068
1095
|
***************/
|
|
1069
1096
|
complete(data, resolve) {
|
|
1070
|
-
this.zone('complete', data.id);
|
|
1097
|
+
this.zone('complete', data.id.uid);
|
|
1071
1098
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1072
1099
|
|
|
1073
|
-
this.action('complete', data.id);
|
|
1100
|
+
this.action('complete', data.id.uid);
|
|
1074
1101
|
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
1075
1102
|
|
|
1076
1103
|
delete data.md5;
|
|
@@ -1082,7 +1109,7 @@ class Deva {
|
|
|
1082
1109
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1083
1110
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1084
1111
|
|
|
1085
|
-
this.state('complete', data.id);
|
|
1112
|
+
this.state('complete', data.id.uid);
|
|
1086
1113
|
this.talk(config.events.complete, data);
|
|
1087
1114
|
return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
|
|
1088
1115
|
}
|
|
@@ -1238,7 +1265,7 @@ class Deva {
|
|
|
1238
1265
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1239
1266
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1240
1267
|
|
|
1241
|
-
this.state('return', `states:${id}`);
|
|
1268
|
+
this.state('return', `states:${id.uid}`);
|
|
1242
1269
|
return data;
|
|
1243
1270
|
}
|
|
1244
1271
|
|
|
@@ -1274,7 +1301,7 @@ class Deva {
|
|
|
1274
1301
|
this.talk(config.events.zone, data);
|
|
1275
1302
|
return data;
|
|
1276
1303
|
} catch (e) {
|
|
1277
|
-
this.state('catch', `zone:${value}:${id}`);
|
|
1304
|
+
this.state('catch', `zone:${value}:${id.uid}`);
|
|
1278
1305
|
return this.error(e, value);
|
|
1279
1306
|
}
|
|
1280
1307
|
}
|
|
@@ -1286,8 +1313,8 @@ class Deva {
|
|
|
1286
1313
|
***************/
|
|
1287
1314
|
zones() {
|
|
1288
1315
|
const id = this.lib.uid();
|
|
1289
|
-
this.action('zones', id);
|
|
1290
|
-
this.state('return', `zones:${id}`);
|
|
1316
|
+
this.action('zones', id.uid);
|
|
1317
|
+
this.state('return', `zones:${id.uid}`);
|
|
1291
1318
|
|
|
1292
1319
|
const data = {
|
|
1293
1320
|
id, // set the uuid of the data
|
|
@@ -1341,7 +1368,7 @@ class Deva {
|
|
|
1341
1368
|
this.talk(config.events.action, data); // talk the core action event
|
|
1342
1369
|
return data;
|
|
1343
1370
|
} catch (e) { // catch any errors that occur
|
|
1344
|
-
this.state('catch', `action:${value}:${id}`);
|
|
1371
|
+
this.state('catch', `action:${value}:${id.uid}`);
|
|
1345
1372
|
return this.error(e); // return error on error catch
|
|
1346
1373
|
}
|
|
1347
1374
|
}
|
|
@@ -1353,7 +1380,7 @@ class Deva {
|
|
|
1353
1380
|
***************/
|
|
1354
1381
|
actions() {
|
|
1355
1382
|
const id = this.lib.uid();
|
|
1356
|
-
this.action('actions', id);
|
|
1383
|
+
this.action('actions', id.uid);
|
|
1357
1384
|
const data = {
|
|
1358
1385
|
id, // set the id with a uuid
|
|
1359
1386
|
agent: this.agent(), // set the agent value
|
|
@@ -1367,7 +1394,7 @@ class Deva {
|
|
|
1367
1394
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1368
1395
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1369
1396
|
|
|
1370
|
-
this.state('return', `actions:${id}`);
|
|
1397
|
+
this.state('return', `actions:${id.uid}`);
|
|
1371
1398
|
return data;
|
|
1372
1399
|
}
|
|
1373
1400
|
|
|
@@ -1402,7 +1429,7 @@ class Deva {
|
|
|
1402
1429
|
this.talk(config.events.feature, data); // talk the feature event with data
|
|
1403
1430
|
return data;
|
|
1404
1431
|
} catch (e) { // catch any errors
|
|
1405
|
-
this.state('catch', `feature:${value}:${id}`);
|
|
1432
|
+
this.state('catch', `feature:${value}:${id.uid}`);
|
|
1406
1433
|
return this.error(e); // retun this.error when an error is caught.
|
|
1407
1434
|
}
|
|
1408
1435
|
}
|
|
@@ -1415,7 +1442,7 @@ class Deva {
|
|
|
1415
1442
|
features() {
|
|
1416
1443
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1417
1444
|
const id = this.lib.uid();
|
|
1418
|
-
this.action('features', id);
|
|
1445
|
+
this.action('features', id.uid);
|
|
1419
1446
|
const data = {
|
|
1420
1447
|
id, // set the object id
|
|
1421
1448
|
agent: this.agent(), // set the agent value.
|
|
@@ -1429,7 +1456,7 @@ class Deva {
|
|
|
1429
1456
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1430
1457
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1431
1458
|
|
|
1432
|
-
this.state('return', `features:${id}`);
|
|
1459
|
+
this.state('return', `features:${id.uid}`);
|
|
1433
1460
|
return data;
|
|
1434
1461
|
}
|
|
1435
1462
|
|
|
@@ -1466,7 +1493,7 @@ class Deva {
|
|
|
1466
1493
|
this.talk(config.events.context, data);
|
|
1467
1494
|
return data;
|
|
1468
1495
|
} catch (e) {
|
|
1469
|
-
this.state('catch', `context:${value}:${id}`);
|
|
1496
|
+
this.state('catch', `context:${value}:${id.uid}`);
|
|
1470
1497
|
return this.error(e, value);
|
|
1471
1498
|
}
|
|
1472
1499
|
}
|
|
@@ -1489,7 +1516,7 @@ class Deva {
|
|
|
1489
1516
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1490
1517
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1491
1518
|
|
|
1492
|
-
this.state('return', `contexts:${id}`);
|
|
1519
|
+
this.state('return', `contexts:${id.uid}`);
|
|
1493
1520
|
return data;
|
|
1494
1521
|
}
|
|
1495
1522
|
|
|
@@ -1530,15 +1557,35 @@ class Deva {
|
|
|
1530
1557
|
|
|
1531
1558
|
// FEATURE FUNCTIONS
|
|
1532
1559
|
/**************
|
|
1560
|
+
func: vector
|
|
1561
|
+
params: none
|
|
1562
|
+
describe: basic vector features available in a Deva.
|
|
1563
|
+
usage: this.vector()
|
|
1564
|
+
***************/
|
|
1565
|
+
vector() {
|
|
1566
|
+
return this._getFeature('vector', this._vector);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
/**************
|
|
1533
1570
|
func: veda
|
|
1534
1571
|
params: none
|
|
1535
1572
|
describe: basic veda features available in a Deva.
|
|
1536
1573
|
usage: this.veda()
|
|
1537
1574
|
***************/
|
|
1538
1575
|
veda() {
|
|
1539
|
-
return this._getFeature('veda', this.
|
|
1576
|
+
return this._getFeature('veda', this._veda);
|
|
1540
1577
|
}
|
|
1541
|
-
|
|
1578
|
+
|
|
1579
|
+
/**************
|
|
1580
|
+
func: god
|
|
1581
|
+
params: none
|
|
1582
|
+
describe: basic god features available in a Deva.
|
|
1583
|
+
usage: this.god()
|
|
1584
|
+
***************/
|
|
1585
|
+
god() {
|
|
1586
|
+
return this._getFeature('god', this._god);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1542
1589
|
/**************
|
|
1543
1590
|
func: king
|
|
1544
1591
|
params: none
|
|
@@ -1546,17 +1593,17 @@ class Deva {
|
|
|
1546
1593
|
usage: this.king()
|
|
1547
1594
|
***************/
|
|
1548
1595
|
king() {
|
|
1549
|
-
return this._getFeature('king', this.
|
|
1596
|
+
return this._getFeature('king', this._king);
|
|
1550
1597
|
}
|
|
1551
1598
|
|
|
1552
1599
|
/**************
|
|
1553
|
-
func:
|
|
1600
|
+
func: owner
|
|
1554
1601
|
params: none
|
|
1555
|
-
describe: basic
|
|
1556
|
-
usage: this.
|
|
1602
|
+
describe: basic owner features available in a Deva.
|
|
1603
|
+
usage: this.owner()
|
|
1557
1604
|
***************/
|
|
1558
|
-
|
|
1559
|
-
return this._getFeature('
|
|
1605
|
+
owner() {
|
|
1606
|
+
return this._getFeature('owner', this._king);
|
|
1560
1607
|
}
|
|
1561
1608
|
|
|
1562
1609
|
/**************
|
|
@@ -1622,7 +1669,7 @@ class Deva {
|
|
|
1622
1669
|
/**************
|
|
1623
1670
|
func: proxy
|
|
1624
1671
|
params: none
|
|
1625
|
-
describe: basic proxy features
|
|
1672
|
+
describe: basic proxy features availcoable in a Deva.
|
|
1626
1673
|
usage: this.proxy()
|
|
1627
1674
|
***************/
|
|
1628
1675
|
proxy() {
|
|
@@ -1787,7 +1834,7 @@ class Deva {
|
|
|
1787
1834
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1788
1835
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1789
1836
|
|
|
1790
|
-
this.state('return', `core:${id}`);
|
|
1837
|
+
this.state('return', `core:${id.uid}`);
|
|
1791
1838
|
return data;
|
|
1792
1839
|
}
|
|
1793
1840
|
|
|
@@ -1809,7 +1856,7 @@ class Deva {
|
|
|
1809
1856
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1810
1857
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1811
1858
|
|
|
1812
|
-
this.state('return', `info:${id}`);
|
|
1859
|
+
this.state('return', `info:${id.uid}`);
|
|
1813
1860
|
return data;
|
|
1814
1861
|
}
|
|
1815
1862
|
|
|
@@ -1833,7 +1880,7 @@ class Deva {
|
|
|
1833
1880
|
// format the date since active for output.
|
|
1834
1881
|
const dateFormat = this.lib.formatDate(this._active, 'long', true);
|
|
1835
1882
|
// create the text msg string
|
|
1836
|
-
this.state('return', `status:${id}`);
|
|
1883
|
+
this.state('return', `status:${id.uid}`);
|
|
1837
1884
|
return `${this._agent.profile.name} active since ${dateFormat}`; // return final text string
|
|
1838
1885
|
}
|
|
1839
1886
|
|
|
@@ -1854,10 +1901,10 @@ class Deva {
|
|
|
1854
1901
|
this.zone('help', id);
|
|
1855
1902
|
if (!this._active) return resolve(this._messages.offline);
|
|
1856
1903
|
|
|
1857
|
-
this.feature('help', id);
|
|
1858
|
-
this.action('help', id);
|
|
1859
|
-
this.state('help', id);
|
|
1860
|
-
this.context('help', id);
|
|
1904
|
+
this.feature('help', id.uid);
|
|
1905
|
+
this.action('help', id.uid);
|
|
1906
|
+
this.state('help', id.uid);
|
|
1907
|
+
this.context('help', id.uid);
|
|
1861
1908
|
const params = msg.split(' '); // split the msg into an array by spaces.
|
|
1862
1909
|
|
|
1863
1910
|
const splitText = params[0].split(':');
|
|
@@ -1867,12 +1914,12 @@ class Deva {
|
|
|
1867
1914
|
const helpPath = this.lib.path.join(help_dir, 'help', `${helpFile}.feecting`);
|
|
1868
1915
|
|
|
1869
1916
|
try {
|
|
1870
|
-
this.state('try', `help:${id}`);
|
|
1917
|
+
this.state('try', `help:${id.uid}`);
|
|
1871
1918
|
|
|
1872
1919
|
// check if help file exists first and resolve if no file
|
|
1873
1920
|
const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
|
|
1874
1921
|
if (!helpExists) {
|
|
1875
|
-
this.state('return', `${this._messages.help_not_found}:${id}`);
|
|
1922
|
+
this.state('return', `${this._messages.help_not_found}:${id.uid}`);
|
|
1876
1923
|
return resolve(this._messages.help_not_found);
|
|
1877
1924
|
}
|
|
1878
1925
|
|
|
@@ -1880,7 +1927,7 @@ class Deva {
|
|
|
1880
1927
|
const helpFile = this.lib.fs.readFileSync(helpPath, 'utf8');
|
|
1881
1928
|
const helpPart = helpFile.split(`::BEGIN:${part}`);
|
|
1882
1929
|
if (!helpPart[1]) {
|
|
1883
|
-
this.state('return', `${this._messages.help_not_found}:${id}`);
|
|
1930
|
+
this.state('return', `${this._messages.help_not_found}:${id.uid}`);
|
|
1884
1931
|
resolve(this._messages.help_not_found);
|
|
1885
1932
|
}
|
|
1886
1933
|
|
|
@@ -1888,11 +1935,11 @@ class Deva {
|
|
|
1888
1935
|
helpDoc = helpFile.split(`::BEGIN:${part}`)[1].split(`::END:${part}`)[0];
|
|
1889
1936
|
}
|
|
1890
1937
|
catch(e) {
|
|
1891
|
-
this.state('catch', `help:${id}`);
|
|
1938
|
+
this.state('catch', `help:${id.uid}`);
|
|
1892
1939
|
return this.error(e, msg, reject);
|
|
1893
1940
|
}
|
|
1894
1941
|
finally {
|
|
1895
|
-
this.state('return', `help:${id}`);
|
|
1942
|
+
this.state('return', `help:${id.uid}`);
|
|
1896
1943
|
return resolve(helpDoc);
|
|
1897
1944
|
}
|
|
1898
1945
|
});
|
|
@@ -1910,11 +1957,11 @@ class Deva {
|
|
|
1910
1957
|
***************/
|
|
1911
1958
|
error(err,packet,reject=false) {
|
|
1912
1959
|
const id = this.lib.uid();
|
|
1913
|
-
this.zone('error', id);
|
|
1960
|
+
this.zone('error', id.uid);
|
|
1914
1961
|
const agent = this.agent();
|
|
1915
1962
|
const client = this.client();
|
|
1916
1963
|
|
|
1917
|
-
this.action('error', id);
|
|
1964
|
+
this.action('error', id.uid);
|
|
1918
1965
|
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1919
1966
|
|
|
1920
1967
|
const data = {
|
|
@@ -1937,9 +1984,9 @@ class Deva {
|
|
|
1937
1984
|
|
|
1938
1985
|
this.talk(config.events.error, this.lib.copy(data));
|
|
1939
1986
|
|
|
1940
|
-
this.state('return', `error:${id}`);
|
|
1941
|
-
this.state('error', id);
|
|
1942
|
-
this.context('error', id);
|
|
1987
|
+
this.state('return', `error:${id.uid}`);
|
|
1988
|
+
this.state('error', id.uid);
|
|
1989
|
+
this.context('error', id.uid);
|
|
1943
1990
|
if (hasOnError) return this.onError(err, packet, reject);
|
|
1944
1991
|
else return reject ? reject(err) : Promise.reject(err);
|
|
1945
1992
|
}
|
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ class Node {
|
|
|
15
15
|
}
|
|
16
16
|
class LIB {
|
|
17
17
|
constructor(opts) {
|
|
18
|
+
this.config = opts.config || {};
|
|
18
19
|
this.lang = opts.lang || 'en';
|
|
19
20
|
this.locale = opts.locale || 'en-US';
|
|
20
21
|
this.currency = opts.currency || 'USD';
|
|
@@ -48,23 +49,38 @@ class LIB {
|
|
|
48
49
|
describe:
|
|
49
50
|
The uid function can create two types of id for you.
|
|
50
51
|
1. random GUID - this is good for when you need a uinique record id returned
|
|
51
|
-
2. transport
|
|
52
|
+
2. transport uid - The transport id is a number generated to provide a
|
|
52
53
|
secure numerical number used for transporting records
|
|
53
54
|
across networks without collision or needing to store system uuid.
|
|
55
|
+
3. the uid is then returned with a created, md5, sha256, and sha512 hash of the value
|
|
54
56
|
copyright: 2025 Quinn A Michaels. All rights reserved.
|
|
55
57
|
***************/
|
|
56
58
|
uid(guid=false) {
|
|
57
59
|
const time = Date.now();
|
|
58
60
|
if (guid) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
+
const uid = randomUUID(); // set uid into local constant.
|
|
62
|
+
const created = Date.now(); // set created into local constant.
|
|
63
|
+
const data = {uid,created}; // set base data object.
|
|
64
|
+
data.md5 = this.hash(data, 'md5'); // md5 the uid and created.
|
|
65
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the uid, created, md5
|
|
66
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the uid, created, md5, sha256.
|
|
67
|
+
return data; // return the data.
|
|
61
68
|
}
|
|
62
69
|
else {
|
|
63
70
|
const min = Math.floor(time - (time / Math.PI)); // generate min time from Math.PI divisor.
|
|
64
71
|
const max = Math.ceil(time + (time * Math.PI)); // generate max time form Math.PI multiplier.
|
|
65
72
|
const begin_random = Math.floor(Math.random() * (max - min) + min); // generate random number between min and max.
|
|
66
|
-
const
|
|
67
|
-
|
|
73
|
+
const {end_min, end_max} = this.config.uid; // set end min and max in to constant
|
|
74
|
+
const end_random = Math.ceil(Math.random() * (end_max - end_min) + end_min); // generate the 5 digit end salt on the number for added randomness.
|
|
75
|
+
|
|
76
|
+
const uid = `${begin_random}${end_random}`; // set uid to local constant
|
|
77
|
+
const created = Date.now(); // set created to local constant
|
|
78
|
+
|
|
79
|
+
const data = {uid,created}; // set base data object.
|
|
80
|
+
data.md5 = this.hash(data, 'md5'); // md5 the uid and created.
|
|
81
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the uid, created, md5
|
|
82
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the uid, created, md5, sha256.
|
|
83
|
+
return data; // return the complete uid data.
|
|
68
84
|
}
|
|
69
85
|
}
|
|
70
86
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "9f0bc743-d720-4320-832e-cf5edc3b7cf",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.56",
|
|
5
5
|
"description": "The Deva Core",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
"config": {
|
|
54
54
|
"cmdChr": "/",
|
|
55
55
|
"askChr": "#",
|
|
56
|
+
"uid": {
|
|
57
|
+
"end_min": 1000000,
|
|
58
|
+
"end_max": 9999999
|
|
59
|
+
},
|
|
56
60
|
"inherit": [
|
|
57
61
|
"events",
|
|
58
62
|
"lib",
|
|
@@ -95,7 +99,7 @@
|
|
|
95
99
|
"ask": "📣 Ask",
|
|
96
100
|
"load": "🚛 Load",
|
|
97
101
|
"unload": "🛻 Unload",
|
|
98
|
-
"init": "🟠
|
|
102
|
+
"init": "🟠 Init",
|
|
99
103
|
"start": "🟢 Start",
|
|
100
104
|
"enter": "🚪 Enter",
|
|
101
105
|
"done": "☑️ Done",
|
|
@@ -108,8 +112,10 @@
|
|
|
108
112
|
"agent": "🤖 Agent",
|
|
109
113
|
"client": "👨 Client",
|
|
110
114
|
"vector": "🛤️ Vector",
|
|
115
|
+
"god": "💫 God",
|
|
111
116
|
"veda": "🕉️ Veda",
|
|
112
117
|
"king": "👑️ King",
|
|
118
|
+
"owner": "🐲️ Owner",
|
|
113
119
|
"treasury": "🏦️ Treasury",
|
|
114
120
|
"security": "🚨 Security",
|
|
115
121
|
"guard": "💂 Guard",
|
|
@@ -147,7 +153,7 @@
|
|
|
147
153
|
"disconnect": "📴 Disconnect",
|
|
148
154
|
"send": "📬 Send",
|
|
149
155
|
"receive": "📪 Receive",
|
|
150
|
-
"init": "🟠
|
|
156
|
+
"init": "🟠 Init",
|
|
151
157
|
"start": "🟢 Start",
|
|
152
158
|
"enter": "🚪 Enter",
|
|
153
159
|
"done": "☑️ Done",
|
|
@@ -210,22 +216,24 @@
|
|
|
210
216
|
"client": "👨 Client",
|
|
211
217
|
"agent": "🕵️♂️ Agent",
|
|
212
218
|
"vector": "👽 Vector",
|
|
219
|
+
"god": "💫 God",
|
|
213
220
|
"veda": "🕉️ Veda",
|
|
214
221
|
"king": "👑️ King",
|
|
222
|
+
"owner": "🐲️ Owner",
|
|
223
|
+
"treasury": "🏦 Treasury",
|
|
215
224
|
"security": "🚨 Security",
|
|
216
225
|
"guard": "💂 Guard",
|
|
217
|
-
"
|
|
226
|
+
"defense": "🪖 Defense",
|
|
218
227
|
"wall": "🧱 Wall",
|
|
228
|
+
"shield": "🛡️ Shield",
|
|
219
229
|
"proxy": "👾️ Proxy",
|
|
220
|
-
"
|
|
230
|
+
"legal": "🏛️ Legal",
|
|
231
|
+
"authority": "🚔 Authority",
|
|
232
|
+
"justice": "⚖️ Justice",
|
|
221
233
|
"support": "💼 Support",
|
|
222
234
|
"services": "🛠️ Services",
|
|
223
235
|
"systems": "🖥️ Systems",
|
|
224
236
|
"networks": "📡 Networks",
|
|
225
|
-
"legal": "🏛️ Legal",
|
|
226
|
-
"justice": "⚖️ Justice",
|
|
227
|
-
"authority": "🚔 Authority",
|
|
228
|
-
"treasury": "🏦 Treasury",
|
|
229
237
|
"talk": "📢 Talk",
|
|
230
238
|
"listen": "👂 Listen",
|
|
231
239
|
"once": "👂 Once",
|
|
@@ -233,7 +241,7 @@
|
|
|
233
241
|
"question": "🙋 Question",
|
|
234
242
|
"answer": "💡 Answer",
|
|
235
243
|
"ask": "📣 Ask",
|
|
236
|
-
"init": "🟠
|
|
244
|
+
"init": "🟠 Init",
|
|
237
245
|
"start": "🟢 Start",
|
|
238
246
|
"enter": "🚪 Enter",
|
|
239
247
|
"finish": "🏁 Finish",
|
|
@@ -259,12 +267,14 @@
|
|
|
259
267
|
},
|
|
260
268
|
"feature": false,
|
|
261
269
|
"features": {
|
|
262
|
-
"init": "🟠
|
|
270
|
+
"init": "🟠 Init",
|
|
263
271
|
"agent": "🦾 Agent",
|
|
264
272
|
"client": "💪 Client",
|
|
265
273
|
"vector": "🛤️ Vector",
|
|
274
|
+
"god": "💫 God",
|
|
266
275
|
"veda": "🕉️ Veda",
|
|
267
276
|
"king": "👑️ King",
|
|
277
|
+
"owner": "🐲️ Owner",
|
|
268
278
|
"treasury": "🏦 Treasury",
|
|
269
279
|
"security": "🚨 Security",
|
|
270
280
|
"guard": "💂 Guard",
|
package/tests/agent.json
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"copyright": "Copyright (c)2025 Quinn Michaels. All rights reserved.",
|
|
5
5
|
"DATA": {
|
|
6
6
|
"id": 5380514963421,
|
|
7
|
-
"key": "
|
|
7
|
+
"key": "test",
|
|
8
8
|
"prompt": {
|
|
9
9
|
"emoji": "🍏",
|
|
10
|
-
"text": "
|
|
10
|
+
"text": "test",
|
|
11
11
|
"colors": {
|
|
12
12
|
"label": {
|
|
13
13
|
"R": 0,
|
|
@@ -22,77 +22,15 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"profile": {
|
|
25
|
-
"name": "Deva",
|
|
26
|
-
"describe": "The
|
|
25
|
+
"name": "Test Deva",
|
|
26
|
+
"describe": "The Test Deva.",
|
|
27
27
|
"emoji": "/public/devas/deva/emoji.png",
|
|
28
28
|
"avatar": "/public/devas/deva/avatar.png",
|
|
29
29
|
"background": "/public/devas/deva/background.png",
|
|
30
30
|
"gender": "M"
|
|
31
31
|
},
|
|
32
|
-
"features": {
|
|
33
|
-
"vector": {
|
|
34
|
-
"label": "🛤️VECTOR",
|
|
35
|
-
"name": "@VECTOR",
|
|
36
|
-
"tag": "#VECTOR",
|
|
37
|
-
"loc": "$VECTOR"
|
|
38
|
-
},
|
|
39
|
-
"security": {
|
|
40
|
-
"label": "🚨SECURITY",
|
|
41
|
-
"name": "@SECURITY",
|
|
42
|
-
"tag": "#SECURITY",
|
|
43
|
-
"loc": "$SECURITY"
|
|
44
|
-
},
|
|
45
|
-
"support": {
|
|
46
|
-
"label": "🆘SUPPORT",
|
|
47
|
-
"name": "@SUPPORT",
|
|
48
|
-
"tag": "#SUPPORT",
|
|
49
|
-
"loc": "$SUPPORT"
|
|
50
|
-
},
|
|
51
|
-
"services": {
|
|
52
|
-
"label": "📞SERVICES",
|
|
53
|
-
"name": "@SERVICES",
|
|
54
|
-
"tag": "#SERVICES",
|
|
55
|
-
"loc": "$SERVICES"
|
|
56
|
-
},
|
|
57
|
-
"systems": {
|
|
58
|
-
"label": "🔧SYSTEMS",
|
|
59
|
-
"name": "@SYSTEMS",
|
|
60
|
-
"tag": "#SYSTEMS",
|
|
61
|
-
"loc": "$SYSTEMS"
|
|
62
|
-
},
|
|
63
|
-
"networks": {
|
|
64
|
-
"label": "📡NETWORKS",
|
|
65
|
-
"name": "@NETWORKS",
|
|
66
|
-
"tag": "#NETWORKS",
|
|
67
|
-
"loc": "$NETWORKS"
|
|
68
|
-
},
|
|
69
|
-
"legal": {
|
|
70
|
-
"label": "🏛️LEGAL",
|
|
71
|
-
"name": "@LEGAL",
|
|
72
|
-
"tag": "#LEGAL",
|
|
73
|
-
"loc": "$LEGAL"
|
|
74
|
-
},
|
|
75
|
-
"justice": {
|
|
76
|
-
"label": "⚖️JUSTICE",
|
|
77
|
-
"name": "@JUSTICE",
|
|
78
|
-
"tag": "#JUSTICE",
|
|
79
|
-
"loc": "$JUSTICE"
|
|
80
|
-
},
|
|
81
|
-
"defense": {
|
|
82
|
-
"label": "🪖DEFENSE",
|
|
83
|
-
"name": "@DEFENSE",
|
|
84
|
-
"tag": "#DEFENSE",
|
|
85
|
-
"loc": "$DEFENSE"
|
|
86
|
-
},
|
|
87
|
-
"defense": {
|
|
88
|
-
"label": "💂GUARD",
|
|
89
|
-
"name": "@GUARD",
|
|
90
|
-
"tag": "#GUARD",
|
|
91
|
-
"loc": "$GUARD"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
32
|
"vars": {
|
|
95
|
-
"hello": "
|
|
33
|
+
"hello": "Hello World",
|
|
96
34
|
"context": {
|
|
97
35
|
"start": "🏎️ Start",
|
|
98
36
|
"enter": "🚪️ Enter",
|
package/tests/client.json
CHANGED
|
@@ -34,17 +34,27 @@
|
|
|
34
34
|
"currency": "USD"
|
|
35
35
|
},
|
|
36
36
|
"features": {
|
|
37
|
+
"vector": {
|
|
38
|
+
"concerns": [],
|
|
39
|
+
"global": [],
|
|
40
|
+
"devas": {}
|
|
41
|
+
},
|
|
37
42
|
"veda": {
|
|
38
43
|
"concerns": [],
|
|
39
44
|
"global": [],
|
|
40
45
|
"devas": {}
|
|
41
46
|
},
|
|
47
|
+
"god": {
|
|
48
|
+
"concerns": [],
|
|
49
|
+
"global": [],
|
|
50
|
+
"devas": {}
|
|
51
|
+
},
|
|
42
52
|
"king": {
|
|
43
53
|
"concerns": [],
|
|
44
54
|
"global": [],
|
|
45
55
|
"devas": {}
|
|
46
56
|
},
|
|
47
|
-
"
|
|
57
|
+
"owner": {
|
|
48
58
|
"concerns": [],
|
|
49
59
|
"global": [],
|
|
50
60
|
"devas": {}
|
package/tests/index.js
CHANGED
|
@@ -91,7 +91,7 @@ const DevaTest = new Deva({
|
|
|
91
91
|
console.log(`💥 action: ${packet.text}`);
|
|
92
92
|
},
|
|
93
93
|
'devacore:feature'(packet) {
|
|
94
|
-
this.context('feature');
|
|
94
|
+
this.context('feature', `${packet.value}:${packet.id.uid}`);
|
|
95
95
|
console.log(`🍿 feature: ${packet.text}`);
|
|
96
96
|
},
|
|
97
97
|
'devacore:context'(packet) {
|
|
@@ -110,12 +110,12 @@ const DevaTest = new Deva({
|
|
|
110
110
|
const info = this.info();
|
|
111
111
|
const data = [
|
|
112
112
|
'🧪 TEST RESULTS',
|
|
113
|
-
`::BEGIN:CORE:${core.id}`,
|
|
113
|
+
`::BEGIN:CORE:${core.id.uid}`,
|
|
114
114
|
JSON.stringify(core,null,2),
|
|
115
|
-
`::END:CORE:${core.id}`,
|
|
116
|
-
`::BEGIN:INFO:${info.id}`,
|
|
115
|
+
`::END:CORE:${core.id.uid}`,
|
|
116
|
+
`::BEGIN:INFO:${info.id.uid}`,
|
|
117
117
|
JSON.stringify(info,null,2),
|
|
118
|
-
`::END:INFO:${info.id}`,
|
|
118
|
+
`::END:INFO:${info.id.uid}`,
|
|
119
119
|
];
|
|
120
120
|
return {
|
|
121
121
|
text: data.join('\n'),
|
|
@@ -130,19 +130,19 @@ const DevaTest = new Deva({
|
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
onStart(data, resolve) {
|
|
133
|
-
this.context('start', data.id);
|
|
133
|
+
this.context('start', data.id.uid);
|
|
134
134
|
return this.enter(data, resolve);
|
|
135
135
|
},
|
|
136
136
|
onEnter(data, resolve) {
|
|
137
|
-
this.context('enter', data.id);
|
|
137
|
+
this.context('enter', data.id.uid);
|
|
138
138
|
return this.done(data, resolve);
|
|
139
139
|
},
|
|
140
140
|
onDone(data, resolve) {
|
|
141
|
-
this.context('done', data.id);
|
|
141
|
+
this.context('done', data.id.uid);
|
|
142
142
|
return this.ready(data, resolve);
|
|
143
143
|
},
|
|
144
144
|
onReady(data, resolve) {
|
|
145
|
-
this.context('ready', data.id);
|
|
145
|
+
this.context('ready', data.id.uid);
|
|
146
146
|
const test = this.methods.test(data);
|
|
147
147
|
this.prompt(test.text);
|
|
148
148
|
setTimeout(() => {
|
|
@@ -150,11 +150,11 @@ const DevaTest = new Deva({
|
|
|
150
150
|
}, 10000);
|
|
151
151
|
},
|
|
152
152
|
onFinish(data, resolve) {
|
|
153
|
-
this.context('finish', data.id);
|
|
153
|
+
this.context('finish', data.id.uid);
|
|
154
154
|
return this.complete(data, resolve);
|
|
155
155
|
},
|
|
156
156
|
onComplete(data, resolve) {
|
|
157
|
-
this.context('complete', data.id);
|
|
157
|
+
this.context('complete', data.id.uid);
|
|
158
158
|
return resolve(data);
|
|
159
159
|
},
|
|
160
160
|
onError(e) {
|