@eluvio/elv-client-js 4.2.12 → 4.2.14

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.
@@ -1262,7 +1262,7 @@ exports.SetTenantId = /*#__PURE__*/function () {
1262
1262
  */
1263
1263
  exports.SetTenantContractId = /*#__PURE__*/function () {
1264
1264
  var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref45) {
1265
- var contractAddress, objectId, versionHash, tenantContractId, objectVersion, tenantAddress, version, tenantAdminGroupAddress, hasPutMetaMethod, libraryId, editRequest;
1265
+ var contractAddress, objectId, versionHash, tenantContractId, objectVersion, version, tenantAdminGroupAddress, hasPutMetaMethod, libraryId, editRequest;
1266
1266
  return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1267
1267
  while (1) switch (_context22.prev = _context22.next) {
1268
1268
  case 0:
@@ -1294,78 +1294,74 @@ exports.SetTenantContractId = /*#__PURE__*/function () {
1294
1294
  }
1295
1295
  throw Error("Invalid tenant ID: ".concat(tenantContractId));
1296
1296
  case 14:
1297
- tenantAddress = Utils.HashToAddress(tenantContractId);
1298
- _context22.next = 17;
1297
+ _context22.next = 16;
1299
1298
  return this.authClient.AccessType(tenantContractId);
1300
- case 17:
1299
+ case 16:
1301
1300
  version = _context22.sent;
1302
1301
  if (!(version !== this.authClient.ACCESS_TYPES.TENANT)) {
1303
- _context22.next = 20;
1302
+ _context22.next = 19;
1304
1303
  break;
1305
1304
  }
1306
1305
  throw Error("Invalid tenant ID: " + tenantContractId);
1307
- case 20:
1308
- _context22.next = 22;
1309
- return this.CallContractMethod({
1310
- contractAddress: tenantAddress,
1311
- methodName: "groupsMapping",
1312
- methodArgs: ["tenant_admin", 0],
1313
- formatArguments: true
1306
+ case 19:
1307
+ _context22.next = 21;
1308
+ return this.TenantAdminGroup({
1309
+ tenantContractId: tenantContractId
1314
1310
  });
1315
- case 22:
1311
+ case 21:
1316
1312
  tenantAdminGroupAddress = _context22.sent;
1317
- _context22.next = 25;
1313
+ _context22.next = 24;
1318
1314
  return this.authClient.ContractHasMethod({
1319
1315
  contractAddress: contractAddress,
1320
1316
  methodName: "putMeta"
1321
1317
  });
1322
- case 25:
1318
+ case 24:
1323
1319
  hasPutMetaMethod = _context22.sent;
1324
1320
  if (!hasPutMetaMethod) {
1325
- _context22.next = 37;
1321
+ _context22.next = 36;
1326
1322
  break;
1327
1323
  }
1328
- _context22.next = 29;
1324
+ _context22.next = 28;
1329
1325
  return this.ReplaceContractMetadata({
1330
1326
  contractAddress: contractAddress,
1331
1327
  metadataKey: "_ELV_TENANT_ID",
1332
1328
  metadata: tenantContractId
1333
1329
  });
1334
- case 29:
1330
+ case 28:
1335
1331
  if (!tenantAdminGroupAddress) {
1336
- _context22.next = 34;
1332
+ _context22.next = 33;
1337
1333
  break;
1338
1334
  }
1339
- _context22.next = 32;
1335
+ _context22.next = 31;
1340
1336
  return this.ReplaceContractMetadata({
1341
1337
  contractAddress: contractAddress,
1342
1338
  metadataKey: "_tenantId",
1343
1339
  metadata: "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1344
1340
  });
1345
- case 32:
1346
- _context22.next = 35;
1341
+ case 31:
1342
+ _context22.next = 34;
1347
1343
  break;
1348
- case 34:
1344
+ case 33:
1349
1345
  // eslint-disable-next-line no-console
1350
1346
  console.warn("No tenant ID associated with current tenant.");
1351
- case 35:
1352
- _context22.next = 47;
1347
+ case 34:
1348
+ _context22.next = 46;
1353
1349
  break;
1354
- case 37:
1355
- _context22.next = 39;
1350
+ case 36:
1351
+ _context22.next = 38;
1356
1352
  return this.ContentObjectLibraryId({
1357
1353
  objectId: objectId
1358
1354
  });
1359
- case 39:
1355
+ case 38:
1360
1356
  libraryId = _context22.sent;
1361
- _context22.next = 42;
1357
+ _context22.next = 41;
1362
1358
  return this.EditContentObject({
1363
1359
  libraryId: libraryId,
1364
1360
  objectId: objectId
1365
1361
  });
1366
- case 42:
1362
+ case 41:
1367
1363
  editRequest = _context22.sent;
1368
- _context22.next = 45;
1364
+ _context22.next = 44;
1369
1365
  return this.MergeMetadata({
1370
1366
  libraryId: libraryId,
1371
1367
  objectId: objectId,
@@ -1375,20 +1371,20 @@ exports.SetTenantContractId = /*#__PURE__*/function () {
1375
1371
  tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1376
1372
  }
1377
1373
  });
1378
- case 45:
1379
- _context22.next = 47;
1374
+ case 44:
1375
+ _context22.next = 46;
1380
1376
  return this.FinalizeContentObject({
1381
1377
  libraryId: libraryId,
1382
1378
  objectId: objectId,
1383
1379
  writeToken: editRequest.write_token,
1384
1380
  commitMessage: "set tenant_contract_id"
1385
1381
  });
1386
- case 47:
1382
+ case 46:
1387
1383
  return _context22.abrupt("return", {
1388
1384
  tenantContractId: tenantContractId,
1389
1385
  tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1390
1386
  });
1391
- case 48:
1387
+ case 47:
1392
1388
  case "end":
1393
1389
  return _context22.stop();
1394
1390
  }
@@ -1522,6 +1518,161 @@ exports.ResetTenantId = /*#__PURE__*/function () {
1522
1518
  return _ref48.apply(this, arguments);
1523
1519
  };
1524
1520
  }();
1521
+ function GetTenantGroupAddress(_x22) {
1522
+ return _GetTenantGroupAddress.apply(this, arguments);
1523
+ }
1524
+ /**
1525
+ * Returns the tenant_admin group address for a given tenant contract.
1526
+ *
1527
+ * @methodGroup Tenant
1528
+ * @namedParams
1529
+ * @param {string=} tenantContractId - The ID of the tenant contract
1530
+ * @returns {Promise<*|undefined>}
1531
+ */
1532
+ function _GetTenantGroupAddress() {
1533
+ _GetTenantGroupAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref49) {
1534
+ var ctx, tenantContractId, groupName, tenantAddress, version, groupAddress;
1535
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
1536
+ while (1) switch (_context33.prev = _context33.next) {
1537
+ case 0:
1538
+ ctx = _ref49.ctx, tenantContractId = _ref49.tenantContractId, groupName = _ref49.groupName;
1539
+ if (tenantContractId) {
1540
+ _context33.next = 3;
1541
+ break;
1542
+ }
1543
+ throw new Error("tenantContractId is required");
1544
+ case 3:
1545
+ if (tenantContractId.startsWith("iten")) {
1546
+ _context33.next = 5;
1547
+ break;
1548
+ }
1549
+ throw new Error("Invalid Tenant Contract ID format: ".concat(tenantContractId));
1550
+ case 5:
1551
+ tenantAddress = Utils.HashToAddress(tenantContractId); // Needs to be tenant type
1552
+ _context33.next = 8;
1553
+ return ctx.authClient.AccessType(tenantContractId);
1554
+ case 8:
1555
+ version = _context33.sent;
1556
+ if (!(version !== ctx.authClient.ACCESS_TYPES.TENANT)) {
1557
+ _context33.next = 11;
1558
+ break;
1559
+ }
1560
+ throw new Error("Contract ".concat(tenantContractId, " is not a Tenant. Actual version: ").concat(version));
1561
+ case 11:
1562
+ _context33.prev = 11;
1563
+ _context33.next = 14;
1564
+ return ctx.CallContractMethod({
1565
+ contractAddress: tenantAddress,
1566
+ methodName: "groupsMapping",
1567
+ methodArgs: [groupName, 0],
1568
+ formatArguments: true
1569
+ });
1570
+ case 14:
1571
+ groupAddress = _context33.sent;
1572
+ if (groupAddress) {
1573
+ _context33.next = 17;
1574
+ break;
1575
+ }
1576
+ throw new Error("".concat(groupName, " group address not set."));
1577
+ case 17:
1578
+ return _context33.abrupt("return", groupAddress);
1579
+ case 20:
1580
+ _context33.prev = 20;
1581
+ _context33.t0 = _context33["catch"](11);
1582
+ this.Log(_context33.t0);
1583
+ throw new Error("Failed to retrieve ".concat(groupName, " group address."));
1584
+ case 24:
1585
+ case "end":
1586
+ return _context33.stop();
1587
+ }
1588
+ }, _callee33, this, [[11, 20]]);
1589
+ }));
1590
+ return _GetTenantGroupAddress.apply(this, arguments);
1591
+ }
1592
+ exports.TenantAdminGroup = /*#__PURE__*/function () {
1593
+ var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref50) {
1594
+ var tenantContractId;
1595
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1596
+ while (1) switch (_context24.prev = _context24.next) {
1597
+ case 0:
1598
+ tenantContractId = _ref50.tenantContractId;
1599
+ return _context24.abrupt("return", GetTenantGroupAddress({
1600
+ ctx: this,
1601
+ tenantContractId: tenantContractId,
1602
+ groupName: "tenant_admin"
1603
+ }));
1604
+ case 2:
1605
+ case "end":
1606
+ return _context24.stop();
1607
+ }
1608
+ }, _callee24, this);
1609
+ }));
1610
+ return function (_x23) {
1611
+ return _ref51.apply(this, arguments);
1612
+ };
1613
+ }();
1614
+
1615
+ /**
1616
+ * Returns the content_admin group address for a given tenant contract.
1617
+ *
1618
+ * @methodGroup Tenant
1619
+ * @namedParams
1620
+ * @param {string=} tenantContractId - The ID of the tenant contract
1621
+ * @returns {Promise<*|undefined>}
1622
+ */
1623
+ exports.ContentAdminGroup = /*#__PURE__*/function () {
1624
+ var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref52) {
1625
+ var tenantContractId;
1626
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1627
+ while (1) switch (_context25.prev = _context25.next) {
1628
+ case 0:
1629
+ tenantContractId = _ref52.tenantContractId;
1630
+ return _context25.abrupt("return", GetTenantGroupAddress({
1631
+ ctx: this,
1632
+ tenantContractId: tenantContractId,
1633
+ groupName: "content_admin"
1634
+ }));
1635
+ case 2:
1636
+ case "end":
1637
+ return _context25.stop();
1638
+ }
1639
+ }, _callee25, this);
1640
+ }));
1641
+ return function (_x24) {
1642
+ return _ref53.apply(this, arguments);
1643
+ };
1644
+ }();
1645
+
1646
+ /**
1647
+ * Returns the tenant_users group address for a given tenant contract.
1648
+ *
1649
+ * @methodGroup Tenant
1650
+ * @namedParams
1651
+ * @param {string=} tenantContractId - The ID of the tenant contract
1652
+ * @returns {Promise<*|undefined>}
1653
+ */
1654
+ exports.TenantUsersGroup = /*#__PURE__*/function () {
1655
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref54) {
1656
+ var tenantContractId;
1657
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1658
+ while (1) switch (_context26.prev = _context26.next) {
1659
+ case 0:
1660
+ tenantContractId = _ref54.tenantContractId;
1661
+ return _context26.abrupt("return", GetTenantGroupAddress({
1662
+ ctx: this,
1663
+ tenantContractId: tenantContractId,
1664
+ groupName: "tenant_users"
1665
+ }));
1666
+ case 2:
1667
+ case "end":
1668
+ return _context26.stop();
1669
+ }
1670
+ }, _callee26, this);
1671
+ }));
1672
+ return function (_x25) {
1673
+ return _ref55.apply(this, arguments);
1674
+ };
1675
+ }();
1525
1676
 
