@thoughtspot/visual-embed-sdk 1.6.0-alpha.2 → 1.6.2

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 (56) hide show
  1. package/dist/src/auth.d.ts +2 -4
  2. package/dist/src/embed/app.d.ts +9 -2
  3. package/dist/src/embed/liveboard.d.ts +19 -19
  4. package/dist/src/embed/liveboard.spec.d.ts +1 -0
  5. package/dist/src/embed/search.d.ts +4 -0
  6. package/dist/src/embed/ts-embed.d.ts +2 -11
  7. package/dist/src/types.d.ts +24 -24
  8. package/dist/tsembed.es.js +82 -68
  9. package/dist/tsembed.js +81 -67
  10. package/lib/package.json +5 -1
  11. package/lib/src/auth.d.ts +2 -4
  12. package/lib/src/auth.js +25 -7
  13. package/lib/src/auth.js.map +1 -1
  14. package/lib/src/embed/app.d.ts +9 -2
  15. package/lib/src/embed/app.js +18 -1
  16. package/lib/src/embed/app.js.map +1 -1
  17. package/lib/src/embed/app.spec.js +31 -0
  18. package/lib/src/embed/app.spec.js.map +1 -1
  19. package/lib/src/embed/events.spec.js +55 -2
  20. package/lib/src/embed/events.spec.js.map +1 -1
  21. package/lib/src/embed/liveboard.d.ts +19 -19
  22. package/lib/src/embed/liveboard.js +12 -13
  23. package/lib/src/embed/liveboard.js.map +1 -1
  24. package/lib/src/embed/liveboard.spec.d.ts +1 -0
  25. package/lib/src/embed/liveboard.spec.js +159 -0
  26. package/lib/src/embed/liveboard.spec.js.map +1 -0
  27. package/lib/src/embed/search.d.ts +4 -0
  28. package/lib/src/embed/search.js +1 -1
  29. package/lib/src/embed/search.js.map +1 -1
  30. package/lib/src/embed/ts-embed.d.ts +2 -11
  31. package/lib/src/embed/ts-embed.js +4 -23
  32. package/lib/src/embed/ts-embed.js.map +1 -1
  33. package/lib/src/embed/ts-embed.spec.js +63 -6
  34. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  35. package/lib/src/types.d.ts +24 -24
  36. package/lib/src/types.js +21 -22
  37. package/lib/src/types.js.map +1 -1
  38. package/lib/src/visual-embed-sdk.d.ts +51 -49
  39. package/package.json +5 -1
  40. package/src/auth.ts +35 -7
  41. package/src/embed/app.spec.ts +40 -0
  42. package/src/embed/app.ts +21 -2
  43. package/src/embed/events.spec.ts +60 -1
  44. package/src/embed/liveboard.spec.ts +199 -0
  45. package/src/embed/liveboard.ts +21 -24
  46. package/src/embed/search.ts +5 -0
  47. package/src/embed/ts-embed.spec.ts +78 -5
  48. package/src/embed/ts-embed.ts +6 -25
  49. package/src/types.ts +24 -24
  50. package/dist/src/embed/pinboard.d.ts +0 -85
  51. package/lib/src/embed/pinboard.d.ts +0 -85
  52. package/lib/src/embed/pinboard.js +0 -107
  53. package/lib/src/embed/pinboard.js.map +0 -1
  54. package/lib/src/utils/fetchAnswers.d.ts +0 -3
  55. package/lib/src/utils/fetchAnswers.js +0 -49
  56. 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 IODC
26
+ */
27
+ IODC = 'SSO_IODC',
24
28
  /**
25
29
  * Trusted authentication server
26
30
  */
@@ -124,13 +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.
131
+ * @version 1.5.0 or later
127
132
  * @default false
128
133
  */
129
134
  queueMultiRenders?: boolean;
130
135
 
131
136
  /**
132
137
  * Dynamic CSS Url to be injected in the loaded application.
133
- * _Since: 1.6.0_
138
+ * @version 1.6.0 or later
134
139
  * @default ''
135
140
  */
136
141
  customCssUrl?: string;
@@ -212,7 +217,7 @@ export enum RuntimeFilterOp {
212
217
  }
213
218
 
214
219
  /**
215
- * A filter that can be applied to ThoughtSpot answers, liveboards, or
220
+ * A filter that can be applied to ThoughtSpot answers, Liveboards, or
216
221
  * visualizations at runtime.
217
222
  */
