@cubejs-client/core 1.3.52 → 1.3.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.
@@ -2,61 +2,68 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _toArray = require('@babel/runtime/helpers/toArray');
5
6
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
7
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
7
8
  var _typeof = require('@babel/runtime/helpers/typeof');
8
9
  var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
9
10
  var _createClass = require('@babel/runtime/helpers/createClass');
10
11
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
12
+ var _awaitAsyncGenerator = require('@babel/runtime/helpers/awaitAsyncGenerator');
13
+ var _wrapAsyncGenerator = require('@babel/runtime/helpers/wrapAsyncGenerator');
11
14
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
12
- require('core-js/modules/es.array.for-each.js');
13
15
  require('core-js/modules/es.symbol.js');
16
+ require('core-js/modules/es.symbol.description.js');
17
+ require('core-js/modules/es.symbol.async-iterator.js');
18
+ require('core-js/modules/es.symbol.iterator.js');
19
+ require('core-js/modules/es.array.concat.js');
14
20
  require('core-js/modules/es.array.filter.js');
21
+ require('core-js/modules/es.array.for-each.js');
22
+ require('core-js/modules/es.array.from.js');
15
23
  require('core-js/modules/es.array.is-array.js');
16
- require('core-js/modules/es.object.define-properties.js');
17
- require('core-js/modules/es.object.define-property.js');
18
- require('core-js/modules/es.object.get-own-property-descriptor.js');
19
- require('core-js/modules/es.object.get-own-property-descriptors.js');
24
+ require('core-js/modules/es.array.iterator.js');
20
25
  require('core-js/modules/es.array.map.js');
21
26
  require('core-js/modules/es.array.reduce.js');
27
+ require('core-js/modules/es.array.slice.js');
28
+ require('core-js/modules/es.function.name.js');
29
+ require('core-js/modules/es.date.to-string.js');
22
30
  require('core-js/modules/es.number.constructor.js');
23
31
  require('core-js/modules/es.object.entries.js');
24
32
  require('core-js/modules/es.object.keys.js');
33
+ require('core-js/modules/es.object.define-properties.js');
34
+ require('core-js/modules/es.object.define-property.js');
35
+ require('core-js/modules/es.object.get-own-property-descriptor.js');
36
+ require('core-js/modules/es.object.get-own-property-descriptors.js');
25
37
  require('core-js/modules/es.object.to-string.js');
26
38
  require('core-js/modules/es.promise.js');
39
+ require('core-js/modules/es.regexp.exec.js');
40
+ require('core-js/modules/es.regexp.to-string.js');
41
+ require('core-js/modules/es.string.iterator.js');
42
+ require('core-js/modules/es.string.trim.js');
27
43
  require('core-js/modules/web.dom-collections.for-each.js');
44
+ require('core-js/modules/web.dom-collections.iterator.js');
28
45
  require('core-js/modules/web.timers.js');
29
46
  var uuid = require('uuid');
30
47
  require('@babel/runtime/helpers/readOnlyError');
31
48
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
32
49
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
33
- require('core-js/modules/es.array.concat.js');
34
50
  require('core-js/modules/es.array.find.js');
35
- require('core-js/modules/es.array.from.js');
36
51
  require('core-js/modules/es.array.includes.js');
37
52
  require('core-js/modules/es.array.index-of.js');
38
- require('core-js/modules/es.array.iterator.js');
39
53
  require('core-js/modules/es.array.join.js');
40
- require('core-js/modules/es.date.to-string.js');
41
54
  require('core-js/modules/es.map.js');
42
55
  require('core-js/modules/es.number.is-nan.js');
43
56
  require('core-js/modules/es.number.parse-float.js');
44
57
  require('core-js/modules/es.object.values.js');
45
- require('core-js/modules/es.regexp.exec.js');
46
- require('core-js/modules/es.regexp.to-string.js');
47
58
  require('core-js/modules/es.set.js');
48
59
  require('core-js/modules/es.string.includes.js');
49
- require('core-js/modules/es.string.iterator.js');
50
60
  require('core-js/modules/es.string.match.js');
51
- require('core-js/modules/es.string.trim.js');
52
- require('core-js/modules/web.dom-collections.iterator.js');
53
61
  var dayjs = require('dayjs');
54
62
  var ramda = require('ramda');
55
63
  require('core-js/modules/es.array.every.js');
56
64
  require('core-js/modules/es.array.flat-map.js');
57
65
  require('core-js/modules/es.array.splice.js');
58
66
  require('core-js/modules/es.array.unscopables.flat-map.js');
59
- require('core-js/modules/es.array.slice.js');
60
67
  require('core-js/modules/es.parse-int.js');
61
68
  require('core-js/modules/es.string.ends-with.js');
62
69
  require('core-js/modules/es.string.split.js');
@@ -65,11 +72,37 @@ var duration = require('dayjs/plugin/duration');
65
72
  var isoWeek = require('dayjs/plugin/isoWeek');
66
73
  var en = require('dayjs/locale/en');
67
74
  require('core-js/modules/es.array.sort.js');
68
- require('core-js/modules/es.function.name.js');
69
75
  require('core-js/modules/es.date.to-json.js');
70
76
  require('core-js/modules/web.url-search-params.js');
71
77
  var fetch = require('cross-fetch');
72
78
  require('url-search-params-polyfill');
