@sisense/sdk-data 2.19.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dimensional-model/attributes.js +5 -2
- package/dist/cjs/dimensional-model/base.d.ts +29 -0
- package/dist/cjs/dimensional-model/base.js +39 -1
- package/dist/cjs/dimensional-model/dimensions/dimensions.js +2 -1
- package/dist/cjs/dimensional-model/filters/filter-relations.js +3 -1
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +2 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +2 -0
- package/dist/cjs/dimensional-model/interfaces.d.ts +7 -1
- package/dist/cjs/dimensional-model/interfaces.js +9 -1
- package/dist/cjs/dimensional-model/measures/factory.d.ts +3 -1
- package/dist/cjs/dimensional-model/measures/factory.js +4 -2
- package/dist/cjs/dimensional-model/measures/measures.js +9 -5
- package/dist/cjs/dimensional-model/types.d.ts +1 -0
- package/dist/cjs/translation/resources/en.d.ts +1 -2
- package/dist/cjs/translation/resources/en.js +8 -9
- package/dist/cjs/translation/resources/index.d.ts +2 -4
- package/dist/cjs/translation/resources/uk.js +7 -8
- package/dist/cjs/utils.d.ts +19 -0
- package/dist/cjs/utils.js +46 -2
- package/dist/dimensional-model/attributes.js +6 -3
- package/dist/dimensional-model/base.d.ts +29 -0
- package/dist/dimensional-model/base.js +36 -0
- package/dist/dimensional-model/dimensions/dimensions.js +4 -3
- package/dist/dimensional-model/filters/filter-relations.js +3 -1
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +2 -0
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +2 -0
- package/dist/dimensional-model/interfaces.d.ts +7 -1
- package/dist/dimensional-model/interfaces.js +7 -0
- package/dist/dimensional-model/measures/factory.d.ts +3 -1
- package/dist/dimensional-model/measures/factory.js +4 -2
- package/dist/dimensional-model/measures/measures.js +9 -5
- package/dist/dimensional-model/types.d.ts +1 -0
- package/dist/translation/resources/en.d.ts +1 -2
- package/dist/translation/resources/en.js +8 -9
- package/dist/translation/resources/index.d.ts +2 -4
- package/dist/translation/resources/uk.js +7 -8
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/utils.d.ts +19 -0
- package/dist/utils.js +43 -1
- package/package.json +2 -2
|
@@ -153,6 +153,7 @@ export const createAttributeFilterFromConditionFilterJaql = (attribute, conditio
|
|
|
153
153
|
}
|
|
154
154
|
throw new TranslatableError('errors.filter.unsupportedConditionFilter', {
|
|
155
155
|
filter: JSON.stringify(conditionFilterJaql),
|
|
156
|
+
attributeName: attribute.name,
|
|
156
157
|
});
|
|
157
158
|
};
|
|
158
159
|
/**
|
|
@@ -188,5 +189,6 @@ export const createMeasureFilterFromConditionFilterJaql = (measure, conditionFil
|
|
|
188
189
|
}
|
|
189
190
|
throw new TranslatableError('errors.filter.unsupportedConditionFilter', {
|
|
190
191
|
filter: JSON.stringify(conditionFilterJaql),
|
|
192
|
+
attributeName: measure.name,
|
|
191
193
|
});
|
|
192
194
|
};
|
|
@@ -130,11 +130,13 @@ export const createFilterFromCustomFilterJaql = (attribute, customFilterJaql, gu
|
|
|
130
130
|
* @returns Filter object.
|
|
131
131
|
*/
|
|
132
132
|
export const createFilterFromJaqlInternal = (jaql, guid) => {
|
|
133
|
+
var _a, _b;
|
|
133
134
|
try {
|
|
134
135
|
if ('formula' in jaql) {
|
|
135
136
|
// generic pass-through JAQL filter will be used instead
|
|
136
137
|
throw new TranslatableError('errors.filter.formulaFiltersNotSupported', {
|
|
137
138
|
filter: JSON.stringify(jaql),
|
|
139
|
+
attributeName: (_b = (_a = jaql.title) !== null && _a !== void 0 ? _a : jaql.column) !== null && _b !== void 0 ? _b : jaql.dim,
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
const filterJaqlWrapperWithType = extractFilterTypeFromFilterJaql(jaql, jaql.datatype);
|
|
@@ -639,8 +639,14 @@ export declare type FilterRelationsModelCascadeNode = {
|
|
|
639
639
|
type: 'CascadingIdentifier';
|
|
640
640
|
levels: FilterRelationsModelIdNode[];
|
|
641
641
|
};
|
|
642
|
-
/**
|
|
642
|
+
/**
|
|
643
|
+
* Sorting direction, either in Ascending order, Descending order, or None
|
|
644
|
+
*/
|
|
643
645
|
export declare type SortDirection = 'sortAsc' | 'sortDesc' | 'sortNone';
|
|
646
|
+
/**
|
|
647
|
+
* @internal
|
|
648
|
+
*/
|
|
649
|
+
export declare function isSortDirection(sortDirection: unknown): sortDirection is SortDirection;
|
|
644
650
|
/**
|
|
645
651
|
* Sorting configuration for pivot "rows".
|
|
646
652
|
*
|
|
@@ -32,3 +32,10 @@ export const DEFAULT_PIVOT_GRAND_TOTALS = {
|
|
|
32
32
|
rows: false,
|
|
33
33
|
columns: false,
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export function isSortDirection(sortDirection) {
|
|
39
|
+
const SORT_DIRECTIONS = ['sortAsc', 'sortDesc', 'sortNone'];
|
|
40
|
+
return (typeof sortDirection === 'string' && SORT_DIRECTIONS.includes(sortDirection));
|
|
41
|
+
}
|
|
@@ -81,10 +81,12 @@ export declare const RankingSortTypes: {
|
|
|
81
81
|
* @param title - Title of the measure to be displayed in legend
|
|
82
82
|
* @param formula - Formula to be used for the measure
|
|
83
83
|
* @param context - Formula context as a map of strings to attributes, measures, or filters
|
|
84
|
+
* @param format - Optional format string for the measure
|
|
85
|
+
* @param description - Optional description of the measure
|
|
84
86
|
* @returns A calculated measure instance
|
|
85
87
|
* @group Advanced Analytics
|
|
86
88
|
*/
|
|
87
|
-
export declare const customFormula: (title: string, formula: string, context: CustomFormulaContext) => CalculatedMeasure;
|
|
89
|
+
export declare const customFormula: (title: string, formula: string, context: CustomFormulaContext, format?: string, description?: string) => CalculatedMeasure;
|
|
88
90
|
/**
|
|
89
91
|
* Creates an aggregated measure.
|
|
90
92
|
*
|
|
@@ -121,13 +121,15 @@ function measureFunction(measure, name, func, options) {
|
|
|
121
121
|
* @param title - Title of the measure to be displayed in legend
|
|
122
122
|
* @param formula - Formula to be used for the measure
|
|
123
123
|
* @param context - Formula context as a map of strings to attributes, measures, or filters
|
|
124
|
+
* @param format - Optional format string for the measure
|
|
125
|
+
* @param description - Optional description of the measure
|
|
124
126
|
* @returns A calculated measure instance
|
|
125
127
|
* @group Advanced Analytics
|
|
126
128
|
*/
|
|
127
|
-
export const customFormula = withComposeCodeForMeasure((title, formula, context) => {
|
|
129
|
+
export const customFormula = withComposeCodeForMeasure((title, formula, context, format, description) => {
|
|
128
130
|
// context keys must be in brackets
|
|
129
131
|
const newContext = Object.fromEntries(Object.entries(context).map(([key, val]) => [key.startsWith('[') ? key : `[${key}]`, val]));
|
|
130
|
-
return new DimensionalCalculatedMeasure(title, formula, newContext);
|
|
132
|
+
return new DimensionalCalculatedMeasure(title, formula, newContext, format, description);
|
|
131
133
|
}, 'customFormula');
|
|
132
134
|
function arithmetic(operand1, operator, operand2, name, withParentheses) {
|
|
133
135
|
const builder = [];
|
|
@@ -391,7 +391,9 @@ export function createMeasure(json) {
|
|
|
391
391
|
}
|
|
392
392
|
if (MetadataTypes.isCalculatedMeasure(json)) {
|
|
393
393
|
if (json.context === undefined) {
|
|
394
|
-
throw new TranslatableError('errors.measure.dimensionalCalculatedMeasure.noContext'
|
|
394
|
+
throw new TranslatableError('errors.measure.dimensionalCalculatedMeasure.noContext', {
|
|
395
|
+
measureName: name,
|
|
396
|
+
});
|
|
395
397
|
}
|
|
396
398
|
const context = {};
|
|
397
399
|
Object.getOwnPropertyNames(json.context).forEach((pname) => {
|
|
@@ -401,19 +403,21 @@ export function createMeasure(json) {
|
|
|
401
403
|
}
|
|
402
404
|
else if (MetadataTypes.isMeasureTemplate(json)) {
|
|
403
405
|
if (att === undefined) {
|
|
404
|
-
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAttributeDimExpression');
|
|
406
|
+
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAttributeDimExpression', { measureName: name });
|
|
405
407
|
}
|
|
406
408
|
return new DimensionalMeasureTemplate(name, att, format, desc, sort);
|
|
407
409
|
}
|
|
408
410
|
else if (MetadataTypes.isBaseMeasure(json)) {
|
|
409
411
|
if (att === undefined) {
|
|
410
|
-
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAttributeDimExpression');
|
|
412
|
+
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAttributeDimExpression', { measureName: name });
|
|
411
413
|
}
|
|
412
414
|
const agg = json.agg || json.aggregation;
|
|
413
415
|
if (!agg) {
|
|
414
|
-
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAggAggregation'
|
|
416
|
+
throw new TranslatableError('errors.measure.dimensionalBaseMeasure.noAggAggregation', {
|
|
417
|
+
measureName: name,
|
|
418
|
+
});
|
|
415
419
|
}
|
|
416
420
|
return new DimensionalBaseMeasure(name, att, agg, format, desc, sort);
|
|
417
421
|
}
|
|
418
|
-
throw new TranslatableError('errors.measure.unsupportedType');
|
|
422
|
+
throw new TranslatableError('errors.measure.unsupportedType', { measureName: name });
|
|
419
423
|
}
|
|
@@ -217,6 +217,7 @@ export declare type FormulaJaql = {
|
|
|
217
217
|
formula: string;
|
|
218
218
|
context?: Record<FormulaID, FormulaContext>;
|
|
219
219
|
datasource?: JaqlDataSource;
|
|
220
|
+
description?: string;
|
|
220
221
|
};
|
|
221
222
|
/** @internal */
|
|
222
223
|
export declare type BaseFilterJaql = IncludeAllFilterJaql | IncludeMembersFilterJaql | ExcludeMembersFilterJaql | NumericFilterJaql | ConditionFilterJaql | AndFilterJaql<NumericFilterJaql | ConditionFilterJaql> | OrFilterJaql<NumericFilterJaql | ConditionFilterJaql>;
|
|
@@ -4,26 +4,25 @@
|
|
|
4
4
|
export const translation = {
|
|
5
5
|
errors: {
|
|
6
6
|
measure: {
|
|
7
|
-
unsupportedType: 'Unsupported measure type',
|
|
7
|
+
unsupportedType: 'Unsupported measure type for measure: {{measureName}}',
|
|
8
8
|
dimensionalCalculatedMeasure: {
|
|
9
|
-
noContext: "DimensionalCalculatedMeasure must have 'context' property",
|
|
9
|
+
noContext: "DimensionalCalculatedMeasure {{measureName}} must have 'context' property",
|
|
10
10
|
},
|
|
11
11
|
dimensionalBaseMeasure: {
|
|
12
|
-
noAttributeDimExpression: "DimensionalBaseMeasure must have 'attribute'/'dim'/'expression' property",
|
|
13
|
-
noAggAggregation: "DimensionalBaseMeasure must have 'agg' or 'aggregation' property",
|
|
12
|
+
noAttributeDimExpression: "DimensionalBaseMeasure {{measureName}} must have 'attribute'/'dim'/'expression' property",
|
|
13
|
+
noAggAggregation: "DimensionalBaseMeasure {{measureName}} must have 'agg' or 'aggregation' property",
|
|
14
14
|
},
|
|
15
|
-
notAFormula: 'Jaql is not a formula',
|
|
16
15
|
},
|
|
17
|
-
|
|
16
|
+
dataModel: {
|
|
18
17
|
noName: "'name' must be specified in config for DataModel",
|
|
19
18
|
noMetadata: "'metadata' must be specified in config for DataModel",
|
|
20
19
|
},
|
|
21
20
|
filter: {
|
|
22
21
|
unsupportedType: 'Unsupported filter type: {{filterType}}',
|
|
23
|
-
unsupportedDatetimeLevel: 'Filters do not support the
|
|
22
|
+
unsupportedDatetimeLevel: 'Filters do not support the following "datetime" levels: Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds',
|
|
24
23
|
membersFilterNullMember: 'MembersFilter of {{attributeId}} - member cannot be null',
|
|
25
|
-
unsupportedConditionFilter: 'Jaql contains unsupported condition filter: {{filter}}',
|
|
26
|
-
formulaFiltersNotSupported: 'Formula-based filter not supported yet: {{filter}}',
|
|
24
|
+
unsupportedConditionFilter: 'Jaql for {{attributeName}} contains unsupported condition filter: {{filter}}',
|
|
25
|
+
formulaFiltersNotSupported: 'Formula-based filter for {{attributeName}} not supported yet: {{filter}}',
|
|
27
26
|
},
|
|
28
27
|
unsupportedDimensionalElement: 'Unsupported dimensional element type',
|
|
29
28
|
},
|
|
@@ -19,9 +19,8 @@ export declare const resources: {
|
|
|
19
19
|
noAttributeDimExpression: string;
|
|
20
20
|
noAggAggregation: string;
|
|
21
21
|
};
|
|
22
|
-
notAFormula: string;
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
dataModel: {
|
|
25
24
|
noName: string;
|
|
26
25
|
noMetadata: string;
|
|
27
26
|
};
|
|
@@ -46,9 +45,8 @@ export declare const resources: {
|
|
|
46
45
|
noAttributeDimExpression: string;
|
|
47
46
|
noAggAggregation: string;
|
|
48
47
|
};
|
|
49
|
-
notAFormula: string;
|
|
50
48
|
};
|
|
51
|
-
|
|
49
|
+
dataModel: {
|
|
52
50
|
noName: string;
|
|
53
51
|
noMetadata: string;
|
|
54
52
|
};
|
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
export const translation = {
|
|
5
5
|
errors: {
|
|
6
6
|
measure: {
|
|
7
|
-
unsupportedType: 'Непідтримуваний тип measure',
|
|
7
|
+
unsupportedType: 'Непідтримуваний тип measure: {{measureName}}',
|
|
8
8
|
dimensionalCalculatedMeasure: {
|
|
9
|
-
noContext: "DimensionalCalculatedMeasure має мати властивість 'context'",
|
|
9
|
+
noContext: "DimensionalCalculatedMeasure {{measureName}} має мати властивість 'context'",
|
|
10
10
|
},
|
|
11
11
|
dimensionalBaseMeasure: {
|
|
12
|
-
noAttributeDimExpression: "DimensionalBaseMeasure має мати властивість 'attribute'/'dim'/'expression'",
|
|
13
|
-
noAggAggregation: "DimensionalBaseMeasure має мати властивість 'agg' або 'aggregation'",
|
|
12
|
+
noAttributeDimExpression: "DimensionalBaseMeasure {{measureName}} має мати властивість 'attribute'/'dim'/'expression'",
|
|
13
|
+
noAggAggregation: "DimensionalBaseMeasure {{measureName}} має мати властивість 'agg' або 'aggregation'",
|
|
14
14
|
},
|
|
15
|
-
notAFormula: 'Jaql не формула',
|
|
16
15
|
},
|
|
17
|
-
|
|
16
|
+
dataModel: {
|
|
18
17
|
noName: "'name' має бути вказано в конфігурації для DataModel",
|
|
19
18
|
noMetadata: "'metadata' має бути вказано в конфігурації для DataModel",
|
|
20
19
|
},
|
|
@@ -22,8 +21,8 @@ export const translation = {
|
|
|
22
21
|
unsupportedType: 'Непідтримуваний тип фільтра: {{filterType}}',
|
|
23
22
|
unsupportedDatetimeLevel: 'Фільтри не підтримують наступні рівні "datetime": Hours, MinutesRoundTo30, MinutesRoundTo15, Minutes, Seconds',
|
|
24
23
|
membersFilterNullMember: 'MembersFilter у {{attributeId}} - member не може бути нульовим',
|
|
25
|
-
unsupportedConditionFilter: 'Jaql містить непідтримуваний condition фільтр: {{filter}}',
|
|
26
|
-
formulaFiltersNotSupported: 'Фільтри, що містять формули наразі не підтримуються: {{filter}}',
|
|
24
|
+
unsupportedConditionFilter: 'Jaql для {{attributeName}} містить непідтримуваний condition фільтр: {{filter}}',
|
|
25
|
+
formulaFiltersNotSupported: 'Фільтри, що містять формули для {{attributeName}} наразі не підтримуються: {{filter}}',
|
|
27
26
|
},
|
|
28
27
|
unsupportedDimensionalElement: 'Непідтримуваний тип елемента',
|
|
29
28
|
},
|