wao 0.4.0 → 0.4.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/aoconnect.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.connect = void 0;
8
8
  var _warpArbundles = require("warp-arbundles");
9
+ var _crypto = _interopRequireDefault(require("crypto"));
9
10
  var _base64url = _interopRequireDefault(require("base64url"));
10
11
  var _utils = require("./utils.js");
11
12
  var _armem = _interopRequireDefault(require("./armem.js"));
@@ -185,7 +186,7 @@ var connect = exports.connect = function connect(mem) {
185
186
  }();
186
187
  var spawn = /*#__PURE__*/function () {
187
188
  var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
188
- var _opt$module, _opt$tags;
189
+ var _opt$module, _opt$tags, _opt$tags2;
189
190
  var opt,
190
191
  mod,
191
192
  __dirname,
@@ -264,9 +265,18 @@ var connect = exports.connect = function connect(mem) {
264
265
  }
265
266
  throw Error("module not found");
266
267
  case 17:
268
+ opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : []), {
269
+ "Data-Protocol": "ao",
270
+ Variant: "ao.TN.1",
271
+ Type: "Process",
272
+ SDK: "aoconnect",
273
+ Module: opt.module,
274
+ Scheduler: opt.scheduler,
275
+ "Content-Type": "text/plain"
276
+ }));
267
277
  _module = mem.modmap[mod];
268
278
  ex = false;
269
- (_opt$tags = opt.tags) !== null && _opt$tags !== void 0 ? _opt$tags : opt.tags = [];
279
+ (_opt$tags2 = opt.tags) !== null && _opt$tags2 !== void 0 ? _opt$tags2 : opt.tags = [];
270
280
  _iterator = _createForOfIteratorHelper(opt.tags);
271
281
  try {
272
282
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -282,27 +292,29 @@ var connect = exports.connect = function connect(mem) {
282
292
  name: "Type",
283
293
  value: "Process"
284
294
  });
285
- _context2.next = 25;
295
+ _context2.next = 26;
286
296
  return ar.dataitem({
287
297
  data: opt.data,
288
298
  signer: opt.signer,
289
299
  tags: (0, _utils.tags)(opt.tags)
290
300
  });
291
- case 25:
301
+ case 26:
292
302
  _yield$ar$dataitem2 = _context2.sent;
293
303
  id = _yield$ar$dataitem2.id;
294
304
  owner = _yield$ar$dataitem2.owner;
295
305
  item = _yield$ar$dataitem2.item;
296
- _context2.next = 31;
306
+ _context2.next = 32;
297
307
  return ar.postItem(item, _test.su.jwk);
298
- case 31:
308
+ case 32:
299
309
  _tags = (0, _utils.tags)(opt.tags);
300
310
  res = null;
301
311
  memory = null;
302
312
  p = {
303
313
  id: id,
314
+ epochs: [],
304
315
  handle: _module.handle,
305
316
  module: _module.id,
317
+ hash: id,
306
318
  memory: memory,
307
319
  owner: owner,
308
320
  height: 0,
@@ -312,7 +324,7 @@ var connect = exports.connect = function connect(mem) {
312
324
  opt: opt
313
325
  };
314
326
  if (!_tags["On-Boot"]) {
315
- _context2.next = 49;
327
+ _context2.next = 50;
316
328
  break;
317
329
  }
318
330
  data = "";
@@ -325,51 +337,51 @@ var connect = exports.connect = function connect(mem) {
325
337
  auth: _test.mu.addr
326
338
  });
327
339
  _t = (0, _utils.tags)(msg.Tags);
328
- _context2.next = 43;
340
+ _context2.next = 44;
329
341
  return _module.handle(null, msg, _env);
330
- case 43:
342
+ case 44:
331
343
  res = _context2.sent;
332
344
  p.memory = res.Memory;
333
345
  delete res.Memory;
334
346
  p.res[id] = res;
335
- _context2.next = 50;
347
+ _context2.next = 51;
336
348
  break;
