@cubejs-client/core 1.5.10 → 1.5.12
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.
- package/dist/cubejs-client-core.cjs.js +346 -340
- package/dist/cubejs-client-core.cjs.js.map +1 -1
- package/dist/cubejs-client-core.umd.js +346 -340
- package/dist/cubejs-client-core.umd.js.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -8
- package/dist/src/types.d.ts +16 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/test/CubeApi.test.js +161 -0
- package/package.json +4 -3
|
@@ -514,9 +514,9 @@
|
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
516
|
if ((newChartType === 'pie' || newChartType === 'table' || newChartType === 'number') && (oldQuery.timeDimensions || []).length === 1 && oldQuery.timeDimensions[0].granularity) {
|
|
517
|
-
var
|
|
518
|
-
|
|
519
|
-
_td2 =
|
|
517
|
+
var _ref0 = oldQuery.timeDimensions,
|
|
518
|
+
_ref1 = _slicedToArray__default['default'](_ref0, 1),
|
|
519
|
+
_td2 = _ref1[0];
|
|
520
520
|
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
521
521
|
pivotConfig: null,
|
|
522
522
|
shouldApplyHeuristicOrder: true,
|
|
@@ -603,10 +603,10 @@
|
|
|
603
603
|
var indexedOrderMembers = ramda.indexBy(ramda.prop('id'), orderMembers);
|
|
604
604
|
var entries = Array.isArray(order) ? order : Object.entries(order || {});
|
|
605
605
|
var nextOrderMembers = [];
|
|
606
|
-
entries.forEach(function (
|
|
607
|
-
var
|
|
608
|
-
memberId =
|
|
609
|
-
currentOrder =
|
|
606
|
+
entries.forEach(function (_ref10) {
|
|
607
|
+
var _ref11 = _slicedToArray__default['default'](_ref10, 2),
|
|
608
|
+
memberId = _ref11[0],
|
|
609
|
+
currentOrder = _ref11[1];
|
|
610
610
|
if (currentOrder !== 'none' && indexedOrderMembers[memberId]) {
|
|
611
611
|
ids.add(memberId);
|
|
612
612
|
nextOrderMembers.push(_objectSpread$3(_objectSpread$3({}, indexedOrderMembers[memberId]), {}, {
|
|
@@ -912,9 +912,9 @@
|
|
|
912
912
|
title: title,
|
|
913
913
|
shortTitle: shortTitle,
|
|
914
914
|
key: key,
|
|
915
|
-
series: _this.chartPivot(pivotConfig).map(function (
|
|
916
|
-
var x =
|
|
917
|
-
obj = _objectWithoutProperties__default['default'](
|
|
915
|
+
series: _this.chartPivot(pivotConfig).map(function (_ref0) {
|
|
916
|
+
var x = _ref0.x,
|
|
917
|
+
obj = _objectWithoutProperties__default['default'](_ref0, _excluded$1);
|
|
918
918
|
return {
|
|
919
919
|
value: obj[key],
|
|
920
920
|
x: x
|
|
@@ -1057,8 +1057,8 @@
|
|
|
1057
1057
|
var query = this.loadResponse.pivotQuery;
|
|
1058
1058
|
var pivotImpl = function pivotImpl() {
|
|
1059
1059
|
var resultIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1060
|
-
var groupByXAxis = groupByToPairs(function (
|
|
1061
|
-
var xValues =
|
|
1060
|
+
var groupByXAxis = groupByToPairs(function (_ref1) {
|
|
1061
|
+
var xValues = _ref1.xValues;
|
|
1062
1062
|
return _this2.axisValuesString(xValues);
|
|
1063
1063
|
});
|
|
1064
1064
|
var measureValue = function measureValue(row, measure) {
|
|
@@ -1075,8 +1075,8 @@
|
|
|
1075
1075
|
if (series[0]) {
|
|
1076
1076
|
groupByXAxis = function groupByXAxis(rows) {
|
|
1077
1077
|
var _series$resultIndex$m, _series$resultIndex;
|
|
1078
|
-
var byXValues = ramda.groupBy(function (
|
|
1079
|
-
var xValues =
|
|
1078
|
+
var byXValues = ramda.groupBy(function (_ref10) {
|
|
1079
|
+
var xValues = _ref10.xValues;
|
|
1080
1080
|
return xValues[0];
|
|
1081
1081
|
}, rows);
|
|
1082
1082
|
return (_series$resultIndex$m = (_series$resultIndex = series[resultIndex]) === null || _series$resultIndex === void 0 ? void 0 : _series$resultIndex.map(function (d) {
|
|
@@ -1097,11 +1097,11 @@
|
|
|
1097
1097
|
});
|
|
1098
1098
|
}), unnest, groupByXAxis)(_this2.timeDimensionBackwardCompatibleData(resultIndex));
|
|
1099
1099
|
var yValuesMap = {};
|
|
1100
|
-
xGrouped.forEach(function (
|
|
1101
|
-
var
|
|
1102
|
-
rows =
|
|
1103
|
-
rows.forEach(function (
|
|
1104
|
-
var row =
|
|
1100
|
+
xGrouped.forEach(function (_ref11) {
|
|
1101
|
+
var _ref12 = _slicedToArray__default['default'](_ref11, 2),
|
|
1102
|
+
rows = _ref12[1];
|
|
1103
|
+
rows.forEach(function (_ref13) {
|
|
1104
|
+
var row = _ref13.row;
|
|
1105
1105
|
_this2.axisValues(normalizedPivotConfig.y, resultIndex)(row).forEach(function (values) {
|
|
1106
1106
|
if (Object.keys(row).length > 0) {
|
|
1107
1107
|
yValuesMap[values.join()] = values;
|
|
@@ -1113,13 +1113,13 @@
|
|
|
1113
1113
|
var measureOnX = Boolean(normalizedPivotConfig.x.find(function (d) {
|
|
1114
1114
|
return d === 'measures';
|
|
1115
1115
|
}));
|
|
1116
|
-
return xGrouped.map(function (
|
|
1117
|
-
var
|
|
1118
|
-
rows =
|
|
1116
|
+
return xGrouped.map(function (_ref14) {
|
|
1117
|
+
var _ref15 = _slicedToArray__default['default'](_ref14, 2),
|
|
1118
|
+
rows = _ref15[1];
|
|
1119
1119
|
var xValues = rows[0].xValues;
|
|
1120
1120
|
var yGrouped = {};
|
|
1121
|
-
rows.forEach(function (
|
|
1122
|
-
var row =
|
|
1121
|
+
rows.forEach(function (_ref16) {
|
|
1122
|
+
var row = _ref16.row;
|
|
1123
1123
|
var arr = _this2.axisValues(normalizedPivotConfig.y, resultIndex)(row).map(function (yValues) {
|
|
1124
1124
|
return {
|
|
1125
1125
|
yValues: yValues,
|
|
@@ -1261,9 +1261,9 @@
|
|
|
1261
1261
|
};
|
|
1262
1262
|
var duplicateMeasures = new Set();
|
|
1263
1263
|
if (this.queryType === QUERY_TYPE.BLENDING_QUERY) {
|
|
1264
|
-
var allMeasures = ramda.flatten(this.loadResponses.map(function (
|
|
1264
|
+
var allMeasures = ramda.flatten(this.loadResponses.map(function (_ref17) {
|
|
1265
1265
|
var _query$measures;
|
|
1266
|
-
var query =
|
|
1266
|
+
var query = _ref17.query;
|
|
1267
1267
|
return (_query$measures = query.measures) !== null && _query$measures !== void 0 ? _query$measures : [];
|
|
1268
1268
|
}));
|
|
1269
1269
|
allMeasures.filter(function (e, i, a) {
|
|
@@ -1272,14 +1272,14 @@
|
|
|
1272
1272
|
return duplicateMeasures.add(m);
|
|
1273
1273
|
});
|
|
1274
1274
|
}
|
|
1275
|
-
return this.pivot(pivotConfig).map(function (
|
|
1276
|
-
var xValues =
|
|
1277
|
-
yValuesArray =
|
|
1275
|
+
return this.pivot(pivotConfig).map(function (_ref18) {
|
|
1276
|
+
var xValues = _ref18.xValues,
|
|
1277
|
+
yValuesArray = _ref18.yValuesArray;
|
|
1278
1278
|
var yValuesMap = {};
|
|
1279
|
-
yValuesArray.forEach(function (
|
|
1280
|
-
var
|
|
1281
|
-
yValues =
|
|
1282
|
-
m =
|
|
1279
|
+
yValuesArray.forEach(function (_ref19, i) {
|
|
1280
|
+
var _ref20 = _slicedToArray__default['default'](_ref19, 2),
|
|
1281
|
+
yValues = _ref20[0],
|
|
1282
|
+
m = _ref20[1];
|
|
1283
1283
|
yValuesMap[_this3.axisValuesString(aliasSeries(yValues, i, pivotConfig, duplicateMeasures), ',')] = m && validate(m);
|
|
1284
1284
|
});
|
|
1285
1285
|
return _objectSpread$2({
|
|
@@ -1321,15 +1321,15 @@
|
|
|
1321
1321
|
value: function tablePivot(pivotConfig) {
|
|
1322
1322
|
var normalizedPivotConfig = this.normalizePivotConfig(pivotConfig || {});
|
|
1323
1323
|
var isMeasuresPresent = normalizedPivotConfig.x.concat(normalizedPivotConfig.y).includes('measures');
|
|
1324
|
-
return this.pivot(normalizedPivotConfig).map(function (
|
|
1325
|
-
var xValues =
|
|
1326
|
-
yValuesArray =
|
|
1324
|
+
return this.pivot(normalizedPivotConfig).map(function (_ref21) {
|
|
1325
|
+
var xValues = _ref21.xValues,
|
|
1326
|
+
yValuesArray = _ref21.yValuesArray;
|
|
1327
1327
|
return ramda.fromPairs([].concat(_toConsumableArray__default['default'](normalizedPivotConfig.x.map(function (key, index) {
|
|
1328
1328
|
return [key, xValues[index]];
|
|
1329
|
-
})), _toConsumableArray__default['default'](isMeasuresPresent ? yValuesArray.map(function (
|
|
1330
|
-
var
|
|
1331
|
-
yValues =
|
|
1332
|
-
measure =
|
|
1329
|
+
})), _toConsumableArray__default['default'](isMeasuresPresent ? yValuesArray.map(function (_ref22) {
|
|
1330
|
+
var _ref23 = _slicedToArray__default['default'](_ref22, 2),
|
|
1331
|
+
yValues = _ref23[0],
|
|
1332
|
+
measure = _ref23[1];
|
|
1333
1333
|
return [yValues.length ? yValues.join() : 'value', measure];
|
|
1334
1334
|
}) : [])));
|
|
1335
1335
|
});
|
|
@@ -1449,12 +1449,12 @@
|
|
|
1449
1449
|
}, {});
|
|
1450
1450
|
var schema = {};
|
|
1451
1451
|
var extractFields = function extractFields(key) {
|
|
1452
|
-
var
|
|
1453
|
-
title =
|
|
1454
|
-
shortTitle =
|
|
1455
|
-
type =
|
|
1456
|
-
format =
|
|
1457
|
-
meta =
|
|
1452
|
+
var _ref24 = flatMeta[key] || {},
|
|
1453
|
+
title = _ref24.title,
|
|
1454
|
+
shortTitle = _ref24.shortTitle,
|
|
1455
|
+
type = _ref24.type,
|
|
1456
|
+
format = _ref24.format,
|
|
1457
|
+
meta = _ref24.meta;
|
|
1458
1458
|
return {
|
|
1459
1459
|
key: key,
|
|
1460
1460
|
title: title,
|
|
@@ -1465,9 +1465,9 @@
|
|
|
1465
1465
|
};
|
|
1466
1466
|
};
|
|
1467
1467
|
var pivot = this.pivot(normalizedPivotConfig);
|
|
1468
|
-
(((_pivot$ = pivot[0]) === null || _pivot$ === void 0 ? void 0 : _pivot$.yValuesArray) || []).forEach(function (
|
|
1469
|
-
var
|
|
1470
|
-
yValues =
|
|
1468
|
+
(((_pivot$ = pivot[0]) === null || _pivot$ === void 0 ? void 0 : _pivot$.yValuesArray) || []).forEach(function (_ref25) {
|
|
1469
|
+
var _ref26 = _slicedToArray__default['default'](_ref25, 1),
|
|
1470
|
+
yValues = _ref26[0];
|
|
1471
1471
|
if (yValues.length > 0) {
|
|
1472
1472
|
var currentItem = schema;
|
|
1473
1473
|
yValues.forEach(function (value, index) {
|
|
@@ -1487,9 +1487,9 @@
|
|
|
1487
1487
|
if (Object.keys(item).length === 0) {
|
|
1488
1488
|
return [];
|
|
1489
1489
|
}
|
|
1490
|
-
return Object.values(item).map(function (
|
|
1491
|
-
var key =
|
|
1492
|
-
currentItem = _objectWithoutProperties__default['default'](
|
|
1490
|
+
return Object.values(item).map(function (_ref27) {
|
|
1491
|
+
var key = _ref27.key,
|
|
1492
|
+
currentItem = _objectWithoutProperties__default['default'](_ref27, _excluded2);
|
|
1493
1493
|
var children = _toColumns(currentItem.children, [].concat(_toConsumableArray__default['default'](path), [key]));
|
|
1494
1494
|
var _extractFields = extractFields(currentItem.memberId),
|
|
1495
1495
|
title = _extractFields.title,
|
|
@@ -1597,9 +1597,9 @@
|
|
|
1597
1597
|
}));
|
|
1598
1598
|
var duplicateMeasures = new Set();
|
|
1599
1599
|
if (this.queryType === QUERY_TYPE.BLENDING_QUERY) {
|
|
1600
|
-
var allMeasures = ramda.flatten(this.loadResponses.map(function (
|
|
1600
|
+
var allMeasures = ramda.flatten(this.loadResponses.map(function (_ref28) {
|
|
1601
1601
|
var _query$measures2;
|
|
1602
|
-
var query =
|
|
1602
|
+
var query = _ref28.query;
|
|
1603
1603
|
return (_query$measures2 = query.measures) !== null && _query$measures2 !== void 0 ? _query$measures2 : [];
|
|
1604
1604
|
}));
|
|
1605
1605
|
allMeasures.filter(function (e, i, a) {
|
|
@@ -1761,11 +1761,11 @@
|
|
|
1761
1761
|
fillMissingDates: true,
|
|
1762
1762
|
joinDateRange: false
|
|
1763
1763
|
};
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1766
|
-
measures =
|
|
1767
|
-
|
|
1768
|
-
dimensions =
|
|
1764
|
+
var _ref29 = query || {},
|
|
1765
|
+
_ref29$measures = _ref29.measures,
|
|
1766
|
+
measures = _ref29$measures === void 0 ? [] : _ref29$measures,
|
|
1767
|
+
_ref29$dimensions = _ref29.dimensions,
|
|
1768
|
+
dimensions = _ref29$dimensions === void 0 ? [] : _ref29$dimensions;
|
|
1769
1769
|
var timeDimensions = ((query === null || query === void 0 ? void 0 : query.timeDimensions) || []).filter(function (td) {
|
|
1770
1770
|
return !!td.granularity;
|
|
1771
1771
|
});
|
|
@@ -2118,117 +2118,117 @@
|
|
|
2118
2118
|
}
|
|
2119
2119
|
function _responseChunks() {
|
|
2120
2120
|
_responseChunks = _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(res) {
|
|
2121
|
-
var body, reader, _yield$_awaitAsyncGen, done, value, _reader$releaseLock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
|
2122
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2121
|
+
var body, reader, _yield$_awaitAsyncGen, done, value, _reader$releaseLock, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _t;
|
|
2122
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2123
2123
|
while (1) switch (_context.prev = _context.next) {
|
|
2124
2124
|
case 0:
|
|
2125
2125
|
// eslint-disable-next-line prefer-destructuring
|
|
2126
2126
|
body = res.body;
|
|
2127
2127
|
if (!(body && typeof body.getReader === 'function')) {
|
|
2128
|
-
_context.next =
|
|
2128
|
+
_context.next = 8;
|
|
2129
2129
|
break;
|
|
2130
2130
|
}
|
|
2131
2131
|
reader = body.getReader(); // Browser / Node native fetch
|
|
2132
|
-
_context.prev =
|
|
2133
|
-
case
|
|
2134
|
-
_context.next =
|
|
2132
|
+
_context.prev = 1;
|
|
2133
|
+
case 2:
|
|
2134
|
+
_context.next = 3;
|
|
2135
2135
|
return _awaitAsyncGenerator__default['default'](reader.read());
|
|
2136
|
-
case
|
|
2136
|
+
case 3:
|
|
2137
2137
|
_yield$_awaitAsyncGen = _context.sent;
|
|
2138
2138
|
done = _yield$_awaitAsyncGen.done;
|
|
2139
2139
|
value = _yield$_awaitAsyncGen.value;
|
|
2140
2140
|
if (!done) {
|
|
2141
|
-
_context.next =
|
|
2141
|
+
_context.next = 4;
|
|
2142
2142
|
break;
|
|
2143
2143
|
}
|
|
2144
|
-
return _context.abrupt("
|
|
2145
|
-
case
|
|
2144
|
+
return _context.abrupt("continue", 6);
|
|
2145
|
+
case 4:
|
|
2146
2146
|
if (!value) {
|
|
2147
|
-
_context.next =
|
|
2147
|
+
_context.next = 5;
|
|
2148
2148
|
break;
|
|
2149
2149
|
}
|
|
2150
|
-
_context.next =
|
|
2150
|
+
_context.next = 5;
|
|
2151
2151
|
return value;
|
|
2152
|
-
case
|
|
2153
|
-
_context.next =
|
|
2152
|
+
case 5:
|
|
2153
|
+
_context.next = 2;
|
|
2154
2154
|
break;
|
|
2155
|
-
case
|
|
2156
|
-
_context.prev =
|
|
2155
|
+
case 6:
|
|
2156
|
+
_context.prev = 6;
|
|
2157
2157
|
(_reader$releaseLock = reader.releaseLock) === null || _reader$releaseLock === void 0 || _reader$releaseLock.call(reader);
|
|
2158
|
-
return _context.finish(
|
|
2159
|
-
case
|
|
2158
|
+
return _context.finish(6);
|
|
2159
|
+
case 7:
|
|
2160
2160
|
return _context.abrupt("return");
|
|
2161
|
-
case
|
|
2161
|
+
case 8:
|
|
2162
2162
|
if (!(body && Symbol.asyncIterator in body)) {
|
|
2163
|
-
_context.next =
|
|
2163
|
+
_context.next = 23;
|
|
2164
2164
|
break;
|
|
2165
2165
|
}
|
|
2166
2166
|
_iteratorAbruptCompletion = false;
|
|
2167
2167
|
_didIteratorError = false;
|
|
2168
|
-
_context.prev =
|
|
2168
|
+
_context.prev = 9;
|
|
2169
2169
|
_iterator = _asyncIterator$1(body);
|
|
2170
|
-
case
|
|
2171
|
-
_context.next =
|
|
2170
|
+
case 10:
|
|
2171
|
+
_context.next = 11;
|
|
2172
2172
|
return _awaitAsyncGenerator__default['default'](_iterator.next());
|
|
2173
|
-
case
|
|
2173
|
+
case 11:
|
|
2174
2174
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
2175
|
-
_context.next =
|
|
2175
|
+
_context.next = 15;
|
|
2176
2176
|
break;
|
|
2177
2177
|
}
|
|
2178
2178
|
chunk = _step.value;
|
|
2179
2179
|
if (!(typeof chunk === 'string')) {
|
|
2180
|
-
_context.next =
|
|
2180
|
+
_context.next = 13;
|
|
2181
2181
|
break;
|
|
2182
2182
|
}
|
|
2183
|
-
_context.next =
|
|
2183
|
+
_context.next = 12;
|
|
2184
2184
|
return new TextEncoder().encode(chunk);
|
|
2185
|
-
case
|
|
2186
|
-
_context.next =
|
|
2185
|
+
case 12:
|
|
2186
|
+
_context.next = 14;
|
|
2187
2187
|
break;
|
|
2188
|
-
case
|
|
2189
|
-
_context.next =
|
|
2188
|
+
case 13:
|
|
2189
|
+
_context.next = 14;
|
|
2190
2190
|
return new Uint8Array(chunk);
|
|
2191
|
-
case
|
|
2191
|
+
case 14:
|
|
2192
2192
|
_iteratorAbruptCompletion = false;
|
|
2193
|
-
_context.next =
|
|
2193
|
+
_context.next = 10;
|
|
2194
2194
|
break;
|
|
2195
|
-
case
|
|
2196
|
-
_context.next =
|
|
2195
|
+
case 15:
|
|
2196
|
+
_context.next = 17;
|
|
2197
2197
|
break;
|
|
2198
|
-
case
|
|
2199
|
-
_context.prev =
|
|
2200
|
-
|
|
2198
|
+
case 16:
|
|
2199
|
+
_context.prev = 16;
|
|
2200
|
+
_t = _context["catch"](9);
|
|
2201
2201
|
_didIteratorError = true;
|
|
2202
|
-
_iteratorError =
|
|
2203
|
-
case
|
|
2204
|
-
_context.prev =
|
|
2205
|
-
_context.prev =
|
|
2202
|
+
_iteratorError = _t;
|
|
2203
|
+
case 17:
|
|
2204
|
+
_context.prev = 17;
|
|
2205
|
+
_context.prev = 18;
|
|
2206
2206
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
2207
|
-
_context.next =
|
|
2207
|
+
_context.next = 19;
|
|
2208
2208
|
break;
|
|
2209
2209
|
}
|
|
2210
|
-
_context.next =
|
|
2210
|
+
_context.next = 19;
|
|
2211
2211
|
return _awaitAsyncGenerator__default['default'](_iterator["return"]());
|
|
2212
|
-
case
|
|
2213
|
-
_context.prev =
|
|
2212
|
+
case 19:
|
|
2213
|
+
_context.prev = 19;
|
|
2214
2214
|
if (!_didIteratorError) {
|
|
2215
|
-
_context.next =
|
|
2215
|
+
_context.next = 20;
|
|
2216
2216
|
break;
|
|
2217
2217
|
}
|
|
2218
2218
|
throw _iteratorError;
|
|
2219
|
-
case
|
|
2220
|
-
return _context.finish(
|
|
2221
|
-
case
|
|
2222
|
-
return _context.finish(
|
|
2223
|
-
case
|
|
2219
|
+
case 20:
|
|
2220
|
+
return _context.finish(19);
|
|
2221
|
+
case 21:
|
|
2222
|
+
return _context.finish(17);
|
|
2223
|
+
case 22:
|
|
2224
2224
|
return _context.abrupt("return");
|
|
2225
|
-
case
|
|
2225
|
+
case 23:
|
|
2226
2226
|
throw new Error('Unsupported response body type for streaming');
|
|
2227
|
-
case
|
|
2227
|
+
case 24:
|
|
2228
2228
|
case "end":
|
|
2229
2229
|
return _context.stop();
|
|
2230
2230
|
}
|
|
2231
|
-
}, _callee, null, [[
|
|
2231
|
+
}, _callee, null, [[1,, 6, 7], [9, 16, 17, 22], [18,, 19, 21]]);
|
|
2232
2232
|
}));
|
|
2233
2233
|
return _responseChunks.apply(this, arguments);
|
|
2234
2234
|
}
|
|
@@ -2308,23 +2308,23 @@
|
|
|
2308
2308
|
/* eslint no-unsafe-finally: off */subscribe: function subscribe(callback) {
|
|
2309
2309
|
var _this2 = this;
|
|
2310
2310
|
return _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2311
|
-
var result, errorMessage, _actualSignal$reason, _result;
|
|
2312
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2311
|
+
var result, errorMessage, _actualSignal$reason, _result, _t;
|
|
2312
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2313
2313
|
while (1) switch (_context.prev = _context.next) {
|
|
2314
2314
|
case 0:
|
|
2315
2315
|
_context.prev = 0;
|
|
2316
|
-
_context.next =
|
|
2316
|
+
_context.next = 1;
|
|
2317
2317
|
return runRequest();
|
|
2318
|
-
case
|
|
2318
|
+
case 1:
|
|
2319
2319
|
result = _context.sent;
|
|
2320
2320
|
return _context.abrupt("return", callback(result, function () {
|
|
2321
2321
|
return _this2.subscribe(callback);
|
|
2322
2322
|
}));
|
|
2323
|
-
case
|
|
2324
|
-
_context.prev =
|
|
2325
|
-
|
|
2323
|
+
case 2:
|
|
2324
|
+
_context.prev = 2;
|
|
2325
|
+
_t = _context["catch"](0);
|
|
2326
2326
|
errorMessage = 'network Error';
|
|
2327
|
-
if (
|
|
2327
|
+
if (_t.name === 'AbortError') {
|
|
2328
2328
|
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') {
|
|
2329
2329
|
errorMessage = 'timeout';
|
|
2330
2330
|
} else {
|
|
@@ -2337,11 +2337,11 @@
|
|
|
2337
2337
|
return _context.abrupt("return", callback(_result, function () {
|
|
2338
2338
|
return _this2.subscribe(callback);
|
|
2339
2339
|
}));
|
|
2340
|
-
case
|
|
2340
|
+
case 3:
|
|
2341
2341
|
case "end":
|
|
2342
2342
|
return _context.stop();
|
|
2343
2343
|
}
|
|
2344
|
-
}, _callee, null, [[0,
|
|
2344
|
+
}, _callee, null, [[0, 2]]);
|
|
2345
2345
|
}))();
|
|
2346
2346
|
}
|
|
2347
2347
|
};
|
|
@@ -2389,10 +2389,10 @@
|
|
|
2389
2389
|
stream: function () {
|
|
2390
2390
|
var _stream = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2391
2391
|
var response;
|
|
2392
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2392
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context2) {
|
|
2393
2393
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2394
2394
|
case 0:
|
|
2395
|
-
_context2.next =
|
|
2395
|
+
_context2.next = 1;
|
|
2396
2396
|
return fetch__default['default'](url, {
|
|
2397
2397
|
method: requestMethod,
|
|
2398
2398
|
headers: _objectSpread$1({
|
|
@@ -2403,22 +2403,22 @@
|
|
|
2403
2403
|
body: requestMethod === 'POST' ? JSON.stringify(params || {}) : null,
|
|
2404
2404
|
signal: actualSignal
|
|
2405
2405
|
});
|
|
2406
|
-
case
|
|
2406
|
+
case 1:
|
|
2407
2407
|
response = _context2.sent;
|
|
2408
2408
|
if (response.ok) {
|
|
2409
|
-
_context2.next =
|
|
2409
|
+
_context2.next = 2;
|
|
2410
2410
|
break;
|
|
2411
2411
|
}
|
|
2412
2412
|
throw new Error("HTTP ".concat(response.status, ": ").concat(response.statusText));
|
|
2413
|
-
case
|
|
2413
|
+
case 2:
|
|
2414
2414
|
if (response.body) {
|
|
2415
|
-
_context2.next =
|
|
2415
|
+
_context2.next = 3;
|
|
2416
2416
|
break;
|
|
2417
2417
|
}
|
|
2418
2418
|
throw new Error('No response body available for streaming');
|
|
2419
|
-
case
|
|
2419
|
+
case 3:
|
|
2420
2420
|
return _context2.abrupt("return", responseChunks(response));
|
|
2421
|
-
case
|
|
2421
|
+
case 4:
|
|
2422
2422
|
case "end":
|
|
2423
2423
|
return _context2.stop();
|
|
2424
2424
|
}
|
|
@@ -2431,7 +2431,7 @@
|
|
|
2431
2431
|
}(),
|
|
2432
2432
|
unsubscribe: function () {
|
|
2433
2433
|
var _unsubscribe = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
2434
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2434
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context3) {
|
|
2435
2435
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2436
2436
|
case 0:
|
|
2437
2437
|
if (controller) {
|
|
@@ -2563,9 +2563,9 @@
|
|
|
2563
2563
|
return _createClass__default['default'](CubeApi, [{
|
|
2564
2564
|
key: "request",
|
|
2565
2565
|
value: function request(method, params) {
|
|
2566
|
-
return this.transport.request(method, _objectSpread({
|
|
2567
|
-
baseRequestId: uuid.v4()
|
|
2568
|
-
}
|
|
2566
|
+
return this.transport.request(method, _objectSpread(_objectSpread({}, params), {}, {
|
|
2567
|
+
baseRequestId: (params === null || params === void 0 ? void 0 : params.baseRequestId) || uuid.v4()
|
|
2568
|
+
}));
|
|
2569
2569
|
}
|
|
2570
2570
|
}, {
|
|
2571
2571
|
key: "loadMethod",
|
|
@@ -2589,27 +2589,27 @@
|
|
|
2589
2589
|
var checkMutex = /*#__PURE__*/function () {
|
|
2590
2590
|
var _ref = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2591
2591
|
var requestInstance;
|
|
2592
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2592
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context) {
|
|
2593
2593
|
while (1) switch (_context.prev = _context.next) {
|
|
2594
2594
|
case 0:
|
|
2595
|
-
_context.next =
|
|
2595
|
+
_context.next = 1;
|
|
2596
2596
|
return requestPromise;
|
|
2597
|
-
case
|
|
2597
|
+
case 1:
|
|
2598
2598
|
requestInstance = _context.sent;
|
|
2599
2599
|
if (!(options && options.mutexObj && options.mutexObj[mutexKey] !== mutexValue)) {
|
|
2600
|
-
_context.next =
|
|
2600
|
+
_context.next = 3;
|
|
2601
2601
|
break;
|
|
2602
2602
|
}
|
|
2603
2603
|
unsubscribed = true;
|
|
2604
2604
|
if (!requestInstance.unsubscribe) {
|
|
2605
|
-
_context.next =
|
|
2605
|
+
_context.next = 2;
|
|
2606
2606
|
break;
|
|
2607
2607
|
}
|
|
2608
|
-
_context.next =
|
|
2608
|
+
_context.next = 2;
|
|
2609
2609
|
return requestInstance.unsubscribe();
|
|
2610
|
-
case
|
|
2610
|
+
case 2:
|
|
2611
2611
|
throw MUTEX_ERROR;
|
|
2612
|
-
case
|
|
2612
|
+
case 3:
|
|
2613
2613
|
case "end":
|
|
2614
2614
|
return _context.stop();
|
|
2615
2615
|
}
|
|
@@ -2624,40 +2624,40 @@
|
|
|
2624
2624
|
var _ref2 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(response, next) {
|
|
2625
2625
|
var _options2, _response$error, _options5;
|
|
2626
2626
|
var requestInstance, subscribeNext, continueWait, body, text, _options3, _options4, _error, result;
|
|
2627
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2627
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context4) {
|
|
2628
2628
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2629
2629
|
case 0:
|
|
2630
|
-
_context4.next =
|
|
2630
|
+
_context4.next = 1;
|
|
2631
2631
|
return requestPromise;
|
|
2632
|
-
case
|
|
2632
|
+
case 1:
|
|
2633
2633
|
requestInstance = _context4.sent;
|
|
2634
2634
|
subscribeNext = /*#__PURE__*/function () {
|
|
2635
2635
|
var _ref3 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2636
2636
|
var _options;
|
|
2637
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2637
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context2) {
|
|
2638
2638
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2639
2639
|
case 0:
|
|
2640
2640
|
if (!((_options = options) !== null && _options !== void 0 && _options.subscribe && !unsubscribed)) {
|
|
2641
|
-
_context2.next =
|
|
2641
|
+
_context2.next = 3;
|
|
2642
2642
|
break;
|
|
2643
2643
|
}
|
|
2644
2644
|
if (!requestInstance.unsubscribe) {
|
|
2645
|
-
_context2.next =
|
|
2645
|
+
_context2.next = 1;
|
|
2646
2646
|
break;
|
|
2647
2647
|
}
|
|
2648
2648
|
return _context2.abrupt("return", next());
|
|
2649
|
-
case
|
|
2650
|
-
_context2.next =
|
|
2649
|
+
case 1:
|
|
2650
|
+
_context2.next = 2;
|
|
2651
2651
|
return new Promise(function (resolve) {
|
|
2652
2652
|
return setTimeout(function () {
|
|
2653
2653
|
return resolve();
|
|
2654
2654
|
}, _this2.pollInterval * 1000);
|
|
2655
2655
|
});
|
|
2656
|
-
case
|
|
2656
|
+
case 2:
|
|
2657
2657
|
return _context2.abrupt("return", next());
|
|
2658
|
-
case
|
|
2658
|
+
case 3:
|
|
2659
2659
|
return _context2.abrupt("return", null);
|
|
2660
|
-
case
|
|
2660
|
+
case 4:
|
|
2661
2661
|
case "end":
|
|
2662
2662
|
return _context2.stop();
|
|
2663
2663
|
}
|
|
@@ -2671,29 +2671,29 @@
|
|
|
2671
2671
|
var _ref4 = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
2672
2672
|
var wait,
|
|
2673
2673
|
_args3 = arguments;
|
|
2674
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2674
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context3) {
|
|
2675
2675
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2676
2676
|
case 0:
|
|
2677
2677
|
wait = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
2678
2678
|
if (unsubscribed) {
|
|
2679
|
-
_context3.next =
|
|
2679
|
+
_context3.next = 2;
|
|
2680
2680
|
break;
|
|
2681
2681
|
}
|
|
2682
2682
|
if (!wait) {
|
|
2683
|
-
_context3.next =
|
|
2683
|
+
_context3.next = 1;
|
|
2684
2684
|
break;
|
|
2685
2685
|
}
|
|
2686
|
-
_context3.next =
|
|
2686
|
+
_context3.next = 1;
|
|
2687
2687
|
return new Promise(function (resolve) {
|
|
2688
2688
|
return setTimeout(function () {
|
|
2689
2689
|
return resolve();
|
|
2690
2690
|
}, _this2.pollInterval * 1000);
|
|
2691
2691
|
});
|
|
2692
|
-
case
|
|
2692
|
+
case 1:
|
|
2693
2693
|
return _context3.abrupt("return", next());
|
|
2694
|
-
case
|
|
2694
|
+
case 2:
|
|
2695
2695
|
return _context3.abrupt("return", null);
|
|
2696
|
-
case
|
|
2696
|
+
case 3:
|
|
2697
2697
|
case "end":
|
|
2698
2698
|
return _context3.stop();
|
|
2699
2699
|
}
|
|
@@ -2704,105 +2704,105 @@
|
|
|
2704
2704
|
};
|
|
2705
2705
|
}();
|
|
2706
2706
|
if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.subscribe && !skipAuthorizationUpdate)) {
|
|
2707
|
-
_context4.next =
|
|
2707
|
+
_context4.next = 2;
|
|
2708
2708
|
break;
|
|
2709
2709
|
}
|
|
2710
|
-
_context4.next =
|
|
2710
|
+
_context4.next = 2;
|
|
2711
2711
|
return _this2.updateTransportAuthorization();
|
|
2712
|
-
case
|
|
2712
|
+
case 2:
|
|
2713
2713
|
skipAuthorizationUpdate = false;
|
|
2714
2714
|
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)) {
|
|
2715
|
-
_context4.next =
|
|
2715
|
+
_context4.next = 4;
|
|
2716
2716
|
break;
|
|
2717
2717
|
}
|
|
2718
|
-
_context4.next =
|
|
2718
|
+
_context4.next = 3;
|
|
2719
2719
|
return checkMutex();
|
|
2720
|
-
case
|
|
2720
|
+
case 3:
|
|
2721
2721
|
return _context4.abrupt("return", continueWait(true));
|
|
2722
|
-
case
|
|
2722
|
+
case 4:
|
|
2723
2723
|
// From here we're sure that response is only fetch Response
|
|
2724
2724
|
response = response;
|
|
2725
2725
|
body = {};
|
|
2726
2726
|
text = '';
|
|
2727
|
-
_context4.prev =
|
|
2728
|
-
_context4.next =
|
|
2727
|
+
_context4.prev = 5;
|
|
2728
|
+
_context4.next = 6;
|
|
2729
2729
|
return response.text();
|
|
2730
|
-
case
|
|
2730
|
+
case 6:
|
|
2731
2731
|
text = _context4.sent;
|
|
2732
2732
|
body = JSON.parse(text);
|
|
2733
|
-
_context4.next =
|
|
2733
|
+
_context4.next = 8;
|
|
2734
2734
|
break;
|
|
2735
|
-
case
|
|
2736
|
-
_context4.prev =
|
|
2737
|
-
_context4
|
|
2735
|
+
case 7:
|
|
2736
|
+
_context4.prev = 7;
|
|
2737
|
+
_context4["catch"](5);
|
|
2738
2738
|
body.error = text;
|
|
2739
|
-
case
|
|
2739
|
+
case 8:
|
|
2740
2740
|
if (!(body.error === 'Continue wait')) {
|
|
2741
|
-
_context4.next =
|
|
2741
|
+
_context4.next = 10;
|
|
2742
2742
|
break;
|
|
2743
2743
|
}
|
|
2744
|
-
_context4.next =
|
|
2744
|
+
_context4.next = 9;
|
|
2745
2745
|
return checkMutex();
|
|
2746
|
-
case
|
|
2746
|
+
case 9:
|
|
2747
2747
|
if ((_options3 = options) !== null && _options3 !== void 0 && _options3.progressCallback) {
|
|
2748
2748
|
options.progressCallback(new ProgressResult(body));
|
|
2749
2749
|
}
|
|
2750
2750
|
return _context4.abrupt("return", continueWait());
|
|
2751
|
-
case
|
|
2751
|
+
case 10:
|
|
2752
2752
|
if (!(response.status !== 200)) {
|
|
2753
|
-
_context4.next =
|
|
2753
|
+
_context4.next = 15;
|
|
2754
2754
|
break;
|
|
2755
2755
|
}
|
|
2756
|
-
_context4.next =
|
|
2756
|
+
_context4.next = 11;
|
|
2757
2757
|
return checkMutex();
|
|
2758
|
-
case
|
|
2758
|
+
case 11:
|
|
2759
2759
|
if (!(!((_options4 = options) !== null && _options4 !== void 0 && _options4.subscribe) && requestInstance.unsubscribe)) {
|
|
2760
|
-
_context4.next =
|
|
2760
|
+
_context4.next = 12;
|
|
2761
2761
|
break;
|
|
2762
2762
|
}
|
|
2763
|
-
_context4.next =
|
|
2763
|
+
_context4.next = 12;
|
|
2764
2764
|
return requestInstance.unsubscribe();
|
|
2765
|
-
case
|
|
2765
|
+
case 12:
|
|
2766
2766
|
_error = new RequestError(body.error || response.error || '', body, response.status);
|
|
2767
2767
|
if (!callback) {
|
|
2768
|
-
_context4.next =
|
|
2768
|
+
_context4.next = 13;
|
|
2769
2769
|
break;
|
|
2770
2770
|
}
|
|
2771
2771
|
callback(_error);
|
|
2772
|
-
_context4.next =
|
|
2772
|
+
_context4.next = 14;
|
|
2773
2773
|
break;
|
|
2774
|
-
case
|
|
2774
|
+
case 13:
|
|
2775
2775
|
throw _error;
|
|
2776
|
-
case
|
|
2776
|
+
case 14:
|
|
2777
2777
|
return _context4.abrupt("return", subscribeNext());
|
|
2778
|
-
case
|
|
2779
|
-
_context4.next =
|
|
2778
|
+
case 15:
|
|
2779
|
+
_context4.next = 16;
|
|
2780
2780
|
return checkMutex();
|
|
2781
|
-
case
|
|
2781
|
+
case 16:
|
|
2782
2782
|
if (!(!((_options5 = options) !== null && _options5 !== void 0 && _options5.subscribe) && requestInstance.unsubscribe)) {
|
|
2783
|
-
_context4.next =
|
|
2783
|
+
_context4.next = 17;
|
|
2784
2784
|
break;
|
|
2785
2785
|
}
|
|
2786
|
-
_context4.next =
|
|
2786
|
+
_context4.next = 17;
|
|
2787
2787
|
return requestInstance.unsubscribe();
|
|
2788
|
-
case
|
|
2788
|
+
case 17:
|
|
2789
2789
|
result = toResult(body);
|
|
2790
2790
|
if (!callback) {
|
|
2791
|
-
_context4.next =
|
|
2791
|
+
_context4.next = 18;
|
|
2792
2792
|
break;
|
|
2793
2793
|
}
|
|
2794
2794
|
callback(null, result);
|
|
2795
|
-
_context4.next =
|
|
2795
|
+
_context4.next = 19;
|
|
2796
2796
|
break;
|
|
2797
|
-
case
|
|
2797
|
+
case 18:
|
|
2798
2798
|
return _context4.abrupt("return", result);
|
|
2799
|
-
case
|
|
2799
|
+
case 19:
|
|
2800
2800
|
return _context4.abrupt("return", subscribeNext());
|
|
2801
|
-
case
|
|
2801
|
+
case 20:
|
|
2802
2802
|
case "end":
|
|
2803
2803
|
return _context4.stop();
|
|
2804
2804
|
}
|
|
2805
|
-
}, _callee4, null, [[
|
|
2805
|
+
}, _callee4, null, [[5, 7]]);
|
|
2806
2806
|
}));
|
|
2807
2807
|
return function loadImpl(_x, _x2) {
|
|
2808
2808
|
return _ref2.apply(this, arguments);
|
|
@@ -2816,22 +2816,22 @@
|
|
|
2816
2816
|
unsubscribe: function () {
|
|
2817
2817
|
var _unsubscribe = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5() {
|
|
2818
2818
|
var requestInstance;
|
|
2819
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2819
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context5) {
|
|
2820
2820
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2821
2821
|
case 0:
|
|
2822
|
-
_context5.next =
|
|
2822
|
+
_context5.next = 1;
|
|
2823
2823
|
return requestPromise;
|
|
2824
|
-
case
|
|
2824
|
+
case 1:
|
|
2825
2825
|
requestInstance = _context5.sent;
|
|
2826
2826
|
unsubscribed = true;
|
|
2827
2827
|
if (!requestInstance.unsubscribe) {
|
|
2828
|
-
_context5.next =
|
|
2828
|
+
_context5.next = 2;
|
|
2829
2829
|
break;
|
|
2830
2830
|
}
|
|
2831
2831
|
return _context5.abrupt("return", requestInstance.unsubscribe());
|
|
2832
|
-
case
|
|
2832
|
+
case 2:
|
|
2833
2833
|
return _context5.abrupt("return", null);
|
|
2834
|
-
case
|
|
2834
|
+
case 3:
|
|
2835
2835
|
case "end":
|
|
2836
2836
|
return _context5.stop();
|
|
2837
2837
|
}
|
|
@@ -2853,50 +2853,50 @@
|
|
|
2853
2853
|
var _updateTransportAuthorization = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
|
|
2854
2854
|
var _this3 = this;
|
|
2855
2855
|
var tokenFetcher, promise;
|
|
2856
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2856
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context7) {
|
|
2857
2857
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2858
2858
|
case 0:
|
|
2859
2859
|
if (!this.updateAuthorizationPromise) {
|
|
2860
|
-
_context7.next =
|
|
2860
|
+
_context7.next = 2;
|
|
2861
2861
|
break;
|
|
2862
2862
|
}
|
|
2863
|
-
_context7.next =
|
|
2863
|
+
_context7.next = 1;
|
|
2864
2864
|
return this.updateAuthorizationPromise;
|
|
2865
|
-
case
|
|
2865
|
+
case 1:
|
|
2866
2866
|
return _context7.abrupt("return");
|
|
2867
|
-
case
|
|
2867
|
+
case 2:
|
|
2868
2868
|
tokenFetcher = this.apiToken;
|
|
2869
2869
|
if (!(typeof tokenFetcher === 'function')) {
|
|
2870
|
-
_context7.next =
|
|
2870
|
+
_context7.next = 3;
|
|
2871
2871
|
break;
|
|
2872
2872
|
}
|
|
2873
2873
|
promise = _asyncToGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6() {
|
|
2874
2874
|
var token;
|
|
2875
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
2875
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context6) {
|
|
2876
2876
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2877
2877
|
case 0:
|
|
2878
2878
|
_context6.prev = 0;
|
|
2879
|
-
_context6.next =
|
|
2879
|
+
_context6.next = 1;
|
|
2880
2880
|
return tokenFetcher();
|
|
2881
|
-
case
|
|
2881
|
+
case 1:
|
|
2882
2882
|
token = _context6.sent;
|
|
2883
2883
|
if (_this3.transport.authorization !== token) {
|
|
2884
2884
|
_this3.transport.authorization = token;
|
|
2885
2885
|
}
|
|
2886
|
-
case
|
|
2887
|
-
_context6.prev =
|
|
2886
|
+
case 2:
|
|
2887
|
+
_context6.prev = 2;
|
|
2888
2888
|
_this3.updateAuthorizationPromise = null;
|
|
2889
|
-
return _context6.finish(
|
|
2890
|
-
case
|
|
2889
|
+
return _context6.finish(2);
|
|
2890
|
+
case 3:
|
|
2891
2891
|
case "end":
|
|
2892
2892
|
return _context6.stop();
|
|
2893
2893
|
}
|
|
2894
|
-
}, _callee6, null, [[0,,
|
|
2894
|
+
}, _callee6, null, [[0,, 2, 3]]);
|
|
2895
2895
|
}))();
|
|
2896
2896
|
this.updateAuthorizationPromise = promise;
|
|
2897
|
-
_context7.next =
|
|
2897
|
+
_context7.next = 3;
|
|
2898
2898
|
return promise;
|
|
2899
|
-
case
|
|
2899
|
+
case 3:
|
|
2900
2900
|
case "end":
|
|
2901
2901
|
return _context7.stop();
|
|
2902
2902
|
}
|
|
@@ -3011,11 +3011,12 @@
|
|
|
3011
3011
|
query = _this$prepareQueryOpt2[0];
|
|
3012
3012
|
options = _this$prepareQueryOpt2[1];
|
|
3013
3013
|
return this.loadMethod(function () {
|
|
3014
|
-
var _options6;
|
|
3014
|
+
var _options6, _options7;
|
|
3015
3015
|
return _this4.request('load', {
|
|
3016
3016
|
query: query,
|
|
3017
3017
|
queryType: 'multi',
|
|
3018
|
-
signal: (_options6 = options) === null || _options6 === void 0 ? void 0 : _options6.signal
|
|
3018
|
+
signal: (_options6 = options) === null || _options6 === void 0 ? void 0 : _options6.signal,
|
|
3019
|
+
baseRequestId: (_options7 = options) === null || _options7 === void 0 ? void 0 : _options7.baseRequestId
|
|
3019
3020
|
});
|
|
3020
3021
|
}, function (response) {
|
|
3021
3022
|
return _this4.loadResponseInternal(response, options);
|
|
@@ -3081,11 +3082,12 @@
|
|
|
3081
3082
|
query = _this$prepareQueryOpt4[0];
|
|
3082
3083
|
options = _this$prepareQueryOpt4[1];
|
|
3083
3084
|
return this.loadMethod(function () {
|
|
3084
|
-
var
|
|
3085
|
+
var _options8, _options9;
|
|
3085
3086
|
return _this6.request('subscribe', {
|
|
3086
3087
|
query: query,
|
|
3087
3088
|
queryType: 'multi',
|
|
3088
|
-
signal: (
|
|
3089
|
+
signal: (_options8 = options) === null || _options8 === void 0 ? void 0 : _options8.signal,
|
|
3090
|
+
baseRequestId: (_options9 = options) === null || _options9 === void 0 ? void 0 : _options9.baseRequestId
|
|
3089
3091
|
});
|
|
3090
3092
|
}, function (response) {
|
|
3091
3093
|
return _this6.loadResponseInternal(response, options);
|
|
@@ -3104,7 +3106,8 @@
|
|
|
3104
3106
|
return this.loadMethod(function () {
|
|
3105
3107
|
return _this7.request('sql', {
|
|
3106
3108
|
query: query,
|
|
3107
|
-
signal: options === null || options === void 0 ? void 0 : options.signal
|
|
3109
|
+
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
3110
|
+
baseRequestId: options === null || options === void 0 ? void 0 : options.baseRequestId
|
|
3108
3111
|
});
|
|
3109
3112
|
}, function (response) {
|
|
3110
3113
|
return Array.isArray(response) ? response.map(function (body) {
|
|
@@ -3122,7 +3125,8 @@
|
|
|
3122
3125
|
var _this8 = this;
|
|
3123
3126
|
return this.loadMethod(function () {
|
|
3124
3127
|
return _this8.request('meta', {
|
|
3125
|
-
signal: options === null || options === void 0 ? void 0 : options.signal
|
|
3128
|
+
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
3129
|
+
baseRequestId: options === null || options === void 0 ? void 0 : options.baseRequestId
|
|
3126
3130
|
});
|
|
3127
3131
|
}, function (body) {
|
|
3128
3132
|
return new Meta(body);
|
|
@@ -3139,7 +3143,8 @@
|
|
|
3139
3143
|
return this.loadMethod(function () {
|
|
3140
3144
|
return _this9.request('dry-run', {
|
|
3141
3145
|
query: query,
|
|
3142
|
-
signal: options === null || options === void 0 ? void 0 : options.signal
|
|
3146
|
+
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
3147
|
+
baseRequestId: options === null || options === void 0 ? void 0 : options.baseRequestId
|
|
3143
3148
|
});
|
|
3144
3149
|
}, function (response) {
|
|
3145
3150
|
return response;
|
|
@@ -3152,14 +3157,15 @@
|
|
|
3152
3157
|
* Execute a Cube SQL query against Cube SQL interface and return the results.
|
|
3153
3158
|
*/
|
|
3154
3159
|
function cubeSql(sqlQuery, options, callback) {
|
|
3155
|
-
var
|
|
3160
|
+
var _this0 = this;
|
|
3156
3161
|
return this.loadMethod(function () {
|
|
3157
|
-
var request =
|
|
3162
|
+
var request = _this0.request('cubesql', {
|
|
3158
3163
|
query: sqlQuery,
|
|
3159
3164
|
cache: options === null || options === void 0 ? void 0 : options.cache,
|
|
3160
3165
|
method: 'POST',
|
|
3161
3166
|
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
3162
|
-
fetchTimeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
3167
|
+
fetchTimeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
3168
|
+
baseRequestId: options === null || options === void 0 ? void 0 : options.baseRequestId
|
|
3163
3169
|
});
|
|
3164
3170
|
return request;
|
|
3165
3171
|
}, function (response) {
|
|
@@ -3179,7 +3185,7 @@
|
|
|
3179
3185
|
var _response$error$split = response.error.split('\n'),
|
|
3180
3186
|
_response$error$split2 = _toArray__default['default'](_response$error$split),
|
|
3181
3187
|
schema = _response$error$split2[0],
|
|
3182
|
-
data = _response$error$split2.slice(1);
|
|
3188
|
+
data = _arrayLikeToArray(_response$error$split2).slice(1);
|
|
3183
3189
|
try {
|
|
3184
3190
|
return {
|
|
3185
3191
|
schema: JSON.parse(schema).schema,
|
|
@@ -3206,16 +3212,16 @@
|
|
|
3206
3212
|
value: function cubeSqlStream(sqlQuery, options) {
|
|
3207
3213
|
var _this = this;
|
|
3208
3214
|
return _wrapAsyncGenerator__default['default'](/*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
|
|
3209
|
-
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator2, _step2, line, parsed, _parsed;
|
|
3210
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
3215
|
+
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator2, _step2, line, parsed, _parsed, _t3, _t4, _t6;
|
|
3216
|
+
return _regeneratorRuntime__default['default'].wrap(function (_context8) {
|
|
3211
3217
|
while (1) switch (_context8.prev = _context8.next) {
|
|
3212
3218
|
case 0:
|
|
3213
3219
|
if (_this.transport.requestStream) {
|
|
3214
|
-
_context8.next =
|
|
3220
|
+
_context8.next = 1;
|
|
3215
3221
|
break;
|
|
3216
3222
|
}
|
|
3217
3223
|
throw new Error('Transport does not support streaming');
|
|
3218
|
-
case
|
|
3224
|
+
case 1:
|
|
3219
3225
|
streamResponse = _this.transport.requestStream('cubesql', {
|
|
3220
3226
|
method: 'POST',
|
|
3221
3227
|
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
@@ -3228,21 +3234,21 @@
|
|
|
3228
3234
|
});
|
|
3229
3235
|
decoder = new TextDecoder();
|
|
3230
3236
|
buffer = '';
|
|
3231
|
-
_context8.prev =
|
|
3232
|
-
_context8.next =
|
|
3237
|
+
_context8.prev = 2;
|
|
3238
|
+
_context8.next = 3;
|
|
3233
3239
|
return _awaitAsyncGenerator__default['default'](streamResponse.stream());
|
|
3234
|
-
case
|
|
3240
|
+
case 3:
|
|
3235
3241
|
stream = _context8.sent;
|
|
3236
3242
|
_iteratorAbruptCompletion = false;
|
|
3237
3243
|
_didIteratorError = false;
|
|
3238
|
-
_context8.prev =
|
|
3244
|
+
_context8.prev = 4;
|
|
3239
3245
|
_iterator = _asyncIterator(stream);
|
|
3240
|
-
case
|
|
3241
|
-
_context8.next =
|
|
3246
|
+
case 5:
|
|
3247
|
+
_context8.next = 6;
|
|
3242
3248
|
return _awaitAsyncGenerator__default['default'](_iterator.next());
|
|
3243
|
-
case
|
|
3249
|
+
case 6:
|
|
3244
3250
|
if (!(_iteratorAbruptCompletion = !(_step = _context8.sent).done)) {
|
|
3245
|
-
_context8.next =
|
|
3251
|
+
_context8.next = 21;
|
|
3246
3252
|
break;
|
|
3247
3253
|
}
|
|
3248
3254
|
chunk = _step.value;
|
|
@@ -3252,193 +3258,193 @@
|
|
|
3252
3258
|
lines = buffer.split('\n');
|
|
3253
3259
|
buffer = lines.pop() || '';
|
|
3254
3260
|
_iterator2 = _createForOfIteratorHelper(lines);
|
|
3255
|
-
_context8.prev =
|
|
3261
|
+
_context8.prev = 7;
|
|
3256
3262
|
_iterator2.s();
|
|
3257
|
-
case
|
|
3263
|
+
case 8:
|
|
3258
3264
|
if ((_step2 = _iterator2.n()).done) {
|
|
3259
|
-
_context8.next =
|
|
3265
|
+
_context8.next = 17;
|
|
3260
3266
|
break;
|
|
3261
3267
|
}
|
|
3262
3268
|
line = _step2.value;
|
|
3263
3269
|
if (!line.trim()) {
|
|
3264
|
-
_context8.next =
|
|
3270
|
+
_context8.next = 16;
|
|
3265
3271
|
break;
|
|
3266
3272
|
}
|
|
3267
|
-
_context8.prev =
|
|
3273
|
+
_context8.prev = 9;
|
|
3268
3274
|
parsed = JSON.parse(line);
|
|
3269
3275
|
if (!parsed.schema) {
|
|
3270
|
-
_context8.next =
|
|
3276
|
+
_context8.next = 11;
|
|
3271
3277
|
break;
|
|
3272
3278
|
}
|
|
3273
|
-
_context8.next =
|
|
3279
|
+
_context8.next = 10;
|
|
3274
3280
|
return {
|
|
3275
3281
|
type: 'schema',
|
|
3276
3282
|
schema: parsed.schema
|
|
3277
3283
|
};
|
|
3278
|
-
case
|
|
3279
|
-
_context8.next =
|
|
3284
|
+
case 10:
|
|
3285
|
+
_context8.next = 14;
|
|
3280
3286
|
break;
|
|
3281
|
-
case
|
|
3287
|
+
case 11:
|
|
3282
3288
|
if (!parsed.data) {
|
|
3283
|
-
_context8.next =
|
|
3289
|
+
_context8.next = 13;
|
|
3284
3290
|
break;
|
|
3285
3291
|
}
|
|
3286
|
-
_context8.next =
|
|
3292
|
+
_context8.next = 12;
|
|
3287
3293
|
return {
|
|
3288
3294
|
type: 'data',
|
|
3289
3295
|
data: parsed.data
|
|
3290
3296
|
};
|
|
3291
|
-
case
|
|
3292
|
-
_context8.next =
|
|
3297
|
+
case 12:
|
|
3298
|
+
_context8.next = 14;
|
|
3293
3299
|
break;
|
|
3294
|
-
case
|
|
3300
|
+
case 13:
|
|
3295
3301
|
if (!parsed.error) {
|
|
3296
|
-
_context8.next =
|
|
3302
|
+
_context8.next = 14;
|
|
3297
3303
|
break;
|
|
3298
3304
|
}
|
|
3299
|
-
_context8.next =
|
|
3305
|
+
_context8.next = 14;
|
|
3300
3306
|
return {
|
|
3301
3307
|
type: 'error',
|
|
3302
3308
|
error: parsed.error
|
|
3303
3309
|
};
|
|
3304
|
-
case
|
|
3305
|
-
_context8.next =
|
|
3310
|
+
case 14:
|
|
3311
|
+
_context8.next = 16;
|
|
3306
3312
|
break;
|
|
3307
|
-
case
|
|
3308
|
-
_context8.prev =
|
|
3309
|
-
_context8
|
|
3310
|
-
_context8.next =
|
|
3313
|
+
case 15:
|
|
3314
|
+
_context8.prev = 15;
|
|
3315
|
+
_context8["catch"](9);
|
|
3316
|
+
_context8.next = 16;
|
|
3311
3317
|
return {
|
|
3312
3318
|
type: 'error',
|
|
3313
3319
|
error: "Failed to parse JSON line: ".concat(line)
|
|
3314
3320
|
};
|
|
3315
|
-
case
|
|
3316
|
-
_context8.next =
|
|
3321
|
+
case 16:
|
|
3322
|
+
_context8.next = 8;
|
|
3317
3323
|
break;
|
|
3318
|
-
case
|
|
3319
|
-
_context8.next =
|
|
3324
|
+
case 17:
|
|
3325
|
+
_context8.next = 19;
|
|
3320
3326
|
break;
|
|
3321
|
-
case
|
|
3322
|
-
_context8.prev =
|
|
3323
|
-
|
|
3324
|
-
_iterator2.e(
|
|
3325
|
-
case
|
|
3326
|
-
_context8.prev =
|
|
3327
|
+
case 18:
|
|
3328
|
+
_context8.prev = 18;
|
|
3329
|
+
_t3 = _context8["catch"](7);
|
|
3330
|
+
_iterator2.e(_t3);
|
|
3331
|
+
case 19:
|
|
3332
|
+
_context8.prev = 19;
|
|
3327
3333
|
_iterator2.f();
|
|
3328
|
-
return _context8.finish(
|
|
3329
|
-
case
|
|
3334
|
+
return _context8.finish(19);
|
|
3335
|
+
case 20:
|
|
3330
3336
|
_iteratorAbruptCompletion = false;
|
|
3331
|
-
_context8.next =
|
|
3337
|
+
_context8.next = 5;
|
|
3332
3338
|
break;
|
|
3333
|
-
case
|
|
3334
|
-
_context8.next =
|
|
3339
|
+
case 21:
|
|
3340
|
+
_context8.next = 23;
|
|
3335
3341
|
break;
|
|
3336
|
-
case
|
|
3337
|
-
_context8.prev =
|
|
3338
|
-
|
|
3342
|
+
case 22:
|
|
3343
|
+
_context8.prev = 22;
|
|
3344
|
+
_t4 = _context8["catch"](4);
|
|
3339
3345
|
_didIteratorError = true;
|
|
3340
|
-
_iteratorError =
|
|
3341
|
-
case
|
|
3342
|
-
_context8.prev =
|
|
3343
|
-
_context8.prev =
|
|
3346
|
+
_iteratorError = _t4;
|
|
3347
|
+
case 23:
|
|
3348
|
+
_context8.prev = 23;
|
|
3349
|
+
_context8.prev = 24;
|
|
3344
3350
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
3345
|
-
_context8.next =
|
|
3351
|
+
_context8.next = 25;
|
|
3346
3352
|
break;
|
|
3347
3353
|
}
|
|
3348
|
-
_context8.next =
|
|
3354
|
+
_context8.next = 25;
|
|
3349
3355
|
return _awaitAsyncGenerator__default['default'](_iterator["return"]());
|
|
3350
|
-
case
|
|
3351
|
-
_context8.prev =
|
|
3356
|
+
case 25:
|
|
3357
|
+
_context8.prev = 25;
|
|
3352
3358
|
if (!_didIteratorError) {
|
|
3353
|
-
_context8.next =
|
|
3359
|
+
_context8.next = 26;
|
|
3354
3360
|
break;
|
|
3355
3361
|
}
|
|
3356
3362
|
throw _iteratorError;
|
|
3357
|
-
case
|
|
3358
|
-
return _context8.finish(
|
|
3359
|
-
case
|
|
3360
|
-
return _context8.finish(
|
|
3361
|
-
case
|
|
3363
|
+
case 26:
|
|
3364
|
+
return _context8.finish(25);
|
|
3365
|
+
case 27:
|
|
3366
|
+
return _context8.finish(23);
|
|
3367
|
+
case 28:
|
|
3362
3368
|
if (!buffer.trim()) {
|
|
3363
|
-
_context8.next =
|
|
3369
|
+
_context8.next = 36;
|
|
3364
3370
|
break;
|
|
3365
3371
|
}
|
|
3366
|
-
_context8.prev =
|
|
3372
|
+
_context8.prev = 29;
|
|
3367
3373
|
_parsed = JSON.parse(buffer);
|
|
3368
3374
|
if (!_parsed.schema) {
|
|
3369
|
-
_context8.next =
|
|
3375
|
+
_context8.next = 31;
|
|
3370
3376
|
break;
|
|
3371
3377
|
}
|
|
3372
|
-
_context8.next =
|
|
3378
|
+
_context8.next = 30;
|
|
3373
3379
|
return {
|
|
3374
3380
|
type: 'schema',
|
|
3375
3381
|
schema: _parsed.schema
|
|
3376
3382
|
};
|
|
3377
|
-
case
|
|
3378
|
-
_context8.next =
|
|
3383
|
+
case 30:
|
|
3384
|
+
_context8.next = 34;
|
|
3379
3385
|
break;
|
|
3380
|
-
case
|
|
3386
|
+
case 31:
|
|
3381
3387
|
if (!_parsed.data) {
|
|
3382
|
-
_context8.next =
|
|
3388
|
+
_context8.next = 33;
|
|
3383
3389
|
break;
|
|
3384
3390
|
}
|
|
3385
|
-
_context8.next =
|
|
3391
|
+
_context8.next = 32;
|
|
3386
3392
|
return {
|
|
3387
3393
|
type: 'data',
|
|
3388
3394
|
data: _parsed.data
|
|
3389
3395
|
};
|
|
3390
|
-
case
|
|
3391
|
-
_context8.next =
|
|
3396
|
+
case 32:
|
|
3397
|
+
_context8.next = 34;
|
|
3392
3398
|
break;
|
|
3393
|
-
case
|
|
3399
|
+
case 33:
|
|
3394
3400
|
if (!_parsed.error) {
|
|
3395
|
-
_context8.next =
|
|
3401
|
+
_context8.next = 34;
|
|
3396
3402
|
break;
|
|
3397
3403
|
}
|
|
3398
|
-
_context8.next =
|
|
3404
|
+
_context8.next = 34;
|
|
3399
3405
|
return {
|
|
3400
3406
|
type: 'error',
|
|
3401
3407
|
error: _parsed.error
|
|
3402
3408
|
};
|
|
3403
|
-
case
|
|
3404
|
-
_context8.next =
|
|
3409
|
+
case 34:
|
|
3410
|
+
_context8.next = 36;
|
|
3405
3411
|
break;
|
|
3406
|
-
case
|
|
3407
|
-
_context8.prev =
|
|
3408
|
-
_context8
|
|
3409
|
-
_context8.next =
|
|
3412
|
+
case 35:
|
|
3413
|
+
_context8.prev = 35;
|
|
3414
|
+
_context8["catch"](29);
|
|
3415
|
+
_context8.next = 36;
|
|
3410
3416
|
return {
|
|
3411
3417
|
type: 'error',
|
|
3412
3418
|
error: "Failed to parse remaining JSON: ".concat(buffer)
|
|
3413
3419
|
};
|
|
3414
|
-
case
|
|
3415
|
-
_context8.next =
|
|
3420
|
+
case 36:
|
|
3421
|
+
_context8.next = 39;
|
|
3416
3422
|
break;
|
|
3417
|
-
case
|
|
3418
|
-
_context8.prev =
|
|
3419
|
-
|
|
3420
|
-
if (!(
|
|
3421
|
-
_context8.next =
|
|
3423
|
+
case 37:
|
|
3424
|
+
_context8.prev = 37;
|
|
3425
|
+
_t6 = _context8["catch"](2);
|
|
3426
|
+
if (!(_t6.name === 'AbortError')) {
|
|
3427
|
+
_context8.next = 38;
|
|
3422
3428
|
break;
|
|
3423
3429
|
}
|
|
3424
3430
|
throw new Error('aborted');
|
|
3425
|
-
case
|
|
3426
|
-
throw
|
|
3427
|
-
case
|
|
3428
|
-
_context8.prev =
|
|
3431
|
+
case 38:
|
|
3432
|
+
throw _t6;
|
|
3433
|
+
case 39:
|
|
3434
|
+
_context8.prev = 39;
|
|
3429
3435
|
if (!streamResponse.unsubscribe) {
|
|
3430
|
-
_context8.next =
|
|
3436
|
+
_context8.next = 40;
|
|
3431
3437
|
break;
|
|
3432
3438
|
}
|
|
3433
|
-
_context8.next =
|
|
3439
|
+
_context8.next = 40;
|
|
3434
3440
|
return _awaitAsyncGenerator__default['default'](streamResponse.unsubscribe());
|
|
3435
|
-
case
|
|
3436
|
-
return _context8.finish(
|
|
3437
|
-
case
|
|
3441
|
+
case 40:
|
|
3442
|
+
return _context8.finish(39);
|
|
3443
|
+
case 41:
|
|
3438
3444
|
case "end":
|
|
3439
3445
|
return _context8.stop();
|
|
3440
3446
|
}
|
|
3441
|
-
}, _callee8, null, [[
|
|
3447
|
+
}, _callee8, null, [[2, 37, 39, 41], [4, 22, 23, 28], [7, 18, 19, 20], [9, 15], [24,, 25, 27], [29, 35]]);
|
|
3442
3448
|
}))();
|
|
3443
3449
|
}
|
|
3444
3450
|
}]);
|