@thoughtspot/ts-chart-sdk 0.0.1-alpha.0 → 0.0.1-alpha.1
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/README.md +782 -0
- package/cjs/index.d.ts +8 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +24 -0
- package/cjs/index.js.map +1 -0
- package/cjs/main/custom-chart-context.d.ts +39 -0
- package/cjs/main/custom-chart-context.d.ts.map +1 -0
- package/cjs/main/custom-chart-context.js +211 -0
- package/cjs/main/custom-chart-context.js.map +1 -0
- package/cjs/main/custom-chart-context.spec.d.ts +2 -0
- package/cjs/main/custom-chart-context.spec.d.ts.map +1 -0
- package/cjs/main/custom-chart-context.spec.js +379 -0
- package/cjs/main/custom-chart-context.spec.js.map +1 -0
- package/cjs/main/post-message-event-bridge.d.ts +6 -0
- package/cjs/main/post-message-event-bridge.d.ts.map +1 -0
- package/cjs/main/post-message-event-bridge.js +46 -0
- package/cjs/main/post-message-event-bridge.js.map +1 -0
- package/cjs/main/post-message-event-bridge.spec.d.ts +2 -0
- package/cjs/main/post-message-event-bridge.spec.d.ts.map +1 -0
- package/cjs/main/post-message-event-bridge.spec.js +122 -0
- package/cjs/main/post-message-event-bridge.spec.js.map +1 -0
- package/cjs/test/test-utils.d.ts +7 -0
- package/cjs/test/test-utils.d.ts.map +1 -0
- package/cjs/test/test-utils.js +14 -0
- package/cjs/test/test-utils.js.map +1 -0
- package/cjs/types/answer-column.types.d.ts +69 -0
- package/cjs/types/answer-column.types.d.ts.map +1 -0
- package/cjs/types/answer-column.types.js +59 -0
- package/cjs/types/answer-column.types.js.map +1 -0
- package/cjs/types/chart-to-ts-event.types.d.ts +48 -0
- package/cjs/types/chart-to-ts-event.types.d.ts.map +1 -0
- package/cjs/types/chart-to-ts-event.types.js +19 -0
- package/cjs/types/chart-to-ts-event.types.js.map +1 -0
- package/cjs/types/common.types.d.ts +50 -0
- package/cjs/types/common.types.d.ts.map +1 -0
- package/cjs/types/common.types.js +3 -0
- package/cjs/types/common.types.js.map +1 -0
- package/cjs/types/configurator.types.d.ts +15 -0
- package/cjs/types/configurator.types.d.ts.map +1 -0
- package/cjs/types/configurator.types.js +3 -0
- package/cjs/types/configurator.types.js.map +1 -0
- package/cjs/types/ts-to-chart-event.types.d.ts +69 -0
- package/cjs/types/ts-to-chart-event.types.d.ts.map +1 -0
- package/cjs/types/ts-to-chart-event.types.js +16 -0
- package/cjs/types/ts-to-chart-event.types.js.map +1 -0
- package/cjs/types/visual-prop.types.d.ts +47 -0
- package/cjs/types/visual-prop.types.d.ts.map +1 -0
- package/cjs/types/visual-prop.types.js +3 -0
- package/cjs/types/visual-prop.types.js.map +1 -0
- package/lib/main/custom-chart-context.d.ts +2 -1
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +11 -7
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +64 -25
- package/lib/main/custom-chart-context.spec.js.map +1 -1
- package/lib/types/chart-to-ts-event.types.d.ts +8 -8
- package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
- package/lib/types/chart-to-ts-event.types.js.map +1 -1
- package/lib/types/common.types.d.ts +7 -8
- package/lib/types/common.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.d.ts +2 -0
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.js +1 -0
- package/lib/types/ts-to-chart-event.types.js.map +1 -1
- package/package.json +2 -2
- package/src/main/custom-chart-context.spec.ts +87 -26
- package/src/main/custom-chart-context.ts +26 -16
- package/src/main/post-message-event-bridge.ts +2 -2
- package/src/types/answer-column.types.ts +5 -5
- package/src/types/chart-to-ts-event.types.ts +18 -28
- package/src/types/common.types.ts +22 -25
- package/src/types/configurator.types.ts +8 -8
- package/src/types/ts-to-chart-event.types.ts +10 -4
- package/src/types/visual-prop.types.ts +11 -11
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Copyright: ThoughtSpot Inc. 2023
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ChartColumn
|
|
9
|
+
import { ChartColumn } from './answer-column.types';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* List of Columns for a dimension in the Custom Chart Config.
|
|
@@ -18,13 +18,13 @@ import { ChartColumn, DataType } from './answer-column.types';
|
|
|
18
18
|
*/
|
|
19
19
|
export interface ChartConfigDimension {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Key for the dimension in the chart config
|
|
22
22
|
*
|
|
23
23
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
24
24
|
*/
|
|
25
25
|
key: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* List of columns added for the dimension
|
|
28
28
|
*
|
|
29
29
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
30
30
|
*/
|
|
@@ -40,8 +40,8 @@ export interface ChartConfigDimension {
|
|
|
40
40
|
*/
|
|
41
41
|
export interface ChartConfig {
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Key of the custom chart config defined in the chart config editor definition
|
|
44
|
+
* This is used to differentiate between different custom chart configurations
|
|
45
45
|
* within the same chart
|
|
46
46
|
*
|
|
47
47
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
@@ -56,35 +56,32 @@ export interface ChartConfig {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* Data Array
|
|
59
|
+
* Data Points Array interface to define data for each row and column.
|
|
60
|
+
* Data is ordered as per the columns in the query and the rows are sorted
|
|
61
|
+
* as per the search query.
|
|
60
62
|
*
|
|
61
63
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
62
64
|
* @group Chart Model
|
|
63
65
|
*/
|
|
64
|
-
export type
|
|
66
|
+
export type DataPointsArray = {
|
|
65
67
|
/**
|
|
66
|
-
* column
|
|
68
|
+
* Array of column IDs ordered as per the data query
|
|
67
69
|
*
|
|
68
70
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
69
71
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* type of data
|
|
73
|
-
*
|
|
74
|
-
* @version SDK: 0.1 | ThoughtSpot:
|
|
75
|
-
*/
|
|
76
|
-
columnDataType: DataType;
|
|
72
|
+
columns: string[];
|
|
73
|
+
|
|
77
74
|
/**
|
|
78
|
-
*
|
|
75
|
+
* Array of rows of data ordered by the columns
|
|
79
76
|
*
|
|
80
77
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
81
78
|
*/
|
|
82
|
-
dataValue: any[];
|
|
79
|
+
dataValue: any[][];
|
|
83
80
|
};
|
|
84
81
|
|
|
85
82
|
/**
|
|
86
83
|
* For each query defined by the user, a query data object is sent
|
|
87
|
-
* in
|
|
84
|
+
* in this format.
|
|
88
85
|
*
|
|
89
86
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
90
87
|
* @group Chart Model
|
|
@@ -95,21 +92,21 @@ export type QueryData = {
|
|
|
95
92
|
*
|
|
96
93
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
97
94
|
*/
|
|
98
|
-
data:
|
|
95
|
+
data: DataPointsArray;
|
|
99
96
|
|
|
100
97
|
/**
|
|
101
98
|
* @hidden
|
|
102
99
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
103
100
|
*/
|
|
104
|
-
completionRatio
|
|
101
|
+
completionRatio?: number;
|
|
105
102
|
/**
|
|
106
103
|
* @hidden
|
|
107
104
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
108
105
|
*/
|
|
109
|
-
samplingRatio
|
|
106
|
+
samplingRatio?: number;
|
|
110
107
|
|
|
111
108
|
/**
|
|
112
|
-
*
|
|
109
|
+
* Number of rows of data fetched for the query
|
|
113
110
|
*
|
|
114
111
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
115
112
|
*/
|
|
@@ -130,7 +127,7 @@ export interface ChartModel {
|
|
|
130
127
|
*/
|
|
131
128
|
columns: ChartColumn[];
|
|
132
129
|
/**
|
|
133
|
-
* Array of
|
|
130
|
+
* Array of datasets for each query
|
|
134
131
|
*
|
|
135
132
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
136
133
|
*/
|
|
@@ -152,14 +149,14 @@ export type ValidationResponse = {
|
|
|
152
149
|
/**
|
|
153
150
|
* Custom Visual props is the stored metadata for the visual props definition
|
|
154
151
|
* configured by the user in the visual prop editor
|
|
155
|
-
* The JSON is defined by the visual prop types. See VisualPropEditorDefinition
|
|
152
|
+
* The JSON is defined by the visual prop types. See VisualPropEditorDefinition.
|
|
156
153
|
*
|
|
157
154
|
* @group Chart Model
|
|
158
155
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
159
156
|
*/
|
|
160
157
|
export type VisualProps = JSON;
|
|
161
158
|
|
|
162
|
-
// Todo: this should be imported from custom style config package.
|
|
159
|
+
// Todo: this should be imported from the custom style config package.
|
|
163
160
|
type CustomStylingConfig = any;
|
|
164
161
|
|
|
165
162
|
export interface AppConfig {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @file Column Configuration Definition
|
|
3
3
|
* @fileoverview
|
|
4
4
|
* Developers will use this to define the axis configuration that any
|
|
5
|
-
* creator of the chart can use
|
|
5
|
+
* creator of the chart can use it to define the expected chart configuration.
|
|
6
6
|
*
|
|
7
7
|
* This will also be validated with the overall expectation
|
|
8
8
|
* of the chart developer using validate flow.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Developers are expected to use this to define the data queries
|
|
11
11
|
* required for the chart.
|
|
12
12
|
* @author Chetan Agrawal <chetan.agrawal@thoughtspot.com>
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
export interface ChartConfigSection {
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Key to persist the columns
|
|
24
24
|
*
|
|
25
25
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
26
26
|
*/
|
|
@@ -33,9 +33,9 @@ export interface ChartConfigSection {
|
|
|
33
33
|
label: string;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* In the UI, the following values will only prevent
|
|
37
|
-
* columns on the section config or prevent from opening a drop
|
|
38
|
-
* multiple queries.
|
|
36
|
+
* In the UI, the following values will only prevent dropping unnecessary
|
|
37
|
+
* columns on the section config or prevent users from opening a drop-down in case of
|
|
38
|
+
* multiple queries. Developers must validate this flow.
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -76,7 +76,7 @@ export interface ChartConfigSection {
|
|
|
76
76
|
*/
|
|
77
77
|
export interface ChartConfigEditorDefinition {
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Key to store the chart config
|
|
80
80
|
*
|
|
81
81
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
82
82
|
*/
|
|
@@ -94,7 +94,7 @@ export interface ChartConfigEditorDefinition {
|
|
|
94
94
|
*/
|
|
95
95
|
descriptionText?: string;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Defines all the column sections for the chart config
|
|
98
98
|
*
|
|
99
99
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
100
100
|
*/
|
|
@@ -11,7 +11,7 @@ import { ChartConfigEditorDefinition } from './configurator.types';
|
|
|
11
11
|
import { VisualPropEditorDefinition } from './visual-prop.types';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* All the events sent from
|
|
14
|
+
* All the events sent from the ThoughtSpot application to Custom Chart App
|
|
15
15
|
*
|
|
16
16
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
17
17
|
* @group ThoughtSpot to Chart Events
|
|
@@ -21,6 +21,10 @@ export enum TSToChartEvent {
|
|
|
21
21
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
22
22
|
*/
|
|
23
23
|
Initialize = 'Initialize',
|
|
24
|
+
/**
|
|
25
|
+
* @version SDK: 0.1 | ThoughtSpot:
|
|
26
|
+
*/
|
|
27
|
+
InitializeComplete = 'InitializeComplete',
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
@@ -85,6 +89,8 @@ export interface TSToChartInternalEventsPayloadMap {
|
|
|
85
89
|
payload: InitializeEventPayload,
|
|
86
90
|
) => InitializeEventResponsePayload;
|
|
87
91
|
|
|
92
|
+
[TSToChartEvent.InitializeComplete]: () => void;
|
|
93
|
+
|
|
88
94
|
[TSToChartEvent.GetDataQuery]: (
|
|
89
95
|
payload: GetDataQueryPayload,
|
|
90
96
|
) => GetDataQueryResponsePayload;
|
|
@@ -113,7 +119,7 @@ export interface InitializeEventPayload {
|
|
|
113
119
|
chartModel: ChartModel;
|
|
114
120
|
|
|
115
121
|
/**
|
|
116
|
-
* Additional
|
|
122
|
+
* Additional app configuration
|
|
117
123
|
*
|
|
118
124
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
119
125
|
*/
|
|
@@ -121,13 +127,13 @@ export interface InitializeEventPayload {
|
|
|
121
127
|
|
|
122
128
|
/**
|
|
123
129
|
* This is a unique component id that the context should send in every
|
|
124
|
-
* post message payload. This helps in identifying
|
|
130
|
+
* post message payload. This helps in identifying multiple app components.
|
|
125
131
|
*
|
|
126
132
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
127
133
|
*/
|
|
128
134
|
componentId: string;
|
|
129
135
|
/**
|
|
130
|
-
* The host
|
|
136
|
+
* The host URL of the parent to send the post message requests to.
|
|
131
137
|
* We cannot use the window.parent object details to fetch this.
|
|
132
138
|
* Hence sending in init flow.
|
|
133
139
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
export interface TextInputFormDetail {
|
|
17
17
|
type: 'text';
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Key to store the value
|
|
20
20
|
*
|
|
21
21
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
22
22
|
*/
|
|
@@ -35,7 +35,7 @@ export interface TextInputFormDetail {
|
|
|
35
35
|
*/
|
|
36
36
|
password?: boolean;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Allows multiline text
|
|
39
39
|
*
|
|
40
40
|
* @default false
|
|
41
41
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
@@ -63,7 +63,7 @@ export interface TextInputFormDetail {
|
|
|
63
63
|
export interface ToggleFormDetail {
|
|
64
64
|
type: 'toggle';
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Key to store the value
|
|
67
67
|
*
|
|
68
68
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
69
69
|
*/
|
|
@@ -90,7 +90,7 @@ export interface ToggleFormDetail {
|
|
|
90
90
|
export interface CheckboxFormDetail {
|
|
91
91
|
type: 'checkbox';
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* Key to store the value
|
|
94
94
|
*
|
|
95
95
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
96
96
|
*/
|
|
@@ -117,7 +117,7 @@ export interface CheckboxFormDetail {
|
|
|
117
117
|
export interface RadioButtonFormDetail {
|
|
118
118
|
type: 'radio';
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
120
|
+
* Key to store the value
|
|
121
121
|
*
|
|
122
122
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
123
123
|
*/
|
|
@@ -135,7 +135,7 @@ export interface RadioButtonFormDetail {
|
|
|
135
135
|
*/
|
|
136
136
|
defaultValue?: string;
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
138
|
+
* List of values to select from
|
|
139
139
|
*
|
|
140
140
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
141
141
|
*/
|
|
@@ -150,7 +150,7 @@ export interface RadioButtonFormDetail {
|
|
|
150
150
|
export interface DropDownFormDetail {
|
|
151
151
|
type: 'dropdown';
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
153
|
+
* Key to store the value
|
|
154
154
|
*
|
|
155
155
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
156
156
|
*/
|
|
@@ -168,7 +168,7 @@ export interface DropDownFormDetail {
|
|
|
168
168
|
*/
|
|
169
169
|
defaultValue?: string;
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
171
|
+
* List of values to select from
|
|
172
172
|
*
|
|
173
173
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
174
174
|
*/
|
|
@@ -176,14 +176,14 @@ export interface DropDownFormDetail {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* Element to define sections of form for the visual props editor
|
|
179
|
+
* Element to define sections of the form for the visual props editor
|
|
180
180
|
*
|
|
181
181
|
* @group Visual Properties Editor
|
|
182
182
|
*/
|
|
183
183
|
export interface Section {
|
|
184
184
|
type: 'section';
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
186
|
+
* Key to define & store the children's parent
|
|
187
187
|
*
|
|
188
188
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
189
189
|
*/
|
|
@@ -201,7 +201,7 @@ export interface Section {
|
|
|
201
201
|
*/
|
|
202
202
|
children?: PropElement[];
|
|
203
203
|
/**
|
|
204
|
-
*
|
|
204
|
+
* Defines form alignment in the view for the section
|
|
205
205
|
*
|
|
206
206
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
207
207
|
*/
|