wao 0.7.2 → 0.8.2

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