wao 0.13.0 → 0.13.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/bao.js CHANGED
@@ -71,10 +71,12 @@ var AO = /*#__PURE__*/function (_MAO) {
71
71
  })]);
72
72
  _this.in_memory = true;
73
73
  _this.createDataItemSigner = (_opt$createDataItemSi = opt.createDataItemSigner) !== null && _opt$createDataItemSi !== void 0 ? _opt$createDataItemSi : _aoconnect.createDataItemSigner;
74
+ _this.hb = opt.hb;
74
75
  var _opt$connect = opt.connect(opt.mem, {
75
76
  extensions: opt.extensions,
76
77
  cache: opt.cache,
77
- reset: opt.reset
78
+ reset: opt.reset,
79
+ hb: _this.hb
78
80
  }),
79
81
  modules = _opt$connect.modules,
80
82
  results = _opt$connect.results,
@@ -85,7 +87,9 @@ var AO = /*#__PURE__*/function (_MAO) {
85
87
  dryrun = _opt$connect.dryrun,
86
88
  monitor = _opt$connect.monitor,
87
89
  unmonitor = _opt$connect.unmonitor,
90
+ recover = _opt$connect.recover,
88
91
  mem = _opt$connect.mem;
92
+ _this.recover = recover;
89
93
  _this.assign = assign;
90
94
  _this.result = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
91
95
  var res,
@@ -168,8 +172,15 @@ var AO = /*#__PURE__*/function (_MAO) {
168
172
  _context4.next = 3;
169
173
  return this.ar.init(jwk);
170
174
  case 3:
175
+ if (!this.hb) {
176
+ _context4.next = 6;
177
+ break;
178
+ }
179
+ _context4.next = 6;
180
+ return this.hb.init(jwk);
181
+ case 6:
171
182
  return _context4.abrupt("return", this);
172
- case 4:
183
+ case 7:
173
184
  case "end":
174
185
  return _context4.stop();
175
186
  }
package/cjs/bar.js CHANGED
@@ -93,32 +93,41 @@ var AR = /*#__PURE__*/function (_MAR) {
93
93
  key: "httpmsg",
94
94
  value: function () {
95
95
  var _httpmsg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
96
- var tags, _parseSignatureInput, n, owner;
96
+ var tags, owner, _parseSignatureInput, n, _tags$Owner;
97
97
  return _regeneratorRuntime().wrap(function _callee$(_context) {
98
98
  while (1) switch (_context.prev = _context.next) {
99
99
  case 0:
100
100
  tags = (0, _utils.tags)(msg.tags);
101
+ owner = null;
102
+ _context.prev = 2;
101
103
  _parseSignatureInput = parseSignatureInput(tags["signature-input"]), n = _parseSignatureInput.keyid;
102
- _context.next = 4;
104
+ _context.next = 6;
103
105
  return this.arweave.wallets.jwkToAddress({
104
106
  n: n
105
107
  });
106
- case 4:
108
+ case 6:
107
109
  owner = _context.sent;
108
- _context.next = 7;
110
+ _context.next = 12;
111
+ break;
112
+ case 9:
113
+ _context.prev = 9;
114
+ _context.t0 = _context["catch"](2);
115
+ owner = (_tags$Owner = tags.Owner) !== null && _tags$Owner !== void 0 ? _tags$Owner : null;
116
+ case 12:
117
+ _context.next = 14;
109
118
  return this.mem.set(msg, "txs", msg.id);
110
- case 7:
119
+ case 14:
111
120
  return _context.abrupt("return", {
112
121
  item: msg,
113
122
  id: tags.id,
114
123
  tags: tags,
115
124
  owner: owner
116
125
  });
117
- case 8:
126
+ case 15:
118
127
  case "end":
119
128
  return _context.stop();
120
129
  }
121
- }, _callee, this);
130
+ }, _callee, this, [[2, 9]]);
122
131
  }));
