wao 0.13.7 → 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.
@@ -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 = 12;
140
+ _context.next = 9;
141
141
  return mem.get("height");
142
- case 12:
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 18:
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.next = 4;
179
+ _context2.t1 = capitalize;
180
+ _context2.next = 5;
180
181
  return mem.getTx(pid);
181
- case 4:
182
- _context2.t3 = _yield$mem$getTx = _context2.sent;
183
- _context2.t2 = _context2.t3 === null;
184
- if (_context2.t2) {
185
- _context2.next = 8;
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.t2 = _yield$mem$getTx === void 0;
189
- case 8:
190
- if (!_context2.t2) {
191
- _context2.next = 12;
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.t4 = void 0;
195
- _context2.next = 13;
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$tags = _context2.t4;
201
- _context2.t1 = _context2.t5 !== null;
202
- if (!_context2.t1) {
203
- _context2.next = 17;
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.t1 = _yield$mem$getTx$tags !== void 0;
207
- case 17:
208
- if (!_context2.t1) {
209
- _context2.next = 21;
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.t6 = _yield$mem$getTx$tags;
213
- _context2.next = 22;
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 = _context2.t6;
219
- _context2.t8 = owner;
220
- _context2.t9 = {
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.t7,
223
- Owner: _context2.t8
224
+ Tags: _context2.t9,
225
+ Owner: _context2.t10
224
226
  };
225
- _context2.t10 = module;
226
- _context2.next = 28;
227
+ _context2.t12 = module;
228
+ _context2.t13 = capitalize;
229
+ _context2.next = 31;
227
230
  return mem.getTx(module);
228
- case 28:
229
- _context2.t13 = _yield$mem$getTx2 = _context2.sent;
230
- _context2.t12 = _context2.t13 === null;
231
- if (_context2.t12) {
232
- _context2.next = 32;
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.t12 = _yield$mem$getTx2 === void 0;
236
- case 32:
237
- if (!_context2.t12) {
238
- _context2.next = 36;
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.t14 = void 0;
242
- _context2.next = 37;
244
+ _context2.t17 = void 0;
245
+ _context2.next = 40;
243
246
  break;
244
- case 36:
245
- _context2.t14 = _yield$mem$getTx2.tags;
246
- case 37:
247
- _context2.t15 = _yield$mem$getTx$tags2 = _context2.t14;
248
- _context2.t11 = _context2.t15 !== null;
249
- if (!_context2.t11) {
250
- _context2.next = 41;
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.t11 = _yield$mem$getTx$tags2 !== void 0;
254
- case 41:
255
- if (!_context2.t11) {
256
- _context2.next = 45;
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.t16 = _yield$mem$getTx$tags2;
260
- _context2.next = 46;
262
+ _context2.t19 = _yield$mem$getTx$tags2;
263
+ _context2.next = 49;
261
264
  break;
262
- case 45:
263
- _context2.t16 = [];
264
- case 46:
265
- _context2.t17 = _context2.t16;
266
- _context2.t18 = {
267
- Id: _context2.t10,
268
- Tags: _context2.t17
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.t9,
272
- Module: _context2.t18
275
+ Process: _context2.t11,
276
+ Module: _context2.t22
273
277
  });
274
- case 49:
278
+ case 53:
275
279
  case "end":
276
280
  return _context2.stop();
277
281
  }
@@ -351,24 +355,23 @@ var _default = exports["default"] = function _default() {
351
355
  format = _yield$mem$getWasm.format;
352
356
  msg_owner = mu.addr;
353
357
  if (!ar.isHttpMsg(opt.http_msg)) {
354
- _context3.next = 26;
358
+ _context3.next = 25;
355
359
  break;
356
360
  }
357
- ;
361
+ id = opt.http_msg.target;
358
362
  _context3.next = 16;
359
- return ar.httpmsg(opt.http_msg);
363
+ return ar.httpmsg(opt.http_msg, id);
360
364
  case 16:
361
365
  _yield$ar$httpmsg = _context3.sent;
362
366
  owner = _yield$ar$httpmsg.owner;
363
367
  item = _yield$ar$httpmsg.item;
364
368
  __tags = _yield$ar$httpmsg.tags;
365
- id = opt.http_msg.target;
366
369
  opt.tags = (0, _utils.buildTags)(null, __tags);
367
370
  opt.data = opt.http_msg.data;
368
371
  msg_owner = owner;
369
- _context3.next = 43;
372
+ _context3.next = 42;
370
373
  break;
371
- case 26:
374
+ case 25:
372
375
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
373
376
  "Data-Protocol": "ao",
374
377
  Variant: "ao.TN.1",
@@ -399,14 +402,14 @@ var _default = exports["default"] = function _default() {
399
402
  name: "Pushed-For",
400
403
  value: opt["for"]
401
404
  });
402
- _context3.next = 34;
405
+ _context3.next = 33;
403
406
  return ar.dataitem({
404
407
  item: opt.item,
405
408
  data: opt.data,
406
409
  signer: opt.signer,
407
410
  tags: (0, _utils.tags)(opt.tags)
408
411
  });
409
- case 34:
412
+ case 33:
410
413
  _yield$ar$dataitem = _context3.sent;
411
414
  id = _yield$ar$dataitem.id;
412
415
  owner = _yield$ar$dataitem.owner;
@@ -414,23 +417,23 @@ var _default = exports["default"] = function _default() {
414
417
  __tags = _yield$ar$dataitem.tags;
415
418
  opt.tags = (0, _utils.buildTags)(null, __tags);
416
419
  if (opt.item) opt.data = _base64url["default"].decode(item.data);
417
- _context3.next = 43;
420
+ _context3.next = 42;
418
421
  return ar.postItems(item, su.jwk);
419
- case 43:
422
+ case 42:
420
423
  now = Date.now;
421
424
  t = (0, _utils.tags)(opt.tags);
422
425
  ext = t.Extension || "WeaveDrive";
423
426
  wdrive = extensions[ext];
424
427
  handle = null;
425
- _context3.prev = 48;
428
+ _context3.prev = 47;
426
429
  _context3.t0 = AoLoader;
427
430
  _context3.t1 = wasm;
428
431
  _context3.t2 = format;
429
432
  _context3.t3 = wdrive;
430
433
  _context3.t4 = item;
431
- _context3.next = 56;
434
+ _context3.next = 55;
432
435
  return mem.getTx(mod);
433
- case 56:
436
+ case 55:
434
437
  _context3.t5 = _context3.sent;
435
438
  _context3.t6 = {
436
439
  format: _context3.t2,
@@ -438,23 +441,23 @@ var _default = exports["default"] = function _default() {
438
441
  spawn: _context3.t4,
439
442
  module: _context3.t5
440
443
  };
441
- _context3.next = 60;
444
+ _context3.next = 59;
442
445
  return (0, _context3.t0)(_context3.t1, _context3.t6);
443
- case 60:
446
+ case 59:
444
447
  handle = _context3.sent;
445
- _context3.next = 66;
448
+ _context3.next = 65;
446
449
  break;
447
- case 63:
448
- _context3.prev = 63;
449
- _context3.t7 = _context3["catch"](48);
450
+ case 62:
451
+ _context3.prev = 62;
452
+ _context3.t7 = _context3["catch"](47);
450
453
  console.log(mod, _context3.t7);
451
- case 66:
454
+ case 65:
452
455
  if (handle) {
453
- _context3.next = 68;
456
+ _context3.next = 67;
454
457
  break;
455
458
  }
456
459
  return _context3.abrupt("return", null);
457
- case 68:
460
+ case 67:
458
461
  _module = null;
459
462
  _module = {
460
463
  handle: handle,
@@ -478,126 +481,126 @@ var _default = exports["default"] = function _default() {
478
481
  results: [id]
479
482
  };
480
483
  if (!memory) {
481
- _context3.next = 78;
484
+ _context3.next = 77;
482
485
  break;
483
486
  }
484
- _context3.next = 119;
487
+ _context3.next = 118;
485
488
  break;
486
- case 78:
489
+ case 77:
487
490
  if (!(_tags["On-Boot"] || true)) {
488
- _context3.next = 118;
491
+ _context3.next = 117;
489
492
  break;
490
493
  }
491
494
  data = "";
492
495
  if (!(_tags["On-Boot"] === "Data")) {
493
- _context3.next = 84;
496
+ _context3.next = 83;
494
497
  break;
495
498
  }
496
499
  data = (_opt$data = opt.data) !== null && _opt$data !== void 0 ? _opt$data : "";
497
- _context3.next = 105;
500
+ _context3.next = 104;
498
501
  break;
499
- case 84:
500
- _context3.next = 86;
502
+ case 83:
503
+ _context3.next = 85;
501
504
  return mem.get("msgs", _tags["On-Boot"]);
502
- case 86:
505
+ case 85:
503
506
  _context3.t10 = _yield$mem$get = _context3.sent;
504
507
  _context3.t9 = _context3.t10 === null;
505
508
  if (_context3.t9) {
506
- _context3.next = 90;
509
+ _context3.next = 89;
507
510
  break;
508
511
  }
509
512
  _context3.t9 = _yield$mem$get === void 0;
510
- case 90:
513
+ case 89:
511
514
  if (!_context3.t9) {
512
- _context3.next = 94;
515
+ _context3.next = 93;
513
516
  break;
514
517
  }
515
518
  _context3.t11 = void 0;
516
- _context3.next = 95;
519
+ _context3.next = 94;
517
520
  break;
518
- case 94:
521
+ case 93:
519
522
  _context3.t11 = _yield$mem$get.data;
520
- case 95:
523
+ case 94:
521
524
  _context3.t12 = _yield$mem$get$data = _context3.t11;
522
525
  _context3.t8 = _context3.t12 !== null;
523
526
  if (!_context3.t8) {
524
- _context3.next = 99;
527
+ _context3.next = 98;
525
528
  break;
526
529
  }
527
530
  _context3.t8 = _yield$mem$get$data !== void 0;
528
- case 99:
531
+ case 98:
529
532
  if (!_context3.t8) {
530
- _context3.next = 103;
533
+ _context3.next = 102;
531
534
  break;
532
535
  }
533
536
  _context3.t13 = _yield$mem$get$data;
534
- _context3.next = 104;
537
+ _context3.next = 103;
535
538
  break;
536
- case 103:
539
+ case 102:
537
540
  _context3.t13 = "";
538
- case 104:
541
+ case 103:
539
542
  data = _context3.t13;
540
- case 105:
541
- _context3.next = 107;
543
+ case 104:
544
+ _context3.next = 106;
542
545
  return genMsg(id, p, data, opt.tags, owner, msg_owner, true);
543
- case 107:
546
+ case 106:
544
547
  msg = _context3.sent;
545
- _context3.next = 110;
548
+ _context3.next = 109;
546
549
  return genEnv({
547
550
  pid: p.id,
548
551
  owner: p.owner,
549
552
  module: p.module
550
553
  });
551
- case 110:
554
+ case 109:
552
555
  _env = _context3.sent;
553
- _context3.next = 113;
556
+ _context3.next = 112;
554
557
  return _module.handle(null, msg, _env);
555
- case 113:
558
+ case 112:
556
559
  res = _context3.sent;
557
560
  p.memory = res.Memory;
558
561
  delete res.Memory;
559
- _context3.next = 119;
562
+ _context3.next = 118;
560
563
  break;
561
- case 118:
564
+ case 117:
562
565
  p.height += 1;
563
- case 119:
566
+ case 118:
564
567
  _msg = _objectSpread(_objectSpread({}, (0, _ramda.o)((0, _ramda.dissoc)("signer"), (0, _ramda.dissoc)("memory"))(opt)), {}, {
565
568
  res: res
566
569
  });
567
- _context3.next = 122;
570
+ _context3.next = 121;
568
571
  return mem.set(_msg, "msgs", id);
569
- case 122:
572
+ case 121:
570
573
  if (!_tags["Cron-Interval"]) {
571
- _context3.next = 146;
574
+ _context3.next = 145;
572
575
  break;
573
576
  }
574
577
  _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];
575
578
  _int = 0;
576
579
  _context3.t14 = unit.replace(/s$/, "");
577
- _context3.next = _context3.t14 === "millisecond" ? 128 : _context3.t14 === "second" ? 130 : _context3.t14 === "minute" ? 132 : _context3.t14 === "hour" ? 134 : _context3.t14 === "day" ? 136 : _context3.t14 === "month" ? 138 : _context3.t14 === "year" ? 140 : 142;
580
+ _context3.next = _context3.t14 === "millisecond" ? 127 : _context3.t14 === "second" ? 129 : _context3.t14 === "minute" ? 131 : _context3.t14 === "hour" ? 133 : _context3.t14 === "day" ? 135 : _context3.t14 === "month" ? 137 : _context3.t14 === "year" ? 139 : 141;
578
581
  break;
579
- case 128:
582
+ case 127:
580
583
  _int = num;
581
- return _context3.abrupt("break", 142);
582
- case 130:
584
+ return _context3.abrupt("break", 141);
585
+ case 129:
583
586
  _int = num * 1000;
584
- return _context3.abrupt("break", 142);
585
- case 132:
587
+ return _context3.abrupt("break", 141);
588
+ case 131:
586
589
  _int = num * 1000 * 60;
587
- return _context3.abrupt("break", 142);
588
- case 134:
590
+ return _context3.abrupt("break", 141);
591
+ case 133:
589
592
  _int = num * 1000 * 60 * 60;
590
- return _context3.abrupt("break", 142);
591
- case 136:
593
+ return _context3.abrupt("break", 141);
594
+ case 135:
592
595
  _int = num * 1000 * 60 * 60 * 24;
593
- return _context3.abrupt("break", 142);
594
- case 138:
596
+ return _context3.abrupt("break", 141);
597
+ case 137:
595
598
  _int = num * 1000 * 60 * 60 * 24 * 30;
596
- return _context3.abrupt("break", 142);
597
- case 140:
599
+ return _context3.abrupt("break", 141);
600
+ case 139:
598
601
  _int = num * 1000 * 60 * 60 * 24 * 365;
599
- return _context3.abrupt("break", 142);
600
- case 142:
602
+ return _context3.abrupt("break", 141);
603
+ case 141:
601
604
  cronTags = [];
602
605
  for (_k in _tags) {
603
606
  if (/^Cron-Tag-/.test(_k)) {
@@ -609,16 +612,16 @@ var _default = exports["default"] = function _default() {
609
612
  }
610
613
  p.cronTags = cronTags;
611
614
  p.span = _int;
612
- case 146:
613
- _context3.next = 148;
615
+ case 145:
616
+ _context3.next = 147;
614
617
  return mem.set(p, "env", id);
615
- case 148:
618
+ case 147:
616
619
  return _context3.abrupt("return", id);
617
- case 149:
620
+ case 148:
618
621
  case "end":
619
622
  return _context3.stop();
620
623
  }
621
- }, _callee3, null, [[48, 63]]);
624
+ }, _callee3, null, [[47, 62]]);
622
625
  }));
623
626
  return function spawn() {
624
627
  return _ref8.apply(this, arguments);
@@ -960,56 +963,54 @@ var _default = exports["default"] = function _default() {
960
963
  owner = "";
961
964
  item = null;
962
965
  if (!ar.isHttpMsg(opt.http_msg)) {
963
- _context5.next = 24;
966
+ _context5.next = 22;
964
967
  break;
965
968
  }
966
- ;
969
+ id = opt.http_msg.target;
967
970
  _context5.next = 7;
968
- return ar.httpmsg(opt.http_msg);
971
+ return ar.httpmsg(opt.http_msg, id);
969
972
  case 7:
970
973
  _yield$ar$httpmsg2 = _context5.sent;
971
- id = _yield$ar$httpmsg2.id;
972
974
  owner = _yield$ar$httpmsg2.owner;
973
975
  item = _yield$ar$httpmsg2.item;
974
- _context5.next = 13;
976
+ _context5.next = 12;
975
977
  return mem.get("env", opt.process);
976
- case 13:
978
+ case 12:
977
979
  _p = _context5.sent;
978
980
  new_slot = opt.slot * 1;
979
981
  last_slot = !_p ? -1 : _p.results.length - 1;
980
982
  if (!(last_slot + 1 !== new_slot)) {
981
- _context5.next = 22;
983
+ _context5.next = 20;
982
984
  break;
983
985
  }
984
- console.log("need process recovery from HB:", opt.process);
985
986
  if (!(!hb || opt.recovery)) {
986
- _context5.next = 20;
987
+ _context5.next = 18;
987
988
  break;
988
989
  }
989
990
  return _context5.abrupt("return", null);
990
- case 20:
991
- _context5.next = 22;
991
+ case 18:
992
+ _context5.next = 20;
992
993
  return _recover(opt.process);
993
- case 22:
994
- _context5.next = 27;
994
+ case 20:
995
+ _context5.next = 25;
995
996
  break;
996
- case 24:
997
+ case 22:
997
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 : "";
998
999
  _owner = (_opt$owner = opt.owner) !== null && _opt$owner !== void 0 ? _opt$owner : "";
999
1000
  _item = opt.item;
1000
- case 27:
1001
- _context5.next = 29;
1001
+ case 25:
1002
+ _context5.next = 27;
1002
1003
  return mem.get("env", opt.process);
1003
- case 29:
1004
+ case 27:
1004
1005
  p = _context5.sent;
1005
1006
  if (p) {
1006
- _context5.next = 32;
1007
+ _context5.next = 30;
1007
1008
  break;
1008
1009
  }
1009
1010
  return _context5.abrupt("return", null);
1010
- case 32:
1011
+ case 30:
1011
1012
  if (!(!opt.item && opt.signer)) {
1012
- _context5.next = 67;
1013
+ _context5.next = 65;
1013
1014
  break;
1014
1015
  }
1015
1016
  opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
@@ -1019,7 +1020,7 @@ var _default = exports["default"] = function _default() {
1019
1020
  SDK: "aoconnect"
1020
1021
  }));
1021
1022
  if (!opt["for"]) {
1022
- _context5.next = 60;
1023
+ _context5.next = 58;
1023
1024
  break;
1024
1025
  }
1025
1026
  opt.tags.push({
@@ -1030,100 +1031,100 @@ var _default = exports["default"] = function _default() {
1030
1031
  name: "From-Process",
1031
1032
  value: opt.from
1032
1033
  });
1033
- _context5.next = 39;
1034
+ _context5.next = 37;
1034
1035
  return mem.getTx(opt.from);
1035
- case 39:
1036
+ case 37:
1036
1037
  _context5.t2 = _yield$mem$getTx3 = _context5.sent;
1037
1038
  _context5.t1 = _context5.t2 === null;
1038
1039
  if (_context5.t1) {
1039
- _context5.next = 43;
1040
+ _context5.next = 41;
1040
1041
  break;
1041
1042
  }
1042
1043
  _context5.t1 = _yield$mem$getTx3 === void 0;
1043
- case 43:
1044
+ case 41:
1044
1045
  if (!_context5.t1) {
1045
- _context5.next = 47;
1046
+ _context5.next = 45;
1046
1047
  break;
1047
1048
  }
1048
1049
  _context5.t3 = void 0;
1049
- _context5.next = 48;
1050
+ _context5.next = 46;
1050
1051
  break;
1051
- case 47:
1052
+ case 45:
1052
1053
  _context5.t3 = _yield$mem$getTx3.tags;
1053
- case 48:
1054
+ case 46:
1054
1055
  _context5.t4 = _yield$mem$getTx$tags3 = _context5.t3;
1055
1056
  _context5.t0 = _context5.t4 !== null;
1056
1057
  if (!_context5.t0) {
1057
- _context5.next = 52;
1058
+ _context5.next = 50;
1058
1059
  break;
1059
1060
  }
1060
1061
  _context5.t0 = _yield$mem$getTx$tags3 !== void 0;
1061
- case 52:
1062
+ case 50:
1062
1063
  if (!_context5.t0) {
1063
- _context5.next = 56;
1064
+ _context5.next = 54;
1064
1065
  break;
1065
1066
  }
1066
1067
  _context5.t5 = _yield$mem$getTx$tags3;
1067
- _context5.next = 57;
1068
+ _context5.next = 55;
1068
1069
  break;
1069
- case 56:
1070
+ case 54:
1070
1071
  _context5.t5 = [];
1071
- case 57:
1072
+ case 55:
1072
1073
  pr = _context5.t5;
1073
1074
  module = (0, _utils.tags)(pr).Module;
1074
1075
  if (module) opt.tags.push({
1075
1076
  name: "From-Module",
1076
1077
  value: module
1077
1078
  });
1078
- case 60:
1079
+ case 58:
1079
1080
  ;
1080
- _context5.next = 63;
1081
+ _context5.next = 61;
1081
1082
  return ar.dataitem({
1082
1083
  data: opt.data,
1083
1084
  signer: opt.signer,
1084
1085
  tags: (0, _utils.tags)(opt.tags),
1085
1086
  target: opt.process
1086
1087
  });
1087
- case 63:
1088
+ case 61:
1088
1089
  _yield$ar$dataitem3 = _context5.sent;
1089
1090
  item = _yield$ar$dataitem3.item;
1090
1091
  id = _yield$ar$dataitem3.id;
1091
1092
  owner = _yield$ar$dataitem3.owner;
1092
- case 67:
1093
+ case 65:
1093
1094
  _msg = (0, _ramda.dissoc)("signer", opt);
1094
- _context5.next = 70;
1095
+ _context5.next = 68;
1095
1096
  return mem.set(_msg, "msgs", id);
1096
- case 70:
1097
+ case 68:
1097
1098
  if (!ar.isHttpMsg(opt.http_msg)) {
1098
- _context5.next = 125;
1099
+ _context5.next = 123;
1099
1100
  break;
1100
1101
  }
1101
1102
  p.epochs.push([id]);
1102
1103
  _opt = opt;
1103
- _context5.prev = 73;
1104
+ _context5.prev = 71;
1104
1105
  // todo: not sure if this is correct
1105
1106
  from = (_ref12 = (_opt$from2 = _opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : opt.from) !== null && _ref12 !== void 0 ? _ref12 : owner;
1106
1107
  data = (_opt$http_msg$data = opt.http_msg.data) !== null && _opt$http_msg$data !== void 0 ? _opt$http_msg$data : "";
1107
1108
  _tags = _opt.http_msg.tags; // todo: check if owner=mu.addr right?
1108
- _context5.next = 79;
1109
+ _context5.next = 77;
1109
1110
  return genMsg(opt.http_msg, p, data, _tags, from, owner);
1110
- case 79:
1111
+ case 77:
1111
1112
  msg = _context5.sent;
1112
- _context5.next = 82;
1113
+ _context5.next = 80;
1113
1114
  return genEnv({
1114
1115
  pid: p.id,
1115
1116
  owner: p.owner,
1116
1117
  module: p.module
1117
1118
  });
1118
- case 82:
1119
+ case 80:
1119
1120
  _env = _context5.sent;
1120
1121
  if (p.handle) {
1121
- _context5.next = 106;
1122
+ _context5.next = 104;
1122
1123
  break;
1123
1124
  }
1124
- _context5.next = 86;
1125
+ _context5.next = 84;
1125
1126
  return mem.getWasm(p.modulea);
1126
- case 86:
1127
+ case 84:
1127
1128
  _yield$mem$getWasm3 = _context5.sent;
1128
1129
  format = _yield$mem$getWasm3.format;
1129
1130
  mod = _yield$mem$getWasm3.mod;
@@ -1133,13 +1134,13 @@ var _default = exports["default"] = function _default() {
1133
1134
  _context5.t7 = wasm;
1134
1135
  _context5.t8 = format;
1135
1136
  _context5.t9 = wdrive;
1136
- _context5.next = 97;
1137
+ _context5.next = 95;
1137
1138
  return mem.getTx(p.id);
1138
- case 97:
1139
+ case 95:
1139
1140
  _context5.t10 = _context5.sent.item;
1140
- _context5.next = 100;
1141
+ _context5.next = 98;
1141
1142
  return mem.getTx(mod);
1142
- case 100:
1143
+ case 98:
1143
1144
  _context5.t11 = _context5.sent;
1144
1145
  _context5.t12 = {
1145
1146
  format: _context5.t8,
@@ -1147,38 +1148,38 @@ var _default = exports["default"] = function _default() {
1147
1148
  spawn: _context5.t10,
1148
1149
  module: _context5.t11
1149
1150
  };
1150
- _context5.next = 104;
1151
+ _context5.next = 102;
1151
1152
  return (0, _context5.t6)(_context5.t7, _context5.t12);
1152
- case 104:
1153
+ case 102:
1153
1154
  p.handle = _context5.sent;
1154
1155
  mem.env[opt.process].handle = p.handle;
1155
- case 106:
1156
- _context5.next = 108;
1156
+ case 104:
1157
+ _context5.next = 106;
1157
1158
  return p.handle(p.memory, msg, _env);
1158
- case 108:
1159
+ case 106:
1159
1160
  res = _context5.sent;
1160
1161
  p.memory = res.Memory;
1161
1162
  delete res.Memory;
1162
1163
  p.results.push(id);
1163
- _context5.next = 114;
1164
+ _context5.next = 112;
1164
1165
  return mem.set(p, "env", opt.process);
1165
- case 114:
1166
+ case 112:
1166
1167
  _msg2 = _objectSpread(_objectSpread({}, (0, _ramda.dissoc)("signer", _opt)), {}, {
1167
1168
  res: res
1168
1169
  });
1169
- _context5.next = 117;
1170
+ _context5.next = 115;
1170
1171
  return mem.set(_msg2, "msgs", id);
1171
- case 117:
1172
+ case 115:
1172
1173
  return _context5.abrupt("return", id);
1173
- case 120:
1174
- _context5.prev = 120;
1175
- _context5.t13 = _context5["catch"](73);
1174
+ case 118:
1175
+ _context5.prev = 118;
1176
+ _context5.t13 = _context5["catch"](71);
1176
1177
  console.log(_context5.t13);
1177
- case 123:
1178
- _context5.next = 127;
1178
+ case 121:
1179
+ _context5.next = 125;
1179
1180
  break;
1180
- case 125:
1181
- _context5.next = 127;
1181
+ case 123:
1182
+ _context5.next = 125;
1182
1183
  return _assign({
1183
1184
  message_item: item,
1184
1185
  message: id,
@@ -1186,13 +1187,13 @@ var _default = exports["default"] = function _default() {
1186
1187
  from: owner,
1187
1188
  signer: mu.signer
1188
1189
  });
1189
- case 127:
1190
+ case 125:
1190
1191
  return _context5.abrupt("return", id);
1191
- case 128:
1192
+ case 126:
1192
1193
  case "end":
1193
1194
  return _context5.stop();
1194
1195
  }
1195
- }, _callee5, null, [[73, 120]]);
1196
+ }, _callee5, null, [[71, 118]]);
1196
1197
  }));
