wao 0.36.0 → 0.36.1
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 +37 -9
- package/esm/hb.js +14 -2
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -77,8 +77,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
77
77
|
url = _ref2$url === void 0 ? "http://localhost:10001" : _ref2$url,
|
|
78
78
|
_ref2$cu = _ref2.cu,
|
|
79
79
|
cu = _ref2$cu === void 0 ? "http://localhost:6363" : _ref2$cu,
|
|
80
|
-
jwk = _ref2.jwk
|
|
80
|
+
jwk = _ref2.jwk,
|
|
81
|
+
_ref2$format = _ref2.format,
|
|
82
|
+
format = _ref2$format === void 0 ? "httpsig" : _ref2$format;
|
|
81
83
|
_classCallCheck(this, HB);
|
|
84
|
+
this.format = format;
|
|
82
85
|
this.cu = cu;
|
|
83
86
|
this.url = url;
|
|
84
87
|
if (jwk) this._init(jwk);
|
|
@@ -393,20 +396,33 @@ var HB = /*#__PURE__*/function () {
|
|
|
393
396
|
key: "compute",
|
|
394
397
|
value: function () {
|
|
395
398
|
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref5) {
|
|
396
|
-
var pid, slot, _ref5$path, path;
|
|
399
|
+
var pid, slot, _ref5$path, path, res;
|
|
397
400
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
398
401
|
while (1) switch (_context12.prev = _context12.next) {
|
|
399
402
|
case 0:
|
|
400
403
|
pid = _ref5.pid, slot = _ref5.slot, _ref5$path = _ref5.path, path = _ref5$path === void 0 ? "" : _ref5$path;
|
|
401
404
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
402
|
-
|
|
405
|
+
if (!(this.format === "ans104")) {
|
|
406
|
+
_context12.next = 9;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
_context12.next = 5;
|
|
410
|
+
return this.get({
|
|
411
|
+
path: "/".concat(pid, "/compute").concat(path),
|
|
412
|
+
slot: slot
|
|
413
|
+
});
|
|
414
|
+
case 5:
|
|
415
|
+
res = _context12.sent;
|
|
416
|
+
return _context12.abrupt("return", res.out);
|
|
417
|
+
case 9:
|
|
418
|
+
_context12.next = 11;
|
|
403
419
|
return this.getJSON({
|
|
404
420
|
path: "/".concat(pid, "/compute").concat(path),
|
|
405
421
|
slot: slot
|
|
406
422
|
});
|
|
407
|
-
case
|
|
423
|
+
case 11:
|
|
408
424
|
return _context12.abrupt("return", _context12.sent);
|
|
409
|
-
case
|
|
425
|
+
case 12:
|
|
410
426
|
case "end":
|
|
411
427
|
return _context12.stop();
|
|
412
428
|
}
|
|
@@ -865,19 +881,31 @@ var HB = /*#__PURE__*/function () {
|
|
|
865
881
|
key: "now",
|
|
866
882
|
value: function () {
|
|
867
883
|
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref12) {
|
|
868
|
-
var pid, _ref12$path, path;
|
|
884
|
+
var pid, _ref12$path, path, res;
|
|
869
885
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
870
886
|
while (1) switch (_context23.prev = _context23.next) {
|
|
871
887
|
case 0:
|
|
872
888
|
pid = _ref12.pid, _ref12$path = _ref12.path, path = _ref12$path === void 0 ? "" : _ref12$path;
|
|
873
889
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
874
|
-
|
|
890
|
+
if (!(this.format === "ans104")) {
|
|
891
|
+
_context23.next = 9;
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
_context23.next = 5;
|
|
895
|
+
return this.get({
|
|
896
|
+
path: "/".concat(pid, "/now").concat(path)
|
|
897
|
+
});
|
|
898
|
+
case 5:
|
|
899
|
+
res = _context23.sent;
|
|
900
|
+
return _context23.abrupt("return", res.out);
|
|
901
|
+
case 9:
|
|
902
|
+
_context23.next = 11;
|
|
875
903
|
return this.getJSON({
|
|
876
904
|
path: "/".concat(pid, "/now").concat(path)
|
|
877
905
|
});
|
|
878
|
-
case
|
|
906
|
+
case 11:
|
|
879
907
|
return _context23.abrupt("return", _context23.sent);
|
|
880
|
-
case
|
|
908
|
+
case 12:
|
|
881
909
|
case "end":
|
|
882
910
|
return _context23.stop();
|
|
883
911
|
}
|
package/esm/hb.js
CHANGED
|
@@ -24,7 +24,9 @@ class HB {
|
|
|
24
24
|
url = "http://localhost:10001",
|
|
25
25
|
cu = "http://localhost:6363",
|
|
26
26
|
jwk,
|
|
27
|
+
format = "httpsig",
|
|
27
28
|
} = {}) {
|
|
29
|
+
this.format = format
|
|
28
30
|
this.cu = cu
|
|
29
31
|
this.url = url
|
|
30
32
|
if (jwk) this._init(jwk)
|
|
@@ -104,7 +106,12 @@ class HB {
|
|
|
104
106
|
|
|
105
107
|
async compute({ pid, slot, path = "" }) {
|
|
106
108
|
if (path && !/^\//.test(path)) path = "/" + path
|
|
107
|
-
|
|
109
|
+
if (this.format === "ans104") {
|
|
110
|
+
const res = await this.get({ path: `/${pid}/compute${path}`, slot })
|
|
111
|
+
return res.out
|
|
112
|
+
} else {
|
|
113
|
+
return await this.getJSON({ path: `/${pid}/compute${path}`, slot })
|
|
114
|
+
}
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
async computeLegacy({ pid, slot }) {
|
|
@@ -212,7 +219,12 @@ class HB {
|
|
|
212
219
|
|
|
213
220
|
async now({ pid, path = "" }) {
|
|
214
221
|
if (path && !/^\//.test(path)) path = "/" + path
|
|
215
|
-
|
|
222
|
+
if (this.format === "ans104") {
|
|
223
|
+
const res = await this.get({ path: `/${pid}/now${path}` })
|
|
224
|
+
return res.out
|
|
225
|
+
} else {
|
|
226
|
+
return await this.getJSON({ path: `/${pid}/now${path}` })
|
|
227
|
+
}
|
|
216
228
|
}
|
|
217
229
|
|
|
218
230
|
async slot({ pid, path = "" }) {
|