@eluvio/elv-client-js 4.0.104 → 4.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +15 -14
- package/dist/ElvClient-node-min.js +14 -13
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +15 -14
- package/dist/ElvWalletClient-node-min.js +14 -13
- package/dist/src/AuthorizationClient.js +9 -12
- package/dist/src/ContentObjectAudit.js +3 -3
- package/dist/src/ContentObjectVerification.js +3 -3
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +47 -28
- package/dist/src/ElvWallet.js +7 -5
- package/dist/src/EthClient.js +8 -9
- package/dist/src/FrameClient.js +8 -9
- package/dist/src/HttpClient.js +1 -2
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +31 -19
- package/dist/src/RemoteSigner.js +10 -11
- package/dist/src/UserProfileClient.js +194 -150
- package/dist/src/Utils.js +2 -3
- package/dist/src/abr_profiles/abr_profile_live_drm.js +22 -0
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +9 -6
- package/dist/src/client/ContentManagement.js +3 -3
- package/dist/src/client/Contracts.js +433 -108
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +60 -78
- package/dist/src/client/LiveStream.js +270 -158
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/walletClient/ClientMethods.js +2 -2
- package/dist/src/walletClient/Profile.js +2 -2
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +19 -16
- package/package.json +1 -1
- package/src/UserProfileClient.js +19 -20
- package/src/abr_profiles/abr_profile_live_drm.js +22 -0
- package/src/client/Contracts.js +244 -42
- package/src/client/LiveConf.js +86 -111
- package/src/client/LiveStream.js +141 -44
- package/testScripts/TestAddTenantContractId.js +45 -4
|
@@ -62,7 +62,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
62
62
|
this.walletAddress = undefined;
|
|
63
63
|
this.walletAddressRetrieved = false;
|
|
64
64
|
}
|
|
65
|
-
_createClass(UserProfileClient, [{
|
|
65
|
+
return _createClass(UserProfileClient, [{
|
|
66
66
|
key: "Log",
|
|
67
67
|
value: function Log(message) {
|
|
68
68
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -202,7 +202,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
202
202
|
*/
|
|
203
203
|
}, {
|
|
204
204
|
key: "WalletAddress",
|
|
205
|
-
value: function () {
|
|
205
|
+
value: (function () {
|
|
206
206
|
var _WalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
207
207
|
var autoCreate,
|
|
208
208
|
walletAddress,
|
|
@@ -259,9 +259,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
259
259
|
*
|
|
260
260
|
* @return {Promise<string>} - The wallet address of the specified user, if it exists
|
|
261
261
|
*/
|
|
262
|
+
)
|
|
262
263
|
}, {
|
|
263
264
|
key: "UserWalletAddress",
|
|
264
|
-
value: function () {
|
|
265
|
+
value: (function () {
|
|
265
266
|
var _UserWalletAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
266
267
|
var address, walletAddress;
|
|
267
268
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -315,9 +316,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
315
316
|
*
|
|
316
317
|
* @return {Promise<{Object}>} - An object containing the libraryId and objectId for the wallet object.
|
|
317
318
|
*/
|
|
319
|
+
)
|
|
318
320
|
}, {
|
|
319
321
|
key: "UserWalletObjectInfo",
|
|
320
|
-
value: function () {
|
|
322
|
+
value: (function () {
|
|
321
323
|
var _UserWalletObjectInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
322
324
|
var _ref3,
|
|
323
325
|
address,
|
|
@@ -389,9 +391,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
389
391
|
*
|
|
390
392
|
* @return {Promise<Object|string>}
|
|
391
393
|
*/
|
|
394
|
+
)
|
|
392
395
|
}, {
|
|
393
396
|
key: "PublicUserMetadata",
|
|
394
|
-
value: function () {
|
|
397
|
+
value: (function () {
|
|
395
398
|
var _PublicUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
|
|
396
399
|
var address, _ref4$metadataSubtree, metadataSubtree, _ref4$queryParams, queryParams, _ref4$select, select, _ref4$resolveLinks, resolveLinks, _ref4$resolveIncludeS, resolveIncludeSource, _ref4$resolveIgnoreEr, resolveIgnoreErrors, _ref4$linkDepthLimit, linkDepthLimit, walletAddress, _yield$this$UserWalle, libraryId, objectId;
|
|
397
400
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
@@ -487,9 +490,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
487
490
|
*
|
|
488
491
|
* @return {Promise<Object|string>} - The user's profile metadata - returns undefined if no metadata set or subtree doesn't exist
|
|
489
492
|
*/
|
|
493
|
+
)
|
|
490
494
|
}, {
|
|
491
495
|
key: "UserMetadata",
|
|
492
|
-
value: function () {
|
|
496
|
+
value: (function () {
|
|
493
497
|
var _UserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
494
498
|
var _ref5,
|
|
495
499
|
_ref5$metadataSubtree,
|
|
@@ -553,9 +557,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
553
557
|
* @param {Object} metadata - New metadata
|
|
554
558
|
* @param {string=} metadataSubtree - Subtree to merge into - modifies root metadata if not specified
|
|
555
559
|
*/
|
|
560
|
+
)
|
|
556
561
|
}, {
|
|
557
562
|
key: "MergeUserMetadata",
|
|
558
|
-
value: function () {
|
|
563
|
+
value: (function () {
|
|
559
564
|
var _MergeUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
|
|
560
565
|
var _ref6$metadataSubtree, metadataSubtree, _ref6$metadata, metadata, _yield$this$UserWalle3, libraryId, objectId, editRequest;
|
|
561
566
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
@@ -610,9 +615,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
610
615
|
* @param {Object} metadata - New metadata
|
|
611
616
|
* @param {string=} metadataSubtree - Subtree to replace - modifies root metadata if not specified
|
|
612
617
|
*/
|
|
618
|
+
)
|
|
613
619
|
}, {
|
|
614
620
|
key: "ReplaceUserMetadata",
|
|
615
|
-
value: function () {
|
|
621
|
+
value: (function () {
|
|
616
622
|
var _ReplaceUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
|
|
617
623
|
var _ref7$metadataSubtree, metadataSubtree, _ref7$metadata, metadata, _yield$this$UserWalle4, libraryId, objectId, editRequest;
|
|
618
624
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
@@ -666,9 +672,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
666
672
|
* @namedParams
|
|
667
673
|
* @param {string=} metadataSubtree - Subtree to delete - deletes all metadata if not specified
|
|
668
674
|
*/
|
|
675
|
+
)
|
|
669
676
|
}, {
|
|
670
677
|
key: "DeleteUserMetadata",
|
|
671
|
-
value: function () {
|
|
678
|
+
value: (function () {
|
|
672
679
|
var _DeleteUserMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
|
|
673
680
|
var _ref8$metadataSubtree, metadataSubtree, _yield$this$UserWalle5, libraryId, objectId, editRequest;
|
|
674
681
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
@@ -724,9 +731,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
724
731
|
*
|
|
725
732
|
* @return {Promise<string>} - Access setting
|
|
726
733
|
*/
|
|
734
|
+
)
|
|
727
735
|
}, {
|
|
728
736
|
key: "AccessLevel",
|
|
729
|
-
value: function () {
|
|
737
|
+
value: (function () {
|
|
730
738
|
var _AccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
731
739
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
732
740
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -763,9 +771,10 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
763
771
|
* @namedParams
|
|
764
772
|
* @param level
|
|
765
773
|
*/
|
|
774
|
+
)
|
|
766
775
|
}, {
|
|
767
776
|
key: "SetAccessLevel",
|
|
768
|
-
value: function () {
|
|
777
|
+
value: (function () {
|
|
769
778
|
var _SetAccessLevel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref9) {
|
|
770
779
|
var level;
|
|
771
780
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
@@ -796,30 +805,37 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
796
805
|
return SetAccessLevel;
|
|
797
806
|
}()
|
|
798
807
|
/**
|
|
799
|
-
* Return the ID of the tenant
|
|
808
|
+
* Return the ID of the tenant admin group set for current user
|
|
800
809
|
*
|
|
801
810
|
* @return {Promise<string>} - Tenant ID
|
|
802
811
|
*/
|
|
812
|
+
)
|
|
803
813
|
}, {
|
|
804
814
|
key: "TenantId",
|
|
805
|
-
value: function () {
|
|
815
|
+
value: (function () {
|
|
806
816
|
var _TenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
817
|
+
var _yield$this$UserWalle6, objectId;
|
|
807
818
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
808
819
|
while (1) switch (_context12.prev = _context12.next) {
|
|
809
820
|
case 0:
|
|
810
821
|
if (this.tenantId) {
|
|
811
|
-
_context12.next =
|
|
822
|
+
_context12.next = 8;
|
|
812
823
|
break;
|
|
813
824
|
}
|
|
814
825
|
_context12.next = 3;
|
|
815
|
-
return this.
|
|
816
|
-
metadataSubtree: "tenantId"
|
|
817
|
-
});
|
|
826
|
+
return this.UserWalletObjectInfo();
|
|
818
827
|
case 3:
|
|
828
|
+
_yield$this$UserWalle6 = _context12.sent;
|
|
829
|
+
objectId = _yield$this$UserWalle6.objectId;
|
|
830
|
+
_context12.next = 7;
|
|
831
|
+
return this.client.TenantId({
|
|
832
|
+
objectId: objectId
|
|
833
|
+
});
|
|
834
|
+
case 7:
|
|
819
835
|
this.tenantId = _context12.sent;
|
|
820
|
-
case
|
|
836
|
+
case 8:
|
|
821
837
|
return _context12.abrupt("return", this.tenantId);
|
|
822
|
-
case
|
|
838
|
+
case 9:
|
|
823
839
|
case "end":
|
|
824
840
|
return _context12.stop();
|
|
825
841
|
}
|
|
@@ -831,7 +847,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
831
847
|
return TenantId;
|
|
832
848
|
}()
|
|
833
849
|
/**
|
|
834
|
-
* Set the current user's tenant
|
|
850
|
+
* Set the current user's tenant admin group ID
|
|
835
851
|
*
|
|
836
852
|
* Note: This method is not accessible to applications. Eluvio core will drop the request.
|
|
837
853
|
*
|
|
@@ -839,11 +855,12 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
839
855
|
* @param {string} id - The tenant ID in hash format
|
|
840
856
|
* @param {string} address - The group address to use in the hash if id is not provided
|
|
841
857
|
*/
|
|
858
|
+
)
|
|
842
859
|
}, {
|
|
843
860
|
key: "SetTenantId",
|
|
844
|
-
value: function () {
|
|
861
|
+
value: (function () {
|
|
845
862
|
var _SetTenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref10) {
|
|
846
|
-
var id, address,
|
|
863
|
+
var id, address, _yield$this$UserWalle7, objectId, tenantInfo;
|
|
847
864
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
848
865
|
while (1) switch (_context13.prev = _context13.next) {
|
|
849
866
|
case 0:
|
|
@@ -866,38 +883,25 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
866
883
|
case 6:
|
|
867
884
|
id = "iten".concat(Utils.AddressToHash(address));
|
|
868
885
|
case 7:
|
|
869
|
-
_context13.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
886
|
+
_context13.next = 9;
|
|
887
|
+
return this.UserWalletObjectInfo();
|
|
888
|
+
case 9:
|
|
889
|
+
_yield$this$UserWalle7 = _context13.sent;
|
|
890
|
+
objectId = _yield$this$UserWalle7.objectId;
|
|
891
|
+
_context13.next = 13;
|
|
892
|
+
return this.client.SetTenantId({
|
|
893
|
+
objectId: objectId,
|
|
894
|
+
tenantId: id
|
|
873
895
|
});
|
|
874
|
-
case 10:
|
|
875
|
-
version = _context13.sent;
|
|
876
|
-
if (!(version !== this.client.authClient.ACCESS_TYPES.GROUP)) {
|
|
877
|
-
_context13.next = 13;
|
|
878
|
-
break;
|
|
879
|
-
}
|
|
880
|
-
throw Error("Invalid tenant ID: " + id);
|
|
881
896
|
case 13:
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
_context13.t0 = _context13["catch"](7);
|
|
887
|
-
throw Error("Invalid tenant ID: " + id);
|
|
888
|
-
case 18:
|
|
889
|
-
_context13.next = 20;
|
|
890
|
-
return this.ReplaceUserMetadata({
|
|
891
|
-
metadataSubtree: "tenantId",
|
|
892
|
-
metadata: id
|
|
893
|
-
});
|
|
894
|
-
case 20:
|
|
895
|
-
this.tenantId = id;
|
|
896
|
-
case 21:
|
|
897
|
+
tenantInfo = _context13.sent;
|
|
898
|
+
this.tenantContractId = tenantInfo.tenantContractId;
|
|
899
|
+
this.tenantId = tenantInfo.tenantId;
|
|
900
|
+
case 16:
|
|
897
901
|
case "end":
|
|
898
902
|
return _context13.stop();
|
|
899
903
|
}
|
|
900
|
-
}, _callee13, this
|
|
904
|
+
}, _callee13, this);
|
|
901
905
|
}));
|
|
902
906
|
function SetTenantId(_x7) {
|
|
903
907
|
return _SetTenantId.apply(this, arguments);
|
|
@@ -909,11 +913,12 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
909
913
|
*
|
|
910
914
|
* @return {Promise<string>} - Tenant Contract ID
|
|
911
915
|
*/
|
|
916
|
+
)
|
|
912
917
|
}, {
|
|
913
918
|
key: "TenantContractId",
|
|
914
|
-
value: function () {
|
|
919
|
+
value: (function () {
|
|
915
920
|
var _TenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
916
|
-
var _yield$this$
|
|
921
|
+
var _yield$this$UserWalle8, objectId;
|
|
917
922
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
918
923
|
while (1) switch (_context14.prev = _context14.next) {
|
|
919
924
|
case 0:
|
|
@@ -924,11 +929,11 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
924
929
|
_context14.next = 3;
|
|
925
930
|
return this.UserWalletObjectInfo();
|
|
926
931
|
case 3:
|
|
927
|
-
_yield$this$
|
|
928
|
-
objectId = _yield$this$
|
|
932
|
+
_yield$this$UserWalle8 = _context14.sent;
|
|
933
|
+
objectId = _yield$this$UserWalle8.objectId;
|
|
929
934
|
_context14.next = 7;
|
|
930
935
|
return this.client.TenantContractId({
|
|
931
|
-
|
|
936
|
+
objectId: objectId
|
|
932
937
|
});
|
|
933
938
|
case 7:
|
|
934
939
|
this.tenantContractId = _context14.sent;
|
|
@@ -954,11 +959,12 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
954
959
|
* @param {string} tenantContractId - The tenant contract ID in hash format
|
|
955
960
|
* @param {string} address - The tenant address to use in the hash if id is not provided
|
|
956
961
|
*/
|
|
962
|
+
)
|
|
957
963
|
}, {
|
|
958
964
|
key: "SetTenantContractId",
|
|
959
|
-
value: function () {
|
|
965
|
+
value: (function () {
|
|
960
966
|
var _SetTenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref11) {
|
|
961
|
-
var tenantContractId, _yield$this$
|
|
967
|
+
var tenantContractId, _yield$this$UserWalle9, objectId, tenantInfo;
|
|
962
968
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
963
969
|
while (1) switch (_context15.prev = _context15.next) {
|
|
964
970
|
case 0:
|
|
@@ -966,8 +972,8 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
966
972
|
_context15.next = 3;
|
|
967
973
|
return this.UserWalletObjectInfo();
|
|
968
974
|
case 3:
|
|
969
|
-
_yield$this$
|
|
970
|
-
objectId = _yield$this$
|
|
975
|
+
_yield$this$UserWalle9 = _context15.sent;
|
|
976
|
+
objectId = _yield$this$UserWalle9.objectId;
|
|
971
977
|
_context15.next = 7;
|
|
972
978
|
return this.client.SetTenantContractId({
|
|
973
979
|
objectId: objectId,
|
|
@@ -976,7 +982,8 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
976
982
|
case 7:
|
|
977
983
|
tenantInfo = _context15.sent;
|
|
978
984
|
this.tenantContractId = tenantInfo.tenantContractId;
|
|
979
|
-
|
|
985
|
+
this.tenantId = tenantInfo.tenantId;
|
|
986
|
+
case 10:
|
|
980
987
|
case "end":
|
|
981
988
|
return _context15.stop();
|
|
982
989
|
}
|
|
@@ -986,6 +993,41 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
986
993
|
return _SetTenantContractId.apply(this, arguments);
|
|
987
994
|
}
|
|
988
995
|
return SetTenantContractId;
|
|
996
|
+
}())
|
|
997
|
+
}, {
|
|
998
|
+
key: "ResetTenantId",
|
|
999
|
+
value: function () {
|
|
1000
|
+
var _ResetTenantId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1001
|
+
var _yield$this$UserWalle10, objectId;
|
|
1002
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1003
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1004
|
+
case 0:
|
|
1005
|
+
_context16.next = 2;
|
|
1006
|
+
return this.UserWalletObjectInfo();
|
|
1007
|
+
case 2:
|
|
1008
|
+
_yield$this$UserWalle10 = _context16.sent;
|
|
1009
|
+
objectId = _yield$this$UserWalle10.objectId;
|
|
1010
|
+
_context16.next = 6;
|
|
1011
|
+
return this.client.ResetTenantId({
|
|
1012
|
+
objectId: objectId
|
|
1013
|
+
});
|
|
1014
|
+
case 6:
|
|
1015
|
+
this.tenantId = this.client.TenantId({
|
|
1016
|
+
objectId: objectId
|
|
1017
|
+
});
|
|
1018
|
+
this.tenantContractId = this.client.TenantContractId({
|
|
1019
|
+
objectId: objectId
|
|
1020
|
+
});
|
|
1021
|
+
case 8:
|
|
1022
|
+
case "end":
|
|
1023
|
+
return _context16.stop();
|
|
1024
|
+
}
|
|
1025
|
+
}, _callee16, this);
|
|
1026
|
+
}));
|
|
1027
|
+
function ResetTenantId() {
|
|
1028
|
+
return _ResetTenantId.apply(this, arguments);
|
|
1029
|
+
}
|
|
1030
|
+
return ResetTenantId;
|
|
989
1031
|
}()
|
|
990
1032
|
/**
|
|
991
1033
|
* Get the URL of the current user's profile image
|
|
@@ -1003,51 +1045,51 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1003
1045
|
*/
|
|
1004
1046
|
}, {
|
|
1005
1047
|
key: "UserProfileImage",
|
|
1006
|
-
value: function () {
|
|
1007
|
-
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1048
|
+
value: (function () {
|
|
1049
|
+
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
1008
1050
|
var _ref12,
|
|
1009
1051
|
address,
|
|
1010
1052
|
height,
|
|
1011
1053
|
walletAddress,
|
|
1012
|
-
_yield$this$
|
|
1054
|
+
_yield$this$UserWalle11,
|
|
1013
1055
|
libraryId,
|
|
1014
1056
|
objectId,
|
|
1015
|
-
|
|
1016
|
-
return _regeneratorRuntime.wrap(function
|
|
1017
|
-
while (1) switch (
|
|
1057
|
+
_args17 = arguments;
|
|
1058
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1059
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1018
1060
|
case 0:
|
|
1019
|
-
_ref12 =
|
|
1061
|
+
_ref12 = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {}, address = _ref12.address, height = _ref12.height;
|
|
1020
1062
|
if (!address) {
|
|
1021
|
-
|
|
1063
|
+
_context17.next = 7;
|
|
1022
1064
|
break;
|
|
1023
1065
|
}
|
|
1024
|
-
|
|
1066
|
+
_context17.next = 4;
|
|
1025
1067
|
return this.UserWalletAddress({
|
|
1026
1068
|
address: address
|
|
1027
1069
|
});
|
|
1028
1070
|
case 4:
|
|
1029
|
-
walletAddress =
|
|
1030
|
-
|
|
1071
|
+
walletAddress = _context17.sent;
|
|
1072
|
+
_context17.next = 9;
|
|
1031
1073
|
break;
|
|
1032
1074
|
case 7:
|
|
1033
1075
|
address = this.client.signer.address;
|
|
1034
1076
|
walletAddress = this.walletAddress;
|
|
1035
1077
|
case 9:
|
|
1036
1078
|
if (walletAddress) {
|
|
1037
|
-
|
|
1079
|
+
_context17.next = 11;
|
|
1038
1080
|
break;
|
|
1039
1081
|
}
|
|
1040
|
-
return
|
|
1082
|
+
return _context17.abrupt("return");
|
|
1041
1083
|
case 11:
|
|
1042
|
-
|
|
1084
|
+
_context17.next = 13;
|
|
1043
1085
|
return this.UserWalletObjectInfo({
|
|
1044
1086
|
address: address
|
|
1045
1087
|
});
|
|
1046
1088
|
case 13:
|
|
1047
|
-
_yield$this$
|
|
1048
|
-
libraryId = _yield$this$
|
|
1049
|
-
objectId = _yield$this$
|
|
1050
|
-
return
|
|
1089
|
+
_yield$this$UserWalle11 = _context17.sent;
|
|
1090
|
+
libraryId = _yield$this$UserWalle11.libraryId;
|
|
1091
|
+
objectId = _yield$this$UserWalle11.objectId;
|
|
1092
|
+
return _context17.abrupt("return", this.client.ContentObjectImageUrl({
|
|
1051
1093
|
libraryId: libraryId,
|
|
1052
1094
|
objectId: objectId,
|
|
1053
1095
|
height: height,
|
|
@@ -1055,9 +1097,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1055
1097
|
}));
|
|
1056
1098
|
case 17:
|
|
1057
1099
|
case "end":
|
|
1058
|
-
return
|
|
1100
|
+
return _context17.stop();
|
|
1059
1101
|
}
|
|
1060
|
-
},
|
|
1102
|
+
}, _callee17, this);
|
|
1061
1103
|
}));
|
|
1062
1104
|
function UserProfileImage() {
|
|
1063
1105
|
return _UserProfileImage.apply(this, arguments);
|
|
@@ -1070,37 +1112,38 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1070
1112
|
* @namedParams
|
|
1071
1113
|
* @param {blob} image - The new profile image for the current user
|
|
1072
1114
|
*/
|
|
1115
|
+
)
|
|
1073
1116
|
}, {
|
|
1074
1117
|
key: "SetUserProfileImage",
|
|
1075
|
-
value: function () {
|
|
1076
|
-
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1077
|
-
var image, size, _yield$this$
|
|
1078
|
-
return _regeneratorRuntime.wrap(function
|
|
1079
|
-
while (1) switch (
|
|
1118
|
+
value: (function () {
|
|
1119
|
+
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref13) {
|
|
1120
|
+
var image, size, _yield$this$UserWalle12, libraryId, objectId, editRequest;
|
|
1121
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1122
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1080
1123
|
case 0:
|
|
1081
1124
|
image = _ref13.image;
|
|
1082
1125
|
this.Log("Setting profile image for user ".concat(this.client.signer.address));
|
|
1083
1126
|
size = image.length || image.byteLength || image.size;
|
|
1084
1127
|
if (!(size > 5000000)) {
|
|
1085
|
-
|
|
1128
|
+
_context18.next = 5;
|
|
1086
1129
|
break;
|
|
1087
1130
|
}
|
|
1088
1131
|
throw Error("Maximum profile image size is 5MB");
|
|
1089
1132
|
case 5:
|
|
1090
|
-
|
|
1133
|
+
_context18.next = 7;
|
|
1091
1134
|
return this.UserWalletObjectInfo();
|
|
1092
1135
|
case 7:
|
|
1093
|
-
_yield$this$
|
|
1094
|
-
libraryId = _yield$this$
|
|
1095
|
-
objectId = _yield$this$
|
|
1096
|
-
|
|
1136
|
+
_yield$this$UserWalle12 = _context18.sent;
|
|
1137
|
+
libraryId = _yield$this$UserWalle12.libraryId;
|
|
1138
|
+
objectId = _yield$this$UserWalle12.objectId;
|
|
1139
|
+
_context18.next = 12;
|
|
1097
1140
|
return this.client.EditContentObject({
|
|
1098
1141
|
libraryId: libraryId,
|
|
1099
1142
|
objectId: objectId
|
|
1100
1143
|
});
|
|
1101
1144
|
case 12:
|
|
1102
|
-
editRequest =
|
|
1103
|
-
|
|
1145
|
+
editRequest = _context18.sent;
|
|
1146
|
+
_context18.next = 15;
|
|
1104
1147
|
return this.client.SetContentObjectImage({
|
|
1105
1148
|
libraryId: libraryId,
|
|
1106
1149
|
objectId: objectId,
|
|
@@ -1110,7 +1153,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1110
1153
|
imagePath: "public/profile_image"
|
|
1111
1154
|
});
|
|
1112
1155
|
case 15:
|
|
1113
|
-
|
|
1156
|
+
_context18.next = 17;
|
|
1114
1157
|
return this.client.FinalizeContentObject({
|
|
1115
1158
|
libraryId: libraryId,
|
|
1116
1159
|
objectId: objectId,
|
|
@@ -1119,9 +1162,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1119
1162
|
});
|
|
1120
1163
|
case 17:
|
|
1121
1164
|
case "end":
|
|
1122
|
-
return
|
|
1165
|
+
return _context18.stop();
|
|
1123
1166
|
}
|
|
1124
|
-
},
|
|
1167
|
+
}, _callee18, this);
|
|
1125
1168
|
}));
|
|
1126
1169
|
function SetUserProfileImage(_x9) {
|
|
1127
1170
|
return _SetUserProfileImage.apply(this, arguments);
|
|
@@ -1137,66 +1180,68 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1137
1180
|
*
|
|
1138
1181
|
* @return {Promise<Object>} - User tags
|
|
1139
1182
|
*/
|
|
1183
|
+
)
|
|
1140
1184
|
}, {
|
|
1141
1185
|
key: "CollectedTags",
|
|
1142
|
-
value: function () {
|
|
1143
|
-
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1144
|
-
return _regeneratorRuntime.wrap(function
|
|
1145
|
-
while (1) switch (
|
|
1186
|
+
value: (function () {
|
|
1187
|
+
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
1188
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1189
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1146
1190
|
case 0:
|
|
1147
|
-
|
|
1191
|
+
_context19.next = 2;
|
|
1148
1192
|
return this.UserMetadata({
|
|
1149
1193
|
metadataSubtree: "collected_data"
|
|
1150
1194
|
});
|
|
1151
1195
|
case 2:
|
|
1152
|
-
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1196
|
+
_context19.t0 = _context19.sent;
|
|
1197
|
+
if (_context19.t0) {
|
|
1198
|
+
_context19.next = 5;
|
|
1155
1199
|
break;
|
|
1156
1200
|
}
|
|
1157
|
-
|
|
1201
|
+
_context19.t0 = {};
|
|
1158
1202
|
case 5:
|
|
1159
|
-
return
|
|
1203
|
+
return _context19.abrupt("return", _context19.t0);
|
|
1160
1204
|
case 6:
|
|
1161
1205
|
case "end":
|
|
1162
|
-
return
|
|
1206
|
+
return _context19.stop();
|
|
1163
1207
|
}
|
|
1164
|
-
},
|
|
1208
|
+
}, _callee19, this);
|
|
1165
1209
|
}));
|
|
1166
1210
|
function CollectedTags() {
|
|
1167
1211
|
return _CollectedTags.apply(this, arguments);
|
|
1168
1212
|
}
|
|
1169
1213
|
return CollectedTags;
|
|
1170
1214
|
}() // Ensure recording tags never causes action to fail
|
|
1215
|
+
)
|
|
1171
1216
|
}, {
|
|
1172
1217
|
key: "RecordTags",
|
|
1173
1218
|
value: function () {
|
|
1174
|
-
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1219
|
+
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref14) {
|
|
1175
1220
|
var libraryId, objectId, versionHash;
|
|
1176
|
-
return _regeneratorRuntime.wrap(function
|
|
1177
|
-
while (1) switch (
|
|
1221
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1222
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1178
1223
|
case 0:
|
|
1179
1224
|
libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
|
|
1180
|
-
|
|
1181
|
-
|
|
1225
|
+
_context20.prev = 1;
|
|
1226
|
+
_context20.next = 4;
|
|
1182
1227
|
return this.__RecordTags({
|
|
1183
1228
|
libraryId: libraryId,
|
|
1184
1229
|
objectId: objectId,
|
|
1185
1230
|
versionHash: versionHash
|
|
1186
1231
|
});
|
|
1187
1232
|
case 4:
|
|
1188
|
-
|
|
1233
|
+
_context20.next = 9;
|
|
1189
1234
|
break;
|
|
1190
1235
|
case 6:
|
|
1191
|
-
|
|
1192
|
-
|
|
1236
|
+
_context20.prev = 6;
|
|
1237
|
+
_context20.t0 = _context20["catch"](1);
|
|
1193
1238
|
// eslint-disable-next-line no-console
|
|
1194
|
-
console.error(
|
|
1239
|
+
console.error(_context20.t0);
|
|
1195
1240
|
case 9:
|
|
1196
1241
|
case "end":
|
|
1197
|
-
return
|
|
1242
|
+
return _context20.stop();
|
|
1198
1243
|
}
|
|
1199
|
-
},
|
|
1244
|
+
}, _callee20, this, [[1, 6]]);
|
|
1200
1245
|
}));
|
|
1201
1246
|
function RecordTags(_x10) {
|
|
1202
1247
|
return _RecordTags.apply(this, arguments);
|
|
@@ -1206,73 +1251,73 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1206
1251
|
}, {
|
|
1207
1252
|
key: "__RecordTags",
|
|
1208
1253
|
value: function () {
|
|
1209
|
-
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1254
|
+
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref15) {
|
|
1210
1255
|
var libraryId, objectId, versionHash, accessType, seen, walletObjectInfo, userLibraryId, userObjectId, editRequest, contentTags, userTags, formattedTags;
|
|
1211
|
-
return _regeneratorRuntime.wrap(function
|
|
1212
|
-
while (1) switch (
|
|
1256
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1257
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1213
1258
|
case 0:
|
|
1214
1259
|
libraryId = _ref15.libraryId, objectId = _ref15.objectId, versionHash = _ref15.versionHash;
|
|
1215
|
-
|
|
1260
|
+
_context21.next = 3;
|
|
1216
1261
|
return this.client.AccessType({
|
|
1217
1262
|
id: objectId
|
|
1218
1263
|
});
|
|
1219
1264
|
case 3:
|
|
1220
|
-
accessType =
|
|
1265
|
+
accessType = _context21.sent;
|
|
1221
1266
|
if (!(accessType !== "object")) {
|
|
1222
|
-
|
|
1267
|
+
_context21.next = 6;
|
|
1223
1268
|
break;
|
|
1224
1269
|
}
|
|
1225
|
-
return
|
|
1270
|
+
return _context21.abrupt("return");
|
|
1226
1271
|
case 6:
|
|
1227
1272
|
if (!(!versionHash && !libraryId)) {
|
|
1228
|
-
|
|
1273
|
+
_context21.next = 10;
|
|
1229
1274
|
break;
|
|
1230
1275
|
}
|
|
1231
|
-
|
|
1276
|
+
_context21.next = 9;
|
|
1232
1277
|
return this.client.ContentObjectLibraryId({
|
|
1233
1278
|
objectId: objectId
|
|
1234
1279
|
});
|
|
1235
1280
|
case 9:
|
|
1236
|
-
libraryId =
|
|
1281
|
+
libraryId = _context21.sent;
|
|
1237
1282
|
case 10:
|
|
1238
1283
|
if (versionHash) {
|
|
1239
|
-
|
|
1284
|
+
_context21.next = 14;
|
|
1240
1285
|
break;
|
|
1241
1286
|
}
|
|
1242
|
-
|
|
1287
|
+
_context21.next = 13;
|
|
1243
1288
|
return this.client.ContentObject({
|
|
1244
1289
|
libraryId: libraryId,
|
|
1245
1290
|
objectId: objectId
|
|
1246
1291
|
});
|
|
1247
1292
|
case 13:
|
|
1248
|
-
versionHash =
|
|
1293
|
+
versionHash = _context21.sent.hash;
|
|
1249
1294
|
case 14:
|
|
1250
|
-
|
|
1295
|
+
_context21.next = 16;
|
|
1251
1296
|
return this.UserMetadata({
|
|
1252
1297
|
metadataSubtree: UrlJoin("accessed_content", versionHash)
|
|
1253
1298
|
});
|
|
1254
1299
|
case 16:
|
|
1255
|
-
seen =
|
|
1300
|
+
seen = _context21.sent;
|
|
1256
1301
|
if (!seen) {
|
|
1257
|
-
|
|
1302
|
+
_context21.next = 19;
|
|
1258
1303
|
break;
|
|
1259
1304
|
}
|
|
1260
|
-
return
|
|
1305
|
+
return _context21.abrupt("return");
|
|
1261
1306
|
case 19:
|
|
1262
|
-
|
|
1307
|
+
_context21.next = 21;
|
|
1263
1308
|
return this.UserWalletObjectInfo();
|
|
1264
1309
|
case 21:
|
|
1265
|
-
walletObjectInfo =
|
|
1310
|
+
walletObjectInfo = _context21.sent;
|
|
1266
1311
|
userLibraryId = walletObjectInfo.libraryId;
|
|
1267
1312
|
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1268
|
-
|
|
1313
|
+
_context21.next = 26;
|
|
1269
1314
|
return this.client.EditContentObject({
|
|
1270
1315
|
libraryId: userLibraryId,
|
|
1271
1316
|
objectId: userObjectId
|
|
1272
1317
|
});
|
|
1273
1318
|
case 26:
|
|
1274
|
-
editRequest =
|
|
1275
|
-
|
|
1319
|
+
editRequest = _context21.sent;
|
|
1320
|
+
_context21.next = 29;
|
|
1276
1321
|
return this.client.ReplaceMetadata({
|
|
1277
1322
|
libraryId: userLibraryId,
|
|
1278
1323
|
objectId: userObjectId,
|
|
@@ -1281,7 +1326,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1281
1326
|
metadata: Date.now()
|
|
1282
1327
|
});
|
|
1283
1328
|
case 29:
|
|
1284
|
-
|
|
1329
|
+
_context21.next = 31;
|
|
1285
1330
|
return this.client.ContentObjectMetadata({
|
|
1286
1331
|
libraryId: libraryId,
|
|
1287
1332
|
objectId: objectId,
|
|
@@ -1289,15 +1334,15 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1289
1334
|
metadataSubtree: "video_tags"
|
|
1290
1335
|
});
|
|
1291
1336
|
case 31:
|
|
1292
|
-
contentTags =
|
|
1337
|
+
contentTags = _context21.sent;
|
|
1293
1338
|
if (!(contentTags && contentTags.length > 0)) {
|
|
1294
|
-
|
|
1339
|
+
_context21.next = 40;
|
|
1295
1340
|
break;
|
|
1296
1341
|
}
|
|
1297
|
-
|
|
1342
|
+
_context21.next = 35;
|
|
1298
1343
|
return this.CollectedTags();
|
|
1299
1344
|
case 35:
|
|
1300
|
-
userTags =
|
|
1345
|
+
userTags = _context21.sent;
|
|
1301
1346
|
formattedTags = this.__FormatVideoTags(contentTags);
|
|
1302
1347
|
Object.keys(formattedTags).forEach(function (tag) {
|
|
1303
1348
|
if (userTags[tag]) {
|
|
@@ -1314,7 +1359,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1314
1359
|
});
|
|
1315
1360
|
|
|
1316
1361
|
// Update user tags
|
|
1317
|
-
|
|
1362
|
+
_context21.next = 40;
|
|
1318
1363
|
return this.client.ReplaceMetadata({
|
|
1319
1364
|
libraryId: userLibraryId,
|
|
1320
1365
|
objectId: userObjectId,
|
|
@@ -1323,7 +1368,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1323
1368
|
metadata: userTags
|
|
1324
1369
|
});
|
|
1325
1370
|
case 40:
|
|
1326
|
-
|
|
1371
|
+
_context21.next = 42;
|
|
1327
1372
|
return this.client.FinalizeContentObject({
|
|
1328
1373
|
libraryId: userLibraryId,
|
|
1329
1374
|
objectId: userObjectId,
|
|
@@ -1333,9 +1378,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1333
1378
|
});
|
|
1334
1379
|
case 42:
|
|
1335
1380
|
case "end":
|
|
1336
|
-
return
|
|
1381
|
+
return _context21.stop();
|
|
1337
1382
|
}
|
|
1338
|
-
},
|
|
1383
|
+
}, _callee21, this);
|
|
1339
1384
|
}));
|
|
1340
1385
|
function __RecordTags(_x11) {
|
|
1341
1386
|
return _RecordTags2.apply(this, arguments);
|
|
@@ -1416,6 +1461,5 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1416
1461
|
});
|
|
1417
1462
|
}
|
|
1418
1463
|
}]);
|
|
1419
|
-
return UserProfileClient;
|
|
1420
1464
|
}();
|
|
1421
1465
|
module.exports = UserProfileClient;
|