@eluvio/elv-client-js 4.2.33 → 4.2.36
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 +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +41 -32
- package/dist/src/ElvClient.js +391 -285
- package/dist/src/EthClient.js +3 -2
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +59 -52
- package/dist/src/client/ABRPublishing.js +71 -60
- package/dist/src/client/ContentAccess.js +585 -207
- package/dist/src/client/ContentManagement.js +667 -67
- package/dist/src/client/Files.js +1400 -844
- package/dist/src/client/LiveConf.js +66 -45
- package/dist/src/client/LiveStream.js +1649 -1194
- package/package.json +1 -1
- package/src/HttpClient.js +9 -2
- package/src/client/ContentAccess.js +6 -2
- package/src/client/ContentManagement.js +7 -5
- package/src/client/LiveConf.js +19 -13
- package/src/client/LiveStream.js +66 -12
- package/testScripts/Test.js +2 -14
package/dist/src/EthClient.js
CHANGED
|
@@ -494,11 +494,11 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
494
494
|
key: "CallContractMethodAndWait",
|
|
495
495
|
value: function () {
|
|
496
496
|
var _CallContractMethodAndWait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
497
|
-
var contractAddress, abi, methodName, methodArgs, value, timeout, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
|
|
497
|
+
var contractAddress, abi, methodName, methodArgs, value, _ref10$overrides, overrides, timeout, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
|
|
498
498
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
499
499
|
while (1) switch (_context7.prev = _context7.next) {
|
|
500
500
|
case 0:
|
|
501
|
-
contractAddress = _ref10.contractAddress, abi = _ref10.abi, methodName = _ref10.methodName, methodArgs = _ref10.methodArgs, value = _ref10.value, timeout = _ref10.timeout, _ref10$formatArgument = _ref10.formatArguments, formatArguments = _ref10$formatArgument === void 0 ? true : _ref10$formatArgument, _ref10$cacheContract = _ref10.cacheContract, cacheContract = _ref10$cacheContract === void 0 ? true : _ref10$cacheContract, _ref10$overrideCached = _ref10.overrideCachedContract, overrideCachedContract = _ref10$overrideCached === void 0 ? false : _ref10$overrideCached;
|
|
501
|
+
contractAddress = _ref10.contractAddress, abi = _ref10.abi, methodName = _ref10.methodName, methodArgs = _ref10.methodArgs, value = _ref10.value, _ref10$overrides = _ref10.overrides, overrides = _ref10$overrides === void 0 ? {} : _ref10$overrides, timeout = _ref10.timeout, _ref10$formatArgument = _ref10.formatArguments, formatArguments = _ref10$formatArgument === void 0 ? true : _ref10$formatArgument, _ref10$cacheContract = _ref10.cacheContract, cacheContract = _ref10$cacheContract === void 0 ? true : _ref10$cacheContract, _ref10$overrideCached = _ref10.overrideCachedContract, overrideCachedContract = _ref10$overrideCached === void 0 ? false : _ref10$overrideCached;
|
|
502
502
|
timeout = timeout || this.timeout || 10000;
|
|
503
503
|
if (abi) {
|
|
504
504
|
_context7.next = 6;
|
|
@@ -524,6 +524,7 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
524
524
|
methodName: methodName,
|
|
525
525
|
methodArgs: methodArgs,
|
|
526
526
|
value: value,
|
|
527
|
+
overrides: overrides,
|
|
527
528
|
formatArguments: formatArguments,
|
|
528
529
|
cacheContract: cacheContract
|
|
529
530
|
});
|
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", "AuditContentObject", "AuditStream", "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", "CreateAuthorizationToken", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "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", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "OutputsCreate", "OutputsDelete", "OutputsDeleteBatch", "OutputsList", "OutputsListItem", "OutputsModify", "OutputsModifyBatch", "OutputsReset", "OutputsResolveSrtPullUrls", "OutputsState", "OutputsStop", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "StreamApplyProfile", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamApplyProfile", "StreamAssignProfile", "StreamConfig", "StreamConfigProfile", "StreamConfigProfiles", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamLinkToSite", "StreamListUrls", "StreamRemoveLinkToSite", "StreamRemoveWatermark", "StreamSaveConfigProfile", "StreamSetOfferingAndDRM", "StreamSiteSettings", "StreamStartRecording", "StreamStartOrStopOrReset", "StreamStatus", "StreamStopRecording", "StreamUnassignProfile", "StreamUpdateConfig", "SuspendNTPInstance", "TenantContractId", "TenantId", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UpdateShare", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrlLocal", "WriteTokenNodeUrlNetwork"];
|
|
452
|
+
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddContentObjectGroups", "AddContentObjectQueryFields", "AddContentObjectTags", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectGroups", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectQueryFields", "ContentObjectTags", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateAuthorizationToken", "CreateContentGroup", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreatePlainToken", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "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", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "OutputsCreate", "OutputsDelete", "OutputsDeleteBatch", "OutputsHop", "OutputsList", "OutputsListItem", "OutputsModify", "OutputsModifyBatch", "OutputsReset", "OutputsResolveSrtPullUrls", "OutputsState", "OutputsStop", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveContentObjectGroups", "RemoveContentObjectQueryFields", "RemoveContentObjectTags", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "StreamApplyProfile", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectGroups", "SetContentObjectImage", "SetContentObjectQueryFields", "SetContentObjectTags", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamApplyProfile", "StreamAssignProfile", "StreamConfig", "StreamConfigProfile", "StreamConfigProfiles", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamLinkToSite", "StreamListUrls", "StreamRemoveLinkToSite", "StreamRemoveWatermark", "StreamSaveConfigProfile", "StreamSetOfferingAndDRM", "StreamSiteSettings", "StreamRestartRecording", "StreamStartRecording", "StreamStartOrStopOrReset", "StreamStatus", "StreamStopRecording", "StreamUnassignProfile", "StreamUpdateConfig", "SuspendNTPInstance", "TenantContent", "TenantContractId", "TenantId", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UpdateShare", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrlLocal", "WriteTokenNodeUrlNetwork"];
|
|
453
453
|
}
|
|
454
454
|
}, {
|
|
455
455
|
key: "AllowedUserProfileMethods",
|
package/dist/src/HttpClient.js
CHANGED
|
@@ -71,63 +71,69 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
71
71
|
key: "Request",
|
|
72
72
|
value: function () {
|
|
73
73
|
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
74
|
-
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, uriIndex, baseURI, writeTokenMatch, writeToken, configUrl, uri, fetchParameters, response, responseType, errorBody, error;
|
|
74
|
+
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, uriIndex, nodeUrl, baseURI, writeTokenMatch, writeToken, configUrl, uri, fetchParameters, response, responseType, errorBody, error;
|
|
75
75
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
76
76
|
while (1) switch (_context.prev = _context.next) {
|
|
77
77
|
case 0:
|
|
78
|
-
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, uriIndex = _ref3.uriIndex;
|
|
79
|
-
baseURI = this.BaseURI(uriIndex);
|
|
78
|
+
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, uriIndex = _ref3.uriIndex, nodeUrl = _ref3.nodeUrl;
|
|
79
|
+
baseURI = this.BaseURI(uriIndex);
|
|
80
|
+
if (nodeUrl) {
|
|
81
|
+
baseURI = new URI(nodeUrl);
|
|
82
|
+
allowFailover = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// If URL contains a write token, it must go to the correct server and can not fail over
|
|
80
86
|
writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
|
|
81
87
|
writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
|
|
82
88
|
if (!writeToken) {
|
|
83
|
-
_context.next =
|
|
89
|
+
_context.next = 31;
|
|
84
90
|
break;
|
|
85
91
|
}
|
|
86
92
|
allowFailover = false;
|
|
87
93
|
if (!this.draftURIs[writeToken]) {
|
|
88
|
-
_context.next =
|
|
94
|
+
_context.next = 11;
|
|
89
95
|
break;
|
|
90
96
|
}
|
|
91
97
|
// Use saved write token URI
|
|
92
98
|
baseURI = this.draftURIs[writeToken];
|
|
93
|
-
_context.next =
|
|
99
|
+
_context.next = 30;
|
|
94
100
|
break;
|
|
95
|
-
case
|
|
101
|
+
case 11:
|
|
96
102
|
if (!this.networkName) {
|
|
97
|
-
_context.next =
|
|
103
|
+
_context.next = 29;
|
|
98
104
|
break;
|
|
99
105
|
}
|
|
100
|
-
_context.prev =
|
|
106
|
+
_context.prev = 12;
|
|
101
107
|
configUrl = new URL(NetworkUrls[this.networkName]);
|
|
102
108
|
configUrl.pathname = UrlJoin("/s", this.networkName, "nodes");
|
|
103
109
|
configUrl.searchParams.set("token", writeToken);
|
|
104
110
|
_context.t0 = URI;
|
|
105
|
-
_context.next =
|
|
111
|
+
_context.next = 19;
|
|
106
112
|
return fetch(configUrl);
|
|
107
|
-
case
|
|
108
|
-
_context.next =
|
|
113
|
+
case 19:
|
|
114
|
+
_context.next = 21;
|
|
109
115
|
return _context.sent.json();
|
|
110
|
-
case
|
|
116
|
+
case 21:
|
|
111
117
|
_context.t1 = _context.sent.nodes[0].services.fabric_api.urls[0];
|
|
112
118
|
baseURI = new _context.t0(_context.t1);
|
|
113
|
-
_context.next =
|
|
119
|
+
_context.next = 29;
|
|
114
120
|
break;
|
|
115
|
-
case
|
|
116
|
-
_context.prev =
|
|
117
|
-
_context.t2 = _context["catch"](
|
|
121
|
+
case 25:
|
|
122
|
+
_context.prev = 25;
|
|
123
|
+
_context.t2 = _context["catch"](12);
|
|
118
124
|
this.Log("Failed to retrieve write token node for " + writeToken);
|
|
119
125
|
this.Log(_context.t2);
|
|
120
|
-
case
|
|
126
|
+
case 29:
|
|
121
127
|
// Save current URI for all future requests involving this write token
|
|
122
128
|
this.draftURIs[writeToken] = baseURI;
|
|
123
|
-
case
|
|
129
|
+
case 30:
|
|
124
130
|
// If write token is present in headers, we may get redirected even if we try and use the right node.
|
|
125
131
|
// When a network request is redirected, the authorization header is dropped, which will cause issues.
|
|
126
132
|
// Ensure it is present in query params as well
|
|
127
133
|
if ((headers.Authorization || headers.authorization) && !queryParams.authorization) {
|
|
128
134
|
queryParams.authorization = headers.Authorization || headers.authorization;
|
|
129
135
|
}
|
|
130
|
-
case
|
|
136
|
+
case 31:
|
|
131
137
|
uri = baseURI.path(path).query(queryParams).hash("");
|
|
132
138
|
fetchParameters = {
|
|
133
139
|
method: method,
|
|
@@ -144,16 +150,16 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
144
150
|
this.Log("".concat(method, " - ").concat(uri.toString()));
|
|
145
151
|
this.Log("fetchParameters: ".concat(JSON.stringify(fetchParameters, null, 2)));
|
|
146
152
|
}
|
|
147
|
-
_context.prev =
|
|
148
|
-
_context.next =
|
|
153
|
+
_context.prev = 35;
|
|
154
|
+
_context.next = 38;
|
|
149
155
|
return HttpClient.Fetch(uri.toString(), fetchParameters);
|
|
150
|
-
case
|
|
156
|
+
case 38:
|
|
151
157
|
response = _context.sent;
|
|
152
|
-
_context.next =
|
|
158
|
+
_context.next = 44;
|
|
153
159
|
break;
|
|
154
|
-
case
|
|
155
|
-
_context.prev =
|
|
156
|
-
_context.t3 = _context["catch"](
|
|
160
|
+
case 41:
|
|
161
|
+
_context.prev = 41;
|
|
162
|
+
_context.t3 = _context["catch"](35);
|
|
157
163
|
response = {
|
|
158
164
|
ok: false,
|
|
159
165
|
status: _context.t3 && _context.t3.status || 500,
|
|
@@ -161,33 +167,33 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
161
167
|
url: uri.toString(),
|
|
162
168
|
error: _context.t3
|
|
163
169
|
};
|
|
164
|
-
case
|
|
170
|
+
case 44:
|
|
165
171
|
if (response.ok) {
|
|
166
|
-
_context.next =
|
|
172
|
+
_context.next = 73;
|
|
167
173
|
break;
|
|
168
174
|
}
|
|
169
175
|
if (!((parseInt(response.status) >= 500 || forceFailover) && allowRetry && attempts < this.retries)) {
|
|
170
|
-
_context.next =
|
|
176
|
+
_context.next = 57;
|
|
171
177
|
break;
|
|
172
178
|
}
|
|
173
179
|
if (!allowFailover) {
|
|
174
|
-
_context.next =
|
|
180
|
+
_context.next = 51;
|
|
175
181
|
break;
|
|
176
182
|
}
|
|
177
183
|
// Fail over to alternate node
|
|
178
184
|
this.uriIndex = (this.uriIndex + 1) % this.uris.length;
|
|
179
185
|
this.Log("HttpClient failing over from ".concat(baseURI.toString(), ": ").concat(attempts + 1, " attempts"), true);
|
|
180
|
-
_context.next =
|
|
186
|
+
_context.next = 54;
|
|
181
187
|
break;
|
|
182
|
-
case
|
|
188
|
+
case 51:
|
|
183
189
|
// Wait and retry
|
|
184
190
|
this.Log("HttpClient retrying request from ".concat(baseURI.toString(), ": ").concat(attempts + 1, " attempts"), true);
|
|
185
|
-
_context.next =
|
|
191
|
+
_context.next = 54;
|
|
186
192
|
return new Promise(function (resolve) {
|
|
187
193
|
return setTimeout(resolve, 1000);
|
|
188
194
|
});
|
|
189
|
-
case
|
|
190
|
-
_context.next =
|
|
195
|
+
case 54:
|
|
196
|
+
_context.next = 56;
|
|
191
197
|
return this.Request({
|
|
192
198
|
method: method,
|
|
193
199
|
path: path,
|
|
@@ -197,36 +203,37 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
197
203
|
headers: headers,
|
|
198
204
|
attempts: attempts + 1,
|
|
199
205
|
uriIndex: uriIndex,
|
|
200
|
-
forceFailover: forceFailover
|
|
206
|
+
forceFailover: forceFailover,
|
|
207
|
+
nodeUrl: nodeUrl
|
|
201
208
|
});
|
|
202
|
-
case 55:
|
|
203
|
-
return _context.abrupt("return", _context.sent);
|
|
204
209
|
case 56:
|
|
210
|
+
return _context.abrupt("return", _context.sent);
|
|
211
|
+
case 57:
|
|
205
212
|
// Parse JSON error if headers indicate JSON
|
|
206
213
|
responseType = response.headers ? response.headers.get("content-type") || "" : "";
|
|
207
214
|
errorBody = "";
|
|
208
215
|
if (!(response.text && response.json)) {
|
|
209
|
-
_context.next =
|
|
216
|
+
_context.next = 70;
|
|
210
217
|
break;
|
|
211
218
|
}
|
|
212
219
|
if (!responseType.includes("application/json")) {
|
|
213
|
-
_context.next =
|
|
220
|
+
_context.next = 66;
|
|
214
221
|
break;
|
|
215
222
|
}
|
|
216
|
-
_context.next =
|
|
223
|
+
_context.next = 63;
|
|
217
224
|
return response.json();
|
|
218
|
-
case
|
|
225
|
+
case 63:
|
|
219
226
|
_context.t4 = _context.sent;
|
|
220
|
-
_context.next =
|
|
227
|
+
_context.next = 69;
|
|
221
228
|
break;
|
|
222
|
-
case
|
|
223
|
-
_context.next =
|
|
229
|
+
case 66:
|
|
230
|
+
_context.next = 68;
|
|
224
231
|
return response.text();
|
|
225
|
-
case 67:
|
|
226
|
-
_context.t4 = _context.sent;
|
|
227
232
|
case 68:
|
|
228
|
-
|
|
233
|
+
_context.t4 = _context.sent;
|
|
229
234
|
case 69:
|
|
235
|
+
errorBody = _context.t4;
|
|
236
|
+
case 70:
|
|
230
237
|
error = {
|
|
231
238
|
name: "ElvHttpClientError",
|
|
232
239
|
status: response.status,
|
|
@@ -239,14 +246,14 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
239
246
|
};
|
|
240
247
|
if (this.debug) this.Log(JSON.stringify(error, null, 2), true);
|
|
241
248
|
throw error;
|
|
242
|
-
case
|
|
249
|
+
case 73:
|
|
243
250
|
this.Log("".concat(response.status, " - ").concat(method, " ").concat(uri.toString()));
|
|
244
251
|
return _context.abrupt("return", response);
|
|
245
|
-
case
|
|
252
|
+
case 75:
|
|
246
253
|
case "end":
|
|
247
254
|
return _context.stop();
|
|
248
255
|
}
|
|
249
|
-
}, _callee, this, [[
|
|
256
|
+
}, _callee, this, [[12, 25], [35, 41]]);
|
|
250
257
|
}));
|
|
251
258
|
function Request(_x) {
|
|
252
259
|
return _Request.apply(this, arguments);
|
|
@@ -84,6 +84,11 @@ var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
|
|
|
84
84
|
* - ...
|
|
85
85
|
* - ]
|
|
86
86
|
* -
|
|
87
|
+
* - For a presigned URL, `path` and `storage_endpoint` are not required and `cloud_credentials` should be:
|
|
88
|
+
* - {
|
|
89
|
+
* - signed_url: "YOUR_PRESIGNED_S3_URL"
|
|
90
|
+
* - }
|
|
91
|
+
* -
|
|
87
92
|
* - The simplest case is a one element array with .path_matchers == [".*"], in which case the same credentials will be used for all items in fileInfo
|
|
88
93
|
*
|
|
89
94
|
* @throws {Object} error - If the initialization of the master fails, error details can be found in error.body
|
|
@@ -91,7 +96,7 @@ var MezJobMainOfferingKey = function MezJobMainOfferingKey(abrMezOfferings) {
|
|
|
91
96
|
*/
|
|
92
97
|
exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
93
98
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
94
|
-
var libraryId, type, writeToken, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel, objectId, finalize, _yield$this$CreateCon, s3prefixRegex, i, oneFileInfo, matched, j, credentialSet, credentialSetBucket, matchers, k, matcher, fileSourcePath, s3prefixMatch, bucketName, _i, _credentialSet, region, bucket, accessKey, secret, _yield$this$CallBitco, logs, errors, warnings, additionalReturnVals;
|
|
99
|
+
var libraryId, type, writeToken, name, description, _ref$metadata, metadata, fileInfo, _ref$encrypt, encrypt, _ref$access, access, _ref$copy, copy, callback, _ref$respLogLevel, respLogLevel, _ref$structLogLevel, structLogLevel, objectId, finalize, _yield$this$CreateCon, s3prefixRegex, i, oneFileInfo, matched, j, credentialSet, remoteAccess, credentialSetBucket, matchers, k, matcher, fileSourcePath, s3prefixMatch, bucketName, _i, _credentialSet, _remoteAccess, cloudCredentials, region, bucket, accessKey, secret, signedUrl, _yield$this$CallBitco, logs, errors, warnings, mergeMetadata, additionalReturnVals;
|
|
95
100
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
96
101
|
while (1) switch (_context.prev = _context.next) {
|
|
97
102
|
case 0:
|
|
@@ -120,11 +125,11 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
120
125
|
writeToken = _yield$this$CreateCon.writeToken;
|
|
121
126
|
case 12:
|
|
122
127
|
if (!fileInfo) {
|
|
123
|
-
_context.next =
|
|
128
|
+
_context.next = 68;
|
|
124
129
|
break;
|
|
125
130
|
}
|
|
126
131
|
if (!(access.length > 0)) {
|
|
127
|
-
_context.next =
|
|
132
|
+
_context.next = 66;
|
|
128
133
|
break;
|
|
129
134
|
}
|
|
130
135
|
// S3 Upload
|
|
@@ -133,7 +138,7 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
133
138
|
i = 0;
|
|
134
139
|
case 16:
|
|
135
140
|
if (!(i < fileInfo.length)) {
|
|
136
|
-
_context.next =
|
|
141
|
+
_context.next = 48;
|
|
137
142
|
break;
|
|
138
143
|
}
|
|
139
144
|
oneFileInfo = fileInfo[i];
|
|
@@ -141,38 +146,39 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
141
146
|
j = 0;
|
|
142
147
|
case 20:
|
|
143
148
|
if (!(!matched && j < access.length)) {
|
|
144
|
-
_context.next =
|
|
149
|
+
_context.next = 43;
|
|
145
150
|
break;
|
|
146
151
|
}
|
|
147
|
-
credentialSet = access[j];
|
|
148
|
-
|
|
152
|
+
credentialSet = access[j];
|
|
153
|
+
remoteAccess = credentialSet.remote_access; // strip trailing slash to get bucket name for credential set
|
|
154
|
+
credentialSetBucket = remoteAccess.path ? remoteAccess.path.replace(/\/$/, "") : undefined;
|
|
149
155
|
matchers = credentialSet.path_matchers;
|
|
150
156
|
k = 0;
|
|
151
|
-
case
|
|
157
|
+
case 26:
|
|
152
158
|
if (!(!matched && k < matchers.length)) {
|
|
153
|
-
_context.next =
|
|
159
|
+
_context.next = 40;
|
|
154
160
|
break;
|
|
155
161
|
}
|
|
156
162
|
matcher = new RegExp(matchers[k]);
|
|
157
163
|
fileSourcePath = oneFileInfo.source;
|
|
158
164
|
if (!matcher.test(fileSourcePath)) {
|
|
159
|
-
_context.next =
|
|
165
|
+
_context.next = 37;
|
|
160
166
|
break;
|
|
161
167
|
}
|
|
162
168
|
matched = true;
|
|
163
169
|
// if full s3 path supplied, check bucket name
|
|
164
170
|
s3prefixMatch = s3prefixRegex.exec(fileSourcePath);
|
|
165
171
|
if (!s3prefixMatch) {
|
|
166
|
-
_context.next =
|
|
172
|
+
_context.next = 36;
|
|
167
173
|
break;
|
|
168
174
|
}
|
|
169
175
|
bucketName = s3prefixMatch[1];
|
|
170
|
-
if (!(bucketName !== credentialSetBucket)) {
|
|
171
|
-
_context.next =
|
|
176
|
+
if (!(credentialSetBucket && bucketName !== credentialSetBucket)) {
|
|
177
|
+
_context.next = 36;
|
|
172
178
|
break;
|
|
173
179
|
}
|
|
174
180
|
throw Error("Full S3 file path \"" + fileSourcePath + "\" matched to credential set with different bucket name '" + credentialSetBucket + "'");
|
|
175
|
-
case
|
|
181
|
+
case 36:
|
|
176
182
|
if (credentialSet.hasOwnProperty("matched")) {
|
|
177
183
|
credentialSet.matched.push(oneFileInfo);
|
|
178
184
|
} else {
|
|
@@ -180,41 +186,44 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
180
186
|
// initialize new 'matched' property to 1-element array
|
|
181
187
|
credentialSet.matched = [oneFileInfo];
|
|
182
188
|
}
|
|
183
|
-
case
|
|
189
|
+
case 37:
|
|
184
190
|
k++;
|
|
185
|
-
_context.next =
|
|
191
|
+
_context.next = 26;
|
|
186
192
|
break;
|
|
187
|
-
case
|
|
193
|
+
case 40:
|
|
188
194
|
j++;
|
|
189
195
|
_context.next = 20;
|
|
190
196
|
break;
|
|
191
|
-
case
|
|
197
|
+
case 43:
|
|
192
198
|
if (matched) {
|
|
193
|
-
_context.next =
|
|
199
|
+
_context.next = 45;
|
|
194
200
|
break;
|
|
195
201
|
}
|
|
196
|
-
throw Error("no credential set found for file path: \"" +
|
|
197
|
-
case
|
|
202
|
+
throw Error("no credential set found for file path: \"" + oneFileInfo.source + "\"");
|
|
203
|
+
case 45:
|
|
198
204
|
i++;
|
|
199
205
|
_context.next = 16;
|
|
200
206
|
break;
|
|
201
|
-
case 47:
|
|
202
|
-
_i = 0;
|
|
203
207
|
case 48:
|
|
208
|
+
_i = 0;
|
|
209
|
+
case 49:
|
|
204
210
|
if (!(_i < access.length)) {
|
|
205
|
-
_context.next =
|
|
211
|
+
_context.next = 64;
|
|
206
212
|
break;
|
|
207
213
|
}
|
|
208
214
|
_credentialSet = access[_i];
|
|
209
215
|
if (!(_credentialSet.hasOwnProperty("matched") && _credentialSet.matched.length > 0)) {
|
|
210
|
-
_context.next =
|
|
216
|
+
_context.next = 61;
|
|
211
217
|
break;
|
|
212
218
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
_remoteAccess = _credentialSet.remote_access;
|
|
220
|
+
cloudCredentials = _remoteAccess.cloud_credentials;
|
|
221
|
+
region = _remoteAccess.storage_endpoint && _remoteAccess.storage_endpoint.region;
|
|
222
|
+
bucket = _remoteAccess.path && _remoteAccess.path.replace(/\/$/, "");
|
|
223
|
+
accessKey = cloudCredentials.access_key_id;
|
|
224
|
+
secret = cloudCredentials.secret_access_key;
|
|
225
|
+
signedUrl = cloudCredentials.signed_url;
|
|
226
|
+
_context.next = 61;
|
|
218
227
|
return this.UploadFilesFromS3({
|
|
219
228
|
libraryId: libraryId,
|
|
220
229
|
objectId: objectId,
|
|
@@ -224,19 +233,20 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
224
233
|
bucket: bucket,
|
|
225
234
|
accessKey: accessKey,
|
|
226
235
|
secret: secret,
|
|
236
|
+
signedUrl: signedUrl,
|
|
227
237
|
copy: copy,
|
|
228
238
|
callback: callback,
|
|
229
239
|
encryption: encrypt ? "cgck" : "none"
|
|
230
240
|
});
|
|
231
|
-
case
|
|
241
|
+
case 61:
|
|
232
242
|
_i++;
|
|
233
|
-
_context.next =
|
|
243
|
+
_context.next = 49;
|
|
234
244
|
break;
|
|
235
|
-
case
|
|
236
|
-
_context.next =
|
|
245
|
+
case 64:
|
|
246
|
+
_context.next = 68;
|
|
237
247
|
break;
|
|
238
|
-
case
|
|
239
|
-
_context.next =
|
|
248
|
+
case 66:
|
|
249
|
+
_context.next = 68;
|
|
240
250
|
return this.UploadFiles({
|
|
241
251
|
libraryId: libraryId,
|
|
242
252
|
objectId: objectId,
|
|
@@ -245,16 +255,16 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
245
255
|
callback: callback,
|
|
246
256
|
encryption: encrypt ? "cgck" : "none"
|
|
247
257
|
});
|
|
248
|
-
case
|
|
249
|
-
_context.next =
|
|
258
|
+
case 68:
|
|
259
|
+
_context.next = 70;
|
|
250
260
|
return this.CreateEncryptionConk({
|
|
251
261
|
libraryId: libraryId,
|
|
252
262
|
objectId: objectId,
|
|
253
263
|
writeToken: writeToken,
|
|
254
264
|
createKMSConk: true
|
|
255
265
|
});
|
|
256
|
-
case
|
|
257
|
-
_context.next =
|
|
266
|
+
case 70:
|
|
267
|
+
_context.next = 72;
|
|
258
268
|
return this.CallBitcodeMethod({
|
|
259
269
|
libraryId: libraryId,
|
|
260
270
|
objectId: objectId,
|
|
@@ -269,33 +279,34 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
269
279
|
},
|
|
270
280
|
constant: false
|
|
271
281
|
});
|
|
272
|
-
case
|
|
282
|
+
case 72:
|
|
273
283
|
_yield$this$CallBitco = _context.sent;
|
|
274
284
|
logs = _yield$this$CallBitco.logs;
|
|
275
285
|
errors = _yield$this$CallBitco.errors;
|
|
276
286
|
warnings = _yield$this$CallBitco.warnings;
|
|
277
|
-
|
|
287
|
+
mergeMetadata = _objectSpread(_objectSpread({}, metadata || {}), {}, {
|
|
288
|
+
name: name !== undefined ? name : (metadata || {}).name,
|
|
289
|
+
description: description !== undefined ? description : (metadata || {}).description,
|
|
290
|
+
reference: access && !copy,
|
|
291
|
+
"public": _objectSpread(_objectSpread({}, (metadata || {})["public"] || {}), {}, {
|
|
292
|
+
name: name !== undefined ? name : ((metadata || {})["public"] || {}).name,
|
|
293
|
+
description: description !== undefined ? description : ((metadata || {})["public"] || {}).description
|
|
294
|
+
}),
|
|
295
|
+
elv_created_at: new Date().getTime()
|
|
296
|
+
});
|
|
297
|
+
_context.next = 79;
|
|
278
298
|
return this.MergeMetadata({
|
|
279
299
|
libraryId: libraryId,
|
|
280
300
|
objectId: objectId,
|
|
281
301
|
writeToken: writeToken,
|
|
282
|
-
metadata:
|
|
283
|
-
name: name,
|
|
284
|
-
description: description,
|
|
285
|
-
reference: access && !copy,
|
|
286
|
-
"public": _objectSpread(_objectSpread({}, (metadata || {})["public"] || {}), {}, {
|
|
287
|
-
name: name || "",
|
|
288
|
-
description: description || ""
|
|
289
|
-
}),
|
|
290
|
-
elv_created_at: new Date().getTime()
|
|
291
|
-
})
|
|
302
|
+
metadata: mergeMetadata
|
|
292
303
|
});
|
|
293
|
-
case
|
|
304
|
+
case 79:
|
|
294
305
|
if (!finalize) {
|
|
295
|
-
_context.next =
|
|
306
|
+
_context.next = 85;
|
|
296
307
|
break;
|
|
297
308
|
}
|
|
298
|
-
_context.next =
|
|
309
|
+
_context.next = 82;
|
|
299
310
|
return this.FinalizeContentObject({
|
|
300
311
|
libraryId: libraryId,
|
|
301
312
|
objectId: objectId,
|
|
@@ -303,24 +314,24 @@ exports.CreateProductionMaster = /*#__PURE__*/function () {
|
|
|
303
314
|
commitMessage: "Create master",
|
|
304
315
|
awaitCommitConfirmation: false
|
|
305
316
|
});
|
|
306
|
-
case
|
|
317
|
+
case 82:
|
|
307
318
|
additionalReturnVals = _context.sent;
|
|
308
|
-
_context.next =
|
|
319
|
+
_context.next = 86;
|
|
309
320
|
break;
|
|
310
|
-
case
|
|
321
|
+
case 85:
|
|
311
322
|
additionalReturnVals = {
|
|
312
323
|
write_token: writeToken,
|
|
313
324
|
type: type,
|
|
314
325
|
qlib_id: libraryId,
|
|
315
326
|
id: objectId
|
|
316
327
|
};
|
|
317
|
-
case
|
|
328
|
+
case 86:
|
|
318
329
|
return _context.abrupt("return", _objectSpread({
|
|
319
330
|
errors: errors || [],
|
|
320
331
|
logs: logs || [],
|
|
321
332
|
warnings: warnings || []
|
|
322
333
|
}, additionalReturnVals));
|
|
323
|
-
case
|
|
334
|
+
case 87:
|
|
324
335
|
case "end":
|
|
325
336
|
return _context.stop();
|
|
326
337
|
}
|