@eluvio/elv-client-js 4.0.49 → 4.0.51

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.
@@ -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",
@@ -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
- return this.BaseURI().path(path).query(queryParams).hash("").toString();
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 _callee14() {
925
- var _ref11,
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
- _args14 = arguments;
933
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
934
- while (1) switch (_context14.prev = _context14.next) {
1050
+ _args16 = arguments;
1051
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1052
+ while (1) switch (_context16.prev = _context16.next) {
935
1053
  case 0:
936
- _ref11 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, address = _ref11.address, height = _ref11.height;
1054
+ _ref12 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, address = _ref12.address, height = _ref12.height;
937
1055
  if (!address) {
938
- _context14.next = 7;
1056
+ _context16.next = 7;
939
1057
  break;
940
1058
  }
941
- _context14.next = 4;
1059
+ _context16.next = 4;
942
1060
  return this.UserWalletAddress({
943
1061
  address: address
944
1062
  });
945
1063
  case 4:
946
- walletAddress = _context14.sent;
947
- _context14.next = 9;
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
- _context14.next = 11;
1072
+ _context16.next = 11;
955
1073
  break;
956
1074
  }
957
- return _context14.abrupt("return");
1075
+ return _context16.abrupt("return");
958
1076
  case 11:
959
- _context14.next = 13;
1077
+ _context16.next = 13;
960
1078
  return this.UserWalletObjectInfo({
961
1079
  address: address
962
1080
  });
963
1081
  case 13:
964
- _yield$this$UserWalle6 = _context14.sent;
1082
+ _yield$this$UserWalle6 = _context16.sent;
965
1083
  libraryId = _yield$this$UserWalle6.libraryId;
966
1084
  objectId = _yield$this$UserWalle6.objectId;
967
- return _context14.abrupt("return", this.client.ContentObjectImageUrl({
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 _context14.stop();
1093
+ return _context16.stop();
976
1094
  }
977
- }, _callee14, this);
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 _callee15(_ref12) {
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 _callee15$(_context15) {
996
- while (1) switch (_context15.prev = _context15.next) {
1113
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1114
+ while (1) switch (_context17.prev = _context17.next) {
997
1115
  case 0:
998
- image = _ref12.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
- _context15.next = 5;
1120
+ _context17.next = 5;
1003
1121
  break;
1004
1122
  }
1005
1123
  throw Error("Maximum profile image size is 5MB");
1006
1124
  case 5:
1007
- _context15.next = 7;
1125
+ _context17.next = 7;
1008
1126
  return this.UserWalletObjectInfo();
1009
1127
  case 7:
1010
- _yield$this$UserWalle7 = _context15.sent;
1128
+ _yield$this$UserWalle7 = _context17.sent;
1011
1129
  libraryId = _yield$this$UserWalle7.libraryId;
1012
1130
  objectId = _yield$this$UserWalle7.objectId;
1013
- _context15.next = 12;
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 = _context15.sent;
1020
- _context15.next = 15;
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
- _context15.next = 17;
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 _context15.stop();
1157
+ return _context17.stop();
1040
1158
  }
1041
- }, _callee15, this);
1159
+ }, _callee17, this);
1042
1160
  }));
1043
- function SetUserProfileImage(_x8) {
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 _callee16() {
1061
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1062
- while (1) switch (_context16.prev = _context16.next) {
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
- _context16.next = 2;
1182
+ _context18.next = 2;
1065
1183
  return this.UserMetadata({
1066
1184
  metadataSubtree: "collected_data"
1067
1185
  });
1068
1186
  case 2:
1069
- _context16.t0 = _context16.sent;
1070
- if (_context16.t0) {
1071
- _context16.next = 5;
1187
+ _context18.t0 = _context18.sent;
1188
+ if (_context18.t0) {
1189
+ _context18.next = 5;
1072
1190
  break;
1073
1191
  }
1074
- _context16.t0 = {};
1192
+ _context18.t0 = {};
1075
1193
  case 5:
1076
- return _context16.abrupt("return", _context16.t0);
1194
+ return _context18.abrupt("return", _context18.t0);
1077
1195
  case 6:
1078
1196
  case "end":
1079
- return _context16.stop();
1197
+ return _context18.stop();
1080
1198
  }
1081
- }, _callee16, this);
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 _callee17(_ref13) {
1209
+ var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref14) {
1092
1210
  var libraryId, objectId, versionHash;
1093
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1094
- while (1) switch (_context17.prev = _context17.next) {
1211
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1212
+ while (1) switch (_context19.prev = _context19.next) {
1095
1213
  case 0:
1096
- libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash;
1097
- _context17.prev = 1;
1098
- _context17.next = 4;
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
- _context17.next = 9;
1223
+ _context19.next = 9;
1106
1224
  break;
1107
1225
  case 6:
1108
- _context17.prev = 6;
1109
- _context17.t0 = _context17["catch"](1);
1226
+ _context19.prev = 6;
1227
+ _context19.t0 = _context19["catch"](1);
1110
1228
  // eslint-disable-next-line no-console
1111
- console.error(_context17.t0);
1229
+ console.error(_context19.t0);
1112
1230
  case 9:
1113
1231
  case "end":
1114
- return _context17.stop();
1232
+ return _context19.stop();
1115
1233
  }
1116
- }, _callee17, this, [[1, 6]]);
1234
+ }, _callee19, this, [[1, 6]]);
1117
1235
  }));
