@vizzly/semantic-layer-public 0.0.214 → 0.0.215

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.
@@ -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',
@@ -2,3 +2,4 @@ export * from './getQueryEngineConfig';
2
2
  export * from './merge';
3
3
  export * as Constants from './constants';
4
4
  export * as Support from './support';
5
+ export * from './removeUnsupportedFeatures';
@@ -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;
@@ -29,6 +29,7 @@ const queryEngineConfig = () => ({
29
29
  'dayOfWeekOnly',
30
30
  'weekOfYearOnly',
31
31
  'hourOfDayOnly',
32
+ 'monthOfYearOnly',
32
33
  ]),
33
34
  supportedAggregates: (0, support_1.supportedAggregates)([
34
35
  'sum',
@@ -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
@@ -1,2 +1,3 @@
1
1
  export type OriginId = 'direct' | 'environment' | 'vizzly_api' | 'github' | 'remote' | 's3' | 'file' | 'encrypted_blob';
2
2
  export type * from './QueryEngineConfig/types';
3
+ export type * from './QueryEngineConfig/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly/semantic-layer-public",
3
- "version": "0.0.214",
3
+ "version": "0.0.215",
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
- "uuid": "^9.0.1",
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.23",
27
+ "@vizzly/sqlbuilder-public": "0.1.24",
31
28
  "@vizzly/joi": "^17.11.0"
32
29
  }
33
30
  }