wao 0.4.7 → 0.4.9

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 CHANGED
@@ -9,6 +9,7 @@ var _ar2 = _interopRequireDefault(require("./ar.js"));
9
9
  var _aoconnect = require("@permaweb/aoconnect");
10
10
  var _ramda = require("ramda");
11
11
  var _utils = require("./utils.js");
12
+ var _WarpArBundles$defaul;
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
15
  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; }
@@ -27,7 +28,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
27
28
  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
29
  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
30
  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
- var pkg = WarpArBundles["default"] ? WarpArBundles["default"] : WarpArBundles;
31
+ var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
31
32
  var createData = pkg.createData,
32
33
  ArweaveSigner = pkg.ArweaveSigner;
33
34
  function createDataItemSigner2(wallet) {
package/cjs/aoconnect.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.connect = void 0;
8
- var _warpArbundles = require("warp-arbundles");
8
+ var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
9
9
  var _crypto = _interopRequireDefault(require("crypto"));
10
10
  var _base64url = _interopRequireDefault(require("base64url"));
11
11
  var _utils = require("./utils.js");
@@ -17,7 +17,10 @@ var _path = require("path");
17
17
  var _test = require("./test.js");
18
18
  var _ramda = require("ramda");
19
19
  var _tar = _interopRequireDefault(require("./tar.js"));
20
+ var _WarpArBundles$defaul;
20
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
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; }
21
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; }
22
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; }
23
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; }
@@ -33,6 +36,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
33
36
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
34
37
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35
38
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
39
+ var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
40
+ var DataItem = pkg.DataItem;
36
41
  var connect = exports.connect = function connect(mem) {
37
42
  var _mem;
38
43
  (_mem = mem) !== null && _mem !== void 0 ? _mem : mem = new _armem["default"]();
package/cjs/ar.js CHANGED
@@ -9,6 +9,7 @@ var _arbundles = require("arbundles");
9
9
  var _utils = require("./utils.js");
10
10
  var _ramda = require("ramda");
11
11
  var _gql = _interopRequireDefault(require("./gql.js"));
12
+ var _Arweave$default;
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
14
  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; }
14
15
  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; }
