@cubejs-client/core 1.6.39 → 1.6.41
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 → cubejs-client-core.cjs} +31 -11
- package/dist/cubejs-client-core.cjs.map +1 -0
- package/dist/cubejs-client-core.umd.js +28 -8
- package/dist/cubejs-client-core.umd.js.map +1 -1
- package/dist/src/HttpTransport.js +1 -1
- package/dist/src/Meta.d.ts +1 -2
- package/dist/src/Meta.d.ts.map +1 -1
- package/dist/src/ProgressResult.d.ts +1 -1
- package/dist/src/ProgressResult.d.ts.map +1 -1
- package/dist/src/ResultSet.d.ts +1 -1
- package/dist/src/ResultSet.d.ts.map +1 -1
- package/dist/src/ResultSet.js +2 -2
- package/dist/src/format.d.ts +1 -1
- package/dist/src/format.d.ts.map +1 -1
- package/dist/src/format.js +7 -5
- package/dist/src/index.d.ts +18 -21
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +38 -22
- package/dist/src/index.umd.js +1 -1
- package/dist/src/time.js +4 -4
- package/dist/src/types.d.ts +6 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +2 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/test/CubeApi.test.js +5 -5
- package/dist/test/HttpTransport.test.js +1 -1
- package/dist/test/ResultSet.bench.js +1 -1
- package/dist/test/ResultSet.test.js +2 -2
- package/dist/test/SqlQuery.test.js +1 -1
- package/dist/test/compare-date-range.test.js +1 -1
- package/dist/test/data-blending.test.js +1 -1
- package/dist/test/dayjs-isolation.test.js +1 -1
- package/dist/test/default-heuristics.test.js +1 -1
- package/dist/test/drill-down.test.js +1 -1
- package/dist/test/format-no-intl.test.js +7 -7
- package/dist/test/format.test.js +12 -12
- package/dist/test/granularity.test.js +1 -1
- package/dist/test/index.test.js +2 -2
- package/dist/test/table.test.js +1 -1
- package/dist/test/utils.test.js +2 -2
- package/package.json +6 -5
- package/dist/cubejs-client-core.cjs.js.map +0 -1
package/dist/test/format.test.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { formatValue, formatDateByGranularity, getFormat } from '../src/format';
|
|
2
|
+
import { formatValue, formatDateByGranularity, getFormat } from '../src/format.js';
|
|
3
3
|
describe('formatValue', () => {
|
|
4
4
|
it('format null', () => {
|
|
5
5
|
expect(formatValue(null, { type: 'number' })).toBe('∅');
|
|
6
6
|
expect(formatValue(undefined, { type: 'number' })).toBe('∅');
|
|
7
7
|
});
|
|
8
8
|
it('format: currency (defaults to USD)', () => {
|
|
9
|
-
expect(formatValue(0, { type: 'number', format: 'currency' })).toBe('$0
|
|
10
|
-
expect(formatValue(-42.5, { type: 'number', format: 'currency' })).toBe('−$42.
|
|
9
|
+
expect(formatValue(0, { type: 'number', format: 'currency' })).toBe('$0');
|
|
10
|
+
expect(formatValue(-42.5, { type: 'number', format: 'currency' })).toBe('−$42.5');
|
|
11
11
|
expect(formatValue('1234.56', { type: 'number', format: 'currency' })).toBe('$1,234.56');
|
|
12
12
|
expect(formatValue(1234.56, { type: 'number', format: 'currency' })).toBe('$1,234.56');
|
|
13
13
|
});
|
|
@@ -19,13 +19,13 @@ describe('formatValue', () => {
|
|
|
19
19
|
});
|
|
20
20
|
it('format: percent', () => {
|
|
21
21
|
expect(formatValue(0.1234, { type: 'number', format: 'percent' })).toBe('12.34%');
|
|
22
|
-
expect(formatValue(0, { type: 'number', format: 'percent' })).toBe('0
|
|
23
|
-
expect(formatValue(1, { type: 'number', format: 'percent' })).toBe('100
|
|
22
|
+
expect(formatValue(0, { type: 'number', format: 'percent' })).toBe('0%');
|
|
23
|
+
expect(formatValue(1, { type: 'number', format: 'percent' })).toBe('100%');
|
|
24
24
|
});
|
|
25
25
|
it('format: number', () => {
|
|
26
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
|
|
28
|
-
expect(formatValue('999.1', { type: 'number', format: 'number' })).toBe('999.
|
|
27
|
+
expect(formatValue(1234, { type: 'number', format: 'number' })).toBe('1,234');
|
|
28
|
+
expect(formatValue('999.1', { type: 'number', format: 'number' })).toBe('999.1');
|
|
29
29
|
});
|
|
30
30
|
it('format: custom-numeric', () => {
|
|
31
31
|
expect(formatValue(1234.5, { type: 'number', format: { type: 'custom-numeric', value: '.2f' } })).toBe('1234.50');
|
|
@@ -64,7 +64,7 @@ describe('formatValue', () => {
|
|
|
64
64
|
it('format with nl-NL locale', () => {
|
|
65
65
|
const locale = 'nl-NL';
|
|
66
66
|
expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'EUR', locale })).toBe('€1.234,56');
|
|
67
|
-
expect(formatValue(0, { type: 'number', format: 'currency', currency: 'EUR', locale })).toBe('€0
|
|
67
|
+
expect(formatValue(0, { type: 'number', format: 'currency', currency: 'EUR', locale })).toBe('€0');
|
|
68
68
|
expect(formatValue(1234.56, { type: 'number', format: 'currency', currency: 'USD', locale })).toBe('US$1.234,56');
|
|
69
69
|
expect(formatValue(1234.56, { type: 'number', format: 'number', locale })).toBe('1.234,56');
|
|
70
70
|
expect(formatValue(1234.56, { type: 'number', locale })).toBe('1.234,56');
|
|
@@ -86,7 +86,7 @@ describe('formatValue', () => {
|
|
|
86
86
|
});
|
|
87
87
|
it('default fallback', () => {
|
|
88
88
|
expect(formatValue('hello', { type: 'string' })).toBe('hello');
|
|
89
|
-
expect(formatValue(42, { type: 'number' })).toBe('42
|
|
89
|
+
expect(formatValue(42, { type: 'number' })).toBe('42');
|
|
90
90
|
expect(formatValue(true, { type: 'boolean' })).toBe('true');
|
|
91
91
|
expect(formatValue('', { type: 'string' })).toBe('');
|
|
92
92
|
});
|
|
@@ -140,18 +140,18 @@ describe('getFormat', () => {
|
|
|
140
140
|
});
|
|
141
141
|
it('number with currency format', () => {
|
|
142
142
|
const { formatString, formatFunc } = getFormat({ type: 'number', format: 'currency' });
|
|
143
|
-
expect(formatString).toBe('$,.
|
|
143
|
+
expect(formatString).toBe('$,.2~f');
|
|
144
144
|
expect(formatFunc(1234.56)).toBe('$1,234.56');
|
|
145
145
|
expect(formatFunc('1234.56')).toBe('$1,234.56');
|
|
146
146
|
});
|
|
147
147
|
it('number with percent format', () => {
|
|
148
148
|
const { formatString, formatFunc } = getFormat({ type: 'number', format: 'percent' });
|
|
149
|
-
expect(formatString).toBe('.2
|
|
149
|
+
expect(formatString).toBe('.2~%');
|
|
150
150
|
expect(formatFunc(0.1234)).toBe('12.34%');
|
|
151
151
|
});
|
|
152
152
|
it('number with no explicit format falls back to default number format', () => {
|
|
153
153
|
const { formatString, formatFunc } = getFormat({ type: 'number' });
|
|
154
|
-
expect(formatString).toBe(',.
|
|
154
|
+
expect(formatString).toBe(',.2~f');
|
|
155
155
|
expect(formatFunc(1234.56)).toBe('1,234.56');
|
|
156
156
|
});
|
|
157
157
|
it('custom-numeric format exposes the spec as formatString', () => {
|
package/dist/test/index.test.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @fileoverview CubeApi class unit tests.
|
|
5
5
|
*/
|
|
6
6
|
import { vi } from 'vitest';
|
|
7
|
-
import { CubeApi } from '../src/index';
|
|
8
|
-
import ResultSet from '../src/ResultSet';
|
|
7
|
+
import { CubeApi } from '../src/index.js';
|
|
8
|
+
import ResultSet from '../src/ResultSet.js';
|
|
9
9
|
vi.mock('../src/ResultSet');
|
|
10
10
|
const MockedResultSet = ResultSet;
|
|
11
11
|
class CubeApiTest extends CubeApi {
|
package/dist/test/table.test.js
CHANGED
package/dist/test/utils.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultOrder } from '../src/utils';
|
|
2
|
-
import { dayRange, TIME_SERIES } from '../src/time';
|
|
1
|
+
import { defaultOrder } from '../src/utils.js';
|
|
2
|
+
import { dayRange, TIME_SERIES } from '../src/time.js';
|
|
3
3
|
describe('utils', () => {
|
|
4
4
|
test('default order', () => {
|
|
5
5
|
const query = {
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubejs-client/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.41",
|
|
4
4
|
"engines": {},
|
|
5
|
+
"type": "module",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/cube-js/cube.git",
|
|
8
9
|
"directory": "packages/cubejs-client-core"
|
|
9
10
|
},
|
|
10
11
|
"description": "Cube client",
|
|
11
|
-
"main": "dist/cubejs-client-core.cjs
|
|
12
|
+
"main": "dist/cubejs-client-core.cjs",
|
|
12
13
|
"browser": "dist/cubejs-client-core.umd.js",
|
|
13
14
|
"typings": "dist/src/index.d.ts",
|
|
14
15
|
"author": "Cube Dev, Inc.",
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
".": {
|
|
17
18
|
"types": "./dist/src/index.d.ts",
|
|
18
19
|
"import": "./dist/src/index.js",
|
|
19
|
-
"require": "./dist/cubejs-client-core.cjs
|
|
20
|
+
"require": "./dist/cubejs-client-core.cjs"
|
|
20
21
|
},
|
|
21
22
|
"./format": {
|
|
22
23
|
"types": "./dist/src/format.d.ts",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
],
|
|
56
57
|
"license": "MIT",
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@cubejs-backend/linter": "1.6.
|
|
59
|
+
"@cubejs-backend/linter": "1.6.41",
|
|
59
60
|
"@types/d3-format": "^3",
|
|
60
61
|
"@types/d3-time-format": "^4",
|
|
61
62
|
"@types/moment-range": "^4.0.0",
|
|
@@ -67,5 +68,5 @@
|
|
|
67
68
|
"eslintConfig": {
|
|
68
69
|
"extends": "../cubejs-linter"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "e121f662d703c35053e3867fa6fd1910389e7331"
|
|
71
72
|
}
|