flowerbi 6.0.1 → 6.0.2
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/QueryJson.d.ts +5 -5
- package/dist/executeQuery.d.ts +2 -2
- package/dist/executeQuery.js +1 -1
- package/dist/queryModel.d.ts +14 -14
- package/package.json +1 -1
package/dist/QueryJson.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The allowed filter comparison operators.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type FilterOperator = "=" | "<>" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "BITS IN" | "LIKE";
|
|
5
5
|
/**
|
|
6
6
|
* The allowed value types for a filter.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type FilterValue = string | number | boolean | Date | unknown | string[] | number[];
|
|
9
9
|
/**
|
|
10
10
|
* Specifies a filter criterion. The column is specified by a string of the
|
|
11
11
|
* form `table.column`.
|
|
@@ -19,7 +19,7 @@ export interface FilterJson {
|
|
|
19
19
|
/**
|
|
20
20
|
* The allowed aggregation function names.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type AggregationType = "Count" | "Sum" | "Avg" | "Min" | "Max" | "CountDistinct";
|
|
23
23
|
/**
|
|
24
24
|
* Describes an aggregated values. It is always taken from one column, with
|
|
25
25
|
* a function applied to it. Filters can optionally be supplied to limit
|
|
@@ -39,7 +39,7 @@ export interface AggregationJson {
|
|
|
39
39
|
* a type of column (the type 'Value' refers to aggregations) and its
|
|
40
40
|
* zero-based position.
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type OrderingJson = {
|
|
43
43
|
descending?: boolean;
|
|
44
44
|
} & ({
|
|
45
45
|
column: string;
|
|
@@ -51,7 +51,7 @@ export declare type OrderingJson = {
|
|
|
51
51
|
* Specifies an expression for calculating a derived value based on
|
|
52
52
|
* the values of aggregations, specified by zero-based position.
|
|
53
53
|
*/
|
|
54
|
-
export
|
|
54
|
+
export type CalculationJson = {
|
|
55
55
|
value: number;
|
|
56
56
|
} | {
|
|
57
57
|
aggregation: number;
|
package/dist/executeQuery.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { QueryJson } from "./QueryJson";
|
|
|
3
3
|
/**
|
|
4
4
|
* The allowed data types for plain columns.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type QuerySelectValue = number | string | Date | boolean;
|
|
7
7
|
/**
|
|
8
8
|
* The JSON format of a record returned from the API when executing a query.
|
|
9
9
|
*/
|
|
@@ -39,7 +39,7 @@ export interface QueryResultJson {
|
|
|
39
39
|
* the `fetch` browser API, or something more high-level, and can make use
|
|
40
40
|
* of whatever authentication method you prefer.
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type QueryFetch = (queryJson: QueryJson) => Promise<QueryResultJson>;
|
|
43
43
|
/**
|
|
44
44
|
* Converts a statically-typed {@link Query} into the {@link QueryJson}
|
|
45
45
|
* format, ready to be sent to your API.
|
package/dist/executeQuery.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/dist/queryModel.d.ts
CHANGED
|
@@ -4,22 +4,22 @@ import { AggregationJson, FilterJson, OrderingJson } from "./QueryJson";
|
|
|
4
4
|
* Defines the kinds of member that can appear in the `select` object of a query.
|
|
5
5
|
* Queries can select plain columns, or aggregation functions on columns.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type SelectMember = QueryColumn<any> | AggregationJson;
|
|
8
8
|
/**
|
|
9
9
|
* The `select` object of a query has named properties of type {@link SelectMember}.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type QuerySelect = Record<string, SelectMember>;
|
|
12
12
|
/**
|
|
13
13
|
* Extracts the data type from a column. So `QueryColumnType<QueryColumn<boolean>>` is `boolean`.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type QueryColumnType<T> = T extends QueryColumn<infer C> ? C : never;
|
|
16
16
|
/**
|
|
17
17
|
* Defines the shape of a record returned from a query, based on its `select` object.
|
|
18
18
|
* Each selected property appears as a property in the record with the same name. For
|
|
19
19
|
* plain columns the data type depends on the column definition, but for aggregations
|
|
20
20
|
* and calculations the data type is always `number`.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type ExpandedQueryRecord<S extends QuerySelect, C extends QueryCalculations<S>> = {
|
|
23
23
|
[P in keyof S]: S[P] extends QueryColumn<any> ? QueryColumnType<S[P]> : number;
|
|
24
24
|
} & {
|
|
25
25
|
[P in keyof C]: number;
|
|
@@ -28,7 +28,7 @@ export declare type ExpandedQueryRecord<S extends QuerySelect, C extends QueryCa
|
|
|
28
28
|
* Similar to {@link ExpandedQueryRecord} but the plain columns are optional, so they
|
|
29
29
|
* may be `undefined`. Aggregations/calculations are not optional.
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type ExpandedQueryRecordWithOptionalColumns<S extends QuerySelect, C extends QueryCalculations<S>> = {
|
|
32
32
|
[P in keyof S]: S[P] extends QueryColumn<any> ? QueryColumnType<S[P]> | undefined : number;
|
|
33
33
|
} & {
|
|
34
34
|
[P in keyof C]: number;
|
|
@@ -36,14 +36,14 @@ export declare type ExpandedQueryRecordWithOptionalColumns<S extends QuerySelect
|
|
|
36
36
|
/**
|
|
37
37
|
* A helper type used in the definition of {@link AggregatePropsOnly}.
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export type AggregatePropsOnlyHelper<T extends QuerySelect> = {
|
|
40
40
|
[K in keyof T]: T[K] extends QueryColumn<any> ? never : K;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* The names of properties from a `select` object that refer to aggregated values.
|
|
44
44
|
* Compare with {@link ColumnPropsOnly}.
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export type AggregatePropsOnly<T extends QuerySelect> = AggregatePropsOnlyHelper<T>[keyof AggregatePropsOnlyHelper<T>];
|
|
47
47
|
/**
|
|
48
48
|
* Returns the names of properties in a query that refer to aggregated columns.
|
|
49
49
|
* The result is an array of strings, but type-constrained to string literal types:
|
|
@@ -63,23 +63,23 @@ export declare function getAggregatePropsOnly<T extends QuerySelect>(select: T):
|
|
|
63
63
|
* `select` object, those that refer to aggregated values (hence all are of
|
|
64
64
|
* type `number`.)
|
|
65
65
|
*/
|
|
66
|
-
export
|
|
66
|
+
export type AggregateValuesOnly<T extends QuerySelect> = {
|
|
67
67
|
[K in AggregatePropsOnly<T>]: number;
|
|
68
68
|
};
|
|
69
|
-
export
|
|
69
|
+
export type CalculationValues<C extends QueryCalculations<any>> = {
|
|
70
70
|
[K in keyof C]: number;
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
73
|
* A helper type used in the definition of {@link ColumnPropsOnly}.
|
|
74
74
|
*/
|
|
75
|
-
export
|
|
75
|
+
export type ColumnPropsOnlyHelper<T extends QuerySelect> = {
|
|
76
76
|
[K in keyof T]: T[K] extends QueryColumn<any> ? K : never;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* The names of properties from a `select` object that refer to plain columns.
|
|
80
80
|
* Compare with {@link AggregatePropsOnly}.
|
|
81
81
|
*/
|
|
82
|
-
export
|
|
82
|
+
export type ColumnPropsOnly<T extends QuerySelect> = ColumnPropsOnlyHelper<T>[keyof ColumnPropsOnlyHelper<T>];
|
|
83
83
|
/**
|
|
84
84
|
* Returns the names of properties in a query that refer to plain columns. The
|
|
85
85
|
* result is an array of strings, but type-constrained to string literal types:
|
|
@@ -100,12 +100,12 @@ export declare function getColumnPropsOnly<T extends QuerySelect>(select: T): Co
|
|
|
100
100
|
* @param select the `select` object from a query
|
|
101
101
|
*/
|
|
102
102
|
export declare function getColumnsOnly(select: QuerySelect): QueryColumn<any>[];
|
|
103
|
-
export
|
|
103
|
+
export type Calculation<S extends QuerySelect> = number | AggregatePropsOnly<S> | [Calculation<S>, "+" | "-" | "*" | "/" | "??", Calculation<S>];
|
|
104
104
|
/**
|
|
105
105
|
* The `select` object of a query has named properties of type {@link SelectMember}.
|
|
106
106
|
*/
|
|
107
|
-
export
|
|
108
|
-
export
|
|
107
|
+
export type QueryCalculations<S extends QuerySelect> = Record<string, Calculation<S>>;
|
|
108
|
+
export type Ordering<S extends QuerySelect, C extends QueryCalculations<S>> = {
|
|
109
109
|
descending?: boolean;
|
|
110
110
|
} & ({
|
|
111
111
|
select: keyof S;
|