1526
1677
  /**
1527
1678
  * Enum for object types that can be cleaned up after object deletion.
@@ -1596,288 +1747,288 @@ var ObjectTypesToClean = Object.freeze({
1596
1747
  * }
1597
1748
  */
1598
1749
  exports.ObjectCleanup = /*#__PURE__*/function () {
1599
- var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref49) {
1750
+ var _ref57 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(_ref56) {
1600
1751
  var _this = this;
1601
- var contractAddress, objectId, versionHash, _ref49$objectTypeToCl, objectTypeToClean, isUserWallet, userAddress, allowedTypes, cleanupTasks, runCleanupTasks, results, res, groupsLength, groupAddressPromises, i, groupAddresses, cleanupResults, _iterator, _step, _step$value, addr, _res2;
1602
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
1603
- while (1) switch (_context29.prev = _context29.next) {
1752
+ var contractAddress, objectId, versionHash, _ref56$objectTypeToCl, objectTypeToClean, isUserWallet, userAddress, allowedTypes, cleanupTasks, runCleanupTasks, results, res, groupsLength, groupAddressPromises, i, groupAddresses, cleanupResults, _iterator, _step, _step$value, addr, _res2;
1753
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
1754
+ while (1) switch (_context32.prev = _context32.next) {
1604
1755
  case 0:
1605
- contractAddress = _ref49.contractAddress, objectId = _ref49.objectId, versionHash = _ref49.versionHash, _ref49$objectTypeToCl = _ref49.objectTypeToClean, objectTypeToClean = _ref49$objectTypeToCl === void 0 ? ObjectTypesToClean.ALL : _ref49$objectTypeToCl;
1606
- _context29.next = 3;
1756
+ contractAddress = _ref56.contractAddress, objectId = _ref56.objectId, versionHash = _ref56.versionHash, _ref56$objectTypeToCl = _ref56.objectTypeToClean, objectTypeToClean = _ref56$objectTypeToCl === void 0 ? ObjectTypesToClean.ALL : _ref56$objectTypeToCl;
1757
+ _context32.next = 3;
1607
1758
  return GetObjectIDAndContractAddress({
1608
1759
  contractAddress: contractAddress,
1609
1760
  objectId: objectId,
1610
1761
  versionHash: versionHash
1611
1762
  });
1612
1763
  case 3:
1613
- objectInfo = _context29.sent;
1764
+ objectInfo = _context32.sent;
1614
1765
  contractAddress = objectInfo.contractAddress;
1615
1766
  isUserWallet = false;
1616
- _context29.prev = 6;
1617
- _context29.next = 9;
1767
+ _context32.prev = 6;
1768
+ _context32.next = 9;
1618
1769
  return this.CallContractMethod({
1619
1770
  contractAddress: contractAddress,
1620
1771
  methodName: "getLibrariesLength",
1621
1772
  formatArguments: false
1622
1773
  });
1623
1774
  case 9:
1624
- _context29.next = 24;
1775
+ _context32.next = 24;
1625
1776
  break;
1626
1777
  case 11:
1627
- _context29.prev = 11;
1628
- _context29.t0 = _context29["catch"](6);
1629
- _context29.prev = 13;
1778
+ _context32.prev = 11;
1779
+ _context32.t0 = _context32["catch"](6);
1780
+ _context32.prev = 13;
1630
1781
  userAddress = contractAddress;
1631
- _context29.next = 17;
1782
+ _context32.next = 17;
1632
1783
  return this.userProfileClient.UserWalletAddress({
1633
1784
  address: contractAddress
1634
1785
  });
1635
1786
  case 17:
1636
- contractAddress = _context29.sent;
1787
+ contractAddress = _context32.sent;
1637
1788
  isUserWallet = true;
1638
- _context29.next = 24;
1789
+ _context32.next = 24;
1639
1790
  break;
1640
1791
  case 21:
1641
- _context29.prev = 21;
1642
- _context29.t1 = _context29["catch"](13);
1643
- throw new Error("Invalid object: ".concat(_context29.t1.message));
1792
+ _context32.prev = 21;
1793
+ _context32.t1 = _context32["catch"](13);
1794
+ throw new Error("Invalid object: ".concat(_context32.t1.message));
1644
1795
  case 24:
1645
1796
  allowedTypes = Object.values(ObjectTypesToClean);
1646
1797
  if (allowedTypes.includes(objectTypeToClean)) {
1647
- _context29.next = 27;
1798
+ _context32.next = 27;
1648
1799
  break;
1649
1800
  }
1650
1801
  throw Error("Invalid objectType '".concat(objectTypeToClean, "'. Allowed types: ").concat(allowedTypes.join(", ")));
1651
1802
  case 27:
1652
1803
  cleanupTasks = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ObjectTypesToClean.LIBRARY, function () {
1653
- var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref51) {
1804
+ var _ref59 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref58) {
1654
1805
  var contractAddress, res, before, after;
1655
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1656
- while (1) switch (_context24.prev = _context24.next) {
1806
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1807
+ while (1) switch (_context27.prev = _context27.next) {
1657
1808
  case 0:
1658
- contractAddress = _ref51.contractAddress, res = _ref51.res;
1659
- _context24.next = 3;
1809
+ contractAddress = _ref58.contractAddress, res = _ref58.res;
1810
+ _context27.next = 3;
1660
1811
  return _this.CallContractMethod({
1661
1812
  contractAddress: contractAddress,
1662
1813
  methodName: "getLibrariesLength",
1663
1814
  formatArguments: false
1664
1815
  });
1665
1816
  case 3:
1666
- before = _context24.sent;
1817
+ before = _context27.sent;
1667
1818
  res.beforeCleanup.librariesLength = before.toNumber();
1668
- _context24.next = 7;
1819
+ _context27.next = 7;
1669
1820
  return _this.CallContractMethodAndWait({
1670
1821
  contractAddress: contractAddress,
1671
1822
  methodName: "cleanUpLibraries",
1672
1823
  formatArguments: true
1673
1824
  });
1674
1825
  case 7:
1675
- _context24.next = 9;
1826
+ _context27.next = 9;
1676
1827
  return _this.CallContractMethod({
1677
1828
  contractAddress: contractAddress,
1678
1829
  methodName: "getLibrariesLength",
1679
1830
  formatArguments: false
1680
1831
  });
1681
1832
  case 9:
1682
- after = _context24.sent;
1833
+ after = _context27.sent;
1683
1834
  res.afterCleanup.librariesLength = after.toNumber();
1684
1835
  case 11:
1685
1836
  case "end":
1686
- return _context24.stop();
1837
+ return _context27.stop();
1687
1838
  }
1688
- }, _callee24);
1839
+ }, _callee27);
1689
1840
  }));
