@sisense/sdk-data 1.34.0 → 2.1.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 (68) hide show
  1. package/dist/cjs/dimensional-model/analytics/factory.d.ts +10 -10
  2. package/dist/cjs/dimensional-model/analytics/factory.js +15 -16
  3. package/dist/cjs/dimensional-model/attributes.d.ts +4 -4
  4. package/dist/cjs/dimensional-model/attributes.js +21 -7
  5. package/dist/cjs/dimensional-model/base.d.ts +3 -3
  6. package/dist/cjs/dimensional-model/base.js +7 -4
  7. package/dist/cjs/dimensional-model/compose-code-utils.d.ts +41 -0
  8. package/dist/cjs/dimensional-model/compose-code-utils.js +127 -0
  9. package/dist/cjs/dimensional-model/consts.d.ts +1 -0
  10. package/dist/cjs/dimensional-model/consts.js +4 -0
  11. package/dist/cjs/dimensional-model/dimensions/dimensions.d.ts +5 -5
  12. package/dist/cjs/dimensional-model/dimensions/dimensions.js +25 -16
  13. package/dist/cjs/dimensional-model/filters/factory.d.ts +41 -41
  14. package/dist/cjs/dimensional-model/filters/factory.js +53 -168
  15. package/dist/cjs/dimensional-model/filters/filter-relations.js +2 -5
  16. package/dist/cjs/dimensional-model/filters/filters.d.ts +39 -23
  17. package/dist/cjs/dimensional-model/filters/filters.js +102 -52
  18. package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +6 -14
  19. package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +28 -26
  20. package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +9 -15
  21. package/dist/cjs/dimensional-model/filters/utils/types.d.ts +10 -0
  22. package/dist/cjs/dimensional-model/interfaces.d.ts +9 -7
  23. package/dist/cjs/dimensional-model/jaql-element.d.ts +13 -1
  24. package/dist/cjs/dimensional-model/jaql-element.js +53 -1
  25. package/dist/cjs/dimensional-model/measures/factory.d.ts +45 -52
  26. package/dist/cjs/dimensional-model/measures/factory.js +55 -184
  27. package/dist/cjs/dimensional-model/measures/measures.d.ts +9 -9
  28. package/dist/cjs/dimensional-model/measures/measures.js +31 -29
  29. package/dist/cjs/dimensional-model/types.d.ts +25 -2
  30. package/dist/cjs/utils.d.ts +26 -19
  31. package/dist/cjs/utils.js +85 -41
  32. package/dist/dimensional-model/analytics/factory.d.ts +10 -10
  33. package/dist/dimensional-model/analytics/factory.js +15 -14
  34. package/dist/dimensional-model/attributes.d.ts +4 -4
  35. package/dist/dimensional-model/attributes.js +21 -7
  36. package/dist/dimensional-model/base.d.ts +3 -3
  37. package/dist/dimensional-model/base.js +7 -4
  38. package/dist/dimensional-model/compose-code-utils.d.ts +41 -0
  39. package/dist/dimensional-model/compose-code-utils.js +119 -0
  40. package/dist/dimensional-model/consts.d.ts +1 -0
  41. package/dist/dimensional-model/consts.js +1 -0
  42. package/dist/dimensional-model/dimensions/dimensions.d.ts +5 -5
  43. package/dist/dimensional-model/dimensions/dimensions.js +26 -17
  44. package/dist/dimensional-model/filters/factory.d.ts +41 -41
  45. package/dist/dimensional-model/filters/factory.js +51 -125
  46. package/dist/dimensional-model/filters/filter-relations.js +3 -6
  47. package/dist/dimensional-model/filters/filters.d.ts +39 -23
  48. package/dist/dimensional-model/filters/filters.js +102 -52
  49. package/dist/dimensional-model/filters/utils/attribute-measure-util.js +6 -14
  50. package/dist/dimensional-model/filters/utils/condition-filter-util.js +28 -26
  51. package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +9 -15
  52. package/dist/dimensional-model/filters/utils/types.d.ts +10 -0
  53. package/dist/dimensional-model/interfaces.d.ts +9 -7
  54. package/dist/dimensional-model/jaql-element.d.ts +13 -1
  55. package/dist/dimensional-model/jaql-element.js +52 -1
  56. package/dist/dimensional-model/measures/factory.d.ts +45 -52
  57. package/dist/dimensional-model/measures/factory.js +54 -141
  58. package/dist/dimensional-model/measures/measures.d.ts +9 -9
  59. package/dist/dimensional-model/measures/measures.js +31 -29
  60. package/dist/dimensional-model/types.d.ts +25 -2
  61. package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
  62. package/dist/utils.d.ts +26 -19
  63. package/dist/utils.js +63 -44
  64. package/package.json +3 -3
  65. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.d.ts +0 -17
  66. package/dist/cjs/dimensional-model/filters/utils/filter-code-util.js +0 -82
  67. package/dist/dimensional-model/filters/utils/filter-code-util.d.ts +0 -17
  68. package/dist/dimensional-model/filters/utils/filter-code-util.js +0 -77
