@eluvio/elv-client-js 4.0.12 → 4.0.13

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.
@@ -14,12 +14,26 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
14
 
15
15
  var R = require("ramda");
16
16
  var UrlJoin = require("url-join");
17
- var HttpClient = require("../HttpClient");
18
17
  var _require = require("../Validation"),
19
18
  ValidateLibrary = _require.ValidateLibrary,
20
19
  ValidateVersion = _require.ValidateVersion,
21
20
  ValidateParameters = _require.ValidateParameters;
22
21
 
22
+ // When `/abr_mezzanine/offerings` contains more than one entry, only 1 is the 'real' offering, the others are
23
+ // additional copies to be modified upon finalization due to addlOfferingSpecs having been specified in call to
24
+ // `CreateABRMezzanine()`. The 'real' offering will have an object stored in `mez_prep_specs`, the copies will not.
25
+ // This function accepts the metadata retrieved from `/abr_mezzanine/offerings` and returns the offering key for the
26
+ // 'real' offering that actually has transcode LROs.
27
+ // If no suitable offering is found, throws an error.
28
+ var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
29
+ if (!abrMezOfferings) throw Error("No mezzanine preparation job info found at /abr_mezzanine");
30
+ var mainOfferingKey = Object.keys(abrMezOfferings).find(function (offKey) {
31
+ return abrMezOfferings[offKey].mez_prep_specs;
32
+ });
33
+ if (!mainOfferingKey) throw Error("Could not determine offering key for last submitted job");
34
+ return mainOfferingKey;
35
+ };
36
+
23
37
  /**
24
38
  * Create a master media content object with the given files.
25
39
  *
@@ -557,13 +571,12 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
557
571
  }();
558
572
 
559
573
  /**
560
- * Start any incomplete jobs on the specified mezzanine
574
+ * Start transcoding jobs previously set up by CreateABRMezzanine() on the specified mezzanine
561
575
  *
562
576
  * @methodGroup ABR Publishing
563
577
  * @namedParams
564
578
  * @param {string} libraryId - ID of the mezzanine library
565
579
  * @param {string} objectId - ID of the mezzanine object
566
- * @param {string=} offeringKey=default - The offering to process
567
580
  * @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)
568
581
  * - Format: {region, bucket, accessKey, secret}
569
582
  * @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
@@ -573,11 +586,11 @@ exports.CreateABRMezzanine = /*#__PURE__*/function () {
573
586
  exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
574
587
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
575
588
  var _this = this;
576
- var libraryId, objectId, _ref5$offeringKey, offeringKey, _ref5$access, access, _ref5$jobIndexes, jobIndexes, mezzanineMetadata, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
589
+ var libraryId, objectId, _ref5$access, access, _ref5$jobIndexes, jobIndexes, lastJobOfferingsInfo, offeringKey, prepSpecs, masterVersionHashes, authorizationTokens, headers, processingDraft, lroInfo, statusDraft, finalizeResponse, _yield$this$CallBitco3, data, errors, warnings, logs;
577
590
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
578
591
  while (1) switch (_context4.prev = _context4.next) {
579
592
  case 0:
580
- libraryId = _ref5.libraryId, objectId = _ref5.objectId, _ref5$offeringKey = _ref5.offeringKey, offeringKey = _ref5$offeringKey === void 0 ? "default" : _ref5$offeringKey, _ref5$access = _ref5.access, access = _ref5$access === void 0 ? [] : _ref5$access, _ref5$jobIndexes = _ref5.jobIndexes, jobIndexes = _ref5$jobIndexes === void 0 ? null : _ref5$jobIndexes;
593
+ libraryId = _ref5.libraryId, objectId = _ref5.objectId, _ref5$access = _ref5.access, access = _ref5$access === void 0 ? [] : _ref5$access, _ref5$jobIndexes = _ref5.jobIndexes, jobIndexes = _ref5$jobIndexes === void 0 ? null : _ref5$jobIndexes;
581
594
  ValidateParameters({
582
595
  libraryId: libraryId,
583
596
  objectId: objectId
@@ -589,8 +602,16 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
589
602
  metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
590
603
  });
591
604
  case 4:
592
- mezzanineMetadata = _context4.sent;
593
- prepSpecs = mezzanineMetadata[offeringKey].mez_prep_specs || []; // Retrieve all masters associated with this offering
605
+ lastJobOfferingsInfo = _context4.sent;
606
+ offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
607
+ prepSpecs = lastJobOfferingsInfo[offeringKey].mez_prep_specs;
608
+ if (prepSpecs) {
609
+ _context4.next = 9;
610
+ break;
611
+ }
612
+ throw Error("No stream preparation specs found");
613
+ case 9:
614
+ // Retrieve all masters associated with this offering
594
615
  masterVersionHashes = Object.keys(prepSpecs).map(function (spec) {
595
616
  return (prepSpecs[spec].source_streams || []).map(function (stream) {
596
617
  return stream.source_hash;
@@ -603,7 +624,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
603
624
  });
604
625
 
605
626
  // Retrieve authorization tokens for all masters and the mezzanine
606
- _context4.next = 10;
627
+ _context4.next = 13;
607
628
  return Promise.all(masterVersionHashes.map( /*#__PURE__*/function () {
608
629
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(versionHash) {
609
630
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -625,15 +646,15 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
625
646
  return _ref7.apply(this, arguments);
626
647
  };
627
648
  }()));
628
- case 10:
649
+ case 13:
629
650
  authorizationTokens = _context4.sent;
630
- _context4.next = 13;
651
+ _context4.next = 16;
631
652
  return this.authClient.AuthorizationToken({
632
653
  libraryId: libraryId,
633
654
  objectId: objectId,
634
655
  update: true
635
656
  });
636
- case 13:
657
+ case 16:
637
658
  _context4.t0 = _context4.sent;
638
659
  authorizationTokens = [_context4.t0].concat(_toConsumableArray(authorizationTokens));
639
660
  headers = {
@@ -641,44 +662,44 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
641
662
  return "Bearer ".concat(token);
642
663
  }).join(",")
643
664
  };
644
- _context4.next = 18;
665
+ _context4.next = 21;
645
666
  return this.EditContentObject({
646
667
  libraryId: libraryId,
647
668
  objectId: objectId
648
669
  });
649
- case 18:
670
+ case 21:
650
671
  processingDraft = _context4.sent;
651
672
  lroInfo = {
652
673
  write_token: processingDraft.write_token,
653
- node: this.HttpClient.BaseURI().toString(),
674
+ node: processingDraft.nodeUrl,
654
675
  offering: offeringKey
655
676
  }; // Update metadata with LRO version write token
656
- _context4.next = 22;
677
+ _context4.next = 25;
657
678
  return this.EditContentObject({
658
679
  libraryId: libraryId,
659
680
  objectId: objectId
660
681
  });
661
- case 22:
682
+ case 25:
662
683
  statusDraft = _context4.sent;
663
- _context4.next = 25;
684
+ _context4.next = 28;
664
685
  return this.ReplaceMetadata({
665
686
  libraryId: libraryId,
666
687
  objectId: objectId,
667
688
  writeToken: statusDraft.write_token,
668
- metadataSubtree: "lro_draft_".concat(offeringKey),
689
+ metadataSubtree: "lro_draft",
669
690
  metadata: lroInfo
670
691
  });
671
- case 25:
672
- _context4.next = 27;
692
+ case 28:
693
+ _context4.next = 30;
673
694
  return this.FinalizeContentObject({
674
695
  libraryId: libraryId,
675
696
  objectId: objectId,
676
697
  writeToken: statusDraft.write_token,
677
698
  commitMessage: "Mezzanine LRO status"
678
699
  });
679
- case 27:
700
+ case 30:
680
701
  finalizeResponse = _context4.sent;
681
- _context4.next = 30;
702
+ _context4.next = 33;
682
703
  return this.CallBitcodeMethod({
683
704
  libraryId: libraryId,
684
705
  objectId: objectId,
@@ -692,7 +713,7 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
692
713
  job_indexes: jobIndexes
693
714
  }
694
715
  });
695
- case 30:
716
+ case 33:
696
717
  _yield$this$CallBitco3 = _context4.sent;
697
718
  data = _yield$this$CallBitco3.data;
698
719
  errors = _yield$this$CallBitco3.errors;
@@ -702,12 +723,13 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
702
723
  hash: finalizeResponse.hash,
703
724
  lro_draft: lroInfo,
704
725
  writeToken: processingDraft.write_token,
726
+ nodeUrl: processingDraft.nodeUrl,
705
727
  data: data,
706
728
  logs: logs || [],
707
729
  warnings: warnings || [],
708
730
  errors: errors || []
709
731
  });