337
- case 49:
338
- p.height += 1;
339
349
  case 50:
350
+ p.height += 1;
351
+ case 51:
340
352
  mem.msgs[id] = opt;
341
353
  mem.env[id] = p;
342
354
  if (!_tags["Cron-Interval"]) {
343
- _context2.next = 76;
355
+ _context2.next = 77;
344
356
  break;
345
357
  }
346
358
  _tags$CronInterval$s = _tags["Cron-Interval"].split("-"), _tags$CronInterval$s2 = _slicedToArray(_tags$CronInterval$s, 2), num = _tags$CronInterval$s2[0], unit = _tags$CronInterval$s2[1];
347
359
  _int = 0;
348
360
  _context2.t0 = unit.replace(/s$/, "");
349
- _context2.next = _context2.t0 === "millisecond" ? 58 : _context2.t0 === "second" ? 60 : _context2.t0 === "minute" ? 62 : _context2.t0 === "hour" ? 64 : _context2.t0 === "day" ? 66 : _context2.t0 === "month" ? 68 : _context2.t0 === "year" ? 70 : 72;
361
+ _context2.next = _context2.t0 === "millisecond" ? 59 : _context2.t0 === "second" ? 61 : _context2.t0 === "minute" ? 63 : _context2.t0 === "hour" ? 65 : _context2.t0 === "day" ? 67 : _context2.t0 === "month" ? 69 : _context2.t0 === "year" ? 71 : 73;
350
362
  break;
351
- case 58:
363
+ case 59:
352
364
  _int = num;
353
- return _context2.abrupt("break", 72);
354
- case 60:
365
+ return _context2.abrupt("break", 73);
366
+ case 61:
355
367
  _int = num * 1000;
356
- return _context2.abrupt("break", 72);
357
- case 62:
368
+ return _context2.abrupt("break", 73);
369
+ case 63:
358
370
  _int = num * 1000 * 60;
359
- return _context2.abrupt("break", 72);
360
- case 64:
371
+ return _context2.abrupt("break", 73);
372
+ case 65:
361
373
  _int = num * 1000 * 60 * 60;
362
- return _context2.abrupt("break", 72);
363
- case 66:
374
+ return _context2.abrupt("break", 73);
375
+ case 67:
364
376
  _int = num * 1000 * 60 * 60 * 24;
365
- return _context2.abrupt("break", 72);
366
- case 68:
377
+ return _context2.abrupt("break", 73);
378
+ case 69:
367
379
  _int = num * 1000 * 60 * 60 * 24 * 30;
368
- return _context2.abrupt("break", 72);
369
- case 70:
380
+ return _context2.abrupt("break", 73);
381
+ case 71:
370
382
  _int = num * 1000 * 60 * 60 * 24 * 365;
371
- return _context2.abrupt("break", 72);
372
- case 72:
383
+ return _context2.abrupt("break", 73);
384
+ case 73:
373
385
  cronTags = [];
374
386
  for (k in _tags) {
375
387
  if (/^Cron-Tag-/.test(k)) {
@@ -381,9 +393,9 @@ var connect = exports.connect = function connect(mem) {
381
393
  }
382
394
  mem.env[id].cronTags = cronTags;
383
395
  mem.env[id].span = _int;
384
- case 76:
385
- return _context2.abrupt("return", id);
386
396
  case 77:
397
+ return _context2.abrupt("return", id);
398
+ case 78:
387
399
  case "end":
388
400
  return _context2.stop();
389
401
  }
@@ -393,129 +405,248 @@ var connect = exports.connect = function connect(mem) {
393
405
  return _ref6.apply(this, arguments);
394
406
  };
395
407
  }();
