@cubejs-client/core 1.6.31 → 1.6.33

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.
Files changed (54) hide show
  1. package/dist/cubejs-client-core.cjs.js +20 -14
  2. package/dist/cubejs-client-core.cjs.js.map +1 -1
  3. package/dist/cubejs-client-core.umd.js +20 -14
  4. package/dist/cubejs-client-core.umd.js.map +1 -1
  5. package/dist/src/ResultSet.d.ts.map +1 -1
  6. package/dist/src/ResultSet.js +20 -13
  7. package/dist/src/format-d3-numeric-locale.d.ts +4 -0
  8. package/dist/src/format-d3-numeric-locale.d.ts.map +1 -0
  9. package/dist/src/format-d3-numeric-locale.js +103 -0
  10. package/dist/src/format.d.ts +17 -0
  11. package/dist/src/format.d.ts.map +1 -0
  12. package/dist/src/format.js +89 -0
  13. package/dist/src/index.js +2 -0
  14. package/dist/test/CubeApi.test.js +37 -37
  15. package/dist/test/HttpTransport.test.js +3 -3
  16. package/dist/test/ResultSet.bench.d.ts +2 -0
  17. package/dist/test/ResultSet.bench.d.ts.map +1 -0
  18. package/dist/test/ResultSet.bench.js +109 -0
  19. package/dist/test/ResultSet.test.d.ts +1 -1
  20. package/dist/test/ResultSet.test.d.ts.map +1 -1
  21. package/dist/test/ResultSet.test.js +0 -2
  22. package/dist/test/SqlQuery.test.js +0 -1
  23. package/dist/test/compare-date-range.test.d.ts +1 -1
  24. package/dist/test/compare-date-range.test.d.ts.map +1 -1
  25. package/dist/test/compare-date-range.test.js +0 -2
  26. package/dist/test/data-blending.test.d.ts +1 -1
  27. package/dist/test/data-blending.test.d.ts.map +1 -1
  28. package/dist/test/data-blending.test.js +0 -2
  29. package/dist/test/dayjs-isolation.test.d.ts +1 -1
  30. package/dist/test/dayjs-isolation.test.d.ts.map +1 -1
  31. package/dist/test/dayjs-isolation.test.js +0 -2
  32. package/dist/test/default-heuristics.test.d.ts +1 -1
  33. package/dist/test/default-heuristics.test.d.ts.map +1 -1
  34. package/dist/test/default-heuristics.test.js +4 -5
  35. package/dist/test/drill-down.test.d.ts +1 -1
  36. package/dist/test/drill-down.test.d.ts.map +1 -1
  37. package/dist/test/drill-down.test.js +4 -5
  38. package/dist/test/format-no-intl.test.d.ts +2 -0
  39. package/dist/test/format-no-intl.test.d.ts.map +1 -0
  40. package/dist/test/format-no-intl.test.js +49 -0
  41. package/dist/test/format.test.d.ts +2 -0
  42. package/dist/test/format.test.d.ts.map +1 -0
  43. package/dist/test/format.test.js +87 -0
  44. package/dist/test/granularity.test.d.ts +1 -1
  45. package/dist/test/granularity.test.d.ts.map +1 -1
  46. package/dist/test/granularity.test.js +0 -2
  47. package/dist/test/index.test.js +2 -2
  48. package/dist/test/table.test.d.ts +1 -1
  49. package/dist/test/table.test.d.ts.map +1 -1
  50. package/dist/test/table.test.js +0 -2
  51. package/dist/test/utils.test.d.ts +1 -1
  52. package/dist/test/utils.test.d.ts.map +1 -1
  53. package/dist/test/utils.test.js +0 -2
  54. package/package.json +12 -9