710
- case 36:
732
+ case 39:
711
733
  case "end":
712
734
  return _context4.stop();
713
735
  }
@@ -719,87 +741,138 @@ exports.StartABRMezzanineJobs = /*#__PURE__*/function () {
719
741
  }();
720
742
 
721
743
  /**
722
- * Retrieve status information for a long running operation (LRO) on the given object.
744
+ * Retrieve node and write token for a mezzanine's current offering preparation job (if any).
745
+ * Also returns the offering key.
723
746
  *
724
747
  * @methodGroup ABR Publishing
725
748
  * @namedParams
726
749
  * @param {string} libraryId - ID of the library
727
750
  * @param {string} objectId - ID of the object
728
- * @param {string=} offeringKey=default - Offering key of the mezzanine
729
751
  *
730
752
  * @return {Promise<Object>} - LRO status
731
753
  */
732
- exports.LROStatus = /*#__PURE__*/function () {
754
+ exports.LRODraftInfo = /*#__PURE__*/function () {
733
755
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
734
- var libraryId, objectId, _ref8$offeringKey, offeringKey, lroDraft, ready;
756
+ var libraryId, objectId, standardPathContents, lastJobOfferingsInfo, mainOfferingKey, ready, oldPathContents;
735
757
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
736
758
  while (1) switch (_context5.prev = _context5.next) {
737
759
  case 0:
738
- libraryId = _ref8.libraryId, objectId = _ref8.objectId, _ref8$offeringKey = _ref8.offeringKey, offeringKey = _ref8$offeringKey === void 0 ? "default" : _ref8$offeringKey;
739
- ValidateParameters({
740
- libraryId: libraryId,
741
- objectId: objectId
742
- });
743
- _context5.next = 4;
760
+ libraryId = _ref8.libraryId, objectId = _ref8.objectId;
761
+ _context5.next = 3;
744
762
  return this.ContentObjectMetadata({
745
763
  libraryId: libraryId,
746
764
  objectId: objectId,
747
- metadataSubtree: "lro_draft_".concat(offeringKey)
765
+ metadataSubtree: "lro_draft"
748
766
  });
749
- case 4:
750
- _context5.t0 = _context5.sent;
751
- if (_context5.t0) {
752
- _context5.next = 9;
767
+ case 3:
768
+ standardPathContents = _context5.sent;
769
+ if (!standardPathContents) {
770
+ _context5.next = 6;
753
771
  break;
754
772
  }
773
+ return _context5.abrupt("return", standardPathContents);
774
+ case 6:
755
775
  _context5.next = 8;
756
776
  return this.ContentObjectMetadata({
757
777
  libraryId: libraryId,
758
778
  objectId: objectId,
759
- metadataSubtree: "lro_draft"
779
+ metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
760
780
  });
761
781
  case 8:
762
- _context5.t0 = _context5.sent;
763
- case 9:
764
- lroDraft = _context5.t0;
765
- if (!(!lroDraft || !lroDraft.write_token)) {
766
- _context5.next = 19;
782
+ lastJobOfferingsInfo = _context5.sent;
783
+ if (lastJobOfferingsInfo) {
784
+ _context5.next = 11;
767
785
  break;
768
786
  }
769
- _context5.next = 13;
787
+ throw Error("No metadata for mezzanine preparation job found at /abr_mezzanine");
788
+ case 11:
789
+ mainOfferingKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
790
+ if (mainOfferingKey) {
791
+ _context5.next = 14;
792
+ break;
793
+ }
794
+ throw Error("Could not determine offering key for last submitted job");
795
+ case 14:
796
+ // see if offering from last job was finalized
797
+ ready = lastJobOfferingsInfo[mainOfferingKey].ready; // old location for LRO draft info
798
+ _context5.next = 17;
770
799
  return this.ContentObjectMetadata({
771
800
  libraryId: libraryId,
772
801
  objectId: objectId,
773
- metadataSubtree: UrlJoin("abr_mezzanine", "offerings", offeringKey, "ready")
802
+ metadataSubtree: "lro_draft_".concat(mainOfferingKey)
774
803
  });
775
- case 13:
776
- ready = _context5.sent;
804
+ case 17:
805
+ oldPathContents = _context5.sent;
806
+ if (!oldPathContents) {
807
+ _context5.next = 22;
808
+ break;
809
+ }
810
+ return _context5.abrupt("return", oldPathContents);
811
+ case 22:
777
812
  if (!ready) {
778
- _context5.next = 18;
813
+ _context5.next = 26;
779
814
  break;
780
815
  }
781
- throw Error("Mezzanine already finalized for offering '".concat(offeringKey, "'"));
782
- case 18:
783
- throw Error("No LRO draft found for this mezzanine");
784
- case 19:
816
+ throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was already finalized.");
817
+ case 26:
818
+ throw Error("No LRO draft found for this mezzanine - looks like last mez prep job was either cancelled or discarded.");
819
+ case 27:
820
+ case "end":
821
+ return _context5.stop();
822
+ }
823
+ }, _callee5, this);
824
+ }));
825
+ return function (_x5) {
826
+ return _ref9.apply(this, arguments);
827
+ };
828
+ }();
829
+
830
+ /**
831
+ * Retrieve status information for mezzanine transcoding jobs, aka long running operations (LROs) on the given object.
832
+ *
833
+ * @methodGroup ABR Publishing
834
+ * @namedParams
835
+ * @param {string} libraryId - ID of the library
836
+ * @param {string} objectId - ID of the object
837
+ *
838
+ * @return {Promise<Object>} - LRO status
839
+ */
840
+ exports.LROStatus = /*#__PURE__*/function () {
841
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
842
+ var libraryId, objectId, lroDraft;
843
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
844
+ while (1) switch (_context6.prev = _context6.next) {
845
+ case 0:
846
+ libraryId = _ref10.libraryId, objectId = _ref10.objectId;
847
+ ValidateParameters({
848
+ libraryId: libraryId,
849
+ objectId: objectId
850
+ });
851
+ _context6.next = 4;
852
+ return this.LRODraftInfo({
853
+ libraryId: libraryId,
854
+ objectId: objectId
855
+ });
856
+ case 4:
857
+ lroDraft = _context6.sent;
785
858
  this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
786
- _context5.next = 22;
859
+ _context6.next = 8;
787
860
  return this.ContentObjectMetadata({
788
861
  libraryId: libraryId,
789
862
  objectId: objectId,
790
863
  writeToken: lroDraft.write_token,
791
864
  metadataSubtree: "lro_status"
792
865
  });
793
- case 22:
794
- return _context5.abrupt("return", _context5.sent);
795
- case 23:
866
+ case 8:
867
+ return _context6.abrupt("return", _context6.sent);
868
+ case 9:
796
869
  case "end":
797
- return _context5.stop();
870
+ return _context6.stop();
798
871
  }
799
- }, _callee5, this);
872
+ }, _callee6, this);
800
873
  }));
