wao 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/hb.js +488 -322
- package/cjs/hyperbeam.js +32 -2
- package/cjs/signer.js +352 -196
- package/cjs/utils.js +1 -0
- package/esm/hb.js +119 -81
- package/esm/hyperbeam.js +21 -4
- package/esm/signer.js +172 -27
- package/esm/utils.js +1 -0
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -8,9 +8,12 @@ var _aoconnect = require("@permaweb/aoconnect");
|
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
10
|
var _signer = require("./signer.js");
|
|
11
|
-
var
|
|
11
|
+
var _path4 = require("path");
|
|
12
12
|
var _fs = require("fs");
|
|
13
|
+
var _excluded = ["path"];
|
|
13
14
|
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
14
17
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
18
|
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; } }
|
|
16
19
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
@@ -56,7 +59,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
56
59
|
args = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
57
60
|
_context.t0 = _this;
|
|
58
61
|
_context.next = 4;
|
|
59
|
-
return _this.fetch(_this.path(
|
|
62
|
+
return _this.fetch(_this.path({
|
|
63
|
+
dev: "hyperbuddy",
|
|
64
|
+
path: "metrics",
|
|
65
|
+
json: false
|
|
66
|
+
}), false);
|
|
60
67
|
case 4:
|
|
61
68
|
_context.t1 = _context.sent;
|
|
62
69
|
return _context.abrupt("return", _context.t0.parseMetrics.call(_context.t0, _context.t1));
|
|
@@ -79,7 +86,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
79
86
|
while (1) switch (_context2.prev = _context2.next) {
|
|
80
87
|
case 0:
|
|
81
88
|
_context2.next = 2;
|
|
82
|
-
return _this.
|
|
89
|
+
return _this.post(_objectSpread({
|
|
83
90
|
path: "/~json@1.0/commit"
|
|
84
91
|
}, args));
|
|
85
92
|
case 2:
|
|
@@ -101,7 +108,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
101
108
|
while (1) switch (_context3.prev = _context3.next) {
|
|
102
109
|
case 0:
|
|
103
110
|
_context3.next = 2;
|
|
104
|
-
return _this.
|
|
111
|
+
return _this.post(_objectSpread({
|
|
105
112
|
path: "/~json@1.0/verify"
|
|
106
113
|
}, args));
|
|
107
114
|
case 2:
|
|
@@ -123,7 +130,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
123
130
|
while (1) switch (_context4.prev = _context4.next) {
|
|
124
131
|
case 0:
|
|
125
132
|
_context4.next = 2;
|
|
126
|
-
return _this.
|
|
133
|
+
return _this.post(_objectSpread({
|
|
127
134
|
path: "/~json@1.0/deserialize"
|
|
128
135
|
}, args));
|
|
129
136
|
case 2:
|
|
@@ -145,7 +152,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
145
152
|
while (1) switch (_context5.prev = _context5.next) {
|
|
146
153
|
case 0:
|
|
147
154
|
_context5.next = 2;
|
|
148
|
-
return _this.
|
|
155
|
+
return _this.post(_objectSpread({
|
|
149
156
|
path: "/~json@1.0/serialize"
|
|
150
157
|
}, args));
|
|
151
158
|
case 2:
|
|
@@ -184,7 +191,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
184
191
|
break;
|
|
185
192
|
}
|
|
186
193
|
_context6.next = 5;
|
|
187
|
-
return _this.
|
|
194
|
+
return _this.post(_objectSpread({
|
|
188
195
|
path: "/~meta@1.0/info"
|
|
189
196
|
}, args));
|
|
190
197
|
case 5:
|
|
@@ -195,14 +202,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
195
202
|
break;
|
|
196
203
|
}
|
|
197
204
|
_context6.next = 11;
|
|
198
|
-
return _this.fetch(_this.path(
|
|
205
|
+
return _this.fetch(_this.path({
|
|
206
|
+
dev: "meta",
|
|
207
|
+
path: "info/".concat(key),
|
|
208
|
+
json: (_args$json2 = args.json) !== null && _args$json2 !== void 0 ? _args$json2 : false
|
|
209
|
+
}), (_args$json3 = args.json) !== null && _args$json3 !== void 0 ? _args$json3 : false);
|
|
199
210
|
case 11:
|
|
200
211
|
_context6.t0 = _context6.sent;
|
|
201
212
|
_context6.next = 17;
|
|
202
213
|
break;
|
|
203
214
|
case 14:
|
|
204
215
|
_context6.next = 16;
|
|
205
|
-
return _this.fetch(_this.path(
|
|
216
|
+
return _this.fetch(_this.path({
|
|
217
|
+
dev: "meta",
|
|
218
|
+
path: "info",
|
|
219
|
+
json: json
|
|
220
|
+
}));
|
|
206
221
|
case 16:
|
|
207
222
|
_context6.t0 = _context6.sent;
|
|
208
223
|
case 17:
|
|
@@ -224,7 +239,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
224
239
|
while (1) switch (_context7.prev = _context7.next) {
|
|
225
240
|
case 0:
|
|
226
241
|
_context7.next = 2;
|
|
227
|
-
return _this.fetch(_this.path(
|
|
242
|
+
return _this.fetch(_this.path({
|
|
243
|
+
dev: "meta",
|
|
244
|
+
path: "build"
|
|
245
|
+
}));
|
|
228
246
|
case 2:
|
|
229
247
|
return _context7.abrupt("return", _context7.sent);
|
|
230
248
|
case 3:
|
|
@@ -246,7 +264,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
246
264
|
value: function _init(jwk) {
|
|
247
265
|
this.signer = (0, _aoconnect.createSigner)(jwk, this.url);
|
|
248
266
|
this.addr = (0, _utils.toAddr)(jwk.n);
|
|
249
|
-
this.
|
|
267
|
+
this.sign = (0, _signer.createRequest)({
|
|
250
268
|
signer: this.signer,
|
|
251
269
|
url: this.url
|
|
252
270
|
});
|
|
@@ -286,24 +304,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
286
304
|
}, {
|
|
287
305
|
key: "send",
|
|
288
306
|
value: function () {
|
|
289
|
-
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(
|
|
307
|
+
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(msg) {
|
|
290
308
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
291
309
|
while (1) switch (_context9.prev = _context9.next) {
|
|
292
310
|
case 0:
|
|
293
|
-
_context9.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
case 3:
|
|
297
|
-
_context9.t1 = _context9.sent;
|
|
298
|
-
_context9.next = 6;
|
|
299
|
-
return (0, _context9.t0)(_context9.t1);
|
|
300
|
-
case 6:
|
|
311
|
+
_context9.next = 2;
|
|
312
|
+
return (0, _signer.send)(msg);
|
|
313
|
+
case 2:
|
|
301
314
|
return _context9.abrupt("return", _context9.sent);
|
|
302
|
-
case
|
|
315
|
+
case 3:
|
|
303
316
|
case "end":
|
|
304
317
|
return _context9.stop();
|
|
305
318
|
}
|
|
306
|
-
}, _callee9
|
|
319
|
+
}, _callee9);
|
|
307
320
|
}));
|
|
308
321
|
function send(_x7) {
|
|
309
322
|
return _send2.apply(this, arguments);
|
|
@@ -319,7 +332,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
319
332
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
320
333
|
while (1) switch (_context10.prev = _context10.next) {
|
|
321
334
|
case 0:
|
|
322
|
-
wasm = (0, _fs.readFileSync)((0,
|
|
335
|
+
wasm = (0, _fs.readFileSync)((0, _path4.resolve)(import.meta.dirname, "./lua/aos2-wamr.wasm"));
|
|
323
336
|
_context10.next = 3;
|
|
324
337
|
return this.cacheModule(wasm, "application/wasm");
|
|
325
338
|
case 3:
|
|
@@ -338,20 +351,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
338
351
|
return getImage;
|
|
339
352
|
}()
|
|
340
353
|
}, {
|
|
341
|
-
key: "
|
|
354
|
+
key: "getLua",
|
|
342
355
|
value: function () {
|
|
343
|
-
var
|
|
344
|
-
var _this$
|
|
345
|
-
var
|
|
356
|
+
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
357
|
+
var _this$lua;
|
|
358
|
+
var lua, id;
|
|
346
359
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
347
360
|
while (1) switch (_context11.prev = _context11.next) {
|
|
348
361
|
case 0:
|
|
349
|
-
|
|
362
|
+
lua = (0, _fs.readFileSync)((0, _path4.resolve)(import.meta.dirname, "./lua/hyper-aos.lua"));
|
|
350
363
|
_context11.next = 3;
|
|
351
|
-
return this.cacheModule(
|
|
364
|
+
return this.cacheModule(lua, "application/lua");
|
|
352
365
|
case 3:
|
|
353
366
|
id = _context11.sent;
|
|
354
|
-
(_this$
|
|
367
|
+
(_this$lua = this.lua) !== null && _this$lua !== void 0 ? _this$lua : this.lua = id;
|
|
355
368
|
return _context11.abrupt("return", id);
|
|
356
369
|
case 6:
|
|
357
370
|
case "end":
|
|
@@ -359,96 +372,105 @@ var HB = /*#__PURE__*/function () {
|
|
|
359
372
|
}
|
|
360
373
|
}, _callee11, this);
|
|
361
374
|
}));
|
|
362
|
-
function getLegacy() {
|
|
363
|
-
return _getLegacy.apply(this, arguments);
|
|
364
|
-
}
|
|
365
|
-
return getLegacy;
|
|
366
|
-
}()
|
|
367
|
-
}, {
|
|
368
|
-
key: "getLua",
|
|
369
|
-
value: function () {
|
|
370
|
-
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
371
|
-
var _this$lua;
|
|
372
|
-
var lua, id;
|
|
373
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
374
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
375
|
-
case 0:
|
|
376
|
-
lua = (0, _fs.readFileSync)((0, _path2.resolve)(import.meta.dirname, "./lua/hyper-aos.lua"));
|
|
377
|
-
_context12.next = 3;
|
|
378
|
-
return this.cacheModule(lua, "application/lua");
|
|
379
|
-
case 3:
|
|
380
|
-
id = _context12.sent;
|
|
381
|
-
(_this$lua = this.lua) !== null && _this$lua !== void 0 ? _this$lua : this.lua = id;
|
|
382
|
-
return _context12.abrupt("return", id);
|
|
383
|
-
case 6:
|
|
384
|
-
case "end":
|
|
385
|
-
return _context12.stop();
|
|
386
|
-
}
|
|
387
|
-
}, _callee12, this);
|
|
388
|
-
}));
|
|
389
375
|
function getLua() {
|
|
390
376
|
return _getLua.apply(this, arguments);
|
|
391
377
|
}
|
|
392
378
|
return getLua;
|
|
393
379
|
}()
|
|
394
380
|
}, {
|
|
395
|
-
key: "
|
|
381
|
+
key: "scheduleAOS",
|
|
396
382
|
value: function () {
|
|
397
|
-
var
|
|
383
|
+
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref2) {
|
|
398
384
|
var _pid;
|
|
399
385
|
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
400
|
-
return _regeneratorRuntime().wrap(function
|
|
401
|
-
while (1) switch (
|
|
386
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
387
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
402
388
|
case 0:
|
|
403
389
|
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;
|
|
404
390
|
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
405
391
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
406
392
|
device: "process@1.0",
|
|
407
393
|
method: "POST",
|
|
408
|
-
path: "/".concat(pid, "/schedule"),
|
|
394
|
+
path: "/".concat(pid, "~process@1.0/schedule"),
|
|
409
395
|
scheduler: this.scheduler,
|
|
410
396
|
Type: "Message",
|
|
411
397
|
Action: action,
|
|
412
398
|
Target: pid
|
|
413
399
|
});
|
|
414
400
|
if (data) _tags.data = data;
|
|
415
|
-
|
|
416
|
-
return this.
|
|
401
|
+
_context12.next = 6;
|
|
402
|
+
return this.post(_tags);
|
|
417
403
|
case 6:
|
|
418
|
-
res =
|
|
419
|
-
slot = res.headers.
|
|
404
|
+
res = _context12.sent;
|
|
405
|
+
slot = res.headers.slot;
|
|
406
|
+
return _context12.abrupt("return", {
|
|
407
|
+
slot: slot,
|
|
408
|
+
res: res,
|
|
409
|
+
pid: pid
|
|
410
|
+
});
|
|
411
|
+
case 9:
|
|
412
|
+
case "end":
|
|
413
|
+
return _context12.stop();
|
|
414
|
+
}
|
|
415
|
+
}, _callee12, this);
|
|
416
|
+
}));
|
|
417
|
+
function scheduleAOS(_x8) {
|
|
418
|
+
return _scheduleAOS.apply(this, arguments);
|
|
419
|
+
}
|
|
420
|
+
return scheduleAOS;
|
|
421
|
+
}()
|
|
422
|
+
}, {
|
|
423
|
+
key: "messageAOS",
|
|
424
|
+
value: function () {
|
|
425
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(args) {
|
|
426
|
+
var _yield$this$scheduleA, slot, pid;
|
|
427
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
428
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
429
|
+
case 0:
|
|
430
|
+
_context13.next = 2;
|
|
431
|
+
return this.scheduleAOS(args);
|
|
432
|
+
case 2:
|
|
433
|
+
_yield$this$scheduleA = _context13.sent;
|
|
434
|
+
slot = _yield$this$scheduleA.slot;
|
|
435
|
+
pid = _yield$this$scheduleA.pid;
|
|
420
436
|
_context13.t0 = slot;
|
|
421
|
-
_context13.next =
|
|
437
|
+
_context13.next = 8;
|
|
422
438
|
return this.computeAOS({
|
|
423
439
|
pid: pid,
|
|
424
440
|
slot: slot
|
|
425
441
|
});
|
|
426
|
-
case
|
|
442
|
+
case 8:
|
|
427
443
|
_context13.t1 = _context13.sent;
|
|
428
444
|
return _context13.abrupt("return", {
|
|
429
445
|
slot: _context13.t0,
|
|
430
446
|
outbox: _context13.t1
|
|
431
447
|
});
|
|
432
|
-
case
|
|
448
|
+
case 10:
|
|
433
449
|
case "end":
|
|
434
450
|
return _context13.stop();
|
|
435
451
|
}
|
|
436
452
|
}, _callee13, this);
|
|
437
453
|
}));
|
|
438
|
-
function messageAOS(
|
|
454
|
+
function messageAOS(_x9) {
|
|
439
455
|
return _messageAOS.apply(this, arguments);
|
|
440
456
|
}
|
|
441
457
|
return messageAOS;
|
|
442
458
|
}()
|
|
443
459
|
}, {
|
|
444
460
|
key: "path",
|
|
445
|
-
value: function path() {
|
|
446
|
-
var
|
|
447
|
-
var
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
461
|
+
value: function path(_ref3) {
|
|
462
|
+
var _path2;
|
|
463
|
+
var _ref3$dev = _ref3.dev,
|
|
464
|
+
dev = _ref3$dev === void 0 ? "message" : _ref3$dev,
|
|
465
|
+
_path = _ref3.path,
|
|
466
|
+
_ref3$json = _ref3.json,
|
|
467
|
+
json = _ref3$json === void 0 ? true : _ref3$json,
|
|
468
|
+
_ref3$params = _ref3.params,
|
|
469
|
+
params = _ref3$params === void 0 ? {} : _ref3$params,
|
|
470
|
+
_ref3$pid = _ref3.pid,
|
|
471
|
+
pid = _ref3$pid === void 0 ? "" : _ref3$pid,
|
|
472
|
+
_ref3$tail = _ref3.tail,
|
|
473
|
+
tail = _ref3$tail === void 0 ? "" : _ref3$tail;
|
|
452
474
|
if (!/@/.test(dev)) dev += "@1.0";
|
|
453
475
|
var _params = "";
|
|
454
476
|
if (!(0, _ramda.isEmpty)(params)) {
|
|
@@ -458,7 +480,8 @@ var HB = /*#__PURE__*/function () {
|
|
|
458
480
|
i++;
|
|
459
481
|
}
|
|
460
482
|
}
|
|
461
|
-
|
|
483
|
+
if (_path && !/^\//.test(_path)) _path = "/" + _path;
|
|
484
|
+
return "/".concat(pid, "~").concat(dev).concat((_path2 = _path) !== null && _path2 !== void 0 ? _path2 : "").concat(tail).concat(json ? "/~json@1.0/serialize" : "").concat(_params);
|
|
462
485
|
}
|
|
463
486
|
}, {
|
|
464
487
|
key: "text",
|
|
@@ -479,7 +502,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
479
502
|
dev = "process";
|
|
480
503
|
}
|
|
481
504
|
_context14.next = 6;
|
|
482
|
-
return this.fetch(this.path(
|
|
505
|
+
return this.fetch(this.path({
|
|
506
|
+
dev: dev,
|
|
507
|
+
path: path,
|
|
508
|
+
json: false,
|
|
509
|
+
params: params,
|
|
510
|
+
pid: pid,
|
|
511
|
+
tail: tail
|
|
512
|
+
}), false);
|
|
483
513
|
case 6:
|
|
484
514
|
return _context14.abrupt("return", _context14.sent);
|
|
485
515
|
case 7:
|
|
@@ -488,7 +518,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
488
518
|
}
|
|
489
519
|
}, _callee14, this);
|
|
490
520
|
}));
|
|
491
|
-
function text(
|
|
521
|
+
function text(_x10, _x11) {
|
|
492
522
|
return _text.apply(this, arguments);
|
|
493
523
|
}
|
|
494
524
|
return text;
|
|
@@ -496,7 +526,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
496
526
|
}, {
|
|
497
527
|
key: "json",
|
|
498
528
|
value: function () {
|
|
499
|
-
var
|
|
529
|
+
var _json2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(dev, path) {
|
|
500
530
|
var params,
|
|
501
531
|
tail,
|
|
502
532
|
pid,
|
|
@@ -512,7 +542,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
512
542
|
dev = "process";
|
|
513
543
|
}
|
|
514
544
|
_context15.next = 6;
|
|
515
|
-
return this.fetch(this.path(
|
|
545
|
+
return this.fetch(this.path({
|
|
546
|
+
dev: dev,
|
|
547
|
+
path: path,
|
|
548
|
+
json: true,
|
|
549
|
+
params: params,
|
|
550
|
+
pid: pid,
|
|
551
|
+
tail: tail
|
|
552
|
+
}));
|
|
516
553
|
case 6:
|
|
517
554
|
return _context15.abrupt("return", _context15.sent);
|
|
518
555
|
case 7:
|
|
@@ -521,8 +558,8 @@ var HB = /*#__PURE__*/function () {
|
|
|
521
558
|
}
|
|
522
559
|
}, _callee15, this);
|
|
523
560
|
}));
|
|
524
|
-
function json(
|
|
525
|
-
return
|
|
561
|
+
function json(_x12, _x13) {
|
|
562
|
+
return _json2.apply(this, arguments);
|
|
526
563
|
}
|
|
527
564
|
return json;
|
|
528
565
|
}()
|
|
@@ -537,7 +574,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
537
574
|
};
|
|
538
575
|
return fetch;
|
|
539
576
|
}(/*#__PURE__*/function () {
|
|
540
|
-
var
|
|
577
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(path) {
|
|
541
578
|
var json,
|
|
542
579
|
_args16 = arguments;
|
|
543
580
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
@@ -545,7 +582,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
545
582
|
case 0:
|
|
546
583
|
json = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : true;
|
|
547
584
|
_context16.next = 3;
|
|
548
|
-
return fetch(url).then(function (r) {
|
|
585
|
+
return fetch(this.url + path).then(function (r) {
|
|
549
586
|
return json ? r.json() : r.text();
|
|
550
587
|
});
|
|
551
588
|
case 3:
|
|
@@ -554,24 +591,25 @@ var HB = /*#__PURE__*/function () {
|
|
|
554
591
|
case "end":
|
|
555
592
|
return _context16.stop();
|
|
556
593
|
}
|
|
557
|
-
}, _callee16);
|
|
594
|
+
}, _callee16, this);
|
|
558
595
|
}));
|
|
559
|
-
return function (
|
|
560
|
-
return
|
|
596
|
+
return function (_x14) {
|
|
597
|
+
return _ref4.apply(this, arguments);
|
|
561
598
|
};
|
|
562
599
|
}())
|
|
563
600
|
}, {
|
|
564
601
|
key: "computeAOS",
|
|
565
602
|
value: function () {
|
|
566
|
-
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(
|
|
603
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref5) {
|
|
567
604
|
var pid, slot;
|
|
568
605
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
569
606
|
while (1) switch (_context17.prev = _context17.next) {
|
|
570
607
|
case 0:
|
|
571
|
-
pid =
|
|
608
|
+
pid = _ref5.pid, slot = _ref5.slot;
|
|
572
609
|
_context17.next = 3;
|
|
573
|
-
return
|
|
574
|
-
|
|
610
|
+
return this.getJSON({
|
|
611
|
+
path: "/".concat(pid, "/compute/results/outbox"),
|
|
612
|
+
slot: slot
|
|
575
613
|
});
|
|
576
614
|
case 3:
|
|
577
615
|
return _context17.abrupt("return", _context17.sent);
|
|
@@ -581,7 +619,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
581
619
|
}
|
|
582
620
|
}, _callee17, this);
|
|
583
621
|
}));
|
|
584
|
-
function computeAOS(
|
|
622
|
+
function computeAOS(_x15) {
|
|
585
623
|
return _computeAOS.apply(this, arguments);
|
|
586
624
|
}
|
|
587
625
|
return computeAOS;
|
|
@@ -589,15 +627,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
589
627
|
}, {
|
|
590
628
|
key: "computeLua",
|
|
591
629
|
value: function () {
|
|
592
|
-
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(
|
|
630
|
+
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref6) {
|
|
593
631
|
var pid, slot;
|
|
594
632
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
595
633
|
while (1) switch (_context18.prev = _context18.next) {
|
|
596
634
|
case 0:
|
|
597
|
-
pid =
|
|
635
|
+
pid = _ref6.pid, slot = _ref6.slot;
|
|
598
636
|
_context18.next = 3;
|
|
599
|
-
return
|
|
600
|
-
|
|
637
|
+
return this.getJSON({
|
|
638
|
+
path: "/".concat(pid, "/compute/results"),
|
|
639
|
+
slot: slot
|
|
601
640
|
});
|
|
602
641
|
case 3:
|
|
603
642
|
return _context18.abrupt("return", _context18.sent);
|
|
@@ -607,7 +646,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
607
646
|
}
|
|
608
647
|
}, _callee18, this);
|
|
609
648
|
}));
|
|
610
|
-
function computeLua(
|
|
649
|
+
function computeLua(_x16) {
|
|
611
650
|
return _computeLua.apply(this, arguments);
|
|
612
651
|
}
|
|
613
652
|
return computeLua;
|
|
@@ -615,15 +654,16 @@ var HB = /*#__PURE__*/function () {
|
|
|
615
654
|
}, {
|
|
616
655
|
key: "compute",
|
|
617
656
|
value: function () {
|
|
618
|
-
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(
|
|
657
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref7) {
|
|
619
658
|
var pid, slot;
|
|
620
659
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
621
660
|
while (1) switch (_context19.prev = _context19.next) {
|
|
622
661
|
case 0:
|
|
623
|
-
pid =
|
|
662
|
+
pid = _ref7.pid, slot = _ref7.slot;
|
|
624
663
|
_context19.next = 3;
|
|
625
|
-
return
|
|
626
|
-
|
|
664
|
+
return this.getJSON({
|
|
665
|
+
path: "/".concat(pid, "/compute"),
|
|
666
|
+
slot: slot
|
|
627
667
|
});
|
|
628
668
|
case 3:
|
|
629
669
|
return _context19.abrupt("return", _context19.sent);
|
|
@@ -633,7 +673,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
633
673
|
}
|
|
634
674
|
}, _callee19, this);
|
|
635
675
|
}));
|
|
636
|
-
function compute(
|
|
676
|
+
function compute(_x17) {
|
|
637
677
|
return _compute.apply(this, arguments);
|
|
638
678
|
}
|
|
639
679
|
return compute;
|
|
@@ -641,12 +681,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
641
681
|
}, {
|
|
642
682
|
key: "computeLegacy",
|
|
643
683
|
value: function () {
|
|
644
|
-
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(
|
|
684
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref8) {
|
|
645
685
|
var pid, slot, json;
|
|
646
686
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
647
687
|
while (1) switch (_context20.prev = _context20.next) {
|
|
648
688
|
case 0:
|
|
649
|
-
pid =
|
|
689
|
+
pid = _ref8.pid, slot = _ref8.slot;
|
|
650
690
|
_context20.next = 3;
|
|
651
691
|
return this.compute({
|
|
652
692
|
pid: pid,
|
|
@@ -661,7 +701,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
661
701
|
}
|
|
662
702
|
}, _callee20, this);
|
|
663
703
|
}));
|
|
664
|
-
function computeLegacy(
|
|
704
|
+
function computeLegacy(_x18) {
|
|
665
705
|
return _computeLegacy.apply(this, arguments);
|
|
666
706
|
}
|
|
667
707
|
return computeLegacy;
|
|
@@ -673,6 +713,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
673
713
|
var _this$scheduler;
|
|
674
714
|
var tags,
|
|
675
715
|
addr,
|
|
716
|
+
_tags,
|
|
676
717
|
res,
|
|
677
718
|
_args21 = arguments;
|
|
678
719
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
@@ -686,23 +727,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
686
727
|
case 3:
|
|
687
728
|
addr = _context21.sent;
|
|
688
729
|
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
689
|
-
|
|
690
|
-
return this.send((0, _ramda.mergeLeft)(tags, {
|
|
730
|
+
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
691
731
|
device: "process@1.0",
|
|
692
732
|
path: "/schedule",
|
|
693
733
|
scheduler: this.scheduler,
|
|
694
734
|
"random-seed": seed(16),
|
|
695
735
|
Type: "Process",
|
|
696
|
-
"scheduler-device": "scheduler@1.0",
|
|
697
736
|
"execution-device": "test-device@1.0"
|
|
698
|
-
})
|
|
699
|
-
|
|
737
|
+
});
|
|
738
|
+
_context21.next = 8;
|
|
739
|
+
return this.post(_tags);
|
|
740
|
+
case 8:
|
|
700
741
|
res = _context21.sent;
|
|
701
742
|
return _context21.abrupt("return", {
|
|
702
743
|
res: res,
|
|
703
|
-
pid: res.headers.
|
|
744
|
+
pid: res.headers.process
|
|
704
745
|
});
|
|
705
|
-
case
|
|
746
|
+
case 10:
|
|
706
747
|
case "end":
|
|
707
748
|
return _context21.stop();
|
|
708
749
|
}
|
|
@@ -714,66 +755,114 @@ var HB = /*#__PURE__*/function () {
|
|
|
714
755
|
return spawn;
|
|
715
756
|
}()
|
|
716
757
|
}, {
|
|
717
|
-
key: "
|
|
758
|
+
key: "cacheModule2",
|
|
718
759
|
value: function () {
|
|
719
760
|
var _cacheModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data, type) {
|
|
720
|
-
var
|
|
761
|
+
var _yield$this$spawn, pid, _yield$this$schedule, slot, msgs;
|
|
721
762
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
722
763
|
while (1) switch (_context22.prev = _context22.next) {
|
|
723
764
|
case 0:
|
|
724
|
-
|
|
725
|
-
|
|
765
|
+
if (this.cache) {
|
|
766
|
+
_context22.next = 6;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
_context22.next = 3;
|
|
770
|
+
return this.spawn({});
|
|
771
|
+
case 3:
|
|
772
|
+
_yield$this$spawn = _context22.sent;
|
|
773
|
+
pid = _yield$this$spawn.pid;
|
|
774
|
+
this.cache = pid;
|
|
775
|
+
case 6:
|
|
776
|
+
_context22.next = 8;
|
|
777
|
+
return this.schedule({
|
|
778
|
+
data: data,
|
|
779
|
+
pid: this.cache,
|
|
780
|
+
"content-type": type
|
|
781
|
+
});
|
|
782
|
+
case 8:
|
|
783
|
+
_yield$this$schedule = _context22.sent;
|
|
784
|
+
slot = _yield$this$schedule.slot;
|
|
785
|
+
_context22.next = 12;
|
|
786
|
+
return this.messages({
|
|
787
|
+
pid: this.cache,
|
|
788
|
+
from: slot,
|
|
789
|
+
limit: 1
|
|
790
|
+
});
|
|
791
|
+
case 12:
|
|
792
|
+
msgs = _context22.sent;
|
|
793
|
+
return _context22.abrupt("return", msgs.edges[0].node.message.Id);
|
|
794
|
+
case 14:
|
|
795
|
+
case "end":
|
|
796
|
+
return _context22.stop();
|
|
797
|
+
}
|
|
798
|
+
}, _callee22, this);
|
|
799
|
+
}));
|
|
800
|
+
function cacheModule2(_x19, _x20) {
|
|
801
|
+
return _cacheModule.apply(this, arguments);
|
|
802
|
+
}
|
|
803
|
+
return cacheModule2;
|
|
804
|
+
}()
|
|
805
|
+
}, {
|
|
806
|
+
key: "cacheModule",
|
|
807
|
+
value: function () {
|
|
808
|
+
var _cacheModule2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data, type) {
|
|
809
|
+
var res;
|
|
810
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
811
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
812
|
+
case 0:
|
|
813
|
+
_context23.next = 2;
|
|
814
|
+
return this.post({
|
|
726
815
|
path: "/~wao@1.0/cache_module",
|
|
727
816
|
data: data,
|
|
728
817
|
type: type
|
|
729
818
|
});
|
|
730
819
|
case 2:
|
|
731
|
-
res =
|
|
732
|
-
return
|
|
820
|
+
res = _context23.sent;
|
|
821
|
+
return _context23.abrupt("return", res.headers.id);
|
|
733
822
|
case 4:
|
|
734
823
|
case "end":
|
|
735
|
-
return
|
|
824
|
+
return _context23.stop();
|
|
736
825
|
}
|
|
737
|
-
},
|
|
826
|
+
}, _callee23, this);
|
|
738
827
|
}));
|
|
739
|
-
function cacheModule(
|
|
740
|
-
return
|
|
828
|
+
function cacheModule(_x21, _x22) {
|
|
829
|
+
return _cacheModule2.apply(this, arguments);
|
|
741
830
|
}
|
|
742
831
|
return cacheModule;
|
|
743
832
|
}()
|
|
744
833
|
}, {
|
|
745
834
|
key: "message",
|
|
746
835
|
value: function () {
|
|
747
|
-
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
748
|
-
var pid, _yield$this$
|
|
749
|
-
return _regeneratorRuntime().wrap(function
|
|
750
|
-
while (1) switch (
|
|
836
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(args) {
|
|
837
|
+
var pid, _yield$this$schedule2, slot, res;
|
|
838
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
839
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
751
840
|
case 0:
|
|
752
841
|
pid = args.pid;
|
|
753
|
-
|
|
842
|
+
_context24.next = 3;
|
|
754
843
|
return this.schedule(args);
|
|
755
844
|
case 3:
|
|
756
|
-
_yield$this$
|
|
757
|
-
slot = _yield$this$
|
|
758
|
-
|
|
845
|
+
_yield$this$schedule2 = _context24.sent;
|
|
846
|
+
slot = _yield$this$schedule2.slot;
|
|
847
|
+
_context24.next = 7;
|
|
759
848
|
return this.compute({
|
|
760
849
|
pid: pid,
|
|
761
850
|
slot: slot
|
|
762
851
|
});
|
|
763
852
|
case 7:
|
|
764
|
-
res =
|
|
765
|
-
return
|
|
853
|
+
res = _context24.sent;
|
|
854
|
+
return _context24.abrupt("return", {
|
|
766
855
|
slot: slot,
|
|
767
856
|
pid: pid,
|
|
768
857
|
res: res
|
|
769
858
|
});
|
|
770
859
|
case 9:
|
|
771
860
|
case "end":
|
|
772
|
-
return
|
|
861
|
+
return _context24.stop();
|
|
773
862
|
}
|
|
774
|
-
},
|
|
863
|
+
}, _callee24, this);
|
|
775
864
|
}));
|
|
776
|
-
function message(
|
|
865
|
+
function message(_x23) {
|
|
777
866
|
return _message.apply(this, arguments);
|
|
778
867
|
}
|
|
779
868
|
return message;
|
|
@@ -781,22 +870,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
781
870
|
}, {
|
|
782
871
|
key: "scheduleLegacy",
|
|
783
872
|
value: function () {
|
|
784
|
-
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
785
|
-
var
|
|
873
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
874
|
+
var _ref9,
|
|
786
875
|
pid,
|
|
787
|
-
|
|
876
|
+
_ref9$action,
|
|
788
877
|
action,
|
|
789
|
-
|
|
878
|
+
_ref9$tags,
|
|
790
879
|
tags,
|
|
791
880
|
data,
|
|
792
881
|
scheduler,
|
|
793
|
-
|
|
794
|
-
return _regeneratorRuntime().wrap(function
|
|
795
|
-
while (1) switch (
|
|
882
|
+
_args25 = arguments;
|
|
883
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
884
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
796
885
|
case 0:
|
|
797
|
-
|
|
886
|
+
_ref9 = _args25.length > 0 && _args25[0] !== undefined ? _args25[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;
|
|
798
887
|
if (action) tags.Action = action;
|
|
799
|
-
|
|
888
|
+
_context25.next = 4;
|
|
800
889
|
return this.schedule({
|
|
801
890
|
pid: pid,
|
|
802
891
|
tags: tags,
|
|
@@ -804,12 +893,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
804
893
|
scheduler: scheduler
|
|
805
894
|
});
|
|
806
895
|
case 4:
|
|
807
|
-
return
|
|
896
|
+
return _context25.abrupt("return", _context25.sent);
|
|
808
897
|
case 5:
|
|
809
898
|
case "end":
|
|
810
|
-
return
|
|
899
|
+
return _context25.stop();
|
|
811
900
|
}
|
|
812
|
-
},
|
|
901
|
+
}, _callee25, this);
|
|
813
902
|
}));
|
|
814
903
|
function scheduleLegacy() {
|
|
815
904
|
return _scheduleLegacy.apply(this, arguments);
|
|
@@ -819,20 +908,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
819
908
|
}, {
|
|
820
909
|
key: "scheduleLua",
|
|
821
910
|
value: function () {
|
|
822
|
-
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
823
|
-
var
|
|
824
|
-
return _regeneratorRuntime().wrap(function
|
|
825
|
-
while (1) switch (
|
|
911
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
912
|
+
var _args26 = arguments;
|
|
913
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
914
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
826
915
|
case 0:
|
|
827
|
-
|
|
828
|
-
return this.scheduleLegacy.apply(this,
|
|
916
|
+
_context26.next = 2;
|
|
917
|
+
return this.scheduleLegacy.apply(this, _args26);
|
|
829
918
|
case 2:
|
|
830
|
-
return
|
|
919
|
+
return _context26.abrupt("return", _context26.sent);
|
|
831
920
|
case 3:
|
|
832
921
|
case "end":
|
|
833
|
-
return
|
|
922
|
+
return _context26.stop();
|
|
834
923
|
}
|
|
835
|
-
},
|
|
924
|
+
}, _callee26, this);
|
|
836
925
|
}));
|
|
837
926
|
function scheduleLua() {
|
|
838
927
|
return _scheduleLua.apply(this, arguments);
|
|
@@ -842,44 +931,41 @@ var HB = /*#__PURE__*/function () {
|
|
|
842
931
|
}, {
|
|
843
932
|
key: "schedule",
|
|
844
933
|
value: function () {
|
|
845
|
-
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
846
|
-
var _pid2
|
|
847
|
-
var
|
|
934
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
935
|
+
var _pid2;
|
|
936
|
+
var _ref10,
|
|
848
937
|
pid,
|
|
849
|
-
|
|
938
|
+
_ref10$tags,
|
|
850
939
|
tags,
|
|
851
940
|
data,
|
|
852
|
-
scheduler,
|
|
853
941
|
_tags,
|
|
854
942
|
res,
|
|
855
|
-
|
|
856
|
-
return _regeneratorRuntime().wrap(function
|
|
857
|
-
while (1) switch (
|
|
943
|
+
_args27 = arguments;
|
|
944
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
945
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
858
946
|
case 0:
|
|
859
|
-
|
|
947
|
+
_ref10 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, pid = _ref10.pid, _ref10$tags = _ref10.tags, tags = _ref10$tags === void 0 ? {} : _ref10$tags, data = _ref10.data;
|
|
860
948
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
861
|
-
(_scheduler = scheduler) !== null && _scheduler !== void 0 ? _scheduler : scheduler = this.scheduler;
|
|
862
949
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
863
950
|
method: "POST",
|
|
864
|
-
path: "/".concat(pid, "/schedule"),
|
|
865
|
-
scheduler: scheduler,
|
|
951
|
+
path: "/".concat(pid, "~process@1.0/schedule"),
|
|
866
952
|
Type: "Message",
|
|
867
953
|
Target: pid
|
|
868
954
|
});
|
|
869
955
|
if (data) _tags.data = data;
|
|
870
|
-
|
|
871
|
-
return this.
|
|
872
|
-
case
|
|
873
|
-
res =
|
|
874
|
-
return
|
|
875
|
-
slot: res.headers.
|
|
956
|
+
_context27.next = 6;
|
|
957
|
+
return this.post(_tags);
|
|
958
|
+
case 6:
|
|
959
|
+
res = _context27.sent;
|
|
960
|
+
return _context27.abrupt("return", {
|
|
961
|
+
slot: res.headers.slot,
|
|
876
962
|
res: res
|
|
877
963
|
});
|
|
878
|
-
case
|
|
964
|
+
case 8:
|
|
879
965
|
case "end":
|
|
880
|
-
return
|
|
966
|
+
return _context27.stop();
|
|
881
967
|
}
|
|
882
|
-
},
|
|
968
|
+
}, _callee27, this);
|
|
883
969
|
}));
|
|
884
970
|
function schedule() {
|
|
885
971
|
return _schedule.apply(this, arguments);
|
|
@@ -889,44 +975,44 @@ var HB = /*#__PURE__*/function () {
|
|
|
889
975
|
}, {
|
|
890
976
|
key: "spawnAOS",
|
|
891
977
|
value: function () {
|
|
892
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
978
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(image) {
|
|
893
979
|
var _this$scheduler2, _image, _this$image2, _this$pid;
|
|
894
980
|
var addr, res, pid;
|
|
895
|
-
return _regeneratorRuntime().wrap(function
|
|
896
|
-
while (1) switch (
|
|
981
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
982
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
897
983
|
case 0:
|
|
898
|
-
|
|
984
|
+
_context28.next = 2;
|
|
899
985
|
return this.dev.meta.info({
|
|
900
986
|
key: "address"
|
|
901
987
|
});
|
|
902
988
|
case 2:
|
|
903
|
-
addr =
|
|
989
|
+
addr = _context28.sent;
|
|
904
990
|
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
905
991
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
906
|
-
|
|
992
|
+
_context28.next = 8;
|
|
907
993
|
break;
|
|
908
994
|
}
|
|
909
995
|
_image;
|
|
910
|
-
|
|
996
|
+
_context28.next = 16;
|
|
911
997
|
break;
|
|
912
998
|
case 8:
|
|
913
999
|
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
914
|
-
|
|
1000
|
+
_context28.next = 12;
|
|
915
1001
|
break;
|
|
916
1002
|
}
|
|
917
|
-
|
|
918
|
-
|
|
1003
|
+
_context28.t0 = _this$image2;
|
|
1004
|
+
_context28.next = 15;
|
|
919
1005
|
break;
|
|
920
1006
|
case 12:
|
|
921
|
-
|
|
1007
|
+
_context28.next = 14;
|
|
922
1008
|
return this.getImage();
|
|
923
1009
|
case 14:
|
|
924
|
-
|
|
1010
|
+
_context28.t0 = _context28.sent;
|
|
925
1011
|
case 15:
|
|
926
|
-
image =
|
|
1012
|
+
image = _context28.t0;
|
|
927
1013
|
case 16:
|
|
928
|
-
|
|
929
|
-
return this.
|
|
1014
|
+
_context28.next = 18;
|
|
1015
|
+
return this.post({
|
|
930
1016
|
device: "process@1.0",
|
|
931
1017
|
path: "/schedule",
|
|
932
1018
|
scheduler: this.scheduler,
|
|
@@ -937,7 +1023,6 @@ var HB = /*#__PURE__*/function () {
|
|
|
937
1023
|
"random-seed": seed(16),
|
|
938
1024
|
Type: "Process",
|
|
939
1025
|
image: image,
|
|
940
|
-
"scheduler-device": "scheduler@1.0",
|
|
941
1026
|
"execution-device": "stack@1.0",
|
|
942
1027
|
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "multipass@1.0"],
|
|
943
1028
|
"output-prefix": "wasm",
|
|
@@ -946,20 +1031,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
946
1031
|
passes: 2
|
|
947
1032
|
});
|
|
948
1033
|
case 18:
|
|
949
|
-
res =
|
|
950
|
-
pid = res.headers.
|
|
1034
|
+
res = _context28.sent;
|
|
1035
|
+
pid = res.headers.process;
|
|
951
1036
|
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
952
|
-
return
|
|
1037
|
+
return _context28.abrupt("return", {
|
|
953
1038
|
pid: pid,
|
|
954
1039
|
res: res
|
|
955
1040
|
});
|
|
956
1041
|
case 22:
|
|
957
1042
|
case "end":
|
|
958
|
-
return
|
|
1043
|
+
return _context28.stop();
|
|
959
1044
|
}
|
|
960
|
-
},
|
|
1045
|
+
}, _callee28, this);
|
|
961
1046
|
}));
|
|
962
|
-
function spawnAOS(
|
|
1047
|
+
function spawnAOS(_x24) {
|
|
963
1048
|
return _spawnAOS.apply(this, arguments);
|
|
964
1049
|
}
|
|
965
1050
|
return spawnAOS;
|
|
@@ -967,44 +1052,44 @@ var HB = /*#__PURE__*/function () {
|
|
|
967
1052
|
}, {
|
|
968
1053
|
key: "spawnLua",
|
|
969
1054
|
value: function () {
|
|
970
|
-
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1055
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(lua) {
|
|
971
1056
|
var _this$scheduler3, _lua, _this$lua2, _this$pid2;
|
|
972
1057
|
var addr, res, pid;
|
|
973
|
-
return _regeneratorRuntime().wrap(function
|
|
974
|
-
while (1) switch (
|
|
1058
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1059
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
975
1060
|
case 0:
|
|
976
|
-
|
|
1061
|
+
_context29.next = 2;
|
|
977
1062
|
return this.dev.meta.info({
|
|
978
1063
|
key: "address"
|
|
979
1064
|
});
|
|
980
1065
|
case 2:
|
|
981
|
-
addr =
|
|
1066
|
+
addr = _context29.sent;
|
|
982
1067
|
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
983
1068
|
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
984
|
-
|
|
1069
|
+
_context29.next = 8;
|
|
985
1070
|
break;
|
|
986
1071
|
}
|
|
987
1072
|
_lua;
|
|
988
|
-
|
|
1073
|
+
_context29.next = 16;
|
|
989
1074
|
break;
|
|
990
1075
|
case 8:
|
|
991
1076
|
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
992
|
-
|
|
1077
|
+
_context29.next = 12;
|
|
993
1078
|
break;
|
|
994
1079
|
}
|
|
995
|
-
|
|
996
|
-
|
|
1080
|
+
_context29.t0 = _this$lua2;
|
|
1081
|
+
_context29.next = 15;
|
|
997
1082
|
break;
|
|
998
1083
|
case 12:
|
|
999
|
-
|
|
1084
|
+
_context29.next = 14;
|
|
1000
1085
|
return this.getLua();
|
|
1001
1086
|
case 14:
|
|
1002
|
-
|
|
1087
|
+
_context29.t0 = _context29.sent;
|
|
1003
1088
|
case 15:
|
|
1004
|
-
lua =
|
|
1089
|
+
lua = _context29.t0;
|
|
1005
1090
|
case 16:
|
|
1006
|
-
|
|
1007
|
-
return this.
|
|
1091
|
+
_context29.next = 18;
|
|
1092
|
+
return this.post({
|
|
1008
1093
|
device: "process@1.0",
|
|
1009
1094
|
path: "/schedule",
|
|
1010
1095
|
scheduler: this.scheduler,
|
|
@@ -1015,25 +1100,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
1015
1100
|
"random-seed": seed(16),
|
|
1016
1101
|
Type: "Process",
|
|
1017
1102
|
module: lua,
|
|
1018
|
-
"scheduler-device": "scheduler@1.0",
|
|
1019
1103
|
"execution-device": "lua@5.3a",
|
|
1020
1104
|
"patch-from": "/results/outbox"
|
|
1021
1105
|
});
|
|
1022
1106
|
case 18:
|
|
1023
|
-
res =
|
|
1024
|
-
pid = res.headers.
|
|
1107
|
+
res = _context29.sent;
|
|
1108
|
+
pid = res.headers.process;
|
|
1025
1109
|
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
1026
|
-
return
|
|
1110
|
+
return _context29.abrupt("return", {
|
|
1027
1111
|
pid: pid,
|
|
1028
1112
|
res: res
|
|
1029
1113
|
});
|
|
1030
1114
|
case 22:
|
|
1031
1115
|
case "end":
|
|
1032
|
-
return
|
|
1116
|
+
return _context29.stop();
|
|
1033
1117
|
}
|
|
1034
|
-
},
|
|
1118
|
+
}, _callee29, this);
|
|
1035
1119
|
}));
|
|
1036
|
-
function spawnLua(
|
|
1120
|
+
function spawnLua(_x25) {
|
|
1037
1121
|
return _spawnLua.apply(this, arguments);
|
|
1038
1122
|
}
|
|
1039
1123
|
return spawnLua;
|
|
@@ -1120,41 +1204,68 @@ var HB = /*#__PURE__*/function () {
|
|
|
1120
1204
|
}
|
|
1121
1205
|
return _metrics;
|
|
1122
1206
|
}
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "now",
|
|
1209
|
+
value: function () {
|
|
1210
|
+
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(_ref11) {
|
|
1211
|
+
var pid, _ref11$path, path;
|
|
1212
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1213
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1214
|
+
case 0:
|
|
1215
|
+
pid = _ref11.pid, _ref11$path = _ref11.path, path = _ref11$path === void 0 ? "" : _ref11$path;
|
|
1216
|
+
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1217
|
+
_context30.next = 4;
|
|
1218
|
+
return this.getJSON({
|
|
1219
|
+
path: "/".concat(pid, "~process@1.0/now").concat(path)
|
|
1220
|
+
});
|
|
1221
|
+
case 4:
|
|
1222
|
+
return _context30.abrupt("return", _context30.sent);
|
|
1223
|
+
case 5:
|
|
1224
|
+
case "end":
|
|
1225
|
+
return _context30.stop();
|
|
1226
|
+
}
|
|
1227
|
+
}, _callee30, this);
|
|
1228
|
+
}));
|
|
1229
|
+
function now(_x26) {
|
|
1230
|
+
return _now.apply(this, arguments);
|
|
1231
|
+
}
|
|
1232
|
+
return now;
|
|
1233
|
+
}()
|
|
1123
1234
|
}, {
|
|
1124
1235
|
key: "messages",
|
|
1125
1236
|
value: function () {
|
|
1126
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1237
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1127
1238
|
var _this2 = this;
|
|
1128
|
-
var
|
|
1239
|
+
var _ref12,
|
|
1129
1240
|
pid,
|
|
1130
1241
|
from,
|
|
1131
1242
|
to,
|
|
1132
1243
|
limit,
|
|
1133
1244
|
params,
|
|
1134
1245
|
res,
|
|
1135
|
-
|
|
1136
|
-
return _regeneratorRuntime().wrap(function
|
|
1137
|
-
while (1) switch (
|
|
1246
|
+
_args32 = arguments;
|
|
1247
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1248
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1138
1249
|
case 0:
|
|
1139
|
-
|
|
1250
|
+
_ref12 = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {}, pid = _ref12.pid, from = _ref12.from, to = _ref12.to, limit = _ref12.limit;
|
|
1140
1251
|
params = "target=".concat(pid);
|
|
1141
1252
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1142
1253
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1143
1254
|
params += "&accept=application/aos-2";
|
|
1144
|
-
|
|
1255
|
+
_context32.next = 7;
|
|
1145
1256
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1146
1257
|
return r.json();
|
|
1147
1258
|
});
|
|
1148
1259
|
case 7:
|
|
1149
|
-
res =
|
|
1260
|
+
res = _context32.sent;
|
|
1150
1261
|
if (res.page_info.has_next_page) {
|
|
1151
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1262
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1152
1263
|
var from2;
|
|
1153
|
-
return _regeneratorRuntime().wrap(function
|
|
1154
|
-
while (1) switch (
|
|
1264
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1265
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1155
1266
|
case 0:
|
|
1156
1267
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1157
|
-
|
|
1268
|
+
_context31.next = 3;
|
|
1158
1269
|
return _this2.message({
|
|
1159
1270
|
pid: pid,
|
|
1160
1271
|
from: from2,
|
|
@@ -1162,20 +1273,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1162
1273
|
limit: limit
|
|
1163
1274
|
});
|
|
1164
1275
|
case 3:
|
|
1165
|
-
return
|
|
1276
|
+
return _context31.abrupt("return", _context31.sent);
|
|
1166
1277
|
case 4:
|
|
1167
1278
|
case "end":
|
|
1168
|
-
return
|
|
1279
|
+
return _context31.stop();
|
|
1169
1280
|
}
|
|
1170
|
-
},
|
|
1281
|
+
}, _callee31);
|
|
1171
1282
|
}));
|
|
1172
1283
|
}
|
|
1173
|
-
return
|
|
1284
|
+
return _context32.abrupt("return", res);
|
|
1174
1285
|
case 10:
|
|
1175
1286
|
case "end":
|
|
1176
|
-
return
|
|
1287
|
+
return _context32.stop();
|
|
1177
1288
|
}
|
|
1178
|
-
},
|
|
1289
|
+
}, _callee32, this);
|
|
1179
1290
|
}));
|
|
1180
1291
|
function messages() {
|
|
1181
1292
|
return _messages.apply(this, arguments);
|
|
@@ -1185,17 +1296,17 @@ var HB = /*#__PURE__*/function () {
|
|
|
1185
1296
|
}, {
|
|
1186
1297
|
key: "spawnLegacy",
|
|
1187
1298
|
value: function () {
|
|
1188
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1189
|
-
var
|
|
1299
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
1300
|
+
var _ref14,
|
|
1190
1301
|
module,
|
|
1191
|
-
|
|
1302
|
+
_ref14$tags,
|
|
1192
1303
|
tags,
|
|
1193
1304
|
data,
|
|
1194
|
-
|
|
1195
|
-
return _regeneratorRuntime().wrap(function
|
|
1196
|
-
while (1) switch (
|
|
1305
|
+
_args33 = arguments;
|
|
1306
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1307
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1197
1308
|
case 0:
|
|
1198
|
-
|
|
1309
|
+
_ref14 = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {}, module = _ref14.module, _ref14$tags = _ref14.tags, tags = _ref14$tags === void 0 ? {} : _ref14$tags, data = _ref14.data;
|
|
1199
1310
|
tags = (0, _ramda.mergeLeft)(tags, {
|
|
1200
1311
|
data: data,
|
|
1201
1312
|
Type: "Process",
|
|
@@ -1210,15 +1321,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1210
1321
|
"scheduler-device": "scheduler@1.0",
|
|
1211
1322
|
"execution-device": "genesis-wasm@1.0"
|
|
1212
1323
|
});
|
|
1213
|
-
|
|
1324
|
+
_context33.next = 4;
|
|
1214
1325
|
return this.spawn(tags);
|
|
1215
1326
|
case 4:
|
|
1216
|
-
return
|
|
1327
|
+
return _context33.abrupt("return", _context33.sent);
|
|
1217
1328
|
case 5:
|
|
1218
1329
|
case "end":
|
|
1219
|
-
return
|
|
1330
|
+
return _context33.stop();
|
|
1220
1331
|
}
|
|
1221
|
-
},
|
|
1332
|
+
}, _callee33, this);
|
|
1222
1333
|
}));
|
|
1223
1334
|
function spawnLegacy() {
|
|
1224
1335
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1228,27 +1339,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1228
1339
|
}, {
|
|
1229
1340
|
key: "dryrun",
|
|
1230
1341
|
value: function () {
|
|
1231
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1232
|
-
var
|
|
1233
|
-
|
|
1342
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1343
|
+
var _ref15,
|
|
1344
|
+
_ref15$tags,
|
|
1234
1345
|
tags,
|
|
1235
1346
|
pid,
|
|
1236
1347
|
action,
|
|
1237
1348
|
data,
|
|
1238
1349
|
json,
|
|
1239
1350
|
res,
|
|
1240
|
-
|
|
1241
|
-
return _regeneratorRuntime().wrap(function
|
|
1242
|
-
while (1) switch (
|
|
1351
|
+
_args34 = arguments;
|
|
1352
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1353
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1243
1354
|
case 0:
|
|
1244
|
-
|
|
1355
|
+
_ref15 = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {}, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, pid = _ref15.pid, action = _ref15.action, data = _ref15.data;
|
|
1245
1356
|
if (typeof action === "string") tags.Action = action;
|
|
1246
1357
|
json = {
|
|
1247
1358
|
Tags: (0, _utils.buildTags)(tags)
|
|
1248
1359
|
};
|
|
1249
1360
|
if (data) json.Data = data;
|
|
1250
|
-
|
|
1251
|
-
return this.
|
|
1361
|
+
_context34.next = 6;
|
|
1362
|
+
return this.post({
|
|
1252
1363
|
path: "/~relay@1.0/call",
|
|
1253
1364
|
"relay-method": "POST",
|
|
1254
1365
|
"relay-path": "/dry-run?process-id=".concat(pid),
|
|
@@ -1256,104 +1367,159 @@ var HB = /*#__PURE__*/function () {
|
|
|
1256
1367
|
body: JSON.stringify(json)
|
|
1257
1368
|
});
|
|
1258
1369
|
case 6:
|
|
1259
|
-
res =
|
|
1260
|
-
return
|
|
1370
|
+
res = _context34.sent;
|
|
1371
|
+
return _context34.abrupt("return", JSON.parse(res.body));
|
|
1261
1372
|
case 8:
|
|
1262
1373
|
case "end":
|
|
1263
|
-
return
|
|
1374
|
+
return _context34.stop();
|
|
1264
1375
|
}
|
|
1265
|
-
},
|
|
1376
|
+
}, _callee34, this);
|
|
1266
1377
|
}));
|
|
1267
1378
|
function dryrun() {
|
|
1268
1379
|
return _dryrun.apply(this, arguments);
|
|
1269
1380
|
}
|
|
1270
1381
|
return dryrun;
|
|
1271
1382
|
}()
|
|
1383
|
+
}, {
|
|
1384
|
+
key: "post",
|
|
1385
|
+
value: function () {
|
|
1386
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(obj, json) {
|
|
1387
|
+
var _json;
|
|
1388
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1389
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1390
|
+
case 0:
|
|
1391
|
+
_json = json ? "/~json@1.0/serialize" : "";
|
|
1392
|
+
obj.path += _json;
|
|
1393
|
+
_context35.t0 = this;
|
|
1394
|
+
_context35.next = 5;
|
|
1395
|
+
return this.sign(obj);
|
|
1396
|
+
case 5:
|
|
1397
|
+
_context35.t1 = _context35.sent;
|
|
1398
|
+
_context35.next = 8;
|
|
1399
|
+
return _context35.t0.send.call(_context35.t0, _context35.t1);
|
|
1400
|
+
case 8:
|
|
1401
|
+
return _context35.abrupt("return", _context35.sent);
|
|
1402
|
+
case 9:
|
|
1403
|
+
case "end":
|
|
1404
|
+
return _context35.stop();
|
|
1405
|
+
}
|
|
1406
|
+
}, _callee35, this);
|
|
1407
|
+
}));
|
|
1408
|
+
function post(_x27, _x28) {
|
|
1409
|
+
return _post.apply(this, arguments);
|
|
1410
|
+
}
|
|
1411
|
+
return post;
|
|
1412
|
+
}()
|
|
1272
1413
|
}, {
|
|
1273
1414
|
key: "get",
|
|
1274
1415
|
value: function () {
|
|
1275
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1416
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(_ref16) {
|
|
1417
|
+
var _path3;
|
|
1418
|
+
var path,
|
|
1419
|
+
params,
|
|
1420
|
+
json,
|
|
1421
|
+
_json,
|
|
1422
|
+
_params,
|
|
1423
|
+
i,
|
|
1424
|
+
k,
|
|
1425
|
+
response,
|
|
1426
|
+
headers,
|
|
1427
|
+
_args36 = arguments;
|
|
1428
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1429
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1279
1430
|
case 0:
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1431
|
+
path = _ref16.path, params = _objectWithoutProperties(_ref16, _excluded);
|
|
1432
|
+
json = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : false;
|
|
1433
|
+
_json = json ? "/~json@1.0/serialize" : "";
|
|
1434
|
+
(_path3 = path) !== null && _path3 !== void 0 ? _path3 : path = "/~message@1.0";
|
|
1435
|
+
if (!/^\//.test(path)) path = "/" + path;
|
|
1436
|
+
_params = "";
|
|
1437
|
+
if (!(0, _ramda.isEmpty)(params)) {
|
|
1438
|
+
i = 0;
|
|
1439
|
+
for (k in params) {
|
|
1440
|
+
_params += "".concat(i === 0 ? "?" : "&").concat(k, "=").concat(params[k]);
|
|
1441
|
+
i++;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
_context36.next = 9;
|
|
1445
|
+
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1446
|
+
case 9:
|
|
1447
|
+
response = _context36.sent;
|
|
1448
|
+
headers = {};
|
|
1449
|
+
response.headers.forEach(function (v, k) {
|
|
1450
|
+
return headers[k] = v;
|
|
1286
1451
|
});
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1452
|
+
_context36.t0 = response;
|
|
1453
|
+
_context36.t1 = headers;
|
|
1454
|
+
_context36.next = 16;
|
|
1455
|
+
return response.text();
|
|
1456
|
+
case 16:
|
|
1457
|
+
_context36.t2 = _context36.sent;
|
|
1458
|
+
_context36.t3 = response.status;
|
|
1459
|
+
return _context36.abrupt("return", {
|
|
1460
|
+
response: _context36.t0,
|
|
1461
|
+
headers: _context36.t1,
|
|
1462
|
+
body: _context36.t2,
|
|
1463
|
+
status: _context36.t3
|
|
1464
|
+
});
|
|
1465
|
+
case 19:
|
|
1290
1466
|
case "end":
|
|
1291
|
-
return
|
|
1467
|
+
return _context36.stop();
|
|
1292
1468
|
}
|
|
1293
|
-
},
|
|
1469
|
+
}, _callee36, this);
|
|
1294
1470
|
}));
|
|
1295
|
-
function get(
|
|
1471
|
+
function get(_x29) {
|
|
1296
1472
|
return _get.apply(this, arguments);
|
|
1297
1473
|
}
|
|
1298
1474
|
return get;
|
|
1299
1475
|
}()
|
|
1300
1476
|
}, {
|
|
1301
|
-
key: "
|
|
1477
|
+
key: "postJSON",
|
|
1302
1478
|
value: function () {
|
|
1303
|
-
var
|
|
1304
|
-
var
|
|
1305
|
-
return _regeneratorRuntime().wrap(function
|
|
1306
|
-
while (1) switch (
|
|
1479
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(args) {
|
|
1480
|
+
var res;
|
|
1481
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1482
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1307
1483
|
case 0:
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
path: path,
|
|
1314
|
-
method: "POST"
|
|
1315
|
-
});
|
|
1316
|
-
case 3:
|
|
1317
|
-
return _context34.abrupt("return", _context34.sent);
|
|
1484
|
+
_context37.next = 2;
|
|
1485
|
+
return this.post(args, true);
|
|
1486
|
+
case 2:
|
|
1487
|
+
res = _context37.sent;
|
|
1488
|
+
return _context37.abrupt("return", JSON.parse(res.body));
|
|
1318
1489
|
case 4:
|
|
1319
1490
|
case "end":
|
|
1320
|
-
return
|
|
1491
|
+
return _context37.stop();
|
|
1321
1492
|
}
|
|
1322
|
-
},
|
|
1493
|
+
}, _callee37, this);
|
|
1323
1494
|
}));
|
|
1324
|
-
function
|
|
1325
|
-
return
|
|
1495
|
+
function postJSON(_x30) {
|
|
1496
|
+
return _postJSON.apply(this, arguments);
|
|
1326
1497
|
}
|
|
1327
|
-
return
|
|
1498
|
+
return postJSON;
|
|
1328
1499
|
}()
|
|
1329
1500
|
}, {
|
|
1330
|
-
key: "
|
|
1501
|
+
key: "getJSON",
|
|
1331
1502
|
value: function () {
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
1334
|
-
return _regeneratorRuntime().wrap(function
|
|
1335
|
-
while (1) switch (
|
|
1503
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(args) {
|
|
1504
|
+
var res;
|
|
1505
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1506
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1336
1507
|
case 0:
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
_context35.next = 5;
|
|
1344
|
-
return this._request(_tags);
|
|
1345
|
-
case 5:
|
|
1346
|
-
return _context35.abrupt("return", _context35.sent);
|
|
1347
|
-
case 6:
|
|
1508
|
+
_context38.next = 2;
|
|
1509
|
+
return this.get(args, true);
|
|
1510
|
+
case 2:
|
|
1511
|
+
res = _context38.sent;
|
|
1512
|
+
return _context38.abrupt("return", JSON.parse(res.body));
|
|
1513
|
+
case 4:
|
|
1348
1514
|
case "end":
|
|
1349
|
-
return
|
|
1515
|
+
return _context38.stop();
|
|
1350
1516
|
}
|
|
1351
|
-
},
|
|
1517
|
+
}, _callee38, this);
|
|
1352
1518
|
}));
|
|
1353
|
-
function
|
|
1354
|
-
return
|
|
1519
|
+
function getJSON(_x31) {
|
|
1520
|
+
return _getJSON.apply(this, arguments);
|
|
1355
1521
|
}
|
|
1356
|
-
return
|
|
1522
|
+
return getJSON;
|
|
1357
1523
|
}()
|
|
1358
1524
|
}]);
|
|
1359
1525
|
}();
|