wao 0.32.1 → 0.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/hb.js +474 -690
- package/cjs/send.js +6 -2
- package/cjs/workspace/package.json +1 -1
- package/esm/hb.js +68 -218
- package/esm/send.js +8 -4
- package/esm/signer.js +0 -1
- package/esm/workspace/package.json +1 -1
- package/package.json +1 -1
- package/cjs/hb2.js +0 -1505
- package/cjs/hb3.js +0 -1468
- package/esm/hb2.js +0 -439
- package/esm/hb3.js +0 -418
package/cjs/hb.js
CHANGED
|
@@ -13,7 +13,10 @@ var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
|
|
|
13
13
|
var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
|
|
14
14
|
var _httpsig = require("./httpsig.js");
|
|
15
15
|
var _excluded = ["path"],
|
|
16
|
-
_excluded2 = ["
|
|
16
|
+
_excluded2 = ["action", "tags"],
|
|
17
|
+
_excluded3 = ["action", "tags"],
|
|
18
|
+
_excluded4 = ["path"],
|
|
19
|
+
_excluded5 = ["action", "tags"];
|
|
17
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
21
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19
22
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -109,7 +112,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
109
112
|
while (1) switch (_context2.prev = _context2.next) {
|
|
110
113
|
case 0:
|
|
111
114
|
if (this._info) {
|
|
112
|
-
_context2.next =
|
|
115
|
+
_context2.next = 10;
|
|
113
116
|
break;
|
|
114
117
|
}
|
|
115
118
|
_context2.prev = 1;
|
|
@@ -117,16 +120,17 @@ var HB = /*#__PURE__*/function () {
|
|
|
117
120
|
return this.g("/~meta@1.0/info");
|
|
118
121
|
case 4:
|
|
119
122
|
this._info = _context2.sent;
|
|
120
|
-
|
|
123
|
+
this.operator = this._info.address;
|
|
124
|
+
_context2.next = 10;
|
|
121
125
|
break;
|
|
122
|
-
case
|
|
123
|
-
_context2.prev =
|
|
126
|
+
case 8:
|
|
127
|
+
_context2.prev = 8;
|
|
124
128
|
_context2.t0 = _context2["catch"](1);
|
|
125
|
-
case
|
|
129
|
+
case 10:
|
|
126
130
|
case "end":
|
|
127
131
|
return _context2.stop();
|
|
128
132
|
}
|
|
129
|
-
}, _callee2, this, [[1,
|
|
133
|
+
}, _callee2, this, [[1, 8]]);
|
|
130
134
|
}));
|
|
131
135
|
function setInfo() {
|
|
132
136
|
return _setInfo.apply(this, arguments);
|
|
@@ -416,148 +420,57 @@ var HB = /*#__PURE__*/function () {
|
|
|
416
420
|
}
|
|
417
421
|
return computeLegacy;
|
|
418
422
|
}()
|
|
419
|
-
}, {
|
|
420
|
-
key: "spawn",
|
|
421
|
-
value: function () {
|
|
422
|
-
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
423
|
-
var _this$scheduler;
|
|
424
|
-
var tags,
|
|
425
|
-
addr,
|
|
426
|
-
res,
|
|
427
|
-
_args14 = arguments;
|
|
428
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
429
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
430
|
-
case 0:
|
|
431
|
-
tags = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
432
|
-
_context13.next = 3;
|
|
433
|
-
return this.g("/~meta@1.0/info/address");
|
|
434
|
-
case 3:
|
|
435
|
-
addr = _context13.sent;
|
|
436
|
-
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
437
|
-
_context13.next = 7;
|
|
438
|
-
return this.post({
|
|
439
|
-
path: "/~process@1.0/schedule",
|
|
440
|
-
body: (0, _ramda.mergeLeft)(tags, {
|
|
441
|
-
device: "process@1.0",
|
|
442
|
-
"random-seed": seed(16),
|
|
443
|
-
type: "Process",
|
|
444
|
-
"execution-device": "test-device@1.0"
|
|
445
|
-
}),
|
|
446
|
-
scheduler: this.scheduler
|
|
447
|
-
});
|
|
448
|
-
case 7:
|
|
449
|
-
res = _context13.sent;
|
|
450
|
-
return _context13.abrupt("return", {
|
|
451
|
-
res: res,
|
|
452
|
-
pid: res.out.process
|
|
453
|
-
});
|
|
454
|
-
case 9:
|
|
455
|
-
case "end":
|
|
456
|
-
return _context13.stop();
|
|
457
|
-
}
|
|
458
|
-
}, _callee13, this);
|
|
459
|
-
}));
|
|
460
|
-
function spawn() {
|
|
461
|
-
return _spawn.apply(this, arguments);
|
|
462
|
-
}
|
|
463
|
-
return spawn;
|
|
464
|
-
}()
|
|
465
|
-
}, {
|
|
466
|
-
key: "spawn2",
|
|
467
|
-
value: function () {
|
|
468
|
-
var _spawn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
469
|
-
var _this$scheduler2;
|
|
470
|
-
var tags,
|
|
471
|
-
addr,
|
|
472
|
-
_tags,
|
|
473
|
-
res,
|
|
474
|
-
_args15 = arguments;
|
|
475
|
-
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
476
|
-
while (1) switch (_context14.prev = _context14.next) {
|
|
477
|
-
case 0:
|
|
478
|
-
tags = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
479
|
-
_context14.next = 3;
|
|
480
|
-
return this.g("/~meta@1.0/info/address");
|
|
481
|
-
case 3:
|
|
482
|
-
addr = _context14.sent;
|
|
483
|
-
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
484
|
-
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
485
|
-
path: "/~process@1.0/schedule",
|
|
486
|
-
scheduler: this.scheduler,
|
|
487
|
-
"random-seed": seed(16),
|
|
488
|
-
type: "Process",
|
|
489
|
-
"execution-device": "test-device@1.0"
|
|
490
|
-
});
|
|
491
|
-
_context14.next = 8;
|
|
492
|
-
return this.post(_tags, {
|
|
493
|
-
path: false
|
|
494
|
-
});
|
|
495
|
-
case 8:
|
|
496
|
-
res = _context14.sent;
|
|
497
|
-
return _context14.abrupt("return", {
|
|
498
|
-
res: res,
|
|
499
|
-
pid: res.headers.process
|
|
500
|
-
});
|
|
501
|
-
case 10:
|
|
502
|
-
case "end":
|
|
503
|
-
return _context14.stop();
|
|
504
|
-
}
|
|
505
|
-
}, _callee14, this);
|
|
506
|
-
}));
|
|
507
|
-
function spawn2() {
|
|
508
|
-
return _spawn2.apply(this, arguments);
|
|
509
|
-
}
|
|
510
|
-
return spawn2;
|
|
511
|
-
}()
|
|
512
423
|
}, {
|
|
513
424
|
key: "cacheScript",
|
|
514
425
|
value: function () {
|
|
515
|
-
var _cacheScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
426
|
+
var _cacheScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(data) {
|
|
516
427
|
var type,
|
|
517
428
|
_yield$this$spawn,
|
|
518
429
|
pid,
|
|
519
|
-
_yield$this$
|
|
430
|
+
_yield$this$scheduleF,
|
|
520
431
|
slot,
|
|
521
432
|
msgs,
|
|
522
|
-
|
|
523
|
-
return _regeneratorRuntime().wrap(function
|
|
524
|
-
while (1) switch (
|
|
433
|
+
_args14 = arguments;
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
435
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
525
436
|
case 0:
|
|
526
|
-
type =
|
|
437
|
+
type = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : "application/lua";
|
|
527
438
|
if (this.cache) {
|
|
528
|
-
|
|
439
|
+
_context13.next = 7;
|
|
529
440
|
break;
|
|
530
441
|
}
|
|
531
|
-
|
|
442
|
+
_context13.next = 4;
|
|
532
443
|
return this.spawn({});
|
|
533
444
|
case 4:
|
|
534
|
-
_yield$this$spawn =
|
|
445
|
+
_yield$this$spawn = _context13.sent;
|
|
535
446
|
pid = _yield$this$spawn.pid;
|
|
536
447
|
this.cache = pid;
|
|
537
448
|
case 7:
|
|
538
|
-
|
|
539
|
-
return this.
|
|
449
|
+
_context13.next = 9;
|
|
450
|
+
return this.scheduleFlat({
|
|
540
451
|
data: data,
|
|
541
452
|
pid: this.cache,
|
|
542
|
-
|
|
453
|
+
tags: {
|
|
454
|
+
"content-type": type
|
|
455
|
+
}
|
|
543
456
|
});
|
|
544
457
|
case 9:
|
|
545
|
-
_yield$this$
|
|
546
|
-
slot = _yield$this$
|
|
547
|
-
|
|
458
|
+
_yield$this$scheduleF = _context13.sent;
|
|
459
|
+
slot = _yield$this$scheduleF.slot;
|
|
460
|
+
_context13.next = 13;
|
|
548
461
|
return this.messages({
|
|
549
462
|
pid: this.cache,
|
|
550
463
|
from: slot,
|
|
551
464
|
limit: 1
|
|
552
465
|
});
|
|
553
466
|
case 13:
|
|
554
|
-
msgs =
|
|
555
|
-
return
|
|
467
|
+
msgs = _context13.sent;
|
|
468
|
+
return _context13.abrupt("return", msgs.edges[0].node.message.Id);
|
|
556
469
|
case 15:
|
|
557
470
|
case "end":
|
|
558
|
-
return
|
|
471
|
+
return _context13.stop();
|
|
559
472
|
}
|
|
560
|
-
},
|
|
473
|
+
}, _callee13, this);
|
|
561
474
|
}));
|
|
562
475
|
function cacheScript(_x10) {
|
|
563
476
|
return _cacheScript.apply(this, arguments);
|
|
@@ -567,25 +480,25 @@ var HB = /*#__PURE__*/function () {
|
|
|
567
480
|
}, {
|
|
568
481
|
key: "cacheBinary",
|
|
569
482
|
value: function () {
|
|
570
|
-
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
483
|
+
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(data, type) {
|
|
571
484
|
var res;
|
|
572
|
-
return _regeneratorRuntime().wrap(function
|
|
573
|
-
while (1) switch (
|
|
485
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
486
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
574
487
|
case 0:
|
|
575
|
-
|
|
488
|
+
_context14.next = 2;
|
|
576
489
|
return this.post({
|
|
577
490
|
path: "/~wao@1.0/cache_module",
|
|
578
491
|
data: data,
|
|
579
492
|
type: type
|
|
580
493
|
});
|
|
581
494
|
case 2:
|
|
582
|
-
res =
|
|
583
|
-
return
|
|
495
|
+
res = _context14.sent;
|
|
496
|
+
return _context14.abrupt("return", res.out.id);
|
|
584
497
|
case 4:
|
|
585
498
|
case "end":
|
|
586
|
-
return
|
|
499
|
+
return _context14.stop();
|
|
587
500
|
}
|
|
588
|
-
},
|
|
501
|
+
}, _callee14, this);
|
|
589
502
|
}));
|
|
590
503
|
function cacheBinary(_x11, _x12) {
|
|
591
504
|
return _cacheBinary.apply(this, arguments);
|
|
@@ -595,34 +508,34 @@ var HB = /*#__PURE__*/function () {
|
|
|
595
508
|
}, {
|
|
596
509
|
key: "message",
|
|
597
510
|
value: function () {
|
|
598
|
-
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
599
|
-
var pid, _yield$this$
|
|
600
|
-
return _regeneratorRuntime().wrap(function
|
|
601
|
-
while (1) switch (
|
|
511
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(args) {
|
|
512
|
+
var pid, _yield$this$schedule, slot, res;
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
514
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
602
515
|
case 0:
|
|
603
516
|
pid = args.pid;
|
|
604
|
-
|
|
517
|
+
_context15.next = 3;
|
|
605
518
|
return this.schedule(args);
|
|
606
519
|
case 3:
|
|
607
|
-
_yield$this$
|
|
608
|
-
slot = _yield$this$
|
|
609
|
-
|
|
520
|
+
_yield$this$schedule = _context15.sent;
|
|
521
|
+
slot = _yield$this$schedule.slot;
|
|
522
|
+
_context15.next = 7;
|
|
610
523
|
return this.compute({
|
|
611
524
|
pid: pid,
|
|
612
525
|
slot: slot
|
|
613
526
|
});
|
|
614
527
|
case 7:
|
|
615
|
-
res =
|
|
616
|
-
return
|
|
528
|
+
res = _context15.sent;
|
|
529
|
+
return _context15.abrupt("return", {
|
|
617
530
|
slot: slot,
|
|
618
531
|
pid: pid,
|
|
619
532
|
res: res
|
|
620
533
|
});
|
|
621
534
|
case 9:
|
|
622
535
|
case "end":
|
|
623
|
-
return
|
|
536
|
+
return _context15.stop();
|
|
624
537
|
}
|
|
625
|
-
},
|
|
538
|
+
}, _callee15, this);
|
|
626
539
|
}));
|
|
627
540
|
function message(_x13) {
|
|
628
541
|
return _message.apply(this, arguments);
|
|
@@ -630,9 +543,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
630
543
|
return message;
|
|
631
544
|
}()
|
|
632
545
|
}, {
|
|
633
|
-
key: "
|
|
546
|
+
key: "scheduleFlat",
|
|
634
547
|
value: function () {
|
|
635
|
-
var
|
|
548
|
+
var _scheduleFlat = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
636
549
|
var _ref6,
|
|
637
550
|
pid,
|
|
638
551
|
_ref6$tags,
|
|
@@ -640,227 +553,207 @@ var HB = /*#__PURE__*/function () {
|
|
|
640
553
|
data,
|
|
641
554
|
_tags,
|
|
642
555
|
res,
|
|
643
|
-
|
|
644
|
-
return _regeneratorRuntime().wrap(function
|
|
645
|
-
while (1) switch (
|
|
556
|
+
_args17 = arguments;
|
|
557
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
558
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
646
559
|
case 0:
|
|
647
|
-
_ref6 =
|
|
560
|
+
_ref6 = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {}, pid = _ref6.pid, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, data = _ref6.data;
|
|
648
561
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
649
|
-
method: "POST",
|
|
650
|
-
path: "/".concat(pid, "/schedule"),
|
|
651
562
|
type: "Message",
|
|
652
563
|
target: pid
|
|
653
564
|
});
|
|
654
565
|
if (data) _tags.data = data;
|
|
655
|
-
|
|
656
|
-
return this.post(
|
|
657
|
-
path:
|
|
566
|
+
_context16.next = 5;
|
|
567
|
+
return this.post({
|
|
568
|
+
path: "/~process@1.0/schedule",
|
|
569
|
+
body: _tags
|
|
658
570
|
});
|
|
659
571
|
case 5:
|
|
660
|
-
res =
|
|
661
|
-
return
|
|
662
|
-
slot: res.
|
|
572
|
+
res = _context16.sent;
|
|
573
|
+
return _context16.abrupt("return", {
|
|
574
|
+
slot: res.out.slot,
|
|
663
575
|
res: res,
|
|
664
576
|
pid: pid
|
|
665
577
|
});
|
|
666
578
|
case 7:
|
|
667
579
|
case "end":
|
|
668
|
-
return
|
|
580
|
+
return _context16.stop();
|
|
669
581
|
}
|
|
670
|
-
},
|
|
582
|
+
}, _callee16, this);
|
|
671
583
|
}));
|
|
672
|
-
function
|
|
673
|
-
return
|
|
584
|
+
function scheduleFlat() {
|
|
585
|
+
return _scheduleFlat.apply(this, arguments);
|
|
674
586
|
}
|
|
675
|
-
return
|
|
587
|
+
return scheduleFlat;
|
|
676
588
|
}()
|
|
677
589
|
}, {
|
|
678
|
-
key: "
|
|
590
|
+
key: "scheduleNP",
|
|
679
591
|
value: function () {
|
|
680
|
-
var
|
|
592
|
+
var _scheduleNP = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
681
593
|
var _ref7,
|
|
682
594
|
pid,
|
|
683
|
-
_ref7$action,
|
|
684
|
-
action,
|
|
685
595
|
_ref7$tags,
|
|
686
596
|
tags,
|
|
687
597
|
data,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return _regeneratorRuntime().wrap(function
|
|
691
|
-
while (1) switch (
|
|
598
|
+
res,
|
|
599
|
+
_args18 = arguments;
|
|
600
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
601
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
692
602
|
case 0:
|
|
693
|
-
_ref7 =
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
603
|
+
_ref7 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, pid = _ref7.pid, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data;
|
|
604
|
+
if (data) tags.data = data;
|
|
605
|
+
_context17.t0 = this;
|
|
606
|
+
_context17.t1 = "/".concat(pid, "~node-process@1.0/schedule");
|
|
607
|
+
_context17.next = 6;
|
|
608
|
+
return this.commit(tags);
|
|
609
|
+
case 6:
|
|
610
|
+
_context17.t2 = _context17.sent;
|
|
611
|
+
_context17.t3 = {
|
|
612
|
+
path: _context17.t1,
|
|
613
|
+
body: _context17.t2
|
|
614
|
+
};
|
|
615
|
+
_context17.next = 10;
|
|
616
|
+
return _context17.t0.post.call(_context17.t0, _context17.t3);
|
|
617
|
+
case 10:
|
|
618
|
+
res = _context17.sent;
|
|
619
|
+
return _context17.abrupt("return", {
|
|
620
|
+
slot: res.out.slot,
|
|
621
|
+
res: res,
|
|
622
|
+
pid: pid
|
|
701
623
|
});
|
|
702
|
-
case
|
|
703
|
-
return _context19.abrupt("return", _context19.sent);
|
|
704
|
-
case 4:
|
|
624
|
+
case 12:
|
|
705
625
|
case "end":
|
|
706
|
-
return
|
|
626
|
+
return _context17.stop();
|
|
707
627
|
}
|
|
708
|
-
},
|
|
628
|
+
}, _callee17, this);
|
|
709
629
|
}));
|
|
710
|
-
function
|
|
711
|
-
return
|
|
630
|
+
function scheduleNP() {
|
|
631
|
+
return _scheduleNP.apply(this, arguments);
|
|
712
632
|
}
|
|
713
|
-
return
|
|
633
|
+
return scheduleNP;
|
|
714
634
|
}()
|
|
715
635
|
}, {
|
|
716
|
-
key: "
|
|
636
|
+
key: "schedule",
|
|
717
637
|
value: function () {
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
|
|
638
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
639
|
+
var _ref8,
|
|
640
|
+
pid,
|
|
641
|
+
_ref8$tags,
|
|
642
|
+
tags,
|
|
643
|
+
data,
|
|
644
|
+
_tags,
|
|
645
|
+
res,
|
|
646
|
+
_args19 = arguments;
|
|
647
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
648
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
722
649
|
case 0:
|
|
723
|
-
|
|
724
|
-
if (action) tags.Action = action;
|
|
650
|
+
_ref8 = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {}, pid = _ref8.pid, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data;
|
|
725
651
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
726
|
-
path: "/".concat(pid, "/schedule"),
|
|
727
652
|
type: "Message",
|
|
728
653
|
target: pid
|
|
729
654
|
});
|
|
730
655
|
if (data) _tags.data = data;
|
|
731
|
-
|
|
732
|
-
|
|
656
|
+
_context18.t0 = this;
|
|
657
|
+
_context18.t1 = "/".concat(pid, "/schedule");
|
|
658
|
+
_context18.next = 7;
|
|
659
|
+
return this.commit(_tags, {
|
|
733
660
|
path: false
|
|
734
661
|
});
|
|
735
|
-
case
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
662
|
+
case 7:
|
|
663
|
+
_context18.t2 = _context18.sent;
|
|
664
|
+
_context18.t3 = {
|
|
665
|
+
path: _context18.t1,
|
|
666
|
+
body: _context18.t2
|
|
667
|
+
};
|
|
668
|
+
_context18.next = 11;
|
|
669
|
+
return _context18.t0.post.call(_context18.t0, _context18.t3);
|
|
670
|
+
case 11:
|
|
671
|
+
res = _context18.sent;
|
|
672
|
+
return _context18.abrupt("return", {
|
|
673
|
+
slot: res.out.slot,
|
|
739
674
|
res: res,
|
|
740
675
|
pid: pid
|
|
741
676
|
});
|
|
742
|
-
case
|
|
677
|
+
case 13:
|
|
743
678
|
case "end":
|
|
744
|
-
return
|
|
679
|
+
return _context18.stop();
|
|
745
680
|
}
|
|
746
|
-
},
|
|
681
|
+
}, _callee18, this);
|
|
747
682
|
}));
|
|
748
|
-
function
|
|
749
|
-
return
|
|
683
|
+
function schedule() {
|
|
684
|
+
return _schedule.apply(this, arguments);
|
|
750
685
|
}
|
|
751
|
-
return
|
|
686
|
+
return schedule;
|
|
752
687
|
}()
|
|
753
688
|
}, {
|
|
754
|
-
key: "
|
|
689
|
+
key: "scheduleLua",
|
|
755
690
|
value: function () {
|
|
756
|
-
var
|
|
757
|
-
var _ref9,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
tags,
|
|
761
|
-
data,
|
|
762
|
-
body,
|
|
763
|
-
res,
|
|
764
|
-
_args22 = arguments;
|
|
765
|
-
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
766
|
-
while (1) switch (_context21.prev = _context21.next) {
|
|
691
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref9) {
|
|
692
|
+
var _ref9$action, action, _ref9$tags, tags, rest;
|
|
693
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
694
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
767
695
|
case 0:
|
|
768
|
-
_ref9 =
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
return
|
|
776
|
-
path: "/~process@1.0/schedule",
|
|
777
|
-
body: body
|
|
778
|
-
});
|
|
696
|
+
_ref9$action = _ref9.action, action = _ref9$action === void 0 ? "Eval" : _ref9$action, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, rest = _objectWithoutProperties(_ref9, _excluded2);
|
|
697
|
+
if (action) tags.Action = action;
|
|
698
|
+
_context19.next = 4;
|
|
699
|
+
return this.schedule(_objectSpread({
|
|
700
|
+
tags: tags
|
|
701
|
+
}, rest));
|
|
702
|
+
case 4:
|
|
703
|
+
return _context19.abrupt("return", _context19.sent);
|
|
779
704
|
case 5:
|
|
780
|
-
res = _context21.sent;
|
|
781
|
-
return _context21.abrupt("return", {
|
|
782
|
-
slot: res.headers.slot,
|
|
783
|
-
res: res,
|
|
784
|
-
pid: pid
|
|
785
|
-
});
|
|
786
|
-
case 7:
|
|
787
705
|
case "end":
|
|
788
|
-
return
|
|
706
|
+
return _context19.stop();
|
|
789
707
|
}
|
|
790
|
-
},
|
|
708
|
+
}, _callee19, this);
|
|
791
709
|
}));
|
|
792
|
-
function
|
|
793
|
-
return
|
|
710
|
+
function scheduleLua(_x14) {
|
|
711
|
+
return _scheduleLua.apply(this, arguments);
|
|
794
712
|
}
|
|
795
|
-
return
|
|
713
|
+
return scheduleLua;
|
|
796
714
|
}()
|
|
797
715
|
}, {
|
|
798
716
|
key: "spawnLua",
|
|
799
717
|
value: function () {
|
|
800
|
-
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
801
|
-
var _this$
|
|
802
|
-
var
|
|
803
|
-
return _regeneratorRuntime().wrap(function
|
|
804
|
-
while (1) switch (
|
|
718
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(lua) {
|
|
719
|
+
var _this$lua2;
|
|
720
|
+
var tags;
|
|
721
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
722
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
805
723
|
case 0:
|
|
806
|
-
|
|
807
|
-
return this.
|
|
724
|
+
_context20.next = 2;
|
|
725
|
+
return this.setInfo();
|
|
808
726
|
case 2:
|
|
809
|
-
|
|
810
|
-
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
811
|
-
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
812
|
-
_context22.next = 8;
|
|
813
|
-
break;
|
|
814
|
-
}
|
|
815
|
-
_lua;
|
|
816
|
-
_context22.next = 16;
|
|
817
|
-
break;
|
|
818
|
-
case 8:
|
|
727
|
+
_context20.t0 = this.operator;
|
|
819
728
|
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
820
|
-
|
|
729
|
+
_context20.next = 7;
|
|
821
730
|
break;
|
|
822
731
|
}
|
|
823
|
-
|
|
824
|
-
|
|
732
|
+
_context20.t1 = _this$lua2;
|
|
733
|
+
_context20.next = 10;
|
|
825
734
|
break;
|
|
826
|
-
case
|
|
827
|
-
|
|
735
|
+
case 7:
|
|
736
|
+
_context20.next = 9;
|
|
828
737
|
return this.getLua();
|
|
829
|
-
case
|
|
830
|
-
|
|
831
|
-
case
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
_context22.next = 18;
|
|
835
|
-
return this.post({
|
|
836
|
-
device: "process@1.0",
|
|
837
|
-
path: "/schedule",
|
|
838
|
-
scheduler: this.scheduler,
|
|
738
|
+
case 9:
|
|
739
|
+
_context20.t1 = _context20.sent;
|
|
740
|
+
case 10:
|
|
741
|
+
_context20.t2 = _context20.t1;
|
|
742
|
+
tags = {
|
|
839
743
|
"data-protocol": "ao",
|
|
840
744
|
variant: "ao.N.1",
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
"random-seed": seed(16),
|
|
844
|
-
type: "Process",
|
|
845
|
-
module: lua,
|
|
745
|
+
authority: _context20.t0,
|
|
746
|
+
module: _context20.t2,
|
|
846
747
|
"execution-device": "lua@5.3a",
|
|
847
748
|
"push-device": "push@1.0",
|
|
848
749
|
"patch-from": "/results/outbox"
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
case 18:
|
|
853
|
-
res = _context22.sent;
|
|
854
|
-
pid = res.headers.process;
|
|
855
|
-
return _context22.abrupt("return", {
|
|
856
|
-
pid: pid,
|
|
857
|
-
res: res
|
|
858
|
-
});
|
|
859
|
-
case 21:
|
|
750
|
+
};
|
|
751
|
+
return _context20.abrupt("return", this.spawn(tags));
|
|
752
|
+
case 13:
|
|
860
753
|
case "end":
|
|
861
|
-
return
|
|
754
|
+
return _context20.stop();
|
|
862
755
|
}
|
|
863
|
-
},
|
|
756
|
+
}, _callee20, this);
|
|
864
757
|
}));
|
|
865
758
|
function spawnLua(_x15) {
|
|
866
759
|
return _spawnLua.apply(this, arguments);
|
|
@@ -870,24 +763,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
870
763
|
}, {
|
|
871
764
|
key: "now",
|
|
872
765
|
value: function () {
|
|
873
|
-
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
766
|
+
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref10) {
|
|
874
767
|
var pid, _ref10$path, path;
|
|
875
|
-
return _regeneratorRuntime().wrap(function
|
|
876
|
-
while (1) switch (
|
|
768
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
769
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
877
770
|
case 0:
|
|
878
771
|
pid = _ref10.pid, _ref10$path = _ref10.path, path = _ref10$path === void 0 ? "" : _ref10$path;
|
|
879
772
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
880
|
-
|
|
773
|
+
_context21.next = 4;
|
|
881
774
|
return this.getJSON({
|
|
882
775
|
path: "/".concat(pid, "/now").concat(path)
|
|
883
776
|
});
|
|
884
777
|
case 4:
|
|
885
|
-
return
|
|
778
|
+
return _context21.abrupt("return", _context21.sent);
|
|
886
779
|
case 5:
|
|
887
780
|
case "end":
|
|
888
|
-
return
|
|
781
|
+
return _context21.stop();
|
|
889
782
|
}
|
|
890
|
-
},
|
|
783
|
+
}, _callee21, this);
|
|
891
784
|
}));
|
|
892
785
|
function now(_x16) {
|
|
893
786
|
return _now.apply(this, arguments);
|
|
@@ -897,24 +790,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
897
790
|
}, {
|
|
898
791
|
key: "slot",
|
|
899
792
|
value: function () {
|
|
900
|
-
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
793
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref11) {
|
|
901
794
|
var pid, _ref11$path, path;
|
|
902
|
-
return _regeneratorRuntime().wrap(function
|
|
903
|
-
while (1) switch (
|
|
795
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
796
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
904
797
|
case 0:
|
|
905
798
|
pid = _ref11.pid, _ref11$path = _ref11.path, path = _ref11$path === void 0 ? "" : _ref11$path;
|
|
906
799
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
907
|
-
|
|
800
|
+
_context22.next = 4;
|
|
908
801
|
return this.getJSON({
|
|
909
802
|
path: "/".concat(pid, "/slot").concat(path)
|
|
910
803
|
});
|
|
911
804
|
case 4:
|
|
912
|
-
return
|
|
805
|
+
return _context22.abrupt("return", _context22.sent);
|
|
913
806
|
case 5:
|
|
914
807
|
case "end":
|
|
915
|
-
return
|
|
808
|
+
return _context22.stop();
|
|
916
809
|
}
|
|
917
|
-
},
|
|
810
|
+
}, _callee22, this);
|
|
918
811
|
}));
|
|
919
812
|
function slot(_x17) {
|
|
920
813
|
return _slot.apply(this, arguments);
|
|
@@ -924,7 +817,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
924
817
|
}, {
|
|
925
818
|
key: "messages",
|
|
926
819
|
value: function () {
|
|
927
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
820
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
928
821
|
var _this = this;
|
|
929
822
|
var _ref12,
|
|
930
823
|
pid,
|
|
@@ -932,49 +825,49 @@ var HB = /*#__PURE__*/function () {
|
|
|
932
825
|
to,
|
|
933
826
|
params,
|
|
934
827
|
res,
|
|
935
|
-
|
|
936
|
-
return _regeneratorRuntime().wrap(function
|
|
937
|
-
while (1) switch (
|
|
828
|
+
_args25 = arguments;
|
|
829
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
830
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
938
831
|
case 0:
|
|
939
|
-
_ref12 =
|
|
832
|
+
_ref12 = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {}, pid = _ref12.pid, from = _ref12.from, to = _ref12.to;
|
|
940
833
|
params = "target=".concat(pid);
|
|
941
834
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
942
835
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
943
836
|
params += "&accept=application/aos-2";
|
|
944
|
-
|
|
837
|
+
_context24.next = 7;
|
|
945
838
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
946
839
|
return r.json();
|
|
947
840
|
});
|
|
948
841
|
case 7:
|
|
949
|
-
res =
|
|
842
|
+
res = _context24.sent;
|
|
950
843
|
if (res.page_info.has_next_page) {
|
|
951
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
844
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
952
845
|
var from2;
|
|
953
|
-
return _regeneratorRuntime().wrap(function
|
|
954
|
-
while (1) switch (
|
|
846
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
847
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
955
848
|
case 0:
|
|
956
849
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
957
|
-
|
|
850
|
+
_context23.next = 3;
|
|
958
851
|
return _this.messages({
|
|
959
852
|
pid: pid,
|
|
960
853
|
from: from2,
|
|
961
854
|
to: to
|
|
962
855
|
});
|
|
963
856
|
case 3:
|
|
964
|
-
return
|
|
857
|
+
return _context23.abrupt("return", _context23.sent);
|
|
965
858
|
case 4:
|
|
966
859
|
case "end":
|
|
967
|
-
return
|
|
860
|
+
return _context23.stop();
|
|
968
861
|
}
|
|
969
|
-
},
|
|
862
|
+
}, _callee23);
|
|
970
863
|
}));
|
|
971
864
|
}
|
|
972
|
-
return
|
|
865
|
+
return _context24.abrupt("return", res);
|
|
973
866
|
case 10:
|
|
974
867
|
case "end":
|
|
975
|
-
return
|
|
868
|
+
return _context24.stop();
|
|
976
869
|
}
|
|
977
|
-
},
|
|
870
|
+
}, _callee24, this);
|
|
978
871
|
}));
|
|
979
872
|
function messages() {
|
|
980
873
|
return _messages.apply(this, arguments);
|
|
@@ -982,51 +875,93 @@ var HB = /*#__PURE__*/function () {
|
|
|
982
875
|
return messages;
|
|
983
876
|
}()
|
|
984
877
|
}, {
|
|
985
|
-
key: "
|
|
878
|
+
key: "spawn",
|
|
986
879
|
value: function () {
|
|
987
|
-
var
|
|
988
|
-
var
|
|
880
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
881
|
+
var tags,
|
|
882
|
+
res,
|
|
883
|
+
_args26 = arguments;
|
|
884
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
885
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
886
|
+
case 0:
|
|
887
|
+
tags = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
|
|
888
|
+
_context25.t0 = this;
|
|
889
|
+
_context25.next = 4;
|
|
890
|
+
return this.commit((0, _ramda.mergeLeft)(tags, {
|
|
891
|
+
"random-seed": seed(16),
|
|
892
|
+
type: "Process",
|
|
893
|
+
"execution-device": "test-device@1.0",
|
|
894
|
+
device: "process@1.0",
|
|
895
|
+
scheduler: this.addr
|
|
896
|
+
}), {
|
|
897
|
+
path: false
|
|
898
|
+
});
|
|
899
|
+
case 4:
|
|
900
|
+
_context25.t1 = _context25.sent;
|
|
901
|
+
_context25.t2 = this.operator;
|
|
902
|
+
_context25.t3 = {
|
|
903
|
+
path: "/~process@1.0/schedule",
|
|
904
|
+
body: _context25.t1,
|
|
905
|
+
scheduler: _context25.t2
|
|
906
|
+
};
|
|
907
|
+
_context25.next = 9;
|
|
908
|
+
return _context25.t0.post.call(_context25.t0, _context25.t3);
|
|
909
|
+
case 9:
|
|
910
|
+
res = _context25.sent;
|
|
911
|
+
return _context25.abrupt("return", {
|
|
912
|
+
res: res,
|
|
913
|
+
pid: res.out.process
|
|
914
|
+
});
|
|
915
|
+
case 11:
|
|
916
|
+
case "end":
|
|
917
|
+
return _context25.stop();
|
|
918
|
+
}
|
|
919
|
+
}, _callee25, this);
|
|
920
|
+
}));
|
|
921
|
+
function spawn() {
|
|
922
|
+
return _spawn.apply(this, arguments);
|
|
923
|
+
}
|
|
924
|
+
return spawn;
|
|
925
|
+
}()
|
|
926
|
+
}, {
|
|
927
|
+
key: "spawnLegacy",
|
|
928
|
+
value: function () {
|
|
929
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
930
|
+
var _ref14,
|
|
989
931
|
module,
|
|
990
932
|
_ref14$tags,
|
|
991
933
|
tags,
|
|
992
934
|
data,
|
|
993
935
|
t,
|
|
994
|
-
|
|
995
|
-
return _regeneratorRuntime().wrap(function
|
|
996
|
-
while (1) switch (
|
|
936
|
+
_args27 = arguments;
|
|
937
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
938
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
997
939
|
case 0:
|
|
998
|
-
_ref14 =
|
|
999
|
-
|
|
940
|
+
_ref14 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, module = _ref14.module, _ref14$tags = _ref14.tags, tags = _ref14$tags === void 0 ? {} : _ref14$tags, data = _ref14.data;
|
|
941
|
+
_context26.next = 3;
|
|
1000
942
|
return this.setInfo();
|
|
1001
943
|
case 3:
|
|
1002
|
-
t = {
|
|
1003
|
-
type: "Process",
|
|
944
|
+
t = (0, _ramda.mergeLeft)(tags, {
|
|
1004
945
|
"data-protocol": "ao",
|
|
1005
946
|
variant: "ao.TN.1",
|
|
1006
|
-
scheduler: this._info.address,
|
|
1007
947
|
authority: this._info.address,
|
|
1008
|
-
"scheduler-location": this._info.address,
|
|
1009
|
-
"random-seed": seed(16),
|
|
1010
948
|
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1011
949
|
device: "process@1.0",
|
|
1012
|
-
"scheduler-device": "scheduler@1.0",
|
|
1013
950
|
"execution-device": "stack@1.0",
|
|
1014
951
|
"push-device": "push@1.0",
|
|
1015
952
|
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1016
|
-
"patch-from": "/results/outbox"
|
|
1017
|
-
|
|
1018
|
-
};
|
|
953
|
+
"patch-from": "/results/outbox"
|
|
954
|
+
});
|
|
1019
955
|
if (data) t.data = data;
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
956
|
+
_context26.next = 7;
|
|
957
|
+
return this.spawn(t);
|
|
958
|
+
case 7:
|
|
959
|
+
return _context26.abrupt("return", _context26.sent);
|
|
1023
960
|
case 8:
|
|
1024
|
-
return _context27.abrupt("return", _context27.sent);
|
|
1025
|
-
case 9:
|
|
1026
961
|
case "end":
|
|
1027
|
-
return
|
|
962
|
+
return _context26.stop();
|
|
1028
963
|
}
|
|
1029
|
-
},
|
|
964
|
+
}, _callee26, this);
|
|
1030
965
|
}));
|
|
1031
966
|
function spawnLegacy() {
|
|
1032
967
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1036,122 +971,55 @@ var HB = /*#__PURE__*/function () {
|
|
|
1036
971
|
}, {
|
|
1037
972
|
key: "scheduleLegacy",
|
|
1038
973
|
value: function () {
|
|
1039
|
-
var
|
|
974
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1040
975
|
var _ref15,
|
|
1041
|
-
pid,
|
|
1042
976
|
_ref15$action,
|
|
1043
977
|
action,
|
|
1044
978
|
_ref15$tags,
|
|
1045
979
|
tags,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
while (1) switch (_context28.prev = _context28.next) {
|
|
980
|
+
rest,
|
|
981
|
+
_args28 = arguments;
|
|
982
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
983
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1051
984
|
case 0:
|
|
1052
|
-
_ref15 =
|
|
985
|
+
_ref15 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, _ref15$action = _ref15.action, action = _ref15$action === void 0 ? "Eval" : _ref15$action, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, rest = _objectWithoutProperties(_ref15, _excluded3);
|
|
1053
986
|
if (action) tags.Action = action;
|
|
1054
|
-
|
|
1055
|
-
return this.
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
data: data,
|
|
1059
|
-
scheduler: scheduler
|
|
1060
|
-
});
|
|
987
|
+
_context27.next = 4;
|
|
988
|
+
return this.schedule(_objectSpread({
|
|
989
|
+
tags: tags
|
|
990
|
+
}, rest));
|
|
1061
991
|
case 4:
|
|
1062
|
-
return
|
|
992
|
+
return _context27.abrupt("return", _context27.sent);
|
|
1063
993
|
case 5:
|
|
1064
994
|
case "end":
|
|
1065
|
-
return
|
|
995
|
+
return _context27.stop();
|
|
1066
996
|
}
|
|
1067
|
-
},
|
|
997
|
+
}, _callee27, this);
|
|
1068
998
|
}));
|
|
1069
999
|
function scheduleLegacy() {
|
|
1070
|
-
return
|
|
1000
|
+
return _scheduleLegacy.apply(this, arguments);
|
|
1071
1001
|
}
|
|
1072
1002
|
return scheduleLegacy;
|
|
1073
1003
|
}()
|
|
1074
|
-
}, {
|
|
1075
|
-
key: "spawnLegacy2",
|
|
1076
|
-
value: function () {
|
|
1077
|
-
var _spawnLegacy2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1078
|
-
var _ref16,
|
|
1079
|
-
module,
|
|
1080
|
-
_ref16$tags,
|
|
1081
|
-
tags,
|
|
1082
|
-
data,
|
|
1083
|
-
t,
|
|
1084
|
-
res,
|
|
1085
|
-
pid,
|
|
1086
|
-
_args30 = arguments;
|
|
1087
|
-
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1088
|
-
while (1) switch (_context29.prev = _context29.next) {
|
|
1089
|
-
case 0:
|
|
1090
|
-
_ref16 = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {}, module = _ref16.module, _ref16$tags = _ref16.tags, tags = _ref16$tags === void 0 ? {} : _ref16$tags, data = _ref16.data;
|
|
1091
|
-
_context29.next = 3;
|
|
1092
|
-
return this.setInfo();
|
|
1093
|
-
case 3:
|
|
1094
|
-
t = {
|
|
1095
|
-
type: "Process",
|
|
1096
|
-
"data-protocol": "ao",
|
|
1097
|
-
variant: "ao.TN.1",
|
|
1098
|
-
scheduler: this._info.address,
|
|
1099
|
-
authority: this._info.address,
|
|
1100
|
-
"scheduler-location": this._info.address,
|
|
1101
|
-
"random-seed": seed(16),
|
|
1102
|
-
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1103
|
-
device: "process@1.0",
|
|
1104
|
-
"scheduler-device": "scheduler@1.0",
|
|
1105
|
-
"execution-device": "stack@1.0",
|
|
1106
|
-
"push-device": "push@1.0",
|
|
1107
|
-
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1108
|
-
"patch-from": "/results/outbox",
|
|
1109
|
-
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1110
|
-
path: "/~process@1.0/schedule"
|
|
1111
|
-
};
|
|
1112
|
-
if (data) t.data = data;
|
|
1113
|
-
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1114
|
-
_context29.next = 8;
|
|
1115
|
-
return this.post(t, {
|
|
1116
|
-
path: false
|
|
1117
|
-
});
|
|
1118
|
-
case 8:
|
|
1119
|
-
res = _context29.sent;
|
|
1120
|
-
pid = res.headers.process;
|
|
1121
|
-
return _context29.abrupt("return", {
|
|
1122
|
-
pid: pid,
|
|
1123
|
-
res: res
|
|
1124
|
-
});
|
|
1125
|
-
case 11:
|
|
1126
|
-
case "end":
|
|
1127
|
-
return _context29.stop();
|
|
1128
|
-
}
|
|
1129
|
-
}, _callee29, this);
|
|
1130
|
-
}));
|
|
1131
|
-
function spawnLegacy2() {
|
|
1132
|
-
return _spawnLegacy2.apply(this, arguments);
|
|
1133
|
-
}
|
|
1134
|
-
return spawnLegacy2;
|
|
1135
|
-
}()
|
|
1136
1004
|
}, {
|
|
1137
1005
|
key: "results",
|
|
1138
1006
|
value: function () {
|
|
1139
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1140
|
-
var
|
|
1007
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1008
|
+
var _ref16,
|
|
1141
1009
|
process,
|
|
1142
1010
|
limit,
|
|
1143
|
-
|
|
1011
|
+
_ref16$sort,
|
|
1144
1012
|
sort,
|
|
1145
1013
|
from,
|
|
1146
1014
|
to,
|
|
1147
1015
|
params,
|
|
1148
1016
|
addParam,
|
|
1149
1017
|
res,
|
|
1150
|
-
|
|
1151
|
-
return _regeneratorRuntime().wrap(function
|
|
1152
|
-
while (1) switch (
|
|
1018
|
+
_args29 = arguments;
|
|
1019
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1020
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1153
1021
|
case 0:
|
|
1154
|
-
|
|
1022
|
+
_ref16 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, process = _ref16.process, limit = _ref16.limit, _ref16$sort = _ref16.sort, sort = _ref16$sort === void 0 ? "DESC" : _ref16$sort, from = _ref16.from, to = _ref16.to;
|
|
1155
1023
|
params = "";
|
|
1156
1024
|
addParam = function addParam(key, val) {
|
|
1157
1025
|
params += params === "" ? "?" : "&";
|
|
@@ -1161,7 +1029,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1161
1029
|
if (sort) addParam("sort", sort);
|
|
1162
1030
|
if (from) addParam("from", from);
|
|
1163
1031
|
if (to) addParam("to", to);
|
|
1164
|
-
|
|
1032
|
+
_context28.next = 9;
|
|
1165
1033
|
return this.post({
|
|
1166
1034
|
path: "/~relay@1.0/call",
|
|
1167
1035
|
method: "GET",
|
|
@@ -1169,13 +1037,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1169
1037
|
"content-type": "application/json"
|
|
1170
1038
|
});
|
|
1171
1039
|
case 9:
|
|
1172
|
-
res =
|
|
1173
|
-
return
|
|
1040
|
+
res = _context28.sent;
|
|
1041
|
+
return _context28.abrupt("return", JSON.parse(res.body));
|
|
1174
1042
|
case 11:
|
|
1175
1043
|
case "end":
|
|
1176
|
-
return
|
|
1044
|
+
return _context28.stop();
|
|
1177
1045
|
}
|
|
1178
|
-
},
|
|
1046
|
+
}, _callee28, this);
|
|
1179
1047
|
}));
|
|
1180
1048
|
function results() {
|
|
1181
1049
|
return _results.apply(this, arguments);
|
|
@@ -1185,27 +1053,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1185
1053
|
}, {
|
|
1186
1054
|
key: "dryrun",
|
|
1187
1055
|
value: function () {
|
|
1188
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1189
|
-
var
|
|
1190
|
-
|
|
1056
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1057
|
+
var _ref17,
|
|
1058
|
+
_ref17$tags,
|
|
1191
1059
|
tags,
|
|
1192
1060
|
pid,
|
|
1193
1061
|
action,
|
|
1194
1062
|
data,
|
|
1195
1063
|
json,
|
|
1196
1064
|
res,
|
|
1197
|
-
|
|
1198
|
-
return _regeneratorRuntime().wrap(function
|
|
1199
|
-
while (1) switch (
|
|
1065
|
+
_args30 = arguments;
|
|
1066
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1067
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1200
1068
|
case 0:
|
|
1201
|
-
|
|
1069
|
+
_ref17 = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {}, _ref17$tags = _ref17.tags, tags = _ref17$tags === void 0 ? {} : _ref17$tags, pid = _ref17.pid, action = _ref17.action, data = _ref17.data;
|
|
1202
1070
|
if (typeof action === "string") tags.Action = action;
|
|
1203
1071
|
json = {
|
|
1204
1072
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1205
1073
|
Owner: this.addr
|
|
1206
1074
|
};
|
|
1207
1075
|
if (data) json.Data = data;
|
|
1208
|
-
|
|
1076
|
+
_context29.next = 6;
|
|
1209
1077
|
return this.post({
|
|
1210
1078
|
path: "/~relay@1.0/call",
|
|
1211
1079
|
method: "POST",
|
|
@@ -1214,13 +1082,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1214
1082
|
"relay-body": JSON.stringify(json)
|
|
1215
1083
|
});
|
|
1216
1084
|
case 6:
|
|
1217
|
-
res =
|
|
1218
|
-
return
|
|
1085
|
+
res = _context29.sent;
|
|
1086
|
+
return _context29.abrupt("return", JSON.parse(res.body));
|
|
1219
1087
|
case 8:
|
|
1220
1088
|
case "end":
|
|
1221
|
-
return
|
|
1089
|
+
return _context29.stop();
|
|
1222
1090
|
}
|
|
1223
|
-
},
|
|
1091
|
+
}, _callee29, this);
|
|
1224
1092
|
}));
|
|
1225
1093
|
function dryrun() {
|
|
1226
1094
|
return _dryrun.apply(this, arguments);
|
|
@@ -1230,15 +1098,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1230
1098
|
}, {
|
|
1231
1099
|
key: "commit",
|
|
1232
1100
|
value: function () {
|
|
1233
|
-
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1101
|
+
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(obj, opts) {
|
|
1234
1102
|
var msg, hmacId, rsaId, committer, meta, meta2, sigs;
|
|
1235
|
-
return _regeneratorRuntime().wrap(function
|
|
1236
|
-
while (1) switch (
|
|
1103
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1104
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1237
1105
|
case 0:
|
|
1238
|
-
|
|
1106
|
+
_context30.next = 2;
|
|
1239
1107
|
return this.sign(obj, opts);
|
|
1240
1108
|
case 2:
|
|
1241
|
-
msg =
|
|
1109
|
+
msg = _context30.sent;
|
|
1242
1110
|
hmacId = (0, _utils.hmacid)(msg.headers);
|
|
1243
1111
|
rsaId = (0, _utils.rsaid)(msg.headers);
|
|
1244
1112
|
committer = this.addr;
|
|
@@ -1254,16 +1122,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
1254
1122
|
signature: msg.headers.signature,
|
|
1255
1123
|
"signature-input": msg.headers["signature-input"]
|
|
1256
1124
|
};
|
|
1257
|
-
return
|
|
1125
|
+
return _context30.abrupt("return", _objectSpread({
|
|
1258
1126
|
commitments: _defineProperty(_defineProperty({}, rsaId, _objectSpread(_objectSpread({}, meta), {}, {
|
|
1259
1127
|
committer: committer
|
|
1260
1128
|
}, sigs)), hmacId, _objectSpread(_objectSpread({}, meta2), sigs))
|
|
1261
1129
|
}, obj));
|
|
1262
1130
|
case 10:
|
|
1263
1131
|
case "end":
|
|
1264
|
-
return
|
|
1132
|
+
return _context30.stop();
|
|
1265
1133
|
}
|
|
1266
|
-
},
|
|
1134
|
+
}, _callee30, this);
|
|
1267
1135
|
}));
|
|
1268
1136
|
function commit(_x18, _x19) {
|
|
1269
1137
|
return _commit.apply(this, arguments);
|
|
@@ -1273,67 +1141,67 @@ var HB = /*#__PURE__*/function () {
|
|
|
1273
1141
|
}, {
|
|
1274
1142
|
key: "p",
|
|
1275
1143
|
value: function () {
|
|
1276
|
-
var _p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1144
|
+
var _p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(path) {
|
|
1277
1145
|
var _, _args$_, _args$, _args$$path, _yield$this$post$out, _yield$this$post;
|
|
1278
1146
|
var _len,
|
|
1279
1147
|
args,
|
|
1280
1148
|
_key,
|
|
1281
1149
|
_args,
|
|
1282
|
-
|
|
1283
|
-
return _regeneratorRuntime().wrap(function
|
|
1284
|
-
while (1) switch (
|
|
1150
|
+
_args32 = arguments;
|
|
1151
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1152
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1285
1153
|
case 0:
|
|
1286
|
-
for (_len =
|
|
1287
|
-
args[_key - 1] =
|
|
1154
|
+
for (_len = _args32.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1155
|
+
args[_key - 1] = _args32[_key];
|
|
1288
1156
|
}
|
|
1289
1157
|
_args = (0, _ramda.clone)(args);
|
|
1290
1158
|
(_args$_ = _args[_ = 0]) !== null && _args$_ !== void 0 ? _args$_ : _args[_] = {};
|
|
1291
1159
|
(_args$$path = (_args$ = _args[0]).path) !== null && _args$$path !== void 0 ? _args$$path : _args$.path = path;
|
|
1292
|
-
|
|
1160
|
+
_context31.next = 6;
|
|
1293
1161
|
return this.post.apply(this, _toConsumableArray(_args));
|
|
1294
1162
|
case 6:
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (
|
|
1298
|
-
|
|
1163
|
+
_context31.t2 = _yield$this$post = _context31.sent;
|
|
1164
|
+
_context31.t1 = _context31.t2 === null;
|
|
1165
|
+
if (_context31.t1) {
|
|
1166
|
+
_context31.next = 10;
|
|
1299
1167
|
break;
|
|
1300
1168
|
}
|
|
1301
|
-
|
|
1169
|
+
_context31.t1 = _yield$this$post === void 0;
|
|
1302
1170
|
case 10:
|
|
1303
|
-
if (!
|
|
1304
|
-
|
|
1171
|
+
if (!_context31.t1) {
|
|
1172
|
+
_context31.next = 14;
|
|
1305
1173
|
break;
|
|
1306
1174
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1175
|
+
_context31.t3 = void 0;
|
|
1176
|
+
_context31.next = 15;
|
|
1309
1177
|
break;
|
|
1310
1178
|
case 14:
|
|
1311
|
-
|
|
1179
|
+
_context31.t3 = _yield$this$post.out;
|
|
1312
1180
|
case 15:
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
if (!
|
|
1316
|
-
|
|
1181
|
+
_context31.t4 = _yield$this$post$out = _context31.t3;
|
|
1182
|
+
_context31.t0 = _context31.t4 !== null;
|
|
1183
|
+
if (!_context31.t0) {
|
|
1184
|
+
_context31.next = 19;
|
|
1317
1185
|
break;
|
|
1318
1186
|
}
|
|
1319
|
-
|
|
1187
|
+
_context31.t0 = _yield$this$post$out !== void 0;
|
|
1320
1188
|
case 19:
|
|
1321
|
-
if (!
|
|
1322
|
-
|
|
1189
|
+
if (!_context31.t0) {
|
|
1190
|
+
_context31.next = 23;
|
|
1323
1191
|
break;
|
|
1324
1192
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1193
|
+
_context31.t5 = _yield$this$post$out;
|
|
1194
|
+
_context31.next = 24;
|
|
1327
1195
|
break;
|
|
1328
1196
|
case 23:
|
|
1329
|
-
|
|
1197
|
+
_context31.t5 = null;
|
|
1330
1198
|
case 24:
|
|
1331
|
-
return
|
|
1199
|
+
return _context31.abrupt("return", _context31.t5);
|
|
1332
1200
|
case 25:
|
|
1333
1201
|
case "end":
|
|
1334
|
-
return
|
|
1202
|
+
return _context31.stop();
|
|
1335
1203
|
}
|
|
1336
|
-
},
|
|
1204
|
+
}, _callee31, this);
|
|
1337
1205
|
}));
|
|
1338
1206
|
function p(_x20) {
|
|
1339
1207
|
return _p.apply(this, arguments);
|
|
@@ -1343,30 +1211,30 @@ var HB = /*#__PURE__*/function () {
|
|
|
1343
1211
|
}, {
|
|
1344
1212
|
key: "post",
|
|
1345
1213
|
value: function () {
|
|
1346
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1214
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(obj) {
|
|
1347
1215
|
var opt,
|
|
1348
1216
|
_json,
|
|
1349
1217
|
signed,
|
|
1350
|
-
|
|
1351
|
-
return _regeneratorRuntime().wrap(function
|
|
1352
|
-
while (1) switch (
|
|
1218
|
+
_args33 = arguments;
|
|
1219
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1220
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1353
1221
|
case 0:
|
|
1354
|
-
opt =
|
|
1222
|
+
opt = _args33.length > 1 && _args33[1] !== undefined ? _args33[1] : {};
|
|
1355
1223
|
_json = opt.json ? "/~json@1.0/serialize" : "";
|
|
1356
1224
|
obj.path += _json;
|
|
1357
|
-
|
|
1225
|
+
_context32.next = 5;
|
|
1358
1226
|
return this.sign(obj, opt);
|
|
1359
1227
|
case 5:
|
|
1360
|
-
signed =
|
|
1361
|
-
|
|
1228
|
+
signed = _context32.sent;
|
|
1229
|
+
_context32.next = 8;
|
|
1362
1230
|
return this.send(signed);
|
|
1363
1231
|
case 8:
|
|
1364
|
-
return
|
|
1232
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1365
1233
|
case 9:
|
|
1366
1234
|
case "end":
|
|
1367
|
-
return
|
|
1235
|
+
return _context32.stop();
|
|
1368
1236
|
}
|
|
1369
|
-
},
|
|
1237
|
+
}, _callee32, this);
|
|
1370
1238
|
}));
|
|
1371
1239
|
function post(_x21) {
|
|
1372
1240
|
return _post.apply(this, arguments);
|
|
@@ -1376,67 +1244,67 @@ var HB = /*#__PURE__*/function () {
|
|
|
1376
1244
|
}, {
|
|
1377
1245
|
key: "g",
|
|
1378
1246
|
value: function () {
|
|
1379
|
-
var _g = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1247
|
+
var _g = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(path) {
|
|
1380
1248
|
var _2, _args$_2, _args$2, _args$2$path, _yield$this$get$out, _yield$this$get;
|
|
1381
1249
|
var _len2,
|
|
1382
1250
|
args,
|
|
1383
1251
|
_key2,
|
|
1384
1252
|
_args,
|
|
1385
|
-
|
|
1386
|
-
return _regeneratorRuntime().wrap(function
|
|
1387
|
-
while (1) switch (
|
|
1253
|
+
_args34 = arguments;
|
|
1254
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1255
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1388
1256
|
case 0:
|
|
1389
|
-
for (_len2 =
|
|
1390
|
-
args[_key2 - 1] =
|
|
1257
|
+
for (_len2 = _args34.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1258
|
+
args[_key2 - 1] = _args34[_key2];
|
|
1391
1259
|
}
|
|
1392
1260
|
_args = (0, _ramda.clone)(args);
|
|
1393
1261
|
(_args$_2 = _args[_2 = 0]) !== null && _args$_2 !== void 0 ? _args$_2 : _args[_2] = {};
|
|
1394
1262
|
(_args$2$path = (_args$2 = _args[0]).path) !== null && _args$2$path !== void 0 ? _args$2$path : _args$2.path = path;
|
|
1395
|
-
|
|
1263
|
+
_context33.next = 6;
|
|
1396
1264
|
return this.get.apply(this, _toConsumableArray(_args));
|
|
1397
1265
|
case 6:
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1266
|
+
_context33.t2 = _yield$this$get = _context33.sent;
|
|
1267
|
+
_context33.t1 = _context33.t2 === null;
|
|
1268
|
+
if (_context33.t1) {
|
|
1269
|
+
_context33.next = 10;
|
|
1402
1270
|
break;
|
|
1403
1271
|
}
|
|
1404
|
-
|
|
1272
|
+
_context33.t1 = _yield$this$get === void 0;
|
|
1405
1273
|
case 10:
|
|
1406
|
-
if (!
|
|
1407
|
-
|
|
1274
|
+
if (!_context33.t1) {
|
|
1275
|
+
_context33.next = 14;
|
|
1408
1276
|
break;
|
|
1409
1277
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1278
|
+
_context33.t3 = void 0;
|
|
1279
|
+
_context33.next = 15;
|
|
1412
1280
|
break;
|
|
1413
1281
|
case 14:
|
|
1414
|
-
|
|
1282
|
+
_context33.t3 = _yield$this$get.out;
|
|
1415
1283
|
case 15:
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
if (!
|
|
1419
|
-
|
|
1284
|
+
_context33.t4 = _yield$this$get$out = _context33.t3;
|
|
1285
|
+
_context33.t0 = _context33.t4 !== null;
|
|
1286
|
+
if (!_context33.t0) {
|
|
1287
|
+
_context33.next = 19;
|
|
1420
1288
|
break;
|
|
1421
1289
|
}
|
|
1422
|
-
|
|
1290
|
+
_context33.t0 = _yield$this$get$out !== void 0;
|
|
1423
1291
|
case 19:
|
|
1424
|
-
if (!
|
|
1425
|
-
|
|
1292
|
+
if (!_context33.t0) {
|
|
1293
|
+
_context33.next = 23;
|
|
1426
1294
|
break;
|
|
1427
1295
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1296
|
+
_context33.t5 = _yield$this$get$out;
|
|
1297
|
+
_context33.next = 24;
|
|
1430
1298
|
break;
|
|
1431
1299
|
case 23:
|
|
1432
|
-
|
|
1300
|
+
_context33.t5 = null;
|
|
1433
1301
|
case 24:
|
|
1434
|
-
return
|
|
1302
|
+
return _context33.abrupt("return", _context33.t5);
|
|
1435
1303
|
case 25:
|
|
1436
1304
|
case "end":
|
|
1437
|
-
return
|
|
1305
|
+
return _context33.stop();
|
|
1438
1306
|
}
|
|
1439
|
-
},
|
|
1307
|
+
}, _callee33, this);
|
|
1440
1308
|
}));
|
|
1441
1309
|
function g(_x22) {
|
|
1442
1310
|
return _g.apply(this, arguments);
|
|
@@ -1446,7 +1314,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1446
1314
|
}, {
|
|
1447
1315
|
key: "get",
|
|
1448
1316
|
value: function () {
|
|
1449
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1317
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(_ref18) {
|
|
1450
1318
|
var _path;
|
|
1451
1319
|
var path,
|
|
1452
1320
|
params,
|
|
@@ -1458,12 +1326,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1458
1326
|
response,
|
|
1459
1327
|
headers,
|
|
1460
1328
|
http,
|
|
1461
|
-
|
|
1462
|
-
return _regeneratorRuntime().wrap(function
|
|
1463
|
-
while (1) switch (
|
|
1329
|
+
_args35 = arguments;
|
|
1330
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1331
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1464
1332
|
case 0:
|
|
1465
|
-
path =
|
|
1466
|
-
opt =
|
|
1333
|
+
path = _ref18.path, params = _objectWithoutProperties(_ref18, _excluded4);
|
|
1334
|
+
opt = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
|
|
1467
1335
|
_json = opt.json ? "/~json@1.0/serialize" : "";
|
|
1468
1336
|
(_path = path) !== null && _path !== void 0 ? _path : path = "/~message@1.0";
|
|
1469
1337
|
if (!/^\//.test(path)) path = "/" + path;
|
|
@@ -1475,31 +1343,31 @@ var HB = /*#__PURE__*/function () {
|
|
|
1475
1343
|
i++;
|
|
1476
1344
|
}
|
|
1477
1345
|
}
|
|
1478
|
-
|
|
1346
|
+
_context34.next = 9;
|
|
1479
1347
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1480
1348
|
case 9:
|
|
1481
|
-
response =
|
|
1349
|
+
response = _context34.sent;
|
|
1482
1350
|
headers = {};
|
|
1483
1351
|
response.headers.forEach(function (v, k) {
|
|
1484
1352
|
return headers[k] = v;
|
|
1485
1353
|
});
|
|
1486
|
-
|
|
1487
|
-
|
|
1354
|
+
_context34.t0 = headers;
|
|
1355
|
+
_context34.next = 15;
|
|
1488
1356
|
return response.text();
|
|
1489
1357
|
case 15:
|
|
1490
|
-
|
|
1491
|
-
|
|
1358
|
+
_context34.t1 = _context34.sent;
|
|
1359
|
+
_context34.t2 = response.status;
|
|
1492
1360
|
http = {
|
|
1493
|
-
headers:
|
|
1494
|
-
body:
|
|
1495
|
-
status:
|
|
1361
|
+
headers: _context34.t0,
|
|
1362
|
+
body: _context34.t1,
|
|
1363
|
+
status: _context34.t2
|
|
1496
1364
|
};
|
|
1497
|
-
return
|
|
1365
|
+
return _context34.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsig.from)(http)), http));
|
|
1498
1366
|
case 19:
|
|
1499
1367
|
case "end":
|
|
1500
|
-
return
|
|
1368
|
+
return _context34.stop();
|
|
1501
1369
|
}
|
|
1502
|
-
},
|
|
1370
|
+
}, _callee34, this);
|
|
1503
1371
|
}));
|
|
1504
1372
|
function get(_x23) {
|
|
1505
1373
|
return _get.apply(this, arguments);
|
|
@@ -1509,26 +1377,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1509
1377
|
}, {
|
|
1510
1378
|
key: "postJSON",
|
|
1511
1379
|
value: function () {
|
|
1512
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1380
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(args) {
|
|
1513
1381
|
var opt,
|
|
1514
1382
|
res,
|
|
1515
|
-
|
|
1516
|
-
return _regeneratorRuntime().wrap(function
|
|
1517
|
-
while (1) switch (
|
|
1383
|
+
_args36 = arguments;
|
|
1384
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1385
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1518
1386
|
case 0:
|
|
1519
|
-
opt =
|
|
1520
|
-
|
|
1387
|
+
opt = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {};
|
|
1388
|
+
_context35.next = 3;
|
|
1521
1389
|
return this.post(args, _objectSpread(_objectSpread({}, opt), {}, {
|
|
1522
1390
|
json: true
|
|
1523
1391
|
}));
|
|
1524
1392
|
case 3:
|
|
1525
|
-
res =
|
|
1526
|
-
return
|
|
1393
|
+
res = _context35.sent;
|
|
1394
|
+
return _context35.abrupt("return", JSON.parse(res.body));
|
|
1527
1395
|
case 5:
|
|
1528
1396
|
case "end":
|
|
1529
|
-
return
|
|
1397
|
+
return _context35.stop();
|
|
1530
1398
|
}
|
|
1531
|
-
},
|
|
1399
|
+
}, _callee35, this);
|
|
1532
1400
|
}));
|
|
1533
1401
|
function postJSON(_x24) {
|
|
1534
1402
|
return _postJSON.apply(this, arguments);
|
|
@@ -1538,26 +1406,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1538
1406
|
}, {
|
|
1539
1407
|
key: "getJSON",
|
|
1540
1408
|
value: function () {
|
|
1541
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1409
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(args) {
|
|
1542
1410
|
var opt,
|
|
1543
1411
|
res,
|
|
1544
|
-
|
|
1545
|
-
return _regeneratorRuntime().wrap(function
|
|
1546
|
-
while (1) switch (
|
|
1412
|
+
_args37 = arguments;
|
|
1413
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1414
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1547
1415
|
case 0:
|
|
1548
|
-
opt =
|
|
1549
|
-
|
|
1416
|
+
opt = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
|
|
1417
|
+
_context36.next = 3;
|
|
1550
1418
|
return this.get(args, _objectSpread(_objectSpread({}, opt), {}, {
|
|
1551
1419
|
json: true
|
|
1552
1420
|
}));
|
|
1553
1421
|
case 3:
|
|
1554
|
-
res =
|
|
1555
|
-
return
|
|
1422
|
+
res = _context36.sent;
|
|
1423
|
+
return _context36.abrupt("return", JSON.parse(res.body));
|
|
1556
1424
|
case 5:
|
|
1557
1425
|
case "end":
|
|
1558
|
-
return
|
|
1426
|
+
return _context36.stop();
|
|
1559
1427
|
}
|
|
1560
|
-
},
|
|
1428
|
+
}, _callee36, this);
|
|
1561
1429
|
}));
|
|
1562
1430
|
function getJSON(_x25) {
|
|
1563
1431
|
return _getJSON.apply(this, arguments);
|
|
@@ -1567,51 +1435,42 @@ var HB = /*#__PURE__*/function () {
|
|
|
1567
1435
|
}, {
|
|
1568
1436
|
key: "spawnAOS",
|
|
1569
1437
|
value: function () {
|
|
1570
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1571
|
-
var
|
|
1572
|
-
var
|
|
1573
|
-
return _regeneratorRuntime().wrap(function
|
|
1574
|
-
while (1) switch (
|
|
1438
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(image) {
|
|
1439
|
+
var _image, _this$image2;
|
|
1440
|
+
var tags;
|
|
1441
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1442
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1575
1443
|
case 0:
|
|
1576
|
-
|
|
1577
|
-
return this.
|
|
1444
|
+
_context37.next = 2;
|
|
1445
|
+
return this.setInfo();
|
|
1578
1446
|
case 2:
|
|
1579
|
-
addr = _context39.sent;
|
|
1580
|
-
(_this$scheduler4 = this.scheduler) !== null && _this$scheduler4 !== void 0 ? _this$scheduler4 : this.scheduler = addr;
|
|
1581
1447
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
1582
|
-
|
|
1448
|
+
_context37.next = 6;
|
|
1583
1449
|
break;
|
|
1584
1450
|
}
|
|
1585
1451
|
_image;
|
|
1586
|
-
|
|
1452
|
+
_context37.next = 14;
|
|
1587
1453
|
break;
|
|
1588
|
-
case
|
|
1454
|
+
case 6:
|
|
1589
1455
|
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
1590
|
-
|
|
1456
|
+
_context37.next = 10;
|
|
1591
1457
|
break;
|
|
1592
1458
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1459
|
+
_context37.t0 = _this$image2;
|
|
1460
|
+
_context37.next = 13;
|
|
1595
1461
|
break;
|
|
1596
|
-
case
|
|
1597
|
-
|
|
1462
|
+
case 10:
|
|
1463
|
+
_context37.next = 12;
|
|
1598
1464
|
return this.getImage();
|
|
1465
|
+
case 12:
|
|
1466
|
+
_context37.t0 = _context37.sent;
|
|
1467
|
+
case 13:
|
|
1468
|
+
image = _context37.t0;
|
|
1599
1469
|
case 14:
|
|
1600
|
-
|
|
1601
|
-
case 15:
|
|
1602
|
-
image = _context39.t0;
|
|
1603
|
-
case 16:
|
|
1604
|
-
_context39.next = 18;
|
|
1605
|
-
return this.post({
|
|
1606
|
-
device: "process@1.0",
|
|
1607
|
-
path: "/schedule",
|
|
1608
|
-
scheduler: this.scheduler,
|
|
1470
|
+
tags = {
|
|
1609
1471
|
"data-protocol": "ao",
|
|
1610
1472
|
variant: "ao.N.1",
|
|
1611
|
-
|
|
1612
|
-
authority: this.scheduler,
|
|
1613
|
-
"random-seed": seed(16),
|
|
1614
|
-
type: "Process",
|
|
1473
|
+
authority: this.operator,
|
|
1615
1474
|
image: image,
|
|
1616
1475
|
"execution-device": "stack@1.0",
|
|
1617
1476
|
"push-device": "push@1.0",
|
|
@@ -1619,23 +1478,17 @@ var HB = /*#__PURE__*/function () {
|
|
|
1619
1478
|
"output-prefix": "wasm",
|
|
1620
1479
|
"patch-from": "/results/outbox",
|
|
1621
1480
|
"patch-mode": "patches",
|
|
1622
|
-
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1623
1481
|
passes: 2
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1482
|
+
};
|
|
1483
|
+
_context37.next = 17;
|
|
1484
|
+
return this.spawn(tags);
|
|
1485
|
+
case 17:
|
|
1486
|
+
return _context37.abrupt("return", _context37.sent);
|
|
1627
1487
|
case 18:
|
|
1628
|
-
res = _context39.sent;
|
|
1629
|
-
pid = res.headers.process;
|
|
1630
|
-
return _context39.abrupt("return", {
|
|
1631
|
-
pid: pid,
|
|
1632
|
-
res: res
|
|
1633
|
-
});
|
|
1634
|
-
case 21:
|
|
1635
1488
|
case "end":
|
|
1636
|
-
return
|
|
1489
|
+
return _context37.stop();
|
|
1637
1490
|
}
|
|
1638
|
-
},
|
|
1491
|
+
}, _callee37, this);
|
|
1639
1492
|
}));
|
|
1640
1493
|
function spawnAOS(_x26) {
|
|
1641
1494
|
return _spawnAOS.apply(this, arguments);
|
|
@@ -1645,99 +1498,30 @@ var HB = /*#__PURE__*/function () {
|
|
|
1645
1498
|
}, {
|
|
1646
1499
|
key: "scheduleAOS",
|
|
1647
1500
|
value: function () {
|
|
1648
|
-
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1649
|
-
var
|
|
1650
|
-
return _regeneratorRuntime().wrap(function
|
|
1651
|
-
while (1) switch (
|
|
1501
|
+
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(_ref19) {
|
|
1502
|
+
var _ref19$action, action, _ref19$tags, tags, rest;
|
|
1503
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1504
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1652
1505
|
case 0:
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
target: pid
|
|
1662
|
-
});
|
|
1663
|
-
if (data) _tags.data = data;
|
|
1664
|
-
_context40.next = 5;
|
|
1665
|
-
return this.post(_tags, {
|
|
1666
|
-
path: false
|
|
1667
|
-
});
|
|
1506
|
+
_ref19$action = _ref19.action, action = _ref19$action === void 0 ? "Eval" : _ref19$action, _ref19$tags = _ref19.tags, tags = _ref19$tags === void 0 ? {} : _ref19$tags, rest = _objectWithoutProperties(_ref19, _excluded5);
|
|
1507
|
+
if (action) tags.Action = action;
|
|
1508
|
+
_context38.next = 4;
|
|
1509
|
+
return this.schedule(_objectSpread({
|
|
1510
|
+
tags: tags
|
|
1511
|
+
}, rest));
|
|
1512
|
+
case 4:
|
|
1513
|
+
return _context38.abrupt("return", _context38.sent);
|
|
1668
1514
|
case 5:
|
|
1669
|
-
res = _context40.sent;
|
|
1670
|
-
slot = res.headers.slot;
|
|
1671
|
-
return _context40.abrupt("return", {
|
|
1672
|
-
slot: slot,
|
|
1673
|
-
res: res,
|
|
1674
|
-
pid: pid
|
|
1675
|
-
});
|
|
1676
|
-
case 8:
|
|
1677
1515
|
case "end":
|
|
1678
|
-
return
|
|
1516
|
+
return _context38.stop();
|
|
1679
1517
|
}
|
|
1680
|
-
},
|
|
1518
|
+
}, _callee38, this);
|
|
1681
1519
|
}));
|
|
1682
1520
|
function scheduleAOS(_x27) {
|
|
1683
1521
|
return _scheduleAOS.apply(this, arguments);
|
|
1684
1522
|
}
|
|
1685
1523
|
return scheduleAOS;
|
|
1686
1524
|
}()
|
|
1687
|
-
/*
|
|
1688
|
-
async scheduleAOS2({ pid, action = "Eval", tags = {}, data }) {
|
|
1689
|
-
let _tags = mergeLeft(tags, {
|
|
1690
|
-
device: "process@1.0",
|
|
1691
|
-
type: "Message",
|
|
1692
|
-
Action: action,
|
|
1693
|
-
target: pid,
|
|
1694
|
-
})
|
|
1695
|
-
if (data) _tags.data = data
|
|
1696
|
-
const msg = { body: _tags, path: `/${pid}~process@1.0/schedule` }
|
|
1697
|
-
let res = await this.post(msg, { path: false })
|
|
1698
|
-
const slot = res.headers.slot
|
|
1699
|
-
return { slot, res, pid }
|
|
1700
|
-
}
|
|
1701
|
-
async spawnAOS2(image) {
|
|
1702
|
-
const addr = await this.g("/~meta@1.0/info/address")
|
|
1703
|
-
this.scheduler ??= addr
|
|
1704
|
-
image ??= this.image ?? (await this.getImage())
|
|
1705
|
-
const _tags = {
|
|
1706
|
-
device: "process@1.0",
|
|
1707
|
-
scheduler: this.scheduler,
|
|
1708
|
-
"data-protocol": "ao",
|
|
1709
|
-
variant: "ao.N.1",
|
|
1710
|
-
"scheduler-location": this.scheduler,
|
|
1711
|
-
authority: this.scheduler,
|
|
1712
|
-
"random-seed": seed(16),
|
|
1713
|
-
type: "Process",
|
|
1714
|
-
image,
|
|
1715
|
-
"execution-device": "stack@1.0",
|
|
1716
|
-
"push-device": "push@1.0",
|
|
1717
|
-
"device-stack": [
|
|
1718
|
-
"wasi@1.0",
|
|
1719
|
-
"json-iface@1.0",
|
|
1720
|
-
"wasm-64@1.0",
|
|
1721
|
-
"patch@1.0",
|
|
1722
|
-
"multipass@1.0",
|
|
1723
|
-
],
|
|
1724
|
-
"output-prefix": "wasm",
|
|
1725
|
-
"patch-from": "/results/outbox",
|
|
1726
|
-
"patch-mode": "patches",
|
|
1727
|
-
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1728
|
-
passes: 2,
|
|
1729
|
-
}
|
|
1730
|
-
const msg = {
|
|
1731
|
-
device: "process@1.0",
|
|
1732
|
-
path: "schedule",
|
|
1733
|
-
body: _tags,
|
|
1734
|
-
scheduler: this.scheduler,
|
|
1735
|
-
}
|
|
1736
|
-
const res = await this.post(msg, { path: false })
|
|
1737
|
-
const pid = res.headers.process
|
|
1738
|
-
return { pid, res }
|
|
1739
|
-
}
|
|
1740
|
-
*/
|
|
1741
1525
|
}]);
|
|
1742
1526
|
}();
|
|
1743
1527
|
var _default = exports["default"] = HB;
|