wao 0.18.5 → 0.18.7

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.
@@ -866,7 +866,7 @@ var _default = exports["default"] = function _default() {
866
866
  _iterator3.s();
867
867
  case 104:
868
868
  if ((_step3 = _iterator3.n()).done) {
869
- _context4.next = 113;
869
+ _context4.next = 117;
870
870
  break;
871
871
  }
872
872
  v = _step3.value;
@@ -874,7 +874,7 @@ var _default = exports["default"] = function _default() {
874
874
  return mem.get("env", v.Target);
875
875
  case 108:
876
876
  if (!_context4.sent) {
877
- _context4.next = 111;
877
+ _context4.next = 113;
878
878
  break;
879
879
  }
880
880
  _context4.next = 111;
@@ -887,31 +887,44 @@ var _default = exports["default"] = function _default() {
887
887
  from: opt.process
888
888
  });
889
889
  case 111:
890
- _context4.next = 104;
890
+ _context4.next = 115;
891
891
  break;
892
892
  case 113:
893
- _context4.next = 118;
894
- break;
893
+ _context4.next = 115;
894
+ return record({
895
+ "for": opt.message,
896
+ tags: v.Tags,
897
+ data: v.Data,
898
+ signer: mu.signer,
899
+ from: opt.process,
900
+ target: v.Target
901
+ });
895
902
  case 115:
896
- _context4.prev = 115;
903
+ _context4.next = 104;
904
+ break;
905
+ case 117:
906
+ _context4.next = 122;
907
+ break;
908
+ case 119:
909
+ _context4.prev = 119;
897
910
  _context4.t22 = _context4["catch"](102);
898
911
  _iterator3.e(_context4.t22);
899
- case 118:
900
- _context4.prev = 118;
912
+ case 122:
913
+ _context4.prev = 122;
901
914
  _iterator3.f();
902
- return _context4.finish(118);
903
- case 121:
915
+ return _context4.finish(122);
916
+ case 125:
904
917
  _iterator4 = _createForOfIteratorHelper((_res$Spawns = res.Spawns) !== null && _res$Spawns !== void 0 ? _res$Spawns : []);
905
- _context4.prev = 122;
918
+ _context4.prev = 126;
906
919
  _iterator4.s();
907
- case 124:
920
+ case 128:
908
921
  if ((_step4 = _iterator4.n()).done) {
909
- _context4.next = 131;
922
+ _context4.next = 135;
910
923
  break;
911
924
  }
912
925
  _v = _step4.value;
913
926
  __tags = (0, _utils.tags)(_v.Tags);
914
- _context4.next = 129;
927
+ _context4.next = 133;
915
928
  return spawn({
916
929
  "for": opt.message,
917
930
  module: __tags.Module,
@@ -921,87 +934,87 @@ var _default = exports["default"] = function _default() {
921
934
  from: __tags["From-Process"],
922
935
  signer: mu.signer
923
936
  });
924
- case 129:
925
- _context4.next = 124;
937
+ case 133:
938
+ _context4.next = 128;
926
939
  break;
927
- case 131:
928
- _context4.next = 136;
940
+ case 135:
941
+ _context4.next = 140;
929
942
  break;
930
- case 133:
931
- _context4.prev = 133;
932
- _context4.t23 = _context4["catch"](122);
943
+ case 137:
944
+ _context4.prev = 137;
945
+ _context4.t23 = _context4["catch"](126);
933
946
  _iterator4.e(_context4.t23);
934
- case 136:
935
- _context4.prev = 136;
947
+ case 140:
948
+ _context4.prev = 140;
936
949
  _iterator4.f();
937
- return _context4.finish(136);
938
- case 139:
950
+ return _context4.finish(140);
951
+ case 143:
939
952
  _iterator5 = _createForOfIteratorHelper((_res$Assignments = res.Assignments) !== null && _res$Assignments !== void 0 ? _res$Assignments : []);
940
- _context4.prev = 140;
953
+ _context4.prev = 144;
941
954
  _iterator5.s();
942
- case 142:
955
+ case 146:
943
956
  if ((_step5 = _iterator5.n()).done) {
944
- _context4.next = 163;
957
+ _context4.next = 167;
945
958
  break;
946
959
  }
947
960
  _v2 = _step5.value;
948
961
  _iterator6 = _createForOfIteratorHelper(_v2.Processes);
949
- _context4.prev = 145;
962
+ _context4.prev = 149;
950
963
  _iterator6.s();
951
- case 147:
964
+ case 151:
952
965
  if ((_step6 = _iterator6.n()).done) {
953
- _context4.next = 153;
966
+ _context4.next = 157;
954
967
  break;
955
968
  }
956
969
  v2 = _step6.value;
957
- _context4.next = 151;
970
+ _context4.next = 155;
958
971
  return _assign({
959
972
  message: _v2.Message,
960
973
  process: v2,
961
974
  from: opt.process,
962
975
  signer: mu.signer
963
976
  });
964
- case 151:
965
- _context4.next = 147;
977
+ case 155:
978
+ _context4.next = 151;
966
979
  break;
967
- case 153:
968
- _context4.next = 158;
980
+ case 157:
981
+ _context4.next = 162;
969
982
  break;
970
- case 155:
971
- _context4.prev = 155;
972
- _context4.t24 = _context4["catch"](145);
983
+ case 159:
984
+ _context4.prev = 159;
985
+ _context4.t24 = _context4["catch"](149);
973
986
  _iterator6.e(_context4.t24);
974
- case 158:
975
- _context4.prev = 158;
987
+ case 162:
988
+ _context4.prev = 162;
976
989
  _iterator6.f();
977
- return _context4.finish(158);
978
- case 161:
979
- _context4.next = 142;
990
+ return _context4.finish(162);
991
+ case 165:
992
+ _context4.next = 146;
980
993
  break;
981
- case 163:
982
- _context4.next = 168;
994
+ case 167:
995
+ _context4.next = 172;
983
996
  break;
984
- case 165:
985
- _context4.prev = 165;
986
- _context4.t25 = _context4["catch"](140);
997
+ case 169:
998
+ _context4.prev = 169;
999
+ _context4.t25 = _context4["catch"](144);
987
1000
  _iterator5.e(_context4.t25);
988
- case 168:
989
- _context4.prev = 168;
1001
+ case 172:
1002
+ _context4.prev = 172;
990
1003
  _iterator5.f();
991
- return _context4.finish(168);
992
- case 171:
1004
+ return _context4.finish(172);
1005
+ case 175:
993
1006
  return _context4.abrupt("return", id);
994
- case 174:
995
- _context4.prev = 174;
1007
+ case 178:
1008
+ _context4.prev = 178;
996
1009
  _context4.t26 = _context4["catch"](40);
997
1010
  console.log(_context4.t26);
998
- case 177:
1011
+ case 181:
999
1012
  return _context4.abrupt("return", null);
1000
- case 178:
1013
+ case 182:
1001
1014
  case "end":
1002
1015
  return _context4.stop();
1003
1016
  }
1004
- }, _callee4, null, [[40, 174], [102, 115, 118, 121], [122, 133, 136, 139], [140, 165, 168, 171], [145, 155, 158, 161]]);
1017
+ }, _callee4, null, [[40, 178], [102, 119, 122, 125], [126, 137, 140, 143], [144, 169, 172, 175], [149, 159, 162, 165]]);
1005
1018
  }));
