@sisense/sdk-data 1.34.0 → 2.1.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 +4 -4
- package/dist/cjs/dimensional-model/attributes.js +21 -7
- 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/dimensions/dimensions.d.ts +5 -5
- package/dist/cjs/dimensional-model/dimensions/dimensions.js +25 -16
- package/dist/cjs/dimensional-model/filters/factory.d.ts +41 -41
- package/dist/cjs/dimensional-model/filters/factory.js +53 -168
- package/dist/cjs/dimensional-model/filters/filter-relations.js +2 -5
- package/dist/cjs/dimensional-model/filters/filters.d.ts +39 -23
- package/dist/cjs/dimensional-model/filters/filters.js +102 -52
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +6 -14
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +28 -26
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +9 -15
- package/dist/cjs/dimensional-model/filters/utils/types.d.ts +10 -0
- package/dist/cjs/dimensional-model/interfaces.d.ts +9 -7
- package/dist/cjs/dimensional-model/jaql-element.d.ts +13 -1
- package/dist/cjs/dimensional-model/jaql-element.js +53 -1
- package/dist/cjs/dimensional-model/measures/factory.d.ts +45 -52
- package/dist/cjs/dimensional-model/measures/factory.js +55 -184
- package/dist/cjs/dimensional-model/measures/measures.d.ts +9 -9
- package/dist/cjs/dimensional-model/measures/measures.js +31 -29
- package/dist/cjs/dimensional-model/types.d.ts +25 -2
- package/dist/cjs/utils.d.ts +26 -19
- package/dist/cjs/utils.js +85 -41
- 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 +4 -4
- package/dist/dimensional-model/attributes.js +21 -7
- 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/dimensions/dimensions.d.ts +5 -5
- package/dist/dimensional-model/dimensions/dimensions.js +26 -17
- package/dist/dimensional-model/filters/factory.d.ts +41 -41
- package/dist/dimensional-model/filters/factory.js +51 -125
- package/dist/dimensional-model/filters/filter-relations.js +3 -6
- package/dist/dimensional-model/filters/filters.d.ts +39 -23
- package/dist/dimensional-model/filters/filters.js +102 -52
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +6 -14
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +28 -26
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +9 -15
- package/dist/dimensional-model/filters/utils/types.d.ts +10 -0
- package/dist/dimensional-model/interfaces.d.ts +9 -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 +45 -52
- package/dist/dimensional-model/measures/factory.js +54 -141
- package/dist/dimensional-model/measures/measures.d.ts +9 -9
- package/dist/dimensional-model/measures/measures.js +31 -29
- package/dist/dimensional-model/types.d.ts +25 -2
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/utils.d.ts +26 -19
- package/dist/utils.js +63 -44
- package/package.json +3 -3
- 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
|
@@ -28,7 +28,6 @@ const translatable_error_js_1 = require("../../../translation/translatable-error
|
|
|
28
28
|
const filterFactory = __importStar(require("../factory.js"));
|
|
29
29
|
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
30
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
31
|
const types_js_1 = require("./types.js");
|
|
33
32
|
const isTopCondition = (filter) => filter.top !== undefined;
|
|
34
33
|
const isBottomCondition = (filter) => filter.bottom !== undefined;
|
|
@@ -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),
|
|
@@ -29,7 +29,6 @@ const filterFactory = __importStar(require("../factory.js"));
|
|
|
29
29
|
const filter_config_utils_js_1 = require("../filter-config-utils.js");
|
|
30
30
|
const attribute_measure_util_js_1 = require("./attribute-measure-util.js");
|
|
31
31
|
const condition_filter_util_js_1 = require("./condition-filter-util.js");
|
|
32
|
-
const filter_code_util_js_1 = require("./filter-code-util.js");
|
|
33
32
|
const filter_types_util_js_1 = require("./filter-types-util.js");
|
|
34
33
|
const types_js_1 = require("./types.js");
|
|
35
34
|
/**
|
|
@@ -40,7 +39,7 @@ const types_js_1 = require("./types.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
|
};
|
|
@@ -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 { DateLevel, 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
|
*
|
|
@@ -522,10 +522,6 @@ export declare function isPivotMeasure(arg: Measure | PivotMeasure): arg is Pivo
|
|
|
522
522
|
* Data options for grand totals of a pivot table
|
|
523
523
|
*/
|
|
524
524
|
export declare type PivotGrandTotals = {
|
|
525
|
-
/**
|
|
526
|
-
* @deprecated
|
|
527
|
-
*/
|
|
528
|
-
title?: string;
|
|
529
525
|
rows?: boolean;
|
|
530
526
|
columns?: boolean;
|
|
531
527
|
};
|
|
@@ -558,6 +554,12 @@ export interface FilterRelations {
|
|
|
558
554
|
left: FilterRelationsNode;
|
|
559
555
|
right: FilterRelationsNode;
|
|
560
556
|
operator: 'AND' | 'OR';
|
|
557
|
+
/**
|
|
558
|
+
* Compose code for the filter relations
|
|
559
|
+
*
|
|
560
|
+
* @internal
|
|
561
|
+
*/
|
|
562
|
+
composeCode?: string;
|
|
561
563
|
}
|
|
562
564
|
/**
|
|
563
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createJaqlElement = exports.JaqlElement = void 0;
|
|
3
|
+
exports.createDimensionalElementFromMetadataItem = exports.createJaqlElement = exports.JaqlElement = void 0;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
const base_js_1 = require("./base.js");
|
|
6
6
|
const types_js_1 = require("./types.js");
|
|
@@ -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;
|