@@ -0,0 +1,109 @@
1
+ import { bench, describe } from 'vitest';
2
+ import ResultSet from '../src/ResultSet';
3
+ const STATUSES = ['completed', 'processing', 'shipped'];
4
+ function generateLoadResponse(rowCount) {
5
+ const data = [];
6
+ const startDate = new Date('2020-01-01T00:00:00.000Z');
7
+ for (let i = 0; i < rowCount; i++) {
8
+ const date = new Date(startDate.getTime() + i * 86400000);
9
+ const dateStr = date.toISOString().replace('Z', '');
10
+ data.push({
11
+ 'Orders.createdAt.day': dateStr,
12
+ 'Orders.createdAt': dateStr,
13
+ 'Orders.status': STATUSES[i % 3],
14
+ 'Orders.count': String(Math.floor(Math.random() * 1000)),
15
+ });
16
+ }
17
+ return {
18
+ query: {
19
+ measures: ['Orders.count'],
20
+ dimensions: ['Orders.status'],
21
+ timeDimensions: [
22
+ {
23
+ dimension: 'Orders.createdAt',
24
+ granularity: 'day',
25
+ },
26
+ ],
27
+ },
28
+ data,
29
+ lastRefreshTime: '2024-01-01T00:00:00.000Z',
30
+ usedPreAggregations: {},
31
+ annotation: {
32
+ measures: {
33
+ 'Orders.count': {
34
+ title: 'Orders Count',
35
+ shortTitle: 'Count',
36
+ type: 'number',
37
+ },
38
+ },
39
+ dimensions: {
40
+ 'Orders.status': {
41
+ title: 'Orders Status',
42
+ shortTitle: 'Status',
43
+ type: 'string',
44
+ },
45
+ },
46
+ segments: {},
47
+ timeDimensions: {
48
+ 'Orders.createdAt': {
49
+ title: 'Orders Created at',
50
+ shortTitle: 'Created at',
51
+ type: 'time',
52
+ },
53
+ 'Orders.createdAt.day': {
54
+ title: 'Orders Created at',
55
+ shortTitle: 'Created at',
56
+ type: 'time',
57
+ granularity: {
58
+ name: 'day',
59
+ title: 'day',
60
+ interval: '1 day',
61
+ },
62
+ },
63
+ },
64
+ },
65
+ };
66
+ }
67
+ function computeHourRange(targetHours) {
68
+ const start = new Date('2020-01-01T00:00:00.000Z');
69
+ const end = new Date(start.getTime() + (targetHours - 1) * 3600000);
70
+ return [
71
+ start.toISOString().replace('Z', ''),
72
+ end.toISOString().replace('Z', ''),
73
+ ];
74
+ }
75
+ const ROW_COUNTS = [5000, 10000, 25000, 50000, 100000];
76
+ // Pre-build all ResultSets outside benchmarks to avoid measuring construction time
77
+ const pivotResultSets = new Map();
78
+ for (const count of ROW_COUNTS) {
79
+ pivotResultSets.set(count, new ResultSet(generateLoadResponse(count)));
80
+ }
81
+ describe('pivot', () => {
82
+ for (const count of ROW_COUNTS) {
83
+ const label = `${count / 1000}k rows`;
84
+ const rs = pivotResultSets.get(count);
85
+ bench(`pivot - ${label}`, () => {
86
+ rs.pivot();
87
+ });
88
+ bench(`chartPivot - ${label}`, () => {
89
+ rs.chartPivot();
90
+ });
91
+ bench(`tablePivot - ${label}`, () => {
92
+ rs.tablePivot();
93
+ });
94
+ }
95
+ });
96
+ describe('timeSeries', () => {
97
+ const rs = new ResultSet({});
98
+ for (const count of ROW_COUNTS) {
99
+ const label = `${count / 1000}k hours`;
100
+ const dateRange = computeHourRange(count);
101
+ bench(`timeSeries - ${label}`, () => {
102
+ rs.timeSeries({
103
+ dimension: 'Orders.createdAt',
104
+ granularity: 'hour',
105
+ dateRange,
106
+ });
107
+ });
108
+ }
109
+ });
@@ -3,5 +3,5 @@
3
3
  * @copyright Cube Dev, Inc.
4
4
  * @fileoverview ResultSet class unit tests.
5
5
  */
6
- import 'jest';
6
+ export {};
7
7
  //# sourceMappingURL=ResultSet.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultSet.test.d.ts","sourceRoot":"","sources":["../../test/ResultSet.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"ResultSet.test.d.ts","sourceRoot":"","sources":["../../test/ResultSet.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -3,8 +3,6 @@
3
3
  * @copyright Cube Dev, Inc.
4
4
  * @fileoverview ResultSet class unit tests.
5
5
  */
6
- /* globals describe,test,expect */
7
- import 'jest';
8
6
  import ResultSet from '../src/ResultSet';
9
7
  import { DescriptiveQueryResponse } from './helpers';