@@ -25,6 +26,7 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
25
26
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
26
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
27
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); }
29
+ var Arweave = (_Arweave$default = _arweave2["default"]["default"]) !== null && _Arweave$default !== void 0 ? _Arweave$default : _arweave2["default"];
28
30
  var AR = /*#__PURE__*/function () {
29
31
  function AR() {
30
32
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
@@ -45,7 +47,7 @@ var AR = /*#__PURE__*/function () {
45
47
  this.port = _arweave.port;
46
48
  this.host = _arweave.host;
47
49
  this.protocol = _arweave.protocol;
48
- this.arweave = _arweave2["default"].init(_arweave);
50
+ this.arweave = Arweave.init(_arweave);
49
51
  this.gql = new _gql["default"]({
50
52
  url: "".concat(_arweave.protocol, "://").concat(_arweave.host, ":").concat(_arweave.port, "/graphql")
51
53
  });
package/cjs/gql.js CHANGED
@@ -233,8 +233,9 @@ var query_blocks = function query_blocks() {
233
233
  return "query {\n blocks ".concat(_cond, "{\n edges { cursor node { ").concat(_fields, " } }\n }\n}");
234
234
  };
235
235
  var GQL = exports["default"] = /*#__PURE__*/function () {
236
- function GQL(_ref) {
237
- var _ref$url = _ref.url,
236
+ function GQL() {
237
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
238
+ _ref$url = _ref.url,
238
239
  url = _ref$url === void 0 ? "https://arweave.net/graphql" : _ref$url;
239
240
  _classCallCheck(this, GQL);
240
241
  this.url = url;
package/cjs/tao.js CHANGED
@@ -31,6 +31,31 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
31
31
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
32
32
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
33
33
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
34
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
35
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
36
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
37
+ var log = "\nlocal json = require(\"json\")\nao = ao or {}\n\nfunction ao.log(txt)\n if type(txt) == 'table' then\n txt = json.encode(txt)\n end\n if type(ao.outbox.Output) == 'string' then\n ao.outbox.Output = {ao.outbox.Output}\n end\n table.insert(ao.outbox.Output, txt)\n ao.outbox.Logs = ao.outbox.Logs or {}\n table.insert(ao.outbox.Logs, txt)\nend\n\nfunction ao.result(result)\n if ao.outbox.Error or result.Error then\n return { Error = result.Error or ao.outbox.Error, Output = ao.outbox.Logs }\n end\n return {\n Output = ao.outbox.Logs or result.Output or ao.outbox.Output,\n Messages = ao.outbox.Messages,\n Spawns = ao.outbox.Spawns,\n Assignments = ao.outbox.Assignments,\n }\nend\n";
38
+ var renderLogs = function renderLogs(logs) {
39
+ if ((0, _ramda.is)(Array, logs) && logs.length > 0) {
40
+ var _iterator = _createForOfIteratorHelper(logs),
41
+ _step;
42
+ try {
43
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
44
+ var v = _step.value;
45
+ var l = v;
46
+ try {
47
+ var p = JSON.parse(v);
48
+ if (JSON.stringify(p) === v) l = p;
49
+ } catch (e) {}
50
+ console.log(l);
51
+ }
52
+ } catch (err) {
53
+ _iterator.e(err);
54
+ } finally {
55
+ _iterator.f();
56
+ }
57
+ }
58
+ };
34
59
  var AO = /*#__PURE__*/function (_MAO) {
35
60
  function AO() {
36
61
  var _this;
@@ -53,11 +78,67 @@ var AO = /*#__PURE__*/function (_MAO) {
53
78
  mem = _connect.mem;
54
79
  _this.module = mem.modules.aos2_0_1;
55
80
  _this.assign = assign;
56
- _this.result = result;
81
+ _this.result = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
82
+ var res,
83
+ _args = arguments;
84
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
85
+ while (1) switch (_context.prev = _context.next) {
86
+ case 0:
87
+ _context.next = 2;
88
+ return result.apply(void 0, _args);
89
+ case 2:
90
+ res = _context.sent;
91
+ renderLogs(res.Output);
92
+ return _context.abrupt("return", res);
93
+ case 5:
94
+ case "end":
95
+ return _context.stop();
96
+ }
97
+ }, _callee);
98
+ }));
57
99
  _this.results = results;
58
100
  _this.message = message;
59
- _this.spawn = spawn;
60
- _this.dryrun = dryrun;
101
+ _this.spawn = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
102
+ var res,
103
+ _args2 = arguments;
104
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
105
+ while (1) switch (_context2.prev = _context2.next) {
106
+ case 0:
107
+ _context2.next = 2;
108
+ return spawn.apply(void 0, _args2);
109
+ case 2:
110
+ res = _context2.sent;
111
+ _context2.next = 5;
112
+ return _this.load({
113
+ data: log,
114
+ pid: res
115
+ });
116
+ case 5:
117
+ return _context2.abrupt("return", res);
118
+ case 6:
119
+ case "end":
120
+ return _context2.stop();
121
+ }
122
+ }, _callee2);
123
+ }));
124
+ _this.dryrun = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
125
+ var res,
126
+ _args3 = arguments;
127
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
128
+ while (1) switch (_context3.prev = _context3.next) {
129
+ case 0:
130
+ _context3.next = 2;
131
+ return dryrun.apply(void 0, _args3);
132
+ case 2:
133
+ res = _context3.sent;
134
+ renderLogs(res.Output);
135
+ return _context3.abrupt("return", res);
136
+ case 5:
137
+ case "end":
138
+ return _context3.stop();
139
+ }
140
+ }, _callee3);
141
+ }));
61
142
  _this.monitor = monitor;
62
143
  _this.unmonitor = unmonitor;
63
144
  _this.mem = mem;
