@sisense/sdk-data 1.4.1 → 1.5.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.
@@ -1,11 +1,11 @@
1
1
  import { DataModel, Element } from './interfaces.js';
2
- import { DataSource } from '../interfaces.js';
2
+ import { DataSource, DataSourceInfo } from '../interfaces.js';
3
3
  /**
4
4
  * @internal
5
5
  */
6
6
  export declare class DimensionalDataModel implements DataModel {
7
7
  static fromConfig(config: any): DimensionalDataModel;
8
- constructor(name: string, dataSource: DataSource, metadata: Element[]);
8
+ constructor(name: string, dataSource: DataSourceInfo, metadata: Element[]);
9
9
  readonly name: string;
10
10
  readonly dataSource: DataSource;
11
11
  readonly metadata: Element[];
@@ -1,9 +1,11 @@
1
+ import { DataSource } from '../interfaces.js';
1
2
  import { Sort } from './types.js';
2
3
  /**
3
4
  * @internal
4
5
  */
5
6
  export interface DataModel {
6
7
  readonly name: string;
8
+ readonly dataSource: DataSource;
7
9
  readonly metadata: Element[];
8
10
  [propName: string]: any;
9
11
  }
@@ -122,10 +122,17 @@ export interface CalculatedMeasureColumn {
122
122
  */
123
123
  title?: string;
124
124
  }
125
+ /**
126
+ * Info of data source
127
+ */
128
+ export declare type DataSourceInfo = {
129
+ title: string;
130
+ type: 'live' | 'elasticube';
131
+ };
125
132
  /**
126
133
  * Data source for queries to run against
127
134
  */
128
- export declare type DataSource = string;
135
+ export declare type DataSource = string | DataSourceInfo;
129
136
  /**
130
137
  * Data set, which is made up of an array of {@link Column | columns}
131
138
  * and a two-dimensional array of data {@link Cell | cells}.
@@ -13,5 +13,5 @@ export const EMPTY_PIVOT_QUERY_RESULT_DATA = {
13
13
  * @internal
14
14
  */
15
15
  export function isDataSource(arg) {
16
- return arg === undefined || typeof arg === 'string';
16
+ return arg === undefined || typeof arg === 'string' || ('title' in arg && 'type' in arg);
17
17
  }
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Filter, FilterRelations, FilterRelationsJaql } from './index.js';
1
+ import { Filter, FilterRelations, FilterRelationsJaql, DataSource, DataSourceInfo } from './index.js';
2
2
  /**
3
3
  * A more performant, but slightly bulkier, RFC4122v4 implementation. Performance is improved by minimizing calls to random()
4
4
  *
@@ -14,3 +14,13 @@ export declare const getFilterListAndRelations: (filterRelations: FilterRelation
14
14
  filters: Filter[] | undefined;
15
15
  relations: FilterRelationsJaql | undefined;
16
16
  };
17
+ /**
18
+ * Gets the name of the data source
19
+ * @internal
20
+ */
21
+ export declare function getDataSourceName(dataSource: DataSource): string;
22
+ /**
23
+ * Checks if the provided 'dataSource' is a data source info structure that contains more than just the data source name.
24
+ * @internal
25
+ */
26
+ export declare function isDataSourceInfo(dataSource: DataSource): dataSource is DataSourceInfo;
package/dist/utils.js CHANGED
@@ -61,3 +61,17 @@ export const getFilterListAndRelations = (filterRelations) => {
61
61
  const relations = traverse(copiedFilterRelations);
62
62
  return { filters: Array.from(filters), relations };
63
63
  };
64
+ /**
65
+ * Gets the name of the data source
66
+ * @internal
67
+ */
68
+ export function getDataSourceName(dataSource) {
69
+ return typeof dataSource === 'string' ? dataSource : dataSource.title;
70
+ }
71
+ /**
72
+ * Checks if the provided 'dataSource' is a data source info structure that contains more than just the data source name.
73
+ * @internal
74
+ */
75
+ export function isDataSourceInfo(dataSource) {
76
+ return typeof dataSource === 'object' && 'type' in dataSource && 'title' in dataSource;
77
+ }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Sisense",
12
12
  "Compose SDK"
13
13
  ],
14
- "version": "1.4.1",
14
+ "version": "1.5.0",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -23,8 +23,8 @@
23
23
  "author": "Sisense ",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@sisense/sdk-common": "^1.4.1",
27
- "@sisense/sdk-rest-client": "^1.4.1",
26
+ "@sisense/sdk-common": "^1.5.0",
27
+ "@sisense/sdk-rest-client": "^1.5.0",
28
28
  "guid-typescript": "^1.0.9",
29
29
  "lodash": "^4.17.21",
30
30
  "numeral": "^2.0.6",