1006
1019
  return function assign(_x8) {
1007
1020
  return _ref9.apply(this, arguments);
@@ -1300,86 +1313,188 @@ var _default = exports["default"] = function _default() {
1300
1313
  return _ref11.apply(this, arguments);
1301
1314
  };
1302
1315
  }();
1303
- var _recover = /*#__PURE__*/function () {
1304
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(pid, next) {
1305
- var count, success, _success, i, p, from, msgs, _iterator7, _step7, v, item, _k2, _tags;
1316
+ var record = /*#__PURE__*/function () {
1317
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(opt) {
1318
+ var _opt$item$id2, _opt$item2, _opt$owner2, _opt$tags4;
1319
+ var id, owner, item, _yield$mem$getTx$tags4, _yield$mem$getTx6, pr, module, _yield$ar$dataitem4, _msg;
1306
1320
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1307
1321
  while (1) switch (_context6.prev = _context6.next) {
1322
+ case 0:
1323
+ id = (_opt$item$id2 = opt === null || opt === void 0 || (_opt$item2 = opt.item) === null || _opt$item2 === void 0 ? void 0 : _opt$item2.id) !== null && _opt$item$id2 !== void 0 ? _opt$item$id2 : "";
1324
+ owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : "";
1325
+ item = opt.item;
1326
+ opt.tags = (0, _utils.buildTags)(null, (0, _ramda.mergeLeft)((0, _utils.tags)((_opt$tags4 = opt.tags) !== null && _opt$tags4 !== void 0 ? _opt$tags4 : []), {
1327
+ "Data-Protocol": "ao",
1328
+ Variant: variant !== null && variant !== void 0 ? variant : "ao.TN.1",
1329
+ Type: "Message"
1330
+ }));
1331
+ if (!opt["for"]) {
1332
+ _context6.next = 30;
1333
+ break;
1334
+ }
1335
+ opt.tags.push({
1336
+ name: "Pushed-For",
1337
+ value: opt["for"]
1338
+ });
1339
+ opt.tags.push({
1340
+ name: "From-Process",
1341
+ value: opt.from
1342
+ });
1343
+ _context6.next = 9;
1344
+ return mem.getTx(opt.from);
1345
+ case 9:
1346
+ _context6.t2 = _yield$mem$getTx6 = _context6.sent;
1347
+ _context6.t1 = _context6.t2 === null;
1348
+ if (_context6.t1) {
1349
+ _context6.next = 13;
1350
+ break;
1351
+ }
1352
+ _context6.t1 = _yield$mem$getTx6 === void 0;
1353
+ case 13:
1354
+ if (!_context6.t1) {
1355
+ _context6.next = 17;
1356
+ break;
1357
+ }
1358
+ _context6.t3 = void 0;
1359
+ _context6.next = 18;
1360
+ break;
1361
+ case 17:
1362
+ _context6.t3 = _yield$mem$getTx6.tags;
1363
+ case 18:
1364
+ _context6.t4 = _yield$mem$getTx$tags4 = _context6.t3;
1365
+ _context6.t0 = _context6.t4 !== null;
1366
+ if (!_context6.t0) {
1367
+ _context6.next = 22;
1368
+ break;
1369
+ }
1370
+ _context6.t0 = _yield$mem$getTx$tags4 !== void 0;
1371
+ case 22:
1372
+ if (!_context6.t0) {
1373
+ _context6.next = 26;
1374
+ break;
1375
+ }
1376
+ _context6.t5 = _yield$mem$getTx$tags4;
1377
+ _context6.next = 27;
1378
+ break;
1379
+ case 26:
1380
+ _context6.t5 = [];
1381
+ case 27:
1382
+ pr = _context6.t5;
1383
+ module = (0, _utils.tags)(pr).Module;
1384
+ if (module) opt.tags.push({
1385
+ name: "From-Module",
1386
+ value: module
1387
+ });
1388
+ case 30:
1389
+ ;
1390
+ _context6.next = 33;
1391
+ return ar.dataitem({
1392
+ data: opt.data,
1393
+ signer: opt.signer,
1394
+ tags: (0, _utils.tags)(opt.tags),
1395
+ target: opt.process
1396
+ });
1397
+ case 33:
1398
+ _yield$ar$dataitem4 = _context6.sent;
1399
+ item = _yield$ar$dataitem4.item;
1400
+ id = _yield$ar$dataitem4.id;
1401
+ owner = _yield$ar$dataitem4.owner;
1402
+ _msg = (0, _ramda.dissoc)("signer", opt);
1403
+ _context6.next = 40;
1404
+ return mem.set(_msg, "msgs", id);
1405
+ case 40:
1406
+ _context6.next = 42;
1407
+ return ar.postItems(item, su.jwk);
1408
+ case 42:
1409
+ case "end":
1410
+ return _context6.stop();
1411
+ }
1412
+ }, _callee6);
1413
+ }));
1414
+ return function record(_x10) {
1415
+ return _ref13.apply(this, arguments);
1416
+ };
1417
+ }();
1418
+ var _recover = /*#__PURE__*/function () {
1419
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(pid, next) {
1420
+ var count, success, _success, i, p, from, msgs, _iterator7, _step7, v, item, _k2, _tags;
1421
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1422
+ while (1) switch (_context7.prev = _context7.next) {
1308
1423
  case 0:
1309
1424
  count = 0;
1310
1425
  success = false;
1311
1426
  if (!hb) {
1312
- _context6.next = 77;
1427
+ _context7.next = 77;
1313
1428
  break;
1314
1429
  }
1315
1430
  if (!onRecovery[pid]) {
1316
- _context6.next = 20;
1431
+ _context7.next = 20;
1317
1432
  break;
1318
1433
  }
1319
1434
  _success = false;
1320
1435
  i = 0;
1321
1436
  case 6:
1322
1437
  if (!true) {
1323
- _context6.next = 17;
1438
+ _context7.next = 17;
1324
1439
  break;
1325
1440
  }
1326
- _context6.next = 9;
1441
+ _context7.next = 9;
1327
1442
  return (0, _utils.wait)(1000);
1328
1443
  case 9:
1329
1444
  if (onRecovery[pid]) {
1330
- _context6.next = 12;
1445
+ _context7.next = 12;
1331
1446
  break;
1332
1447
  }
1333
1448
  _success = true;
1334
- return _context6.abrupt("break", 17);
1449
+ return _context7.abrupt("break", 17);
1335
1450
  case 12:
1336
1451
  if (!(i > 10)) {
1337
- _context6.next = 14;
1452
+ _context7.next = 14;
1338
1453
  break;
1339
1454
  }
1340
- return _context6.abrupt("break", 17);
1455
+ return _context7.abrupt("break", 17);
1341
1456
  case 14:
1342
1457
  i++;
1343
- _context6.next = 6;
1458
+ _context7.next = 6;
1344
1459
  break;
1345
1460
  case 17:
1346
- return _context6.abrupt("return", {
1461
+ return _context7.abrupt("return", {
1347
1462
  success: _success
1348
1463
  });
1349
1464
  case 20:
1350
1465
  onRecovery[pid] = true;
1351
- _context6.prev = 21;
1352
- _context6.next = 24;
1466
+ _context7.prev = 21;
1467
+ _context7.next = 24;
1353
1468
  return mem.get("env", pid);
1354
1469
  case 24:
1355
- p = _context6.sent;
1470
+ p = _context7.sent;
1356
1471
  from = p ? p.results.length : 0;
1357
1472
  if (!next) {
1358
- _context6.next = 32;
1473
+ _context7.next = 32;
1359
1474
  break;
1360
1475
  }
1361
- _context6.next = 29;
1476
+ _context7.next = 29;
1362
1477
  return next();
1363
1478
  case 29:
1364
- _context6.t0 = _context6.sent;
1365
- _context6.next = 35;
1479
+ _context7.t0 = _context7.sent;
1480
+ _context7.next = 35;
1366
1481
  break;
1367
1482
  case 32:
1368
- _context6.next = 34;
1483
+ _context7.next = 34;
1369
1484
  return hb.messages({
1370
1485
  target: pid,
1371
1486
  from: from
1372
1487
  });
1373
1488
  case 34:
1374
- _context6.t0 = _context6.sent;
1489
+ _context7.t0 = _context7.sent;
1375
1490
  case 35:
1376
- msgs = _context6.t0;
1491
+ msgs = _context7.t0;
1377
1492
  _iterator7 = _createForOfIteratorHelper(msgs.edges);
1378
- _context6.prev = 37;
1493
+ _context7.prev = 37;
1379
1494
  _iterator7.s();
1380
1495
  case 39:
1381
1496
  if ((_step7 = _iterator7.n()).done) {
1382
- _context6.next = 59;
1497
+ _context7.next = 59;
1383
1498
  break;
1384
1499
  }
1385
1500
  v = _step7.value;
@@ -1407,10 +1522,10 @@ var _default = exports["default"] = function _default() {
1407
1522
  item.target = pid;
1408
1523
  _tags = (0, _utils.tags)(item.tags);
1409
1524
  if (!(_tags.Type === "Process")) {
1410
- _context6.next = 54;
1525
+ _context7.next = 54;
1411
1526
  break;
1412
1527
  }
1413
- _context6.next = 52;
1528
+ _context7.next = 52;
1414
1529
  return spawn({
1415
1530
  id: v.node.message.Id,
1416
1531
  http_msg: item,
@@ -1420,10 +1535,10 @@ var _default = exports["default"] = function _default() {
1420
1535
  recovery: true
1421
1536
  });
1422
1537
  case 52:
1423
- _context6.next = 56;
1538
+ _context7.next = 56;
1424
1539
  break;
1425
1540
  case 54:
1426
- _context6.next = 56;
1541
+ _context7.next = 56;
1427
1542
  return message({
1428
1543
  id: v.node.message.Id,
1429
1544
  process: pid,
@@ -1434,134 +1549,134 @@ var _default = exports["default"] = function _default() {
1434
1549
  case 56:
1435
1550
  count++;
1436
1551
  case 57:
1437
- _context6.next = 39;
1552
+ _context7.next = 39;
1438
1553
  break;
1439
1554
  case 59:
1440
- _context6.next = 64;
1555
+ _context7.next = 64;
1441
1556
  break;
1442
1557
  case 61:
1443
- _context6.prev = 61;
1444
- _context6.t1 = _context6["catch"](37);
1445
- _iterator7.e(_context6.t1);
1558
+ _context7.prev = 61;
1559
+ _context7.t1 = _context7["catch"](37);
1560
+ _iterator7.e(_context7.t1);
1446
1561
  case 64:
1447
- _context6.prev = 64;
1562
+ _context7.prev = 64;
1448
1563
  _iterator7.f();
1449
- return _context6.finish(64);
1564
+ return _context7.finish(64);
1450
1565
  case 67:
1451
1566
  if (!msgs.next) {
1452
- _context6.next = 70;
1567
+ _context7.next = 70;
1453
1568
  break;
1454
1569
  }
1455
- _context6.next = 70;
1570
+ _context7.next = 70;
1456
1571
  return _recover(pid, msgs.next);
1457
1572
  case 70:
1458
- _context6.next = 75;
1573
+ _context7.next = 75;
1459
1574
  break;
1460
1575
  case 72:
1461
- _context6.prev = 72;
1462
- _context6.t2 = _context6["catch"](21);
1463
- console.log(_context6.t2);
1576
+ _context7.prev = 72;
1577
+ _context7.t2 = _context7["catch"](21);
1578
+ console.log(_context7.t2);
1464
1579
  case 75:
1465
1580
  delete onRecovery[pid];
1466
1581
  case 76:
1467
1582
  success = true;
1468
1583
  case 77:
1469
- return _context6.abrupt("return", {
1584
+ return _context7.abrupt("return", {
1470
1585
  recovered: count,
1471
1586
  pid: pid,
1472
1587
  success: success
1473
1588
  });
1474
1589
  case 78:
1475
1590
  case "end":
1476
- return _context6.stop();
1591
+ return _context7.stop();
1477
1592
  }
1478
- }, _callee6, null, [[21, 72], [37, 61, 64, 67]]);
1593
+ }, _callee7, null, [[21, 72], [37, 61, 64, 67]]);
1479
1594
  }));
1480
- return function recover(_x10, _x11) {
1481
- return _ref13.apply(this, arguments);
1595
+ return function recover(_x11, _x12) {
1596
+ return _ref14.apply(this, arguments);
1482
1597
  };
1483
1598
  }();
1484
1599
  var result = /*#__PURE__*/function () {
1485
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(opt) {
1600
+ var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
1486
1601
  var _yield$mem$get2;
1487
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1488
- while (1) switch (_context7.prev = _context7.next) {
1602
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1603
+ while (1) switch (_context8.prev = _context8.next) {
1489
1604
  case 0:
1490
- _context7.next = 2;
1605
+ _context8.next = 2;
1491
1606
  return mem.get("msgs", opt.message);
1492
1607
  case 2:
1493
- _context7.t1 = _yield$mem$get2 = _context7.sent;
1494
- _context7.t0 = _context7.t1 === null;
1495
- if (_context7.t0) {
1496
- _context7.next = 6;
1608
+ _context8.t1 = _yield$mem$get2 = _context8.sent;
1609
+ _context8.t0 = _context8.t1 === null;
1610
+ if (_context8.t0) {
1611
+ _context8.next = 6;
1497
1612
  break;
1498
1613
  }
1499
- _context7.t0 = _yield$mem$get2 === void 0;
1614
+ _context8.t0 = _yield$mem$get2 === void 0;
1500
1615
  case 6:
1501
- if (!_context7.t0) {
1502
- _context7.next = 10;
1616
+ if (!_context8.t0) {
1617
+ _context8.next = 10;
1503
1618
  break;
1504
1619
  }
1505
- _context7.t2 = void 0;
1506
- _context7.next = 11;
1620
+ _context8.t2 = void 0;
1621
+ _context8.next = 11;
1507
1622
  break;
1508
1623
  case 10:
1509
- _context7.t2 = _yield$mem$get2.res;
1624
+ _context8.t2 = _yield$mem$get2.res;
1510
1625
  case 11:
1511
- return _context7.abrupt("return", _context7.t2);
1626
+ return _context8.abrupt("return", _context8.t2);
1512
1627
  case 12:
1513
1628
  case "end":
1514
- return _context7.stop();
1629
+ return _context8.stop();
1515
1630
  }
1516
- }, _callee7);
1631
+ }, _callee8);
1517
1632
  }));
1518
- return function result(_x12) {
1519
- return _ref14.apply(this, arguments);
1633
+ return function result(_x13) {
1634
+ return _ref15.apply(this, arguments);
1520
1635
  };
1521
1636
  }();
1522
1637
  return {
1523
1638
  message: message,
1524
1639
  unmonitor: function () {
1525
- var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(opt) {
1640
+ var _unmonitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(opt) {
1526
1641
  var p;
1527
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1528
- while (1) switch (_context8.prev = _context8.next) {
1642
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1643
+ while (1) switch (_context9.prev = _context9.next) {
1529
1644
  case 0:
1530
- _context8.next = 2;
1645
+ _context9.next = 2;
1531
1646
  return mem.get("env", opt.process);
1532
1647
  case 2:
1533
- p = _context8.sent;
1648
+ p = _context9.sent;
1534
1649
  try {
1535
1650
  clearInterval(p.cron);
1536
1651
  p.cron = null;
1537
1652
  } catch (e) {}
1538
1653
  case 4:
1539
1654
  case "end":
1540
- return _context8.stop();
1655
+ return _context9.stop();
1541
1656
  }
1542
- }, _callee8);
1657
+ }, _callee9);
1543
1658
  }));