396
- var assign = /*#__PURE__*/function () {
408
+ function genHashChain(previousHash) {
409
+ var previousMessageId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
410
+ var hasher = _crypto["default"].createHash("sha256");
411
+ hasher.update(Buffer.from(previousHash, "base64url"));
412
+ if (previousMessageId) {
413
+ hasher.update(Buffer.from(previousMessageId, "base64url"));
414
+ }
415
+ return (0, _base64url["default"])(hasher.digest());
416
+ }
417
+ var _assign = /*#__PURE__*/function () {
397
418
  var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opt) {
398
- var p, _opt, _yield$ar$dataitem3, id, owner, item, _opt$data2, _opt$from, _res$Messages, msg, _env, res, _iterator2, _step2, v;
419
+ var _opt$tags3;
420
+ var p, _opt, hash, _yield$ar$dataitem3, id, owner, item, _opt$data2, _ref8, _opt$from, _res$Messages, _res$Spawns, _res$Assignments, msg, _env, res, _iterator2, _step2, v, _iterator3, _step3, _v, _tags, _iterator4, _step4, _v2, _iterator5, _step5, v2;
399
421
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
400
422
  while (1) switch (_context3.prev = _context3.next) {
401
423
  case 0:
402
424
  p = mem.env[opt.process];
403
- _opt = (0, _ramda.clone)(mem.msgs[opt.message]);
404
- _context3.next = 4;
425
+ _opt = mem.msgs[opt.message];
426
+ hash = genHashChain(p.hash, opt.message);
427
+ p.hash = hash;
428
+ opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags3 = opt.tags) !== null && _opt$tags3 !== void 0 ? _opt$tags3 : []), {
429
+ Timestamp: Date.now(),
430
+ Epoch: p.epochs.length,
431
+ Nonce: "0",
432
+ "Data-Protocol": "ao",
433
+ Variant: "ao.TN.1",
434
+ SDK: "aoconnect",
435
+ Type: "Assignment",
436
+ "Block-Height": mem.height,
437
+ Process: opt.process,
438
+ Message: opt.message,
439
+ "Hash-Chain": hash
440
+ }));
441
+ p.epochs.push([opt.id]);
442
+ _context3.next = 8;
405
443
  return ar.dataitem({
406
- data: _opt.data,
407
- signer: _opt.signer,
408
- tags: (0, _utils.tags)(_opt.tags)
444
+ data: opt.data,
445
+ signer: opt.signer,
446
+ tags: (0, _utils.tags)(opt.tags),
447
+ target: opt.process
409
448
  });
410
- case 4:
449
+ case 8:
411
450
  _yield$ar$dataitem3 = _context3.sent;
412
451
  id = _yield$ar$dataitem3.id;
413
452
  owner = _yield$ar$dataitem3.owner;
414
453
  item = _yield$ar$dataitem3.item;
415
- _context3.next = 10;
454
+ _context3.next = 14;
416
455
  return ar.postItem(item, _test.su.jwk);
417
- case 10:
418
- _context3.prev = 10;
419
- msg = genMsg(p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : owner, _test.mu.addr);
456
+ case 14:
457
+ _context3.prev = 14;
458
+ msg = genMsg(p, (_opt$data2 = _opt.data) !== null && _opt$data2 !== void 0 ? _opt$data2 : "", _opt.tags, (_ref8 = (_opt$from = _opt.from) !== null && _opt$from !== void 0 ? _opt$from : opt.from) !== null && _ref8 !== void 0 ? _ref8 : owner, _test.mu.addr);
420
459
  _env = genEnv({
421
460
  pid: p.id,
422
461
  owner: p.owner,
423
462
  module: p.module,
424
463
  auth: _test.mu.addr
425
464
  });
426
- _context3.next = 15;
465
+ _context3.next = 19;
427
466
  return p.handle(p.memory, msg, _env);
428
- case 15:
467
+ case 19:
429
468
  res = _context3.sent;
430
469
  p.memory = res.Memory;
431
470
  delete res.Memory;
