@thoughtspot/visual-embed-sdk 1.42.1-alpha.7 → 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 (181) hide show
  1. package/cjs/package.json +4 -3
  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 +0 -2
  24. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  25. package/cjs/src/index.d.ts +3 -3
  26. package/cjs/src/index.d.ts.map +1 -1
  27. package/cjs/src/index.js +1 -2
  28. package/cjs/src/index.js.map +1 -1
  29. package/cjs/src/react/all-types-export.d.ts +1 -2
  30. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  31. package/cjs/src/react/all-types-export.js +3 -3
  32. package/cjs/src/react/all-types-export.js.map +1 -1
  33. package/cjs/src/react/all-types-export.spec.js +0 -8
  34. package/cjs/src/react/all-types-export.spec.js.map +1 -1
  35. package/cjs/src/react/index.d.ts +1 -2
  36. package/cjs/src/react/index.d.ts.map +1 -1
  37. package/cjs/src/react/index.js +2 -1
  38. package/cjs/src/react/index.js.map +1 -1
  39. package/cjs/src/react/util.d.ts +1 -0
  40. package/cjs/src/react/util.d.ts.map +1 -1
  41. package/cjs/src/types.d.ts +105 -143
  42. package/cjs/src/types.d.ts.map +1 -1
  43. package/cjs/src/types.js +103 -98
  44. package/cjs/src/types.js.map +1 -1
  45. package/cjs/src/utils/processData.d.ts +1 -1
  46. package/cjs/src/utils/processData.d.ts.map +1 -1
  47. package/cjs/src/utils/processData.js +8 -8
  48. package/cjs/src/utils/processData.js.map +1 -1
  49. package/cjs/src/utils/processData.spec.js.map +1 -1
  50. package/cjs/src/utils/processTrigger.d.ts +2 -1
  51. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  52. package/cjs/src/utils/processTrigger.js +4 -2
  53. package/cjs/src/utils/processTrigger.js.map +1 -1
  54. package/dist/{index-DvNA626T.js → index-CWQnMX2L.js} +1 -1
  55. package/dist/src/embed/app.d.ts +20 -0
  56. package/dist/src/embed/app.d.ts.map +1 -1
  57. package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
  58. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  59. package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  60. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  61. package/dist/src/embed/search.d.ts.map +1 -1
  62. package/dist/src/embed/ts-embed.d.ts +1 -3
  63. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  64. package/dist/src/index.d.ts +3 -3
  65. package/dist/src/index.d.ts.map +1 -1
  66. package/dist/src/react/all-types-export.d.ts +1 -2
  67. package/dist/src/react/all-types-export.d.ts.map +1 -1
  68. package/dist/src/react/index.d.ts +1 -2
  69. package/dist/src/react/index.d.ts.map +1 -1
  70. package/dist/src/react/util.d.ts +1 -0
  71. package/dist/src/react/util.d.ts.map +1 -1
  72. package/dist/src/types.d.ts +105 -143
  73. package/dist/src/types.d.ts.map +1 -1
  74. package/dist/src/utils/processData.d.ts +1 -1
  75. package/dist/src/utils/processData.d.ts.map +1 -1
  76. package/dist/src/utils/processTrigger.d.ts +2 -1
  77. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  78. package/dist/tsembed-react.es.js +157 -280
  79. package/dist/tsembed-react.js +301 -500
  80. package/dist/tsembed.es.js +156 -280
  81. package/dist/tsembed.js +299 -499
  82. package/dist/visual-embed-sdk-react-full.d.ts +129 -160
  83. package/dist/visual-embed-sdk-react.d.ts +129 -157
  84. package/dist/visual-embed-sdk.d.ts +129 -160
  85. package/lib/package.json +4 -3
  86. package/lib/src/embed/app.d.ts +20 -0
  87. package/lib/src/embed/app.d.ts.map +1 -1
  88. package/lib/src/embed/app.js +5 -4
  89. package/lib/src/embed/app.js.map +1 -1
  90. package/lib/src/embed/app.spec.js +32 -0
  91. package/lib/src/embed/app.spec.js.map +1 -1
  92. package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
  93. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  94. package/lib/src/embed/hostEventClient/contracts.js +0 -1
  95. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  96. package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  97. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  98. package/lib/src/embed/hostEventClient/host-event-client.js +6 -6
  99. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  100. package/lib/src/embed/search.d.ts.map +1 -1
  101. package/lib/src/embed/search.js +1 -3
  102. package/lib/src/embed/search.js.map +1 -1
  103. package/lib/src/embed/ts-embed.d.ts +1 -3
  104. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  105. package/lib/src/embed/ts-embed.js +16 -44
  106. package/lib/src/embed/ts-embed.js.map +1 -1
  107. package/lib/src/embed/ts-embed.spec.js +0 -2
  108. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  109. package/lib/src/index.d.ts +3 -3
  110. package/lib/src/index.d.ts.map +1 -1
  111. package/lib/src/index.js +2 -2
  112. package/lib/src/index.js.map +1 -1
  113. package/lib/src/react/all-types-export.d.ts +1 -2
  114. package/lib/src/react/all-types-export.d.ts.map +1 -1
  115. package/lib/src/react/all-types-export.js +2 -2
  116. package/lib/src/react/all-types-export.js.map +1 -1
  117. package/lib/src/react/all-types-export.spec.js +0 -8
  118. package/lib/src/react/all-types-export.spec.js.map +1 -1
  119. package/lib/src/react/index.d.ts +1 -2
  120. package/lib/src/react/index.d.ts.map +1 -1
  121. package/lib/src/react/index.js +4 -3
  122. package/lib/src/react/index.js.map +1 -1
  123. package/lib/src/react/util.d.ts +1 -0
  124. package/lib/src/react/util.d.ts.map +1 -1
  125. package/lib/src/types.d.ts +105 -143
  126. package/lib/src/types.d.ts.map +1 -1
  127. package/lib/src/types.js +102 -97
  128. package/lib/src/types.js.map +1 -1
  129. package/lib/src/utils/processData.d.ts +1 -1
  130. package/lib/src/utils/processData.d.ts.map +1 -1
  131. package/lib/src/utils/processData.js +8 -8
  132. package/lib/src/utils/processData.js.map +1 -1
  133. package/lib/src/utils/processData.spec.js.map +1 -1
  134. package/lib/src/utils/processTrigger.d.ts +2 -1
  135. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  136. package/lib/src/utils/processTrigger.js +4 -2
  137. package/lib/src/utils/processTrigger.js.map +1 -1
  138. package/package.json +4 -3
  139. package/src/embed/app.spec.ts +45 -0
  140. package/src/embed/app.ts +26 -4
  141. package/src/embed/hostEventClient/contracts.ts +0 -10
  142. package/src/embed/hostEventClient/host-event-client.ts +7 -3
  143. package/src/embed/search.ts +1 -3
  144. package/src/embed/ts-embed.spec.ts +7 -9
  145. package/src/embed/ts-embed.ts +33 -68
  146. package/src/index.ts +3 -4
  147. package/src/react/all-types-export.spec.ts +1 -9
  148. package/src/react/all-types-export.ts +6 -10
  149. package/src/react/index.tsx +130 -155
  150. package/src/types.ts +104 -145
  151. package/src/utils/processData.spec.ts +1 -0
  152. package/src/utils/processData.ts +11 -11
  153. package/src/utils/processTrigger.ts +5 -2
  154. package/cjs/src/api-intercept.d.ts +0 -31
  155. package/cjs/src/api-intercept.d.ts.map +0 -1
  156. package/cjs/src/api-intercept.js +0 -119
  157. package/cjs/src/api-intercept.js.map +0 -1
  158. package/cjs/src/api-intercept.spec.d.ts +0 -2
  159. package/cjs/src/api-intercept.spec.d.ts.map +0 -1
  160. package/cjs/src/api-intercept.spec.js +0 -122
  161. package/cjs/src/api-intercept.spec.js.map +0 -1
  162. package/dist/index-BCC3Z072.js +0 -7371
  163. package/dist/index-BEzW4MDA.js +0 -7371
  164. package/dist/index-BaESA9rq.js +0 -7371
  165. package/dist/index-CFNZIcKr.js +0 -7447
  166. package/dist/index-CqKTa1Fe.js +0 -7447
  167. package/dist/index-DFnPKcjZ.js +0 -7447
  168. package/dist/index-DhFH7b7U.js +0 -7447
  169. package/dist/src/api-intercept.d.ts +0 -31
  170. package/dist/src/api-intercept.d.ts.map +0 -1
  171. package/dist/src/api-intercept.spec.d.ts +0 -2
  172. package/dist/src/api-intercept.spec.d.ts.map +0 -1
  173. package/lib/src/api-intercept.d.ts +0 -31
  174. package/lib/src/api-intercept.d.ts.map +0 -1
  175. package/lib/src/api-intercept.js +0 -112
  176. package/lib/src/api-intercept.js.map +0 -1
  177. package/lib/src/api-intercept.spec.d.ts +0 -2
  178. package/lib/src/api-intercept.spec.d.ts.map +0 -1
  179. package/lib/src/api-intercept.spec.js +0 -119
  180. package/lib/src/api-intercept.spec.js.map +0 -1
  181. package/src/api-intercept.ts +0 -139
