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