wao 0.13.1 → 0.13.2

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/hb.js +18 -10
  2. package/esm/hb.js +10 -5
  3. package/package.json +1 -1
package/cjs/hb.js CHANGED
@@ -43,7 +43,7 @@ var HB = /*#__PURE__*/function () {
43
43
  while (1) switch (_context.prev = _context.next) {
44
44
  case 0:
45
45
  _context.next = 2;
46
- return fetch("".concat(this.url, "/metrics")).then(function (r) {
46
+ return fetch("".concat(this.url, "/~hyperbuddy@1.0/metrics")).then(function (r) {
47
47
  return r.text();
48
48
  });
49
49
  case 2:
@@ -243,13 +243,13 @@ var HB = /*#__PURE__*/function () {
243
243
  var _ref4,
244
244
  _ref4$tags,
245
245
  tags,
246
- _ref4$data,
247
246
  data,
247
+ res,
248
248
  _args6 = arguments;
249
249
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
250
250
  while (1) switch (_context6.prev = _context6.next) {
251
251
  case 0:
252
- _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, _ref4$data = _ref4.data, data = _ref4$data === void 0 ? "1984" : _ref4$data;
252
+ _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, data = _ref4.data;
253
253
  tags = (0, _ramda.mergeLeft)(tags, {
254
254
  data: data,
255
255
  Type: "Process",
@@ -269,8 +269,12 @@ var HB = /*#__PURE__*/function () {
269
269
  tags: tags
270
270
  });
271
271
  case 4:
272
+ res = _context6.sent;
273
+ _context6.next = 7;
274
+ return res.process.text();
275
+ case 7:
272
276
  return _context6.abrupt("return", _context6.sent);
273
- case 5:
277
+ case 8:
274
278
  case "end":
275
279
  return _context6.stop();
276
280
  }
@@ -363,21 +367,25 @@ var HB = /*#__PURE__*/function () {
363
367
  tags,
364
368
  process,
365
369
  action,
370
+ data,
371
+ json,
366
372
  _args9 = arguments;
367
373
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
368
374
  while (1) switch (_context9.prev = _context9.next) {
369
375
  case 0:
370
- _ref7 = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {}, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, process = _ref7.process, action = _ref7.action;
376
+ _ref7 = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {}, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, process = _ref7.process, action = _ref7.action, data = _ref7.data;
371
377
  if (typeof action === "string") tags.Action = action;
372
- _context9.next = 4;
373
- return fetch("".concat(this.url, "/~relay@1.0/call?relay-method=POST&relay-path=/dry-run?process-id=").concat(process, "/&content-type=application/json&body=").concat(JSON.stringify({
378
+ json = {
374
379
  Tags: (0, _utils.buildTags)(tags)
375
- }))).then(function (r) {
380
+ };
381
+ if (data) json.Data = data;
382
+ _context9.next = 6;
383
+ return fetch("".concat(this.url, "/~relay@1.0/call?relay-method=POST&relay-path=/dry-run?process-id=").concat(process, "/&content-type=application/json&body=").concat(JSON.stringify(json))).then(function (r) {
376
384
  return r.json();
377
385
  });
378
- case 4:
386
+ case 6:
379
387
  return _context9.abrupt("return", _context9.sent);
380
- case 5:
388
+ case 7:
381
389
  case "end":
382
390
  return _context9.stop();
383
391
  }
package/esm/hb.js CHANGED
@@ -9,7 +9,9 @@ class HB {
9
9
  }
10
10
 
11
11
  async metrics() {
12
- const txt = await fetch(`${this.url}/metrics`).then(r => r.text())
12
+ const txt = await fetch(`${this.url}/~hyperbuddy@1.0/metrics`).then(r =>
13
+ r.text()
14
+ )
13
15
  const parts = txt.split(/\r?\n/)
14
16
  let index = 0
15
17
  let _metrics = {}
@@ -77,7 +79,7 @@ class HB {
77
79
  return res
78
80
  }
79
81
 
80
- async process({ tags = {}, data = "1984" } = {}) {
82
+ async process({ tags = {}, data } = {}) {
81
83
  tags = mergeLeft(tags, {
82
84
  data,
83
85
  Type: "Process",
@@ -92,7 +94,8 @@ class HB {
92
94
  "scheduler-device": "scheduler@1.0",
93
95
  "execution-device": "genesis-wasm@1.0",
94
96
  })
95
- return await this.post({ tags })
97
+ const res = await this.post({ tags })
98
+ return await res.process.text()
96
99
  }
97
100
 
98
101
  async schedule({ tags = {}, data, process, action = "Eval" } = {}) {
@@ -114,10 +117,12 @@ class HB {
114
117
  })
115
118
  }
116
119
 
117
- async dryrun({ tags = {}, process, action } = {}) {
120
+ async dryrun({ tags = {}, process, action, data } = {}) {
118
121
  if (typeof action === "string") tags.Action = action
122
+ let json = { Tags: buildTags(tags) }
123
+ if (data) json.Data = data
119
124
  return await fetch(
120
- `${this.url}/~relay@1.0/call?relay-method=POST&relay-path=/dry-run?process-id=${process}/&content-type=application/json&body=${JSON.stringify({ Tags: buildTags(tags) })}`
125
+ `${this.url}/~relay@1.0/call?relay-method=POST&relay-path=/dry-run?process-id=${process}/&content-type=application/json&body=${JSON.stringify(json)}`
121
126
  ).then(r => r.json())
122
127
  }
123
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"