wao 0.21.1 → 0.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ var _crypto = _interopRequireDefault(require("crypto"));
11
11
  var _base64url = _interopRequireDefault(require("base64url"));
12
12
  var _utils = require("./utils.js");
13
13
  var _ao = _interopRequireDefault(require("./ao.js"));
14
+ var _aoconnect = require("@permaweb/aoconnect");
14
15
  var _weavedrive = _interopRequireDefault(require("./weavedrive.js"));
15
16
  var _ramda = require("ramda");
16
17
  var _Arweave$default, _WarpArBundles$defaul;
@@ -671,26 +672,26 @@ var _default = exports["default"] = function _default() {
671
672
  return (0, _base64url["default"])(hasher.digest());
672
673
  }
673
674
  var _assign = /*#__PURE__*/function () {
674
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
675
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
675
676
  var _opt$tags2;
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;
677
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
678
- while (1) switch (_context4.prev = _context4.next) {
677
+ 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, _loop, _iterator4, _step4, v, __tags, _iterator5, _step5, _v, _iterator6, _step6, v2;
678
+ return _regeneratorRuntime().wrap(function _callee5$(_context6) {
679
+ while (1) switch (_context6.prev = _context6.next) {
679
680
  case 0:
680
- _context4.next = 2;
681
+ _context6.next = 2;
681
682
  return mem.get("env", opt.process);
682
683
  case 2:
683
- p = _context4.sent;
684
+ p = _context6.sent;
684
685
  if (!(!p || !opt.process)) {
685
- _context4.next = 5;
686
+ _context6.next = 5;
686
687
  break;
687
688
  }
688
- return _context4.abrupt("return", null);
689
+ return _context6.abrupt("return", null);
689
690
  case 5:
690
- _context4.next = 7;
691
+ _context6.next = 7;
691
692
  return mem.get("msgs", opt.message);
692
693
  case 7:
693
- _opt = _context4.sent;
694
+ _opt = _context6.sent;
694
695
  hash = p.hash;
695
696
  try {
696
697
  hash = genHashChain(p.hash, opt.message);
@@ -698,35 +699,35 @@ var _default = exports["default"] = function _default() {
698
699
  console.log(e);
699
700
  }
700
701
  p.hash = hash;
701
- _context4.t0 = _utils.buildTags;
702
- _context4.t1 = _ramda.mergeLeft;
703
- _context4.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
704
- _context4.t3 = Date.now();
705
- _context4.t4 = p.epochs.length;
706
- _context4.t5 = variant !== null && variant !== void 0 ? variant : "ao.TN.1";
707
- _context4.next = 19;
702
+ _context6.t0 = _utils.buildTags;
703
+ _context6.t1 = _ramda.mergeLeft;
704
+ _context6.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
705
+ _context6.t3 = Date.now();
706
+ _context6.t4 = p.epochs.length;
707
+ _context6.t5 = variant !== null && variant !== void 0 ? variant : "ao.TN.1";
708
+ _context6.next = 19;
708
709
  return mem.get("height");
709
710
  case 19:
710
- _context4.t6 = _context4.sent;
711
- _context4.t7 = opt.process;
712
- _context4.t8 = opt.message;
713
- _context4.t9 = hash;
714
- _context4.t10 = {
715
- Timestamp: _context4.t3,
716
- Epoch: _context4.t4,
711
+ _context6.t6 = _context6.sent;
712
+ _context6.t7 = opt.process;
713
+ _context6.t8 = opt.message;
714
+ _context6.t9 = hash;
715
+ _context6.t10 = {
716
+ Timestamp: _context6.t3,
717
+ Epoch: _context6.t4,
717
718
  Nonce: "0",
718
719
  "Data-Protocol": "ao",
719
- Variant: _context4.t5,
720
+ Variant: _context6.t5,
720
721
  Type: "Assignment",
721
- "Block-Height": _context4.t6,
722
- Process: _context4.t7,
723
- Message: _context4.t8,
724
- "Hash-Chain": _context4.t9
722
+ "Block-Height": _context6.t6,
723
+ Process: _context6.t7,
724
+ Message: _context6.t8,
725
+ "Hash-Chain": _context6.t9
725
726
  };
726
- _context4.t11 = (0, _context4.t1)(_context4.t2, _context4.t10);
727
- opt.tags = (0, _context4.t0)(null, _context4.t11);
727
+ _context6.t11 = (0, _context6.t1)(_context6.t2, _context6.t10);
728
+ opt.tags = (0, _context6.t0)(null, _context6.t11);
728
729
  p.epochs.push([opt.message]);
729
- _context4.next = 29;
730
+ _context6.next = 29;
730
731
  return ar.dataitem({
731
732
  data: opt.data,
732
733
  signer: opt.signer,
@@ -734,29 +735,29 @@ var _default = exports["default"] = function _default() {
734
735
  target: opt.process
735
736
  });
736
737
  case 29:
737
- _yield$ar$dataitem2 = _context4.sent;
738
+ _yield$ar$dataitem2 = _context6.sent;
738
739
  id = _yield$ar$dataitem2.id;
739
740
  owner = _yield$ar$dataitem2.owner;
740
741
  item = _yield$ar$dataitem2.item;
741
742
  if (!opt.message_item) {
742
- _context4.next = 38;
743
+ _context6.next = 38;
743
744
  break;
744
745
  }
745
- _context4.next = 36;
746
+ _context6.next = 36;
746
747
  return ar.postItems([opt.message_item, item], su.jwk);
747
748
  case 36:
748
- _context4.next = 40;
749
+ _context6.next = 40;
749
750
  break;
750
751
  case 38:
751
- _context4.next = 40;
752
+ _context6.next = 40;
752
753
  return ar.postItems(item, su.jwk);
753
754
  case 40:
754
- _context4.prev = 40;
755
+ _context6.prev = 40;
755
756
  data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
756
757
  _tags = _opt.tags;
757
758
  from = (_ref10 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref10 !== void 0 ? _ref10 : owner;
758
759
  if (!_opt.item) {
759
- _context4.next = 53;
760
+ _context6.next = 53;
760
761
  break;
761
762
  }
762
763
  data = _base64url["default"].decode(_opt.item.data);
@@ -764,82 +765,82 @@ var _default = exports["default"] = function _default() {
764
765
  t = (0, _utils.tags)(_tags);
765
766
  if (t["From-Process"]) from = t["From-Process"];
766
767
  if (from) {
767
- _context4.next = 53;
768
+ _context6.next = 53;
768
769
  break;
769
770
  }
770
- _context4.next = 52;
771
+ _context6.next = 52;
771
772
  return arweave.wallets.jwkToAddress({
772
773
  kty: "RSA",
773
774
  n: _opt.item.owner,
774
775
  e: "AQAB"
775
776
  });
776
777
  case 52:
777
- from = _context4.sent;
778
+ from = _context6.sent;
778
779
  case 53:
779
- _context4.next = 55;
780
+ _context6.next = 55;
780
781
  return genMsg(opt.message, p, data, _tags, from, mu.addr);
781
782
  case 55:
782
- msg = _context4.sent;
783
- _context4.next = 58;
783
+ msg = _context6.sent;
784
+ _context6.next = 58;
784
785
  return genEnv({
785
786
  pid: p.id,
786
787
  owner: p.owner,
787
788
  module: p.module
788
789
  });
789
790
  case 58:
790
- _env = _context4.sent;
791
+ _env = _context6.sent;
791
792
  if (p.handle) {
792
- _context4.next = 91;
793
+ _context6.next = 91;
793
794
  break;
794
795
  }
795
- _context4.next = 62;
796
+ _context6.next = 62;
796
797
  return mem.getWasm(p.modulea);
797
798
  case 62:
798
- _yield$mem$getWasm2 = _context4.sent;
799
+ _yield$mem$getWasm2 = _context6.sent;
799
800
  format = _yield$mem$getWasm2.format;
800
801
  mod = _yield$mem$getWasm2.mod;
801
802
  wasm = _yield$mem$getWasm2.wasm;
802
803
  wdrive = extensions[p.extention];
803
- _context4.t12 = AoLoader;
804
- _context4.t13 = wasm;
805
- _context4.t14 = format;
806
- _context4.t15 = wdrive;
807
- _context4.next = 73;
804
+ _context6.t12 = AoLoader;
805
+ _context6.t13 = wasm;
806
+ _context6.t14 = format;
807
+ _context6.t15 = wdrive;
808
+ _context6.next = 73;
808
809
  return mem.getTx(p.id);
809
810
  case 73:
810
- _context4.t17 = _yield$mem$getTx3 = _context4.sent;
811
- _context4.t16 = _context4.t17 === null;
812
- if (_context4.t16) {
813
- _context4.next = 77;
811
+ _context6.t17 = _yield$mem$getTx3 = _context6.sent;
812
+ _context6.t16 = _context6.t17 === null;
813
+ if (_context6.t16) {
814
+ _context6.next = 77;
814
815
  break;
815
816
  }
816
- _context4.t16 = _yield$mem$getTx3 === void 0;
817
+ _context6.t16 = _yield$mem$getTx3 === void 0;
817
818
  case 77:
818
- if (!_context4.t16) {
819
- _context4.next = 81;
819
+ if (!_context6.t16) {
820
+ _context6.next = 81;
820
821
  break;
821
822
  }
822
- _context4.t18 = void 0;
823
- _context4.next = 82;
823
+ _context6.t18 = void 0;
824
+ _context6.next = 82;
824
825
  break;
825
826
  case 81:
826
- _context4.t18 = _yield$mem$getTx3.item;
827
+ _context6.t18 = _yield$mem$getTx3.item;
827
828
  case 82:
828
- _context4.t19 = _context4.t18;
829
- _context4.next = 85;
829
+ _context6.t19 = _context6.t18;
830
+ _context6.next = 85;
830
831
  return mem.getTx(mod);
831
832
  case 85:
832
- _context4.t20 = _context4.sent;
833
- _context4.t21 = {
834
- format: _context4.t14,
835
- WeaveDrive: _context4.t15,
836
- spawn: _context4.t19,
837
- module: _context4.t20
833
+ _context6.t20 = _context6.sent;
834
+ _context6.t21 = {
835
+ format: _context6.t14,
836
+ WeaveDrive: _context6.t15,
837
+ spawn: _context6.t19,
838
+ module: _context6.t20
838
839
  };
839
- _context4.next = 89;
840
- return (0, _context4.t12)(_context4.t13, _context4.t21);
840
+ _context6.next = 89;
841
+ return (0, _context6.t12)(_context6.t13, _context6.t21);
841
842
  case 89:
842
- p.handle = _context4.sent;
843
+ p.handle = _context6.sent;
843
844
  mem.env[opt.process].handle = p.handle;
844
845
  case 91:
845
846
  if (p.compressed) {
@@ -847,384 +848,485 @@ var _default = exports["default"] = function _default() {
847
848
  p.memory = mem.decompress(p.memory, p.original_size);
848
849
  p.compressed = false;
849
850
  }
850
- _context4.next = 94;
851
+ _context6.next = 94;
851
852
  return p.handle(p.memory, msg, _env);
852
853
  case 94:
853
- res = _context4.sent;
854
+ res = _context6.sent;
854
855
  p.memory = res.Memory;
855
856
  delete res.Memory;
856
857
  p.results.push(opt.message);
857
- _context4.next = 100;
858
+ _context6.next = 100;
858
859
  return mem.set(p, "env", opt.process);
859
860
  case 100:
860
861
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
861
862
  res: res,
862
863
  msg: msg
863
864
  });
864
- _context4.next = 103;
865
+ _context6.next = 103;
865
866
  return mem.set(_msg, "msgs", opt.message);
866
867
  case 103:
867
868
  _iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
868
- _context4.prev = 104;
869
+ _context6.prev = 104;
870
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
871
+ var v, _t, _result, slot, fetchHB, info, _connect, request, _tags2, _yield$request, _res2, _data, _yield$fetch$then$Pro, _yield$fetch$then, sch, tar, procs, ao, _yield$mem$getTx$tags3, _yield$mem$getTx4, _tags3$Action, _v$Data, _tags3, pr, module, _yield$ao$msg, mid;
872
+ return _regeneratorRuntime().wrap(function _loop$(_context5) {
873
+ while (1) switch (_context5.prev = _context5.next) {
874
+ case 0:
875
+ v = _step3.value;
876
+ _context5.next = 3;
877
+ return mem.get("env", v.Target);
878
+ case 3:
879
+ if (!_context5.sent) {
880
+ _context5.next = 8;
881
+ break;
882
+ }
883
+ _context5.next = 6;
884
+ return message({
885
+ "for": opt.message,
886
+ process: v.Target,
887
+ tags: v.Tags,
888
+ data: v.Data,
889
+ signer: mu.signer,
890
+ from: opt.process,
891
+ target: v.Target
892
+ });
893
+ case 6:
894
+ _context5.next = 101;
895
+ break;
896
+ case 8:
897
+ _t = (0, _utils.tags)(v.Tags); // this behaviour is different from AOS (temporary hack for remote tests)
898
+ if (!_t.__HyperBEAM__) {
899
+ _context5.next = 36;
900
+ break;
901
+ }
902
+ _result = null;
903
+ slot = null;
904
+ _context5.prev = 12;
905
+ fetchHB = /*#__PURE__*/function () {
906
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {
907
+ var _ref12,
908
+ _ref12$json,
909
+ json,
910
+ _ref12$params,
911
+ params,
912
+ _args4 = arguments;
913
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
914
+ while (1) switch (_context4.prev = _context4.next) {
915
+ case 0:
916
+ _ref12 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, _ref12$json = _ref12.json, json = _ref12$json === void 0 ? true : _ref12$json, _ref12$params = _ref12.params, params = _ref12$params === void 0 ? "" : _ref12$params;
917
+ _context4.next = 3;
918
+ return fetch("".concat(_t.__HyperBEAM__).concat(path).concat(json ? "/serialize~json@1.0" : "").concat(params ? "?" + params : "")).then(function (r) {
919
+ return r[json ? "json" : "text"]();
920
+ });
921
+ case 3:
922
+ return _context4.abrupt("return", _context4.sent);
923
+ case 4:
924
+ case "end":
925
+ return _context4.stop();
926
+ }
927
+ }, _callee4);
928
+ }));
929
+ return function fetchHB(_x9) {
930
+ return _ref11.apply(this, arguments);
931
+ };
932
+ }();
933
+ _context5.next = 16;
934
+ return fetchHB("/~meta@1.0/info");
935
+ case 16:
936
+ info = _context5.sent;
937
+ _connect = (0, _aoconnect.connect)({
938
+ MODE: "mainnet",
939
+ URL: _t.__HyperBEAM__,
940
+ device: "",
941
+ signer: (0, _aoconnect.createSigner)(mu.jwk)
942
+ }), request = _connect.request;
943
+ _tags2 = _objectSpread(_objectSpread({}, _t), {}, {
944
+ "From-Process": opt.process,
945
+ "Pushed-For": id,
946
+ method: "POST",
947
+ path: "/".concat(v.Target, "/schedule"),
948
+ scheduler: info.address
949
+ });
950
+ _context5.next = 21;
951
+ return request(_tags2);
952
+ case 21:
953
+ _yield$request = _context5.sent;
954
+ slot = _yield$request.slot;
955
+ _context5.next = 25;
956
+ return fetchHB("/".concat(v.Target, "~process@1.0/compute"), {
957
+ params: "slot=".concat(slot)
958
+ });
959
+ case 25:
960
+ _res2 = _context5.sent;
961
+ _data = _res2.results.data;
962
+ _result = _data;
963
+ _context5.next = 33;
964
+ break;
965
+ case 30:
966
+ _context5.prev = 30;
967
+ _context5.t0 = _context5["catch"](12);
968
+ console.log(_context5.t0);
969
+ case 33:
970
+ if (_result) {
971
+ /*
972
+ await message({
973
+ for: slot,
974
+ process: opt.process,
975
+ tags: buildTags({
976
+ "X-Reference": t.Reference,
977
+ }),
978
+ data: JSON.stringify(result),
979
+ signer: mu.signer,
980
+ from: v.Target,
981
+ target: opt.process,
982
+ })*/
983
+ }
984
+ _context5.next = 101;
985
+ break;
986
+ case 36:
987
+ if (!_t.__Scheduler__) {
988
+ _context5.next = 99;
989
+ break;
990
+ }
991
+ sch = _t.__Scheduler__;
992
+ tar = v.Target;
993
+ _context5.next = 41;
994
+ return fetch(sch).then(function (r) {
995
+ return r.json();
996
+ });
997
+ case 41:
998
+ _context5.t3 = _yield$fetch$then = _context5.sent;
999
+ _context5.t2 = _context5.t3 === null;
1000
+ if (_context5.t2) {
1001
+ _context5.next = 45;
1002
+ break;
1003
+ }
1004
+ _context5.t2 = _yield$fetch$then === void 0;
1005
+ case 45:
1006
+ if (!_context5.t2) {
1007
+ _context5.next = 49;
1008
+ break;
1009
+ }
1010
+ _context5.t4 = void 0;
1011
+ _context5.next = 50;
1012
+ break;
1013
+ case 49:
1014
+ _context5.t4 = _yield$fetch$then.Processes;
1015
+ case 50:
1016
+ _context5.t5 = _yield$fetch$then$Pro = _context5.t4;
1017
+ _context5.t1 = _context5.t5 !== null;
1018
+ if (!_context5.t1) {
1019
+ _context5.next = 54;
1020
+ break;
1021
+ }
1022
+ _context5.t1 = _yield$fetch$then$Pro !== void 0;
1023
+ case 54:
1024
+ if (!_context5.t1) {
1025
+ _context5.next = 58;
1026
+ break;
1027
+ }
1028
+ _context5.t6 = _yield$fetch$then$Pro;
1029
+ _context5.next = 59;
1030
+ break;
1031
+ case 58:
1032
+ _context5.t6 = [];
1033
+ case 59:
1034
+ procs = _context5.t6;
1035
+ _context5.next = 62;
1036
+ return new _ao["default"]({
1037
+ port: sch.split(":").pop() - 3
1038
+ }).init(mu.jwk);
1039
+ case 62:
1040
+ ao = _context5.sent;
1041
+ _context5.prev = 63;
1042
+ _tags3 = _objectSpread(_objectSpread({}, _t), {}, {
1043
+ "From-Process": opt.process,
1044
+ "Pushed-For": id
1045
+ });
1046
+ _context5.next = 67;
1047
+ return mem.getTx(opt.process);
1048
+ case 67:
1049
+ _context5.t9 = _yield$mem$getTx4 = _context5.sent;
1050
+ _context5.t8 = _context5.t9 === null;
1051
+ if (_context5.t8) {
1052
+ _context5.next = 71;
1053
+ break;
1054
+ }
1055
+ _context5.t8 = _yield$mem$getTx4 === void 0;
1056
+ case 71:
1057
+ if (!_context5.t8) {
1058
+ _context5.next = 75;
1059
+ break;
1060
+ }
1061
+ _context5.t10 = void 0;
1062
+ _context5.next = 76;
1063
+ break;
1064
+ case 75:
1065
+ _context5.t10 = _yield$mem$getTx4.tags;
1066
+ case 76:
1067
+ _context5.t11 = _yield$mem$getTx$tags3 = _context5.t10;
1068
+ _context5.t7 = _context5.t11 !== null;
1069
+ if (!_context5.t7) {
1070
+ _context5.next = 80;
1071
+ break;
1072
+ }
1073
+ _context5.t7 = _yield$mem$getTx$tags3 !== void 0;
1074
+ case 80:
1075
+ if (!_context5.t7) {
1076
+ _context5.next = 84;
1077
+ break;
1078
+ }
1079
+ _context5.t12 = _yield$mem$getTx$tags3;
1080
+ _context5.next = 85;
1081
+ break;
1082
+ case 84:
1083
+ _context5.t12 = [];
1084
+ case 85:
1085
+ pr = _context5.t12;
1086
+ module = (0, _utils.tags)(pr).Module;
1087
+ if (module) _tags3["From-Module"] = module;
1088
+ _context5.next = 90;
1089
+ return ao.msg({
1090
+ act: (_tags3$Action = _tags3["Action"]) !== null && _tags3$Action !== void 0 ? _tags3$Action : null,
1091
+ pid: tar,
1092
+ tags: _tags3,
1093
+ data: (_v$Data = v.Data) !== null && _v$Data !== void 0 ? _v$Data : ""
1094
+ });
1095
+ case 90:
1096
+ _yield$ao$msg = _context5.sent;
1097
+ mid = _yield$ao$msg.mid;
1098
+ _context5.next = 97;
1099
+ break;
1100
+ case 94:
1101
+ _context5.prev = 94;
1102
+ _context5.t13 = _context5["catch"](63);
1103
+ console.log(_context5.t13);
1104
+ case 97:
1105
+ _context5.next = 101;
1106
+ break;
1107
+ case 99:
1108
+ _context5.next = 101;
1109
+ return record({
1110
+ "for": opt.message,
1111
+ tags: v.Tags,
1112
+ data: v.Data,
1113
+ signer: mu.signer,
1114
+ from: opt.process,
1115
+ target: v.Target
1116
+ });
1117
+ case 101:
1118
+ case "end":
1119
+ return _context5.stop();
1120
+ }
1121
+ }, _loop, null, [[12, 30], [63, 94]]);
1122
+ });
869
1123
  _iterator3.s();
870
- case 106:
1124
+ case 107:
871
1125
  if ((_step3 = _iterator3.n()).done) {
872
- _context4.next = 183;
873
- break;
874
- }
875
- v = _step3.value;
876
- _context4.next = 110;
877
- return mem.get("env", v.Target);
878
- case 110:
879
- if (!_context4.sent) {
880
- _context4.next = 115;
881
- break;
882
- }
883
- _context4.next = 113;
884
- return message({
885
- "for": opt.message,
886
- process: v.Target,
887
- tags: v.Tags,
888
- data: v.Data,
889
- signer: mu.signer,
890
- from: opt.process,
891
- target: v.Target
892
- });
893
- case 113:
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;
1126
+ _context6.next = 111;
919
1127
  break;
920
1128
  }
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;
1020
- return record({
1021
- "for": opt.message,
1022
- tags: v.Tags,
1023
- data: v.Data,
1024
- signer: mu.signer,
1025
- from: opt.process,
1026
- target: v.Target
1027
- });
1028
- case 181:
1029
- _context4.next = 106;
1129
+ return _context6.delegateYield(_loop(), "t22", 109);
1130
+ case 109:
1131
+ _context6.next = 107;
1030
1132
  break;
1031
- case 183:
1032
- _context4.next = 188;
1133
+ case 111:
1134
+ _context6.next = 116;
1033
1135
  break;
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;
1136
+ case 113:
1137
+ _context6.prev = 113;
1138
+ _context6.t23 = _context6["catch"](104);
1139
+ _iterator3.e(_context6.t23);
1140
+ case 116:
1141
+ _context6.prev = 116;
1040
1142
  _iterator3.f();
1041
- return _context4.finish(188);
1042
- case 191:
1143
+ return _context6.finish(116);
1144
+ case 119:
1043
1145
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
1044
- _context4.prev = 192;
1146
+ _context6.prev = 120;
1045
1147
  _iterator4.s();
1046
- case 194:
1148
+ case 122:
1047
1149
  if ((_step4 = _iterator4.n()).done) {
1048
- _context4.next = 201;
1150
+ _context6.next = 129;
1049
1151
  break;
1050
1152
  }
1051
- _v = _step4.value;
1052
- __tags = (0, _utils.tags)(_v.Tags);
1053
- _context4.next = 199;
1153
+ v = _step4.value;
1154
+ __tags = (0, _utils.tags)(v.Tags);
1155
+ _context6.next = 127;
1054
1156
  return spawn({
1055
1157
  "for": opt.message,
1056
1158
  module: __tags.Module,
1057
1159
  scheduler: scheduler,
1058
- tags: _v.Tags,
1059
- data: _v.Data,
1160
+ tags: v.Tags,
1161
+ data: v.Data,
1060
1162
  from: __tags["From-Process"],
1061
1163
  signer: mu.signer
1062
1164
  });
1063
- case 199:
1064
- _context4.next = 194;
1165
+ case 127:
1166
+ _context6.next = 122;
1065
1167
  break;
1066
- case 201:
1067
- _context4.next = 206;
1168
+ case 129:
1169
+ _context6.next = 134;
1068
1170
  break;
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;
1171
+ case 131:
1172
+ _context6.prev = 131;
1173
+ _context6.t24 = _context6["catch"](120);
1174
+ _iterator4.e(_context6.t24);
1175
+ case 134:
1176
+ _context6.prev = 134;
1075
1177
  _iterator4.f();
1076
- return _context4.finish(206);
1077
- case 209:
1178
+ return _context6.finish(134);
1179
+ case 137:
1078
1180
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
1079
- _context4.prev = 210;
1181
+ _context6.prev = 138;
1080
1182
  _iterator5.s();
1081
- case 212:
1183
+ case 140:
1082
1184
  if ((_step5 = _iterator5.n()).done) {
1083
- _context4.next = 233;
1185
+ _context6.next = 161;
1084
1186
  break;
1085
1187
  }
1086
- _v2 = _step5.value;
1087
- _iterator6 = _createForOfIteratorHelper(_v2.Processes);
1088
- _context4.prev = 215;
1188
+ _v = _step5.value;
1189
+ _iterator6 = _createForOfIteratorHelper(_v.Processes);
1190
+ _context6.prev = 143;
1089
1191
  _iterator6.s();
1090
- case 217:
1192
+ case 145:
1091
1193
  if ((_step6 = _iterator6.n()).done) {
1092
- _context4.next = 223;
1194
+ _context6.next = 151;
1093
1195
  break;
1094
1196
  }
1095
1197
  v2 = _step6.value;
1096
- _context4.next = 221;
1198
+ _context6.next = 149;
1097
1199
  return _assign({
1098
- message: _v2.Message,
1200
+ message: _v.Message,
1099
1201
  process: v2,
1100
1202
  from: opt.process,
1101
1203
  signer: mu.signer
1102
1204
  });
1103
- case 221:
1104
- _context4.next = 217;
1205
+ case 149:
1206
+ _context6.next = 145;
1105
1207
  break;
1106
- case 223:
1107
- _context4.next = 228;
1208
+ case 151:
1209
+ _context6.next = 156;
1108
1210
  break;
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;
1211
+ case 153:
1212
+ _context6.prev = 153;
1213
+ _context6.t25 = _context6["catch"](143);
1214
+ _iterator6.e(_context6.t25);
1215
+ case 156:
1216
+ _context6.prev = 156;
1115
1217
  _iterator6.f();
1116
- return _context4.finish(228);
1117
- case 231:
1118
- _context4.next = 212;
1218
+ return _context6.finish(156);
1219
+ case 159:
1220
+ _context6.next = 140;
1119
1221
  break;
1120
- case 233:
1121
- _context4.next = 238;
1222
+ case 161:
1223
+ _context6.next = 166;
1122
1224
  break;
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;
1225
+ case 163:
1226
+ _context6.prev = 163;
1227
+ _context6.t26 = _context6["catch"](138);
1228
+ _iterator5.e(_context6.t26);
1229
+ case 166:
1230
+ _context6.prev = 166;
1129
1231
  _iterator5.f();
1130
- return _context4.finish(238);
1131
- case 241:
1132
- return _context4.abrupt("return", id);
1133
- case 244:
1134
- _context4.prev = 244;
1135
- _context4.t39 = _context4["catch"](40);
1136
- console.log(_context4.t39);
1137
- case 247:
1138
- return _context4.abrupt("return", null);
1139
- case 248:
1232
+ return _context6.finish(166);
1233
+ case 169:
1234
+ return _context6.abrupt("return", id);
1235
+ case 172:
1236
+ _context6.prev = 172;
1237
+ _context6.t27 = _context6["catch"](40);
1238
+ console.log(_context6.t27);
1239
+ case 175:
1240
+ return _context6.abrupt("return", null);
1241
+ case 176:
1140
1242
  case "end":
1141
- return _context4.stop();
1243
+ return _context6.stop();
1142
1244
  }
1143
- }, _callee4, null, [[40, 244], [104, 185, 188, 191], [143, 174], [192, 203, 206, 209], [210, 235, 238, 241], [215, 225, 228, 231]]);
1245
+ }, _callee5, null, [[40, 172], [104, 113, 116, 119], [120, 131, 134, 137], [138, 163, 166, 169], [143, 153, 156, 159]]);
1144
1246
  }));
