@vizzly/semantic-layer-public 0.0.114 → 0.0.116
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,11 @@
|
|
|
1
|
-
import validate, { ConfigValidationOptions } from './validate';
|
|
2
|
-
|
|
1
|
+
import validate, { ConfigValidationOptions, ALLOWED_ID_REGEX, ID_REGEX_ERROR_MESSAGE } from './validate';
|
|
2
|
+
declare const Schemas: {
|
|
3
|
+
bigQuery: import("@vizzly/joi").ObjectSchema<any>;
|
|
4
|
+
postgres: import("@vizzly/joi").ObjectSchema<any>;
|
|
5
|
+
mariadb: import("@vizzly/joi").ObjectSchema<any>;
|
|
6
|
+
mySQL: import("@vizzly/joi").ObjectSchema<any>;
|
|
7
|
+
snowflake: import("@vizzly/joi").ObjectSchema<any>;
|
|
8
|
+
microsoftSQLServer: import("@vizzly/joi").ObjectSchema<any>;
|
|
9
|
+
redshift: import("@vizzly/joi").ObjectSchema<any>;
|
|
10
|
+
};
|
|
11
|
+
export { validate, ConfigValidationOptions, ALLOWED_ID_REGEX, ID_REGEX_ERROR_MESSAGE, Schemas };
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validate = void 0;
|
|
7
|
-
const validate_1 =
|
|
26
|
+
exports.Schemas = exports.ID_REGEX_ERROR_MESSAGE = exports.ALLOWED_ID_REGEX = exports.validate = void 0;
|
|
27
|
+
const validate_1 = __importStar(require("./validate"));
|
|
8
28
|
exports.validate = validate_1.default;
|
|
29
|
+
Object.defineProperty(exports, "ALLOWED_ID_REGEX", { enumerable: true, get: function () { return validate_1.ALLOWED_ID_REGEX; } });
|
|
30
|
+
Object.defineProperty(exports, "ID_REGEX_ERROR_MESSAGE", { enumerable: true, get: function () { return validate_1.ID_REGEX_ERROR_MESSAGE; } });
|
|
31
|
+
const Schemas = {
|
|
32
|
+
bigQuery: validate_1.bigQuerySchema,
|
|
33
|
+
postgres: validate_1.postgresSchema,
|
|
34
|
+
mariadb: validate_1.mariadbSchema,
|
|
35
|
+
mySQL: validate_1.mySQLSchema,
|
|
36
|
+
snowflake: validate_1.snowflakeSchema,
|
|
37
|
+
microsoftSQLServer: validate_1.microsoftSQLServerSchema,
|
|
38
|
+
redshift: validate_1.redshiftSchema,
|
|
39
|
+
};
|
|
40
|
+
exports.Schemas = Schemas;
|
|
@@ -11,5 +11,12 @@ export type ConfigValidationOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const _fieldSchema: (client: Client) => Joi.ObjectSchema<any>;
|
|
13
13
|
export declare const _sqlDataSetSchema: (fieldSchema: Joi.Schema) => Joi.ObjectSchema<any>;
|
|
14
|
+
export declare const bigQuerySchema: Joi.ObjectSchema<any>;
|
|
15
|
+
export declare const postgresSchema: Joi.ObjectSchema<any>;
|
|
16
|
+
export declare const mariadbSchema: Joi.ObjectSchema<any>;
|
|
17
|
+
export declare const mySQLSchema: Joi.ObjectSchema<any>;
|
|
18
|
+
export declare const snowflakeSchema: Joi.ObjectSchema<any>;
|
|
19
|
+
export declare const microsoftSQLServerSchema: Joi.ObjectSchema<any>;
|
|
20
|
+
export declare const redshiftSchema: Joi.ObjectSchema<any>;
|
|
14
21
|
declare const _default: (config: any, options?: Partial<ConfigValidationOptions>) => Joi.ValidationResult;
|
|
15
22
|
export default _default;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports._sqlDataSetSchema = exports._fieldSchema = exports.ID_REGEX_ERROR_MESSAGE = exports.ALLOWED_ID_REGEX = void 0;
|
|
6
|
+
exports.redshiftSchema = exports.microsoftSQLServerSchema = exports.snowflakeSchema = exports.mySQLSchema = exports.mariadbSchema = exports.postgresSchema = exports.bigQuerySchema = exports._sqlDataSetSchema = exports._fieldSchema = exports.ID_REGEX_ERROR_MESSAGE = exports.ALLOWED_ID_REGEX = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("@vizzly/joi"));
|
|
8
8
|
const getQueryEngineConfig_1 = require("../QueryEngineConfig/getQueryEngineConfig");
|
|
9
9
|
const constants_1 = require("./constants");
|
|
@@ -54,9 +54,9 @@ const _fieldSchema = (client) => {
|
|
|
54
54
|
.optional()
|
|
55
55
|
.description('Provide a SQL definition of the field, instead of a table & name combination.'),
|
|
56
56
|
dataType: joi_1.default.valid(...Object.values(constants_1.NATIVE_DATA_TYPES[client])).required(),
|
|
57
|
-
canBeDimension: joi_1.default.boolean().optional(),
|
|
58
|
-
canBeMeasure: joi_1.default.boolean().optional(),
|
|
59
|
-
canBeUsedInSort: joi_1.default.boolean().optional(),
|
|
57
|
+
canBeDimension: joi_1.default.boolean().optional().description('Can this field be used in groupings?'),
|
|
58
|
+
canBeMeasure: joi_1.default.boolean().optional().description('Can this field be used in aggregations?'),
|
|
59
|
+
canBeUsedInSort: joi_1.default.boolean().optional().description('__vizzly_hide_from_docs'),
|
|
60
60
|
allowedGranularities: joi_1.default.array()
|
|
61
61
|
.items(joi_1.default.string().valid(...SUPPORTED_ALLOWED_GRANULARITIES))
|
|
62
62
|
.optional(),
|
|
@@ -114,7 +114,7 @@ const baseDataSetSchema = (fieldSchema) => ({
|
|
|
114
114
|
.required()
|
|
115
115
|
.regex(exports.ALLOWED_ID_REGEX, exports.ID_REGEX_ERROR_MESSAGE)
|
|
116
116
|
.description('A unique ID for the data set. This should not change unless the meaning of the data set represents changes.'),
|
|
117
|
-
connectionId: joi_1.default.string().required(),
|
|
117
|
+
connectionId: joi_1.default.string().required().description('Reference the connection to use for this data set.'),
|
|
118
118
|
hide: joi_1.default.boolean().optional().description('Hide the data set from the dashboard.'),
|
|
119
119
|
name: joi_1.default.string()
|
|
120
120
|
.required()
|
|
@@ -213,6 +213,13 @@ const configSchema = (fullObj, options) => joi_1.default.object({
|
|
|
213
213
|
.pattern(joi_1.default.string(), joi_1.default.object({ name: joi_1.default.string().required(), sql: joi_1.default.string().allow('').required() }))
|
|
214
214
|
.optional(),
|
|
215
215
|
});
|
|
216
|
+
exports.bigQuerySchema = configSchema({}, { onlyClients: ['bigquery'] });
|
|
217
|
+
exports.postgresSchema = configSchema({}, { onlyClients: ['postgres'] });
|
|
218
|
+
exports.mariadbSchema = configSchema({}, { onlyClients: ['mariadb'] });
|
|
219
|
+
exports.mySQLSchema = configSchema({}, { onlyClients: ['mysql'] });
|
|
220
|
+
exports.snowflakeSchema = configSchema({}, { onlyClients: ['snowflake'] });
|
|
221
|
+
exports.microsoftSQLServerSchema = configSchema({}, { onlyClients: ['microsoftSQLServer'] });
|
|
222
|
+
exports.redshiftSchema = configSchema({}, { onlyClients: ['redshift'] });
|
|
216
223
|
exports.default = (config, options = {}) => {
|
|
217
224
|
const validationResult = configSchema(config, Object.assign(Object.assign(Object.assign({}, DEFAULT_SCHEMA_OPTIONS), options), { dataSetIdToClientMapping: buildDataSetToClientTypeMapping(config) })).validate(config, joiOptions);
|
|
218
225
|
if (validationResult.error) {
|