@thoughtspot/visual-embed-sdk 1.42.1-alpha.6 → 1.42.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.
Files changed (162) hide show
  1. package/cjs/package.json +3 -2
  2. package/cjs/src/embed/app.d.ts +20 -0
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +5 -4
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/app.spec.js +32 -0
  7. package/cjs/src/embed/app.spec.js.map +1 -1
  8. package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
  9. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  10. package/cjs/src/embed/hostEventClient/contracts.js +0 -1
  11. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
  12. package/cjs/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  13. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  14. package/cjs/src/embed/hostEventClient/host-event-client.js +6 -6
  15. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  16. package/cjs/src/embed/search.d.ts.map +1 -1
  17. package/cjs/src/embed/search.js +1 -3
  18. package/cjs/src/embed/search.js.map +1 -1
  19. package/cjs/src/embed/ts-embed.d.ts +1 -3
  20. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  21. package/cjs/src/embed/ts-embed.js +16 -44
  22. package/cjs/src/embed/ts-embed.js.map +1 -1
  23. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  24. package/cjs/src/index.d.ts +2 -2
  25. package/cjs/src/index.d.ts.map +1 -1
  26. package/cjs/src/index.js +1 -2
  27. package/cjs/src/index.js.map +1 -1
  28. package/cjs/src/react/all-types-export.d.ts +1 -1
  29. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  30. package/cjs/src/react/all-types-export.js +1 -2
  31. package/cjs/src/react/all-types-export.js.map +1 -1
  32. package/cjs/src/react/util.d.ts +1 -0
  33. package/cjs/src/react/util.d.ts.map +1 -1
  34. package/cjs/src/types.d.ts +105 -143
  35. package/cjs/src/types.d.ts.map +1 -1
  36. package/cjs/src/types.js +103 -98
  37. package/cjs/src/types.js.map +1 -1
  38. package/cjs/src/utils/processData.d.ts +1 -1
  39. package/cjs/src/utils/processData.d.ts.map +1 -1
  40. package/cjs/src/utils/processData.js +8 -8
  41. package/cjs/src/utils/processData.js.map +1 -1
  42. package/cjs/src/utils/processData.spec.js.map +1 -1
  43. package/cjs/src/utils/processTrigger.d.ts +2 -1
  44. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  45. package/cjs/src/utils/processTrigger.js +4 -2
  46. package/cjs/src/utils/processTrigger.js.map +1 -1
  47. package/dist/{index-DvNA626T.js → index-CWQnMX2L.js} +1 -1
  48. package/dist/src/embed/app.d.ts +20 -0
  49. package/dist/src/embed/app.d.ts.map +1 -1
  50. package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
  51. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  52. package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  53. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  54. package/dist/src/embed/search.d.ts.map +1 -1
  55. package/dist/src/embed/ts-embed.d.ts +1 -3
  56. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  57. package/dist/src/index.d.ts +2 -2
  58. package/dist/src/index.d.ts.map +1 -1
  59. package/dist/src/react/all-types-export.d.ts +1 -1
  60. package/dist/src/react/all-types-export.d.ts.map +1 -1
  61. package/dist/src/react/util.d.ts +1 -0
  62. package/dist/src/react/util.d.ts.map +1 -1
  63. package/dist/src/types.d.ts +105 -143
  64. package/dist/src/types.d.ts.map +1 -1
  65. package/dist/src/utils/processData.d.ts +1 -1
  66. package/dist/src/utils/processData.d.ts.map +1 -1
  67. package/dist/src/utils/processTrigger.d.ts +2 -1
  68. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  69. package/dist/tsembed-react.es.js +155 -277
  70. package/dist/tsembed-react.js +299 -497
  71. package/dist/tsembed.es.js +156 -278
  72. package/dist/tsembed.js +299 -497
  73. package/dist/visual-embed-sdk-react-full.d.ts +129 -160
  74. package/dist/visual-embed-sdk-react.d.ts +129 -157
  75. package/dist/visual-embed-sdk.d.ts +129 -160
  76. package/lib/package.json +3 -2
  77. package/lib/src/embed/app.d.ts +20 -0
  78. package/lib/src/embed/app.d.ts.map +1 -1
  79. package/lib/src/embed/app.js +5 -4
  80. package/lib/src/embed/app.js.map +1 -1
  81. package/lib/src/embed/app.spec.js +32 -0
  82. package/lib/src/embed/app.spec.js.map +1 -1
  83. package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
  84. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  85. package/lib/src/embed/hostEventClient/contracts.js +0 -1
  86. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  87. package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  88. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  89. package/lib/src/embed/hostEventClient/host-event-client.js +6 -6
  90. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  91. package/lib/src/embed/search.d.ts.map +1 -1
  92. package/lib/src/embed/search.js +1 -3
  93. package/lib/src/embed/search.js.map +1 -1
  94. package/lib/src/embed/ts-embed.d.ts +1 -3
  95. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  96. package/lib/src/embed/ts-embed.js +16 -44
  97. package/lib/src/embed/ts-embed.js.map +1 -1
  98. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  99. package/lib/src/index.d.ts +2 -2
  100. package/lib/src/index.d.ts.map +1 -1
  101. package/lib/src/index.js +2 -2
  102. package/lib/src/index.js.map +1 -1
  103. package/lib/src/react/all-types-export.d.ts +1 -1
  104. package/lib/src/react/all-types-export.d.ts.map +1 -1
  105. package/lib/src/react/all-types-export.js +1 -1
  106. package/lib/src/react/all-types-export.js.map +1 -1
  107. package/lib/src/react/util.d.ts +1 -0
  108. package/lib/src/react/util.d.ts.map +1 -1
  109. package/lib/src/types.d.ts +105 -143
  110. package/lib/src/types.d.ts.map +1 -1
  111. package/lib/src/types.js +102 -97
  112. package/lib/src/types.js.map +1 -1
  113. package/lib/src/utils/processData.d.ts +1 -1
  114. package/lib/src/utils/processData.d.ts.map +1 -1
  115. package/lib/src/utils/processData.js +8 -8
  116. package/lib/src/utils/processData.js.map +1 -1
  117. package/lib/src/utils/processData.spec.js.map +1 -1
  118. package/lib/src/utils/processTrigger.d.ts +2 -1
  119. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  120. package/lib/src/utils/processTrigger.js +4 -2
  121. package/lib/src/utils/processTrigger.js.map +1 -1
  122. package/package.json +3 -2
  123. package/src/embed/app.spec.ts +45 -0
  124. package/src/embed/app.ts +26 -4
  125. package/src/embed/hostEventClient/contracts.ts +0 -10
  126. package/src/embed/hostEventClient/host-event-client.ts +7 -3
  127. package/src/embed/search.ts +1 -3
  128. package/src/embed/ts-embed.spec.ts +7 -7
  129. package/src/embed/ts-embed.ts +33 -68
  130. package/src/index.ts +0 -2
  131. package/src/react/all-types-export.ts +0 -1
  132. package/src/types.ts +104 -145
  133. package/src/utils/processData.spec.ts +1 -0
  134. package/src/utils/processData.ts +11 -11
  135. package/src/utils/processTrigger.ts +5 -2
  136. package/cjs/src/api-intercept.d.ts +0 -31
  137. package/cjs/src/api-intercept.d.ts.map +0 -1
  138. package/cjs/src/api-intercept.js +0 -117
  139. package/cjs/src/api-intercept.js.map +0 -1
  140. package/cjs/src/api-intercept.spec.d.ts +0 -2
  141. package/cjs/src/api-intercept.spec.d.ts.map +0 -1
  142. package/cjs/src/api-intercept.spec.js +0 -122
  143. package/cjs/src/api-intercept.spec.js.map +0 -1
  144. package/dist/index-BCC3Z072.js +0 -7371
  145. package/dist/index-BEzW4MDA.js +0 -7371
  146. package/dist/index-BaESA9rq.js +0 -7371
  147. package/dist/index-CFNZIcKr.js +0 -7447
  148. package/dist/index-DFnPKcjZ.js +0 -7447
  149. package/dist/index-DhFH7b7U.js +0 -7447
  150. package/dist/src/api-intercept.d.ts +0 -31
  151. package/dist/src/api-intercept.d.ts.map +0 -1
  152. package/dist/src/api-intercept.spec.d.ts +0 -2
  153. package/dist/src/api-intercept.spec.d.ts.map +0 -1
  154. package/lib/src/api-intercept.d.ts +0 -31
  155. package/lib/src/api-intercept.d.ts.map +0 -1
  156. package/lib/src/api-intercept.js +0 -110
  157. package/lib/src/api-intercept.js.map +0 -1
  158. package/lib/src/api-intercept.spec.d.ts +0 -2
  159. package/lib/src/api-intercept.spec.d.ts.map +0 -1
  160. package/lib/src/api-intercept.spec.js +0 -119
  161. package/lib/src/api-intercept.spec.js.map +0 -1
  162. package/src/api-intercept.ts +0 -136
