wao 0.14.1 → 0.14.2

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.
@@ -639,7 +639,7 @@ var _default = exports["default"] = function _default() {
639
639
  var _assign = /*#__PURE__*/function () {
640
640
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
641
641
  var _opt$tags2;
642
- var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
642
+ var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref10, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
643
643
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
644
644
  while (1) switch (_context4.prev = _context4.next) {
645
645
  case 0:
@@ -756,7 +756,7 @@ var _default = exports["default"] = function _default() {
756
756
  case 64:
757
757
  _env = _context4.sent;
758
758
  if (p.handle) {
759
- _context4.next = 88;
759
+ _context4.next = 97;
760
760
  break;
761
761
  }
762
762
  _context4.next = 68;
@@ -774,56 +774,74 @@ var _default = exports["default"] = function _default() {
774
774
  _context4.next = 79;
775
775
  return mem.getTx(p.id);
776
776
  case 79:
777
- _context4.t18 = _context4.sent.item;
778
- _context4.next = 82;
777
+ _context4.t19 = _yield$mem$getTx3 = _context4.sent;
778
+ _context4.t18 = _context4.t19 === null;
779
+ if (_context4.t18) {
780
+ _context4.next = 83;
781
+ break;
782
+ }
783
+ _context4.t18 = _yield$mem$getTx3 === void 0;
784
+ case 83:
785
+ if (!_context4.t18) {
786
+ _context4.next = 87;
787
+ break;
788
+ }
789
+ _context4.t20 = void 0;
790
+ _context4.next = 88;
791
+ break;
792
+ case 87:
793
+ _context4.t20 = _yield$mem$getTx3.item;
794
+ case 88:
795
+ _context4.t21 = _context4.t20;
796
+ _context4.next = 91;
779
797
  return mem.getTx(mod);
780
- case 82:
781
- _context4.t19 = _context4.sent;
782
- _context4.t20 = {
798
+ case 91:
799
+ _context4.t22 = _context4.sent;
800
+ _context4.t23 = {
783
801
  format: _context4.t16,
784
802
  WeaveDrive: _context4.t17,
785
- spawn: _context4.t18,
786
- module: _context4.t19
803
+ spawn: _context4.t21,
804
+ module: _context4.t22
787
805
  };
788
- _context4.next = 86;
789
- return (0, _context4.t14)(_context4.t15, _context4.t20);
790
- case 86:
806
+ _context4.next = 95;
807
+ return (0, _context4.t14)(_context4.t15, _context4.t23);
808
+ case 95:
791
809
  p.handle = _context4.sent;
792
810
  mem.env[opt.process].handle = p.handle;
793
- case 88:
794
- _context4.next = 90;
811
+ case 97:
812
+ _context4.next = 99;
795
813
  return p.handle(p.memory, msg, _env);
796
- case 90:
814
+ case 99:
797
815
  res = _context4.sent;
798
816
  p.memory = res.Memory;
799
817
  delete res.Memory;
800
818
  p.results.push(opt.message);
801
- _context4.next = 96;
819
+ _context4.next = 105;
802
820
  return mem.set(p, "env", opt.process);
803
- case 96:
821
+ case 105:
804
822
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
805
823
  res: res
806
824
  });
807
- _context4.next = 99;
825
+ _context4.next = 108;
808
826
  return mem.set(_msg, "msgs", opt.message);
809
- case 99:
827
+ case 108:
810
828
  _iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
811
- _context4.prev = 100;
829
+ _context4.prev = 109;
812
830
  _iterator3.s();
813
- case 102:
831
+ case 111:
814
832
  if ((_step3 = _iterator3.n()).done) {
815
- _context4.next = 111;
833
+ _context4.next = 120;
816
834
  break;
817
835
  }
818
836
  v = _step3.value;
819
- _context4.next = 106;
837
+ _context4.next = 115;
820
838
  return mem.get("env", v.Target);
821
- case 106:
839
+ case 115:
822
840
  if (!_context4.sent) {
823
- _context4.next = 109;
841
+ _context4.next = 118;
824
842
  break;
825
843
  }
826
- _context4.next = 109;
844
+ _context4.next = 118;
827
845
  return message({
828
846
  "for": opt.message,
829
847
  process: v.Target,
@@ -832,32 +850,32 @@ var _default = exports["default"] = function _default() {
832
850
  signer: mu.signer,
833
851
  from: opt.process
834
852
  });
835
- case 109:
836
- _context4.next = 102;
853
+ case 118:
854
+ _context4.next = 111;
837
855
  break;
838
- case 111:
839
- _context4.next = 116;
856
+ case 120:
857
+ _context4.next = 125;
840
858
  break;
841
- case 113:
842
- _context4.prev = 113;
843
- _context4.t21 = _context4["catch"](100);
844
- _iterator3.e(_context4.t21);
845
- case 116:
846
- _context4.prev = 116;
859
+ case 122:
860
+ _context4.prev = 122;
861
+ _context4.t24 = _context4["catch"](109);
862
+ _iterator3.e(_context4.t24);
863
+ case 125:
864
+ _context4.prev = 125;
847
865
  _iterator3.f();
848
- return _context4.finish(116);
849
- case 119:
866
+ return _context4.finish(125);
867
+ case 128:
850
868
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
851
- _context4.prev = 120;
869
+ _context4.prev = 129;
852
870
  _iterator4.s();
853
- case 122:
871
+ case 131:
854
872
  if ((_step4 = _iterator4.n()).done) {
855
- _context4.next = 129;
873
+ _context4.next = 138;
856
874
  break;
857
875
  }
858
876
  _v = _step4.value;
859
877
  __tags = (0, _utils.tags)(_v.Tags);
860
- _context4.next = 127;
878
+ _context4.next = 136;
861
879
  return spawn({
862
880
  "for": opt.message,
863
881
  module: __tags.Module,
@@ -867,87 +885,87 @@ var _default = exports["default"] = function _default() {
867
885
  from: __tags["From-Process"],
868
886
  signer: mu.signer
869
887
  });
870
- case 127:
871
- _context4.next = 122;
888
+ case 136:
889
+ _context4.next = 131;
872
890
  break;
873
- case 129:
874
- _context4.next = 134;
891
+ case 138:
892
+ _context4.next = 143;
875
893
  break;
876
- case 131:
877
- _context4.prev = 131;
878
- _context4.t22 = _context4["catch"](120);
879
- _iterator4.e(_context4.t22);
880
- case 134:
881
- _context4.prev = 134;
894
+ case 140:
895
+ _context4.prev = 140;
896
+ _context4.t25 = _context4["catch"](129);
897
+ _iterator4.e(_context4.t25);
898
+ case 143:
899
+ _context4.prev = 143;
882
900
  _iterator4.f();
883
- return _context4.finish(134);
884
- case 137:
901
+ return _context4.finish(143);
902
+ case 146:
885
903
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
886
- _context4.prev = 138;
904
+ _context4.prev = 147;
887
905
  _iterator5.s();
888
- case 140:
906
+ case 149:
889
907
  if ((_step5 = _iterator5.n()).done) {
890
- _context4.next = 161;
908
+ _context4.next = 170;
891
909
  break;
892
910
  }
893
911
  _v2 = _step5.value;
894
912
  _iterator6 = _createForOfIteratorHelper(_v2.Processes);
895
- _context4.prev = 143;
913
+ _context4.prev = 152;
896
914
  _iterator6.s();
897
- case 145:
915
+ case 154:
898
916
  if ((_step6 = _iterator6.n()).done) {
899
- _context4.next = 151;
917
+ _context4.next = 160;
900
918
  break;
901
919
  }
902
920
  v2 = _step6.value;
903
- _context4.next = 149;
921
+ _context4.next = 158;
904
922
  return _assign({
905
923
  message: _v2.Message,
906
924
  process: v2,
907
925
  from: opt.process,
908
926
  signer: mu.signer
909
927
  });
910
- case 149:
911
- _context4.next = 145;
928
+ case 158:
929
+ _context4.next = 154;
912
930
  break;
913
- case 151:
914
- _context4.next = 156;
931
+ case 160:
932
+ _context4.next = 165;
915
933
  break;
916
- case 153:
917
- _context4.prev = 153;
918
- _context4.t23 = _context4["catch"](143);
919
- _iterator6.e(_context4.t23);
920
- case 156:
921
- _context4.prev = 156;
934
+ case 162:
935
+ _context4.prev = 162;
936
+ _context4.t26 = _context4["catch"](152);
937
+ _iterator6.e(_context4.t26);
938
+ case 165:
939
+ _context4.prev = 165;
922
940
  _iterator6.f();
923
- return _context4.finish(156);
924
- case 159:
925
- _context4.next = 140;
941
+ return _context4.finish(165);
942
+ case 168:
943
+ _context4.next = 149;
926
944
  break;
927
- case 161:
928
- _context4.next = 166;
945
+ case 170:
946
+ _context4.next = 175;
929
947
  break;
930
- case 163:
931
- _context4.prev = 163;
932
- _context4.t24 = _context4["catch"](138);
933
- _iterator5.e(_context4.t24);
934
- case 166:
935
- _context4.prev = 166;
936
- _iterator5.f();
937
- return _context4.finish(166);
938
- case 169:
939
- return _context4.abrupt("return", id);
940
948
  case 172:
941
949
  _context4.prev = 172;
942
- _context4.t25 = _context4["catch"](38);
943
- console.log(_context4.t25);
950
+ _context4.t27 = _context4["catch"](147);
951
+ _iterator5.e(_context4.t27);
944
952
  case 175:
953
+ _context4.prev = 175;
954
+ _iterator5.f();
955
+ return _context4.finish(175);
956
+ case 178:
957
+ return _context4.abrupt("return", id);
958
+ case 181:
959
+ _context4.prev = 181;
960
+ _context4.t28 = _context4["catch"](38);
961
+ console.log(_context4.t28);
962
+ case 184:
945
963
  return _context4.abrupt("return", null);
946
- case 176:
964
+ case 185:
947
965
  case "end":
948
966
  return _context4.stop();
949
967
  }
950
- }, _callee4, null, [[38, 172], [43, 56], [100, 113, 116, 119], [120, 131, 134, 137], [138, 163, 166, 169], [143, 153, 156, 159]]);
968
+ }, _callee4, null, [[38, 181], [43, 56], [109, 122, 125, 128], [129, 140, 143, 146], [147, 172, 175, 178], [152, 162, 165, 168]]);
951
969
  }));
