@vizzly/semantic-layer-public 0.0.219 → 0.0.223

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.
@@ -71,54 +71,67 @@ exports.timeDimensionsConstants = {
71
71
  month: {
72
72
  publicName: 'Monthly',
73
73
  dateFormat: 'MMMM YYYY',
74
+ dataTypeOutput: 'date_time',
74
75
  },
75
76
  year: {
76
77
  publicName: 'Yearly',
77
78
  dateFormat: 'YYYY',
79
+ dataTypeOutput: 'date_time',
78
80
  },
79
81
  quarter: {
80
82
  publicName: 'Per quarter',
81
83
  dateFormat: 'quarter',
84
+ dataTypeOutput: 'date_time',
82
85
  },
83
86
  week: {
84
87
  publicName: 'Weekly',
85
88
  dateFormat: 'week',
89
+ dataTypeOutput: 'date_time',
86
90
  },
87
91
  day: {
88
92
  publicName: 'Daily',
89
93
  dateFormat: 'DD-MM-YYYY',
94
+ dataTypeOutput: 'date_time',
90
95
  },
91
96
  hourOfDayOnly: {
92
97
  publicName: 'Hour of day',
93
98
  dateFormat: 'hour_of_day',
99
+ dataTypeOutput: 'date_time',
94
100
  },
95
101
  weekOfYearOnly: {
96
102
  publicName: 'Week of year',
97
103
  dateFormat: 'week_of_year',
104
+ dataTypeOutput: 'number',
98
105
  },
99
106
  dayOfWeekOnly: {
100
107
  publicName: 'Day of week',
101
108
  dateFormat: 'day_of_week_iso',
109
+ dataTypeOutput: 'number',
102
110
  },
103
111
  monthOfYearOnly: {
104
112
  publicName: 'Month of year',
105
113
  dateFormat: 'month_of_year',
114
+ dataTypeOutput: 'number',
106
115
  },
107
116
  dayOfMonthOnly: {
108
117
  publicName: 'Day of month',
109
118
  dateFormat: 'day_of_month',
119
+ dataTypeOutput: 'number',
110
120
  },
111
121
  second: {
112
122
  publicName: 'Per second',
113
123
  dateFormat: 'hh:mm:ss',
124
+ dataTypeOutput: 'date_time',
114
125
  },
115
126
  hour: {
116
127
  publicName: 'Hourly',
117
128
  dateFormat: 'hh:mm',
129
+ dataTypeOutput: 'date_time',
118
130
  },
119
131
  minute: {
120
132
  publicName: 'Per minute',
121
133
  dateFormat: 'hh:mm',
134
+ dataTypeOutput: 'date_time',
122
135
  },
123
136
  };
124
137
  exports.supportedAggregatesConstants = {
@@ -24,10 +24,11 @@ export type SupportedTransformationFunctions = {
24
24
  };
25
25
  export type SupportedTimeTruncFunction = {
26
26
  publicName: string;
27
+ dataTypeOutput: 'number' | 'boolean' | 'string' | 'date_time' | 'string[]';
27
28
  /**
28
- * Once from the query engine, what is
29
- * the most appropriate format for it
30
- * to be displayed in?
29
+ * @deprecated
30
+ * formatting function to use is determined
31
+ * by the frontend from function -> formatter id
31
32
  * */
32
33
  dateFormat: DateTimeFormat | (string & {});
33
34
  };
@@ -12,21 +12,6 @@ const constants_2 = require("../QueryEngineConfig/constants");
12
12
  const DataSetNotLinkedToConnection_1 = require("../errors/DataSetNotLinkedToConnection");
13
13
  const REDACT_KEYS_FROM_ERROR_MESSAGE = ['unencryptedCredentials', 'encryptedCredentials'];
14
14
  const SUPPORTED_SECURE_FILTER_OPS = Object.keys(constants_2.supportedOperatorsConstants);
15
- const SUPPORTED_ALLOWED_GRANULARITIES = [
16
- 'second',
17
- 'minute',
18
- 'hour',
19
- 'day',
20
- 'week',
21
- 'month',
22
- 'quarter',
23
- 'year',
24
- 'dayOfMonthOnly',
25
- 'dayOfWeekOnly',
26
- 'weekOfYearOnly',
27
- 'hourOfDayOnly',
28
- 'monthOfYearOnly',
29
- ];
30
15
  const SUPPORTED_JOINS = ['rightJoin', 'leftJoin', 'innerJoin', 'outerJoin', 'leftOuterJoin', 'rightOuterJoin'];
31
16
  exports.ALLOWED_ID_REGEX = /^[a-zA-Z0-9_+:\/=\-\s]*$/;
32
17
  exports.ID_REGEX_ERROR_MESSAGE = 'IDs must only use alpha numeric characters and _';
@@ -59,7 +44,7 @@ const _fieldSchema = (client) => {
59
44
  canBeMeasure: joi_1.default.boolean().optional().description('Can this field be used in aggregations?'),
60
45
  canBeUsedInSort: joi_1.default.boolean().optional().description('__vizzly_hide_from_docs'),
61
46
  allowedGranularities: joi_1.default.array()
62
- .items(joi_1.default.string().valid(...SUPPORTED_ALLOWED_GRANULARITIES))
47
+ .items(joi_1.default.string().valid(...Object.keys((0, getQueryEngineConfig_1.getQueryEngineConfig)(client).supportedTimeTruncFunctions)))
63
48
  .optional(),
64
49
  allowedOperators: joi_1.default.alternatives()
65
50
  .conditional('..dataType', {
@@ -133,6 +118,13 @@ const baseDataSetSchema = (fieldSchema) => ({
133
118
  .optional()
134
119
  .description('Optional - For pre-aggregated data sets or SQL views, provide a list of data sets that are relied upon.'),
135
120
  fields: joi_1.default.array().min(1).items(fieldSchema).unique('id').message('Field IDs must be unique').required(),
121
+ permanentFilters: joi_1.default.object({
122
+ type: joi_1.default.valid('andWhere', 'orWhere', 'where'),
123
+ // TODO;
124
+ // more validation on the list
125
+ // of filters provided here.
126
+ value: joi_1.default.array(),
127
+ }),
136
128
  secureFilterGuards: joi_1.default.array().items(secureFilterGuardSchema).optional(),
137
129
  });
138
130
  const _sqlDataSetSchema = (fieldSchema) => joi_1.default.object(Object.assign(Object.assign({}, baseDataSetSchema(fieldSchema)), { joins: joi_1.default.array()
package/dist/types.d.ts CHANGED
@@ -1,3 +1,2 @@
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.219",
3
+ "version": "0.0.223",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,10 +21,10 @@
21
21
  "jest": "^29.7.0",
22
22
  "ts-jest": "^29.1.2",
23
23
  "typescript": "^5.4.5",
24
- "@vizzly/sqlbuilder-public": "0.1.25"
24
+ "@vizzly/sqlbuilder-public": "0.1.28"
25
25
  },
26
26
  "peerDependencies": {
27
- "@vizzly/sqlbuilder-public": "0.1.25",
27
+ "@vizzly/sqlbuilder-public": "0.1.28",
28
28
  "@vizzly/joi": "^17.11.0"
29
29
  }
30
30
  }