wao 0.18.9 → 0.18.10

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.
Files changed (3) hide show
  1. package/cjs/bao.js +11 -6
  2. package/esm/bao.js +8 -4
  3. package/package.json +1 -1
package/cjs/bao.js CHANGED
@@ -70,7 +70,7 @@ var renderLogs = function renderLogs(logs) {
70
70
  };
71
71
  var AO = /*#__PURE__*/function (_MAO) {
72
72
  function AO() {
73
- var _opt$createDataItemSi;
73
+ var _opt$log, _opt$createDataItemSi;
74
74
  var _this;
75
75
  var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
76
76
  _classCallCheck(this, AO);
@@ -80,6 +80,7 @@ var AO = /*#__PURE__*/function (_MAO) {
80
80
  _this = _callSuper(this, AO, [_objectSpread(_objectSpread({}, opt), {}, {
81
81
  in_memory: true
82
82
  })]);
83
+ _this.log = (_opt$log = opt.log) !== null && _opt$log !== void 0 ? _opt$log : true;
83
84
  _this.in_memory = true;
84
85
  _this.createDataItemSigner = (_opt$createDataItemSi = opt.createDataItemSigner) !== null && _opt$createDataItemSi !== void 0 ? _opt$createDataItemSi : _aoconnect.createDataItemSigner;
85
86
  _this.hb = opt.hb;
@@ -125,8 +126,9 @@ var AO = /*#__PURE__*/function (_MAO) {
125
126
  case 8:
126
127
  res = _context.sent;
127
128
  case 9:
129
+ if (res) renderLogs(res.Output);
128
130
  return _context.abrupt("return", res);
129
- case 10:
131
+ case 11:
130
132
  case "end":
131
133
  return _context.stop();
132
134
  }
@@ -150,7 +152,7 @@ var AO = /*#__PURE__*/function (_MAO) {
150
152
  return spawn.apply(void 0, opt);
151
153
  case 3:
152
154
  res = _context2.sent;
153
- if (opt[0].http_msg) {
155
+ if (!(!opt[0].http_msg && _this.log)) {
154
156
  _context2.next = 7;
155
157
  break;
156
158
  }
@@ -168,15 +170,18 @@ var AO = /*#__PURE__*/function (_MAO) {
168
170
  }, _callee2);
169
171
  }));
170
172
  _this.dryrun = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
171
- var _args3 = arguments;
173
+ var res,
174
+ _args3 = arguments;
172
175
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
173
176
  while (1) switch (_context3.prev = _context3.next) {
174
177
  case 0:
175
178
  _context3.next = 2;
176
179
  return dryrun.apply(void 0, _args3);
177
180
  case 2:
178
- return _context3.abrupt("return", _context3.sent);
179
- case 3:
181
+ res = _context3.sent;
182
+ if (res) renderLogs(res.Output);
183
+ return _context3.abrupt("return", res);
184
+ case 5:
180
185
  case "end":
181
186
  return _context3.stop();
182
187
  }
package/esm/bao.js CHANGED
@@ -52,6 +52,7 @@ class AO extends MAO {
52
52
  constructor(opt = {}) {
53
53
  if (opt.hb_url) opt.hb = new HB({ url: opt.hb_url })
54
54
  super({ ...opt, in_memory: true })
55
+ this.log = opt.log ?? true
55
56
  this.in_memory = true
56
57
  this.createDataItemSigner = opt.createDataItemSigner ?? createDataItemSigner
57
58
  this.hb = opt.hb
@@ -82,6 +83,7 @@ class AO extends MAO {
82
83
  await wait(100) // todo: why do we need to wait?
83
84
  res = await result(...opt)
84
85
  }
86
+ if (res) renderLogs(res.Output)
85
87
  return res
86
88
  }
87
89
 
@@ -89,12 +91,14 @@ class AO extends MAO {
89
91
  this.message = message
90
92
  this.spawn = async (...opt) => {
91
93
  const res = await spawn(...opt)
92
- if (!opt[0].http_msg) {
93
- await this.load({ data: log, pid: res })
94
- }
94
+ if (!opt[0].http_msg && this.log) await this.load({ data: log, pid: res })
95
+ return res
96
+ }
97
+ this.dryrun = async (...opt) => {
98
+ const res = await dryrun(...opt)
99
+ if (res) renderLogs(res.Output)
95
100
  return res
96
101
  }
97
- this.dryrun = async (...opt) => await dryrun(...opt)
98
102
 
99
103
  this.monitor = monitor
100
104
  this.unmonitor = unmonitor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"