@thoughtspot/visual-embed-sdk 1.6.0-alpha.3 → 1.6.3
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/src/auth.d.ts +3 -5
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/types.d.ts +13 -8
- package/dist/tsembed.es.js +42 -18
- package/dist/tsembed.js +42 -18
- package/lib/package.json +5 -1
- package/lib/src/auth.d.ts +3 -5
- package/lib/src/auth.js +27 -9
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +2 -2
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +4 -0
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.js +2 -1
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/types.d.ts +13 -8
- package/lib/src/types.js +11 -6
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +17 -8
- package/package.json +5 -1
- package/src/auth.spec.ts +2 -2
- package/src/auth.ts +37 -9
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.ts +3 -1
- package/src/types.ts +13 -8
- package/dist/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.js +0 -107
- package/lib/src/embed/pinboard.js.map +0 -1
- package/lib/src/utils/fetchAnswers.d.ts +0 -3
- package/lib/src/utils/fetchAnswers.js +0 -49
- package/lib/src/utils/fetchAnswers.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -21,6 +21,10 @@ export enum AuthType {
|
|
|
21
21
|
* SSO using SAML
|
|
22
22
|
*/
|
|
23
23
|
SSO = 'SSO_SAML',
|
|
24
|
+
/**
|
|
25
|
+
* SSO using OIDC
|
|
26
|
+
*/
|
|
27
|
+
OIDC = 'SSO_OIDC',
|
|
24
28
|
/**
|
|
25
29
|
* Trusted authentication server
|
|
26
30
|
*/
|
|
@@ -124,14 +128,14 @@ export interface EmbedConfig {
|
|
|
124
128
|
* When there are multiple embeds, queue the render of embed to start
|
|
125
129
|
* after the previous embed's render is complete. This helps in the load performance
|
|
126
130
|
* by decreasing the load on the browser.
|
|
127
|
-
*
|
|
131
|
+
* @version 1.5.0 or later
|
|
128
132
|
* @default false
|
|
129
133
|
*/
|
|
130
134
|
queueMultiRenders?: boolean;
|
|
131
135
|
|
|
132
136
|
/**
|
|
133
137
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
134
|
-
*
|
|
138
|
+
* @version 1.6.0 or later
|
|
135
139
|
* @default ''
|
|
136
140
|
*/
|
|
137
141
|
customCssUrl?: string;
|
|
@@ -287,7 +291,7 @@ export enum EmbedEvent {
|
|
|
287
291
|
/**
|
|
288
292
|
* A double click has been triggered on table/chart
|
|
289
293
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
290
|
-
*
|
|
294
|
+
* @version 1.5.0 or later
|
|
291
295
|
*/
|
|
292
296
|
VizPointDoubleClick = 'vizPointDoubleClick',
|
|
293
297
|
/**
|
|
@@ -329,7 +333,7 @@ export enum EmbedEvent {
|
|
|
329
333
|
* Emitted when the embed does not have cookie access. This
|
|
330
334
|
* happens on Safari where third-party cookies are blocked by default.
|
|
331
335
|
*
|
|
332
|
-
* @version 1.1.0
|
|
336
|
+
* @version 1.1.0 or later
|
|
333
337
|
*/
|
|
334
338
|
NoCookieAccess = 'noCookieAccess',
|
|
335
339
|
/**
|
|
@@ -340,12 +344,12 @@ export enum EmbedEvent {
|
|
|
340
344
|
SAMLComplete = 'samlComplete',
|
|
341
345
|
/**
|
|
342
346
|
* Emitted when any modal is opened in the app
|
|
343
|
-
*
|
|
347
|
+
* @version 1.6.0 or later
|
|
344
348
|
*/
|
|
345
349
|
DialogOpen = 'dialog-open',
|
|
346
350
|
/**
|
|
347
351
|
* Emitted when any modal is closed in the app
|
|
348
|
-
*
|
|
352
|
+
* @version 1.6.0 or later
|
|
349
353
|
*/
|
|
350
354
|
DialogClose = 'dialog-close',
|
|
351
355
|
}
|
|
@@ -368,7 +372,7 @@ export enum HostEvent {
|
|
|
368
372
|
* eg. { selectedPoints: []}
|
|
369
373
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
370
374
|
* if not provided it will auto drill by the configured column. \
|
|
371
|
-
*
|
|
375
|
+
* @version 1.5.0 or later
|
|
372
376
|
*/
|
|
373
377
|
DrillDown = 'triggerDrillDown',
|
|
374
378
|
/**
|
|
@@ -385,7 +389,7 @@ export enum HostEvent {
|
|
|
385
389
|
* Set the visible visualizations on a Liveboard.
|
|
386
390
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
387
391
|
* will be hidden.
|
|
388
|
-
*
|
|
392
|
+
* @version 1.6.0 or later
|
|
389
393
|
*/
|
|
390
394
|
SetVisibleVizs = 'SetPinboardVisibleVizs',
|
|
391
395
|
}
|
|
@@ -418,6 +422,7 @@ export enum DataSourceVisualMode {
|
|
|
418
422
|
export enum Param {
|
|
419
423
|
DataSources = 'dataSources',
|
|
420
424
|
DataSourceMode = 'dataSourceMode',
|
|
425
|
+
ExpandAllDataSource = 'expandAllDataSource',
|
|
421
426
|
DisableActions = 'disableAction',
|
|
422
427
|
DisableActionReason = 'disableHint',
|
|
423
428
|
ForceTable = 'forceTable',
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { DOMSelector } from '../types';
|
|
12
|
-
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
-
/**
|
|
14
|
-
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
-
* @Category Pinboards and Charts
|
|
16
|
-
*/
|
|
17
|
-
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
-
/**
|
|
19
|
-
* If set to true, the embedded object container dynamically resizes
|
|
20
|
-
* according to the height of the pinboard.
|
|
21
|
-
*/
|
|
22
|
-
fullHeight?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
-
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
-
* other screens navigable from a pinboard.
|
|
27
|
-
* @default 500
|
|
28
|
-
* * _since 1.5.0_
|
|
29
|
-
*/
|
|
30
|
-
defaultHeight?: number;
|
|
31
|
-
/**
|
|
32
|
-
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
-
*/
|
|
34
|
-
enableVizTransformations?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The pinboard to display in the embedded view.
|
|
37
|
-
*/
|
|
38
|
-
pinboardId: string;
|
|
39
|
-
/**
|
|
40
|
-
* The visualization within the pinboard to display.
|
|
41
|
-
*/
|
|
42
|
-
vizId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If set to true, all filter chips from a
|
|
45
|
-
* pinboard page will be read-only (no X buttons)
|
|
46
|
-
*/
|
|
47
|
-
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
51
|
-
* @Category Pinboards and Charts
|
|
52
|
-
*/
|
|
53
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
54
|
-
protected viewConfig: PinboardViewConfig;
|
|
55
|
-
private defaultHeight;
|
|
56
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
57
|
-
/**
|
|
58
|
-
* Construct a map of params to be passed on to the
|
|
59
|
-
* embedded pinboard or visualization.
|
|
60
|
-
*/
|
|
61
|
-
private getEmbedParams;
|
|
62
|
-
/**
|
|
63
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
64
|
-
* to be loaded within the iframe.
|
|
65
|
-
* @param pinboardId The GUID of the pinboard.
|
|
66
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
67
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
68
|
-
* the pinboard or visualization on load.
|
|
69
|
-
*/
|
|
70
|
-
private getIFrameSrc;
|
|
71
|
-
/**
|
|
72
|
-
* Set the iframe height as per the computed height received
|
|
73
|
-
* from the ThoughtSpot app.
|
|
74
|
-
* @param data The event payload
|
|
75
|
-
*/
|
|
76
|
-
private updateIFrameHeight;
|
|
77
|
-
private embedIframeCenter;
|
|
78
|
-
private handleRouteChangeFullHeightPinboard;
|
|
79
|
-
/**
|
|
80
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
81
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
82
|
-
* visualization ID and the runtime filters.
|
|
83
|
-
*/
|
|
84
|
-
render(): PinboardEmbed;
|
|
85
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { DOMSelector } from '../types';
|
|
12
|
-
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
-
/**
|
|
14
|
-
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
-
* @Category Pinboards and Charts
|
|
16
|
-
*/
|
|
17
|
-
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
-
/**
|
|
19
|
-
* If set to true, the embedded object container dynamically resizes
|
|
20
|
-
* according to the height of the pinboard.
|
|
21
|
-
*/
|
|
22
|
-
fullHeight?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
-
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
-
* other screens navigable from a pinboard.
|
|
27
|
-
* @default 500
|
|
28
|
-
* * _since 1.5.0_
|
|
29
|
-
*/
|
|
30
|
-
defaultHeight?: number;
|
|
31
|
-
/**
|
|
32
|
-
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
-
*/
|
|
34
|
-
enableVizTransformations?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The pinboard to display in the embedded view.
|
|
37
|
-
*/
|
|
38
|
-
pinboardId: string;
|
|
39
|
-
/**
|
|
40
|
-
* The visualization within the pinboard to display.
|
|
41
|
-
*/
|
|
42
|
-
vizId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If set to true, all filter chips from a
|
|
45
|
-
* pinboard page will be read-only (no X buttons)
|
|
46
|
-
*/
|
|
47
|
-
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
51
|
-
* @Category Pinboards and Charts
|
|
52
|
-
*/
|
|
53
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
54
|
-
protected viewConfig: PinboardViewConfig;
|
|
55
|
-
private defaultHeight;
|
|
56
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
57
|
-
/**
|
|
58
|
-
* Construct a map of params to be passed on to the
|
|
59
|
-
* embedded pinboard or visualization.
|
|
60
|
-
*/
|
|
61
|
-
private getEmbedParams;
|
|
62
|
-
/**
|
|
63
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
64
|
-
* to be loaded within the iframe.
|
|
65
|
-
* @param pinboardId The GUID of the pinboard.
|
|
66
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
67
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
68
|
-
* the pinboard or visualization on load.
|
|
69
|
-
*/
|
|
70
|
-
private getIFrameSrc;
|
|
71
|
-
/**
|
|
72
|
-
* Set the iframe height as per the computed height received
|
|
73
|
-
* from the ThoughtSpot app.
|
|
74
|
-
* @param data The event payload
|
|
75
|
-
*/
|
|
76
|
-
private updateIFrameHeight;
|
|
77
|
-
private embedIframeCenter;
|
|
78
|
-
private handleRouteChangeFullHeightPinboard;
|
|
79
|
-
/**
|
|
80
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
81
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
82
|
-
* visualization ID and the runtime filters.
|
|
83
|
-
*/
|
|
84
|
-
render(): PinboardEmbed;
|
|
85
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { ERROR_MESSAGE } from '../errors';
|
|
12
|
-
import { EmbedEvent, Param, } from '../types';
|
|
13
|
-
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
14
|
-
import { V1Embed } from './ts-embed';
|
|
15
|
-
/**
|
|
16
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
17
|
-
* @Category Pinboards and Charts
|
|
18
|
-
*/
|
|
19
|
-
export class PinboardEmbed extends V1Embed {
|
|
20
|
-
// eslint-disable-next-line no-useless-constructor
|
|
21
|
-
constructor(domSelector, viewConfig) {
|
|
22
|
-
super(domSelector, viewConfig);
|
|
23
|
-
this.defaultHeight = 500;
|
|
24
|
-
/**
|
|
25
|
-
* Set the iframe height as per the computed height received
|
|
26
|
-
* from the ThoughtSpot app.
|
|
27
|
-
* @param data The event payload
|
|
28
|
-
*/
|
|
29
|
-
this.updateIFrameHeight = (data) => {
|
|
30
|
-
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
31
|
-
};
|
|
32
|
-
this.embedIframeCenter = (data, responder) => {
|
|
33
|
-
const obj = this.getIframeCenter();
|
|
34
|
-
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
35
|
-
};
|
|
36
|
-
this.handleRouteChangeFullHeightPinboard = (data) => {
|
|
37
|
-
if (data.data.canvasState !== 'EMBED' &&
|
|
38
|
-
data.data.canvasState !== 'pinboard') {
|
|
39
|
-
this.setIFrameHeight(this.defaultHeight);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Construct a map of params to be passed on to the
|
|
45
|
-
* embedded pinboard or visualization.
|
|
46
|
-
*/
|
|
47
|
-
getEmbedParams() {
|
|
48
|
-
const params = this.getBaseQueryParams();
|
|
49
|
-
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight, } = this.viewConfig;
|
|
50
|
-
if (fullHeight === true) {
|
|
51
|
-
params[Param.fullHeight] = true;
|
|
52
|
-
}
|
|
53
|
-
if (defaultHeight) {
|
|
54
|
-
this.defaultHeight = defaultHeight;
|
|
55
|
-
}
|
|
56
|
-
if (enableVizTransformations !== undefined) {
|
|
57
|
-
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
58
|
-
}
|
|
59
|
-
if (preventPinboardFilterRemoval) {
|
|
60
|
-
params[Param.preventPinboardFilterRemoval] = true;
|
|
61
|
-
}
|
|
62
|
-
params[Param.livedBoardEmbed] = true;
|
|
63
|
-
const queryParams = getQueryParamString(params, true);
|
|
64
|
-
return queryParams;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
68
|
-
* to be loaded within the iframe.
|
|
69
|
-
* @param pinboardId The GUID of the pinboard.
|
|
70
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
71
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
72
|
-
* the pinboard or visualization on load.
|
|
73
|
-
*/
|
|
74
|
-
getIFrameSrc(pinboardId, vizId, runtimeFilters) {
|
|
75
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
76
|
-
const queryParams = this.getEmbedParams();
|
|
77
|
-
const queryString = [filterQuery, queryParams]
|
|
78
|
-
.filter(Boolean)
|
|
79
|
-
.join('&');
|
|
80
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${pinboardId}`;
|
|
81
|
-
if (vizId) {
|
|
82
|
-
url = `${url}/${vizId}`;
|
|
83
|
-
}
|
|
84
|
-
return url;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
88
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
89
|
-
* visualization ID and the runtime filters.
|
|
90
|
-
*/
|
|
91
|
-
render() {
|
|
92
|
-
const { pinboardId, vizId, runtimeFilters } = this.viewConfig;
|
|
93
|
-
if (!pinboardId && !vizId) {
|
|
94
|
-
this.handleError(ERROR_MESSAGE.PINBOARD_VIZ_ID_VALIDATION);
|
|
95
|
-
}
|
|
96
|
-
if (this.viewConfig.fullHeight === true) {
|
|
97
|
-
this.on(EmbedEvent.RouteChange, this.handleRouteChangeFullHeightPinboard);
|
|
98
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
99
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
100
|
-
}
|
|
101
|
-
super.render();
|
|
102
|
-
const src = this.getIFrameSrc(pinboardId, vizId, runtimeFilters);
|
|
103
|
-
this.renderV1Embed(src);
|
|
104
|
-
return this;
|
|
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ACP,GAAG,GAAG,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;SAC3B;QAED,OAAO,GAAG,CAAC;IACf,CAAC;IAyBD;;;;OAIG;IACI,MAAM;QACT,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAE9D,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE;YACvB,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;SAC9D;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC,EAAE,CACH,UAAU,CAAC,WAAW,EACtB,IAAI,CAAC,mCAAmC,CAC3C,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjE;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { OperationType } from '../types';
|
|
2
|
-
function FetchAnswers(session, query, operation, thoughtSpotHost) {
|
|
3
|
-
let variable;
|
|
4
|
-
const fetchQuery = async (variables) => {
|
|
5
|
-
try {
|
|
6
|
-
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operation}`, {
|
|
7
|
-
method: 'POST',
|
|
8
|
-
headers: {
|
|
9
|
-
'content-type': 'application/json;charset=UTF-8',
|
|
10
|
-
'x-requested-by': 'ThoughtSpot',
|
|
11
|
-
accept: '*/*',
|
|
12
|
-
'accept-language': 'en-us',
|
|
13
|
-
},
|
|
14
|
-
body: JSON.stringify({
|
|
15
|
-
operationName: operation,
|
|
16
|
-
query,
|
|
17
|
-
variables,
|
|
18
|
-
}),
|
|
19
|
-
credentials: 'include'
|
|
20
|
-
});
|
|
21
|
-
const result = await response.json();
|
|
22
|
-
return result.data;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
return error;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const getAnswer = (offset, batchSize) => {
|
|
29
|
-
if (operation === OperationType.GetChartWithData) {
|
|
30
|
-
variable = { batchSize, offset };
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
variable = {
|
|
34
|
-
dataPaginationParams: {
|
|
35
|
-
isClientPaginated: true,
|
|
36
|
-
offset,
|
|
37
|
-
size: batchSize,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return fetchQuery({
|
|
42
|
-
session,
|
|
43
|
-
...variable,
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
return getAnswer;
|
|
47
|
-
}
|
|
48
|
-
export default FetchAnswers;
|
|
49
|
-
//# sourceMappingURL=fetchAnswers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAnswers.js","sourceRoot":"","sources":["../../../src/utils/fetchAnswers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3D,SAAS,YAAY,CACjB,OAAyB,EACzB,KAAa,EACb,SAAiB,EACjB,eAAuB;IAEvB,IAAI,QAAa,CAAC;IAElB,MAAM,UAAU,GAAG,KAAK,EAAE,SAAc,EAAE,EAAE;QACxC,IAAI;YACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,eAAe,cAAc,SAAS,EAAE,EAC3C;gBACI,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACL,cAAc,EAAE,gCAAgC;oBAChD,g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