@sisense/sdk-data 1.22.0 → 1.24.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/filters/factory.d.ts +2 -1
- package/dist/cjs/dimensional-model/filters/factory.js +3 -2
- package/dist/cjs/dimensional-model/filters/filters.d.ts +10 -8
- package/dist/cjs/dimensional-model/filters/filters.js +3 -5
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +5 -4
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +9 -6
- 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 +3 -3
- package/dist/cjs/dimensional-model/jaql-element.d.ts +36 -0
- package/dist/cjs/dimensional-model/jaql-element.js +73 -0
- package/dist/cjs/dimensional-model/types.d.ts +155 -0
- package/dist/cjs/dimensional-model/types.js +11 -2
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/interfaces.d.ts +8 -0
- package/dist/cjs/translation/resources/en.d.ts +14 -0
- package/dist/cjs/translation/resources/index.d.ts +6 -0
- package/dist/cjs/translation/resources/index.js +6 -0
- package/dist/cjs/utils.d.ts +11 -1
- package/dist/cjs/utils.js +30 -5
- package/dist/dimensional-model/filters/factory.d.ts +2 -1
- package/dist/dimensional-model/filters/factory.js +3 -2
- package/dist/dimensional-model/filters/filters.d.ts +10 -8
- package/dist/dimensional-model/filters/filters.js +3 -5
- package/dist/dimensional-model/filters/utils/attribute-measure-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +5 -4
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +9 -6
- 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 +3 -3
- package/dist/dimensional-model/jaql-element.d.ts +36 -0
- package/dist/dimensional-model/jaql-element.js +68 -0
- package/dist/dimensional-model/types.d.ts +155 -0
- package/dist/dimensional-model/types.js +10 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces.d.ts +8 -0
- package/dist/translation/resources/en.d.ts +14 -0
- package/dist/translation/resources/index.d.ts +6 -0
- package/dist/translation/resources/index.js +6 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/utils.d.ts +11 -1
- package/dist/utils.js +26 -2
- package/package.json +3 -3
package/dist/cjs/utils.js
CHANGED
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getColumnNameFromAttribute = exports.getTableNameFromAttribute = exports.createFilterFromJaql = exports.convertSort = exports.convertJaqlDataSource = exports.convertDataSource = exports.isDataSourceInfo = exports.getDataSourceName = exports.getFilterListAndRelations = exports.guidFast = void 0;
|
|
6
|
+
exports.getSortType = exports.getColumnNameFromAttribute = exports.getTableNameFromAttribute = exports.createFilterFromJaql = exports.convertSort = exports.convertJaqlDataSource = exports.convertDataSource = exports.isDataSourceInfo = exports.getDataSourceName = exports.getFilterListAndRelations = exports.guidFast = void 0;
|
|
7
7
|
const cloneDeep_js_1 = __importDefault(require("lodash-es/cloneDeep.js"));
|
|
8
|
-
const index_js_1 = require("./index.js");
|
|
9
8
|
const filter_from_jaql_util_js_1 = require("./dimensional-model/filters/utils/filter-from-jaql-util.js");
|
|
9
|
+
const types_js_1 = require("./dimensional-model/types.js");
|
|
10
10
|
/**
|
|
11
11
|
* A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
|
|
12
12
|
*
|
|
@@ -96,6 +96,8 @@ exports.isDataSourceInfo = isDataSourceInfo;
|
|
|
96
96
|
*/
|
|
97
97
|
function convertDataSource(jaqlDataSource) {
|
|
98
98
|
return {
|
|
99
|
+
id: jaqlDataSource.id,
|
|
100
|
+
address: jaqlDataSource.address,
|
|
99
101
|
title: jaqlDataSource.title,
|
|
100
102
|
type: jaqlDataSource.live ? 'live' : 'elasticube',
|
|
101
103
|
};
|
|
@@ -127,10 +129,10 @@ exports.convertJaqlDataSource = convertJaqlDataSource;
|
|
|
127
129
|
*/
|
|
128
130
|
function convertSort(sort) {
|
|
129
131
|
if (sort) {
|
|
130
|
-
return sort === 'asc' ?
|
|
132
|
+
return sort === 'asc' ? types_js_1.Sort.Ascending : types_js_1.Sort.Descending;
|
|
131
133
|
}
|
|
132
134
|
else {
|
|
133
|
-
return
|
|
135
|
+
return types_js_1.Sort.None;
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
exports.convertSort = convertSort;
|
|
@@ -162,7 +164,12 @@ function parseExpression(expression) {
|
|
|
162
164
|
const [table, column] = expression.slice(1, -1).split('.');
|
|
163
165
|
return {
|
|
164
166
|
table,
|
|
165
|
-
column
|
|
167
|
+
column: column
|
|
168
|
+
? column
|
|
169
|
+
// in case of Date we have to remove the (Calendar) part
|
|
170
|
+
.replace('(Calendar)', '')
|
|
171
|
+
.trim()
|
|
172
|
+
: '',
|
|
166
173
|
};
|
|
167
174
|
}
|
|
168
175
|
/**
|
|
@@ -183,3 +190,21 @@ function getColumnNameFromAttribute(attribute) {
|
|
|
183
190
|
return parseExpression(attribute.expression).column;
|
|
184
191
|
}
|
|
185
192
|
exports.getColumnNameFromAttribute = getColumnNameFromAttribute;
|
|
193
|
+
/**
|
|
194
|
+
* Gets the sort type based on the jaql sort direction.
|
|
195
|
+
*
|
|
196
|
+
* @param jaqlSort - The jaql sort direction.
|
|
197
|
+
* @returns The sort direction.
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
function getSortType(jaqlSort) {
|
|
201
|
+
switch (jaqlSort) {
|
|
202
|
+
case types_js_1.JaqlSortDirection.ASC:
|
|
203
|
+
return 'sortAsc';
|
|
204
|
+
case types_js_1.JaqlSortDirection.DESC:
|
|
205
|
+
return 'sortDesc';
|
|
206
|
+
default:
|
|
207
|
+
return 'sortNone';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.getSortType = getSortType;
|
|
@@ -377,10 +377,11 @@ export declare function numeric(attribute: Attribute, operatorA?: string, valueA
|
|
|
377
377
|
* @param guid - Optional GUID for the filter
|
|
378
378
|
* @param deactivatedMembers - Array of deactivated member values
|
|
379
379
|
* @param backgroundFilter - Optional background filter
|
|
380
|
+
* @param multiSelection - Optional flag to disable multi-selection
|
|
380
381
|
* @returns A filter instance
|
|
381
382
|
* @shortDescription Creates filter on attribute to match certain string values
|
|
382
383
|
*/
|
|
383
|
-
export declare function members(attribute: Attribute, members: string[], excludeMembers?: boolean, guid?: string, deactivatedMembers?: string[], backgroundFilter?: Filter): Filter;
|
|
384
|
+
export declare function members(attribute: Attribute, members: string[], excludeMembers?: boolean, guid?: string, deactivatedMembers?: string[], backgroundFilter?: Filter, multiSelection?: boolean): Filter;
|
|
384
385
|
/**
|
|
385
386
|
* Creates a filter to isolate date values starting from and including the given date and level.
|
|
386
387
|
*
|
|
@@ -427,11 +427,12 @@ export function numeric(attribute, operatorA, valueA, operatorB, valueB, guid) {
|
|
|
427
427
|
* @param guid - Optional GUID for the filter
|
|
428
428
|
* @param deactivatedMembers - Array of deactivated member values
|
|
429
429
|
* @param backgroundFilter - Optional background filter
|
|
430
|
+
* @param multiSelection - Optional flag to disable multi-selection
|
|
430
431
|
* @returns A filter instance
|
|
431
432
|
* @shortDescription Creates filter on attribute to match certain string values
|
|
432
433
|
*/
|
|
433
|
-
export function members(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter) {
|
|
434
|
-
return new MembersFilter(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter);
|
|
434
|
+
export function members(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter, multiSelection) {
|
|
435
|
+
return new MembersFilter(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter, multiSelection);
|
|
435
436
|
}
|
|
436
437
|
// DATE FILTERS
|
|
437
438
|
/**
|
|
@@ -34,11 +34,11 @@ export declare const NumericOperators: {
|
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
36
36
|
export declare const DateOperators: {
|
|
37
|
-
From:
|
|
38
|
-
To:
|
|
39
|
-
Last:
|
|
40
|
-
Next:
|
|
41
|
-
Anchor:
|
|
37
|
+
readonly From: "from";
|
|
38
|
+
readonly To: "to";
|
|
39
|
+
readonly Last: "last";
|
|
40
|
+
readonly Next: "next";
|
|
41
|
+
readonly Anchor: "Anchor";
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Different logical operators that can be used with logical filters
|
|
@@ -166,10 +166,12 @@ export declare class MembersFilter extends AbstractFilter {
|
|
|
166
166
|
/** @internal */
|
|
167
167
|
excludeMembers: boolean;
|
|
168
168
|
/** @internal */
|
|
169
|
+
multiSelection: boolean;
|
|
170
|
+
/** @internal */
|
|
169
171
|
deactivatedMembers: any[];
|
|
170
172
|
/** @internal */
|
|
171
173
|
backgroundFilter?: Filter;
|
|
172
|
-
constructor(attribute: Attribute, members?: any[], excludeMembers?: boolean, guid?: string, deactivatedMembers?: any[], backgroundFilter?: Filter);
|
|
174
|
+
constructor(attribute: Attribute, members?: any[], excludeMembers?: boolean, guid?: string, deactivatedMembers?: any[], backgroundFilter?: Filter, multiSelection?: boolean);
|
|
173
175
|
/**
|
|
174
176
|
* gets the element's ID
|
|
175
177
|
*/
|
|
@@ -317,9 +319,9 @@ export declare class DateRangeFilter extends DoubleOperatorFilter<Date | string>
|
|
|
317
319
|
export declare class RelativeDateFilter extends AbstractFilter {
|
|
318
320
|
readonly offset: number;
|
|
319
321
|
readonly count: number;
|
|
320
|
-
readonly operator:
|
|
322
|
+
readonly operator: typeof DateOperators.Last | typeof DateOperators.Next;
|
|
321
323
|
readonly anchor?: Date | string;
|
|
322
|
-
constructor(l: LevelAttribute, offset: number, count: number, operator?:
|
|
324
|
+
constructor(l: LevelAttribute, offset: number, count: number, operator?: typeof DateOperators.Last | typeof DateOperators.Next, anchor?: Date | string, guid?: string);
|
|
323
325
|
get level(): LevelAttribute;
|
|
324
326
|
/**
|
|
325
327
|
* gets the element's ID
|
|
@@ -220,10 +220,11 @@ export class LogicalAttributeFilter extends AbstractFilter {
|
|
|
220
220
|
* @internal
|
|
221
221
|
*/
|
|
222
222
|
export class MembersFilter extends AbstractFilter {
|
|
223
|
-
constructor(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter) {
|
|
223
|
+
constructor(attribute, members, excludeMembers, guid, deactivatedMembers, backgroundFilter, multiSelection = true) {
|
|
224
224
|
super(attribute, FilterTypes.members, guid);
|
|
225
225
|
this.members = members !== null && members !== void 0 ? members : [];
|
|
226
226
|
this.excludeMembers = excludeMembers !== null && excludeMembers !== void 0 ? excludeMembers : false;
|
|
227
|
+
this.multiSelection = multiSelection;
|
|
227
228
|
this.deactivatedMembers = deactivatedMembers !== null && deactivatedMembers !== void 0 ? deactivatedMembers : [];
|
|
228
229
|
this.backgroundFilter = backgroundFilter;
|
|
229
230
|
if (this.members.filter((m) => m === null || m === undefined).length > 0) {
|
|
@@ -256,10 +257,7 @@ export class MembersFilter extends AbstractFilter {
|
|
|
256
257
|
const membersFilterJaql = {
|
|
257
258
|
members: this.members.map((m) => m.toString()),
|
|
258
259
|
};
|
|
259
|
-
|
|
260
|
-
const filterJaql = this.excludeMembers && this.members.length
|
|
261
|
-
? { exclude: membersFilterJaql }
|
|
262
|
-
: membersFilterJaql;
|
|
260
|
+
const filterJaql = this.excludeMembers ? { exclude: membersFilterJaql } : membersFilterJaql;
|
|
263
261
|
if (this.backgroundFilter) {
|
|
264
262
|
return {
|
|
265
263
|
and: [filterJaql, this.backgroundFilter.filterJaql()],
|
|
@@ -55,4 +55,4 @@ export declare const createMeasureFromFilterJaql: (jaql: FilterJaqlInternal) =>
|
|
|
55
55
|
* @param jaql - Ranking filter Jaql object
|
|
56
56
|
* @returns Measure
|
|
57
57
|
*/
|
|
58
|
-
export declare const createMeasureFromRankingFilterJaql: (jaql: RankingFilterJaql | CustomFormulaJaql) => BaseMeasure | CalculatedMeasure;
|
|
58
|
+
export declare const createMeasureFromRankingFilterJaql: (jaql: RankingFilterJaql | CustomFormulaJaql, rankingMessage?: string) => BaseMeasure | CalculatedMeasure;
|
|
@@ -3,6 +3,7 @@ import { isNumber } from '../../simple-column-types.js';
|
|
|
3
3
|
import { MetadataTypes } from '../../types.js';
|
|
4
4
|
import * as measureFactory from '../../measures/factory.js';
|
|
5
5
|
import { transformCustomFormulaJaql } from '../../measures/factory.js';
|
|
6
|
+
import { DimensionalBaseMeasure } from '../../measures/measures.js';
|
|
6
7
|
const DATA_MODEL_MODULE_NAME = 'DM';
|
|
7
8
|
/**
|
|
8
9
|
* Creates an attribute or level attribute from the provided parameters
|
|
@@ -58,7 +59,7 @@ export const createAttributeFromFilterJaql = (jaql) => {
|
|
|
58
59
|
*/
|
|
59
60
|
export const createMeasureHelper = (dim, table, column, level, dataType, agg, title, dataSource) => {
|
|
60
61
|
const attribute = createAttributeHelper(dim, table, column, level, dataType, title, dataSource);
|
|
61
|
-
const measure = measureFactory.aggregate(attribute, agg);
|
|
62
|
+
const measure = measureFactory.aggregate(attribute, agg, title);
|
|
62
63
|
measure.composeCode = `measureFactory.${agg}(${attribute.composeCode})`;
|
|
63
64
|
return measure;
|
|
64
65
|
};
|
|
@@ -85,7 +86,7 @@ export const createMeasureFromFilterJaql = (jaql) => {
|
|
|
85
86
|
const { dim, table, column, title, level, datatype: dataType, agg, datasource: dataSource, } = jaql;
|
|
86
87
|
if (!agg)
|
|
87
88
|
return undefined;
|
|
88
|
-
return createMeasureHelper(dim, table, column, level, dataType, agg, title, dataSource);
|
|
89
|
+
return createMeasureHelper(dim, table, column, level, dataType, DimensionalBaseMeasure.aggregationFromJAQL(agg), title, dataSource);
|
|
89
90
|
};
|
|
90
91
|
/**
|
|
91
92
|
* Creates a measure from the provided ranking filter JAQL object
|
|
@@ -93,9 +94,9 @@ export const createMeasureFromFilterJaql = (jaql) => {
|
|
|
93
94
|
* @param jaql - Ranking filter Jaql object
|
|
94
95
|
* @returns Measure
|
|
95
96
|
*/
|
|
96
|
-
export const createMeasureFromRankingFilterJaql = (jaql) => {
|
|
97
|
+
export const createMeasureFromRankingFilterJaql = (jaql, rankingMessage) => {
|
|
97
98
|
if ('formula' in jaql)
|
|
98
99
|
return createCalculatedMeasureFromJaql(jaql);
|
|
99
100
|
const { dim, table, column, level, datatype: dataType, agg } = jaql;
|
|
100
|
-
return createMeasureHelper(dim, table, column, level, dataType, agg);
|
|
101
|
+
return createMeasureHelper(dim, table, column, level, dataType, DimensionalBaseMeasure.aggregationFromJAQL(agg), rankingMessage);
|
|
101
102
|
};
|
|
@@ -82,12 +82,12 @@ export const getSelectedConditionOption = (filter) => {
|
|
|
82
82
|
* @returns attribute filter
|
|
83
83
|
*/
|
|
84
84
|
export const createAttributeFilterFromConditionFilterJaql = (attribute, conditionFilterJaql, guid) => {
|
|
85
|
-
var _a, _b, _c, _d, _e;
|
|
85
|
+
var _a, _b, _c, _d, _e, _f;
|
|
86
86
|
const conditionType = getSelectedConditionOption(conditionFilterJaql);
|
|
87
87
|
switch (conditionType) {
|
|
88
88
|
case ConditionFilterType.BOTTOM:
|
|
89
89
|
if (conditionFilterJaql.by) {
|
|
90
|
-
return withComposeCode(filterFactory.bottomRanking)(attribute, createMeasureFromRankingFilterJaql(conditionFilterJaql.by), conditionFilterJaql[ConditionFilterType.BOTTOM], guid);
|
|
90
|
+
return withComposeCode(filterFactory.bottomRanking)(attribute, createMeasureFromRankingFilterJaql(conditionFilterJaql.by, conditionFilterJaql.rankingMessage), conditionFilterJaql[ConditionFilterType.BOTTOM], guid);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
93
93
|
case ConditionFilterType.EQUALS:
|
|
@@ -100,7 +100,7 @@ export const createAttributeFilterFromConditionFilterJaql = (attribute, conditio
|
|
|
100
100
|
return withComposeCode(filterFactory.greaterThanOrEqual)(attribute, conditionFilterJaql[ConditionFilterType.GREATER_THAN_OR_EQUAL], guid);
|
|
101
101
|
case ConditionFilterType.TOP:
|
|
102
102
|
if (conditionFilterJaql.by) {
|
|
103
|
-
return withComposeCode(filterFactory.topRanking)(attribute, createMeasureFromRankingFilterJaql(conditionFilterJaql.by), conditionFilterJaql[ConditionFilterType.TOP], guid);
|
|
103
|
+
return withComposeCode(filterFactory.topRanking)(attribute, createMeasureFromRankingFilterJaql(conditionFilterJaql.by, conditionFilterJaql.rankingMessage), conditionFilterJaql[ConditionFilterType.TOP], guid);
|
|
104
104
|
}
|
|
105
105
|
break;
|
|
106
106
|
case ConditionFilterType.STARTS_WITH:
|
|
@@ -131,10 +131,13 @@ export const createAttributeFilterFromConditionFilterJaql = (attribute, conditio
|
|
|
131
131
|
return withComposeCode(filterFactory.union)(conditionFilterJaql.or.map((c) => createAttributeFilterFromConditionFilterJaql(attribute, c, guid)), guid);
|
|
132
132
|
}
|
|
133
133
|
break;
|
|
134
|
-
case ConditionFilterType.IS_NOT:
|
|
134
|
+
case ConditionFilterType.IS_NOT: {
|
|
135
|
+
const deactivatedMembers = (((_c = conditionFilterJaql.filter) === null || _c === void 0 ? void 0 : _c.turnedOff) && ((_d = conditionFilterJaql.filter.exclude) === null || _d === void 0 ? void 0 : _d.members)) ||
|
|
136
|
+
[];
|
|
137
|
+
const selectedMembers = ((_f = (_e = conditionFilterJaql.exclude) === null || _e === void 0 ? void 0 : _e.members) === null || _f === void 0 ? void 0 : _f.filter((member) => !deactivatedMembers.includes(member))) || [];
|
|
135
138
|
// use members filter with exclude instead of exclude filter
|
|
136
|
-
return withComposeCode(filterFactory.members)(attribute,
|
|
137
|
-
|
|
139
|
+
return withComposeCode(filterFactory.members)(attribute, selectedMembers, true, guid, deactivatedMembers, undefined, conditionFilterJaql.multiSelection);
|
|
140
|
+
}
|
|
138
141
|
case ConditionFilterType.AFTER:
|
|
139
142
|
case ConditionFilterType.BEFORE:
|
|
140
143
|
case ConditionFilterType.IS_EMPTY:
|
|
@@ -25,7 +25,7 @@ export declare const createFilterIncludeAll: (attribute: Attribute, guid?: strin
|
|
|
25
25
|
* @param guid - Optional GUID for the filter
|
|
26
26
|
* @returns Filter object
|
|
27
27
|
*/
|
|
28
|
-
export declare const createFilterFromSpecificItemsFilterJaql: (attribute: Attribute, specificItemsFilterJaql: SpecificItemsFilterJaql, guid?: string) => Filter;
|
|
28
|
+
export declare const createFilterFromSpecificItemsFilterJaql: (attribute: Attribute, specificItemsFilterJaql: SpecificItemsFilterJaql, guid?: string, multiSelection?: boolean) => Filter;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a filter from a date range filter JAQL object.
|
|
31
31
|
*
|
|
@@ -57,11 +57,11 @@ export const createFilterIncludeAll = (attribute, guid) => {
|
|
|
57
57
|
* @param guid - Optional GUID for the filter
|
|
58
58
|
* @returns Filter object
|
|
59
59
|
*/
|
|
60
|
-
export const createFilterFromSpecificItemsFilterJaql = (attribute, specificItemsFilterJaql, guid) => {
|
|
60
|
+
export const createFilterFromSpecificItemsFilterJaql = (attribute, specificItemsFilterJaql, guid, multiSelection) => {
|
|
61
61
|
const deactivatedMembers = getDeactivatedMembersFromFilterJaql(specificItemsFilterJaql);
|
|
62
62
|
const activeMembers = getActiveMembersFromFilterJaql(specificItemsFilterJaql, deactivatedMembers);
|
|
63
63
|
return withComposeCode(filterFactory.members)(attribute, activeMembers, undefined, // use undefined instead of false to avoid including the property in composeCode
|
|
64
|
-
guid, deactivatedMembers);
|
|
64
|
+
guid, deactivatedMembers, undefined, multiSelection);
|
|
65
65
|
};
|
|
66
66
|
function getDeactivatedMembersFromFilterJaql(filterJaql) {
|
|
67
67
|
var _a, _b, _c;
|
|
@@ -163,7 +163,7 @@ export const createFilterFromJaqlInternal = (jaql, guid) => {
|
|
|
163
163
|
case FILTER_TYPES.INCLUDE_ALL:
|
|
164
164
|
return createFilterIncludeAll(attribute, guid);
|
|
165
165
|
case FILTER_TYPES.SPECIFIC_ITEMS:
|
|
166
|
-
return createFilterFromSpecificItemsFilterJaql(attribute, filterJaqlWithType, guid);
|
|
166
|
+
return createFilterFromSpecificItemsFilterJaql(attribute, filterJaqlWithType, guid, filterJaqlWithType.multiSelection);
|
|
167
167
|
case FILTER_TYPES.CONDITION:
|
|
168
168
|
return createFilterFromConditionFilterJaql(attribute, filterJaqlWithType, measure, guid);
|
|
169
169
|
case FILTER_TYPES.DATE_RANGE:
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DimensionalElement } from './base.js';
|
|
2
|
+
import { SortDirection } from './interfaces.js';
|
|
3
|
+
import { MetadataItem } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* This implementation wraps metadata for a JAQL query. The metadata could be
|
|
6
|
+
* for a dimension, measure, or filter. We do little to no interpretation of
|
|
7
|
+
* the JAQL as it is designed to be "passed through" to the query execution
|
|
8
|
+
* step.
|
|
9
|
+
*
|
|
10
|
+
* This will typically be used for JAQL metadata that is coming from a Sisense
|
|
11
|
+
* instance and is assumed to be correct (e.g. dashboard widget, NLQ
|
|
12
|
+
* suggestion).
|
|
13
|
+
*
|
|
14
|
+
* @param item - the metadata item in a JAQL query
|
|
15
|
+
* @param type - the data type of the dimension
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare class JaqlElement extends DimensionalElement {
|
|
19
|
+
private readonly metadataItem;
|
|
20
|
+
expression: string;
|
|
21
|
+
skipValidation: boolean;
|
|
22
|
+
aggregation?: string;
|
|
23
|
+
formula?: string;
|
|
24
|
+
sortType?: SortDirection;
|
|
25
|
+
constructor(item: MetadataItem, type: string);
|
|
26
|
+
get id(): string;
|
|
27
|
+
jaql(): MetadataItem;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a JaqlElement from a MetadataItem
|
|
31
|
+
*
|
|
32
|
+
* @param item - the metadata item in a JAQL query
|
|
33
|
+
* @returns a JaqlElement
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function createJaqlElement(item: MetadataItem): JaqlElement;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DimensionalElement } from './base.js';
|
|
2
|
+
import { getSortType } from '../utils.js';
|
|
3
|
+
import { MetadataTypes } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* This implementation wraps metadata for a JAQL query. The metadata could be
|
|
6
|
+
* for a dimension, measure, or filter. We do little to no interpretation of
|
|
7
|
+
* the JAQL as it is designed to be "passed through" to the query execution
|
|
8
|
+
* step.
|
|
9
|
+
*
|
|
10
|
+
* This will typically be used for JAQL metadata that is coming from a Sisense
|
|
11
|
+
* instance and is assumed to be correct (e.g. dashboard widget, NLQ
|
|
12
|
+
* suggestion).
|
|
13
|
+
*
|
|
14
|
+
* @param item - the metadata item in a JAQL query
|
|
15
|
+
* @param type - the data type of the dimension
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export class JaqlElement extends DimensionalElement {
|
|
19
|
+
constructor(item, type) {
|
|
20
|
+
var _a;
|
|
21
|
+
super((_a = item.jaql.title) !== null && _a !== void 0 ? _a : '', type);
|
|
22
|
+
this.expression = (item.jaql.dim || item.jaql.formula);
|
|
23
|
+
this.metadataItem = item;
|
|
24
|
+
if (item.jaql.agg) {
|
|
25
|
+
this.aggregation = item.jaql.agg;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
delete this.aggregation;
|
|
29
|
+
}
|
|
30
|
+
if (item.jaql.formula) {
|
|
31
|
+
this.formula = item.jaql.formula;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
delete this.formula;
|
|
35
|
+
}
|
|
36
|
+
if (item.jaql.sort) {
|
|
37
|
+
this.sortType = getSortType(item.jaql.sort);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
delete this.sortType;
|
|
41
|
+
}
|
|
42
|
+
this.skipValidation = true;
|
|
43
|
+
}
|
|
44
|
+
get id() {
|
|
45
|
+
return this.expression;
|
|
46
|
+
}
|
|
47
|
+
jaql() {
|
|
48
|
+
return this.metadataItem;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const toMetadataType = {
|
|
52
|
+
text: MetadataTypes.TextAttribute,
|
|
53
|
+
numeric: MetadataTypes.NumericAttribute,
|
|
54
|
+
datetime: MetadataTypes.DateLevel,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Create a JaqlElement from a MetadataItem
|
|
58
|
+
*
|
|
59
|
+
* @param item - the metadata item in a JAQL query
|
|
60
|
+
* @returns a JaqlElement
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export function createJaqlElement(item) {
|
|
64
|
+
var _a;
|
|
65
|
+
// TODO: measures with a "formula" may not have a datatype. force this to be numeric because aggregations
|
|
66
|
+
// will always be of type number. check if there is a more correct way to do this
|
|
67
|
+
return new JaqlElement(item, (_a = toMetadataType[item.jaql.datatype]) !== null && _a !== void 0 ? _a : 'numeric');
|
|
68
|
+
}
|
|
@@ -223,12 +223,14 @@ export declare type IncludeAllFilter = {
|
|
|
223
223
|
/** @internal */
|
|
224
224
|
export declare type IncludeMembersFilter = {
|
|
225
225
|
members: string[];
|
|
226
|
+
multiSelection?: boolean;
|
|
226
227
|
};
|
|
227
228
|
/** @internal */
|
|
228
229
|
export declare type ExcludeMembersFilter = {
|
|
229
230
|
exclude: {
|
|
230
231
|
members: string[];
|
|
231
232
|
};
|
|
233
|
+
multiSelection?: boolean;
|
|
232
234
|
};
|
|
233
235
|
/** @internal */
|
|
234
236
|
export declare type TurnOffMembersFilter = ExcludeMembersFilter & {
|
|
@@ -266,3 +268,156 @@ export declare type OrFilter<FilterItem> = {
|
|
|
266
268
|
* Abstract object with any unknown values
|
|
267
269
|
*/
|
|
268
270
|
export declare type AnyObject = Record<string, any>;
|
|
271
|
+
/**
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
interface DecimalAbbreviations {
|
|
275
|
+
k: boolean;
|
|
276
|
+
m: boolean;
|
|
277
|
+
b: boolean;
|
|
278
|
+
t: boolean;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
export declare enum CurrencyPosition {
|
|
284
|
+
PRE = "pre",
|
|
285
|
+
POST = "post"
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
export declare type NumericMask = {
|
|
291
|
+
isdefault?: boolean;
|
|
292
|
+
abbreviations?: DecimalAbbreviations;
|
|
293
|
+
decimals?: 'auto' | number | string;
|
|
294
|
+
currency?: {
|
|
295
|
+
symbol: string;
|
|
296
|
+
position: CurrencyPosition;
|
|
297
|
+
};
|
|
298
|
+
percent?: boolean;
|
|
299
|
+
number?: {
|
|
300
|
+
separated: boolean;
|
|
301
|
+
};
|
|
302
|
+
separated?: boolean;
|
|
303
|
+
type?: string;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* @internal
|
|
307
|
+
*/
|
|
308
|
+
export declare type DatetimeMask = {
|
|
309
|
+
isdefault?: boolean;
|
|
310
|
+
years: string;
|
|
311
|
+
quarters: string;
|
|
312
|
+
months: string;
|
|
313
|
+
weeks: string;
|
|
314
|
+
minutes: string;
|
|
315
|
+
days: string;
|
|
316
|
+
type: string;
|
|
317
|
+
dateAndTime?: string;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* @internal
|
|
321
|
+
*/
|
|
322
|
+
export declare type MetadataItem = {
|
|
323
|
+
instanceid?: string;
|
|
324
|
+
measure?: MetadataItemJaql;
|
|
325
|
+
jaql: MetadataItemJaql;
|
|
326
|
+
panel?: string;
|
|
327
|
+
isScope?: boolean;
|
|
328
|
+
members?: string[];
|
|
329
|
+
format?: {
|
|
330
|
+
mask?: Partial<DatetimeMask> | Partial<NumericMask>;
|
|
331
|
+
number?: string;
|
|
332
|
+
subtotal?: boolean;
|
|
333
|
+
width?: number;
|
|
334
|
+
databars?: boolean;
|
|
335
|
+
color?: {
|
|
336
|
+
type: string;
|
|
337
|
+
color?: string;
|
|
338
|
+
conditions?: Array<{
|
|
339
|
+
color: string;
|
|
340
|
+
operator: string;
|
|
341
|
+
expression: string | Record<string, any>;
|
|
342
|
+
}>;
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
field?: {
|
|
346
|
+
id?: string;
|
|
347
|
+
index?: number;
|
|
348
|
+
};
|
|
349
|
+
filter?: MetadataItem;
|
|
350
|
+
exclude?: MetadataItem;
|
|
351
|
+
by?: MetadataItemJaql;
|
|
352
|
+
level?: string;
|
|
353
|
+
anchor?: string;
|
|
354
|
+
from?: string;
|
|
355
|
+
to?: string;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
export declare type VagueMetadataItem = Omit<MetadataItem, 'json'> & {
|
|
361
|
+
json?: MetadataItem;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
export declare type MetadataItemJaql = {
|
|
367
|
+
dim?: string;
|
|
368
|
+
agg?: string;
|
|
369
|
+
datatype?: string;
|
|
370
|
+
table?: string;
|
|
371
|
+
column?: string;
|
|
372
|
+
level?: string;
|
|
373
|
+
dateTimeLevel?: string;
|
|
374
|
+
bucket?: string;
|
|
375
|
+
sort?: string;
|
|
376
|
+
in?: {
|
|
377
|
+
selected: {
|
|
378
|
+
jaql: MetadataItemJaql;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
title?: string;
|
|
382
|
+
type?: string;
|
|
383
|
+
formula?: string;
|
|
384
|
+
context?: {
|
|
385
|
+
[itemId: string]: MetadataItemJaql;
|
|
386
|
+
};
|
|
387
|
+
filter?: MetadataItem;
|
|
388
|
+
sortDetails?: {
|
|
389
|
+
dir: string;
|
|
390
|
+
field?: number;
|
|
391
|
+
measurePath?: Record<number, string | number>;
|
|
392
|
+
sortingLastDimension?: boolean;
|
|
393
|
+
initialized?: boolean;
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* @internal
|
|
398
|
+
*/
|
|
399
|
+
export declare type DataSourceField = {
|
|
400
|
+
column: string;
|
|
401
|
+
dimtype: string;
|
|
402
|
+
id: string;
|
|
403
|
+
indexed: boolean;
|
|
404
|
+
merged: boolean;
|
|
405
|
+
table: string;
|
|
406
|
+
title: string;
|
|
407
|
+
type: string;
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
export declare type DataSourceSchema = {
|
|
413
|
+
title: string;
|
|
414
|
+
type: 'extract' | 'live';
|
|
415
|
+
} & AnyObject;
|
|
416
|
+
/**
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
export declare type DataSourceMetadata = {
|
|
420
|
+
title: string;
|
|
421
|
+
fullname: string;
|
|
422
|
+
live: boolean;
|
|
423
|
+
};
|
|
@@ -104,7 +104,8 @@ export const MetadataTypes = {
|
|
|
104
104
|
const type = o;
|
|
105
105
|
return type.toLowerCase() === MetadataTypes.BaseMeasure;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
// JaqlElement doesn't have property attribute. Check for jaql instead
|
|
108
|
+
return (o.agg || o.aggregation) && (o.attribute || o.jaql) && !this.isMeasureTemplate(o);
|
|
108
109
|
},
|
|
109
110
|
/**
|
|
110
111
|
* Checks whether the given object or type is a measure - of any type
|
|
@@ -297,3 +298,11 @@ export var JaqlSortDirection;
|
|
|
297
298
|
JaqlSortDirection["ASC"] = "asc";
|
|
298
299
|
JaqlSortDirection["DESC"] = "desc";
|
|
299
300
|
})(JaqlSortDirection = JaqlSortDirection || (JaqlSortDirection = {}));
|
|
301
|
+
/**
|
|
302
|
+
* @internal
|
|
303
|
+
*/
|
|
304
|
+
export var CurrencyPosition;
|
|
305
|
+
(function (CurrencyPosition) {
|
|
306
|
+
CurrencyPosition["PRE"] = "pre";
|
|
307
|
+
CurrencyPosition["POST"] = "post";
|
|
308
|
+
})(CurrencyPosition = CurrencyPosition || (CurrencyPosition = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './dimensional-model/data-model.js';
|
|
|
14
14
|
export * from './dimensional-model/attributes.js';
|
|
15
15
|
export * from './dimensional-model/dimensions.js';
|
|
16
16
|
export * from './dimensional-model/factory.js';
|
|
17
|
+
export * from './dimensional-model/jaql-element.js';
|
|
17
18
|
export * from './dimensional-model/filters/filters.js';
|
|
18
19
|
export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
|
|
19
20
|
/**
|
|
@@ -91,3 +92,4 @@ export * from './dimensional-model/simple-column-types.js';
|
|
|
91
92
|
*/
|
|
92
93
|
export * as analyticsFactory from './dimensional-model/analytics/factory.js';
|
|
93
94
|
export * from './utils.js';
|
|
95
|
+
export { type TranslationDictionary, PACKAGE_NAMESPACE as translationNamespace, } from './translation/resources/index.js';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from './dimensional-model/data-model.js';
|
|
|
14
14
|
export * from './dimensional-model/attributes.js';
|
|
15
15
|
export * from './dimensional-model/dimensions.js';
|
|
16
16
|
export * from './dimensional-model/factory.js';
|
|
17
|
+
export * from './dimensional-model/jaql-element.js';
|
|
17
18
|
export * from './dimensional-model/filters/filters.js';
|
|
18
19
|
export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
|
|
19
20
|
/**
|
|
@@ -91,3 +92,4 @@ export * from './dimensional-model/simple-column-types.js';
|
|
|
91
92
|
*/
|
|
92
93
|
export * as analyticsFactory from './dimensional-model/analytics/factory.js';
|
|
93
94
|
export * from './utils.js';
|
|
95
|
+
export { PACKAGE_NAMESPACE as translationNamespace, } from './translation/resources/index.js';
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -132,6 +132,14 @@ export interface CalculatedMeasureColumn {
|
|
|
132
132
|
* Info of data source
|
|
133
133
|
*/
|
|
134
134
|
export declare type DataSourceInfo = {
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
**/
|
|
138
|
+
id?: string;
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
**/
|
|
142
|
+
address?: string;
|
|
135
143
|
title: string;
|
|
136
144
|
type: 'live' | 'elasticube';
|
|
137
145
|
};
|
|
@@ -28,4 +28,18 @@ export declare const translation: {
|
|
|
28
28
|
unsupportedDimensionalElement: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* A reference type containing all currently used translation keys.
|
|
33
|
+
* This type serves as a complete resource for creating custom translations,
|
|
34
|
+
* ensuring that all required keys are present and included.
|
|
35
|
+
* It can also be used as Partial to make sure custom translation does not contain any typos.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { TranslationDictionary } from '@sisense/sdk-data';
|
|
40
|
+
*
|
|
41
|
+
* const customTranslationResources: Partial<TranslationDictionary> = {
|
|
42
|
+
* ```
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
31
45
|
export declare type TranslationDictionary = typeof translation;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { TranslationDictionary } from './en.js';
|
|
2
2
|
export type { TranslationDictionary };
|
|
3
|
+
/**
|
|
4
|
+
* A reference to the namespace of the translation resources.
|
|
5
|
+
* This namespace is used to access the translation resources in the i18next instance.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
3
9
|
export declare const PACKAGE_NAMESPACE: "sdkData";
|
|
4
10
|
export declare const resources: {
|
|
5
11
|
en: {
|