wao 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/weavedrive.js CHANGED
@@ -5,21 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _arweave = _interopRequireDefault(require("arweave"));
9
- var _utils = require("./utils.js");
10
- var _ramda = require("ramda");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
8
+ 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; }
9
+ 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; }
10
+ 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; }
12
11
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
13
12
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
13
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
15
14
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
16
- 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; }
17
- 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; }
18
- 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; }
19
- 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; }
20
15
  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; } } }; }
21
16
  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; } }
22
17
  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; }
18
+ 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
19
  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); }
24
20
  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); }); }; }
25
21
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
@@ -42,126 +38,40 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
42
38
  FS.streams[fd].node.position = 0;
43
39
  FS.streams[fd].node.cache = new Uint8Array(0);
44
40
  },
45
- joinUrl: function joinUrl(_ref) {
46
- var url = _ref.url,
47
- path = _ref.path;
48
- if (!path) return url;
49
- if (path.startsWith("/")) return this.joinUrl({
50
- url: url,
51
- path: path.slice(1)
52
- });
53
- url = new URL(url);
54
- url.pathname += path;
55
- return url.toString();
56
- },
57
- customFetch: function customFetch(path, options) {
41
+ create: function create(id) {
58
42
  var _this = this;
59
43
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
60
- var urlList, p, _iterator, _step, url, res;
61
- return _regeneratorRuntime().wrap(function _callee$(_context) {
62
- while (1) switch (_context.prev = _context.next) {
63
- case 0:
64
- /**
65
- * mod.ARWEAVE may be a comma-delimited list of urls.
66
- * So we parse it into an array that we sequentially consume
67
- * using fetch, and return the first successful response.
68
- *
69
- * The first url is considered "primary". So if all urls fail
70
- * to produce a successful response, then we return the primary's
71
- * error response
72
- */
73
- urlList = mod.ARWEAVE.includes(",") ? mod.ARWEAVE.split(",").map(function (url) {
74
- return url.trim();
75
- }) : [mod.ARWEAVE];
76
- _iterator = _createForOfIteratorHelper(urlList);
77
- _context.prev = 2;
78
- _iterator.s();
79
- case 4:
80
- if ((_step = _iterator.n()).done) {
81
- _context.next = 14;
82
- break;
83
- }
84
- url = _step.value;
85
- res = fetch(_this.joinUrl({
86
- url: url,
87
- path: path
88
- }), options);
89
- _context.next = 9;
90
- return res.then(function (r) {
91
- return r.ok;
92
- })["catch"](function () {
93
- return false;
94
- });
95
- case 9:
96
- if (!_context.sent) {
97
- _context.next = 11;
98
- break;
99
- }
100
- return _context.abrupt("return", res);
101
- case 11:
102
- if (!p) p = res;
103
- case 12:
104
- _context.next = 4;
105
- break;
106
- case 14:
107
- _context.next = 19;
108
- break;
109
- case 16:
110
- _context.prev = 16;
111
- _context.t0 = _context["catch"](2);
112
- _iterator.e(_context.t0);
113
- case 19:
114
- _context.prev = 19;
115
- _iterator.f();
116
- return _context.finish(19);
117
- case 22:
118
- return _context.abrupt("return", p);
119
- case 23:
120
- case "end":
121
- return _context.stop();
122
- }
123
- }, _callee, null, [[2, 16, 19, 22]]);
124
- }))();
125
- },
126
- create: function create(id) {
127
- var _this2 = this;
128
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
129
44
  var _data$length;
130
45
  var properties, node, data, bytesLength, stream;
131
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
132
- while (1) switch (_context2.prev = _context2.next) {
46
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
47
+ while (1) switch (_context.prev = _context.next) {
133
48
  case 0:
134
49
  properties = {
135
50
  isDevice: false,
136
51
  contents: null
137
52
  };
138
- _context2.next = 3;
139
- return _this2.checkAdmissible(id);
53
+ _context.next = 3;
54
+ return _this.checkAdmissible(id);
140
55
  case 3:
141
- if (_context2.sent) {
142
- _context2.next = 5;
56
+ if (_context.sent) {
57
+ _context.next = 5;
143
58
  break;
144
59
  }
145
- return _context2.abrupt("return", 0);
60
+ return _context.abrupt("return", 0);
146
61
  case 5:
147
62
  // Create the file in the emscripten FS
148
63
 
149
- // This check/mkdir was added for AOP 6 Boot loader because create is
150
- // called first because were only loading Data, we needed to create
151
- // the directory. See: https://github.com/permaweb/aos/issues/342
152
- if (!FS.analyzePath("/data/").exists) {
153
- FS.mkdir("/data/");
154
- }
64
+ if (!FS.analyzePath("/data/").exists) FS.mkdir("/data/");
155
65
  node = FS.createFile("/", "data/" + id, properties, true, false); // Set initial parameters
156
66
  /*
157
- var bytesLength = await this.customFetch(`/${id}`, {
158
- method: "HEAD",
159
- }).then(res => res.headers.get("Content-Length"))
67
+ var bytesLength = await this.customFetch(`/${id}`, {
68
+ method: "HEAD",
69
+ }).then(res => res.headers.get("Content-Length"))
160
70
  */
161
- _context2.next = 9;
71
+ _context.next = 9;
162
72
  return ar.data(id);
163
73
  case 9:
164
- data = _context2.sent;
74
+ data = _context.sent;
165
75
  bytesLength = (_data$length = data === null || data === void 0 ? void 0 : data.length) !== null && _data$length !== void 0 ? _data$length : 0;
166
76
  node.total_size = Number(bytesLength);
167
77
  node.cache = new Uint8Array(0);
@@ -178,404 +88,230 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
178
88
 
179
89
  // Now we have created the file in the emscripten FS, we can open it as a stream
180
90
  stream = FS.open("/data/" + id, "r"); //console.log("JS: Created file: ", id, " fd: ", stream.fd);
181
- return _context2.abrupt("return", stream);
91
+ return _context.abrupt("return", stream);
182
92
  case 17:
183
93
  case "end":
184
- return _context2.stop();
94
+ return _context.stop();
185
95
  }
186
- }, _callee2);
96
+ }, _callee);
187
97
  }))();