package/dist/tsembed.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.6 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.42.1 */
2
2
  'use client';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -32,7 +32,7 @@
32
32
  }
33
33
  return false;
34
34
  };
35
- const merge$1 = (...objects) => objects.reduce((result, current) => {
35
+ const merge = (...objects) => objects.reduce((result, current) => {
36
36
  if (Array.isArray(current)) {
37
37
  throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
38
38
  }
@@ -41,19 +41,19 @@
41
41
  return;
42
42
  }
43
43
  if (Array.isArray(result[key]) && Array.isArray(current[key])) {
44
- result[key] = merge$1.options.mergeArrays
45
- ? merge$1.options.uniqueArrayItems
44
+ result[key] = merge.options.mergeArrays
45
+ ? merge.options.uniqueArrayItems
46
46
  ? Array.from(new Set(result[key].concat(current[key])))
47
47
  : [...result[key], ...current[key]]
48
48
  : current[key];
49
49
  }
50
50
  else if (isObject$1(result[key]) && isObject$1(current[key])) {
51
- result[key] = merge$1(result[key], current[key]);
51
+ result[key] = merge(result[key], current[key]);
52
52
  }
53
53
  else {
54
54
  result[key] =
55
55
  current[key] === undefined
56
- ? merge$1.options.allowUndefinedOverrides
56
+ ? merge.options.allowUndefinedOverrides
57
57
  ? current[key]
58
58
  : result[key]
59
59
  : current[key];
@@ -66,11 +66,11 @@
66
66
  mergeArrays: true,
67
67
  uniqueArrayItems: true,
68
68
  };
69
- merge$1.options = defaultOptions;
70
- merge$1.withOptions = (options, ...objects) => {
71
- merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
72
- const result = merge$1(...objects);
73
- merge$1.options = defaultOptions;
69
+ merge.options = defaultOptions;
70
+ merge.withOptions = (options, ...objects) => {
71
+ merge.options = Object.assign(Object.assign({}, defaultOptions), options);
72
+ const result = merge(...objects);
73
+ merge.options = defaultOptions;
74
74
  return result;
75
75
  };
76
76
 
@@ -271,7 +271,7 @@
271
271
  function getDOMNode(domSelector) {
272
272
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
273
273
  }
274
- const deepMerge = (target, source) => merge$1(target, source);
274
+ const deepMerge = (target, source) => merge(target, source);
275
275
  const getOperationNameFromQuery = (query) => {
276
276
  const regex = /(?:query|mutation)\s+(\w+)/;
277
277
  const matches = query.match(regex);
@@ -922,7 +922,7 @@
922
922
  */
923
923
  EmbedEvent["Load"] = "load";
924
924
  /**
925
- * Data pertaining to an Answer or Liveboard is received.
925
+ * Data pertaining to an Answer, Liveboard or Spotter visualization is received.
926
926
  * The event payload includes the raw data of the object.
927
927
  * @return data - Answer of Liveboard data
928
928
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
@@ -2005,21 +2005,6 @@
2005
2005
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
2006
2006
  */
2007
2007
  EmbedEvent["OrgSwitched"] = "orgSwitched";
2008
- /**
2009
- * Emitted when the user intercepts a URL.
2010
- *
2011
- * Supported on all embed types.
2012
- *
2013
- * @example
2014
- * ```js
2015
- * embed.on(EmbedEvent.ApiIntercept, (payload) => {
2016
- * console.log('payload', payload);
2017
- * })
2018
- * ```
2019
- *
2020
- * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
2021
- */
2022
- EmbedEvent["ApiIntercept"] = "ApiIntercept";
2023
2008
  })(exports.EmbedEvent || (exports.EmbedEvent = {}));
2024
2009
  /**
2025
2010
  * Event types that can be triggered by the host application
@@ -2308,7 +2293,7 @@
2308
2293
  * the following parameters:
2309
2294
  *
2310
2295
  * @param
2311
- * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2296
+ * `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
2312
2297
  * Optional when pinning a new chart or table generated from a Search query.
2313
2298
  * **Required** in Spotter Embed.
2314
2299
  * @param
@@ -2360,10 +2345,16 @@
2360
2345
  * ```
2361
2346
  * @example
2362
2347
  * ```js
2363
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Pin, {
2364
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2365
- * });
2366
- * ```
2348
+
2349
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2350
+ * let latestSpotterVizId = '';
2351
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2352
+ * latestSpotterVizId = payload.data.id;
2353
+ * });
2354
+ *
2355
+ * spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
2356
+ * ```
2357
+ *
2367
2358
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2368
2359
  */
2369
2360
  HostEvent["Pin"] = "pin";
@@ -2438,10 +2429,15 @@
2438
2429
  * ```
2439
2430
  * @example
2440
2431
  * ```js
2441
- * spotterEmbed.trigger(HostEvent.DownloadAsPdf, {
2442
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2443
- * });
2444
- * ```
2432
+
2433
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
2434
+ * let latestSpotterVizId = '';
2435
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2436
+ * latestSpotterVizId = payload.data.id;
2437
+ * });
2438
+ *
2439
+ * spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
2440
+ * ```
2445
2441
  *
2446
2442
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2447
2443
  */
@@ -2468,10 +2464,14 @@
2468
2464
  * ```
2469
2465
  * @example
2470
2466
  * ```js
2471
- * const pinResponse = await spotterEmbed.trigger(HostEvent.MakeACopy, {
2472
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2473
- * });
2474
- * ```
2467
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
2468
+ * let latestSpotterVizId = '';
2469
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2470
+ * latestSpotterVizId = payload.data.id;
2471
+ * });
2472
+ *
2473
+ * spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
2474
+ * ```
2475
2475
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2476
2476
  */
2477
2477
  HostEvent["MakeACopy"] = "makeACopy";
@@ -2556,15 +2556,7 @@
2556
2556
  * ```
2557
2557
  * @example
2558
2558
  * ```js
2559
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2560
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2561
- * });
2562
- * ```
2563
- * @example
2564
- * ```js
2565
- * const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2566
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2567
- * });
2559
+ * spotterEmbed.trigger(HostEvent.Edit);
2568
2560
  * ```
2569
2561
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2570
2562
  */
@@ -2613,16 +2605,23 @@
2613
2605
  * );
2614
2606
  * })
2615
2607
  * ```
2616
- * @example
2608
+ * * @example
2617
2609
  * ```js
2618
- * spotterEmbed.trigger(HostEvent.GetTML, {
2619
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2610
+
2611
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2612
+ * let latestSpotterVizId = '';
2613
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2614
+ * latestSpotterVizId = payload.data.id;
2615
+ * });
2616
+ *
2617
+ * spotterEmbed.trigger(HostEvent.GetTML, {
2618
+ * vizId: latestSpotterVizId
2620
2619
  * }).then((tml) => {
2621
2620
  * console.log(
2622
2621
  * tml.answer.search_query // TML representation of the search query
2623
2622
  * );
2624
2623
  * })
2625
- * ```
2624
+ * ```
2626
2625
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
2627
2626
  * @important
2628
2627
  */
@@ -2686,7 +2685,7 @@
2686
2685
  /**
2687
2686
  * Trigger the **Download** action on charts in
2688
2687
  * the embedded view.
2689
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2688
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2690
2689
  * @example
2691
2690
  * ```js
