@sisense/sdk-data
Advanced tools
@@ -176,4 +176,14 @@ import { DimensionalElement } from '../base.js'; | ||
| /** | ||
| * Defines the JAQL data type of the calculated dimension (e.g. `text`, `numeric`, `datetime`). | ||
| * | ||
| * The analytical engine reads this from the element to resolve the formula's result type, so it | ||
| * must be preserved on the JAQL when present (e.g. for a calculated-dimension filter created in | ||
| * Fusion). | ||
| * | ||
| * @internal | ||
| */ | ||
| readonly dataType?: string; | ||
| /** | ||
| * @internal | ||
| */ | ||
| readonly panel?: string; | ||
@@ -189,3 +199,3 @@ /** | ||
| protected _sort: Sort; | ||
| constructor(name: string, expression: string, context: AttributeContext, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string, indexed?: boolean, merged?: boolean, title?: string); | ||
| constructor(name: string, expression: string, context: AttributeContext, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string, indexed?: boolean, merged?: boolean, title?: string, dataType?: string); | ||
| /** | ||
@@ -192,0 +202,0 @@ * gets the element's ID |
@@ -409,3 +409,3 @@ "use strict"; | ||
| class DimensionalCalculatedAttribute extends base_js_1.DimensionalElement { | ||
| constructor(name, expression, context, desc, sort, dataSource, composeCode, panel, indexed, merged, title) { | ||
| constructor(name, expression, context, desc, sort, dataSource, composeCode, panel, indexed, merged, title, dataType) { | ||
| super(name, types_js_1.MetadataTypes.CalculatedAttribute, desc, dataSource, composeCode, title); | ||
@@ -419,2 +419,3 @@ /** | ||
| this.context = context; | ||
| this.dataType = dataType; | ||
| this._sort = sort || types_js_1.Sort.None; | ||
@@ -449,3 +450,3 @@ // panel is not needed in most cases, this is to support break by columns functionality | ||
| sort(sort) { | ||
| return new DimensionalCalculatedAttribute(this.name, this.expression, this.context, this.description, sort, this.dataSource, this.composeCode, this.panel, this.indexed, this.merged, this.title); | ||
| return new DimensionalCalculatedAttribute(this.name, this.expression, this.context, this.description, sort, this.dataSource, this.composeCode, this.panel, this.indexed, this.merged, this.title, this.dataType); | ||
| } | ||
@@ -469,2 +470,5 @@ /** | ||
| } | ||
| if (this.dataType) { | ||
| result.datatype = this.dataType; | ||
| } | ||
| return result; | ||
@@ -521,2 +525,7 @@ } | ||
| }; | ||
| // The analytical engine resolves a formula element's result type from its `datatype`; preserve | ||
| // it so calculated-dimension filters/queries don't fail element data-type extraction. | ||
| if (this.dataType) { | ||
| result.jaql.datatype = this.dataType; | ||
| } | ||
| if (this.panel) { | ||
@@ -591,3 +600,3 @@ result.panel = this.panel; | ||
| }); | ||
| return new DimensionalCalculatedAttribute(name, expression, context, desc, sort, json.dataSource, undefined, json.panel, json.indexed, json.merged, title); | ||
| return new DimensionalCalculatedAttribute(name, expression, context, desc, sort, json.dataSource, undefined, json.panel, json.indexed, json.merged, title, json.datatype); | ||
| } | ||
@@ -594,0 +603,0 @@ /** |
@@ -13,2 +13,23 @@ "use strict"; | ||
| /** | ||
| * Checks whether a property is defined anywhere on an object's prototype chain | ||
| * (as a data or accessor property), regardless of its current value. Used to | ||
| * detect reserved instance members (e.g. getters) before attaching a child | ||
| * attribute/dimension under the same name. | ||
| * | ||
| * @param obj - The object whose prototype chain is inspected. | ||
| * @param propName - The property name to look for. | ||
| * @returns True when the property is defined on the prototype chain, otherwise false. | ||
| * @internal | ||
| */ | ||
| const isDefinedOnPrototypeChain = (obj, propName) => { | ||
| let proto = Object.getPrototypeOf(obj); | ||
| while (proto !== null) { | ||
| if (Object.getOwnPropertyDescriptor(proto, propName) !== undefined) { | ||
| return true; | ||
| } | ||
| proto = Object.getPrototypeOf(proto); | ||
| } | ||
| return false; | ||
| }; | ||
| /** | ||
| * Represents a Dimension in a Dimensional Model | ||
@@ -63,2 +84,7 @@ * | ||
| Object.getOwnPropertyDescriptor(this, normalizedName) !== undefined || | ||
| // Catch accessor/data members inherited from the prototype (e.g. the | ||
| // `dataSource`/`attributes`/`dimensions` getters). These may still read as | ||
| // `undefined` while the instance is being constructed, so an own-value | ||
| // check alone would let the name through and clobber a getter-only member. | ||
| isDefinedOnPrototypeChain(this, normalizedName) || | ||
| this[normalizedName] !== undefined) { | ||
@@ -65,0 +91,0 @@ result = expression; |
@@ -48,2 +48,29 @@ "use strict"; | ||
| /** | ||
| * Keys that `createDimension` reads directly from its config object. | ||
| * An attribute stored under any of these keys would be mistaken for a reserved | ||
| * dimension property (e.g. a column named "title" would overwrite the dimension's | ||
| * title with an attribute object). Such attributes are keyed by their unique | ||
| * expression instead to avoid the collision. | ||
| * | ||
| * @internal | ||
| */ | ||
| const RESERVED_DIMENSION_CONFIG_KEYS = new Set([ | ||
| 'id', | ||
| 'name', | ||
| 'title', | ||
| 'desc', | ||
| 'description', | ||
| 'expression', | ||
| 'dim', | ||
| 'dimtype', | ||
| 'type', | ||
| 'sort', | ||
| 'dataSource', | ||
| 'indexed', | ||
| 'merged', | ||
| 'attributes', | ||
| 'dimensions', | ||
| 'defaultAttribute', | ||
| ]); | ||
| /** | ||
| * Groups an array of attribute entries by their dimension name. | ||
@@ -59,6 +86,7 @@ * Returns an object whose keys are dimension names and values are configuration objects | ||
| }; | ||
| const safeAttributeName = ['id', 'name', 'expression'].includes(attribute.name) | ||
| const normalizedName = (0, base_js_1.normalizeName)(attribute.name); | ||
| const safeAttributeName = RESERVED_DIMENSION_CONFIG_KEYS.has(normalizedName) | ||
| ? attribute.expression | ||
| : (0, base_js_1.normalizeName)(attribute.name); | ||
| : normalizedName; | ||
| return Object.assign(Object.assign({}, acc), { [dimension.name]: Object.assign(Object.assign({}, dimensionConfig), { [safeAttributeName]: attribute }) }); | ||
| }, {}); |
@@ -182,7 +182,2 @@ "use strict"; | ||
| static checkAttributeSupport(attribute) { | ||
| // Calculated attributes cannot be used as a filter's source | ||
| // attribute — Fusion does not support filtering on a formula-based dimension. | ||
| if (types_js_1.MetadataTypes.isCalculatedAttribute(attribute)) { | ||
| throw new translatable_error_js_1.TranslatableError('errors.filter.unsupportedCalculatedAttribute'); | ||
| } | ||
| const { granularity } = attribute; | ||
@@ -189,0 +184,0 @@ if (granularity === types_js_1.DateLevels.Hours || |
@@ -27,3 +27,4 @@ "use strict"; | ||
| exports.createFilterFromJaqlInternal = exports.createFilterFromCustomFilterJaql = exports.createFilterFromPeriodFilterJaql = exports.createFilterFromNumericRangeJaql = exports.createFilterFromDateRangeFilterJaql = exports.createFilterFromSpecificItemsFilterJaql = exports.createFilterIncludeAll = exports.createGenericFilter = void 0; | ||
| const translatable_error_js_1 = require("../../../translation/translatable-error.js"); | ||
| const attributes_js_1 = require("../../attributes/attributes.js"); | ||
| const types_js_1 = require("../../types.js"); | ||
| const filterFactory = __importStar(require("../factory.js")); | ||
@@ -34,3 +35,3 @@ const filter_config_utils_js_1 = require("../filter-config-utils.js"); | ||
| const filter_types_util_js_1 = require("./filter-types-util.js"); | ||
| const types_js_1 = require("./types.js"); | ||
| const types_js_2 = require("./types.js"); | ||
| /** | ||
@@ -168,22 +169,22 @@ * Creates a generic filter (aka pass-through JAQL filter) if the JAQL cannot be translated to a specific filter type. | ||
| const createFilterFromJaqlInternal = (jaql, guid) => { | ||
| var _a, _b; | ||
| try { | ||
| if ('formula' in jaql) { | ||
| // generic pass-through JAQL filter will be used instead | ||
| throw new translatable_error_js_1.TranslatableError('errors.filter.formulaFiltersNotSupported', { | ||
| filter: JSON.stringify(jaql), | ||
| attributeName: (_b = (_a = jaql.title) !== null && _a !== void 0 ? _a : jaql.column) !== null && _b !== void 0 ? _b : jaql.dim, | ||
| }); | ||
| } | ||
| // A calculated dimension (CD) filter is identified by its formula + context | ||
| // rather than a `dim`. It is deserialized into a first-class filter backed by a | ||
| // calculated attribute and routed through the same filter-type handling below. | ||
| const isCalculatedDimension = types_js_1.MetadataTypes.isCalculatedAttribute(jaql); | ||
| const filterJaqlWrapperWithType = (0, filter_types_util_js_1.extractFilterTypeFromFilterJaql)(jaql, jaql.datatype); | ||
| const { filter: filterJaqlWithType } = filterJaqlWrapperWithType; | ||
| const { filterType } = filterJaqlWithType; | ||
| const attribute = (0, attribute_measure_util_js_1.createAttributeFromFilterJaql)(jaql); | ||
| const measure = (0, attribute_measure_util_js_1.createMeasureFromFilterJaql)(jaql); | ||
| const attribute = isCalculatedDimension | ||
| ? (0, attributes_js_1.createCalculatedAttribute)(jaql) | ||
| : (0, attribute_measure_util_js_1.createAttributeFromFilterJaql)(jaql); | ||
| // A CD filter always filters on its attribute, never on a measure, so skip | ||
| // measure detection to route conditions through the attribute filter path. | ||
| const measure = isCalculatedDimension ? undefined : (0, attribute_measure_util_js_1.createMeasureFromFilterJaql)(jaql); | ||
| switch (filterType) { | ||
| case types_js_1.FILTER_TYPES.INCLUDE_ALL: | ||
| case types_js_2.FILTER_TYPES.INCLUDE_ALL: | ||
| return (0, exports.createFilterIncludeAll)(attribute, guid); | ||
| case types_js_1.FILTER_TYPES.SPECIFIC_ITEMS: | ||
| case types_js_2.FILTER_TYPES.SPECIFIC_ITEMS: | ||
| return (0, exports.createFilterFromSpecificItemsFilterJaql)(attribute, filterJaqlWithType, guid, filterJaqlWithType.multiSelection); | ||
| case types_js_1.FILTER_TYPES.CONDITION: | ||
| case types_js_2.FILTER_TYPES.CONDITION: | ||
| if (measure) { | ||
@@ -195,11 +196,11 @@ return (0, condition_filter_util_js_1.createMeasureFilterFromConditionFilterJaql)(measure, filterJaqlWithType, guid); | ||
| } | ||
| case types_js_1.FILTER_TYPES.DATE_RANGE: | ||
| case types_js_2.FILTER_TYPES.DATE_RANGE: | ||
| return (0, exports.createFilterFromDateRangeFilterJaql)(attribute, filterJaqlWithType, guid); | ||
| case types_js_1.FILTER_TYPES.PERIOD: | ||
| case types_js_2.FILTER_TYPES.PERIOD: | ||
| return (0, exports.createFilterFromPeriodFilterJaql)(attribute, filterJaqlWithType, guid); | ||
| case types_js_1.FILTER_TYPES.NUMERIC_RANGE: | ||
| case types_js_2.FILTER_TYPES.NUMERIC_RANGE: | ||
| return (0, exports.createFilterFromNumericRangeJaql)(attribute, filterJaqlWithType, guid); | ||
| case types_js_1.FILTER_TYPES.ADVANCED: | ||
| case types_js_2.FILTER_TYPES.ADVANCED: | ||
| return (0, exports.createFilterFromCustomFilterJaql)(attribute, filterJaqlWithType, guid); | ||
| case types_js_1.FILTER_TYPES.INVALID: | ||
| case types_js_2.FILTER_TYPES.INVALID: | ||
| return (0, exports.createGenericFilter)(jaql, guid); | ||
@@ -206,0 +207,0 @@ } |
@@ -9,2 +9,5 @@ "use strict"; | ||
| const isInteger = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -33,2 +36,5 @@ '__int4', | ||
| const isDecimal = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -63,2 +69,5 @@ 'basemeasure', | ||
| const isText = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -88,2 +97,5 @@ 'textdimension', | ||
| const isDatetime = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -116,2 +128,5 @@ 'datelevel', | ||
| const isBoolean = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return ['bool', 'boolean', 'bit', 'logical'].includes(type.toLowerCase()); | ||
@@ -118,0 +133,0 @@ }; |
@@ -23,6 +23,4 @@ /** | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -29,0 +27,0 @@ }; |
@@ -26,6 +26,4 @@ "use strict"; | ||
| unsupportedDatetimeLevel: 'Filters do not support the following "datetime" levels: Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds', | ||
| unsupportedCalculatedAttribute: 'Filters are not supported on calculated attributes', | ||
| membersFilterNullMember: 'MembersFilter of {{attributeId}} - member cannot be null', | ||
| unsupportedConditionFilter: 'Jaql for {{attributeName}} contains unsupported condition filter: {{filter}}', | ||
| formulaFiltersNotSupported: 'Formula-based filter for {{attributeName}} not supported yet: {{filter}}', | ||
| unexpectedFilterRelationsModelNode: 'Unexpected filter relations model node: {{node}}', | ||
@@ -32,0 +30,0 @@ }, |
@@ -30,6 +30,4 @@ import { TranslationDictionary } from './en.js'; | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -59,6 +57,4 @@ }; | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -65,0 +61,0 @@ }; |
@@ -26,6 +26,4 @@ "use strict"; | ||
| unsupportedDatetimeLevel: 'Фільтри не підтримують наступні рівні "datetime": Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds', | ||
| unsupportedCalculatedAttribute: 'Фільтри не підтримуються для обчислюваних атрибутів', | ||
| membersFilterNullMember: 'MembersFilter у {{attributeId}} - member не може бути нульовим', | ||
| unsupportedConditionFilter: 'Jaql для {{attributeName}} містить непідтримуваний condition фільтр: {{filter}}', | ||
| formulaFiltersNotSupported: 'Фільтри, що містять формули для {{attributeName}} наразі не підтримуються: {{filter}}', | ||
| unexpectedFilterRelationsModelNode: 'Неочікуваний вузол моделі зв’язків фільтрів: {{node}}', | ||
@@ -32,0 +30,0 @@ }, |
@@ -176,4 +176,14 @@ import { DimensionalElement } from '../base.js'; | ||
| /** | ||
| * Defines the JAQL data type of the calculated dimension (e.g. `text`, `numeric`, `datetime`). | ||
| * | ||
| * The analytical engine reads this from the element to resolve the formula's result type, so it | ||
| * must be preserved on the JAQL when present (e.g. for a calculated-dimension filter created in | ||
| * Fusion). | ||
| * | ||
| * @internal | ||
| */ | ||
| readonly dataType?: string; | ||
| /** | ||
| * @internal | ||
| */ | ||
| readonly panel?: string; | ||
@@ -189,3 +199,3 @@ /** | ||
| protected _sort: Sort; | ||
| constructor(name: string, expression: string, context: AttributeContext, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string, indexed?: boolean, merged?: boolean, title?: string); | ||
| constructor(name: string, expression: string, context: AttributeContext, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string, indexed?: boolean, merged?: boolean, title?: string, dataType?: string); | ||
| /** | ||
@@ -192,0 +202,0 @@ * gets the element's ID |
@@ -397,3 +397,3 @@ /* eslint-disable max-params */ | ||
| export class DimensionalCalculatedAttribute extends DimensionalElement { | ||
| constructor(name, expression, context, desc, sort, dataSource, composeCode, panel, indexed, merged, title) { | ||
| constructor(name, expression, context, desc, sort, dataSource, composeCode, panel, indexed, merged, title, dataType) { | ||
| super(name, MetadataTypes.CalculatedAttribute, desc, dataSource, composeCode, title); | ||
@@ -407,2 +407,3 @@ /** | ||
| this.context = context; | ||
| this.dataType = dataType; | ||
| this._sort = sort || Sort.None; | ||
@@ -437,3 +438,3 @@ // panel is not needed in most cases, this is to support break by columns functionality | ||
| sort(sort) { | ||
| return new DimensionalCalculatedAttribute(this.name, this.expression, this.context, this.description, sort, this.dataSource, this.composeCode, this.panel, this.indexed, this.merged, this.title); | ||
| return new DimensionalCalculatedAttribute(this.name, this.expression, this.context, this.description, sort, this.dataSource, this.composeCode, this.panel, this.indexed, this.merged, this.title, this.dataType); | ||
| } | ||
@@ -457,2 +458,5 @@ /** | ||
| } | ||
| if (this.dataType) { | ||
| result.datatype = this.dataType; | ||
| } | ||
| return result; | ||
@@ -509,2 +513,7 @@ } | ||
| }; | ||
| // The analytical engine resolves a formula element's result type from its `datatype`; preserve | ||
| // it so calculated-dimension filters/queries don't fail element data-type extraction. | ||
| if (this.dataType) { | ||
| result.jaql.datatype = this.dataType; | ||
| } | ||
| if (this.panel) { | ||
@@ -577,3 +586,3 @@ result.panel = this.panel; | ||
| }); | ||
| return new DimensionalCalculatedAttribute(name, expression, context, desc, sort, json.dataSource, undefined, json.panel, json.indexed, json.merged, title); | ||
| return new DimensionalCalculatedAttribute(name, expression, context, desc, sort, json.dataSource, undefined, json.panel, json.indexed, json.merged, title, json.datatype); | ||
| } | ||
@@ -580,0 +589,0 @@ /** |
@@ -8,2 +8,23 @@ /* eslint-disable sonarjs/no-duplicate-string */ | ||
| /** | ||
| * Checks whether a property is defined anywhere on an object's prototype chain | ||
| * (as a data or accessor property), regardless of its current value. Used to | ||
| * detect reserved instance members (e.g. getters) before attaching a child | ||
| * attribute/dimension under the same name. | ||
| * | ||
| * @param obj - The object whose prototype chain is inspected. | ||
| * @param propName - The property name to look for. | ||
| * @returns True when the property is defined on the prototype chain, otherwise false. | ||
| * @internal | ||
| */ | ||
| const isDefinedOnPrototypeChain = (obj, propName) => { | ||
| let proto = Object.getPrototypeOf(obj); | ||
| while (proto !== null) { | ||
| if (Object.getOwnPropertyDescriptor(proto, propName) !== undefined) { | ||
| return true; | ||
| } | ||
| proto = Object.getPrototypeOf(proto); | ||
| } | ||
| return false; | ||
| }; | ||
| /** | ||
| * Represents a Dimension in a Dimensional Model | ||
@@ -58,2 +79,7 @@ * | ||
| Object.getOwnPropertyDescriptor(this, normalizedName) !== undefined || | ||
| // Catch accessor/data members inherited from the prototype (e.g. the | ||
| // `dataSource`/`attributes`/`dimensions` getters). These may still read as | ||
| // `undefined` while the instance is being constructed, so an own-value | ||
| // check alone would let the name through and clobber a getter-only member. | ||
| isDefinedOnPrototypeChain(this, normalizedName) || | ||
| this[normalizedName] !== undefined) { | ||
@@ -60,0 +86,0 @@ result = expression; |
@@ -45,2 +45,29 @@ import { isDataSourceInfo } from '../../utils.js'; | ||
| /** | ||
| * Keys that `createDimension` reads directly from its config object. | ||
| * An attribute stored under any of these keys would be mistaken for a reserved | ||
| * dimension property (e.g. a column named "title" would overwrite the dimension's | ||
| * title with an attribute object). Such attributes are keyed by their unique | ||
| * expression instead to avoid the collision. | ||
| * | ||
| * @internal | ||
| */ | ||
| const RESERVED_DIMENSION_CONFIG_KEYS = new Set([ | ||
| 'id', | ||
| 'name', | ||
| 'title', | ||
| 'desc', | ||
| 'description', | ||
| 'expression', | ||
| 'dim', | ||
| 'dimtype', | ||
| 'type', | ||
| 'sort', | ||
| 'dataSource', | ||
| 'indexed', | ||
| 'merged', | ||
| 'attributes', | ||
| 'dimensions', | ||
| 'defaultAttribute', | ||
| ]); | ||
| /** | ||
| * Groups an array of attribute entries by their dimension name. | ||
@@ -56,6 +83,7 @@ * Returns an object whose keys are dimension names and values are configuration objects | ||
| }; | ||
| const safeAttributeName = ['id', 'name', 'expression'].includes(attribute.name) | ||
| const normalizedName = normalizeName(attribute.name); | ||
| const safeAttributeName = RESERVED_DIMENSION_CONFIG_KEYS.has(normalizedName) | ||
| ? attribute.expression | ||
| : normalizeName(attribute.name); | ||
| : normalizedName; | ||
| return Object.assign(Object.assign({}, acc), { [dimension.name]: Object.assign(Object.assign({}, dimensionConfig), { [safeAttributeName]: attribute }) }); | ||
| }, {}); |
@@ -163,7 +163,2 @@ /* eslint-disable max-lines */ | ||
| static checkAttributeSupport(attribute) { | ||
| // Calculated attributes cannot be used as a filter's source | ||
| // attribute — Fusion does not support filtering on a formula-based dimension. | ||
| if (MetadataTypes.isCalculatedAttribute(attribute)) { | ||
| throw new TranslatableError('errors.filter.unsupportedCalculatedAttribute'); | ||
| } | ||
| const { granularity } = attribute; | ||
@@ -170,0 +165,0 @@ if (granularity === DateLevels.Hours || |
@@ -1,2 +0,3 @@ | ||
| import { TranslatableError } from '../../../translation/translatable-error.js'; | ||
| import { createCalculatedAttribute } from '../../attributes/attributes.js'; | ||
| import { MetadataTypes } from '../../types.js'; | ||
| import * as filterFactory from '../factory.js'; | ||
@@ -133,16 +134,16 @@ import { getDefaultBaseFilterConfig, simplifyFilterConfig } from '../filter-config-utils.js'; | ||
| export const createFilterFromJaqlInternal = (jaql, guid) => { | ||
| var _a, _b; | ||
| try { | ||
| if ('formula' in jaql) { | ||
| // generic pass-through JAQL filter will be used instead | ||
| throw new TranslatableError('errors.filter.formulaFiltersNotSupported', { | ||
| filter: JSON.stringify(jaql), | ||
| attributeName: (_b = (_a = jaql.title) !== null && _a !== void 0 ? _a : jaql.column) !== null && _b !== void 0 ? _b : jaql.dim, | ||
| }); | ||
| } | ||
| // A calculated dimension (CD) filter is identified by its formula + context | ||
| // rather than a `dim`. It is deserialized into a first-class filter backed by a | ||
| // calculated attribute and routed through the same filter-type handling below. | ||
| const isCalculatedDimension = MetadataTypes.isCalculatedAttribute(jaql); | ||
| const filterJaqlWrapperWithType = extractFilterTypeFromFilterJaql(jaql, jaql.datatype); | ||
| const { filter: filterJaqlWithType } = filterJaqlWrapperWithType; | ||
| const { filterType } = filterJaqlWithType; | ||
| const attribute = createAttributeFromFilterJaql(jaql); | ||
| const measure = createMeasureFromFilterJaql(jaql); | ||
| const attribute = isCalculatedDimension | ||
| ? createCalculatedAttribute(jaql) | ||
| : createAttributeFromFilterJaql(jaql); | ||
| // A CD filter always filters on its attribute, never on a measure, so skip | ||
| // measure detection to route conditions through the attribute filter path. | ||
| const measure = isCalculatedDimension ? undefined : createMeasureFromFilterJaql(jaql); | ||
| switch (filterType) { | ||
@@ -149,0 +150,0 @@ case FILTER_TYPES.INCLUDE_ALL: |
@@ -6,2 +6,5 @@ /** | ||
| export const isInteger = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -29,2 +32,5 @@ '__int4', | ||
| export const isDecimal = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -57,2 +63,5 @@ 'basemeasure', | ||
| export const isText = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -81,2 +90,5 @@ 'textdimension', | ||
| export const isDatetime = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return [ | ||
@@ -108,2 +120,5 @@ 'datelevel', | ||
| export const isBoolean = (type) => { | ||
| if (!type) { | ||
| return false; | ||
| } | ||
| return ['bool', 'boolean', 'bit', 'logical'].includes(type.toLowerCase()); | ||
@@ -110,0 +125,0 @@ }; |
@@ -23,6 +23,4 @@ /** | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -29,0 +27,0 @@ }; |
@@ -23,6 +23,4 @@ /** | ||
| unsupportedDatetimeLevel: 'Filters do not support the following "datetime" levels: Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds', | ||
| unsupportedCalculatedAttribute: 'Filters are not supported on calculated attributes', | ||
| membersFilterNullMember: 'MembersFilter of {{attributeId}} - member cannot be null', | ||
| unsupportedConditionFilter: 'Jaql for {{attributeName}} contains unsupported condition filter: {{filter}}', | ||
| formulaFiltersNotSupported: 'Formula-based filter for {{attributeName}} not supported yet: {{filter}}', | ||
| unexpectedFilterRelationsModelNode: 'Unexpected filter relations model node: {{node}}', | ||
@@ -29,0 +27,0 @@ }, |
@@ -30,6 +30,4 @@ import { TranslationDictionary } from './en.js'; | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -59,6 +57,4 @@ }; | ||
| unsupportedDatetimeLevel: string; | ||
| unsupportedCalculatedAttribute: string; | ||
| membersFilterNullMember: string; | ||
| unsupportedConditionFilter: string; | ||
| formulaFiltersNotSupported: string; | ||
| unexpectedFilterRelationsModelNode: string; | ||
@@ -65,0 +61,0 @@ }; |
@@ -23,6 +23,4 @@ /** | ||
| unsupportedDatetimeLevel: 'Фільтри не підтримують наступні рівні "datetime": Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds', | ||
| unsupportedCalculatedAttribute: 'Фільтри не підтримуються для обчислюваних атрибутів', | ||
| membersFilterNullMember: 'MembersFilter у {{attributeId}} - member не може бути нульовим', | ||
| unsupportedConditionFilter: 'Jaql для {{attributeName}} містить непідтримуваний condition фільтр: {{filter}}', | ||
| formulaFiltersNotSupported: 'Фільтри, що містять формули для {{attributeName}} наразі не підтримуються: {{filter}}', | ||
| unexpectedFilterRelationsModelNode: 'Неочікуваний вузол моделі зв’язків фільтрів: {{node}}', | ||
@@ -29,0 +27,0 @@ }, |
+2
-2
@@ -14,3 +14,3 @@ { | ||
| ], | ||
| "version": "2.31.1", | ||
| "version": "2.32.0", | ||
| "type": "module", | ||
@@ -31,3 +31,3 @@ "main": "./dist/cjs/index.js", | ||
| "dependencies": { | ||
| "@sisense/sdk-common": "2.31.1", | ||
| "@sisense/sdk-common": "2.32.0", | ||
| "hash-it": "^6.0.0", | ||
@@ -34,0 +34,0 @@ "lodash-es": "^4.17.21" |
Sorry, the diff of this file is not supported yet
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
1339333
0.31%33543
0.44%+ Added
- Removed
Updated