1690
- return function (_x23) {
1691
- return _ref52.apply(this, arguments);
1841
+ return function (_x27) {
1842
+ return _ref59.apply(this, arguments);
1692
1843
  };
1693
1844
  }()), ObjectTypesToClean.CONTENT_OBJECT, function () {
1694
- var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref53) {
1845
+ var _ref61 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref60) {
1695
1846
  var contractAddress, res, before, after;
1696
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1697
- while (1) switch (_context25.prev = _context25.next) {
1847
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
1848
+ while (1) switch (_context28.prev = _context28.next) {
1698
1849
  case 0:
1699
- contractAddress = _ref53.contractAddress, res = _ref53.res;
1700
- _context25.next = 3;
1850
+ contractAddress = _ref60.contractAddress, res = _ref60.res;
1851
+ _context28.next = 3;
1701
1852
  return _this.CallContractMethod({
1702
1853
  contractAddress: contractAddress,
1703
1854
  methodName: "getContentObjectsLength",
1704
1855
  formatArguments: false
1705
1856
  });
1706
1857
  case 3:
1707
- before = _context25.sent;
1858
+ before = _context28.sent;
1708
1859
  res.beforeCleanup.contentObjectsLength = before.toNumber();
1709
- _context25.next = 7;
1860
+ _context28.next = 7;
1710
1861
  return _this.CallContractMethodAndWait({
1711
1862
  contractAddress: contractAddress,
1712
1863
  methodName: "cleanUpContentObjects",
1713
1864
  formatArguments: true
1714
1865
  });
1715
1866
  case 7:
1716
- _context25.next = 9;
1867
+ _context28.next = 9;
1717
1868
  return _this.CallContractMethod({
1718
1869
  contractAddress: contractAddress,
1719
1870
  methodName: "getContentObjectsLength",
1720
1871
  formatArguments: false
1721
1872
  });
1722
1873
  case 9:
1723
- after = _context25.sent;
1874
+ after = _context28.sent;
1724
1875
  res.afterCleanup.contentObjectsLength = after.toNumber();
1725
1876
  case 11:
1726
1877
  case "end":
1727
- return _context25.stop();
1878
+ return _context28.stop();
1728
1879
  }
1729
- }, _callee25);
1880
+ }, _callee28);
1730
1881
  }));
