@eluvio/elv-client-js 4.0.56 → 4.0.57
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 +11 -10
- 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 +10 -9
- package/dist/ElvWalletClient-node-min.js +10 -10
- package/dist/src/ElvClient.js +441 -306
- package/dist/src/FrameClient.js +2 -2
- package/dist/src/HttpClient.js +10 -1
- package/dist/src/UserProfileClient.js +206 -88
- package/dist/src/Utils.js +10 -0
- package/dist/src/Validation.js +1 -1
- package/dist/src/client/ContentAccess.js +574 -405
- package/dist/src/client/LiveConf.js +330 -0
- package/dist/src/client/LiveStream.js +1785 -0
- package/package.json +1 -1
- package/src/client/Files.js +23 -2
- package/testScripts/Test.js +0 -14
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", "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"];
|
|
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", "EmbedUrl", "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", "SpaceNodes", "StartABRMezzanineJobs", "StreamConfig", "StreamCreate", "StreamStatus", "StreamStartOrStopOrReset", "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", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
|
|
457
|
+
return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "TenantContractId", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
|
|
458
458
|
}
|
|
459
459
|
}, {
|
|
460
460
|
key: "AllowedWalletClientMethods",
|
package/dist/src/HttpClient.js
CHANGED
|
@@ -199,7 +199,16 @@ 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
|
-
|
|
202
|
+
var baseURI = this.BaseURI();
|
|
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();
|
|
203
212
|
}
|
|
204
213
|
}], [{
|
|
205
214
|
key: "Fetch",
|
|
@@ -904,6 +904,124 @@ 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
|
+
}()
|
|
907
1025
|
/**
|
|
908
1026
|
* Get the URL of the current user's profile image
|
|
909
1027
|
*
|
|
@@ -921,50 +1039,50 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
921
1039
|
}, {
|
|
922
1040
|
key: "UserProfileImage",
|
|
923
1041
|
value: function () {
|
|
924
|
-
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
925
|
-
var
|
|
1042
|
+
var _UserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1043
|
+
var _ref12,
|
|
926
1044
|
address,
|
|
927
1045
|
height,
|
|
928
1046
|
walletAddress,
|
|
929
1047
|
_yield$this$UserWalle6,
|
|
930
1048
|
libraryId,
|
|
931
1049
|
objectId,
|
|
932
|
-
|
|
933
|
-
return _regeneratorRuntime.wrap(function
|
|
934
|
-
while (1) switch (
|
|
1050
|
+
_args16 = arguments;
|
|
1051
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1052
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
935
1053
|
case 0:
|
|
936
|
-
|
|
1054
|
+
_ref12 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, address = _ref12.address, height = _ref12.height;
|
|
937
1055
|
if (!address) {
|
|
938
|
-
|
|
1056
|
+
_context16.next = 7;
|
|
939
1057
|
break;
|
|
940
1058
|
}
|
|
941
|
-
|
|
1059
|
+
_context16.next = 4;
|
|
942
1060
|
return this.UserWalletAddress({
|
|
943
1061
|
address: address
|
|
944
1062
|
});
|
|
945
1063
|
case 4:
|
|
946
|
-
walletAddress =
|
|
947
|
-
|
|
1064
|
+
walletAddress = _context16.sent;
|
|
1065
|
+
_context16.next = 9;
|
|
948
1066
|
break;
|
|
949
1067
|
case 7:
|
|
950
1068
|
address = this.client.signer.address;
|
|
951
1069
|
walletAddress = this.walletAddress;
|
|
952
1070
|
case 9:
|
|
953
1071
|
if (walletAddress) {
|
|
954
|
-
|
|
1072
|
+
_context16.next = 11;
|
|
955
1073
|
break;
|
|
956
1074
|
}
|
|
957
|
-
return
|
|
1075
|
+
return _context16.abrupt("return");
|
|
958
1076
|
case 11:
|
|
959
|
-
|
|
1077
|
+
_context16.next = 13;
|
|
960
1078
|
return this.UserWalletObjectInfo({
|
|
961
1079
|
address: address
|
|
962
1080
|
});
|
|
963
1081
|
case 13:
|
|
964
|
-
_yield$this$UserWalle6 =
|
|
1082
|
+
_yield$this$UserWalle6 = _context16.sent;
|
|
965
1083
|
libraryId = _yield$this$UserWalle6.libraryId;
|
|
966
1084
|
objectId = _yield$this$UserWalle6.objectId;
|
|
967
|
-
return
|
|
1085
|
+
return _context16.abrupt("return", this.client.ContentObjectImageUrl({
|
|
968
1086
|
libraryId: libraryId,
|
|
969
1087
|
objectId: objectId,
|
|
970
1088
|
height: height,
|
|
@@ -972,9 +1090,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
972
1090
|
}));
|
|
973
1091
|
case 17:
|
|
974
1092
|
case "end":
|
|
975
|
-
return
|
|
1093
|
+
return _context16.stop();
|
|
976
1094
|
}
|
|
977
|
-
},
|
|
1095
|
+
}, _callee16, this);
|
|
978
1096
|
}));
|
|
979
1097
|
function UserProfileImage() {
|
|
980
1098
|
return _UserProfileImage.apply(this, arguments);
|
|
@@ -990,34 +1108,34 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
990
1108
|
}, {
|
|
991
1109
|
key: "SetUserProfileImage",
|
|
992
1110
|
value: function () {
|
|
993
|
-
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1111
|
+
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref13) {
|
|
994
1112
|
var image, size, _yield$this$UserWalle7, libraryId, objectId, editRequest;
|
|
995
|
-
return _regeneratorRuntime.wrap(function
|
|
996
|
-
while (1) switch (
|
|
1113
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1114
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
997
1115
|
case 0:
|
|
998
|
-
image =
|
|
1116
|
+
image = _ref13.image;
|
|
999
1117
|
this.Log("Setting profile image for user ".concat(this.client.signer.address));
|
|
1000
1118
|
size = image.length || image.byteLength || image.size;
|
|
1001
1119
|
if (!(size > 5000000)) {
|
|
1002
|
-
|
|
1120
|
+
_context17.next = 5;
|
|
1003
1121
|
break;
|
|
1004
1122
|
}
|
|
1005
1123
|
throw Error("Maximum profile image size is 5MB");
|
|
1006
1124
|
case 5:
|
|
1007
|
-
|
|
1125
|
+
_context17.next = 7;
|
|
1008
1126
|
return this.UserWalletObjectInfo();
|
|
1009
1127
|
case 7:
|
|
1010
|
-
_yield$this$UserWalle7 =
|
|
1128
|
+
_yield$this$UserWalle7 = _context17.sent;
|
|
1011
1129
|
libraryId = _yield$this$UserWalle7.libraryId;
|
|
1012
1130
|
objectId = _yield$this$UserWalle7.objectId;
|
|
1013
|
-
|
|
1131
|
+
_context17.next = 12;
|
|
1014
1132
|
return this.client.EditContentObject({
|
|
1015
1133
|
libraryId: libraryId,
|
|
1016
1134
|
objectId: objectId
|
|
1017
1135
|
});
|
|
1018
1136
|
case 12:
|
|
1019
|
-
editRequest =
|
|
1020
|
-
|
|
1137
|
+
editRequest = _context17.sent;
|
|
1138
|
+
_context17.next = 15;
|
|
1021
1139
|
return this.client.SetContentObjectImage({
|
|
1022
1140
|
libraryId: libraryId,
|
|
1023
1141
|
objectId: objectId,
|
|
@@ -1027,7 +1145,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1027
1145
|
imagePath: "public/profile_image"
|
|
1028
1146
|
});
|
|
1029
1147
|
case 15:
|
|
1030
|
-
|
|
1148
|
+
_context17.next = 17;
|
|
1031
1149
|
return this.client.FinalizeContentObject({
|
|
1032
1150
|
libraryId: libraryId,
|
|
1033
1151
|
objectId: objectId,
|
|
@@ -1036,11 +1154,11 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1036
1154
|
});
|
|
1037
1155
|
case 17:
|
|
1038
1156
|
case "end":
|
|
1039
|
-
return
|
|
1157
|
+
return _context17.stop();
|
|
1040
1158
|
}
|
|
1041
|
-
},
|
|
1159
|
+
}, _callee17, this);
|
|
1042
1160
|
}));
|
|
1043
|
-
function SetUserProfileImage(
|
|
1161
|
+
function SetUserProfileImage(_x9) {
|
|
1044
1162
|
return _SetUserProfileImage.apply(this, arguments);
|
|
1045
1163
|
}
|
|
1046
1164
|
return SetUserProfileImage;
|
|
@@ -1057,28 +1175,28 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1057
1175
|
}, {
|
|
1058
1176
|
key: "CollectedTags",
|
|
1059
1177
|
value: function () {
|
|
1060
|
-
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1061
|
-
return _regeneratorRuntime.wrap(function
|
|
1062
|
-
while (1) switch (
|
|
1178
|
+
var _CollectedTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
1179
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1180
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1063
1181
|
case 0:
|
|
1064
|
-
|
|
1182
|
+
_context18.next = 2;
|
|
1065
1183
|
return this.UserMetadata({
|
|
1066
1184
|
metadataSubtree: "collected_data"
|
|
1067
1185
|
});
|
|
1068
1186
|
case 2:
|
|
1069
|
-
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1187
|
+
_context18.t0 = _context18.sent;
|
|
1188
|
+
if (_context18.t0) {
|
|
1189
|
+
_context18.next = 5;
|
|
1072
1190
|
break;
|
|
1073
1191
|
}
|
|
1074
|
-
|
|
1192
|
+
_context18.t0 = {};
|
|
1075
1193
|
case 5:
|
|
1076
|
-
return
|
|
1194
|
+
return _context18.abrupt("return", _context18.t0);
|
|
1077
1195
|
case 6:
|
|
1078
1196
|
case "end":
|
|
1079
|
-
return
|
|
1197
|
+
return _context18.stop();
|
|
1080
1198
|
}
|
|
1081
|
-
},
|
|
1199
|
+
}, _callee18, this);
|
|
1082
1200
|
}));
|
|
1083
1201
|
function CollectedTags() {
|
|
1084
1202
|
return _CollectedTags.apply(this, arguments);
|
|
@@ -1088,34 +1206,34 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1088
1206
|
}, {
|
|
1089
1207
|
key: "RecordTags",
|
|
1090
1208
|
value: function () {
|
|
1091
|
-
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1209
|
+
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref14) {
|
|
1092
1210
|
var libraryId, objectId, versionHash;
|
|
1093
|
-
return _regeneratorRuntime.wrap(function
|
|
1094
|
-
while (1) switch (
|
|
1211
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1212
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1095
1213
|
case 0:
|
|
1096
|
-
libraryId =
|
|
1097
|
-
|
|
1098
|
-
|
|
1214
|
+
libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
|
|
1215
|
+
_context19.prev = 1;
|
|
1216
|
+
_context19.next = 4;
|
|
1099
1217
|
return this.__RecordTags({
|
|
1100
1218
|
libraryId: libraryId,
|
|
1101
1219
|
objectId: objectId,
|
|
1102
1220
|
versionHash: versionHash
|
|
1103
1221
|
});
|
|
1104
1222
|
case 4:
|
|
1105
|
-
|
|
1223
|
+
_context19.next = 9;
|
|
1106
1224
|
break;
|
|
1107
1225
|
case 6:
|
|
1108
|
-
|
|
1109
|
-
|
|
1226
|
+
_context19.prev = 6;
|
|
1227
|
+
_context19.t0 = _context19["catch"](1);
|
|
1110
1228
|
// eslint-disable-next-line no-console
|
|
1111
|
-
console.error(
|
|
1229
|
+
console.error(_context19.t0);
|
|
1112
1230
|
case 9:
|
|
1113
1231
|
case "end":
|
|
1114
|
-
return
|
|
1232
|
+
return _context19.stop();
|
|
1115
1233
|
}
|
|
1116
|
-
},
|
|
1234
|
+
}, _callee19, this, [[1, 6]]);
|
|
1117
1235
|
}));
|
|
1118
|
-
function RecordTags(
|
|
1236
|
+
function RecordTags(_x10) {
|
|
1119
1237
|
return _RecordTags.apply(this, arguments);
|
|
1120
1238
|
}
|
|
1121
1239
|
return RecordTags;
|
|
@@ -1123,73 +1241,73 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1123
1241
|
}, {
|
|
1124
1242
|
key: "__RecordTags",
|
|
1125
1243
|
value: function () {
|
|
1126
|
-
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1244
|
+
var _RecordTags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref15) {
|
|
1127
1245
|
var libraryId, objectId, versionHash, accessType, seen, walletObjectInfo, userLibraryId, userObjectId, editRequest, contentTags, userTags, formattedTags;
|
|
1128
|
-
return _regeneratorRuntime.wrap(function
|
|
1129
|
-
while (1) switch (
|
|
1246
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1247
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1130
1248
|
case 0:
|
|
1131
|
-
libraryId =
|
|
1132
|
-
|
|
1249
|
+
libraryId = _ref15.libraryId, objectId = _ref15.objectId, versionHash = _ref15.versionHash;
|
|
1250
|
+
_context20.next = 3;
|
|
1133
1251
|
return this.client.AccessType({
|
|
1134
1252
|
id: objectId
|
|
1135
1253
|
});
|
|
1136
1254
|
case 3:
|
|
1137
|
-
accessType =
|
|
1255
|
+
accessType = _context20.sent;
|
|
1138
1256
|
if (!(accessType !== "object")) {
|
|
1139
|
-
|
|
1257
|
+
_context20.next = 6;
|
|
1140
1258
|
break;
|
|
1141
1259
|
}
|
|
1142
|
-
return
|
|
1260
|
+
return _context20.abrupt("return");
|
|
1143
1261
|
case 6:
|
|
1144
1262
|
if (!(!versionHash && !libraryId)) {
|
|
1145
|
-
|
|
1263
|
+
_context20.next = 10;
|
|
1146
1264
|
break;
|
|
1147
1265
|
}
|
|
1148
|
-
|
|
1266
|
+
_context20.next = 9;
|
|
1149
1267
|
return this.client.ContentObjectLibraryId({
|
|
1150
1268
|
objectId: objectId
|
|
1151
1269
|
});
|
|
1152
1270
|
case 9:
|
|
1153
|
-
libraryId =
|
|
1271
|
+
libraryId = _context20.sent;
|
|
1154
1272
|
case 10:
|
|
1155
1273
|
if (versionHash) {
|
|
1156
|
-
|
|
1274
|
+
_context20.next = 14;
|
|
1157
1275
|
break;
|
|
1158
1276
|
}
|
|
1159
|
-
|
|
1277
|
+
_context20.next = 13;
|
|
1160
1278
|
return this.client.ContentObject({
|
|
1161
1279
|
libraryId: libraryId,
|
|
1162
1280
|
objectId: objectId
|
|
1163
1281
|
});
|
|
1164
1282
|
case 13:
|
|
1165
|
-
versionHash =
|
|
1283
|
+
versionHash = _context20.sent.hash;
|
|
1166
1284
|
case 14:
|
|
1167
|
-
|
|
1285
|
+
_context20.next = 16;
|
|
1168
1286
|
return this.UserMetadata({
|
|
1169
1287
|
metadataSubtree: UrlJoin("accessed_content", versionHash)
|
|
1170
1288
|
});
|
|
1171
1289
|
case 16:
|
|
1172
|
-
seen =
|
|
1290
|
+
seen = _context20.sent;
|
|
1173
1291
|
if (!seen) {
|
|
1174
|
-
|
|
1292
|
+
_context20.next = 19;
|
|
1175
1293
|
break;
|
|
1176
1294
|
}
|
|
1177
|
-
return
|
|
1295
|
+
return _context20.abrupt("return");
|
|
1178
1296
|
case 19:
|
|
1179
|
-
|
|
1297
|
+
_context20.next = 21;
|
|
1180
1298
|
return this.UserWalletObjectInfo();
|
|
1181
1299
|
case 21:
|
|
1182
|
-
walletObjectInfo =
|
|
1300
|
+
walletObjectInfo = _context20.sent;
|
|
1183
1301
|
userLibraryId = walletObjectInfo.libraryId;
|
|
1184
1302
|
userObjectId = walletObjectInfo.objectId; // Mark content as seen
|
|
1185
|
-
|
|
1303
|
+
_context20.next = 26;
|
|
1186
1304
|
return this.client.EditContentObject({
|
|
1187
1305
|
libraryId: userLibraryId,
|
|
1188
1306
|
objectId: userObjectId
|
|
1189
1307
|
});
|
|
1190
1308
|
case 26:
|
|
1191
|
-
editRequest =
|
|
1192
|
-
|
|
1309
|
+
editRequest = _context20.sent;
|
|
1310
|
+
_context20.next = 29;
|
|
1193
1311
|
return this.client.ReplaceMetadata({
|
|
1194
1312
|
libraryId: userLibraryId,
|
|
1195
1313
|
objectId: userObjectId,
|
|
@@ -1198,7 +1316,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1198
1316
|
metadata: Date.now()
|
|
1199
1317
|
});
|
|
1200
1318
|
case 29:
|
|
1201
|
-
|
|
1319
|
+
_context20.next = 31;
|
|
1202
1320
|
return this.client.ContentObjectMetadata({
|
|
1203
1321
|
libraryId: libraryId,
|
|
1204
1322
|
objectId: objectId,
|
|
@@ -1206,15 +1324,15 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1206
1324
|
metadataSubtree: "video_tags"
|
|
1207
1325
|
});
|
|
1208
1326
|
case 31:
|
|
1209
|
-
contentTags =
|
|
1327
|
+
contentTags = _context20.sent;
|
|
1210
1328
|
if (!(contentTags && contentTags.length > 0)) {
|
|
1211
|
-
|
|
1329
|
+
_context20.next = 40;
|
|
1212
1330
|
break;
|
|
1213
1331
|
}
|
|
1214
|
-
|
|
1332
|
+
_context20.next = 35;
|
|
1215
1333
|
return this.CollectedTags();
|
|
1216
1334
|
case 35:
|
|
1217
|
-
userTags =
|
|
1335
|
+
userTags = _context20.sent;
|
|
1218
1336
|
formattedTags = this.__FormatVideoTags(contentTags);
|
|
1219
1337
|
Object.keys(formattedTags).forEach(function (tag) {
|
|
1220
1338
|
if (userTags[tag]) {
|
|
@@ -1231,7 +1349,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1231
1349
|
});
|
|
1232
1350
|
|
|
1233
1351
|
// Update user tags
|
|
1234
|
-
|
|
1352
|
+
_context20.next = 40;
|
|
1235
1353
|
return this.client.ReplaceMetadata({
|
|
1236
1354
|
libraryId: userLibraryId,
|
|
1237
1355
|
objectId: userObjectId,
|
|
@@ -1240,7 +1358,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1240
1358
|
metadata: userTags
|
|
1241
1359
|
});
|
|
1242
1360
|
case 40:
|
|
1243
|
-
|
|
1361
|
+
_context20.next = 42;
|
|
1244
1362
|
return this.client.FinalizeContentObject({
|
|
1245
1363
|
libraryId: userLibraryId,
|
|
1246
1364
|
objectId: userObjectId,
|
|
@@ -1250,11 +1368,11 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1250
1368
|
});
|
|
1251
1369
|
case 42:
|
|
1252
1370
|
case "end":
|
|
1253
|
-
return
|
|
1371
|
+
return _context20.stop();
|
|
1254
1372
|
}
|
|
1255
|
-
},
|
|
1373
|
+
}, _callee20, this);
|
|
1256
1374
|
}));
|
|
1257
|
-
function __RecordTags(
|
|
1375
|
+
function __RecordTags(_x11) {
|
|
1258
1376
|
return _RecordTags2.apply(this, arguments);
|
|
1259
1377
|
}
|
|
1260
1378
|
return __RecordTags;
|
package/dist/src/Utils.js
CHANGED
|
@@ -305,6 +305,16 @@ 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
|
+
},
|
|
308
318
|
/**
|
|
309
319
|
* Convert contract address to content library ID
|
|
310
320
|
*
|
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") && !partHash.toString().startsWith("hqt_") && !partHash.toString().startsWith("hqte") && !partHash.toString().startsWith("hql_") && !partHash.toString().startsWith("hqle")) {
|
|
39
39
|
throw Error("Invalid part hash: ".concat(partHash));
|
|
40
40
|
}
|
|
41
41
|
};
|