@cubejs-client/core 1.8.12 → 1.8.14
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 +58 -40
- package/dist/cubejs-client-core.cjs.map +1 -1
- package/dist/cubejs-client-core.umd.js +61 -43
- package/dist/cubejs-client-core.umd.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +25 -11
- package/dist/test/CubeApi.test.js +45 -0
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('core-js/modules/es.array.for-each.js'), require('core-js/modules/es.object.keys.js'), require('core-js/modules/es.object.to-string.js'), require('core-js/modules/web.dom-collections.for-each.js'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.is-array.js'), require('core-js/modules/es.array.map.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.array.slice.js'), require('core-js/modules/es.function.name.js'), require('core-js/modules/es.number.constructor.js'), require('core-js/modules/es.object.entries.js'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/web.timers.js'), require('uuid'), require('core-js/modules/es.array.concat.js'), require('core-js/modules/es.array.filter.js'), require('core-js/modules/es.array.find.js'), require('core-js/modules/es.array.from.js'), require('core-js/modules/es.array.index-of.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.array.join.js'), require('core-js/modules/es.date.to-string.js'), require('core-js/modules/es.map.js'), require('core-js/modules/es.number.is-nan.js'), require('core-js/modules/es.number.parse-float.js'), require('core-js/modules/es.object.values.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.regexp.to-string.js'), require('core-js/modules/es.set.js'), require('core-js/modules/es.string.iterator.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('dayjs'), require('ramda'), require('core-js/modules/es.array.every.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.splice.js'), require('core-js/modules/es.array.unscopables.flat-map.js'), require('core-js/modules/es.parse-int.js'), require('core-js/modules/es.string.ends-with.js'), require('core-js/modules/es.string.split.js'), require('dayjs/plugin/quarterOfYear.js'), require('dayjs/plugin/duration.js'), require('dayjs/plugin/isoWeek.js'), require('dayjs/locale/en.js'), require('core-js/modules/es.array.sort.js'), require('core-js/modules/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['core-js/modules/es.array.for-each.js', 'core-js/modules/es.object.keys.js', 'core-js/modules/es.object.to-string.js', 'core-js/modules/web.dom-collections.for-each.js', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.is-array.js', 'core-js/modules/es.array.map.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.array.slice.js', 'core-js/modules/es.function.name.js', 'core-js/modules/es.number.constructor.js', 'core-js/modules/es.object.entries.js', 'core-js/modules/es.promise.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/web.timers.js', 'uuid', 'core-js/modules/es.array.concat.js', 'core-js/modules/es.array.filter.js', 'core-js/modules/es.array.find.js', 'core-js/modules/es.array.from.js', 'core-js/modules/es.array.index-of.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.array.join.js', 'core-js/modules/es.date.to-string.js', 'core-js/modules/es.map.js', 'core-js/modules/es.number.is-nan.js', 'core-js/modules/es.number.parse-float.js', 'core-js/modules/es.object.values.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.regexp.to-string.js', 'core-js/modules/es.set.js', 'core-js/modules/es.string.iterator.js', 'core-js/modules/es.string.match.js', 'core-js/modules/web.dom-collections.iterator.js', 'dayjs', 'ramda', 'core-js/modules/es.array.every.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.splice.js', 'core-js/modules/es.array.unscopables.flat-map.js', 'core-js/modules/es.parse-int.js', 'core-js/modules/es.string.ends-with.js', 'core-js/modules/es.string.split.js', 'dayjs/plugin/quarterOfYear.js', 'dayjs/plugin/duration.js', 'dayjs/plugin/isoWeek.js', 'dayjs/locale/en.js', 'core-js/modules/es.array.sort.js', 'core-js/modules/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.cubejs = factory(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.uuid, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.dayjs, global.ramda, null, null, null, null, null, null, null, global.quarterOfYear, global.duration, global.isoWeek, global.en));
|
|
5
|
-
})(this, (function (es_array_forEach_js, es_object_keys_js, es_object_toString_js, web_domCollections_forEach_js, es_array_includes_js, es_array_isArray_js, es_array_map_js, es_array_reduce_js, es_array_slice_js, es_function_name_js, es_number_constructor_js, es_object_entries_js, es_promise_js, es_string_includes_js, es_string_trim_js, web_timers_js, uuid, es_array_concat_js, es_array_filter_js, es_array_find_js, es_array_from_js, es_array_indexOf_js, es_array_iterator_js, es_array_join_js, es_date_toString_js, es_map_js, es_number_isNan_js, es_number_parseFloat_js, es_object_values_js, es_regexp_exec_js, es_regexp_toString_js, es_set_js, es_string_iterator_js, es_string_match_js, web_domCollections_iterator_js, dayjs, ramda, es_array_every_js, es_array_flatMap_js, es_array_splice_js, es_array_unscopables_flatMap_js, es_parseInt_js, es_string_endsWith_js, es_string_split_js, quarterOfYear, duration, isoWeek, en) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('core-js/modules/es.array.for-each.js'), require('core-js/modules/es.object.keys.js'), require('core-js/modules/es.object.to-string.js'), require('core-js/modules/web.dom-collections.for-each.js'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.is-array.js'), require('core-js/modules/es.array.map.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.array.slice.js'), require('core-js/modules/es.date.to-json.js'), require('core-js/modules/es.function.name.js'), require('core-js/modules/es.number.constructor.js'), require('core-js/modules/es.object.entries.js'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/web.timers.js'), require('uuid'), require('core-js/modules/es.array.concat.js'), require('core-js/modules/es.array.filter.js'), require('core-js/modules/es.array.find.js'), require('core-js/modules/es.array.from.js'), require('core-js/modules/es.array.index-of.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.array.join.js'), require('core-js/modules/es.date.to-string.js'), require('core-js/modules/es.map.js'), require('core-js/modules/es.number.is-nan.js'), require('core-js/modules/es.number.parse-float.js'), require('core-js/modules/es.object.values.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.regexp.to-string.js'), require('core-js/modules/es.set.js'), require('core-js/modules/es.string.iterator.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('dayjs'), require('ramda'), require('core-js/modules/es.array.every.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.splice.js'), require('core-js/modules/es.array.unscopables.flat-map.js'), require('core-js/modules/es.parse-int.js'), require('core-js/modules/es.string.ends-with.js'), require('core-js/modules/es.string.split.js'), require('dayjs/plugin/quarterOfYear.js'), require('dayjs/plugin/duration.js'), require('dayjs/plugin/isoWeek.js'), require('dayjs/locale/en.js'), require('core-js/modules/es.array.sort.js'), require('core-js/modules/web.url-search-params.js'), require('url-search-params-polyfill')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['core-js/modules/es.array.for-each.js', 'core-js/modules/es.object.keys.js', 'core-js/modules/es.object.to-string.js', 'core-js/modules/web.dom-collections.for-each.js', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.is-array.js', 'core-js/modules/es.array.map.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.array.slice.js', 'core-js/modules/es.date.to-json.js', 'core-js/modules/es.function.name.js', 'core-js/modules/es.number.constructor.js', 'core-js/modules/es.object.entries.js', 'core-js/modules/es.promise.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/web.timers.js', 'uuid', 'core-js/modules/es.array.concat.js', 'core-js/modules/es.array.filter.js', 'core-js/modules/es.array.find.js', 'core-js/modules/es.array.from.js', 'core-js/modules/es.array.index-of.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.array.join.js', 'core-js/modules/es.date.to-string.js', 'core-js/modules/es.map.js', 'core-js/modules/es.number.is-nan.js', 'core-js/modules/es.number.parse-float.js', 'core-js/modules/es.object.values.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.regexp.to-string.js', 'core-js/modules/es.set.js', 'core-js/modules/es.string.iterator.js', 'core-js/modules/es.string.match.js', 'core-js/modules/web.dom-collections.iterator.js', 'dayjs', 'ramda', 'core-js/modules/es.array.every.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.splice.js', 'core-js/modules/es.array.unscopables.flat-map.js', 'core-js/modules/es.parse-int.js', 'core-js/modules/es.string.ends-with.js', 'core-js/modules/es.string.split.js', 'dayjs/plugin/quarterOfYear.js', 'dayjs/plugin/duration.js', 'dayjs/plugin/isoWeek.js', 'dayjs/locale/en.js', 'core-js/modules/es.array.sort.js', 'core-js/modules/web.url-search-params.js', 'url-search-params-polyfill'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.cubejs = factory(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.uuid, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.dayjs, global.ramda, null, null, null, null, null, null, null, global.quarterOfYear, global.duration, global.isoWeek, global.en));
|
|
5
|
+
})(this, (function (es_array_forEach_js, es_object_keys_js, es_object_toString_js, web_domCollections_forEach_js, es_array_includes_js, es_array_isArray_js, es_array_map_js, es_array_reduce_js, es_array_slice_js, es_date_toJson_js, es_function_name_js, es_number_constructor_js, es_object_entries_js, es_promise_js, es_string_includes_js, es_string_trim_js, web_timers_js, uuid, es_array_concat_js, es_array_filter_js, es_array_find_js, es_array_from_js, es_array_indexOf_js, es_array_iterator_js, es_array_join_js, es_date_toString_js, es_map_js, es_number_isNan_js, es_number_parseFloat_js, es_object_values_js, es_regexp_exec_js, es_regexp_toString_js, es_set_js, es_string_iterator_js, es_string_match_js, web_domCollections_iterator_js, dayjs, ramda, es_array_every_js, es_array_flatMap_js, es_array_splice_js, es_array_unscopables_flatMap_js, es_parseInt_js, es_string_endsWith_js, es_string_split_js, quarterOfYear, duration, isoWeek, en) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -3062,8 +3062,8 @@
|
|
|
3062
3062
|
var networkRetries = this.networkErrorRetries;
|
|
3063
3063
|
var loadImpl = /*#__PURE__*/function () {
|
|
3064
3064
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(response, next) {
|
|
3065
|
-
var _options2, _response$error, _body$error,
|
|
3066
|
-
var requestInstance, subscribeNext, continueWait, body, text, _options3,
|
|
3065
|
+
var _options2, _response$error, _body$error, _options4;
|
|
3066
|
+
var requestInstance, subscribeNext, continueWait, body, text, _options3, result, error, _t2;
|
|
3067
3067
|
return _regenerator().w(function (_context4) {
|
|
3068
3068
|
while (1) switch (_context4.p = _context4.n) {
|
|
3069
3069
|
case 0:
|
|
@@ -3183,10 +3183,6 @@
|
|
|
3183
3183
|
}
|
|
3184
3184
|
return _context4.a(2, continueWait());
|
|
3185
3185
|
case 10:
|
|
3186
|
-
if (!(response.status !== 200)) {
|
|
3187
|
-
_context4.n = 15;
|
|
3188
|
-
break;
|
|
3189
|
-
}
|
|
3190
3186
|
_context4.n = 11;
|
|
3191
3187
|
return checkMutex();
|
|
3192
3188
|
case 11:
|
|
@@ -3197,43 +3193,60 @@
|
|
|
3197
3193
|
_context4.n = 12;
|
|
3198
3194
|
return requestInstance.unsubscribe();
|
|
3199
3195
|
case 12:
|
|
3200
|
-
|
|
3201
|
-
if (!
|
|
3196
|
+
error = null;
|
|
3197
|
+
if (!(response.status !== 200)) {
|
|
3202
3198
|
_context4.n = 13;
|
|
3203
3199
|
break;
|
|
3204
3200
|
}
|
|
3205
|
-
|
|
3206
|
-
_context4.n =
|
|
3201
|
+
error = new RequestError(body.error || response.error || '', body, response.status);
|
|
3202
|
+
_context4.n = 16;
|
|
3207
3203
|
break;
|
|
3208
3204
|
case 13:
|
|
3209
|
-
|
|
3205
|
+
_context4.p = 13;
|
|
3206
|
+
result = toResult(body);
|
|
3207
|
+
_context4.n = 16;
|
|
3208
|
+
break;
|
|
3210
3209
|
case 14:
|
|
3211
|
-
|
|
3210
|
+
_context4.p = 14;
|
|
3211
|
+
_t2 = _context4.v;
|
|
3212
|
+
if (_t2 instanceof RequestError) {
|
|
3213
|
+
_context4.n = 15;
|
|
3214
|
+
break;
|
|
3215
|
+
}
|
|
3216
|
+
throw _t2;
|
|
3212
3217
|
case 15:
|
|
3213
|
-
|
|
3214
|
-
return checkMutex();
|
|
3218
|
+
error = _t2;
|
|
3215
3219
|
case 16:
|
|
3216
|
-
if (!
|
|
3220
|
+
if (!error) {
|
|
3221
|
+
_context4.n = 19;
|
|
3222
|
+
break;
|
|
3223
|
+
}
|
|
3224
|
+
if (!callback) {
|
|
3217
3225
|
_context4.n = 17;
|
|
3218
3226
|
break;
|
|
3219
3227
|
}
|
|
3220
|
-
|
|
3221
|
-
|
|
3228
|
+
callback(error);
|
|
3229
|
+
_context4.n = 18;
|
|
3230
|
+
break;
|
|
3222
3231
|
case 17:
|
|
3223
|
-
|
|
3232
|
+
throw error;
|
|
3233
|
+
case 18:
|
|
3234
|
+
_context4.n = 21;
|
|
3235
|
+
break;
|
|
3236
|
+
case 19:
|
|
3224
3237
|
if (!callback) {
|
|
3225
|
-
_context4.n =
|
|
3238
|
+
_context4.n = 20;
|
|
3226
3239
|
break;
|
|
3227
3240
|
}
|
|
3228
3241
|
callback(null, result);
|
|
3229
|
-
_context4.n =
|
|
3242
|
+
_context4.n = 21;
|
|
3230
3243
|
break;
|
|
3231
|
-
case
|
|
3244
|
+
case 20:
|
|
3232
3245
|
return _context4.a(2, result);
|
|
3233
|
-
case
|
|
3246
|
+
case 21:
|
|
3234
3247
|
return _context4.a(2, subscribeNext());
|
|
3235
3248
|
}
|
|
3236
|
-
}, _callee4, null, [[5, 7]]);
|
|
3249
|
+
}, _callee4, null, [[13, 14], [5, 7]]);
|
|
3237
3250
|
}));
|
|
3238
3251
|
return function loadImpl(_x, _x2) {
|
|
3239
3252
|
return _ref2.apply(this, arguments);
|
|
@@ -3356,6 +3369,11 @@
|
|
|
3356
3369
|
key: "loadResponseInternal",
|
|
3357
3370
|
value: function loadResponseInternal(response) {
|
|
3358
3371
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3372
|
+
// A 200 that isn't a load response, e.g. a non-JSON body like "[object Blob]" (#6149)
|
|
3373
|
+
if (!Array.isArray(response === null || response === void 0 ? void 0 : response.results)) {
|
|
3374
|
+
var body = response;
|
|
3375
|
+
throw new RequestError(body.error || "Invalid load response: ".concat(JSON.stringify(response)), response, 200);
|
|
3376
|
+
}
|
|
3359
3377
|
if (response.results.length) {
|
|
3360
3378
|
if (options !== null && options !== void 0 && options.castNumerics) {
|
|
3361
3379
|
response.results.forEach(function (result) {
|
|
@@ -3450,9 +3468,9 @@
|
|
|
3450
3468
|
* @param responseFormat
|
|
3451
3469
|
*/
|
|
3452
3470
|
function load(query, options, callback) {
|
|
3453
|
-
var
|
|
3471
|
+
var _options5,
|
|
3472
|
+
_options6,
|
|
3454
3473
|
_options7,
|
|
3455
|
-
_options8,
|
|
3456
3474
|
_this4 = this;
|
|
3457
3475
|
var responseFormat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'default';
|
|
3458
3476
|
var _this$prepareQueryOpt = this.prepareQueryOptions(query, options, responseFormat);
|
|
@@ -3462,10 +3480,10 @@
|
|
|
3462
3480
|
var params = {
|
|
3463
3481
|
query: query,
|
|
3464
3482
|
queryType: 'multi',
|
|
3465
|
-
signal: (
|
|
3466
|
-
baseRequestId: (
|
|
3483
|
+
signal: (_options5 = options) === null || _options5 === void 0 ? void 0 : _options5.signal,
|
|
3484
|
+
baseRequestId: (_options6 = options) === null || _options6 === void 0 ? void 0 : _options6.baseRequestId
|
|
3467
3485
|
};
|
|
3468
|
-
if ((
|
|
3486
|
+
if ((_options7 = options) !== null && _options7 !== void 0 && _options7.cache) {
|
|
3469
3487
|
params.cache = options.cache;
|
|
3470
3488
|
}
|
|
3471
3489
|
return this.loadMethod(function () {
|
|
@@ -3534,12 +3552,12 @@
|
|
|
3534
3552
|
query = _this$prepareQueryOpt4[0];
|
|
3535
3553
|
options = _this$prepareQueryOpt4[1];
|
|
3536
3554
|
return this.loadMethod(function () {
|
|
3537
|
-
var
|
|
3555
|
+
var _options8, _options9;
|
|
3538
3556
|
return _this6.request('subscribe', {
|
|
3539
3557
|
query: query,
|
|
3540
3558
|
queryType: 'multi',
|
|
3541
|
-
signal: (
|
|
3542
|
-
baseRequestId: (
|
|
3559
|
+
signal: (_options8 = options) === null || _options8 === void 0 ? void 0 : _options8.signal,
|
|
3560
|
+
baseRequestId: (_options9 = options) === null || _options9 === void 0 ? void 0 : _options9.baseRequestId
|
|
3543
3561
|
});
|
|
3544
3562
|
}, function (response) {
|
|
3545
3563
|
return _this6.loadResponseInternal(response, options);
|
|
@@ -3722,7 +3740,7 @@
|
|
|
3722
3740
|
value: function cubeSqlStream(sqlQuery, options) {
|
|
3723
3741
|
var _this = this;
|
|
3724
3742
|
return _wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
3725
|
-
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator3, _step3, line, parsed, _parsed,
|
|
3743
|
+
var streamResponse, decoder, buffer, stream, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, lines, _iterator3, _step3, line, parsed, _parsed, _t4, _t5, _t7;
|
|
3726
3744
|
return _regenerator().w(function (_context8) {
|
|
3727
3745
|
while (1) switch (_context8.p = _context8.n) {
|
|
3728
3746
|
case 0:
|
|
@@ -3837,8 +3855,8 @@
|
|
|
3837
3855
|
break;
|
|
3838
3856
|
case 18:
|
|
3839
3857
|
_context8.p = 18;
|
|
3840
|
-
|
|
3841
|
-
_iterator3.e(
|
|
3858
|
+
_t4 = _context8.v;
|
|
3859
|
+
_iterator3.e(_t4);
|
|
3842
3860
|
case 19:
|
|
3843
3861
|
_context8.p = 19;
|
|
3844
3862
|
_iterator3.f();
|
|
@@ -3852,9 +3870,9 @@
|
|
|
3852
3870
|
break;
|
|
3853
3871
|
case 22:
|
|
3854
3872
|
_context8.p = 22;
|
|
3855
|
-
|
|
3873
|
+
_t5 = _context8.v;
|
|
3856
3874
|
_didIteratorError = true;
|
|
3857
|
-
_iteratorError =
|
|
3875
|
+
_iteratorError = _t5;
|
|
3858
3876
|
case 23:
|
|
3859
3877
|
_context8.p = 23;
|
|
3860
3878
|
_context8.p = 24;
|
|
@@ -3933,14 +3951,14 @@
|
|
|
3933
3951
|
break;
|
|
3934
3952
|
case 37:
|
|
3935
3953
|
_context8.p = 37;
|
|
3936
|
-
|
|
3937
|
-
if (!(
|
|
3954
|
+
_t7 = _context8.v;
|
|
3955
|
+
if (!(_t7.name === 'AbortError')) {
|
|
3938
3956
|
_context8.n = 38;
|
|
3939
3957
|
break;
|
|
3940
3958
|
}
|
|
3941
3959
|
throw new Error('aborted');
|
|
3942
3960
|
case 38:
|
|
3943
|
-
throw
|
|
3961
|
+
throw _t7;
|
|
3944
3962
|
case 39:
|
|
3945
3963
|
_context8.p = 39;
|
|
3946
3964
|
if (!streamResponse.unsubscribe) {
|