@sisense/sdk-data 0.11.3

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 (31) hide show
  1. package/LICENSE.md +35 -0
  2. package/README.md +3 -0
  3. package/dist/dimensional-model/attributes.d.ts +124 -0
  4. package/dist/dimensional-model/attributes.js +280 -0
  5. package/dist/dimensional-model/base.d.ts +38 -0
  6. package/dist/dimensional-model/base.js +37 -0
  7. package/dist/dimensional-model/data-model.d.ts +13 -0
  8. package/dist/dimensional-model/data-model.js +32 -0
  9. package/dist/dimensional-model/dimensions.d.ts +165 -0
  10. package/dist/dimensional-model/dimensions.js +297 -0
  11. package/dist/dimensional-model/factory.d.ts +17 -0
  12. package/dist/dimensional-model/factory.js +50 -0
  13. package/dist/dimensional-model/filters/factory.d.ts +315 -0
  14. package/dist/dimensional-model/filters/factory.js +404 -0
  15. package/dist/dimensional-model/filters/filters.d.ts +288 -0
  16. package/dist/dimensional-model/filters/filters.js +534 -0
  17. package/dist/dimensional-model/interfaces.d.ts +341 -0
  18. package/dist/dimensional-model/interfaces.js +1 -0
  19. package/dist/dimensional-model/measures/factory.d.ts +437 -0
  20. package/dist/dimensional-model/measures/factory.js +632 -0
  21. package/dist/dimensional-model/measures/measures.d.ts +217 -0
  22. package/dist/dimensional-model/measures/measures.js +388 -0
  23. package/dist/dimensional-model/simple-column-types.d.ts +39 -0
  24. package/dist/dimensional-model/simple-column-types.js +124 -0
  25. package/dist/dimensional-model/types.d.ts +152 -0
  26. package/dist/dimensional-model/types.js +284 -0
  27. package/dist/index.d.ts +79 -0
  28. package/dist/index.js +79 -0
  29. package/dist/interfaces.d.ts +233 -0
  30. package/dist/interfaces.js +9 -0
  31. package/package.json +47 -0