79
+ require('core-js/modules/es.array-buffer.constructor.js');
80
+ require('core-js/modules/es.array-buffer.slice.js');
81
+ require('core-js/modules/es.data-view.js');
82
+ require('core-js/modules/es.typed-array.uint8-array.js');
83
+ require('core-js/modules/es.typed-array.copy-within.js');
84
+ require('core-js/modules/es.typed-array.every.js');
85
+ require('core-js/modules/es.typed-array.fill.js');
86
+ require('core-js/modules/es.typed-array.filter.js');
87
+ require('core-js/modules/es.typed-array.find.js');
88
+ require('core-js/modules/es.typed-array.find-index.js');
89
+ require('core-js/modules/es.typed-array.for-each.js');
90
+ require('core-js/modules/es.typed-array.includes.js');
91
+ require('core-js/modules/es.typed-array.index-of.js');
92
+ require('core-js/modules/es.typed-array.iterator.js');
93
+ require('core-js/modules/es.typed-array.join.js');
94
+ require('core-js/modules/es.typed-array.last-index-of.js');
95
+ require('core-js/modules/es.typed-array.map.js');
96
+ require('core-js/modules/es.typed-array.reduce.js');
97
+ require('core-js/modules/es.typed-array.reduce-right.js');
98
+ require('core-js/modules/es.typed-array.reverse.js');
99
+ require('core-js/modules/es.typed-array.set.js');
100
+ require('core-js/modules/es.typed-array.slice.js');
101
+ require('core-js/modules/es.typed-array.some.js');
102
+ require('core-js/modules/es.typed-array.sort.js');
103
+ require('core-js/modules/es.typed-array.subarray.js');
104
+ require('core-js/modules/es.typed-array.to-locale-string.js');
105
+ require('core-js/modules/es.typed-array.to-string.js');
73
106
  require('core-js/modules/es.reflect.construct.js');
74
107
  var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
75
108
  var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
@@ -78,12 +111,15 @@ var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
78
111
 
79
112
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
80
113
 
114
+ var _toArray__default = /*#__PURE__*/_interopDefaultLegacy(_toArray);
81
115
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
82
116
  var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
83
117
  var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
84
118
  var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
85
119
  var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
86
120
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
121
+ var _awaitAsyncGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_awaitAsyncGenerator);
122
+ var _wrapAsyncGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_wrapAsyncGenerator);
87
123
  var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
88
124
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
89
125
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
@@ -2130,7 +2166,129 @@ var ProgressResult = /*#__PURE__*/function () {
2130
2166
  }]);
2131
2167
  }();
2132
2168
 