1731
- return function (_x24) {
1732
- return _ref54.apply(this, arguments);
1882
+ return function (_x28) {
1883
+ return _ref61.apply(this, arguments);
1733
1884
  };
1734
1885
  }()), ObjectTypesToClean.GROUP, function () {
1735
- var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref55) {
1886
+ var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref62) {
1736
1887
  var contractAddress, res, before, after;
1737
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1738
- while (1) switch (_context26.prev = _context26.next) {
1888
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
1889
+ while (1) switch (_context29.prev = _context29.next) {
1739
1890
  case 0:
1740
- contractAddress = _ref55.contractAddress, res = _ref55.res;
1741
- _context26.next = 3;
1891
+ contractAddress = _ref62.contractAddress, res = _ref62.res;
1892
+ _context29.next = 3;
1742
1893
  return _this.CallContractMethod({
1743
1894
  contractAddress: contractAddress,
1744
1895
  methodName: "getAccessGroupsLength",
1745
1896
  formatArguments: false
1746
1897
  });
1747
1898
  case 3:
1748
- before = _context26.sent;
1899
+ before = _context29.sent;
1749
1900
  res.beforeCleanup.accessGroupsLength = before.toNumber();
1750
- _context26.next = 7;
1901
+ _context29.next = 7;
1751
1902
  return _this.CallContractMethodAndWait({
1752
1903
  contractAddress: contractAddress,
1753
1904
  methodName: "cleanUpAccessGroups",
1754
1905
  formatArguments: true
1755
1906
  });
1756
1907
  case 7:
1757
- _context26.next = 9;
1908
+ _context29.next = 9;
1758
1909
  return _this.CallContractMethod({
1759
1910
  contractAddress: contractAddress,
1760
1911
  methodName: "getAccessGroupsLength",
1761
1912
  formatArguments: false
1762
1913
  });
1763
1914
  case 9:
1764
- after = _context26.sent;
1915
+ after = _context29.sent;
1765
1916
  res.afterCleanup.accessGroupsLength = after.toNumber();
1766
1917
  case 11:
1767
1918
  case "end":
1768
- return _context26.stop();
1919
+ return _context29.stop();
1769
1920
  }
1770
- }, _callee26);
1921
+ }, _callee29);
1771
1922
  }));