952
970
  return function assign(_x8) {
953
971
  return _ref9.apply(this, arguments);
@@ -955,7 +973,7 @@ var _default = exports["default"] = function _default() {
955
973
  }();
956
974
  var message = /*#__PURE__*/function () {
957
975
  var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
958
- var id, owner, item, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner, _id, _owner, _item, p, _opt$tags3, _yield$mem$getTx$tags3, _yield$mem$getTx3, pr, module, _yield$ar$dataitem3, _msg, _opt, _ref12, _opt$from2, _opt$http_msg$data, from, data, _tags, msg, _env, _yield$mem$getWasm3, format, mod, wasm, wdrive, res, _msg2;
976
+ var id, owner, item, _yield$ar$httpmsg2, _p, new_slot, last_slot, _opt$item$id, _opt$item, _opt$owner, _id, _owner, _item, p, _opt$tags3, _yield$mem$getTx$tags3, _yield$mem$getTx4, pr, module, _yield$ar$dataitem3, _msg, _opt, _ref12, _opt$from2, _opt$http_msg$data, from, data, _tags, msg, _env, _yield$mem$getTx5, _yield$mem$getWasm3, format, mod, wasm, wdrive, res, _msg2;
959
977
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
960
978
  while (1) switch (_context5.prev = _context5.next) {
961
979
  case 0:
@@ -979,7 +997,7 @@ var _default = exports["default"] = function _default() {
979
997
  _p = _context5.sent;
980
998
  new_slot = opt.slot * 1;
981
999
  last_slot = !_p ? -1 : _p.results.length - 1;
982
- if (!(last_slot + 1 !== new_slot)) {
1000
+ if (!(last_slot + 1 < new_slot)) {
983
1001
  _context5.next = 20;
984
1002
  break;
985
1003
  }
@@ -1034,13 +1052,13 @@ var _default = exports["default"] = function _default() {
1034
1052
  _context5.next = 37;
1035
1053
  return mem.getTx(opt.from);
1036
1054
  case 37:
1037
- _context5.t2 = _yield$mem$getTx3 = _context5.sent;
1055
+ _context5.t2 = _yield$mem$getTx4 = _context5.sent;
1038
1056
  _context5.t1 = _context5.t2 === null;
1039
1057
  if (_context5.t1) {
1040
1058
  _context5.next = 41;
1041
1059
  break;
1042
1060
  }
1043
- _context5.t1 = _yield$mem$getTx3 === void 0;
1061
+ _context5.t1 = _yield$mem$getTx4 === void 0;
1044
1062
  case 41:
1045
1063
  if (!_context5.t1) {
1046
1064
  _context5.next = 45;
@@ -1050,7 +1068,7 @@ var _default = exports["default"] = function _default() {
1050
1068
  _context5.next = 46;
1051
1069
  break;
1052
1070
  case 45:
1053
- _context5.t3 = _yield$mem$getTx3.tags;
1071
+ _context5.t3 = _yield$mem$getTx4.tags;
1054
1072
  case 46:
1055
1073
  _context5.t4 = _yield$mem$getTx$tags3 = _context5.t3;
1056
1074
  _context5.t0 = _context5.t4 !== null;
@@ -1096,7 +1114,7 @@ var _default = exports["default"] = function _default() {
1096
1114
  return mem.set(_msg, "msgs", id);
1097
1115
  case 68:
1098
1116
  if (!ar.isHttpMsg(opt.http_msg)) {
1099
- _context5.next = 123;
1117
+ _context5.next = 132;
1100
1118
  break;
1101
1119
  }
1102
1120
  p.epochs.push([id]);
@@ -1119,7 +1137,7 @@ var _default = exports["default"] = function _default() {
1119
1137
  case 80:
1120
1138
  _env = _context5.sent;
1121
1139
  if (p.handle) {
1122
- _context5.next = 104;
1140
+ _context5.next = 113;
1123
1141
  break;
1124
1142
  }
1125
1143
  _context5.next = 84;
@@ -1137,49 +1155,67 @@ var _default = exports["default"] = function _default() {
1137
1155
  _context5.next = 95;
1138
1156
  return mem.getTx(p.id);
1139
1157
  case 95:
1140
- _context5.t10 = _context5.sent.item;
1141
- _context5.next = 98;
1158
+ _context5.t11 = _yield$mem$getTx5 = _context5.sent;
1159
+ _context5.t10 = _context5.t11 === null;
1160
+ if (_context5.t10) {
1161
+ _context5.next = 99;
1162
+ break;
1163
+ }
1164
+ _context5.t10 = _yield$mem$getTx5 === void 0;
1165
+ case 99:
1166
+ if (!_context5.t10) {
1167
+ _context5.next = 103;
1168
+ break;
1169
+ }
1170
+ _context5.t12 = void 0;
1171
+ _context5.next = 104;
1172
+ break;
1173
+ case 103:
1174
+ _context5.t12 = _yield$mem$getTx5.item;
1175
+ case 104:
1176
+ _context5.t13 = _context5.t12;
1177
+ _context5.next = 107;
1142
1178
  return mem.getTx(mod);
1143
- case 98:
1144
- _context5.t11 = _context5.sent;
1145
- _context5.t12 = {
1179
+ case 107:
1180
+ _context5.t14 = _context5.sent;
1181
+ _context5.t15 = {
1146
1182
  format: _context5.t8,
1147
1183
  WeaveDrive: _context5.t9,
1148
- spawn: _context5.t10,
1149
- module: _context5.t11
1184
+ spawn: _context5.t13,
1185
+ module: _context5.t14
1150
1186
  };
1151
- _context5.next = 102;
1152
- return (0, _context5.t6)(_context5.t7, _context5.t12);
1153
- case 102:
1187
+ _context5.next = 111;
1188
+ return (0, _context5.t6)(_context5.t7, _context5.t15);
1189
+ case 111:
1154
1190
  p.handle = _context5.sent;
1155
1191
  mem.env[opt.process].handle = p.handle;
1156
- case 104:
1157
- _context5.next = 106;
1192
+ case 113:
1193
+ _context5.next = 115;
1158
1194
  return p.handle(p.memory, msg, _env);
1159
- case 106:
1195
+ case 115:
1160
1196
  res = _context5.sent;
1161
1197
  p.memory = res.Memory;
1162
1198
  delete res.Memory;
1163
1199
  p.results.push(id);
1164
- _context5.next = 112;
1200
+ _context5.next = 121;
1165
1201
  return mem.set(p, "env", opt.process);
1166
- case 112:
1202
+ case 121:
1167
1203
  _msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
1168
1204
  res: res
1169
1205
  });
1170
- _context5.next = 115;
1206
+ _context5.next = 124;
1171
1207
  return mem.set(_msg2, "msgs", id);
1172
- case 115:
1208
+ case 124:
1173
1209
  return _context5.abrupt("return", id);
1174
- case 118:
1175
- _context5.prev = 118;
1176
- _context5.t13 = _context5["catch"](71);
1177
- console.log(_context5.t13);
1178
- case 121:
1179
- _context5.next = 125;
1210
+ case 127:
1211
+ _context5.prev = 127;
1212
+ _context5.t16 = _context5["catch"](71);
1213
+ console.log(_context5.t16);
1214
+ case 130:
1215
+ _context5.next = 134;
1180
1216
  break;
1181
- case 123:
1182
- _context5.next = 125;
1217
+ case 132:
1218
+ _context5.next = 134;
1183
1219
  return _assign({
1184
1220
  message_item: item,
1185
1221
  message: id,
@@ -1187,13 +1223,13 @@ var _default = exports["default"] = function _default() {
1187
1223
  from: owner,
1188
1224
  signer: mu.signer
1189
1225
  });
1190
- case 125:
1226
+ case 134:
1191
1227
  return _context5.abrupt("return", id);
1192
- case 126:
1228
+ case 135:
1193
1229
  case "end":
1194
1230
  return _context5.stop();
1195
1231
  }
1196
- }, _callee5, null, [[71, 118]]);
1232
+ }, _callee5, null, [[71, 127]]);
1197
1233
  }));
1198
1234
  return function message(_x9) {
1199
1235
  return _ref11.apply(this, arguments);
@@ -318,7 +318,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
318
318
  p.handle = await AoLoader(wasm, {
319
319
  format,
320
320
  WeaveDrive: wdrive,
321
- spawn: (await mem.getTx(p.id)).item,
321
+ spawn: (await mem.getTx(p.id))?.item,
322
322
  module: await mem.getTx(mod),
323
323
  })
324
324
  mem.env[opt.process].handle = p.handle
@@ -382,7 +382,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
382
382
  const p = await mem.get("env", opt.process)
383
383
  const new_slot = opt.slot * 1
384
384
  const last_slot = !p ? -1 : p.results.length - 1
385
- if (last_slot + 1 !== new_slot) {
385
+ if (last_slot + 1 < new_slot) {
386
386
  if (!hb || opt.recovery) return null
387
387
  await recover(opt.process)
388
388
  }
@@ -394,7 +394,6 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
394
394
 
395
395
  const p = await mem.get("env", opt.process)
396
396
  if (!p) return null
397
-
398
397
  if (!opt.item && opt.signer) {
399
398
  opt.tags = buildTags(
400
399
  null,
@@ -442,7 +441,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
442
441
  p.handle = await AoLoader(wasm, {
443
442
  format,
444
443
  WeaveDrive: wdrive,
445
- spawn: (await mem.getTx(p.id)).item,
444
+ spawn: (await mem.getTx(p.id))?.item,
446
445
  module: await mem.getTx(mod),
447
446
  })
448
447
  mem.env[opt.process].handle = p.handle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"