@eluvio/elv-client-js 4.0.0 → 4.0.2

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.
@@ -87,7 +87,8 @@ var ElvClient = /*#__PURE__*/function () {
87
87
  * @param {number} fabricVersion - The version of the target content fabric
88
88
  * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
89
89
  * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
90
- * @param {Array<string>} ethereumURIs - A list of full URIs to auth service endpoints
90
+ * @param {Array<string>} authServiceURIs - A list of full URIs to auth service endpoints
91
+ * @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
91
92
  * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
92
93
  * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
93
94
  * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
@@ -104,6 +105,7 @@ var ElvClient = /*#__PURE__*/function () {
104
105
  fabricURIs = _ref.fabricURIs,
105
106
  ethereumURIs = _ref.ethereumURIs,
106
107
  authServiceURIs = _ref.authServiceURIs,
108
+ searchURIs = _ref.searchURIs,
107
109
  _ref$ethereumContract = _ref.ethereumContractTimeout,
108
110
  ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
109
111
  trustAuthorityId = _ref.trustAuthorityId,
@@ -128,6 +130,7 @@ var ElvClient = /*#__PURE__*/function () {
128
130
  this.fabricURIs = fabricURIs;
129
131
  this.authServiceURIs = authServiceURIs;
130
132
  this.ethereumURIs = ethereumURIs;
133
+ this.searchURIs = searchURIs;
131
134
  this.ethereumContractTimeout = ethereumContractTimeout;
132
135
  this.trustAuthorityId = trustAuthorityId;
133
136
  this.noCache = noCache;
@@ -364,7 +367,7 @@ var ElvClient = /*#__PURE__*/function () {
364
367
  key: "UseRegion",
365
368
  value: function () {
366
369
  var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
367
- var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs;
370
+ var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, searchURIs;
368
371
 
369
372
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
370
373
  while (1) {
@@ -391,19 +394,22 @@ var ElvClient = /*#__PURE__*/function () {
391
394
  fabricURIs = _yield$ElvClient$Conf.fabricURIs;
392
395
  ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
393
396
  authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
397
+ searchURIs = _yield$ElvClient$Conf.searchURIs;
394
398
  this.authServiceURIs = authServiceURIs;
395
399
  this.fabricURIs = fabricURIs;
396
400
  this.ethereumURIs = ethereumURIs;
401
+ this.searchURIs = searchURIs;
397
402
  this.HttpClient.uris = fabricURIs;
398
403
  this.HttpClient.uriIndex = 0;
399
404
  this.ethClient.ethereumURIs = ethereumURIs;
400
405
  this.ethClient.ethereumURIIndex = 0;
401
406
  return _context3.abrupt("return", {
402
407
  fabricURIs: fabricURIs,
403
- ethereumURIs: ethereumURIs
408
+ ethereumURIs: ethereumURIs,
409
+ searchURIs: searchURIs
404
410
  });
405
411
 
406
- case 17:
412
+ case 19:
407
413
  case "end":
408
414
  return _context3.stop();
409
415
  }
@@ -1715,7 +1721,7 @@ var ElvClient = /*#__PURE__*/function () {
1715
1721
  key: "Configuration",
1716
1722
  value: function () {
1717
1723
  var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
1718
- var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion;
1724
+ var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1719
1725
 
1720
1726
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1721
1727
  while (1) {
@@ -1759,6 +1765,7 @@ var ElvClient = /*#__PURE__*/function () {
1759
1765
  authServiceURIs = authServiceURIs.filter(filterHTTPS);
1760
1766
  }
1761
1767
 
1768
+ searchURIs = fabricInfo.network.services.search || [];
1762
1769
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1763
1770
  return _context21.abrupt("return", {
1764
1771
  nodeId: fabricInfo.node_id,
@@ -1769,11 +1776,12 @@ var ElvClient = /*#__PURE__*/function () {
1769
1776
  ethereumURIs: ethereumURIs,
1770
1777
  authServiceURIs: authServiceURIs,
1771
1778
  kmsURIs: kmsUrls,
1779
+ searchURIs: searchURIs,
1772
1780
  fabricVersion: fabricVersion
1773
1781
  });
1774
1782
 
1775
- case 19:
1776
- _context21.prev = 19;
1783
+ case 20:
1784
+ _context21.prev = 20;
1777
1785
  _context21.t0 = _context21["catch"](1);
1778
1786
  // eslint-disable-next-line no-console
1779
1787
  console.error("Error retrieving fabric configuration:"); // eslint-disable-next-line no-console
@@ -1781,12 +1789,12 @@ var ElvClient = /*#__PURE__*/function () {
1781
1789
  console.error(_context21.t0);
1782
1790
  throw _context21.t0;
1783
1791
 
1784
- case 24:
1792
+ case 25:
1785
1793
  case "end":
1786
1794
  return _context21.stop();
1787
1795
  }
1788
1796
  }
1789
- }, _callee21, null, [[1, 19]]);
1797
+ }, _callee21, null, [[1, 20]]);
1790
1798
  }));
1791
1799
 
1792
1800
  function Configuration(_x18) {
@@ -1881,7 +1889,7 @@ var ElvClient = /*#__PURE__*/function () {
1881
1889
  key: "FromConfigurationUrl",
1882
1890
  value: function () {
1883
1891
  var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref24) {
1884
- var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
1892
+ var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1885
1893
 
1886
1894
  return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1887
1895
  while (1) {
@@ -1902,6 +1910,7 @@ var ElvClient = /*#__PURE__*/function () {
1902
1910
  fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1903
1911
  ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1904
1912
  authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1913
+ searchURIs = _yield$ElvClient$Conf3.searchURIs;
1905
1914
  fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1906
1915
  client = new ElvClient({
1907
1916
  contentSpaceId: contentSpaceId,
@@ -1911,6 +1920,7 @@ var ElvClient = /*#__PURE__*/function () {
1911
1920
  fabricURIs: fabricURIs,
1912
1921
  ethereumURIs: ethereumURIs,
1913
1922
  authServiceURIs: authServiceURIs,
1923
+ searchURIs: searchURIs,
1914
1924
  ethereumContractTimeout: ethereumContractTimeout,
1915
1925
  trustAuthorityId: trustAuthorityId,
1916
1926
  staticToken: staticToken,
@@ -1921,7 +1931,7 @@ var ElvClient = /*#__PURE__*/function () {
1921
1931
  client.configUrl = configUrl;
1922
1932
  return _context23.abrupt("return", client);
1923
1933
 
1924
- case 14:
1934
+ case 15:
1925
1935
  case "end":
1926
1936
  return _context23.stop();
1927
1937
  }
@@ -36,8 +36,8 @@ var HttpClient = /*#__PURE__*/function () {
36
36
  }
37
37
  }, {
38
38
  key: "BaseURI",
39
- value: function BaseURI() {
40
- return new URI(this.uris[this.uriIndex]);
39
+ value: function BaseURI(url) {
40
+ return new URI(url || this.uris[this.uriIndex]);
41
41
  }
42
42
  }, {
43
43
  key: "RecordWriteToken",
@@ -65,14 +65,15 @@ var HttpClient = /*#__PURE__*/function () {
65
65
  key: "Request",
66
66
  value: function () {
67
67
  var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
68
- var method, path, _ref2$queryParams, queryParams, body, _ref2$bodyType, bodyType, _ref2$headers, headers, _ref2$attempts, attempts, _ref2$failover, failover, _ref2$forceFailover, forceFailover, baseURI, writeTokenMatch, writeToken, uri, fetchParameters, response, responseType, errorBody, error;
68
+ var method, path, _ref2$queryParams, queryParams, body, _ref2$bodyType, bodyType, _ref2$headers, headers, _ref2$attempts, attempts, _ref2$failover, failover, _ref2$forceFailover, forceFailover, nodeUrl, baseURI, writeTokenMatch, writeToken, uri, fetchParameters, response, responseType, errorBody, error;
69
69
 
70
70
  return _regeneratorRuntime.wrap(function _callee$(_context) {
71
71
  while (1) {
72
72
  switch (_context.prev = _context.next) {
73
73
  case 0:
74
- method = _ref2.method, path = _ref2.path, _ref2$queryParams = _ref2.queryParams, queryParams = _ref2$queryParams === void 0 ? {} : _ref2$queryParams, body = _ref2.body, _ref2$bodyType = _ref2.bodyType, bodyType = _ref2$bodyType === void 0 ? "JSON" : _ref2$bodyType, _ref2$headers = _ref2.headers, headers = _ref2$headers === void 0 ? {} : _ref2$headers, _ref2$attempts = _ref2.attempts, attempts = _ref2$attempts === void 0 ? 0 : _ref2$attempts, _ref2$failover = _ref2.failover, failover = _ref2$failover === void 0 ? true : _ref2$failover, _ref2$forceFailover = _ref2.forceFailover, forceFailover = _ref2$forceFailover === void 0 ? false : _ref2$forceFailover;
75
- baseURI = this.BaseURI(); // If URL contains a write token, it must go to the correct server and can not fail over
74
+ method = _ref2.method, path = _ref2.path, _ref2$queryParams = _ref2.queryParams, queryParams = _ref2$queryParams === void 0 ? {} : _ref2$queryParams, body = _ref2.body, _ref2$bodyType = _ref2.bodyType, bodyType = _ref2$bodyType === void 0 ? "JSON" : _ref2$bodyType, _ref2$headers = _ref2.headers, headers = _ref2$headers === void 0 ? {} : _ref2$headers, _ref2$attempts = _ref2.attempts, attempts = _ref2$attempts === void 0 ? 0 : _ref2$attempts, _ref2$failover = _ref2.failover, failover = _ref2$failover === void 0 ? true : _ref2$failover, _ref2$forceFailover = _ref2.forceFailover, forceFailover = _ref2$forceFailover === void 0 ? false : _ref2$forceFailover, nodeUrl = _ref2.nodeUrl;
75
+ // if nodeUrl passed in, restrict communication to that node only (unless previously recorded write token is found in next step)
76
+ baseURI = this.BaseURI(nodeUrl); // If URL contains a write token, it must go to the correct server and can not fail over
76
77
 
77
78
  writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
78
79
  writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
@@ -127,7 +128,7 @@ var HttpClient = /*#__PURE__*/function () {
127
128
  break;
128
129
  }
129
130
 
130
- if (!(!writeToken && (failover && parseInt(response.status) >= 500 || forceFailover) && attempts < this.uris.length)) {
131
+ if (!(!writeToken && !nodeUrl && (failover && parseInt(response.status) >= 500 || forceFailover) && attempts < this.uris.length)) {
131
132
  _context.next = 24;
132
133
  break;
133
134
  }
@@ -1428,6 +1428,7 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
1428
1428
  * @param {object=} options -
1429
1429
  * meta: New metadata for the object - will be merged into existing metadata if specified
1430
1430
  * type: New type for the object - Object ID, version hash or name of type
1431
+ * nodeUrl: Node URL to use in HTTP call
1431
1432
  *
1432
1433
  * @returns {Promise<object>} - Response containing the object ID and write token of the draft, as well as URL of node handling the draft
1433
1434
  */
@@ -1517,26 +1518,28 @@ exports.EditContentObject = /*#__PURE__*/function () {
1517
1518
  _context15.t1 = _context15.sent;
1518
1519
  _context15.t2 = path;
1519
1520
  _context15.t3 = options;
1520
- _context15.t4 = {
1521
+ _context15.t4 = options.nodeUrl;
1522
+ _context15.t5 = {
1521
1523
  headers: _context15.t1,
1522
1524
  method: "POST",
1523
1525
  path: _context15.t2,
1524
- body: _context15.t3
1526
+ body: _context15.t3,
1527
+ nodeUrl: _context15.t4
1525
1528
  };
1526
- _context15.next = 33;
1527
- return _context15.t0.Request.call(_context15.t0, _context15.t4);
1529
+ _context15.next = 34;
1530
+ return _context15.t0.Request.call(_context15.t0, _context15.t5);
1528
1531
 
1529
- case 33:
1532
+ case 34:
1530
1533
  rawEditResponse = _context15.sent;
1531
1534
  actualUrl = new URL(rawEditResponse.url);
1532
1535
  actualUrl.pathname = "";
1533
1536
  actualUrl.search = "";
1534
1537
  actualUrl.hash = "";
1535
1538
  nodeUrl = actualUrl.href;
1536
- _context15.next = 41;
1539
+ _context15.next = 42;
1537
1540
  return this.utils.ResponseToJson(rawEditResponse);
1538
1541
 
1539
- case 41:
1542
+ case 42:
1540
1543
  editResponse = _context15.sent;
1541
1544
  // Record the node used in creating this write token
1542
1545
  this.HttpClient.RecordWriteToken(editResponse.write_token, nodeUrl);
@@ -1545,7 +1548,7 @@ exports.EditContentObject = /*#__PURE__*/function () {
1545
1548
  editResponse.nodeUrl = nodeUrl;
1546
1549
  return _context15.abrupt("return", editResponse);
1547
1550
 
1548
- case 47:
1551
+ case 48:
1549
1552
  case "end":
1550
1553
  return _context15.stop();
1551
1554
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
package/src/ElvClient.js CHANGED
@@ -126,11 +126,13 @@ class ElvClient {
126
126
  *
127
127
  * @namedParams
128
128
  * @param {string} contentSpaceId - ID of the content space
129
- * @param {string} contentSpaceId - ID of the blockchain network
129
+ * @param {string} networkId - ID of the blockchain network
130
+ * @param {string} networkName - Name of the blockchain network
130
131
  * @param {number} fabricVersion - The version of the target content fabric
131
132
  * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
132
133
  * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
133
- * @param {Array<string>} ethereumURIs - A list of full URIs to auth service endpoints
134
+ * @param {Array<string>} authServiceURIs - A list of full URIs to auth service endpoints
135
+ * @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
134
136
  * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
135
137
  * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
136
138
  * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
@@ -147,6 +149,7 @@ class ElvClient {
147
149
  fabricURIs,
148
150
  ethereumURIs,
149
151
  authServiceURIs,
152
+ searchURIs,
150
153
  ethereumContractTimeout = 10,
151
154
  trustAuthorityId,
152
155
  staticToken,
@@ -169,6 +172,7 @@ class ElvClient {
169
172
  this.fabricURIs = fabricURIs;
170
173
  this.authServiceURIs = authServiceURIs;
171
174
  this.ethereumURIs = ethereumURIs;
175
+ this.searchURIs = searchURIs;
172
176
  this.ethereumContractTimeout = ethereumContractTimeout;
173
177
 
174
178
  this.trustAuthorityId = trustAuthorityId;
@@ -230,6 +234,8 @@ class ElvClient {
230
234
  authServiceURIs = authServiceURIs.filter(filterHTTPS);
231
235
  }
232
236
 
237
+ const searchURIs = fabricInfo.network.services.search || [];
238
+
233
239
  const fabricVersion = Math.max(...(fabricInfo.network.api_versions || [2]));
234
240
 
235
241
  return {
@@ -241,6 +247,7 @@ class ElvClient {
241
247
  ethereumURIs,
242
248
  authServiceURIs,
243
249
  kmsURIs: kmsUrls,
250
+ searchURIs,
244
251
  fabricVersion
245
252
  };
246
253
  } catch(error) {
@@ -326,6 +333,7 @@ class ElvClient {
326
333
  fabricURIs,
327
334
  ethereumURIs,
328
335
  authServiceURIs,
336
+ searchURIs,
329
337
  fabricVersion
330
338
  } = await ElvClient.Configuration({
331
339
  configUrl,
@@ -340,6 +348,7 @@ class ElvClient {
340
348
  fabricURIs,
341
349
  ethereumURIs,
342
350
  authServiceURIs,
351
+ searchURIs,
343
352
  ethereumContractTimeout,
344
353
  trustAuthorityId,
345
354
  staticToken,
@@ -421,7 +430,7 @@ class ElvClient {
421
430
  throw Error("Unable to change region: Configuration URL not set");
422
431
  }
423
432
 
424
- const {fabricURIs, ethereumURIs, authServiceURIs} = await ElvClient.Configuration({
433
+ const {fabricURIs, ethereumURIs, authServiceURIs, searchURIs} = await ElvClient.Configuration({
425
434
  configUrl: this.configUrl,
426
435
  region
427
436
  });
@@ -429,6 +438,7 @@ class ElvClient {
429
438
  this.authServiceURIs = authServiceURIs;
430
439
  this.fabricURIs = fabricURIs;
431
440
  this.ethereumURIs = ethereumURIs;
441
+ this.searchURIs = searchURIs;
432
442
 
433
443
  this.HttpClient.uris = fabricURIs;
434
444
  this.HttpClient.uriIndex = 0;
@@ -438,7 +448,8 @@ class ElvClient {
438
448
 
439
449
  return {
440
450
  fabricURIs,
441
- ethereumURIs
451
+ ethereumURIs,
452
+ searchURIs
442
453
  };
443
454
  }
444
455
 
@@ -481,17 +492,18 @@ class ElvClient {
481
492
  }
482
493
 
483
494
  /**
484
- * Retrieve the fabric and ethereum nodes currently used by the client, in preference order
495
+ * Retrieve the fabric, ethereum, auth service, and search nodes currently used by the client, in preference order
485
496
  *
486
497
  * @methodGroup Nodes
487
498
  *
488
- * @return {Promise<Object>} - An object containing the lists of fabric and ethereum urls in use by the client
499
+ * @return {Promise<Object>} - An object containing the lists of fabric, ethereum, auth service, and search urls in use by the client
489
500
  */
490
501
  Nodes() {
491
502
  return {
492
503
  fabricURIs: this.fabricURIs,
493
504
  ethereumURIs: this.ethereumURIs,
494
- authServiceURIs: this.authServiceURIs
505
+ authServiceURIs: this.authServiceURIs,
506
+ searchURIs: this.searchURIs
495
507
  };
496
508
  }
497
509
 
@@ -1044,6 +1056,18 @@ class ElvClient {
1044
1056
  );
1045
1057
  }
1046
1058
 
1059
+ /**
1060
+ * Record the write token with node url to the HttpClient
1061
+ *
1062
+ * @param {string} writeToken - Write token to be cached
1063
+ * @param {string=} nodeUrlStr - If provided, this node url
1064
+ * will be associated with the provided write token, which will
1065
+ * be used in subsequent HTTP calls
1066
+ */
1067
+ RecordWriteToken(writeToken, nodeUrlStr) {
1068
+ this.HttpClient.RecordWriteToken(writeToken, nodeUrlStr);
1069
+ }
1070
+
1047
1071
  /* FrameClient related */
1048
1072
 
1049
1073
  // Whitelist of methods allowed to be called using the frame API
@@ -416,6 +416,7 @@ class FrameClient {
416
416
  "PublicRep",
417
417
  "PublishContentVersion",
418
418
  "QParts",
419
+ "RecordWriteToken",
419
420
  "RedeemCode",
420
421
  "RemoveAccessGroupManager",
421
422
  "RemoveAccessGroupMember",
@@ -480,6 +481,6 @@ class FrameClient {
480
481
  }
481
482
 
482
483
  const { UploadFiles } = require("./client/Files");
483
- FrameClient.prototype.UploadFiles=UploadFiles;
484
+ FrameClient.prototype.UploadFiles = UploadFiles;
484
485
 
485
486
  exports.FrameClient = FrameClient;
package/src/HttpClient.js CHANGED
@@ -14,8 +14,8 @@ class HttpClient {
14
14
  this.draftURIs = {};
15
15
  }
16
16
 
17
- BaseURI() {
18
- return new URI(this.uris[this.uriIndex]);
17
+ BaseURI(url) {
18
+ return new URI(url || this.uris[this.uriIndex]);
19
19
  }
20
20
 
21
21
  static Fetch(url, params={}) {
@@ -49,9 +49,11 @@ class HttpClient {
49
49
  headers={},
50
50
  attempts=0,
51
51
  failover=true,
52
- forceFailover=false
52
+ forceFailover=false,
53
+ nodeUrl
53
54
  }) {
54
- let baseURI = this.BaseURI();
55
+ // if nodeUrl passed in, restrict communication to that node only (unless previously recorded write token is found in next step)
56
+ let baseURI = this.BaseURI(nodeUrl);
55
57
 
56
58
  // If URL contains a write token, it must go to the correct server and can not fail over
57
59
  const writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
@@ -105,7 +107,7 @@ class HttpClient {
105
107
 
106
108
  if(!response.ok) {
107
109
  // Fail over if not a write token request, the response was a server error, and we haven't tried all available nodes
108
- if(!writeToken && ((failover && parseInt(response.status) >= 500) || forceFailover) && attempts < this.uris.length) {
110
+ if(!writeToken && !nodeUrl && ((failover && parseInt(response.status) >= 500) || forceFailover) && attempts < this.uris.length) {
109
111
  // Server error - Try next node
110
112
  this.Log(`HttpClient failing over from ${this.BaseURI()}: ${attempts + 1} attempts`, true);
111
113
  this.uriIndex = (this.uriIndex + 1) % this.uris.length;
@@ -749,6 +749,7 @@ exports.CreateNonOwnerCap = async function({objectId, libraryId, publicKey, writ
749
749
  * @param {object=} options -
750
750
  * meta: New metadata for the object - will be merged into existing metadata if specified
751
751
  * type: New type for the object - Object ID, version hash or name of type
752
+ * nodeUrl: Node URL to use in HTTP call
752
753
  *
753
754
  * @returns {Promise<object>} - Response containing the object ID and write token of the draft, as well as URL of node handling the draft
754
755
  */
@@ -778,7 +779,8 @@ exports.EditContentObject = async function({libraryId, objectId, options={}}) {
778
779
  headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
779
780
  method: "POST",
780
781
  path: path,
781
- body: options
782
+ body: options,
783
+ nodeUrl: options.nodeUrl
782
784
  });
783
785
 
784
786
  const actualUrl = new URL(rawEditResponse.url);
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },
@@ -660,17 +660,17 @@
660
660
  },
661
661
  {
662
662
  "bit_rate": 810000,
663
- "height": 360,
663
+ "height": 640,
664
664
  "media_type": "video",
665
665
  "pregenerate": false,
666
- "width": 640
666
+ "width": 360
667
667
  },
668
668
  {
669
669
  "bit_rate": 520000,
670
- "height": 360,
670
+ "height": 640,
671
671
  "media_type": "video",
672
672
  "pregenerate": false,
673
- "width": 640
673
+ "width": 360
674
674
  }
675
675
  ]
676
676
  },