@eluvio/elv-client-js 4.0.114 → 4.0.115
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/dist/ElvClient-min.js +67 -0
- package/dist/ElvClient-node-min.js +66 -0
- package/dist/ElvFrameClient-min.js +60 -0
- package/dist/ElvPermissionsClient-min.js +60 -0
- package/dist/ElvWalletClient-min.js +67 -0
- package/dist/ElvWalletClient-node-min.js +66 -0
- package/dist/src/AuthorizationClient.js +2169 -0
- package/dist/src/ContentObjectAudit.js +175 -0
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +412 -0
- package/dist/src/ElvClient.js +2044 -0
- package/dist/src/ElvWallet.js +245 -0
- package/dist/src/EthClient.js +1154 -0
- package/dist/src/FrameClient.js +485 -0
- package/dist/src/HttpClient.js +315 -0
- package/dist/src/Id.js +21 -0
- package/dist/src/LogMessage.js +25 -0
- package/dist/src/PermissionsClient.js +1544 -0
- package/dist/src/RemoteSigner.js +385 -0
- package/dist/src/UserProfileClient.js +1450 -0
- package/dist/src/Utils.js +894 -0
- package/dist/src/Validation.js +121 -0
- package/dist/src/abr_profiles/abr_profile_live_drm.js +1661 -0
- package/dist/src/abr_profiles/abr_profile_live_to_vod.js +1606 -0
- package/dist/src/client/ABRPublishing.js +1018 -0
- package/dist/src/client/AccessGroups.js +1503 -0
- package/dist/src/client/ContentAccess.js +5195 -0
- package/dist/src/client/ContentManagement.js +2680 -0
- package/dist/src/client/Contracts.js +1520 -0
- package/dist/src/client/Files.js +2181 -0
- package/dist/src/client/LiveConf.js +569 -0
- package/dist/src/client/LiveStream.js +2640 -0
- package/dist/src/client/NFT.js +162 -0
- package/dist/src/client/NTP.js +581 -0
- package/dist/src/contracts/v2/AccessIndexor.js +831 -0
- package/dist/src/contracts/v2/Accessible.js +31 -0
- package/dist/src/contracts/v2/BaseAccessControlGroup.js +1263 -0
- package/dist/src/contracts/v2/BaseAccessWallet.js +1609 -0
- package/dist/src/contracts/v2/BaseAccessWalletFactory.js +93 -0
- package/dist/src/contracts/v2/BaseContent.js +1076 -0
- package/dist/src/contracts/v2/BaseContentFactory.js +219 -0
- package/dist/src/contracts/v2/BaseContentSpace.js +1352 -0
- package/dist/src/contracts/v2/BaseContentType.js +364 -0
- package/dist/src/contracts/v2/BaseFactory.js +107 -0
- package/dist/src/contracts/v2/BaseGroupFactory.js +93 -0
- package/dist/src/contracts/v2/BaseLibrary.js +1041 -0
- package/dist/src/contracts/v2/BaseLibraryFactory.js +96 -0
- package/dist/src/contracts/v2/Certifyer.js +86 -0
- package/dist/src/contracts/v2/Container.js +540 -0
- package/dist/src/contracts/v2/Content.js +443 -0
- package/dist/src/contracts/v2/Editable.js +306 -0
- package/dist/src/contracts/v2/ExternalUserWallet.js +379 -0
- package/dist/src/contracts/v2/IFactorySpace.js +57 -0
- package/dist/src/contracts/v2/IKmsSpace.js +52 -0
- package/dist/src/contracts/v2/INodeSpace.js +18 -0
- package/dist/src/contracts/v2/IUserSpace.js +18 -0
- package/dist/src/contracts/v2/LvRecordableStream.js +1037 -0
- package/dist/src/contracts/v2/LvRecording.js +627 -0
- package/dist/src/contracts/v2/LvStreamRightsHolder.js +562 -0
- package/dist/src/contracts/v2/MetaObject.js +119 -0
- package/dist/src/contracts/v2/Node.js +167 -0
- package/dist/src/contracts/v2/NodeSpace.js +273 -0
- package/dist/src/contracts/v2/Ownable.js +87 -0
- package/dist/src/contracts/v2/PaymentService.js +627 -0
- package/dist/src/contracts/v2/Precompile.js +15 -0
- package/dist/src/contracts/v2/Transactable.js +82 -0
- package/dist/src/contracts/v2/UserSpace.js +29 -0
- package/dist/src/contracts/v2/Utils.js +18 -0
- package/dist/src/contracts/v2/Verifier.js +53 -0
- package/dist/src/contracts/v2/strings.js +4 -0
- package/dist/src/contracts/v3/AccessIndexor.js +774 -0
- package/dist/src/contracts/v3/Accessible.js +232 -0
- package/dist/src/contracts/v3/Adminable.js +107 -0
- package/dist/src/contracts/v3/AvailsDelivery.js +586 -0
- package/dist/src/contracts/v3/BaseAccessControlGroup.js +1603 -0
- package/dist/src/contracts/v3/BaseAccessWallet.js +1628 -0
- package/dist/src/contracts/v3/BaseAccessWalletFactory.js +112 -0
- package/dist/src/contracts/v3/BaseContent.js +1312 -0
- package/dist/src/contracts/v3/BaseContentFactory.js +183 -0
- package/dist/src/contracts/v3/BaseContentFactoryExt.js +175 -0
- package/dist/src/contracts/v3/BaseContentSpace.js +1515 -0
- package/dist/src/contracts/v3/BaseContentType.js +527 -0
- package/dist/src/contracts/v3/BaseFactory.js +126 -0
- package/dist/src/contracts/v3/BaseGroupFactory.js +112 -0
- package/dist/src/contracts/v3/BaseLibrary.js +1204 -0
- package/dist/src/contracts/v3/BaseLibraryFactory.js +115 -0
- package/dist/src/contracts/v3/BaseTenantSpace.js +1587 -0
- package/dist/src/contracts/v3/Certifyer.js +86 -0
- package/dist/src/contracts/v3/Container.js +739 -0
- package/dist/src/contracts/v3/Content.js +438 -0
- package/dist/src/contracts/v3/CounterObject.js +243 -0
- package/dist/src/contracts/v3/Editable.js +519 -0
- package/dist/src/contracts/v3/EncToken.js +4 -0
- package/dist/src/contracts/v3/ExternalUserWallet.js +587 -0
- package/dist/src/contracts/v3/IAdmin.js +18 -0
- package/dist/src/contracts/v3/IFactorySpace.js +57 -0
- package/dist/src/contracts/v3/IKmsSpace.js +52 -0
- package/dist/src/contracts/v3/INodeSpace.js +18 -0
- package/dist/src/contracts/v3/IUserSpace.js +32 -0
- package/dist/src/contracts/v3/LvRecordableStream.js +1032 -0
- package/dist/src/contracts/v3/LvRecording.js +650 -0
- package/dist/src/contracts/v3/LvStreamRightsHolder.js +557 -0
- package/dist/src/contracts/v3/MetaObject.js +144 -0
- package/dist/src/contracts/v3/Node.js +178 -0
- package/dist/src/contracts/v3/NodeSpace.js +284 -0
- package/dist/src/contracts/v3/Ownable.js +98 -0
- package/dist/src/contracts/v3/PaymentService.js +622 -0
- package/dist/src/contracts/v3/Precompile.js +26 -0
- package/dist/src/contracts/v3/TenantFuncsBase.js +351 -0
- package/dist/src/contracts/v3/Transactable.js +82 -0
- package/dist/src/contracts/v3/UserSpace.js +43 -0
- package/dist/src/contracts/v3/Utils.js +18 -0
- package/dist/src/contracts/v3/Verifier.js +53 -0
- package/dist/src/contracts/v3/strings.js +4 -0
- package/dist/src/contracts/v3b/BaseAccessControlGroup.js +1704 -0
- package/dist/src/events/Topics.js +1793 -0
- package/dist/src/index.js +8 -0
- package/dist/src/walletClient/ClientMethods.js +3102 -0
- package/dist/src/walletClient/Configuration.js +38 -0
- package/dist/src/walletClient/Notifications.js +168 -0
- package/dist/src/walletClient/Profile.js +332 -0
- package/dist/src/walletClient/Utils.js +281 -0
- package/dist/src/walletClient/index.js +2106 -0
- package/package.json +1 -1
- package/src/AuthorizationClient.js +24 -16
- package/src/ElvClient.js +19 -0
- package/src/client/ContentAccess.js +10 -1
- package/src/client/LiveConf.js +10 -8
- package/src/client/LiveStream.js +6 -4
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
};
|
package/src/client/LiveConf.js
CHANGED
|
@@ -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
|
|
502
|
+
let topLadderRate = 0;
|
|
503
|
+
for(let i = 0; i < ladderProfile.video.length; i ++) {
|
|
502
504
|
let elem = ladderProfile.video[i];
|
|
503
|
-
if
|
|
505
|
+
if(elem.height > videoStream.height)
|
|
504
506
|
continue;
|
|
505
|
-
if
|
|
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
|
|
529
|
+
for(let j = 0; j < ladderProfile.audio.length; j ++) {
|
|
528
530
|
let elem = ladderProfile.audio[j];
|
|
529
|
-
if
|
|
531
|
+
if(elem.channels == audio.recordingChannels) {
|
|
530
532
|
audioLadderSpec = {...elem};
|
|
531
533
|
break;
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
|
-
if
|
|
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
|
}
|
package/src/client/LiveStream.js
CHANGED
|
@@ -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) {
|