2692
2691
  * liveboardEmbed.trigger(HostEvent.Download, {vizId:
@@ -2696,10 +2695,14 @@
2696
2695
  * embed.trigger(HostEvent.Download)
2697
2696
  * ```
2698
2697
  * ```js
2699
- * spotterEmbed.trigger(HostEvent.Download, {
2700
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2701
- * });
2702
- * ```
2698
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
2699
+ * let latestSpotterVizId = '';
2700
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2701
+ * latestSpotterVizId = payload.data.id;
2702
+ * });
2703
+ *
2704
+ * spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
2705
+ * ```
2703
2706
  * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
2704
2707
  * Use {@link DownloadAsPng}
2705
2708
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
@@ -2717,9 +2720,13 @@
2717
2720
  *
2718
2721
  * searchEmbed.trigger(HostEvent.DownloadAsPng)
2719
2722
  *
2720
- * spotterEmbed.trigger(HostEvent.DownloadAsPng, {
2721
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2722
- * })
2723
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
2724
+ * let latestSpotterVizId = '';
2725
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2726
+ * latestSpotterVizId = payload.data.id;
2727
+ * });
2728
+ *
2729
+ * spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
2723
2730
  * ```
2724
2731
  *
2725
2732
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
@@ -2728,7 +2735,7 @@
2728
2735
  /**
2729
2736
  * Trigger the **Download** > **CSV** action on tables in
2730
2737
  * the embedded view.
2731
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2738
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2732
2739
  * @example
2733
2740
  * ```js
2734
2741
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
@@ -2741,9 +2748,13 @@
2741
2748
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
2742
2749
  * ```
2743
2750
  * ```js
2744
- * spotterEmbed.trigger(HostEvent.DownloadAsCsv, {
2745
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2746
- * })
2751
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
2752
+ * let latestSpotterVizId = '';
2753
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2754
+ * latestSpotterVizId = payload.data.id;
2755
+ * });
2756
+ *
2757
+ * spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
2747
2758
  * ```
2748
2759
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2749
2760
  */
@@ -2751,7 +2762,7 @@
2751
2762
  /**
2752
2763
  * Trigger the **Download** > **XLSX** action on tables
2753
2764
  * in the embedded view.
2754
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2765
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2755
2766
  * @example
2756
2767
  * ```js
2757
2768
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
@@ -2764,9 +2775,13 @@
2764
2775
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
2765
2776
  * ```
2766
2777
  * ```js
2767
- * spotterEmbed.trigger(HostEvent.downloadAsXLSX, {
2768
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2769
- * })
2778
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
2779
+ * let latestSpotterVizId = '';
2780
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2781
+ * latestSpotterVizId = payload.data.id;
2782
+ * });
2783
+ *
2784
+ * spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
2770
2785
  * ```
2771
2786
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2772
2787
  */
@@ -2803,7 +2818,7 @@
2803
2818
  * ```
2804
2819
  *
2805
2820
  * ```js
2806
- * // Save an Answer in Spotter (requires vizId)
2821
+ * // Save a Visualization in Spotter (requires vizId)
2807
2822
  * spotterEmbed.trigger(HostEvent.Save, {
2808
2823
  * vizId: "730496d6-6903-4601-937e-2c691821af3c"
2809
2824
  * })
@@ -3125,11 +3140,13 @@
3125
3140
  * });
3126
3141
  *```
3127
3142
  *```js
3128
- * spotterEmbed.trigger(HostEvent.GetParameters, {
3129
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
3130
- * }).then((parameter) => {
3131
- * console.log('parameters', parameter);
3132
- * });
3143
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
3144
+ * let latestSpotterVizId = '';
3145
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3146
+ * latestSpotterVizId = payload.data.id;
3147
+ * });
3148
+ *
3149
+ * spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
3133
3150
  *```
3134
3151
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
3135
3152
  */
@@ -3172,11 +3189,13 @@
3172
3189
  * ```
3173
3190
  * @example
3174
3191
  * ```js
3175
- * const saveAnswerResponse = await spotterEmbed.trigger(HostEvent.SaveAnswer, {
3176
- * vizId: '730496d6-6903-4601-937e-2c691821af3c',
3177
- * name: "Sales by states",
3178
- * description: "Total sales by states in MidWest"
3192
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
3193
+ * let latestSpotterVizId = '';
3194
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3195
+ * latestSpotterVizId = payload.data.id;
3179
3196
  * });
3197
+ *
3198
+ * spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
3180
3199
  * ```
3181
3200
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
3182
3201
  */
@@ -3260,12 +3279,15 @@
3260
3279
  HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
3261
3280
  /**
3262
3281
  * Toggle the visualization to chart or table view.
3263
- * @param - `vizId ` refers to the answer id in spotter Embed, it is required in spotter Embed.
3282
+ * @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
3264
3283
  * @example
3265
3284
  * ```js
3266
- * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, {
3267
- * vizId:'b535c760-8bbe-4e6f-bb26-af56b4129a1e'
3285
+ * let latestSpotterVizId = '';
3286
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3287
+ * latestSpotterVizId = payload.data.id;
3268
3288
  * });
3289
+ *
3290
+ * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
3269
3291
  *```
3270
3292
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
3271
3293
  */
@@ -3294,12 +3316,16 @@
3294
3316
  */
3295
3317
  HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
3296
3318
  /**
3297
- * Trigger the *Ask Spotter* action for visualizations
3298
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3319
+ * Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
3320
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
3299
3321
  * @example
3300
3322
  * ```js