188
98
  },
189
99
  createBlockHeader: function createBlockHeader(id) {
190
- var _this3 = this;
191
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
192
- var customFetch, retry, _retry, result, bytesLength, node, stream;
193
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
194
- while (1) switch (_context4.prev = _context4.next) {
100
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
101
+ var result, block, bytesLength, node, stream;
102
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
103
+ while (1) switch (_context2.prev = _context2.next) {
195
104
  case 0:
196
- _retry = function _retry3() {
197
- _retry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(x) {
198
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
199
- while (1) switch (_context3.prev = _context3.next) {
200
- case 0:
201
- return _context3.abrupt("return", new Promise(function (r) {
202
- setTimeout(function () {
203
- r(customFetch("/block/height/".concat(id)));
204
- }, x * 10000);
205
- }));
206
- case 1:
207
- case "end":
208
- return _context3.stop();
209
- }
210
- }, _callee3);
211
- }));
212
- return _retry.apply(this, arguments);
213
- };
214
- retry = function _retry2(_x) {
215
- return _retry.apply(this, arguments);
216
- };
217
- customFetch = _this3.customFetch; // todo: add a bunch of retries
218
- _context4.next = 5;
219
- return _this3.customFetch("/block/height/".concat(id)).then(function (res) {
220
- return !res.ok ? retry(1) : res;
221
- }).then(function (res) {
222
- return !res.ok ? retry(2) : res;
223
- }).then(function (res) {
224
- return !res.ok ? retry(3) : res;
225
- }).then(function (res) {
226
- return !res.ok ? retry(4) : res;
227
- }).then(function (res) {
228
- return res.text();
229
- });
230
- case 5:
231
- result = _context4.sent;
105
+ result = "";
106
+ try {
107
+ // todo: implement indep_hash
108
+ // fetch(`/block/height/${id}`)
109
+ block = ar.mem.blockmap[ar.mem.blocks[id]];
110
+ if (block) {
111
+ result = JSON.stringify({
112
+ id: block.id,
113
+ timestamp: block.timestamp,
114
+ previous_block: block.previous,
115
+ txs: block.txs,
116
+ height: id
117
+ });
118
+ }
119
+ } catch (e) {}
232
120
  bytesLength = result.length;
233
121
  node = FS.createDataFile("/", "block/" + id, Buffer.from(result, "utf-8"), true, false);
234
122
  stream = FS.open("/block/" + id, "r");
235
- return _context4.abrupt("return", stream);
236
- case 10:
123
+ return _context2.abrupt("return", stream);
124
+ case 6:
237
125
  case "end":
238
- return _context4.stop();
126
+ return _context2.stop();
239
127
  }
240
- }, _callee4);
128
+ }, _callee2);
241
129
  }))();
242
130
  },
243
131
  createTxHeader: function createTxHeader(id) {
244
- var _this4 = this;
245
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
246
- var customFetch, toAddress, _toAddress, retry, _retry4, result, node, stream;
247
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
248
- while (1) switch (_context8.prev = _context8.next) {
132
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
133
+ var result, tx, node, stream;
134
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
135
+ while (1) switch (_context3.prev = _context3.next) {
249
136
  case 0:
250
- _retry4 = function _retry6() {
251
- _retry4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(x) {
252
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
253
- while (1) switch (_context7.prev = _context7.next) {
254
- case 0:
255
- return _context7.abrupt("return", new Promise(function (r) {
256
- setTimeout(function () {
257
- r(customFetch("/tx/".concat(id)));
258
- }, x * 10000);
259
- }));
260
- case 1:
261
- case "end":
262
- return _context7.stop();
263
- }
264
- }, _callee7);
265
- }));
266
- return _retry4.apply(this, arguments);
267
- };
268
- retry = function _retry5(_x3) {
269
- return _retry4.apply(this, arguments);
270
- };
271
- _toAddress = function _toAddress3() {
272
- _toAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(owner) {
273
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
274
- while (1) switch (_context6.prev = _context6.next) {
275
- case 0:
276
- _context6.t0 = _arweave["default"].utils;
277
- _context6.next = 3;
278
- return _arweave["default"].crypto.hash(_arweave["default"].utils.b64UrlToBuffer(owner));
279
- case 3:
280
- _context6.t1 = _context6.sent;
281
- return _context6.abrupt("return", _context6.t0.bufferTob64Url.call(_context6.t0, _context6.t1));
282
- case 5:
283
- case "end":
284
- return _context6.stop();
285
- }
286
- }, _callee6);
287
- }));
288
- return _toAddress.apply(this, arguments);
289
- };
290
- toAddress = function _toAddress2(_x2) {
291
- return _toAddress.apply(this, arguments);
292
- };
293
- customFetch = _this4.customFetch; // todo: add a bunch of retries
294
- _context8.next = 7;
295
- return _this4.customFetch("/tx/".concat(id)).then(function (res) {
296
- return !res.ok ? retry(1) : res;
297
- }).then(function (res) {
298
- return !res.ok ? retry(2) : res;
299
- }).then(function (res) {
300
- return !res.ok ? retry(3) : res;
301
- }).then(function (res) {
302
- return !res.ok ? retry(4) : res;
303
- }).then(function (res) {
304
- return res.json();
305
- }).then(/*#__PURE__*/function () {
306
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entry) {
307
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
308
- while (1) switch (_context5.prev = _context5.next) {
309
- case 0:
310
- _context5.t0 = _objectSpread;
311
- _context5.t1 = _objectSpread({}, entry);
312
- _context5.t2 = {};
313
- _context5.next = 5;
314
- return toAddress(entry.owner);
315
- case 5:
316
- _context5.t3 = _context5.sent;
317
- _context5.t4 = {
318
- ownerAddress: _context5.t3
319
- };
320
- return _context5.abrupt("return", (0, _context5.t0)(_context5.t1, _context5.t2, _context5.t4));
321
- case 8:
322
- case "end":
323
- return _context5.stop();
324
- }
325
- }, _callee5);
326
- }));
327
- return function (_x4) {
328
- return _ref2.apply(this, arguments);
329
- };
330
- }())
331
- //.then(x => (console.error(x), x))
332
- .then(function (x) {
333
- return JSON.stringify(x);
334
- });
335
- case 7:
336
- result = _context8.sent;
137
+ result = ""; // fetch(`/tx/${id}`)
138
+ try {
139
+ tx = ar.mem.txs[id];
140
+ if (tx) result = JSON.stringify(tx);
141
+ } catch (e) {}
337
142
  node = FS.createDataFile("/", "tx/" + id, Buffer.from(result, "utf-8"), true, false);
