@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,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
+ const filter_from_jaql_util_js_1 = require("./utils/filter-from-jaql-util.js");
6
+ // LOGICAL FILTERS
7
+ /**
8
+ * Creates a filter representing the union of multiple filters on the same attribute. The resulting
9
+ * union filter filters on items that match any of the given filters.
10
+ *
11
+ * To create 'or' filters using different attributes, use the {@link logic.and | `or()`} function.
12
+ *
13
+ * @example
14
+ * Filter for countries that start with the letter 'A' **or** end with the letter 'A'
15
+ * in the Sample ECommerce data model.
16
+ * ```ts
17
+ * filterFactory.union([
18
+ * filterFactory.startsWith(DM.Country.Country, 'A'),
19
+ * filterFactory.endsWith(DM.Country.Country, 'A'),
20
+ * ])
21
+ * ```
22
+ * @param filters - Filters to union. The filters must all be on the same attribute.
23
+ * @param guid - Optional GUID for the filter
24
+ * @returns A filter instance
25
+ */
26
+ function union(filters, guid) {
27
+ return new filters_js_1.LogicalAttributeFilter(filters, filters_js_1.LogicalOperators.Union, guid);
28
+ }
29
+ exports.union = union;
30
+ /**
31
+ * Creates a filter representing the intersection of multiple filters on the same attribute. The resulting
32
+ * intersection filter filters on items that match all of the given filters.
33
+ *
34
+ * To create 'and' filters using different attributes, use the {@link logic.and | `and()`} function.
35
+ *
36
+ * @example
37
+ * Filter for countries that start with the letter 'A' **and** end with the letter 'A'
38
+ * in the Sample ECommerce data model.
39
+ * ```ts
40
+ * filterFactory.intersection([
41
+ * filterFactory.startsWith(DM.Country.Country, 'A'),
42
+ * filterFactory.endsWith(DM.Country.Country, 'A'),
43
+ * ])
44
+ * ```
45
+ * @param filters - Filters to intersect. The filters must all be on the same attribute.
46
+ * @param guid - Optional GUID for the filter
47
+ * @returns A filter instance
48
+ */
49
+ function intersection(filters, guid) {
50
+ return new filters_js_1.LogicalAttributeFilter(filters, filters_js_1.LogicalOperators.Intersection, guid);
51
+ }
52
+ exports.intersection = intersection;
53
+ /**
54
+ * Creates a filter that excludes items matching the given filter
55
+ * from all items or from items matching the optional input filter.
56
+ *
57
+ * @example
58
+ * Filter for items where the country name does not contain the letter 'A'
59
+ * from the Sample ECommerce data model.
60
+ * ```ts
61
+ * filterFactory.exclude(filterFactory.contains(DM.Country.Country, 'A'))
62
+ * ```
63
+ *
64
+ * Filter for items where the country name starts with the letter 'B' but does not contain the letter 'A'
65
+ * from the Sample ECommerce data model. This filter will match countries like 'Belgium', but will not
66
+ * match countries like 'Bermuda'.
67
+ * ```ts
68
+ * filterFactory.exclude(
69
+ * filterFactory.contains(DM.Country.Country, 'A'),
70
+ * filterFactory.startsWith(DM.Country.Country, 'B')
71
+ * )
72
+ * ```
73
+ * @param filter - Filter to exclude
74
+ * @param input - Input filter to exclude from, on the same attribute. If not provided, the filter excludes from all items.
75
+ * @param guid - Optional GUID for the filter
76
+ * @returns A filter representing an exclusion of the given filter
77
+ * from all attribute members or from the optional input filter
78
+ */
79
+ function exclude(filter, input, guid) {
80
+ return new filters_js_1.ExcludeFilter(filter, input, guid);
81
+ }
82
+ exports.exclude = exclude;
83
+ // TEXT / NUMERIC FILTERS
84
+ /**
85
+ * Creates a filter to isolate attribute values that do not contain a specified string.
86
+ *
87
+ * Matching is case insensitive.
88
+ *
89
+ * You can optionally use wildcard characters for pattern matching, as described in the
90
+ * {@link like | `like()`} function.
91
+ *
92
+ * @example
93
+ * Filter for categories in the Sample ECommerce data model where the category name doesn't contain
94
+ * 'digital'. This filter matches categories not like 'Digital Cameras' and 'MP3 & Digital Media Players'.
95
+ * ```ts
96
+ * filterFactory.contains(DM.Category.Category, 'digital')
97
+ * ```
98
+ * @param attribute - Text attribute to filter on
99
+ * @param value - Value to filter by
100
+ * @param guid - Optional GUID for the filter
101
+ * @returns A filter instance
102
+ */
103
+ function doesntContain(attribute, value, guid) {
104
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntContain, value, guid);
105
+ }
106
+ exports.doesntContain = doesntContain;
107
+ /**
108
+ * Creates a filter to isolate attribute values that do not end with a specified string.
109
+ *
110
+ * Matching is case insensitive.
111
+ *
112
+ * You can optionally use wildcard characters for pattern matching, as described in the
113
+ * {@link like | `like()`} function.
114
+ *
115
+ * @example
116
+ * Filter for countries in the Sample ECommerce data model where the country name doesn't end with
117
+ * 'land'. This filter matches countries not like 'Iceland' and 'Ireland'.
118
+ * ```ts
119
+ * filterFactory.doesntEndWith(DM.Country.Country, 'land')
120
+ * ```
121
+ * @param attribute - Text attribute to filter on
122
+ * @param value - Value to filter by
123
+ * @param guid - Optional GUID for the filter
124
+ * @returns A filter instance
125
+ */
126
+ function doesntEndWith(attribute, value, guid) {
127
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntEndWith, value, guid);
128
+ }
129
+ exports.doesntEndWith = doesntEndWith;
130
+ /**
131
+ * Creates a filter to isolate attribute values that do not start with a specified string.
132
+ *
133
+ * Matching is case insensitive.
134
+ *
135
+ * You can optionally use wildcard characters for pattern matching, as described in the
136
+ * {@link like | `like()`} function.
137
+ *
138
+ * @example
139
+ * Filter for countries in the Sample ECommerce data model where the country name doesn't start with
140
+ * 'United'. This filter matches countries not like 'United States' and 'United Kingdom'.
141
+ * ```ts
142
+ * filterFactory.doesntStartWith(DM.Country.Country, 'United')
143
+ * ```
144
+ * @param attribute - Text attribute to filter on
145
+ * @param value - Value to filter by
146
+ * @param guid - Optional GUID for the filter
147
+ * @returns A filter instance
148
+ */
149
+ function doesntStartWith(attribute, value, guid) {
150
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntStartWith, value, guid);
151
+ }
152
+ exports.doesntStartWith = doesntStartWith;
153
+ /**
154
+ * Creates a filter to isolate attribute values that contain a specified string.
155
+ *
156
+ * Matching is case insensitive.
157
+ *
158
+ * You can optionally use wildcard characters for pattern matching, as described in the
159
+ * {@link like | `like()`} function.
160
+ *
161
+ * @example
162
+ * Filter for categories in the Sample ECommerce data model where the category name contains
163
+ * 'digital'. This filter matches categories like 'Digital Cameras' and 'MP3 & Digital Media Players'.
164
+ * ```ts
165
+ * filterFactory.contains(DM.Category.Category, 'digital')
166
+ * ```
167
+ * @param attribute - Text attribute to filter on
168
+ * @param value - Value to filter by
169
+ * @param guid - Optional GUID for the filter
170
+ * @returns A filter instance
171
+ */
172
+ function contains(attribute, value, guid) {
173
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Contains, value, guid);
174
+ }
175
+ exports.contains = contains;
176
+ /**
177
+ * Creates a filter to isolate attribute values that end with a specified string.
178
+ *
179
+ * Matching is case insensitive.
180
+ *
181
+ * You can optionally use wildcard characters for pattern matching, as described in the
182
+ * {@link like | `like()`} function.
183
+ *
184
+ * @example
185
+ * Filter for countries in the Sample ECommerce data model where the country name ends with
186
+ * 'land'. This filter matches countries like 'Ireland' and 'Iceland'.
187
+ * ```ts
188
+ * filterFactory.endsWith(DM.Country.Country, 'land')
189
+ * ```
190
+ * @param attribute - Text attribute to filter on
191
+ * @param value - Value to filter by
192
+ * @param guid - Optional GUID for the filter
193
+ * @returns A filter instance
194
+ */
195
+ function endsWith(attribute, value, guid) {
196
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.EndsWith, value, guid);
197
+ }
198
+ exports.endsWith = endsWith;
199
+ /**
200
+ * Creates a filter to isolate attribute values that start with a specified string.
201
+ *
202
+ * Matching is case insensitive.
203
+ *
204
+ * You can optionally use wildcard characters for pattern matching, as described in the
205
+ * {@link like | `like()`} function.
206
+ *
207
+ * @example
208
+ * Filter for countries in the Sample ECommerce data model where the country name starts with
209
+ * 'United'. This filter matches countries like 'United States' and 'United Kingdom'.
210
+ * ```ts
211
+ * filterFactory.startsWith(DM.Country.Country, 'United')
212
+ * ```
213
+ * @param attribute - Text attribute to filter on
214
+ * @param value - Value to filter by
215
+ * @param guid - Optional GUID for the filter
216
+ * @returns A filter instance
217
+ */
218
+ function startsWith(attribute, value, guid) {
219
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.StartsWith, value, guid);
220
+ }
221
+ exports.startsWith = startsWith;
222
+ /**
223
+ * Creates a filter to isolate attribute values that match a specified string pattern.
224
+ *
225
+ * The pattern can include the following wildcard characters:
226
+ *
227
+ * + `_`: Matches a single character
228
+ * + `%`: Matches multiple characters
229
+ *
230
+ * To search for a literal underscore (`_`) or percent symbol (`%`), use the backslash (`\`) escape
231
+ * character.
232
+ *
233
+ * Matching is case insensitive.
234
+ *
235
+ * @example
236
+ * Filter for countries from the Sample ECommerce data model where the country name starts with an
237
+ * 'A' and ends with an 'a'. This filter matches countries like 'Argentina' and 'Australia'.
238
+ * ```ts
239
+ * filterFactory.like(DM.Country.Country, 'A%a')
240
+ * ```
241
+ * @param attribute - Text attribute to filter on
242
+ * @param value - Value to filter by
243
+ * @param guid - Optional GUID for the filter
244
+ * @returns A filter instance
245
+ */
246
+ function like(attribute, value, guid) {
247
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Like, value, guid);
248
+ }
249
+ exports.like = like;
250
+ /**
251
+ * Creates a filter to isolate attribute values that do not equal a specified string or number.
252
+ *
253
+ * When filtering against a string:
254
+ *
255
+ * + Matching is case insensitive.
256
+ * + You can optionally use wildcard characters for pattern matching, as described in the
257
+ * {@link like | `like()`} function.
258
+ *
259
+ * @example
260
+ * Filter for items not in new condition from the Sample ECommerce data model.
261
+ * ```ts
262
+ * filterFactory.doesntEqual(DM.Commerce.Condition, 'New')
263
+ * ```
264
+ * @param attribute - Text or numeric attribute to filter on
265
+ * @param value - Value to filter by
266
+ * @returns A filter instance
267
+ */
268
+ function doesntEqual(attribute, value, guid) {
269
+ if (typeof value === 'string') {
270
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.DoesntEqual, value, guid);
271
+ }
272
+ else {
273
+ return numeric(attribute, filters_js_1.NumericOperators.DoesntEqual, value, undefined, undefined, guid);
274
+ }
275
+ }
276
+ exports.doesntEqual = doesntEqual;
277
+ /**
278
+ * Creates a filter to isolate attribute values that equal a specified string or number.
279
+ *
280
+ * When filtering against a string:
281
+ *
282
+ * + Matching is case insensitive.
283
+ * + You can optionally use wildcard characters for pattern matching, as described in the
284
+ * {@link like | `like()`} function.
285
+ *
286
+ * @example
287
+ * Filter for items in new condition from the Sample ECommerce data model.
288
+ * ```ts
289
+ * filterFactory.equals(DM.Commerce.Condition, 'New')
290
+ * ```
291
+ * @param attribute - Text or numeric attribute to filter on
292
+ * @param value - Value to filter by
293
+ * @param guid - Optional GUID for the filter
294
+ * @returns A filter instance
295
+ */
296
+ function equals(attribute, value, guid) {
297
+ if (typeof value === 'string') {
298
+ return new filters_js_1.TextFilter(attribute, filters_js_1.TextOperators.Equals, value, guid);
299
+ }
300
+ else {
301
+ return numeric(attribute, filters_js_1.NumericOperators.Equals, value, undefined, undefined, guid);
302
+ }
303
+ }
304
+ exports.equals = equals;
305
+ /**
306
+ * Creates a filter to isolate attribute values strictly greater than a specified number.
307
+ *
308
+ * @example
309
+ * Filter for items where the cost is greater than 100 from the Sample ECommerce data model.
310
+ * ```ts
311
+ * filterFactory.greaterThan(DM.Commerce.Cost, 100)
312
+ * ```
313
+ * @param attribute - Numeric attribute to filter on
314
+ * @param value - Value to filter by
315
+ * @param guid - Optional GUID for the filter
316
+ * @returns A filter instance
317
+ */
318
+ function greaterThan(attribute, value, guid) {
319
+ return numeric(attribute, filters_js_1.NumericOperators.FromNotEqual, value, undefined, undefined, guid);
320
+ }
321
+ exports.greaterThan = greaterThan;
322
+ /**
323
+ * Creates a filter to isolate attribute values greater than or equal to a specified number.
324
+ *
325
+ * @example
326
+ * Filter for items where the cost is greater than or equal to 100 from the Sample ECommerce data model.
327
+ * ```ts
328
+ * filterFactory.greaterThanOrEqual(DM.Commerce.Cost, 100)
329
+ * ```
330
+ * @param attribute - Numeric attribute to filter on
331
+ * @param value - Value to filter by
332
+ * @param guid - Optional GUID for the filter
333
+ * @returns A filter instance
334
+ */
335
+ function greaterThanOrEqual(attribute, value, guid) {
336
+ return numeric(attribute, filters_js_1.NumericOperators.From, value, undefined, undefined, guid);
337
+ }
338
+ exports.greaterThanOrEqual = greaterThanOrEqual;
339
+ /**
340
+ * Creates a filter to isolate attribute values strictly less than a specified number.
341
+ *
342
+ * @example
343
+ * Filter for items where the cost is less than 100 from the Sample ECommerce data model.
344
+ * ```ts
345
+ * filterFactory.lessThan(DM.Commerce.Cost, 100)
346
+ * ```
347
+ * @param attribute - Numeric attribute to filter on
348
+ * @param value - Value to filter by
349
+ * @param guid - Optional GUID for the filter
350
+ * @returns A filter instance
351
+ */
352
+ function lessThan(attribute, value, guid) {
353
+ return numeric(attribute, filters_js_1.NumericOperators.ToNotEqual, value, undefined, undefined, guid);
354
+ }
355
+ exports.lessThan = lessThan;
356
+ /**
357
+ * Creates a filter to isolate attribute values less than or equal to a specified number.
358
+ *
359
+ * @example
360
+ * Filter for items where the cost is less than or equal to 100 from the Sample ECommerce data model.
361
+ * ```ts
362
+ * filterFactory.lessThanOrEqual(DM.Commerce.Cost, 100)
363
+ * ```
364
+ * @param attribute - Numeric attribute to filter on
365
+ * @param value - Value to filter by
366
+ * @param guid - Optional GUID for the filter
367
+ * @returns A filter instance
368
+ */
369
+ function lessThanOrEqual(attribute, value, guid) {
370
+ return numeric(attribute, filters_js_1.NumericOperators.To, value, undefined, undefined, guid);
371
+ }
372
+ exports.lessThanOrEqual = lessThanOrEqual;
373
+ /**
374
+ * Creates a filter to isolate attribute values within or exactly matching two specified numerical boundaries.
375
+ *
376
+ * @example
377
+ * 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.
378
+ * ```ts
379
+ * filterFactory.between(DM.Commerce.Cost, 100, 200)
380
+ * ```
381
+ * @param attribute - Numeric attribute to filter on
382
+ * @param valueA - Value to filter from
383
+ * @param valueB - Value to filter to
384
+ * @param guid - Optional GUID for the filter
385
+ * @returns A filter instance
386
+ */
387
+ function between(attribute, valueA, valueB, guid) {
388
+ return numeric(attribute, filters_js_1.NumericOperators.From, valueA, filters_js_1.NumericOperators.To, valueB, guid);
389
+ }
390
+ exports.between = between;
391
+ /**
392
+ * Creates a filter that isolates attribute values strictly within two specified numerical boundaries.
393
+ *
394
+ * @example
395
+ * Filter for items from the Sample ECommerce data model where the cost is greater than 100 and less than 200.
396
+ * ```ts
397
+ * filterFactory.betweenNotEqual(DM.Commerce.Cost, 100, 200)
398
+ * ```
399
+ * @param attribute - Numeric attribute to filter on
400
+ * @param valueA - Value to filter from
401
+ * @param valueB - Value to filter to
402
+ * @param guid - Optional GUID for the filter
403
+ * @returns A filter instance
404
+ */
405
+ function betweenNotEqual(attribute, valueA, valueB, guid) {
406
+ return numeric(attribute, filters_js_1.NumericOperators.FromNotEqual, valueA, filters_js_1.NumericOperators.ToNotEqual, valueB, guid);
407
+ }
408
+ exports.betweenNotEqual = betweenNotEqual;
409
+ /**
410
+ * Creates a custom numeric filter that filters for given attribute values.
411
+ *
412
+ * @example
413
+ * Filter for items where the cost is greater than 100 and less than 200
414
+ * from the Sample ECommerce data model.
415
+ * ```ts
416
+ * filterFactory.numeric(
417
+ * DM.Commerce.Cost,
418
+ * NumericOperators.From,
419
+ * 100,
420
+ * NumericOperators.To,
421
+ * 200
422
+ * )
423
+ * ```
424
+ * @param attribute - Numeric attribute to filter
425
+ * @param operatorA - First operator
426
+ * @param valueA - First value
427
+ * @param operatorB - Second operator
428
+ * @param valueB - Second value
429
+ * @param guid - Optional GUID for the filter
430
+ * @returns A custom numeric filter of the given attribute
431
+ */
432
+ function numeric(attribute, operatorA, valueA, operatorB, valueB, guid) {
433
+ return new filters_js_1.NumericFilter(attribute, operatorA, valueA, operatorB, valueB, guid);
434
+ }
435
+ exports.numeric = numeric;
436
+ /**
437
+ * Creates a filter to isolate attribute values that match any of the specified strings.
438
+ *
439
+ * Matching is case sensitive.
440
+ *
441
+ * @example
442
+ * Filter for items where the condition is 'Used' or 'Refurbished'
443
+ * from the Sample ECommerce data model.
444
+ * ```ts
445
+ * filterFactory.members(DM.Commerce.Condition, ['Used', 'Refurbished'])
446
+ * ```
447
+ * @param attribute - Attribute to filter on
448
+ * @param members - Array of member values to filter by
449
+ * @param guid - Optional GUID for the filter
450
+ * @returns A filter instance
451
+ */
452
+ function members(attribute, members, guid) {
453
+ return new filters_js_1.MembersFilter(attribute, members, 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(jaql, guid) {
960
+ return (0, filter_from_jaql_util_js_1.createGenericFilter)(jaql, guid);
961
+ }
962
+ exports.customFilter = customFilter;