wao 0.14.2 → 0.14.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.
@@ -33,6 +33,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
33
33
  var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
34
34
  var DataItem = pkg.DataItem;
35
35
  var onRecovery = {};
36
+ var ongoing = {};
36
37
  var _default = exports["default"] = function _default() {
37
38
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
38
39
  AR = _ref.AR,
@@ -298,6 +299,7 @@ var _default = exports["default"] = function _default() {
298
299
  item,
299
300
  __tags,
300
301
  msg_owner,
302
+ _opt$id,
301
303
  _yield$ar$httpmsg,
302
304
  _opt$tags,
303
305
  ex,
@@ -355,13 +357,31 @@ var _default = exports["default"] = function _default() {
355
357
  format = _yield$mem$getWasm.format;
356
358
  msg_owner = mu.addr;
357
359
  if (!ar.isHttpMsg(opt.http_msg)) {
358
- _context3.next = 25;
360
+ _context3.next = 35;
359
361
  break;
360
362
  }
361
- id = opt.http_msg.target;
362
- _context3.next = 16;
363
+ id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : opt.http_msg.target;
364
+ if (!ongoing[id]) {
365
+ _context3.next = 23;
366
+ break;
367
+ }
368
+ case 15:
369
+ if (!ongoing[id]) {
370
+ _context3.next = 20;
371
+ break;
372
+ }
373
+ _context3.next = 18;
374
+ return (0, _utils.wait)(100);
375
+ case 18:
376
+ _context3.next = 15;
377
+ break;
378
+ case 20:
379
+ return _context3.abrupt("return", id);
380
+ case 23:
381
+ ongoing[id] = true;
382
+ _context3.next = 26;
363
383
  return ar.httpmsg(opt.http_msg, id);
364
- case 16:
384
+ case 26:
365
385
  _yield$ar$httpmsg = _context3.sent;
366
386
  owner = _yield$ar$httpmsg.owner;
367
387
  item = _yield$ar$httpmsg.item;
@@ -369,9 +389,10 @@ var _default = exports["default"] = function _default() {
369
389
  opt.tags = (0, _utils.buildTags)(null, __tags);
370
390
  opt.data = opt.http_msg.data;
371
391
  msg_owner = owner;
372
- _context3.next = 42;
392
+ case 33:
393
+ _context3.next = 52;
373
394
  break;
374
- case 25:
395
+ case 35:
375
396
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
376
397
  "Data-Protocol": "ao",
377
398
  Variant: "ao.TN.1",
@@ -402,14 +423,14 @@ var _default = exports["default"] = function _default() {
402
423
  name: "Pushed-For",
403
424
  value: opt["for"]
404
425
  });
405
- _context3.next = 33;
426
+ _context3.next = 43;
406
427
  return ar.dataitem({
407
428
  item: opt.item,
408
429
  data: opt.data,
409
430
  signer: opt.signer,
410
431
  tags: (0, _utils.tags)(opt.tags)
411
432
  });
412
- case 33:
433
+ case 43:
413
434
  _yield$ar$dataitem = _context3.sent;
414
435
  id = _yield$ar$dataitem.id;
415
436
  owner = _yield$ar$dataitem.owner;
@@ -417,23 +438,23 @@ var _default = exports["default"] = function _default() {
417
438
  __tags = _yield$ar$dataitem.tags;
418
439
  opt.tags = (0, _utils.buildTags)(null, __tags);
419
440
  if (opt.item) opt.data = _base64url["default"].decode(item.data);
420
- _context3.next = 42;
441
+ _context3.next = 52;
421
442
  return ar.postItems(item, su.jwk);
422
- case 42:
443
+ case 52:
423
444
  now = Date.now;
424
445
  t = (0, _utils.tags)(opt.tags);
425
446
  ext = t.Extension || "WeaveDrive";
426
447
  wdrive = extensions[ext];
427
448
  handle = null;
428
- _context3.prev = 47;
449
+ _context3.prev = 57;
429
450
  _context3.t0 = AoLoader;
430
451
  _context3.t1 = wasm;
431
452
  _context3.t2 = format;
432
453
  _context3.t3 = wdrive;
433
454
  _context3.t4 = item;
434
- _context3.next = 55;
455
+ _context3.next = 65;
435
456
  return mem.getTx(mod);
436
- case 55:
457
+ case 65:
437
458
  _context3.t5 = _context3.sent;
438
459
  _context3.t6 = {
439
460
  format: _context3.t2,
@@ -441,23 +462,23 @@ var _default = exports["default"] = function _default() {
441
462
  spawn: _context3.t4,
442
463
  module: _context3.t5
443
464
  };
444
- _context3.next = 59;
465
+ _context3.next = 69;
445
466
  return (0, _context3.t0)(_context3.t1, _context3.t6);
446
- case 59:
467
+ case 69:
447
468
  handle = _context3.sent;
448
- _context3.next = 65;
469
+ _context3.next = 75;
449
470
  break;
450
- case 62:
451
- _context3.prev = 62;
452
- _context3.t7 = _context3["catch"](47);
471
+ case 72:
472
+ _context3.prev = 72;
473
+ _context3.t7 = _context3["catch"](57);
453
474
  console.log(mod, _context3.t7);
454
- case 65:
475
+ case 75:
455
476
  if (handle) {
456
- _context3.next = 67;
477
+ _context3.next = 77;
457
478
  break;
458
479
  }
459
480
  return _context3.abrupt("return", null);
460
- case 67:
481
+ case 77:
461
482
  _module = null;
462
483
  _module = {
463
484
  handle: handle,
@@ -481,126 +502,126 @@ var _default = exports["default"] = function _default() {
481
502
  results: [id]
482
503
  };
483
504
  if (!memory) {
484
- _context3.next = 77;
505
+ _context3.next = 87;
485
506
  break;
486
507
  }
487
- _context3.next = 118;
508
+ _context3.next = 128;
488
509
  break;
489
- case 77:
510
+ case 87:
490
511
  if (!(_tags["On-Boot"] || true)) {
491
- _context3.next = 117;
512
+ _context3.next = 127;
492
513
  break;
493
514
  }
494
515
  data = "";
495
516
  if (!(_tags["On-Boot"] === "Data")) {
496
- _context3.next = 83;
517
+ _context3.next = 93;
497
518
  break;
498
519
  }
499
520
  data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
500
- _context3.next = 104;
521
+ _context3.next = 114;
501
522
  break;
502
- case 83:
503
- _context3.next = 85;
523
+ case 93:
524
+ _context3.next = 95;
504
525
  return mem.get("msgs", _tags["On-Boot"]);
505
- case 85:
526
+ case 95:
506
527
  _context3.t10 = _yield$mem$get = _context3.sent;
507
528
  _context3.t9 = _context3.t10 === null;
508
529
  if (_context3.t9) {
509
- _context3.next = 89;
530
+ _context3.next = 99;
510
531
  break;
511
532
  }
512
533
  _context3.t9 = _yield$mem$get === void 0;
513
- case 89:
534
+ case 99:
514
535
  if (!_context3.t9) {
515
- _context3.next = 93;
536
+ _context3.next = 103;
516
537
  break;
517
538
  }
518
539
  _context3.t11 = void 0;
519
- _context3.next = 94;
540
+ _context3.next = 104;
520
541
  break;
521
- case 93:
542
+ case 103:
522
543
  _context3.t11 = _yield$mem$get.data;
523
- case 94:
544
+ case 104:
524
545
  _context3.t12 = _yield$mem$get$data = _context3.t11;
525
546
  _context3.t8 = _context3.t12 !== null;
526
547
  if (!_context3.t8) {
527
- _context3.next = 98;
548
+ _context3.next = 108;
528
549
  break;
529
550
  }
530
551
  _context3.t8 = _yield$mem$get$data !== void 0;
531
- case 98:
552
+ case 108:
532
553
  if (!_context3.t8) {
533
- _context3.next = 102;
554
+ _context3.next = 112;
534
555
  break;
535
556
  }
536
557
  _context3.t13 = _yield$mem$get$data;
537
- _context3.next = 103;
558
+ _context3.next = 113;
538
559
  break;
539
- case 102:
560
+ case 112:
540
561
  _context3.t13 = "";
541
- case 103:
562
+ case 113:
542
563
  data = _context3.t13;
543
- case 104:
544
- _context3.next = 106;
564
+ case 114:
565
+ _context3.next = 116;
545
566
  return genMsg(id, p, data, opt.tags, owner, msg_owner, true);
546
- case 106:
567
+ case 116:
547
568
  msg = _context3.sent;
548
- _context3.next = 109;
569
+ _context3.next = 119;
549
570
  return genEnv({
550
571
  pid: p.id,
551
572
  owner: p.owner,
552
573
  module: p.module
553
574
  });
554
- case 109:
575
+ case 119:
555
576
  _env = _context3.sent;
556
- _context3.next = 112;
577
+ _context3.next = 122;
557
578
  return _module.handle(null, msg, _env);
558
- case 112:
579
+ case 122:
559
580
  res = _context3.sent;
560
581
  p.memory = res.Memory;
561
582
  delete res.Memory;
562
- _context3.next = 118;
583
+ _context3.next = 128;
563
584
  break;
564
- case 117:
585
+ case 127:
565
586
  p.height += 1;
566
- case 118:
587
+ case 128:
567
588
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.o)((0, _ramda.dissoc)("signer"), (0, _ramda.dissoc)("memory"))(opt)), {}, {
568
589
  res: res
569
590
  });
570
- _context3.next = 121;
591
+ _context3.next = 131;
571
592
  return mem.set(_msg, "msgs", id);
572
- case 121:
593
+ case 131:
573
594
  if (!_tags["Cron-Interval"]) {
574
- _context3.next = 145;
595
+ _context3.next = 155;
575
596
  break;
576
597
  }
577
598
  _tags$CronInterval$s = _tags["Cron-Interval"].split("-"), _tags$CronInterval$s2 = _slicedToArray(_tags$CronInterval$s, 2), num = _tags$CronInterval$s2[0], unit = _tags$CronInterval$s2[1];
578
599
  _int = 0;
579
600
  _context3.t14 = unit.replace(/s$/, "");
580
- _context3.next = _context3.t14 === "millisecond" ? 127 : _context3.t14 === "second" ? 129 : _context3.t14 === "minute" ? 131 : _context3.t14 === "hour" ? 133 : _context3.t14 === "day" ? 135 : _context3.t14 === "month" ? 137 : _context3.t14 === "year" ? 139 : 141;
601
+ _context3.next = _context3.t14 === "millisecond" ? 137 : _context3.t14 === "second" ? 139 : _context3.t14 === "minute" ? 141 : _context3.t14 === "hour" ? 143 : _context3.t14 === "day" ? 145 : _context3.t14 === "month" ? 147 : _context3.t14 === "year" ? 149 : 151;
581
602
  break;
582
- case 127:
603
+ case 137:
583
604
  _int = num;
584
- return _context3.abrupt("break", 141);
585
- case 129:
605
+ return _context3.abrupt("break", 151);
606
+ case 139:
586
607
  _int = num * 1000;
587
- return _context3.abrupt("break", 141);
588
- case 131:
608
+ return _context3.abrupt("break", 151);
609
+ case 141:
589
610
  _int = num * 1000 * 60;
590
- return _context3.abrupt("break", 141);
591
- case 133:
611
+ return _context3.abrupt("break", 151);
612
+ case 143:
592
613
  _int = num * 1000 * 60 * 60;
593
- return _context3.abrupt("break", 141);
594
- case 135:
614
+ return _context3.abrupt("break", 151);
615
+ case 145:
595
616
  _int = num * 1000 * 60 * 60 * 24;
596
- return _context3.abrupt("break", 141);
597
- case 137:
617
+ return _context3.abrupt("break", 151);
618
+ case 147:
598
619
  _int = num * 1000 * 60 * 60 * 24 * 30;
599
- return _context3.abrupt("break", 141);
600
- case 139:
620
+ return _context3.abrupt("break", 151);
621
+ case 149:
601
622
  _int = num * 1000 * 60 * 60 * 24 * 365;
602
- return _context3.abrupt("break", 141);
603
- case 141:
623
+ return _context3.abrupt("break", 151);
624
+ case 151:
604
625
  cronTags = [];
605
626
  for (_k in _tags) {
606
627
  if (/^Cron-Tag-/.test(_k)) {
@@ -612,16 +633,16 @@ var _default = exports["default"] = function _default() {
612
633
  }
613
634
  p.cronTags = cronTags;
614
635
  p.span = _int;
615
- case 145:
616
- _context3.next = 147;
636
+ case 155:
637
+ _context3.next = 157;
617
638
  return mem.set(p, "env", id);
618
- case 147:
639
+ case 157:
619
640
  return _context3.abrupt("return", id);
620
- case 148:
641
+ case 158:
621
642
  case "end":
622
643
  return _context3.stop();
623
644
  }
624
- }, _callee3, null, [[47, 62]]);
645
+ }, _callee3, null, [[57, 72]]);
625
646
  }));
