@sisense/sdk-data 1.11.0 → 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 (96) 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/filters/factory.d.ts +80 -42
  88. package/dist/dimensional-model/filters/factory.js +123 -85
  89. package/dist/dimensional-model/filters/filters.d.ts +34 -12
  90. package/dist/dimensional-model/filters/filters.js +69 -27
  91. package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -2
  92. package/dist/dimensional-model/filters/utils/condition-filter-util.js +27 -25
  93. package/dist/dimensional-model/filters/utils/filter-code-util.js +1 -1
  94. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +16 -10
  95. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +34 -27
  96. package/package.json +18 -9
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /*
6
+ * Types
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.JaqlSortDirection = exports.DataType = exports.DateLevels = exports.MetadataTypes = exports.Sort = exports.AggregationTypes = void 0;
10
+ /**
11
+ * Different aggregation types
12
+ */
13
+ exports.AggregationTypes = {
14
+ /** Sum aggregation type */
15
+ Sum: 'sum',
16
+ /** Average aggregation type */
17
+ Average: 'avg',
18
+ /** Min aggregation type */
19
+ Min: 'min',
20
+ /** Max aggregation type */
21
+ Max: 'max',
22
+ /** Count aggregation type */
23
+ Count: 'count',
24
+ /** Count distinct aggregation type */
25
+ CountDistinct: 'countDistinct',
26
+ /** Median aggregation type */
27
+ Median: 'median',
28
+ /** Variance aggregation type */
29
+ Variance: 'var',
30
+ /** Standard deviation aggregation type */
31
+ StandardDeviation: 'stdev',
32
+ };
33
+ /**
34
+ * Different sort types.
35
+ */
36
+ var Sort;
37
+ (function (Sort) {
38
+ /** No sort definition */
39
+ Sort[Sort["None"] = 0] = "None";
40
+ /** Sort Ascending */
41
+ Sort[Sort["Ascending"] = 1] = "Ascending";
42
+ /** Sort Descending */
43
+ Sort[Sort["Descending"] = 2] = "Descending";
44
+ })(Sort = exports.Sort || (exports.Sort = {}));
45
+ /**
46
+ * Different metadata types
47
+ *
48
+ * @internal
49
+ */
50
+ exports.MetadataTypes = {
51
+ Measure: 'measure',
52
+ MeasureTemplate: 'measuretemplate',
53
+ BaseMeasure: 'basemeasure',
54
+ CalculatedMeasure: 'calculatedmeasure',
55
+ Dimension: 'dimension',
56
+ DateDimension: 'datedimension',
57
+ TextDimension: 'textdimension',
58
+ NumericDimension: 'numericdimension',
59
+ DateLevel: 'datelevel',
60
+ Attribute: 'attribute',
61
+ TextAttribute: 'text-attribute',
62
+ NumericAttribute: 'numeric-attribute',
63
+ Filter: 'filter',
64
+ DimensionFilter: 'dimensionfilter',
65
+ MeasureFilter: 'measurefilter',
66
+ /**
67
+ * Checks whether the given object or type is a metadata element
68
+ *
69
+ * @param o - object to check
70
+ * @returns true if the object or type is a metadata element
71
+ */
72
+ isMetadata(o) {
73
+ return (exports.MetadataTypes.isMeasure(o) ||
74
+ exports.MetadataTypes.isDimension(o) ||
75
+ exports.MetadataTypes.isAttribute(o) ||
76
+ exports.MetadataTypes.isFilter(o));
77
+ },
78
+ /**
79
+ * Checks whether the given object or type is a measure template
80
+ *
81
+ * @param o - object to check
82
+ * @returns true if the object or type is a measure template
83
+ */
84
+ isMeasureTemplate(o) {
85
+ if (!o) {
86
+ return false;
87
+ }
88
+ if (typeof o === 'string') {
89
+ const type = o;
90
+ return type.toLowerCase() === exports.MetadataTypes.MeasureTemplate;
91
+ }
92
+ return (o.agg === '*' ||
93
+ o.aggregation === '*' ||
94
+ (o.type && o.type.toLowerCase() === exports.MetadataTypes.MeasureTemplate));
95
+ },
96
+ /**
97
+ * Checks whether the given object or type is a base measure
98
+ *
99
+ * @param o - object to check
100
+ * @returns true if the object or type is a base measure
101
+ */
102
+ isBaseMeasure(o) {
103
+ if (!o) {
104
+ return false;
105
+ }
106
+ if (typeof o === 'string') {
107
+ const type = o;
108
+ return type.toLowerCase() === exports.MetadataTypes.BaseMeasure;
109
+ }
110
+ return (o.agg || o.aggregation) && o.attribute && !this.isMeasureTemplate(o);
111
+ },
112
+ /**
113
+ * Checks whether the given object or type is a measure - of any type
114
+ *
115
+ * @param o - object to check
116
+ * @returns true if the object or type is a measure - of any type
117
+ */
118
+ isMeasure(o) {
119
+ if (!o) {
120
+ return false;
121
+ }
122
+ if (typeof o === 'string') {
123
+ const type = o;
124
+ return (type.toLowerCase() === exports.MetadataTypes.Measure ||
125
+ type.toLowerCase() === exports.MetadataTypes.BaseMeasure ||
126
+ type.toLowerCase() === exports.MetadataTypes.MeasureTemplate ||
127
+ type.toLowerCase() === exports.MetadataTypes.CalculatedMeasure);
128
+ }
129
+ return this.isBaseMeasure(o) || this.isCalculatedMeasure(o) || this.isMeasureTemplate(o);
130
+ },
131
+ /**
132
+ * Checks whether the given object or type is a calculated measure
133
+ *
134
+ * @param o - object to check
135
+ * @returns true if the object or type is a calculated measure
136
+ */
137
+ isCalculatedMeasure(o) {
138
+ if (!o) {
139
+ return false;
140
+ }
141
+ if (typeof o === 'string') {
142
+ const type = o;
143
+ return type.toLowerCase() === exports.MetadataTypes.CalculatedMeasure;
144
+ }
145
+ return (o.expression || o.formula) && o.context;
146
+ },
147
+ /**
148
+ * Checks whether the given object or type is a date dimension
149
+ *
150
+ * @param o - object to check
151
+ * @returns true if the object or type is a date dimension
152
+ */
153
+ isDateDimension(o) {
154
+ if (!o) {
155
+ return false;
156
+ }
157
+ if (typeof o === 'string') {
158
+ const type = o;
159
+ return type.toLowerCase() === exports.MetadataTypes.DateDimension;
160
+ }
161
+ return (o.dim || o.expression) && o.level;
162
+ },
163
+ /**
164
+ * Checks whether the given object or type is a text dimension
165
+ *
166
+ * @param o - object to check
167
+ * @returns true if the object or type is a text dimension
168
+ */
169
+ isTextDimension(o) {
170
+ if (!o) {
171
+ return false;
172
+ }
173
+ if (typeof o === 'string') {
174
+ const type = o;
175
+ return type.toLowerCase() === exports.MetadataTypes.TextDimension;
176
+ }
177
+ return false;
178
+ },
179
+ /**
180
+ * Checks whether the given object or type is a numeric dimension
181
+ *
182
+ * @param o - object to check
183
+ * @returns true if the object or type is a numeric dimension
184
+ */
185
+ isNumericDimension(o) {
186
+ if (!o) {
187
+ return false;
188
+ }
189
+ if (typeof o === 'string') {
190
+ const type = o;
191
+ return type.toLowerCase() === exports.MetadataTypes.NumericDimension;
192
+ }
193
+ return false;
194
+ },
195
+ /**
196
+ * Checks whether the given object or type is a dimension - of any type
197
+ *
198
+ * @param o - object to check
199
+ * @returns true if the object or type is a dimension - of any type
200
+ */
201
+ isDimension(o) {
202
+ if (typeof o === 'object') {
203
+ o = o.type;
204
+ }
205
+ if (typeof o === 'string') {
206
+ const type = o;
207
+ return (type.toLowerCase() === exports.MetadataTypes.DateDimension ||
208
+ type.toLowerCase() === exports.MetadataTypes.Dimension ||
209
+ type.toLowerCase() === exports.MetadataTypes.TextDimension ||
210
+ type.toLowerCase() === exports.MetadataTypes.NumericDimension);
211
+ }
212
+ return false;
213
+ },
214
+ /**
215
+ * Checks whether the given object or type is an attribute - of any type
216
+ *
217
+ * @param o - object to check
218
+ * @returns true if the object or type is an attribute - of any type
219
+ */
220
+ isAttribute(o) {
221
+ if (typeof o === 'string') {
222
+ const type = o;
223
+ return (type.toLowerCase() === exports.MetadataTypes.Attribute ||
224
+ type.toLowerCase() === exports.MetadataTypes.TextAttribute ||
225
+ type.toLowerCase() === exports.MetadataTypes.NumericAttribute ||
226
+ type.toLowerCase() === exports.MetadataTypes.DateLevel);
227
+ }
228
+ if (o && o.type) {
229
+ return this.isAttribute(o.type);
230
+ }
231
+ return false;
232
+ },
233
+ /**
234
+ * Checks whether the given object or type is a filter
235
+ *
236
+ * @param o - object to check
237
+ * @returns true if the object or type is a filter
238
+ */
239
+ isFilter(o) {
240
+ if (typeof o === 'object') {
241
+ o = o.type;
242
+ }
243
+ if (typeof o === 'string') {
244
+ const type = o;
245
+ return (type.toLowerCase() === exports.MetadataTypes.Filter ||
246
+ type.toLowerCase() === exports.MetadataTypes.DimensionFilter ||
247
+ type.toLowerCase() === exports.MetadataTypes.MeasureFilter);
248
+ }
249
+ return false;
250
+ },
251
+ };
252
+ /**
253
+ * Levels for {@link DateDimension}
254
+ */
255
+ exports.DateLevels = {
256
+ Years: 'Years',
257
+ Quarters: 'Quarters',
258
+ Months: 'Months',
259
+ Weeks: 'Weeks',
260
+ Days: 'Days',
261
+ Hours: 'Hours',
262
+ MinutesRoundTo30: 'MinutesRoundTo30',
263
+ MinutesRoundTo15: 'MinutesRoundTo15',
264
+ AggHours: 'AggHours',
265
+ AggMinutesRoundTo30: 'AggMinutesRoundTo30',
266
+ AggMinutesRoundTo15: 'AggMinutesRoundTo15',
267
+ AggMinutesRoundTo1: 'AggMinutesRoundTo1',
268
+ /** @internal */
269
+ get all() {
270
+ return [
271
+ exports.DateLevels.Years,
272
+ exports.DateLevels.Quarters,
273
+ exports.DateLevels.Months,
274
+ exports.DateLevels.Weeks,
275
+ exports.DateLevels.Days,
276
+ exports.DateLevels.Hours,
277
+ exports.DateLevels.MinutesRoundTo30,
278
+ exports.DateLevels.MinutesRoundTo15,
279
+ exports.DateLevels.AggHours,
280
+ exports.DateLevels.AggMinutesRoundTo30,
281
+ exports.DateLevels.AggMinutesRoundTo15,
282
+ exports.DateLevels.AggMinutesRoundTo1,
283
+ ];
284
+ },
285
+ };
286
+ /** @internal */
287
+ var DataType;
288
+ (function (DataType) {
289
+ DataType["TEXT"] = "text";
290
+ DataType["NUMERIC"] = "numeric";
291
+ DataType["DATETIME"] = "datetime";
292
+ })(DataType = exports.DataType || (exports.DataType = {}));
293
+ /** @internal */
294
+ var JaqlSortDirection;
295
+ (function (JaqlSortDirection) {
296
+ JaqlSortDirection["ASC"] = "asc";
297
+ JaqlSortDirection["DESC"] = "desc";
298
+ })(JaqlSortDirection = exports.JaqlSortDirection || (exports.JaqlSortDirection = {}));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const types_js_1 = require("./types.js");
6
+ describe('MetadataTypes', () => {
7
+ describe('isMeasure', () => {
8
+ it('should fail validation for an invalid measure', () => {
9
+ const measure = {
10
+ name: 'Quantity',
11
+ aggregation: 'sum',
12
+ title: 'Total Quantity',
13
+ };
14
+ expect(types_js_1.MetadataTypes.isMeasure(measure)).toBeFalsy();
15
+ });
16
+ it('should pass validation for a valid measure', () => {
17
+ const measure = {
18
+ name: 'sum Revenue',
19
+ type: 'basemeasure',
20
+ desc: '',
21
+ sort: 0,
22
+ aggregation: 'sum',
23
+ attribute: {
24
+ name: 'Revenue',
25
+ type: 'numeric-attribute',
26
+ desc: '',
27
+ expression: '[Commerce.Revenue]',
28
+ },
29
+ };
30
+ expect(types_js_1.MetadataTypes.isMeasure(measure)).toBeTruthy();
31
+ });
32
+ });
33
+ });
@@ -0,0 +1,93 @@
1
+ import './translation/initialize-i18n.js';
2
+ /**
3
+ * @packageDocumentation
4
+ * @group Factories
5
+ * Functions for creating measures, filters, and advanced analytics elements.
6
+ * @group Data Model Utilities
7
+ * Utility functions for creating attributes and dimensions in code.
8
+ */
9
+ export * from './interfaces.js';
10
+ export * from './dimensional-model/types.js';
11
+ export * from './dimensional-model/interfaces.js';
12
+ export * from './dimensional-model/base.js';
13
+ export * from './dimensional-model/data-model.js';
14
+ export * from './dimensional-model/attributes.js';
15
+ export * from './dimensional-model/dimensions.js';
16
+ export * from './dimensional-model/factory.js';
17
+ export * from './dimensional-model/filters/filters.js';
18
+ export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
19
+ /**
20
+ * Functions to create date, text, or numeric filters on specified data.
21
+ *
22
+ * Filters created with these functions can be used to:
23
+ *
24
+ * + Filter explicit queries by query components or query functions
25
+ * + Filter or highlight queries used by UI components, such as charts
26
+ * + Set the filters of filter components
27
+ *
28
+ * @example
29
+ * Example of using React hook `useExecuteQuery` to query the `Sample ECommerce` data source.
30
+ * Factory function `filterFactory.greaterThan()` is used to create a filter on `Revenue` to get values
31
+ * greater than 1000.
32
+ * ```tsx
33
+ * const { data, isLoading, isError } = useExecuteQuery({
34
+ * dataSource: DM.DataSource,
35
+ * dimensions: [DM.Commerce.AgeRange],
36
+ * measures: [measureFactory.sum(DM.Commerce.Revenue)],
37
+ * filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
38
+ * });
39
+ * if (isLoading) {
40
+ * return <div>Loading...</div>;
41
+ * }
42
+ * if (isError) {
43
+ * return <div>Error</div>;
44
+ * }
45
+ * if (data) {
46
+ * return <div>{`Total Rows: ${data.rows.length}`}</div>;
47
+ * }
48
+ * return null;
49
+ * ```
50
+ * @group Factories
51
+ */
52
+ export * as filterFactory from './dimensional-model/filters/factory.js';
53
+ export * from './dimensional-model/measures/measures.js';
54
+ /**
55
+ * Functions to create measures that aggregate, summarize, and accumulate data,
56
+ * plus show changes in data over time.
57
+ *
58
+ * Measures created with these functions can be used in the data options of UI components such as
59
+ * {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
60
+ * and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
61
+ *
62
+ * @example
63
+ * Example of using React hook useExecuteQuery to query the `Sample ECommerce` data source.
64
+ * Factory function `measureFactory.sum()` is used to create a measure that sums the `Revenue` column.
65
+ * ```tsx
66
+ * const { data, isLoading, isError } = useExecuteQuery({
67
+ * dataSource: DM.DataSource,
68
+ * dimensions: [DM.Commerce.AgeRange],
69
+ * measures: [measureFactory.sum(DM.Commerce.Revenue)],
70
+ * filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
71
+ * });
72
+ * if (isLoading) {
73
+ * return <div>Loading...</div>;
74
+ * }
75
+ * if (isError) {
76
+ * return <div>Error</div>;
77
+ * }
78
+ * if (data) {
79
+ * return <div>{`Total Rows: ${data.rows.length}`}</div>;
80
+ * }
81
+ * return null;
82
+ * ```
83
+ * @group Factories
84
+ */
85
+ export * as measureFactory from './dimensional-model/measures/factory.js';
86
+ export * from './dimensional-model/simple-column-types.js';
87
+ /**
88
+ * Functions to create elements for advanced analytics – for example, attributes and measures for constructing a custom Boxplot chart
89
+ *
90
+ * @group Factories
91
+ */
92
+ export * as analyticsFactory from './dimensional-model/analytics/factory.js';
93
+ export * from './utils.js';
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.analyticsFactory = exports.measureFactory = exports.filterFactory = exports.createFilterMatcher = void 0;
30
+ require("./translation/initialize-i18n.js");
31
+ /**
32
+ * @packageDocumentation
33
+ * @group Factories
34
+ * Functions for creating measures, filters, and advanced analytics elements.
35
+ * @group Data Model Utilities
36
+ * Utility functions for creating attributes and dimensions in code.
37
+ */
38
+ __exportStar(require("./interfaces.js"), exports);
39
+ __exportStar(require("./dimensional-model/types.js"), exports);
40
+ __exportStar(require("./dimensional-model/interfaces.js"), exports);
41
+ __exportStar(require("./dimensional-model/base.js"), exports);
42
+ __exportStar(require("./dimensional-model/data-model.js"), exports);
43
+ __exportStar(require("./dimensional-model/attributes.js"), exports);
44
+ __exportStar(require("./dimensional-model/dimensions.js"), exports);
45
+ __exportStar(require("./dimensional-model/factory.js"), exports);
46
+ __exportStar(require("./dimensional-model/filters/filters.js"), exports);
47
+ var filter_matcher_utils_js_1 = require("./dimensional-model/filters/utils/filter-matcher-utils.js");
48
+ Object.defineProperty(exports, "createFilterMatcher", { enumerable: true, get: function () { return filter_matcher_utils_js_1.createFilterMatcher; } });
49
+ /**
50
+ * Functions to create date, text, or numeric filters on specified data.
51
+ *
52
+ * Filters created with these functions can be used to:
53
+ *
54
+ * + Filter explicit queries by query components or query functions
55
+ * + Filter or highlight queries used by UI components, such as charts
56
+ * + Set the filters of filter components
57
+ *
58
+ * @example
59
+ * Example of using React hook `useExecuteQuery` to query the `Sample ECommerce` data source.
60
+ * Factory function `filterFactory.greaterThan()` is used to create a filter on `Revenue` to get values
61
+ * greater than 1000.
62
+ * ```tsx
63
+ * const { data, isLoading, isError } = useExecuteQuery({
64
+ * dataSource: DM.DataSource,
65
+ * dimensions: [DM.Commerce.AgeRange],
66
+ * measures: [measureFactory.sum(DM.Commerce.Revenue)],
67
+ * filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
68
+ * });
69
+ * if (isLoading) {
70
+ * return <div>Loading...</div>;
71
+ * }
72
+ * if (isError) {
73
+ * return <div>Error</div>;
74
+ * }
75
+ * if (data) {
76
+ * return <div>{`Total Rows: ${data.rows.length}`}</div>;
77
+ * }
78
+ * return null;
79
+ * ```
80
+ * @group Factories
81
+ */
82
+ exports.filterFactory = __importStar(require("./dimensional-model/filters/factory.js"));
83
+ __exportStar(require("./dimensional-model/measures/measures.js"), exports);
84
+ /**
85
+ * Functions to create measures that aggregate, summarize, and accumulate data,
86
+ * plus show changes in data over time.
87
+ *
88
+ * Measures created with these functions can be used in the data options of UI components such as
89
+ * {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
90
+ * and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
91
+ *
92
+ * @example
93
+ * Example of using React hook useExecuteQuery to query the `Sample ECommerce` data source.
94
+ * Factory function `measureFactory.sum()` is used to create a measure that sums the `Revenue` column.
95
+ * ```tsx
96
+ * const { data, isLoading, isError } = useExecuteQuery({
97
+ * dataSource: DM.DataSource,
98
+ * dimensions: [DM.Commerce.AgeRange],
99
+ * measures: [measureFactory.sum(DM.Commerce.Revenue)],
100
+ * filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
101
+ * });
102
+ * if (isLoading) {
103
+ * return <div>Loading...</div>;
104
+ * }
105
+ * if (isError) {
106
+ * return <div>Error</div>;
107
+ * }
108
+ * if (data) {
109
+ * return <div>{`Total Rows: ${data.rows.length}`}</div>;
110
+ * }
111
+ * return null;
112
+ * ```
113
+ * @group Factories
114
+ */
115
+ exports.measureFactory = __importStar(require("./dimensional-model/measures/factory.js"));
116
+ __exportStar(require("./dimensional-model/simple-column-types.js"), exports);
117
+ /**
118
+ * Functions to create elements for advanced analytics – for example, attributes and measures for constructing a custom Boxplot chart
119
+ *
120
+ * @group Factories
121
+ */
122
+ exports.analyticsFactory = __importStar(require("./dimensional-model/analytics/factory.js"));
123
+ __exportStar(require("./utils.js"), exports);