@eluvio/elv-client-js 4.0.144 → 4.0.146
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 +15 -14
- package/dist/ElvClient-node-min.js +14 -13
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +15 -14
- package/dist/ElvWalletClient-node-min.js +14 -13
- package/dist/src/AuthorizationClient.js +9 -12
- package/dist/src/ContentObjectAudit.js +3 -3
- package/dist/src/ContentObjectVerification.js +3 -3
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +49 -30
- package/dist/src/ElvWallet.js +7 -5
- package/dist/src/EthClient.js +8 -9
- package/dist/src/FrameClient.js +8 -9
- package/dist/src/HttpClient.js +1 -2
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +31 -19
- package/dist/src/RemoteSigner.js +6 -8
- package/dist/src/UserProfileClient.js +35 -20
- package/dist/src/Utils.js +2 -3
- package/dist/src/Validation.js +10 -2
- package/dist/src/client/ABRPublishing.js +309 -253
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +2 -3
- package/dist/src/client/ContentManagement.js +3 -3
- package/dist/src/client/Contracts.js +11 -12
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +3 -5
- package/dist/src/client/LiveStream.js +0 -2
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/client/Shares.js +2 -2
- package/dist/src/walletClient/ClientMethods.js +2 -2
- package/dist/src/walletClient/Profile.js +2 -2
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +17 -14
- package/package.json +2 -2
- package/src/Validation.js +9 -3
- package/src/client/ABRPublishing.js +178 -161
|
@@ -2,8 +2,8 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
2
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
4
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
/**
|
|
8
8
|
* Methods for ABR video creation and management
|
|
9
9
|
*
|
|
@@ -18,7 +18,8 @@ var _require = require("../Validation"),
|
|
|
18
18
|
ValidateLibrary = _require.ValidateLibrary,
|
|
19
19
|
ValidateVersion = _require.ValidateVersion,
|
|
20
20
|
ValidateParameters = _require.ValidateParameters,
|
|
21
|
-
ValidateWriteToken = _require.ValidateWriteToken
|
|
21
|
+
ValidateWriteToken = _require.ValidateWriteToken,
|
|
22
|
+
ValidateObject = _require.ValidateObject;
|
|
22
23
|
|
|
23
24
|
// When `/abr_mezzanine/offerings` contains more than one entry, only 1 is the 'real' offering, the others are
|
|
24
25
|
// additional copies to be modified upon finalization due to addlOfferingSpecs having been specified in call to
|
|
@@ -90,7 +91,7 @@ var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
|
|
|
90
91
|
*/
|
|
91
92
|
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
92
93
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
93
|
-
var libraryId, type, writeToken, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel,
|
|
94
|
+
var libraryId, type, writeToken, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel, objectId, finalize, _yield$this$CreateCon, 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, additionalReturnVals;
|
|
94
95
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
95
96
|
while (1) switch (_context.prev = _context.next) {
|
|
96
97
|
case 0:
|
|
@@ -101,7 +102,8 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
101
102
|
_context.next = 7;
|
|
102
103
|
break;
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
// if write token passed in, don't create a new object
|
|
106
|
+
objectId = this.utils.DecodeWriteToken(writeToken).objectId;
|
|
105
107
|
_context.next = 12;
|
|
106
108
|
break;
|
|
107
109
|
case 7:
|
|
@@ -114,7 +116,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
114
116
|
});
|
|
115
117
|
case 9:
|
|
116
118
|
_yield$this$CreateCon = _context.sent;
|
|
117
|
-
|
|
119
|
+
objectId = _yield$this$CreateCon.objectId;
|
|
118
120
|
writeToken = _yield$this$CreateCon.writeToken;
|
|
119
121
|
case 12:
|
|
120
122
|
if (!fileInfo) {
|
|
@@ -215,7 +217,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
215
217
|
_context.next = 57;
|
|
216
218
|
return this.UploadFilesFromS3({
|
|
217
219
|
libraryId: libraryId,
|
|
218
|
-
objectId:
|
|
220
|
+
objectId: objectId,
|
|
219
221
|
writeToken: writeToken,
|
|
220
222
|
fileInfo: _credentialSet.matched,
|
|
221
223
|
region: region,
|
|
@@ -237,7 +239,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
237
239
|
_context.next = 64;
|
|
238
240
|
return this.UploadFiles({
|
|
239
241
|
libraryId: libraryId,
|
|
240
|
-
objectId:
|
|
242
|
+
objectId: objectId,
|
|
241
243
|
writeToken: writeToken,
|
|
242
244
|
fileInfo: fileInfo,
|
|
243
245
|
callback: callback,
|
|
@@ -247,7 +249,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
247
249
|
_context.next = 66;
|
|
248
250
|
return this.CreateEncryptionConk({
|
|
249
251
|
libraryId: libraryId,
|
|
250
|
-
objectId:
|
|
252
|
+
objectId: objectId,
|
|
251
253
|
writeToken: writeToken,
|
|
252
254
|
createKMSConk: true
|
|
253
255
|
});
|
|
@@ -255,7 +257,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
255
257
|
_context.next = 68;
|
|
256
258
|
return this.CallBitcodeMethod({
|
|
257
259
|
libraryId: libraryId,
|
|
258
|
-
objectId:
|
|
260
|
+
objectId: objectId,
|
|
259
261
|
writeToken: writeToken,
|
|
260
262
|
method: UrlJoin("media", "production_master", "init"),
|
|
261
263
|
queryParams: {
|
|
@@ -275,7 +277,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
275
277
|
_context.next = 74;
|
|
276
278
|
return this.MergeMetadata({
|
|
277
279
|
libraryId: libraryId,
|
|
278
|
-
objectId:
|
|
280
|
+
objectId: objectId,
|
|
279
281
|
writeToken: writeToken,
|
|
280
282
|
metadata: _objectSpread(_objectSpread({}, metadata || {}), {}, {
|
|
281
283
|
name: name,
|
|
@@ -296,28 +298,28 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
296
298
|
_context.next = 77;
|
|
297
299
|
return this.FinalizeContentObject({
|
|
298
300
|
libraryId: libraryId,
|
|
299
|
-
objectId:
|
|
301
|
+
objectId: objectId,
|
|
300
302
|
writeToken: writeToken,
|
|
301
303
|
commitMessage: "Create master",
|
|
302
304
|
awaitCommitConfirmation: false
|
|
303
305
|
});
|
|
304
306
|
case 77:
|
|
305
|
-
|
|
307
|
+
additionalReturnVals = _context.sent;
|
|
306
308
|
_context.next = 81;
|
|
307
309
|
break;
|
|
308
310
|
case 80:
|
|
309
|
-
|
|
311
|
+
additionalReturnVals = {
|
|
310
312
|
write_token: writeToken,
|
|
311
313
|
type: type,
|
|
312
314
|
qlib_id: libraryId,
|
|
313
|
-
id:
|
|
315
|
+
id: objectId
|
|
314
316
|
};
|
|
315
317
|
case 81:
|
|
316
318
|
return _context.abrupt("return", _objectSpread({
|
|
317
319
|
errors: errors || [],
|
|
318
320
|
logs: logs || [],
|
|
319
321
|
warnings: warnings || []
|
|
320
|
-
},
|
|
322
|
+
}, additionalReturnVals));
|
|
321
323
|
case 82:
|
|
322
324
|
case "end":
|
|
323
325
|
return _context.stop();
|
|
@@ -340,8 +342,8 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
340
342
|
* @param {boolean=} keepOtherStreams=false - If objectId is specified, whether to preserve existing streams with keys other than the ones specified in production master
|
|
341
343
|
* @param {string} libraryId - ID of the mezzanine library
|
|
342
344
|
* @param {string} masterVersionHash - The version hash of the production master content object
|
|
343
|
-
* @param {string=} masterWriteToken - The write token of the production master content object draft.
|
|
344
|
-
* @param {string=} writeToken - The write token of the mezzanine object draft. If specified, the object will not be finalized
|
|
345
|
+
* @param {string=} masterWriteToken - The write token of the production master content object draft.
|
|
346
|
+
* @param {string=} writeToken - The write token of the mezzanine object draft. If specified, the object will not be finalized, and no extra version of the object will be created to hold "bread crumb" metadata entry /lro_draft
|
|
345
347
|
* @param {Object=} metadata - Additional metadata for mezzanine content object
|
|
346
348
|
* @param {string} name - Name for mezzanine content object
|
|
347
349
|
* @param {string=} objectId - ID of existing object (if not specified, new object will be created)
|
|
@@ -356,135 +358,156 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
356
358
|
*/
|
|
357
359
|
exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
358
360
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
359
|
-
var libraryId, objectId, type, name, description, metadata, masterVersionHash, masterWriteToken, writeToken, abrProfile, addlOfferingSpecs, _ref3$variant, variant, _ref3$offeringKey, offeringKey, _ref3$keepOtherStream, keepOtherStreams, _ref3$respLogLevel, respLogLevel, _ref3$structLogLevel, structLogLevel, streamKeys, masterObjectId,
|
|
361
|
+
var libraryId, objectId, type, name, description, metadata, masterVersionHash, masterWriteToken, writeToken, abrProfile, addlOfferingSpecs, _ref3$variant, variant, _ref3$offeringKey, offeringKey, _ref3$keepOtherStream, keepOtherStreams, _ref3$respLogLevel, respLogLevel, _ref3$structLogLevel, structLogLevel, streamKeys, masterObjectId, masterLibId, useExistingMez, options, finalize, _yield$this$EditConte, _yield$this$CreateCon2, masterMetaSource, masterName, authorizationTokens, headers, body, storeClear, _yield$this$CallBitco2, logs, errors, warnings, masterId, existingMetadata, additionalReturnVals;
|
|
360
362
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
361
363
|
while (1) switch (_context2.prev = _context2.next) {
|
|
362
364
|
case 0:
|
|
363
365
|
libraryId = _ref3.libraryId, objectId = _ref3.objectId, type = _ref3.type, name = _ref3.name, description = _ref3.description, metadata = _ref3.metadata, masterVersionHash = _ref3.masterVersionHash, masterWriteToken = _ref3.masterWriteToken, writeToken = _ref3.writeToken, 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;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
} else if (masterWriteToken) {
|
|
368
|
-
ValidateWriteToken(masterWriteToken);
|
|
369
|
-
masterObjectId = this.utils.DecodeWriteToken(masterWriteToken).objectId;
|
|
366
|
+
if (!(!masterVersionHash && !masterWriteToken)) {
|
|
367
|
+
_context2.next = 3;
|
|
368
|
+
break;
|
|
370
369
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
370
|
+
throw Error("Neither master version hash nor master write token specified. One must be provided");
|
|
371
|
+
case 3:
|
|
372
|
+
if (!(masterVersionHash && masterWriteToken)) {
|
|
373
|
+
_context2.next = 5;
|
|
374
|
+
break;
|
|
376
375
|
}
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
throw Error("Both master version hash and master write token specified. Only one can be provided");
|
|
377
|
+
case 5:
|
|
378
|
+
// double-check library id for mez
|
|
379
|
+
ValidateLibrary(libraryId);
|
|
380
|
+
|
|
381
|
+
// The following 2 vars are used only if masterWriteToken is passed in (to retrieve master name)
|
|
382
|
+
if (!masterVersionHash) {
|
|
383
|
+
_context2.next = 10;
|
|
379
384
|
break;
|
|
380
385
|
}
|
|
381
|
-
|
|
382
|
-
|
|
386
|
+
// NOTE: masterObjectId is left undefined if masterWriteToken not passed in
|
|
387
|
+
ValidateVersion(masterVersionHash);
|
|
388
|
+
_context2.next = 16;
|
|
389
|
+
break;
|
|
390
|
+
case 10:
|
|
391
|
+
if (!masterWriteToken) {
|
|
392
|
+
_context2.next = 16;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
// determine master object id if a master write token was passed in
|
|
396
|
+
ValidateWriteToken(masterWriteToken);
|
|
397
|
+
masterObjectId = this.utils.DecodeWriteToken(masterWriteToken).objectId;
|
|
398
|
+
_context2.next = 15;
|
|
399
|
+
return client.ContentObjectLibraryId({
|
|
400
|
+
masterObjectId: masterObjectId
|
|
401
|
+
});
|
|
402
|
+
case 15:
|
|
403
|
+
masterLibId = _context2.sent;
|
|
404
|
+
case 16:
|
|
405
|
+
// if pre-existing mez object id passed in, validate
|
|
406
|
+
if (objectId) ValidateObject(objectId);
|
|
407
|
+
|
|
408
|
+
// if mez write token supplied, validate it
|
|
409
|
+
if (writeToken) {
|
|
410
|
+
ValidateWriteToken(writeToken, objectId);
|
|
411
|
+
|
|
412
|
+
// if pre-existing mez object id not passed in, decode it from write token
|
|
413
|
+
objectId = objectId || this.utils.DecodeWriteToken(writeToken).objectId;
|
|
414
|
+
}
|
|
415
|
+
// After above, if objectId is undefined then no mez writeToken was passed in, no mez objectId was passed in,
|
|
416
|
+
// meaning we must create a new object
|
|
417
|
+
useExistingMez = !!objectId; // type coerce string or undefined to boolean: "" -> false, undefined -> false, all else -> true
|
|
383
418
|
if (!(!objectId && keepOtherStreams)) {
|
|
384
|
-
_context2.next =
|
|
419
|
+
_context2.next = 21;
|
|
385
420
|
break;
|
|
386
421
|
}
|
|
387
422
|
throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");
|
|
388
|
-
case
|
|
423
|
+
case 21:
|
|
389
424
|
if (!(addlOfferingSpecs && !abrProfile)) {
|
|
390
|
-
_context2.next =
|
|
425
|
+
_context2.next = 23;
|
|
391
426
|
break;
|
|
392
427
|
}
|
|
393
428
|
throw Error("abrProfile required when using addlOfferingSpecs");
|
|
394
|
-
case
|
|
395
|
-
existingMez = !!objectId;
|
|
429
|
+
case 23:
|
|
396
430
|
options = type ? {
|
|
397
431
|
type: type
|
|
398
432
|
} : {};
|
|
399
|
-
finalize = !writeToken;
|
|
400
|
-
if (!
|
|
401
|
-
_context2.next =
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
if (!writeToken) {
|
|
405
|
-
_context2.next = 18;
|
|
433
|
+
finalize = !writeToken; // are we ingesting to an existing mez (and did NOT supply a write token?)
|
|
434
|
+
if (!(useExistingMez && !writeToken)) {
|
|
435
|
+
_context2.next = 30;
|
|
406
436
|
break;
|
|
407
437
|
}
|
|
408
|
-
|
|
409
|
-
_context2.next = 23;
|
|
410
|
-
break;
|
|
411
|
-
case 18:
|
|
412
|
-
_context2.next = 20;
|
|
438
|
+
_context2.next = 28;
|
|
413
439
|
return this.EditContentObject({
|
|
414
440
|
libraryId: libraryId,
|
|
415
441
|
objectId: objectId,
|
|
416
442
|
options: options
|
|
417
443
|
});
|
|
418
|
-
case
|
|
444
|
+
case 28:
|
|
419
445
|
_yield$this$EditConte = _context2.sent;
|
|
420
446
|
writeToken = _yield$this$EditConte.writeToken;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
_context2.next =
|
|
447
|
+
case 30:
|
|
448
|
+
if (useExistingMez) {
|
|
449
|
+
_context2.next = 36;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
_context2.next = 33;
|
|
427
453
|
return this.CreateContentObject({
|
|
428
454
|
libraryId: libraryId,
|
|
429
455
|
options: options
|
|
430
456
|
});
|
|
431
|
-
case
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
writeToken =
|
|
435
|
-
case
|
|
436
|
-
_context2.next =
|
|
457
|
+
case 33:
|
|
458
|
+
_yield$this$CreateCon2 = _context2.sent;
|
|
459
|
+
objectId = _yield$this$CreateCon2.objectId;
|
|
460
|
+
writeToken = _yield$this$CreateCon2.writeToken;
|
|
461
|
+
case 36:
|
|
462
|
+
_context2.next = 38;
|
|
437
463
|
return this.CreateEncryptionConk({
|
|
438
464
|
libraryId: libraryId,
|
|
439
|
-
objectId:
|
|
465
|
+
objectId: objectId,
|
|
440
466
|
writeToken: writeToken,
|
|
441
467
|
createKMSConk: true
|
|
442
468
|
});
|
|
443
|
-
case
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
_context2.next = 35;
|
|
456
|
-
return this.ContentObjectMetadata(_objectSpread(_objectSpread({}, nameMetaPayload), {}, {
|
|
469
|
+
case 38:
|
|
470
|
+
// figure out where to read master metadata from
|
|
471
|
+
masterMetaSource = masterWriteToken ? {
|
|
472
|
+
libraryId: masterLibId,
|
|
473
|
+
objectId: masterObjectId,
|
|
474
|
+
writeToken: masterWriteToken
|
|
475
|
+
} : {
|
|
476
|
+
versionHash: masterVersionHash
|
|
477
|
+
};
|
|
478
|
+
_context2.next = 41;
|
|
479
|
+
return this.ContentObjectMetadata(_objectSpread(_objectSpread({}, masterMetaSource), {}, {
|
|
457
480
|
metadataSubtree: "public/name"
|
|
458
481
|
}));
|
|
459
|
-
case
|
|
482
|
+
case 41:
|
|
460
483
|
masterName = _context2.sent;
|
|
461
484
|
// Include authorization for library, master, and mezzanine
|
|
462
485
|
authorizationTokens = [];
|
|
463
486
|
_context2.t0 = authorizationTokens;
|
|
464
|
-
_context2.next =
|
|
487
|
+
_context2.next = 46;
|
|
465
488
|
return this.authClient.AuthorizationToken({
|
|
466
489
|
libraryId: libraryId,
|
|
467
|
-
objectId:
|
|
490
|
+
objectId: objectId,
|
|
468
491
|
update: true
|
|
469
492
|
});
|
|
470
|
-
case
|
|
493
|
+
case 46:
|
|
471
494
|
_context2.t1 = _context2.sent;
|
|
472
495
|
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
473
496
|
_context2.t2 = authorizationTokens;
|
|
474
|
-
_context2.next =
|
|
497
|
+
_context2.next = 51;
|
|
475
498
|
return this.authClient.AuthorizationToken({
|
|
476
499
|
libraryId: libraryId
|
|
477
500
|
});
|
|
478
|
-
case
|
|
501
|
+
case 51:
|
|
479
502
|
_context2.t3 = _context2.sent;
|
|
480
503
|
_context2.t2.push.call(_context2.t2, _context2.t3);
|
|
481
504
|
_context2.t4 = authorizationTokens;
|
|
482
|
-
_context2.next =
|
|
505
|
+
_context2.next = 56;
|
|
483
506
|
return this.authClient.AuthorizationToken({
|
|
484
507
|
versionHash: masterVersionHash,
|
|
485
508
|
objectId: masterObjectId
|
|
486
509
|
});
|
|
487
|
-
case
|
|
510
|
+
case 56:
|
|
488
511
|
_context2.t5 = _context2.sent;
|
|
489
512
|
_context2.t4.push.call(_context2.t4, _context2.t5);
|
|
490
513
|
headers = {
|
|
@@ -500,40 +523,39 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
500
523
|
stream_keys: streamKeys,
|
|
501
524
|
variant_key: variant
|
|
502
525
|
};
|
|
503
|
-
storeClear = false;
|
|
504
526
|
if (!abrProfile) {
|
|
505
|
-
_context2.next =
|
|
527
|
+
_context2.next = 65;
|
|
506
528
|
break;
|
|
507
529
|
}
|
|
508
530
|
body.abr_profile = abrProfile;
|
|
509
531
|
storeClear = abrProfile.store_clear;
|
|
510
|
-
_context2.next =
|
|
532
|
+
_context2.next = 68;
|
|
511
533
|
break;
|
|
512
|
-
case
|
|
513
|
-
_context2.next =
|
|
534
|
+
case 65:
|
|
535
|
+
_context2.next = 67;
|
|
514
536
|
return this.ContentObjectMetadata({
|
|
515
537
|
libraryId: libraryId,
|
|
516
538
|
objectId: this.utils.AddressToObjectId(this.utils.HashToAddress(libraryId)),
|
|
517
539
|
metadataSubtree: "abr_profile/store_clear"
|
|
518
540
|
});
|
|
519
|
-
case
|
|
541
|
+
case 67:
|
|
520
542
|
storeClear = _context2.sent;
|
|
521
|
-
case
|
|
543
|
+
case 68:
|
|
522
544
|
if (storeClear) {
|
|
523
|
-
_context2.next =
|
|
545
|
+
_context2.next = 71;
|
|
524
546
|
break;
|
|
525
547
|
}
|
|
526
|
-
_context2.next =
|
|
548
|
+
_context2.next = 71;
|
|
527
549
|
return this.EncryptionConk({
|
|
528
550
|
libraryId: libraryId,
|
|
529
|
-
objectId:
|
|
551
|
+
objectId: objectId,
|
|
530
552
|
writeToken: writeToken
|
|
531
553
|
});
|
|
532
|
-
case
|
|
533
|
-
_context2.next =
|
|
554
|
+
case 71:
|
|
555
|
+
_context2.next = 73;
|
|
534
556
|
return this.CallBitcodeMethod({
|
|
535
557
|
libraryId: libraryId,
|
|
536
|
-
objectId:
|
|
558
|
+
objectId: objectId,
|
|
537
559
|
writeToken: writeToken,
|
|
538
560
|
method: UrlJoin("media", "abr_mezzanine", "init"),
|
|
539
561
|
queryParams: {
|
|
@@ -544,7 +566,7 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
544
566
|
body: body,
|
|
545
567
|
constant: false
|
|
546
568
|
});
|
|
547
|
-
case
|
|
569
|
+
case 73:
|
|
548
570
|
_yield$this$CallBitco2 = _context2.sent;
|
|
549
571
|
logs = _yield$this$CallBitco2.logs;
|
|
550
572
|
errors = _yield$this$CallBitco2.errors;
|
|
@@ -575,70 +597,70 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
575
597
|
"/": "./rep/playout/".concat(offeringKey, "/options.json")
|
|
576
598
|
})
|
|
577
599
|
}, metadata["public"].asset_metadata);
|
|
578
|
-
if (name || !
|
|
600
|
+
if (name || !useExistingMez) {
|
|
579
601
|
metadata.name = name || "".concat(masterName, " Mezzanine");
|
|
580
602
|
metadata["public"].name = name || "".concat(masterName, " Mezzanine");
|
|
581
603
|
}
|
|
582
|
-
if (description || !
|
|
604
|
+
if (description || !useExistingMez) {
|
|
583
605
|
metadata.description = description || "";
|
|
584
606
|
metadata["public"].description = description || "";
|
|
585
607
|
}
|
|
586
608
|
|
|
587
609
|
// retrieve existing metadata to merge with updated metadata
|
|
588
|
-
_context2.next =
|
|
610
|
+
_context2.next = 88;
|
|
589
611
|
return this.ContentObjectMetadata({
|
|
590
612
|
libraryId: libraryId,
|
|
591
|
-
objectId:
|
|
613
|
+
objectId: objectId,
|
|
592
614
|
writeToken: writeToken
|
|
593
615
|
});
|
|
594
|
-
case
|
|
616
|
+
case 88:
|
|
595
617
|
existingMetadata = _context2.sent;
|
|
596
618
|
// newer metadata values replace existing metadata, unless both new and old values are objects,
|
|
597
619
|
// in which case their keys are merged recursively
|
|
598
620
|
metadata = R.mergeDeepRight(existingMetadata, metadata);
|
|
599
|
-
if (!
|
|
621
|
+
if (!useExistingMez) {
|
|
600
622
|
// set creation date
|
|
601
623
|
metadata.elv_created_at = new Date().getTime();
|
|
602
624
|
}
|
|
603
625
|
|
|
604
626
|
// write metadata to mezzanine object
|
|
605
|
-
_context2.next =
|
|
627
|
+
_context2.next = 93;
|
|
606
628
|
return this.ReplaceMetadata({
|
|
607
629
|
libraryId: libraryId,
|
|
608
|
-
objectId:
|
|
630
|
+
objectId: objectId,
|
|
609
631
|
writeToken: writeToken,
|
|
610
632
|
metadata: metadata
|
|
611
633
|
});
|
|
612
|
-
case
|
|
634
|
+
case 93:
|
|
613
635
|
if (!finalize) {
|
|
614
|
-
_context2.next =
|
|
636
|
+
_context2.next = 99;
|
|
615
637
|
break;
|
|
616
638
|
}
|
|
617
|
-
_context2.next =
|
|
639
|
+
_context2.next = 96;
|
|
618
640
|
return this.FinalizeContentObject({
|
|
619
641
|
libraryId: libraryId,
|
|
620
|
-
objectId:
|
|
642
|
+
objectId: objectId,
|
|
621
643
|
writeToken: writeToken,
|
|
622
644
|
commitMessage: "Create ABR mezzanine"
|
|
623
645
|
});
|
|
624
|
-
case
|
|
625
|
-
|
|
626
|
-
_context2.next =
|
|
646
|
+
case 96:
|
|
647
|
+
additionalReturnVals = _context2.sent;
|
|
648
|
+
_context2.next = 100;
|
|
627
649
|
break;
|
|
628
|
-
case
|
|
629
|
-
|
|
650
|
+
case 99:
|
|
651
|
+
additionalReturnVals = {
|
|
630
652
|
write_token: writeToken,
|
|
631
653
|
type: type,
|
|
632
654
|
qlib_id: libraryId,
|
|
633
|
-
id:
|
|
655
|
+
id: objectId
|
|
634
656
|
};
|
|
635
|
-
case
|
|
657
|
+
case 100:
|
|
636
658
|
return _context2.abrupt("return", _objectSpread({
|
|
637
659
|
logs: logs || [],
|
|
638
660
|
warnings: warnings || [],
|
|
639
661
|
errors: errors || []
|
|
640
|
-
},
|
|
641
|
-
case
|
|
662
|
+
}, additionalReturnVals));
|
|
663
|
+
case 101:
|
|
642
664
|
case "end":
|
|
643
665
|
return _context2.stop();
|
|
644
666
|
}
|
|
@@ -656,7 +678,7 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
656
678
|
* @namedParams
|
|
657
679
|
* @param {string} libraryId - ID of the mezzanine library
|
|
658
680
|
* @param {string} objectId - ID of the mezzanine object
|
|
659
|
-
* @param {string=} writeToken - Write token of the mezzanine object draft. If provided,
|
|
681
|
+
* @param {string=} writeToken - Write token of the mezzanine object draft. If provided, no "bread crumb" metadata /lro_draft will be created, nor saved as an extra finalized version
|
|
660
682
|
* @param {Array<Object>=} access - Array of S3 credentials, along with path matching regexes - Required if any files in the masters are S3 references (See CreateProductionMaster method)
|
|
661
683
|
* - Format: {region, bucket, accessKey, secret}
|
|
662
684
|
* @param {number[]} jobIndexes - Array of LRO job indexes to start. LROs are listed in a map under metadata key /abr_mezzanine/offerings/(offeringKey)/mez_prep_specs/, and job indexes start with 0, corresponding to map keys in alphabetical order
|
|
@@ -666,7 +688,7 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
|
|
|
666
688
|
exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
667
689
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
668
690
|
var _this = this;
|
|
669
|
-
var libraryId, objectId, writeToken, _ref5$access, access, _ref5$jobIndexes, jobIndexes, lastJobOfferingsInfo, offeringKey, prepSpecs, masterVersionHashes, authorizationTokens, headers,
|
|
691
|
+
var libraryId, objectId, writeToken, _ref5$access, access, _ref5$jobIndexes, jobIndexes, writeTokenSupplied, lastJobOfferingsInfo, offeringKey, prepSpecs, masterVersionHashes, authorizationTokens, headers, breadCrumb, breadCrumbHash, lroWorkingDraft, breadCrumbDraft, finalizeResponse, nodeUrl, _yield$this$CallBitco3, data, errors, warnings, logs;
|
|
670
692
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
671
693
|
while (1) switch (_context4.prev = _context4.next) {
|
|
672
694
|
case 0:
|
|
@@ -675,29 +697,28 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
675
697
|
libraryId: libraryId,
|
|
676
698
|
objectId: objectId
|
|
677
699
|
});
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
700
|
+
writeTokenSupplied = !!writeToken;
|
|
701
|
+
if (writeTokenSupplied) {
|
|
702
|
+
ValidateWriteToken(writeToken, objectId);
|
|
703
|
+
objectId = objectId || this.utils.DecodeWriteToken(writeToken).objectId;
|
|
683
704
|
}
|
|
684
|
-
_context4.next =
|
|
705
|
+
_context4.next = 6;
|
|
685
706
|
return this.ContentObjectMetadata({
|
|
686
707
|
libraryId: libraryId,
|
|
687
708
|
objectId: objectId,
|
|
688
709
|
writeToken: writeToken,
|
|
689
710
|
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
690
711
|
});
|
|
691
|
-
case
|
|
712
|
+
case 6:
|
|
692
713
|
lastJobOfferingsInfo = _context4.sent;
|
|
693
714
|
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
694
715
|
prepSpecs = lastJobOfferingsInfo[offeringKey].mez_prep_specs;
|
|
695
716
|
if (prepSpecs) {
|
|
696
|
-
_context4.next =
|
|
717
|
+
_context4.next = 11;
|
|
697
718
|
break;
|
|
698
719
|
}
|
|
699
720
|
throw Error("No stream preparation specs found");
|
|
700
|
-
case
|
|
721
|
+
case 11:
|
|
701
722
|
// Retrieve all masters associated with this offering
|
|
702
723
|
masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
|
|
703
724
|
return (prepSpecs[spec].source_streams || []).map(function (stream) {
|
|
@@ -711,7 +732,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
711
732
|
});
|
|
712
733
|
|
|
713
734
|
// Retrieve authorization tokens for all masters and the mezzanine
|
|
714
|
-
_context4.next =
|
|
735
|
+
_context4.next = 15;
|
|
715
736
|
return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
|
|
716
737
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
|
|
717
738
|
var payload;
|
|
@@ -738,15 +759,15 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
738
759
|
return _ref7.apply(this, arguments);
|
|
739
760
|
};
|
|
740
761
|
}()));
|
|
741
|
-
case
|
|
762
|
+
case 15:
|
|
742
763
|
authorizationTokens = _context4.sent;
|
|
743
|
-
_context4.next =
|
|
764
|
+
_context4.next = 18;
|
|
744
765
|
return this.authClient.AuthorizationToken({
|
|
745
766
|
libraryId: libraryId,
|
|
746
767
|
objectId: objectId,
|
|
747
768
|
update: true
|
|
748
769
|
});
|
|
749
|
-
case
|
|
770
|
+
case 18:
|
|
750
771
|
_context4.t0 = _context4.sent;
|
|
751
772
|
authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
|
|
752
773
|
headers = {
|
|
@@ -754,83 +775,71 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
754
775
|
return "Bearer ".concat(token);
|
|
755
776
|
}).join(",")
|
|
756
777
|
};
|
|
757
|
-
if (
|
|
758
|
-
_context4.next =
|
|
778
|
+
if (writeTokenSupplied) {
|
|
779
|
+
_context4.next = 36;
|
|
759
780
|
break;
|
|
760
781
|
}
|
|
761
|
-
_context4.next =
|
|
762
|
-
return this.WriteTokenNodeUrlNetwork({
|
|
763
|
-
writeToken: writeToken
|
|
764
|
-
});
|
|
765
|
-
case 23:
|
|
766
|
-
nodeUrl = _context4.sent;
|
|
767
|
-
processingDraft = {
|
|
768
|
-
write_token: writeToken,
|
|
769
|
-
nodeUrl: nodeUrl
|
|
770
|
-
};
|
|
771
|
-
_context4.next = 30;
|
|
772
|
-
break;
|
|
773
|
-
case 27:
|
|
774
|
-
_context4.next = 29;
|
|
782
|
+
_context4.next = 24;
|
|
775
783
|
return this.EditContentObject({
|
|
776
784
|
libraryId: libraryId,
|
|
777
785
|
objectId: objectId
|
|
778
786
|
});
|
|
779
|
-
case
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}; // Update metadata with LRO version write token
|
|
787
|
-
if (!writeToken) {
|
|
788
|
-
_context4.next = 36;
|
|
789
|
-
break;
|
|
790
|
-
}
|
|
791
|
-
_context4.next = 34;
|
|
792
|
-
return this.ReplaceMetadata({
|
|
793
|
-
libraryId: libraryId,
|
|
794
|
-
objectId: objectId,
|
|
795
|
-
writeToken: writeToken,
|
|
796
|
-
metadataSubtree: "lro_draft",
|
|
797
|
-
metadata: lroInfo
|
|
798
|
-
});
|
|
799
|
-
case 34:
|
|
800
|
-
_context4.next = 44;
|
|
801
|
-
break;
|
|
802
|
-
case 36:
|
|
803
|
-
_context4.next = 38;
|
|
787
|
+
case 24:
|
|
788
|
+
lroWorkingDraft = _context4.sent;
|
|
789
|
+
writeToken = lroWorkingDraft.writeToken;
|
|
790
|
+
|
|
791
|
+
// Save this write token (and node url, and offering key) to ANOTHER, NEW write token in order to
|
|
792
|
+
// record "bread crumb" metadata at /lro_draft, and save (finalize) this second write token
|
|
793
|
+
_context4.next = 28;
|
|
804
794
|
return this.EditContentObject({
|
|
805
795
|
libraryId: libraryId,
|
|
806
796
|
objectId: objectId
|
|
807
797
|
});
|
|
808
|
-
case
|
|
809
|
-
|
|
810
|
-
|
|
798
|
+
case 28:
|
|
799
|
+
breadCrumbDraft = _context4.sent;
|
|
800
|
+
breadCrumb = {
|
|
801
|
+
write_token: lroWorkingDraft.writeToken,
|
|
802
|
+
node: lroWorkingDraft.nodeUrl,
|
|
803
|
+
offering: offeringKey
|
|
804
|
+
};
|
|
805
|
+
_context4.next = 32;
|
|
811
806
|
return this.ReplaceMetadata({
|
|
812
807
|
libraryId: libraryId,
|
|
813
808
|
objectId: objectId,
|
|
814
|
-
writeToken:
|
|
809
|
+
writeToken: breadCrumbDraft.writeToken,
|
|
815
810
|
metadataSubtree: "lro_draft",
|
|
816
|
-
metadata:
|
|
811
|
+
metadata: breadCrumb
|
|
817
812
|
});
|
|
818
|
-
case
|
|
819
|
-
_context4.next =
|
|
813
|
+
case 32:
|
|
814
|
+
_context4.next = 34;
|
|
820
815
|
return this.FinalizeContentObject({
|
|
821
816
|
libraryId: libraryId,
|
|
822
817
|
objectId: objectId,
|
|
823
|
-
writeToken:
|
|
824
|
-
commitMessage: "
|
|
818
|
+
writeToken: breadCrumbDraft.write_token,
|
|
819
|
+
commitMessage: "Save mez LRO write token to /lro_draft"
|
|
825
820
|
});
|
|
826
|
-
case
|
|
821
|
+
case 34:
|
|
827
822
|
finalizeResponse = _context4.sent;
|
|
828
|
-
|
|
829
|
-
|
|
823
|
+
breadCrumbHash = finalizeResponse.hash;
|
|
824
|
+
case 36:
|
|
825
|
+
_context4.next = 38;
|
|
826
|
+
return this.WriteTokenNodeUrlNetwork({
|
|
827
|
+
writeToken: writeToken
|
|
828
|
+
});
|
|
829
|
+
case 38:
|
|
830
|
+
nodeUrl = _context4.sent;
|
|
831
|
+
// tell http client what node to contact for this write token
|
|
832
|
+
this.RecordWriteToken({
|
|
833
|
+
writeToken: writeToken,
|
|
834
|
+
fabricNodeUrl: nodeUrl
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
// Make the API call that actually starts the LROs
|
|
838
|
+
_context4.next = 42;
|
|
830
839
|
return this.CallBitcodeMethod({
|
|
831
840
|
libraryId: libraryId,
|
|
832
841
|
objectId: objectId,
|
|
833
|
-
writeToken:
|
|
842
|
+
writeToken: writeToken,
|
|
834
843
|
headers: headers,
|
|
835
844
|
method: UrlJoin("media", "abr_mezzanine", "prep_start"),
|
|
836
845
|
constant: false,
|
|
@@ -840,23 +849,23 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
840
849
|
job_indexes: jobIndexes
|
|
841
850
|
}
|
|
842
851
|
});
|
|
843
|
-
case
|
|
852
|
+
case 42:
|
|
844
853
|
_yield$this$CallBitco3 = _context4.sent;
|
|
845
854
|
data = _yield$this$CallBitco3.data;
|
|
846
855
|
errors = _yield$this$CallBitco3.errors;
|
|
847
856
|
warnings = _yield$this$CallBitco3.warnings;
|
|
848
857
|
logs = _yield$this$CallBitco3.logs;
|
|
849
858
|
return _context4.abrupt("return", {
|
|
850
|
-
hash:
|
|
851
|
-
lro_draft:
|
|
852
|
-
writeToken:
|
|
853
|
-
nodeUrl:
|
|
859
|
+
hash: breadCrumbHash,
|
|
860
|
+
lro_draft: breadCrumb,
|
|
861
|
+
writeToken: writeToken,
|
|
862
|
+
nodeUrl: nodeUrl,
|
|
854
863
|
data: data,
|
|
855
864
|
logs: logs || [],
|
|
856
865
|
warnings: warnings || [],
|
|
857
866
|
errors: errors || []
|
|
858
867
|
});
|
|
859
|
-
case
|
|
868
|
+
case 48:
|
|
860
869
|
case "end":
|
|
861
870
|
return _context4.stop();
|
|
862
871
|
}
|
|
@@ -871,6 +880,10 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
871
880
|
* Retrieve node and write token for a mezzanine's current offering preparation job (if any).
|
|
872
881
|
* Also returns the offering key.
|
|
873
882
|
*
|
|
883
|
+
* This information is contained in metadata at /lro_draft, in an extra version of the object
|
|
884
|
+
* that gets created and finalized as part of creating a mezzanine. This serves as a "bread crumb trail" to
|
|
885
|
+
* allow users to find the active draft/write token that the ingest LROs are writing to.
|
|
886
|
+
*
|
|
874
887
|
* @methodGroup ABR Publishing
|
|
875
888
|
* @namedParams
|
|
876
889
|
* @param {string} libraryId - ID of the library
|
|
@@ -880,16 +893,15 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
|
|
|
880
893
|
*/
|
|
881
894
|
exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
882
895
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
883
|
-
var libraryId, objectId,
|
|
896
|
+
var libraryId, objectId, standardPathContents, lastJobOfferingsInfo, mainOfferingKey, ready, oldPathContents;
|
|
884
897
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
885
898
|
while (1) switch (_context5.prev = _context5.next) {
|
|
886
899
|
case 0:
|
|
887
|
-
libraryId = _ref8.libraryId, objectId = _ref8.objectId
|
|
900
|
+
libraryId = _ref8.libraryId, objectId = _ref8.objectId;
|
|
888
901
|
_context5.next = 3;
|
|
889
902
|
return this.ContentObjectMetadata({
|
|
890
903
|
libraryId: libraryId,
|
|
891
904
|
objectId: objectId,
|
|
892
|
-
writeToken: writeToken,
|
|
893
905
|
metadataSubtree: "lro_draft"
|
|
894
906
|
});
|
|
895
907
|
case 3:
|
|
@@ -959,47 +971,67 @@ exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
|
959
971
|
|
|
960
972
|
/**
|
|
961
973
|
* Retrieve status information for mezzanine transcoding jobs, aka long running operations (LROs) on the given object.
|
|
974
|
+
* If a write token is passed in, its draft will be checked directly by lookiing at /lro_status.
|
|
975
|
+
* If a write token is not passed in, then the latest version of objectId will be checked for "bread crumb" entry
|
|
976
|
+
* at /lro_draft, to determine the write token that current ingest LRO(s) are writing to.
|
|
962
977
|
*
|
|
963
978
|
* @methodGroup ABR Publishing
|
|
964
979
|
* @namedParams
|
|
965
980
|
* @param {string} libraryId - ID of the library
|
|
966
981
|
* @param {string} objectId - ID of the object
|
|
982
|
+
* @param {string=} writeToken - Write token of the active draft (that the transcode LROs are writing to)
|
|
967
983
|
*
|
|
968
984
|
* @return {Promise<Object>} - LRO status
|
|
969
985
|
*/
|
|
970
986
|
exports.LROStatus = /*#__PURE__*/function () {
|
|
971
987
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
|
|
972
|
-
var libraryId, objectId, writeToken, lroDraft;
|
|
988
|
+
var libraryId, objectId, _ref10$writeToken, writeToken, activeWriteToken, lroDraft, fabricNodeUrl;
|
|
973
989
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
974
990
|
while (1) switch (_context6.prev = _context6.next) {
|
|
975
991
|
case 0:
|
|
976
|
-
libraryId = _ref10.libraryId, objectId = _ref10.objectId, writeToken = _ref10.writeToken;
|
|
992
|
+
libraryId = _ref10.libraryId, objectId = _ref10.objectId, _ref10$writeToken = _ref10.writeToken, writeToken = _ref10$writeToken === void 0 ? "" : _ref10$writeToken;
|
|
977
993
|
ValidateParameters({
|
|
978
994
|
libraryId: libraryId,
|
|
979
995
|
objectId: objectId
|
|
980
996
|
});
|
|
981
|
-
|
|
997
|
+
if (!writeToken) {
|
|
998
|
+
_context6.next = 7;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
ValidateWriteToken(writeToken, objectId);
|
|
1002
|
+
activeWriteToken = writeToken;
|
|
1003
|
+
_context6.next = 15;
|
|
1004
|
+
break;
|
|
1005
|
+
case 7:
|
|
1006
|
+
_context6.next = 9;
|
|
982
1007
|
return this.LRODraftInfo({
|
|
983
1008
|
libraryId: libraryId,
|
|
984
|
-
objectId: objectId
|
|
985
|
-
writeToken: writeToken
|
|
1009
|
+
objectId: objectId
|
|
986
1010
|
});
|
|
987
|
-
case
|
|
1011
|
+
case 9:
|
|
988
1012
|
lroDraft = _context6.sent;
|
|
1013
|
+
activeWriteToken = lroDraft.write_token;
|
|
1014
|
+
_context6.next = 13;
|
|
1015
|
+
return this.WriteTokenNodeUrlNetwork({
|
|
1016
|
+
writeToken: activeWriteToken
|
|
1017
|
+
});
|
|
1018
|
+
case 13:
|
|
1019
|
+
fabricNodeUrl = _context6.sent;
|
|
989
1020
|
this.RecordWriteToken({
|
|
990
1021
|
writeToken: lroDraft.write_token,
|
|
991
|
-
fabricNodeUrl:
|
|
1022
|
+
fabricNodeUrl: fabricNodeUrl
|
|
992
1023
|
});
|
|
993
|
-
|
|
1024
|
+
case 15:
|
|
1025
|
+
_context6.next = 17;
|
|
994
1026
|
return this.ContentObjectMetadata({
|
|
995
1027
|
libraryId: libraryId,
|
|
996
1028
|
objectId: objectId,
|
|
997
|
-
writeToken:
|
|
1029
|
+
writeToken: activeWriteToken,
|
|
998
1030
|
metadataSubtree: "lro_status"
|
|
999
1031
|
});
|
|
1000
|
-
case
|
|
1032
|
+
case 17:
|
|
1001
1033
|
return _context6.abrupt("return", _context6.sent);
|
|
1002
|
-
case
|
|
1034
|
+
case 18:
|
|
1003
1035
|
case "end":
|
|
1004
1036
|
return _context6.stop();
|
|
1005
1037
|
}
|
|
@@ -1011,13 +1043,17 @@ exports.LROStatus = /*#__PURE__*/function () {
|
|
|
1011
1043
|
}();
|
|
1012
1044
|
|
|
1013
1045
|
/**
|
|
1014
|
-
*
|
|
1046
|
+
* Process completed mezzanine transcoding LRO(s), creating the final offering(s) from the transcode(s)
|
|
1047
|
+
* Unless a writeToken is passed in, finalize the mez object working draft as well.
|
|
1048
|
+
*
|
|
1049
|
+
* If a writeToken is not passed in, then it will be retrieved from /lro_draft of most recent version of object.
|
|
1050
|
+
* This is a "bread crumb" entry that gets created by StartABRMezzanineJobs() - unless a writeToken was passed in to StartABRMezzanineJobs() also.
|
|
1015
1051
|
*
|
|
1016
1052
|
* @methodGroup ABR Publishing
|
|
1017
1053
|
* @namedParams
|
|
1018
1054
|
* @param {string} libraryId - ID of the mezzanine library
|
|
1019
1055
|
* @param {string} objectId - ID of the mezzanine object
|
|
1020
|
-
* @param {string} writeToken - Write token for the mezzanine object. If specified, the object will not be finalized.
|
|
1056
|
+
* @param {string=} writeToken - Write token for the mezzanine object. If specified, the object will not be finalized.
|
|
1021
1057
|
* @param {function=} preFinalizeFn - A function to call before finalizing changes, to allow further modifications to offering. The function will be invoked with {elvClient, nodeUrl, writeToken} to allow access to the draft and MUST NOT finalize the draft.
|
|
1022
1058
|
* @param {boolean=} preFinalizeThrow - If set to `true` then any error thrown by preFinalizeFn will not be caught. Otherwise, any exception will be appended to the `warnings` array returned after finalization.
|
|
1023
1059
|
*
|
|
@@ -1025,59 +1061,75 @@ exports.LROStatus = /*#__PURE__*/function () {
|
|
|
1025
1061
|
*/
|
|
1026
1062
|
exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
1027
1063
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
|
|
1028
|
-
var libraryId, objectId, preFinalizeFn, preFinalizeThrow, writeToken,
|
|
1064
|
+
var libraryId, objectId, preFinalizeFn, preFinalizeThrow, _ref12$writeToken, writeToken, writeTokenSupplied, lroDraft, fabricNodeUrl, lastJobOfferingsInfo, offeringKey, masterHash, masterIdentifier, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, preFinalizeWarnings, params, finalizeResponse;
|
|
1029
1065
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1030
1066
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1031
1067
|
case 0:
|
|
1032
|
-
libraryId = _ref12.libraryId, objectId = _ref12.objectId, preFinalizeFn = _ref12.preFinalizeFn, preFinalizeThrow = _ref12.preFinalizeThrow, writeToken = _ref12.writeToken;
|
|
1068
|
+
libraryId = _ref12.libraryId, objectId = _ref12.objectId, preFinalizeFn = _ref12.preFinalizeFn, preFinalizeThrow = _ref12.preFinalizeThrow, _ref12$writeToken = _ref12.writeToken, writeToken = _ref12$writeToken === void 0 ? "" : _ref12$writeToken;
|
|
1033
1069
|
ValidateParameters({
|
|
1034
1070
|
libraryId: libraryId,
|
|
1035
1071
|
objectId: objectId
|
|
1036
1072
|
});
|
|
1037
|
-
|
|
1038
|
-
|
|
1073
|
+
writeTokenSupplied = !!writeToken;
|
|
1074
|
+
if (!writeTokenSupplied) {
|
|
1075
|
+
_context7.next = 8;
|
|
1076
|
+
break;
|
|
1039
1077
|
}
|
|
1040
|
-
|
|
1078
|
+
ValidateWriteToken(writeToken, objectId);
|
|
1079
|
+
objectId = objectId || this.utils.DecodeWriteToken(writeToken).objectId;
|
|
1080
|
+
_context7.next = 12;
|
|
1081
|
+
break;
|
|
1082
|
+
case 8:
|
|
1083
|
+
_context7.next = 10;
|
|
1084
|
+
return this.LRODraftInfo({
|
|
1085
|
+
libraryId: libraryId,
|
|
1086
|
+
objectId: objectId
|
|
1087
|
+
});
|
|
1088
|
+
case 10:
|
|
1089
|
+
lroDraft = _context7.sent;
|
|
1090
|
+
writeToken = lroDraft.write_token;
|
|
1091
|
+
case 12:
|
|
1092
|
+
_context7.next = 14;
|
|
1041
1093
|
return this.WriteTokenNodeUrlNetwork({
|
|
1042
1094
|
writeToken: writeToken
|
|
1043
1095
|
});
|
|
1044
|
-
case
|
|
1045
|
-
|
|
1096
|
+
case 14:
|
|
1097
|
+
fabricNodeUrl = _context7.sent;
|
|
1046
1098
|
// tell http client what node to contact for this write token
|
|
1047
1099
|
this.RecordWriteToken({
|
|
1048
1100
|
writeToken: writeToken,
|
|
1049
|
-
fabricNodeUrl:
|
|
1101
|
+
fabricNodeUrl: fabricNodeUrl
|
|
1050
1102
|
});
|
|
1051
|
-
_context7.next =
|
|
1103
|
+
_context7.next = 18;
|
|
1052
1104
|
return this.ContentObjectMetadata({
|
|
1053
1105
|
libraryId: libraryId,
|
|
1054
1106
|
objectId: objectId,
|
|
1055
1107
|
writeToken: writeToken,
|
|
1056
1108
|
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
1057
1109
|
});
|
|
1058
|
-
case
|
|
1110
|
+
case 18:
|
|
1059
1111
|
lastJobOfferingsInfo = _context7.sent;
|
|
1060
1112
|
offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
|
|
1061
1113
|
masterHash = lastJobOfferingsInfo[offeringKey].prod_master_hash;
|
|
1062
|
-
|
|
1114
|
+
masterIdentifier = {};
|
|
1063
1115
|
if (masterHash.startsWith("tqw__")) {
|
|
1064
|
-
|
|
1116
|
+
masterIdentifier["objectId"] = this.utils.DecodeWriteToken(masterHash).objectId;
|
|
1065
1117
|
} else {
|
|
1066
|
-
|
|
1118
|
+
masterIdentifier["versionHash"] = masterHash;
|
|
1067
1119
|
}
|
|
1068
1120
|
|
|
1069
1121
|
// Authorization token for mezzanine and master
|
|
1070
|
-
_context7.next =
|
|
1122
|
+
_context7.next = 25;
|
|
1071
1123
|
return this.authClient.AuthorizationToken({
|
|
1072
1124
|
libraryId: libraryId,
|
|
1073
1125
|
objectId: objectId,
|
|
1074
1126
|
update: true
|
|
1075
1127
|
});
|
|
1076
|
-
case
|
|
1128
|
+
case 25:
|
|
1077
1129
|
_context7.t0 = _context7.sent;
|
|
1078
|
-
_context7.next =
|
|
1079
|
-
return this.authClient.AuthorizationToken(_objectSpread({},
|
|
1080
|
-
case
|
|
1130
|
+
_context7.next = 28;
|
|
1131
|
+
return this.authClient.AuthorizationToken(_objectSpread({}, masterIdentifier));
|
|
1132
|
+
case 28:
|
|
1081
1133
|
_context7.t1 = _context7.sent;
|
|
1082
1134
|
authorizationTokens = [_context7.t0, _context7.t1];
|
|
1083
1135
|
headers = {
|
|
@@ -1085,7 +1137,7 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1085
1137
|
return "Bearer ".concat(token);
|
|
1086
1138
|
}).join(",")
|
|
1087
1139
|
};
|
|
1088
|
-
_context7.next =
|
|
1140
|
+
_context7.next = 33;
|
|
1089
1141
|
return this.CallBitcodeMethod({
|
|
1090
1142
|
objectId: objectId,
|
|
1091
1143
|
libraryId: libraryId,
|
|
@@ -1094,7 +1146,7 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1094
1146
|
headers: headers,
|
|
1095
1147
|
constant: false
|
|
1096
1148
|
});
|
|
1097
|
-
case
|
|
1149
|
+
case 33:
|
|
1098
1150
|
_yield$this$CallBitco4 = _context7.sent;
|
|
1099
1151
|
data = _yield$this$CallBitco4.data;
|
|
1100
1152
|
errors = _yield$this$CallBitco4.errors;
|
|
@@ -1102,7 +1154,7 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1102
1154
|
logs = _yield$this$CallBitco4.logs;
|
|
1103
1155
|
preFinalizeWarnings = [];
|
|
1104
1156
|
if (!preFinalizeFn) {
|
|
1105
|
-
_context7.next =
|
|
1157
|
+
_context7.next = 53;
|
|
1106
1158
|
break;
|
|
1107
1159
|
}
|
|
1108
1160
|
params = {
|
|
@@ -1110,31 +1162,34 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1110
1162
|
offeringKey: offeringKey,
|
|
1111
1163
|
writeToken: writeToken
|
|
1112
1164
|
};
|
|
1113
|
-
_context7.prev =
|
|
1114
|
-
_context7.next = 35;
|
|
1115
|
-
return preFinalizeFn(params);
|
|
1116
|
-
case 35:
|
|
1165
|
+
_context7.prev = 41;
|
|
1117
1166
|
_context7.next = 44;
|
|
1167
|
+
return preFinalizeFn(params);
|
|
1168
|
+
case 44:
|
|
1169
|
+
_context7.next = 53;
|
|
1118
1170
|
break;
|
|
1119
|
-
case
|
|
1120
|
-
_context7.prev =
|
|
1121
|
-
_context7.t2 = _context7["catch"](
|
|
1171
|
+
case 46:
|
|
1172
|
+
_context7.prev = 46;
|
|
1173
|
+
_context7.t2 = _context7["catch"](41);
|
|
1122
1174
|
if (!preFinalizeThrow) {
|
|
1123
|
-
_context7.next =
|
|
1175
|
+
_context7.next = 52;
|
|
1124
1176
|
break;
|
|
1125
1177
|
}
|
|
1126
1178
|
throw new Error("Error running preFinalize function", {
|
|
1127
1179
|
cause: _context7.t2
|
|
1128
1180
|
});
|
|
1129
|
-
case
|
|
1181
|
+
case 52:
|
|
1130
1182
|
preFinalizeWarnings = "Error running preFinalize function: ".concat(_context7.t2);
|
|
1131
|
-
case
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
_context7.next = 49;
|
|
1183
|
+
case 53:
|
|
1184
|
+
if (!writeTokenSupplied) {
|
|
1185
|
+
_context7.next = 57;
|
|
1135
1186
|
break;
|
|
1136
1187
|
}
|
|
1137
|
-
_context7.
|
|
1188
|
+
_context7.t3 = {};
|
|
1189
|
+
_context7.next = 60;
|
|
1190
|
+
break;
|
|
1191
|
+
case 57:
|
|
1192
|
+
_context7.next = 59;
|
|
1138
1193
|
return this.FinalizeContentObject({
|
|
1139
1194
|
libraryId: libraryId,
|
|
1140
1195
|
objectId: objectId,
|
|
@@ -1142,20 +1197,21 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
|
|
|
1142
1197
|
commitMessage: "Finalize ABR mezzanine",
|
|
1143
1198
|
awaitCommitConfirmation: false
|
|
1144
1199
|
});
|
|
1145
|
-
case
|
|
1146
|
-
|
|
1147
|
-
case
|
|
1200
|
+
case 59:
|
|
1201
|
+
_context7.t3 = _context7.sent;
|
|
1202
|
+
case 60:
|
|
1203
|
+
finalizeResponse = _context7.t3;
|
|
1148
1204
|
return _context7.abrupt("return", _objectSpread({
|
|
1149
1205
|
data: data,
|
|
1150
1206
|
logs: logs || [],
|
|
1151
1207
|
warnings: (warnings || []).concat(preFinalizeWarnings),
|
|
1152
1208
|
errors: errors || []
|
|
1153
1209
|
}, finalizeResponse));
|
|
1154
|
-
case
|
|
1210
|
+
case 62:
|
|
1155
1211
|
case "end":
|
|
1156
1212
|
return _context7.stop();
|
|
1157
1213
|
}
|
|
1158
|
-
}, _callee7, this, [[
|
|
1214
|
+
}, _callee7, this, [[41, 46]]);
|
|
1159
1215
|
}));
|
|
1160
1216
|
return function (_x7) {
|
|
1161
1217
|
return _ref13.apply(this, arguments);
|