wao 0.22.3 → 0.23.0
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/adaptor-base.js +28 -22
- package/cjs/hb.js +415 -230
- package/cjs/hyperbeam.js +5 -1
- package/cjs/server.js +1 -1
- package/esm/adaptor-base.js +3 -0
- package/esm/hb.js +82 -24
- package/esm/hyperbeam.js +6 -2
- package/esm/server.js +1 -0
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -42,7 +42,8 @@ var HB = /*#__PURE__*/function () {
|
|
|
42
42
|
jwk = _ref.jwk;
|
|
43
43
|
_classCallCheck(this, HB);
|
|
44
44
|
this.url = url;
|
|
45
|
-
this.
|
|
45
|
+
this.dev = {};
|
|
46
|
+
this.dev.hyperbuddy = {
|
|
46
47
|
metrics: function () {
|
|
47
48
|
var _metrics2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
48
49
|
var args,
|
|
@@ -69,7 +70,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
69
70
|
return metrics;
|
|
70
71
|
}()
|
|
71
72
|
};
|
|
72
|
-
this.json = {
|
|
73
|
+
this.dev.json = {
|
|
73
74
|
commit: function () {
|
|
74
75
|
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args) {
|
|
75
76
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -159,7 +160,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
159
160
|
return serialize;
|
|
160
161
|
}()
|
|
161
162
|
};
|
|
162
|
-
this.meta = {
|
|
163
|
+
this.dev.meta = {
|
|
163
164
|
info: function () {
|
|
164
165
|
var _info = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
165
166
|
var args,
|
|
@@ -265,7 +266,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
265
266
|
case 0:
|
|
266
267
|
this._init(jwk);
|
|
267
268
|
_context8.next = 3;
|
|
268
|
-
return this.meta.info({});
|
|
269
|
+
return this.dev.meta.info({});
|
|
269
270
|
case 3:
|
|
270
271
|
this._info = _context8.sent;
|
|
271
272
|
return _context8.abrupt("return", this);
|
|
@@ -311,20 +312,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
311
312
|
key: "getImage",
|
|
312
313
|
value: function () {
|
|
313
314
|
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
314
|
-
var
|
|
315
|
+
var _this$image;
|
|
316
|
+
var result, image;
|
|
315
317
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
316
318
|
while (1) switch (_context10.prev = _context10.next) {
|
|
317
319
|
case 0:
|
|
318
320
|
_context10.next = 2;
|
|
319
321
|
return this.send({
|
|
320
322
|
path: "/~wao@1.0/cache_wasm_image",
|
|
321
|
-
method: "POST",
|
|
322
323
|
filename: "test/aos-2-pure-xs.wasm"
|
|
323
324
|
});
|
|
324
325
|
case 2:
|
|
325
326
|
result = _context10.sent;
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
image = result.headers.get("image");
|
|
328
|
+
(_this$image = this.image) !== null && _this$image !== void 0 ? _this$image : this.image = image;
|
|
329
|
+
return _context10.abrupt("return", image);
|
|
330
|
+
case 6:
|
|
328
331
|
case "end":
|
|
329
332
|
return _context10.stop();
|
|
330
333
|
}
|
|
@@ -335,14 +338,44 @@ var HB = /*#__PURE__*/function () {
|
|
|
335
338
|
}
|
|
336
339
|
return getImage;
|
|
337
340
|
}()
|
|
341
|
+
}, {
|
|
342
|
+
key: "getLua",
|
|
343
|
+
value: function () {
|
|
344
|
+
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
345
|
+
var _this$lua;
|
|
346
|
+
var result, lua;
|
|
347
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
348
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
349
|
+
case 0:
|
|
350
|
+
_context11.next = 2;
|
|
351
|
+
return this.send({
|
|
352
|
+
path: "/~wao@1.0/cache_lua_module",
|
|
353
|
+
filename: "test/hyper-aos.lua"
|
|
354
|
+
});
|
|
355
|
+
case 2:
|
|
356
|
+
result = _context11.sent;
|
|
357
|
+
lua = result.headers.get("id").split("/").pop();
|
|
358
|
+
(_this$lua = this.lua) !== null && _this$lua !== void 0 ? _this$lua : this.lua = lua;
|
|
359
|
+
return _context11.abrupt("return", lua);
|
|
360
|
+
case 6:
|
|
361
|
+
case "end":
|
|
362
|
+
return _context11.stop();
|
|
363
|
+
}
|
|
364
|
+
}, _callee11, this);
|
|
365
|
+
}));
|
|
366
|
+
function getLua() {
|
|
367
|
+
return _getLua.apply(this, arguments);
|
|
368
|
+
}
|
|
369
|
+
return getLua;
|
|
370
|
+
}()
|
|
338
371
|
}, {
|
|
339
372
|
key: "messageAOS",
|
|
340
373
|
value: function () {
|
|
341
|
-
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
374
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref2) {
|
|
342
375
|
var _pid;
|
|
343
376
|
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
344
|
-
return _regeneratorRuntime().wrap(function
|
|
345
|
-
while (1) switch (
|
|
377
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
378
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
346
379
|
case 0:
|
|
347
380
|
pid = _ref2.pid, _ref2$action = _ref2.action, action = _ref2$action === void 0 ? "Eval" : _ref2$action, _ref2$tags = _ref2.tags, tags = _ref2$tags === void 0 ? {} : _ref2$tags, data = _ref2.data;
|
|
348
381
|
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
@@ -356,28 +389,28 @@ var HB = /*#__PURE__*/function () {
|
|
|
356
389
|
Target: pid
|
|
357
390
|
});
|
|
358
391
|
if (data) _tags.data = data;
|
|
359
|
-
|
|
392
|
+
_context12.next = 6;
|
|
360
393
|
return this.send(_tags);
|
|
361
394
|
case 6:
|
|
362
|
-
res =
|
|
395
|
+
res = _context12.sent;
|
|
363
396
|
slot = res.headers.get("slot");
|
|
364
|
-
|
|
365
|
-
|
|
397
|
+
_context12.t0 = slot;
|
|
398
|
+
_context12.next = 11;
|
|
366
399
|
return this.computeAOS({
|
|
367
400
|
pid: pid,
|
|
368
401
|
slot: slot
|
|
369
402
|
});
|
|
370
403
|
case 11:
|
|
371
|
-
|
|
372
|
-
return
|
|
373
|
-
slot:
|
|
374
|
-
outbox:
|
|
404
|
+
_context12.t1 = _context12.sent;
|
|
405
|
+
return _context12.abrupt("return", {
|
|
406
|
+
slot: _context12.t0,
|
|
407
|
+
outbox: _context12.t1
|
|
375
408
|
});
|
|
376
409
|
case 13:
|
|
377
410
|
case "end":
|
|
378
|
-
return
|
|
411
|
+
return _context12.stop();
|
|
379
412
|
}
|
|
380
|
-
},
|
|
413
|
+
}, _callee12, this);
|
|
381
414
|
}));
|
|
382
415
|
function messageAOS(_x8) {
|
|
383
416
|
return _messageAOS.apply(this, arguments);
|
|
@@ -387,10 +420,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
387
420
|
}, {
|
|
388
421
|
key: "path",
|
|
389
422
|
value: function path() {
|
|
390
|
-
var dev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "
|
|
391
|
-
var _path = arguments.length > 1
|
|
423
|
+
var dev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "message";
|
|
424
|
+
var _path = arguments.length > 1 ? arguments[1] : undefined;
|
|
392
425
|
var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
393
426
|
var params = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
427
|
+
var pid = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
428
|
+
var tail = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
|
|
394
429
|
if (!/@/.test(dev)) dev += "@1.0";
|
|
395
430
|
var _params = "";
|
|
396
431
|
if (!(0, _ramda.isEmpty)(params)) {
|
|
@@ -400,24 +435,35 @@ var HB = /*#__PURE__*/function () {
|
|
|
400
435
|
i++;
|
|
401
436
|
}
|
|
402
437
|
}
|
|
403
|
-
return "".concat(this.url, "
|
|
438
|
+
return "".concat(this.url, "/").concat(pid, "~").concat(dev).concat(_path ? "/".concat(_path) : "").concat(tail).concat(json ? "/~json@1.0/serialize" : "").concat(_params);
|
|
404
439
|
}
|
|
405
440
|
}, {
|
|
406
441
|
key: "text",
|
|
407
442
|
value: function () {
|
|
408
|
-
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
409
|
-
|
|
410
|
-
|
|
443
|
+
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(dev, path) {
|
|
444
|
+
var params,
|
|
445
|
+
tail,
|
|
446
|
+
pid,
|
|
447
|
+
_args13 = arguments;
|
|
448
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
449
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
411
450
|
case 0:
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
451
|
+
params = _args13.length > 2 && _args13[2] !== undefined ? _args13[2] : {};
|
|
452
|
+
tail = _args13.length > 3 ? _args13[3] : undefined;
|
|
453
|
+
pid = "";
|
|
454
|
+
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
455
|
+
pid = dev;
|
|
456
|
+
dev = "process";
|
|
457
|
+
}
|
|
458
|
+
_context13.next = 6;
|
|
459
|
+
return this.fetch(this.path(dev, path, false, params, pid, tail), false);
|
|
460
|
+
case 6:
|
|
461
|
+
return _context13.abrupt("return", _context13.sent);
|
|
462
|
+
case 7:
|
|
417
463
|
case "end":
|
|
418
|
-
return
|
|
464
|
+
return _context13.stop();
|
|
419
465
|
}
|
|
420
|
-
},
|
|
466
|
+
}, _callee13, this);
|
|
421
467
|
}));
|
|
422
468
|
function text(_x9, _x10) {
|
|
423
469
|
return _text.apply(this, arguments);
|
|
@@ -427,19 +473,30 @@ var HB = /*#__PURE__*/function () {
|
|
|
427
473
|
}, {
|
|
428
474
|
key: "json",
|
|
429
475
|
value: function () {
|
|
430
|
-
var _json = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
431
|
-
|
|
432
|
-
|
|
476
|
+
var _json = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(dev, path) {
|
|
477
|
+
var params,
|
|
478
|
+
tail,
|
|
479
|
+
pid,
|
|
480
|
+
_args14 = arguments;
|
|
481
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
482
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
433
483
|
case 0:
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
484
|
+
params = _args14.length > 2 && _args14[2] !== undefined ? _args14[2] : {};
|
|
485
|
+
tail = _args14.length > 3 ? _args14[3] : undefined;
|
|
486
|
+
pid = "";
|
|
487
|
+
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
488
|
+
pid = dev;
|
|
489
|
+
dev = "process";
|
|
490
|
+
}
|
|
491
|
+
_context14.next = 6;
|
|
492
|
+
return this.fetch(this.path(dev, path, true, params, pid, tail));
|
|
493
|
+
case 6:
|
|
494
|
+
return _context14.abrupt("return", _context14.sent);
|
|
495
|
+
case 7:
|
|
439
496
|
case "end":
|
|
440
|
-
return
|
|
497
|
+
return _context14.stop();
|
|
441
498
|
}
|
|
442
|
-
},
|
|
499
|
+
}, _callee14, this);
|
|
443
500
|
}));
|
|
444
501
|
function json(_x11, _x12) {
|
|
445
502
|
return _json.apply(this, arguments);
|
|
@@ -457,24 +514,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
457
514
|
};
|
|
458
515
|
return fetch;
|
|
459
516
|
}(/*#__PURE__*/function () {
|
|
460
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
517
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(url) {
|
|
461
518
|
var json,
|
|
462
|
-
|
|
463
|
-
return _regeneratorRuntime().wrap(function
|
|
464
|
-
while (1) switch (
|
|
519
|
+
_args15 = arguments;
|
|
520
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
521
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
465
522
|
case 0:
|
|
466
|
-
json =
|
|
467
|
-
|
|
523
|
+
json = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : true;
|
|
524
|
+
_context15.next = 3;
|
|
468
525
|
return fetch(url).then(function (r) {
|
|
469
526
|
return json ? r.json() : r.text();
|
|
470
527
|
});
|
|
471
528
|
case 3:
|
|
472
|
-
return
|
|
529
|
+
return _context15.abrupt("return", _context15.sent);
|
|
473
530
|
case 4:
|
|
474
531
|
case "end":
|
|
475
|
-
return
|
|
532
|
+
return _context15.stop();
|
|
476
533
|
}
|
|
477
|
-
},
|
|
534
|
+
}, _callee15);
|
|
478
535
|
}));
|
|
479
536
|
return function (_x13) {
|
|
480
537
|
return _ref3.apply(this, arguments);
|
|
@@ -483,23 +540,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
483
540
|
}, {
|
|
484
541
|
key: "computeAOS",
|
|
485
542
|
value: function () {
|
|
486
|
-
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
543
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref4) {
|
|
487
544
|
var pid, slot;
|
|
488
|
-
return _regeneratorRuntime().wrap(function
|
|
489
|
-
while (1) switch (
|
|
545
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
546
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
490
547
|
case 0:
|
|
491
548
|
pid = _ref4.pid, slot = _ref4.slot;
|
|
492
|
-
|
|
493
|
-
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/outbox
|
|
549
|
+
_context16.next = 3;
|
|
550
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/outbox/~json@1.0/serialize?slot=").concat(slot)).then(function (r) {
|
|
494
551
|
return r.json();
|
|
495
552
|
});
|
|
496
553
|
case 3:
|
|
497
|
-
return
|
|
554
|
+
return _context16.abrupt("return", _context16.sent);
|
|
498
555
|
case 4:
|
|
499
556
|
case "end":
|
|
500
|
-
return
|
|
557
|
+
return _context16.stop();
|
|
501
558
|
}
|
|
502
|
-
},
|
|
559
|
+
}, _callee16, this);
|
|
503
560
|
}));
|
|
504
561
|
function computeAOS(_x14) {
|
|
505
562
|
return _computeAOS.apply(this, arguments);
|
|
@@ -507,27 +564,53 @@ var HB = /*#__PURE__*/function () {
|
|
|
507
564
|
return computeAOS;
|
|
508
565
|
}()
|
|
509
566
|
}, {
|
|
510
|
-
key: "
|
|
567
|
+
key: "computeLua",
|
|
511
568
|
value: function () {
|
|
512
|
-
var
|
|
569
|
+
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref5) {
|
|
513
570
|
var pid, slot;
|
|
514
|
-
return _regeneratorRuntime().wrap(function
|
|
515
|
-
while (1) switch (
|
|
571
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
572
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
516
573
|
case 0:
|
|
517
574
|
pid = _ref5.pid, slot = _ref5.slot;
|
|
518
|
-
|
|
519
|
-
return fetch("".concat(this.url, "/").concat(pid, "/compute/
|
|
575
|
+
_context17.next = 3;
|
|
576
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/~json@1.0/serialize?slot=").concat(slot)).then(function (r) {
|
|
520
577
|
return r.json();
|
|
521
578
|
});
|
|
522
579
|
case 3:
|
|
523
|
-
return
|
|
580
|
+
return _context17.abrupt("return", _context17.sent);
|
|
524
581
|
case 4:
|
|
525
582
|
case "end":
|
|
526
|
-
return
|
|
583
|
+
return _context17.stop();
|
|
527
584
|
}
|
|
528
|
-
},
|
|
585
|
+
}, _callee17, this);
|
|
529
586
|
}));
|
|
530
|
-
function
|
|
587
|
+
function computeLua(_x15) {
|
|
588
|
+
return _computeLua.apply(this, arguments);
|
|
589
|
+
}
|
|
590
|
+
return computeLua;
|
|
591
|
+
}()
|
|
592
|
+
}, {
|
|
593
|
+
key: "compute",
|
|
594
|
+
value: function () {
|
|
595
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref6) {
|
|
596
|
+
var pid, slot;
|
|
597
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
598
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
599
|
+
case 0:
|
|
600
|
+
pid = _ref6.pid, slot = _ref6.slot;
|
|
601
|
+
_context18.next = 3;
|
|
602
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/~json@1.0/serialize?slot=").concat(slot)).then(function (r) {
|
|
603
|
+
return r.json();
|
|
604
|
+
});
|
|
605
|
+
case 3:
|
|
606
|
+
return _context18.abrupt("return", _context18.sent);
|
|
607
|
+
case 4:
|
|
608
|
+
case "end":
|
|
609
|
+
return _context18.stop();
|
|
610
|
+
}
|
|
611
|
+
}, _callee18, this);
|
|
612
|
+
}));
|
|
613
|
+
function compute(_x16) {
|
|
531
614
|
return _compute.apply(this, arguments);
|
|
532
615
|
}
|
|
533
616
|
return compute;
|
|
@@ -535,27 +618,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
535
618
|
}, {
|
|
536
619
|
key: "computeLegacy",
|
|
537
620
|
value: function () {
|
|
538
|
-
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
621
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref7) {
|
|
539
622
|
var pid, slot, json;
|
|
540
|
-
return _regeneratorRuntime().wrap(function
|
|
541
|
-
while (1) switch (
|
|
623
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
624
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
542
625
|
case 0:
|
|
543
|
-
pid =
|
|
544
|
-
|
|
626
|
+
pid = _ref7.pid, slot = _ref7.slot;
|
|
627
|
+
_context19.next = 3;
|
|
545
628
|
return this.compute({
|
|
546
629
|
pid: pid,
|
|
547
630
|
slot: slot
|
|
548
631
|
});
|
|
549
632
|
case 3:
|
|
550
|
-
json =
|
|
551
|
-
return
|
|
633
|
+
json = _context19.sent;
|
|
634
|
+
return _context19.abrupt("return", JSON.parse(json.results.json.body));
|
|
552
635
|
case 5:
|
|
553
636
|
case "end":
|
|
554
|
-
return
|
|
637
|
+
return _context19.stop();
|
|
555
638
|
}
|
|
556
|
-
},
|
|
639
|
+
}, _callee19, this);
|
|
557
640
|
}));
|
|
558
|
-
function computeLegacy(
|
|
641
|
+
function computeLegacy(_x17) {
|
|
559
642
|
return _computeLegacy.apply(this, arguments);
|
|
560
643
|
}
|
|
561
644
|
return computeLegacy;
|
|
@@ -563,24 +646,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
563
646
|
}, {
|
|
564
647
|
key: "spawn",
|
|
565
648
|
value: function () {
|
|
566
|
-
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
649
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
567
650
|
var _this$scheduler;
|
|
568
651
|
var tags,
|
|
569
652
|
addr,
|
|
570
653
|
res,
|
|
571
|
-
|
|
572
|
-
return _regeneratorRuntime().wrap(function
|
|
573
|
-
while (1) switch (
|
|
654
|
+
_args20 = arguments;
|
|
655
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
656
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
574
657
|
case 0:
|
|
575
|
-
tags =
|
|
576
|
-
|
|
577
|
-
return this.meta.info({
|
|
658
|
+
tags = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
|
|
659
|
+
_context20.next = 3;
|
|
660
|
+
return this.dev.meta.info({
|
|
578
661
|
key: "address"
|
|
579
662
|
});
|
|
580
663
|
case 3:
|
|
581
|
-
addr =
|
|
664
|
+
addr = _context20.sent;
|
|
582
665
|
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
583
|
-
|
|
666
|
+
_context20.next = 7;
|
|
584
667
|
return this.send((0, _ramda.mergeLeft)(tags, {
|
|
585
668
|
device: "process@1.0",
|
|
586
669
|
path: "/schedule",
|
|
@@ -591,16 +674,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
591
674
|
"execution-device": "test-device@1.0"
|
|
592
675
|
}));
|
|
593
676
|
case 7:
|
|
594
|
-
res =
|
|
595
|
-
return
|
|
677
|
+
res = _context20.sent;
|
|
678
|
+
return _context20.abrupt("return", {
|
|
596
679
|
res: res,
|
|
597
680
|
pid: res.headers.get("process")
|
|
598
681
|
});
|
|
599
682
|
case 9:
|
|
600
683
|
case "end":
|
|
601
|
-
return
|
|
684
|
+
return _context20.stop();
|
|
602
685
|
}
|
|
603
|
-
},
|
|
686
|
+
}, _callee20, this);
|
|
604
687
|
}));
|
|
605
688
|
function spawn() {
|
|
606
689
|
return _spawn.apply(this, arguments);
|
|
@@ -610,36 +693,36 @@ var HB = /*#__PURE__*/function () {
|
|
|
610
693
|
}, {
|
|
611
694
|
key: "message",
|
|
612
695
|
value: function () {
|
|
613
|
-
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
696
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(args) {
|
|
614
697
|
var pid, _yield$this$schedule, slot, res;
|
|
615
|
-
return _regeneratorRuntime().wrap(function
|
|
616
|
-
while (1) switch (
|
|
698
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
699
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
617
700
|
case 0:
|
|
618
701
|
pid = args.pid;
|
|
619
|
-
|
|
702
|
+
_context21.next = 3;
|
|
620
703
|
return this.schedule(args);
|
|
621
704
|
case 3:
|
|
622
|
-
_yield$this$schedule =
|
|
705
|
+
_yield$this$schedule = _context21.sent;
|
|
623
706
|
slot = _yield$this$schedule.slot;
|
|
624
|
-
|
|
707
|
+
_context21.next = 7;
|
|
625
708
|
return this.compute({
|
|
626
709
|
pid: pid,
|
|
627
710
|
slot: slot
|
|
628
711
|
});
|
|
629
712
|
case 7:
|
|
630
|
-
res =
|
|
631
|
-
return
|
|
713
|
+
res = _context21.sent;
|
|
714
|
+
return _context21.abrupt("return", {
|
|
632
715
|
slot: slot,
|
|
633
716
|
pid: pid,
|
|
634
717
|
res: res
|
|
635
718
|
});
|
|
636
719
|
case 9:
|
|
637
720
|
case "end":
|
|
638
|
-
return
|
|
721
|
+
return _context21.stop();
|
|
639
722
|
}
|
|
640
|
-
},
|
|
723
|
+
}, _callee21, this);
|
|
641
724
|
}));
|
|
642
|
-
function message(
|
|
725
|
+
function message(_x18) {
|
|
643
726
|
return _message.apply(this, arguments);
|
|
644
727
|
}
|
|
645
728
|
return message;
|
|
@@ -647,22 +730,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
647
730
|
}, {
|
|
648
731
|
key: "scheduleLegacy",
|
|
649
732
|
value: function () {
|
|
650
|
-
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
651
|
-
var
|
|
733
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
734
|
+
var _ref8,
|
|
652
735
|
pid,
|
|
653
|
-
|
|
736
|
+
_ref8$action,
|
|
654
737
|
action,
|
|
655
|
-
|
|
738
|
+
_ref8$tags,
|
|
656
739
|
tags,
|
|
657
740
|
data,
|
|
658
741
|
scheduler,
|
|
659
|
-
|
|
660
|
-
return _regeneratorRuntime().wrap(function
|
|
661
|
-
while (1) switch (
|
|
742
|
+
_args22 = arguments;
|
|
743
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
744
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
662
745
|
case 0:
|
|
663
|
-
|
|
746
|
+
_ref8 = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {}, pid = _ref8.pid, _ref8$action = _ref8.action, action = _ref8$action === void 0 ? "Eval" : _ref8$action, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data, scheduler = _ref8.scheduler;
|
|
664
747
|
if (action) tags.Action = action;
|
|
665
|
-
|
|
748
|
+
_context22.next = 4;
|
|
666
749
|
return this.schedule({
|
|
667
750
|
pid: pid,
|
|
668
751
|
tags: tags,
|
|
@@ -670,36 +753,59 @@ var HB = /*#__PURE__*/function () {
|
|
|
670
753
|
scheduler: scheduler
|
|
671
754
|
});
|
|
672
755
|
case 4:
|
|
673
|
-
return
|
|
756
|
+
return _context22.abrupt("return", _context22.sent);
|
|
674
757
|
case 5:
|
|
675
758
|
case "end":
|
|
676
|
-
return
|
|
759
|
+
return _context22.stop();
|
|
677
760
|
}
|
|
678
|
-
},
|
|
761
|
+
}, _callee22, this);
|
|
679
762
|
}));
|
|
680
763
|
function scheduleLegacy() {
|
|
681
764
|
return _scheduleLegacy.apply(this, arguments);
|
|
682
765
|
}
|
|
683
766
|
return scheduleLegacy;
|
|
684
767
|
}()
|
|
768
|
+
}, {
|
|
769
|
+
key: "scheduleLua",
|
|
770
|
+
value: function () {
|
|
771
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
772
|
+
var _args23 = arguments;
|
|
773
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
774
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
775
|
+
case 0:
|
|
776
|
+
_context23.next = 2;
|
|
777
|
+
return this.scheduleLegacy.apply(this, _args23);
|
|
778
|
+
case 2:
|
|
779
|
+
return _context23.abrupt("return", _context23.sent);
|
|
780
|
+
case 3:
|
|
781
|
+
case "end":
|
|
782
|
+
return _context23.stop();
|
|
783
|
+
}
|
|
784
|
+
}, _callee23, this);
|
|
785
|
+
}));
|
|
786
|
+
function scheduleLua() {
|
|
787
|
+
return _scheduleLua.apply(this, arguments);
|
|
788
|
+
}
|
|
789
|
+
return scheduleLua;
|
|
790
|
+
}()
|
|
685
791
|
}, {
|
|
686
792
|
key: "schedule",
|
|
687
793
|
value: function () {
|
|
688
|
-
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
794
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
689
795
|
var _pid2, _scheduler;
|
|
690
|
-
var
|
|
796
|
+
var _ref9,
|
|
691
797
|
pid,
|
|
692
|
-
|
|
798
|
+
_ref9$tags,
|
|
693
799
|
tags,
|
|
694
800
|
data,
|
|
695
801
|
scheduler,
|
|
696
802
|
_tags,
|
|
697
803
|
res,
|
|
698
|
-
|
|
699
|
-
return _regeneratorRuntime().wrap(function
|
|
700
|
-
while (1) switch (
|
|
804
|
+
_args24 = arguments;
|
|
805
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
806
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
701
807
|
case 0:
|
|
702
|
-
|
|
808
|
+
_ref9 = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {}, pid = _ref9.pid, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, data = _ref9.data, scheduler = _ref9.scheduler;
|
|
703
809
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
704
810
|
(_scheduler = scheduler) !== null && _scheduler !== void 0 ? _scheduler : scheduler = this.scheduler;
|
|
705
811
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
@@ -710,19 +816,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
710
816
|
Target: pid
|
|
711
817
|
});
|
|
712
818
|
if (data) _tags.data = data;
|
|
713
|
-
|
|
819
|
+
_context24.next = 7;
|
|
714
820
|
return this.send(_tags);
|
|
715
821
|
case 7:
|
|
716
|
-
res =
|
|
717
|
-
return
|
|
822
|
+
res = _context24.sent;
|
|
823
|
+
return _context24.abrupt("return", {
|
|
718
824
|
slot: res.headers.get("slot"),
|
|
719
825
|
res: res
|
|
720
826
|
});
|
|
721
827
|
case 9:
|
|
722
828
|
case "end":
|
|
723
|
-
return
|
|
829
|
+
return _context24.stop();
|
|
724
830
|
}
|
|
725
|
-
},
|
|
831
|
+
}, _callee24, this);
|
|
726
832
|
}));
|
|
727
833
|
function schedule() {
|
|
728
834
|
return _schedule.apply(this, arguments);
|
|
@@ -732,43 +838,43 @@ var HB = /*#__PURE__*/function () {
|
|
|
732
838
|
}, {
|
|
733
839
|
key: "spawnAOS",
|
|
734
840
|
value: function () {
|
|
735
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
736
|
-
var _this$scheduler2, _image, _this$
|
|
841
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(image) {
|
|
842
|
+
var _this$scheduler2, _image, _this$image2, _this$pid;
|
|
737
843
|
var addr, res, pid;
|
|
738
|
-
return _regeneratorRuntime().wrap(function
|
|
739
|
-
while (1) switch (
|
|
844
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
845
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
740
846
|
case 0:
|
|
741
|
-
|
|
742
|
-
return this.meta.info({
|
|
847
|
+
_context25.next = 2;
|
|
848
|
+
return this.dev.meta.info({
|
|
743
849
|
key: "address"
|
|
744
850
|
});
|
|
745
851
|
case 2:
|
|
746
|
-
addr =
|
|
852
|
+
addr = _context25.sent;
|
|
747
853
|
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
748
854
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
749
|
-
|
|
855
|
+
_context25.next = 8;
|
|
750
856
|
break;
|
|
751
857
|
}
|
|
752
858
|
_image;
|
|
753
|
-
|
|
859
|
+
_context25.next = 16;
|
|
754
860
|
break;
|
|
755
861
|
case 8:
|
|
756
|
-
if (!((_this$
|
|
757
|
-
|
|
862
|
+
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
863
|
+
_context25.next = 12;
|
|
758
864
|
break;
|
|
759
865
|
}
|
|
760
|
-
|
|
761
|
-
|
|
866
|
+
_context25.t0 = _this$image2;
|
|
867
|
+
_context25.next = 15;
|
|
762
868
|
break;
|
|
763
869
|
case 12:
|
|
764
|
-
|
|
870
|
+
_context25.next = 14;
|
|
765
871
|
return this.getImage();
|
|
766
872
|
case 14:
|
|
767
|
-
|
|
873
|
+
_context25.t0 = _context25.sent;
|
|
768
874
|
case 15:
|
|
769
|
-
image =
|
|
875
|
+
image = _context25.t0;
|
|
770
876
|
case 16:
|
|
771
|
-
|
|
877
|
+
_context25.next = 18;
|
|
772
878
|
return this.send({
|
|
773
879
|
device: "process@1.0",
|
|
774
880
|
path: "/schedule",
|
|
@@ -789,24 +895,103 @@ var HB = /*#__PURE__*/function () {
|
|
|
789
895
|
passes: 2
|
|
790
896
|
});
|
|
791
897
|
case 18:
|
|
792
|
-
res =
|
|
898
|
+
res = _context25.sent;
|
|
793
899
|
pid = res.headers.get("process");
|
|
794
900
|
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
795
|
-
return
|
|
901
|
+
return _context25.abrupt("return", {
|
|
796
902
|
pid: pid,
|
|
797
903
|
res: res
|
|
798
904
|
});
|
|
799
905
|
case 22:
|
|
800
906
|
case "end":
|
|
801
|
-
return
|
|
907
|
+
return _context25.stop();
|
|
802
908
|
}
|
|
803
|
-
},
|
|
909
|
+
}, _callee25, this);
|
|
804
910
|
}));
|
|
805
|
-
function spawnAOS(
|
|
911
|
+
function spawnAOS(_x19) {
|
|
806
912
|
return _spawnAOS.apply(this, arguments);
|
|
807
913
|
}
|
|
808
914
|
return spawnAOS;
|
|
809
915
|
}()
|
|
916
|
+
}, {
|
|
917
|
+
key: "spawnLua",
|
|
918
|
+
value: function () {
|
|
919
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
920
|
+
var _this$scheduler3, _lua, _this$lua2, _this$pid2;
|
|
921
|
+
var lua,
|
|
922
|
+
addr,
|
|
923
|
+
res,
|
|
924
|
+
pid,
|
|
925
|
+
_args26 = arguments;
|
|
926
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
927
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
928
|
+
case 0:
|
|
929
|
+
lua = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : "8DvyaxF8xpHMgPdmpMnhcb1mjY-M8qr2kGxnCpGMb60";
|
|
930
|
+
_context26.next = 3;
|
|
931
|
+
return this.dev.meta.info({
|
|
932
|
+
key: "address"
|
|
933
|
+
});
|
|
934
|
+
case 3:
|
|
935
|
+
addr = _context26.sent;
|
|
936
|
+
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
937
|
+
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
938
|
+
_context26.next = 9;
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
_lua;
|
|
942
|
+
_context26.next = 17;
|
|
943
|
+
break;
|
|
944
|
+
case 9:
|
|
945
|
+
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
946
|
+
_context26.next = 13;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
_context26.t0 = _this$lua2;
|
|
950
|
+
_context26.next = 16;
|
|
951
|
+
break;
|
|
952
|
+
case 13:
|
|
953
|
+
_context26.next = 15;
|
|
954
|
+
return this.getLua();
|
|
955
|
+
case 15:
|
|
956
|
+
_context26.t0 = _context26.sent;
|
|
957
|
+
case 16:
|
|
958
|
+
lua = _context26.t0;
|
|
959
|
+
case 17:
|
|
960
|
+
_context26.next = 19;
|
|
961
|
+
return this.send({
|
|
962
|
+
device: "process@1.0",
|
|
963
|
+
path: "/schedule",
|
|
964
|
+
scheduler: this.scheduler,
|
|
965
|
+
"Data-Protocol": "ao",
|
|
966
|
+
Variant: "ao.N.1",
|
|
967
|
+
"scheduler-location": this.scheduler,
|
|
968
|
+
Authority: this.scheduler,
|
|
969
|
+
"random-seed": seed(16),
|
|
970
|
+
Type: "Process",
|
|
971
|
+
module: lua,
|
|
972
|
+
"scheduler-device": "scheduler@1.0",
|
|
973
|
+
"execution-device": "lua@5.3a",
|
|
974
|
+
"patch-from": "/results/outbox"
|
|
975
|
+
});
|
|
976
|
+
case 19:
|
|
977
|
+
res = _context26.sent;
|
|
978
|
+
pid = res.headers.get("process");
|
|
979
|
+
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
980
|
+
return _context26.abrupt("return", {
|
|
981
|
+
pid: pid,
|
|
982
|
+
res: res
|
|
983
|
+
});
|
|
984
|
+
case 23:
|
|
985
|
+
case "end":
|
|
986
|
+
return _context26.stop();
|
|
987
|
+
}
|
|
988
|
+
}, _callee26, this);
|
|
989
|
+
}));
|
|
990
|
+
function spawnLua() {
|
|
991
|
+
return _spawnLua.apply(this, arguments);
|
|
992
|
+
}
|
|
993
|
+
return spawnLua;
|
|
994
|
+
}()
|
|
810
995
|
}, {
|
|
811
996
|
key: "parseMetrics",
|
|
812
997
|
value: function parseMetrics(txt) {
|
|
@@ -892,38 +1077,38 @@ var HB = /*#__PURE__*/function () {
|
|
|
892
1077
|
}, {
|
|
893
1078
|
key: "messages",
|
|
894
1079
|
value: function () {
|
|
895
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1080
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
896
1081
|
var _this2 = this;
|
|
897
|
-
var
|
|
1082
|
+
var _ref10,
|
|
898
1083
|
pid,
|
|
899
1084
|
from,
|
|
900
1085
|
to,
|
|
901
1086
|
limit,
|
|
902
1087
|
params,
|
|
903
1088
|
res,
|
|
904
|
-
|
|
905
|
-
return _regeneratorRuntime().wrap(function
|
|
906
|
-
while (1) switch (
|
|
1089
|
+
_args28 = arguments;
|
|
1090
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1091
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
907
1092
|
case 0:
|
|
908
|
-
|
|
1093
|
+
_ref10 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, pid = _ref10.pid, from = _ref10.from, to = _ref10.to, limit = _ref10.limit;
|
|
909
1094
|
params = "target=".concat(pid);
|
|
910
1095
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
911
1096
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
912
1097
|
params += "&accept=application/aos-2";
|
|
913
|
-
|
|
1098
|
+
_context28.next = 7;
|
|
914
1099
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
915
1100
|
return r.json();
|
|
916
1101
|
});
|
|
917
1102
|
case 7:
|
|
918
|
-
res =
|
|
1103
|
+
res = _context28.sent;
|
|
919
1104
|
if (res.page_info.has_next_page) {
|
|
920
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1105
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
921
1106
|
var from2;
|
|
922
|
-
return _regeneratorRuntime().wrap(function
|
|
923
|
-
while (1) switch (
|
|
1107
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1108
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
924
1109
|
case 0:
|
|
925
1110
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
926
|
-
|
|
1111
|
+
_context27.next = 3;
|
|
927
1112
|
return _this2.message({
|
|
928
1113
|
pid: pid,
|
|
929
1114
|
from: from2,
|
|
@@ -931,20 +1116,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
931
1116
|
limit: limit
|
|
932
1117
|
});
|
|
933
1118
|
case 3:
|
|
934
|
-
return
|
|
1119
|
+
return _context27.abrupt("return", _context27.sent);
|
|
935
1120
|
case 4:
|
|
936
1121
|
case "end":
|
|
937
|
-
return
|
|
1122
|
+
return _context27.stop();
|
|
938
1123
|
}
|
|
939
|
-
},
|
|
1124
|
+
}, _callee27);
|
|
940
1125
|
}));
|
|
941
1126
|
}
|
|
942
|
-
return
|
|
1127
|
+
return _context28.abrupt("return", res);
|
|
943
1128
|
case 10:
|
|
944
1129
|
case "end":
|
|
945
|
-
return
|
|
1130
|
+
return _context28.stop();
|
|
946
1131
|
}
|
|
947
|
-
},
|
|
1132
|
+
}, _callee28, this);
|
|
948
1133
|
}));
|
|
949
1134
|
function messages() {
|
|
950
1135
|
return _messages.apply(this, arguments);
|
|
@@ -954,16 +1139,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
954
1139
|
}, {
|
|
955
1140
|
key: "spawnLegacy",
|
|
956
1141
|
value: function () {
|
|
957
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
958
|
-
var
|
|
959
|
-
|
|
1142
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1143
|
+
var _ref12,
|
|
1144
|
+
_ref12$tags,
|
|
960
1145
|
tags,
|
|
961
1146
|
data,
|
|
962
|
-
|
|
963
|
-
return _regeneratorRuntime().wrap(function
|
|
964
|
-
while (1) switch (
|
|
1147
|
+
_args29 = arguments;
|
|
1148
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1149
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
965
1150
|
case 0:
|
|
966
|
-
|
|
1151
|
+
_ref12 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, _ref12$tags = _ref12.tags, tags = _ref12$tags === void 0 ? {} : _ref12$tags, data = _ref12.data;
|
|
967
1152
|
tags = (0, _ramda.mergeLeft)(tags, {
|
|
968
1153
|
data: data,
|
|
969
1154
|
Type: "Process",
|
|
@@ -978,15 +1163,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
978
1163
|
"scheduler-device": "scheduler@1.0",
|
|
979
1164
|
"execution-device": "genesis-wasm@1.0"
|
|
980
1165
|
});
|
|
981
|
-
|
|
1166
|
+
_context29.next = 4;
|
|
982
1167
|
return this.spawn(tags);
|
|
983
1168
|
case 4:
|
|
984
|
-
return
|
|
1169
|
+
return _context29.abrupt("return", _context29.sent);
|
|
985
1170
|
case 5:
|
|
986
1171
|
case "end":
|
|
987
|
-
return
|
|
1172
|
+
return _context29.stop();
|
|
988
1173
|
}
|
|
989
|
-
},
|
|
1174
|
+
}, _callee29, this);
|
|
990
1175
|
}));
|
|
991
1176
|
function spawnLegacy() {
|
|
992
1177
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -994,41 +1179,41 @@ var HB = /*#__PURE__*/function () {
|
|
|
994
1179
|
return spawnLegacy;
|
|
995
1180
|
}()
|
|
996
1181
|
/*
|
|
997
|
-
|
|
1182
|
+
async scheduleLegacy({ tags = {}, data, process, action = "Eval" } = {}) {
|
|
998
1183
|
tags = mergeLeft(tags, {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1184
|
+
path: `${process}/schedule`,
|
|
1185
|
+
type: "Message",
|
|
1186
|
+
action,
|
|
1187
|
+
data,
|
|
1188
|
+
"Data-Protocol": "ao",
|
|
1189
|
+
Variant: "ao.N.1",
|
|
1005
1190
|
})
|
|
1006
1191
|
return (await this.post({ tags })).slot.text()
|
|
1007
|
-
|
|
1192
|
+
}
|
|
1008
1193
|
*/
|
|
1009
1194
|
}, {
|
|
1010
1195
|
key: "dryrun",
|
|
1011
1196
|
value: (function () {
|
|
1012
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1013
|
-
var
|
|
1014
|
-
|
|
1197
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1198
|
+
var _ref13,
|
|
1199
|
+
_ref13$tags,
|
|
1015
1200
|
tags,
|
|
1016
1201
|
pid,
|
|
1017
1202
|
action,
|
|
1018
1203
|
data,
|
|
1019
1204
|
json,
|
|
1020
1205
|
res,
|
|
1021
|
-
|
|
1022
|
-
return _regeneratorRuntime().wrap(function
|
|
1023
|
-
while (1) switch (
|
|
1206
|
+
_args30 = arguments;
|
|
1207
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1208
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1024
1209
|
case 0:
|
|
1025
|
-
|
|
1210
|
+
_ref13 = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {}, _ref13$tags = _ref13.tags, tags = _ref13$tags === void 0 ? {} : _ref13$tags, pid = _ref13.pid, action = _ref13.action, data = _ref13.data;
|
|
1026
1211
|
if (typeof action === "string") tags.Action = action;
|
|
1027
1212
|
json = {
|
|
1028
1213
|
Tags: (0, _utils.buildTags)(tags)
|
|
1029
1214
|
};
|
|
1030
1215
|
if (data) json.Data = data;
|
|
1031
|
-
|
|
1216
|
+
_context30.next = 6;
|
|
1032
1217
|
return this.send({
|
|
1033
1218
|
path: "/~relay@1.0/call",
|
|
1034
1219
|
"relay-method": "POST",
|
|
@@ -1037,13 +1222,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1037
1222
|
body: JSON.stringify(json)
|
|
1038
1223
|
});
|
|
1039
1224
|
case 6:
|
|
1040
|
-
res =
|
|
1041
|
-
return
|
|
1225
|
+
res = _context30.sent;
|
|
1226
|
+
return _context30.abrupt("return", JSON.parse(res.body));
|
|
1042
1227
|
case 8:
|
|
1043
1228
|
case "end":
|
|
1044
|
-
return
|
|
1229
|
+
return _context30.stop();
|
|
1045
1230
|
}
|
|
1046
|
-
},
|
|
1231
|
+
}, _callee30, this);
|
|
1047
1232
|
}));
|
|
1048
1233
|
function dryrun() {
|
|
1049
1234
|
return _dryrun.apply(this, arguments);
|
|
@@ -1053,27 +1238,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1053
1238
|
}, {
|
|
1054
1239
|
key: "get",
|
|
1055
1240
|
value: function () {
|
|
1056
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1057
|
-
var device,
|
|
1058
|
-
return _regeneratorRuntime().wrap(function
|
|
1059
|
-
while (1) switch (
|
|
1241
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(_ref14) {
|
|
1242
|
+
var device, _ref14$path, path;
|
|
1243
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1244
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1060
1245
|
case 0:
|
|
1061
|
-
device =
|
|
1062
|
-
|
|
1246
|
+
device = _ref14.device, _ref14$path = _ref14.path, path = _ref14$path === void 0 ? "~meta@1.0/info" : _ref14$path;
|
|
1247
|
+
_context31.next = 3;
|
|
1063
1248
|
return this.request({
|
|
1064
1249
|
device: device,
|
|
1065
1250
|
path: path,
|
|
1066
1251
|
method: "GET"
|
|
1067
1252
|
});
|
|
1068
1253
|
case 3:
|
|
1069
|
-
return
|
|
1254
|
+
return _context31.abrupt("return", _context31.sent.body);
|
|
1070
1255
|
case 4:
|
|
1071
1256
|
case "end":
|
|
1072
|
-
return
|
|
1257
|
+
return _context31.stop();
|
|
1073
1258
|
}
|
|
1074
|
-
},
|
|
1259
|
+
}, _callee31, this);
|
|
1075
1260
|
}));
|
|
1076
|
-
function get(
|
|
1261
|
+
function get(_x20) {
|
|
1077
1262
|
return _get.apply(this, arguments);
|
|
1078
1263
|
}
|
|
1079
1264
|
return get;
|
|
@@ -1081,13 +1266,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1081
1266
|
}, {
|
|
1082
1267
|
key: "post",
|
|
1083
1268
|
value: function () {
|
|
1084
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1085
|
-
var device, tags,
|
|
1086
|
-
return _regeneratorRuntime().wrap(function
|
|
1087
|
-
while (1) switch (
|
|
1269
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(_ref15) {
|
|
1270
|
+
var device, tags, _ref15$path, path;
|
|
1271
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1272
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1088
1273
|
case 0:
|
|
1089
|
-
device =
|
|
1090
|
-
|
|
1274
|
+
device = _ref15.device, tags = _ref15.tags, _ref15$path = _ref15.path, path = _ref15$path === void 0 ? "/schedule" : _ref15$path;
|
|
1275
|
+
_context32.next = 3;
|
|
1091
1276
|
return this.request({
|
|
1092
1277
|
tags: tags,
|
|
1093
1278
|
device: device,
|
|
@@ -1095,14 +1280,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
1095
1280
|
method: "POST"
|
|
1096
1281
|
});
|
|
1097
1282
|
case 3:
|
|
1098
|
-
return
|
|
1283
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1099
1284
|
case 4:
|
|
1100
1285
|
case "end":
|
|
1101
|
-
return
|
|
1286
|
+
return _context32.stop();
|
|
1102
1287
|
}
|
|
1103
|
-
},
|
|
1288
|
+
}, _callee32, this);
|
|
1104
1289
|
}));
|
|
1105
|
-
function post(
|
|
1290
|
+
function post(_x21) {
|
|
1106
1291
|
return _post.apply(this, arguments);
|
|
1107
1292
|
}
|
|
1108
1293
|
return post;
|
|
@@ -1110,28 +1295,28 @@ var HB = /*#__PURE__*/function () {
|
|
|
1110
1295
|
}, {
|
|
1111
1296
|
key: "request",
|
|
1112
1297
|
value: function () {
|
|
1113
|
-
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1114
|
-
var device, tags,
|
|
1115
|
-
return _regeneratorRuntime().wrap(function
|
|
1116
|
-
while (1) switch (
|
|
1298
|
+
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(_ref16) {
|
|
1299
|
+
var device, tags, _ref16$method, method, _ref16$path, path, _tags;
|
|
1300
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1301
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1117
1302
|
case 0:
|
|
1118
|
-
device =
|
|
1303
|
+
device = _ref16.device, tags = _ref16.tags, _ref16$method = _ref16.method, method = _ref16$method === void 0 ? "POST" : _ref16$method, _ref16$path = _ref16.path, path = _ref16$path === void 0 ? "/schedule" : _ref16$path;
|
|
1119
1304
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
1120
1305
|
path: path,
|
|
1121
1306
|
method: method
|
|
1122
1307
|
});
|
|
1123
1308
|
if (device) _tags.device = device;
|
|
1124
|
-
|
|
1309
|
+
_context33.next = 5;
|
|
1125
1310
|
return this._request(_tags);
|
|
1126
1311
|
case 5:
|
|
1127
|
-
return
|
|
1312
|
+
return _context33.abrupt("return", _context33.sent);
|
|
1128
1313
|
case 6:
|
|
1129
1314
|
case "end":
|
|
1130
|
-
return
|
|
1315
|
+
return _context33.stop();
|
|
1131
1316
|
}
|
|
1132
|
-
},
|
|
1317
|
+
}, _callee33, this);
|
|
1133
1318
|
}));
|
|
1134
|
-
function request(
|
|
1319
|
+
function request(_x22) {
|
|
1135
1320
|
return _request.apply(this, arguments);
|
|
1136
1321
|
}
|
|
1137
1322
|
return request;
|