@eluvio/elv-client-js 4.0.9 → 4.0.10
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 +11 -10
- package/dist/ElvClient-node-min.js +11 -10
- package/dist/ElvFrameClient-min.js +11 -10
- package/dist/ElvPermissionsClient-min.js +10 -9
- package/dist/ElvWalletClient-min.js +10 -9
- package/dist/ElvWalletClient-node-min.js +10 -9
- package/dist/src/AuthorizationClient.js +1556 -2077
- package/dist/src/ContentObjectVerification.js +134 -185
- package/dist/src/Crypto.js +224 -319
- package/dist/src/ElvClient.js +822 -1114
- package/dist/src/ElvWallet.js +64 -106
- package/dist/src/EthClient.js +719 -974
- package/dist/src/FrameClient.js +222 -318
- package/dist/src/HttpClient.js +112 -154
- package/dist/src/Id.js +1 -6
- package/dist/src/LogMessage.js +4 -8
- package/dist/src/PermissionsClient.js +973 -1271
- package/dist/src/RemoteSigner.js +161 -232
- package/dist/src/UserProfileClient.js +781 -1038
- package/dist/src/Utils.js +159 -299
- package/dist/src/Validation.js +2 -17
- package/dist/src/client/ABRPublishing.js +772 -942
- package/dist/src/client/AccessGroups.js +849 -1095
- package/dist/src/client/ContentAccess.js +3322 -4195
- package/dist/src/client/ContentManagement.js +1817 -2286
- package/dist/src/client/Contracts.js +468 -614
- package/dist/src/client/Files.js +1505 -1845
- package/dist/src/client/NFT.js +94 -116
- package/dist/src/client/NTP.js +326 -425
- package/dist/src/index.js +2 -5
- package/dist/src/walletClient/ClientMethods.js +1368 -1763
- package/dist/src/walletClient/Configuration.js +4 -2
- package/dist/src/walletClient/Notifications.js +98 -127
- package/dist/src/walletClient/Profile.js +184 -246
- package/dist/src/walletClient/Utils.js +76 -122
- package/dist/src/walletClient/index.js +1171 -1496
- package/package.json +1 -1
- package/src/client/ContentManagement.js +24 -29
- package/testScripts/CreateMezMonolithic.js +779 -0
- package/utilities/ListAccessGroups.js +34 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
|
|
2
|
-
|
|
3
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
|
-
|
|
5
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
6
|
-
|
|
7
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
8
|
-
|
|
9
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
7
|
/**
|
|
14
8
|
* Methods for ABR video creation and management
|
|
15
9
|
*
|
|
@@ -17,16 +11,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
11
|
*
|
|
18
12
|
* @module ElvClient/ABRPublishing
|
|
19
13
|
*/
|
|
20
|
-
var R = require("ramda");
|
|
21
14
|
|
|
15
|
+
var R = require("ramda");
|
|
22
16
|
var UrlJoin = require("url-join");
|
|
23
|
-
|
|
24
17
|
var HttpClient = require("../HttpClient");
|
|
25
|
-
|
|
26
18
|
var _require = require("../Validation"),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
ValidateLibrary = _require.ValidateLibrary,
|
|
20
|
+
ValidateVersion = _require.ValidateVersion,
|
|
21
|
+
ValidateParameters = _require.ValidateParameters;
|
|
22
|
+
|
|
30
23
|
/**
|
|
31
24
|
* Create a master media content object with the given files.
|
|
32
25
|
*
|
|
@@ -79,266 +72,223 @@ var _require = require("../Validation"),
|
|
|
79
72
|
* @throws {Object} error - If the initialization of the master fails, error details can be found in error.body
|
|
80
73
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the master initialization
|
|
81
74
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
75
|
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
85
76
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
86
77
|
var libraryId, type, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel, _yield$this$CreateCon, id, write_token, s3prefixRegex, i, oneFileInfo, matched, j, credentialSet, credentialSetBucket, matchers, k, matcher, fileSourcePath, s3prefixMatch, bucketName, _i, _credentialSet, region, bucket, accessKey, secret, _yield$this$CallBitco, logs, errors, warnings, finalizeResponse;
|
|
87
|
-
|
|
88
78
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
|
-
while (1) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (!fileInfo) {
|
|
108
|
-
_context.next = 59;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!(access.length > 0)) {
|
|
113
|
-
_context.next = 57;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// S3 Upload
|
|
118
|
-
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
119
|
-
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
120
|
-
|
|
121
|
-
i = 0;
|
|
122
|
-
|
|
123
|
-
case 11:
|
|
124
|
-
if (!(i < fileInfo.length)) {
|
|
125
|
-
_context.next = 42;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
oneFileInfo = fileInfo[i];
|
|
130
|
-
matched = false;
|
|
131
|
-
j = 0;
|
|
132
|
-
|
|
133
|
-
case 15:
|
|
134
|
-
if (!(!matched && j < access.length)) {
|
|
135
|
-
_context.next = 37;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
140
|
-
|
|
141
|
-
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
142
|
-
matchers = credentialSet.path_matchers;
|
|
143
|
-
k = 0;
|
|
144
|
-
|
|
145
|
-
case 20:
|
|
146
|
-
if (!(!matched && k < matchers.length)) {
|
|
147
|
-
_context.next = 34;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
matcher = new RegExp(matchers[k]);
|
|
152
|
-
fileSourcePath = oneFileInfo.source;
|
|
153
|
-
|
|
154
|
-
if (!matcher.test(fileSourcePath)) {
|
|
155
|
-
_context.next = 31;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
matched = true; // if full s3 path supplied, check bucket name
|
|
160
|
-
|
|
161
|
-
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
162
|
-
|
|
163
|
-
if (!s3prefixMatch) {
|
|
164
|
-
_context.next = 30;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
bucketName = s3prefixMatch[1];
|
|
169
|
-
|
|
170
|
-
if (!(bucketName !== credentialSetBucket)) {
|
|
171
|
-
_context.next = 30;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
176
|
-
|
|
177
|
-
case 30:
|
|
178
|
-
if (credentialSet.hasOwnProperty("matched")) {
|
|
179
|
-
credentialSet.matched.push(oneFileInfo);
|
|
180
|
-
} else {
|
|
181
|
-
// first matching file path for this credential set,
|
|
182
|
-
// initialize new 'matched' property to 1-element array
|
|
183
|
-
credentialSet.matched = [oneFileInfo];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
case 31:
|
|
187
|
-
k++;
|
|
188
|
-
_context.next = 20;
|
|
79
|
+
while (1) switch (_context.prev = _context.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
libraryId = _ref.libraryId, type = _ref.type, name = _ref.name, description = _ref.description, _ref$metadata = _ref.metadata, metadata = _ref$metadata === void 0 ? {} : _ref$metadata, fileInfo = _ref.fileInfo, _ref$encrypt = _ref.encrypt, encrypt = _ref$encrypt === void 0 ? true : _ref$encrypt, _ref$access = _ref.access, access = _ref$access === void 0 ? [] : _ref$access, _ref$copy = _ref.copy, copy = _ref$copy === void 0 ? false : _ref$copy, callback = _ref.callback, _ref$respLogLevel = _ref.respLogLevel, respLogLevel = _ref$respLogLevel === void 0 ? "warn" : _ref$respLogLevel, _ref$structLogLevel = _ref.structLogLevel, structLogLevel = _ref$structLogLevel === void 0 ? "none" : _ref$structLogLevel;
|
|
82
|
+
ValidateLibrary(libraryId);
|
|
83
|
+
_context.next = 4;
|
|
84
|
+
return this.CreateContentObject({
|
|
85
|
+
libraryId: libraryId,
|
|
86
|
+
options: type ? {
|
|
87
|
+
type: type
|
|
88
|
+
} : {}
|
|
89
|
+
});
|
|
90
|
+
case 4:
|
|
91
|
+
_yield$this$CreateCon = _context.sent;
|
|
92
|
+
id = _yield$this$CreateCon.id;
|
|
93
|
+
write_token = _yield$this$CreateCon.write_token;
|
|
94
|
+
if (!fileInfo) {
|
|
95
|
+
_context.next = 59;
|
|
189
96
|
break;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
_context.next = 15;
|
|
97
|
+
}
|
|
98
|
+
if (!(access.length > 0)) {
|
|
99
|
+
_context.next = 57;
|
|
194
100
|
break;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
case 39:
|
|
205
|
-
i++;
|
|
206
|
-
_context.next = 11;
|
|
101
|
+
}
|
|
102
|
+
// S3 Upload
|
|
103
|
+
s3prefixRegex = /^s3:\/\/([^/]+)\//i; // for matching and extracting bucket name when full s3:// path is specified
|
|
104
|
+
// batch the cloud storage files by matching credential set, check each file's source path against credential set path_matchers
|
|
105
|
+
i = 0;
|
|
106
|
+
case 11:
|
|
107
|
+
if (!(i < fileInfo.length)) {
|
|
108
|
+
_context.next = 42;
|
|
207
109
|
break;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_credentialSet = access[_i];
|
|
219
|
-
|
|
220
|
-
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
221
|
-
_context.next = 52;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
226
|
-
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
227
|
-
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
228
|
-
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
229
|
-
_context.next = 52;
|
|
230
|
-
return this.UploadFilesFromS3({
|
|
231
|
-
libraryId: libraryId,
|
|
232
|
-
objectId: id,
|
|
233
|
-
writeToken: write_token,
|
|
234
|
-
fileInfo: _credentialSet.matched,
|
|
235
|
-
region: region,
|
|
236
|
-
bucket: bucket,
|
|
237
|
-
accessKey: accessKey,
|
|
238
|
-
secret: secret,
|
|
239
|
-
copy: copy,
|
|
240
|
-
callback: callback,
|
|
241
|
-
encryption: encrypt ? "cgck" : "none"
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
case 52:
|
|
245
|
-
_i++;
|
|
246
|
-
_context.next = 43;
|
|
110
|
+
}
|
|
111
|
+
oneFileInfo = fileInfo[i];
|
|
112
|
+
matched = false;
|
|
113
|
+
j = 0;
|
|
114
|
+
case 15:
|
|
115
|
+
if (!(!matched && j < access.length)) {
|
|
116
|
+
_context.next = 37;
|
|
247
117
|
break;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
118
|
+
}
|
|
119
|
+
credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
|
|
120
|
+
credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
|
|
121
|
+
matchers = credentialSet.path_matchers;
|
|
122
|
+
k = 0;
|
|
123
|
+
case 20:
|
|
124
|
+
if (!(!matched && k < matchers.length)) {
|
|
125
|
+
_context.next = 34;
|
|
251
126
|
break;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
127
|
+
}
|
|
128
|
+
matcher = new RegExp(matchers[k]);
|
|
129
|
+
fileSourcePath = oneFileInfo.source;
|
|
130
|
+
if (!matcher.test(fileSourcePath)) {
|
|
131
|
+
_context.next = 31;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
matched = true;
|
|
135
|
+
// if full s3 path supplied, check bucket name
|
|
136
|
+
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
137
|
+
if (!s3prefixMatch) {
|
|
138
|
+
_context.next = 30;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
bucketName = s3prefixMatch[1];
|
|
142
|
+
if (!(bucketName !== credentialSetBucket)) {
|
|
143
|
+
_context.next = 30;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
147
|
+
case 30:
|
|
148
|
+
if (credentialSet.hasOwnProperty("matched")) {
|
|
149
|
+
credentialSet.matched.push(oneFileInfo);
|
|
150
|
+
} else {
|
|
151
|
+
// first matching file path for this credential set,
|
|
152
|
+
// initialize new 'matched' property to 1-element array
|
|
153
|
+
credentialSet.matched = [oneFileInfo];
|
|
154
|
+
}
|
|
155
|
+
case 31:
|
|
156
|
+
k++;
|
|
157
|
+
_context.next = 20;
|
|
158
|
+
break;
|
|
159
|
+
case 34:
|
|
160
|
+
j++;
|
|
161
|
+
_context.next = 15;
|
|
162
|
+
break;
|
|
163
|
+
case 37:
|
|
164
|
+
if (matched) {
|
|
165
|
+
_context.next = 39;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
throw Error("no credential set found for file path: \"" + filePath + "\"");
|
|
169
|
+
case 39:
|
|
170
|
+
i++;
|
|
171
|
+
_context.next = 11;
|
|
172
|
+
break;
|
|
173
|
+
case 42:
|
|
174
|
+
_i = 0;
|
|
175
|
+
case 43:
|
|
176
|
+
if (!(_i < access.length)) {
|
|
177
|
+
_context.next = 55;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
_credentialSet = access[_i];
|
|
181
|
+
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
182
|
+
_context.next = 52;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
region = _credentialSet.remote_access.storage_endpoint.region;
|
|
186
|
+
bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
|
|
187
|
+
accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
|
|
188
|
+
secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
|
|
189
|
+
_context.next = 52;
|
|
190
|
+
return this.UploadFilesFromS3({
|
|
191
|
+
libraryId: libraryId,
|
|
192
|
+
objectId: id,
|
|
193
|
+
writeToken: write_token,
|
|
194
|
+
fileInfo: _credentialSet.matched,
|
|
195
|
+
region: region,
|
|
196
|
+
bucket: bucket,
|
|
197
|
+
accessKey: accessKey,
|
|
198
|
+
secret: secret,
|
|
199
|
+
copy: copy,
|
|
200
|
+
callback: callback,
|
|
201
|
+
encryption: encrypt ? "cgck" : "none"
|
|
202
|
+
});
|
|
203
|
+
case 52:
|
|
204
|
+
_i++;
|
|
205
|
+
_context.next = 43;
|
|
206
|
+
break;
|
|
207
|
+
case 55:
|
|
208
|
+
_context.next = 59;
|
|
209
|
+
break;
|
|
210
|
+
case 57:
|
|
211
|
+
_context.next = 59;
|
|
212
|
+
return this.UploadFiles({
|
|
213
|
+
libraryId: libraryId,
|
|
214
|
+
objectId: id,
|
|
215
|
+
writeToken: write_token,
|
|
216
|
+
fileInfo: fileInfo,
|
|
217
|
+
callback: callback,
|
|
218
|
+
encryption: encrypt ? "cgck" : "none"
|
|
219
|
+
});
|
|
220
|
+
case 59:
|
|
221
|
+
_context.next = 61;
|
|
222
|
+
return this.CreateEncryptionConk({
|
|
223
|
+
libraryId: libraryId,
|
|
224
|
+
objectId: id,
|
|
225
|
+
writeToken: write_token,
|
|
226
|
+
createKMSConk: true
|
|
227
|
+
});
|
|
228
|
+
case 61:
|
|
229
|
+
_context.next = 63;
|
|
230
|
+
return this.CallBitcodeMethod({
|
|
231
|
+
libraryId: libraryId,
|
|
232
|
+
objectId: id,
|
|
233
|
+
writeToken: write_token,
|
|
234
|
+
method: UrlJoin("media", "production_master", "init"),
|
|
235
|
+
queryParams: {
|
|
236
|
+
response_log_level: respLogLevel,
|
|
237
|
+
struct_log_level: structLogLevel
|
|
238
|
+
},
|
|
239
|
+
body: {
|
|
240
|
+
access: access
|
|
241
|
+
},
|
|
242
|
+
constant: false
|
|
243
|
+
});
|
|
244
|
+
case 63:
|
|
245
|
+
_yield$this$CallBitco = _context.sent;
|
|
246
|
+
logs = _yield$this$CallBitco.logs;
|
|
247
|
+
errors = _yield$this$CallBitco.errors;
|
|
248
|
+
warnings = _yield$this$CallBitco.warnings;
|
|
249
|
+
_context.next = 69;
|
|
250
|
+
return this.MergeMetadata({
|
|
251
|
+
libraryId: libraryId,
|
|
252
|
+
objectId: id,
|
|
253
|
+
writeToken: write_token,
|
|
254
|
+
metadata: _objectSpread(_objectSpread({}, metadata || {}), {}, {
|
|
255
|
+
name: name,
|
|
256
|
+
description: description,
|
|
257
|
+
reference: access && !copy,
|
|
258
|
+
"public": _objectSpread(_objectSpread({}, (metadata || {})["public"] || {}), {}, {
|
|
259
|
+
name: name || "",
|
|
260
|
+
description: description || ""
|
|
261
|
+
}),
|
|
262
|
+
elv_created_at: new Date().getTime()
|
|
263
|
+
})
|
|
264
|
+
});
|
|
265
|
+
case 69:
|
|
266
|
+
_context.next = 71;
|
|
267
|
+
return this.FinalizeContentObject({
|
|
268
|
+
libraryId: libraryId,
|
|
269
|
+
objectId: id,
|
|
270
|
+
writeToken: write_token,
|
|
271
|
+
commitMessage: "Create master",
|
|
272
|
+
awaitCommitConfirmation: false
|
|
273
|
+
});
|
|
274
|
+
case 71:
|
|
275
|
+
finalizeResponse = _context.sent;
|
|
276
|
+
return _context.abrupt("return", _objectSpread({
|
|
277
|
+
errors: errors || [],
|
|
278
|
+
logs: logs || [],
|
|
279
|
+
warnings: warnings || []
|
|
280
|
+
}, finalizeResponse));
|
|
281
|
+
case 73:
|
|
282
|
+
case "end":
|
|
283
|
+
return _context.stop();
|
|
334
284
|
}
|
|
335
285
|
}, _callee, this);
|
|
336
286
|
}));
|
|
337
|
-
|
|
338
287
|
return function (_x) {
|
|
339
288
|
return _ref2.apply(this, arguments);
|
|
340
289
|
};
|
|
341
290
|
}();
|
|
291
|
+
|
|
342
292
|
/**
|
|
343
293
|
* Create (or edit) a mezzanine offering based on the a given master content object version and variant key
|
|
344
294
|
*
|
|
@@ -362,298 +312,250 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
362
312
|
*
|
|
363
313
|
* @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the mezzanine initialization
|
|
364
314
|
*/
|
|
365
|
-
|
|
366
|
-
|
|
367
315
|
exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
368
316
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
369
317
|
var libraryId, objectId, type, name, description, metadata, masterVersionHash, abrProfile, addlOfferingSpecs, _ref3$variant, variant, _ref3$offeringKey, offeringKey, _ref3$keepOtherStream, keepOtherStreams, _ref3$respLogLevel, respLogLevel, _ref3$structLogLevel, structLogLevel, streamKeys, existingMez, options, id, write_token, editResponse, createResponse, masterName, authorizationTokens, headers, body, storeClear, _yield$this$CallBitco2, logs, errors, warnings, existingMetadata, finalizeResponse;
|
|
370
|
-
|
|
371
318
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
372
|
-
while (1) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (masterVersionHash) {
|
|
380
|
-
_context2.next = 5;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
throw Error("Master version hash not specified");
|
|
385
|
-
|
|
386
|
-
case 5:
|
|
387
|
-
if (!(!objectId && keepOtherStreams)) {
|
|
388
|
-
_context2.next = 7;
|
|
389
|
-
break;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
393
|
-
|
|
394
|
-
case 7:
|
|
395
|
-
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
396
|
-
_context2.next = 9;
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
401
|
-
|
|
402
|
-
case 9:
|
|
403
|
-
existingMez = !!objectId;
|
|
404
|
-
options = type ? {
|
|
405
|
-
type: type
|
|
406
|
-
} : {};
|
|
407
|
-
|
|
408
|
-
if (!existingMez) {
|
|
409
|
-
_context2.next = 19;
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
_context2.next = 14;
|
|
414
|
-
return this.EditContentObject({
|
|
415
|
-
libraryId: libraryId,
|
|
416
|
-
objectId: objectId,
|
|
417
|
-
options: options
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
case 14:
|
|
421
|
-
editResponse = _context2.sent;
|
|
422
|
-
id = editResponse.id;
|
|
423
|
-
write_token = editResponse.write_token;
|
|
424
|
-
_context2.next = 24;
|
|
319
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
320
|
+
case 0:
|
|
321
|
+
libraryId = _ref3.libraryId, objectId = _ref3.objectId, type = _ref3.type, name = _ref3.name, description = _ref3.description, metadata = _ref3.metadata, masterVersionHash = _ref3.masterVersionHash, abrProfile = _ref3.abrProfile, addlOfferingSpecs = _ref3.addlOfferingSpecs, _ref3$variant = _ref3.variant, variant = _ref3$variant === void 0 ? "default" : _ref3$variant, _ref3$offeringKey = _ref3.offeringKey, offeringKey = _ref3$offeringKey === void 0 ? "default" : _ref3$offeringKey, _ref3$keepOtherStream = _ref3.keepOtherStreams, keepOtherStreams = _ref3$keepOtherStream === void 0 ? false : _ref3$keepOtherStream, _ref3$respLogLevel = _ref3.respLogLevel, respLogLevel = _ref3$respLogLevel === void 0 ? "warn" : _ref3$respLogLevel, _ref3$structLogLevel = _ref3.structLogLevel, structLogLevel = _ref3$structLogLevel === void 0 ? "none" : _ref3$structLogLevel, streamKeys = _ref3.streamKeys;
|
|
322
|
+
ValidateLibrary(libraryId);
|
|
323
|
+
ValidateVersion(masterVersionHash);
|
|
324
|
+
if (masterVersionHash) {
|
|
325
|
+
_context2.next = 5;
|
|
425
326
|
break;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
options: options
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
case 21:
|
|
435
|
-
createResponse = _context2.sent;
|
|
436
|
-
id = createResponse.id;
|
|
437
|
-
write_token = createResponse.write_token;
|
|
438
|
-
|
|
439
|
-
case 24:
|
|
440
|
-
_context2.next = 26;
|
|
441
|
-
return this.CreateEncryptionConk({
|
|
442
|
-
libraryId: libraryId,
|
|
443
|
-
objectId: id,
|
|
444
|
-
writeToken: write_token,
|
|
445
|
-
createKMSConk: true
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
case 26:
|
|
449
|
-
_context2.next = 28;
|
|
450
|
-
return this.ContentObjectMetadata({
|
|
451
|
-
versionHash: masterVersionHash,
|
|
452
|
-
metadataSubtree: "public/name"
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
case 28:
|
|
456
|
-
masterName = _context2.sent;
|
|
457
|
-
// Include authorization for library, master, and mezzanine
|
|
458
|
-
authorizationTokens = [];
|
|
459
|
-
_context2.t0 = authorizationTokens;
|
|
460
|
-
_context2.next = 33;
|
|
461
|
-
return this.authClient.AuthorizationToken({
|
|
462
|
-
libraryId: libraryId,
|
|
463
|
-
objectId: id,
|
|
464
|
-
update: true
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
case 33:
|
|
468
|
-
_context2.t1 = _context2.sent;
|
|
469
|
-
|
|
470
|
-
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
471
|
-
|
|
472
|
-
_context2.t2 = authorizationTokens;
|
|
473
|
-
_context2.next = 38;
|
|
474
|
-
return this.authClient.AuthorizationToken({
|
|
475
|
-
libraryId: libraryId
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
case 38:
|
|
479
|
-
_context2.t3 = _context2.sent;
|
|
480
|
-
|
|
481
|
-
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
482
|
-
|
|
483
|
-
_context2.t4 = authorizationTokens;
|
|
484
|
-
_context2.next = 43;
|
|
485
|
-
return this.authClient.AuthorizationToken({
|
|
486
|
-
versionHash: masterVersionHash
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
case 43:
|
|
490
|
-
_context2.t5 = _context2.sent;
|
|
491
|
-
|
|
492
|
-
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
493
|
-
|
|
494
|
-
headers = {
|
|
495
|
-
Authorization: authorizationTokens.map(function (token) {
|
|
496
|
-
return "Bearer ".concat(token);
|
|
497
|
-
}).join(",")
|
|
498
|
-
};
|
|
499
|
-
body = {
|
|
500
|
-
additional_offering_specs: addlOfferingSpecs,
|
|
501
|
-
offering_key: offeringKey,
|
|
502
|
-
keep_other_streams: keepOtherStreams,
|
|
503
|
-
prod_master_hash: masterVersionHash,
|
|
504
|
-
stream_keys: streamKeys,
|
|
505
|
-
variant_key: variant
|
|
506
|
-
};
|
|
507
|
-
storeClear = false;
|
|
508
|
-
|
|
509
|
-
if (!abrProfile) {
|
|
510
|
-
_context2.next = 53;
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
body.abr_profile = abrProfile;
|
|
515
|
-
storeClear = abrProfile.store_clear;
|
|
516
|
-
_context2.next = 56;
|
|
327
|
+
}
|
|
328
|
+
throw Error("Master version hash not specified");
|
|
329
|
+
case 5:
|
|
330
|
+
if (!(!objectId && keepOtherStreams)) {
|
|
331
|
+
_context2.next = 7;
|
|
517
332
|
break;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
333
|
+
}
|
|
334
|
+
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
335
|
+
case 7:
|
|
336
|
+
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
337
|
+
_context2.next = 9;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
341
|
+
case 9:
|
|
342
|
+
existingMez = !!objectId;
|
|
343
|
+
options = type ? {
|
|
344
|
+
type: type
|
|
345
|
+
} : {};
|
|
346
|
+
if (!existingMez) {
|
|
347
|
+
_context2.next = 19;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
_context2.next = 14;
|
|
351
|
+
return this.EditContentObject({
|
|
352
|
+
libraryId: libraryId,
|
|
353
|
+
objectId: objectId,
|
|
354
|
+
options: options
|
|
355
|
+
});
|
|
356
|
+
case 14:
|
|
357
|
+
editResponse = _context2.sent;
|
|
358
|
+
id = editResponse.id;
|
|
359
|
+
write_token = editResponse.write_token;
|
|
360
|
+
_context2.next = 24;
|
|
361
|
+
break;
|
|
362
|
+
case 19:
|
|
363
|
+
_context2.next = 21;
|
|
364
|
+
return this.CreateContentObject({
|
|
365
|
+
libraryId: libraryId,
|
|
366
|
+
options: options
|
|
367
|
+
});
|
|
368
|
+
case 21:
|
|
369
|
+
createResponse = _context2.sent;
|
|
370
|
+
id = createResponse.id;
|
|
371
|
+
write_token = createResponse.write_token;
|
|
372
|
+
case 24:
|
|
373
|
+
_context2.next = 26;
|
|
374
|
+
return this.CreateEncryptionConk({
|
|
375
|
+
libraryId: libraryId,
|
|
376
|
+
objectId: id,
|
|
377
|
+
writeToken: write_token,
|
|
378
|
+
createKMSConk: true
|
|
379
|
+
});
|
|
380
|
+
case 26:
|
|
381
|
+
_context2.next = 28;
|
|
382
|
+
return this.ContentObjectMetadata({
|
|
383
|
+
versionHash: masterVersionHash,
|
|
384
|
+
metadataSubtree: "public/name"
|
|
385
|
+
});
|
|
386
|
+
case 28:
|
|
387
|
+
masterName = _context2.sent;
|
|
388
|
+
// Include authorization for library, master, and mezzanine
|
|
389
|
+
authorizationTokens = [];
|
|
390
|
+
_context2.t0 = authorizationTokens;
|
|
391
|
+
_context2.next = 33;
|
|
392
|
+
return this.authClient.AuthorizationToken({
|
|
393
|
+
libraryId: libraryId,
|
|
394
|
+
objectId: id,
|
|
395
|
+
update: true
|
|
396
|
+
});
|
|
397
|
+
case 33:
|
|
398
|
+
_context2.t1 = _context2.sent;
|
|
399
|
+
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
400
|
+
_context2.t2 = authorizationTokens;
|
|
401
|
+
_context2.next = 38;
|
|
402
|
+
return this.authClient.AuthorizationToken({
|
|
403
|
+
libraryId: libraryId
|
|
404
|
+
});
|
|
405
|
+
case 38:
|
|
406
|
+
_context2.t3 = _context2.sent;
|
|
407
|
+
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
408
|
+
_context2.t4 = authorizationTokens;
|
|
409
|
+
_context2.next = 43;
|
|
410
|
+
return this.authClient.AuthorizationToken({
|
|
411
|
+
versionHash: masterVersionHash
|
|
412
|
+
});
|
|
413
|
+
case 43:
|
|
414
|
+
_context2.t5 = _context2.sent;
|
|
415
|
+
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
416
|
+
headers = {
|
|
417
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
418
|
+
return "Bearer ".concat(token);
|
|
419
|
+
}).join(",")
|
|
420
|
+
};
|
|
421
|
+
body = {
|
|
422
|
+
additional_offering_specs: addlOfferingSpecs,
|
|
423
|
+
offering_key: offeringKey,
|
|
424
|
+
keep_other_streams: keepOtherStreams,
|
|
425
|
+
prod_master_hash: masterVersionHash,
|
|
426
|
+
stream_keys: streamKeys,
|
|
427
|
+
variant_key: variant
|
|
428
|
+
};
|
|
429
|
+
storeClear = false;
|
|
430
|
+
if (!abrProfile) {
|
|
431
|
+
_context2.next = 53;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
body.abr_profile = abrProfile;
|
|
435
|
+
storeClear = abrProfile.store_clear;
|
|
436
|
+
_context2.next = 56;
|
|
437
|
+
break;
|
|
438
|
+
case 53:
|
|
439
|
+
_context2.next = 55;
|
|
440
|
+
return this.ContentObjectMetadata({
|
|
441
|
+
libraryId: libraryId,
|
|
442
|
+
objectId: this.utils.AddressToObjectId(this.utils.HashToAddress(libraryId)),
|
|
443
|
+
metadataSubtree: "abr_profile/store_clear"
|
|
444
|
+
});
|
|
445
|
+
case 55:
|
|
446
|
+
storeClear = _context2.sent;
|
|
447
|
+
case 56:
|
|
448
|
+
if (storeClear) {
|
|
536
449
|
_context2.next = 59;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
finalizeResponse = _context2.sent;
|
|
639
|
-
return _context2.abrupt("return", _objectSpread({
|
|
640
|
-
logs: logs || [],
|
|
641
|
-
warnings: warnings || [],
|
|
642
|
-
errors: errors || []
|
|
643
|
-
}, finalizeResponse));
|
|
644
|
-
|
|
645
|
-
case 84:
|
|
646
|
-
case "end":
|
|
647
|
-
return _context2.stop();
|
|
648
|
-
}
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
_context2.next = 59;
|
|
453
|
+
return this.EncryptionConk({
|
|
454
|
+
libraryId: libraryId,
|
|
455
|
+
objectId: id,
|
|
456
|
+
writeToken: write_token
|
|
457
|
+
});
|
|
458
|
+
case 59:
|
|
459
|
+
_context2.next = 61;
|
|
460
|
+
return this.CallBitcodeMethod({
|
|
461
|
+
libraryId: libraryId,
|
|
462
|
+
objectId: id,
|
|
463
|
+
writeToken: write_token,
|
|
464
|
+
method: UrlJoin("media", "abr_mezzanine", "init"),
|
|
465
|
+
queryParams: {
|
|
466
|
+
response_log_level: respLogLevel,
|
|
467
|
+
struct_log_level: structLogLevel
|
|
468
|
+
},
|
|
469
|
+
headers: headers,
|
|
470
|
+
body: body,
|
|
471
|
+
constant: false
|
|
472
|
+
});
|
|
473
|
+
case 61:
|
|
474
|
+
_yield$this$CallBitco2 = _context2.sent;
|
|
475
|
+
logs = _yield$this$CallBitco2.logs;
|
|
476
|
+
errors = _yield$this$CallBitco2.errors;
|
|
477
|
+
warnings = _yield$this$CallBitco2.warnings;
|
|
478
|
+
if (!metadata) {
|
|
479
|
+
metadata = {};
|
|
480
|
+
}
|
|
481
|
+
if (!metadata["public"]) {
|
|
482
|
+
metadata["public"] = {};
|
|
483
|
+
}
|
|
484
|
+
if (!metadata["public"].asset_metadata) {
|
|
485
|
+
metadata["public"].asset_metadata = {};
|
|
486
|
+
}
|
|
487
|
+
metadata.master = {
|
|
488
|
+
name: masterName,
|
|
489
|
+
id: this.utils.DecodeVersionHash(masterVersionHash).objectId,
|
|
490
|
+
hash: masterVersionHash,
|
|
491
|
+
variant: variant
|
|
492
|
+
};
|
|
493
|
+
metadata["public"] = _objectSpread({}, metadata["public"]);
|
|
494
|
+
metadata["public"].asset_metadata = _objectSpread({
|
|
495
|
+
sources: _defineProperty({}, offeringKey, {
|
|
496
|
+
"/": "./rep/playout/".concat(offeringKey, "/options.json")
|
|
497
|
+
})
|
|
498
|
+
}, metadata["public"].asset_metadata);
|
|
499
|
+
if (name || !existingMez) {
|
|
500
|
+
metadata.name = name || "".concat(masterName, " Mezzanine");
|
|
501
|
+
metadata["public"].name = name || "".concat(masterName, " Mezzanine");
|
|
502
|
+
}
|
|
503
|
+
if (description || !existingMez) {
|
|
504
|
+
metadata.description = description || "";
|
|
505
|
+
metadata["public"].description = description || "";
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// retrieve existing metadata to merge with updated metadata
|
|
509
|
+
_context2.next = 75;
|
|
510
|
+
return this.ContentObjectMetadata({
|
|
511
|
+
libraryId: libraryId,
|
|
512
|
+
objectId: id,
|
|
513
|
+
writeToken: write_token
|
|
514
|
+
});
|
|
515
|
+
case 75:
|
|
516
|
+
existingMetadata = _context2.sent;
|
|
517
|
+
// newer metadata values replace existing metadata, unless both new and old values are objects,
|
|
518
|
+
// in which case their keys are merged recursively
|
|
519
|
+
metadata = R.mergeDeepRight(existingMetadata, metadata);
|
|
520
|
+
if (!existingMez) {
|
|
521
|
+
// set creation date
|
|
522
|
+
metadata.elv_created_at = new Date().getTime();
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// write metadata to mezzanine object
|
|
526
|
+
_context2.next = 80;
|
|
527
|
+
return this.ReplaceMetadata({
|
|
528
|
+
libraryId: libraryId,
|
|
529
|
+
objectId: id,
|
|
530
|
+
writeToken: write_token,
|
|
531
|
+
metadata: metadata
|
|
532
|
+
});
|
|
533
|
+
case 80:
|
|
534
|
+
_context2.next = 82;
|
|
535
|
+
return this.FinalizeContentObject({
|
|
536
|
+
libraryId: libraryId,
|
|
537
|
+
objectId: id,
|
|
538
|
+
writeToken: write_token,
|
|
539
|
+
commitMessage: "Create ABR mezzanine"
|
|
540
|
+
});
|
|
541
|
+
case 82:
|
|
542
|
+
finalizeResponse = _context2.sent;
|
|
543
|
+
return _context2.abrupt("return", _objectSpread({
|
|
544
|
+
logs: logs || [],
|
|
545
|
+
warnings: warnings || [],
|
|
546
|
+
errors: errors || []
|
|
547
|
+
}, finalizeResponse));
|
|
548
|
+
case 84:
|
|
549
|
+
case "end":
|
|
550
|
+
return _context2.stop();
|
|
649
551
|
}
|
|
650
552
|
}, _callee2, this);
|
|
651
553
|
}));
|
|
652
|
-
|
|
653
554
|
return function (_x2) {
|
|
654
555
|
return _ref4.apply(this, arguments);
|
|
655
556
|
};
|
|
656
557
|
}();
|
|
558
|
+
|
|
657
559
|
/**
|
|
658
560
|
* Start any incomplete jobs on the specified mezzanine
|
|
659
561
|
*
|
|
@@ -668,176 +570,154 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
668
570
|
*
|
|
669
571
|
* @return {Promise<Object>} - A write token for the mezzanine object, as well as any logs, warnings and errors from the job initialization
|
|
670
572
|
*/
|
|
671
|
-
|
|
672
|
-
|
|
673
573
|
exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
674
574
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
675
575
|
var _this = this;
|
|
676
|
-
|
|
677
576
|
var libraryId, objectId, _ref5$offeringKey, offeringKey, _ref5$access, access, _ref5$jobIndexes, jobIndexes, mezzanineMetadata, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
|
|
678
|
-
|
|
679
577
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
680
|
-
while (1) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
prepSpecs
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
return _context3.stop();
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}, _callee3);
|
|
732
|
-
}));
|
|
733
|
-
|
|
734
|
-
return function (_x4) {
|
|
735
|
-
return _ref7.apply(this, arguments);
|
|
736
|
-
};
|
|
737
|
-
}()));
|
|
738
|
-
|
|
739
|
-
case 10:
|
|
740
|
-
authorizationTokens = _context4.sent;
|
|
741
|
-
_context4.next = 13;
|
|
742
|
-
return this.authClient.AuthorizationToken({
|
|
743
|
-
libraryId: libraryId,
|
|
744
|
-
objectId: objectId,
|
|
745
|
-
update: true
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
case 13:
|
|
749
|
-
_context4.t0 = _context4.sent;
|
|
750
|
-
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
751
|
-
headers = {
|
|
752
|
-
Authorization: authorizationTokens.map(function (token) {
|
|
753
|
-
return "Bearer ".concat(token);
|
|
754
|
-
}).join(",")
|
|
578
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
579
|
+
case 0:
|
|
580
|
+
libraryId = _ref5.libraryId, objectId = _ref5.objectId, _ref5$offeringKey = _ref5.offeringKey, offeringKey = _ref5$offeringKey === void 0 ? "default" : _ref5$offeringKey, _ref5$access = _ref5.access, access = _ref5$access === void 0 ? [] : _ref5$access, _ref5$jobIndexes = _ref5.jobIndexes, jobIndexes = _ref5$jobIndexes === void 0 ? null : _ref5$jobIndexes;
|
|
581
|
+
ValidateParameters({
|
|
582
|
+
libraryId: libraryId,
|
|
583
|
+
objectId: objectId
|
|
584
|
+
});
|
|
585
|
+
_context4.next = 4;
|
|
586
|
+
return this.ContentObjectMetadata({
|
|
587
|
+
libraryId: libraryId,
|
|
588
|
+
objectId: objectId,
|
|
589
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
590
|
+
});
|
|
591
|
+
case 4:
|
|
592
|
+
mezzanineMetadata = _context4.sent;
|
|
593
|
+
prepSpecs = mezzanineMetadata[offeringKey].mez_prep_specs || []; // Retrieve all masters associated with this offering
|
|
594
|
+
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
595
|
+
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
596
|
+
return stream.source_hash;
|
|
597
|
+
});
|
|
598
|
+
}); // Flatten and filter
|
|
599
|
+
masterVersionHashes = [].concat.apply([], masterVersionHashes).filter(function (hash) {
|
|
600
|
+
return hash;
|
|
601
|
+
}).filter(function (v, i, a) {
|
|
602
|
+
return a.indexOf(v) === i;
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
// Retrieve authorization tokens for all masters and the mezzanine
|
|
606
|
+
_context4.next = 10;
|
|
607
|
+
return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
|
|
608
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
609
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
610
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
611
|
+
case 0:
|
|
612
|
+
_context3.next = 2;
|
|
613
|
+
return _this.authClient.AuthorizationToken({
|
|
614
|
+
versionHash: versionHash
|
|
615
|
+
});
|
|
616
|
+
case 2:
|
|
617
|
+
return _context3.abrupt("return", _context3.sent);
|
|
618
|
+
case 3:
|
|
619
|
+
case "end":
|
|
620
|
+
return _context3.stop();
|
|
621
|
+
}
|
|
622
|
+
}, _callee3);
|
|
623
|
+
}));
|
|
624
|
+
return function (_x4) {
|
|
625
|
+
return _ref7.apply(this, arguments);
|
|
755
626
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
627
|
+
}()));
|
|
628
|
+
case 10:
|
|
629
|
+
authorizationTokens = _context4.sent;
|
|
630
|
+
_context4.next = 13;
|
|
631
|
+
return this.authClient.AuthorizationToken({
|
|
632
|
+
libraryId: libraryId,
|
|
633
|
+
objectId: objectId,
|
|
634
|
+
update: true
|
|
635
|
+
});
|
|
636
|
+
case 13:
|
|
637
|
+
_context4.t0 = _context4.sent;
|
|
638
|
+
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
639
|
+
headers = {
|
|
640
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
641
|
+
return "Bearer ".concat(token);
|
|
642
|
+
}).join(",")
|
|
643
|
+
};
|
|
644
|
+
_context4.next = 18;
|
|
645
|
+
return this.EditContentObject({
|
|
646
|
+
libraryId: libraryId,
|
|
647
|
+
objectId: objectId
|
|
648
|
+
});
|
|
649
|
+
case 18:
|
|
650
|
+
processingDraft = _context4.sent;
|
|
651
|
+
lroInfo = {
|
|
652
|
+
write_token: processingDraft.write_token,
|
|
653
|
+
node: this.HttpClient.BaseURI().toString(),
|
|
654
|
+
offering: offeringKey
|
|
655
|
+
}; // Update metadata with LRO version write token
|
|
656
|
+
_context4.next = 22;
|
|
657
|
+
return this.EditContentObject({
|
|
658
|
+
libraryId: libraryId,
|
|
659
|
+
objectId: objectId
|
|
660
|
+
});
|
|
661
|
+
case 22:
|
|
662
|
+
statusDraft = _context4.sent;
|
|
663
|
+
_context4.next = 25;
|
|
664
|
+
return this.ReplaceMetadata({
|
|
665
|
+
libraryId: libraryId,
|
|
666
|
+
objectId: objectId,
|
|
667
|
+
writeToken: statusDraft.write_token,
|
|
668
|
+
metadataSubtree: "lro_draft_".concat(offeringKey),
|
|
669
|
+
metadata: lroInfo
|
|
670
|
+
});
|
|
671
|
+
case 25:
|
|
672
|
+
_context4.next = 27;
|
|
673
|
+
return this.FinalizeContentObject({
|
|
674
|
+
libraryId: libraryId,
|
|
675
|
+
objectId: objectId,
|
|
676
|
+
writeToken: statusDraft.write_token,
|
|
677
|
+
commitMessage: "Mezzanine LRO status"
|
|
678
|
+
});
|
|
679
|
+
case 27:
|
|
680
|
+
finalizeResponse = _context4.sent;
|
|
681
|
+
_context4.next = 30;
|
|
682
|
+
return this.CallBitcodeMethod({
|
|
683
|
+
libraryId: libraryId,
|
|
684
|
+
objectId: objectId,
|
|
685
|
+
writeToken: processingDraft.write_token,
|
|
686
|
+
headers: headers,
|
|
687
|
+
method: UrlJoin("media", "abr_mezzanine", "prep_start"),
|
|
688
|
+
constant: false,
|
|
689
|
+
body: {
|
|
690
|
+
access: access,
|
|
691
|
+
offering_key: offeringKey,
|
|
692
|
+
job_indexes: jobIndexes
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
case 30:
|
|
696
|
+
_yield$this$CallBitco3 = _context4.sent;
|
|
697
|
+
data = _yield$this$CallBitco3.data;
|
|
698
|
+
errors = _yield$this$CallBitco3.errors;
|
|
699
|
+
warnings = _yield$this$CallBitco3.warnings;
|
|
700
|
+
logs = _yield$this$CallBitco3.logs;
|
|
701
|
+
return _context4.abrupt("return", {
|
|
702
|
+
hash: finalizeResponse.hash,
|
|
703
|
+
lro_draft: lroInfo,
|
|
704
|
+
writeToken: processingDraft.write_token,
|
|
705
|
+
data: data,
|
|
706
|
+
logs: logs || [],
|
|
707
|
+
warnings: warnings || [],
|
|
708
|
+
errors: errors || []
|
|
709
|
+
});
|
|
710
|
+
case 36:
|
|
711
|
+
case "end":
|
|
712
|
+
return _context4.stop();
|
|
833
713
|
}
|
|
834
714
|
}, _callee4, this);
|
|
835
715
|
}));
|
|
836
|
-
|
|
837
716
|
return function (_x3) {
|
|
838
717
|
return _ref6.apply(this, arguments);
|
|
839
718
|
};
|
|
840
719
|
}();
|
|
720
|
+
|
|
841
721
|
/**
|
|
842
722
|
* Retrieve status information for a long running operation (LRO) on the given object.
|
|
843
723
|
*
|
|
@@ -849,99 +729,80 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
849
729
|
*
|
|
850
730
|
* @return {Promise<Object>} - LRO status
|
|
851
731
|
*/
|
|
852
|
-
|
|
853
|
-
|
|
854
732
|
exports.LROStatus = /*#__PURE__*/function () {
|
|
855
733
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
856
734
|
var libraryId, objectId, _ref8$offeringKey, offeringKey, lroDraft, ready;
|
|
857
|
-
|
|
858
735
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
859
|
-
while (1) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
_context5.
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
|
|
922
|
-
_context5.next = 22;
|
|
923
|
-
return this.ContentObjectMetadata({
|
|
924
|
-
libraryId: libraryId,
|
|
925
|
-
objectId: objectId,
|
|
926
|
-
writeToken: lroDraft.write_token,
|
|
927
|
-
metadataSubtree: "lro_status"
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
case 22:
|
|
931
|
-
return _context5.abrupt("return", _context5.sent);
|
|
932
|
-
|
|
933
|
-
case 23:
|
|
934
|
-
case "end":
|
|
935
|
-
return _context5.stop();
|
|
936
|
-
}
|
|
736
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
737
|
+
case 0:
|
|
738
|
+
libraryId = _ref8.libraryId, objectId = _ref8.objectId, _ref8$offeringKey = _ref8.offeringKey, offeringKey = _ref8$offeringKey === void 0 ? "default" : _ref8$offeringKey;
|
|
739
|
+
ValidateParameters({
|
|
740
|
+
libraryId: libraryId,
|
|
741
|
+
objectId: objectId
|
|
742
|
+
});
|
|
743
|
+
_context5.next = 4;
|
|
744
|
+
return this.ContentObjectMetadata({
|
|
745
|
+
libraryId: libraryId,
|
|
746
|
+
objectId: objectId,
|
|
747
|
+
metadataSubtree: "lro_draft_".concat(offeringKey)
|
|
748
|
+
});
|
|
749
|
+
case 4:
|
|
750
|
+
_context5.t0 = _context5.sent;
|
|
751
|
+
if (_context5.t0) {
|
|
752
|
+
_context5.next = 9;
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
_context5.next = 8;
|
|
756
|
+
return this.ContentObjectMetadata({
|
|
757
|
+
libraryId: libraryId,
|
|
758
|
+
objectId: objectId,
|
|
759
|
+
metadataSubtree: "lro_draft"
|
|
760
|
+
});
|
|
761
|
+
case 8:
|
|
762
|
+
_context5.t0 = _context5.sent;
|
|
763
|
+
case 9:
|
|
764
|
+
lroDraft = _context5.t0;
|
|
765
|
+
if (!(!lroDraft || !lroDraft.write_token)) {
|
|
766
|
+
_context5.next = 19;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
_context5.next = 13;
|
|
770
|
+
return this.ContentObjectMetadata({
|
|
771
|
+
libraryId: libraryId,
|
|
772
|
+
objectId: objectId,
|
|
773
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings", offeringKey, "ready")
|
|
774
|
+
});
|
|
775
|
+
case 13:
|
|
776
|
+
ready = _context5.sent;
|
|
777
|
+
if (!ready) {
|
|
778
|
+
_context5.next = 18;
|
|
779
|
+
break;
|
|
780
|
+
}
|
|
781
|
+
throw Error("Mezzanine already finalized for offering '".concat(offeringKey, "'"));
|
|
782
|
+
case 18:
|
|
783
|
+
throw Error("No LRO draft found for this mezzanine");
|
|
784
|
+
case 19:
|
|
785
|
+
this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
|
|
786
|
+
_context5.next = 22;
|
|
787
|
+
return this.ContentObjectMetadata({
|
|
788
|
+
libraryId: libraryId,
|
|
789
|
+
objectId: objectId,
|
|
790
|
+
writeToken: lroDraft.write_token,
|
|
791
|
+
metadataSubtree: "lro_status"
|
|
792
|
+
});
|
|
793
|
+
case 22:
|
|
794
|
+
return _context5.abrupt("return", _context5.sent);
|
|
795
|
+
case 23:
|
|
796
|
+
case "end":
|
|
797
|
+
return _context5.stop();
|
|
937
798
|
}
|
|
938
799
|
}, _callee5, this);
|
|
939
800
|
}));
|
|
940
|
-
|
|
941
801
|
return function (_x5) {
|
|
942
802
|
return _ref9.apply(this, arguments);
|
|
943
803
|
};
|
|
944
804
|
}();
|
|
805
|
+
|
|
945
806
|
/**
|
|
946
807
|
* Finalize a mezzanine object after all jobs have finished
|
|
947
808
|
*
|
|
@@ -956,186 +817,155 @@ exports.LROStatus = /*#__PURE__*/function () {
|
|
|
956
817
|
*
|
|
957
818
|
* @return {Promise<Object>} - The finalize response for the mezzanine object, as well as any logs, warnings and errors from the finalization
|
|
958
819
|
*/
|
|
959
|
-
|
|
960
|
-
|
|
961
820
|
exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
962
821
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
|
|
963
822
|
var libraryId, objectId, _ref10$offeringKey, offeringKey, preFinalizeFn, preFinalizeThrow, lroDraft, httpClient, error, result, mezzanineMetadata, masterHash, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, preFinalizeWarnings, params, finalizeResponse;
|
|
964
|
-
|
|
965
823
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
966
|
-
while (1) {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
if (!(!lroDraft || !lroDraft.write_token)) {
|
|
985
|
-
_context6.next = 7;
|
|
986
|
-
break;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
throw Error("No LRO draft found for this mezzanine");
|
|
990
|
-
|
|
991
|
-
case 7:
|
|
992
|
-
httpClient = this.HttpClient;
|
|
993
|
-
_context6.prev = 8;
|
|
994
|
-
// Point directly to the node containing the draft
|
|
995
|
-
this.HttpClient = new HttpClient({
|
|
996
|
-
uris: [lroDraft.node],
|
|
997
|
-
debug: httpClient.debug
|
|
998
|
-
});
|
|
999
|
-
_context6.next = 12;
|
|
1000
|
-
return this.ContentObjectMetadata({
|
|
1001
|
-
libraryId: libraryId,
|
|
1002
|
-
objectId: objectId,
|
|
1003
|
-
writeToken: lroDraft.write_token,
|
|
1004
|
-
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
1005
|
-
});
|
|
1006
|
-
|
|
1007
|
-
case 12:
|
|
1008
|
-
mezzanineMetadata = _context6.sent;
|
|
1009
|
-
masterHash = mezzanineMetadata[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
|
|
1010
|
-
|
|
1011
|
-
_context6.next = 16;
|
|
1012
|
-
return this.authClient.AuthorizationToken({
|
|
1013
|
-
libraryId: libraryId,
|
|
1014
|
-
objectId: objectId,
|
|
1015
|
-
update: true
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
case 16:
|
|
1019
|
-
_context6.t0 = _context6.sent;
|
|
1020
|
-
_context6.next = 19;
|
|
1021
|
-
return this.authClient.AuthorizationToken({
|
|
1022
|
-
versionHash: masterHash
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
|
-
case 19:
|
|
1026
|
-
_context6.t1 = _context6.sent;
|
|
1027
|
-
authorizationTokens = [_context6.t0, _context6.t1];
|
|
1028
|
-
headers = {
|
|
1029
|
-
Authorization: authorizationTokens.map(function (token) {
|
|
1030
|
-
return "Bearer ".concat(token);
|
|
1031
|
-
}).join(",")
|
|
1032
|
-
};
|
|
1033
|
-
_context6.next = 24;
|
|
1034
|
-
return this.CallBitcodeMethod({
|
|
1035
|
-
objectId: objectId,
|
|
1036
|
-
libraryId: libraryId,
|
|
1037
|
-
writeToken: lroDraft.write_token,
|
|
1038
|
-
method: UrlJoin("media", "abr_mezzanine", "offerings", offeringKey, "finalize"),
|
|
1039
|
-
headers: headers,
|
|
1040
|
-
constant: false
|
|
1041
|
-
});
|
|
1042
|
-
|
|
1043
|
-
case 24:
|
|
1044
|
-
_yield$this$CallBitco4 = _context6.sent;
|
|
1045
|
-
data = _yield$this$CallBitco4.data;
|
|
1046
|
-
errors = _yield$this$CallBitco4.errors;
|
|
1047
|
-
warnings = _yield$this$CallBitco4.warnings;
|
|
1048
|
-
logs = _yield$this$CallBitco4.logs;
|
|
1049
|
-
preFinalizeWarnings = [];
|
|
1050
|
-
|
|
1051
|
-
if (!preFinalizeFn) {
|
|
1052
|
-
_context6.next = 45;
|
|
1053
|
-
break;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
params = {
|
|
1057
|
-
elvClient: this,
|
|
1058
|
-
nodeUrl: lroDraft.node,
|
|
1059
|
-
writeToken: lroDraft.write_token
|
|
1060
|
-
};
|
|
1061
|
-
|
|
1062
|
-
if (!preFinalizeThrow) {
|
|
1063
|
-
_context6.next = 37;
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
_context6.next = 35;
|
|
1068
|
-
return preFinalizeFn(params);
|
|
1069
|
-
|
|
1070
|
-
case 35:
|
|
1071
|
-
_context6.next = 45;
|
|
824
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
825
|
+
case 0:
|
|
826
|
+
libraryId = _ref10.libraryId, objectId = _ref10.objectId, _ref10$offeringKey = _ref10.offeringKey, offeringKey = _ref10$offeringKey === void 0 ? "default" : _ref10$offeringKey, preFinalizeFn = _ref10.preFinalizeFn, preFinalizeThrow = _ref10.preFinalizeThrow;
|
|
827
|
+
ValidateParameters({
|
|
828
|
+
libraryId: libraryId,
|
|
829
|
+
objectId: objectId
|
|
830
|
+
});
|
|
831
|
+
_context6.next = 4;
|
|
832
|
+
return this.ContentObjectMetadata({
|
|
833
|
+
libraryId: libraryId,
|
|
834
|
+
objectId: objectId,
|
|
835
|
+
metadataSubtree: "lro_draft_".concat(offeringKey)
|
|
836
|
+
});
|
|
837
|
+
case 4:
|
|
838
|
+
lroDraft = _context6.sent;
|
|
839
|
+
if (!(!lroDraft || !lroDraft.write_token)) {
|
|
840
|
+
_context6.next = 7;
|
|
1072
841
|
break;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
842
|
+
}
|
|
843
|
+
throw Error("No LRO draft found for this mezzanine");
|
|
844
|
+
case 7:
|
|
845
|
+
httpClient = this.HttpClient;
|
|
846
|
+
_context6.prev = 8;
|
|
847
|
+
// Point directly to the node containing the draft
|
|
848
|
+
this.HttpClient = new HttpClient({
|
|
849
|
+
uris: [lroDraft.node],
|
|
850
|
+
debug: httpClient.debug
|
|
851
|
+
});
|
|
852
|
+
_context6.next = 12;
|
|
853
|
+
return this.ContentObjectMetadata({
|
|
854
|
+
libraryId: libraryId,
|
|
855
|
+
objectId: objectId,
|
|
856
|
+
writeToken: lroDraft.write_token,
|
|
857
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
858
|
+
});
|
|
859
|
+
case 12:
|
|
860
|
+
mezzanineMetadata = _context6.sent;
|
|
861
|
+
masterHash = mezzanineMetadata[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
|
|
862
|
+
_context6.next = 16;
|
|
863
|
+
return this.authClient.AuthorizationToken({
|
|
864
|
+
libraryId: libraryId,
|
|
865
|
+
objectId: objectId,
|
|
866
|
+
update: true
|
|
867
|
+
});
|
|
868
|
+
case 16:
|
|
869
|
+
_context6.t0 = _context6.sent;
|
|
870
|
+
_context6.next = 19;
|
|
871
|
+
return this.authClient.AuthorizationToken({
|
|
872
|
+
versionHash: masterHash
|
|
873
|
+
});
|
|
874
|
+
case 19:
|
|
875
|
+
_context6.t1 = _context6.sent;
|
|
876
|
+
authorizationTokens = [_context6.t0, _context6.t1];
|
|
877
|
+
headers = {
|
|
878
|
+
Authorization: authorizationTokens.map(function (token) {
|
|
879
|
+
return "Bearer ".concat(token);
|
|
880
|
+
}).join(",")
|
|
881
|
+
};
|
|
882
|
+
_context6.next = 24;
|
|
883
|
+
return this.CallBitcodeMethod({
|
|
884
|
+
objectId: objectId,
|
|
885
|
+
libraryId: libraryId,
|
|
886
|
+
writeToken: lroDraft.write_token,
|
|
887
|
+
method: UrlJoin("media", "abr_mezzanine", "offerings", offeringKey, "finalize"),
|
|
888
|
+
headers: headers,
|
|
889
|
+
constant: false
|
|
890
|
+
});
|
|
891
|
+
case 24:
|
|
892
|
+
_yield$this$CallBitco4 = _context6.sent;
|
|
893
|
+
data = _yield$this$CallBitco4.data;
|
|
894
|
+
errors = _yield$this$CallBitco4.errors;
|
|
895
|
+
warnings = _yield$this$CallBitco4.warnings;
|
|
896
|
+
logs = _yield$this$CallBitco4.logs;
|
|
897
|
+
preFinalizeWarnings = [];
|
|
898
|
+
if (!preFinalizeFn) {
|
|
1080
899
|
_context6.next = 45;
|
|
1081
900
|
break;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
_context6.next =
|
|
1090
|
-
return this.FinalizeContentObject({
|
|
1091
|
-
libraryId: libraryId,
|
|
1092
|
-
objectId: objectId,
|
|
1093
|
-
writeToken: lroDraft.write_token,
|
|
1094
|
-
commitMessage: "Finalize ABR mezzanine",
|
|
1095
|
-
awaitCommitConfirmation: false
|
|
1096
|
-
});
|
|
1097
|
-
|
|
1098
|
-
case 47:
|
|
1099
|
-
finalizeResponse = _context6.sent;
|
|
1100
|
-
result = _objectSpread({
|
|
1101
|
-
data: data,
|
|
1102
|
-
logs: logs || [],
|
|
1103
|
-
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
1104
|
-
errors: errors || []
|
|
1105
|
-
}, finalizeResponse);
|
|
1106
|
-
_context6.next = 54;
|
|
901
|
+
}
|
|
902
|
+
params = {
|
|
903
|
+
elvClient: this,
|
|
904
|
+
nodeUrl: lroDraft.node,
|
|
905
|
+
writeToken: lroDraft.write_token
|
|
906
|
+
};
|
|
907
|
+
if (!preFinalizeThrow) {
|
|
908
|
+
_context6.next = 37;
|
|
1107
909
|
break;
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
910
|
+
}
|
|
911
|
+
_context6.next = 35;
|
|
912
|
+
return preFinalizeFn(params);
|
|
913
|
+
case 35:
|
|
914
|
+
_context6.next = 45;
|
|
915
|
+
break;
|
|
916
|
+
case 37:
|
|
917
|
+
_context6.prev = 37;
|
|
918
|
+
_context6.next = 40;
|
|
919
|
+
return preFinalizeFn(params);
|
|
920
|
+
case 40:
|
|
921
|
+
_context6.next = 45;
|
|
922
|
+
break;
|
|
923
|
+
case 42:
|
|
924
|
+
_context6.prev = 42;
|
|
925
|
+
_context6.t2 = _context6["catch"](37);
|
|
926
|
+
preFinalizeWarnings = "Error trying to set video stream codec descriptors: ".concat(_context6.t2);
|
|
927
|
+
case 45:
|
|
928
|
+
_context6.next = 47;
|
|
929
|
+
return this.FinalizeContentObject({
|
|
930
|
+
libraryId: libraryId,
|
|
931
|
+
objectId: objectId,
|
|
932
|
+
writeToken: lroDraft.write_token,
|
|
933
|
+
commitMessage: "Finalize ABR mezzanine",
|
|
934
|
+
awaitCommitConfirmation: false
|
|
935
|
+
});
|
|
936
|
+
case 47:
|
|
937
|
+
finalizeResponse = _context6.sent;
|
|
938
|
+
result = _objectSpread({
|
|
939
|
+
data: data,
|
|
940
|
+
logs: logs || [],
|
|
941
|
+
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
942
|
+
errors: errors || []
|
|
943
|
+
}, finalizeResponse);
|
|
944
|
+
_context6.next = 54;
|
|
945
|
+
break;
|
|
946
|
+
case 51:
|
|
947
|
+
_context6.prev = 51;
|
|
948
|
+
_context6.t3 = _context6["catch"](8);
|
|
949
|
+
error = _context6.t3;
|
|
950
|
+
case 54:
|
|
951
|
+
_context6.prev = 54;
|
|
952
|
+
// Ensure original http client is restored
|
|
953
|
+
this.HttpClient = httpClient;
|
|
954
|
+
return _context6.finish(54);
|
|
955
|
+
case 57:
|
|
956
|
+
if (!error) {
|
|
957
|
+
_context6.next = 59;
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
throw error;
|
|
961
|
+
case 59:
|
|
962
|
+
return _context6.abrupt("return", result);
|
|
963
|
+
case 60:
|
|
964
|
+
case "end":
|
|
965
|
+
return _context6.stop();
|
|
1135
966
|
}
|
|
1136
967
|
}, _callee6, this, [[8, 51, 54, 57], [37, 42]]);
|
|
1137
968
|
}));
|
|
1138
|
-
|
|
1139
969
|
return function (_x6) {
|
|
1140
970
|
return _ref11.apply(this, arguments);
|
|
1141
971
|
};
|