Skip to content

Commit e6ee408

Browse files
committed
Client build
1 parent ab9539a commit e6ee408

File tree

3 files changed

+70
-25
lines changed

3 files changed

+70
-25
lines changed

packages/cubejs-client-core/dist/cubejs-client-core.esm.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import _createClass from '@babel/runtime/helpers/createClass';
88
import 'core-js/modules/es6.promise';
99
import 'core-js/modules/es6.object.to-string';
1010
import uuid from 'uuid/v4';
11-
import 'core-js/modules/es6.number.constructor';
1211
import 'core-js/modules/es6.number.parse-float';
12+
import 'core-js/modules/es6.number.constructor';
13+
import 'core-js/modules/es6.number.is-nan';
1314
import 'core-js/modules/web.dom.iterable';
1415
import 'core-js/modules/es6.array.iterator';
1516
import 'core-js/modules/es6.object.keys';
@@ -75,6 +76,7 @@ var TIME_SERIES = {
7576
}
7677
};
7778
var DateRegex = /^\d\d\d\d-\d\d-\d\d$/;
79+
var ISO8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
7880
/**
7981
* Provides a convenient interface for data manipulation.
8082
*/
@@ -421,6 +423,16 @@ function () {
421423
value: function chartPivot(pivotConfig) {
422424
var _this3 = this;
423425

426+
var validate = function validate(value) {
427+
if (ISO8601_REGEX.test(value)) {
428+
return new Date(value);
429+
} else if (!Number.isNaN(Number.parseFloat(value))) {
430+
return Number.parseFloat(value);
431+
}
432+
433+
return value;
434+
};
435+
424436
return this.pivot(pivotConfig).map(function (_ref15) {
425437
var xValues = _ref15.xValues,
426438
yValuesArray = _ref15.yValuesArray;
@@ -433,7 +445,7 @@ function () {
433445
yValues = _ref17[0],
434446
m = _ref17[1];
435447

436-
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m));
448+
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && validate(m));
437449
}).reduce(function (a, b) {
438450
return Object.assign(a, b);
439451
}, {}));

packages/cubejs-client-core/dist/cubejs-client-core.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass')
1414
require('core-js/modules/es6.promise');
1515
require('core-js/modules/es6.object.to-string');
1616
var uuid = _interopDefault(require('uuid/v4'));
17-
require('core-js/modules/es6.number.constructor');
1817
require('core-js/modules/es6.number.parse-float');
18+
require('core-js/modules/es6.number.constructor');
19+
require('core-js/modules/es6.number.is-nan');
1920
require('core-js/modules/web.dom.iterable');
2021
require('core-js/modules/es6.array.iterator');
2122
require('core-js/modules/es6.object.keys');
@@ -81,6 +82,7 @@ var TIME_SERIES = {
8182
}
8283
};
8384
var DateRegex = /^\d\d\d\d-\d\d-\d\d$/;
85+
var ISO8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
8486
/**
8587
* Provides a convenient interface for data manipulation.
8688
*/
@@ -427,6 +429,16 @@ function () {
427429
value: function chartPivot(pivotConfig) {
428430
var _this3 = this;
429431

432+
var validate = function validate(value) {
433+
if (ISO8601_REGEX.test(value)) {
434+
return new Date(value);
435+
} else if (!Number.isNaN(Number.parseFloat(value))) {
436+
return Number.parseFloat(value);
437+
}
438+
439+
return value;
440+
};
441+
430442
return this.pivot(pivotConfig).map(function (_ref15) {
431443
var xValues = _ref15.xValues,
432444
yValuesArray = _ref15.yValuesArray;
@@ -439,7 +451,7 @@ function () {
439451
yValues = _ref17[0],
440452
m = _ref17[1];
441453

442-
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m));
454+
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && validate(m));
443455
}).reduce(function (a, b) {
444456
return Object.assign(a, b);
445457
}, {}));

packages/cubejs-client-core/dist/cubejs-client-core.umd.js

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,15 +3633,6 @@
36333633

36343634
var v4_1 = v4;
36353635

3636-
var setPrototypeOf = _setProto.set;
3637-
var _inheritIfRequired = function (that, target, C) {
3638-
var S = target.constructor;
3639-
var P;
3640-
if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) {
3641-
setPrototypeOf(that, P);
3642-
} return that;
3643-
};
3644-
36453636
var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
36463637
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
36473638

