@eluvio/elv-client-js 4.0.68 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.68",
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",
@@ -526,6 +526,7 @@ class FrameClient {
526
526
  "CollectionRedemptionStatus",
527
527
  "CreateListing",
528
528
  "CreateMarketplaceOffer",
529
+ "DeployTenant",
529
530
  "DropStatus",
530
531
  "ExchangeRate",
531
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"));