wao 0.7.1 → 0.8.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
@@ -23,11 +23,11 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
23
23
  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; }
24
24
  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; }
25
25
  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; }
26
- 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; }
27
26
  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; }
28
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
29
28
  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); }
30
29
  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; } } }; }
30
+ 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; }
31
31
  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
32
  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
33
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -41,6 +41,7 @@ var DataItem = pkg.DataItem;
41
41
  var connect = exports.connect = function connect(mem) {
42
42
  var _mem;
43
43
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
44
+ cache = _ref.cache,
44
45
  _ref$log = _ref.log,
45
46
  log = _ref$log === void 0 ? false : _ref$log,
46
47
  _ref$extensions = _ref.extensions,
@@ -48,9 +49,11 @@ var connect = exports.connect = function connect(mem) {
48
49
  var isMem = ((_mem = mem) === null || _mem === void 0 ? void 0 : _mem.__type__) === "mem";
49
50
  if (!isMem) {
50
51
  var _mem2;
51
- var args = {};
52
+ var args = {
53
+ cache: cache
54
+ };
52
55
  if ((_mem2 = mem) !== null && _mem2 !== void 0 && _mem2.SU_URL) {
53
- args = mem;
56
+ args = (0, _ramda.mergeLeft)(mem, args);
54
57
  args.scheduler = _test.scheduler;
55
58
  }
56
59
  mem = new _armem["default"](args);
@@ -90,30 +93,57 @@ var connect = exports.connect = function connect(mem) {
90
93
  });
91
94
  return output;
92
95
  };
93
- var genMsg = function genMsg(Id, p, data, Tags, from, Owner) {
94
- var dry = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
95
- if (!dry) p.height += 1;
96
- return {
97
- Id: Id,
98
- Target: p.id,
99
- Owner: Owner,
100
- Data: data !== null && data !== void 0 && data.length ? data : "",
101
- "Block-Height": mem.height.toString(),
102
- Timestamp: Date.now().toString(),
103
- Module: p.module,
104
- From: from,
105
- Cron: false,
106
- Tags: Tags !== null && Tags !== void 0 && Tags.length ? Tags : []
96
+ var genMsg = /*#__PURE__*/function () {
97
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(Id, p, data, Tags, from, Owner) {
98
+ var dry,
99
+ _args = arguments;
100
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
101
+ while (1) switch (_context.prev = _context.next) {
102
+ case 0:
103
+ dry = _args.length > 6 && _args[6] !== undefined ? _args[6] : false;
104
+ if (!dry) p.height += 1;
105
+ _context.t0 = Id;
106
+ _context.t1 = p.id;
107
+ _context.t2 = Owner;
108
+ _context.t3 = data !== null && data !== void 0 && data.length ? data : "";
109
+ _context.next = 8;
110
+ return mem.get("height");
111
+ case 8:
112
+ _context.t4 = _context.sent.toString();
113
+ _context.t5 = Date.now().toString();
114
+ _context.t6 = p.module;
115
+ _context.t7 = from;
116
+ _context.t8 = Tags !== null && Tags !== void 0 && Tags.length ? Tags : [];
117
+ return _context.abrupt("return", {
118
+ Id: _context.t0,
119
+ Target: _context.t1,
120
+ Owner: _context.t2,
121
+ Data: _context.t3,
122
+ "Block-Height": _context.t4,
123
+ Timestamp: _context.t5,
124
+ Module: _context.t6,
125
+ From: _context.t7,
126
+ Cron: false,
127
+ Tags: _context.t8
128
+ });
129
+ case 14:
130
+ case "end":
131
+ return _context.stop();
132
+ }
133
+ }, _callee);
134
+ }));
135
+ return function genMsg(_x, _x2, _x3, _x4, _x5, _x6) {
136
+ return _ref4.apply(this, arguments);
107
137
  };