2133
- var _excluded = ["baseRequestId", "signal"];
2169
+ function _asyncIterator$1(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator$1(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
2170
+ function AsyncFromSyncIterator$1(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator$1 = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator$1.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator$1(r); }
2171
+ function responseChunks(_x) {
2172
+ return _responseChunks.apply(this, arguments);
2173
+ }
2174
+ function _responseChunks() {
2175
+ _responseChunks = _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(res) {
2176
+ var body, reader, _yield$_awaitAsyncGen, done, value, _reader$releaseLock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
2177
+ return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
2178
+ while (1) switch (_context.prev = _context.next) {
2179
+ case 0:
2180
+ // eslint-disable-next-line prefer-destructuring
2181
+ body = res.body;
2182
+ if (!(body && typeof body.getReader === 'function')) {
2183
+ _context.next = 21;
2184
+ break;
2185
+ }
2186
+ reader = body.getReader(); // Browser / Node native fetch
2187
+ _context.prev = 3;
2188
+ case 4:
2189
+ _context.next = 7;
2190
+ return _awaitAsyncGenerator__default['default'](reader.read());
2191
+ case 7:
2192
+ _yield$_awaitAsyncGen = _context.sent;
2193
+ done = _yield$_awaitAsyncGen.done;
2194
+ value = _yield$_awaitAsyncGen.value;
2195
+ if (!done) {
2196
+ _context.next = 12;
2197
+ break;
2198
+ }
2199
+ return _context.abrupt("break", 17);
2200
+ case 12:
2201
+ if (!value) {
2202
+ _context.next = 15;
2203
+ break;
2204
+ }
2205
+ _context.next = 15;
2206
+ return value;
2207
+ case 15:
2208
+ _context.next = 4;
2209
+ break;
2210
+ case 17:
2211
+ _context.prev = 17;
2212
+ (_reader$releaseLock = reader.releaseLock) === null || _reader$releaseLock === void 0 || _reader$releaseLock.call(reader);
2213
+ return _context.finish(17);
2214
+ case 20:
2215
+ return _context.abrupt("return");
2216
+ case 21:
2217
+ if (!(body && Symbol.asyncIterator in body)) {
2218
+ _context.next = 57;
2219
+ break;
2220
+ }
2221
+ _iteratorAbruptCompletion = false;
2222
+ _didIteratorError = false;
2223
+ _context.prev = 24;
2224
+ _iterator = _asyncIterator$1(body);
2225
+ case 26:
2226
+ _context.next = 28;
2227
+ return _awaitAsyncGenerator__default['default'](_iterator.next());
2228
+ case 28:
2229
+ if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
2230
+ _context.next = 40;
2231
+ break;
2232
+ }
2233
+ chunk = _step.value;
2234
+ if (!(typeof chunk === 'string')) {
2235
+ _context.next = 35;
2236
+ break;
2237
+ }
2238
+ _context.next = 33;
2239
+ return new TextEncoder().encode(chunk);
2240
+ case 33:
2241
+ _context.next = 37;
2242
+ break;
2243
+ case 35:
2244
+ _context.next = 37;
2245
+ return new Uint8Array(chunk);
2246
+ case 37:
2247
+ _iteratorAbruptCompletion = false;
2248
+ _context.next = 26;
2249
+ break;
2250
+ case 40:
2251
+ _context.next = 46;
2252
+ break;
2253
+ case 42:
2254
+ _context.prev = 42;
2255
+ _context.t0 = _context["catch"](24);
2256
+ _didIteratorError = true;
2257
+ _iteratorError = _context.t0;
2258
+ case 46:
2259
+ _context.prev = 46;
2260
+ _context.prev = 47;
2261
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
2262
+ _context.next = 51;
2263
+ break;
2264
+ }
2265
+ _context.next = 51;
2266
+ return _awaitAsyncGenerator__default['default'](_iterator["return"]());
2267
+ case 51:
2268
+ _context.prev = 51;
2269
+ if (!_didIteratorError) {
2270
+ _context.next = 54;
2271
+ break;
2272
+ }
2273
+ throw _iteratorError;
2274
+ case 54:
2275
+ return _context.finish(51);
2276
+ case 55:
2277
+ return _context.finish(46);
2278
+ case 56:
2279
+ return _context.abrupt("return");
2280
+ case 57:
2281
+ throw new Error('Unsupported response body type for streaming');
2282
+ case 58:
2283
+ case "end":
2284
+ return _context.stop();
2285
+ }
2286
+ }, _callee, null, [[3,, 17, 20], [24, 42, 46, 56], [47,, 51, 55]]);
2287
+ }));
2288
+ return _responseChunks.apply(this, arguments);
2289
+ }
2290
+
2291
+ var _excluded = ["method", "fetchTimeout", "baseRequestId", "signal"];
2134
2292
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2135
2293
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty__default['default'](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2136
2294
  /**
@@ -2164,9 +2322,12 @@ var HttpTransport = /*#__PURE__*/function () {
2164
2322
  }
2165
2323
  return _createClass__default['default'](HttpTransport, [{
2166
2324
  key: "request",
2167
- value: function request(method, _ref2) {
2168
- var _this = this;
2169
- var baseRequestId = _ref2.baseRequestId,
2325
+ value: function request(apiMethod, _ref2) {
2326
+ var _ref4,
2327
+ _this = this;
2328
+ var method = _ref2.method,
2329
+ fetchTimeout = _ref2.fetchTimeout,
2330
+ baseRequestId = _ref2.baseRequestId,
2170
2331
  signal = _ref2.signal,
2171
2332
  params = _objectWithoutProperties__default['default'](_ref2, _excluded);
2172
2333
  var spanCounter = 1;
@@ -2175,12 +2336,14 @@ var HttpTransport = /*#__PURE__*/function () {
2175
2336
  }).reduce(function (a, b) {
2176
2337
  return _objectSpread$1(_objectSpread$1({}, a), b);
2177
2338
  }, {}));
2178
- var url = "".concat(this.apiUrl, "/").concat(method).concat(searchParams.toString().length ? "?".concat(searchParams) : '');
2179
- var requestMethod = this.method || (url.length < 2000 ? 'GET' : 'POST');
2339
+ var url = "".concat(this.apiUrl, "/").concat(apiMethod).concat(searchParams.toString().length ? "?".concat(searchParams) : '');
2340
+ var requestMethod = (_ref4 = method !== null && method !== void 0 ? method : this.method) !== null && _ref4 !== void 0 ? _ref4 : url.length < 2000 ? 'GET' : 'POST';
2180
2341
  if (requestMethod === 'POST') {
2181
- url = "".concat(this.apiUrl, "/").concat(method);
2342
+ url = "".concat(this.apiUrl, "/").concat(apiMethod);
2182
2343
  this.headers['Content-Type'] = 'application/json';
2183
2344
  }
2345
+ var effectiveFetchTimeout = fetchTimeout !== null && fetchTimeout !== void 0 ? fetchTimeout : this.fetchTimeout;
2346
+ var actualSignal = signal || this.signal || (effectiveFetchTimeout ? AbortSignal.timeout(effectiveFetchTimeout) : undefined);
2184
2347
 
2185
2348
  // Currently, all methods make GET requests. If a method makes a request with a body payload,
2186
2349
  // remember to add {'Content-Type': 'application/json'} to the header.
@@ -2193,14 +2356,14 @@ var HttpTransport = /*#__PURE__*/function () {
2193
2356
  }, _this.headers),
2194
2357
  credentials: _this.credentials,
2195
2358
  body: requestMethod === 'POST' ? JSON.stringify(params) : null,
2196
- signal: signal || _this.signal || (_this.fetchTimeout ? AbortSignal.timeout(_this.fetchTimeout) : undefined)
2359
+ signal: actualSignal
2197
2360
  });
2198
2361
  };