801
- return function (_x5) {
802
- return _ref9.apply(this, arguments);
874
+ return function (_x6) {
875
+ return _ref11.apply(this, arguments);
803
876
  };
804
877
  }();
805
878
 
@@ -811,75 +884,63 @@ exports.LROStatus = /*#__PURE__*/function () {
811
884
  * @param {string} libraryId - ID of the mezzanine library
812
885
  * @param {string} objectId - ID of the mezzanine object
813
886
  * @param {string} writeToken - Write token for the mezzanine object
814
- * @param {string=} offeringKey=default - The offering to process
815
887
  * @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.
816
888
  * @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.
817
889
  *
818
890
  * @return {Promise<Object>} - The finalize response for the mezzanine object, as well as any logs, warnings and errors from the finalization
819
891
  */
820
892
  exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
821
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
822
- var libraryId, objectId, _ref10$offeringKey, offeringKey, preFinalizeFn, preFinalizeThrow, lroDraft, httpClient, error, result, mezzanineMetadata, masterHash, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, preFinalizeWarnings, params, finalizeResponse;
823
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
824
- while (1) switch (_context6.prev = _context6.next) {
893
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
894
+ var libraryId, objectId, preFinalizeFn, preFinalizeThrow, lroDraft, lastJobOfferingsInfo, offeringKey, masterHash, authorizationTokens, headers, _yield$this$CallBitco4, data, errors, warnings, logs, preFinalizeWarnings, params, finalizeResponse;
895
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
896
+ while (1) switch (_context7.prev = _context7.next) {
825
897
  case 0:
826
- libraryId = _ref10.libraryId, objectId = _ref10.objectId, _ref10$offeringKey = _ref10.offeringKey, offeringKey = _ref10$offeringKey === void 0 ? "default" : _ref10$offeringKey, preFinalizeFn = _ref10.preFinalizeFn, preFinalizeThrow = _ref10.preFinalizeThrow;
898
+ libraryId = _ref12.libraryId, objectId = _ref12.objectId, preFinalizeFn = _ref12.preFinalizeFn, preFinalizeThrow = _ref12.preFinalizeThrow;
827
899
  ValidateParameters({
828
900
  libraryId: libraryId,
829
901
  objectId: objectId
830
902
  });
831
- _context6.next = 4;
832
- return this.ContentObjectMetadata({
903
+ _context7.next = 4;
904
+ return this.LRODraftInfo({
833
905
  libraryId: libraryId,
834
- objectId: objectId,
835
- metadataSubtree: "lro_draft_".concat(offeringKey)
906
+ objectId: objectId
836
907
  });
837
908
  case 4:
838
- lroDraft = _context6.sent;
839
- if (!(!lroDraft || !lroDraft.write_token)) {
840
- _context6.next = 7;
841
- break;
842
- }
843
- throw Error("No LRO draft found for this mezzanine");
844
- case 7:
845
- httpClient = this.HttpClient;
846
- _context6.prev = 8;
847
- // Point directly to the node containing the draft
848
- this.HttpClient = new HttpClient({
849
- uris: [lroDraft.node],
850
- debug: httpClient.debug
851
- });
852
- _context6.next = 12;
909
+ lroDraft = _context7.sent;
910
+ // tell http client what node to contact for this write token
911
+ this.HttpClient.RecordWriteToken(lroDraft.write_token, lroDraft.node);
912
+ _context7.next = 8;
853
913
  return this.ContentObjectMetadata({
854
914
  libraryId: libraryId,
855
915
  objectId: objectId,
856
916
  writeToken: lroDraft.write_token,
857
917
  metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
858
918
  });
859
- case 12:
860
- mezzanineMetadata = _context6.sent;
861
- masterHash = mezzanineMetadata[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
862
- _context6.next = 16;
919
+ case 8:
920
+ lastJobOfferingsInfo = _context7.sent;
921
+ offeringKey = MezJobMainOfferingKey(lastJobOfferingsInfo);
922
+ masterHash = lastJobOfferingsInfo[offeringKey].prod_master_hash; // Authorization token for mezzanine and master
923
+ _context7.next = 13;
863
924
  return this.authClient.AuthorizationToken({
864
925
  libraryId: libraryId,
865
926
  objectId: objectId,
866
927
  update: true
867
928
  });
868
- case 16:
869
- _context6.t0 = _context6.sent;
870
- _context6.next = 19;
929
+ case 13:
930
+ _context7.t0 = _context7.sent;
931
+ _context7.next = 16;
871
932
  return this.authClient.AuthorizationToken({
872
933
  versionHash: masterHash
873
934
  });
874
- case 19:
875
- _context6.t1 = _context6.sent;
876
- authorizationTokens = [_context6.t0, _context6.t1];
935
+ case 16:
936
+ _context7.t1 = _context7.sent;
937
+ authorizationTokens = [_context7.t0, _context7.t1];
877
938
  headers = {
878
939
  Authorization: authorizationTokens.map(function (token) {
879
940
  return "Bearer ".concat(token);
880
941
  }).join(",")
881
942
  };
882
- _context6.next = 24;
943
+ _context7.next = 21;
883
944
  return this.CallBitcodeMethod({
884
945
  objectId: objectId,
885
946
  libraryId: libraryId,
@@ -888,15 +949,15 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
888
949
  headers: headers,
889
950
  constant: false
890
951
  });
891
- case 24:
892
- _yield$this$CallBitco4 = _context6.sent;
952
+ case 21:
953
+ _yield$this$CallBitco4 = _context7.sent;
893
954
  data = _yield$this$CallBitco4.data;
894
955
  errors = _yield$this$CallBitco4.errors;
895
956
  warnings = _yield$this$CallBitco4.warnings;
896
957
  logs = _yield$this$CallBitco4.logs;
897
958
  preFinalizeWarnings = [];
898
959
  if (!preFinalizeFn) {
899
- _context6.next = 45;
960
+ _context7.next = 41;
900
961
  break;
901
962
  }
902
963
  params = {
@@ -904,28 +965,26 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
904
965
  nodeUrl: lroDraft.node,
905
966
  writeToken: lroDraft.write_token
906
967
  };
968
+ _context7.prev = 29;
969
+ _context7.next = 32;
970
+ return preFinalizeFn(params);
971
+ case 32:
972
+ _context7.next = 41;
973
+ break;
974
+ case 34:
975
+ _context7.prev = 34;
976
+ _context7.t2 = _context7["catch"](29);
907
977
  if (!preFinalizeThrow) {
908
- _context6.next = 37;
978
+ _context7.next = 40;
909
979
  break;
910
980
  }
911
- _context6.next = 35;
912
- return preFinalizeFn(params);
913
- case 35:
914
- _context6.next = 45;
915
- break;
916
- case 37:
917
- _context6.prev = 37;
918
- _context6.next = 40;
919
- return preFinalizeFn(params);
981
+ throw new Error("Error running preFinalize function", {
982
+ cause: _context7.t2
983
+ });
920
984
  case 40:
921
- _context6.next = 45;
922
- break;
923
- case 42:
924
- _context6.prev = 42;
925
- _context6.t2 = _context6["catch"](37);
926
- preFinalizeWarnings = "Error trying to set video stream codec descriptors: ".concat(_context6.t2);
927
- case 45:
928
- _context6.next = 47;
985
+ preFinalizeWarnings = "Error running preFinalize function: ".concat(_context7.t2);
986
+ case 41:
987
+ _context7.next = 43;
929
988
  return this.FinalizeContentObject({
930
989
  libraryId: libraryId,
931
990
  objectId: objectId,
@@ -933,40 +992,21 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
933
992
  commitMessage: "Finalize ABR mezzanine",
934
993
  awaitCommitConfirmation: false
935
994
  });
936
- case 47:
937
- finalizeResponse = _context6.sent;
938
- result = _objectSpread({
995
+ case 43:
996
+ finalizeResponse = _context7.sent;
997
+ return _context7.abrupt("return", _objectSpread({
939
998
  data: data,
940
999
  logs: logs || [],
941
1000
  warnings: (warnings || []).concat(preFinalizeWarnings),
942
1001
  errors: errors || []
943
- }, finalizeResponse);
944
- _context6.next = 54;
945
- break;
946
- case 51:
947
- _context6.prev = 51;
948
- _context6.t3 = _context6["catch"](8);
949
- error = _context6.t3;
950
- case 54:
951
- _context6.prev = 54;
952
- // Ensure original http client is restored
953
- this.HttpClient = httpClient;
954
- return _context6.finish(54);
955
- case 57:
956
- if (!error) {
957
- _context6.next = 59;
958
- break;
959
- }
960
- throw error;
961
- case 59:
962
- return _context6.abrupt("return", result);
963
- case 60:
1002
+ }, finalizeResponse));
1003
+ case 45:
964
1004
  case "end":
965
- return _context6.stop();
1005
+ return _context7.stop();
966
1006
  }
967
- }, _callee6, this, [[8, 51, 54, 57], [37, 42]]);
1007
+ }, _callee7, this, [[29, 34]]);
968
1008
  }));
