@cubejs-client/core 0.29.43 → 0.29.53

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.
@@ -21,8 +21,8 @@ require('core-js/modules/es.array.is-array.js');
21
21
  require('core-js/modules/web.timers.js');
22
22
  require('core-js/modules/es.array.for-each.js');
23
23
  require('core-js/modules/web.dom-collections.for-each.js');
24
- require('core-js/modules/es.function.bind.js');
25
24
  require('core-js/modules/es.array.map.js');
25
+ require('core-js/modules/es.function.bind.js');
26
26
  var uuid = require('uuid');
27
27
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
28
28
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
@@ -1587,6 +1587,7 @@ var HttpTransport = /*#__PURE__*/function () {
1587
1587
  };
1588
1588
 
1589
1589
  return {
1590
+ /* eslint no-unsafe-finally: off */
1590
1591
  subscribe: function subscribe(callback) {
1591
1592
  var _this2 = this;
1592
1593
 
@@ -1596,21 +1597,29 @@ var HttpTransport = /*#__PURE__*/function () {
1596
1597
  while (1) {
1597
1598
  switch (_context.prev = _context.next) {
1598
1599
  case 0:
1599
- _context.next = 2;
1600
+ result = {
1601
+ error: 'network Error' // add default error message
1602
+
1603
+ };
1604
+ _context.prev = 1;
1605
+ _context.next = 4;
1600
1606
  return runRequest();
1601
1607
 
1602
- case 2:
1608
+ case 4:
1603
1609
  result = _context.sent;
1610
+
1611
+ case 5:
1612
+ _context.prev = 5;
1604
1613
  return _context.abrupt("return", callback(result, function () {
1605
1614
  return _this2.subscribe(callback);
1606
1615
  }));
1607
1616
 
1608
- case 4:
1617
+ case 8:
1609
1618
  case "end":
1610
1619
  return _context.stop();
1611
1620
  }
1612
1621
  }
1613
- }, _callee);
1622
+ }, _callee, null, [[1,, 5, 8]]);
1614
1623
  }))();
1615
1624
  }
1616
1625
  };
@@ -1629,13 +1638,14 @@ var RequestError = /*#__PURE__*/function (_Error) {
1629
1638
 
1630
1639
  var _super = _createSuper(RequestError);
1631
1640
 
1632
- function RequestError(message, response) {
1641
+ function RequestError(message, response, status) {
1633
1642
  var _this;
1634
1643
 
1635
1644
  _classCallCheck__default['default'](this, RequestError);
1636
1645
 
1637
1646
  _this = _super.call(this, message);
1638
1647
  _this.response = response;
1648
+ _this.status = status;
1639
1649
  return _this;
1640
1650
  }
1641
1651
 
@@ -1979,7 +1989,7 @@ var CubejsApi = /*#__PURE__*/function () {
1979
1989
  return requestInstance.unsubscribe();
1980
1990
 
1981
1991
  case 36:
1982
- error = new RequestError(body.error, body); // TODO error class
1992
+ error = new RequestError(body.error, body, response.status); // TODO error class
1983
1993
 
1984
1994
  if (!callback) {
1985
1995
  _context5.next = 41;
@@ -2189,7 +2199,11 @@ var CubejsApi = /*#__PURE__*/function () {
2189
2199
  key: "patchQueryInternal",
2190
2200
  value: function patchQueryInternal(query, responseFormat) {
2191
2201
  if (responseFormat === ResultType.COMPACT && query.responseFormat !== ResultType.COMPACT) {
2192
- query.responseFormat = ResultType.COMPACT;
2202
+ return _objectSpread(_objectSpread({}, query), {}, {
2203
+ responseFormat: ResultType.COMPACT
2204
+ });
2205
+ } else {
2206
+ return query;
2193
2207
  }
2194
2208
  }
2195
2209
  /**
@@ -2240,11 +2254,11 @@ var CubejsApi = /*#__PURE__*/function () {
2240
2254
 
2241
2255
  if (responseFormat === ResultType.COMPACT) {
2242
2256
  if (Array.isArray(query)) {
2243
- query.forEach(function (q) {
2244
- _this3.patchQueryInternal(q, ResultType.COMPACT);
2257
+ query = query.map(function (q) {
2258
+ return _this3.patchQueryInternal(q, ResultType.COMPACT);
2245
2259
  });
2246
2260
  } else {
2247
- this.patchQueryInternal(query, ResultType.COMPACT);
2261
+ query = this.patchQueryInternal(query, ResultType.COMPACT);
2248
2262
  }
2249
2263
  }
2250
2264
 
@@ -2275,11 +2289,11 @@ var CubejsApi = /*#__PURE__*/function () {
2275
2289
 
2276
2290
  if (responseFormat === ResultType.COMPACT) {
2277
2291
  if (Array.isArray(query)) {
2278
- query.forEach(function (q) {
2279
- _this4.patchQueryInternal(q, ResultType.COMPACT);
2292
+ query = query.map(function (q) {
2293
+ return _this4.patchQueryInternal(q, ResultType.COMPACT);
2280
2294
  });
2281
2295
  } else {
2282
- this.patchQueryInternal(query, ResultType.COMPACT);
2296
+ query = this.patchQueryInternal(query, ResultType.COMPACT);
2283
2297
  }
2284
2298
  }
2285
2299