1544
- function unmonitor(_x13) {
1659
+ function unmonitor(_x14) {
1545
1660
  return _unmonitor.apply(this, arguments);
1546
1661
  }
1547
1662
  return unmonitor;
1548
1663
  }(),
1549
1664
  monitor: function () {
1550
- var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(opt) {
1665
+ var _monitor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
1551
1666
  var p;
1552
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1553
- while (1) switch (_context10.prev = _context10.next) {
1667
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1668
+ while (1) switch (_context11.prev = _context11.next) {
1554
1669
  case 0:
1555
- _context10.next = 2;
1670
+ _context11.next = 2;
1556
1671
  return mem.get("env", opt.process);
1557
1672
  case 2:
1558
- p = _context10.sent;
1673
+ p = _context11.sent;
1559
1674
  if ((0, _ramda.isNil)(p.cron)) {
1560
- p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1561
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1562
- while (1) switch (_context9.prev = _context9.next) {
1675
+ p.cron = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1676
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1677
+ while (1) switch (_context10.prev = _context10.next) {
1563
1678
  case 0:
1564
- _context9.next = 2;
1679
+ _context10.next = 2;
1565
1680
  return message({
1566
1681
  tags: p.cronTags,
1567
1682
  process: opt.process,
@@ -1570,18 +1685,18 @@ var _default = exports["default"] = function _default() {
1570
1685
  });
1571
1686
  case 2:
1572
1687
  case "end":
1573
- return _context9.stop();
1688
+ return _context10.stop();
1574
1689
  }
1575
- }, _callee9);
1690
+ }, _callee10);
1576
1691
  })), p.span);
