@vizzly/semantic-layer-public
Advanced tools
Comparing version 0.0.205-rc-2 to 0.0.205
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -21,3 +20,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -31,11 +30,4 @@ 'year', | ||
'second', | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -57,3 +49,4 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,5 +0,4 @@ | ||
import { QueryEngineConfigV1, SupportedOperators } from './types'; | ||
import { SupportedAggregates, SupportedOperators, SupportedTimeTruncFunctions } from './types'; | ||
export declare const supportedOperatorsConstants: SupportedOperators; | ||
/** Map a function to it's default public name. */ | ||
export declare const functionToPublicName: (functionName: string) => string; | ||
export declare const SUPPORTED_FUNCTIONS: QueryEngineConfigV1['supportedFunctions']; | ||
export declare const timeDimensionsConstants: SupportedTimeTruncFunctions; | ||
export declare const supportedAggregatesConstants: SupportedAggregates; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SUPPORTED_FUNCTIONS = exports.functionToPublicName = exports.supportedOperatorsConstants = void 0; | ||
exports.supportedAggregatesConstants = exports.timeDimensionsConstants = exports.supportedOperatorsConstants = void 0; | ||
exports.supportedOperatorsConstants = { | ||
@@ -70,179 +70,101 @@ '>': { | ||
}; | ||
/** Map a function to it's default public name. */ | ||
const functionToPublicName = (functionName) => { | ||
const publicName = { | ||
month: 'Monthly', | ||
year: 'Yearly', | ||
quarter: 'Per quarter', | ||
week: 'Weekly', | ||
day: 'Daily', | ||
hourOfDayOnly: 'Hour of day', | ||
weekOfYearOnly: 'Week of year', | ||
dayOfWeekOnly: 'Day of week', | ||
dayOfMonthOnly: 'Day of month', | ||
second: 'Per second', | ||
hour: 'Hourly', | ||
minute: 'Per minute', | ||
mean: 'Mean', | ||
sum: 'Sum', | ||
min: 'Min', | ||
max: 'Max', | ||
count: 'Count', | ||
countDistinct: 'Unique', | ||
median: 'Median', | ||
percentile25: '25th percentile', | ||
percentile75: '75th percentile', | ||
percentile90: '90th percentile', | ||
percentile95: '95th percentile', | ||
percentile99: '99th percentile', | ||
round_to_0_dp: 'Round to 0dp', | ||
round_to_2_dp: 'Round to 2dp', | ||
}[functionName]; | ||
if (publicName) | ||
return publicName; | ||
console.warn(`Missing public name for function '${functionName}'.`); | ||
return functionName; | ||
}; | ||
exports.functionToPublicName = functionToPublicName; | ||
exports.SUPPORTED_FUNCTIONS = { | ||
// rounding | ||
round_to_0_dp: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
}, | ||
round_to_2_dp: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
}, | ||
// times | ||
exports.timeDimensionsConstants = { | ||
month: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Monthly', | ||
dateFormat: 'MMMM YYYY', | ||
}, | ||
year: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Yearly', | ||
dateFormat: 'YYYY', | ||
}, | ||
quarter: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Per quarter', | ||
dateFormat: 'quarter', | ||
}, | ||
week: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Weekly', | ||
dateFormat: 'week', | ||
}, | ||
day: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Daily', | ||
dateFormat: 'DD-MM-YYYY', | ||
}, | ||
hourOfDayOnly: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'number', | ||
publicName: 'Hour of day', | ||
dateFormat: 'hour_of_day', | ||
}, | ||
weekOfYearOnly: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'number', | ||
publicName: 'Week of year', | ||
dateFormat: 'week_of_year', | ||
}, | ||
dayOfWeekOnly: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'number', | ||
publicName: 'Day of week', | ||
dateFormat: 'day_of_week_iso', | ||
}, | ||
dayOfMonthOnly: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'number', | ||
publicName: 'Day of month', | ||
dateFormat: 'day_of_month', | ||
}, | ||
second: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Per second', | ||
dateFormat: 'hh:mm:ss', | ||
}, | ||
hour: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Hourly', | ||
dateFormat: 'hh:mm', | ||
}, | ||
minute: { | ||
useFor: ['transform'], | ||
inputDataTypes: ['date_time'], | ||
outputDataType: 'date_time', | ||
publicName: 'Per minute', | ||
dateFormat: 'hh:mm', | ||
}, | ||
// aggregates | ||
}; | ||
exports.supportedAggregatesConstants = { | ||
mean: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: 'Mean', | ||
validDataTypes: ['number'], | ||
}, | ||
sum: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: 'Sum', | ||
validDataTypes: ['number'], | ||
}, | ||
min: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: 'Min', | ||
validDataTypes: ['number'], | ||
}, | ||
max: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: 'Max', | ||
validDataTypes: ['number'], | ||
}, | ||
count: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['string', 'number', 'boolean', 'date_time', 'string[]'], | ||
outputDataType: 'number', | ||
publicName: 'Count', | ||
validDataTypes: ['string', 'number', 'boolean', 'date_time', 'string[]'], | ||
}, | ||
countDistinct: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['string', 'number', 'boolean', 'date_time'], | ||
outputDataType: 'number', | ||
publicName: 'Unique', | ||
validDataTypes: ['string', 'number', 'boolean', 'date_time'], | ||
}, | ||
median: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: 'Median', | ||
validDataTypes: ['number'], | ||
}, | ||
percentile25: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: '25th percentile', | ||
validDataTypes: ['number'], | ||
}, | ||
percentile75: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: '75th percentile', | ||
validDataTypes: ['number'], | ||
}, | ||
percentile90: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: '90th percentile', | ||
validDataTypes: ['number'], | ||
}, | ||
percentile95: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: '95th percentile', | ||
validDataTypes: ['number'], | ||
}, | ||
percentile99: { | ||
useFor: ['aggregate'], | ||
inputDataTypes: ['number'], | ||
outputDataType: 'number', | ||
publicName: '99th percentile', | ||
validDataTypes: ['number'], | ||
}, | ||
}; | ||
// { | ||
// [id: string]: { | ||
// useFor: Array<'aggregate' | 'transform'>; | ||
// inputDataTypes: Array<NormalizedDataType>; | ||
// outputDataType: NormalizedDataType; | ||
// }; | ||
// } |
import { Client } from '@vizzly/sqlbuilder-public'; | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const getQueryEngineConfig: (client: Client | 'js') => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const getQueryEngineConfig: (client: Client | 'js') => QueryEngineConfig; |
export * from './getQueryEngineConfig'; | ||
export * from './merge'; | ||
export * from './upcast'; | ||
export * from './downcast'; | ||
export * from './helpers'; | ||
export * as Constants from './constants'; | ||
export * as Support from './support'; |
@@ -32,6 +32,3 @@ "use strict"; | ||
__exportStar(require("./merge"), exports); | ||
__exportStar(require("./upcast"), exports); | ||
__exportStar(require("./downcast"), exports); | ||
__exportStar(require("./helpers"), exports); | ||
exports.Constants = __importStar(require("./constants")); | ||
exports.Support = __importStar(require("./support")); |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const localQueryEngineConfig: QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const localQueryEngineConfig: QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
exports.localQueryEngineConfig = { | ||
version: 1, | ||
origin: 'in-browser', | ||
@@ -19,3 +18,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -29,12 +28,4 @@ 'year', | ||
'second', | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'median', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct', 'median']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -56,2 +47,3 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -21,18 +20,4 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
'month', | ||
'year', | ||
'day', | ||
'hour', | ||
'minute', | ||
'second', | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)(['month', 'year', 'day', 'hour', 'minute', 'second']), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -52,3 +37,4 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,3 +0,3 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
import { QueryEngineConfig } from './types'; | ||
/** If more than one DB is used, then we need to combine the configs and take the intersection of features. */ | ||
export declare const merge: (...queryEngineConfigs: QueryEngineConfigV1[]) => QueryEngineConfigV1; | ||
export declare const merge: (...queryEngineConfigs: QueryEngineConfig[]) => QueryEngineConfig; |
@@ -18,7 +18,8 @@ "use strict"; | ||
return { | ||
version: 1, | ||
origin: 'query-engine', | ||
supportedFunctions: mapIntersection('supportedFunctions'), | ||
supportedAggregates: mapIntersection('supportedAggregates'), | ||
supportedFeatures: (0, lodash_1.intersection)(acc.supportedFeatures, current.supportedFeatures), | ||
supportedOperators: mapIntersection('supportedOperators'), | ||
supportedTimeTruncFunctions: mapIntersection('supportedTimeTruncFunctions'), | ||
supportedTransformationFunctions: mapIntersection('supportedTransformationFunctions'), | ||
}; | ||
@@ -25,0 +26,0 @@ }, queryEngineConfigs[0]); |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -13,3 +13,2 @@ "use strict"; | ||
return { | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -28,3 +27,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -38,11 +37,4 @@ 'year', | ||
...(isKustoFlavor() ? [] : ['second']), | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -64,4 +56,5 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}; | ||
}; | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -20,18 +19,4 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
'month', | ||
'year', | ||
'day', | ||
'hour', | ||
'minute', | ||
'second', | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)(['month', 'year', 'day', 'hour', 'minute', 'second']), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -51,3 +36,4 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -21,3 +20,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -34,2 +33,4 @@ 'year', | ||
'weekOfYearOnly', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)([ | ||
'sum', | ||
@@ -47,4 +48,2 @@ 'mean', | ||
'percentile99', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
@@ -67,3 +66,4 @@ supportedOperators: (0, support_1.supportedOperators)([ | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -21,3 +20,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -31,11 +30,4 @@ 'year', | ||
'second', | ||
'sum', | ||
'mean', | ||
'min', | ||
'max', | ||
'count', | ||
'countDistinct', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)(['sum', 'mean', 'min', 'max', 'count', 'countDistinct']), | ||
supportedOperators: (0, support_1.supportedOperators)([ | ||
@@ -57,3 +49,4 @@ '>', | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
@@ -1,2 +0,2 @@ | ||
import { QueryEngineConfigV1 } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfigV1; | ||
import { QueryEngineConfig } from './types'; | ||
export declare const queryEngineConfig: () => QueryEngineConfig; |
@@ -6,3 +6,2 @@ "use strict"; | ||
const queryEngineConfig = () => ({ | ||
version: 1, | ||
origin: 'query-engine', | ||
@@ -21,3 +20,3 @@ supportedFeatures: [ | ||
], | ||
supportedFunctions: (0, support_1.supportedFunctions)([ | ||
supportedTimeTruncFunctions: (0, support_1.supportedTimeTruncFunctions)([ | ||
'month', | ||
@@ -35,2 +34,4 @@ 'year', | ||
'hourOfDayOnly', | ||
]), | ||
supportedAggregates: (0, support_1.supportedAggregates)([ | ||
'sum', | ||
@@ -48,4 +49,2 @@ 'mean', | ||
'percentile99', | ||
'round_to_0_dp', | ||
'round_to_2_dp', | ||
]), | ||
@@ -70,3 +69,4 @@ supportedOperators: (0, support_1.supportedOperators)([ | ||
]), | ||
supportedTransformationFunctions: (0, support_1.supportedTransformationFunctions)(['round_to_0_dp', 'round_to_2_dp']), | ||
}); | ||
exports.queryEngineConfig = queryEngineConfig; |
import { NormalizedDataType } from '@vizzly/sqlbuilder-public'; | ||
import { QueryEngineConfigV1, SupportedAggregates, SupportedOperators, SupportedTimeTruncFunctions } from './types'; | ||
import { SUPPORTED_FUNCTIONS } from './constants'; | ||
import { QueryEngineConfig, SupportedAggregateOption, SupportedAggregates, SupportedOperators, SupportedTimeFunctions, SupportedTimeTruncFunctions, SupportedTransformationFunctions } from './types'; | ||
declare const vizzlySupportedTransformationFunctions: SupportedTransformationFunctions; | ||
export declare const supportedTransformationFunctions: (keys?: Array<keyof typeof vizzlySupportedTransformationFunctions>) => SupportedTransformationFunctions; | ||
export declare const supportedAggregatesFunction: (queryEngineConfig: QueryEngineConfig, dataType: NormalizedDataType, supportedAggregateOptions?: SupportedAggregateOption[]) => SupportedAggregateOption[]; | ||
export declare const supportedOperators: (keys?: Array<string>) => SupportedOperators; | ||
export declare const supportedFunctions: (keys?: Array<keyof typeof SUPPORTED_FUNCTIONS>) => QueryEngineConfigV1['supportedFunctions']; | ||
export declare const supportedTimeTruncFunctions: (keys?: Array<SupportedTimeFunctions>) => SupportedTimeTruncFunctions; | ||
export declare const supportedAggregates: (keys?: Array<string>) => SupportedAggregates; | ||
export declare const isSupportedAggregateFunction: (supportedAggregateFunctions: SupportedAggregates, proposedFunction: string) => boolean; | ||
export declare const isSupportedAggregate: (value: string | undefined, supportedAggregates: SupportedAggregates) => boolean; | ||
export declare const isSupportedTimeTruncFunction: (supportedTimeFunctions: SupportedTimeTruncFunctions, proposedFunction: string) => boolean; | ||
export declare const ALL_SUPPORTED_CONSTANTS: { | ||
export declare const ALL_SUPPORTED_CONSTANTS: ({ | ||
namespace: string; | ||
constants: SupportedOperators; | ||
}[]; | ||
} | { | ||
namespace: string; | ||
constants: SupportedTimeTruncFunctions; | ||
})[]; | ||
export declare const validOperatorsForField: (field: { | ||
dataType: NormalizedDataType; | ||
}, queryEngineConfig: QueryEngineConfigV1) => string[]; | ||
}, queryEngineConfig: QueryEngineConfig) => string[]; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validOperatorsForField = exports.ALL_SUPPORTED_CONSTANTS = exports.isSupportedTimeTruncFunction = exports.isSupportedAggregate = exports.isSupportedAggregateFunction = exports.supportedFunctions = exports.supportedOperators = void 0; | ||
exports.validOperatorsForField = exports.ALL_SUPPORTED_CONSTANTS = exports.isSupportedTimeTruncFunction = exports.isSupportedAggregate = exports.isSupportedAggregateFunction = exports.supportedAggregates = exports.supportedTimeTruncFunctions = exports.supportedOperators = exports.supportedAggregatesFunction = exports.supportedTransformationFunctions = void 0; | ||
const lodash_1 = require("lodash"); | ||
const constants_1 = require("./constants"); | ||
const vizzlySupportedTransformationFunctions = { | ||
round_to_0_dp: { | ||
publicName: 'Round to 0dp', | ||
validDataTypes: ['number'], | ||
}, | ||
round_to_2_dp: { | ||
publicName: 'Round to 2dp', | ||
validDataTypes: ['number'], | ||
}, | ||
}; | ||
const supportedTransformationFunctions = (keys) => { | ||
const supportedAggregates = (0, lodash_1.cloneDeep)(vizzlySupportedTransformationFunctions); | ||
if (!keys) | ||
return supportedAggregates; | ||
let supportedTimeDimensions = {}; | ||
keys.forEach((key) => { | ||
if (!supportedAggregates[key]) | ||
throw `Transformation function ${key} is not managed by Vizzly`; | ||
supportedTimeDimensions[key] = supportedAggregates[key]; | ||
}); | ||
return supportedTimeDimensions; | ||
}; | ||
exports.supportedTransformationFunctions = supportedTransformationFunctions; | ||
const supportedAggregatesFunction = (queryEngineConfig, dataType, supportedAggregateOptions) => { | ||
const supportedAggregates = queryEngineConfig.supportedAggregates; | ||
// Derive default order from supportedAggregates | ||
const derivedDefaultOrder = Object.keys(supportedAggregates).filter((aggregateId) => supportedAggregates[aggregateId].validDataTypes.includes(dataType)); | ||
// supportedAggregateOptions?.forEach((option) => { | ||
// if (!supportedAggregates.hasOwnProperty(option)) { | ||
// logWarning(`Unsupported aggregate option: ${option} on ${dataType}`); | ||
// } | ||
// }); | ||
// Determine the order of aggregates to use | ||
let orderToUse = supportedAggregateOptions && supportedAggregateOptions.length > 0 | ||
? supportedAggregateOptions.filter((option) => derivedDefaultOrder.includes(option)) | ||
: derivedDefaultOrder; | ||
// If no valid options found in supportedAggregateOptions, use derivedDefaultOrder | ||
if (supportedAggregateOptions && supportedAggregateOptions.length > 0 && orderToUse.length === 0) { | ||
orderToUse = derivedDefaultOrder; | ||
} | ||
// Return the aggregates in the order determined | ||
return orderToUse; | ||
}; | ||
exports.supportedAggregatesFunction = supportedAggregatesFunction; | ||
const supportedOperators = (keys) => { | ||
@@ -19,15 +63,29 @@ const supportedOperators = (0, lodash_1.cloneDeep)(constants_1.supportedOperatorsConstants); | ||
exports.supportedOperators = supportedOperators; | ||
const supportedFunctions = (keys) => { | ||
const allSupportedFunctions = (0, lodash_1.cloneDeep)(constants_1.SUPPORTED_FUNCTIONS); | ||
const supportedTimeTruncFunctions = (keys) => { | ||
const supportedAggregates = (0, lodash_1.cloneDeep)(constants_1.timeDimensionsConstants); | ||
if (!keys) | ||
return allSupportedFunctions; | ||
let supportedFunctions = {}; | ||
return supportedAggregates; | ||
let supportedTimeDimensions = {}; | ||
keys.forEach((key) => { | ||
if (!allSupportedFunctions[key]) | ||
if (!supportedAggregates[key]) | ||
throw `Time trunc function ${key} not managed by Vizzly`; | ||
supportedFunctions[key] = allSupportedFunctions[key]; | ||
supportedTimeDimensions[key] = supportedAggregates[key]; | ||
}); | ||
return supportedFunctions; | ||
return supportedTimeDimensions; | ||
}; | ||
exports.supportedFunctions = supportedFunctions; | ||
exports.supportedTimeTruncFunctions = supportedTimeTruncFunctions; | ||
// Aggregates supported by the Vizzly query engine. | ||
const supportedAggregates = (keys) => { | ||
const supportedAggregates = (0, lodash_1.cloneDeep)(constants_1.supportedAggregatesConstants); | ||
if (!keys) | ||
return supportedAggregates; | ||
let supportedAggregatesSubset = {}; | ||
keys.forEach((key) => { | ||
if (!supportedAggregates[key]) | ||
throw `Aggregate ${key} not managed by Vizzly`; | ||
supportedAggregatesSubset[key] = supportedAggregates[key]; | ||
}); | ||
return supportedAggregatesSubset; | ||
}; | ||
exports.supportedAggregates = supportedAggregates; | ||
const isSupportedAggregateFunction = (supportedAggregateFunctions, proposedFunction) => { | ||
@@ -50,4 +108,4 @@ return [...Object.keys(supportedAggregateFunctions), 'none'].includes(proposedFunction); | ||
{ namespace: 'config.supported_operator', constants: constants_1.supportedOperatorsConstants }, | ||
// { namespace: 'config.supported_aggregate', constants: supportedAggregatesConstants }, | ||
// { namespace: 'config.supported_time', constants: timeDimensionsConstants }, | ||
{ namespace: 'config.supported_aggregate', constants: constants_1.supportedAggregatesConstants }, | ||
{ namespace: 'config.supported_time', constants: constants_1.timeDimensionsConstants }, | ||
]; | ||
@@ -54,0 +112,0 @@ const validOperatorsForField = (field, queryEngineConfig) => { |
import { NormalizedDataType } from '@vizzly/sqlbuilder-public'; | ||
export type SupportedFeature = 'subquery' | 'simpleMaths' | 'aggregateMaths' | 'switchField' | 'configManagerUi' | 'roundedNumbers' | 'sqlDefinedDataSet' | 'encryptedDashboards' | 'sqlViews' | 'dateMaths'; | ||
/** @deprecated use QueryEngineConfigV1 instead.*/ | ||
export type QueryEngineConfig = { | ||
@@ -12,15 +11,2 @@ origin?: 'in-browser' | 'query-engine' | 'custom'; | ||
}; | ||
export type QueryEngineConfigV1 = { | ||
version: 1; | ||
origin?: 'in-browser' | 'query-engine' | 'custom'; | ||
supportedFeatures: SupportedFeature[]; | ||
supportedOperators: SupportedOperators; | ||
supportedFunctions: { | ||
[id: string]: { | ||
useFor: Array<'aggregate' | 'transform'>; | ||
inputDataTypes: Array<NormalizedDataType>; | ||
outputDataType: NormalizedDataType; | ||
}; | ||
}; | ||
}; | ||
export type QueryEngineEndpoint = string | { | ||
@@ -33,3 +19,2 @@ endpoint: string; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedFunction = { | ||
@@ -39,7 +24,5 @@ publicName: string; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedTransformationFunctions = { | ||
[id: string]: SupportedFunction; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedTimeTruncFunction = { | ||
@@ -54,3 +37,2 @@ publicName: string; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedTimeTruncFunctions = { | ||
@@ -66,5 +48,3 @@ [key: string]: SupportedTimeTruncFunction; | ||
}; | ||
/** @deprecated */ | ||
export type DateTimeFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'DD-MM-YYYY' | 'MM-DD-YYYY' | 'DD MMMM YYYY, hh:mm' | 'dddd DD MMMM YYYY, hh:mm' | 'hh:mm' | 'hh:mm:ss' | 'DD MMMM YYYY' | 'MMMM YYYY' | 'YYYY' | 'YYYY-MM-DD[T]HH:mm:ss' | 'quarter' | 'week'; | ||
/** @deprecated */ | ||
export type SupportedAggregate = { | ||
@@ -74,9 +54,6 @@ publicName: string; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedAggregates = { | ||
[id: string]: SupportedAggregate; | ||
}; | ||
/** @deprecated */ | ||
export type SupportedAggregateOption = string; | ||
/** @deprecated */ | ||
export type SupportedTimeFunctions = 'minute' | 'hour' | 'second' | 'week' | 'quarter' | 'year' | 'month' | 'day' | 'dayOfMonthOnly' | 'dayOfWeekOnly' | 'hourOfDayOnly' | 'weekOfYearOnly'; |
{ | ||
"name": "@vizzly/semantic-layer-public", | ||
"version": "0.0.205-rc-2", | ||
"version": "0.0.205", | ||
"source": "src/index.ts", | ||
@@ -27,7 +27,7 @@ "main": "dist/index.js", | ||
"uuid": "^9.0.1", | ||
"@vizzly/sqlbuilder-public": "0.1.15" | ||
"@vizzly/sqlbuilder-public": "0.1.16" | ||
}, | ||
"peerDependencies": { | ||
"@vizzly/sqlbuilder-public": "0.1.15" | ||
"@vizzly/sqlbuilder-public": "0.1.16" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70861
51
1852