108
- };
109
- var genEnv = function genEnv(_ref4) {
110
- var pid = _ref4.pid,
111
- _ref4$owner = _ref4.owner,
112
- owner = _ref4$owner === void 0 ? "" : _ref4$owner,
113
- _ref4$module = _ref4.module,
114
- module = _ref4$module === void 0 ? "" : _ref4$module,
115
- _ref4$auth = _ref4.auth,
116
- auth = _ref4$auth === void 0 ? "" : _ref4$auth;
138
+ }();
139
+ var genEnv = function genEnv(_ref5) {
140
+ var pid = _ref5.pid,
141
+ _ref5$owner = _ref5.owner,
142
+ owner = _ref5$owner === void 0 ? "" : _ref5$owner,
143
+ _ref5$module = _ref5.module,
144
+ module = _ref5$module === void 0 ? "" : _ref5$module,
145
+ _ref5$auth = _ref5.auth,
146
+ auth = _ref5$auth === void 0 ? "" : _ref5$auth;
117
147
  return {
118
148
  Process: {
119
149
  Id: pid,
@@ -148,15 +178,13 @@ var connect = exports.connect = function connect(mem) {
148
178
  };
149
179
  };
150
180
  var spawn = /*#__PURE__*/function () {
151
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
152
- var _opt$module, _mem$wasms$mod, _format, _opt$tags, _opt$tags2;
181
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
182
+ var _opt$tags, _opt$memory;
153
183
  var opt,
184
+ _yield$mem$getWasm,
154
185
  mod,
155
- _module,
156
- __dirname,
157
- format,
158
186
  wasm,
159
- _mem$wasms$mod2,
187
+ format,
160
188
  ex,
161
189
  _iterator,
162
190
  _step,
@@ -168,19 +196,20 @@ var connect = exports.connect = function connect(mem) {
168
196
  __tags,
169
197
  now,
170
198
  t,
199
+ ext,
171
200
  wdrive,
172
201
  handle,
202
+ _module,
173
203
  _tags,
174
204
  res,
175
205
  memory,
176
206
  p,
177
207
  _opt$data,
178
- _mem$msgs$_tags$OnBo,
179
- _mem$msgs$_tags$OnBo2,
208
+ _yield$mem$get$data,
209
+ _yield$mem$get,
180
210
  data,
181
211
  msg,
182
212
  _env,
183
- _t,
184
213
  _tags$CronInterval$s,
185
214
  _tags$CronInterval$s2,
186
215
  num,
@@ -188,49 +217,30 @@ var connect = exports.connect = function connect(mem) {
188
217
  _int,
189
218
  cronTags,
190
219
  _k,
191
- _args = arguments;
192
- return _regeneratorRuntime().wrap(function _callee$(_context) {
193
- while (1) switch (_context.prev = _context.next) {
220
+ _args2 = arguments;
221
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
222
+ while (1) switch (_context2.prev = _context2.next) {
194
223
  case 0:
195
- opt = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
224
+ opt = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
196
225
  if (opt.module) {
197
- _context.next = 3;
226
+ _context2.next = 3;
198
227
  break;
199
228
  }
200
229
  throw Error("module missing");
201
230
  case 3:
202
231
  if (opt.scheduler) {
203
- _context.next = 5;
232
+ _context2.next = 5;
204
233
  break;
205
234
  }
206
235
  throw Error("scheduler missing");
207
236
  case 5:
208
- mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : mem.modules["aos2_0_1"];
209
- _module = null;
210
- _context.next = 9;
211
- return (0, _utils.dirname)();
212
- case 9:
213
- __dirname = _context.sent;
214
- format = null;
215
- wasm = (_mem$wasms$mod = mem.wasms[mod]) === null || _mem$wasms$mod === void 0 ? void 0 : _mem$wasms$mod.data;
216
- if (!wasm) {
217
- if ((_mem$wasms$mod2 = mem.wasms[mod]) !== null && _mem$wasms$mod2 !== void 0 && _mem$wasms$mod2.file) {
218
- wasm = (0, _fs.readFileSync)((0, _path.resolve)(__dirname, "lua/".concat(mem.wasms[mod].file, ".wasm")));
219
- format = mem.wasms[mod].format;
220
- } else if (mem.txs[mod]) {
221
- wasm = Buffer.from(mem.txs[mod].data, "base64");
222
- format = (0, _utils.tags)(mem.txs[mod].tags)["Module-Format"];
223
- }
224
- } else {
225
- format = mem.wasms[mod].format;
226
- }
227
- (_format = format) !== null && _format !== void 0 ? _format : format = "wasm64-unknown-emscripten-draft_2024_02_15";
228
- if (mod) {
229
- _context.next = 16;
230
- break;
231
- }
232
- throw Error("module not found");
233
- case 16:
237
+ _context2.next = 7;
238
+ return mem.getWasm(opt.module, mem);
239
+ case 7:
240
+ _yield$mem$getWasm = _context2.sent;
241
+ mod = _yield$mem$getWasm.mod;
242
+ wasm = _yield$mem$getWasm.wasm;
243
+ format = _yield$mem$getWasm.format;
234
244
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
235
245
  "Data-Protocol": "ao",
236
246
  Variant: "ao.TN.1",
@@ -241,7 +251,6 @@ var connect = exports.connect = function connect(mem) {
241
251
  "Content-Type": "text/plain"
242
252
  }));
243
253
  ex = false;
244
- (_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : opt.tags = [];
245
254
  _iterator = _createForOfIteratorHelper(opt.tags);
246
255
  try {
247
256
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -257,50 +266,62 @@ var connect = exports.connect = function connect(mem) {
257
266
  name: "Type",
258
267
  value: "Process"
259
268
  });
260
- _context.next = 24;
269
+ _context2.next = 18;
261
270
  return ar.dataitem({
262
271
  item: opt.item,
263
272
  data: opt.data,
264
273
  signer: opt.signer,
265
274
  tags: (0, _utils.tags)(opt.tags)
266
275
  });
267
- case 24:
268
- _yield$ar$dataitem = _context.sent;
276
+ case 18:
277
+ _yield$ar$dataitem = _context2.sent;
269
278
  id = _yield$ar$dataitem.id;
270
279
  owner = _yield$ar$dataitem.owner;
271
280
  item = _yield$ar$dataitem.item;
272
281
  __tags = _yield$ar$dataitem.tags;
273
282
  opt.tags = (0, _utils.buildTags)(null, __tags);
274
283
  if (opt.item) opt.data = _base64url["default"].decode(item.data);
275
- _context.next = 33;
284
+ _context2.next = 27;
276
285
  return ar.postItems(item, _test.su.jwk);
277
- case 33:
286
+ case 27:
278
287
  now = Date.now;
279
288
  t = (0, _utils.tags)(opt.tags);
280
- wdrive = extensions[t.Extension || "WeaveDrive"];
289
+ ext = t.Extension || "WeaveDrive";
290
+ wdrive = extensions[ext];
281
291
  handle = null;
282
- _context.prev = 37;
283
- _context.next = 40;
284
- return (0, _aoLoader["default"])(wasm, {
285
- format: format,
286
- WeaveDrive: wdrive,
287
- spawn: item,
288
- module: mem.txs[mod]
289
- });
292
+ _context2.prev = 32;
293
+ _context2.t0 = _aoLoader["default"];
294
+ _context2.t1 = wasm;
295
+ _context2.t2 = format;
296
+ _context2.t3 = wdrive;
297
+ _context2.t4 = item;
298
+ _context2.next = 40;
299
+ return mem.get("txs", mod);
290
300
  case 40:
291
- handle = _context.sent;
292
- _context.next = 45;
301
+ _context2.t5 = _context2.sent;
302
+ _context2.t6 = {
303
+ format: _context2.t2,
304
+ WeaveDrive: _context2.t3,
305
+ spawn: _context2.t4,
306
+ module: _context2.t5
307
+ };
308
+ _context2.next = 44;
309
+ return (0, _context2.t0)(_context2.t1, _context2.t6);
310
+ case 44:
311
+ handle = _context2.sent;
312
+ _context2.next = 49;
293
313
  break;
294
- case 43:
295
- _context.prev = 43;
296
- _context.t0 = _context["catch"](37);
297
- case 45:
314
+ case 47:
315
+ _context2.prev = 47;
316
+ _context2.t7 = _context2["catch"](32);
317
+ case 49:
298
318
  if (handle) {
299
- _context.next = 47;
319
+ _context2.next = 51;
300
320
  break;
301
321
  }
302
- return _context.abrupt("return", null);
303
- case 47:
322
+ return _context2.abrupt("return", null);
323
+ case 51:
324
+ _module = null;
304
325
  _module = {
305
326
  handle: handle,
306
327
  id: mod
@@ -308,8 +329,11 @@ var connect = exports.connect = function connect(mem) {
308
329
  Date.now = now;
309
330
  _tags = (0, _utils.tags)(opt.tags);
310
331
  res = null;
311
- memory = null;
332
+ memory = (_opt$memory = opt.memory) !== null && _opt$memory !== void 0 ? _opt$memory : null;
312
333
  p = {
334
+ extension: ext,
335
+ item: item === null || item === void 0 ? void 0 : item.binary,
336
+ format: format,
313
337
  id: id,
314
338
  epochs: [],
315
339
  handle: _module.handle,
@@ -323,65 +347,123 @@ var connect = exports.connect = function connect(mem) {
323
347
  txs: [],
324
348
  opt: opt
325
349
  };
350
+ if (!memory) {
351
+ _context2.next = 61;
352
+ break;
353
+ }
354
+ _context2.next = 101;
355
+ break;
356
+ case 61:
326
357
  if (!(_tags["On-Boot"] || true)) {
327
- _context.next = 67;
358
+ _context2.next = 100;
328
359
  break;
329
360
  }
330
361
  data = "";
331
- if (_tags["On-Boot"] === "Data") data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";else data = (_mem$msgs$_tags$OnBo = (_mem$msgs$_tags$OnBo2 = mem.msgs[_tags["On-Boot"]]) === null || _mem$msgs$_tags$OnBo2 === void 0 ? void 0 : _mem$msgs$_tags$OnBo2.data) !== null && _mem$msgs$_tags$OnBo !== void 0 ? _mem$msgs$_tags$OnBo : "";
332
- msg = genMsg(id, p, data, opt.tags, owner, _test.mu.addr, true);
362
+ if (!(_tags["On-Boot"] === "Data")) {
363
+ _context2.next = 67;
364
+ break;
365
+ }
366
+ data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
367
+ _context2.next = 88;
368
+ break;
369
+ case 67:
370
+ _context2.next = 69;
371
+ return mem.get("msgs", _tags["On-Boot"]);
372
+ case 69:
373
+ _context2.t10 = _yield$mem$get = _context2.sent;
374
+ _context2.t9 = _context2.t10 === null;
375
+ if (_context2.t9) {
376
+ _context2.next = 73;
377
+ break;
378
+ }
379
+ _context2.t9 = _yield$mem$get === void 0;
380
+ case 73:
381
+ if (!_context2.t9) {
382
+ _context2.next = 77;
383
+ break;
384
+ }
385
+ _context2.t11 = void 0;
386
+ _context2.next = 78;
387
+ break;
388
+ case 77:
389
+ _context2.t11 = _yield$mem$get.data;
390
+ case 78:
391
+ _context2.t12 = _yield$mem$get$data = _context2.t11;
392
+ _context2.t8 = _context2.t12 !== null;
393
+ if (!_context2.t8) {
394
+ _context2.next = 82;
395
+ break;
396
+ }
397
+ _context2.t8 = _yield$mem$get$data !== void 0;
398
+ case 82:
399
+ if (!_context2.t8) {
400
+ _context2.next = 86;
401
+ break;
402
+ }
403
+ _context2.t13 = _yield$mem$get$data;
404
+ _context2.next = 87;
405
+ break;
406
+ case 86:
407
+ _context2.t13 = "";
408
+ case 87:
409
+ data = _context2.t13;
410
+ case 88:
411
+ _context2.next = 90;
412
+ return genMsg(id, p, data, opt.tags, owner, _test.mu.addr, true);
413
+ case 90:
414
+ msg = _context2.sent;
333
415
  _env = genEnv({
334
416
  pid: p.id,
335
417
  owner: p.owner,
336
418
  module: p.module,
337
419
  auth: _test.mu.addr
338
420
  });
339
- _t = (0, _utils.tags)(msg.Tags);
340
- _context.next = 61;
421
+ _context2.next = 94;
341
422
  return _module.handle(null, msg, _env);
342
- case 61:
343
- res = _context.sent;
423
+ case 94:
424
+ res = _context2.sent;
344
425
  p.memory = res.Memory;
345
426
  delete res.Memory;
346
427
  p.res[id] = res;
347
- _context.next = 68;
428
+ _context2.next = 101;
348
429
  break;
349
- case 67:
430
+ case 100:
350
431
  p.height += 1;
351
- case 68:
352
- mem.msgs[id] = opt;
353
- mem.env[id] = p;
432
+ case 101:
433
+ _context2.next = 103;
434
+ return mem.set(opt, "msgs", id);
435
+ case 103:
354
436
  if (!_tags["Cron-Interval"]) {
355
- _context.next = 94;
437
+ _context2.next = 127;
356
438
  break;
357
439
  }
358
440
  _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];
359
441
  _int = 0;
360
- _context.t1 = unit.replace(/s$/, "");
361
- _context.next = _context.t1 === "millisecond" ? 76 : _context.t1 === "second" ? 78 : _context.t1 === "minute" ? 80 : _context.t1 === "hour" ? 82 : _context.t1 === "day" ? 84 : _context.t1 === "month" ? 86 : _context.t1 === "year" ? 88 : 90;
442
+ _context2.t14 = unit.replace(/s$/, "");
443
+ _context2.next = _context2.t14 === "millisecond" ? 109 : _context2.t14 === "second" ? 111 : _context2.t14 === "minute" ? 113 : _context2.t14 === "hour" ? 115 : _context2.t14 === "day" ? 117 : _context2.t14 === "month" ? 119 : _context2.t14 === "year" ? 121 : 123;
362
444
  break;
363
- case 76:
445
+ case 109:
364
446
  _int = num;
365
- return _context.abrupt("break", 90);
366
- case 78:
447
+ return _context2.abrupt("break", 123);
448
+ case 111:
367
449
  _int = num * 1000;
368
- return _context.abrupt("break", 90);
369
- case 80:
450
+ return _context2.abrupt("break", 123);
451
+ case 113:
370
452
  _int = num * 1000 * 60;
371
- return _context.abrupt("break", 90);
372
- case 82:
453
+ return _context2.abrupt("break", 123);
454
+ case 115:
373
455
  _int = num * 1000 * 60 * 60;
374
- return _context.abrupt("break", 90);
375
- case 84:
456
+ return _context2.abrupt("break", 123);
457
+ case 117:
376
458
  _int = num * 1000 * 60 * 60 * 24;
377
- return _context.abrupt("break", 90);
378
- case 86:
459
+ return _context2.abrupt("break", 123);
460
+ case 119:
379
461
  _int = num * 1000 * 60 * 60 * 24 * 30;
380
- return _context.abrupt("break", 90);
381
- case 88:
462
+ return _context2.abrupt("break", 123);
463
+ case 121:
382
464
  _int = num * 1000 * 60 * 60 * 24 * 365;
383
- return _context.abrupt("break", 90);
384
- case 90:
465
+ return _context2.abrupt("break", 123);
466
+ case 123:
385
467
  cronTags = [];
386
468
  for (_k in _tags) {
387
469
  if (/^Cron-Tag-/.test(_k)) {
@@ -391,18 +473,21 @@ var connect = exports.connect = function connect(mem) {
391
473
  });
392
474
  }
393
475
  }
394
- mem.env[id].cronTags = cronTags;
395
- mem.env[id].span = _int;
396
- case 94:
397
- return _context.abrupt("return", id);
398
- case 95:
476
+ p.cronTags = cronTags;
477
+ p.span = _int;
478
+ case 127:
479
+ _context2.next = 129;
480
+ return mem.set(p, "env", id);
481
+ case 129:
482
+ return _context2.abrupt("return", id);
483
+ case 130:
399
484
  case "end":
400
- return _context.stop();
485
+ return _context2.stop();
401
486
  }
402
- }, _callee, null, [[37, 43]]);
487
+ }, _callee2, null, [[32, 47]]);
403
488
  }));
404
489
  return function spawn() {
405
- return _ref5.apply(this, arguments);
490
+ return _ref6.apply(this, arguments);
406
491
  };
407
492
  }();
