wao 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ao.js +23 -13
- package/cjs/aoconnect.js +554 -346
- package/cjs/ar.js +63 -60
- package/cjs/helpers.js +6 -27
- package/cjs/tao.js +5 -1
- package/cjs/test.js +32 -0
- package/esm/ao.js +22 -4
- package/esm/aoconnect.js +196 -101
- package/esm/ar.js +2 -0
- package/esm/helpers.js +1 -4
- package/esm/tao.js +5 -1
- package/esm/test.js +3 -0
- package/package.json +1 -1
package/cjs/aoconnect.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.connect = void 0;
|
|
6
|
+
exports.mu = exports.connect = exports.acc = void 0;
|
|
7
7
|
var _warpArbundles = require("warp-arbundles");
|
|
8
8
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
9
9
|
var _aoLoader = _interopRequireDefault(require("@permaweb/ao-loader"));
|
|
@@ -11,19 +11,20 @@ var _fs = require("fs");
|
|
|
11
11
|
var _path = require("path");
|
|
12
12
|
var _ramda = require("ramda");
|
|
13
13
|
var _accounts = _interopRequireDefault(require("./accounts.js"));
|
|
14
|
+
var _utils = require("./utils.js");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
16
|
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; }
|
|
16
17
|
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; }
|
|
17
18
|
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; }
|
|
18
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
20
|
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); }
|
|
21
|
+
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; } } }; }
|
|
20
22
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
23
|
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."); }
|
|
22
|
-
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; } }
|
|
23
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
24
|
-
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; } } }; }
|
|
25
24
|
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; } }
|
|
26
25
|
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 _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; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
28
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
28
29
|
function _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); }
|
|
29
30
|
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; }
|
|
@@ -78,41 +79,10 @@ var dirname = /*#__PURE__*/function () {
|
|
|
78
79
|
return _ref.apply(this, arguments);
|
|
79
80
|
};
|
|
80
81
|
}();
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
var action = function action(value) {
|
|
87
|
-
return tag("Action", value);
|
|
88
|
-
};
|
|
89
|
-
var tag = function tag(name, value) {
|
|
90
|
-
return {
|
|
91
|
-
name: name,
|
|
92
|
-
value: jsonToStr(value)
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
var buildTags = function buildTags(act, tags) {
|
|
96
|
-
var _tags = [];
|
|
97
|
-
if (act) _tags.push(action(act));
|
|
98
|
-
for (var k in tags) {
|
|
99
|
-
if ((0, _ramda.is)(Array)(tags[k])) {
|
|
100
|
-
var _iterator = _createForOfIteratorHelper(tags[k]),
|
|
101
|
-
_step;
|
|
102
|
-
try {
|
|
103
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
104
|
-
var v = _step.value;
|
|
105
|
-
_tags.push(tag(k, v));
|
|
106
|
-
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
_iterator.e(err);
|
|
109
|
-
} finally {
|
|
110
|
-
_iterator.f();
|
|
111
|
-
}
|
|
112
|
-
} else _tags.push(tag(k, tags[k]));
|
|
113
|
-
}
|
|
114
|
-
return _tags;
|
|
115
|
-
};
|
|
82
|
+
var acc = exports.acc = _accounts["default"].users;
|
|
83
|
+
var mu = exports.mu = _accounts["default"].mu;
|
|
84
|
+
var scheduler = "GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
|
|
85
|
+
var env = {};
|
|
116
86
|
var connect = exports.connect = function connect() {
|
|
117
87
|
var wasms = {
|
|
118
88
|
"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM": {
|
|
@@ -129,15 +99,12 @@ var connect = exports.connect = function connect() {
|
|
|
129
99
|
}
|
|
130
100
|
};
|
|
131
101
|
var modules = {
|
|
132
|
-
|
|
133
|
-
|
|
102
|
+
aos2_0_1: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
|
|
103
|
+
aos1: "cNlipBptaF9JeFAf4wUmpi43EojNanIBos3EfNrEOWo",
|
|
134
104
|
sqlite: "ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw"
|
|
135
105
|
};
|
|
136
106
|
var modmap = {};
|
|
137
|
-
var
|
|
138
|
-
msgs: {}
|
|
139
|
-
};
|
|
140
|
-
var mu = _accounts["default"].mu;
|
|
107
|
+
var msgs = {};
|
|
141
108
|
var transform = function transform(input) {
|
|
142
109
|
var _input$Tags;
|
|
143
110
|
var output = {
|
|
@@ -277,7 +244,7 @@ var connect = exports.connect = function connect() {
|
|
|
277
244
|
"Memory-Limit": "1-gb",
|
|
278
245
|
"Compute-Limit": "9000000000000"
|
|
279
246
|
});
|
|
280
|
-
_tags = buildTags(t);
|
|
247
|
+
_tags = (0, _utils.buildTags)(t);
|
|
281
248
|
_context3.next = 5;
|
|
282
249
|
return parse({
|
|
283
250
|
tags: _tags,
|
|
@@ -309,47 +276,333 @@ var connect = exports.connect = function connect() {
|
|
|
309
276
|
return _ref7.apply(this, arguments);
|
|
310
277
|
};
|
|
311
278
|
}();
|
|
312
|
-
var
|
|
313
|
-
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(
|
|
314
|
-
var
|
|
279
|
+
var spawn = /*#__PURE__*/function () {
|
|
280
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
281
|
+
var _opt$module, _opt$tags;
|
|
282
|
+
var opt,
|
|
283
|
+
mod,
|
|
284
|
+
_dirname,
|
|
285
|
+
wasm,
|
|
286
|
+
handle,
|
|
287
|
+
_module,
|
|
288
|
+
ex,
|
|
289
|
+
_iterator,
|
|
290
|
+
_step,
|
|
291
|
+
v,
|
|
292
|
+
_yield$parse2,
|
|
293
|
+
id,
|
|
294
|
+
owner,
|
|
295
|
+
_tags,
|
|
296
|
+
res,
|
|
297
|
+
memory,
|
|
298
|
+
p,
|
|
299
|
+
_opt$data2,
|
|
300
|
+
_msgs$_tags$OnBoot$d,
|
|
301
|
+
_msgs$_tags$OnBoot,
|
|
302
|
+
data,
|
|
303
|
+
msg,
|
|
304
|
+
_env,
|
|
305
|
+
_t,
|
|
306
|
+
_tags$CronInterval$s,
|
|
307
|
+
_tags$CronInterval$s2,
|
|
308
|
+
num,
|
|
309
|
+
unit,
|
|
310
|
+
_int,
|
|
311
|
+
cronTags,
|
|
312
|
+
k,
|
|
313
|
+
_args4 = arguments;
|
|
315
314
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
316
315
|
while (1) switch (_context4.prev = _context4.next) {
|
|
317
316
|
case 0:
|
|
318
|
-
|
|
317
|
+
opt = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
318
|
+
if (opt.module) {
|
|
319
|
+
_context4.next = 3;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
throw Error("module missing");
|
|
323
|
+
case 3:
|
|
324
|
+
if (opt.scheduler) {
|
|
325
|
+
_context4.next = 5;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
throw Error("scheduler missing");
|
|
329
|
+
case 5:
|
|
330
|
+
mod = (_opt$module = opt.module) !== null && _opt$module !== void 0 ? _opt$module : modules["aos2_0_1"];
|
|
331
|
+
if (!(!modmap[mod] && wasms[mod])) {
|
|
332
|
+
_context4.next = 15;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
_context4.next = 9;
|
|
336
|
+
return dirname();
|
|
337
|
+
case 9:
|
|
338
|
+
_dirname = _context4.sent;
|
|
339
|
+
wasm = (0, _fs.readFileSync)((0, _path.resolve)(_dirname, "lua/".concat(wasms[mod].file, ".wasm")));
|
|
340
|
+
_context4.next = 13;
|
|
341
|
+
return (0, _aoLoader["default"])(wasm, {
|
|
342
|
+
format: wasms[mod].format
|
|
343
|
+
});
|
|
344
|
+
case 13:
|
|
345
|
+
handle = _context4.sent;
|
|
346
|
+
modmap[mod] = {
|
|
347
|
+
handle: handle,
|
|
348
|
+
id: mod
|
|
349
|
+
};
|
|
350
|
+
case 15:
|
|
351
|
+
if (mod) {
|
|
352
|
+
_context4.next = 17;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
throw Error("module not found");
|
|
356
|
+
case 17:
|
|
357
|
+
_module = modmap[mod];
|
|
319
358
|
ex = false;
|
|
320
|
-
|
|
359
|
+
(_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
|
|
360
|
+
_iterator = _createForOfIteratorHelper(opt.tags);
|
|
321
361
|
try {
|
|
322
|
-
for (
|
|
323
|
-
|
|
324
|
-
if (
|
|
362
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
363
|
+
v = _step.value;
|
|
364
|
+
if (v.name === "Type") ex = true;
|
|
325
365
|
}
|
|
326
366
|
} catch (err) {
|
|
327
|
-
|
|
367
|
+
_iterator.e(err);
|
|
328
368
|
} finally {
|
|
329
|
-
|
|
369
|
+
_iterator.f();
|
|
330
370
|
}
|
|
331
371
|
if (!ex) opt.tags.push({
|
|
332
372
|
name: "Type",
|
|
333
|
-
value: "
|
|
373
|
+
value: "Process"
|
|
334
374
|
});
|
|
335
|
-
_context4.next =
|
|
375
|
+
_context4.next = 25;
|
|
336
376
|
return parse(opt);
|
|
337
|
-
case
|
|
377
|
+
case 25:
|
|
338
378
|
_yield$parse2 = _context4.sent;
|
|
339
379
|
id = _yield$parse2.id;
|
|
340
380
|
owner = _yield$parse2.owner;
|
|
341
|
-
|
|
342
|
-
|
|
381
|
+
_tags = (0, _utils.tags)(opt.tags);
|
|
382
|
+
res = null;
|
|
383
|
+
memory = null;
|
|
384
|
+
p = {
|
|
385
|
+
id: id,
|
|
386
|
+
handle: _module.handle,
|
|
387
|
+
module: _module.id,
|
|
388
|
+
memory: memory,
|
|
389
|
+
owner: owner,
|
|
390
|
+
height: 0,
|
|
391
|
+
res: _defineProperty({}, id, res),
|
|
392
|
+
results: [id],
|
|
393
|
+
txs: [],
|
|
394
|
+
opt: opt
|
|
395
|
+
};
|
|
396
|
+
if (!_tags["On-Boot"]) {
|
|
397
|
+
_context4.next = 46;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
data = "";
|
|
401
|
+
if (_tags["On-Boot"] === "Data") data = (_opt$data2 = opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "";else data = (_msgs$_tags$OnBoot$d = (_msgs$_tags$OnBoot = msgs[_tags["On-Boot"]]) === null || _msgs$_tags$OnBoot === void 0 ? void 0 : _msgs$_tags$OnBoot.data) !== null && _msgs$_tags$OnBoot$d !== void 0 ? _msgs$_tags$OnBoot$d : "";
|
|
402
|
+
msg = genMsg(p, data, opt.tags, owner, mu.addr, true);
|
|
403
|
+
_env = genEnv({
|
|
404
|
+
pid: p.id,
|
|
405
|
+
owner: p.owner,
|
|
406
|
+
module: p.module,
|
|
407
|
+
auth: mu.addr
|
|
408
|
+
});
|
|
409
|
+
_t = (0, _utils.tags)(msg.Tags);
|
|
410
|
+
_context4.next = 40;
|
|
411
|
+
return _module.handle(null, msg, _env);
|
|
412
|
+
case 40:
|
|
413
|
+
res = _context4.sent;
|
|
414
|
+
p.memory = res.Memory;
|
|
415
|
+
delete res.Memory;
|
|
416
|
+
p.res[id] = res;
|
|
417
|
+
_context4.next = 47;
|
|
418
|
+
break;
|
|
419
|
+
case 46:
|
|
420
|
+
p.height += 1;
|
|
421
|
+
case 47:
|
|
422
|
+
msgs[id] = opt;
|
|
423
|
+
env[id] = p;
|
|
424
|
+
if (!_tags["Cron-Interval"]) {
|
|
425
|
+
_context4.next = 73;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
_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];
|
|
429
|
+
_int = 0;
|
|
430
|
+
_context4.t0 = unit.replace(/s$/, "");
|
|
431
|
+
_context4.next = _context4.t0 === "millisecond" ? 55 : _context4.t0 === "second" ? 57 : _context4.t0 === "minute" ? 59 : _context4.t0 === "hour" ? 61 : _context4.t0 === "day" ? 63 : _context4.t0 === "month" ? 65 : _context4.t0 === "year" ? 67 : 69;
|
|
432
|
+
break;
|
|
433
|
+
case 55:
|
|
434
|
+
_int = num;
|
|
435
|
+
return _context4.abrupt("break", 69);
|
|
436
|
+
case 57:
|
|
437
|
+
_int = num * 1000;
|
|
438
|
+
return _context4.abrupt("break", 69);
|
|
439
|
+
case 59:
|
|
440
|
+
_int = num * 1000 * 60;
|
|
441
|
+
return _context4.abrupt("break", 69);
|
|
442
|
+
case 61:
|
|
443
|
+
_int = num * 1000 * 60 * 60;
|
|
444
|
+
return _context4.abrupt("break", 69);
|
|
445
|
+
case 63:
|
|
446
|
+
_int = num * 1000 * 60 * 60 * 24;
|
|
447
|
+
return _context4.abrupt("break", 69);
|
|
448
|
+
case 65:
|
|
449
|
+
_int = num * 1000 * 60 * 60 * 24 * 30;
|
|
450
|
+
return _context4.abrupt("break", 69);
|
|
451
|
+
case 67:
|
|
452
|
+
_int = num * 1000 * 60 * 60 * 24 * 365;
|
|
453
|
+
return _context4.abrupt("break", 69);
|
|
454
|
+
case 69:
|
|
455
|
+
cronTags = [];
|
|
456
|
+
for (k in _tags) {
|
|
457
|
+
if (/^Cron-Tag-/.test(k)) {
|
|
458
|
+
cronTags.push({
|
|
459
|
+
name: k.replace(/Cron-Tag-/, ""),
|
|
460
|
+
value: _tags[k]
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
env[id].cronTags = cronTags;
|
|
465
|
+
env[id].span = _int;
|
|
466
|
+
case 73:
|
|
467
|
+
return _context4.abrupt("return", id);
|
|
468
|
+
case 74:
|
|
469
|
+
case "end":
|
|
470
|
+
return _context4.stop();
|
|
471
|
+
}
|
|
472
|
+
}, _callee4);
|
|
473
|
+
}));
|
|
474
|
+
return function spawn() {
|
|
475
|
+
return _ref8.apply(this, arguments);
|
|
476
|
+
};
|
|
477
|
+
}();
|
|
478
|
+
var assign = /*#__PURE__*/function () {
|
|
479
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
|
|
480
|
+
var p, _opt, _yield$parse3, id, owner, _opt$data3, _opt$from, _res$Messages, msg, _env, res, _iterator2, _step2, v;
|
|
481
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
482
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
483
|
+
case 0:
|
|
484
|
+
p = env[opt.process];
|
|
485
|
+
_opt = (0, _ramda.clone)(msgs[opt.message]);
|
|
486
|
+
_context5.next = 4;
|
|
487
|
+
return parse(_opt);
|
|
488
|
+
case 4:
|
|
489
|
+
_yield$parse3 = _context5.sent;
|
|
490
|
+
id = _yield$parse3.id;
|
|
491
|
+
owner = _yield$parse3.owner;
|
|
492
|
+
_context5.prev = 7;
|
|
493
|
+
msg = genMsg(p, (_opt$data3 = _opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", _opt.tags, (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : owner, mu.addr);
|
|
494
|
+
_env = genEnv({
|
|
495
|
+
pid: p.id,
|
|
496
|
+
owner: p.owner,
|
|
497
|
+
module: p.module,
|
|
498
|
+
auth: mu.addr
|
|
499
|
+
});
|
|
500
|
+
_context5.next = 12;
|
|
501
|
+
return p.handle(p.memory, msg, _env);
|
|
502
|
+
case 12:
|
|
503
|
+
res = _context5.sent;
|
|
504
|
+
p.memory = res.Memory;
|
|
505
|
+
delete res.Memory;
|
|
506
|
+
p.res[id] = res;
|
|
507
|
+
p.results.push(id);
|
|
508
|
+
p.txs.unshift(_objectSpread({
|
|
509
|
+
id: id
|
|
510
|
+
}, _opt));
|
|
511
|
+
msgs[id] = _opt;
|
|
512
|
+
_iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
|
|
513
|
+
_context5.prev = 20;
|
|
514
|
+
_iterator2.s();
|
|
515
|
+
case 22:
|
|
516
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
517
|
+
_context5.next = 29;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
v = _step2.value;
|
|
521
|
+
if (!env[v.Target]) {
|
|
522
|
+
_context5.next = 27;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
_context5.next = 27;
|
|
526
|
+
return _message({
|
|
527
|
+
process: v.Target,
|
|
528
|
+
tags: v.Tags,
|
|
529
|
+
data: v.Data,
|
|
530
|
+
signer: mu.signer,
|
|
531
|
+
from: opt.process
|
|
532
|
+
});
|
|
533
|
+
case 27:
|
|
534
|
+
_context5.next = 22;
|
|
535
|
+
break;
|
|
536
|
+
case 29:
|
|
537
|
+
_context5.next = 34;
|
|
538
|
+
break;
|
|
539
|
+
case 31:
|
|
540
|
+
_context5.prev = 31;
|
|
541
|
+
_context5.t0 = _context5["catch"](20);
|
|
542
|
+
_iterator2.e(_context5.t0);
|
|
543
|
+
case 34:
|
|
544
|
+
_context5.prev = 34;
|
|
545
|
+
_iterator2.f();
|
|
546
|
+
return _context5.finish(34);
|
|
547
|
+
case 37:
|
|
548
|
+
return _context5.abrupt("return", id);
|
|
549
|
+
case 40:
|
|
550
|
+
_context5.prev = 40;
|
|
551
|
+
_context5.t1 = _context5["catch"](7);
|
|
552
|
+
console.log(_context5.t1);
|
|
553
|
+
case 43:
|
|
554
|
+
return _context5.abrupt("return", null);
|
|
555
|
+
case 44:
|
|
556
|
+
case "end":
|
|
557
|
+
return _context5.stop();
|
|
558
|
+
}
|
|
559
|
+
}, _callee5, null, [[7, 40], [20, 31, 34, 37]]);
|
|
560
|
+
}));
|
|
561
|
+
return function assign(_x3) {
|
|
562
|
+
return _ref9.apply(this, arguments);
|
|
563
|
+
};
|
|
564
|
+
}();
|
|
565
|
+
var _message = /*#__PURE__*/function () {
|
|
566
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
|
|
567
|
+
var p, ex, _iterator3, _step3, _v3, _yield$parse4, id, owner, _opt$data4, _opt$from2, _res$Messages2, _res$Spawns, _res$Assignments, msg, _env, res, _iterator4, _step4, v, _iterator5, _step5, _v, _tags, _iterator6, _step6, _v2, _iterator7, _step7, v2;
|
|
568
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
569
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
570
|
+
case 0:
|
|
571
|
+
p = env[opt.process];
|
|
572
|
+
ex = false;
|
|
573
|
+
_iterator3 = _createForOfIteratorHelper(opt.tags);
|
|
574
|
+
try {
|
|
575
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
576
|
+
_v3 = _step3.value;
|
|
577
|
+
if (_v3.name === "Type") ex = true;
|
|
578
|
+
}
|
|
579
|
+
} catch (err) {
|
|
580
|
+
_iterator3.e(err);
|
|
581
|
+
} finally {
|
|
582
|
+
_iterator3.f();
|
|
583
|
+
}
|
|
584
|
+
if (!ex) opt.tags.push({
|
|
585
|
+
name: "Type",
|
|
586
|
+
value: "Message"
|
|
587
|
+
});
|
|
588
|
+
_context6.next = 7;
|
|
589
|
+
return parse(opt);
|
|
590
|
+
case 7:
|
|
591
|
+
_yield$parse4 = _context6.sent;
|
|
592
|
+
id = _yield$parse4.id;
|
|
593
|
+
owner = _yield$parse4.owner;
|
|
594
|
+
_context6.prev = 10;
|
|
595
|
+
msg = genMsg(p, (_opt$data4 = opt.data) !== null && _opt$data4 !== void 0 ? _opt$data4 : "", opt.tags, (_opt$from2 = opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : owner, mu.addr);
|
|
343
596
|
_env = genEnv({
|
|
344
597
|
pid: p.id,
|
|
345
598
|
owner: p.owner,
|
|
346
599
|
module: p.module,
|
|
347
600
|
auth: mu.addr
|
|
348
601
|
});
|
|
349
|
-
|
|
602
|
+
_context6.next = 15;
|
|
350
603
|
return p.handle(p.memory, msg, _env);
|
|
351
604
|
case 15:
|
|
352
|
-
res =
|
|
605
|
+
res = _context6.sent;
|
|
353
606
|
p.memory = res.Memory;
|
|
354
607
|
delete res.Memory;
|
|
355
608
|
p.res[id] = res;
|
|
@@ -357,21 +610,21 @@ var connect = exports.connect = function connect() {
|
|
|
357
610
|
p.txs.unshift(_objectSpread({
|
|
358
611
|
id: id
|
|
359
612
|
}, opt));
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
613
|
+
msgs[id] = opt;
|
|
614
|
+
_iterator4 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
|
|
615
|
+
_context6.prev = 23;
|
|
616
|
+
_iterator4.s();
|
|
364
617
|
case 25:
|
|
365
|
-
if ((
|
|
366
|
-
|
|
618
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
619
|
+
_context6.next = 32;
|
|
367
620
|
break;
|
|
368
621
|
}
|
|
369
|
-
v =
|
|
622
|
+
v = _step4.value;
|
|
370
623
|
if (!env[v.Target]) {
|
|
371
|
-
|
|
624
|
+
_context6.next = 30;
|
|
372
625
|
break;
|
|
373
626
|
}
|
|
374
|
-
|
|
627
|
+
_context6.next = 30;
|
|
375
628
|
return _message({
|
|
376
629
|
process: v.Target,
|
|
377
630
|
tags: v.Tags,
|
|
@@ -380,308 +633,260 @@ var connect = exports.connect = function connect() {
|
|
|
380
633
|
from: opt.process
|
|
381
634
|
});
|
|
382
635
|
case 30:
|
|
383
|
-
|
|
636
|
+
_context6.next = 25;
|
|
384
637
|
break;
|
|
385
638
|
case 32:
|
|
386
|
-
|
|
639
|
+
_context6.next = 37;
|
|
387
640
|
break;
|
|
388
641
|
case 34:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
642
|
+
_context6.prev = 34;
|
|
643
|
+
_context6.t0 = _context6["catch"](23);
|
|
644
|
+
_iterator4.e(_context6.t0);
|
|
392
645
|
case 37:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
return
|
|
646
|
+
_context6.prev = 37;
|
|
647
|
+
_iterator4.f();
|
|
648
|
+
return _context6.finish(37);
|
|
396
649
|
case 40:
|
|
397
|
-
|
|
650
|
+
_iterator5 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
|
|
651
|
+
_context6.prev = 41;
|
|
652
|
+
_iterator5.s();
|
|
398
653
|
case 43:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
654
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
655
|
+
_context6.next = 50;
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
_v = _step5.value;
|
|
659
|
+
_tags = (0, _utils.tags)(_v.Tags);
|
|
660
|
+
_context6.next = 48;
|
|
661
|
+
return spawn({
|
|
662
|
+
module: _tags.Module,
|
|
663
|
+
scheduler: scheduler,
|
|
664
|
+
tags: _v.Tags,
|
|
665
|
+
data: _v.Data,
|
|
666
|
+
from: _tags["From-Process"],
|
|
667
|
+
signer: mu.signer
|
|
668
|
+
});
|
|
669
|
+
case 48:
|
|
670
|
+
_context6.next = 43;
|
|
671
|
+
break;
|
|
672
|
+
case 50:
|
|
673
|
+
_context6.next = 55;
|
|
674
|
+
break;
|
|
675
|
+
case 52:
|
|
676
|
+
_context6.prev = 52;
|
|
677
|
+
_context6.t1 = _context6["catch"](41);
|
|
678
|
+
_iterator5.e(_context6.t1);
|
|
679
|
+
case 55:
|
|
680
|
+
_context6.prev = 55;
|
|
681
|
+
_iterator5.f();
|
|
682
|
+
return _context6.finish(55);
|
|
683
|
+
case 58:
|
|
684
|
+
_iterator6 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
|
|
685
|
+
_context6.prev = 59;
|
|
686
|
+
_iterator6.s();
|
|
687
|
+
case 61:
|
|
688
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
689
|
+
_context6.next = 82;
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
_v2 = _step6.value;
|
|
693
|
+
_iterator7 = _createForOfIteratorHelper(_v2.Processes);
|
|
694
|
+
_context6.prev = 64;
|
|
695
|
+
_iterator7.s();
|
|
696
|
+
case 66:
|
|
697
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
698
|
+
_context6.next = 72;
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
v2 = _step7.value;
|
|
702
|
+
_context6.next = 70;
|
|
703
|
+
return assign({
|
|
704
|
+
message: _v2.Message,
|
|
705
|
+
process: v2,
|
|
706
|
+
from: opt.process,
|
|
707
|
+
signer: mu.signer
|
|
708
|
+
});
|
|
709
|
+
case 70:
|
|
710
|
+
_context6.next = 66;
|
|
711
|
+
break;
|
|
712
|
+
case 72:
|
|
713
|
+
_context6.next = 77;
|
|
714
|
+
break;
|
|
715
|
+
case 74:
|
|
716
|
+
_context6.prev = 74;
|
|
717
|
+
_context6.t2 = _context6["catch"](64);
|
|
718
|
+
_iterator7.e(_context6.t2);
|
|
719
|
+
case 77:
|
|
720
|
+
_context6.prev = 77;
|
|
721
|
+
_iterator7.f();
|
|
722
|
+
return _context6.finish(77);
|
|
723
|
+
case 80:
|
|
724
|
+
_context6.next = 61;
|
|
725
|
+
break;
|
|
726
|
+
case 82:
|
|
727
|
+
_context6.next = 87;
|
|
728
|
+
break;
|
|
729
|
+
case 84:
|
|
730
|
+
_context6.prev = 84;
|
|
731
|
+
_context6.t3 = _context6["catch"](59);
|
|
732
|
+
_iterator6.e(_context6.t3);
|
|
733
|
+
case 87:
|
|
734
|
+
_context6.prev = 87;
|
|
735
|
+
_iterator6.f();
|
|
736
|
+
return _context6.finish(87);
|
|
737
|
+
case 90:
|
|
738
|
+
return _context6.abrupt("return", id);
|
|
739
|
+
case 93:
|
|
740
|
+
_context6.prev = 93;
|
|
741
|
+
_context6.t4 = _context6["catch"](10);
|
|
742
|
+
console.log(_context6.t4);
|
|
743
|
+
case 96:
|
|
744
|
+
return _context6.abrupt("return", null);
|
|
745
|
+
case 97:
|
|
405
746
|
case "end":
|
|
406
|
-
return
|
|
747
|
+
return _context6.stop();
|
|
407
748
|
}
|
|
408
|
-
},
|
|
749
|
+
}, _callee6, null, [[10, 93], [23, 34, 37, 40], [41, 52, 55, 58], [59, 84, 87, 90], [64, 74, 77, 80]]);
|
|
409
750
|
}));
|
|
410
|
-
return function message(
|
|
411
|
-
return
|
|
751
|
+
return function message(_x4) {
|
|
752
|
+
return _ref10.apply(this, arguments);
|
|
412
753
|
};
|
|
413
754
|
}();
|
|
414
755
|
return {
|
|
415
|
-
scheduler:
|
|
756
|
+
scheduler: scheduler,
|
|
416
757
|
modules: modules,
|
|
417
|
-
accounts:
|
|
758
|
+
accounts: acc,
|
|
759
|
+
mu: mu,
|
|
418
760
|
message: _message,
|
|
419
|
-
|
|
420
|
-
var
|
|
421
|
-
var
|
|
422
|
-
return _regeneratorRuntime().wrap(function
|
|
423
|
-
while (1) switch (
|
|
761
|
+
unmonitor: function () {
|
|
762
|
+
var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
|
|
763
|
+
var p;
|
|
764
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
765
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
424
766
|
case 0:
|
|
425
|
-
|
|
426
|
-
_iterator4 = _createForOfIteratorHelper(env[pid].txs);
|
|
767
|
+
p = env[opt.process];
|
|
427
768
|
try {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
id: v.id
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
} catch (err) {
|
|
436
|
-
_iterator4.e(err);
|
|
437
|
-
} finally {
|
|
438
|
-
_iterator4.f();
|
|
439
|
-
}
|
|
440
|
-
return _context5.abrupt("return", _txs);
|
|
441
|
-
case 4:
|
|
769
|
+
clearInterval(p.cron);
|
|
770
|
+
p.cron = null;
|
|
771
|
+
} catch (e) {}
|
|
772
|
+
case 2:
|
|
442
773
|
case "end":
|
|
443
|
-
return
|
|
774
|
+
return _context7.stop();
|
|
444
775
|
}
|
|
445
|
-
},
|
|
776
|
+
}, _callee7);
|
|
446
777
|
}));
|
|
447
|
-
function
|
|
448
|
-
return
|
|
778
|
+
function unmonitor(_x5) {
|
|
779
|
+
return _unmonitor.apply(this, arguments);
|
|
449
780
|
}
|
|
450
|
-
return
|
|
781
|
+
return unmonitor;
|
|
451
782
|
}(),
|
|
452
|
-
|
|
453
|
-
var
|
|
454
|
-
var
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
_dirname,
|
|
458
|
-
wasm,
|
|
459
|
-
handle,
|
|
460
|
-
_module,
|
|
461
|
-
ex,
|
|
462
|
-
_iterator5,
|
|
463
|
-
_step5,
|
|
464
|
-
v,
|
|
465
|
-
_yield$parse3,
|
|
466
|
-
id,
|
|
467
|
-
owner,
|
|
468
|
-
_args6 = arguments;
|
|
469
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
470
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
783
|
+
monitor: function () {
|
|
784
|
+
var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
|
|
785
|
+
var p;
|
|
786
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
787
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
471
788
|
case 0:
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return dirname();
|
|
492
|
-
case 9:
|
|
493
|
-
_dirname = _context6.sent;
|
|
494
|
-
wasm = (0, _fs.readFileSync)((0, _path.resolve)(_dirname, "lua/".concat(wasms[mod].file, ".wasm")));
|
|
495
|
-
_context6.next = 13;
|
|
496
|
-
return (0, _aoLoader["default"])(wasm, {
|
|
497
|
-
format: wasms[mod].format
|
|
498
|
-
});
|
|
499
|
-
case 13:
|
|
500
|
-
handle = _context6.sent;
|
|
501
|
-
modmap[mod] = {
|
|
502
|
-
handle: handle,
|
|
503
|
-
id: mod
|
|
504
|
-
};
|
|
505
|
-
case 15:
|
|
506
|
-
if (mod) {
|
|
507
|
-
_context6.next = 17;
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
throw Error("module not found");
|
|
511
|
-
case 17:
|
|
512
|
-
_module = modmap[mod];
|
|
513
|
-
ex = false;
|
|
514
|
-
(_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
|
|
515
|
-
_iterator5 = _createForOfIteratorHelper(opt.tags);
|
|
516
|
-
try {
|
|
517
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
518
|
-
v = _step5.value;
|
|
519
|
-
if (v.name === "Type") ex = true;
|
|
520
|
-
}
|
|
521
|
-
} catch (err) {
|
|
522
|
-
_iterator5.e(err);
|
|
523
|
-
} finally {
|
|
524
|
-
_iterator5.f();
|
|
789
|
+
p = env[opt.process];
|
|
790
|
+
if ((0, _ramda.isNil)(p.cron)) {
|
|
791
|
+
p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
792
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
793
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
794
|
+
case 0:
|
|
795
|
+
_context8.next = 2;
|
|
796
|
+
return _message({
|
|
797
|
+
tags: p.cronTags,
|
|
798
|
+
process: opt.process,
|
|
799
|
+
signer: mu.signer,
|
|
800
|
+
from: mu.addr
|
|
801
|
+
});
|
|
802
|
+
case 2:
|
|
803
|
+
case "end":
|
|
804
|
+
return _context8.stop();
|
|
805
|
+
}
|
|
806
|
+
}, _callee8);
|
|
807
|
+
})), p.span);
|
|
525
808
|
}
|
|
526
|
-
|
|
527
|
-
name: "Type",
|
|
528
|
-
value: "Process"
|
|
529
|
-
});
|
|
530
|
-
_context6.next = 25;
|
|
531
|
-
return parse(opt);
|
|
532
|
-
case 25:
|
|
533
|
-
_yield$parse3 = _context6.sent;
|
|
534
|
-
id = _yield$parse3.id;
|
|
535
|
-
owner = _yield$parse3.owner;
|
|
536
|
-
env.msgs[id] = opt;
|
|
537
|
-
env[id] = {
|
|
538
|
-
id: id,
|
|
539
|
-
handle: _module.handle,
|
|
540
|
-
module: _module.id,
|
|
541
|
-
memory: null,
|
|
542
|
-
owner: owner,
|
|
543
|
-
height: 1,
|
|
544
|
-
res: {
|
|
545
|
-
id: null
|
|
546
|
-
},
|
|
547
|
-
results: [id],
|
|
548
|
-
txs: []
|
|
549
|
-
};
|
|
550
|
-
return _context6.abrupt("return", id);
|
|
551
|
-
case 31:
|
|
809
|
+
case 2:
|
|
552
810
|
case "end":
|
|
553
|
-
return
|
|
811
|
+
return _context9.stop();
|
|
554
812
|
}
|
|
555
|
-
},
|
|
813
|
+
}, _callee9);
|
|
556
814
|
}));
|
|
557
|
-
function
|
|
558
|
-
return
|
|
815
|
+
function monitor(_x6) {
|
|
816
|
+
return _monitor.apply(this, arguments);
|
|
559
817
|
}
|
|
560
|
-
return
|
|
818
|
+
return monitor;
|
|
561
819
|
}(),
|
|
562
|
-
|
|
563
|
-
var
|
|
564
|
-
var
|
|
565
|
-
return _regeneratorRuntime().wrap(function
|
|
566
|
-
while (1) switch (
|
|
820
|
+
txs: function () {
|
|
821
|
+
var _txs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(pid) {
|
|
822
|
+
var _txs, _iterator8, _step8, v;
|
|
823
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
824
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
567
825
|
case 0:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
auth: mu.addr
|
|
583
|
-
});
|
|
584
|
-
_context7.next = 12;
|
|
585
|
-
return p.handle(p.memory, msg, _env);
|
|
586
|
-
case 12:
|
|
587
|
-
res = _context7.sent;
|
|
588
|
-
p.memory = res.Memory;
|
|
589
|
-
delete res.Memory;
|
|
590
|
-
p.res[id] = res;
|
|
591
|
-
p.results.push(id);
|
|
592
|
-
p.txs.unshift(_objectSpread({
|
|
593
|
-
id: id
|
|
594
|
-
}, _opt));
|
|
595
|
-
env.msgs[id] = _opt;
|
|
596
|
-
_iterator6 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
|
|
597
|
-
_context7.prev = 20;
|
|
598
|
-
_iterator6.s();
|
|
599
|
-
case 22:
|
|
600
|
-
if ((_step6 = _iterator6.n()).done) {
|
|
601
|
-
_context7.next = 29;
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
v = _step6.value;
|
|
605
|
-
if (!env[v.Target]) {
|
|
606
|
-
_context7.next = 27;
|
|
607
|
-
break;
|
|
826
|
+
_txs = [];
|
|
827
|
+
_iterator8 = _createForOfIteratorHelper(env[pid].txs);
|
|
828
|
+
try {
|
|
829
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
830
|
+
v = _step8.value;
|
|
831
|
+
_txs.push({
|
|
832
|
+
tags: v.tags,
|
|
833
|
+
id: v.id
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
} catch (err) {
|
|
837
|
+
_iterator8.e(err);
|
|
838
|
+
} finally {
|
|
839
|
+
_iterator8.f();
|
|
608
840
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
process: v.Target,
|
|
612
|
-
tags: v.Tags,
|
|
613
|
-
data: v.Data,
|
|
614
|
-
signer: mu.signer,
|
|
615
|
-
from: opt.process
|
|
616
|
-
});
|
|
617
|
-
case 27:
|
|
618
|
-
_context7.next = 22;
|
|
619
|
-
break;
|
|
620
|
-
case 29:
|
|
621
|
-
_context7.next = 34;
|
|
622
|
-
break;
|
|
623
|
-
case 31:
|
|
624
|
-
_context7.prev = 31;
|
|
625
|
-
_context7.t0 = _context7["catch"](20);
|
|
626
|
-
_iterator6.e(_context7.t0);
|
|
627
|
-
case 34:
|
|
628
|
-
_context7.prev = 34;
|
|
629
|
-
_iterator6.f();
|
|
630
|
-
return _context7.finish(34);
|
|
631
|
-
case 37:
|
|
632
|
-
return _context7.abrupt("return", id);
|
|
633
|
-
case 40:
|
|
634
|
-
_context7.prev = 40;
|
|
635
|
-
_context7.t1 = _context7["catch"](7);
|
|
636
|
-
console.log(_context7.t1);
|
|
637
|
-
case 43:
|
|
638
|
-
return _context7.abrupt("return", null);
|
|
639
|
-
case 44:
|
|
841
|
+
return _context10.abrupt("return", _txs);
|
|
842
|
+
case 4:
|
|
640
843
|
case "end":
|
|
641
|
-
return
|
|
844
|
+
return _context10.stop();
|
|
642
845
|
}
|
|
643
|
-
},
|
|
846
|
+
}, _callee10);
|
|
644
847
|
}));
|
|
645
|
-
function
|
|
646
|
-
return
|
|
848
|
+
function txs(_x7) {
|
|
849
|
+
return _txs2.apply(this, arguments);
|
|
647
850
|
}
|
|
648
|
-
return
|
|
851
|
+
return txs;
|
|
649
852
|
}(),
|
|
853
|
+
spawn: spawn,
|
|
854
|
+
assign: assign,
|
|
650
855
|
result: function () {
|
|
651
|
-
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
652
|
-
return _regeneratorRuntime().wrap(function
|
|
653
|
-
while (1) switch (
|
|
856
|
+
var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
|
|
857
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
858
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
654
859
|
case 0:
|
|
655
|
-
return
|
|
860
|
+
return _context11.abrupt("return", env[opt.process].res[opt.message]);
|
|
656
861
|
case 1:
|
|
657
862
|
case "end":
|
|
658
|
-
return
|
|
863
|
+
return _context11.stop();
|
|
659
864
|
}
|
|
660
|
-
},
|
|
865
|
+
}, _callee11);
|
|
661
866
|
}));
|
|
662
|
-
function result(
|
|
867
|
+
function result(_x8) {
|
|
663
868
|
return _result.apply(this, arguments);
|
|
664
869
|
}
|
|
665
870
|
return result;
|
|
666
871
|
}(),
|
|
667
872
|
results: function () {
|
|
668
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
873
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
|
|
669
874
|
var _opt$limit;
|
|
670
875
|
var p, results, limit, i, _i;
|
|
671
|
-
return _regeneratorRuntime().wrap(function
|
|
672
|
-
while (1) switch (
|
|
876
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
877
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
673
878
|
case 0:
|
|
674
879
|
p = env[opt.process];
|
|
675
880
|
results = [];
|
|
676
881
|
limit = (_opt$limit = opt.limit) !== null && _opt$limit !== void 0 ? _opt$limit : 25;
|
|
677
882
|
if (!(opt.sort === "DESC")) {
|
|
678
|
-
|
|
883
|
+
_context12.next = 14;
|
|
679
884
|
break;
|
|
680
885
|
}
|
|
681
886
|
i = p.results.length - 1;
|
|
682
887
|
case 5:
|
|
683
888
|
if (!(0 < i)) {
|
|
684
|
-
|
|
889
|
+
_context12.next = 12;
|
|
685
890
|
break;
|
|
686
891
|
}
|
|
687
892
|
results.push({
|
|
@@ -689,93 +894,96 @@ var connect = exports.connect = function connect() {
|
|
|
689
894
|
node: p.res[p.results[i]]
|
|
690
895
|
});
|
|
691
896
|
if (!(results.length >= limit)) {
|
|
692
|
-
|
|
897
|
+
_context12.next = 9;
|
|
693
898
|
break;
|
|
694
899
|
}
|
|
695
|
-
return
|
|
900
|
+
return _context12.abrupt("break", 12);
|
|
696
901
|
case 9:
|
|
697
902
|
i--;
|
|
698
|
-
|
|
903
|
+
_context12.next = 5;
|
|
699
904
|
break;
|
|
700
905
|
case 12:
|
|
701
|
-
|
|
906
|
+
_context12.next = 22;
|
|
702
907
|
break;
|
|
703
908
|
case 14:
|
|
704
909
|
_i = 0;
|
|
705
910
|
case 15:
|
|
706
911
|
if (!(_i < p.results.length)) {
|
|
707
|
-
|
|
912
|
+
_context12.next = 22;
|
|
708
913
|
break;
|
|
709
914
|
}
|
|
710
915
|
results.push({
|
|
711
916
|
node: p.res[p.results[_i]]
|
|
712
917
|
});
|
|
713
918
|
if (!(results.length >= limit)) {
|
|
714
|
-
|
|
919
|
+
_context12.next = 19;
|
|
715
920
|
break;
|
|
716
921
|
}
|
|
717
|
-
return
|
|
922
|
+
return _context12.abrupt("break", 22);
|
|
718
923
|
case 19:
|
|
719
924
|
_i++;
|
|
720
|
-
|
|
925
|
+
_context12.next = 15;
|
|
721
926
|
break;
|
|
722
927
|
case 22:
|
|
723
|
-
return
|
|
928
|
+
return _context12.abrupt("return", {
|
|
724
929
|
edges: results
|
|
725
930
|
});
|
|
726
931
|
case 23:
|
|
727
932
|
case "end":
|
|
728
|
-
return
|
|
933
|
+
return _context12.stop();
|
|
729
934
|
}
|
|
730
|
-
},
|
|
935
|
+
}, _callee12);
|
|
731
936
|
}));
|
|
732
|
-
function results(
|
|
937
|
+
function results(_x9) {
|
|
733
938
|
return _results.apply(this, arguments);
|
|
734
939
|
}
|
|
735
940
|
return results;
|
|
736
941
|
}(),
|
|
737
942
|
dryrun: function () {
|
|
738
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
739
|
-
var p, _yield$parse5, id, owner, _opt$
|
|
740
|
-
return _regeneratorRuntime().wrap(function
|
|
741
|
-
while (1) switch (
|
|
943
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(opt) {
|
|
944
|
+
var p, _yield$parse5, id, owner, _opt$data5, msg, _env, res;
|
|
945
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
946
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
742
947
|
case 0:
|
|
743
948
|
p = env[opt.process];
|
|
744
|
-
|
|
949
|
+
_context13.next = 3;
|
|
745
950
|
return parse(opt);
|
|
746
951
|
case 3:
|
|
747
|
-
_yield$parse5 =
|
|
952
|
+
_yield$parse5 = _context13.sent;
|
|
748
953
|
id = _yield$parse5.id;
|
|
749
954
|
owner = _yield$parse5.owner;
|
|
750
|
-
|
|
751
|
-
msg = genMsg(p, (_opt$
|
|
955
|
+
_context13.prev = 6;
|
|
956
|
+
msg = genMsg(p, (_opt$data5 = opt.data) !== null && _opt$data5 !== void 0 ? _opt$data5 : "", opt.tags, owner, mu.addr, true);
|
|
752
957
|
_env = genEnv({
|
|
753
958
|
pid: p.id,
|
|
754
959
|
owner: p.owner,
|
|
755
960
|
module: p.module,
|
|
756
961
|
auth: mu.addr
|
|
757
962
|
});
|
|
758
|
-
|
|
963
|
+
_context13.next = 11;
|
|
759
964
|
return p.handle(p.memory, msg, _env);
|
|
760
965
|
case 11:
|
|
761
|
-
res =
|
|
762
|
-
return
|
|
966
|
+
res = _context13.sent;
|
|
967
|
+
return _context13.abrupt("return", res);
|
|
763
968
|
case 15:
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
console.log(
|
|
969
|
+
_context13.prev = 15;
|
|
970
|
+
_context13.t0 = _context13["catch"](6);
|
|
971
|
+
console.log(_context13.t0);
|
|
767
972
|
case 18:
|
|
768
|
-
return
|
|
973
|
+
return _context13.abrupt("return", null);
|
|
769
974
|
case 19:
|
|
770
975
|
case "end":
|
|
771
|
-
return
|
|
976
|
+
return _context13.stop();
|
|
772
977
|
}
|
|
773
|
-
},
|
|
978
|
+
}, _callee13, null, [[6, 15]]);
|
|
774
979
|
}));
|
|
775
|
-
function dryrun(
|
|
980
|
+
function dryrun(_x10) {
|
|
776
981
|
return _dryrun.apply(this, arguments);
|
|
777
982
|
}
|
|
778
983
|
return dryrun;
|
|
779
|
-
}()
|
|
984
|
+
}(),
|
|
985
|
+
getProcesses: function getProcesses() {
|
|
986
|
+
return env;
|
|
987
|
+
}
|
|
780
988
|
};
|
|
781
989
|
};
|