123
132
  function httpmsg(_x) {
124
133
  return _httpmsg.apply(this, arguments);
package/cjs/hb.js CHANGED
@@ -176,19 +176,80 @@ var HB = /*#__PURE__*/function () {
176
176
  return init;
177
177
  }()
178
178
  }, {
179
- key: "process",
179
+ key: "messages",
180
180
  value: function () {
181
- var _process = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
181
+ var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
182
+ var _this = this;
182
183
  var _ref2,
183
- _ref2$tags,
184
+ target,
185
+ from,
186
+ to,
187
+ limit,
188
+ params,
189
+ res,
190
+ _args5 = arguments;
191
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
192
+ while (1) switch (_context5.prev = _context5.next) {
193
+ case 0:
194
+ _ref2 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, target = _ref2.target, from = _ref2.from, to = _ref2.to, limit = _ref2.limit;
195
+ params = "target=".concat(target);
196
+ if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
197
+ if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
198
+ params += "&accept=application/aos-2";
199
+ _context5.next = 7;
200
+ return fetch("".concat(this.url, "/~scheduler@1.0/schedule?").concat(params)).then(function (r) {
201
+ return r.json();
202
+ });
203
+ case 7:
204
+ res = _context5.sent;
205
+ if (res.page_info.has_next_page) {
206
+ res.next = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
207
+ var from2;
208
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
209
+ while (1) switch (_context4.prev = _context4.next) {
210
+ case 0:
211
+ from2 = (0, _ramda.last)(res.edges).cursor + 1;
212
+ _context4.next = 3;
213
+ return _this.message({
214
+ target: target,
215
+ from2: from2,
216
+ to: to
217
+ });
218
+ case 3:
219
+ return _context4.abrupt("return", _context4.sent);
220
+ case 4:
221
+ case "end":
222
+ return _context4.stop();
223
+ }
224
+ }, _callee4);
225
+ }));
226
+ }
227
+ return _context5.abrupt("return", res);
228
+ case 10:
229
+ case "end":
230
+ return _context5.stop();
231
+ }
232
+ }, _callee5, this);
233
+ }));
234
+ function messages() {
235
+ return _messages.apply(this, arguments);
236
+ }
237
+ return messages;
238
+ }()
239
+ }, {
240
+ key: "process",
241
+ value: function () {
242
+ var _process = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
243
+ var _ref4,
244
+ _ref4$tags,
184
245
  tags,
185
- _ref2$data,
246
+ _ref4$data,
186
247
  data,
187
- _args4 = arguments;
188
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
189
- while (1) switch (_context4.prev = _context4.next) {
248
+ _args6 = arguments;
249
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
250
+ while (1) switch (_context6.prev = _context6.next) {
190
251
  case 0:
191
- _ref2 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref2$tags = _ref2.tags, tags = _ref2$tags === void 0 ? {} : _ref2$tags, _ref2$data = _ref2.data, data = _ref2$data === void 0 ? "1984" : _ref2$data;
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;
192
253
  tags = (0, _ramda.mergeLeft)(tags, {
193
254
  data: data,
194
255
  Type: "Process",
@@ -203,17 +264,17 @@ var HB = /*#__PURE__*/function () {
203
264
  "scheduler-device": "scheduler@1.0",
204
265
  "execution-device": "genesis-wasm@1.0"
205
266
  });
206
- _context4.next = 4;
267
+ _context6.next = 4;
207
268
  return this.post({
208
269
  tags: tags
209
270
  });
210
271
  case 4:
211
- return _context4.abrupt("return", _context4.sent);
272
+ return _context6.abrupt("return", _context6.sent);
212
273
  case 5:
213
274
  case "end":
214
- return _context4.stop();
275
+ return _context6.stop();
215
276
  }
216
- }, _callee4, this);
277
+ }, _callee6, this);
217
278
  }));
218
279
  function process() {
219
280
  return _process.apply(this, arguments);
@@ -223,19 +284,19 @@ var HB = /*#__PURE__*/function () {
223
284
  }, {
224
285
  key: "schedule",
225
286
  value: function () {
226
- var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
227
- var _ref3,
228
- _ref3$tags,
287
+ var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
288
+ var _ref5,
289
+ _ref5$tags,
229
290
  tags,
230
291
  data,
231
292
  process,
232
- _ref3$action,
293
+ _ref5$action,
233
294
  action,
234
- _args5 = arguments;
235
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
236
- while (1) switch (_context5.prev = _context5.next) {
295
+ _args7 = arguments;
296
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
297
+ while (1) switch (_context7.prev = _context7.next) {
237
298
  case 0:
238
- _ref3 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref3$tags = _ref3.tags, tags = _ref3$tags === void 0 ? {} : _ref3$tags, data = _ref3.data, process = _ref3.process, _ref3$action = _ref3.action, action = _ref3$action === void 0 ? "Eval" : _ref3$action;
299
+ _ref5 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, _ref5$tags = _ref5.tags, tags = _ref5$tags === void 0 ? {} : _ref5$tags, data = _ref5.data, process = _ref5.process, _ref5$action = _ref5.action, action = _ref5$action === void 0 ? "Eval" : _ref5$action;
239
300
  tags = (0, _ramda.mergeLeft)(tags, {
240
301
  path: "".concat(process, "/schedule"),
241
302
  type: "Message",
@@ -244,17 +305,17 @@ var HB = /*#__PURE__*/function () {
244
305
  "Data-Protocol": "ao",
245
306
  Variant: "ao.N.1"
246
307
  });
247
- _context5.next = 4;
308
+ _context7.next = 4;
248
309
  return this.post({
249
310
  tags: tags
250
311
  });
251
312
  case 4:
252
- return _context5.abrupt("return", _context5.sent.slot.text());
313
+ return _context7.abrupt("return", _context7.sent.slot.text());
253
314
  case 5:
254
315
  case "end":
255
- return _context5.stop();
316
+ return _context7.stop();
256
317
  }
257
- }, _callee5, this);
318
+ }, _callee7, this);
258
319
  }));