338
143
  stream = FS.open("/tx/" + id, "r");
339
- return _context8.abrupt("return", stream);
340
- case 11:
144
+ return _context3.abrupt("return", stream);
145
+ case 5:
341
146
  case "end":
342
- return _context8.stop();
147
+ return _context3.stop();
343
148
  }
344
- }, _callee8);
149
+ }, _callee3);
345
150
  }))();
346
151
  },
347
152
  createDataItemTxHeader: function createDataItemTxHeader(id) {
348
- var _this5 = this;
349
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
350
- var gqlQuery, GET_TRANSACTION_QUERY, variables, retry, _retry7, gqlExists, result, stream;
351
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
352
- while (1) switch (_context11.prev = _context11.next) {
153
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
154
+ var result, stream;
155
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
156
+ while (1) switch (_context4.prev = _context4.next) {
353
157
  case 0:
354
- _retry7 = function _retry9() {
355
- _retry7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(x) {
356
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
357
- while (1) switch (_context10.prev = _context10.next) {
358
- case 0:
359
- return _context10.abrupt("return", new Promise(function (r) {
360
- setTimeout(function () {
361
- r(gqlQuery(GET_TRANSACTION_QUERY, variables));
362
- }, x * 10000);
363
- }));
364
- case 1:
365
- case "end":
366
- return _context10.stop();
367
- }
368
- }, _callee10);
369
- }));
370
- return _retry7.apply(this, arguments);
371
- };
372
- retry = function _retry8(_x5) {
373
- return _retry7.apply(this, arguments);
374
- };
375
- gqlQuery = _this5.gqlQuery;
376
- GET_TRANSACTION_QUERY = "\n query GetTransactions ($transactionIds: [ID!]!) {\n transactions(ids: $transactionIds) {\n edges {\n node {\n id\n anchor\n data {\n size\n }\n signature\n recipient \n owner {\n address \n key\n }\n fee {\n ar \n winston\n }\n quantity {\n winston\n ar\n }\n tags {\n name \n value \n }\n bundledIn {\n id\n }\n block { \n id\n timestamp\n height\n previous\n }\n }\n }\n }\n }";
377
- variables = {
378
- transactionIds: [id]
379
- };
380
- _context11.next = 7;
381
- return _this5.gqlExists();
382
- case 7:
383
- gqlExists = _context11.sent;
384
- if (gqlExists) {
385
- _context11.next = 10;
386
- break;
387
- }
388
- return _context11.abrupt("return", "GQL Not Found!");
389
- case 10:
390
- _context11.next = 12;
391
- return _this5.gqlQuery(GET_TRANSACTION_QUERY, variables).then(function (res) {
392
- return !res.ok ? retry(1) : res;
393
- }).then(function (res) {
394
- return !res.ok ? retry(2) : res;
395
- }).then(function (res) {
396
- return !res.ok ? retry(3) : res;
397
- }).then(function (res) {
398
- return !res.ok ? retry(4) : res;
399
- }).then(function (res) {
400
- return res.json();
401
- }).then(function (res) {
402
- var _res$data;
403
- return res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && (_res$data = _res$data.transactions) !== null && _res$data !== void 0 && (_res$data = _res$data.edges) !== null && _res$data !== void 0 && (_res$data = _res$data[0]) !== null && _res$data !== void 0 && _res$data.node ? res.data.transactions.edges[0].node : "No results";
404
- }).then(/*#__PURE__*/function () {
405
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(entry) {
406
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
407
- while (1) switch (_context9.prev = _context9.next) {
408
- case 0:
409
- return _context9.abrupt("return", typeof entry == "string" ? entry : _objectSpread({
410
- format: 3
411
- }, entry));
412
- case 1:
413
- case "end":
414
- return _context9.stop();
415
- }
416
- }, _callee9);
417
- }));
418
- return function (_x6) {
419
- return _ref3.apply(this, arguments);
420
- };
421
- }()).then(function (x) {
422
- return typeof x == "string" ? x : JSON.stringify(x);
158
+ _context4.next = 2;
159
+ return ar.gql.txs({
160
+ id: id,
161
+ fields: ["id", "anchor", {
162
+ data: ["size"]
163
+ }, "signature", "recipient", "owner", "fee", "quantity", "tags", "bundledIn", "block"]
423
164
  });
424
- case 12:
425
- result = _context11.sent;
426
- if (!(result === "No results")) {
427
- _context11.next = 15;
428
- break;
429
- }
430
- return _context11.abrupt("return", result);
431
- case 15:
165
+ case 2:
166
+ result = _context4.sent[0];
167
+ result = result ? JSON.stringify(result) : "No results";
432
168
  FS.createDataFile("/", "tx2/" + id, Buffer.from(result, "utf-8"), true, false);
433
169
  stream = FS.open("/tx2/" + id, "r");
434
- return _context11.abrupt("return", stream);
435
- case 18:
170
+ return _context4.abrupt("return", stream);
171
+ case 7:
436
172
  case "end":
437
- return _context11.stop();
173
+ return _context4.stop();
438
174
  }
439
- }, _callee11);
175
+ }, _callee4);
440
176
  }))();
