wao 0.13.8 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aoconnect-base.js +172 -168
- package/cjs/bao.js +40 -15
- package/cjs/bar.js +14 -22
- package/esm/aoconnect-base.js +12 -8
- package/esm/bao.js +11 -8
- package/esm/bar.js +3 -4
- package/package.json +1 -1
package/cjs/aoconnect-base.js
CHANGED
|
@@ -21,9 +21,9 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
22
|
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); }
|
|
23
23
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
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 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); }
|
|
26
25
|
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); }); }; }
|
|
26
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
27
27
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
28
28
|
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."); }
|
|
29
29
|
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; } }
|
|
@@ -99,15 +99,33 @@ var _default = exports["default"] = function _default() {
|
|
|
99
99
|
});
|
|
100
100
|
return output;
|
|
101
101
|
};
|
|
102
|
+
var capitalize = function capitalize(__tags) {
|
|
103
|
+
var cap = {
|
|
104
|
+
authority: "Authority",
|
|
105
|
+
action: "Action",
|
|
106
|
+
"on-boot": "On-Boot",
|
|
107
|
+
scheduler: "Scheduler",
|
|
108
|
+
module: "Module"
|
|
109
|
+
};
|
|
110
|
+
var _iterator = _createForOfIteratorHelper(__tags),
|
|
111
|
+
_step;
|
|
112
|
+
try {
|
|
113
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
|
+
var _cap$v$name;
|
|
115
|
+
var v = _step.value;
|
|
116
|
+
v.name = (_cap$v$name = cap[v.name]) !== null && _cap$v$name !== void 0 ? _cap$v$name : v.name;
|
|
117
|
+
}
|
|
118
|
+
} catch (err) {
|
|
119
|
+
_iterator.e(err);
|
|
120
|
+
} finally {
|
|
121
|
+
_iterator.f();
|
|
122
|
+
}
|
|
123
|
+
return __tags;
|
|
124
|
+
};
|
|
102
125
|
var genMsg = /*#__PURE__*/function () {
|
|
103
126
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(Id, p, data, Tags, from, Owner) {
|
|
104
127
|
var dry,
|
|
105
128
|
__tags,
|
|
106
|
-
cap,
|
|
107
|
-
_iterator,
|
|
108
|
-
_step,
|
|
109
|
-
_cap$v$name,
|
|
110
|
-
v,
|
|
111
129
|
_args = arguments;
|
|
112
130
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
113
131
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -115,36 +133,18 @@ var _default = exports["default"] = function _default() {
|
|
|
115
133
|
dry = _args.length > 6 && _args[6] !== undefined ? _args[6] : false;
|
|
116
134
|
if (!dry) p.height += 1;
|
|
117
135
|
__tags = Tags !== null && Tags !== void 0 && Tags.length ? Tags : [];
|
|
118
|
-
cap = {
|
|
119
|
-
authority: "Authority",
|
|
120
|
-
action: "Action",
|
|
121
|
-
"on-boot": "On-Boot",
|
|
122
|
-
scheduler: "Scheduler",
|
|
123
|
-
module: "Module"
|
|
124
|
-
};
|
|
125
|
-
_iterator = _createForOfIteratorHelper(__tags);
|
|
126
|
-
try {
|
|
127
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
128
|
-
v = _step.value;
|
|
129
|
-
v.name = (_cap$v$name = cap[v.name]) !== null && _cap$v$name !== void 0 ? _cap$v$name : v.name;
|
|
130
|
-
}
|
|
131
|
-
} catch (err) {
|
|
132
|
-
_iterator.e(err);
|
|
133
|
-
} finally {
|
|
134
|
-
_iterator.f();
|
|
135
|
-
}
|
|
136
136
|
_context.t0 = Id;
|
|
137
137
|
_context.t1 = p.id;
|
|
138
138
|
_context.t2 = Owner;
|
|
139
139
|
_context.t3 = data !== null && data !== void 0 && data.length ? data : "";
|
|
140
|
-
_context.next =
|
|
140
|
+
_context.next = 9;
|
|
141
141
|
return mem.get("height");
|
|
142
|
-
case
|
|
142
|
+
case 9:
|
|
143
143
|
_context.t4 = _context.sent.toString();
|
|
144
144
|
_context.t5 = Date.now().toString();
|
|
145
145
|
_context.t6 = p.module;
|
|
146
146
|
_context.t7 = from;
|
|
147
|
-
_context.t8 = __tags;
|
|
147
|
+
_context.t8 = capitalize(__tags);
|
|
148
148
|
return _context.abrupt("return", {
|
|
149
149
|
Id: _context.t0,
|
|
150
150
|
Target: _context.t1,
|
|
@@ -157,7 +157,7 @@ var _default = exports["default"] = function _default() {
|
|
|
157
157
|
Cron: false,
|
|
158
158
|
Tags: _context.t8
|
|
159
159
|
});
|
|
160
|
-
case
|
|
160
|
+
case 15:
|
|
161
161
|
case "end":
|
|
162
162
|
return _context.stop();
|
|
163
163
|
}
|
|
@@ -176,102 +176,106 @@ var _default = exports["default"] = function _default() {
|
|
|
176
176
|
case 0:
|
|
177
177
|
pid = _ref6.pid, _ref6$owner = _ref6.owner, owner = _ref6$owner === void 0 ? "" : _ref6$owner, _ref6$module = _ref6.module, module = _ref6$module === void 0 ? "" : _ref6$module;
|
|
178
178
|
_context2.t0 = pid;
|
|
179
|
-
_context2.
|
|
179
|
+
_context2.t1 = capitalize;
|
|
180
|
+
_context2.next = 5;
|
|
180
181
|
return mem.getTx(pid);
|
|
181
|
-
case
|
|
182
|
-
_context2.
|
|
183
|
-
_context2.
|
|
184
|
-
if (_context2.
|
|
185
|
-
_context2.next =
|
|
182
|
+
case 5:
|
|
183
|
+
_context2.t4 = _yield$mem$getTx = _context2.sent;
|
|
184
|
+
_context2.t3 = _context2.t4 === null;
|
|
185
|
+
if (_context2.t3) {
|
|
186
|
+
_context2.next = 9;
|
|
186
187
|
break;
|
|
187
188
|
}
|
|
188
|
-
_context2.
|
|
189
|
-
case
|
|
190
|
-
if (!_context2.
|
|
191
|
-
_context2.next =
|
|
189
|
+
_context2.t3 = _yield$mem$getTx === void 0;
|
|
190
|
+
case 9:
|
|
191
|
+
if (!_context2.t3) {
|
|
192
|
+
_context2.next = 13;
|
|
192
193
|
break;
|
|
193
194
|
}
|
|
194
|
-
_context2.
|
|
195
|
-
_context2.next =
|
|
195
|
+
_context2.t5 = void 0;
|
|
196
|
+
_context2.next = 14;
|
|
196
197
|
break;
|
|
197
|
-
case 12:
|
|
198
|
-
_context2.t4 = _yield$mem$getTx.tags;
|
|
199
198
|
case 13:
|
|
200
|
-
_context2.t5 = _yield$mem$getTx
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
_context2.t5 = _yield$mem$getTx.tags;
|
|
200
|
+
case 14:
|
|
201
|
+
_context2.t6 = _yield$mem$getTx$tags = _context2.t5;
|
|
202
|
+
_context2.t2 = _context2.t6 !== null;
|
|
203
|
+
if (!_context2.t2) {
|
|
204
|
+
_context2.next = 18;
|
|
204
205
|
break;
|
|
205
206
|
}
|
|
206
|
-
_context2.
|
|
207
|
-
case
|
|
208
|
-
if (!_context2.
|
|
209
|
-
_context2.next =
|
|
207
|
+
_context2.t2 = _yield$mem$getTx$tags !== void 0;
|
|
208
|
+
case 18:
|
|
209
|
+
if (!_context2.t2) {
|
|
210
|
+
_context2.next = 22;
|
|
210
211
|
break;
|
|
211
212
|
}
|
|
212
|
-
_context2.
|
|
213
|
-
_context2.next =
|
|
213
|
+
_context2.t7 = _yield$mem$getTx$tags;
|
|
214
|
+
_context2.next = 23;
|
|
214
215
|
break;
|
|
215
|
-
case 21:
|
|
216
|
-
_context2.t6 = [];
|
|
217
216
|
case 22:
|
|
218
|
-
_context2.t7 =
|
|
219
|
-
|
|
220
|
-
_context2.
|
|
217
|
+
_context2.t7 = [];
|
|
218
|
+
case 23:
|
|
219
|
+
_context2.t8 = _context2.t7;
|
|
220
|
+
_context2.t9 = (0, _context2.t1)(_context2.t8);
|
|
221
|
+
_context2.t10 = owner;
|
|
222
|
+
_context2.t11 = {
|
|
221
223
|
Id: _context2.t0,
|
|
222
|
-
Tags: _context2.
|
|
223
|
-
Owner: _context2.
|
|
224
|
+
Tags: _context2.t9,
|
|
225
|
+
Owner: _context2.t10
|
|
224
226
|
};
|
|
225
|
-
_context2.
|
|
226
|
-
_context2.
|
|
227
|
+
_context2.t12 = module;
|
|
228
|
+
_context2.t13 = capitalize;
|
|
229
|
+
_context2.next = 31;
|
|
227
230
|
return mem.getTx(module);
|
|
228
|
-
case
|
|
229
|
-
_context2.
|
|
230
|
-
_context2.
|
|
231
|
-
if (_context2.
|
|
232
|
-
_context2.next =
|
|
231
|
+
case 31:
|
|
232
|
+
_context2.t16 = _yield$mem$getTx2 = _context2.sent;
|
|
233
|
+
_context2.t15 = _context2.t16 === null;
|
|
234
|
+
if (_context2.t15) {
|
|
235
|
+
_context2.next = 35;
|
|
233
236
|
break;
|
|
234
237
|
}
|
|
235
|
-
_context2.
|
|
236
|
-
case
|
|
237
|
-
if (!_context2.
|
|
238
|
-
_context2.next =
|
|
238
|
+
_context2.t15 = _yield$mem$getTx2 === void 0;
|
|
239
|
+
case 35:
|
|
240
|
+
if (!_context2.t15) {
|
|
241
|
+
_context2.next = 39;
|
|
239
242
|
break;
|
|
240
243
|
}
|
|
241
|
-
_context2.
|
|
242
|
-
_context2.next =
|
|
244
|
+
_context2.t17 = void 0;
|
|
245
|
+
_context2.next = 40;
|
|
243
246
|
break;
|
|
244
|
-
case
|
|
245
|
-
_context2.
|
|
246
|
-
case
|
|
247
|
-
_context2.
|
|
248
|
-
_context2.
|
|
249
|
-
if (!_context2.
|
|
250
|
-
_context2.next =
|
|
247
|
+
case 39:
|
|
248
|
+
_context2.t17 = _yield$mem$getTx2.tags;
|
|
249
|
+
case 40:
|
|
250
|
+
_context2.t18 = _yield$mem$getTx$tags2 = _context2.t17;
|
|
251
|
+
_context2.t14 = _context2.t18 !== null;
|
|
252
|
+
if (!_context2.t14) {
|
|
253
|
+
_context2.next = 44;
|
|
251
254
|
break;
|
|
252
255
|
}
|
|
253
|
-
_context2.
|
|
254
|
-
case
|
|
255
|
-
if (!_context2.
|
|
256
|
-
_context2.next =
|
|
256
|
+
_context2.t14 = _yield$mem$getTx$tags2 !== void 0;
|
|
257
|
+
case 44:
|
|
258
|
+
if (!_context2.t14) {
|
|
259
|
+
_context2.next = 48;
|
|
257
260
|
break;
|
|
258
261
|
}
|
|
259
|
-
_context2.
|
|
260
|
-
_context2.next =
|
|
262
|
+
_context2.t19 = _yield$mem$getTx$tags2;
|
|
263
|
+
_context2.next = 49;
|
|
261
264
|
break;
|
|
262
|
-
case
|
|
263
|
-
_context2.
|
|
264
|
-
case
|
|
265
|
-
_context2.
|
|
266
|
-
_context2.
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
case 48:
|
|
266
|
+
_context2.t19 = [];
|
|
267
|
+
case 49:
|
|
268
|
+
_context2.t20 = _context2.t19;
|
|
269
|
+
_context2.t21 = (0, _context2.t13)(_context2.t20);
|
|
270
|
+
_context2.t22 = {
|
|
271
|
+
Id: _context2.t12,
|
|
272
|
+
Tags: _context2.t21
|
|
269
273
|
};
|
|
270
274
|
return _context2.abrupt("return", {
|
|
271
|
-
Process: _context2.
|
|
272
|
-
Module: _context2.
|
|
275
|
+
Process: _context2.t11,
|
|
276
|
+
Module: _context2.t22
|
|
273
277
|
});
|
|
274
|
-
case
|
|
278
|
+
case 53:
|
|
275
279
|
case "end":
|
|
276
280
|
return _context2.stop();
|
|
277
281
|
}
|
|
@@ -959,7 +963,7 @@ var _default = exports["default"] = function _default() {
|
|
|
959
963
|
owner = "";
|
|
960
964
|
item = null;
|
|
961
965
|
if (!ar.isHttpMsg(opt.http_msg)) {
|
|
962
|
-
_context5.next =
|
|
966
|
+
_context5.next = 22;
|
|
963
967
|
break;
|
|
964
968
|
}
|
|
965
969
|
id = opt.http_msg.target;
|
|
@@ -976,38 +980,37 @@ var _default = exports["default"] = function _default() {
|
|
|
976
980
|
new_slot = opt.slot * 1;
|
|
977
981
|
last_slot = !_p ? -1 : _p.results.length - 1;
|
|
978
982
|
if (!(last_slot + 1 !== new_slot)) {
|
|
979
|
-
_context5.next =
|
|
983
|
+
_context5.next = 20;
|
|
980
984
|
break;
|
|
981
985
|
}
|
|
982
|
-
console.log("need process recovery from HB:", opt.process);
|
|
983
986
|
if (!(!hb || opt.recovery)) {
|
|
984
|
-
_context5.next =
|
|
987
|
+
_context5.next = 18;
|
|
985
988
|
break;
|
|
986
989
|
}
|
|
987
990
|
return _context5.abrupt("return", null);
|
|
988
|
-
case
|
|
989
|
-
_context5.next =
|
|
991
|
+
case 18:
|
|
992
|
+
_context5.next = 20;
|
|
990
993
|
return _recover(opt.process);
|
|
991
|
-
case
|
|
992
|
-
_context5.next =
|
|
994
|
+
case 20:
|
|
995
|
+
_context5.next = 25;
|
|
993
996
|
break;
|
|
994
|
-
case
|
|
997
|
+
case 22:
|
|
995
998
|
_id = (_opt$item$id = opt === null || opt === void 0 || (_opt$item = opt.item) === null || _opt$item === void 0 ? void 0 : _opt$item.id) !== null && _opt$item$id !== void 0 ? _opt$item$id : "";
|
|
996
999
|
_owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
|
|
997
1000
|
_item = opt.item;
|
|
998
|
-
case
|
|
999
|
-
_context5.next =
|
|
1001
|
+
case 25:
|
|
1002
|
+
_context5.next = 27;
|
|
1000
1003
|
return mem.get("env", opt.process);
|
|
1001
|
-
case
|
|
1004
|
+
case 27:
|
|
1002
1005
|
p = _context5.sent;
|
|
1003
1006
|
if (p) {
|
|
1004
|
-
_context5.next =
|
|
1007
|
+
_context5.next = 30;
|
|
1005
1008
|
break;
|
|
1006
1009
|
}
|
|
1007
1010
|
return _context5.abrupt("return", null);
|
|
1008
|
-
case
|
|
1011
|
+
case 30:
|
|
1009
1012
|
if (!(!opt.item && opt.signer)) {
|
|
1010
|
-
_context5.next =
|
|
1013
|
+
_context5.next = 65;
|
|
1011
1014
|
break;
|
|
1012
1015
|
}
|
|
1013
1016
|
opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
|
|
@@ -1017,7 +1020,7 @@ var _default = exports["default"] = function _default() {
|
|
|
1017
1020
|
SDK: "aoconnect"
|
|
1018
1021
|
}));
|
|
1019
1022
|
if (!opt["for"]) {
|
|
1020
|
-
_context5.next =
|
|
1023
|
+
_context5.next = 58;
|
|
1021
1024
|
break;
|
|
1022
1025
|
}
|
|
1023
1026
|
opt.tags.push({
|
|
@@ -1028,100 +1031,100 @@ var _default = exports["default"] = function _default() {
|
|
|
1028
1031
|
name: "From-Process",
|
|
1029
1032
|
value: opt.from
|
|
1030
1033
|
});
|
|
1031
|
-
_context5.next =
|
|
1034
|
+
_context5.next = 37;
|
|
1032
1035
|
return mem.getTx(opt.from);
|
|
1033
|
-
case
|
|
1036
|
+
case 37:
|
|
1034
1037
|
_context5.t2 = _yield$mem$getTx3 = _context5.sent;
|
|
1035
1038
|
_context5.t1 = _context5.t2 === null;
|
|
1036
1039
|
if (_context5.t1) {
|
|
1037
|
-
_context5.next =
|
|
1040
|
+
_context5.next = 41;
|
|
1038
1041
|
break;
|
|
1039
1042
|
}
|
|
1040
1043
|
_context5.t1 = _yield$mem$getTx3 === void 0;
|
|
1041
|
-
case
|
|
1044
|
+
case 41:
|
|
1042
1045
|
if (!_context5.t1) {
|
|
1043
|
-
_context5.next =
|
|
1046
|
+
_context5.next = 45;
|
|
1044
1047
|
break;
|
|
1045
1048
|
}
|
|
1046
1049
|
_context5.t3 = void 0;
|
|
1047
|
-
_context5.next =
|
|
1050
|
+
_context5.next = 46;
|
|
1048
1051
|
break;
|
|
1049
|
-
case
|
|
1052
|
+
case 45:
|
|
1050
1053
|
_context5.t3 = _yield$mem$getTx3.tags;
|
|
1051
|
-
case
|
|
1054
|
+
case 46:
|
|
1052
1055
|
_context5.t4 = _yield$mem$getTx$tags3 = _context5.t3;
|
|
1053
1056
|
_context5.t0 = _context5.t4 !== null;
|
|
1054
1057
|
if (!_context5.t0) {
|
|
1055
|
-
_context5.next =
|
|
1058
|
+
_context5.next = 50;
|
|
1056
1059
|
break;
|
|
1057
1060
|
}
|
|
1058
1061
|
_context5.t0 = _yield$mem$getTx$tags3 !== void 0;
|
|
1059
|
-
case
|
|
1062
|
+
case 50:
|
|
1060
1063
|
if (!_context5.t0) {
|
|
1061
|
-
_context5.next =
|
|
1064
|
+
_context5.next = 54;
|
|
1062
1065
|
break;
|
|
1063
1066
|
}
|
|
1064
1067
|
_context5.t5 = _yield$mem$getTx$tags3;
|
|
1065
|
-
_context5.next =
|
|
1068
|
+
_context5.next = 55;
|
|
1066
1069
|
break;
|
|
1067
|
-
case
|
|
1070
|
+
case 54:
|
|
1068
1071
|
_context5.t5 = [];
|
|
1069
|
-
case
|
|
1072
|
+
case 55:
|
|
1070
1073
|
pr = _context5.t5;
|
|
1071
1074
|
module = (0, _utils.tags)(pr).Module;
|
|
1072
1075
|
if (module) opt.tags.push({
|
|
1073
1076
|
name: "From-Module",
|
|
1074
1077
|
value: module
|
|
1075
1078
|
});
|
|
1076
|
-
case
|
|
1079
|
+
case 58:
|
|
1077
1080
|
;
|
|
1078
|
-
_context5.next =
|
|
1081
|
+
_context5.next = 61;
|
|
1079
1082
|
return ar.dataitem({
|
|
1080
1083
|
data: opt.data,
|
|
1081
1084
|
signer: opt.signer,
|
|
1082
1085
|
tags: (0, _utils.tags)(opt.tags),
|
|
1083
1086
|
target: opt.process
|
|
1084
1087
|
});
|
|
1085
|
-
case
|
|
1088
|
+
case 61:
|
|
1086
1089
|
_yield$ar$dataitem3 = _context5.sent;
|
|
1087
1090
|
item = _yield$ar$dataitem3.item;
|
|
1088
1091
|
id = _yield$ar$dataitem3.id;
|
|
1089
1092
|
owner = _yield$ar$dataitem3.owner;
|
|
1090
|
-
case
|
|
1093
|
+
case 65:
|
|
1091
1094
|
_msg = (0, _ramda.dissoc)("signer", opt);
|
|
1092
|
-
_context5.next =
|
|
1095
|
+
_context5.next = 68;
|
|
1093
1096
|
return mem.set(_msg, "msgs", id);
|
|
1094
|
-
case
|
|
1097
|
+
case 68:
|
|
1095
1098
|
if (!ar.isHttpMsg(opt.http_msg)) {
|
|
1096
|
-
_context5.next =
|
|
1099
|
+
_context5.next = 123;
|
|
1097
1100
|
break;
|
|
1098
1101
|
}
|
|
1099
1102
|
p.epochs.push([id]);
|
|
1100
1103
|
_opt = opt;
|
|
1101
|
-
_context5.prev =
|
|
1104
|
+
_context5.prev = 71;
|
|
1102
1105
|
// todo: not sure if this is correct
|
|
1103
1106
|
from = (_ref12 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref12 !== void 0 ? _ref12 : owner;
|
|
1104
1107
|
data = (_opt$http_msg$data = opt.http_msg.data) !== null && _opt$http_msg$data !== void 0 ? _opt$http_msg$data : "";
|
|
1105
1108
|
_tags = _opt.http_msg.tags; // todo: check if owner=mu.addr right?
|
|
1106
|
-
_context5.next =
|
|
1109
|
+
_context5.next = 77;
|
|
1107
1110
|
return genMsg(opt.http_msg, p, data, _tags, from, owner);
|
|
1108
|
-
case
|
|
1111
|
+
case 77:
|
|
1109
1112
|
msg = _context5.sent;
|
|
1110
|
-
_context5.next =
|
|
1113
|
+
_context5.next = 80;
|
|
1111
1114
|
return genEnv({
|
|
1112
1115
|
pid: p.id,
|
|
1113
1116
|
owner: p.owner,
|
|
1114
1117
|
module: p.module
|
|
1115
1118
|
});
|
|
1116
|
-
case
|
|
1119
|
+
case 80:
|
|
1117
1120
|
_env = _context5.sent;
|
|
1118
1121
|
if (p.handle) {
|
|
1119
|
-
_context5.next =
|
|
1122
|
+
_context5.next = 104;
|
|
1120
1123
|
break;
|
|
1121
1124
|
}
|
|
1122
|
-
_context5.next =
|
|
1125
|
+
_context5.next = 84;
|
|
1123
1126
|
return mem.getWasm(p.modulea);
|
|
1124
|
-
case
|
|
1127
|
+
case 84:
|
|
1125
1128
|
_yield$mem$getWasm3 = _context5.sent;
|
|
1126
1129
|
format = _yield$mem$getWasm3.format;
|
|
1127
1130
|
mod = _yield$mem$getWasm3.mod;
|
|
@@ -1131,13 +1134,13 @@ var _default = exports["default"] = function _default() {
|
|
|
1131
1134
|
_context5.t7 = wasm;
|
|
1132
1135
|
_context5.t8 = format;
|
|
1133
1136
|
_context5.t9 = wdrive;
|
|
1134
|
-
_context5.next =
|
|
1137
|
+
_context5.next = 95;
|
|
1135
1138
|
return mem.getTx(p.id);
|
|
1136
|
-
case
|
|
1139
|
+
case 95:
|
|
1137
1140
|
_context5.t10 = _context5.sent.item;
|
|
1138
|
-
_context5.next =
|
|
1141
|
+
_context5.next = 98;
|
|
1139
1142
|
return mem.getTx(mod);
|
|
1140
|
-
case
|
|
1143
|
+
case 98:
|
|
1141
1144
|
_context5.t11 = _context5.sent;
|
|
1142
1145
|
_context5.t12 = {
|
|
1143
1146
|
format: _context5.t8,
|
|
@@ -1145,38 +1148,38 @@ var _default = exports["default"] = function _default() {
|
|
|
1145
1148
|
spawn: _context5.t10,
|
|
1146
1149
|
module: _context5.t11
|
|
1147
1150
|
};
|
|
1148
|
-
_context5.next =
|
|
1151
|
+
_context5.next = 102;
|
|
1149
1152
|
return (0, _context5.t6)(_context5.t7, _context5.t12);
|
|
1150
|
-
case
|
|
1153
|
+
case 102:
|
|
1151
1154
|
p.handle = _context5.sent;
|
|
1152
1155
|
mem.env[opt.process].handle = p.handle;
|
|
1153
|
-
case
|
|
1154
|
-
_context5.next =
|
|
1156
|
+
case 104:
|
|
1157
|
+
_context5.next = 106;
|
|
1155
1158
|
return p.handle(p.memory, msg, _env);
|
|
1156
|
-
case
|
|
1159
|
+
case 106:
|
|
1157
1160
|
res = _context5.sent;
|
|
1158
1161
|
p.memory = res.Memory;
|
|
1159
1162
|
delete res.Memory;
|
|
1160
1163
|
p.results.push(id);
|
|
1161
|
-
_context5.next =
|
|
1164
|
+
_context5.next = 112;
|
|
1162
1165
|
return mem.set(p, "env", opt.process);
|
|
1163
|
-
case
|
|
1166
|
+
case 112:
|
|
1164
1167
|
_msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
|
|
1165
1168
|
res: res
|
|
1166
1169
|
});
|
|
1167
|
-
_context5.next =
|
|
1170
|
+
_context5.next = 115;
|
|
1168
1171
|
return mem.set(_msg2, "msgs", id);
|
|
1169
|
-
case
|
|
1172
|
+
case 115:
|
|
1170
1173
|
return _context5.abrupt("return", id);
|
|
1171
|
-
case
|
|
1172
|
-
_context5.prev =
|
|
1173
|
-
_context5.t13 = _context5["catch"](
|
|
1174
|
+
case 118:
|
|
1175
|
+
_context5.prev = 118;
|
|
1176
|
+
_context5.t13 = _context5["catch"](71);
|
|
1174
1177
|
console.log(_context5.t13);
|
|
1175
|
-
case
|
|
1176
|
-
_context5.next =
|
|
1178
|
+
case 121:
|
|
1179
|
+
_context5.next = 125;
|
|
1177
1180
|
break;
|
|
1178
|
-
case
|
|
1179
|
-
_context5.next =
|
|
1181
|
+
case 123:
|
|
1182
|
+
_context5.next = 125;
|
|
1180
1183
|
return _assign({
|
|
1181
1184
|
message_item: item,
|
|
1182
1185
|
message: id,
|
|
@@ -1184,13 +1187,13 @@ var _default = exports["default"] = function _default() {
|
|
|
1184
1187
|
from: owner,
|
|
1185
1188
|
signer: mu.signer
|
|
1186
1189
|
});
|
|
1187
|
-
case
|
|
1190
|
+
case 125:
|
|
1188
1191
|
return _context5.abrupt("return", id);
|
|
1189
|
-
case
|
|
1192
|
+
case 126:
|
|
1190
1193
|
case "end":
|
|
1191
1194
|
return _context5.stop();
|
|
1192
1195
|
}
|
|
1193
|
-
}, _callee5, null, [[
|
|
1196
|
+
}, _callee5, null, [[71, 118]]);
|
|
1194
1197
|
}));
|
|
1195
1198
|
return function message(_x9) {
|
|
1196
1199
|
return _ref11.apply(this, arguments);
|
|
@@ -1674,18 +1677,19 @@ var _default = exports["default"] = function _default() {
|
|
|
1674
1677
|
return p.handle(p.memory, msg, _env);
|
|
1675
1678
|
case 47:
|
|
1676
1679
|
res = _context12.sent;
|
|
1680
|
+
delete res.Memory;
|
|
1677
1681
|
return _context12.abrupt("return", res);
|
|
1678
|
-
case
|
|
1679
|
-
_context12.prev =
|
|
1682
|
+
case 52:
|
|
1683
|
+
_context12.prev = 52;
|
|
1680
1684
|
_context12.t7 = _context12["catch"](14);
|
|
1681
1685
|
console.log(_context12.t7);
|
|
1682
|
-
case 54:
|
|
1683
|
-
return _context12.abrupt("return", null);
|
|
1684
1686
|
case 55:
|
|
1687
|
+
return _context12.abrupt("return", null);
|
|
1688
|
+
case 56:
|
|
1685
1689
|
case "end":
|
|
1686
1690
|
return _context12.stop();
|
|
1687
1691
|
}
|
|
1688
|
-
}, _callee12, null, [[14,
|
|
1692
|
+
}, _callee12, null, [[14, 52]]);
|
|
1689
1693
|
}));
|
|
1690
1694
|
function dryrun(_x16) {
|
|
1691
1695
|
return _dryrun.apply(this, arguments);
|
package/cjs/bao.js
CHANGED
|
@@ -35,6 +35,13 @@ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(
|
|
|
35
35
|
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; } } }; }
|
|
36
36
|
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; } }
|
|
37
37
|
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; }
|
|
38
|
+
var wait = function wait(ms) {
|
|
39
|
+
return new Promise(function (res) {
|
|
40
|
+
return setTimeout(function () {
|
|
41
|
+
return res();
|
|
42
|
+
}, ms);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
38
45
|
var log = "\nlocal json = require(\"json\")\nao = ao or {}\n\nfunction ao.log(...)\n local args = {...}\n local txt = json.encode(args)\n if type(ao.outbox.Output) == 'string' then\n ao.outbox.Output = {ao.outbox.Output}\n end\n table.insert(ao.outbox.Output, txt)\n ao.outbox.Logs = ao.outbox.Logs or {}\n table.insert(ao.outbox.Logs, txt)\nend\n\nfunction ao.result(result)\n if ao.outbox.Error or result.Error then\n return { Error = result.Error or ao.outbox.Error, Output = ao.outbox.Logs }\n end\n return {\n Output = ao.outbox.Logs or result.Output or ao.outbox.Output,\n Messages = ao.outbox.Messages,\n Spawns = ao.outbox.Spawns,\n Assignments = ao.outbox.Assignments,\n }\nend\n";
|
|
39
46
|
var renderLogs = function renderLogs(logs) {
|
|
40
47
|
if ((0, _ramda.is)(Array, logs) && logs.length > 0) {
|
|
@@ -101,9 +108,20 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
101
108
|
return result.apply(void 0, _args);
|
|
102
109
|
case 2:
|
|
103
110
|
res = _context.sent;
|
|
104
|
-
|
|
111
|
+
if (res) {
|
|
112
|
+
_context.next = 9;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
_context.next = 6;
|
|
116
|
+
return wait(100);
|
|
117
|
+
case 6:
|
|
118
|
+
_context.next = 8;
|
|
119
|
+
return result.apply(void 0, _args);
|
|
120
|
+
case 8:
|
|
121
|
+
res = _context.sent;
|
|
122
|
+
case 9:
|
|
105
123
|
return _context.abrupt("return", res);
|
|
106
|
-
case
|
|
124
|
+
case 10:
|
|
107
125
|
case "end":
|
|
108
126
|
return _context.stop();
|
|
109
127
|
}
|
|
@@ -112,41 +130,48 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
112
130
|
_this.results = results;
|
|
113
131
|
_this.message = message;
|
|
114
132
|
_this.spawn = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
115
|
-
var
|
|
133
|
+
var _len,
|
|
134
|
+
opt,
|
|
135
|
+
_key,
|
|
136
|
+
res,
|
|
116
137
|
_args2 = arguments;
|
|
117
138
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
118
139
|
while (1) switch (_context2.prev = _context2.next) {
|
|
119
140
|
case 0:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
141
|
+
for (_len = _args2.length, opt = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
142
|
+
opt[_key] = _args2[_key];
|
|
143
|
+
}
|
|
144
|
+
_context2.next = 3;
|
|
145
|
+
return spawn.apply(void 0, opt);
|
|
146
|
+
case 3:
|
|
123
147
|
res = _context2.sent;
|
|
124
|
-
|
|
148
|
+
if (opt[0].http_msg) {
|
|
149
|
+
_context2.next = 7;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
_context2.next = 7;
|
|
125
153
|
return _this.load({
|
|
126
154
|
data: log,
|
|
127
155
|
pid: res
|
|
128
156
|
});
|
|
129
|
-
case
|
|
157
|
+
case 7:
|
|
130
158
|
return _context2.abrupt("return", res);
|
|
131
|
-
case
|
|
159
|
+
case 8:
|
|
132
160
|
case "end":
|
|
133
161
|
return _context2.stop();
|
|
134
162
|
}
|
|
135
163
|
}, _callee2);
|
|
136
164
|
}));
|
|
137
165
|
_this.dryrun = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
138
|
-
var
|
|
139
|
-
_args3 = arguments;
|
|
166
|
+
var _args3 = arguments;
|
|
140
167
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
141
168
|
while (1) switch (_context3.prev = _context3.next) {
|
|
142
169
|
case 0:
|
|
143
170
|
_context3.next = 2;
|
|
144
171
|
return dryrun.apply(void 0, _args3);
|
|
145
172
|
case 2:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return _context3.abrupt("return", res);
|
|
149
|
-
case 5:
|
|
173
|
+
return _context3.abrupt("return", _context3.sent);
|
|
174
|
+
case 3:
|
|
150
175
|
case "end":
|
|
151
176
|
return _context3.stop();
|
|
152
177
|
}
|
package/cjs/bar.js
CHANGED
|
@@ -92,7 +92,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
92
92
|
}, {
|
|
93
93
|
key: "httpmsg",
|
|
94
94
|
value: function () {
|
|
95
|
-
var _httpmsg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg
|
|
95
|
+
var _httpmsg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
|
|
96
96
|
var tags, owner, _parseSignatureInput, n, _tags$Owner;
|
|
97
97
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
98
98
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -114,30 +114,22 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
114
114
|
_context.t0 = _context["catch"](2);
|
|
115
115
|
owner = (_tags$Owner = tags.Owner) !== null && _tags$Owner !== void 0 ? _tags$Owner : null;
|
|
116
116
|
case 12:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
_context.next = 15;
|
|
122
|
-
return this.mem.set(msg, "txs", id);
|
|
123
|
-
case 15:
|
|
124
|
-
_context.next = 18;
|
|
125
|
-
break;
|
|
126
|
-
case 17:
|
|
127
|
-
console.log("id missing");
|
|
128
|
-
case 18:
|
|
117
|
+
_context.next = 14;
|
|
118
|
+
return this.mem.set(msg, "txs", msg.id);
|
|
119
|
+
case 14:
|
|
129
120
|
return _context.abrupt("return", {
|
|
130
121
|
item: msg,
|
|
122
|
+
id: tags.id,
|
|
131
123
|
tags: tags,
|
|
132
124
|
owner: owner
|
|
133
125
|
});
|
|
134
|
-
case
|
|
126
|
+
case 15:
|
|
135
127
|
case "end":
|
|
136
128
|
return _context.stop();
|
|
137
129
|
}
|
|
138
130
|
}, _callee, this, [[2, 9]]);
|
|
139
131
|
}));
|
|
140
|
-
function httpmsg(_x
|
|
132
|
+
function httpmsg(_x) {
|
|
141
133
|
return _httpmsg.apply(this, arguments);
|
|
142
134
|
}
|
|
143
135
|
return httpmsg;
|
|
@@ -163,7 +155,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
163
155
|
}
|
|
164
156
|
}, _callee2);
|
|
165
157
|
}));
|
|
166
|
-
function owner(
|
|
158
|
+
function owner(_x2) {
|
|
167
159
|
return _owner.apply(this, arguments);
|
|
168
160
|
}
|
|
169
161
|
return owner;
|
|
@@ -219,7 +211,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
219
211
|
}
|
|
220
212
|
}, _callee3, this);
|
|
221
213
|
}));
|
|
222
|
-
function dataitem(
|
|
214
|
+
function dataitem(_x3) {
|
|
223
215
|
return _dataitem.apply(this, arguments);
|
|
224
216
|
}
|
|
225
217
|
return dataitem;
|
|
@@ -277,7 +269,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
277
269
|
}
|
|
278
270
|
}, _callee4, this);
|
|
279
271
|
}));
|
|
280
|
-
function post(
|
|
272
|
+
function post(_x4) {
|
|
281
273
|
return _post.apply(this, arguments);
|
|
282
274
|
}
|
|
283
275
|
return post;
|
|
@@ -418,7 +410,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
418
410
|
}
|
|
419
411
|
}, _callee5, this, [[11, 51, 54, 57]]);
|
|
420
412
|
}));
|
|
421
|
-
function postItems(
|
|
413
|
+
function postItems(_x5, _x6) {
|
|
422
414
|
return _postItems.apply(this, arguments);
|
|
423
415
|
}
|
|
424
416
|
return postItems;
|
|
@@ -675,7 +667,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
675
667
|
}
|
|
676
668
|
}, _callee6, this, [[41, 62, 65, 68]]);
|
|
677
669
|
}));
|
|
678
|
-
function postTx(
|
|
670
|
+
function postTx(_x7, _x8) {
|
|
679
671
|
return _postTx.apply(this, arguments);
|
|
680
672
|
}
|
|
681
673
|
return postTx;
|
|
@@ -697,7 +689,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
697
689
|
}
|
|
698
690
|
}, _callee7, this);
|
|
699
691
|
}));
|
|
700
|
-
function tx(
|
|
692
|
+
function tx(_x9) {
|
|
701
693
|
return _tx.apply(this, arguments);
|
|
702
694
|
}
|
|
703
695
|
return tx;
|
|
@@ -760,7 +752,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
760
752
|
}
|
|
761
753
|
}, _callee8, this);
|
|
762
754
|
}));
|
|
763
|
-
function data(_x11, _x12
|
|
755
|
+
function data(_x10, _x11, _x12) {
|
|
764
756
|
return _data2.apply(this, arguments);
|
|
765
757
|
}
|
|
766
758
|
return data;
|
package/esm/aoconnect-base.js
CHANGED
|
@@ -60,10 +60,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
60
60
|
|
|
61
61
|
return output
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
const genMsg = async (Id, p, data, Tags, from, Owner, dry = false) => {
|
|
65
|
-
if (!dry) p.height += 1
|
|
66
|
-
let __tags = Tags?.length ? Tags : []
|
|
63
|
+
const capitalize = __tags => {
|
|
67
64
|
let cap = {
|
|
68
65
|
authority: "Authority",
|
|
69
66
|
action: "Action",
|
|
@@ -72,6 +69,12 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
72
69
|
module: "Module",
|
|
73
70
|
}
|
|
74
71
|
for (let v of __tags) v.name = cap[v.name] ?? v.name
|
|
72
|
+
return __tags
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const genMsg = async (Id, p, data, Tags, from, Owner, dry = false) => {
|
|
76
|
+
if (!dry) p.height += 1
|
|
77
|
+
let __tags = Tags?.length ? Tags : []
|
|
75
78
|
return {
|
|
76
79
|
Id,
|
|
77
80
|
Target: p.id,
|
|
@@ -82,7 +85,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
82
85
|
Module: p.module,
|
|
83
86
|
From: from,
|
|
84
87
|
Cron: false,
|
|
85
|
-
Tags: __tags,
|
|
88
|
+
Tags: capitalize(__tags),
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
|
|
@@ -90,12 +93,12 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
90
93
|
return {
|
|
91
94
|
Process: {
|
|
92
95
|
Id: pid,
|
|
93
|
-
Tags: (await mem.getTx(pid))?.tags ?? [],
|
|
96
|
+
Tags: capitalize((await mem.getTx(pid))?.tags ?? []),
|
|
94
97
|
Owner: owner,
|
|
95
98
|
},
|
|
96
99
|
Module: {
|
|
97
100
|
Id: module,
|
|
98
|
-
Tags: (await mem.getTx(module))?.tags ?? [],
|
|
101
|
+
Tags: capitalize((await mem.getTx(module))?.tags ?? []),
|
|
99
102
|
},
|
|
100
103
|
}
|
|
101
104
|
}
|
|
@@ -380,7 +383,6 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
380
383
|
const new_slot = opt.slot * 1
|
|
381
384
|
const last_slot = !p ? -1 : p.results.length - 1
|
|
382
385
|
if (last_slot + 1 !== new_slot) {
|
|
383
|
-
console.log("need process recovery from HB:", opt.process)
|
|
384
386
|
if (!hb || opt.recovery) return null
|
|
385
387
|
await recover(opt.process)
|
|
386
388
|
}
|
|
@@ -539,6 +541,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
539
541
|
}
|
|
540
542
|
|
|
541
543
|
const result = async opt => (await mem.get("msgs", opt.message))?.res
|
|
544
|
+
|
|
542
545
|
return {
|
|
543
546
|
message,
|
|
544
547
|
unmonitor: async opt => {
|
|
@@ -628,6 +631,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
|
|
|
628
631
|
mem.env[opt.process].handle = p.handle
|
|
629
632
|
}
|
|
630
633
|
const res = await p.handle(p.memory, msg, _env)
|
|
634
|
+
delete res.Memory
|
|
631
635
|
return res
|
|
632
636
|
} catch (e) {
|
|
633
637
|
console.log(e)
|
package/esm/bao.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createDataItemSigner } from "@permaweb/aoconnect"
|
|
|
3
3
|
import { srcs, buildTags } from "./utils.js"
|
|
4
4
|
import { mergeLeft, is, map } from "ramda"
|
|
5
5
|
|
|
6
|
+
const wait = ms => new Promise(res => setTimeout(() => res(), ms))
|
|
6
7
|
let log = `
|
|
7
8
|
local json = require("json")
|
|
8
9
|
ao = ao or {}
|
|
@@ -73,8 +74,11 @@ class AO extends MAO {
|
|
|
73
74
|
this.recover = recover
|
|
74
75
|
this.assign = assign
|
|
75
76
|
this.result = async (...opt) => {
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
let res = await result(...opt)
|
|
78
|
+
if (!res) {
|
|
79
|
+
await wait(100) // todo: why do we need to wait?
|
|
80
|
+
res = await result(...opt)
|
|
81
|
+
}
|
|
78
82
|
return res
|
|
79
83
|
}
|
|
80
84
|
|
|
@@ -82,14 +86,13 @@ class AO extends MAO {
|
|
|
82
86
|
this.message = message
|
|
83
87
|
this.spawn = async (...opt) => {
|
|
84
88
|
const res = await spawn(...opt)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.dryrun = async (...opt) => {
|
|
89
|
-
const res = await dryrun(...opt)
|
|
90
|
-
renderLogs(res.Output)
|
|
89
|
+
if (!opt[0].http_msg) {
|
|
90
|
+
await this.load({ data: log, pid: res })
|
|
91
|
+
}
|
|
91
92
|
return res
|
|
92
93
|
}
|
|
94
|
+
this.dryrun = async (...opt) => await dryrun(...opt)
|
|
95
|
+
|
|
93
96
|
this.monitor = monitor
|
|
94
97
|
this.unmonitor = unmonitor
|
|
95
98
|
this.mem = mem
|
package/esm/bar.js
CHANGED
|
@@ -35,7 +35,7 @@ class AR extends MAR {
|
|
|
35
35
|
}
|
|
36
36
|
return false
|
|
37
37
|
}
|
|
38
|
-
async httpmsg(msg
|
|
38
|
+
async httpmsg(msg) {
|
|
39
39
|
const tags = t(msg.tags)
|
|
40
40
|
let owner = null
|
|
41
41
|
try {
|
|
@@ -44,9 +44,8 @@ class AR extends MAR {
|
|
|
44
44
|
} catch (e) {
|
|
45
45
|
owner = tags.Owner ?? null
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return { item: msg, tags, owner }
|
|
47
|
+
await this.mem.set(msg, "txs", msg.id)
|
|
48
|
+
return { item: msg, id: tags.id, tags, owner }
|
|
50
49
|
}
|
|
51
50
|
async owner(di) {
|
|
52
51
|
return base64url.encode(
|