432
- p.res[id] = res;
433
- p.results.push(id);
471
+ p.res[opt.message] = res;
472
+ p.results.push(opt.message);
434
473
  p.txs.unshift(_objectSpread({
435
- id: id
436
- }, _opt));
437
- mem.msgs[id] = _opt;
474
+ id: opt.message
475
+ }, opt));
476
+ mem.msgs[opt.message] = _opt;
438
477
  _iterator2 = _createForOfIteratorHelper((_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : []);
439
- _context3.prev = 23;
478
+ _context3.prev = 27;
440
479
  _iterator2.s();
441
- case 25:
480
+ case 29:
442
481
  if ((_step2 = _iterator2.n()).done) {
443
- _context3.next = 32;
482
+ _context3.next = 36;
444
483
  break;
445
484
  }
446
485
  v = _step2.value;
447
486
  if (!mem.env[v.Target]) {
448
- _context3.next = 30;
487
+ _context3.next = 34;
449
488
  break;
450
489
  }
451
- _context3.next = 30;
452
- return _message({
490
+ _context3.next = 34;
491
+ return message({
453
492
  process: v.Target,
454
493
  tags: v.Tags,
455
494
  data: v.Data,
456
495
  signer: _test.mu.signer,
457
496
  from: opt.process
458
497
  });
459
- case 30:
460
- _context3.next = 25;
498
+ case 34:
499
+ _context3.next = 29;
461
500
  break;
462
- case 32:
463
- _context3.next = 37;
501
+ case 36:
502
+ _context3.next = 41;
464
503
  break;
465
- case 34:
466
- _context3.prev = 34;
467
- _context3.t0 = _context3["catch"](23);
504
+ case 38:
505
+ _context3.prev = 38;
506
+ _context3.t0 = _context3["catch"](27);
468
507
  _iterator2.e(_context3.t0);
469
- case 37:
470
- _context3.prev = 37;
508
+ case 41:
509
+ _context3.prev = 41;
471
510
  _iterator2.f();
472
- return _context3.finish(37);
473
- case 40:
511
+ return _context3.finish(41);
512
+ case 44:
513
+ _iterator3 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
514
+ _context3.prev = 45;
515
+ _iterator3.s();
516
+ case 47:
517
+ if ((_step3 = _iterator3.n()).done) {
518
+ _context3.next = 54;
519
+ break;
520
+ }
521
+ _v = _step3.value;
522
+ _tags = (0, _utils.tags)(_v.Tags);
523
+ _context3.next = 52;
524
+ return spawn({
525
+ module: _tags.Module,
526
+ scheduler: _test.scheduler,
527
+ tags: _v.Tags,
528
+ data: _v.Data,
529
+ from: _tags["From-Process"],
530
+ signer: _test.mu.signer
531
+ });
532
+ case 52:
533
+ _context3.next = 47;
534
+ break;
535
+ case 54:
536
+ _context3.next = 59;
537
+ break;
538
+ case 56:
539
+ _context3.prev = 56;
540
+ _context3.t1 = _context3["catch"](45);
541
+ _iterator3.e(_context3.t1);
542
+ case 59:
543
+ _context3.prev = 59;
544
+ _iterator3.f();
545
+ return _context3.finish(59);
546
+ case 62:
547
+ _iterator4 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
548
+ _context3.prev = 63;
549
+ _iterator4.s();
550
+ case 65:
551
+ if ((_step4 = _iterator4.n()).done) {
552
+ _context3.next = 86;
553
+ break;
554
+ }
555
+ _v2 = _step4.value;
556
+ _iterator5 = _createForOfIteratorHelper(_v2.Processes);
557
+ _context3.prev = 68;
558
+ _iterator5.s();
559
+ case 70:
560
+ if ((_step5 = _iterator5.n()).done) {
561
+ _context3.next = 76;
562
+ break;
563
+ }
564
+ v2 = _step5.value;
565
+ _context3.next = 74;
566
+ return _assign({
567
+ message: _v2.Message,
568
+ process: v2,
569
+ from: opt.process,
570
+ signer: _test.mu.signer
571
+ });
572
+ case 74:
573
+ _context3.next = 70;
574
+ break;
575
+ case 76:
576
+ _context3.next = 81;
577
+ break;
578
+ case 78:
579
+ _context3.prev = 78;
580
+ _context3.t2 = _context3["catch"](68);
581
+ _iterator5.e(_context3.t2);
582
+ case 81:
583
+ _context3.prev = 81;
584
+ _iterator5.f();
585
+ return _context3.finish(81);
586
+ case 84:
587
+ _context3.next = 65;
588
+ break;
589
+ case 86:
590
+ _context3.next = 91;
591
+ break;
592
+ case 88:
593
+ _context3.prev = 88;
594
+ _context3.t3 = _context3["catch"](63);
595
+ _iterator4.e(_context3.t3);
596
+ case 91:
597
+ _context3.prev = 91;
598
+ _iterator4.f();
599
+ return _context3.finish(91);
600
+ case 94:
474
601
  return _context3.abrupt("return", id);
475
- case 43:
476
- _context3.prev = 43;
477
- _context3.t1 = _context3["catch"](10);
478
- console.log(_context3.t1);
479
- case 46:
602
+ case 97:
603
+ _context3.prev = 97;
604
+ _context3.t4 = _context3["catch"](14);
605
+ console.log(_context3.t4);
606
+ case 100:
480
607
  return _context3.abrupt("return", null);
481
- case 47:
608
+ case 101:
482
609
  case "end":
483
610
  return _context3.stop();
484
611
  }
485
- }, _callee3, null, [[10, 43], [23, 34, 37, 40]]);
612
+ }, _callee3, null, [[14, 97], [27, 38, 41, 44], [45, 56, 59, 62], [63, 88, 91, 94], [68, 78, 81, 84]]);
486
613
  }));
