@sisense/sdk-data 1.32.0 → 1.34.0
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.
- package/dist/cjs/dimensional-model/attributes.d.ts +10 -3
- package/dist/cjs/dimensional-model/attributes.js +18 -5
- package/dist/cjs/dimensional-model/data-model.d.ts +1 -1
- package/dist/cjs/dimensional-model/data-model.js +1 -1
- package/dist/cjs/dimensional-model/dimensions/dimensions.d.ts +2 -2
- package/dist/cjs/dimensional-model/dimensions/dimensions.js +9 -1
- package/dist/cjs/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/cjs/dimensional-model/dimensions/utils.js +5 -1
- package/dist/cjs/dimensional-model/factory.js +5 -5
- package/dist/cjs/dimensional-model/filters/factory.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/cjs/dimensional-model/filters/filter-relations.js +12 -2
- package/dist/cjs/dimensional-model/filters/filters.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/filters.js +4 -4
- package/dist/cjs/dimensional-model/filters/helpers.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/helpers.js +2 -2
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +6 -6
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +4 -4
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -5
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/cjs/dimensional-model/interfaces.d.ts +9 -1
- package/dist/cjs/dimensional-model/jaql-element.js +1 -1
- package/dist/cjs/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/cjs/dimensional-model/measures/factory.js +4 -4
- package/dist/cjs/dimensional-model/measures/measures.d.ts +2 -2
- package/dist/cjs/dimensional-model/measures/measures.js +4 -4
- package/dist/cjs/dimensional-model/types.d.ts +17 -15
- package/dist/cjs/index.d.ts +7 -7
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/utils.d.ts +24 -8
- package/dist/cjs/utils.js +44 -13
- package/dist/dimensional-model/attributes.d.ts +10 -3
- package/dist/dimensional-model/attributes.js +18 -5
- package/dist/dimensional-model/data-model.d.ts +1 -1
- package/dist/dimensional-model/data-model.js +1 -1
- package/dist/dimensional-model/dimensions/dimensions.d.ts +2 -2
- package/dist/dimensional-model/dimensions/dimensions.js +9 -1
- package/dist/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/dimensional-model/dimensions/utils.js +6 -2
- package/dist/dimensional-model/factory.js +5 -5
- package/dist/dimensional-model/filters/factory.d.ts +1 -1
- package/dist/dimensional-model/filters/factory.js +1 -1
- package/dist/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/dimensional-model/filters/filter-relations.js +12 -2
- package/dist/dimensional-model/filters/filters.d.ts +1 -1
- package/dist/dimensional-model/filters/filters.js +4 -4
- package/dist/dimensional-model/filters/helpers.d.ts +1 -1
- package/dist/dimensional-model/filters/helpers.js +2 -2
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +7 -7
- package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +4 -4
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -5
- package/dist/dimensional-model/filters/utils/filter-types-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/dimensional-model/interfaces.d.ts +9 -1
- package/dist/dimensional-model/jaql-element.js +1 -1
- package/dist/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/dimensional-model/measures/factory.js +4 -4
- package/dist/dimensional-model/measures/measures.d.ts +2 -2
- package/dist/dimensional-model/measures/measures.js +4 -4
- package/dist/dimensional-model/types.d.ts +17 -15
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/translation/initialize-i18n.js +1 -1
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/utils.d.ts +24 -8
- package/dist/utils.js +42 -13
- package/package.json +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, LevelAttribute } from './interfaces.js';
|
|
2
|
-
import { Sort, JaqlDataSource } from './types.js';
|
|
3
1
|
import { DimensionalElement } from './base.js';
|
|
2
|
+
import { Attribute, LevelAttribute } from './interfaces.js';
|
|
3
|
+
import { DateLevel, JaqlDataSource, Sort } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -79,6 +79,13 @@ export declare class DimensionalLevelAttribute extends DimensionalAttribute impl
|
|
|
79
79
|
* @returns An instance representing the formatted {@link LevelAttribute} of this instance
|
|
80
80
|
*/
|
|
81
81
|
format(format: string): LevelAttribute;
|
|
82
|
+
/**
|
|
83
|
+
* Gets a {@link LevelAttribute} with the given granularity
|
|
84
|
+
*
|
|
85
|
+
* @param granularity - Date granularity
|
|
86
|
+
* @returns New instance representing {@link LevelAttribute} with provided granularity
|
|
87
|
+
*/
|
|
88
|
+
setGranularity(granularity: DateLevel): LevelAttribute;
|
|
82
89
|
/**
|
|
83
90
|
* Gets a serializable representation of the element
|
|
84
91
|
*/
|
|
@@ -138,4 +145,4 @@ export declare function createLevel(json: any): LevelAttribute;
|
|
|
138
145
|
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
139
146
|
* @internal
|
|
140
147
|
*/
|
|
141
|
-
export declare function normalizeAttributeName(tableName: string, columnName: string,
|
|
148
|
+
export declare function normalizeAttributeName(tableName: string, columnName: string, granularity?: string, modelName?: string): string;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeAttributeName = exports.createLevel = exports.createAttribute = exports.DimensionalLevelAttribute = exports.DimensionalAttribute = exports.jaqlSimpleColumnType = void 0;
|
|
4
|
-
|
|
4
|
+
/* eslint-disable max-params */
|
|
5
|
+
/* eslint-disable no-underscore-dangle */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
9
|
+
/* eslint-disable sonarjs/no-nested-switch */
|
|
5
10
|
const base_js_1 = require("./base.js");
|
|
6
11
|
const simple_column_types_js_1 = require("./simple-column-types.js");
|
|
12
|
+
const types_js_1 = require("./types.js");
|
|
7
13
|
/**
|
|
8
14
|
* @internal
|
|
9
15
|
*/
|
|
@@ -139,6 +145,15 @@ class DimensionalLevelAttribute extends DimensionalAttribute {
|
|
|
139
145
|
format(format) {
|
|
140
146
|
return new DimensionalLevelAttribute(this.name, this.expression, this.granularity, format, this.description, this._sort, this.dataSource, this.composeCode);
|
|
141
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Gets a {@link LevelAttribute} with the given granularity
|
|
150
|
+
*
|
|
151
|
+
* @param granularity - Date granularity
|
|
152
|
+
* @returns New instance representing {@link LevelAttribute} with provided granularity
|
|
153
|
+
*/
|
|
154
|
+
setGranularity(granularity) {
|
|
155
|
+
return new DimensionalLevelAttribute(this.name, this.expression, granularity, this._format, this.description, this._sort, this.dataSource, this.composeCode);
|
|
156
|
+
}
|
|
142
157
|
/**
|
|
143
158
|
* Gets a serializable representation of the element
|
|
144
159
|
*/
|
|
@@ -363,13 +378,11 @@ exports.createLevel = createLevel;
|
|
|
363
378
|
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
364
379
|
* @internal
|
|
365
380
|
*/
|
|
366
|
-
function normalizeAttributeName(tableName, columnName,
|
|
381
|
+
function normalizeAttributeName(tableName, columnName, granularity, modelName) {
|
|
367
382
|
return ((modelName && modelName.length > 0 ? modelName + '.' : '') +
|
|
368
383
|
(0, base_js_1.normalizeName)(tableName) +
|
|
369
384
|
'.' +
|
|
370
385
|
(0, base_js_1.normalizeName)(columnName) +
|
|
371
|
-
(
|
|
372
|
-
? '.' + DimensionalLevelAttribute.translateJaqlToGranularity({ level: dateLevel })
|
|
373
|
-
: ''));
|
|
386
|
+
(granularity && granularity.length > 0 ? '.' + granularity : ''));
|
|
374
387
|
}
|
|
375
388
|
exports.normalizeAttributeName = normalizeAttributeName;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DimensionalDataModel = void 0;
|
|
4
|
-
const factory_js_1 = require("./factory.js");
|
|
5
4
|
const translatable_error_js_1 = require("../translation/translatable-error.js");
|
|
5
|
+
const factory_js_1 = require("./factory.js");
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, LevelAttribute, Dimension, DateDimension } from '../interfaces.js';
|
|
2
|
-
import { Sort, JaqlDataSource } from '../types.js';
|
|
3
1
|
import { DimensionalElement } from '../base.js';
|
|
2
|
+
import { Attribute, DateDimension, Dimension, LevelAttribute } from '../interfaces.js';
|
|
3
|
+
import { JaqlDataSource, Sort } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a Dimension in a Dimensional Model
|
|
6
6
|
*
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDateDimension = exports.createDimension = exports.DimensionalDateDimension = exports.DimensionalDimension = void 0;
|
|
4
|
-
|
|
4
|
+
/* eslint-disable max-params */
|
|
5
|
+
/* eslint-disable no-underscore-dangle */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
9
|
+
/* eslint-disable sonarjs/no-duplicate-string */
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
5
12
|
const attributes_js_1 = require("../attributes.js");
|
|
6
13
|
const base_js_1 = require("../base.js");
|
|
14
|
+
const types_js_1 = require("../types.js");
|
|
7
15
|
/**
|
|
8
16
|
* Represents a Dimension in a Dimensional Model
|
|
9
17
|
*
|
|
@@ -3,6 +3,7 @@ import { Dimension } from '../interfaces.js';
|
|
|
3
3
|
import { DataSourceField } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Function to convert data source fields to dimensions.
|
|
6
|
+
*
|
|
6
7
|
* @param fields - The data source fields to convert.
|
|
7
8
|
* @param dataSource - The data source title.
|
|
8
9
|
* @returns - The dimensions created from the data source fields.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDimensionsFromDataSourceFields = void 0;
|
|
4
|
+
const utils_js_1 = require("../../utils.js");
|
|
4
5
|
const attributes_js_1 = require("../attributes.js");
|
|
5
6
|
const dimensions_js_1 = require("./dimensions.js");
|
|
6
7
|
/**
|
|
7
8
|
* Function to convert data source fields to dimensions.
|
|
9
|
+
*
|
|
8
10
|
* @param fields - The data source fields to convert.
|
|
9
11
|
* @param dataSource - The data source title.
|
|
10
12
|
* @returns - The dimensions created from the data source fields.
|
|
@@ -25,7 +27,9 @@ const createAttributeEntry = (field, dataSource) => {
|
|
|
25
27
|
const dimensionName = field.tableTitle || dimensionId;
|
|
26
28
|
const attributeId = field.id;
|
|
27
29
|
const attributeName = field.title || attributeId;
|
|
28
|
-
const dataSourceConfig =
|
|
30
|
+
const dataSourceConfig = (0, utils_js_1.isDataSourceInfo)(dataSource)
|
|
31
|
+
? dataSource
|
|
32
|
+
: { title: dataSource, live: false };
|
|
29
33
|
const attribute = field.dimtype === 'datetime'
|
|
30
34
|
? (0, dimensions_js_1.createDateDimension)({
|
|
31
35
|
name: attributeName,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = exports.createAll = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
-
const types_js_1 = require("./types.js");
|
|
6
|
-
const measures_js_1 = require("./measures/measures.js");
|
|
7
|
-
const filters_js_1 = require("./filters/filters.js");
|
|
8
|
-
const index_js_1 = require("./dimensions/index.js");
|
|
9
|
-
const attributes_js_1 = require("./attributes.js");
|
|
10
5
|
const translatable_error_js_1 = require("../translation/translatable-error.js");
|
|
6
|
+
const attributes_js_1 = require("./attributes.js");
|
|
7
|
+
const index_js_1 = require("./dimensions/index.js");
|
|
8
|
+
const filters_js_1 = require("./filters/filters.js");
|
|
9
|
+
const measures_js_1 = require("./measures/measures.js");
|
|
10
|
+
const types_js_1 = require("./types.js");
|
|
11
11
|
/**
|
|
12
12
|
* Generate an array of dimension model instances out of the given JSON array
|
|
13
13
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Attribute, BaseFilterConfig, BaseMeasure, DateDimension, Filter, FilterRelations, FilterRelationsNode, LevelAttribute, Measure, MembersFilterConfig } from '../interfaces.js';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a filter representing the union of multiple filters on the same attribute. The resulting
|
|
4
4
|
* union filter filters on items that match any of the given filters.
|
|
@@ -11,7 +11,6 @@ export declare function isFilterRelations(filters: Filter[] | FilterRelations |
|
|
|
11
11
|
* Rules of filter relations - logical operators of how filters are related to each other.
|
|
12
12
|
*
|
|
13
13
|
* @internal
|
|
14
|
-
*
|
|
15
14
|
*/
|
|
16
15
|
export declare type FilterRelationsRules = FilterRelationsRule | FilterRelationsRuleNode | null;
|
|
17
16
|
/** @internal */
|
|
@@ -49,6 +48,7 @@ export declare type FilterAction = {
|
|
|
49
48
|
export declare function mergeFiltersOrFilterRelations(sourceFilters?: Filter[] | FilterRelations, targetFilters?: Filter[] | FilterRelations): Filter[] | FilterRelations;
|
|
50
49
|
/**
|
|
51
50
|
* Splits filters or filter relations into filters and relations rules.
|
|
51
|
+
*
|
|
52
52
|
* @internal
|
|
53
53
|
*/
|
|
54
54
|
export declare function splitFiltersAndRelations(filtersOrFilterRelations: Filter[] | FilterRelations | undefined): {
|
|
@@ -57,31 +57,38 @@ export declare function splitFiltersAndRelations(filtersOrFilterRelations: Filte
|
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
59
|
* Returns pure filters array from the given filters or filter relations.
|
|
60
|
+
*
|
|
60
61
|
* @internal
|
|
61
62
|
*/
|
|
62
63
|
export declare function getFiltersArray(filtersOrFilterRelations: Filter[] | FilterRelations | undefined): Filter[];
|
|
63
64
|
/**
|
|
64
65
|
* Combines filters and relations into a single FilterRelations object.
|
|
65
66
|
* If the relations are empty or relations are trivial (single node), the filters are returned as is.
|
|
67
|
+
*
|
|
66
68
|
* @internal
|
|
67
69
|
*/
|
|
68
70
|
export declare function combineFiltersAndRelations(filters: Filter[], relations: FilterRelationsRules): Filter[] | FilterRelations;
|
|
69
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Type guard for checking if a node is a single relations node (trivial case when relations are needless).
|
|
73
|
+
*
|
|
70
74
|
* @internal
|
|
71
75
|
*/
|
|
72
76
|
export declare function isTrivialSingleNodeRelations(relations: FilterRelationsRules): relations is FilterRelationsRuleIdNode;
|
|
73
77
|
/**
|
|
74
78
|
* Calculates new relations based on the changes in filters.
|
|
79
|
+
*
|
|
75
80
|
* @internal
|
|
76
81
|
*/
|
|
77
82
|
export declare function calculateNewRelations(prevFilters: Filter[], prevRelations: FilterRelationsRules, newFilters: Filter[]): FilterRelationsRules;
|
|
78
83
|
/**
|
|
79
84
|
* Replaces a filter in the relations tree with a new filter.
|
|
85
|
+
*
|
|
80
86
|
* @internal
|
|
81
87
|
*/
|
|
82
88
|
export declare function getRelationsWithReplacedFilter(relations: FilterRelationsRules, filterToReplace: Filter, newFilter: Filter): FilterRelationsRules;
|
|
83
89
|
/**
|
|
84
90
|
* Converts filter relations model from Fusion to internal CSDK filter relations rules.
|
|
91
|
+
*
|
|
85
92
|
* @internal
|
|
86
93
|
*/
|
|
87
94
|
export declare function convertFilterRelationsModelToRelationRules(filterRelationsModel: FilterRelationsModel | FilterRelationsModelNode | undefined, filters: Filter[]): FilterRelationsRules;
|
|
@@ -95,6 +102,7 @@ export declare function isRelationsRuleIdNode(node: FilterRelationsRuleNode): no
|
|
|
95
102
|
export declare function isRelationsRule(node: FilterRelationsRuleNode): node is FilterRelationsRule;
|
|
96
103
|
/**
|
|
97
104
|
* Converts internal CSDK filter relations rules to filter relations model for Fusion.
|
|
105
|
+
*
|
|
98
106
|
* @internal
|
|
99
107
|
*/
|
|
100
108
|
export declare function filterRelationRulesToFilterRelationsModel(filterRelationRules: FilterRelationsRules, filters: Filter[]): FilterRelationsModel | FilterRelationsModelNode | undefined;
|
|
@@ -104,6 +112,7 @@ export declare function filterRelationRulesToFilterRelationsModel(filterRelation
|
|
|
104
112
|
export declare function findFilterByGuid(filters: Filter[], guid: string): Filter | undefined;
|
|
105
113
|
/**
|
|
106
114
|
* Error thrown when an unknown node type is encountered in filter relations.
|
|
115
|
+
*
|
|
107
116
|
* @internal
|
|
108
117
|
*/
|
|
109
118
|
export declare class UnknownRelationsNodeError extends Error {
|
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.convertFilterRelationsModelToJaql = exports.getFilterRelationsFromJaql = exports.mergeFilters = exports.getFilterCompareId = exports.isOperatorDescriptionNode = exports.isAttributeDescriptionNode = exports.isCloseBracketDescriptionNode = exports.isOpenBracketDescriptionNode = exports.UnknownRelationsNodeError = exports.findFilterByGuid = exports.filterRelationRulesToFilterRelationsModel = exports.isRelationsRule = exports.isRelationsRuleIdNode = exports.convertFilterRelationsModelToRelationRules = exports.getRelationsWithReplacedFilter = exports.calculateNewRelations = exports.isTrivialSingleNodeRelations = exports.combineFiltersAndRelations = exports.getFiltersArray = exports.splitFiltersAndRelations = exports.mergeFiltersOrFilterRelations = exports.isFilterRelations = void 0;
|
|
7
7
|
/* eslint-disable @typescript-eslint/default-param-last */
|
|
8
|
-
const index_js_1 = require("../../index.js");
|
|
9
8
|
const cloneDeep_js_1 = __importDefault(require("lodash-es/cloneDeep.js"));
|
|
10
9
|
const isArray_js_1 = __importDefault(require("lodash-es/isArray.js"));
|
|
10
|
+
const index_js_1 = require("../../index.js");
|
|
11
11
|
const translatable_error_js_1 = require("../../translation/translatable-error.js");
|
|
12
12
|
/**
|
|
13
13
|
* Type guard for checking if the provided filters are FilterRelations.
|
|
@@ -45,6 +45,7 @@ function mergeFiltersOrFilterRelations(sourceFilters = [], targetFilters = []) {
|
|
|
45
45
|
exports.mergeFiltersOrFilterRelations = mergeFiltersOrFilterRelations;
|
|
46
46
|
/**
|
|
47
47
|
* Splits filters or filter relations into filters and relations rules.
|
|
48
|
+
*
|
|
48
49
|
* @internal
|
|
49
50
|
*/
|
|
50
51
|
function splitFiltersAndRelations(filtersOrFilterRelations) {
|
|
@@ -76,6 +77,7 @@ function splitFiltersAndRelations(filtersOrFilterRelations) {
|
|
|
76
77
|
exports.splitFiltersAndRelations = splitFiltersAndRelations;
|
|
77
78
|
/**
|
|
78
79
|
* Returns pure filters array from the given filters or filter relations.
|
|
80
|
+
*
|
|
79
81
|
* @internal
|
|
80
82
|
*/
|
|
81
83
|
function getFiltersArray(filtersOrFilterRelations) {
|
|
@@ -88,6 +90,7 @@ exports.getFiltersArray = getFiltersArray;
|
|
|
88
90
|
/**
|
|
89
91
|
* Combines filters and relations into a single FilterRelations object.
|
|
90
92
|
* If the relations are empty or relations are trivial (single node), the filters are returned as is.
|
|
93
|
+
*
|
|
91
94
|
* @internal
|
|
92
95
|
*/
|
|
93
96
|
function combineFiltersAndRelations(filters, relations) {
|
|
@@ -111,7 +114,9 @@ function combineFiltersAndRelations(filters, relations) {
|
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
exports.combineFiltersAndRelations = combineFiltersAndRelations;
|
|
114
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Type guard for checking if a node is a single relations node (trivial case when relations are needless).
|
|
119
|
+
*
|
|
115
120
|
* @internal
|
|
116
121
|
*/
|
|
117
122
|
function isTrivialSingleNodeRelations(relations) {
|
|
@@ -120,6 +125,7 @@ function isTrivialSingleNodeRelations(relations) {
|
|
|
120
125
|
exports.isTrivialSingleNodeRelations = isTrivialSingleNodeRelations;
|
|
121
126
|
/**
|
|
122
127
|
* Calculates new relations based on the changes in filters.
|
|
128
|
+
*
|
|
123
129
|
* @internal
|
|
124
130
|
*/
|
|
125
131
|
function calculateNewRelations(prevFilters, prevRelations, newFilters) {
|
|
@@ -149,6 +155,7 @@ function areFiltersEqualForRelations(filter1, filter2) {
|
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
157
|
* Replaces a filter in the relations tree with a new filter.
|
|
158
|
+
*
|
|
152
159
|
* @internal
|
|
153
160
|
*/
|
|
154
161
|
function getRelationsWithReplacedFilter(relations, filterToReplace, newFilter) {
|
|
@@ -248,6 +255,7 @@ function removeFilterFromRelations(filter, relations) {
|
|
|
248
255
|
}
|
|
249
256
|
/**
|
|
250
257
|
* Converts filter relations model from Fusion to internal CSDK filter relations rules.
|
|
258
|
+
*
|
|
251
259
|
* @internal
|
|
252
260
|
*/
|
|
253
261
|
function convertFilterRelationsModelToRelationRules(filterRelationsModel, filters) {
|
|
@@ -319,6 +327,7 @@ function isFilterNode(node) {
|
|
|
319
327
|
}
|
|
320
328
|
/**
|
|
321
329
|
* Converts internal CSDK filter relations rules to filter relations model for Fusion.
|
|
330
|
+
*
|
|
322
331
|
* @internal
|
|
323
332
|
*/
|
|
324
333
|
function filterRelationRulesToFilterRelationsModel(filterRelationRules, filters) {
|
|
@@ -373,6 +382,7 @@ function findFilterByGuid(filters, guid) {
|
|
|
373
382
|
exports.findFilterByGuid = findFilterByGuid;
|
|
374
383
|
/**
|
|
375
384
|
* Error thrown when an unknown node type is encountered in filter relations.
|
|
385
|
+
*
|
|
376
386
|
* @internal
|
|
377
387
|
*/
|
|
378
388
|
class UnknownRelationsNodeError extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LevelAttribute, Attribute, Measure, Filter, MembersFilterConfig, CompleteMembersFilterConfig, CompleteBaseFilterConfig, BaseFilterConfig } from '../interfaces.js';
|
|
2
1
|
import { DimensionalElement } from '../base.js';
|
|
2
|
+
import { Attribute, BaseFilterConfig, CompleteBaseFilterConfig, CompleteMembersFilterConfig, Filter, LevelAttribute, Measure, MembersFilterConfig } from '../interfaces.js';
|
|
3
3
|
import { AnyObject } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Different text operators that can be used with text filters
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createFilter = exports.isDateRangeFilter = exports.isTextFilter = exports.isRelativeDateFilter = exports.isCascadingFilter = exports.isLogicalAttributeFilter = exports.isExcludeFilter = exports.isMeasureFilter = exports.isRankingFilter = exports.isNumericFilter = exports.isMembersFilter = exports.isCustomFilter = exports.CustomFilter = exports.RelativeDateFilter = exports.DateRangeFilter = exports.TextFilter = exports.NumericFilter = exports.RankingFilter = exports.MeasureFilter = exports.DoubleOperatorFilter = exports.ExcludeFilter = exports.CascadingFilter = exports.MembersFilter = exports.LogicalAttributeFilter = exports.FilterTypes = exports.RankingOperators = exports.LogicalOperators = exports.DateOperators = exports.NumericOperators = exports.TextOperators = void 0;
|
|
7
7
|
const hash_it_1 = __importDefault(require("hash-it"));
|
|
8
|
+
const merge_js_1 = __importDefault(require("lodash-es/merge.js"));
|
|
9
|
+
const omit_js_1 = __importDefault(require("lodash-es/omit.js"));
|
|
10
|
+
const translatable_error_js_1 = require("../../translation/translatable-error.js");
|
|
8
11
|
const base_js_1 = require("../base.js");
|
|
9
|
-
const types_js_1 = require("../types.js");
|
|
10
12
|
const factory_js_1 = require("../factory.js");
|
|
11
13
|
const measures_js_1 = require("../measures/measures.js");
|
|
12
|
-
const
|
|
14
|
+
const types_js_1 = require("../types.js");
|
|
13
15
|
const filter_config_utils_js_1 = require("./filter-config-utils.js");
|
|
14
|
-
const merge_js_1 = __importDefault(require("lodash-es/merge.js"));
|
|
15
|
-
const omit_js_1 = __importDefault(require("lodash-es/omit.js"));
|
|
16
16
|
/**
|
|
17
17
|
* Different text operators that can be used with text filters
|
|
18
18
|
*
|
|
@@ -103,10 +103,10 @@ export declare function withReplacedFilter(filterToReplace: Filter, newFilter: F
|
|
|
103
103
|
/**
|
|
104
104
|
* Finds a filter in an array of filters or filter relations.
|
|
105
105
|
* Returns the first filter that satisfies the provided search function.
|
|
106
|
+
*
|
|
106
107
|
* @group Filter Utilities
|
|
107
108
|
* @param filters - An array of filters or filter relations to search.
|
|
108
109
|
* @param searchFn - A function that takes a filter and returns a boolean indicating whether the filter satisfies the search criteria.
|
|
109
110
|
* @returns The first filter that satisfies the search function, or `undefined` if no filter is found.
|
|
110
|
-
*
|
|
111
111
|
*/
|
|
112
112
|
export declare function findFilter(filters: Filter[] | FilterRelations | undefined, searchFn: (filter: Filter) => boolean): Filter | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findFilter = exports.withReplacedFilter = exports.withoutFilters = exports.withoutFilter = exports.withAddedFilters = exports.withAddedFilter = void 0;
|
|
4
|
-
const filter_relations_js_1 = require("./filter-relations.js");
|
|
5
4
|
const index_js_1 = require("../../index.js");
|
|
5
|
+
const filter_relations_js_1 = require("./filter-relations.js");
|
|
6
6
|
/**
|
|
7
7
|
* Returns a function that adds a filter to existing filters or filter relations.
|
|
8
8
|
*
|
|
@@ -162,11 +162,11 @@ exports.withReplacedFilter = withReplacedFilter;
|
|
|
162
162
|
/**
|
|
163
163
|
* Finds a filter in an array of filters or filter relations.
|
|
164
164
|
* Returns the first filter that satisfies the provided search function.
|
|
165
|
+
*
|
|
165
166
|
* @group Filter Utilities
|
|
166
167
|
* @param filters - An array of filters or filter relations to search.
|
|
167
168
|
* @param searchFn - A function that takes a filter and returns a boolean indicating whether the filter satisfies the search criteria.
|
|
168
169
|
* @returns The first filter that satisfies the search function, or `undefined` if no filter is found.
|
|
169
|
-
*
|
|
170
170
|
*/
|
|
171
171
|
function findFilter(filters, searchFn) {
|
|
172
172
|
if (!filters) {
|
|
@@ -9,13 +9,13 @@ const utils_js_1 = require("../../../utils.js");
|
|
|
9
9
|
* @returns attribute or level attribute
|
|
10
10
|
*/
|
|
11
11
|
const createAttributeFromFilterJaql = (jaql) => {
|
|
12
|
-
const { dim, table, column,
|
|
12
|
+
const { dim, table, column, datatype, title, datasource: dataSource } = jaql;
|
|
13
13
|
return (0, utils_js_1.createAttributeHelper)({
|
|
14
14
|
dim,
|
|
15
15
|
table,
|
|
16
16
|
column,
|
|
17
17
|
dataType: datatype,
|
|
18
|
-
|
|
18
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
19
19
|
format: undefined,
|
|
20
20
|
sort: undefined,
|
|
21
21
|
title,
|
|
@@ -30,7 +30,7 @@ exports.createAttributeFromFilterJaql = createAttributeFromFilterJaql;
|
|
|
30
30
|
* @returns Measure
|
|
31
31
|
*/
|
|
32
32
|
const createMeasureFromFilterJaql = (jaql) => {
|
|
33
|
-
const { dim, table, column, title,
|
|
33
|
+
const { dim, table, column, title, datatype: dataType, agg, datasource: dataSource } = jaql;
|
|
34
34
|
if (!agg)
|
|
35
35
|
return undefined;
|
|
36
36
|
return (0, utils_js_1.createMeasureHelper)({
|
|
@@ -39,7 +39,7 @@ const createMeasureFromFilterJaql = (jaql) => {
|
|
|
39
39
|
column,
|
|
40
40
|
dataType,
|
|
41
41
|
agg,
|
|
42
|
-
|
|
42
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
43
43
|
format: undefined,
|
|
44
44
|
sort: undefined,
|
|
45
45
|
title,
|
|
@@ -56,12 +56,12 @@ exports.createMeasureFromFilterJaql = createMeasureFromFilterJaql;
|
|
|
56
56
|
const createMeasureFromRankingFilterJaql = (jaql, rankingMessage) => {
|
|
57
57
|
if ('formula' in jaql)
|
|
58
58
|
return (0, utils_js_1.createCalculatedMeasureHelper)(jaql);
|
|
59
|
-
const { dim, table, column,
|
|
59
|
+
const { dim, table, column, datatype: dataType, agg } = jaql;
|
|
60
60
|
return (0, utils_js_1.createMeasureHelper)({
|
|
61
61
|
dim,
|
|
62
62
|
table,
|
|
63
63
|
column,
|
|
64
|
-
|
|
64
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
65
65
|
dataType,
|
|
66
66
|
agg,
|
|
67
67
|
format: undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConditionFilterJaql, ConditionFilterType } from './types.js';
|
|
2
1
|
import { Attribute, BaseMeasure, Filter } from '../../interfaces.js';
|
|
2
|
+
import { ConditionFilterJaql, ConditionFilterType } from './types.js';
|
|
3
3
|
export declare const getSelectedConditionOption: (filter: ConditionFilterJaql) => ConditionFilterType;
|
|
4
4
|
/**
|
|
5
5
|
* Creates an attribute filter from the provided attribute and condition filter JAQL object
|
|
@@ -24,12 +24,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createMeasureFilterFromConditionFilterJaql = exports.createAttributeFilterFromConditionFilterJaql = exports.getSelectedConditionOption = void 0;
|
|
27
|
-
const types_js_1 = require("./types.js");
|
|
28
|
-
const filter_code_util_js_1 = require("./filter-code-util.js");
|
|
29
|
-
const filterFactory = __importStar(require("../factory.js"));
|
|
30
|
-
const attribute_measure_util_js_1 = require("./attribute-measure-util.js");
|
|
31
27
|
const translatable_error_js_1 = require("../../../translation/translatable-error.js");
|
|
28
|
+
const filterFactory = __importStar(require("../factory.js"));
|
|
32
29
|
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
30
|
+
const attribute_measure_util_js_1 = require("./attribute-measure-util.js");
|
|
31
|
+
const filter_code_util_js_1 = require("./filter-code-util.js");
|
|
32
|
+
const types_js_1 = require("./types.js");
|
|
33
33
|
const isTopCondition = (filter) => filter.top !== undefined;
|
|
34
34
|
const isBottomCondition = (filter) => filter.bottom !== undefined;
|
|
35
35
|
const isExcludeCondition = (filter) => { var _a; return !!((_a = filter.exclude) === null || _a === void 0 ? void 0 : _a.members); };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseFilterJaql, FilterJaqlInternal, PeriodFilterJaql, RangeFilterJaql, SpecificItemsFilterJaql } from './types.js';
|
|
2
1
|
import { Attribute, Filter, LevelAttribute } from '../../interfaces.js';
|
|
3
2
|
import { FilterJaql } from '../../types.js';
|
|
3
|
+
import { BaseFilterJaql, FilterJaqlInternal, PeriodFilterJaql, RangeFilterJaql, SpecificItemsFilterJaql } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a generic filter (aka pass-through JAQL filter) if the JAQL cannot be translated to a specific filter type.
|
|
6
6
|
*
|
|
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createFilterFromJaqlInternal = exports.createFilterFromCustomFilterJaql = exports.createFilterFromPeriodFilterJaql = exports.createFilterFromNumericRangeJaql = exports.createFilterFromDateRangeFilterJaql = exports.createFilterFromSpecificItemsFilterJaql = exports.createFilterIncludeAll = exports.createGenericFilter = void 0;
|
|
27
|
-
const
|
|
27
|
+
const translatable_error_js_1 = require("../../../translation/translatable-error.js");
|
|
28
28
|
const filterFactory = __importStar(require("../factory.js"));
|
|
29
|
+
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
30
|
+
const attribute_measure_util_js_1 = require("./attribute-measure-util.js");
|
|
29
31
|
const condition_filter_util_js_1 = require("./condition-filter-util.js");
|
|
30
|
-
const filter_types_util_js_1 = require("./filter-types-util.js");
|
|
31
32
|
const filter_code_util_js_1 = require("./filter-code-util.js");
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
33
|
+
const filter_types_util_js_1 = require("./filter-types-util.js");
|
|
34
|
+
const types_js_1 = require("./types.js");
|
|
35
35
|
/**
|
|
36
36
|
* Creates a generic filter (aka pass-through JAQL filter) if the JAQL cannot be translated to a specific filter type.
|
|
37
37
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyTypeFilterJaql, ConditionFilterJaql, DatetimeLevel, FilterJaqlInternal, FilterJaqlWrapperWithType, FilterModalType, FilterType, SpecificItemsFilterJaql } from './types.js';
|
|
2
2
|
export declare const isSpecificItemsFilter: (filter: AnyTypeFilterJaql) => filter is SpecificItemsFilterJaql;
|
|
3
3
|
export declare const isNumericRangeFilter: (filter: AnyTypeFilterJaql) => boolean;
|
|
4
4
|
export declare const isConditionFilter: (filter: AnyTypeFilterJaql) => filter is ConditionFilterJaql;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFilterTypeFromFilterJaql = exports.getFilterType = exports.isConditionFilter = exports.isNumericRangeFilter = exports.isSpecificItemsFilter = void 0;
|
|
4
4
|
const condition_filter_util_js_1 = require("./condition-filter-util.js");
|
|
5
|
-
const types_js_1 = require("./types.js");
|
|
6
5
|
const date_time_filter_util_js_1 = require("./date-time-filter-util.js");
|
|
6
|
+
const types_js_1 = require("./types.js");
|
|
7
7
|
const isIncludeAllFilter = (filter) => filter === null || filter === void 0 ? void 0 : filter.all;
|
|
8
8
|
const getInnerPeriodFilter = (filter) => (filter.last ? filter.last : filter.next);
|
|
9
9
|
const isPeriodFilter = (filter) => { var _a; return ((_a = getInnerPeriodFilter(filter)) === null || _a === void 0 ? void 0 : _a.offset) < 2; };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataSource } from '../interfaces.js';
|
|
2
|
-
import { FilterJaql, JaqlDataSource, Sort } from './types.js';
|
|
2
|
+
import { DateLevel, FilterJaql, JaqlDataSource, Sort } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -337,6 +337,14 @@ export interface LevelAttribute extends Attribute {
|
|
|
337
337
|
dateTimeLevel?: string;
|
|
338
338
|
bucket?: string;
|
|
339
339
|
};
|
|
340
|
+
/**
|
|
341
|
+
* Gets a {@link LevelAttribute} with the given granularity
|
|
342
|
+
*
|
|
343
|
+
* @param granularity - Date granularity
|
|
344
|
+
* @returns New instance representing {@link LevelAttribute} with provided granularity
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
setGranularity(granularity: DateLevel): LevelAttribute;
|
|
340
348
|
}
|
|
341
349
|
/**
|
|
342
350
|
* Base filter configuration
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createJaqlElement = exports.JaqlElement = void 0;
|
|
4
|
-
const base_js_1 = require("./base.js");
|
|
5
4
|
const utils_js_1 = require("../utils.js");
|
|
5
|
+
const base_js_1 = require("./base.js");
|
|
6
6
|
const types_js_1 = require("./types.js");
|
|
7
7
|
/**
|
|
8
8
|
* This implementation wraps metadata for a JAQL query. The metadata could be
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, Measure, Filter, CalculatedMeasure, BaseMeasure, CustomFormulaContext } from '../interfaces.js';
|
|
2
1
|
import { ForecastFormulaOptions, TrendFormulaOptions } from '../../interfaces.js';
|
|
3
2
|
import { CustomFormulaJaql } from '../filters/utils/types.js';
|
|
3
|
+
import { Attribute, BaseMeasure, CalculatedMeasure, CustomFormulaContext, Filter, Measure } from '../interfaces.js';
|
|
4
4
|
/**
|
|
5
5
|
* Defines the different numeric operators that can be used with numeric filters
|
|
6
6
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rank = exports.forecast = exports.trend = exports.contribution = exports.pastYear = exports.pastQuarter = exports.pastMonth = exports.pastWeek = exports.pastDay = exports.diffPastYear = exports.diffPastQuarter = exports.diffPastMonth = exports.diffPastWeek = exports.difference = exports.growthPastYear = exports.growthPastQuarter = exports.growthPastMonth = exports.growthPastWeek = exports.growthRate = exports.growth = exports.runningSum = exports.weekToDateSum = exports.monthToDateSum = exports.quarterToDateSum = exports.yearToDateSum = exports.divide = exports.multiply = exports.subtract = exports.add = exports.measuredValue = exports.countDistinct = exports.count = exports.median = exports.max = exports.min = exports.avg = exports.average = exports.sum = exports.constant = exports.aggregate = exports.customFormula = exports.transformCustomFormulaJaql = exports.RankingSortTypes = exports.RankingTypes = void 0;
|
|
4
|
-
const measures_js_1 = require("./measures.js");
|
|
5
|
-
const types_js_1 = require("../types.js");
|
|
6
|
-
const base_js_1 = require("../base.js");
|
|
7
|
-
const utils_js_1 = require("../../utils.js");
|
|
8
4
|
const translatable_error_js_1 = require("../../translation/translatable-error.js");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
const base_js_1 = require("../base.js");
|
|
7
|
+
const types_js_1 = require("../types.js");
|
|
8
|
+
const measures_js_1 = require("./measures.js");
|
|
9
9
|
/**
|
|
10
10
|
* Defines the different numeric operators that can be used with numeric filters
|
|
11
11
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, Measure, BaseMeasure, MeasureTemplate, CalculatedMeasure, MeasureContext } from '../interfaces.js';
|
|
2
|
-
import { Sort } from '../types.js';
|
|
3
1
|
import { DimensionalElement } from '../base.js';
|
|
2
|
+
import { Attribute, BaseMeasure, CalculatedMeasure, Measure, MeasureContext, MeasureTemplate } from '../interfaces.js';
|
|
3
|
+
import { Sort } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -31,12 +31,12 @@ exports.createMeasure = exports.DimensionalMeasureTemplate = exports.Dimensional
|
|
|
31
31
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
32
32
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
33
33
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
34
|
-
const
|
|
35
|
-
const types_js_1 = require("../types.js");
|
|
36
|
-
const base_js_1 = require("../base.js");
|
|
34
|
+
const translatable_error_js_1 = require("../../translation/translatable-error.js");
|
|
37
35
|
const attributes_js_1 = require("../attributes.js");
|
|
36
|
+
const base_js_1 = require("../base.js");
|
|
38
37
|
const factory_js_1 = require("../factory.js");
|
|
39
|
-
const
|
|
38
|
+
const types_js_1 = require("../types.js");
|
|
39
|
+
const m = __importStar(require("./factory.js"));
|
|
40
40
|
/**
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|