wao 0.29.2 → 0.30.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/ao.js +33 -10
- package/cjs/devs.js +122 -110
- package/cjs/hb.js +500 -367
- package/cjs/hyperbeam.js +15 -8
- package/cjs/id.js +212 -18
- package/cjs/signer.js +14 -5
- package/cjs/utils.js +6 -0
- package/cjs/workspace/package.json +1 -1
- package/cjs/workspace/test/hyperbeam.js +8 -5
- package/esm/ao.js +1 -1
- package/esm/devs.js +56 -33
- package/esm/hb.js +51 -10
- package/esm/hyperbeam.js +23 -12
- package/esm/id.js +172 -15
- package/esm/signer.js +5 -4
- package/esm/utils.js +2 -0
- package/esm/workspace/package.json +1 -1
- package/esm/workspace/test/hyperbeam.js +8 -5
- package/package.json +5 -1
package/cjs/hb.js
CHANGED
|
@@ -12,11 +12,10 @@ var _send3 = require("./send.js");
|
|
|
12
12
|
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
|
-
var _excluded = ["path"]
|
|
15
|
+
var _excluded = ["path"],
|
|
16
|
+
_excluded2 = ["path"];
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
18
|
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); }
|
|
18
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
19
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
20
19
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
20
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
21
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
@@ -26,6 +25,8 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
26
25
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
27
26
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
28
27
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
28
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
29
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
29
30
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
31
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
32
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -38,8 +39,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
38
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
39
40
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
40
41
|
var seed = function seed(num) {
|
|
41
|
-
var array = new
|
|
42
|
-
|
|
42
|
+
var array = new Array(num);
|
|
43
|
+
for (var i = 0; i < num; i++) array[i] = Math.floor(Math.random() * 256);
|
|
44
|
+
return Buffer.from(array).toString("base64");
|
|
43
45
|
};
|
|
44
46
|
var HB = /*#__PURE__*/function () {
|
|
45
47
|
function HB() {
|
|
@@ -266,8 +268,38 @@ var HB = /*#__PURE__*/function () {
|
|
|
266
268
|
if (jwk) this._init(jwk);
|
|
267
269
|
}
|
|
268
270
|
return _createClass(HB, [{
|
|
271
|
+
key: "signEncoded",
|
|
272
|
+
value: function () {
|
|
273
|
+
var _signEncoded = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(encoded) {
|
|
274
|
+
var path, msg;
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
276
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
path = encoded.path, msg = _objectWithoutProperties(encoded, _excluded);
|
|
279
|
+
_context8.next = 3;
|
|
280
|
+
return (0, _signer.sign)({
|
|
281
|
+
jwk: this.jwk,
|
|
282
|
+
msg: msg,
|
|
283
|
+
path: path,
|
|
284
|
+
url: this.url
|
|
285
|
+
});
|
|
286
|
+
case 3:
|
|
287
|
+
return _context8.abrupt("return", _context8.sent);
|
|
288
|
+
case 4:
|
|
289
|
+
case "end":
|
|
290
|
+
return _context8.stop();
|
|
291
|
+
}
|
|
292
|
+
}, _callee8, this);
|
|
293
|
+
}));
|
|
294
|
+
function signEncoded(_x6) {
|
|
295
|
+
return _signEncoded.apply(this, arguments);
|
|
296
|
+
}
|
|
297
|
+
return signEncoded;
|
|
298
|
+
}()
|
|
299
|
+
}, {
|
|
269
300
|
key: "_init",
|
|
270
301
|
value: function _init(jwk) {
|
|
302
|
+
this.jwk = jwk;
|
|
271
303
|
this.signer = (0, _aoconnect.createSigner)(jwk, this.url);
|
|
272
304
|
this.addr = (0, _utils.toAddr)(jwk.n);
|
|
273
305
|
this.sign = (0, _signer.signer)({
|
|
@@ -286,30 +318,30 @@ var HB = /*#__PURE__*/function () {
|
|
|
286
318
|
}, {
|
|
287
319
|
key: "init",
|
|
288
320
|
value: function () {
|
|
289
|
-
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
290
|
-
return _regeneratorRuntime().wrap(function
|
|
291
|
-
while (1) switch (
|
|
321
|
+
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(jwk) {
|
|
322
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
323
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
292
324
|
case 0:
|
|
293
325
|
this._init(jwk);
|
|
294
|
-
|
|
295
|
-
|
|
326
|
+
_context9.prev = 1;
|
|
327
|
+
_context9.next = 4;
|
|
296
328
|
return this.dev.meta.info({});
|
|
297
329
|
case 4:
|
|
298
|
-
this._info =
|
|
299
|
-
|
|
330
|
+
this._info = _context9.sent;
|
|
331
|
+
_context9.next = 9;
|
|
300
332
|
break;
|
|
301
333
|
case 7:
|
|
302
|
-
|
|
303
|
-
|
|
334
|
+
_context9.prev = 7;
|
|
335
|
+
_context9.t0 = _context9["catch"](1);
|
|
304
336
|
case 9:
|
|
305
|
-
return
|
|
337
|
+
return _context9.abrupt("return", this);
|
|
306
338
|
case 10:
|
|
307
339
|
case "end":
|
|
308
|
-
return
|
|
340
|
+
return _context9.stop();
|
|
309
341
|
}
|
|
310
|
-
},
|
|
342
|
+
}, _callee9, this, [[1, 7]]);
|
|
311
343
|
}));
|
|
312
|
-
function init(
|
|
344
|
+
function init(_x7) {
|
|
313
345
|
return _init2.apply(this, arguments);
|
|
314
346
|
}
|
|
315
347
|
return init;
|
|
@@ -317,21 +349,21 @@ var HB = /*#__PURE__*/function () {
|
|
|
317
349
|
}, {
|
|
318
350
|
key: "send",
|
|
319
351
|
value: function () {
|
|
320
|
-
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
321
|
-
return _regeneratorRuntime().wrap(function
|
|
322
|
-
while (1) switch (
|
|
352
|
+
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(msg) {
|
|
353
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
354
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
323
355
|
case 0:
|
|
324
|
-
|
|
356
|
+
_context10.next = 2;
|
|
325
357
|
return (0, _send3.send)(msg);
|
|
326
358
|
case 2:
|
|
327
|
-
return
|
|
359
|
+
return _context10.abrupt("return", _context10.sent);
|
|
328
360
|
case 3:
|
|
329
361
|
case "end":
|
|
330
|
-
return
|
|
362
|
+
return _context10.stop();
|
|
331
363
|
}
|
|
332
|
-
},
|
|
364
|
+
}, _callee10);
|
|
333
365
|
}));
|
|
334
|
-
function send(
|
|
366
|
+
function send(_x8) {
|
|
335
367
|
return _send2.apply(this, arguments);
|
|
336
368
|
}
|
|
337
369
|
return send;
|
|
@@ -339,24 +371,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
339
371
|
}, {
|
|
340
372
|
key: "getImage",
|
|
341
373
|
value: function () {
|
|
342
|
-
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
374
|
+
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
343
375
|
var _this$image;
|
|
344
376
|
var wasm, id;
|
|
345
|
-
return _regeneratorRuntime().wrap(function
|
|
346
|
-
while (1) switch (
|
|
377
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
378
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
347
379
|
case 0:
|
|
348
380
|
wasm = Buffer.from(_aos_wamr["default"], "base64");
|
|
349
|
-
|
|
381
|
+
_context11.next = 3;
|
|
350
382
|
return this.cacheBinary(wasm, "application/wasm");
|
|
351
383
|
case 3:
|
|
352
|
-
id =
|
|
384
|
+
id = _context11.sent;
|
|
353
385
|
(_this$image = this.image) !== null && _this$image !== void 0 ? _this$image : this.image = id;
|
|
354
|
-
return
|
|
386
|
+
return _context11.abrupt("return", id);
|
|
355
387
|
case 6:
|
|
356
388
|
case "end":
|
|
357
|
-
return
|
|
389
|
+
return _context11.stop();
|
|
358
390
|
}
|
|
359
|
-
},
|
|
391
|
+
}, _callee11, this);
|
|
360
392
|
}));
|
|
361
393
|
function getImage() {
|
|
362
394
|
return _getImage.apply(this, arguments);
|
|
@@ -366,24 +398,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
366
398
|
}, {
|
|
367
399
|
key: "getLua",
|
|
368
400
|
value: function () {
|
|
369
|
-
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
401
|
+
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
370
402
|
var _this$lua;
|
|
371
403
|
var lua, id;
|
|
372
|
-
return _regeneratorRuntime().wrap(function
|
|
373
|
-
while (1) switch (
|
|
404
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
405
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
374
406
|
case 0:
|
|
375
407
|
lua = Buffer.from(_hyperAos["default"], "base64");
|
|
376
|
-
|
|
377
|
-
return this.
|
|
408
|
+
_context12.next = 3;
|
|
409
|
+
return this.cacheScript(lua, "application/lua");
|
|
378
410
|
case 3:
|
|
379
|
-
id =
|
|
411
|
+
id = _context12.sent;
|
|
380
412
|
(_this$lua = this.lua) !== null && _this$lua !== void 0 ? _this$lua : this.lua = id;
|
|
381
|
-
return
|
|
413
|
+
return _context12.abrupt("return", id);
|
|
382
414
|
case 6:
|
|
383
415
|
case "end":
|
|
384
|
-
return
|
|
416
|
+
return _context12.stop();
|
|
385
417
|
}
|
|
386
|
-
},
|
|
418
|
+
}, _callee12, this);
|
|
387
419
|
}));
|
|
388
420
|
function getLua() {
|
|
389
421
|
return _getLua.apply(this, arguments);
|
|
@@ -393,11 +425,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
393
425
|
}, {
|
|
394
426
|
key: "scheduleAOS",
|
|
395
427
|
value: function () {
|
|
396
|
-
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
428
|
+
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref2) {
|
|
397
429
|
var _pid;
|
|
398
430
|
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
399
|
-
return _regeneratorRuntime().wrap(function
|
|
400
|
-
while (1) switch (
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
432
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
401
433
|
case 0:
|
|
402
434
|
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;
|
|
403
435
|
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
@@ -411,23 +443,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
411
443
|
Target: pid
|
|
412
444
|
});
|
|
413
445
|
if (data) _tags.data = data;
|
|
414
|
-
|
|
446
|
+
_context13.next = 6;
|
|
415
447
|
return this.post(_tags);
|
|
416
448
|
case 6:
|
|
417
|
-
res =
|
|
449
|
+
res = _context13.sent;
|
|
418
450
|
slot = res.headers.slot;
|
|
419
|
-
return
|
|
451
|
+
return _context13.abrupt("return", {
|
|
420
452
|
slot: slot,
|
|
421
453
|
res: res,
|
|
422
454
|
pid: pid
|
|
423
455
|
});
|
|
424
456
|
case 9:
|
|
425
457
|
case "end":
|
|
426
|
-
return
|
|
458
|
+
return _context13.stop();
|
|
427
459
|
}
|
|
428
|
-
},
|
|
460
|
+
}, _callee13, this);
|
|
429
461
|
}));
|
|
430
|
-
function scheduleAOS(
|
|
462
|
+
function scheduleAOS(_x9) {
|
|
431
463
|
return _scheduleAOS.apply(this, arguments);
|
|
432
464
|
}
|
|
433
465
|
return scheduleAOS;
|
|
@@ -435,40 +467,78 @@ var HB = /*#__PURE__*/function () {
|
|
|
435
467
|
}, {
|
|
436
468
|
key: "messageAOS",
|
|
437
469
|
value: function () {
|
|
438
|
-
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
470
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(args) {
|
|
439
471
|
var _yield$this$scheduleA, slot, pid;
|
|
440
|
-
return _regeneratorRuntime().wrap(function
|
|
441
|
-
while (1) switch (
|
|
472
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
473
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
442
474
|
case 0:
|
|
443
|
-
|
|
475
|
+
_context14.next = 2;
|
|
444
476
|
return this.scheduleAOS(args);
|
|
445
477
|
case 2:
|
|
446
|
-
_yield$this$scheduleA =
|
|
478
|
+
_yield$this$scheduleA = _context14.sent;
|
|
447
479
|
slot = _yield$this$scheduleA.slot;
|
|
448
480
|
pid = _yield$this$scheduleA.pid;
|
|
449
|
-
|
|
450
|
-
|
|
481
|
+
_context14.t0 = slot;
|
|
482
|
+
_context14.next = 8;
|
|
451
483
|
return this.computeAOS({
|
|
452
484
|
pid: pid,
|
|
453
485
|
slot: slot
|
|
454
486
|
});
|
|
455
487
|
case 8:
|
|
456
|
-
|
|
457
|
-
return
|
|
458
|
-
slot:
|
|
459
|
-
outbox:
|
|
488
|
+
_context14.t1 = _context14.sent;
|
|
489
|
+
return _context14.abrupt("return", {
|
|
490
|
+
slot: _context14.t0,
|
|
491
|
+
outbox: _context14.t1
|
|
460
492
|
});
|
|
461
493
|
case 10:
|
|
462
494
|
case "end":
|
|
463
|
-
return
|
|
495
|
+
return _context14.stop();
|
|
464
496
|
}
|
|
465
|
-
},
|
|
497
|
+
}, _callee14, this);
|
|
466
498
|
}));
|
|
467
|
-
function messageAOS(
|
|
499
|
+
function messageAOS(_x10) {
|
|
468
500
|
return _messageAOS.apply(this, arguments);
|
|
469
501
|
}
|
|
470
502
|
return messageAOS;
|
|
471
503
|
}()
|
|
504
|
+
}, {
|
|
505
|
+
key: "messageLegacy",
|
|
506
|
+
value: function () {
|
|
507
|
+
var _messageLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(args) {
|
|
508
|
+
var _yield$this$scheduleL, slot, pid;
|
|
509
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
510
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
511
|
+
case 0:
|
|
512
|
+
_context15.next = 2;
|
|
513
|
+
return this.scheduleLegacy(args);
|
|
514
|
+
case 2:
|
|
515
|
+
_yield$this$scheduleL = _context15.sent;
|
|
516
|
+
slot = _yield$this$scheduleL.slot;
|
|
517
|
+
pid = _yield$this$scheduleL.pid;
|
|
518
|
+
console.log(slot, pid, args);
|
|
519
|
+
_context15.t0 = slot;
|
|
520
|
+
_context15.next = 9;
|
|
521
|
+
return this.computeLegacy({
|
|
522
|
+
pid: pid,
|
|
523
|
+
slot: slot
|
|
524
|
+
});
|
|
525
|
+
case 9:
|
|
526
|
+
_context15.t1 = _context15.sent;
|
|
527
|
+
return _context15.abrupt("return", {
|
|
528
|
+
slot: _context15.t0,
|
|
529
|
+
res: _context15.t1
|
|
530
|
+
});
|
|
531
|
+
case 11:
|
|
532
|
+
case "end":
|
|
533
|
+
return _context15.stop();
|
|
534
|
+
}
|
|
535
|
+
}, _callee15, this);
|
|
536
|
+
}));
|
|
537
|
+
function messageLegacy(_x11) {
|
|
538
|
+
return _messageLegacy.apply(this, arguments);
|
|
539
|
+
}
|
|
540
|
+
return messageLegacy;
|
|
541
|
+
}()
|
|
472
542
|
}, {
|
|
473
543
|
key: "path",
|
|
474
544
|
value: function path(_ref3) {
|
|
@@ -499,22 +569,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
499
569
|
}, {
|
|
500
570
|
key: "text",
|
|
501
571
|
value: function () {
|
|
502
|
-
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
572
|
+
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(dev, path) {
|
|
503
573
|
var params,
|
|
504
574
|
tail,
|
|
505
575
|
pid,
|
|
506
|
-
|
|
507
|
-
return _regeneratorRuntime().wrap(function
|
|
508
|
-
while (1) switch (
|
|
576
|
+
_args16 = arguments;
|
|
577
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
578
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
509
579
|
case 0:
|
|
510
|
-
params =
|
|
511
|
-
tail =
|
|
580
|
+
params = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
581
|
+
tail = _args16.length > 3 ? _args16[3] : undefined;
|
|
512
582
|
pid = "";
|
|
513
583
|
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
514
584
|
pid = dev;
|
|
515
585
|
dev = "process";
|
|
516
586
|
}
|
|
517
|
-
|
|
587
|
+
_context16.next = 6;
|
|
518
588
|
return this.fetch(this.path({
|
|
519
589
|
dev: dev,
|
|
520
590
|
path: path,
|
|
@@ -524,14 +594,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
524
594
|
tail: tail
|
|
525
595
|
}), false);
|
|
526
596
|
case 6:
|
|
527
|
-
return
|
|
597
|
+
return _context16.abrupt("return", _context16.sent);
|
|
528
598
|
case 7:
|
|
529
599
|
case "end":
|
|
530
|
-
return
|
|
600
|
+
return _context16.stop();
|
|
531
601
|
}
|
|
532
|
-
},
|
|
602
|
+
}, _callee16, this);
|
|
533
603
|
}));
|
|
534
|
-
function text(
|
|
604
|
+
function text(_x12, _x13) {
|
|
535
605
|
return _text.apply(this, arguments);
|
|
536
606
|
}
|
|
537
607
|
return text;
|
|
@@ -539,22 +609,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
539
609
|
}, {
|
|
540
610
|
key: "json",
|
|
541
611
|
value: function () {
|
|
542
|
-
var _json2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
612
|
+
var _json2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(dev, path) {
|
|
543
613
|
var params,
|
|
544
614
|
tail,
|
|
545
615
|
pid,
|
|
546
|
-
|
|
547
|
-
return _regeneratorRuntime().wrap(function
|
|
548
|
-
while (1) switch (
|
|
616
|
+
_args17 = arguments;
|
|
617
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
618
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
549
619
|
case 0:
|
|
550
|
-
params =
|
|
551
|
-
tail =
|
|
620
|
+
params = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
621
|
+
tail = _args17.length > 3 ? _args17[3] : undefined;
|
|
552
622
|
pid = "";
|
|
553
623
|
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
554
624
|
pid = dev;
|
|
555
625
|
dev = "process";
|
|
556
626
|
}
|
|
557
|
-
|
|
627
|
+
_context17.next = 6;
|
|
558
628
|
return this.fetch(this.path({
|
|
559
629
|
dev: dev,
|
|
560
630
|
path: path,
|
|
@@ -564,14 +634,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
564
634
|
tail: tail
|
|
565
635
|
}));
|
|
566
636
|
case 6:
|
|
567
|
-
return
|
|
637
|
+
return _context17.abrupt("return", _context17.sent);
|
|
568
638
|
case 7:
|
|
569
639
|
case "end":
|
|
570
|
-
return
|
|
640
|
+
return _context17.stop();
|
|
571
641
|
}
|
|
572
|
-
},
|
|
642
|
+
}, _callee17, this);
|
|
573
643
|
}));
|
|
574
|
-
function json(
|
|
644
|
+
function json(_x14, _x15) {
|
|
575
645
|
return _json2.apply(this, arguments);
|
|
576
646
|
}
|
|
577
647
|
return json;
|
|
@@ -587,52 +657,52 @@ var HB = /*#__PURE__*/function () {
|
|
|
587
657
|
};
|
|
588
658
|
return fetch;
|
|
589
659
|
}(/*#__PURE__*/function () {
|
|
590
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(path) {
|
|
591
661
|
var json,
|
|
592
|
-
|
|
593
|
-
return _regeneratorRuntime().wrap(function
|
|
594
|
-
while (1) switch (
|
|
662
|
+
_args18 = arguments;
|
|
663
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
664
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
595
665
|
case 0:
|
|
596
|
-
json =
|
|
597
|
-
|
|
666
|
+
json = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : true;
|
|
667
|
+
_context18.next = 3;
|
|
598
668
|
return fetch(this.url + path).then(function (r) {
|
|
599
669
|
return json ? r.json() : r.text();
|
|
600
670
|
});
|
|
601
671
|
case 3:
|
|
602
|
-
return
|
|
672
|
+
return _context18.abrupt("return", _context18.sent);
|
|
603
673
|
case 4:
|
|
604
674
|
case "end":
|
|
605
|
-
return
|
|
675
|
+
return _context18.stop();
|
|
606
676
|
}
|
|
607
|
-
},
|
|
677
|
+
}, _callee18, this);
|
|
608
678
|
}));
|
|
609
|
-
return function (
|
|
679
|
+
return function (_x16) {
|
|
610
680
|
return _ref4.apply(this, arguments);
|
|
611
681
|
};
|
|
612
682
|
}())
|
|
613
683
|
}, {
|
|
614
684
|
key: "computeAOS",
|
|
615
685
|
value: function () {
|
|
616
|
-
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
686
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref5) {
|
|
617
687
|
var pid, slot;
|
|
618
|
-
return _regeneratorRuntime().wrap(function
|
|
619
|
-
while (1) switch (
|
|
688
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
689
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
620
690
|
case 0:
|
|
621
691
|
pid = _ref5.pid, slot = _ref5.slot;
|
|
622
|
-
|
|
692
|
+
_context19.next = 3;
|
|
623
693
|
return this.getJSON({
|
|
624
694
|
path: "/".concat(pid, "/compute/results/outbox"),
|
|
625
695
|
slot: slot
|
|
626
696
|
});
|
|
627
697
|
case 3:
|
|
628
|
-
return
|
|
698
|
+
return _context19.abrupt("return", _context19.sent);
|
|
629
699
|
case 4:
|
|
630
700
|
case "end":
|
|
631
|
-
return
|
|
701
|
+
return _context19.stop();
|
|
632
702
|
}
|
|
633
|
-
},
|
|
703
|
+
}, _callee19, this);
|
|
634
704
|
}));
|
|
635
|
-
function computeAOS(
|
|
705
|
+
function computeAOS(_x17) {
|
|
636
706
|
return _computeAOS.apply(this, arguments);
|
|
637
707
|
}
|
|
638
708
|
return computeAOS;
|
|
@@ -640,26 +710,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
640
710
|
}, {
|
|
641
711
|
key: "computeLua",
|
|
642
712
|
value: function () {
|
|
643
|
-
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
713
|
+
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref6) {
|
|
644
714
|
var pid, slot;
|
|
645
|
-
return _regeneratorRuntime().wrap(function
|
|
646
|
-
while (1) switch (
|
|
715
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
716
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
647
717
|
case 0:
|
|
648
718
|
pid = _ref6.pid, slot = _ref6.slot;
|
|
649
|
-
|
|
719
|
+
_context20.next = 3;
|
|
650
720
|
return this.getJSON({
|
|
651
721
|
path: "/".concat(pid, "/compute/results"),
|
|
652
722
|
slot: slot
|
|
653
723
|
});
|
|
654
724
|
case 3:
|
|
655
|
-
return
|
|
725
|
+
return _context20.abrupt("return", _context20.sent);
|
|
656
726
|
case 4:
|
|
657
727
|
case "end":
|
|
658
|
-
return
|
|
728
|
+
return _context20.stop();
|
|
659
729
|
}
|
|
660
|
-
},
|
|
730
|
+
}, _callee20, this);
|
|
661
731
|
}));
|
|
662
|
-
function computeLua(
|
|
732
|
+
function computeLua(_x18) {
|
|
663
733
|
return _computeLua.apply(this, arguments);
|
|
664
734
|
}
|
|
665
735
|
return computeLua;
|
|
@@ -667,27 +737,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
667
737
|
}, {
|
|
668
738
|
key: "compute",
|
|
669
739
|
value: function () {
|
|
670
|
-
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
740
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref7) {
|
|
671
741
|
var pid, slot, _ref7$path, path;
|
|
672
|
-
return _regeneratorRuntime().wrap(function
|
|
673
|
-
while (1) switch (
|
|
742
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
743
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
674
744
|
case 0:
|
|
675
745
|
pid = _ref7.pid, slot = _ref7.slot, _ref7$path = _ref7.path, path = _ref7$path === void 0 ? "" : _ref7$path;
|
|
676
746
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
677
|
-
|
|
747
|
+
_context21.next = 4;
|
|
678
748
|
return this.getJSON({
|
|
679
749
|
path: "/".concat(pid, "/compute").concat(path),
|
|
680
750
|
slot: slot
|
|
681
751
|
});
|
|
682
752
|
case 4:
|
|
683
|
-
return
|
|
753
|
+
return _context21.abrupt("return", _context21.sent);
|
|
684
754
|
case 5:
|
|
685
755
|
case "end":
|
|
686
|
-
return
|
|
756
|
+
return _context21.stop();
|
|
687
757
|
}
|
|
688
|
-
},
|
|
758
|
+
}, _callee21, this);
|
|
689
759
|
}));
|
|
690
|
-
function compute(
|
|
760
|
+
function compute(_x19) {
|
|
691
761
|
return _compute.apply(this, arguments);
|
|
692
762
|
}
|
|
693
763
|
return compute;
|
|
@@ -695,27 +765,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
695
765
|
}, {
|
|
696
766
|
key: "computeLegacy",
|
|
697
767
|
value: function () {
|
|
698
|
-
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
768
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref8) {
|
|
699
769
|
var pid, slot, json;
|
|
700
|
-
return _regeneratorRuntime().wrap(function
|
|
701
|
-
while (1) switch (
|
|
770
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
771
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
702
772
|
case 0:
|
|
703
773
|
pid = _ref8.pid, slot = _ref8.slot;
|
|
704
|
-
|
|
774
|
+
_context22.next = 3;
|
|
705
775
|
return this.compute({
|
|
706
776
|
pid: pid,
|
|
707
777
|
slot: slot
|
|
708
778
|
});
|
|
709
779
|
case 3:
|
|
710
|
-
json =
|
|
711
|
-
return
|
|
780
|
+
json = _context22.sent;
|
|
781
|
+
return _context22.abrupt("return", JSON.parse(json.results.json.body));
|
|
712
782
|
case 5:
|
|
713
783
|
case "end":
|
|
714
|
-
return
|
|
784
|
+
return _context22.stop();
|
|
715
785
|
}
|
|
716
|
-
},
|
|
786
|
+
}, _callee22, this);
|
|
717
787
|
}));
|
|
718
|
-
function computeLegacy(
|
|
788
|
+
function computeLegacy(_x20) {
|
|
719
789
|
return _computeLegacy.apply(this, arguments);
|
|
720
790
|
}
|
|
721
791
|
return computeLegacy;
|
|
@@ -723,23 +793,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
723
793
|
}, {
|
|
724
794
|
key: "spawn",
|
|
725
795
|
value: function () {
|
|
726
|
-
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
796
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
727
797
|
var _this$scheduler;
|
|
728
798
|
var tags,
|
|
729
799
|
addr,
|
|
730
800
|
_tags,
|
|
731
801
|
res,
|
|
732
|
-
|
|
733
|
-
return _regeneratorRuntime().wrap(function
|
|
734
|
-
while (1) switch (
|
|
802
|
+
_args23 = arguments;
|
|
803
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
804
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
735
805
|
case 0:
|
|
736
|
-
tags =
|
|
737
|
-
|
|
806
|
+
tags = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
807
|
+
_context23.next = 3;
|
|
738
808
|
return this.dev.meta.info({
|
|
739
809
|
key: "address"
|
|
740
810
|
});
|
|
741
811
|
case 3:
|
|
742
|
-
addr =
|
|
812
|
+
addr = _context23.sent;
|
|
743
813
|
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
744
814
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
745
815
|
device: "process@1.0",
|
|
@@ -749,19 +819,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
749
819
|
Type: "Process",
|
|
750
820
|
"execution-device": "test-device@1.0"
|
|
751
821
|
});
|
|
752
|
-
|
|
822
|
+
_context23.next = 8;
|
|
753
823
|
return this.post(_tags);
|
|
754
824
|
case 8:
|
|
755
|
-
res =
|
|
756
|
-
return
|
|
825
|
+
res = _context23.sent;
|
|
826
|
+
return _context23.abrupt("return", {
|
|
757
827
|
res: res,
|
|
758
828
|
pid: res.headers.process
|
|
759
829
|
});
|
|
760
830
|
case 10:
|
|
761
831
|
case "end":
|
|
762
|
-
return
|
|
832
|
+
return _context23.stop();
|
|
763
833
|
}
|
|
764
|
-
},
|
|
834
|
+
}, _callee23, this);
|
|
765
835
|
}));
|
|
766
836
|
function spawn() {
|
|
767
837
|
return _spawn.apply(this, arguments);
|
|
@@ -769,77 +839,84 @@ var HB = /*#__PURE__*/function () {
|
|
|
769
839
|
return spawn;
|
|
770
840
|
}()
|
|
771
841
|
}, {
|
|
772
|
-
key: "
|
|
842
|
+
key: "cacheScript",
|
|
773
843
|
value: function () {
|
|
774
|
-
var
|
|
775
|
-
var
|
|
776
|
-
|
|
777
|
-
|
|
844
|
+
var _cacheScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(data) {
|
|
845
|
+
var type,
|
|
846
|
+
_yield$this$spawn,
|
|
847
|
+
pid,
|
|
848
|
+
_yield$this$schedule,
|
|
849
|
+
slot,
|
|
850
|
+
msgs,
|
|
851
|
+
_args24 = arguments;
|
|
852
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
853
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
778
854
|
case 0:
|
|
855
|
+
type = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : "application/lua";
|
|
779
856
|
if (this.cache) {
|
|
780
|
-
|
|
857
|
+
_context24.next = 7;
|
|
781
858
|
break;
|
|
782
859
|
}
|
|
783
|
-
|
|
860
|
+
_context24.next = 4;
|
|
784
861
|
return this.spawn({});
|
|
785
|
-
case
|
|
786
|
-
_yield$this$spawn =
|
|
862
|
+
case 4:
|
|
863
|
+
_yield$this$spawn = _context24.sent;
|
|
787
864
|
pid = _yield$this$spawn.pid;
|
|
788
865
|
this.cache = pid;
|
|
789
|
-
case
|
|
790
|
-
|
|
866
|
+
case 7:
|
|
867
|
+
_context24.next = 9;
|
|
791
868
|
return this.schedule({
|
|
792
869
|
data: data,
|
|
793
870
|
pid: this.cache,
|
|
794
871
|
"content-type": type
|
|
795
872
|
});
|
|
796
|
-
case
|
|
797
|
-
_yield$this$schedule =
|
|
873
|
+
case 9:
|
|
874
|
+
_yield$this$schedule = _context24.sent;
|
|
798
875
|
slot = _yield$this$schedule.slot;
|
|
799
|
-
|
|
876
|
+
_context24.next = 13;
|
|
800
877
|
return this.messages({
|
|
801
878
|
pid: this.cache,
|
|
802
879
|
from: slot,
|
|
803
880
|
limit: 1
|
|
804
881
|
});
|
|
805
|
-
case
|
|
806
|
-
msgs =
|
|
807
|
-
return
|
|
808
|
-
case
|
|
882
|
+
case 13:
|
|
883
|
+
msgs = _context24.sent;
|
|
884
|
+
return _context24.abrupt("return", msgs.edges[0].node.message.Id);
|
|
885
|
+
case 15:
|
|
809
886
|
case "end":
|
|
810
|
-
return
|
|
887
|
+
return _context24.stop();
|
|
811
888
|
}
|
|
812
|
-
},
|
|
889
|
+
}, _callee24, this);
|
|
813
890
|
}));
|
|
814
|
-
function
|
|
815
|
-
return
|
|
891
|
+
function cacheScript(_x21) {
|
|
892
|
+
return _cacheScript.apply(this, arguments);
|
|
816
893
|
}
|
|
817
|
-
return
|
|
894
|
+
return cacheScript;
|
|
818
895
|
}()
|
|
819
896
|
}, {
|
|
820
897
|
key: "cacheBinary",
|
|
821
898
|
value: function () {
|
|
822
|
-
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
899
|
+
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(data, type) {
|
|
823
900
|
var res;
|
|
824
|
-
return _regeneratorRuntime().wrap(function
|
|
825
|
-
while (1) switch (
|
|
901
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
902
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
826
903
|
case 0:
|
|
827
|
-
|
|
904
|
+
_context25.next = 2;
|
|
828
905
|
return this.post({
|
|
829
906
|
path: "/~wao@1.0/cache_module",
|
|
830
907
|
data: data,
|
|
831
908
|
type: type
|
|
832
909
|
});
|
|
833
910
|
case 2:
|
|
834
|
-
res =
|
|
835
|
-
return
|
|
911
|
+
res = _context25.sent;
|
|
912
|
+
return _context25.abrupt("return", res.headers.id);
|
|
836
913
|
case 4:
|
|
837
914
|
case "end":
|
|
838
|
-
return
|
|
915
|
+
return _context25.stop();
|
|
839
916
|
}
|
|
840
|
-
},
|
|
917
|
+
}, _callee25, this);
|
|
841
918
|
}));
|
|
842
|
-
function cacheBinary(
|
|
919
|
+
function cacheBinary(_x22, _x23) {
|
|
843
920
|
return _cacheBinary.apply(this, arguments);
|
|
844
921
|
}
|
|
845
922
|
return cacheBinary;
|
|
@@ -847,36 +924,36 @@ var HB = /*#__PURE__*/function () {
|
|
|
847
924
|
}, {
|
|
848
925
|
key: "message",
|
|
849
926
|
value: function () {
|
|
850
|
-
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
927
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(args) {
|
|
851
928
|
var pid, _yield$this$schedule2, slot, res;
|
|
852
|
-
return _regeneratorRuntime().wrap(function
|
|
853
|
-
while (1) switch (
|
|
929
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
930
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
854
931
|
case 0:
|
|
855
932
|
pid = args.pid;
|
|
856
|
-
|
|
933
|
+
_context26.next = 3;
|
|
857
934
|
return this.schedule(args);
|
|
858
935
|
case 3:
|
|
859
|
-
_yield$this$schedule2 =
|
|
936
|
+
_yield$this$schedule2 = _context26.sent;
|
|
860
937
|
slot = _yield$this$schedule2.slot;
|
|
861
|
-
|
|
938
|
+
_context26.next = 7;
|
|
862
939
|
return this.compute({
|
|
863
940
|
pid: pid,
|
|
864
941
|
slot: slot
|
|
865
942
|
});
|
|
866
943
|
case 7:
|
|
867
|
-
res =
|
|
868
|
-
return
|
|
944
|
+
res = _context26.sent;
|
|
945
|
+
return _context26.abrupt("return", {
|
|
869
946
|
slot: slot,
|
|
870
947
|
pid: pid,
|
|
871
948
|
res: res
|
|
872
949
|
});
|
|
873
950
|
case 9:
|
|
874
951
|
case "end":
|
|
875
|
-
return
|
|
952
|
+
return _context26.stop();
|
|
876
953
|
}
|
|
877
|
-
},
|
|
954
|
+
}, _callee26, this);
|
|
878
955
|
}));
|
|
879
|
-
function message(
|
|
956
|
+
function message(_x24) {
|
|
880
957
|
return _message.apply(this, arguments);
|
|
881
958
|
}
|
|
882
959
|
return message;
|
|
@@ -884,7 +961,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
884
961
|
}, {
|
|
885
962
|
key: "scheduleLegacy",
|
|
886
963
|
value: function () {
|
|
887
|
-
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
964
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
888
965
|
var _ref9,
|
|
889
966
|
pid,
|
|
890
967
|
_ref9$action,
|
|
@@ -893,13 +970,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
893
970
|
tags,
|
|
894
971
|
data,
|
|
895
972
|
scheduler,
|
|
896
|
-
|
|
897
|
-
return _regeneratorRuntime().wrap(function
|
|
898
|
-
while (1) switch (
|
|
973
|
+
_args27 = arguments;
|
|
974
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
975
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
899
976
|
case 0:
|
|
900
|
-
_ref9 =
|
|
977
|
+
_ref9 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, pid = _ref9.pid, _ref9$action = _ref9.action, action = _ref9$action === void 0 ? "Eval" : _ref9$action, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, data = _ref9.data, scheduler = _ref9.scheduler;
|
|
901
978
|
if (action) tags.Action = action;
|
|
902
|
-
|
|
979
|
+
_context27.next = 4;
|
|
903
980
|
return this.schedule({
|
|
904
981
|
pid: pid,
|
|
905
982
|
tags: tags,
|
|
@@ -907,12 +984,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
907
984
|
scheduler: scheduler
|
|
908
985
|
});
|
|
909
986
|
case 4:
|
|
910
|
-
return
|
|
987
|
+
return _context27.abrupt("return", _context27.sent);
|
|
911
988
|
case 5:
|
|
912
989
|
case "end":
|
|
913
|
-
return
|
|
990
|
+
return _context27.stop();
|
|
914
991
|
}
|
|
915
|
-
},
|
|
992
|
+
}, _callee27, this);
|
|
916
993
|
}));
|
|
917
994
|
function scheduleLegacy() {
|
|
918
995
|
return _scheduleLegacy.apply(this, arguments);
|
|
@@ -922,20 +999,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
922
999
|
}, {
|
|
923
1000
|
key: "scheduleLua",
|
|
924
1001
|
value: function () {
|
|
925
|
-
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
926
|
-
var
|
|
927
|
-
return _regeneratorRuntime().wrap(function
|
|
928
|
-
while (1) switch (
|
|
1002
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1003
|
+
var _args28 = arguments;
|
|
1004
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1005
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
929
1006
|
case 0:
|
|
930
|
-
|
|
931
|
-
return this.scheduleLegacy.apply(this,
|
|
1007
|
+
_context28.next = 2;
|
|
1008
|
+
return this.scheduleLegacy.apply(this, _args28);
|
|
932
1009
|
case 2:
|
|
933
|
-
return
|
|
1010
|
+
return _context28.abrupt("return", _context28.sent);
|
|
934
1011
|
case 3:
|
|
935
1012
|
case "end":
|
|
936
|
-
return
|
|
1013
|
+
return _context28.stop();
|
|
937
1014
|
}
|
|
938
|
-
},
|
|
1015
|
+
}, _callee28, this);
|
|
939
1016
|
}));
|
|
940
1017
|
function scheduleLua() {
|
|
941
1018
|
return _scheduleLua.apply(this, arguments);
|
|
@@ -945,7 +1022,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
945
1022
|
}, {
|
|
946
1023
|
key: "schedule",
|
|
947
1024
|
value: function () {
|
|
948
|
-
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1025
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
949
1026
|
var _pid2;
|
|
950
1027
|
var _ref10,
|
|
951
1028
|
pid,
|
|
@@ -954,11 +1031,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
954
1031
|
data,
|
|
955
1032
|
_tags,
|
|
956
1033
|
res,
|
|
957
|
-
|
|
958
|
-
return _regeneratorRuntime().wrap(function
|
|
959
|
-
while (1) switch (
|
|
1034
|
+
_args29 = arguments;
|
|
1035
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1036
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
960
1037
|
case 0:
|
|
961
|
-
_ref10 =
|
|
1038
|
+
_ref10 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, pid = _ref10.pid, _ref10$tags = _ref10.tags, tags = _ref10$tags === void 0 ? {} : _ref10$tags, data = _ref10.data;
|
|
962
1039
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
963
1040
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
964
1041
|
method: "POST",
|
|
@@ -967,19 +1044,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
967
1044
|
Target: pid
|
|
968
1045
|
});
|
|
969
1046
|
if (data) _tags.data = data;
|
|
970
|
-
|
|
1047
|
+
_context29.next = 6;
|
|
971
1048
|
return this.post(_tags);
|
|
972
1049
|
case 6:
|
|
973
|
-
res =
|
|
974
|
-
return
|
|
1050
|
+
res = _context29.sent;
|
|
1051
|
+
return _context29.abrupt("return", {
|
|
975
1052
|
slot: res.headers.slot,
|
|
976
|
-
res: res
|
|
1053
|
+
res: res,
|
|
1054
|
+
pid: pid
|
|
977
1055
|
});
|
|
978
1056
|
case 8:
|
|
979
1057
|
case "end":
|
|
980
|
-
return
|
|
1058
|
+
return _context29.stop();
|
|
981
1059
|
}
|
|
982
|
-
},
|
|
1060
|
+
}, _callee29, this);
|
|
983
1061
|
}));
|
|
984
1062
|
function schedule() {
|
|
985
1063
|
return _schedule.apply(this, arguments);
|
|
@@ -989,43 +1067,43 @@ var HB = /*#__PURE__*/function () {
|
|
|
989
1067
|
}, {
|
|
990
1068
|
key: "spawnAOS",
|
|
991
1069
|
value: function () {
|
|
992
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1070
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(image) {
|
|
993
1071
|
var _this$scheduler2, _image, _this$image2, _this$pid;
|
|
994
1072
|
var addr, res, pid;
|
|
995
|
-
return _regeneratorRuntime().wrap(function
|
|
996
|
-
while (1) switch (
|
|
1073
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1074
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
997
1075
|
case 0:
|
|
998
|
-
|
|
1076
|
+
_context30.next = 2;
|
|
999
1077
|
return this.dev.meta.info({
|
|
1000
1078
|
key: "address"
|
|
1001
1079
|
});
|
|
1002
1080
|
case 2:
|
|
1003
|
-
addr =
|
|
1081
|
+
addr = _context30.sent;
|
|
1004
1082
|
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
1005
1083
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
1006
|
-
|
|
1084
|
+
_context30.next = 8;
|
|
1007
1085
|
break;
|
|
1008
1086
|
}
|
|
1009
1087
|
_image;
|
|
1010
|
-
|
|
1088
|
+
_context30.next = 16;
|
|
1011
1089
|
break;
|
|
1012
1090
|
case 8:
|
|
1013
1091
|
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
1014
|
-
|
|
1092
|
+
_context30.next = 12;
|
|
1015
1093
|
break;
|
|
1016
1094
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1095
|
+
_context30.t0 = _this$image2;
|
|
1096
|
+
_context30.next = 15;
|
|
1019
1097
|
break;
|
|
1020
1098
|
case 12:
|
|
1021
|
-
|
|
1099
|
+
_context30.next = 14;
|
|
1022
1100
|
return this.getImage();
|
|
1023
1101
|
case 14:
|
|
1024
|
-
|
|
1102
|
+
_context30.t0 = _context30.sent;
|
|
1025
1103
|
case 15:
|
|
1026
|
-
image =
|
|
1104
|
+
image = _context30.t0;
|
|
1027
1105
|
case 16:
|
|
1028
|
-
|
|
1106
|
+
_context30.next = 18;
|
|
1029
1107
|
return this.post({
|
|
1030
1108
|
device: "process@1.0",
|
|
1031
1109
|
path: "/schedule",
|
|
@@ -1047,20 +1125,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1047
1125
|
passes: 2
|
|
1048
1126
|
});
|
|
1049
1127
|
case 18:
|
|
1050
|
-
res =
|
|
1128
|
+
res = _context30.sent;
|
|
1051
1129
|
pid = res.headers.process;
|
|
1052
1130
|
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
1053
|
-
return
|
|
1131
|
+
return _context30.abrupt("return", {
|
|
1054
1132
|
pid: pid,
|
|
1055
1133
|
res: res
|
|
1056
1134
|
});
|
|
1057
1135
|
case 22:
|
|
1058
1136
|
case "end":
|
|
1059
|
-
return
|
|
1137
|
+
return _context30.stop();
|
|
1060
1138
|
}
|
|
1061
|
-
},
|
|
1139
|
+
}, _callee30, this);
|
|
1062
1140
|
}));
|
|
1063
|
-
function spawnAOS(
|
|
1141
|
+
function spawnAOS(_x25) {
|
|
1064
1142
|
return _spawnAOS.apply(this, arguments);
|
|
1065
1143
|
}
|
|
1066
1144
|
return spawnAOS;
|
|
@@ -1068,43 +1146,43 @@ var HB = /*#__PURE__*/function () {
|
|
|
1068
1146
|
}, {
|
|
1069
1147
|
key: "spawnLua",
|
|
1070
1148
|
value: function () {
|
|
1071
|
-
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1149
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lua) {
|
|
1072
1150
|
var _this$scheduler3, _lua, _this$lua2, _this$pid2;
|
|
1073
1151
|
var addr, res, pid;
|
|
1074
|
-
return _regeneratorRuntime().wrap(function
|
|
1075
|
-
while (1) switch (
|
|
1152
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1153
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1076
1154
|
case 0:
|
|
1077
|
-
|
|
1155
|
+
_context31.next = 2;
|
|
1078
1156
|
return this.dev.meta.info({
|
|
1079
1157
|
key: "address"
|
|
1080
1158
|
});
|
|
1081
1159
|
case 2:
|
|
1082
|
-
addr =
|
|
1160
|
+
addr = _context31.sent;
|
|
1083
1161
|
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
1084
1162
|
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
1085
|
-
|
|
1163
|
+
_context31.next = 8;
|
|
1086
1164
|
break;
|
|
1087
1165
|
}
|
|
1088
1166
|
_lua;
|
|
1089
|
-
|
|
1167
|
+
_context31.next = 16;
|
|
1090
1168
|
break;
|
|
1091
1169
|
case 8:
|
|
1092
1170
|
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
1093
|
-
|
|
1171
|
+
_context31.next = 12;
|
|
1094
1172
|
break;
|
|
1095
1173
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1174
|
+
_context31.t0 = _this$lua2;
|
|
1175
|
+
_context31.next = 15;
|
|
1098
1176
|
break;
|
|
1099
1177
|
case 12:
|
|
1100
|
-
|
|
1178
|
+
_context31.next = 14;
|
|
1101
1179
|
return this.getLua();
|
|
1102
1180
|
case 14:
|
|
1103
|
-
|
|
1181
|
+
_context31.t0 = _context31.sent;
|
|
1104
1182
|
case 15:
|
|
1105
|
-
lua =
|
|
1183
|
+
lua = _context31.t0;
|
|
1106
1184
|
case 16:
|
|
1107
|
-
|
|
1185
|
+
_context31.next = 18;
|
|
1108
1186
|
return this.post({
|
|
1109
1187
|
device: "process@1.0",
|
|
1110
1188
|
path: "/schedule",
|
|
@@ -1121,20 +1199,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1121
1199
|
"patch-from": "/results/outbox"
|
|
1122
1200
|
});
|
|
1123
1201
|
case 18:
|
|
1124
|
-
res =
|
|
1202
|
+
res = _context31.sent;
|
|
1125
1203
|
pid = res.headers.process;
|
|
1126
1204
|
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
1127
|
-
return
|
|
1205
|
+
return _context31.abrupt("return", {
|
|
1128
1206
|
pid: pid,
|
|
1129
1207
|
res: res
|
|
1130
1208
|
});
|
|
1131
1209
|
case 22:
|
|
1132
1210
|
case "end":
|
|
1133
|
-
return
|
|
1211
|
+
return _context31.stop();
|
|
1134
1212
|
}
|
|
1135
|
-
},
|
|
1213
|
+
}, _callee31, this);
|
|
1136
1214
|
}));
|
|
1137
|
-
function spawnLua(
|
|
1215
|
+
function spawnLua(_x26) {
|
|
1138
1216
|
return _spawnLua.apply(this, arguments);
|
|
1139
1217
|
}
|
|
1140
1218
|
return spawnLua;
|
|
@@ -1224,26 +1302,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1224
1302
|
}, {
|
|
1225
1303
|
key: "now",
|
|
1226
1304
|
value: function () {
|
|
1227
|
-
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1305
|
+
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(_ref11) {
|
|
1228
1306
|
var pid, _ref11$path, path;
|
|
1229
|
-
return _regeneratorRuntime().wrap(function
|
|
1230
|
-
while (1) switch (
|
|
1307
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1308
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1231
1309
|
case 0:
|
|
1232
1310
|
pid = _ref11.pid, _ref11$path = _ref11.path, path = _ref11$path === void 0 ? "" : _ref11$path;
|
|
1233
1311
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1234
|
-
|
|
1312
|
+
_context32.next = 4;
|
|
1235
1313
|
return this.getJSON({
|
|
1236
1314
|
path: "/".concat(pid, "/now").concat(path)
|
|
1237
1315
|
});
|
|
1238
1316
|
case 4:
|
|
1239
|
-
return
|
|
1317
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1240
1318
|
case 5:
|
|
1241
1319
|
case "end":
|
|
1242
|
-
return
|
|
1320
|
+
return _context32.stop();
|
|
1243
1321
|
}
|
|
1244
|
-
},
|
|
1322
|
+
}, _callee32, this);
|
|
1245
1323
|
}));
|
|
1246
|
-
function now(
|
|
1324
|
+
function now(_x27) {
|
|
1247
1325
|
return _now.apply(this, arguments);
|
|
1248
1326
|
}
|
|
1249
1327
|
return now;
|
|
@@ -1251,26 +1329,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1251
1329
|
}, {
|
|
1252
1330
|
key: "slot",
|
|
1253
1331
|
value: function () {
|
|
1254
|
-
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1332
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(_ref12) {
|
|
1255
1333
|
var pid, _ref12$path, path;
|
|
1256
|
-
return _regeneratorRuntime().wrap(function
|
|
1257
|
-
while (1) switch (
|
|
1334
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1335
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1258
1336
|
case 0:
|
|
1259
1337
|
pid = _ref12.pid, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "" : _ref12$path;
|
|
1260
1338
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1261
|
-
|
|
1339
|
+
_context33.next = 4;
|
|
1262
1340
|
return this.getJSON({
|
|
1263
1341
|
path: "/".concat(pid, "/slot").concat(path)
|
|
1264
1342
|
});
|
|
1265
1343
|
case 4:
|
|
1266
|
-
return
|
|
1344
|
+
return _context33.abrupt("return", _context33.sent);
|
|
1267
1345
|
case 5:
|
|
1268
1346
|
case "end":
|
|
1269
|
-
return
|
|
1347
|
+
return _context33.stop();
|
|
1270
1348
|
}
|
|
1271
|
-
},
|
|
1349
|
+
}, _callee33, this);
|
|
1272
1350
|
}));
|
|
1273
|
-
function slot(
|
|
1351
|
+
function slot(_x28) {
|
|
1274
1352
|
return _slot.apply(this, arguments);
|
|
1275
1353
|
}
|
|
1276
1354
|
return slot;
|
|
@@ -1278,7 +1356,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1278
1356
|
}, {
|
|
1279
1357
|
key: "messages",
|
|
1280
1358
|
value: function () {
|
|
1281
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1359
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1282
1360
|
var _this2 = this;
|
|
1283
1361
|
var _ref13,
|
|
1284
1362
|
pid,
|
|
@@ -1286,51 +1364,63 @@ var HB = /*#__PURE__*/function () {
|
|
|
1286
1364
|
to,
|
|
1287
1365
|
limit,
|
|
1288
1366
|
params,
|
|
1367
|
+
_yield$this$get,
|
|
1368
|
+
body,
|
|
1289
1369
|
res,
|
|
1290
|
-
|
|
1291
|
-
return _regeneratorRuntime().wrap(function
|
|
1292
|
-
while (1) switch (
|
|
1370
|
+
_args35 = arguments;
|
|
1371
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1372
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1293
1373
|
case 0:
|
|
1294
|
-
_ref13 =
|
|
1374
|
+
_ref13 = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {}, pid = _ref13.pid, from = _ref13.from, to = _ref13.to, limit = _ref13.limit;
|
|
1295
1375
|
params = "target=".concat(pid);
|
|
1296
1376
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1297
1377
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1298
1378
|
params += "&accept=application/aos-2";
|
|
1299
|
-
|
|
1379
|
+
_context35.next = 7;
|
|
1380
|
+
return this.get({
|
|
1381
|
+
path: "/~scheduler@1.0/schedule",
|
|
1382
|
+
target: pid,
|
|
1383
|
+
from: from,
|
|
1384
|
+
accept: "application/aos-2"
|
|
1385
|
+
});
|
|
1386
|
+
case 7:
|
|
1387
|
+
_yield$this$get = _context35.sent;
|
|
1388
|
+
body = _yield$this$get.out.body;
|
|
1389
|
+
_context35.next = 11;
|
|
1300
1390
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1301
1391
|
return r.json();
|
|
1302
1392
|
});
|
|
1303
|
-
case
|
|
1304
|
-
res =
|
|
1393
|
+
case 11:
|
|
1394
|
+
res = _context35.sent;
|
|
1305
1395
|
if (res.page_info.has_next_page) {
|
|
1306
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1396
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1307
1397
|
var from2;
|
|
1308
|
-
return _regeneratorRuntime().wrap(function
|
|
1309
|
-
while (1) switch (
|
|
1398
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1399
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1310
1400
|
case 0:
|
|
1311
1401
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1312
|
-
|
|
1313
|
-
return _this2.
|
|
1402
|
+
_context34.next = 3;
|
|
1403
|
+
return _this2.messages({
|
|
1314
1404
|
pid: pid,
|
|
1315
1405
|
from: from2,
|
|
1316
1406
|
to: to,
|
|
1317
1407
|
limit: limit
|
|
1318
1408
|
});
|
|
1319
1409
|
case 3:
|
|
1320
|
-
return
|
|
1410
|
+
return _context34.abrupt("return", _context34.sent);
|
|
1321
1411
|
case 4:
|
|
1322
1412
|
case "end":
|
|
1323
|
-
return
|
|
1413
|
+
return _context34.stop();
|
|
1324
1414
|
}
|
|
1325
|
-
},
|
|
1415
|
+
}, _callee34);
|
|
1326
1416
|
}));
|
|
1327
1417
|
}
|
|
1328
|
-
return
|
|
1329
|
-
case
|
|
1418
|
+
return _context35.abrupt("return", res);
|
|
1419
|
+
case 14:
|
|
1330
1420
|
case "end":
|
|
1331
|
-
return
|
|
1421
|
+
return _context35.stop();
|
|
1332
1422
|
}
|
|
1333
|
-
},
|
|
1423
|
+
}, _callee35, this);
|
|
1334
1424
|
}));
|
|
1335
1425
|
function messages() {
|
|
1336
1426
|
return _messages.apply(this, arguments);
|
|
@@ -1340,18 +1430,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
1340
1430
|
}, {
|
|
1341
1431
|
key: "spawnLegacy",
|
|
1342
1432
|
value: function () {
|
|
1343
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1433
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1344
1434
|
var _ref15,
|
|
1345
1435
|
module,
|
|
1346
1436
|
_ref15$tags,
|
|
1347
1437
|
tags,
|
|
1348
1438
|
data,
|
|
1349
1439
|
t,
|
|
1350
|
-
|
|
1351
|
-
return _regeneratorRuntime().wrap(function
|
|
1352
|
-
while (1) switch (
|
|
1440
|
+
_args36 = arguments;
|
|
1441
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1442
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1353
1443
|
case 0:
|
|
1354
|
-
_ref15 =
|
|
1444
|
+
_ref15 = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {}, module = _ref15.module, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, data = _ref15.data;
|
|
1355
1445
|
t = {
|
|
1356
1446
|
Type: "Process",
|
|
1357
1447
|
"Data-Protocol": "ao",
|
|
@@ -1371,15 +1461,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1371
1461
|
};
|
|
1372
1462
|
if (data) t.data = data;
|
|
1373
1463
|
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1374
|
-
|
|
1464
|
+
_context36.next = 6;
|
|
1375
1465
|
return this.spawn(tags);
|
|
1376
1466
|
case 6:
|
|
1377
|
-
return
|
|
1467
|
+
return _context36.abrupt("return", _context36.sent);
|
|
1378
1468
|
case 7:
|
|
1379
1469
|
case "end":
|
|
1380
|
-
return
|
|
1470
|
+
return _context36.stop();
|
|
1381
1471
|
}
|
|
1382
|
-
},
|
|
1472
|
+
}, _callee36, this);
|
|
1383
1473
|
}));
|
|
1384
1474
|
function spawnLegacy() {
|
|
1385
1475
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1389,7 +1479,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1389
1479
|
}, {
|
|
1390
1480
|
key: "results",
|
|
1391
1481
|
value: function () {
|
|
1392
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1482
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
1393
1483
|
var _ref16,
|
|
1394
1484
|
process,
|
|
1395
1485
|
limit,
|
|
@@ -1400,11 +1490,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
1400
1490
|
params,
|
|
1401
1491
|
addParam,
|
|
1402
1492
|
res,
|
|
1403
|
-
|
|
1404
|
-
return _regeneratorRuntime().wrap(function
|
|
1405
|
-
while (1) switch (
|
|
1493
|
+
_args37 = arguments;
|
|
1494
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1495
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1406
1496
|
case 0:
|
|
1407
|
-
_ref16 =
|
|
1497
|
+
_ref16 = _args37.length > 0 && _args37[0] !== undefined ? _args37[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;
|
|
1408
1498
|
params = "";
|
|
1409
1499
|
addParam = function addParam(key, val) {
|
|
1410
1500
|
params += params === "" ? "?" : "&";
|
|
@@ -1414,7 +1504,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1414
1504
|
if (sort) addParam("sort", sort);
|
|
1415
1505
|
if (from) addParam("from", from);
|
|
1416
1506
|
if (to) addParam("to", to);
|
|
1417
|
-
|
|
1507
|
+
_context37.next = 9;
|
|
1418
1508
|
return this.post({
|
|
1419
1509
|
path: "/~relay@1.0/call",
|
|
1420
1510
|
method: "GET",
|
|
@@ -1422,13 +1512,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1422
1512
|
"content-type": "application/json"
|
|
1423
1513
|
});
|
|
1424
1514
|
case 9:
|
|
1425
|
-
res =
|
|
1426
|
-
return
|
|
1515
|
+
res = _context37.sent;
|
|
1516
|
+
return _context37.abrupt("return", JSON.parse(res.body));
|
|
1427
1517
|
case 11:
|
|
1428
1518
|
case "end":
|
|
1429
|
-
return
|
|
1519
|
+
return _context37.stop();
|
|
1430
1520
|
}
|
|
1431
|
-
},
|
|
1521
|
+
}, _callee37, this);
|
|
1432
1522
|
}));
|
|
1433
1523
|
function results() {
|
|
1434
1524
|
return _results.apply(this, arguments);
|
|
@@ -1438,7 +1528,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1438
1528
|
}, {
|
|
1439
1529
|
key: "dryrun",
|
|
1440
1530
|
value: function () {
|
|
1441
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1531
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
1442
1532
|
var _ref17,
|
|
1443
1533
|
_ref17$tags,
|
|
1444
1534
|
tags,
|
|
@@ -1447,18 +1537,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
1447
1537
|
data,
|
|
1448
1538
|
json,
|
|
1449
1539
|
res,
|
|
1450
|
-
|
|
1451
|
-
return _regeneratorRuntime().wrap(function
|
|
1452
|
-
while (1) switch (
|
|
1540
|
+
_args38 = arguments;
|
|
1541
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1542
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1453
1543
|
case 0:
|
|
1454
|
-
_ref17 =
|
|
1544
|
+
_ref17 = _args38.length > 0 && _args38[0] !== undefined ? _args38[0] : {}, _ref17$tags = _ref17.tags, tags = _ref17$tags === void 0 ? {} : _ref17$tags, pid = _ref17.pid, action = _ref17.action, data = _ref17.data;
|
|
1455
1545
|
if (typeof action === "string") tags.Action = action;
|
|
1456
1546
|
json = {
|
|
1457
1547
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1458
1548
|
Owner: this.addr
|
|
1459
1549
|
};
|
|
1460
1550
|
if (data) json.Data = data;
|
|
1461
|
-
|
|
1551
|
+
_context38.next = 6;
|
|
1462
1552
|
return this.post({
|
|
1463
1553
|
path: "/~relay@1.0/call",
|
|
1464
1554
|
method: "POST",
|
|
@@ -1467,45 +1557,88 @@ var HB = /*#__PURE__*/function () {
|
|
|
1467
1557
|
"relay-body": JSON.stringify(json)
|
|
1468
1558
|
});
|
|
1469
1559
|
case 6:
|
|
1470
|
-
res =
|
|
1471
|
-
return
|
|
1560
|
+
res = _context38.sent;
|
|
1561
|
+
return _context38.abrupt("return", JSON.parse(res.body));
|
|
1472
1562
|
case 8:
|
|
1473
1563
|
case "end":
|
|
1474
|
-
return
|
|
1564
|
+
return _context38.stop();
|
|
1475
1565
|
}
|
|
1476
|
-
},
|
|
1566
|
+
}, _callee38, this);
|
|
1477
1567
|
}));
|
|
1478
1568
|
function dryrun() {
|
|
1479
1569
|
return _dryrun.apply(this, arguments);
|
|
1480
1570
|
}
|
|
1481
1571
|
return dryrun;
|
|
1482
1572
|
}()
|
|
1573
|
+
}, {
|
|
1574
|
+
key: "commit",
|
|
1575
|
+
value: function () {
|
|
1576
|
+
var _commit2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(obj, opts) {
|
|
1577
|
+
var msg, hmacId, rsaId, committer, meta, meta2, sigs;
|
|
1578
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1579
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1580
|
+
case 0:
|
|
1581
|
+
_context39.next = 2;
|
|
1582
|
+
return this.sign(obj, opts);
|
|
1583
|
+
case 2:
|
|
1584
|
+
msg = _context39.sent;
|
|
1585
|
+
hmacId = (0, _utils.hmacid)(msg.headers);
|
|
1586
|
+
rsaId = (0, _utils.rsaid)(msg.headers);
|
|
1587
|
+
committer = this.addr;
|
|
1588
|
+
meta = {
|
|
1589
|
+
alg: "rsa-pss-sha512",
|
|
1590
|
+
"commitment-device": "httpsig@1.0"
|
|
1591
|
+
};
|
|
1592
|
+
meta2 = {
|
|
1593
|
+
alg: "hmac-sha256",
|
|
1594
|
+
"commitment-device": "httpsig@1.0"
|
|
1595
|
+
};
|
|
1596
|
+
sigs = {
|
|
1597
|
+
signature: msg.headers.signature,
|
|
1598
|
+
"signature-input": msg.headers["signature-input"]
|
|
1599
|
+
};
|
|
1600
|
+
return _context39.abrupt("return", _objectSpread({
|
|
1601
|
+
commitments: _defineProperty(_defineProperty({}, rsaId, _objectSpread(_objectSpread({}, meta), {}, {
|
|
1602
|
+
committer: committer
|
|
1603
|
+
}, sigs)), hmacId, _objectSpread(_objectSpread({}, meta2), sigs))
|
|
1604
|
+
}, obj));
|
|
1605
|
+
case 10:
|
|
1606
|
+
case "end":
|
|
1607
|
+
return _context39.stop();
|
|
1608
|
+
}
|
|
1609
|
+
}, _callee39, this);
|
|
1610
|
+
}));
|
|
1611
|
+
function commit(_x29, _x30) {
|
|
1612
|
+
return _commit2.apply(this, arguments);
|
|
1613
|
+
}
|
|
1614
|
+
return commit;
|
|
1615
|
+
}()
|
|
1483
1616
|
}, {
|
|
1484
1617
|
key: "post",
|
|
1485
1618
|
value: function () {
|
|
1486
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1619
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(obj, json) {
|
|
1487
1620
|
var _json;
|
|
1488
|
-
return _regeneratorRuntime().wrap(function
|
|
1489
|
-
while (1) switch (
|
|
1621
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1622
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1490
1623
|
case 0:
|
|
1491
1624
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1492
1625
|
obj.path += _json;
|
|
1493
|
-
|
|
1494
|
-
|
|
1626
|
+
_context40.t0 = this;
|
|
1627
|
+
_context40.next = 5;
|
|
1495
1628
|
return this.sign(obj);
|
|
1496
1629
|
case 5:
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
return
|
|
1630
|
+
_context40.t1 = _context40.sent;
|
|
1631
|
+
_context40.next = 8;
|
|
1632
|
+
return _context40.t0.send.call(_context40.t0, _context40.t1);
|
|
1500
1633
|
case 8:
|
|
1501
|
-
return
|
|
1634
|
+
return _context40.abrupt("return", _context40.sent);
|
|
1502
1635
|
case 9:
|
|
1503
1636
|
case "end":
|
|
1504
|
-
return
|
|
1637
|
+
return _context40.stop();
|
|
1505
1638
|
}
|
|
1506
|
-
},
|
|
1639
|
+
}, _callee40, this);
|
|
1507
1640
|
}));
|
|
1508
|
-
function post(
|
|
1641
|
+
function post(_x31, _x32) {
|
|
1509
1642
|
return _post.apply(this, arguments);
|
|
1510
1643
|
}
|
|
1511
1644
|
return post;
|
|
@@ -1513,7 +1646,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1513
1646
|
}, {
|
|
1514
1647
|
key: "get",
|
|
1515
1648
|
value: function () {
|
|
1516
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1649
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(_ref18) {
|
|
1517
1650
|
var _path3;
|
|
1518
1651
|
var path,
|
|
1519
1652
|
params,
|
|
@@ -1525,12 +1658,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
1525
1658
|
response,
|
|
1526
1659
|
headers,
|
|
1527
1660
|
http,
|
|
1528
|
-
|
|
1529
|
-
return _regeneratorRuntime().wrap(function
|
|
1530
|
-
while (1) switch (
|
|
1661
|
+
_args41 = arguments;
|
|
1662
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
1663
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1531
1664
|
case 0:
|
|
1532
|
-
path = _ref18.path, params = _objectWithoutProperties(_ref18,
|
|
1533
|
-
json =
|
|
1665
|
+
path = _ref18.path, params = _objectWithoutProperties(_ref18, _excluded2);
|
|
1666
|
+
json = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : false;
|
|
1534
1667
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1535
1668
|
(_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
|
|
1536
1669
|
if (!/^\//.test(path)) path = "/" + path;
|
|
@@ -1542,33 +1675,33 @@ var HB = /*#__PURE__*/function () {
|
|
|
1542
1675
|
i++;
|
|
1543
1676
|
}
|
|
1544
1677
|
}
|
|
1545
|
-
|
|
1678
|
+
_context41.next = 9;
|
|
1546
1679
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1547
1680
|
case 9:
|
|
1548
|
-
response =
|
|
1681
|
+
response = _context41.sent;
|
|
1549
1682
|
headers = {};
|
|
1550
1683
|
response.headers.forEach(function (v, k) {
|
|
1551
1684
|
return headers[k] = v;
|
|
1552
1685
|
});
|
|
1553
|
-
|
|
1554
|
-
|
|
1686
|
+
_context41.t0 = headers;
|
|
1687
|
+
_context41.next = 15;
|
|
1555
1688
|
return response.text();
|
|
1556
1689
|
case 15:
|
|
1557
|
-
|
|
1558
|
-
|
|
1690
|
+
_context41.t1 = _context41.sent;
|
|
1691
|
+
_context41.t2 = response.status;
|
|
1559
1692
|
http = {
|
|
1560
|
-
headers:
|
|
1561
|
-
body:
|
|
1562
|
-
status:
|
|
1693
|
+
headers: _context41.t0,
|
|
1694
|
+
body: _context41.t1,
|
|
1695
|
+
status: _context41.t2
|
|
1563
1696
|
};
|
|
1564
|
-
return
|
|
1697
|
+
return _context41.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsig.from)(http)), http));
|
|
1565
1698
|
case 19:
|
|
1566
1699
|
case "end":
|
|
1567
|
-
return
|
|
1700
|
+
return _context41.stop();
|
|
1568
1701
|
}
|
|
1569
|
-
},
|
|
1702
|
+
}, _callee41, this);
|
|
1570
1703
|
}));
|
|
1571
|
-
function get(
|
|
1704
|
+
function get(_x33) {
|
|
1572
1705
|
return _get.apply(this, arguments);
|
|
1573
1706
|
}
|
|
1574
1707
|
return get;
|
|
@@ -1576,23 +1709,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1576
1709
|
}, {
|
|
1577
1710
|
key: "postJSON",
|
|
1578
1711
|
value: function () {
|
|
1579
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1712
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(args) {
|
|
1580
1713
|
var res;
|
|
1581
|
-
return _regeneratorRuntime().wrap(function
|
|
1582
|
-
while (1) switch (
|
|
1714
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
1715
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1583
1716
|
case 0:
|
|
1584
|
-
|
|
1717
|
+
_context42.next = 2;
|
|
1585
1718
|
return this.post(args, true);
|
|
1586
1719
|
case 2:
|
|
1587
|
-
res =
|
|
1588
|
-
return
|
|
1720
|
+
res = _context42.sent;
|
|
1721
|
+
return _context42.abrupt("return", JSON.parse(res.body));
|
|
1589
1722
|
case 4:
|
|
1590
1723
|
case "end":
|
|
1591
|
-
return
|
|
1724
|
+
return _context42.stop();
|
|
1592
1725
|
}
|
|
1593
|
-
},
|
|
1726
|
+
}, _callee42, this);
|
|
1594
1727
|
}));
|
|
1595
|
-
function postJSON(
|
|
1728
|
+
function postJSON(_x34) {
|
|
1596
1729
|
return _postJSON.apply(this, arguments);
|
|
1597
1730
|
}
|
|
1598
1731
|
return postJSON;
|
|
@@ -1600,23 +1733,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1600
1733
|
}, {
|
|
1601
1734
|
key: "getJSON",
|
|
1602
1735
|
value: function () {
|
|
1603
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1736
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(args) {
|
|
1604
1737
|
var res;
|
|
1605
|
-
return _regeneratorRuntime().wrap(function
|
|
1606
|
-
while (1) switch (
|
|
1738
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
1739
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
1607
1740
|
case 0:
|
|
1608
|
-
|
|
1741
|
+
_context43.next = 2;
|
|
1609
1742
|
return this.get(args, true);
|
|
1610
1743
|
case 2:
|
|
1611
|
-
res =
|
|
1612
|
-
return
|
|
1744
|
+
res = _context43.sent;
|
|
1745
|
+
return _context43.abrupt("return", JSON.parse(res.body));
|
|
1613
1746
|
case 4:
|
|
1614
1747
|
case "end":
|
|
1615
|
-
return
|
|
1748
|
+
return _context43.stop();
|
|
1616
1749
|
}
|
|
1617
|
-
},
|
|
1750
|
+
}, _callee43, this);
|
|
1618
1751
|
}));
|
|
1619
|
-
function getJSON(
|
|
1752
|
+
function getJSON(_x35) {
|
|
1620
1753
|
return _getJSON.apply(this, arguments);
|
|
1621
1754
|
}
|
|
1622
1755
|
return getJSON;
|