wao 0.21.0 → 0.21.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/adaptor-base.js +5 -5
- package/cjs/aoconnect-base.js +250 -125
- package/cjs/hb.js +1 -1
- package/esm/adaptor-base.js +1 -1
- package/esm/aoconnect-base.js +43 -8
- package/esm/hb.js +0 -1
- package/package.json +1 -1
package/cjs/adaptor-base.js
CHANGED
|
@@ -895,9 +895,9 @@ var Adaptor = /*#__PURE__*/function () {
|
|
|
895
895
|
return cu_post_dryrun;
|
|
896
896
|
}()
|
|
897
897
|
}, {
|
|
898
|
-
key: "
|
|
898
|
+
key: "cu_get_results",
|
|
899
899
|
value: function () {
|
|
900
|
-
var
|
|
900
|
+
var _cu_get_results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref7) {
|
|
901
901
|
var _this$mem$env$pid$res, _this$mem$env$pid2;
|
|
902
902
|
var query, params, body, headers, method, pid, _query$from, from, _query$to, to, _query$sort, sort, _query$limit, limit, results, _res, i, count, started, _iterator4, _step4, v, _this$mem$msgs$v;
|
|
903
903
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
@@ -974,10 +974,10 @@ var Adaptor = /*#__PURE__*/function () {
|
|
|
974
974
|
}
|
|
975
975
|
}, _callee23, this, [[10, 29, 32, 35]]);
|
|
976
976
|
}));
|
|
977
|
-
function
|
|
978
|
-
return
|
|
977
|
+
function cu_get_results(_x24) {
|
|
978
|
+
return _cu_get_results.apply(this, arguments);
|
|
979
979
|
}
|
|
980
|
-
return
|
|
980
|
+
return cu_get_results;
|
|
981
981
|
}()
|
|
982
982
|
}, {
|
|
983
983
|
key: "cu_get_result",
|
package/cjs/aoconnect-base.js
CHANGED
|
@@ -10,6 +10,7 @@ var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
|
|
|
10
10
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
11
11
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
12
12
|
var _utils = require("./utils.js");
|
|
13
|
+
var _ao = _interopRequireDefault(require("./ao.js"));
|
|
13
14
|
var _weavedrive = _interopRequireDefault(require("./weavedrive.js"));
|
|
14
15
|
var _ramda = require("ramda");
|
|
15
16
|
var _Arweave$default, _WarpArBundles$defaul;
|
|
@@ -672,7 +673,7 @@ var _default = exports["default"] = function _default() {
|
|
|
672
673
|
var _assign = /*#__PURE__*/function () {
|
|
673
674
|
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
674
675
|
var _opt$tags2;
|
|
675
|
-
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, start, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
|
|
676
|
+
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, t, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, start, res, _msg, _iterator3, _step3, v, _t, _yield$fetch$then$Pro, _yield$fetch$then, sch, tar, procs, ao, _yield$mem$getTx$tags3, _yield$mem$getTx4, _tags2$Action, _v$Data, _tags2, pr, module, _yield$ao$msg, mid, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
|
|
676
677
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
677
678
|
while (1) switch (_context4.prev = _context4.next) {
|
|
678
679
|
case 0:
|
|
@@ -755,43 +756,45 @@ var _default = exports["default"] = function _default() {
|
|
|
755
756
|
_tags = _opt.tags;
|
|
756
757
|
from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
|
|
757
758
|
if (!_opt.item) {
|
|
758
|
-
_context4.next =
|
|
759
|
+
_context4.next = 53;
|
|
759
760
|
break;
|
|
760
761
|
}
|
|
761
762
|
data = _base64url["default"].decode(_opt.item.data);
|
|
762
763
|
_tags = _opt.item.tags;
|
|
764
|
+
t = (0, _utils.tags)(_tags);
|
|
765
|
+
if (t["From-Process"]) from = t["From-Process"];
|
|
763
766
|
if (from) {
|
|
764
|
-
_context4.next =
|
|
767
|
+
_context4.next = 53;
|
|
765
768
|
break;
|
|
766
769
|
}
|
|
767
|
-
_context4.next =
|
|
770
|
+
_context4.next = 52;
|
|
768
771
|
return arweave.wallets.jwkToAddress({
|
|
769
772
|
kty: "RSA",
|
|
770
773
|
n: _opt.item.owner,
|
|
771
774
|
e: "AQAB"
|
|
772
775
|
});
|
|
773
|
-
case
|
|
776
|
+
case 52:
|
|
774
777
|
from = _context4.sent;
|
|
775
|
-
case 51:
|
|
776
|
-
_context4.next = 53;
|
|
777
|
-
return genMsg(opt.message, p, data, _tags, from, mu.addr);
|
|
778
778
|
case 53:
|
|
779
|
+
_context4.next = 55;
|
|
780
|
+
return genMsg(opt.message, p, data, _tags, from, mu.addr);
|
|
781
|
+
case 55:
|
|
779
782
|
msg = _context4.sent;
|
|
780
|
-
_context4.next =
|
|
783
|
+
_context4.next = 58;
|
|
781
784
|
return genEnv({
|
|
782
785
|
pid: p.id,
|
|
783
786
|
owner: p.owner,
|
|
784
787
|
module: p.module
|
|
785
788
|
});
|
|
786
|
-
case
|
|
789
|
+
case 58:
|
|
787
790
|
_env = _context4.sent;
|
|
788
791
|
if (p.handle) {
|
|
789
|
-
_context4.next =
|
|
792
|
+
_context4.next = 91;
|
|
790
793
|
break;
|
|
791
794
|
}
|
|
792
|
-
_context4.next =
|
|
795
|
+
_context4.next = 62;
|
|
793
796
|
return mem.getWasm(p.modulea);
|
|
794
|
-
case
|
|
797
|
+
case 62:
|
|
795
798
|
_yield$mem$getWasm2 = _context4.sent;
|
|
796
799
|
format = _yield$mem$getWasm2.format;
|
|
797
800
|
mod = _yield$mem$getWasm2.mod;
|
|
@@ -801,31 +804,31 @@ var _default = exports["default"] = function _default() {
|
|
|
801
804
|
_context4.t13 = wasm;
|
|
802
805
|
_context4.t14 = format;
|
|
803
806
|
_context4.t15 = wdrive;
|
|
804
|
-
_context4.next =
|
|
807
|
+
_context4.next = 73;
|
|
805
808
|
return mem.getTx(p.id);
|
|
806
|
-
case
|
|
809
|
+
case 73:
|
|
807
810
|
_context4.t17 = _yield$mem$getTx3 = _context4.sent;
|
|
808
811
|
_context4.t16 = _context4.t17 === null;
|
|
809
812
|
if (_context4.t16) {
|
|
810
|
-
_context4.next =
|
|
813
|
+
_context4.next = 77;
|
|
811
814
|
break;
|
|
812
815
|
}
|
|
813
816
|
_context4.t16 = _yield$mem$getTx3 === void 0;
|
|
814
|
-
case
|
|
817
|
+
case 77:
|
|
815
818
|
if (!_context4.t16) {
|
|
816
|
-
_context4.next =
|
|
819
|
+
_context4.next = 81;
|
|
817
820
|
break;
|
|
818
821
|
}
|
|
819
822
|
_context4.t18 = void 0;
|
|
820
|
-
_context4.next =
|
|
823
|
+
_context4.next = 82;
|
|
821
824
|
break;
|
|
822
|
-
case
|
|
825
|
+
case 81:
|
|
823
826
|
_context4.t18 = _yield$mem$getTx3.item;
|
|
824
|
-
case
|
|
827
|
+
case 82:
|
|
825
828
|
_context4.t19 = _context4.t18;
|
|
826
|
-
_context4.next =
|
|
829
|
+
_context4.next = 85;
|
|
827
830
|
return mem.getTx(mod);
|
|
828
|
-
case
|
|
831
|
+
case 85:
|
|
829
832
|
_context4.t20 = _context4.sent;
|
|
830
833
|
_context4.t21 = {
|
|
831
834
|
format: _context4.t14,
|
|
@@ -833,51 +836,51 @@ var _default = exports["default"] = function _default() {
|
|
|
833
836
|
spawn: _context4.t19,
|
|
834
837
|
module: _context4.t20
|
|
835
838
|
};
|
|
836
|
-
_context4.next =
|
|
839
|
+
_context4.next = 89;
|
|
837
840
|
return (0, _context4.t12)(_context4.t13, _context4.t21);
|
|
838
|
-
case
|
|
841
|
+
case 89:
|
|
839
842
|
p.handle = _context4.sent;
|
|
840
843
|
mem.env[opt.process].handle = p.handle;
|
|
841
|
-
case
|
|
844
|
+
case 91:
|
|
842
845
|
if (p.compressed) {
|
|
843
846
|
start = Date.now();
|
|
844
847
|
p.memory = mem.decompress(p.memory, p.original_size);
|
|
845
848
|
p.compressed = false;
|
|
846
849
|
}
|
|
847
|
-
_context4.next =
|
|
850
|
+
_context4.next = 94;
|
|
848
851
|
return p.handle(p.memory, msg, _env);
|
|
849
|
-
case
|
|
852
|
+
case 94:
|
|
850
853
|
res = _context4.sent;
|
|
851
854
|
p.memory = res.Memory;
|
|
852
855
|
delete res.Memory;
|
|
853
856
|
p.results.push(opt.message);
|
|
854
|
-
_context4.next =
|
|
857
|
+
_context4.next = 100;
|
|
855
858
|
return mem.set(p, "env", opt.process);
|
|
856
|
-
case
|
|
859
|
+
case 100:
|
|
857
860
|
_msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
|
|
858
861
|
res: res,
|
|
859
862
|
msg: msg
|
|
860
863
|
});
|
|
861
|
-
_context4.next =
|
|
864
|
+
_context4.next = 103;
|
|
862
865
|
return mem.set(_msg, "msgs", opt.message);
|
|
863
|
-
case
|
|
866
|
+
case 103:
|
|
864
867
|
_iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
865
|
-
_context4.prev =
|
|
868
|
+
_context4.prev = 104;
|
|
866
869
|
_iterator3.s();
|
|
867
|
-
case
|
|
870
|
+
case 106:
|
|
868
871
|
if ((_step3 = _iterator3.n()).done) {
|
|
869
|
-
_context4.next =
|
|
872
|
+
_context4.next = 183;
|
|
870
873
|
break;
|
|
871
874
|
}
|
|
872
875
|
v = _step3.value;
|
|
873
|
-
_context4.next =
|
|
876
|
+
_context4.next = 110;
|
|
874
877
|
return mem.get("env", v.Target);
|
|
875
|
-
case
|
|
878
|
+
case 110:
|
|
876
879
|
if (!_context4.sent) {
|
|
877
|
-
_context4.next =
|
|
880
|
+
_context4.next = 115;
|
|
878
881
|
break;
|
|
879
882
|
}
|
|
880
|
-
_context4.next =
|
|
883
|
+
_context4.next = 113;
|
|
881
884
|
return message({
|
|
882
885
|
"for": opt.message,
|
|
883
886
|
process: v.Target,
|
|
@@ -887,11 +890,133 @@ var _default = exports["default"] = function _default() {
|
|
|
887
890
|
from: opt.process,
|
|
888
891
|
target: v.Target
|
|
889
892
|
});
|
|
890
|
-
case 111:
|
|
891
|
-
_context4.next = 115;
|
|
892
|
-
break;
|
|
893
893
|
case 113:
|
|
894
|
-
_context4.next =
|
|
894
|
+
_context4.next = 181;
|
|
895
|
+
break;
|
|
896
|
+
case 115:
|
|
897
|
+
_t = (0, _utils.tags)(v.Tags); // this behaviour is different from AOS (temporary hack for remote tests)
|
|
898
|
+
if (!_t.__Scheduler__) {
|
|
899
|
+
_context4.next = 179;
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
sch = _t.__Scheduler__;
|
|
903
|
+
tar = v.Target;
|
|
904
|
+
_context4.next = 121;
|
|
905
|
+
return fetch(sch).then(function (r) {
|
|
906
|
+
return r.json();
|
|
907
|
+
});
|
|
908
|
+
case 121:
|
|
909
|
+
_context4.t24 = _yield$fetch$then = _context4.sent;
|
|
910
|
+
_context4.t23 = _context4.t24 === null;
|
|
911
|
+
if (_context4.t23) {
|
|
912
|
+
_context4.next = 125;
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
_context4.t23 = _yield$fetch$then === void 0;
|
|
916
|
+
case 125:
|
|
917
|
+
if (!_context4.t23) {
|
|
918
|
+
_context4.next = 129;
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
_context4.t25 = void 0;
|
|
922
|
+
_context4.next = 130;
|
|
923
|
+
break;
|
|
924
|
+
case 129:
|
|
925
|
+
_context4.t25 = _yield$fetch$then.Processes;
|
|
926
|
+
case 130:
|
|
927
|
+
_context4.t26 = _yield$fetch$then$Pro = _context4.t25;
|
|
928
|
+
_context4.t22 = _context4.t26 !== null;
|
|
929
|
+
if (!_context4.t22) {
|
|
930
|
+
_context4.next = 134;
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
_context4.t22 = _yield$fetch$then$Pro !== void 0;
|
|
934
|
+
case 134:
|
|
935
|
+
if (!_context4.t22) {
|
|
936
|
+
_context4.next = 138;
|
|
937
|
+
break;
|
|
938
|
+
}
|
|
939
|
+
_context4.t27 = _yield$fetch$then$Pro;
|
|
940
|
+
_context4.next = 139;
|
|
941
|
+
break;
|
|
942
|
+
case 138:
|
|
943
|
+
_context4.t27 = [];
|
|
944
|
+
case 139:
|
|
945
|
+
procs = _context4.t27;
|
|
946
|
+
_context4.next = 142;
|
|
947
|
+
return new _ao["default"]({
|
|
948
|
+
port: sch.split(":").pop() - 3
|
|
949
|
+
}).init(mu.jwk);
|
|
950
|
+
case 142:
|
|
951
|
+
ao = _context4.sent;
|
|
952
|
+
_context4.prev = 143;
|
|
953
|
+
_tags2 = _objectSpread(_objectSpread({}, _t), {}, {
|
|
954
|
+
"From-Process": opt.process,
|
|
955
|
+
"Pushed-For": id
|
|
956
|
+
});
|
|
957
|
+
_context4.next = 147;
|
|
958
|
+
return mem.getTx(opt.process);
|
|
959
|
+
case 147:
|
|
960
|
+
_context4.t30 = _yield$mem$getTx4 = _context4.sent;
|
|
961
|
+
_context4.t29 = _context4.t30 === null;
|
|
962
|
+
if (_context4.t29) {
|
|
963
|
+
_context4.next = 151;
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
_context4.t29 = _yield$mem$getTx4 === void 0;
|
|
967
|
+
case 151:
|
|
968
|
+
if (!_context4.t29) {
|
|
969
|
+
_context4.next = 155;
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
_context4.t31 = void 0;
|
|
973
|
+
_context4.next = 156;
|
|
974
|
+
break;
|
|
975
|
+
case 155:
|
|
976
|
+
_context4.t31 = _yield$mem$getTx4.tags;
|
|
977
|
+
case 156:
|
|
978
|
+
_context4.t32 = _yield$mem$getTx$tags3 = _context4.t31;
|
|
979
|
+
_context4.t28 = _context4.t32 !== null;
|
|
980
|
+
if (!_context4.t28) {
|
|
981
|
+
_context4.next = 160;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
_context4.t28 = _yield$mem$getTx$tags3 !== void 0;
|
|
985
|
+
case 160:
|
|
986
|
+
if (!_context4.t28) {
|
|
987
|
+
_context4.next = 164;
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
_context4.t33 = _yield$mem$getTx$tags3;
|
|
991
|
+
_context4.next = 165;
|
|
992
|
+
break;
|
|
993
|
+
case 164:
|
|
994
|
+
_context4.t33 = [];
|
|
995
|
+
case 165:
|
|
996
|
+
pr = _context4.t33;
|
|
997
|
+
module = (0, _utils.tags)(pr).Module;
|
|
998
|
+
if (module) _tags2["From-Module"] = module;
|
|
999
|
+
_context4.next = 170;
|
|
1000
|
+
return ao.msg({
|
|
1001
|
+
act: (_tags2$Action = _tags2["Action"]) !== null && _tags2$Action !== void 0 ? _tags2$Action : null,
|
|
1002
|
+
pid: tar,
|
|
1003
|
+
tags: _tags2,
|
|
1004
|
+
data: (_v$Data = v.Data) !== null && _v$Data !== void 0 ? _v$Data : ""
|
|
1005
|
+
});
|
|
1006
|
+
case 170:
|
|
1007
|
+
_yield$ao$msg = _context4.sent;
|
|
1008
|
+
mid = _yield$ao$msg.mid;
|
|
1009
|
+
_context4.next = 177;
|
|
1010
|
+
break;
|
|
1011
|
+
case 174:
|
|
1012
|
+
_context4.prev = 174;
|
|
1013
|
+
_context4.t34 = _context4["catch"](143);
|
|
1014
|
+
console.log(_context4.t34);
|
|
1015
|
+
case 177:
|
|
1016
|
+
_context4.next = 181;
|
|
1017
|
+
break;
|
|
1018
|
+
case 179:
|
|
1019
|
+
_context4.next = 181;
|
|
895
1020
|
return record({
|
|
896
1021
|
"for": opt.message,
|
|
897
1022
|
tags: v.Tags,
|
|
@@ -900,32 +1025,32 @@ var _default = exports["default"] = function _default() {
|
|
|
900
1025
|
from: opt.process,
|
|
901
1026
|
target: v.Target
|
|
902
1027
|
});
|
|
903
|
-
case
|
|
904
|
-
_context4.next =
|
|
1028
|
+
case 181:
|
|
1029
|
+
_context4.next = 106;
|
|
905
1030
|
break;
|
|
906
|
-
case
|
|
907
|
-
_context4.next =
|
|
1031
|
+
case 183:
|
|
1032
|
+
_context4.next = 188;
|
|
908
1033
|
break;
|
|
909
|
-
case
|
|
910
|
-
_context4.prev =
|
|
911
|
-
_context4.
|
|
912
|
-
_iterator3.e(_context4.
|
|
913
|
-
case
|
|
914
|
-
_context4.prev =
|
|
1034
|
+
case 185:
|
|
1035
|
+
_context4.prev = 185;
|
|
1036
|
+
_context4.t35 = _context4["catch"](104);
|
|
1037
|
+
_iterator3.e(_context4.t35);
|
|
1038
|
+
case 188:
|
|
1039
|
+
_context4.prev = 188;
|
|
915
1040
|
_iterator3.f();
|
|
916
|
-
return _context4.finish(
|
|
917
|
-
case
|
|
1041
|
+
return _context4.finish(188);
|
|
1042
|
+
case 191:
|
|
918
1043
|
_iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
919
|
-
_context4.prev =
|
|
1044
|
+
_context4.prev = 192;
|
|
920
1045
|
_iterator4.s();
|
|
921
|
-
case
|
|
1046
|
+
case 194:
|
|
922
1047
|
if ((_step4 = _iterator4.n()).done) {
|
|
923
|
-
_context4.next =
|
|
1048
|
+
_context4.next = 201;
|
|
924
1049
|
break;
|
|
925
1050
|
}
|
|
926
1051
|
_v = _step4.value;
|
|
927
1052
|
__tags = (0, _utils.tags)(_v.Tags);
|
|
928
|
-
_context4.next =
|
|
1053
|
+
_context4.next = 199;
|
|
929
1054
|
return spawn({
|
|
930
1055
|
"for": opt.message,
|
|
931
1056
|
module: __tags.Module,
|
|
@@ -935,87 +1060,87 @@ var _default = exports["default"] = function _default() {
|
|
|
935
1060
|
from: __tags["From-Process"],
|
|
936
1061
|
signer: mu.signer
|
|
937
1062
|
});
|
|
938
|
-
case
|
|
939
|
-
_context4.next =
|
|
1063
|
+
case 199:
|
|
1064
|
+
_context4.next = 194;
|
|
940
1065
|
break;
|
|
941
|
-
case
|
|
942
|
-
_context4.next =
|
|
1066
|
+
case 201:
|
|
1067
|
+
_context4.next = 206;
|
|
943
1068
|
break;
|
|
944
|
-
case
|
|
945
|
-
_context4.prev =
|
|
946
|
-
_context4.
|
|
947
|
-
_iterator4.e(_context4.
|
|
948
|
-
case
|
|
949
|
-
_context4.prev =
|
|
1069
|
+
case 203:
|
|
1070
|
+
_context4.prev = 203;
|
|
1071
|
+
_context4.t36 = _context4["catch"](192);
|
|
1072
|
+
_iterator4.e(_context4.t36);
|
|
1073
|
+
case 206:
|
|
1074
|
+
_context4.prev = 206;
|
|
950
1075
|
_iterator4.f();
|
|
951
|
-
return _context4.finish(
|
|
952
|
-
case
|
|
1076
|
+
return _context4.finish(206);
|
|
1077
|
+
case 209:
|
|
953
1078
|
_iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
954
|
-
_context4.prev =
|
|
1079
|
+
_context4.prev = 210;
|
|
955
1080
|
_iterator5.s();
|
|
956
|
-
case
|
|
1081
|
+
case 212:
|
|
957
1082
|
if ((_step5 = _iterator5.n()).done) {
|
|
958
|
-
_context4.next =
|
|
1083
|
+
_context4.next = 233;
|
|
959
1084
|
break;
|
|
960
1085
|
}
|
|
961
1086
|
_v2 = _step5.value;
|
|
962
1087
|
_iterator6 = _createForOfIteratorHelper(_v2.Processes);
|
|
963
|
-
_context4.prev =
|
|
1088
|
+
_context4.prev = 215;
|
|
964
1089
|
_iterator6.s();
|
|
965
|
-
case
|
|
1090
|
+
case 217:
|
|
966
1091
|
if ((_step6 = _iterator6.n()).done) {
|
|
967
|
-
_context4.next =
|
|
1092
|
+
_context4.next = 223;
|
|
968
1093
|
break;
|
|
969
1094
|
}
|
|
970
1095
|
v2 = _step6.value;
|
|
971
|
-
_context4.next =
|
|
1096
|
+
_context4.next = 221;
|
|
972
1097
|
return _assign({
|
|
973
1098
|
message: _v2.Message,
|
|
974
1099
|
process: v2,
|
|
975
1100
|
from: opt.process,
|
|
976
1101
|
signer: mu.signer
|
|
977
1102
|
});
|
|
978
|
-
case
|
|
979
|
-
_context4.next =
|
|
1103
|
+
case 221:
|
|
1104
|
+
_context4.next = 217;
|
|
980
1105
|
break;
|
|
981
|
-
case
|
|
982
|
-
_context4.next =
|
|
1106
|
+
case 223:
|
|
1107
|
+
_context4.next = 228;
|
|
983
1108
|
break;
|
|
984
|
-
case
|
|
985
|
-
_context4.prev =
|
|
986
|
-
_context4.
|
|
987
|
-
_iterator6.e(_context4.
|
|
988
|
-
case
|
|
989
|
-
_context4.prev =
|
|
1109
|
+
case 225:
|
|
1110
|
+
_context4.prev = 225;
|
|
1111
|
+
_context4.t37 = _context4["catch"](215);
|
|
1112
|
+
_iterator6.e(_context4.t37);
|
|
1113
|
+
case 228:
|
|
1114
|
+
_context4.prev = 228;
|
|
990
1115
|
_iterator6.f();
|
|
991
|
-
return _context4.finish(
|
|
992
|
-
case
|
|
993
|
-
_context4.next =
|
|
1116
|
+
return _context4.finish(228);
|
|
1117
|
+
case 231:
|
|
1118
|
+
_context4.next = 212;
|
|
994
1119
|
break;
|
|
995
|
-
case
|
|
996
|
-
_context4.next =
|
|
1120
|
+
case 233:
|
|
1121
|
+
_context4.next = 238;
|
|
997
1122
|
break;
|
|
998
|
-
case
|
|
999
|
-
_context4.prev =
|
|
1000
|
-
_context4.
|
|
1001
|
-
_iterator5.e(_context4.
|
|
1002
|
-
case
|
|
1003
|
-
_context4.prev =
|
|
1123
|
+
case 235:
|
|
1124
|
+
_context4.prev = 235;
|
|
1125
|
+
_context4.t38 = _context4["catch"](210);
|
|
1126
|
+
_iterator5.e(_context4.t38);
|
|
1127
|
+
case 238:
|
|
1128
|
+
_context4.prev = 238;
|
|
1004
1129
|
_iterator5.f();
|
|
1005
|
-
return _context4.finish(
|
|
1006
|
-
case
|
|
1130
|
+
return _context4.finish(238);
|
|
1131
|
+
case 241:
|
|
1007
1132
|
return _context4.abrupt("return", id);
|
|
1008
|
-
case
|
|
1009
|
-
_context4.prev =
|
|
1010
|
-
_context4.
|
|
1011
|
-
console.log(_context4.
|
|
1012
|
-
case
|
|
1133
|
+
case 244:
|
|
1134
|
+
_context4.prev = 244;
|
|
1135
|
+
_context4.t39 = _context4["catch"](40);
|
|
1136
|
+
console.log(_context4.t39);
|
|
1137
|
+
case 247:
|
|
1013
1138
|
return _context4.abrupt("return", null);
|
|
1014
|
-
case
|
|
1139
|
+
case 248:
|
|
1015
1140
|
case "end":
|
|
1016
1141
|
return _context4.stop();
|
|
1017
1142
|
}
|
|
1018
|
-
}, _callee4, null, [[40,
|
|
1143
|
+
}, _callee4, null, [[40, 244], [104, 185, 188, 191], [143, 174], [192, 203, 206, 209], [210, 235, 238, 241], [215, 225, 228, 231]]);
|
|
1019
1144
|
}));
|
|
1020
1145
|
return function assign(_x8) {
|
|
1021
1146
|
return _ref9.apply(this, arguments);
|
|
@@ -1023,7 +1148,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1023
1148
|
}();
|
|
1024
1149
|
var message = /*#__PURE__*/function () {
|
|
1025
1150
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
|
|
1026
|
-
var id, owner, item, _opt$id2, _key, i, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner, p, _opt$tags3, _yield$mem$getTx$
|
|
1151
|
+
var id, owner, item, _opt$id2, _key, i, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner, p, _opt$tags3, _yield$mem$getTx$tags4, _yield$mem$getTx5, pr, module, _yield$ar$dataitem3, _msg, _opt, _ref12, _opt$from2, _opt$http_msg$data, from, data, _tags, msg, _env, _yield$mem$getTx6, _yield$mem$getWasm3, format, mod, wasm, wdrive, start, res, _msg2, key;
|
|
1027
1152
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1028
1153
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1029
1154
|
case 0:
|
|
@@ -1122,13 +1247,13 @@ var _default = exports["default"] = function _default() {
|
|
|
1122
1247
|
_context5.next = 50;
|
|
1123
1248
|
return mem.getTx(opt.from);
|
|
1124
1249
|
case 50:
|
|
1125
|
-
_context5.t2 = _yield$mem$
|
|
1250
|
+
_context5.t2 = _yield$mem$getTx5 = _context5.sent;
|
|
1126
1251
|
_context5.t1 = _context5.t2 === null;
|
|
1127
1252
|
if (_context5.t1) {
|
|
1128
1253
|
_context5.next = 54;
|
|
1129
1254
|
break;
|
|
1130
1255
|
}
|
|
1131
|
-
_context5.t1 = _yield$mem$
|
|
1256
|
+
_context5.t1 = _yield$mem$getTx5 === void 0;
|
|
1132
1257
|
case 54:
|
|
1133
1258
|
if (!_context5.t1) {
|
|
1134
1259
|
_context5.next = 58;
|
|
@@ -1138,21 +1263,21 @@ var _default = exports["default"] = function _default() {
|
|
|
1138
1263
|
_context5.next = 59;
|
|
1139
1264
|
break;
|
|
1140
1265
|
case 58:
|
|
1141
|
-
_context5.t3 = _yield$mem$
|
|
1266
|
+
_context5.t3 = _yield$mem$getTx5.tags;
|
|
1142
1267
|
case 59:
|
|
1143
|
-
_context5.t4 = _yield$mem$getTx$
|
|
1268
|
+
_context5.t4 = _yield$mem$getTx$tags4 = _context5.t3;
|
|
1144
1269
|
_context5.t0 = _context5.t4 !== null;
|
|
1145
1270
|
if (!_context5.t0) {
|
|
1146
1271
|
_context5.next = 63;
|
|
1147
1272
|
break;
|
|
1148
1273
|
}
|
|
1149
|
-
_context5.t0 = _yield$mem$getTx$
|
|
1274
|
+
_context5.t0 = _yield$mem$getTx$tags4 !== void 0;
|
|
1150
1275
|
case 63:
|
|
1151
1276
|
if (!_context5.t0) {
|
|
1152
1277
|
_context5.next = 67;
|
|
1153
1278
|
break;
|
|
1154
1279
|
}
|
|
1155
|
-
_context5.t5 = _yield$mem$getTx$
|
|
1280
|
+
_context5.t5 = _yield$mem$getTx$tags4;
|
|
1156
1281
|
_context5.next = 68;
|
|
1157
1282
|
break;
|
|
1158
1283
|
case 67:
|
|
@@ -1225,13 +1350,13 @@ var _default = exports["default"] = function _default() {
|
|
|
1225
1350
|
_context5.next = 108;
|
|
1226
1351
|
return mem.getTx(p.id);
|
|
1227
1352
|
case 108:
|
|
1228
|
-
_context5.t11 = _yield$mem$
|
|
1353
|
+
_context5.t11 = _yield$mem$getTx6 = _context5.sent;
|
|
1229
1354
|
_context5.t10 = _context5.t11 === null;
|
|
1230
1355
|
if (_context5.t10) {
|
|
1231
1356
|
_context5.next = 112;
|
|
1232
1357
|
break;
|
|
1233
1358
|
}
|
|
1234
|
-
_context5.t10 = _yield$mem$
|
|
1359
|
+
_context5.t10 = _yield$mem$getTx6 === void 0;
|
|
1235
1360
|
case 112:
|
|
1236
1361
|
if (!_context5.t10) {
|
|
1237
1362
|
_context5.next = 116;
|
|
@@ -1241,7 +1366,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1241
1366
|
_context5.next = 117;
|
|
1242
1367
|
break;
|
|
1243
1368
|
case 116:
|
|
1244
|
-
_context5.t12 = _yield$mem$
|
|
1369
|
+
_context5.t12 = _yield$mem$getTx6.item;
|
|
1245
1370
|
case 117:
|
|
1246
1371
|
_context5.t13 = _context5.t12;
|
|
1247
1372
|
_context5.next = 120;
|
|
@@ -1317,7 +1442,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1317
1442
|
var record = /*#__PURE__*/function () {
|
|
1318
1443
|
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
|
|
1319
1444
|
var _opt$item$id2, _opt$item2, _opt$owner2, _opt$tags4;
|
|
1320
|
-
var id, owner, item, _yield$mem$getTx$
|
|
1445
|
+
var id, owner, item, _yield$mem$getTx$tags5, _yield$mem$getTx7, pr, module, _yield$ar$dataitem4, _msg;
|
|
1321
1446
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1322
1447
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1323
1448
|
case 0:
|
|
@@ -1344,13 +1469,13 @@ var _default = exports["default"] = function _default() {
|
|
|
1344
1469
|
_context6.next = 9;
|
|
1345
1470
|
return mem.getTx(opt.from);
|
|
1346
1471
|
case 9:
|
|
1347
|
-
_context6.t2 = _yield$mem$
|
|
1472
|
+
_context6.t2 = _yield$mem$getTx7 = _context6.sent;
|
|
1348
1473
|
_context6.t1 = _context6.t2 === null;
|
|
1349
1474
|
if (_context6.t1) {
|
|
1350
1475
|
_context6.next = 13;
|
|
1351
1476
|
break;
|
|
1352
1477
|
}
|
|
1353
|
-
_context6.t1 = _yield$mem$
|
|
1478
|
+
_context6.t1 = _yield$mem$getTx7 === void 0;
|
|
1354
1479
|
case 13:
|
|
1355
1480
|
if (!_context6.t1) {
|
|
1356
1481
|
_context6.next = 17;
|
|
@@ -1360,21 +1485,21 @@ var _default = exports["default"] = function _default() {
|
|
|
1360
1485
|
_context6.next = 18;
|
|
1361
1486
|
break;
|
|
1362
1487
|
case 17:
|
|
1363
|
-
_context6.t3 = _yield$mem$
|
|
1488
|
+
_context6.t3 = _yield$mem$getTx7.tags;
|
|
1364
1489
|
case 18:
|
|
1365
|
-
_context6.t4 = _yield$mem$getTx$
|
|
1490
|
+
_context6.t4 = _yield$mem$getTx$tags5 = _context6.t3;
|
|
1366
1491
|
_context6.t0 = _context6.t4 !== null;
|
|
1367
1492
|
if (!_context6.t0) {
|
|
1368
1493
|
_context6.next = 22;
|
|
1369
1494
|
break;
|
|
1370
1495
|
}
|
|
1371
|
-
_context6.t0 = _yield$mem$getTx$
|
|
1496
|
+
_context6.t0 = _yield$mem$getTx$tags5 !== void 0;
|
|
1372
1497
|
case 22:
|
|
1373
1498
|
if (!_context6.t0) {
|
|
1374
1499
|
_context6.next = 26;
|
|
1375
1500
|
break;
|
|
1376
1501
|
}
|
|
1377
|
-
_context6.t5 = _yield$mem$getTx$
|
|
1502
|
+
_context6.t5 = _yield$mem$getTx$tags5;
|
|
1378
1503
|
_context6.next = 27;
|
|
1379
1504
|
break;
|
|
1380
1505
|
case 26:
|
package/cjs/hb.js
CHANGED
|
@@ -24,7 +24,7 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
24
24
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
25
25
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
26
26
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
27
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
28
28
|
var randomBytes = function randomBytes(num) {
|
|
29
29
|
var array = new Uint8Array(num);
|
|
30
30
|
return crypto.getRandomValues(array);
|
package/esm/adaptor-base.js
CHANGED
|
@@ -293,7 +293,7 @@ class Adaptor {
|
|
|
293
293
|
return { json: res2 }
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
async
|
|
296
|
+
async cu_get_results({ query, params, body, headers, method }) {
|
|
297
297
|
const pid = params.pid
|
|
298
298
|
const { from = null, to = null, sort = "ASC", limit = 25 } = query
|
|
299
299
|
let results = this.mem.env[pid]?.results ?? []
|
package/esm/aoconnect-base.js
CHANGED
|
@@ -7,6 +7,8 @@ const { DataItem } = pkg
|
|
|
7
7
|
import crypto from "crypto"
|
|
8
8
|
import base64url from "base64url"
|
|
9
9
|
import { wait } from "./utils.js"
|
|
10
|
+
import AO from "./ao.js"
|
|
11
|
+
|
|
10
12
|
import {
|
|
11
13
|
tags,
|
|
12
14
|
action,
|
|
@@ -27,6 +29,7 @@ import {
|
|
|
27
29
|
dissoc,
|
|
28
30
|
o,
|
|
29
31
|
reverse,
|
|
32
|
+
includes,
|
|
30
33
|
} from "ramda"
|
|
31
34
|
|
|
32
35
|
let onRecovery = {}
|
|
@@ -319,6 +322,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
319
322
|
if (_opt.item) {
|
|
320
323
|
data = base64url.decode(_opt.item.data)
|
|
321
324
|
_tags = _opt.item.tags
|
|
325
|
+
const t = tags(_tags)
|
|
326
|
+
if (t["From-Process"]) from = t["From-Process"]
|
|
322
327
|
if (!from) {
|
|
323
328
|
from = await arweave.wallets.jwkToAddress({
|
|
324
329
|
kty: "RSA",
|
|
@@ -369,14 +374,44 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
369
374
|
target: v.Target,
|
|
370
375
|
})
|
|
371
376
|
} else {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
377
|
+
const t = tags(v.Tags)
|
|
378
|
+
// this behaviour is different from AOS (temporary hack for remote tests)
|
|
379
|
+
if (t.__Scheduler__) {
|
|
380
|
+
const sch = t.__Scheduler__
|
|
381
|
+
const tar = v.Target
|
|
382
|
+
const procs =
|
|
383
|
+
(await fetch(sch).then(r => r.json()))?.Processes ?? []
|
|
384
|
+
const ao = await new AO({ port: sch.split(":").pop() - 3 }).init(
|
|
385
|
+
mu.jwk
|
|
386
|
+
)
|
|
387
|
+
try {
|
|
388
|
+
let _tags = {
|
|
389
|
+
...t,
|
|
390
|
+
"From-Process": opt.process,
|
|
391
|
+
"Pushed-For": id,
|
|
392
|
+
}
|
|
393
|
+
const pr = (await mem.getTx(opt.process))?.tags ?? []
|
|
394
|
+
const module = tags(pr).Module
|
|
395
|
+
if (module) _tags["From-Module"] = module
|
|
396
|
+
const { mid } = await ao.msg({
|
|
397
|
+
act: _tags["Action"] ?? null,
|
|
398
|
+
pid: tar,
|
|
399
|
+
tags: _tags,
|
|
400
|
+
data: v.Data ?? "",
|
|
401
|
+
})
|
|
402
|
+
} catch (e) {
|
|
403
|
+
console.log(e)
|
|
404
|
+
}
|
|
405
|
+
} else {
|
|
406
|
+
await record({
|
|
407
|
+
for: opt.message,
|
|
408
|
+
tags: v.Tags,
|
|
409
|
+
data: v.Data,
|
|
410
|
+
signer: mu.signer,
|
|
411
|
+
from: opt.process,
|
|
412
|
+
target: v.Target,
|
|
413
|
+
})
|
|
414
|
+
}
|
|
380
415
|
}
|
|
381
416
|
}
|
|
382
417
|
for (const v of res.Spawns ?? []) {
|
package/esm/hb.js
CHANGED