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