wao 0.31.2 → 0.32.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 +708 -435
- package/cjs/hb2.js +1505 -0
- package/cjs/hb3.js +1468 -0
- package/cjs/http-message-signatures/httpbis.js +497 -0
- package/cjs/http-message-signatures/index.js +26 -0
- package/cjs/http-message-signatures/structured-header.js +129 -0
- package/cjs/hyperbeam.js +1 -3
- package/cjs/send.js +5 -5
- package/cjs/signer-utils.js +6 -6
- package/cjs/signer.js +12 -15
- package/cjs/workspace/README.md +2 -1
- package/cjs/workspace/package.json +1 -1
- package/cjs/workspace/test/legacynet.test.js +23 -0
- package/cjs/workspace/test/web.test.js +1 -11
- package/esm/hb.js +213 -94
- package/esm/hb2.js +439 -0
- package/esm/hb3.js +418 -0
- package/esm/http-message-signatures/httpbis.js +438 -0
- package/esm/http-message-signatures/index.js +4 -0
- package/esm/http-message-signatures/structured-header.js +105 -0
- package/esm/hyperbeam.js +2 -2
- package/esm/send.js +1 -1
- package/esm/signer-utils.js +1 -1
- package/esm/signer.js +11 -15
- package/esm/workspace/README.md +2 -1
- package/esm/workspace/package.json +1 -1
- package/esm/workspace/test/legacynet.test.js +23 -0
- package/esm/workspace/test/web.test.js +1 -11
- package/package.json +2 -1
package/cjs/hb.js
CHANGED
|
@@ -232,81 +232,39 @@ var HB = /*#__PURE__*/function () {
|
|
|
232
232
|
}
|
|
233
233
|
return getLua;
|
|
234
234
|
}()
|
|
235
|
-
}, {
|
|
236
|
-
key: "scheduleAOS",
|
|
237
|
-
value: function () {
|
|
238
|
-
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref2) {
|
|
239
|
-
var _pid;
|
|
240
|
-
var pid, _ref2$action, action, _ref2$tags, tags, data, _tags, res, slot;
|
|
241
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
242
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
243
|
-
case 0:
|
|
244
|
-
pid = _ref2.pid, _ref2$action = _ref2.action, action = _ref2$action === void 0 ? "Eval" : _ref2$action, _ref2$tags = _ref2.tags, tags = _ref2$tags === void 0 ? {} : _ref2$tags, data = _ref2.data;
|
|
245
|
-
(_pid = pid) !== null && _pid !== void 0 ? _pid : pid = this.pid;
|
|
246
|
-
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
247
|
-
device: "process@1.0",
|
|
248
|
-
method: "POST",
|
|
249
|
-
path: "/".concat(pid, "~process@1.0/schedule"),
|
|
250
|
-
scheduler: this.scheduler,
|
|
251
|
-
type: "Message",
|
|
252
|
-
Action: action,
|
|
253
|
-
target: pid
|
|
254
|
-
});
|
|
255
|
-
if (data) _tags.data = data;
|
|
256
|
-
_context7.next = 6;
|
|
257
|
-
return this.post(_tags);
|
|
258
|
-
case 6:
|
|
259
|
-
res = _context7.sent;
|
|
260
|
-
slot = res.headers.slot;
|
|
261
|
-
return _context7.abrupt("return", {
|
|
262
|
-
slot: slot,
|
|
263
|
-
res: res,
|
|
264
|
-
pid: pid
|
|
265
|
-
});
|
|
266
|
-
case 9:
|
|
267
|
-
case "end":
|
|
268
|
-
return _context7.stop();
|
|
269
|
-
}
|
|
270
|
-
}, _callee7, this);
|
|
271
|
-
}));
|
|
272
|
-
function scheduleAOS(_x4) {
|
|
273
|
-
return _scheduleAOS.apply(this, arguments);
|
|
274
|
-
}
|
|
275
|
-
return scheduleAOS;
|
|
276
|
-
}()
|
|
277
235
|
}, {
|
|
278
236
|
key: "messageAOS",
|
|
279
237
|
value: function () {
|
|
280
|
-
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
238
|
+
var _messageAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(args) {
|
|
281
239
|
var _yield$this$scheduleA, slot, pid;
|
|
282
|
-
return _regeneratorRuntime().wrap(function
|
|
283
|
-
while (1) switch (
|
|
240
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
241
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
284
242
|
case 0:
|
|
285
|
-
|
|
243
|
+
_context7.next = 2;
|
|
286
244
|
return this.scheduleAOS(args);
|
|
287
245
|
case 2:
|
|
288
|
-
_yield$this$scheduleA =
|
|
246
|
+
_yield$this$scheduleA = _context7.sent;
|
|
289
247
|
slot = _yield$this$scheduleA.slot;
|
|
290
248
|
pid = _yield$this$scheduleA.pid;
|
|
291
|
-
|
|
292
|
-
|
|
249
|
+
_context7.t0 = slot;
|
|
250
|
+
_context7.next = 8;
|
|
293
251
|
return this.computeAOS({
|
|
294
252
|
pid: pid,
|
|
295
253
|
slot: slot
|
|
296
254
|
});
|
|
297
255
|
case 8:
|
|
298
|
-
|
|
299
|
-
return
|
|
300
|
-
slot:
|
|
301
|
-
outbox:
|
|
256
|
+
_context7.t1 = _context7.sent;
|
|
257
|
+
return _context7.abrupt("return", {
|
|
258
|
+
slot: _context7.t0,
|
|
259
|
+
outbox: _context7.t1
|
|
302
260
|
});
|
|
303
261
|
case 10:
|
|
304
262
|
case "end":
|
|
305
|
-
return
|
|
263
|
+
return _context7.stop();
|
|
306
264
|
}
|
|
307
|
-
},
|
|
265
|
+
}, _callee7, this);
|
|
308
266
|
}));
|
|
309
|
-
function messageAOS(
|
|
267
|
+
function messageAOS(_x4) {
|
|
310
268
|
return _messageAOS.apply(this, arguments);
|
|
311
269
|
}
|
|
312
270
|
return messageAOS;
|
|
@@ -314,36 +272,36 @@ var HB = /*#__PURE__*/function () {
|
|
|
314
272
|
}, {
|
|
315
273
|
key: "messageLegacy",
|
|
316
274
|
value: function () {
|
|
317
|
-
var _messageLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
275
|
+
var _messageLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(args) {
|
|
318
276
|
var _yield$this$scheduleL, slot, pid;
|
|
319
|
-
return _regeneratorRuntime().wrap(function
|
|
320
|
-
while (1) switch (
|
|
277
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
278
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
321
279
|
case 0:
|
|
322
|
-
|
|
280
|
+
_context8.next = 2;
|
|
323
281
|
return this.scheduleLegacy(args);
|
|
324
282
|
case 2:
|
|
325
|
-
_yield$this$scheduleL =
|
|
283
|
+
_yield$this$scheduleL = _context8.sent;
|
|
326
284
|
slot = _yield$this$scheduleL.slot;
|
|
327
285
|
pid = _yield$this$scheduleL.pid;
|
|
328
|
-
|
|
329
|
-
|
|
286
|
+
_context8.t0 = slot;
|
|
287
|
+
_context8.next = 8;
|
|
330
288
|
return this.computeLegacy({
|
|
331
289
|
pid: pid,
|
|
332
290
|
slot: slot
|
|
333
291
|
});
|
|
334
292
|
case 8:
|
|
335
|
-
|
|
336
|
-
return
|
|
337
|
-
slot:
|
|
338
|
-
res:
|
|
293
|
+
_context8.t1 = _context8.sent;
|
|
294
|
+
return _context8.abrupt("return", {
|
|
295
|
+
slot: _context8.t0,
|
|
296
|
+
res: _context8.t1
|
|
339
297
|
});
|
|
340
298
|
case 10:
|
|
341
299
|
case "end":
|
|
342
|
-
return
|
|
300
|
+
return _context8.stop();
|
|
343
301
|
}
|
|
344
|
-
},
|
|
302
|
+
}, _callee8, this);
|
|
345
303
|
}));
|
|
346
|
-
function messageLegacy(
|
|
304
|
+
function messageLegacy(_x5) {
|
|
347
305
|
return _messageLegacy.apply(this, arguments);
|
|
348
306
|
}
|
|
349
307
|
return messageLegacy;
|
|
@@ -351,26 +309,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
351
309
|
}, {
|
|
352
310
|
key: "computeAOS",
|
|
353
311
|
value: function () {
|
|
354
|
-
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
312
|
+
var _computeAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref2) {
|
|
355
313
|
var pid, slot;
|
|
356
|
-
return _regeneratorRuntime().wrap(function
|
|
357
|
-
while (1) switch (
|
|
314
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
315
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
358
316
|
case 0:
|
|
359
|
-
pid =
|
|
360
|
-
|
|
317
|
+
pid = _ref2.pid, slot = _ref2.slot;
|
|
318
|
+
_context9.next = 3;
|
|
361
319
|
return this.getJSON({
|
|
362
320
|
path: "/".concat(pid, "/compute/results/outbox"),
|
|
363
321
|
slot: slot
|
|
364
322
|
});
|
|
365
323
|
case 3:
|
|
366
|
-
return
|
|
324
|
+
return _context9.abrupt("return", _context9.sent);
|
|
367
325
|
case 4:
|
|
368
326
|
case "end":
|
|
369
|
-
return
|
|
327
|
+
return _context9.stop();
|
|
370
328
|
}
|
|
371
|
-
},
|
|
329
|
+
}, _callee9, this);
|
|
372
330
|
}));
|
|
373
|
-
function computeAOS(
|
|
331
|
+
function computeAOS(_x6) {
|
|
374
332
|
return _computeAOS.apply(this, arguments);
|
|
375
333
|
}
|
|
376
334
|
return computeAOS;
|
|
@@ -378,26 +336,26 @@ var HB = /*#__PURE__*/function () {
|
|
|
378
336
|
}, {
|
|
379
337
|
key: "computeLua",
|
|
380
338
|
value: function () {
|
|
381
|
-
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
339
|
+
var _computeLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref3) {
|
|
382
340
|
var pid, slot;
|
|
383
|
-
return _regeneratorRuntime().wrap(function
|
|
384
|
-
while (1) switch (
|
|
341
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
342
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
385
343
|
case 0:
|
|
386
|
-
pid =
|
|
387
|
-
|
|
344
|
+
pid = _ref3.pid, slot = _ref3.slot;
|
|
345
|
+
_context10.next = 3;
|
|
388
346
|
return this.getJSON({
|
|
389
347
|
path: "/".concat(pid, "/compute/results"),
|
|
390
348
|
slot: slot
|
|
391
349
|
});
|
|
392
350
|
case 3:
|
|
393
|
-
return
|
|
351
|
+
return _context10.abrupt("return", _context10.sent);
|
|
394
352
|
case 4:
|
|
395
353
|
case "end":
|
|
396
|
-
return
|
|
354
|
+
return _context10.stop();
|
|
397
355
|
}
|
|
398
|
-
},
|
|
356
|
+
}, _callee10, this);
|
|
399
357
|
}));
|
|
400
|
-
function computeLua(
|
|
358
|
+
function computeLua(_x7) {
|
|
401
359
|
return _computeLua.apply(this, arguments);
|
|
402
360
|
}
|
|
403
361
|
return computeLua;
|
|
@@ -405,27 +363,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
405
363
|
}, {
|
|
406
364
|
key: "compute",
|
|
407
365
|
value: function () {
|
|
408
|
-
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
409
|
-
var pid, slot,
|
|
410
|
-
return _regeneratorRuntime().wrap(function
|
|
411
|
-
while (1) switch (
|
|
366
|
+
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref4) {
|
|
367
|
+
var pid, slot, _ref4$path, path;
|
|
368
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
369
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
412
370
|
case 0:
|
|
413
|
-
pid =
|
|
371
|
+
pid = _ref4.pid, slot = _ref4.slot, _ref4$path = _ref4.path, path = _ref4$path === void 0 ? "" : _ref4$path;
|
|
414
372
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
415
|
-
|
|
373
|
+
_context11.next = 4;
|
|
416
374
|
return this.getJSON({
|
|
417
375
|
path: "/".concat(pid, "/compute").concat(path),
|
|
418
376
|
slot: slot
|
|
419
377
|
});
|
|
420
378
|
case 4:
|
|
421
|
-
return
|
|
379
|
+
return _context11.abrupt("return", _context11.sent);
|
|
422
380
|
case 5:
|
|
423
381
|
case "end":
|
|
424
|
-
return
|
|
382
|
+
return _context11.stop();
|
|
425
383
|
}
|
|
426
|
-
},
|
|
384
|
+
}, _callee11, this);
|
|
427
385
|
}));
|
|
428
|
-
function compute(
|
|
386
|
+
function compute(_x8) {
|
|
429
387
|
return _compute.apply(this, arguments);
|
|
430
388
|
}
|
|
431
389
|
return compute;
|
|
@@ -433,27 +391,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
433
391
|
}, {
|
|
434
392
|
key: "computeLegacy",
|
|
435
393
|
value: function () {
|
|
436
|
-
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
394
|
+
var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref5) {
|
|
437
395
|
var pid, slot, json;
|
|
438
|
-
return _regeneratorRuntime().wrap(function
|
|
439
|
-
while (1) switch (
|
|
396
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
397
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
440
398
|
case 0:
|
|
441
|
-
pid =
|
|
442
|
-
|
|
399
|
+
pid = _ref5.pid, slot = _ref5.slot;
|
|
400
|
+
_context12.next = 3;
|
|
443
401
|
return this.compute({
|
|
444
402
|
pid: pid,
|
|
445
403
|
slot: slot
|
|
446
404
|
});
|
|
447
405
|
case 3:
|
|
448
|
-
json =
|
|
449
|
-
return
|
|
406
|
+
json = _context12.sent;
|
|
407
|
+
return _context12.abrupt("return", JSON.parse(json.results.json.body));
|
|
450
408
|
case 5:
|
|
451
409
|
case "end":
|
|
452
|
-
return
|
|
410
|
+
return _context12.stop();
|
|
453
411
|
}
|
|
454
|
-
},
|
|
412
|
+
}, _callee12, this);
|
|
455
413
|
}));
|
|
456
|
-
function computeLegacy(
|
|
414
|
+
function computeLegacy(_x9) {
|
|
457
415
|
return _computeLegacy.apply(this, arguments);
|
|
458
416
|
}
|
|
459
417
|
return computeLegacy;
|
|
@@ -461,8 +419,54 @@ var HB = /*#__PURE__*/function () {
|
|
|
461
419
|
}, {
|
|
462
420
|
key: "spawn",
|
|
463
421
|
value: function () {
|
|
464
|
-
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
422
|
+
var _spawn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
465
423
|
var _this$scheduler;
|
|
424
|
+
var tags,
|
|
425
|
+
addr,
|
|
426
|
+
res,
|
|
427
|
+
_args14 = arguments;
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
429
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
tags = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
432
|
+
_context13.next = 3;
|
|
433
|
+
return this.g("/~meta@1.0/info/address");
|
|
434
|
+
case 3:
|
|
435
|
+
addr = _context13.sent;
|
|
436
|
+
(_this$scheduler = this.scheduler) !== null && _this$scheduler !== void 0 ? _this$scheduler : this.scheduler = addr;
|
|
437
|
+
_context13.next = 7;
|
|
438
|
+
return this.post({
|
|
439
|
+
path: "/~process@1.0/schedule",
|
|
440
|
+
body: (0, _ramda.mergeLeft)(tags, {
|
|
441
|
+
device: "process@1.0",
|
|
442
|
+
"random-seed": seed(16),
|
|
443
|
+
type: "Process",
|
|
444
|
+
"execution-device": "test-device@1.0"
|
|
445
|
+
}),
|
|
446
|
+
scheduler: this.scheduler
|
|
447
|
+
});
|
|
448
|
+
case 7:
|
|
449
|
+
res = _context13.sent;
|
|
450
|
+
return _context13.abrupt("return", {
|
|
451
|
+
res: res,
|
|
452
|
+
pid: res.out.process
|
|
453
|
+
});
|
|
454
|
+
case 9:
|
|
455
|
+
case "end":
|
|
456
|
+
return _context13.stop();
|
|
457
|
+
}
|
|
458
|
+
}, _callee13, this);
|
|
459
|
+
}));
|
|
460
|
+
function spawn() {
|
|
461
|
+
return _spawn.apply(this, arguments);
|
|
462
|
+
}
|
|
463
|
+
return spawn;
|
|
464
|
+
}()
|
|
465
|
+
}, {
|
|
466
|
+
key: "spawn2",
|
|
467
|
+
value: function () {
|
|
468
|
+
var _spawn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
469
|
+
var _this$scheduler2;
|
|
466
470
|
var tags,
|
|
467
471
|
addr,
|
|
468
472
|
_tags,
|
|
@@ -476,17 +480,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
476
480
|
return this.g("/~meta@1.0/info/address");
|
|
477
481
|
case 3:
|
|
478
482
|
addr = _context14.sent;
|
|
479
|
-
(_this$
|
|
483
|
+
(_this$scheduler2 = this.scheduler) !== null && _this$scheduler2 !== void 0 ? _this$scheduler2 : this.scheduler = addr;
|
|
480
484
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
481
|
-
|
|
482
|
-
path: "/schedule",
|
|
485
|
+
path: "/~process@1.0/schedule",
|
|
483
486
|
scheduler: this.scheduler,
|
|
484
487
|
"random-seed": seed(16),
|
|
485
488
|
type: "Process",
|
|
486
489
|
"execution-device": "test-device@1.0"
|
|
487
490
|
});
|
|
488
491
|
_context14.next = 8;
|
|
489
|
-
return this.post(_tags
|
|
492
|
+
return this.post(_tags, {
|
|
493
|
+
path: false
|
|
494
|
+
});
|
|
490
495
|
case 8:
|
|
491
496
|
res = _context14.sent;
|
|
492
497
|
return _context14.abrupt("return", {
|
|
@@ -499,10 +504,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
499
504
|
}
|
|
500
505
|
}, _callee14, this);
|
|
501
506
|
}));
|
|
502
|
-
function
|
|
503
|
-
return
|
|
507
|
+
function spawn2() {
|
|
508
|
+
return _spawn2.apply(this, arguments);
|
|
504
509
|
}
|
|
505
|
-
return
|
|
510
|
+
return spawn2;
|
|
506
511
|
}()
|
|
507
512
|
}, {
|
|
508
513
|
key: "cacheScript",
|
|
@@ -554,7 +559,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
554
559
|
}
|
|
555
560
|
}, _callee15, this);
|
|
556
561
|
}));
|
|
557
|
-
function cacheScript(
|
|
562
|
+
function cacheScript(_x10) {
|
|
558
563
|
return _cacheScript.apply(this, arguments);
|
|
559
564
|
}
|
|
560
565
|
return cacheScript;
|
|
@@ -582,7 +587,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
582
587
|
}
|
|
583
588
|
}, _callee16, this);
|
|
584
589
|
}));
|
|
585
|
-
function cacheBinary(
|
|
590
|
+
function cacheBinary(_x11, _x12) {
|
|
586
591
|
return _cacheBinary.apply(this, arguments);
|
|
587
592
|
}
|
|
588
593
|
return cacheBinary;
|
|
@@ -619,99 +624,114 @@ var HB = /*#__PURE__*/function () {
|
|
|
619
624
|
}
|
|
620
625
|
}, _callee17, this);
|
|
621
626
|
}));
|
|
622
|
-
function message(
|
|
627
|
+
function message(_x13) {
|
|
623
628
|
return _message.apply(this, arguments);
|
|
624
629
|
}
|
|
625
630
|
return message;
|
|
626
631
|
}()
|
|
627
632
|
}, {
|
|
628
|
-
key: "
|
|
633
|
+
key: "schedule2",
|
|
629
634
|
value: function () {
|
|
630
|
-
var
|
|
631
|
-
var
|
|
635
|
+
var _schedule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
636
|
+
var _ref6,
|
|
632
637
|
pid,
|
|
633
|
-
|
|
634
|
-
action,
|
|
635
|
-
_ref7$tags,
|
|
638
|
+
_ref6$tags,
|
|
636
639
|
tags,
|
|
637
640
|
data,
|
|
638
|
-
|
|
641
|
+
_tags,
|
|
642
|
+
res,
|
|
639
643
|
_args19 = arguments;
|
|
640
644
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
641
645
|
while (1) switch (_context18.prev = _context18.next) {
|
|
642
646
|
case 0:
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
647
|
+
_ref6 = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {}, pid = _ref6.pid, _ref6$tags = _ref6.tags, tags = _ref6$tags === void 0 ? {} : _ref6$tags, data = _ref6.data;
|
|
648
|
+
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
649
|
+
method: "POST",
|
|
650
|
+
path: "/".concat(pid, "/schedule"),
|
|
651
|
+
type: "Message",
|
|
652
|
+
target: pid
|
|
653
|
+
});
|
|
654
|
+
if (data) _tags.data = data;
|
|
655
|
+
_context18.next = 5;
|
|
656
|
+
return this.post(_tags, {
|
|
657
|
+
path: false
|
|
651
658
|
});
|
|
652
|
-
case 4:
|
|
653
|
-
return _context18.abrupt("return", _context18.sent);
|
|
654
659
|
case 5:
|
|
660
|
+
res = _context18.sent;
|
|
661
|
+
return _context18.abrupt("return", {
|
|
662
|
+
slot: res.headers.slot,
|
|
663
|
+
res: res,
|
|
664
|
+
pid: pid
|
|
665
|
+
});
|
|
666
|
+
case 7:
|
|
655
667
|
case "end":
|
|
656
668
|
return _context18.stop();
|
|
657
669
|
}
|
|
658
670
|
}, _callee18, this);
|
|
659
671
|
}));
|
|
660
|
-
function
|
|
661
|
-
return
|
|
672
|
+
function schedule2() {
|
|
673
|
+
return _schedule.apply(this, arguments);
|
|
662
674
|
}
|
|
663
|
-
return
|
|
675
|
+
return schedule2;
|
|
664
676
|
}()
|
|
665
677
|
}, {
|
|
666
|
-
key: "
|
|
678
|
+
key: "scheduleLegacy2",
|
|
667
679
|
value: function () {
|
|
668
|
-
var
|
|
669
|
-
var
|
|
680
|
+
var _scheduleLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
681
|
+
var _ref7,
|
|
682
|
+
pid,
|
|
683
|
+
_ref7$action,
|
|
684
|
+
action,
|
|
685
|
+
_ref7$tags,
|
|
686
|
+
tags,
|
|
687
|
+
data,
|
|
688
|
+
scheduler,
|
|
689
|
+
_args20 = arguments;
|
|
670
690
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
671
691
|
while (1) switch (_context19.prev = _context19.next) {
|
|
672
692
|
case 0:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
693
|
+
_ref7 = _args20.length > 0 && _args20[0] !== undefined ? _args20[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;
|
|
694
|
+
_context19.next = 3;
|
|
695
|
+
return this.scheduleLua({
|
|
696
|
+
pid: pid,
|
|
697
|
+
action: action,
|
|
698
|
+
tags: tags,
|
|
699
|
+
data: data,
|
|
700
|
+
scheduler: scheduler
|
|
701
|
+
});
|
|
677
702
|
case 3:
|
|
703
|
+
return _context19.abrupt("return", _context19.sent);
|
|
704
|
+
case 4:
|
|
678
705
|
case "end":
|
|
679
706
|
return _context19.stop();
|
|
680
707
|
}
|
|
681
708
|
}, _callee19, this);
|
|
682
709
|
}));
|
|
683
|
-
function
|
|
684
|
-
return
|
|
710
|
+
function scheduleLegacy2() {
|
|
711
|
+
return _scheduleLegacy.apply(this, arguments);
|
|
685
712
|
}
|
|
686
|
-
return
|
|
713
|
+
return scheduleLegacy2;
|
|
687
714
|
}()
|
|
688
715
|
}, {
|
|
689
|
-
key: "
|
|
716
|
+
key: "scheduleLua",
|
|
690
717
|
value: function () {
|
|
691
|
-
var
|
|
692
|
-
var
|
|
693
|
-
var _ref8,
|
|
694
|
-
pid,
|
|
695
|
-
_ref8$tags,
|
|
696
|
-
tags,
|
|
697
|
-
data,
|
|
698
|
-
_tags,
|
|
699
|
-
res,
|
|
700
|
-
_args21 = arguments;
|
|
718
|
+
var _scheduleLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref8) {
|
|
719
|
+
var pid, _ref8$action, action, _ref8$tags, tags, data, scheduler, _tags, res;
|
|
701
720
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
702
721
|
while (1) switch (_context20.prev = _context20.next) {
|
|
703
722
|
case 0:
|
|
704
|
-
_ref8 =
|
|
705
|
-
(
|
|
723
|
+
pid = _ref8.pid, _ref8$action = _ref8.action, action = _ref8$action === void 0 ? "Eval" : _ref8$action, _ref8$tags = _ref8.tags, tags = _ref8$tags === void 0 ? {} : _ref8$tags, data = _ref8.data, scheduler = _ref8.scheduler;
|
|
724
|
+
if (action) tags.Action = action;
|
|
706
725
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
707
|
-
method: "POST",
|
|
708
726
|
path: "/".concat(pid, "/schedule"),
|
|
709
727
|
type: "Message",
|
|
710
728
|
target: pid
|
|
711
729
|
});
|
|
712
730
|
if (data) _tags.data = data;
|
|
713
731
|
_context20.next = 6;
|
|
714
|
-
return this.post(_tags
|
|
732
|
+
return this.post(_tags, {
|
|
733
|
+
path: false
|
|
734
|
+
});
|
|
715
735
|
case 6:
|
|
716
736
|
res = _context20.sent;
|
|
717
737
|
return _context20.abrupt("return", {
|
|
@@ -725,116 +745,83 @@ var HB = /*#__PURE__*/function () {
|
|
|
725
745
|
}
|
|
726
746
|
}, _callee20, this);
|
|
727
747
|
}));
|
|
748
|
+
function scheduleLua(_x14) {
|
|
749
|
+
return _scheduleLua.apply(this, arguments);
|
|
750
|
+
}
|
|
751
|
+
return scheduleLua;
|
|
752
|
+
}()
|
|
753
|
+
}, {
|
|
754
|
+
key: "schedule",
|
|
755
|
+
value: function () {
|
|
756
|
+
var _schedule2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
757
|
+
var _ref9,
|
|
758
|
+
pid,
|
|
759
|
+
_ref9$tags,
|
|
760
|
+
tags,
|
|
761
|
+
data,
|
|
762
|
+
body,
|
|
763
|
+
res,
|
|
764
|
+
_args22 = arguments;
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
766
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
767
|
+
case 0:
|
|
768
|
+
_ref9 = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {}, pid = _ref9.pid, _ref9$tags = _ref9.tags, tags = _ref9$tags === void 0 ? {} : _ref9$tags, data = _ref9.data;
|
|
769
|
+
body = (0, _ramda.mergeLeft)(tags, {
|
|
770
|
+
type: "Message",
|
|
771
|
+
target: pid
|
|
772
|
+
});
|
|
773
|
+
if (data) body.data = data;
|
|
774
|
+
_context21.next = 5;
|
|
775
|
+
return this.post({
|
|
776
|
+
path: "/~process@1.0/schedule",
|
|
777
|
+
body: body
|
|
778
|
+
});
|
|
779
|
+
case 5:
|
|
780
|
+
res = _context21.sent;
|
|
781
|
+
return _context21.abrupt("return", {
|
|
782
|
+
slot: res.headers.slot,
|
|
783
|
+
res: res,
|
|
784
|
+
pid: pid
|
|
785
|
+
});
|
|
786
|
+
case 7:
|
|
787
|
+
case "end":
|
|
788
|
+
return _context21.stop();
|
|
789
|
+
}
|
|
790
|
+
}, _callee21, this);
|
|
791
|
+
}));
|
|
728
792
|
function schedule() {
|
|
729
|
-
return
|
|
793
|
+
return _schedule2.apply(this, arguments);
|
|
730
794
|
}
|
|
731
795
|
return schedule;
|
|
732
796
|
}()
|
|
733
797
|
}, {
|
|
734
|
-
key: "
|
|
798
|
+
key: "spawnLua",
|
|
735
799
|
value: function () {
|
|
736
|
-
var
|
|
737
|
-
var _this$
|
|
800
|
+
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(lua) {
|
|
801
|
+
var _this$scheduler3, _lua, _this$lua2;
|
|
738
802
|
var addr, res, pid;
|
|
739
|
-
return _regeneratorRuntime().wrap(function
|
|
740
|
-
while (1) switch (
|
|
803
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
804
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
741
805
|
case 0:
|
|
742
|
-
|
|
806
|
+
_context22.next = 2;
|
|
743
807
|
return this.g("/~meta@1.0/info/address");
|
|
744
808
|
case 2:
|
|
745
|
-
addr =
|
|
746
|
-
(_this$
|
|
747
|
-
if (!((
|
|
748
|
-
|
|
809
|
+
addr = _context22.sent;
|
|
810
|
+
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
811
|
+
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
812
|
+
_context22.next = 8;
|
|
749
813
|
break;
|
|
750
814
|
}
|
|
751
|
-
|
|
752
|
-
|
|
815
|
+
_lua;
|
|
816
|
+
_context22.next = 16;
|
|
753
817
|
break;
|
|
754
818
|
case 8:
|
|
755
|
-
if (!((_this$
|
|
756
|
-
|
|
819
|
+
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
820
|
+
_context22.next = 12;
|
|
757
821
|
break;
|
|
758
822
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
break;
|
|
762
|
-
case 12:
|
|
763
|
-
_context21.next = 14;
|
|
764
|
-
return this.getImage();
|
|
765
|
-
case 14:
|
|
766
|
-
_context21.t0 = _context21.sent;
|
|
767
|
-
case 15:
|
|
768
|
-
image = _context21.t0;
|
|
769
|
-
case 16:
|
|
770
|
-
_context21.next = 18;
|
|
771
|
-
return this.post({
|
|
772
|
-
device: "process@1.0",
|
|
773
|
-
path: "/schedule",
|
|
774
|
-
scheduler: this.scheduler,
|
|
775
|
-
"data-protocol": "ao",
|
|
776
|
-
variant: "ao.N.1",
|
|
777
|
-
"scheduler-location": this.scheduler,
|
|
778
|
-
authority: this.scheduler,
|
|
779
|
-
"random-seed": seed(16),
|
|
780
|
-
type: "Process",
|
|
781
|
-
image: image,
|
|
782
|
-
"execution-device": "stack@1.0",
|
|
783
|
-
"push-device": "push@1.0",
|
|
784
|
-
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
|
|
785
|
-
"output-prefix": "wasm",
|
|
786
|
-
"patch-from": "/results/outbox",
|
|
787
|
-
"patch-mode": "patches",
|
|
788
|
-
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
789
|
-
passes: 2
|
|
790
|
-
});
|
|
791
|
-
case 18:
|
|
792
|
-
res = _context21.sent;
|
|
793
|
-
pid = res.headers.process;
|
|
794
|
-
(_this$pid = this.pid) !== null && _this$pid !== void 0 ? _this$pid : this.pid = pid;
|
|
795
|
-
return _context21.abrupt("return", {
|
|
796
|
-
pid: pid,
|
|
797
|
-
res: res
|
|
798
|
-
});
|
|
799
|
-
case 22:
|
|
800
|
-
case "end":
|
|
801
|
-
return _context21.stop();
|
|
802
|
-
}
|
|
803
|
-
}, _callee21, this);
|
|
804
|
-
}));
|
|
805
|
-
function spawnAOS(_x15) {
|
|
806
|
-
return _spawnAOS.apply(this, arguments);
|
|
807
|
-
}
|
|
808
|
-
return spawnAOS;
|
|
809
|
-
}()
|
|
810
|
-
}, {
|
|
811
|
-
key: "spawnLua",
|
|
812
|
-
value: function () {
|
|
813
|
-
var _spawnLua = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(lua) {
|
|
814
|
-
var _this$scheduler3, _lua, _this$lua2, _this$pid2;
|
|
815
|
-
var addr, res, pid;
|
|
816
|
-
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
817
|
-
while (1) switch (_context22.prev = _context22.next) {
|
|
818
|
-
case 0:
|
|
819
|
-
_context22.next = 2;
|
|
820
|
-
return this.g("/~meta@1.0/info/address");
|
|
821
|
-
case 2:
|
|
822
|
-
addr = _context22.sent;
|
|
823
|
-
(_this$scheduler3 = this.scheduler) !== null && _this$scheduler3 !== void 0 ? _this$scheduler3 : this.scheduler = addr;
|
|
824
|
-
if (!((_lua = lua) !== null && _lua !== void 0)) {
|
|
825
|
-
_context22.next = 8;
|
|
826
|
-
break;
|
|
827
|
-
}
|
|
828
|
-
_lua;
|
|
829
|
-
_context22.next = 16;
|
|
830
|
-
break;
|
|
831
|
-
case 8:
|
|
832
|
-
if (!((_this$lua2 = this.lua) !== null && _this$lua2 !== void 0)) {
|
|
833
|
-
_context22.next = 12;
|
|
834
|
-
break;
|
|
835
|
-
}
|
|
836
|
-
_context22.t0 = _this$lua2;
|
|
837
|
-
_context22.next = 15;
|
|
823
|
+
_context22.t0 = _this$lua2;
|
|
824
|
+
_context22.next = 15;
|
|
838
825
|
break;
|
|
839
826
|
case 12:
|
|
840
827
|
_context22.next = 14;
|
|
@@ -859,22 +846,23 @@ var HB = /*#__PURE__*/function () {
|
|
|
859
846
|
"execution-device": "lua@5.3a",
|
|
860
847
|
"push-device": "push@1.0",
|
|
861
848
|
"patch-from": "/results/outbox"
|
|
849
|
+
}, {
|
|
850
|
+
path: false
|
|
862
851
|
});
|
|
863
852
|
case 18:
|
|
864
853
|
res = _context22.sent;
|
|
865
854
|
pid = res.headers.process;
|
|
866
|
-
(_this$pid2 = this.pid) !== null && _this$pid2 !== void 0 ? _this$pid2 : this.pid = pid;
|
|
867
855
|
return _context22.abrupt("return", {
|
|
868
856
|
pid: pid,
|
|
869
857
|
res: res
|
|
870
858
|
});
|
|
871
|
-
case
|
|
859
|
+
case 21:
|
|
872
860
|
case "end":
|
|
873
861
|
return _context22.stop();
|
|
874
862
|
}
|
|
875
863
|
}, _callee22, this);
|
|
876
864
|
}));
|
|
877
|
-
function spawnLua(
|
|
865
|
+
function spawnLua(_x15) {
|
|
878
866
|
return _spawnLua.apply(this, arguments);
|
|
879
867
|
}
|
|
880
868
|
return spawnLua;
|
|
@@ -882,12 +870,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
882
870
|
}, {
|
|
883
871
|
key: "now",
|
|
884
872
|
value: function () {
|
|
885
|
-
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(
|
|
886
|
-
var pid,
|
|
873
|
+
var _now = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref10) {
|
|
874
|
+
var pid, _ref10$path, path;
|
|
887
875
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
888
876
|
while (1) switch (_context23.prev = _context23.next) {
|
|
889
877
|
case 0:
|
|
890
|
-
pid =
|
|
878
|
+
pid = _ref10.pid, _ref10$path = _ref10.path, path = _ref10$path === void 0 ? "" : _ref10$path;
|
|
891
879
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
892
880
|
_context23.next = 4;
|
|
893
881
|
return this.getJSON({
|
|
@@ -901,7 +889,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
901
889
|
}
|
|
902
890
|
}, _callee23, this);
|
|
903
891
|
}));
|
|
904
|
-
function now(
|
|
892
|
+
function now(_x16) {
|
|
905
893
|
return _now.apply(this, arguments);
|
|
906
894
|
}
|
|
907
895
|
return now;
|
|
@@ -909,12 +897,12 @@ var HB = /*#__PURE__*/function () {
|
|
|
909
897
|
}, {
|
|
910
898
|
key: "slot",
|
|
911
899
|
value: function () {
|
|
912
|
-
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(
|
|
913
|
-
var pid,
|
|
900
|
+
var _slot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref11) {
|
|
901
|
+
var pid, _ref11$path, path;
|
|
914
902
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
915
903
|
while (1) switch (_context24.prev = _context24.next) {
|
|
916
904
|
case 0:
|
|
917
|
-
pid =
|
|
905
|
+
pid = _ref11.pid, _ref11$path = _ref11.path, path = _ref11$path === void 0 ? "" : _ref11$path;
|
|
918
906
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
919
907
|
_context24.next = 4;
|
|
920
908
|
return this.getJSON({
|
|
@@ -928,7 +916,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
928
916
|
}
|
|
929
917
|
}, _callee24, this);
|
|
930
918
|
}));
|
|
931
|
-
function slot(
|
|
919
|
+
function slot(_x17) {
|
|
932
920
|
return _slot.apply(this, arguments);
|
|
933
921
|
}
|
|
934
922
|
return slot;
|
|
@@ -938,18 +926,17 @@ var HB = /*#__PURE__*/function () {
|
|
|
938
926
|
value: function () {
|
|
939
927
|
var _messages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
940
928
|
var _this = this;
|
|
941
|
-
var
|
|
929
|
+
var _ref12,
|
|
942
930
|
pid,
|
|
943
931
|
from,
|
|
944
932
|
to,
|
|
945
|
-
limit,
|
|
946
933
|
params,
|
|
947
934
|
res,
|
|
948
935
|
_args27 = arguments;
|
|
949
936
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
950
937
|
while (1) switch (_context26.prev = _context26.next) {
|
|
951
938
|
case 0:
|
|
952
|
-
|
|
939
|
+
_ref12 = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {}, pid = _ref12.pid, from = _ref12.from, to = _ref12.to;
|
|
953
940
|
params = "target=".concat(pid);
|
|
954
941
|
if ((0, _ramda.isNotNil)(from)) params += "&from=".concat(from);
|
|
955
942
|
if ((0, _ramda.isNotNil)(to)) params += "&to=".concat(to);
|
|
@@ -971,8 +958,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
971
958
|
return _this.messages({
|
|
972
959
|
pid: pid,
|
|
973
960
|
from: from2,
|
|
974
|
-
to: to
|
|
975
|
-
limit: limit
|
|
961
|
+
to: to
|
|
976
962
|
});
|
|
977
963
|
case 3:
|
|
978
964
|
return _context25.abrupt("return", _context25.sent);
|
|
@@ -999,9 +985,9 @@ var HB = /*#__PURE__*/function () {
|
|
|
999
985
|
key: "spawnLegacy",
|
|
1000
986
|
value: function () {
|
|
1001
987
|
var _spawnLegacy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1002
|
-
var
|
|
988
|
+
var _ref14,
|
|
1003
989
|
module,
|
|
1004
|
-
|
|
990
|
+
_ref14$tags,
|
|
1005
991
|
tags,
|
|
1006
992
|
data,
|
|
1007
993
|
t,
|
|
@@ -1009,7 +995,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1009
995
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1010
996
|
while (1) switch (_context27.prev = _context27.next) {
|
|
1011
997
|
case 0:
|
|
1012
|
-
|
|
998
|
+
_ref14 = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {}, module = _ref14.module, _ref14$tags = _ref14.tags, tags = _ref14$tags === void 0 ? {} : _ref14$tags, data = _ref14.data;
|
|
1013
999
|
_context27.next = 3;
|
|
1014
1000
|
return this.setInfo();
|
|
1015
1001
|
case 3:
|
|
@@ -1033,7 +1019,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1033
1019
|
if (data) t.data = data;
|
|
1034
1020
|
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1035
1021
|
_context27.next = 8;
|
|
1036
|
-
return this.
|
|
1022
|
+
return this.spawn2(tags);
|
|
1037
1023
|
case 8:
|
|
1038
1024
|
return _context27.abrupt("return", _context27.sent);
|
|
1039
1025
|
case 9:
|
|
@@ -1047,25 +1033,125 @@ var HB = /*#__PURE__*/function () {
|
|
|
1047
1033
|
}
|
|
1048
1034
|
return spawnLegacy;
|
|
1049
1035
|
}()
|
|
1036
|
+
}, {
|
|
1037
|
+
key: "scheduleLegacy",
|
|
1038
|
+
value: function () {
|
|
1039
|
+
var _scheduleLegacy2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1040
|
+
var _ref15,
|
|
1041
|
+
pid,
|
|
1042
|
+
_ref15$action,
|
|
1043
|
+
action,
|
|
1044
|
+
_ref15$tags,
|
|
1045
|
+
tags,
|
|
1046
|
+
data,
|
|
1047
|
+
scheduler,
|
|
1048
|
+
_args29 = arguments;
|
|
1049
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1050
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1051
|
+
case 0:
|
|
1052
|
+
_ref15 = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {}, pid = _ref15.pid, _ref15$action = _ref15.action, action = _ref15$action === void 0 ? "Eval" : _ref15$action, _ref15$tags = _ref15.tags, tags = _ref15$tags === void 0 ? {} : _ref15$tags, data = _ref15.data, scheduler = _ref15.scheduler;
|
|
1053
|
+
if (action) tags.Action = action;
|
|
1054
|
+
_context28.next = 4;
|
|
1055
|
+
return this.schedule2({
|
|
1056
|
+
pid: pid,
|
|
1057
|
+
tags: tags,
|
|
1058
|
+
data: data,
|
|
1059
|
+
scheduler: scheduler
|
|
1060
|
+
});
|
|
1061
|
+
case 4:
|
|
1062
|
+
return _context28.abrupt("return", _context28.sent);
|
|
1063
|
+
case 5:
|
|
1064
|
+
case "end":
|
|
1065
|
+
return _context28.stop();
|
|
1066
|
+
}
|
|
1067
|
+
}, _callee28, this);
|
|
1068
|
+
}));
|
|
1069
|
+
function scheduleLegacy() {
|
|
1070
|
+
return _scheduleLegacy2.apply(this, arguments);
|
|
1071
|
+
}
|
|
1072
|
+
return scheduleLegacy;
|
|
1073
|
+
}()
|
|
1074
|
+
}, {
|
|
1075
|
+
key: "spawnLegacy2",
|
|
1076
|
+
value: function () {
|
|
1077
|
+
var _spawnLegacy2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1078
|
+
var _ref16,
|
|
1079
|
+
module,
|
|
1080
|
+
_ref16$tags,
|
|
1081
|
+
tags,
|
|
1082
|
+
data,
|
|
1083
|
+
t,
|
|
1084
|
+
res,
|
|
1085
|
+
pid,
|
|
1086
|
+
_args30 = arguments;
|
|
1087
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1088
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1089
|
+
case 0:
|
|
1090
|
+
_ref16 = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {}, module = _ref16.module, _ref16$tags = _ref16.tags, tags = _ref16$tags === void 0 ? {} : _ref16$tags, data = _ref16.data;
|
|
1091
|
+
_context29.next = 3;
|
|
1092
|
+
return this.setInfo();
|
|
1093
|
+
case 3:
|
|
1094
|
+
t = {
|
|
1095
|
+
type: "Process",
|
|
1096
|
+
"data-protocol": "ao",
|
|
1097
|
+
variant: "ao.TN.1",
|
|
1098
|
+
scheduler: this._info.address,
|
|
1099
|
+
authority: this._info.address,
|
|
1100
|
+
"scheduler-location": this._info.address,
|
|
1101
|
+
"random-seed": seed(16),
|
|
1102
|
+
module: module !== null && module !== void 0 ? module : "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1103
|
+
device: "process@1.0",
|
|
1104
|
+
"scheduler-device": "scheduler@1.0",
|
|
1105
|
+
"execution-device": "stack@1.0",
|
|
1106
|
+
"push-device": "push@1.0",
|
|
1107
|
+
"device-stack": ["genesis-wasm@1.0", "patch@1.0"],
|
|
1108
|
+
"patch-from": "/results/outbox",
|
|
1109
|
+
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1110
|
+
path: "/~process@1.0/schedule"
|
|
1111
|
+
};
|
|
1112
|
+
if (data) t.data = data;
|
|
1113
|
+
tags = (0, _ramda.mergeLeft)(tags, t);
|
|
1114
|
+
_context29.next = 8;
|
|
1115
|
+
return this.post(t, {
|
|
1116
|
+
path: false
|
|
1117
|
+
});
|
|
1118
|
+
case 8:
|
|
1119
|
+
res = _context29.sent;
|
|
1120
|
+
pid = res.headers.process;
|
|
1121
|
+
return _context29.abrupt("return", {
|
|
1122
|
+
pid: pid,
|
|
1123
|
+
res: res
|
|
1124
|
+
});
|
|
1125
|
+
case 11:
|
|
1126
|
+
case "end":
|
|
1127
|
+
return _context29.stop();
|
|
1128
|
+
}
|
|
1129
|
+
}, _callee29, this);
|
|
1130
|
+
}));
|
|
1131
|
+
function spawnLegacy2() {
|
|
1132
|
+
return _spawnLegacy2.apply(this, arguments);
|
|
1133
|
+
}
|
|
1134
|
+
return spawnLegacy2;
|
|
1135
|
+
}()
|
|
1050
1136
|
}, {
|
|
1051
1137
|
key: "results",
|
|
1052
1138
|
value: function () {
|
|
1053
|
-
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1054
|
-
var
|
|
1139
|
+
var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1140
|
+
var _ref17,
|
|
1055
1141
|
process,
|
|
1056
1142
|
limit,
|
|
1057
|
-
|
|
1143
|
+
_ref17$sort,
|
|
1058
1144
|
sort,
|
|
1059
1145
|
from,
|
|
1060
1146
|
to,
|
|
1061
1147
|
params,
|
|
1062
1148
|
addParam,
|
|
1063
1149
|
res,
|
|
1064
|
-
|
|
1065
|
-
return _regeneratorRuntime().wrap(function
|
|
1066
|
-
while (1) switch (
|
|
1150
|
+
_args31 = arguments;
|
|
1151
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1152
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1067
1153
|
case 0:
|
|
1068
|
-
|
|
1154
|
+
_ref17 = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {}, process = _ref17.process, limit = _ref17.limit, _ref17$sort = _ref17.sort, sort = _ref17$sort === void 0 ? "DESC" : _ref17$sort, from = _ref17.from, to = _ref17.to;
|
|
1069
1155
|
params = "";
|
|
1070
1156
|
addParam = function addParam(key, val) {
|
|
1071
1157
|
params += params === "" ? "?" : "&";
|
|
@@ -1075,7 +1161,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1075
1161
|
if (sort) addParam("sort", sort);
|
|
1076
1162
|
if (from) addParam("from", from);
|
|
1077
1163
|
if (to) addParam("to", to);
|
|
1078
|
-
|
|
1164
|
+
_context30.next = 9;
|
|
1079
1165
|
return this.post({
|
|
1080
1166
|
path: "/~relay@1.0/call",
|
|
1081
1167
|
method: "GET",
|
|
@@ -1083,13 +1169,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1083
1169
|
"content-type": "application/json"
|
|
1084
1170
|
});
|
|
1085
1171
|
case 9:
|
|
1086
|
-
res =
|
|
1087
|
-
return
|
|
1172
|
+
res = _context30.sent;
|
|
1173
|
+
return _context30.abrupt("return", JSON.parse(res.body));
|
|
1088
1174
|
case 11:
|
|
1089
1175
|
case "end":
|
|
1090
|
-
return
|
|
1176
|
+
return _context30.stop();
|
|
1091
1177
|
}
|
|
1092
|
-
},
|
|
1178
|
+
}, _callee30, this);
|
|
1093
1179
|
}));
|
|
1094
1180
|
function results() {
|
|
1095
1181
|
return _results.apply(this, arguments);
|
|
@@ -1099,27 +1185,27 @@ var HB = /*#__PURE__*/function () {
|
|
|
1099
1185
|
}, {
|
|
1100
1186
|
key: "dryrun",
|
|
1101
1187
|
value: function () {
|
|
1102
|
-
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1188
|
+
var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1189
|
+
var _ref18,
|
|
1190
|
+
_ref18$tags,
|
|
1105
1191
|
tags,
|
|
1106
1192
|
pid,
|
|
1107
1193
|
action,
|
|
1108
1194
|
data,
|
|
1109
1195
|
json,
|
|
1110
1196
|
res,
|
|
1111
|
-
|
|
1112
|
-
return _regeneratorRuntime().wrap(function
|
|
1113
|
-
while (1) switch (
|
|
1197
|
+
_args32 = arguments;
|
|
1198
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1199
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1114
1200
|
case 0:
|
|
1115
|
-
|
|
1201
|
+
_ref18 = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {}, _ref18$tags = _ref18.tags, tags = _ref18$tags === void 0 ? {} : _ref18$tags, pid = _ref18.pid, action = _ref18.action, data = _ref18.data;
|
|
1116
1202
|
if (typeof action === "string") tags.Action = action;
|
|
1117
1203
|
json = {
|
|
1118
1204
|
Tags: (0, _utils.buildTags)(_objectSpread({}, tags)),
|
|
1119
1205
|
Owner: this.addr
|
|
1120
1206
|
};
|
|
1121
1207
|
if (data) json.Data = data;
|
|
1122
|
-
|
|
1208
|
+
_context31.next = 6;
|
|
1123
1209
|
return this.post({
|
|
1124
1210
|
path: "/~relay@1.0/call",
|
|
1125
1211
|
method: "POST",
|
|
@@ -1128,13 +1214,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1128
1214
|
"relay-body": JSON.stringify(json)
|
|
1129
1215
|
});
|
|
1130
1216
|
case 6:
|
|
1131
|
-
res =
|
|
1132
|
-
return
|
|
1217
|
+
res = _context31.sent;
|
|
1218
|
+
return _context31.abrupt("return", JSON.parse(res.body));
|
|
1133
1219
|
case 8:
|
|
1134
1220
|
case "end":
|
|
1135
|
-
return
|
|
1221
|
+
return _context31.stop();
|
|
1136
1222
|
}
|
|
1137
|
-
},
|
|
1223
|
+
}, _callee31, this);
|
|
1138
1224
|
}));
|
|
1139
1225
|
function dryrun() {
|
|
1140
1226
|
return _dryrun.apply(this, arguments);
|
|
@@ -1144,15 +1230,15 @@ var HB = /*#__PURE__*/function () {
|
|
|
1144
1230
|
}, {
|
|
1145
1231
|
key: "commit",
|
|
1146
1232
|
value: function () {
|
|
1147
|
-
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1233
|
+
var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(obj, opts) {
|
|
1148
1234
|
var msg, hmacId, rsaId, committer, meta, meta2, sigs;
|
|
1149
|
-
return _regeneratorRuntime().wrap(function
|
|
1150
|
-
while (1) switch (
|
|
1235
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1236
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1151
1237
|
case 0:
|
|
1152
|
-
|
|
1238
|
+
_context32.next = 2;
|
|
1153
1239
|
return this.sign(obj, opts);
|
|
1154
1240
|
case 2:
|
|
1155
|
-
msg =
|
|
1241
|
+
msg = _context32.sent;
|
|
1156
1242
|
hmacId = (0, _utils.hmacid)(msg.headers);
|
|
1157
1243
|
rsaId = (0, _utils.rsaid)(msg.headers);
|
|
1158
1244
|
committer = this.addr;
|
|
@@ -1168,18 +1254,18 @@ var HB = /*#__PURE__*/function () {
|
|
|
1168
1254
|
signature: msg.headers.signature,
|
|
1169
1255
|
"signature-input": msg.headers["signature-input"]
|
|
1170
1256
|
};
|
|
1171
|
-
return
|
|
1257
|
+
return _context32.abrupt("return", _objectSpread({
|
|
1172
1258
|
commitments: _defineProperty(_defineProperty({}, rsaId, _objectSpread(_objectSpread({}, meta), {}, {
|
|
1173
1259
|
committer: committer
|
|
1174
1260
|
}, sigs)), hmacId, _objectSpread(_objectSpread({}, meta2), sigs))
|
|
1175
1261
|
}, obj));
|
|
1176
1262
|
case 10:
|
|
1177
1263
|
case "end":
|
|
1178
|
-
return
|
|
1264
|
+
return _context32.stop();
|
|
1179
1265
|
}
|
|
1180
|
-
},
|
|
1266
|
+
}, _callee32, this);
|
|
1181
1267
|
}));
|
|
1182
|
-
function commit(
|
|
1268
|
+
function commit(_x18, _x19) {
|
|
1183
1269
|
return _commit.apply(this, arguments);
|
|
1184
1270
|
}
|
|
1185
1271
|
return commit;
|
|
@@ -1187,69 +1273,69 @@ var HB = /*#__PURE__*/function () {
|
|
|
1187
1273
|
}, {
|
|
1188
1274
|
key: "p",
|
|
1189
1275
|
value: function () {
|
|
1190
|
-
var _p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1276
|
+
var _p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(path) {
|
|
1191
1277
|
var _, _args$_, _args$, _args$$path, _yield$this$post$out, _yield$this$post;
|
|
1192
1278
|
var _len,
|
|
1193
1279
|
args,
|
|
1194
1280
|
_key,
|
|
1195
1281
|
_args,
|
|
1196
|
-
|
|
1197
|
-
return _regeneratorRuntime().wrap(function
|
|
1198
|
-
while (1) switch (
|
|
1282
|
+
_args34 = arguments;
|
|
1283
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1284
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1199
1285
|
case 0:
|
|
1200
|
-
for (_len =
|
|
1201
|
-
args[_key - 1] =
|
|
1286
|
+
for (_len = _args34.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1287
|
+
args[_key - 1] = _args34[_key];
|
|
1202
1288
|
}
|
|
1203
1289
|
_args = (0, _ramda.clone)(args);
|
|
1204
1290
|
(_args$_ = _args[_ = 0]) !== null && _args$_ !== void 0 ? _args$_ : _args[_] = {};
|
|
1205
1291
|
(_args$$path = (_args$ = _args[0]).path) !== null && _args$$path !== void 0 ? _args$$path : _args$.path = path;
|
|
1206
|
-
|
|
1292
|
+
_context33.next = 6;
|
|
1207
1293
|
return this.post.apply(this, _toConsumableArray(_args));
|
|
1208
1294
|
case 6:
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1295
|
+
_context33.t2 = _yield$this$post = _context33.sent;
|
|
1296
|
+
_context33.t1 = _context33.t2 === null;
|
|
1297
|
+
if (_context33.t1) {
|
|
1298
|
+
_context33.next = 10;
|
|
1213
1299
|
break;
|
|
1214
1300
|
}
|
|
1215
|
-
|
|
1301
|
+
_context33.t1 = _yield$this$post === void 0;
|
|
1216
1302
|
case 10:
|
|
1217
|
-
if (!
|
|
1218
|
-
|
|
1303
|
+
if (!_context33.t1) {
|
|
1304
|
+
_context33.next = 14;
|
|
1219
1305
|
break;
|
|
1220
1306
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1307
|
+
_context33.t3 = void 0;
|
|
1308
|
+
_context33.next = 15;
|
|
1223
1309
|
break;
|
|
1224
1310
|
case 14:
|
|
1225
|
-
|
|
1311
|
+
_context33.t3 = _yield$this$post.out;
|
|
1226
1312
|
case 15:
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
if (!
|
|
1230
|
-
|
|
1313
|
+
_context33.t4 = _yield$this$post$out = _context33.t3;
|
|
1314
|
+
_context33.t0 = _context33.t4 !== null;
|
|
1315
|
+
if (!_context33.t0) {
|
|
1316
|
+
_context33.next = 19;
|
|
1231
1317
|
break;
|
|
1232
1318
|
}
|
|
1233
|
-
|
|
1319
|
+
_context33.t0 = _yield$this$post$out !== void 0;
|
|
1234
1320
|
case 19:
|
|
1235
|
-
if (!
|
|
1236
|
-
|
|
1321
|
+
if (!_context33.t0) {
|
|
1322
|
+
_context33.next = 23;
|
|
1237
1323
|
break;
|
|
1238
1324
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1325
|
+
_context33.t5 = _yield$this$post$out;
|
|
1326
|
+
_context33.next = 24;
|
|
1241
1327
|
break;
|
|
1242
1328
|
case 23:
|
|
1243
|
-
|
|
1329
|
+
_context33.t5 = null;
|
|
1244
1330
|
case 24:
|
|
1245
|
-
return
|
|
1331
|
+
return _context33.abrupt("return", _context33.t5);
|
|
1246
1332
|
case 25:
|
|
1247
1333
|
case "end":
|
|
1248
|
-
return
|
|
1334
|
+
return _context33.stop();
|
|
1249
1335
|
}
|
|
1250
|
-
},
|
|
1336
|
+
}, _callee33, this);
|
|
1251
1337
|
}));
|
|
1252
|
-
function p(
|
|
1338
|
+
function p(_x20) {
|
|
1253
1339
|
return _p.apply(this, arguments);
|
|
1254
1340
|
}
|
|
1255
1341
|
return p;
|
|
@@ -1257,29 +1343,32 @@ var HB = /*#__PURE__*/function () {
|
|
|
1257
1343
|
}, {
|
|
1258
1344
|
key: "post",
|
|
1259
1345
|
value: function () {
|
|
1260
|
-
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1261
|
-
var
|
|
1262
|
-
|
|
1263
|
-
|
|
1346
|
+
var _post = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(obj) {
|
|
1347
|
+
var opt,
|
|
1348
|
+
_json,
|
|
1349
|
+
signed,
|
|
1350
|
+
_args35 = arguments;
|
|
1351
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1352
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1264
1353
|
case 0:
|
|
1265
|
-
|
|
1354
|
+
opt = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
|
|
1355
|
+
_json = opt.json ? "/~json@1.0/serialize" : "";
|
|
1266
1356
|
obj.path += _json;
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
return this.sign(obj);
|
|
1357
|
+
_context34.next = 5;
|
|
1358
|
+
return this.sign(obj, opt);
|
|
1270
1359
|
case 5:
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
return
|
|
1360
|
+
signed = _context34.sent;
|
|
1361
|
+
_context34.next = 8;
|
|
1362
|
+
return this.send(signed);
|
|
1274
1363
|
case 8:
|
|
1275
|
-
return
|
|
1364
|
+
return _context34.abrupt("return", _context34.sent);
|
|
1276
1365
|
case 9:
|
|
1277
1366
|
case "end":
|
|
1278
|
-
return
|
|
1367
|
+
return _context34.stop();
|
|
1279
1368
|
}
|
|
1280
|
-
},
|
|
1369
|
+
}, _callee34, this);
|
|
1281
1370
|
}));
|
|
1282
|
-
function post(
|
|
1371
|
+
function post(_x21) {
|
|
1283
1372
|
return _post.apply(this, arguments);
|
|
1284
1373
|
}
|
|
1285
1374
|
return post;
|
|
@@ -1287,69 +1376,69 @@ var HB = /*#__PURE__*/function () {
|
|
|
1287
1376
|
}, {
|
|
1288
1377
|
key: "g",
|
|
1289
1378
|
value: function () {
|
|
1290
|
-
var _g = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1379
|
+
var _g = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(path) {
|
|
1291
1380
|
var _2, _args$_2, _args$2, _args$2$path, _yield$this$get$out, _yield$this$get;
|
|
1292
1381
|
var _len2,
|
|
1293
1382
|
args,
|
|
1294
1383
|
_key2,
|
|
1295
1384
|
_args,
|
|
1296
|
-
|
|
1297
|
-
return _regeneratorRuntime().wrap(function
|
|
1298
|
-
while (1) switch (
|
|
1385
|
+
_args36 = arguments;
|
|
1386
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1387
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1299
1388
|
case 0:
|
|
1300
|
-
for (_len2 =
|
|
1301
|
-
args[_key2 - 1] =
|
|
1389
|
+
for (_len2 = _args36.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1390
|
+
args[_key2 - 1] = _args36[_key2];
|
|
1302
1391
|
}
|
|
1303
1392
|
_args = (0, _ramda.clone)(args);
|
|
1304
1393
|
(_args$_2 = _args[_2 = 0]) !== null && _args$_2 !== void 0 ? _args$_2 : _args[_2] = {};
|
|
1305
1394
|
(_args$2$path = (_args$2 = _args[0]).path) !== null && _args$2$path !== void 0 ? _args$2$path : _args$2.path = path;
|
|
1306
|
-
|
|
1395
|
+
_context35.next = 6;
|
|
1307
1396
|
return this.get.apply(this, _toConsumableArray(_args));
|
|
1308
1397
|
case 6:
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
if (
|
|
1312
|
-
|
|
1398
|
+
_context35.t2 = _yield$this$get = _context35.sent;
|
|
1399
|
+
_context35.t1 = _context35.t2 === null;
|
|
1400
|
+
if (_context35.t1) {
|
|
1401
|
+
_context35.next = 10;
|
|
1313
1402
|
break;
|
|
1314
1403
|
}
|
|
1315
|
-
|
|
1404
|
+
_context35.t1 = _yield$this$get === void 0;
|
|
1316
1405
|
case 10:
|
|
1317
|
-
if (!
|
|
1318
|
-
|
|
1406
|
+
if (!_context35.t1) {
|
|
1407
|
+
_context35.next = 14;
|
|
1319
1408
|
break;
|
|
1320
1409
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1410
|
+
_context35.t3 = void 0;
|
|
1411
|
+
_context35.next = 15;
|
|
1323
1412
|
break;
|
|
1324
1413
|
case 14:
|
|
1325
|
-
|
|
1414
|
+
_context35.t3 = _yield$this$get.out;
|
|
1326
1415
|
case 15:
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
if (!
|
|
1330
|
-
|
|
1416
|
+
_context35.t4 = _yield$this$get$out = _context35.t3;
|
|
1417
|
+
_context35.t0 = _context35.t4 !== null;
|
|
1418
|
+
if (!_context35.t0) {
|
|
1419
|
+
_context35.next = 19;
|
|
1331
1420
|
break;
|
|
1332
1421
|
}
|
|
1333
|
-
|
|
1422
|
+
_context35.t0 = _yield$this$get$out !== void 0;
|
|
1334
1423
|
case 19:
|
|
1335
|
-
if (!
|
|
1336
|
-
|
|
1424
|
+
if (!_context35.t0) {
|
|
1425
|
+
_context35.next = 23;
|
|
1337
1426
|
break;
|
|
1338
1427
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1428
|
+
_context35.t5 = _yield$this$get$out;
|
|
1429
|
+
_context35.next = 24;
|
|
1341
1430
|
break;
|
|
1342
1431
|
case 23:
|
|
1343
|
-
|
|
1432
|
+
_context35.t5 = null;
|
|
1344
1433
|
case 24:
|
|
1345
|
-
return
|
|
1434
|
+
return _context35.abrupt("return", _context35.t5);
|
|
1346
1435
|
case 25:
|
|
1347
1436
|
case "end":
|
|
1348
|
-
return
|
|
1437
|
+
return _context35.stop();
|
|
1349
1438
|
}
|
|
1350
|
-
},
|
|
1439
|
+
}, _callee35, this);
|
|
1351
1440
|
}));
|
|
1352
|
-
function g(
|
|
1441
|
+
function g(_x22) {
|
|
1353
1442
|
return _g.apply(this, arguments);
|
|
1354
1443
|
}
|
|
1355
1444
|
return g;
|
|
@@ -1357,11 +1446,11 @@ var HB = /*#__PURE__*/function () {
|
|
|
1357
1446
|
}, {
|
|
1358
1447
|
key: "get",
|
|
1359
1448
|
value: function () {
|
|
1360
|
-
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1449
|
+
var _get = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(_ref19) {
|
|
1361
1450
|
var _path;
|
|
1362
1451
|
var path,
|
|
1363
1452
|
params,
|
|
1364
|
-
|
|
1453
|
+
opt,
|
|
1365
1454
|
_json,
|
|
1366
1455
|
_params,
|
|
1367
1456
|
i,
|
|
@@ -1369,13 +1458,13 @@ var HB = /*#__PURE__*/function () {
|
|
|
1369
1458
|
response,
|
|
1370
1459
|
headers,
|
|
1371
1460
|
http,
|
|
1372
|
-
|
|
1373
|
-
return _regeneratorRuntime().wrap(function
|
|
1374
|
-
while (1) switch (
|
|
1461
|
+
_args37 = arguments;
|
|
1462
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1463
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1375
1464
|
case 0:
|
|
1376
|
-
path =
|
|
1377
|
-
|
|
1378
|
-
_json = json ? "/~json@1.0/serialize" : "";
|
|
1465
|
+
path = _ref19.path, params = _objectWithoutProperties(_ref19, _excluded2);
|
|
1466
|
+
opt = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
|
|
1467
|
+
_json = opt.json ? "/~json@1.0/serialize" : "";
|
|
1379
1468
|
(_path = path) !== null && _path !== void 0 ? _path : path = "/~message@1.0";
|
|
1380
1469
|
if (!/^\//.test(path)) path = "/" + path;
|
|
1381
1470
|
_params = "";
|
|
@@ -1386,33 +1475,33 @@ var HB = /*#__PURE__*/function () {
|
|
|
1386
1475
|
i++;
|
|
1387
1476
|
}
|
|
1388
1477
|
}
|
|
1389
|
-
|
|
1478
|
+
_context36.next = 9;
|
|
1390
1479
|
return fetch("".concat(this.url).concat(path).concat(_json).concat(_params));
|
|
1391
1480
|
case 9:
|
|
1392
|
-
response =
|
|
1481
|
+
response = _context36.sent;
|
|
1393
1482
|
headers = {};
|
|
1394
1483
|
response.headers.forEach(function (v, k) {
|
|
1395
1484
|
return headers[k] = v;
|
|
1396
1485
|
});
|
|
1397
|
-
|
|
1398
|
-
|
|
1486
|
+
_context36.t0 = headers;
|
|
1487
|
+
_context36.next = 15;
|
|
1399
1488
|
return response.text();
|
|
1400
1489
|
case 15:
|
|
1401
|
-
|
|
1402
|
-
|
|
1490
|
+
_context36.t1 = _context36.sent;
|
|
1491
|
+
_context36.t2 = response.status;
|
|
1403
1492
|
http = {
|
|
1404
|
-
headers:
|
|
1405
|
-
body:
|
|
1406
|
-
status:
|
|
1493
|
+
headers: _context36.t0,
|
|
1494
|
+
body: _context36.t1,
|
|
1495
|
+
status: _context36.t2
|
|
1407
1496
|
};
|
|
1408
|
-
return
|
|
1497
|
+
return _context36.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsig.from)(http)), http));
|
|
1409
1498
|
case 19:
|
|
1410
1499
|
case "end":
|
|
1411
|
-
return
|
|
1500
|
+
return _context36.stop();
|
|
1412
1501
|
}
|
|
1413
|
-
},
|
|
1502
|
+
}, _callee36, this);
|
|
1414
1503
|
}));
|
|
1415
|
-
function get(
|
|
1504
|
+
function get(_x23) {
|
|
1416
1505
|
return _get.apply(this, arguments);
|
|
1417
1506
|
}
|
|
1418
1507
|
return get;
|
|
@@ -1420,23 +1509,28 @@ var HB = /*#__PURE__*/function () {
|
|
|
1420
1509
|
}, {
|
|
1421
1510
|
key: "postJSON",
|
|
1422
1511
|
value: function () {
|
|
1423
|
-
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1424
|
-
var
|
|
1425
|
-
|
|
1426
|
-
|
|
1512
|
+
var _postJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(args) {
|
|
1513
|
+
var opt,
|
|
1514
|
+
res,
|
|
1515
|
+
_args38 = arguments;
|
|
1516
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1517
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1427
1518
|
case 0:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
case
|
|
1519
|
+
opt = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
|
|
1520
|
+
_context37.next = 3;
|
|
1521
|
+
return this.post(args, _objectSpread(_objectSpread({}, opt), {}, {
|
|
1522
|
+
json: true
|
|
1523
|
+
}));
|
|
1524
|
+
case 3:
|
|
1525
|
+
res = _context37.sent;
|
|
1526
|
+
return _context37.abrupt("return", JSON.parse(res.body));
|
|
1527
|
+
case 5:
|
|
1434
1528
|
case "end":
|
|
1435
|
-
return
|
|
1529
|
+
return _context37.stop();
|
|
1436
1530
|
}
|
|
1437
|
-
},
|
|
1531
|
+
}, _callee37, this);
|
|
1438
1532
|
}));
|
|
1439
|
-
function postJSON(
|
|
1533
|
+
function postJSON(_x24) {
|
|
1440
1534
|
return _postJSON.apply(this, arguments);
|
|
1441
1535
|
}
|
|
1442
1536
|
return postJSON;
|
|
@@ -1444,27 +1538,206 @@ var HB = /*#__PURE__*/function () {
|
|
|
1444
1538
|
}, {
|
|
1445
1539
|
key: "getJSON",
|
|
1446
1540
|
value: function () {
|
|
1447
|
-
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1448
|
-
var
|
|
1449
|
-
|
|
1450
|
-
|
|
1541
|
+
var _getJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(args) {
|
|
1542
|
+
var opt,
|
|
1543
|
+
res,
|
|
1544
|
+
_args39 = arguments;
|
|
1545
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1546
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1451
1547
|
case 0:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
case
|
|
1548
|
+
opt = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
|
|
1549
|
+
_context38.next = 3;
|
|
1550
|
+
return this.get(args, _objectSpread(_objectSpread({}, opt), {}, {
|
|
1551
|
+
json: true
|
|
1552
|
+
}));
|
|
1553
|
+
case 3:
|
|
1554
|
+
res = _context38.sent;
|
|
1555
|
+
return _context38.abrupt("return", JSON.parse(res.body));
|
|
1556
|
+
case 5:
|
|
1458
1557
|
case "end":
|
|
1459
|
-
return
|
|
1558
|
+
return _context38.stop();
|
|
1460
1559
|
}
|
|
1461
|
-
},
|
|
1560
|
+
}, _callee38, this);
|
|
1462
1561
|
}));
|
|
1463
|
-
function getJSON(
|
|
1562
|
+
function getJSON(_x25) {
|
|
1464
1563
|
return _getJSON.apply(this, arguments);
|
|
1465
1564
|
}
|
|
1466
1565
|
return getJSON;
|
|
1467
1566
|
}()
|
|
1567
|
+
}, {
|
|
1568
|
+
key: "spawnAOS",
|
|
1569
|
+
value: function () {
|
|
1570
|
+
var _spawnAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(image) {
|
|
1571
|
+
var _this$scheduler4, _image, _this$image2;
|
|
1572
|
+
var addr, res, pid;
|
|
1573
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1574
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1575
|
+
case 0:
|
|
1576
|
+
_context39.next = 2;
|
|
1577
|
+
return this.g("/~meta@1.0/info/address");
|
|
1578
|
+
case 2:
|
|
1579
|
+
addr = _context39.sent;
|
|
1580
|
+
(_this$scheduler4 = this.scheduler) !== null && _this$scheduler4 !== void 0 ? _this$scheduler4 : this.scheduler = addr;
|
|
1581
|
+
if (!((_image = image) !== null && _image !== void 0)) {
|
|
1582
|
+
_context39.next = 8;
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1585
|
+
_image;
|
|
1586
|
+
_context39.next = 16;
|
|
1587
|
+
break;
|
|
1588
|
+
case 8:
|
|
1589
|
+
if (!((_this$image2 = this.image) !== null && _this$image2 !== void 0)) {
|
|
1590
|
+
_context39.next = 12;
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
_context39.t0 = _this$image2;
|
|
1594
|
+
_context39.next = 15;
|
|
1595
|
+
break;
|
|
1596
|
+
case 12:
|
|
1597
|
+
_context39.next = 14;
|
|
1598
|
+
return this.getImage();
|
|
1599
|
+
case 14:
|
|
1600
|
+
_context39.t0 = _context39.sent;
|
|
1601
|
+
case 15:
|
|
1602
|
+
image = _context39.t0;
|
|
1603
|
+
case 16:
|
|
1604
|
+
_context39.next = 18;
|
|
1605
|
+
return this.post({
|
|
1606
|
+
device: "process@1.0",
|
|
1607
|
+
path: "/schedule",
|
|
1608
|
+
scheduler: this.scheduler,
|
|
1609
|
+
"data-protocol": "ao",
|
|
1610
|
+
variant: "ao.N.1",
|
|
1611
|
+
"scheduler-location": this.scheduler,
|
|
1612
|
+
authority: this.scheduler,
|
|
1613
|
+
"random-seed": seed(16),
|
|
1614
|
+
type: "Process",
|
|
1615
|
+
image: image,
|
|
1616
|
+
"execution-device": "stack@1.0",
|
|
1617
|
+
"push-device": "push@1.0",
|
|
1618
|
+
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
|
|
1619
|
+
"output-prefix": "wasm",
|
|
1620
|
+
"patch-from": "/results/outbox",
|
|
1621
|
+
"patch-mode": "patches",
|
|
1622
|
+
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1623
|
+
passes: 2
|
|
1624
|
+
}, {
|
|
1625
|
+
path: false
|
|
1626
|
+
});
|
|
1627
|
+
case 18:
|
|
1628
|
+
res = _context39.sent;
|
|
1629
|
+
pid = res.headers.process;
|
|
1630
|
+
return _context39.abrupt("return", {
|
|
1631
|
+
pid: pid,
|
|
1632
|
+
res: res
|
|
1633
|
+
});
|
|
1634
|
+
case 21:
|
|
1635
|
+
case "end":
|
|
1636
|
+
return _context39.stop();
|
|
1637
|
+
}
|
|
1638
|
+
}, _callee39, this);
|
|
1639
|
+
}));
|
|
1640
|
+
function spawnAOS(_x26) {
|
|
1641
|
+
return _spawnAOS.apply(this, arguments);
|
|
1642
|
+
}
|
|
1643
|
+
return spawnAOS;
|
|
1644
|
+
}()
|
|
1645
|
+
}, {
|
|
1646
|
+
key: "scheduleAOS",
|
|
1647
|
+
value: function () {
|
|
1648
|
+
var _scheduleAOS = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(_ref20) {
|
|
1649
|
+
var pid, _ref20$action, action, _ref20$tags, tags, data, _tags, res, slot;
|
|
1650
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1651
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1652
|
+
case 0:
|
|
1653
|
+
pid = _ref20.pid, _ref20$action = _ref20.action, action = _ref20$action === void 0 ? "Eval" : _ref20$action, _ref20$tags = _ref20.tags, tags = _ref20$tags === void 0 ? {} : _ref20$tags, data = _ref20.data;
|
|
1654
|
+
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
1655
|
+
device: "process@1.0",
|
|
1656
|
+
method: "POST",
|
|
1657
|
+
path: "/".concat(pid, "~process@1.0/schedule"),
|
|
1658
|
+
scheduler: this.scheduler,
|
|
1659
|
+
type: "Message",
|
|
1660
|
+
Action: action,
|
|
1661
|
+
target: pid
|
|
1662
|
+
});
|
|
1663
|
+
if (data) _tags.data = data;
|
|
1664
|
+
_context40.next = 5;
|
|
1665
|
+
return this.post(_tags, {
|
|
1666
|
+
path: false
|
|
1667
|
+
});
|
|
1668
|
+
case 5:
|
|
1669
|
+
res = _context40.sent;
|
|
1670
|
+
slot = res.headers.slot;
|
|
1671
|
+
return _context40.abrupt("return", {
|
|
1672
|
+
slot: slot,
|
|
1673
|
+
res: res,
|
|
1674
|
+
pid: pid
|
|
1675
|
+
});
|
|
1676
|
+
case 8:
|
|
1677
|
+
case "end":
|
|
1678
|
+
return _context40.stop();
|
|
1679
|
+
}
|
|
1680
|
+
}, _callee40, this);
|
|
1681
|
+
}));
|
|
1682
|
+
function scheduleAOS(_x27) {
|
|
1683
|
+
return _scheduleAOS.apply(this, arguments);
|
|
1684
|
+
}
|
|
1685
|
+
return scheduleAOS;
|
|
1686
|
+
}()
|
|
1687
|
+
/*
|
|
1688
|
+
async scheduleAOS2({ pid, action = "Eval", tags = {}, data }) {
|
|
1689
|
+
let _tags = mergeLeft(tags, {
|
|
1690
|
+
device: "process@1.0",
|
|
1691
|
+
type: "Message",
|
|
1692
|
+
Action: action,
|
|
1693
|
+
target: pid,
|
|
1694
|
+
})
|
|
1695
|
+
if (data) _tags.data = data
|
|
1696
|
+
const msg = { body: _tags, path: `/${pid}~process@1.0/schedule` }
|
|
1697
|
+
let res = await this.post(msg, { path: false })
|
|
1698
|
+
const slot = res.headers.slot
|
|
1699
|
+
return { slot, res, pid }
|
|
1700
|
+
}
|
|
1701
|
+
async spawnAOS2(image) {
|
|
1702
|
+
const addr = await this.g("/~meta@1.0/info/address")
|
|
1703
|
+
this.scheduler ??= addr
|
|
1704
|
+
image ??= this.image ?? (await this.getImage())
|
|
1705
|
+
const _tags = {
|
|
1706
|
+
device: "process@1.0",
|
|
1707
|
+
scheduler: this.scheduler,
|
|
1708
|
+
"data-protocol": "ao",
|
|
1709
|
+
variant: "ao.N.1",
|
|
1710
|
+
"scheduler-location": this.scheduler,
|
|
1711
|
+
authority: this.scheduler,
|
|
1712
|
+
"random-seed": seed(16),
|
|
1713
|
+
type: "Process",
|
|
1714
|
+
image,
|
|
1715
|
+
"execution-device": "stack@1.0",
|
|
1716
|
+
"push-device": "push@1.0",
|
|
1717
|
+
"device-stack": [
|
|
1718
|
+
"wasi@1.0",
|
|
1719
|
+
"json-iface@1.0",
|
|
1720
|
+
"wasm-64@1.0",
|
|
1721
|
+
"patch@1.0",
|
|
1722
|
+
"multipass@1.0",
|
|
1723
|
+
],
|
|
1724
|
+
"output-prefix": "wasm",
|
|
1725
|
+
"patch-from": "/results/outbox",
|
|
1726
|
+
"patch-mode": "patches",
|
|
1727
|
+
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1728
|
+
passes: 2,
|
|
1729
|
+
}
|
|
1730
|
+
const msg = {
|
|
1731
|
+
device: "process@1.0",
|
|
1732
|
+
path: "schedule",
|
|
1733
|
+
body: _tags,
|
|
1734
|
+
scheduler: this.scheduler,
|
|
1735
|
+
}
|
|
1736
|
+
const res = await this.post(msg, { path: false })
|
|
1737
|
+
const pid = res.headers.process
|
|
1738
|
+
return { pid, res }
|
|
1739
|
+
}
|
|
1740
|
+
*/
|
|
1468
1741
|
}]);
|
|
1469
1742
|
}();
|
|
1470
1743
|
var _default = exports["default"] = HB;
|