218
223
  export interface RuntimeFilter {
@@ -252,12 +257,12 @@ export enum EmbedEvent {
252
257
  */
253
258
  Load = 'load',
254
259
  /**
255
- * Data pertaining to answer or liveboard is received
256
- * @return data - The answer or liveboard data
260
+ * Data pertaining to answer or Liveboard is received
261
+ * @return data - The answer or Liveboard data
257
262
  */
258
263
  Data = 'data',
259
264
  /**
260
- * Search/answer/liveboard filters have been applied/updated
265
+ * Search/answer/Liveboard filters have been applied/updated
261
266
  * @hidden
262
267
  */
263
268
  FiltersChanged = 'filtersChanged',
@@ -280,13 +285,13 @@ export enum EmbedEvent {
280
285
  /**
281
286
  * A custom action has been triggered
282
287
  * @return actionId - The id of the custom action
283
- * @return data - The answer or liveboard data
288
+ * @return data - The answer or Liveboard data
284
289
  */
285
290
  CustomAction = 'customAction',
286
291
  /**
287
292
  * A double click has been triggered on table/chart
288
293
  * @return ContextMenuInputPoints - data point that is double clicked
289
- * * _since: 1.5.0_
294
+ * @version 1.5.0 or later
290
295
  */
291
296
  VizPointDoubleClick = 'vizPointDoubleClick',
292
297
  /**
@@ -304,8 +309,8 @@ export enum EmbedEvent {
304
309
  */
305
310
  AuthExpire = 'ThoughtspotAuthExpired',
306
311
  /**
307
- * The height of the embedded liveboard or visualization has been computed.
308
- * @return data - The height of the embedded liveboard or visualization
312
+ * The height of the embedded Liveboard or visualization has been computed.
313
+ * @return data - The height of the embedded Liveboard or visualization
309
314
  * @hidden
310
315
  */
311
316
  EmbedHeight = 'EMBED_HEIGHT',
@@ -317,7 +322,6 @@ export enum EmbedEvent {
317
322
  EmbedIframeCenter = 'EmbedIframeCenter',
318
323
  /**
319
324
  * Detects the route change.
320
- * @hidden
321
325
  */
322
326
  RouteChange = 'ROUTE_CHANGE',
323
327
  /**
@@ -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
- * * _since: 1.6.0_
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
- * * _since: 1.6.0_
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
- * * _since: 1.5.0_
375
+ * @version 1.5.0 or later
372
376
  */
373
377
  DrillDown = 'triggerDrillDown',
374
378
  /**
@@ -382,10 +386,10 @@ export enum HostEvent {
382
386
  */
383
387
  Reload = 'reload',
384
388
  /**
385
- * Set the visible Vizs on a pinboard/liveboard.
386
- * @param - an array of ids of vizs to show, the ids not passed
389
+ * Set the visible visualizations on a Liveboard.
390
+ * @param - an array of ids of visualizations to show, the ids not passed
387
391
  * will be hidden.
388
- * _since: 1.6.0_
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',
@@ -444,7 +449,7 @@ export enum Param {
444
449
 
445
450
  /**
446
451
  * The list of actions that can be performed on visual ThoughtSpot
447
- * entities, such as answers and liveboards.
452
+ * entities, such as answers and Liveboards.
448
453
  */
449
454
  // eslint-disable-next-line no-shadow
450
455
  export enum Action {
@@ -455,11 +460,6 @@ export enum Action {
455
460
  MakeACopy = 'makeACopy',
456
461
  EditACopy = 'editACopy',
457
462
  CopyLink = 'embedDocument',
458
- /**
459
- * @hidden
460
- */
461
- PinboardSnapshot = 'pinboardSnapshot',
462
- LiveboardSnapshot = 'liveboardSnapshot', // update-TSCB
463
463
  ResetLayout = 'resetLayout',
464
464
  Schedule = 'schedule',
465
465
  SchedulesList = 'schedule-list',
@@ -496,7 +496,7 @@ export enum Action {
496
496
  * @hidden
497
497
  */
498
498
  PinboardInfo = 'pinboardInfo',
499
- LiveboardInfo = 'liveboardInfo', // update-TSCB
499
+ LiveboardInfo = 'pinboardInfo',
500
500
  SendAnswerFeedback = 'sendFeedback',
501
501
  /**
502
502
  * @deprecated Will be removed in next version
@@ -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;
105
- }
106
- }
107
- //# sourceMappingURL=pinboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACH,UAAU,EAEV,KAAK,GAIR,MAAM,UAAU,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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,3 +0,0 @@
1
- import { SessionInterface } from '../types';
2
- declare function FetchAnswers(session: SessionInterface, query: string, operation: string, thoughtSpotHost: string): any;
3
- export default FetchAnswers;
@@ -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,gBAAgB,EAAE,aAAa;oBAC/B,MAAM,EAAE,KAAK;oBACb,iBAAiB,EAAE,OAAO;iBAC7B;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACjB,aAAa,EAAE,SAAS;oBACxB,KAAK;oBACL,SAAS;iBACZ,CAAC;gBACF,WAAW,EAAE,SAAS;aACzB,CACA,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACrC,OAAO,MAAM,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE;QACpD,IAAI,SAAS,KAAK,aAAa,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;SACpC;aAAM;YACH,QAAQ,GAAG;gBACP,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