@cubejs-client/core 0.28.52 → 0.29.23
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/CHANGELOG.md +50 -0
- package/dist/cubejs-client-core.esm.js +13 -17
- package/dist/cubejs-client-core.esm.js.map +1 -1
- package/dist/cubejs-client-core.js +13 -17
- package/dist/cubejs-client-core.js.map +1 -1
- package/dist/cubejs-client-core.umd.js +1124 -2007
- package/dist/cubejs-client-core.umd.js.map +1 -1
- package/index.d.ts +29 -17
- package/package.json +2 -2
- package/src/ResultSet.js +1 -3
- package/src/index.js +1 -1
- package/src/tests/ResultSet.test.js +2 -3
- package/src/tests/data-blending.test.js +3 -0
package/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @title @cubejs-client/core
|
|
3
3
|
* @permalink /@cubejs-client-core
|
|
4
|
-
* @menuCategory
|
|
4
|
+
* @menuCategory Frontend Integrations
|
|
5
5
|
* @subcategory Reference
|
|
6
6
|
* @menuOrder 2
|
|
7
7
|
* @description Vanilla JavaScript Cube.js client.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
declare module '@cubejs-client/core' {
|
|
11
|
+
|
|
11
12
|
export type TransportOptions = {
|
|
12
13
|
/**
|
|
13
14
|
* [jwt auth token](security)
|
|
@@ -714,28 +715,34 @@ declare module '@cubejs-client/core' {
|
|
|
714
715
|
}
|
|
715
716
|
|
|
716
717
|
export type Filter = BinaryFilter | UnaryFilter | LogicalOrFilter | LogicalAndFilter;
|
|
717
|
-
type LogicalAndFilter = {
|
|
718
|
+
export type LogicalAndFilter = {
|
|
718
719
|
and: (BinaryFilter | UnaryFilter | LogicalOrFilter)[];
|
|
719
720
|
};
|
|
720
721
|
|
|
721
|
-
type LogicalOrFilter = {
|
|
722
|
+
export type LogicalOrFilter = {
|
|
722
723
|
or: (BinaryFilter | UnaryFilter | LogicalAndFilter)[];
|
|
723
724
|
};
|
|
724
725
|
|
|
725
|
-
|
|
726
|
+
export interface BinaryFilter {
|
|
727
|
+
/**
|
|
728
|
+
* @deprecated Use `member` instead.
|
|
729
|
+
*/
|
|
726
730
|
dimension?: string;
|
|
727
731
|
member?: string;
|
|
728
732
|
operator: BinaryOperator;
|
|
729
733
|
values: string[];
|
|
730
|
-
}
|
|
731
|
-
|
|
734
|
+
}
|
|
735
|
+
export interface UnaryFilter {
|
|
736
|
+
/**
|
|
737
|
+
* @deprecated Use `member` instead.
|
|
738
|
+
*/
|
|
732
739
|
dimension?: string;
|
|
733
740
|
member?: string;
|
|
734
741
|
operator: UnaryOperator;
|
|
735
742
|
values?: never;
|
|
736
|
-
}
|
|
737
|
-
type UnaryOperator = 'set' | 'notSet';
|
|
738
|
-
type BinaryOperator =
|
|
743
|
+
}
|
|
744
|
+
export type UnaryOperator = 'set' | 'notSet';
|
|
745
|
+
export type BinaryOperator =
|
|
739
746
|
| 'equals'
|
|
740
747
|
| 'notEquals'
|
|
741
748
|
| 'contains'
|
|
@@ -753,10 +760,10 @@ declare module '@cubejs-client/core' {
|
|
|
753
760
|
|
|
754
761
|
export type DateRange = string | [string, string];
|
|
755
762
|
|
|
756
|
-
export
|
|
763
|
+
export interface TimeDimensionBase {
|
|
757
764
|
dimension: string;
|
|
758
765
|
granularity?: TimeDimensionGranularity;
|
|
759
|
-
}
|
|
766
|
+
}
|
|
760
767
|
|
|
761
768
|
type TimeDimensionComparisonFields = {
|
|
762
769
|
compareDateRange: Array<DateRange>;
|
|
@@ -771,7 +778,7 @@ declare module '@cubejs-client/core' {
|
|
|
771
778
|
|
|
772
779
|
export type TimeDimension = TimeDimensionComparison | TimeDimensionRanged;
|
|
773
780
|
|
|
774
|
-
export
|
|
781
|
+
export interface Query {
|
|
775
782
|
measures?: string[];
|
|
776
783
|
dimensions?: string[];
|
|
777
784
|
filters?: Filter[];
|
|
@@ -783,7 +790,7 @@ declare module '@cubejs-client/core' {
|
|
|
783
790
|
timezone?: string;
|
|
784
791
|
renewQuery?: boolean;
|
|
785
792
|
ungrouped?: boolean;
|
|
786
|
-
}
|
|
793
|
+
}
|
|
787
794
|
|
|
788
795
|
export class ProgressResult {
|
|
789
796
|
stage(): string;
|
|
@@ -818,13 +825,14 @@ declare module '@cubejs-client/core' {
|
|
|
818
825
|
type TCubeMemberType = 'time' | 'number' | 'string' | 'boolean';
|
|
819
826
|
|
|
820
827
|
// @see BaseCubeMember
|
|
821
|
-
// @
|
|
828
|
+
// @deprecated
|
|
822
829
|
export type TCubeMember = {
|
|
823
830
|
type: TCubeMemberType;
|
|
824
831
|
name: string;
|
|
825
832
|
title: string;
|
|
826
833
|
shortTitle: string;
|
|
827
834
|
isVisible?: boolean;
|
|
835
|
+
meta?: any;
|
|
828
836
|
};
|
|
829
837
|
|
|
830
838
|
export type BaseCubeMember = {
|
|
@@ -833,6 +841,7 @@ declare module '@cubejs-client/core' {
|
|
|
833
841
|
title: string;
|
|
834
842
|
shortTitle: string;
|
|
835
843
|
isVisible?: boolean;
|
|
844
|
+
meta?: any;
|
|
836
845
|
};
|
|
837
846
|
|
|
838
847
|
export type TCubeMeasure = BaseCubeMember & {
|
|
@@ -1052,7 +1061,7 @@ declare module '@cubejs-client/core' {
|
|
|
1052
1061
|
* );
|
|
1053
1062
|
* ```
|
|
1054
1063
|
*
|
|
1055
|
-
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. In the development mode, Cube.js Backend will print the API token to the console on
|
|
1064
|
+
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing. In the development mode, Cube.js Backend will print the API token to the console on startup. In case of async function `authorization` is updated for `options.transport` on each request.
|
|
1056
1065
|
* @order 1
|
|
1057
1066
|
*/
|
|
1058
1067
|
export default function cubejs(apiToken: string | (() => Promise<string>), options: CubeJSApiOptions): CubejsApi;
|
|
@@ -1105,12 +1114,15 @@ declare module '@cubejs-client/core' {
|
|
|
1105
1114
|
|
|
1106
1115
|
export function defaultOrder(query: Query): { [key: string]: QueryOrder };
|
|
1107
1116
|
|
|
1108
|
-
|
|
1117
|
+
export interface TFlatFilter {
|
|
1118
|
+
/**
|
|
1119
|
+
* @deprecated Use `member` instead.
|
|
1120
|
+
*/
|
|
1109
1121
|
dimension?: string;
|
|
1110
1122
|
member?: string;
|
|
1111
1123
|
operator: BinaryOperator;
|
|
1112
1124
|
values: string[];
|
|
1113
|
-
}
|
|
1125
|
+
}
|
|
1114
1126
|
|
|
1115
1127
|
/**
|
|
1116
1128
|
* @hidden
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubejs-client/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.23",
|
|
4
4
|
"engines": {},
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"eslint-plugin-node": "^5.2.1",
|
|
46
46
|
"jest": "^26.0.1"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "da516571691c103ecbd035c3319653766622b083"
|
|
49
49
|
}
|
package/src/ResultSet.js
CHANGED
|
@@ -355,7 +355,7 @@ class ResultSet {
|
|
|
355
355
|
const pivotImpl = (resultIndex = 0) => {
|
|
356
356
|
let groupByXAxis = groupByToPairs(({ xValues }) => this.axisValuesString(xValues));
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
const measureValue = (row, measure) => row[measure] || 0;
|
|
359
359
|
|
|
360
360
|
if (
|
|
361
361
|
pivotConfig.fillMissingDates &&
|
|
@@ -379,8 +379,6 @@ class ResultSet {
|
|
|
379
379
|
);
|
|
380
380
|
return series[resultIndex].map(d => [d, byXValues[d] || [{ xValues: [d], row: {} }]]);
|
|
381
381
|
};
|
|
382
|
-
|
|
383
|
-
measureValue = (row, measure) => row[measure] || 0;
|
|
384
382
|
}
|
|
385
383
|
}
|
|
386
384
|
|
package/src/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function mutexPromise(promise) {
|
|
|
24
24
|
|
|
25
25
|
class CubejsApi {
|
|
26
26
|
constructor(apiToken, options) {
|
|
27
|
-
if (typeof apiToken === 'object') {
|
|
27
|
+
if (apiToken !== null && !Array.isArray(apiToken) && typeof apiToken === 'object') {
|
|
28
28
|
options = apiToken;
|
|
29
29
|
apiToken = undefined;
|
|
30
30
|
}
|
|
@@ -187,7 +187,7 @@ describe('ResultSet', () => {
|
|
|
187
187
|
{
|
|
188
188
|
x: 'Name 1',
|
|
189
189
|
|
|
190
|
-
'Foo.count':
|
|
190
|
+
'Foo.count': 0,
|
|
191
191
|
xValues: [
|
|
192
192
|
'Name 1'
|
|
193
193
|
],
|
|
@@ -235,8 +235,7 @@ describe('ResultSet', () => {
|
|
|
235
235
|
expect(resultSet.chartPivot()).toEqual([
|
|
236
236
|
{
|
|
237
237
|
x: 'Name 1',
|
|
238
|
-
|
|
239
|
-
'Foo.count': undefined,
|
|
238
|
+
'Foo.count': 0,
|
|
240
239
|
xValues: [
|
|
241
240
|
'Name 1'
|
|
242
241
|
],
|
|
@@ -255,11 +255,14 @@ describe('data blending', () => {
|
|
|
255
255
|
xValues: ['2020-08-01T00:00:00.000'],
|
|
256
256
|
'Orders.count': 1,
|
|
257
257
|
'Australia,Users.count': 20,
|
|
258
|
+
'Italy,Users.count': 0,
|
|
259
|
+
'Spain,Users.count': 0
|
|
258
260
|
},
|
|
259
261
|
{
|
|
260
262
|
x: '2020-08-02T00:00:00.000',
|
|
261
263
|
xValues: ['2020-08-02T00:00:00.000'],
|
|
262
264
|
'Orders.count': 2,
|
|
265
|
+
'Australia,Users.count': 0,
|
|
263
266
|
'Spain,Users.count': 34,
|
|
264
267
|
'Italy,Users.count': 18,
|
|
265
268
|
},
|