1577
1692
  }
1578
1693
  case 4:
1579
1694
  case "end":
1580
- return _context10.stop();
1695
+ return _context11.stop();
1581
1696
  }
1582
- }, _callee10);
1697
+ }, _callee11);
1583
1698
  }));
1584
- function monitor(_x14) {
1699
+ function monitor(_x15) {
1585
1700
  return _monitor.apply(this, arguments);
1586
1701
  }
1587
1702
  return monitor;
@@ -1591,135 +1706,135 @@ var _default = exports["default"] = function _default() {
1591
1706
  ar: ar,
1592
1707
  result: result,
1593
1708
  results: function () {
1594
- var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(opt) {
1595
- var p, results, _ref16, _ref16$from, from, _ref16$to, to, _ref16$sort, sort, _ref16$limit, limit, _res, count, started, _iterator8, _step8, v;
1596
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1597
- while (1) switch (_context11.prev = _context11.next) {
1709
+ var _results = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1710
+ var p, results, _ref17, _ref17$from, from, _ref17$to, to, _ref17$sort, sort, _ref17$limit, limit, _res, count, started, _iterator8, _step8, v;
1711
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1712
+ while (1) switch (_context12.prev = _context12.next) {
1598
1713
  case 0:
1599
- _context11.next = 2;
1714
+ _context12.next = 2;
1600
1715
  return mem.get("env", opt.process);
1601
1716
  case 2:
1602
- p = _context11.sent;
1717
+ p = _context12.sent;
1603
1718
  if (p) {
1604
- _context11.next = 5;
1719
+ _context12.next = 5;
1605
1720
  break;
1606
1721
  }
1607
- return _context11.abrupt("return", {
1722
+ return _context12.abrupt("return", {
1608
1723
  edges: []
1609
1724
  });
1610
1725
  case 5:
1611
1726
  results = (p === null || p === void 0 ? void 0 : p.results) || [];
1612
- _ref16 = opt || {}, _ref16$from = _ref16.from, from = _ref16$from === void 0 ? null : _ref16$from, _ref16$to = _ref16.to, to = _ref16$to === void 0 ? null : _ref16$to, _ref16$sort = _ref16.sort, sort = _ref16$sort === void 0 ? "ASC" : _ref16$sort, _ref16$limit = _ref16.limit, limit = _ref16$limit === void 0 ? 25 : _ref16$limit;
1727
+ _ref17 = opt || {}, _ref17$from = _ref17.from, from = _ref17$from === void 0 ? null : _ref17$from, _ref17$to = _ref17.to, to = _ref17$to === void 0 ? null : _ref17$to, _ref17$sort = _ref17.sort, sort = _ref17$sort === void 0 ? "ASC" : _ref17$sort, _ref17$limit = _ref17.limit, limit = _ref17$limit === void 0 ? 25 : _ref17$limit;
1613
1728
  if (sort === "DESC") results = (0, _ramda.reverse)(results);
1614
1729
  _res = [];
1615
1730
  count = 0;
1616
1731
  started = (0, _ramda.isNil)(from);
1617
1732
  _iterator8 = _createForOfIteratorHelper(results);
1618
- _context11.prev = 12;
1733
+ _context12.prev = 12;
1619
1734
  _iterator8.s();
1620
1735
  case 14:
1621
1736
  if ((_step8 = _iterator8.n()).done) {
1622
- _context11.next = 34;
1737
+ _context12.next = 34;
1623
1738
  break;
1624
1739
  }
1625
1740
  v = _step8.value;
1626
1741
  if (!started) {
1627
- _context11.next = 31;
1742
+ _context12.next = 31;
1628
1743
  break;
1629
1744
  }
1630
- _context11.t0 = _res;
1631
- _context11.t1 = v;
1632
- _context11.next = 21;
1745
+ _context12.t0 = _res;
1746
+ _context12.t1 = v;
1747
+ _context12.next = 21;
1633
1748
  return result({
1634
1749
  message: v
1635
1750
  });
1636
1751
  case 21:
1637
- _context11.t2 = _context11.sent;
1638
- _context11.t3 = {
1639
- cursor: _context11.t1,
1640
- node: _context11.t2
1752
+ _context12.t2 = _context12.sent;
1753
+ _context12.t3 = {
1754
+ cursor: _context12.t1,
1755
+ node: _context12.t2
1641
1756
  };
1642
- _context11.t0.push.call(_context11.t0, _context11.t3);
1757
+ _context12.t0.push.call(_context12.t0, _context12.t3);
1643
1758
  count++;
1644
1759
  if (!(!(0, _ramda.isNil)(to) && v === to)) {
1645
- _context11.next = 27;
1760
+ _context12.next = 27;
1646
1761
  break;
1647
1762
  }
1648
- return _context11.abrupt("break", 34);
1763
+ return _context12.abrupt("break", 34);
1649
1764
  case 27:
1650
1765
  if (!(limit <= count)) {
1651
- _context11.next = 29;
1766
+ _context12.next = 29;
1652
1767
  break;
1653
1768
  }
1654
- return _context11.abrupt("break", 34);
1769
+ return _context12.abrupt("break", 34);
1655
1770
  case 29:
1656
- _context11.next = 32;
1771
+ _context12.next = 32;
1657
1772
  break;
1658
1773
  case 31:
1659
1774
  if (from === v) started = true;
1660
1775
  case 32:
1661
- _context11.next = 14;
1776
+ _context12.next = 14;
1662
1777
  break;
1663
1778
  case 34:
1664
- _context11.next = 39;
1779
+ _context12.next = 39;
1665
1780
  break;
1666
1781
  case 36:
1667
- _context11.prev = 36;
1668
- _context11.t4 = _context11["catch"](12);
1669
- _iterator8.e(_context11.t4);
1782
+ _context12.prev = 36;
1783
+ _context12.t4 = _context12["catch"](12);
1784
+ _iterator8.e(_context12.t4);
1670
1785
  case 39:
1671
- _context11.prev = 39;
1786
+ _context12.prev = 39;
1672
1787
  _iterator8.f();
1673
- return _context11.finish(39);
1788
+ return _context12.finish(39);
1674
1789
  case 42:
1675
- return _context11.abrupt("return", {
1790
+ return _context12.abrupt("return", {
1676
1791
  edges: _res
1677
1792
  });
1678
1793
  case 43:
1679
1794
  case "end":
1680
- return _context11.stop();
1795
+ return _context12.stop();
1681
1796
  }
1682
- }, _callee11, null, [[12, 36, 39, 42]]);
1797
+ }, _callee12, null, [[12, 36, 39, 42]]);
1683
1798
  }));
1684
- function results(_x15) {
1799
+ function results(_x16) {
1685
1800
  return _results.apply(this, arguments);
1686
1801
  }
1687
1802
  return results;
1688
1803
  }(),
1689
1804
  dryrun: function () {
1690
- var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(opt) {
1691
- var _opt$id3, _opt$owner2;
1692
- var p, id, owner, _yield$ar$dataitem4, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm4, format, mod, wasm, wdrive, start, res;
1693
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1694
- while (1) switch (_context12.prev = _context12.next) {
1805
+ var _dryrun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(opt) {
1806
+ var _opt$id3, _opt$owner3;
1807
+ var p, id, owner, _yield$ar$dataitem5, _opt$data3, cloneMemory, msg, _env, _yield$mem$getWasm4, format, mod, wasm, wdrive, start, res;
1808
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1809
+ while (1) switch (_context13.prev = _context13.next) {
1695
1810
  case 0:
1696
- _context12.next = 2;
1811
+ _context13.next = 2;
1697
1812
  return mem.get("env", opt.process);
1698
1813
  case 2:
1699
- p = _context12.sent;
1814
+ p = _context13.sent;
1700
1815
  if (p) {
1701
- _context12.next = 5;
1816
+ _context13.next = 5;
1702
1817
  break;
1703
1818
  }
1704
- return _context12.abrupt("return", null);
1819
+ return _context13.abrupt("return", null);
1705
1820
  case 5:
1706
1821
  id = (_opt$id3 = opt.id) !== null && _opt$id3 !== void 0 ? _opt$id3 : "";
1707
- owner = (_opt$owner2 = opt.owner) !== null && _opt$owner2 !== void 0 ? _opt$owner2 : mu.addr;
1822
+ owner = (_opt$owner3 = opt.owner) !== null && _opt$owner3 !== void 0 ? _opt$owner3 : mu.addr;
1708
1823
  if (!(!opt.id && opt.signer)) {
1709
- _context12.next = 14;
1824
+ _context13.next = 14;
1710
1825
  break;
1711
1826
  }
1712
1827
  ;
1713
- _context12.next = 11;
1828
+ _context13.next = 11;
1714
1829
  return ar.dataitem(_objectSpread(_objectSpread({}, opt), {}, {
1715
1830
  target: opt.process
1716
1831
  }));
1717
1832
  case 11:
1718
- _yield$ar$dataitem4 = _context12.sent;
1719
- id = _yield$ar$dataitem4.id;
1720
- owner = _yield$ar$dataitem4.owner;
1833
+ _yield$ar$dataitem5 = _context13.sent;
1834
+ id = _yield$ar$dataitem5.id;
1835
+ owner = _yield$ar$dataitem5.owner;
1721
1836
  case 14:
1722
- _context12.prev = 14;
1837
+ _context13.prev = 14;
1723
1838
  cloneMemory = function cloneMemory(memory) {
1724
1839
  var buffer = memory.buffer.slice(0);
1725
1840
  return new WebAssembly.Memory({
@@ -1728,52 +1843,52 @@ var _default = exports["default"] = function _default() {
1728
1843
  shared: memory.shared || false
1729
1844
  });
1730
1845
  };
1731
- _context12.next = 18;
1846
+ _context13.next = 18;
1732
1847
  return genMsg(id, p, (_opt$data3 = opt.data) !== null && _opt$data3 !== void 0 ? _opt$data3 : "", opt.tags, owner, owner, true);
1733
1848
  case 18:
1734
- msg = _context12.sent;
1735
- _context12.next = 21;
1849
+ msg = _context13.sent;
1850
+ _context13.next = 21;
1736
1851
  return genEnv({
1737
1852
  pid: p.id,
1738
1853
  owner: p.owner,
1739
1854
  module: p.module
1740
1855
  });
1741
1856
  case 21:
1742
- _env = _context12.sent;
1857
+ _env = _context13.sent;
1743
1858
  if (p.handle) {
1744
- _context12.next = 45;
1859
+ _context13.next = 45;
1745
1860
  break;
1746
1861
  }
1747
- _context12.next = 25;
1862
+ _context13.next = 25;
1748
1863
  return mem.getWasm(p.module);
1749
1864
  case 25:
1750
- _yield$mem$getWasm4 = _context12.sent;
1865
+ _yield$mem$getWasm4 = _context13.sent;
1751
1866
  format = _yield$mem$getWasm4.format;
1752
1867
  mod = _yield$mem$getWasm4.mod;
1753
1868
  wasm = _yield$mem$getWasm4.wasm;
1754
1869
  wdrive = extensions[p.extention];
1755
- _context12.t0 = AoLoader;
1756
- _context12.t1 = wasm;
1757
- _context12.t2 = format;
1758
- _context12.t3 = wdrive;
1759
- _context12.next = 36;
1870
+ _context13.t0 = AoLoader;
1871
+ _context13.t1 = wasm;
1872
+ _context13.t2 = format;
1873
+ _context13.t3 = wdrive;
1874
+ _context13.next = 36;
1760
1875
  return mem.getTx(p.id);
1761
1876
  case 36:
1762
- _context12.t4 = _context12.sent.item;
1763
- _context12.next = 39;
1877
+ _context13.t4 = _context13.sent.item;
1878
+ _context13.next = 39;
1764
1879
  return mem.getTx(mod);
1765
1880
  case 39:
1766
- _context12.t5 = _context12.sent;
1767
- _context12.t6 = {
1768
- format: _context12.t2,
1769
- WeaveDrive: _context12.t3,
1770
- spawn: _context12.t4,
1771
- module: _context12.t5
1881
+ _context13.t5 = _context13.sent;
1882
+ _context13.t6 = {
1883
+ format: _context13.t2,
1884
+ WeaveDrive: _context13.t3,
1885
+ spawn: _context13.t4,
1886
+ module: _context13.t5
1772
1887
  };
1773
- _context12.next = 43;
1774
- return (0, _context12.t0)(_context12.t1, _context12.t6);
1888
+ _context13.next = 43;
1889
+ return (0, _context13.t0)(_context13.t1, _context13.t6);
1775
1890
  case 43:
1776
- p.handle = _context12.sent;
1891
+ p.handle = _context13.sent;
1777
1892
  mem.env[opt.process].handle = p.handle;
1778
1893
  case 45:
1779
1894
  if (p.compressed) {
@@ -1781,25 +1896,25 @@ var _default = exports["default"] = function _default() {
1781
1896
  p.memory = mem.decompress(p.memory, p.original_size);
1782
1897
  p.compressed = false;
1783
1898
  }
1784
- _context12.next = 48;
1899
+ _context13.next = 48;
1785
1900
  return p.handle(p.memory, msg, _env);
1786
1901
  case 48:
1787
- res = _context12.sent;
1902
+ res = _context13.sent;
1788
1903
  delete res.Memory;
1789
- return _context12.abrupt("return", res);
1904
+ return _context13.abrupt("return", res);
1790
1905
  case 53:
1791
- _context12.prev = 53;
1792
- _context12.t7 = _context12["catch"](14);
1793
- console.log(_context12.t7);
1906
+ _context13.prev = 53;
1907
+ _context13.t7 = _context13["catch"](14);
1908
+ console.log(_context13.t7);
1794
1909
  case 56:
1795
- return _context12.abrupt("return", null);
1910
+ return _context13.abrupt("return", null);
1796
1911
  case 57:
1797
1912
  case "end":
1798
- return _context12.stop();
1913
+ return _context13.stop();
1799
1914
  }
1800
- }, _callee12, null, [[14, 53]]);
1915
+ }, _callee13, null, [[14, 53]]);
1801
1916
  }));
1802
- function dryrun(_x16) {
1917
+ function dryrun(_x17) {
1803
1918
  return _dryrun.apply(this, arguments);
1804
1919
  }
1805
1920
  return dryrun;
package/cjs/armem-base.js CHANGED
@@ -283,7 +283,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
283
283
  this.blockmap["0"] = {
284
284
  txs: txs,
285
285
  timestamp: Date.now(),
286
- height: 0,
286
+ height: 1,
287
287
  previous: "",
288
288
  id: "0"
289
289
  };
@@ -367,6 +367,15 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
367
367
  signer: mu.signer,
368
368
  from: opt.process,
369
369
  })
370
+ } else {
371
+ await record({
372
+ for: opt.message,
373
+ tags: v.Tags,
374
+ data: v.Data,
375
+ signer: mu.signer,
376
+ from: opt.process,
377
+ target: v.Target,
378
+ })
370
379
  }
371
380
  }