259
320
  function schedule() {
260
321
  return _schedule.apply(this, arguments);
@@ -264,29 +325,29 @@ var HB = /*#__PURE__*/function () {
264
325
  }, {
265
326
  key: "compute",
266
327
  value: function () {
267
- var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
268
- var _ref4,
269
- _ref4$tags,
328
+ var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
329
+ var _ref6,
330
+ _ref6$tags,
270
331
  tags,
271
332
  process,
272
333
  slot,
273
- _args6 = arguments;
274
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
275
- while (1) switch (_context6.prev = _context6.next) {
334
+ _args8 = arguments;
335
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
336
+ while (1) switch (_context8.prev = _context8.next) {
276
337
  case 0:
277
- _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$tags = _ref4.tags, tags = _ref4$tags === void 0 ? {} : _ref4$tags, process = _ref4.process, slot = _ref4.slot;
278
- _context6.next = 3;
338
+ _ref6 = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {}, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, process = _ref6.process, slot = _ref6.slot;
339
+ _context8.next = 3;
279
340
  return this.request({
280
341
  method: "GET",
281
342
  path: "/".concat(process, "/compute&slot+integer=").concat(slot, "/results/json")
282
343
  });
283
344
  case 3:
284
- return _context6.abrupt("return", _context6.sent);
345
+ return _context8.abrupt("return", _context8.sent);
285
346
  case 4:
286
347
  case "end":
287
- return _context6.stop();
348
+ return _context8.stop();
288
349
  }
289
- }, _callee6, this);
350
+ }, _callee8, this);
290
351
  }));
291
352
  function compute() {
292
353
  return _compute.apply(this, arguments);
@@ -296,31 +357,31 @@ var HB = /*#__PURE__*/function () {
296
357
  }, {
297
358
  key: "dryrun",
298
359
  value: function () {
299
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
300
- var _ref5,
301
- _ref5$tags,
360
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
361
+ var _ref7,
362
+ _ref7$tags,
302
363
  tags,
303
364
  process,
304
365
  action,
305
- _args7 = arguments;
306
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
307
- while (1) switch (_context7.prev = _context7.next) {
366
+ _args9 = arguments;
367
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
368
+ while (1) switch (_context9.prev = _context9.next) {
308
369
  case 0:
309
- _ref5 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, _ref5$tags = _ref5.tags, tags = _ref5$tags === void 0 ? {} : _ref5$tags, process = _ref5.process, action = _ref5.action;
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;
310
371
  if (typeof action === "string") tags.Action = action;
311
- _context7.next = 4;
372
+ _context9.next = 4;
312
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({
313
374
  Tags: (0, _utils.buildTags)(tags)
314
375
  }))).then(function (r) {
315
376
  return r.json();
316
377
  });
317
378
  case 4:
318
- return _context7.abrupt("return", _context7.sent);
379
+ return _context9.abrupt("return", _context9.sent);
319
380
  case 5:
320
381
  case "end":
321
- return _context7.stop();
382
+ return _context9.stop();
322
383
  }
323
- }, _callee7, this);
384
+ }, _callee9, this);
324
385
  }));
325
386
  function dryrun() {
326
387
  return _dryrun.apply(this, arguments);
@@ -330,25 +391,25 @@ var HB = /*#__PURE__*/function () {
330
391
  }, {
331
392
  key: "get",
332
393
  value: function () {
333
- var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref6) {
334
- var device, _ref6$path, path;
335
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
336
- while (1) switch (_context8.prev = _context8.next) {
394
+ var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref8) {
395
+ var device, _ref8$path, path;
396
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
397
+ while (1) switch (_context10.prev = _context10.next) {
337
398
  case 0:
338
- device = _ref6.device, _ref6$path = _ref6.path, path = _ref6$path === void 0 ? "~meta@1.0/info" : _ref6$path;
339
- _context8.next = 3;
399
+ device = _ref8.device, _ref8$path = _ref8.path, path = _ref8$path === void 0 ? "~meta@1.0/info" : _ref8$path;
400
+ _context10.next = 3;
340
401
  return this.request({
341
402
  device: device,
342
403
  path: path,
343
404
  method: "GET"
344
405
  });
345
406
  case 3:
346
- return _context8.abrupt("return", _context8.sent.body);
407
+ return _context10.abrupt("return", _context10.sent.body);
347
408
  case 4:
348
409
  case "end":
349
- return _context8.stop();
410
+ return _context10.stop();
350
411
  }
351
- }, _callee8, this);
412
+ }, _callee10, this);
352
413
  }));
