wao 0.2.4 → 0.3.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/aoconnect.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mu = exports.connect = exports.acc = void 0;
7
+ var _arweave = _interopRequireDefault(require("arweave"));
7
8
  var _warpArbundles = require("warp-arbundles");
8
9
  var _base64url = _interopRequireDefault(require("base64url"));
9
10
  var _aoLoader = _interopRequireDefault(require("@permaweb/ao-loader"));
@@ -13,24 +14,952 @@ var _ramda = require("ramda");
13
14
  var _accounts = _interopRequireDefault(require("./accounts.js"));
14
15
  var _utils = require("./utils.js");
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
18
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ 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; } }
20
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
23
+ 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); }
24
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
25
+ 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."); }
26
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
27
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
16
28
  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
29
  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
30
  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
31
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
32
  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); }
33
+ 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
34
  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; } } }; }
22
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
23
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
35
  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; } }
25
36
  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; }
26
- 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; } }
27
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
28
- 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; }
29
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
30
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
31
37
  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); }
32
38
  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); }); }; }
33
- 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); }
39
+ var _txs = {};
40
+ var KB = 1024;
41
+ var MB = KB * 1024;
42
+ var CACHE_SZ = 32 * KB;
43
+ var CHUNK_SZ = 128 * MB;
44
+ var NOTIFY_SZ = 512 * MB;
45
+ function WeaveDrive(mod, FS) {
46
+ return {
47
+ reset: function reset(fd) {
48
+ //console.log("WeaveDrive: Resetting fd: ", fd)
49
+ FS.streams[fd].node.position = 0;
50
+ FS.streams[fd].node.cache = new Uint8Array(0);
51
+ },
52
+ joinUrl: function joinUrl(_ref) {
53
+ var url = _ref.url,
54
+ path = _ref.path;
55
+ if (!path) return url;
56
+ if (path.startsWith("/")) return this.joinUrl({
57
+ url: url,
58
+ path: path.slice(1)
59
+ });
60
+ url = new URL(url);
61
+ url.pathname += path;
62
+ return url.toString();
63
+ },
64
+ customFetch: function customFetch(path, options) {
65
+ var _this = this;
66
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
67
+ var urlList, p, _iterator, _step, url, res;
68
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
69
+ while (1) switch (_context.prev = _context.next) {
70
+ case 0:
71
+ txs[path] = true;
72
+ /**
73
+ * mod.ARWEAVE may be a comma-delimited list of urls.
74
+ * So we parse it into an array that we sequentially consume
75
+ * using fetch, and return the first successful response.
76
+ *
77
+ * The first url is considered "primary". So if all urls fail
78
+ * to produce a successful response, then we return the primary's
79
+ * error response
80
+ */
81
+ urlList = mod.ARWEAVE.includes(",") ? mod.ARWEAVE.split(",").map(function (url) {
82
+ return url.trim();
83
+ }) : [mod.ARWEAVE];
84
+ _iterator = _createForOfIteratorHelper(urlList);
85
+ _context.prev = 3;
86
+ _iterator.s();
87
+ case 5:
88
+ if ((_step = _iterator.n()).done) {
89
+ _context.next = 15;
90
+ break;
91
+ }
92
+ url = _step.value;
93
+ //txs[this.joinUrl({ url, path })] = true
94
+ res = fetch(_this.joinUrl({
95
+ url: url,
96
+ path: path
97
+ }), options);
98
+ _context.next = 10;
99
+ return res.then(function (r) {
100
+ return r.ok;
101
+ })["catch"](function () {
102
+ return false;
103
+ });
104
+ case 10:
105
+ if (!_context.sent) {
106
+ _context.next = 12;
107
+ break;
108
+ }
109
+ return _context.abrupt("return", res);
110
+ case 12:
111
+ if (!p) p = res;
112
+ case 13:
113
+ _context.next = 5;
114
+ break;
115
+ case 15:
116
+ _context.next = 20;
117
+ break;
118
+ case 17:
119
+ _context.prev = 17;
120
+ _context.t0 = _context["catch"](3);
121
+ _iterator.e(_context.t0);
122
+ case 20:
123
+ _context.prev = 20;
124
+ _iterator.f();
125
+ return _context.finish(20);
126
+ case 23:
127
+ return _context.abrupt("return", p);
128
+ case 24:
129
+ case "end":
130
+ return _context.stop();
131
+ }
132
+ }, _callee, null, [[3, 17, 20, 23]]);
133
+ }))();
134
+ },
135
+ create: function create(id) {
136
+ var _this2 = this;
137
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
138
+ var properties, node, bytesLength, stream;
139
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
140
+ while (1) switch (_context2.prev = _context2.next) {
141
+ case 0:
142
+ properties = {
143
+ isDevice: false,
144
+ contents: null
145
+ };
146
+ _context2.next = 3;
147
+ return _this2.checkAdmissible(id);
148
+ case 3:
149
+ if (_context2.sent) {
150
+ _context2.next = 5;
151
+ break;
152
+ }
153
+ return _context2.abrupt("return", 0);
154
+ case 5:
155
+ // Create the file in the emscripten FS
156
+
157
+ // This check/mkdir was added for AOP 6 Boot loader because create is
158
+ // called first because were only loading Data, we needed to create
159
+ // the directory. See: https://github.com/permaweb/aos/issues/342
160
+ if (!FS.analyzePath("/data/").exists) {
161
+ FS.mkdir("/data/");
162
+ }
163
+ node = FS.createFile("/", "data/" + id, properties, true, false); // Set initial parameters
164
+ /*
165
+ var bytesLength = await this.customFetch(`/${id}`, {
166
+ method: "HEAD",
167
+ }).then(res => res.headers.get("Content-Length"))
168
+ */
169
+ bytesLength = _txs[id] ? new TextEncoder().encode(_txs[id]).length : 100;
170
+ node.total_size = Number(bytesLength);
171
+ node.cache = new Uint8Array(0);
172
+ node.position = 0;
173
+
174
+ // Add a function that defers querying the file size until it is asked the first time.
175
+ Object.defineProperties(node, {
176
+ usedBytes: {
177
+ get: function get() {
178
+ return bytesLength;
179
+ }
180
+ }
181
+ });
182
+
183
+ // Now we have created the file in the emscripten FS, we can open it as a stream
184
+ stream = FS.open("/data/" + id, "r"); //console.log("JS: Created file: ", id, " fd: ", stream.fd);
185
+ return _context2.abrupt("return", stream);
186
+ case 14:
187
+ case "end":
188
+ return _context2.stop();
189
+ }
190
+ }, _callee2);
191
+ }))();
192
+ },
193
+ createBlockHeader: function createBlockHeader(id) {
194
+ var _this3 = this;
195
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
196
+ var customFetch, retry, _retry, result, bytesLength, node, stream;
197
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
198
+ while (1) switch (_context4.prev = _context4.next) {
199
+ case 0:
200
+ _retry = function _retry3() {
201
+ _retry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(x) {
202
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
203
+ while (1) switch (_context3.prev = _context3.next) {
204
+ case 0:
205
+ return _context3.abrupt("return", new Promise(function (r) {
206
+ setTimeout(function () {
207
+ r(customFetch("/block/height/".concat(id)));
208
+ }, x * 10000);
209
+ }));
210
+ case 1:
211
+ case "end":
212
+ return _context3.stop();
213
+ }
214
+ }, _callee3);
215
+ }));
216
+ return _retry.apply(this, arguments);
217
+ };
218
+ retry = function _retry2(_x) {
219
+ return _retry.apply(this, arguments);
220
+ };
221
+ customFetch = _this3.customFetch; // todo: add a bunch of retries
222
+ _context4.next = 5;
223
+ return _this3.customFetch("/block/height/".concat(id)).then(function (res) {
224
+ return !res.ok ? retry(1) : res;
225
+ }).then(function (res) {
226
+ return !res.ok ? retry(2) : res;
227
+ }).then(function (res) {
228
+ return !res.ok ? retry(3) : res;
229
+ }).then(function (res) {
230
+ return !res.ok ? retry(4) : res;
231
+ }).then(function (res) {
232
+ return res.text();
233
+ });
234
+ case 5:
235
+ result = _context4.sent;
236
+ bytesLength = result.length;
237
+ node = FS.createDataFile("/", "block/" + id, Buffer.from(result, "utf-8"), true, false);
238
+ stream = FS.open("/block/" + id, "r");
239
+ return _context4.abrupt("return", stream);
240
+ case 10:
241
+ case "end":
242
+ return _context4.stop();
243
+ }
244
+ }, _callee4);
245
+ }))();
246
+ },
247
+ createTxHeader: function createTxHeader(id) {
248
+ var _this4 = this;
249
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
250
+ var customFetch, toAddress, _toAddress, retry, _retry4, result, node, stream;
251
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
252
+ while (1) switch (_context8.prev = _context8.next) {
253
+ case 0:
254
+ _retry4 = function _retry6() {
255
+ _retry4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(x) {
256
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
257
+ while (1) switch (_context7.prev = _context7.next) {
258
+ case 0:
259
+ return _context7.abrupt("return", new Promise(function (r) {
260
+ setTimeout(function () {
261
+ r(customFetch("/tx/".concat(id)));
262
+ }, x * 10000);
263
+ }));
264
+ case 1:
265
+ case "end":
266
+ return _context7.stop();
267
+ }
268
+ }, _callee7);
269
+ }));
270
+ return _retry4.apply(this, arguments);
271
+ };
272
+ retry = function _retry5(_x3) {
273
+ return _retry4.apply(this, arguments);
274
+ };
275
+ _toAddress = function _toAddress3() {
276
+ _toAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(owner) {
277
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
278
+ while (1) switch (_context6.prev = _context6.next) {
279
+ case 0:
280
+ _context6.t0 = _arweave["default"].utils;
281
+ _context6.next = 3;
282
+ return _arweave["default"].crypto.hash(_arweave["default"].utils.b64UrlToBuffer(owner));
283
+ case 3:
284
+ _context6.t1 = _context6.sent;
285
+ return _context6.abrupt("return", _context6.t0.bufferTob64Url.call(_context6.t0, _context6.t1));
286
+ case 5:
287
+ case "end":
288
+ return _context6.stop();
289
+ }
290
+ }, _callee6);
291
+ }));
292
+ return _toAddress.apply(this, arguments);
293
+ };
294
+ toAddress = function _toAddress2(_x2) {
295
+ return _toAddress.apply(this, arguments);
296
+ };
297
+ customFetch = _this4.customFetch; // todo: add a bunch of retries
298
+ _context8.next = 7;
299
+ return _this4.customFetch("/tx/".concat(id)).then(function (res) {
300
+ return !res.ok ? retry(1) : res;
301
+ }).then(function (res) {
302
+ return !res.ok ? retry(2) : res;
303
+ }).then(function (res) {
304
+ return !res.ok ? retry(3) : res;
305
+ }).then(function (res) {
306
+ return !res.ok ? retry(4) : res;
307
+ }).then(function (res) {
308
+ return res.json();
309
+ }).then(/*#__PURE__*/function () {
310
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(entry) {
311
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
312
+ while (1) switch (_context5.prev = _context5.next) {
313
+ case 0:
314
+ _context5.t0 = _objectSpread;
315
+ _context5.t1 = _objectSpread({}, entry);
316
+ _context5.t2 = {};
317
+ _context5.next = 5;
318
+ return toAddress(entry.owner);
319
+ case 5:
320
+ _context5.t3 = _context5.sent;
321
+ _context5.t4 = {
322
+ ownerAddress: _context5.t3
323
+ };
324
+ return _context5.abrupt("return", (0, _context5.t0)(_context5.t1, _context5.t2, _context5.t4));
325
+ case 8:
326
+ case "end":
327
+ return _context5.stop();
328
+ }
329
+ }, _callee5);
330
+ }));
331
+ return function (_x4) {
332
+ return _ref2.apply(this, arguments);
333
+ };
334
+ }())
335
+ //.then(x => (console.error(x), x))
336
+ .then(function (x) {
337
+ return JSON.stringify(x);
338
+ });
339
+ case 7:
340
+ result = _context8.sent;
341
+ node = FS.createDataFile("/", "tx/" + id, Buffer.from(result, "utf-8"), true, false);
342
+ stream = FS.open("/tx/" + id, "r");
343
+ return _context8.abrupt("return", stream);
344
+ case 11:
345
+ case "end":
346
+ return _context8.stop();
347
+ }
348
+ }, _callee8);
349
+ }))();
350
+ },
351
+ createDataItemTxHeader: function createDataItemTxHeader(id) {
352
+ var _this5 = this;
353
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
354
+ var gqlQuery, GET_TRANSACTION_QUERY, variables, retry, _retry7, gqlExists, result, stream;
355
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
356
+ while (1) switch (_context11.prev = _context11.next) {
357
+ case 0:
358
+ _retry7 = function _retry9() {
359
+ _retry7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(x) {
360
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
361
+ while (1) switch (_context10.prev = _context10.next) {
362
+ case 0:
363
+ return _context10.abrupt("return", new Promise(function (r) {
364
+ setTimeout(function () {
365
+ r(gqlQuery(GET_TRANSACTION_QUERY, variables));
366
+ }, x * 10000);
367
+ }));
368
+ case 1:
369
+ case "end":
370
+ return _context10.stop();
371
+ }
372
+ }, _callee10);
373
+ }));
374
+ return _retry7.apply(this, arguments);
375
+ };
376
+ retry = function _retry8(_x5) {
377
+ return _retry7.apply(this, arguments);
378
+ };
379
+ gqlQuery = _this5.gqlQuery;
380
+ 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 }";
381
+ variables = {
382
+ transactionIds: [id]
383
+ };
384
+ _context11.next = 7;
385
+ return _this5.gqlExists();
386
+ case 7:
387
+ gqlExists = _context11.sent;
388
+ if (gqlExists) {
389
+ _context11.next = 10;
390
+ break;
391
+ }
392
+ return _context11.abrupt("return", "GQL Not Found!");
393
+ case 10:
394
+ _context11.next = 12;
395
+ return _this5.gqlQuery(GET_TRANSACTION_QUERY, variables).then(function (res) {
396
+ return !res.ok ? retry(1) : res;
397
+ }).then(function (res) {
398
+ return !res.ok ? retry(2) : res;
399
+ }).then(function (res) {
400
+ return !res.ok ? retry(3) : res;
401
+ }).then(function (res) {
402
+ return !res.ok ? retry(4) : res;
403
+ }).then(function (res) {
404
+ return res.json();
405
+ }).then(function (res) {
406
+ var _res$data;
407
+ 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";
408
+ }).then(/*#__PURE__*/function () {
409
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(entry) {
410
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
411
+ while (1) switch (_context9.prev = _context9.next) {
412
+ case 0:
413
+ return _context9.abrupt("return", typeof entry == "string" ? entry : _objectSpread({
414
+ format: 3
415
+ }, entry));
416
+ case 1:
417
+ case "end":
418
+ return _context9.stop();
419
+ }
420
+ }, _callee9);
421
+ }));
422
+ return function (_x6) {
423
+ return _ref3.apply(this, arguments);
424
+ };
425
+ }()).then(function (x) {
426
+ return typeof x == "string" ? x : JSON.stringify(x);
427
+ });
428
+ case 12:
429
+ result = _context11.sent;
430
+ if (!(result === "No results")) {
431
+ _context11.next = 15;
432
+ break;
433
+ }
434
+ return _context11.abrupt("return", result);
435
+ case 15:
436
+ FS.createDataFile("/", "tx2/" + id, Buffer.from(result, "utf-8"), true, false);
437
+ stream = FS.open("/tx2/" + id, "r");
438
+ return _context11.abrupt("return", stream);
439
+ case 18:
440
+ case "end":
441
+ return _context11.stop();
442
+ }
443
+ }, _callee11);
444
+ }))();
445
+ },
446
+ open: function open(filename) {
447
+ var _this6 = this;
448
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
449
+ var pathCategory, id, stream, _stream, _stream2, _stream3, _stream4;
450
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
451
+ while (1) switch (_context12.prev = _context12.next) {
452
+ case 0:
453
+ pathCategory = filename.split("/")[1];
454
+ id = filename.split("/")[2];
455
+ console.log("JS: Opening ID: ", id);
456
+ if (!(pathCategory === "tx")) {
457
+ _context12.next = 16;
458
+ break;
459
+ }
460
+ FS.createPath("/", "tx", true, false);
461
+ if (!FS.analyzePath(filename).exists) {
462
+ _context12.next = 12;
463
+ break;
464
+ }
465
+ stream = FS.open(filename, "r");
466
+ if (!stream.fd) {
467
+ _context12.next = 9;
468
+ break;
469
+ }
470
+ return _context12.abrupt("return", stream.fd);
471
+ case 9:
472
+ return _context12.abrupt("return", 0);
473
+ case 12:
474
+ _context12.next = 14;
475
+ return _this6.createTxHeader(id);
476
+ case 14:
477
+ _stream = _context12.sent;
478
+ return _context12.abrupt("return", _stream.fd);
479
+ case 16:
480
+ if (!(pathCategory === "tx2")) {
481
+ _context12.next = 31;
482
+ break;
483
+ }
484
+ FS.createPath("/", "tx2", true, false);
485
+ if (!FS.analyzePath(filename).exists) {
486
+ _context12.next = 25;
487
+ break;
488
+ }
489
+ stream = FS.open(filename, "r");
490
+ if (!stream.fd) {
491
+ _context12.next = 22;
492
+ break;
493
+ }
494
+ return _context12.abrupt("return", stream.fd);
495
+ case 22:
496
+ return _context12.abrupt("return", 0);
497
+ case 25:
498
+ _context12.next = 27;
499
+ return _this6.createDataItemTxHeader(id);
500
+ case 27:
501
+ _stream2 = _context12.sent;
502
+ if (!_stream2.fd) {
503
+ _context12.next = 30;
504
+ break;
505
+ }
506
+ return _context12.abrupt("return", _stream2.fd);
507
+ case 30:
508
+ return _context12.abrupt("return", 0);
509
+ case 31:
510
+ if (!(pathCategory === "block")) {
511
+ _context12.next = 44;
512
+ break;
513
+ }
514
+ FS.createPath("/", "block", true, false);
515
+ if (!FS.analyzePath(filename).exists) {
516
+ _context12.next = 40;
517
+ break;
518
+ }
519
+ stream = FS.open(filename, "r");
520
+ if (!stream.fd) {
521
+ _context12.next = 37;
522
+ break;
523
+ }
524
+ return _context12.abrupt("return", stream.fd);
525
+ case 37:
526
+ return _context12.abrupt("return", 0);
527
+ case 40:
528
+ _context12.next = 42;
529
+ return _this6.createBlockHeader(id);
530
+ case 42:
531
+ _stream3 = _context12.sent;
532
+ return _context12.abrupt("return", _stream3.fd);
533
+ case 44:
534
+ if (!(pathCategory === "data")) {
535
+ _context12.next = 59;
536
+ break;
537
+ }
538
+ if (!FS.analyzePath(filename).exists) {
539
+ _context12.next = 53;
540
+ break;
541
+ }
542
+ stream = FS.open(filename, "r");
543
+ if (!stream.fd) {
544
+ _context12.next = 49;
545
+ break;
546
+ }
547
+ return _context12.abrupt("return", stream.fd);
548
+ case 49:
549
+ console.log("JS: File not found: ", filename);
550
+ return _context12.abrupt("return", 0);
551
+ case 53:
552
+ _context12.next = 55;
553
+ return _this6.create(id);
554
+ case 55:
555
+ _stream4 = _context12.sent;
556
+ return _context12.abrupt("return", _stream4.fd);
557
+ case 57:
558
+ _context12.next = 66;
559
+ break;
560
+ case 59:
561
+ if (!(pathCategory === "headers")) {
562
+ _context12.next = 64;
563
+ break;
564
+ }
565
+ console.log("Header access not implemented yet.");
566
+ return _context12.abrupt("return", 0);
567
+ case 64:
568
+ console.log("JS: Invalid path category: ", pathCategory);
569
+ return _context12.abrupt("return", 0);
570
+ case 66:
571
+ case "end":
572
+ return _context12.stop();
573
+ }
574
+ }, _callee12);
575
+ }))();
576
+ },
577
+ read: function read(fd, raw_dst_ptr, raw_length) {
578
+ var _this7 = this;
579
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
580
+ var _txs$stream$node$name;
581
+ 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;
582
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
583
+ while (1) switch (_context13.prev = _context13.next) {
584
+ case 0:
585
+ // Note: The length and dst_ptr are 53 bit integers in JS, so this _should_ be ok into a large memspace.
586
+ to_read = Number(raw_length);
587
+ dst_ptr = Number(raw_dst_ptr);
588
+ stream = 0;
589
+ for (i = 0; i < FS.streams.length; i++) {
590
+ if (FS.streams[i].fd === fd) {
591
+ stream = FS.streams[i];
592
+ }
593
+ }
594
+ // read block headers
595
+ if (!stream.path.includes("/block")) {
596
+ _context13.next = 7;
597
+ break;
598
+ }
599
+ mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
600
+ return _context13.abrupt("return", to_read);
601
+ case 7:
602
+ if (!stream.path.includes("/tx")) {
603
+ _context13.next = 10;
604
+ break;
605
+ }
606
+ mod.HEAP8.set(stream.node.contents.subarray(0, to_read), dst_ptr);
607
+ return _context13.abrupt("return", to_read);
608
+ case 10:
609
+ // Satisfy what we can with the cache first
610
+ bytes_read = _this7.readFromCache(stream, dst_ptr, to_read);
611
+ stream.position += bytes_read;
612
+ stream.lastReadPosition = stream.position;
613
+ dst_ptr += bytes_read;
614
+ to_read -= bytes_read;
615
+
616
+ // Return if we have satisfied the request
617
+ if (!(to_read === 0)) {
618
+ _context13.next = 17;
619
+ break;
620
+ }
621
+ return _context13.abrupt("return", bytes_read);
622
+ case 17:
623
+ //console.log("WeaveDrive: Read from cache: ", bytes_read, " Remaining to read: ", to_read)
624
+ chunk_download_sz = Math.max(to_read, CACHE_SZ);
625
+ 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)
626
+ // Fetch with streaming
627
+ /*
628
+ const response = await this.customFetch(`/${stream.node.name}`, {
629
+ method: "GET",
630
+ redirect: "follow",
631
+ headers: { Range: `bytes=${stream.position}-${to}` },
632
+ })
633
+ const reader = response.body.getReader()
634
+ */
635
+ data = new TextEncoder().encode((_txs$stream$node$name = _txs[stream.node.name]) !== null && _txs$stream$node$name !== void 0 ? _txs$stream$node$name : ""); // Extract the Range header to determine the start and end of the requested chunk
636
+ start = 0;
637
+ end = data.length; // Create a ReadableStream for the requested chunk
638
+ chunk = data.subarray(start, end);
639
+ response = new Response(new ReadableStream({
640
+ start: function start(controller) {
641
+ controller.enqueue(chunk); // Push the chunk to the stream
642
+ controller.close(); // Close the stream when done
643
+ }
644
+ }), {
645
+ headers: {
646
+ "Content-Length": chunk.length.toString()
647
+ }
648
+ });
649
+ reader = response.body.getReader();
650
+ bytes_until_cache = CHUNK_SZ;
651
+ bytes_until_notify = NOTIFY_SZ;
652
+ downloaded_bytes = 0;
653
+ cache_chunks = [];
654
+ _context13.prev = 29;
655
+ case 30:
656
+ if (!true) {
657
+ _context13.next = 48;
658
+ break;
659
+ }
660
+ _context13.next = 33;
661
+ return reader.read();
662
+ case 33:
663
+ _yield$reader$read = _context13.sent;
664
+ done = _yield$reader$read.done;
665
+ chunk_bytes = _yield$reader$read.value;
666
+ if (!done) {
667
+ _context13.next = 38;
668
+ break;
669
+ }
670
+ return _context13.abrupt("break", 48);
671
+ case 38:
672
+ // Update the number of downloaded bytes to be _all_, not just the write length
673
+ downloaded_bytes += chunk_bytes.length;
674
+ bytes_until_cache -= chunk_bytes.length;
675
+ bytes_until_notify -= chunk_bytes.length;
676
+
677
+ // Write bytes from the chunk and update the pointer if necessary
678
+ write_length = Math.min(chunk_bytes.length, to_read);
679
+ if (write_length > 0) {
680
+ //console.log("WeaveDrive: Writing: ", write_length, " bytes to: ", dst_ptr)
681
+ mod.HEAP8.set(chunk_bytes.subarray(0, write_length), dst_ptr);
682
+ dst_ptr += write_length;
683
+ bytes_read += write_length;
684
+ stream.position += write_length;
685
+ to_read -= write_length;
686
+ }
687
+ if (to_read == 0) {
688
+ // Add excess bytes to our cache
689
+ chunk_to_cache = chunk_bytes.subarray(write_length); //console.log("WeaveDrive: Cacheing excess: ", chunk_to_cache.length)
690
+ cache_chunks.push(chunk_to_cache);
691
+ }
692
+ if (bytes_until_cache <= 0) {
693
+ console.log("WeaveDrive: Chunk size reached. Compressing cache...");
694
+ stream.node.cache = _this7.addChunksToCache(stream.node.cache, cache_chunks);
695
+ cache_chunks = [];
696
+ bytes_until_cache = CHUNK_SZ;
697
+ }
698
+ if (bytes_until_notify <= 0) {
699
+ console.log("WeaveDrive: Downloaded: ", downloaded_bytes / stream.node.total_size * 100, "%");
700
+ bytes_until_notify = NOTIFY_SZ;
701
+ }
702
+ _context13.next = 30;
703
+ break;
704
+ case 48:
705
+ _context13.next = 53;
706
+ break;
707
+ case 50:
708
+ _context13.prev = 50;
709
+ _context13.t0 = _context13["catch"](29);
710
+ console.error("WeaveDrive: Error reading the stream: ", _context13.t0);
711
+ case 53:
712
+ _context13.prev = 53;
713
+ reader.releaseLock();
714
+ return _context13.finish(53);
715
+ case 56:
716
+ // If we have no cache, or we have not satisfied the full request, we need to download the rest
717
+ // Rebuild the cache from the new cache chunks
718
+ stream.node.cache = _this7.addChunksToCache(stream.node.cache, cache_chunks);
719
+
720
+ // Update the last read position
721
+ stream.lastReadPosition = stream.position;
722
+ return _context13.abrupt("return", bytes_read);
723
+ case 59:
724
+ case "end":
725
+ return _context13.stop();
726
+ }
727
+ }, _callee13, null, [[29, 50, 53, 56]]);
728
+ }))();
729
+ },
730
+ close: function close(fd) {
731
+ var stream = 0;
732
+ for (var i = 0; i < FS.streams.length; i++) {
733
+ if (FS.streams[i].fd === fd) {
734
+ stream = FS.streams[i];
735
+ }
736
+ }
737
+ FS.close(stream);
738
+ },
739
+ // Readahead cache functions
740
+ readFromCache: function readFromCache(stream, dst_ptr, length) {
741
+ // Check if the cache has been invalidated by a seek
742
+ if (stream.lastReadPosition !== stream.position) {
743
+ //console.log("WeaveDrive: Invalidating cache for fd: ", stream.fd, " Current pos: ", stream.position, " Last read pos: ", stream.lastReadPosition)
744
+ stream.node.cache = new Uint8Array(0);
745
+ return 0;
746
+ }
747
+ // Calculate the bytes of the request that can be satisfied with the cache
748
+ var cache_part_length = Math.min(length, stream.node.cache.length);
749
+ var cache_part = stream.node.cache.subarray(0, cache_part_length);
750
+ mod.HEAP8.set(cache_part, dst_ptr);
751
+ // Set the new cache to the remainder of the unused cache and update pointers
752
+ stream.node.cache = stream.node.cache.subarray(cache_part_length);
753
+ return cache_part_length;
754
+ },
755
+ addChunksToCache: function addChunksToCache(old_cache, chunks) {
756
+ // Make a new cache array of the old cache length + the sum of the chunk lengths, capped by the max cache size
757
+ var new_cache_length = Math.min(old_cache.length + chunks.reduce(function (acc, chunk) {
758
+ return acc + chunk.length;
759
+ }, 0), CACHE_SZ);
760
+ var new_cache = new Uint8Array(new_cache_length);
761
+ // Copy the old cache to the new cache
762
+ new_cache.set(old_cache, 0);
763
+ // Load the cache chunks into the new cache
764
+ var current_offset = old_cache.length;
765
+ var _iterator2 = _createForOfIteratorHelper(chunks),
766
+ _step2;
767
+ try {
768
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
769
+ var chunk = _step2.value;
770
+ if (current_offset < new_cache_length) {
771
+ new_cache.set(chunk.subarray(0, new_cache_length - current_offset), current_offset);
772
+ current_offset += chunk.length;
773
+ }
774
+ }
775
+ } catch (err) {
776
+ _iterator2.e(err);
777
+ } finally {
778
+ _iterator2.f();
779
+ }
780
+ return new_cache;
781
+ },
782
+ // General helpder functions
783
+ checkAdmissible: function checkAdmissible(ID) {
784
+ var _this8 = this;
785
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
786
+ var bootTag, blockHeight, moduleExtensions, moduleHasWeaveDrive, processExtensions, processHasWeaveDrive, modes, moduleAvailabilityType, moduleMode, processAvailabilityType, processMode, attestors, assignmentsHaveID, individualsHaveID;
787
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
788
+ while (1) switch (_context14.prev = _context14.next) {
789
+ case 0:
790
+ if (!(mod.mode && mod.mode == "test")) {
791
+ _context14.next = 2;
792
+ break;
793
+ }
794
+ return _context14.abrupt("return", true);
795
+ case 2:
796
+ // Check if we are attempting to load the On-Boot id, if so allow it
797
+ // this was added for AOP 6 Boot loader See: https://github.com/permaweb/aos/issues/342
798
+ bootTag = _this8.getTagValue("On-Boot", mod.spawn.tags);
799
+ if (!(bootTag && bootTag === ID)) {
800
+ _context14.next = 5;
801
+ break;
802
+ }
803
+ return _context14.abrupt("return", true);
804
+ case 5:
805
+ // Check that this module or process set the WeaveDrive tag on spawn
806
+ blockHeight = mod.blockHeight;
807
+ moduleExtensions = _this8.getTagValues("Extension", mod.module.tags);
808
+ moduleHasWeaveDrive = moduleExtensions.includes("WeaveDrive");
809
+ processExtensions = _this8.getTagValues("Extension", mod.spawn.tags);
810
+ processHasWeaveDrive = moduleHasWeaveDrive || processExtensions.includes("WeaveDrive");
811
+ if (processHasWeaveDrive) {
812
+ _context14.next = 13;
813
+ break;
814
+ }
815
+ console.log("WeaveDrive: Process tried to call WeaveDrive, but extension not set!");
816
+ return _context14.abrupt("return", false);
817
+ case 13:
818
+ modes = ["Assignments", "Individual", "Library"]; // Get the Availability-Type from the spawned process's Module or Process item
819
+ // First check the module for its defaults
820
+ moduleAvailabilityType = _this8.getTagValue("Availability-Type", mod.module.tags);
821
+ moduleMode = moduleAvailabilityType ? moduleAvailabilityType : "Assignments"; // Default to assignments
822
+ // Now check the process's spawn item. These settings override Module item settings.
823
+ processAvailabilityType = _this8.getTagValue("Availability-Type", mod.spawn.tags);
824
+ processMode = processAvailabilityType ? processAvailabilityType : moduleMode;
825
+ if (modes.includes(processMode)) {
826
+ _context14.next = 20;
827
+ break;
828
+ }
829
+ throw "Unsupported WeaveDrive mode: ".concat(processMode);
830
+ case 20:
831
+ attestors = _this8.serializeStringArr([_this8.getTagValue("Scheduler", mod.spawn.tags)].concat(_toConsumableArray(_this8.getTagValues("Attestor", mod.spawn.tags))).filter(function (t) {
832
+ return !!t;
833
+ })); // Init a set of GraphQL queries to run in order to find a valid attestation
834
+ // Every WeaveDrive process has at least the "Assignments" availability check form.
835
+ _context14.next = 23;
836
+ 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 }"));
837
+ case 23:
838
+ assignmentsHaveID = _context14.sent;
839
+ if (!assignmentsHaveID) {
840
+ _context14.next = 26;
841
+ break;
842
+ }
843
+ return _context14.abrupt("return", true);
844
+ case 26:
845
+ if (!(processMode == "Individual")) {
846
+ _context14.next = 32;
847
+ break;
848
+ }
849
+ _context14.next = 29;
850
+ 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 }"));
851
+ case 29:
852
+ individualsHaveID = _context14.sent;
853
+ if (!individualsHaveID) {
854
+ _context14.next = 32;
855
+ break;
856
+ }
857
+ return _context14.abrupt("return", true);
858
+ case 32:
859
+ if (!(processMode == "Library")) {
860
+ _context14.next = 34;
861
+ break;
862
+ }
863
+ throw "This WeaveDrive implementation does not support Library attestations yet!";
864
+ case 34:
865
+ return _context14.abrupt("return", false);
866
+ case 35:
867
+ case "end":
868
+ return _context14.stop();
869
+ }
870
+ }, _callee14);
871
+ }))();
872
+ },
873
+ serializeStringArr: function serializeStringArr() {
874
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
875
+ return "[".concat(arr.map(function (s) {
876
+ return "\"".concat(s, "\"");
877
+ }).join(", "), "]");
878
+ },
879
+ getTagValues: function getTagValues(key, tags) {
880
+ var values = [];
881
+ for (i = 0; i < tags.length; i++) {
882
+ if (tags[i].name == key) {
883
+ values.push(tags[i].value);
884
+ }
885
+ }
886
+ return values;
887
+ },
888
+ getTagValue: function getTagValue(key, tags) {
889
+ var values = this.getTagValues(key, tags);
890
+ return values.pop();
891
+ },
892
+ queryHasResult: function queryHasResult(query, variables) {
893
+ var _this9 = this;
894
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
895
+ var _json$data;
896
+ var json;
897
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
898
+ while (1) switch (_context15.prev = _context15.next) {
899
+ case 0:
900
+ _context15.next = 2;
901
+ return _this9.gqlQuery(query, variables).then(function (res) {
902
+ return res.json();
903
+ });
904
+ case 2:
905
+ json = _context15.sent;
906
+ 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));
907
+ case 4:
908
+ case "end":
909
+ return _context15.stop();
910
+ }
911
+ }, _callee15);
912
+ }))();
913
+ },
914
+ gqlExists: function gqlExists() {
915
+ var _this10 = this;
916
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
917
+ var query, gqlExists;
918
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
919
+ while (1) switch (_context16.prev = _context16.next) {
920
+ case 0:
921
+ query = "query {\n transactions(\n first: 1\n ) {\n pageInfo {\n hasNextPage\n }\n }\n }\n ";
922
+ _context16.next = 3;
923
+ return _this10.gqlQuery(query, {}).then(function (res) {
924
+ return res.ok;
925
+ });
926
+ case 3:
927
+ gqlExists = _context16.sent;
928
+ return _context16.abrupt("return", gqlExists);
929
+ case 5:
930
+ case "end":
931
+ return _context16.stop();
932
+ }
933
+ }, _callee16);
934
+ }))();
935
+ },
936
+ gqlQuery: function gqlQuery(query, variables) {
937
+ var _this11 = this;
938
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
939
+ var options;
940
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
941
+ while (1) switch (_context17.prev = _context17.next) {
942
+ case 0:
943
+ options = {
944
+ method: "POST",
945
+ body: JSON.stringify({
946
+ query: query,
947
+ variables: variables
948
+ }),
949
+ headers: {
950
+ "Content-Type": "application/json"
951
+ }
952
+ };
953
+ return _context17.abrupt("return", _this11.customFetch("graphql", options));
954
+ case 2:
955
+ case "end":
956
+ return _context17.stop();
957
+ }
958
+ }, _callee17);
959
+ }))();
960
+ }
961
+ };
962
+ }
34
963
  function isJSON(obj) {
35
964
  if (obj === null || obj === undefined) return false;
36
965
  if (_typeof(obj) !== "object" || obj instanceof Buffer || obj instanceof ArrayBuffer || Array.isArray(obj)) {
@@ -49,34 +978,34 @@ var jsonToStr = function jsonToStr(obj) {
49
978
  return isJSON(obj) || ((0, _ramda.is)(Number, obj) ? Number(obj).toString() : obj);
50
979
  };
51
980
  var dirname = /*#__PURE__*/function () {
52
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
53
- return _regeneratorRuntime().wrap(function _callee$(_context) {
54
- while (1) switch (_context.prev = _context.next) {
981
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
982
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
983
+ while (1) switch (_context18.prev = _context18.next) {
55
984
  case 0:
56
985
  if (!(typeof __dirname != "undefined")) {
57
- _context.next = 4;
986
+ _context18.next = 4;
58
987
  break;
59
988
  }
60
- _context.t0 = __dirname;
61
- _context.next = 7;
989
+ _context18.t0 = __dirname;
990
+ _context18.next = 7;
62
991
  break;
63
992
  case 4:
64
- _context.next = 6;
993
+ _context18.next = 6;
65
994
  return Promise.resolve().then(function () {
66
995
  return _interopRequireWildcard(require("./dirname.js"));
67
996
  });
68
997
  case 6:
69
- _context.t0 = _context.sent["default"];
998
+ _context18.t0 = _context18.sent["default"];
70
999
  case 7:
71
- return _context.abrupt("return", _context.t0);
1000
+ return _context18.abrupt("return", _context18.t0);
72
1001
  case 8:
73
1002
  case "end":
74
- return _context.stop();
1003
+ return _context18.stop();
75
1004
  }
76
- }, _callee);
1005
+ }, _callee18);
77
1006
  }));
