@sisense/sdk-data 1.10.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dimensional-model/analytics/factory.d.ts +47 -0
- package/dist/cjs/dimensional-model/analytics/factory.js +151 -0
- package/dist/cjs/dimensional-model/analytics/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/analytics/factory.test.js +99 -0
- package/dist/cjs/dimensional-model/attributes.d.ts +139 -0
- package/dist/cjs/dimensional-model/attributes.js +342 -0
- package/dist/cjs/dimensional-model/attributes.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/attributes.test.js +154 -0
- package/dist/cjs/dimensional-model/base.d.ts +43 -0
- package/dist/cjs/dimensional-model/base.js +58 -0
- package/dist/cjs/dimensional-model/base.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/base.test.js +17 -0
- package/dist/cjs/dimensional-model/data-model.d.ts +13 -0
- package/dist/cjs/dimensional-model/data-model.js +37 -0
- package/dist/cjs/dimensional-model/dimensions.d.ts +167 -0
- package/dist/cjs/dimensional-model/dimensions.js +307 -0
- package/dist/cjs/dimensional-model/dimensions.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/dimensions.test.js +54 -0
- package/dist/cjs/dimensional-model/factory.d.ts +17 -0
- package/dist/cjs/dimensional-model/factory.js +54 -0
- package/dist/cjs/dimensional-model/filters/factory.d.ts +796 -0
- package/dist/cjs/dimensional-model/filters/factory.js +962 -0
- package/dist/cjs/dimensional-model/filters/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/factory.test.js +366 -0
- package/dist/cjs/dimensional-model/filters/filters.d.ts +321 -0
- package/dist/cjs/dimensional-model/filters/filters.js +614 -0
- package/dist/cjs/dimensional-model/filters/filters.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/filters.test.js +225 -0
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.d.ts +47 -0
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +111 -0
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.d.ts +21 -0
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +194 -0
- package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.d.ts +2 -0
- package/dist/cjs/dimensional-model/filters/utils/date-time-filter-util.js +12 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +13 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +54 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.js +32 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +73 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +190 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.js +558 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.js +174 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.js +236 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.d.ts +17 -0
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +79 -0
- package/dist/cjs/dimensional-model/filters/utils/types.d.ts +200 -0
- package/dist/cjs/dimensional-model/filters/utils/types.js +99 -0
- package/dist/cjs/dimensional-model/interfaces.d.ts +512 -0
- package/dist/cjs/dimensional-model/interfaces.js +31 -0
- package/dist/cjs/dimensional-model/measures/factory.d.ts +920 -0
- package/dist/cjs/dimensional-model/measures/factory.js +1188 -0
- package/dist/cjs/dimensional-model/measures/factory.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/measures/factory.test.js +481 -0
- package/dist/cjs/dimensional-model/measures/measures.d.ts +217 -0
- package/dist/cjs/dimensional-model/measures/measures.js +416 -0
- package/dist/cjs/dimensional-model/measures/measures.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/measures/measures.test.js +79 -0
- package/dist/cjs/dimensional-model/simple-column-types.d.ts +39 -0
- package/dist/cjs/dimensional-model/simple-column-types.js +134 -0
- package/dist/cjs/dimensional-model/simple-column-types.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/simple-column-types.test.js +85 -0
- package/dist/cjs/dimensional-model/types.d.ts +256 -0
- package/dist/cjs/dimensional-model/types.js +298 -0
- package/dist/cjs/dimensional-model/types.test.d.ts +1 -0
- package/dist/cjs/dimensional-model/types.test.js +33 -0
- package/dist/cjs/index.d.ts +93 -0
- package/dist/cjs/index.js +123 -0
- package/dist/cjs/interfaces.d.ts +367 -0
- package/dist/cjs/interfaces.js +21 -0
- package/dist/cjs/translation/initialize-i18n.d.ts +2 -0
- package/dist/cjs/translation/initialize-i18n.js +14 -0
- package/dist/cjs/translation/resources/en.d.ts +28 -0
- package/dist/cjs/translation/resources/en.js +30 -0
- package/dist/cjs/translation/resources/index.d.ts +53 -0
- package/dist/cjs/translation/resources/index.js +10 -0
- package/dist/cjs/translation/resources/uk.d.ts +5 -0
- package/dist/cjs/translation/resources/uk.js +30 -0
- package/dist/cjs/translation/translatable-error.d.ts +5 -0
- package/dist/cjs/translation/translatable-error.js +15 -0
- package/dist/cjs/utils.d.ts +37 -0
- package/dist/cjs/utils.js +105 -0
- package/dist/cjs/utils.test.d.ts +1 -0
- package/dist/cjs/utils.test.js +158 -0
- package/dist/dimensional-model/attributes.d.ts +1 -0
- package/dist/dimensional-model/attributes.js +31 -0
- package/dist/dimensional-model/filters/factory.d.ts +80 -42
- package/dist/dimensional-model/filters/factory.js +123 -85
- package/dist/dimensional-model/filters/filters.d.ts +40 -12
- package/dist/dimensional-model/filters/filters.js +75 -24
- package/dist/dimensional-model/filters/utils/attribute-measure-util.d.ts +2 -2
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +6 -3
- package/dist/dimensional-model/filters/utils/condition-filter-util.d.ts +4 -2
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +34 -31
- package/dist/dimensional-model/filters/utils/filter-code-util.js +1 -1
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.d.ts +16 -10
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +34 -27
- package/dist/dimensional-model/filters/utils/filter-matcher-utils.d.ts +5 -0
- package/dist/dimensional-model/filters/utils/filter-matcher-utils.js +170 -0
- package/dist/dimensional-model/filters/utils/filter-types-util.d.ts +3 -1
- package/dist/dimensional-model/filters/utils/filter-types-util.js +2 -2
- package/dist/dimensional-model/filters/utils/types.d.ts +1 -1
- package/dist/dimensional-model/interfaces.d.ts +6 -0
- package/dist/dimensional-model/types.d.ts +9 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +18 -9
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
const measures_js_1 = require("./measures.js");
|
|
7
|
+
const attributes_js_1 = require("../attributes.js");
|
|
8
|
+
const types_js_1 = require("../types.js");
|
|
9
|
+
describe('Measures jaql preparations', () => {
|
|
10
|
+
it('must prepare simple measure jaql', () => {
|
|
11
|
+
const result = {
|
|
12
|
+
jaql: { title: 'Cost', agg: 'sum', dim: '[Commerce.Cost]', datatype: 'numeric' },
|
|
13
|
+
};
|
|
14
|
+
const measure = new measures_js_1.DimensionalBaseMeasure('Cost', new attributes_js_1.DimensionalAttribute('[Commerce.Cost]', '[Commerce.Cost]', 'numeric-attribute'), 'sum');
|
|
15
|
+
const jaql = measure.jaql();
|
|
16
|
+
expect(jaql).toStrictEqual(result);
|
|
17
|
+
});
|
|
18
|
+
it('must prepare constant as jaql', () => {
|
|
19
|
+
const result = {
|
|
20
|
+
jaql: {
|
|
21
|
+
title: '0',
|
|
22
|
+
formula: '0',
|
|
23
|
+
context: {},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const measure = new measures_js_1.DimensionalCalculatedMeasure('0', '0', {});
|
|
27
|
+
const jaql = measure.jaql();
|
|
28
|
+
expect(jaql).toStrictEqual(result);
|
|
29
|
+
});
|
|
30
|
+
it('must prepare calculated measure jaql', () => {
|
|
31
|
+
const result = {
|
|
32
|
+
jaql: {
|
|
33
|
+
title: 'sum([Cost] + [Total Revenue])',
|
|
34
|
+
formula: 'sum([M1] + [M2])',
|
|
35
|
+
context: {
|
|
36
|
+
'[M1]': { title: 'Revenue', agg: 'sum', dim: '[Commerce.Revenue]', datatype: 'numeric' },
|
|
37
|
+
'[M2]': { title: 'Cost', agg: 'sum', dim: '[Commerce.Cost]', datatype: 'numeric' },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const measure = new measures_js_1.DimensionalCalculatedMeasure('sum([Cost] + [Total Revenue])', 'sum([M1] + [M2])', {
|
|
42
|
+
'[M1]': new measures_js_1.DimensionalBaseMeasure('Revenue', new attributes_js_1.DimensionalAttribute('[Commerce.Revenue]', '[Commerce.Revenue]', 'numeric-attribute'), 'sum'),
|
|
43
|
+
'[M2]': new measures_js_1.DimensionalBaseMeasure('Cost', new attributes_js_1.DimensionalAttribute('[Commerce.Cost]', '[Commerce.Cost]', 'numeric-attribute'), 'sum'),
|
|
44
|
+
});
|
|
45
|
+
const jaql = measure.jaql();
|
|
46
|
+
expect(jaql).toStrictEqual(result);
|
|
47
|
+
});
|
|
48
|
+
it('must prepare template measure jaql', () => {
|
|
49
|
+
const result = {
|
|
50
|
+
jaql: { title: 'sum CommerceCost', agg: 'sum', dim: '[Commerce.Cost]', datatype: 'numeric' },
|
|
51
|
+
};
|
|
52
|
+
const measure = new measures_js_1.DimensionalMeasureTemplate('Count', new attributes_js_1.DimensionalAttribute('[Commerce.Cost]', '[Commerce.Cost]', 'numeric-attribute'));
|
|
53
|
+
const jaql = measure.jaql();
|
|
54
|
+
expect(jaql).toStrictEqual(result);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('Measures aggregation transformations', () => {
|
|
58
|
+
const aggregationTypesMapping = {
|
|
59
|
+
[types_js_1.AggregationTypes.Sum]: 'sum',
|
|
60
|
+
[types_js_1.AggregationTypes.Average]: 'avg',
|
|
61
|
+
[types_js_1.AggregationTypes.Min]: 'min',
|
|
62
|
+
[types_js_1.AggregationTypes.Max]: 'max',
|
|
63
|
+
[types_js_1.AggregationTypes.Count]: 'countduplicates',
|
|
64
|
+
[types_js_1.AggregationTypes.CountDistinct]: 'count',
|
|
65
|
+
[types_js_1.AggregationTypes.Median]: 'median',
|
|
66
|
+
[types_js_1.AggregationTypes.Variance]: 'var',
|
|
67
|
+
[types_js_1.AggregationTypes.StandardDeviation]: 'stdev',
|
|
68
|
+
};
|
|
69
|
+
it('should correctly extract aggregation from jaql', () => {
|
|
70
|
+
Object.entries(aggregationTypesMapping).forEach(([aggType, jaqlAggType]) => {
|
|
71
|
+
expect(measures_js_1.DimensionalBaseMeasure.aggregationFromJAQL(jaqlAggType)).toEqual(aggType);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
it('should correctly convert aggregation to jaql aggregation type', () => {
|
|
75
|
+
Object.entries(aggregationTypesMapping).forEach(([aggType, jaqlAggType]) => {
|
|
76
|
+
expect(measures_js_1.DimensionalBaseMeasure.aggregationToJAQL(aggType)).toEqual(jaqlAggType);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param type
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const isInteger: (type: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* @param type
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const isDecimal: (type: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @param type
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const isNumber: (type: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @param type
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const isText: (type: string) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @param type
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const isDatetime: (type: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @param type
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare const isBoolean: (type: string) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare type SimpleColumnType = 'number' | 'text' | 'datetime' | 'boolean';
|
|
35
|
+
/**
|
|
36
|
+
* @param type
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const simpleColumnType: (type: string) => SimpleColumnType;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simpleColumnType = exports.isBoolean = exports.isDatetime = exports.isText = exports.isNumber = exports.isDecimal = exports.isInteger = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @param type
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
const isInteger = (type) => {
|
|
9
|
+
return [
|
|
10
|
+
'__int4',
|
|
11
|
+
'__int8',
|
|
12
|
+
'int',
|
|
13
|
+
'tinyint',
|
|
14
|
+
'bigint',
|
|
15
|
+
'int2',
|
|
16
|
+
'int4',
|
|
17
|
+
'int8',
|
|
18
|
+
'smallint',
|
|
19
|
+
'mediumint',
|
|
20
|
+
'serial',
|
|
21
|
+
'integer',
|
|
22
|
+
'byteint',
|
|
23
|
+
'int64',
|
|
24
|
+
].includes(type.toLowerCase());
|
|
25
|
+
};
|
|
26
|
+
exports.isInteger = isInteger;
|
|
27
|
+
/**
|
|
28
|
+
* @param type
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
const isDecimal = (type) => {
|
|
32
|
+
return [
|
|
33
|
+
'basemeasure',
|
|
34
|
+
'calculatedmeasure',
|
|
35
|
+
'float',
|
|
36
|
+
'float4',
|
|
37
|
+
'float8',
|
|
38
|
+
'double precision',
|
|
39
|
+
'double',
|
|
40
|
+
'numeric',
|
|
41
|
+
'decimal',
|
|
42
|
+
'real',
|
|
43
|
+
'number',
|
|
44
|
+
'float64',
|
|
45
|
+
].includes(type.toLowerCase());
|
|
46
|
+
};
|
|
47
|
+
exports.isDecimal = isDecimal;
|
|
48
|
+
/**
|
|
49
|
+
* @param type
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
const isNumber = (type) => {
|
|
53
|
+
return (0, exports.isInteger)(type) || (0, exports.isDecimal)(type) || type === 'numeric-attribute';
|
|
54
|
+
};
|
|
55
|
+
exports.isNumber = isNumber;
|
|
56
|
+
/**
|
|
57
|
+
* @param type
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
const isText = (type) => {
|
|
61
|
+
return [
|
|
62
|
+
'textdimension',
|
|
63
|
+
'string',
|
|
64
|
+
'varchar',
|
|
65
|
+
'text',
|
|
66
|
+
'ntext',
|
|
67
|
+
'char',
|
|
68
|
+
'character',
|
|
69
|
+
'character varying',
|
|
70
|
+
'smalltext',
|
|
71
|
+
'nchar',
|
|
72
|
+
'nvarchar',
|
|
73
|
+
'json',
|
|
74
|
+
'jsonb',
|
|
75
|
+
'object',
|
|
76
|
+
'text-attribute',
|
|
77
|
+
].includes(type.toLowerCase());
|
|
78
|
+
};
|
|
79
|
+
exports.isText = isText;
|
|
80
|
+
/**
|
|
81
|
+
* @param type
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
const isDatetime = (type) => {
|
|
85
|
+
return [
|
|
86
|
+
'datelevel',
|
|
87
|
+
'date',
|
|
88
|
+
'time',
|
|
89
|
+
'datetime',
|
|
90
|
+
'timestamp without time zone',
|
|
91
|
+
'timestamp',
|
|
92
|
+
'timestamp with time zone',
|
|
93
|
+
'timestamp(6)',
|
|
94
|
+
'timestamp_tz',
|
|
95
|
+
'timestamp_ntz',
|
|
96
|
+
'timestamp_ltz',
|
|
97
|
+
'timestampltz',
|
|
98
|
+
'timestampntz',
|
|
99
|
+
'timestamptz',
|
|
100
|
+
'datetime64[ns]',
|
|
101
|
+
'timewithtimezone',
|
|
102
|
+
'timestampwithtimezone',
|
|
103
|
+
'timestamp_with_timezone',
|
|
104
|
+
].includes(type.toLowerCase());
|
|
105
|
+
};
|
|
106
|
+
exports.isDatetime = isDatetime;
|
|
107
|
+
/**
|
|
108
|
+
* @param type
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
const isBoolean = (type) => {
|
|
112
|
+
return ['bool', 'boolean', 'bit', 'logical'].includes(type.toLowerCase());
|
|
113
|
+
};
|
|
114
|
+
exports.isBoolean = isBoolean;
|
|
115
|
+
/**
|
|
116
|
+
* @param type
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
const simpleColumnType = (type) => {
|
|
120
|
+
if ((0, exports.isNumber)(type)) {
|
|
121
|
+
return 'number';
|
|
122
|
+
}
|
|
123
|
+
if ((0, exports.isDatetime)(type)) {
|
|
124
|
+
return 'datetime';
|
|
125
|
+
}
|
|
126
|
+
if ((0, exports.isText)(type)) {
|
|
127
|
+
return 'text';
|
|
128
|
+
}
|
|
129
|
+
if ((0, exports.isBoolean)(type)) {
|
|
130
|
+
return 'boolean';
|
|
131
|
+
}
|
|
132
|
+
return 'text';
|
|
133
|
+
};
|
|
134
|
+
exports.simpleColumnType = simpleColumnType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const simple_column_types_js_1 = require("./simple-column-types.js");
|
|
4
|
+
const typeMap = {
|
|
5
|
+
number: [
|
|
6
|
+
// INTEGER
|
|
7
|
+
'__int4',
|
|
8
|
+
'__int8',
|
|
9
|
+
'int',
|
|
10
|
+
'tinyint',
|
|
11
|
+
'bigint',
|
|
12
|
+
'int2',
|
|
13
|
+
'int4',
|
|
14
|
+
'int8',
|
|
15
|
+
'smallint',
|
|
16
|
+
'mediumint',
|
|
17
|
+
'serial',
|
|
18
|
+
'integer',
|
|
19
|
+
'byteint',
|
|
20
|
+
'int64',
|
|
21
|
+
// DECIMAL
|
|
22
|
+
'basemeasure',
|
|
23
|
+
'calculatedmeasure',
|
|
24
|
+
'float',
|
|
25
|
+
'float4',
|
|
26
|
+
'float8',
|
|
27
|
+
'double precision',
|
|
28
|
+
'double',
|
|
29
|
+
'numeric',
|
|
30
|
+
'decimal',
|
|
31
|
+
'real',
|
|
32
|
+
'number',
|
|
33
|
+
'float64',
|
|
34
|
+
// OTHER
|
|
35
|
+
'numeric-attribute',
|
|
36
|
+
],
|
|
37
|
+
text: [
|
|
38
|
+
'textdimension',
|
|
39
|
+
'string',
|
|
40
|
+
'varchar',
|
|
41
|
+
'text',
|
|
42
|
+
'ntext',
|
|
43
|
+
'char',
|
|
44
|
+
'character',
|
|
45
|
+
'character varying',
|
|
46
|
+
'smalltext',
|
|
47
|
+
'nchar',
|
|
48
|
+
'nvarchar',
|
|
49
|
+
'json',
|
|
50
|
+
'jsonb',
|
|
51
|
+
'object',
|
|
52
|
+
'text-attribute',
|
|
53
|
+
'RANDOM_TEXT',
|
|
54
|
+
],
|
|
55
|
+
datetime: [
|
|
56
|
+
'datelevel',
|
|
57
|
+
'date',
|
|
58
|
+
'time',
|
|
59
|
+
'datetime',
|
|
60
|
+
'timestamp without time zone',
|
|
61
|
+
'timestamp',
|
|
62
|
+
'timestamp with time zone',
|
|
63
|
+
'timestamp(6)',
|
|
64
|
+
'timestamp_tz',
|
|
65
|
+
'timestamp_ntz',
|
|
66
|
+
'timestamp_ltz',
|
|
67
|
+
'timestampltz',
|
|
68
|
+
'timestampntz',
|
|
69
|
+
'timestamptz',
|
|
70
|
+
'datetime64[ns]',
|
|
71
|
+
'timewithtimezone',
|
|
72
|
+
'timestampwithtimezone',
|
|
73
|
+
'timestamp_with_timezone',
|
|
74
|
+
],
|
|
75
|
+
boolean: ['bool', 'boolean', 'bit', 'logical'],
|
|
76
|
+
};
|
|
77
|
+
describe('simpleColumnType', () => {
|
|
78
|
+
it('should return correct type', () => {
|
|
79
|
+
Object.entries(typeMap).forEach(([outputType, inputTypes]) => {
|
|
80
|
+
inputTypes.forEach((inputType) => {
|
|
81
|
+
expect((0, simple_column_types_js_1.simpleColumnType)(inputType)).toBe(outputType);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { type ConditionFilterJaql } from './filters/utils/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Different aggregation types
|
|
4
|
+
*/
|
|
5
|
+
export declare const AggregationTypes: {
|
|
6
|
+
/** Sum aggregation type */
|
|
7
|
+
Sum: string;
|
|
8
|
+
/** Average aggregation type */
|
|
9
|
+
Average: string;
|
|
10
|
+
/** Min aggregation type */
|
|
11
|
+
Min: string;
|
|
12
|
+
/** Max aggregation type */
|
|
13
|
+
Max: string;
|
|
14
|
+
/** Count aggregation type */
|
|
15
|
+
Count: string;
|
|
16
|
+
/** Count distinct aggregation type */
|
|
17
|
+
CountDistinct: string;
|
|
18
|
+
/** Median aggregation type */
|
|
19
|
+
Median: string;
|
|
20
|
+
/** Variance aggregation type */
|
|
21
|
+
Variance: string;
|
|
22
|
+
/** Standard deviation aggregation type */
|
|
23
|
+
StandardDeviation: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Different sort types.
|
|
27
|
+
*/
|
|
28
|
+
export declare enum Sort {
|
|
29
|
+
/** No sort definition */
|
|
30
|
+
None = 0,
|
|
31
|
+
/** Sort Ascending */
|
|
32
|
+
Ascending = 1,
|
|
33
|
+
/** Sort Descending */
|
|
34
|
+
Descending = 2
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Different metadata types
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare const MetadataTypes: {
|
|
42
|
+
Measure: string;
|
|
43
|
+
MeasureTemplate: string;
|
|
44
|
+
BaseMeasure: string;
|
|
45
|
+
CalculatedMeasure: string;
|
|
46
|
+
Dimension: string;
|
|
47
|
+
DateDimension: string;
|
|
48
|
+
TextDimension: string;
|
|
49
|
+
NumericDimension: string;
|
|
50
|
+
DateLevel: string;
|
|
51
|
+
Attribute: string;
|
|
52
|
+
TextAttribute: string;
|
|
53
|
+
NumericAttribute: string;
|
|
54
|
+
Filter: string;
|
|
55
|
+
DimensionFilter: string;
|
|
56
|
+
MeasureFilter: string;
|
|
57
|
+
/**
|
|
58
|
+
* Checks whether the given object or type is a metadata element
|
|
59
|
+
*
|
|
60
|
+
* @param o - object to check
|
|
61
|
+
* @returns true if the object or type is a metadata element
|
|
62
|
+
*/
|
|
63
|
+
isMetadata(o: any): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether the given object or type is a measure template
|
|
66
|
+
*
|
|
67
|
+
* @param o - object to check
|
|
68
|
+
* @returns true if the object or type is a measure template
|
|
69
|
+
*/
|
|
70
|
+
isMeasureTemplate(o: any): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Checks whether the given object or type is a base measure
|
|
73
|
+
*
|
|
74
|
+
* @param o - object to check
|
|
75
|
+
* @returns true if the object or type is a base measure
|
|
76
|
+
*/
|
|
77
|
+
isBaseMeasure(o: any): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Checks whether the given object or type is a measure - of any type
|
|
80
|
+
*
|
|
81
|
+
* @param o - object to check
|
|
82
|
+
* @returns true if the object or type is a measure - of any type
|
|
83
|
+
*/
|
|
84
|
+
isMeasure(o: any): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Checks whether the given object or type is a calculated measure
|
|
87
|
+
*
|
|
88
|
+
* @param o - object to check
|
|
89
|
+
* @returns true if the object or type is a calculated measure
|
|
90
|
+
*/
|
|
91
|
+
isCalculatedMeasure(o: any): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Checks whether the given object or type is a date dimension
|
|
94
|
+
*
|
|
95
|
+
* @param o - object to check
|
|
96
|
+
* @returns true if the object or type is a date dimension
|
|
97
|
+
*/
|
|
98
|
+
isDateDimension(o: any): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Checks whether the given object or type is a text dimension
|
|
101
|
+
*
|
|
102
|
+
* @param o - object to check
|
|
103
|
+
* @returns true if the object or type is a text dimension
|
|
104
|
+
*/
|
|
105
|
+
isTextDimension(o: any): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Checks whether the given object or type is a numeric dimension
|
|
108
|
+
*
|
|
109
|
+
* @param o - object to check
|
|
110
|
+
* @returns true if the object or type is a numeric dimension
|
|
111
|
+
*/
|
|
112
|
+
isNumericDimension(o: any): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Checks whether the given object or type is a dimension - of any type
|
|
115
|
+
*
|
|
116
|
+
* @param o - object to check
|
|
117
|
+
* @returns true if the object or type is a dimension - of any type
|
|
118
|
+
*/
|
|
119
|
+
isDimension(o: any): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Checks whether the given object or type is an attribute - of any type
|
|
122
|
+
*
|
|
123
|
+
* @param o - object to check
|
|
124
|
+
* @returns true if the object or type is an attribute - of any type
|
|
125
|
+
*/
|
|
126
|
+
isAttribute(o: any): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Checks whether the given object or type is a filter
|
|
129
|
+
*
|
|
130
|
+
* @param o - object to check
|
|
131
|
+
* @returns true if the object or type is a filter
|
|
132
|
+
*/
|
|
133
|
+
isFilter(o: any): boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Levels for {@link DateDimension}
|
|
137
|
+
*/
|
|
138
|
+
export declare const DateLevels: {
|
|
139
|
+
Years: string;
|
|
140
|
+
Quarters: string;
|
|
141
|
+
Months: string;
|
|
142
|
+
Weeks: string;
|
|
143
|
+
Days: string;
|
|
144
|
+
Hours: string;
|
|
145
|
+
MinutesRoundTo30: string;
|
|
146
|
+
MinutesRoundTo15: string;
|
|
147
|
+
AggHours: string;
|
|
148
|
+
AggMinutesRoundTo30: string;
|
|
149
|
+
AggMinutesRoundTo15: string;
|
|
150
|
+
AggMinutesRoundTo1: string;
|
|
151
|
+
/** @internal */
|
|
152
|
+
readonly all: string[];
|
|
153
|
+
};
|
|
154
|
+
/** @internal */
|
|
155
|
+
export declare enum DataType {
|
|
156
|
+
TEXT = "text",
|
|
157
|
+
NUMERIC = "numeric",
|
|
158
|
+
DATETIME = "datetime"
|
|
159
|
+
}
|
|
160
|
+
/** @internal */
|
|
161
|
+
export declare enum JaqlSortDirection {
|
|
162
|
+
ASC = "asc",
|
|
163
|
+
DESC = "desc"
|
|
164
|
+
}
|
|
165
|
+
/** @internal */
|
|
166
|
+
export declare type Jaql = BaseJaql | FormulaJaql | FilterJaql | PivotJaql;
|
|
167
|
+
/** @internal */
|
|
168
|
+
export declare type PivotJaql = (BaseJaql | FormulaJaql) & {
|
|
169
|
+
sortDetails?: {
|
|
170
|
+
dir: JaqlSortDirection;
|
|
171
|
+
field: number;
|
|
172
|
+
measurePath?: Record<string, string> | null;
|
|
173
|
+
};
|
|
174
|
+
subtotalAgg?: 'sum' | 'min' | 'max' | 'avg' | 'median';
|
|
175
|
+
};
|
|
176
|
+
/** @internal */
|
|
177
|
+
export declare type BaseJaql = {
|
|
178
|
+
agg?: string;
|
|
179
|
+
datatype: `${DataType}`;
|
|
180
|
+
dim: string;
|
|
181
|
+
table: string;
|
|
182
|
+
column: string;
|
|
183
|
+
title: string;
|
|
184
|
+
level?: 'years' | 'quarters' | 'months' | 'weeks' | 'minutes' | 'days';
|
|
185
|
+
sort?: `${JaqlSortDirection}`;
|
|
186
|
+
in?: {
|
|
187
|
+
selected?: {
|
|
188
|
+
jaql: FilterJaql;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
/** @internal */
|
|
193
|
+
export declare type FormulaID = string;
|
|
194
|
+
/** @internal */
|
|
195
|
+
export declare type FormulaContext = BaseJaql | FormulaJaql | FilterJaql;
|
|
196
|
+
/** @internal */
|
|
197
|
+
export declare type FormulaJaql = {
|
|
198
|
+
type?: 'measure';
|
|
199
|
+
sort?: JaqlSortDirection;
|
|
200
|
+
title: string;
|
|
201
|
+
formula: string;
|
|
202
|
+
context?: Record<FormulaID, FormulaContext>;
|
|
203
|
+
};
|
|
204
|
+
/** @internal */
|
|
205
|
+
export declare type BaseFilter = IncludeAllFilter | IncludeMembersFilter | ExcludeMembersFilter | JaqlNumericFilter | ConditionFilterJaql | AndFilter<JaqlNumericFilter | ConditionFilterJaql> | OrFilter<JaqlNumericFilter | ConditionFilterJaql>;
|
|
206
|
+
/** @internal */
|
|
207
|
+
export declare type BackgroundFilter = BaseFilter & {
|
|
208
|
+
level?: 'string';
|
|
209
|
+
};
|
|
210
|
+
/** @internal */
|
|
211
|
+
export declare type IncludeAllFilter = {
|
|
212
|
+
all: true;
|
|
213
|
+
};
|
|
214
|
+
/** @internal */
|
|
215
|
+
export declare type IncludeMembersFilter = {
|
|
216
|
+
members: string[];
|
|
217
|
+
};
|
|
218
|
+
/** @internal */
|
|
219
|
+
export declare type ExcludeMembersFilter = {
|
|
220
|
+
exclude: {
|
|
221
|
+
members: string[];
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
/** @internal */
|
|
225
|
+
export declare type TurnOffMembersFilter = ExcludeMembersFilter & {
|
|
226
|
+
turnedOff: boolean;
|
|
227
|
+
};
|
|
228
|
+
/** @internal */
|
|
229
|
+
export declare type FilterJaql = BaseJaql & {
|
|
230
|
+
filter: BaseFilter & {
|
|
231
|
+
filter?: BackgroundFilter | TurnOffMembersFilter;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
declare type NumericFilterValue = number | FormulaJaql;
|
|
235
|
+
/** @internal */
|
|
236
|
+
export declare type JaqlNumericFilter = {
|
|
237
|
+
equals?: NumericFilterValue;
|
|
238
|
+
doesntEqual?: NumericFilterValue;
|
|
239
|
+
toNotEqual?: NumericFilterValue;
|
|
240
|
+
to?: NumericFilterValue;
|
|
241
|
+
fromNotEqual?: NumericFilterValue;
|
|
242
|
+
from?: NumericFilterValue;
|
|
243
|
+
'='?: NumericFilterValue;
|
|
244
|
+
'<'?: NumericFilterValue;
|
|
245
|
+
'>'?: NumericFilterValue;
|
|
246
|
+
'>='?: NumericFilterValue;
|
|
247
|
+
'<='?: NumericFilterValue;
|
|
248
|
+
};
|
|
249
|
+
declare type AndFilter<FilterItem> = {
|
|
250
|
+
and: FilterItem[];
|
|
251
|
+
};
|
|
252
|
+
/** @internal */
|
|
253
|
+
export declare type OrFilter<FilterItem> = {
|
|
254
|
+
or: FilterItem[];
|
|
255
|
+
};
|
|
256
|
+
export {};
|