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