626
647
  return function spawn() {
627
648
  return _ref8.apply(this, arguments);
@@ -639,7 +660,7 @@ var _default = exports["default"] = function _default() {
639
660
  var _assign = /*#__PURE__*/function () {
640
661
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
641
662
  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$getTx3, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
663
+ 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, start, res, _msg, _iterator3, _step3, v, _iterator4, _step4, _v, __tags, _iterator5, _step5, _v2, _iterator6, _step6, v2;
643
664
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
644
665
  while (1) switch (_context4.prev = _context4.next) {
645
666
  case 0:
@@ -809,39 +830,44 @@ var _default = exports["default"] = function _default() {
809
830
  p.handle = _context4.sent;
810
831
  mem.env[opt.process].handle = p.handle;
811
832
  case 97:
812
- _context4.next = 99;
833
+ if (p.compressed) {
834
+ start = Date.now();
835
+ p.memory = mem.waosm.decompress(p.memory, p.original_size);
836
+ p.compressed = false;
837
+ }
838
+ _context4.next = 100;
813
839
  return p.handle(p.memory, msg, _env);
814
- case 99:
840
+ case 100:
815
841
  res = _context4.sent;
816
842
  p.memory = res.Memory;
817
843
  delete res.Memory;
818
844
  p.results.push(opt.message);
819
- _context4.next = 105;
845
+ _context4.next = 106;
820
846
  return mem.set(p, "env", opt.process);
821
- case 105:
847
+ case 106:
822
848
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
823
849
  res: res
824
850
  });
825
- _context4.next = 108;
851
+ _context4.next = 109;
826
852
  return mem.set(_msg, "msgs", opt.message);
827
- case 108:
853
+ case 109:
828
854
  _iterator3 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
829
- _context4.prev = 109;
855
+ _context4.prev = 110;
830
856
  _iterator3.s();
831
- case 111:
857
+ case 112:
832
858
  if ((_step3 = _iterator3.n()).done) {
833
- _context4.next = 120;
859
+ _context4.next = 121;
834
860
  break;
835
861
  }
836
862
  v = _step3.value;
837
- _context4.next = 115;
863
+ _context4.next = 116;
838
864
  return mem.get("env", v.Target);
839
- case 115:
865
+ case 116:
840
866
  if (!_context4.sent) {
841
- _context4.next = 118;
867
+ _context4.next = 119;
842
868
  break;
843
869
  }
844
- _context4.next = 118;
870
+ _context4.next = 119;
845
871
  return message({
846
872
  "for": opt.message,
847
873
  process: v.Target,
@@ -850,32 +876,32 @@ var _default = exports["default"] = function _default() {
850
876
  signer: mu.signer,
851
877
  from: opt.process
852
878
  });
853
- case 118:
854
- _context4.next = 111;
879
+ case 119:
880
+ _context4.next = 112;
855
881
  break;
856
- case 120:
857
- _context4.next = 125;
882
+ case 121:
883
+ _context4.next = 126;
858
884
  break;
859
- case 122:
860
- _context4.prev = 122;
861
- _context4.t24 = _context4["catch"](109);
885
+ case 123:
886
+ _context4.prev = 123;
887
+ _context4.t24 = _context4["catch"](110);
862
888
  _iterator3.e(_context4.t24);
863
- case 125:
864
- _context4.prev = 125;
889
+ case 126:
890
+ _context4.prev = 126;
865
891
  _iterator3.f();
866
- return _context4.finish(125);
867
- case 128:
892
+ return _context4.finish(126);
893
+ case 129:
868
894
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
869
- _context4.prev = 129;
895
+ _context4.prev = 130;
870
896
  _iterator4.s();
871
- case 131:
897
+ case 132:
872
898
  if ((_step4 = _iterator4.n()).done) {
873
- _context4.next = 138;
899
+ _context4.next = 139;
874
900
  break;
875
901
  }
876
902
  _v = _step4.value;
877
903
  __tags = (0, _utils.tags)(_v.Tags);
878
- _context4.next = 136;
904
+ _context4.next = 137;
879
905
  return spawn({
880
906
  "for": opt.message,
881
907
  module: __tags.Module,
@@ -885,87 +911,87 @@ var _default = exports["default"] = function _default() {
885
911
  from: __tags["From-Process"],
886
912
  signer: mu.signer
887
913
  });
888
- case 136:
889
- _context4.next = 131;
914
+ case 137:
915
+ _context4.next = 132;
890
916
  break;
891
- case 138:
892
- _context4.next = 143;
917
+ case 139:
918
+ _context4.next = 144;
893
919
  break;
894
- case 140:
895
- _context4.prev = 140;
896
- _context4.t25 = _context4["catch"](129);
920
+ case 141:
921
+ _context4.prev = 141;
922
+ _context4.t25 = _context4["catch"](130);
897
923
  _iterator4.e(_context4.t25);
898
- case 143:
899
- _context4.prev = 143;
924
+ case 144:
925
+ _context4.prev = 144;
900
926
  _iterator4.f();
901
- return _context4.finish(143);
902
- case 146:
927
+ return _context4.finish(144);
928
+ case 147:
903
929
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
904
- _context4.prev = 147;
930
+ _context4.prev = 148;
905
931
  _iterator5.s();
906
- case 149:
932
+ case 150:
907
933
  if ((_step5 = _iterator5.n()).done) {
908
- _context4.next = 170;
934
+ _context4.next = 171;
909
935
  break;
910
936
  }
911
937
  _v2 = _step5.value;
912
938
  _iterator6 = _createForOfIteratorHelper(_v2.Processes);
913
- _context4.prev = 152;
939
+ _context4.prev = 153;
914
940
  _iterator6.s();
915
- case 154:
941
+ case 155:
916
942
  if ((_step6 = _iterator6.n()).done) {
917
- _context4.next = 160;
943
+ _context4.next = 161;
918
944
  break;
919
945
  }
920
946
  v2 = _step6.value;
921
- _context4.next = 158;
947
+ _context4.next = 159;
922
948
  return _assign({
923
949
  message: _v2.Message,
924
950
  process: v2,
925
951
  from: opt.process,
926
952
  signer: mu.signer
927
953
  });
928
- case 158:
929
- _context4.next = 154;
954
+ case 159:
955
+ _context4.next = 155;
930
956
  break;
931
- case 160:
932
- _context4.next = 165;
957
+ case 161:
958
+ _context4.next = 166;
933
959
  break;
934
- case 162:
935
- _context4.prev = 162;
936
- _context4.t26 = _context4["catch"](152);
960
+ case 163:
961
+ _context4.prev = 163;
962
+ _context4.t26 = _context4["catch"](153);
937
963
  _iterator6.e(_context4.t26);
938
- case 165:
939
- _context4.prev = 165;
964
+ case 166:
965
+ _context4.prev = 166;
940
966
  _iterator6.f();
941
- return _context4.finish(165);
942
- case 168:
943
- _context4.next = 149;
967
+ return _context4.finish(166);
968
+ case 169:
969
+ _context4.next = 150;
944
970
  break;
945
- case 170:
946
- _context4.next = 175;
971
+ case 171:
972
+ _context4.next = 176;
947
973
  break;
948
- case 172:
949
- _context4.prev = 172;
950
- _context4.t27 = _context4["catch"](147);
974
+ case 173:
975
+ _context4.prev = 173;
976
+ _context4.t27 = _context4["catch"](148);
951
977
  _iterator5.e(_context4.t27);
952
- case 175:
953
- _context4.prev = 175;
978
+ case 176:
979
+ _context4.prev = 176;
954
980
  _iterator5.f();
955
- return _context4.finish(175);
956
- case 178:
981
+ return _context4.finish(176);
982
+ case 179:
957
983
  return _context4.abrupt("return", id);
958
- case 181:
959
- _context4.prev = 181;
984
+ case 182:
985
+ _context4.prev = 182;
960
986
  _context4.t28 = _context4["catch"](38);
961
987
  console.log(_context4.t28);
962
- case 184:
963
- return _context4.abrupt("return", null);
964
988
  case 185:
989
+ return _context4.abrupt("return", null);
990
+ case 186:
965
991
  case "end":
966
992
  return _context4.stop();
967
993
  }
968
- }, _callee4, null, [[38, 181], [43, 56], [109, 122, 125, 128], [129, 140, 143, 146], [147, 172, 175, 178], [152, 162, 165, 168]]);
994
+ }, _callee4, null, [[38, 182], [43, 56], [110, 123, 126, 129], [130, 141, 144, 147], [148, 173, 176, 179], [153, 163, 166, 169]]);
969
995
  }));
