@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
@@ -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, require('react')) :
@@ -163,7 +163,7 @@
163
163
  }
164
164
  return false;
165
165
  };
166
- const merge$1 = (...objects) => objects.reduce((result, current) => {
166
+ const merge = (...objects) => objects.reduce((result, current) => {
167
167
  if (Array.isArray(current)) {
168
168
  throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
169
169
  }
@@ -172,19 +172,19 @@
172
172
  return;
173
173
  }
174
174
  if (Array.isArray(result[key]) && Array.isArray(current[key])) {
175
- result[key] = merge$1.options.mergeArrays
176
- ? merge$1.options.uniqueArrayItems
175
+ result[key] = merge.options.mergeArrays
176
+ ? merge.options.uniqueArrayItems
177
177
  ? Array.from(new Set(result[key].concat(current[key])))
178
178
  : [...result[key], ...current[key]]
179
179
  : current[key];
180
180
  }
181
181
  else if (isObject$1(result[key]) && isObject$1(current[key])) {
182
- result[key] = merge$1(result[key], current[key]);
182
+ result[key] = merge(result[key], current[key]);
183
183
  }
184
184
  else {
185
185
  result[key] =
186
186
  current[key] === undefined
187
- ? merge$1.options.allowUndefinedOverrides
187
+ ? merge.options.allowUndefinedOverrides
188
188
  ? current[key]
189
189
  : result[key]
190
190
  : current[key];
@@ -197,11 +197,11 @@
197
197
  mergeArrays: true,
198
198
  uniqueArrayItems: true,
199
199
  };
200
- merge$1.options = defaultOptions;
201
- merge$1.withOptions = (options, ...objects) => {
202
- merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
203
- const result = merge$1(...objects);
204
- merge$1.options = defaultOptions;
200
+ merge.options = defaultOptions;
201
+ merge.withOptions = (options, ...objects) => {
202
+ merge.options = Object.assign(Object.assign({}, defaultOptions), options);
203
+ const result = merge(...objects);
204
+ merge.options = defaultOptions;
205
205
  return result;
206
206
  };
207
207
 
@@ -636,7 +636,7 @@
636
636
  */
637
637
  EmbedEvent["Load"] = "load";
638
638
  /**
639
- * Data pertaining to an Answer or Liveboard is received.
639
+ * Data pertaining to an Answer, Liveboard or Spotter visualization is received.
640
640
  * The event payload includes the raw data of the object.
641
641
  * @return data - Answer of Liveboard data
642
642
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
@@ -1719,21 +1719,6 @@
1719
1719
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1720
1720
  */
1721
1721
  EmbedEvent["OrgSwitched"] = "orgSwitched";
1722
- /**
1723
- * Emitted when the user intercepts a URL.
1724
- *
1725
- * Supported on all embed types.
1726
- *
1727
- * @example
1728
- * ```js
1729
- * embed.on(EmbedEvent.ApiIntercept, (payload) => {
1730
- * console.log('payload', payload);
1731
- * })
1732
- * ```
1733
- *
1734
- * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
1735
- */
1736
- EmbedEvent["ApiIntercept"] = "ApiIntercept";
1737
1722
  })(exports.EmbedEvent || (exports.EmbedEvent = {}));
1738
1723
  /**
1739
1724
  * Event types that can be triggered by the host application
@@ -2022,7 +2007,7 @@
2022
2007
  * the following parameters:
2023
2008
  *
2024
2009
  * @param
2025
- * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2010
+ * `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
2026
2011
  * Optional when pinning a new chart or table generated from a Search query.
2027
2012
  * **Required** in Spotter Embed.
2028
2013
  * @param
@@ -2074,10 +2059,16 @@
2074
2059
  * ```
2075
2060
  * @example
2076
2061
  * ```js
2077
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Pin, {
2078
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2079
- * });
2080
- * ```
2062
+
2063
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2064
+ * let latestSpotterVizId = '';
2065
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2066
+ * latestSpotterVizId = payload.data.id;
2067
+ * });
2068
+ *
2069
+ * spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
2070
+ * ```
2071
+ *
2081
2072
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2082
2073
  */
2083
2074
  HostEvent["Pin"] = "pin";
@@ -2152,10 +2143,15 @@
2152
2143
  * ```
2153
2144
  * @example
2154
2145
  * ```js
2155
- * spotterEmbed.trigger(HostEvent.DownloadAsPdf, {
2156
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2157
- * });
2158
- * ```
2146
+
2147
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
2148
+ * let latestSpotterVizId = '';
2149
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2150
+ * latestSpotterVizId = payload.data.id;
2151
+ * });
2152
+ *
2153
+ * spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
2154
+ * ```
2159
2155
  *
2160
2156
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2161
2157
  */
@@ -2182,10 +2178,14 @@
2182
2178
  * ```
2183
2179
  * @example
2184
2180
  * ```js
2185
- * const pinResponse = await spotterEmbed.trigger(HostEvent.MakeACopy, {
2186
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2187
- * });
2188
- * ```
2181
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
2182
+ * let latestSpotterVizId = '';
2183
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2184
+ * latestSpotterVizId = payload.data.id;
2185
+ * });
2186
+ *
2187
+ * spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
2188
+ * ```
2189
2189
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2190
2190
  */
2191
2191
  HostEvent["MakeACopy"] = "makeACopy";
@@ -2270,15 +2270,7 @@
2270
2270
  * ```
2271
2271
  * @example
2272
2272
  * ```js
2273
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2274
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2275
- * });
2276
- * ```
2277
- * @example
2278
- * ```js
2279
- * const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2280
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2281
- * });
2273
+ * spotterEmbed.trigger(HostEvent.Edit);
2282
2274
  * ```
2283
2275
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2284
2276
  */
@@ -2327,16 +2319,23 @@
2327
2319
  * );
2328
2320
  * })
2329
2321
  * ```
2330
- * @example
2322
+ * * @example
2331
2323
  * ```js
2332
- * spotterEmbed.trigger(HostEvent.GetTML, {
2333
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2324
+
2325
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2326
+ * let latestSpotterVizId = '';
2327
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2328
+ * latestSpotterVizId = payload.data.id;
2329
+ * });
2330
+ *
2331
+ * spotterEmbed.trigger(HostEvent.GetTML, {
2332
+ * vizId: latestSpotterVizId
2334
2333
  * }).then((tml) => {
2335
2334
  * console.log(
2336
2335
  * tml.answer.search_query // TML representation of the search query
2337
2336
  * );
2338
2337
  * })
2339
- * ```
2338
+ * ```
2340
2339
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
2341
2340
  * @important
2342
2341
  */
@@ -2400,7 +2399,7 @@
2400
2399
  /**
2401
2400
  * Trigger the **Download** action on charts in
2402
2401
  * the embedded view.
2403
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2402
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2404
2403
  * @example
2405
2404
  * ```js
