@sisense/sdk-data 1.24.0 → 1.26.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.
Files changed (44) hide show
  1. package/dist/cjs/dimensional-model/base.js +1 -1
  2. package/dist/cjs/dimensional-model/filter-relations.d.ts +9 -0
  3. package/dist/cjs/dimensional-model/filter-relations.js +18 -0
  4. package/dist/cjs/dimensional-model/filters/factory.d.ts +84 -85
  5. package/dist/cjs/dimensional-model/filters/factory.js +126 -127
  6. package/dist/cjs/dimensional-model/filters/filter-config-utils.d.ts +25 -0
  7. package/dist/cjs/dimensional-model/filters/filter-config-utils.js +49 -0
  8. package/dist/cjs/dimensional-model/filters/filters.d.ts +22 -45
  9. package/dist/cjs/dimensional-model/filters/filters.js +51 -95
  10. package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -4
  11. package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +35 -28
  12. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +9 -5
  13. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +32 -8
  14. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +17 -27
  15. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +37 -39
  16. package/dist/cjs/dimensional-model/interfaces.d.ts +113 -15
  17. package/dist/cjs/dimensional-model/types.d.ts +11 -11
  18. package/dist/cjs/index.d.ts +2 -0
  19. package/dist/cjs/index.js +2 -0
  20. package/dist/cjs/utils.d.ts +5 -3
  21. package/dist/cjs/utils.js +33 -9
  22. package/dist/dimensional-model/base.js +1 -1
  23. package/dist/dimensional-model/filter-relations.d.ts +9 -0
  24. package/dist/dimensional-model/filter-relations.js +14 -0
  25. package/dist/dimensional-model/filters/factory.d.ts +84 -85
  26. package/dist/dimensional-model/filters/factory.js +126 -127
  27. package/dist/dimensional-model/filters/filter-config-utils.d.ts +25 -0
  28. package/dist/dimensional-model/filters/filter-config-utils.js +39 -0
  29. package/dist/dimensional-model/filters/filters.d.ts +22 -45
  30. package/dist/dimensional-model/filters/filters.js +51 -95
  31. package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -4
  32. package/dist/dimensional-model/filters/utils/condition-filter-util.js +35 -28
  33. package/dist/dimensional-model/filters/utils/filter-code-util.d.ts +9 -5
  34. package/dist/dimensional-model/filters/utils/filter-code-util.js +32 -8
  35. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +17 -27
  36. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +36 -37
  37. package/dist/dimensional-model/interfaces.d.ts +113 -15
  38. package/dist/dimensional-model/types.d.ts +11 -11
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +2 -0
  41. package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
  42. package/dist/utils.d.ts +5 -3
  43. package/dist/utils.js +31 -7
  44. package/package.json +3 -3
@@ -1,13 +1,17 @@
1
1
  /**
2
- * Stringifies the argument
2
+ * Stringifies the argument, with an option to exclude specific properties.
3
3
  *
4
- * @param arg - argument to stringify
5
- * @returns stringified argument
4
+ * @param arg - The argument to stringify.
5
+ * @param excludeProps - Optional array of property names to exclude when stringifying objects.
6
+ * @returns The stringified representation of the argument.
6
7
  */
7
- export declare function stringifyHelper(arg: any): string;
8
+ export declare function stringifyHelper(arg: any, excludeProps?: string[]): string;
8
9
  /**
9
10
  * High order function to construct compose code for filter factory functions
10
11
  *
11
12
  * @param func - filter factory function
13
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
14
+ * @param ignoreIndexes - Indexes of parameters to ignore in the generated composeCode
15
+ * @returns filter factory function with composeCode property added to the filter
12
16
  */
13
- export declare function withComposeCode(func: (...args: any[]) => any): (...args: any[]) => any;
17
+ export declare function withComposeCode<T extends (...args: any[]) => any>(func: T, funcName?: string, ignoreIndexes?: number[]): T;
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Stringifies the argument
2
+ * Stringifies the argument, with an option to exclude specific properties.
3
3
  *
4
- * @param arg - argument to stringify
5
- * @returns stringified argument
4
+ * @param arg - The argument to stringify.
5
+ * @param excludeProps - Optional array of property names to exclude when stringifying objects.
6
+ * @returns The stringified representation of the argument.
6
7
  */
