@eluvio/elv-client-js 4.0.88 → 4.0.90

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 (58) hide show
  1. package/dist/ElvClient-min.js +15 -14
  2. package/dist/ElvClient-node-min.js +14 -13
  3. package/dist/ElvFrameClient-min.js +10 -10
  4. package/dist/ElvPermissionsClient-min.js +9 -9
  5. package/dist/ElvWalletClient-min.js +15 -14
  6. package/dist/ElvWalletClient-node-min.js +14 -13
  7. package/dist/src/AuthorizationClient.js +9 -12
  8. package/dist/src/ContentObjectAudit.js +3 -3
  9. package/dist/src/ContentObjectVerification.js +3 -3
  10. package/dist/src/Crypto.js +2 -2
  11. package/dist/src/ElvClient.js +47 -28
  12. package/dist/src/ElvWallet.js +7 -5
  13. package/dist/src/EthClient.js +8 -9
  14. package/dist/src/FrameClient.js +8 -9
  15. package/dist/src/HttpClient.js +27 -4
  16. package/dist/src/Id.js +1 -2
  17. package/dist/src/PermissionsClient.js +31 -19
  18. package/dist/src/RemoteSigner.js +6 -8
  19. package/dist/src/UserProfileClient.js +35 -19
  20. package/dist/src/Utils.js +62 -28
  21. package/dist/src/client/ABRPublishing.js +2 -2
  22. package/dist/src/client/AccessGroups.js +2 -2
  23. package/dist/src/client/ContentAccess.js +104 -104
  24. package/dist/src/client/ContentManagement.js +25 -23
  25. package/dist/src/client/Contracts.js +2 -2
  26. package/dist/src/client/Files.js +77 -88
  27. package/dist/src/client/LiveConf.js +3 -7
  28. package/dist/src/client/LiveStream.js +35 -36
  29. package/dist/src/client/NFT.js +2 -2
  30. package/dist/src/walletClient/ClientMethods.js +2 -2
  31. package/dist/src/walletClient/Profile.js +2 -2
  32. package/dist/src/walletClient/Utils.js +2 -2
  33. package/dist/src/walletClient/index.js +17 -14
  34. package/package.json +1 -1
  35. package/src/HttpClient.js +16 -2
  36. package/src/Utils.js +27 -5
  37. package/src/client/ContentAccess.js +85 -93
  38. package/src/client/ContentManagement.js +25 -11
  39. package/src/client/Files.js +43 -51
  40. package/src/client/LiveConf.js +0 -2
  41. package/src/client/LiveStream.js +7 -3
  42. package/testScripts/OfferingEnsureStrongDrm.js +2 -2
  43. package/testScripts/Test.js +3 -0
  44. package/testScripts/abr_profile_4k_both.json +18 -0
  45. package/testScripts/abr_profile_4k_drm.json +9 -0
  46. package/testScripts/abr_profile_4k_drm_public_access.json +18 -0
  47. package/testScripts/abr_profile_both.json +18 -0
  48. package/testScripts/abr_profile_drm.json +9 -0
  49. package/testScripts/abr_profile_drm_public_access.json +18 -0
  50. package/utilities/example_files/abr_profile_4k_both.json +18 -0
  51. package/utilities/example_files/abr_profile_4k_drm.json +9 -0
  52. package/utilities/example_files/abr_profile_4k_drm_public_access.json +18 -0
  53. package/utilities/example_files/abr_profile_4k_drm_strict.json +9 -0
  54. package/utilities/example_files/abr_profile_both.json +18 -0
  55. package/utilities/example_files/abr_profile_drm.json +9 -0
  56. package/utilities/example_files/abr_profile_drm_hls_only.json +9 -0
  57. package/utilities/example_files/abr_profile_drm_public_access.json +18 -0
  58. package/utilities/example_files/simple_ingest_library_metadata.json +9 -0
