@vizzly/semantic-layer-public 0.0.214 → 0.0.216
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/QueryEngineConfig/constants.d.ts +2 -1
- package/dist/QueryEngineConfig/constants.js +6 -1
- package/dist/QueryEngineConfig/index.d.ts +1 -0
- package/dist/QueryEngineConfig/index.js +1 -0
- package/dist/QueryEngineConfig/removeUnsupportedFeatures.d.ts +12 -0
- package/dist/QueryEngineConfig/removeUnsupportedFeatures.js +22 -0
- package/dist/QueryEngineConfig/snowflake.js +1 -0
- package/dist/QueryEngineConfig/types.d.ts +11 -1
- package/dist/VizzlyConfig/validate.js +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +3 -6
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SupportedAggregates, SupportedOperators, SupportedTimeTruncFunctions } from './types';
|
|
1
|
+
import { FrontendFeature, SupportedAggregates, SupportedOperators, SupportedTimeTruncFunctions } from './types';
|
|
2
2
|
export declare const supportedOperatorsConstants: SupportedOperators;
|
|
3
3
|
export declare const timeDimensionsConstants: SupportedTimeTruncFunctions;
|
|
4
4
|
export declare const supportedAggregatesConstants: SupportedAggregates;
|
|
5
|
+
export declare const ALL_FRONTEND_FEATURES: FrontendFeature[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportedAggregatesConstants = exports.timeDimensionsConstants = exports.supportedOperatorsConstants = void 0;
|
|
3
|
+
exports.ALL_FRONTEND_FEATURES = exports.supportedAggregatesConstants = exports.timeDimensionsConstants = exports.supportedOperatorsConstants = void 0;
|
|
4
4
|
exports.supportedOperatorsConstants = {
|
|
5
5
|
'>': {
|
|
6
6
|
publicName: 'Greater than',
|
|
@@ -100,6 +100,10 @@ exports.timeDimensionsConstants = {
|
|
|
100
100
|
publicName: 'Day of week',
|
|
101
101
|
dateFormat: 'day_of_week_iso',
|
|
102
102
|
},
|
|
103
|
+
monthOfYearOnly: {
|
|
104
|
+
publicName: 'Month of year',
|
|
105
|
+
dateFormat: 'month_of_year_only',
|
|
106
|
+
},
|
|
103
107
|
dayOfMonthOnly: {
|
|
104
108
|
publicName: 'Day of month',
|
|
105
109
|
dateFormat: 'day_of_month',
|
|
@@ -167,3 +171,4 @@ exports.supportedAggregatesConstants = {
|
|
|
167
171
|
validDataTypes: ['number'],
|
|
168
172
|
},
|
|
169
173
|
};
|
|
174
|
+
exports.ALL_FRONTEND_FEATURES = ['formatter:monthOfYearOnly'];
|
|
@@ -31,3 +31,4 @@ __exportStar(require("./getQueryEngineConfig"), exports);
|
|
|
31
31
|
__exportStar(require("./merge"), exports);
|
|
32
32
|
exports.Constants = __importStar(require("./constants"));
|
|
33
33
|
exports.Support = __importStar(require("./support"));
|
|
34
|
+
__exportStar(require("./removeUnsupportedFeatures"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FrontendFeature, QueryEngineConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sometimes the query engine will support a feature which the dashboard does not.
|
|
4
|
+
* An example being returning a number that represents a month of the year. However
|
|
5
|
+
* the dashboard will not know how to format this - e.g convert the number 1 into "January"
|
|
6
|
+
* as a number formatting option.
|
|
7
|
+
*
|
|
8
|
+
* Therefore the query engine config should be modified to only add in features which the
|
|
9
|
+
* dashboard can understand. This is the function that takes a list of supported functions
|
|
10
|
+
* from the frontend, adjusts the query engine config and then returns it.
|
|
11
|
+
* */
|
|
12
|
+
export declare const removeUnsupportedFeatures: (config: QueryEngineConfig, frontendSupportedFeatures: FrontendFeature[]) => QueryEngineConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeUnsupportedFeatures = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
/**
|
|
6
|
+
* Sometimes the query engine will support a feature which the dashboard does not.
|
|
7
|
+
* An example being returning a number that represents a month of the year. However
|
|
8
|
+
* the dashboard will not know how to format this - e.g convert the number 1 into "January"
|
|
9
|
+
* as a number formatting option.
|
|
10
|
+
*
|
|
11
|
+
* Therefore the query engine config should be modified to only add in features which the
|
|
12
|
+
* dashboard can understand. This is the function that takes a list of supported functions
|
|
13
|
+
* from the frontend, adjusts the query engine config and then returns it.
|
|
14
|
+
* */
|
|
15
|
+
const removeUnsupportedFeatures = (config, frontendSupportedFeatures) => {
|
|
16
|
+
const newConfig = (0, lodash_1.cloneDeep)(config);
|
|
17
|
+
if (!frontendSupportedFeatures.includes('formatter:monthOfYearOnly')) {
|
|
18
|
+
delete newConfig['supportedTimeTruncFunctions']['monthOfYearOnly'];
|
|
19
|
+
}
|
|
20
|
+
return newConfig;
|
|
21
|
+
};
|
|
22
|
+
exports.removeUnsupportedFeatures = removeUnsupportedFeatures;
|
|
@@ -50,4 +50,14 @@ export type SupportedAggregates = {
|
|
|
50
50
|
[id: string]: SupportedAggregate;
|
|
51
51
|
};
|
|
52
52
|
export type SupportedAggregateOption = string;
|
|
53
|
-
export type SupportedTimeFunctions = 'minute' | 'hour' | 'second' | 'week' | 'quarter' | 'year' | 'month' | 'day' | 'dayOfMonthOnly' | 'dayOfWeekOnly' | 'hourOfDayOnly' | 'weekOfYearOnly';
|
|
53
|
+
export type SupportedTimeFunctions = 'minute' | 'hour' | 'second' | 'week' | 'quarter' | 'year' | 'month' | 'day' | 'dayOfMonthOnly' | 'dayOfWeekOnly' | 'hourOfDayOnly' | 'weekOfYearOnly' | 'monthOfYearOnly';
|
|
54
|
+
/**
|
|
55
|
+
* Sometimes the query engine will support a feature which the dashboard does not.
|
|
56
|
+
* An example being returning a number that represents a month of the year. However
|
|
57
|
+
* the dashboard will not know how to format this - e.g convert the number 1 into "January"
|
|
58
|
+
* as a number formatting option.
|
|
59
|
+
*
|
|
60
|
+
* Therefore the query engine config should be modified to only add in features which the
|
|
61
|
+
* dashboard can understand. Listed here are the definitions of features which are supported.
|
|
62
|
+
* */
|
|
63
|
+
export type FrontendFeature = 'formatter:monthOfYearOnly';
|
|
@@ -25,6 +25,7 @@ const SUPPORTED_ALLOWED_GRANULARITIES = [
|
|
|
25
25
|
'dayOfWeekOnly',
|
|
26
26
|
'weekOfYearOnly',
|
|
27
27
|
'hourOfDayOnly',
|
|
28
|
+
'monthOfYearOnly',
|
|
28
29
|
];
|
|
29
30
|
const SUPPORTED_JOINS = ['rightJoin', 'leftJoin', 'innerJoin', 'outerJoin', 'leftOuterJoin', 'rightOuterJoin'];
|
|
30
31
|
exports.ALLOWED_ID_REGEX = /^[a-zA-Z0-9_+:\/=\-\s]*$/;
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/semantic-layer-public",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.216",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,16 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/jest": "^29.5.12",
|
|
21
|
-
"@types/uuid": "^9.0.8",
|
|
22
21
|
"jest": "^29.7.0",
|
|
23
|
-
"prettier": "^3.2.5",
|
|
24
22
|
"ts-jest": "^29.1.2",
|
|
25
23
|
"typescript": "^5.4.5",
|
|
26
|
-
"
|
|
27
|
-
"@vizzly/sqlbuilder-public": "0.1.23"
|
|
24
|
+
"@vizzly/sqlbuilder-public": "0.1.24"
|
|
28
25
|
},
|
|
29
26
|
"peerDependencies": {
|
|
30
|
-
"@vizzly/sqlbuilder-public": "0.1.
|
|
27
|
+
"@vizzly/sqlbuilder-public": "0.1.24",
|
|
31
28
|
"@vizzly/joi": "^17.11.0"
|
|
32
29
|
}
|
|
33
30
|
}
|