441
177
  },
442
178
  open: function open(filename) {
443
- var _this6 = this;
444
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
179
+ var _this2 = this;
180
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
445
181
  var pathCategory, id, stream, _stream, _stream2, _stream3, _stream4;
446
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
447
- while (1) switch (_context12.prev = _context12.next) {
182
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
183
+ while (1) switch (_context5.prev = _context5.next) {
448
184
  case 0:
449
185
  pathCategory = filename.split("/")[1];
450
186
  id = filename.split("/")[2];
451
187
  console.log("JS: Opening ID: ", id);
452
188
  if (!(pathCategory === "tx")) {
453
- _context12.next = 16;
189
+ _context5.next = 16;
454
190
  break;
455
191
  }
456
192
  FS.createPath("/", "tx", true, false);
457
193
  if (!FS.analyzePath(filename).exists) {
458
- _context12.next = 12;
194
+ _context5.next = 12;
459
195
  break;
460
196
  }
461
197
  stream = FS.open(filename, "r");
462
198
  if (!stream.fd) {
463
- _context12.next = 9;
199
+ _context5.next = 9;
464
200
  break;
465
201
  }
466
- return _context12.abrupt("return", stream.fd);
202
+ return _context5.abrupt("return", stream.fd);
467
203
  case 9:
468
- return _context12.abrupt("return", 0);
204
+ return _context5.abrupt("return", 0);
469
205
  case 12:
470
- _context12.next = 14;
471
- return _this6.createTxHeader(id);
206
+ _context5.next = 14;
207
+ return _this2.createTxHeader(id);
472
208
  case 14:
473
- _stream = _context12.sent;
474
- return _context12.abrupt("return", _stream.fd);
209
+ _stream = _context5.sent;
210
+ return _context5.abrupt("return", _stream.fd);
475
211
  case 16:
476
212
  if (!(pathCategory === "tx2")) {
477
- _context12.next = 31;
213
+ _context5.next = 31;
478
214
  break;
479
215
  }
480
216
  FS.createPath("/", "tx2", true, false);
481
217
  if (!FS.analyzePath(filename).exists) {
482
- _context12.next = 25;
218
+ _context5.next = 25;
483
219
  break;
484
220
  }
485
221
  stream = FS.open(filename, "r");
486
222
  if (!stream.fd) {
487
- _context12.next = 22;
223
+ _context5.next = 22;
488
224
  break;
489
225
  }
490
- return _context12.abrupt("return", stream.fd);
226
+ return _context5.abrupt("return", stream.fd);
491
227
  case 22:
492
- return _context12.abrupt("return", 0);
228
+ return _context5.abrupt("return", 0);
493
229
  case 25:
494
- _context12.next = 27;
495
- return _this6.createDataItemTxHeader(id);
230
+ _context5.next = 27;
231
+ return _this2.createDataItemTxHeader(id);
496
232
  case 27:
497
- _stream2 = _context12.sent;
233
+ _stream2 = _context5.sent;
498
234
  if (!_stream2.fd) {
499
- _context12.next = 30;
235
+ _context5.next = 30;
500
236
  break;
501
237
  }
502
- return _context12.abrupt("return", _stream2.fd);
238
+ return _context5.abrupt("return", _stream2.fd);
503
239
  case 30:
504
- return _context12.abrupt("return", 0);
240
+ return _context5.abrupt("return", 0);
505
241
  case 31:
506
242
  if (!(pathCategory === "block")) {
507
- _context12.next = 44;
243
+ _context5.next = 44;
508
244
  break;
509
245
  }
510
246
  FS.createPath("/", "block", true, false);
511
247
  if (!FS.analyzePath(filename).exists) {
512
- _context12.next = 40;
248
+ _context5.next = 40;
513
249
  break;
514
250
  }
515
251
  stream = FS.open(filename, "r");
516
252
  if (!stream.fd) {
517
- _context12.next = 37;
253
+ _context5.next = 37;
518
254
  break;
519
255
  }
520
- return _context12.abrupt("return", stream.fd);
256
+ return _context5.abrupt("return", stream.fd);
521
257
  case 37:
522
- return _context12.abrupt("return", 0);
258
+ return _context5.abrupt("return", 0);
523
259
  case 40:
524
- _context12.next = 42;
525
- return _this6.createBlockHeader(id);
260
+ _context5.next = 42;
261
+ return _this2.createBlockHeader(id);
526
262
  case 42:
527
- _stream3 = _context12.sent;
528
- return _context12.abrupt("return", _stream3.fd);
263
+ _stream3 = _context5.sent;
264
+ return _context5.abrupt("return", _stream3.fd);
529
265
  case 44:
530
266
  if (!(pathCategory === "data")) {
531
- _context12.next = 59;
267
+ _context5.next = 59;
532
268
  break;
533
269
  }
534
270
  if (!FS.analyzePath(filename).exists) {
535
- _context12.next = 53;
271
+ _context5.next = 53;
536
272
  break;
537
273
  }
538
274
  stream = FS.open(filename, "r");
539
275
  if (!stream.fd) {
540
- _context12.next = 49;
276
+ _context5.next = 49;
541
277
  break;
542
278
  }
543
- return _context12.abrupt("return", stream.fd);
279
+ return _context5.abrupt("return", stream.fd);
544
280
  case 49:
545
281
  console.log("JS: File not found: ", filename);
546
- return _context12.abrupt("return", 0);
282
+ return _context5.abrupt("return", 0);
547
283
  case 53:
548
- _context12.next = 55;
549
- return _this6.create(id);
284
+ _context5.next = 55;
285
+ return _this2.create(id);
550
286
  case 55:
551
- _stream4 = _context12.sent;
552
- return _context12.abrupt("return", _stream4.fd);
287
+ _stream4 = _context5.sent;
288
+ return _context5.abrupt("return", _stream4.fd);
553
289
  case 57:
554
- _context12.next = 66;
290
+ _context5.next = 66;
555
291
  break;
556
292
  case 59:
557
293
  if (!(pathCategory === "headers")) {
558
- _context12.next = 64;
294
+ _context5.next = 64;
559
295
  break;
560
296
  }
561
297
  console.log("Header access not implemented yet.");
562
- return _context12.abrupt("return", 0);
298
+ return _context5.abrupt("return", 0);
563
299
  case 64:
564
300
  console.log("JS: Invalid path category: ", pathCategory);
565
- return _context12.abrupt("return", 0);
301
+ return _context5.abrupt("return", 0);
566
302
  case 66:
567
303
  case "end":
568
- return _context12.stop();
304
+ return _context5.stop();
569
305
  }
570
- }, _callee12);
306
+ }, _callee5);
571
307
  }))();