2199
2362
  return {
2200
2363
  /* eslint no-unsafe-finally: off */subscribe: function subscribe(callback) {
2201
2364
  var _this2 = this;
2202
2365
  return _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
2203
- var result, _result;
2366
+ var result, errorMessage, _actualSignal$reason, _result;
2204
2367
  return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
2205
2368
  while (1) switch (_context.prev = _context.next) {
2206
2369
  case 0:
@@ -2215,13 +2378,21 @@ var HttpTransport = /*#__PURE__*/function () {
2215
2378
  case 7:
2216
2379
  _context.prev = 7;
2217
2380
  _context.t0 = _context["catch"](0);
2381
+ errorMessage = 'network Error';
2382
+ if (_context.t0.name === 'AbortError') {
2383
+ if ((actualSignal === null || actualSignal === void 0 ? void 0 : actualSignal.reason) === 'TimeoutError' || (actualSignal === null || actualSignal === void 0 || (_actualSignal$reason = actualSignal.reason) === null || _actualSignal$reason === void 0 ? void 0 : _actualSignal$reason.name) === 'TimeoutError') {
2384
+ errorMessage = 'timeout';
2385
+ } else {
2386
+ errorMessage = 'aborted';
2387
+ }
2388
+ }
2218
2389
  _result = {
2219
- error: 'network Error'
2390
+ error: errorMessage
2220
2391
  };
2221
2392
  return _context.abrupt("return", callback(_result, function () {
2222
2393
  return _this2.subscribe(callback);
2223
2394
  }));
2224
- case 11:
2395
+ case 13:
2225
2396
  case "end":
2226
2397
  return _context.stop();
2227
2398
  }
@@ -2230,6 +2401,110 @@ var HttpTransport = /*#__PURE__*/function () {
2230
2401
  }
2231
2402
  };
2232
2403
  }
2404
+ }, {
2405
+ key: "requestStream",
2406
+ value: function requestStream(apiMethod, _ref5) {
2407
+ var _ref6,
2408
+ _this3 = this;
2409
+ var method = _ref5.method,
2410
+ fetchTimeout = _ref5.fetchTimeout,
2411
+ baseRequestId = _ref5.baseRequestId,
2412
+ signal = _ref5.signal,
2413
+ params = _ref5.params;
2414
+ var processedParams = {};
2415
+
2416
+ // Handle the generic params object
2417
+ if (params) {
2418
+ Object.keys(params).forEach(function (k) {
2419
+ var value = params[k];
2420
+ if (value !== undefined) {
2421
+ processedParams[k] = _typeof__default['default'](value) === 'object' ? JSON.stringify(value) : String(value);
2422
+ }
2423
+ });
2424
+ }
2425
+ var searchParams = new URLSearchParams(processedParams);
2426
+ var url = "".concat(this.apiUrl, "/").concat(apiMethod).concat(searchParams.toString().length ? "?".concat(searchParams) : '');
2427
+ var requestMethod = (_ref6 = method !== null && method !== void 0 ? method : this.method) !== null && _ref6 !== void 0 ? _ref6 : 'POST';
2428
+ if (requestMethod === 'POST') {
2429
+ url = "".concat(this.apiUrl, "/").concat(apiMethod);
2430
+ this.headers['Content-Type'] = 'application/json';
2431
+ }
2432
+ var effectiveFetchTimeout = fetchTimeout !== null && fetchTimeout !== void 0 ? fetchTimeout : this.fetchTimeout;
2433
+ var controller;
2434
+ var actualSignal = signal || this.signal;
2435
+ if (!actualSignal && effectiveFetchTimeout) {
2436
+ controller = new AbortController();
2437
+ actualSignal = controller.signal;
2438
+ setTimeout(function () {
2439
+ var _controller;
2440
+ return (_controller = controller) === null || _controller === void 0 ? void 0 : _controller.abort();
2441
+ }, effectiveFetchTimeout);
2442
+ }
2443
+ return {
2444
+ stream: function () {
2445
+ var _stream = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
2446
+ var response;
2447
+ return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
2448
+ while (1) switch (_context2.prev = _context2.next) {
2449
+ case 0:
2450
+ _context2.next = 2;
2451
+ return fetch__default['default'](url, {
2452
+ method: requestMethod,
2453
+ headers: _objectSpread$1({
2454
+ Authorization: _this3.authorization,
2455
+ 'x-request-id': baseRequestId || 'stream-request'
2456
+ }, _this3.headers),
2457
+ credentials: _this3.credentials,
2458
+ body: requestMethod === 'POST' ? JSON.stringify(params || {}) : null,
2459
+ signal: actualSignal
2460
+ });
2461
+ case 2:
2462
+ response = _context2.sent;
2463
+ if (response.ok) {
2464
+ _context2.next = 5;
2465
+ break;
2466
+ }
2467
+ throw new Error("HTTP ".concat(response.status, ": ").concat(response.statusText));
2468
+ case 5:
2469
+ if (response.body) {
2470
+ _context2.next = 7;
2471
+ break;
2472
+ }
2473
+ throw new Error('No response body available for streaming');
2474
+ case 7:
2475
+ return _context2.abrupt("return", responseChunks(response));
2476
+ case 8:
2477
+ case "end":
2478
+ return _context2.stop();
2479
+ }
2480
+ }, _callee2);
2481
+ }));
2482
+ function stream() {
2483
+ return _stream.apply(this, arguments);
2484
+ }
2485
+ return stream;
2486
+ }(),
2487
+ unsubscribe: function () {
2488
+ var _unsubscribe = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
2489
+ return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
2490
+ while (1) switch (_context3.prev = _context3.next) {
2491
+ case 0:
2492
+ if (controller) {
2493
+ controller.abort();
2494
+ }
2495
+ case 1:
2496
+ case "end":
2497
+ return _context3.stop();
2498
+ }
2499
+ }, _callee3);
2500
+ }));
2501
+ function unsubscribe() {
2502
+ return _unsubscribe.apply(this, arguments);
2503
+ }
2504
+ return unsubscribe;
2505
+ }()
2506
+ };
2507
+ }
2233
2508
  }]);