@@ -3672,10 +3663,31 @@
36723663

36733664
var _stringTrim = exporter;
36743665

3666+
var $parseFloat = _global.parseFloat;
3667+
var $trim = _stringTrim.trim;
3668+
3669+
var _parseFloat = 1 / $parseFloat(_stringWs + '-0') !== -Infinity ? function parseFloat(str) {
3670+
var string = $trim(String(str), 3);
3671+
var result = $parseFloat(string);
3672+
return result === 0 && string.charAt(0) == '-' ? -0 : result;
3673+
} : $parseFloat;
3674+
3675+
// 20.1.2.12 Number.parseFloat(string)
3676+
_export(_export.S + _export.F * (Number.parseFloat != _parseFloat), 'Number', { parseFloat: _parseFloat });
3677+
3678+
var setPrototypeOf = _setProto.set;
3679+
var _inheritIfRequired = function (that, target, C) {
3680+
var S = target.constructor;
3681+
var P;
3682+
if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) {
3683+
setPrototypeOf(that, P);
3684+
} return that;
3685+
};
3686+
36753687
var gOPN$2 = _objectGopn.f;
36763688
var gOPD$2 = _objectGopd.f;
36773689
var dP$3 = _objectDp.f;
3678-
var $trim = _stringTrim.trim;
3690+
var $trim$1 = _stringTrim.trim;
36793691
var NUMBER = 'Number';
36803692
var $Number = _global[NUMBER];
36813693
var Base = $Number;
@@ -3688,7 +3700,7 @@
36883700
var toNumber = function (argument) {
36893701
var it = _toPrimitive(argument, false);
36903702
if (typeof it == 'string' && it.length > 2) {
3691-
it = TRIM ? it.trim() : $trim(it, 3);
3703+
it = TRIM ? it.trim() : $trim$1(it, 3);
36923704
var first = it.charCodeAt(0);
36933705
var third, radix, maxCode;
36943706
if (first === 43 || first === 45) {
@@ -3735,17 +3747,15 @@
37353747
_redefine(_global, NUMBER, $Number);
37363748
}
37373749

3738-
var $parseFloat = _global.parseFloat;
3739-
var $trim$1 = _stringTrim.trim;
3750+
// 20.1.2.4 Number.isNaN(number)
37403751

3741-
var _parseFloat = 1 / $parseFloat(_stringWs + '-0') !== -Infinity ? function parseFloat(str) {
3742-
var string = $trim$1(String(str), 3);
3743-
var result = $parseFloat(string);
3744-
return result === 0 && string.charAt(0) == '-' ? -0 : result;
3745-
} : $parseFloat;
37463752

3747-
// 20.1.2.12 Number.parseFloat(string)
3748-
_export(_export.S + _export.F * (Number.parseFloat != _parseFloat), 'Number', { parseFloat: _parseFloat });
3753+
_export(_export.S, 'Number', {
3754+
isNaN: function isNaN(number) {
3755+
// eslint-disable-next-line no-self-compare
3756+
return number != number;
3757+
}
3758+
});
37493759

37503760
// most Object methods by ES6 should accept primitives
37513761

@@ -13589,6 +13599,7 @@
1358913599
}
1359013600
};
1359113601
var DateRegex = /^\d\d\d\d-\d\d-\d\d$/;
13602+
var ISO8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
1359213603
/**
1359313604
* Provides a convenient interface for data manipulation.
1359413605
*/
@@ -13935,6 +13946,16 @@
1393513946
value: function chartPivot(pivotConfig) {
1393613947
var _this3 = this;
1393713948

13949+
var validate = function validate(value) {
13950+
if (ISO8601_REGEX.test(value)) {
13951+
return new Date(value);
13952+
} else if (!Number.isNaN(Number.parseFloat(value))) {
13953+
return Number.parseFloat(value);
13954+
}
13955+
13956+
return value;
13957+
};
13958+
1393813959
return this.pivot(pivotConfig).map(function (_ref15) {
1393913960
var xValues = _ref15.xValues,
1394013961
yValuesArray = _ref15.yValuesArray;
@@ -13947,7 +13968,7 @@
1394713968
yValues = _ref17[0],
1394813969
m = _ref17[1];
1394913970

13950-
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m));
13971+
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && validate(m));
1395113972
}).reduce(function (a, b) {
1395213973
return Object.assign(a, b);
1395313974
}, {}));

0 commit comments

Comments
 (0)