408
493
  function genHashChain(previousHash) {
@@ -415,104 +500,159 @@ var connect = exports.connect = function connect(mem) {
415
500
  return (0, _base64url["default"])(hasher.digest());
416
501
  }
417
502
  var _assign = /*#__PURE__*/function () {
418
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opt) {
419
- var _opt$tags3;
420
- var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref7, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, res, _iterator2, _step2, v, _iterator3, _step3, _v, __tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
421
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
422
- while (1) switch (_context2.prev = _context2.next) {
503
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
504
+ var _opt$tags2;
505
+ var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref8, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, data, _tags, from, raw_owner, hashBuffer, msg, _env, _yield$mem$getWasm2, format, mod, wasm, wdrive, res, _iterator2, _step2, v, _iterator3, _step3, _v, __tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
506
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
507
+ while (1) switch (_context3.prev = _context3.next) {
423
508
  case 0:
424
- p = mem.env[opt.process];
509
+ _context3.next = 2;
510
+ return mem.get("env", opt.process);
511
+ case 2:
512
+ p = _context3.sent;
425
513
  if (p) {
426
- _context2.next = 3;
514
+ _context3.next = 5;
427
515
  break;
428
516
  }
429
- return _context2.abrupt("return", null);
430
- case 3:
431
- _opt = mem.msgs[opt.message];
517
+ return _context3.abrupt("return", null);
518
+ case 5:
519
+ _context3.next = 7;
520
+ return mem.get("msgs", opt.message);
521
+ case 7:
522
+ _opt = _context3.sent;
432
523
  hash = genHashChain(p.hash, opt.message);
433
524
  p.hash = hash;
434
- opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
435
- Timestamp: Date.now(),
436
- Epoch: p.epochs.length,
525
+ _context3.t0 = _utils.buildTags;
526
+ _context3.t1 = _ramda.mergeLeft;
527
+ _context3.t2 = (0, _utils.tags)((_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : []);
528
+ _context3.t3 = Date.now();
529
+ _context3.t4 = p.epochs.length;
530
+ _context3.next = 17;
531
+ return mem.get("height");
532
+ case 17:
533
+ _context3.t5 = _context3.sent;
534
+ _context3.t6 = opt.process;
535
+ _context3.t7 = opt.message;
536
+ _context3.t8 = hash;
537
+ _context3.t9 = {
538
+ Timestamp: _context3.t3,
539
+ Epoch: _context3.t4,
437
540
  Nonce: "0",
438
541
  "Data-Protocol": "ao",
439
542
  Variant: "ao.TN.1",
440
543
  SDK: "aoconnect",
441
544
  Type: "Assignment",
442
- "Block-Height": mem.height,
443
- Process: opt.process,
444
- Message: opt.message,
445
- "Hash-Chain": hash
446
- }));
545
+ "Block-Height": _context3.t5,
546
+ Process: _context3.t6,
547
+ Message: _context3.t7,
548
+ "Hash-Chain": _context3.t8
549
+ };
550
+ _context3.t10 = (0, _context3.t1)(_context3.t2, _context3.t9);
551
+ opt.tags = (0, _context3.t0)(null, _context3.t10);
447
552
  p.epochs.push([opt.message]);
448
- _context2.next = 10;
553
+ _context3.next = 27;
449
554
  return ar.dataitem({
450
555
  data: opt.data,
451
556
  signer: opt.signer,
452
557
  tags: (0, _utils.tags)(opt.tags),
453
558
  target: opt.process
454
559
  });
455
- case 10:
456
- _yield$ar$dataitem2 = _context2.sent;
560
+ case 27:
561
+ _yield$ar$dataitem2 = _context3.sent;
457
562
  id = _yield$ar$dataitem2.id;
458
563
  owner = _yield$ar$dataitem2.owner;
459
564
  item = _yield$ar$dataitem2.item;
460
565
  if (!opt.message_item) {
461
- _context2.next = 19;
566
+ _context3.next = 36;
462
567
  break;
463
568
  }
464
- _context2.next = 17;
569
+ _context3.next = 34;
465
570
  return ar.postItems([opt.message_item, item], _test.su.jwk);
466
- case 17:
467
- _context2.next = 21;
571
+ case 34:
572
+ _context3.next = 38;
468
573
  break;
469
- case 19:
470
- _context2.next = 21;
574
+ case 36:
575
+ _context3.next = 38;
471
576
  return ar.postItems(item, _test.su.jwk);
472
- case 21:
473
- _context2.prev = 21;
577
+ case 38:
578
+ _context3.prev = 38;
474
579
  data = (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";
475
580
  _tags = _opt.tags;
476
- from = (_ref7 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref7 !== void 0 ? _ref7 : owner;
581
+ from = (_ref8 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref8 !== void 0 ? _ref8 : owner;
477
582
  if (!_opt.item) {
478
- _context2.next = 42;
583
+ _context3.next = 59;
479
584
  break;
480
585
  }
481
- _context2.prev = 26;
586
+ _context3.prev = 43;
482
587
  data = _base64url["default"].decode(_opt.item.data);
483
588
  _tags = _opt.item.tags;
484
589
  if (from) {
485
- _context2.next = 37;
590
+ _context3.next = 54;
486
591
  break;
487
592
  }
488
593
  raw_owner = _opt.item.rawOwner;
489
- _context2.t0 = Buffer;
490
- _context2.next = 34;
594
+ _context3.t11 = Buffer;
595
+ _context3.next = 51;
491
596
  return _crypto["default"].subtle.digest("SHA-256", raw_owner);
492
- case 34:
493
- _context2.t1 = _context2.sent;
494
- hashBuffer = _context2.t0.from.call(_context2.t0, _context2.t1);
597
+ case 51:
598
+ _context3.t12 = _context3.sent;
599
+ hashBuffer = _context3.t11.from.call(_context3.t11, _context3.t12);
495
600
  from = _base64url["default"].encode(hashBuffer);
496
- case 37:
497
- _context2.next = 42;
601
+ case 54:
602
+ _context3.next = 59;
498
603
  break;
499
- case 39:
500
- _context2.prev = 39;
501
- _context2.t2 = _context2["catch"](26);
502
- console.log(_context2.t2);
503
- case 42:
504
- // check: is owner=mu.addr right?
505
- msg = genMsg(opt.message, p, data, _tags, from, _test.mu.addr);
604
+ case 56:
605
+ _context3.prev = 56;
606
+ _context3.t13 = _context3["catch"](43);
607
+ console.log(_context3.t13);
608
+ case 59:
609
+ _context3.next = 61;
610
+ return genMsg(opt.message, p, data, _tags, from, _test.mu.addr);
611
+ case 61:
612
+ msg = _context3.sent;
506
613
  _env = genEnv({
507
614
  pid: p.id,
508
615
  owner: p.owner,
509
616
  module: p.module,
510
617
  auth: _test.mu.addr
511
618
  });
512
- _context2.next = 46;
619
+ if (p.handle) {
620
+ _context3.next = 84;
621
+ break;
622
+ }
623
+ _context3.next = 66;
624
+ return mem.getWasm(p.modulea);
625
+ case 66:
626
+ _yield$mem$getWasm2 = _context3.sent;
627
+ format = _yield$mem$getWasm2.format;
628
+ mod = _yield$mem$getWasm2.mod;
629
+ wasm = _yield$mem$getWasm2.wasm;
630
+ wdrive = extensions[p.extention];
631
+ _context3.t14 = _aoLoader["default"];
632
+ _context3.t15 = wasm;
633
+ _context3.t16 = format;
634
+ _context3.t17 = wdrive;
635
+ _context3.t18 = new DataItem(p.item);
636
+ _context3.next = 78;
637
+ return mem.get("txs", mod);
638
+ case 78:
639
+ _context3.t19 = _context3.sent;
640
+ _context3.t20 = {
641
+ format: _context3.t16,
642
+ WeaveDrive: _context3.t17,
643
+ spawn: _context3.t18,
644
+ module: _context3.t19
645
+ };
646
+ _context3.next = 82;
647
+ return (0, _context3.t14)(_context3.t15, _context3.t20);
648
+ case 82:
649
+ p.handle = _context3.sent;
650
+ mem.env[opt.process].handle = p.handle;
651
+ case 84:
652
+ _context3.next = 86;
513
653
  return p.handle(p.memory, msg, _env);
514
- case 46:
515
- res = _context2.sent;
654
+ case 86:
655
+ res = _context3.sent;
516
656
  p.memory = res.Memory;
517
657
  delete res.Memory;
518
658
  p.res[opt.message] = res;
@@ -520,21 +660,29 @@ var connect = exports.connect = function connect(mem) {
520
660
  p.txs.unshift(_objectSpread({
521
661
  id: id
522
662
  }, opt));
523
- mem.msgs[opt.message] = _opt;
663
+ _context3.next = 94;
664
+ return mem.set(p, "env", opt.process);
665
+ case 94:
666
+ _context3.next = 96;
667
+ return mem.set(_opt, "msgs", opt.message);
668
+ case 96:
524
669
  _iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
525
- _context2.prev = 54;
670
+ _context3.prev = 97;
526
671
  _iterator2.s();
527
- case 56:
672
+ case 99:
528
673
  if ((_step2 = _iterator2.n()).done) {
529
- _context2.next = 63;
674
+ _context3.next = 108;
530
675
  break;
531
676
  }
532
677
  v = _step2.value;
533
- if (!mem.env[v.Target]) {
534
- _context2.next = 61;
678
+ _context3.next = 103;
679
+ return mem.get("env", v.Target);
680
+ case 103:
681
+ if (!_context3.sent) {
682
+ _context3.next = 106;
535
683
  break;
536
684
  }
537
- _context2.next = 61;
685
+ _context3.next = 106;
538
686
  return message({
539
687
  process: v.Target,
540
688
  tags: v.Tags,
@@ -542,32 +690,32 @@ var connect = exports.connect = function connect(mem) {
542
690
  signer: _test.mu.signer,
543
691
  from: opt.process
544
692
  });
545
- case 61:
546
- _context2.next = 56;
693
+ case 106:
694
+ _context3.next = 99;
547
695
  break;
548
- case 63:
549
- _context2.next = 68;
696
+ case 108:
697
+ _context3.next = 113;
550
698
  break;
551
- case 65:
552
- _context2.prev = 65;
553
- _context2.t3 = _context2["catch"](54);
554
- _iterator2.e(_context2.t3);
555
- case 68:
556
- _context2.prev = 68;
699
+ case 110:
700
+ _context3.prev = 110;
701
+ _context3.t21 = _context3["catch"](97);
702
+ _iterator2.e(_context3.t21);
703
+ case 113:
704
+ _context3.prev = 113;
557
705
  _iterator2.f();
558
- return _context2.finish(68);
559
- case 71:
706
+ return _context3.finish(113);
707
+ case 116:
560
708
  _iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
561
- _context2.prev = 72;
709
+ _context3.prev = 117;
562
710
  _iterator3.s();
563
- case 74:
711
+ case 119:
564
712
  if ((_step3 = _iterator3.n()).done) {
565
- _context2.next = 81;
713
+ _context3.next = 126;
566
714
  break;
567
715
  }
568
716
  _v = _step3.value;
569
717
  __tags = (0, _utils.tags)(_v.Tags);
570
- _context2.next = 79;
718
+ _context3.next = 124;
571
719
  return spawn({
572
720
  module: __tags.Module,
573
721
  scheduler: _test.scheduler,
@@ -576,112 +724,115 @@ var connect = exports.connect = function connect(mem) {
576
724
  from: __tags["From-Process"],
577
725
  signer: _test.mu.signer
578
726
  });
579
- case 79:
580
- _context2.next = 74;
727
+ case 124:
728
+ _context3.next = 119;
581
729
  break;
582
- case 81:
583
- _context2.next = 86;
730
+ case 126:
731
+ _context3.next = 131;
584
732
  break;
585
- case 83:
586
- _context2.prev = 83;
587
- _context2.t4 = _context2["catch"](72);
588
- _iterator3.e(_context2.t4);
589
- case 86:
590
- _context2.prev = 86;
733
+ case 128:
734
+ _context3.prev = 128;
735
+ _context3.t22 = _context3["catch"](117);
736
+ _iterator3.e(_context3.t22);
737
+ case 131:
738
+ _context3.prev = 131;
591
739
  _iterator3.f();
592
- return _context2.finish(86);
593
- case 89:
740
+ return _context3.finish(131);
741
+ case 134:
594
742
  _iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
595
- _context2.prev = 90;
743
+ _context3.prev = 135;
596
744
  _iterator4.s();
597
- case 92:
745
+ case 137:
598
746
  if ((_step4 = _iterator4.n()).done) {
599
- _context2.next = 113;
747
+ _context3.next = 158;
600
748
  break;
601
749
  }
602
750
  _v2 = _step4.value;
603
751
  _iterator5 = _createForOfIteratorHelper(_v2.Processes);
604
- _context2.prev = 95;
752
+ _context3.prev = 140;
605
753
  _iterator5.s();
606
- case 97:
754
+ case 142:
607
755
  if ((_step5 = _iterator5.n()).done) {
608
- _context2.next = 103;
756
+ _context3.next = 148;
609
757
  break;
610
758
  }
611
759
  v2 = _step5.value;
612
- _context2.next = 101;
760
+ _context3.next = 146;
613
761
  return _assign({
614
762
  message: _v2.Message,
615
763
  process: v2,
616
764
  from: opt.process,
617
765
  signer: _test.mu.signer
618
766
  });
619
- case 101:
620
- _context2.next = 97;
767
+ case 146:
768
+ _context3.next = 142;
621
769
  break;
622
- case 103:
623
- _context2.next = 108;
770
+ case 148:
771
+ _context3.next = 153;
624
772
  break;
625
- case 105:
626
- _context2.prev = 105;
627
- _context2.t5 = _context2["catch"](95);
628
- _iterator5.e(_context2.t5);
629
- case 108:
630
- _context2.prev = 108;
773
+ case 150:
774
+ _context3.prev = 150;
775
+ _context3.t23 = _context3["catch"](140);
776
+ _iterator5.e(_context3.t23);
777
+ case 153:
778
+ _context3.prev = 153;
631
779
  _iterator5.f();
632
- return _context2.finish(108);
633
- case 111:
634
- _context2.next = 92;
780
+ return _context3.finish(153);
781
+ case 156:
782
+ _context3.next = 137;
635
783
  break;
636
- case 113:
637
- _context2.next = 118;
784
+ case 158:
785
+ _context3.next = 163;
638
786
  break;
639
- case 115:
640
- _context2.prev = 115;
641
- _context2.t6 = _context2["catch"](90);
642
- _iterator4.e(_context2.t6);
643
- case 118:
644
- _context2.prev = 118;
787
+ case 160:
788
+ _context3.prev = 160;
789
+ _context3.t24 = _context3["catch"](135);
790
+ _iterator4.e(_context3.t24);
791
+ case 163:
792
+ _context3.prev = 163;
645
793
  _iterator4.f();
646
- return _context2.finish(118);
647
- case 121:
648
- return _context2.abrupt("return", id);
649
- case 124:
650
- _context2.prev = 124;
651
- _context2.t7 = _context2["catch"](21);
652
- console.log(_context2.t7);
653
- case 127:
654
- return _context2.abrupt("return", null);
655
- case 128:
794
+ return _context3.finish(163);
795
+ case 166:
796
+ return _context3.abrupt("return", id);
797
+ case 169:
798
+ _context3.prev = 169;
799
+ _context3.t25 = _context3["catch"](38);
800
+ console.log(_context3.t25);
801
+ case 172:
802
+ return _context3.abrupt("return", null);
803
+ case 173:
656
804
  case "end":
657
- return _context2.stop();
805
+ return _context3.stop();
658
806
  }
659
- }, _callee2, null, [[21, 124], [26, 39], [54, 65, 68, 71], [72, 83, 86, 89], [90, 115, 118, 121], [95, 105, 108, 111]]);
807
+ }, _callee3, null, [[38, 169], [43, 56], [97, 110, 113, 116], [117, 128, 131, 134], [135, 160, 163, 166], [140, 150, 153, 156]]);
660
808
  }));
661
- return function assign(_x) {
662
- return _ref6.apply(this, arguments);
809
+ return function assign(_x7) {
810
+ return _ref7.apply(this, arguments);
663
811
  };
664
812
  }();
665
813
  var message = /*#__PURE__*/function () {
666
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
814
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
667
815
  var _opt$item$id, _opt$item, _opt$owner;
668
- var p, ex, id, owner, item, _opt$tags4, _iterator6, _step6, v, _yield$ar$dataitem3;
669
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
670
- while (1) switch (_context3.prev = _context3.next) {
816
+ var p, ex, id, owner, item, _opt$tags3, _iterator6, _step6, v, _yield$ar$dataitem3;
817
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
818
+ while (1) switch (_context4.prev = _context4.next) {
671
819
  case 0:
672
- p = mem.env[opt.process];
820
+ _context4.next = 2;
821
+ return mem.get("env", opt.process);
822
+ case 2:
823
+ p = _context4.sent;
673
824
  if (p) {
674
- _context3.next = 3;
825
+ _context4.next = 5;
675
826
  break;
676
827
  }
677
- return _context3.abrupt("return", null);
678
- case 3:
828
+ return _context4.abrupt("return", null);
829
+ case 5:
679
830
  ex = false;
680
831
  id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
681
832
  owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
682
833
  item = opt.item;
683
834
  if (!(!opt.item && opt.signer)) {
684
- _context3.next = 17;
835
+ _context4.next = 19;
685
836
  break;
686
837
  }
687
838
  _iterator6 = _createForOfIteratorHelper(opt.tags);
@@ -695,27 +846,29 @@ var connect = exports.connect = function connect(mem) {
695
846
  } finally {
696
847
  _iterator6.f();
697
848
  }
698
- opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags4 = opt.tags) !== null && _opt$tags4 !== void 0 ? _opt$tags4 : []), {
849
+ opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
699
850
  "Data-Protocol": "ao",
700
851
  Variant: "ao.TN.1",
701
852
  Type: "Message",
702
853
  SDK: "aoconnect"
703
854
  }));