package/dist/tsembed.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.7 */
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.7";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":"NODE_OPTIONS=--max_old_space_size=8192 jest -c jest.config.sdk.js --runInBand --no-cache",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,123 +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, _d, _e, _f, _g;
17787
- const errorText = ((_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.errorText) || ((_c = (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.errorText);
17788
- const errorDescription = ((_d = payload === null || payload === void 0 ? void 0 : payload.data) === null || _d === void 0 ? void 0 : _d.errorDescription) || ((_f = (_e = payload === null || payload === void 0 ? void 0 : payload.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.errorDescription);
17789
- const payloadToSend = {
17790
- execute: (_g = payload === null || payload === void 0 ? void 0 : payload.data) === null || _g === void 0 ? void 0 : _g.execute,
17791
- response: {
17792
- body: {
17793
- errors: [
17794
- {
17795
- title: errorText,
17796
- description: errorDescription,
17797
- isUserError: true,
17798
- },
17799
- ],
17800
- data: {},
17801
- },
17802
- },
17803
- };
17804
- return { data: payloadToSend };
17805
- };
17806
-
17807
17708
  /**
17808
17709
  * Copyright (c) 2022
17809
17710
  *
@@ -17857,27 +17758,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17857
17758
  */
17858
17759
  this.fullscreenChangeHandler = null;
17859
17760
  this.subscribedListeners = {};
17860
- this.messageEventListener = async (event) => {
17861
- const eventType = this.getEventType(event);
17862
- const eventPort = this.getEventPort(event);
17863
- const eventData = this.formatEventData(event, eventType);
17864
- if (event.source === this.iFrame.contentWindow) {
17865
- const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
17866
- const executeEvent = (_eventType, data) => {
17867
- this.executeCallbacks(_eventType, data, eventPort);
17868
- };
17869
- if (eventType === exports.EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
17870
- const getUnsavedAnswerTml = async (props) => {
17871
- var _a;
17872
- const response = await this.triggerUIPassThrough(exports.UIPassthroughEvent.GetUnsavedAnswerTML, props);
17873
- return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
17874
- };
17875
- handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
17876
- return;
17877
- }
17878
- this.executeCallbacks(eventType, processedEventData, eventPort);
17879
- }
17880
- };
17881
17761
  /**
17882
17762
  * Send Custom style as part of payload of APP_INIT
17883
17763
  * @param _
@@ -17962,18 +17842,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17962
17842
  this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
17963
17843
  };
17964
17844
  this.showPreRenderByDefault = false;
17965
- this.createEmbedEventResponder = (eventPort, eventType) => {
17966
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
17967
- if (eventType === exports.EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
17968
- return (payload) => {
17969
- const payloadToSend = processLegacyInterceptResponse(payload);
17970
- this.triggerEventOnPort(eventPort, payloadToSend);
17971
- };
17972
- }
17973
- return (payload) => {
17974
- this.triggerEventOnPort(eventPort, payload);
17975
- };
17976
- };
17977
17845
  /**
17978
17846
  * @hidden
17979
17847
  * Internal state to track if the embed container is loaded.
@@ -18159,8 +18027,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18159
18027
  */
18160
18028
  subscribeToMessageEvents() {
18161
18029
  this.unsubscribeToMessageEvents();
18162
- window.addEventListener('message', this.messageEventListener);
18163
- 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;
18164
18040
  }
18165
18041
  /**
18166
18042
  * Adds event listeners for both network and message events.
@@ -18221,7 +18097,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18221
18097
  message: customActionsResult.errors,
18222
18098
  });
18223
18099
  }
18224
- const baseInitData = {
18100
+ return {
18225
18101
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
18226
18102
  authToken,
18227
18103
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -18239,9 +18115,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18239
18115
  customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
18240
18116
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
18241
18117
  customActions: customActionsResult.actions,
18242
- ...getInterceptInitData(this.embedConfig, this.viewConfig),
18243
18118
  };
18244
- return baseInitData;
18245
18119
  }
18246
18120
  async getAppInitData() {
18247
18121
  return this.getDefaultAppInitData();
@@ -18670,8 +18544,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18670
18544
  // When start status is false it trigger only end releated
18671
18545
  // payload
18672
18546
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
18673
- const responder = this.createEmbedEventResponder(eventPort, eventType);
18674
- callbackObj.callback(data, responder);
18547
+ callbackObj.callback(data, (payload) => {
18548
+ this.triggerEventOnPort(eventPort, payload);
18549
+ });
18675
18550
  }
18676
18551
  });
18677
18552
  }
@@ -18846,7 +18721,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18846
18721
  * @param {any} data The payload to send with the message
18847
18722
  * @returns A promise that resolves with the response from the embedded app
18848
18723
  */
18849
- async trigger(messageType, data = {}) {
18724
+ async trigger(messageType, data = {}, context = {}) {
18850
18725
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
18851
18726
  if (!this.isRendered) {
18852
18727
  this.handleError('Please call render before triggering events');
@@ -18863,7 +18738,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18863
18738
  return null;
18864
18739
  }
18865
18740
  // send an empty object, this is needed for liveboard default handlers
18866
- return this.hostEventClient.triggerHostEvent(messageType, data);
18741
+ return this.hostEventClient.triggerHostEvent(messageType, data, context);
18867
18742
  }
18868
18743
  /**
18869
18744
  * Triggers an event to the embedded app, skipping the UI flow.
@@ -19381,7 +19256,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19381
19256
  * embedded Liveboard or visualization.
19382
19257
  */
19383
19258
  getEmbedParams() {
19384
- 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;
19385
19260
  let params = {};
19386
19261
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
19387
19262
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -19434,8 +19309,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19434
19309
  if (enableAskSage) {
19435
19310
  params[Param.enableAskSage] = enableAskSage;
19436
19311
  }
19437
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19438
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19312
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19439
19313
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19440
19314
  }
19441
19315
  if (homePageSearchBarMode) {
@@ -19450,6 +19324,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19450
19324
  if (isPNGInScheduledEmailsEnabled !== undefined) {
19451
19325
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
19452
19326
  }
19327
+ if (hideTagFilterChips !== undefined) {
19328
+ params[Param.HideTagFilterChips] = hideTagFilterChips;
19329
+ }
19453
19330
  if (isLinkParametersEnabled !== undefined) {
19454
19331
  params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19455
19332
  }
@@ -20161,8 +20038,7 @@ query GetEurekaVizSnapshots(
20161
20038
  if (hideSearchBar) {
20162
20039
  queryParams[Param.HideSearchBar] = true;
20163
20040
  }
20164
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
20165
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
20041
+ if (isOnBeforeGetVizDataInterceptEnabled) {
20166
20042
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
20167
20043
  }
20168
20044
  if (!focusSearchBarOnRender) {
@@ -22031,7 +21907,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22031
21907
  return {
22032
21908
  onAnchor: (source) => {
22033
21909
  aliasObjects.push(source);
22034
- prevAnchors ?? (prevAnchors = anchorNames(doc));
21910
+ if (!prevAnchors)
21911
+ prevAnchors = anchorNames(doc);
22035
21912
  const anchor = findNewAnchor(prefix, prevAnchors);
22036
21913
  prevAnchors.add(anchor);
22037
21914
  return anchor;
@@ -22195,36 +22072,23 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22195
22072
  * Resolve the value of this alias within `doc`, finding the last
22196
22073
  * instance of the `source` anchor before this node.
22197
22074
  */
22198
- resolve(doc, ctx) {
22199
- let nodes;
22200
- if (ctx?.aliasResolveCache) {
22201
- nodes = ctx.aliasResolveCache;
22202
- }
22203
- else {
22204
- nodes = [];
22205
- visit$1(doc, {
22206
- Node: (_key, node) => {
22207
- if (isAlias(node) || hasAnchor(node))
22208
- nodes.push(node);
22209
- }
22210
- });
22211
- if (ctx)
22212
- ctx.aliasResolveCache = nodes;
22213
- }
22075
+ resolve(doc) {
22214
22076
  let found = undefined;
22215
- for (const node of nodes) {
22216
- if (node === this)
22217
- break;
22218
- if (node.anchor === this.source)
22219
- found = node;
22220
- }
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
+ });
22221
22085
  return found;
22222
22086
  }
22223
22087
  toJSON(_arg, ctx) {
22224
22088
  if (!ctx)
22225
22089
  return { source: this.source };
22226
22090
  const { anchors, doc, maxAliasCount } = ctx;
22227
- const source = this.resolve(doc, ctx);
22091
+ const source = this.resolve(doc);
22228
22092
  if (!source) {
22229
22093
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
22230
22094
  throw new ReferenceError(msg);
@@ -22343,7 +22207,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22343
22207
  if (aliasDuplicateObjects && value && typeof value === 'object') {
22344
22208
  ref = sourceObjects.get(value);
22345
22209
  if (ref) {
22346
- ref.anchor ?? (ref.anchor = onAnchor(value));
22210
+ if (!ref.anchor)
22211
+ ref.anchor = onAnchor(value);
22347
22212
  return new Alias(ref.anchor);
22348
22213
  }
22349
22214
  else {
@@ -22854,7 +22719,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22854
22719
  const { blockQuote, commentString, lineWidth } = ctx.options;
22855
22720
  // 1. Block can't end in whitespace unless the last line is non-empty.
22856
22721
  // 2. Strings consisting of only whitespace are best rendered explicitly.
22857
- if (!blockQuote || /\n[\t ]+$/.test(value)) {
22722
+ if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
22858
22723
  return quotedString(value, ctx);
22859
22724
  }
22860
22725
  const indent = ctx.indent ||
@@ -22914,32 +22779,23 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22914
22779
  start = start.replace(/\n+/g, `$&${indent}`);
22915
22780
  }
22916
22781
  const indentSize = indent ? '2' : '1'; // root is at -1
22917
- // Leading | or > is added later
22918
- let header = (startWithSpace ? indentSize : '') + chomp;
22782
+ let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
22919
22783
  if (comment) {
22920
22784
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
22921
22785
  if (onComment)
22922
22786
  onComment();
22923
22787
  }
22924
- if (!literal) {
22925
- const foldedValue = value
22926
- .replace(/\n+/g, '\n$&')
22927
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22928
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22929
- .replace(/\n+/g, `$&${indent}`);
22930
- let literalFallback = false;
22931
- const foldOptions = getFoldOptions(ctx, true);
22932
- if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
22933
- foldOptions.onOverflow = () => {
22934
- literalFallback = true;
22935
- };
22936
- }
22937
- const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
22938
- if (!literalFallback)
22939
- return `>${header}\n${indent}${body}`;
22788
+ if (literal) {
22789
+ value = value.replace(/\n+/g, `$&${indent}`);
22790
+ return `${header}\n${indent}${start}${value}${end}`;
22940
22791
  }
22941
- value = value.replace(/\n+/g, `$&${indent}`);
22942
- 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}`;
22943
22799
  }
22944
22800
  function plainString(item, ctx, onComment, onChompKeep) {
22945
22801
  const { type, value } = item;
@@ -22948,9 +22804,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22948
22804
  (inFlow && /[[\]{},]/.test(value))) {
22949
22805
  return quotedString(value, ctx);
22950
22806
  }
22951
- 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)) {
22952
22809
  // not allowed:
22953
- // - '-' or '?'
22810
+ // - empty string, '-' or '?'
22954
22811
  // - start with an indicator character (except [?:-]) or /[?-] /
22955
22812
  // - '\n ', ': ' or ' \n' anywhere
22956
22813
  // - '#' not preceded by a non-space char
@@ -23079,12 +22936,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23079
22936
  let obj;
23080
22937
  if (isScalar$1(item)) {
23081
22938
  obj = item.value;
23082
- let match = tags.filter(t => t.identify?.(obj));
23083
- if (match.length > 1) {
23084
- const testMatch = match.filter(t => t.test);
23085
- if (testMatch.length > 0)
23086
- match = testMatch;
23087
- }
22939
+ const match = tags.filter(t => t.identify?.(obj));
23088
22940
  tagObj =
23089
22941
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
23090
22942
  }
@@ -23093,7 +22945,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23093
22945
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
23094
22946
  }
23095
22947
  if (!tagObj) {
23096
- const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
22948
+ const name = obj?.constructor?.name ?? typeof obj;
23097
22949
  throw new Error(`Tag not resolved for ${name} value`);
23098
22950
  }
23099
22951
  return tagObj;
@@ -23108,7 +22960,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23108
22960
  anchors.add(anchor);
23109
22961
  props.push(`&${anchor}`);
23110
22962
  }
23111
- const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
22963
+ const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
23112
22964
  if (tag)
23113
22965
  props.push(doc.directives.tagString(tag));
23114
22966
  return props.join(' ');
@@ -23134,7 +22986,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23134
22986
  const node = isNode(item)
23135
22987
  ? item
23136
22988
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
23137
- tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
22989
+ if (!tagObj)
22990
+ tagObj = getTagObject(ctx.doc.schema.tags, node);
23138
22991
  const props = stringifyProps(node, tagObj, ctx);
23139
22992
  if (props.length > 0)
23140
22993
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -23296,10 +23149,54 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23296
23149
 
23297
23150
  function warn(logLevel, warning) {
23298
23151
  if (logLevel === 'debug' || logLevel === 'warn') {
23299
- console.warn(warning);
23152
+ if (typeof process !== 'undefined' && process.emitWarning)
23153
+ process.emitWarning(warning);
23154
+ else
23155
+ console.warn(warning);
23300
23156
  }
23301
23157
  }
23302
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));
23303
23200
  // If the value associated with a merge key is a single mapping node, each of
23304
23201
  // its key/value pairs is inserted into the current mapping, unless the key
23305
23202
  // already exists in it. If the value associated with the merge key is a
@@ -23307,35 +23204,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23307
23204
  // of these nodes is merged in turn according to its order in the sequence.
23308
23205
  // Keys in mapping nodes earlier in the sequence override keys specified in
23309
23206
  // later mapping nodes. -- http://yaml.org/type/merge.html
23310
- const MERGE_KEY = '<<';
23311
- const merge = {
23312
- identify: value => value === MERGE_KEY ||
23313
- (typeof value === 'symbol' && value.description === MERGE_KEY),
23314
- default: 'key',
23315
- tag: 'tag:yaml.org,2002:merge',
23316
- test: /^<<$/,
23317
- resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
23318
- addToJSMap: addMergeToJSMap
23319
- }),
23320
- stringify: () => MERGE_KEY
23321
- };
23322
- const isMergeKey = (ctx, key) => (merge.identify(key) ||
23323
- (isScalar$1(key) &&
23324
- (!key.type || key.type === Scalar.PLAIN) &&
23325
- merge.identify(key.value))) &&
23326
- ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
23327
- function addMergeToJSMap(ctx, map, value) {
23328
- value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23329
- if (isSeq(value))
23330
- for (const it of value.items)
23331
- mergeValue(ctx, map, it);
23332
- else if (Array.isArray(value))
23333
- for (const it of value)
23334
- mergeValue(ctx, map, it);
23335
- else
23336
- mergeValue(ctx, map, value);
23337
- }
23338
- function mergeValue(ctx, map, value) {
23207
+ function mergeToJSMap(ctx, map, value) {
23339
23208
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23340
23209
  if (!isMap(source))
23341
23210
  throw new Error('Merge sources must be maps or map aliases');
@@ -23359,41 +23228,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23359
23228
  }
23360
23229
  return map;
23361
23230
  }
23362
-
23363
- function addPairToJSMap(ctx, map, { key, value }) {
23364
- if (isNode(key) && key.addToJSMap)
23365
- key.addToJSMap(ctx, map, value);
23366
- // TODO: Should drop this special case for bare << handling
23367
- else if (isMergeKey(ctx, key))
23368
- addMergeToJSMap(ctx, map, value);
23369
- else {
23370
- const jsKey = toJS(key, '', ctx);
23371
- if (map instanceof Map) {
23372
- map.set(jsKey, toJS(value, jsKey, ctx));
23373
- }
23374
- else if (map instanceof Set) {
23375
- map.add(jsKey);
23376
- }
23377
- else {
23378
- const stringKey = stringifyKey(key, jsKey, ctx);
23379
- const jsValue = toJS(value, stringKey, ctx);
23380
- if (stringKey in map)
23381
- Object.defineProperty(map, stringKey, {
23382
- value: jsValue,
23383
- writable: true,
23384
- enumerable: true,
23385
- configurable: true
23386
- });
23387
- else
23388
- map[stringKey] = jsValue;
23389
- }
23390
- }
23391
- return map;
23392
- }
23393
23231
  function stringifyKey(key, jsKey, ctx) {
23394
23232
  if (jsKey === null)
23395
23233
  return '';
23396
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
23397
23234
  if (typeof jsKey !== 'object')
23398
23235
  return String(jsKey);
23399
23236
  if (isNode(key) && ctx?.doc) {
@@ -24026,7 +23863,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24026
23863
  identify: value => typeof value === 'boolean',
24027
23864
  default: true,
24028
23865
  tag: 'tag:yaml.org,2002:bool',
24029
- test: /^true$|^false$/,
23866
+ test: /^true|false$/,
24030
23867
  resolve: str => str === 'true',
24031
23868
  stringify: stringifyJSON
24032
23869
  },
@@ -24071,7 +23908,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24071
23908
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
24072
23909
  */
24073
23910
  resolve(src, onError) {
24074
- if (typeof atob === 'function') {
23911
+ if (typeof Buffer === 'function') {
23912
+ return Buffer.from(src, 'base64');
23913
+ }
23914
+ else if (typeof atob === 'function') {
24075
23915
  // On IE 11, atob() can't handle newlines
24076
23916
  const str = atob(src.replace(/[\n\r]/g, ''));
24077
23917
  const buffer = new Uint8Array(str.length);
@@ -24085,11 +23925,15 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24085
23925
  }
24086
23926
  },
24087
23927
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
24088
- if (!value)
24089
- return '';
24090
23928
  const buf = value; // checked earlier by binary.identify()
24091
23929
  let str;
24092
- 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') {
24093
23937
  let s = '';
24094
23938
  for (let i = 0; i < buf.length; ++i)
24095
23939
  s += String.fromCharCode(buf[i]);
@@ -24098,7 +23942,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24098
23942
  else {
24099
23943
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
24100
23944
  }
24101
- type ?? (type = Scalar.BLOCK_LITERAL);
23945
+ if (!type)
23946
+ type = Scalar.BLOCK_LITERAL;
24102
23947
  if (type !== Scalar.QUOTE_DOUBLE) {
24103
23948
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
24104
23949
  const n = Math.ceil(str.length / lineWidth);
@@ -24567,7 +24412,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24567
24412
  }
24568
24413
  return new Date(date);
24569
24414
  },
24570
- stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
24415
+ stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
24571
24416
  };
24572
24417
 
24573
24418
  const schema = [
@@ -24585,7 +24430,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24585
24430
  floatExp,
24586
24431
  float,
24587
24432
  binary,
24588
- merge,
24589
24433
  omap,
24590
24434
  pairs,
24591
24435
  set,
@@ -24613,7 +24457,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24613
24457
  intOct: intOct$1,
24614
24458
  intTime,
24615
24459
  map,
24616
- merge,
24617
24460
  null: nullTag,
24618
24461
  omap,
24619
24462
  pairs,
@@ -24623,20 +24466,13 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24623
24466
  };
24624
24467
  const coreKnownTags = {
24625
24468
  'tag:yaml.org,2002:binary': binary,
24626
- 'tag:yaml.org,2002:merge': merge,
24627
24469
  'tag:yaml.org,2002:omap': omap,
24628
24470
  'tag:yaml.org,2002:pairs': pairs,
24629
24471
  'tag:yaml.org,2002:set': set,
24630
24472
  'tag:yaml.org,2002:timestamp': timestamp
24631
24473
  };
24632
- function getTags(customTags, schemaName, addMergeTag) {
24633
- const schemaTags = schemas.get(schemaName);
24634
- if (schemaTags && !customTags) {
24635
- return addMergeTag && !schemaTags.includes(merge)
24636
- ? schemaTags.concat(merge)
24637
- : schemaTags.slice();
24638
- }
24639
- let tags = schemaTags;
24474
+ function getTags(customTags, schemaName) {
24475
+ let tags = schemas.get(schemaName);
24640
24476
  if (!tags) {
24641
24477
  if (Array.isArray(customTags))
24642
24478
  tags = [];
@@ -24655,21 +24491,17 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24655
24491
  else if (typeof customTags === 'function') {
24656
24492
  tags = customTags(tags.slice());
24657
24493
  }
24658
- if (addMergeTag)
24659
- tags = tags.concat(merge);
24660
- return tags.reduce((tags, tag) => {
24661
- const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
24662
- if (!tagObj) {
24663
- const tagName = JSON.stringify(tag);
24664
- const keys = Object.keys(tagsByName)
24665
- .map(key => JSON.stringify(key))
24666
- .join(', ');
24667
- throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
24668
- }
24669
- if (!tags.includes(tagObj))
24670
- tags.push(tagObj);
24671
- return tags;
24672
- }, []);
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
+ });
24673
24505
  }
24674
24506
 
24675
24507
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -24680,9 +24512,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24680
24512
  : compat
24681
24513
  ? getTags(null, compat)
24682
24514
  : null;
24515
+ this.merge = !!merge;
24683
24516
  this.name = (typeof schema === 'string' && schema) || 'core';
24684
24517
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
24685
- this.tags = getTags(customTags, this.name, merge);
24518
+ this.tags = getTags(customTags, this.name);
24686
24519
  this.toStringOptions = toStringDefaults ?? null;
24687
24520
  Object.defineProperty(this, MAP, { value: map });
24688
24521
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -24807,7 +24640,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24807
24640
  logLevel: 'warn',
24808
24641
  prettyErrors: true,
24809
24642
  strict: true,
24810
- stringKeys: false,
24811
24643
  uniqueKeys: true,
24812
24644
  version: '1.2'
24813
24645
  }, options);
@@ -25031,7 +24863,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25031
24863
  this.directives.yaml.version = '1.1';
25032
24864
  else
25033
24865
  this.directives = new Directives({ version: '1.1' });
25034
- opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
24866
+ opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
25035
24867
  break;
25036
24868
  case '1.2':
25037
24869
  case 'next':
@@ -25039,7 +24871,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25039
24871
  this.directives.yaml.version = version;
25040
24872
  else
25041
24873
  this.directives = new Directives({ version });
25042
- opt = { resolveKnownTags: true, schema: 'core' };
24874
+ opt = { merge: false, resolveKnownTags: true, schema: 'core' };
25043
24875
  break;
25044
24876
  case null:
25045
24877
  if (this.directives)
@@ -25217,7 +25049,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25217
25049
  if (atNewline) {
25218
25050
  if (comment)
25219
25051
  comment += token.source;
25220
- else if (!found || indicator !== 'seq-item-ind')
25052
+ else
25221
25053
  spaceBefore = true;
25222
25054
  }
25223
25055
  else
@@ -25234,7 +25066,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25234
25066
  if (token.source.endsWith(':'))
25235
25067
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
25236
25068
  anchor = token;
25237
- start ?? (start = token.offset);
25069
+ if (start === null)
25070
+ start = token.offset;
25238
25071
  atNewline = false;
25239
25072
  hasSpace = false;
25240
25073
  reqSpace = true;
@@ -25243,7 +25076,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25243
25076
  if (tag)
25244
25077
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
25245
25078
  tag = token;
25246
- start ?? (start = token.offset);
25079
+ if (start === null)
25080
+ start = token.offset;
25247
25081
  atNewline = false;
25248
25082
  hasSpace = false;
25249
25083
  reqSpace = true;
@@ -25356,7 +25190,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25356
25190
  return false;
25357
25191
  const isEqual = typeof uniqueKeys === 'function'
25358
25192
  ? uniqueKeys
25359
- : (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));
25360
25198
  return items.some(pair => isEqual(pair.key, search));
25361
25199
  }
25362
25200
 
@@ -25405,14 +25243,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25405
25243
  onError(offset, 'BAD_INDENT', startColMsg);
25406
25244
  }
25407
25245
  // key value
25408
- ctx.atKey = true;
25409
25246
  const keyStart = keyProps.end;
25410
25247
  const keyNode = key
25411
25248
  ? composeNode(ctx, key, keyProps, onError)
25412
25249
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
25413
25250
  if (ctx.schema.compat)
25414
25251
  flowIndentCheck(bm.indent, key, onError);
25415
- ctx.atKey = false;
25416
25252
  if (mapIncludes(ctx, map.items, keyNode))
25417
25253
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
25418
25254
  // value properties
@@ -25472,8 +25308,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25472
25308
  const seq = new NodeClass(ctx.schema);
25473
25309
  if (ctx.atRoot)
25474
25310
  ctx.atRoot = false;
25475
- if (ctx.atKey)
25476
- ctx.atKey = false;
25477
25311
  let offset = bs.offset;
25478
25312
  let commentEnd = null;
25479
25313
  for (const { start, value } of bs.items) {
@@ -25558,8 +25392,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25558
25392
  const atRoot = ctx.atRoot;
25559
25393
  if (atRoot)
25560
25394
  ctx.atRoot = false;
25561
- if (ctx.atKey)
25562
- ctx.atKey = false;
25563
25395
  let offset = fc.offset + fc.start.source.length;
25564
25396
  for (let i = 0; i < fc.items.length; ++i) {
25565
25397
  const collItem = fc.items[i];
@@ -25639,14 +25471,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25639
25471
  else {
25640
25472
  // item is a key+value pair
25641
25473
  // key value
25642
- ctx.atKey = true;
25643
25474
  const keyStart = props.end;
25644
25475
  const keyNode = key
25645
25476
  ? composeNode(ctx, key, props, onError)
25646
25477
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
25647
25478
  if (isBlock(key))
25648
25479
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
25649
- ctx.atKey = false;
25650
25480
  // value properties
25651
25481
  const valueProps = resolveProps(sep ?? [], {
25652
25482
  flow: fcName,
@@ -25802,8 +25632,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25802
25632
  tag = kt;
25803
25633
  }
25804
25634
  else {
25805
- if (kt) {
25806
- 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);
25807
25637
  }
25808
25638
  else {
25809
25639
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -26244,16 +26074,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26244
26074
  const tagName = tagToken
26245
26075
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
26246
26076
  : null;
26247
- let tag;
26248
- if (ctx.options.stringKeys && ctx.atKey) {
26249
- tag = ctx.schema[SCALAR$1];
26250
- }
26251
- else if (tagName)
26252
- tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
26253
- else if (token.type === 'scalar')
26254
- tag = findScalarTagByTest(ctx, value, token, onError);
26255
- else
26256
- 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];
26257
26082
  let scalar;
26258
26083
  try {
26259
26084
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -26301,9 +26126,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26301
26126
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
26302
26127
  return schema[SCALAR$1];
26303
26128
  }
26304
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
26305
- const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
26306
- 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];
26307
26131
  if (schema.compat) {
26308
26132
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
26309
26133
  schema[SCALAR$1];
@@ -26319,7 +26143,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26319
26143
 
26320
26144
  function emptyScalarPosition(offset, before, pos) {
26321
26145
  if (before) {
26322
- pos ?? (pos = before.length);
26146
+ if (pos === null)
26147
+ pos = before.length;
26323
26148
  for (let i = pos - 1; i >= 0; --i) {
26324
26149
  let st = before[i];
26325
26150
  switch (st.type) {
@@ -26344,7 +26169,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26344
26169
 
26345
26170
  const CN = { composeNode, composeEmptyNode };
26346
26171
  function composeNode(ctx, token, props, onError) {
26347
- const atKey = ctx.atKey;
26348
26172
  const { spaceBefore, comment, anchor, tag } = props;
26349
26173
  let node;
26350
26174
  let isSrcToken = true;
@@ -26380,14 +26204,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26380
26204
  }
26381
26205
  if (anchor && node.anchor === '')
26382
26206
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
26383
- if (atKey &&
26384
- ctx.options.stringKeys &&
26385
- (!isScalar$1(node) ||
26386
- typeof node.value !== 'string' ||
26387
- (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
26388
- const msg = 'With stringKeys, all keys must be strings';
26389
- onError(tag ?? token, 'NON_STRING_KEY', msg);
26390
- }
26391
26207
  if (spaceBefore)
26392
26208
  node.spaceBefore = true;
26393
26209
  if (comment) {
@@ -26440,7 +26256,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26440
26256
  const opts = Object.assign({ _directives: directives }, options);
26441
26257
  const doc = new Document(undefined, opts);
26442
26258
  const ctx = {
26443
- atKey: false,
26444
26259
  atRoot: true,
26445
26260
  directives: doc.directives,
26446
26261
  options: doc.options,
@@ -28575,20 +28390,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28575
28390
  default: {
28576
28391
  const bv = this.startBlockValue(map);
28577
28392
  if (bv) {
28578
- if (bv.type === 'block-seq') {
28579
- if (!it.explicitKey &&
28580
- it.sep &&
28581
- !includesToken(it.sep, 'newline')) {
28582
- yield* this.pop({
28583
- type: 'error',
28584
- offset: this.offset,
28585
- message: 'Unexpected block-seq-ind on same line with key',
28586
- source: this.source
28587
- });
28588
- return;
28589
- }
28590
- }
28591
- else if (atMapIndent) {
28393
+ if (atMapIndent && bv.type !== 'block-seq') {
28592
28394
  map.items.push({ start });
28593
28395
  }
28594
28396
  this.stack.push(bv);
@@ -28959,8 +28761,6 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28959
28761
  if (!keepUndefined)
28960
28762
  return undefined;
28961
28763
  }
28962
- if (isDocument(value) && !_replacer)
28963
- return value.toString(options);
28964
28764
  return new Document(value, _replacer, options).toString(options);
28965
28765
  }
28966
28766