wao 0.21.2 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/adaptor-base.js +183 -162
- package/cjs/ao.js +1 -1
- package/cjs/aoconnect-base.js +70 -73
- package/cjs/bao.js +1 -1
- package/cjs/hb.js +896 -272
- package/cjs/hyperbeam-server.js +46 -0
- package/cjs/hyperbeam.js +86 -0
- package/cjs/server.js +1 -1
- package/cjs/signer.js +1016 -0
- package/cjs/signer2.js +1012 -0
- package/cjs/test.js +3 -1
- package/cjs/utils.js +39 -3
- package/esm/adaptor-base.js +4 -2
- package/esm/ao.js +1 -1
- package/esm/aoconnect-base.js +12 -12
- package/esm/ar.js +1 -1
- package/esm/bao.js +1 -1
- package/esm/bar.js +3 -0
- package/esm/gql.js +2 -1
- package/esm/hb.js +232 -43
- package/esm/helpers.js +1 -1
- package/esm/hyperbeam-server.js +21 -0
- package/esm/hyperbeam.js +57 -0
- package/esm/server.js +4 -1
- package/esm/signer.js +769 -0
- package/esm/signer2.js +762 -0
- package/esm/test.js +2 -0
- package/esm/utils.js +31 -3
- package/package.json +3 -2
package/cjs/hb.js
CHANGED
|
@@ -7,8 +7,8 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _aoconnect = require("@permaweb/aoconnect");
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
|
+
var _signer = require("./signer.js");
|
|
10
11
|
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); }
|
|
11
|
-
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; }
|
|
12
12
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
13
|
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; } }
|
|
14
14
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
@@ -18,6 +18,10 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
18
18
|
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; } } }; }
|
|
19
19
|
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; } }
|
|
20
20
|
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
21
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); }
|
|
22
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); }); }; }
|
|
23
27
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -25,215 +29,892 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
25
29
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
26
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
27
31
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
28
|
-
var
|
|
32
|
+
var seed = function seed(num) {
|
|
29
33
|
var array = new Uint8Array(num);
|
|
30
|
-
return crypto.getRandomValues(array);
|
|
34
|
+
return crypto.getRandomValues(array).toString();
|
|
31
35
|
};
|
|
32
36
|
var HB = /*#__PURE__*/function () {
|
|
33
37
|
function HB() {
|
|
38
|
+
var _this = this;
|
|
34
39
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
35
40
|
_ref$url = _ref.url,
|
|
36
|
-
url = _ref$url === void 0 ? "http://localhost:10001" : _ref$url
|
|
41
|
+
url = _ref$url === void 0 ? "http://localhost:10001" : _ref$url,
|
|
42
|
+
jwk = _ref.jwk;
|
|
37
43
|
_classCallCheck(this, HB);
|
|
38
44
|
this.url = url;
|
|
45
|
+
this.hyperbuddy = {
|
|
46
|
+
metrics: function () {
|
|
47
|
+
var _metrics2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
48
|
+
var args,
|
|
49
|
+
_args = arguments;
|
|
50
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
|
+
while (1) switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
args = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
54
|
+
_context.t0 = _this;
|
|
55
|
+
_context.next = 4;
|
|
56
|
+
return _this.fetch(_this.path("hyperbuddy", "metrics", false), false);
|
|
57
|
+
case 4:
|
|
58
|
+
_context.t1 = _context.sent;
|
|
59
|
+
return _context.abrupt("return", _context.t0.parseMetrics.call(_context.t0, _context.t1));
|
|
60
|
+
case 6:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee);
|
|
65
|
+
}));
|
|
66
|
+
function metrics() {
|
|
67
|
+
return _metrics2.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
return metrics;
|
|
70
|
+
}()
|
|
71
|
+
};
|
|
72
|
+
this.json = {
|
|
73
|
+
commit: function () {
|
|
74
|
+
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args) {
|
|
75
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
76
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
_context2.next = 2;
|
|
79
|
+
return _this.send(_objectSpread({
|
|
80
|
+
path: "/~json@1.0/commit"
|
|
81
|
+
}, args));
|
|
82
|
+
case 2:
|
|
83
|
+
return _context2.abrupt("return", _context2.sent);
|
|
84
|
+
case 3:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context2.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
}));
|
|
90
|
+
function commit(_x2) {
|
|
91
|
+
return _commit.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
return commit;
|
|
94
|
+
}(),
|
|
95
|
+
verify: function () {
|
|
96
|
+
var _verify = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(args) {
|
|
97
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
98
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
_context3.next = 2;
|
|
101
|
+
return _this.send(_objectSpread({
|
|
102
|
+
path: "/~json@1.0/verify"
|
|
103
|
+
}, args));
|
|
104
|
+
case 2:
|
|
105
|
+
return _context3.abrupt("return", _context3.sent);
|
|
106
|
+
case 3:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context3.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee3);
|
|
111
|
+
}));
|
|
112
|
+
function verify(_x3) {
|
|
113
|
+
return _verify.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
return verify;
|
|
116
|
+
}(),
|
|
117
|
+
deserialize: function () {
|
|
118
|
+
var _deserialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(args) {
|
|
119
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
120
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
_context4.next = 2;
|
|
123
|
+
return _this.send(_objectSpread({
|
|
124
|
+
path: "/~json@1.0/deserialize"
|
|
125
|
+
}, args));
|
|
126
|
+
case 2:
|
|
127
|
+
return _context4.abrupt("return", _context4.sent);
|
|
128
|
+
case 3:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context4.stop();
|
|
131
|
+
}
|
|
132
|
+
}, _callee4);
|
|
133
|
+
}));
|
|
134
|
+
function deserialize(_x4) {
|
|
135
|
+
return _deserialize.apply(this, arguments);
|
|
136
|
+
}
|
|
137
|
+
return deserialize;
|
|
138
|
+
}(),
|
|
139
|
+
serialize: function () {
|
|
140
|
+
var _serialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(args) {
|
|
141
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
142
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
143
|
+
case 0:
|
|
144
|
+
_context5.next = 2;
|
|
145
|
+
return _this.send(_objectSpread({
|
|
146
|
+
path: "/~json@1.0/serialize"
|
|
147
|
+
}, args));
|
|
148
|
+
case 2:
|
|
149
|
+
return _context5.abrupt("return", _context5.sent);
|
|
150
|
+
case 3:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context5.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee5);
|
|
155
|
+
}));
|
|
156
|
+
function serialize(_x5) {
|
|
157
|
+
return _serialize.apply(this, arguments);
|
|
158
|
+
}
|
|
159
|
+
return serialize;
|
|
160
|
+
}()
|
|
161
|
+
};
|
|
162
|
+
this.meta = {
|
|
163
|
+
info: function () {
|
|
164
|
+
var _info = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
165
|
+
var args,
|
|
166
|
+
_args$method,
|
|
167
|
+
method,
|
|
168
|
+
_args$json,
|
|
169
|
+
json,
|
|
170
|
+
key,
|
|
171
|
+
_args$json2,
|
|
172
|
+
_args$json3,
|
|
173
|
+
_args6 = arguments;
|
|
174
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
175
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
args = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
178
|
+
_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;
|
|
179
|
+
if (!(method.toLowerCase() === "post")) {
|
|
180
|
+
_context6.next = 8;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
_context6.next = 5;
|
|
184
|
+
return _this.send(_objectSpread({
|
|
185
|
+
path: "/~meta@1.0/info"
|
|
186
|
+
}, args));
|
|
187
|
+
case 5:
|
|
188
|
+
return _context6.abrupt("return", _context6.sent);
|
|
189
|
+
case 8:
|
|
190
|
+
if (!key) {
|
|
191
|
+
_context6.next = 14;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
_context6.next = 11;
|
|
195
|
+
return _this.fetch(_this.path("meta", "info/".concat(key), (_args$json2 = args.json) !== null && _args$json2 !== void 0 ? _args$json2 : false), (_args$json3 = args.json) !== null && _args$json3 !== void 0 ? _args$json3 : false);
|
|
196
|
+
case 11:
|
|
197
|
+
_context6.t0 = _context6.sent;
|
|
198
|
+
_context6.next = 17;
|
|
199
|
+
break;
|
|
200
|
+
case 14:
|
|
201
|
+
_context6.next = 16;
|
|
202
|
+
return _this.fetch(_this.path("meta", "info", json));
|
|
203
|
+
case 16:
|
|
204
|
+
_context6.t0 = _context6.sent;
|
|
205
|
+
case 17:
|
|
206
|
+
return _context6.abrupt("return", _context6.t0);
|
|
207
|
+
case 18:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context6.stop();
|
|
210
|
+
}
|
|
211
|
+
}, _callee6);
|
|
212
|
+
}));
|
|
213
|
+
function info() {
|
|
214
|
+
return _info.apply(this, arguments);
|
|
215
|
+
}
|
|
216
|
+
return info;
|
|
217
|
+
}(),
|
|
218
|
+
build: function () {
|
|
219
|
+
var _build = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
220
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
221
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
222
|
+
case 0:
|
|
223
|
+
_context7.next = 2;
|
|
224
|
+
return _this.fetch(_this.path("meta", "build"));
|
|
225
|
+
case 2:
|
|
226
|
+
return _context7.abrupt("return", _context7.sent);
|
|
227
|
+
case 3:
|
|
228
|
+
case "end":
|
|
229
|
+
return _context7.stop();
|
|
230
|
+
}
|
|
231
|
+
}, _callee7);
|
|
232
|
+
}));
|
|
233
|
+
function build() {
|
|
234
|
+
return _build.apply(this, arguments);
|
|
235
|
+
}
|
|
236
|
+
return build;
|
|
237
|
+
}()
|
|
238
|
+
};
|
|
239
|
+
if (jwk) this._init(jwk);
|
|
39
240
|
}
|
|
40
241
|
return _createClass(HB, [{
|
|
41
|
-
key: "
|
|
242
|
+
key: "_init",
|
|
243
|
+
value: function _init(jwk) {
|
|
244
|
+
this.signer = (0, _aoconnect.createSigner)(jwk, this.url);
|
|
245
|
+
this.addr = (0, _utils.toAddr)(jwk.n);
|
|
246
|
+
this._request2 = (0, _signer.createRequest)({
|
|
247
|
+
signer: this.signer,
|
|
248
|
+
url: this.url
|
|
249
|
+
});
|
|
250
|
+
var _connect = (0, _aoconnect.connect)({
|
|
251
|
+
MODE: "mainnet",
|
|
252
|
+
URL: this.url,
|
|
253
|
+
device: "",
|
|
254
|
+
signer: this.signer
|
|
255
|
+
}),
|
|
256
|
+
request = _connect.request;
|
|
257
|
+
this._request = request;
|
|
258
|
+
}
|
|
259
|
+
}, {
|
|
260
|
+
key: "init",
|
|
42
261
|
value: function () {
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
while (1) switch (_context.prev = _context.next) {
|
|
262
|
+
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(jwk) {
|
|
263
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
264
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
47
265
|
case 0:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
266
|
+
this._init(jwk);
|
|
267
|
+
_context8.next = 3;
|
|
268
|
+
return this.meta.info({});
|
|
269
|
+
case 3:
|
|
270
|
+
this._info = _context8.sent;
|
|
271
|
+
return _context8.abrupt("return", this);
|
|
272
|
+
case 5:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context8.stop();
|
|
275
|
+
}
|
|
276
|
+
}, _callee8, this);
|
|
277
|
+
}));
|
|
278
|
+
function init(_x6) {
|
|
279
|
+
return _init2.apply(this, arguments);
|
|
280
|
+
}
|
|
281
|
+
return init;
|
|
282
|
+
}()
|
|
283
|
+
}, {
|
|
284
|
+
key: "send",
|
|
285
|
+
value: function () {
|
|
286
|
+
var _send2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(args) {
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
288
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
289
|
+
case 0:
|
|
290
|
+
_context9.t0 = _signer.send;
|
|
291
|
+
_context9.next = 3;
|
|
292
|
+
return this._request2(args);
|
|
293
|
+
case 3:
|
|
294
|
+
_context9.t1 = _context9.sent;
|
|
295
|
+
_context9.next = 6;
|
|
296
|
+
return (0, _context9.t0)(_context9.t1);
|
|
297
|
+
case 6:
|
|
298
|
+
return _context9.abrupt("return", _context9.sent);
|
|
299
|
+
case 7:
|
|
300
|
+
case "end":
|
|
301
|
+
return _context9.stop();
|
|
302
|
+
}
|
|
303
|
+
}, _callee9, this);
|
|
304
|
+
}));
|
|
305
|
+
function send(_x7) {
|
|
306
|
+
return _send2.apply(this, arguments);
|
|
307
|
+
}
|
|
308
|
+
return send;
|
|
309
|
+
}()
|
|
310
|
+
}, {
|
|
311
|
+
key: "getImage",
|
|
312
|
+
value: function () {
|
|
313
|
+
var _getImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
314
|
+
var result;
|
|
315
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
316
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
317
|
+
case 0:
|
|
318
|
+
_context10.next = 2;
|
|
319
|
+
return this.send({
|
|
320
|
+
path: "/~wao@1.0/cache_wasm_image",
|
|
321
|
+
method: "POST",
|
|
322
|
+
filename: "test/aos-2-pure-xs.wasm"
|
|
51
323
|
});
|
|
52
324
|
case 2:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
index: ++index,
|
|
99
|
-
values: []
|
|
100
|
-
};
|
|
101
|
-
_metrics[_name2].values.push({
|
|
102
|
-
value: _val2
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
_iterator.e(err);
|
|
109
|
-
} finally {
|
|
110
|
-
_iterator.f();
|
|
111
|
-
}
|
|
112
|
-
return _context.abrupt("return", _metrics);
|
|
325
|
+
result = _context10.sent;
|
|
326
|
+
return _context10.abrupt("return", result.headers.get("image"));
|
|
327
|
+
case 4:
|
|
328
|
+
case "end":
|
|
329
|
+
return _context10.stop();
|
|
330
|
+
}
|
|
331
|
+
}, _callee10, this);
|
|
332
|
+
}));
|
|
333
|
+
function getImage() {
|
|
334
|
+
return _getImage.apply(this, arguments);
|
|
335
|
+
}
|
|
336
|
+
return getImage;
|
|
337
|
+
}()
|
|
338
|
+
}, {
|
|
339
|
+
key: "messageAOS",
|
|
340
|
+
value: function () {
|
|
341
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref2) {
|
|
342
|
+
var _pid;
|
|
343
|
+
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
344
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
345
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
346
|
+
case 0:
|
|
347
|
+
pid = _ref2.pid, _ref2$action = _ref2.action, action = _ref2$action === void 0 ? "Eval" : _ref2$action, _ref2$tags = _ref2.tags, tags = _ref2$tags === void 0 ? {} : _ref2$tags, data = _ref2.data;
|
|
348
|
+
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
349
|
+
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
350
|
+
device: "process@1.0",
|
|
351
|
+
method: "POST",
|
|
352
|
+
path: "/".concat(pid, "/schedule"),
|
|
353
|
+
scheduler: this.scheduler,
|
|
354
|
+
Type: "Message",
|
|
355
|
+
Action: action,
|
|
356
|
+
Target: pid
|
|
357
|
+
});
|
|
358
|
+
if (data) _tags.data = data;
|
|
359
|
+
_context11.next = 6;
|
|
360
|
+
return this.send(_tags);
|
|
361
|
+
case 6:
|
|
362
|
+
res = _context11.sent;
|
|
363
|
+
slot = res.headers.get("slot");
|
|
364
|
+
_context11.t0 = slot;
|
|
365
|
+
_context11.next = 11;
|
|
366
|
+
return this.computeAOS({
|
|
367
|
+
pid: pid,
|
|
368
|
+
slot: slot
|
|
369
|
+
});
|
|
113
370
|
case 11:
|
|
371
|
+
_context11.t1 = _context11.sent;
|
|
372
|
+
return _context11.abrupt("return", {
|
|
373
|
+
slot: _context11.t0,
|
|
374
|
+
outbox: _context11.t1
|
|
375
|
+
});
|
|
376
|
+
case 13:
|
|
114
377
|
case "end":
|
|
115
|
-
return
|
|
378
|
+
return _context11.stop();
|
|
116
379
|
}
|
|
117
|
-
},
|
|
380
|
+
}, _callee11, this);
|
|
118
381
|
}));
|
|
119
|
-
function
|
|
120
|
-
return
|
|
382
|
+
function messageAOS(_x8) {
|
|
383
|
+
return _messageAOS.apply(this, arguments);
|
|
121
384
|
}
|
|
122
|
-
return
|
|
385
|
+
return messageAOS;
|
|
123
386
|
}()
|
|
124
387
|
}, {
|
|
125
|
-
key: "
|
|
388
|
+
key: "path",
|
|
389
|
+
value: function path() {
|
|
390
|
+
var dev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "meta";
|
|
391
|
+
var _path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "info";
|
|
392
|
+
var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
393
|
+
var params = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
394
|
+
if (!/@/.test(dev)) dev += "@1.0";
|
|
395
|
+
var _params = "";
|
|
396
|
+
if (!(0, _ramda.isEmpty)(params)) {
|
|
397
|
+
var i = 0;
|
|
398
|
+
for (var k in params) {
|
|
399
|
+
_params += "".concat(i === 0 ? "?" : "&").concat(k, "=").concat(params[k]);
|
|
400
|
+
i++;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return "".concat(this.url, "/~").concat(dev, "/").concat(_path).concat(json ? "/serialize~json@1.0" : "").concat(_params);
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "text",
|
|
126
407
|
value: function () {
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
408
|
+
var _text = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(dev, path) {
|
|
409
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
410
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
131
411
|
case 0:
|
|
132
|
-
|
|
133
|
-
return fetch(
|
|
412
|
+
_context12.next = 2;
|
|
413
|
+
return this.fetch(this.path(dev, path, false), false);
|
|
414
|
+
case 2:
|
|
415
|
+
return _context12.abrupt("return", _context12.sent);
|
|
416
|
+
case 3:
|
|
417
|
+
case "end":
|
|
418
|
+
return _context12.stop();
|
|
419
|
+
}
|
|
420
|
+
}, _callee12, this);
|
|
421
|
+
}));
|
|
422
|
+
function text(_x9, _x10) {
|
|
423
|
+
return _text.apply(this, arguments);
|
|
424
|
+
}
|
|
425
|
+
return text;
|
|
426
|
+
}()
|
|
427
|
+
}, {
|
|
428
|
+
key: "json",
|
|
429
|
+
value: function () {
|
|
430
|
+
var _json = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(dev, path) {
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
432
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
_context13.next = 2;
|
|
435
|
+
return this.fetch(this.path(dev, path));
|
|
436
|
+
case 2:
|
|
437
|
+
return _context13.abrupt("return", _context13.sent);
|
|
438
|
+
case 3:
|
|
439
|
+
case "end":
|
|
440
|
+
return _context13.stop();
|
|
441
|
+
}
|
|
442
|
+
}, _callee13, this);
|
|
443
|
+
}));
|
|
444
|
+
function json(_x11, _x12) {
|
|
445
|
+
return _json.apply(this, arguments);
|
|
446
|
+
}
|
|
447
|
+
return json;
|
|
448
|
+
}()
|
|
449
|
+
}, {
|
|
450
|
+
key: "fetch",
|
|
451
|
+
value: function (_fetch) {
|
|
452
|
+
function fetch(_x) {
|
|
453
|
+
return _fetch.apply(this, arguments);
|
|
454
|
+
}
|
|
455
|
+
fetch.toString = function () {
|
|
456
|
+
return _fetch.toString();
|
|
457
|
+
};
|
|
458
|
+
return fetch;
|
|
459
|
+
}(/*#__PURE__*/function () {
|
|
460
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(url) {
|
|
461
|
+
var json,
|
|
462
|
+
_args14 = arguments;
|
|
463
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
464
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
465
|
+
case 0:
|
|
466
|
+
json = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : true;
|
|
467
|
+
_context14.next = 3;
|
|
468
|
+
return fetch(url).then(function (r) {
|
|
469
|
+
return json ? r.json() : r.text();
|
|
470
|
+
});
|
|
471
|
+
case 3:
|
|
472
|
+
return _context14.abrupt("return", _context14.sent);
|
|
473
|
+
case 4:
|
|
474
|
+
case "end":
|
|
475
|
+
return _context14.stop();
|
|
476
|
+
}
|
|
477
|
+
}, _callee14);
|
|
478
|
+
}));
|
|
479
|
+
return function (_x13) {
|
|
480
|
+
return _ref3.apply(this, arguments);
|
|
481
|
+
};
|
|
482
|
+
}())
|
|
483
|
+
}, {
|
|
484
|
+
key: "computeAOS",
|
|
485
|
+
value: function () {
|
|
486
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref4) {
|
|
487
|
+
var pid, slot;
|
|
488
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
489
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
490
|
+
case 0:
|
|
491
|
+
pid = _ref4.pid, slot = _ref4.slot;
|
|
492
|
+
_context15.next = 3;
|
|
493
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/outbox/serialize~json@1.0?slot=").concat(slot)).then(function (r) {
|
|
494
|
+
return r.json();
|
|
495
|
+
});
|
|
496
|
+
case 3:
|
|
497
|
+
return _context15.abrupt("return", _context15.sent);
|
|
498
|
+
case 4:
|
|
499
|
+
case "end":
|
|
500
|
+
return _context15.stop();
|
|
501
|
+
}
|
|
502
|
+
}, _callee15, this);
|
|
503
|
+
}));
|
|
504
|
+
function computeAOS(_x14) {
|
|
505
|
+
return _computeAOS.apply(this, arguments);
|
|
506
|
+
}
|
|
507
|
+
return computeAOS;
|
|
508
|
+
}()
|
|
509
|
+
}, {
|
|
510
|
+
key: "compute",
|
|
511
|
+
value: function () {
|
|
512
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(pid, slot) {
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
514
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
515
|
+
case 0:
|
|
516
|
+
_context16.next = 2;
|
|
517
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/serialize~json@1.0?slot=").concat(slot)).then(function (r) {
|
|
134
518
|
return r.json();
|
|
135
519
|
});
|
|
136
520
|
case 2:
|
|
137
|
-
|
|
138
|
-
|
|
521
|
+
return _context16.abrupt("return", _context16.sent);
|
|
522
|
+
case 3:
|
|
523
|
+
case "end":
|
|
524
|
+
return _context16.stop();
|
|
525
|
+
}
|
|
526
|
+
}, _callee16, this);
|
|
527
|
+
}));
|
|
528
|
+
function compute(_x15, _x16) {
|
|
529
|
+
return _compute.apply(this, arguments);
|
|
530
|
+
}
|
|
531
|
+
return compute;
|
|
532
|
+
}()
|
|
533
|
+
}, {
|
|
534
|
+
key: "computeLegacy",
|
|
535
|
+
value: function () {
|
|
536
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(pid, slot) {
|
|
537
|
+
var json;
|
|
538
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
539
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
540
|
+
case 0:
|
|
541
|
+
_context17.next = 2;
|
|
542
|
+
return this.compute(pid, slot);
|
|
543
|
+
case 2:
|
|
544
|
+
json = _context17.sent;
|
|
545
|
+
return _context17.abrupt("return", JSON.parse(json.results.json.body));
|
|
139
546
|
case 4:
|
|
140
547
|
case "end":
|
|
141
|
-
return
|
|
548
|
+
return _context17.stop();
|
|
142
549
|
}
|
|
143
|
-
},
|
|
550
|
+
}, _callee17, this);
|
|
144
551
|
}));
|
|
145
|
-
function
|
|
146
|
-
return
|
|
552
|
+
function computeLegacy(_x17, _x18) {
|
|
553
|
+
return _computeLegacy.apply(this, arguments);
|
|
147
554
|
}
|
|
148
|
-
return
|
|
555
|
+
return computeLegacy;
|
|
149
556
|
}()
|
|
150
557
|
}, {
|
|
151
|
-
key: "
|
|
558
|
+
key: "spawn",
|
|
152
559
|
value: function () {
|
|
153
|
-
var
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
560
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
561
|
+
var _this$scheduler, _this$pid;
|
|
562
|
+
var tags,
|
|
563
|
+
addr,
|
|
564
|
+
spawned,
|
|
565
|
+
pid,
|
|
566
|
+
res,
|
|
567
|
+
_args18 = arguments;
|
|
568
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
569
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
157
570
|
case 0:
|
|
158
|
-
|
|
159
|
-
|
|
571
|
+
tags = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
572
|
+
_context18.next = 3;
|
|
573
|
+
return this.meta.info({
|
|
574
|
+
key: "address"
|
|
575
|
+
});
|
|
576
|
+
case 3:
|
|
577
|
+
addr = _context18.sent;
|
|
578
|
+
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
579
|
+
_context18.next = 7;
|
|
580
|
+
return this.send((0, _ramda.mergeLeft)(tags, {
|
|
581
|
+
device: "process@1.0",
|
|
582
|
+
path: "/schedule",
|
|
583
|
+
scheduler: this.scheduler,
|
|
584
|
+
"random-seed": seed(16),
|
|
585
|
+
Type: "Process",
|
|
586
|
+
"scheduler-device": "scheduler@1.0",
|
|
587
|
+
"execution-device": "wao@1.0"
|
|
588
|
+
}));
|
|
589
|
+
case 7:
|
|
590
|
+
spawned = _context18.sent;
|
|
591
|
+
pid = spawned.headers.get("process");
|
|
592
|
+
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
593
|
+
_context18.next = 12;
|
|
594
|
+
return this.compute(pid, 0);
|
|
595
|
+
case 12:
|
|
596
|
+
res = _context18.sent;
|
|
597
|
+
return _context18.abrupt("return", {
|
|
598
|
+
spawned: res,
|
|
599
|
+
pid: pid,
|
|
600
|
+
res: res
|
|
601
|
+
});
|
|
602
|
+
case 14:
|
|
603
|
+
case "end":
|
|
604
|
+
return _context18.stop();
|
|
605
|
+
}
|
|
606
|
+
}, _callee18, this);
|
|
607
|
+
}));
|
|
608
|
+
function spawn() {
|
|
609
|
+
return _spawn.apply(this, arguments);
|
|
610
|
+
}
|
|
611
|
+
return spawn;
|
|
612
|
+
}()
|
|
613
|
+
}, {
|
|
614
|
+
key: "message",
|
|
615
|
+
value: function () {
|
|
616
|
+
var _message = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
617
|
+
var _yield$this$schedule,
|
|
618
|
+
pid,
|
|
619
|
+
slot,
|
|
620
|
+
scheduled,
|
|
621
|
+
res,
|
|
622
|
+
_args19 = arguments;
|
|
623
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
624
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
625
|
+
case 0:
|
|
626
|
+
_context19.next = 2;
|
|
627
|
+
return this.schedule.apply(this, _args19);
|
|
160
628
|
case 2:
|
|
161
|
-
this
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return
|
|
170
|
-
|
|
629
|
+
_yield$this$schedule = _context19.sent;
|
|
630
|
+
pid = _yield$this$schedule.pid;
|
|
631
|
+
slot = _yield$this$schedule.slot;
|
|
632
|
+
scheduled = _yield$this$schedule.res;
|
|
633
|
+
_context19.next = 8;
|
|
634
|
+
return this.compute(pid, slot);
|
|
635
|
+
case 8:
|
|
636
|
+
res = _context19.sent;
|
|
637
|
+
return _context19.abrupt("return", {
|
|
638
|
+
slot: slot,
|
|
639
|
+
pid: pid,
|
|
640
|
+
res: res,
|
|
641
|
+
scheduled: scheduled
|
|
642
|
+
});
|
|
643
|
+
case 10:
|
|
171
644
|
case "end":
|
|
172
|
-
return
|
|
645
|
+
return _context19.stop();
|
|
173
646
|
}
|
|
174
|
-
},
|
|
647
|
+
}, _callee19, this);
|
|
175
648
|
}));
|
|
176
|
-
function
|
|
177
|
-
return
|
|
649
|
+
function message() {
|
|
650
|
+
return _message.apply(this, arguments);
|
|
178
651
|
}
|
|
179
|
-
return
|
|
652
|
+
return message;
|
|
653
|
+
}()
|
|
654
|
+
}, {
|
|
655
|
+
key: "schedule",
|
|
656
|
+
value: function () {
|
|
657
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
658
|
+
var _pid2, _scheduler;
|
|
659
|
+
var _ref5,
|
|
660
|
+
pid,
|
|
661
|
+
_ref5$tags,
|
|
662
|
+
tags,
|
|
663
|
+
data,
|
|
664
|
+
scheduler,
|
|
665
|
+
_tags,
|
|
666
|
+
res,
|
|
667
|
+
slot,
|
|
668
|
+
_args20 = arguments;
|
|
669
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
670
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
671
|
+
case 0:
|
|
672
|
+
_ref5 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, pid = _ref5.pid, _ref5$tags = _ref5.tags, tags = _ref5$tags === void 0 ? {} : _ref5$tags, data = _ref5.data, scheduler = _ref5.scheduler;
|
|
673
|
+
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
674
|
+
(_scheduler = scheduler) !== null && _scheduler !== void 0 ? _scheduler : scheduler = this.scheduler;
|
|
675
|
+
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
676
|
+
device: "process@1.0",
|
|
677
|
+
method: "POST",
|
|
678
|
+
path: "/".concat(pid, "/schedule"),
|
|
679
|
+
scheduler: scheduler,
|
|
680
|
+
Type: "Message",
|
|
681
|
+
Target: pid
|
|
682
|
+
});
|
|
683
|
+
if (data) _tags.data = data;
|
|
684
|
+
_context20.next = 7;
|
|
685
|
+
return this.send(_tags);
|
|
686
|
+
case 7:
|
|
687
|
+
res = _context20.sent;
|
|
688
|
+
slot = res.headers.get("slot");
|
|
689
|
+
return _context20.abrupt("return", {
|
|
690
|
+
slot: slot,
|
|
691
|
+
res: res,
|
|
692
|
+
pid: pid
|
|
693
|
+
});
|
|
694
|
+
case 10:
|
|
695
|
+
case "end":
|
|
696
|
+
return _context20.stop();
|
|
697
|
+
}
|
|
698
|
+
}, _callee20, this);
|
|
699
|
+
}));
|
|
700
|
+
function schedule() {
|
|
701
|
+
return _schedule.apply(this, arguments);
|
|
702
|
+
}
|
|
703
|
+
return schedule;
|
|
704
|
+
}()
|
|
705
|
+
}, {
|
|
706
|
+
key: "spawnAOS",
|
|
707
|
+
value: function () {
|
|
708
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(image) {
|
|
709
|
+
var _this$scheduler2, _image, _this$image, _this$pid2;
|
|
710
|
+
var addr, res, pid;
|
|
711
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
712
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
713
|
+
case 0:
|
|
714
|
+
_context21.next = 2;
|
|
715
|
+
return this.meta.info({
|
|
716
|
+
key: "address"
|
|
717
|
+
});
|
|
718
|
+
case 2:
|
|
719
|
+
addr = _context21.sent;
|
|
720
|
+
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
721
|
+
if (!((_image = image) !== null && _image !== void 0)) {
|
|
722
|
+
_context21.next = 8;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
_image;
|
|
726
|
+
_context21.next = 16;
|
|
727
|
+
break;
|
|
728
|
+
case 8:
|
|
729
|
+
if (!((_this$image = this.image) !== null && _this$image !== void 0)) {
|
|
730
|
+
_context21.next = 12;
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
_context21.t0 = _this$image;
|
|
734
|
+
_context21.next = 15;
|
|
735
|
+
break;
|
|
736
|
+
case 12:
|
|
737
|
+
_context21.next = 14;
|
|
738
|
+
return this.getImage();
|
|
739
|
+
case 14:
|
|
740
|
+
_context21.t0 = _context21.sent;
|
|
741
|
+
case 15:
|
|
742
|
+
image = _context21.t0;
|
|
743
|
+
case 16:
|
|
744
|
+
_context21.next = 18;
|
|
745
|
+
return this.send({
|
|
746
|
+
device: "process@1.0",
|
|
747
|
+
path: "/schedule",
|
|
748
|
+
scheduler: this.scheduler,
|
|
749
|
+
"Data-Protocol": "ao",
|
|
750
|
+
Variant: "ao.N.1",
|
|
751
|
+
"scheduler-location": this.scheduler,
|
|
752
|
+
Authority: this.scheduler,
|
|
753
|
+
"random-seed": seed(16),
|
|
754
|
+
Type: "Process",
|
|
755
|
+
image: image,
|
|
756
|
+
"scheduler-device": "scheduler@1.0",
|
|
757
|
+
"execution-device": "stack@1.0",
|
|
758
|
+
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "multipass@1.0"],
|
|
759
|
+
"output-prefix": "wasm",
|
|
760
|
+
"patch-from": "/results/outbox",
|
|
761
|
+
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
762
|
+
passes: 2
|
|
763
|
+
});
|
|
764
|
+
case 18:
|
|
765
|
+
res = _context21.sent;
|
|
766
|
+
pid = res.headers.get("process");
|
|
767
|
+
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
768
|
+
return _context21.abrupt("return", pid);
|
|
769
|
+
case 22:
|
|
770
|
+
case "end":
|
|
771
|
+
return _context21.stop();
|
|
772
|
+
}
|
|
773
|
+
}, _callee21, this);
|
|
774
|
+
}));
|
|
775
|
+
function spawnAOS(_x19) {
|
|
776
|
+
return _spawnAOS.apply(this, arguments);
|
|
777
|
+
}
|
|
778
|
+
return spawnAOS;
|
|
180
779
|
}()
|
|
780
|
+
}, {
|
|
781
|
+
key: "parseMetrics",
|
|
782
|
+
value: function parseMetrics(txt) {
|
|
783
|
+
var parts = txt.split(/\r?\n/);
|
|
784
|
+
var index = 0;
|
|
785
|
+
var _metrics = {};
|
|
786
|
+
var vals = [];
|
|
787
|
+
var desc = [];
|
|
788
|
+
var _iterator = _createForOfIteratorHelper(parts),
|
|
789
|
+
_step;
|
|
790
|
+
try {
|
|
791
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
792
|
+
var v = _step.value;
|
|
793
|
+
if (/^# /.test(v)) {
|
|
794
|
+
var _v$split = v.split(" "),
|
|
795
|
+
_v$split2 = _toArray(_v$split),
|
|
796
|
+
_ = _v$split2[0],
|
|
797
|
+
type = _v$split2[1],
|
|
798
|
+
name = _v$split2[2],
|
|
799
|
+
rest = _v$split2.slice(3);
|
|
800
|
+
if (!_metrics[name]) _metrics[name] = {
|
|
801
|
+
index: ++index,
|
|
802
|
+
values: []
|
|
803
|
+
};
|
|
804
|
+
_metrics[name][type] = rest.join(" ");
|
|
805
|
+
} else if (v !== "") {
|
|
806
|
+
if (/{/.test(v)) {
|
|
807
|
+
var _v$split3 = v.split("{"),
|
|
808
|
+
_v$split4 = _slicedToArray(_v$split3, 2),
|
|
809
|
+
_name = _v$split4[0],
|
|
810
|
+
_rest = _v$split4[1];
|
|
811
|
+
if (!_metrics[_name]) _metrics[_name] = {
|
|
812
|
+
index: ++index,
|
|
813
|
+
values: []
|
|
814
|
+
};
|
|
815
|
+
var _rest$split = _rest.split("}"),
|
|
816
|
+
_rest$split2 = _slicedToArray(_rest$split, 2),
|
|
817
|
+
params = _rest$split2[0],
|
|
818
|
+
val = _rest$split2[1];
|
|
819
|
+
var _params = {};
|
|
820
|
+
var _iterator2 = _createForOfIteratorHelper(params.split(",")),
|
|
821
|
+
_step2;
|
|
822
|
+
try {
|
|
823
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
824
|
+
var _v = _step2.value;
|
|
825
|
+
var _v$trim$split = _v.trim().split("="),
|
|
826
|
+
_v$trim$split2 = _slicedToArray(_v$trim$split, 2),
|
|
827
|
+
key = _v$trim$split2[0],
|
|
828
|
+
_val = _v$trim$split2[1];
|
|
829
|
+
_params[key] = _val.replace(/"/g, "");
|
|
830
|
+
}
|
|
831
|
+
} catch (err) {
|
|
832
|
+
_iterator2.e(err);
|
|
833
|
+
} finally {
|
|
834
|
+
_iterator2.f();
|
|
835
|
+
}
|
|
836
|
+
_metrics[_name].values.push({
|
|
837
|
+
value: val.trim(),
|
|
838
|
+
params: _params
|
|
839
|
+
});
|
|
840
|
+
} else {
|
|
841
|
+
var _v$split5 = v.split(" "),
|
|
842
|
+
_v$split6 = _slicedToArray(_v$split5, 2),
|
|
843
|
+
_name2 = _v$split6[0],
|
|
844
|
+
_val2 = _v$split6[1];
|
|
845
|
+
if (!_metrics[_name2]) _metrics[_name2] = {
|
|
846
|
+
index: ++index,
|
|
847
|
+
values: []
|
|
848
|
+
};
|
|
849
|
+
_metrics[_name2].values.push({
|
|
850
|
+
value: _val2
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
} catch (err) {
|
|
856
|
+
_iterator.e(err);
|
|
857
|
+
} finally {
|
|
858
|
+
_iterator.f();
|
|
859
|
+
}
|
|
860
|
+
return _metrics;
|
|
861
|
+
}
|
|
181
862
|
}, {
|
|
182
863
|
key: "messages",
|
|
183
864
|
value: function () {
|
|
184
|
-
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
185
|
-
var
|
|
186
|
-
var
|
|
865
|
+
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
866
|
+
var _this2 = this;
|
|
867
|
+
var _ref6,
|
|
187
868
|
target,
|
|
188
869
|
from,
|
|
189
870
|
to,
|
|
190
871
|
limit,
|
|
191
872
|
params,
|
|
192
873
|
res,
|
|
193
|
-
|
|
194
|
-
return _regeneratorRuntime().wrap(function
|
|
195
|
-
while (1) switch (
|
|
874
|
+
_args23 = arguments;
|
|
875
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
876
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
196
877
|
case 0:
|
|
197
|
-
|
|
878
|
+
_ref6 = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {}, target = _ref6.target, from = _ref6.from, to = _ref6.to, limit = _ref6.limit;
|
|
198
879
|
params = "target=".concat(target);
|
|
199
880
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
200
881
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
201
882
|
params += "&accept=application/aos-2";
|
|
202
|
-
|
|
883
|
+
_context23.next = 7;
|
|
203
884
|
return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
|
|
204
885
|
return r.json();
|
|
205
886
|
});
|
|
206
887
|
case 7:
|
|
207
|
-
res =
|
|
888
|
+
res = _context23.sent;
|
|
208
889
|
if (res.page_info.has_next_page) {
|
|
209
|
-
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
890
|
+
res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
210
891
|
var from2;
|
|
211
|
-
return _regeneratorRuntime().wrap(function
|
|
212
|
-
while (1) switch (
|
|
892
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
893
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
213
894
|
case 0:
|
|
214
895
|
from2 = (0, _ramda.last)(res.edges).cursor + 1;
|
|
215
|
-
|
|
216
|
-
return
|
|
896
|
+
_context22.next = 3;
|
|
897
|
+
return _this2.message({
|
|
217
898
|
target: target,
|
|
218
899
|
from: from2,
|
|
219
900
|
to: to,
|
|
220
901
|
limit: limit
|
|
221
902
|
});
|
|
222
903
|
case 3:
|
|
223
|
-
return
|
|
904
|
+
return _context22.abrupt("return", _context22.sent);
|
|
224
905
|
case 4:
|
|
225
906
|
case "end":
|
|
226
|
-
return
|
|
907
|
+
return _context22.stop();
|
|
227
908
|
}
|
|
228
|
-
},
|
|
909
|
+
}, _callee22);
|
|
229
910
|
}));
|
|
230
911
|
}
|
|
231
|
-
return
|
|
912
|
+
return _context23.abrupt("return", res);
|
|
232
913
|
case 10:
|
|
233
914
|
case "end":
|
|
234
|
-
return
|
|
915
|
+
return _context23.stop();
|
|
235
916
|
}
|
|
236
|
-
},
|
|
917
|
+
}, _callee23, this);
|
|
237
918
|
}));
|
|
238
919
|
function messages() {
|
|
239
920
|
return _messages.apply(this, arguments);
|
|
@@ -243,187 +924,130 @@ var HB = /*#__PURE__*/function () {
|
|
|
243
924
|
}, {
|
|
244
925
|
key: "process",
|
|
245
926
|
value: function () {
|
|
246
|
-
var _process = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
247
|
-
var
|
|
248
|
-
|
|
927
|
+
var _process = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
928
|
+
var _ref8,
|
|
929
|
+
_ref8$tags,
|
|
249
930
|
tags,
|
|
250
931
|
data,
|
|
251
932
|
res,
|
|
252
|
-
|
|
253
|
-
return _regeneratorRuntime().wrap(function
|
|
254
|
-
while (1) switch (
|
|
933
|
+
_args24 = arguments;
|
|
934
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
935
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
255
936
|
case 0:
|
|
256
|
-
|
|
937
|
+
_ref8 = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {}, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data;
|
|
257
938
|
tags = (0, _ramda.mergeLeft)(tags, {
|
|
258
939
|
data: data,
|
|
259
940
|
Type: "Process",
|
|
260
941
|
"Data-Protocol": "ao",
|
|
261
|
-
Variant: "ao.
|
|
942
|
+
Variant: "ao.TN.1",
|
|
262
943
|
scheduler: this._info.address,
|
|
263
|
-
|
|
264
|
-
"scheduler-location": this.
|
|
265
|
-
"random-seed":
|
|
944
|
+
Authority: this._info.address,
|
|
945
|
+
"scheduler-location": this._info.address,
|
|
946
|
+
"random-seed": seed(16),
|
|
266
947
|
module: "JArYBF-D8q2OmZ4Mok00sD2Y_6SYEQ7Hjx-6VZ_jl3g",
|
|
267
948
|
device: "process@1.0",
|
|
268
949
|
"scheduler-device": "scheduler@1.0",
|
|
269
950
|
"execution-device": "genesis-wasm@1.0"
|
|
270
951
|
});
|
|
271
|
-
|
|
952
|
+
_context24.next = 4;
|
|
272
953
|
return this.post({
|
|
273
954
|
tags: tags
|
|
274
955
|
});
|
|
275
956
|
case 4:
|
|
276
|
-
res =
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
case 7:
|
|
280
|
-
return _context6.abrupt("return", _context6.sent);
|
|
281
|
-
case 8:
|
|
957
|
+
res = _context24.sent;
|
|
958
|
+
return _context24.abrupt("return", res.process);
|
|
959
|
+
case 6:
|
|
282
960
|
case "end":
|
|
283
|
-
return
|
|
961
|
+
return _context24.stop();
|
|
284
962
|
}
|
|
285
|
-
},
|
|
963
|
+
}, _callee24, this);
|
|
286
964
|
}));
|
|
287
965
|
function process() {
|
|
288
966
|
return _process.apply(this, arguments);
|
|
289
967
|
}
|
|
290
968
|
return process;
|
|
291
969
|
}()
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
306
|
-
case 0:
|
|
307
|
-
_ref5 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, _ref5$tags = _ref5.tags, tags = _ref5$tags === void 0 ? {} : _ref5$tags, data = _ref5.data, process = _ref5.process, _ref5$action = _ref5.action, action = _ref5$action === void 0 ? "Eval" : _ref5$action;
|
|
308
|
-
tags = (0, _ramda.mergeLeft)(tags, {
|
|
309
|
-
path: "".concat(process, "/schedule"),
|
|
310
|
-
type: "Message",
|
|
311
|
-
action: action,
|
|
312
|
-
data: data,
|
|
313
|
-
"Data-Protocol": "ao",
|
|
314
|
-
Variant: "ao.N.1"
|
|
315
|
-
});
|
|
316
|
-
_context7.next = 4;
|
|
317
|
-
return this.post({
|
|
318
|
-
tags: tags
|
|
319
|
-
});
|
|
320
|
-
case 4:
|
|
321
|
-
return _context7.abrupt("return", _context7.sent.slot.text());
|
|
322
|
-
case 5:
|
|
323
|
-
case "end":
|
|
324
|
-
return _context7.stop();
|
|
325
|
-
}
|
|
326
|
-
}, _callee7, this);
|
|
327
|
-
}));
|
|
328
|
-
function schedule() {
|
|
329
|
-
return _schedule.apply(this, arguments);
|
|
330
|
-
}
|
|
331
|
-
return schedule;
|
|
332
|
-
}()
|
|
333
|
-
}, {
|
|
334
|
-
key: "compute",
|
|
335
|
-
value: function () {
|
|
336
|
-
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
337
|
-
var _ref6,
|
|
338
|
-
_ref6$tags,
|
|
339
|
-
tags,
|
|
340
|
-
process,
|
|
341
|
-
slot,
|
|
342
|
-
_args8 = arguments;
|
|
343
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
344
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
345
|
-
case 0:
|
|
346
|
-
_ref6 = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {}, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, process = _ref6.process, slot = _ref6.slot;
|
|
347
|
-
_context8.next = 3;
|
|
348
|
-
return this.request({
|
|
349
|
-
method: "GET",
|
|
350
|
-
path: "/".concat(process, "/compute&slot+integer=").concat(slot, "/results/json")
|
|
351
|
-
});
|
|
352
|
-
case 3:
|
|
353
|
-
return _context8.abrupt("return", _context8.sent);
|
|
354
|
-
case 4:
|
|
355
|
-
case "end":
|
|
356
|
-
return _context8.stop();
|
|
357
|
-
}
|
|
358
|
-
}, _callee8, this);
|
|
359
|
-
}));
|
|
360
|
-
function compute() {
|
|
361
|
-
return _compute.apply(this, arguments);
|
|
362
|
-
}
|
|
363
|
-
return compute;
|
|
364
|
-
}()
|
|
970
|
+
/*
|
|
971
|
+
async scheduleLegacy({ tags = {}, data, process, action = "Eval" } = {}) {
|
|
972
|
+
tags = mergeLeft(tags, {
|
|
973
|
+
path: `${process}/schedule`,
|
|
974
|
+
type: "Message",
|
|
975
|
+
action,
|
|
976
|
+
data,
|
|
977
|
+
"Data-Protocol": "ao",
|
|
978
|
+
Variant: "ao.N.1",
|
|
979
|
+
})
|
|
980
|
+
return (await this.post({ tags })).slot.text()
|
|
981
|
+
}
|
|
982
|
+
*/
|
|
365
983
|
}, {
|
|
366
984
|
key: "dryrun",
|
|
367
|
-
value: function () {
|
|
368
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
369
|
-
var
|
|
370
|
-
|
|
985
|
+
value: (function () {
|
|
986
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
987
|
+
var _ref9,
|
|
988
|
+
_ref9$tags,
|
|
371
989
|
tags,
|
|
372
990
|
process,
|
|
373
991
|
action,
|
|
374
992
|
data,
|
|
375
993
|
json,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
994
|
+
res,
|
|
995
|
+
_args25 = arguments;
|
|
996
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
997
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
379
998
|
case 0:
|
|
380
|
-
|
|
999
|
+
_ref9 = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {}, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, process = _ref9.process, action = _ref9.action, data = _ref9.data;
|
|
381
1000
|
if (typeof action === "string") tags.Action = action;
|
|
382
1001
|
json = {
|
|
383
1002
|
Tags: (0, _utils.buildTags)(tags)
|
|
384
1003
|
};
|
|
385
1004
|
if (data) json.Data = data;
|
|
386
|
-
|
|
387
|
-
return
|
|
388
|
-
|
|
1005
|
+
_context25.next = 6;
|
|
1006
|
+
return this.send({
|
|
1007
|
+
path: "/~relay@1.0/call",
|
|
1008
|
+
"relay-method": "POST",
|
|
1009
|
+
"relay-path": "/dry-run?process-id=".concat(process),
|
|
1010
|
+
"content-type": "application/json",
|
|
1011
|
+
body: JSON.stringify(json)
|
|
389
1012
|
});
|
|
390
1013
|
case 6:
|
|
391
|
-
|
|
392
|
-
|
|
1014
|
+
res = _context25.sent;
|
|
1015
|
+
return _context25.abrupt("return", JSON.parse(res.body));
|
|
1016
|
+
case 8:
|
|
393
1017
|
case "end":
|
|
394
|
-
return
|
|
1018
|
+
return _context25.stop();
|
|
395
1019
|
}
|
|
396
|
-
},
|
|
1020
|
+
}, _callee25, this);
|
|
397
1021
|
}));
|
|
398
1022
|
function dryrun() {
|
|
399
1023
|
return _dryrun.apply(this, arguments);
|
|
400
1024
|
}
|
|
401
1025
|
return dryrun;
|
|
402
|
-
}()
|
|
1026
|
+
}())
|
|
403
1027
|
}, {
|
|
404
1028
|
key: "get",
|
|
405
1029
|
value: function () {
|
|
406
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
407
|
-
var device,
|
|
408
|
-
return _regeneratorRuntime().wrap(function
|
|
409
|
-
while (1) switch (
|
|
1030
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(_ref10) {
|
|
1031
|
+
var device, _ref10$path, path;
|
|
1032
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1033
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
410
1034
|
case 0:
|
|
411
|
-
device =
|
|
412
|
-
|
|
1035
|
+
device = _ref10.device, _ref10$path = _ref10.path, path = _ref10$path === void 0 ? "~meta@1.0/info" : _ref10$path;
|
|
1036
|
+
_context26.next = 3;
|
|
413
1037
|
return this.request({
|
|
414
1038
|
device: device,
|
|
415
1039
|
path: path,
|
|
416
1040
|
method: "GET"
|
|
417
1041
|
});
|
|
418
1042
|
case 3:
|
|
419
|
-
return
|
|
1043
|
+
return _context26.abrupt("return", _context26.sent.body);
|
|
420
1044
|
case 4:
|
|
421
1045
|
case "end":
|
|
422
|
-
return
|
|
1046
|
+
return _context26.stop();
|
|
423
1047
|
}
|
|
424
|
-
},
|
|
1048
|
+
}, _callee26, this);
|
|
425
1049
|
}));
|
|
426
|
-
function get(
|
|
1050
|
+
function get(_x20) {
|
|
427
1051
|
return _get.apply(this, arguments);
|
|
428
1052
|
}
|
|
429
1053
|
return get;
|
|
@@ -431,13 +1055,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
431
1055
|
}, {
|
|
432
1056
|
key: "post",
|
|
433
1057
|
value: function () {
|
|
434
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
435
|
-
var device, tags,
|
|
436
|
-
return _regeneratorRuntime().wrap(function
|
|
437
|
-
while (1) switch (
|
|
1058
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref11) {
|
|
1059
|
+
var device, tags, _ref11$path, path;
|
|
1060
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1061
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
438
1062
|
case 0:
|
|
439
|
-
device =
|
|
440
|
-
|
|
1063
|
+
device = _ref11.device, tags = _ref11.tags, _ref11$path = _ref11.path, path = _ref11$path === void 0 ? "/schedule" : _ref11$path;
|
|
1064
|
+
_context27.next = 3;
|
|
441
1065
|
return this.request({
|
|
442
1066
|
tags: tags,
|
|
443
1067
|
device: device,
|
|
@@ -445,14 +1069,14 @@ var HB = /*#__PURE__*/function () {
|
|
|
445
1069
|
method: "POST"
|
|
446
1070
|
});
|
|
447
1071
|
case 3:
|
|
448
|
-
return
|
|
1072
|
+
return _context27.abrupt("return", _context27.sent);
|
|
449
1073
|
case 4:
|
|
450
1074
|
case "end":
|
|
451
|
-
return
|
|
1075
|
+
return _context27.stop();
|
|
452
1076
|
}
|
|
453
|
-
},
|
|
1077
|
+
}, _callee27, this);
|
|
454
1078
|
}));
|
|
455
|
-
function post(
|
|
1079
|
+
function post(_x21) {
|
|
456
1080
|
return _post.apply(this, arguments);
|
|
457
1081
|
}
|
|
458
1082
|
return post;
|
|
@@ -460,28 +1084,28 @@ var HB = /*#__PURE__*/function () {
|
|
|
460
1084
|
}, {
|
|
461
1085
|
key: "request",
|
|
462
1086
|
value: function () {
|
|
463
|
-
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
464
|
-
var device, tags,
|
|
465
|
-
return _regeneratorRuntime().wrap(function
|
|
466
|
-
while (1) switch (
|
|
1087
|
+
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(_ref12) {
|
|
1088
|
+
var device, tags, _ref12$method, method, _ref12$path, path, _tags;
|
|
1089
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1090
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
467
1091
|
case 0:
|
|
468
|
-
device =
|
|
1092
|
+
device = _ref12.device, tags = _ref12.tags, _ref12$method = _ref12.method, method = _ref12$method === void 0 ? "POST" : _ref12$method, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "/schedule" : _ref12$path;
|
|
469
1093
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
470
1094
|
path: path,
|
|
471
1095
|
method: method
|
|
472
1096
|
});
|
|
473
1097
|
if (device) _tags.device = device;
|
|
474
|
-
|
|
1098
|
+
_context28.next = 5;
|
|
475
1099
|
return this._request(_tags);
|
|
476
1100
|
case 5:
|
|
477
|
-
return
|
|
1101
|
+
return _context28.abrupt("return", _context28.sent);
|
|
478
1102
|
case 6:
|
|
479
1103
|
case "end":
|
|
480
|
-
return
|
|
1104
|
+
return _context28.stop();
|
|
481
1105
|
}
|
|
482
|
-
},
|
|
1106
|
+
}, _callee28, this);
|
|
483
1107
|
}));
|
|
484
|
-
function request(
|
|
1108
|
+
function request(_x22) {
|
|
485
1109
|
return _request.apply(this, arguments);
|
|
486
1110
|
}
|
|
487
1111
|
return request;
|