@@ -1,6 +1,6 @@
1
1
  import { DimensionalElement } from './base.js';
2
2
  import { Attribute, LevelAttribute } from './interfaces.js';
3
- import { DateLevel, JaqlDataSource, Sort } from './types.js';
3
+ import { DateLevel, JaqlDataSource, JSONObject, Sort } from './types.js';
4
4
  /**
5
5
  * @internal
6
6
  */
@@ -39,7 +39,7 @@ export declare class DimensionalAttribute extends DimensionalElement implements
39
39
  /**
40
40
  * Gets a serializable representation of the element
41
41
  */
42
- serializable(): any;
42
+ serialize(): JSONObject;
43
43
  }
44
44
  /**
45
45
  * @internal
@@ -48,7 +48,7 @@ export declare class DimensionalLevelAttribute extends DimensionalAttribute impl
48
48
  private _format;
49
49
  readonly granularity: string;
50
50
  readonly panel: string;
51
- constructor(l: string, expression: string, granularity: string, format?: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string);
51
+ constructor(name: string, expression: string, granularity: string, format?: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, panel?: string);
52
52
  /**
53
53
  * gets the element's ID
54
54
  */
@@ -89,7 +89,7 @@ export declare class DimensionalLevelAttribute extends DimensionalAttribute impl
89
89
  /**
90
90
  * Gets a serializable representation of the element
91
91
  */
92
- serializable(): any;
92
+ serialize(): JSONObject;
93
93
  /**
94
94
  * Gets the JAQL representation of this instance
95
95
  *
@@ -4,7 +4,9 @@
4
4
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
5
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
6
6
  /* eslint-disable sonarjs/no-nested-switch */
7
+ import { parseExpression } from '../utils.js';
7
8
  import { DimensionalElement, normalizeName } from './base.js';
9
+ import { DATA_MODEL_MODULE_NAME } from './consts.js';
8
10
  import { simpleColumnType } from './simple-column-types.js';
9
11
  import { DateLevels, MetadataTypes, Sort } from './types.js';
10
12
  /**
@@ -19,6 +21,11 @@ export class DimensionalAttribute extends DimensionalElement {
19
21
  super(name, type || MetadataTypes.Attribute, desc, dataSource, composeCode);
20
22
  this._sort = Sort.None;
21
23
  this.expression = expression;
24
+ // if composeCode is not explicitly set by the caller, extract it from expression
25
+ if (!composeCode && expression) {
26
+ const { table, column } = parseExpression(expression);
27
+ this.composeCode = normalizeAttributeName(table, column, '', DATA_MODEL_MODULE_NAME);
28
+ }
22
29
  // panel is not needed in most cases, this is to support break by columns functionality
23
30
  if (panel === 'columns') {
24
31
  this.panel = panel;
@@ -72,11 +79,12 @@ export class DimensionalAttribute extends DimensionalElement {
72
79
  /**
73
80
  * Gets a serializable representation of the element
74
81
  */