572
308
  },
573
309
  read: function read(fd, raw_dst_ptr, raw_length) {
574
- var _this7 = this;
575
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
310
+ var _this3 = this;
311
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
576
312
  var to_read, dst_ptr, stream, i, bytes_read, chunk_download_sz, to, data, start, end, chunk, response, reader, bytes_until_cache, bytes_until_notify, downloaded_bytes, cache_chunks, _yield$reader$read, done, chunk_bytes, write_length, chunk_to_cache;
577
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
578
- while (1) switch (_context13.prev = _context13.next) {
313
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
314
+ while (1) switch (_context6.prev = _context6.next) {
579
315
  case 0:
580
316
  // Note: The length and dst_ptr are 53 bit integers in JS, so this _should_ be ok into a large memspace.
581
317
  to_read = Number(raw_length);
@@ -588,21 +324,21 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
588
324
  }
589
325
  // read block headers
590
326
  if (!stream.path.includes("/block")) {
591
- _context13.next = 7;
327
+ _context6.next = 7;
592
328
  break;
593
329
  }
594
330
  mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
595
- return _context13.abrupt("return", to_read);
331
+ return _context6.abrupt("return", to_read);
596
332
  case 7:
597
333
  if (!stream.path.includes("/tx")) {
598
- _context13.next = 10;
334
+ _context6.next = 10;
599
335
  break;
600
336
  }
601
337
  mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
602
- return _context13.abrupt("return", to_read);
338
+ return _context6.abrupt("return", to_read);
603
339
  case 10:
604
340
  // Satisfy what we can with the cache first
605
- bytes_read = _this7.readFromCache(stream, dst_ptr, to_read);
341
+ bytes_read = _this3.readFromCache(stream, dst_ptr, to_read);
606
342
  stream.position += bytes_read;
607
343
  stream.lastReadPosition = stream.position;
608
344
  dst_ptr += bytes_read;
@@ -610,27 +346,19 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
610
346
 
611
347
  // Return if we have satisfied the request
612
348
  if (!(to_read === 0)) {
613
- _context13.next = 17;
349
+ _context6.next = 17;
614
350
  break;
615
351
  }
616
- return _context13.abrupt("return", bytes_read);
352
+ return _context6.abrupt("return", bytes_read);
617
353
  case 17:
618
354
  //console.log("WeaveDrive: Read from cache: ", bytes_read, " Remaining to read: ", to_read)
619
355
  chunk_download_sz = Math.max(to_read, CACHE_SZ);
620
356
  to = Math.min(stream.node.total_size, stream.position + chunk_download_sz); //console.log("WeaveDrive: fd: ", fd, " Read length: ", to_read, " Reading ahead:", to - to_read - stream.position)
621
- // Fetch with streaming
622
- /*
623
- const response = await this.customFetch(`/${stream.node.name}`, {
624
- method: "GET",
625
- redirect: "follow",
626
- headers: { Range: `bytes=${stream.position}-${to}` },
627
- })
628
- const reader = response.body.getReader()
629
- */
630
- _context13.next = 21;
357
+ // fetch(`/${stream.node.name}`)
358
+ _context6.next = 21;
631
359
  return ar.data(stream.node.name);
632
360
  case 21:
633
- data = _context13.sent;
361
+ data = _context6.sent;
634
362
  // Extract the Range header to determine the start and end of the requested chunk
635
363
  start = 0;
636
364
  end = data.length; // Create a ReadableStream for the requested chunk
@@ -650,23 +378,23 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
650
378
  bytes_until_notify = NOTIFY_SZ;
651
379
  downloaded_bytes = 0;
652
380
  cache_chunks = [];
653
- _context13.prev = 31;
381
+ _context6.prev = 31;
654
382
  case 32:
655
383
  if (!true) {
656
- _context13.next = 50;
384
+ _context6.next = 50;
657
385
  break;
658
386
  }
659
- _context13.next = 35;
387
+ _context6.next = 35;
660
388
  return reader.read();
661
389
  case 35:
662
- _yield$reader$read = _context13.sent;
390
+ _yield$reader$read = _context6.sent;
663
391
  done = _yield$reader$read.done;
664
392
  chunk_bytes = _yield$reader$read.value;
665
393
  if (!done) {
666
- _context13.next = 40;
394
+ _context6.next = 40;
667
395
  break;
668
396
  }
669
- return _context13.abrupt("break", 50);
397
+ return _context6.abrupt("break", 50);
670
398
  case 40:
671
399
  // Update the number of downloaded bytes to be _all_, not just the write length
672
400
  downloaded_bytes += chunk_bytes.length;
@@ -690,7 +418,7 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
690
418
  }
691
419
  if (bytes_until_cache <= 0) {
692
420
  console.log("WeaveDrive: Chunk size reached. Compressing cache...");
693
- stream.node.cache = _this7.addChunksToCache(stream.node.cache, cache_chunks);
421
+ stream.node.cache = _this3.addChunksToCache(stream.node.cache, cache_chunks);
694
422
  cache_chunks = [];
695
423
  bytes_until_cache = CHUNK_SZ;
696
424
  }
@@ -698,40 +426,38 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
698
426
  console.log("WeaveDrive: Downloaded: ", downloaded_bytes / stream.node.total_size * 100, "%");
699
427
  bytes_until_notify = NOTIFY_SZ;
700
428
  }
