@sisense/sdk-data 1.11.0 → 1.13.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 (99) hide show
  1. package/dist/cjs/dimensional-model/analytics/factory.d.ts +47 -0
  2. package/dist/cjs/dimensional-model/analytics/factory.js +153 -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 +797 -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 +344 -0
  26. package/dist/cjs/dimensional-model/filters/filters.js +663 -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 +196 -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 +58 -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 +82 -0
  40. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +215 -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 +623 -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 +206 -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/analytics/factory.js +6 -4
  88. package/dist/dimensional-model/filters/factory.d.ts +81 -42
  89. package/dist/dimensional-model/filters/factory.js +125 -87
  90. package/dist/dimensional-model/filters/filters.d.ts +58 -13
  91. package/dist/dimensional-model/filters/filters.js +117 -27
  92. package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -2
  93. package/dist/dimensional-model/filters/utils/condition-filter-util.js +30 -26
  94. package/dist/dimensional-model/filters/utils/filter-code-util.js +5 -1
  95. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +26 -11
  96. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +58 -27
  97. package/dist/dimensional-model/filters/utils/filter-types-util.js +3 -3
  98. package/dist/dimensional-model/filters/utils/types.d.ts +6 -0
  99. package/package.json +18 -9
@@ -0,0 +1,962 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customFilter = exports.logic = exports.bottomRanking = exports.topRanking = exports.measureBetweenNotEqual = exports.measureBetween = exports.measureLessThan = exports.measureLessThanOrEqual = exports.measureGreaterThanOrEqual = exports.measureGreaterThan = exports.measureEquals = exports.measureBase = exports.today = exports.thisQuarter = exports.thisMonth = exports.thisYear = exports.dateRelativeTo = exports.dateRelativeFrom = exports.dateRelative = exports.dateRange = exports.dateTo = exports.dateFrom = exports.members = exports.numeric = exports.betweenNotEqual = exports.between = exports.lessThanOrEqual = exports.lessThan = exports.greaterThanOrEqual = exports.greaterThan = exports.equals = exports.doesntEqual = exports.like = exports.startsWith = exports.endsWith = exports.contains = exports.doesntStartWith = exports.doesntEndWith = exports.doesntContain = exports.exclude = exports.intersection = exports.union = void 0;
4
+ const filters_js_1 = require("./filters.js");
5
+ // LOGICAL FILTERS
6
+ /**
7
+ * Creates a filter representing the union of multiple filters on the same attribute. The resulting
8
+ * union filter filters on items that match any of the given filters.
9
+ *
10
+ * To create 'or' filters using different attributes, use the {@link logic.and | `or()`} function.
11
+ *
12
+ * @example
13
+ * Filter for countries that start with the letter 'A' **or** end with the letter 'A'
14
+ * in the Sample ECommerce data model.
15
+ * ```ts
16
+ * filterFactory.union([
17
+ * filterFactory.startsWith(DM.Country.Country, 'A'),
18
+ * filterFactory.endsWith(DM.Country.Country, 'A'),
19
+ * ])
20
+ * ```
21
+ * @param filters - Filters to union. The filters must all be on the same attribute.
22
+ * @param guid - Optional GUID for the filter
23
+ * @returns A filter instance
24
+ */
25
+ function union(filters, guid) {
26
+ return new filters_js_1.LogicalAttributeFilter(filters, filters_js_1.LogicalOperators.Union, guid);
27
+ }
28
+ exports.union = union;
29
+ /**
30
+ * Creates a filter representing the intersection of multiple filters on the same attribute. The resulting
31
+ * intersection filter filters on items that match all of the given filters.
32
+ *
33
+ * To create 'and' filters using different attributes, use the {@link logic.and | `and()`} function.
34
+ *
35
+ * @example
36
+ * Filter for countries that start with the letter 'A' **and** end with the letter 'A'
37
+ * in the Sample ECommerce data model.
38
+ * ```ts
39
+ * filterFactory.intersection([
40
+ * filterFactory.startsWith(DM.Country.Country, 'A'),
41
+ * filterFactory.endsWith(DM.Country.Country, 'A'),
42
+ * ])
43
+ * ```
44
+ * @param filters - Filters to intersect. The filters must all be on the same attribute.
45
+ * @param guid - Optional GUID for the filter
46
+ * @returns A filter instance
47
+ */
48
+ function intersection(filters, guid) {
49
+ return new filters_js_1.LogicalAttributeFilter(filters, filters_js_1.LogicalOperators.Intersection, guid);
50
+ }
51
+ exports.intersection = intersection;
52
+ /**
53
+ * Creates a filter that excludes items matching the given filter
54
+ * from all items or from items matching the optional input filter.
55
+ *
56
+ * @example
57
+ * Filter for items where the country name does not contain the letter 'A'
58
+ * from the Sample ECommerce data model.
59
+ * ```ts
60
+ * filterFactory.exclude(filterFactory.contains(DM.Country.Country, 'A'))
61
+ * ```
62
+ *
63
+ * Filter for items where the country name starts with the letter 'B' but does not contain the letter 'A'
64
+ * from the Sample ECommerce data model. This filter will match countries like 'Belgium', but will not
65
+ * match countries like 'Bermuda'.
66
+ * ```ts
67
+ * filterFactory.exclude(
68
+ * filterFactory.contains(DM.Country.Country, 'A'),
69
+ * filterFactory.startsWith(DM.Country.Country, 'B')
70
+ * )
71
+ * ```
72
+ * @param filter - Filter to exclude
73
+ * @param input - Input filter to exclude from, on the same attribute. If not provided, the filter excludes from all items.
74
+ * @param guid - Optional GUID for the filter
75
+ * @returns A filter representing an exclusion of the given filter
76
+ * from all attribute members or from the optional input filter
77
+ */
78
+ function exclude(filter, input, guid) {
79
+ return new filters_js_1.ExcludeFilter(filter, input, guid);
80
+ }
81
+ exports.exclude = exclude;
82
+ // TEXT / NUMERIC FILTERS
83
+ /**
84
+ * Creates a filter to isolate attribute values that do not contain a specified string.
85
+ *
86
+ * Matching is case insensitive.
87
+ *
88
+ * You can optionally use wildcard characters for pattern matching, as described in the
89
+ * {@link like | `like()`} function.
90
+ *
91
+ * @example
92
+ * Filter for categories in the Sample ECommerce data model where the category name doesn't contain
93
+ * 'digital'. This filter matches categories not like 'Digital Cameras' and 'MP3 & Digital Media Players'.
94
+ * ```ts
95
+ * filterFactory.contains(DM.Category.Category, 'digital')
96
+ * ```
97
+ * @param attribute - Text attribute to filter on
98
+ * @param value - Value to filter by
99
+ * @param guid - Optional GUID for the filter
100
+ * @returns A filter instance
101
+ */
102
+ function doesntContain(attribute, value, guid) {
103
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntContain, value, guid);
104
+ }
105
+ exports.doesntContain = doesntContain;
106
+ /**
107
+ * Creates a filter to isolate attribute values that do not end with a specified string.
108
+ *
109
+ * Matching is case insensitive.
110
+ *
111
+ * You can optionally use wildcard characters for pattern matching, as described in the
112
+ * {@link like | `like()`} function.
113
+ *
114
+ * @example
115
+ * Filter for countries in the Sample ECommerce data model where the country name doesn't end with
116
+ * 'land'. This filter matches countries not like 'Iceland' and 'Ireland'.
117
+ * ```ts
118
+ * filterFactory.doesntEndWith(DM.Country.Country, 'land')
119
+ * ```
120
+ * @param attribute - Text attribute to filter on
121
+ * @param value - Value to filter by
122
+ * @param guid - Optional GUID for the filter
123
+ * @returns A filter instance
124
+ */
125
+ function doesntEndWith(attribute, value, guid) {
126
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntEndWith, value, guid);
127
+ }
128
+ exports.doesntEndWith = doesntEndWith;
129
+ /**
130
+ * Creates a filter to isolate attribute values that do not start with a specified string.
131
+ *
132
+ * Matching is case insensitive.
133
+ *
134
+ * You can optionally use wildcard characters for pattern matching, as described in the
135
+ * {@link like | `like()`} function.
136
+ *
137
+ * @example
138
+ * Filter for countries in the Sample ECommerce data model where the country name doesn't start with
139
+ * 'United'. This filter matches countries not like 'United States' and 'United Kingdom'.
140
+ * ```ts
141
+ * filterFactory.doesntStartWith(DM.Country.Country, 'United')
142
+ * ```
143
+ * @param attribute - Text attribute to filter on
144
+ * @param value - Value to filter by
145
+ * @param guid - Optional GUID for the filter
146
+ * @returns A filter instance
147
+ */
148
+ function doesntStartWith(attribute, value, guid) {
149
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntStartWith, value, guid);
150
+ }
151
+ exports.doesntStartWith = doesntStartWith;
152
+ /**
153
+ * Creates a filter to isolate attribute values that contain a specified string.
154
+ *
155
+ * Matching is case insensitive.
156
+ *
157
+ * You can optionally use wildcard characters for pattern matching, as described in the
158
+ * {@link like | `like()`} function.
159
+ *
160
+ * @example
161
+ * Filter for categories in the Sample ECommerce data model where the category name contains
162
+ * 'digital'. This filter matches categories like 'Digital Cameras' and 'MP3 & Digital Media Players'.
163
+ * ```ts
164
+ * filterFactory.contains(DM.Category.Category, 'digital')
165
+ * ```
166
+ * @param attribute - Text attribute to filter on
167
+ * @param value - Value to filter by
168
+ * @param guid - Optional GUID for the filter
169
+ * @returns A filter instance
170
+ */
171
+ function contains(attribute, value, guid) {
172
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Contains, value, guid);
173
+ }
174
+ exports.contains = contains;
175
+ /**
176
+ * Creates a filter to isolate attribute values that end with a specified string.
177
+ *
178
+ * Matching is case insensitive.
179
+ *
180
+ * You can optionally use wildcard characters for pattern matching, as described in the
181
+ * {@link like | `like()`} function.
182
+ *
183
+ * @example
184
+ * Filter for countries in the Sample ECommerce data model where the country name ends with
185
+ * 'land'. This filter matches countries like 'Ireland' and 'Iceland'.
186
+ * ```ts
187
+ * filterFactory.endsWith(DM.Country.Country, 'land')
188
+ * ```
189
+ * @param attribute - Text attribute to filter on
190
+ * @param value - Value to filter by
191
+ * @param guid - Optional GUID for the filter
192
+ * @returns A filter instance
193
+ */
194
+ function endsWith(attribute, value, guid) {
195
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.EndsWith, value, guid);
196
+ }
197
+ exports.endsWith = endsWith;
198
+ /**
199
+ * Creates a filter to isolate attribute values that start with a specified string.
200
+ *
201
+ * Matching is case insensitive.
202
+ *
203
+ * You can optionally use wildcard characters for pattern matching, as described in the
204
+ * {@link like | `like()`} function.
205
+ *
206
+ * @example
207
+ * Filter for countries in the Sample ECommerce data model where the country name starts with
208
+ * 'United'. This filter matches countries like 'United States' and 'United Kingdom'.
209
+ * ```ts
210
+ * filterFactory.startsWith(DM.Country.Country, 'United')
211
+ * ```
212
+ * @param attribute - Text attribute to filter on
213
+ * @param value - Value to filter by
214
+ * @param guid - Optional GUID for the filter
215
+ * @returns A filter instance
216
+ */
217
+ function startsWith(attribute, value, guid) {
218
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.StartsWith, value, guid);
219
+ }
220
+ exports.startsWith = startsWith;
221
+ /**
222
+ * Creates a filter to isolate attribute values that match a specified string pattern.
223
+ *
224
+ * The pattern can include the following wildcard characters:
225
+ *
226
+ * + `_`: Matches a single character
227
+ * + `%`: Matches multiple characters
228
+ *
229
+ * To search for a literal underscore (`_`) or percent symbol (`%`), use the backslash (`\`) escape
230
+ * character.
231
+ *
232
+ * Matching is case insensitive.
233
+ *
234
+ * @example
235
+ * Filter for countries from the Sample ECommerce data model where the country name starts with an
236
+ * 'A' and ends with an 'a'. This filter matches countries like 'Argentina' and 'Australia'.
237
+ * ```ts
238
+ * filterFactory.like(DM.Country.Country, 'A%a')
239
+ * ```
240
+ * @param attribute - Text attribute to filter on
241
+ * @param value - Value to filter by
242
+ * @param guid - Optional GUID for the filter
243
+ * @returns A filter instance
244
+ */
245
+ function like(attribute, value, guid) {
246
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Like, value, guid);
247
+ }
248
+ exports.like = like;
249
+ /**
250
+ * Creates a filter to isolate attribute values that do not equal a specified string or number.
251
+ *
252
+ * When filtering against a string:
253
+ *
254
+ * + Matching is case insensitive.
255
+ * + You can optionally use wildcard characters for pattern matching, as described in the
256
+ * {@link like | `like()`} function.
257
+ *
258
+ * @example
259
+ * Filter for items not in new condition from the Sample ECommerce data model.
260
+ * ```ts
261
+ * filterFactory.doesntEqual(DM.Commerce.Condition, 'New')
262
+ * ```
263
+ * @param attribute - Text or numeric attribute to filter on
264
+ * @param value - Value to filter by
265
+ * @returns A filter instance
266
+ */
267
+ function doesntEqual(attribute, value, guid) {
268
+ if (typeof value === 'string') {
269
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntEqual, value, guid);
270
+ }
271
+ else {
272
+ return numeric(attribute, filters_js_1.NumericOperators.DoesntEqual, value, undefined, undefined, guid);
273
+ }
274
+ }
275
+ exports.doesntEqual = doesntEqual;
276
+ /**
277
+ * Creates a filter to isolate attribute values that equal a specified string or number.
278
+ *
279
+ * When filtering against a string:
280
+ *
281
+ * + Matching is case insensitive.
282
+ * + You can optionally use wildcard characters for pattern matching, as described in the
283
+ * {@link like | `like()`} function.
284
+ *
285
+ * @example
286
+ * Filter for items in new condition from the Sample ECommerce data model.
287
+ * ```ts
288
+ * filterFactory.equals(DM.Commerce.Condition, 'New')
289
+ * ```
290
+ * @param attribute - Text or numeric attribute to filter on
291
+ * @param value - Value to filter by
292
+ * @param guid - Optional GUID for the filter
293
+ * @returns A filter instance
294
+ */
295
+ function equals(attribute, value, guid) {
296
+ if (typeof value === 'string') {
297
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Equals, value, guid);
298
+ }
299
+ else {
300
+ return numeric(attribute, filters_js_1.NumericOperators.Equals, value, undefined, undefined, guid);
301
+ }
302
+ }
303
+ exports.equals = equals;
304
+ /**
305
+ * Creates a filter to isolate attribute values strictly greater than a specified number.
306
+ *
307
+ * @example
308
+ * Filter for items where the cost is greater than 100 from the Sample ECommerce data model.
309
+ * ```ts
310
+ * filterFactory.greaterThan(DM.Commerce.Cost, 100)
311
+ * ```
312
+ * @param attribute - Numeric attribute to filter on
313
+ * @param value - Value to filter by
314
+ * @param guid - Optional GUID for the filter
315
+ * @returns A filter instance
316
+ */
317
+ function greaterThan(attribute, value, guid) {
318
+ return numeric(attribute, filters_js_1.NumericOperators.FromNotEqual, value, undefined, undefined, guid);
319
+ }
320
+ exports.greaterThan = greaterThan;
321
+ /**
322
+ * Creates a filter to isolate attribute values greater than or equal to a specified number.
323
+ *
324
+ * @example
325
+ * Filter for items where the cost is greater than or equal to 100 from the Sample ECommerce data model.
326
+ * ```ts
327
+ * filterFactory.greaterThanOrEqual(DM.Commerce.Cost, 100)
328
+ * ```
329
+ * @param attribute - Numeric attribute to filter on
330
+ * @param value - Value to filter by
331
+ * @param guid - Optional GUID for the filter
332
+ * @returns A filter instance
333
+ */
334
+ function greaterThanOrEqual(attribute, value, guid) {
335
+ return numeric(attribute, filters_js_1.NumericOperators.From, value, undefined, undefined, guid);
336
+ }
337
+ exports.greaterThanOrEqual = greaterThanOrEqual;
338
+ /**
339
+ * Creates a filter to isolate attribute values strictly less than a specified number.
340
+ *
341
+ * @example
342
+ * Filter for items where the cost is less than 100 from the Sample ECommerce data model.
343
+ * ```ts
344
+ * filterFactory.lessThan(DM.Commerce.Cost, 100)
345
+ * ```
346
+ * @param attribute - Numeric attribute to filter on
347
+ * @param value - Value to filter by
348
+ * @param guid - Optional GUID for the filter
349
+ * @returns A filter instance
350
+ */
351
+ function lessThan(attribute, value, guid) {
352
+ return numeric(attribute, filters_js_1.NumericOperators.ToNotEqual, value, undefined, undefined, guid);
353
+ }
354
+ exports.lessThan = lessThan;
355
+ /**
356
+ * Creates a filter to isolate attribute values less than or equal to a specified number.
357
+ *
358
+ * @example
359
+ * Filter for items where the cost is less than or equal to 100 from the Sample ECommerce data model.
360
+ * ```ts
361
+ * filterFactory.lessThanOrEqual(DM.Commerce.Cost, 100)
362
+ * ```
363
+ * @param attribute - Numeric attribute to filter on
364
+ * @param value - Value to filter by
365
+ * @param guid - Optional GUID for the filter
366
+ * @returns A filter instance
367
+ */
368
+ function lessThanOrEqual(attribute, value, guid) {
369
+ return numeric(attribute, filters_js_1.NumericOperators.To, value, undefined, undefined, guid);
370
+ }
371
+ exports.lessThanOrEqual = lessThanOrEqual;
372
+ /**
373
+ * Creates a filter to isolate attribute values within or exactly matching two specified numerical boundaries.
374
+ *
375
+ * @example
376
+ * Filter for items from the Sample ECommerce data model where the cost is greater than or equal to 100 and less than or equal to 200.
377
+ * ```ts
378
+ * filterFactory.between(DM.Commerce.Cost, 100, 200)
379
+ * ```
380
+ * @param attribute - Numeric attribute to filter on
381
+ * @param valueA - Value to filter from
382
+ * @param valueB - Value to filter to
383
+ * @param guid - Optional GUID for the filter
384
+ * @returns A filter instance
385
+ */
386
+ function between(attribute, valueA, valueB, guid) {
387
+ return numeric(attribute, filters_js_1.NumericOperators.From, valueA, filters_js_1.NumericOperators.To, valueB, guid);
388
+ }
389
+ exports.between = between;
390
+ /**
391
+ * Creates a filter that isolates attribute values strictly within two specified numerical boundaries.
392
+ *
393
+ * @example
394
+ * Filter for items from the Sample ECommerce data model where the cost is greater than 100 and less than 200.
395
+ * ```ts
396
+ * filterFactory.betweenNotEqual(DM.Commerce.Cost, 100, 200)
397
+ * ```
398
+ * @param attribute - Numeric attribute to filter on
399
+ * @param valueA - Value to filter from
400
+ * @param valueB - Value to filter to
401
+ * @param guid - Optional GUID for the filter
402
+ * @returns A filter instance
403
+ */
404
+ function betweenNotEqual(attribute, valueA, valueB, guid) {
405
+ return numeric(attribute, filters_js_1.NumericOperators.FromNotEqual, valueA, filters_js_1.NumericOperators.ToNotEqual, valueB, guid);
406
+ }
407
+ exports.betweenNotEqual = betweenNotEqual;
408
+ /**
409
+ * Creates a custom numeric filter that filters for given attribute values.
410
+ *
411
+ * @example
412
+ * Filter for items where the cost is greater than 100 and less than 200
413
+ * from the Sample ECommerce data model.
414
+ * ```ts
415
+ * filterFactory.numeric(
416
+ * DM.Commerce.Cost,
417
+ * NumericOperators.From,
418
+ * 100,
419
+ * NumericOperators.To,
420
+ * 200
421
+ * )
422
+ * ```
423
+ * @param attribute - Numeric attribute to filter
424
+ * @param operatorA - First operator
425
+ * @param valueA - First value
426
+ * @param operatorB - Second operator
427
+ * @param valueB - Second value
428
+ * @param guid - Optional GUID for the filter
429
+ * @returns A custom numeric filter of the given attribute
430
+ */
431
+ function numeric(attribute, operatorA, valueA, operatorB, valueB, guid) {
432
+ return new filters_js_1.NumericFilter(attribute, operatorA, valueA, operatorB, valueB, guid);
433
+ }
434
+ exports.numeric = numeric;
435
+ /**
436
+ * Creates a filter to isolate attribute values that match any of the specified strings.
437
+ *
438
+ * Matching is case sensitive.
439
+ *
440
+ * @example
441
+ * Filter for items where the condition is 'Used' or 'Refurbished'
442
+ * from the Sample ECommerce data model.
443
+ * ```ts
444
+ * filterFactory.members(DM.Commerce.Condition, ['Used', 'Refurbished'])
445
+ * ```
446
+ * @param attribute - Attribute to filter on
447
+ * @param members - Array of member values to filter by
448
+ * @param _deactivatedMembers - [internal] Array of deactivated member values
449
+ * @param guid - Optional GUID for the filter
450
+ * @returns A filter instance
451
+ */
452
+ function members(attribute, members, _deactivatedMembers, guid) {
453
+ return new filters_js_1.MembersFilter(attribute, members, _deactivatedMembers, guid);
454
+ }
455
+ exports.members = members;
456
+ // DATE FILTERS
457
+ /**
458
+ * Creates a filter to isolate date values starting from and including the given date and level.
459
+ *
460
+ * @example
461
+ * Filter for items in the Sample ECommerce data model where the date is not before the year 2010.
462
+ * ```ts
463
+ * filterFactory.dateFrom(DM.Commerce.Date.Years, '2010-01')
464
+ * ```
465
+ * @param level - Date {@link LevelAttribute} to filter on
466
+ * @param from - Date or string representing the value to filter from
467
+ * @returns A filter instance
468
+ */
469
+ function dateFrom(level, from, guid) {
470
+ return dateRange(level, from, undefined, guid);
471
+ }
472
+ exports.dateFrom = dateFrom;
473
+ /**
474
+ * Creates a filter to isolate items up until and including the given date and level.
475
+ *
476
+ * @example
477
+ * Filter for items where the date is from the year 2010 or earlier in the Sample ECommerce data model.
478
+ * ```ts
479
+ * filterFactory.dateTo(DM.Commerce.Date.Years, '2010-01')
480
+ * ```
481
+ * @param level - Date {@link LevelAttribute} to filter on
482
+ * @param to - Date or string representing the last member to filter to
483
+ * @param guid - Optional GUID for the filter
484
+ * @returns A filter instance
485
+ */
486
+ function dateTo(level, to, guid) {
487
+ return dateRange(level, undefined, to, guid);
488
+ }
489
+ exports.dateTo = dateTo;
490
+ /**
491
+ * Creates a filter to isolate items between and including the given dates and level.
492
+ *
493
+ * @example
494
+ * Filter for items in the Sample ECommerce data model where the date is from the years 2009, 2010, or 2011.
495
+ * ```ts
496
+ * filterFactory.dateRange(DM.Commerce.Date.Years, '2009-01', '2011-01')
497
+ * ```
498
+ * @param level - Date {@link LevelAttribute} to filter on
499
+ * @param from - Date or string representing the start member to filter from
500
+ * @param to - Date or string representing the end member to filter to
501
+ * @param guid - Optional GUID for the filter
502
+ * @returns A filter instance
503
+ */
504
+ function dateRange(level, from, to, guid) {
505
+ return new filters_js_1.DateRangeFilter(level, from, to, guid);
506
+ }
507
+ exports.dateRange = dateRange;
508
+ /**
509
+ * Creates a filter to isolate items with a date dimension value within a specified range after a
510
+ * given date and level.
511
+ *
512
+ * Although the `offset` can be used to set a beginning date prior to the `anchor`, the filter range always
513
+ * continues forward after the offset beginning date. So, using an `offset` of `-6` and a `count` of `18` when `level`
514
+ * is a month level creates a range that begins 6 month before the `anchor` date and extends to 12 months after
515
+ * the `anchor` date.
516
+ *
517
+ * @example
518
+ * Filter for items in the Sample ECommerce data model where the date is in 2011 or the first half of 2012.
519
+ * ```ts
520
+ * filterFactory.dateRelative(DM.Commerce.Date.Months, 0, 18, '2011-01'),
521
+ * ```
522
+ *
523
+ * Filter for items in the Sample ECommerce data model where the date is in the second half of 2010 or in 2011.
524
+ * ```ts
525
+ * filterFactory.dateRelative(DM.Commerce.Date.Months, -6, 18, '2011-01'),
526
+ * ```
527
+ *
528
+ * Filter for items in the Sample ECommerce data model where the date is in the past 6 months.
529
+ * ```ts
530
+ * filterFactory.dateRelative(DM.Commerce.Date.Months, -6, 6),
531
+ * ```
532
+ * @param level - Date {@link LevelAttribute} to filter on
533
+ * @param offset - Number of levels to skip from the given `anchor` or the default of the current day.
534
+ * Positive numbers skip forwards and negative numbers skip backwards (e.g. `-6` is 6 months backwards when `level` is a months level attribute)
535
+ * @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
536
+ * @param anchor - Date to filter from, defaults to the current day
537
+ * @param guid - Optional GUID for the filter
538
+ * @returns A filter instance
539
+ */
540
+ function dateRelative(level, offset, count, anchor, guid) {
541
+ return new filters_js_1.RelativeDateFilter(level, offset, count, undefined, anchor, guid);
542
+ }
543
+ exports.dateRelative = dateRelative;
544
+ /**
545
+ * Creates a filter to isolate items with a date dimension value within a specified range after a
546
+ * given date and level.
547
+ *
548
+ * @example
549
+ * Filter for items in the Sample ECommerce data model where the date is in 2011 or the first half of 2012.
550
+ * ```ts
551
+ * filterFactory.dateRelativeFrom(DM.Commerce.Date.Months, 0, 18, '2011-01'),
552
+ * ```
553
+ * @param level - Date {@link LevelAttribute} to filter on
554
+ * @param offset - Number of levels to skip from the given `anchor` or the default of the current day (e.g. `6` is 6 months when `level` is a months level attribute)
555
+ * @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
556
+ * @param anchor - Date to filter from, defaults to the current day
557
+ * @param guid - Optional GUID for the filter
558
+ * @returns A filter instance
559
+ */
560
+ function dateRelativeFrom(level, offset, count, anchor, guid) {
561
+ return new filters_js_1.RelativeDateFilter(level, offset, count, filters_js_1.DateOperators.Next, anchor, guid);
562
+ }
563
+ exports.dateRelativeFrom = dateRelativeFrom;
564
+ /**
565
+ * Creates a filter to isolate items with a date dimension value within a specified range before a
566
+ * given date and level.
567
+ *
568
+ * @example
569
+ * Filter for items in the Sample ECommerce data model where the date is in the first half of 2010 or in 2011.
570
+ * ```ts
571
+ * filterFactory.dateRelativeTo(DM.Commerce.Date.Months, 0, 18, '2011-12'),
572
+ * ```
573
+ * @param level - Date {@link LevelAttribute} to filter on
574
+ * @param offset - Number of levels to skip from the given `anchor` or the default of the current day (e.g. `6` is 6 months when `level` is a months level attribute)
575
+ * @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
576
+ * @param anchor - Date to filter to, defaults to the current day
577
+ * @param guid - Optional GUID for the filter
578
+ * @returns A filter instance
579
+ */
580
+ function dateRelativeTo(level, offset, count, anchor, guid) {
581
+ return new filters_js_1.RelativeDateFilter(level, offset, count, filters_js_1.DateOperators.Last, anchor, guid);
582
+ }
583
+ exports.dateRelativeTo = dateRelativeTo;
584
+ /**
585
+ * Creates a filter to isolate items with a date dimension value in the current calendar year.
586
+ *
587
+ * @example
588
+ * Filter for items where the date is in the current calendar year in the Sample ECommerce data model.
589
+ * ```ts
590
+ * filterFactory.thisYear(DM.Commerce.Date)
591
+ * ```
592
+ * @param dimension - Date dimension to filter
593
+ * @param guid - Optional GUID for the filter
594
+ * @returns A filter instance
595
+ */
596
+ function thisYear(dimension, guid) {
597
+ return dateRelativeTo(dimension.Years, 0, 1, undefined, guid);
598
+ }
599
+ exports.thisYear = thisYear;
600
+ /**
601
+ * Creates a filter to isolate items with a date dimension value in the current calendar month.
602
+ *
603
+ * @example
604
+ * Filter for items where the date is in the current calendar month in the Sample ECommerce data model.
605
+ * ```ts
606
+ * filterFactory.thisMonth(DM.Commerce.Date)
607
+ * ```
608
+ * @param dimension - Date dimension to filter
609
+ * @param guid - Optional GUID for the filter
610
+ * @returns A filter instance
611
+ */
612
+ function thisMonth(dimension, guid) {
613
+ return dateRelativeTo(dimension.Months, 0, 1, undefined, guid);
614
+ }
615
+ exports.thisMonth = thisMonth;
616
+ /**
617
+ * Creates a filter to isolate items with a date dimension value in the current quarter.
618
+ *
619
+ * @example
620
+ * Filter for items where the date is in the current quarter in the Sample ECommerce data model.
621
+ * ```ts
622
+ * filterFactory.thisQuarter(DM.Commerce.Date)
623
+ * ```
624
+ * @param dimension - Date dimension to filter
625
+ * @param guid - Optional GUID for the filter
626
+ * @returns A filter instance
627
+ */
628
+ function thisQuarter(dimension, guid) {
629
+ return dateRelativeTo(dimension.Quarters, 0, 1, undefined, guid);
630
+ }
631
+ exports.thisQuarter = thisQuarter;
632
+ /**
633
+ * Creates a filter to isolate items with a date dimension value of the current date.
634
+ *
635
+ * @example
636
+ * Filter for items where the date is today in the Sample ECommerce data model.
637
+ * ```ts
638
+ * filterFactory.today(DM.Commerce.Date)
639
+ * ```
640
+ * @param dimension - date dimension to filter
641
+ * @param guid - Optional GUID for the filter
642
+ * @returns A filter instance
643
+ */
644
+ function today(dimension, guid) {
645
+ return dateRelativeTo(dimension.Days, 0, 1, undefined, guid);
646
+ }
647
+ exports.today = today;
648
+ // MEASURE-RELATED FILTERS
649
+ /**
650
+ * Creates a filter on all measure values matching the provided criteria.
651
+ *
652
+ * @param attribute - Attribute to filter
653
+ * @param measure - Measure to filter by
654
+ * @param operatorA - Operator to apply on `valueA` ({@link NumericOperators})
655
+ * @param valueA - First value
656
+ * @param operatorB - Operator to apply on `valueB` ({@link NumericOperators})
657
+ * @param valueB - Second value
658
+ * @param guid - Optional GUID for the filter
659
+ * @returns A filter representing the provided logic
660
+ * @internal
661
+ */
662
+ function measureBase(attribute, measure, operatorA, valueA, operatorB, valueB, guid) {
663
+ return new filters_js_1.MeasureFilter(attribute, measure, operatorA, valueA, operatorB, valueB, guid);
664
+ }
665
+ exports.measureBase = measureBase;
666
+ /**
667
+ * Creates a filter to isolate a measure value equal to a given number.
668
+ *
669
+ * @example
670
+ * Filter for categories that have an average revenue equal 50 in the Sample ECommerce data model.
671
+ * ```ts
672
+ * filterFactory.measureEquals(
673
+ * measures.average(DM.Commerce.Revenue),
674
+ * 50
675
+ * )
676
+ * ```
677
+ * @param measure - Measure to filter by
678
+ * @param value - Value
679
+ * @param guid - Optional GUID for the filter
680
+ * @returns A filter instance
681
+ */
682
+ function measureEquals(measure, value, guid) {
683
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.Equals, value, undefined, undefined, guid);
684
+ }
685
+ exports.measureEquals = measureEquals;
686
+ /**
687
+ * Creates a filter to isolate a measure value greater than to a given number.
688
+ *
689
+ * @example
690
+ * Filter for categories that have an average revenue greater than
691
+ * to 50 in the Sample ECommerce data model.
692
+ * ```ts
693
+ * filterFactory.measureGreaterThan(
694
+ * measures.average(DM.Commerce.Revenue),
695
+ * 50
696
+ * )
697
+ * ```
698
+ * @param measure - Measure to filter by
699
+ * @param value - Min value
700
+ * @param guid - Optional GUID for the filter
701
+ * @returns A filter instance
702
+ */
703
+ function measureGreaterThan(measure, value, guid) {
704
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.FromNotEqual, value, undefined, undefined, guid);
705
+ }
706
+ exports.measureGreaterThan = measureGreaterThan;
707
+ /**
708
+ * Creates a filter to isolate a measure value greater than or equal to a given number.
709
+ *
710
+ * @example
711
+ * Filter for categories that have an average revenue greater than
712
+ * or equal to 50 in the Sample ECommerce data model.
713
+ * ```ts
714
+ * filterFactory.measureGreaterThanOrEqual(
715
+ * measures.average(DM.Commerce.Revenue),
716
+ * 50
717
+ * )
718
+ * ```
719
+ * @param measure - Measure to filter by
720
+ * @param value - Min value
721
+ * @param guid - Optional GUID for the filter
722
+ * @returns A filter instance
723
+ */
724
+ function measureGreaterThanOrEqual(measure, value, guid) {
725
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.From, value, undefined, undefined, guid);
726
+ }
727
+ exports.measureGreaterThanOrEqual = measureGreaterThanOrEqual;
728
+ /**
729
+ * Creates a filter to isolate a measure value less than or equal to a given number.
730
+ *
731
+ * @example
732
+ * Filter for categories that have an average revenue less than
733
+ * or equal to 100 in the Sample ECommerce data model.
734
+ * ```ts
735
+ * filterFactory.measureLessThanOrEqual(
736
+ * measures.average(DM.Commerce.Revenue),
737
+ * 100
738
+ * )
739
+ * ```
740
+ * @param measure - Measure to filter by
741
+ * @param value - Max value
742
+ * @param guid - Optional GUID for the filter
743
+ * @returns A filter instance
744
+ */
745
+ function measureLessThanOrEqual(measure, value, guid) {
746
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.To, value, undefined, undefined, guid);
747
+ }
748
+ exports.measureLessThanOrEqual = measureLessThanOrEqual;
749
+ /**
750
+ * Creates a filter to isolate a measure value less than a given number.
751
+ *
752
+ * @example
753
+ * Filter for categories that have an average revenue less than 100 in the Sample ECommerce data model.
754
+ * ```ts
755
+ * filterFactory.measureLessThan(
756
+ * measures.average(DM.Commerce.Revenue),
757
+ * 100
758
+ * )
759
+ * ```
760
+ * @param measure - Measure to filter by
761
+ * @param value - Value
762
+ * @param guid - Optional GUID for the filter
763
+ * @returns A filter instance
764
+ */
765
+ function measureLessThan(measure, value, guid) {
766
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.ToNotEqual, value, undefined, undefined, guid);
767
+ }
768
+ exports.measureLessThan = measureLessThan;
769
+ /**
770
+ * Creates a filter to isolate a measure value between or equal to two given numbers.
771
+ *
772
+ * @example
773
+ * Filter for categories that have an average revenue greater than or equal to 50 and less than
774
+ * or equal to 100 in the Sample ECommerce data model.
775
+ * ```ts
776
+ * filterFactory.measureBetween(
777
+ * measures.average(DM.Commerce.Revenue),
778
+ * 50,
779
+ * 100
780
+ * )
781
+ * ```
782
+ * @param measure - Measure to filter by
783
+ * @param valueA - Min value
784
+ * @param valueB - Max value
785
+ * @param guid - Optional GUID for the filter
786
+ * @returns A filter instance
787
+ */
788
+ function measureBetween(measure, valueA, valueB, guid) {
789
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.From, valueA, filters_js_1.NumericOperators.To, valueB, guid);
790
+ }
791
+ exports.measureBetween = measureBetween;
792
+ /**
793
+ * Creates a filter to isolate a measure value between but not equal to two given numbers.
794
+ *
795
+ * @example
796
+ * Filter for categories that have an average revenue greater than 50 and less than
797
+ * 100 in the Sample ECommerce data model.
798
+ * ```ts
799
+ * filterFactory.measureBetweenNotEqual(
800
+ * measures.average(DM.Commerce.Revenue),
801
+ * 50,
802
+ * 100
803
+ * )
804
+ * ```
805
+ * @param measure - Measure to filter by
806
+ * @param valueA - Min value
807
+ * @param valueB - Max value
808
+ * @param guid - Optional GUID for the filter
809
+ * @returns A filter instance
810
+ */
811
+ function measureBetweenNotEqual(measure, valueA, valueB, guid) {
812
+ return measureBase(measure.attribute, measure, filters_js_1.NumericOperators.FromNotEqual, valueA, filters_js_1.NumericOperators.ToNotEqual, valueB, guid);
813
+ }
814
+ exports.measureBetweenNotEqual = measureBetweenNotEqual;
815
+ // RANKING FILTERS
816
+ /**
817
+ * Creates a filter to isolate items that rank towards the top for a given measure.
818
+ *
819
+ * @example
820
+ * Filter for age ranges with the top 3 highest total revenue in the Sample ECommerce data model.
821
+ * ```ts
822
+ * filterFactory.topRanking(
823
+ * DM.Commerce.AgeRange,
824
+ * measures.sum(DM.Commerce.Revenue),
825
+ * 3
826
+ * )
827
+ * ```
828
+ * @param attribute - Attribute to filter
829
+ * @param measure - Measure to filter by
830
+ * @param count - Number of members to return
831
+ * @param guid - Optional GUID for the filter
832
+ * @returns A filter instance
833
+ */
834
+ function topRanking(attribute, measure, count, guid) {
835
+ return new filters_js_1.RankingFilter(attribute, measure, filters_js_1.RankingOperators.Top, count, guid);
836
+ }
837
+ exports.topRanking = topRanking;
838
+ /**
839
+ * Creates a filter to isolate items that rank towards the bottom for a given measure.
840
+ *
841
+ * @example
842
+ * Filter for age ranges with the bottom 3 lowest total revenue in the Sample ECommerce data model.
843
+ * ```ts
844
+ * filterFactory.bottomRanking(
845
+ * DM.Commerce.AgeRange,
846
+ * measures.sum(DM.Commerce.Revenue),
847
+ * 3
848
+ * )
849
+ * ```
850
+ * @param attribute - Attribute to filter
851
+ * @param measure - Measure to filter by
852
+ * @param count - Number of members to return
853
+ * @param guid - Optional GUID for the filter
854
+ * @returns A filter instance
855
+ */
856
+ function bottomRanking(attribute, measure, count, guid) {
857
+ return new filters_js_1.RankingFilter(attribute, measure, filters_js_1.RankingOperators.Bottom, count, guid);
858
+ }
859
+ exports.bottomRanking = bottomRanking;
860
+ const relate = (node) => {
861
+ if (Array.isArray(node)) {
862
+ const [first, ...rest] = node;
863
+ return rest.length === 0
864
+ ? relate(first)
865
+ : {
866
+ operator: 'AND',
867
+ left: relate(first),
868
+ right: relate(rest),
869
+ };
870
+ }
871
+ return node;
872
+ };
873
+ /**
874
+ * Set of logic operators for filter relations construction
875
+ *
876
+ * These operators are still in beta.
877
+ *
878
+ * @example
879
+ * ```ts
880
+ * import { filters } from '@sisense/sdk-data';
881
+ *
882
+ * // define filters
883
+ * const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 1000);
884
+ * const countryFilter = filterFactory.members(DM.Commerce.Country, ['USA', 'Canada']);
885
+ * const genderFilter = filterFactory.doesntContain(DM.Commerce.Gender, 'Unspecified');
886
+ * const costFilter = filterFactory.between(DM.Commerce.Cost, 1000, 2000);
887
+ *
888
+ * // create filter relations of two filters
889
+ * const orFilerRelations = filterFactory.logic.or(revenueFilter, countryFilter);
890
+ * // revenueFilter OR countryFilter
891
+ *
892
+ * // filter relations can have nested filter relations
893
+ * const mixedFilterRelations = filterFactory.logic.and(genderFilter, orFilerRelations);
894
+ * // genderFilter AND (revenueFilter OR countryFilter)
895
+ *
896
+ * // array, specified in filter relations, will be converted to an intersection of filters automatically
897
+ * const arrayFilterRelations = filterFactory.logic.or([genderFilter, costFilter], mixedFilterRelations);
898
+ * // (genderFilter AND costFilter) OR (genderFilter AND (revenueFilter OR countryFilter))
899
+ * ```
900
+ * @beta
901
+ */
902
+ // eslint-disable-next-line @typescript-eslint/no-namespace
903
+ var logic;
904
+ (function (logic) {
905
+ /**
906
+ * Creates an 'AND' filter relations
907
+ *
908
+ * @example
909
+ * Create filter relations for items that have a revenue greater than 100 and are in new condition
910
+ * in the Sample ECommerce data model.
911
+ * ```ts
912
+ * const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 100);
913
+ * const conditionFilter = filterFactory.equals(DM.Commerce.Condition, 'New');
914
+ *
915
+ * const andFilerRelation = filterFactory.logic.and(revenueFilter, conditionFilter);
916
+ * ```
917
+ * @param left First filter or filter relations
918
+ * @param right Second filter or filter relations
919
+ * @returns Filter relations
920
+ * @beta
921
+ */
922
+ logic.and = (left, right) => ({
923
+ operator: 'AND',
924
+ left: relate(left),
925
+ right: relate(right),
926
+ });
927
+ /**
928
+ * Creates an 'OR' filter relations
929
+ *
930
+ * @example
931
+ * Create filter relations for items that have a revenue greater than 100 or are in new condition
932
+ * in the Sample ECommerce data model.
933
+ * ```ts
934
+ * const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 100);
935
+ * const conditionFilter = filterFactory.equals(DM.Commerce.Condition, 'New');
936
+ *
937
+ * const orFilerRelation = filterFactory.logic.or(revenueFilter, conditionFilter);
938
+ * ```
939
+ * @param left First filter or filter relations
940
+ * @param right Second filter or filter relations
941
+ * @returns Filter relations
942
+ * @beta
943
+ */
944
+ logic.or = (left, right) => ({
945
+ operator: 'OR',
946
+ left: relate(left),
947
+ right: relate(right),
948
+ });
949
+ })(logic = exports.logic || (exports.logic = {}));
950
+ // CUSTOM FILTER
951
+ /**
952
+ * Creates a filter from JAQL
953
+ *
954
+ * @param jaql - Filter Jaql
955
+ * @param guid - Optional GUID for the filter
956
+ * @returns A filter instance
957
+ * @internal
958
+ */
959
+ function customFilter(attribute, jaql, guid) {
960
+ return new filters_js_1.CustomFilter(attribute, jaql, guid);
961
+ }
962
+ exports.customFilter = customFilter;