1145
1247
  return function assign(_x8) {
1146
1248
  return _ref9.apply(this, arguments);
1147
1249
  };
1148
1250
  }();
1149
1251
  var message = /*#__PURE__*/function () {
1150
- var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
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;
1152
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1153
- while (1) switch (_context5.prev = _context5.next) {
1252
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
1253
+ 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, _ref14, _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;
1254
+ return _regeneratorRuntime().wrap(function _callee6$(_context7) {
1255
+ while (1) switch (_context7.prev = _context7.next) {
1154
1256
  case 0:
1155
1257
  id = "";
1156
1258
  owner = "";
1157
1259
  item = null;
1158
1260
  if (!ar.isHttpMsg(opt.http_msg)) {
1159
- _context5.next = 35;
1261
+ _context7.next = 35;
1160
1262
  break;
1161
1263
  }
1162
1264
  id = (_opt$id2 = opt.id) !== null && _opt$id2 !== void 0 ? _opt$id2 : opt.http_msg.target;
1163
1265
  _key = "".concat(opt.process, ":").concat(id, "}");
1164
1266
  if (!ongoing[_key]) {
1165
- _context5.next = 17;
1267
+ _context7.next = 17;
1166
1268
  break;
1167
1269
  }
1168
1270
  i = 0;
1169
1271
  case 8:
1170
1272
  if (!(i < 30 && ongoing[_key])) {
1171
- _context5.next = 14;
1273
+ _context7.next = 14;
1172
1274
  break;
1173
1275
  }
1174
- _context5.next = 11;
1276
+ _context7.next = 11;
1175
1277
  return (0, _utils.wait)(100);
1176
1278
  case 11:
1177
1279
  i++;
1178
- _context5.next = 8;
1280
+ _context7.next = 8;
1179
1281
  break;
1180
1282
  case 14:
1181
- return _context5.abrupt("return", id);
1283
+ return _context7.abrupt("return", id);
1182
1284
  case 17:
1183
1285
  ongoing[_key] = true;
1184
- _context5.next = 20;
1286
+ _context7.next = 20;
1185
1287
  return ar.httpmsg(opt.http_msg, id);
1186
1288
  case 20:
1187
- _yield$ar$httpmsg2 = _context5.sent;
1289
+ _yield$ar$httpmsg2 = _context7.sent;
1188
1290
  owner = _yield$ar$httpmsg2.owner;
1189
1291
  item = _yield$ar$httpmsg2.item;
1190
- _context5.next = 25;
1292
+ _context7.next = 25;
1191
1293
  return mem.get("env", opt.process);
1192
1294
  case 25:
1193
- _p = _context5.sent;
1295
+ _p = _context7.sent;
1194
1296
  new_slot = opt.slot * 1;
1195
1297
  last_slot = !_p ? -1 : _p.results.length - 1;
1196
1298
  if (!(last_slot + 1 < new_slot)) {
1197
- _context5.next = 33;
1299
+ _context7.next = 33;
1198
1300
  break;
1199
1301
  }
1200
1302
  if (!(!hb || opt.recovery)) {
1201
- _context5.next = 31;
1303
+ _context7.next = 31;
1202
1304
  break;
1203
1305
  }
1204
- return _context5.abrupt("return", null);
1306
+ return _context7.abrupt("return", null);
1205
1307
  case 31:
1206
- _context5.next = 33;
1308
+ _context7.next = 33;
1207
1309
  return _recover(opt.process);
1208
1310
  case 33:
1209
- _context5.next = 38;
1311
+ _context7.next = 38;
1210
1312
  break;
1211
1313
  case 35:
1212
1314
  id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
1213
1315
  owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
1214
1316
  item = opt.item;
1215
1317
  case 38:
1216
- _context5.next = 40;
1318
+ _context7.next = 40;
1217
1319
  return mem.get("env", opt.process);
1218
1320
  case 40:
1219
- p = _context5.sent;
1321
+ p = _context7.sent;
1220
1322
  if (p) {
1221
- _context5.next = 43;
1323
+ _context7.next = 43;
1222
1324
  break;
1223
1325
  }
1224
- return _context5.abrupt("return", null);
1326
+ return _context7.abrupt("return", null);
1225
1327
  case 43:
1226
1328
  if (!(!opt.item && opt.signer)) {
1227
- _context5.next = 78;
1329
+ _context7.next = 78;
1228
1330
  break;
1229
1331
  }
1230
1332
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
@@ -1233,7 +1335,7 @@ var _default = exports["default"] = function _default() {
1233
1335
  Type: "Message"
1234
1336
  }));
1235
1337
  if (!opt["for"]) {
1236
- _context5.next = 71;
1338
+ _context7.next = 71;
1237
1339
  break;
1238
1340
  }
1239
1341
  opt.tags.push({
@@ -1244,46 +1346,46 @@ var _default = exports["default"] = function _default() {
1244
1346
  name: "From-Process",
1245
1347
  value: opt.from
1246
1348
  });
1247
- _context5.next = 50;
1349
+ _context7.next = 50;
1248
1350
  return mem.getTx(opt.from);
1249
1351
  case 50:
1250
- _context5.t2 = _yield$mem$getTx5 = _context5.sent;
1251
- _context5.t1 = _context5.t2 === null;
1252
- if (_context5.t1) {
1253
- _context5.next = 54;
1352
+ _context7.t2 = _yield$mem$getTx5 = _context7.sent;
1353
+ _context7.t1 = _context7.t2 === null;
1354
+ if (_context7.t1) {
1355
+ _context7.next = 54;
1254
1356
  break;
1255
1357
  }
1256
- _context5.t1 = _yield$mem$getTx5 === void 0;
1358
+ _context7.t1 = _yield$mem$getTx5 === void 0;
1257
1359
  case 54:
1258
- if (!_context5.t1) {
1259
- _context5.next = 58;
1360
+ if (!_context7.t1) {
1361
+ _context7.next = 58;
1260
1362
  break;
1261
1363
  }
1262
- _context5.t3 = void 0;
1263
- _context5.next = 59;
1364
+ _context7.t3 = void 0;
1365
+ _context7.next = 59;
1264
1366
  break;
1265
1367
  case 58:
1266
- _context5.t3 = _yield$mem$getTx5.tags;
1368
+ _context7.t3 = _yield$mem$getTx5.tags;
1267
1369
  case 59:
1268
- _context5.t4 = _yield$mem$getTx$tags4 = _context5.t3;
1269
- _context5.t0 = _context5.t4 !== null;
1270
- if (!_context5.t0) {
1271
- _context5.next = 63;
1370
+ _context7.t4 = _yield$mem$getTx$tags4 = _context7.t3;
1371
+ _context7.t0 = _context7.t4 !== null;
1372
+ if (!_context7.t0) {
1373
+ _context7.next = 63;
1272
1374
  break;
1273
1375
  }
1274
- _context5.t0 = _yield$mem$getTx$tags4 !== void 0;
1376
+ _context7.t0 = _yield$mem$getTx$tags4 !== void 0;
1275
1377
  case 63:
1276
- if (!_context5.t0) {
1277
- _context5.next = 67;
1378
+ if (!_context7.t0) {
1379
+ _context7.next = 67;
1278
1380
  break;
1279
1381
  }
1280
- _context5.t5 = _yield$mem$getTx$tags4;
1281
- _context5.next = 68;
1382
+ _context7.t5 = _yield$mem$getTx$tags4;
1383
+ _context7.next = 68;
1282
1384
  break;
1283
1385
  case 67:
1284
- _context5.t5 = [];
1386
+ _context7.t5 = [];
1285
1387
  case 68:
1286
- pr = _context5.t5;
1388
+ pr = _context7.t5;
1287
1389
  module = (0, _utils.tags)(pr).Module;
1288
1390
  if (module) opt.tags.push({
1289
1391
  name: "From-Module",
@@ -1291,7 +1393,7 @@ var _default = exports["default"] = function _default() {
1291
1393
  });
1292
1394
  case 71:
1293
1395
  ;
1294
- _context5.next = 74;
1396
+ _context7.next = 74;
1295
1397
  return ar.dataitem({
1296
1398
  data: opt.data,
1297
1399
  signer: opt.signer,
@@ -1299,90 +1401,90 @@ var _default = exports["default"] = function _default() {
1299
1401
  target: opt.process
1300
1402
  });
1301
1403
  case 74:
1302
- _yield$ar$dataitem3 = _context5.sent;
1404
+ _yield$ar$dataitem3 = _context7.sent;
1303
1405
  item = _yield$ar$dataitem3.item;
1304
1406
  id = _yield$ar$dataitem3.id;
1305
1407
  owner = _yield$ar$dataitem3.owner;
1306
1408
  case 78:
1307
1409
  _msg = (0, _ramda.dissoc)("signer", opt);
1308
- _context5.next = 81;
1410
+ _context7.next = 81;
1309
1411
  return mem.set(_msg, "msgs", id);
1310
1412
  case 81:
1311
1413
  if (!ar.isHttpMsg(opt.http_msg)) {
1312
- _context5.next = 145;
1414
+ _context7.next = 145;
1313
1415
  break;
1314
1416
  }
1315
1417
  p.epochs.push([id]);
1316
1418
  _opt = opt;
1317
- _context5.prev = 84;
1419
+ _context7.prev = 84;
1318
1420
  // todo: not sure if this is correct
1319
- from = (_ref12 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref12 !== void 0 ? _ref12 : owner;
1421
+ from = (_ref14 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref14 !== void 0 ? _ref14 : owner;
1320
1422
  data = (_opt$http_msg$data = opt.http_msg.data) !== null && _opt$http_msg$data !== void 0 ? _opt$http_msg$data : "";
1321
1423
  _tags = _opt.http_msg.tags; // todo: check if owner=mu.addr right?
1322
- _context5.next = 90;
1424
+ _context7.next = 90;
1323
1425
  return genMsg(opt.http_msg, p, data, _tags, from, owner);
1324
1426
  case 90:
1325
- msg = _context5.sent;
1326
- _context5.next = 93;
1427
+ msg = _context7.sent;
1428
+ _context7.next = 93;
1327
1429
  return genEnv({
1328
1430
  pid: p.id,
1329
1431
  owner: p.owner,
1330
1432
  module: p.module
1331
1433
  });
1332
1434
  case 93:
1333
- _env = _context5.sent;
1435
+ _env = _context7.sent;
1334
1436
  if (p.handle) {
1335
- _context5.next = 126;
1437
+ _context7.next = 126;
1336
1438
  break;
1337
1439
  }
1338
- _context5.next = 97;
1440
+ _context7.next = 97;
1339
1441
  return mem.getWasm(p.modulea);
1340
1442
  case 97:
1341
- _yield$mem$getWasm3 = _context5.sent;
1443
+ _yield$mem$getWasm3 = _context7.sent;
1342
1444
  format = _yield$mem$getWasm3.format;
1343
1445
  mod = _yield$mem$getWasm3.mod;
1344
1446
  wasm = _yield$mem$getWasm3.wasm;
1345
1447
  wdrive = extensions[p.extention];
1346
- _context5.t6 = AoLoader;
1347
- _context5.t7 = wasm;
1348
- _context5.t8 = format;
1349
- _context5.t9 = wdrive;
1350
- _context5.next = 108;
1448
+ _context7.t6 = AoLoader;
1449
+ _context7.t7 = wasm;
1450
+ _context7.t8 = format;
1451
+ _context7.t9 = wdrive;
1452
+ _context7.next = 108;
1351
1453
  return mem.getTx(p.id);
1352
1454
  case 108:
1353
- _context5.t11 = _yield$mem$getTx6 = _context5.sent;
1354
- _context5.t10 = _context5.t11 === null;
1355
- if (_context5.t10) {
1356
- _context5.next = 112;
1455
+ _context7.t11 = _yield$mem$getTx6 = _context7.sent;
1456
+ _context7.t10 = _context7.t11 === null;
1457
+ if (_context7.t10) {
1458
+ _context7.next = 112;
1357
1459
  break;
1358
1460
  }
1359
- _context5.t10 = _yield$mem$getTx6 === void 0;
1461
+ _context7.t10 = _yield$mem$getTx6 === void 0;
1360
1462
  case 112:
1361
- if (!_context5.t10) {
1362
- _context5.next = 116;
1463
+ if (!_context7.t10) {
1464
+ _context7.next = 116;
1363
1465
  break;
1364
1466
  }
1365
- _context5.t12 = void 0;
1366
- _context5.next = 117;
1467
+ _context7.t12 = void 0;
1468
+ _context7.next = 117;
1367
1469
  break;
1368
1470
  case 116:
1369
- _context5.t12 = _yield$mem$getTx6.item;
1471
+ _context7.t12 = _yield$mem$getTx6.item;
1370
1472
  case 117:
1371
- _context5.t13 = _context5.t12;
1372
- _context5.next = 120;
1473
+ _context7.t13 = _context7.t12;
1474
+ _context7.next = 120;
1373
1475
  return mem.getTx(mod);
1374
1476
  case 120:
1375
- _context5.t14 = _context5.sent;
1376
- _context5.t15 = {
1377
- format: _context5.t8,
1378
- WeaveDrive: _context5.t9,
1379
- spawn: _context5.t13,
1380
- module: _context5.t14
1477
+ _context7.t14 = _context7.sent;
1478
+ _context7.t15 = {
1479
+ format: _context7.t8,
1480
+ WeaveDrive: _context7.t9,
1481
+ spawn: _context7.t13,
1482
+ module: _context7.t14
1381
1483
  };
1382
- _context5.next = 124;
1383
- return (0, _context5.t6)(_context5.t7, _context5.t15);
1484
+ _context7.next = 124;
1485
+ return (0, _context7.t6)(_context7.t7, _context7.t15);
1384
1486
  case 124:
1385
- p.handle = _context5.sent;
1487
+ p.handle = _context7.sent;
1386
1488
  mem.env[opt.process].handle = p.handle;
1387
1489
  case 126:
1388
1490
  if (p.compressed) {
@@ -1390,34 +1492,34 @@ var _default = exports["default"] = function _default() {
1390
1492
  p.memory = mem.decompress(p.memory, p.original_size);
1391
1493
  p.compressed = false;
1392
1494
  }
1393
- _context5.next = 129;
1495
+ _context7.next = 129;
1394
1496
  return p.handle(p.memory, msg, _env);
1395
1497
  case 129:
1396
- res = _context5.sent;
1498
+ res = _context7.sent;
1397
1499
  p.memory = res.Memory;
1398
1500
  delete res.Memory;
1399
1501
  p.results.push(id);
1400
- _context5.next = 135;
1502
+ _context7.next = 135;
1401
1503
  return mem.set(p, "env", opt.process);
1402
1504
  case 135:
1403
1505
  _msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
1404
1506
  res: res,
1405
1507
  msg: msg
1406
1508
  });
1407
- _context5.next = 138;
1509
+ _context7.next = 138;
1408
1510
  return mem.set(_msg2, "msgs", id);
1409
1511
  case 138:
1410
- _context5.next = 143;
1512
+ _context7.next = 143;
1411
1513
  break;
1412
1514
  case 140:
1413
- _context5.prev = 140;
1414
- _context5.t16 = _context5["catch"](84);
1415
- console.log(_context5.t16);
1515
+ _context7.prev = 140;
1516
+ _context7.t16 = _context7["catch"](84);
1517
+ console.log(_context7.t16);
1416
1518
  case 143:
1417
- _context5.next = 147;
1519
+ _context7.next = 147;
1418
1520
  break;
1419
1521
  case 145:
1420
- _context5.next = 147;
1522
+ _context7.next = 147;
1421
1523
  return _assign({
1422
1524
  message_item: item,
1423
1525
  message: id,
@@ -1428,23 +1530,23 @@ var _default = exports["default"] = function _default() {
1428
1530
  case 147:
1429
1531
  key = "".concat(opt.process, ":").concat(id, "}");
1430
1532
  delete ongoing[key];
1431
- return _context5.abrupt("return", id);
1533
+ return _context7.abrupt("return", id);
1432
1534
  case 150:
1433
1535
  case "end":
1434
- return _context5.stop();
1536
+ return _context7.stop();
1435
1537
  }
1436
- }, _callee5, null, [[84, 140]]);
1538
+ }, _callee6, null, [[84, 140]]);
1437
1539
  }));
1438
- return function message(_x9) {
1439
- return _ref11.apply(this, arguments);
1540
+ return function message(_x10) {
1541
+ return _ref13.apply(this, arguments);
1440
1542
  };
1441
1543
  }();
1442
1544
  var record = /*#__PURE__*/function () {
1443
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
1545
+ var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
1444
1546
  var _opt$item$id2, _opt$item2, _opt$owner2, _opt$tags4;
1445
1547
  var id, owner, item, _yield$mem$getTx$tags5, _yield$mem$getTx7, pr, module, _yield$ar$dataitem4, _msg;
1446
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1447
- while (1) switch (_context6.prev = _context6.next) {
1548
+ return _regeneratorRuntime().wrap(function _callee7$(_context8) {
1549
+ while (1) switch (_context8.prev = _context8.next) {
1448
1550
  case 0:
1449
1551
  id = (_opt$item$id2 = opt === null || opt === void 0 || (_opt$item2 = opt.item) === null || _opt$item2 === void 0 ? void 0 : _opt$item2.id) !== null && _opt$item$id2 !== void 0 ? _opt$item$id2 : "";
1450
1552
  owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : "";
@@ -1455,7 +1557,7 @@ var _default = exports["default"] = function _default() {
1455
1557
  Type: "Message"
1456
1558
  }));
1457
1559
  if (!opt["for"]) {
1458
- _context6.next = 30;
1560
+ _context8.next = 30;
1459
1561
  break;
1460
1562
  }
1461
1563
  opt.tags.push({
@@ -1466,46 +1568,46 @@ var _default = exports["default"] = function _default() {
1466
1568
  name: "From-Process",
1467
1569
  value: opt.from
1468
1570
  });
1469
- _context6.next = 9;
1571
+ _context8.next = 9;
1470
1572
  return mem.getTx(opt.from);
1471
1573
  case 9:
1472
- _context6.t2 = _yield$mem$getTx7 = _context6.sent;
1473
- _context6.t1 = _context6.t2 === null;
1474
- if (_context6.t1) {
1475
- _context6.next = 13;
1574
+ _context8.t2 = _yield$mem$getTx7 = _context8.sent;
1575
+ _context8.t1 = _context8.t2 === null;
1576
+ if (_context8.t1) {
1577
+ _context8.next = 13;
1476
1578
  break;
1477
1579
  }
1478
- _context6.t1 = _yield$mem$getTx7 === void 0;
1580
+ _context8.t1 = _yield$mem$getTx7 === void 0;
1479
1581
  case 13:
1480
- if (!_context6.t1) {
1481
- _context6.next = 17;
1582
+ if (!_context8.t1) {
1583
+ _context8.next = 17;
1482
1584
  break;
1483
1585
  }
1484
- _context6.t3 = void 0;
1485
- _context6.next = 18;
1586
+ _context8.t3 = void 0;
1587
+ _context8.next = 18;
1486
1588
  break;
1487
1589
  case 17:
1488
- _context6.t3 = _yield$mem$getTx7.tags;
1590
+ _context8.t3 = _yield$mem$getTx7.tags;
1489
1591
  case 18:
1490
- _context6.t4 = _yield$mem$getTx$tags5 = _context6.t3;
1491
- _context6.t0 = _context6.t4 !== null;
1492
- if (!_context6.t0) {
1493
- _context6.next = 22;
1592
+ _context8.t4 = _yield$mem$getTx$tags5 = _context8.t3;
1593
+ _context8.t0 = _context8.t4 !== null;
1594
+ if (!_context8.t0) {
1595
+ _context8.next = 22;
1494
1596
  break;
1495
1597
  }
1496
- _context6.t0 = _yield$mem$getTx$tags5 !== void 0;
1598
+ _context8.t0 = _yield$mem$getTx$tags5 !== void 0;
1497
1599
  case 22:
1498
- if (!_context6.t0) {
1499
- _context6.next = 26;
1600
+ if (!_context8.t0) {
1601
+ _context8.next = 26;
1500
1602
  break;
1501
1603
  }
1502
- _context6.t5 = _yield$mem$getTx$tags5;
1503
- _context6.next = 27;
1604
+ _context8.t5 = _yield$mem$getTx$tags5;
1605
+ _context8.next = 27;
1504
1606
  break;
1505
1607
  case 26:
1506
- _context6.t5 = [];
1608
+ _context8.t5 = [];
1507
1609
  case 27:
1508
- pr = _context6.t5;
1610
+ pr = _context8.t5;
1509
1611
  module = (0, _utils.tags)(pr).Module;
1510
1612
  if (module) opt.tags.push({
1511
1613
  name: "From-Module",
@@ -1513,7 +1615,7 @@ var _default = exports["default"] = function _default() {
1513
1615
  });
1514
1616
  case 30:
1515
1617
  ;
1516
- _context6.next = 33;
1618
+ _context8.next = 33;
1517
1619
  return ar.dataitem({
1518
1620
  data: opt.data,
1519
1621
  signer: opt.signer,
@@ -1521,106 +1623,106 @@ var _default = exports["default"] = function _default() {
1521
1623
  target: opt.process
1522
1624
  });
1523
1625
  case 33:
1524
- _yield$ar$dataitem4 = _context6.sent;
1626
+ _yield$ar$dataitem4 = _context8.sent;
1525
1627
  item = _yield$ar$dataitem4.item;
1526
1628
  id = _yield$ar$dataitem4.id;
1527
1629
  owner = _yield$ar$dataitem4.owner;
1528
1630
  _msg = (0, _ramda.dissoc)("signer", opt);
1529
- _context6.next = 40;
1631
+ _context8.next = 40;
1530
1632
  return mem.set(_msg, "msgs", id);
1531
1633
  case 40:
1532
- _context6.next = 42;
1634
+ _context8.next = 42;
1533
1635
  return ar.postItems(item, su.jwk);
1534
1636
  case 42:
1535
1637
  case "end":
1536
- return _context6.stop();
1638
+ return _context8.stop();
1537
1639
  }
1538
- }, _callee6);
1640
+ }, _callee7);
1539
1641
  }));
1540
- return function record(_x10) {
1541
- return _ref13.apply(this, arguments);
1642
+ return function record(_x11) {
1643
+ return _ref15.apply(this, arguments);
1542
1644
  };
1543
1645
  }();
1544
1646
  var _recover = /*#__PURE__*/function () {
1545
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(pid, next) {
1647
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(pid, next) {
1546
1648
  var count, success, _success, i, p, from, msgs, _iterator7, _step7, v, item, _k2, _tags;
1547
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1548
- while (1) switch (_context7.prev = _context7.next) {
1649
+ return _regeneratorRuntime().wrap(function _callee8$(_context9) {
1650
+ while (1) switch (_context9.prev = _context9.next) {
1549
1651
  case 0:
1550
1652
  count = 0;
1551
1653
  success = false;
1552
1654
  if (!hb) {
1553
- _context7.next = 77;
1655
+ _context9.next = 77;
1554
1656
  break;
1555
1657
  }
1556
1658
  if (!onRecovery[pid]) {
1557
- _context7.next = 20;
1659
+ _context9.next = 20;
1558
1660
  break;
1559
1661
  }
1560
1662
  _success = false;
1561
1663
  i = 0;
1562
1664
  case 6:
1563
1665
  if (!true) {
1564
- _context7.next = 17;
1666
+ _context9.next = 17;
1565
1667
  break;
1566
1668
  }
1567
- _context7.next = 9;
1669
+ _context9.next = 9;
1568
1670
  return (0, _utils.wait)(1000);
1569
1671
  case 9:
1570
1672
  if (onRecovery[pid]) {
1571
- _context7.next = 12;
1673
+ _context9.next = 12;
1572
1674
  break;
1573
1675
  }
1574
1676
  _success = true;
1575
- return _context7.abrupt("break", 17);
1677
+ return _context9.abrupt("break", 17);
1576
1678
  case 12:
1577
1679
  if (!(i > 10)) {
1578
- _context7.next = 14;
1680
+ _context9.next = 14;
1579
1681
  break;
1580
1682
  }
1581
- return _context7.abrupt("break", 17);
1683
+ return _context9.abrupt("break", 17);
1582
1684
  case 14:
1583
1685
  i++;
1584
- _context7.next = 6;
1686
+ _context9.next = 6;
1585
1687
  break;
1586
1688
  case 17:
1587
- return _context7.abrupt("return", {
1689
+ return _context9.abrupt("return", {
1588
1690
  success: _success
1589
1691
  });
1590
1692
  case 20:
1591
1693
  onRecovery[pid] = true;
1592
- _context7.prev = 21;
1593
- _context7.next = 24;
1694
+ _context9.prev = 21;
1695
+ _context9.next = 24;
1594
1696
  return mem.get("env", pid);
1595
1697
  case 24:
1596
- p = _context7.sent;
1698
+ p = _context9.sent;
1597
1699
  from = p ? p.results.length : 0;
1598
1700
  if (!next) {
1599
- _context7.next = 32;
1701
+ _context9.next = 32;
1600
1702
  break;
1601
1703
  }
1602
- _context7.next = 29;
1704
+ _context9.next = 29;
1603
1705
  return next();
1604
1706
  case 29:
1605
- _context7.t0 = _context7.sent;
1606
- _context7.next = 35;
1707
+ _context9.t0 = _context9.sent;
1708
+ _context9.next = 35;
1607
1709
  break;
1608
1710
  case 32:
1609
- _context7.next = 34;
1711
+ _context9.next = 34;
1610
1712
  return hb.messages({
1611
1713
  target: pid,
1612
1714
  from: from
1613
1715
  });
1614
1716
  case 34:
1615
- _context7.t0 = _context7.sent;
1717
+ _context9.t0 = _context9.sent;
1616
1718
  case 35:
1617
- msgs = _context7.t0;
1719
+ msgs = _context9.t0;
1618
1720
  _iterator7 = _createForOfIteratorHelper(msgs.edges);
1619
- _context7.prev = 37;
1721
+ _context9.prev = 37;
1620
1722
  _iterator7.s();
1621
1723
  case 39:
1622
1724
  if ((_step7 = _iterator7.n()).done) {
1623
- _context7.next = 59;
1725
+ _context9.next = 59;
1624
1726
  break;
1625
1727
  }
1626
1728
  v = _step7.value;
@@ -1648,10 +1750,10 @@ var _default = exports["default"] = function _default() {
1648
1750
  item.target = pid;
1649
1751
  _tags = (0, _utils.tags)(item.tags);
1650
1752
  if (!(_tags.Type === "Process")) {
1651
- _context7.next = 54;
1753
+ _context9.next = 54;
1652
1754
  break;
1653
1755
  }
1654
- _context7.next = 52;
1756
+ _context9.next = 52;
1655
1757
  return spawn({
1656
1758
  id: v.node.message.Id,
1657
1759
  http_msg: item,
@@ -1661,10 +1763,10 @@ var _default = exports["default"] = function _default() {
1661
1763
  recovery: true
1662
1764
  });
1663
1765
  case 52:
1664
- _context7.next = 56;
1766
+ _context9.next = 56;
1665
1767
  break;
1666
1768
  case 54:
1667
- _context7.next = 56;
1769
+ _context9.next = 56;
1668
1770
  return message({
1669
1771
  id: v.node.message.Id,
1670
1772
  process: pid,
@@ -1675,134 +1777,134 @@ var _default = exports["default"] = function _default() {
1675
1777
  case 56:
1676
1778
  count++;
1677
1779
  case 57:
1678
- _context7.next = 39;
1780
+ _context9.next = 39;
1679
1781
  break;
1680
1782
  case 59:
1681
- _context7.next = 64;
1783
+ _context9.next = 64;
1682
1784
  break;
1683
1785
  case 61:
1684
- _context7.prev = 61;
1685
- _context7.t1 = _context7["catch"](37);
1686
- _iterator7.e(_context7.t1);
1786
+ _context9.prev = 61;
1787
+ _context9.t1 = _context9["catch"](37);
1788
+ _iterator7.e(_context9.t1);
1687
1789
  case 64:
1688
- _context7.prev = 64;
1790
+ _context9.prev = 64;
1689
1791
  _iterator7.f();
1690
- return _context7.finish(64);
1792
+ return _context9.finish(64);
1691
1793
  case 67:
1692
1794
  if (!msgs.next) {
1693
- _context7.next = 70;
1795
+ _context9.next = 70;
1694
1796
  break;
1695
1797
  }
1696
- _context7.next = 70;
1798
+ _context9.next = 70;
1697
1799
  return _recover(pid, msgs.next);
1698
1800
  case 70:
1699
- _context7.next = 75;
1801
+ _context9.next = 75;
1700
1802
  break;
1701
1803
  case 72:
1702
- _context7.prev = 72;
1703
- _context7.t2 = _context7["catch"](21);
1704
- console.log(_context7.t2);
1804
+ _context9.prev = 72;
1805
+ _context9.t2 = _context9["catch"](21);
1806
+ console.log(_context9.t2);
1705
1807
  case 75:
1706
1808
  delete onRecovery[pid];
1707
1809
  case 76:
1708
1810
  success = true;
1709
1811
  case 77:
1710
- return _context7.abrupt("return", {
1812
+ return _context9.abrupt("return", {
1711
1813
  recovered: count,
1712
1814
  pid: pid,
1713
1815
  success: success
1714
1816
  });
1715
1817
  case 78:
1716
1818
  case "end":
1717
- return _context7.stop();
1819
+ return _context9.stop();
1718
1820
  }
1719
- }, _callee7, null, [[21, 72], [37, 61, 64, 67]]);
1821
+ }, _callee8, null, [[21, 72], [37, 61, 64, 67]]);
1720
1822
  }));
1721
- return function recover(_x11, _x12) {
1722
- return _ref14.apply(this, arguments);
1823
+ return function recover(_x12, _x13) {
1824
+ return _ref16.apply(this, arguments);
1723
1825
  };
1724
1826
  }();
1725
1827
  var result = /*#__PURE__*/function () {
1726
- var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
1828
+ var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1727
1829
  var _yield$mem$get2;
1728
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1729
- while (1) switch (_context8.prev = _context8.next) {
1830
+ return _regeneratorRuntime().wrap(function _callee9$(_context10) {
1831
+ while (1) switch (_context10.prev = _context10.next) {
1730
1832
  case 0:
1731
- _context8.next = 2;
1833
+ _context10.next = 2;
1732
1834
  return mem.get("msgs", opt.message);
1733
1835
  case 2:
1734
- _context8.t1 = _yield$mem$get2 = _context8.sent;
1735
- _context8.t0 = _context8.t1 === null;
1736
- if (_context8.t0) {
1737
- _context8.next = 6;
1836
+ _context10.t1 = _yield$mem$get2 = _context10.sent;
1837
+ _context10.t0 = _context10.t1 === null;
1838
+ if (_context10.t0) {
1839
+ _context10.next = 6;
1738
1840
  break;
1739
1841
  }
1740
- _context8.t0 = _yield$mem$get2 === void 0;
1842
+ _context10.t0 = _yield$mem$get2 === void 0;
1741
1843
  case 6:
1742
- if (!_context8.t0) {
1743
- _context8.next = 10;
1844
+ if (!_context10.t0) {
1845
+ _context10.next = 10;
1744
1846
  break;
1745
1847
  }
1746
- _context8.t2 = void 0;
1747
- _context8.next = 11;
1848
+ _context10.t2 = void 0;
1849
+ _context10.next = 11;
1748
1850
  break;
1749
1851
  case 10:
1750
- _context8.t2 = _yield$mem$get2.res;
1852
+ _context10.t2 = _yield$mem$get2.res;
1751
1853
  case 11:
1752
- return _context8.abrupt("return", _context8.t2);
1854
+ return _context10.abrupt("return", _context10.t2);
1753
1855
  case 12:
1754
1856
  case "end":
1755
- return _context8.stop();
1857
+ return _context10.stop();
1756
1858
  }
1757
- }, _callee8);
1859
+ }, _callee9);
1758
1860
  }));
1759
- return function result(_x13) {
1760
- return _ref15.apply(this, arguments);
1861
+ return function result(_x14) {
1862
+ return _ref17.apply(this, arguments);
1761
1863
  };
1762
1864
  }();
1763
1865
  return {
1764
1866
  message: message,
1765
1867
  unmonitor: function () {
1766
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1868
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
1767
1869
  var p;
1768
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1769
- while (1) switch (_context9.prev = _context9.next) {
1870
+ return _regeneratorRuntime().wrap(function _callee10$(_context11) {
1871
+ while (1) switch (_context11.prev = _context11.next) {
1770
1872
  case 0:
1771
- _context9.next = 2;
1873
+ _context11.next = 2;
1772
1874
  return mem.get("env", opt.process);
1773
1875
  case 2:
1774
- p = _context9.sent;
1876
+ p = _context11.sent;
1775
1877
  try {
1776
1878
  clearInterval(p.cron);
1777
1879
  p.cron = null;
1778
1880
  } catch (e) {}
1779
1881
  case 4:
1780
1882
  case "end":
1781
- return _context9.stop();
1883
+ return _context11.stop();
1782
1884
  }
1783
- }, _callee9);
1885
+ }, _callee10);
1784
1886
  }));
1785
- function unmonitor(_x14) {
1887
+ function unmonitor(_x15) {
1786
1888
  return _unmonitor.apply(this, arguments);
1787
1889
  }
1788
1890
  return unmonitor;
1789
1891
  }(),
1790
1892
  monitor: function () {
1791
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
1893
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1792
1894
  var p;
1793
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1794
- while (1) switch (_context11.prev = _context11.next) {
1895
+ return _regeneratorRuntime().wrap(function _callee12$(_context13) {
1896
+ while (1) switch (_context13.prev = _context13.next) {
1795
1897
  case 0:
1796
- _context11.next = 2;
1898
+ _context13.next = 2;
1797
1899
  return mem.get("env", opt.process);
1798
1900
  case 2:
1799
- p = _context11.sent;
1901
+ p = _context13.sent;
1800
1902
  if ((0, _ramda.isNil)(p.cron)) {
1801
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1802
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1803
- while (1) switch (_context10.prev = _context10.next) {
1903
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1904
+ return _regeneratorRuntime().wrap(function _callee11$(_context12) {
1905
+ while (1) switch (_context12.prev = _context12.next) {
1804
1906
  case 0:
1805
- _context10.next = 2;
1907
+ _context12.next = 2;
1806
1908
  return message({
1807
1909
  tags: p.cronTags,
1808
1910
  process: opt.process,
@@ -1811,18 +1913,18 @@ var _default = exports["default"] = function _default() {
1811
1913
  });
1812
1914
  case 2:
1813
1915
  case "end":
1814
- return _context10.stop();
1916
+ return _context12.stop();
1815
1917
  }
1816
- }, _callee10);
1918
+ }, _callee11);
1817
1919
  })), p.span);
1818
1920
  }
1819
1921
  case 4:
1820
1922
  case "end":
1821
- return _context11.stop();
1923
+ return _context13.stop();
1822
1924
  }
1823
- }, _callee11);
1925
+ }, _callee12);
1824
1926
  }));
1825
- function monitor(_x15) {
1927
+ function monitor(_x16) {
1826
1928
  return _monitor.apply(this, arguments);
1827
1929
  }
1828
1930
  return monitor;
@@ -1832,135 +1934,135 @@ var _default = exports["default"] = function _default() {
1832
1934
  ar: ar,
1833
1935
  result: result,
1834
1936
  results: function () {
1835
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1836
- var p, results, _ref17, _ref17$from, from, _ref17$to, to, _ref17$sort, sort, _ref17$limit, limit, _res, count, started, _iterator8, _step8, v;
1837
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1838
- while (1) switch (_context12.prev = _context12.next) {
1937
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(opt) {
1938
+ var p, results, _ref19, _ref19$from, from, _ref19$to, to, _ref19$sort, sort, _ref19$limit, limit, _res, count, started, _iterator8, _step8, v;
1939
+ return _regeneratorRuntime().wrap(function _callee13$(_context14) {
1940
+ while (1) switch (_context14.prev = _context14.next) {
1839
1941
  case 0:
1840
- _context12.next = 2;
1942
+ _context14.next = 2;
1841
1943
  return mem.get("env", opt.process);
1842
1944
  case 2:
1843
- p = _context12.sent;
1945
+ p = _context14.sent;
1844
1946
  if (p) {
1845
- _context12.next = 5;
1947
+ _context14.next = 5;
1846
1948
  break;
1847
1949
  }
1848
- return _context12.abrupt("return", {
1950
+ return _context14.abrupt("return", {
1849
1951
  edges: []
1850
1952
  });
1851
1953
  case 5:
1852
1954
  results = (p === null || p === void 0 ? void 0 : p.results) || [];
1853
- _ref17 = opt || {}, _ref17$from = _ref17.from, from = _ref17$from === void 0 ? null : _ref17$from, _ref17$to = _ref17.to, to = _ref17$to === void 0 ? null : _ref17$to, _ref17$sort = _ref17.sort, sort = _ref17$sort === void 0 ? "ASC" : _ref17$sort, _ref17$limit = _ref17.limit, limit = _ref17$limit === void 0 ? 25 : _ref17$limit;
1955
+ _ref19 = opt || {}, _ref19$from = _ref19.from, from = _ref19$from === void 0 ? null : _ref19$from, _ref19$to = _ref19.to, to = _ref19$to === void 0 ? null : _ref19$to, _ref19$sort = _ref19.sort, sort = _ref19$sort === void 0 ? "ASC" : _ref19$sort, _ref19$limit = _ref19.limit, limit = _ref19$limit === void 0 ? 25 : _ref19$limit;
1854
1956
  if (sort === "DESC") results = (0, _ramda.reverse)(results);
1855
1957
  _res = [];
1856
1958
  count = 0;
1857
1959
  started = (0, _ramda.isNil)(from);
1858
1960
  _iterator8 = _createForOfIteratorHelper(results);
1859
- _context12.prev = 12;
1961
+ _context14.prev = 12;
1860
1962
  _iterator8.s();
1861
1963
  case 14:
1862
1964
  if ((_step8 = _iterator8.n()).done) {
1863
- _context12.next = 34;
1965
+ _context14.next = 34;
1864
1966
  break;
1865
1967
  }
1866
1968
  v = _step8.value;
1867
1969
  if (!started) {
1868
- _context12.next = 31;
1970
+ _context14.next = 31;
1869
1971
  break;
1870
1972
  }
1871
- _context12.t0 = _res;
1872
- _context12.t1 = v;
1873
- _context12.next = 21;
1973
+ _context14.t0 = _res;
1974
+ _context14.t1 = v;
1975
+ _context14.next = 21;
1874
1976
  return result({
1875
1977
  message: v
1876
1978
  });
1877
1979
  case 21:
1878
- _context12.t2 = _context12.sent;
1879
- _context12.t3 = {
1880
- cursor: _context12.t1,
1881
- node: _context12.t2
1980
+ _context14.t2 = _context14.sent;
1981
+ _context14.t3 = {
1982
+ cursor: _context14.t1,
1983
+ node: _context14.t2
1882
1984
  };
1883
- _context12.t0.push.call(_context12.t0, _context12.t3);
1985
+ _context14.t0.push.call(_context14.t0, _context14.t3);
1884
1986
  count++;
1885
1987
  if (!(!(0, _ramda.isNil)(to) && v === to)) {
1886
- _context12.next = 27;
1988
+ _context14.next = 27;
1887
1989
  break;
1888
1990
  }
1889
- return _context12.abrupt("break", 34);
1991
+ return _context14.abrupt("break", 34);
1890
1992
  case 27:
1891
1993
  if (!(limit <= count)) {
1892
- _context12.next = 29;
1994
+ _context14.next = 29;
1893
1995
  break;
1894
1996
  }
1895
- return _context12.abrupt("break", 34);
1997
+ return _context14.abrupt("break", 34);
1896
1998
  case 29:
1897
- _context12.next = 32;
1999
+ _context14.next = 32;
1898
2000
  break;
1899
2001
  case 31:
1900
2002
  if (from === v) started = true;
1901
2003
  case 32:
1902
- _context12.next = 14;
2004
+ _context14.next = 14;
1903
2005
  break;
1904
2006
  case 34:
1905
- _context12.next = 39;
2007
+ _context14.next = 39;
1906
2008
  break;
1907
2009
  case 36:
1908
- _context12.prev = 36;
1909
- _context12.t4 = _context12["catch"](12);
1910
- _iterator8.e(_context12.t4);
2010
+ _context14.prev = 36;
2011
+ _context14.t4 = _context14["catch"](12);
2012
+ _iterator8.e(_context14.t4);
1911
2013
  case 39:
1912
- _context12.prev = 39;
2014
+ _context14.prev = 39;
1913
2015
  _iterator8.f();
1914
- return _context12.finish(39);
2016
+ return _context14.finish(39);
1915
2017
  case 42:
1916
- return _context12.abrupt("return", {
2018
+ return _context14.abrupt("return", {
1917
2019
  edges: _res
1918
2020
  });
1919
2021
  case 43:
1920
2022
  case "end":
1921
- return _context12.stop();
2023
+ return _context14.stop();
1922
2024
  }
1923
- }, _callee12, null, [[12, 36, 39, 42]]);
2025
+ }, _callee13, null, [[12, 36, 39, 42]]);
1924
2026
  }));
1925
- function results(_x16) {
2027
+ function results(_x17) {
1926
2028
  return _results.apply(this, arguments);
1927
2029
  }
1928
2030
  return results;
1929
2031
  }(),
1930
2032
  dryrun: function () {
1931
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(opt) {
2033
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(opt) {
1932
2034
  var _opt$id3, _opt$owner3;
1933
2035
  var p, id, owner, _yield$ar$dataitem5, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm4, format, mod, wasm, wdrive, start, res;
1934
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1935
- while (1) switch (_context13.prev = _context13.next) {
2036
+ return _regeneratorRuntime().wrap(function _callee14$(_context15) {
2037
+ while (1) switch (_context15.prev = _context15.next) {
1936
2038
  case 0:
1937
- _context13.next = 2;
2039
+ _context15.next = 2;
1938
2040
  return mem.get("env", opt.process);
1939
2041
  case 2:
1940
- p = _context13.sent;
2042
+ p = _context15.sent;
1941
2043
  if (p) {
1942
- _context13.next = 5;
2044
+ _context15.next = 5;
1943
2045
  break;
1944
2046
  }
1945
- return _context13.abrupt("return", null);
2047
+ return _context15.abrupt("return", null);
1946
2048
  case 5:
1947
2049
  id = (_opt$id3 = opt.id) !== null && _opt$id3 !== void 0 ? _opt$id3 : "";
1948
2050
  owner = (_opt$owner3 = opt.owner) !== null && _opt$owner3 !== void 0 ? _opt$owner3 : mu.addr;
1949
2051
  if (!(!opt.id && opt.signer)) {
1950
- _context13.next = 14;
2052
+ _context15.next = 14;
1951
2053
  break;
1952
2054
  }
1953
2055
  ;
1954
- _context13.next = 11;
2056
+ _context15.next = 11;
1955
2057
  return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
1956
2058
  target: opt.process
1957
2059
  }));
1958
2060
  case 11:
1959
- _yield$ar$dataitem5 = _context13.sent;
2061
+ _yield$ar$dataitem5 = _context15.sent;
1960
2062
  id = _yield$ar$dataitem5.id;
1961
2063
  owner = _yield$ar$dataitem5.owner;
1962
2064
  case 14:
1963
- _context13.prev = 14;
2065
+ _context15.prev = 14;
1964
2066
  cloneMemory = function cloneMemory(memory) {
1965
2067
  var buffer = memory.buffer.slice(0);
1966
2068
  return new WebAssembly.Memory({
@@ -1969,52 +2071,52 @@ var _default = exports["default"] = function _default() {
1969
2071
  shared: memory.shared || false
1970
2072
  });
1971
2073
  };
1972
- _context13.next = 18;
2074
+ _context15.next = 18;
1973
2075
  return genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, owner, true);
1974
2076
  case 18:
1975
- msg = _context13.sent;
1976
- _context13.next = 21;
2077
+ msg = _context15.sent;
2078
+ _context15.next = 21;
1977
2079
  return genEnv({
1978
2080
  pid: p.id,
1979
2081
  owner: p.owner,
1980
2082
  module: p.module
1981
2083
  });
1982
2084
  case 21:
1983
- _env = _context13.sent;
2085
+ _env = _context15.sent;
1984
2086
  if (p.handle) {
1985
- _context13.next = 45;
2087
+ _context15.next = 45;
1986
2088
  break;
1987
2089
  }
1988
- _context13.next = 25;
2090
+ _context15.next = 25;
1989
2091
  return mem.getWasm(p.module);
1990
2092
  case 25:
1991
- _yield$mem$getWasm4 = _context13.sent;
2093
+ _yield$mem$getWasm4 = _context15.sent;
1992
2094
  format = _yield$mem$getWasm4.format;
1993
2095
  mod = _yield$mem$getWasm4.mod;
1994
2096
  wasm = _yield$mem$getWasm4.wasm;
1995
2097
  wdrive = extensions[p.extention];
1996
- _context13.t0 = AoLoader;
1997
- _context13.t1 = wasm;
1998
- _context13.t2 = format;
1999
- _context13.t3 = wdrive;
2000
- _context13.next = 36;
2098
+ _context15.t0 = AoLoader;
2099
+ _context15.t1 = wasm;
2100
+ _context15.t2 = format;
2101
+ _context15.t3 = wdrive;
2102
+ _context15.next = 36;
2001
2103
  return mem.getTx(p.id);
2002
2104
  case 36:
2003
- _context13.t4 = _context13.sent.item;
2004
- _context13.next = 39;
2105
+ _context15.t4 = _context15.sent.item;
2106
+ _context15.next = 39;
2005
2107
  return mem.getTx(mod);
2006
2108
  case 39:
2007
- _context13.t5 = _context13.sent;
2008
- _context13.t6 = {
2009
- format: _context13.t2,
2010
- WeaveDrive: _context13.t3,
2011
- spawn: _context13.t4,
2012
- module: _context13.t5
2109
+ _context15.t5 = _context15.sent;
2110
+ _context15.t6 = {
2111
+ format: _context15.t2,
2112
+ WeaveDrive: _context15.t3,
2113
+ spawn: _context15.t4,
2114
+ module: _context15.t5
2013
2115
  };
2014
- _context13.next = 43;
2015
- return (0, _context13.t0)(_context13.t1, _context13.t6);
2116
+ _context15.next = 43;
2117
+ return (0, _context15.t0)(_context15.t1, _context15.t6);
2016
2118
  case 43:
2017
- p.handle = _context13.sent;
2119
+ p.handle = _context15.sent;
2018
2120
  mem.env[opt.process].handle = p.handle;
2019
2121
  case 45:
2020
2122
  if (p.compressed) {
@@ -2022,25 +2124,25 @@ var _default = exports["default"] = function _default() {
2022
2124
  p.memory = mem.decompress(p.memory, p.original_size);
2023
2125
  p.compressed = false;
2024
2126
  }
2025
- _context13.next = 48;
2127
+ _context15.next = 48;
2026
2128
  return p.handle(p.memory, msg, _env);
2027
2129
  case 48:
2028
- res = _context13.sent;
2130
+ res = _context15.sent;
2029
2131
  delete res.Memory;
2030
- return _context13.abrupt("return", res);
2132
+ return _context15.abrupt("return", res);
2031
2133
  case 53:
2032
- _context13.prev = 53;
2033
- _context13.t7 = _context13["catch"](14);
2034
- console.log(_context13.t7);
2134
+ _context15.prev = 53;
2135
+ _context15.t7 = _context15["catch"](14);
2136
+ console.log(_context15.t7);
2035
2137
  case 56:
2036
- return _context13.abrupt("return", null);
2138
+ return _context15.abrupt("return", null);
2037
2139
  case 57:
2038
2140
  case "end":
2039
- return _context13.stop();
2141
+ return _context15.stop();
2040
2142
  }
2041
- }, _callee13, null, [[14, 53]]);
2143
+ }, _callee14, null, [[14, 53]]);
2042
2144
  }));
2043
- function dryrun(_x17) {
2145
+ function dryrun(_x18) {
2044
2146
  return _dryrun.apply(this, arguments);
2045
2147
  }
2046
2148
  return dryrun;