wao 0.22.2 → 0.22.3
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/cjs/aoconnect-base.js +1 -1
- package/cjs/hb.js +144 -112
- package/esm/aoconnect-base.js +1 -3
- package/esm/hb.js +13 -5
- package/package.json +1 -1
package/cjs/aoconnect-base.js
CHANGED
package/cjs/hb.js
CHANGED
|
@@ -588,7 +588,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
588
588
|
"random-seed": seed(16),
|
|
589
589
|
Type: "Process",
|
|
590
590
|
"scheduler-device": "scheduler@1.0",
|
|
591
|
-
"execution-device": "
|
|
591
|
+
"execution-device": "test-device@1.0"
|
|
592
592
|
}));
|
|
593
593
|
case 7:
|
|
594
594
|
res = _context18.sent;
|
|
@@ -611,7 +611,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
611
611
|
key: "message",
|
|
612
612
|
value: function () {
|
|
613
613
|
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(args) {
|
|
614
|
-
var pid, slot, res;
|
|
614
|
+
var pid, _yield$this$schedule, slot, res;
|
|
615
615
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
616
616
|
while (1) switch (_context19.prev = _context19.next) {
|
|
617
617
|
case 0:
|
|
@@ -619,20 +619,21 @@ var HB = /*#__PURE__*/function () {
|
|
|
619
619
|
_context19.next = 3;
|
|
620
620
|
return this.schedule(args);
|
|
621
621
|
case 3:
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
_yield$this$schedule = _context19.sent;
|
|
623
|
+
slot = _yield$this$schedule.slot;
|
|
624
|
+
_context19.next = 7;
|
|
624
625
|
return this.compute({
|
|
625
626
|
pid: pid,
|
|
626
627
|
slot: slot
|
|
627
628
|
});
|
|
628
|
-
case
|
|
629
|
+
case 7:
|
|
629
630
|
res = _context19.sent;
|
|
630
631
|
return _context19.abrupt("return", {
|
|
631
632
|
slot: slot,
|
|
632
633
|
pid: pid,
|
|
633
634
|
res: res
|
|
634
635
|
});
|
|
635
|
-
case
|
|
636
|
+
case 9:
|
|
636
637
|
case "end":
|
|
637
638
|
return _context19.stop();
|
|
638
639
|
}
|
|
@@ -644,23 +645,61 @@ var HB = /*#__PURE__*/function () {
|
|
|
644
645
|
return message;
|
|
645
646
|
}()
|
|
646
647
|
}, {
|
|
647
|
-
key: "
|
|
648
|
+
key: "scheduleLegacy",
|
|
648
649
|
value: function () {
|
|
649
|
-
var
|
|
650
|
-
var _pid2, _scheduler;
|
|
650
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
651
651
|
var _ref7,
|
|
652
652
|
pid,
|
|
653
|
+
_ref7$action,
|
|
654
|
+
action,
|
|
653
655
|
_ref7$tags,
|
|
654
656
|
tags,
|
|
655
657
|
data,
|
|
656
658
|
scheduler,
|
|
657
|
-
_tags,
|
|
658
|
-
res,
|
|
659
659
|
_args20 = arguments;
|
|
660
660
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
661
661
|
while (1) switch (_context20.prev = _context20.next) {
|
|
662
662
|
case 0:
|
|
663
|
-
_ref7 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, pid = _ref7.pid, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data, scheduler = _ref7.scheduler;
|
|
663
|
+
_ref7 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, pid = _ref7.pid, _ref7$action = _ref7.action, action = _ref7$action === void 0 ? "Eval" : _ref7$action, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data, scheduler = _ref7.scheduler;
|
|
664
|
+
if (action) tags.Action = action;
|
|
665
|
+
_context20.next = 4;
|
|
666
|
+
return this.schedule({
|
|
667
|
+
pid: pid,
|
|
668
|
+
tags: tags,
|
|
669
|
+
data: data,
|
|
670
|
+
scheduler: scheduler
|
|
671
|
+
});
|
|
672
|
+
case 4:
|
|
673
|
+
return _context20.abrupt("return", _context20.sent);
|
|
674
|
+
case 5:
|
|
675
|
+
case "end":
|
|
676
|
+
return _context20.stop();
|
|
677
|
+
}
|
|
678
|
+
}, _callee20, this);
|
|
679
|
+
}));
|
|
680
|
+
function scheduleLegacy() {
|
|
681
|
+
return _scheduleLegacy.apply(this, arguments);
|
|
682
|
+
}
|
|
683
|
+
return scheduleLegacy;
|
|
684
|
+
}()
|
|
685
|
+
}, {
|
|
686
|
+
key: "schedule",
|
|
687
|
+
value: function () {
|
|
688
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
689
|
+
var _pid2, _scheduler;
|
|
690
|
+
var _ref8,
|
|
691
|
+
pid,
|
|
692
|
+
_ref8$tags,
|
|
693
|
+
tags,
|
|
694
|
+
data,
|
|
695
|
+
scheduler,
|
|
696
|
+
_tags,
|
|
697
|
+
res,
|
|
698
|
+
_args21 = arguments;
|
|
699
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
700
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
701
|
+
case 0:
|
|
702
|
+
_ref8 = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {}, pid = _ref8.pid, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data, scheduler = _ref8.scheduler;
|
|
664
703
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
665
704
|
(_scheduler = scheduler) !== null && _scheduler !== void 0 ? _scheduler : scheduler = this.scheduler;
|
|
666
705
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
@@ -671,19 +710,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
671
710
|
Target: pid
|
|
672
711
|
});
|
|
673
712
|
if (data) _tags.data = data;
|
|
674
|
-
|
|
713
|
+
_context21.next = 7;
|
|
675
714
|
return this.send(_tags);
|
|
676
715
|
case 7:
|
|
677
|
-
res =
|
|
678
|
-
return
|
|
716
|
+
res = _context21.sent;
|
|
717
|
+
return _context21.abrupt("return", {
|
|
679
718
|
slot: res.headers.get("slot"),
|
|
680
719
|
res: res
|
|
681
720
|
});
|
|
682
721
|
case 9:
|
|
683
722
|
case "end":
|
|
684
|
-
return
|
|
723
|
+
return _context21.stop();
|
|
685
724
|
}
|
|
686
|
-
},
|
|
725
|
+
}, _callee21, this);
|
|
687
726
|
}));
|
|
688
727
|
function schedule() {
|
|
689
728
|
return _schedule.apply(this, arguments);
|
|
@@ -693,43 +732,43 @@ var HB = /*#__PURE__*/function () {
|
|
|
693
732
|
}, {
|
|
694
733
|
key: "spawnAOS",
|
|
695
734
|
value: function () {
|
|
696
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
735
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(image) {
|
|
697
736
|
var _this$scheduler2, _image, _this$image, _this$pid;
|
|
698
737
|
var addr, res, pid;
|
|
699
|
-
return _regeneratorRuntime().wrap(function
|
|
700
|
-
while (1) switch (
|
|
738
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
739
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
701
740
|
case 0:
|
|
702
|
-
|
|
741
|
+
_context22.next = 2;
|
|
703
742
|
return this.meta.info({
|
|
704
743
|
key: "address"
|
|
705
744
|
});
|
|
706
745
|
case 2:
|
|
707
|
-
addr =
|
|
746
|
+
addr = _context22.sent;
|
|
708
747
|
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
709
748
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
710
|
-
|
|
749
|
+
_context22.next = 8;
|
|
711
750
|
break;
|
|
712
751
|
}
|
|
713
752
|
_image;
|
|
714
|
-
|
|
753
|
+
_context22.next = 16;
|
|
715
754
|
break;
|
|
716
755
|
case 8:
|
|
717
756
|
if (!((_this$image = this.image) !== null && _this$image !== void 0)) {
|
|
718
|
-
|
|
757
|
+
_context22.next = 12;
|
|
719
758
|
break;
|
|
720
759
|
}
|
|
721
|
-
|
|
722
|
-
|
|
760
|
+
_context22.t0 = _this$image;
|
|
761
|
+
_context22.next = 15;
|
|
723
762
|
break;
|
|
724
763
|
case 12:
|
|
725
|
-
|
|
764
|
+
_context22.next = 14;
|
|
726
765
|
return this.getImage();
|
|
727
766
|
case 14:
|
|
728
|
-
|
|
767
|
+
_context22.t0 = _context22.sent;
|
|
729
768
|
case 15:
|
|
730
|
-
image =
|
|
769
|
+
image = _context22.t0;
|
|
731
770
|
case 16:
|
|
732
|
-
|
|
771
|
+
_context22.next = 18;
|
|
733
772
|
return this.send({
|
|
734
773
|
device: "process@1.0",
|
|
735
774
|
path: "/schedule",
|
|
@@ -750,18 +789,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
750
789
|
passes: 2
|
|
751
790
|
});
|
|
752
791
|
case 18:
|
|
753
|
-
res =
|
|
792
|
+
res = _context22.sent;
|
|
754
793
|
pid = res.headers.get("process");
|
|
755
794
|
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
756
|
-
return
|
|
795
|
+
return _context22.abrupt("return", {
|
|
757
796
|
pid: pid,
|
|
758
797
|
res: res
|
|
759
798
|
});
|
|
760
799
|
case 22:
|
|
761
800
|
case "end":
|
|
762
|
-
return
|
|
801
|
+
return _context22.stop();
|
|
763
802
|
}
|
|
764
|
-
},
|
|
803
|
+
}, _callee22, this);
|
|
765
804
|
}));
|
|
766
805
|
function spawnAOS(_x18) {
|
|
767
806
|
return _spawnAOS.apply(this, arguments);
|
|
@@ -853,38 +892,38 @@ var HB = /*#__PURE__*/function () {
|
|
|
853
892
|
}, {
|
|
854
893
|
key: "messages",
|
|
855
894
|
value: function () {
|
|
856
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
895
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
857
896
|
var _this2 = this;
|
|
858
|
-
var
|
|
897
|
+
var _ref9,
|
|
859
898
|
pid,
|
|
860
899
|
from,
|
|
861
900
|
to,
|
|
862
901
|
limit,
|
|
863
902
|
params,
|
|
864
903
|
res,
|
|
865
|
-
|
|
866
|
-
return _regeneratorRuntime().wrap(function
|
|
867
|
-
while (1) switch (
|
|
904
|
+
_args24 = arguments;
|
|
905
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
906
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
868
907
|
case 0:
|
|
869
|
-
|
|
908
|
+
_ref9 = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {}, pid = _ref9.pid, from = _ref9.from, to = _ref9.to, limit = _ref9.limit;
|
|
870
909
|
params = "target=".concat(pid);
|
|
871
910
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
872
911
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
873
912
|
params += "&accept=application/aos-2";
|
|
874
|
-
|
|
913
|
+
_context24.next = 7;
|
|
875
914
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
876
915
|
return r.json();
|
|
877
916
|
});
|
|
878
917
|
case 7:
|
|
879
|
-
res =
|
|
918
|
+
res = _context24.sent;
|
|
880
919
|
if (res.page_info.has_next_page) {
|
|
881
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
920
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
882
921
|
var from2;
|
|
883
|
-
return _regeneratorRuntime().wrap(function
|
|
884
|
-
while (1) switch (
|
|
922
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
923
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
885
924
|
case 0:
|
|
886
925
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
887
|
-
|
|
926
|
+
_context23.next = 3;
|
|
888
927
|
return _this2.message({
|
|
889
928
|
pid: pid,
|
|
890
929
|
from: from2,
|
|
@@ -892,20 +931,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
892
931
|
limit: limit
|
|
893
932
|
});
|
|
894
933
|
case 3:
|
|
895
|
-
return
|
|
934
|
+
return _context23.abrupt("return", _context23.sent);
|
|
896
935
|
case 4:
|
|
897
936
|
case "end":
|
|
898
|
-
return
|
|
937
|
+
return _context23.stop();
|
|
899
938
|
}
|
|
900
|
-
},
|
|
939
|
+
}, _callee23);
|
|
901
940
|
}));
|
|
902
941
|
}
|
|
903
|
-
return
|
|
942
|
+
return _context24.abrupt("return", res);
|
|
904
943
|
case 10:
|
|
905
944
|
case "end":
|
|
906
|
-
return
|
|
945
|
+
return _context24.stop();
|
|
907
946
|
}
|
|
908
|
-
},
|
|
947
|
+
}, _callee24, this);
|
|
909
948
|
}));
|
|
910
949
|
function messages() {
|
|
911
950
|
return _messages.apply(this, arguments);
|
|
@@ -915,17 +954,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
915
954
|
}, {
|
|
916
955
|
key: "spawnLegacy",
|
|
917
956
|
value: function () {
|
|
918
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
919
|
-
var
|
|
920
|
-
|
|
957
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
958
|
+
var _ref11,
|
|
959
|
+
_ref11$tags,
|
|
921
960
|
tags,
|
|
922
961
|
data,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
while (1) switch (_context24.prev = _context24.next) {
|
|
962
|
+
_args25 = arguments;
|
|
963
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
964
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
927
965
|
case 0:
|
|
928
|
-
|
|
966
|
+
_ref11 = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {}, _ref11$tags = _ref11.tags, tags = _ref11$tags === void 0 ? {} : _ref11$tags, data = _ref11.data;
|
|
929
967
|
tags = (0, _ramda.mergeLeft)(tags, {
|
|
930
968
|
data: data,
|
|
931
969
|
Type: "Process",
|
|
@@ -940,21 +978,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
940
978
|
"scheduler-device": "scheduler@1.0",
|
|
941
979
|
"execution-device": "genesis-wasm@1.0"
|
|
942
980
|
});
|
|
943
|
-
|
|
944
|
-
return this.
|
|
945
|
-
tags: tags
|
|
946
|
-
});
|
|
981
|
+
_context25.next = 4;
|
|
982
|
+
return this.spawn(tags);
|
|
947
983
|
case 4:
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
pid: res.process,
|
|
951
|
-
res: res
|
|
952
|
-
});
|
|
953
|
-
case 6:
|
|
984
|
+
return _context25.abrupt("return", _context25.sent);
|
|
985
|
+
case 5:
|
|
954
986
|
case "end":
|
|
955
|
-
return
|
|
987
|
+
return _context25.stop();
|
|
956
988
|
}
|
|
957
|
-
},
|
|
989
|
+
}, _callee25, this);
|
|
958
990
|
}));
|
|
959
991
|
function spawnLegacy() {
|
|
960
992
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -977,26 +1009,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
977
1009
|
}, {
|
|
978
1010
|
key: "dryrun",
|
|
979
1011
|
value: (function () {
|
|
980
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
981
|
-
var
|
|
982
|
-
|
|
1012
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1013
|
+
var _ref12,
|
|
1014
|
+
_ref12$tags,
|
|
983
1015
|
tags,
|
|
984
1016
|
pid,
|
|
985
1017
|
action,
|
|
986
1018
|
data,
|
|
987
1019
|
json,
|
|
988
1020
|
res,
|
|
989
|
-
|
|
990
|
-
return _regeneratorRuntime().wrap(function
|
|
991
|
-
while (1) switch (
|
|
1021
|
+
_args26 = arguments;
|
|
1022
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1023
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
992
1024
|
case 0:
|
|
993
|
-
|
|
1025
|
+
_ref12 = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {}, _ref12$tags = _ref12.tags, tags = _ref12$tags === void 0 ? {} : _ref12$tags, pid = _ref12.pid, action = _ref12.action, data = _ref12.data;
|
|
994
1026
|
if (typeof action === "string") tags.Action = action;
|
|
995
1027
|
json = {
|
|
996
1028
|
Tags: (0, _utils.buildTags)(tags)
|
|
997
1029
|
};
|
|
998
1030
|
if (data) json.Data = data;
|
|
999
|
-
|
|
1031
|
+
_context26.next = 6;
|
|
1000
1032
|
return this.send({
|
|
1001
1033
|
path: "/~relay@1.0/call",
|
|
1002
1034
|
"relay-method": "POST",
|
|
@@ -1005,13 +1037,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1005
1037
|
body: JSON.stringify(json)
|
|
1006
1038
|
});
|
|
1007
1039
|
case 6:
|
|
1008
|
-
res =
|
|
1009
|
-
return
|
|
1040
|
+
res = _context26.sent;
|
|
1041
|
+
return _context26.abrupt("return", JSON.parse(res.body));
|
|
1010
1042
|
case 8:
|
|
1011
1043
|
case "end":
|
|
1012
|
-
return
|
|
1044
|
+
return _context26.stop();
|
|
1013
1045
|
}
|
|
1014
|
-
},
|
|
1046
|
+
}, _callee26, this);
|
|
1015
1047
|
}));
|
|
1016
1048
|
function dryrun() {
|
|
1017
1049
|
return _dryrun.apply(this, arguments);
|
|
@@ -1021,25 +1053,25 @@ var HB = /*#__PURE__*/function () {
|
|
|
1021
1053
|
}, {
|
|
1022
1054
|
key: "get",
|
|
1023
1055
|
value: function () {
|
|
1024
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1025
|
-
var device,
|
|
1026
|
-
return _regeneratorRuntime().wrap(function
|
|
1027
|
-
while (1) switch (
|
|
1056
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref13) {
|
|
1057
|
+
var device, _ref13$path, path;
|
|
1058
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1059
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1028
1060
|
case 0:
|
|
1029
|
-
device =
|
|
1030
|
-
|
|
1061
|
+
device = _ref13.device, _ref13$path = _ref13.path, path = _ref13$path === void 0 ? "~meta@1.0/info" : _ref13$path;
|
|
1062
|
+
_context27.next = 3;
|
|
1031
1063
|
return this.request({
|
|
1032
1064
|
device: device,
|
|
1033
1065
|
path: path,
|
|
1034
1066
|
method: "GET"
|
|
1035
1067
|
});
|
|
1036
1068
|
case 3:
|
|
1037
|
-
return
|
|
1069
|
+
return _context27.abrupt("return", _context27.sent.body);
|
|
1038
1070
|
case 4:
|
|
1039
1071
|
case "end":
|
|
1040
|
-
return
|
|
1072
|
+
return _context27.stop();
|
|
1041
1073
|
}
|
|
1042
|
-
},
|
|
1074
|
+
}, _callee27, this);
|
|
1043
1075
|
}));
|
|
1044
1076
|
function get(_x19) {
|
|
1045
1077
|
return _get.apply(this, arguments);
|
|
@@ -1049,13 +1081,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1049
1081
|
}, {
|
|
1050
1082
|
key: "post",
|
|
1051
1083
|
value: function () {
|
|
1052
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1053
|
-
var device, tags,
|
|
1054
|
-
return _regeneratorRuntime().wrap(function
|
|
1055
|
-
while (1) switch (
|
|
1084
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref14) {
|
|
1085
|
+
var device, tags, _ref14$path, path;
|
|
1086
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1087
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1056
1088
|
case 0:
|
|
1057
|
-
device =
|
|
1058
|
-
|
|
1089
|
+
device = _ref14.device, tags = _ref14.tags, _ref14$path = _ref14.path, path = _ref14$path === void 0 ? "/schedule" : _ref14$path;
|
|
1090
|
+
_context28.next = 3;
|
|
1059
1091
|
return this.request({
|
|
1060
1092
|
tags: tags,
|
|
1061
1093
|
device: device,
|
|
@@ -1063,12 +1095,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1063
1095
|
method: "POST"
|
|
1064
1096
|
});
|
|
1065
1097
|
case 3:
|
|
1066
|
-
return
|
|
1098
|
+
return _context28.abrupt("return", _context28.sent);
|
|
1067
1099
|
case 4:
|
|
1068
1100
|
case "end":
|
|
1069
|
-
return
|
|
1101
|
+
return _context28.stop();
|
|
1070
1102
|
}
|
|
1071
|
-
},
|
|
1103
|
+
}, _callee28, this);
|
|
1072
1104
|
}));
|
|
1073
1105
|
function post(_x20) {
|
|
1074
1106
|
return _post.apply(this, arguments);
|
|
@@ -1078,26 +1110,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1078
1110
|
}, {
|
|
1079
1111
|
key: "request",
|
|
1080
1112
|
value: function () {
|
|
1081
|
-
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1082
|
-
var device, tags,
|
|
1083
|
-
return _regeneratorRuntime().wrap(function
|
|
1084
|
-
while (1) switch (
|
|
1113
|
+
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref15) {
|
|
1114
|
+
var device, tags, _ref15$method, method, _ref15$path, path, _tags;
|
|
1115
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1116
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1085
1117
|
case 0:
|
|
1086
|
-
device =
|
|
1118
|
+
device = _ref15.device, tags = _ref15.tags, _ref15$method = _ref15.method, method = _ref15$method === void 0 ? "POST" : _ref15$method, _ref15$path = _ref15.path, path = _ref15$path === void 0 ? "/schedule" : _ref15$path;
|
|
1087
1119
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
1088
1120
|
path: path,
|
|
1089
1121
|
method: method
|
|
1090
1122
|
});
|
|
1091
1123
|
if (device) _tags.device = device;
|
|
1092
|
-
|
|
1124
|
+
_context29.next = 5;
|
|
1093
1125
|
return this._request(_tags);
|
|
1094
1126
|
case 5:
|
|
1095
|
-
return
|
|
1127
|
+
return _context29.abrupt("return", _context29.sent);
|
|
1096
1128
|
case 6:
|
|
1097
1129
|
case "end":
|
|
1098
|
-
return
|
|
1130
|
+
return _context29.stop();
|
|
1099
1131
|
}
|
|
1100
|
-
},
|
|
1132
|
+
}, _callee29, this);
|
|
1101
1133
|
}));
|
|
1102
1134
|
function request(_x21) {
|
|
1103
1135
|
return _request.apply(this, arguments);
|
package/esm/aoconnect-base.js
CHANGED
|
@@ -659,9 +659,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
659
659
|
try {
|
|
660
660
|
const p = await mem.get("env", pid)
|
|
661
661
|
const from = p ? p.results.length : 0
|
|
662
|
-
const msgs = next
|
|
663
|
-
? await next()
|
|
664
|
-
: await hb.messages({ target: pid, from })
|
|
662
|
+
const msgs = next ? await next() : await hb.messages({ pid, from })
|
|
665
663
|
for (let v of msgs.edges) {
|
|
666
664
|
let item = {}
|
|
667
665
|
for (let k in v.node.message) {
|
package/esm/hb.js
CHANGED
|
@@ -158,7 +158,7 @@ class HB {
|
|
|
158
158
|
"random-seed": seed(16),
|
|
159
159
|
Type: "Process",
|
|
160
160
|
"scheduler-device": "scheduler@1.0",
|
|
161
|
-
"execution-device": "
|
|
161
|
+
"execution-device": "test-device@1.0",
|
|
162
162
|
})
|
|
163
163
|
)
|
|
164
164
|
return { res, pid: res.headers.get("process") }
|
|
@@ -166,11 +166,20 @@ class HB {
|
|
|
166
166
|
|
|
167
167
|
async message(args) {
|
|
168
168
|
const pid = args.pid
|
|
169
|
-
const slot = await this.schedule(args)
|
|
169
|
+
const { slot } = await this.schedule(args)
|
|
170
170
|
const res = await this.compute({ pid, slot })
|
|
171
171
|
return { slot, pid, res }
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
async scheduleLegacy({
|
|
174
|
+
pid,
|
|
175
|
+
action = "Eval",
|
|
176
|
+
tags = {},
|
|
177
|
+
data,
|
|
178
|
+
scheduler,
|
|
179
|
+
} = {}) {
|
|
180
|
+
if (action) tags.Action = action
|
|
181
|
+
return await this.schedule({ pid, tags, data, scheduler })
|
|
182
|
+
}
|
|
174
183
|
async schedule({ pid, tags = {}, data, scheduler } = {}) {
|
|
175
184
|
pid ??= this.pid
|
|
176
185
|
scheduler ??= this.scheduler
|
|
@@ -283,8 +292,7 @@ class HB {
|
|
|
283
292
|
"scheduler-device": "scheduler@1.0",
|
|
284
293
|
"execution-device": "genesis-wasm@1.0",
|
|
285
294
|
})
|
|
286
|
-
|
|
287
|
-
return { pid: res.process, res }
|
|
295
|
+
return await this.spawn(tags)
|
|
288
296
|
}
|
|
289
297
|
|
|
290
298
|
/*
|