wao 0.22.3 → 0.22.4
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 +18 -17
- package/esm/hb.js +18 -17
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -42,7 +42,8 @@ var HB = /*#__PURE__*/function () {
|
|
|
42
42
|
jwk = _ref.jwk;
|
|
43
43
|
_classCallCheck(this, HB);
|
|
44
44
|
this.url = url;
|
|
45
|
-
this.
|
|
45
|
+
this.dev = {};
|
|
46
|
+
this.dev.hyperbuddy = {
|
|
46
47
|
metrics: function () {
|
|
47
48
|
var _metrics2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
48
49
|
var args,
|
|
@@ -69,7 +70,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
69
70
|
return metrics;
|
|
70
71
|
}()
|
|
71
72
|
};
|
|
72
|
-
this.json = {
|
|
73
|
+
this.dev.json = {
|
|
73
74
|
commit: function () {
|
|
74
75
|
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args) {
|
|
75
76
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -159,7 +160,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
159
160
|
return serialize;
|
|
160
161
|
}()
|
|
161
162
|
};
|
|
162
|
-
this.meta = {
|
|
163
|
+
this.dev.meta = {
|
|
163
164
|
info: function () {
|
|
164
165
|
var _info = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
165
166
|
var args,
|
|
@@ -265,7 +266,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
265
266
|
case 0:
|
|
266
267
|
this._init(jwk);
|
|
267
268
|
_context8.next = 3;
|
|
268
|
-
return this.meta.info({});
|
|
269
|
+
return this.dev.meta.info({});
|
|
269
270
|
case 3:
|
|
270
271
|
this._info = _context8.sent;
|
|
271
272
|
return _context8.abrupt("return", this);
|
|
@@ -400,7 +401,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
400
401
|
i++;
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
|
-
return "".concat(this.url, "/~").concat(dev, "/").concat(_path).concat(json ? "
|
|
404
|
+
return "".concat(this.url, "/~").concat(dev, "/").concat(_path).concat(json ? "/~json@1.0/serialize" : "").concat(_params);
|
|
404
405
|
}
|
|
405
406
|
}, {
|
|
406
407
|
key: "text",
|
|
@@ -490,7 +491,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
490
491
|
case 0:
|
|
491
492
|
pid = _ref4.pid, slot = _ref4.slot;
|
|
492
493
|
_context15.next = 3;
|
|
493
|
-
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/outbox
|
|
494
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/results/outbox/~json@1.0/serialize?slot=").concat(slot)).then(function (r) {
|
|
494
495
|
return r.json();
|
|
495
496
|
});
|
|
496
497
|
case 3:
|
|
@@ -516,7 +517,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
516
517
|
case 0:
|
|
517
518
|
pid = _ref5.pid, slot = _ref5.slot;
|
|
518
519
|
_context16.next = 3;
|
|
519
|
-
return fetch("".concat(this.url, "/").concat(pid, "/compute
|
|
520
|
+
return fetch("".concat(this.url, "/").concat(pid, "/compute/~json@1.0/serialize?slot=").concat(slot)).then(function (r) {
|
|
520
521
|
return r.json();
|
|
521
522
|
});
|
|
522
523
|
case 3:
|
|
@@ -574,7 +575,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
574
575
|
case 0:
|
|
575
576
|
tags = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
576
577
|
_context18.next = 3;
|
|
577
|
-
return this.meta.info({
|
|
578
|
+
return this.dev.meta.info({
|
|
578
579
|
key: "address"
|
|
579
580
|
});
|
|
580
581
|
case 3:
|
|
@@ -739,7 +740,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
739
740
|
while (1) switch (_context22.prev = _context22.next) {
|
|
740
741
|
case 0:
|
|
741
742
|
_context22.next = 2;
|
|
742
|
-
return this.meta.info({
|
|
743
|
+
return this.dev.meta.info({
|
|
743
744
|
key: "address"
|
|
744
745
|
});
|
|
745
746
|
case 2:
|
|
@@ -994,17 +995,17 @@ var HB = /*#__PURE__*/function () {
|
|
|
994
995
|
return spawnLegacy;
|
|
995
996
|
}()
|
|
996
997
|
/*
|
|
997
|
-
|
|
998
|
+
async scheduleLegacy({ tags = {}, data, process, action = "Eval" } = {}) {
|
|
998
999
|
tags = mergeLeft(tags, {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1000
|
+
path: `${process}/schedule`,
|
|
1001
|
+
type: "Message",
|
|
1002
|
+
action,
|
|
1003
|
+
data,
|
|
1004
|
+
"Data-Protocol": "ao",
|
|
1005
|
+
Variant: "ao.N.1",
|
|
1005
1006
|
})
|
|
1006
1007
|
return (await this.post({ tags })).slot.text()
|
|
1007
|
-
|
|
1008
|
+
}
|
|
1008
1009
|
*/
|
|
1009
1010
|
}, {
|
|
1010
1011
|
key: "dryrun",
|
package/esm/hb.js
CHANGED
|
@@ -11,7 +11,8 @@ const seed = num => {
|
|
|
11
11
|
class HB {
|
|
12
12
|
constructor({ url = "http://localhost:10001", jwk } = {}) {
|
|
13
13
|
this.url = url
|
|
14
|
-
this.
|
|
14
|
+
this.dev = {}
|
|
15
|
+
this.dev.hyperbuddy = {
|
|
15
16
|
metrics: async (args = {}) => {
|
|
16
17
|
return this.parseMetrics(
|
|
17
18
|
await this.fetch(this.path("hyperbuddy", "metrics", false), false)
|
|
@@ -19,7 +20,7 @@ class HB {
|
|
|
19
20
|
},
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
this.json = {
|
|
23
|
+
this.dev.json = {
|
|
23
24
|
commit: async args => {
|
|
24
25
|
return await this.send({ path: "/~json@1.0/commit", ...args })
|
|
25
26
|
},
|
|
@@ -33,7 +34,7 @@ class HB {
|
|
|
33
34
|
return await this.send({ path: "/~json@1.0/serialize", ...args })
|
|
34
35
|
},
|
|
35
36
|
}
|
|
36
|
-
this.meta = {
|
|
37
|
+
this.dev.meta = {
|
|
37
38
|
info: async (args = {}) => {
|
|
38
39
|
let { method = "GET", json = true, key } = args
|
|
39
40
|
if (method.toLowerCase() === "post") {
|
|
@@ -71,7 +72,7 @@ class HB {
|
|
|
71
72
|
|
|
72
73
|
async init(jwk) {
|
|
73
74
|
this._init(jwk)
|
|
74
|
-
this._info = await this.meta.info({})
|
|
75
|
+
this._info = await this.dev.meta.info({})
|
|
75
76
|
return this
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -115,7 +116,7 @@ class HB {
|
|
|
115
116
|
i++
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
return `${this.url}/~${dev}/${path}${json ? "
|
|
119
|
+
return `${this.url}/~${dev}/${path}${json ? "/~json@1.0/serialize" : ""}${_params}`
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
async text(dev, path) {
|
|
@@ -132,13 +133,13 @@ class HB {
|
|
|
132
133
|
|
|
133
134
|
async computeAOS({ pid, slot }) {
|
|
134
135
|
return await fetch(
|
|
135
|
-
`${this.url}/${pid}/compute/results/outbox
|
|
136
|
+
`${this.url}/${pid}/compute/results/outbox/~json@1.0/serialize?slot=${slot}`
|
|
136
137
|
).then(r => r.json())
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
async compute({ pid, slot }) {
|
|
140
141
|
return await fetch(
|
|
141
|
-
`${this.url}/${pid}/compute
|
|
142
|
+
`${this.url}/${pid}/compute/~json@1.0/serialize?slot=${slot}`
|
|
142
143
|
).then(r => r.json())
|
|
143
144
|
}
|
|
144
145
|
|
|
@@ -148,7 +149,7 @@ class HB {
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
async spawn(tags = {}) {
|
|
151
|
-
const addr = await this.meta.info({ key: "address" })
|
|
152
|
+
const addr = await this.dev.meta.info({ key: "address" })
|
|
152
153
|
this.scheduler ??= addr
|
|
153
154
|
const res = await this.send(
|
|
154
155
|
mergeLeft(tags, {
|
|
@@ -196,7 +197,7 @@ class HB {
|
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
async spawnAOS(image) {
|
|
199
|
-
const addr = await this.meta.info({ key: "address" })
|
|
200
|
+
const addr = await this.dev.meta.info({ key: "address" })
|
|
200
201
|
this.scheduler ??= addr
|
|
201
202
|
image ??= this.image ?? (await this.getImage())
|
|
202
203
|
const res = await this.send({
|
|
@@ -296,17 +297,17 @@ class HB {
|
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
/*
|
|
299
|
-
|
|
300
|
+
async scheduleLegacy({ tags = {}, data, process, action = "Eval" } = {}) {
|
|
300
301
|
tags = mergeLeft(tags, {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
path: `${process}/schedule`,
|
|
303
|
+
type: "Message",
|
|
304
|
+
action,
|
|
305
|
+
data,
|
|
306
|
+
"Data-Protocol": "ao",
|
|
307
|
+
Variant: "ao.N.1",
|
|
307
308
|
})
|
|
308
309
|
return (await this.post({ tags })).slot.text()
|
|
309
|
-
|
|
310
|
+
}
|
|
310
311
|
*/
|
|
311
312
|
|
|
312
313
|
async dryrun({ tags = {}, pid, action, data } = {}) {
|