@@ -70,20 +151,20 @@ var AO = /*#__PURE__*/function (_MAO) {
70
151
  return _createClass(AO, [{
71
152
  key: "init",
72
153
  value: function () {
73
- var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(jwk) {
74
- return _regeneratorRuntime().wrap(function _callee$(_context) {
75
- while (1) switch (_context.prev = _context.next) {
154
+ var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(jwk) {
155
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
156
+ while (1) switch (_context4.prev = _context4.next) {
76
157
  case 0:
77
158
  if (!jwk && this.acc[0]) jwk = this.acc[0].jwk;
78
- _context.next = 3;
159
+ _context4.next = 3;
79
160
  return this.ar.init(jwk);
80
161
  case 3:
81
- return _context.abrupt("return", this);
162
+ return _context4.abrupt("return", this);
82
163
  case 4:
83
164
  case "end":
84
- return _context.stop();
165
+ return _context4.stop();
85
166
  }
86
- }, _callee, this);
167
+ }, _callee4, this);
87
168
  }));
88
169
  function init(_x) {
89
170
  return _init.apply(this, arguments);
@@ -93,26 +174,26 @@ var AO = /*#__PURE__*/function (_MAO) {
93
174
  }, {
94
175
  key: "postModule",
95
176
  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) {
177
+ var _postModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref4) {
178
+ var data, _ref4$tags, tags, jwk, err, _yield$this$ar$checkW, t, _tags, signer, _yield$this$ar$datait, id, owner;
179
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
180
+ while (1) switch (_context5.prev = _context5.next) {
100
181
  case 0:
101
- data = _ref.data, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? {} : _ref$tags, jwk = _ref.jwk;
182
+ data = _ref4.data, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, jwk = _ref4.jwk;
102
183
  err = null;
103
- _context2.next = 4;
184
+ _context5.next = 4;
104
185
  return this.ar.checkWallet({
105
186
  jwk: jwk
106
187
  });
107
188
  case 4:
108
- _yield$this$ar$checkW = _context2.sent;
189
+ _yield$this$ar$checkW = _context5.sent;
109
190
  jwk = _yield$this$ar$checkW.jwk;
110
191
  err = _yield$this$ar$checkW.err;
111
192
  if (!err) {
112
- _context2.next = 9;
193
+ _context5.next = 9;
113
194
  break;
114
195
  }
115
- return _context2.abrupt("return", {
196
+ return _context5.abrupt("return", {
116
197
  err: err
117
198
  });
118
199
  case 9:
@@ -128,17 +209,17 @@ var AO = /*#__PURE__*/function (_MAO) {
128
209
  });
129
210
  _tags = (0, _utils.buildTags)(null, t);
130
211
  signer = (0, _aoconnect.createDataItemSigner)(jwk);
131
- _context2.next = 14;
212
+ _context5.next = 14;
132
213
  return this.ar.dataitem({
133
214
  tags: _tags,
134
215
  data: data,
135
216
  signer: signer
136
217
  });
137
218
  case 14:
138
- _yield$this$ar$datait = _context2.sent;
219
+ _yield$this$ar$datait = _context5.sent;
139
220
  id = _yield$this$ar$datait.id;
140
221
  owner = _yield$this$ar$datait.owner;
141
- _context2.next = 19;
222
+ _context5.next = 19;
142
223
  return this.ar.post({
143
224
  data: data,
144
225
  tags: t,
@@ -149,12 +230,12 @@ var AO = /*#__PURE__*/function (_MAO) {
149
230
  data: data,
150
231
  format: t["Module-Format"]
151
232
  };
152
- return _context2.abrupt("return", id);
233
+ return _context5.abrupt("return", id);
153
234
  case 21:
154
235
  case "end":
155
- return _context2.stop();
236
+ return _context5.stop();
156
237
  }
157
- }, _callee2, this);
238
+ }, _callee5, this);
158
239
  }));
159
240
  function postModule(_x2) {
160
241
  return _postModule.apply(this, arguments);
package/cjs/tar.js CHANGED
@@ -7,11 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = void 0;
8
8
  var _ar = _interopRequireDefault(require("./ar.js"));
9
9
  var _utils = require("./utils.js");
10
- var _warpArbundles = require("warp-arbundles");
10
+ var WarpArBundles = _interopRequireWildcard(require("warp-arbundles"));
11
11
  var _base64url = _interopRequireDefault(require("base64url"));
12
12
  var _armem = _interopRequireDefault(require("./armem.js"));
13
13
  var _tgql = _interopRequireDefault(require("./tgql.js"));
14
14
  var _ramda = require("ramda");
15
+ var _WarpArBundles$defaul;
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
+ 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; }
15
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
16
19
  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; } } }; }
