@eluvio/elv-client-js 4.0.114 → 4.0.116

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.
Files changed (129) hide show
  1. package/dist/ElvClient-min.js +68 -0
  2. package/dist/ElvClient-node-min.js +67 -0
  3. package/dist/ElvFrameClient-min.js +60 -0
  4. package/dist/ElvPermissionsClient-min.js +60 -0
  5. package/dist/ElvWalletClient-min.js +68 -0
  6. package/dist/ElvWalletClient-node-min.js +67 -0
  7. package/dist/src/AuthorizationClient.js +2166 -0
  8. package/dist/src/ContentObjectAudit.js +175 -0
  9. package/dist/src/ContentObjectVerification.js +281 -0
  10. package/dist/src/Crypto.js +412 -0
  11. package/dist/src/ElvClient.js +2063 -0
  12. package/dist/src/ElvWallet.js +247 -0
  13. package/dist/src/EthClient.js +1153 -0
  14. package/dist/src/FrameClient.js +484 -0
  15. package/dist/src/HttpClient.js +314 -0
  16. package/dist/src/Id.js +20 -0
  17. package/dist/src/LogMessage.js +25 -0
  18. package/dist/src/PermissionsClient.js +1556 -0
  19. package/dist/src/RemoteSigner.js +383 -0
  20. package/dist/src/UserProfileClient.js +1465 -0
  21. package/dist/src/Utils.js +893 -0
  22. package/dist/src/Validation.js +121 -0
  23. package/dist/src/abr_profiles/abr_profile_live_drm.js +1661 -0
  24. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +1606 -0
  25. package/dist/src/client/ABRPublishing.js +1018 -0
  26. package/dist/src/client/AccessGroups.js +1503 -0
  27. package/dist/src/client/ContentAccess.js +5202 -0
  28. package/dist/src/client/ContentManagement.js +2680 -0
  29. package/dist/src/client/Contracts.js +1520 -0
  30. package/dist/src/client/Files.js +2181 -0
  31. package/dist/src/client/LiveConf.js +567 -0
  32. package/dist/src/client/LiveStream.js +2638 -0
  33. package/dist/src/client/NFT.js +162 -0
  34. package/dist/src/client/NTP.js +581 -0
  35. package/dist/src/contracts/v2/AccessIndexor.js +831 -0
  36. package/dist/src/contracts/v2/Accessible.js +31 -0
  37. package/dist/src/contracts/v2/BaseAccessControlGroup.js +1263 -0
  38. package/dist/src/contracts/v2/BaseAccessWallet.js +1609 -0
  39. package/dist/src/contracts/v2/BaseAccessWalletFactory.js +93 -0
  40. package/dist/src/contracts/v2/BaseContent.js +1076 -0
  41. package/dist/src/contracts/v2/BaseContentFactory.js +219 -0
  42. package/dist/src/contracts/v2/BaseContentSpace.js +1352 -0
  43. package/dist/src/contracts/v2/BaseContentType.js +364 -0
  44. package/dist/src/contracts/v2/BaseFactory.js +107 -0
  45. package/dist/src/contracts/v2/BaseGroupFactory.js +93 -0
  46. package/dist/src/contracts/v2/BaseLibrary.js +1041 -0
  47. package/dist/src/contracts/v2/BaseLibraryFactory.js +96 -0
  48. package/dist/src/contracts/v2/Certifyer.js +86 -0
  49. package/dist/src/contracts/v2/Container.js +540 -0
  50. package/dist/src/contracts/v2/Content.js +443 -0
  51. package/dist/src/contracts/v2/Editable.js +306 -0
  52. package/dist/src/contracts/v2/ExternalUserWallet.js +379 -0
  53. package/dist/src/contracts/v2/IFactorySpace.js +57 -0
  54. package/dist/src/contracts/v2/IKmsSpace.js +52 -0
  55. package/dist/src/contracts/v2/INodeSpace.js +18 -0
  56. package/dist/src/contracts/v2/IUserSpace.js +18 -0
  57. package/dist/src/contracts/v2/LvRecordableStream.js +1037 -0
  58. package/dist/src/contracts/v2/LvRecording.js +627 -0
  59. package/dist/src/contracts/v2/LvStreamRightsHolder.js +562 -0
  60. package/dist/src/contracts/v2/MetaObject.js +119 -0
  61. package/dist/src/contracts/v2/Node.js +167 -0
  62. package/dist/src/contracts/v2/NodeSpace.js +273 -0
  63. package/dist/src/contracts/v2/Ownable.js +87 -0
  64. package/dist/src/contracts/v2/PaymentService.js +627 -0
  65. package/dist/src/contracts/v2/Precompile.js +15 -0
  66. package/dist/src/contracts/v2/Transactable.js +82 -0
  67. package/dist/src/contracts/v2/UserSpace.js +29 -0
  68. package/dist/src/contracts/v2/Utils.js +18 -0
  69. package/dist/src/contracts/v2/Verifier.js +53 -0
  70. package/dist/src/contracts/v2/strings.js +4 -0
  71. package/dist/src/contracts/v3/AccessIndexor.js +774 -0
  72. package/dist/src/contracts/v3/Accessible.js +232 -0
  73. package/dist/src/contracts/v3/Adminable.js +107 -0
  74. package/dist/src/contracts/v3/AvailsDelivery.js +586 -0
  75. package/dist/src/contracts/v3/BaseAccessControlGroup.js +1603 -0
  76. package/dist/src/contracts/v3/BaseAccessWallet.js +1628 -0
  77. package/dist/src/contracts/v3/BaseAccessWalletFactory.js +112 -0
  78. package/dist/src/contracts/v3/BaseContent.js +1312 -0
  79. package/dist/src/contracts/v3/BaseContentFactory.js +183 -0
  80. package/dist/src/contracts/v3/BaseContentFactoryExt.js +175 -0
  81. package/dist/src/contracts/v3/BaseContentSpace.js +1515 -0
  82. package/dist/src/contracts/v3/BaseContentType.js +527 -0
  83. package/dist/src/contracts/v3/BaseFactory.js +126 -0
  84. package/dist/src/contracts/v3/BaseGroupFactory.js +112 -0
  85. package/dist/src/contracts/v3/BaseLibrary.js +1204 -0
  86. package/dist/src/contracts/v3/BaseLibraryFactory.js +115 -0
  87. package/dist/src/contracts/v3/BaseTenantSpace.js +1587 -0
  88. package/dist/src/contracts/v3/Certifyer.js +86 -0
  89. package/dist/src/contracts/v3/Container.js +739 -0
  90. package/dist/src/contracts/v3/Content.js +438 -0
  91. package/dist/src/contracts/v3/CounterObject.js +243 -0
  92. package/dist/src/contracts/v3/Editable.js +519 -0
  93. package/dist/src/contracts/v3/EncToken.js +4 -0
  94. package/dist/src/contracts/v3/ExternalUserWallet.js +587 -0
  95. package/dist/src/contracts/v3/IAdmin.js +18 -0
  96. package/dist/src/contracts/v3/IFactorySpace.js +57 -0
  97. package/dist/src/contracts/v3/IKmsSpace.js +52 -0
  98. package/dist/src/contracts/v3/INodeSpace.js +18 -0
  99. package/dist/src/contracts/v3/IUserSpace.js +32 -0
  100. package/dist/src/contracts/v3/LvRecordableStream.js +1032 -0
  101. package/dist/src/contracts/v3/LvRecording.js +650 -0
  102. package/dist/src/contracts/v3/LvStreamRightsHolder.js +557 -0
  103. package/dist/src/contracts/v3/MetaObject.js +144 -0
  104. package/dist/src/contracts/v3/Node.js +178 -0
  105. package/dist/src/contracts/v3/NodeSpace.js +284 -0
  106. package/dist/src/contracts/v3/Ownable.js +98 -0
  107. package/dist/src/contracts/v3/PaymentService.js +622 -0
  108. package/dist/src/contracts/v3/Precompile.js +26 -0
  109. package/dist/src/contracts/v3/TenantFuncsBase.js +351 -0
  110. package/dist/src/contracts/v3/Transactable.js +82 -0
  111. package/dist/src/contracts/v3/UserSpace.js +43 -0
  112. package/dist/src/contracts/v3/Utils.js +18 -0
  113. package/dist/src/contracts/v3/Verifier.js +53 -0
  114. package/dist/src/contracts/v3/strings.js +4 -0
  115. package/dist/src/contracts/v3b/BaseAccessControlGroup.js +1704 -0
  116. package/dist/src/events/Topics.js +1793 -0
  117. package/dist/src/index.js +8 -0
  118. package/dist/src/walletClient/ClientMethods.js +3102 -0
  119. package/dist/src/walletClient/Configuration.js +38 -0
  120. package/dist/src/walletClient/Notifications.js +168 -0
  121. package/dist/src/walletClient/Profile.js +332 -0
  122. package/dist/src/walletClient/Utils.js +281 -0
  123. package/dist/src/walletClient/index.js +2109 -0
  124. package/package.json +1 -1
  125. package/src/AuthorizationClient.js +24 -16
  126. package/src/ElvClient.js +19 -0
  127. package/src/client/ContentAccess.js +20 -2
  128. package/src/client/LiveConf.js +10 -8
  129. package/src/client/LiveStream.js +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.114",