701
- _context13.next = 32;
429
+ _context6.next = 32;
702
430
  break;
703
431
  case 50:
704
- _context13.next = 55;
432
+ _context6.next = 55;
705
433
  break;
706
434
  case 52:
707
- _context13.prev = 52;
708
- _context13.t0 = _context13["catch"](31);
709
- console.error("WeaveDrive: Error reading the stream: ", _context13.t0);
435
+ _context6.prev = 52;
436
+ _context6.t0 = _context6["catch"](31);
437
+ console.error("WeaveDrive: Error reading the stream: ", _context6.t0);
710
438
  case 55:
711
- _context13.prev = 55;
439
+ _context6.prev = 55;
712
440
  reader.releaseLock();
713
- return _context13.finish(55);
441
+ return _context6.finish(55);
714
442
  case 58:
715
443
  // If we have no cache, or we have not satisfied the full request, we need to download the rest
716
444
  // Rebuild the cache from the new cache chunks
717
- stream.node.cache = _this7.addChunksToCache(stream.node.cache, cache_chunks);
445
+ stream.node.cache = _this3.addChunksToCache(stream.node.cache, cache_chunks);
718
446
 
719
447
  // Update the last read position
720
448
  stream.lastReadPosition = stream.position;
721
- return _context13.abrupt("return", bytes_read);
449
+ return _context6.abrupt("return", bytes_read);
722
450
  case 61:
723
451
  case "end":
724
- return _context13.stop();
452
+ return _context6.stop();
725
453
  }
726
- }, _callee13, null, [[31, 52, 55, 58]]);
454
+ }, _callee6, null, [[31, 52, 55, 58]]);
727
455
  }))();
728
456
  },
729
457
  close: function close(fd) {
730
458
  var stream = 0;
731
459
  for (var i = 0; i < FS.streams.length; i++) {
732
- if (FS.streams[i].fd === fd) {
733
- stream = FS.streams[i];
734
- }
460
+ if (FS.streams[i].fd === fd) stream = FS.streams[i];
735
461
  }
736
462
  FS.close(stream);
737
463
  },
@@ -761,112 +487,148 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
761
487
  new_cache.set(old_cache, 0);
762
488
  // Load the cache chunks into the new cache
763
489
  var current_offset = old_cache.length;
764
- var _iterator2 = _createForOfIteratorHelper(chunks),
765
- _step2;
490
+ var _iterator = _createForOfIteratorHelper(chunks),
491
+ _step;
766
492
  try {
767
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
768
- var chunk = _step2.value;
493
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
494
+ var chunk = _step.value;
769
495
  if (current_offset < new_cache_length) {
770
496
  new_cache.set(chunk.subarray(0, new_cache_length - current_offset), current_offset);
771
497
  current_offset += chunk.length;
772
498
  }
773
499
  }
774
500
  } catch (err) {
775
- _iterator2.e(err);
501
+ _iterator.e(err);
776
502
  } finally {
777
- _iterator2.f();
503
+ _iterator.f();
778
504
  }
779
505
  return new_cache;
780
506
  },
781
507
  // General helpder functions