353
414
  function get(_x2) {
354
415
  return _get.apply(this, arguments);
@@ -358,13 +419,13 @@ var HB = /*#__PURE__*/function () {
358
419
  }, {
359
420
  key: "post",
360
421
  value: function () {
361
- var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref7) {
362
- var device, tags, _ref7$path, path;
363
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
364
- while (1) switch (_context9.prev = _context9.next) {
422
+ var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref9) {
423
+ var device, tags, _ref9$path, path;
424
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
425
+ while (1) switch (_context11.prev = _context11.next) {
365
426
  case 0:
366
- device = _ref7.device, tags = _ref7.tags, _ref7$path = _ref7.path, path = _ref7$path === void 0 ? "/schedule" : _ref7$path;
367
- _context9.next = 3;
427
+ device = _ref9.device, tags = _ref9.tags, _ref9$path = _ref9.path, path = _ref9$path === void 0 ? "/schedule" : _ref9$path;
428
+ _context11.next = 3;
368
429
  return this.request({
369
430
  tags: tags,
370
431
  device: device,
@@ -372,12 +433,12 @@ var HB = /*#__PURE__*/function () {
372
433
  method: "POST"
373
434
  });
374
435
  case 3:
375
- return _context9.abrupt("return", _context9.sent);
436
+ return _context11.abrupt("return", _context11.sent);
376
437
  case 4:
377
438
  case "end":
378
- return _context9.stop();
439
+ return _context11.stop();
379
440
  }
380
- }, _callee9, this);
441
+ }, _callee11, this);
381
442
  }));
382
443
  function post(_x3) {
383
444
  return _post.apply(this, arguments);
@@ -387,26 +448,26 @@ var HB = /*#__PURE__*/function () {
387
448
  }, {
388
449
  key: "request",
389
450
  value: function () {
390
- var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref8) {
391
- var device, tags, _ref8$method, method, _ref8$path, path, _tags;
392
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
393
- while (1) switch (_context10.prev = _context10.next) {
451
+ var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref10) {
452
+ var device, tags, _ref10$method, method, _ref10$path, path, _tags;
453
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
454
+ while (1) switch (_context12.prev = _context12.next) {
394
455
  case 0:
395
- device = _ref8.device, tags = _ref8.tags, _ref8$method = _ref8.method, method = _ref8$method === void 0 ? "POST" : _ref8$method, _ref8$path = _ref8.path, path = _ref8$path === void 0 ? "/schedule" : _ref8$path;
456
+ device = _ref10.device, tags = _ref10.tags, _ref10$method = _ref10.method, method = _ref10$method === void 0 ? "POST" : _ref10$method, _ref10$path = _ref10.path, path = _ref10$path === void 0 ? "/schedule" : _ref10$path;
396
457
  _tags = (0, _ramda.mergeLeft)(tags, {
397
458
  path: path,
398
459
  method: method
399
460
  });
400
461
  if (device) _tags.device = device;
401
- _context10.next = 5;
462
+ _context12.next = 5;
402
463
  return this._request(_tags);
403
464
  case 5:
404
- return _context10.abrupt("return", _context10.sent);
465
+ return _context12.abrupt("return", _context12.sent);
405
466
  case 6:
406
467
  case "end":
407
- return _context10.stop();
468
+ return _context12.stop();
408
469
  }
409
- }, _callee10, this);
470
+ }, _callee12, this);
410
471
  }));
411
472
  function request(_x4) {
412
473
  return _request.apply(this, arguments);
package/cjs/run.js CHANGED
@@ -18,7 +18,8 @@ var _yargs$argv = (0, _yargs["default"])(process.argv.slice(2)).argv,
18
18
  _yargs$argv$port = _yargs$argv.port,
19
19
  port = _yargs$argv$port === void 0 ? 4000 : _yargs$argv$port,
20
20
  _yargs$argv$db = _yargs$argv.db,
21
- db = _yargs$argv$db === void 0 ? ".cache" : _yargs$argv$db;
21
+ db = _yargs$argv$db === void 0 ? ".cache" : _yargs$argv$db,
22
+ hb = _yargs$argv.hb;
22
23
  db = memory ? null : (0, _path.resolve)(process.cwd(), db);
23
24
  if (reset) {
24
25
  try {
@@ -33,7 +34,8 @@ var main = /*#__PURE__*/function () {
33
34
  return _context.abrupt("return", new _server["default"]({
34
35
  log: true,
35
36
  port: port,
36
- db: db
37
+ db: db,
38
+ hb_url: hb
37
39
  }));
38
40
  case 1:
39
41
  case "end":