wao 0.25.4 → 0.26.0
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 +138 -109
- package/esm/ao.js +5 -8
- package/esm/hb.js +8 -3
- 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
|
@@ -1241,41 +1241,68 @@ var HB = /*#__PURE__*/function () {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
return now;
|
|
1243
1243
|
}()
|
|
1244
|
+
}, {
|
|
1245
|
+
key: "slot",
|
|
1246
|
+
value: function () {
|
|
1247
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(_ref12) {
|
|
1248
|
+
var pid, _ref12$path, path;
|
|
1249
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1250
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1251
|
+
case 0:
|
|
1252
|
+
pid = _ref12.pid, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "" : _ref12$path;
|
|
1253
|
+
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1254
|
+
_context31.next = 4;
|
|
1255
|
+
return this.getJSON({
|
|
1256
|
+
path: "/".concat(pid, "/slot").concat(path)
|
|
1257
|
+
});
|
|
1258
|
+
case 4:
|
|
1259
|
+
return _context31.abrupt("return", _context31.sent);
|
|
1260
|
+
case 5:
|
|
1261
|
+
case "end":
|
|
1262
|
+
return _context31.stop();
|
|
1263
|
+
}
|
|
1264
|
+
}, _callee31, this);
|
|
1265
|
+
}));
|
|
1266
|
+
function slot(_x27) {
|
|
1267
|
+
return _slot.apply(this, arguments);
|
|
1268
|
+
}
|
|
1269
|
+
return slot;
|
|
1270
|
+
}()
|
|
1244
1271
|
}, {
|
|
1245
1272
|
key: "messages",
|
|
1246
1273
|
value: function () {
|
|
1247
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1274
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
1248
1275
|
var _this2 = this;
|
|
1249
|
-
var
|
|
1276
|
+
var _ref13,
|
|
1250
1277
|
pid,
|
|
1251
1278
|
from,
|
|
1252
1279
|
to,
|
|
1253
1280
|
limit,
|
|
1254
1281
|
params,
|
|
1255
1282
|
res,
|
|
1256
|
-
|
|
1257
|
-
return _regeneratorRuntime().wrap(function
|
|
1258
|
-
while (1) switch (
|
|
1283
|
+
_args33 = arguments;
|
|
1284
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1285
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1259
1286
|
case 0:
|
|
1260
|
-
|
|
1287
|
+
_ref13 = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {}, pid = _ref13.pid, from = _ref13.from, to = _ref13.to, limit = _ref13.limit;
|
|
1261
1288
|
params = "target=".concat(pid);
|
|
1262
1289
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1263
1290
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1264
1291
|
params += "&accept=application/aos-2";
|
|
1265
|
-
|
|
1292
|
+
_context33.next = 7;
|
|
1266
1293
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1267
1294
|
return r.json();
|
|
1268
1295
|
});
|
|
1269
1296
|
case 7:
|
|
1270
|
-
res =
|
|
1297
|
+
res = _context33.sent;
|
|
1271
1298
|
if (res.page_info.has_next_page) {
|
|
1272
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1299
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1273
1300
|
var from2;
|
|
1274
|
-
return _regeneratorRuntime().wrap(function
|
|
1275
|
-
while (1) switch (
|
|
1301
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1302
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1276
1303
|
case 0:
|
|
1277
1304
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1278
|
-
|
|
1305
|
+
_context32.next = 3;
|
|
1279
1306
|
return _this2.message({
|
|
1280
1307
|
pid: pid,
|
|
1281
1308
|
from: from2,
|
|
@@ -1283,20 +1310,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1283
1310
|
limit: limit
|
|
1284
1311
|
});
|
|
1285
1312
|
case 3:
|
|
1286
|
-
return
|
|
1313
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1287
1314
|
case 4:
|
|
1288
1315
|
case "end":
|
|
1289
|
-
return
|
|
1316
|
+
return _context32.stop();
|
|
1290
1317
|
}
|
|
1291
|
-
},
|
|
1318
|
+
}, _callee32);
|
|
1292
1319
|
}));
|
|
1293
1320
|
}
|
|
1294
|
-
return
|
|
1321
|
+
return _context33.abrupt("return", res);
|
|
1295
1322
|
case 10:
|
|
1296
1323
|
case "end":
|
|
1297
|
-
return
|
|
1324
|
+
return _context33.stop();
|
|
1298
1325
|
}
|
|
1299
|
-
},
|
|
1326
|
+
}, _callee33, this);
|
|
1300
1327
|
}));
|
|
1301
1328
|
function messages() {
|
|
1302
1329
|
return _messages.apply(this, arguments);
|
|
@@ -1306,19 +1333,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
1306
1333
|
}, {
|
|
1307
1334
|
key: "spawnLegacy",
|
|
1308
1335
|
value: function () {
|
|
1309
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1310
|
-
var
|
|
1336
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1337
|
+
var _ref15,
|
|
1311
1338
|
module,
|
|
1312
|
-
|
|
1339
|
+
_ref15$tags,
|
|
1313
1340
|
tags,
|
|
1314
1341
|
data,
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1342
|
+
t,
|
|
1343
|
+
_args34 = arguments;
|
|
1344
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1345
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1318
1346
|
case 0:
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
data: data,
|
|
1347
|
+
_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;
|
|
1348
|
+
t = {
|
|
1322
1349
|
Type: "Process",
|
|
1323
1350
|
"Data-Protocol": "ao",
|
|
1324
1351
|
Variant: "ao.TN.1",
|
|
@@ -1334,16 +1361,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
1334
1361
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1335
1362
|
"patch-from": "/results/outbox",
|
|
1336
1363
|
"stack-keys": ["init", "compute", "snapshot", "normalize"]
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1364
|
+
};
|
|
1365
|
+
if (data) t.data = data;
|
|
1366
|
+
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1367
|
+
_context34.next = 6;
|
|
1339
1368
|
return this.spawn(tags);
|
|
1340
|
-
case
|
|
1341
|
-
return
|
|
1342
|
-
case
|
|
1369
|
+
case 6:
|
|
1370
|
+
return _context34.abrupt("return", _context34.sent);
|
|
1371
|
+
case 7:
|
|
1343
1372
|
case "end":
|
|
1344
|
-
return
|
|
1373
|
+
return _context34.stop();
|
|
1345
1374
|
}
|
|
1346
|
-
},
|
|
1375
|
+
}, _callee34, this);
|
|
1347
1376
|
}));
|
|
1348
1377
|
function spawnLegacy() {
|
|
1349
1378
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1353,22 +1382,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
1353
1382
|
}, {
|
|
1354
1383
|
key: "results",
|
|
1355
1384
|
value: function () {
|
|
1356
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1357
|
-
var
|
|
1385
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1386
|
+
var _ref16,
|
|
1358
1387
|
process,
|
|
1359
1388
|
limit,
|
|
1360
|
-
|
|
1389
|
+
_ref16$sort,
|
|
1361
1390
|
sort,
|
|
1362
1391
|
from,
|
|
1363
1392
|
to,
|
|
1364
1393
|
params,
|
|
1365
1394
|
addParam,
|
|
1366
1395
|
res,
|
|
1367
|
-
|
|
1368
|
-
return _regeneratorRuntime().wrap(function
|
|
1369
|
-
while (1) switch (
|
|
1396
|
+
_args35 = arguments;
|
|
1397
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1398
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1370
1399
|
case 0:
|
|
1371
|
-
|
|
1400
|
+
_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
1401
|
params = "";
|
|
1373
1402
|
addParam = function addParam(key, val) {
|
|
1374
1403
|
params += params === "" ? "?" : "&";
|
|
@@ -1378,7 +1407,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1378
1407
|
if (sort) addParam("sort", sort);
|
|
1379
1408
|
if (from) addParam("from", from);
|
|
1380
1409
|
if (to) addParam("to", to);
|
|
1381
|
-
|
|
1410
|
+
_context35.next = 9;
|
|
1382
1411
|
return this.post({
|
|
1383
1412
|
path: "/~relay@1.0/call",
|
|
1384
1413
|
method: "GET",
|
|
@@ -1386,13 +1415,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1386
1415
|
"content-type": "application/json"
|
|
1387
1416
|
});
|
|
1388
1417
|
case 9:
|
|
1389
|
-
res =
|
|
1390
|
-
return
|
|
1418
|
+
res = _context35.sent;
|
|
1419
|
+
return _context35.abrupt("return", JSON.parse(res.body));
|
|
1391
1420
|
case 11:
|
|
1392
1421
|
case "end":
|
|
1393
|
-
return
|
|
1422
|
+
return _context35.stop();
|
|
1394
1423
|
}
|
|
1395
|
-
},
|
|
1424
|
+
}, _callee35, this);
|
|
1396
1425
|
}));
|
|
1397
1426
|
function results() {
|
|
1398
1427
|
return _results.apply(this, arguments);
|
|
@@ -1402,27 +1431,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1402
1431
|
}, {
|
|
1403
1432
|
key: "dryrun",
|
|
1404
1433
|
value: function () {
|
|
1405
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1406
|
-
var
|
|
1407
|
-
|
|
1434
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1435
|
+
var _ref17,
|
|
1436
|
+
_ref17$tags,
|
|
1408
1437
|
tags,
|
|
1409
1438
|
pid,
|
|
1410
1439
|
action,
|
|
1411
1440
|
data,
|
|
1412
1441
|
json,
|
|
1413
1442
|
res,
|
|
1414
|
-
|
|
1415
|
-
return _regeneratorRuntime().wrap(function
|
|
1416
|
-
while (1) switch (
|
|
1443
|
+
_args36 = arguments;
|
|
1444
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1445
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1417
1446
|
case 0:
|
|
1418
|
-
|
|
1447
|
+
_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
1448
|
if (typeof action === "string") tags.Action = action;
|
|
1420
1449
|
json = {
|
|
1421
1450
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1422
1451
|
Owner: this.addr
|
|
1423
1452
|
};
|
|
1424
1453
|
if (data) json.Data = data;
|
|
1425
|
-
|
|
1454
|
+
_context36.next = 6;
|
|
1426
1455
|
return this.post({
|
|
1427
1456
|
path: "/~relay@1.0/call",
|
|
1428
1457
|
method: "POST",
|
|
@@ -1431,13 +1460,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1431
1460
|
"relay-body": JSON.stringify(json)
|
|
1432
1461
|
});
|
|
1433
1462
|
case 6:
|
|
1434
|
-
res =
|
|
1435
|
-
return
|
|
1463
|
+
res = _context36.sent;
|
|
1464
|
+
return _context36.abrupt("return", JSON.parse(res.body));
|
|
1436
1465
|
case 8:
|
|
1437
1466
|
case "end":
|
|
1438
|
-
return
|
|
1467
|
+
return _context36.stop();
|
|
1439
1468
|
}
|
|
1440
|
-
},
|
|
1469
|
+
}, _callee36, this);
|
|
1441
1470
|
}));
|
|
1442
1471
|
function dryrun() {
|
|
1443
1472
|
return _dryrun.apply(this, arguments);
|
|
@@ -1447,29 +1476,29 @@ var HB = /*#__PURE__*/function () {
|
|
|
1447
1476
|
}, {
|
|
1448
1477
|
key: "post",
|
|
1449
1478
|
value: function () {
|
|
1450
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1479
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(obj, json) {
|
|
1451
1480
|
var _json;
|
|
1452
|
-
return _regeneratorRuntime().wrap(function
|
|
1453
|
-
while (1) switch (
|
|
1481
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1482
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1454
1483
|
case 0:
|
|
1455
1484
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1456
1485
|
obj.path += _json;
|
|
1457
|
-
|
|
1458
|
-
|
|
1486
|
+
_context37.t0 = this;
|
|
1487
|
+
_context37.next = 5;
|
|
1459
1488
|
return this.sign(obj);
|
|
1460
1489
|
case 5:
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1490
|
+
_context37.t1 = _context37.sent;
|
|
1491
|
+
_context37.next = 8;
|
|
1492
|
+
return _context37.t0.send.call(_context37.t0, _context37.t1);
|
|
1464
1493
|
case 8:
|
|
1465
|
-
return
|
|
1494
|
+
return _context37.abrupt("return", _context37.sent);
|
|
1466
1495
|
case 9:
|
|
1467
1496
|
case "end":
|
|
1468
|
-
return
|
|
1497
|
+
return _context37.stop();
|
|
1469
1498
|
}
|
|
1470
|
-
},
|
|
1499
|
+
}, _callee37, this);
|
|
1471
1500
|
}));
|
|
1472
|
-
function post(
|
|
1501
|
+
function post(_x28, _x29) {
|
|
1473
1502
|
return _post.apply(this, arguments);
|
|
1474
1503
|
}
|
|
1475
1504
|
return post;
|
|
@@ -1477,7 +1506,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1477
1506
|
}, {
|
|
1478
1507
|
key: "get",
|
|
1479
1508
|
value: function () {
|
|
1480
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1509
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(_ref18) {
|
|
1481
1510
|
var _path3;
|
|
1482
1511
|
var path,
|
|
1483
1512
|
params,
|
|
@@ -1488,12 +1517,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1488
1517
|
k,
|
|
1489
1518
|
response,
|
|
1490
1519
|
headers,
|
|
1491
|
-
|
|
1492
|
-
return _regeneratorRuntime().wrap(function
|
|
1493
|
-
while (1) switch (
|
|
1520
|
+
_args38 = arguments;
|
|
1521
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1522
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1494
1523
|
case 0:
|
|
1495
|
-
path =
|
|
1496
|
-
json =
|
|
1524
|
+
path = _ref18.path, params = _objectWithoutProperties(_ref18, _excluded);
|
|
1525
|
+
json = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : false;
|
|
1497
1526
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1498
1527
|
(_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
|
|
1499
1528
|
if (!/^\//.test(path)) path = "/" + path;
|
|
@@ -1505,34 +1534,34 @@ var HB = /*#__PURE__*/function () {
|
|
|
1505
1534
|
i++;
|
|
1506
1535
|
}
|
|
1507
1536
|
}
|
|
1508
|
-
|
|
1537
|
+
_context38.next = 9;
|
|
1509
1538
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1510
1539
|
case 9:
|
|
1511
|
-
response =
|
|
1540
|
+
response = _context38.sent;
|
|
1512
1541
|
headers = {};
|
|
1513
1542
|
response.headers.forEach(function (v, k) {
|
|
1514
1543
|
return headers[k] = v;
|
|
1515
1544
|
});
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1545
|
+
_context38.t0 = response;
|
|
1546
|
+
_context38.t1 = headers;
|
|
1547
|
+
_context38.next = 16;
|
|
1519
1548
|
return response.text();
|
|
1520
1549
|
case 16:
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
return
|
|
1524
|
-
response:
|
|
1525
|
-
headers:
|
|
1526
|
-
body:
|
|
1527
|
-
status:
|
|
1550
|
+
_context38.t2 = _context38.sent;
|
|
1551
|
+
_context38.t3 = response.status;
|
|
1552
|
+
return _context38.abrupt("return", {
|
|
1553
|
+
response: _context38.t0,
|
|
1554
|
+
headers: _context38.t1,
|
|
1555
|
+
body: _context38.t2,
|
|
1556
|
+
status: _context38.t3
|
|
1528
1557
|
});
|
|
1529
1558
|
case 19:
|
|
1530
1559
|
case "end":
|
|
1531
|
-
return
|
|
1560
|
+
return _context38.stop();
|
|
1532
1561
|
}
|
|
1533
|
-
},
|
|
1562
|
+
}, _callee38, this);
|
|
1534
1563
|
}));
|
|
1535
|
-
function get(
|
|
1564
|
+
function get(_x30) {
|
|
1536
1565
|
return _get.apply(this, arguments);
|
|
1537
1566
|
}
|
|
1538
1567
|
return get;
|
|
@@ -1540,23 +1569,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1540
1569
|
}, {
|
|
1541
1570
|
key: "postJSON",
|
|
1542
1571
|
value: function () {
|
|
1543
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1572
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(args) {
|
|
1544
1573
|
var res;
|
|
1545
|
-
return _regeneratorRuntime().wrap(function
|
|
1546
|
-
while (1) switch (
|
|
1574
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1575
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1547
1576
|
case 0:
|
|
1548
|
-
|
|
1577
|
+
_context39.next = 2;
|
|
1549
1578
|
return this.post(args, true);
|
|
1550
1579
|
case 2:
|
|
1551
|
-
res =
|
|
1552
|
-
return
|
|
1580
|
+
res = _context39.sent;
|
|
1581
|
+
return _context39.abrupt("return", JSON.parse(res.body));
|
|
1553
1582
|
case 4:
|
|
1554
1583
|
case "end":
|
|
1555
|
-
return
|
|
1584
|
+
return _context39.stop();
|
|
1556
1585
|
}
|
|
1557
|
-
},
|
|
1586
|
+
}, _callee39, this);
|
|
1558
1587
|
}));
|
|
1559
|
-
function postJSON(
|
|
1588
|
+
function postJSON(_x31) {
|
|
1560
1589
|
return _postJSON.apply(this, arguments);
|
|
1561
1590
|
}
|
|
1562
1591
|
return postJSON;
|
|
@@ -1564,23 +1593,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1564
1593
|
}, {
|
|
1565
1594
|
key: "getJSON",
|
|
1566
1595
|
value: function () {
|
|
1567
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1596
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(args) {
|
|
1568
1597
|
var res;
|
|
1569
|
-
return _regeneratorRuntime().wrap(function
|
|
1570
|
-
while (1) switch (
|
|
1598
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1599
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1571
1600
|
case 0:
|
|
1572
|
-
|
|
1601
|
+
_context40.next = 2;
|
|
1573
1602
|
return this.get(args, true);
|
|
1574
1603
|
case 2:
|
|
1575
|
-
res =
|
|
1576
|
-
return
|
|
1604
|
+
res = _context40.sent;
|
|
1605
|
+
return _context40.abrupt("return", JSON.parse(res.body));
|
|
1577
1606
|
case 4:
|
|
1578
1607
|
case "end":
|
|
1579
|
-
return
|
|
1608
|
+
return _context40.stop();
|
|
1580
1609
|
}
|
|
1581
|
-
},
|
|
1610
|
+
}, _callee40, this);
|
|
1582
1611
|
}));
|
|
1583
|
-
function getJSON(
|
|
1612
|
+
function getJSON(_x32) {
|
|
1584
1613
|
return _getJSON.apply(this, arguments);
|
|
1585
1614
|
}
|
|
1586
1615
|
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
|
@@ -356,6 +356,10 @@ class HB {
|
|
|
356
356
|
if (path && !/^\//.test(path)) path = "/" + path
|
|
357
357
|
return await this.getJSON({ path: `/${pid}/now${path}` })
|
|
358
358
|
}
|
|
359
|
+
async slot({ pid, path = "" }) {
|
|
360
|
+
if (path && !/^\//.test(path)) path = "/" + path
|
|
361
|
+
return await this.getJSON({ path: `/${pid}/slot${path}` })
|
|
362
|
+
}
|
|
359
363
|
|
|
360
364
|
async messages({ pid, from, to, limit } = {}) {
|
|
361
365
|
let params = `target=${pid}`
|
|
@@ -375,8 +379,7 @@ class HB {
|
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
async spawnLegacy({ module, tags = {}, data } = {}) {
|
|
378
|
-
|
|
379
|
-
data,
|
|
382
|
+
let t = {
|
|
380
383
|
Type: "Process",
|
|
381
384
|
"Data-Protocol": "ao",
|
|
382
385
|
Variant: "ao.TN.1",
|
|
@@ -392,7 +395,9 @@ class HB {
|
|
|
392
395
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
393
396
|
"patch-from": "/results/outbox",
|
|
394
397
|
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
395
|
-
}
|
|
398
|
+
}
|
|
399
|
+
if (data) t.data = data
|
|
400
|
+
tags = mergeLeft(tags, t)
|
|
396
401
|
return await this.spawn(tags)
|
|
397
402
|
}
|
|
398
403
|
async results({ process, limit, sort = "DESC", from, to } = {}) {
|