@eluvio/elv-client-js 4.0.52 → 4.0.53
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 +10 -11
- package/dist/ElvClient-node-min.js +10 -10
- package/dist/ElvFrameClient-min.js +4 -4
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +9 -10
- package/dist/ElvWalletClient-node-min.js +10 -10
- package/dist/src/ElvClient.js +306 -441
- package/dist/src/FrameClient.js +2 -2
- package/dist/src/HttpClient.js +1 -10
- package/dist/src/UserProfileClient.js +88 -206
- package/dist/src/Utils.js +0 -10
- package/dist/src/Validation.js +1 -1
- package/dist/src/client/ContentAccess.js +405 -574
- package/package.json +1 -1
- package/src/Utils.js +18 -0
- package/src/client/ContentAccess.js +3 -0
- package/dist/src/client/LiveConf.js +0 -330
- package/dist/src/client/LiveStream.js +0 -1785
package/dist/src/FrameClient.js
CHANGED
|
@@ -449,12 +449,12 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
449
449
|
}, {
|
|
450
450
|
key: "AllowedMethods",
|
|
451
451
|
value: function AllowedMethods() {
|
|
452
|
-
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "
|
|
452
|
+
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
|
|
453
453
|
}
|
|
454
454
|
}, {
|
|
455
455
|
key: "AllowedUserProfileMethods",
|
|
456
456
|
value: function AllowedUserProfileMethods() {
|
|
457
|
-
return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "
|
|
457
|
+
return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
|
|
458
458
|
}
|
|
459
459
|
}, {
|
|
460
460
|
key: "AllowedWalletClientMethods",
|
package/dist/src/HttpClient.js
CHANGED
|
@@ -199,16 +199,7 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
199
199
|
var path = _ref3.path,
|
|
200
200
|
_ref3$queryParams = _ref3.queryParams,
|
|
201
201
|
queryParams = _ref3$queryParams === void 0 ? {} : _ref3$queryParams;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
// If URL contains a write token, it must go to the correct server and can not fail over
|
|
205
|
-
var writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
|
|
206
|
-
var writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
|
|
207
|
-
if (writeToken && this.draftURIs[writeToken]) {
|
|
208
|
-
// Use saved write token URI
|
|
209
|
-
baseURI = this.draftURIs[writeToken];
|
|
210
|
-
}
|
|
211
|
-
return baseURI.path(path).query(queryParams).hash("").toString();
|
|
202
|
+
return this.BaseURI().path(path).query(queryParams).hash("").toString();
|
|
212
203
|
}
|
|
213
204
|
}], [{
|
|
214
205
|
key: "Fetch",
|
|
@@ -904,124 +904,6 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
904
904
|
}
|
|
905
905
|
return SetTenantId;
|
|
906
906
|
}()
|
|
907
|
-
/**
|
|
908
|
-
* Return the ID of the tenant contract this user belongs to, if set.
|
|
909
|
-
*
|
|
910
|
-
* @return {Promise<string>} - Tenant Contract ID
|
|
911
|
-
*/
|
|
912
|
-
}, {
|
|
913
|
-
key: "TenantContractId",
|
|
914
|
-
value: function () {
|
|
915
|
-
var _TenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
916
|
-
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
917
|
-
while (1) switch (_context14.prev = _context14.next) {
|
|
918
|
-
case 0:
|
|
919
|
-
if (this.tenantContractId) {
|
|
920
|
-
_context14.next = 4;
|
|
921
|
-
break;
|
|
922
|
-
}
|
|
923
|
-
_context14.next = 3;
|
|
924
|
-
return this.UserMetadata({
|
|
925
|
-
metadataSubtree: "tenantContractId"
|
|
926
|
-
});
|
|
927
|
-
case 3:
|
|
928
|
-
this.tenantContractId = _context14.sent;
|
|
929
|
-
case 4:
|
|
930
|
-
return _context14.abrupt("return", this.tenantContractId);
|
|
931
|
-
case 5:
|
|
932
|
-
case "end":
|
|
933
|
-
return _context14.stop();
|
|
934
|
-
}
|
|
935
|
-
}, _callee14, this);
|
|
936
|
-
}));
|
|
937
|
-
function TenantContractId() {
|
|
938
|
-
return _TenantContractId.apply(this, arguments);
|
|
939
|
-
}
|
|
940
|
-
return TenantContractId;
|
|
941
|
-
}()
|
|
942
|
-
/**
|
|
943
|
-
* Set the current user's tenant contract.
|
|
944
|
-
*
|
|
945
|
-
* Note: This method is not accessible to applications. Eluvio core will drop the request.
|
|
946
|
-
*
|
|
947
|
-
* @namedParams
|
|
948
|
-
* @param {string} tenantContractId - The tenant contract ID in hash format
|
|
949
|
-
* @param {string} address - The group address to use in the hash if id is not provided
|
|
950
|
-
*/
|
|
951
|
-
}, {
|
|
952
|
-
key: "SetTenantContractId",
|
|
953
|
-
value: function () {
|
|
954
|
-
var _SetTenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref11) {
|
|
955
|
-
var tenantContractId, address, version, tenantAdminGroupAddress;
|
|
956
|
-
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
957
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
958
|
-
case 0:
|
|
959
|
-
tenantContractId = _ref11.tenantContractId, address = _ref11.address;
|
|
960
|
-
if (!(tenantContractId && (!tenantContractId.startsWith("iten") || !Utils.ValidHash(tenantContractId)))) {
|
|
961
|
-
_context15.next = 3;
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
throw Error("Invalid tenant ID: ".concat(tenantContractId));
|
|
965
|
-
case 3:
|
|
966
|
-
if (!address) {
|
|
967
|
-
_context15.next = 7;
|
|
968
|
-
break;
|
|
969
|
-
}
|
|
970
|
-
if (Utils.ValidAddress(address)) {
|
|
971
|
-
_context15.next = 6;
|
|
972
|
-
break;
|
|
973
|
-
}
|
|
974
|
-
throw Error("Invalid address: ".concat(address));
|
|
975
|
-
case 6:
|
|
976
|
-
tenantContractId = "iten".concat(Utils.AddressToHash(address));
|
|
977
|
-
case 7:
|
|
978
|
-
_context15.prev = 7;
|
|
979
|
-
_context15.next = 10;
|
|
980
|
-
return this.client.AccessType({
|
|
981
|
-
id: tenantContractId
|
|
982
|
-
});
|
|
983
|
-
case 10:
|
|
984
|
-
version = _context15.sent;
|
|
985
|
-
if (!(version !== this.client.authClient.ACCESS_TYPES.TENANT)) {
|
|
986
|
-
_context15.next = 13;
|
|
987
|
-
break;
|
|
988
|
-
}
|
|
989
|
-
throw Error("Invalid tenant ID: " + tenantContractId);
|
|
990
|
-
case 13:
|
|
991
|
-
_context15.next = 18;
|
|
992
|
-
break;
|
|
993
|
-
case 15:
|
|
994
|
-
_context15.prev = 15;
|
|
995
|
-
_context15.t0 = _context15["catch"](7);
|
|
996
|
-
throw Error("Invalid tenant ID: " + tenantContractId);
|
|
997
|
-
case 18:
|
|
998
|
-
_context15.next = 20;
|
|
999
|
-
return this.client.CallContractMethod({
|
|
1000
|
-
contractAddress: address || Utils.HashToAddress(tenantContractId),
|
|
1001
|
-
methodName: "groupsMapping",
|
|
1002
|
-
methodArgs: ["tenant_admin", 0],
|
|
1003
|
-
formatArguments: true
|
|
1004
|
-
});
|
|
1005
|
-
case 20:
|
|
1006
|
-
tenantAdminGroupAddress = _context15.sent;
|
|
1007
|
-
_context15.next = 23;
|
|
1008
|
-
return this.MergeUserMetadata({
|
|
1009
|
-
metadata: {
|
|
1010
|
-
tenantContractId: tenantContractId,
|
|
1011
|
-
tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
|
|
1012
|
-
}
|
|
1013
|
-
});
|
|
1014
|
-
case 23:
|
|
1015
|
-
case "end":
|
|
1016
|
-
return _context15.stop();
|
|
1017
|
-
}
|
|
1018
|
-
}, _callee15, this, [[7, 15]]);
|
|
1019
|
-
}));
|
|
1020
|
-
function SetTenantContractId(_x8) {
|
|
1021
|
-
return _SetTenantContractId.apply(this, arguments);
|
|
1022
|
-
}
|
|
1023
|
-
return SetTenantContractId;
|
|
1024
|
-
}()
|
|
1025
907
|
/**
|
|
1026
908
|
* Get the URL of the current user's profile image
|
|
1027
909
|
*
|
|
@@ -1039,50 +921,50 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1039
921
|
}, {
|
|
1040
922
|
key: "UserProfileImage",
|
|
1041
923
|
value: function () {
|
|
1042
|
-
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1043
|
-
var
|
|
924
|
+
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
925
|
+
var _ref11,
|
|
1044
926
|
address,
|
|
1045
927
|
height,
|
|
1046
928
|
walletAddress,
|
|
1047
929
|
_yield$this$UserWalle6,
|
|
1048
930
|
libraryId,
|
|
1049
931
|
objectId,
|
|
1050
|
-
|
|
1051
|
-
return _regeneratorRuntime.wrap(function
|
|
1052
|
-
while (1) switch (
|
|
932
|
+
_args14 = arguments;
|
|
933
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
934
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1053
935
|
case 0:
|
|
1054
|
-
|
|
936
|
+
_ref11 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, address = _ref11.address, height = _ref11.height;
|
|
1055
937
|
if (!address) {
|
|
1056
|
-
|
|
938
|
+
_context14.next = 7;
|
|
1057
939
|
break;
|
|
1058
940
|
}
|
|
1059
|
-
|
|
941
|
+
_context14.next = 4;
|
|
1060
942
|
return this.UserWalletAddress({
|
|
1061
943
|
address: address
|
|
1062
944
|
});
|
|
1063
945
|
case 4:
|
|
1064
|
-
walletAddress =
|
|
1065
|
-
|
|
946
|
+
walletAddress = _context14.sent;
|
|
947
|
+
_context14.next = 9;
|
|
1066
948
|
break;
|
|
1067
949
|
case 7:
|
|
1068
950
|
address = this.client.signer.address;
|
|
1069
951
|
walletAddress = this.walletAddress;
|
|
1070
952
|
case 9:
|
|
1071
953
|
if (walletAddress) {
|
|
1072
|
-
|
|
954
|
+
_context14.next = 11;
|
|
1073
955
|
break;
|
|
1074
956
|
}
|
|
1075
|
-
return
|
|
957
|
+
return _context14.abrupt("return");
|
|
1076
958
|
case 11:
|
|
1077
|
-
|
|
959
|
+
_context14.next = 13;
|
|
1078
960
|
return this.UserWalletObjectInfo({
|
|
1079
961
|
address: address
|
|
1080
962
|
});
|
|
1081
963
|
case 13:
|
|
1082
|
-
_yield$this$UserWalle6 =
|
|
964
|
+
_yield$this$UserWalle6 = _context14.sent;
|
|
1083
965
|
libraryId = _yield$this$UserWalle6.libraryId;
|
|
1084
966
|
objectId = _yield$this$UserWalle6.objectId;
|
|
1085
|
-
return
|
|
967
|
+
return _context14.abrupt("return", this.client.ContentObjectImageUrl({
|
|
1086
968
|
libraryId: libraryId,
|
|
1087
969
|
objectId: objectId,
|
|
1088
970
|
height: height,
|
|
@@ -1090,9 +972,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1090
972
|
}));
|
|
1091
973
|
case 17:
|
|
1092
974
|
case "end":
|
|
1093
|
-
return
|
|
975
|
+
return _context14.stop();
|
|
1094
976
|
}
|
|
1095
|
-
},
|
|
977
|
+
}, _callee14, this);
|
|
1096
978
|
}));
|
|
1097
979
|
function UserProfileImage() {
|
|
1098
980
|
return _UserProfileImage.apply(this, arguments);
|
|
@@ -1108,34 +990,34 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1108
990
|
}, {
|
|
1109
991
|
key: "SetUserProfileImage",
|
|
1110
992
|
value: function () {
|
|
1111
|
-
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
993
|
+
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref12) {
|
|
1112
994
|
var image, size, _yield$this$UserWalle7, libraryId, objectId, editRequest;
|
|
1113
|
-
return _regeneratorRuntime.wrap(function
|
|
1114
|
-
while (1) switch (
|
|
995
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
996
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1115
997
|
case 0:
|
|
1116
|
-
image =
|
|
998
|
+
image = _ref12.image;
|
|
1117
999
|
this.Log("Setting profile image for user ".concat(this.client.signer.address));
|
|
1118
1000
|
size = image.length || image.byteLength || image.size;
|
|
1119
1001
|
if (!(size > 5000000)) {
|
|
1120
|
-
|
|
1002
|
+
_context15.next = 5;
|
|
1121
1003
|
break;
|
|
1122
1004
|
}
|
|
1123
1005
|
throw Error("Maximum profile image size is 5MB");
|
|
1124
1006
|
case 5:
|
|
1125
|
-
|
|
1007
|
+
_context15.next = 7;
|
|
1126
1008
|
return this.UserWalletObjectInfo();
|
|
1127
1009
|
case 7:
|
|
1128
|
-
_yield$this$UserWalle7 =
|
|
1010
|
+
_yield$this$UserWalle7 = _context15.sent;
|
|
1129
1011
|
libraryId = _yield$this$UserWalle7.libraryId;
|
|
1130
1012
|
objectId = _yield$this$UserWalle7.objectId;
|
|
1131
|
-
|
|
1013
|
+
_context15.next = 12;
|
|
1132
1014
|
return this.client.EditContentObject({
|
|
1133
1015
|
libraryId: libraryId,
|
|
1134
1016
|
objectId: objectId
|
|
1135
1017
|
});
|
|
1136
1018
|
case 12:
|
|
1137
|
-
editRequest =
|
|
1138
|
-
|
|
1019
|
+
editRequest = _context15.sent;
|
|
1020
|
+
_context15.next = 15;
|
|
1139
1021
|
return this.client.SetContentObjectImage({
|
|
1140
1022
|
libraryId: libraryId,
|
|
1141
1023
|
objectId: objectId,
|
|
@@ -1145,7 +1027,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1145
1027
|
imagePath: "public/profile_image"
|
|
1146
1028
|
});
|
|
1147
1029
|
case 15:
|
|
1148
|
-
|
|
1030
|
+
_context15.next = 17;
|
|
1149
1031
|
return this.client.FinalizeContentObject({
|
|
1150
1032
|
libraryId: libraryId,
|
|
1151
1033
|
objectId: objectId,
|
|
@@ -1154,11 +1036,11 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1154
1036
|
});
|
|
1155
1037
|
case 17:
|
|
1156
1038
|
case "end":
|
|
1157
|
-
return
|
|
1039
|
+
return _context15.stop();
|
|
1158
1040
|
}
|
|
1159
|
-
},
|
|
1041
|
+
}, _callee15, this);
|
|
1160
1042
|
}));
|
|
1161
|
-
function SetUserProfileImage(
|
|
1043
|
+
function SetUserProfileImage(_x8) {
|
|
1162
1044
|
return _SetUserProfileImage.apply(this, arguments);
|
|
1163
1045
|
}
|
|
1164
1046
|
return SetUserProfileImage;
|
|
@@ -1175,28 +1057,28 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1175
1057
|
}, {
|
|
1176
1058
|
key: "CollectedTags",
|
|
1177
1059
|
value: function () {
|
|
1178
|
-
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1179
|
-
return _regeneratorRuntime.wrap(function
|
|
1180
|
-
while (1) switch (
|
|
1060
|
+
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1061
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1062
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1181
1063
|
case 0:
|
|
1182
|
-
|
|
1064
|
+
_context16.next = 2;
|
|
1183
1065
|
return this.UserMetadata({
|
|
1184
1066
|
metadataSubtree: "collected_data"
|
|
1185
1067
|
});
|
|
1186
1068
|
case 2:
|
|
1187
|
-
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1069
|
+
_context16.t0 = _context16.sent;
|
|
1070
|
+
if (_context16.t0) {
|
|
1071
|
+
_context16.next = 5;
|
|
1190
1072
|
break;
|
|
1191
1073
|
}
|
|
1192
|
-
|
|
1074
|
+
_context16.t0 = {};
|
|
1193
1075
|
case 5:
|
|
1194
|
-
return
|
|
1076
|
+
return _context16.abrupt("return", _context16.t0);
|
|
1195
1077
|
case 6:
|
|
1196
1078
|
case "end":
|
|
1197
|
-
return
|
|
1079
|
+
return _context16.stop();
|
|
1198
1080
|
}
|
|
1199
|
-
},
|
|
1081
|
+
}, _callee16, this);
|
|
1200
1082
|
}));
|
|
1201
1083
|
function CollectedTags() {
|
|
1202
1084
|
return _CollectedTags.apply(this, arguments);
|
|
@@ -1206,34 +1088,34 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1206
1088
|
}, {
|
|
1207
1089
|
key: "RecordTags",
|
|
1208
1090
|
value: function () {
|
|
1209
|
-
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1091
|
+
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref13) {
|
|
1210
1092
|
var libraryId, objectId, versionHash;
|
|
1211
|
-
return _regeneratorRuntime.wrap(function
|
|
1212
|
-
while (1) switch (
|
|
1093
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1094
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1213
1095
|
case 0:
|
|
1214
|
-
libraryId =
|
|
1215
|
-
|
|
1216
|
-
|
|
1096
|
+
libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash;
|
|
1097
|
+
_context17.prev = 1;
|
|
1098
|
+
_context17.next = 4;
|
|
1217
1099
|
return this.__RecordTags({
|
|
1218
1100
|
libraryId: libraryId,
|
|
1219
1101
|
objectId: objectId,
|
|
1220
1102
|
versionHash: versionHash
|
|
1221
1103
|
});
|
|
1222
1104
|
case 4:
|
|
1223
|
-
|
|
1105
|
+
_context17.next = 9;
|
|
1224
1106
|
break;
|
|
1225
1107
|
case 6:
|
|
1226
|
-
|
|
1227
|
-
|
|
1108
|
+
_context17.prev = 6;
|
|
1109
|
+
_context17.t0 = _context17["catch"](1);
|
|
1228
1110
|
// eslint-disable-next-line no-console
|
|
1229
|
-
console.error(
|
|
1111
|
+
console.error(_context17.t0);
|
|
1230
1112
|
case 9:
|
|
1231
1113
|
case "end":
|
|
1232
|
-
return
|
|
1114
|
+
return _context17.stop();
|
|
1233
1115
|
}
|
|
1234
|
-
},
|
|
1116
|
+
}, _callee17, this, [[1, 6]]);
|
|
1235
1117
|
}));
|
|
1236
|
-
function RecordTags(
|
|
1118
|
+
function RecordTags(_x9) {
|
|
1237
1119
|
return _RecordTags.apply(this, arguments);
|
|
1238
1120
|
}
|
|
1239
1121
|
return RecordTags;
|
|
@@ -1241,73 +1123,73 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1241
1123
|
}, {
|
|
1242
1124
|
key: "__RecordTags",
|
|
1243
1125
|
value: function () {
|
|
1244
|
-
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1126
|
+
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref14) {
|
|
1245
1127
|
var libraryId, objectId, versionHash, accessType, seen, walletObjectInfo, userLibraryId, userObjectId, editRequest, contentTags, userTags, formattedTags;
|
|
1246
|
-
return _regeneratorRuntime.wrap(function
|
|
1247
|
-
while (1) switch (
|
|
1128
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1129
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1248
1130
|
case 0:
|
|
1249
|
-
libraryId =
|
|
1250
|
-
|
|
1131
|
+
libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
|
|
1132
|
+
_context18.next = 3;
|
|
1251
1133
|
return this.client.AccessType({
|
|
1252
1134
|
id: objectId
|
|
1253
1135
|
});
|
|
1254
1136
|
case 3:
|
|
1255
|
-
accessType =
|
|
1137
|
+
accessType = _context18.sent;
|
|
1256
1138
|
if (!(accessType !== "object")) {
|
|
1257
|
-
|
|
1139
|
+
_context18.next = 6;
|
|
1258
1140
|
break;
|
|
1259
1141
|
}
|
|
1260
|
-
return
|
|
1142
|
+
return _context18.abrupt("return");
|
|
1261
1143
|
case 6:
|
|
1262
1144
|
if (!(!versionHash && !libraryId)) {
|
|
1263
|
-
|
|
1145
|
+
_context18.next = 10;
|
|
1264
1146
|
break;
|
|
1265
1147
|
}
|
|
1266
|
-
|
|
1148
|
+
_context18.next = 9;
|
|
1267
1149
|
return this.client.ContentObjectLibraryId({
|
|
1268
1150
|
objectId: objectId
|
|
1269
1151
|
});
|
|
1270
1152
|
case 9:
|
|
1271
|
-
libraryId =
|
|
1153
|
+
libraryId = _context18.sent;
|
|
1272
1154
|
case 10:
|
|
1273
1155
|
if (versionHash) {
|
|
1274
|
-
|
|
1156
|
+
_context18.next = 14;
|
|
1275
1157
|
break;
|
|
1276
1158
|
}
|
|
1277
|
-
|
|
1159
|
+
_context18.next = 13;
|
|
1278
1160
|
return this.client.ContentObject({
|
|
1279
1161
|
libraryId: libraryId,
|
|
1280
1162
|
objectId: objectId
|
|
1281
1163
|
});
|
|
1282
1164
|
case 13:
|
|
1283
|
-
versionHash =
|
|
1165
|
+
versionHash = _context18.sent.hash;
|
|
1284
1166
|
case 14:
|
|
1285
|
-
|
|
1167
|
+
_context18.next = 16;
|
|
1286
1168
|
return this.UserMetadata({
|
|
1287
1169
|
metadataSubtree: UrlJoin("accessed_content", versionHash)
|
|
1288
1170
|
});
|
|
1289
1171
|
case 16:
|
|
1290
|
-
seen =
|
|
1172
|
+
seen = _context18.sent;
|
|
1291
1173
|
if (!seen) {
|
|
1292
|
-
|
|
1174
|
+
_context18.next = 19;
|
|
1293
1175
|
break;
|
|
1294
1176
|
}
|
|
1295
|
-
return
|
|
1177
|
+
return _context18.abrupt("return");
|
|
1296
1178
|
case 19:
|
|
1297
|
-
|
|
1179
|
+
_context18.next = 21;
|
|
1298
1180
|
return this.UserWalletObjectInfo();
|
|
1299
1181
|
case 21:
|
|
1300
|
-
walletObjectInfo =
|
|
1182
|
+
walletObjectInfo = _context18.sent;
|
|
1301
1183
|
userLibraryId = walletObjectInfo.libraryId;
|
|
1302
1184
|
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1303
|
-
|
|
1185
|
+
_context18.next = 26;
|
|
1304
1186
|
return this.client.EditContentObject({
|
|
1305
1187
|
libraryId: userLibraryId,
|
|
1306
1188
|
objectId: userObjectId
|
|
1307
1189
|
});
|
|
1308
1190
|
case 26:
|
|
1309
|
-
editRequest =
|
|
1310
|
-
|
|
1191
|
+
editRequest = _context18.sent;
|
|
1192
|
+
_context18.next = 29;
|
|
1311
1193
|
return this.client.ReplaceMetadata({
|
|
1312
1194
|
libraryId: userLibraryId,
|
|
1313
1195
|
objectId: userObjectId,
|
|
@@ -1316,7 +1198,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1316
1198
|
metadata: Date.now()
|
|
1317
1199
|
});
|
|
1318
1200
|
case 29:
|
|
1319
|
-
|
|
1201
|
+
_context18.next = 31;
|
|
1320
1202
|
return this.client.ContentObjectMetadata({
|
|
1321
1203
|
libraryId: libraryId,
|
|
1322
1204
|
objectId: objectId,
|
|
@@ -1324,15 +1206,15 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1324
1206
|
metadataSubtree: "video_tags"
|
|
1325
1207
|
});
|
|
1326
1208
|
case 31:
|
|
1327
|
-
contentTags =
|
|
1209
|
+
contentTags = _context18.sent;
|
|
1328
1210
|
if (!(contentTags && contentTags.length > 0)) {
|
|
1329
|
-
|
|
1211
|
+
_context18.next = 40;
|
|
1330
1212
|
break;
|
|
1331
1213
|
}
|
|
1332
|
-
|
|
1214
|
+
_context18.next = 35;
|
|
1333
1215
|
return this.CollectedTags();
|
|
1334
1216
|
case 35:
|
|
1335
|
-
userTags =
|
|
1217
|
+
userTags = _context18.sent;
|
|
1336
1218
|
formattedTags = this.__FormatVideoTags(contentTags);
|
|
1337
1219
|
Object.keys(formattedTags).forEach(function (tag) {
|
|
1338
1220
|
if (userTags[tag]) {
|
|
@@ -1349,7 +1231,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1349
1231
|
});
|
|
1350
1232
|
|
|
1351
1233
|
// Update user tags
|
|
1352
|
-
|
|
1234
|
+
_context18.next = 40;
|
|
1353
1235
|
return this.client.ReplaceMetadata({
|
|
1354
1236
|
libraryId: userLibraryId,
|
|
1355
1237
|
objectId: userObjectId,
|
|
@@ -1358,7 +1240,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1358
1240
|
metadata: userTags
|
|
1359
1241
|
});
|
|
1360
1242
|
case 40:
|
|
1361
|
-
|
|
1243
|
+
_context18.next = 42;
|
|
1362
1244
|
return this.client.FinalizeContentObject({
|
|
1363
1245
|
libraryId: userLibraryId,
|
|
1364
1246
|
objectId: userObjectId,
|
|
@@ -1368,11 +1250,11 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1368
1250
|
});
|
|
1369
1251
|
case 42:
|
|
1370
1252
|
case "end":
|
|
1371
|
-
return
|
|
1253
|
+
return _context18.stop();
|
|
1372
1254
|
}
|
|
1373
|
-
},
|
|
1255
|
+
}, _callee18, this);
|
|
1374
1256
|
}));
|
|
1375
|
-
function __RecordTags(
|
|
1257
|
+
function __RecordTags(_x10) {
|
|
1376
1258
|
return _RecordTags2.apply(this, arguments);
|
|
1377
1259
|
}
|
|
1378
1260
|
return __RecordTags;
|
package/dist/src/Utils.js
CHANGED
|
@@ -305,16 +305,6 @@ var Utils = {
|
|
|
305
305
|
AddressToSpaceId: function AddressToSpaceId(address) {
|
|
306
306
|
return "ispc" + Utils.AddressToHash(address);
|
|
307
307
|
},
|
|
308
|
-
/**
|
|
309
|
-
* Convert contract address to node ID
|
|
310
|
-
*
|
|
311
|
-
* @param {string} address - Address of contract
|
|
312
|
-
*
|
|
313
|
-
* @returns {string} - Node ID from contract address
|
|
314
|
-
*/
|
|
315
|
-
AddressToNodeId: function AddressToNodeId(address) {
|
|
316
|
-
return "inod" + Utils.AddressToHash(address);
|
|
317
|
-
},
|
|
318
308
|
/**
|
|
319
309
|
* Convert contract address to content library ID
|
|
320
310
|
*
|
package/dist/src/Validation.js
CHANGED
|
@@ -35,7 +35,7 @@ exports.ValidateWriteToken = function (writeToken) {
|
|
|
35
35
|
exports.ValidatePartHash = function (partHash) {
|
|
36
36
|
if (!partHash) {
|
|
37
37
|
throw Error("Part hash not specified");
|
|
38
|
-
} else if (!partHash.toString().startsWith("hqp_") && !partHash.toString().startsWith("hqpe")
|
|
38
|
+
} else if (!partHash.toString().startsWith("hqp_") && !partHash.toString().startsWith("hqpe")) {
|
|
39
39
|
throw Error("Invalid part hash: ".concat(partHash));
|
|
40
40
|
}
|
|
41
41
|
};
|