487
614
  return function assign(_x2) {
488
615
  return _ref7.apply(this, arguments);
489
616
  };
490
617
  }();
491
- var _message = /*#__PURE__*/function () {
492
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
493
- var p, ex, _iterator3, _step3, _v3, _yield$ar$dataitem4, item, id, owner, _opt$data3, _opt$from2, _res$Messages2, _res$Spawns, _res$Assignments, msg, _env, res, _iterator4, _step4, v, _iterator5, _step5, _v, _tags, _iterator6, _step6, _v2, _iterator7, _step7, v2;
618
+ var message = /*#__PURE__*/function () {
619
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(opt) {
620
+ var _opt$tags4;
621
+ var p, ex, _iterator6, _step6, v, _yield$ar$dataitem4, item, id, owner;
494
622
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
495
623
  while (1) switch (_context4.prev = _context4.next) {
496
624
  case 0:
497
625
  p = mem.env[opt.process];
498
626
  ex = false;
499
- _iterator3 = _createForOfIteratorHelper(opt.tags);
627
+ _iterator6 = _createForOfIteratorHelper(opt.tags);
500
628
  try {
501
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
502
- _v3 = _step3.value;
503
- if (_v3.name === "Type") ex = true;
629
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
630
+ v = _step6.value;
631
+ if (v.name === "Type") ex = true;
504
632
  }
505
633
  } catch (err) {
506
- _iterator3.e(err);
634
+ _iterator6.e(err);
507
635
  } finally {
508
- _iterator3.f();
636
+ _iterator6.f();
509
637
  }
510
- if (!ex) opt.tags.push({
511
- name: "Type",
512
- value: "Message"
513
- });
638
+ opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags4 = opt.tags) !== null && _opt$tags4 !== void 0 ? _opt$tags4 : []), {
639
+ "Data-Protocol": "ao",
640
+ Variant: "ao.TN.1",
641
+ Type: "Message",
642
+ SDK: "aoconnect"
643
+ }));
514
644
  _context4.next = 7;
515
645
  return ar.dataitem({
516
646
  data: opt.data,
517
647
  signer: opt.signer,
518
- tags: (0, _utils.tags)(opt.tags)
648
+ tags: (0, _utils.tags)(opt.tags),
649
+ target: opt.process
519
650
  });