78
1007
  return function dirname() {
79
- return _ref.apply(this, arguments);
1008
+ return _ref4.apply(this, arguments);
80
1009
  };
81
1010
  }();
82
1011
  var acc = exports.acc = _accounts["default"].users;
@@ -111,10 +1040,10 @@ var connect = exports.connect = function connect() {
111
1040
  Tags: []
112
1041
  };
113
1042
  if (input.Data) output.Data = input.Data;
114
- Object.entries(input).forEach(function (_ref2) {
115
- var _ref3 = _slicedToArray(_ref2, 2),
116
- key = _ref3[0],
117
- value = _ref3[1];
1043
+ Object.entries(input).forEach(function (_ref5) {
1044
+ var _ref6 = _slicedToArray(_ref5, 2),
1045
+ key = _ref6[0],
1046
+ value = _ref6[1];
118
1047
  if (key !== "Data" && key !== "Tags" && typeof value === "string") {
119
1048
  output.Tags.push({
120
1049
  name: key,
@@ -150,14 +1079,14 @@ var connect = exports.connect = function connect() {
150
1079
  Tags: Tags !== null && Tags !== void 0 && Tags.length ? Tags : []
151
1080
  };
152
1081
  };
153
- var genEnv = function genEnv(_ref4) {
154
- var pid = _ref4.pid,
155
- _ref4$owner = _ref4.owner,
156
- owner = _ref4$owner === void 0 ? "" : _ref4$owner,
157
- _ref4$module = _ref4.module,
158
- module = _ref4$module === void 0 ? "" : _ref4$module,
159
- _ref4$auth = _ref4.auth,
160
- auth = _ref4$auth === void 0 ? "" : _ref4$auth;
1082
+ var genEnv = function genEnv(_ref7) {
1083
+ var pid = _ref7.pid,
1084
+ _ref7$owner = _ref7.owner,
1085
+ owner = _ref7$owner === void 0 ? "" : _ref7$owner,
1086
+ _ref7$module = _ref7.module,
1087
+ module = _ref7$module === void 0 ? "" : _ref7$module,
1088
+ _ref7$auth = _ref7.auth,
1089
+ auth = _ref7$auth === void 0 ? "" : _ref7$auth;
161
1090
  return {
162
1091
  Process: {
163
1092
  Id: pid,
@@ -192,48 +1121,48 @@ var connect = exports.connect = function connect() {
192
1121
  };
193
1122
  };
194
1123
  var parse = /*#__PURE__*/function () {
195
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opt) {
1124
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(opt) {
196
1125
  var _opt$data;
197
1126
  var item, rowner, hashBuffer, owner;
198
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
199
- while (1) switch (_context2.prev = _context2.next) {
1127
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1128
+ while (1) switch (_context19.prev = _context19.next) {
200
1129
  case 0:
201
- _context2.next = 2;
1130
+ _context19.next = 2;
202
1131
  return opt.signer({
203
1132
  data: (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "",
204
1133
  tags: opt.tags
205
1134
  });
206
1135
  case 2:
207
- item = _context2.sent;
1136
+ item = _context19.sent;
208
1137
  rowner = new _warpArbundles.DataItem(item.raw).rawOwner;
209
- _context2.t0 = Buffer;
210
- _context2.next = 7;
1138
+ _context19.t0 = Buffer;
1139
+ _context19.next = 7;
211
1140
  return crypto.subtle.digest("SHA-256", rowner);
212
1141
  case 7:
213
- _context2.t1 = _context2.sent;
214
- hashBuffer = _context2.t0.from.call(_context2.t0, _context2.t1);
1142
+ _context19.t1 = _context19.sent;
1143
+ hashBuffer = _context19.t0.from.call(_context19.t0, _context19.t1);
215
1144
  owner = _base64url["default"].encode(hashBuffer);
216
- return _context2.abrupt("return", {
1145
+ return _context19.abrupt("return", {
217
1146
  id: item.id,
218
1147
  owner: owner
219
1148
  });
220
1149
  case 11:
221
1150
  case "end":
222
- return _context2.stop();
1151
+ return _context19.stop();
223
1152
  }
224
- }, _callee2);
1153
+ }, _callee19);
225
1154
  }));
226
- return function parse(_x) {
227
- return _ref5.apply(this, arguments);
1155
+ return function parse(_x7) {
1156
+ return _ref8.apply(this, arguments);
228
1157
  };
229
1158
  }();
230
1159
  var postModule = /*#__PURE__*/function () {
231
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref6) {
232
- var data, _ref6$tags, tags, signer, t, _tags, _yield$parse, id, owner, handle;
233
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
234
- while (1) switch (_context3.prev = _context3.next) {
1160
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref9) {
1161
+ var data, _ref9$tags, tags, signer, t, _tags, _yield$parse, id, owner, handle;
1162
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1163
+ while (1) switch (_context20.prev = _context20.next) {
235
1164
  case 0:
236
- data = _ref6.data, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, signer = _ref6.signer;
1165
+ data = _ref9.data, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, signer = _ref9.signer;
237
1166
  t = (0, _ramda.mergeLeft)(tags, {
238
1167
  "Data-Protocol": "ao",
239
1168
  Variant: "ao.TN.1",
@@ -245,40 +1174,42 @@ var connect = exports.connect = function connect() {
245
1174
  "Compute-Limit": "9000000000000"
246
1175
  });
247
1176
  _tags = (0, _utils.buildTags)(t);
248
- _context3.next = 5;
1177
+ _context20.next = 5;
249
1178
  return parse({
250
1179
  tags: _tags,
251
1180
  data: data,
252
1181
  signer: signer
253
1182
  });
254
1183
  case 5:
255
- _yield$parse = _context3.sent;
1184
+ _yield$parse = _context20.sent;
256
1185
  id = _yield$parse.id;
257
1186
  owner = _yield$parse.owner;
258
- _context3.next = 10;
1187
+ _context20.next = 10;
259
1188
  return (0, _aoLoader["default"])(data, {
260
- format: t["Module-Format"]
1189
+ format: t["Module-Format"],
1190
+ mode: "test",
1191
+ WeaveDrive: WeaveDrive
261
1192
  });
262
1193
  case 10:
263
- handle = _context3.sent;
1194
+ handle = _context20.sent;
264
1195
  modmap[id] = {
265
1196
  handle: handle,
266
1197
  id: id
267
1198
  };
268
- return _context3.abrupt("return", id);
1199
+ return _context20.abrupt("return", id);
269
1200
  case 13:
270
1201
  case "end":
271
- return _context3.stop();
1202
+ return _context20.stop();
272
1203
  }
273
- }, _callee3);
1204
+ }, _callee20);
274
1205
  }));
275
- return function postModule(_x2) {
276
- return _ref7.apply(this, arguments);
1206
+ return function postModule(_x8) {
1207
+ return _ref10.apply(this, arguments);
277
1208
  };
278
1209
  }();
279
1210
  var spawn = /*#__PURE__*/function () {
280
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
281
- var _opt$module, _opt$tags;
1211
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1212
+ var _opt$module, _opt$tags, _opt$data2;
282
1213
  var opt,
283
1214
  mod,
284
1215
  _dirname,
@@ -286,8 +1217,8 @@ var connect = exports.connect = function connect() {
286
1217
  handle,
287
1218
  _module,
288
1219
  ex,
289
- _iterator,
290
- _step,
1220
+ _iterator3,
1221
+ _step3,
291
1222
  v,
292
1223
  _yield$parse2,
293
1224
  id,
@@ -296,7 +1227,7 @@ var connect = exports.connect = function connect() {
296
1227
  res,
297
1228
  memory,
298
1229
  p,
299
- _opt$data2,
1230
+ _opt$data3,
300
1231
  _msgs$_tags$OnBoot$d,
301
1232
  _msgs$_tags$OnBoot,
302
1233
  data,
@@ -310,46 +1241,48 @@ var connect = exports.connect = function connect() {
310
1241
  _int,
311
1242
  cronTags,
312
1243
  k,
313
- _args4 = arguments;
314
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
315
- while (1) switch (_context4.prev = _context4.next) {
1244
+ _args21 = arguments;
1245
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1246
+ while (1) switch (_context21.prev = _context21.next) {
316
1247
  case 0:
317
- opt = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
1248
+ opt = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
318
1249
  if (opt.module) {
319
- _context4.next = 3;
1250
+ _context21.next = 3;
320
1251
  break;
321
1252
  }
322
1253
  throw Error("module missing");
323
1254
  case 3:
324
1255
  if (opt.scheduler) {
325
- _context4.next = 5;
1256
+ _context21.next = 5;
326
1257
  break;
327
1258
  }
328
1259
  throw Error("scheduler missing");
329
1260
  case 5:
330
1261
  mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : modules["aos2_0_1"];
331
1262
  if (!(!modmap[mod] && wasms[mod])) {
332
- _context4.next = 15;
1263
+ _context21.next = 15;
333
1264
  break;
334
1265
  }
335
- _context4.next = 9;
1266
+ _context21.next = 9;
336
1267
  return dirname();
337
1268
  case 9:
338
- _dirname = _context4.sent;
1269
+ _dirname = _context21.sent;
339
1270
  wasm = (0, _fs.readFileSync)((0, _path.resolve)(_dirname, "lua/".concat(wasms[mod].file, ".wasm")));
340
- _context4.next = 13;
1271
+ _context21.next = 13;
341
1272
  return (0, _aoLoader["default"])(wasm, {
342
- format: wasms[mod].format
1273
+ format: wasms[mod].format,
1274
+ mode: "test",
1275
+ WeaveDrive: WeaveDrive
343
1276
  });
344
1277
  case 13:
345
- handle = _context4.sent;
1278
+ handle = _context21.sent;
346
1279
  modmap[mod] = {
347
1280
  handle: handle,
348
1281
  id: mod
349
1282
  };
350
1283
  case 15:
351
1284
  if (mod) {
352
- _context4.next = 17;
1285
+ _context21.next = 17;
353
1286
  break;
354
1287
  }
355
1288
  throw Error("module not found");
@@ -357,28 +1290,29 @@ var connect = exports.connect = function connect() {
357
1290
  _module = modmap[mod];
358
1291
  ex = false;
359
1292
  (_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
360
- _iterator = _createForOfIteratorHelper(opt.tags);
1293
+ _iterator3 = _createForOfIteratorHelper(opt.tags);
361
1294
  try {
362
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
363
- v = _step.value;
1295
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1296
+ v = _step3.value;
364
1297
  if (v.name === "Type") ex = true;
365
1298
  }
366
1299
  } catch (err) {
367
- _iterator.e(err);
1300
+ _iterator3.e(err);
368
1301
  } finally {
369
- _iterator.f();
1302
+ _iterator3.f();
370
1303
  }
371
1304
  if (!ex) opt.tags.push({
372
1305
  name: "Type",
373
1306
  value: "Process"
374
1307
  });
375
- _context4.next = 25;
1308
+ _context21.next = 25;
376
1309
  return parse(opt);
377
1310
  case 25:
378
- _yield$parse2 = _context4.sent;
1311
+ _yield$parse2 = _context21.sent;
379
1312
  id = _yield$parse2.id;
380
1313
  owner = _yield$parse2.owner;
381
1314
  _tags = (0, _utils.tags)(opt.tags);
1315
+ _txs[id] = (_opt$data2 = opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : null;
382
1316
  res = null;
383
1317
  memory = null;
384
1318
  p = {
@@ -394,11 +1328,11 @@ var connect = exports.connect = function connect() {
394
1328
  opt: opt
395
1329
  };
396
1330
  if (!_tags["On-Boot"]) {
397
- _context4.next = 46;
1331
+ _context21.next = 47;
398
1332
  break;
399
1333
  }
400
1334
  data = "";
401
- if (_tags["On-Boot"] === "Data") data = (_opt$data2 = opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";else data = (_msgs$_tags$OnBoot$d = (_msgs$_tags$OnBoot = msgs[_tags["On-Boot"]]) === null || _msgs$_tags$OnBoot === void 0 ? void 0 : _msgs$_tags$OnBoot.data) !== null && _msgs$_tags$OnBoot$d !== void 0 ? _msgs$_tags$OnBoot$d : "";
1335
+ if (_tags["On-Boot"] === "Data") data = (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "";else data = (_msgs$_tags$OnBoot$d = (_msgs$_tags$OnBoot = msgs[_tags["On-Boot"]]) === null || _msgs$_tags$OnBoot === void 0 ? void 0 : _msgs$_tags$OnBoot.data) !== null && _msgs$_tags$OnBoot$d !== void 0 ? _msgs$_tags$OnBoot$d : "";
402
1336
  msg = genMsg(p, data, opt.tags, owner, mu.addr, true);
403
1337
  _env = genEnv({
404
1338
  pid: p.id,
@@ -407,51 +1341,51 @@ var connect = exports.connect = function connect() {
407
1341
  auth: mu.addr
408
1342
  });
409
1343
  _t = (0, _utils.tags)(msg.Tags);
410
- _context4.next = 40;
1344
+ _context21.next = 41;
411
1345
  return _module.handle(null, msg, _env);
412
- case 40:
413
- res = _context4.sent;
1346
+ case 41:
1347
+ res = _context21.sent;
414
1348
  p.memory = res.Memory;
415
1349
  delete res.Memory;
416
1350
  p.res[id] = res;
417
- _context4.next = 47;
1351
+ _context21.next = 48;
418
1352
  break;
419
- case 46:
420
- p.height += 1;
421
1353
  case 47:
1354
+ p.height += 1;
1355
+ case 48:
422
1356
  msgs[id] = opt;
423
1357
  env[id] = p;
424
1358
  if (!_tags["Cron-Interval"]) {
425
- _context4.next = 73;
1359
+ _context21.next = 74;
426
1360
  break;
427
1361
  }
428
1362
  _tags$CronInterval$s = _tags["Cron-Interval"].split("-"), _tags$CronInterval$s2 = _slicedToArray(_tags$CronInterval$s, 2), num = _tags$CronInterval$s2[0], unit = _tags$CronInterval$s2[1];
429
1363
  _int = 0;
430
- _context4.t0 = unit.replace(/s$/, "");
431
- _context4.next = _context4.t0 === "millisecond" ? 55 : _context4.t0 === "second" ? 57 : _context4.t0 === "minute" ? 59 : _context4.t0 === "hour" ? 61 : _context4.t0 === "day" ? 63 : _context4.t0 === "month" ? 65 : _context4.t0 === "year" ? 67 : 69;
1364
+ _context21.t0 = unit.replace(/s$/, "");
1365
+ _context21.next = _context21.t0 === "millisecond" ? 56 : _context21.t0 === "second" ? 58 : _context21.t0 === "minute" ? 60 : _context21.t0 === "hour" ? 62 : _context21.t0 === "day" ? 64 : _context21.t0 === "month" ? 66 : _context21.t0 === "year" ? 68 : 70;
432
1366
  break;
433
- case 55:
1367
+ case 56:
434
1368
  _int = num;
435
- return _context4.abrupt("break", 69);
436
- case 57:
1369
+ return _context21.abrupt("break", 70);
1370
+ case 58:
437
1371
  _int = num * 1000;
438
- return _context4.abrupt("break", 69);
439
- case 59:
1372
+ return _context21.abrupt("break", 70);
1373
+ case 60:
440
1374
  _int = num * 1000 * 60;
441
- return _context4.abrupt("break", 69);
442
- case 61:
1375
+ return _context21.abrupt("break", 70);
1376
+ case 62:
443
1377
  _int = num * 1000 * 60 * 60;
444
- return _context4.abrupt("break", 69);
445
- case 63:
1378
+ return _context21.abrupt("break", 70);
1379
+ case 64:
446
1380
  _int = num * 1000 * 60 * 60 * 24;
447
- return _context4.abrupt("break", 69);
448
- case 65:
1381
+ return _context21.abrupt("break", 70);
1382
+ case 66:
449
1383
  _int = num * 1000 * 60 * 60 * 24 * 30;
450
- return _context4.abrupt("break", 69);
451
- case 67:
1384
+ return _context21.abrupt("break", 70);
1385
+ case 68:
452
1386
  _int = num * 1000 * 60 * 60 * 24 * 365;
453
- return _context4.abrupt("break", 69);
454
- case 69:
1387
+ return _context21.abrupt("break", 70);
1388
+ case 70:
455
1389
  cronTags = [];
456
1390
  for (k in _tags) {
457
1391
  if (/^Cron-Tag-/.test(k)) {
@@ -463,44 +1397,44 @@ var connect = exports.connect = function connect() {
463
1397
  }
464
1398
  env[id].cronTags = cronTags;
465
1399
  env[id].span = _int;
466
- case 73:
467
- return _context4.abrupt("return", id);
468
1400
  case 74:
1401
+ return _context21.abrupt("return", id);
1402
+ case 75:
469
1403
  case "end":
470
- return _context4.stop();
1404
+ return _context21.stop();
471
1405
  }
472
- }, _callee4);
1406
+ }, _callee21);
473
1407
  }));
474
1408
  return function spawn() {
475
- return _ref8.apply(this, arguments);
1409
+ return _ref11.apply(this, arguments);
476
1410
  };
477
1411
  }();
478
1412
  var assign = /*#__PURE__*/function () {
479
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
480
- var p, _opt, _yield$parse3, id, owner, _opt$data3, _opt$from, _res$Messages, msg, _env, res, _iterator2, _step2, v;
481
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
482
- while (1) switch (_context5.prev = _context5.next) {
1413
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(opt) {
1414
+ var p, _opt, _yield$parse3, id, owner, _opt$data4, _opt$from, _res$Messages, msg, _env, res, _iterator4, _step4, v;
1415
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1416
+ while (1) switch (_context22.prev = _context22.next) {
483
1417
  case 0:
484
1418
  p = env[opt.process];
485
1419
  _opt = (0, _ramda.clone)(msgs[opt.message]);
486
- _context5.next = 4;
1420
+ _context22.next = 4;
487
1421
  return parse(_opt);
488
1422
  case 4:
489
- _yield$parse3 = _context5.sent;
1423
+ _yield$parse3 = _context22.sent;
490
1424
  id = _yield$parse3.id;
491
1425
  owner = _yield$parse3.owner;
492
- _context5.prev = 7;
493
- msg = genMsg(p, (_opt$data3 = _opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", _opt.tags, (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : owner, mu.addr);
1426
+ _context22.prev = 7;
1427
+ msg = genMsg(p, (_opt$data4 = _opt.data) !== null && _opt$data4 !== void 0 ? _opt$data4 : "", _opt.tags, (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : owner, mu.addr);
494
1428
  _env = genEnv({
495
1429
  pid: p.id,
496
1430
  owner: p.owner,
497
1431
  module: p.module,
498
1432
  auth: mu.addr
499
1433
  });
500
- _context5.next = 12;
1434
+ _context22.next = 12;
501
1435
  return p.handle(p.memory, msg, _env);
502
1436
  case 12:
503
- res = _context5.sent;
1437
+ res = _context22.sent;
504
1438
  p.memory = res.Memory;
505
1439
  delete res.Memory;
506
1440
  p.res[id] = res;
@@ -509,20 +1443,20 @@ var connect = exports.connect = function connect() {
509
1443
  id: id
510
1444
  }, _opt));
511
1445
  msgs[id] = _opt;
512
- _iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
513
- _context5.prev = 20;
514
- _iterator2.s();
1446
+ _iterator4 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
1447
+ _context22.prev = 20;
1448
+ _iterator4.s();
515
1449
  case 22:
516
- if ((_step2 = _iterator2.n()).done) {
517
- _context5.next = 29;
1450
+ if ((_step4 = _iterator4.n()).done) {
1451
+ _context22.next = 29;
518
1452
  break;
519
1453
  }
520
- v = _step2.value;
1454
+ v = _step4.value;
521
1455
  if (!env[v.Target]) {
522
- _context5.next = 27;
1456
+ _context22.next = 27;
523
1457
  break;
524
1458
  }
525
- _context5.next = 27;
1459
+ _context22.next = 27;
526
1460
  return _message({
527
1461
  process: v.Target,
528
1462
  tags: v.Tags,
@@ -531,78 +1465,79 @@ var connect = exports.connect = function connect() {
531
1465
  from: opt.process
532
1466
  });
533
1467
  case 27:
534
- _context5.next = 22;
1468
+ _context22.next = 22;
535
1469
  break;
536
1470
  case 29:
537
- _context5.next = 34;
1471
+ _context22.next = 34;
538
1472
  break;
539
1473
  case 31:
540
- _context5.prev = 31;
541
- _context5.t0 = _context5["catch"](20);
542
- _iterator2.e(_context5.t0);
1474
+ _context22.prev = 31;
1475
+ _context22.t0 = _context22["catch"](20);
1476
+ _iterator4.e(_context22.t0);
543
1477
  case 34:
544
- _context5.prev = 34;
545
- _iterator2.f();
546
- return _context5.finish(34);
1478
+ _context22.prev = 34;
1479
+ _iterator4.f();
1480
+ return _context22.finish(34);
547
1481
  case 37:
548
- return _context5.abrupt("return", id);
1482
+ return _context22.abrupt("return", id);
549
1483
  case 40:
550
- _context5.prev = 40;
551
- _context5.t1 = _context5["catch"](7);
552
- console.log(_context5.t1);
1484
+ _context22.prev = 40;
1485
+ _context22.t1 = _context22["catch"](7);
1486
+ console.log(_context22.t1);
553
1487
  case 43:
554
- return _context5.abrupt("return", null);
1488
+ return _context22.abrupt("return", null);
555
1489
  case 44:
556
1490
  case "end":
557
- return _context5.stop();
1491
+ return _context22.stop();
558
1492
  }
559
- }, _callee5, null, [[7, 40], [20, 31, 34, 37]]);
1493
+ }, _callee22, null, [[7, 40], [20, 31, 34, 37]]);
560
1494
  }));
561
- return function assign(_x3) {
562
- return _ref9.apply(this, arguments);
1495
+ return function assign(_x9) {
1496
+ return _ref12.apply(this, arguments);
563
1497
  };
564
1498
  }();
565
1499
  var _message = /*#__PURE__*/function () {
566
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
567
- var p, ex, _iterator3, _step3, _v3, _yield$parse4, id, owner, _opt$data4, _opt$from2, _res$Messages2, _res$Spawns, _res$Assignments, msg, _env, res, _iterator4, _step4, v, _iterator5, _step5, _v, _tags, _iterator6, _step6, _v2, _iterator7, _step7, v2;
568
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
569
- while (1) switch (_context6.prev = _context6.next) {
1500
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(opt) {
1501
+ var p, ex, _iterator5, _step5, _v3, _yield$parse4, id, owner, _opt$data5, _opt$from2, _opt$data6, _res$Messages2, _res$Spawns, _res$Assignments, msg, _env, res, _iterator6, _step6, v, _iterator7, _step7, _v, _tags, _iterator8, _step8, _v2, _iterator9, _step9, v2;
1502
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1503
+ while (1) switch (_context23.prev = _context23.next) {
570
1504
  case 0:
571
1505
  p = env[opt.process];
572
1506
  ex = false;
573
- _iterator3 = _createForOfIteratorHelper(opt.tags);
1507
+ _iterator5 = _createForOfIteratorHelper(opt.tags);
574
1508
  try {
575
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
576
- _v3 = _step3.value;
1509
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1510
+ _v3 = _step5.value;
577
1511
  if (_v3.name === "Type") ex = true;
578
1512
  }
579
1513
  } catch (err) {
580
- _iterator3.e(err);
1514
+ _iterator5.e(err);
581
1515
  } finally {
582
- _iterator3.f();
1516
+ _iterator5.f();
583
1517
  }
584
1518
  if (!ex) opt.tags.push({
585
1519
  name: "Type",
586
1520
  value: "Message"
587
1521
  });
588
- _context6.next = 7;
1522
+ _context23.next = 7;
589
1523
  return parse(opt);
590
1524
  case 7:
591
- _yield$parse4 = _context6.sent;
1525
+ _yield$parse4 = _context23.sent;
592
1526
  id = _yield$parse4.id;
593
1527
  owner = _yield$parse4.owner;
594
- _context6.prev = 10;
595
- msg = genMsg(p, (_opt$data4 = opt.data) !== null && _opt$data4 !== void 0 ? _opt$data4 : "", opt.tags, (_opt$from2 = opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : owner, mu.addr);
1528
+ _context23.prev = 10;
1529
+ msg = genMsg(p, (_opt$data5 = opt.data) !== null && _opt$data5 !== void 0 ? _opt$data5 : "", opt.tags, (_opt$from2 = opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : owner, mu.addr);
596
1530
  _env = genEnv({
597
1531
  pid: p.id,
598
1532
  owner: p.owner,
599
1533
  module: p.module,
600
1534
  auth: mu.addr
601
1535
  });
602
- _context6.next = 15;
1536
+ _context23.next = 15;
603
1537
  return p.handle(p.memory, msg, _env);
604
1538
  case 15:
605
- res = _context6.sent;
1539
+ res = _context23.sent;
1540
+ _txs[id] = (_opt$data6 = opt.data) !== null && _opt$data6 !== void 0 ? _opt$data6 : null;
606
1541
  p.memory = res.Memory;
607
1542
  delete res.Memory;
608
1543
  p.res[id] = res;
@@ -611,20 +1546,20 @@ var connect = exports.connect = function connect() {
611
1546
  id: id
612
1547
  }, opt));
613
1548
  msgs[id] = opt;
614
- _iterator4 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
615
- _context6.prev = 23;
616
- _iterator4.s();
617
- case 25:
618
- if ((_step4 = _iterator4.n()).done) {
619
- _context6.next = 32;
1549
+ _iterator6 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
1550
+ _context23.prev = 24;
1551
+ _iterator6.s();
1552
+ case 26:
1553
+ if ((_step6 = _iterator6.n()).done) {
1554
+ _context23.next = 33;
620
1555
  break;
621
1556
  }
622
- v = _step4.value;
1557
+ v = _step6.value;
623
1558
  if (!env[v.Target]) {
624
- _context6.next = 30;
1559
+ _context23.next = 31;
625
1560
  break;
626
1561
  }
627
- _context6.next = 30;
1562
+ _context23.next = 31;
628
1563
  return _message({
629
1564
  process: v.Target,
630
1565
  tags: v.Tags,
@@ -632,32 +1567,32 @@ var connect = exports.connect = function connect() {
632
1567
  signer: mu.signer,
633
1568
  from: opt.process
634
1569
  });
635
- case 30:
636
- _context6.next = 25;
1570
+ case 31:
1571
+ _context23.next = 26;
637
1572
  break;
638
- case 32:
639
- _context6.next = 37;
1573
+ case 33:
1574
+ _context23.next = 38;
640
1575
  break;
641
- case 34:
642
- _context6.prev = 34;
643
- _context6.t0 = _context6["catch"](23);
644
- _iterator4.e(_context6.t0);
645
- case 37:
646
- _context6.prev = 37;
647
- _iterator4.f();
648
- return _context6.finish(37);
649
- case 40:
650
- _iterator5 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
651
- _context6.prev = 41;
652
- _iterator5.s();
653
- case 43:
654
- if ((_step5 = _iterator5.n()).done) {
655
- _context6.next = 50;
1576
+ case 35:
1577
+ _context23.prev = 35;
1578
+ _context23.t0 = _context23["catch"](24);
1579
+ _iterator6.e(_context23.t0);
1580
+ case 38:
1581
+ _context23.prev = 38;
1582
+ _iterator6.f();
1583
+ return _context23.finish(38);
1584
+ case 41:
1585
+ _iterator7 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
1586
+ _context23.prev = 42;
1587
+ _iterator7.s();
1588
+ case 44:
1589
+ if ((_step7 = _iterator7.n()).done) {
1590
+ _context23.next = 51;
656
1591
  break;
657
1592
  }
658
- _v = _step5.value;
1593
+ _v = _step7.value;
659
1594
  _tags = (0, _utils.tags)(_v.Tags);
660
- _context6.next = 48;
1595
+ _context23.next = 49;
661
1596
  return spawn({
662
1597
  module: _tags.Module,
663
1598
  scheduler: scheduler,
@@ -666,90 +1601,90 @@ var connect = exports.connect = function connect() {
666
1601
  from: _tags["From-Process"],
667
1602
  signer: mu.signer
668
1603
  });
669
- case 48:
670
- _context6.next = 43;
1604
+ case 49:
1605
+ _context23.next = 44;
671
1606
  break;
672
- case 50:
673
- _context6.next = 55;
1607
+ case 51:
1608
+ _context23.next = 56;
674
1609
  break;
675
- case 52:
676
- _context6.prev = 52;
677
- _context6.t1 = _context6["catch"](41);
678
- _iterator5.e(_context6.t1);
679
- case 55:
680
- _context6.prev = 55;
681
- _iterator5.f();
682
- return _context6.finish(55);
683
- case 58:
684
- _iterator6 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
685
- _context6.prev = 59;
686
- _iterator6.s();
687
- case 61:
688
- if ((_step6 = _iterator6.n()).done) {
689
- _context6.next = 82;
1610
+ case 53:
1611
+ _context23.prev = 53;
1612
+ _context23.t1 = _context23["catch"](42);
1613
+ _iterator7.e(_context23.t1);
1614
+ case 56:
1615
+ _context23.prev = 56;
1616
+ _iterator7.f();
1617
+ return _context23.finish(56);
1618
+ case 59:
1619
+ _iterator8 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
1620
+ _context23.prev = 60;
1621
+ _iterator8.s();
1622
+ case 62:
1623
+ if ((_step8 = _iterator8.n()).done) {
1624
+ _context23.next = 83;
690
1625
  break;
691
1626
  }
692
- _v2 = _step6.value;
693
- _iterator7 = _createForOfIteratorHelper(_v2.Processes);
694
- _context6.prev = 64;
695
- _iterator7.s();
696
- case 66:
697
- if ((_step7 = _iterator7.n()).done) {
698
- _context6.next = 72;
1627
+ _v2 = _step8.value;
1628
+ _iterator9 = _createForOfIteratorHelper(_v2.Processes);
1629
+ _context23.prev = 65;
1630
+ _iterator9.s();
1631
+ case 67:
1632
+ if ((_step9 = _iterator9.n()).done) {
1633
+ _context23.next = 73;
699
1634
  break;
700
1635
  }
701
- v2 = _step7.value;
702
- _context6.next = 70;
1636
+ v2 = _step9.value;
1637
+ _context23.next = 71;
703
1638
  return assign({
704
1639
  message: _v2.Message,
705
1640
  process: v2,
706
1641
  from: opt.process,
707
1642
  signer: mu.signer
708
1643
  });
709
- case 70:
710
- _context6.next = 66;
1644
+ case 71:
1645
+ _context23.next = 67;
711
1646
  break;
712
- case 72:
713
- _context6.next = 77;
1647
+ case 73:
1648
+ _context23.next = 78;
714
1649
  break;
715
- case 74:
716
- _context6.prev = 74;
717
- _context6.t2 = _context6["catch"](64);
718
- _iterator7.e(_context6.t2);
719
- case 77:
720
- _context6.prev = 77;
721
- _iterator7.f();
722
- return _context6.finish(77);
723
- case 80:
724
- _context6.next = 61;
1650
+ case 75:
1651
+ _context23.prev = 75;
1652
+ _context23.t2 = _context23["catch"](65);
1653
+ _iterator9.e(_context23.t2);
1654
+ case 78:
1655
+ _context23.prev = 78;
1656
+ _iterator9.f();
1657
+ return _context23.finish(78);
1658
+ case 81:
1659
+ _context23.next = 62;
725
1660
  break;
726
- case 82:
727
- _context6.next = 87;
1661
+ case 83:
1662
+ _context23.next = 88;
728
1663
  break;
729
- case 84:
730
- _context6.prev = 84;
731
- _context6.t3 = _context6["catch"](59);
732
- _iterator6.e(_context6.t3);
733
- case 87:
734
- _context6.prev = 87;
735
- _iterator6.f();
736
- return _context6.finish(87);
737
- case 90:
738
- return _context6.abrupt("return", id);
739
- case 93:
740
- _context6.prev = 93;
741
- _context6.t4 = _context6["catch"](10);
742
- console.log(_context6.t4);
743
- case 96:
744
- return _context6.abrupt("return", null);
1664
+ case 85:
1665
+ _context23.prev = 85;
1666
+ _context23.t3 = _context23["catch"](60);
1667
+ _iterator8.e(_context23.t3);
1668
+ case 88:
1669
+ _context23.prev = 88;
1670
+ _iterator8.f();
1671
+ return _context23.finish(88);
1672
+ case 91:
1673
+ return _context23.abrupt("return", id);
1674
+ case 94:
1675
+ _context23.prev = 94;
1676
+ _context23.t4 = _context23["catch"](10);
1677
+ console.log(_context23.t4);
745
1678
  case 97:
1679
+ return _context23.abrupt("return", null);
1680
+ case 98:
746
1681
  case "end":
747
- return _context6.stop();
1682
+ return _context23.stop();
748
1683
  }
749
- }, _callee6, null, [[10, 93], [23, 34, 37, 40], [41, 52, 55, 58], [59, 84, 87, 90], [64, 74, 77, 80]]);
1684
+ }, _callee23, null, [[10, 94], [24, 35, 38, 41], [42, 53, 56, 59], [60, 85, 88, 91], [65, 75, 78, 81]]);
750
1685
  }));
751
- return function message(_x4) {
752
- return _ref10.apply(this, arguments);
1686
+ return function message(_x10) {
1687
+ return _ref13.apply(this, arguments);
753
1688
  };
754
1689
  }();
755
1690
  return {
@@ -759,10 +1694,10 @@ var connect = exports.connect = function connect() {
759
1694
  mu: mu,
760
1695
  message: _message,
761
1696
  unmonitor: function () {
762
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
1697
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(opt) {
763
1698
  var p;
764
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
765
- while (1) switch (_context7.prev = _context7.next) {
1699
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1700
+ while (1) switch (_context24.prev = _context24.next) {
766
1701
  case 0:
767
1702
  p = env[opt.process];
768
1703
  try {
@@ -771,28 +1706,28 @@ var connect = exports.connect = function connect() {
771
1706
  } catch (e) {}
772
1707
  case 2:
773
1708
  case "end":
774
- return _context7.stop();
1709
+ return _context24.stop();
775
1710
  }
776
- }, _callee7);
1711
+ }, _callee24);
777
1712
  }));
778
- function unmonitor(_x5) {
1713
+ function unmonitor(_x11) {
779
1714
  return _unmonitor.apply(this, arguments);
780
1715
  }
781
1716
  return unmonitor;
782
1717
  }(),
783
1718
  monitor: function () {
784
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1719
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(opt) {
785
1720
  var p;
786
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
787
- while (1) switch (_context9.prev = _context9.next) {
1721
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1722
+ while (1) switch (_context26.prev = _context26.next) {
788
1723
  case 0:
789
1724
  p = env[opt.process];
790
1725
  if ((0, _ramda.isNil)(p.cron)) {
791
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
792
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
793
- while (1) switch (_context8.prev = _context8.next) {
1726
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1727
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1728
+ while (1) switch (_context25.prev = _context25.next) {
794
1729
  case 0:
795
- _context8.next = 2;
1730
+ _context25.next = 2;
796
1731
  return _message({
797
1732
  tags: p.cronTags,
798
1733
  process: opt.process,
@@ -801,51 +1736,51 @@ var connect = exports.connect = function connect() {
801
1736
  });
802
1737
  case 2:
803
1738
  case "end":
804
- return _context8.stop();
1739
+ return _context25.stop();
805
1740
  }
806
- }, _callee8);
1741
+ }, _callee25);
807
1742
  })), p.span);
808
1743
  }
809
1744
  case 2:
810
1745
  case "end":
811
- return _context9.stop();
1746
+ return _context26.stop();
812
1747
  }
813
- }, _callee9);
1748
+ }, _callee26);
814
1749
  }));
