wao 0.5.5 → 0.6.0

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/ao.js CHANGED
@@ -407,7 +407,8 @@ var AO = /*#__PURE__*/function () {
407
407
  "Input-Encoding": "JSON-V1",
408
408
  "Output-Encoding": "JSON-V1",
409
409
  "Memory-Limit": "1-gb",
410
- "Compute-Limit": "9000000000000"
410
+ "Compute-Limit": "9000000000000",
411
+ Extension: "WeaveDrive"
411
412
  });
412
413
  fns = [{
413
414
  fn: "post",
@@ -1284,14 +1285,77 @@ var AO = /*#__PURE__*/function () {
1284
1285
  return wait;
1285
1286
  }()
1286
1287
  }, {
1287
- key: "deploy",
1288
+ key: "attest",
1288
1289
  value: function () {
1289
- var _deploy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref23) {
1290
- var boot, loads, src, src_data, _ref23$fills, fills, _ref23$module, module, _ref23$scheduler, scheduler, jwk, _ref23$tags, tags, data, fns, isBoot, i, _iterator9, _step9, v, result;
1290
+ var _attest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref23) {
1291
+ var id, jwk, tags;
1291
1292
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1292
1293
  while (1) switch (_context18.prev = _context18.next) {
1293
1294
  case 0:
1294
- boot = _ref23.boot, loads = _ref23.loads, src = _ref23.src, src_data = _ref23.src_data, _ref23$fills = _ref23.fills, fills = _ref23$fills === void 0 ? {} : _ref23$fills, _ref23$module = _ref23.module, module = _ref23$module === void 0 ? this.module : _ref23$module, _ref23$scheduler = _ref23.scheduler, scheduler = _ref23$scheduler === void 0 ? this.scheduler : _ref23$scheduler, jwk = _ref23.jwk, _ref23$tags = _ref23.tags, tags = _ref23$tags === void 0 ? {} : _ref23$tags, data = _ref23.data;
1295
+ id = _ref23.id, jwk = _ref23.jwk, tags = _ref23.tags;
1296
+ _context18.next = 3;
1297
+ return this.ar.post({
1298
+ tags: (0, _ramda.mergeLeft)(tags, {
1299
+ "Data-Protocol": "ao",
1300
+ Type: "Attestation",
1301
+ Message: id
1302
+ }),
1303
+ jwk: jwk
1304
+ });
1305
+ case 3:
1306
+ return _context18.abrupt("return", _context18.sent);
1307
+ case 4:
1308
+ case "end":
1309
+ return _context18.stop();
1310
+ }
1311
+ }, _callee18, this);
1312
+ }));
1313
+ function attest(_x16) {
1314
+ return _attest.apply(this, arguments);
1315
+ }
1316
+ return attest;
1317
+ }()
1318
+ }, {
1319
+ key: "avail",
1320
+ value: function () {
1321
+ var _avail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref24) {
1322
+ var ids, jwk, tags;
1323
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1324
+ while (1) switch (_context19.prev = _context19.next) {
1325
+ case 0:
1326
+ ids = _ref24.ids, jwk = _ref24.jwk, tags = _ref24.tags;
1327
+ _context19.next = 3;
1328
+ return this.ar.post({
1329
+ tags: (0, _ramda.mergeLeft)(tags, {
1330
+ "Data-Protocol": "WeaveDrive",
1331
+ Variant: "WeaveDrive.tn.1",
1332
+ Type: "Available",
1333
+ ID: ids
1334
+ }),
1335
+ jwk: jwk
1336
+ });
1337
+ case 3:
1338
+ return _context19.abrupt("return", _context19.sent);
1339
+ case 4:
1340
+ case "end":
1341
+ return _context19.stop();
1342
+ }
1343
+ }, _callee19, this);
1344
+ }));
1345
+ function avail(_x17) {
1346
+ return _avail.apply(this, arguments);
1347
+ }
1348
+ return avail;
1349
+ }()
1350
+ }, {
1351
+ key: "deploy",
1352
+ value: function () {
1353
+ var _deploy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref25) {
1354
+ var boot, loads, src, src_data, _ref25$fills, fills, _ref25$module, module, _ref25$scheduler, scheduler, jwk, _ref25$tags, tags, data, fns, isBoot, i, _iterator9, _step9, v, args, result;
1355
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1356
+ while (1) switch (_context20.prev = _context20.next) {
1357
+ case 0:
1358
+ boot = _ref25.boot, loads = _ref25.loads, src = _ref25.src, src_data = _ref25.src_data, _ref25$fills = _ref25.fills, fills = _ref25$fills === void 0 ? {} : _ref25$fills, _ref25$module = _ref25.module, module = _ref25$module === void 0 ? this.module : _ref25$module, _ref25$scheduler = _ref25.scheduler, scheduler = _ref25$scheduler === void 0 ? this.scheduler : _ref25$scheduler, jwk = _ref25.jwk, _ref25$tags = _ref25.tags, tags = _ref25$tags === void 0 ? {} : _ref25$tags, data = _ref25.data;
1295
1359
  fns = [], isBoot = false;
1296
1360
  if (boot === true && !data) {
1297
1361
  isBoot = true;
@@ -1348,9 +1412,13 @@ var AO = /*#__PURE__*/function () {
1348
1412
  for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1349
1413
  v = _step9.value;
1350
1414
  if (!isBoot || i !== 0) {
1415
+ args = v;
1416
+ if (typeof args === "string") args = {
1417
+ data: v
1418
+ };
1351
1419
  fns.push({
1352
1420
  fn: this.load,
1353
- args: v,
1421
+ args: args,
1354
1422
  then: {
1355
1423
  "args.pid": "pid"
1356
1424
  }
@@ -1363,22 +1431,22 @@ var AO = /*#__PURE__*/function () {
1363
1431
  } finally {
1364
1432
  _iterator9.f();
1365
1433
  }
1366
- _context18.next = 9;
1434
+ _context20.next = 9;
1367
1435
  return this.pipe({
1368
1436
  jwk: jwk,
1369
1437
  fns: fns
1370
1438
  });
1371
1439
  case 9:
1372
- result = _context18.sent;
1440
+ result = _context20.sent;
1373
1441
  if (result.pid) result.p = this.p(result.pid);
1374
- return _context18.abrupt("return", result);
1442
+ return _context20.abrupt("return", result);
1375
1443
  case 12:
1376
1444
  case "end":
1377
- return _context18.stop();
1445
+ return _context20.stop();
1378
1446
  }
1379
- }, _callee18, this);
1447
+ }, _callee20, this);
1380
1448
  }));