970
996
  return function assign(_x8) {
971
997
  return _ref9.apply(this, arguments);
@@ -973,7 +999,7 @@ var _default = exports["default"] = function _default() {
973
999
  }();
974
1000
  var message = /*#__PURE__*/function () {
975
1001
  var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
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;
1002
+ var id, owner, item, _opt$id2, _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, start, res, _msg2;
977
1003
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
978
1004
  while (1) switch (_context5.prev = _context5.next) {
979
1005
  case 0:
@@ -981,54 +1007,72 @@ var _default = exports["default"] = function _default() {
981
1007
  owner = "";
982
1008
  item = null;
983
1009
  if (!ar.isHttpMsg(opt.http_msg)) {
984
- _context5.next = 22;
1010
+ _context5.next = 32;
985
1011
  break;
986
1012
  }
987
- id = opt.http_msg.target;
988
- _context5.next = 7;
1013
+ id = (_opt$id2 = opt.id) !== null && _opt$id2 !== void 0 ? _opt$id2 : opt.http_msg.target;
1014
+ if (!ongoing[id]) {
1015
+ _context5.next = 14;
1016
+ break;
1017
+ }
1018
+ case 6:
1019
+ if (!ongoing[id]) {
1020
+ _context5.next = 11;
1021
+ break;
1022
+ }
1023
+ _context5.next = 9;
1024
+ return (0, _utils.wait)(100);
1025
+ case 9:
1026
+ _context5.next = 6;
1027
+ break;
1028
+ case 11:
1029
+ return _context5.abrupt("return", id);
1030
+ case 14:
1031
+ ongoing[id] = true;
1032
+ _context5.next = 17;
989
1033
  return ar.httpmsg(opt.http_msg, id);
990
- case 7:
1034
+ case 17:
991
1035
  _yield$ar$httpmsg2 = _context5.sent;
992
1036
  owner = _yield$ar$httpmsg2.owner;
993
1037
  item = _yield$ar$httpmsg2.item;
994
- _context5.next = 12;
1038
+ _context5.next = 22;
995
1039
  return mem.get("env", opt.process);
996
- case 12:
1040
+ case 22:
997
1041
  _p = _context5.sent;
998
1042
  new_slot = opt.slot * 1;
999
1043
  last_slot = !_p ? -1 : _p.results.length - 1;
1000
1044
  if (!(last_slot + 1 < new_slot)) {
1001
- _context5.next = 20;
1045
+ _context5.next = 30;
1002
1046
  break;
1003
1047
  }
1004
1048
  if (!(!hb || opt.recovery)) {
1005
- _context5.next = 18;
1049
+ _context5.next = 28;
1006
1050
  break;
1007
1051
  }
1008
1052
  return _context5.abrupt("return", null);
1009
- case 18:
1010
- _context5.next = 20;
1053
+ case 28:
1054
+ _context5.next = 30;
1011
1055
  return _recover(opt.process);
1012
- case 20:
1013
- _context5.next = 25;
1056
+ case 30:
1057
+ _context5.next = 35;
1014
1058
  break;
1015
- case 22:
1059
+ case 32:
1016
1060
  _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 : "";
1017
1061
  _owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
1018
1062
  _item = opt.item;
1019
- case 25:
1020
- _context5.next = 27;
1063
+ case 35:
1064
+ _context5.next = 37;
1021
1065
  return mem.get("env", opt.process);
1022
- case 27:
1066
+ case 37:
1023
1067
  p = _context5.sent;
1024
1068
  if (p) {
1025
- _context5.next = 30;
1069
+ _context5.next = 40;
1026
1070
  break;
1027
1071
  }
1028
1072
  return _context5.abrupt("return", null);
1029
- case 30:
1073
+ case 40:
1030
1074
  if (!(!opt.item && opt.signer)) {
1031
- _context5.next = 65;
1075
+ _context5.next = 75;
1032
1076
  break;
1033
1077
  }
1034
1078
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
@@ -1038,7 +1082,7 @@ var _default = exports["default"] = function _default() {
1038
1082
  SDK: "aoconnect"
1039
1083
  }));
1040
1084
  if (!opt["for"]) {
1041
- _context5.next = 58;
1085
+ _context5.next = 68;
1042
1086
  break;
1043
1087
  }
1044
1088
  opt.tags.push({
@@ -1049,100 +1093,100 @@ var _default = exports["default"] = function _default() {
1049
1093
  name: "From-Process",
1050
1094
  value: opt.from
1051
1095
  });
1052
- _context5.next = 37;
1096
+ _context5.next = 47;
1053
1097
  return mem.getTx(opt.from);
1054
- case 37:
1098
+ case 47:
1055
1099
  _context5.t2 = _yield$mem$getTx4 = _context5.sent;
1056
1100
  _context5.t1 = _context5.t2 === null;
1057
1101
  if (_context5.t1) {
1058
- _context5.next = 41;
1102
+ _context5.next = 51;
1059
1103
  break;
1060
1104
  }
1061
1105
  _context5.t1 = _yield$mem$getTx4 === void 0;
1062
- case 41:
1106
+ case 51:
1063
1107
  if (!_context5.t1) {
1064
- _context5.next = 45;
1108
+ _context5.next = 55;
1065
1109
  break;
1066
1110
  }
1067
1111
  _context5.t3 = void 0;
1068
- _context5.next = 46;
1112
+ _context5.next = 56;
1069
1113
  break;
1070
- case 45:
1114
+ case 55:
1071
1115
  _context5.t3 = _yield$mem$getTx4.tags;
1072
- case 46:
1116
+ case 56:
1073
1117
  _context5.t4 = _yield$mem$getTx$tags3 = _context5.t3;
1074
1118
  _context5.t0 = _context5.t4 !== null;
1075
1119
  if (!_context5.t0) {
1076
- _context5.next = 50;
1120
+ _context5.next = 60;
1077
1121
  break;
1078
1122
  }
1079
1123
  _context5.t0 = _yield$mem$getTx$tags3 !== void 0;
1080
- case 50:
1124
+ case 60:
1081
1125
  if (!_context5.t0) {
1082
- _context5.next = 54;
1126
+ _context5.next = 64;
1083
1127
  break;
1084
1128
  }
1085
1129
  _context5.t5 = _yield$mem$getTx$tags3;
1086
- _context5.next = 55;
1130
+ _context5.next = 65;
1087
1131
  break;
1088
- case 54:
1132
+ case 64:
1089
1133
  _context5.t5 = [];
1090
- case 55:
1134
+ case 65:
1091
1135
  pr = _context5.t5;
1092
1136
  module = (0, _utils.tags)(pr).Module;
1093
1137
  if (module) opt.tags.push({
1094
1138
  name: "From-Module",
1095
1139
  value: module
1096
1140
  });
1097
- case 58:
1141
+ case 68:
1098
1142
  ;
1099
- _context5.next = 61;
1143
+ _context5.next = 71;
1100
1144
  return ar.dataitem({
1101
1145
  data: opt.data,
1102
1146
  signer: opt.signer,
1103
1147
  tags: (0, _utils.tags)(opt.tags),
1104
1148
  target: opt.process
1105
1149
  });
1106
- case 61:
1150
+ case 71:
1107
1151
  _yield$ar$dataitem3 = _context5.sent;
1108
1152
  item = _yield$ar$dataitem3.item;
1109
1153
  id = _yield$ar$dataitem3.id;
1110
1154
  owner = _yield$ar$dataitem3.owner;
1111
- case 65:
1155
+ case 75:
1112
1156
  _msg = (0, _ramda.dissoc)("signer", opt);
1113
- _context5.next = 68;
1157
+ _context5.next = 78;
1114
1158
  return mem.set(_msg, "msgs", id);
1115
- case 68:
1159
+ case 78:
1116
1160
  if (!ar.isHttpMsg(opt.http_msg)) {
1117
- _context5.next = 132;
1161
+ _context5.next = 143;
1118
1162
  break;
1119
1163
  }
1120
1164
  p.epochs.push([id]);
1121
1165
  _opt = opt;
1122
- _context5.prev = 71;
1166
+ _context5.prev = 81;
1123
1167
  // todo: not sure if this is correct
1124
1168
  from = (_ref12 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref12 !== void 0 ? _ref12 : owner;
1125
1169
  data = (_opt$http_msg$data = opt.http_msg.data) !== null && _opt$http_msg$data !== void 0 ? _opt$http_msg$data : "";
1126
1170
  _tags = _opt.http_msg.tags; // todo: check if owner=mu.addr right?
1127
- _context5.next = 77;
1171
+ _context5.next = 87;
1128
1172
  return genMsg(opt.http_msg, p, data, _tags, from, owner);
1129
- case 77:
1173
+ case 87:
1130
1174
  msg = _context5.sent;
1131
- _context5.next = 80;
1175
+ _context5.next = 90;
1132
1176
  return genEnv({
1133
1177
  pid: p.id,
1134
1178
  owner: p.owner,
1135
1179
  module: p.module
1136
1180
  });
1137
- case 80:
1181
+ case 90:
1138
1182
  _env = _context5.sent;
1139
1183
  if (p.handle) {
1140
- _context5.next = 113;
1184
+ _context5.next = 123;
1141
1185
  break;
1142
1186
  }
1143
- _context5.next = 84;
1187
+ _context5.next = 94;
1144
1188
  return mem.getWasm(p.modulea);
1145
- case 84:
1189
+ case 94:
1146
1190
  _yield$mem$getWasm3 = _context5.sent;
1147
1191
  format = _yield$mem$getWasm3.format;
1148
1192
  mod = _yield$mem$getWasm3.mod;
@@ -1152,31 +1196,31 @@ var _default = exports["default"] = function _default() {
1152
1196
  _context5.t7 = wasm;
1153
1197
  _context5.t8 = format;
1154
1198
  _context5.t9 = wdrive;
1155
- _context5.next = 95;
1199
+ _context5.next = 105;
1156
1200
  return mem.getTx(p.id);
1157
- case 95:
1201
+ case 105:
1158
1202
  _context5.t11 = _yield$mem$getTx5 = _context5.sent;
1159
1203
  _context5.t10 = _context5.t11 === null;
1160
1204
  if (_context5.t10) {
1161
- _context5.next = 99;
1205
+ _context5.next = 109;
1162
1206
  break;
1163
1207
  }
1164
1208
  _context5.t10 = _yield$mem$getTx5 === void 0;
1165
- case 99:
1209
+ case 109:
1166
1210
  if (!_context5.t10) {
1167
- _context5.next = 103;
1211
+ _context5.next = 113;
1168
1212
  break;
1169
1213
  }
1170
1214
  _context5.t12 = void 0;
1171
- _context5.next = 104;
1215
+ _context5.next = 114;
1172
1216
  break;
1173
- case 103:
1217
+ case 113:
1174
1218
  _context5.t12 = _yield$mem$getTx5.item;
1175
- case 104:
1219
+ case 114:
1176
1220
  _context5.t13 = _context5.t12;
1177
- _context5.next = 107;
1221
+ _context5.next = 117;
1178
1222
  return mem.getTx(mod);
1179
- case 107:
1223
+ case 117:
1180
1224
  _context5.t14 = _context5.sent;
1181
1225
  _context5.t15 = {
1182
1226
  format: _context5.t8,
@@ -1184,38 +1228,43 @@ var _default = exports["default"] = function _default() {
1184
1228
  spawn: _context5.t13,
1185
1229
  module: _context5.t14
1186
1230
  };
1187
- _context5.next = 111;
1231
+ _context5.next = 121;
1188
1232
  return (0, _context5.t6)(_context5.t7, _context5.t15);
1189
- case 111:
1233
+ case 121:
1190
1234
  p.handle = _context5.sent;
1191
1235
  mem.env[opt.process].handle = p.handle;
1192
- case 113:
1193
- _context5.next = 115;
1236
+ case 123:
1237
+ if (p.compressed) {
1238
+ start = Date.now();
1239
+ p.memory = mem.waosm.decompress(p.memory, p.original_size);
1240
+ p.compressed = false;
1241
+ }
1242
+ _context5.next = 126;
1194
1243
  return p.handle(p.memory, msg, _env);
1195
- case 115:
1244
+ case 126:
1196
1245
  res = _context5.sent;
1197
1246
  p.memory = res.Memory;
1198
1247
  delete res.Memory;
1199
1248
  p.results.push(id);
1200
- _context5.next = 121;
1249
+ _context5.next = 132;
1201
1250
  return mem.set(p, "env", opt.process);
1202
- case 121:
1251
+ case 132:
1203
1252
  _msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
1204
1253
  res: res
1205
1254
  });
1206
- _context5.next = 124;
1255
+ _context5.next = 135;
1207
1256
  return mem.set(_msg2, "msgs", id);
1208
- case 124:
1257
+ case 135:
1209
1258
  return _context5.abrupt("return", id);
1210
- case 127:
1211
- _context5.prev = 127;
1212
- _context5.t16 = _context5["catch"](71);
1259
+ case 138:
1260
+ _context5.prev = 138;
1261
+ _context5.t16 = _context5["catch"](81);
1213
1262
  console.log(_context5.t16);
1214
- case 130:
1215
- _context5.next = 134;
1263
+ case 141:
1264
+ _context5.next = 145;
1216
1265
  break;
1217
- case 132:
1218
- _context5.next = 134;
1266
+ case 143:
1267
+ _context5.next = 145;
1219
1268
  return _assign({
1220
1269
  message_item: item,
1221
1270
  message: id,
@@ -1223,13 +1272,14 @@ var _default = exports["default"] = function _default() {
1223
1272
  from: owner,
1224
1273
  signer: mu.signer
1225
1274
  });
1226
- case 134:
1275
+ case 145:
1276
+ delete ongoing[id];
1227
1277
  return _context5.abrupt("return", id);
1228
- case 135:
1278
+ case 147:
1229
1279
  case "end":
1230
1280
  return _context5.stop();
1231
1281
  }
1232
- }, _callee5, null, [[71, 127]]);
1282
+ }, _callee5, null, [[81, 138]]);
1233
1283
  }));