704
- _context3.next = 13;
855
+ _context4.next = 15;
705
856
  return ar.dataitem({
706
857
  data: opt.data,
707
858
  signer: opt.signer,
708
859
  tags: (0, _utils.tags)(opt.tags),
709
860
  target: opt.process
710
861
  });
711
- case 13:
712
- _yield$ar$dataitem3 = _context3.sent;
862
+ case 15:
863
+ _yield$ar$dataitem3 = _context4.sent;
713
864
  item = _yield$ar$dataitem3.item;
714
865
  id = _yield$ar$dataitem3.id;
715
866
  owner = _yield$ar$dataitem3.owner;
716
- case 17:
717
- mem.msgs[id] = opt;
718
- _context3.next = 20;
867
+ case 19:
868
+ _context4.next = 21;
869
+ return mem.set(opt, "msgs", id);
870
+ case 21:
871
+ _context4.next = 23;
719
872
  return _assign({
720
873
  message_item: item,
721
874
  message: id,
@@ -723,55 +876,61 @@ var connect = exports.connect = function connect(mem) {
723
876
  from: owner,
724
877
  signer: _test.mu.signer
725
878
  });
726
- case 20:
727
- return _context3.abrupt("return", id);
728
- case 21:
879
+ case 23:
880
+ return _context4.abrupt("return", id);
881
+ case 24:
729
882
  case "end":
730
- return _context3.stop();
883
+ return _context4.stop();
731
884
  }
