@eluvio/elv-client-js 4.2.14 → 4.2.16
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 +1 -1
- package/src/AuthorizationClient.js +2 -1
- package/src/ContentObjectAudit.js +4 -1
- package/src/ElvClient.js +8 -15
- package/src/HttpClient.js +17 -1
- package/src/NetworkUrls.js +9 -0
- package/src/client/ContentAccess.js +9 -22
- package/utilities/CompositionCreate.js +517 -0
- package/utilities/LibraryDownloadMp4.js +417 -0
- package/utilities/LibraryDownloadMp4Parallel.js +544 -0
- package/utilities/MezDownloadMp4.js +177 -0
- package/utilities/lib/DownloadFile.js +88 -0
- package/utilities/lib/FrameAccurateVideo.js +431 -0
- package/utilities/lib/concerns/Client.js +5 -0
- package/utilities/lib/concerns/Metadata.js +2 -1
package/package.json
CHANGED
|
@@ -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/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;
|
|
@@ -1505,6 +1505,7 @@ exports.PlayoutOptions = async function({
|
|
|
1505
1505
|
playoutMethods: {
|
|
1506
1506
|
...((playoutMap[protocol] || {}).playoutMethods || {}),
|
|
1507
1507
|
[drm || "clear"]: {
|
|
1508
|
+
properties: option.properties || {},
|
|
1508
1509
|
playoutUrl:
|
|
1509
1510
|
signedLink ?
|
|
1510
1511
|
await this.LinkUrl({
|
|
@@ -1785,17 +1786,14 @@ exports.GlobalUrl = async function({
|
|
|
1785
1786
|
);
|
|
1786
1787
|
|
|
1787
1788
|
// Pull auth out of query params
|
|
1788
|
-
if(
|
|
1789
|
-
queryParams.authorization &&
|
|
1790
|
-
(
|
|
1791
|
-
typeof queryParams.authorization === "string" ||
|
|
1792
|
-
(Array.isArray(queryParams.authorization) && queryParams.authorization.length === 1)
|
|
1793
|
-
)
|
|
1794
|
-
) {
|
|
1789
|
+
if(!queryParams.authorization) {
|
|
1795
1790
|
queryParams = {...queryParams};
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1791
|
+
queryParams.authorization = await this.authClient.AuthorizationToken({
|
|
1792
|
+
libraryId,
|
|
1793
|
+
objectId,
|
|
1794
|
+
versionHash,
|
|
1795
|
+
noAuth
|
|
1796
|
+
});
|
|
1799
1797
|
}
|
|
1800
1798
|
|
|
1801
1799
|
if(writeToken) {
|
|
@@ -1806,19 +1804,8 @@ exports.GlobalUrl = async function({
|
|
|
1806
1804
|
}
|
|
1807
1805
|
}
|
|
1808
1806
|
|
|
1807
|
+
console.log("Updated")
|
|
1809
1808
|
let urlPath = UrlJoin("s", network);
|
|
1810
|
-
if(!noAuth || authorizationToken) {
|
|
1811
|
-
urlPath = UrlJoin(
|
|
1812
|
-
"t",
|
|
1813
|
-
authorizationToken || await this.authClient.AuthorizationToken({
|
|
1814
|
-
libraryId,
|
|
1815
|
-
objectId,
|
|
1816
|
-
versionHash,
|
|
1817
|
-
noAuth
|
|
1818
|
-
})
|
|
1819
|
-
);
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
1809
|
if(versionHash) {
|
|
1823
1810
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1824
1811
|
} else {
|