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