732
- }, _callee3);
885
+ }, _callee4);
733
886
  }));
734
- return function message(_x2) {
735
- return _ref8.apply(this, arguments);
887
+ return function message(_x8) {
888
+ return _ref9.apply(this, arguments);
736
889
  };
737
890
  }();
738
891
  return {
739
892
  message: message,
740
893
  unmonitor: function () {
741
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
894
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
742
895
  var p;
743
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
744
- while (1) switch (_context4.prev = _context4.next) {
896
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
897
+ while (1) switch (_context5.prev = _context5.next) {
745
898
  case 0:
746
- p = mem.env[opt.process];
899
+ _context5.next = 2;
900
+ return mem.get("env", opt.process);
901
+ case 2:
902
+ p = _context5.sent;
747
903
  try {
748
904
  clearInterval(p.cron);
749
905
  p.cron = null;
750
906
  } catch (e) {}
751
- case 2:
907
+ case 4:
752
908
  case "end":
753
- return _context4.stop();
909
+ return _context5.stop();
754
910
  }
755
- }, _callee4);
911
+ }, _callee5);
756
912
  }));
757
- function unmonitor(_x3) {
913
+ function unmonitor(_x9) {
758
914
  return _unmonitor.apply(this, arguments);
759
915
  }
760
916
  return unmonitor;
761
917
  }(),