1197
1198
  return function message(_x9) {
1198
1199
  return _ref11.apply(this, arguments);
@@ -1676,18 +1677,19 @@ var _default = exports["default"] = function _default() {
1676
1677
  return p.handle(p.memory, msg, _env);
1677
1678
  case 47:
1678
1679
  res = _context12.sent;
1680
+ delete res.Memory;
1679
1681
  return _context12.abrupt("return", res);
1680
- case 51:
1681
- _context12.prev = 51;
1682
+ case 52:
1683
+ _context12.prev = 52;
1682
1684
  _context12.t7 = _context12["catch"](14);
1683
1685
  console.log(_context12.t7);
1684
- case 54:
1685
- return _context12.abrupt("return", null);
1686
1686
  case 55:
1687
+ return _context12.abrupt("return", null);
1688
+ case 56:
1687
1689
  case "end":
1688
1690
  return _context12.stop();
1689
1691
  }
1690
- }, _callee12, null, [[14, 51]]);
1692
+ }, _callee12, null, [[14, 52]]);
1691
1693
  }));
1692
1694
  function dryrun(_x16) {
1693
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
- renderLogs(res.Output);
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 5:
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 res,
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
- _context2.next = 2;
121
- return spawn.apply(void 0, _args2);
122
- case 2:
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
- _context2.next = 5;
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 5:
157
+ case 7:
130
158
  return _context2.abrupt("return", res);
131
- case 6:
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 res,
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
- res = _context3.sent;
147
- renderLogs(res.Output);
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/server.js CHANGED
@@ -288,7 +288,7 @@ var Server = /*#__PURE__*/function () {
288
288
  try {
289
289
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
290
290
  _v = _step3.value;
291
- if (_v.name === "id") id = _v.value;
291
+ if (_v.name === "id") item.target = _v.value;
292
292
  }
293
293
  } catch (err) {
294
294
  _iterator3.e(err);
@@ -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
  }
@@ -107,8 +110,8 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
107
110
  let id, owner, item, __tags
108
111
  let msg_owner = mu.addr
109
112
  if (ar.isHttpMsg(opt.http_msg)) {
110
- ;({ owner, item, tags: __tags } = await ar.httpmsg(opt.http_msg))
111
113
  id = opt.http_msg.target
114
+ ;({ owner, item, tags: __tags } = await ar.httpmsg(opt.http_msg, id))
112
115
  opt.tags = buildTags(null, __tags)
113
116
  opt.data = opt.http_msg.data
114
117
  msg_owner = owner
@@ -373,13 +376,13 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
373
376
  let owner = ""
374
377
  let item = null
375
378
  if (ar.isHttpMsg(opt.http_msg)) {
376
- ;({ id, owner, item } = await ar.httpmsg(opt.http_msg))
379
+ id = opt.http_msg.target
380
+ ;({ owner, item } = await ar.httpmsg(opt.http_msg, id))
377
381
  // check if process exists, and recover if necessary
378
382
  const p = await mem.get("env", opt.process)
379
383
  const new_slot = opt.slot * 1
380
384
  const last_slot = !p ? -1 : p.results.length - 1
381
385
  if (last_slot + 1 !== new_slot) {
382
- console.log("need process recovery from HB:", opt.process)
383
386
  if (!hb || opt.recovery) return null
384
387
  await recover(opt.process)
385
388
  }
@@ -538,6 +541,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
538
541
  }
539
542
 
540
543
  const result = async opt => (await mem.get("msgs", opt.message))?.res
544
+
541
545
  return {
542
546
  message,
543
547
  unmonitor: async opt => {
@@ -627,6 +631,7 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
627
631
  mem.env[opt.process].handle = p.handle
628
632
  }
629
633
  const res = await p.handle(p.memory, msg, _env)
634
+ delete res.Memory
630
635
  return res
631
636
  } catch (e) {
632
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
- const res = await result(...opt)
77
- renderLogs(res.Output)
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
- await this.load({ data: log, pid: res })
86
- return res
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/server.js CHANGED
@@ -174,17 +174,14 @@ class Server {
174
174
  const item = toANS104Request(sigs).item
175
175
 
176
176
  if (sigs.slot === "0" || sigs.type === "Process") {
177
- for (let v of item.tags) {
178
- if (v.name === "Type") v.value = "Process"
179
- }
180
-
177
+ for (let v of item.tags) if (v.name === "Type") v.value = "Process"
181
178
  const res = await this.spawn({
182
179
  http_msg: item,
183
180
  module: sigs.module,
184
181
  scheduler: sigs.scheduler,
185
182
  })
186
183
  } else if (sigs.type === "Message") {
187
- for (let v of item.tags) if (v.name === "id") id = v.value
184
+ for (let v of item.tags) if (v.name === "id") item.target = v.value
188
185
  const res = await this.message({
189
186
  slot: sigs.slot,
190
187
  http_msg: item,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.13.7",
3
+ "version": "0.14.0",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"