@eluvio/elv-client-js 4.2.15 → 4.2.17
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 +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +2 -1
- package/dist/src/ContentObjectAudit.js +2 -1
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/ElvClient.js +8 -9
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +83 -47
- package/dist/src/NetworkUrls.js +8 -0
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/dist/src/client/ContentAccess.js +76 -85
- package/dist/src/client/LiveConf.js +170 -84
- package/dist/src/client/LiveStream.js +5205 -2118
- package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
- package/package.json +3 -2
- package/src/AuthorizationClient.js +2 -1
- package/src/ContentObjectAudit.js +4 -1
- package/src/ElvClient.js +8 -15
- package/src/FrameClient.js +23 -2
- package/src/HttpClient.js +17 -1
- package/src/NetworkUrls.js +9 -0
- package/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/src/client/ContentAccess.js +8 -23
- package/src/client/LiveConf.js +149 -65
- package/src/client/LiveStream.js +2592 -654
- package/src/live_recording_config_profiles/live_recording_config_default.js +54 -0
- package/src/live_recording_config_profiles/live_stream_profile_full.json +143 -0
- package/testScripts/StreamUpdateLinks.js +95 -0
- package/utilities/ChannelCreate.js +1 -1
- package/utilities/LibraryDownloadMp4.js +54 -8
- package/utilities/LibraryDownloadMp4Parallel.js +544 -0
- package/utilities/LiveOutputs.js +149 -0
- package/utilities/StreamCreate.js +53 -0
- package/utilities/lib/concerns/Client.js +5 -0
- package/utilities/lib/helpers.js +5 -1
- package/utilities/tests/mocks/ElvClient.mock.js +9 -1
- package/utilities/tests/unit/StreamCreate.test.js +39 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var LiveRecordingConfigDefault = {
|
|
2
|
+
drm_type: "clear",
|
|
3
|
+
recording_config: {
|
|
4
|
+
part_ttl: 86400,
|
|
5
|
+
reconnect_timeout: 3600,
|
|
6
|
+
connection_timeout: 3600,
|
|
7
|
+
copy_mpegts: false
|
|
8
|
+
},
|
|
9
|
+
profile: {
|
|
10
|
+
ladder_specs: {
|
|
11
|
+
audio: [{
|
|
12
|
+
bit_rate: 192000,
|
|
13
|
+
channels: 2,
|
|
14
|
+
codecs: "mp4a.40.2"
|
|
15
|
+
}, {
|
|
16
|
+
bit_rate: 384000,
|
|
17
|
+
channels: 6,
|
|
18
|
+
codecs: "mp4a.40.2"
|
|
19
|
+
}],
|
|
20
|
+
video: [{
|
|
21
|
+
bit_rate: 9500000,
|
|
22
|
+
codecs: "avc1.640028,mp4a.40.2",
|
|
23
|
+
height: 1080,
|
|
24
|
+
width: 1920
|
|
25
|
+
}, {
|
|
26
|
+
bit_rate: 4500000,
|
|
27
|
+
codecs: "avc1.640028,mp4a.40.2",
|
|
28
|
+
height: 720,
|
|
29
|
+
width: 1280
|
|
30
|
+
}, {
|
|
31
|
+
bit_rate: 2000000,
|
|
32
|
+
codecs: "avc1.640028,mp4a.40.2",
|
|
33
|
+
height: 540,
|
|
34
|
+
width: 960
|
|
35
|
+
}, {
|
|
36
|
+
bit_rate: 900000,
|
|
37
|
+
codecs: "avc1.640028,mp4a.40.2",
|
|
38
|
+
height: 540,
|
|
39
|
+
width: 960
|
|
40
|
+
}]
|
|
41
|
+
},
|
|
42
|
+
name: "Default"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
module.exports = LiveRecordingConfigDefault;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eluvio/elv-client-js",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.17",
|
|
4
4
|
"description": "Javascript client for the Eluvio Content Fabric",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Kevin Talmadge",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"lodash": "^4.17.19",
|
|
80
80
|
"lodash.isequal": "^4.5.0",
|
|
81
81
|
"mime-types": "^2.1.24",
|
|
82
|
+
"moment": "^2.27.0",
|
|
82
83
|
"multihashes": "^0.4.14",
|
|
83
84
|
"node-fetch": "^2.6.7",
|
|
84
85
|
"object-path": "^0.11.8",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"eslint": "^9.32.0",
|
|
113
114
|
"jsdoc": "^4.0.0",
|
|
114
115
|
"jsdom": "^26.1.0",
|
|
115
|
-
"
|
|
116
|
+
"mocha": "^11.7.5",
|
|
116
117
|
"raw-loader": "^0.5.1",
|
|
117
118
|
"shell-quote": "^1.7.2",
|
|
118
119
|
"showdown": "^1.9.1",
|
|
@@ -49,7 +49,10 @@ const ContentObjectAudit = {
|
|
|
49
49
|
]
|
|
50
50
|
.filter((v, i, s) => s.indexOf(v) === i);
|
|
51
51
|
|
|
52
|
-
const httpClient = new HttpClient({
|
|
52
|
+
const httpClient = new HttpClient({
|
|
53
|
+
uris,
|
|
54
|
+
networkName: client.networkName
|
|
55
|
+
});
|
|
53
56
|
|
|
54
57
|
let path = UrlJoin("qlibs", libraryId, "q", versionHash || objectId, live ? "call/live/audit" : "audit");
|
|
55
58
|
let responses = await httpClient.RequestAll({
|
package/src/ElvClient.js
CHANGED
|
@@ -11,6 +11,7 @@ const HttpClient = require("./HttpClient");
|
|
|
11
11
|
const RemoteSigner = require("./RemoteSigner");
|
|
12
12
|
const Utils = require("./Utils");
|
|
13
13
|
const Crypto = require("./Crypto");
|
|
14
|
+
const NetworkUrls = require("./NetworkUrls");
|
|
14
15
|
const {LogMessage} = require("./LogMessage");
|
|
15
16
|
|
|
16
17
|
const Pako = require("pako");
|
|
@@ -21,14 +22,6 @@ const {
|
|
|
21
22
|
} = require("./Validation");
|
|
22
23
|
const UrlJoin = require("url-join");
|
|
23
24
|
|
|
24
|
-
const networks = {
|
|
25
|
-
"main": "https://main.net955305.contentfabric.io",
|
|
26
|
-
"demo": "https://demov3.net955210.contentfabric.io",
|
|
27
|
-
"demov3": "https://demov3.net955210.contentfabric.io",
|
|
28
|
-
"local": "http://127.0.0.1:8008/config?qspace=dev&self",
|
|
29
|
-
"test": "https://test.net955203.contentfabric.io"
|
|
30
|
-
};
|
|
31
|
-
|
|
32
25
|
if(Utils.Platform() === Utils.PLATFORM_NODE) {
|
|
33
26
|
// Define Response in node
|
|
34
27
|
// eslint-disable-next-line no-global-assign
|
|
@@ -302,7 +295,7 @@ class ElvClient {
|
|
|
302
295
|
* @return {Object} - An object using network names as keys and configuration URLs as values.
|
|
303
296
|
*/
|
|
304
297
|
static Networks() {
|
|
305
|
-
return Object.assign({},
|
|
298
|
+
return Object.assign({}, NetworkUrls);
|
|
306
299
|
}
|
|
307
300
|
|
|
308
301
|
/**
|
|
@@ -332,7 +325,7 @@ class ElvClient {
|
|
|
332
325
|
noAuth=false,
|
|
333
326
|
assumeV3
|
|
334
327
|
}) {
|
|
335
|
-
const configUrl =
|
|
328
|
+
const configUrl = this.Networks()[networkName];
|
|
336
329
|
|
|
337
330
|
if(!configUrl) { throw Error("Invalid network name: " + networkName); }
|
|
338
331
|
|
|
@@ -430,10 +423,10 @@ class ElvClient {
|
|
|
430
423
|
this.inaccessibleLibraries = {};
|
|
431
424
|
|
|
432
425
|
const uris = this.service === "search" ? this.searchURIs : this.fabricURIs;
|
|
433
|
-
this.HttpClient = new HttpClient({uris, debug: this.debug});
|
|
434
|
-
this.AuthHttpClient = new HttpClient({uris: this.authServiceURIs, debug: this.debug});
|
|
435
|
-
this.FileServiceHttpClient = new HttpClient({uris: this.fileServiceURIs, debug: this.debug});
|
|
436
|
-
this.SearchHttpClient = new HttpClient({uris: this.searchURIs || [], debug: this.debug});
|
|
426
|
+
this.HttpClient = new HttpClient({uris, networkName: this.networkName, debug: this.debug});
|
|
427
|
+
this.AuthHttpClient = new HttpClient({uris: this.authServiceURIs, networkName: this.networkName, debug: this.debug});
|
|
428
|
+
this.FileServiceHttpClient = new HttpClient({uris: this.fileServiceURIs, networkName: this.networkName, debug: this.debug});
|
|
429
|
+
this.SearchHttpClient = new HttpClient({uris: this.searchURIs || [], networkName: this.networkName, debug: this.debug});
|
|
437
430
|
this.ethClient = new EthClient({client: this, uris: this.ethereumURIs, networkId: this.networkId, debug: this.debug, timeout: this.ethereumContractTimeout});
|
|
438
431
|
|
|
439
432
|
if(!this.signer) {
|
|
@@ -1224,7 +1217,7 @@ class ElvClient {
|
|
|
1224
1217
|
this.oauthToken = token;
|
|
1225
1218
|
|
|
1226
1219
|
const path = "/ks/jwt/wlt";
|
|
1227
|
-
const httpClient = new HttpClient({uris: this.kmsURIs, debug: this.debug});
|
|
1220
|
+
const httpClient = new HttpClient({uris: this.kmsURIs, networkName: this.networkName, debug: this.debug});
|
|
1228
1221
|
|
|
1229
1222
|
const response = await this.utils.ResponseToJson(
|
|
1230
1223
|
httpClient.Request({
|
package/src/FrameClient.js
CHANGED
|
@@ -447,6 +447,15 @@ class FrameClient {
|
|
|
447
447
|
"Nodes",
|
|
448
448
|
"NTPInstance",
|
|
449
449
|
"ObjectCleanup",
|
|
450
|
+
"OutputsCreate",
|
|
451
|
+
"OutputsDelete",
|
|
452
|
+
"OutputsList",
|
|
453
|
+
"OutputsListItem",
|
|
454
|
+
"OutputsModify",
|
|
455
|
+
"OutputsModifyBatch",
|
|
456
|
+
"OutputsResolveSrtPullUrls",
|
|
457
|
+
"OutputsState",
|
|
458
|
+
"OutputsStop",
|
|
450
459
|
"Permission",
|
|
451
460
|
"PlayoutOptions",
|
|
452
461
|
"PlayoutPathResolution",
|
|
@@ -472,6 +481,7 @@ class FrameClient {
|
|
|
472
481
|
"RevokeShare",
|
|
473
482
|
"SendFunds",
|
|
474
483
|
"SetAccessCharge",
|
|
484
|
+
"StreamApplyProfile",
|
|
475
485
|
"SetAuth",
|
|
476
486
|
"SetAuthContext",
|
|
477
487
|
"SetAuthPolicy",
|
|
@@ -496,17 +506,28 @@ class FrameClient {
|
|
|
496
506
|
"SpaceNodes",
|
|
497
507
|
"StartABRMezzanineJobs",
|
|
498
508
|
"StreamAddWatermark",
|
|
509
|
+
"StreamApplyProfile",
|
|
510
|
+
"StreamAssignProfile",
|
|
499
511
|
"StreamConfig",
|
|
512
|
+
"StreamConfigProfile",
|
|
513
|
+
"StreamConfigProfiles",
|
|
500
514
|
"StreamCopyToVod",
|
|
501
515
|
"StreamCreate",
|
|
502
516
|
"StreamInitialize",
|
|
503
517
|
"StreamInsertion",
|
|
518
|
+
"StreamLinkToSite",
|
|
504
519
|
"StreamListUrls",
|
|
520
|
+
"StreamRemoveLinkToSite",
|
|
505
521
|
"StreamRemoveWatermark",
|
|
522
|
+
"StreamSaveConfigProfile",
|
|
506
523
|
"StreamSetOfferingAndDRM",
|
|
507
|
-
"
|
|
524
|
+
"StreamSiteSettings",
|
|
525
|
+
"StreamStartRecording",
|
|
508
526
|
"StreamStartOrStopOrReset",
|
|
509
|
-
"
|
|
527
|
+
"StreamStatus",
|
|
528
|
+
"StreamStopRecording",
|
|
529
|
+
"StreamUnassignProfile",
|
|
530
|
+
"StreamUpdateConfig",
|
|
510
531
|
"SuspendNTPInstance",
|
|
511
532
|
"TenantContractId",
|
|
512
533
|
"TenantId",
|
package/src/HttpClient.js
CHANGED
|
@@ -2,17 +2,20 @@ const URI = require("urijs");
|
|
|
2
2
|
const Fetch = typeof fetch !== "undefined" ? fetch : require("node-fetch").default;
|
|
3
3
|
const {LogMessage} = require("./LogMessage");
|
|
4
4
|
const Utils = require("./Utils");
|
|
5
|
+
const UrlJoin = require("url-join");
|
|
6
|
+
const NetworkUrls = require("./NetworkUrls");
|
|
5
7
|
|
|
6
8
|
class HttpClient {
|
|
7
9
|
Log(message, error=false) {
|
|
8
10
|
LogMessage(this, message, error);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
constructor({uris, debug}) {
|
|
13
|
+
constructor({uris, networkName, debug}) {
|
|
12
14
|
this.uris = uris;
|
|
13
15
|
this.uriIndex = 0;
|
|
14
16
|
this.debug = debug;
|
|
15
17
|
this.draftURIs = {};
|
|
18
|
+
this.networkName = networkName;
|
|
16
19
|
this.retries = Math.max(3, uris.length);
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -77,6 +80,19 @@ class HttpClient {
|
|
|
77
80
|
// Use saved write token URI
|
|
78
81
|
baseURI = this.draftURIs[writeToken];
|
|
79
82
|
} else {
|
|
83
|
+
// Retrieve the node that this write token is for to ensure it is correct.
|
|
84
|
+
if(this.networkName) {
|
|
85
|
+
try {
|
|
86
|
+
const configUrl = new URL(NetworkUrls[this.networkName]);
|
|
87
|
+
configUrl.pathname = UrlJoin("/s", this.networkName, "nodes");
|
|
88
|
+
configUrl.searchParams.set("token", writeToken);
|
|
89
|
+
baseURI = new URI((await (await fetch(configUrl)).json()).nodes[0].services.fabric_api.urls[0]);
|
|
90
|
+
} catch(error) {
|
|
91
|
+
this.Log("Failed to retrieve write token node for " + writeToken);
|
|
92
|
+
this.Log(error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
80
96
|
// Save current URI for all future requests involving this write token
|
|
81
97
|
this.draftURIs[writeToken] = baseURI;
|
|
82
98
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const networks = {
|
|
2
|
+
"main": "https://main.net955305.contentfabric.io",
|
|
3
|
+
"demo": "https://demov3.net955210.contentfabric.io",
|
|
4
|
+
"demov3": "https://demov3.net955210.contentfabric.io",
|
|
5
|
+
"local": "http://127.0.0.1:8008/config?qspace=dev&self",
|
|
6
|
+
"test": "https://test.net955203.contentfabric.io"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
module.exports = networks;
|
|
@@ -1863,16 +1863,6 @@ const AbrProfileLiveDrm = {
|
|
|
1863
1863
|
}
|
|
1864
1864
|
},
|
|
1865
1865
|
"playout_formats": {
|
|
1866
|
-
"dash-playready-cenc": {
|
|
1867
|
-
"drm": {
|
|
1868
|
-
"enc_scheme_name": "cenc",
|
|
1869
|
-
"type": "DrmPlayReady"
|
|
1870
|
-
},
|
|
1871
|
-
"protocol": {
|
|
1872
|
-
"min_buffer_length": 2,
|
|
1873
|
-
"type": "ProtoDash"
|
|
1874
|
-
}
|
|
1875
|
-
},
|
|
1876
1866
|
"dash-widevine": {
|
|
1877
1867
|
"drm": {
|
|
1878
1868
|
"content_id": "",
|
|
@@ -1786,17 +1786,14 @@ exports.GlobalUrl = async function({
|
|
|
1786
1786
|
);
|
|
1787
1787
|
|
|
1788
1788
|
// Pull auth out of query params
|
|
1789
|
-
if(
|
|
1790
|
-
queryParams.authorization &&
|
|
1791
|
-
(
|
|
1792
|
-
typeof queryParams.authorization === "string" ||
|
|
1793
|
-
(Array.isArray(queryParams.authorization) && queryParams.authorization.length === 1)
|
|
1794
|
-
)
|
|
1795
|
-
) {
|
|
1789
|
+
if(!queryParams.authorization) {
|
|
1796
1790
|
queryParams = {...queryParams};
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1791
|
+
queryParams.authorization = await this.authClient.AuthorizationToken({
|
|
1792
|
+
libraryId,
|
|
1793
|
+
objectId,
|
|
1794
|
+
versionHash,
|
|
1795
|
+
noAuth
|
|
1796
|
+
});
|
|
1800
1797
|
}
|
|
1801
1798
|
|
|
1802
1799
|
if(writeToken) {
|
|
@@ -1808,18 +1805,6 @@ exports.GlobalUrl = async function({
|
|
|
1808
1805
|
}
|
|
1809
1806
|
|
|
1810
1807
|
let urlPath = UrlJoin("s", network);
|
|
1811
|
-
if(!noAuth || authorizationToken) {
|
|
1812
|
-
urlPath = UrlJoin(
|
|
1813
|
-
"t",
|
|
1814
|
-
authorizationToken || await this.authClient.AuthorizationToken({
|
|
1815
|
-
libraryId,
|
|
1816
|
-
objectId,
|
|
1817
|
-
versionHash,
|
|
1818
|
-
noAuth
|
|
1819
|
-
})
|
|
1820
|
-
);
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
1808
|
if(versionHash) {
|
|
1824
1809
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1825
1810
|
} else {
|
|
@@ -2838,7 +2823,7 @@ exports.EncryptionConk = async function({libraryId, objectId, versionHash, write
|
|
|
2838
2823
|
const owner = await this.authClient.Owner({id: objectId});
|
|
2839
2824
|
|
|
2840
2825
|
const ownerCapKey = `eluv.caps.iusr${this.utils.AddressToHash(this.signer.address)}`;
|
|
2841
|
-
const ownerCap = await this.ContentObjectMetadata({libraryId, objectId, versionHash, metadataSubtree: ownerCapKey});
|
|
2826
|
+
const ownerCap = await this.ContentObjectMetadata({libraryId, objectId, versionHash, writeToken, metadataSubtree: ownerCapKey});
|
|
2842
2827
|
|
|
2843
2828
|
if(!this.utils.EqualAddress(owner, this.signer.address) && !ownerCap) {
|
|
2844
2829
|
if(download) {
|