7
- export function stringifyHelper(arg) {
8
+ export function stringifyHelper(arg, excludeProps = []) {
8
9
  try {
9
10
  if (arg === null || arg === undefined) {
10
11
  return JSON.stringify(arg);
@@ -16,7 +17,7 @@ export function stringifyHelper(arg) {
16
17
  return ('[' +
17
18
  arg
18
19
  .map((e) => {
19
- return stringifyHelper(e);
20
+ return stringifyHelper(e, excludeProps);
20
21
  })
21
22
  .join(', ') +
22
23
  ']');
@@ -27,6 +28,19 @@ export function stringifyHelper(arg) {
27
28
  if (typeof arg === 'number' || !isNaN(arg)) {
28
29
  return arg;
29
30
  }
31
+ if (typeof arg === 'object') {
32
+ const filteredObject = Object.keys(arg)
33
+ .filter((key) => !excludeProps.includes(key))
34
+ .reduce((acc, key) => {
35
+ acc[key] = arg[key];
36
+ return acc;
37
+ }, {});
38
+ // Check if the filtered object is empty
39
+ if (Object.keys(filteredObject).length === 0) {
40
+ return '';
41
+ }
42
+ return JSON.stringify(filteredObject);
43
+ }
30
44
  }
31
45
  catch (e) {
32
46
  console.error(e);
@@ -37,16 +51,26 @@ export function stringifyHelper(arg) {
37
51
  * High order function to construct compose code for filter factory functions
38
52
  *
39
53
  * @param func - filter factory function
54
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
55
+ * @param ignoreIndexes - Indexes of parameters to ignore in the generated composeCode
56
+ * @returns filter factory function with composeCode property added to the filter
40
57
  */
41
- export function withComposeCode(func) {
58
+ export function withComposeCode(func, funcName, ignoreIndexes = []) {
42
59
  return function (...args) {
43
60
  const argValues = args
44
- .map(stringifyHelper)
61
+ .map((arg, index) => {
62
+ if (ignoreIndexes.includes(index)) {
63
+ return ''; // Placeholder for ignored parameters
64
+ }
65
+ return stringifyHelper(arg, ['guid']);
66
+ })
45
67
  .join(', ')
46
68
  // remove any number of trailing commas
47
69
  .replace(/(,\s*)+$/, '');
48
- const signature = `filterFactory.${func.name}(${argValues})`;
70
+ const signature = `filterFactory.${funcName !== null && funcName !== void 0 ? funcName : func.name}(${argValues})`;
71
+ // Call the original function and get the filter
49
72
  const filter = func(...args);
73
+ // Add the composeCode property
50
74
  filter.composeCode = signature;
51
75
  return filter;
52
76
  };
@@ -1,5 +1,5 @@
1
- import { BaseFilterJaql, ConditionFilterJaql, FilterJaqlInternal, PeriodFilterJaql, RangeFilterJaql, SpecificItemsFilterJaql } from './types.js';
2
- import { Attribute, BaseMeasure, Filter, LevelAttribute } from '../../interfaces.js';
1
+ import { BaseFilterJaql, FilterJaqlInternal, PeriodFilterJaql, RangeFilterJaql, SpecificItemsFilterJaql } from './types.js';
2
+ import { Attribute, Filter, LevelAttribute } from '../../interfaces.js';
3
3
  import { FilterJaql } 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.
@@ -8,75 +8,65 @@ import { FilterJaql } from '../../types.js';
8
8
  * @param guid - Optional GUID for the filter
9
9
  * @returns A generic Filter object.
10
10
  */
11
- export declare const createGenericFilter: (jaql: FilterJaql | FilterJaqlInternal, guid?: string) => Filter;
11
+ export declare const createGenericFilter: (jaql: FilterJaql | FilterJaqlInternal, guid: string) => Filter;
12
12
  /**
13
13
  * Creates a filter that includes all members of the attribute.
14
14
  *
15
15
  * @param attribute - The attribute.
16
- * @param guid - Optional GUID for the filter
16
+ * @param guid - GUID for the filter
17
17
  * @returns The created Filter object.
18
18
  */
19
- export declare const createFilterIncludeAll: (attribute: Attribute, guid?: string) => Filter;
19
+ export declare const createFilterIncludeAll: (attribute: Attribute, guid: string) => Filter;
20
20
  /**
21
21
  * Creates a filter from a specific items filter JAQL object.
22
22
  *
23
23
  * @param attribute - attribute
24
24
  * @param specificItemsFilterJaql - Specific Items Filter Jaql
25
- * @param guid - Optional GUID for the filter
25
+ * @param guid - GUID for the filter
26
26
  * @returns Filter object
27
27
  */
28
- export declare const createFilterFromSpecificItemsFilterJaql: (attribute: Attribute, specificItemsFilterJaql: SpecificItemsFilterJaql, guid?: string, multiSelection?: boolean) => 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
  *
32
32
  * @param attribute - attribute
33
33
  * @param rangeFilterJaql - Range Filter Jaql
34
- * @param guid - Optional GUID for the filter
34
+ * @param guid - GUID for the filter
35
35
  * @returns Filter object
36
36
  */
37
- export declare const createFilterFromDateRangeFilterJaql: (attribute: LevelAttribute, rangeFilterJaql: RangeFilterJaql, guid?: string) => Filter;
37
+ export declare const createFilterFromDateRangeFilterJaql: (attribute: LevelAttribute, rangeFilterJaql: RangeFilterJaql, guid: string) => Filter;
38
38
  /**
39
39
  * Creates a filter from a numeric range filter JAQL object.
40
40
  *
41
41
  * @param attribute - attribute
42
42
  * @param rangeFilterJaql - Range Filter Jaql
43
- * @param guid - Optional GUID for the filter
43
+ * @param guid - GUID for the filter
44
44
  * @returns Filter object
45
45
  */
46
- export declare const createFilterFromNumericRangeJaql: (attribute: Attribute, rangeFilterJaql: RangeFilterJaql, guid?: string) => Filter;
46
+ export declare const createFilterFromNumericRangeJaql: (attribute: Attribute, rangeFilterJaql: RangeFilterJaql, guid: string) => Filter;
47
47
  /**
48
48
  * Creates a filter from a period filter JAQL object.
49
49
  *
50
50
  * @param attribute - attribute
51
51
  * @param periodFilterJaql - Period Filter Jaql
52
- * @param guid - Optional GUID for the filter
52
+ * @param guid - GUID for the filter
53
53
  * @returns Filter object
54
54
  */
55
- export declare const createFilterFromPeriodFilterJaql: (attribute: LevelAttribute, periodFilterJaql: PeriodFilterJaql, guid?: string) => Filter;
56
- /**
57
- * Creates a filter from a condition filter JAQL object.
58
- *
59
- * @param attribute - attribute
60
- * @param conditionFilterJaql - Condition Filter Jaql
61
- * @param measure - measure
62
- * @param guid - Optional GUID for the filter
63
- * @returns Filter object
64
- */
65
- export declare const createFilterFromConditionFilterJaql: (attribute: Attribute, conditionFilterJaql: ConditionFilterJaql, measure?: BaseMeasure, guid?: string) => Filter;
55
+ export declare const createFilterFromPeriodFilterJaql: (attribute: LevelAttribute, periodFilterJaql: PeriodFilterJaql, guid: string) => Filter;
66
56
  /**
67
57
  * Creates a filter from a custom filter JAQL object.
68
58
  *
69
59
  * @param attribute - attribute
70
60
  * @param customFilterJaql - Custom Filter Jaql
71
- * @param guid - Optional GUID for the filter
61
+ * @param guid - GUID for the filter
72
62
  * @returns Filter object
73
63
  */
74
- export declare const createFilterFromCustomFilterJaql: (attribute: Attribute, customFilterJaql: BaseFilterJaql, guid?: string) => Filter;
64
+ export declare const createFilterFromCustomFilterJaql: (attribute: Attribute, customFilterJaql: BaseFilterJaql, guid: string) => Filter;
75
65
  /**
76
66
  * Creates a filter from a filter JAQL object.
77
67
  *
78
68
  * @param jaql - The filter JAQL object.
79
- * @param guid - Optional GUID for the filter
69
+ * @param guid - GUID for the filter
80
70
  * @returns Filter object.
81
71
  */
82
- export declare const createFilterFromJaqlInternal: (jaql: FilterJaqlInternal, guid?: string) => Filter;
72
+ export declare const createFilterFromJaqlInternal: (jaql: FilterJaqlInternal, guid: string) => Filter;
@@ -4,8 +4,8 @@ import { createAttributeFilterFromConditionFilterJaql, createMeasureFilterFromCo
4
4
  import { extractFilterTypeFromFilterJaql } from './filter-types-util.js';
5
5
  import { withComposeCode } from './filter-code-util.js';
6
6
  import { createAttributeFromFilterJaql, createMeasureFromFilterJaql, } from './attribute-measure-util.js';
7
- import { guidFast } from '../../../utils.js';
8
7
  import { TranslatableError } from '../../../translation/translatable-error.js';
8
+ import { getDefaultBaseFilterConfig, simplifyFilterConfig } from '../filter-config-utils.js';
9
9
  /**
10
10
  * Creates a generic filter (aka pass-through JAQL filter) if the JAQL cannot be translated to a specific filter type.
11
11
  *
@@ -15,7 +15,7 @@ import { TranslatableError } from '../../../translation/translatable-error.js';
15
15
  */
16
16
  export const createGenericFilter = (jaql, guid) => {
17
17
  return {
18
- guid: guid || guidFast(13),
18
+ config: Object.assign(Object.assign({}, getDefaultBaseFilterConfig()), { guid, originalFilterJaql: jaql }),
19
19
  jaql: (nested) => {
20
20
  if (nested) {
21
21
  return jaql;
@@ -41,31 +41,40 @@ export const createGenericFilter = (jaql, guid) => {
41
41
  * Creates a filter that includes all members of the attribute.
42
42
  *
43
43
  * @param attribute - The attribute.
44
- * @param guid - Optional GUID for the filter
44
+ * @param guid - GUID for the filter
45
45
  * @returns The created Filter object.
46
46
  */
47
47
  export const createFilterIncludeAll = (attribute, guid) => {
48
48
  // including all members is equivalent to excluding none
49
49
  // so we can simply create a filter with no members and excludeMembers set to true
50
- return withComposeCode(filterFactory.members)(attribute, [], true, guid);
50
+ const config = {
51
+ guid,
52
+ excludeMembers: true,
53
+ };
54
+ return withComposeCode(filterFactory.members, 'members')(attribute, [], config);
51
55
  };
52
56
  /**
53
57
  * Creates a filter from a specific items filter JAQL object.
54
58
  *
55
59
  * @param attribute - attribute
56
60
  * @param specificItemsFilterJaql - Specific Items Filter Jaql
57
- * @param guid - Optional GUID for the filter
61
+ * @param guid - GUID for the filter
58
62
  * @returns Filter object
59
63
  */
60
64
  export const createFilterFromSpecificItemsFilterJaql = (attribute, specificItemsFilterJaql, guid, multiSelection) => {
61
65
  const deactivatedMembers = getDeactivatedMembersFromFilterJaql(specificItemsFilterJaql);
62
66
  const activeMembers = getActiveMembersFromFilterJaql(specificItemsFilterJaql, deactivatedMembers);
63
- return withComposeCode(filterFactory.members)(attribute, activeMembers, undefined, // use undefined instead of false to avoid including the property in composeCode
64
- guid, deactivatedMembers, undefined, multiSelection);
67
+ const config = simplifyFilterConfig({
68
+ guid,
69
+ excludeMembers: false,
70
+ enableMultiSelection: multiSelection !== null && multiSelection !== void 0 ? multiSelection : true,
71
+ deactivatedMembers,
72
+ });
73
+ return withComposeCode(filterFactory.members, 'members')(attribute, activeMembers, config);
65
74
  };
66
75
  function getDeactivatedMembersFromFilterJaql(filterJaql) {
67
- var _a, _b, _c;
68
- return ((_a = filterJaql.filter) === null || _a === void 0 ? void 0 : _a.turnedOff) ? (_c = (_b = filterJaql.filter) === null || _b === void 0 ? void 0 : _b.exclude) === null || _c === void 0 ? void 0 : _c.members : undefined;
76
+ var _a, _b, _c, _d;
77
+ return ((_a = filterJaql.filter) === null || _a === void 0 ? void 0 : _a.turnedOff) ? (_d = (_c = (_b = filterJaql.filter) === null || _b === void 0 ? void 0 : _b.exclude) === null || _c === void 0 ? void 0 : _c.members) !== null && _d !== void 0 ? _d : [] : [];
69
78
  }
70
79
  function getActiveMembersFromFilterJaql(filterJaql, deactivatedMembers) {
71
80
  const allMembers = filterJaql.members;
@@ -78,54 +87,37 @@ function getActiveMembersFromFilterJaql(filterJaql, deactivatedMembers) {
78
87
  *
79
88
  * @param attribute - attribute
80
89
  * @param rangeFilterJaql - Range Filter Jaql
81
- * @param guid - Optional GUID for the filter
90
+ * @param guid - GUID for the filter
82
91
  * @returns Filter object
83
92
  */
84
93
  export const createFilterFromDateRangeFilterJaql = (attribute, rangeFilterJaql, guid) => {
85
- return withComposeCode(filterFactory.dateRange)(attribute, rangeFilterJaql.from, rangeFilterJaql.to, guid);
94
+ return withComposeCode(filterFactory.dateRange, 'dateRange')(attribute, rangeFilterJaql.from, rangeFilterJaql.to, { guid });
86
95
  };
87
96
  /**
88
97
  * Creates a filter from a numeric range filter JAQL object.
89
98
  *
90
99
  * @param attribute - attribute
91
100
  * @param rangeFilterJaql - Range Filter Jaql
92
- * @param guid - Optional GUID for the filter
101
+ * @param guid - GUID for the filter
93
102
  * @returns Filter object
94
103
  */
95
104
  export const createFilterFromNumericRangeJaql = (attribute, rangeFilterJaql, guid) => {
96
- return withComposeCode(filterFactory.between)(attribute, rangeFilterJaql.from, rangeFilterJaql.to, guid);
105
+ return withComposeCode(filterFactory.between, 'between')(attribute, rangeFilterJaql.from, rangeFilterJaql.to, { guid });
97
106
  };
98
107
  /**
99
108
  * Creates a filter from a period filter JAQL object.
100
109
  *
101
110
  * @param attribute - attribute
102
111
  * @param periodFilterJaql - Period Filter Jaql
103
- * @param guid - Optional GUID for the filter
112
+ * @param guid - GUID for the filter
104
113
  * @returns Filter object
105
114
  */
106
115
  export const createFilterFromPeriodFilterJaql = (attribute, periodFilterJaql, guid) => {
107
116
  if (periodFilterJaql.last) {
108
- return withComposeCode(filterFactory.dateRelativeTo)(attribute, periodFilterJaql.last.offset, periodFilterJaql.last.count, periodFilterJaql.last.anchor, guid);
109
- }
110
- else {
111
- return withComposeCode(filterFactory.dateRelativeFrom)(attribute, periodFilterJaql.next.offset, periodFilterJaql.next.count, periodFilterJaql.next.anchor, guid);
112
- }
113
- };
114
- /**
115
- * Creates a filter from a condition filter JAQL object.
116
- *
117
- * @param attribute - attribute
118
- * @param conditionFilterJaql - Condition Filter Jaql
119
- * @param measure - measure
120
- * @param guid - Optional GUID for the filter
121
- * @returns Filter object
122
- */
123
- export const createFilterFromConditionFilterJaql = (attribute, conditionFilterJaql, measure, guid) => {
124
- if (measure) {
125
- return createMeasureFilterFromConditionFilterJaql(measure, conditionFilterJaql, guid);
117
+ return withComposeCode(filterFactory.dateRelativeTo, 'dateRelativeTo')(attribute, periodFilterJaql.last.offset, periodFilterJaql.last.count, periodFilterJaql.last.anchor, { guid });
126
118
  }
127
119
  else {
128
- return createAttributeFilterFromConditionFilterJaql(attribute, conditionFilterJaql, guid);
120
+ return withComposeCode(filterFactory.dateRelativeFrom, 'dateRelativeFrom')(attribute, periodFilterJaql.next.offset, periodFilterJaql.next.count, periodFilterJaql.next.anchor, { guid });
129
121
  }
130
122
  };
131
123
  /**
@@ -133,17 +125,19 @@ export const createFilterFromConditionFilterJaql = (attribute, conditionFilterJa
133
125
  *
134
126
  * @param attribute - attribute
135
127
  * @param customFilterJaql - Custom Filter Jaql
136
- * @param guid - Optional GUID for the filter
128
+ * @param guid - GUID for the filter
137
129
  * @returns Filter object
138
130
  */
139
131
  export const createFilterFromCustomFilterJaql = (attribute, customFilterJaql, guid) => {
140
- return withComposeCode(filterFactory.customFilter)(attribute, customFilterJaql, guid);
132
+ return withComposeCode(filterFactory.customFilter, 'customFilter')(attribute, customFilterJaql, {
133
+ guid,
134
+ });
141
135
  };
142
136
  /**
143
137
  * Creates a filter from a filter JAQL object.
144
138
  *
145
139
  * @param jaql - The filter JAQL object.
146
- * @param guid - Optional GUID for the filter
140
+ * @param guid - GUID for the filter
147
141
  * @returns Filter object.
148
142
  */
149
143
  export const createFilterFromJaqlInternal = (jaql, guid) => {
@@ -165,7 +159,12 @@ export const createFilterFromJaqlInternal = (jaql, guid) => {
165
159
  case FILTER_TYPES.SPECIFIC_ITEMS:
166
160
  return createFilterFromSpecificItemsFilterJaql(attribute, filterJaqlWithType, guid, filterJaqlWithType.multiSelection);
167
161
  case FILTER_TYPES.CONDITION:
168
- return createFilterFromConditionFilterJaql(attribute, filterJaqlWithType, measure, guid);
162
+ if (measure) {
163
+ return createMeasureFilterFromConditionFilterJaql(measure, filterJaqlWithType, guid);
164
+ }
165
+ else {
166
+ return createAttributeFilterFromConditionFilterJaql(attribute, filterJaqlWithType, guid);
167
+ }
169
168
  case FILTER_TYPES.DATE_RANGE:
170
169
  return createFilterFromDateRangeFilterJaql(attribute, filterJaqlWithType, guid);
171
170
  case FILTER_TYPES.PERIOD:
@@ -1,5 +1,5 @@
1
1
  import { DataSource } from '../interfaces.js';
2
- import { JaqlDataSource, Sort } from './types.js';
2
+ import { FilterJaql, JaqlDataSource, Sort } from './types.js';
3
3
  /**
4
4
  * @internal
5
5
  */
@@ -339,15 +339,106 @@ export interface LevelAttribute extends Attribute {
339
339
  };
340
340
  }
341
341
  /**
342
- * Base interface for filter. See {@link filterFactory} for how to create filters.
342
+ * Base filter configuration
343
343
  */
344
- export interface Filter extends Element {
344
+ export interface BaseFilterConfig {
345
+ /**
346
+ * Optional filter identifier
347
+ *
348
+ * If not provided, a unique identifier will be generated.
349
+ *
350
+ * @category Base Configurations
351
+ */
352
+ readonly guid?: string;
353
+ /**
354
+ * Original filter JAQL
355
+ *
356
+ * @category Base Configurations
357
+ * @internal
358
+ */
359
+ originalFilterJaql?: FilterJaql;
360
+ /**
361
+ * Boolean flag whether the filter is disabled
362
+ *
363
+ * If not specified, the default value is `false`.
364
+ *
365
+ * @category Base Configurations
366
+ */
367
+ disabled?: boolean;
368
+ /**
369
+ * Boolean flag whether the filter is locked
370
+ *
371
+ * If not specified, the default value is `false`.
372
+ *
373
+ * @category Base Configurations
374
+ */
375
+ locked?: boolean;
376
+ }
377
+ /**
378
+ * Complete configuration for base filter
379
+ *
380
+ * All properties are required except for originalFilterJaql
381
+ *
382
+ * @internal
383
+ */
384
+ export declare type CompleteBaseFilterConfig = Required<Omit<BaseFilterConfig, 'originalFilterJaql'>> & {
385
+ originalFilterJaql?: FilterJaql;
386
+ };
387
+ /**
388
+ * Configurations for members filter
389
+ */
390
+ export interface MembersFilterConfig extends BaseFilterConfig {
391
+ /**
392
+ * Boolean flag whether selected members are excluded or included in the filter
393
+ *
394
+ * If not specified, the default value is false.
395
+ *
396
+ * @category Extended Configurations
397
+ */
398
+ excludeMembers?: boolean;
399
+ /**
400
+ * Boolean flag whether selection of multiple members is enabled
401
+ *
402
+ * If not specified, the default value is `true`.
403
+ *
404
+ * @category Extended Configurations
405
+ */
406
+ enableMultiSelection?: boolean;
345
407
  /**
346
- * Global filter identifier
408
+ * Optional list of members to be shown as deactivated in the `MemberFilterTile` component.
409
+ *
410
+ * This list should not contain members that are already included in the filter.
411
+ *
412
+ * @category Extended Configurations
347
413
  */
348
- readonly guid: string;
414
+ deactivatedMembers?: string[];
415
+ /**
416
+ * Optional filter to be applied in the background
417
+ */
418
+ backgroundFilter?: Filter;
419
+ }
420
+ /**
421
+ * Complete configuration for members filter
422
+ *
423
+ * All properties are required except for originalFilterJaql and backgroundFilter
424
+ *
425
+ * @internal
426
+ */
427
+ export declare type CompleteMembersFilterConfig = Required<Omit<MembersFilterConfig, 'originalFilterJaql' | 'backgroundFilter'>> & {
428
+ originalFilterJaql?: FilterJaql;
429
+ backgroundFilter?: Filter;
430
+ };
431
+ /**
432
+ * @internal
433
+ */
434
+ export declare type FilterConfig = CompleteBaseFilterConfig | CompleteMembersFilterConfig;
435
+ /**
436
+ * Base interface for filter. See {@link filterFactory} for how to create filters.
437
+ */
438
+ export interface Filter extends Element {
349
439
  /**
350
440
  * Attribute this filter instance is filtering
441
+ * @internal
351
442
  */
352
443
  readonly attribute: Attribute;
353
444
  /**
@@ -356,20 +447,15 @@ export interface Filter extends Element {
356
447
  readonly filterType: string;
357
448
  /**
358
449
  * Boolean flag whether the filter is a scope filter
359
- */
360
- isScope: boolean;
361
- /**
362
- * Boolean flag whether the filter is disabled
363
- *
364
450
  * @internal
365
451
  */
366
- disabled: boolean;
452
+ isScope: boolean;
367
453
  /**
368
- * Boolean flag whether the filter is locked
454
+ * Filter config
369
455
  *
370
456
  * @internal
371
457
  */
372
- locked: boolean;
458
+ config: FilterConfig;
373
459
  /**
374
460
  * Gets JAQL representing this Filter instance
375
461
  *
@@ -436,7 +522,7 @@ export declare type FilterRelationsNode = Filter | Filter[] | FilterRelations;
436
522
  *
437
523
  * @internal
438
524
  */
439
- export declare type FilterRelationsModelNode = FilterRelationsModelIdNode | FilterRelationsModelBracketNode | FilterRelationsModel;
525
+ export declare type FilterRelationsModelNode = FilterRelationsModelIdNode | FilterRelationsModelCascadeNode | FilterRelationsModelBracketNode | FilterRelationsModel;
440
526
  /**
441
527
  * A node or a subtree of a {@link FilterRelationsJaql} tree
442
528
  *
@@ -456,11 +542,12 @@ export interface FilterRelations {
456
542
  operator: 'AND' | 'OR';
457
543
  }
458
544
  /**
459
- * Incoming filter logical relations (AND/OR) when fetched from the instance
545
+ * Model of filter logical relations (AND/OR) from Fusion dashboard
460
546
  *
461
547
  * @internal
462
548
  */
463
549
  export interface FilterRelationsModel {
550
+ type: 'LogicalExpression';
464
551
  left: FilterRelationsModelNode;
465
552
  right: FilterRelationsModelNode;
466
553
  operator: 'AND' | 'OR';
@@ -489,6 +576,7 @@ export declare type FilterRelationsJaqlIdNode = {
489
576
  * @internal
490
577
  */
491
578
  export declare type FilterRelationsModelIdNode = {
579
+ type: 'Identifier';
492
580
  instanceId: string;
493
581
  };
494
582
  /**
@@ -497,8 +585,18 @@ export declare type FilterRelationsModelIdNode = {
497
585
  * @internal
498
586
  */
499
587
  export declare type FilterRelationsModelBracketNode = {
588
+ type: 'ParenthesizedLogicalExpression';
500
589
  value: FilterRelationsModelNode;
501
590
  };
591
+ /**
592
+ * A node of a {@link FilterRelationsModel} tree that represents a cascading filter
593
+ *
594
+ * @internal
595
+ */
596
+ export declare type FilterRelationsModelCascadeNode = {
597
+ type: 'CascadingIdentifier';
598
+ levels: FilterRelationsModelIdNode[];
599
+ };
502
600
  /** Sorting direction, either in Ascending order, Descending order, or None */
503
601
  export declare type SortDirection = 'sortAsc' | 'sortDesc' | 'sortNone';
504
602
  /**
@@ -211,40 +211,40 @@ export declare type FormulaJaql = {
211
211
  context?: Record<FormulaID, FormulaContext>;
212
212
  };
213
213
  /** @internal */
214
- export declare type BaseFilter = IncludeAllFilter | IncludeMembersFilter | ExcludeMembersFilter | JaqlNumericFilter | ConditionFilterJaql | AndFilter<JaqlNumericFilter | ConditionFilterJaql> | OrFilter<JaqlNumericFilter | ConditionFilterJaql>;
214
+ export declare type BaseFilterJaql = IncludeAllFilterJaql | IncludeMembersFilterJaql | ExcludeMembersFilterJaql | NumericFilterJaql | ConditionFilterJaql | AndFilterJaql<NumericFilterJaql | ConditionFilterJaql> | OrFilterJaql<NumericFilterJaql | ConditionFilterJaql>;
215
215
  /** @internal */
216
- export declare type BackgroundFilter = BaseFilter & {
216
+ export declare type BackgroundFilterJaql = BaseFilterJaql & {
217
217
  level?: 'string';
218
218
  };
219
219
  /** @internal */
220
- export declare type IncludeAllFilter = {
220
+ export declare type IncludeAllFilterJaql = {
221
221
  all: true;
222
222
  };
223
223
  /** @internal */
224
- export declare type IncludeMembersFilter = {
224
+ export declare type IncludeMembersFilterJaql = {
225
225
  members: string[];
226
226
  multiSelection?: boolean;
227
227
  };
228
228
  /** @internal */
229
- export declare type ExcludeMembersFilter = {
229
+ export declare type ExcludeMembersFilterJaql = {
230
230
  exclude: {
231
231
  members: string[];
232
232
  };
233
233
  multiSelection?: boolean;
234
234
  };
235
235
  /** @internal */
236
- export declare type TurnOffMembersFilter = ExcludeMembersFilter & {
236
+ export declare type TurnOffMembersFilterJaql = ExcludeMembersFilterJaql & {
237
237
  turnedOff: boolean;
238
238
  };
239
239
  /** @internal */
240
240
  export declare type FilterJaql = BaseJaql & {
241
- filter: BaseFilter & {
242
- filter?: BackgroundFilter | TurnOffMembersFilter;
241
+ filter: BaseFilterJaql & {
242
+ filter?: BackgroundFilterJaql | TurnOffMembersFilterJaql;
243
243
  };
244
244
  };
245
245
  declare type NumericFilterValue = number | FormulaJaql;
246
246
  /** @internal */
247
- export declare type JaqlNumericFilter = {
247
+ export declare type NumericFilterJaql = {
248
248
  equals?: NumericFilterValue;
249
249
  doesntEqual?: NumericFilterValue;
250
250
  toNotEqual?: NumericFilterValue;
@@ -257,11 +257,11 @@ export declare type JaqlNumericFilter = {
257
257
  '>='?: NumericFilterValue;
258
258
  '<='?: NumericFilterValue;
259
259
  };
260
- declare type AndFilter<FilterItem> = {
260
+ declare type AndFilterJaql<FilterItem> = {
261
261
  and: FilterItem[];
262
262
  };
263
263
  /** @internal */
264
- export declare type OrFilter<FilterItem> = {
264
+ export declare type OrFilterJaql<FilterItem> = {
265
265
  or: FilterItem[];
266
266
  };
267
267
  /**
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from './dimensional-model/dimensions.js';
16
16
  export * from './dimensional-model/factory.js';
17
17
  export * from './dimensional-model/jaql-element.js';
18
18
  export * from './dimensional-model/filters/filters.js';
19
+ export * from './dimensional-model/filters/filter-config-utils.js';
19
20
  export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
20
21
  /**
21
22
  * Functions to create date, text, or numeric filters on specified data.
@@ -85,6 +86,7 @@ export * from './dimensional-model/measures/measures.js';
85
86
  */
86
87
  export * as measureFactory from './dimensional-model/measures/factory.js';
87
88
  export * from './dimensional-model/simple-column-types.js';
89
+ export * from './dimensional-model/filter-relations.js';
88
90
  /**
89
91
  * Functions to create elements for advanced analytics – for example, attributes and measures for constructing a custom Boxplot chart
90
92
  *
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ export * from './dimensional-model/dimensions.js';
16
16
  export * from './dimensional-model/factory.js';
17
17
  export * from './dimensional-model/jaql-element.js';
18
18
  export * from './dimensional-model/filters/filters.js';
19
+ export * from './dimensional-model/filters/filter-config-utils.js';
19
20
  export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
20
21
  /**
21
22
  * Functions to create date, text, or numeric filters on specified data.
@@ -85,6 +86,7 @@ export * from './dimensional-model/measures/measures.js';
85
86
  */
86
87
  export * as measureFactory from './dimensional-model/measures/factory.js';
87
88
  export * from './dimensional-model/simple-column-types.js';
89
+ export * from './dimensional-model/filter-relations.js';
88
90
  /**
89
91
  * Functions to create elements for advanced analytics – for example, attributes and measures for constructing a custom Boxplot chart
90
92
  *