2234
2509
  }();
2235
2510
 
@@ -2250,8 +2525,13 @@ var RequestError = /*#__PURE__*/function (_Error) {
2250
2525
  return _createClass__default['default'](RequestError);
2251
2526
  }(/*#__PURE__*/_wrapNativeSuper__default['default'](Error));
2252
2527
 
2528
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
2529
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2530
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2253
2531
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2254
2532
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default['default'](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2533
+ function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
2534
+ function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
2255
2535
 
2256
2536
  // If we can't infer any members at all, then return any.
2257
2537
 
@@ -2345,7 +2625,7 @@ var CubeApi = /*#__PURE__*/function () {
2345
2625
  }, {
2346
2626
  key: "loadMethod",
2347
2627
  value: function loadMethod(request, toResult, options, callback) {
2348
- var _this = this;
2628
+ var _this2 = this;
2349
2629
  var mutexValue = ++mutexCounter;
2350
2630
  if (typeof options === 'function' && !callback) {
2351
2631
  callback = options;
@@ -2426,7 +2706,7 @@ var CubeApi = /*#__PURE__*/function () {
2426
2706
  return new Promise(function (resolve) {
2427
2707
  return setTimeout(function () {
2428
2708
  return resolve();
2429
- }, _this.pollInterval * 1000);
2709
+ }, _this2.pollInterval * 1000);
2430
2710
  });
2431
2711
  case 7:
2432
2712
  return _context2.abrupt("return", next());
@@ -2462,7 +2742,7 @@ var CubeApi = /*#__PURE__*/function () {
2462
2742
  return new Promise(function (resolve) {
2463
2743
  return setTimeout(function () {
2464
2744
  return resolve();
2465
- }, _this.pollInterval * 1000);
2745
+ }, _this2.pollInterval * 1000);
2466
2746
  });
2467
2747
  case 5:
2468
2748
  return _context3.abrupt("return", next());
@@ -2483,7 +2763,7 @@ var CubeApi = /*#__PURE__*/function () {
2483
2763
  break;
2484
2764
  }
2485
2765
  _context4.next = 8;
2486
- return _this.updateTransportAuthorization();
2766
+ return _this2.updateTransportAuthorization();
2487
2767
  case 8:
2488
2768
  skipAuthorizationUpdate = false;
2489
2769
  if (!('status' in response && response.status === 502 || 'error' in response && ((_response$error = response.error) === null || _response$error === void 0 ? void 0 : _response$error.toLowerCase()) === 'network error' && --networkRetries >= 0)) {
@@ -2538,7 +2818,7 @@ var CubeApi = /*#__PURE__*/function () {
2538
2818
  _context4.next = 37;
2539
2819
  return requestInstance.unsubscribe();
2540
2820
  case 37:
2541
- _error = new RequestError(body.error || '', body, response.status);
2821
+ _error = new RequestError(body.error || response.error || '', body, response.status);
2542
2822
  if (!callback) {
2543
2823
  _context4.next = 42;
2544
2824
  break;
@@ -2626,7 +2906,7 @@ var CubeApi = /*#__PURE__*/function () {
2626
2906
  key: "updateTransportAuthorization",
2627
2907
  value: function () {
2628
2908
  var _updateTransportAuthorization = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
2629
- var _this2 = this;
2909
+ var _this3 = this;
2630
2910
  var tokenFetcher, promise;
2631
2911
  return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
2632
2912
  while (1) switch (_context7.prev = _context7.next) {
@@ -2655,12 +2935,12 @@ var CubeApi = /*#__PURE__*/function () {
2655
2935
  return tokenFetcher();
2656
2936
  case 3:
2657
2937
  token = _context6.sent;
2658
- if (_this2.transport.authorization !== token) {
2659
- _this2.transport.authorization = token;
2938
+ if (_this3.transport.authorization !== token) {
2939
+ _this3.transport.authorization = token;
2660
2940
  }
2661
2941
  case 5:
2662
2942
  _context6.prev = 5;
2663
- _this2.updateAuthorizationPromise = null;
2943
+ _this3.updateAuthorizationPromise = null;
2664
2944
  return _context6.finish(5);
2665
2945
  case 8:
2666
2946
  case "end":
@@ -2779,7 +3059,7 @@ var CubeApi = /*#__PURE__*/function () {
2779
3059
  * @param responseFormat
2780
3060
  */
2781
3061
  function load(query, options, callback) {
2782
- var _this3 = this;
3062
+ var _this4 = this;
2783
3063
  var responseFormat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'default';
2784
3064
  var _this$prepareQueryOpt = this.prepareQueryOptions(query, options, responseFormat);
2785
3065
  var _this$prepareQueryOpt2 = _slicedToArray__default['default'](_this$prepareQueryOpt, 2);
@@ -2787,19 +3067,19 @@ var CubeApi = /*#__PURE__*/function () {
2787
3067
  options = _this$prepareQueryOpt2[1];
2788
3068
  return this.loadMethod(function () {
2789
3069
  var _options6;
2790
- return _this3.request('load', {
3070
+ return _this4.request('load', {
2791
3071
  query: query,
2792
3072
  queryType: 'multi',
2793
3073
  signal: (_options6 = options) === null || _options6 === void 0 ? void 0 : _options6.signal
2794
3074
  });
2795
3075
  }, function (response) {
2796
- return _this3.loadResponseInternal(response, options);
3076
+ return _this4.loadResponseInternal(response, options);
2797
3077
  }, options, callback);
2798
3078
  }
2799
3079
  }, {
2800
3080
  key: "prepareQueryOptions",
2801
3081
  value: function prepareQueryOptions(query, options) {
2802
- var _this4 = this;
3082
+ var _this5 = this;
2803
3083
  var responseFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'default';
2804
3084
  options = _objectSpread({
2805
3085
  castNumerics: this.castNumerics
@@ -2807,7 +3087,7 @@ var CubeApi = /*#__PURE__*/function () {
2807
3087
  if (responseFormat === 'compact') {
2808
3088
  if (Array.isArray(query)) {
2809
3089
  var patched = query.map(function (q) {
2810
- return _this4.patchQueryInternal(q, 'compact');
3090
+ return _this5.patchQueryInternal(q, 'compact');
2811
3091
  });
2812
3092
  return [patched, options];
2813
3093
  } else {
@@ -2849,7 +3129,7 @@ var CubeApi = /*#__PURE__*/function () {
2849
3129
  }, {
2850
3130
  key: "subscribe",
2851
3131
  value: function subscribe(query, options, callback) {
2852
- var _this5 = this;
3132
+ var _this6 = this;
2853
3133
  var responseFormat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'default';
2854
3134
  var _this$prepareQueryOpt3 = this.prepareQueryOptions(query, options, responseFormat);
2855
3135
  var _this$prepareQueryOpt4 = _slicedToArray__default['default'](_this$prepareQueryOpt3, 2);
@@ -2857,13 +3137,13 @@ var CubeApi = /*#__PURE__*/function () {
2857
3137
  options = _this$prepareQueryOpt4[1];
2858
3138
  return this.loadMethod(function () {
2859
3139
  var _options7;
2860
- return _this5.request('subscribe', {
3140
+ return _this6.request('subscribe', {
2861
3141
  query: query,
2862
3142
  queryType: 'multi',
2863
3143
  signal: (_options7 = options) === null || _options7 === void 0 ? void 0 : _options7.signal
2864
3144
  });
2865
3145
  }, function (response) {
2866
- return _this5.loadResponseInternal(response, options);
3146
+ return _this6.loadResponseInternal(response, options);
2867
3147
  }, _objectSpread(_objectSpread({}, options), {}, {
2868
3148
  subscribe: true
2869
3149
  }), callback);
@@ -2875,9 +3155,9 @@ var CubeApi = /*#__PURE__*/function () {
2875
3155
  * Get generated SQL string for the given `query`.
2876
3156
  */
2877
3157
  function sql(query, options, callback) {
2878
- var _this6 = this;
3158
+ var _this7 = this;
2879
3159
  return this.loadMethod(function () {
2880
- return _this6.request('sql', {
3160
+ return _this7.request('sql', {
2881
3161
  query: query,
2882
3162
  signal: options === null || options === void 0 ? void 0 : options.signal
2883
3163
  });
@@ -2894,9 +3174,9 @@ var CubeApi = /*#__PURE__*/function () {
2894
3174
  * Get meta description of cubes available for querying.
2895
3175
  */
2896
3176
  function meta(options, callback) {
2897
- var _this7 = this;
3177
+ var _this8 = this;
2898
3178
  return this.loadMethod(function () {
2899
- return _this7.request('meta', {
3179
+ return _this8.request('meta', {
2900
3180
  signal: options === null || options === void 0 ? void 0 : options.signal
2901
3181
  });
2902
3182
  }, function (body) {
@@ -2910,9 +3190,9 @@ var CubeApi = /*#__PURE__*/function () {
2910
3190
  * Get query related meta without query execution
2911
3191
  */
2912
3192
  function dryRun(query, options, callback) {
2913
- var _this8 = this;
3193
+ var _this9 = this;
2914
3194
  return this.loadMethod(function () {
2915
- return _this8.request('dry-run', {
3195
+ return _this9.request('dry-run', {
2916
3196
  query: query,
2917
3197
  signal: options === null || options === void 0 ? void 0 : options.signal
2918
3198
  });
@@ -2920,6 +3200,300 @@ var CubeApi = /*#__PURE__*/function () {
2920
3200
  return response;
2921
3201
  }, options, callback);
2922
3202
  }
3203
+ }, {
3204
+ key: "cubeSql",
3205
+ value:
3206
+ /**
3207
+ * Execute a Cube SQL query against Cube SQL interface and return the results.
3208
+ */
3209
+ function cubeSql(sqlQuery, options, callback) {
3210
+ var _this10 = this;
3211
+ return this.loadMethod(function () {
3212
+ var request = _this10.request('cubesql', {
3213
+ query: sqlQuery,
3214
+ method: 'POST',
3215
+ signal: options === null || options === void 0 ? void 0 : options.signal,
3216
+ fetchTimeout: options === null || options === void 0 ? void 0 : options.timeout
3217
+ });
3218
+ return request;
3219
+ }, function (response) {
3220
+ // TODO: The response is sending both errors and successful results as `error`
3221
+ if (!response || !response.error) {
3222
+ throw new Error('Invalid response format');
3223
+ }
3224
+
3225
+ // Check if this is a timeout or abort error from transport
3226
+ if (response.error === 'timeout') {
3227
+ var timeoutMs = (options === null || options === void 0 ? void 0 : options.timeout) || 5 * 60 * 1000;
3228
+ throw new Error("CubeSQL query timed out after ".concat(timeoutMs, "ms"));
3229
+ }
3230
+ if (response.error === 'aborted') {
3231
+ throw new Error('CubeSQL query was aborted');
3232
+ }
3233
+ var _response$error$split = response.error.split('\n'),
3234
+ _response$error$split2 = _toArray__default['default'](_response$error$split),
3235
+ schema = _response$error$split2[0],
3236
+ data = _response$error$split2.slice(1);
3237
+ try {
3238
+ return {
3239
+ schema: JSON.parse(schema).schema,
3240
+ data: data.filter(function (d) {
3241
+ return d.trim().length;
3242
+ }).map(function (d) {
3243
+ return JSON.parse(d).data;
3244
+ }).reduce(function (a, b) {
3245
+ return a.concat(b);
3246
+ }, [])
3247
+ };
3248
+ } catch (err) {
3249
+ throw new Error(response.error);
3250
+ }
3251
+ }, options, callback);
3252
+ }
3253
+
3254
+ /**
3255
+ * Execute a Cube SQL query against Cube SQL interface and return streaming results as an async generator.
3256
+ * The server returns JSONL (JSON Lines) format with schema first, then data rows.
3257
+ */
3258
+ }, {
3259
+ key: "cubeSqlStream",
3260
+ value: function cubeSqlStream(sqlQuery, options) {
3261
+ var _this = this;
3262
+ return _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
3263
+ var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator2, _step2, line, parsed, _parsed;
3264
+ return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
3265
+ while (1) switch (_context8.prev = _context8.next) {
3266
+ case 0:
3267
+ if (_this.transport.requestStream) {
3268
+ _context8.next = 2;
3269
+ break;
3270
+ }
3271
+ throw new Error('Transport does not support streaming');
3272
+ case 2:
3273
+ streamResponse = _this.transport.requestStream('cubesql', {
3274
+ method: 'POST',
3275
+ signal: options === null || options === void 0 ? void 0 : options.signal,
3276
+ fetchTimeout: options === null || options === void 0 ? void 0 : options.timeout,
3277
+ baseRequestId: uuid.v4(),
3278
+ params: {
3279
+ query: sqlQuery
3280
+ }
3281
+ });
3282
+ decoder = new TextDecoder();
3283
+ buffer = '';
3284
+ _context8.prev = 5;
3285
+ _context8.next = 8;
3286
+ return _awaitAsyncGenerator__default['default'](streamResponse.stream());
3287
+ case 8:
3288
+ stream = _context8.sent;
3289
+ _iteratorAbruptCompletion = false;
3290
+ _didIteratorError = false;
3291
+ _context8.prev = 11;
3292
+ _iterator = _asyncIterator(stream);
3293
+ case 13:
3294
+ _context8.next = 15;
3295
+ return _awaitAsyncGenerator__default['default'](_iterator.next());
3296
+ case 15:
3297
+ if (!(_iteratorAbruptCompletion = !(_step = _context8.sent).done)) {
3298
+ _context8.next = 60;
3299
+ break;
3300
+ }
3301
+ chunk = _step.value;
3302
+ buffer += decoder.decode(chunk, {
3303
+ stream: true
3304
+ });
3305
+ lines = buffer.split('\n');
3306
+ buffer = lines.pop() || '';
3307
+ _iterator2 = _createForOfIteratorHelper(lines);
3308
+ _context8.prev = 21;
3309
+ _iterator2.s();
3310
+ case 23:
3311
+ if ((_step2 = _iterator2.n()).done) {
3312
+ _context8.next = 49;
3313
+ break;
3314
+ }
3315
+ line = _step2.value;
3316
+ if (!line.trim()) {
3317
+ _context8.next = 47;
3318
+ break;
3319
+ }
3320
+ _context8.prev = 26;
3321
+ parsed = JSON.parse(line);
3322
+ if (!parsed.schema) {
3323
+ _context8.next = 33;
3324
+ break;
3325
+ }
3326
+ _context8.next = 31;
3327
+ return {
3328
+ type: 'schema',
3329
+ schema: parsed.schema
3330
+ };
3331
+ case 31:
3332
+ _context8.next = 41;
3333
+ break;
3334
+ case 33:
3335
+ if (!parsed.data) {
3336
+ _context8.next = 38;
3337
+ break;
3338
+ }
3339
+ _context8.next = 36;
3340
+ return {
3341
+ type: 'data',
3342
+ data: parsed.data
3343
+ };
3344
+ case 36:
3345
+ _context8.next = 41;
3346
+ break;
3347
+ case 38:
3348
+ if (!parsed.error) {
3349
+ _context8.next = 41;
3350
+ break;
3351
+ }
3352
+ _context8.next = 41;
3353
+ return {
3354
+ type: 'error',
3355
+ error: parsed.error
3356
+ };
3357
+ case 41:
3358
+ _context8.next = 47;
3359
+ break;
3360
+ case 43:
3361
+ _context8.prev = 43;
3362
+ _context8.t0 = _context8["catch"](26);
3363
+ _context8.next = 47;
3364
+ return {
3365
+ type: 'error',
3366
+ error: "Failed to parse JSON line: ".concat(line)
3367
+ };
3368
+ case 47:
3369
+ _context8.next = 23;
3370
+ break;
3371
+ case 49:
3372
+ _context8.next = 54;
3373
+ break;
3374
+ case 51:
3375
+ _context8.prev = 51;
3376
+ _context8.t1 = _context8["catch"](21);
3377
+ _iterator2.e(_context8.t1);
3378
+ case 54:
3379
+ _context8.prev = 54;
3380
+ _iterator2.f();
3381
+ return _context8.finish(54);
3382
+ case 57:
3383
+ _iteratorAbruptCompletion = false;
3384
+ _context8.next = 13;
3385
+ break;
3386
+ case 60:
3387
+ _context8.next = 66;
3388
+ break;
3389
+ case 62:
3390
+ _context8.prev = 62;
3391
+ _context8.t2 = _context8["catch"](11);
3392
+ _didIteratorError = true;
3393
+ _iteratorError = _context8.t2;
3394
+ case 66:
3395
+ _context8.prev = 66;
3396
+ _context8.prev = 67;
3397
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
3398
+ _context8.next = 71;
3399
+ break;
3400
+ }
3401
+ _context8.next = 71;
3402
+ return _awaitAsyncGenerator__default['default'](_iterator["return"]());
3403
+ case 71:
3404
+ _context8.prev = 71;
3405
+ if (!_didIteratorError) {
3406
+ _context8.next = 74;
3407
+ break;
3408
+ }
3409
+ throw _iteratorError;
3410
+ case 74:
3411
+ return _context8.finish(71);
3412
+ case 75:
3413
+ return _context8.finish(66);
3414
+ case 76:
3415
+ if (!buffer.trim()) {
3416
+ _context8.next = 98;
3417
+ break;
3418
+ }
3419
+ _context8.prev = 77;
3420
+ _parsed = JSON.parse(buffer);
3421
+ if (!_parsed.schema) {
3422
+ _context8.next = 84;
3423
+ break;
3424
+ }
3425
+ _context8.next = 82;
3426
+ return {
3427
+ type: 'schema',
3428
+ schema: _parsed.schema
3429
+ };
3430
+ case 82:
3431
+ _context8.next = 92;
3432
+ break;
3433
+ case 84:
3434
+ if (!_parsed.data) {
3435
+ _context8.next = 89;
3436
+ break;
3437
+ }
3438
+ _context8.next = 87;
3439
+ return {
3440
+ type: 'data',
3441
+ data: _parsed.data
3442
+ };
3443
+ case 87:
3444
+ _context8.next = 92;
3445
+ break;
3446
+ case 89:
3447
+ if (!_parsed.error) {
3448
+ _context8.next = 92;
3449
+ break;
3450
+ }
3451
+ _context8.next = 92;
3452
+ return {
3453
+ type: 'error',
3454
+ error: _parsed.error
3455
+ };
3456
+ case 92:
3457
+ _context8.next = 98;
3458
+ break;
3459
+ case 94:
3460
+ _context8.prev = 94;
3461
+ _context8.t3 = _context8["catch"](77);
3462
+ _context8.next = 98;
3463
+ return {
3464
+ type: 'error',
3465
+ error: "Failed to parse remaining JSON: ".concat(buffer)
3466
+ };
3467
+ case 98:
3468
+ _context8.next = 105;
3469
+ break;
3470
+ case 100:
3471
+ _context8.prev = 100;
3472
+ _context8.t4 = _context8["catch"](5);
3473
+ if (!(_context8.t4.name === 'AbortError')) {
3474
+ _context8.next = 104;
3475
+ break;
3476
+ }
3477
+ throw new Error('aborted');
3478
+ case 104:
3479
+ throw _context8.t4;
3480
+ case 105:
3481
+ _context8.prev = 105;
3482
+ if (!streamResponse.unsubscribe) {
3483
+ _context8.next = 109;
3484
+ break;
3485
+ }
3486
+ _context8.next = 109;
3487
+ return _awaitAsyncGenerator__default['default'](streamResponse.unsubscribe());
3488
+ case 109:
3489
+ return _context8.finish(105);
3490
+ case 110:
3491
+ case "end":
3492
+ return _context8.stop();
3493
+ }
3494
+ }, _callee8, null, [[5, 100, 105, 110], [11, 62, 66, 76], [21, 51, 54, 57], [26, 43], [67,, 71, 75], [77, 94]]);
3495
+ }))();
3496
+ }
2923
3497
  }]);
2924
3498
  }();
2925
3499
  var index = (function (apiToken, options) {