@sisense/sdk-data 1.33.0 → 1.34.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/attributes.d.ts +10 -3
- package/dist/cjs/dimensional-model/attributes.js +18 -5
- package/dist/cjs/dimensional-model/data-model.d.ts +1 -1
- package/dist/cjs/dimensional-model/data-model.js +1 -1
- package/dist/cjs/dimensional-model/dimensions/dimensions.d.ts +2 -2
- package/dist/cjs/dimensional-model/dimensions/dimensions.js +9 -1
- package/dist/cjs/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/cjs/dimensional-model/dimensions/utils.js +2 -1
- package/dist/cjs/dimensional-model/factory.js +5 -5
- package/dist/cjs/dimensional-model/filters/factory.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/cjs/dimensional-model/filters/filter-relations.js +12 -2
- package/dist/cjs/dimensional-model/filters/filters.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/filters.js +4 -4
- package/dist/cjs/dimensional-model/filters/helpers.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/helpers.js +2 -2
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +6 -6
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +4 -4
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -5
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.d.ts +1 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/cjs/dimensional-model/interfaces.d.ts +9 -1
- package/dist/cjs/dimensional-model/jaql-element.js +1 -1
- package/dist/cjs/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/cjs/dimensional-model/measures/factory.js +4 -4
- package/dist/cjs/dimensional-model/measures/measures.d.ts +2 -2
- package/dist/cjs/dimensional-model/measures/measures.js +4 -4
- package/dist/cjs/dimensional-model/types.d.ts +17 -15
- package/dist/cjs/index.d.ts +7 -7
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/utils.d.ts +24 -8
- package/dist/cjs/utils.js +44 -13
- package/dist/dimensional-model/attributes.d.ts +10 -3
- package/dist/dimensional-model/attributes.js +18 -5
- package/dist/dimensional-model/data-model.d.ts +1 -1
- package/dist/dimensional-model/data-model.js +1 -1
- package/dist/dimensional-model/dimensions/dimensions.d.ts +2 -2
- package/dist/dimensional-model/dimensions/dimensions.js +9 -1
- package/dist/dimensional-model/dimensions/utils.d.ts +1 -0
- package/dist/dimensional-model/dimensions/utils.js +3 -2
- package/dist/dimensional-model/factory.js +5 -5
- package/dist/dimensional-model/filters/factory.d.ts +1 -1
- package/dist/dimensional-model/filters/factory.js +1 -1
- package/dist/dimensional-model/filters/filter-relations.d.ts +11 -2
- package/dist/dimensional-model/filters/filter-relations.js +12 -2
- package/dist/dimensional-model/filters/filters.d.ts +1 -1
- package/dist/dimensional-model/filters/filters.js +4 -4
- package/dist/dimensional-model/filters/helpers.d.ts +1 -1
- package/dist/dimensional-model/filters/helpers.js +2 -2
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +7 -7
- package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +4 -4
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -5
- package/dist/dimensional-model/filters/utils/filter-types-util.d.ts +1 -1
- package/dist/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/dimensional-model/interfaces.d.ts +9 -1
- package/dist/dimensional-model/jaql-element.js +1 -1
- package/dist/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/dimensional-model/measures/factory.js +4 -4
- package/dist/dimensional-model/measures/measures.d.ts +2 -2
- package/dist/dimensional-model/measures/measures.js +4 -4
- package/dist/dimensional-model/types.d.ts +17 -15
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/translation/initialize-i18n.js +1 -1
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/dist/utils.d.ts +24 -8
- package/dist/utils.js +42 -13
- package/package.json +5 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ConditionFilterJaql, JaqlDataSource } from './filters/utils/types.js';
|
|
2
2
|
import { Attribute } from './interfaces.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
@@ -141,24 +141,26 @@ export declare const MetadataTypes: {
|
|
|
141
141
|
* Levels for {@link DateDimension}
|
|
142
142
|
*/
|
|
143
143
|
export declare const DateLevels: {
|
|
144
|
-
Years:
|
|
145
|
-
Quarters:
|
|
146
|
-
Months:
|
|
147
|
-
Weeks:
|
|
148
|
-
Days:
|
|
149
|
-
Hours:
|
|
150
|
-
MinutesRoundTo30:
|
|
151
|
-
MinutesRoundTo15:
|
|
152
|
-
Minutes:
|
|
153
|
-
Seconds:
|
|
154
|
-
AggHours:
|
|
155
|
-
AggMinutesRoundTo30:
|
|
156
|
-
AggMinutesRoundTo15:
|
|
157
|
-
AggMinutesRoundTo1:
|
|
144
|
+
readonly Years: "Years";
|
|
145
|
+
readonly Quarters: "Quarters";
|
|
146
|
+
readonly Months: "Months";
|
|
147
|
+
readonly Weeks: "Weeks";
|
|
148
|
+
readonly Days: "Days";
|
|
149
|
+
readonly Hours: "Hours";
|
|
150
|
+
readonly MinutesRoundTo30: "MinutesRoundTo30";
|
|
151
|
+
readonly MinutesRoundTo15: "MinutesRoundTo15";
|
|
152
|
+
readonly Minutes: "Minutes";
|
|
153
|
+
readonly Seconds: "Seconds";
|
|
154
|
+
readonly AggHours: "AggHours";
|
|
155
|
+
readonly AggMinutesRoundTo30: "AggMinutesRoundTo30";
|
|
156
|
+
readonly AggMinutesRoundTo15: "AggMinutesRoundTo15";
|
|
157
|
+
readonly AggMinutesRoundTo1: "AggMinutesRoundTo1";
|
|
158
158
|
/** @internal */
|
|
159
159
|
readonly all: string[];
|
|
160
160
|
};
|
|
161
161
|
/** @internal */
|
|
162
|
+
export declare type DateLevel = Exclude<(typeof DateLevels)[keyof typeof DateLevels], typeof DateLevels.all>;
|
|
163
|
+
/** @internal */
|
|
162
164
|
export declare enum DataType {
|
|
163
165
|
TEXT = "text",
|
|
164
166
|
NUMERIC = "numeric",
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -6,18 +6,18 @@ import './translation/initialize-i18n.js';
|
|
|
6
6
|
* @group Data Model Utilities
|
|
7
7
|
* Utility functions for creating attributes and dimensions in code.
|
|
8
8
|
*/
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './dimensional-model/types.js';
|
|
11
|
-
export * from './dimensional-model/interfaces.js';
|
|
9
|
+
export * from './dimensional-model/attributes.js';
|
|
12
10
|
export * from './dimensional-model/base.js';
|
|
13
11
|
export * from './dimensional-model/data-model.js';
|
|
14
|
-
export * from './dimensional-model/attributes.js';
|
|
15
12
|
export * from './dimensional-model/dimensions/index.js';
|
|
16
13
|
export * from './dimensional-model/factory.js';
|
|
17
|
-
export * from './dimensional-model/jaql-element.js';
|
|
18
|
-
export * from './dimensional-model/filters/filters.js';
|
|
19
14
|
export * from './dimensional-model/filters/filter-config-utils.js';
|
|
15
|
+
export * from './dimensional-model/filters/filters.js';
|
|
20
16
|
export { createFilterMatcher } from './dimensional-model/filters/utils/filter-matcher-utils.js';
|
|
17
|
+
export * from './dimensional-model/interfaces.js';
|
|
18
|
+
export * from './dimensional-model/jaql-element.js';
|
|
19
|
+
export * from './dimensional-model/types.js';
|
|
20
|
+
export * from './interfaces.js';
|
|
21
21
|
/**
|
|
22
22
|
* Functions to create date, text, or numeric filters on specified data.
|
|
23
23
|
*
|
|
@@ -92,6 +92,6 @@ export * from './dimensional-model/simple-column-types.js';
|
|
|
92
92
|
* @group Factories
|
|
93
93
|
*/
|
|
94
94
|
export * as analyticsFactory from './dimensional-model/analytics/factory.js';
|
|
95
|
-
export * from './utils.js';
|
|
96
95
|
export * from './dimensional-model/filters/index.js';
|
|
97
96
|
export { type TranslationDictionary, PACKAGE_NAMESPACE as translationNamespace, } from './translation/resources/index.js';
|
|
97
|
+
export * from './utils.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -35,19 +35,19 @@ require("./translation/initialize-i18n.js");
|
|
|
35
35
|
* @group Data Model Utilities
|
|
36
36
|
* Utility functions for creating attributes and dimensions in code.
|
|
37
37
|
*/
|
|
38
|
-
__exportStar(require("./
|
|
39
|
-
__exportStar(require("./dimensional-model/types.js"), exports);
|
|
40
|
-
__exportStar(require("./dimensional-model/interfaces.js"), exports);
|
|
38
|
+
__exportStar(require("./dimensional-model/attributes.js"), exports);
|
|
41
39
|
__exportStar(require("./dimensional-model/base.js"), exports);
|
|
42
40
|
__exportStar(require("./dimensional-model/data-model.js"), exports);
|
|
43
|
-
__exportStar(require("./dimensional-model/attributes.js"), exports);
|
|
44
41
|
__exportStar(require("./dimensional-model/dimensions/index.js"), exports);
|
|
45
42
|
__exportStar(require("./dimensional-model/factory.js"), exports);
|
|
46
|
-
__exportStar(require("./dimensional-model/jaql-element.js"), exports);
|
|
47
|
-
__exportStar(require("./dimensional-model/filters/filters.js"), exports);
|
|
48
43
|
__exportStar(require("./dimensional-model/filters/filter-config-utils.js"), exports);
|
|
44
|
+
__exportStar(require("./dimensional-model/filters/filters.js"), exports);
|
|
49
45
|
var filter_matcher_utils_js_1 = require("./dimensional-model/filters/utils/filter-matcher-utils.js");
|
|
50
46
|
Object.defineProperty(exports, "createFilterMatcher", { enumerable: true, get: function () { return filter_matcher_utils_js_1.createFilterMatcher; } });
|
|
47
|
+
__exportStar(require("./dimensional-model/interfaces.js"), exports);
|
|
48
|
+
__exportStar(require("./dimensional-model/jaql-element.js"), exports);
|
|
49
|
+
__exportStar(require("./dimensional-model/types.js"), exports);
|
|
50
|
+
__exportStar(require("./interfaces.js"), exports);
|
|
51
51
|
/**
|
|
52
52
|
* Functions to create date, text, or numeric filters on specified data.
|
|
53
53
|
*
|
|
@@ -122,7 +122,7 @@ __exportStar(require("./dimensional-model/simple-column-types.js"), exports);
|
|
|
122
122
|
* @group Factories
|
|
123
123
|
*/
|
|
124
124
|
exports.analyticsFactory = __importStar(require("./dimensional-model/analytics/factory.js"));
|
|
125
|
-
__exportStar(require("./utils.js"), exports);
|
|
126
125
|
__exportStar(require("./dimensional-model/filters/index.js"), exports);
|
|
127
126
|
var index_js_1 = require("./translation/resources/index.js");
|
|
128
127
|
Object.defineProperty(exports, "translationNamespace", { enumerable: true, get: function () { return index_js_1.PACKAGE_NAMESPACE; } });
|
|
128
|
+
__exportStar(require("./utils.js"), exports);
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JaqlDataSource } from './dimensional-model/filters/utils/types.js';
|
|
1
|
+
import { FilterJaqlInternal, JaqlDataSource, RankingFilterJaql } from './dimensional-model/filters/utils/types.js';
|
|
2
2
|
import { Attribute, BaseMeasure, CalculatedMeasure, Filter, FilterRelations, FilterRelationsJaql, LevelAttribute, SortDirection } from './dimensional-model/interfaces.js';
|
|
3
|
+
import { BaseJaql, FilterJaql, FormulaJaql, Jaql, JaqlSortDirection, Sort } from './dimensional-model/types.js';
|
|
3
4
|
import { DataSource, DataSourceInfo } from './interfaces.js';
|
|
4
|
-
import { FilterJaql, FormulaJaql, Jaql, JaqlSortDirection, Sort } from './dimensional-model/types.js';
|
|
5
5
|
/**
|
|
6
6
|
* A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
|
|
7
7
|
*
|
|
@@ -49,6 +49,14 @@ export declare function convertJaqlDataSource(dataSource: DataSource): JaqlDataS
|
|
|
49
49
|
* @internal
|
|
50
50
|
*/
|
|
51
51
|
export declare function convertSort(sort?: string): Sort;
|
|
52
|
+
/**
|
|
53
|
+
* Converts a SortDirection to a Sort enum
|
|
54
|
+
*
|
|
55
|
+
* @param sortDirection - The SortDirection to convert
|
|
56
|
+
* @returns The converted Sort enum
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare function convertSortDirectionToSort(sortDirection: SortDirection): Sort;
|
|
52
60
|
/**
|
|
53
61
|
* Creates a filter from a JAQL object.
|
|
54
62
|
*
|
|
@@ -86,7 +94,7 @@ export declare function getSortType(jaqlSort: `${JaqlSortDirection}` | undefined
|
|
|
86
94
|
* @returns attribute or level attribute
|
|
87
95
|
* @internal
|
|
88
96
|
*/
|
|
89
|
-
export declare const createAttributeHelper: ({ dim, table, column, dataType,
|
|
97
|
+
export declare const createAttributeHelper: ({ dim, table, column, dataType, granularity, format, sort, title, panel, dataSource, }: {
|
|
90
98
|
/** Dimension expression */
|
|
91
99
|
dim: string;
|
|
92
100
|
/** Table name */
|
|
@@ -95,8 +103,8 @@ export declare const createAttributeHelper: ({ dim, table, column, dataType, lev
|
|
|
95
103
|
column: string | undefined;
|
|
96
104
|
/** Data type */
|
|
97
105
|
dataType: string;
|
|
98
|
-
/** Date
|
|
99
|
-
|
|
106
|
+
/** Date granularity */
|
|
107
|
+
granularity: string | undefined;
|
|
100
108
|
/** Format */
|
|
101
109
|
format: string | undefined;
|
|
102
110
|
/** Sort */
|
|
@@ -114,7 +122,7 @@ export declare const createAttributeHelper: ({ dim, table, column, dataType, lev
|
|
|
114
122
|
* @returns measure
|
|
115
123
|
* @internal
|
|
116
124
|
*/
|
|
117
|
-
export declare const createMeasureHelper: ({ dim, table, column, dataType, agg,
|
|
125
|
+
export declare const createMeasureHelper: ({ dim, table, column, dataType, agg, granularity, format, sort, title, dataSource, }: {
|
|
118
126
|
/** Dimension expression */
|
|
119
127
|
dim: string;
|
|
120
128
|
/** Table name */
|
|
@@ -125,8 +133,8 @@ export declare const createMeasureHelper: ({ dim, table, column, dataType, agg,
|
|
|
125
133
|
dataType: string;
|
|
126
134
|
/** Aggregation function */
|
|
127
135
|
agg: string;
|
|
128
|
-
/** Date
|
|
129
|
-
|
|
136
|
+
/** Date granularity */
|
|
137
|
+
granularity: string | undefined;
|
|
130
138
|
/** Format */
|
|
131
139
|
format: string | undefined;
|
|
132
140
|
/** Sort */
|
|
@@ -152,3 +160,11 @@ export declare const createCalculatedMeasureHelper: (jaql: FormulaJaql) => Calcu
|
|
|
152
160
|
* @internal
|
|
153
161
|
*/
|
|
154
162
|
export declare function createDimensionalElementFromJaql(jaql: Jaql, datetimeFormat?: string, panel?: string): Attribute | BaseMeasure | CalculatedMeasure | Filter;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the granularity from the provided JAQL object.
|
|
165
|
+
*
|
|
166
|
+
* @param jaql - The JAQL object.
|
|
167
|
+
* @returns string.
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
export declare function getGranularityFromJaql(jaql: BaseJaql | FilterJaql | FilterJaqlInternal | RankingFilterJaql): string | undefined;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createDimensionalElementFromJaql = exports.createCalculatedMeasureHelper = exports.createMeasureHelper = exports.createAttributeHelper = exports.getSortType = exports.getColumnNameFromAttribute = exports.getTableNameFromAttribute = exports.createFilterFromJaql = exports.convertSort = exports.convertJaqlDataSource = exports.convertDataSource = exports.isDataSourceInfo = exports.getDataSourceName = exports.getFilterListAndRelationsJaql = exports.guidFast = void 0;
|
|
6
|
+
exports.getGranularityFromJaql = exports.createDimensionalElementFromJaql = exports.createCalculatedMeasureHelper = exports.createMeasureHelper = exports.createAttributeHelper = exports.getSortType = exports.getColumnNameFromAttribute = exports.getTableNameFromAttribute = exports.createFilterFromJaql = exports.convertSortDirectionToSort = exports.convertSort = exports.convertJaqlDataSource = exports.convertDataSource = exports.isDataSourceInfo = exports.getDataSourceName = exports.getFilterListAndRelationsJaql = exports.guidFast = void 0;
|
|
7
|
+
const sdk_common_1 = require("@sisense/sdk-common");
|
|
7
8
|
const cloneDeep_js_1 = __importDefault(require("lodash-es/cloneDeep.js"));
|
|
8
9
|
const mapValues_js_1 = __importDefault(require("lodash-es/mapValues.js"));
|
|
10
|
+
const attributes_js_1 = require("./dimensional-model/attributes.js");
|
|
11
|
+
const filters_js_1 = require("./dimensional-model/filters/filters.js");
|
|
9
12
|
const filter_from_jaql_util_js_1 = require("./dimensional-model/filters/utils/filter-from-jaql-util.js");
|
|
10
|
-
const types_js_1 = require("./dimensional-model/types.js");
|
|
11
|
-
const sdk_common_1 = require("@sisense/sdk-common");
|
|
12
13
|
const measures_js_1 = require("./dimensional-model/measures/measures.js");
|
|
13
|
-
const filters_js_1 = require("./dimensional-model/filters/filters.js");
|
|
14
|
-
const attributes_js_1 = require("./dimensional-model/attributes.js");
|
|
15
14
|
const simple_column_types_js_1 = require("./dimensional-model/simple-column-types.js");
|
|
15
|
+
const types_js_1 = require("./dimensional-model/types.js");
|
|
16
16
|
/**
|
|
17
17
|
* A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
|
|
18
18
|
*
|
|
@@ -158,6 +158,24 @@ function convertSort(sort) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
exports.convertSort = convertSort;
|
|
161
|
+
/**
|
|
162
|
+
* Converts a SortDirection to a Sort enum
|
|
163
|
+
*
|
|
164
|
+
* @param sortDirection - The SortDirection to convert
|
|
165
|
+
* @returns The converted Sort enum
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
function convertSortDirectionToSort(sortDirection) {
|
|
169
|
+
switch (sortDirection) {
|
|
170
|
+
case 'sortAsc':
|
|
171
|
+
return types_js_1.Sort.Ascending;
|
|
172
|
+
case 'sortDesc':
|
|
173
|
+
return types_js_1.Sort.Descending;
|
|
174
|
+
default:
|
|
175
|
+
return types_js_1.Sort.None;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.convertSortDirectionToSort = convertSortDirectionToSort;
|
|
161
179
|
/**
|
|
162
180
|
* Creates a filter from a JAQL object.
|
|
163
181
|
*
|
|
@@ -244,7 +262,7 @@ const DATA_MODEL_MODULE_NAME = 'DM';
|
|
|
244
262
|
* @returns attribute or level attribute
|
|
245
263
|
* @internal
|
|
246
264
|
*/
|
|
247
|
-
const createAttributeHelper = ({ dim, table, column, dataType,
|
|
265
|
+
const createAttributeHelper = ({ dim, table, column, dataType, granularity, format, sort, title, panel, dataSource, }) => {
|
|
248
266
|
// if table is undefined, extract it from dim
|
|
249
267
|
const dimTable = table !== null && table !== void 0 ? table : parseExpression(dim).table;
|
|
250
268
|
// if column is undefined, extract it from dim
|
|
@@ -252,9 +270,9 @@ const createAttributeHelper = ({ dim, table, column, dataType, level, format, so
|
|
|
252
270
|
const sortEnum = convertSort(sort);
|
|
253
271
|
const isDataTypeDatetime = dataType === types_js_1.DataType.DATETIME;
|
|
254
272
|
if (isDataTypeDatetime) {
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
|
|
273
|
+
const composeCode = (0, attributes_js_1.normalizeAttributeName)(dimTable, dimColumn, granularity, DATA_MODEL_MODULE_NAME);
|
|
274
|
+
const levelAttribute = new attributes_js_1.DimensionalLevelAttribute(title !== null && title !== void 0 ? title : dimColumn, dim, granularity || types_js_1.DateLevels.Years, format ||
|
|
275
|
+
attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(granularity || types_js_1.DateLevels.Years), undefined, sortEnum, dataSource, composeCode, panel);
|
|
258
276
|
return levelAttribute;
|
|
259
277
|
}
|
|
260
278
|
const attributeType = !dataType || (0, simple_column_types_js_1.isNumber)(dataType) ? types_js_1.MetadataTypes.NumericAttribute : types_js_1.MetadataTypes.TextAttribute;
|
|
@@ -269,14 +287,14 @@ exports.createAttributeHelper = createAttributeHelper;
|
|
|
269
287
|
* @returns measure
|
|
270
288
|
* @internal
|
|
271
289
|
*/
|
|
272
|
-
const createMeasureHelper = ({ dim, table, column, dataType, agg,
|
|
290
|
+
const createMeasureHelper = ({ dim, table, column, dataType, agg, granularity, format, sort, title, dataSource, }) => {
|
|
273
291
|
const sortEnum = convertSort(sort);
|
|
274
292
|
const attribute = (0, exports.createAttributeHelper)({
|
|
275
293
|
dim,
|
|
276
294
|
table,
|
|
277
295
|
column,
|
|
278
296
|
dataType,
|
|
279
|
-
|
|
297
|
+
granularity,
|
|
280
298
|
format,
|
|
281
299
|
sort,
|
|
282
300
|
title,
|
|
@@ -345,7 +363,7 @@ function createDimensionalElementFromJaql(jaql, datetimeFormat, panel) {
|
|
|
345
363
|
column: jaql.column,
|
|
346
364
|
dataType: jaql.datatype,
|
|
347
365
|
agg: jaql.agg || '',
|
|
348
|
-
|
|
366
|
+
granularity: getGranularityFromJaql(jaql),
|
|
349
367
|
format: datetimeFormat,
|
|
350
368
|
sort: jaql.sort,
|
|
351
369
|
title: jaql.title,
|
|
@@ -357,7 +375,7 @@ function createDimensionalElementFromJaql(jaql, datetimeFormat, panel) {
|
|
|
357
375
|
table: jaql.table,
|
|
358
376
|
column: jaql.column,
|
|
359
377
|
dataType: jaql.datatype,
|
|
360
|
-
|
|
378
|
+
granularity: getGranularityFromJaql(jaql),
|
|
361
379
|
format: datetimeFormat,
|
|
362
380
|
sort: jaql.sort,
|
|
363
381
|
title: jaql.title,
|
|
@@ -366,3 +384,16 @@ function createDimensionalElementFromJaql(jaql, datetimeFormat, panel) {
|
|
|
366
384
|
});
|
|
367
385
|
}
|
|
368
386
|
exports.createDimensionalElementFromJaql = createDimensionalElementFromJaql;
|
|
387
|
+
/**
|
|
388
|
+
* Returns the granularity from the provided JAQL object.
|
|
389
|
+
*
|
|
390
|
+
* @param jaql - The JAQL object.
|
|
391
|
+
* @returns string.
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
function getGranularityFromJaql(jaql) {
|
|
395
|
+
return (jaql === null || jaql === void 0 ? void 0 : jaql.datatype) && (0, simple_column_types_js_1.isDatetime)(jaql.datatype)
|
|
396
|
+
? attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(jaql)
|
|
397
|
+
: undefined;
|
|
398
|
+
}
|
|
399
|
+
exports.getGranularityFromJaql = getGranularityFromJaql;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, LevelAttribute } from './interfaces.js';
|
|
2
|
-
import { Sort, JaqlDataSource } from './types.js';
|
|
3
1
|
import { DimensionalElement } from './base.js';
|
|
2
|
+
import { Attribute, LevelAttribute } from './interfaces.js';
|
|
3
|
+
import { DateLevel, JaqlDataSource, Sort } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -79,6 +79,13 @@ export declare class DimensionalLevelAttribute extends DimensionalAttribute impl
|
|
|
79
79
|
* @returns An instance representing the formatted {@link LevelAttribute} of this instance
|
|
80
80
|
*/
|
|
81
81
|
format(format: string): LevelAttribute;
|
|
82
|
+
/**
|
|
83
|
+
* Gets a {@link LevelAttribute} with the given granularity
|
|
84
|
+
*
|
|
85
|
+
* @param granularity - Date granularity
|
|
86
|
+
* @returns New instance representing {@link LevelAttribute} with provided granularity
|
|
87
|
+
*/
|
|
88
|
+
setGranularity(granularity: DateLevel): LevelAttribute;
|
|
82
89
|
/**
|
|
83
90
|
* Gets a serializable representation of the element
|
|
84
91
|
*/
|
|
@@ -138,4 +145,4 @@ export declare function createLevel(json: any): LevelAttribute;
|
|
|
138
145
|
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
139
146
|
* @internal
|
|
140
147
|
*/
|
|
141
|
-
export declare function normalizeAttributeName(tableName: string, columnName: string,
|
|
148
|
+
export declare function normalizeAttributeName(tableName: string, columnName: string, granularity?: string, modelName?: string): string;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable max-params */
|
|
2
|
+
/* eslint-disable no-underscore-dangle */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
6
|
+
/* eslint-disable sonarjs/no-nested-switch */
|
|
2
7
|
import { DimensionalElement, normalizeName } from './base.js';
|
|
3
8
|
import { simpleColumnType } from './simple-column-types.js';
|
|
9
|
+
import { DateLevels, MetadataTypes, Sort } from './types.js';
|
|
4
10
|
/**
|
|
5
11
|
* @internal
|
|
6
12
|
*/
|
|
@@ -134,6 +140,15 @@ export class DimensionalLevelAttribute extends DimensionalAttribute {
|
|
|
134
140
|
format(format) {
|
|
135
141
|
return new DimensionalLevelAttribute(this.name, this.expression, this.granularity, format, this.description, this._sort, this.dataSource, this.composeCode);
|
|
136
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets a {@link LevelAttribute} with the given granularity
|
|
145
|
+
*
|
|
146
|
+
* @param granularity - Date granularity
|
|
147
|
+
* @returns New instance representing {@link LevelAttribute} with provided granularity
|
|
148
|
+
*/
|
|
149
|
+
setGranularity(granularity) {
|
|
150
|
+
return new DimensionalLevelAttribute(this.name, this.expression, granularity, this._format, this.description, this._sort, this.dataSource, this.composeCode);
|
|
151
|
+
}
|
|
137
152
|
/**
|
|
138
153
|
* Gets a serializable representation of the element
|
|
139
154
|
*/
|
|
@@ -355,12 +370,10 @@ export function createLevel(json) {
|
|
|
355
370
|
* @return full normalized attribute name (e.g., DM.CommerceSales.OrderDate.Years)
|
|
356
371
|
* @internal
|
|
357
372
|
*/
|
|
358
|
-
export function normalizeAttributeName(tableName, columnName,
|
|
373
|
+
export function normalizeAttributeName(tableName, columnName, granularity, modelName) {
|
|
359
374
|
return ((modelName && modelName.length > 0 ? modelName + '.' : '') +
|
|
360
375
|
normalizeName(tableName) +
|
|
361
376
|
'.' +
|
|
362
377
|
normalizeName(columnName) +
|
|
363
|
-
(
|
|
364
|
-
? '.' + DimensionalLevelAttribute.translateJaqlToGranularity({ level: dateLevel })
|
|
365
|
-
: ''));
|
|
378
|
+
(granularity && granularity.length > 0 ? '.' + granularity : ''));
|
|
366
379
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Attribute, LevelAttribute, Dimension, DateDimension } from '../interfaces.js';
|
|
2
|
-
import { Sort, JaqlDataSource } from '../types.js';
|
|
3
1
|
import { DimensionalElement } from '../base.js';
|
|
2
|
+
import { Attribute, DateDimension, Dimension, LevelAttribute } from '../interfaces.js';
|
|
3
|
+
import { JaqlDataSource, Sort } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a Dimension in a Dimensional Model
|
|
6
6
|
*
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable max-params */
|
|
2
|
+
/* eslint-disable no-underscore-dangle */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
6
|
+
/* eslint-disable sonarjs/no-duplicate-string */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
9
|
import { DimensionalAttribute, DimensionalLevelAttribute, jaqlSimpleColumnType, } from '../attributes.js';
|
|
3
10
|
import { DimensionalElement, normalizeName } from '../base.js';
|
|
11
|
+
import { DateLevels, MetadataTypes, Sort } from '../types.js';
|
|
4
12
|
/**
|
|
5
13
|
* Represents a Dimension in a Dimensional Model
|
|
6
14
|
*
|
|
@@ -3,6 +3,7 @@ import { Dimension } from '../interfaces.js';
|
|
|
3
3
|
import { DataSourceField } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Function to convert data source fields to dimensions.
|
|
6
|
+
*
|
|
6
7
|
* @param fields - The data source fields to convert.
|
|
7
8
|
* @param dataSource - The data source title.
|
|
8
9
|
* @returns - The dimensions created from the data source fields.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createAttribute } from '../attributes.js';
|
|
2
|
-
import { createDimension, createDateDimension } from './dimensions.js';
|
|
3
1
|
import { isDataSourceInfo } from '../../utils.js';
|
|
2
|
+
import { createAttribute } from '../attributes.js';
|
|
3
|
+
import { createDateDimension, createDimension } from './dimensions.js';
|
|
4
4
|
/**
|
|
5
5
|
* Function to convert data source fields to dimensions.
|
|
6
|
+
*
|
|
6
7
|
* @param fields - The data source fields to convert.
|
|
7
8
|
* @param dataSource - The data source title.
|
|
8
9
|
* @returns - The dimensions created from the data source fields.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
-
import { MetadataTypes } from './types.js';
|
|
3
|
-
import { createMeasure } from './measures/measures.js';
|
|
4
|
-
import { createFilter } from './filters/filters.js';
|
|
5
|
-
import { createDimension } from './dimensions/index.js';
|
|
6
|
-
import { createAttribute } from './attributes.js';
|
|
7
2
|
import { TranslatableError } from '../translation/translatable-error.js';
|
|
3
|
+
import { createAttribute } from './attributes.js';
|
|
4
|
+
import { createDimension } from './dimensions/index.js';
|
|
5
|
+
import { createFilter } from './filters/filters.js';
|
|
6
|
+
import { createMeasure } from './measures/measures.js';
|
|
7
|
+
import { MetadataTypes } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Generate an array of dimension model instances out of the given JSON array
|
|
10
10
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Attribute, BaseFilterConfig, BaseMeasure, DateDimension, Filter, FilterRelations, FilterRelationsNode, LevelAttribute, Measure, MembersFilterConfig } from '../interfaces.js';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a filter representing the union of multiple filters on the same attribute. The resulting
|
|
4
4
|
* union filter filters on items that match any of the given filters.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CascadingFilter, CustomFilter, DateOperators, DateRangeFilter, ExcludeFilter, LogicalAttributeFilter, LogicalOperators, MeasureFilter, MembersFilter, NumericFilter, NumericOperators, RankingFilter, RankingOperators, RelativeDateFilter, TextFilter, TextOperators, } from './filters.js';
|
|
2
2
|
// LOGICAL FILTERS
|
|
3
3
|
/**
|
|
4
4
|
* Creates a filter representing the union of multiple filters on the same attribute. The resulting
|
|
@@ -11,7 +11,6 @@ export declare function isFilterRelations(filters: Filter[] | FilterRelations |
|
|
|
11
11
|
* Rules of filter relations - logical operators of how filters are related to each other.
|
|
12
12
|
*
|
|
13
13
|
* @internal
|
|
14
|
-
*
|
|
15
14
|
*/
|
|
16
15
|
export declare type FilterRelationsRules = FilterRelationsRule | FilterRelationsRuleNode | null;
|
|
17
16
|
/** @internal */
|
|
@@ -49,6 +48,7 @@ export declare type FilterAction = {
|
|
|
49
48
|
export declare function mergeFiltersOrFilterRelations(sourceFilters?: Filter[] | FilterRelations, targetFilters?: Filter[] | FilterRelations): Filter[] | FilterRelations;
|
|
50
49
|
/**
|
|
51
50
|
* Splits filters or filter relations into filters and relations rules.
|
|
51
|
+
*
|
|
52
52
|
* @internal
|
|
53
53
|
*/
|
|
54
54
|
export declare function splitFiltersAndRelations(filtersOrFilterRelations: Filter[] | FilterRelations | undefined): {
|
|
@@ -57,31 +57,38 @@ export declare function splitFiltersAndRelations(filtersOrFilterRelations: Filte
|
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
59
|
* Returns pure filters array from the given filters or filter relations.
|
|
60
|
+
*
|
|
60
61
|
* @internal
|
|
61
62
|
*/
|
|
62
63
|
export declare function getFiltersArray(filtersOrFilterRelations: Filter[] | FilterRelations | undefined): Filter[];
|
|
63
64
|
/**
|
|
64
65
|
* Combines filters and relations into a single FilterRelations object.
|
|
65
66
|
* If the relations are empty or relations are trivial (single node), the filters are returned as is.
|
|
67
|
+
*
|
|
66
68
|
* @internal
|
|
67
69
|
*/
|
|
68
70
|
export declare function combineFiltersAndRelations(filters: Filter[], relations: FilterRelationsRules): Filter[] | FilterRelations;
|
|
69
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Type guard for checking if a node is a single relations node (trivial case when relations are needless).
|
|
73
|
+
*
|
|
70
74
|
* @internal
|
|
71
75
|
*/
|
|
72
76
|
export declare function isTrivialSingleNodeRelations(relations: FilterRelationsRules): relations is FilterRelationsRuleIdNode;
|
|
73
77
|
/**
|
|
74
78
|
* Calculates new relations based on the changes in filters.
|
|
79
|
+
*
|
|
75
80
|
* @internal
|
|
76
81
|
*/
|
|
77
82
|
export declare function calculateNewRelations(prevFilters: Filter[], prevRelations: FilterRelationsRules, newFilters: Filter[]): FilterRelationsRules;
|
|
78
83
|
/**
|
|
79
84
|
* Replaces a filter in the relations tree with a new filter.
|
|
85
|
+
*
|
|
80
86
|
* @internal
|
|
81
87
|
*/
|
|
82
88
|
export declare function getRelationsWithReplacedFilter(relations: FilterRelationsRules, filterToReplace: Filter, newFilter: Filter): FilterRelationsRules;
|
|
83
89
|
/**
|
|
84
90
|
* Converts filter relations model from Fusion to internal CSDK filter relations rules.
|
|
91
|
+
*
|
|
85
92
|
* @internal
|
|
86
93
|
*/
|
|
87
94
|
export declare function convertFilterRelationsModelToRelationRules(filterRelationsModel: FilterRelationsModel | FilterRelationsModelNode | undefined, filters: Filter[]): FilterRelationsRules;
|
|
@@ -95,6 +102,7 @@ export declare function isRelationsRuleIdNode(node: FilterRelationsRuleNode): no
|
|
|
95
102
|
export declare function isRelationsRule(node: FilterRelationsRuleNode): node is FilterRelationsRule;
|
|
96
103
|
/**
|
|
97
104
|
* Converts internal CSDK filter relations rules to filter relations model for Fusion.
|
|
105
|
+
*
|
|
98
106
|
* @internal
|
|
99
107
|
*/
|
|
100
108
|
export declare function filterRelationRulesToFilterRelationsModel(filterRelationRules: FilterRelationsRules, filters: Filter[]): FilterRelationsModel | FilterRelationsModelNode | undefined;
|
|
@@ -104,6 +112,7 @@ export declare function filterRelationRulesToFilterRelationsModel(filterRelation
|
|
|
104
112
|
export declare function findFilterByGuid(filters: Filter[], guid: string): Filter | undefined;
|
|
105
113
|
/**
|
|
106
114
|
* Error thrown when an unknown node type is encountered in filter relations.
|
|
115
|
+
*
|
|
107
116
|
* @internal
|
|
108
117
|
*/
|
|
109
118
|
export declare class UnknownRelationsNodeError extends Error {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/default-param-last */
|
|
2
|
-
import { DimensionalLevelAttribute, isCascadingFilter, } from '../../index.js';
|
|
3
2
|
import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
4
3
|
import isArray from 'lodash-es/isArray.js';
|
|
4
|
+
import { DimensionalLevelAttribute, isCascadingFilter, } from '../../index.js';
|
|
5
5
|
import { TranslatableError } from '../../translation/translatable-error.js';
|
|
6
6
|
/**
|
|
7
7
|
* Type guard for checking if the provided filters are FilterRelations.
|
|
@@ -37,6 +37,7 @@ export function mergeFiltersOrFilterRelations(sourceFilters = [], targetFilters
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Splits filters or filter relations into filters and relations rules.
|
|
40
|
+
*
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
43
|
export function splitFiltersAndRelations(filtersOrFilterRelations) {
|
|
@@ -67,6 +68,7 @@ export function splitFiltersAndRelations(filtersOrFilterRelations) {
|
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Returns pure filters array from the given filters or filter relations.
|
|
71
|
+
*
|
|
70
72
|
* @internal
|
|
71
73
|
*/
|
|
72
74
|
export function getFiltersArray(filtersOrFilterRelations) {
|
|
@@ -78,6 +80,7 @@ export function getFiltersArray(filtersOrFilterRelations) {
|
|
|
78
80
|
/**
|
|
79
81
|
* Combines filters and relations into a single FilterRelations object.
|
|
80
82
|
* If the relations are empty or relations are trivial (single node), the filters are returned as is.
|
|
83
|
+
*
|
|
81
84
|
* @internal
|
|
82
85
|
*/
|
|
83
86
|
export function combineFiltersAndRelations(filters, relations) {
|
|
@@ -100,7 +103,9 @@ export function combineFiltersAndRelations(filters, relations) {
|
|
|
100
103
|
throw new UnknownRelationsNodeError();
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Type guard for checking if a node is a single relations node (trivial case when relations are needless).
|
|
108
|
+
*
|
|
104
109
|
* @internal
|
|
105
110
|
*/
|
|
106
111
|
export function isTrivialSingleNodeRelations(relations) {
|
|
@@ -108,6 +113,7 @@ export function isTrivialSingleNodeRelations(relations) {
|
|
|
108
113
|
}
|
|
109
114
|
/**
|
|
110
115
|
* Calculates new relations based on the changes in filters.
|
|
116
|
+
*
|
|
111
117
|
* @internal
|
|
112
118
|
*/
|
|
113
119
|
export function calculateNewRelations(prevFilters, prevRelations, newFilters) {
|
|
@@ -136,6 +142,7 @@ function areFiltersEqualForRelations(filter1, filter2) {
|
|
|
136
142
|
}
|
|
137
143
|
/**
|
|
138
144
|
* Replaces a filter in the relations tree with a new filter.
|
|
145
|
+
*
|
|
139
146
|
* @internal
|
|
140
147
|
*/
|
|
141
148
|
export function getRelationsWithReplacedFilter(relations, filterToReplace, newFilter) {
|
|
@@ -234,6 +241,7 @@ function removeFilterFromRelations(filter, relations) {
|
|
|
234
241
|
}
|
|
235
242
|
/**
|
|
236
243
|
* Converts filter relations model from Fusion to internal CSDK filter relations rules.
|
|
244
|
+
*
|
|
237
245
|
* @internal
|
|
238
246
|
*/
|
|
239
247
|
export function convertFilterRelationsModelToRelationRules(filterRelationsModel, filters) {
|
|
@@ -302,6 +310,7 @@ function isFilterNode(node) {
|
|
|
302
310
|
}
|
|
303
311
|
/**
|
|
304
312
|
* Converts internal CSDK filter relations rules to filter relations model for Fusion.
|
|
313
|
+
*
|
|
305
314
|
* @internal
|
|
306
315
|
*/
|
|
307
316
|
export function filterRelationRulesToFilterRelationsModel(filterRelationRules, filters) {
|
|
@@ -354,6 +363,7 @@ export function findFilterByGuid(filters, guid) {
|
|
|
354
363
|
}
|
|
355
364
|
/**
|
|
356
365
|
* Error thrown when an unknown node type is encountered in filter relations.
|
|
366
|
+
*
|
|
357
367
|
* @internal
|
|
358
368
|
*/
|
|
359
369
|
export class UnknownRelationsNodeError extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LevelAttribute, Attribute, Measure, Filter, MembersFilterConfig, CompleteMembersFilterConfig, CompleteBaseFilterConfig, BaseFilterConfig } from '../interfaces.js';
|
|
2
1
|
import { DimensionalElement } from '../base.js';
|
|
2
|
+
import { Attribute, BaseFilterConfig, CompleteBaseFilterConfig, CompleteMembersFilterConfig, Filter, LevelAttribute, Measure, MembersFilterConfig } from '../interfaces.js';
|
|
3
3
|
import { AnyObject } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Different text operators that can be used with text filters
|