@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.
@@ -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
  });
@@ -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",
@@ -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); // If URL contains a write token, it must go to the correct server and can not fail over
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 = 30;
89
+ _context.next = 31;
84
90
  break;
85
91
  }
86
92
  allowFailover = false;
87
93
  if (!this.draftURIs[writeToken]) {
88
- _context.next = 10;
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 = 29;
99
+ _context.next = 30;
94
100
  break;
95
- case 10:
101
+ case 11:
96
102
  if (!this.networkName) {
97
- _context.next = 28;
103
+ _context.next = 29;
98
104
  break;
99
105
  }
100
- _context.prev = 11;
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 = 18;
111
+ _context.next = 19;
106
112
  return fetch(configUrl);
107
- case 18:
108
- _context.next = 20;
113
+ case 19:
114
+ _context.next = 21;
109
115
  return _context.sent.json();
110
- case 20:
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 = 28;
119
+ _context.next = 29;
114
120
  break;
115
- case 24:
116
- _context.prev = 24;
117
- _context.t2 = _context["catch"](11);
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 28:
126
+ case 29:
121
127
  // Save current URI for all future requests involving this write token
122
128
  this.draftURIs[writeToken] = baseURI;
123
- case 29:
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 30:
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 = 34;
148
- _context.next = 37;
153
+ _context.prev = 35;
154
+ _context.next = 38;
149
155
  return HttpClient.Fetch(uri.toString(), fetchParameters);
150
- case 37:
156
+ case 38:
151
157
  response = _context.sent;
152
- _context.next = 43;
158
+ _context.next = 44;
153
159
  break;
154
- case 40:
155
- _context.prev = 40;
156
- _context.t3 = _context["catch"](34);
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 43:
170
+ case 44:
165
171
  if (response.ok) {
166
- _context.next = 72;
172
+ _context.next = 73;
167
173
  break;
168
174
  }
169
175
  if (!((parseInt(response.status) >= 500 || forceFailover) && allowRetry && attempts < this.retries)) {
170
- _context.next = 56;
176
+ _context.next = 57;
171
177
  break;
172
178
  }
173
179
  if (!allowFailover) {
174
- _context.next = 50;
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 = 53;
186
+ _context.next = 54;
181
187
  break;
182
- case 50:
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 = 53;
191
+ _context.next = 54;
186
192
  return new Promise(function (resolve) {
187
193
  return setTimeout(resolve, 1000);
188
194
  });
189
- case 53:
190
- _context.next = 55;
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 = 69;
216
+ _context.next = 70;
210
217
  break;
211
218
  }
212
219
  if (!responseType.includes("application/json")) {
213
- _context.next = 65;
220
+ _context.next = 66;
214
221
  break;
215
222
  }
216
- _context.next = 62;
223
+ _context.next = 63;
217
224
  return response.json();
218
- case 62:
225
+ case 63:
219
226
  _context.t4 = _context.sent;
220
- _context.next = 68;
227
+ _context.next = 69;
221
228
  break;
222
- case 65:
223
- _context.next = 67;
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
- errorBody = _context.t4;
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 72:
249
+ case 73:
243
250
  this.Log("".concat(response.status, " - ").concat(method, " ").concat(uri.toString()));
244
251
  return _context.abrupt("return", response);
245
- case 74:
252
+ case 75:
246
253
  case "end":
247
254
  return _context.stop();
248
255
  }
249
- }, _callee, this, [[11, 24], [34, 40]]);
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 = 64;
128
+ _context.next = 68;
124
129
  break;
125
130
  }
126
131
  if (!(access.length > 0)) {
127
- _context.next = 62;
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 = 47;
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 = 42;
149
+ _context.next = 43;
145
150
  break;
146
151
  }
147
- credentialSet = access[j]; // strip trailing slash to get bucket name for credential set
148
- credentialSetBucket = credentialSet.remote_access.path.replace(/\/$/, "");
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 25:
157
+ case 26:
152
158
  if (!(!matched && k < matchers.length)) {
153
- _context.next = 39;
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 = 36;
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 = 35;
172
+ _context.next = 36;
167
173
  break;
168
174
  }
169
175
  bucketName = s3prefixMatch[1];
170
- if (!(bucketName !== credentialSetBucket)) {
171
- _context.next = 35;
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 35:
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 36:
189
+ case 37:
184
190
  k++;
185
- _context.next = 25;
191
+ _context.next = 26;
186
192
  break;
187
- case 39:
193
+ case 40:
188
194
  j++;
189
195
  _context.next = 20;
190
196
  break;
191
- case 42:
197
+ case 43:
192
198
  if (matched) {
193
- _context.next = 44;
199
+ _context.next = 45;
194
200
  break;
195
201
  }
196
- throw Error("no credential set found for file path: \"" + filePath + "\"");
197
- case 44:
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 = 60;
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 = 57;
216
+ _context.next = 61;
211
217
  break;
212
218
  }
213
- region = _credentialSet.remote_access.storage_endpoint.region;
214
- bucket = _credentialSet.remote_access.path.replace(/\/$/, "");
215
- accessKey = _credentialSet.remote_access.cloud_credentials.access_key_id;
216
- secret = _credentialSet.remote_access.cloud_credentials.secret_access_key;
217
- _context.next = 57;
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 57:
241
+ case 61:
232
242
  _i++;
233
- _context.next = 48;
243
+ _context.next = 49;
234
244
  break;
235
- case 60:
236
- _context.next = 64;
245
+ case 64:
246
+ _context.next = 68;
237
247
  break;
238
- case 62:
239
- _context.next = 64;
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 64:
249
- _context.next = 66;
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 66:
257
- _context.next = 68;
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 68:
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
- _context.next = 74;
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: _objectSpread(_objectSpread({}, 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 74:
304
+ case 79:
294
305
  if (!finalize) {
295
- _context.next = 80;
306
+ _context.next = 85;
296
307
  break;
297
308
  }
298
- _context.next = 77;
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 77:
317
+ case 82:
307
318
  additionalReturnVals = _context.sent;
308
- _context.next = 81;
319
+ _context.next = 86;
309
320
  break;
310
- case 80:
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 81:
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 82:
334
+ case 87:
324
335
  case "end":
325
336
  return _context.stop();
326
337
  }