1234
1284
  return function message(_x9) {
1235
1285
  return _ref11.apply(this, arguments);
@@ -1347,6 +1397,7 @@ var _default = exports["default"] = function _default() {
1347
1397
  }
1348
1398
  _context6.next = 52;
1349
1399
  return spawn({
1400
+ id: v.node.message.Id,
1350
1401
  http_msg: item,
1351
1402
  scheduler: _tags.Scheduler,
1352
1403
  module: _tags.Module,
@@ -1359,6 +1410,7 @@ var _default = exports["default"] = function _default() {
1359
1410
  case 54:
1360
1411
  _context6.next = 56;
1361
1412
  return message({
1413
+ id: v.node.message.Id,
1362
1414
  process: pid,
1363
1415
  http_msg: item,
1364
1416
  slot: v.cursor,
@@ -1621,8 +1673,8 @@ var _default = exports["default"] = function _default() {
1621
1673
  }(),
1622
1674
  dryrun: function () {
1623
1675
  var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1624
- var _opt$id, _opt$owner2;
1625
- var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm4, format, mod, wasm, wdrive, res;
1676
+ var _opt$id3, _opt$owner2;
1677
+ var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm4, format, mod, wasm, wdrive, start, res;
1626
1678
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1627
1679
  while (1) switch (_context12.prev = _context12.next) {
1628
1680
  case 0:
@@ -1636,7 +1688,7 @@ var _default = exports["default"] = function _default() {
1636
1688
  }
1637
1689
  return _context12.abrupt("return", null);
1638
1690
  case 5:
1639
- id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : "";
1691
+ id = (_opt$id3 = opt.id) !== null && _opt$id3 !== void 0 ? _opt$id3 : "";
1640
1692
  owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : mu.addr;
1641
1693
  if (!(!opt.id && opt.signer)) {
1642
1694
  _context12.next = 14;
@@ -1709,23 +1761,28 @@ var _default = exports["default"] = function _default() {
1709
1761
  p.handle = _context12.sent;
1710
1762
  mem.env[opt.process].handle = p.handle;
1711
1763
  case 45:
1712
- _context12.next = 47;
1764
+ if (p.compressed) {
1765
+ start = Date.now();
1766
+ p.memory = mem.waosm.decompress(p.memory, p.original_size);
1767
+ p.compressed = false;
1768
+ }
1769
+ _context12.next = 48;
1713
1770
  return p.handle(p.memory, msg, _env);
1714
- case 47:
1771
+ case 48:
1715
1772
  res = _context12.sent;
1716
1773
  delete res.Memory;
1717
1774
  return _context12.abrupt("return", res);
1718
- case 52:
1719
- _context12.prev = 52;
1775
+ case 53:
1776
+ _context12.prev = 53;
1720
1777
  _context12.t7 = _context12["catch"](14);
1721
1778
  console.log(_context12.t7);
1722
- case 55:
1723
- return _context12.abrupt("return", null);
1724
1779
  case 56:
1780
+ return _context12.abrupt("return", null);
1781
+ case 57:
1725
1782
  case "end":
1726
1783
  return _context12.stop();
1727
1784
  }
1728
- }, _callee12, null, [[14, 52]]);
1785
+ }, _callee12, null, [[14, 53]]);
1729
1786
  }));
1730
1787
  function dryrun(_x16) {
1731
1788
  return _dryrun.apply(this, arguments);
package/cjs/armem-base.js CHANGED
@@ -396,7 +396,8 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
396
396
  v3 = _context5.sent;
397
397
  if ((0, _ramda.is)(Uint8Array, v3.memory)) {
398
398
  try {
399
- v3.memory = this.waosm.decompress(v3.memory, v3.original_size);
399
+ v3.compressed = true;
400
+ //v3.memory = this.waosm.decompress(v3.memory, v3.original_size)
400
401
  } catch (e) {
401
402
  console.log(e);
402
403
  v3.memory = (0, _compress.decompress)(v3.memory);
@@ -27,6 +27,8 @@ import {
27
27
  } from "ramda"
28
28
 
29
29
  let onRecovery = {}
30
+ let ongoing = {}
31
+
30
32
  export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
31
33
  return (mem, { cache, log = false, extensions = {}, hb } = {}) => {
32
34
  const isMem = mem?.__type__ === "mem"
@@ -110,11 +112,17 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
110
112
  let id, owner, item, __tags
111
113
  let msg_owner = mu.addr
112
114
  if (ar.isHttpMsg(opt.http_msg)) {
113
- id = opt.http_msg.target
114
- ;({ owner, item, tags: __tags } = await ar.httpmsg(opt.http_msg, id))
115
- opt.tags = buildTags(null, __tags)
116
- opt.data = opt.http_msg.data
117
- msg_owner = owner
115
+ id = opt.id ?? opt.http_msg.target
116
+ if (ongoing[id]) {
117
+ while (ongoing[id]) await wait(100)
118
+ return id
119
+ } else {
120
+ ongoing[id] = true
121
+ ;({ owner, item, tags: __tags } = await ar.httpmsg(opt.http_msg, id))
122
+ opt.tags = buildTags(null, __tags)
123
+ opt.data = opt.http_msg.data
124
+ msg_owner = owner
125
+ }
118
126
  } else {
119
127
  opt.tags = buildTags(
120
128
  null,
@@ -323,6 +331,11 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
323
331
  })
324
332
  mem.env[opt.process].handle = p.handle
325
333
  }
334
+ if (p.compressed) {
335
+ const start = Date.now()
336
+ p.memory = mem.waosm.decompress(p.memory, p.original_size)
337
+ p.compressed = false
338
+ }
326
339
  const res = await p.handle(p.memory, msg, _env)
327
340
  p.memory = res.Memory
328
341
  delete res.Memory
@@ -376,15 +389,21 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
376
389
  let owner = ""
377
390
  let item = null
378
391
  if (ar.isHttpMsg(opt.http_msg)) {
379
- id = opt.http_msg.target
380
- ;({ owner, item } = await ar.httpmsg(opt.http_msg, id))
381
- // check if process exists, and recover if necessary
382
- const p = await mem.get("env", opt.process)
383
- const new_slot = opt.slot * 1
384
- const last_slot = !p ? -1 : p.results.length - 1
385
- if (last_slot + 1 < new_slot) {
386
- if (!hb || opt.recovery) return null
387
- await recover(opt.process)
392
+ id = opt.id ?? opt.http_msg.target
393
+ if (ongoing[id]) {
394
+ while (ongoing[id]) await wait(100)
395
+ return id
396
+ } else {
397
+ ongoing[id] = true
398
+ ;({ owner, item } = await ar.httpmsg(opt.http_msg, id))
399
+ // check if process exists, and recover if necessary
400
+ const p = await mem.get("env", opt.process)
401
+ const new_slot = opt.slot * 1
402
+ const last_slot = !p ? -1 : p.results.length - 1
403
+ if (last_slot + 1 < new_slot) {
404
+ if (!hb || opt.recovery) return null
405
+ await recover(opt.process)
406
+ }
388
407
  }
389
408
  } else {
390
409
  let id = opt?.item?.id ?? ""
@@ -446,6 +465,11 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
446
465
  })
447
466
  mem.env[opt.process].handle = p.handle
448
467
  }
468
+ if (p.compressed) {
469
+ const start = Date.now()
470
+ p.memory = mem.waosm.decompress(p.memory, p.original_size)
471
+ p.compressed = false
472
+ }
449
473
  const res = await p.handle(p.memory, msg, _env)
450
474
  p.memory = res.Memory
451
475
  delete res.Memory
@@ -466,6 +490,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
466
490
  signer: mu.signer,
467
491
  })
468
492
  }
493
+ delete ongoing[id]
469
494
  return id
470
495
  }
