@eluvio/elv-client-js 4.0.87 → 4.0.89

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 (43) hide show
  1. package/dist/ElvClient-min.js +10 -10
  2. package/dist/ElvClient-node-min.js +11 -11
  3. package/dist/ElvFrameClient-min.js +7 -7
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +11 -11
  6. package/dist/ElvWalletClient-node-min.js +11 -11
  7. package/dist/src/ContentObjectAudit.js +163 -0
  8. package/dist/src/ElvClient.js +422 -444
  9. package/dist/src/FrameClient.js +1 -1
  10. package/dist/src/HttpClient.js +70 -9
  11. package/dist/src/RemoteSigner.js +162 -57
  12. package/dist/src/Validation.js +6 -2
  13. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +7 -0
  14. package/dist/src/client/ContentAccess.js +834 -770
  15. package/dist/src/client/ContentManagement.js +55 -3
  16. package/dist/src/client/Files.js +9 -6
  17. package/dist/src/client/LiveConf.js +144 -35
  18. package/dist/src/client/LiveStream.js +1104 -531
  19. package/dist/src/walletClient/index.js +366 -279
  20. package/package.json +1 -1
  21. package/src/ElvClient.js +1 -1
  22. package/src/Validation.js +5 -2
  23. package/src/client/ContentAccess.js +22 -13
  24. package/src/client/Files.js +7 -5
  25. package/src/client/LiveConf.js +0 -2
  26. package/src/client/LiveStream.js +3 -1
  27. package/testScripts/OfferingEnsureStrongDrm.js +2 -2
  28. package/testScripts/Test.js +3 -0
  29. package/testScripts/abr_profile_4k_both.json +18 -0
  30. package/testScripts/abr_profile_4k_drm.json +9 -0
  31. package/testScripts/abr_profile_4k_drm_public_access.json +18 -0
  32. package/testScripts/abr_profile_both.json +18 -0
  33. package/testScripts/abr_profile_drm.json +9 -0
  34. package/testScripts/abr_profile_drm_public_access.json +18 -0
  35. package/utilities/example_files/abr_profile_4k_both.json +18 -0
  36. package/utilities/example_files/abr_profile_4k_drm.json +9 -0
  37. package/utilities/example_files/abr_profile_4k_drm_public_access.json +18 -0
  38. package/utilities/example_files/abr_profile_4k_drm_strict.json +9 -0
  39. package/utilities/example_files/abr_profile_both.json +18 -0
  40. package/utilities/example_files/abr_profile_drm.json +9 -0
  41. package/utilities/example_files/abr_profile_drm_hls_only.json +9 -0
  42. package/utilities/example_files/abr_profile_drm_public_access.json +18 -0
  43. package/utilities/example_files/simple_ingest_library_metadata.json +9 -0
