wao 0.25.4 → 0.26.1
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/ao.js +86 -94
- package/cjs/hb.js +147 -120
- package/esm/ao.js +5 -8
- package/esm/hb.js +11 -8
- package/package.json +1 -1
package/cjs/ao.js
CHANGED
|
@@ -580,7 +580,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
580
580
|
pid,
|
|
581
581
|
_yield$this$hb$spawnL,
|
|
582
582
|
_module3,
|
|
583
|
-
|
|
583
|
+
_tags2,
|
|
584
584
|
p,
|
|
585
585
|
_args8 = arguments;
|
|
586
586
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -633,7 +633,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
633
633
|
case 23:
|
|
634
634
|
(_module3 = module) !== null && _module3 !== void 0 ? _module3 : module = this.module;
|
|
635
635
|
if (!tags.Authority && this.authority) tags.Authority = this.authority;
|
|
636
|
-
|
|
636
|
+
_tags2 = (0, _utils.buildTags)(null, tags);
|
|
637
637
|
_context8.next = 28;
|
|
638
638
|
return this.spawn({
|
|
639
639
|
variant: this.variant,
|
|
@@ -641,7 +641,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
641
641
|
module: module,
|
|
642
642
|
scheduler: scheduler,
|
|
643
643
|
signer: this.toSigner(jwk),
|
|
644
|
-
tags:
|
|
644
|
+
tags: _tags2,
|
|
645
645
|
data: (0, _utils.jsonToStr)(data)
|
|
646
646
|
});
|
|
647
647
|
case 28:
|
|
@@ -680,7 +680,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
680
680
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
681
681
|
while (1) switch (_context11.prev = _context11.next) {
|
|
682
682
|
case 0:
|
|
683
|
-
jwk = _ref12.jwk, pid = _ref12.pid, mid = _ref12.mid, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ?
|
|
683
|
+
jwk = _ref12.jwk, pid = _ref12.pid, mid = _ref12.mid, _ref12$check = _ref12.check, check = _ref12$check === void 0 ? [] : _ref12$check, get = _ref12.get, _ref12$timeout = _ref12.timeout, timeout = _ref12$timeout === void 0 ? 5000 : _ref12$timeout, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "aoconnect" : _ref12$mode, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 25 : _ref12$limit;
|
|
684
684
|
err = null;
|
|
685
685
|
hash = null;
|
|
686
686
|
getNewTxs = /*#__PURE__*/function () {
|
|
@@ -854,7 +854,7 @@ var AO = /*#__PURE__*/function () {
|
|
|
854
854
|
};
|
|
855
855
|
_txs = [_context11.t2];
|
|
856
856
|
if (!this.hb) {
|
|
857
|
-
_context11.next =
|
|
857
|
+
_context11.next = 23;
|
|
858
858
|
break;
|
|
859
859
|
}
|
|
860
860
|
_context11.next = 18;
|
|
@@ -864,31 +864,23 @@ var AO = /*#__PURE__*/function () {
|
|
|
864
864
|
});
|
|
865
865
|
case 18:
|
|
866
866
|
res = _context11.sent;
|
|
867
|
-
_context11.
|
|
868
|
-
_context11.next = 22;
|
|
867
|
+
_context11.next = 21;
|
|
869
868
|
return this.hb.get({
|
|
870
869
|
path: "/".concat(pid, "/push"),
|
|
871
870
|
slot: mid
|
|
872
871
|
});
|
|
873
|
-
case
|
|
874
|
-
_context11.next =
|
|
875
|
-
break;
|
|
876
|
-
case 24:
|
|
877
|
-
_context11.prev = 24;
|
|
878
|
-
_context11.t3 = _context11["catch"](19);
|
|
879
|
-
console.log(_context11.t3);
|
|
880
|
-
case 27:
|
|
881
|
-
_context11.next = 32;
|
|
872
|
+
case 21:
|
|
873
|
+
_context11.next = 26;
|
|
882
874
|
break;
|
|
883
|
-
case
|
|
884
|
-
_context11.next =
|
|
875
|
+
case 23:
|
|
876
|
+
_context11.next = 25;
|
|
885
877
|
return this.result({
|
|
886
878
|
process: pid,
|
|
887
879
|
message: mid
|
|
888
880
|
});
|
|
889
|
-
case
|
|
881
|
+
case 25:
|
|
890
882
|
res = _context11.sent;
|
|
891
|
-
case
|
|
883
|
+
case 26:
|
|
892
884
|
hash = getHash(res);
|
|
893
885
|
_txmap = _defineProperty({}, mid, {
|
|
894
886
|
checked: false,
|
|
@@ -899,131 +891,131 @@ var AO = /*#__PURE__*/function () {
|
|
|
899
891
|
res: res
|
|
900
892
|
});
|
|
901
893
|
checked = false;
|
|
902
|
-
case
|
|
894
|
+
case 30:
|
|
903
895
|
_iterator5 = _createForOfIteratorHelper(_txs);
|
|
904
|
-
_context11.prev =
|
|
896
|
+
_context11.prev = 31;
|
|
905
897
|
_iterator5.s();
|
|
906
|
-
case
|
|
898
|
+
case 33:
|
|
907
899
|
if ((_step5 = _iterator5.n()).done) {
|
|
908
|
-
_context11.next =
|
|
900
|
+
_context11.next = 47;
|
|
909
901
|
break;
|
|
910
902
|
}
|
|
911
903
|
v = _step5.value;
|
|
912
904
|
if (_txmap[v.id].checked) {
|
|
913
|
-
_context11.next =
|
|
905
|
+
_context11.next = 45;
|
|
914
906
|
break;
|
|
915
907
|
}
|
|
916
908
|
_txmap[v.id].checked = true;
|
|
917
909
|
if (!(0, _ramda.isNil)(_txmap[v.id].res)) {
|
|
918
|
-
_context11.next =
|
|
910
|
+
_context11.next = 42;
|
|
919
911
|
break;
|
|
920
912
|
}
|
|
921
|
-
_context11.next =
|
|
913
|
+
_context11.next = 40;
|
|
922
914
|
return this.result({
|
|
923
915
|
process: pid,
|
|
924
916
|
message: v.id
|
|
925
917
|
});
|
|
926
|
-
case
|
|
918
|
+
case 40:
|
|
927
919
|
_res = _context11.sent;
|
|
928
920
|
_txmap[v.id].res = _res;
|
|
929
|
-
case
|
|
921
|
+
case 42:
|
|
930
922
|
if (!(0, _ramda.isNil)(check) && check.length > 0) {
|
|
931
923
|
checked = (0, _utils.allChecked)(check, _txmap[v.id].res, v.from);
|
|
932
924
|
} else {
|
|
933
925
|
checked = true;
|
|
934
926
|
}
|
|
935
927
|
if (!checked) {
|
|
936
|
-
_context11.next =
|
|
928
|
+
_context11.next = 45;
|
|
937
929
|
break;
|
|
938
930
|
}
|
|
939
|
-
return _context11.abrupt("break",
|
|
940
|
-
case
|
|
941
|
-
_context11.next =
|
|
931
|
+
return _context11.abrupt("break", 47);
|
|
932
|
+
case 45:
|
|
933
|
+
_context11.next = 33;
|
|
942
934
|
break;
|
|
943
|
-
case
|
|
944
|
-
_context11.next =
|
|
935
|
+
case 47:
|
|
936
|
+
_context11.next = 52;
|
|
945
937
|
break;
|
|
946
|
-
case
|
|
947
|
-
_context11.prev =
|
|
948
|
-
_context11.
|
|
949
|
-
_iterator5.e(_context11.
|
|
950
|
-
case
|
|
951
|
-
_context11.prev =
|
|
938
|
+
case 49:
|
|
939
|
+
_context11.prev = 49;
|
|
940
|
+
_context11.t3 = _context11["catch"](31);
|
|
941
|
+
_iterator5.e(_context11.t3);
|
|
942
|
+
case 52:
|
|
943
|
+
_context11.prev = 52;
|
|
952
944
|
_iterator5.f();
|
|
953
|
-
return _context11.finish(
|
|
954
|
-
case
|
|
945
|
+
return _context11.finish(52);
|
|
946
|
+
case 55:
|
|
955
947
|
if (!checked) {
|
|
956
|
-
_context11.next =
|
|
948
|
+
_context11.next = 57;
|
|
957
949
|
break;
|
|
958
950
|
}
|
|
959
|
-
return _context11.abrupt("break",
|
|
960
|
-
case
|
|
961
|
-
_context11.next =
|
|
951
|
+
return _context11.abrupt("break", 62);
|
|
952
|
+
case 57:
|
|
953
|
+
_context11.next = 59;
|
|
962
954
|
return (0, _utils.wait)(1000);
|
|
963
|
-
case
|
|
964
|
-
_context11.next =
|
|
955
|
+
case 59:
|
|
956
|
+
_context11.next = 61;
|
|
965
957
|
return getNewTxs(pid, _txs, _txmap);
|
|
966
|
-
case
|
|
958
|
+
case 61:
|
|
967
959
|
if (Date.now() - start < timeout) {
|
|
968
|
-
_context11.next =
|
|
960
|
+
_context11.next = 30;
|
|
969
961
|
break;
|
|
970
962
|
}
|
|
971
|
-
case
|
|
963
|
+
case 62:
|
|
972
964
|
if (checked) {
|
|
973
|
-
_context11.next =
|
|
965
|
+
_context11.next = 66;
|
|
974
966
|
break;
|
|
975
967
|
}
|
|
976
968
|
err = "something went wrong!";
|
|
977
|
-
_context11.next =
|
|
969
|
+
_context11.next = 90;
|
|
978
970
|
break;
|
|
979
|
-
case
|
|
980
|
-
_context11.
|
|
981
|
-
_context11.
|
|
982
|
-
_context11.next =
|
|
971
|
+
case 66:
|
|
972
|
+
_context11.t4 = _utils.mergeOut;
|
|
973
|
+
_context11.t5 = out;
|
|
974
|
+
_context11.next = 70;
|
|
983
975
|
return checkOut(get, _txs, _txmap, out);
|
|
984
|
-
case
|
|
985
|
-
_context11.
|
|
986
|
-
_context11.
|
|
987
|
-
out = (0, _context11.
|
|
976
|
+
case 70:
|
|
977
|
+
_context11.t6 = _context11.sent;
|
|
978
|
+
_context11.t7 = get;
|
|
979
|
+
out = (0, _context11.t4)(_context11.t5, _context11.t6, _context11.t7);
|
|
988
980
|
if (!(!(0, _utils.isOutComplete)(out, get) && !(0, _ramda.isNil)(get))) {
|
|
989
|
-
_context11.next =
|
|
981
|
+
_context11.next = 90;
|
|
990
982
|
break;
|
|
991
983
|
}
|
|
992
|
-
case
|
|
984
|
+
case 74:
|
|
993
985
|
if (!(Date.now() - start < timeout)) {
|
|
994
|
-
_context11.next =
|
|
986
|
+
_context11.next = 90;
|
|
995
987
|
break;
|
|
996
988
|
}
|
|
997
|
-
_context11.next =
|
|
989
|
+
_context11.next = 77;
|
|
998
990
|
return getNewTxs(pid, _txs, _txmap);
|
|
999
|
-
case
|
|
1000
|
-
_context11.
|
|
1001
|
-
_context11.
|
|
1002
|
-
_context11.next =
|
|
991
|
+
case 77:
|
|
992
|
+
_context11.t8 = _utils.mergeOut;
|
|
993
|
+
_context11.t9 = out;
|
|
994
|
+
_context11.next = 81;
|
|
1003
995
|
return checkOut(get, _txs, _txmap, out);
|
|
1004
|
-
case
|
|
1005
|
-
_context11.
|
|
1006
|
-
_context11.
|
|
1007
|
-
out = (0, _context11.
|
|
996
|
+
case 81:
|
|
997
|
+
_context11.t10 = _context11.sent;
|
|
998
|
+
_context11.t11 = get;
|
|
999
|
+
out = (0, _context11.t8)(_context11.t9, _context11.t10, _context11.t11);
|
|
1008
1000
|
if (!(0, _utils.isOutComplete)(out, get)) {
|
|
1009
|
-
_context11.next =
|
|
1001
|
+
_context11.next = 86;
|
|
1010
1002
|
break;
|
|
1011
1003
|
}
|
|
1012
|
-
return _context11.abrupt("break",
|
|
1013
|
-
case
|
|
1014
|
-
_context11.next =
|
|
1004
|
+
return _context11.abrupt("break", 90);
|
|
1005
|
+
case 86:
|
|
1006
|
+
_context11.next = 88;
|
|
1015
1007
|
return (0, _utils.wait)(1000);
|
|
1016
|
-
case
|
|
1017
|
-
_context11.next =
|
|
1008
|
+
case 88:
|
|
1009
|
+
_context11.next = 74;
|
|
1018
1010
|
break;
|
|
1019
|
-
case
|
|
1020
|
-
_context11.next =
|
|
1011
|
+
case 90:
|
|
1012
|
+
_context11.next = 95;
|
|
1021
1013
|
break;
|
|
1022
|
-
case
|
|
1023
|
-
_context11.prev =
|
|
1024
|
-
_context11.
|
|
1025
|
-
err = _context11.
|
|
1026
|
-
case
|
|
1014
|
+
case 92:
|
|
1015
|
+
_context11.prev = 92;
|
|
1016
|
+
_context11.t12 = _context11["catch"](7);
|
|
1017
|
+
err = _context11.t12;
|
|
1018
|
+
case 95:
|
|
1027
1019
|
return _context11.abrupt("return", {
|
|
1028
1020
|
mid: mid,
|
|
1029
1021
|
res: res,
|
|
@@ -1031,11 +1023,11 @@ var AO = /*#__PURE__*/function () {
|
|
|
1031
1023
|
out: out,
|
|
1032
1024
|
results: results
|
|
1033
1025
|
});
|
|
1034
|
-
case
|
|
1026
|
+
case 96:
|
|
1035
1027
|
case "end":
|
|
1036
1028
|
return _context11.stop();
|
|
1037
1029
|
}
|
|
1038
|
-
}, _callee11, this, [[7,
|
|
1030
|
+
}, _callee11, this, [[7, 92], [31, 49, 52, 55]]);
|
|
1039
1031
|
}));
|
|
1040
1032
|
function res(_x7) {
|
|
1041
1033
|
return _res2.apply(this, arguments);
|
|
@@ -1046,11 +1038,11 @@ var AO = /*#__PURE__*/function () {
|
|
|
1046
1038
|
key: "msg",
|
|
1047
1039
|
value: function () {
|
|
1048
1040
|
var _msg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref15) {
|
|
1049
|
-
var pid, jwk, data, _ref15$act, act, _ref15$tags, tags, _ref15$check, check, get, _ref15$timeout, timeout, _ref15$mode, mode, _ref15$limit, limit, err, _yield$this$ar$checkW2, _yield$this$hb$schedu, mid,
|
|
1041
|
+
var pid, jwk, data, _ref15$act, act, _ref15$tags, tags, _ref15$check, check, get, _ref15$timeout, timeout, _ref15$mode, mode, _ref15$limit, limit, err, _yield$this$ar$checkW2, _yield$this$hb$schedu, mid, _tags3, _mid;
|
|
1050
1042
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1051
1043
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1052
1044
|
case 0:
|
|
1053
|
-
pid = _ref15.pid, jwk = _ref15.jwk, data = _ref15.data, _ref15$act = _ref15.act, act = _ref15$act === void 0 ? "Eval" : _ref15$act, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get, _ref15$timeout = _ref15.timeout, timeout = _ref15$timeout === void 0 ?
|
|
1045
|
+
pid = _ref15.pid, jwk = _ref15.jwk, data = _ref15.data, _ref15$act = _ref15.act, act = _ref15$act === void 0 ? "Eval" : _ref15$act, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, _ref15$check = _ref15.check, check = _ref15$check === void 0 ? [] : _ref15$check, get = _ref15.get, _ref15$timeout = _ref15.timeout, timeout = _ref15$timeout === void 0 ? 5000 : _ref15$timeout, _ref15$mode = _ref15.mode, mode = _ref15$mode === void 0 ? "aoconnect" : _ref15$mode, _ref15$limit = _ref15.limit, limit = _ref15$limit === void 0 ? 25 : _ref15$limit;
|
|
1054
1046
|
_context12.next = 3;
|
|
1055
1047
|
return this.ar.checkWallet({
|
|
1056
1048
|
jwk: jwk
|
|
@@ -1095,13 +1087,13 @@ var AO = /*#__PURE__*/function () {
|
|
|
1095
1087
|
case 15:
|
|
1096
1088
|
return _context12.abrupt("return", _context12.sent);
|
|
1097
1089
|
case 18:
|
|
1098
|
-
|
|
1090
|
+
_tags3 = (0, _utils.buildTags)(act, tags);
|
|
1099
1091
|
_context12.next = 21;
|
|
1100
1092
|
return this.message({
|
|
1101
1093
|
variant: this.variant,
|
|
1102
1094
|
process: pid,
|
|
1103
1095
|
signer: this.toSigner(jwk),
|
|
1104
|
-
tags:
|
|
1096
|
+
tags: _tags3,
|
|
1105
1097
|
data: (0, _utils.jsonToStr)(data)
|
|
1106
1098
|
});
|
|
1107
1099
|
case 21:
|
|
@@ -1881,7 +1873,7 @@ var getParams = function getParams(tags, opts) {
|
|
|
1881
1873
|
var _opts = opts;
|
|
1882
1874
|
if ((!(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.get) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.check) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.jwk) || !(0, _ramda.isNil)(tags === null || tags === void 0 ? void 0 : tags.data) || (0, _ramda.is)(Boolean, tags) || (0, _ramda.is)(String, tags)) && (0, _ramda.isNil)(opts)) {
|
|
1883
1875
|
_opts = tags;
|
|
1884
|
-
_tags =
|
|
1876
|
+
_tags = {};
|
|
1885
1877
|
}
|
|
1886
1878
|
if ((0, _ramda.isNil)(_opts)) _opts = {
|
|
1887
1879
|
get: false
|
package/cjs/hb.js
CHANGED
|
@@ -8,8 +8,6 @@ var _aoconnect = require("@permaweb/aoconnect");
|
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
10
|
var _signer = require("./signer.js");
|
|
11
|
-
var _path4 = require("path");
|
|
12
|
-
var _fs = require("fs");
|
|
13
11
|
var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
|
|
14
12
|
var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
|
|
15
13
|
var _excluded = ["path"];
|
|
@@ -340,7 +338,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
340
338
|
case 0:
|
|
341
339
|
wasm = Buffer.from(_aos_wamr["default"], "base64");
|
|
342
340
|
_context10.next = 3;
|
|
343
|
-
return this.
|
|
341
|
+
return this.cacheBinary(wasm, "application/wasm");
|
|
344
342
|
case 3:
|
|
345
343
|
id = _context10.sent;
|
|
346
344
|
(_this$image = this.image) !== null && _this$image !== void 0 ? _this$image : this.image = id;
|
|
@@ -762,7 +760,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
762
760
|
return spawn;
|
|
763
761
|
}()
|
|
764
762
|
}, {
|
|
765
|
-
key: "
|
|
763
|
+
key: "cacheModule",
|
|
766
764
|
value: function () {
|
|
767
765
|
var _cacheModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data, type) {
|
|
768
766
|
var _yield$this$spawn, pid, _yield$this$schedule, slot, msgs;
|
|
@@ -804,15 +802,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
804
802
|
}
|
|
805
803
|
}, _callee22, this);
|
|
806
804
|
}));
|
|
807
|
-
function
|
|
805
|
+
function cacheModule(_x19, _x20) {
|
|
808
806
|
return _cacheModule.apply(this, arguments);
|
|
809
807
|
}
|
|
810
|
-
return
|
|
808
|
+
return cacheModule;
|
|
811
809
|
}()
|
|
812
810
|
}, {
|
|
813
|
-
key: "
|
|
811
|
+
key: "cacheBinary",
|
|
814
812
|
value: function () {
|
|
815
|
-
var
|
|
813
|
+
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data, type) {
|
|
816
814
|
var res;
|
|
817
815
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
818
816
|
while (1) switch (_context23.prev = _context23.next) {
|
|
@@ -832,10 +830,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
832
830
|
}
|
|
833
831
|
}, _callee23, this);
|
|
834
832
|
}));
|
|
835
|
-
function
|
|
836
|
-
return
|
|
833
|
+
function cacheBinary(_x21, _x22) {
|
|
834
|
+
return _cacheBinary.apply(this, arguments);
|
|
837
835
|
}
|
|
838
|
-
return
|
|
836
|
+
return cacheBinary;
|
|
839
837
|
}()
|
|
840
838
|
}, {
|
|
841
839
|
key: "message",
|
|
@@ -1241,41 +1239,68 @@ var HB = /*#__PURE__*/function () {
|
|
|
1241
1239
|
}
|
|
1242
1240
|
return now;
|
|
1243
1241
|
}()
|
|
1242
|
+
}, {
|
|
1243
|
+
key: "slot",
|
|
1244
|
+
value: function () {
|
|
1245
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(_ref12) {
|
|
1246
|
+
var pid, _ref12$path, path;
|
|
1247
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1248
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1249
|
+
case 0:
|
|
1250
|
+
pid = _ref12.pid, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "" : _ref12$path;
|
|
1251
|
+
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1252
|
+
_context31.next = 4;
|
|
1253
|
+
return this.getJSON({
|
|
1254
|
+
path: "/".concat(pid, "/slot").concat(path)
|
|
1255
|
+
});
|
|
1256
|
+
case 4:
|
|
1257
|
+
return _context31.abrupt("return", _context31.sent);
|
|
1258
|
+
case 5:
|
|
1259
|
+
case "end":
|
|
1260
|
+
return _context31.stop();
|
|
1261
|
+
}
|
|
1262
|
+
}, _callee31, this);
|
|
1263
|
+
}));
|
|
1264
|
+
function slot(_x27) {
|
|
1265
|
+
return _slot.apply(this, arguments);
|
|
1266
|
+
}
|
|
1267
|
+
return slot;
|
|
1268
|
+
}()
|
|
1244
1269
|
}, {
|
|
1245
1270
|
key: "messages",
|
|
1246
1271
|
value: function () {
|
|
1247
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1272
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
1248
1273
|
var _this2 = this;
|
|
1249
|
-
var
|
|
1274
|
+
var _ref13,
|
|
1250
1275
|
pid,
|
|
1251
1276
|
from,
|
|
1252
1277
|
to,
|
|
1253
1278
|
limit,
|
|
1254
1279
|
params,
|
|
1255
1280
|
res,
|
|
1256
|
-
|
|
1257
|
-
return _regeneratorRuntime().wrap(function
|
|
1258
|
-
while (1) switch (
|
|
1281
|
+
_args33 = arguments;
|
|
1282
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1283
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1259
1284
|
case 0:
|
|
1260
|
-
|
|
1285
|
+
_ref13 = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {}, pid = _ref13.pid, from = _ref13.from, to = _ref13.to, limit = _ref13.limit;
|
|
1261
1286
|
params = "target=".concat(pid);
|
|
1262
1287
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1263
1288
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1264
1289
|
params += "&accept=application/aos-2";
|
|
1265
|
-
|
|
1290
|
+
_context33.next = 7;
|
|
1266
1291
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1267
1292
|
return r.json();
|
|
1268
1293
|
});
|
|
1269
1294
|
case 7:
|
|
1270
|
-
res =
|
|
1295
|
+
res = _context33.sent;
|
|
1271
1296
|
if (res.page_info.has_next_page) {
|
|
1272
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1297
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1273
1298
|
var from2;
|
|
1274
|
-
return _regeneratorRuntime().wrap(function
|
|
1275
|
-
while (1) switch (
|
|
1299
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1300
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1276
1301
|
case 0:
|
|
1277
1302
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1278
|
-
|
|
1303
|
+
_context32.next = 3;
|
|
1279
1304
|
return _this2.message({
|
|
1280
1305
|
pid: pid,
|
|
1281
1306
|
from: from2,
|
|
@@ -1283,20 +1308,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1283
1308
|
limit: limit
|
|
1284
1309
|
});
|
|
1285
1310
|
case 3:
|
|
1286
|
-
return
|
|
1311
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1287
1312
|
case 4:
|
|
1288
1313
|
case "end":
|
|
1289
|
-
return
|
|
1314
|
+
return _context32.stop();
|
|
1290
1315
|
}
|
|
1291
|
-
},
|
|
1316
|
+
}, _callee32);
|
|
1292
1317
|
}));
|
|
1293
1318
|
}
|
|
1294
|
-
return
|
|
1319
|
+
return _context33.abrupt("return", res);
|
|
1295
1320
|
case 10:
|
|
1296
1321
|
case "end":
|
|
1297
|
-
return
|
|
1322
|
+
return _context33.stop();
|
|
1298
1323
|
}
|
|
1299
|
-
},
|
|
1324
|
+
}, _callee33, this);
|
|
1300
1325
|
}));
|
|
1301
1326
|
function messages() {
|
|
1302
1327
|
return _messages.apply(this, arguments);
|
|
@@ -1306,19 +1331,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
1306
1331
|
}, {
|
|
1307
1332
|
key: "spawnLegacy",
|
|
1308
1333
|
value: function () {
|
|
1309
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1310
|
-
var
|
|
1334
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1335
|
+
var _ref15,
|
|
1311
1336
|
module,
|
|
1312
|
-
|
|
1337
|
+
_ref15$tags,
|
|
1313
1338
|
tags,
|
|
1314
1339
|
data,
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1340
|
+
t,
|
|
1341
|
+
_args34 = arguments;
|
|
1342
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1343
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1318
1344
|
case 0:
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
data: data,
|
|
1345
|
+
_ref15 = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {}, module = _ref15.module, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, data = _ref15.data;
|
|
1346
|
+
t = {
|
|
1322
1347
|
Type: "Process",
|
|
1323
1348
|
"Data-Protocol": "ao",
|
|
1324
1349
|
Variant: "ao.TN.1",
|
|
@@ -1334,16 +1359,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
1334
1359
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1335
1360
|
"patch-from": "/results/outbox",
|
|
1336
1361
|
"stack-keys": ["init", "compute", "snapshot", "normalize"]
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1362
|
+
};
|
|
1363
|
+
if (data) t.data = data;
|
|
1364
|
+
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1365
|
+
_context34.next = 6;
|
|
1339
1366
|
return this.spawn(tags);
|
|
1340
|
-
case
|
|
1341
|
-
return
|
|
1342
|
-
case
|
|
1367
|
+
case 6:
|
|
1368
|
+
return _context34.abrupt("return", _context34.sent);
|
|
1369
|
+
case 7:
|
|
1343
1370
|
case "end":
|
|
1344
|
-
return
|
|
1371
|
+
return _context34.stop();
|
|
1345
1372
|
}
|
|
1346
|
-
},
|
|
1373
|
+
}, _callee34, this);
|
|
1347
1374
|
}));
|
|
1348
1375
|
function spawnLegacy() {
|
|
1349
1376
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1353,22 +1380,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
1353
1380
|
}, {
|
|
1354
1381
|
key: "results",
|
|
1355
1382
|
value: function () {
|
|
1356
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1357
|
-
var
|
|
1383
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1384
|
+
var _ref16,
|
|
1358
1385
|
process,
|
|
1359
1386
|
limit,
|
|
1360
|
-
|
|
1387
|
+
_ref16$sort,
|
|
1361
1388
|
sort,
|
|
1362
1389
|
from,
|
|
1363
1390
|
to,
|
|
1364
1391
|
params,
|
|
1365
1392
|
addParam,
|
|
1366
1393
|
res,
|
|
1367
|
-
|
|
1368
|
-
return _regeneratorRuntime().wrap(function
|
|
1369
|
-
while (1) switch (
|
|
1394
|
+
_args35 = arguments;
|
|
1395
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1396
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1370
1397
|
case 0:
|
|
1371
|
-
|
|
1398
|
+
_ref16 = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {}, process = _ref16.process, limit = _ref16.limit, _ref16$sort = _ref16.sort, sort = _ref16$sort === void 0 ? "DESC" : _ref16$sort, from = _ref16.from, to = _ref16.to;
|
|
1372
1399
|
params = "";
|
|
1373
1400
|
addParam = function addParam(key, val) {
|
|
1374
1401
|
params += params === "" ? "?" : "&";
|
|
@@ -1378,7 +1405,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1378
1405
|
if (sort) addParam("sort", sort);
|
|
1379
1406
|
if (from) addParam("from", from);
|
|
1380
1407
|
if (to) addParam("to", to);
|
|
1381
|
-
|
|
1408
|
+
_context35.next = 9;
|
|
1382
1409
|
return this.post({
|
|
1383
1410
|
path: "/~relay@1.0/call",
|
|
1384
1411
|
method: "GET",
|
|
@@ -1386,13 +1413,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1386
1413
|
"content-type": "application/json"
|
|
1387
1414
|
});
|
|
1388
1415
|
case 9:
|
|
1389
|
-
res =
|
|
1390
|
-
return
|
|
1416
|
+
res = _context35.sent;
|
|
1417
|
+
return _context35.abrupt("return", JSON.parse(res.body));
|
|
1391
1418
|
case 11:
|
|
1392
1419
|
case "end":
|
|
1393
|
-
return
|
|
1420
|
+
return _context35.stop();
|
|
1394
1421
|
}
|
|
1395
|
-
},
|
|
1422
|
+
}, _callee35, this);
|
|
1396
1423
|
}));
|
|
1397
1424
|
function results() {
|
|
1398
1425
|
return _results.apply(this, arguments);
|
|
@@ -1402,27 +1429,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1402
1429
|
}, {
|
|
1403
1430
|
key: "dryrun",
|
|
1404
1431
|
value: function () {
|
|
1405
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1406
|
-
var
|
|
1407
|
-
|
|
1432
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1433
|
+
var _ref17,
|
|
1434
|
+
_ref17$tags,
|
|
1408
1435
|
tags,
|
|
1409
1436
|
pid,
|
|
1410
1437
|
action,
|
|
1411
1438
|
data,
|
|
1412
1439
|
json,
|
|
1413
1440
|
res,
|
|
1414
|
-
|
|
1415
|
-
return _regeneratorRuntime().wrap(function
|
|
1416
|
-
while (1) switch (
|
|
1441
|
+
_args36 = arguments;
|
|
1442
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1443
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1417
1444
|
case 0:
|
|
1418
|
-
|
|
1445
|
+
_ref17 = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {}, _ref17$tags = _ref17.tags, tags = _ref17$tags === void 0 ? {} : _ref17$tags, pid = _ref17.pid, action = _ref17.action, data = _ref17.data;
|
|
1419
1446
|
if (typeof action === "string") tags.Action = action;
|
|
1420
1447
|
json = {
|
|
1421
1448
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1422
1449
|
Owner: this.addr
|
|
1423
1450
|
};
|
|
1424
1451
|
if (data) json.Data = data;
|
|
1425
|
-
|
|
1452
|
+
_context36.next = 6;
|
|
1426
1453
|
return this.post({
|
|
1427
1454
|
path: "/~relay@1.0/call",
|
|
1428
1455
|
method: "POST",
|
|
@@ -1431,13 +1458,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1431
1458
|
"relay-body": JSON.stringify(json)
|
|
1432
1459
|
});
|
|
1433
1460
|
case 6:
|
|
1434
|
-
res =
|
|
1435
|
-
return
|
|
1461
|
+
res = _context36.sent;
|
|
1462
|
+
return _context36.abrupt("return", JSON.parse(res.body));
|
|
1436
1463
|
case 8:
|
|
1437
1464
|
case "end":
|
|
1438
|
-
return
|
|
1465
|
+
return _context36.stop();
|
|
1439
1466
|
}
|
|
1440
|
-
},
|
|
1467
|
+
}, _callee36, this);
|
|
1441
1468
|
}));
|
|
1442
1469
|
function dryrun() {
|
|
1443
1470
|
return _dryrun.apply(this, arguments);
|
|
@@ -1447,29 +1474,29 @@ var HB = /*#__PURE__*/function () {
|
|
|
1447
1474
|
}, {
|
|
1448
1475
|
key: "post",
|
|
1449
1476
|
value: function () {
|
|
1450
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1477
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(obj, json) {
|
|
1451
1478
|
var _json;
|
|
1452
|
-
return _regeneratorRuntime().wrap(function
|
|
1453
|
-
while (1) switch (
|
|
1479
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1480
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1454
1481
|
case 0:
|
|
1455
1482
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1456
1483
|
obj.path += _json;
|
|
1457
|
-
|
|
1458
|
-
|
|
1484
|
+
_context37.t0 = this;
|
|
1485
|
+
_context37.next = 5;
|
|
1459
1486
|
return this.sign(obj);
|
|
1460
1487
|
case 5:
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1488
|
+
_context37.t1 = _context37.sent;
|
|
1489
|
+
_context37.next = 8;
|
|
1490
|
+
return _context37.t0.send.call(_context37.t0, _context37.t1);
|
|
1464
1491
|
case 8:
|
|
1465
|
-
return
|
|
1492
|
+
return _context37.abrupt("return", _context37.sent);
|
|
1466
1493
|
case 9:
|
|
1467
1494
|
case "end":
|
|
1468
|
-
return
|
|
1495
|
+
return _context37.stop();
|
|
1469
1496
|
}
|
|
1470
|
-
},
|
|
1497
|
+
}, _callee37, this);
|
|
1471
1498
|
}));
|
|
1472
|
-
function post(
|
|
1499
|
+
function post(_x28, _x29) {
|
|
1473
1500
|
return _post.apply(this, arguments);
|
|
1474
1501
|
}
|
|
1475
1502
|
return post;
|
|
@@ -1477,7 +1504,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1477
1504
|
}, {
|
|
1478
1505
|
key: "get",
|
|
1479
1506
|
value: function () {
|
|
1480
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1507
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(_ref18) {
|
|
1481
1508
|
var _path3;
|
|
1482
1509
|
var path,
|
|
1483
1510
|
params,
|
|
@@ -1488,12 +1515,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1488
1515
|
k,
|
|
1489
1516
|
response,
|
|
1490
1517
|
headers,
|
|
1491
|
-
|
|
1492
|
-
return _regeneratorRuntime().wrap(function
|
|
1493
|
-
while (1) switch (
|
|
1518
|
+
_args38 = arguments;
|
|
1519
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1520
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1494
1521
|
case 0:
|
|
1495
|
-
path =
|
|
1496
|
-
json =
|
|
1522
|
+
path = _ref18.path, params = _objectWithoutProperties(_ref18, _excluded);
|
|
1523
|
+
json = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : false;
|
|
1497
1524
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1498
1525
|
(_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
|
|
1499
1526
|
if (!/^\//.test(path)) path = "/" + path;
|
|
@@ -1505,34 +1532,34 @@ var HB = /*#__PURE__*/function () {
|
|
|
1505
1532
|
i++;
|
|
1506
1533
|
}
|
|
1507
1534
|
}
|
|
1508
|
-
|
|
1535
|
+
_context38.next = 9;
|
|
1509
1536
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1510
1537
|
case 9:
|
|
1511
|
-
response =
|
|
1538
|
+
response = _context38.sent;
|
|
1512
1539
|
headers = {};
|
|
1513
1540
|
response.headers.forEach(function (v, k) {
|
|
1514
1541
|
return headers[k] = v;
|
|
1515
1542
|
});
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1543
|
+
_context38.t0 = response;
|
|
1544
|
+
_context38.t1 = headers;
|
|
1545
|
+
_context38.next = 16;
|
|
1519
1546
|
return response.text();
|
|
1520
1547
|
case 16:
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
return
|
|
1524
|
-
response:
|
|
1525
|
-
headers:
|
|
1526
|
-
body:
|
|
1527
|
-
status:
|
|
1548
|
+
_context38.t2 = _context38.sent;
|
|
1549
|
+
_context38.t3 = response.status;
|
|
1550
|
+
return _context38.abrupt("return", {
|
|
1551
|
+
response: _context38.t0,
|
|
1552
|
+
headers: _context38.t1,
|
|
1553
|
+
body: _context38.t2,
|
|
1554
|
+
status: _context38.t3
|
|
1528
1555
|
});
|
|
1529
1556
|
case 19:
|
|
1530
1557
|
case "end":
|
|
1531
|
-
return
|
|
1558
|
+
return _context38.stop();
|
|
1532
1559
|
}
|
|
1533
|
-
},
|
|
1560
|
+
}, _callee38, this);
|
|
1534
1561
|
}));
|
|
1535
|
-
function get(
|
|
1562
|
+
function get(_x30) {
|
|
1536
1563
|
return _get.apply(this, arguments);
|
|
1537
1564
|
}
|
|
1538
1565
|
return get;
|
|
@@ -1540,23 +1567,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1540
1567
|
}, {
|
|
1541
1568
|
key: "postJSON",
|
|
1542
1569
|
value: function () {
|
|
1543
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1570
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(args) {
|
|
1544
1571
|
var res;
|
|
1545
|
-
return _regeneratorRuntime().wrap(function
|
|
1546
|
-
while (1) switch (
|
|
1572
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1573
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1547
1574
|
case 0:
|
|
1548
|
-
|
|
1575
|
+
_context39.next = 2;
|
|
1549
1576
|
return this.post(args, true);
|
|
1550
1577
|
case 2:
|
|
1551
|
-
res =
|
|
1552
|
-
return
|
|
1578
|
+
res = _context39.sent;
|
|
1579
|
+
return _context39.abrupt("return", JSON.parse(res.body));
|
|
1553
1580
|
case 4:
|
|
1554
1581
|
case "end":
|
|
1555
|
-
return
|
|
1582
|
+
return _context39.stop();
|
|
1556
1583
|
}
|
|
1557
|
-
},
|
|
1584
|
+
}, _callee39, this);
|
|
1558
1585
|
}));
|
|
1559
|
-
function postJSON(
|
|
1586
|
+
function postJSON(_x31) {
|
|
1560
1587
|
return _postJSON.apply(this, arguments);
|
|
1561
1588
|
}
|
|
1562
1589
|
return postJSON;
|
|
@@ -1564,23 +1591,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1564
1591
|
}, {
|
|
1565
1592
|
key: "getJSON",
|
|
1566
1593
|
value: function () {
|
|
1567
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1594
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(args) {
|
|
1568
1595
|
var res;
|
|
1569
|
-
return _regeneratorRuntime().wrap(function
|
|
1570
|
-
while (1) switch (
|
|
1596
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1597
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1571
1598
|
case 0:
|
|
1572
|
-
|
|
1599
|
+
_context40.next = 2;
|
|
1573
1600
|
return this.get(args, true);
|
|
1574
1601
|
case 2:
|
|
1575
|
-
res =
|
|
1576
|
-
return
|
|
1602
|
+
res = _context40.sent;
|
|
1603
|
+
return _context40.abrupt("return", JSON.parse(res.body));
|
|
1577
1604
|
case 4:
|
|
1578
1605
|
case "end":
|
|
1579
|
-
return
|
|
1606
|
+
return _context40.stop();
|
|
1580
1607
|
}
|
|
1581
|
-
},
|
|
1608
|
+
}, _callee40, this);
|
|
1582
1609
|
}));
|
|
1583
|
-
function getJSON(
|
|
1610
|
+
function getJSON(_x32) {
|
|
1584
1611
|
return _getJSON.apply(this, arguments);
|
|
1585
1612
|
}
|
|
1586
1613
|
return getJSON;
|
package/esm/ao.js
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
wait,
|
|
41
41
|
isLocalhost,
|
|
42
42
|
tag,
|
|
43
|
+
tags as _tags,
|
|
43
44
|
ltags,
|
|
44
45
|
action,
|
|
45
46
|
isData,
|
|
@@ -415,7 +416,7 @@ class AO {
|
|
|
415
416
|
mid,
|
|
416
417
|
check = [],
|
|
417
418
|
get,
|
|
418
|
-
timeout =
|
|
419
|
+
timeout = 5000,
|
|
419
420
|
mode = "aoconnect",
|
|
420
421
|
limit = 25,
|
|
421
422
|
}) {
|
|
@@ -480,11 +481,7 @@ class AO {
|
|
|
480
481
|
let _txs = [{ id: mid, from: await this.ar.toAddr(jwk) }]
|
|
481
482
|
if (this.hb) {
|
|
482
483
|
res = await this.hb.computeLegacy({ pid, slot: mid })
|
|
483
|
-
|
|
484
|
-
await this.hb.get({ path: `/${pid}/push`, slot: mid })
|
|
485
|
-
} catch (e) {
|
|
486
|
-
console.log(e)
|
|
487
|
-
}
|
|
484
|
+
await this.hb.get({ path: `/${pid}/push`, slot: mid })
|
|
488
485
|
} else {
|
|
489
486
|
res = await this.result({ process: pid, message: mid })
|
|
490
487
|
}
|
|
@@ -540,7 +537,7 @@ class AO {
|
|
|
540
537
|
tags = {},
|
|
541
538
|
check = [],
|
|
542
539
|
get,
|
|
543
|
-
timeout =
|
|
540
|
+
timeout = 5000,
|
|
544
541
|
mode = "aoconnect",
|
|
545
542
|
limit = 25,
|
|
546
543
|
}) {
|
|
@@ -855,7 +852,7 @@ const getParams = (tags, opts) => {
|
|
|
855
852
|
isNil(opts)
|
|
856
853
|
) {
|
|
857
854
|
_opts = tags
|
|
858
|
-
_tags =
|
|
855
|
+
_tags = {}
|
|
859
856
|
}
|
|
860
857
|
|
|
861
858
|
if (isNil(_opts)) _opts = { get: false }
|
package/esm/hb.js
CHANGED
|
@@ -2,8 +2,6 @@ import { connect, createSigner } from "@permaweb/aoconnect"
|
|
|
2
2
|
import { isEmpty, last, isNotNil, mergeLeft } from "ramda"
|
|
3
3
|
import { toAddr, buildTags } from "./utils.js"
|
|
4
4
|
import { send as _send, createRequest } from "./signer.js"
|
|
5
|
-
import { resolve } from "path"
|
|
6
|
-
import { readFileSync } from "fs"
|
|
7
5
|
import hyper_aos from "./lua/hyper-aos.js"
|
|
8
6
|
import aos_wamr from "./lua/aos_wamr.js"
|
|
9
7
|
|
|
@@ -99,7 +97,7 @@ class HB {
|
|
|
99
97
|
|
|
100
98
|
async getImage() {
|
|
101
99
|
const wasm = Buffer.from(aos_wamr, "base64")
|
|
102
|
-
const id = await this.
|
|
100
|
+
const id = await this.cacheBinary(wasm, "application/wasm")
|
|
103
101
|
this.image ??= id
|
|
104
102
|
return id
|
|
105
103
|
}
|
|
@@ -212,7 +210,7 @@ class HB {
|
|
|
212
210
|
return { res, pid: res.headers.process }
|
|
213
211
|
}
|
|
214
212
|
|
|
215
|
-
async
|
|
213
|
+
async cacheModule(data, type) {
|
|
216
214
|
if (!this.cache) {
|
|
217
215
|
const { pid } = await this.spawn({})
|
|
218
216
|
this.cache = pid
|
|
@@ -226,7 +224,7 @@ class HB {
|
|
|
226
224
|
return msgs.edges[0].node.message.Id
|
|
227
225
|
}
|
|
228
226
|
|
|
229
|
-
async
|
|
227
|
+
async cacheBinary(data, type) {
|
|
230
228
|
const res = await this.post({ path: "/~wao@1.0/cache_module", data, type })
|
|
231
229
|
return res.headers.id
|
|
232
230
|
}
|
|
@@ -356,6 +354,10 @@ class HB {
|
|
|
356
354
|
if (path && !/^\//.test(path)) path = "/" + path
|
|
357
355
|
return await this.getJSON({ path: `/${pid}/now${path}` })
|
|
358
356
|
}
|
|
357
|
+
async slot({ pid, path = "" }) {
|
|
358
|
+
if (path && !/^\//.test(path)) path = "/" + path
|
|
359
|
+
return await this.getJSON({ path: `/${pid}/slot${path}` })
|
|
360
|
+
}
|
|
359
361
|
|
|
360
362
|
async messages({ pid, from, to, limit } = {}) {
|
|
361
363
|
let params = `target=${pid}`
|
|
@@ -375,8 +377,7 @@ class HB {
|
|
|
375
377
|
}
|
|
376
378
|
|
|
377
379
|
async spawnLegacy({ module, tags = {}, data } = {}) {
|
|
378
|
-
|
|
379
|
-
data,
|
|
380
|
+
let t = {
|
|
380
381
|
Type: "Process",
|
|
381
382
|
"Data-Protocol": "ao",
|
|
382
383
|
Variant: "ao.TN.1",
|
|
@@ -392,7 +393,9 @@ class HB {
|
|
|
392
393
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
393
394
|
"patch-from": "/results/outbox",
|
|
394
395
|
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
395
|
-
}
|
|
396
|
+
}
|
|
397
|
+
if (data) t.data = data
|
|
398
|
+
tags = mergeLeft(tags, t)
|
|
396
399
|
return await this.spawn(tags)
|
|
397
400
|
}
|
|
398
401
|
async results({ process, limit, sort = "DESC", from, to } = {}) {
|