@@ -0,0 +1,341 @@
1
+ import { Sort } from './types.js';
2
+ /**
3
+ * @internal
4
+ */
5
+ export interface DataModel {
6
+ readonly name: string;
7
+ readonly metadata: Element[];
8
+ [propName: string]: any;
9
+ }
10
+ /**
11
+ * Common interface for elements of
12
+ * [dimensional modeling](https://docs.sisense.com/main/SisenseLinux/data-model-building-practices.htm?tocpath=Modeling%20Data%7C_____4).
13
+ *
14
+ * @internal
15
+ */
16
+ export interface Element {
17
+ /**
18
+ * Element name
19
+ */
20
+ name: string;
21
+ /**
22
+ * Element type
23
+ */
24
+ readonly type: string;
25
+ /**
26
+ * Element description
27
+ *
28
+ * @internal
29
+ */
30
+ readonly description: string;
31
+ /**
32
+ * Element ID
33
+ *
34
+ * @internal
35
+ */
36
+ readonly id: string;
37
+ /**
38
+ * Gets a serializable representation of the element.
39
+ *
40
+ * @internal
41
+ */
42
+ serializable(): any;
43
+ /**
44
+ * Overrides JSON.stringify() behavior.
45
+ *
46
+ * @internal
47
+ */
48
+ toJSON(): any;
49
+ /**
50
+ * Gets the JAQL representation of this instance.
51
+ *
52
+ * @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
53
+ * @internal
54
+ */
55
+ jaql(nested?: boolean): any;
56
+ /**
57
+ * Skip any validation of this instance.
58
+ *
59
+ * @internal
60
+ */
61
+ skipValidation?: boolean;
62
+ }
63
+ /**
64
+ * Base interface for measure, which is typically numeric aggregation over {@link Attribute}(s).
65
+ * See {@link measures} for how to create measures.
66
+ *
67
+ */
68
+ export interface Measure extends Element {
69
+ /**
70
+ * Gets the sort definition of this measure.
71
+ */
72
+ getSort(): Sort;
73
+ /**
74
+ * Sorts the measure by the given `sort` definition.
75
+ *
76
+ * @param sort - Sort definition
77
+ * @returns A sorted instance of measure
78
+ */
79
+ sort(sort: Sort): Measure;
80
+ /**
81
+ * Gets the formatting string of this measure.
82
+ *
83
+ * @returns Formatting string
84
+ */
85
+ getFormat(): string | undefined;
86
+ /**
87
+ * Formats the measure according to the given `format` definition.
88
+ *
89
+ * @param format - Format string
90
+ * @returns A formatted instance of this measure
91
+ */
92
+ format(format: string): Measure;
93
+ }
94
+ /**
95
+ * Common interface of a Base measure, which is aggregation over {@link Attribute}.
96
+ *
97
+ */
98
+ export interface BaseMeasure extends Measure {
99
+ /**
100
+ * Aggregated attribute
101
+ */
102
+ readonly attribute: Attribute;
103
+ /**
104
+ * Aggregation type
105
+ */
106
+ readonly aggregation: string;
107
+ }
108
+ /**
109
+ * Common interface of a Measure template, which is a generator for different aggregation over {@link Attribute}.
110
+ *
111
+ * @internal
112
+ */
113
+ export interface MeasureTemplate extends Measure {
114
+ /**
115
+ * Aggregated attribute
116
+ */
117
+ readonly attribute: Attribute;
118
+ /**
119
+ * Gets a sorted instance with the given definition.
120
+ *
121
+ * @param sort - Sort definition
122
+ * @returns A sorted instance of this measure template
123
+ */
124
+ sort(sort: Sort): MeasureTemplate;
125
+ /**
126
+ * Gets a {@link Measure} defined with sum aggregation.
127
+ *
128
+ * @returns A {@link Measure} defined with sum aggregation
129
+ */
130
+ sum(): Measure;
131
+ /**
132
+ * Gets a {@link Measure} defined with average aggregation.
133
+ *
134
+ * @returns A {@link Measure} defined with average aggregation
135
+ */
136
+ average(): Measure;
137
+ /**
138
+ * Gets a {@link Measure} defined with median aggregation.
139
+ *
140
+ * @returns A {@link Measure} defined with median aggregation
141
+ */
142
+ median(): Measure;
143
+ /**
144
+ * Gets a {@link Measure} defined with min aggregation.
145
+ *
146
+ * @returns A {@link Measure} defined with min aggregation
147
+ */
148
+ min(): Measure;
149
+ /**
150
+ * Gets a {@link Measure} defined with max aggregation.
151
+ *
152
+ * @returns A {@link Measure} defined with max aggregation
153
+ */
154
+ max(): Measure;
155
+ /**
156
+ * Gets a {@link Measure} defined with count aggregation.
157
+ *
158
+ * @returns A {@link Measure} defined with count aggregation
159
+ */
160
+ count(): Measure;
161
+ /**
162
+ * Gets a {@link Measure} defined with a count distinct aggregation.
163
+ *
164
+ * @returns A {@link Measure} defined with a count distinct aggregation
165
+ */
166
+ countDistinct(): Measure;
167
+ }
168
+ /**
169
+ * Context of a calculated measure.
170
+ */
171
+ export interface MeasureContext {
172
+ [propName: string]: any;
173
+ }
174
+ /**
175
+ * Interface for a Calculated Measure, extending {@link Measure}.
176
+ *
177
+ * @see {@link https://sisense.dev/guides/querying/useJaql/#step-7-adding-a-formula | Using the JAQL to Add A Formula}
178
+ */
179
+ export interface CalculatedMeasure extends Measure {
180
+ /**
181
+ * Expression of the calculated measure
182
+ */
183
+ expression: string;
184
+ /**
185
+ * Context of the calculated measure
186
+ */
187
+ context: MeasureContext;
188
+ }
189
+ /**
190
+ * Common interface of a Dimension, which serves as a container for {@link Attribute}(s)
191
+ * and other {@link DateDimension}(s).
192
+ */
193
+ export interface Dimension extends Element, Attribute {
194
+ /**
195
+ * Child dimensions
196
+ *
197
+ * @internal
198
+ */
199
+ dimensions: Dimension[];
200
+ /**
201
+ * Child attributes
202
+ *
203
+ * @internal
204
+ */
205
+ attributes: Attribute[];
206
+ /** @internal */
207
+ [propName: string]: any;
208
+ }
209
+ /**
210
+ * Date Dimension extending {@link Dimension}.
211
+ *
212
+ * See [here](https://docs.sisense.com/main/SisenseLinux/date-and-time-fields.htm)
213
+ * for more details on Date and Time Resolution for ElastiCubes and for Live Models.
214
+ */
215
+ export interface DateDimension extends Dimension {
216
+ /**
217
+ * Years level
218
+ */
219
+ readonly Years: LevelAttribute;
220
+ /**
221
+ * Quarters level
222
+ */
223
+ readonly Quarters: LevelAttribute;
224
+ /**
225
+ * Months level
226
+ */
227
+ readonly Months: LevelAttribute;
228
+ /**
229
+ * Weeks level
230
+ */
231
+ readonly Weeks: LevelAttribute;
232
+ /**
233
+ * Days level
234
+ */
235
+ readonly Days: LevelAttribute;
236
+ /**
237
+ * Hours level (for Live Models)
238
+ */
239
+ readonly Hours: LevelAttribute;
240
+ /**
241
+ * Minutes (round to 30) level (for Live Models)
242
+ */
243
+ readonly MinutesRoundTo30: LevelAttribute;
244
+ /**
245
+ * Minutes (round to 15) level (for Live Models)
246
+ */
247
+ readonly MinutesRoundTo15: LevelAttribute;
248
+ /**
249
+ * Aggregated Hours level (for Live Models)
250
+ */
251
+ readonly AggHours: LevelAttribute;
252
+ /**
253
+ * Aggregated Minutes (round to 30) level
254
+ */
255
+ readonly AggMinutesRoundTo30: LevelAttribute;
256
+ /**
257
+ * Aggregated Minutes (round to 15) level
258
+ */
259
+ readonly AggMinutesRoundTo15: LevelAttribute;
260
+ /**
261
+ * Aggregated Minutes (every minute) level
262
+ */
263
+ readonly AggMinutesRoundTo1: LevelAttribute;
264
+ }
265
+ /**
266
+ * Common interface of an Attribute as defined in
267
+ * [Dimensional Modeling](https://docs.sisense.com/main/SisenseLinux/data-model-building-practices.htm?tocpath=Modeling%20Data%7C_____4).
268
+ * It is an extension of a {@link Column} in a generic {@link Data | Data Set}.
269
+ */
270
+ export interface Attribute extends Element {
271
+ /**
272
+ * Expression representing the element in a {@link https://sisense.dev/guides/querying/useJaql/ | JAQL query}.
273
+ * It is typically populated automatically in the data model generated by the data model generator.
274
+ */
275
+ readonly expression: string;
276
+ /**
277
+ * Gets the sort definition.
278
+ *
279
+ * @returns The Sort definition
280
+ */
281
+ getSort(): Sort;
282
+ /**
283
+ * Sorts the attribute by the given definition
284
+ *
285
+ * @param sort - Sort definition
286
+ * @returns An sorted instance of the attribute
287
+ */
288
+ sort(sort: Sort): Attribute;
289
+ }
290
+ /**
291
+ * Date Level Attribute associated with a granularity - for example, Years, Quarters, Months, Days.
292
+ */
293
+ export interface LevelAttribute extends Attribute {
294
+ /**
295
+ * Granularity of the level. See supported granularity values at {@link DateLevels}.
296
+ */
297
+ readonly granularity: string;
298
+ /**
299
+ * String formatting of this instance.
300
+ *
301
+ * @returns string formatting
302
+ */
303
+ getFormat(): string | undefined;
304
+ /**
305
+ * Gets a formatted instance with the given definition.
306
+ *
307
+ * @param format - Format string
308
+ * @returns A formatted instance of this level attribute
309
+ */
310
+ format(format: string): LevelAttribute;
311
+ /**
312
+ * Obtains the JAQL representation of the level that depends on the granularity
313
+ *
314
+ * @returns The JAQL representation of the level
315
+ * @internal
316
+ */
317
+ translateGranularityToJaql(): {
318
+ level?: string;
319
+ dateTimeLevel?: string;
320
+ bucket?: string;
321
+ };
322
+ }
323
+ /**
324
+ * Base interface for filter. See {@link filters} for how to create filters.
325
+ */
326
+ export interface Filter extends Element {
327
+ /**
328
+ * Attribute this filter instance is filtering
329
+ */
330
+ readonly attribute: Attribute;
331
+ /**
332
+ * Boolean flag whether the filter is a scope filter
333
+ */
334
+ isScope: boolean;
335
+ /**
336
+ * Gets JAQL representing this Filter instance
337
+ *
338
+ * @internal
339
+ */
340
+ filterJaql(): any;
341
+ }
@@ -0,0 +1 @@
1
+ export {};