@@ -0,0 +1,163 @@
1
+ var _regeneratorRuntime = require("@babel/runtime/regenerator");
2
+ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
3
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
4
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ var UrlJoin = require("url-join");
8
+ var HttpClient = require("./HttpClient");
9
+ var UUID = require("uuid").v4;
10
+ var _require = require("./Validation"),
11
+ ValidateParameters = _require.ValidateParameters;
12
+ var ContentObjectAudit = {
13
+ AuditContentObject: function AuditContentObject(_ref) {
14
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
15
+ var client, libraryId, objectId, versionHash, salt, samples, _ref$live, live, queryParams, uris, httpClient, path, responses, auditHash, verified, audits, _iterator, _step, response, url, audit, res;
16
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ client = _ref.client, libraryId = _ref.libraryId, objectId = _ref.objectId, versionHash = _ref.versionHash, salt = _ref.salt, samples = _ref.samples, _ref$live = _ref.live, live = _ref$live === void 0 ? false : _ref$live;
20
+ if (!salt) {
21
+ salt = client.utils.B64(UUID());
22
+ }
23
+ if (!samples) {
24
+ samples = [Math.random() * 0.33, Math.random() * 0.33 + 0.33, Math.random() * 0.33 + 0.66];
25
+ }
26
+
27
+ // Ensure only a max of 3 samples
28
+ samples = samples.slice(0, 3);
29
+ if (versionHash) {
30
+ objectId = client.utils.DecodeVersionHash(versionHash).objectId;
31
+ }
32
+ if (libraryId) {
33
+ _context.next = 9;
34
+ break;
35
+ }
36
+ _context.next = 8;
37
+ return client.ContentObjectLibraryId({
38
+ objectId: objectId
39
+ });
40
+ case 8:
41
+ libraryId = _context.sent;
42
+ case 9:
43
+ ValidateParameters({
44
+ libraryId: libraryId,
45
+ objectId: objectId,
46
+ versionHash: versionHash
47
+ });
48
+ queryParams = {
49
+ salt: salt,
50
+ samples: samples
51
+ };
52
+ if (live) {
53
+ queryParams.now = Date.now();
54
+ }
55
+
56
+ // Test against the node the client is currently using, plus a batch of fresh nodes
57
+ _context.t0 = [client.HttpClient.uris[client.HttpClient.uriIndex]];
58
+ _context.t1 = _toConsumableArray;
59
+ _context.next = 16;
60
+ return client.Configuration({
61
+ configUrl: client.configUrl,
62
+ clientIP: client.clientIP,
63
+ region: client.region
64
+ });
65
+ case 16:
66
+ _context.t2 = _context.sent.fabricURIs;
67
+ _context.t3 = (0, _context.t1)(_context.t2);
68
+ uris = _context.t0.concat.call(_context.t0, _context.t3).filter(function (v, i, s) {
69
+ return s.indexOf(v) === i;
70
+ });
71
+ httpClient = new HttpClient({
72
+ uris: uris
73
+ });
74
+ path = UrlJoin("qlibs", libraryId, "q", versionHash || objectId, live ? "call/live/audit" : "audit");
75
+ _context.t4 = httpClient;
76
+ _context.next = 24;
77
+ return client.authClient.AuthorizationHeader({
78
+ libraryId: libraryId,
79
+ objectId: objectId,
80
+ versionHash: versionHash
81
+ });
82
+ case 24:
83
+ _context.t5 = _context.sent;
84
+ _context.t6 = queryParams;
85
+ _context.t7 = path;
86
+ _context.t8 = {
87
+ headers: _context.t5,
88
+ queryParams: _context.t6,
89
+ method: "GET",
90
+ path: _context.t7
91
+ };
92
+ _context.next = 30;
93
+ return _context.t4.RequestAll.call(_context.t4, _context.t8);
94
+ case 30:
95
+ responses = _context.sent;
96
+ audits = [];
97
+ _iterator = _createForOfIteratorHelper(responses);
98
+ _context.prev = 33;
99
+ _iterator.s();
100
+ case 35:
101
+ if ((_step = _iterator.n()).done) {
102
+ _context.next = 52;
103
+ break;
104
+ }
105
+ response = _step.value;
106
+ url = new URL(response.url);
107
+ audit = {
108
+ host: url.hostname
109
+ };
110
+ if (response.ok) {
111
+ _context.next = 44;
112
+ break;
113
+ }
114
+ audit.error = response;
115
+ audit.errorMessage = response.message || JSON.stringify(response);
116
+ _context.next = 49;
117
+ break;
118
+ case 44:
119
+ _context.next = 46;
120
+ return client.utils.ResponseToJson(response);
121
+ case 46:
122
+ res = _context.sent;
123
+ if (auditHash === undefined) {
124
+ auditHash = res.audit_hash;
125
+ } else if (res.audit_hash !== auditHash) {
126
+ verified = false;
127
+ } else if (verified === undefined) {
128
+ verified = true;
129
+ }
130
+ audit.audit_hash = res.audit_hash;
131
+ case 49:
132
+ audits.push(audit);
133
+ case 50:
134
+ _context.next = 35;
135
+ break;
136
+ case 52:
137
+ _context.next = 57;
138
+ break;
139
+ case 54:
140
+ _context.prev = 54;
141
+ _context.t9 = _context["catch"](33);
142
+ _iterator.e(_context.t9);
143
+ case 57:
144
+ _context.prev = 57;
145
+ _iterator.f();
146
+ return _context.finish(57);
147
+ case 60:
148
+ verified = verified || false;
149
+ return _context.abrupt("return", {
150
+ verified: verified,
151
+ salt: salt,
152
+ samples: samples,
153
+ audits: audits
154
+ });
155
+ case 62:
156
+ case "end":
157
+ return _context.stop();
158
+ }
159
+ }, _callee, null, [[33, 54, 57, 60]]);
160
+ }))();
161
+ }
162
+ };
163
+ module.exports = ContentObjectAudit;