@sisense/sdk-data 1.33.0 → 2.0.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/analytics/factory.d.ts +10 -10
- package/dist/cjs/dimensional-model/analytics/factory.js +15 -16
- package/dist/cjs/dimensional-model/attributes.d.ts +13 -6
- package/dist/cjs/dimensional-model/attributes.js +39 -12
- package/dist/cjs/dimensional-model/base.d.ts +3 -3
- package/dist/cjs/dimensional-model/base.js +7 -4
- package/dist/cjs/dimensional-model/compose-code-utils.d.ts +41 -0
- package/dist/cjs/dimensional-model/compose-code-utils.js +127 -0
- package/dist/cjs/dimensional-model/consts.d.ts +1 -0
- package/dist/cjs/dimensional-model/consts.js +4 -0
- 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 +6 -6
- package/dist/cjs/dimensional-model/dimensions/dimensions.js +34 -17
- package/dist/cjs/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/cjs/dimensional-model/dimensions/utils.js +2 -1
- package/dist/cjs/dimensional-model/factory.js +5 -5
- package/dist/cjs/dimensional-model/filters/factory.d.ts +42 -42
- package/dist/cjs/dimensional-model/filters/factory.js +53 -168
- package/dist/cjs/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/cjs/dimensional-model/filters/filter-relations.js +14 -7
- package/dist/cjs/dimensional-model/filters/filters.d.ts +40 -24
- package/dist/cjs/dimensional-model/filters/filters.js +106 -56
- 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 +9 -17
- 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 +31 -29
- 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 +13 -19
- 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/filters/utils/types.d.ts +10 -0
- package/dist/cjs/dimensional-model/interfaces.d.ts +17 -7
- package/dist/cjs/dimensional-model/jaql-element.d.ts +13 -1
- package/dist/cjs/dimensional-model/jaql-element.js +54 -2
- package/dist/cjs/dimensional-model/measures/factory.d.ts +46 -53
- package/dist/cjs/dimensional-model/measures/factory.js +57 -186
- package/dist/cjs/dimensional-model/measures/measures.d.ts +10 -10
- package/dist/cjs/dimensional-model/measures/measures.js +35 -33
- package/dist/cjs/dimensional-model/types.d.ts +41 -16
- package/dist/cjs/index.d.ts +7 -7
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/utils.d.ts +45 -22
- package/dist/cjs/utils.js +119 -47
- package/dist/dimensional-model/analytics/factory.d.ts +10 -10
- package/dist/dimensional-model/analytics/factory.js +15 -14
- package/dist/dimensional-model/attributes.d.ts +13 -6
- package/dist/dimensional-model/attributes.js +39 -12
- package/dist/dimensional-model/base.d.ts +3 -3
- package/dist/dimensional-model/base.js +7 -4
- package/dist/dimensional-model/compose-code-utils.d.ts +41 -0
- package/dist/dimensional-model/compose-code-utils.js +119 -0
- package/dist/dimensional-model/consts.d.ts +1 -0
- package/dist/dimensional-model/consts.js +1 -0
- 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 +6 -6
- package/dist/dimensional-model/dimensions/dimensions.js +35 -18
- package/dist/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/dimensional-model/dimensions/utils.js +3 -2
- package/dist/dimensional-model/factory.js +5 -5
- package/dist/dimensional-model/filters/factory.d.ts +42 -42
- package/dist/dimensional-model/filters/factory.js +52 -126
- package/dist/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/dimensional-model/filters/filter-relations.js +14 -7
- package/dist/dimensional-model/filters/filters.d.ts +40 -24
- package/dist/dimensional-model/filters/filters.js +106 -56
- 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 +10 -18
- package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +31 -29
- 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 +13 -19
- 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/filters/utils/types.d.ts +10 -0
- package/dist/dimensional-model/interfaces.d.ts +17 -7
- package/dist/dimensional-model/jaql-element.d.ts +13 -1
- package/dist/dimensional-model/jaql-element.js +52 -1
- package/dist/dimensional-model/measures/factory.d.ts +46 -53
- package/dist/dimensional-model/measures/factory.js +56 -143
- package/dist/dimensional-model/measures/measures.d.ts +10 -10
- package/dist/dimensional-model/measures/measures.js +35 -33
- package/dist/dimensional-model/types.d.ts +41 -16
- 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 +45 -22
- package/dist/utils.js +94 -49
- package/package.json +5 -4
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +0 -17
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +0 -82
- package/dist/dimensional-model/filters/utils/filter-code-util.d.ts +0 -17
- package/dist/dimensional-model/filters/utils/filter-code-util.js +0 -77
|
@@ -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,15 +9,11 @@ const utils_js_1 = require("../../../utils.js");
|
|
|
9
9
|
* @returns attribute or level attribute
|
|
10
10
|
*/
|
|
11
11
|
const createAttributeFromFilterJaql = (jaql) => {
|
|
12
|
-
const { dim,
|
|
12
|
+
const { dim, datatype, title, datasource: dataSource } = jaql;
|
|
13
13
|
return (0, utils_js_1.createAttributeHelper)({
|
|
14
|
-
dim,
|
|
15
|
-
table,
|
|
16
|
-
column,
|
|
14
|
+
expression: dim,
|
|
17
15
|
dataType: datatype,
|
|
18
|
-
|
|
19
|
-
format: undefined,
|
|
20
|
-
sort: undefined,
|
|
16
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
21
17
|
title,
|
|
22
18
|
dataSource,
|
|
23
19
|
});
|
|
@@ -30,16 +26,14 @@ exports.createAttributeFromFilterJaql = createAttributeFromFilterJaql;
|
|
|
30
26
|
* @returns Measure
|
|
31
27
|
*/
|
|
32
28
|
const createMeasureFromFilterJaql = (jaql) => {
|
|
33
|
-
const { dim,
|
|
29
|
+
const { dim, title, datatype: dataType, agg, datasource: dataSource } = jaql;
|
|
34
30
|
if (!agg)
|
|
35
31
|
return undefined;
|
|
36
32
|
return (0, utils_js_1.createMeasureHelper)({
|
|
37
|
-
dim,
|
|
38
|
-
table,
|
|
39
|
-
column,
|
|
33
|
+
expression: dim,
|
|
40
34
|
dataType,
|
|
41
35
|
agg,
|
|
42
|
-
|
|
36
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
43
37
|
format: undefined,
|
|
44
38
|
sort: undefined,
|
|
45
39
|
title,
|
|
@@ -56,12 +50,10 @@ exports.createMeasureFromFilterJaql = createMeasureFromFilterJaql;
|
|
|
56
50
|
const createMeasureFromRankingFilterJaql = (jaql, rankingMessage) => {
|
|
57
51
|
if ('formula' in jaql)
|
|
58
52
|
return (0, utils_js_1.createCalculatedMeasureHelper)(jaql);
|
|
59
|
-
const { dim,
|
|
53
|
+
const { dim, datatype: dataType, agg } = jaql;
|
|
60
54
|
return (0, utils_js_1.createMeasureHelper)({
|
|
61
|
-
dim,
|
|
62
|
-
|
|
63
|
-
column,
|
|
64
|
-
level,
|
|
55
|
+
expression: dim,
|
|
56
|
+
granularity: (0, utils_js_1.getGranularityFromJaql)(jaql),
|
|
65
57
|
dataType,
|
|
66
58
|
agg,
|
|
67
59
|
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,11 @@ 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 types_js_1 = require("./types.js");
|
|
33
32
|
const isTopCondition = (filter) => filter.top !== undefined;
|
|
34
33
|
const isBottomCondition = (filter) => filter.bottom !== undefined;
|
|
35
34
|
const isExcludeCondition = (filter) => { var _a; return !!((_a = filter.exclude) === null || _a === void 0 ? void 0 : _a.members); };
|
|
@@ -115,48 +114,48 @@ const createAttributeFilterFromConditionFilterJaql = (attribute, conditionFilter
|
|
|
115
114
|
switch (conditionType) {
|
|
116
115
|
case types_js_1.ConditionFilterType.BOTTOM:
|
|
117
116
|
if (conditionFilterJaql.by) {
|
|
118
|
-
return
|
|
117
|
+
return filterFactory.bottomRanking(attribute, (0, attribute_measure_util_js_1.createMeasureFromRankingFilterJaql)(conditionFilterJaql.by, conditionFilterJaql.rankingMessage), conditionFilterJaql[types_js_1.ConditionFilterType.BOTTOM], { guid });
|
|
119
118
|
}
|
|
120
119
|
break;
|
|
121
120
|
case types_js_1.ConditionFilterType.EQUALS:
|
|
122
|
-
return
|
|
121
|
+
return filterFactory.equals(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.EQUALS], { guid });
|
|
123
122
|
case types_js_1.ConditionFilterType.DOESNT_EQUAL:
|
|
124
|
-
return
|
|
123
|
+
return filterFactory.doesntEqual(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.DOESNT_EQUAL], { guid });
|
|
125
124
|
case types_js_1.ConditionFilterType.GREATER_THAN:
|
|
126
|
-
return
|
|
125
|
+
return filterFactory.greaterThan(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.GREATER_THAN], { guid });
|
|
127
126
|
case types_js_1.ConditionFilterType.GREATER_THAN_OR_EQUAL:
|
|
128
|
-
return
|
|
127
|
+
return filterFactory.greaterThanOrEqual(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.GREATER_THAN_OR_EQUAL], { guid });
|
|
129
128
|
case types_js_1.ConditionFilterType.TOP:
|
|
130
129
|
if (conditionFilterJaql.by) {
|
|
131
|
-
return
|
|
130
|
+
return filterFactory.topRanking(attribute, (0, attribute_measure_util_js_1.createMeasureFromRankingFilterJaql)(conditionFilterJaql.by, conditionFilterJaql.rankingMessage), conditionFilterJaql[types_js_1.ConditionFilterType.TOP], { guid });
|
|
132
131
|
}
|
|
133
132
|
break;
|
|
134
133
|
case types_js_1.ConditionFilterType.STARTS_WITH:
|
|
135
|
-
return
|
|
134
|
+
return filterFactory.startsWith(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.STARTS_WITH], { guid });
|
|
136
135
|
case types_js_1.ConditionFilterType.DOESNT_START_WITH:
|
|
137
|
-
return
|
|
136
|
+
return filterFactory.doesntStartWith(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.DOESNT_START_WITH], { guid });
|
|
138
137
|
case types_js_1.ConditionFilterType.ENDS_WITH:
|
|
139
|
-
return
|
|
138
|
+
return filterFactory.endsWith(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.ENDS_WITH], { guid });
|
|
140
139
|
case types_js_1.ConditionFilterType.DOESNT_END_WITH:
|
|
141
|
-
return
|
|
140
|
+
return filterFactory.doesntEndWith(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.DOESNT_END_WITH], { guid });
|
|
142
141
|
case types_js_1.ConditionFilterType.CONTAINS:
|
|
143
|
-
return
|
|
142
|
+
return filterFactory.contains(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.CONTAINS], { guid });
|
|
144
143
|
case types_js_1.ConditionFilterType.DOESNT_CONTAIN:
|
|
145
|
-
return
|
|
144
|
+
return filterFactory.doesntContain(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.DOESNT_CONTAIN], { guid });
|
|
146
145
|
case types_js_1.ConditionFilterType.LESS_THAN:
|
|
147
|
-
return
|
|
146
|
+
return filterFactory.lessThan(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.LESS_THAN], { guid });
|
|
148
147
|
case types_js_1.ConditionFilterType.LESS_THAN_OR_EQUAL:
|
|
149
|
-
return
|
|
148
|
+
return filterFactory.lessThanOrEqual(attribute, conditionFilterJaql[types_js_1.ConditionFilterType.LESS_THAN_OR_EQUAL], { guid });
|
|
150
149
|
case types_js_1.ConditionFilterType.BETWEEN:
|
|
151
|
-
return
|
|
150
|
+
return filterFactory.between(attribute, conditionFilterJaql.from, conditionFilterJaql.to, { guid });
|
|
152
151
|
case types_js_1.ConditionFilterType.IS_NOT_BETWEEN:
|
|
153
|
-
return
|
|
152
|
+
return filterFactory.exclude(filterFactory.between(attribute, (_a = conditionFilterJaql.exclude) === null || _a === void 0 ? void 0 : _a.from, (_b = conditionFilterJaql.exclude) === null || _b === void 0 ? void 0 : _b.to, { guid }), undefined, { guid });
|
|
154
153
|
case types_js_1.ConditionFilterType.MULTIPLE_CONDITION:
|
|
155
154
|
if (conditionFilterJaql.and) {
|
|
156
|
-
return
|
|
155
|
+
return filterFactory.intersection(conditionFilterJaql.and.map((c) => (0, exports.createAttributeFilterFromConditionFilterJaql)(attribute, c, guid)), { guid });
|
|
157
156
|
}
|
|
158
157
|
if (conditionFilterJaql.or) {
|
|
159
|
-
return
|
|
158
|
+
return filterFactory.union(conditionFilterJaql.or.map((c) => (0, exports.createAttributeFilterFromConditionFilterJaql)(attribute, c, guid)), { guid });
|
|
160
159
|
}
|
|
161
160
|
break;
|
|
162
161
|
case types_js_1.ConditionFilterType.IS_NOT: {
|
|
@@ -170,7 +169,7 @@ const createAttributeFilterFromConditionFilterJaql = (attribute, conditionFilter
|
|
|
170
169
|
enableMultiSelection: (_g = conditionFilterJaql.multiSelection) !== null && _g !== void 0 ? _g : true,
|
|
171
170
|
deactivatedMembers,
|
|
172
171
|
});
|
|
173
|
-
return
|
|
172
|
+
return filterFactory.members(attribute, selectedMembers, config);
|
|
174
173
|
}
|
|
175
174
|
case types_js_1.ConditionFilterType.AFTER:
|
|
176
175
|
case types_js_1.ConditionFilterType.BEFORE:
|
|
@@ -193,20 +192,23 @@ exports.createAttributeFilterFromConditionFilterJaql = createAttributeFilterFrom
|
|
|
193
192
|
* @returns measure filter
|
|
194
193
|
*/
|
|
195
194
|
const createMeasureFilterFromConditionFilterJaql = (measure, conditionFilterJaql, guid) => {
|
|
195
|
+
var _a, _b;
|
|
196
196
|
const conditionType = (0, exports.getSelectedConditionOption)(conditionFilterJaql);
|
|
197
197
|
switch (conditionType) {
|
|
198
198
|
case types_js_1.ConditionFilterType.EQUALS:
|
|
199
|
-
return
|
|
199
|
+
return filterFactory.measureEquals(measure, conditionFilterJaql[types_js_1.ConditionFilterType.EQUALS], { guid });
|
|
200
200
|
case types_js_1.ConditionFilterType.GREATER_THAN:
|
|
201
|
-
return
|
|
201
|
+
return filterFactory.measureGreaterThan(measure, conditionFilterJaql[types_js_1.ConditionFilterType.GREATER_THAN], { guid });
|
|
202
202
|
case types_js_1.ConditionFilterType.GREATER_THAN_OR_EQUAL:
|
|
203
|
-
return
|
|
203
|
+
return filterFactory.measureGreaterThanOrEqual(measure, conditionFilterJaql[types_js_1.ConditionFilterType.GREATER_THAN_OR_EQUAL], { guid });
|
|
204
204
|
case types_js_1.ConditionFilterType.LESS_THAN:
|
|
205
|
-
return
|
|
205
|
+
return filterFactory.measureLessThan(measure, conditionFilterJaql[types_js_1.ConditionFilterType.LESS_THAN], { guid });
|
|
206
206
|
case types_js_1.ConditionFilterType.LESS_THAN_OR_EQUAL:
|
|
207
|
-
return
|
|
207
|
+
return filterFactory.measureLessThanOrEqual(measure, conditionFilterJaql[types_js_1.ConditionFilterType.LESS_THAN_OR_EQUAL], { guid });
|
|
208
208
|
case types_js_1.ConditionFilterType.BETWEEN:
|
|
209
|
-
return
|
|
209
|
+
return filterFactory.measureBetween(measure, conditionFilterJaql.from, conditionFilterJaql.to, { guid });
|
|
210
|
+
case types_js_1.ConditionFilterType.IS_NOT_BETWEEN:
|
|
211
|
+
return filterFactory.exclude(filterFactory.measureBetween(measure, (_a = conditionFilterJaql.exclude) === null || _a === void 0 ? void 0 : _a.from, (_b = conditionFilterJaql.exclude) === null || _b === void 0 ? void 0 : _b.to, { guid }), undefined, { guid });
|
|
210
212
|
}
|
|
211
213
|
throw new translatable_error_js_1.TranslatableError('errors.filter.unsupportedConditionFilter', {
|
|
212
214
|
filter: JSON.stringify(conditionFilterJaql),
|
|
@@ -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,13 @@ 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
32
|
const filter_types_util_js_1 = require("./filter-types-util.js");
|
|
31
|
-
const
|
|
32
|
-
const attribute_measure_util_js_1 = require("./attribute-measure-util.js");
|
|
33
|
-
const translatable_error_js_1 = require("../../../translation/translatable-error.js");
|
|
34
|
-
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
33
|
+
const types_js_1 = require("./types.js");
|
|
35
34
|
/**
|
|
36
35
|
* Creates a generic filter (aka pass-through JAQL filter) if the JAQL cannot be translated to a specific filter type.
|
|
37
36
|
*
|
|
@@ -40,7 +39,7 @@ const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
|
40
39
|
* @returns A generic Filter object.
|
|
41
40
|
*/
|
|
42
41
|
const createGenericFilter = (jaql, guid) => {
|
|
43
|
-
|
|
42
|
+
const baseFilter = {
|
|
44
43
|
config: Object.assign(Object.assign({}, (0, filter_config_utils_js_1.getDefaultBaseFilterConfig)()), { guid, originalFilterJaql: jaql }),
|
|
45
44
|
jaql: (nested) => {
|
|
46
45
|
if (nested) {
|
|
@@ -55,13 +54,8 @@ const createGenericFilter = (jaql, guid) => {
|
|
|
55
54
|
id: jaql.dim,
|
|
56
55
|
},
|
|
57
56
|
type: 'filter',
|
|
58
|
-
serializable() {
|
|
59
|
-
return Object.assign(Object.assign({}, this), { jaql: this.jaql() });
|
|
60
|
-
},
|
|
61
|
-
toJSON() {
|
|
62
|
-
return this.serializable();
|
|
63
|
-
},
|
|
64
57
|
};
|
|
58
|
+
return Object.assign({}, baseFilter);
|
|
65
59
|
};
|
|
66
60
|
exports.createGenericFilter = createGenericFilter;
|
|
67
61
|
/**
|
|
@@ -78,7 +72,7 @@ const createFilterIncludeAll = (attribute, guid) => {
|
|
|
78
72
|
guid,
|
|
79
73
|
excludeMembers: true,
|
|
80
74
|
};
|
|
81
|
-
return
|
|
75
|
+
return filterFactory.members(attribute, [], config);
|
|
82
76
|
};
|
|
83
77
|
exports.createFilterIncludeAll = createFilterIncludeAll;
|
|
84
78
|
/**
|
|
@@ -98,7 +92,7 @@ const createFilterFromSpecificItemsFilterJaql = (attribute, specificItemsFilterJ
|
|
|
98
92
|
enableMultiSelection: multiSelection !== null && multiSelection !== void 0 ? multiSelection : true,
|
|
99
93
|
deactivatedMembers,
|
|
100
94
|
});
|
|
101
|
-
return
|
|
95
|
+
return filterFactory.members(attribute, activeMembers, config);
|
|
102
96
|
};
|
|
103
97
|
exports.createFilterFromSpecificItemsFilterJaql = createFilterFromSpecificItemsFilterJaql;
|
|
104
98
|
function getDeactivatedMembersFromFilterJaql(filterJaql) {
|
|
@@ -120,7 +114,7 @@ function getActiveMembersFromFilterJaql(filterJaql, deactivatedMembers) {
|
|
|
120
114
|
* @returns Filter object
|
|
121
115
|
*/
|
|
122
116
|
const createFilterFromDateRangeFilterJaql = (attribute, rangeFilterJaql, guid) => {
|
|
123
|
-
return
|
|
117
|
+
return filterFactory.dateRange(attribute, rangeFilterJaql.from, rangeFilterJaql.to, { guid });
|
|
124
118
|
};
|
|
125
119
|
exports.createFilterFromDateRangeFilterJaql = createFilterFromDateRangeFilterJaql;
|
|
126
120
|
/**
|
|
@@ -132,7 +126,7 @@ exports.createFilterFromDateRangeFilterJaql = createFilterFromDateRangeFilterJaq
|
|
|
132
126
|
* @returns Filter object
|
|
133
127
|
*/
|
|
134
128
|
const createFilterFromNumericRangeJaql = (attribute, rangeFilterJaql, guid) => {
|
|
135
|
-
return
|
|
129
|
+
return filterFactory.between(attribute, rangeFilterJaql.from, rangeFilterJaql.to, { guid });
|
|
136
130
|
};
|
|
137
131
|
exports.createFilterFromNumericRangeJaql = createFilterFromNumericRangeJaql;
|
|
138
132
|
/**
|
|
@@ -145,10 +139,10 @@ exports.createFilterFromNumericRangeJaql = createFilterFromNumericRangeJaql;
|
|
|
145
139
|
*/
|
|
146
140
|
const createFilterFromPeriodFilterJaql = (attribute, periodFilterJaql, guid) => {
|
|
147
141
|
if (periodFilterJaql.last) {
|
|
148
|
-
return
|
|
142
|
+
return filterFactory.dateRelativeTo(attribute, periodFilterJaql.last.offset, periodFilterJaql.last.count, periodFilterJaql.last.anchor, { guid });
|
|
149
143
|
}
|
|
150
144
|
else {
|
|
151
|
-
return
|
|
145
|
+
return filterFactory.dateRelativeFrom(attribute, periodFilterJaql.next.offset, periodFilterJaql.next.count, periodFilterJaql.next.anchor, { guid });
|
|
152
146
|
}
|
|
153
147
|
};
|
|
154
148
|
exports.createFilterFromPeriodFilterJaql = createFilterFromPeriodFilterJaql;
|
|
@@ -161,7 +155,7 @@ exports.createFilterFromPeriodFilterJaql = createFilterFromPeriodFilterJaql;
|
|
|
161
155
|
* @returns Filter object
|
|
162
156
|
*/
|
|
163
157
|
const createFilterFromCustomFilterJaql = (attribute, customFilterJaql, guid) => {
|
|
164
|
-
return
|
|
158
|
+
return filterFactory.customFilter(attribute, customFilterJaql, {
|
|
165
159
|
guid,
|
|
166
160
|
});
|
|
167
161
|
};
|
|
@@ -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; };
|
|
@@ -19,6 +19,16 @@ export declare type JaqlDataSource = {
|
|
|
19
19
|
lastBuildTime?: string;
|
|
20
20
|
revisionId?: string;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Data source as specified in the jaql
|
|
24
|
+
* but with required filelds
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare type JaqlDataSourceForDto = JaqlDataSource & {
|
|
29
|
+
id: string;
|
|
30
|
+
address?: string;
|
|
31
|
+
};
|
|
22
32
|
export declare enum GeneralFilterType {
|
|
23
33
|
INCLUDE_ALL = "INCLUDE_ALL",
|
|
24
34
|
ADVANCED = "ADVANCED",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataSource } from '../interfaces.js';
|
|
2
|
-
import { FilterJaql, JaqlDataSource, Sort } from './types.js';
|
|
2
|
+
import { DateLevel, FilterJaql, JaqlDataSource, JSONObject, Sort } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -46,13 +46,13 @@ export interface Element {
|
|
|
46
46
|
*
|
|
47
47
|
* @internal
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
serialize(): JSONObject;
|
|
50
50
|
/**
|
|
51
51
|
* Overrides JSON.stringify() behavior.
|
|
52
52
|
*
|
|
53
53
|
* @internal
|
|
54
54
|
*/
|
|
55
|
-
toJSON():
|
|
55
|
+
toJSON(): JSONObject;
|
|
56
56
|
/**
|
|
57
57
|
* Gets the JAQL representation of this instance.
|
|
58
58
|
*
|
|
@@ -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
|
|
@@ -514,10 +522,6 @@ export declare function isPivotMeasure(arg: Measure | PivotMeasure): arg is Pivo
|
|
|
514
522
|
* Data options for grand totals of a pivot table
|
|
515
523
|
*/
|
|
516
524
|
export declare type PivotGrandTotals = {
|
|
517
|
-
/**
|
|
518
|
-
* @deprecated
|
|
519
|
-
*/
|
|
520
|
-
title?: string;
|
|
521
525
|
rows?: boolean;
|
|
522
526
|
columns?: boolean;
|
|
523
527
|
};
|
|
@@ -550,6 +554,12 @@ export interface FilterRelations {
|
|
|
550
554
|
left: FilterRelationsNode;
|
|
551
555
|
right: FilterRelationsNode;
|
|
552
556
|
operator: 'AND' | 'OR';
|
|
557
|
+
/**
|
|
558
|
+
* Compose code for the filter relations
|
|
559
|
+
*
|
|
560
|
+
* @internal
|
|
561
|
+
*/
|
|
562
|
+
composeCode?: string;
|
|
553
563
|
}
|
|
554
564
|
/**
|
|
555
565
|
* Model of filter logical relations (AND/OR) from Fusion dashboard
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DimensionalElement } from './base.js';
|
|
2
2
|
import { SortDirection } from './interfaces.js';
|
|
3
|
-
import { MetadataItem, MetadataItemJaql } from './types.js';
|
|
3
|
+
import { JSONObject, MetadataItem, MetadataItemJaql } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* This implementation wraps metadata for a JAQL query. The metadata could be
|
|
6
6
|
* for a dimension, measure, or filter. We do little to no interpretation of
|
|
@@ -26,6 +26,10 @@ export declare class JaqlElement extends DimensionalElement {
|
|
|
26
26
|
get id(): string;
|
|
27
27
|
jaql(nested?: true): MetadataItemJaql;
|
|
28
28
|
jaql(nested?: false | undefined): MetadataItem;
|
|
29
|
+
/**
|
|
30
|
+
* Gets a serializable representation of the element
|
|
31
|
+
*/
|
|
32
|
+
serialize(): JSONObject;
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* Create a JaqlElement from a MetadataItem
|
|
@@ -35,3 +39,11 @@ export declare class JaqlElement extends DimensionalElement {
|
|
|
35
39
|
* @internal
|
|
36
40
|
*/
|
|
37
41
|
export declare function createJaqlElement(item: MetadataItem): JaqlElement;
|
|
42
|
+
/**
|
|
43
|
+
* Create a DimensionalElement from a MetadataItem
|
|
44
|
+
*
|
|
45
|
+
* @param item - the metadata item in a JAQL query
|
|
46
|
+
* @returns a DimensionalElement
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare function createDimensionalElementFromMetadataItem(item: MetadataItem): import("./interfaces.js").Attribute | import("./interfaces.js").BaseMeasure | import("./interfaces.js").CalculatedMeasure | JaqlElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createJaqlElement = exports.JaqlElement = void 0;
|
|
4
|
-
const base_js_1 = require("./base.js");
|
|
3
|
+
exports.createDimensionalElementFromMetadataItem = exports.createJaqlElement = exports.JaqlElement = void 0;
|
|
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
|
|
@@ -50,6 +50,16 @@ class JaqlElement extends base_js_1.DimensionalElement {
|
|
|
50
50
|
jaql(nested) {
|
|
51
51
|
return nested === true ? this.metadataItem.jaql : this.metadataItem;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets a serializable representation of the element
|
|
55
|
+
*/
|
|
56
|
+
serialize() {
|
|
57
|
+
const result = super.serialize();
|
|
58
|
+
result.__serializable = 'JaqlElement';
|
|
59
|
+
result.metadataItem = this.metadataItem;
|
|
60
|
+
result.type = this.type;
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
64
|
exports.JaqlElement = JaqlElement;
|
|
55
65
|
const toMetadataType = {
|
|
@@ -71,3 +81,45 @@ function createJaqlElement(item) {
|
|
|
71
81
|
return new JaqlElement(item, (_a = toMetadataType[item.jaql.datatype]) !== null && _a !== void 0 ? _a : 'numeric');
|
|
72
82
|
}
|
|
73
83
|
exports.createJaqlElement = createJaqlElement;
|
|
84
|
+
/**
|
|
85
|
+
* Create a DimensionalElement from a MetadataItem
|
|
86
|
+
*
|
|
87
|
+
* @param item - the metadata item in a JAQL query
|
|
88
|
+
* @returns a DimensionalElement
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
function createDimensionalElementFromMetadataItem(item) {
|
|
92
|
+
const { jaql } = item;
|
|
93
|
+
// calculated measure
|
|
94
|
+
if (jaql.formula) {
|
|
95
|
+
return (0, utils_js_1.createCalculatedMeasureHelper)(jaql);
|
|
96
|
+
}
|
|
97
|
+
// measure
|
|
98
|
+
if ('agg' in jaql && jaql.dim && jaql.datatype) {
|
|
99
|
+
return (0, utils_js_1.createMeasureHelper)({
|
|
100
|
+
expression: jaql.dim,
|
|
101
|
+
dataType: jaql.datatype,
|
|
102
|
+
agg: jaql.agg || '',
|
|
103
|
+
granularity: jaql.level,
|
|
104
|
+
format: undefined,
|
|
105
|
+
sort: jaql.sort,
|
|
106
|
+
title: jaql.title,
|
|
107
|
+
dataSource: jaql.datasource,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// attribute
|
|
111
|
+
if (jaql.dim && jaql.datatype) {
|
|
112
|
+
return (0, utils_js_1.createAttributeHelper)({
|
|
113
|
+
expression: jaql.dim,
|
|
114
|
+
dataType: jaql.datatype,
|
|
115
|
+
granularity: jaql.level,
|
|
116
|
+
sort: jaql.sort,
|
|
117
|
+
title: jaql.title,
|
|
118
|
+
panel: item.panel,
|
|
119
|
+
dataSource: jaql.datasource,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// fall back to createJaqlElement
|
|
123
|
+
return createJaqlElement(item);
|
|
124
|
+
}
|
|
125
|
+
exports.createDimensionalElementFromMetadataItem = createDimensionalElementFromMetadataItem;
|