@@ -45,13 +45,11 @@ exports.ListFiles = async function({libraryId, objectId, path = "", versionHash,
45
45
 
46
46
  let urlPath = UrlJoin("q", writeToken || versionHash || objectId, "files_list", path);
47
47
 
48
- return this.utils.ResponseToJson(
49
- this.HttpClient.Request({
50
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
51
- method: "GET",
52
- path: urlPath,
53
- })
54
- );
48
+ return this.HttpClient.RequestJsonBody({
49
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
50
+ method: "GET",
51
+ path: urlPath,
52
+ });
55
53
  };
56
54
 
57
55
  /**
@@ -121,7 +119,11 @@ exports.UploadFilesFromS3 = async function({
121
119
  }
122
120
  }
123
121
 
124
- this.Log(`Uploading files from S3: ${libraryId} ${objectId} ${writeToken}`);
122
+ if(copy) {
123
+ this.Log(`Copying files from S3: ${libraryId} ${objectId} ${writeToken}`);
124
+ } else {
125
+ this.Log(`Adding links to files in S3: ${libraryId} ${objectId} ${writeToken}`);
126
+ }
125
127
 
126
128
  let encryption_key;
127
129
  if(encryption === "cgck") {
@@ -485,15 +487,13 @@ exports.CreateFileUploadJob = async function({libraryId, objectId, writeToken, o
485
487
 
486
488
  const path = UrlJoin("q", writeToken, "file_jobs");
487
489
 
488
- return this.utils.ResponseToJson(
489
- this.HttpClient.Request({
490
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
491
- method: "POST",
492
- path: path,
493
- body,
494
- allowFailover: false
495
- })
496
- );
490
+ return this.HttpClient.RequestJsonBody({
491
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
492
+ method: "POST",
493
+ path: path,
494
+ body,
495
+ allowFailover: false
496
+ });
497
497
  };
498
498
 
499
499
  exports.UploadStatus = async function({libraryId, objectId, writeToken, uploadId}) {
@@ -815,13 +815,11 @@ exports.ContentParts = async function({libraryId, objectId, versionHash}) {
815
815
 
816
816
  const path = UrlJoin("q", versionHash || objectId, "parts");
817
817
 
818
- const response = await this.utils.ResponseToJson(
819
- this.HttpClient.Request({
820
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
821
- method: "GET",
822
- path: path
823
- })
824
- );
818
+ const response = await this.HttpClient.RequestJsonBody({
819
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
820
+ method: "GET",
821
+ path: path
822
+ });
825
823
 
826
824
  return response.parts;
827
825
  };
@@ -849,13 +847,11 @@ exports.ContentPart = async function({libraryId, objectId, versionHash, partHash
849
847
 
850
848
  let path = UrlJoin("q", versionHash || objectId, "parts", partHash);
851
849
 
852
- return await this.utils.ResponseToJson(
853
- this.HttpClient.Request({
854
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
855
- method: "GET",
856
- path: path
857
- })
858
- );
850
+ return await this.HttpClient.RequestJsonBody({
851
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
852
+ method: "GET",
853
+ path: path
854
+ });
859
855
  };
860
856
 
861
857
  /**
@@ -1079,16 +1075,14 @@ exports.CreatePart = async function({libraryId, objectId, writeToken, encryption
1079
1075
 
1080
1076
  const path = UrlJoin("q", writeToken, "parts");
1081
1077
 
1082
- const openResponse = await this.utils.ResponseToJson(
1083
- this.HttpClient.Request({
1084
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
1085
- method: "POST",
1086
- path,
1087
- bodyType: "BINARY",
1088
- body: "",
1089
- allowFailover: false
1090
- })
1091
- );
1078
+ const openResponse = await this.HttpClient.RequestJsonBody({
1079
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
1080
+ method: "POST",
1081
+ path,
1082
+ bodyType: "BINARY",
1083
+ body: "",
1084
+ allowFailover: false
1085
+ });
1092
1086
 
1093
1087
  return openResponse.part.write_token;
1094
1088
  };
@@ -1149,16 +1143,14 @@ exports.FinalizePart = async function({libraryId, objectId, writeToken, partWrit
1149
1143
  ValidateWriteToken(writeToken);
1150
1144
 
1151
1145
  const path = UrlJoin("q", writeToken, "parts");
1152
- return await this.utils.ResponseToJson(
1153
- await this.HttpClient.Request({
1154
- headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
1155
- method: "POST",
1156
- path: UrlJoin(path, partWriteToken),
1157
- bodyType: "BINARY",
1158
- body: "",
1159
- allowFailover: false
1160
- })
1161
- );
1146
+ return await this.HttpClient.RequestJsonBody({
1147
+ headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true, encryption}),
1148
+ method: "POST",
1149
+ path: UrlJoin(path, partWriteToken),
1150
+ bodyType: "BINARY",
1151
+ body: "",
1152
+ allowFailover: false
1153
+ });
1162
1154
  };
1163
1155
 
1164
1156
  /**
@@ -301,7 +301,6 @@ class LiveConf {
301
301
  break;
302
302
  default:
303
303
  throw "unsupported frame rate for MPEGTS - " + frameRate;
304
- break;
305
304
  }
306
305
  return seg;
307
306
  }
@@ -362,7 +361,6 @@ class LiveConf {
362
361
  break;
363
362
  default:
364
363
  throw "unsupported frame rate for RTMP - " + frameRate;
365
- break;
366
364
  }
367
365
  return seg;
368
366
  }
@@ -498,8 +498,8 @@ exports.StreamStatus = async function({name, stopLro=false, showParams=false}) {
498
498
  state = lroStatus.state;
499
499
  status.warnings = lroStatus.custom && lroStatus.custom.warnings;
500
500
  status.quality = lroStatus.custom && lroStatus.custom.quality;
501
- if (lroStatus.custom && lroStatus.custom.status) {
502
- status.recording_status = lroStatus.custom.status
501
+ if(lroStatus.custom && lroStatus.custom.status) {
502
+ status.recording_status = lroStatus.custom.status;
503
503
  }
504
504
  } catch(error) {
505
505
  console.log("LRO Status (failed): ", error.response.statusCode);
@@ -1350,7 +1350,11 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
1350
1350
  status.user_config = userConfig;
1351
1351
 
1352
1352
  // Get node URI from user config
1353
- const hostName = userConfig.url.replace("udp://", "").replace("rtmp://", "").replace("srt://", "").split(":")[0];
1353
+ const parsedName = userConfig.url
1354
+ .replace("udp://", "https://")
1355
+ .replace("rtmp://", "https://")
1356
+ .replace("srt://", "https://");
1357
+ const hostName = new URL(parsedName).hostname;
1354
1358
  const streamUrl = new URL(userConfig.url);
1355
1359
 
1356
1360
  console.log("Retrieving nodes - matching", hostName);
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
- // Ensures that an existing offering has only strong DRM playout options (Widevine and Fairplay)
3
+ // Ensures that an existing offering has only strong DRM playout options (FairPlay, PlayReady, and Widevine)
4
4
 
5
5
  const ScriptOffering = require("./parentClasses/ScriptOffering");
6
6
 
@@ -49,7 +49,7 @@ class OfferingEnsureStrongDrm extends ScriptOffering {
49
49
  for(let i = 0; i < originalFormatCount; i++) {
50
50
  const key = playoutFormatKeys[i];
51
51
  const drm = metadata.offerings[offeringKey].playout.playout_formats[key].drm;
52
- if(!drm || !["DrmWidevine", "DrmFairplay"].includes(drm.type)) {
52
+ if(!drm || !["DrmWidevine", "DrmFairplay", "DrmPlayReady"].includes(drm.type)) {
53
53
  console.log("Deleting playout format '" + key + "'...");
54
54
  delete metadata.offerings[offeringKey].playout.playout_formats[key];
55
55
  changesMade = true;
@@ -9,6 +9,9 @@ const Test = async () => {
9
9
  const client = await ElvClient.FromNetworkName({
10
10
  networkName: "demo"
11
11
  });
12
+ // const client = await ElvClient.FromConfigurationUrl({
13
+ // configUrl: "http://localhost:8008/config?qspace=demov3&self"
14
+ // });
12
15
 
13
16
  const wallet = client.GenerateWallet();
14
17
  const signer = wallet.AddAccount({
@@ -126,6 +126,24 @@
126
126
  "protocol": {
127
127
  "type": "ProtoHls"
128
128
  }
129
+ },
130
+ "hls-fairplay": {
131
+ "drm": {
132
+ "enc_scheme_name": "cbcs",
133
+ "type": "DrmFairplay"
134
+ },
135
+ "protocol": {
136
+ "type": "ProtoHls"
137
+ }
138
+ },
139
+ "hls-playready-cenc": {
140
+ "drm": {
141
+ "enc_scheme_name": "cenc",
142
+ "type": "DrmPlayReady"
143
+ },
144
+ "protocol": {
145
+ "type": "ProtoHls"
146
+ }
129
147
  }
130
148
  },
131
149
  "segment_specs": {
@@ -123,6 +123,15 @@
123
123
  "protocol": {
124
124
  "type": "ProtoHls"
125
125
  }
126
+ },
127
+ "hls-playready-cenc": {
128
+ "drm": {
129
+ "enc_scheme_name": "cenc",
130
+ "type": "DrmPlayReady"
131
+ },
132
+ "protocol": {
133
+ "type": "ProtoHls"
134
+ }
126
135
  }
127
136
  },
128
137
  "segment_specs": {
@@ -113,6 +113,24 @@
113
113
  "protocol": {
114
114
  "type": "ProtoHls"
115
115
  }
116
+ },
117
+ "hls-fairplay": {
118
+ "drm": {
119
+ "enc_scheme_name": "cbcs",
120
+ "type": "DrmFairplay"
121
+ },
122
+ "protocol": {
123
+ "type": "ProtoHls"
124
+ }
125
+ },
126
+ "hls-playready-cenc": {
127
+ "drm": {
128
+ "enc_scheme_name": "cenc",
129
+ "type": "DrmPlayReady"
130
+ },
131
+ "protocol": {
132
+ "type": "ProtoHls"
133
+ }
116
134
  }
117
135
  },
118
136
  "segment_specs": {
@@ -1960,6 +1960,24 @@
1960
1960
  "protocol": {
1961
1961
  "type": "ProtoHls"
1962
1962
  }
1963
+ },
1964
+ "hls-fairplay": {
1965
+ "drm": {
1966
+ "enc_scheme_name": "cbcs",
1967
+ "type": "DrmFairplay"
1968
+ },
1969
+ "protocol": {
1970
+ "type": "ProtoHls"
1971
+ }
1972
+ },
1973
+ "hls-playready-cenc": {
1974
+ "drm": {
1975
+ "enc_scheme_name": "cenc",
1976
+ "type": "DrmPlayReady"
1977
+ },
1978
+ "protocol": {
1979
+ "type": "ProtoHls"
1980
+ }
1963
1981
  }
1964
1982
  },
1965
1983
  "segment_specs": {
@@ -1957,6 +1957,15 @@
1957
1957
  "protocol": {
1958
1958
  "type": "ProtoHls"
1959
1959
  }
1960
+ },
1961
+ "hls-playready-cenc": {
1962
+ "drm": {
1963
+ "enc_scheme_name": "cenc",
1964
+ "type": "DrmPlayReady"
1965
+ },
1966
+ "protocol": {
1967
+ "type": "ProtoHls"
1968
+ }
1960
1969
  }
1961
1970
  },
1962
1971
  "segment_specs": {
@@ -1947,6 +1947,24 @@
1947
1947
  "protocol": {
1948
1948
  "type": "ProtoHls"
1949
1949
  }
1950
+ },
1951
+ "hls-fairplay": {
1952
+ "drm": {
1953
+ "enc_scheme_name": "cbcs",
1954
+ "type": "DrmFairplay"
1955
+ },
1956
+ "protocol": {
1957
+ "type": "ProtoHls"
1958
+ }
1959
+ },
1960
+ "hls-playready-cenc": {
1961
+ "drm": {
1962
+ "enc_scheme_name": "cenc",
1963
+ "type": "DrmPlayReady"
1964
+ },
1965
+ "protocol": {
1966
+ "type": "ProtoHls"
1967
+ }
1950
1968
  }
1951
1969
  },
1952
1970
  "segment_specs": {
@@ -126,6 +126,24 @@
126
126
  "protocol": {
127
127
  "type": "ProtoHls"
128
128
  }
129
+ },
130
+ "hls-fairplay": {
131
+ "drm": {
132
+ "enc_scheme_name": "cbcs",
133
+ "type": "DrmFairplay"
134
+ },
135
+ "protocol": {
136
+ "type": "ProtoHls"
137
+ }
138
+ },
139
+ "hls-playready-cenc": {
140
+ "drm": {
141
+ "enc_scheme_name": "cenc",
142
+ "type": "DrmPlayReady"
143
+ },
144
+ "protocol": {
145
+ "type": "ProtoHls"
146
+ }
129
147
  }
130
148
  },
131
149
  "segment_specs": {
@@ -123,6 +123,15 @@
123
123
  "protocol": {
124
124
  "type": "ProtoHls"
125
125
  }
126
+ },
127
+ "hls-playready-cenc": {
128
+ "drm": {
129
+ "enc_scheme_name": "cenc",
130
+ "type": "DrmPlayReady"
131
+ },
132
+ "protocol": {
133
+ "type": "ProtoHls"
134
+ }
126
135
  }
127
136
  },
128
137
  "segment_specs": {
@@ -113,6 +113,24 @@
113
113
  "protocol": {
114
114
  "type": "ProtoHls"
115
115
  }
116
+ },
117
+ "hls-fairplay": {
118
+ "drm": {
119
+ "enc_scheme_name": "cbcs",
120
+ "type": "DrmFairplay"
121
+ },
122
+ "protocol": {
123
+ "type": "ProtoHls"
124
+ }
125
+ },
126
+ "hls-playready-cenc": {
127
+ "drm": {
128
+ "enc_scheme_name": "cenc",
129
+ "type": "DrmPlayReady"
130
+ },
131
+ "protocol": {
132
+ "type": "ProtoHls"
133
+ }
116
134
  }
117
135
  },
118
136
  "segment_specs": {
@@ -105,6 +105,15 @@
105
105
  "protocol": {
106
106
  "type": "ProtoHls"
107
107
  }
108
+ },
109
+ "hls-playready-cenc": {
110
+ "drm": {
111
+ "enc_scheme_name": "cenc",
112
+ "type": "DrmPlayReady"
113
+ },
114
+ "protocol": {
115
+ "type": "ProtoHls"
116
+ }
108
117
  }
109
118
  },
110
119
  "segment_specs": {
@@ -1914,6 +1914,24 @@
1914
1914
  "protocol": {
1915
1915
  "type": "ProtoHls"
1916
1916
  }
1917
+ },
1918
+ "hls-fairplay": {
1919
+ "drm": {
1920
+ "enc_scheme_name": "cbcs",
1921
+ "type": "DrmFairplay"
1922
+ },
1923
+ "protocol": {
1924
+ "type": "ProtoHls"
1925
+ }
1926
+ },
1927
+ "hls-playready-cenc": {
1928
+ "drm": {
1929
+ "enc_scheme_name": "cenc",
1930
+ "type": "DrmPlayReady"
1931
+ },
1932
+ "protocol": {
1933
+ "type": "ProtoHls"
1934
+ }
1917
1935
  }
1918
1936
  },
1919
1937
  "segment_specs": {
@@ -1911,6 +1911,15 @@
1911
1911
  "protocol": {
1912
1912
  "type": "ProtoHls"
1913
1913
  }
1914
+ },
1915
+ "hls-playready-cenc": {
1916
+ "drm": {
1917
+ "enc_scheme_name": "cenc",
1918
+ "type": "DrmPlayReady"
1919
+ },
1920
+ "protocol": {
1921
+ "type": "ProtoHls"
1922
+ }
1914
1923
  }
1915
1924
  },
1916
1925
  "segment_specs": {
@@ -1899,6 +1899,15 @@
1899
1899
  "protocol": {
1900
1900
  "type": "ProtoHls"
1901
1901
  }
1902
+ },
1903
+ "hls-playready-cenc": {
1904
+ "drm": {
1905
+ "enc_scheme_name": "cenc",
1906
+ "type": "DrmPlayReady"
1907
+ },
1908
+ "protocol": {
1909
+ "type": "ProtoHls"
1910
+ }
1902
1911
  }
1903
1912
  },
1904
1913
  "segment_specs": {
@@ -1901,6 +1901,24 @@
1901
1901
  "protocol": {
1902
1902
  "type": "ProtoHls"
1903
1903
  }
1904
+ },
1905
+ "hls-fairplay": {
1906
+ "drm": {
1907
+ "enc_scheme_name": "cbcs",
1908
+ "type": "DrmFairplay"
1909
+ },
1910
+ "protocol": {
1911
+ "type": "ProtoHls"
1912
+ }
1913
+ },
1914
+ "hls-playready-cenc": {
1915
+ "drm": {
1916
+ "enc_scheme_name": "cenc",
1917
+ "type": "DrmPlayReady"
1918
+ },
1919
+ "protocol": {
1920
+ "type": "ProtoHls"
1921
+ }
1904
1922
  }
1905
1923
  },
1906
1924
  "segment_specs": {
@@ -154,6 +154,15 @@
154
154
  "protocol": {
155
155
  "type": "ProtoHls"
156
156
  }
157
+ },
158
+ "hls-playready-cenc": {
159
+ "drm": {
160
+ "enc_scheme_name": "cenc",
161
+ "type": "DrmPlayReady"
162
+ },
163
+ "protocol": {
164
+ "type": "ProtoHls"
165
+ }
157
166
  }
158
167
  },
159
168
  "segment_specs": {