10
8
  describe('ResultSet', () => {
@@ -3,7 +3,6 @@
3
3
  * @copyright Cube Dev, Inc.
4
4
  * @fileoverview SqlQuery class unit tests.
5
5
  */
6
- /* globals describe,it,expect */
7
6
  import SqlQuery from '../src/SqlQuery';
8
7
  describe('SqlQuery', () => {
9
8
  const mockCacheKeyQueriesTuple = [
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=compare-date-range.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compare-date-range.test.d.ts","sourceRoot":"","sources":["../../test/compare-date-range.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"compare-date-range.test.d.ts","sourceRoot":"","sources":["../../test/compare-date-range.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe, test, expect */
2
- import 'jest';
3
1
  import ResultSet from '../src/ResultSet';
4
2
  const loadResponses = [
5
3
  {
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=data-blending.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-blending.test.d.ts","sourceRoot":"","sources":["../../test/data-blending.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"data-blending.test.d.ts","sourceRoot":"","sources":["../../test/data-blending.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe, test, expect */
2
- import 'jest';
3
1
  import ResultSet from '../src/ResultSet';
4
2
  import { loadResponse, loadResponseWithoutDateRange } from './fixtures/datablending/load-responses.json';
5
3
  describe('data blending', () => {
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=dayjs-isolation.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dayjs-isolation.test.d.ts","sourceRoot":"","sources":["../../test/dayjs-isolation.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"dayjs-isolation.test.d.ts","sourceRoot":"","sources":["../../test/dayjs-isolation.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe,test,expect */
2
- import 'jest';
3
1
  import dayjs from 'dayjs';
4
2
  import { internalDayjs } from '../src/time';
5
3
  describe('Dayjs Instance Isolation', () => {
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=default-heuristics.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-heuristics.test.d.ts","sourceRoot":"","sources":["../../test/default-heuristics.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"default-heuristics.test.d.ts","sourceRoot":"","sources":["../../test/default-heuristics.test.ts"],"names":[],"mappings":""}
@@ -1,9 +1,8 @@
1
- /* globals jest, describe, expect, it */
2
- import 'jest';
1
+ import { vi } from 'vitest';
3
2
  import { defaultHeuristics } from '../src/utils';
4
- jest.mock('moment-range', () => {
5
- const Moment = jest.requireActual('moment');
6
- const MomentRange = jest.requireActual('moment-range');
3
+ vi.mock('moment-range', async () => {
4
+ const Moment = await vi.importActual('moment');
5
+ const MomentRange = await vi.importActual('moment-range');
7
6
  const moment = MomentRange.extendMoment(Moment);
8
7
  return {
9
8
  extendMoment: () => moment,
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=drill-down.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drill-down.test.d.ts","sourceRoot":"","sources":["../../test/drill-down.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"drill-down.test.d.ts","sourceRoot":"","sources":["../../test/drill-down.test.ts"],"names":[],"mappings":""}
@@ -1,9 +1,8 @@
1
- /* globals jest, describe, expect, it */
2
- import 'jest';
1
+ import { vi } from 'vitest';
3
2
  import ResultSet from '../src/ResultSet';
4
- jest.mock('moment-range', () => {
5
- const Moment = jest.requireActual('moment');
6
- const MomentRange = jest.requireActual('moment-range');
3
+ vi.mock('moment-range', async () => {
4
+ const Moment = await vi.importActual('moment');
5
+ const MomentRange = await vi.importActual('moment-range');
7
6
  const moment = MomentRange.extendMoment(Moment);
8
7
  return {
9
8
  extendMoment: () => moment,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format-no-intl.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-no-intl.test.d.ts","sourceRoot":"","sources":["../../test/format-no-intl.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
2
+ describe('formatValue without Intl', () => {
3
+ const originalIntl = globalThis.Intl;
4
+ beforeAll(() => {
5
+ vi.resetModules();
6
+ // @ts-expect-error — intentionally removing Intl to simulate environments where it is unavailable
7
+ delete globalThis.Intl;
8
+ });
9
+ afterAll(() => {
10
+ globalThis.Intl = originalIntl;
11
+ });
12
+ it('detectLocale falls back to en-US and formatting works', async () => {
13
+ const { formatValue } = await import('../src/format');
14
+ // number type uses the detected locale (should be en-US fallback)
15
+ expect(formatValue(1234.56, { type: 'number' })).toBe('1,234.56');
16
+ });
17
+ it('currency formatting falls back to en-US locale definition', async () => {
18
+ const { formatValue } = await import('../src/format');
19
+ expect(formatValue(1234.56, { type: 'number', format: 'currency' })).toBe('$1,234.56');
20
+ });
21
+ it('percent formatting works without Intl', async () => {
22
+ const { formatValue } = await import('../src/format');
23
+ expect(formatValue(0.1234, { type: 'number', format: 'percent' })).toBe('12.34%');
24
+ });
25
+ it('time formatting works without Intl', async () => {
26
+ const { formatValue } = await import('../src/format');
27
+ expect(formatValue('2024-03-15T00:00:00.000', { type: 'time', granularity: 'day' })).toBe('2024-03-15');
28
+ });
29
+ it('null/undefined still return emptyPlaceholder', async () => {
30
+ const { formatValue } = await import('../src/format');
31
+ expect(formatValue(null, { type: 'number' })).toBe('∅');
32
+ expect(formatValue(undefined, { type: 'number' })).toBe('∅');
33
+ });
34
+ // Known locale (de-DE) — pre-built d3 definition is used,
35
+ // getCurrencySymbol falls back to the static currencySymbols map.
36
+ it('known locale (de-DE) uses pre-built locale definition', async () => {
37
+ const { formatValue } = await import('../src/format');
38
+ expect(formatValue(1234.56, { type: 'number', format: 'number', locale: 'de-DE' })).toBe('1.234,56');
39
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'EUR', locale: 'de-DE' })).toBe('€1.234,56');
40
+ expect(formatValue(0.1234, { type: 'number', format: 'percent', locale: 'de-DE' })).toBe('12,34%');
41
+ });
42
+ // Unknown locale (sv-SE) — getD3NumericLocaleFromIntl throws,
43
+ // falls back entirely to en-US.
44
+ it('unknown locale (sv-SE) falls back to en-US', async () => {
45
+ const { formatValue } = await import('../src/format');
46
+ expect(formatValue(1234.56, { type: 'number', format: 'number', locale: 'sv-SE' })).toBe('1,234.56');
47
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'USD', locale: 'sv-SE' })).toBe('$1,234.56');
48
+ });
49
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../test/format.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,87 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { formatValue } from '../src/format';
3
+ describe('formatValue', () => {
4
+ it('format null', () => {
5
+ expect(formatValue(null, { type: 'number' })).toBe('∅');
6
+ expect(formatValue(undefined, { type: 'number' })).toBe('∅');
7
+ });
8
+ it('format: currency (defaults to USD)', () => {
9
+ expect(formatValue(0, { type: 'number', format: 'currency' })).toBe('$0.00');
10
+ expect(formatValue(-42.5, { type: 'number', format: 'currency' })).toBe('−$42.50');
11
+ expect(formatValue('1234.56', { type: 'number', format: 'currency' })).toBe('$1,234.56');
12
+ expect(formatValue(1234.56, { type: 'number', format: 'currency' })).toBe('$1,234.56');
13
+ });
14
+ it('format: currency with currency code', () => {
15
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'EUR' })).toBe('€1,234.56');
16
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'GBP' })).toBe('£1,234.56');
17
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'JPY' })).toBe('¥1,234.56');
18
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'USD' })).toBe('$1,234.56');
19
+ });
20
+ it('format: percent', () => {
21
+ expect(formatValue(0.1234, { type: 'number', format: 'percent' })).toBe('12.34%');
22
+ expect(formatValue(0, { type: 'number', format: 'percent' })).toBe('0.00%');
23
+ expect(formatValue(1, { type: 'number', format: 'percent' })).toBe('100.00%');
24
+ });
25
+ it('format: number', () => {
26
+ expect(formatValue(1234567.89, { type: 'number', format: 'number' })).toBe('1,234,567.89');
27
+ expect(formatValue(1234, { type: 'number', format: 'number' })).toBe('1,234.00');
28
+ expect(formatValue('999.1', { type: 'number', format: 'number' })).toBe('999.10');
29
+ });
30
+ it('format: custom-numeric', () => {
31
+ expect(formatValue(1234.5, { type: 'number', format: { type: 'custom-numeric', value: '.2f' } })).toBe('1234.50');
32
+ expect(formatValue(1234, { type: 'number', format: { type: 'custom-numeric', value: '$,.2f' } })).toBe('$1,234.00');
33
+ expect(formatValue(0.5, { type: 'number', format: { type: 'custom-numeric', value: '.0%' } })).toBe('50%');
34
+ expect(formatValue(1500, { type: 'number', format: { type: 'custom-numeric', value: '.2s' } })).toBe('1.5k');
35
+ });
36
+ it('format: custom-time', () => {
37
+ expect(formatValue('2024-03-15T10:30:00.000', { type: 'time', format: { type: 'custom-time', value: '%Y-%m-%d' } })).toBe('2024-03-15');
38
+ expect(formatValue('2024-03-15T10:30:00.000', { type: 'time', format: { type: 'custom-time', value: '%H:%M' } })).toBe('10:30');
39
+ });
40
+ it('passthrough formats', () => {
41
+ expect(formatValue('https://img.example.com/photo.png', { type: 'string', format: 'imageUrl' })).toBe('https://img.example.com/photo.png');
42
+ expect(formatValue(12345, { type: 'number', format: 'id' })).toBe('12345');
43
+ expect(formatValue('https://example.com', { type: 'string', format: 'link' })).toBe('https://example.com');
44
+ expect(formatValue('https://example.com', { type: 'string', format: { type: 'link', label: 'Example' } })).toBe('https://example.com');
45
+ });
46
+ it('type-based fallback: number', () => {
47
+ expect(formatValue(1234.56, { type: 'number' })).toBe('1,234.56');
48
+ });
49
+ it('type-based fallback: time with grain', () => {
50
+ expect(formatValue('2024-03-15T00:00:00.000', { type: 'time', granularity: 'day' })).toBe('2024-03-15');
51
+ expect(formatValue('2024-03-01T00:00:00.000', { type: 'time', granularity: 'month' })).toBe('2024-03');
52
+ expect(formatValue('2024-01-01T00:00:00.000', { type: 'time', granularity: 'year' })).toBe('2024');
53
+ expect(formatValue('2024-03-11T00:00:00.000', { type: 'time', granularity: 'week' })).toBe('2024-03-11');
54
+ expect(formatValue('2024-03-01T00:00:00.000', { type: 'time', granularity: 'quarter' })).toBe('2024-Q1');
55
+ expect(formatValue('2024-03-15T14:00:00.000', { type: 'time', granularity: 'hour' })).toBe('2024-03-15 14:00:00');
56
+ expect(formatValue('2024-03-15T14:30:45.000', { type: 'time' })).toBe('2024-03-15 14:30:45');
57
+ });
58
+ it('format with nl-NL locale', () => {
59
+ const locale = 'nl-NL';
60
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'EUR', locale })).toBe('€1.234,56');
61
+ expect(formatValue(0, { type: 'number', format: 'currency', currency: 'EUR', locale })).toBe('€0,00');
62
+ expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'USD', locale })).toBe('US$1.234,56');
63
+ expect(formatValue(1234.56, { type: 'number', format: 'number', locale })).toBe('1.234,56');
64
+ expect(formatValue(1234.56, { type: 'number', locale })).toBe('1.234,56');
65
+ });
66
+ it('format with en-IN locale (non-uniform digit grouping)', () => {
67
+ const locale = 'en-IN';
68
+ expect(formatValue(1234567.89, { type: 'number', format: 'number', locale })).toBe('12,34,567.89');
69
+ expect(formatValue(1234567.89, { type: 'number', format: 'currency', currency: 'INR', locale })).toBe('₹12,34,567.89');
70
+ expect(formatValue(1234567.89, { type: 'number', locale })).toBe('12,34,567.89');
71
+ });
72
+ it('invalid date input returns Invalid date', () => {
73
+ expect(formatValue('not-a-date', { type: 'time' })).toBe('Invalid date');
74
+ expect(formatValue('not-a-date', { type: 'time', granularity: 'day' })).toBe('Invalid date');
75
+ expect(formatValue('not-a-date', { type: 'time', format: { type: 'custom-time', value: '%Y-%m-%d' } })).toBe('Invalid date');
76
+ });
77
+ it('custom emptyPlaceholder', () => {
78
+ expect(formatValue(null, { type: 'number', emptyPlaceholder: 'N/A' })).toBe('N/A');
79
+ expect(formatValue(undefined, { type: 'time', emptyPlaceholder: '-' })).toBe('-');
80
+ });
81
+ it('default fallback', () => {
82
+ expect(formatValue('hello', { type: 'string' })).toBe('hello');
83
+ expect(formatValue(42, { type: 'number' })).toBe('42.00');
84
+ expect(formatValue(true, { type: 'boolean' })).toBe('true');
85
+ expect(formatValue('', { type: 'string' })).toBe('');
86
+ });
87
+ });
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=granularity.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"granularity.test.d.ts","sourceRoot":"","sources":["../../test/granularity.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"granularity.test.d.ts","sourceRoot":"","sources":["../../test/granularity.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe,test,expect */
2
- import 'jest';
3
1
  import dayjs from 'dayjs';
4
2
  import ko from 'dayjs/locale/ko';
5
3
  import ResultSet from '../src/ResultSet';
@@ -3,10 +3,10 @@
3
3
  * @copyright Cube Dev, Inc.
4
4
  * @fileoverview CubeApi class unit tests.
5
5
  */
6
- /* globals describe,test,expect,beforeEach,jest */
6
+ import { vi } from 'vitest';
7
7
  import { CubeApi } from '../src/index';
8
8
  import ResultSet from '../src/ResultSet';
9
- jest.mock('../src/ResultSet');
9
+ vi.mock('../src/ResultSet');
10
10
  const MockedResultSet = ResultSet;
11
11
  class CubeApiTest extends CubeApi {
12
12
  loadResponseInternal(response, options = {}) {
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=table.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.test.d.ts","sourceRoot":"","sources":["../../test/table.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"table.test.d.ts","sourceRoot":"","sources":["../../test/table.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe, expect, test */
2
- import 'jest';
3
1
  import ResultSet from '../src/ResultSet';
4
2
  describe('resultSet tablePivot and tableColumns', () => {
5
3
  describe('it works with one measure', () => {
@@ -1,2 +1,2 @@
1
- import 'jest';
1
+ export {};
2
2
  //# sourceMappingURL=utils.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../test/utils.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../test/utils.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,3 @@
1
- /* globals describe, expect, test */
2
- import 'jest';
3
1
  import { defaultOrder } from '../src/utils';
4
2
  import { dayRange, TIME_SERIES } from '../src/time';
5
3
  describe('utils', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubejs-client/core",
3
- "version": "1.6.31",
3
+ "version": "1.6.33",
4
4
  "engines": {},
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,6 +20,8 @@
20
20
  "dependencies": {
21
21
  "core-js": "^3.6.5",
22
22
  "cross-fetch": "^3.0.2",
23
+ "d3-format": "^3.1.0",
24
+ "d3-time-format": "^4.1.0",
23
25
  "dayjs": "^1.10.4",
24
26
  "ramda": "^0.27.2",
25
27
  "url-search-params-polyfill": "^7.0.0",
@@ -30,7 +32,8 @@
30
32
  "tsc": "tsc",
31
33
  "watch": "tsc -w",
32
34
  "test": "npm run unit",
33
- "unit": "jest --coverage",
35
+ "unit": "vitest run --coverage",
36
+ "bench": "vitest bench",
34
37
  "lint": "eslint src/* test/ --ext .ts,.js",
35
38
  "lint:fix": "eslint --fix src/* test/ --ext .ts,js"
36
39
  },
@@ -39,17 +42,17 @@
39
42
  ],
40
43
  "license": "MIT",
41
44
  "devDependencies": {
42
- "@cubejs-backend/linter": "1.6.31",
43
- "@types/jest": "^29",
45
+ "@cubejs-backend/linter": "1.6.33",
46
+ "@types/d3-format": "^3",
47
+ "@types/d3-time-format": "^4",
44
48
  "@types/moment-range": "^4.0.0",
45
49
  "@types/ramda": "^0.27.34",
46
- "babel-jest": "^29",
47
- "jest": "^29",
48
- "ts-jest": "^29",
49
- "typescript": "~5.2.2"
50
+ "@vitest/coverage-v8": "^4",
51
+ "typescript": "~5.2.2",
52
+ "vitest": "^4"
50
53
  },
51
54
  "eslintConfig": {
52
55
  "extends": "../cubejs-linter"
53
56
  },
54
- "gitHead": "4081bee0cf865e21b8f2f26ccdd21c7c7e60aad3"
57
+ "gitHead": "cec71d6fcd0aa1864d9e8039fbfc8ec50c136f7b"
55
58
  }