815
- function monitor(_x6) {
1750
+ function monitor(_x12) {
816
1751
  return _monitor.apply(this, arguments);
817
1752
  }
818
1753
  return monitor;
819
1754
  }(),
820
1755
  txs: function () {
821
- var _txs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(pid) {
822
- var _txs, _iterator8, _step8, v;
823
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
824
- while (1) switch (_context10.prev = _context10.next) {
1756
+ var _txs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(pid) {
1757
+ var _txs, _iterator10, _step10, v;
1758
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1759
+ while (1) switch (_context27.prev = _context27.next) {
825
1760
  case 0:
826
1761
  _txs = [];
827
- _iterator8 = _createForOfIteratorHelper(env[pid].txs);
1762
+ _iterator10 = _createForOfIteratorHelper(env[pid].txs);
828
1763
  try {
829
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
830
- v = _step8.value;
1764
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1765
+ v = _step10.value;
831
1766
  _txs.push({
832
1767
  tags: v.tags,
833
1768
  id: v.id
834
1769
  });
835
1770
  }
836
1771
  } catch (err) {
837
- _iterator8.e(err);
1772
+ _iterator10.e(err);
838
1773
  } finally {
839
- _iterator8.f();
1774
+ _iterator10.f();
840
1775
  }
841
- return _context10.abrupt("return", _txs);
1776
+ return _context27.abrupt("return", _txs);
842
1777
  case 4:
843
1778
  case "end":
844
- return _context10.stop();
1779
+ return _context27.stop();
845
1780
  }
846
- }, _callee10);
1781
+ }, _callee27);
847
1782
  }));