782
508
  checkAdmissible: function checkAdmissible(ID) {
783
- var _this8 = this;
784
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
785
- var bootTag, blockHeight, moduleExtensions, moduleHasWeaveDrive, processExtensions, processHasWeaveDrive, modes, moduleAvailabilityType, moduleMode, processAvailabilityType, processMode, attestors, assignmentsHaveID, individualsHaveID;
786
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
787
- while (1) switch (_context14.prev = _context14.next) {
509
+ var _this4 = this;
510
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
511
+ var bootTag, blockHeight, moduleExtensions, moduleHasWeaveDrive, processExtensions, processHasWeaveDrive, modes, moduleAvailabilityType, moduleMode, processAvailabilityType, processMode, attestors, exists, assignmentsHaveID, individualsHaveID;
512
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
513
+ while (1) switch (_context8.prev = _context8.next) {
788
514
  case 0:
789
515
  if (!(mod.mode && mod.mode == "test")) {
790
- _context14.next = 2;
516
+ _context8.next = 2;
791
517
  break;
792
518
  }
793
- return _context14.abrupt("return", true);
519
+ return _context8.abrupt("return", true);
794
520
  case 2:
795
521
  // Check if we are attempting to load the On-Boot id, if so allow it
796
522
  // this was added for AOP 6 Boot loader See: https://github.com/permaweb/aos/issues/342
797
- bootTag = _this8.getTagValue("On-Boot", mod.spawn.tags);
523
+ bootTag = _this4.getTagValue("On-Boot", mod.spawn.tags);
798
524
  if (!(bootTag && bootTag === ID)) {
799
- _context14.next = 5;
525
+ _context8.next = 5;
800
526
  break;
801
527
  }
802
- return _context14.abrupt("return", true);
528
+ return _context8.abrupt("return", true);
803
529
  case 5:
804
530
  // Check that this module or process set the WeaveDrive tag on spawn
805
531
  blockHeight = mod.blockHeight;
806
- moduleExtensions = _this8.getTagValues("Extension", mod.module.tags);
532
+ moduleExtensions = _this4.getTagValues("Extension", mod.module.tags);
807
533
  moduleHasWeaveDrive = moduleExtensions.includes("WeaveDrive");
808
- processExtensions = _this8.getTagValues("Extension", mod.spawn.tags);
534
+ processExtensions = _this4.getTagValues("Extension", mod.spawn.tags);
809
535
  processHasWeaveDrive = moduleHasWeaveDrive || processExtensions.includes("WeaveDrive");
810
536
  if (processHasWeaveDrive) {
811
- _context14.next = 13;
537
+ _context8.next = 13;
812
538
  break;
813
539
  }
814
540
  console.log("WeaveDrive: Process tried to call WeaveDrive, but extension not set!");
815
- return _context14.abrupt("return", false);
541
+ return _context8.abrupt("return", false);
816
542
  case 13:
817
543
  modes = ["Assignments", "Individual", "Library"]; // Get the Availability-Type from the spawned process's Module or Process item
818
544
  // First check the module for its defaults
819
- moduleAvailabilityType = _this8.getTagValue("Availability-Type", mod.module.tags);
545
+ moduleAvailabilityType = _this4.getTagValue("Availability-Type", mod.module.tags);
820
546
  moduleMode = moduleAvailabilityType ? moduleAvailabilityType : "Assignments"; // Default to assignments
821
547
  // Now check the process's spawn item. These settings override Module item settings.
822
- processAvailabilityType = _this8.getTagValue("Availability-Type", mod.spawn.tags);
548
+ processAvailabilityType = _this4.getTagValue("Availability-Type", mod.spawn.tags);
823
549
  processMode = processAvailabilityType ? processAvailabilityType : moduleMode;
824
550
  if (modes.includes(processMode)) {
825
- _context14.next = 20;
551
+ _context8.next = 20;
826
552
  break;
827
553
  }
828
554
  throw "Unsupported WeaveDrive mode: ".concat(processMode);
829
555
  case 20:
830
- attestors = _this8.serializeStringArr([_this8.getTagValue("Scheduler", mod.spawn.tags)].concat(_toConsumableArray(_this8.getTagValues("Attestor", mod.spawn.tags))).filter(function (t) {
556
+ attestors = _this4.serializeStringArr([_this4.getTagValue("Scheduler", mod.spawn.tags)].concat(_toConsumableArray(_this4.getTagValues("Attestor", mod.spawn.tags))).filter(function (t) {
831
557
  return !!t;
832
558
  })); // Init a set of GraphQL queries to run in order to find a valid attestation
833
559
  // Every WeaveDrive process has at least the "Assignments" availability check form.
834
- _context14.next = 23;
835
- return _this8.queryHasResult("query {\n transactions(\n owners: ".concat(attestors, ",\n block: {min: 0, max: ").concat(blockHeight, "},\n tags: [\n { name: \"Type\", values: [\"Attestation\"] },\n { name: \"Message\", values: [\"").concat(ID, "\"]}\n { name: \"Data-Protocol\", values: [\"ao\"] },\n ]\n ) \n {\n edges {\n node {\n tags {\n name\n value\n }\n }\n }\n }\n }"));
836
- case 23:
837
- assignmentsHaveID = _context14.sent;
560
+ exists = /*#__PURE__*/function () {
561
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(tags) {
562
+ var common;
563
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
564
+ while (1) switch (_context7.prev = _context7.next) {
565
+ case 0:
566
+ common = {
567
+ owners: attestors,
568
+ block: [0, blockHeight],
569
+ fields: ["tags"]
570
+ };
571
+ _context7.next = 3;
572
+ return ar.gql.txs(_objectSpread(_objectSpread({}, common), {}, {
573
+ tags: tags
574
+ }));
575
+ case 3:
576
+ _context7.t0 = _context7.sent.length;
577
+ return _context7.abrupt("return", _context7.t0 > 0);
578
+ case 5:
579
+ case "end":
580
+ return _context7.stop();
581
+ }
582
+ }, _callee7);
583
+ }));
584
+ return function exists(_x) {
585
+ return _ref.apply(this, arguments);
586
+ };
587
+ }();
588
+ _context8.next = 24;
589
+ return exists({
590
+ Type: "Attestation",
591
+ Message: ID,
592
+ "Data-Protocol": "ao"
593
+ });
594
+ case 24:
595
+ assignmentsHaveID = _context8.sent;
838
596
  if (!assignmentsHaveID) {
839
- _context14.next = 26;
597
+ _context8.next = 27;
840
598
  break;
841
599
  }
842
- return _context14.abrupt("return", true);
843
- case 26:
600
+ return _context8.abrupt("return", true);
601
+ case 27:
844
602
  if (!(processMode == "Individual")) {
845
- _context14.next = 32;
603
+ _context8.next = 33;
846
604
  break;
847
605
  }
848
- _context14.next = 29;
849
- return _this8.queryHasResult("query {\n transactions(\n owners: ".concat(attestors, ",\n block: {min: 0, max: ").concat(blockHeight, "},\n tags: [\n { name: \"Type\", values: [\"Available\"]},\n { name: \"ID\", values: [\"").concat(ID, "\"]}\n { name: \"Data-Protocol\", values: [\"WeaveDrive\"] },\n ]\n ) \n {\n edges {\n node {\n tags {\n name\n value\n }\n }\n }\n }\n }"));
850
- case 29:
851
- individualsHaveID = _context14.sent;
606
+ _context8.next = 30;
607
+ return exists({
608
+ Type: "Available",
609
+ ID: ID,
610
+ "Data-Protocol": "WeaveDrive"
611
+ });
612
+ case 30:
613
+ individualsHaveID = _context8.sent;
852
614
  if (!individualsHaveID) {
853
- _context14.next = 32;
615
+ _context8.next = 33;
854
616
  break;
855
617
  }
856
- return _context14.abrupt("return", true);
857
- case 32:
618
+ return _context8.abrupt("return", true);
619
+ case 33:
858
620
  if (!(processMode == "Library")) {
859
- _context14.next = 34;
621
+ _context8.next = 35;
860
622
  break;
861
623
  }
862
624
  throw "This WeaveDrive implementation does not support Library attestations yet!";
863
- case 34:
864
- return _context14.abrupt("return", false);
865
625
  case 35:
626
+ return _context8.abrupt("return", false);
627
+ case 36:
866
628
  case "end":
867
- return _context14.stop();
629
+ return _context8.stop();
868
630
  }
869
- }, _callee14);
631
+ }, _callee8);
870
632
  }))();
