@cubejs-client/core 1.5.10 → 1.5.11
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.
|
@@ -619,9 +619,9 @@ function defaultHeuristics(newState, oldQuery, options) {
|
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
621
|
if ((newChartType === 'pie' || newChartType === 'table' || newChartType === 'number') && (oldQuery.timeDimensions || []).length === 1 && oldQuery.timeDimensions[0].granularity) {
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
_td2 =
|
|
622
|
+
var _ref0 = oldQuery.timeDimensions,
|
|
623
|
+
_ref1 = _slicedToArray__default['default'](_ref0, 1),
|
|
624
|
+
_td2 = _ref1[0];
|
|
625
625
|
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
626
626
|
pivotConfig: null,
|
|
627
627
|
shouldApplyHeuristicOrder: true,
|
|
@@ -708,10 +708,10 @@ function getOrderMembersFromOrder(orderMembers, order) {
|
|
|
708
708
|
var indexedOrderMembers = ramda.indexBy(ramda.prop('id'), orderMembers);
|
|
709
709
|
var entries = Array.isArray(order) ? order : Object.entries(order || {});
|
|
710
710
|
var nextOrderMembers = [];
|
|
711
|
-
entries.forEach(function (
|
|
712
|
-
var
|
|
713
|
-
memberId =
|
|
714
|
-
currentOrder =
|
|
711
|
+
entries.forEach(function (_ref10) {
|
|
712
|
+
var _ref11 = _slicedToArray__default['default'](_ref10, 2),
|
|
713
|
+
memberId = _ref11[0],
|
|
714
|
+
currentOrder = _ref11[1];
|
|
715
715
|
if (currentOrder !== 'none' && indexedOrderMembers[memberId]) {
|
|
716
716
|
ids.add(memberId);
|
|
717
717
|
nextOrderMembers.push(_objectSpread$3(_objectSpread$3({}, indexedOrderMembers[memberId]), {}, {
|
|
@@ -1017,9 +1017,9 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1017
1017
|
title: title,
|
|
1018
1018
|
shortTitle: shortTitle,
|
|
1019
1019
|
key: key,
|
|
1020
|
-
series: _this.chartPivot(pivotConfig).map(function (
|
|
1021
|
-
var x =
|
|
1022
|
-
obj = _objectWithoutProperties__default['default'](
|
|
1020
|
+
series: _this.chartPivot(pivotConfig).map(function (_ref0) {
|
|
1021
|
+
var x = _ref0.x,
|
|
1022
|
+
obj = _objectWithoutProperties__default['default'](_ref0, _excluded$1);
|
|
1023
1023
|
return {
|
|
1024
1024
|
value: obj[key],
|
|
1025
1025
|
x: x
|
|
@@ -1162,8 +1162,8 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1162
1162
|
var query = this.loadResponse.pivotQuery;
|
|
1163
1163
|
var pivotImpl = function pivotImpl() {
|
|
1164
1164
|
var resultIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1165
|
-
var groupByXAxis = groupByToPairs(function (
|
|
1166
|
-
var xValues =
|
|
1165
|
+
var groupByXAxis = groupByToPairs(function (_ref1) {
|
|
1166
|
+
var xValues = _ref1.xValues;
|
|
1167
1167
|
return _this2.axisValuesString(xValues);
|
|
1168
1168
|
});
|
|
1169
1169
|
var measureValue = function measureValue(row, measure) {
|
|
@@ -1180,8 +1180,8 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1180
1180
|
if (series[0]) {
|
|
1181
1181
|
groupByXAxis = function groupByXAxis(rows) {
|
|
1182
1182
|
var _series$resultIndex$m, _series$resultIndex;
|
|
1183
|
-
var byXValues = ramda.groupBy(function (
|
|
1184
|
-
var xValues =
|
|
1183
|
+
var byXValues = ramda.groupBy(function (_ref10) {
|
|
1184
|
+
var xValues = _ref10.xValues;
|
|
1185
1185
|
return xValues[0];
|
|
1186
1186
|
}, rows);
|
|
1187
1187
|
return (_series$resultIndex$m = (_series$resultIndex = series[resultIndex]) === null || _series$resultIndex === void 0 ? void 0 : _series$resultIndex.map(function (d) {
|
|
@@ -1202,11 +1202,11 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1202
1202
|
});
|
|
1203
1203
|
}), unnest, groupByXAxis)(_this2.timeDimensionBackwardCompatibleData(resultIndex));
|
|
1204
1204
|
var yValuesMap = {};
|
|
1205
|
-
xGrouped.forEach(function (
|
|
1206
|
-
var
|
|
1207
|
-
rows =
|
|
1208
|
-
rows.forEach(function (
|
|
1209
|
-
var row =
|
|
1205
|
+
xGrouped.forEach(function (_ref11) {
|
|
1206
|
+
var _ref12 = _slicedToArray__default['default'](_ref11, 2),
|
|
1207
|
+
rows = _ref12[1];
|
|
1208
|
+
rows.forEach(function (_ref13) {
|
|
1209
|
+
var row = _ref13.row;
|
|
1210
1210
|
_this2.axisValues(normalizedPivotConfig.y, resultIndex)(row).forEach(function (values) {
|
|
1211
1211
|
if (Object.keys(row).length > 0) {
|
|
1212
1212
|
yValuesMap[values.join()] = values;
|
|
@@ -1218,13 +1218,13 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1218
1218
|
var measureOnX = Boolean(normalizedPivotConfig.x.find(function (d) {
|
|
1219
1219
|
return d === 'measures';
|
|
1220
1220
|
}));
|
|
1221
|
-
return xGrouped.map(function (
|
|
1222
|
-
var
|
|
1223
|
-
rows =
|
|
1221
|
+
return xGrouped.map(function (_ref14) {
|
|
1222
|
+
var _ref15 = _slicedToArray__default['default'](_ref14, 2),
|
|
1223
|
+
rows = _ref15[1];
|
|
1224
1224
|
var xValues = rows[0].xValues;
|
|
1225
1225
|
var yGrouped = {};
|
|
1226
|
-
rows.forEach(function (
|
|
1227
|
-
var row =
|
|
1226
|
+
rows.forEach(function (_ref16) {
|
|
1227
|
+
var row = _ref16.row;
|
|
1228
1228
|
var arr = _this2.axisValues(normalizedPivotConfig.y, resultIndex)(row).map(function (yValues) {
|
|
1229
1229
|
return {
|
|
1230
1230
|
yValues: yValues,
|
|
@@ -1366,9 +1366,9 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1366
1366
|
};
|
|
1367
1367
|
var duplicateMeasures = new Set();
|
|
1368
1368
|
if (this.queryType === QUERY_TYPE.BLENDING_QUERY) {
|
|
1369
|
-
var allMeasures = ramda.flatten(this.loadResponses.map(function (
|
|
1369
|
+
var allMeasures = ramda.flatten(this.loadResponses.map(function (_ref17) {
|
|
1370
1370
|
var _query$measures;
|
|
1371
|
-
var query =
|
|
1371
|
+
var query = _ref17.query;
|
|
1372
1372
|
return (_query$measures = query.measures) !== null && _query$measures !== void 0 ? _query$measures : [];
|
|
1373
1373
|
}));
|
|
1374
1374
|
allMeasures.filter(function (e, i, a) {
|
|
@@ -1377,14 +1377,14 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1377
1377
|
return duplicateMeasures.add(m);
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
|
-
return this.pivot(pivotConfig).map(function (
|
|
1381
|
-
var xValues =
|
|
1382
|
-
yValuesArray =
|
|
1380
|
+
return this.pivot(pivotConfig).map(function (_ref18) {
|
|
1381
|
+
var xValues = _ref18.xValues,
|
|
1382
|
+
yValuesArray = _ref18.yValuesArray;
|
|
1383
1383
|
var yValuesMap = {};
|
|
1384
|
-
yValuesArray.forEach(function (
|
|
1385
|
-
var
|
|
1386
|
-
yValues =
|
|
1387
|
-
m =
|
|
1384
|
+
yValuesArray.forEach(function (_ref19, i) {
|
|
1385
|
+
var _ref20 = _slicedToArray__default['default'](_ref19, 2),
|
|
1386
|
+
yValues = _ref20[0],
|
|
1387
|
+
m = _ref20[1];
|
|
1388
1388
|
yValuesMap[_this3.axisValuesString(aliasSeries(yValues, i, pivotConfig, duplicateMeasures), ',')] = m && validate(m);
|
|
1389
1389
|
});
|
|
1390
1390
|
return _objectSpread$2({
|
|
@@ -1426,15 +1426,15 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1426
1426
|
value: function tablePivot(pivotConfig) {
|
|
1427
1427
|
var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig || {});
|
|
1428
1428
|
var isMeasuresPresent = normalizedPivotConfig.x.concat(normalizedPivotConfig.y).includes('measures');
|
|
1429
|
-
return this.pivot(normalizedPivotConfig).map(function (
|
|
1430
|
-
var xValues =
|
|
1431
|
-
yValuesArray =
|
|
1429
|
+
return this.pivot(normalizedPivotConfig).map(function (_ref21) {
|
|
1430
|
+
var xValues = _ref21.xValues,
|
|
1431
|
+
yValuesArray = _ref21.yValuesArray;
|
|
1432
1432
|
return ramda.fromPairs([].concat(_toConsumableArray__default['default'](normalizedPivotConfig.x.map(function (key, index) {
|
|
1433
1433
|
return [key, xValues[index]];
|
|
1434
|
-
})), _toConsumableArray__default['default'](isMeasuresPresent ? yValuesArray.map(function (
|
|
1435
|
-
var
|
|
1436
|
-
yValues =
|
|
1437
|
-
measure =
|
|
1434
|
+
})), _toConsumableArray__default['default'](isMeasuresPresent ? yValuesArray.map(function (_ref22) {
|
|
1435
|
+
var _ref23 = _slicedToArray__default['default'](_ref22, 2),
|
|
1436
|
+
yValues = _ref23[0],
|
|
1437
|
+
measure = _ref23[1];
|
|
1438
1438
|
return [yValues.length ? yValues.join() : 'value', measure];
|
|
1439
1439
|
}) : [])));
|
|
1440
1440
|
});
|
|
@@ -1554,12 +1554,12 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1554
1554
|
}, {});
|
|
1555
1555
|
var schema = {};
|
|
1556
1556
|
var extractFields = function extractFields(key) {
|
|
1557
|
-
var
|
|
1558
|
-
title =
|
|
1559
|
-
shortTitle =
|
|
1560
|
-
type =
|
|
1561
|
-
format =
|
|
1562
|
-
meta =
|
|
1557
|
+
var _ref24 = flatMeta[key] || {},
|
|
1558
|
+
title = _ref24.title,
|
|
1559
|
+
shortTitle = _ref24.shortTitle,
|
|
1560
|
+
type = _ref24.type,
|
|
1561
|
+
format = _ref24.format,
|
|
1562
|
+
meta = _ref24.meta;
|
|
1563
1563
|
return {
|
|
1564
1564
|
key: key,
|
|
1565
1565
|
title: title,
|
|
@@ -1570,9 +1570,9 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1570
1570
|
};
|
|
1571
1571
|
};
|
|
1572
1572
|
var pivot = this.pivot(normalizedPivotConfig);
|
|
1573
|
-
(((_pivot$ = pivot[0]) === null || _pivot$ === void 0 ? void 0 : _pivot$.yValuesArray) || []).forEach(function (
|
|
1574
|
-
var
|
|
1575
|
-
yValues =
|
|
1573
|
+
(((_pivot$ = pivot[0]) === null || _pivot$ === void 0 ? void 0 : _pivot$.yValuesArray) || []).forEach(function (_ref25) {
|
|
1574
|
+
var _ref26 = _slicedToArray__default['default'](_ref25, 1),
|
|
1575
|
+
yValues = _ref26[0];
|
|
1576
1576
|
if (yValues.length > 0) {
|
|
1577
1577
|
var currentItem = schema;
|
|
1578
1578
|
yValues.forEach(function (value, index) {
|
|
@@ -1592,9 +1592,9 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1592
1592
|
if (Object.keys(item).length === 0) {
|
|
1593
1593
|
return [];
|
|
1594
1594
|
}
|
|
1595
|
-
return Object.values(item).map(function (
|
|
1596
|
-
var key =
|
|
1597
|
-
currentItem = _objectWithoutProperties__default['default'](
|
|
1595
|
+
return Object.values(item).map(function (_ref27) {
|
|
1596
|
+
var key = _ref27.key,
|
|
1597
|
+
currentItem = _objectWithoutProperties__default['default'](_ref27, _excluded2);
|
|
1598
1598
|
var children = _toColumns(currentItem.children, [].concat(_toConsumableArray__default['default'](path), [key]));
|
|
1599
1599
|
var _extractFields = extractFields(currentItem.memberId),
|
|
1600
1600
|
title = _extractFields.title,
|
|
@@ -1702,9 +1702,9 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1702
1702
|
}));
|
|
1703
1703
|
var duplicateMeasures = new Set();
|
|
1704
1704
|
if (this.queryType === QUERY_TYPE.BLENDING_QUERY) {
|
|
1705
|
-
var allMeasures = ramda.flatten(this.loadResponses.map(function (
|
|
1705
|
+
var allMeasures = ramda.flatten(this.loadResponses.map(function (_ref28) {
|
|
1706
1706
|
var _query$measures2;
|
|
1707
|
-
var query =
|
|
1707
|
+
var query = _ref28.query;
|
|
1708
1708
|
return (_query$measures2 = query.measures) !== null && _query$measures2 !== void 0 ? _query$measures2 : [];
|
|
1709
1709
|
}));
|
|
1710
1710
|
allMeasures.filter(function (e, i, a) {
|
|
@@ -1866,11 +1866,11 @@ var ResultSet = /*#__PURE__*/function () {
|
|
|
1866
1866
|
fillMissingDates: true,
|
|
1867
1867
|
joinDateRange: false
|
|
1868
1868
|
};
|
|
1869
|
-
var
|
|
1870
|
-
|
|
1871
|
-
measures =
|
|
1872
|
-
|
|
1873
|
-
dimensions =
|
|
1869
|
+
var _ref29 = query || {},
|
|
1870
|
+
_ref29$measures = _ref29.measures,
|
|
1871
|
+
measures = _ref29$measures === void 0 ? [] : _ref29$measures,
|
|
1872
|
+
_ref29$dimensions = _ref29.dimensions,
|
|
1873
|
+
dimensions = _ref29$dimensions === void 0 ? [] : _ref29$dimensions;
|
|
1874
1874
|
var timeDimensions = ((query === null || query === void 0 ? void 0 : query.timeDimensions) || []).filter(function (td) {
|
|
1875
1875
|
return !!td.granularity;
|
|
1876
1876
|
});
|
|
@@ -2223,117 +2223,117 @@ function responseChunks(_x) {
|
|
|
2223
2223
|
}
|
|
2224
2224
|
function _responseChunks() {
|
|
2225
2225
|
_responseChunks = _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(res) {
|
|
2226
|
-
var body, reader, _yield$_awaitAsyncGen, done, value, _reader$releaseLock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
|
2227
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2226
|
+
var body, reader, _yield$_awaitAsyncGen, done, value, _reader$releaseLock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _t;
|
|
2227
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2228
2228
|
while (1) switch (_context.prev = _context.next) {
|
|
2229
2229
|
case 0:
|
|
2230
2230
|
// eslint-disable-next-line prefer-destructuring
|
|
2231
2231
|
body = res.body;
|
|
2232
2232
|
if (!(body && typeof body.getReader === 'function')) {
|
|
2233
|
-
_context.next =
|
|
2233
|
+
_context.next = 8;
|
|
2234
2234
|
break;
|
|
2235
2235
|
}
|
|
2236
2236
|
reader = body.getReader(); // Browser / Node native fetch
|
|
2237
|
-
_context.prev =
|
|
2238
|
-
case
|
|
2239
|
-
_context.next =
|
|
2237
|
+
_context.prev = 1;
|
|
2238
|
+
case 2:
|
|
2239
|
+
_context.next = 3;
|
|
2240
2240
|
return _awaitAsyncGenerator__default['default'](reader.read());
|
|
2241
|
-
case
|
|
2241
|
+
case 3:
|
|
2242
2242
|
_yield$_awaitAsyncGen = _context.sent;
|
|
2243
2243
|
done = _yield$_awaitAsyncGen.done;
|
|
2244
2244
|
value = _yield$_awaitAsyncGen.value;
|
|
2245
2245
|
if (!done) {
|
|
2246
|
-
_context.next =
|
|
2246
|
+
_context.next = 4;
|
|
2247
2247
|
break;
|
|
2248
2248
|
}
|
|
2249
|
-
return _context.abrupt("
|
|
2250
|
-
case
|
|
2249
|
+
return _context.abrupt("continue", 6);
|
|
2250
|
+
case 4:
|
|
2251
2251
|
if (!value) {
|
|
2252
|
-
_context.next =
|
|
2252
|
+
_context.next = 5;
|
|
2253
2253
|
break;
|
|
2254
2254
|
}
|
|
2255
|
-
_context.next =
|
|
2255
|
+
_context.next = 5;
|
|
2256
2256
|
return value;
|
|
2257
|
-
case
|
|
2258
|
-
_context.next =
|
|
2257
|
+
case 5:
|
|
2258
|
+
_context.next = 2;
|
|
2259
2259
|
break;
|
|
2260
|
-
case
|
|
2261
|
-
_context.prev =
|
|
2260
|
+
case 6:
|
|
2261
|
+
_context.prev = 6;
|
|
2262
2262
|
(_reader$releaseLock = reader.releaseLock) === null || _reader$releaseLock === void 0 || _reader$releaseLock.call(reader);
|
|
2263
|
-
return _context.finish(
|
|
2264
|
-
case
|
|
2263
|
+
return _context.finish(6);
|
|
2264
|
+
case 7:
|
|
2265
2265
|
return _context.abrupt("return");
|
|
2266
|
-
case
|
|
2266
|
+
case 8:
|
|
2267
2267
|
if (!(body && Symbol.asyncIterator in body)) {
|
|
2268
|
-
_context.next =
|
|
2268
|
+
_context.next = 23;
|
|
2269
2269
|
break;
|
|
2270
2270
|
}
|
|
2271
2271
|
_iteratorAbruptCompletion = false;
|
|
2272
2272
|
_didIteratorError = false;
|
|
2273
|
-
_context.prev =
|
|
2273
|
+
_context.prev = 9;
|
|
2274
2274
|
_iterator = _asyncIterator$1(body);
|
|
2275
|
-
case
|
|
2276
|
-
_context.next =
|
|
2275
|
+
case 10:
|
|
2276
|
+
_context.next = 11;
|
|
2277
2277
|
return _awaitAsyncGenerator__default['default'](_iterator.next());
|
|
2278
|
-
case
|
|
2278
|
+
case 11:
|
|
2279
2279
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
2280
|
-
_context.next =
|
|
2280
|
+
_context.next = 15;
|
|
2281
2281
|
break;
|
|
2282
2282
|
}
|
|
2283
2283
|
chunk = _step.value;
|
|
2284
2284
|
if (!(typeof chunk === 'string')) {
|
|
2285
|
-
_context.next =
|
|
2285
|
+
_context.next = 13;
|
|
2286
2286
|
break;
|
|
2287
2287
|
}
|
|
2288
|
-
_context.next =
|
|
2288
|
+
_context.next = 12;
|
|
2289
2289
|
return new TextEncoder().encode(chunk);
|
|
2290
|
-
case
|
|
2291
|
-
_context.next =
|
|
2290
|
+
case 12:
|
|
2291
|
+
_context.next = 14;
|
|
2292
2292
|
break;
|
|
2293
|
-
case
|
|
2294
|
-
_context.next =
|
|
2293
|
+
case 13:
|
|
2294
|
+
_context.next = 14;
|
|
2295
2295
|
return new Uint8Array(chunk);
|
|
2296
|
-
case
|
|
2296
|
+
case 14:
|
|
2297
2297
|
_iteratorAbruptCompletion = false;
|
|
2298
|
-
_context.next =
|
|
2298
|
+
_context.next = 10;
|
|
2299
2299
|
break;
|
|
2300
|
-
case
|
|
2301
|
-
_context.next =
|
|
2300
|
+
case 15:
|
|
2301
|
+
_context.next = 17;
|
|
2302
2302
|
break;
|
|
2303
|
-
case
|
|
2304
|
-
_context.prev =
|
|
2305
|
-
|
|
2303
|
+
case 16:
|
|
2304
|
+
_context.prev = 16;
|
|
2305
|
+
_t = _context["catch"](9);
|
|
2306
2306
|
_didIteratorError = true;
|
|
2307
|
-
_iteratorError =
|
|
2308
|
-
case
|
|
2309
|
-
_context.prev =
|
|
2310
|
-
_context.prev =
|
|
2307
|
+
_iteratorError = _t;
|
|
2308
|
+
case 17:
|
|
2309
|
+
_context.prev = 17;
|
|
2310
|
+
_context.prev = 18;
|
|
2311
2311
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
2312
|
-
_context.next =
|
|
2312
|
+
_context.next = 19;
|
|
2313
2313
|
break;
|
|
2314
2314
|
}
|
|
2315
|
-
_context.next =
|
|
2315
|
+
_context.next = 19;
|
|
2316
2316
|
return _awaitAsyncGenerator__default['default'](_iterator["return"]());
|
|
2317
|
-
case
|
|
2318
|
-
_context.prev =
|
|
2317
|
+
case 19:
|
|
2318
|
+
_context.prev = 19;
|
|
2319
2319
|
if (!_didIteratorError) {
|
|
2320
|
-
_context.next =
|
|
2320
|
+
_context.next = 20;
|
|
2321
2321
|
break;
|
|
2322
2322
|
}
|
|
2323
2323
|
throw _iteratorError;
|
|
2324
|
-
case
|
|
2325
|
-
return _context.finish(
|
|
2326
|
-
case
|
|
2327
|
-
return _context.finish(
|
|
2328
|
-
case
|
|
2324
|
+
case 20:
|
|
2325
|
+
return _context.finish(19);
|
|
2326
|
+
case 21:
|
|
2327
|
+
return _context.finish(17);
|
|
2328
|
+
case 22:
|
|
2329
2329
|
return _context.abrupt("return");
|
|
2330
|
-
case
|
|
2330
|
+
case 23:
|
|
2331
2331
|
throw new Error('Unsupported response body type for streaming');
|
|
2332
|
-
case
|
|
2332
|
+
case 24:
|
|
2333
2333
|
case "end":
|
|
2334
2334
|
return _context.stop();
|
|
2335
2335
|
}
|
|
2336
|
-
}, _callee, null, [[
|
|
2336
|
+
}, _callee, null, [[1,, 6, 7], [9, 16, 17, 22], [18,, 19, 21]]);
|
|
2337
2337
|
}));
|
|
2338
2338
|
return _responseChunks.apply(this, arguments);
|
|
2339
2339
|
}
|
|
@@ -2413,23 +2413,23 @@ var HttpTransport = /*#__PURE__*/function () {
|
|
|
2413
2413
|
/* eslint no-unsafe-finally: off */subscribe: function subscribe(callback) {
|
|
2414
2414
|
var _this2 = this;
|
|
2415
2415
|
return _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2416
|
-
var result, errorMessage, _actualSignal$reason, _result;
|
|
2417
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2416
|
+
var result, errorMessage, _actualSignal$reason, _result, _t;
|
|
2417
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2418
2418
|
while (1) switch (_context.prev = _context.next) {
|
|
2419
2419
|
case 0:
|
|
2420
2420
|
_context.prev = 0;
|
|
2421
|
-
_context.next =
|
|
2421
|
+
_context.next = 1;
|
|
2422
2422
|
return runRequest();
|
|
2423
|
-
case
|
|
2423
|
+
case 1:
|
|
2424
2424
|
result = _context.sent;
|
|
2425
2425
|
return _context.abrupt("return", callback(result, function () {
|
|
2426
2426
|
return _this2.subscribe(callback);
|
|
2427
2427
|
}));
|
|
2428
|
-
case
|
|
2429
|
-
_context.prev =
|
|
2430
|
-
|
|
2428
|
+
case 2:
|
|
2429
|
+
_context.prev = 2;
|
|
2430
|
+
_t = _context["catch"](0);
|
|
2431
2431
|
errorMessage = 'network Error';
|
|
2432
|
-
if (
|
|
2432
|
+
if (_t.name === 'AbortError') {
|
|
2433
2433
|
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') {
|
|
2434
2434
|
errorMessage = 'timeout';
|
|
2435
2435
|
} else {
|
|
@@ -2442,11 +2442,11 @@ var HttpTransport = /*#__PURE__*/function () {
|
|
|
2442
2442
|
return _context.abrupt("return", callback(_result, function () {
|
|
2443
2443
|
return _this2.subscribe(callback);
|
|
2444
2444
|
}));
|
|
2445
|
-
case
|
|
2445
|
+
case 3:
|
|
2446
2446
|
case "end":
|
|
2447
2447
|
return _context.stop();
|
|
2448
2448
|
}
|
|
2449
|
-
}, _callee, null, [[0,
|
|
2449
|
+
}, _callee, null, [[0, 2]]);
|
|
2450
2450
|
}))();
|
|
2451
2451
|
}
|
|
2452
2452
|
};
|
|
@@ -2494,10 +2494,10 @@ var HttpTransport = /*#__PURE__*/function () {
|
|
|
2494
2494
|
stream: function () {
|
|
2495
2495
|
var _stream = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2496
2496
|
var response;
|
|
2497
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2497
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context2) {
|
|
2498
2498
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2499
2499
|
case 0:
|
|
2500
|
-
_context2.next =
|
|
2500
|
+
_context2.next = 1;
|
|
2501
2501
|
return fetch__default['default'](url, {
|
|
2502
2502
|
method: requestMethod,
|
|
2503
2503
|
headers: _objectSpread$1({
|
|
@@ -2508,22 +2508,22 @@ var HttpTransport = /*#__PURE__*/function () {
|
|
|
2508
2508
|
body: requestMethod === 'POST' ? JSON.stringify(params || {}) : null,
|
|
2509
2509
|
signal: actualSignal
|
|
2510
2510
|
});
|
|
2511
|
-
case
|
|
2511
|
+
case 1:
|
|
2512
2512
|
response = _context2.sent;
|
|
2513
2513
|
if (response.ok) {
|
|
2514
|
-
_context2.next =
|
|
2514
|
+
_context2.next = 2;
|
|
2515
2515
|
break;
|
|
2516
2516
|
}
|
|
2517
2517
|
throw new Error("HTTP ".concat(response.status, ": ").concat(response.statusText));
|
|
2518
|
-
case
|
|
2518
|
+
case 2:
|
|
2519
2519
|
if (response.body) {
|
|
2520
|
-
_context2.next =
|
|
2520
|
+
_context2.next = 3;
|
|
2521
2521
|
break;
|
|
2522
2522
|
}
|
|
2523
2523
|
throw new Error('No response body available for streaming');
|
|
2524
|
-
case
|
|
2524
|
+
case 3:
|
|
2525
2525
|
return _context2.abrupt("return", responseChunks(response));
|
|
2526
|
-
case
|
|
2526
|
+
case 4:
|
|
2527
2527
|
case "end":
|
|
2528
2528
|
return _context2.stop();
|
|
2529
2529
|
}
|
|
@@ -2536,7 +2536,7 @@ var HttpTransport = /*#__PURE__*/function () {
|
|
|
2536
2536
|
}(),
|
|
2537
2537
|
unsubscribe: function () {
|
|
2538
2538
|
var _unsubscribe = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
2539
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2539
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context3) {
|
|
2540
2540
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2541
2541
|
case 0:
|
|
2542
2542
|
if (controller) {
|
|
@@ -2694,27 +2694,27 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2694
2694
|
var checkMutex = /*#__PURE__*/function () {
|
|
2695
2695
|
var _ref = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2696
2696
|
var requestInstance;
|
|
2697
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2697
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2698
2698
|
while (1) switch (_context.prev = _context.next) {
|
|
2699
2699
|
case 0:
|
|
2700
|
-
_context.next =
|
|
2700
|
+
_context.next = 1;
|
|
2701
2701
|
return requestPromise;
|
|
2702
|
-
case
|
|
2702
|
+
case 1:
|
|
2703
2703
|
requestInstance = _context.sent;
|
|
2704
2704
|
if (!(options && options.mutexObj && options.mutexObj[mutexKey] !== mutexValue)) {
|
|
2705
|
-
_context.next =
|
|
2705
|
+
_context.next = 3;
|
|
2706
2706
|
break;
|
|
2707
2707
|
}
|
|
2708
2708
|
unsubscribed = true;
|
|
2709
2709
|
if (!requestInstance.unsubscribe) {
|
|
2710
|
-
_context.next =
|
|
2710
|
+
_context.next = 2;
|
|
2711
2711
|
break;
|
|
2712
2712
|
}
|
|
2713
|
-
_context.next =
|
|
2713
|
+
_context.next = 2;
|
|
2714
2714
|
return requestInstance.unsubscribe();
|
|
2715
|
-
case
|
|
2715
|
+
case 2:
|
|
2716
2716
|
throw MUTEX_ERROR;
|
|
2717
|
-
case
|
|
2717
|
+
case 3:
|
|
2718
2718
|
case "end":
|
|
2719
2719
|
return _context.stop();
|
|
2720
2720
|
}
|
|
@@ -2729,40 +2729,40 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2729
2729
|
var _ref2 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(response, next) {
|
|
2730
2730
|
var _options2, _response$error, _options5;
|
|
2731
2731
|
var requestInstance, subscribeNext, continueWait, body, text, _options3, _options4, _error, result;
|
|
2732
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2732
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context4) {
|
|
2733
2733
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2734
2734
|
case 0:
|
|
2735
|
-
_context4.next =
|
|
2735
|
+
_context4.next = 1;
|
|
2736
2736
|
return requestPromise;
|
|
2737
|
-
case
|
|
2737
|
+
case 1:
|
|
2738
2738
|
requestInstance = _context4.sent;
|
|
2739
2739
|
subscribeNext = /*#__PURE__*/function () {
|
|
2740
2740
|
var _ref3 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2741
2741
|
var _options;
|
|
2742
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2742
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context2) {
|
|
2743
2743
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2744
2744
|
case 0:
|
|
2745
2745
|
if (!((_options = options) !== null && _options !== void 0 && _options.subscribe && !unsubscribed)) {
|
|
2746
|
-
_context2.next =
|
|
2746
|
+
_context2.next = 3;
|
|
2747
2747
|
break;
|
|
2748
2748
|
}
|
|
2749
2749
|
if (!requestInstance.unsubscribe) {
|
|
2750
|
-
_context2.next =
|
|
2750
|
+
_context2.next = 1;
|
|
2751
2751
|
break;
|
|
2752
2752
|
}
|
|
2753
2753
|
return _context2.abrupt("return", next());
|
|
2754
|
-
case
|
|
2755
|
-
_context2.next =
|
|
2754
|
+
case 1:
|
|
2755
|
+
_context2.next = 2;
|
|
2756
2756
|
return new Promise(function (resolve) {
|
|
2757
2757
|
return setTimeout(function () {
|
|
2758
2758
|
return resolve();
|
|
2759
2759
|
}, _this2.pollInterval * 1000);
|
|
2760
2760
|
});
|
|
2761
|
-
case
|
|
2761
|
+
case 2:
|
|
2762
2762
|
return _context2.abrupt("return", next());
|
|
2763
|
-
case
|
|
2763
|
+
case 3:
|
|
2764
2764
|
return _context2.abrupt("return", null);
|
|
2765
|
-
case
|
|
2765
|
+
case 4:
|
|
2766
2766
|
case "end":
|
|
2767
2767
|
return _context2.stop();
|
|
2768
2768
|
}
|
|
@@ -2776,29 +2776,29 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2776
2776
|
var _ref4 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
2777
2777
|
var wait,
|
|
2778
2778
|
_args3 = arguments;
|
|
2779
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2779
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context3) {
|
|
2780
2780
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2781
2781
|
case 0:
|
|
2782
2782
|
wait = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
2783
2783
|
if (unsubscribed) {
|
|
2784
|
-
_context3.next =
|
|
2784
|
+
_context3.next = 2;
|
|
2785
2785
|
break;
|
|
2786
2786
|
}
|
|
2787
2787
|
if (!wait) {
|
|
2788
|
-
_context3.next =
|
|
2788
|
+
_context3.next = 1;
|
|
2789
2789
|
break;
|
|
2790
2790
|
}
|
|
2791
|
-
_context3.next =
|
|
2791
|
+
_context3.next = 1;
|
|
2792
2792
|
return new Promise(function (resolve) {
|
|
2793
2793
|
return setTimeout(function () {
|
|
2794
2794
|
return resolve();
|
|
2795
2795
|
}, _this2.pollInterval * 1000);
|
|
2796
2796
|
});
|
|
2797
|
-
case
|
|
2797
|
+
case 1:
|
|
2798
2798
|
return _context3.abrupt("return", next());
|
|
2799
|
-
case
|
|
2799
|
+
case 2:
|
|
2800
2800
|
return _context3.abrupt("return", null);
|
|
2801
|
-
case
|
|
2801
|
+
case 3:
|
|
2802
2802
|
case "end":
|
|
2803
2803
|
return _context3.stop();
|
|
2804
2804
|
}
|
|
@@ -2809,105 +2809,105 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2809
2809
|
};
|
|
2810
2810
|
}();
|
|
2811
2811
|
if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.subscribe && !skipAuthorizationUpdate)) {
|
|
2812
|
-
_context4.next =
|
|
2812
|
+
_context4.next = 2;
|
|
2813
2813
|
break;
|
|
2814
2814
|
}
|
|
2815
|
-
_context4.next =
|
|
2815
|
+
_context4.next = 2;
|
|
2816
2816
|
return _this2.updateTransportAuthorization();
|
|
2817
|
-
case
|
|
2817
|
+
case 2:
|
|
2818
2818
|
skipAuthorizationUpdate = false;
|
|
2819
2819
|
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)) {
|
|
2820
|
-
_context4.next =
|
|
2820
|
+
_context4.next = 4;
|
|
2821
2821
|
break;
|
|
2822
2822
|
}
|
|
2823
|
-
_context4.next =
|
|
2823
|
+
_context4.next = 3;
|
|
2824
2824
|
return checkMutex();
|
|
2825
|
-
case
|
|
2825
|
+
case 3:
|
|
2826
2826
|
return _context4.abrupt("return", continueWait(true));
|
|
2827
|
-
case
|
|
2827
|
+
case 4:
|
|
2828
2828
|
// From here we're sure that response is only fetch Response
|
|
2829
2829
|
response = response;
|
|
2830
2830
|
body = {};
|
|
2831
2831
|
text = '';
|
|
2832
|
-
_context4.prev =
|
|
2833
|
-
_context4.next =
|
|
2832
|
+
_context4.prev = 5;
|
|
2833
|
+
_context4.next = 6;
|
|
2834
2834
|
return response.text();
|
|
2835
|
-
case
|
|
2835
|
+
case 6:
|
|
2836
2836
|
text = _context4.sent;
|
|
2837
2837
|
body = JSON.parse(text);
|
|
2838
|
-
_context4.next =
|
|
2838
|
+
_context4.next = 8;
|
|
2839
2839
|
break;
|
|
2840
|
-
case
|
|
2841
|
-
_context4.prev =
|
|
2842
|
-
_context4
|
|
2840
|
+
case 7:
|
|
2841
|
+
_context4.prev = 7;
|
|
2842
|
+
_context4["catch"](5);
|
|
2843
2843
|
body.error = text;
|
|
2844
|
-
case
|
|
2844
|
+
case 8:
|
|
2845
2845
|
if (!(body.error === 'Continue wait')) {
|
|
2846
|
-
_context4.next =
|
|
2846
|
+
_context4.next = 10;
|
|
2847
2847
|
break;
|
|
2848
2848
|
}
|
|
2849
|
-
_context4.next =
|
|
2849
|
+
_context4.next = 9;
|
|
2850
2850
|
return checkMutex();
|
|
2851
|
-
case
|
|
2851
|
+
case 9:
|
|
2852
2852
|
if ((_options3 = options) !== null && _options3 !== void 0 && _options3.progressCallback) {
|
|
2853
2853
|
options.progressCallback(new ProgressResult(body));
|
|
2854
2854
|
}
|
|
2855
2855
|
return _context4.abrupt("return", continueWait());
|
|
2856
|
-
case
|
|
2856
|
+
case 10:
|
|
2857
2857
|
if (!(response.status !== 200)) {
|
|
2858
|
-
_context4.next =
|
|
2858
|
+
_context4.next = 15;
|
|
2859
2859
|
break;
|
|
2860
2860
|
}
|
|
2861
|
-
_context4.next =
|
|
2861
|
+
_context4.next = 11;
|
|
2862
2862
|
return checkMutex();
|
|
2863
|
-
case
|
|
2863
|
+
case 11:
|
|
2864
2864
|
if (!(!((_options4 = options) !== null && _options4 !== void 0 && _options4.subscribe) && requestInstance.unsubscribe)) {
|
|
2865
|
-
_context4.next =
|
|
2865
|
+
_context4.next = 12;
|
|
2866
2866
|
break;
|
|
2867
2867
|
}
|
|
2868
|
-
_context4.next =
|
|
2868
|
+
_context4.next = 12;
|
|
2869
2869
|
return requestInstance.unsubscribe();
|
|
2870
|
-
case
|
|
2870
|
+
case 12:
|
|
2871
2871
|
_error = new RequestError(body.error || response.error || '', body, response.status);
|
|
2872
2872
|
if (!callback) {
|
|
2873
|
-
_context4.next =
|
|
2873
|
+
_context4.next = 13;
|
|
2874
2874
|
break;
|
|
2875
2875
|
}
|
|
2876
2876
|
callback(_error);
|
|
2877
|
-
_context4.next =
|
|
2877
|
+
_context4.next = 14;
|
|
2878
2878
|
break;
|
|
2879
|
-
case
|
|
2879
|
+
case 13:
|
|
2880
2880
|
throw _error;
|
|
2881
|
-
case
|
|
2881
|
+
case 14:
|
|
2882
2882
|
return _context4.abrupt("return", subscribeNext());
|
|
2883
|
-
case
|
|
2884
|
-
_context4.next =
|
|
2883
|
+
case 15:
|
|
2884
|
+
_context4.next = 16;
|
|
2885
2885
|
return checkMutex();
|
|
2886
|
-
case
|
|
2886
|
+
case 16:
|
|
2887
2887
|
if (!(!((_options5 = options) !== null && _options5 !== void 0 && _options5.subscribe) && requestInstance.unsubscribe)) {
|
|
2888
|
-
_context4.next =
|
|
2888
|
+
_context4.next = 17;
|
|
2889
2889
|
break;
|
|
2890
2890
|
}
|
|
2891
|
-
_context4.next =
|
|
2891
|
+
_context4.next = 17;
|
|
2892
2892
|
return requestInstance.unsubscribe();
|
|
2893
|
-
case
|
|
2893
|
+
case 17:
|
|
2894
2894
|
result = toResult(body);
|
|
2895
2895
|
if (!callback) {
|
|
2896
|
-
_context4.next =
|
|
2896
|
+
_context4.next = 18;
|
|
2897
2897
|
break;
|
|
2898
2898
|
}
|
|
2899
2899
|
callback(null, result);
|
|
2900
|
-
_context4.next =
|
|
2900
|
+
_context4.next = 19;
|
|
2901
2901
|
break;
|
|
2902
|
-
case
|
|
2902
|
+
case 18:
|
|
2903
2903
|
return _context4.abrupt("return", result);
|
|
2904
|
-
case
|
|
2904
|
+
case 19:
|
|
2905
2905
|
return _context4.abrupt("return", subscribeNext());
|
|
2906
|
-
case
|
|
2906
|
+
case 20:
|
|
2907
2907
|
case "end":
|
|
2908
2908
|
return _context4.stop();
|
|
2909
2909
|
}
|
|
2910
|
-
}, _callee4, null, [[
|
|
2910
|
+
}, _callee4, null, [[5, 7]]);
|
|
2911
2911
|
}));
|
|
2912
2912
|
return function loadImpl(_x, _x2) {
|
|
2913
2913
|
return _ref2.apply(this, arguments);
|
|
@@ -2921,22 +2921,22 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2921
2921
|
unsubscribe: function () {
|
|
2922
2922
|
var _unsubscribe = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5() {
|
|
2923
2923
|
var requestInstance;
|
|
2924
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2924
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context5) {
|
|
2925
2925
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2926
2926
|
case 0:
|
|
2927
|
-
_context5.next =
|
|
2927
|
+
_context5.next = 1;
|
|
2928
2928
|
return requestPromise;
|
|
2929
|
-
case
|
|
2929
|
+
case 1:
|
|
2930
2930
|
requestInstance = _context5.sent;
|
|
2931
2931
|
unsubscribed = true;
|
|
2932
2932
|
if (!requestInstance.unsubscribe) {
|
|
2933
|
-
_context5.next =
|
|
2933
|
+
_context5.next = 2;
|
|
2934
2934
|
break;
|
|
2935
2935
|
}
|
|
2936
2936
|
return _context5.abrupt("return", requestInstance.unsubscribe());
|
|
2937
|
-
case
|
|
2937
|
+
case 2:
|
|
2938
2938
|
return _context5.abrupt("return", null);
|
|
2939
|
-
case
|
|
2939
|
+
case 3:
|
|
2940
2940
|
case "end":
|
|
2941
2941
|
return _context5.stop();
|
|
2942
2942
|
}
|
|
@@ -2958,50 +2958,50 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
2958
2958
|
var _updateTransportAuthorization = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
|
|
2959
2959
|
var _this3 = this;
|
|
2960
2960
|
var tokenFetcher, promise;
|
|
2961
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2961
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context7) {
|
|
2962
2962
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2963
2963
|
case 0:
|
|
2964
2964
|
if (!this.updateAuthorizationPromise) {
|
|
2965
|
-
_context7.next =
|
|
2965
|
+
_context7.next = 2;
|
|
2966
2966
|
break;
|
|
2967
2967
|
}
|
|
2968
|
-
_context7.next =
|
|
2968
|
+
_context7.next = 1;
|
|
2969
2969
|
return this.updateAuthorizationPromise;
|
|
2970
|
-
case
|
|
2970
|
+
case 1:
|
|
2971
2971
|
return _context7.abrupt("return");
|
|
2972
|
-
case
|
|
2972
|
+
case 2:
|
|
2973
2973
|
tokenFetcher = this.apiToken;
|
|
2974
2974
|
if (!(typeof tokenFetcher === 'function')) {
|
|
2975
|
-
_context7.next =
|
|
2975
|
+
_context7.next = 3;
|
|
2976
2976
|
break;
|
|
2977
2977
|
}
|
|
2978
2978
|
promise = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6() {
|
|
2979
2979
|
var token;
|
|
2980
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2980
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context6) {
|
|
2981
2981
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2982
2982
|
case 0:
|
|
2983
2983
|
_context6.prev = 0;
|
|
2984
|
-
_context6.next =
|
|
2984
|
+
_context6.next = 1;
|
|
2985
2985
|
return tokenFetcher();
|
|
2986
|
-
case
|
|
2986
|
+
case 1:
|
|
2987
2987
|
token = _context6.sent;
|
|
2988
2988
|
if (_this3.transport.authorization !== token) {
|
|
2989
2989
|
_this3.transport.authorization = token;
|
|
2990
2990
|
}
|
|
2991
|
-
case
|
|
2992
|
-
_context6.prev =
|
|
2991
|
+
case 2:
|
|
2992
|
+
_context6.prev = 2;
|
|
2993
2993
|
_this3.updateAuthorizationPromise = null;
|
|
2994
|
-
return _context6.finish(
|
|
2995
|
-
case
|
|
2994
|
+
return _context6.finish(2);
|
|
2995
|
+
case 3:
|
|
2996
2996
|
case "end":
|
|
2997
2997
|
return _context6.stop();
|
|
2998
2998
|
}
|
|
2999
|
-
}, _callee6, null, [[0,,
|
|
2999
|
+
}, _callee6, null, [[0,, 2, 3]]);
|
|
3000
3000
|
}))();
|
|
3001
3001
|
this.updateAuthorizationPromise = promise;
|
|
3002
|
-
_context7.next =
|
|
3002
|
+
_context7.next = 3;
|
|
3003
3003
|
return promise;
|
|
3004
|
-
case
|
|
3004
|
+
case 3:
|
|
3005
3005
|
case "end":
|
|
3006
3006
|
return _context7.stop();
|
|
3007
3007
|
}
|
|
@@ -3257,9 +3257,9 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
3257
3257
|
* Execute a Cube SQL query against Cube SQL interface and return the results.
|
|
3258
3258
|
*/
|
|
3259
3259
|
function cubeSql(sqlQuery, options, callback) {
|
|
3260
|
-
var
|
|
3260
|
+
var _this0 = this;
|
|
3261
3261
|
return this.loadMethod(function () {
|
|
3262
|
-
var request =
|
|
3262
|
+
var request = _this0.request('cubesql', {
|
|
3263
3263
|
query: sqlQuery,
|
|
3264
3264
|
cache: options === null || options === void 0 ? void 0 : options.cache,
|
|
3265
3265
|
method: 'POST',
|
|
@@ -3284,7 +3284,7 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
3284
3284
|
var _response$error$split = response.error.split('\n'),
|
|
3285
3285
|
_response$error$split2 = _toArray__default['default'](_response$error$split),
|
|
3286
3286
|
schema = _response$error$split2[0],
|
|
3287
|
-
data = _response$error$split2.slice(1);
|
|
3287
|
+
data = _arrayLikeToArray(_response$error$split2).slice(1);
|
|
3288
3288
|
try {
|
|
3289
3289
|
return {
|
|
3290
3290
|
schema: JSON.parse(schema).schema,
|
|
@@ -3311,16 +3311,16 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
3311
3311
|
value: function cubeSqlStream(sqlQuery, options) {
|
|
3312
3312
|
var _this = this;
|
|
3313
3313
|
return _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
|
|
3314
|
-
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator2, _step2, line, parsed, _parsed;
|
|
3315
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
3314
|
+
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator2, _step2, line, parsed, _parsed, _t3, _t4, _t6;
|
|
3315
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context8) {
|
|
3316
3316
|
while (1) switch (_context8.prev = _context8.next) {
|
|
3317
3317
|
case 0:
|
|
3318
3318
|
if (_this.transport.requestStream) {
|
|
3319
|
-
_context8.next =
|
|
3319
|
+
_context8.next = 1;
|
|
3320
3320
|
break;
|
|
3321
3321
|
}
|
|
3322
3322
|
throw new Error('Transport does not support streaming');
|
|
3323
|
-
case
|
|
3323
|
+
case 1:
|
|
3324
3324
|
streamResponse = _this.transport.requestStream('cubesql', {
|
|
3325
3325
|
method: 'POST',
|
|
3326
3326
|
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
@@ -3333,21 +3333,21 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
3333
3333
|
});
|
|
3334
3334
|
decoder = new TextDecoder();
|
|
3335
3335
|
buffer = '';
|
|
3336
|
-
_context8.prev =
|
|
3337
|
-
_context8.next =
|
|
3336
|
+
_context8.prev = 2;
|
|
3337
|
+
_context8.next = 3;
|
|
3338
3338
|
return _awaitAsyncGenerator__default['default'](streamResponse.stream());
|
|
3339
|
-
case
|
|
3339
|
+
case 3:
|
|
3340
3340
|
stream = _context8.sent;
|
|
3341
3341
|
_iteratorAbruptCompletion = false;
|
|
3342
3342
|
_didIteratorError = false;
|
|
3343
|
-
_context8.prev =
|
|
3343
|
+
_context8.prev = 4;
|
|
3344
3344
|
_iterator = _asyncIterator(stream);
|
|
3345
|
-
case
|
|
3346
|
-
_context8.next =
|
|
3345
|
+
case 5:
|
|
3346
|
+
_context8.next = 6;
|
|
3347
3347
|
return _awaitAsyncGenerator__default['default'](_iterator.next());
|
|
3348
|
-
case
|
|
3348
|
+
case 6:
|
|
3349
3349
|
if (!(_iteratorAbruptCompletion = !(_step = _context8.sent).done)) {
|
|
3350
|
-
_context8.next =
|
|
3350
|
+
_context8.next = 21;
|
|
3351
3351
|
break;
|
|
3352
3352
|
}
|
|
3353
3353
|
chunk = _step.value;
|
|
@@ -3357,193 +3357,193 @@ var CubeApi = /*#__PURE__*/function () {
|
|
|
3357
3357
|
lines = buffer.split('\n');
|
|
3358
3358
|
buffer = lines.pop() || '';
|
|
3359
3359
|
_iterator2 = _createForOfIteratorHelper(lines);
|
|
3360
|
-
_context8.prev =
|
|
3360
|
+
_context8.prev = 7;
|
|
3361
3361
|
_iterator2.s();
|
|
3362
|
-
case
|
|
3362
|
+
case 8:
|
|
3363
3363
|
if ((_step2 = _iterator2.n()).done) {
|
|
3364
|
-
_context8.next =
|
|
3364
|
+
_context8.next = 17;
|
|
3365
3365
|
break;
|
|
3366
3366
|
}
|
|
3367
3367
|
line = _step2.value;
|
|
3368
3368
|
if (!line.trim()) {
|
|
3369
|
-
_context8.next =
|
|
3369
|
+
_context8.next = 16;
|
|
3370
3370
|
break;
|
|
3371
3371
|
}
|
|
3372
|
-
_context8.prev =
|
|
3372
|
+
_context8.prev = 9;
|
|
3373
3373
|
parsed = JSON.parse(line);
|
|
3374
3374
|
if (!parsed.schema) {
|
|
3375
|
-
_context8.next =
|
|
3375
|
+
_context8.next = 11;
|
|
3376
3376
|
break;
|
|
3377
3377
|
}
|
|
3378
|
-
_context8.next =
|
|
3378
|
+
_context8.next = 10;
|
|
3379
3379
|
return {
|
|
3380
3380
|
type: 'schema',
|
|
3381
3381
|
schema: parsed.schema
|
|
3382
3382
|
};
|
|
3383
|
-
case
|
|
3384
|
-
_context8.next =
|
|
3383
|
+
case 10:
|
|
3384
|
+
_context8.next = 14;
|
|
3385
3385
|
break;
|
|
3386
|
-
case
|
|
3386
|
+
case 11:
|
|
3387
3387
|
if (!parsed.data) {
|
|
3388
|
-
_context8.next =
|
|
3388
|
+
_context8.next = 13;
|
|
3389
3389
|
break;
|
|
3390
3390
|
}
|
|
3391
|
-
_context8.next =
|
|
3391
|
+
_context8.next = 12;
|
|
3392
3392
|
return {
|
|
3393
3393
|
type: 'data',
|
|
3394
3394
|
data: parsed.data
|
|
3395
3395
|
};
|
|
3396
|
-
case
|
|
3397
|
-
_context8.next =
|
|
3396
|
+
case 12:
|
|
3397
|
+
_context8.next = 14;
|
|
3398
3398
|
break;
|
|
3399
|
-
case
|
|
3399
|
+
case 13:
|
|
3400
3400
|
if (!parsed.error) {
|
|
3401
|
-
_context8.next =
|
|
3401
|
+
_context8.next = 14;
|
|
3402
3402
|
break;
|
|
3403
3403
|
}
|
|
3404
|
-
_context8.next =
|
|
3404
|
+
_context8.next = 14;
|
|
3405
3405
|
return {
|
|
3406
3406
|
type: 'error',
|
|
3407
3407
|
error: parsed.error
|
|
3408
3408
|
};
|
|
3409
|
-
case
|
|
3410
|
-
_context8.next =
|
|
3409
|
+
case 14:
|
|
3410
|
+
_context8.next = 16;
|
|
3411
3411
|
break;
|
|
3412
|
-
case
|
|
3413
|
-
_context8.prev =
|
|
3414
|
-
_context8
|
|
3415
|
-
_context8.next =
|
|
3412
|
+
case 15:
|
|
3413
|
+
_context8.prev = 15;
|
|
3414
|
+
_context8["catch"](9);
|
|
3415
|
+
_context8.next = 16;
|
|
3416
3416
|
return {
|
|
3417
3417
|
type: 'error',
|
|
3418
3418
|
error: "Failed to parse JSON line: ".concat(line)
|
|
3419
3419
|
};
|
|
3420
|
-
case
|
|
3421
|
-
_context8.next =
|
|
3420
|
+
case 16:
|
|
3421
|
+
_context8.next = 8;
|
|
3422
3422
|
break;
|
|
3423
|
-
case
|
|
3424
|
-
_context8.next =
|
|
3423
|
+
case 17:
|
|
3424
|
+
_context8.next = 19;
|
|
3425
3425
|
break;
|
|
3426
|
-
case
|
|
3427
|
-
_context8.prev =
|
|
3428
|
-
|
|
3429
|
-
_iterator2.e(
|
|
3430
|
-
case
|
|
3431
|
-
_context8.prev =
|
|
3426
|
+
case 18:
|
|
3427
|
+
_context8.prev = 18;
|
|
3428
|
+
_t3 = _context8["catch"](7);
|
|
3429
|
+
_iterator2.e(_t3);
|
|
3430
|
+
case 19:
|
|
3431
|
+
_context8.prev = 19;
|
|
3432
3432
|
_iterator2.f();
|
|
3433
|
-
return _context8.finish(
|
|
3434
|
-
case
|
|
3433
|
+
return _context8.finish(19);
|
|
3434
|
+
case 20:
|
|
3435
3435
|
_iteratorAbruptCompletion = false;
|
|
3436
|
-
_context8.next =
|
|
3436
|
+
_context8.next = 5;
|
|
3437
3437
|
break;
|
|
3438
|
-
case
|
|
3439
|
-
_context8.next =
|
|
3438
|
+
case 21:
|
|
3439
|
+
_context8.next = 23;
|
|
3440
3440
|
break;
|
|
3441
|
-
case
|
|
3442
|
-
_context8.prev =
|
|
3443
|
-
|
|
3441
|
+
case 22:
|
|
3442
|
+
_context8.prev = 22;
|
|
3443
|
+
_t4 = _context8["catch"](4);
|
|
3444
3444
|
_didIteratorError = true;
|
|
3445
|
-
_iteratorError =
|
|
3446
|
-
case
|
|
3447
|
-
_context8.prev =
|
|
3448
|
-
_context8.prev =
|
|
3445
|
+
_iteratorError = _t4;
|
|
3446
|
+
case 23:
|
|
3447
|
+
_context8.prev = 23;
|
|
3448
|
+
_context8.prev = 24;
|
|
3449
3449
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
3450
|
-
_context8.next =
|
|
3450
|
+
_context8.next = 25;
|
|
3451
3451
|
break;
|
|
3452
3452
|
}
|
|
3453
|
-
_context8.next =
|
|
3453
|
+
_context8.next = 25;
|
|
3454
3454
|
return _awaitAsyncGenerator__default['default'](_iterator["return"]());
|
|
3455
|
-
case
|
|
3456
|
-
_context8.prev =
|
|
3455
|
+
case 25:
|
|
3456
|
+
_context8.prev = 25;
|
|
3457
3457
|
if (!_didIteratorError) {
|
|
3458
|
-
_context8.next =
|
|
3458
|
+
_context8.next = 26;
|
|
3459
3459
|
break;
|
|
3460
3460
|
}
|
|
3461
3461
|
throw _iteratorError;
|
|
3462
|
-
case
|
|
3463
|
-
return _context8.finish(
|
|
3464
|
-
case
|
|
3465
|
-
return _context8.finish(
|
|
3466
|
-
case
|
|
3462
|
+
case 26:
|
|
3463
|
+
return _context8.finish(25);
|
|
3464
|
+
case 27:
|
|
3465
|
+
return _context8.finish(23);
|
|
3466
|
+
case 28:
|
|
3467
3467
|
if (!buffer.trim()) {
|
|
3468
|
-
_context8.next =
|
|
3468
|
+
_context8.next = 36;
|
|
3469
3469
|
break;
|
|
3470
3470
|
}
|
|
3471
|
-
_context8.prev =
|
|
3471
|
+
_context8.prev = 29;
|
|
3472
3472
|
_parsed = JSON.parse(buffer);
|
|
3473
3473
|
if (!_parsed.schema) {
|
|
3474
|
-
_context8.next =
|
|
3474
|
+
_context8.next = 31;
|
|
3475
3475
|
break;
|
|
3476
3476
|
}
|
|
3477
|
-
_context8.next =
|
|
3477
|
+
_context8.next = 30;
|
|
3478
3478
|
return {
|
|
3479
3479
|
type: 'schema',
|
|
3480
3480
|
schema: _parsed.schema
|
|
3481
3481
|
};
|
|
3482
|
-
case
|
|
3483
|
-
_context8.next =
|
|
3482
|
+
case 30:
|
|
3483
|
+
_context8.next = 34;
|
|
3484
3484
|
break;
|
|
3485
|
-
case
|
|
3485
|
+
case 31:
|
|
3486
3486
|
if (!_parsed.data) {
|
|
3487
|
-
_context8.next =
|
|
3487
|
+
_context8.next = 33;
|
|
3488
3488
|
break;
|
|
3489
3489
|
}
|
|
3490
|
-
_context8.next =
|
|
3490
|
+
_context8.next = 32;
|
|
3491
3491
|
return {
|
|
3492
3492
|
type: 'data',
|
|
3493
3493
|
data: _parsed.data
|
|
3494
3494
|
};
|
|
3495
|
-
case
|
|
3496
|
-
_context8.next =
|
|
3495
|
+
case 32:
|
|
3496
|
+
_context8.next = 34;
|
|
3497
3497
|
break;
|
|
3498
|
-
case
|
|
3498
|
+
case 33:
|
|
3499
3499
|
if (!_parsed.error) {
|
|
3500
|
-
_context8.next =
|
|
3500
|
+
_context8.next = 34;
|
|
3501
3501
|
break;
|
|
3502
3502
|
}
|
|
3503
|
-
_context8.next =
|
|
3503
|
+
_context8.next = 34;
|
|
3504
3504
|
return {
|
|
3505
3505
|
type: 'error',
|
|
3506
3506
|
error: _parsed.error
|
|
3507
3507
|
};
|
|
3508
|
-
case
|
|
3509
|
-
_context8.next =
|
|
3508
|
+
case 34:
|
|
3509
|
+
_context8.next = 36;
|
|
3510
3510
|
break;
|
|
3511
|
-
case
|
|
3512
|
-
_context8.prev =
|
|
3513
|
-
_context8
|
|
3514
|
-
_context8.next =
|
|
3511
|
+
case 35:
|
|
3512
|
+
_context8.prev = 35;
|
|
3513
|
+
_context8["catch"](29);
|
|
3514
|
+
_context8.next = 36;
|
|
3515
3515
|
return {
|
|
3516
3516
|
type: 'error',
|
|
3517
3517
|
error: "Failed to parse remaining JSON: ".concat(buffer)
|
|
3518
3518
|
};
|
|
3519
|
-
case
|
|
3520
|
-
_context8.next =
|
|
3519
|
+
case 36:
|
|
3520
|
+
_context8.next = 39;
|
|
3521
3521
|
break;
|
|
3522
|
-
case
|
|
3523
|
-
_context8.prev =
|
|
3524
|
-
|
|
3525
|
-
if (!(
|
|
3526
|
-
_context8.next =
|
|
3522
|
+
case 37:
|
|
3523
|
+
_context8.prev = 37;
|
|
3524
|
+
_t6 = _context8["catch"](2);
|
|
3525
|
+
if (!(_t6.name === 'AbortError')) {
|
|
3526
|
+
_context8.next = 38;
|
|
3527
3527
|
break;
|
|
3528
3528
|
}
|
|
3529
3529
|
throw new Error('aborted');
|
|
3530
|
-
case
|
|
3531
|
-
throw
|
|
3532
|
-
case
|
|
3533
|
-
_context8.prev =
|
|
3530
|
+
case 38:
|
|
3531
|
+
throw _t6;
|
|
3532
|
+
case 39:
|
|
3533
|
+
_context8.prev = 39;
|
|
3534
3534
|
if (!streamResponse.unsubscribe) {
|
|
3535
|
-
_context8.next =
|
|
3535
|
+
_context8.next = 40;
|
|
3536
3536
|
break;
|
|
3537
3537
|
}
|
|
3538
|
-
_context8.next =
|
|
3538
|
+
_context8.next = 40;
|
|
3539
3539
|
return _awaitAsyncGenerator__default['default'](streamResponse.unsubscribe());
|
|
3540
|
-
case
|
|
3541
|
-
return _context8.finish(
|
|
3542
|
-
case
|
|
3540
|
+
case 40:
|
|
3541
|
+
return _context8.finish(39);
|
|
3542
|
+
case 41:
|
|
3543
3543
|
case "end":
|
|
3544
3544
|
return _context8.stop();
|
|
3545
3545
|
}
|
|
3546
|
-
}, _callee8, null, [[
|
|
3546
|
+
}, _callee8, null, [[2, 37, 39, 41], [4, 22, 23, 28], [7, 18, 19, 20], [9, 15], [24,, 25, 27], [29, 35]]);
|
|
3547
3547
|
}))();
|
|
3548
3548
|
}
|
|
3549
3549
|
}]);
|