@eluvio/elv-client-js 4.0.91 → 4.0.92
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 +2 -2
- package/dist/ElvClient-node-min.js +2 -2
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +2 -2
- package/dist/ElvWalletClient-node-min.js +2 -2
- package/dist/src/ContentObjectAudit.js +48 -36
- package/dist/src/client/ContentAccess.js +5 -3
- package/dist/src/client/LiveStream.js +5 -3
- package/package.json +1 -1
- package/src/ContentObjectAudit.js +4 -2
- package/src/client/ContentAccess.js +4 -2
- package/src/client/LiveStream.js +4 -2
|
@@ -12,11 +12,11 @@ var _require = require("./Validation"),
|
|
|
12
12
|
var ContentObjectAudit = {
|
|
13
13
|
AuditContentObject: function AuditContentObject(_ref) {
|
|
14
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;
|
|
15
|
+
var client, libraryId, objectId, versionHash, salt, samples, _ref$live, live, authorizationToken, queryParams, uris, httpClient, path, responses, auditHash, verified, audits, _iterator, _step, response, url, audit, res;
|
|
16
16
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
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;
|
|
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, authorizationToken = _ref.authorizationToken;
|
|
20
20
|
if (!salt) {
|
|
21
21
|
salt = client.utils.B64(UUID());
|
|
22
22
|
}
|
|
@@ -73,33 +73,45 @@ var ContentObjectAudit = {
|
|
|
73
73
|
});
|
|
74
74
|
path = UrlJoin("qlibs", libraryId, "q", versionHash || objectId, live ? "call/live/audit" : "audit");
|
|
75
75
|
_context.t4 = httpClient;
|
|
76
|
-
|
|
76
|
+
if (!authorizationToken) {
|
|
77
|
+
_context.next = 26;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
_context.t5 = {
|
|
81
|
+
Authorization: "Bearer ".concat(authorizationToken)
|
|
82
|
+
};
|
|
83
|
+
_context.next = 29;
|
|
84
|
+
break;
|
|
85
|
+
case 26:
|
|
86
|
+
_context.next = 28;
|
|
77
87
|
return client.authClient.AuthorizationHeader({
|
|
78
88
|
libraryId: libraryId,
|
|
79
89
|
objectId: objectId,
|
|
80
90
|
versionHash: versionHash
|
|
81
91
|
});
|
|
82
|
-
case
|
|
92
|
+
case 28:
|
|
83
93
|
_context.t5 = _context.sent;
|
|
84
|
-
|
|
85
|
-
_context.
|
|
86
|
-
_context.
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
case 29:
|
|
95
|
+
_context.t6 = _context.t5;
|
|
96
|
+
_context.t7 = queryParams;
|
|
97
|
+
_context.t8 = path;
|
|
98
|
+
_context.t9 = {
|
|
99
|
+
headers: _context.t6,
|
|
100
|
+
queryParams: _context.t7,
|
|
89
101
|
method: "GET",
|
|
90
|
-
path: _context.
|
|
102
|
+
path: _context.t8
|
|
91
103
|
};
|
|
92
|
-
_context.next =
|
|
93
|
-
return _context.t4.RequestAll.call(_context.t4, _context.
|
|
94
|
-
case
|
|
104
|
+
_context.next = 35;
|
|
105
|
+
return _context.t4.RequestAll.call(_context.t4, _context.t9);
|
|
106
|
+
case 35:
|
|
95
107
|
responses = _context.sent;
|
|
96
108
|
audits = [];
|
|
97
109
|
_iterator = _createForOfIteratorHelper(responses);
|
|
98
|
-
_context.prev =
|
|
110
|
+
_context.prev = 38;
|
|
99
111
|
_iterator.s();
|
|
100
|
-
case
|
|
112
|
+
case 40:
|
|
101
113
|
if ((_step = _iterator.n()).done) {
|
|
102
|
-
_context.next =
|
|
114
|
+
_context.next = 57;
|
|
103
115
|
break;
|
|
104
116
|
}
|
|
105
117
|
response = _step.value;
|
|
@@ -108,17 +120,17 @@ var ContentObjectAudit = {
|
|
|
108
120
|
host: url.hostname
|
|
109
121
|
};
|
|
110
122
|
if (response.ok) {
|
|
111
|
-
_context.next =
|
|
123
|
+
_context.next = 49;
|
|
112
124
|
break;
|
|
113
125
|
}
|
|
114
126
|
audit.error = response;
|
|
115
127
|
audit.errorMessage = response.message || JSON.stringify(response);
|
|
116
|
-
_context.next =
|
|
128
|
+
_context.next = 54;
|
|
117
129
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context.next =
|
|
130
|
+
case 49:
|
|
131
|
+
_context.next = 51;
|
|
120
132
|
return client.utils.ResponseToJson(response);
|
|
121
|
-
case
|
|
133
|
+
case 51:
|
|
122
134
|
res = _context.sent;
|
|
123
135
|
if (auditHash === undefined) {
|
|
124
136
|
auditHash = res.audit_hash;
|
|
@@ -128,23 +140,23 @@ var ContentObjectAudit = {
|
|
|
128
140
|
verified = true;
|
|
129
141
|
}
|
|
130
142
|
audit.audit_hash = res.audit_hash;
|
|
131
|
-
case
|
|
143
|
+
case 54:
|
|
132
144
|
audits.push(audit);
|
|
133
|
-
case
|
|
134
|
-
_context.next =
|
|
135
|
-
break;
|
|
136
|
-
case 52:
|
|
137
|
-
_context.next = 57;
|
|
145
|
+
case 55:
|
|
146
|
+
_context.next = 40;
|
|
138
147
|
break;
|
|
139
|
-
case 54:
|
|
140
|
-
_context.prev = 54;
|
|
141
|
-
_context.t9 = _context["catch"](33);
|
|
142
|
-
_iterator.e(_context.t9);
|
|
143
148
|
case 57:
|
|
144
|
-
_context.
|
|
149
|
+
_context.next = 62;
|
|
150
|
+
break;
|
|
151
|
+
case 59:
|
|
152
|
+
_context.prev = 59;
|
|
153
|
+
_context.t10 = _context["catch"](38);
|
|
154
|
+
_iterator.e(_context.t10);
|
|
155
|
+
case 62:
|
|
156
|
+
_context.prev = 62;
|
|
145
157
|
_iterator.f();
|
|
146
|
-
return _context.finish(
|
|
147
|
-
case
|
|
158
|
+
return _context.finish(62);
|
|
159
|
+
case 65:
|
|
148
160
|
verified = verified || false;
|
|
149
161
|
return _context.abrupt("return", {
|
|
150
162
|
verified: verified,
|
|
@@ -152,11 +164,11 @@ var ContentObjectAudit = {
|
|
|
152
164
|
samples: samples,
|
|
153
165
|
audits: audits
|
|
154
166
|
});
|
|
155
|
-
case
|
|
167
|
+
case 67:
|
|
156
168
|
case "end":
|
|
157
169
|
return _context.stop();
|
|
158
170
|
}
|
|
159
|
-
}, _callee, null, [[
|
|
171
|
+
}, _callee, null, [[38, 59, 62, 65]]);
|
|
160
172
|
}))();
|
|
161
173
|
}
|
|
162
174
|
};
|
|
@@ -4811,16 +4811,17 @@ exports.Collection = /*#__PURE__*/function () {
|
|
|
4811
4811
|
* @param {string=} versionHash - Version hash of the object -- if not specified, latest version is returned
|
|
4812
4812
|
* @param {string=} salt - base64-encoded byte sequence for salting the audit hash
|
|
4813
4813
|
* @param {Array<number>=} samples - list of percentages (0.0 - <1.0) used for sampling the content part list, up to 3
|
|
4814
|
+
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
4814
4815
|
*
|
|
4815
4816
|
* @returns {Promise<Object>} - Response describing audit results
|
|
4816
4817
|
*/
|
|
4817
4818
|
exports.AuditContentObject = /*#__PURE__*/function () {
|
|
4818
4819
|
var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref108) {
|
|
4819
|
-
var libraryId, objectId, versionHash, salt, samples;
|
|
4820
|
+
var libraryId, objectId, versionHash, salt, samples, authorizationToken;
|
|
4820
4821
|
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
|
|
4821
4822
|
while (1) switch (_context59.prev = _context59.next) {
|
|
4822
4823
|
case 0:
|
|
4823
|
-
libraryId = _ref108.libraryId, objectId = _ref108.objectId, versionHash = _ref108.versionHash, salt = _ref108.salt, samples = _ref108.samples;
|
|
4824
|
+
libraryId = _ref108.libraryId, objectId = _ref108.objectId, versionHash = _ref108.versionHash, salt = _ref108.salt, samples = _ref108.samples, authorizationToken = _ref108.authorizationToken;
|
|
4824
4825
|
_context59.next = 3;
|
|
4825
4826
|
return ContentObjectAudit.AuditContentObject({
|
|
4826
4827
|
client: this,
|
|
@@ -4828,7 +4829,8 @@ exports.AuditContentObject = /*#__PURE__*/function () {
|
|
|
4828
4829
|
objectId: objectId,
|
|
4829
4830
|
versionHash: versionHash,
|
|
4830
4831
|
salt: salt,
|
|
4831
|
-
samples: samples
|
|
4832
|
+
samples: samples,
|
|
4833
|
+
authorizationToken: authorizationToken
|
|
4832
4834
|
});
|
|
4833
4835
|
case 3:
|
|
4834
4836
|
return _context59.abrupt("return", _context59.sent);
|
|
@@ -2497,16 +2497,17 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2497
2497
|
* @param {string=} versionHash - Version hash of the live stream -- if not specified, latest version is returned
|
|
2498
2498
|
* @param {string=} salt - base64-encoded byte sequence for salting the audit hash
|
|
2499
2499
|
* @param {Array<number>=} samples - list of percentages (0.0 - <1.0) used for sampling the content part list, up to 3
|
|
2500
|
+
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
2500
2501
|
*
|
|
2501
2502
|
* @returns {Promise<Object>} - Response describing audit results
|
|
2502
2503
|
*/
|
|
2503
2504
|
exports.AuditStream = /*#__PURE__*/function () {
|
|
2504
2505
|
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref32) {
|
|
2505
|
-
var objectId, versionHash, salt, samples;
|
|
2506
|
+
var objectId, versionHash, salt, samples, authorizationToken;
|
|
2506
2507
|
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
2507
2508
|
while (1) switch (_context17.prev = _context17.next) {
|
|
2508
2509
|
case 0:
|
|
2509
|
-
objectId = _ref32.objectId, versionHash = _ref32.versionHash, salt = _ref32.salt, samples = _ref32.samples;
|
|
2510
|
+
objectId = _ref32.objectId, versionHash = _ref32.versionHash, salt = _ref32.salt, samples = _ref32.samples, authorizationToken = _ref32.authorizationToken;
|
|
2510
2511
|
_context17.next = 3;
|
|
2511
2512
|
return ContentObjectAudit.AuditContentObject({
|
|
2512
2513
|
client: this,
|
|
@@ -2514,7 +2515,8 @@ exports.AuditStream = /*#__PURE__*/function () {
|
|
|
2514
2515
|
versionHash: versionHash,
|
|
2515
2516
|
salt: salt,
|
|
2516
2517
|
samples: samples,
|
|
2517
|
-
live: true
|
|
2518
|
+
live: true,
|
|
2519
|
+
authorizationToken: authorizationToken
|
|
2518
2520
|
});
|
|
2519
2521
|
case 3:
|
|
2520
2522
|
return _context17.abrupt("return", _context17.sent);
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ const UUID = require("uuid").v4;
|
|
|
5
5
|
const {ValidateParameters} = require("./Validation");
|
|
6
6
|
|
|
7
7
|
const ContentObjectAudit = {
|
|
8
|
-
async AuditContentObject({client, libraryId, objectId, versionHash, salt, samples, live=false}) {
|
|
8
|
+
async AuditContentObject({client, libraryId, objectId, versionHash, salt, samples, live=false, authorizationToken}) {
|
|
9
9
|
if(!salt){
|
|
10
10
|
salt = client.utils.B64(UUID());
|
|
11
11
|
}
|
|
@@ -53,7 +53,9 @@ const ContentObjectAudit = {
|
|
|
53
53
|
|
|
54
54
|
let path = UrlJoin("qlibs", libraryId, "q", versionHash || objectId, live ? "call/live/audit" : "audit");
|
|
55
55
|
let responses = await httpClient.RequestAll({
|
|
56
|
-
headers:
|
|
56
|
+
headers: authorizationToken ?
|
|
57
|
+
{ Authorization: `Bearer ${authorizationToken}`} :
|
|
58
|
+
await client.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
|
|
57
59
|
queryParams: queryParams,
|
|
58
60
|
method: "GET",
|
|
59
61
|
path
|
|
@@ -3056,17 +3056,19 @@ exports.Collection = async function({collectionType}) {
|
|
|
3056
3056
|
* @param {string=} versionHash - Version hash of the object -- if not specified, latest version is returned
|
|
3057
3057
|
* @param {string=} salt - base64-encoded byte sequence for salting the audit hash
|
|
3058
3058
|
* @param {Array<number>=} samples - list of percentages (0.0 - <1.0) used for sampling the content part list, up to 3
|
|
3059
|
+
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
3059
3060
|
*
|
|
3060
3061
|
* @returns {Promise<Object>} - Response describing audit results
|
|
3061
3062
|
*/
|
|
3062
|
-
exports.AuditContentObject = async function({libraryId, objectId, versionHash, salt, samples}) {
|
|
3063
|
+
exports.AuditContentObject = async function({libraryId, objectId, versionHash, salt, samples, authorizationToken}) {
|
|
3063
3064
|
return await ContentObjectAudit.AuditContentObject({
|
|
3064
3065
|
client: this,
|
|
3065
3066
|
libraryId,
|
|
3066
3067
|
objectId,
|
|
3067
3068
|
versionHash,
|
|
3068
3069
|
salt,
|
|
3069
|
-
samples
|
|
3070
|
+
samples,
|
|
3071
|
+
authorizationToken
|
|
3070
3072
|
});
|
|
3071
3073
|
};
|
|
3072
3074
|
|
package/src/client/LiveStream.js
CHANGED
|
@@ -1955,16 +1955,18 @@ exports.StreamAddWatermark = async function({
|
|
|
1955
1955
|
* @param {string=} versionHash - Version hash of the live stream -- if not specified, latest version is returned
|
|
1956
1956
|
* @param {string=} salt - base64-encoded byte sequence for salting the audit hash
|
|
1957
1957
|
* @param {Array<number>=} samples - list of percentages (0.0 - <1.0) used for sampling the content part list, up to 3
|
|
1958
|
+
* @param {string=} authorizationToken - Additional authorization token for this request
|
|
1958
1959
|
*
|
|
1959
1960
|
* @returns {Promise<Object>} - Response describing audit results
|
|
1960
1961
|
*/
|
|
1961
|
-
exports.AuditStream = async function({objectId, versionHash, salt, samples}) {
|
|
1962
|
+
exports.AuditStream = async function({objectId, versionHash, salt, samples, authorizationToken}) {
|
|
1962
1963
|
return await ContentObjectAudit.AuditContentObject({
|
|
1963
1964
|
client: this,
|
|
1964
1965
|
objectId,
|
|
1965
1966
|
versionHash,
|
|
1966
1967
|
salt,
|
|
1967
1968
|
samples,
|
|
1968
|
-
live: true
|
|
1969
|
+
live: true,
|
|
1970
|
+
authorizationToken
|
|
1969
1971
|
});
|
|
1970
1972
|
};
|