471
496
  const recover = async (pid, next) => {
@@ -512,6 +537,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
512
537
  let _tags = tags(item.tags)
513
538
  if (_tags.Type === "Process") {
514
539
  await spawn({
540
+ id: v.node.message.Id,
515
541
  http_msg: item,
516
542
  scheduler: _tags.Scheduler,
517
543
  module: _tags.Module,
@@ -520,6 +546,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
520
546
  })
521
547
  } else {
522
548
  await message({
549
+ id: v.node.message.Id,
523
550
  process: pid,
524
551
  http_msg: item,
525
552
  slot: v.cursor,
@@ -539,7 +566,9 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
539
566
  return { recovered: count, pid, success }
540
567
  }
541
568
 
542
- const result = async opt => (await mem.get("msgs", opt.message))?.res
569
+ const result = async opt => {
570
+ return (await mem.get("msgs", opt.message))?.res
571
+ }
543
572
 
544
573
  return {
545
574
  message,
@@ -629,6 +658,11 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
629
658
  })
630
659
  mem.env[opt.process].handle = p.handle
631
660
  }
661
+ if (p.compressed) {
662
+ const start = Date.now()
663
+ p.memory = mem.waosm.decompress(p.memory, p.original_size)
664
+ p.compressed = false
665
+ }
632
666
  const res = await p.handle(p.memory, msg, _env)
633
667
  delete res.Memory
634
668
  return res
package/esm/armem-base.js CHANGED
@@ -199,7 +199,8 @@ export default class ArMemBase {
199
199
  let v3 = await this.db.get(v2)
200
200
  if (is(Uint8Array, v3.memory)) {
201
201
  try {
202
- v3.memory = this.waosm.decompress(v3.memory, v3.original_size)
202
+ v3.compressed = true
203
+ //v3.memory = this.waosm.decompress(v3.memory, v3.original_size)
203
204
  } catch (e) {
204
205
  console.log(e)
205
206
  v3.memory = decompress(v3.memory)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"