@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.
- package/dist/ElvClient-min.js +8 -8
- package/dist/ElvClient-node-min.js +8 -8
- package/dist/ElvFrameClient-min.js +2 -2
- package/dist/ElvWalletClient-min.js +6 -6
- package/dist/ElvWalletClient-node-min.js +7 -7
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +30 -27
- package/dist/src/client/ABRPublishing.js +187 -147
- package/dist/src/client/ContentAccess.js +1 -0
- package/dist/src/client/ContentManagement.js +4 -2
- package/dist/src/walletClient/Configuration.js +1 -1
- package/package.json +1 -1
- package/src/FrameClient.js +1 -0
- package/src/HttpClient.js +4 -2
- package/src/client/ABRPublishing.js +126 -105
- package/src/client/ContentAccess.js +1 -0
- package/src/client/ContentManagement.js +4 -2
- package/src/walletClient/Configuration.js +3 -2
- package/utilities/ListAccessGroups.js +0 -34
|
@@ -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
|
|
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$
|
|
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$
|
|
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
|
-
|
|
593
|
-
|
|
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 =
|
|
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
|
|
649
|
+
case 13:
|
|
629
650
|
authorizationTokens = _context4.sent;
|
|
630
|
-
_context4.next =
|
|
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
|
|
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 =
|
|
665
|
+
_context4.next = 21;
|
|
645
666
|
return this.EditContentObject({
|
|
646
667
|
libraryId: libraryId,
|
|
647
668
|
objectId: objectId
|
|
648
669
|
});
|
|
649
|
-
case
|
|
670
|
+
case 21:
|
|
650
671
|
processingDraft = _context4.sent;
|
|
651
672
|
lroInfo = {
|
|
652
673
|
write_token: processingDraft.write_token,
|
|
653
|
-
node:
|
|
674
|
+
node: processingDraft.nodeUrl,
|
|
654
675
|
offering: offeringKey
|
|
655
676
|
}; // Update metadata with LRO version write token
|
|
656
|
-
_context4.next =
|
|
677
|
+
_context4.next = 25;
|
|
657
678
|
return this.EditContentObject({
|
|
658
679
|
libraryId: libraryId,
|
|
659
680
|
objectId: objectId
|
|
660
681
|
});
|
|
661
|
-
case
|
|
682
|
+
case 25:
|
|
662
683
|
statusDraft = _context4.sent;
|
|
663
|
-
_context4.next =
|
|
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: "
|
|
689
|
+
metadataSubtree: "lro_draft",
|
|
669
690
|
metadata: lroInfo
|
|
670
691
|
});
|
|
671
|
-
case
|
|
672
|
-
_context4.next =
|
|
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
|
|
700
|
+
case 30:
|
|
680
701
|
finalizeResponse = _context4.sent;
|
|
681
|
-
_context4.next =
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
754
|
+
exports.LRODraftInfo = /*#__PURE__*/function () {
|
|
733
755
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
734
|
-
var libraryId, objectId,
|
|
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
|
|
739
|
-
|
|
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: "
|
|
765
|
+
metadataSubtree: "lro_draft"
|
|
748
766
|
});
|
|
749
|
-
case
|
|
750
|
-
|
|
751
|
-
if (
|
|
752
|
-
_context5.next =
|
|
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: "
|
|
779
|
+
metadataSubtree: UrlJoin("abr_mezzanine", "offerings")
|
|
760
780
|
});
|
|
761
781
|
case 8:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
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
|
-
|
|
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:
|
|
802
|
+
metadataSubtree: "lro_draft_".concat(mainOfferingKey)
|
|
774
803
|
});
|
|
775
|
-
case
|
|
776
|
-
|
|
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 =
|
|
813
|
+
_context5.next = 26;
|
|
779
814
|
break;
|
|
780
815
|
}
|
|
781
|
-
throw Error("
|
|
782
|
-
case
|
|
783
|
-
throw Error("No LRO draft found for this mezzanine");
|
|
784
|
-
case
|
|
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
|
-
|
|
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
|
|
794
|
-
return
|
|
795
|
-
case
|
|
866
|
+
case 8:
|
|
867
|
+
return _context6.abrupt("return", _context6.sent);
|
|
868
|
+
case 9:
|
|
796
869
|
case "end":
|
|
797
|
-
return
|
|
870
|
+
return _context6.stop();
|
|
798
871
|
}
|
|
799
|
-
},
|
|
872
|
+
}, _callee6, this);
|
|
800
873
|
}));
|
|
801
|
-
return function (
|
|
802
|
-
return
|
|
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
|
|
822
|
-
var libraryId, objectId,
|
|
823
|
-
return _regeneratorRuntime.wrap(function
|
|
824
|
-
while (1) switch (
|
|
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 =
|
|
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
|
-
|
|
832
|
-
return this.
|
|
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 =
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
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
|
|
869
|
-
|
|
870
|
-
|
|
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
|
|
875
|
-
|
|
876
|
-
authorizationTokens = [
|
|
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
|
-
|
|
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
|
|
892
|
-
_yield$this$CallBitco4 =
|
|
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
|
-
|
|
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
|
-
|
|
978
|
+
_context7.next = 40;
|
|
909
979
|
break;
|
|
910
980
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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
|
|
937
|
-
finalizeResponse =
|
|
938
|
-
|
|
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
|
-
|
|
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
|
|
1005
|
+
return _context7.stop();
|
|
966
1006
|
}
|
|
967
|
-
},
|
|
1007
|
+
}, _callee7, this, [[29, 34]]);
|
|
968
1008
|
}));
|
|
969
|
-
return function (
|
|
970
|
-
return
|
|
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
|
|
1220
|
-
* 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", "
|
|
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
package/src/FrameClient.js
CHANGED
package/src/HttpClient.js
CHANGED
|
@@ -23,7 +23,9 @@ class HttpClient {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
RecordWriteToken(writeToken, nodeUrlStr) {
|
|
26
|
-
|
|
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(
|