1381
- function deploy(_x16) {
1449
+ function deploy(_x18) {
1382
1450
  return _deploy.apply(this, arguments);
1383
1451
  }
1384
1452
  return deploy;
@@ -1414,29 +1482,56 @@ var Process = /*#__PURE__*/function () {
1414
1482
  this.pid = pid;
1415
1483
  }
1416
1484
  return _createClass(Process, [{
1485
+ key: "load",
1486
+ value: function () {
1487
+ var _load2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1488
+ var opt,
1489
+ _args21 = arguments;
1490
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1491
+ while (1) switch (_context21.prev = _context21.next) {
1492
+ case 0:
1493
+ opt = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
1494
+ _context21.next = 3;
1495
+ return this.ao.load(_objectSpread({
1496
+ pid: this.pid
1497
+ }, opt));
1498
+ case 3:
1499
+ return _context21.abrupt("return", _context21.sent);
1500
+ case 4:
1501
+ case "end":
1502
+ return _context21.stop();
1503
+ }
1504
+ }, _callee21, this);
1505
+ }));
1506
+ function load() {
1507
+ return _load2.apply(this, arguments);
1508
+ }
1509
+ return load;
1510
+ }()
1511
+ }, {
1417
1512
  key: "msg",
1418
1513
  value: function () {
1419
- var _msg2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(act, tags, opts) {
1514
+ var _msg2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(act, tags, opts) {
1420
1515
  var _getParams, _tags, _opts;
1421
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1422
- while (1) switch (_context19.prev = _context19.next) {
1516
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1517
+ while (1) switch (_context22.prev = _context22.next) {
1423
1518
  case 0:
1424
1519
  _getParams = getParams(tags, opts), _tags = _getParams._tags, _opts = _getParams._opts;
1425
- _context19.next = 3;
1520
+ _context22.next = 3;
1426
1521
  return this.ao.msg(_objectSpread({
1427
1522
  pid: this.pid,
1428
1523
  act: act,
1429
1524
  tags: _tags
1430
1525
  }, _opts));
1431
1526
  case 3:
1432
- return _context19.abrupt("return", _context19.sent);
1527
+ return _context22.abrupt("return", _context22.sent);
1433
1528
  case 4:
1434
1529
  case "end":
1435
- return _context19.stop();
1530
+ return _context22.stop();
1436
1531
  }
1437
- }, _callee19, this);
1532
+ }, _callee22, this);
1438
1533
  }));