2406
2405
  * liveboardEmbed.trigger(HostEvent.Download, {vizId:
@@ -2410,10 +2409,14 @@
2410
2409
  * embed.trigger(HostEvent.Download)
2411
2410
  * ```
2412
2411
  * ```js
2413
- * spotterEmbed.trigger(HostEvent.Download, {
2414
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2415
- * });
2416
- * ```
2412
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
2413
+ * let latestSpotterVizId = '';
2414
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2415
+ * latestSpotterVizId = payload.data.id;
2416
+ * });
2417
+ *
2418
+ * spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
2419
+ * ```
2417
2420
  * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
2418
2421
  * Use {@link DownloadAsPng}
2419
2422
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
@@ -2431,9 +2434,13 @@
2431
2434
  *
2432
2435
  * searchEmbed.trigger(HostEvent.DownloadAsPng)
2433
2436
  *
2434
- * spotterEmbed.trigger(HostEvent.DownloadAsPng, {
2435
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2436
- * })
2437
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
2438
+ * let latestSpotterVizId = '';
2439
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2440
+ * latestSpotterVizId = payload.data.id;
2441
+ * });
2442
+ *
2443
+ * spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
2437
2444
  * ```
2438
2445
  *
2439
2446
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
@@ -2442,7 +2449,7 @@
2442
2449
  /**
2443
2450
  * Trigger the **Download** > **CSV** action on tables in
2444
2451
  * the embedded view.
2445
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2452
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2446
2453
  * @example
2447
2454
  * ```js
2448
2455
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
@@ -2455,9 +2462,13 @@
2455
2462
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
2456
2463
  * ```
2457
2464
  * ```js
2458
- * spotterEmbed.trigger(HostEvent.DownloadAsCsv, {
2459
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2460
- * })
2465
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
2466
+ * let latestSpotterVizId = '';
2467
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2468
+ * latestSpotterVizId = payload.data.id;
2469
+ * });
2470
+ *
2471
+ * spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
2461
2472
  * ```
2462
2473
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2463
2474
  */
@@ -2465,7 +2476,7 @@
2465
2476
  /**
2466
2477
  * Trigger the **Download** > **XLSX** action on tables
2467
2478
  * in the embedded view.
2468
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2479
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2469
2480
  * @example
2470
2481
  * ```js
2471
2482
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
@@ -2478,9 +2489,13 @@
2478
2489
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
2479
2490
  * ```
2480
2491
  * ```js
2481
- * spotterEmbed.trigger(HostEvent.downloadAsXLSX, {
2482
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2483
- * })
2492
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
2493
+ * let latestSpotterVizId = '';
2494
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2495
+ * latestSpotterVizId = payload.data.id;
2496
+ * });
2497
+ *
2498
+ * spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
2484
2499
  * ```
2485
2500
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2486
2501
  */
@@ -2517,7 +2532,7 @@
2517
2532
  * ```
2518
2533
  *
2519
2534
  * ```js
2520
- * // Save an Answer in Spotter (requires vizId)
2535
+ * // Save a Visualization in Spotter (requires vizId)
2521
2536
  * spotterEmbed.trigger(HostEvent.Save, {
2522
2537
  * vizId: "730496d6-6903-4601-937e-2c691821af3c"
2523
2538
  * })
@@ -2839,11 +2854,13 @@
2839
2854
  * });
2840
2855
  *```
2841
2856
  *```js
2842
- * spotterEmbed.trigger(HostEvent.GetParameters, {
2843
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2844
- * }).then((parameter) => {
2845
- * console.log('parameters', parameter);
2846
- * });
2857
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
2858
+ * let latestSpotterVizId = '';
2859
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2860
+ * latestSpotterVizId = payload.data.id;
2861
+ * });
2862
+ *
2863
+ * spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
2847
2864
  *```
2848
2865
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
2849
2866
  */
@@ -2886,11 +2903,13 @@
2886
2903
  * ```
2887
2904
  * @example
2888
2905
  * ```js
2889
- * const saveAnswerResponse = await spotterEmbed.trigger(HostEvent.SaveAnswer, {
2890
- * vizId: '730496d6-6903-4601-937e-2c691821af3c',
2891
- * name: "Sales by states",
2892
- * description: "Total sales by states in MidWest"
2906
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
2907
+ * let latestSpotterVizId = '';
2908
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2909
+ * latestSpotterVizId = payload.data.id;
2893
2910
  * });
2911
+ *
2912
+ * spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
2894
2913
  * ```
2895
2914
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
2896
2915
  */
@@ -2974,12 +2993,15 @@
2974
2993
  HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
2975
2994
  /**
2976
2995
  * Toggle the visualization to chart or table view.
2977
- * @param - `vizId ` refers to the answer id in spotter Embed, it is required in spotter Embed.
2996
+ * @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
2978
2997
  * @example
2979
2998
  * ```js
2980
- * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, {
2981
- * vizId:'b535c760-8bbe-4e6f-bb26-af56b4129a1e'
2999
+ * let latestSpotterVizId = '';
3000
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3001
+ * latestSpotterVizId = payload.data.id;
2982
3002
  * });
3003
+ *
3004
+ * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
2983
3005
  *```
2984
3006
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
2985
3007
  */
@@ -3008,12 +3030,16 @@
3008
3030
  */
3009
3031
  HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
3010
3032
  /**
3011
- * Trigger the *Ask Spotter* action for visualizations
3012
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3033
+ * Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
3034
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
3013
3035
  * @example
3014
3036
  * ```js