75
- serializable() {
76
- const result = super.serializable();
82
+ serialize() {
83
+ const result = super.serialize();
84
+ result.__serializable = 'DimensionalAttribute';
77
85
  result.expression = this.expression;
78
86
  if (this.getSort() !== Sort.None) {
79
- result.sort = this.getSort().toString();
87
+ result.sort = this.getSort();
80
88
  }
81
89
  return result;
82
90
  }
@@ -85,10 +93,15 @@ export class DimensionalAttribute extends DimensionalElement {
85
93
  * @internal
86
94
  */
87
95
  export class DimensionalLevelAttribute extends DimensionalAttribute {
88
- constructor(l, expression, granularity, format, desc, sort, dataSource, composeCode, panel) {
89
- super(l, expression, MetadataTypes.DateLevel, desc, sort, dataSource, composeCode);
96
+ constructor(name, expression, granularity, format, desc, sort, dataSource, composeCode, panel) {
97
+ super(name, expression, MetadataTypes.DateLevel, desc, sort, dataSource, composeCode);
90
98
  this._format = format;
91
99
  this.granularity = granularity;
100
+ // if composeCode is not explicitly set by the caller, extract it from expression and granularity
101
+ if (!composeCode && expression) {
102
+ const { table, column } = parseExpression(expression);
103
+ this.composeCode = normalizeAttributeName(table, column, granularity, DATA_MODEL_MODULE_NAME);
104
+ }
92
105
  // panel is not needed in most cases, this is to support break by columns functionality
93
106
  if (panel === 'columns') {
94
107
  this.panel = panel;
@@ -152,8 +165,9 @@ export class DimensionalLevelAttribute extends DimensionalAttribute {
152
165
  /**
153
166
  * Gets a serializable representation of the element
154
167
  */
155
- serializable() {
156
- const result = super.serializable();
168
+ serialize() {
169
+ const result = super.serialize();
170
+ result.__serializable = 'DimensionalLevelAttribute';
157
171
  result.granularity = this.granularity;
158
172
  if (this.getFormat() !== undefined) {
159
173
  result.format = this.getFormat();
@@ -1,5 +1,5 @@
1
1
  import { Element } from './interfaces.js';
2
- import { JaqlDataSource } from './types.js';
2
+ import { JaqlDataSource, JSONObject } from './types.js';
3
3
  /**
4
4
  * @internal
5
5
  */
@@ -43,8 +43,8 @@ export declare abstract class DimensionalElement implements Element {
43
43
  /**
44
44
  * Gets a serializable representation of the element
45
45
  */
46
- serializable(): any;
47
- toJSON(): any;
46
+ serialize(): JSONObject;
47
+ toJSON(): JSONObject;
48
48
  abstract jaql(nested?: boolean): any;
49
49
  /**
50
50
  * Gets a string representation of the element
@@ -9,7 +9,9 @@ export class DimensionalElement {
9
9
  if (dataSource) {
10
10
  this._dataSource = dataSource;
11
11
  }
12
- this.composeCode = composeCode;
12
+ if (composeCode) {
13
+ this.composeCode = composeCode;
14
+ }
13
15
  }
14
16
  /**
15
17
  * Defines the element's name
@@ -29,17 +31,18 @@ export class DimensionalElement {
29
31
  /**
30
32
  * Gets a serializable representation of the element
31
33
  */
32
- serializable() {
34
+ serialize() {
33
35
  return {
34
36
  name: this.name,
35
37
  type: this.type,
36
- desc: this.description,
38
+ description: this.description,
37
39
  dataSource: this.dataSource,
40
+ composeCode: this.composeCode,
38
41
  __serializable: 'DimensionalElement',
39
42
  };
40
43
  }
41
44
  toJSON() {
42
- return this.serializable();
45
+ return this.serialize();
43
46
  }
44
47
  /**
45
48
  * Gets a string representation of the element
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Stringifies the argument, with an option to exclude specific properties from objects without a 'composeCode'.
3
+ * Keys with spaces in objects will be enclosed in single quotes.
4
+ *
5
+ * @param arg - The argument to stringify.
6
+ * @param excludeProps - Optional array of property names to exclude when stringifying objects (that don't have 'composeCode').
7
+ * @returns The stringified representation of the argument.
8
+ */
9
+ export declare function stringifyHelper(arg: any, excludeProps?: string[]): string;
10
+ /**
11
+ * High order function to construct compose code for filter factory functions
12
+ *
13
+ * @param func - filter factory function
14
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
15
+ * @returns filter factory function with composeCode property added to the filter
16
+ */
17
+ export declare function withComposeCodeForFilter<T extends (...args: any[]) => any>(func: T, funcName?: string): T;
18
+ /**
19
+ * High order function to construct compose code for filter relations factory functions
20
+ *
21
+ * @param func - filter factory function
22
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
23
+ * @returns filter factory function with composeCode property added to the filter
24
+ */
25
+ export declare function withComposeCodeForFilterRelations<T extends (...args: any[]) => any>(func: T, funcName?: string): T;
26
+ /**
27
+ * High order function to construct compose code for analytics factory functions
28
+ *
29
+ * @param func - analytics factory function
30
+ * @param funcName - name of the analytics factory function. Needed if the function name is minified.
31
+ * @returns analytics factory function with composeCode property added to the analytics
32
+ */
33
+ export declare function withComposeCodeForAnalytics<T extends (...args: any[]) => any>(func: T, funcName?: string): T;
34
+ /**
35
+ * High order function to construct compose code for measure factory functions
36
+ *
37
+ * @param func - measure factory function
38
+ * @param funcName - name of the measure factory function. Needed if the function name is minified.
39
+ * @returns measure factory function with composeCode property added to the measure
40
+ */
41
+ export declare function withComposeCodeForMeasure<T extends (...args: any[]) => any>(func: T, funcName?: string): T;
@@ -0,0 +1,119 @@
1
+ import { escapeSingleQuotes } from '@sisense/sdk-common';
2
+ /**
3
+ * Stringifies the argument, with an option to exclude specific properties from objects without a 'composeCode'.
4
+ * Keys with spaces in objects will be enclosed in single quotes.
5
+ *
6
+ * @param arg - The argument to stringify.
7
+ * @param excludeProps - Optional array of property names to exclude when stringifying objects (that don't have 'composeCode').
8
+ * @returns The stringified representation of the argument.
9
+ */
10
+ export function stringifyHelper(arg, excludeProps = []) {
11
+ try {
12
+ if (arg === null || arg === undefined) {
13
+ return String(arg);
14
+ }
15
+ if (typeof arg === 'string') {
16
+ return `'${escapeSingleQuotes(arg)}'`;
17
+ }
18
+ if (typeof arg === 'number' || typeof arg === 'boolean') {
19
+ return String(arg);
20
+ }
21
+ if (arg instanceof Date) {
22
+ return `new Date('${arg.toISOString()}')`;
23
+ }
24
+ if (Array.isArray(arg)) {
25
+ return `[${arg.map((item) => stringifyHelper(item, excludeProps)).join(', ')}]`;
26
+ }
27
+ if (typeof arg === 'object' && arg !== null) {
28
+ if ('composeCode' in arg) {
29
+ return arg.composeCode;
30
+ }
31
+ const entries = Object.entries(arg)
32
+ .filter(([key]) => !excludeProps.includes(key))
33
+ .map(([key, value]) => {
34
+ const formattedKey = /[^a-zA-Z0-9_$]/.test(key) ? `'${key}'` : key;
35
+ return `${formattedKey}: ${stringifyHelper(value, excludeProps)}`;
36
+ });
37
+ return `{ ${entries.join(', ')} }`;
38
+ }
39
+ // Fallback for anything else
40
+ return JSON.stringify(arg);
41
+ }
42
+ catch (e) {
43
+ console.error(e, JSON.stringify(arg, null, 2));
44
+ return JSON.stringify(arg);
45
+ }
46
+ }
47
+ function trimTrailingUndefined(args) {
48
+ let i = args.length;
49
+ while (i > 0 && args[i - 1] === undefined) {
50
+ i--;
51
+ }
52
+ return args.slice(0, i);
53
+ }
54
+ /**
55
+ * Generic high order function to construct compose code for factory functions
56
+ *
57
+ * @param func - factory function
58
+ * @param factoryName - name of the factory (e.g. 'filterFactory', 'measureFactory')
59
+ * @param funcName - name of the factory function. Needed if the function name is minified.
60
+ * @returns factory function with composeCode property added
61
+ */
62
+ function withComposeCode(factoryName, funcName) {
63
+ return function (func) {
64
+ return function (...args) {
65
+ const trimmedArgs = trimTrailingUndefined(args);
66
+ const length = trimmedArgs.length;
67
+ const argValues = trimmedArgs
68
+ .map((arg) => stringifyHelper(arg, ['guid']))
69
+ // Remove trivial arg values from the end of the array
70
+ .filter((str, index) => !(['', '{ }', '[]', 'undefined', 'null'].includes(str) && index === length - 1))
71
+ .join(', ');
72
+ const signature = `${factoryName}.${funcName !== null && funcName !== void 0 ? funcName : func.name}(${argValues})`;
73
+ // Call the original function and get the result
74
+ const result = func(...args);
75
+ result.composeCode = signature; // Type assertion needed here
76
+ return result;
77
+ };
78
+ };
79
+ }
80
+ /**
81
+ * High order function to construct compose code for filter factory functions
82
+ *
83
+ * @param func - filter factory function
84
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
85
+ * @returns filter factory function with composeCode property added to the filter
86
+ */
87
+ export function withComposeCodeForFilter(func, funcName) {
88
+ return withComposeCode('filterFactory', funcName)(func);
89
+ }
90
+ /**
91
+ * High order function to construct compose code for filter relations factory functions
92
+ *
93
+ * @param func - filter factory function
94
+ * @param funcName - name of the filter factory function. Needed if the function name is minified.
95
+ * @returns filter factory function with composeCode property added to the filter
96
+ */
97
+ export function withComposeCodeForFilterRelations(func, funcName) {
98
+ return withComposeCode('filterFactory.logic', funcName)(func);
99
+ }
100
+ /**
101
+ * High order function to construct compose code for analytics factory functions
102
+ *
103
+ * @param func - analytics factory function
104
+ * @param funcName - name of the analytics factory function. Needed if the function name is minified.
105
+ * @returns analytics factory function with composeCode property added to the analytics
106
+ */
107
+ export function withComposeCodeForAnalytics(func, funcName) {
108
+ return withComposeCode('analyticsFactory', funcName)(func);
109
+ }
110
+ /**
111
+ * High order function to construct compose code for measure factory functions
112
+ *
113
+ * @param func - measure factory function
114
+ * @param funcName - name of the measure factory function. Needed if the function name is minified.
115
+ * @returns measure factory function with composeCode property added to the measure
116
+ */
117
+ export function withComposeCodeForMeasure(func, funcName) {
118
+ return withComposeCode('measureFactory', funcName)(func);
119
+ }
@@ -0,0 +1 @@
1
+ export declare const DATA_MODEL_MODULE_NAME = "DM";
@@ -0,0 +1 @@
1
+ export const DATA_MODEL_MODULE_NAME = 'DM';
@@ -1,6 +1,6 @@
1
1
  import { DimensionalElement } from '../base.js';
2
2
  import { Attribute, DateDimension, Dimension, LevelAttribute } from '../interfaces.js';
3
- import { JaqlDataSource, Sort } from '../types.js';
3
+ import { JaqlDataSource, JSONObject, Sort } from '../types.js';
4
4
  /**
5
5
  * Represents a Dimension in a Dimensional Model
6
6
  *
@@ -14,7 +14,7 @@ export declare class DimensionalDimension extends DimensionalElement implements
14
14
  protected _attributes: Attribute[];
15
15
  private _expression;
16
16
  protected _sort: Sort;
17
- constructor(name: string, expression: string, attributes: Attribute[], dimensions?: Dimension[], type?: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource);
17
+ constructor(name: string, expression: string, attributes: Attribute[], dimensions?: Dimension[], type?: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string, defaultAttribute?: Attribute);
18
18
  private getAttachedName;
19
19
  protected setDimensions(dimensions: Dimension[]): void;
20
20
  protected setAttributes(attributes: Attribute[]): void;
@@ -47,7 +47,7 @@ export declare class DimensionalDimension extends DimensionalElement implements
47
47
  /**
48
48
  * Gets a serializable representation of the element
49
49
  */
50
- serializable(): any;
50
+ serialize(): JSONObject;
51
51
  /**
52
52
  * Gets the JAQL representation of this instance
53
53
  *
@@ -61,7 +61,7 @@ export declare class DimensionalDimension extends DimensionalElement implements
61
61
  * @internal
62
62
  */
63
63
  export declare class DimensionalDateDimension extends DimensionalDimension implements DateDimension {
64
- constructor(name: string, expression: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource);
64
+ constructor(name: string, expression: string, desc?: string, sort?: Sort, dataSource?: JaqlDataSource, composeCode?: string);
65
65
  /**
66
66
  * Years level
67
67
  */
@@ -141,7 +141,7 @@ export declare class DimensionalDateDimension extends DimensionalDimension imple
141
141
  /**
142
142
  * Gets a serializable representation of the element
143
143
  */
144
- serializable(): any;
144
+ serialize(): JSONObject;
145
145
  /**
146
146
  * Gets the JAQL representation of this instance
147
147
  *
@@ -6,8 +6,10 @@
6
6
  /* eslint-disable sonarjs/no-duplicate-string */
7
7
  /* eslint-disable @typescript-eslint/no-unsafe-call */
8
8
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
9
- import { DimensionalAttribute, DimensionalLevelAttribute, jaqlSimpleColumnType, } from '../attributes.js';
9
+ import { parseExpression } from '../../utils.js';
10
+ import { DimensionalAttribute, DimensionalLevelAttribute, jaqlSimpleColumnType, normalizeAttributeName, } from '../attributes.js';
10
11
  import { DimensionalElement, normalizeName } from '../base.js';
12
+ import { DATA_MODEL_MODULE_NAME } from '../consts.js';
11
13
  import { DateLevels, MetadataTypes, Sort } from '../types.js';
12
14
  /**
13
15
  * Represents a Dimension in a Dimensional Model
@@ -15,15 +17,23 @@ import { DateLevels, MetadataTypes, Sort } from '../types.js';
15
17
  * @internal
16
18
  */
17
19
  export class DimensionalDimension extends DimensionalElement {
18
- constructor(name, expression, attributes, dimensions, type, desc, sort, dataSource) {
19
- super(name, type || MetadataTypes.Dimension, desc, dataSource);
20
+ constructor(name, expression, attributes, dimensions, type, desc, sort, dataSource, composeCode, defaultAttribute) {
21
+ super(name, type || MetadataTypes.Dimension, desc, dataSource, composeCode);
20
22
  this._dimensions = [];
21
23
  this._attributes = [];
22
24
  this._sort = Sort.None;
25
+ // if composeCode is not explicitly set by the caller, extract it from expression
26
+ if (!composeCode && expression) {
27
+ const { table, column } = parseExpression(expression);
28
+ this.composeCode = normalizeAttributeName(table, column, '', DATA_MODEL_MODULE_NAME);
29
+ }
23
30
  this._sort = sort || Sort.None;
24
31
  this._expression = expression;
25
32
  this.setDimensions(dimensions || []);
26
33
  this.setAttributes(attributes);
34
+ if (defaultAttribute) {
35
+ this.defaultAttribute = defaultAttribute;
36
+ }
27
37
  }
28
38
  static parseType(type) {
29
39
  switch (type) {
@@ -109,21 +119,22 @@ export class DimensionalDimension extends DimensionalElement {
109
119
  * @returns An instance representing the sorted {@link Dimension} of this instance
110
120
  */
111
121
  sort(sort) {
112
- return new DimensionalDimension(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, sort, this.dataSource);
122
+ return new DimensionalDimension(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, sort, this.dataSource, this.composeCode, this.defaultAttribute);
113
123
  }
114
124
  /**
115
125
  * Gets a serializable representation of the element
116
126
  */
117
- serializable() {
118
- const result = super.serializable();
127
+ serialize() {
128
+ const result = super.serialize();
129
+ result.__serializable = 'DimensionalDimension';
119
130
  result.expression = this.expression;
120
131
  if (this.getSort() !== undefined) {
121
132
  result.sort = this.getSort();
122
133
  }
123
- result.attributes = this._attributes.map((att) => att.serializable());
124
- result.diemsnions = this._dimensions.map((dim) => dim.serializable());
134
+ result.attributes = this._attributes.map((att) => att.serialize());
135
+ result.dimensions = this._dimensions.map((dim) => dim.serialize());
125
136
  if (this.defaultAttribute) {
126
- result.defaultAttribute = this.defaultAttribute.serializable();
137
+ result.defaultAttribute = this.defaultAttribute.serialize();
127
138
  }
128
139
  return result;
129
140
  }
@@ -158,8 +169,8 @@ export class DimensionalDimension extends DimensionalElement {
158
169
  * @internal
159
170
  */
160
171
  export class DimensionalDateDimension extends DimensionalDimension {
161
- constructor(name, expression, desc, sort, dataSource) {
162
- super(name, expression, [], [], MetadataTypes.DateDimension, desc, sort, dataSource);
172
+ constructor(name, expression, desc, sort, dataSource, composeCode) {
173
+ super(name, expression, [], [], MetadataTypes.DateDimension, desc, sort, dataSource, composeCode);
163
174
  this.defaultLevel = DateLevels.Years;
164
175
  this.Years = new DimensionalLevelAttribute(DateLevels.Years, expression, DateLevels.Years, 'yyyy', desc, sort, dataSource);
165
176
  this.Quarters = new DimensionalLevelAttribute(DateLevels.Quarters, expression, DateLevels.Quarters, 'Q yyyy', desc, sort, dataSource);
@@ -219,16 +230,14 @@ export class DimensionalDateDimension extends DimensionalDimension {
219
230
  * @returns An instance representing the sorted {@link Dimension} of this instance
220
231
  */
221
232
  sort(sort) {
222
- return new DimensionalDateDimension(this.name, this.expression, this.description, sort, this.dataSource);
233
+ return new DimensionalDateDimension(this.name, this.expression, this.description, sort, this.dataSource, this.composeCode);
223
234
  }
224
235
  /**
225
236
  * Gets a serializable representation of the element
226
237
  */
227
- serializable() {
228
- const result = super.serializable();
229
- if (this.defaultLevel) {
230
- result.defaultLevel = this.defaultLevel;
231
- }
238
+ serialize() {
239
+ const result = super.serialize();
240
+ result.__serializable = 'DimensionalDateDimension';
232
241
  return result;
233
242
  }
234
243
  /**