wao 0.36.1 → 0.36.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 +18 -19
- package/esm/hb.js +11 -12
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -492,7 +492,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
492
492
|
data: data,
|
|
493
493
|
pid: this.cache,
|
|
494
494
|
tags: {
|
|
495
|
-
"
|
|
495
|
+
"Content-Type": type
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
498
|
case 9:
|
|
@@ -600,7 +600,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
600
600
|
case 0:
|
|
601
601
|
_ref7 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, pid = _ref7.pid, _ref7$tags = _ref7.tags, tags = _ref7$tags === void 0 ? {} : _ref7$tags, data = _ref7.data;
|
|
602
602
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
603
|
-
|
|
603
|
+
Type: "Message",
|
|
604
604
|
target: pid
|
|
605
605
|
});
|
|
606
606
|
if (data) _tags.data = data;
|
|
@@ -686,14 +686,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
686
686
|
signingFormat: "ANS-104"
|
|
687
687
|
}));
|
|
688
688
|
signer = new _sdk.ArweaveSigner(this.jwk);
|
|
689
|
-
console.log(_tags);
|
|
690
689
|
di = (0, _arbundles.createData)(data, signer, {
|
|
691
690
|
tags: _tags
|
|
692
691
|
});
|
|
693
|
-
_context19.next =
|
|
692
|
+
_context19.next = 6;
|
|
694
693
|
return di.sign(signer);
|
|
695
|
-
case
|
|
696
|
-
_context19.next =
|
|
694
|
+
case 6:
|
|
695
|
+
_context19.next = 8;
|
|
697
696
|
return fetch("".concat(this.url).concat(path), {
|
|
698
697
|
method: "POST",
|
|
699
698
|
headers: {
|
|
@@ -702,19 +701,19 @@ var HB = /*#__PURE__*/function () {
|
|
|
702
701
|
},
|
|
703
702
|
body: di.binary
|
|
704
703
|
});
|
|
705
|
-
case
|
|
704
|
+
case 8:
|
|
706
705
|
res = _context19.sent;
|
|
707
706
|
_context19.t0 = _hbsig.structured_to;
|
|
708
707
|
_context19.t1 = _hbsig.httpsig_from;
|
|
709
|
-
_context19.next =
|
|
708
|
+
_context19.next = 13;
|
|
710
709
|
return toMsg(res);
|
|
711
|
-
case
|
|
710
|
+
case 13:
|
|
712
711
|
_context19.t2 = _context19.sent;
|
|
713
712
|
_context19.t3 = (0, _context19.t1)(_context19.t2);
|
|
714
713
|
_headers = (0, _context19.t0)(_context19.t3);
|
|
715
714
|
res.out = _headers;
|
|
716
715
|
return _context19.abrupt("return", res);
|
|
717
|
-
case
|
|
716
|
+
case 18:
|
|
718
717
|
case "end":
|
|
719
718
|
return _context19.stop();
|
|
720
719
|
}
|
|
@@ -750,7 +749,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
750
749
|
break;
|
|
751
750
|
}
|
|
752
751
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
753
|
-
|
|
752
|
+
Type: "Message"
|
|
754
753
|
});
|
|
755
754
|
_context20.next = 6;
|
|
756
755
|
return this.post104({
|
|
@@ -764,7 +763,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
764
763
|
break;
|
|
765
764
|
case 9:
|
|
766
765
|
_tags2 = (0, _ramda.mergeLeft)(tags, {
|
|
767
|
-
|
|
766
|
+
Type: "Message",
|
|
768
767
|
target: pid
|
|
769
768
|
});
|
|
770
769
|
if (data) _tags2.data = data;
|
|
@@ -1027,10 +1026,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
1027
1026
|
tags: (0, _ramda.mergeLeft)(tags, {
|
|
1028
1027
|
"codec-device": "ans104@1.0",
|
|
1029
1028
|
"random-seed": (0, _utils.seed)(16),
|
|
1030
|
-
|
|
1029
|
+
Type: "Process",
|
|
1031
1030
|
"execution-device": "test-device@1.0",
|
|
1032
1031
|
device: "process@1.0",
|
|
1033
|
-
|
|
1032
|
+
Scheduler: this.operator
|
|
1034
1033
|
})
|
|
1035
1034
|
});
|
|
1036
1035
|
case 7:
|
|
@@ -1042,10 +1041,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
1042
1041
|
_context27.next = 13;
|
|
1043
1042
|
return this.commit((0, _ramda.mergeLeft)(tags, {
|
|
1044
1043
|
"random-seed": (0, _utils.seed)(16),
|
|
1045
|
-
|
|
1044
|
+
Type: "Process",
|
|
1046
1045
|
"execution-device": "test-device@1.0",
|
|
1047
1046
|
device: "process@1.0",
|
|
1048
|
-
|
|
1047
|
+
Scheduler: this.operator
|
|
1049
1048
|
}), {
|
|
1050
1049
|
path: false
|
|
1051
1050
|
});
|
|
@@ -1055,7 +1054,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1055
1054
|
_context27.t3 = {
|
|
1056
1055
|
path: "/~process@1.0/schedule",
|
|
1057
1056
|
body: _context27.t1,
|
|
1058
|
-
|
|
1057
|
+
Scheduler: _context27.t2
|
|
1059
1058
|
};
|
|
1060
1059
|
_context27.next = 18;
|
|
1061
1060
|
return _context27.t0.post.call(_context27.t0, _context27.t3);
|
|
@@ -1188,7 +1187,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1188
1187
|
path: "/~relay@1.0/call",
|
|
1189
1188
|
method: "GET",
|
|
1190
1189
|
"relay-path": "".concat(this.cu, "/results/").concat(process).concat(params),
|
|
1191
|
-
"
|
|
1190
|
+
"Content-Type": "application/json"
|
|
1192
1191
|
});
|
|
1193
1192
|
case 9:
|
|
1194
1193
|
res = _context30.sent;
|
|
@@ -1232,7 +1231,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1232
1231
|
path: "/~relay@1.0/call",
|
|
1233
1232
|
method: "POST",
|
|
1234
1233
|
"relay-path": "".concat(this.cu, "/dry-run?process-id=").concat(pid),
|
|
1235
|
-
"
|
|
1234
|
+
"Content-Type": "application/json",
|
|
1236
1235
|
"relay-body": JSON.stringify(json)
|
|
1237
1236
|
});
|
|
1238
1237
|
case 6:
|
package/esm/hb.js
CHANGED
|
@@ -127,7 +127,7 @@ class HB {
|
|
|
127
127
|
const { slot } = await this.scheduleFlat({
|
|
128
128
|
data,
|
|
129
129
|
pid: this.cache,
|
|
130
|
-
tags: { "
|
|
130
|
+
tags: { "Content-Type": type },
|
|
131
131
|
})
|
|
132
132
|
const msgs = await this.messages({ pid: this.cache, from: slot, limit: 1 })
|
|
133
133
|
return msgs.edges[0].node.message.Id
|
|
@@ -146,7 +146,7 @@ class HB {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
async scheduleFlat({ pid, tags = {}, data } = {}) {
|
|
149
|
-
let _tags = mergeLeft(tags, {
|
|
149
|
+
let _tags = mergeLeft(tags, { Type: "Message", target: pid })
|
|
150
150
|
if (data) _tags.data = data
|
|
151
151
|
let res = await this.post({ path: "/~process@1.0/schedule", body: _tags })
|
|
152
152
|
return { slot: res.out.slot, res, pid }
|
|
@@ -163,7 +163,6 @@ class HB {
|
|
|
163
163
|
async post104({ path = "/~process@1.0/schedule", tags = {}, data = "1984" }) {
|
|
164
164
|
const _tags = buildTags(mergeLeft(tags, { signingFormat: "ANS-104" }))
|
|
165
165
|
const signer = new ArweaveSigner(this.jwk)
|
|
166
|
-
console.log(_tags)
|
|
167
166
|
const di = createData(data, signer, { tags: _tags })
|
|
168
167
|
await di.sign(signer)
|
|
169
168
|
let res = await fetch(`${this.url}${path}`, {
|
|
@@ -182,14 +181,14 @@ class HB {
|
|
|
182
181
|
async schedule({ pid, tags = {}, data } = {}) {
|
|
183
182
|
let res = null
|
|
184
183
|
if (this.format === "ans104") {
|
|
185
|
-
let _tags = mergeLeft(tags, {
|
|
184
|
+
let _tags = mergeLeft(tags, { Type: "Message" })
|
|
186
185
|
res = await this.post104({
|
|
187
186
|
path: `/${pid}/schedule`,
|
|
188
187
|
tags: _tags,
|
|
189
188
|
data: data ?? "1984",
|
|
190
189
|
})
|
|
191
190
|
} else {
|
|
192
|
-
let _tags = mergeLeft(tags, {
|
|
191
|
+
let _tags = mergeLeft(tags, { Type: "Message", target: pid })
|
|
193
192
|
if (data) _tags.data = data
|
|
194
193
|
let body = await this.commit(_tags, { path: false })
|
|
195
194
|
let signed = await this.sign({ path: `/${pid}/schedule`, body })
|
|
@@ -256,10 +255,10 @@ class HB {
|
|
|
256
255
|
tags: mergeLeft(tags, {
|
|
257
256
|
"codec-device": "ans104@1.0",
|
|
258
257
|
"random-seed": seed(16),
|
|
259
|
-
|
|
258
|
+
Type: "Process",
|
|
260
259
|
"execution-device": "test-device@1.0",
|
|
261
260
|
device: "process@1.0",
|
|
262
|
-
|
|
261
|
+
Scheduler: this.operator,
|
|
263
262
|
}),
|
|
264
263
|
})
|
|
265
264
|
} else {
|
|
@@ -268,14 +267,14 @@ class HB {
|
|
|
268
267
|
body: await this.commit(
|
|
269
268
|
mergeLeft(tags, {
|
|
270
269
|
"random-seed": seed(16),
|
|
271
|
-
|
|
270
|
+
Type: "Process",
|
|
272
271
|
"execution-device": "test-device@1.0",
|
|
273
272
|
device: "process@1.0",
|
|
274
|
-
|
|
273
|
+
Scheduler: this.operator,
|
|
275
274
|
}),
|
|
276
275
|
{ path: false }
|
|
277
276
|
),
|
|
278
|
-
|
|
277
|
+
Scheduler: this.operator,
|
|
279
278
|
})
|
|
280
279
|
}
|
|
281
280
|
return { res, pid: res.out.process }
|
|
@@ -316,7 +315,7 @@ class HB {
|
|
|
316
315
|
path: "/~relay@1.0/call",
|
|
317
316
|
method: "GET",
|
|
318
317
|
"relay-path": `${this.cu}/results/${process}${params}`,
|
|
319
|
-
"
|
|
318
|
+
"Content-Type": "application/json",
|
|
320
319
|
})
|
|
321
320
|
return JSON.parse(res.body)
|
|
322
321
|
}
|
|
@@ -329,7 +328,7 @@ class HB {
|
|
|
329
328
|
path: "/~relay@1.0/call",
|
|
330
329
|
method: "POST",
|
|
331
330
|
"relay-path": `${this.cu}/dry-run?process-id=${pid}`,
|
|
332
|
-
"
|
|
331
|
+
"Content-Type": "application/json",
|
|
333
332
|
"relay-body": JSON.stringify(json),
|
|
334
333
|
})
|
|
335
334
|
return JSON.parse(res.body)
|