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