@eluvio/elv-client-js 4.0.78 → 4.0.79
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 +5 -5
- package/dist/ElvClient-node-min.js +9 -9
- package/dist/ElvFrameClient-min.js +2 -2
- package/dist/ElvWalletClient-min.js +7 -7
- package/dist/ElvWalletClient-node-min.js +9 -9
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +15 -7
- package/dist/src/UserProfileClient.js +36 -71
- package/dist/src/client/AccessGroups.js +39 -35
- package/dist/src/client/ContentAccess.js +1 -1
- package/dist/src/client/ContentManagement.js +100 -40
- package/dist/src/client/Contracts.js +268 -4
- package/dist/src/client/LiveStream.js +239 -210
- package/package.json +1 -1
- package/src/FrameClient.js +2 -1
- package/src/HttpClient.js +6 -0
- package/src/UserProfileClient.js +9 -38
- package/src/client/AccessGroups.js +19 -24
- package/src/client/ContentAccess.js +1 -1
- package/src/client/ContentManagement.js +44 -22
- package/src/client/Contracts.js +157 -2
- package/src/client/LiveStream.js +146 -128
- package/testScripts/TestAddTenantContractId.js +87 -0
package/dist/src/FrameClient.js
CHANGED
|
@@ -449,7 +449,7 @@ 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", "ContractInfo", "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", "MakeAuthServiceRequest", "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", "
|
|
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", "ContractInfo", "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", "DeleteWriteToken", "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", "MakeAuthServiceRequest", "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", "StreamInitialize", "StreamInsertion", "StreamListUrls", "StreamStatus", "StreamStartOrStopOrReset", "StreamStopSession", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility", "WriteTokenNodeUrl"];
|
|
453
453
|
}
|
|
454
454
|
}, {
|
|
455
455
|
key: "AllowedUserProfileMethods",
|
package/dist/src/HttpClient.js
CHANGED
|
@@ -37,6 +37,14 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
37
37
|
if (!writeToken) throw Error("RecordWriteToken() - writeToken not supplied");
|
|
38
38
|
this.draftURIs[writeToken] = new URI(nodeUrlStr);
|
|
39
39
|
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "ClearWriteToken",
|
|
42
|
+
value: function ClearWriteToken(_ref2) {
|
|
43
|
+
var writeToken = _ref2.writeToken;
|
|
44
|
+
if (Object.hasOwn(this.draftURIs, writeToken)) {
|
|
45
|
+
delete this.draftURIs[writeToken];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
40
48
|
}, {
|
|
41
49
|
key: "RequestHeaders",
|
|
42
50
|
value: function RequestHeaders(bodyType) {
|
|
@@ -54,12 +62,12 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
54
62
|
}, {
|
|
55
63
|
key: "Request",
|
|
56
64
|
value: function () {
|
|
57
|
-
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
|
58
|
-
var method, path,
|
|
65
|
+
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
66
|
+
var method, path, _ref3$queryParams, queryParams, body, _ref3$bodyType, bodyType, _ref3$headers, headers, _ref3$attempts, attempts, _ref3$allowFailover, allowFailover, _ref3$forceFailover, forceFailover, _ref3$allowRetry, allowRetry, baseURI, writeTokenMatch, writeToken, uri, fetchParameters, response, responseType, errorBody, error;
|
|
59
67
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
60
68
|
while (1) switch (_context.prev = _context.next) {
|
|
61
69
|
case 0:
|
|
62
|
-
method =
|
|
70
|
+
method = _ref3.method, path = _ref3.path, _ref3$queryParams = _ref3.queryParams, queryParams = _ref3$queryParams === void 0 ? {} : _ref3$queryParams, body = _ref3.body, _ref3$bodyType = _ref3.bodyType, bodyType = _ref3$bodyType === void 0 ? "JSON" : _ref3$bodyType, _ref3$headers = _ref3.headers, headers = _ref3$headers === void 0 ? {} : _ref3$headers, _ref3$attempts = _ref3.attempts, attempts = _ref3$attempts === void 0 ? 0 : _ref3$attempts, _ref3$allowFailover = _ref3.allowFailover, allowFailover = _ref3$allowFailover === void 0 ? true : _ref3$allowFailover, _ref3$forceFailover = _ref3.forceFailover, forceFailover = _ref3$forceFailover === void 0 ? false : _ref3$forceFailover, _ref3$allowRetry = _ref3.allowRetry, allowRetry = _ref3$allowRetry === void 0 ? true : _ref3$allowRetry;
|
|
63
71
|
baseURI = this.BaseURI(); // If URL contains a write token, it must go to the correct server and can not fail over
|
|
64
72
|
writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
|
|
65
73
|
writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
|
|
@@ -195,10 +203,10 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
195
203
|
}()
|
|
196
204
|
}, {
|
|
197
205
|
key: "URL",
|
|
198
|
-
value: function URL(
|
|
199
|
-
var path =
|
|
200
|
-
|
|
201
|
-
queryParams =
|
|
206
|
+
value: function URL(_ref4) {
|
|
207
|
+
var path = _ref4.path,
|
|
208
|
+
_ref4$queryParams = _ref4.queryParams,
|
|
209
|
+
queryParams = _ref4$queryParams === void 0 ? {} : _ref4$queryParams;
|
|
202
210
|
var baseURI = this.BaseURI();
|
|
203
211
|
|
|
204
212
|
// If URL contains a write token, it must go to the correct server and can not fail over
|
|
@@ -913,22 +913,28 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
913
913
|
key: "TenantContractId",
|
|
914
914
|
value: function () {
|
|
915
915
|
var _TenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
916
|
+
var _yield$this$UserWalle6, objectId;
|
|
916
917
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
917
918
|
while (1) switch (_context14.prev = _context14.next) {
|
|
918
919
|
case 0:
|
|
919
920
|
if (this.tenantContractId) {
|
|
920
|
-
_context14.next =
|
|
921
|
+
_context14.next = 8;
|
|
921
922
|
break;
|
|
922
923
|
}
|
|
923
924
|
_context14.next = 3;
|
|
924
|
-
return this.
|
|
925
|
-
metadataSubtree: "tenantContractId"
|
|
926
|
-
});
|
|
925
|
+
return this.UserWalletObjectInfo();
|
|
927
926
|
case 3:
|
|
927
|
+
_yield$this$UserWalle6 = _context14.sent;
|
|
928
|
+
objectId = _yield$this$UserWalle6.objectId;
|
|
929
|
+
_context14.next = 7;
|
|
930
|
+
return this.client.TenantContractId({
|
|
931
|
+
contractAddress: this.client.utils.HashToAddress(objectId)
|
|
932
|
+
});
|
|
933
|
+
case 7:
|
|
928
934
|
this.tenantContractId = _context14.sent;
|
|
929
|
-
case
|
|
935
|
+
case 8:
|
|
930
936
|
return _context14.abrupt("return", this.tenantContractId);
|
|
931
|
-
case
|
|
937
|
+
case 9:
|
|
932
938
|
case "end":
|
|
933
939
|
return _context14.stop();
|
|
934
940
|
}
|
|
@@ -946,76 +952,35 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
946
952
|
*
|
|
947
953
|
* @namedParams
|
|
948
954
|
* @param {string} tenantContractId - The tenant contract ID in hash format
|
|
949
|
-
* @param {string} address - The
|
|
955
|
+
* @param {string} address - The tenant address to use in the hash if id is not provided
|
|
950
956
|
*/
|
|
951
957
|
}, {
|
|
952
958
|
key: "SetTenantContractId",
|
|
953
959
|
value: function () {
|
|
954
960
|
var _SetTenantContractId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref11) {
|
|
955
|
-
var tenantContractId,
|
|
961
|
+
var tenantContractId, _yield$this$UserWalle7, objectId, tenantInfo;
|
|
956
962
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
957
963
|
while (1) switch (_context15.prev = _context15.next) {
|
|
958
964
|
case 0:
|
|
959
|
-
tenantContractId = _ref11.tenantContractId
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
throw Error("Invalid tenant ID: ".concat(tenantContractId));
|
|
965
|
+
tenantContractId = _ref11.tenantContractId;
|
|
966
|
+
_context15.next = 3;
|
|
967
|
+
return this.UserWalletObjectInfo();
|
|
965
968
|
case 3:
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
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
|
-
}
|
|
969
|
+
_yield$this$UserWalle7 = _context15.sent;
|
|
970
|
+
objectId = _yield$this$UserWalle7.objectId;
|
|
971
|
+
_context15.next = 7;
|
|
972
|
+
return this.client.SetTenantContractId({
|
|
973
|
+
objectId: objectId,
|
|
974
|
+
tenantContractId: tenantContractId
|
|
1013
975
|
});
|
|
1014
|
-
case
|
|
976
|
+
case 7:
|
|
977
|
+
tenantInfo = _context15.sent;
|
|
978
|
+
this.tenantContractId = tenantInfo.tenantContractId;
|
|
979
|
+
case 9:
|
|
1015
980
|
case "end":
|
|
1016
981
|
return _context15.stop();
|
|
1017
982
|
}
|
|
1018
|
-
}, _callee15, this
|
|
983
|
+
}, _callee15, this);
|
|
1019
984
|
}));
|
|
1020
985
|
function SetTenantContractId(_x8) {
|
|
1021
986
|
return _SetTenantContractId.apply(this, arguments);
|
|
@@ -1044,7 +1009,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1044
1009
|
address,
|
|
1045
1010
|
height,
|
|
1046
1011
|
walletAddress,
|
|
1047
|
-
_yield$this$
|
|
1012
|
+
_yield$this$UserWalle8,
|
|
1048
1013
|
libraryId,
|
|
1049
1014
|
objectId,
|
|
1050
1015
|
_args16 = arguments;
|
|
@@ -1079,9 +1044,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1079
1044
|
address: address
|
|
1080
1045
|
});
|
|
1081
1046
|
case 13:
|
|
1082
|
-
_yield$this$
|
|
1083
|
-
libraryId = _yield$this$
|
|
1084
|
-
objectId = _yield$this$
|
|
1047
|
+
_yield$this$UserWalle8 = _context16.sent;
|
|
1048
|
+
libraryId = _yield$this$UserWalle8.libraryId;
|
|
1049
|
+
objectId = _yield$this$UserWalle8.objectId;
|
|
1085
1050
|
return _context16.abrupt("return", this.client.ContentObjectImageUrl({
|
|
1086
1051
|
libraryId: libraryId,
|
|
1087
1052
|
objectId: objectId,
|
|
@@ -1109,7 +1074,7 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1109
1074
|
key: "SetUserProfileImage",
|
|
1110
1075
|
value: function () {
|
|
1111
1076
|
var _SetUserProfileImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref13) {
|
|
1112
|
-
var image, size, _yield$this$
|
|
1077
|
+
var image, size, _yield$this$UserWalle9, libraryId, objectId, editRequest;
|
|
1113
1078
|
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1114
1079
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1115
1080
|
case 0:
|
|
@@ -1125,9 +1090,9 @@ var UserProfileClient = /*#__PURE__*/function () {
|
|
|
1125
1090
|
_context17.next = 7;
|
|
1126
1091
|
return this.UserWalletObjectInfo();
|
|
1127
1092
|
case 7:
|
|
1128
|
-
_yield$this$
|
|
1129
|
-
libraryId = _yield$this$
|
|
1130
|
-
objectId = _yield$this$
|
|
1093
|
+
_yield$this$UserWalle9 = _context17.sent;
|
|
1094
|
+
libraryId = _yield$this$UserWalle9.libraryId;
|
|
1095
|
+
objectId = _yield$this$UserWalle9.objectId;
|
|
1131
1096
|
_context17.next = 12;
|
|
1132
1097
|
return this.client.EditContentObject({
|
|
1133
1098
|
libraryId: libraryId,
|
|
@@ -414,9 +414,10 @@ exports.CreateAccessGroup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regene
|
|
|
414
414
|
_yield$this$authClien,
|
|
415
415
|
contractAddress,
|
|
416
416
|
objectId,
|
|
417
|
-
|
|
417
|
+
tenantContractId,
|
|
418
418
|
editResponse,
|
|
419
419
|
groupMetadata,
|
|
420
|
+
tenantInfo,
|
|
420
421
|
tenantAdminGroupAddress,
|
|
421
422
|
_args9 = arguments;
|
|
422
423
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
@@ -432,9 +433,9 @@ exports.CreateAccessGroup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regene
|
|
|
432
433
|
contractAddress = this.utils.FormatAddress(contractAddress);
|
|
433
434
|
objectId = this.utils.AddressToObjectId(contractAddress);
|
|
434
435
|
_context9.next = 10;
|
|
435
|
-
return this.userProfileClient.
|
|
436
|
+
return this.userProfileClient.TenantContractId();
|
|
436
437
|
case 10:
|
|
437
|
-
|
|
438
|
+
tenantContractId = _context9.sent;
|
|
438
439
|
this.Log("Access group: ".concat(contractAddress, " ").concat(objectId));
|
|
439
440
|
_context9.next = 14;
|
|
440
441
|
return this.EditContentObject({
|
|
@@ -451,57 +452,60 @@ exports.CreateAccessGroup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regene
|
|
|
451
452
|
name: name,
|
|
452
453
|
description: description
|
|
453
454
|
}, metadata);
|
|
454
|
-
|
|
455
|
-
_context9.next = 25;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
tenantAdminGroupAddress = this.utils.HashToAddress(tenantId);
|
|
459
|
-
_context9.next = 20;
|
|
460
|
-
return this.AddContentObjectGroupPermission({
|
|
461
|
-
objectId: objectId,
|
|
462
|
-
groupAddress: tenantAdminGroupAddress,
|
|
463
|
-
permission: "manage"
|
|
464
|
-
});
|
|
465
|
-
case 20:
|
|
466
|
-
_context9.next = 22;
|
|
467
|
-
return this.ReplaceContractMetadata({
|
|
468
|
-
contractAddress: contractAddress,
|
|
469
|
-
metadataKey: "_tenantId",
|
|
470
|
-
metadata: tenantId
|
|
471
|
-
});
|
|
472
|
-
case 22:
|
|
473
|
-
groupMetadata["tenantId"] = tenantId;
|
|
474
|
-
_context9.next = 26;
|
|
475
|
-
break;
|
|
476
|
-
case 25:
|
|
477
|
-
// eslint-disable-next-line no-console
|
|
478
|
-
console.warn("No tenant ID associated with current tenant.");
|
|
479
|
-
case 26:
|
|
480
|
-
_context9.next = 28;
|
|
455
|
+
_context9.next = 18;
|
|
481
456
|
return this.ReplaceMetadata({
|
|
482
457
|
libraryId: this.contentSpaceLibraryId,
|
|
483
458
|
objectId: objectId,
|
|
484
459
|
writeToken: editResponse.write_token,
|
|
485
460
|
metadata: groupMetadata
|
|
486
461
|
});
|
|
487
|
-
case
|
|
488
|
-
_context9.next =
|
|
462
|
+
case 18:
|
|
463
|
+
_context9.next = 20;
|
|
489
464
|
return this.CallContractMethodAndWait({
|
|
490
465
|
contractAddress: contractAddress,
|
|
491
466
|
methodName: "setVisibility",
|
|
492
467
|
methodArgs: [visibility]
|
|
493
468
|
});
|
|
494
|
-
case
|
|
495
|
-
_context9.next =
|
|
469
|
+
case 20:
|
|
470
|
+
_context9.next = 22;
|
|
496
471
|
return this.FinalizeContentObject({
|
|
497
472
|
libraryId: this.contentSpaceLibraryId,
|
|
498
473
|
objectId: objectId,
|
|
499
474
|
writeToken: editResponse.write_token,
|
|
500
475
|
commitMessage: "Create access group"
|
|
501
476
|
});
|
|
477
|
+
case 22:
|
|
478
|
+
if (!tenantContractId) {
|
|
479
|
+
_context9.next = 33;
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
_context9.next = 25;
|
|
483
|
+
return this.SetTenantContractId({
|
|
484
|
+
contractAddress: contractAddress,
|
|
485
|
+
tenantContractId: tenantContractId
|
|
486
|
+
});
|
|
487
|
+
case 25:
|
|
488
|
+
tenantInfo = _context9.sent;
|
|
489
|
+
if (!tenantInfo.tenantId) {
|
|
490
|
+
_context9.next = 32;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
tenantAdminGroupAddress = this.utils.HashToAddress(tenantInfo.tenantId);
|
|
494
|
+
_context9.next = 30;
|
|
495
|
+
return this.AddContentObjectGroupPermission({
|
|
496
|
+
objectId: objectId,
|
|
497
|
+
groupAddress: tenantAdminGroupAddress,
|
|
498
|
+
permission: "manage"
|
|
499
|
+
});
|
|
500
|
+
case 30:
|
|
501
|
+
_context9.next = 33;
|
|
502
|
+
break;
|
|
502
503
|
case 32:
|
|
503
|
-
|
|
504
|
+
// eslint-disable-next-line no-console
|
|
505
|
+
console.warn("No tenant ID associated with current tenant.");
|
|
504
506
|
case 33:
|
|
507
|
+
return _context9.abrupt("return", contractAddress);
|
|
508
|
+
case 34:
|
|
505
509
|
case "end":
|
|
506
510
|
return _context9.stop();
|
|
507
511
|
}
|
|
@@ -2109,7 +2109,7 @@ exports.PlayoutPathResolution = /*#__PURE__*/function () {
|
|
|
2109
2109
|
* Retrieve available playout offerings for the specified content
|
|
2110
2110
|
*
|
|
2111
2111
|
* @methodGroup Media
|
|
2112
|
-
* @param {string=} objectId -
|
|
2112
|
+
* @param {string=} objectId - ID of the content
|
|
2113
2113
|
* @param {string=} versionHash - Version hash of the content
|
|
2114
2114
|
* @param {string=} writeToken - Write token for the content
|
|
2115
2115
|
* @param {string=} linkPath - If playing from a link, the path to the link
|
|
@@ -282,7 +282,7 @@ exports.SetPermission = /*#__PURE__*/function () {
|
|
|
282
282
|
*/
|
|
283
283
|
exports.CreateContentType = /*#__PURE__*/function () {
|
|
284
284
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
|
|
285
|
-
var name, _ref6$metadata, metadata, bitcode, _yield$this$authClien, contractAddress, objectId, path, rawCreateResponse, nodeUrl, createResponse, uploadResponse;
|
|
285
|
+
var name, _ref6$metadata, metadata, bitcode, _yield$this$authClien, contractAddress, objectId, path, rawCreateResponse, nodeUrl, createResponse, uploadResponse, tenantContractId;
|
|
286
286
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
287
287
|
while (1) switch (_context4.prev = _context4.next) {
|
|
288
288
|
case 0:
|
|
@@ -377,8 +377,24 @@ exports.CreateContentType = /*#__PURE__*/function () {
|
|
|
377
377
|
commitMessage: "Create content type"
|
|
378
378
|
});
|
|
379
379
|
case 37:
|
|
380
|
+
_context4.next = 39;
|
|
381
|
+
return this.userProfileClient.TenantContractId();
|
|
382
|
+
case 39:
|
|
383
|
+
tenantContractId = _context4.sent;
|
|
384
|
+
if (!tenantContractId) {
|
|
385
|
+
_context4.next = 44;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
_context4.next = 43;
|
|
389
|
+
return this.SetTenantContractId({
|
|
390
|
+
contractAddress: contractAddress,
|
|
391
|
+
tenantContractId: tenantContractId
|
|
392
|
+
});
|
|
393
|
+
case 43:
|
|
394
|
+
this.Log("tenant_contract_id set for ".concat(objectId));
|
|
395
|
+
case 44:
|
|
380
396
|
return _context4.abrupt("return", objectId);
|
|
381
|
-
case
|
|
397
|
+
case 45:
|
|
382
398
|
case "end":
|
|
383
399
|
return _context4.stop();
|
|
384
400
|
}
|
|
@@ -414,11 +430,11 @@ exports.CreateContentType = /*#__PURE__*/function () {
|
|
|
414
430
|
*/
|
|
415
431
|
exports.CreateContentLibrary = /*#__PURE__*/function () {
|
|
416
432
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
|
|
417
|
-
var name, description, image, imageName, _ref8$metadata, metadata, kmsId,
|
|
433
|
+
var name, description, image, imageName, _ref8$metadata, metadata, kmsId, tenantContractId, _yield$this$authClien2, contractAddress, libraryId, objectId, editResponse;
|
|
418
434
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
419
435
|
while (1) switch (_context5.prev = _context5.next) {
|
|
420
436
|
case 0:
|
|
421
|
-
name = _ref8.name, description = _ref8.description, image = _ref8.image, imageName = _ref8.imageName, _ref8$metadata = _ref8.metadata, metadata = _ref8$metadata === void 0 ? {} : _ref8$metadata, kmsId = _ref8.kmsId,
|
|
437
|
+
name = _ref8.name, description = _ref8.description, image = _ref8.image, imageName = _ref8.imageName, _ref8$metadata = _ref8.metadata, metadata = _ref8$metadata === void 0 ? {} : _ref8$metadata, kmsId = _ref8.kmsId, tenantContractId = _ref8.tenantContractId;
|
|
422
438
|
if (kmsId) {
|
|
423
439
|
_context5.next = 9;
|
|
424
440
|
break;
|
|
@@ -441,32 +457,6 @@ exports.CreateContentLibrary = /*#__PURE__*/function () {
|
|
|
441
457
|
case 13:
|
|
442
458
|
_yield$this$authClien2 = _context5.sent;
|
|
443
459
|
contractAddress = _yield$this$authClien2.contractAddress;
|
|
444
|
-
if (tenantId) {
|
|
445
|
-
_context5.next = 19;
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
_context5.next = 18;
|
|
449
|
-
return this.userProfileClient.TenantId();
|
|
450
|
-
case 18:
|
|
451
|
-
tenantId = _context5.sent;
|
|
452
|
-
case 19:
|
|
453
|
-
if (!tenantId) {
|
|
454
|
-
_context5.next = 24;
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
if (this.utils.ValidHash(tenantId)) {
|
|
458
|
-
_context5.next = 22;
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
throw Error("Invalid tenant ID: ".concat(tenantId));
|
|
462
|
-
case 22:
|
|
463
|
-
_context5.next = 24;
|
|
464
|
-
return this.CallContractMethod({
|
|
465
|
-
contractAddress: contractAddress,
|
|
466
|
-
methodName: "putMeta",
|
|
467
|
-
methodArgs: ["_tenantId", tenantId]
|
|
468
|
-
});
|
|
469
|
-
case 24:
|
|
470
460
|
metadata = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
471
461
|
name: name,
|
|
472
462
|
description: description,
|
|
@@ -481,43 +471,64 @@ exports.CreateContentLibrary = /*#__PURE__*/function () {
|
|
|
481
471
|
|
|
482
472
|
// Set library content object type and metadata on automatically created library object
|
|
483
473
|
objectId = libraryId.replace("ilib", "iq__");
|
|
484
|
-
_context5.next =
|
|
474
|
+
_context5.next = 22;
|
|
485
475
|
return this.EditContentObject({
|
|
486
476
|
libraryId: libraryId,
|
|
487
477
|
objectId: objectId
|
|
488
478
|
});
|
|
489
|
-
case
|
|
479
|
+
case 22:
|
|
490
480
|
editResponse = _context5.sent;
|
|
491
|
-
_context5.next =
|
|
481
|
+
_context5.next = 25;
|
|
492
482
|
return this.ReplaceMetadata({
|
|
493
483
|
libraryId: libraryId,
|
|
494
484
|
objectId: objectId,
|
|
495
485
|
metadata: metadata,
|
|
496
486
|
writeToken: editResponse.write_token
|
|
497
487
|
});
|
|
498
|
-
case
|
|
499
|
-
_context5.next =
|
|
488
|
+
case 25:
|
|
489
|
+
_context5.next = 27;
|
|
500
490
|
return this.FinalizeContentObject({
|
|
501
491
|
libraryId: libraryId,
|
|
502
492
|
objectId: objectId,
|
|
503
493
|
writeToken: editResponse.write_token,
|
|
504
494
|
commitMessage: "Create library"
|
|
505
495
|
});
|
|
506
|
-
case
|
|
496
|
+
case 27:
|
|
507
497
|
if (!image) {
|
|
508
|
-
_context5.next =
|
|
498
|
+
_context5.next = 30;
|
|
509
499
|
break;
|
|
510
500
|
}
|
|
511
|
-
_context5.next =
|
|
501
|
+
_context5.next = 30;
|
|
512
502
|
return this.SetContentLibraryImage({
|
|
513
503
|
libraryId: libraryId,
|
|
514
504
|
image: image,
|
|
515
505
|
imageName: imageName
|
|
516
506
|
});
|
|
517
|
-
case
|
|
507
|
+
case 30:
|
|
508
|
+
if (tenantContractId) {
|
|
509
|
+
_context5.next = 34;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
_context5.next = 33;
|
|
513
|
+
return this.userProfileClient.TenantContractId();
|
|
514
|
+
case 33:
|
|
515
|
+
tenantContractId = _context5.sent;
|
|
516
|
+
case 34:
|
|
517
|
+
if (!tenantContractId) {
|
|
518
|
+
_context5.next = 38;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
_context5.next = 37;
|
|
522
|
+
return this.SetTenantContractId({
|
|
523
|
+
contractAddress: contractAddress,
|
|
524
|
+
tenantContractId: tenantContractId
|
|
525
|
+
});
|
|
526
|
+
case 37:
|
|
527
|
+
this.Log("tenant_contract_id set for ".concat(contractAddress));
|
|
528
|
+
case 38:
|
|
518
529
|
this.Log("Library ".concat(libraryId, " created"));
|
|
519
530
|
return _context5.abrupt("return", libraryId);
|
|
520
|
-
case
|
|
531
|
+
case 40:
|
|
521
532
|
case "end":
|
|
522
533
|
return _context5.stop();
|
|
523
534
|
}
|
|
@@ -2540,4 +2551,53 @@ exports.SetAuthPolicy = /*#__PURE__*/function () {
|
|
|
2540
2551
|
return function (_x33) {
|
|
2541
2552
|
return _ref63.apply(this, arguments);
|
|
2542
2553
|
};
|
|
2554
|
+
}();
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* Delete the specified write token
|
|
2558
|
+
*
|
|
2559
|
+
* @methodGroup Content Objects
|
|
2560
|
+
*
|
|
2561
|
+
* @namedParams
|
|
2562
|
+
* @param {string} writeToken - Write token to delete
|
|
2563
|
+
* @param {string} libraryId - ID of the library
|
|
2564
|
+
*/
|
|
2565
|
+
exports.DeleteWriteToken = /*#__PURE__*/function () {
|
|
2566
|
+
var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(_ref64) {
|
|
2567
|
+
var writeToken, libraryId, path, authorizationHeader;
|
|
2568
|
+
return _regeneratorRuntime.wrap(function _callee35$(_context36) {
|
|
2569
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2570
|
+
case 0:
|
|
2571
|
+
writeToken = _ref64.writeToken, libraryId = _ref64.libraryId;
|
|
2572
|
+
ValidateWriteToken(writeToken);
|
|
2573
|
+
ValidateLibrary(libraryId);
|
|
2574
|
+
path = UrlJoin("qlibs", libraryId, "q", writeToken);
|
|
2575
|
+
_context36.next = 6;
|
|
2576
|
+
return this.authClient.AuthorizationHeader({
|
|
2577
|
+
libraryId: libraryId,
|
|
2578
|
+
update: true
|
|
2579
|
+
});
|
|
2580
|
+
case 6:
|
|
2581
|
+
authorizationHeader = _context36.sent;
|
|
2582
|
+
_context36.next = 9;
|
|
2583
|
+
return this.HttpClient.Request({
|
|
2584
|
+
headers: authorizationHeader,
|
|
2585
|
+
method: "DELETE",
|
|
2586
|
+
path: path,
|
|
2587
|
+
allowFailover: false
|
|
2588
|
+
});
|
|
2589
|
+
case 9:
|
|
2590
|
+
_context36.next = 11;
|
|
2591
|
+
return this.HttpClient.ClearWriteToken({
|
|
2592
|
+
writeToken: writeToken
|
|
2593
|
+
});
|
|
2594
|
+
case 11:
|
|
2595
|
+
case "end":
|
|
2596
|
+
return _context36.stop();
|
|
2597
|
+
}
|
|
2598
|
+
}, _callee35, this);
|
|
2599
|
+
}));
|
|
2600
|
+
return function (_x34) {
|
|
2601
|
+
return _ref65.apply(this, arguments);
|
|
2602
|
+
};
|
|
2543
2603
|
}();
|