@sisense/sdk-data 1.10.1 → 1.12.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 (109) hide show
  1. package/dist/cjs/dimensional-model/analytics/factory.d.ts +47 -0
  2. package/dist/cjs/dimensional-model/analytics/factory.js +151 -0
  3. package/dist/cjs/dimensional-model/analytics/factory.test.d.ts +1 -0
  4. package/dist/cjs/dimensional-model/analytics/factory.test.js +99 -0
  5. package/dist/cjs/dimensional-model/attributes.d.ts +139 -0
  6. package/dist/cjs/dimensional-model/attributes.js +342 -0
  7. package/dist/cjs/dimensional-model/attributes.test.d.ts +1 -0
  8. package/dist/cjs/dimensional-model/attributes.test.js +154 -0
  9. package/dist/cjs/dimensional-model/base.d.ts +43 -0
  10. package/dist/cjs/dimensional-model/base.js +58 -0
  11. package/dist/cjs/dimensional-model/base.test.d.ts +1 -0
  12. package/dist/cjs/dimensional-model/base.test.js +17 -0
  13. package/dist/cjs/dimensional-model/data-model.d.ts +13 -0
  14. package/dist/cjs/dimensional-model/data-model.js +37 -0
  15. package/dist/cjs/dimensional-model/dimensions.d.ts +167 -0
  16. package/dist/cjs/dimensional-model/dimensions.js +307 -0
  17. package/dist/cjs/dimensional-model/dimensions.test.d.ts +1 -0
  18. package/dist/cjs/dimensional-model/dimensions.test.js +54 -0
  19. package/dist/cjs/dimensional-model/factory.d.ts +17 -0
  20. package/dist/cjs/dimensional-model/factory.js +54 -0
  21. package/dist/cjs/dimensional-model/filters/factory.d.ts +796 -0
  22. package/dist/cjs/dimensional-model/filters/factory.js +962 -0
  23. package/dist/cjs/dimensional-model/filters/factory.test.d.ts +1 -0
  24. package/dist/cjs/dimensional-model/filters/factory.test.js +366 -0
  25. package/dist/cjs/dimensional-model/filters/filters.d.ts +321 -0
  26. package/dist/cjs/dimensional-model/filters/filters.js +614 -0
  27. package/dist/cjs/dimensional-model/filters/filters.test.d.ts +1 -0
  28. package/dist/cjs/dimensional-model/filters/filters.test.js +225 -0
  29. package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.d.ts +47 -0
  30. package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +111 -0
  31. package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +21 -0
  32. package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +194 -0
  33. package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.d.ts +2 -0
  34. package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.js +12 -0
  35. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +13 -0
  36. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +54 -0
  37. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.d.ts +1 -0
  38. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.js +32 -0
  39. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +73 -0
  40. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +190 -0
  41. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.d.ts +1 -0
  42. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.js +558 -0
  43. package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
  44. package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.js +174 -0
  45. package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.d.ts +1 -0
  46. package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.js +236 -0
  47. package/dist/cjs/dimensional-model/filters/utils/filter-types-util.d.ts +17 -0
  48. package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +79 -0
  49. package/dist/cjs/dimensional-model/filters/utils/types.d.ts +200 -0
  50. package/dist/cjs/dimensional-model/filters/utils/types.js +99 -0
  51. package/dist/cjs/dimensional-model/interfaces.d.ts +512 -0
  52. package/dist/cjs/dimensional-model/interfaces.js +31 -0
  53. package/dist/cjs/dimensional-model/measures/factory.d.ts +920 -0
  54. package/dist/cjs/dimensional-model/measures/factory.js +1188 -0
  55. package/dist/cjs/dimensional-model/measures/factory.test.d.ts +1 -0
  56. package/dist/cjs/dimensional-model/measures/factory.test.js +481 -0
  57. package/dist/cjs/dimensional-model/measures/measures.d.ts +217 -0
  58. package/dist/cjs/dimensional-model/measures/measures.js +416 -0
  59. package/dist/cjs/dimensional-model/measures/measures.test.d.ts +1 -0
  60. package/dist/cjs/dimensional-model/measures/measures.test.js +79 -0
  61. package/dist/cjs/dimensional-model/simple-column-types.d.ts +39 -0
  62. package/dist/cjs/dimensional-model/simple-column-types.js +134 -0
  63. package/dist/cjs/dimensional-model/simple-column-types.test.d.ts +1 -0
  64. package/dist/cjs/dimensional-model/simple-column-types.test.js +85 -0
  65. package/dist/cjs/dimensional-model/types.d.ts +256 -0
  66. package/dist/cjs/dimensional-model/types.js +298 -0
  67. package/dist/cjs/dimensional-model/types.test.d.ts +1 -0
  68. package/dist/cjs/dimensional-model/types.test.js +33 -0
  69. package/dist/cjs/index.d.ts +93 -0
  70. package/dist/cjs/index.js +123 -0
  71. package/dist/cjs/interfaces.d.ts +367 -0
  72. package/dist/cjs/interfaces.js +21 -0
  73. package/dist/cjs/translation/initialize-i18n.d.ts +2 -0
  74. package/dist/cjs/translation/initialize-i18n.js +14 -0
  75. package/dist/cjs/translation/resources/en.d.ts +28 -0
  76. package/dist/cjs/translation/resources/en.js +30 -0
  77. package/dist/cjs/translation/resources/index.d.ts +53 -0
  78. package/dist/cjs/translation/resources/index.js +10 -0
  79. package/dist/cjs/translation/resources/uk.d.ts +5 -0
  80. package/dist/cjs/translation/resources/uk.js +30 -0
  81. package/dist/cjs/translation/translatable-error.d.ts +5 -0
  82. package/dist/cjs/translation/translatable-error.js +15 -0
  83. package/dist/cjs/utils.d.ts +37 -0
  84. package/dist/cjs/utils.js +105 -0
  85. package/dist/cjs/utils.test.d.ts +1 -0
  86. package/dist/cjs/utils.test.js +158 -0
  87. package/dist/dimensional-model/attributes.d.ts +1 -0
  88. package/dist/dimensional-model/attributes.js +31 -0
  89. package/dist/dimensional-model/filters/factory.d.ts +80 -42
  90. package/dist/dimensional-model/filters/factory.js +123 -85
  91. package/dist/dimensional-model/filters/filters.d.ts +40 -12
  92. package/dist/dimensional-model/filters/filters.js +75 -24
  93. package/dist/dimensional-model/filters/utils/attribute-measure-util.d.ts +2 -2
  94. package/dist/dimensional-model/filters/utils/attribute-measure-util.js +6 -3
  95. package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -2
  96. package/dist/dimensional-model/filters/utils/condition-filter-util.js +34 -31
  97. package/dist/dimensional-model/filters/utils/filter-code-util.js +1 -1
  98. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +16 -10
  99. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +34 -27
  100. package/dist/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
  101. package/dist/dimensional-model/filters/utils/filter-matcher-utils.js +170 -0
  102. package/dist/dimensional-model/filters/utils/filter-types-util.d.ts +3 -1
  103. package/dist/dimensional-model/filters/utils/filter-types-util.js +2 -2
  104. package/dist/dimensional-model/filters/utils/types.d.ts +1 -1
  105. package/dist/dimensional-model/interfaces.d.ts +6 -0
  106. package/dist/dimensional-model/types.d.ts +9 -3
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.js +1 -0
  109. package/package.json +18 -9
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
27
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
28
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
29
+ const index_js_1 = require("../../index.js");
30
+ const dimensions_js_1 = require("../dimensions.js");
31
+ const filterFactory = __importStar(require("./factory.js"));
32
+ const filters_js_1 = require("./filters.js");
33
+ const TextDim = (0, dimensions_js_1.createDimension)({
34
+ name: 'text',
35
+ type: 'textdimension',
36
+ expression: '[Text]',
37
+ });
38
+ const NumDim = (0, dimensions_js_1.createDimension)({
39
+ name: 'num',
40
+ type: 'numericdimension',
41
+ expression: '[Num]',
42
+ });
43
+ const DateDim = (0, dimensions_js_1.createDateDimension)({
44
+ name: 'date',
45
+ expression: '[Date]',
46
+ });
47
+ const filter1 = new filters_js_1.MembersFilter(TextDim, []);
48
+ const filter2 = new filters_js_1.MembersFilter(NumDim, []);
49
+ describe('filterFactory', () => {
50
+ test('filterFactory.union()', () => {
51
+ const f = filterFactory.union([filter1, filter2]);
52
+ expect(f).toBeInstanceOf(filters_js_1.LogicalAttributeFilter);
53
+ expect(f).toHaveProperty('operator', filters_js_1.LogicalOperators.Union);
54
+ expect(f).toHaveProperty('filters', [filter1, filter2]);
55
+ });
56
+ test('filterFactory.intersection()', () => {
57
+ const f = filterFactory.intersection([filter1, filter2]);
58
+ expect(f).toBeInstanceOf(filters_js_1.LogicalAttributeFilter);
59
+ expect(f).toHaveProperty('operator', filters_js_1.LogicalOperators.Intersection);
60
+ expect(f).toHaveProperty('filters', [filter1, filter2]);
61
+ });
62
+ test('filterFactory.exclude()', () => {
63
+ const f = filterFactory.exclude(filter1);
64
+ expect(f).toBeInstanceOf(filters_js_1.ExcludeFilter);
65
+ expect(f).toHaveProperty('attribute', TextDim);
66
+ expect(f).toHaveProperty('filter', filter1);
67
+ });
68
+ test('filterFactory.doesntContain()', () => {
69
+ const f = filterFactory.doesntContain(TextDim, 'mem');
70
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
71
+ expect(f).toHaveProperty('attribute', TextDim);
72
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntContain);
73
+ expect(f).toHaveProperty('valueA', 'mem');
74
+ });
75
+ test('filterFactory.doesntEndWith()', () => {
76
+ const f = filterFactory.doesntEndWith(TextDim, 'mem');
77
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
78
+ expect(f).toHaveProperty('attribute', TextDim);
79
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntEndWith);
80
+ expect(f).toHaveProperty('valueA', 'mem');
81
+ });
82
+ test('filterFactory.doesntStartWith()', () => {
83
+ const f = filterFactory.doesntStartWith(TextDim, 'mem');
84
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
85
+ expect(f).toHaveProperty('attribute', TextDim);
86
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntStartWith);
87
+ expect(f).toHaveProperty('valueA', 'mem');
88
+ });
89
+ test('filterFactory.contains()', () => {
90
+ const f = filterFactory.contains(TextDim, 'mem');
91
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
92
+ expect(f).toHaveProperty('attribute', TextDim);
93
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Contains);
94
+ expect(f).toHaveProperty('valueA', 'mem');
95
+ });
96
+ test('filterFactory.endsWith()', () => {
97
+ const f = filterFactory.endsWith(TextDim, 'mem');
98
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
99
+ expect(f).toHaveProperty('attribute', TextDim);
100
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.EndsWith);
101
+ expect(f).toHaveProperty('valueA', 'mem');
102
+ });
103
+ test('filterFactory.startsWith()', () => {
104
+ const f = filterFactory.startsWith(TextDim, 'mem');
105
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
106
+ expect(f).toHaveProperty('attribute', TextDim);
107
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.StartsWith);
108
+ expect(f).toHaveProperty('valueA', 'mem');
109
+ });
110
+ test('filterFactory.like()', () => {
111
+ const f = filterFactory.like(TextDim, '%mem%');
112
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
113
+ expect(f).toHaveProperty('attribute', TextDim);
114
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Like);
115
+ expect(f).toHaveProperty('valueA', '%mem%');
116
+ });
117
+ test('filterFactory.doesntEqual() with string arg', () => {
118
+ const f = filterFactory.doesntEqual(TextDim, 'mem');
119
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
120
+ expect(f).toHaveProperty('attribute', TextDim);
121
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntEqual);
122
+ expect(f).toHaveProperty('valueA', 'mem');
123
+ });
124
+ test('filterFactory.doesntEqual() with numeric arg', () => {
125
+ const f = filterFactory.doesntEqual(NumDim, 5);
126
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
127
+ expect(f).toHaveProperty('attribute', NumDim);
128
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.DoesntEqual);
129
+ expect(f).toHaveProperty('valueA', 5);
130
+ });
131
+ test('filterFactory.equals() with string arg', () => {
132
+ const f = filterFactory.equals(TextDim, 'mem');
133
+ expect(f).toBeInstanceOf(filters_js_1.TextFilter);
134
+ expect(f).toHaveProperty('attribute', TextDim);
135
+ expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Equals);
136
+ expect(f).toHaveProperty('valueA', 'mem');
137
+ });
138
+ test('filterFactory.equals() with numeric arg', () => {
139
+ const f = filterFactory.equals(NumDim, 5);
140
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
141
+ expect(f).toHaveProperty('attribute', NumDim);
142
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.Equals);
143
+ expect(f).toHaveProperty('valueA', 5);
144
+ });
145
+ test('filterFactory.greaterThan()', () => {
146
+ const f = filterFactory.greaterThan(NumDim, 5);
147
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
148
+ expect(f).toHaveProperty('attribute', NumDim);
149
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
150
+ expect(f).toHaveProperty('valueA', 5);
151
+ });
152
+ test('filterFactory.greaterThanOrEqual()', () => {
153
+ const f = filterFactory.greaterThanOrEqual(NumDim, 5);
154
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
155
+ expect(f).toHaveProperty('attribute', NumDim);
156
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
157
+ expect(f).toHaveProperty('valueA', 5);
158
+ });
159
+ test('filterFactory.lessThan()', () => {
160
+ const f = filterFactory.lessThan(NumDim, 5);
161
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
162
+ expect(f).toHaveProperty('attribute', NumDim);
163
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.ToNotEqual);
164
+ expect(f).toHaveProperty('valueA', 5);
165
+ });
166
+ test('filterFactory.lessThanOrEqual()', () => {
167
+ const f = filterFactory.lessThanOrEqual(NumDim, 5);
168
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
169
+ expect(f).toHaveProperty('attribute', NumDim);
170
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.To);
171
+ expect(f).toHaveProperty('valueA', 5);
172
+ });
173
+ test('filterFactory.between()', () => {
174
+ const f = filterFactory.between(NumDim, 3, 7);
175
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
176
+ expect(f).toHaveProperty('attribute', NumDim);
177
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
178
+ expect(f).toHaveProperty('valueA', 3);
179
+ expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.To);
180
+ expect(f).toHaveProperty('valueB', 7);
181
+ });
182
+ test('filterFactory.betweenNotEqual()', () => {
183
+ const f = filterFactory.betweenNotEqual(NumDim, 3, 7);
184
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
185
+ expect(f).toHaveProperty('attribute', NumDim);
186
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
187
+ expect(f).toHaveProperty('valueA', 3);
188
+ expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.ToNotEqual);
189
+ expect(f).toHaveProperty('valueB', 7);
190
+ });
191
+ test('filterFactory.numeric()', () => {
192
+ const f = filterFactory.numeric(NumDim, filters_js_1.NumericOperators.Equals, 5);
193
+ expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
194
+ expect(f).toHaveProperty('attribute', NumDim);
195
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.Equals);
196
+ expect(f).toHaveProperty('valueA', 5);
197
+ });
198
+ test('filterFactory.member()', () => {
199
+ const f = filterFactory.members(TextDim, ['mem1', 'mem2']);
200
+ expect(f).toBeInstanceOf(filters_js_1.MembersFilter);
201
+ expect(f).toHaveProperty('attribute', TextDim);
202
+ expect(f).toHaveProperty('members', ['mem1', 'mem2']);
203
+ });
204
+ test('filterFactory.dateFrom()', () => {
205
+ const f = filterFactory.dateFrom(DateDim.Years, '2020-02-02T00:00:00Z');
206
+ expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
207
+ expect(f).toHaveProperty('attribute', DateDim.Years);
208
+ expect(f).toHaveProperty('operatorA', filters_js_1.DateOperators.From);
209
+ expect(f).toHaveProperty('valueA', '2020-02-02T00:00:00Z');
210
+ });
211
+ test('filterFactory.dateTo()', () => {
212
+ const f = filterFactory.dateTo(DateDim.Years, '2020-02-02T00:00:00Z');
213
+ expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
214
+ expect(f).toHaveProperty('attribute', DateDim.Years);
215
+ expect(f).toHaveProperty('operatorB', filters_js_1.DateOperators.To);
216
+ expect(f).toHaveProperty('valueB', '2020-02-02T00:00:00Z');
217
+ });
218
+ test('filterFactory.dateRange()', () => {
219
+ const f = filterFactory.dateRange(DateDim.Years, '2020-02-02T00:00:00Z', '2021-02-02T00:00:00Z');
220
+ expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
221
+ expect(f).toHaveProperty('attribute', DateDim.Years);
222
+ expect(f).toHaveProperty('operatorA', filters_js_1.DateOperators.From);
223
+ expect(f).toHaveProperty('valueA', '2020-02-02T00:00:00Z');
224
+ expect(f).toHaveProperty('operatorB', filters_js_1.DateOperators.To);
225
+ expect(f).toHaveProperty('valueB', '2021-02-02T00:00:00Z');
226
+ });
227
+ test('filterFactory.dateRelative()', () => {
228
+ const f = filterFactory.dateRelative(DateDim.Years, 0, 1);
229
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
230
+ expect(f).toHaveProperty('attribute', DateDim.Years);
231
+ expect(f).toHaveProperty('offset', 0);
232
+ expect(f).toHaveProperty('count', 1);
233
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Next);
234
+ });
235
+ test('filterFactory.dateRelativeFrom()', () => {
236
+ const f = filterFactory.dateRelativeFrom(DateDim.Years, 0, 1);
237
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
238
+ expect(f).toHaveProperty('attribute', DateDim.Years);
239
+ expect(f).toHaveProperty('offset', 0);
240
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Next);
241
+ });
242
+ test('filterFactory.dateRelativeTo()', () => {
243
+ const f = filterFactory.dateRelativeTo(DateDim.Years, 0, 1);
244
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
245
+ expect(f).toHaveProperty('attribute', DateDim.Years);
246
+ expect(f).toHaveProperty('offset', 0);
247
+ expect(f).toHaveProperty('count', 1);
248
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
249
+ });
250
+ test('filterFactory.thisYear()', () => {
251
+ const f = filterFactory.thisYear(DateDim);
252
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
253
+ expect(f).toHaveProperty('attribute', DateDim.Years);
254
+ expect(f).toHaveProperty('offset', 0);
255
+ expect(f).toHaveProperty('count', 1);
256
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
257
+ });
258
+ test('filterFactory.thisMonth()', () => {
259
+ const f = filterFactory.thisMonth(DateDim);
260
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
261
+ expect(f).toHaveProperty('attribute', DateDim.Months);
262
+ expect(f).toHaveProperty('offset', 0);
263
+ expect(f).toHaveProperty('count', 1);
264
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
265
+ });
266
+ test('filterFactory.thisQuarter()', () => {
267
+ const f = filterFactory.thisQuarter(DateDim);
268
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
269
+ expect(f).toHaveProperty('attribute', DateDim.Quarters);
270
+ expect(f).toHaveProperty('offset', 0);
271
+ expect(f).toHaveProperty('count', 1);
272
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
273
+ });
274
+ test('filterFactory.today()', () => {
275
+ const f = filterFactory.today(DateDim);
276
+ expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
277
+ expect(f).toHaveProperty('attribute', DateDim.Days);
278
+ expect(f).toHaveProperty('offset', 0);
279
+ expect(f).toHaveProperty('count', 1);
280
+ expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
281
+ });
282
+ test('filterFactory.measureBase()', () => {
283
+ const f = filterFactory.measureBase(NumDim, index_js_1.measureFactory.sum(NumDim), filters_js_1.NumericOperators.From, 5);
284
+ expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
285
+ expect(f).toHaveProperty('attribute', NumDim);
286
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
287
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
288
+ expect(f).toHaveProperty('valueA', 5);
289
+ });
290
+ test('filterFactory.measureGreaterThanOrEqual()', () => {
291
+ const f = filterFactory.measureGreaterThanOrEqual(index_js_1.measureFactory.sum(NumDim), 5);
292
+ expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
293
+ expect(f).toHaveProperty('attribute', NumDim);
294
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
295
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
296
+ expect(f).toHaveProperty('valueA', 5);
297
+ });
298
+ test('filterFactory.measureLessThanOrEqual()', () => {
299
+ const f = filterFactory.measureLessThanOrEqual(index_js_1.measureFactory.sum(NumDim), 5);
300
+ expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
301
+ expect(f).toHaveProperty('attribute', NumDim);
302
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
303
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.To);
304
+ expect(f).toHaveProperty('valueA', 5);
305
+ });
306
+ test('filterFactory.measureBetween()', () => {
307
+ const f = filterFactory.measureBetween(index_js_1.measureFactory.sum(NumDim), 3, 7);
308
+ expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
309
+ expect(f).toHaveProperty('attribute', NumDim);
310
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
311
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
312
+ expect(f).toHaveProperty('valueA', 3);
313
+ expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.To);
314
+ expect(f).toHaveProperty('valueB', 7);
315
+ });
316
+ test('filterFactory.measureBetweenNotEqual()', () => {
317
+ const f = filterFactory.measureBetweenNotEqual(index_js_1.measureFactory.sum(NumDim), 3, 7);
318
+ expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
319
+ expect(f).toHaveProperty('attribute', NumDim);
320
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
321
+ expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
322
+ expect(f).toHaveProperty('valueA', 3);
323
+ expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.ToNotEqual);
324
+ expect(f).toHaveProperty('valueB', 7);
325
+ });
326
+ test('filterFactory.topRanking()', () => {
327
+ const f = filterFactory.topRanking(TextDim, index_js_1.measureFactory.sum(NumDim), 3);
328
+ expect(f).toBeInstanceOf(filters_js_1.RankingFilter);
329
+ expect(f).toHaveProperty('attribute', TextDim);
330
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
331
+ expect(f).toHaveProperty('operator', filters_js_1.RankingOperators.Top);
332
+ expect(f).toHaveProperty('count', 3);
333
+ });
334
+ test('filterFactory.bottomRanking()', () => {
335
+ const f = filterFactory.bottomRanking(TextDim, index_js_1.measureFactory.sum(NumDim), 3);
336
+ expect(f).toBeInstanceOf(filters_js_1.RankingFilter);
337
+ expect(f).toHaveProperty('attribute', TextDim);
338
+ expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
339
+ expect(f).toHaveProperty('operator', filters_js_1.RankingOperators.Bottom);
340
+ expect(f).toHaveProperty('count', 3);
341
+ });
342
+ test('filterFactory.logic.and()', () => {
343
+ const f = filterFactory.logic.and(filter1, filter2);
344
+ expect(f).toHaveProperty('operator', 'AND');
345
+ expect(f).toHaveProperty('left', filter1);
346
+ expect(f).toHaveProperty('right', filter2);
347
+ });
348
+ test('filterFactory.logic.and() with array', () => {
349
+ const f = filterFactory.logic.and([filter1, filter2], filter2);
350
+ expect(f).toHaveProperty('operator', 'AND');
351
+ expect(f).toHaveProperty('left', { operator: 'AND', left: filter1, right: filter2 });
352
+ expect(f).toHaveProperty('right', filter2);
353
+ });
354
+ test('filterFactory.logic.or()', () => {
355
+ const f = filterFactory.logic.or(filter1, filter2);
356
+ expect(f).toHaveProperty('operator', 'OR');
357
+ expect(f).toHaveProperty('left', filter1);
358
+ expect(f).toHaveProperty('right', filter2);
359
+ });
360
+ test('filterFactory.logic.or() with array', () => {
361
+ const f = filterFactory.logic.or(filter1, [filter1, filter2]);
362
+ expect(f).toHaveProperty('operator', 'OR');
363
+ expect(f).toHaveProperty('left', filter1);
364
+ expect(f).toHaveProperty('right', { operator: 'AND', left: filter1, right: filter2 });
365
+ });
366
+ });
@@ -0,0 +1,321 @@
1
+ import { LevelAttribute, Attribute, Measure, Filter } from '../interfaces.js';
2
+ import { DimensionalElement } from '../base.js';
3
+ /**
4
+ * Different text operators that can be used with text filters
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const TextOperators: {
9
+ Contains: string;
10
+ StartsWith: string;
11
+ EndsWith: string;
12
+ Equals: string;
13
+ DoesntEqual: string;
14
+ DoesntStartWith: string;
15
+ DoesntContain: string;
16
+ DoesntEndWith: string;
17
+ Like: string;
18
+ };
19
+ /**
20
+ * Different numeric operators that can be used with numeric filters
21
+ */
22
+ export declare const NumericOperators: {
23
+ Equals: string;
24
+ DoesntEqual: string;
25
+ From: string;
26
+ FromNotEqual: string;
27
+ To: string;
28
+ ToNotEqual: string;
29
+ };
30
+ /**
31
+ * Different date operators that can be used with date filters
32
+ *
33
+ * @internal
34
+ */
35
+ export declare const DateOperators: {
36
+ From: string;
37
+ To: string;
38
+ Last: string;
39
+ Next: string;
40
+ Anchor: string;
41
+ };
42
+ /**
43
+ * Different logical operators that can be used with logical filters
44
+ *
45
+ * @internal
46
+ */
47
+ export declare const LogicalOperators: {
48
+ Union: string;
49
+ Intersection: string;
50
+ Exclude: string;
51
+ };
52
+ /**
53
+ * Different ranking operators that can be used with ranking filter
54
+ *
55
+ * @internal
56
+ */
57
+ export declare const RankingOperators: {
58
+ Top: string;
59
+ Bottom: string;
60
+ };
61
+ /**
62
+ * Different filter types
63
+ *
64
+ * @internal
65
+ */
66
+ export declare const FilterTypes: {
67
+ logicalAttribute: string;
68
+ members: string;
69
+ exclude: string;
70
+ measure: string;
71
+ ranking: string;
72
+ text: string;
73
+ numeric: string;
74
+ date: string;
75
+ relativeDate: string;
76
+ cascading: string;
77
+ };
78
+ /**
79
+ * base implementation for filter classes
80
+ *
81
+ * @internal
82
+ */
83
+ declare abstract class AbstractFilter extends DimensionalElement implements Filter {
84
+ /**
85
+ * Attribute this filter instance is filtering
86
+ */
87
+ readonly attribute: Attribute;
88
+ /**
89
+ * Filter type
90
+ */
91
+ readonly filterType: string;
92
+ /**
93
+ * Global filter identifier
94
+ */
95
+ readonly guid: string;
96
+ /**
97
+ * Boolean flag whether the filter is disabled
98
+ *
99
+ * @internal
100
+ */
101
+ disabled: boolean;
102
+ constructor(att: Attribute, filterType: string, guid?: string);
103
+ get name(): string;
104
+ /**
105
+ * Gets JAQL representing this Filter instance
106
+ */
107
+ abstract filterJaql(): any;
108
+ /**
109
+ * gets the element's ID
110
+ */
111
+ abstract get id(): string;
112
+ /**
113
+ * Defines whether the filter is a scope filters
114
+ */
115
+ isScope: boolean;
116
+ /**
117
+ * Gets a serializable representation of the element
118
+ */
119
+ serializable(): any;
120
+ /**
121
+ * Gets the JAQL representation of this instance
122
+ *
123
+ * @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
124
+ */
125
+ jaql(nested?: boolean): any;
126
+ static checkAttributeSupport(attribute: Attribute): void;
127
+ static disabledJaql(nested?: boolean): any;
128
+ }
129
+ /**
130
+ * @internal
131
+ */
132
+ export declare class LogicalAttributeFilter extends AbstractFilter {
133
+ readonly filters: Filter[];
134
+ readonly operator: string;
135
+ constructor(filters: Filter[], operator: string, guid?: string);
136
+ /**
137
+ * gets the element's ID
138
+ */
139
+ get id(): string;
140
+ /**
141
+ * Gets a serializable representation of the element
142
+ */
143
+ serializable(): any;
144
+ /**
145
+ * Gets JAQL representing this Filter instance
146
+ */
147
+ filterJaql(): any;
148
+ }
149
+ /**
150
+ * @internal
151
+ */
152
+ export declare class MembersFilter extends AbstractFilter {
153
+ readonly members: any[];
154
+ constructor(attribute: Attribute, members?: any[], guid?: string);
155
+ /**
156
+ * gets the element's ID
157
+ */
158
+ get id(): string;
159
+ /**
160
+ * Gets a serializable representation of the element
161
+ */
162
+ serializable(): any;
163
+ /**
164
+ * Gets JAQL representing this Filter instance
165
+ */
166
+ filterJaql(): any;
167
+ }
168
+ /**
169
+ * @internal
170
+ */
171
+ export declare class CascadingFilter extends AbstractFilter {
172
+ readonly filters: Filter[];
173
+ constructor(filters: Filter[], guid?: string);
174
+ /**
175
+ * gets the element's ID
176
+ */
177
+ get id(): string;
178
+ /**
179
+ * Gets a serializable representation of the element
180
+ */
181
+ serializable(): any;
182
+ /**
183
+ * Gets JAQL representing this Filter instance
184
+ */
185
+ filterJaql(): any;
186
+ jaql(nested?: boolean): any;
187
+ }
188
+ /**
189
+ * @internal
190
+ */
191
+ export declare class ExcludeFilter extends AbstractFilter {
192
+ readonly filter: Filter;
193
+ readonly input?: Filter;
194
+ constructor(filter: Filter, input?: Filter, guid?: string);
195
+ /**
196
+ * gets the element's ID
197
+ */
198
+ get id(): string;
199
+ /**
200
+ * Gets a serializable representation of the element
201
+ */
202
+ serializable(): any;
203
+ /**
204
+ * Gets JAQL representing this Filter instance
205
+ */
206
+ filterJaql(): any;
207
+ }
208
+ /**
209
+ * @internal
210
+ */
211
+ export declare class DoubleOperatorFilter<Type> extends AbstractFilter {
212
+ operatorA?: string;
213
+ operatorB?: string;
214
+ valueA?: Type;
215
+ valueB?: Type;
216
+ constructor(att: Attribute, filterType: string, operatorA?: string, valueA?: Type, operatorB?: string, valueB?: Type, guid?: string);
217
+ /**
218
+ * gets the element's ID
219
+ */
220
+ get id(): string;
221
+ /**
222
+ * Gets a serializable representation of the element
223
+ */
224
+ serializable(): any;
225
+ /**
226
+ * Gets JAQL representing this Filter instance
227
+ */
228
+ filterJaql(): any;
229
+ }
230
+ /**
231
+ * @internal
232
+ */
233
+ export declare class MeasureFilter extends DoubleOperatorFilter<number> {
234
+ measure: Measure;
235
+ constructor(att: Attribute, measure: Measure, operatorA?: string, valueA?: number, operatorB?: string, valueB?: number, guid?: string);
236
+ /**
237
+ * gets the element's ID
238
+ */
239
+ get id(): string;
240
+ /**
241
+ * Gets a serializable representation of the element
242
+ */
243
+ serializable(): any;
244
+ jaql(nested?: boolean | undefined): any;
245
+ }
246
+ /**
247
+ * @internal
248
+ */
249
+ export declare class RankingFilter extends AbstractFilter {
250
+ count: number;
251
+ operator: string;
252
+ measure: Measure;
253
+ constructor(att: Attribute, measure: Measure, operator: string, count: number, guid?: string);
254
+ /**
255
+ * gets the element's ID
256
+ */
257
+ get id(): string;
258
+ /**
259
+ * Gets a serializable representation of the element
260
+ */
261
+ serializable(): any;
262
+ /**
263
+ * Gets JAQL representing this Filter instance
264
+ */
265
+ filterJaql(): any;
266
+ }
267
+ /**
268
+ * @internal
269
+ */
270
+ export declare class NumericFilter extends DoubleOperatorFilter<number> {
271
+ constructor(att: Attribute, operatorA?: string, valueA?: number, operatorB?: string, valueB?: number, guid?: string);
272
+ }
273
+ /**
274
+ * @internal
275
+ */
276
+ export declare class TextFilter extends DoubleOperatorFilter<string> {
277
+ constructor(att: Attribute, operator: string, value: string, guid?: string);
278
+ }
279
+ /**
280
+ * @internal
281
+ */
282
+ export declare class DateRangeFilter extends DoubleOperatorFilter<Date | string> {
283
+ constructor(l: LevelAttribute, valueFrom?: Date | string, valueTo?: Date | string, guid?: string);
284
+ get level(): LevelAttribute;
285
+ get from(): string;
286
+ get to(): string;
287
+ /**
288
+ * Gets JAQL representing this Filter instance
289
+ */
290
+ filterJaql(): any;
291
+ }
292
+ /**
293
+ * @internal
294
+ */
295
+ export declare class RelativeDateFilter extends AbstractFilter {
296
+ readonly offset: number;
297
+ readonly count: number;
298
+ readonly operator: string;
299
+ readonly anchor?: Date | string;
300
+ constructor(l: LevelAttribute, offset: number, count: number, operator?: string, anchor?: Date | string, guid?: string);
301
+ get level(): LevelAttribute;
302
+ /**
303
+ * gets the element's ID
304
+ */
305
+ get id(): string;
306
+ /**
307
+ * Gets a serializable representation of the element
308
+ */
309
+ serializable(): any;
310
+ /**
311
+ * Gets JAQL representing this Filter instance
312
+ *
313
+ */
314
+ filterJaql(): any;
315
+ }
316
+ /**
317
+ * @param json - Filter JSON representation
318
+ * @internal
319
+ */
320
+ export declare function createFilter(json: any): Filter;
321
+ export {};