@eluvio/elv-client-js 4.0.67 → 4.0.69

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.
@@ -95,14 +95,10 @@ var FormatNFTDetails = function FormatNFTDetails(entry) {
95
95
  } else {
96
96
  details.Offers = info.offers || [];
97
97
  }
98
- var result = {
98
+ return {
99
99
  metadata: metadata,
100
100
  details: details
101
101
  };
102
- if (entry.nft_template) {
103
- result.nft_template = entry.nft_template;
104
- }
105
- return result;
106
102
  };
107
103
  exports.FormatNFTDetails = FormatNFTDetails;
108
104
  var FormatNFTMetadata = function FormatNFTMetadata(walletClient, nft) {
@@ -1412,7 +1412,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
1412
1412
  _ref21,
1413
1413
  contents,
1414
1414
  paging,
1415
- modesToFormat,
1416
1415
  _args20 = arguments;
1417
1416
  return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1418
1417
  while (1) switch (_context20.prev = _context20.next) {
@@ -1633,7 +1632,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
1633
1632
  _ref21 = _context20.t1;
1634
1633
  contents = _ref21.contents;
1635
1634
  paging = _ref21.paging;
1636
- modesToFormat = ["owned", "listings", "owned-full-meta"];
1637
1635
  return _context20.abrupt("return", {
1638
1636
  paging: {
1639
1637
  start: params.start,
@@ -1642,14 +1640,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
1642
1640
  more: paging.total > start + limit
1643
1641
  },
1644
1642
  results: (contents || []).map(function (item) {
1645
- return modesToFormat.includes(mode) ? FormatNFT(_this6, item) : item;
1643
+ return ["owned", "listings"].includes(mode) ? FormatNFT(_this6, item) : item;
1646
1644
  })
1647
1645
  });
1648
- case 72:
1649
- _context20.prev = 72;
1646
+ case 71:
1647
+ _context20.prev = 71;
1650
1648
  _context20.t4 = _context20["catch"](14);
1651
1649
  if (!(_context20.t4.status && _context20.t4.status.toString() === "404")) {
1652
- _context20.next = 76;
1650
+ _context20.next = 75;
1653
1651
  break;
1654
1652
  }
1655
1653
  return _context20.abrupt("return", {
@@ -1661,13 +1659,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
1661
1659
  },
1662
1660
  results: []
1663
1661
  });
1664
- case 76:
1662
+ case 75:
1665
1663
  throw _context20.t4;
1666
- case 77:
1664
+ case 76:
1667
1665
  case "end":
1668
1666
  return _context20.stop();
1669
1667
  }
1670
- }, _callee20, this, [[14, 72]]);
1668
+ }, _callee20, this, [[14, 71]]);
1671
1669
  }));
1672
1670
  function FilteredQuery() {
1673
1671
  return _FilteredQuery.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.67",
3
+ "version": "4.0.69",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
package/src/ElvClient.js CHANGED
@@ -1175,6 +1175,10 @@ class ElvClient {
1175
1175
  );
1176
1176
  }
1177
1177
 
1178
+ async MakeAuthServiceRequest({kmsId, objectId, versionHash, method="GET", path, bodyType, body={}, queryParams={}, headers}) {
1179
+ return this.authClient.MakeAuthServiceRequest({kmsId, objectId, versionHash, method, path, bodyType, body, queryParams, headers});
1180
+ }
1181
+
1178
1182
  /* FrameClient related */
1179
1183
 
1180
1184
  // Whitelist of methods allowed to be called using the frame API
@@ -426,6 +426,7 @@ class FrameClient {
426
426
  "ListNTPInstances",
427
427
  "LRODraftInfo",
428
428
  "LROStatus",
429
+ "MakeAuthServiceRequest",
429
430
  "MergeContractMetadata",
430
431
  "MergeMetadata",
431
432
  "MetadataAuth",
@@ -489,7 +490,8 @@ class FrameClient {
489
490
  "UploadStatus",
490
491
  "UseRegion",
491
492
  "VerifyContentObject",
492
- "Visibility"
493
+ "Visibility",
494
+ "WriteTokenNodeUrl"
493
495
  ];
494
496
  }
495
497
 
@@ -524,6 +526,7 @@ class FrameClient {
524
526
  "CollectionRedemptionStatus",
525
527
  "CreateListing",
526
528
  "CreateMarketplaceOffer",
529
+ "DeployTenant",
527
530
  "DropStatus",
528
531
  "ExchangeRate",
529
532
  "FilteredQuery",
@@ -1332,6 +1332,42 @@ class ElvWalletClient {
1332
1332
  return [];
1333
1333
  }
1334
1334
  }
1335
+
1336
+ async DeployTenant({tenantId, tenantSlug="", tenantHash}) {
1337
+ if(!tenantHash) {
1338
+ const tenantLink = await this.client.ContentObjectMetadata({
1339
+ libraryId: this.mainSiteLibraryId,
1340
+ objectId: this.mainSiteId,
1341
+ metadataSubtree: UrlJoin("public/asset_metadata/tenants", tenantSlug),
1342
+ resolveLinks: true,
1343
+ linkDepthLimit: 1,
1344
+ resolveIncludeSource: true,
1345
+ resolveIgnoreErrors: true,
1346
+ select: [
1347
+ "."
1348
+ ]
1349
+ });
1350
+
1351
+ if(!tenantLink) {
1352
+ throw Error(`Eluvio Wallet Client: Invalid or missing tenancy: ${tenantSlug}`);
1353
+ }
1354
+
1355
+ const deployedTenantHash = tenantLink["."].source;
1356
+
1357
+ tenantHash = await this.client.LatestVersionHash({versionHash: deployedTenantHash});
1358
+ }
1359
+
1360
+ const body = { content_hash: tenantHash, ts: Date.now() };
1361
+ const token = await this.client.Sign(JSON.stringify(body));
1362
+ await this.client.authClient.MakeAuthServiceRequest({
1363
+ path: UrlJoin("as", "tnt", "config", tenantId, "metadata"),
1364
+ method: "POST",
1365
+ body,
1366
+ headers: {
1367
+ Authorization: `Bearer ${token}`
1368
+ }
1369
+ });
1370
+ }
1335
1371
  }
1336
1372
 
1337
1373
  Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));