wao 0.30.2 → 0.31.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/hb.js +568 -866
- package/cjs/hyperbeam.js +94 -44
- package/cjs/workspace/package.json +5 -3
- package/cjs/workspace/test/hyperbeam.test.js +18 -0
- package/esm/hb.js +58 -159
- package/esm/hyperbeam.js +42 -19
- package/esm/workspace/package.json +5 -3
- package/esm/workspace/test/hyperbeam.test.js +18 -0
- package/package.json +2 -1
- package/cjs/workspace/test/hyperbeam.js +0 -30
- package/esm/workspace/test/hyperbeam.js +0 -30
- /package/cjs/workspace/test/{test.js → web.test.js} +0 -0
- /package/esm/workspace/test/{test.js → web.test.js} +0 -0
package/cjs/hb.js
CHANGED
|
@@ -16,21 +16,12 @@ var _excluded = ["path"],
|
|
|
16
16
|
_excluded2 = ["path"];
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
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); }
|
|
19
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
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; } }
|
|
21
|
-
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
22
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
24
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
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; } } }; }
|
|
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; } }
|
|
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; }
|
|
30
19
|
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; }
|
|
31
20
|
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; }
|
|
32
21
|
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; }
|
|
33
22
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
34
25
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
35
26
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
36
27
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -45,7 +36,6 @@ var seed = function seed(num) {
|
|
|
45
36
|
};
|
|
46
37
|
var HB = /*#__PURE__*/function () {
|
|
47
38
|
function HB() {
|
|
48
|
-
var _this = this;
|
|
49
39
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
50
40
|
_ref$url = _ref.url,
|
|
51
41
|
url = _ref$url === void 0 ? "http://localhost:10001" : _ref$url,
|
|
@@ -55,228 +45,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
55
45
|
_classCallCheck(this, HB);
|
|
56
46
|
this.cu = cu;
|
|
57
47
|
this.url = url;
|
|
58
|
-
this.dev = {};
|
|
59
|
-
this.dev.hyperbuddy = {
|
|
60
|
-
metrics: function () {
|
|
61
|
-
var _metrics2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
62
|
-
var args,
|
|
63
|
-
_args = arguments;
|
|
64
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
|
-
while (1) switch (_context.prev = _context.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
args = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
68
|
-
_context.t0 = _this;
|
|
69
|
-
_context.next = 4;
|
|
70
|
-
return _this.fetch(_this.path({
|
|
71
|
-
dev: "hyperbuddy",
|
|
72
|
-
path: "metrics",
|
|
73
|
-
json: false
|
|
74
|
-
}), false);
|
|
75
|
-
case 4:
|
|
76
|
-
_context.t1 = _context.sent;
|
|
77
|
-
return _context.abrupt("return", _context.t0.parseMetrics.call(_context.t0, _context.t1));
|
|
78
|
-
case 6:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context.stop();
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}));
|
|
84
|
-
function metrics() {
|
|
85
|
-
return _metrics2.apply(this, arguments);
|
|
86
|
-
}
|
|
87
|
-
return metrics;
|
|
88
|
-
}()
|
|
89
|
-
};
|
|
90
|
-
this.dev.json = {
|
|
91
|
-
commit: function () {
|
|
92
|
-
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args) {
|
|
93
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
_context2.next = 2;
|
|
97
|
-
return _this.post(_objectSpread({
|
|
98
|
-
path: "/~json@1.0/commit"
|
|
99
|
-
}, args));
|
|
100
|
-
case 2:
|
|
101
|
-
return _context2.abrupt("return", _context2.sent);
|
|
102
|
-
case 3:
|
|
103
|
-
case "end":
|
|
104
|
-
return _context2.stop();
|
|
105
|
-
}
|
|
106
|
-
}, _callee2);
|
|
107
|
-
}));
|
|
108
|
-
function commit(_x2) {
|
|
109
|
-
return _commit.apply(this, arguments);
|
|
110
|
-
}
|
|
111
|
-
return commit;
|
|
112
|
-
}(),
|
|
113
|
-
verify: function () {
|
|
114
|
-
var _verify = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(args) {
|
|
115
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
116
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
117
|
-
case 0:
|
|
118
|
-
_context3.next = 2;
|
|
119
|
-
return _this.post(_objectSpread({
|
|
120
|
-
path: "/~json@1.0/verify"
|
|
121
|
-
}, args));
|
|
122
|
-
case 2:
|
|
123
|
-
return _context3.abrupt("return", _context3.sent);
|
|
124
|
-
case 3:
|
|
125
|
-
case "end":
|
|
126
|
-
return _context3.stop();
|
|
127
|
-
}
|
|
128
|
-
}, _callee3);
|
|
129
|
-
}));
|
|
130
|
-
function verify(_x3) {
|
|
131
|
-
return _verify.apply(this, arguments);
|
|
132
|
-
}
|
|
133
|
-
return verify;
|
|
134
|
-
}(),
|
|
135
|
-
deserialize: function () {
|
|
136
|
-
var _deserialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(args) {
|
|
137
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
138
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
139
|
-
case 0:
|
|
140
|
-
_context4.next = 2;
|
|
141
|
-
return _this.post(_objectSpread({
|
|
142
|
-
path: "/~json@1.0/deserialize"
|
|
143
|
-
}, args));
|
|
144
|
-
case 2:
|
|
145
|
-
return _context4.abrupt("return", _context4.sent);
|
|
146
|
-
case 3:
|
|
147
|
-
case "end":
|
|
148
|
-
return _context4.stop();
|
|
149
|
-
}
|
|
150
|
-
}, _callee4);
|
|
151
|
-
}));
|
|
152
|
-
function deserialize(_x4) {
|
|
153
|
-
return _deserialize.apply(this, arguments);
|
|
154
|
-
}
|
|
155
|
-
return deserialize;
|
|
156
|
-
}(),
|
|
157
|
-
serialize: function () {
|
|
158
|
-
var _serialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(args) {
|
|
159
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
160
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
161
|
-
case 0:
|
|
162
|
-
_context5.next = 2;
|
|
163
|
-
return _this.post(_objectSpread({
|
|
164
|
-
path: "/~json@1.0/serialize"
|
|
165
|
-
}, args));
|
|
166
|
-
case 2:
|
|
167
|
-
return _context5.abrupt("return", _context5.sent);
|
|
168
|
-
case 3:
|
|
169
|
-
case "end":
|
|
170
|
-
return _context5.stop();
|
|
171
|
-
}
|
|
172
|
-
}, _callee5);
|
|
173
|
-
}));
|
|
174
|
-
function serialize(_x5) {
|
|
175
|
-
return _serialize.apply(this, arguments);
|
|
176
|
-
}
|
|
177
|
-
return serialize;
|
|
178
|
-
}()
|
|
179
|
-
};
|
|
180
|
-
this.dev.meta = {
|
|
181
|
-
info: function () {
|
|
182
|
-
var _info = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
183
|
-
var args,
|
|
184
|
-
_args$method,
|
|
185
|
-
method,
|
|
186
|
-
_args$json,
|
|
187
|
-
json,
|
|
188
|
-
key,
|
|
189
|
-
_args$json2,
|
|
190
|
-
_args$json3,
|
|
191
|
-
_args6 = arguments;
|
|
192
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
193
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
194
|
-
case 0:
|
|
195
|
-
args = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
196
|
-
_args$method = args.method, method = _args$method === void 0 ? "GET" : _args$method, _args$json = args.json, json = _args$json === void 0 ? true : _args$json, key = args.key;
|
|
197
|
-
if (!(method.toLowerCase() === "post")) {
|
|
198
|
-
_context6.next = 8;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
_context6.next = 5;
|
|
202
|
-
return _this.post(_objectSpread({
|
|
203
|
-
path: "/~meta@1.0/info"
|
|
204
|
-
}, args));
|
|
205
|
-
case 5:
|
|
206
|
-
return _context6.abrupt("return", _context6.sent);
|
|
207
|
-
case 8:
|
|
208
|
-
if (!key) {
|
|
209
|
-
_context6.next = 14;
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
_context6.next = 11;
|
|
213
|
-
return _this.fetch(_this.path({
|
|
214
|
-
dev: "meta",
|
|
215
|
-
path: "info/".concat(key),
|
|
216
|
-
json: (_args$json2 = args.json) !== null && _args$json2 !== void 0 ? _args$json2 : false
|
|
217
|
-
}), (_args$json3 = args.json) !== null && _args$json3 !== void 0 ? _args$json3 : false);
|
|
218
|
-
case 11:
|
|
219
|
-
_context6.t0 = _context6.sent;
|
|
220
|
-
_context6.next = 17;
|
|
221
|
-
break;
|
|
222
|
-
case 14:
|
|
223
|
-
_context6.next = 16;
|
|
224
|
-
return _this.fetch(_this.path({
|
|
225
|
-
dev: "meta",
|
|
226
|
-
path: "info",
|
|
227
|
-
json: json
|
|
228
|
-
}));
|
|
229
|
-
case 16:
|
|
230
|
-
_context6.t0 = _context6.sent;
|
|
231
|
-
case 17:
|
|
232
|
-
return _context6.abrupt("return", _context6.t0);
|
|
233
|
-
case 18:
|
|
234
|
-
case "end":
|
|
235
|
-
return _context6.stop();
|
|
236
|
-
}
|
|
237
|
-
}, _callee6);
|
|
238
|
-
}));
|
|
239
|
-
function info() {
|
|
240
|
-
return _info.apply(this, arguments);
|
|
241
|
-
}
|
|
242
|
-
return info;
|
|
243
|
-
}(),
|
|
244
|
-
build: function () {
|
|
245
|
-
var _build = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
246
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
247
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
248
|
-
case 0:
|
|
249
|
-
_context7.next = 2;
|
|
250
|
-
return _this.fetch(_this.path({
|
|
251
|
-
dev: "meta",
|
|
252
|
-
path: "build"
|
|
253
|
-
}));
|
|
254
|
-
case 2:
|
|
255
|
-
return _context7.abrupt("return", _context7.sent);
|
|
256
|
-
case 3:
|
|
257
|
-
case "end":
|
|
258
|
-
return _context7.stop();
|
|
259
|
-
}
|
|
260
|
-
}, _callee7);
|
|
261
|
-
}));
|
|
262
|
-
function build() {
|
|
263
|
-
return _build.apply(this, arguments);
|
|
264
|
-
}
|
|
265
|
-
return build;
|
|
266
|
-
}()
|
|
267
|
-
};
|
|
268
48
|
if (jwk) this._init(jwk);
|
|
269
49
|
}
|
|
270
50
|
return _createClass(HB, [{
|
|
271
51
|
key: "signEncoded",
|
|
272
52
|
value: function () {
|
|
273
|
-
var _signEncoded = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
53
|
+
var _signEncoded = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(encoded) {
|
|
274
54
|
var path, msg;
|
|
275
|
-
return _regeneratorRuntime().wrap(function
|
|
276
|
-
while (1) switch (
|
|
55
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
56
|
+
while (1) switch (_context.prev = _context.next) {
|
|
277
57
|
case 0:
|
|
278
58
|
path = encoded.path, msg = _objectWithoutProperties(encoded, _excluded);
|
|
279
|
-
|
|
59
|
+
_context.next = 3;
|
|
280
60
|
return (0, _signer.sign)({
|
|
281
61
|
jwk: this.jwk,
|
|
282
62
|
msg: msg,
|
|
@@ -284,14 +64,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
284
64
|
url: this.url
|
|
285
65
|
});
|
|
286
66
|
case 3:
|
|
287
|
-
return
|
|
67
|
+
return _context.abrupt("return", _context.sent);
|
|
288
68
|
case 4:
|
|
289
69
|
case "end":
|
|
290
|
-
return
|
|
70
|
+
return _context.stop();
|
|
291
71
|
}
|
|
292
|
-
},
|
|
72
|
+
}, _callee, this);
|
|
293
73
|
}));
|
|
294
|
-
function signEncoded(
|
|
74
|
+
function signEncoded(_x) {
|
|
295
75
|
return _signEncoded.apply(this, arguments);
|
|
296
76
|
}
|
|
297
77
|
return signEncoded;
|
|
@@ -316,32 +96,56 @@ var HB = /*#__PURE__*/function () {
|
|
|
316
96
|
this._request = request;
|
|
317
97
|
}
|
|
318
98
|
}, {
|
|
319
|
-
key: "
|
|
99
|
+
key: "setInfo",
|
|
320
100
|
value: function () {
|
|
321
|
-
var
|
|
322
|
-
return _regeneratorRuntime().wrap(function
|
|
323
|
-
while (1) switch (
|
|
101
|
+
var _setInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
102
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
103
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
324
104
|
case 0:
|
|
325
|
-
this.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
105
|
+
if (this._info) {
|
|
106
|
+
_context2.next = 9;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
_context2.prev = 1;
|
|
110
|
+
_context2.next = 4;
|
|
111
|
+
return this.g("/~meta@1.0/info");
|
|
329
112
|
case 4:
|
|
330
|
-
this._info =
|
|
331
|
-
|
|
113
|
+
this._info = _context2.sent;
|
|
114
|
+
_context2.next = 9;
|
|
332
115
|
break;
|
|
333
116
|
case 7:
|
|
334
|
-
|
|
335
|
-
|
|
117
|
+
_context2.prev = 7;
|
|
118
|
+
_context2.t0 = _context2["catch"](1);
|
|
336
119
|
case 9:
|
|
337
|
-
return _context9.abrupt("return", this);
|
|
338
|
-
case 10:
|
|
339
120
|
case "end":
|
|
340
|
-
return
|
|
121
|
+
return _context2.stop();
|
|
341
122
|
}
|
|
342
|
-
},
|
|
123
|
+
}, _callee2, this, [[1, 7]]);
|
|
343
124
|
}));
|
|
344
|
-
function
|
|
125
|
+
function setInfo() {
|
|
126
|
+
return _setInfo.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
return setInfo;
|
|
129
|
+
}()
|
|
130
|
+
}, {
|
|
131
|
+
key: "init",
|
|
132
|
+
value: function () {
|
|
133
|
+
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(jwk) {
|
|
134
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
135
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
this._init(jwk);
|
|
138
|
+
_context3.next = 3;
|
|
139
|
+
return this.setInfo();
|
|
140
|
+
case 3:
|
|
141
|
+
return _context3.abrupt("return", this);
|
|
142
|
+
case 4:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context3.stop();
|
|
145
|
+
}
|
|
146
|
+
}, _callee3, this);
|
|
147
|
+
}));
|
|
148
|
+
function init(_x2) {
|
|
345
149
|
return _init2.apply(this, arguments);
|
|
346
150
|
}
|
|
347
151
|
return init;
|
|
@@ -349,21 +153,21 @@ var HB = /*#__PURE__*/function () {
|
|
|
349
153
|
}, {
|
|
350
154
|
key: "send",
|
|
351
155
|
value: function () {
|
|
352
|
-
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
353
|
-
return _regeneratorRuntime().wrap(function
|
|
354
|
-
while (1) switch (
|
|
156
|
+
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(msg) {
|
|
157
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
158
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
355
159
|
case 0:
|
|
356
|
-
|
|
160
|
+
_context4.next = 2;
|
|
357
161
|
return (0, _send3.send)(msg);
|
|
358
162
|
case 2:
|
|
359
|
-
return
|
|
163
|
+
return _context4.abrupt("return", _context4.sent);
|
|
360
164
|
case 3:
|
|
361
165
|
case "end":
|
|
362
|
-
return
|
|
166
|
+
return _context4.stop();
|
|
363
167
|
}
|
|
364
|
-
},
|
|
168
|
+
}, _callee4);
|
|
365
169
|
}));
|
|
366
|
-
function send(
|
|
170
|
+
function send(_x3) {
|
|
367
171
|
return _send2.apply(this, arguments);
|
|
368
172
|
}
|
|
369
173
|
return send;
|
|
@@ -371,24 +175,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
371
175
|
}, {
|
|
372
176
|
key: "getImage",
|
|
373
177
|
value: function () {
|
|
374
|
-
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
178
|
+
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
375
179
|
var _this$image;
|
|
376
180
|
var wasm, id;
|
|
377
|
-
return _regeneratorRuntime().wrap(function
|
|
378
|
-
while (1) switch (
|
|
181
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
182
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
379
183
|
case 0:
|
|
380
184
|
wasm = Buffer.from(_aos_wamr["default"], "base64");
|
|
381
|
-
|
|
185
|
+
_context5.next = 3;
|
|
382
186
|
return this.cacheBinary(wasm, "application/wasm");
|
|
383
187
|
case 3:
|
|
384
|
-
id =
|
|
188
|
+
id = _context5.sent;
|
|
385
189
|
(_this$image = this.image) !== null && _this$image !== void 0 ? _this$image : this.image = id;
|
|
386
|
-
return
|
|
190
|
+
return _context5.abrupt("return", id);
|
|
387
191
|
case 6:
|
|
388
192
|
case "end":
|
|
389
|
-
return
|
|
193
|
+
return _context5.stop();
|
|
390
194
|
}
|
|
391
|
-
},
|
|
195
|
+
}, _callee5, this);
|
|
392
196
|
}));
|
|
393
197
|
function getImage() {
|
|
394
198
|
return _getImage.apply(this, arguments);
|
|
@@ -398,24 +202,24 @@ var HB = /*#__PURE__*/function () {
|
|
|
398
202
|
}, {
|
|
399
203
|
key: "getLua",
|
|
400
204
|
value: function () {
|
|
401
|
-
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
205
|
+
var _getLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
402
206
|
var _this$lua;
|
|
403
207
|
var lua, id;
|
|
404
|
-
return _regeneratorRuntime().wrap(function
|
|
405
|
-
while (1) switch (
|
|
208
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
209
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
406
210
|
case 0:
|
|
407
211
|
lua = Buffer.from(_hyperAos["default"], "base64");
|
|
408
|
-
|
|
212
|
+
_context6.next = 3;
|
|
409
213
|
return this.cacheScript(lua, "application/lua");
|
|
410
214
|
case 3:
|
|
411
|
-
id =
|
|
215
|
+
id = _context6.sent;
|
|
412
216
|
(_this$lua = this.lua) !== null && _this$lua !== void 0 ? _this$lua : this.lua = id;
|
|
413
|
-
return
|
|
217
|
+
return _context6.abrupt("return", id);
|
|
414
218
|
case 6:
|
|
415
219
|
case "end":
|
|
416
|
-
return
|
|
220
|
+
return _context6.stop();
|
|
417
221
|
}
|
|
418
|
-
},
|
|
222
|
+
}, _callee6, this);
|
|
419
223
|
}));
|
|
420
224
|
function getLua() {
|
|
421
225
|
return _getLua.apply(this, arguments);
|
|
@@ -425,11 +229,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
425
229
|
}, {
|
|
426
230
|
key: "scheduleAOS",
|
|
427
231
|
value: function () {
|
|
428
|
-
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
232
|
+
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref2) {
|
|
429
233
|
var _pid;
|
|
430
234
|
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
431
|
-
return _regeneratorRuntime().wrap(function
|
|
432
|
-
while (1) switch (
|
|
235
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
236
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
433
237
|
case 0:
|
|
434
238
|
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;
|
|
435
239
|
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
@@ -438,28 +242,28 @@ var HB = /*#__PURE__*/function () {
|
|
|
438
242
|
method: "POST",
|
|
439
243
|
path: "/".concat(pid, "~process@1.0/schedule"),
|
|
440
244
|
scheduler: this.scheduler,
|
|
441
|
-
|
|
245
|
+
type: "Message",
|
|
442
246
|
Action: action,
|
|
443
|
-
|
|
247
|
+
target: pid
|
|
444
248
|
});
|
|
445
249
|
if (data) _tags.data = data;
|
|
446
|
-
|
|
250
|
+
_context7.next = 6;
|
|
447
251
|
return this.post(_tags);
|
|
448
252
|
case 6:
|
|
449
|
-
res =
|
|
253
|
+
res = _context7.sent;
|
|
450
254
|
slot = res.headers.slot;
|
|
451
|
-
return
|
|
255
|
+
return _context7.abrupt("return", {
|
|
452
256
|
slot: slot,
|
|
453
257
|
res: res,
|
|
454
258
|
pid: pid
|
|
455
259
|
});
|
|
456
260
|
case 9:
|
|
457
261
|
case "end":
|
|
458
|
-
return
|
|
262
|
+
return _context7.stop();
|
|
459
263
|
}
|
|
460
|
-
},
|
|
264
|
+
}, _callee7, this);
|
|
461
265
|
}));
|
|
462
|
-
function scheduleAOS(
|
|
266
|
+
function scheduleAOS(_x4) {
|
|
463
267
|
return _scheduleAOS.apply(this, arguments);
|
|
464
268
|
}
|
|
465
269
|
return scheduleAOS;
|
|
@@ -467,36 +271,36 @@ var HB = /*#__PURE__*/function () {
|
|
|
467
271
|
}, {
|
|
468
272
|
key: "messageAOS",
|
|
469
273
|
value: function () {
|
|
470
|
-
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
274
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(args) {
|
|
471
275
|
var _yield$this$scheduleA, slot, pid;
|
|
472
|
-
return _regeneratorRuntime().wrap(function
|
|
473
|
-
while (1) switch (
|
|
276
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
277
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
474
278
|
case 0:
|
|
475
|
-
|
|
279
|
+
_context8.next = 2;
|
|
476
280
|
return this.scheduleAOS(args);
|
|
477
281
|
case 2:
|
|
478
|
-
_yield$this$scheduleA =
|
|
282
|
+
_yield$this$scheduleA = _context8.sent;
|
|
479
283
|
slot = _yield$this$scheduleA.slot;
|
|
480
284
|
pid = _yield$this$scheduleA.pid;
|
|
481
|
-
|
|
482
|
-
|
|
285
|
+
_context8.t0 = slot;
|
|
286
|
+
_context8.next = 8;
|
|
483
287
|
return this.computeAOS({
|
|
484
288
|
pid: pid,
|
|
485
289
|
slot: slot
|
|
486
290
|
});
|
|
487
291
|
case 8:
|
|
488
|
-
|
|
489
|
-
return
|
|
490
|
-
slot:
|
|
491
|
-
outbox:
|
|
292
|
+
_context8.t1 = _context8.sent;
|
|
293
|
+
return _context8.abrupt("return", {
|
|
294
|
+
slot: _context8.t0,
|
|
295
|
+
outbox: _context8.t1
|
|
492
296
|
});
|
|
493
297
|
case 10:
|
|
494
298
|
case "end":
|
|
495
|
-
return
|
|
299
|
+
return _context8.stop();
|
|
496
300
|
}
|
|
497
|
-
},
|
|
301
|
+
}, _callee8, this);
|
|
498
302
|
}));
|
|
499
|
-
function messageAOS(
|
|
303
|
+
function messageAOS(_x5) {
|
|
500
304
|
return _messageAOS.apply(this, arguments);
|
|
501
305
|
}
|
|
502
306
|
return messageAOS;
|
|
@@ -504,205 +308,64 @@ var HB = /*#__PURE__*/function () {
|
|
|
504
308
|
}, {
|
|
505
309
|
key: "messageLegacy",
|
|
506
310
|
value: function () {
|
|
507
|
-
var _messageLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
311
|
+
var _messageLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(args) {
|
|
508
312
|
var _yield$this$scheduleL, slot, pid;
|
|
509
|
-
return _regeneratorRuntime().wrap(function
|
|
510
|
-
while (1) switch (
|
|
313
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
314
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
511
315
|
case 0:
|
|
512
|
-
|
|
316
|
+
_context9.next = 2;
|
|
513
317
|
return this.scheduleLegacy(args);
|
|
514
318
|
case 2:
|
|
515
|
-
_yield$this$scheduleL =
|
|
319
|
+
_yield$this$scheduleL = _context9.sent;
|
|
516
320
|
slot = _yield$this$scheduleL.slot;
|
|
517
321
|
pid = _yield$this$scheduleL.pid;
|
|
518
322
|
console.log(slot, pid, args);
|
|
519
|
-
|
|
520
|
-
|
|
323
|
+
_context9.t0 = slot;
|
|
324
|
+
_context9.next = 9;
|
|
521
325
|
return this.computeLegacy({
|
|
522
326
|
pid: pid,
|
|
523
327
|
slot: slot
|
|
524
328
|
});
|
|
525
329
|
case 9:
|
|
526
|
-
|
|
527
|
-
return
|
|
528
|
-
slot:
|
|
529
|
-
res:
|
|
330
|
+
_context9.t1 = _context9.sent;
|
|
331
|
+
return _context9.abrupt("return", {
|
|
332
|
+
slot: _context9.t0,
|
|
333
|
+
res: _context9.t1
|
|
530
334
|
});
|
|
531
335
|
case 11:
|
|
532
336
|
case "end":
|
|
533
|
-
return
|
|
337
|
+
return _context9.stop();
|
|
534
338
|
}
|
|
535
|
-
},
|
|
339
|
+
}, _callee9, this);
|
|
536
340
|
}));
|
|
537
|
-
function messageLegacy(
|
|
341
|
+
function messageLegacy(_x6) {
|
|
538
342
|
return _messageLegacy.apply(this, arguments);
|
|
539
343
|
}
|
|
540
344
|
return messageLegacy;
|
|
541
345
|
}()
|
|
542
|
-
}, {
|
|
543
|
-
key: "path",
|
|
544
|
-
value: function path(_ref3) {
|
|
545
|
-
var _path2;
|
|
546
|
-
var _ref3$dev = _ref3.dev,
|
|
547
|
-
dev = _ref3$dev === void 0 ? "message" : _ref3$dev,
|
|
548
|
-
_path = _ref3.path,
|
|
549
|
-
_ref3$json = _ref3.json,
|
|
550
|
-
json = _ref3$json === void 0 ? true : _ref3$json,
|
|
551
|
-
_ref3$params = _ref3.params,
|
|
552
|
-
params = _ref3$params === void 0 ? {} : _ref3$params,
|
|
553
|
-
_ref3$pid = _ref3.pid,
|
|
554
|
-
pid = _ref3$pid === void 0 ? "" : _ref3$pid,
|
|
555
|
-
_ref3$tail = _ref3.tail,
|
|
556
|
-
tail = _ref3$tail === void 0 ? "" : _ref3$tail;
|
|
557
|
-
if (!/@/.test(dev)) dev += "@1.0";
|
|
558
|
-
var _params = "";
|
|
559
|
-
if (!(0, _ramda.isEmpty)(params)) {
|
|
560
|
-
var i = 0;
|
|
561
|
-
for (var k in params) {
|
|
562
|
-
_params += "".concat(i === 0 ? "?" : "&").concat(k, "=").concat(params[k]);
|
|
563
|
-
i++;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
if (_path && !/^\//.test(_path)) _path = "/" + _path;
|
|
567
|
-
return "/".concat(pid, "~").concat(dev).concat((_path2 = _path) !== null && _path2 !== void 0 ? _path2 : "").concat(tail).concat(json ? "/~json@1.0/serialize" : "").concat(_params);
|
|
568
|
-
}
|
|
569
|
-
}, {
|
|
570
|
-
key: "text",
|
|
571
|
-
value: function () {
|
|
572
|
-
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(dev, path) {
|
|
573
|
-
var params,
|
|
574
|
-
tail,
|
|
575
|
-
pid,
|
|
576
|
-
_args16 = arguments;
|
|
577
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
578
|
-
while (1) switch (_context16.prev = _context16.next) {
|
|
579
|
-
case 0:
|
|
580
|
-
params = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
581
|
-
tail = _args16.length > 3 ? _args16[3] : undefined;
|
|
582
|
-
pid = "";
|
|
583
|
-
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
584
|
-
pid = dev;
|
|
585
|
-
dev = "process";
|
|
586
|
-
}
|
|
587
|
-
_context16.next = 6;
|
|
588
|
-
return this.fetch(this.path({
|
|
589
|
-
dev: dev,
|
|
590
|
-
path: path,
|
|
591
|
-
json: false,
|
|
592
|
-
params: params,
|
|
593
|
-
pid: pid,
|
|
594
|
-
tail: tail
|
|
595
|
-
}), false);
|
|
596
|
-
case 6:
|
|
597
|
-
return _context16.abrupt("return", _context16.sent);
|
|
598
|
-
case 7:
|
|
599
|
-
case "end":
|
|
600
|
-
return _context16.stop();
|
|
601
|
-
}
|
|
602
|
-
}, _callee16, this);
|
|
603
|
-
}));
|
|
604
|
-
function text(_x12, _x13) {
|
|
605
|
-
return _text.apply(this, arguments);
|
|
606
|
-
}
|
|
607
|
-
return text;
|
|
608
|
-
}()
|
|
609
|
-
}, {
|
|
610
|
-
key: "json",
|
|
611
|
-
value: function () {
|
|
612
|
-
var _json2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(dev, path) {
|
|
613
|
-
var params,
|
|
614
|
-
tail,
|
|
615
|
-
pid,
|
|
616
|
-
_args17 = arguments;
|
|
617
|
-
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
618
|
-
while (1) switch (_context17.prev = _context17.next) {
|
|
619
|
-
case 0:
|
|
620
|
-
params = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
621
|
-
tail = _args17.length > 3 ? _args17[3] : undefined;
|
|
622
|
-
pid = "";
|
|
623
|
-
if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
|
|
624
|
-
pid = dev;
|
|
625
|
-
dev = "process";
|
|
626
|
-
}
|
|
627
|
-
_context17.next = 6;
|
|
628
|
-
return this.fetch(this.path({
|
|
629
|
-
dev: dev,
|
|
630
|
-
path: path,
|
|
631
|
-
json: true,
|
|
632
|
-
params: params,
|
|
633
|
-
pid: pid,
|
|
634
|
-
tail: tail
|
|
635
|
-
}));
|
|
636
|
-
case 6:
|
|
637
|
-
return _context17.abrupt("return", _context17.sent);
|
|
638
|
-
case 7:
|
|
639
|
-
case "end":
|
|
640
|
-
return _context17.stop();
|
|
641
|
-
}
|
|
642
|
-
}, _callee17, this);
|
|
643
|
-
}));
|
|
644
|
-
function json(_x14, _x15) {
|
|
645
|
-
return _json2.apply(this, arguments);
|
|
646
|
-
}
|
|
647
|
-
return json;
|
|
648
|
-
}()
|
|
649
|
-
}, {
|
|
650
|
-
key: "fetch",
|
|
651
|
-
value: function (_fetch) {
|
|
652
|
-
function fetch(_x) {
|
|
653
|
-
return _fetch.apply(this, arguments);
|
|
654
|
-
}
|
|
655
|
-
fetch.toString = function () {
|
|
656
|
-
return _fetch.toString();
|
|
657
|
-
};
|
|
658
|
-
return fetch;
|
|
659
|
-
}(/*#__PURE__*/function () {
|
|
660
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(path) {
|
|
661
|
-
var json,
|
|
662
|
-
_args18 = arguments;
|
|
663
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
664
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
665
|
-
case 0:
|
|
666
|
-
json = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : true;
|
|
667
|
-
_context18.next = 3;
|
|
668
|
-
return fetch(this.url + path).then(function (r) {
|
|
669
|
-
return json ? r.json() : r.text();
|
|
670
|
-
});
|
|
671
|
-
case 3:
|
|
672
|
-
return _context18.abrupt("return", _context18.sent);
|
|
673
|
-
case 4:
|
|
674
|
-
case "end":
|
|
675
|
-
return _context18.stop();
|
|
676
|
-
}
|
|
677
|
-
}, _callee18, this);
|
|
678
|
-
}));
|
|
679
|
-
return function (_x16) {
|
|
680
|
-
return _ref4.apply(this, arguments);
|
|
681
|
-
};
|
|
682
|
-
}())
|
|
683
346
|
}, {
|
|
684
347
|
key: "computeAOS",
|
|
685
348
|
value: function () {
|
|
686
|
-
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
349
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref3) {
|
|
687
350
|
var pid, slot;
|
|
688
|
-
return _regeneratorRuntime().wrap(function
|
|
689
|
-
while (1) switch (
|
|
351
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
352
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
690
353
|
case 0:
|
|
691
|
-
pid =
|
|
692
|
-
|
|
354
|
+
pid = _ref3.pid, slot = _ref3.slot;
|
|
355
|
+
_context10.next = 3;
|
|
693
356
|
return this.getJSON({
|
|
694
357
|
path: "/".concat(pid, "/compute/results/outbox"),
|
|
695
358
|
slot: slot
|
|
696
359
|
});
|
|
697
360
|
case 3:
|
|
698
|
-
return
|
|
361
|
+
return _context10.abrupt("return", _context10.sent);
|
|
699
362
|
case 4:
|
|
700
363
|
case "end":
|
|
701
|
-
return
|
|
364
|
+
return _context10.stop();
|
|
702
365
|
}
|
|
703
|
-
},
|
|
366
|
+
}, _callee10, this);
|
|
704
367
|
}));
|
|
705
|
-
function computeAOS(
|
|
368
|
+
function computeAOS(_x7) {
|
|
706
369
|
return _computeAOS.apply(this, arguments);
|
|
707
370
|
}
|
|
708
371
|
return computeAOS;
|
|
@@ -710,26 +373,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
710
373
|
}, {
|
|
711
374
|
key: "computeLua",
|
|
712
375
|
value: function () {
|
|
713
|
-
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
376
|
+
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref4) {
|
|
714
377
|
var pid, slot;
|
|
715
|
-
return _regeneratorRuntime().wrap(function
|
|
716
|
-
while (1) switch (
|
|
378
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
379
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
717
380
|
case 0:
|
|
718
|
-
pid =
|
|
719
|
-
|
|
381
|
+
pid = _ref4.pid, slot = _ref4.slot;
|
|
382
|
+
_context11.next = 3;
|
|
720
383
|
return this.getJSON({
|
|
721
384
|
path: "/".concat(pid, "/compute/results"),
|
|
722
385
|
slot: slot
|
|
723
386
|
});
|
|
724
387
|
case 3:
|
|
725
|
-
return
|
|
388
|
+
return _context11.abrupt("return", _context11.sent);
|
|
726
389
|
case 4:
|
|
727
390
|
case "end":
|
|
728
|
-
return
|
|
391
|
+
return _context11.stop();
|
|
729
392
|
}
|
|
730
|
-
},
|
|
393
|
+
}, _callee11, this);
|
|
731
394
|
}));
|
|
732
|
-
function computeLua(
|
|
395
|
+
function computeLua(_x8) {
|
|
733
396
|
return _computeLua.apply(this, arguments);
|
|
734
397
|
}
|
|
735
398
|
return computeLua;
|
|
@@ -737,27 +400,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
737
400
|
}, {
|
|
738
401
|
key: "compute",
|
|
739
402
|
value: function () {
|
|
740
|
-
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
741
|
-
var pid, slot,
|
|
742
|
-
return _regeneratorRuntime().wrap(function
|
|
743
|
-
while (1) switch (
|
|
403
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref5) {
|
|
404
|
+
var pid, slot, _ref5$path, path;
|
|
405
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
406
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
744
407
|
case 0:
|
|
745
|
-
pid =
|
|
408
|
+
pid = _ref5.pid, slot = _ref5.slot, _ref5$path = _ref5.path, path = _ref5$path === void 0 ? "" : _ref5$path;
|
|
746
409
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
747
|
-
|
|
410
|
+
_context12.next = 4;
|
|
748
411
|
return this.getJSON({
|
|
749
412
|
path: "/".concat(pid, "/compute").concat(path),
|
|
750
413
|
slot: slot
|
|
751
414
|
});
|
|
752
415
|
case 4:
|
|
753
|
-
return
|
|
416
|
+
return _context12.abrupt("return", _context12.sent);
|
|
754
417
|
case 5:
|
|
755
418
|
case "end":
|
|
756
|
-
return
|
|
419
|
+
return _context12.stop();
|
|
757
420
|
}
|
|
758
|
-
},
|
|
421
|
+
}, _callee12, this);
|
|
759
422
|
}));
|
|
760
|
-
function compute(
|
|
423
|
+
function compute(_x9) {
|
|
761
424
|
return _compute.apply(this, arguments);
|
|
762
425
|
}
|
|
763
426
|
return compute;
|
|
@@ -765,27 +428,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
765
428
|
}, {
|
|
766
429
|
key: "computeLegacy",
|
|
767
430
|
value: function () {
|
|
768
|
-
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
431
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref6) {
|
|
769
432
|
var pid, slot, json;
|
|
770
|
-
return _regeneratorRuntime().wrap(function
|
|
771
|
-
while (1) switch (
|
|
433
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
434
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
772
435
|
case 0:
|
|
773
|
-
pid =
|
|
774
|
-
|
|
436
|
+
pid = _ref6.pid, slot = _ref6.slot;
|
|
437
|
+
_context13.next = 3;
|
|
775
438
|
return this.compute({
|
|
776
439
|
pid: pid,
|
|
777
440
|
slot: slot
|
|
778
441
|
});
|
|
779
442
|
case 3:
|
|
780
|
-
json =
|
|
781
|
-
return
|
|
443
|
+
json = _context13.sent;
|
|
444
|
+
return _context13.abrupt("return", JSON.parse(json.results.json.body));
|
|
782
445
|
case 5:
|
|
783
446
|
case "end":
|
|
784
|
-
return
|
|
447
|
+
return _context13.stop();
|
|
785
448
|
}
|
|
786
|
-
},
|
|
449
|
+
}, _callee13, this);
|
|
787
450
|
}));
|
|
788
|
-
function computeLegacy(
|
|
451
|
+
function computeLegacy(_x10) {
|
|
789
452
|
return _computeLegacy.apply(this, arguments);
|
|
790
453
|
}
|
|
791
454
|
return computeLegacy;
|
|
@@ -793,45 +456,43 @@ var HB = /*#__PURE__*/function () {
|
|
|
793
456
|
}, {
|
|
794
457
|
key: "spawn",
|
|
795
458
|
value: function () {
|
|
796
|
-
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
459
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
797
460
|
var _this$scheduler;
|
|
798
461
|
var tags,
|
|
799
462
|
addr,
|
|
800
463
|
_tags,
|
|
801
464
|
res,
|
|
802
|
-
|
|
803
|
-
return _regeneratorRuntime().wrap(function
|
|
804
|
-
while (1) switch (
|
|
465
|
+
_args14 = arguments;
|
|
466
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
467
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
805
468
|
case 0:
|
|
806
|
-
tags =
|
|
807
|
-
|
|
808
|
-
return this.
|
|
809
|
-
key: "address"
|
|
810
|
-
});
|
|
469
|
+
tags = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
470
|
+
_context14.next = 3;
|
|
471
|
+
return this.g("/~meta@1.0/info/address");
|
|
811
472
|
case 3:
|
|
812
|
-
addr =
|
|
473
|
+
addr = _context14.sent;
|
|
813
474
|
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
814
475
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
815
476
|
device: "process@1.0",
|
|
816
477
|
path: "/schedule",
|
|
817
478
|
scheduler: this.scheduler,
|
|
818
479
|
"random-seed": seed(16),
|
|
819
|
-
|
|
480
|
+
type: "Process",
|
|
820
481
|
"execution-device": "test-device@1.0"
|
|
821
482
|
});
|
|
822
|
-
|
|
483
|
+
_context14.next = 8;
|
|
823
484
|
return this.post(_tags);
|
|
824
485
|
case 8:
|
|
825
|
-
res =
|
|
826
|
-
return
|
|
486
|
+
res = _context14.sent;
|
|
487
|
+
return _context14.abrupt("return", {
|
|
827
488
|
res: res,
|
|
828
489
|
pid: res.headers.process
|
|
829
490
|
});
|
|
830
491
|
case 10:
|
|
831
492
|
case "end":
|
|
832
|
-
return
|
|
493
|
+
return _context14.stop();
|
|
833
494
|
}
|
|
834
|
-
},
|
|
495
|
+
}, _callee14, this);
|
|
835
496
|
}));
|
|
836
497
|
function spawn() {
|
|
837
498
|
return _spawn.apply(this, arguments);
|
|
@@ -841,54 +502,54 @@ var HB = /*#__PURE__*/function () {
|
|
|
841
502
|
}, {
|
|
842
503
|
key: "cacheScript",
|
|
843
504
|
value: function () {
|
|
844
|
-
var _cacheScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
505
|
+
var _cacheScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(data) {
|
|
845
506
|
var type,
|
|
846
507
|
_yield$this$spawn,
|
|
847
508
|
pid,
|
|
848
509
|
_yield$this$schedule,
|
|
849
510
|
slot,
|
|
850
511
|
msgs,
|
|
851
|
-
|
|
852
|
-
return _regeneratorRuntime().wrap(function
|
|
853
|
-
while (1) switch (
|
|
512
|
+
_args15 = arguments;
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
514
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
854
515
|
case 0:
|
|
855
|
-
type =
|
|
516
|
+
type = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : "application/lua";
|
|
856
517
|
if (this.cache) {
|
|
857
|
-
|
|
518
|
+
_context15.next = 7;
|
|
858
519
|
break;
|
|
859
520
|
}
|
|
860
|
-
|
|
521
|
+
_context15.next = 4;
|
|
861
522
|
return this.spawn({});
|
|
862
523
|
case 4:
|
|
863
|
-
_yield$this$spawn =
|
|
524
|
+
_yield$this$spawn = _context15.sent;
|
|
864
525
|
pid = _yield$this$spawn.pid;
|
|
865
526
|
this.cache = pid;
|
|
866
527
|
case 7:
|
|
867
|
-
|
|
528
|
+
_context15.next = 9;
|
|
868
529
|
return this.schedule({
|
|
869
530
|
data: data,
|
|
870
531
|
pid: this.cache,
|
|
871
532
|
"content-type": type
|
|
872
533
|
});
|
|
873
534
|
case 9:
|
|
874
|
-
_yield$this$schedule =
|
|
535
|
+
_yield$this$schedule = _context15.sent;
|
|
875
536
|
slot = _yield$this$schedule.slot;
|
|
876
|
-
|
|
537
|
+
_context15.next = 13;
|
|
877
538
|
return this.messages({
|
|
878
539
|
pid: this.cache,
|
|
879
540
|
from: slot,
|
|
880
541
|
limit: 1
|
|
881
542
|
});
|
|
882
543
|
case 13:
|
|
883
|
-
msgs =
|
|
884
|
-
return
|
|
544
|
+
msgs = _context15.sent;
|
|
545
|
+
return _context15.abrupt("return", msgs.edges[0].node.message.Id);
|
|
885
546
|
case 15:
|
|
886
547
|
case "end":
|
|
887
|
-
return
|
|
548
|
+
return _context15.stop();
|
|
888
549
|
}
|
|
889
|
-
},
|
|
550
|
+
}, _callee15, this);
|
|
890
551
|
}));
|
|
891
|
-
function cacheScript(
|
|
552
|
+
function cacheScript(_x11) {
|
|
892
553
|
return _cacheScript.apply(this, arguments);
|
|
893
554
|
}
|
|
894
555
|
return cacheScript;
|
|
@@ -896,27 +557,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
896
557
|
}, {
|
|
897
558
|
key: "cacheBinary",
|
|
898
559
|
value: function () {
|
|
899
|
-
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
560
|
+
var _cacheBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(data, type) {
|
|
900
561
|
var res;
|
|
901
|
-
return _regeneratorRuntime().wrap(function
|
|
902
|
-
while (1) switch (
|
|
562
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
563
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
903
564
|
case 0:
|
|
904
|
-
|
|
565
|
+
_context16.next = 2;
|
|
905
566
|
return this.post({
|
|
906
567
|
path: "/~wao@1.0/cache_module",
|
|
907
568
|
data: data,
|
|
908
569
|
type: type
|
|
909
570
|
});
|
|
910
571
|
case 2:
|
|
911
|
-
res =
|
|
912
|
-
return
|
|
572
|
+
res = _context16.sent;
|
|
573
|
+
return _context16.abrupt("return", res.headers.id);
|
|
913
574
|
case 4:
|
|
914
575
|
case "end":
|
|
915
|
-
return
|
|
576
|
+
return _context16.stop();
|
|
916
577
|
}
|
|
917
|
-
},
|
|
578
|
+
}, _callee16, this);
|
|
918
579
|
}));
|
|
919
|
-
function cacheBinary(
|
|
580
|
+
function cacheBinary(_x12, _x13) {
|
|
920
581
|
return _cacheBinary.apply(this, arguments);
|
|
921
582
|
}
|
|
922
583
|
return cacheBinary;
|
|
@@ -924,36 +585,36 @@ var HB = /*#__PURE__*/function () {
|
|
|
924
585
|
}, {
|
|
925
586
|
key: "message",
|
|
926
587
|
value: function () {
|
|
927
|
-
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
588
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(args) {
|
|
928
589
|
var pid, _yield$this$schedule2, slot, res;
|
|
929
|
-
return _regeneratorRuntime().wrap(function
|
|
930
|
-
while (1) switch (
|
|
590
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
591
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
931
592
|
case 0:
|
|
932
593
|
pid = args.pid;
|
|
933
|
-
|
|
594
|
+
_context17.next = 3;
|
|
934
595
|
return this.schedule(args);
|
|
935
596
|
case 3:
|
|
936
|
-
_yield$this$schedule2 =
|
|
597
|
+
_yield$this$schedule2 = _context17.sent;
|
|
937
598
|
slot = _yield$this$schedule2.slot;
|
|
938
|
-
|
|
599
|
+
_context17.next = 7;
|
|
939
600
|
return this.compute({
|
|
940
601
|
pid: pid,
|
|
941
602
|
slot: slot
|
|
942
603
|
});
|
|
943
604
|
case 7:
|
|
944
|
-
res =
|
|
945
|
-
return
|
|
605
|
+
res = _context17.sent;
|
|
606
|
+
return _context17.abrupt("return", {
|
|
946
607
|
slot: slot,
|
|
947
608
|
pid: pid,
|
|
948
609
|
res: res
|
|
949
610
|
});
|
|
950
611
|
case 9:
|
|
951
612
|
case "end":
|
|
952
|
-
return
|
|
613
|
+
return _context17.stop();
|
|
953
614
|
}
|
|
954
|
-
},
|
|
615
|
+
}, _callee17, this);
|
|
955
616
|
}));
|
|
956
|
-
function message(
|
|
617
|
+
function message(_x14) {
|
|
957
618
|
return _message.apply(this, arguments);
|
|
958
619
|
}
|
|
959
620
|
return message;
|
|
@@ -961,22 +622,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
961
622
|
}, {
|
|
962
623
|
key: "scheduleLegacy",
|
|
963
624
|
value: function () {
|
|
964
|
-
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
965
|
-
var
|
|
625
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
626
|
+
var _ref7,
|
|
966
627
|
pid,
|
|
967
|
-
|
|
628
|
+
_ref7$action,
|
|
968
629
|
action,
|
|
969
|
-
|
|
630
|
+
_ref7$tags,
|
|
970
631
|
tags,
|
|
971
632
|
data,
|
|
972
633
|
scheduler,
|
|
973
|
-
|
|
974
|
-
return _regeneratorRuntime().wrap(function
|
|
975
|
-
while (1) switch (
|
|
634
|
+
_args18 = arguments;
|
|
635
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
636
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
976
637
|
case 0:
|
|
977
|
-
|
|
638
|
+
_ref7 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, pid = _ref7.pid, _ref7$action = _ref7.action, action = _ref7$action === void 0 ? "Eval" : _ref7$action, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data, scheduler = _ref7.scheduler;
|
|
978
639
|
if (action) tags.Action = action;
|
|
979
|
-
|
|
640
|
+
_context18.next = 4;
|
|
980
641
|
return this.schedule({
|
|
981
642
|
pid: pid,
|
|
982
643
|
tags: tags,
|
|
@@ -984,12 +645,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
984
645
|
scheduler: scheduler
|
|
985
646
|
});
|
|
986
647
|
case 4:
|
|
987
|
-
return
|
|
648
|
+
return _context18.abrupt("return", _context18.sent);
|
|
988
649
|
case 5:
|
|
989
650
|
case "end":
|
|
990
|
-
return
|
|
651
|
+
return _context18.stop();
|
|
991
652
|
}
|
|
992
|
-
},
|
|
653
|
+
}, _callee18, this);
|
|
993
654
|
}));
|
|
994
655
|
function scheduleLegacy() {
|
|
995
656
|
return _scheduleLegacy.apply(this, arguments);
|
|
@@ -999,20 +660,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
999
660
|
}, {
|
|
1000
661
|
key: "scheduleLua",
|
|
1001
662
|
value: function () {
|
|
1002
|
-
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1003
|
-
var
|
|
1004
|
-
return _regeneratorRuntime().wrap(function
|
|
1005
|
-
while (1) switch (
|
|
663
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
664
|
+
var _args19 = arguments;
|
|
665
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
666
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1006
667
|
case 0:
|
|
1007
|
-
|
|
1008
|
-
return this.scheduleLegacy.apply(this,
|
|
668
|
+
_context19.next = 2;
|
|
669
|
+
return this.scheduleLegacy.apply(this, _args19);
|
|
1009
670
|
case 2:
|
|
1010
|
-
return
|
|
671
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1011
672
|
case 3:
|
|
1012
673
|
case "end":
|
|
1013
|
-
return
|
|
674
|
+
return _context19.stop();
|
|
1014
675
|
}
|
|
1015
|
-
},
|
|
676
|
+
}, _callee19, this);
|
|
1016
677
|
}));
|
|
1017
678
|
function scheduleLua() {
|
|
1018
679
|
return _scheduleLua.apply(this, arguments);
|
|
@@ -1022,42 +683,42 @@ var HB = /*#__PURE__*/function () {
|
|
|
1022
683
|
}, {
|
|
1023
684
|
key: "schedule",
|
|
1024
685
|
value: function () {
|
|
1025
|
-
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
686
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1026
687
|
var _pid2;
|
|
1027
|
-
var
|
|
688
|
+
var _ref8,
|
|
1028
689
|
pid,
|
|
1029
|
-
|
|
690
|
+
_ref8$tags,
|
|
1030
691
|
tags,
|
|
1031
692
|
data,
|
|
1032
693
|
_tags,
|
|
1033
694
|
res,
|
|
1034
|
-
|
|
1035
|
-
return _regeneratorRuntime().wrap(function
|
|
1036
|
-
while (1) switch (
|
|
695
|
+
_args20 = arguments;
|
|
696
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
697
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1037
698
|
case 0:
|
|
1038
|
-
|
|
699
|
+
_ref8 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, pid = _ref8.pid, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data;
|
|
1039
700
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
1040
701
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
1041
702
|
method: "POST",
|
|
1042
703
|
path: "/".concat(pid, "/schedule"),
|
|
1043
|
-
|
|
1044
|
-
|
|
704
|
+
type: "Message",
|
|
705
|
+
target: pid
|
|
1045
706
|
});
|
|
1046
707
|
if (data) _tags.data = data;
|
|
1047
|
-
|
|
708
|
+
_context20.next = 6;
|
|
1048
709
|
return this.post(_tags);
|
|
1049
710
|
case 6:
|
|
1050
|
-
res =
|
|
1051
|
-
return
|
|
711
|
+
res = _context20.sent;
|
|
712
|
+
return _context20.abrupt("return", {
|
|
1052
713
|
slot: res.headers.slot,
|
|
1053
714
|
res: res,
|
|
1054
715
|
pid: pid
|
|
1055
716
|
});
|
|
1056
717
|
case 8:
|
|
1057
718
|
case "end":
|
|
1058
|
-
return
|
|
719
|
+
return _context20.stop();
|
|
1059
720
|
}
|
|
1060
|
-
},
|
|
721
|
+
}, _callee20, this);
|
|
1061
722
|
}));
|
|
1062
723
|
function schedule() {
|
|
1063
724
|
return _schedule.apply(this, arguments);
|
|
@@ -1067,53 +728,51 @@ var HB = /*#__PURE__*/function () {
|
|
|
1067
728
|
}, {
|
|
1068
729
|
key: "spawnAOS",
|
|
1069
730
|
value: function () {
|
|
1070
|
-
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
731
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(image) {
|
|
1071
732
|
var _this$scheduler2, _image, _this$image2, _this$pid;
|
|
1072
733
|
var addr, res, pid;
|
|
1073
|
-
return _regeneratorRuntime().wrap(function
|
|
1074
|
-
while (1) switch (
|
|
734
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
735
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1075
736
|
case 0:
|
|
1076
|
-
|
|
1077
|
-
return this.
|
|
1078
|
-
key: "address"
|
|
1079
|
-
});
|
|
737
|
+
_context21.next = 2;
|
|
738
|
+
return this.g("/~meta@1.0/info/address");
|
|
1080
739
|
case 2:
|
|
1081
|
-
addr =
|
|
740
|
+
addr = _context21.sent;
|
|
1082
741
|
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
1083
742
|
if (!((_image = image) !== null && _image !== void 0)) {
|
|
1084
|
-
|
|
743
|
+
_context21.next = 8;
|
|
1085
744
|
break;
|
|
1086
745
|
}
|
|
1087
746
|
_image;
|
|
1088
|
-
|
|
747
|
+
_context21.next = 16;
|
|
1089
748
|
break;
|
|
1090
749
|
case 8:
|
|
1091
750
|
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
1092
|
-
|
|
751
|
+
_context21.next = 12;
|
|
1093
752
|
break;
|
|
1094
753
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
754
|
+
_context21.t0 = _this$image2;
|
|
755
|
+
_context21.next = 15;
|
|
1097
756
|
break;
|
|
1098
757
|
case 12:
|
|
1099
|
-
|
|
758
|
+
_context21.next = 14;
|
|
1100
759
|
return this.getImage();
|
|
1101
760
|
case 14:
|
|
1102
|
-
|
|
761
|
+
_context21.t0 = _context21.sent;
|
|
1103
762
|
case 15:
|
|
1104
|
-
image =
|
|
763
|
+
image = _context21.t0;
|
|
1105
764
|
case 16:
|
|
1106
|
-
|
|
765
|
+
_context21.next = 18;
|
|
1107
766
|
return this.post({
|
|
1108
767
|
device: "process@1.0",
|
|
1109
768
|
path: "/schedule",
|
|
1110
769
|
scheduler: this.scheduler,
|
|
1111
|
-
"
|
|
1112
|
-
|
|
770
|
+
"data-protocol": "ao",
|
|
771
|
+
variant: "ao.N.1",
|
|
1113
772
|
"scheduler-location": this.scheduler,
|
|
1114
|
-
|
|
773
|
+
authority: this.scheduler,
|
|
1115
774
|
"random-seed": seed(16),
|
|
1116
|
-
|
|
775
|
+
type: "Process",
|
|
1117
776
|
image: image,
|
|
1118
777
|
"execution-device": "stack@1.0",
|
|
1119
778
|
"push-device": "push@1.0",
|
|
@@ -1125,20 +784,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
1125
784
|
passes: 2
|
|
1126
785
|
});
|
|
1127
786
|
case 18:
|
|
1128
|
-
res =
|
|
787
|
+
res = _context21.sent;
|
|
1129
788
|
pid = res.headers.process;
|
|
1130
789
|
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
1131
|
-
return
|
|
790
|
+
return _context21.abrupt("return", {
|
|
1132
791
|
pid: pid,
|
|
1133
792
|
res: res
|
|
1134
793
|
});
|
|
1135
794
|
case 22:
|
|
1136
795
|
case "end":
|
|
1137
|
-
return
|
|
796
|
+
return _context21.stop();
|
|
1138
797
|
}
|
|
1139
|
-
},
|
|
798
|
+
}, _callee21, this);
|
|
1140
799
|
}));
|
|
1141
|
-
function spawnAOS(
|
|
800
|
+
function spawnAOS(_x15) {
|
|
1142
801
|
return _spawnAOS.apply(this, arguments);
|
|
1143
802
|
}
|
|
1144
803
|
return spawnAOS;
|
|
@@ -1146,182 +805,98 @@ var HB = /*#__PURE__*/function () {
|
|
|
1146
805
|
}, {
|
|
1147
806
|
key: "spawnLua",
|
|
1148
807
|
value: function () {
|
|
1149
|
-
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
808
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(lua) {
|
|
1150
809
|
var _this$scheduler3, _lua, _this$lua2, _this$pid2;
|
|
1151
810
|
var addr, res, pid;
|
|
1152
|
-
return _regeneratorRuntime().wrap(function
|
|
1153
|
-
while (1) switch (
|
|
811
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
812
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1154
813
|
case 0:
|
|
1155
|
-
|
|
1156
|
-
return this.
|
|
1157
|
-
key: "address"
|
|
1158
|
-
});
|
|
814
|
+
_context22.next = 2;
|
|
815
|
+
return this.g("/~meta@1.0/info/address");
|
|
1159
816
|
case 2:
|
|
1160
|
-
addr =
|
|
817
|
+
addr = _context22.sent;
|
|
1161
818
|
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
1162
819
|
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
1163
|
-
|
|
820
|
+
_context22.next = 8;
|
|
1164
821
|
break;
|
|
1165
822
|
}
|
|
1166
823
|
_lua;
|
|
1167
|
-
|
|
824
|
+
_context22.next = 16;
|
|
1168
825
|
break;
|
|
1169
826
|
case 8:
|
|
1170
827
|
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
1171
|
-
|
|
828
|
+
_context22.next = 12;
|
|
1172
829
|
break;
|
|
1173
830
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
831
|
+
_context22.t0 = _this$lua2;
|
|
832
|
+
_context22.next = 15;
|
|
1176
833
|
break;
|
|
1177
834
|
case 12:
|
|
1178
|
-
|
|
835
|
+
_context22.next = 14;
|
|
1179
836
|
return this.getLua();
|
|
1180
837
|
case 14:
|
|
1181
|
-
|
|
838
|
+
_context22.t0 = _context22.sent;
|
|
1182
839
|
case 15:
|
|
1183
|
-
lua =
|
|
840
|
+
lua = _context22.t0;
|
|
1184
841
|
case 16:
|
|
1185
|
-
|
|
842
|
+
_context22.next = 18;
|
|
1186
843
|
return this.post({
|
|
1187
844
|
device: "process@1.0",
|
|
1188
845
|
path: "/schedule",
|
|
1189
846
|
scheduler: this.scheduler,
|
|
1190
|
-
"
|
|
1191
|
-
|
|
847
|
+
"data-protocol": "ao",
|
|
848
|
+
variant: "ao.N.1",
|
|
1192
849
|
"scheduler-location": this.scheduler,
|
|
1193
|
-
|
|
850
|
+
authority: this.scheduler,
|
|
1194
851
|
"random-seed": seed(16),
|
|
1195
|
-
|
|
852
|
+
type: "Process",
|
|
1196
853
|
module: lua,
|
|
1197
854
|
"execution-device": "lua@5.3a",
|
|
1198
855
|
"push-device": "push@1.0",
|
|
1199
856
|
"patch-from": "/results/outbox"
|
|
1200
857
|
});
|
|
1201
858
|
case 18:
|
|
1202
|
-
res =
|
|
859
|
+
res = _context22.sent;
|
|
1203
860
|
pid = res.headers.process;
|
|
1204
861
|
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
1205
|
-
return
|
|
862
|
+
return _context22.abrupt("return", {
|
|
1206
863
|
pid: pid,
|
|
1207
864
|
res: res
|
|
1208
865
|
});
|
|
1209
866
|
case 22:
|
|
1210
867
|
case "end":
|
|
1211
|
-
return
|
|
868
|
+
return _context22.stop();
|
|
1212
869
|
}
|
|
1213
|
-
},
|
|
870
|
+
}, _callee22, this);
|
|
1214
871
|
}));
|
|
1215
|
-
function spawnLua(
|
|
872
|
+
function spawnLua(_x16) {
|
|
1216
873
|
return _spawnLua.apply(this, arguments);
|
|
1217
874
|
}
|
|
1218
875
|
return spawnLua;
|
|
1219
876
|
}()
|
|
1220
|
-
}, {
|
|
1221
|
-
key: "parseMetrics",
|
|
1222
|
-
value: function parseMetrics(txt) {
|
|
1223
|
-
var parts = txt.split(/\r?\n/);
|
|
1224
|
-
var index = 0;
|
|
1225
|
-
var _metrics = {};
|
|
1226
|
-
var vals = [];
|
|
1227
|
-
var desc = [];
|
|
1228
|
-
var _iterator = _createForOfIteratorHelper(parts),
|
|
1229
|
-
_step;
|
|
1230
|
-
try {
|
|
1231
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1232
|
-
var v = _step.value;
|
|
1233
|
-
if (/^# /.test(v)) {
|
|
1234
|
-
var _v$split = v.split(" "),
|
|
1235
|
-
_v$split2 = _toArray(_v$split),
|
|
1236
|
-
_ = _v$split2[0],
|
|
1237
|
-
type = _v$split2[1],
|
|
1238
|
-
name = _v$split2[2],
|
|
1239
|
-
rest = _v$split2.slice(3);
|
|
1240
|
-
if (!_metrics[name]) _metrics[name] = {
|
|
1241
|
-
index: ++index,
|
|
1242
|
-
values: []
|
|
1243
|
-
};
|
|
1244
|
-
_metrics[name][type] = rest.join(" ");
|
|
1245
|
-
} else if (v !== "") {
|
|
1246
|
-
if (/{/.test(v)) {
|
|
1247
|
-
var _v$split3 = v.split("{"),
|
|
1248
|
-
_v$split4 = _slicedToArray(_v$split3, 2),
|
|
1249
|
-
_name = _v$split4[0],
|
|
1250
|
-
_rest = _v$split4[1];
|
|
1251
|
-
if (!_metrics[_name]) _metrics[_name] = {
|
|
1252
|
-
index: ++index,
|
|
1253
|
-
values: []
|
|
1254
|
-
};
|
|
1255
|
-
var _rest$split = _rest.split("}"),
|
|
1256
|
-
_rest$split2 = _slicedToArray(_rest$split, 2),
|
|
1257
|
-
params = _rest$split2[0],
|
|
1258
|
-
val = _rest$split2[1];
|
|
1259
|
-
var _params = {};
|
|
1260
|
-
var _iterator2 = _createForOfIteratorHelper(params.split(",")),
|
|
1261
|
-
_step2;
|
|
1262
|
-
try {
|
|
1263
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1264
|
-
var _v = _step2.value;
|
|
1265
|
-
var _v$trim$split = _v.trim().split("="),
|
|
1266
|
-
_v$trim$split2 = _slicedToArray(_v$trim$split, 2),
|
|
1267
|
-
key = _v$trim$split2[0],
|
|
1268
|
-
_val = _v$trim$split2[1];
|
|
1269
|
-
_params[key] = _val.replace(/"/g, "");
|
|
1270
|
-
}
|
|
1271
|
-
} catch (err) {
|
|
1272
|
-
_iterator2.e(err);
|
|
1273
|
-
} finally {
|
|
1274
|
-
_iterator2.f();
|
|
1275
|
-
}
|
|
1276
|
-
_metrics[_name].values.push({
|
|
1277
|
-
value: val.trim(),
|
|
1278
|
-
params: _params
|
|
1279
|
-
});
|
|
1280
|
-
} else {
|
|
1281
|
-
var _v$split5 = v.split(" "),
|
|
1282
|
-
_v$split6 = _slicedToArray(_v$split5, 2),
|
|
1283
|
-
_name2 = _v$split6[0],
|
|
1284
|
-
_val2 = _v$split6[1];
|
|
1285
|
-
if (!_metrics[_name2]) _metrics[_name2] = {
|
|
1286
|
-
index: ++index,
|
|
1287
|
-
values: []
|
|
1288
|
-
};
|
|
1289
|
-
_metrics[_name2].values.push({
|
|
1290
|
-
value: _val2
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
} catch (err) {
|
|
1296
|
-
_iterator.e(err);
|
|
1297
|
-
} finally {
|
|
1298
|
-
_iterator.f();
|
|
1299
|
-
}
|
|
1300
|
-
return _metrics;
|
|
1301
|
-
}
|
|
1302
877
|
}, {
|
|
1303
878
|
key: "now",
|
|
1304
879
|
value: function () {
|
|
1305
|
-
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1306
|
-
var pid,
|
|
1307
|
-
return _regeneratorRuntime().wrap(function
|
|
1308
|
-
while (1) switch (
|
|
880
|
+
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref9) {
|
|
881
|
+
var pid, _ref9$path, path;
|
|
882
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
883
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1309
884
|
case 0:
|
|
1310
|
-
pid =
|
|
885
|
+
pid = _ref9.pid, _ref9$path = _ref9.path, path = _ref9$path === void 0 ? "" : _ref9$path;
|
|
1311
886
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1312
|
-
|
|
887
|
+
_context23.next = 4;
|
|
1313
888
|
return this.getJSON({
|
|
1314
889
|
path: "/".concat(pid, "/now").concat(path)
|
|
1315
890
|
});
|
|
1316
891
|
case 4:
|
|
1317
|
-
return
|
|
892
|
+
return _context23.abrupt("return", _context23.sent);
|
|
1318
893
|
case 5:
|
|
1319
894
|
case "end":
|
|
1320
|
-
return
|
|
895
|
+
return _context23.stop();
|
|
1321
896
|
}
|
|
1322
|
-
},
|
|
897
|
+
}, _callee23, this);
|
|
1323
898
|
}));
|
|
1324
|
-
function now(
|
|
899
|
+
function now(_x17) {
|
|
1325
900
|
return _now.apply(this, arguments);
|
|
1326
901
|
}
|
|
1327
902
|
return now;
|
|
@@ -1329,26 +904,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
1329
904
|
}, {
|
|
1330
905
|
key: "slot",
|
|
1331
906
|
value: function () {
|
|
1332
|
-
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1333
|
-
var pid,
|
|
1334
|
-
return _regeneratorRuntime().wrap(function
|
|
1335
|
-
while (1) switch (
|
|
907
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref10) {
|
|
908
|
+
var pid, _ref10$path, path;
|
|
909
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
910
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1336
911
|
case 0:
|
|
1337
|
-
pid =
|
|
912
|
+
pid = _ref10.pid, _ref10$path = _ref10.path, path = _ref10$path === void 0 ? "" : _ref10$path;
|
|
1338
913
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1339
|
-
|
|
914
|
+
_context24.next = 4;
|
|
1340
915
|
return this.getJSON({
|
|
1341
916
|
path: "/".concat(pid, "/slot").concat(path)
|
|
1342
917
|
});
|
|
1343
918
|
case 4:
|
|
1344
|
-
return
|
|
919
|
+
return _context24.abrupt("return", _context24.sent);
|
|
1345
920
|
case 5:
|
|
1346
921
|
case "end":
|
|
1347
|
-
return
|
|
922
|
+
return _context24.stop();
|
|
1348
923
|
}
|
|
1349
|
-
},
|
|
924
|
+
}, _callee24, this);
|
|
1350
925
|
}));
|
|
1351
|
-
function slot(
|
|
926
|
+
function slot(_x18) {
|
|
1352
927
|
return _slot.apply(this, arguments);
|
|
1353
928
|
}
|
|
1354
929
|
return slot;
|
|
@@ -1356,71 +931,59 @@ var HB = /*#__PURE__*/function () {
|
|
|
1356
931
|
}, {
|
|
1357
932
|
key: "messages",
|
|
1358
933
|
value: function () {
|
|
1359
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1360
|
-
var
|
|
1361
|
-
var
|
|
934
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
935
|
+
var _this = this;
|
|
936
|
+
var _ref11,
|
|
1362
937
|
pid,
|
|
1363
938
|
from,
|
|
1364
939
|
to,
|
|
1365
940
|
limit,
|
|
1366
941
|
params,
|
|
1367
|
-
_yield$this$get,
|
|
1368
|
-
body,
|
|
1369
942
|
res,
|
|
1370
|
-
|
|
1371
|
-
return _regeneratorRuntime().wrap(function
|
|
1372
|
-
while (1) switch (
|
|
943
|
+
_args26 = arguments;
|
|
944
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
945
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1373
946
|
case 0:
|
|
1374
|
-
|
|
947
|
+
_ref11 = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {}, pid = _ref11.pid, from = _ref11.from, to = _ref11.to, limit = _ref11.limit;
|
|
1375
948
|
params = "target=".concat(pid);
|
|
1376
949
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
1377
950
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
1378
951
|
params += "&accept=application/aos-2";
|
|
1379
|
-
|
|
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;
|
|
952
|
+
_context26.next = 7;
|
|
1390
953
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
1391
954
|
return r.json();
|
|
1392
955
|
});
|
|
1393
|
-
case
|
|
1394
|
-
res =
|
|
956
|
+
case 7:
|
|
957
|
+
res = _context26.sent;
|
|
1395
958
|
if (res.page_info.has_next_page) {
|
|
1396
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
959
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1397
960
|
var from2;
|
|
1398
|
-
return _regeneratorRuntime().wrap(function
|
|
1399
|
-
while (1) switch (
|
|
961
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
962
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1400
963
|
case 0:
|
|
1401
964
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
1402
|
-
|
|
1403
|
-
return
|
|
965
|
+
_context25.next = 3;
|
|
966
|
+
return _this.messages({
|
|
1404
967
|
pid: pid,
|
|
1405
968
|
from: from2,
|
|
1406
969
|
to: to,
|
|
1407
970
|
limit: limit
|
|
1408
971
|
});
|
|
1409
972
|
case 3:
|
|
1410
|
-
return
|
|
973
|
+
return _context25.abrupt("return", _context25.sent);
|
|
1411
974
|
case 4:
|
|
1412
975
|
case "end":
|
|
1413
|
-
return
|
|
976
|
+
return _context25.stop();
|
|
1414
977
|
}
|
|
1415
|
-
},
|
|
978
|
+
}, _callee25);
|
|
1416
979
|
}));
|
|
1417
980
|
}
|
|
1418
|
-
return
|
|
1419
|
-
case
|
|
981
|
+
return _context26.abrupt("return", res);
|
|
982
|
+
case 10:
|
|
1420
983
|
case "end":
|
|
1421
|
-
return
|
|
984
|
+
return _context26.stop();
|
|
1422
985
|
}
|
|
1423
|
-
},
|
|
986
|
+
}, _callee26, this);
|
|
1424
987
|
}));
|
|
1425
988
|
function messages() {
|
|
1426
989
|
return _messages.apply(this, arguments);
|
|
@@ -1430,24 +993,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1430
993
|
}, {
|
|
1431
994
|
key: "spawnLegacy",
|
|
1432
995
|
value: function () {
|
|
1433
|
-
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1434
|
-
var
|
|
996
|
+
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
997
|
+
var _ref13,
|
|
1435
998
|
module,
|
|
1436
|
-
|
|
999
|
+
_ref13$tags,
|
|
1437
1000
|
tags,
|
|
1438
1001
|
data,
|
|
1439
1002
|
t,
|
|
1440
|
-
|
|
1441
|
-
return _regeneratorRuntime().wrap(function
|
|
1442
|
-
while (1) switch (
|
|
1003
|
+
_args27 = arguments;
|
|
1004
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1005
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1443
1006
|
case 0:
|
|
1444
|
-
|
|
1007
|
+
_ref13 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, module = _ref13.module, _ref13$tags = _ref13.tags, tags = _ref13$tags === void 0 ? {} : _ref13$tags, data = _ref13.data;
|
|
1008
|
+
_context27.next = 3;
|
|
1009
|
+
return this.setInfo();
|
|
1010
|
+
case 3:
|
|
1445
1011
|
t = {
|
|
1446
|
-
|
|
1447
|
-
"
|
|
1448
|
-
|
|
1012
|
+
type: "Process",
|
|
1013
|
+
"data-protocol": "ao",
|
|
1014
|
+
variant: "ao.TN.1",
|
|
1449
1015
|
scheduler: this._info.address,
|
|
1450
|
-
|
|
1016
|
+
authority: this._info.address,
|
|
1451
1017
|
"scheduler-location": this._info.address,
|
|
1452
1018
|
"random-seed": seed(16),
|
|
1453
1019
|
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
@@ -1461,15 +1027,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1461
1027
|
};
|
|
1462
1028
|
if (data) t.data = data;
|
|
1463
1029
|
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1464
|
-
|
|
1030
|
+
_context27.next = 8;
|
|
1465
1031
|
return this.spawn(tags);
|
|
1466
|
-
case
|
|
1467
|
-
return
|
|
1468
|
-
case
|
|
1032
|
+
case 8:
|
|
1033
|
+
return _context27.abrupt("return", _context27.sent);
|
|
1034
|
+
case 9:
|
|
1469
1035
|
case "end":
|
|
1470
|
-
return
|
|
1036
|
+
return _context27.stop();
|
|
1471
1037
|
}
|
|
1472
|
-
},
|
|
1038
|
+
}, _callee27, this);
|
|
1473
1039
|
}));
|
|
1474
1040
|
function spawnLegacy() {
|
|
1475
1041
|
return _spawnLegacy.apply(this, arguments);
|
|
@@ -1479,22 +1045,22 @@ var HB = /*#__PURE__*/function () {
|
|
|
1479
1045
|
}, {
|
|
1480
1046
|
key: "results",
|
|
1481
1047
|
value: function () {
|
|
1482
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1483
|
-
var
|
|
1048
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1049
|
+
var _ref14,
|
|
1484
1050
|
process,
|
|
1485
1051
|
limit,
|
|
1486
|
-
|
|
1052
|
+
_ref14$sort,
|
|
1487
1053
|
sort,
|
|
1488
1054
|
from,
|
|
1489
1055
|
to,
|
|
1490
1056
|
params,
|
|
1491
1057
|
addParam,
|
|
1492
1058
|
res,
|
|
1493
|
-
|
|
1494
|
-
return _regeneratorRuntime().wrap(function
|
|
1495
|
-
while (1) switch (
|
|
1059
|
+
_args28 = arguments;
|
|
1060
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1061
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1496
1062
|
case 0:
|
|
1497
|
-
|
|
1063
|
+
_ref14 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, process = _ref14.process, limit = _ref14.limit, _ref14$sort = _ref14.sort, sort = _ref14$sort === void 0 ? "DESC" : _ref14$sort, from = _ref14.from, to = _ref14.to;
|
|
1498
1064
|
params = "";
|
|
1499
1065
|
addParam = function addParam(key, val) {
|
|
1500
1066
|
params += params === "" ? "?" : "&";
|
|
@@ -1504,7 +1070,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1504
1070
|
if (sort) addParam("sort", sort);
|
|
1505
1071
|
if (from) addParam("from", from);
|
|
1506
1072
|
if (to) addParam("to", to);
|
|
1507
|
-
|
|
1073
|
+
_context28.next = 9;
|
|
1508
1074
|
return this.post({
|
|
1509
1075
|
path: "/~relay@1.0/call",
|
|
1510
1076
|
method: "GET",
|
|
@@ -1512,13 +1078,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1512
1078
|
"content-type": "application/json"
|
|
1513
1079
|
});
|
|
1514
1080
|
case 9:
|
|
1515
|
-
res =
|
|
1516
|
-
return
|
|
1081
|
+
res = _context28.sent;
|
|
1082
|
+
return _context28.abrupt("return", JSON.parse(res.body));
|
|
1517
1083
|
case 11:
|
|
1518
1084
|
case "end":
|
|
1519
|
-
return
|
|
1085
|
+
return _context28.stop();
|
|
1520
1086
|
}
|
|
1521
|
-
},
|
|
1087
|
+
}, _callee28, this);
|
|
1522
1088
|
}));
|
|
1523
1089
|
function results() {
|
|
1524
1090
|
return _results.apply(this, arguments);
|
|
@@ -1528,27 +1094,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1528
1094
|
}, {
|
|
1529
1095
|
key: "dryrun",
|
|
1530
1096
|
value: function () {
|
|
1531
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1532
|
-
var
|
|
1533
|
-
|
|
1097
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1098
|
+
var _ref15,
|
|
1099
|
+
_ref15$tags,
|
|
1534
1100
|
tags,
|
|
1535
1101
|
pid,
|
|
1536
1102
|
action,
|
|
1537
1103
|
data,
|
|
1538
1104
|
json,
|
|
1539
1105
|
res,
|
|
1540
|
-
|
|
1541
|
-
return _regeneratorRuntime().wrap(function
|
|
1542
|
-
while (1) switch (
|
|
1106
|
+
_args29 = arguments;
|
|
1107
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1108
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1543
1109
|
case 0:
|
|
1544
|
-
|
|
1110
|
+
_ref15 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, pid = _ref15.pid, action = _ref15.action, data = _ref15.data;
|
|
1545
1111
|
if (typeof action === "string") tags.Action = action;
|
|
1546
1112
|
json = {
|
|
1547
1113
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1548
1114
|
Owner: this.addr
|
|
1549
1115
|
};
|
|
1550
1116
|
if (data) json.Data = data;
|
|
1551
|
-
|
|
1117
|
+
_context29.next = 6;
|
|
1552
1118
|
return this.post({
|
|
1553
1119
|
path: "/~relay@1.0/call",
|
|
1554
1120
|
method: "POST",
|
|
@@ -1557,13 +1123,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1557
1123
|
"relay-body": JSON.stringify(json)
|
|
1558
1124
|
});
|
|
1559
1125
|
case 6:
|
|
1560
|
-
res =
|
|
1561
|
-
return
|
|
1126
|
+
res = _context29.sent;
|
|
1127
|
+
return _context29.abrupt("return", JSON.parse(res.body));
|
|
1562
1128
|
case 8:
|
|
1563
1129
|
case "end":
|
|
1564
|
-
return
|
|
1130
|
+
return _context29.stop();
|
|
1565
1131
|
}
|
|
1566
|
-
},
|
|
1132
|
+
}, _callee29, this);
|
|
1567
1133
|
}));
|
|
1568
1134
|
function dryrun() {
|
|
1569
1135
|
return _dryrun.apply(this, arguments);
|
|
@@ -1573,15 +1139,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1573
1139
|
}, {
|
|
1574
1140
|
key: "commit",
|
|
1575
1141
|
value: function () {
|
|
1576
|
-
var
|
|
1142
|
+
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(obj, opts) {
|
|
1577
1143
|
var msg, hmacId, rsaId, committer, meta, meta2, sigs;
|
|
1578
|
-
return _regeneratorRuntime().wrap(function
|
|
1579
|
-
while (1) switch (
|
|
1144
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1145
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1580
1146
|
case 0:
|
|
1581
|
-
|
|
1147
|
+
_context30.next = 2;
|
|
1582
1148
|
return this.sign(obj, opts);
|
|
1583
1149
|
case 2:
|
|
1584
|
-
msg =
|
|
1150
|
+
msg = _context30.sent;
|
|
1585
1151
|
hmacId = (0, _utils.hmacid)(msg.headers);
|
|
1586
1152
|
rsaId = (0, _utils.rsaid)(msg.headers);
|
|
1587
1153
|
committer = this.addr;
|
|
@@ -1597,57 +1163,193 @@ var HB = /*#__PURE__*/function () {
|
|
|
1597
1163
|
signature: msg.headers.signature,
|
|
1598
1164
|
"signature-input": msg.headers["signature-input"]
|
|
1599
1165
|
};
|
|
1600
|
-
return
|
|
1166
|
+
return _context30.abrupt("return", _objectSpread({
|
|
1601
1167
|
commitments: _defineProperty(_defineProperty({}, rsaId, _objectSpread(_objectSpread({}, meta), {}, {
|
|
1602
1168
|
committer: committer
|
|
1603
1169
|
}, sigs)), hmacId, _objectSpread(_objectSpread({}, meta2), sigs))
|
|
1604
1170
|
}, obj));
|
|
1605
1171
|
case 10:
|
|
1606
1172
|
case "end":
|
|
1607
|
-
return
|
|
1173
|
+
return _context30.stop();
|
|
1608
1174
|
}
|
|
1609
|
-
},
|
|
1175
|
+
}, _callee30, this);
|
|
1610
1176
|
}));
|
|
1611
|
-
function commit(
|
|
1612
|
-
return
|
|
1177
|
+
function commit(_x19, _x20) {
|
|
1178
|
+
return _commit.apply(this, arguments);
|
|
1613
1179
|
}
|
|
1614
1180
|
return commit;
|
|
1615
1181
|
}()
|
|
1182
|
+
}, {
|
|
1183
|
+
key: "p",
|
|
1184
|
+
value: function () {
|
|
1185
|
+
var _p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(path) {
|
|
1186
|
+
var _, _args$_, _args$, _args$$path, _yield$this$post$out, _yield$this$post;
|
|
1187
|
+
var _len,
|
|
1188
|
+
args,
|
|
1189
|
+
_key,
|
|
1190
|
+
_args31 = arguments;
|
|
1191
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1192
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1193
|
+
case 0:
|
|
1194
|
+
for (_len = _args31.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1195
|
+
args[_key - 1] = _args31[_key];
|
|
1196
|
+
}
|
|
1197
|
+
(_args$_ = args[_ = 0]) !== null && _args$_ !== void 0 ? _args$_ : args[_] = {};
|
|
1198
|
+
(_args$$path = (_args$ = args[0]).path) !== null && _args$$path !== void 0 ? _args$$path : _args$.path = path;
|
|
1199
|
+
_context31.next = 5;
|
|
1200
|
+
return this.post.apply(this, args);
|
|
1201
|
+
case 5:
|
|
1202
|
+
_context31.t2 = _yield$this$post = _context31.sent;
|
|
1203
|
+
_context31.t1 = _context31.t2 === null;
|
|
1204
|
+
if (_context31.t1) {
|
|
1205
|
+
_context31.next = 9;
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
_context31.t1 = _yield$this$post === void 0;
|
|
1209
|
+
case 9:
|
|
1210
|
+
if (!_context31.t1) {
|
|
1211
|
+
_context31.next = 13;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
_context31.t3 = void 0;
|
|
1215
|
+
_context31.next = 14;
|
|
1216
|
+
break;
|
|
1217
|
+
case 13:
|
|
1218
|
+
_context31.t3 = _yield$this$post.out;
|
|
1219
|
+
case 14:
|
|
1220
|
+
_context31.t4 = _yield$this$post$out = _context31.t3;
|
|
1221
|
+
_context31.t0 = _context31.t4 !== null;
|
|
1222
|
+
if (!_context31.t0) {
|
|
1223
|
+
_context31.next = 18;
|
|
1224
|
+
break;
|
|
1225
|
+
}
|
|
1226
|
+
_context31.t0 = _yield$this$post$out !== void 0;
|
|
1227
|
+
case 18:
|
|
1228
|
+
if (!_context31.t0) {
|
|
1229
|
+
_context31.next = 22;
|
|
1230
|
+
break;
|
|
1231
|
+
}
|
|
1232
|
+
_context31.t5 = _yield$this$post$out;
|
|
1233
|
+
_context31.next = 23;
|
|
1234
|
+
break;
|
|
1235
|
+
case 22:
|
|
1236
|
+
_context31.t5 = null;
|
|
1237
|
+
case 23:
|
|
1238
|
+
return _context31.abrupt("return", _context31.t5);
|
|
1239
|
+
case 24:
|
|
1240
|
+
case "end":
|
|
1241
|
+
return _context31.stop();
|
|
1242
|
+
}
|
|
1243
|
+
}, _callee31, this);
|
|
1244
|
+
}));
|
|
1245
|
+
function p(_x21) {
|
|
1246
|
+
return _p.apply(this, arguments);
|
|
1247
|
+
}
|
|
1248
|
+
return p;
|
|
1249
|
+
}()
|
|
1616
1250
|
}, {
|
|
1617
1251
|
key: "post",
|
|
1618
1252
|
value: function () {
|
|
1619
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1253
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(obj, json) {
|
|
1620
1254
|
var _json;
|
|
1621
|
-
return _regeneratorRuntime().wrap(function
|
|
1622
|
-
while (1) switch (
|
|
1255
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1256
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1623
1257
|
case 0:
|
|
1624
1258
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1625
1259
|
obj.path += _json;
|
|
1626
|
-
|
|
1627
|
-
|
|
1260
|
+
_context32.t0 = this;
|
|
1261
|
+
_context32.next = 5;
|
|
1628
1262
|
return this.sign(obj);
|
|
1629
1263
|
case 5:
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
return
|
|
1264
|
+
_context32.t1 = _context32.sent;
|
|
1265
|
+
_context32.next = 8;
|
|
1266
|
+
return _context32.t0.send.call(_context32.t0, _context32.t1);
|
|
1633
1267
|
case 8:
|
|
1634
|
-
return
|
|
1268
|
+
return _context32.abrupt("return", _context32.sent);
|
|
1635
1269
|
case 9:
|
|
1636
1270
|
case "end":
|
|
1637
|
-
return
|
|
1271
|
+
return _context32.stop();
|
|
1638
1272
|
}
|
|
1639
|
-
},
|
|
1273
|
+
}, _callee32, this);
|
|
1640
1274
|
}));
|
|
1641
|
-
function post(
|
|
1275
|
+
function post(_x22, _x23) {
|
|
1642
1276
|
return _post.apply(this, arguments);
|
|
1643
1277
|
}
|
|
1644
1278
|
return post;
|
|
1645
1279
|
}()
|
|
1280
|
+
}, {
|
|
1281
|
+
key: "g",
|
|
1282
|
+
value: function () {
|
|
1283
|
+
var _g = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(path) {
|
|
1284
|
+
var _2, _args$_2, _args$2, _args$2$path, _yield$this$get$out, _yield$this$get;
|
|
1285
|
+
var _len2,
|
|
1286
|
+
args,
|
|
1287
|
+
_key2,
|
|
1288
|
+
_args33 = arguments;
|
|
1289
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1290
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1291
|
+
case 0:
|
|
1292
|
+
for (_len2 = _args33.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1293
|
+
args[_key2 - 1] = _args33[_key2];
|
|
1294
|
+
}
|
|
1295
|
+
(_args$_2 = args[_2 = 0]) !== null && _args$_2 !== void 0 ? _args$_2 : args[_2] = {};
|
|
1296
|
+
(_args$2$path = (_args$2 = args[0]).path) !== null && _args$2$path !== void 0 ? _args$2$path : _args$2.path = path;
|
|
1297
|
+
_context33.next = 5;
|
|
1298
|
+
return this.get.apply(this, args);
|
|
1299
|
+
case 5:
|
|
1300
|
+
_context33.t2 = _yield$this$get = _context33.sent;
|
|
1301
|
+
_context33.t1 = _context33.t2 === null;
|
|
1302
|
+
if (_context33.t1) {
|
|
1303
|
+
_context33.next = 9;
|
|
1304
|
+
break;
|
|
1305
|
+
}
|
|
1306
|
+
_context33.t1 = _yield$this$get === void 0;
|
|
1307
|
+
case 9:
|
|
1308
|
+
if (!_context33.t1) {
|
|
1309
|
+
_context33.next = 13;
|
|
1310
|
+
break;
|
|
1311
|
+
}
|
|
1312
|
+
_context33.t3 = void 0;
|
|
1313
|
+
_context33.next = 14;
|
|
1314
|
+
break;
|
|
1315
|
+
case 13:
|
|
1316
|
+
_context33.t3 = _yield$this$get.out;
|
|
1317
|
+
case 14:
|
|
1318
|
+
_context33.t4 = _yield$this$get$out = _context33.t3;
|
|
1319
|
+
_context33.t0 = _context33.t4 !== null;
|
|
1320
|
+
if (!_context33.t0) {
|
|
1321
|
+
_context33.next = 18;
|
|
1322
|
+
break;
|
|
1323
|
+
}
|
|
1324
|
+
_context33.t0 = _yield$this$get$out !== void 0;
|
|
1325
|
+
case 18:
|
|
1326
|
+
if (!_context33.t0) {
|
|
1327
|
+
_context33.next = 22;
|
|
1328
|
+
break;
|
|
1329
|
+
}
|
|
1330
|
+
_context33.t5 = _yield$this$get$out;
|
|
1331
|
+
_context33.next = 23;
|
|
1332
|
+
break;
|
|
1333
|
+
case 22:
|
|
1334
|
+
_context33.t5 = null;
|
|
1335
|
+
case 23:
|
|
1336
|
+
return _context33.abrupt("return", _context33.t5);
|
|
1337
|
+
case 24:
|
|
1338
|
+
case "end":
|
|
1339
|
+
return _context33.stop();
|
|
1340
|
+
}
|
|
1341
|
+
}, _callee33, this);
|
|
1342
|
+
}));
|
|
1343
|
+
function g(_x24) {
|
|
1344
|
+
return _g.apply(this, arguments);
|
|
1345
|
+
}
|
|
1346
|
+
return g;
|
|
1347
|
+
}()
|
|
1646
1348
|
}, {
|
|
1647
1349
|
key: "get",
|
|
1648
1350
|
value: function () {
|
|
1649
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1650
|
-
var
|
|
1351
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(_ref16) {
|
|
1352
|
+
var _path;
|
|
1651
1353
|
var path,
|
|
1652
1354
|
params,
|
|
1653
1355
|
json,
|
|
@@ -1658,14 +1360,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
1658
1360
|
response,
|
|
1659
1361
|
headers,
|
|
1660
1362
|
http,
|
|
1661
|
-
|
|
1662
|
-
return _regeneratorRuntime().wrap(function
|
|
1663
|
-
while (1) switch (
|
|
1363
|
+
_args34 = arguments;
|
|
1364
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1365
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1664
1366
|
case 0:
|
|
1665
|
-
path =
|
|
1666
|
-
json =
|
|
1367
|
+
path = _ref16.path, params = _objectWithoutProperties(_ref16, _excluded2);
|
|
1368
|
+
json = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : false;
|
|
1667
1369
|
_json = json ? "/~json@1.0/serialize" : "";
|
|
1668
|
-
(
|
|
1370
|
+
(_path = path) !== null && _path !== void 0 ? _path : path = "/~message@1.0";
|
|
1669
1371
|
if (!/^\//.test(path)) path = "/" + path;
|
|
1670
1372
|
_params = "";
|
|
1671
1373
|
if (!(0, _ramda.isEmpty)(params)) {
|
|
@@ -1675,33 +1377,33 @@ var HB = /*#__PURE__*/function () {
|
|
|
1675
1377
|
i++;
|
|
1676
1378
|
}
|
|
1677
1379
|
}
|
|
1678
|
-
|
|
1380
|
+
_context34.next = 9;
|
|
1679
1381
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1680
1382
|
case 9:
|
|
1681
|
-
response =
|
|
1383
|
+
response = _context34.sent;
|
|
1682
1384
|
headers = {};
|
|
1683
1385
|
response.headers.forEach(function (v, k) {
|
|
1684
1386
|
return headers[k] = v;
|
|
1685
1387
|
});
|
|
1686
|
-
|
|
1687
|
-
|
|
1388
|
+
_context34.t0 = headers;
|
|
1389
|
+
_context34.next = 15;
|
|
1688
1390
|
return response.text();
|
|
1689
1391
|
case 15:
|
|
1690
|
-
|
|
1691
|
-
|
|
1392
|
+
_context34.t1 = _context34.sent;
|
|
1393
|
+
_context34.t2 = response.status;
|
|
1692
1394
|
http = {
|
|
1693
|
-
headers:
|
|
1694
|
-
body:
|
|
1695
|
-
status:
|
|
1395
|
+
headers: _context34.t0,
|
|
1396
|
+
body: _context34.t1,
|
|
1397
|
+
status: _context34.t2
|
|
1696
1398
|
};
|
|
1697
|
-
return
|
|
1399
|
+
return _context34.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsig.from)(http)), http));
|
|
1698
1400
|
case 19:
|
|
1699
1401
|
case "end":
|
|
1700
|
-
return
|
|
1402
|
+
return _context34.stop();
|
|
1701
1403
|
}
|
|
1702
|
-
},
|
|
1404
|
+
}, _callee34, this);
|
|
1703
1405
|
}));
|
|
1704
|
-
function get(
|
|
1406
|
+
function get(_x25) {
|
|
1705
1407
|
return _get.apply(this, arguments);
|
|
1706
1408
|
}
|
|
1707
1409
|
return get;
|
|
@@ -1709,23 +1411,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1709
1411
|
}, {
|
|
1710
1412
|
key: "postJSON",
|
|
1711
1413
|
value: function () {
|
|
1712
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1414
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(args) {
|
|
1713
1415
|
var res;
|
|
1714
|
-
return _regeneratorRuntime().wrap(function
|
|
1715
|
-
while (1) switch (
|
|
1416
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1417
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1716
1418
|
case 0:
|
|
1717
|
-
|
|
1419
|
+
_context35.next = 2;
|
|
1718
1420
|
return this.post(args, true);
|
|
1719
1421
|
case 2:
|
|
1720
|
-
res =
|
|
1721
|
-
return
|
|
1422
|
+
res = _context35.sent;
|
|
1423
|
+
return _context35.abrupt("return", JSON.parse(res.body));
|
|
1722
1424
|
case 4:
|
|
1723
1425
|
case "end":
|
|
1724
|
-
return
|
|
1426
|
+
return _context35.stop();
|
|
1725
1427
|
}
|
|
1726
|
-
},
|
|
1428
|
+
}, _callee35, this);
|
|
1727
1429
|
}));
|
|
1728
|
-
function postJSON(
|
|
1430
|
+
function postJSON(_x26) {
|
|
1729
1431
|
return _postJSON.apply(this, arguments);
|
|
1730
1432
|
}
|
|
1731
1433
|
return postJSON;
|
|
@@ -1733,23 +1435,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
1733
1435
|
}, {
|
|
1734
1436
|
key: "getJSON",
|
|
1735
1437
|
value: function () {
|
|
1736
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1438
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(args) {
|
|
1737
1439
|
var res;
|
|
1738
|
-
return _regeneratorRuntime().wrap(function
|
|
1739
|
-
while (1) switch (
|
|
1440
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1441
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1740
1442
|
case 0:
|
|
1741
|
-
|
|
1443
|
+
_context36.next = 2;
|
|
1742
1444
|
return this.get(args, true);
|
|
1743
1445
|
case 2:
|
|
1744
|
-
res =
|
|
1745
|
-
return
|
|
1446
|
+
res = _context36.sent;
|
|
1447
|
+
return _context36.abrupt("return", JSON.parse(res.body));
|
|
1746
1448
|
case 4:
|
|
1747
1449
|
case "end":
|
|
1748
|
-
return
|
|
1450
|
+
return _context36.stop();
|
|
1749
1451
|
}
|
|
1750
|
-
},
|
|
1452
|
+
}, _callee36, this);
|
|
1751
1453
|
}));
|
|
1752
|
-
function getJSON(
|
|
1454
|
+
function getJSON(_x27) {
|
|
1753
1455
|
return _getJSON.apply(this, arguments);
|
|
1754
1456
|
}
|
|
1755
1457
|
return getJSON;
|