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