520
651
  case 7:
521
652
  _yield$ar$dataitem4 = _context4.sent;
@@ -525,169 +656,28 @@ var connect = exports.connect = function connect(mem) {
525
656
  _context4.next = 13;
526
657
  return ar.postItem(item, _test.su.jwk);
527
658
  case 13:
528
- _context4.prev = 13;
529
- msg = genMsg(p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, (_opt$from2 = opt.from) !== null && _opt$from2 !== void 0 ? _opt$from2 : owner, _test.mu.addr);
530
- _env = genEnv({
531
- pid: p.id,
532
- owner: p.owner,
533
- module: p.module,
534
- auth: _test.mu.addr
535
- });
536
- _context4.next = 18;
537
- return p.handle(p.memory, msg, _env);
538
- case 18:
539
- res = _context4.sent;
540
- p.memory = res.Memory;
541
- delete res.Memory;
542
- p.res[id] = res;
543
- p.results.push(id);
544
- p.txs.unshift(_objectSpread({
545
- id: id
546
- }, opt));
547
659
  mem.msgs[id] = opt;
548
- _iterator4 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []);
549
- _context4.prev = 26;
550
- _iterator4.s();
551
- case 28:
552
- if ((_step4 = _iterator4.n()).done) {
553
- _context4.next = 35;
554
- break;
555
- }
556
- v = _step4.value;
557
- if (!mem.env[v.Target]) {
558
- _context4.next = 33;
559
- break;
560
- }
561
- _context4.next = 33;
562
- return _message({
563
- process: v.Target,
564
- tags: v.Tags,
565
- data: v.Data,
566
- signer: _test.mu.signer,
567
- from: opt.process
568
- });
569
- case 33:
570
- _context4.next = 28;
571
- break;
572
- case 35:
573
- _context4.next = 40;
574
- break;
575
- case 37:
576
- _context4.prev = 37;
577
- _context4.t0 = _context4["catch"](26);
578
- _iterator4.e(_context4.t0);
579
- case 40:
580
- _context4.prev = 40;
581
- _iterator4.f();
582
- return _context4.finish(40);
583
- case 43:
584
- _iterator5 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
585
- _context4.prev = 44;
586
- _iterator5.s();
587
- case 46:
588
- if ((_step5 = _iterator5.n()).done) {
589
- _context4.next = 53;
590
- break;
591
- }
592
- _v = _step5.value;
593
- _tags = (0, _utils.tags)(_v.Tags);
594
- _context4.next = 51;
595
- return spawn({
596
- module: _tags.Module,
597
- scheduler: _test.scheduler,
598
- tags: _v.Tags,
599
- data: _v.Data,
600
- from: _tags["From-Process"],
660
+ _context4.next = 16;
661
+ return _assign({
662
+ message: id,
663
+ process: opt.process,
664
+ from: owner,
601
665
  signer: _test.mu.signer
602
666
  });
603
- case 51:
604
- _context4.next = 46;
605
- break;
606
- case 53:
607
- _context4.next = 58;
608
- break;
609
- case 55:
610
- _context4.prev = 55;
611
- _context4.t1 = _context4["catch"](44);
612
- _iterator5.e(_context4.t1);
613
- case 58:
614
- _context4.prev = 58;
615
- _iterator5.f();
616
- return _context4.finish(58);
617
- case 61:
618
- _iterator6 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
619
- _context4.prev = 62;
620
- _iterator6.s();
621
- case 64:
622
- if ((_step6 = _iterator6.n()).done) {
623
- _context4.next = 85;
624
- break;
625
- }
626
- _v2 = _step6.value;
627
- _iterator7 = _createForOfIteratorHelper(_v2.Processes);
628
- _context4.prev = 67;
629
- _iterator7.s();
630
- case 69:
631
- if ((_step7 = _iterator7.n()).done) {
632
- _context4.next = 75;
633
- break;
634
- }
635
- v2 = _step7.value;
636
- _context4.next = 73;
637
- return assign({
638
- message: _v2.Message,
639
- process: v2,
640
- from: opt.process,
641
- signer: _test.mu.signer
642
- });
643
- case 73:
644
- _context4.next = 69;
645
- break;
646
- case 75:
647
- _context4.next = 80;
648
- break;
649
- case 77:
650
- _context4.prev = 77;
651
- _context4.t2 = _context4["catch"](67);
652
- _iterator7.e(_context4.t2);
653
- case 80:
654
- _context4.prev = 80;
655
- _iterator7.f();
656
- return _context4.finish(80);
657
- case 83:
658
- _context4.next = 64;
659
- break;
660
- case 85:
661
- _context4.next = 90;
662
- break;
663
- case 87:
664
- _context4.prev = 87;
665
- _context4.t3 = _context4["catch"](62);
666
- _iterator6.e(_context4.t3);
667
- case 90:
668
- _context4.prev = 90;
669
- _iterator6.f();
670
- return _context4.finish(90);
671
- case 93:
667
+ case 16:
672
668
  return _context4.abrupt("return", id);
673
- case 96:
674
- _context4.prev = 96;
675
- _context4.t4 = _context4["catch"](13);
676
- console.log(_context4.t4);
677
- case 99:
678
- return _context4.abrupt("return", null);
679
- case 100:
669
+ case 17:
680
670
  case "end":
681
671
  return _context4.stop();
682
672
  }
683
- }, _callee4, null, [[13, 96], [26, 37, 40, 43], [44, 55, 58, 61], [62, 87, 90, 93], [67, 77, 80, 83]]);
673
+ }, _callee4);
684
674
  }));