762
918
  monitor: function () {
763
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
919
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
764
920
  var p;
765
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
766
- while (1) switch (_context6.prev = _context6.next) {
921
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
922
+ while (1) switch (_context7.prev = _context7.next) {
767
923
  case 0:
768
- p = mem.env[opt.process];
924
+ _context7.next = 2;
925
+ return mem.get("env", opt.process);
926
+ case 2:
927
+ p = _context7.sent;
769
928
  if ((0, _ramda.isNil)(p.cron)) {
770
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
771
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
772
- while (1) switch (_context5.prev = _context5.next) {
929
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
930
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
931
+ while (1) switch (_context6.prev = _context6.next) {
773
932
  case 0:
774
- _context5.next = 2;
933
+ _context6.next = 2;
775
934
  return message({
776
935
  tags: p.cronTags,
777
936
  process: opt.process,
@@ -780,18 +939,18 @@ var connect = exports.connect = function connect(mem) {
780
939
  });
781
940
  case 2:
782
941
  case "end":
783
- return _context5.stop();
942
+ return _context6.stop();
784
943
  }
785
- }, _callee5);
944
+ }, _callee6);
786
945
  })), p.span);
787
946
  }
788
- case 2:
947
+ case 4:
789
948
  case "end":
790
- return _context6.stop();
949
+ return _context7.stop();
791
950
  }