372
381
  for (const v of res.Spawns ?? []) {
@@ -510,6 +519,35 @@ export default ({ AR, scheduler, mu, su, cu, acc, AoLoader, ArMem } = {}) => {
510
519
  delete ongoing[key]
511
520
  return id
512
521
  }
522
+ const record = async opt => {
523
+ let id = opt?.item?.id ?? ""
524
+ let owner = opt.owner ?? ""
525
+ let item = opt.item
526
+ opt.tags = buildTags(
527
+ null,
528
+ mergeLeft(tags(opt.tags ?? []), {
529
+ "Data-Protocol": "ao",
530
+ Variant: variant ?? "ao.TN.1",
531
+ Type: "Message",
532
+ })
533
+ )
534
+ if (opt.for) {
535
+ opt.tags.push({ name: "Pushed-For", value: opt.for })
536
+ opt.tags.push({ name: "From-Process", value: opt.from })
537
+ const pr = (await mem.getTx(opt.from))?.tags ?? []
538
+ const module = tags(pr).Module
539
+ if (module) opt.tags.push({ name: "From-Module", value: module })
540
+ }
541
+ ;({ item, id, owner } = await ar.dataitem({
542
+ data: opt.data,
543
+ signer: opt.signer,
544
+ tags: tags(opt.tags),
545
+ target: opt.process,
546
+ }))
547
+ const _msg = dissoc("signer", opt)
548
+ await mem.set(_msg, "msgs", id)
549
+ await ar.postItems(item, su.jwk)
550
+ }
513
551
  const recover = async (pid, next) => {
514
552
  let count = 0
515
553
  let success = false
package/esm/armem-base.js CHANGED
@@ -158,7 +158,7 @@ export default class ArMemBase {
158
158
  this.blockmap["0"] = {
159
159
  txs,
160
160
  timestamp: Date.now(),
161
- height: 0,
161
+ height: 1,
162
162
  previous: "",
163
163
  id: "0",
164
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.18.5",
3
+ "version": "0.18.7",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"