@vizzly/semantic-layer-public 0.0.205-rc-1 → 0.0.205-rc-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.
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { QueryEngineConfigV1 } from './types';
|
|
2
2
|
export declare const takeTimeFunctions: (queryEngineConfig: QueryEngineConfigV1) => string[];
|
|
3
|
+
/** Is the value any query engine function? */
|
|
4
|
+
export declare const isQueryEngineFunction: (queryEngineConfig: QueryEngineConfigV1, possible: string) => boolean;
|
|
5
|
+
/** Is the given value an aggregate function? */
|
|
6
|
+
export declare const isAggregateFunction: (queryEngineConfig: QueryEngineConfigV1, possibleAggregateFunction: string) => boolean;
|
|
7
|
+
/** Is the given value a time trunc function? */
|
|
8
|
+
export declare const isTimeTruncFunction: (queryEngineConfig: QueryEngineConfigV1, possibleTimeTruncFunction: string) => boolean;
|
|
9
|
+
/** Is the given value a transformation function? */
|
|
10
|
+
export declare const isTransformationFunction: (queryEngineConfig: QueryEngineConfigV1, possibleTransformationFunction: string) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.takeTimeFunctions = void 0;
|
|
3
|
+
exports.isTransformationFunction = exports.isTimeTruncFunction = exports.isAggregateFunction = exports.isQueryEngineFunction = exports.takeTimeFunctions = void 0;
|
|
4
4
|
const takeTimeFunctions = (queryEngineConfig) => {
|
|
5
5
|
const funcs = Object.keys(queryEngineConfig.supportedFunctions);
|
|
6
6
|
return funcs.filter((fn) => {
|
|
@@ -8,3 +8,36 @@ const takeTimeFunctions = (queryEngineConfig) => {
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
exports.takeTimeFunctions = takeTimeFunctions;
|
|
11
|
+
/** Is the value any query engine function? */
|
|
12
|
+
const isQueryEngineFunction = (queryEngineConfig, possible) => {
|
|
13
|
+
const allAggregateFunctions = Object.keys(queryEngineConfig.supportedFunctions);
|
|
14
|
+
return allAggregateFunctions.includes(possible);
|
|
15
|
+
};
|
|
16
|
+
exports.isQueryEngineFunction = isQueryEngineFunction;
|
|
17
|
+
/** Is the given value an aggregate function? */
|
|
18
|
+
const isAggregateFunction = (queryEngineConfig, possibleAggregateFunction) => {
|
|
19
|
+
const allAggregateFunctions = Object.keys(queryEngineConfig.supportedFunctions).filter((funcName) => {
|
|
20
|
+
const sF = queryEngineConfig.supportedFunctions[funcName];
|
|
21
|
+
return sF.useFor.includes('aggregate');
|
|
22
|
+
});
|
|
23
|
+
return allAggregateFunctions.includes(possibleAggregateFunction);
|
|
24
|
+
};
|
|
25
|
+
exports.isAggregateFunction = isAggregateFunction;
|
|
26
|
+
/** Is the given value a time trunc function? */
|
|
27
|
+
const isTimeTruncFunction = (queryEngineConfig, possibleTimeTruncFunction) => {
|
|
28
|
+
const allTimeTruncFunctions = Object.keys(queryEngineConfig.supportedFunctions).filter((funcName) => {
|
|
29
|
+
const sF = queryEngineConfig.supportedFunctions[funcName];
|
|
30
|
+
return (sF.useFor.includes('transform') && sF.inputDataTypes.includes('date_time') && sF.outputDataType === 'date_time');
|
|
31
|
+
});
|
|
32
|
+
return allTimeTruncFunctions.includes(possibleTimeTruncFunction);
|
|
33
|
+
};
|
|
34
|
+
exports.isTimeTruncFunction = isTimeTruncFunction;
|
|
35
|
+
/** Is the given value a transformation function? */
|
|
36
|
+
const isTransformationFunction = (queryEngineConfig, possibleTransformationFunction) => {
|
|
37
|
+
const allTransformationFunctions = Object.keys(queryEngineConfig.supportedFunctions).filter((funcName) => {
|
|
38
|
+
const sF = queryEngineConfig.supportedFunctions[funcName];
|
|
39
|
+
return sF.useFor.includes('transform') && sF.outputDataType != 'date_time';
|
|
40
|
+
});
|
|
41
|
+
return allTransformationFunctions.includes(possibleTransformationFunction);
|
|
42
|
+
};
|
|
43
|
+
exports.isTransformationFunction = isTransformationFunction;
|