792
- }, _callee6);
951
+ }, _callee7);
793
952
  }));
794
- function monitor(_x4) {
953
+ function monitor(_x10) {
795
954
  return _monitor.apply(this, arguments);
796
955
  }
797
956
  return monitor;
@@ -800,40 +959,47 @@ var connect = exports.connect = function connect(mem) {
800
959
  assign: _assign,
801
960
  ar: ar,
802
961
  result: function () {
803
- var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
804
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
805
- while (1) switch (_context7.prev = _context7.next) {
962
+ var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
963
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
964
+ while (1) switch (_context8.prev = _context8.next) {
806
965
  case 0:
807
- return _context7.abrupt("return", mem.env[opt.process].res[opt.message]);
808
- case 1:
966
+ _context8.next = 2;
967
+ return mem.get("env", opt.process);
968
+ case 2:
969
+ _context8.t0 = opt.message;
970
+ return _context8.abrupt("return", _context8.sent.res[_context8.t0]);
971
+ case 4:
809
972
  case "end":
810
- return _context7.stop();
973
+ return _context8.stop();
811
974
  }
812
- }, _callee7);
975
+ }, _callee8);
813
976
  }));
814
- function result(_x5) {
977
+ function result(_x11) {
815
978
  return _result.apply(this, arguments);
816
979
  }
817
980
  return result;
818
981
  }(),
819
982
  results: function () {
820
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
983
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
821
984
  var _opt$limit;
822
985
  var p, results, limit, i, _i;
823
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
824
- while (1) switch (_context8.prev = _context8.next) {
986
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
987
+ while (1) switch (_context9.prev = _context9.next) {
825
988
  case 0:
826
- p = mem.env[opt.process];
989
+ _context9.next = 2;
990
+ return mem.get("env", opt.process);
991
+ case 2:
992
+ p = _context9.sent;
827
993
  results = [];
828
994
  limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
829
995
  if (!(opt.sort === "DESC")) {
830
- _context8.next = 14;
996
+ _context9.next = 16;
831
997
  break;
832
998
  }
833
999
  i = p.results.length - 1;
834
- case 5:
1000
+ case 7:
835
1001
  if (!(0 < i)) {
836
- _context8.next = 12;
1002
+ _context9.next = 14;
837
1003
  break;
838
1004
  }
839
1005
  results.push({
@@ -841,82 +1007,85 @@ var connect = exports.connect = function connect(mem) {
841
1007
  node: p.res[p.results[i]]
842
1008
  });
843
1009
  if (!(results.length >= limit)) {
844
- _context8.next = 9;
1010
+ _context9.next = 11;
845
1011
  break;
846
1012
  }
847
- return _context8.abrupt("break", 12);
848
- case 9:
1013
+ return _context9.abrupt("break", 14);
1014
+ case 11:
849
1015
  i--;
850
- _context8.next = 5;
851
- break;
852
- case 12:
853
- _context8.next = 22;
1016
+ _context9.next = 7;
854
1017
  break;
855
1018
  case 14:
1019
+ _context9.next = 24;
1020
+ break;
1021
+ case 16:
856
1022
  _i = 0;
857
- case 15:
1023
+ case 17:
858
1024
  if (!(_i < p.results.length)) {
859
- _context8.next = 22;
1025
+ _context9.next = 24;
860
1026
  break;
861
1027
  }
862
1028
  results.push({
863
1029
  node: p.res[p.results[_i]]
864
1030
  });
865
1031
  if (!(results.length >= limit)) {
866
- _context8.next = 19;
1032
+ _context9.next = 21;
867
1033
  break;
868
1034
  }
869
- return _context8.abrupt("break", 22);
870
- case 19:
1035
+ return _context9.abrupt("break", 24);
1036
+ case 21:
871
1037
  _i++;
872
- _context8.next = 15;
1038
+ _context9.next = 17;
873
1039
  break;
874
- case 22:
875
- return _context8.abrupt("return", {
1040
+ case 24:
1041
+ return _context9.abrupt("return", {
876
1042
  edges: results
877
1043
  });
878
- case 23:
1044
+ case 25:
879
1045
  case "end":
880
- return _context8.stop();
1046
+ return _context9.stop();
881
1047
  }
882
- }, _callee8);
1048
+ }, _callee9);
883
1049
  }));