17
20
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -34,6 +37,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
34
37
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
35
38
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
36
39
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
40
+ var pkg = (_WarpArBundles$defaul = WarpArBundles["default"]) !== null && _WarpArBundles$defaul !== void 0 ? _WarpArBundles$defaul : WarpArBundles;
41
+ var DataItem = pkg.DataItem;
37
42
  var AR = /*#__PURE__*/function (_MAR) {
38
43
  function AR() {
39
44
  var _opt$mem;
@@ -70,7 +75,7 @@ var AR = /*#__PURE__*/function (_MAR) {
70
75
  });
71
76
  case 4:
72
77
  item = _context.sent;
73
- di = new _warpArbundles.DataItem(item.raw);
78
+ di = new DataItem(item.raw);
74
79
  raw_owner = di.rawOwner;
75
80
  _context.t0 = Buffer;
76
81
  _context.next = 10;
@@ -163,7 +168,7 @@ var AR = /*#__PURE__*/function (_MAR) {
163
168
  tx = _context3.sent;
164
169
  tx.addTag("Bundle-Format", "binary");
165
170
  tx.addTag("Bundle-Version", "2.0.0");
166
- di = new _warpArbundles.DataItem(item.raw);
171
+ di = new DataItem(item.raw);
167
172
  data_size = Buffer.byteLength(di.rawData).toString();
168
173
  data_type = "";
169
174
  _iterator2 = _createForOfIteratorHelper(di.tags);
package/esm/ao.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as WarpArBundles from "warp-arbundles"
2
- const pkg = WarpArBundles.default ? WarpArBundles.default : WarpArBundles
2
+ const pkg = WarpArBundles.default ?? WarpArBundles
3
3
  const { createData, ArweaveSigner } = pkg
4
4
  import AR from "./ar.js"
5
5
 
package/esm/aoconnect.js CHANGED
@@ -1,4 +1,7 @@
1
- import { DataItem } from "warp-arbundles"
1
+ import * as WarpArBundles from "warp-arbundles"
2
+ const pkg = WarpArBundles.default ?? WarpArBundles
3
+ const { DataItem } = pkg
4
+
2
5
  import crypto from "crypto"
3
6
  import base64url from "base64url"
4
7
 
package/esm/ar.js CHANGED
@@ -1,4 +1,5 @@
1
- import Arweave from "arweave"
1
+ import _Arweave from "arweave"
2
+ const Arweave = _Arweave.default ?? _Arweave
2
3
  import { ArweaveSigner, bundleAndSignData, createData } from "arbundles"
3
4
  import { buildTags, tag, isLocalhost } from "./utils.js"
4
5
  import { is } from "ramda"
package/esm/gql.js CHANGED
@@ -182,7 +182,7 @@ const query_blocks = (opt = {}) => {
182
182
  }
183
183
 
184
184
  export default class GQL {
185
- constructor({ url = "https://arweave.net/graphql" }) {
185
+ constructor({ url = "https://arweave.net/graphql" } = {}) {
186
186
  this.url = url
187
187
  }
188
188
  async _fetch(query, tar) {
package/esm/tao.js CHANGED
@@ -4,8 +4,49 @@ import { srcs, buildTags } from "./utils.js"
4
4
  import AR from "./tar.js"
5
5
  import { connect } from "./aoconnect.js"
6
6
  import { acc } from "./test.js"
7
- import { mergeLeft } from "ramda"
7
+ import { mergeLeft, is, map } from "ramda"
8
8
 
9
+ let log = `
10
+ local json = require("json")
11
+ ao = ao or {}
12
+
13
+ function ao.log(txt)
14
+ if type(txt) == 'table' then
15
+ txt = json.encode(txt)
16
+ end
17
+ if type(ao.outbox.Output) == 'string' then
18
+ ao.outbox.Output = {ao.outbox.Output}
19
+ end
20
+ table.insert(ao.outbox.Output, txt)
21
+ ao.outbox.Logs = ao.outbox.Logs or {}
22
+ table.insert(ao.outbox.Logs, txt)
23
+ end
24
+
25
+ function ao.result(result)
26
+ if ao.outbox.Error or result.Error then
27
+ return { Error = result.Error or ao.outbox.Error, Output = ao.outbox.Logs }
28
+ end
29
+ return {
30
+ Output = ao.outbox.Logs or result.Output or ao.outbox.Output,
31
+ Messages = ao.outbox.Messages,
32
+ Spawns = ao.outbox.Spawns,
33
+ Assignments = ao.outbox.Assignments,
34
+ }
35
+ end
36
+ `
37
+
38
+ const renderLogs = logs => {
39
+ if (is(Array, logs) && logs.length > 0) {
40
+ for (const v of logs) {
41
+ let l = v
42
+ try {
43
+ const p = JSON.parse(v)
44
+ if (JSON.stringify(p) === v) l = p
45
+ } catch (e) {}
46
+ console.log(l)
47
+ }
48
+ }
49
+ }
9
50
  class AO extends MAO {
10
51
  constructor(opt = {}) {
11
52
  super({ ...opt, in_memory: true })
@@ -24,11 +65,24 @@ class AO extends MAO {
24
65
  } = connect(opt.mem)
25
66
  this.module = mem.modules.aos2_0_1
26
67
  this.assign = assign
27
- this.result = result
68
+ this.result = async (...opt) => {
69
+ const res = await result(...opt)
70
+ renderLogs(res.Output)
71
+ return res
72
+ }
73
+
28
74
  this.results = results
29
75
  this.message = message
30
- this.spawn = spawn
31
- this.dryrun = dryrun
76
+ this.spawn = async (...opt) => {
77
+ const res = await spawn(...opt)
78
+ await this.load({ data: log, pid: res })
79
+ return res
80
+ }
81
+ this.dryrun = async (...opt) => {
82
+ const res = await dryrun(...opt)
83
+ renderLogs(res.Output)
84
+ return res
85
+ }
32
86
  this.monitor = monitor
33
87
  this.unmonitor = unmonitor
34
88
  this.mem = mem
package/esm/tar.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import MAR from "./ar.js"
2
2
  import { buildTags } from "./utils.js"
3
- import { DataItem } from "warp-arbundles"
3
+ import * as WarpArBundles from "warp-arbundles"
4
+ const pkg = WarpArBundles.default ?? WarpArBundles
5
+ const { DataItem } = pkg
6
+
4
7
  import base64url from "base64url"
5
8
  import ArMem from "./armem.js"
6
9
  import GQL from "./tgql.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",