3
+ "version": "4.0.116",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -85,16 +85,8 @@ class AuthorizationClient {
85
85
  this.requestIds = {};
86
86
 
87
87
  this.providers = {};
88
- }
89
-
90
- CreateStaticToken({libraryId}) {
91
- let token = { qspace_id: this.client.contentSpaceId };
92
-
93
- if(libraryId) {
94
- token.qlib_id = libraryId;
95
- }
96
88
 
97
- return Utils.B64(JSON.stringify(token));
89
+ this.CreateStaticToken = client.CreateStaticToken;
98
90
  }
99
91
 
100
92
  // Return authorization token in appropriate headers
@@ -164,7 +156,7 @@ class AuthorizationClient {
164
156
  });
165
157
  } else {
166
158
  if(noAuth && this.client.signer && this.client.signer.remoteSigner && this.client.signer.unsignedPublicAuth) {
167
- return this.CreateStaticToken({libraryId});
159
+ return this.client.CreateStaticToken({libraryId});
168
160
  }
169
161
 
170
162
  authorizationToken = await this.GenerateAuthorizationToken({
@@ -327,12 +319,25 @@ class AuthorizationClient {
327
319
 
328
320
  // Make the request
329
321
  let accessRequest;
330
- if(update) {
331
- this.Log(`Making update request on ${accessType} ${id}`);
332
- accessRequest = await this.UpdateRequest({id, abi});
333
- } else {
334
- this.Log(`Making access request on ${accessType} ${id}`);
335
- accessRequest = await this.AccessRequest({id, args: accessArgs, checkAccessCharge});
322
+ try {
323
+ if(update) {
324
+ this.Log(`Making update request on ${accessType} ${id}`);
325
+ accessRequest = await this.UpdateRequest({id, abi});
326
+ } else {
327
+ this.Log(`Making access request on ${accessType} ${id}`);
328
+ accessRequest = await this.AccessRequest({id, args: accessArgs, checkAccessCharge});
329
+ }
330
+ } catch(error) {
331
+ // Handle specific errors like permission denied
332
+ if(error.message.includes("UNPREDICTABLE_GAS_LIMIT")) {
333
+ this.Log(`Permission denied for ${id}: ${error.message}`);
334
+ throw Error(`Permission denied for ${Utils.FormatAddress(this.client.signer.address)} on ${id} or
335
+ ${Utils.FormatAddress(this.client.signer.address)} have insufficient funds`);
336
+ }
337
+
338
+ // Handle other unexpected errors
339
+ this.Log(`Error during request for ${id}: ${error.message}`);
340
+ throw error;
336
341
  }
337
342
 
338
343
  const cache = update ? this.modifyTransactions : this.accessTransactions;
@@ -380,6 +385,9 @@ class AuthorizationClient {
380
385
  const accessChargeArgs = isV3 ? [0, [], []] : [args[0], args[3], args[4]];
381
386
  // Access charge is in wei, but methods take ether - convert to charge to ether
382
387
  accessCharge = Utils.WeiToEther(await this.GetAccessCharge({objectId: id, args: accessChargeArgs}));
388
+ if(isNaN(accessCharge) || !accessCharge){
389
+ accessCharge = 0;
390
+ }
383
391
  } catch(error) {
384
392
  this.Log("Failed to get access charge for", id);
385
393
  this.Log(error);
package/src/ElvClient.js CHANGED
@@ -1170,6 +1170,25 @@ class ElvClient {
1170
1170
  }
1171
1171
  }
1172
1172
 
1173
+ /**
1174
+ * Create a static authorization token
1175
+ *
1176
+ * @methodGroup Authorization
1177
+ * @namedParams
1178
+ * @param {string=} libraryId - The library ID to associate with the static token
1179
+ *
1180
+ * @return {string} - The created static token
1181
+ */
1182
+ CreateStaticToken({libraryId}) {
1183
+ let token = { qspace_id: this.client.contentSpaceId };
1184
+
1185
+ if(libraryId) {
1186
+ token.qlib_id = libraryId;
1187
+ }
1188
+
1189
+ return Utils.B64(JSON.stringify(token));
1190
+ }
1191
+
1173
1192
  /**
1174
1193
  * Set a static token for the client to use for all authorization
1175
1194
  *
@@ -1557,6 +1557,7 @@ exports.PlayoutOptions = async function({
1557
1557
 
1558
1558
  const licenseServers = option.properties.license_servers;
1559
1559
  const cert = option.properties.cert;
1560
+ const thumbnailTrackUri = option.properties.thumbnails_webvtt_uri;
1560
1561
 
1561
1562
  if(hlsjsProfile && protocol === "hls" && drm === "aes-128") {
1562
1563
  queryParams.player_profile = "hls-js";
@@ -1594,7 +1595,15 @@ exports.PlayoutOptions = async function({
1594
1595
  path: UrlJoin("rep", handler, offering, playoutPath),
1595
1596
  queryParams
1596
1597
  }),
1597
- drms: drm ? {[drm]: {licenseServers, cert}} : undefined
1598
+ drms: drm ? {[drm]: {licenseServers, cert}} : undefined,
1599
+ thumbnailTrack: !thumbnailTrackUri ? undefined :
1600
+ await this.Rep({
1601
+ libraryId: linkTarget.libraryId || libraryId,
1602
+ objectId: linkTarget.objectId || objectId,
1603
+ versionHash: linkTarget.versionHash || versionHash,
1604
+ rep: UrlJoin(handler, offering, thumbnailTrackUri),
1605
+ queryParams
1606
+ }),
1598
1607
  }
1599
1608
  }
1600
1609
  };
@@ -2376,6 +2385,8 @@ const EmbedMediaTypes = {
2376
2385
  - `ntpId` - NTP ID, required for tickets authorization
2377
2386
  - `ticketCode` - Ticket code, optional with tickets authorization
2378
2387
  - `ticketSubject` - Ticket subject, optional with tickets authorization
2388
+ - `verifyContent` - Verify content
2389
+ - `additionalParameters` - Additional search params that will be appended to the URL
2379
2390
  *
2380
2391
  * @returns {Promise<string>} - Will return an embed URL
2381
2392
  */
@@ -2384,7 +2395,8 @@ exports.EmbedUrl = async function({
2384
2395
  versionHash,
2385
2396
  duration=86400000,
2386
2397
  mediaType="video",
2387
- options={}
2398
+ options={},
2399
+ additionalParameters={}
2388
2400
  }) {
2389
2401
  if(versionHash) {
2390
2402
  ValidateVersion(versionHash);
@@ -2495,9 +2507,15 @@ exports.EmbedUrl = async function({
2495
2507
  embedUrl.searchParams.set("sbj", Buffer.from(options.ticketSubject).toString("base64"));
2496
2508
  }
2497
2509
  break;
2510
+ case "verifyContent":
2511
+ embedUrl.searchParams.set("vc", "");
2498
2512
  }
2499
2513
  }
2500
2514
 
2515
+ for(let item of Object.keys(additionalParameters)) {
2516
+ embedUrl.searchParams.set(item, additionalParameters[item]);
2517
+ }
2518
+
2501
2519
  if(Object.keys(data).length > 0) {
2502
2520
  embedUrl.searchParams.set("data", this.utils.B64(JSON.stringify({meta_tags: data})));
2503
2521
  }
@@ -1,3 +1,5 @@
1
+ /* eslint no-console: 0 */
2
+
1
3
  const DefaultABRLadder = {
2
4
  "video" : [
3
5
  {
@@ -497,13 +499,13 @@ class LiveConf {
497
499
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
498
500
 
499
501
  // Determine video recording bitrate and ABR ladder
500
- let topLadderRate = 0
501
- for (let i = 0; i < ladderProfile.video.length; i ++) {
502
+ let topLadderRate = 0;
503
+ for(let i = 0; i < ladderProfile.video.length; i ++) {
502
504
  let elem = ladderProfile.video[i];
503
- if (elem.height > videoStream.height)
505
+ if(elem.height > videoStream.height)
504
506
  continue;
505
- if (elem.bit_rate > topLadderRate) {
506
- topLadderRate = elem.bit_rate
507
+ if(elem.bit_rate > topLadderRate) {
508
+ topLadderRate = elem.bit_rate;
507
509
  }
508
510
  elem.media_type = 1;
509
511
  elem.stream_name = "video";
@@ -524,14 +526,14 @@ class LiveConf {
524
526
  const audio = audioStreams[audioIndex];
525
527
 
526
528
  // Find ladder rung for the specific channel layout (2 or 6 channels)
527
- for (let j = 0; j < ladderProfile.audio.length; j ++) {
529
+ for(let j = 0; j < ladderProfile.audio.length; j ++) {
528
530
  let elem = ladderProfile.audio[j];
529
- if (elem.channels == audio.recordingChannels) {
531
+ if(elem.channels == audio.recordingChannels) {
530
532
  audioLadderSpec = {...elem};
531
533
  break;
532
534
  }
533
535
  }
534
- if (Object.keys(audioLadderSpec).length === 0) {
536
+ if(Object.keys(audioLadderSpec).length === 0) {
535
537
  // If no channels layout match, just use the first element in the ladder
536
538
  audioLadderSpec = {...ladderProfile.audio[0]};
537
539
  }
@@ -1,3 +1,5 @@
1
+ /* eslint no-console: 0 */
2
+
1
3
  /**
2
4
  * Methods for Live Stream creation and management
3
5
  *
@@ -515,7 +517,7 @@ exports.StreamStatus = async function({name, stopLro=false, showParams=false}) {
515
517
  return status;
516
518
  }
517
519
 
518
- const segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration
520
+ const segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration;
519
521
 
520
522
  // Convert LRO 'state' to desired 'state'
521
523
  if(state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
@@ -1047,7 +1049,7 @@ exports.StreamSetOfferingAndDRM = async function({name, typeAbrMaster, typeLiveS
1047
1049
  "min_buffer_length": 2,
1048
1050
  "type": "ProtoDash"
1049
1051
  }
1050
- }
1052
+ };
1051
1053
  continue;
1052
1054
  }
1053
1055
 
@@ -1983,12 +1985,12 @@ exports.StreamAddWatermark = async function({
1983
1985
  }
1984
1986
 
1985
1987
  const watermarkArgCount = [simpleWatermark, imageWatermark, forensicWatermark].filter(i => !!i).length;
1986
- console.log("watermark arg count", watermarkArgCount)
1988
+ console.log("watermark arg count", watermarkArgCount);
1987
1989
 
1988
1990
  if(watermarkArgCount === 0) {
1989
1991
  throw Error("No watermark was provided");
1990
1992
  } else if(watermarkArgCount > 1) {
1991
- throw Error("Only one watermark is allowed")
1993
+ throw Error("Only one watermark is allowed");
1992
1994
  }
1993
1995
 
1994
1996
  if(simpleWatermark) {