wao 0.31.1 → 0.31.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.
package/cjs/hb.js CHANGED
@@ -16,6 +16,12 @@ var _excluded = ["path"],
16
16
  _excluded2 = ["path"];
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
18
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
20
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ 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; } }
22
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
23
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
24
+ 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; }
19
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
26
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
27
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -319,20 +325,19 @@ var HB = /*#__PURE__*/function () {
319
325
  _yield$this$scheduleL = _context9.sent;
320
326
  slot = _yield$this$scheduleL.slot;
321
327
  pid = _yield$this$scheduleL.pid;
322
- console.log(slot, pid, args);
323
328
  _context9.t0 = slot;
324
- _context9.next = 9;
329
+ _context9.next = 8;
325
330
  return this.computeLegacy({
326
331
  pid: pid,
327
332
  slot: slot
328
333
  });
329
- case 9:
334
+ case 8:
330
335
  _context9.t1 = _context9.sent;
331
336
  return _context9.abrupt("return", {
332
337
  slot: _context9.t0,
333
338
  res: _context9.t1
334
339
  });
335
- case 11:
340
+ case 10:
336
341
  case "end":
337
342
  return _context9.stop();
338
343
  }
@@ -462,11 +467,11 @@ var HB = /*#__PURE__*/function () {
462
467
  addr,
463
468
  _tags,
464
469
  res,
465
- _args14 = arguments;
470
+ _args15 = arguments;
466
471
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
467
472
  while (1) switch (_context14.prev = _context14.next) {
468
473
  case 0:
469
- tags = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
474
+ tags = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
470
475
  _context14.next = 3;
471
476
  return this.g("/~meta@1.0/info/address");
472
477
  case 3:
@@ -509,11 +514,11 @@ var HB = /*#__PURE__*/function () {
509
514
  _yield$this$schedule,
510
515
  slot,
511
516
  msgs,
512
- _args15 = arguments;
517
+ _args16 = arguments;
513
518
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
514
519
  while (1) switch (_context15.prev = _context15.next) {
515
520
  case 0:
516
- type = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : "application/lua";
521
+ type = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : "application/lua";
517
522
  if (this.cache) {
518
523
  _context15.next = 7;
519
524
  break;
@@ -631,11 +636,11 @@ var HB = /*#__PURE__*/function () {
631
636
  tags,
632
637
  data,
633
638
  scheduler,
634
- _args18 = arguments;
639
+ _args19 = arguments;
635
640
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
636
641
  while (1) switch (_context18.prev = _context18.next) {
637
642
  case 0:
638
- _ref7 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, pid = _ref7.pid, _ref7$action = _ref7.action, action = _ref7$action === void 0 ? "Eval" : _ref7$action, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data, scheduler = _ref7.scheduler;
643
+ _ref7 = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {}, pid = _ref7.pid, _ref7$action = _ref7.action, action = _ref7$action === void 0 ? "Eval" : _ref7$action, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data, scheduler = _ref7.scheduler;
639
644
  if (action) tags.Action = action;
640
645
  _context18.next = 4;
641
646
  return this.schedule({
@@ -661,12 +666,12 @@ var HB = /*#__PURE__*/function () {
661
666
  key: "scheduleLua",
662
667
  value: function () {
663
668
  var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
664
- var _args19 = arguments;
669
+ var _args20 = arguments;
665
670
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
666
671
  while (1) switch (_context19.prev = _context19.next) {
667
672
  case 0:
668
673
  _context19.next = 2;
669
- return this.scheduleLegacy.apply(this, _args19);
674
+ return this.scheduleLegacy.apply(this, _args20);
670
675
  case 2:
671
676
  return _context19.abrupt("return", _context19.sent);
672
677
  case 3:
@@ -692,11 +697,11 @@ var HB = /*#__PURE__*/function () {
692
697
  data,
693
698
  _tags,
694
699
  res,
695
- _args20 = arguments;
700
+ _args21 = arguments;
696
701
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
697
702
  while (1) switch (_context20.prev = _context20.next) {
698
703
  case 0:
699
- _ref8 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, pid = _ref8.pid, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data;
704
+ _ref8 = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {}, pid = _ref8.pid, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data;
700
705
  (_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
701
706
  _tags = (0, _ramda.mergeLeft)(tags, {
702
707
  method: "POST",
@@ -940,11 +945,11 @@ var HB = /*#__PURE__*/function () {
940
945
  limit,
941
946
  params,
942
947
  res,
943
- _args26 = arguments;
948
+ _args27 = arguments;
944
949
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
945
950
  while (1) switch (_context26.prev = _context26.next) {
946
951
  case 0:
947
- _ref11 = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {}, pid = _ref11.pid, from = _ref11.from, to = _ref11.to, limit = _ref11.limit;
952
+ _ref11 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, pid = _ref11.pid, from = _ref11.from, to = _ref11.to, limit = _ref11.limit;
948
953
  params = "target=".concat(pid);
949
954
  if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
950
955
  if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
@@ -1000,11 +1005,11 @@ var HB = /*#__PURE__*/function () {
1000
1005
  tags,
1001
1006
  data,
1002
1007
  t,
1003
- _args27 = arguments;
1008
+ _args28 = arguments;
1004
1009
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1005
1010
  while (1) switch (_context27.prev = _context27.next) {
1006
1011
  case 0:
1007
- _ref13 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, module = _ref13.module, _ref13$tags = _ref13.tags, tags = _ref13$tags === void 0 ? {} : _ref13$tags, data = _ref13.data;
1012
+ _ref13 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, module = _ref13.module, _ref13$tags = _ref13.tags, tags = _ref13$tags === void 0 ? {} : _ref13$tags, data = _ref13.data;
1008
1013
  _context27.next = 3;
1009
1014
  return this.setInfo();
1010
1015
  case 3:
@@ -1056,11 +1061,11 @@ var HB = /*#__PURE__*/function () {
1056
1061
  params,
1057
1062
  addParam,
1058
1063
  res,
1059
- _args28 = arguments;
1064
+ _args29 = arguments;
1060
1065
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1061
1066
  while (1) switch (_context28.prev = _context28.next) {
1062
1067
  case 0:
1063
- _ref14 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, process = _ref14.process, limit = _ref14.limit, _ref14$sort = _ref14.sort, sort = _ref14$sort === void 0 ? "DESC" : _ref14$sort, from = _ref14.from, to = _ref14.to;
1068
+ _ref14 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, process = _ref14.process, limit = _ref14.limit, _ref14$sort = _ref14.sort, sort = _ref14$sort === void 0 ? "DESC" : _ref14$sort, from = _ref14.from, to = _ref14.to;
1064
1069
  params = "";
1065
1070
  addParam = function addParam(key, val) {
1066
1071
  params += params === "" ? "?" : "&";
@@ -1103,11 +1108,11 @@ var HB = /*#__PURE__*/function () {
1103
1108
  data,
1104
1109
  json,
1105
1110
  res,
1106
- _args29 = arguments;
1111
+ _args30 = arguments;
1107
1112
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1108
1113
  while (1) switch (_context29.prev = _context29.next) {
1109
1114
  case 0:
1110
- _ref15 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, pid = _ref15.pid, action = _ref15.action, data = _ref15.data;
1115
+ _ref15 = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {}, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, pid = _ref15.pid, action = _ref15.action, data = _ref15.data;
1111
1116
  if (typeof action === "string") tags.Action = action;
1112
1117
  json = {
1113
1118
  Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
@@ -1187,56 +1192,58 @@ var HB = /*#__PURE__*/function () {
1187
1192
  var _len,
1188
1193
  args,
1189
1194
  _key,
1190
- _args31 = arguments;
1195
+ _args,
1196
+ _args32 = arguments;
1191
1197
  return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1192
1198
  while (1) switch (_context31.prev = _context31.next) {
1193
1199
  case 0:
1194
- for (_len = _args31.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1195
- args[_key - 1] = _args31[_key];
1200
+ for (_len = _args32.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1201
+ args[_key - 1] = _args32[_key];
1196
1202
  }
1197
- (_args$_ = args[_ = 0]) !== null && _args$_ !== void 0 ? _args$_ : args[_] = {};
1198
- (_args$$path = (_args$ = args[0]).path) !== null && _args$$path !== void 0 ? _args$$path : _args$.path = path;
1199
- _context31.next = 5;
1200
- return this.post.apply(this, args);
1201
- case 5:
1203
+ _args = (0, _ramda.clone)(args);
1204
+ (_args$_ = _args[_ = 0]) !== null && _args$_ !== void 0 ? _args$_ : _args[_] = {};
1205
+ (_args$$path = (_args$ = _args[0]).path) !== null && _args$$path !== void 0 ? _args$$path : _args$.path = path;
1206
+ _context31.next = 6;
1207
+ return this.post.apply(this, _toConsumableArray(_args));
1208
+ case 6:
1202
1209
  _context31.t2 = _yield$this$post = _context31.sent;
1203
1210
  _context31.t1 = _context31.t2 === null;
1204
1211
  if (_context31.t1) {
1205
- _context31.next = 9;
1212
+ _context31.next = 10;
1206
1213
  break;
1207
1214
  }
1208
1215
  _context31.t1 = _yield$this$post === void 0;
1209
- case 9:
1216
+ case 10:
1210
1217
  if (!_context31.t1) {
1211
- _context31.next = 13;
1218
+ _context31.next = 14;
1212
1219
  break;
1213
1220
  }
1214
1221
  _context31.t3 = void 0;
1215
- _context31.next = 14;
1222
+ _context31.next = 15;
1216
1223
  break;
1217
- case 13:
1218
- _context31.t3 = _yield$this$post.out;
1219
1224
  case 14:
1225
+ _context31.t3 = _yield$this$post.out;
1226
+ case 15:
1220
1227
  _context31.t4 = _yield$this$post$out = _context31.t3;
1221
1228
  _context31.t0 = _context31.t4 !== null;
1222
1229
  if (!_context31.t0) {
1223
- _context31.next = 18;
1230
+ _context31.next = 19;
1224
1231
  break;
1225
1232
  }
1226
1233
  _context31.t0 = _yield$this$post$out !== void 0;
1227
- case 18:
1234
+ case 19:
1228
1235
  if (!_context31.t0) {
1229
- _context31.next = 22;
1236
+ _context31.next = 23;
1230
1237
  break;
1231
1238
  }
1232
1239
  _context31.t5 = _yield$this$post$out;
1233
- _context31.next = 23;
1240
+ _context31.next = 24;
1234
1241
  break;
1235
- case 22:
1236
- _context31.t5 = null;
1237
1242
  case 23:
1238
- return _context31.abrupt("return", _context31.t5);
1243
+ _context31.t5 = null;
1239
1244
  case 24:
1245
+ return _context31.abrupt("return", _context31.t5);
1246
+ case 25:
1240
1247
  case "end":
1241
1248
  return _context31.stop();
1242
1249
  }
@@ -1285,56 +1292,58 @@ var HB = /*#__PURE__*/function () {
1285
1292
  var _len2,
1286
1293
  args,
1287
1294
  _key2,
1288
- _args33 = arguments;
1295
+ _args,
1296
+ _args34 = arguments;
1289
1297
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
1290
1298
  while (1) switch (_context33.prev = _context33.next) {
1291
1299
  case 0:
1292
- for (_len2 = _args33.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1293
- args[_key2 - 1] = _args33[_key2];
1300
+ for (_len2 = _args34.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1301
+ args[_key2 - 1] = _args34[_key2];
1294
1302
  }
1295
- (_args$_2 = args[_2 = 0]) !== null && _args$_2 !== void 0 ? _args$_2 : args[_2] = {};
1296
- (_args$2$path = (_args$2 = args[0]).path) !== null && _args$2$path !== void 0 ? _args$2$path : _args$2.path = path;
1297
- _context33.next = 5;
1298
- return this.get.apply(this, args);
1299
- case 5:
1303
+ _args = (0, _ramda.clone)(args);
1304
+ (_args$_2 = _args[_2 = 0]) !== null && _args$_2 !== void 0 ? _args$_2 : _args[_2] = {};
1305
+ (_args$2$path = (_args$2 = _args[0]).path) !== null && _args$2$path !== void 0 ? _args$2$path : _args$2.path = path;
1306
+ _context33.next = 6;
1307
+ return this.get.apply(this, _toConsumableArray(_args));
1308
+ case 6:
1300
1309
  _context33.t2 = _yield$this$get = _context33.sent;
1301
1310
  _context33.t1 = _context33.t2 === null;
1302
1311
  if (_context33.t1) {
1303
- _context33.next = 9;
1312
+ _context33.next = 10;
1304
1313
  break;
1305
1314
  }
1306
1315
  _context33.t1 = _yield$this$get === void 0;
1307
- case 9:
1316
+ case 10:
1308
1317
  if (!_context33.t1) {
1309
- _context33.next = 13;
1318
+ _context33.next = 14;
1310
1319
  break;
1311
1320
  }
1312
1321
  _context33.t3 = void 0;
1313
- _context33.next = 14;
1322
+ _context33.next = 15;
1314
1323
  break;
1315
- case 13:
1316
- _context33.t3 = _yield$this$get.out;
1317
1324
  case 14:
1325
+ _context33.t3 = _yield$this$get.out;
1326
+ case 15:
1318
1327
  _context33.t4 = _yield$this$get$out = _context33.t3;
1319
1328
  _context33.t0 = _context33.t4 !== null;
1320
1329
  if (!_context33.t0) {
1321
- _context33.next = 18;
1330
+ _context33.next = 19;
1322
1331
  break;
1323
1332
  }
1324
1333
  _context33.t0 = _yield$this$get$out !== void 0;
1325
- case 18:
1334
+ case 19:
1326
1335
  if (!_context33.t0) {
1327
- _context33.next = 22;
1336
+ _context33.next = 23;
1328
1337
  break;
1329
1338
  }
1330
1339
  _context33.t5 = _yield$this$get$out;
1331
- _context33.next = 23;
1340
+ _context33.next = 24;
1332
1341
  break;
1333
- case 22:
1334
- _context33.t5 = null;
1335
1342
  case 23:
1336
- return _context33.abrupt("return", _context33.t5);
1343
+ _context33.t5 = null;
1337
1344
  case 24:
1345
+ return _context33.abrupt("return", _context33.t5);
1346
+ case 25:
1338
1347
  case "end":
1339
1348
  return _context33.stop();
1340
1349
  }
@@ -1360,12 +1369,12 @@ var HB = /*#__PURE__*/function () {
1360
1369
  response,
1361
1370
  headers,
1362
1371
  http,
1363
- _args34 = arguments;
1372
+ _args35 = arguments;
1364
1373
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1365
1374
  while (1) switch (_context34.prev = _context34.next) {
1366
1375
  case 0:
1367
1376
  path = _ref16.path, params = _objectWithoutProperties(_ref16, _excluded2);
1368
- json = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : false;
1377
+ json = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : false;
1369
1378
  _json = json ? "/~json@1.0/serialize" : "";
1370
1379
  (_path = path) !== null && _path !== void 0 ? _path : path = "/~message@1.0";
1371
1380
  if (!/^\//.test(path)) path = "/" + path;
@@ -9,6 +9,6 @@
9
9
  "deploy": "node scripts/deploy.js"
10
10
  },
11
11
  "dependencies": {
12
- "wao": "^0.31.0"
12
+ "wao": "^0.31.2"
13
13
  }
14
14
  }
@@ -1,18 +1,30 @@
1
1
  import assert from "assert"
2
2
  import { describe, it, before, after, beforeEach } from "node:test"
3
3
  import { HyperBEAM } from "wao/test"
4
- const cwd = "../../HyperBEAM"
4
+
5
+ /*
6
+ The link to your HyperBEAM node directory.
7
+ It's relative to your app root folder, not the test folder.
8
+ */
9
+ const cwd = "../HyperBEAM"
5
10
 
6
11
  describe("HyperBEAM", function () {
7
12
  let hbeam, hb
8
- before(
9
- async () => (hbeam = await new HyperBEAM({ cwd, reset: true }).ready())
10
- )
13
+
14
+ // start a hyperbeam node and wait till it's ready
15
+ before(async () => (hbeam = await new HyperBEAM({ cwd }).ready()))
16
+
11
17
  beforeEach(async () => (hb = hbeam.hb))
18
+
19
+ // kill the node after testing
12
20
  after(async () => hbeam.kill())
13
21
 
14
22
  it("should run a HyperBEAM node", async () => {
15
- const build = await hb.g("/~meta@1.0/build")
16
- assert.equal(build.node, "HyperBEAM")
23
+ // change config
24
+ await hb.post({ path: "/~meta@1.0/info", test_config: "abc" })
25
+
26
+ // get config
27
+ const { out } = await hb.get({ path: "/~meta@1.0/info" })
28
+ assert.equal(out.test_config, "abc")
17
29
  })
18
30
  })
package/esm/hb.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { connect, createSigner } from "@permaweb/aoconnect"
2
- import { isEmpty, last, isNotNil, mergeLeft } from "ramda"
2
+ import { isEmpty, last, isNotNil, mergeLeft, clone } from "ramda"
3
3
  import { rsaid, hmacid, toAddr, buildTags } from "./utils.js"
4
4
  import { sign, signer } from "./signer.js"
5
5
  import { send as _send } from "./send.js"
@@ -105,7 +105,6 @@ class HB {
105
105
 
106
106
  async messageLegacy(args) {
107
107
  const { slot, pid } = await this.scheduleLegacy(args)
108
- console.log(slot, pid, args)
109
108
  return { slot, res: await this.computeLegacy({ pid, slot }) }
110
109
  }
111
110
 
@@ -360,9 +359,10 @@ class HB {
360
359
  }
361
360
 
362
361
  async p(path, ...args) {
363
- args[0] ??= {}
364
- args[0].path ??= path
365
- return (await this.post(...args))?.out ?? null
362
+ let _args = clone(args)
363
+ _args[0] ??= {}
364
+ _args[0].path ??= path
365
+ return (await this.post(..._args))?.out ?? null
366
366
  }
367
367
 
368
368
  async post(obj, json) {
@@ -372,9 +372,10 @@ class HB {
372
372
  }
373
373
 
374
374
  async g(path, ...args) {
375
- args[0] ??= {}
376
- args[0].path ??= path
377
- return (await this.get(...args))?.out ?? null
375
+ let _args = clone(args)
376
+ _args[0] ??= {}
377
+ _args[0].path ??= path
378
+ return (await this.get(..._args))?.out ?? null
378
379
  }
379
380
 
380
381
  async get({ path, ...params }, json = false) {
@@ -9,6 +9,6 @@
9
9
  "deploy": "node scripts/deploy.js"
10
10
  },
11
11
  "dependencies": {
12
- "wao": "^0.31.0"
12
+ "wao": "^0.31.2"
13
13
  }
14
14
  }
@@ -1,18 +1,30 @@
1
1
  import assert from "assert"
2
2
  import { describe, it, before, after, beforeEach } from "node:test"
3
3
  import { HyperBEAM } from "wao/test"
4
- const cwd = "../../HyperBEAM"
4
+
5
+ /*
6
+ The link to your HyperBEAM node directory.
7
+ It's relative to your app root folder, not the test folder.
8
+ */
9
+ const cwd = "../HyperBEAM"
5
10
 
6
11
  describe("HyperBEAM", function () {
7
12
  let hbeam, hb
8
- before(
9
- async () => (hbeam = await new HyperBEAM({ cwd, reset: true }).ready())
10
- )
13
+
14
+ // start a hyperbeam node and wait till it's ready
15
+ before(async () => (hbeam = await new HyperBEAM({ cwd }).ready()))
16
+
11
17
  beforeEach(async () => (hb = hbeam.hb))
18
+
19
+ // kill the node after testing
12
20
  after(async () => hbeam.kill())
13
21
 
14
22
  it("should run a HyperBEAM node", async () => {
15
- const build = await hb.g("/~meta@1.0/build")
16
- assert.equal(build.node, "HyperBEAM")
23
+ // change config
24
+ await hb.post({ path: "/~meta@1.0/info", test_config: "abc" })
25
+
26
+ // get config
27
+ const { out } = await hb.get({ path: "/~meta@1.0/info" })
28
+ assert.equal(out.test_config, "abc")
17
29
  })
18
30
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"