685
675
  return function message(_x3) {
686
- return _ref8.apply(this, arguments);
676
+ return _ref9.apply(this, arguments);
687
677
  };
688
678
  }();
689
679
  return {
690
- message: _message,
680
+ message: message,
691
681
  unmonitor: function () {
692
682
  var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(opt) {
693
683
  var p;
@@ -723,7 +713,7 @@ var connect = exports.connect = function connect(mem) {
723
713
  while (1) switch (_context6.prev = _context6.next) {
724
714
  case 0:
725
715
  _context6.next = 2;
726
- return _message({
716
+ return message({
727
717
  tags: p.cronTags,
728
718
  process: opt.process,
729
719
  signer: _test.mu.signer,
@@ -748,7 +738,7 @@ var connect = exports.connect = function connect(mem) {
748
738
  return monitor;
749
739
  }(),
750
740
  spawn: spawn,
751
- assign: assign,
741
+ assign: _assign,
752
742
  result: function () {
753
743
  var _result = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
754
744
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -838,19 +828,21 @@ var connect = exports.connect = function connect(mem) {
838
828
  }(),
839
829
  dryrun: function () {
840
830
  var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
841
- var p, _yield$ar$dataitem5, id, owner, _opt$data4, msg, _env, res;
831
+ var p, _yield$ar$dataitem5, id, owner, _opt$data3, msg, _env, res;
842
832
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
843
833
  while (1) switch (_context10.prev = _context10.next) {
844
834
  case 0:
845
835
  p = mem.env[opt.process];
846
836
  _context10.next = 3;
847
- return ar.dataitem(opt);
837
+ return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
838
+ target: opt.process
839
+ }));
848
840
  case 3:
849
841
  _yield$ar$dataitem5 = _context10.sent;
850
842
  id = _yield$ar$dataitem5.id;
851
843
  owner = _yield$ar$dataitem5.owner;
852
844
  _context10.prev = 6;
853
- msg = genMsg(p, (_opt$data4 = opt.data) !== null && _opt$data4 !== void 0 ? _opt$data4 : "", opt.tags, owner, _test.mu.addr, true);
845
+ msg = genMsg(p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, _test.mu.addr, true);
854
846
  _env = genEnv({
855
847
  pid: p.id,
856
848
  owner: p.owner,