848
- function txs(_x7) {
1783
+ function txs(_x13) {
849
1784
  return _txs2.apply(this, arguments);
850
1785
  }
851
1786
  return txs;
@@ -853,131 +1788,131 @@ var connect = exports.connect = function connect() {
853
1788
  spawn: spawn,
854
1789
  assign: assign,
855
1790
  result: function () {
856
- var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
857
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
858
- while (1) switch (_context11.prev = _context11.next) {
1791
+ var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(opt) {
1792
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1793
+ while (1) switch (_context28.prev = _context28.next) {
859
1794
  case 0:
860
- return _context11.abrupt("return", env[opt.process].res[opt.message]);
1795
+ return _context28.abrupt("return", env[opt.process].res[opt.message]);
861
1796
  case 1:
862
1797
  case "end":
863
- return _context11.stop();
1798
+ return _context28.stop();
864
1799
  }
865
- }, _callee11);
1800
+ }, _callee28);
866
1801
  }));
867
- function result(_x8) {
1802
+ function result(_x14) {
868
1803
  return _result.apply(this, arguments);
869
1804
  }
870
1805
  return result;
871
1806
  }(),
872
1807
  results: function () {
873
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1808
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(opt) {
874
1809
  var _opt$limit;
875
- var p, results, limit, i, _i;
876
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
877
- while (1) switch (_context12.prev = _context12.next) {
1810
+ var p, results, limit, _i, _i2;
1811
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1812
+ while (1) switch (_context29.prev = _context29.next) {
878
1813
  case 0:
879
1814
  p = env[opt.process];
880
1815
  results = [];
881
1816
  limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
882
1817
  if (!(opt.sort === "DESC")) {
883
- _context12.next = 14;
1818
+ _context29.next = 14;
884
1819
  break;
885
1820
  }
886
- i = p.results.length - 1;
1821
+ _i = p.results.length - 1;
887
1822
  case 5:
888
- if (!(0 < i)) {
889
- _context12.next = 12;
1823
+ if (!(0 < _i)) {
1824
+ _context29.next = 12;
890
1825
  break;
891
1826
  }
892
1827
  results.push({
893
- cursor: p.results[i],
894
- node: p.res[p.results[i]]
1828
+ cursor: p.results[_i],
1829
+ node: p.res[p.results[_i]]
895
1830
  });
896
1831
  if (!(results.length >= limit)) {
897
- _context12.next = 9;
1832
+ _context29.next = 9;
898
1833
  break;
899
1834
  }
900
- return _context12.abrupt("break", 12);
1835
+ return _context29.abrupt("break", 12);
901
1836
  case 9:
902
- i--;
903
- _context12.next = 5;
1837
+ _i--;
1838
+ _context29.next = 5;
904
1839
  break;
905
1840
  case 12:
906
- _context12.next = 22;
1841
+ _context29.next = 22;
907
1842
  break;
908
1843
  case 14:
909
- _i = 0;
1844
+ _i2 = 0;
910
1845
  case 15:
911
- if (!(_i < p.results.length)) {
912
- _context12.next = 22;
1846
+ if (!(_i2 < p.results.length)) {
1847
+ _context29.next = 22;
913
1848
  break;
914
1849
  }
915
1850
  results.push({
916
- node: p.res[p.results[_i]]
1851
+ node: p.res[p.results[_i2]]
917
1852
  });
918
1853
  if (!(results.length >= limit)) {
919
- _context12.next = 19;
1854
+ _context29.next = 19;
920
1855
  break;
921
1856
  }
922
- return _context12.abrupt("break", 22);
1857
+ return _context29.abrupt("break", 22);
923
1858
  case 19:
924
- _i++;
925
- _context12.next = 15;
1859
+ _i2++;
1860
+ _context29.next = 15;
926
1861
  break;
927
1862
  case 22:
928
- return _context12.abrupt("return", {
1863
+ return _context29.abrupt("return", {
929
1864
  edges: results
930
1865
  });
931
1866
  case 23:
932
1867
  case "end":
933
- return _context12.stop();
1868
+ return _context29.stop();
934
1869
  }
935
- }, _callee12);
1870
+ }, _callee29);
936
1871
  }));