1118
- function RecordTags(_x9) {
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 _callee18(_ref14) {
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 _callee18$(_context18) {
1129
- while (1) switch (_context18.prev = _context18.next) {
1246
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1247
+ while (1) switch (_context20.prev = _context20.next) {
1130
1248
  case 0:
1131
- libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash;
1132
- _context18.next = 3;
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 = _context18.sent;
1255
+ accessType = _context20.sent;
1138
1256
  if (!(accessType !== "object")) {
1139
- _context18.next = 6;
1257
+ _context20.next = 6;
1140
1258
  break;
1141
1259
  }
1142
- return _context18.abrupt("return");
1260
+ return _context20.abrupt("return");
1143
1261
  case 6:
1144
1262
  if (!(!versionHash && !libraryId)) {
1145
- _context18.next = 10;
1263
+ _context20.next = 10;
1146
1264
  break;
1147
1265
  }
1148
- _context18.next = 9;
1266
+ _context20.next = 9;
1149
1267
  return this.client.ContentObjectLibraryId({
1150
1268
  objectId: objectId
1151
1269
  });
1152
1270
  case 9:
1153
- libraryId = _context18.sent;
1271
+ libraryId = _context20.sent;
1154
1272
  case 10:
1155
1273
  if (versionHash) {
1156
- _context18.next = 14;
1274
+ _context20.next = 14;
1157
1275
  break;
1158
1276
  }
1159
- _context18.next = 13;
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 = _context18.sent.hash;
1283
+ versionHash = _context20.sent.hash;
1166
1284
  case 14:
1167
- _context18.next = 16;
1285
+ _context20.next = 16;
1168
1286
  return this.UserMetadata({
1169
1287
  metadataSubtree: UrlJoin("accessed_content", versionHash)
1170
1288
  });
1171
1289
  case 16:
1172
- seen = _context18.sent;
1290
+ seen = _context20.sent;
1173
1291
  if (!seen) {
1174
- _context18.next = 19;
1292
+ _context20.next = 19;
1175
1293
  break;
1176
1294
  }
1177
- return _context18.abrupt("return");
1295
+ return _context20.abrupt("return");
1178
1296
  case 19:
1179
- _context18.next = 21;
1297
+ _context20.next = 21;
1180
1298
  return this.UserWalletObjectInfo();
1181
1299
  case 21:
1182
- walletObjectInfo = _context18.sent;
1300
+ walletObjectInfo = _context20.sent;
1183
1301
  userLibraryId = walletObjectInfo.libraryId;
1184
1302
  userObjectId = walletObjectInfo.objectId; // Mark content as seen
1185
- _context18.next = 26;
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 = _context18.sent;
1192
- _context18.next = 29;
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
- _context18.next = 31;
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 = _context18.sent;
1327
+ contentTags = _context20.sent;
1210
1328
  if (!(contentTags && contentTags.length > 0)) {
1211
- _context18.next = 40;
1329
+ _context20.next = 40;
1212
1330
  break;
1213
1331
  }
1214
- _context18.next = 35;
1332
+ _context20.next = 35;
1215
1333
  return this.CollectedTags();
1216
1334
  case 35:
1217
- userTags = _context18.sent;
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
- _context18.next = 40;
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
- _context18.next = 42;
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 _context18.stop();
1371
+ return _context20.stop();
1254
1372
  }
1255
- }, _callee18, this);
1373
+ }, _callee20, this);
1256
1374
  }));
1257
- function __RecordTags(_x10) {
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
  *
@@ -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
  };