969
- return function (_x6) {
970
- return _ref11.apply(this, arguments);
1009
+ return function (_x7) {
1010
+ return _ref13.apply(this, arguments);
971
1011
  };
972
1012
  }();
@@ -173,6 +173,7 @@ exports.Visibility = /*#__PURE__*/function () {
173
173
  *
174
174
  * @methodGroup Content Objects
175
175
  * @param {string} objectId - The ID of the object
176
+ * @param {boolean=} clearCache - Clear any Visibility info cached by client for this object (forces new Ethereum calls)
176
177
  *
177
178
  * @return {string} - Key for the permission of the object - Use this to retrieve more details from client.permissionLevels
178
179
  */
@@ -328,6 +328,7 @@ exports.CreateContentType = /*#__PURE__*/function () {
328
328
  return _context4.t0.Request.call(_context4.t0, _context4.t3);
329
329
  case 21:
330
330
  rawCreateResponse = _context4.sent;
331
+ // extract the url for the node that handled the request
331
332
  nodeUrl = new URL(rawCreateResponse.url).origin;
332
333
  _context4.next = 25;
333
334
  return this.utils.ResponseToJson(rawCreateResponse);
@@ -1216,8 +1217,8 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
1216
1217
  * @param {string} libraryId - ID of the library
1217
1218
  * @param {string} objectId - ID of the object
1218
1219
  * @param {object=} options -
1219
- * meta: New metadata for the object - will be merged into existing metadata if specified
1220
- * type: New type for the object - Object ID, version hash or name of type
1220
+ * @param {object=} options.meta - New metadata for the object - will be merged into existing metadata if specified
1221
+ * @param {string=} options.type - New type for the object - Object ID, version hash or name of type
1221
1222
  *
1222
1223
  * @returns {Promise<object>} - Response containing the object ID and write token of the draft, as well as URL of node handling the draft
1223
1224
  */
@@ -1300,6 +1301,7 @@ exports.EditContentObject = /*#__PURE__*/function () {
1300
1301
  return _context15.t0.Request.call(_context15.t0, _context15.t4);
1301
1302
  case 33:
1302
1303
  rawEditResponse = _context15.sent;
1304
+ // extract the url for the node that handled the request
1303
1305
  nodeUrl = new URL(rawEditResponse.url).origin;
1304
1306
  _context15.next = 37;
1305
1307
  return this.utils.ResponseToJson(rawEditResponse);
@@ -22,7 +22,7 @@ var WalletConfiguration = {
22
22
  appUrl: "https://wallet.contentfabric.io"
23
23
  }
24
24
  },
25
- __MARKETPLACE_ORDER: ["PREVIEW", "de228e92-ed45-4fe0-8e52-658cf366e962", "wwe-marketplace-main", "realcannonballrun-marketplace", "maskverse-marketplace", "dolly-marketplace", "eluvio-live-marketplace-sonark", "cirkay-marketplace", "eluvio-live-marketplace-fuudge", "oc-marketplace", "emp-marketplace", "microsoft", "indieflix-marketplace", "angels-airwaves-marketplace"]
25
+ __MARKETPLACE_ORDER: ["PREVIEW", "masked-singer-brazil-marketplace", "de228e92-ed45-4fe0-8e52-658cf366e962", "wwe-marketplace-main", "maskverse-marketplace", "dolly-marketplace", "eluvio-live-marketplace-sonark", "cirkay-marketplace", "eluvio-live-marketplace-fuudge", "oc-marketplace", "emp-marketplace", "microsoft", "indieflix-marketplace", "angels-airwaves-marketplace", "realcannonballrun-marketplace"]
26
26
  };
27
27
 
28
28
  // No production environment on demo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.12",
3
+ "version": "4.0.13",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -399,6 +399,7 @@ class FrameClient {
399
399
  "ListAccessGroups",
400
400
  "ListFiles",
401
401
  "ListNTPInstances",
402
+ "LRODraftInfo",
402
403
  "LROStatus",
403
404
  "MergeContractMetadata",
404
405
  "MergeMetadata",
package/src/HttpClient.js CHANGED
@@ -23,7 +23,9 @@ class HttpClient {
23
23
  }
24
24
 
25
25
  RecordWriteToken(writeToken, nodeUrlStr) {
26
- this.draftURIs[writeToken] = nodeUrlStr ? new URI(nodeUrlStr) : this.BaseURI();
26
+ if(!nodeUrlStr) throw Error("RecordWriteToken() - nodeUrlStr not supplied");
27
+ if(!writeToken) throw Error("RecordWriteToken() - writeToken not supplied");
28
+ this.draftURIs[writeToken] = new URI(nodeUrlStr);
27
29
  }
28
30
 
29
31
  RequestHeaders(bodyType, headers={}) {
@@ -86,7 +88,7 @@ class HttpClient {
86
88
  }
87
89
 
88
90
  let response;
89
-
91
+ this.Log(`${method} - ${uri.toString()}`);
90
92
  try {
91
93
  response =
92
94
  await HttpClient.Fetch(