3301
- * spotterEmbed.trigger(HostEvent.AskSpotter,
3302
- * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
3323
+ * let latestSpotterVizId = '';
3324
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3325
+ * latestSpotterVizId = payload.data.id;
3326
+ * });
3327
+ *
3328
+ * spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
3303
3329
  * ```
3304
3330
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
3305
3331
  */
@@ -3357,6 +3383,7 @@
3357
3383
  Param["HideResult"] = "hideResult";
3358
3384
  Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
3359
3385
  Param["Tag"] = "tag";
3386
+ Param["HideTagFilterChips"] = "hideTagFilterChips";
3360
3387
  Param["AutoLogin"] = "autoLogin";
3361
3388
  Param["searchTokenString"] = "searchTokenString";
3362
3389
  Param["executeSearch"] = "executeSearch";
@@ -4887,29 +4914,7 @@
4887
4914
  * @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
4888
4915
  */
4889
4916
  LogLevel["TRACE"] = "TRACE";
4890
- })(exports.LogLevel || (exports.LogLevel = {}));
4891
- /**
4892
- * Enum for the type of API intercepted
4893
- */
4894
- exports.InterceptedApiType = void 0;
4895
- (function (InterceptedApiType) {
4896
- /**
4897
- * The apis that are use to get the metadata for the embed
4898
- */
4899
- InterceptedApiType["METADATA"] = "METADATA";
4900
- /**
4901
- * The apis that are use to get the data for the embed
4902
- */
4903
- InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
4904
- /**
4905
- * This will intercept all the apis
4906
- */
4907
- InterceptedApiType["ALL"] = "ALL";
4908
- /**
4909
- * The apis that are use to get the data for the liveboard
4910
- */
4911
- InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
4912
- })(exports.InterceptedApiType || (exports.InterceptedApiType = {}));
4917
+ })(exports.LogLevel || (exports.LogLevel = {}));
4913
4918
 
4914
4919
  const logFunctions = {
4915
4920
  [exports.LogLevel.SILENT]: () => undefined,
@@ -7255,17 +7260,6 @@
7255
7260
 
7256
7261
  var isEmpty_1 = isEmpty$1;
7257
7262
 
7258
- exports.UIPassthroughEvent = void 0;
7259
- (function (UIPassthroughEvent) {
7260
- UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
7261
- UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
7262
- UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
7263
- UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
7264
- UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
7265
- UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
7266
- UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
7267
- })(exports.UIPassthroughEvent || (exports.UIPassthroughEvent = {}));
7268
-
7269
7263
  const ERROR_MESSAGE = {
7270
7264
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
7271
7265
  SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
@@ -17516,27 +17510,27 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17516
17510
  * @param thoughtSpotHost
17517
17511
  * @param containerEl
17518
17512
  */
17519
- function processEventData(type, eventData, thoughtSpotHost, containerEl) {
17513
+ function processEventData(type, e, thoughtSpotHost, containerEl) {
17520
17514
  switch (type) {
17521
17515
  case exports.EmbedEvent.CustomAction:
17522
- return processCustomAction(eventData, thoughtSpotHost);
17516
+ return processCustomAction(e, thoughtSpotHost);
17523
17517
  case exports.EmbedEvent.AuthInit:
17524
- return processAuthInit(eventData);
17518
+ return processAuthInit(e);
17525
17519
  case exports.EmbedEvent.NoCookieAccess:
17526
- return processNoCookieAccess(eventData, containerEl);
17520
+ return processNoCookieAccess(e, containerEl);
17527
17521
  case exports.EmbedEvent.AuthFailure:
17528
- return processAuthFailure(eventData, containerEl);
17522
+ return processAuthFailure(e, containerEl);
17529
17523
  case exports.EmbedEvent.AuthLogout:
17530
- return processAuthLogout(eventData, containerEl);
17524
+ return processAuthLogout(e, containerEl);
17531
17525
  case exports.EmbedEvent.ExitPresentMode:
17532
17526
  return processExitPresentMode();
17533
17527
  case exports.EmbedEvent.CLEAR_INFO_CACHE:
17534
17528
  return processClearInfoCache();
17535
17529
  }
17536
- return eventData;
17530
+ return e;
17537
17531
  }
17538
17532
 
17539
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1-alpha.6";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
17533
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
17540
17534
 
17541
17535
  /**
17542
17536
  * Reloads the ThoughtSpot iframe.
@@ -17555,6 +17549,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17555
17549
  * @param message
17556
17550
  * @param message.type
17557
17551
  * @param message.data
17552
+ * @param message.context
17558
17553
  * @param thoughtSpotHost
17559
17554
  * @param channel
17560
17555
  */
@@ -17569,8 +17564,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17569
17564
  * @param messageType
17570
17565
  * @param thoughtSpotHost
17571
17566
  * @param data
17567
+ * @param context
17572
17568
  */
17573
- function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
17569
+ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
17574
17570
  return new Promise((res, rej) => {
17575
17571
  var _a;
17576
17572
  if (messageType === exports.HostEvent.Reload) {
@@ -17604,10 +17600,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17604
17600
  channel.port1.close();
17605
17601
  res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
17606
17602
  }, TRIGGER_TIMEOUT);
17607
- return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
17603
+ return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
17608
17604
  });
17609
17605
  }
17610
17606
 
17607
+ exports.UIPassthroughEvent = void 0;
17608
+ (function (UIPassthroughEvent) {
17609
+ UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
17610
+ UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
17611
+ UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
17612
+ UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
17613
+ UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
17614
+ UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
17615
+ })(exports.UIPassthroughEvent || (exports.UIPassthroughEvent = {}));
17616
+
17611
17617
  class HostEventClient {
17612
17618
  constructor(iFrame) {
17613
17619
  this.iFrame = iFrame;
@@ -17618,12 +17624,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17618
17624
  * @param {any} data Data to send with the host event
17619
17625
  * @returns {Promise<any>} - the response from the process trigger
17620
17626
  */
17621
- async processTrigger(message, data) {
17627
+ async processTrigger(message, data, context) {
17622
17628
  if (!this.iFrame) {
17623
17629
  throw new Error('Iframe element is not set');
17624
17630
  }
17625
17631
  const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
17626
- return processTrigger(this.iFrame, message, thoughtspotHost, data);
17632
+ return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
17627
17633
  }
17628
17634
  async handleHostEventWithParam(apiName, parameters) {
17629
17635
  var _a, _b, _c, _d;
@@ -17642,8 +17648,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17642
17648
  }
17643
17649
  return { ...response.value };
17644
17650
  }
17645
- async hostEventFallback(hostEvent, data) {
17646
- return this.processTrigger(hostEvent, data);
17651
+ async hostEventFallback(hostEvent, data, context) {
17652
+ return this.processTrigger(hostEvent, data, context);
17647
17653
  }
17648
17654
  /**
17649
17655
  * Setter for the iframe element used for host events
@@ -17687,121 +17693,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17687
17693
  answerId: (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.saveResponse) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Answer__save) === null || _c === void 0 ? void 0 : _c.answer) === null || _d === void 0 ? void 0 : _d.id,
17688
17694
  };
17689
17695
  }
17690
- async triggerHostEvent(hostEvent, payload) {
17696
+ async triggerHostEvent(hostEvent, payload, context) {
17691
17697
  switch (hostEvent) {
17692
17698
  case exports.HostEvent.Pin:
17693
17699
  return this.handlePinEvent(payload);
17694
17700
  case exports.HostEvent.SaveAnswer:
17695
17701
  return this.handleSaveAnswerEvent(payload);
17696
17702
  default:
17697
- return this.hostEventFallback(hostEvent, payload);
17703
+ return this.hostEventFallback(hostEvent, payload, context);
17698
17704
  }
17699
17705
  }
17700
17706
  }
17701
17707
 
17702
- const defaultUrls = {
17703
- [exports.InterceptedApiType.METADATA]: [
17704
- '/prism/?op=CreateAnswerSession',
17705
- '/prism/?op=GetV2SourceDetail',
17706
- ],
17707
- [exports.InterceptedApiType.ANSWER_DATA]: [
17708
- '/prism/?op=GetChartWithData',
17709
- '/prism/?op=GetTableWithHeadlineData',
17710
- ],
17711
- [exports.InterceptedApiType.LIVEBOARD_DATA]: [
17712
- '/prism/?op=LoadContextBook'
17713
- ],
17714
- };
17715
- const formatInterceptUrl = (url) => {
17716
- const host = getThoughtSpotHost(getEmbedConfig());
17717
- if (url.startsWith('/'))
17718
- return `${host}${url}`;
17719
- return url;
17720
- };
17721
- const processInterceptUrls = (interceptUrls) => {
17722
- let processedUrls = [...interceptUrls];
17723
- Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
17724
- if (!processedUrls.includes(apiType))
17725
- return;
17726
- processedUrls = processedUrls.filter(url => url !== apiType);
17727
- processedUrls = [...processedUrls, ...apiTypeUrls];
17728
- });
17729
- return processedUrls.map(url => formatInterceptUrl(url));
17730
- };
17731
- const getInterceptInitData = (embedConfig, viewConfig) => {
17732
- const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
17733
- if (!enableApiIntercept)
17734
- return {
17735
- enableApiIntercept: false,
17736
- };
17737
- const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
17738
- if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17739
- combinedUrls.push(exports.InterceptedApiType.ANSWER_DATA);
17740
- }
17741
- const shouldInterceptAll = combinedUrls.includes(exports.InterceptedApiType.ALL);
17742
- const interceptUrls = shouldInterceptAll ? [exports.InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
17743
- const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
17744
- return {
17745
- interceptUrls,
17746
- interceptTimeout,
17747
- enableApiIntercept,
17748
- };
17749
- };
17750
- /**
17751
- *
17752
- * @param fetchInit
17753
- */
17754
- const parseInterceptData = (eventDataString) => {
17755
- try {
17756
- const { input, init } = JSON.parse(eventDataString);
17757
- init.body = JSON.parse(init.body);
17758
- const parsedInit = { input, init };
17759
- return [parsedInit, null];
17760
- }
17761
- catch (error) {
17762
- return [null, error];
17763
- }
17764
- };
17765
- const handleInterceptEvent = async (params) => {
17766
- var _a, _b, _c, _d, _e;
17767
- const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
17768
- const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
17769
- if (bodyParseError) {
17770
- executeEvent(exports.EmbedEvent.Error, {
17771
- error: 'Error parsing api intercept body',
17772
- });
17773
- logger$3.error('Error parsing request body', bodyParseError);
17774
- return;
17775
- }
17776
- const { input: requestUrl, init } = interceptData;
17777
- const sessionId = (_c = (_b = (_a = init === null || init === void 0 ? void 0 : init.body) === null || _a === void 0 ? void 0 : _a.variables) === null || _b === void 0 ? void 0 : _b.session) === null || _c === void 0 ? void 0 : _c.sessionId;
17778
- const vizId = (_e = (_d = init === null || init === void 0 ? void 0 : init.body) === null || _d === void 0 ? void 0 : _d.variables) === null || _e === void 0 ? void 0 : _e.contextBookId;
17779
- if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17780
- const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
17781
- executeEvent(exports.EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
17782
- }
17783
- executeEvent(exports.EmbedEvent.ApiIntercept, interceptData);
17784
- };
17785
- const processLegacyInterceptResponse = (payload) => {
17786
- var _a, _b, _c;
17787
- const payloadToSend = {
17788
- execute: (_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.execute,
17789
- response: {
17790
- body: {
17791
- errors: [
17792
- {
17793
- title: (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.errorText,
17794
- message: (_c = payload === null || payload === void 0 ? void 0 : payload.data) === null || _c === void 0 ? void 0 : _c.errorDescription,
17795
- isUserError: true,
17796
- },
17797
- ],
17798
- data: {},
17799
- },
17800
- },
17801
- };
17802
- return { data: payloadToSend };
17803
- };
17804
-
17805
17708
  /**
17806
17709
  * Copyright (c) 2022
17807
17710
  *
@@ -17855,27 +17758,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17855
17758
  */
17856
17759
  this.fullscreenChangeHandler = null;
17857
17760
  this.subscribedListeners = {};
17858
- this.messageEventListener = async (event) => {
17859
- const eventType = this.getEventType(event);
17860
- const eventPort = this.getEventPort(event);
17861
- const eventData = this.formatEventData(event, eventType);
17862
- if (event.source === this.iFrame.contentWindow) {
17863
- const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
17864
- const executeEvent = (_eventType, data) => {
17865
- this.executeCallbacks(_eventType, data, eventPort);
17866
- };
17867
- if (eventType === exports.EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
17868
- const getUnsavedAnswerTml = async (props) => {
17869
- var _a;
17870
- const response = await this.triggerUIPassThrough(exports.UIPassthroughEvent.GetUnsavedAnswerTML, props);
17871
- return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
17872
- };
17873
- handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
17874
- return;
17875
- }
17876
- this.executeCallbacks(eventType, processedEventData, eventPort);
17877
- }
17878
- };
17879
17761
  /**
17880
17762
  * Send Custom style as part of payload of APP_INIT
17881
17763
  * @param _
@@ -17960,18 +17842,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17960
17842
  this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
17961
17843
  };
17962
17844
  this.showPreRenderByDefault = false;
17963
- this.createEmbedEventResponder = (eventPort, eventType) => {
17964
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
17965
- if (eventType === exports.EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
17966
- return (payload) => {
17967
- const payloadToSend = processLegacyInterceptResponse(payload);
17968
- this.triggerEventOnPort(eventPort, payloadToSend);
17969
- };
17970
- }
17971
- return (payload) => {
17972
- this.triggerEventOnPort(eventPort, payload);
17973
- };
17974
- };
17975
17845
  /**
17976
17846
  * @hidden
17977
17847
  * Internal state to track if the embed container is loaded.
@@ -18157,8 +18027,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18157
18027
  */
18158
18028
  subscribeToMessageEvents() {
18159
18029
  this.unsubscribeToMessageEvents();
18160
- window.addEventListener('message', this.messageEventListener);
18161
- this.subscribedListeners.message = this.messageEventListener;
18030
+ const messageEventListener = (event) => {
18031
+ const eventType = this.getEventType(event);
18032
+ const eventPort = this.getEventPort(event);
18033
+ const eventData = this.formatEventData(event, eventType);
18034
+ if (event.source === this.iFrame.contentWindow) {
18035
+ this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
18036
+ }
18037
+ };
18038
+ window.addEventListener('message', messageEventListener);
18039
+ this.subscribedListeners.message = messageEventListener;
18162
18040
  }
18163
18041
  /**
18164
18042
  * Adds event listeners for both network and message events.
@@ -18219,7 +18097,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18219
18097
  message: customActionsResult.errors,
18220
18098
  });
18221
18099
  }
18222
- const baseInitData = {
18100
+ return {
18223
18101
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
18224
18102
  authToken,
18225
18103
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -18237,9 +18115,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18237
18115
  customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
18238
18116
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
18239
18117
  customActions: customActionsResult.actions,
18240
- ...getInterceptInitData(this.embedConfig, this.viewConfig),
18241
18118
  };
18242
- return baseInitData;
18243
18119
  }
18244
18120
  async getAppInitData() {
18245
18121
  return this.getDefaultAppInitData();
@@ -18668,8 +18544,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18668
18544
  // When start status is false it trigger only end releated
18669
18545
  // payload
18670
18546
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
18671
- const responder = this.createEmbedEventResponder(eventPort, eventType);
18672
- callbackObj.callback(data, responder);
18547
+ callbackObj.callback(data, (payload) => {
18548
+ this.triggerEventOnPort(eventPort, payload);
18549
+ });
18673
18550
  }
18674
18551
  });
18675
18552
  }
@@ -18844,7 +18721,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18844
18721
  * @param {any} data The payload to send with the message
18845
18722
  * @returns A promise that resolves with the response from the embedded app
18846
18723
  */
18847
- async trigger(messageType, data = {}) {
18724
+ async trigger(messageType, data = {}, context = {}) {
18848
18725
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
18849
18726
  if (!this.isRendered) {
18850
18727
  this.handleError('Please call render before triggering events');
@@ -18861,7 +18738,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18861
18738
  return null;
18862
18739
  }
18863
18740
  // send an empty object, this is needed for liveboard default handlers
18864
- return this.hostEventClient.triggerHostEvent(messageType, data);
18741
+ return this.hostEventClient.triggerHostEvent(messageType, data, context);
18865
18742
  }
18866
18743
  /**
18867
18744
  * Triggers an event to the embedded app, skipping the UI flow.
@@ -19379,7 +19256,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19379
19256
  * embedded Liveboard or visualization.
19380
19257
  */
19381
19258
  getEmbedParams() {
19382
- const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
19259
+ const { tag, hideTagFilterChips, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
19383
19260
  let params = {};
19384
19261
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
19385
19262
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -19432,8 +19309,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19432
19309
  if (enableAskSage) {
19433
19310
  params[Param.enableAskSage] = enableAskSage;
19434
19311
  }
19435
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19436
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19312
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19437
19313
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19438
19314
  }
19439
19315
  if (homePageSearchBarMode) {
@@ -19448,6 +19324,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19448
19324
  if (isPNGInScheduledEmailsEnabled !== undefined) {
19449
19325
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
19450
19326
  }
19327
+ if (hideTagFilterChips !== undefined) {
19328
+ params[Param.HideTagFilterChips] = hideTagFilterChips;
19329
+ }
19451
19330
  if (isLinkParametersEnabled !== undefined) {
19452
19331
  params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19453
19332
  }
@@ -20159,8 +20038,7 @@ query GetEurekaVizSnapshots(
20159
20038
  if (hideSearchBar) {
20160
20039
  queryParams[Param.HideSearchBar] = true;
20161
20040
  }
20162
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
20163
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
20041
+ if (isOnBeforeGetVizDataInterceptEnabled) {
20164
20042
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
20165
20043
  }
20166
20044
  if (!focusSearchBarOnRender) {
@@ -22029,7 +21907,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22029
21907
  return {
22030
21908
  onAnchor: (source) => {
22031
21909
  aliasObjects.push(source);
22032
- prevAnchors ?? (prevAnchors = anchorNames(doc));
21910
+ if (!prevAnchors)
21911
+ prevAnchors = anchorNames(doc);
22033
21912
  const anchor = findNewAnchor(prefix, prevAnchors);
22034
21913
  prevAnchors.add(anchor);
22035
21914
  return anchor;
@@ -22193,36 +22072,23 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22193
22072
  * Resolve the value of this alias within `doc`, finding the last
22194
22073
  * instance of the `source` anchor before this node.
22195
22074
  */
22196
- resolve(doc, ctx) {
22197
- let nodes;
22198
- if (ctx?.aliasResolveCache) {
22199
- nodes = ctx.aliasResolveCache;
22200
- }
22201
- else {
22202
- nodes = [];
22203
- visit$1(doc, {
22204
- Node: (_key, node) => {
22205
- if (isAlias(node) || hasAnchor(node))
22206
- nodes.push(node);
22207
- }
22208
- });
22209
- if (ctx)
22210
- ctx.aliasResolveCache = nodes;
22211
- }
22075
+ resolve(doc) {
22212
22076
  let found = undefined;
22213
- for (const node of nodes) {
22214
- if (node === this)
22215
- break;
22216
- if (node.anchor === this.source)
22217
- found = node;
22218
- }
22077
+ visit$1(doc, {
22078
+ Node: (_key, node) => {
22079
+ if (node === this)
22080
+ return visit$1.BREAK;
22081
+ if (node.anchor === this.source)
22082
+ found = node;
22083
+ }
22084
+ });
22219
22085
  return found;
22220
22086
  }
22221
22087
  toJSON(_arg, ctx) {
22222
22088
  if (!ctx)
22223
22089
  return { source: this.source };
22224
22090
  const { anchors, doc, maxAliasCount } = ctx;
22225
- const source = this.resolve(doc, ctx);
22091
+ const source = this.resolve(doc);
22226
22092
  if (!source) {
22227
22093
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
22228
22094
  throw new ReferenceError(msg);
@@ -22341,7 +22207,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22341
22207
  if (aliasDuplicateObjects && value && typeof value === 'object') {
22342
22208
  ref = sourceObjects.get(value);
22343
22209
  if (ref) {
22344
- ref.anchor ?? (ref.anchor = onAnchor(value));
22210
+ if (!ref.anchor)
22211
+ ref.anchor = onAnchor(value);
22345
22212
  return new Alias(ref.anchor);
22346
22213
  }
22347
22214
  else {
@@ -22852,7 +22719,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22852
22719
  const { blockQuote, commentString, lineWidth } = ctx.options;
22853
22720
  // 1. Block can't end in whitespace unless the last line is non-empty.
22854
22721
  // 2. Strings consisting of only whitespace are best rendered explicitly.
22855
- if (!blockQuote || /\n[\t ]+$/.test(value)) {
22722
+ if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
22856
22723
  return quotedString(value, ctx);
22857
22724
  }
22858
22725
  const indent = ctx.indent ||
@@ -22912,32 +22779,23 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22912
22779
  start = start.replace(/\n+/g, `$&${indent}`);
22913
22780
  }
22914
22781
  const indentSize = indent ? '2' : '1'; // root is at -1
22915
- // Leading | or > is added later
22916
- let header = (startWithSpace ? indentSize : '') + chomp;
22782
+ let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
22917
22783
  if (comment) {
22918
22784
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
22919
22785
  if (onComment)
22920
22786
  onComment();
22921
22787
  }
22922
- if (!literal) {
22923
- const foldedValue = value
22924
- .replace(/\n+/g, '\n$&')
22925
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22926
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22927
- .replace(/\n+/g, `$&${indent}`);
22928
- let literalFallback = false;
22929
- const foldOptions = getFoldOptions(ctx, true);
22930
- if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
22931
- foldOptions.onOverflow = () => {
22932
- literalFallback = true;
22933
- };
22934
- }
22935
- const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
22936
- if (!literalFallback)
22937
- return `>${header}\n${indent}${body}`;
22788
+ if (literal) {
22789
+ value = value.replace(/\n+/g, `$&${indent}`);
22790
+ return `${header}\n${indent}${start}${value}${end}`;
22938
22791
  }
22939
- value = value.replace(/\n+/g, `$&${indent}`);
22940
- return `|${header}\n${indent}${start}${value}${end}`;
22792
+ value = value
22793
+ .replace(/\n+/g, '\n$&')
22794
+ .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22795
+ // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22796
+ .replace(/\n+/g, `$&${indent}`);
22797
+ const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
22798
+ return `${header}\n${indent}${body}`;
22941
22799
  }
22942
22800
  function plainString(item, ctx, onComment, onChompKeep) {
22943
22801
  const { type, value } = item;
@@ -22946,9 +22804,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22946
22804
  (inFlow && /[[\]{},]/.test(value))) {
22947
22805
  return quotedString(value, ctx);
22948
22806
  }
22949
- if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22807
+ if (!value ||
22808
+ /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22950
22809
  // not allowed:
22951
- // - '-' or '?'
22810
+ // - empty string, '-' or '?'
22952
22811
  // - start with an indicator character (except [?:-]) or /[?-] /
22953
22812
  // - '\n ', ': ' or ' \n' anywhere
22954
22813
  // - '#' not preceded by a non-space char
@@ -23077,12 +22936,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23077
22936
  let obj;
23078
22937
  if (isScalar$1(item)) {
23079
22938
  obj = item.value;
23080
- let match = tags.filter(t => t.identify?.(obj));
23081
- if (match.length > 1) {
23082
- const testMatch = match.filter(t => t.test);
23083
- if (testMatch.length > 0)
23084
- match = testMatch;
23085
- }
22939
+ const match = tags.filter(t => t.identify?.(obj));
23086
22940
  tagObj =
23087
22941
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
23088
22942
  }
@@ -23091,7 +22945,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23091
22945
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
23092
22946
  }
23093
22947
  if (!tagObj) {
23094
- const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
22948
+ const name = obj?.constructor?.name ?? typeof obj;
23095
22949
  throw new Error(`Tag not resolved for ${name} value`);
23096
22950
  }
23097
22951
  return tagObj;
@@ -23106,7 +22960,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23106
22960
  anchors.add(anchor);
23107
22961
  props.push(`&${anchor}`);
23108
22962
  }
23109
- const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
22963
+ const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
23110
22964
  if (tag)
23111
22965
  props.push(doc.directives.tagString(tag));
23112
22966
  return props.join(' ');
@@ -23132,7 +22986,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23132
22986
  const node = isNode(item)
23133
22987
  ? item
23134
22988
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
23135
- tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
22989
+ if (!tagObj)
22990
+ tagObj = getTagObject(ctx.doc.schema.tags, node);
23136
22991
  const props = stringifyProps(node, tagObj, ctx);
23137
22992
  if (props.length > 0)
23138
22993
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -23294,10 +23149,54 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23294
23149
 
23295
23150
  function warn(logLevel, warning) {
23296
23151
  if (logLevel === 'debug' || logLevel === 'warn') {
23297
- console.warn(warning);
23152
+ if (typeof process !== 'undefined' && process.emitWarning)
23153
+ process.emitWarning(warning);
23154
+ else
23155
+ console.warn(warning);
23298
23156
  }
23299
23157
  }
23300
23158
 
23159
+ const MERGE_KEY = '<<';
23160
+ function addPairToJSMap(ctx, map, { key, value }) {
23161
+ if (ctx?.doc.schema.merge && isMergeKey(key)) {
23162
+ value = isAlias(value) ? value.resolve(ctx.doc) : value;
23163
+ if (isSeq(value))
23164
+ for (const it of value.items)
23165
+ mergeToJSMap(ctx, map, it);
23166
+ else if (Array.isArray(value))
23167
+ for (const it of value)
23168
+ mergeToJSMap(ctx, map, it);
23169
+ else
23170
+ mergeToJSMap(ctx, map, value);
23171
+ }
23172
+ else {
23173
+ const jsKey = toJS(key, '', ctx);
23174
+ if (map instanceof Map) {
23175
+ map.set(jsKey, toJS(value, jsKey, ctx));
23176
+ }
23177
+ else if (map instanceof Set) {
23178
+ map.add(jsKey);
23179
+ }
23180
+ else {
23181
+ const stringKey = stringifyKey(key, jsKey, ctx);
23182
+ const jsValue = toJS(value, stringKey, ctx);
23183
+ if (stringKey in map)
23184
+ Object.defineProperty(map, stringKey, {
23185
+ value: jsValue,
23186
+ writable: true,
23187
+ enumerable: true,
23188
+ configurable: true
23189
+ });
23190
+ else
23191
+ map[stringKey] = jsValue;
23192
+ }
23193
+ }
23194
+ return map;
23195
+ }
23196
+ const isMergeKey = (key) => key === MERGE_KEY ||
23197
+ (isScalar$1(key) &&
23198
+ key.value === MERGE_KEY &&
23199
+ (!key.type || key.type === Scalar.PLAIN));
23301
23200
  // If the value associated with a merge key is a single mapping node, each of
23302
23201
  // its key/value pairs is inserted into the current mapping, unless the key
23303
23202
  // already exists in it. If the value associated with the merge key is a
@@ -23305,35 +23204,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23305
23204
  // of these nodes is merged in turn according to its order in the sequence.
23306
23205
  // Keys in mapping nodes earlier in the sequence override keys specified in
23307
23206
  // later mapping nodes. -- http://yaml.org/type/merge.html
23308
- const MERGE_KEY = '<<';
23309
- const merge = {
23310
- identify: value => value === MERGE_KEY ||
23311
- (typeof value === 'symbol' && value.description === MERGE_KEY),
23312
- default: 'key',
23313
- tag: 'tag:yaml.org,2002:merge',
23314
- test: /^<<$/,
23315
- resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
23316
- addToJSMap: addMergeToJSMap
23317
- }),
23318
- stringify: () => MERGE_KEY
23319
- };
23320
- const isMergeKey = (ctx, key) => (merge.identify(key) ||
23321
- (isScalar$1(key) &&
23322
- (!key.type || key.type === Scalar.PLAIN) &&
23323
- merge.identify(key.value))) &&
23324
- ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
23325
- function addMergeToJSMap(ctx, map, value) {
23326
- value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23327
- if (isSeq(value))
23328
- for (const it of value.items)
23329
- mergeValue(ctx, map, it);
23330
- else if (Array.isArray(value))
23331
- for (const it of value)
23332
- mergeValue(ctx, map, it);
23333
- else
23334
- mergeValue(ctx, map, value);
23335
- }
23336
- function mergeValue(ctx, map, value) {
23207
+ function mergeToJSMap(ctx, map, value) {
23337
23208
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23338
23209
  if (!isMap(source))
23339
23210
  throw new Error('Merge sources must be maps or map aliases');
@@ -23357,41 +23228,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23357
23228
  }
23358
23229
  return map;
23359
23230
  }
23360
-
23361
- function addPairToJSMap(ctx, map, { key, value }) {
23362
- if (isNode(key) && key.addToJSMap)
23363
- key.addToJSMap(ctx, map, value);
23364
- // TODO: Should drop this special case for bare << handling
23365
- else if (isMergeKey(ctx, key))
23366
- addMergeToJSMap(ctx, map, value);
23367
- else {
23368
- const jsKey = toJS(key, '', ctx);
23369
- if (map instanceof Map) {
23370
- map.set(jsKey, toJS(value, jsKey, ctx));
23371
- }
23372
- else if (map instanceof Set) {
23373
- map.add(jsKey);
23374
- }
23375
- else {
23376
- const stringKey = stringifyKey(key, jsKey, ctx);
23377
- const jsValue = toJS(value, stringKey, ctx);
23378
- if (stringKey in map)
23379
- Object.defineProperty(map, stringKey, {
23380
- value: jsValue,
23381
- writable: true,
23382
- enumerable: true,
23383
- configurable: true
23384
- });
23385
- else
23386
- map[stringKey] = jsValue;
23387
- }
23388
- }
23389
- return map;
23390
- }
23391
23231
  function stringifyKey(key, jsKey, ctx) {
23392
23232
  if (jsKey === null)
23393
23233
  return '';
23394
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
23395
23234
  if (typeof jsKey !== 'object')
23396
23235
  return String(jsKey);
23397
23236
  if (isNode(key) && ctx?.doc) {
@@ -24024,7 +23863,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24024
23863
  identify: value => typeof value === 'boolean',
24025
23864
  default: true,
24026
23865
  tag: 'tag:yaml.org,2002:bool',
24027
- test: /^true$|^false$/,
23866
+ test: /^true|false$/,
24028
23867
  resolve: str => str === 'true',
24029
23868
  stringify: stringifyJSON
24030
23869
  },
@@ -24069,7 +23908,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24069
23908
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
24070
23909
  */
24071
23910
  resolve(src, onError) {
24072
- if (typeof atob === 'function') {
23911
+ if (typeof Buffer === 'function') {
23912
+ return Buffer.from(src, 'base64');
23913
+ }
23914
+ else if (typeof atob === 'function') {
24073
23915
  // On IE 11, atob() can't handle newlines
24074
23916
  const str = atob(src.replace(/[\n\r]/g, ''));
24075
23917
  const buffer = new Uint8Array(str.length);
@@ -24083,11 +23925,15 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24083
23925
  }
24084
23926
  },
24085
23927
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
24086
- if (!value)
24087
- return '';
24088
23928
  const buf = value; // checked earlier by binary.identify()
24089
23929
  let str;
24090
- if (typeof btoa === 'function') {
23930
+ if (typeof Buffer === 'function') {
23931
+ str =
23932
+ buf instanceof Buffer
23933
+ ? buf.toString('base64')
23934
+ : Buffer.from(buf.buffer).toString('base64');
23935
+ }
23936
+ else if (typeof btoa === 'function') {
24091
23937
  let s = '';
24092
23938
  for (let i = 0; i < buf.length; ++i)
24093
23939
  s += String.fromCharCode(buf[i]);
@@ -24096,7 +23942,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24096
23942
  else {
24097
23943
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
24098
23944
  }
24099
- type ?? (type = Scalar.BLOCK_LITERAL);
23945
+ if (!type)
23946
+ type = Scalar.BLOCK_LITERAL;
24100
23947
  if (type !== Scalar.QUOTE_DOUBLE) {
24101
23948
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
24102
23949
  const n = Math.ceil(str.length / lineWidth);
@@ -24565,7 +24412,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24565
24412
  }
24566
24413
  return new Date(date);
24567
24414
  },
24568
- stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
24415
+ stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
24569
24416
  };
24570
24417
 
24571
24418
  const schema = [
@@ -24583,7 +24430,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24583
24430
  floatExp,
24584
24431
  float,
24585
24432
  binary,
24586
- merge,
24587
24433
  omap,
24588
24434
  pairs,
24589
24435
  set,
@@ -24611,7 +24457,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24611
24457
  intOct: intOct$1,
24612
24458
  intTime,
24613
24459
  map,
24614
- merge,
24615
24460
  null: nullTag,
24616
24461
  omap,
24617
24462
  pairs,
@@ -24621,20 +24466,13 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24621
24466
  };
24622
24467
  const coreKnownTags = {
24623
24468
  'tag:yaml.org,2002:binary': binary,
24624
- 'tag:yaml.org,2002:merge': merge,
24625
24469
  'tag:yaml.org,2002:omap': omap,
24626
24470
  'tag:yaml.org,2002:pairs': pairs,
24627
24471
  'tag:yaml.org,2002:set': set,
24628
24472
  'tag:yaml.org,2002:timestamp': timestamp
24629
24473
  };
24630
- function getTags(customTags, schemaName, addMergeTag) {
24631
- const schemaTags = schemas.get(schemaName);
24632
- if (schemaTags && !customTags) {
24633
- return addMergeTag && !schemaTags.includes(merge)
24634
- ? schemaTags.concat(merge)
24635
- : schemaTags.slice();
24636
- }
24637
- let tags = schemaTags;
24474
+ function getTags(customTags, schemaName) {
24475
+ let tags = schemas.get(schemaName);
24638
24476
  if (!tags) {
24639
24477
  if (Array.isArray(customTags))
24640
24478
  tags = [];
@@ -24653,21 +24491,17 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24653
24491
  else if (typeof customTags === 'function') {
24654
24492
  tags = customTags(tags.slice());
24655
24493
  }
24656
- if (addMergeTag)
24657
- tags = tags.concat(merge);
24658
- return tags.reduce((tags, tag) => {
24659
- const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
24660
- if (!tagObj) {
24661
- const tagName = JSON.stringify(tag);
24662
- const keys = Object.keys(tagsByName)
24663
- .map(key => JSON.stringify(key))
24664
- .join(', ');
24665
- throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
24666
- }
24667
- if (!tags.includes(tagObj))
24668
- tags.push(tagObj);
24669
- return tags;
24670
- }, []);
24494
+ return tags.map(tag => {
24495
+ if (typeof tag !== 'string')
24496
+ return tag;
24497
+ const tagObj = tagsByName[tag];
24498
+ if (tagObj)
24499
+ return tagObj;
24500
+ const keys = Object.keys(tagsByName)
24501
+ .map(key => JSON.stringify(key))
24502
+ .join(', ');
24503
+ throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
24504
+ });
24671
24505
  }
24672
24506
 
24673
24507
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -24678,9 +24512,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24678
24512
  : compat
24679
24513
  ? getTags(null, compat)
24680
24514
  : null;
24515
+ this.merge = !!merge;
24681
24516
  this.name = (typeof schema === 'string' && schema) || 'core';
24682
24517
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
24683
- this.tags = getTags(customTags, this.name, merge);
24518
+ this.tags = getTags(customTags, this.name);
24684
24519
  this.toStringOptions = toStringDefaults ?? null;
24685
24520
  Object.defineProperty(this, MAP, { value: map });
24686
24521
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -24805,7 +24640,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24805
24640
  logLevel: 'warn',
24806
24641
  prettyErrors: true,
24807
24642
  strict: true,
24808
- stringKeys: false,
24809
24643
  uniqueKeys: true,
24810
24644
  version: '1.2'
24811
24645
  }, options);
@@ -25029,7 +24863,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25029
24863
  this.directives.yaml.version = '1.1';
25030
24864
  else
25031
24865
  this.directives = new Directives({ version: '1.1' });
25032
- opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
24866
+ opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
25033
24867
  break;
25034
24868
  case '1.2':
25035
24869
  case 'next':
@@ -25037,7 +24871,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25037
24871
  this.directives.yaml.version = version;
25038
24872
  else
25039
24873
  this.directives = new Directives({ version });
25040
- opt = { resolveKnownTags: true, schema: 'core' };
24874
+ opt = { merge: false, resolveKnownTags: true, schema: 'core' };
25041
24875
  break;
25042
24876
  case null:
25043
24877
  if (this.directives)
@@ -25215,7 +25049,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25215
25049
  if (atNewline) {
25216
25050
  if (comment)
25217
25051
  comment += token.source;
25218
- else if (!found || indicator !== 'seq-item-ind')
25052
+ else
25219
25053
  spaceBefore = true;
25220
25054
  }
25221
25055
  else
@@ -25232,7 +25066,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25232
25066
  if (token.source.endsWith(':'))
25233
25067
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
25234
25068
  anchor = token;
25235
- start ?? (start = token.offset);
25069
+ if (start === null)
25070
+ start = token.offset;
25236
25071
  atNewline = false;
25237
25072
  hasSpace = false;
25238
25073
  reqSpace = true;
@@ -25241,7 +25076,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25241
25076
  if (tag)
25242
25077
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
25243
25078
  tag = token;
25244
- start ?? (start = token.offset);
25079
+ if (start === null)
25080
+ start = token.offset;
25245
25081
  atNewline = false;
25246
25082
  hasSpace = false;
25247
25083
  reqSpace = true;
@@ -25354,7 +25190,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25354
25190
  return false;
25355
25191
  const isEqual = typeof uniqueKeys === 'function'
25356
25192
  ? uniqueKeys
25357
- : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
25193
+ : (a, b) => a === b ||
25194
+ (isScalar$1(a) &&
25195
+ isScalar$1(b) &&
25196
+ a.value === b.value &&
25197
+ !(a.value === '<<' && ctx.schema.merge));
25358
25198
  return items.some(pair => isEqual(pair.key, search));
25359
25199
  }
25360
25200
 
@@ -25403,14 +25243,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25403
25243
  onError(offset, 'BAD_INDENT', startColMsg);
25404
25244
  }
25405
25245
  // key value
25406
- ctx.atKey = true;
25407
25246
  const keyStart = keyProps.end;
25408
25247
  const keyNode = key
25409
25248
  ? composeNode(ctx, key, keyProps, onError)
25410
25249
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
25411
25250
  if (ctx.schema.compat)
25412
25251
  flowIndentCheck(bm.indent, key, onError);
25413
- ctx.atKey = false;
25414
25252
  if (mapIncludes(ctx, map.items, keyNode))
25415
25253
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
25416
25254
  // value properties
@@ -25470,8 +25308,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25470
25308
  const seq = new NodeClass(ctx.schema);
25471
25309
  if (ctx.atRoot)
25472
25310
  ctx.atRoot = false;
25473
- if (ctx.atKey)
25474
- ctx.atKey = false;
25475
25311
  let offset = bs.offset;
25476
25312
  let commentEnd = null;
25477
25313
  for (const { start, value } of bs.items) {
@@ -25556,8 +25392,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25556
25392
  const atRoot = ctx.atRoot;
25557
25393
  if (atRoot)
25558
25394
  ctx.atRoot = false;
25559
- if (ctx.atKey)
25560
- ctx.atKey = false;
25561
25395
  let offset = fc.offset + fc.start.source.length;
25562
25396
  for (let i = 0; i < fc.items.length; ++i) {
25563
25397
  const collItem = fc.items[i];
@@ -25637,14 +25471,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25637
25471
  else {
25638
25472
  // item is a key+value pair
25639
25473
  // key value
25640
- ctx.atKey = true;
25641
25474
  const keyStart = props.end;
25642
25475
  const keyNode = key
25643
25476
  ? composeNode(ctx, key, props, onError)
25644
25477
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
25645
25478
  if (isBlock(key))
25646
25479
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
25647
- ctx.atKey = false;
25648
25480
  // value properties
25649
25481
  const valueProps = resolveProps(sep ?? [], {
25650
25482
  flow: fcName,
@@ -25800,8 +25632,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25800
25632
  tag = kt;
25801
25633
  }
25802
25634
  else {
25803
- if (kt) {
25804
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
25635
+ if (kt?.collection) {
25636
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
25805
25637
  }
25806
25638
  else {
25807
25639
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -26242,16 +26074,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26242
26074
  const tagName = tagToken
26243
26075
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
26244
26076
  : null;
26245
- let tag;
26246
- if (ctx.options.stringKeys && ctx.atKey) {
26247
- tag = ctx.schema[SCALAR$1];
26248
- }
26249
- else if (tagName)
26250
- tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
26251
- else if (token.type === 'scalar')
26252
- tag = findScalarTagByTest(ctx, value, token, onError);
26253
- else
26254
- tag = ctx.schema[SCALAR$1];
26077
+ const tag = tagToken && tagName
26078
+ ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
26079
+ : token.type === 'scalar'
26080
+ ? findScalarTagByTest(ctx, value, token, onError)
26081
+ : ctx.schema[SCALAR$1];
26255
26082
  let scalar;
26256
26083
  try {
26257
26084
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -26299,9 +26126,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26299
26126
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
26300
26127
  return schema[SCALAR$1];
26301
26128
  }
26302
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
26303
- const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
26304
- tag.test?.test(value)) || schema[SCALAR$1];
26129
+ function findScalarTagByTest({ directives, schema }, value, token, onError) {
26130
+ const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
26305
26131
  if (schema.compat) {
26306
26132
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
26307
26133
  schema[SCALAR$1];
@@ -26317,7 +26143,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26317
26143
 
26318
26144
  function emptyScalarPosition(offset, before, pos) {
26319
26145
  if (before) {
26320
- pos ?? (pos = before.length);
26146
+ if (pos === null)
26147
+ pos = before.length;
26321
26148
  for (let i = pos - 1; i >= 0; --i) {
26322
26149
  let st = before[i];
26323
26150
  switch (st.type) {
@@ -26342,7 +26169,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26342
26169
 
26343
26170
  const CN = { composeNode, composeEmptyNode };
26344
26171
  function composeNode(ctx, token, props, onError) {
26345
- const atKey = ctx.atKey;
26346
26172
  const { spaceBefore, comment, anchor, tag } = props;
26347
26173
  let node;
26348
26174
  let isSrcToken = true;
@@ -26378,14 +26204,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26378
26204
  }
26379
26205
  if (anchor && node.anchor === '')
26380
26206
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
26381
- if (atKey &&
26382
- ctx.options.stringKeys &&
26383
- (!isScalar$1(node) ||
26384
- typeof node.value !== 'string' ||
26385
- (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
26386
- const msg = 'With stringKeys, all keys must be strings';
26387
- onError(tag ?? token, 'NON_STRING_KEY', msg);
26388
- }
26389
26207
  if (spaceBefore)
26390
26208
  node.spaceBefore = true;
26391
26209
  if (comment) {
@@ -26438,7 +26256,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26438
26256
  const opts = Object.assign({ _directives: directives }, options);
26439
26257
  const doc = new Document(undefined, opts);
26440
26258
  const ctx = {
26441
- atKey: false,
26442
26259
  atRoot: true,
26443
26260
  directives: doc.directives,
26444
26261
  options: doc.options,
@@ -28573,20 +28390,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28573
28390
  default: {
28574
28391
  const bv = this.startBlockValue(map);
28575
28392
  if (bv) {
28576
- if (bv.type === 'block-seq') {
28577
- if (!it.explicitKey &&
28578
- it.sep &&
28579
- !includesToken(it.sep, 'newline')) {
28580
- yield* this.pop({
28581
- type: 'error',
28582
- offset: this.offset,
28583
- message: 'Unexpected block-seq-ind on same line with key',
28584
- source: this.source
28585
- });
28586
- return;
28587
- }
28588
- }
28589
- else if (atMapIndent) {
28393
+ if (atMapIndent && bv.type !== 'block-seq') {
28590
28394
  map.items.push({ start });
28591
28395
  }
28592
28396
  this.stack.push(bv);
@@ -28957,8 +28761,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28957
28761
  if (!keepUndefined)
28958
28762
  return undefined;
28959
28763
  }
28960
- if (isDocument(value) && !_replacer)
28961
- return value.toString(options);
28962
28764
  return new Document(value, _replacer, options).toString(options);
28963
28765
  }
28964
28766