@eluvio/elv-client-js 3.1.79 → 3.1.80

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.
@@ -56,6 +56,8 @@ await client.userProfileClient.UserMetadata()
56
56
  this.client = client;
57
57
  this.debug = debug;
58
58
  this.userWalletAddresses = {};
59
+ this.walletAddress = undefined;
60
+ this.walletAddressRetrieved = false;
59
61
  }
60
62
 
61
63
  async CreateWallet() {
@@ -130,13 +132,17 @@ await client.userProfileClient.UserMetadata()
130
132
  * @return {Promise<string>} - The contract address of the current user's wallet contract
131
133
  */
132
134
  async WalletAddress(autoCreate=true) {
133
- if(this.walletAddress) { return this.walletAddress; }
135
+ if(this.walletAddress || this.walletAddressRetrieved) { return this.walletAddress; }
134
136
 
135
- const walletAddress = await this.client.CallContractMethod({
136
- contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
137
- methodName: "userWallets",
138
- methodArgs: [this.client.signer.address]
139
- });
137
+ if(!this.walletAddressPromise) {
138
+ this.walletAddressPromise = this.client.CallContractMethod({
139
+ contractAddress: Utils.HashToAddress(this.client.contentSpaceId),
140
+ methodName: "userWallets",
141
+ methodArgs: [this.client.signer.address]
142
+ });
143
+ }
144
+
145
+ const walletAddress = await this.walletAddressPromise;
140
146
 
141
147
  if(!Utils.EqualAddress(walletAddress, Utils.nullAddress)) {
142
148
  this.walletAddress = walletAddress;
@@ -146,6 +152,8 @@ await client.userProfileClient.UserMetadata()
146
152
  await this.CreateWallet();
147
153
  }
148
154
 
155
+ this.walletAddressRetrieved = true;
156
+
149
157
  return this.walletAddress;
150
158
  }
151
159
 
@@ -760,17 +760,22 @@ exports.MetadataAuth = async function({
760
760
  objectId,
761
761
  versionHash,
762
762
  path="/",
763
- channelAuth=false
763
+ channelAuth=false,
764
+ noAuth=false
764
765
  }) {
765
766
  ValidateParameters({libraryId, objectId, versionHash});
766
767
 
767
768
  if(versionHash) { objectId = this.utils.DecodeVersionHash(versionHash).objectId; }
768
769
 
769
- const visibility = await this.Visibility({id: objectId});
770
- const accessType = await this.AccessType({id: objectId});
771
- const isPublic = (path || "").replace(/^\/+/, "").startsWith("public");
772
-
773
- let noAuth = visibility >= 10 || (isPublic && visibility >= 1);
770
+ noAuth = this.noAuth || noAuth;
771
+ let isPublic = noAuth;
772
+ let accessType;
773
+ if(!noAuth) {
774
+ const visibility = await this.Visibility({id: objectId});
775
+ accessType = await this.AccessType({id: objectId});
776
+ isPublic = (path || "").replace(/^\/+/, "").startsWith("public");
777
+ noAuth = visibility >= 10 || (isPublic && visibility >= 1);
778
+ }
774
779
 
775
780
  if(this.oauthToken) {
776
781
  // Check that KMS is set on this object
@@ -823,6 +828,7 @@ exports.MetadataAuth = async function({
823
828
  * - Note: Selection is relative to "metadataSubtree". For example, metadataSubtree="public" and select=["name", "description"] would select "public/name" and "public/description"
824
829
  * @param {Array<string>=} remove - Exclude the specified items from the retrieved metadata
825
830
  * @param {string=} authorizationToken - Additional authorization token for this request
831
+ * @param {string=} noAuth=false - If specified, the normal authorization flow will be skipped. Useful if you know the metadata you're retrieving is publicly accessible
826
832
  * @param {boolean=} resolveLinks=false - If specified, links in the metadata will be resolved
827
833
  * @param {boolean=} resolveIncludeSource=false - If specified, resolved links will include the hash of the link at the root of the metadata
828
834
 
@@ -857,6 +863,7 @@ exports.ContentObjectMetadata = async function({
857
863
  select=[],
858
864
  remove=[],
859
865
  authorizationToken,
866
+ noAuth=false,
860
867
  resolveLinks=false,
861
868
  resolveIncludeSource=false,
862
869
  resolveIgnoreErrors=false,
@@ -877,7 +884,7 @@ exports.ContentObjectMetadata = async function({
877
884
  let path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree);
878
885
 
879
886
  // Main authorization
880
- let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree});
887
+ let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree, noAuth});
881
888
 
882
889
  // All authorization
883
890
  const authTokens = [authorizationToken, queryParams.authorization, defaultAuthToken].flat().filter(token => token);
@@ -2259,9 +2266,7 @@ exports.LinkUrl = async function({
2259
2266
  }
2260
2267
 
2261
2268
  let authorization = [ authorizationToken ];
2262
- if(!noAuth) {
2263
- authorization.push(await this.MetadataAuth({libraryId, objectId, versionHash, path: linkPath, channelAuth}));
2264
- }
2269
+ authorization.push(await this.MetadataAuth({libraryId, objectId, versionHash, path: linkPath, channelAuth, noAuth}));
2265
2270
 
2266
2271
  if(queryParams.authorization) {
2267
2272
  authorization.push(queryParams.authorization);
@@ -270,7 +270,6 @@ const Create = async ({
270
270
  Report(createResponse);
271
271
 
272
272
  const objectId = createResponse.id;
273
- await client.SetVisibility({id: objectId, visibility: 0});
274
273
 
275
274
  console.log("Starting Mezzanine Job(s)");
276
275
 
@@ -0,0 +1,49 @@
1
+ /* eslint-disable no-console */
2
+
3
+ // Removes HLS playout options from an existing offering of a mezzanine
4
+
5
+ const ScriptOffering = require("./parentClasses/ScriptOffering");
6
+
7
+ class OfferingRemoveDash extends ScriptOffering {
8
+
9
+ async body() {
10
+ const client = await this.client();
11
+
12
+ const libraryId = this.args.libraryId;
13
+ const objectId = this.args.objectId;
14
+ const offeringKey = this.args.offeringKey;
15
+
16
+ let dashFound = false;
17
+
18
+ let metadata = await client.ContentObjectMetadata({
19
+ libraryId,
20
+ objectId
21
+ });
22
+
23
+ this.validateOffering(metadata, offeringKey);
24
+
25
+ // loop through playout formats, delete ones where protocol is Dash
26
+ const playoutFormatKeys = Object.keys(metadata.offerings[offeringKey].playout.playout_formats);
27
+ for(let i = 0; i < playoutFormatKeys.length; i++) {
28
+ const key = playoutFormatKeys[i];
29
+ if(metadata.offerings[offeringKey].playout.playout_formats[key].protocol.type === "ProtoDash") {
30
+ console.log("Found Dash playout format '" + key + "', removing...");
31
+ delete metadata.offerings[offeringKey].playout.playout_formats[key];
32
+ dashFound = true;
33
+ }
34
+ }
35
+
36
+ if(dashFound) {
37
+ await this.metadataWrite(metadata);
38
+ } else {
39
+ console.log("No playout formats found with Dash");
40
+ }
41
+ }
42
+
43
+ header() {
44
+ return "Removing playout formats with Dash from mezzanine offering '" + this.args.offeringKey + "'... ";
45
+ }
46
+ }
47
+
48
+ const script = new OfferingRemoveDash;
49
+ script.run();
@@ -6,7 +6,7 @@ const currencyOptions = [...new Set(Object.values(require("country-codes-list").
6
6
  const eventSiteSpec = {
7
7
  "profile": {
8
8
  name: "Eluvio LIVE Event Site",
9
- version: "0.2",
9
+ version: "0.3",
10
10
  },
11
11
  manageApp: "default",
12
12
  associate_permissions: true,
@@ -50,17 +50,25 @@ const eventSiteSpec = {
50
50
  "type": "Text"
51
51
  },
52
52
  {
53
- "label": "Eluvio LIVE Tenant",
54
- "name": "tenant",
55
- "type": "fabric_link",
56
- "hash_only": true,
57
- "no_localize": true
53
+ "name": "tenant_slug",
54
+ "type": "text",
55
+ "required": true,
58
56
  },
59
57
  {
60
- "name": "marketplace",
61
- "type": "fabric_link",
62
- "hash_only": true,
63
- "no_localize": true
58
+ "name": "marketplace_info",
59
+ "type": "subsection",
60
+ "fields": [
61
+ {
62
+ "name": "tenant_slug",
63
+ "type": "text",
64
+ "hint": "The slug of the tenant in which the marketplace is defined"
65
+ },
66
+ {
67
+ "name": "marketplace_slug",
68
+ "type": "text",
69
+ "hint": "The slug of the marketplace"
70
+ }
71
+ ]
64
72
  },
65
73
  {
66
74
  "name": "state",
@@ -81,6 +89,7 @@ const eventSiteSpec = {
81
89
  },
82
90
  {
83
91
  "name": "theme",
92
+ "label": "Color Scheme",
84
93
  "type": "select",
85
94
  "options": [
86
95
  "light",
@@ -473,22 +482,38 @@ const eventSiteSpec = {
473
482
  ]
474
483
  },
475
484
  {
485
+ "name": "event_info_modals",
486
+ "type": "list",
476
487
  "fields": [
477
488
  {
478
- "name": "name",
489
+ "name": "button_text",
479
490
  "type": "text"
480
491
  },
481
492
  {
493
+ "name": "pages",
494
+ "type": "list",
482
495
  "fields": [
483
496
  {
484
- "hint": "A description displayed next to the 'Next' button when viewing the previous page.",
485
497
  "name": "page_title",
486
498
  "type": "text"
487
499
  },
488
500
  {
489
- "extensions": imageTypes,
490
501
  "name": "image",
491
- "type": "file"
502
+ "extensions": imageTypes,
503
+ "type": "file",
504
+ "unless": "./video",
505
+ "hint": "Select an image for this page. Each page may only have one image or one video"
506
+ },
507
+ {
508
+ "name": "video",
509
+ "type": "fabric_link",
510
+ "video_preview": true,
511
+ "unless": "./image",
512
+ "hint": "Select a video for this page. Each page may only have one image or one video"
513
+ },
514
+ {
515
+ "name": "text",
516
+ "type": "rich_text"
492
517
  },
493
518
  {
494
519
  "name": "text_color",
@@ -508,17 +533,9 @@ const eventSiteSpec = {
508
533
  "label": "White"
509
534
  }
510
535
  },
511
- {
512
- "name": "text",
513
- "type": "rich_text"
514
- }
515
- ],
516
- "name": "pages",
517
- "type": "list"
536
+ ]
518
537
  }
519
- ],
520
- "name": "event_descriptions",
521
- "type": "list"
538
+ ]
522
539
  },
523
540
  {
524
541
  "fields": [
@@ -1799,7 +1816,58 @@ const eventSiteSpec = {
1799
1816
  ]
1800
1817
  }
1801
1818
  ]
1802
- }
1819
+ },
1820
+
1821
+
1822
+
1823
+ {
1824
+ "fields": [
1825
+ {
1826
+ "name": "name",
1827
+ "type": "text"
1828
+ },
1829
+ {
1830
+ "fields": [
1831
+ {
1832
+ "hint": "A description displayed next to the 'Next' button when viewing the previous page.",
1833
+ "name": "page_title",
1834
+ "type": "text"
1835
+ },
1836
+ {
1837
+ "extensions": imageTypes,
1838
+ "name": "image",
1839
+ "type": "file"
1840
+ },
1841
+ {
1842
+ "name": "text_color",
1843
+ "type": "color",
1844
+ "no_label": true,
1845
+ "default_value": {
1846
+ "color": "#000000",
1847
+ "label": "Black"
1848
+ }
1849
+ },
1850
+ {
1851
+ "name": "background_color",
1852
+ "type": "color",
1853
+ "no_label": true,
1854
+ "default_value": {
1855
+ "color": "#FFFFFF",
1856
+ "label": "White"
1857
+ }
1858
+ },
1859
+ {
1860
+ "name": "text",
1861
+ "type": "rich_text"
1862
+ }
1863
+ ],
1864
+ "name": "pages",
1865
+ "type": "list"
1866
+ }
1867
+ ],
1868
+ "name": "event_descriptions",
1869
+ "type": "list"
1870
+ },
1803
1871
  ]
1804
1872
  };
1805
1873
 
@@ -3,7 +3,7 @@ const imageTypes = ["gif", "jpg", "jpeg", "png", "svg", "webp"];
3
3
  const eventTenantSpec = {
4
4
  "profile": {
5
5
  name: "Eluvio LIVE Tenant",
6
- version: "0.1",
6
+ version: "0.3",
7
7
  },
8
8
  "hide_image_tab": true,
9
9
  manageApp: "default",