3015
- * spotterEmbed.trigger(HostEvent.AskSpotter,
3016
- * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
3037
+ * let latestSpotterVizId = '';
3038
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3039
+ * latestSpotterVizId = payload.data.id;
3040
+ * });
3041
+ *
3042
+ * spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
3017
3043
  * ```
3018
3044
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
3019
3045
  */
@@ -3071,6 +3097,7 @@
3071
3097
  Param["HideResult"] = "hideResult";
3072
3098
  Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
3073
3099
  Param["Tag"] = "tag";
3100
+ Param["HideTagFilterChips"] = "hideTagFilterChips";
3074
3101
  Param["AutoLogin"] = "autoLogin";
3075
3102
  Param["searchTokenString"] = "searchTokenString";
3076
3103
  Param["executeSearch"] = "executeSearch";
@@ -4601,29 +4628,7 @@
4601
4628
  * @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
4602
4629
  */
4603
4630
  LogLevel["TRACE"] = "TRACE";
4604
- })(exports.LogLevel || (exports.LogLevel = {}));
4605
- /**
4606
- * Enum for the type of API intercepted
4607
- */
4608
- var InterceptedApiType;
4609
- (function (InterceptedApiType) {
4610
- /**
4611
- * The apis that are use to get the metadata for the embed
4612
- */
4613
- InterceptedApiType["METADATA"] = "METADATA";
4614
- /**
4615
- * The apis that are use to get the data for the embed
4616
- */
4617
- InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
4618
- /**
4619
- * This will intercept all the apis
4620
- */
4621
- InterceptedApiType["ALL"] = "ALL";
4622
- /**
4623
- * The apis that are use to get the data for the liveboard
4624
- */
4625
- InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
4626
- })(InterceptedApiType || (InterceptedApiType = {}));
4631
+ })(exports.LogLevel || (exports.LogLevel = {}));
4627
4632
 
4628
4633
  const logFunctions = {
4629
4634
  [exports.LogLevel.SILENT]: () => undefined,
@@ -4892,7 +4897,7 @@
4892
4897
  function getDOMNode(domSelector) {
4893
4898
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
4894
4899
  }
4895
- const deepMerge = (target, source) => merge$1(target, source);
4900
+ const deepMerge = (target, source) => merge(target, source);
4896
4901
  const getOperationNameFromQuery = (query) => {
4897
4902
  const regex = /(?:query|mutation)\s+(\w+)/;
4898
4903
  const matches = query.match(regex);
@@ -7386,17 +7391,6 @@
7386
7391
 
7387
7392
  var isEmpty_1 = isEmpty$1;
7388
7393
 
7389
- var UIPassthroughEvent;
7390
- (function (UIPassthroughEvent) {
7391
- UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
7392
- UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
7393
- UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
7394
- UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
7395
- UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
7396
- UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
7397
- UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
7398
- })(UIPassthroughEvent || (UIPassthroughEvent = {}));
7399
-
7400
7394
  const ERROR_MESSAGE = {
7401
7395
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
7402
7396
  SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
@@ -17481,27 +17475,27 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17481
17475
  * @param thoughtSpotHost
17482
17476
  * @param containerEl
17483
17477
  */
17484
- function processEventData(type, eventData, thoughtSpotHost, containerEl) {
17478
+ function processEventData(type, e, thoughtSpotHost, containerEl) {
17485
17479
  switch (type) {
17486
17480
  case exports.EmbedEvent.CustomAction:
17487
- return processCustomAction(eventData, thoughtSpotHost);
17481
+ return processCustomAction(e, thoughtSpotHost);
17488
17482
  case exports.EmbedEvent.AuthInit:
17489
- return processAuthInit(eventData);
17483
+ return processAuthInit(e);
17490
17484
  case exports.EmbedEvent.NoCookieAccess:
17491
- return processNoCookieAccess(eventData, containerEl);
17485
+ return processNoCookieAccess(e, containerEl);
17492
17486
  case exports.EmbedEvent.AuthFailure:
17493
- return processAuthFailure(eventData, containerEl);
17487
+ return processAuthFailure(e, containerEl);
17494
17488
  case exports.EmbedEvent.AuthLogout:
17495
- return processAuthLogout(eventData, containerEl);
17489
+ return processAuthLogout(e, containerEl);
17496
17490
  case exports.EmbedEvent.ExitPresentMode:
17497
17491
  return processExitPresentMode();
17498
17492
  case exports.EmbedEvent.CLEAR_INFO_CACHE:
17499
17493
  return processClearInfoCache();
17500
17494
  }
17501
- return eventData;
17495
+ return e;
17502
17496
  }
17503
17497
 
17504
- 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};
17498
+ 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};
17505
17499
 
17506
17500
  /**
17507
17501
  * Reloads the ThoughtSpot iframe.
@@ -17520,6 +17514,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17520
17514
  * @param message
17521
17515
  * @param message.type
17522
17516
  * @param message.data
17517
+ * @param message.context
17523
17518
  * @param thoughtSpotHost
17524
17519
  * @param channel
17525
17520
  */
@@ -17534,8 +17529,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17534
17529
  * @param messageType
17535
17530
  * @param thoughtSpotHost
17536
17531
  * @param data
17532
+ * @param context
17537
17533
  */
17538
- function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
17534
+ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
17539
17535
  return new Promise((res, rej) => {
17540
17536
  var _a;
17541
17537
  if (messageType === exports.HostEvent.Reload) {
@@ -17569,10 +17565,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17569
17565
  channel.port1.close();
17570
17566
  res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
17571
17567
  }, TRIGGER_TIMEOUT);
17572
- return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
17568
+ return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
17573
17569
  });
17574
17570
  }
17575
17571
 
17572
+ var UIPassthroughEvent;
17573
+ (function (UIPassthroughEvent) {
17574
+ UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
17575
+ UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
17576
+ UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
17577
+ UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
17578
+ UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
17579
+ UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
17580
+ })(UIPassthroughEvent || (UIPassthroughEvent = {}));
17581
+
17576
17582
  class HostEventClient {
17577
17583
  constructor(iFrame) {
17578
17584
  this.iFrame = iFrame;
@@ -17583,12 +17589,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17583
17589
  * @param {any} data Data to send with the host event
17584
17590
  * @returns {Promise<any>} - the response from the process trigger
17585
17591
  */
17586
- async processTrigger(message, data) {
17592
+ async processTrigger(message, data, context) {
17587
17593
  if (!this.iFrame) {
17588
17594
  throw new Error('Iframe element is not set');
17589
17595
  }
17590
17596
  const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
17591
- return processTrigger(this.iFrame, message, thoughtspotHost, data);
17597
+ return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
17592
17598
  }
17593
17599
  async handleHostEventWithParam(apiName, parameters) {
17594
17600
  var _a, _b, _c, _d;
@@ -17607,8 +17613,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17607
17613
  }
17608
17614
  return { ...response.value };
17609
17615
  }
17610
- async hostEventFallback(hostEvent, data) {
17611
- return this.processTrigger(hostEvent, data);
17616
+ async hostEventFallback(hostEvent, data, context) {
17617
+ return this.processTrigger(hostEvent, data, context);
17612
17618
  }
17613
17619
  /**
17614
17620
  * Setter for the iframe element used for host events
@@ -17652,121 +17658,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17652
17658
  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,
17653
17659
  };
17654
17660
  }
17655
- async triggerHostEvent(hostEvent, payload) {
17661
+ async triggerHostEvent(hostEvent, payload, context) {
17656
17662
  switch (hostEvent) {
17657
17663
  case exports.HostEvent.Pin:
17658
17664
  return this.handlePinEvent(payload);
17659
17665
  case exports.HostEvent.SaveAnswer:
17660
17666
  return this.handleSaveAnswerEvent(payload);
17661
17667
  default:
17662
- return this.hostEventFallback(hostEvent, payload);
17668
+ return this.hostEventFallback(hostEvent, payload, context);
17663
17669
  }
17664
17670
  }
17665
17671
  }
17666
17672
 
17667
- const defaultUrls = {
17668
- [InterceptedApiType.METADATA]: [
17669
- '/prism/?op=CreateAnswerSession',
17670
- '/prism/?op=GetV2SourceDetail',
17671
- ],
17672
- [InterceptedApiType.ANSWER_DATA]: [
17673
- '/prism/?op=GetChartWithData',
17674
- '/prism/?op=GetTableWithHeadlineData',
17675
- ],
17676
- [InterceptedApiType.LIVEBOARD_DATA]: [
17677
- '/prism/?op=LoadContextBook'
17678
- ],
17679
- };
17680
- const formatInterceptUrl = (url) => {
17681
- const host = getThoughtSpotHost(getEmbedConfig());
17682
- if (url.startsWith('/'))
17683
- return `${host}${url}`;
17684
- return url;
17685
- };
17686
- const processInterceptUrls = (interceptUrls) => {
17687
- let processedUrls = [...interceptUrls];
17688
- Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
17689
- if (!processedUrls.includes(apiType))
17690
- return;
17691
- processedUrls = processedUrls.filter(url => url !== apiType);
17692
- processedUrls = [...processedUrls, ...apiTypeUrls];
17693
- });
17694
- return processedUrls.map(url => formatInterceptUrl(url));
17695
- };
17696
- const getInterceptInitData = (embedConfig, viewConfig) => {
17697
- const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
17698
- if (!enableApiIntercept)
17699
- return {
17700
- enableApiIntercept: false,
17701
- };
17702
- const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
17703
- if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17704
- combinedUrls.push(InterceptedApiType.ANSWER_DATA);
17705
- }
17706
- const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
17707
- const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
17708
- const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
17709
- return {
17710
- interceptUrls,
17711
- interceptTimeout,
17712
- enableApiIntercept,
17713
- };
17714
- };
17715
- /**
17716
- *
17717
- * @param fetchInit
17718
- */
17719
- const parseInterceptData = (eventDataString) => {
17720
- try {
17721
- const { input, init } = JSON.parse(eventDataString);
17722
- init.body = JSON.parse(init.body);
17723
- const parsedInit = { input, init };
17724
- return [parsedInit, null];
17725
- }
17726
- catch (error) {
17727
- return [null, error];
17728
- }
17729
- };
17730
- const handleInterceptEvent = async (params) => {
17731
- var _a, _b, _c, _d, _e;
17732
- const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
17733
- const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
17734
- if (bodyParseError) {
17735
- executeEvent(exports.EmbedEvent.Error, {
17736
- error: 'Error parsing api intercept body',
17737
- });
17738
- logger$3.error('Error parsing request body', bodyParseError);
17739
- return;
17740
- }
17741
- const { input: requestUrl, init } = interceptData;
17742
- 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;
17743
- 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;
17744
- if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17745
- const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
17746
- executeEvent(exports.EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
17747
- }
17748
- executeEvent(exports.EmbedEvent.ApiIntercept, interceptData);
17749
- };
17750
- const processLegacyInterceptResponse = (payload) => {
17751
- var _a, _b, _c;
17752
- const payloadToSend = {
17753
- execute: (_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.execute,
17754
- response: {
17755
- body: {
17756
- errors: [
17757
- {
17758
- title: (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.errorText,
17759
- message: (_c = payload === null || payload === void 0 ? void 0 : payload.data) === null || _c === void 0 ? void 0 : _c.errorDescription,
17760
- isUserError: true,
17761
- },
17762
- ],
17763
- data: {},
17764
- },
17765
- },
17766
- };
17767
- return { data: payloadToSend };
17768
- };
17769
-
17770
17673
  /**
17771
17674
  * Copyright (c) 2022
17772
17675
  *
@@ -17820,27 +17723,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17820
17723
  */
17821
17724
  this.fullscreenChangeHandler = null;
17822
17725
  this.subscribedListeners = {};
17823
- this.messageEventListener = async (event) => {
17824
- const eventType = this.getEventType(event);
17825
- const eventPort = this.getEventPort(event);
17826
- const eventData = this.formatEventData(event, eventType);
17827
- if (event.source === this.iFrame.contentWindow) {
17828
- const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
17829
- const executeEvent = (_eventType, data) => {
17830
- this.executeCallbacks(_eventType, data, eventPort);
17831
- };
17832
- if (eventType === exports.EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
17833
- const getUnsavedAnswerTml = async (props) => {
17834
- var _a;
17835
- const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
17836
- return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
17837
- };
17838
- handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
17839
- return;
17840
- }
17841
- this.executeCallbacks(eventType, processedEventData, eventPort);
17842
- }
17843
- };
17844
17726
  /**
17845
17727
  * Send Custom style as part of payload of APP_INIT
17846
17728
  * @param _
@@ -17925,18 +17807,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17925
17807
  this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
17926
17808
  };
17927
17809
  this.showPreRenderByDefault = false;
17928
- this.createEmbedEventResponder = (eventPort, eventType) => {
17929
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
17930
- if (eventType === exports.EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
17931
- return (payload) => {
17932
- const payloadToSend = processLegacyInterceptResponse(payload);
17933
- this.triggerEventOnPort(eventPort, payloadToSend);
17934
- };
17935
- }
17936
- return (payload) => {
17937
- this.triggerEventOnPort(eventPort, payload);
17938
- };
17939
- };
17940
17810
  /**
17941
17811
  * @hidden
17942
17812
  * Internal state to track if the embed container is loaded.
@@ -18122,8 +17992,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18122
17992
  */
18123
17993
  subscribeToMessageEvents() {
18124
17994
  this.unsubscribeToMessageEvents();
18125
- window.addEventListener('message', this.messageEventListener);
18126
- this.subscribedListeners.message = this.messageEventListener;
17995
+ const messageEventListener = (event) => {
17996
+ const eventType = this.getEventType(event);
17997
+ const eventPort = this.getEventPort(event);
17998
+ const eventData = this.formatEventData(event, eventType);
17999
+ if (event.source === this.iFrame.contentWindow) {
18000
+ this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
18001
+ }
18002
+ };
18003
+ window.addEventListener('message', messageEventListener);
18004
+ this.subscribedListeners.message = messageEventListener;
18127
18005
  }
18128
18006
  /**
18129
18007
  * Adds event listeners for both network and message events.
@@ -18184,7 +18062,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18184
18062
  message: customActionsResult.errors,
18185
18063
  });
18186
18064
  }
18187
- const baseInitData = {
18065
+ return {
18188
18066
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
18189
18067
  authToken,
18190
18068
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -18202,9 +18080,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18202
18080
  customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
18203
18081
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
18204
18082
  customActions: customActionsResult.actions,
18205
- ...getInterceptInitData(this.embedConfig, this.viewConfig),
18206
18083
  };
18207
- return baseInitData;
18208
18084
  }
18209
18085
  async getAppInitData() {
18210
18086
  return this.getDefaultAppInitData();
@@ -18633,8 +18509,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18633
18509
  // When start status is false it trigger only end releated
18634
18510
  // payload
18635
18511
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
18636
- const responder = this.createEmbedEventResponder(eventPort, eventType);
18637
- callbackObj.callback(data, responder);
18512
+ callbackObj.callback(data, (payload) => {
18513
+ this.triggerEventOnPort(eventPort, payload);
18514
+ });
18638
18515
  }
18639
18516
  });
18640
18517
  }
@@ -18809,7 +18686,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18809
18686
  * @param {any} data The payload to send with the message
18810
18687
  * @returns A promise that resolves with the response from the embedded app
18811
18688
  */
18812
- async trigger(messageType, data = {}) {
18689
+ async trigger(messageType, data = {}, context = {}) {
18813
18690
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
18814
18691
  if (!this.isRendered) {
18815
18692
  this.handleError('Please call render before triggering events');
@@ -18826,7 +18703,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18826
18703
  return null;
18827
18704
  }
18828
18705
  // send an empty object, this is needed for liveboard default handlers
18829
- return this.hostEventClient.triggerHostEvent(messageType, data);
18706
+ return this.hostEventClient.triggerHostEvent(messageType, data, context);
18830
18707
  }
18831
18708
  /**
18832
18709
  * Triggers an event to the embedded app, skipping the UI flow.
@@ -19418,8 +19295,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19418
19295
  if (hideSearchBar) {
19419
19296
  queryParams[Param.HideSearchBar] = true;
19420
19297
  }
19421
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19422
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19298
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19423
19299
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19424
19300
  }
19425
19301
  if (!focusSearchBarOnRender) {
@@ -19680,7 +19556,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19680
19556
  * embedded Liveboard or visualization.
19681
19557
  */
19682
19558
  getEmbedParams() {
19683
- 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 = 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;
19559
+ 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 = 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;
19684
19560
  let params = {};
19685
19561
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
19686
19562
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -19733,8 +19609,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19733
19609
  if (enableAskSage) {
19734
19610
  params[Param.enableAskSage] = enableAskSage;
19735
19611
  }
19736
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19737
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19612
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19738
19613
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19739
19614
  }
19740
19615
  if (homePageSearchBarMode) {
@@ -19749,6 +19624,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19749
19624
  if (isPNGInScheduledEmailsEnabled !== undefined) {
19750
19625
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
19751
19626
  }
19627
+ if (hideTagFilterChips !== undefined) {
19628
+ params[Param.HideTagFilterChips] = hideTagFilterChips;
19629
+ }
19752
19630
  if (isLinkParametersEnabled !== undefined) {
19753
19631
  params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19754
19632
  }
@@ -21851,7 +21729,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
21851
21729
  return {
21852
21730
  onAnchor: (source) => {
21853
21731
  aliasObjects.push(source);
21854
- prevAnchors ?? (prevAnchors = anchorNames(doc));
21732
+ if (!prevAnchors)
21733
+ prevAnchors = anchorNames(doc);
21855
21734
  const anchor = findNewAnchor(prefix, prevAnchors);
21856
21735
  prevAnchors.add(anchor);
21857
21736
  return anchor;
@@ -22015,36 +21894,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22015
21894
  * Resolve the value of this alias within `doc`, finding the last
22016
21895
  * instance of the `source` anchor before this node.
22017
21896
  */
22018
- resolve(doc, ctx) {
22019
- let nodes;
22020
- if (ctx?.aliasResolveCache) {
22021
- nodes = ctx.aliasResolveCache;
22022
- }
22023
- else {
22024
- nodes = [];
22025
- visit$1(doc, {
22026
- Node: (_key, node) => {
22027
- if (isAlias(node) || hasAnchor(node))
22028
- nodes.push(node);
22029
- }
22030
- });
22031
- if (ctx)
22032
- ctx.aliasResolveCache = nodes;
22033
- }
21897
+ resolve(doc) {
22034
21898
  let found = undefined;
22035
- for (const node of nodes) {
22036
- if (node === this)
22037
- break;
22038
- if (node.anchor === this.source)
22039
- found = node;
22040
- }
21899
+ visit$1(doc, {
21900
+ Node: (_key, node) => {
21901
+ if (node === this)
21902
+ return visit$1.BREAK;
21903
+ if (node.anchor === this.source)
21904
+ found = node;
21905
+ }
21906
+ });
22041
21907
  return found;
22042
21908
  }
22043
21909
  toJSON(_arg, ctx) {
22044
21910
  if (!ctx)
22045
21911
  return { source: this.source };
22046
21912
  const { anchors, doc, maxAliasCount } = ctx;
22047
- const source = this.resolve(doc, ctx);
21913
+ const source = this.resolve(doc);
22048
21914
  if (!source) {
22049
21915
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
22050
21916
  throw new ReferenceError(msg);
@@ -22163,7 +22029,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22163
22029
  if (aliasDuplicateObjects && value && typeof value === 'object') {
22164
22030
  ref = sourceObjects.get(value);
22165
22031
  if (ref) {
22166
- ref.anchor ?? (ref.anchor = onAnchor(value));
22032
+ if (!ref.anchor)
22033
+ ref.anchor = onAnchor(value);
22167
22034
  return new Alias(ref.anchor);
22168
22035
  }
22169
22036
  else {
@@ -22674,7 +22541,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22674
22541
  const { blockQuote, commentString, lineWidth } = ctx.options;
22675
22542
  // 1. Block can't end in whitespace unless the last line is non-empty.
22676
22543
  // 2. Strings consisting of only whitespace are best rendered explicitly.
22677
- if (!blockQuote || /\n[\t ]+$/.test(value)) {
22544
+ if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
22678
22545
  return quotedString(value, ctx);
22679
22546
  }
22680
22547
  const indent = ctx.indent ||
@@ -22734,32 +22601,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22734
22601
  start = start.replace(/\n+/g, `$&${indent}`);
22735
22602
  }
22736
22603
  const indentSize = indent ? '2' : '1'; // root is at -1
22737
- // Leading | or > is added later
22738
- let header = (startWithSpace ? indentSize : '') + chomp;
22604
+ let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
22739
22605
  if (comment) {
22740
22606
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
22741
22607
  if (onComment)
22742
22608
  onComment();
22743
22609
  }
22744
- if (!literal) {
22745
- const foldedValue = value
22746
- .replace(/\n+/g, '\n$&')
22747
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22748
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22749
- .replace(/\n+/g, `$&${indent}`);
22750
- let literalFallback = false;
22751
- const foldOptions = getFoldOptions(ctx, true);
22752
- if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
22753
- foldOptions.onOverflow = () => {
22754
- literalFallback = true;
22755
- };
22756
- }
22757
- const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
22758
- if (!literalFallback)
22759
- return `>${header}\n${indent}${body}`;
22610
+ if (literal) {
22611
+ value = value.replace(/\n+/g, `$&${indent}`);
22612
+ return `${header}\n${indent}${start}${value}${end}`;
22760
22613
  }
22761
- value = value.replace(/\n+/g, `$&${indent}`);
22762
- return `|${header}\n${indent}${start}${value}${end}`;
22614
+ value = value
22615
+ .replace(/\n+/g, '\n$&')
22616
+ .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22617
+ // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22618
+ .replace(/\n+/g, `$&${indent}`);
22619
+ const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
22620
+ return `${header}\n${indent}${body}`;
22763
22621
  }
22764
22622
  function plainString(item, ctx, onComment, onChompKeep) {
22765
22623
  const { type, value } = item;
@@ -22768,9 +22626,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22768
22626
  (inFlow && /[[\]{},]/.test(value))) {
22769
22627
  return quotedString(value, ctx);
22770
22628
  }
22771
- if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22629
+ if (!value ||
22630
+ /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22772
22631
  // not allowed:
22773
- // - '-' or '?'
22632
+ // - empty string, '-' or '?'
22774
22633
  // - start with an indicator character (except [?:-]) or /[?-] /
22775
22634
  // - '\n ', ': ' or ' \n' anywhere
22776
22635
  // - '#' not preceded by a non-space char
@@ -22899,12 +22758,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22899
22758
  let obj;
22900
22759
  if (isScalar$1(item)) {
22901
22760
  obj = item.value;
22902
- let match = tags.filter(t => t.identify?.(obj));
22903
- if (match.length > 1) {
22904
- const testMatch = match.filter(t => t.test);
22905
- if (testMatch.length > 0)
22906
- match = testMatch;
22907
- }
22761
+ const match = tags.filter(t => t.identify?.(obj));
22908
22762
  tagObj =
22909
22763
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
22910
22764
  }
@@ -22913,7 +22767,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22913
22767
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
22914
22768
  }
22915
22769
  if (!tagObj) {
22916
- const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
22770
+ const name = obj?.constructor?.name ?? typeof obj;
22917
22771
  throw new Error(`Tag not resolved for ${name} value`);
22918
22772
  }
22919
22773
  return tagObj;
@@ -22928,7 +22782,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22928
22782
  anchors.add(anchor);
22929
22783
  props.push(`&${anchor}`);
22930
22784
  }
22931
- const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
22785
+ const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
22932
22786
  if (tag)
22933
22787
  props.push(doc.directives.tagString(tag));
22934
22788
  return props.join(' ');
@@ -22954,7 +22808,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22954
22808
  const node = isNode(item)
22955
22809
  ? item
22956
22810
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
22957
- tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
22811
+ if (!tagObj)
22812
+ tagObj = getTagObject(ctx.doc.schema.tags, node);
22958
22813
  const props = stringifyProps(node, tagObj, ctx);
22959
22814
  if (props.length > 0)
22960
22815
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -23116,10 +22971,54 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23116
22971
 
23117
22972
  function warn(logLevel, warning) {
23118
22973
  if (logLevel === 'debug' || logLevel === 'warn') {
23119
- console.warn(warning);
22974
+ if (typeof process !== 'undefined' && process.emitWarning)
22975
+ process.emitWarning(warning);
22976
+ else
22977
+ console.warn(warning);
23120
22978
  }
23121
22979
  }
23122
22980
 
22981
+ const MERGE_KEY = '<<';
22982
+ function addPairToJSMap(ctx, map, { key, value }) {
22983
+ if (ctx?.doc.schema.merge && isMergeKey(key)) {
22984
+ value = isAlias(value) ? value.resolve(ctx.doc) : value;
22985
+ if (isSeq(value))
22986
+ for (const it of value.items)
22987
+ mergeToJSMap(ctx, map, it);
22988
+ else if (Array.isArray(value))
22989
+ for (const it of value)
22990
+ mergeToJSMap(ctx, map, it);
22991
+ else
22992
+ mergeToJSMap(ctx, map, value);
22993
+ }
22994
+ else {
22995
+ const jsKey = toJS(key, '', ctx);
22996
+ if (map instanceof Map) {
22997
+ map.set(jsKey, toJS(value, jsKey, ctx));
22998
+ }
22999
+ else if (map instanceof Set) {
23000
+ map.add(jsKey);
23001
+ }
23002
+ else {
23003
+ const stringKey = stringifyKey(key, jsKey, ctx);
23004
+ const jsValue = toJS(value, stringKey, ctx);
23005
+ if (stringKey in map)
23006
+ Object.defineProperty(map, stringKey, {
23007
+ value: jsValue,
23008
+ writable: true,
23009
+ enumerable: true,
23010
+ configurable: true
23011
+ });
23012
+ else
23013
+ map[stringKey] = jsValue;
23014
+ }
23015
+ }
23016
+ return map;
23017
+ }
23018
+ const isMergeKey = (key) => key === MERGE_KEY ||
23019
+ (isScalar$1(key) &&
23020
+ key.value === MERGE_KEY &&
23021
+ (!key.type || key.type === Scalar.PLAIN));
23123
23022
  // If the value associated with a merge key is a single mapping node, each of
23124
23023
  // its key/value pairs is inserted into the current mapping, unless the key
23125
23024
  // already exists in it. If the value associated with the merge key is a
@@ -23127,35 +23026,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23127
23026
  // of these nodes is merged in turn according to its order in the sequence.
23128
23027
  // Keys in mapping nodes earlier in the sequence override keys specified in
23129
23028
  // later mapping nodes. -- http://yaml.org/type/merge.html
23130
- const MERGE_KEY = '<<';
23131
- const merge = {
23132
- identify: value => value === MERGE_KEY ||
23133
- (typeof value === 'symbol' && value.description === MERGE_KEY),
23134
- default: 'key',
23135
- tag: 'tag:yaml.org,2002:merge',
23136
- test: /^<<$/,
23137
- resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
23138
- addToJSMap: addMergeToJSMap
23139
- }),
23140
- stringify: () => MERGE_KEY
23141
- };
23142
- const isMergeKey = (ctx, key) => (merge.identify(key) ||
23143
- (isScalar$1(key) &&
23144
- (!key.type || key.type === Scalar.PLAIN) &&
23145
- merge.identify(key.value))) &&
23146
- ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
23147
- function addMergeToJSMap(ctx, map, value) {
23148
- value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23149
- if (isSeq(value))
23150
- for (const it of value.items)
23151
- mergeValue(ctx, map, it);
23152
- else if (Array.isArray(value))
23153
- for (const it of value)
23154
- mergeValue(ctx, map, it);
23155
- else
23156
- mergeValue(ctx, map, value);
23157
- }
23158
- function mergeValue(ctx, map, value) {
23029
+ function mergeToJSMap(ctx, map, value) {
23159
23030
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23160
23031
  if (!isMap(source))
23161
23032
  throw new Error('Merge sources must be maps or map aliases');
@@ -23179,41 +23050,9 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23179
23050
  }
23180
23051
  return map;
23181
23052
  }
23182
-
23183
- function addPairToJSMap(ctx, map, { key, value }) {
23184
- if (isNode(key) && key.addToJSMap)
23185
- key.addToJSMap(ctx, map, value);
23186
- // TODO: Should drop this special case for bare << handling
23187
- else if (isMergeKey(ctx, key))
23188
- addMergeToJSMap(ctx, map, value);
23189
- else {
23190
- const jsKey = toJS(key, '', ctx);
23191
- if (map instanceof Map) {
23192
- map.set(jsKey, toJS(value, jsKey, ctx));
23193
- }
23194
- else if (map instanceof Set) {
23195
- map.add(jsKey);
23196
- }
23197
- else {
23198
- const stringKey = stringifyKey(key, jsKey, ctx);
23199
- const jsValue = toJS(value, stringKey, ctx);
23200
- if (stringKey in map)
23201
- Object.defineProperty(map, stringKey, {
23202
- value: jsValue,
23203
- writable: true,
23204
- enumerable: true,
23205
- configurable: true
23206
- });
23207
- else
23208
- map[stringKey] = jsValue;
23209
- }
23210
- }
23211
- return map;
23212
- }
23213
23053
  function stringifyKey(key, jsKey, ctx) {
23214
23054
  if (jsKey === null)
23215
23055
  return '';
23216
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
23217
23056
  if (typeof jsKey !== 'object')
23218
23057
  return String(jsKey);
23219
23058
  if (isNode(key) && ctx?.doc) {
@@ -23846,7 +23685,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23846
23685
  identify: value => typeof value === 'boolean',
23847
23686
  default: true,
23848
23687
  tag: 'tag:yaml.org,2002:bool',
23849
- test: /^true$|^false$/,
23688
+ test: /^true|false$/,
23850
23689
  resolve: str => str === 'true',
23851
23690
  stringify: stringifyJSON
23852
23691
  },
@@ -23891,7 +23730,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23891
23730
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
23892
23731
  */
23893
23732
  resolve(src, onError) {
23894
- if (typeof atob === 'function') {
23733
+ if (typeof Buffer === 'function') {
23734
+ return Buffer.from(src, 'base64');
23735
+ }
23736
+ else if (typeof atob === 'function') {
23895
23737
  // On IE 11, atob() can't handle newlines
23896
23738
  const str = atob(src.replace(/[\n\r]/g, ''));
23897
23739
  const buffer = new Uint8Array(str.length);
@@ -23905,11 +23747,15 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23905
23747
  }
23906
23748
  },
23907
23749
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
23908
- if (!value)
23909
- return '';
23910
23750
  const buf = value; // checked earlier by binary.identify()
23911
23751
  let str;
23912
- if (typeof btoa === 'function') {
23752
+ if (typeof Buffer === 'function') {
23753
+ str =
23754
+ buf instanceof Buffer
23755
+ ? buf.toString('base64')
23756
+ : Buffer.from(buf.buffer).toString('base64');
23757
+ }
23758
+ else if (typeof btoa === 'function') {
23913
23759
  let s = '';
23914
23760
  for (let i = 0; i < buf.length; ++i)
23915
23761
  s += String.fromCharCode(buf[i]);
@@ -23918,7 +23764,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23918
23764
  else {
23919
23765
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
23920
23766
  }
23921
- type ?? (type = Scalar.BLOCK_LITERAL);
23767
+ if (!type)
23768
+ type = Scalar.BLOCK_LITERAL;
23922
23769
  if (type !== Scalar.QUOTE_DOUBLE) {
23923
23770
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
23924
23771
  const n = Math.ceil(str.length / lineWidth);
@@ -24387,7 +24234,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24387
24234
  }
24388
24235
  return new Date(date);
24389
24236
  },
24390
- stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
24237
+ stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
24391
24238
  };
24392
24239
 
24393
24240
  const schema = [
@@ -24405,7 +24252,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24405
24252
  floatExp,
24406
24253
  float,
24407
24254
  binary,
24408
- merge,
24409
24255
  omap,
24410
24256
  pairs,
24411
24257
  set,
@@ -24433,7 +24279,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24433
24279
  intOct: intOct$1,
24434
24280
  intTime,
24435
24281
  map,
24436
- merge,
24437
24282
  null: nullTag,
24438
24283
  omap,
24439
24284
  pairs,
@@ -24443,20 +24288,13 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24443
24288
  };
24444
24289
  const coreKnownTags = {
24445
24290
  'tag:yaml.org,2002:binary': binary,
24446
- 'tag:yaml.org,2002:merge': merge,
24447
24291
  'tag:yaml.org,2002:omap': omap,
24448
24292
  'tag:yaml.org,2002:pairs': pairs,
24449
24293
  'tag:yaml.org,2002:set': set,
24450
24294
  'tag:yaml.org,2002:timestamp': timestamp
24451
24295
  };
24452
- function getTags(customTags, schemaName, addMergeTag) {
24453
- const schemaTags = schemas.get(schemaName);
24454
- if (schemaTags && !customTags) {
24455
- return addMergeTag && !schemaTags.includes(merge)
24456
- ? schemaTags.concat(merge)
24457
- : schemaTags.slice();
24458
- }
24459
- let tags = schemaTags;
24296
+ function getTags(customTags, schemaName) {
24297
+ let tags = schemas.get(schemaName);
24460
24298
  if (!tags) {
24461
24299
  if (Array.isArray(customTags))
24462
24300
  tags = [];
@@ -24475,21 +24313,17 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24475
24313
  else if (typeof customTags === 'function') {
24476
24314
  tags = customTags(tags.slice());
24477
24315
  }
24478
- if (addMergeTag)
24479
- tags = tags.concat(merge);
24480
- return tags.reduce((tags, tag) => {
24481
- const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
24482
- if (!tagObj) {
24483
- const tagName = JSON.stringify(tag);
24484
- const keys = Object.keys(tagsByName)
24485
- .map(key => JSON.stringify(key))
24486
- .join(', ');
24487
- throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
24488
- }
24489
- if (!tags.includes(tagObj))
24490
- tags.push(tagObj);
24491
- return tags;
24492
- }, []);
24316
+ return tags.map(tag => {
24317
+ if (typeof tag !== 'string')
24318
+ return tag;
24319
+ const tagObj = tagsByName[tag];
24320
+ if (tagObj)
24321
+ return tagObj;
24322
+ const keys = Object.keys(tagsByName)
24323
+ .map(key => JSON.stringify(key))
24324
+ .join(', ');
24325
+ throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
24326
+ });
24493
24327
  }
24494
24328
 
24495
24329
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -24500,9 +24334,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24500
24334
  : compat
24501
24335
  ? getTags(null, compat)
24502
24336
  : null;
24337
+ this.merge = !!merge;
24503
24338
  this.name = (typeof schema === 'string' && schema) || 'core';
24504
24339
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
24505
- this.tags = getTags(customTags, this.name, merge);
24340
+ this.tags = getTags(customTags, this.name);
24506
24341
  this.toStringOptions = toStringDefaults ?? null;
24507
24342
  Object.defineProperty(this, MAP, { value: map });
24508
24343
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -24627,7 +24462,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24627
24462
  logLevel: 'warn',
24628
24463
  prettyErrors: true,
24629
24464
  strict: true,
24630
- stringKeys: false,
24631
24465
  uniqueKeys: true,
24632
24466
  version: '1.2'
24633
24467
  }, options);
@@ -24851,7 +24685,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24851
24685
  this.directives.yaml.version = '1.1';
24852
24686
  else
24853
24687
  this.directives = new Directives({ version: '1.1' });
24854
- opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
24688
+ opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
24855
24689
  break;
24856
24690
  case '1.2':
24857
24691
  case 'next':
@@ -24859,7 +24693,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24859
24693
  this.directives.yaml.version = version;
24860
24694
  else
24861
24695
  this.directives = new Directives({ version });
24862
- opt = { resolveKnownTags: true, schema: 'core' };
24696
+ opt = { merge: false, resolveKnownTags: true, schema: 'core' };
24863
24697
  break;
24864
24698
  case null:
24865
24699
  if (this.directives)
@@ -25037,7 +24871,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25037
24871
  if (atNewline) {
25038
24872
  if (comment)
25039
24873
  comment += token.source;
25040
- else if (!found || indicator !== 'seq-item-ind')
24874
+ else
25041
24875
  spaceBefore = true;
25042
24876
  }
25043
24877
  else
@@ -25054,7 +24888,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25054
24888
  if (token.source.endsWith(':'))
25055
24889
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
25056
24890
  anchor = token;
25057
- start ?? (start = token.offset);
24891
+ if (start === null)
24892
+ start = token.offset;
25058
24893
  atNewline = false;
25059
24894
  hasSpace = false;
25060
24895
  reqSpace = true;
@@ -25063,7 +24898,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25063
24898
  if (tag)
25064
24899
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
25065
24900
  tag = token;
25066
- start ?? (start = token.offset);
24901
+ if (start === null)
24902
+ start = token.offset;
25067
24903
  atNewline = false;
25068
24904
  hasSpace = false;
25069
24905
  reqSpace = true;
@@ -25176,7 +25012,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25176
25012
  return false;
25177
25013
  const isEqual = typeof uniqueKeys === 'function'
25178
25014
  ? uniqueKeys
25179
- : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
25015
+ : (a, b) => a === b ||
25016
+ (isScalar$1(a) &&
25017
+ isScalar$1(b) &&
25018
+ a.value === b.value &&
25019
+ !(a.value === '<<' && ctx.schema.merge));
25180
25020
  return items.some(pair => isEqual(pair.key, search));
25181
25021
  }
25182
25022
 
@@ -25225,14 +25065,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25225
25065
  onError(offset, 'BAD_INDENT', startColMsg);
25226
25066
  }
25227
25067
  // key value
25228
- ctx.atKey = true;
25229
25068
  const keyStart = keyProps.end;
25230
25069
  const keyNode = key
25231
25070
  ? composeNode(ctx, key, keyProps, onError)
25232
25071
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
25233
25072
  if (ctx.schema.compat)
25234
25073
  flowIndentCheck(bm.indent, key, onError);
25235
- ctx.atKey = false;
25236
25074
  if (mapIncludes(ctx, map.items, keyNode))
25237
25075
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
25238
25076
  // value properties
@@ -25292,8 +25130,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25292
25130
  const seq = new NodeClass(ctx.schema);
25293
25131
  if (ctx.atRoot)
25294
25132
  ctx.atRoot = false;
25295
- if (ctx.atKey)
25296
- ctx.atKey = false;
25297
25133
  let offset = bs.offset;
25298
25134
  let commentEnd = null;
25299
25135
  for (const { start, value } of bs.items) {
@@ -25378,8 +25214,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25378
25214
  const atRoot = ctx.atRoot;
25379
25215
  if (atRoot)
25380
25216
  ctx.atRoot = false;
25381
- if (ctx.atKey)
25382
- ctx.atKey = false;
25383
25217
  let offset = fc.offset + fc.start.source.length;
25384
25218
  for (let i = 0; i < fc.items.length; ++i) {
25385
25219
  const collItem = fc.items[i];
@@ -25459,14 +25293,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25459
25293
  else {
25460
25294
  // item is a key+value pair
25461
25295
  // key value
25462
- ctx.atKey = true;
25463
25296
  const keyStart = props.end;
25464
25297
  const keyNode = key
25465
25298
  ? composeNode(ctx, key, props, onError)
25466
25299
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
25467
25300
  if (isBlock(key))
25468
25301
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
25469
- ctx.atKey = false;
25470
25302
  // value properties
25471
25303
  const valueProps = resolveProps(sep ?? [], {
25472
25304
  flow: fcName,
@@ -25622,8 +25454,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25622
25454
  tag = kt;
25623
25455
  }
25624
25456
  else {
25625
- if (kt) {
25626
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
25457
+ if (kt?.collection) {
25458
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
25627
25459
  }
25628
25460
  else {
25629
25461
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -26064,16 +25896,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26064
25896
  const tagName = tagToken
26065
25897
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
26066
25898
  : null;
26067
- let tag;
26068
- if (ctx.options.stringKeys && ctx.atKey) {
26069
- tag = ctx.schema[SCALAR$1];
26070
- }
26071
- else if (tagName)
26072
- tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
26073
- else if (token.type === 'scalar')
26074
- tag = findScalarTagByTest(ctx, value, token, onError);
26075
- else
26076
- tag = ctx.schema[SCALAR$1];
25899
+ const tag = tagToken && tagName
25900
+ ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
25901
+ : token.type === 'scalar'
25902
+ ? findScalarTagByTest(ctx, value, token, onError)
25903
+ : ctx.schema[SCALAR$1];
26077
25904
  let scalar;
26078
25905
  try {
26079
25906
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -26121,9 +25948,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26121
25948
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
26122
25949
  return schema[SCALAR$1];
26123
25950
  }
26124
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
26125
- const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
26126
- tag.test?.test(value)) || schema[SCALAR$1];
25951
+ function findScalarTagByTest({ directives, schema }, value, token, onError) {
25952
+ const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
26127
25953
  if (schema.compat) {
26128
25954
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
26129
25955
  schema[SCALAR$1];
@@ -26139,7 +25965,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26139
25965
 
26140
25966
  function emptyScalarPosition(offset, before, pos) {
26141
25967
  if (before) {
26142
- pos ?? (pos = before.length);
25968
+ if (pos === null)
25969
+ pos = before.length;
26143
25970
  for (let i = pos - 1; i >= 0; --i) {
26144
25971
  let st = before[i];
26145
25972
  switch (st.type) {
@@ -26164,7 +25991,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26164
25991
 
26165
25992
  const CN = { composeNode, composeEmptyNode };
26166
25993
  function composeNode(ctx, token, props, onError) {
26167
- const atKey = ctx.atKey;
26168
25994
  const { spaceBefore, comment, anchor, tag } = props;
26169
25995
  let node;
26170
25996
  let isSrcToken = true;
@@ -26200,14 +26026,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26200
26026
  }
26201
26027
  if (anchor && node.anchor === '')
26202
26028
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
26203
- if (atKey &&
26204
- ctx.options.stringKeys &&
26205
- (!isScalar$1(node) ||
26206
- typeof node.value !== 'string' ||
26207
- (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
26208
- const msg = 'With stringKeys, all keys must be strings';
26209
- onError(tag ?? token, 'NON_STRING_KEY', msg);
26210
- }
26211
26029
  if (spaceBefore)
26212
26030
  node.spaceBefore = true;
26213
26031
  if (comment) {
@@ -26260,7 +26078,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26260
26078
  const opts = Object.assign({ _directives: directives }, options);
26261
26079
  const doc = new Document(undefined, opts);
26262
26080
  const ctx = {
26263
- atKey: false,
26264
26081
  atRoot: true,
26265
26082
  directives: doc.directives,
26266
26083
  options: doc.options,
@@ -28395,20 +28212,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
28395
28212
  default: {
28396
28213
  const bv = this.startBlockValue(map);
28397
28214
  if (bv) {
28398
- if (bv.type === 'block-seq') {
28399
- if (!it.explicitKey &&
28400
- it.sep &&
28401
- !includesToken(it.sep, 'newline')) {
28402
- yield* this.pop({
28403
- type: 'error',
28404
- offset: this.offset,
28405
- message: 'Unexpected block-seq-ind on same line with key',
28406
- source: this.source
28407
- });
28408
- return;
28409
- }
28410
- }
28411
- else if (atMapIndent) {
28215
+ if (atMapIndent && bv.type !== 'block-seq') {
28412
28216
  map.items.push({ start });
28413
28217
  }
28414
28218
  this.stack.push(bv);
@@ -28779,8 +28583,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
28779
28583
  if (!keepUndefined)
28780
28584
  return undefined;
28781
28585
  }
28782
- if (isDocument(value) && !_replacer)
28783
- return value.toString(options);
28784
28586
  return new Document(value, _replacer, options).toString(options);
28785
28587
  }
28786
28588