@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,47 @@
1
+ import type { Attribute, Measure } from '../interfaces.js';
2
+ /** @internal */
3
+ export declare const BOX_WHISKER: {
4
+ BOX_MIN_VALUE_NAME: string;
5
+ BOX_MEDIAN_VALUE_NAME: string;
6
+ BOX_MAX_VALUE_NAME: string;
7
+ WHISKER_MIN_VALUE_NAME: string;
8
+ WHISKER_MAX_VALUE_NAME: string;
9
+ OUTLIER_COUNT_VALUE_NAME: string;
10
+ OUTLIER_MIN_VALUE_NAME: string;
11
+ OUTLIER_MAX_VALUE_NAME: string;
12
+ };
13
+ /**
14
+ * Returns an array of values for box whisker plot using interquartile range (IQR) calculations.
15
+ *
16
+ * @param {Attribute} target - The target attribute for calculations.
17
+ * @returns {Measure[]} An array of measures representing IQR values for box whisker plots.
18
+ */
19
+ export declare function boxWhiskerIqrValues(target: Attribute): Measure[];
20
+ /**
21
+ * Returns an array of extremum values for box whisker plot.
22
+ *
23
+ * @param {Attribute} target - The target attribute for calculations.
24
+ * @returns {Measure[]} An array of measures representing extremum values for box whisker plots.
25
+ */
26
+ export declare function boxWhiskerExtremumsValues(target: Attribute): Measure[];
27
+ /**
28
+ * Returns an array of values for box whisker plot using standard deviation calculations.
29
+ *
30
+ * @param {Attribute} target - The target attribute for calculations.
31
+ * @returns {Measure[]} An array of measures representing standard deviation values for box whisker plots.
32
+ */
33
+ export declare function boxWhiskerStdDevValues(target: Attribute): Measure[];
34
+ /**
35
+ * Returns an attribute representing outlier points based on interquartile range (IQR) calculations.
36
+ *
37
+ * @param {Attribute} target - The target attribute for calculations.
38
+ * @returns {Attribute} An attribute representing outliers for box whisker plots using IQR.
39
+ */
40
+ export declare const boxWhiskerIqrOutliers: (target: Attribute) => Attribute;
41
+ /**
42
+ * Returns an attribute representing outlier points based on standard deviation calculations.
43
+ *
44
+ * @param {Attribute} target - The target attribute for calculations.
45
+ * @returns {Attribute} An attribute representing outliers for box whisker plots using standard deviation.
46
+ */
47
+ export declare const boxWhiskerStdDevOutliers: (target: Attribute) => Attribute;
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.boxWhiskerStdDevOutliers = exports.boxWhiskerIqrOutliers = exports.boxWhiskerStdDevValues = exports.boxWhiskerExtremumsValues = exports.boxWhiskerIqrValues = exports.BOX_WHISKER = void 0;
7
+ const cloneDeep_js_1 = __importDefault(require("lodash/cloneDeep.js"));
8
+ const factory_js_1 = require("../measures/factory.js");
9
+ /** @internal */
10
+ exports.BOX_WHISKER = {
11
+ BOX_MIN_VALUE_NAME: 'Box Min',
12
+ BOX_MEDIAN_VALUE_NAME: 'Box Median',
13
+ BOX_MAX_VALUE_NAME: 'Box Max',
14
+ WHISKER_MIN_VALUE_NAME: 'Whisker Min',
15
+ WHISKER_MAX_VALUE_NAME: 'Whisker Max',
16
+ OUTLIER_COUNT_VALUE_NAME: 'Outlier Count',
17
+ OUTLIER_MIN_VALUE_NAME: 'Outlier Min',
18
+ OUTLIER_MAX_VALUE_NAME: 'Outlier Max',
19
+ };
20
+ function boxWhiskerCommonValues(target) {
21
+ return [
22
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.BOX_MIN_VALUE_NAME, 'QUARTILE([Attr], 1)', {
23
+ Attr: target,
24
+ }),
25
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.BOX_MEDIAN_VALUE_NAME, 'MEDIAN([Attr])', {
26
+ Attr: target,
27
+ }),
28
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.BOX_MAX_VALUE_NAME, 'QUARTILE([Attr], 3)', {
29
+ Attr: target,
30
+ }),
31
+ ];
32
+ }
33
+ /**
34
+ * Returns an array of values for box whisker plot using interquartile range (IQR) calculations.
35
+ *
36
+ * @param {Attribute} target - The target attribute for calculations.
37
+ * @returns {Measure[]} An array of measures representing IQR values for box whisker plots.
38
+ */
39
+ function boxWhiskerIqrValues(target) {
40
+ return [
41
+ ...boxWhiskerCommonValues(target),
42
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MIN_VALUE_NAME, 'LOWERWHISKERMAX_IQR([Attr])', {
43
+ Attr: target,
44
+ }),
45
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MAX_VALUE_NAME, 'UPPERWHISKERMIN_IQR([Attr])', {
46
+ Attr: target,
47
+ }),
48
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_COUNT_VALUE_NAME, 'OUTLIERSCOUNT_IQR([Attr])', {
49
+ Attr: target,
50
+ }),
51
+ ];
52
+ }
53
+ exports.boxWhiskerIqrValues = boxWhiskerIqrValues;
54
+ /**
55
+ * Returns an array of extremum values for box whisker plot.
56
+ *
57
+ * @param {Attribute} target - The target attribute for calculations.
58
+ * @returns {Measure[]} An array of measures representing extremum values for box whisker plots.
59
+ */
60
+ function boxWhiskerExtremumsValues(target) {
61
+ return [
62
+ ...boxWhiskerCommonValues(target),
63
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MIN_VALUE_NAME, 'MIN([Attr])', {
64
+ Attr: target,
65
+ }),
66
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MAX_VALUE_NAME, 'MAX([Attr])', {
67
+ Attr: target,
68
+ }),
69
+ ];
70
+ }
71
+ exports.boxWhiskerExtremumsValues = boxWhiskerExtremumsValues;
72
+ /**
73
+ * Returns an array of values for box whisker plot using standard deviation calculations.
74
+ *
75
+ * @param {Attribute} target - The target attribute for calculations.
76
+ * @returns {Measure[]} An array of measures representing standard deviation values for box whisker plots.
77
+ */
78
+ function boxWhiskerStdDevValues(target) {
79
+ return [
80
+ ...boxWhiskerCommonValues(target),
81
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MIN_VALUE_NAME, 'LOWERWHISKERMAX_STDEVP([Attr])', {
82
+ Attr: target,
83
+ }),
84
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.WHISKER_MAX_VALUE_NAME, 'UPPERWHISKERMIN_STDEVP([Attr])', {
85
+ Attr: target,
86
+ }),
87
+ (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_COUNT_VALUE_NAME, 'OUTLIERSCOUNT_STDEVP([Attr])', {
88
+ Attr: target,
89
+ }),
90
+ ];
91
+ }
92
+ exports.boxWhiskerStdDevValues = boxWhiskerStdDevValues;
93
+ /**
94
+ * Returns an attribute representing outlier points based on interquartile range (IQR) calculations.
95
+ *
96
+ * @param {Attribute} target - The target attribute for calculations.
97
+ * @returns {Attribute} An attribute representing outliers for box whisker plots using IQR.
98
+ */
99
+ const boxWhiskerIqrOutliers = (target) => {
100
+ const outliersAttrWithInnerFilter = (0, cloneDeep_js_1.default)(target);
101
+ const outliersMax = (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_MAX_VALUE_NAME, '(UPPERWHISKERMIN_IQR([Attr]), all([Attr]))', {
102
+ Attr: target,
103
+ });
104
+ const outliersMin = (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_MIN_VALUE_NAME, '(LOWERWHISKERMAX_IQR([Attr]), all([Attr]))', {
105
+ Attr: target,
106
+ });
107
+ outliersAttrWithInnerFilter.name = `${outliersAttrWithInnerFilter.name} (Outliers)`;
108
+ outliersAttrWithInnerFilter.jaql = () => {
109
+ return Object.assign(Object.assign({}, target.jaql(true)), { filter: {
110
+ or: [
111
+ {
112
+ fromNotEqual: outliersMax.jaql(true),
113
+ },
114
+ {
115
+ toNotEqual: outliersMin.jaql(true),
116
+ },
117
+ ],
118
+ } });
119
+ };
120
+ return outliersAttrWithInnerFilter;
121
+ };
122
+ exports.boxWhiskerIqrOutliers = boxWhiskerIqrOutliers;
123
+ /**
124
+ * Returns an attribute representing outlier points based on standard deviation calculations.
125
+ *
126
+ * @param {Attribute} target - The target attribute for calculations.
127
+ * @returns {Attribute} An attribute representing outliers for box whisker plots using standard deviation.
128
+ */
129
+ const boxWhiskerStdDevOutliers = (target) => {
130
+ const outliersAttrWithInnerFilter = (0, cloneDeep_js_1.default)(target);
131
+ const outliersMax = (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_MAX_VALUE_NAME, '(UPPERWHISKERMIN_STDEVP([Attr]), all([Attr]))', {
132
+ Attr: target,
133
+ });
134
+ const outliersMin = (0, factory_js_1.customFormula)(exports.BOX_WHISKER.OUTLIER_MIN_VALUE_NAME, '(LOWERWHISKERMAX_STDEVP([Attr]), all([Attr]))', {
135
+ Attr: target,
136
+ });
137
+ outliersAttrWithInnerFilter.jaql = () => {
138
+ return Object.assign(Object.assign({}, target.jaql(true)), { filter: {
139
+ or: [
140
+ {
141
+ fromNotEqual: outliersMax.jaql(true),
142
+ },
143
+ {
144
+ toNotEqual: outliersMin.jaql(true),
145
+ },
146
+ ],
147
+ } });
148
+ };
149
+ return outliersAttrWithInnerFilter;
150
+ };
151
+ exports.boxWhiskerStdDevOutliers = boxWhiskerStdDevOutliers;
@@ -0,0 +1,99 @@
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 __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const analyticsFactory = __importStar(require("./factory.js"));
27
+ const attributes_js_1 = require("../attributes.js");
28
+ const attribute = (0, attributes_js_1.createAttribute)({
29
+ name: 'text',
30
+ type: 'text',
31
+ expression: '[Text]',
32
+ });
33
+ function validateBoxWhiskerValues(values, targetAttribute, expectedFormulas) {
34
+ const valuesJaqls = values.map((v) => v.jaql(true));
35
+ expect(values).toHaveLength(expectedFormulas.length);
36
+ expectedFormulas.forEach((expectedFormula) => {
37
+ var _a;
38
+ const relatedValueJaql = valuesJaqls.find(({ formula }) => formula.includes(expectedFormula));
39
+ expect(relatedValueJaql).toBeDefined();
40
+ expect(((_a = relatedValueJaql === null || relatedValueJaql === void 0 ? void 0 : relatedValueJaql.context) === null || _a === void 0 ? void 0 : _a['[Attr]']).dim).toBe(targetAttribute.expression);
41
+ });
42
+ }
43
+ function validateBoxWhiskerOutliers(outliersAttr, targetAttribute, expectedFilterFormulas) {
44
+ expect(outliersAttr).toBeDefined();
45
+ const outliersAttrJaql = outliersAttr.jaql(true);
46
+ expect(outliersAttrJaql.dim).toBe(targetAttribute.expression);
47
+ expect(outliersAttrJaql.filter).toBeDefined();
48
+ expectedFilterFormulas.forEach((expectedFormula) => {
49
+ var _a;
50
+ const filterJaql = outliersAttrJaql.filter.or
51
+ .map(({ fromNotEqual, toNotEqual }) => (fromNotEqual || toNotEqual))
52
+ .find((formulaJaql) => formulaJaql.formula.includes(expectedFormula));
53
+ expect(filterJaql).toBeDefined();
54
+ expect(((_a = filterJaql === null || filterJaql === void 0 ? void 0 : filterJaql.context) === null || _a === void 0 ? void 0 : _a['[Attr]']).dim).toBe(targetAttribute.expression);
55
+ });
56
+ }
57
+ describe('analyticsFactory', () => {
58
+ test('analyticsFactory.boxWhiskerIqrValues()', () => {
59
+ validateBoxWhiskerValues(analyticsFactory.boxWhiskerIqrValues(attribute), attribute, [
60
+ 'QUARTILE([Attr], 1)',
61
+ 'MEDIAN([Attr])',
62
+ 'QUARTILE([Attr], 3)',
63
+ 'LOWERWHISKERMAX_IQR([Attr])',
64
+ 'UPPERWHISKERMIN_IQR([Attr])',
65
+ 'OUTLIERSCOUNT_IQR([Attr])',
66
+ ]);
67
+ });
68
+ test('analyticsFactory.boxWhiskerExtremumsValues()', () => {
69
+ validateBoxWhiskerValues(analyticsFactory.boxWhiskerExtremumsValues(attribute), attribute, [
70
+ 'QUARTILE([Attr], 1)',
71
+ 'MEDIAN([Attr])',
72
+ 'QUARTILE([Attr], 3)',
73
+ 'MIN([Attr])',
74
+ 'MAX([Attr])',
75
+ ]);
76
+ });
77
+ test('analyticsFactory.boxWhiskerStdDevValues()', () => {
78
+ validateBoxWhiskerValues(analyticsFactory.boxWhiskerStdDevValues(attribute), attribute, [
79
+ 'QUARTILE([Attr], 1)',
80
+ 'MEDIAN([Attr])',
81
+ 'QUARTILE([Attr], 3)',
82
+ 'LOWERWHISKERMAX_STDEVP([Attr])',
83
+ 'UPPERWHISKERMIN_STDEVP([Attr])',
84
+ 'OUTLIERSCOUNT_STDEVP([Attr])',
85
+ ]);
86
+ });
87
+ test('analyticsFactory.boxWhiskerIqrOutliers()', () => {
88
+ validateBoxWhiskerOutliers(analyticsFactory.boxWhiskerIqrOutliers(attribute), attribute, [
89
+ '(UPPERWHISKERMIN_IQR([Attr]), all([Attr]))',
90
+ '(LOWERWHISKERMAX_IQR([Attr]), all([Attr]))',
91
+ ]);
92
+ });
93
+ test('analyticsFactory.boxWhiskerStdDevOutliers()', () => {
94
+ validateBoxWhiskerOutliers(analyticsFactory.boxWhiskerStdDevOutliers(attribute), attribute, [
95
+ '(UPPERWHISKERMIN_STDEVP([Attr]), all([Attr]))',
96
+ '(LOWERWHISKERMAX_STDEVP([Attr]), all([Attr]))',
97
+ ]);
98
+ });
99
+ });
@@ -0,0 +1,139 @@
1
+ import { Attribute, LevelAttribute } from './interfaces.js';
2
+ import { Sort } from './types.js';
3
+ import { DimensionalElement } from './base.js';
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare const jaqlSimpleColumnType: (datatype: string) => string;
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare class DimensionalAttribute extends DimensionalElement implements Attribute {
12
+ readonly expression: string;
13
+ protected _sort: Sort;
14
+ constructor(name: string, expression: string, type?: string, desc?: string, sort?: Sort);
15
+ /**
16
+ * gets the element's ID
17
+ */
18
+ get id(): string;
19
+ /**
20
+ * Gets the sort definition of this instance
21
+ *
22
+ * @returns The Sort definition of this instance
23
+ */
24
+ getSort(): Sort;
25
+ /**
26
+ * Gets a sorted {@link Attribute} with the given definition
27
+ *
28
+ * @param sort - Sort definition
29
+ * @returns An instance representing the sorted {@link Attribute} of this instance
30
+ */
31
+ sort(sort: Sort): Attribute;
32
+ /**
33
+ * Gets the JAQL representation of this instance
34
+ *
35
+ * @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
36
+ */
37
+ jaql(nested?: boolean): any;
38
+ /**
39
+ * Gets a serializable representation of the element
40
+ */
41
+ serializable(): any;
42
+ }
43
+ /**
44
+ * @internal
45
+ */
46
+ export declare class DimensionalLevelAttribute extends DimensionalAttribute implements LevelAttribute {
47
+ private _format;
48
+ readonly granularity: string;
49
+ constructor(l: string, expression: string, granularity: string, format?: string, desc?: string, sort?: Sort);
50
+ /**
51
+ * gets the element's ID
52
+ */
53
+ get id(): string;
54
+ /**
55
+ * Gets the sort definition of this instance
56
+ *
57
+ * @returns The Sort definition of this instance
58
+ */
59
+ getSort(): Sort;
60
+ /**
61
+ * Gets a sorted {@link LevelAttribute} with the given definition
62
+ *
63
+ * @param sort - Sort definition
64
+ * @returns An instance representing the sorted {@link LevelAttribute} of this instance
65
+ */
66
+ sort(sort: Sort): Attribute;
67
+ /**
68
+ * The string formatting of this instance
69
+ *
70
+ * @returns string formatting
71
+ */
72
+ getFormat(): string | undefined;
73
+ /**
74
+ * Gets a formatted {@link LevelAttribute} with the given definition
75
+ *
76
+ * @param format - Format string
77
+ * @returns An instance representing the formatted {@link LevelAttribute} of this instance
78
+ */
79
+ format(format: string): LevelAttribute;
80
+ /**
81
+ * Gets a serializable representation of the element
82
+ */
83
+ serializable(): any;
84
+ /**
85
+ * Gets the JAQL representation of this instance
86
+ *
87
+ * @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
88
+ */
89
+ jaql(nested?: boolean): any;
90
+ /**
91
+ * Obtain the JAQL representation of the level that depends on the granularity
92
+ */
93
+ translateGranularityToJaql(): {
94
+ level: string;
95
+ dateTimeLevel?: undefined;
96
+ bucket?: undefined;
97
+ } | {
98
+ dateTimeLevel: string;
99
+ bucket: string;
100
+ level?: undefined;
101
+ } | {
102
+ level: string;
103
+ bucket: string;
104
+ dateTimeLevel?: undefined;
105
+ };
106
+ static translateJaqlToGranularity(json: any): string;
107
+ static getDefaultFormatForGranularity(granularity: string): string;
108
+ }
109
+ /**
110
+ * Creates an Attribute instance from the given JSON object.
111
+ * If the JSON object contains a granularity property, a {@link LevelAttribute} instance is created.
112
+ *
113
+ * This function is used in the generated data model code to create dimension attributes from an input data source.
114
+ *
115
+ * See also functions {@link createDimension} and {@link createDateDimension}.
116
+ *
117
+ * @param json - JSON object representing the attribute
118
+ * @returns An Attribute instance
119
+ * @group Data Model Utilities
120
+ */
121
+ export declare function createAttribute(json: any): Attribute;
122
+ /**
123
+ * Creates a LevelAttribute instance from the given JSON object.
124
+ *
125
+ * @param json - JSON object representing the level attribute
126
+ * @internal
127
+ */
128
+ export declare function createLevel(json: any): LevelAttribute;
129
+ /**
130
+ * Normalize attribute name
131
+ *
132
+ * @param tableName - Table name (e.g., Commerce Sales)
133
+ * @param columnName - Column name (e.g., Order Date)
134
+ * @param dateLevel - Date level (e.g., Years)
135
+ * @param modelName - module name (e.g., DM)
136
+ * @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
137
+ * @internal
138
+ */
139
+ export declare function normalizeAttributeName(tableName: string, columnName: string, dateLevel?: string, modelName?: string): string;