1439
- function msg(_x17, _x18, _x19) {
1534
+ function msg(_x19, _x20, _x21) {
1440
1535
  return _msg2.apply(this, arguments);
1441
1536
  }
1442
1537
  return msg;
@@ -1444,27 +1539,27 @@ var Process = /*#__PURE__*/function () {
1444
1539
  }, {
1445
1540
  key: "dry",
1446
1541
  value: function () {
1447
- var _dry2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(act, tags, opts) {
1542
+ var _dry2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(act, tags, opts) {
1448
1543
  var _getParams2, _tags, _opts;
1449
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1450
- while (1) switch (_context20.prev = _context20.next) {
1544
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1545
+ while (1) switch (_context23.prev = _context23.next) {
1451
1546
  case 0:
1452
1547
  _getParams2 = getParams(tags, opts), _tags = _getParams2._tags, _opts = _getParams2._opts;
1453
- _context20.next = 3;
1548
+ _context23.next = 3;
1454
1549
  return this.ao.dry(_objectSpread({
1455
1550
  pid: this.pid,
1456
1551
  act: act,
1457
1552
  tags: _tags
1458
1553
  }, _opts));
1459
1554
  case 3:
1460
- return _context20.abrupt("return", _context20.sent);
1555
+ return _context23.abrupt("return", _context23.sent);
1461
1556
  case 4:
1462
1557
  case "end":
1463
- return _context20.stop();
1558
+ return _context23.stop();
1464
1559
  }
1465
- }, _callee20, this);
1560
+ }, _callee23, this);
1466
1561
  }));
1467
- function dry(_x20, _x21, _x22) {
1562
+ function dry(_x22, _x23, _x24) {
1468
1563
  return _dry2.apply(this, arguments);
1469
1564
  }
1470
1565
  return dry;
@@ -1472,28 +1567,28 @@ var Process = /*#__PURE__*/function () {
1472
1567
  }, {
1473
1568
  key: "m",
1474
1569
  value: function () {
1475
- var _m = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1570
+ var _m = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1476
1571
  var res,
1477
- _args21 = arguments;
1478
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1479
- while (1) switch (_context21.prev = _context21.next) {
1572
+ _args24 = arguments;
1573
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1574
+ while (1) switch (_context24.prev = _context24.next) {
1480
1575
  case 0:
1481
- _context21.next = 2;
1482
- return this.msg.apply(this, _args21);
1576
+ _context24.next = 2;
1577
+ return this.msg.apply(this, _args24);
1483
1578
  case 2:
1484
- res = _context21.sent;
1579
+ res = _context24.sent;
1485
1580
  if (!res.err) {
1486
- _context21.next = 5;
1581
+ _context24.next = 5;
1487
1582
  break;
1488
1583
  }
1489
1584
  throw Error(res.err);
1490
1585
  case 5:
1491
- return _context21.abrupt("return", res.out);
1586
+ return _context24.abrupt("return", res.out);
1492
1587
  case 6:
1493
1588
  case "end":
1494
- return _context21.stop();
1589
+ return _context24.stop();
1495
1590
  }
1496
- }, _callee21, this);
1591
+ }, _callee24, this);
1497
1592
  }));
1498
1593
  function m() {
1499
1594
  return _m.apply(this, arguments);
@@ -1503,28 +1598,28 @@ var Process = /*#__PURE__*/function () {
1503
1598
  }, {
1504
1599
  key: "d",
1505
1600
  value: function () {
1506
- var _d = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1601
+ var _d = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1507
1602
  var res,
1508
- _args22 = arguments;
1509
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1510
- while (1) switch (_context22.prev = _context22.next) {
1603
+ _args25 = arguments;
1604
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1605
+ while (1) switch (_context25.prev = _context25.next) {
1511
1606
  case 0:
1512
- _context22.next = 2;
1513
- return this.dry.apply(this, _args22);
1607
+ _context25.next = 2;
1608
+ return this.dry.apply(this, _args25);
1514
1609
  case 2:
1515
- res = _context22.sent;
1610
+ res = _context25.sent;
1516
1611
  if (!res.err) {
1517
- _context22.next = 5;
1612
+ _context25.next = 5;
1518
1613
  break;
1519
1614
  }
1520
1615
  throw Error(res.err);
1521
1616
  case 5:
1522
- return _context22.abrupt("return", res.out);
1617
+ return _context25.abrupt("return", res.out);
1523
1618
  case 6:
1524
1619
  case "end":
1525
- return _context22.stop();
1620
+ return _context25.stop();
1526
1621
  }
1527
- }, _callee22, this);
1622
+ }, _callee25, this);
1528
1623
  }));
1529
1624
  function d() {
1530
1625
  return _d.apply(this, arguments);