1772
- return function (_x25) {
1773
- return _ref56.apply(this, arguments);
1923
+ return function (_x29) {
1924
+ return _ref63.apply(this, arguments);
1774
1925
  };
1775
1926
  }()), ObjectTypesToClean.CONTENT_TYPE, function () {
1776
- var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref57) {
1927
+ var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref64) {
1777
1928
  var contractAddress, res, before, after;
1778
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1779
- while (1) switch (_context27.prev = _context27.next) {
1929
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
1930
+ while (1) switch (_context30.prev = _context30.next) {
1780
1931
  case 0:
1781
- contractAddress = _ref57.contractAddress, res = _ref57.res;
1782
- _context27.next = 3;
1932
+ contractAddress = _ref64.contractAddress, res = _ref64.res;
1933
+ _context30.next = 3;
1783
1934
  return _this.CallContractMethod({
1784
1935
  contractAddress: contractAddress,
1785
1936
  methodName: "getContentTypesLength",
1786
1937
  formatArguments: false
1787
1938
  });
1788
1939
  case 3:
1789
- before = _context27.sent;
1940
+ before = _context30.sent;
1790
1941
  res.beforeCleanup.contentTypesLength = before.toNumber();
1791
- _context27.next = 7;
1942
+ _context30.next = 7;
1792
1943
  return _this.CallContractMethodAndWait({
1793
1944
  contractAddress: contractAddress,
1794
1945
  methodName: "cleanUpContentTypes",
1795
1946
  formatArguments: true
1796
1947
  });
1797
1948
  case 7:
1798
- _context27.next = 9;
1949
+ _context30.next = 9;
1799
1950
  return _this.CallContractMethod({
1800
1951
  contractAddress: contractAddress,
1801
1952
  methodName: "getContentTypesLength",
1802
1953
  formatArguments: false
1803
1954
  });
1804
1955
  case 9:
1805
- after = _context27.sent;
1956
+ after = _context30.sent;
1806
1957
  res.afterCleanup.contentTypesLength = after.toNumber();
1807
1958
  case 11:
1808
1959
  case "end":
1809
- return _context27.stop();
1960
+ return _context30.stop();
1810
1961
  }
1811
- }, _callee27);
1962
+ }, _callee30);
1812
1963
  }));