937
- function results(_x9) {
1872
+ function results(_x15) {
938
1873
  return _results.apply(this, arguments);
939
1874
  }
940
1875
  return results;
941
1876
  }(),
942
1877
  dryrun: function () {
943
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(opt) {
944
- var p, _yield$parse5, id, owner, _opt$data5, msg, _env, res;
945
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
946
- while (1) switch (_context13.prev = _context13.next) {
1878
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(opt) {
1879
+ var p, _yield$parse5, id, owner, _opt$data7, msg, _env, res;
1880
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1881
+ while (1) switch (_context30.prev = _context30.next) {
947
1882
  case 0:
948
1883
  p = env[opt.process];
949
- _context13.next = 3;
1884
+ _context30.next = 3;
950
1885
  return parse(opt);
951
1886
  case 3:
952
- _yield$parse5 = _context13.sent;
1887
+ _yield$parse5 = _context30.sent;
953
1888
  id = _yield$parse5.id;
954
1889
  owner = _yield$parse5.owner;
955
- _context13.prev = 6;
956
- msg = genMsg(p, (_opt$data5 = opt.data) !== null && _opt$data5 !== void 0 ? _opt$data5 : "", opt.tags, owner, mu.addr, true);
1890
+ _context30.prev = 6;
1891
+ msg = genMsg(p, (_opt$data7 = opt.data) !== null && _opt$data7 !== void 0 ? _opt$data7 : "", opt.tags, owner, mu.addr, true);
957
1892
  _env = genEnv({
958
1893
  pid: p.id,
959
1894
  owner: p.owner,
960
1895
  module: p.module,
961
1896
  auth: mu.addr
962
1897
  });
963
- _context13.next = 11;
1898
+ _context30.next = 11;
964
1899
  return p.handle(p.memory, msg, _env);
965
1900
  case 11:
966
- res = _context13.sent;
967
- return _context13.abrupt("return", res);
1901
+ res = _context30.sent;
1902
+ return _context30.abrupt("return", res);
968
1903
  case 15:
969
- _context13.prev = 15;
970
- _context13.t0 = _context13["catch"](6);
971
- console.log(_context13.t0);
1904
+ _context30.prev = 15;
1905
+ _context30.t0 = _context30["catch"](6);
1906
+ console.log(_context30.t0);
972
1907
  case 18:
973
- return _context13.abrupt("return", null);
1908
+ return _context30.abrupt("return", null);
974
1909
  case 19:
975
1910
  case "end":
976
- return _context13.stop();
1911
+ return _context30.stop();
977
1912
  }
978
- }, _callee13, null, [[6, 15]]);
1913
+ }, _callee30, null, [[6, 15]]);
979
1914
  }));
980
- function dryrun(_x10) {
1915
+ function dryrun(_x16) {
981
1916
  return _dryrun.apply(this, arguments);
982
1917
  }
983
1918
  return dryrun;