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