1813
- return function (_x26) {
1814
- return _ref58.apply(this, arguments);
1964
+ return function (_x30) {
1965
+ return _ref65.apply(this, arguments);
1815
1966
  };
1816
1967
  }());
1817
1968
  runCleanupTasks = /*#__PURE__*/function () {
1818
- var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref59) {
1969
+ var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(_ref66) {
1819
1970
  var contractAddress, _res, _i, _Object$keys, type;
1820
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
1821
- while (1) switch (_context28.prev = _context28.next) {
1971
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
1972
+ while (1) switch (_context31.prev = _context31.next) {
1822
1973
  case 0:
1823
- contractAddress = _ref59.contractAddress;
1824
- _context28.prev = 1;
1974
+ contractAddress = _ref66.contractAddress;
1975
+ _context31.prev = 1;
1825
1976
  _res = {
1826
1977
  beforeCleanup: {},
1827
1978
  afterCleanup: {}
1828
1979
  };
1829
1980
  if (!(objectTypeToClean === ObjectTypesToClean.ALL)) {
1830
- _context28.next = 14;
1981
+ _context31.next = 14;
1831
1982
  break;
1832
1983
  }
1833
1984
  _i = 0, _Object$keys = Object.keys(cleanupTasks);
1834
1985
  case 5:
1835
1986
  if (!(_i < _Object$keys.length)) {
1836
- _context28.next = 12;
1987
+ _context31.next = 12;
1837
1988
  break;
1838
1989
  }
1839
1990
  type = _Object$keys[_i];
1840
- _context28.next = 9;
1991
+ _context31.next = 9;
1841
1992
  return cleanupTasks[type]({
1842
1993
  contractAddress: contractAddress,
1843
1994
  res: _res
1844
1995
  });
1845
1996
  case 9:
1846
1997
  _i++;
1847
- _context28.next = 5;
1998
+ _context31.next = 5;
1848
1999
  break;
1849
2000
  case 12:
1850
- _context28.next = 16;
2001
+ _context31.next = 16;
1851
2002
  break;
1852
2003
  case 14:
1853
- _context28.next = 16;
2004
+ _context31.next = 16;
1854
2005
  return cleanupTasks[objectTypeToClean]({
1855
2006
  contractAddress: contractAddress,
1856
2007
  res: _res
1857
2008
  });
1858
2009
  case 16:
1859
- return _context28.abrupt("return", _res);
2010
+ return _context31.abrupt("return", _res);
1860
2011
  case 19:
1861
- _context28.prev = 19;
1862
- _context28.t0 = _context28["catch"](1);
1863
- throw new Error("Error during '".concat(objectTypeToClean, "' cleanup for ").concat(contractAddress, ": ").concat(_context28.t0.message));
2012
+ _context31.prev = 19;
2013
+ _context31.t0 = _context31["catch"](1);
2014
+ throw new Error("Error during '".concat(objectTypeToClean, "' cleanup for ").concat(contractAddress, ": ").concat(_context31.t0.message));
1864
2015
  case 22:
1865
2016
  case "end":
1866
- return _context28.stop();
2017
+ return _context31.stop();
1867
2018
  }
1868
- }, _callee28, null, [[1, 19]]);
2019
+ }, _callee31, null, [[1, 19]]);
1869
2020
  }));