871
633
  },
872
634
  serializeStringArr: function serializeStringArr() {
@@ -878,127 +640,13 @@ var WeaveDrive = exports["default"] = /*#__PURE__*/_createClass(function WeaveDr
878
640
  getTagValues: function getTagValues(key, tags) {
879
641
  var values = [];
880
642
  for (var i = 0; i < tags.length; i++) {
881
- if (tags[i].name == key) {
882
- values.push(tags[i].value);
883
- }
643
+ if (tags[i].name == key) values.push(tags[i].value);
884
644
  }
885
645
  return values;
886
646
  },
887
647
  getTagValue: function getTagValue(key, tags) {
888
648
  var values = this.getTagValues(key, tags);
889
649
  return values.pop();
890
- },
891
- queryHasResult: function queryHasResult(query, variables) {
892
- var _this9 = this;
893
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
894
- var _json$data;
895
- var json;
896
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
897
- while (1) switch (_context15.prev = _context15.next) {
898
- case 0:
899
- _context15.next = 2;
900
- return _this9.gqlQuery(query, variables).then(function (res) {
901
- return res.json();
902
- });
903
- case 2:
904
- json = _context15.sent;
905
- return _context15.abrupt("return", !!(json !== null && json !== void 0 && (_json$data = json.data) !== null && _json$data !== void 0 && (_json$data = _json$data.transactions) !== null && _json$data !== void 0 && (_json$data = _json$data.edges) !== null && _json$data !== void 0 && _json$data.length));
906
- case 4:
907
- case "end":
908
- return _context15.stop();
909
- }
910
- }, _callee15);
911
- }))();
912
- },
913
- gqlExists: function gqlExists() {
914
- var _this10 = this;
915
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
916
- var query, gqlExists;
917
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
918
- while (1) switch (_context16.prev = _context16.next) {
919
- case 0:
920
- query = "query {\n transactions(\n first: 1\n ) {\n pageInfo {\n hasNextPage\n }\n }\n }\n ";
921
- _context16.next = 3;
922
- return _this10.gqlQuery(query, {}).then(function (res) {
923
- return res.ok;
924
- });
925
- case 3:
926
- gqlExists = _context16.sent;
927
- return _context16.abrupt("return", gqlExists);
928
- case 5:
929
- case "end":
930
- return _context16.stop();
931
- }
932
- }, _callee16);
933
- }))();
934
- },
935
- gqlQuery: function gqlQuery(query, variables) {
936
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
937
- var _json, _toGraphObj, tar, args, res2, edges;
938
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
939
- while (1) switch (_context17.prev = _context17.next) {
940
- case 0:
941
- _json = null;
942
- _context17.prev = 1;
943
- _toGraphObj = (0, _utils.toGraphObj)({
944
- query: query,
945
- variables: variables
946
- }), tar = _toGraphObj.tar, args = _toGraphObj.args;
947
- res2 = null;
948
- if (!(tar === "transactions")) {
949
- _context17.next = 10;
950
- break;
951
- }
952
- _context17.next = 7;
953
- return ar.gql.txs(_objectSpread({}, args));
954
- case 7:
955
- res2 = _context17.sent;
956
- _context17.next = 14;
957
- break;
958
- case 10:
959
- if (!(tar === "blocks")) {
960
- _context17.next = 14;
961
- break;
962
- }
963
- _context17.next = 13;
964
- return ar.gql.blocks(_objectSpread({}, args));
965
- case 13:
966
- res2 = _context17.sent;
967
- case 14:
968
- edges = (0, _ramda.map)(function (v) {
969
- return {
970
- node: v,
971
- cursor: v.cursor
972
- };
973
- }, res2);
974
- _json = {
975
- data: {
976
- transactions: {
977
- pageInfo: {
978
- hasNextPage: true
979
- },
980
- edges: edges
981
- }
982
- }
983
- };
984
- _context17.next = 21;
985
- break;
986
- case 18:
987
- _context17.prev = 18;
988
- _context17.t0 = _context17["catch"](1);
989
- log(_context17.t0);
990
- case 21:
991
- return _context17.abrupt("return", {
992
- json: function json() {
993
- return _json;
994
- }
995
- });
996
- case 22:
997
- case "end":
998
- return _context17.stop();
999
- }
1000
- }, _callee17, null, [[1, 18]]);
1001
- }))();
1002
650
  }
1003
651
  };
1004
652
  };