@cubejs-client/core 1.3.1 → 1.3.3

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.
@@ -1658,13 +1658,15 @@ var HttpTransport = /*#__PURE__*/function () {
1658
1658
  method = _ref.method,
1659
1659
  _ref$headers = _ref.headers,
1660
1660
  headers = _ref$headers === void 0 ? {} : _ref$headers,
1661
- credentials = _ref.credentials;
1661
+ credentials = _ref.credentials,
1662
+ fetchTimeout = _ref.fetchTimeout;
1662
1663
  _classCallCheck__default['default'](this, HttpTransport);
1663
1664
  this.authorization = authorization;
1664
1665
  this.apiUrl = apiUrl;
1665
1666
  this.method = method;
1666
1667
  this.headers = headers;
1667
1668
  this.credentials = credentials;
1669
+ this.fetchTimeout = fetchTimeout;
1668
1670
  }
1669
1671
  _createClass__default['default'](HttpTransport, [{
1670
1672
  key: "request",
@@ -1695,7 +1697,8 @@ var HttpTransport = /*#__PURE__*/function () {
1695
1697
  'x-request-id': baseRequestId && "".concat(baseRequestId, "-span-").concat(spanCounter++)
1696
1698
  }, _this.headers),
1697
1699
  credentials: _this.credentials,
1698
- body: requestMethod === 'POST' ? JSON.stringify(params) : null
1700
+ body: requestMethod === 'POST' ? JSON.stringify(params) : null,
1701
+ signal: _this.fetchTimeout ? AbortSignal.timeout(_this.fetchTimeout) : undefined
1699
1702
  });
1700
1703
  };
1701
1704
  return {
@@ -1822,6 +1825,7 @@ var CubeApi = /*#__PURE__*/function () {
1822
1825
  this.pollInterval = options.pollInterval || 5;
1823
1826
  this.parseDateMeasures = options.parseDateMeasures;
1824
1827
  this.castNumerics = typeof options.castNumerics === 'boolean' ? options.castNumerics : false;
1828
+ this.networkErrorRetries = options.networkErrorRetries || 0;
1825
1829
  this.updateAuthorizationPromise = null;
1826
1830
  }
1827
1831
  _createClass__default['default'](CubeApi, [{
@@ -1885,6 +1889,7 @@ var CubeApi = /*#__PURE__*/function () {
1885
1889
  return _ref2.apply(this, arguments);
1886
1890
  };
1887
1891
  }();
1892
+ var networkRetries = this.networkErrorRetries;
1888
1893
  var loadImpl = /*#__PURE__*/function () {
1889
1894
  var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(response, next) {
1890
1895
  var requestInstance, subscribeNext, continueWait, body, text, error, result;
@@ -1976,7 +1981,7 @@ var CubeApi = /*#__PURE__*/function () {
1976
1981
  return _this.updateTransportAuthorization();
1977
1982
  case 8:
1978
1983
  skipAuthorizationUpdate = false;
1979
- if (!(response.status === 502)) {
1984
+ if (!(response.status === 502 || response.error && response.error.toLowerCase() === 'network error' && --networkRetries >= 0)) {
1980
1985
  _context5.next = 13;
1981
1986
  break;
1982
1987
  }