1870
- return function runCleanupTasks(_x27) {
1871
- return _ref60.apply(this, arguments);
2021
+ return function runCleanupTasks(_x31) {
2022
+ return _ref67.apply(this, arguments);
1872
2023
  };
1873
2024
  }();
1874
2025
  results = {}; // run cleanup on main contract
1875
- _context29.next = 32;
2026
+ _context32.next = 32;
1876
2027
  return runCleanupTasks({
1877
2028
  contractAddress: contractAddress
1878
2029
  });
1879
2030
  case 32:
1880
- res = _context29.sent;
2031
+ res = _context32.sent;
1881
2032
  if (isUserWallet) {
1882
2033
  results[userAddress] = res;
1883
2034
  } else {
@@ -1886,17 +2037,17 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1886
2037
 
1887
2038
  // run cleanup on access group contracts if this is a user wallet
1888
2039
  if (!isUserWallet) {
1889
- _context29.next = 49;
2040
+ _context32.next = 49;
1890
2041
  break;
1891
2042
  }
1892
- _context29.next = 37;
2043
+ _context32.next = 37;
1893
2044
  return this.CallContractMethod({
1894
2045
  contractAddress: contractAddress,
1895
2046
  methodName: "getAccessGroupsLength",
1896
2047
  formatArguments: false
1897
2048
  });
1898
2049
  case 37:
1899
- groupsLength = _context29.sent;
2050
+ groupsLength = _context32.sent;
1900
2051
  if (groupsLength > 0) {
1901
2052
  results["groups"] = {};
1902
2053
  }
@@ -1909,11 +2060,11 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1909
2060
  formatArguments: false
1910
2061
  }));
