@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.
- package/dist/cjs/dimensional-model/analytics/factory.d.ts +47 -0
- package/dist/cjs/dimensional-model/analytics/factory.js +151 -0
- package/dist/cjs/dimensional-model/analytics/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/analytics/factory.test.js +99 -0
- package/dist/cjs/dimensional-model/attributes.d.ts +139 -0
- package/dist/cjs/dimensional-model/attributes.js +342 -0
- package/dist/cjs/dimensional-model/attributes.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/attributes.test.js +154 -0
- package/dist/cjs/dimensional-model/base.d.ts +43 -0
- package/dist/cjs/dimensional-model/base.js +58 -0
- package/dist/cjs/dimensional-model/base.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/base.test.js +17 -0
- package/dist/cjs/dimensional-model/data-model.d.ts +13 -0
- package/dist/cjs/dimensional-model/data-model.js +37 -0
- package/dist/cjs/dimensional-model/dimensions.d.ts +167 -0
- package/dist/cjs/dimensional-model/dimensions.js +307 -0
- package/dist/cjs/dimensional-model/dimensions.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/dimensions.test.js +54 -0
- package/dist/cjs/dimensional-model/factory.d.ts +17 -0
- package/dist/cjs/dimensional-model/factory.js +54 -0
- package/dist/cjs/dimensional-model/filters/factory.d.ts +796 -0
- package/dist/cjs/dimensional-model/filters/factory.js +962 -0
- package/dist/cjs/dimensional-model/filters/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/factory.test.js +366 -0
- package/dist/cjs/dimensional-model/filters/filters.d.ts +321 -0
- package/dist/cjs/dimensional-model/filters/filters.js +614 -0
- package/dist/cjs/dimensional-model/filters/filters.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/filters.test.js +225 -0
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.d.ts +47 -0
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +111 -0
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +21 -0
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +194 -0
- package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.d.ts +2 -0
- package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.js +12 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +13 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +54 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.js +32 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +73 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +190 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.js +558 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.js +174 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.js +236 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.d.ts +17 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +79 -0
- package/dist/cjs/dimensional-model/filters/utils/types.d.ts +200 -0
- package/dist/cjs/dimensional-model/filters/utils/types.js +99 -0
- package/dist/cjs/dimensional-model/interfaces.d.ts +512 -0
- package/dist/cjs/dimensional-model/interfaces.js +31 -0
- package/dist/cjs/dimensional-model/measures/factory.d.ts +920 -0
- package/dist/cjs/dimensional-model/measures/factory.js +1188 -0
- package/dist/cjs/dimensional-model/measures/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/measures/factory.test.js +481 -0
- package/dist/cjs/dimensional-model/measures/measures.d.ts +217 -0
- package/dist/cjs/dimensional-model/measures/measures.js +416 -0
- package/dist/cjs/dimensional-model/measures/measures.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/measures/measures.test.js +79 -0
- package/dist/cjs/dimensional-model/simple-column-types.d.ts +39 -0
- package/dist/cjs/dimensional-model/simple-column-types.js +134 -0
- package/dist/cjs/dimensional-model/simple-column-types.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/simple-column-types.test.js +85 -0
- package/dist/cjs/dimensional-model/types.d.ts +256 -0
- package/dist/cjs/dimensional-model/types.js +298 -0
- package/dist/cjs/dimensional-model/types.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/types.test.js +33 -0
- package/dist/cjs/index.d.ts +93 -0
- package/dist/cjs/index.js +123 -0
- package/dist/cjs/interfaces.d.ts +367 -0
- package/dist/cjs/interfaces.js +21 -0
- package/dist/cjs/translation/initialize-i18n.d.ts +2 -0
- package/dist/cjs/translation/initialize-i18n.js +14 -0
- package/dist/cjs/translation/resources/en.d.ts +28 -0
- package/dist/cjs/translation/resources/en.js +30 -0
- package/dist/cjs/translation/resources/index.d.ts +53 -0
- package/dist/cjs/translation/resources/index.js +10 -0
- package/dist/cjs/translation/resources/uk.d.ts +5 -0
- package/dist/cjs/translation/resources/uk.js +30 -0
- package/dist/cjs/translation/translatable-error.d.ts +5 -0
- package/dist/cjs/translation/translatable-error.js +15 -0
- package/dist/cjs/utils.d.ts +37 -0
- package/dist/cjs/utils.js +105 -0
- package/dist/cjs/utils.test.d.ts +1 -0
- package/dist/cjs/utils.test.js +158 -0
- package/dist/dimensional-model/attributes.d.ts +1 -0
- package/dist/dimensional-model/attributes.js +31 -0
- package/dist/dimensional-model/filters/factory.d.ts +80 -42
- package/dist/dimensional-model/filters/factory.js +123 -85
- package/dist/dimensional-model/filters/filters.d.ts +40 -12
- package/dist/dimensional-model/filters/filters.js +75 -24
- package/dist/dimensional-model/filters/utils/attribute-measure-util.d.ts +2 -2
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +6 -3
- package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -2
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +34 -31
- package/dist/dimensional-model/filters/utils/filter-code-util.js +1 -1
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +16 -10
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +34 -27
- package/dist/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
- package/dist/dimensional-model/filters/utils/filter-matcher-utils.js +170 -0
- package/dist/dimensional-model/filters/utils/filter-types-util.d.ts +3 -1
- package/dist/dimensional-model/filters/utils/filter-types-util.js +2 -2
- package/dist/dimensional-model/filters/utils/types.d.ts +1 -1
- package/dist/dimensional-model/interfaces.d.ts +6 -0
- package/dist/dimensional-model/types.d.ts +9 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +18 -9
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import { DataSource } from '../interfaces.js';
|
|
2
|
+
import { Sort } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface DataModel {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly dataSource: DataSource;
|
|
9
|
+
readonly metadata: Element[];
|
|
10
|
+
[propName: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Common interface for elements of a dimensional model.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export interface Element {
|
|
18
|
+
/**
|
|
19
|
+
* Element name
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Element type
|
|
24
|
+
*/
|
|
25
|
+
readonly type: string;
|
|
26
|
+
/**
|
|
27
|
+
* Element description
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
readonly description: string;
|
|
32
|
+
/**
|
|
33
|
+
* Element ID
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
readonly id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Gets a serializable representation of the element.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
serializable(): any;
|
|
44
|
+
/**
|
|
45
|
+
* Overrides JSON.stringify() behavior.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
toJSON(): any;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the JAQL representation of this instance.
|
|
52
|
+
*
|
|
53
|
+
* @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
jaql(nested?: boolean): any;
|
|
57
|
+
/**
|
|
58
|
+
* Skip any validation of this instance.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
skipValidation?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Optional CSDK code to initialize this element
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
composeCode?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Base interface for measure, which is typically numeric aggregation over {@link Attribute}(s).
|
|
72
|
+
* See {@link measureFactory} for how to create measures.
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
export interface Measure extends Element {
|
|
76
|
+
/**
|
|
77
|
+
* Gets the sort definition of this measure.
|
|
78
|
+
*/
|
|
79
|
+
getSort(): Sort;
|
|
80
|
+
/**
|
|
81
|
+
* Sorts the measure by the given `sort` definition.
|
|
82
|
+
*
|
|
83
|
+
* @param sort - Sort definition
|
|
84
|
+
* @returns A sorted instance of measure
|
|
85
|
+
*/
|
|
86
|
+
sort(sort: Sort): Measure;
|
|
87
|
+
/**
|
|
88
|
+
* Gets the formatting string of this measure.
|
|
89
|
+
*
|
|
90
|
+
* @returns Formatting string
|
|
91
|
+
*/
|
|
92
|
+
getFormat(): string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Formats the measure according to the given `format` definition.
|
|
95
|
+
*
|
|
96
|
+
* @param format - Format string
|
|
97
|
+
* @returns A formatted instance of this measure
|
|
98
|
+
*/
|
|
99
|
+
format(format: string): Measure;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Common interface of a Base measure, which is aggregation over {@link Attribute}.
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
export interface BaseMeasure extends Measure {
|
|
106
|
+
/**
|
|
107
|
+
* Aggregated attribute
|
|
108
|
+
*/
|
|
109
|
+
readonly attribute: Attribute;
|
|
110
|
+
/**
|
|
111
|
+
* Aggregation type
|
|
112
|
+
*/
|
|
113
|
+
readonly aggregation: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Common interface of a Measure template, which is a generator for different aggregation over {@link Attribute}.
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export interface MeasureTemplate extends Measure {
|
|
121
|
+
/**
|
|
122
|
+
* Aggregated attribute
|
|
123
|
+
*/
|
|
124
|
+
readonly attribute: Attribute;
|
|
125
|
+
/**
|
|
126
|
+
* Gets a sorted instance with the given definition.
|
|
127
|
+
*
|
|
128
|
+
* @param sort - Sort definition
|
|
129
|
+
* @returns A sorted instance of this measure template
|
|
130
|
+
*/
|
|
131
|
+
sort(sort: Sort): MeasureTemplate;
|
|
132
|
+
/**
|
|
133
|
+
* Gets a {@link Measure} defined with sum aggregation.
|
|
134
|
+
*
|
|
135
|
+
* @returns A {@link Measure} defined with sum aggregation
|
|
136
|
+
*/
|
|
137
|
+
sum(): Measure;
|
|
138
|
+
/**
|
|
139
|
+
* Gets a {@link Measure} defined with average aggregation.
|
|
140
|
+
*
|
|
141
|
+
* @returns A {@link Measure} defined with average aggregation
|
|
142
|
+
*/
|
|
143
|
+
average(): Measure;
|
|
144
|
+
/**
|
|
145
|
+
* Gets a {@link Measure} defined with median aggregation.
|
|
146
|
+
*
|
|
147
|
+
* @returns A {@link Measure} defined with median aggregation
|
|
148
|
+
*/
|
|
149
|
+
median(): Measure;
|
|
150
|
+
/**
|
|
151
|
+
* Gets a {@link Measure} defined with min aggregation.
|
|
152
|
+
*
|
|
153
|
+
* @returns A {@link Measure} defined with min aggregation
|
|
154
|
+
*/
|
|
155
|
+
min(): Measure;
|
|
156
|
+
/**
|
|
157
|
+
* Gets a {@link Measure} defined with max aggregation.
|
|
158
|
+
*
|
|
159
|
+
* @returns A {@link Measure} defined with max aggregation
|
|
160
|
+
*/
|
|
161
|
+
max(): Measure;
|
|
162
|
+
/**
|
|
163
|
+
* Gets a {@link Measure} defined with count aggregation.
|
|
164
|
+
*
|
|
165
|
+
* @returns A {@link Measure} defined with count aggregation
|
|
166
|
+
*/
|
|
167
|
+
count(): Measure;
|
|
168
|
+
/**
|
|
169
|
+
* Gets a {@link Measure} defined with a count distinct aggregation.
|
|
170
|
+
*
|
|
171
|
+
* @returns A {@link Measure} defined with a count distinct aggregation
|
|
172
|
+
*/
|
|
173
|
+
countDistinct(): Measure;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Context of a calculated measure.
|
|
177
|
+
*/
|
|
178
|
+
export interface MeasureContext {
|
|
179
|
+
[propName: string]: any;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Interface for a Calculated Measure, extending {@link Measure}.
|
|
183
|
+
*
|
|
184
|
+
* @see {@link https://sisense.dev/guides/querying/useJaql/#step-7-adding-a-formula | Using the JAQL to Add A Formula}
|
|
185
|
+
*/
|
|
186
|
+
export interface CalculatedMeasure extends Measure {
|
|
187
|
+
/**
|
|
188
|
+
* Expression of the calculated measure
|
|
189
|
+
*/
|
|
190
|
+
expression: string;
|
|
191
|
+
/**
|
|
192
|
+
* Context of the calculated measure
|
|
193
|
+
*/
|
|
194
|
+
context: MeasureContext;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Common interface of a Dimension, which serves as a container for {@link Attribute}(s)
|
|
198
|
+
* and other {@link DateDimension}(s).
|
|
199
|
+
*/
|
|
200
|
+
export interface Dimension extends Element, Attribute {
|
|
201
|
+
/**
|
|
202
|
+
* Child dimensions
|
|
203
|
+
*
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
dimensions: Dimension[];
|
|
207
|
+
/**
|
|
208
|
+
* Child attributes
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
attributes: Attribute[];
|
|
213
|
+
/** @internal */
|
|
214
|
+
[propName: string]: any;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Date Dimension extending {@link Dimension}.
|
|
218
|
+
*/
|
|
219
|
+
export interface DateDimension extends Dimension {
|
|
220
|
+
/**
|
|
221
|
+
* Years level
|
|
222
|
+
*/
|
|
223
|
+
readonly Years: LevelAttribute;
|
|
224
|
+
/**
|
|
225
|
+
* Quarters level
|
|
226
|
+
*/
|
|
227
|
+
readonly Quarters: LevelAttribute;
|
|
228
|
+
/**
|
|
229
|
+
* Months level
|
|
230
|
+
*/
|
|
231
|
+
readonly Months: LevelAttribute;
|
|
232
|
+
/**
|
|
233
|
+
* Weeks level
|
|
234
|
+
*/
|
|
235
|
+
readonly Weeks: LevelAttribute;
|
|
236
|
+
/**
|
|
237
|
+
* Days level
|
|
238
|
+
*/
|
|
239
|
+
readonly Days: LevelAttribute;
|
|
240
|
+
/**
|
|
241
|
+
* Hours level (for Live Models)
|
|
242
|
+
*/
|
|
243
|
+
readonly Hours: LevelAttribute;
|
|
244
|
+
/**
|
|
245
|
+
* Minutes (round to 30) level (for Live Models)
|
|
246
|
+
*/
|
|
247
|
+
readonly MinutesRoundTo30: LevelAttribute;
|
|
248
|
+
/**
|
|
249
|
+
* Minutes (round to 15) level (for Live Models)
|
|
250
|
+
*/
|
|
251
|
+
readonly MinutesRoundTo15: LevelAttribute;
|
|
252
|
+
/**
|
|
253
|
+
* Aggregated Hours level (for Live Models)
|
|
254
|
+
*/
|
|
255
|
+
readonly AggHours: LevelAttribute;
|
|
256
|
+
/**
|
|
257
|
+
* Aggregated Minutes (round to 30) level
|
|
258
|
+
*/
|
|
259
|
+
readonly AggMinutesRoundTo30: LevelAttribute;
|
|
260
|
+
/**
|
|
261
|
+
* Aggregated Minutes (round to 15) level
|
|
262
|
+
*/
|
|
263
|
+
readonly AggMinutesRoundTo15: LevelAttribute;
|
|
264
|
+
/**
|
|
265
|
+
* Aggregated Minutes (every minute) level
|
|
266
|
+
*/
|
|
267
|
+
readonly AggMinutesRoundTo1: LevelAttribute;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Common interface of an attribute as in a dimensional model.
|
|
271
|
+
*
|
|
272
|
+
* An attribute is an extension of a {@link Column} in a generic {@link Data | data set}.
|
|
273
|
+
*/
|
|
274
|
+
export interface Attribute extends Element {
|
|
275
|
+
/**
|
|
276
|
+
* Expression representing the element in a {@link https://sisense.dev/guides/querying/useJaql/ | JAQL query}.
|
|
277
|
+
* It is typically populated automatically in the data model generated by the data model generator.
|
|
278
|
+
*/
|
|
279
|
+
readonly expression: string;
|
|
280
|
+
/**
|
|
281
|
+
* Gets the sort definition.
|
|
282
|
+
*
|
|
283
|
+
* @returns The Sort definition
|
|
284
|
+
*/
|
|
285
|
+
getSort(): Sort;
|
|
286
|
+
/**
|
|
287
|
+
* Sorts the attribute by the given definition
|
|
288
|
+
*
|
|
289
|
+
* @param sort - Sort definition
|
|
290
|
+
* @returns An sorted instance of the attribute
|
|
291
|
+
*/
|
|
292
|
+
sort(sort: Sort): Attribute;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Date Level Attribute associated with a granularity - for example, Years, Quarters, Months, Days.
|
|
296
|
+
*/
|
|
297
|
+
export interface LevelAttribute extends Attribute {
|
|
298
|
+
/**
|
|
299
|
+
* Granularity of the level. See supported granularity values at {@link DateLevels}.
|
|
300
|
+
*/
|
|
301
|
+
readonly granularity: string;
|
|
302
|
+
/**
|
|
303
|
+
* String formatting of this instance.
|
|
304
|
+
*
|
|
305
|
+
* @returns string formatting
|
|
306
|
+
*/
|
|
307
|
+
getFormat(): string | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* Gets a formatted instance with the given definition.
|
|
310
|
+
*
|
|
311
|
+
* @param format - Format string
|
|
312
|
+
* @returns A formatted instance of this level attribute
|
|
313
|
+
*/
|
|
314
|
+
format(format: string): LevelAttribute;
|
|
315
|
+
/**
|
|
316
|
+
* Obtains the JAQL representation of the level that depends on the granularity
|
|
317
|
+
*
|
|
318
|
+
* @returns The JAQL representation of the level
|
|
319
|
+
* @internal
|
|
320
|
+
*/
|
|
321
|
+
translateGranularityToJaql(): {
|
|
322
|
+
level?: string;
|
|
323
|
+
dateTimeLevel?: string;
|
|
324
|
+
bucket?: string;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Base interface for filter. See {@link filterFactory} for how to create filters.
|
|
329
|
+
*/
|
|
330
|
+
export interface Filter extends Element {
|
|
331
|
+
/**
|
|
332
|
+
* Global filter identifier
|
|
333
|
+
*/
|
|
334
|
+
readonly guid: string;
|
|
335
|
+
/**
|
|
336
|
+
* Attribute this filter instance is filtering
|
|
337
|
+
*/
|
|
338
|
+
readonly attribute: Attribute;
|
|
339
|
+
/**
|
|
340
|
+
* Boolean flag whether the filter is a scope filter
|
|
341
|
+
*/
|
|
342
|
+
isScope: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Boolean flag whether the filter is disabled
|
|
345
|
+
*
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
disabled: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Gets JAQL representing this Filter instance
|
|
351
|
+
*
|
|
352
|
+
* @internal
|
|
353
|
+
*/
|
|
354
|
+
filterJaql(): any;
|
|
355
|
+
}
|
|
356
|
+
export interface CustomFormulaContext {
|
|
357
|
+
[key: string]: Attribute | Measure;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Wrapped attribute with additional options for pivot table
|
|
361
|
+
*/
|
|
362
|
+
export interface PivotAttribute {
|
|
363
|
+
attribute: Attribute;
|
|
364
|
+
includeSubTotals?: boolean;
|
|
365
|
+
sort?: PivotRowsSort;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Runs type guard check for PivotAttribute.
|
|
369
|
+
*
|
|
370
|
+
* @param arg - object to check
|
|
371
|
+
* @internal
|
|
372
|
+
*/
|
|
373
|
+
export declare function isPivotAttribute(arg: Attribute | PivotAttribute): arg is PivotAttribute;
|
|
374
|
+
export declare type TotalsCalculation = 'sum' | 'max' | 'min' | 'avg' | 'median';
|
|
375
|
+
/**
|
|
376
|
+
* Wrapped measure with additional options for pivot table
|
|
377
|
+
*/
|
|
378
|
+
export interface PivotMeasure {
|
|
379
|
+
measure: Measure;
|
|
380
|
+
totalsCalculation?: TotalsCalculation;
|
|
381
|
+
/**
|
|
382
|
+
* @internal
|
|
383
|
+
*/
|
|
384
|
+
dataBars?: boolean;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Runs type guard check for PivotMeasure.
|
|
388
|
+
*
|
|
389
|
+
* @param arg - object to check
|
|
390
|
+
* @internal
|
|
391
|
+
*/
|
|
392
|
+
export declare function isPivotMeasure(arg: Measure | PivotMeasure): arg is PivotMeasure;
|
|
393
|
+
/**
|
|
394
|
+
* Data options for grand totals of a pivot table
|
|
395
|
+
*/
|
|
396
|
+
export declare type PivotGrandTotals = {
|
|
397
|
+
title?: string;
|
|
398
|
+
rows?: boolean;
|
|
399
|
+
columns?: boolean;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
export declare const DEFAULT_PIVOT_GRAND_TOTALS: PivotGrandTotals;
|
|
405
|
+
/** A node or a subtree of a {@link FilterRelations} tree */
|
|
406
|
+
export declare type FilterRelationsNode = Filter | Filter[] | FilterRelations;
|
|
407
|
+
/**
|
|
408
|
+
* A node or a subtree of a {@link FilterRelationsModel} tree
|
|
409
|
+
*
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
export declare type FilterRelationsModelNode = FilterRelationsModelIdNode | FilterRelationsModelBracketNode | FilterRelationsModel;
|
|
413
|
+
/**
|
|
414
|
+
* A node or a subtree of a {@link FilterRelationsJaql} tree
|
|
415
|
+
*
|
|
416
|
+
* @internal
|
|
417
|
+
*/
|
|
418
|
+
export declare type FilterRelationsJaqlNode = FilterRelationsJaqlIdNode | FilterRelationsJaql;
|
|
419
|
+
/**
|
|
420
|
+
* Representation of filter logical relations (AND/OR)
|
|
421
|
+
*
|
|
422
|
+
* Unlike {@link FilterRelationsModel} or {@link FilterRelationsJaql},
|
|
423
|
+
* this interface contains filter objects, not just id nodes
|
|
424
|
+
*/
|
|
425
|
+
export interface FilterRelations {
|
|
426
|
+
left: FilterRelationsNode;
|
|
427
|
+
right: FilterRelationsNode;
|
|
428
|
+
operator: 'AND' | 'OR';
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Incoming filter logical relations (AND/OR) when fetched from the instance
|
|
432
|
+
*
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
export interface FilterRelationsModel {
|
|
436
|
+
left: FilterRelationsModelNode;
|
|
437
|
+
right: FilterRelationsModelNode;
|
|
438
|
+
operator: 'AND' | 'OR';
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Outgoing filter logical relations (AND/OR) when added to a query
|
|
442
|
+
*
|
|
443
|
+
* @internal
|
|
444
|
+
*/
|
|
445
|
+
export interface FilterRelationsJaql {
|
|
446
|
+
left: FilterRelationsJaqlNode;
|
|
447
|
+
right: FilterRelationsJaqlNode;
|
|
448
|
+
operator: 'AND' | 'OR';
|
|
449
|
+
}
|
|
450
|
+
/** A node of a {@link FilterRelationsJaql} tree that represents a filter */
|
|
451
|
+
export declare type FilterRelationsJaqlIdNode = {
|
|
452
|
+
instanceid: string;
|
|
453
|
+
};
|
|
454
|
+
/** A node of a {@link FilterRelationsModel} tree that represents a filter */
|
|
455
|
+
export declare type FilterRelationsModelIdNode = {
|
|
456
|
+
instanceId: string;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* A node of a {@link FilterRelationsModel} tree that represents a bracket expression
|
|
460
|
+
*
|
|
461
|
+
* @internal
|
|
462
|
+
*/
|
|
463
|
+
export declare type FilterRelationsModelBracketNode = {
|
|
464
|
+
value: FilterRelationsModelNode;
|
|
465
|
+
};
|
|
466
|
+
/** Sorting direction, either in Ascending order, Descending order, or None */
|
|
467
|
+
export declare type SortDirection = 'sortAsc' | 'sortDesc' | 'sortNone';
|
|
468
|
+
/**
|
|
469
|
+
* Sorting configuration for pivot "rows".
|
|
470
|
+
*
|
|
471
|
+
* This configuration allows sorting pivot "rows" either by their data or by data in a specific "values" column.
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* Examples of sorting configurations for various scenarios:
|
|
475
|
+
*
|
|
476
|
+
* (1) Row sorted in ascending order by its data:
|
|
477
|
+
* ```ts
|
|
478
|
+
* { direction: 'sortAsc' }
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* (2) Row sorted in descending order by data in the first "values" column (index 0):
|
|
482
|
+
* ```ts
|
|
483
|
+
* {
|
|
484
|
+
* direction: 'sortDesc',
|
|
485
|
+
* by: {
|
|
486
|
+
* valuesIndex: 0,
|
|
487
|
+
* }
|
|
488
|
+
* }
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* (3) Row sorted in ascending order by data in the second "values" column (index 1) under the "columns" values of "Female" (for Gender) and "0-18" (for AgeRange):
|
|
492
|
+
* ```ts
|
|
493
|
+
* {
|
|
494
|
+
* direction: 'sortAsc',
|
|
495
|
+
* by: {
|
|
496
|
+
* valuesIndex: 1,
|
|
497
|
+
* columnsMembersPath: ['Female', '0-18']
|
|
498
|
+
* }
|
|
499
|
+
* }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
export declare type PivotRowsSort = {
|
|
503
|
+
/** {@inheritDoc SortDirection} */
|
|
504
|
+
direction: SortDirection;
|
|
505
|
+
/** Sorting target configuration, allowing sorting "rows" by the data in a specific "values" column */
|
|
506
|
+
by?: {
|
|
507
|
+
/** Index of the target "values" item (measure) */
|
|
508
|
+
valuesIndex?: number;
|
|
509
|
+
/** Path to the target column if selected "columns" items (dimensions) are involved */
|
|
510
|
+
columnsMembersPath?: (string | number)[];
|
|
511
|
+
};
|
|
512
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_PIVOT_GRAND_TOTALS = exports.isPivotMeasure = exports.isPivotAttribute = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Runs type guard check for PivotAttribute.
|
|
6
|
+
*
|
|
7
|
+
* @param arg - object to check
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function isPivotAttribute(arg) {
|
|
11
|
+
return 'attribute' in arg;
|
|
12
|
+
}
|
|
13
|
+
exports.isPivotAttribute = isPivotAttribute;
|
|
14
|
+
/**
|
|
15
|
+
* Runs type guard check for PivotMeasure.
|
|
16
|
+
*
|
|
17
|
+
* @param arg - object to check
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
function isPivotMeasure(arg) {
|
|
21
|
+
return 'measure' in arg;
|
|
22
|
+
}
|
|
23
|
+
exports.isPivotMeasure = isPivotMeasure;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
exports.DEFAULT_PIVOT_GRAND_TOTALS = {
|
|
28
|
+
title: 'Grand Total',
|
|
29
|
+
rows: false,
|
|
30
|
+
columns: false,
|
|
31
|
+
};
|