wao 0.14.3 → 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 +185 -176
- package/esm/aoconnect-base.js +16 -7
- package/package.json +1 -1
package/cjs/aoconnect-base.js
CHANGED
|
@@ -300,6 +300,7 @@ var _default = exports["default"] = function _default() {
|
|
|
300
300
|
__tags,
|
|
301
301
|
msg_owner,
|
|
302
302
|
_opt$id,
|
|
303
|
+
i,
|
|
303
304
|
_yield$ar$httpmsg,
|
|
304
305
|
_opt$tags,
|
|
305
306
|
ex,
|
|
@@ -357,31 +358,33 @@ var _default = exports["default"] = function _default() {
|
|
|
357
358
|
format = _yield$mem$getWasm.format;
|
|
358
359
|
msg_owner = mu.addr;
|
|
359
360
|
if (!ar.isHttpMsg(opt.http_msg)) {
|
|
360
|
-
_context3.next =
|
|
361
|
+
_context3.next = 37;
|
|
361
362
|
break;
|
|
362
363
|
}
|
|
363
364
|
id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : opt.http_msg.target;
|
|
364
365
|
if (!ongoing[id]) {
|
|
365
|
-
_context3.next =
|
|
366
|
+
_context3.next = 25;
|
|
366
367
|
break;
|
|
367
368
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
i = 0;
|
|
370
|
+
case 16:
|
|
371
|
+
if (!(i < 30 && ongoing[id])) {
|
|
372
|
+
_context3.next = 22;
|
|
371
373
|
break;
|
|
372
374
|
}
|
|
373
|
-
_context3.next =
|
|
375
|
+
_context3.next = 19;
|
|
374
376
|
return (0, _utils.wait)(100);
|
|
375
|
-
case
|
|
376
|
-
|
|
377
|
+
case 19:
|
|
378
|
+
i++;
|
|
379
|
+
_context3.next = 16;
|
|
377
380
|
break;
|
|
378
|
-
case
|
|
381
|
+
case 22:
|
|
379
382
|
return _context3.abrupt("return", id);
|
|
380
|
-
case
|
|
383
|
+
case 25:
|
|
381
384
|
ongoing[id] = true;
|
|
382
|
-
_context3.next =
|
|
385
|
+
_context3.next = 28;
|
|
383
386
|
return ar.httpmsg(opt.http_msg, id);
|
|
384
|
-
case
|
|
387
|
+
case 28:
|
|
385
388
|
_yield$ar$httpmsg = _context3.sent;
|
|
386
389
|
owner = _yield$ar$httpmsg.owner;
|
|
387
390
|
item = _yield$ar$httpmsg.item;
|
|
@@ -389,10 +392,10 @@ var _default = exports["default"] = function _default() {
|
|
|
389
392
|
opt.tags = (0, _utils.buildTags)(null, __tags);
|
|
390
393
|
opt.data = opt.http_msg.data;
|
|
391
394
|
msg_owner = owner;
|
|
392
|
-
case 33:
|
|
393
|
-
_context3.next = 52;
|
|
394
|
-
break;
|
|
395
395
|
case 35:
|
|
396
|
+
_context3.next = 54;
|
|
397
|
+
break;
|
|
398
|
+
case 37:
|
|
396
399
|
opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
|
|
397
400
|
"Data-Protocol": "ao",
|
|
398
401
|
Variant: "ao.TN.1",
|
|
@@ -423,14 +426,14 @@ var _default = exports["default"] = function _default() {
|
|
|
423
426
|
name: "Pushed-For",
|
|
424
427
|
value: opt["for"]
|
|
425
428
|
});
|
|
426
|
-
_context3.next =
|
|
429
|
+
_context3.next = 45;
|
|
427
430
|
return ar.dataitem({
|
|
428
431
|
item: opt.item,
|
|
429
432
|
data: opt.data,
|
|
430
433
|
signer: opt.signer,
|
|
431
434
|
tags: (0, _utils.tags)(opt.tags)
|
|
432
435
|
});
|
|
433
|
-
case
|
|
436
|
+
case 45:
|
|
434
437
|
_yield$ar$dataitem = _context3.sent;
|
|
435
438
|
id = _yield$ar$dataitem.id;
|
|
436
439
|
owner = _yield$ar$dataitem.owner;
|
|
@@ -438,23 +441,23 @@ var _default = exports["default"] = function _default() {
|
|
|
438
441
|
__tags = _yield$ar$dataitem.tags;
|
|
439
442
|
opt.tags = (0, _utils.buildTags)(null, __tags);
|
|
440
443
|
if (opt.item) opt.data = _base64url["default"].decode(item.data);
|
|
441
|
-
_context3.next =
|
|
444
|
+
_context3.next = 54;
|
|
442
445
|
return ar.postItems(item, su.jwk);
|
|
443
|
-
case
|
|
446
|
+
case 54:
|
|
444
447
|
now = Date.now;
|
|
445
448
|
t = (0, _utils.tags)(opt.tags);
|
|
446
449
|
ext = t.Extension || "WeaveDrive";
|
|
447
450
|
wdrive = extensions[ext];
|
|
448
451
|
handle = null;
|
|
449
|
-
_context3.prev =
|
|
452
|
+
_context3.prev = 59;
|
|
450
453
|
_context3.t0 = AoLoader;
|
|
451
454
|
_context3.t1 = wasm;
|
|
452
455
|
_context3.t2 = format;
|
|
453
456
|
_context3.t3 = wdrive;
|
|
454
457
|
_context3.t4 = item;
|
|
455
|
-
_context3.next =
|
|
458
|
+
_context3.next = 67;
|
|
456
459
|
return mem.getTx(mod);
|
|
457
|
-
case
|
|
460
|
+
case 67:
|
|
458
461
|
_context3.t5 = _context3.sent;
|
|
459
462
|
_context3.t6 = {
|
|
460
463
|
format: _context3.t2,
|
|
@@ -462,23 +465,23 @@ var _default = exports["default"] = function _default() {
|
|
|
462
465
|
spawn: _context3.t4,
|
|
463
466
|
module: _context3.t5
|
|
464
467
|
};
|
|
465
|
-
_context3.next =
|
|
468
|
+
_context3.next = 71;
|
|
466
469
|
return (0, _context3.t0)(_context3.t1, _context3.t6);
|
|
467
|
-
case
|
|
470
|
+
case 71:
|
|
468
471
|
handle = _context3.sent;
|
|
469
|
-
_context3.next =
|
|
472
|
+
_context3.next = 77;
|
|
470
473
|
break;
|
|
471
|
-
case
|
|
472
|
-
_context3.prev =
|
|
473
|
-
_context3.t7 = _context3["catch"](
|
|
474
|
+
case 74:
|
|
475
|
+
_context3.prev = 74;
|
|
476
|
+
_context3.t7 = _context3["catch"](59);
|
|
474
477
|
console.log(mod, _context3.t7);
|
|
475
|
-
case
|
|
478
|
+
case 77:
|
|
476
479
|
if (handle) {
|
|
477
|
-
_context3.next =
|
|
480
|
+
_context3.next = 79;
|
|
478
481
|
break;
|
|
479
482
|
}
|
|
480
483
|
return _context3.abrupt("return", null);
|
|
481
|
-
case
|
|
484
|
+
case 79:
|
|
482
485
|
_module = null;
|
|
483
486
|
_module = {
|
|
484
487
|
handle: handle,
|
|
@@ -502,126 +505,126 @@ var _default = exports["default"] = function _default() {
|
|
|
502
505
|
results: [id]
|
|
503
506
|
};
|
|
504
507
|
if (!memory) {
|
|
505
|
-
_context3.next =
|
|
508
|
+
_context3.next = 89;
|
|
506
509
|
break;
|
|
507
510
|
}
|
|
508
|
-
_context3.next =
|
|
511
|
+
_context3.next = 130;
|
|
509
512
|
break;
|
|
510
|
-
case
|
|
513
|
+
case 89:
|
|
511
514
|
if (!(_tags["On-Boot"] || true)) {
|
|
512
|
-
_context3.next =
|
|
515
|
+
_context3.next = 129;
|
|
513
516
|
break;
|
|
514
517
|
}
|
|
515
518
|
data = "";
|
|
516
519
|
if (!(_tags["On-Boot"] === "Data")) {
|
|
517
|
-
_context3.next =
|
|
520
|
+
_context3.next = 95;
|
|
518
521
|
break;
|
|
519
522
|
}
|
|
520
523
|
data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
|
|
521
|
-
_context3.next =
|
|
524
|
+
_context3.next = 116;
|
|
522
525
|
break;
|
|
523
|
-
case 93:
|
|
524
|
-
_context3.next = 95;
|
|
525
|
-
return mem.get("msgs", _tags["On-Boot"]);
|
|
526
526
|
case 95:
|
|
527
|
+
_context3.next = 97;
|
|
528
|
+
return mem.get("msgs", _tags["On-Boot"]);
|
|
529
|
+
case 97:
|
|
527
530
|
_context3.t10 = _yield$mem$get = _context3.sent;
|
|
528
531
|
_context3.t9 = _context3.t10 === null;
|
|
529
532
|
if (_context3.t9) {
|
|
530
|
-
_context3.next =
|
|
533
|
+
_context3.next = 101;
|
|
531
534
|
break;
|
|
532
535
|
}
|
|
533
536
|
_context3.t9 = _yield$mem$get === void 0;
|
|
534
|
-
case
|
|
537
|
+
case 101:
|
|
535
538
|
if (!_context3.t9) {
|
|
536
|
-
_context3.next =
|
|
539
|
+
_context3.next = 105;
|
|
537
540
|
break;
|
|
538
541
|
}
|
|
539
542
|
_context3.t11 = void 0;
|
|
540
|
-
_context3.next =
|
|
543
|
+
_context3.next = 106;
|
|
541
544
|
break;
|
|
542
|
-
case
|
|
545
|
+
case 105:
|
|
543
546
|
_context3.t11 = _yield$mem$get.data;
|
|
544
|
-
case
|
|
547
|
+
case 106:
|
|
545
548
|
_context3.t12 = _yield$mem$get$data = _context3.t11;
|
|
546
549
|
_context3.t8 = _context3.t12 !== null;
|
|
547
550
|
if (!_context3.t8) {
|
|
548
|
-
_context3.next =
|
|
551
|
+
_context3.next = 110;
|
|
549
552
|
break;
|
|
550
553
|
}
|
|
551
554
|
_context3.t8 = _yield$mem$get$data !== void 0;
|
|
552
|
-
case
|
|
555
|
+
case 110:
|
|
553
556
|
if (!_context3.t8) {
|
|
554
|
-
_context3.next =
|
|
557
|
+
_context3.next = 114;
|
|
555
558
|
break;
|
|
556
559
|
}
|
|
557
560
|
_context3.t13 = _yield$mem$get$data;
|
|
558
|
-
_context3.next =
|
|
561
|
+
_context3.next = 115;
|
|
559
562
|
break;
|
|
560
|
-
case
|
|
563
|
+
case 114:
|
|
561
564
|
_context3.t13 = "";
|
|
562
|
-
case
|
|
565
|
+
case 115:
|
|
563
566
|
data = _context3.t13;
|
|
564
|
-
case 114:
|
|
565
|
-
_context3.next = 116;
|
|
566
|
-
return genMsg(id, p, data, opt.tags, owner, msg_owner, true);
|
|
567
567
|
case 116:
|
|
568
|
+
_context3.next = 118;
|
|
569
|
+
return genMsg(id, p, data, opt.tags, owner, msg_owner, true);
|
|
570
|
+
case 118:
|
|
568
571
|
msg = _context3.sent;
|
|
569
|
-
_context3.next =
|
|
572
|
+
_context3.next = 121;
|
|
570
573
|
return genEnv({
|
|
571
574
|
pid: p.id,
|
|
572
575
|
owner: p.owner,
|
|
573
576
|
module: p.module
|
|
574
577
|
});
|
|
575
|
-
case
|
|
578
|
+
case 121:
|
|
576
579
|
_env = _context3.sent;
|
|
577
|
-
_context3.next =
|
|
580
|
+
_context3.next = 124;
|
|
578
581
|
return _module.handle(null, msg, _env);
|
|
579
|
-
case
|
|
582
|
+
case 124:
|
|
580
583
|
res = _context3.sent;
|
|
581
584
|
p.memory = res.Memory;
|
|
582
585
|
delete res.Memory;
|
|
583
|
-
_context3.next =
|
|
586
|
+
_context3.next = 130;
|
|
584
587
|
break;
|
|
585
|
-
case
|
|
588
|
+
case 129:
|
|
586
589
|
p.height += 1;
|
|
587
|
-
case
|
|
590
|
+
case 130:
|
|
588
591
|
_msg = _objectSpread(_objectSpread({}, (0, _ramda.o)((0, _ramda.dissoc)("signer"), (0, _ramda.dissoc)("memory"))(opt)), {}, {
|
|
589
592
|
res: res
|
|
590
593
|
});
|
|
591
|
-
_context3.next =
|
|
594
|
+
_context3.next = 133;
|
|
592
595
|
return mem.set(_msg, "msgs", id);
|
|
593
|
-
case
|
|
596
|
+
case 133:
|
|
594
597
|
if (!_tags["Cron-Interval"]) {
|
|
595
|
-
_context3.next =
|
|
598
|
+
_context3.next = 157;
|
|
596
599
|
break;
|
|
597
600
|
}
|
|
598
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];
|
|
599
602
|
_int = 0;
|
|
600
603
|
_context3.t14 = unit.replace(/s$/, "");
|
|
601
|
-
_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;
|
|
602
605
|
break;
|
|
603
|
-
case 137:
|
|
604
|
-
_int = num;
|
|
605
|
-
return _context3.abrupt("break", 151);
|
|
606
606
|
case 139:
|
|
607
|
-
_int = num
|
|
608
|
-
return _context3.abrupt("break",
|
|
607
|
+
_int = num;
|
|
608
|
+
return _context3.abrupt("break", 153);
|
|
609
609
|
case 141:
|
|
610
|
-
_int = num * 1000
|
|
611
|
-
return _context3.abrupt("break",
|
|
610
|
+
_int = num * 1000;
|
|
611
|
+
return _context3.abrupt("break", 153);
|
|
612
612
|
case 143:
|
|
613
|
-
_int = num * 1000 * 60
|
|
614
|
-
return _context3.abrupt("break",
|
|
613
|
+
_int = num * 1000 * 60;
|
|
614
|
+
return _context3.abrupt("break", 153);
|
|
615
615
|
case 145:
|
|
616
|
-
_int = num * 1000 * 60 * 60
|
|
617
|
-
return _context3.abrupt("break",
|
|
616
|
+
_int = num * 1000 * 60 * 60;
|
|
617
|
+
return _context3.abrupt("break", 153);
|
|
618
618
|
case 147:
|
|
619
|
-
_int = num * 1000 * 60 * 60 * 24
|
|
620
|
-
return _context3.abrupt("break",
|
|
619
|
+
_int = num * 1000 * 60 * 60 * 24;
|
|
620
|
+
return _context3.abrupt("break", 153);
|
|
621
621
|
case 149:
|
|
622
|
-
_int = num * 1000 * 60 * 60 * 24 *
|
|
623
|
-
return _context3.abrupt("break",
|
|
622
|
+
_int = num * 1000 * 60 * 60 * 24 * 30;
|
|
623
|
+
return _context3.abrupt("break", 153);
|
|
624
624
|
case 151:
|
|
625
|
+
_int = num * 1000 * 60 * 60 * 24 * 365;
|
|
626
|
+
return _context3.abrupt("break", 153);
|
|
627
|
+
case 153:
|
|
625
628
|
cronTags = [];
|
|
626
629
|
for (_k in _tags) {
|
|
627
630
|
if (/^Cron-Tag-/.test(_k)) {
|
|
@@ -633,16 +636,17 @@ var _default = exports["default"] = function _default() {
|
|
|
633
636
|
}
|
|
634
637
|
p.cronTags = cronTags;
|
|
635
638
|
p.span = _int;
|
|
636
|
-
case 155:
|
|
637
|
-
_context3.next = 157;
|
|
638
|
-
return mem.set(p, "env", id);
|
|
639
639
|
case 157:
|
|
640
|
+
_context3.next = 159;
|
|
641
|
+
return mem.set(p, "env", id);
|
|
642
|
+
case 159:
|
|
643
|
+
delete ongoing[id];
|
|
640
644
|
return _context3.abrupt("return", id);
|
|
641
|
-
case
|
|
645
|
+
case 161:
|
|
642
646
|
case "end":
|
|
643
647
|
return _context3.stop();
|
|
644
648
|
}
|
|
645
|
-
}, _callee3, null, [[
|
|
649
|
+
}, _callee3, null, [[59, 74]]);
|
|
646
650
|
}));
|
|
647
651
|
return function spawn() {
|
|
648
652
|
return _ref8.apply(this, arguments);
|
|
@@ -999,7 +1003,7 @@ var _default = exports["default"] = function _default() {
|
|
|
999
1003
|
}();
|
|
1000
1004
|
var message = /*#__PURE__*/function () {
|
|
1001
1005
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
|
|
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;
|
|
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;
|
|
1003
1007
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1004
1008
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1005
1009
|
case 0:
|
|
@@ -1007,72 +1011,75 @@ var _default = exports["default"] = function _default() {
|
|
|
1007
1011
|
owner = "";
|
|
1008
1012
|
item = null;
|
|
1009
1013
|
if (!ar.isHttpMsg(opt.http_msg)) {
|
|
1010
|
-
_context5.next =
|
|
1014
|
+
_context5.next = 35;
|
|
1011
1015
|
break;
|
|
1012
1016
|
}
|
|
1013
1017
|
id = (_opt$id2 = opt.id) !== null && _opt$id2 !== void 0 ? _opt$id2 : opt.http_msg.target;
|
|
1014
|
-
|
|
1015
|
-
|
|
1018
|
+
_key = "".concat(opt.process, ":").concat(id, "}");
|
|
1019
|
+
if (!ongoing[_key]) {
|
|
1020
|
+
_context5.next = 17;
|
|
1016
1021
|
break;
|
|
1017
1022
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1023
|
+
i = 0;
|
|
1024
|
+
case 8:
|
|
1025
|
+
if (!(i < 30 && ongoing[_key])) {
|
|
1026
|
+
_context5.next = 14;
|
|
1021
1027
|
break;
|
|
1022
1028
|
}
|
|
1023
|
-
_context5.next =
|
|
1029
|
+
_context5.next = 11;
|
|
1024
1030
|
return (0, _utils.wait)(100);
|
|
1025
|
-
case 9:
|
|
1026
|
-
_context5.next = 6;
|
|
1027
|
-
break;
|
|
1028
1031
|
case 11:
|
|
1029
|
-
|
|
1032
|
+
i++;
|
|
1033
|
+
_context5.next = 8;
|
|
1034
|
+
break;
|
|
1030
1035
|
case 14:
|
|
1031
|
-
|
|
1032
|
-
_context5.next = 17;
|
|
1033
|
-
return ar.httpmsg(opt.http_msg, id);
|
|
1036
|
+
return _context5.abrupt("return", id);
|
|
1034
1037
|
case 17:
|
|
1038
|
+
ongoing[_key] = true;
|
|
1039
|
+
_context5.next = 20;
|
|
1040
|
+
return ar.httpmsg(opt.http_msg, id);
|
|
1041
|
+
case 20:
|
|
1035
1042
|
_yield$ar$httpmsg2 = _context5.sent;
|
|
1036
1043
|
owner = _yield$ar$httpmsg2.owner;
|
|
1037
1044
|
item = _yield$ar$httpmsg2.item;
|
|
1038
|
-
_context5.next =
|
|
1045
|
+
_context5.next = 25;
|
|
1039
1046
|
return mem.get("env", opt.process);
|
|
1040
|
-
case
|
|
1047
|
+
case 25:
|
|
1041
1048
|
_p = _context5.sent;
|
|
1042
1049
|
new_slot = opt.slot * 1;
|
|
1043
1050
|
last_slot = !_p ? -1 : _p.results.length - 1;
|
|
1044
1051
|
if (!(last_slot + 1 < new_slot)) {
|
|
1045
|
-
_context5.next =
|
|
1052
|
+
_context5.next = 33;
|
|
1046
1053
|
break;
|
|
1047
1054
|
}
|
|
1048
1055
|
if (!(!hb || opt.recovery)) {
|
|
1049
|
-
_context5.next =
|
|
1056
|
+
_context5.next = 31;
|
|
1050
1057
|
break;
|
|
1051
1058
|
}
|
|
1052
1059
|
return _context5.abrupt("return", null);
|
|
1053
|
-
case
|
|
1054
|
-
_context5.next =
|
|
1060
|
+
case 31:
|
|
1061
|
+
_context5.next = 33;
|
|
1055
1062
|
return _recover(opt.process);
|
|
1056
|
-
case
|
|
1057
|
-
_context5.next =
|
|
1063
|
+
case 33:
|
|
1064
|
+
_context5.next = 38;
|
|
1058
1065
|
break;
|
|
1059
|
-
case
|
|
1066
|
+
case 35:
|
|
1060
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 : "";
|
|
1061
1068
|
_owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
|
|
1062
1069
|
_item = opt.item;
|
|
1063
|
-
case
|
|
1064
|
-
_context5.next =
|
|
1070
|
+
case 38:
|
|
1071
|
+
_context5.next = 40;
|
|
1065
1072
|
return mem.get("env", opt.process);
|
|
1066
|
-
case
|
|
1073
|
+
case 40:
|
|
1067
1074
|
p = _context5.sent;
|
|
1068
1075
|
if (p) {
|
|
1069
|
-
_context5.next =
|
|
1076
|
+
_context5.next = 43;
|
|
1070
1077
|
break;
|
|
1071
1078
|
}
|
|
1072
1079
|
return _context5.abrupt("return", null);
|
|
1073
|
-
case
|
|
1080
|
+
case 43:
|
|
1074
1081
|
if (!(!opt.item && opt.signer)) {
|
|
1075
|
-
_context5.next =
|
|
1082
|
+
_context5.next = 78;
|
|
1076
1083
|
break;
|
|
1077
1084
|
}
|
|
1078
1085
|
opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
|
|
@@ -1082,7 +1089,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1082
1089
|
SDK: "aoconnect"
|
|
1083
1090
|
}));
|
|
1084
1091
|
if (!opt["for"]) {
|
|
1085
|
-
_context5.next =
|
|
1092
|
+
_context5.next = 71;
|
|
1086
1093
|
break;
|
|
1087
1094
|
}
|
|
1088
1095
|
opt.tags.push({
|
|
@@ -1093,100 +1100,100 @@ var _default = exports["default"] = function _default() {
|
|
|
1093
1100
|
name: "From-Process",
|
|
1094
1101
|
value: opt.from
|
|
1095
1102
|
});
|
|
1096
|
-
_context5.next =
|
|
1103
|
+
_context5.next = 50;
|
|
1097
1104
|
return mem.getTx(opt.from);
|
|
1098
|
-
case
|
|
1105
|
+
case 50:
|
|
1099
1106
|
_context5.t2 = _yield$mem$getTx4 = _context5.sent;
|
|
1100
1107
|
_context5.t1 = _context5.t2 === null;
|
|
1101
1108
|
if (_context5.t1) {
|
|
1102
|
-
_context5.next =
|
|
1109
|
+
_context5.next = 54;
|
|
1103
1110
|
break;
|
|
1104
1111
|
}
|
|
1105
1112
|
_context5.t1 = _yield$mem$getTx4 === void 0;
|
|
1106
|
-
case
|
|
1113
|
+
case 54:
|
|
1107
1114
|
if (!_context5.t1) {
|
|
1108
|
-
_context5.next =
|
|
1115
|
+
_context5.next = 58;
|
|
1109
1116
|
break;
|
|
1110
1117
|
}
|
|
1111
1118
|
_context5.t3 = void 0;
|
|
1112
|
-
_context5.next =
|
|
1119
|
+
_context5.next = 59;
|
|
1113
1120
|
break;
|
|
1114
|
-
case
|
|
1121
|
+
case 58:
|
|
1115
1122
|
_context5.t3 = _yield$mem$getTx4.tags;
|
|
1116
|
-
case
|
|
1123
|
+
case 59:
|
|
1117
1124
|
_context5.t4 = _yield$mem$getTx$tags3 = _context5.t3;
|
|
1118
1125
|
_context5.t0 = _context5.t4 !== null;
|
|
1119
1126
|
if (!_context5.t0) {
|
|
1120
|
-
_context5.next =
|
|
1127
|
+
_context5.next = 63;
|
|
1121
1128
|
break;
|
|
1122
1129
|
}
|
|
1123
1130
|
_context5.t0 = _yield$mem$getTx$tags3 !== void 0;
|
|
1124
|
-
case
|
|
1131
|
+
case 63:
|
|
1125
1132
|
if (!_context5.t0) {
|
|
1126
|
-
_context5.next =
|
|
1133
|
+
_context5.next = 67;
|
|
1127
1134
|
break;
|
|
1128
1135
|
}
|
|
1129
1136
|
_context5.t5 = _yield$mem$getTx$tags3;
|
|
1130
|
-
_context5.next =
|
|
1137
|
+
_context5.next = 68;
|
|
1131
1138
|
break;
|
|
1132
|
-
case
|
|
1139
|
+
case 67:
|
|
1133
1140
|
_context5.t5 = [];
|
|
1134
|
-
case
|
|
1141
|
+
case 68:
|
|
1135
1142
|
pr = _context5.t5;
|
|
1136
1143
|
module = (0, _utils.tags)(pr).Module;
|
|
1137
1144
|
if (module) opt.tags.push({
|
|
1138
1145
|
name: "From-Module",
|
|
1139
1146
|
value: module
|
|
1140
1147
|
});
|
|
1141
|
-
case
|
|
1148
|
+
case 71:
|
|
1142
1149
|
;
|
|
1143
|
-
_context5.next =
|
|
1150
|
+
_context5.next = 74;
|
|
1144
1151
|
return ar.dataitem({
|
|
1145
1152
|
data: opt.data,
|
|
1146
1153
|
signer: opt.signer,
|
|
1147
1154
|
tags: (0, _utils.tags)(opt.tags),
|
|
1148
1155
|
target: opt.process
|
|
1149
1156
|
});
|
|
1150
|
-
case
|
|
1157
|
+
case 74:
|
|
1151
1158
|
_yield$ar$dataitem3 = _context5.sent;
|
|
1152
1159
|
item = _yield$ar$dataitem3.item;
|
|
1153
1160
|
id = _yield$ar$dataitem3.id;
|
|
1154
1161
|
owner = _yield$ar$dataitem3.owner;
|
|
1155
|
-
case
|
|
1162
|
+
case 78:
|
|
1156
1163
|
_msg = (0, _ramda.dissoc)("signer", opt);
|
|
1157
|
-
_context5.next =
|
|
1164
|
+
_context5.next = 81;
|
|
1158
1165
|
return mem.set(_msg, "msgs", id);
|
|
1159
|
-
case
|
|
1166
|
+
case 81:
|
|
1160
1167
|
if (!ar.isHttpMsg(opt.http_msg)) {
|
|
1161
|
-
_context5.next =
|
|
1168
|
+
_context5.next = 145;
|
|
1162
1169
|
break;
|
|
1163
1170
|
}
|
|
1164
1171
|
p.epochs.push([id]);
|
|
1165
1172
|
_opt = opt;
|
|
1166
|
-
_context5.prev =
|
|
1173
|
+
_context5.prev = 84;
|
|
1167
1174
|
// todo: not sure if this is correct
|
|
1168
1175
|
from = (_ref12 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref12 !== void 0 ? _ref12 : owner;
|
|
1169
1176
|
data = (_opt$http_msg$data = opt.http_msg.data) !== null && _opt$http_msg$data !== void 0 ? _opt$http_msg$data : "";
|
|
1170
1177
|
_tags = _opt.http_msg.tags; // todo: check if owner=mu.addr right?
|
|
1171
|
-
_context5.next =
|
|
1178
|
+
_context5.next = 90;
|
|
1172
1179
|
return genMsg(opt.http_msg, p, data, _tags, from, owner);
|
|
1173
|
-
case
|
|
1180
|
+
case 90:
|
|
1174
1181
|
msg = _context5.sent;
|
|
1175
|
-
_context5.next =
|
|
1182
|
+
_context5.next = 93;
|
|
1176
1183
|
return genEnv({
|
|
1177
1184
|
pid: p.id,
|
|
1178
1185
|
owner: p.owner,
|
|
1179
1186
|
module: p.module
|
|
1180
1187
|
});
|
|
1181
|
-
case
|
|
1188
|
+
case 93:
|
|
1182
1189
|
_env = _context5.sent;
|
|
1183
1190
|
if (p.handle) {
|
|
1184
|
-
_context5.next =
|
|
1191
|
+
_context5.next = 126;
|
|
1185
1192
|
break;
|
|
1186
1193
|
}
|
|
1187
|
-
_context5.next =
|
|
1194
|
+
_context5.next = 97;
|
|
1188
1195
|
return mem.getWasm(p.modulea);
|
|
1189
|
-
case
|
|
1196
|
+
case 97:
|
|
1190
1197
|
_yield$mem$getWasm3 = _context5.sent;
|
|
1191
1198
|
format = _yield$mem$getWasm3.format;
|
|
1192
1199
|
mod = _yield$mem$getWasm3.mod;
|
|
@@ -1196,31 +1203,31 @@ var _default = exports["default"] = function _default() {
|
|
|
1196
1203
|
_context5.t7 = wasm;
|
|
1197
1204
|
_context5.t8 = format;
|
|
1198
1205
|
_context5.t9 = wdrive;
|
|
1199
|
-
_context5.next =
|
|
1206
|
+
_context5.next = 108;
|
|
1200
1207
|
return mem.getTx(p.id);
|
|
1201
|
-
case
|
|
1208
|
+
case 108:
|
|
1202
1209
|
_context5.t11 = _yield$mem$getTx5 = _context5.sent;
|
|
1203
1210
|
_context5.t10 = _context5.t11 === null;
|
|
1204
1211
|
if (_context5.t10) {
|
|
1205
|
-
_context5.next =
|
|
1212
|
+
_context5.next = 112;
|
|
1206
1213
|
break;
|
|
1207
1214
|
}
|
|
1208
1215
|
_context5.t10 = _yield$mem$getTx5 === void 0;
|
|
1209
|
-
case
|
|
1216
|
+
case 112:
|
|
1210
1217
|
if (!_context5.t10) {
|
|
1211
|
-
_context5.next =
|
|
1218
|
+
_context5.next = 116;
|
|
1212
1219
|
break;
|
|
1213
1220
|
}
|
|
1214
1221
|
_context5.t12 = void 0;
|
|
1215
|
-
_context5.next =
|
|
1222
|
+
_context5.next = 117;
|
|
1216
1223
|
break;
|
|
1217
|
-
case
|
|
1224
|
+
case 116:
|
|
1218
1225
|
_context5.t12 = _yield$mem$getTx5.item;
|
|
1219
|
-
case
|
|
1226
|
+
case 117:
|
|
1220
1227
|
_context5.t13 = _context5.t12;
|
|
1221
|
-
_context5.next =
|
|
1228
|
+
_context5.next = 120;
|
|
1222
1229
|
return mem.getTx(mod);
|
|
1223
|
-
case
|
|
1230
|
+
case 120:
|
|
1224
1231
|
_context5.t14 = _context5.sent;
|
|
1225
1232
|
_context5.t15 = {
|
|
1226
1233
|
format: _context5.t8,
|
|
@@ -1228,43 +1235,44 @@ var _default = exports["default"] = function _default() {
|
|
|
1228
1235
|
spawn: _context5.t13,
|
|
1229
1236
|
module: _context5.t14
|
|
1230
1237
|
};
|
|
1231
|
-
_context5.next =
|
|
1238
|
+
_context5.next = 124;
|
|
1232
1239
|
return (0, _context5.t6)(_context5.t7, _context5.t15);
|
|
1233
|
-
case
|
|
1240
|
+
case 124:
|
|
1234
1241
|
p.handle = _context5.sent;
|
|
1235
1242
|
mem.env[opt.process].handle = p.handle;
|
|
1236
|
-
case
|
|
1243
|
+
case 126:
|
|
1237
1244
|
if (p.compressed) {
|
|
1238
1245
|
start = Date.now();
|
|
1239
1246
|
p.memory = mem.waosm.decompress(p.memory, p.original_size);
|
|
1240
1247
|
p.compressed = false;
|
|
1241
1248
|
}
|
|
1242
|
-
_context5.next =
|
|
1249
|
+
_context5.next = 129;
|
|
1243
1250
|
return p.handle(p.memory, msg, _env);
|
|
1244
|
-
case
|
|
1251
|
+
case 129:
|
|
1245
1252
|
res = _context5.sent;
|
|
1246
1253
|
p.memory = res.Memory;
|
|
1247
1254
|
delete res.Memory;
|
|
1248
1255
|
p.results.push(id);
|
|
1249
|
-
_context5.next =
|
|
1256
|
+
_context5.next = 135;
|
|
1250
1257
|
return mem.set(p, "env", opt.process);
|
|
1251
|
-
case
|
|
1258
|
+
case 135:
|
|
1252
1259
|
_msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
|
|
1253
1260
|
res: res
|
|
1254
1261
|
});
|
|
1255
|
-
_context5.next =
|
|
1262
|
+
_context5.next = 138;
|
|
1256
1263
|
return mem.set(_msg2, "msgs", id);
|
|
1257
|
-
case 135:
|
|
1258
|
-
return _context5.abrupt("return", id);
|
|
1259
1264
|
case 138:
|
|
1260
|
-
_context5.
|
|
1261
|
-
_context5.t16 = _context5["catch"](81);
|
|
1262
|
-
console.log(_context5.t16);
|
|
1263
|
-
case 141:
|
|
1264
|
-
_context5.next = 145;
|
|
1265
|
+
_context5.next = 143;
|
|
1265
1266
|
break;
|
|
1267
|
+
case 140:
|
|
1268
|
+
_context5.prev = 140;
|
|
1269
|
+
_context5.t16 = _context5["catch"](84);
|
|
1270
|
+
console.log(_context5.t16);
|
|
1266
1271
|
case 143:
|
|
1267
|
-
_context5.next =
|
|
1272
|
+
_context5.next = 147;
|
|
1273
|
+
break;
|
|
1274
|
+
case 145:
|
|
1275
|
+
_context5.next = 147;
|
|
1268
1276
|
return _assign({
|
|
1269
1277
|
message_item: item,
|
|
1270
1278
|
message: id,
|
|
@@ -1272,14 +1280,15 @@ var _default = exports["default"] = function _default() {
|
|
|
1272
1280
|
from: owner,
|
|
1273
1281
|
signer: mu.signer
|
|
1274
1282
|
});
|
|
1275
|
-
case 145:
|
|
1276
|
-
delete ongoing[id];
|
|
1277
|
-
return _context5.abrupt("return", id);
|
|
1278
1283
|
case 147:
|
|
1284
|
+
key = "".concat(opt.process, ":").concat(id, "}");
|
|
1285
|
+
delete ongoing[key];
|
|
1286
|
+
return _context5.abrupt("return", id);
|
|
1287
|
+
case 150:
|
|
1279
1288
|
case "end":
|
|
1280
1289
|
return _context5.stop();
|
|
1281
1290
|
}
|
|
1282
|
-
}, _callee5, null, [[
|
|
1291
|
+
}, _callee5, null, [[84, 140]]);
|
|
1283
1292
|
}));
|
|
1284
1293
|
return function message(_x9) {
|
|
1285
1294
|
return _ref11.apply(this, arguments);
|
package/esm/aoconnect-base.js
CHANGED
|
@@ -114,7 +114,11 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
114
114
|
if (ar.isHttpMsg(opt.http_msg)) {
|
|
115
115
|
id = opt.id ?? opt.http_msg.target
|
|
116
116
|
if (ongoing[id]) {
|
|
117
|
-
|
|
117
|
+
let i = 0
|
|
118
|
+
while (i < 30 && ongoing[id]) {
|
|
119
|
+
await wait(100)
|
|
120
|
+
i++
|
|
121
|
+
}
|
|
118
122
|
return id
|
|
119
123
|
} else {
|
|
120
124
|
ongoing[id] = true
|
|
@@ -248,6 +252,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
248
252
|
p.span = int
|
|
249
253
|
}
|
|
250
254
|
await mem.set(p, "env", id)
|
|
255
|
+
delete ongoing[id]
|
|
251
256
|
return id
|
|
252
257
|
}
|
|
253
258
|
|
|
@@ -377,7 +382,6 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
377
382
|
})
|
|
378
383
|
}
|
|
379
384
|
}
|
|
380
|
-
|
|
381
385
|
return id
|
|
382
386
|
} catch (e) {
|
|
383
387
|
console.log(e)
|
|
@@ -390,11 +394,16 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
390
394
|
let item = null
|
|
391
395
|
if (ar.isHttpMsg(opt.http_msg)) {
|
|
392
396
|
id = opt.id ?? opt.http_msg.target
|
|
393
|
-
|
|
394
|
-
|
|
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
|
+
}
|
|
395
404
|
return id
|
|
396
405
|
} else {
|
|
397
|
-
ongoing[
|
|
406
|
+
ongoing[key] = true
|
|
398
407
|
;({ owner, item } = await ar.httpmsg(opt.http_msg, id))
|
|
399
408
|
// check if process exists, and recover if necessary
|
|
400
409
|
const p = await mem.get("env", opt.process)
|
|
@@ -477,7 +486,6 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
477
486
|
await mem.set(p, "env", opt.process)
|
|
478
487
|
const _msg = { ...dissoc("signer", _opt), res }
|
|
479
488
|
await mem.set(_msg, "msgs", id)
|
|
480
|
-
return id
|
|
481
489
|
} catch (e) {
|
|
482
490
|
console.log(e)
|
|
483
491
|
}
|
|
@@ -490,7 +498,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
490
498
|
signer: mu.signer,
|
|
491
499
|
})
|
|
492
500
|
}
|
|
493
|
-
|
|
501
|
+
const key = `${opt.process}:${id}}`
|
|
502
|
+
delete ongoing[key]
|
|
494
503
|
return id
|
|
495
504
|
}
|
|
496
505
|
const recover = async (pid, next) => {
|