@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,437 @@
1
+ import { Attribute, Measure, Filter, CalculatedMeasure, BaseMeasure } from '../interfaces.js';
2
+ import { ForecastFormulaOptions, TrendFormulaOptions } from '../../interfaces.js';
3
+ /**
4
+ * Defines the different numeric operators that can be used with numeric filters
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const RankingTypes: {
9
+ /**
10
+ * In competition ranking, items that compare equal receive the same ranking number, and then a gap is left in the ranking numbers.
11
+ */
12
+ StandardCompetition: string;
13
+ /**
14
+ * Sometimes, competition ranking is done by leaving the gaps in the ranking numbers before the sets of equal-ranking items (rather than after them as in standard competition ranking)
15
+ */
16
+ ModifiedCompetition: string;
17
+ /**
18
+ * In dense ranking, items that compare equally receive the same ranking number, and the next items receive the immediately following ranking number.
19
+ */
20
+ Dense: string;
21
+ /**
22
+ * In ordinal ranking, all items receive distinct ordinal numbers, including items that compare equal. The assignment of distinct ordinal numbers is arbitrarily.
23
+ */
24
+ Ordinal: string;
25
+ };
26
+ /**
27
+ * Defines the different ranking sorting types supported by rank measure
28
+ *
29
+ * @internal
30
+ */
31
+ export declare const RankingSortTypes: {
32
+ Ascending: string;
33
+ Descending: string;
34
+ };
35
+ /**
36
+ * Creates a basic aggregated measure.
37
+ * This is a base function to build other aggregation functions (e.g., `sum`, `average`, etc)
38
+ * as listed in {@link AggregationTypes}.
39
+ *
40
+ * @param attribute - Attribute to aggregate
41
+ * @param aggregationType - Aggregation type. See {@link AggregationTypes}
42
+ * @param name - Optional name for the new measure
43
+ * @param format - Numeric formatting to apply
44
+ * @returns A Measure instance
45
+ */
46
+ export declare function aggregate(attribute: Attribute, aggregationType: string, name?: string, format?: string): BaseMeasure;
47
+ /**
48
+ * Returns a numeric value as a measure.
49
+ *
50
+ * @param value - Value to be returned as a measure
51
+ * @returns A Calculated Measure instance
52
+ */
53
+ export declare function constant(value: number): CalculatedMeasure;
54
+ /**
55
+ * Creates a sum aggregation over the given attribute.
56
+ *
57
+ * @param attribute - Attribute to aggregate
58
+ * @param name - Optional name for the new measure
59
+ * @param format - Optional numeric formatting to apply
60
+ * @returns A Measure instance
61
+ */
62
+ export declare function sum(attribute: Attribute, name?: string, format?: string): BaseMeasure;
63
+ /**
64
+ * Creates an average aggregation over the given attribute.
65
+ *
66
+ * @param attribute - Attribute to aggregate
67
+ * @param name - Optional name for the new measure
68
+ * @param format - Optional numeric formatting to apply
69
+ * @returns A Measure instance
70
+ */
71
+ export declare function average(attribute: Attribute, name?: string, format?: string): BaseMeasure;
72
+ /**
73
+ * Creates a min aggregation over the given attribute.
74
+ *
75
+ * @param attribute - Attribute to aggregate
76
+ * @param name - Optional name for the new measure
77
+ * @param format - Optional numeric formatting to apply
78
+ * @returns A Measure instance
79
+ */
80
+ export declare function min(attribute: Attribute, name?: string, format?: string): BaseMeasure;
81
+ /**
82
+ * Creates a max aggregation over the given attribute.
83
+ *
84
+ * @param attribute - Attribute to aggregate
85
+ * @param name - Optional name for the new measure
86
+ * @param format - Optional numeric formatting to apply
87
+ * @returns A Measure instance
88
+ */
89
+ export declare function max(attribute: Attribute, name?: string, format?: string): BaseMeasure;
90
+ /**
91
+ * Creates a median aggregation over the given attribute.
92
+ *
93
+ * @param attribute - Attribute to aggregate
94
+ * @param name - Optional name for the new measure
95
+ * @param format - Optional numeric formatting to apply
96
+ * @returns A Measure instance
97
+ */
98
+ export declare function median(attribute: Attribute, name?: string, format?: string): BaseMeasure;
99
+ /**
100
+ * Creates a count aggregation over the given attribute.
101
+ *
102
+ * @param attribute - Attribute to aggregate
103
+ * @param name - Optional name for the new measure
104
+ * @param format - Optional numeric formatting to apply
105
+ * @returns A Measure instance
106
+ */
107
+ export declare function count(attribute: Attribute, name?: string, format?: string): BaseMeasure;
108
+ /**
109
+ * Creates a count distinct aggregation over the given attribute.
110
+ *
111
+ * @param attribute - Attribute to aggregate
112
+ * @param name - Optional name for the new measure
113
+ * @param format - Optional numeric formatting to apply
114
+ * @returns A Measure instance
115
+ */
116
+ export declare function countDistinct(attribute: Attribute, name?: string, format?: string): BaseMeasure;
117
+ /**
118
+ * Creates a measured value with the given measure and set of filters.
119
+ *
120
+ * @param measure - Measure to filter
121
+ * @param filters - Filters to apply to the measure
122
+ * @param name - Optional name for the new measure
123
+ * @param format - Optional numeric formatting to apply
124
+ * @returns A Calculated Measure instance
125
+ */
126
+ export declare function measuredValue(measure: Measure, filters: Filter[], name?: string, format?: string): CalculatedMeasure;
127
+ /**
128
+ * Adds the two given values.
129
+ *
130
+ * @param value1 - First value
131
+ * @param value2 - Second value
132
+ * @param name - Optional name for the new measure
133
+ * @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
134
+ * @returns A Calculated Measure instance
135
+ */
136
+ export declare function add(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
137
+ /**
138
+ * Subtract value2 from value1.
139
+ *
140
+ * @param value1 - First value
141
+ * @param value2 - Second value
142
+ * @param name - Optional name for the new measure
143
+ * @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
144
+ * @returns A Calculated Measure instance
145
+ */
146
+ export declare function subtract(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
147
+ /**
148
+ * Multiply value1 with value2.
149
+ *
150
+ * @param value1 - First value
151
+ * @param value2 - Second value
152
+ * @param name - Optional name for the new measure
153
+ * @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
154
+ * @returns A Calculated Measure instance
155
+ */
156
+ export declare function multiply(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
157
+ /**
158
+ * Divide value1 by value2.
159
+ *
160
+ * @param value1 - First value
161
+ * @param value2 - Second value
162
+ * @param name - Optional name for the new measure
163
+ * @param withParentheses - Optional boolean flag whether to wrap the arithmetic operation with parentheses
164
+ * @returns A Calculated Measure instance
165
+ */
166
+ export declare function divide(value1: Measure | number, value2: Measure | number, name?: string, withParentheses?: boolean): CalculatedMeasure;
167
+ /**
168
+ * Calculates year to date (YTD) sum of the given measure. Date dimension will be dynamically taken from the query.
169
+ *
170
+ * @param measure - Measure to apply the YTD Sum to
171
+ * @param name - Name for the new measure
172
+ * @returns A Calculated Measure instance
173
+ */
174
+ export declare function yearToDateSum(measure: Measure, name?: string): CalculatedMeasure;
175
+ /**
176
+ * Calculates quarter to date (QTD) sum of the given measure.
177
+ * Date dimension will be dynamically taken from the query.
178
+ *
179
+ * @param measure - Measure to apply the QTD Sum to
180
+ * @param name - Name for the new measure
181
+ * @returns A Calculated Measure instance
182
+ */
183
+ export declare function quarterToDateSum(measure: Measure, name?: string): CalculatedMeasure;
184
+ /**
185
+ * Calculates month to date (MTD) sum of the given measure.
186
+ * Date dimension will be dynamically taken from the query.
187
+ *
188
+ * @param measure - Measure to apply the MTD Sum to
189
+ * @param name - Name for the new measure
190
+ * @returns A Calculated Measure instance
191
+ */
192
+ export declare function monthToDateSum(measure: Measure, name?: string): CalculatedMeasure;
193
+ /**
194
+ * Calculates week to date (WTD) sum of the given measure.
195
+ * Date dimension will be dynamically taken from the query.
196
+ *
197
+ * @param measure - Measure to apply the WTD Sum to
198
+ * @param name - Name for the new measure
199
+ * @returns A Calculated Measure instance
200
+ */
201
+ export declare function weekToDateSum(measure: Measure, name?: string): CalculatedMeasure;
202
+ /**
203
+ * Returns the running total of the measure by the defined dimension
204
+ * according to the current sorting order in the query.
205
+ *
206
+ * By default, `RSUM` accumulates a measure by the sorting order of the dimension.
207
+ * To accumulate by another order, the relevant measure should be added as an additional column and sorted.
208
+ *
209
+ * Note: Filtering the `RSUM` column by Values,
210
+ * filters the dimensions and recalculates the `RSUM` from the first filtered value.
211
+ *
212
+ * @param measure - Measure to apply the Running Sum to
213
+ * @param _continuous - Boolean flag whether to accumulate the sum continuously
214
+ * when there are two or more dimensions. The default value is False.
215
+ * @param name - Name for the new measure
216
+ * @returns A Calculated Measure instance
217
+ */
218
+ export declare function runningSum(measure: Measure, _continuous?: boolean, name?: string): CalculatedMeasure;
219
+ /**
220
+ * Calculates growth over time. The time dimension to be used is determined by the time resolution in the query.
221
+ *
222
+ * Formula: `(current value – compared value) / compared value`.
223
+ *
224
+ * @example
225
+ *
226
+ * If this month your value is 12, and last month it was 10, your Growth for this month is 20% (0.2).
227
+ *
228
+ * Calculation: `(12 – 10) / 10 = 0.2`
229
+ *
230
+ * If this year your value is 80, and last year it was 100, your Growth for this year is -20% ( -0.2).
231
+ *
232
+ * Calculation: `(80 – 100) / 100 = -0.2`
233
+ * @param measure - Measure to apply growth to
234
+ * @param name - Name for the new measure
235
+ * @returns A Calculated Measure instance
236
+ */
237
+ export declare function growth(measure: Measure, name?: string): CalculatedMeasure;
238
+ /**
239
+ * Calculates growth rate over time. The time dimension to be used is determined by the time resolution in the query.
240
+ *
241
+ * @example
242
+ * If this month your value is 12, and last month it was 10, your Growth Rate for this month is 12/10 = 120% (1.2).
243
+ *
244
+ * Calculation: `12 / 10 = 1.2`
245
+ *
246
+ * If this year your value is 80, and last year it was 100, your Growth for this year is 80/100 = 80% ( 0.8).
247
+ *
248
+ * Calculation: `80 / 100 = 0.8`
249
+ * @param measure - Measure to apply the Growth rate
250
+ * @param name - Name for the new measure
251
+ * @returns A Calculated Measure instance
252
+ */
253
+ export declare function growthRate(measure: Measure, name?: string): CalculatedMeasure;
254
+ /**
255
+ * Calculates the growth from past week of the given measure.
256
+ * Date dimension will be dynamically taken from the query.
257
+ *
258
+ * @param measure - Measure to apply growth to
259
+ * @param name - Name for the new measure
260
+ * @returns A Calculated Measure instance
261
+ */
262
+ export declare function growthPastWeek(measure: Measure, name?: string): CalculatedMeasure;
263
+ /**
264
+ * Calculates the growth from past month of the given measure.
265
+ * Date dimension will be dynamically taken from the query
266
+ *
267
+ * @param measure - Measure to apply growth to
268
+ * @param name - Name for the new measure
269
+ * @returns A Calculated Measure instance
270
+ */
271
+ export declare function growthPastMonth(measure: Measure, name?: string): CalculatedMeasure;
272
+ /**
273
+ * Calculates the growth from past quarter of the given measure.
274
+ * Date dimension will be dynamically taken from the query.
275
+ *
276
+ * @param measure - Measure to apply growth to
277
+ * @param name - Name for the new measure
278
+ * @returns A Calculated Measure instance
279
+ */
280
+ export declare function growthPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
281
+ /**
282
+ * Calculates the growth from past year of the given measure.
283
+ * Date dimension will be dynamically taken from the query.
284
+ *
285
+ * @param measure - Measure to apply growth to
286
+ * @param name - Name for the new measure
287
+ * @returns A Calculated Measure instance
288
+ */
289
+ export declare function growthPastYear(measure: Measure, name?: string): CalculatedMeasure;
290
+ /**
291
+ * Calculates the difference of the given measure.
292
+ * Date dimension will be dynamically taken from the query.
293
+ *
294
+ * @param measure - measure to apply difference to
295
+ * @param name - Name for the new measure
296
+ * @returns A Calculated Measure instance
297
+ */
298
+ export declare function difference(measure: Measure, name?: string): CalculatedMeasure;
299
+ /**
300
+ * Calculates the difference from past week of the given measure.
301
+ * Ddate dimension will be dynamically taken from the query.
302
+ *
303
+ * @param measure - Measure to apply difference to
304
+ * @param name - Name for the new measure
305
+ * @returns A Calculated Measure instance
306
+ */
307
+ export declare function diffPastWeek(measure: Measure, name?: string): CalculatedMeasure;
308
+ /**
309
+ * Calculates the difference from past month of the given measure.
310
+ * Date dimension will be dynamically taken from the query.
311
+ *
312
+ * @param measure - Measure to apply difference to
313
+ * @param name - Name for the new measure
314
+ * @returns A Calculated Measure instance
315
+ */
316
+ export declare function diffPastMonth(measure: Measure, name?: string): CalculatedMeasure;
317
+ /**
318
+ * Calculates the difference from past quarter of the given measure.
319
+ * Date dimension will be dynamically taken from the query.
320
+ *
321
+ * @param measure - Measure to apply difference to
322
+ * @param name - Name for the new measure
323
+ * @returns A Calculated Measure instance
324
+ */
325
+ export declare function diffPastQuarter(measure: Measure, name?: string): CalculatedMeasure;
326
+ /**
327
+ * Calculates the difference from past year of the given measure.
328
+ * Date dimension will be dynamically taken from the query.
329
+ *
330
+ * @param measure - Measure to apply difference to
331
+ * @param name - Name for the new measure
332
+ * @returns A Calculated Measure instance
333
+ */
334
+ export declare function diffPastYear(measure: Measure, name?: string): CalculatedMeasure;
335
+ /**
336
+ * Calculates the value of the past day of the given measure.
337
+ * Date dimension will be dynamically taken from the query.
338
+ *
339
+ * @param measure - Measure to apply past value to
340
+ * @param name - Name for the new measure
341
+ * @returns A Calculated Measure instance
342
+ */
343
+ export declare function pastDay(measure: Measure, name?: string): CalculatedMeasure;
344
+ /**
345
+ * Calculates the value of the past week of the given measure.
346
+ * Date dimension will be dynamically taken from the query.
347
+ *
348
+ * @param measure - Measure to apply past value to
349
+ * @param name - Name for the new measure
350
+ * @returns A Calculated Measure instance
351
+ */
352
+ export declare function pastWeek(measure: Measure, name?: string): CalculatedMeasure;
353
+ /**
354
+ * Calculates the value of the path month of the given measure.
355
+ * Date dimension will be dynamically taken from the query.
356
+ *
357
+ * @param measure - Measure to apply past value to
358
+ * @param name - Name for the new measure
359
+ * @returns A Calculated Measure instance
360
+ */
361
+ export declare function pastMonth(measure: Measure, name?: string): CalculatedMeasure;
362
+ /**
363
+ * Calculates the value of the past quarter of the given measure.
364
+ * Date dimension will be dynamically taken from the query.
365
+ *
366
+ * @param measure - Measure to apply past value to
367
+ * @param name - Name for the new measure
368
+ * @returns A Calculated Measure instance
369
+ */
370
+ export declare function pastQuarter(measure: Measure, name?: string): CalculatedMeasure;
371
+ /**
372
+ * Calculates the value of the past year of the given measure.
373
+ * Date dimension will be dynamically taken from the query.
374
+ *
375
+ * @param measure - Measure to apply past value to
376
+ * @param name - Name for the new measure
377
+ * @returns A Calculated Measure instance
378
+ */
379
+ export declare function pastYear(measure: Measure, name?: string): CalculatedMeasure;
380
+ /**
381
+ * Calculates contribution.
382
+ *
383
+ * @param measure - Measure to apply the Contribution logic to
384
+ * @param name - Name for the new measure
385
+ * @returns A Calculated Measure instance
386
+ */
387
+ export declare function contribution(measure: Measure, name?: string): CalculatedMeasure;
388
+ /**
389
+ * Fits a specified trend type to your measure. The trend types include linear,
390
+ * logarithmic, advanced smoothing, and local estimates. It allows for an optional
391
+ * feature to automatically identify and ignore anomalous values in the series.
392
+ *
393
+ * Trend requires a Sisense instance version of L2023.6.0 or greater.
394
+ *
395
+ * @param measure - Measure to apply the trend logic to
396
+ * @param name - Name for the new measure
397
+ * @param options - Trend options
398
+ * @returns A Calculated Measure instance
399
+ */
400
+ export declare function trend(measure: Measure, name?: string, options?: TrendFormulaOptions): CalculatedMeasure;
401
+ /**
402
+ * Calculates Forecast leveraging advanced autoML techniques to generate
403
+ * a forecast for a given measure.
404
+ *
405
+ * This function offers flexibility with auto-selection of the best
406
+ * statistical model or user-selected models, and it also provides control
407
+ * over the time period used for training the model, as well as options to
408
+ * improve forecast accuracy by supplying expected lower and upper limits.
409
+ *
410
+ * In addition to forecast, upper and lower confidence interval is returned
411
+ * with the name of the new measure and a suffix of _upper and _lower
412
+ * respectively.
413
+ *
414
+ * Forecast requires a Sisense instance version of L2023.6.0 or greater.
415
+ *
416
+ * @param measure - Measure to apply the forecast logic to
417
+ * @param name - Name for the new measure
418
+ * @param options - Forecast options
419
+ * @returns A Calculated Measure instance
420
+ */
421
+ export declare function forecast(measure: Measure, name?: string, options?: ForecastFormulaOptions): CalculatedMeasure;
422
+ /**
423
+ * Calculates the rank of a value in a list of values.
424
+ *
425
+ * @example
426
+ * `RANK(Total Cost, “ASC”, “1224”, Product, Years)`
427
+ * will return the rank of the total annual cost per each product were sorted in ascending order.
428
+ * @param measure - Measure to apply the Contribution logic to
429
+ * @param name - Name for the new measure
430
+ * @param sort - By default sort order is descending.
431
+ * @param rankType - By default the type is standard competition ranking `(“1224” ranking)`.
432
+ * Supports also modified competition ranking `(“1334” ranking)`, dense ranking `(“1223” ranking)`,
433
+ * and ordinal ranking `(“1234” ranking)`.
434
+ * @param groupBy - Rank partitions attributes
435
+ * @returns A rank measure
436
+ */
437
+ export declare function rank(measure: Measure, name?: string, sort?: string, rankType?: string, groupBy?: Attribute[]): CalculatedMeasure;