1911
2062
  }
1912
- _context29.next = 43;
2063
+ _context32.next = 43;
1913
2064
  return Promise.all(groupAddressPromises);
1914
2065
  case 43:
1915
- groupAddresses = _context29.sent;
1916
- _context29.next = 46;
2066
+ groupAddresses = _context32.sent;
2067
+ _context32.next = 46;
1917
2068
  return Promise.all(groupAddresses.map(function (addr) {
1918
2069
  return runCleanupTasks({
1919
2070
  contractAddress: addr
@@ -1922,7 +2073,7 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1922
2073
  });
1923
2074
  }));
1924
2075
  case 46:
1925
- cleanupResults = _context29.sent;
2076
+ cleanupResults = _context32.sent;
1926
2077
  _iterator = _createForOfIteratorHelper(cleanupResults);
1927
2078
  try {
1928
2079
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1935,14 +2086,14 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1935
2086
  _iterator.f();
1936
2087
  }
1937
2088
  case 49:
1938
- return _context29.abrupt("return", results);
2089
+ return _context32.abrupt("return", results);
1939
2090
  case 50:
1940
2091
  case "end":
1941
- return _context29.stop();
2092
+ return _context32.stop();
1942
2093
  }
1943
- }, _callee29, this, [[6, 11], [13, 21]]);
2094
+ }, _callee32, this, [[6, 11], [13, 21]]);
1944
2095
  }));
1945
- return function (_x22) {
1946
- return _ref50.apply(this, arguments);
2096
+ return function (_x26) {
2097
+ return _ref57.apply(this, arguments);
1947
2098
  };
1948
2099
  }();