@cubejs-client/core 0.29.53 → 0.29.54
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 +11 -0
- package/index.d.ts +48 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.29.54](https://github.com/cube-js/cube.js/compare/v0.29.53...v0.29.54) (2022-05-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Detailed client TS types ([#4446](https://github.com/cube-js/cube.js/issues/4446)) Thanks [@reify-thomas-smith](https://github.com/reify-thomas-smith) ! ([977cce0](https://github.com/cube-js/cube.js/commit/977cce0c440bc73c0e6b5ad0c10af926b7386873)), closes [#4202](https://github.com/cube-js/cube.js/issues/4202)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.29.53](https://github.com/cube-js/cube.js/compare/v0.29.52...v0.29.53) (2022-04-29)
|
|
7
18
|
|
|
8
19
|
|
package/index.d.ts
CHANGED
|
@@ -808,6 +808,36 @@ declare module '@cubejs-client/core' {
|
|
|
808
808
|
total?: boolean;
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
+
export type QueryRecordType<T extends DeeplyReadonly<Query | Query[]>> =
|
|
812
|
+
T extends DeeplyReadonly<Query[]> ? QueryArrayRecordType<T> :
|
|
813
|
+
T extends DeeplyReadonly<Query> ? SingleQueryRecordType<T> :
|
|
814
|
+
never;
|
|
815
|
+
|
|
816
|
+
type QueryArrayRecordType<T extends DeeplyReadonly<Query[]>> =
|
|
817
|
+
T extends readonly [infer First, ...infer Rest]
|
|
818
|
+
? SingleQueryRecordType<First> | QueryArrayRecordType<Rest>
|
|
819
|
+
: never;
|
|
820
|
+
|
|
821
|
+
// If we can't infer any members at all, then return any.
|
|
822
|
+
type SingleQueryRecordType<T extends DeeplyReadonly<Query>> = ExtractMembers<T> extends never
|
|
823
|
+
? any
|
|
824
|
+
: { [K in string & ExtractMembers<T>]: string | number | boolean | null };
|
|
825
|
+
|
|
826
|
+
type ExtractMembers<T extends DeeplyReadonly<Query>> =
|
|
827
|
+
| ( T extends { dimensions: readonly (infer Names)[]; } ? Names : never )
|
|
828
|
+
| ( T extends { measures: readonly (infer Names)[]; } ? Names : never )
|
|
829
|
+
| ( T extends { timeDimensions: (infer U); } ? ExtractTimeMembers<U> : never );
|
|
830
|
+
|
|
831
|
+
type ExtractTimeMembers<T> =
|
|
832
|
+
T extends readonly [infer First, ...infer Rest]
|
|
833
|
+
? ExtractTimeMember<First> | ExtractTimeMembers<Rest>
|
|
834
|
+
: never;
|
|
835
|
+
|
|
836
|
+
type ExtractTimeMember<T> =
|
|
837
|
+
T extends { dimension: infer Dimension, granularity: infer Granularity }
|
|
838
|
+
? Dimension | `${Dimension & string}.${Granularity & string}`
|
|
839
|
+
: never;
|
|
840
|
+
|
|
811
841
|
export class ProgressResult {
|
|
812
842
|
stage(): string;
|
|
813
843
|
timeElapsed(): string;
|
|
@@ -983,7 +1013,10 @@ declare module '@cubejs-client/core' {
|
|
|
983
1013
|
* @order 2
|
|
984
1014
|
*/
|
|
985
1015
|
export class CubejsApi {
|
|
986
|
-
load
|
|
1016
|
+
load<QueryType extends DeeplyReadonly<Query | Query[]>>(
|
|
1017
|
+
query: QueryType,
|
|
1018
|
+
options?: LoadMethodOptions,
|
|
1019
|
+
): Promise<ResultSet<QueryRecordType<QueryType>>>;
|
|
987
1020
|
/**
|
|
988
1021
|
* Fetch data for the passed `query`.
|
|
989
1022
|
*
|
|
@@ -1008,13 +1041,18 @@ declare module '@cubejs-client/core' {
|
|
|
1008
1041
|
* ```
|
|
1009
1042
|
* @param query - [Query object](query-format)
|
|
1010
1043
|
*/
|
|
1011
|
-
load
|
|
1012
|
-
|
|
1013
|
-
|
|
1044
|
+
load<QueryType extends DeeplyReadonly<Query | Query[]>>(
|
|
1045
|
+
query: QueryType,
|
|
1046
|
+
options?: LoadMethodOptions,
|
|
1047
|
+
callback?: LoadMethodCallback<ResultSet<QueryRecordType<QueryType>>>,
|
|
1048
|
+
): void;
|
|
1049
|
+
|
|
1050
|
+
load<QueryType extends DeeplyReadonly<Query | Query[]>>(
|
|
1051
|
+
query: QueryType,
|
|
1014
1052
|
options?: LoadMethodOptions,
|
|
1015
1053
|
callback?: LoadMethodCallback<ResultSet>,
|
|
1016
1054
|
responseFormat?: string
|
|
1017
|
-
): Promise<ResultSet
|
|
1055
|
+
): Promise<ResultSet<QueryRecordType<QueryType>>>;
|
|
1018
1056
|
|
|
1019
1057
|
/**
|
|
1020
1058
|
* Allows you to fetch data and receive updates over time. See [Real-Time Data Fetch](real-time-data-fetch)
|
|
@@ -1040,7 +1078,11 @@ declare module '@cubejs-client/core' {
|
|
|
1040
1078
|
* );
|
|
1041
1079
|
* ```
|
|
1042
1080
|
*/
|
|
1043
|
-
subscribe
|
|
1081
|
+
subscribe<QueryType extends DeeplyReadonly<Query | Query[]>>(
|
|
1082
|
+
query: QueryType,
|
|
1083
|
+
options: LoadMethodOptions | null,
|
|
1084
|
+
callback: LoadMethodCallback<ResultSet<QueryRecordType<QueryType>>>,
|
|
1085
|
+
): void;
|
|
1044
1086
|
|
|
1045
1087
|
sql(query: DeeplyReadonly<Query | Query[]>, options?: LoadMethodOptions): Promise<SqlQuery>;
|
|
1046
1088
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubejs-client/core",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.54",
|
|
4
4
|
"engines": {},
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"eslint-plugin-node": "^5.2.1",
|
|
47
47
|
"jest": "^26.0.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c5383fcfaaa088e6ca09cee3384da163d3ad6af5"
|
|
50
50
|
}
|