wao 0.4.5 → 0.4.7
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 +198 -261
- package/cjs/tao.js +76 -2
- package/esm/aoconnect.js +12 -37
- package/esm/tao.js +28 -1
- package/package.json +1 -1
package/cjs/aoconnect.js
CHANGED
|
@@ -20,11 +20,11 @@ var _tar = _interopRequireDefault(require("./tar.js"));
|
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
|
+
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; }
|
|
23
24
|
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; }
|
|
24
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
26
|
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); }
|
|
26
27
|
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; } } }; }
|
|
27
|
-
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; }
|
|
28
28
|
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); }
|
|
29
29
|
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); }); }; }
|
|
30
30
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -126,78 +126,20 @@ var connect = exports.connect = function connect(mem) {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
|
-
var postModule = /*#__PURE__*/function () {
|
|
130
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
131
|
-
var data, _ref4$tags, tags, signer, t, _tags, _yield$ar$dataitem, id, owner, handle;
|
|
132
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
133
|
-
while (1) switch (_context.prev = _context.next) {
|
|
134
|
-
case 0:
|
|
135
|
-
data = _ref4.data, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, signer = _ref4.signer;
|
|
136
|
-
t = (0, _ramda.mergeLeft)(tags, {
|
|
137
|
-
"Data-Protocol": "ao",
|
|
138
|
-
Variant: "ao.TN.1",
|
|
139
|
-
Type: "Module",
|
|
140
|
-
"Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
141
|
-
"Input-Encoding": "JSON-V1",
|
|
142
|
-
"Output-Encoding": "JSON-V1",
|
|
143
|
-
"Memory-Limit": "1-gb",
|
|
144
|
-
"Compute-Limit": "9000000000000"
|
|
145
|
-
});
|
|
146
|
-
_tags = (0, _utils.buildTags)(null, t);
|
|
147
|
-
_context.next = 5;
|
|
148
|
-
return ar.dataitem({
|
|
149
|
-
tags: _tags,
|
|
150
|
-
data: data,
|
|
151
|
-
signer: signer
|
|
152
|
-
});
|
|
153
|
-
case 5:
|
|
154
|
-
_yield$ar$dataitem = _context.sent;
|
|
155
|
-
id = _yield$ar$dataitem.id;
|
|
156
|
-
owner = _yield$ar$dataitem.owner;
|
|
157
|
-
_context.next = 10;
|
|
158
|
-
return ar.post({
|
|
159
|
-
data: data,
|
|
160
|
-
signer: signer,
|
|
161
|
-
tags: t
|
|
162
|
-
});
|
|
163
|
-
case 10:
|
|
164
|
-
_context.next = 12;
|
|
165
|
-
return (0, _aoLoader["default"])(data, {
|
|
166
|
-
format: t["Module-Format"],
|
|
167
|
-
mode: "test",
|
|
168
|
-
WeaveDrive: WeaveDrive
|
|
169
|
-
});
|
|
170
|
-
case 12:
|
|
171
|
-
handle = _context.sent;
|
|
172
|
-
mem.modmap[id] = {
|
|
173
|
-
handle: handle,
|
|
174
|
-
id: id
|
|
175
|
-
};
|
|
176
|
-
return _context.abrupt("return", id);
|
|
177
|
-
case 15:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context.stop();
|
|
180
|
-
}
|
|
181
|
-
}, _callee);
|
|
182
|
-
}));
|
|
183
|
-
return function postModule(_x) {
|
|
184
|
-
return _ref5.apply(this, arguments);
|
|
185
|
-
};
|
|
186
|
-
}();
|
|
187
129
|
var spawn = /*#__PURE__*/function () {
|
|
188
|
-
var
|
|
189
|
-
var _opt$module, _opt$tags, _opt$tags2;
|
|
130
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
131
|
+
var _opt$module, _mem$wasms$mod$data, _opt$tags, _opt$tags2;
|
|
190
132
|
var opt,
|
|
191
133
|
mod,
|
|
134
|
+
_module,
|
|
192
135
|
__dirname,
|
|
193
136
|
wasm,
|
|
194
137
|
handle,
|
|
195
|
-
_module,
|
|
196
138
|
ex,
|
|
197
139
|
_iterator,
|
|
198
140
|
_step,
|
|
199
141
|
v,
|
|
200
|
-
_yield$ar$
|
|
142
|
+
_yield$ar$dataitem,
|
|
201
143
|
id,
|
|
202
144
|
owner,
|
|
203
145
|
item,
|
|
@@ -219,48 +161,44 @@ var connect = exports.connect = function connect(mem) {
|
|
|
219
161
|
_int,
|
|
220
162
|
cronTags,
|
|
221
163
|
k,
|
|
222
|
-
|
|
223
|
-
return _regeneratorRuntime().wrap(function
|
|
224
|
-
while (1) switch (
|
|
164
|
+
_args = arguments;
|
|
165
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
166
|
+
while (1) switch (_context.prev = _context.next) {
|
|
225
167
|
case 0:
|
|
226
|
-
opt =
|
|
168
|
+
opt = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
227
169
|
if (opt.module) {
|
|
228
|
-
|
|
170
|
+
_context.next = 3;
|
|
229
171
|
break;
|
|
230
172
|
}
|
|
231
173
|
throw Error("module missing");
|
|
232
174
|
case 3:
|
|
233
175
|
if (opt.scheduler) {
|
|
234
|
-
|
|
176
|
+
_context.next = 5;
|
|
235
177
|
break;
|
|
236
178
|
}
|
|
237
179
|
throw Error("scheduler missing");
|
|
238
180
|
case 5:
|
|
239
181
|
mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : mem.modules["aos2_0_1"];
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
_context2.next = 9;
|
|
182
|
+
_module = null;
|
|
183
|
+
_context.next = 9;
|
|
245
184
|
return (0, _utils.dirname)();
|
|
246
185
|
case 9:
|
|
247
|
-
__dirname =
|
|
248
|
-
wasm = (0, _fs.readFileSync)((0, _path.resolve)(__dirname, "lua/".concat(mem.wasms[mod].file, ".wasm")));
|
|
249
|
-
|
|
186
|
+
__dirname = _context.sent;
|
|
187
|
+
wasm = (_mem$wasms$mod$data = mem.wasms[mod].data) !== null && _mem$wasms$mod$data !== void 0 ? _mem$wasms$mod$data : (0, _fs.readFileSync)((0, _path.resolve)(__dirname, "lua/".concat(mem.wasms[mod].file, ".wasm")));
|
|
188
|
+
_context.next = 13;
|
|
250
189
|
return (0, _aoLoader["default"])(wasm, {
|
|
251
190
|
format: mem.wasms[mod].format,
|
|
252
191
|
mode: "test",
|
|
253
192
|
WeaveDrive: WeaveDrive
|
|
254
193
|
});
|
|
255
194
|
case 13:
|
|
256
|
-
handle =
|
|
257
|
-
|
|
195
|
+
handle = _context.sent;
|
|
196
|
+
_module = {
|
|
258
197
|
handle: handle,
|
|
259
198
|
id: mod
|
|
260
199
|
};
|
|
261
|
-
case 15:
|
|
262
200
|
if (mod) {
|
|
263
|
-
|
|
201
|
+
_context.next = 17;
|
|
264
202
|
break;
|
|
265
203
|
}
|
|
266
204
|
throw Error("module not found");
|
|
@@ -274,7 +212,6 @@ var connect = exports.connect = function connect(mem) {
|
|
|
274
212
|
Scheduler: opt.scheduler,
|
|
275
213
|
"Content-Type": "text/plain"
|
|
276
214
|
}));
|
|
277
|
-
_module = mem.modmap[mod];
|
|
278
215
|
ex = false;
|
|
279
216
|
(_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : opt.tags = [];
|
|
280
217
|
_iterator = _createForOfIteratorHelper(opt.tags);
|
|
@@ -292,20 +229,20 @@ var connect = exports.connect = function connect(mem) {
|
|
|
292
229
|
name: "Type",
|
|
293
230
|
value: "Process"
|
|
294
231
|
});
|
|
295
|
-
|
|
232
|
+
_context.next = 25;
|
|
296
233
|
return ar.dataitem({
|
|
297
234
|
data: opt.data,
|
|
298
235
|
signer: opt.signer,
|
|
299
236
|
tags: (0, _utils.tags)(opt.tags)
|
|
300
237
|
});
|
|
301
|
-
case
|
|
302
|
-
_yield$ar$
|
|
303
|
-
id = _yield$ar$
|
|
304
|
-
owner = _yield$ar$
|
|
305
|
-
item = _yield$ar$
|
|
306
|
-
|
|
238
|
+
case 25:
|
|
239
|
+
_yield$ar$dataitem = _context.sent;
|
|
240
|
+
id = _yield$ar$dataitem.id;
|
|
241
|
+
owner = _yield$ar$dataitem.owner;
|
|
242
|
+
item = _yield$ar$dataitem.item;
|
|
243
|
+
_context.next = 31;
|
|
307
244
|
return ar.postItem(item, _test.su.jwk);
|
|
308
|
-
case
|
|
245
|
+
case 31:
|
|
309
246
|
_tags = (0, _utils.tags)(opt.tags);
|
|
310
247
|
res = null;
|
|
311
248
|
memory = null;
|
|
@@ -324,7 +261,7 @@ var connect = exports.connect = function connect(mem) {
|
|
|
324
261
|
opt: opt
|
|
325
262
|
};
|
|
326
263
|
if (!_tags["On-Boot"]) {
|
|
327
|
-
|
|
264
|
+
_context.next = 49;
|
|
328
265
|
break;
|
|
329
266
|
}
|
|
330
267
|
data = "";
|
|
@@ -337,51 +274,51 @@ var connect = exports.connect = function connect(mem) {
|
|
|
337
274
|
auth: _test.mu.addr
|
|
338
275
|
});
|
|
339
276
|
_t = (0, _utils.tags)(msg.Tags);
|
|
340
|
-
|
|
277
|
+
_context.next = 43;
|
|
341
278
|
return _module.handle(null, msg, _env);
|
|
342
|
-
case
|
|
343
|
-
res =
|
|
279
|
+
case 43:
|
|
280
|
+
res = _context.sent;
|
|
344
281
|
p.memory = res.Memory;
|
|
345
282
|
delete res.Memory;
|
|
346
283
|
p.res[id] = res;
|
|
347
|
-
|
|
284
|
+
_context.next = 50;
|
|
348
285
|
break;
|
|
349
|
-
case
|
|
286
|
+
case 49:
|
|
350
287
|
p.height += 1;
|
|
351
|
-
case
|
|
288
|
+
case 50:
|
|
352
289
|
mem.msgs[id] = opt;
|
|
353
290
|
mem.env[id] = p;
|
|
354
291
|
if (!_tags["Cron-Interval"]) {
|
|
355
|
-
|
|
292
|
+
_context.next = 76;
|
|
356
293
|
break;
|
|
357
294
|
}
|
|
358
295
|
_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
296
|
_int = 0;
|
|
360
|
-
|
|
361
|
-
|
|
297
|
+
_context.t0 = unit.replace(/s$/, "");
|
|
298
|
+
_context.next = _context.t0 === "millisecond" ? 58 : _context.t0 === "second" ? 60 : _context.t0 === "minute" ? 62 : _context.t0 === "hour" ? 64 : _context.t0 === "day" ? 66 : _context.t0 === "month" ? 68 : _context.t0 === "year" ? 70 : 72;
|
|
362
299
|
break;
|
|
363
|
-
case
|
|
300
|
+
case 58:
|
|
364
301
|
_int = num;
|
|
365
|
-
return
|
|
366
|
-
case
|
|
302
|
+
return _context.abrupt("break", 72);
|
|
303
|
+
case 60:
|
|
367
304
|
_int = num * 1000;
|
|
368
|
-
return
|
|
369
|
-
case
|
|
305
|
+
return _context.abrupt("break", 72);
|
|
306
|
+
case 62:
|
|
370
307
|
_int = num * 1000 * 60;
|
|
371
|
-
return
|
|
372
|
-
case
|
|
308
|
+
return _context.abrupt("break", 72);
|
|
309
|
+
case 64:
|
|
373
310
|
_int = num * 1000 * 60 * 60;
|
|
374
|
-
return
|
|
375
|
-
case
|
|
311
|
+
return _context.abrupt("break", 72);
|
|
312
|
+
case 66:
|
|
376
313
|
_int = num * 1000 * 60 * 60 * 24;
|
|
377
|
-
return
|
|
378
|
-
case
|
|
314
|
+
return _context.abrupt("break", 72);
|
|
315
|
+
case 68:
|
|
379
316
|
_int = num * 1000 * 60 * 60 * 24 * 30;
|
|
380
|
-
return
|
|
381
|
-
case
|
|
317
|
+
return _context.abrupt("break", 72);
|
|
318
|
+
case 70:
|
|
382
319
|
_int = num * 1000 * 60 * 60 * 24 * 365;
|
|
383
|
-
return
|
|
384
|
-
case
|
|
320
|
+
return _context.abrupt("break", 72);
|
|
321
|
+
case 72:
|
|
385
322
|
cronTags = [];
|
|
386
323
|
for (k in _tags) {
|
|
387
324
|
if (/^Cron-Tag-/.test(k)) {
|
|
@@ -393,16 +330,16 @@ var connect = exports.connect = function connect(mem) {
|
|
|
393
330
|
}
|
|
394
331
|
mem.env[id].cronTags = cronTags;
|
|
395
332
|
mem.env[id].span = _int;
|
|
333
|
+
case 76:
|
|
334
|
+
return _context.abrupt("return", id);
|
|
396
335
|
case 77:
|
|
397
|
-
return _context2.abrupt("return", id);
|
|
398
|
-
case 78:
|
|
399
336
|
case "end":
|
|
400
|
-
return
|
|
337
|
+
return _context.stop();
|
|
401
338
|
}
|
|
402
|
-
},
|
|
339
|
+
}, _callee);
|
|
403
340
|
}));
|
|
404
341
|
return function spawn() {
|
|
405
|
-
return
|
|
342
|
+
return _ref4.apply(this, arguments);
|
|
406
343
|
};
|
|
407
344
|
}();
|
|
408
345
|
function genHashChain(previousHash) {
|
|
@@ -415,11 +352,11 @@ var connect = exports.connect = function connect(mem) {
|
|
|
415
352
|
return (0, _base64url["default"])(hasher.digest());
|
|
416
353
|
}
|
|
417
354
|
var _assign = /*#__PURE__*/function () {
|
|
418
|
-
var
|
|
355
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opt) {
|
|
419
356
|
var _opt$tags3;
|
|
420
|
-
var p, _opt, hash, _yield$ar$
|
|
421
|
-
return _regeneratorRuntime().wrap(function
|
|
422
|
-
while (1) switch (
|
|
357
|
+
var p, _opt, hash, _yield$ar$dataitem2, id, owner, item, _opt$data2, _ref6, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, msg, _env, res, _iterator2, _step2, v, _iterator3, _step3, _v, _tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
|
|
358
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
359
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
423
360
|
case 0:
|
|
424
361
|
p = mem.env[opt.process];
|
|
425
362
|
_opt = mem.msgs[opt.message];
|
|
@@ -438,8 +375,8 @@ var connect = exports.connect = function connect(mem) {
|
|
|
438
375
|
Message: opt.message,
|
|
439
376
|
"Hash-Chain": hash
|
|
440
377
|
}));
|
|
441
|
-
p.epochs.push([opt.
|
|
442
|
-
|
|
378
|
+
p.epochs.push([opt.message]);
|
|
379
|
+
_context2.next = 8;
|
|
443
380
|
return ar.dataitem({
|
|
444
381
|
data: opt.data,
|
|
445
382
|
signer: opt.signer,
|
|
@@ -447,25 +384,25 @@ var connect = exports.connect = function connect(mem) {
|
|
|
447
384
|
target: opt.process
|
|
448
385
|
});
|
|
449
386
|
case 8:
|
|
450
|
-
_yield$ar$
|
|
451
|
-
id = _yield$ar$
|
|
452
|
-
owner = _yield$ar$
|
|
453
|
-
item = _yield$ar$
|
|
454
|
-
|
|
387
|
+
_yield$ar$dataitem2 = _context2.sent;
|
|
388
|
+
id = _yield$ar$dataitem2.id;
|
|
389
|
+
owner = _yield$ar$dataitem2.owner;
|
|
390
|
+
item = _yield$ar$dataitem2.item;
|
|
391
|
+
_context2.next = 14;
|
|
455
392
|
return ar.postItem(item, _test.su.jwk);
|
|
456
393
|
case 14:
|
|
457
|
-
|
|
458
|
-
msg = genMsg(opt.message, p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (
|
|
394
|
+
_context2.prev = 14;
|
|
395
|
+
msg = genMsg(opt.message, p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (_ref6 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref6 !== void 0 ? _ref6 : owner, _test.mu.addr);
|
|
459
396
|
_env = genEnv({
|
|
460
397
|
pid: p.id,
|
|
461
398
|
owner: p.owner,
|
|
462
399
|
module: p.module,
|
|
463
400
|
auth: _test.mu.addr
|
|
464
401
|
});
|
|
465
|
-
|
|
402
|
+
_context2.next = 19;
|
|
466
403
|
return p.handle(p.memory, msg, _env);
|
|
467
404
|
case 19:
|
|
468
|
-
res =
|
|
405
|
+
res = _context2.sent;
|
|
469
406
|
p.memory = res.Memory;
|
|
470
407
|
delete res.Memory;
|
|
471
408
|
p.res[opt.message] = res;
|
|
@@ -475,19 +412,19 @@ var connect = exports.connect = function connect(mem) {
|
|
|
475
412
|
}, opt));
|
|
476
413
|
mem.msgs[opt.message] = _opt;
|
|
477
414
|
_iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
478
|
-
|
|
415
|
+
_context2.prev = 27;
|
|
479
416
|
_iterator2.s();
|
|
480
417
|
case 29:
|
|
481
418
|
if ((_step2 = _iterator2.n()).done) {
|
|
482
|
-
|
|
419
|
+
_context2.next = 36;
|
|
483
420
|
break;
|
|
484
421
|
}
|
|
485
422
|
v = _step2.value;
|
|
486
423
|
if (!mem.env[v.Target]) {
|
|
487
|
-
|
|
424
|
+
_context2.next = 34;
|
|
488
425
|
break;
|
|
489
426
|
}
|
|
490
|
-
|
|
427
|
+
_context2.next = 34;
|
|
491
428
|
return message({
|
|
492
429
|
process: v.Target,
|
|
493
430
|
tags: v.Tags,
|
|
@@ -496,31 +433,31 @@ var connect = exports.connect = function connect(mem) {
|
|
|
496
433
|
from: opt.process
|
|
497
434
|
});
|
|
498
435
|
case 34:
|
|
499
|
-
|
|
436
|
+
_context2.next = 29;
|
|
500
437
|
break;
|
|
501
438
|
case 36:
|
|
502
|
-
|
|
439
|
+
_context2.next = 41;
|
|
503
440
|
break;
|
|
504
441
|
case 38:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
_iterator2.e(
|
|
442
|
+
_context2.prev = 38;
|
|
443
|
+
_context2.t0 = _context2["catch"](27);
|
|
444
|
+
_iterator2.e(_context2.t0);
|
|
508
445
|
case 41:
|
|
509
|
-
|
|
446
|
+
_context2.prev = 41;
|
|
510
447
|
_iterator2.f();
|
|
511
|
-
return
|
|
448
|
+
return _context2.finish(41);
|
|
512
449
|
case 44:
|
|
513
450
|
_iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
514
|
-
|
|
451
|
+
_context2.prev = 45;
|
|
515
452
|
_iterator3.s();
|
|
516
453
|
case 47:
|
|
517
454
|
if ((_step3 = _iterator3.n()).done) {
|
|
518
|
-
|
|
455
|
+
_context2.next = 54;
|
|
519
456
|
break;
|
|
520
457
|
}
|
|
521
458
|
_v = _step3.value;
|
|
522
459
|
_tags = (0, _utils.tags)(_v.Tags);
|
|
523
|
-
|
|
460
|
+
_context2.next = 52;
|
|
524
461
|
return spawn({
|
|
525
462
|
module: _tags.Module,
|
|
526
463
|
scheduler: _test.scheduler,
|
|
@@ -530,39 +467,39 @@ var connect = exports.connect = function connect(mem) {
|
|
|
530
467
|
signer: _test.mu.signer
|
|
531
468
|
});
|
|
532
469
|
case 52:
|
|
533
|
-
|
|
470
|
+
_context2.next = 47;
|
|
534
471
|
break;
|
|
535
472
|
case 54:
|
|
536
|
-
|
|
473
|
+
_context2.next = 59;
|
|
537
474
|
break;
|
|
538
475
|
case 56:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
_iterator3.e(
|
|
476
|
+
_context2.prev = 56;
|
|
477
|
+
_context2.t1 = _context2["catch"](45);
|
|
478
|
+
_iterator3.e(_context2.t1);
|
|
542
479
|
case 59:
|
|
543
|
-
|
|
480
|
+
_context2.prev = 59;
|
|
544
481
|
_iterator3.f();
|
|
545
|
-
return
|
|
482
|
+
return _context2.finish(59);
|
|
546
483
|
case 62:
|
|
547
484
|
_iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
548
|
-
|
|
485
|
+
_context2.prev = 63;
|
|
549
486
|
_iterator4.s();
|
|
550
487
|
case 65:
|
|
551
488
|
if ((_step4 = _iterator4.n()).done) {
|
|
552
|
-
|
|
489
|
+
_context2.next = 86;
|
|
553
490
|
break;
|
|
554
491
|
}
|
|
555
492
|
_v2 = _step4.value;
|
|
556
493
|
_iterator5 = _createForOfIteratorHelper(_v2.Processes);
|
|
557
|
-
|
|
494
|
+
_context2.prev = 68;
|
|
558
495
|
_iterator5.s();
|
|
559
496
|
case 70:
|
|
560
497
|
if ((_step5 = _iterator5.n()).done) {
|
|
561
|
-
|
|
498
|
+
_context2.next = 76;
|
|
562
499
|
break;
|
|
563
500
|
}
|
|
564
501
|
v2 = _step5.value;
|
|
565
|
-
|
|
502
|
+
_context2.next = 74;
|
|
566
503
|
return _assign({
|
|
567
504
|
message: _v2.Message,
|
|
568
505
|
process: v2,
|
|
@@ -570,57 +507,57 @@ var connect = exports.connect = function connect(mem) {
|
|
|
570
507
|
signer: _test.mu.signer
|
|
571
508
|
});
|
|
572
509
|
case 74:
|
|
573
|
-
|
|
510
|
+
_context2.next = 70;
|
|
574
511
|
break;
|
|
575
512
|
case 76:
|
|
576
|
-
|
|
513
|
+
_context2.next = 81;
|
|
577
514
|
break;
|
|
578
515
|
case 78:
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
_iterator5.e(
|
|
516
|
+
_context2.prev = 78;
|
|
517
|
+
_context2.t2 = _context2["catch"](68);
|
|
518
|
+
_iterator5.e(_context2.t2);
|
|
582
519
|
case 81:
|
|
583
|
-
|
|
520
|
+
_context2.prev = 81;
|
|
584
521
|
_iterator5.f();
|
|
585
|
-
return
|
|
522
|
+
return _context2.finish(81);
|
|
586
523
|
case 84:
|
|
587
|
-
|
|
524
|
+
_context2.next = 65;
|
|
588
525
|
break;
|
|
589
526
|
case 86:
|
|
590
|
-
|
|
527
|
+
_context2.next = 91;
|
|
591
528
|
break;
|
|
592
529
|
case 88:
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
_iterator4.e(
|
|
530
|
+
_context2.prev = 88;
|
|
531
|
+
_context2.t3 = _context2["catch"](63);
|
|
532
|
+
_iterator4.e(_context2.t3);
|
|
596
533
|
case 91:
|
|
597
|
-
|
|
534
|
+
_context2.prev = 91;
|
|
598
535
|
_iterator4.f();
|
|
599
|
-
return
|
|
536
|
+
return _context2.finish(91);
|
|
600
537
|
case 94:
|
|
601
|
-
return
|
|
538
|
+
return _context2.abrupt("return", id);
|
|
602
539
|
case 97:
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
console.log(
|
|
540
|
+
_context2.prev = 97;
|
|
541
|
+
_context2.t4 = _context2["catch"](14);
|
|
542
|
+
console.log(_context2.t4);
|
|
606
543
|
case 100:
|
|
607
|
-
return
|
|
544
|
+
return _context2.abrupt("return", null);
|
|
608
545
|
case 101:
|
|
609
546
|
case "end":
|
|
610
|
-
return
|
|
547
|
+
return _context2.stop();
|
|
611
548
|
}
|
|
612
|
-
},
|
|
549
|
+
}, _callee2, null, [[14, 97], [27, 38, 41, 44], [45, 56, 59, 62], [63, 88, 91, 94], [68, 78, 81, 84]]);
|
|
613
550
|
}));
|
|
614
|
-
return function assign(
|
|
615
|
-
return
|
|
551
|
+
return function assign(_x) {
|
|
552
|
+
return _ref5.apply(this, arguments);
|
|
616
553
|
};
|
|
617
554
|
}();
|
|
618
555
|
var message = /*#__PURE__*/function () {
|
|
619
|
-
var
|
|
556
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
|
|
620
557
|
var _opt$tags4;
|
|
621
|
-
var p, ex, _iterator6, _step6, v, _yield$ar$
|
|
622
|
-
return _regeneratorRuntime().wrap(function
|
|
623
|
-
while (1) switch (
|
|
558
|
+
var p, ex, _iterator6, _step6, v, _yield$ar$dataitem3, item, id, owner;
|
|
559
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
560
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
624
561
|
case 0:
|
|
625
562
|
p = mem.env[opt.process];
|
|
626
563
|
ex = false;
|
|
@@ -641,7 +578,7 @@ var connect = exports.connect = function connect(mem) {
|
|
|
641
578
|
Type: "Message",
|
|
642
579
|
SDK: "aoconnect"
|
|
643
580
|
}));
|
|
644
|
-
|
|
581
|
+
_context3.next = 7;
|
|
645
582
|
return ar.dataitem({
|
|
646
583
|
data: opt.data,
|
|
647
584
|
signer: opt.signer,
|
|
@@ -649,15 +586,15 @@ var connect = exports.connect = function connect(mem) {
|
|
|
649
586
|
target: opt.process
|
|
650
587
|
});
|
|
651
588
|
case 7:
|
|
652
|
-
_yield$ar$
|
|
653
|
-
item = _yield$ar$
|
|
654
|
-
id = _yield$ar$
|
|
655
|
-
owner = _yield$ar$
|
|
656
|
-
|
|
589
|
+
_yield$ar$dataitem3 = _context3.sent;
|
|
590
|
+
item = _yield$ar$dataitem3.item;
|
|
591
|
+
id = _yield$ar$dataitem3.id;
|
|
592
|
+
owner = _yield$ar$dataitem3.owner;
|
|
593
|
+
_context3.next = 13;
|
|
657
594
|
return ar.postItem(item, _test.su.jwk);
|
|
658
595
|
case 13:
|
|
659
596
|
mem.msgs[id] = opt;
|
|
660
|
-
|
|
597
|
+
_context3.next = 16;
|
|
661
598
|
return _assign({
|
|
662
599
|
message: id,
|
|
663
600
|
process: opt.process,
|
|
@@ -665,24 +602,24 @@ var connect = exports.connect = function connect(mem) {
|
|
|
665
602
|
signer: _test.mu.signer
|
|
666
603
|
});
|
|
667
604
|
case 16:
|
|
668
|
-
return
|
|
605
|
+
return _context3.abrupt("return", id);
|
|
669
606
|
case 17:
|
|
670
607
|
case "end":
|
|
671
|
-
return
|
|
608
|
+
return _context3.stop();
|
|
672
609
|
}
|
|
673
|
-
},
|
|
610
|
+
}, _callee3);
|
|
674
611
|
}));
|
|
675
|
-
return function message(
|
|
676
|
-
return
|
|
612
|
+
return function message(_x2) {
|
|
613
|
+
return _ref7.apply(this, arguments);
|
|
677
614
|
};
|
|
678
615
|
}();
|
|
679
616
|
return {
|
|
680
617
|
message: message,
|
|
681
618
|
unmonitor: function () {
|
|
682
|
-
var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
619
|
+
var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
|
|
683
620
|
var p;
|
|
684
|
-
return _regeneratorRuntime().wrap(function
|
|
685
|
-
while (1) switch (
|
|
621
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
622
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
686
623
|
case 0:
|
|
687
624
|
p = mem.env[opt.process];
|
|
688
625
|
try {
|
|
@@ -691,28 +628,28 @@ var connect = exports.connect = function connect(mem) {
|
|
|
691
628
|
} catch (e) {}
|
|
692
629
|
case 2:
|
|
693
630
|
case "end":
|
|
694
|
-
return
|
|
631
|
+
return _context4.stop();
|
|
695
632
|
}
|
|
696
|
-
},
|
|
633
|
+
}, _callee4);
|
|
697
634
|
}));
|
|
698
|
-
function unmonitor(
|
|
635
|
+
function unmonitor(_x3) {
|
|
699
636
|
return _unmonitor.apply(this, arguments);
|
|
700
637
|
}
|
|
701
638
|
return unmonitor;
|
|
702
639
|
}(),
|
|
703
640
|
monitor: function () {
|
|
704
|
-
var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
641
|
+
var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
|
|
705
642
|
var p;
|
|
706
|
-
return _regeneratorRuntime().wrap(function
|
|
707
|
-
while (1) switch (
|
|
643
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
644
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
708
645
|
case 0:
|
|
709
646
|
p = mem.env[opt.process];
|
|
710
647
|
if ((0, _ramda.isNil)(p.cron)) {
|
|
711
|
-
p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
712
|
-
return _regeneratorRuntime().wrap(function
|
|
713
|
-
while (1) switch (
|
|
648
|
+
p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
649
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
650
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
714
651
|
case 0:
|
|
715
|
-
|
|
652
|
+
_context5.next = 2;
|
|
716
653
|
return message({
|
|
717
654
|
tags: p.cronTags,
|
|
718
655
|
process: opt.process,
|
|
@@ -721,18 +658,18 @@ var connect = exports.connect = function connect(mem) {
|
|
|
721
658
|
});
|
|
722
659
|
case 2:
|
|
723
660
|
case "end":
|
|
724
|
-
return
|
|
661
|
+
return _context5.stop();
|
|
725
662
|
}
|
|
726
|
-
},
|
|
663
|
+
}, _callee5);
|
|
727
664
|
})), p.span);
|
|
728
665
|
}
|
|
729
666
|
case 2:
|
|
730
667
|
case "end":
|
|
731
|
-
return
|
|
668
|
+
return _context6.stop();
|
|
732
669
|
}
|
|
733
|
-
},
|
|
670
|
+
}, _callee6);
|
|
734
671
|
}));
|
|
735
|
-
function monitor(
|
|
672
|
+
function monitor(_x4) {
|
|
736
673
|
return _monitor.apply(this, arguments);
|
|
737
674
|
}
|
|
738
675
|
return monitor;
|
|
@@ -740,40 +677,40 @@ var connect = exports.connect = function connect(mem) {
|
|
|
740
677
|
spawn: spawn,
|
|
741
678
|
assign: _assign,
|
|
742
679
|
result: function () {
|
|
743
|
-
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
744
|
-
return _regeneratorRuntime().wrap(function
|
|
745
|
-
while (1) switch (
|
|
680
|
+
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
|
|
681
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
682
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
746
683
|
case 0:
|
|
747
|
-
return
|
|
684
|
+
return _context7.abrupt("return", mem.env[opt.process].res[opt.message]);
|
|
748
685
|
case 1:
|
|
749
686
|
case "end":
|
|
750
|
-
return
|
|
687
|
+
return _context7.stop();
|
|
751
688
|
}
|
|
752
|
-
},
|
|
689
|
+
}, _callee7);
|
|
753
690
|
}));
|
|
754
|
-
function result(
|
|
691
|
+
function result(_x5) {
|
|
755
692
|
return _result.apply(this, arguments);
|
|
756
693
|
}
|
|
757
694
|
return result;
|
|
758
695
|
}(),
|
|
759
696
|
results: function () {
|
|
760
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
697
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
|
|
761
698
|
var _opt$limit;
|
|
762
699
|
var p, results, limit, i, _i;
|
|
763
|
-
return _regeneratorRuntime().wrap(function
|
|
764
|
-
while (1) switch (
|
|
700
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
701
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
765
702
|
case 0:
|
|
766
703
|
p = mem.env[opt.process];
|
|
767
704
|
results = [];
|
|
768
705
|
limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
|
|
769
706
|
if (!(opt.sort === "DESC")) {
|
|
770
|
-
|
|
707
|
+
_context8.next = 14;
|
|
771
708
|
break;
|
|
772
709
|
}
|
|
773
710
|
i = p.results.length - 1;
|
|
774
711
|
case 5:
|
|
775
712
|
if (!(0 < i)) {
|
|
776
|
-
|
|
713
|
+
_context8.next = 12;
|
|
777
714
|
break;
|
|
778
715
|
}
|
|
779
716
|
results.push({
|
|
@@ -781,67 +718,67 @@ var connect = exports.connect = function connect(mem) {
|
|
|
781
718
|
node: p.res[p.results[i]]
|
|
782
719
|
});
|
|
783
720
|
if (!(results.length >= limit)) {
|
|
784
|
-
|
|
721
|
+
_context8.next = 9;
|
|
785
722
|
break;
|
|
786
723
|
}
|
|
787
|
-
return
|
|
724
|
+
return _context8.abrupt("break", 12);
|
|
788
725
|
case 9:
|
|
789
726
|
i--;
|
|
790
|
-
|
|
727
|
+
_context8.next = 5;
|
|
791
728
|
break;
|
|
792
729
|
case 12:
|
|
793
|
-
|
|
730
|
+
_context8.next = 22;
|
|
794
731
|
break;
|
|
795
732
|
case 14:
|
|
796
733
|
_i = 0;
|
|
797
734
|
case 15:
|
|
798
735
|
if (!(_i < p.results.length)) {
|
|
799
|
-
|
|
736
|
+
_context8.next = 22;
|
|
800
737
|
break;
|
|
801
738
|
}
|
|
802
739
|
results.push({
|
|
803
740
|
node: p.res[p.results[_i]]
|
|
804
741
|
});
|
|
805
742
|
if (!(results.length >= limit)) {
|
|
806
|
-
|
|
743
|
+
_context8.next = 19;
|
|
807
744
|
break;
|
|
808
745
|
}
|
|
809
|
-
return
|
|
746
|
+
return _context8.abrupt("break", 22);
|
|
810
747
|
case 19:
|
|
811
748
|
_i++;
|
|
812
|
-
|
|
749
|
+
_context8.next = 15;
|
|
813
750
|
break;
|
|
814
751
|
case 22:
|
|
815
|
-
return
|
|
752
|
+
return _context8.abrupt("return", {
|
|
816
753
|
edges: results
|
|
817
754
|
});
|
|
818
755
|
case 23:
|
|
819
756
|
case "end":
|
|
820
|
-
return
|
|
757
|
+
return _context8.stop();
|
|
821
758
|
}
|
|
822
|
-
},
|
|
759
|
+
}, _callee8);
|
|
823
760
|
}));
|
|
824
|
-
function results(
|
|
761
|
+
function results(_x6) {
|
|
825
762
|
return _results.apply(this, arguments);
|
|
826
763
|
}
|
|
827
764
|
return results;
|
|
828
765
|
}(),
|
|
829
766
|
dryrun: function () {
|
|
830
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
831
|
-
var p, _yield$ar$
|
|
832
|
-
return _regeneratorRuntime().wrap(function
|
|
833
|
-
while (1) switch (
|
|
767
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
|
|
768
|
+
var p, _yield$ar$dataitem4, id, owner, _opt$data3, msg, _env, res;
|
|
769
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
770
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
834
771
|
case 0:
|
|
835
772
|
p = mem.env[opt.process];
|
|
836
|
-
|
|
773
|
+
_context9.next = 3;
|
|
837
774
|
return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
|
|
838
775
|
target: opt.process
|
|
839
776
|
}));
|
|
840
777
|
case 3:
|
|
841
|
-
_yield$ar$
|
|
842
|
-
id = _yield$ar$
|
|
843
|
-
owner = _yield$ar$
|
|
844
|
-
|
|
778
|
+
_yield$ar$dataitem4 = _context9.sent;
|
|
779
|
+
id = _yield$ar$dataitem4.id;
|
|
780
|
+
owner = _yield$ar$dataitem4.owner;
|
|
781
|
+
_context9.prev = 6;
|
|
845
782
|
msg = genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
|
|
846
783
|
_env = genEnv({
|
|
847
784
|
pid: p.id,
|
|
@@ -849,24 +786,24 @@ var connect = exports.connect = function connect(mem) {
|
|
|
849
786
|
module: p.module,
|
|
850
787
|
auth: _test.mu.addr
|
|
851
788
|
});
|
|
852
|
-
|
|
789
|
+
_context9.next = 11;
|
|
853
790
|
return p.handle(p.memory, msg, _env);
|
|
854
791
|
case 11:
|
|
855
|
-
res =
|
|
856
|
-
return
|
|
792
|
+
res = _context9.sent;
|
|
793
|
+
return _context9.abrupt("return", res);
|
|
857
794
|
case 15:
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
console.log(
|
|
795
|
+
_context9.prev = 15;
|
|
796
|
+
_context9.t0 = _context9["catch"](6);
|
|
797
|
+
console.log(_context9.t0);
|
|
861
798
|
case 18:
|
|
862
|
-
return
|
|
799
|
+
return _context9.abrupt("return", null);
|
|
863
800
|
case 19:
|
|
864
801
|
case "end":
|
|
865
|
-
return
|
|
802
|
+
return _context9.stop();
|
|
866
803
|
}
|
|
867
|
-
},
|
|
804
|
+
}, _callee9, null, [[6, 15]]);
|
|
868
805
|
}));
|
|
869
|
-
function dryrun(
|
|
806
|
+
function dryrun(_x7) {
|
|
870
807
|
return _dryrun.apply(this, arguments);
|
|
871
808
|
}
|
|
872
809
|
return dryrun;
|
package/cjs/tao.js
CHANGED
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _ao = _interopRequireDefault(require("./ao.js"));
|
|
9
|
+
var _aoconnect = require("@permaweb/aoconnect");
|
|
9
10
|
var _utils = require("./utils.js");
|
|
10
11
|
var _tar = _interopRequireDefault(require("./tar.js"));
|
|
11
|
-
var
|
|
12
|
+
var _aoconnect2 = require("./aoconnect.js");
|
|
12
13
|
var _test = require("./test.js");
|
|
14
|
+
var _ramda = require("ramda");
|
|
13
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
16
|
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; }
|
|
15
17
|
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,7 +40,7 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
38
40
|
in_memory: true
|
|
39
41
|
})]);
|
|
40
42
|
_this.in_memory = true;
|
|
41
|
-
var _connect = (0,
|
|
43
|
+
var _connect = (0, _aoconnect2.connect)(opt.mem),
|
|
42
44
|
modules = _connect.modules,
|
|
43
45
|
results = _connect.results,
|
|
44
46
|
assign = _connect.assign,
|
|
@@ -58,6 +60,7 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
58
60
|
_this.dryrun = dryrun;
|
|
59
61
|
_this.monitor = monitor;
|
|
60
62
|
_this.unmonitor = unmonitor;
|
|
63
|
+
_this.mem = mem;
|
|
61
64
|
_this.ar = new _tar["default"]({
|
|
62
65
|
mem: mem
|
|
63
66
|
});
|
|
@@ -87,6 +90,77 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
87
90
|
}
|
|
88
91
|
return init;
|
|
89
92
|
}()
|
|
93
|
+
}, {
|
|
94
|
+
key: "postModule",
|
|
95
|
+
value: function () {
|
|
96
|
+
var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
97
|
+
var data, _ref$tags, tags, jwk, err, _yield$this$ar$checkW, t, _tags, signer, _yield$this$ar$datait, id, owner;
|
|
98
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
99
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
data = _ref.data, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? {} : _ref$tags, jwk = _ref.jwk;
|
|
102
|
+
err = null;
|
|
103
|
+
_context2.next = 4;
|
|
104
|
+
return this.ar.checkWallet({
|
|
105
|
+
jwk: jwk
|
|
106
|
+
});
|
|
107
|
+
case 4:
|
|
108
|
+
_yield$this$ar$checkW = _context2.sent;
|
|
109
|
+
jwk = _yield$this$ar$checkW.jwk;
|
|
110
|
+
err = _yield$this$ar$checkW.err;
|
|
111
|
+
if (!err) {
|
|
112
|
+
_context2.next = 9;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return _context2.abrupt("return", {
|
|
116
|
+
err: err
|
|
117
|
+
});
|
|
118
|
+
case 9:
|
|
119
|
+
t = (0, _ramda.mergeLeft)(tags, {
|
|
120
|
+
"Data-Protocol": "ao",
|
|
121
|
+
Variant: "ao.TN.1",
|
|
122
|
+
Type: "Module",
|
|
123
|
+
"Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
124
|
+
"Input-Encoding": "JSON-V1",
|
|
125
|
+
"Output-Encoding": "JSON-V1",
|
|
126
|
+
"Memory-Limit": "1-gb",
|
|
127
|
+
"Compute-Limit": "9000000000000"
|
|
128
|
+
});
|
|
129
|
+
_tags = (0, _utils.buildTags)(null, t);
|
|
130
|
+
signer = (0, _aoconnect.createDataItemSigner)(jwk);
|
|
131
|
+
_context2.next = 14;
|
|
132
|
+
return this.ar.dataitem({
|
|
133
|
+
tags: _tags,
|
|
134
|
+
data: data,
|
|
135
|
+
signer: signer
|
|
136
|
+
});
|
|
137
|
+
case 14:
|
|
138
|
+
_yield$this$ar$datait = _context2.sent;
|
|
139
|
+
id = _yield$this$ar$datait.id;
|
|
140
|
+
owner = _yield$this$ar$datait.owner;
|
|
141
|
+
_context2.next = 19;
|
|
142
|
+
return this.ar.post({
|
|
143
|
+
data: data,
|
|
144
|
+
tags: t,
|
|
145
|
+
jwk: jwk
|
|
146
|
+
});
|
|
147
|
+
case 19:
|
|
148
|
+
this.mem.wasms[id] = {
|
|
149
|
+
data: data,
|
|
150
|
+
format: t["Module-Format"]
|
|
151
|
+
};
|
|
152
|
+
return _context2.abrupt("return", id);
|
|
153
|
+
case 21:
|
|
154
|
+
case "end":
|
|
155
|
+
return _context2.stop();
|
|
156
|
+
}
|
|
157
|
+
}, _callee2, this);
|
|
158
|
+
}));
|
|
159
|
+
function postModule(_x2) {
|
|
160
|
+
return _postModule.apply(this, arguments);
|
|
161
|
+
}
|
|
162
|
+
return postModule;
|
|
163
|
+
}()
|
|
90
164
|
}]);
|
|
91
165
|
}(_ao["default"]);
|
|
92
166
|
var _default = exports["default"] = AO;
|
package/esm/aoconnect.js
CHANGED
|
@@ -83,45 +83,21 @@ export const connect = mem => {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const postModule = async ({ data, tags = {}, signer }) => {
|
|
87
|
-
const t = mergeLeft(tags, {
|
|
88
|
-
"Data-Protocol": "ao",
|
|
89
|
-
Variant: "ao.TN.1",
|
|
90
|
-
Type: "Module",
|
|
91
|
-
"Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
92
|
-
"Input-Encoding": "JSON-V1",
|
|
93
|
-
"Output-Encoding": "JSON-V1",
|
|
94
|
-
"Memory-Limit": "1-gb",
|
|
95
|
-
"Compute-Limit": "9000000000000",
|
|
96
|
-
})
|
|
97
|
-
const _tags = buildTags(null, t)
|
|
98
|
-
const { id, owner } = await ar.dataitem({ tags: _tags, data, signer })
|
|
99
|
-
await ar.post({ data, signer, tags: t })
|
|
100
|
-
const handle = await AoLoader(data, {
|
|
101
|
-
format: t["Module-Format"],
|
|
102
|
-
mode: "test",
|
|
103
|
-
WeaveDrive,
|
|
104
|
-
})
|
|
105
|
-
mem.modmap[id] = { handle, id }
|
|
106
|
-
return id
|
|
107
|
-
}
|
|
108
|
-
|
|
109
86
|
const spawn = async (opt = {}) => {
|
|
110
87
|
if (!opt.module) throw Error("module missing")
|
|
111
88
|
if (!opt.scheduler) throw Error("scheduler missing")
|
|
112
89
|
let mod = opt.module ?? mem.modules["aos2_0_1"]
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
90
|
+
let _module = null
|
|
91
|
+
const __dirname = await dirname()
|
|
92
|
+
const wasm =
|
|
93
|
+
mem.wasms[mod].data ??
|
|
94
|
+
readFileSync(resolve(__dirname, `lua/${mem.wasms[mod].file}.wasm`))
|
|
95
|
+
const handle = await AoLoader(wasm, {
|
|
96
|
+
format: mem.wasms[mod].format,
|
|
97
|
+
mode: "test",
|
|
98
|
+
WeaveDrive,
|
|
99
|
+
})
|
|
100
|
+
_module = { handle, id: mod }
|
|
125
101
|
if (!mod) throw Error("module not found")
|
|
126
102
|
opt.tags = buildTags(
|
|
127
103
|
null,
|
|
@@ -135,7 +111,6 @@ export const connect = mem => {
|
|
|
135
111
|
"Content-Type": "text/plain",
|
|
136
112
|
}),
|
|
137
113
|
)
|
|
138
|
-
const _module = mem.modmap[mod]
|
|
139
114
|
let ex = false
|
|
140
115
|
opt.tags ??= []
|
|
141
116
|
for (let v of opt.tags) if (v.name === "Type") ex = true
|
|
@@ -253,7 +228,7 @@ export const connect = mem => {
|
|
|
253
228
|
"Hash-Chain": hash,
|
|
254
229
|
}),
|
|
255
230
|
)
|
|
256
|
-
p.epochs.push([opt.
|
|
231
|
+
p.epochs.push([opt.message])
|
|
257
232
|
const { id, owner, item } = await ar.dataitem({
|
|
258
233
|
data: opt.data,
|
|
259
234
|
signer: opt.signer,
|
package/esm/tao.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import MAO from "./ao.js"
|
|
2
|
-
import {
|
|
2
|
+
import { createDataItemSigner } from "@permaweb/aoconnect"
|
|
3
|
+
import { srcs, buildTags } from "./utils.js"
|
|
3
4
|
import AR from "./tar.js"
|
|
4
5
|
import { connect } from "./aoconnect.js"
|
|
5
6
|
import { acc } from "./test.js"
|
|
7
|
+
import { mergeLeft } from "ramda"
|
|
8
|
+
|
|
6
9
|
class AO extends MAO {
|
|
7
10
|
constructor(opt = {}) {
|
|
8
11
|
super({ ...opt, in_memory: true })
|
|
@@ -28,6 +31,7 @@ class AO extends MAO {
|
|
|
28
31
|
this.dryrun = dryrun
|
|
29
32
|
this.monitor = monitor
|
|
30
33
|
this.unmonitor = unmonitor
|
|
34
|
+
this.mem = mem
|
|
31
35
|
this.ar = new AR({ mem })
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -36,6 +40,29 @@ class AO extends MAO {
|
|
|
36
40
|
await this.ar.init(jwk)
|
|
37
41
|
return this
|
|
38
42
|
}
|
|
43
|
+
|
|
44
|
+
async postModule({ data, tags = {}, jwk }) {
|
|
45
|
+
let err = null
|
|
46
|
+
;({ jwk, err } = await this.ar.checkWallet({ jwk }))
|
|
47
|
+
if (err) return { err }
|
|
48
|
+
const t = mergeLeft(tags, {
|
|
49
|
+
"Data-Protocol": "ao",
|
|
50
|
+
Variant: "ao.TN.1",
|
|
51
|
+
Type: "Module",
|
|
52
|
+
"Module-Format": "wasm64-unknown-emscripten-draft_2024_02_15",
|
|
53
|
+
"Input-Encoding": "JSON-V1",
|
|
54
|
+
"Output-Encoding": "JSON-V1",
|
|
55
|
+
"Memory-Limit": "1-gb",
|
|
56
|
+
"Compute-Limit": "9000000000000",
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const _tags = buildTags(null, t)
|
|
60
|
+
const signer = createDataItemSigner(jwk)
|
|
61
|
+
const { id, owner } = await this.ar.dataitem({ tags: _tags, data, signer })
|
|
62
|
+
await this.ar.post({ data, tags: t, jwk })
|
|
63
|
+
this.mem.wasms[id] = { data, format: t["Module-Format"] }
|
|
64
|
+
return id
|
|
65
|
+
}
|
|
39
66
|
}
|
|
40
67
|
|
|
41
68
|
export default AO
|