884
- function results(_x6) {
1050
+ function results(_x12) {
885
1051
  return _results.apply(this, arguments);
886
1052
  }
887
1053
  return results;
888
1054
  }(),
889
1055
  dryrun: function () {
890
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1056
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
891
1057
  var _opt$id, _opt$owner2;
892
- var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, res;
893
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
894
- while (1) switch (_context9.prev = _context9.next) {
1058
+ var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm3, format, mod, wasm, wdrive, res;
1059
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1060
+ while (1) switch (_context10.prev = _context10.next) {
895
1061
  case 0:
896
- p = mem.env[opt.process];
1062
+ _context10.next = 2;
1063
+ return mem.get("env", opt.process);
1064
+ case 2:
1065
+ p = _context10.sent;
897
1066
  if (p) {
898
- _context9.next = 3;
1067
+ _context10.next = 5;
899
1068
  break;
900
1069
  }
901
- return _context9.abrupt("return", null);
902
- case 3:
1070
+ return _context10.abrupt("return", null);
1071
+ case 5:
903
1072
  id = (_opt$id = opt.id) !== null && _opt$id !== void 0 ? _opt$id : "";
904
1073
  owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : "";
905
1074
  if (!(!opt.id && opt.signer)) {
906
- _context9.next = 12;
1075
+ _context10.next = 14;
907
1076
  break;
908
1077
  }
909
1078
  ;
910
- _context9.next = 9;
1079
+ _context10.next = 11;
911
1080
  return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
912
1081
  target: opt.process
913
1082
  }));
914
- case 9:
915
- _yield$ar$dataitem4 = _context9.sent;
1083
+ case 11:
1084
+ _yield$ar$dataitem4 = _context10.sent;
916
1085
  id = _yield$ar$dataitem4.id;
917
1086
  owner = _yield$ar$dataitem4.owner;
918
- case 12:
919
- _context9.prev = 12;
1087
+ case 14:
1088
+ _context10.prev = 14;
920
1089
  cloneMemory = function cloneMemory(memory) {
921
1090
  var buffer = memory.buffer.slice(0);
922
1091
  return new WebAssembly.Memory({
@@ -925,31 +1094,67 @@ var connect = exports.connect = function connect(mem) {
925
1094
  shared: memory.shared || false
926
1095
  });
927
1096
  };
928
- msg = genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
1097
+ _context10.next = 18;
1098
+ return genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
1099
+ case 18:
1100
+ msg = _context10.sent;
929
1101
  _env = genEnv({
930
1102
  pid: p.id,
931
1103
  owner: p.owner,
932
1104
  module: p.module,
933
1105
  auth: _test.mu.addr
934
1106
  });
935
- _context9.next = 18;
1107
+ if (p.handle) {
1108
+ _context10.next = 41;
1109
+ break;
1110
+ }
1111
+ _context10.next = 23;
1112
+ return mem.getWasm(p.modulea);
1113
+ case 23:
1114
+ _yield$mem$getWasm3 = _context10.sent;
1115
+ format = _yield$mem$getWasm3.format;
1116
+ mod = _yield$mem$getWasm3.mod;
1117
+ wasm = _yield$mem$getWasm3.wasm;
1118
+ wdrive = extensions[p.extention];
1119
+ _context10.t0 = _aoLoader["default"];
1120
+ _context10.t1 = wasm;
1121
+ _context10.t2 = format;
1122
+ _context10.t3 = wdrive;
1123
+ _context10.t4 = new DataItem(p.item);
1124
+ _context10.next = 35;
1125
+ return mem.get("txs", mod);
1126
+ case 35:
1127
+ _context10.t5 = _context10.sent;
1128
+ _context10.t6 = {
1129
+ format: _context10.t2,
1130
+ WeaveDrive: _context10.t3,
1131
+ spawn: _context10.t4,
1132
+ module: _context10.t5
1133
+ };
1134
+ _context10.next = 39;
1135
+ return (0, _context10.t0)(_context10.t1, _context10.t6);
1136
+ case 39:
1137
+ p.handle = _context10.sent;
1138
+ mem.env[opt.process].handle = p.handle;
1139
+ case 41:
1140
+ _context10.next = 43;
936
1141
  return p.handle(p.memory, msg, _env);
937
- case 18:
938
- res = _context9.sent;
939
- return _context9.abrupt("return", res);
940
- case 22:
941
- _context9.prev = 22;
942
- _context9.t0 = _context9["catch"](12);
943
- console.log(_context9.t0);
944
- case 25:
945
- return _context9.abrupt("return", null);
946
- case 26:
1142
+ case 43:
1143
+ res = _context10.sent;
1144
+ return _context10.abrupt("return", res);
1145
+ case 47:
1146
+ _context10.prev = 47;
1147
+ _context10.t7 = _context10["catch"](14);
1148
+ console.log(_context10.t7);
1149
+ case 50:
1150
+ return _context10.abrupt("return", null);
1151
+ case 51:
947
1152
  case "end":
948
- return _context9.stop();
1153
+ return _context10.stop();
949
1154
  }
950
- }, _callee9, null, [[12, 22]]);
1155
+ }, _callee10, null, [[14, 47]]);
951
1156
  }));
952
- function dryrun(_x7) {
1157
+ function dryrun(_x13) {
953
1158
  return _dryrun.apply(this, arguments);
954
1159
  }
955
1160
  return dryrun;