@thoughtspot/visual-embed-sdk 1.42.1-alpha.7 → 1.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +4 -3
- package/cjs/src/css-variables.d.ts +0 -48
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +20 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +9 -4
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +62 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +1 -1
- package/cjs/src/embed/conversation.d.ts +16 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +5 -2
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +25 -1
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +0 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +5 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +46 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +4 -4
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -3
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +0 -2
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +14 -42
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +0 -2
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.js +1 -1
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +3 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +1 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -2
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +5 -3
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/all-types-export.spec.js +0 -8
- package/cjs/src/react/all-types-export.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -2
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/util.d.ts +1 -0
- package/cjs/src/react/util.d.ts.map +1 -1
- package/cjs/src/types.d.ts +58 -93
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +21 -46
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.d.ts.map +1 -1
- package/cjs/src/utils/custom-actions.js +9 -0
- package/cjs/src/utils/custom-actions.js.map +1 -1
- package/cjs/src/utils/custom-actions.spec.js +20 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -1
- package/cjs/src/utils/processData.d.ts +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +8 -8
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/{index-DvNA626T.js → index-CjbriUI0.js} +1 -1
- package/dist/src/css-variables.d.ts +0 -48
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +20 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts +1 -1
- package/dist/src/embed/conversation.d.ts +16 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +4 -4
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +0 -2
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -2
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -2
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +1 -0
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/types.d.ts +58 -93
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/custom-actions.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +86 -222
- package/dist/tsembed-react.js +230 -442
- package/dist/tsembed.es.js +85 -222
- package/dist/tsembed.js +228 -441
- package/dist/visual-embed-sdk-react-full.d.ts +104 -160
- package/dist/visual-embed-sdk-react.d.ts +95 -155
- package/dist/visual-embed-sdk.d.ts +95 -158
- package/lib/package.json +4 -3
- package/lib/src/css-variables.d.ts +0 -48
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +20 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +9 -4
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +62 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +1 -1
- package/lib/src/embed/conversation.d.ts +16 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +5 -2
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +25 -1
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +0 -1
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +5 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +47 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +4 -4
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +0 -2
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +14 -42
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +0 -2
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.js +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +3 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -2
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +2 -2
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/all-types-export.spec.js +0 -8
- package/lib/src/react/all-types-export.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -2
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +4 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/util.d.ts +1 -0
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/types.d.ts +58 -93
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +20 -45
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.d.ts.map +1 -1
- package/lib/src/utils/custom-actions.js +9 -0
- package/lib/src/utils/custom-actions.js.map +1 -1
- package/lib/src/utils/custom-actions.spec.js +20 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -1
- package/lib/src/utils/processData.d.ts +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -8
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/package.json +4 -3
- package/src/css-variables.ts +0 -58
- package/src/embed/app.spec.ts +87 -0
- package/src/embed/app.ts +35 -4
- package/src/embed/bodyless-conversation.ts +1 -1
- package/src/embed/conversation.spec.ts +35 -1
- package/src/embed/conversation.ts +22 -0
- package/src/embed/hostEventClient/contracts.ts +0 -10
- package/src/embed/liveboard.spec.ts +60 -0
- package/src/embed/liveboard.ts +9 -0
- package/src/embed/sage.ts +4 -4
- package/src/embed/search.ts +1 -3
- package/src/embed/ts-embed.spec.ts +7 -9
- package/src/embed/ts-embed.ts +31 -67
- package/src/errors.ts +1 -1
- package/src/index.ts +3 -4
- package/src/react/all-types-export.spec.ts +1 -9
- package/src/react/all-types-export.ts +8 -10
- package/src/react/index.tsx +130 -155
- package/src/types.ts +56 -94
- package/src/utils/custom-actions.spec.ts +22 -0
- package/src/utils/custom-actions.ts +11 -0
- package/src/utils/processData.spec.ts +1 -0
- package/src/utils/processData.ts +11 -11
- package/cjs/src/api-intercept.d.ts +0 -31
- package/cjs/src/api-intercept.d.ts.map +0 -1
- package/cjs/src/api-intercept.js +0 -119
- package/cjs/src/api-intercept.js.map +0 -1
- package/cjs/src/api-intercept.spec.d.ts +0 -2
- package/cjs/src/api-intercept.spec.d.ts.map +0 -1
- package/cjs/src/api-intercept.spec.js +0 -122
- package/cjs/src/api-intercept.spec.js.map +0 -1
- package/dist/index-BCC3Z072.js +0 -7371
- package/dist/index-BEzW4MDA.js +0 -7371
- package/dist/index-BaESA9rq.js +0 -7371
- package/dist/index-CFNZIcKr.js +0 -7447
- package/dist/index-CqKTa1Fe.js +0 -7447
- package/dist/index-DFnPKcjZ.js +0 -7447
- package/dist/index-DhFH7b7U.js +0 -7447
- package/dist/src/api-intercept.d.ts +0 -31
- package/dist/src/api-intercept.d.ts.map +0 -1
- package/dist/src/api-intercept.spec.d.ts +0 -2
- package/dist/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.d.ts +0 -31
- package/lib/src/api-intercept.d.ts.map +0 -1
- package/lib/src/api-intercept.js +0 -112
- package/lib/src/api-intercept.js.map +0 -1
- package/lib/src/api-intercept.spec.d.ts +0 -2
- package/lib/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.spec.js +0 -119
- package/lib/src/api-intercept.spec.js.map +0 -1
- package/src/api-intercept.ts +0 -139
package/dist/tsembed-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.42.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.42.2 */
|
|
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
|
|
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
|
|
176
|
-
? merge
|
|
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
|
|
182
|
+
result[key] = merge(result[key], current[key]);
|
|
183
183
|
}
|
|
184
184
|
else {
|
|
185
185
|
result[key] =
|
|
186
186
|
current[key] === undefined
|
|
187
|
-
? merge
|
|
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
|
|
201
|
-
merge
|
|
202
|
-
merge
|
|
203
|
-
const result = merge
|
|
204
|
-
merge
|
|
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
|
|
|
@@ -1573,7 +1573,7 @@
|
|
|
1573
1573
|
* the table visualization.
|
|
1574
1574
|
*
|
|
1575
1575
|
* If the Row-Level Security (RLS) rules are applied on the
|
|
1576
|
-
*
|
|
1576
|
+
* Model, exercise caution when changing column
|
|
1577
1577
|
* or table cell values to maintain data security.
|
|
1578
1578
|
*
|
|
1579
1579
|
* @example
|
|
@@ -1631,7 +1631,7 @@
|
|
|
1631
1631
|
*/
|
|
1632
1632
|
EmbedEvent["SpotterData"] = "SpotterData";
|
|
1633
1633
|
/**
|
|
1634
|
-
* Emitted when user opens up the
|
|
1634
|
+
* Emitted when user opens up the data source preview modal in Spotter embed.
|
|
1635
1635
|
* @example
|
|
1636
1636
|
* ```js
|
|
1637
1637
|
* spotterEmbed.on(EmbedEvent.PreviewSpotterData, (payload) => {
|
|
@@ -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
|
|
@@ -1872,9 +1857,7 @@
|
|
|
1872
1857
|
*/
|
|
1873
1858
|
HostEvent["Reload"] = "reload";
|
|
1874
1859
|
/**
|
|
1875
|
-
* Get iframe URL for the current embed view
|
|
1876
|
-
* Developers can use this URL to embed a ThoughtSpot object
|
|
1877
|
-
* in apps like Salesforce or Sharepoint.
|
|
1860
|
+
* Get iframe URL for the current embed view.
|
|
1878
1861
|
* @example
|
|
1879
1862
|
* ```js
|
|
1880
1863
|
* const url = embed.trigger(HostEvent.GetIframeUrl);
|
|
@@ -2946,7 +2929,7 @@
|
|
|
2946
2929
|
*/
|
|
2947
2930
|
HostEvent["EditLastPrompt"] = "EditLastPrompt";
|
|
2948
2931
|
/**
|
|
2949
|
-
* Opens the
|
|
2932
|
+
* Opens the data source preview modal in Spotter Embed.
|
|
2950
2933
|
* @example
|
|
2951
2934
|
* ```js
|
|
2952
2935
|
* spotterEmbed.trigger(HostEvent.PreviewSpotterData);
|
|
@@ -3071,6 +3054,7 @@
|
|
|
3071
3054
|
Param["HideResult"] = "hideResult";
|
|
3072
3055
|
Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
|
|
3073
3056
|
Param["Tag"] = "tag";
|
|
3057
|
+
Param["HideTagFilterChips"] = "hideTagFilterChips";
|
|
3074
3058
|
Param["AutoLogin"] = "autoLogin";
|
|
3075
3059
|
Param["searchTokenString"] = "searchTokenString";
|
|
3076
3060
|
Param["executeSearch"] = "executeSearch";
|
|
@@ -3159,6 +3143,7 @@
|
|
|
3159
3143
|
Param["ShowLiveboardReverifyBanner"] = "showLiveboardReverifyBanner";
|
|
3160
3144
|
Param["LiveboardHeaderV2"] = "isLiveboardHeaderV2Enabled";
|
|
3161
3145
|
Param["HideIrrelevantFiltersInTab"] = "hideIrrelevantFiltersAtTabLevel";
|
|
3146
|
+
Param["IsEnhancedFilterInteractivityEnabled"] = "isLiveboardPermissionV2Enabled";
|
|
3162
3147
|
Param["SpotterEnabled"] = "isSpotterExperienceEnabled";
|
|
3163
3148
|
Param["IsUnifiedSearchExperienceEnabled"] = "isUnifiedSearchExperienceEnabled";
|
|
3164
3149
|
Param["OverrideOrgId"] = "orgId";
|
|
@@ -3175,7 +3160,9 @@
|
|
|
3175
3160
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3176
3161
|
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3177
3162
|
Param["isPNGInScheduledEmailsEnabled"] = "isPNGInScheduledEmailsEnabled";
|
|
3163
|
+
Param["isCentralizedLiveboardFilterUXEnabled"] = "isCentralizedLiveboardFilterUXEnabled";
|
|
3178
3164
|
Param["isLinkParametersEnabled"] = "isLinkParametersEnabled";
|
|
3165
|
+
Param["EnablePastConversationsSidebar"] = "enablePastConversationsSidebar";
|
|
3179
3166
|
})(Param || (Param = {}));
|
|
3180
3167
|
/**
|
|
3181
3168
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3288,7 +3275,7 @@
|
|
|
3288
3275
|
*/
|
|
3289
3276
|
Action["SchedulesList"] = "schedule-list";
|
|
3290
3277
|
/**
|
|
3291
|
-
* The **Share** action on a Liveboard, Answer, or
|
|
3278
|
+
* The **Share** action on a Liveboard, Answer, or Model.
|
|
3292
3279
|
* Allows users to share an object with other users and groups.
|
|
3293
3280
|
* @example
|
|
3294
3281
|
* ```js
|
|
@@ -3746,7 +3733,7 @@
|
|
|
3746
3733
|
Action["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
3747
3734
|
/**
|
|
3748
3735
|
* The Favorites icon (*) for Answers,
|
|
3749
|
-
* Liveboard, and data objects like
|
|
3736
|
+
* Liveboard, and data objects like Model,
|
|
3750
3737
|
* Tables and Views.
|
|
3751
3738
|
* Allows adding an object to the user's favorites list.
|
|
3752
3739
|
* @example
|
|
@@ -4480,6 +4467,16 @@
|
|
|
4480
4467
|
* @version SDK: 1.42.0 | ThoughtSpot Cloud: 10.14.0.cl
|
|
4481
4468
|
*/
|
|
4482
4469
|
Action["RemoveAttachment"] = "removeAttachment";
|
|
4470
|
+
/**
|
|
4471
|
+
* The **Style panel** on a Liveboard.
|
|
4472
|
+
* Controls the visibility of the Liveboard style panel.
|
|
4473
|
+
* @example
|
|
4474
|
+
* ```js
|
|
4475
|
+
* hiddenActions: [Action.LiveboardStylePanel]
|
|
4476
|
+
* ```
|
|
4477
|
+
* @version SDK: 1.43.0 | ThoughtSpot Cloud: 10.15.0.cl
|
|
4478
|
+
*/
|
|
4479
|
+
Action["LiveboardStylePanel"] = "liveboardStylePanel";
|
|
4483
4480
|
})(exports.Action || (exports.Action = {}));
|
|
4484
4481
|
var PrefetchFeatures;
|
|
4485
4482
|
(function (PrefetchFeatures) {
|
|
@@ -4601,29 +4598,7 @@
|
|
|
4601
4598
|
* @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
|
|
4602
4599
|
*/
|
|
4603
4600
|
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 = {}));
|
|
4601
|
+
})(exports.LogLevel || (exports.LogLevel = {}));
|
|
4627
4602
|
|
|
4628
4603
|
const logFunctions = {
|
|
4629
4604
|
[exports.LogLevel.SILENT]: () => undefined,
|
|
@@ -4892,7 +4867,7 @@
|
|
|
4892
4867
|
function getDOMNode(domSelector) {
|
|
4893
4868
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
4894
4869
|
}
|
|
4895
|
-
const deepMerge = (target, source) => merge
|
|
4870
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
4896
4871
|
const getOperationNameFromQuery = (query) => {
|
|
4897
4872
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
4898
4873
|
const matches = query.match(regex);
|
|
@@ -7386,20 +7361,9 @@
|
|
|
7386
7361
|
|
|
7387
7362
|
var isEmpty_1 = isEmpty$1;
|
|
7388
7363
|
|
|
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
7364
|
const ERROR_MESSAGE = {
|
|
7401
7365
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
7402
|
-
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a
|
|
7366
|
+
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a Model to get started',
|
|
7403
7367
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a Liveboard to embed.',
|
|
7404
7368
|
TRIGGER_TIMED_OUT: 'Trigger timed-out in getting a response',
|
|
7405
7369
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'SearchEmbed is in Beta in this release.',
|
|
@@ -9849,6 +9813,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
9849
9813
|
finalValidActions.push(action);
|
|
9850
9814
|
}
|
|
9851
9815
|
});
|
|
9816
|
+
// Step 4: Collect warnings for long custom action names
|
|
9817
|
+
const MAX_ACTION_NAME_LENGTH = 30;
|
|
9818
|
+
const warnings = finalValidActions
|
|
9819
|
+
.filter(action => action.name.length > MAX_ACTION_NAME_LENGTH)
|
|
9820
|
+
.map(action => `Custom action name '${action.name}' exceeds ${MAX_ACTION_NAME_LENGTH} characters. This may cause display or truncation issues in the UI.`);
|
|
9821
|
+
if (warnings.length > 0) {
|
|
9822
|
+
logger$3.warn(warnings);
|
|
9823
|
+
}
|
|
9852
9824
|
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9853
9825
|
return {
|
|
9854
9826
|
actions: sortedActions,
|
|
@@ -17481,27 +17453,27 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17481
17453
|
* @param thoughtSpotHost
|
|
17482
17454
|
* @param containerEl
|
|
17483
17455
|
*/
|
|
17484
|
-
function processEventData(type,
|
|
17456
|
+
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
17485
17457
|
switch (type) {
|
|
17486
17458
|
case exports.EmbedEvent.CustomAction:
|
|
17487
|
-
return processCustomAction(
|
|
17459
|
+
return processCustomAction(e, thoughtSpotHost);
|
|
17488
17460
|
case exports.EmbedEvent.AuthInit:
|
|
17489
|
-
return processAuthInit(
|
|
17461
|
+
return processAuthInit(e);
|
|
17490
17462
|
case exports.EmbedEvent.NoCookieAccess:
|
|
17491
|
-
return processNoCookieAccess(
|
|
17463
|
+
return processNoCookieAccess(e, containerEl);
|
|
17492
17464
|
case exports.EmbedEvent.AuthFailure:
|
|
17493
|
-
return processAuthFailure(
|
|
17465
|
+
return processAuthFailure(e, containerEl);
|
|
17494
17466
|
case exports.EmbedEvent.AuthLogout:
|
|
17495
|
-
return processAuthLogout(
|
|
17467
|
+
return processAuthLogout(e, containerEl);
|
|
17496
17468
|
case exports.EmbedEvent.ExitPresentMode:
|
|
17497
17469
|
return processExitPresentMode();
|
|
17498
17470
|
case exports.EmbedEvent.CLEAR_INFO_CACHE:
|
|
17499
17471
|
return processClearInfoCache();
|
|
17500
17472
|
}
|
|
17501
|
-
return
|
|
17473
|
+
return e;
|
|
17502
17474
|
}
|
|
17503
17475
|
|
|
17504
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.
|
|
17476
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.2";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 test && 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
17477
|
|
|
17506
17478
|
/**
|
|
17507
17479
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -17573,6 +17545,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17573
17545
|
});
|
|
17574
17546
|
}
|
|
17575
17547
|
|
|
17548
|
+
var UIPassthroughEvent;
|
|
17549
|
+
(function (UIPassthroughEvent) {
|
|
17550
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
17551
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
17552
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
17553
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
|
|
17554
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
17555
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
17556
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
17557
|
+
|
|
17576
17558
|
class HostEventClient {
|
|
17577
17559
|
constructor(iFrame) {
|
|
17578
17560
|
this.iFrame = iFrame;
|
|
@@ -17664,111 +17646,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17664
17646
|
}
|
|
17665
17647
|
}
|
|
17666
17648
|
|
|
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, _d, _e, _f, _g;
|
|
17752
|
-
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);
|
|
17753
|
-
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);
|
|
17754
|
-
const payloadToSend = {
|
|
17755
|
-
execute: (_g = payload === null || payload === void 0 ? void 0 : payload.data) === null || _g === void 0 ? void 0 : _g.execute,
|
|
17756
|
-
response: {
|
|
17757
|
-
body: {
|
|
17758
|
-
errors: [
|
|
17759
|
-
{
|
|
17760
|
-
title: errorText,
|
|
17761
|
-
description: errorDescription,
|
|
17762
|
-
isUserError: true,
|
|
17763
|
-
},
|
|
17764
|
-
],
|
|
17765
|
-
data: {},
|
|
17766
|
-
},
|
|
17767
|
-
},
|
|
17768
|
-
};
|
|
17769
|
-
return { data: payloadToSend };
|
|
17770
|
-
};
|
|
17771
|
-
|
|
17772
17649
|
/**
|
|
17773
17650
|
* Copyright (c) 2022
|
|
17774
17651
|
*
|
|
@@ -17822,27 +17699,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17822
17699
|
*/
|
|
17823
17700
|
this.fullscreenChangeHandler = null;
|
|
17824
17701
|
this.subscribedListeners = {};
|
|
17825
|
-
this.messageEventListener = async (event) => {
|
|
17826
|
-
const eventType = this.getEventType(event);
|
|
17827
|
-
const eventPort = this.getEventPort(event);
|
|
17828
|
-
const eventData = this.formatEventData(event, eventType);
|
|
17829
|
-
if (event.source === this.iFrame.contentWindow) {
|
|
17830
|
-
const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
17831
|
-
const executeEvent = (_eventType, data) => {
|
|
17832
|
-
this.executeCallbacks(_eventType, data, eventPort);
|
|
17833
|
-
};
|
|
17834
|
-
if (eventType === exports.EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
|
|
17835
|
-
const getUnsavedAnswerTml = async (props) => {
|
|
17836
|
-
var _a;
|
|
17837
|
-
const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
|
|
17838
|
-
return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
17839
|
-
};
|
|
17840
|
-
handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
|
|
17841
|
-
return;
|
|
17842
|
-
}
|
|
17843
|
-
this.executeCallbacks(eventType, processedEventData, eventPort);
|
|
17844
|
-
}
|
|
17845
|
-
};
|
|
17846
17702
|
/**
|
|
17847
17703
|
* Send Custom style as part of payload of APP_INIT
|
|
17848
17704
|
* @param _
|
|
@@ -17927,18 +17783,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17927
17783
|
this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
|
|
17928
17784
|
};
|
|
17929
17785
|
this.showPreRenderByDefault = false;
|
|
17930
|
-
this.createEmbedEventResponder = (eventPort, eventType) => {
|
|
17931
|
-
const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
|
|
17932
|
-
if (eventType === exports.EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
|
|
17933
|
-
return (payload) => {
|
|
17934
|
-
const payloadToSend = processLegacyInterceptResponse(payload);
|
|
17935
|
-
this.triggerEventOnPort(eventPort, payloadToSend);
|
|
17936
|
-
};
|
|
17937
|
-
}
|
|
17938
|
-
return (payload) => {
|
|
17939
|
-
this.triggerEventOnPort(eventPort, payload);
|
|
17940
|
-
};
|
|
17941
|
-
};
|
|
17942
17786
|
/**
|
|
17943
17787
|
* @hidden
|
|
17944
17788
|
* Internal state to track if the embed container is loaded.
|
|
@@ -18124,8 +17968,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18124
17968
|
*/
|
|
18125
17969
|
subscribeToMessageEvents() {
|
|
18126
17970
|
this.unsubscribeToMessageEvents();
|
|
18127
|
-
|
|
18128
|
-
|
|
17971
|
+
const messageEventListener = (event) => {
|
|
17972
|
+
const eventType = this.getEventType(event);
|
|
17973
|
+
const eventPort = this.getEventPort(event);
|
|
17974
|
+
const eventData = this.formatEventData(event, eventType);
|
|
17975
|
+
if (event.source === this.iFrame.contentWindow) {
|
|
17976
|
+
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
|
|
17977
|
+
}
|
|
17978
|
+
};
|
|
17979
|
+
window.addEventListener('message', messageEventListener);
|
|
17980
|
+
this.subscribedListeners.message = messageEventListener;
|
|
18129
17981
|
}
|
|
18130
17982
|
/**
|
|
18131
17983
|
* Adds event listeners for both network and message events.
|
|
@@ -18186,7 +18038,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18186
18038
|
message: customActionsResult.errors,
|
|
18187
18039
|
});
|
|
18188
18040
|
}
|
|
18189
|
-
|
|
18041
|
+
return {
|
|
18190
18042
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
18191
18043
|
authToken,
|
|
18192
18044
|
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
@@ -18204,9 +18056,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18204
18056
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
18205
18057
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
18206
18058
|
customActions: customActionsResult.actions,
|
|
18207
|
-
...getInterceptInitData(this.embedConfig, this.viewConfig),
|
|
18208
18059
|
};
|
|
18209
|
-
return baseInitData;
|
|
18210
18060
|
}
|
|
18211
18061
|
async getAppInitData() {
|
|
18212
18062
|
return this.getDefaultAppInitData();
|
|
@@ -18635,8 +18485,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
18635
18485
|
// When start status is false it trigger only end releated
|
|
18636
18486
|
// payload
|
|
18637
18487
|
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
18638
|
-
|
|
18639
|
-
|
|
18488
|
+
callbackObj.callback(data, (payload) => {
|
|
18489
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
18490
|
+
});
|
|
18640
18491
|
}
|
|
18641
18492
|
});
|
|
18642
18493
|
}
|
|
@@ -19420,8 +19271,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19420
19271
|
if (hideSearchBar) {
|
|
19421
19272
|
queryParams[Param.HideSearchBar] = true;
|
|
19422
19273
|
}
|
|
19423
|
-
|
|
19424
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
19274
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19425
19275
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
19426
19276
|
}
|
|
19427
19277
|
if (!focusSearchBarOnRender) {
|
|
@@ -19682,7 +19532,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19682
19532
|
* embedded Liveboard or visualization.
|
|
19683
19533
|
*/
|
|
19684
19534
|
getEmbedParams() {
|
|
19685
|
-
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;
|
|
19535
|
+
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, isEnhancedFilterInteractivityEnabled = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isCentralizedLiveboardFilterUXEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
|
|
19686
19536
|
let params = {};
|
|
19687
19537
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
19688
19538
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -19694,6 +19544,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19694
19544
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
19695
19545
|
params[Param.IsFullAppEmbed] = true;
|
|
19696
19546
|
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
19547
|
+
params[Param.IsEnhancedFilterInteractivityEnabled] = isEnhancedFilterInteractivityEnabled;
|
|
19697
19548
|
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
19698
19549
|
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
19699
19550
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
@@ -19735,8 +19586,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19735
19586
|
if (enableAskSage) {
|
|
19736
19587
|
params[Param.enableAskSage] = enableAskSage;
|
|
19737
19588
|
}
|
|
19738
|
-
|
|
19739
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
19589
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19740
19590
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
19741
19591
|
}
|
|
19742
19592
|
if (homePageSearchBarMode) {
|
|
@@ -19751,9 +19601,15 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19751
19601
|
if (isPNGInScheduledEmailsEnabled !== undefined) {
|
|
19752
19602
|
params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
|
|
19753
19603
|
}
|
|
19604
|
+
if (hideTagFilterChips !== undefined) {
|
|
19605
|
+
params[Param.HideTagFilterChips] = hideTagFilterChips;
|
|
19606
|
+
}
|
|
19754
19607
|
if (isLinkParametersEnabled !== undefined) {
|
|
19755
19608
|
params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
|
|
19756
19609
|
}
|
|
19610
|
+
if (isCentralizedLiveboardFilterUXEnabled != undefined) {
|
|
19611
|
+
params[Param.isCentralizedLiveboardFilterUXEnabled] = isCentralizedLiveboardFilterUXEnabled;
|
|
19612
|
+
}
|
|
19757
19613
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
19758
19614
|
params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
|
|
19759
19615
|
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
@@ -20108,7 +19964,7 @@ query GetEurekaVizSnapshots(
|
|
|
20108
19964
|
getEmbedParamsObject() {
|
|
20109
19965
|
let params = {};
|
|
20110
19966
|
params = this.getBaseQueryParams(params);
|
|
20111
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = true, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, showSpotterLimitations, isLinkParametersEnabled, } = this.viewConfig;
|
|
19967
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, isEnhancedFilterInteractivityEnabled = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = true, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, showSpotterLimitations, isCentralizedLiveboardFilterUXEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
|
|
20112
19968
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
20113
19969
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
20114
19970
|
if (fullHeight === true) {
|
|
@@ -20176,11 +20032,15 @@ query GetEurekaVizSnapshots(
|
|
|
20176
20032
|
if (isLinkParametersEnabled !== undefined) {
|
|
20177
20033
|
params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
|
|
20178
20034
|
}
|
|
20035
|
+
if (isCentralizedLiveboardFilterUXEnabled !== undefined) {
|
|
20036
|
+
params[Param.isCentralizedLiveboardFilterUXEnabled] = isCentralizedLiveboardFilterUXEnabled;
|
|
20037
|
+
}
|
|
20179
20038
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
20180
20039
|
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
20181
20040
|
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
20182
20041
|
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
20183
20042
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
20043
|
+
params[Param.IsEnhancedFilterInteractivityEnabled] = isEnhancedFilterInteractivityEnabled;
|
|
20184
20044
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
20185
20045
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
20186
20046
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
@@ -20911,7 +20771,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
20911
20771
|
this.viewConfig = viewConfig;
|
|
20912
20772
|
}
|
|
20913
20773
|
getEmbedParamsObject() {
|
|
20914
|
-
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20774
|
+
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, enablePastConversationsSidebar, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20915
20775
|
if (!worksheetId) {
|
|
20916
20776
|
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
|
|
20917
20777
|
}
|
|
@@ -20935,9 +20795,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
20935
20795
|
return queryParams;
|
|
20936
20796
|
}
|
|
20937
20797
|
getIframeSrc() {
|
|
20938
|
-
const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
|
|
20798
|
+
const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, enablePastConversationsSidebar } = this.viewConfig;
|
|
20939
20799
|
const path = 'insights/conv-assist';
|
|
20940
20800
|
const queryParams = this.getEmbedParamsObject();
|
|
20801
|
+
if (!isUndefined_1(enablePastConversationsSidebar)) {
|
|
20802
|
+
queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar;
|
|
20803
|
+
}
|
|
20941
20804
|
let query = '';
|
|
20942
20805
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
20943
20806
|
if (queryParamsString) {
|
|
@@ -21039,6 +20902,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
21039
20902
|
});
|
|
21040
20903
|
handleRendering(tsEmbed);
|
|
21041
20904
|
if (forwardedRef) {
|
|
20905
|
+
// eslint-disable-next-line no-param-reassign
|
|
21042
20906
|
forwardedRef.current = tsEmbed;
|
|
21043
20907
|
}
|
|
21044
20908
|
return () => {
|
|
@@ -21259,7 +21123,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
21259
21123
|
*/
|
|
21260
21124
|
const SpotterMessage = React.forwardRef((props, ref) => {
|
|
21261
21125
|
const { message, query: _, ...otherProps } = props;
|
|
21262
|
-
return React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps });
|
|
21126
|
+
return (React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
|
|
21263
21127
|
});
|
|
21264
21128
|
/**
|
|
21265
21129
|
* React component for PreRendered Conversation embed.
|
|
@@ -21852,7 +21716,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
21852
21716
|
return {
|
|
21853
21717
|
onAnchor: (source) => {
|
|
21854
21718
|
aliasObjects.push(source);
|
|
21855
|
-
|
|
21719
|
+
if (!prevAnchors)
|
|
21720
|
+
prevAnchors = anchorNames(doc);
|
|
21856
21721
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
21857
21722
|
prevAnchors.add(anchor);
|
|
21858
21723
|
return anchor;
|
|
@@ -22016,36 +21881,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22016
21881
|
* Resolve the value of this alias within `doc`, finding the last
|
|
22017
21882
|
* instance of the `source` anchor before this node.
|
|
22018
21883
|
*/
|
|
22019
|
-
resolve(doc
|
|
22020
|
-
let nodes;
|
|
22021
|
-
if (ctx?.aliasResolveCache) {
|
|
22022
|
-
nodes = ctx.aliasResolveCache;
|
|
22023
|
-
}
|
|
22024
|
-
else {
|
|
22025
|
-
nodes = [];
|
|
22026
|
-
visit$1(doc, {
|
|
22027
|
-
Node: (_key, node) => {
|
|
22028
|
-
if (isAlias(node) || hasAnchor(node))
|
|
22029
|
-
nodes.push(node);
|
|
22030
|
-
}
|
|
22031
|
-
});
|
|
22032
|
-
if (ctx)
|
|
22033
|
-
ctx.aliasResolveCache = nodes;
|
|
22034
|
-
}
|
|
21884
|
+
resolve(doc) {
|
|
22035
21885
|
let found = undefined;
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
|
|
21886
|
+
visit$1(doc, {
|
|
21887
|
+
Node: (_key, node) => {
|
|
21888
|
+
if (node === this)
|
|
21889
|
+
return visit$1.BREAK;
|
|
21890
|
+
if (node.anchor === this.source)
|
|
21891
|
+
found = node;
|
|
21892
|
+
}
|
|
21893
|
+
});
|
|
22042
21894
|
return found;
|
|
22043
21895
|
}
|
|
22044
21896
|
toJSON(_arg, ctx) {
|
|
22045
21897
|
if (!ctx)
|
|
22046
21898
|
return { source: this.source };
|
|
22047
21899
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
22048
|
-
const source = this.resolve(doc
|
|
21900
|
+
const source = this.resolve(doc);
|
|
22049
21901
|
if (!source) {
|
|
22050
21902
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
22051
21903
|
throw new ReferenceError(msg);
|
|
@@ -22164,7 +22016,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22164
22016
|
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
22165
22017
|
ref = sourceObjects.get(value);
|
|
22166
22018
|
if (ref) {
|
|
22167
|
-
|
|
22019
|
+
if (!ref.anchor)
|
|
22020
|
+
ref.anchor = onAnchor(value);
|
|
22168
22021
|
return new Alias(ref.anchor);
|
|
22169
22022
|
}
|
|
22170
22023
|
else {
|
|
@@ -22675,7 +22528,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22675
22528
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
22676
22529
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
22677
22530
|
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
22678
|
-
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
22531
|
+
if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
|
|
22679
22532
|
return quotedString(value, ctx);
|
|
22680
22533
|
}
|
|
22681
22534
|
const indent = ctx.indent ||
|
|
@@ -22735,32 +22588,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22735
22588
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
22736
22589
|
}
|
|
22737
22590
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
22738
|
-
|
|
22739
|
-
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
22591
|
+
let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
|
|
22740
22592
|
if (comment) {
|
|
22741
22593
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
22742
22594
|
if (onComment)
|
|
22743
22595
|
onComment();
|
|
22744
22596
|
}
|
|
22745
|
-
if (
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
22749
|
-
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
22750
|
-
.replace(/\n+/g, `$&${indent}`);
|
|
22751
|
-
let literalFallback = false;
|
|
22752
|
-
const foldOptions = getFoldOptions(ctx, true);
|
|
22753
|
-
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
22754
|
-
foldOptions.onOverflow = () => {
|
|
22755
|
-
literalFallback = true;
|
|
22756
|
-
};
|
|
22757
|
-
}
|
|
22758
|
-
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
22759
|
-
if (!literalFallback)
|
|
22760
|
-
return `>${header}\n${indent}${body}`;
|
|
22597
|
+
if (literal) {
|
|
22598
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
22599
|
+
return `${header}\n${indent}${start}${value}${end}`;
|
|
22761
22600
|
}
|
|
22762
|
-
value = value
|
|
22763
|
-
|
|
22601
|
+
value = value
|
|
22602
|
+
.replace(/\n+/g, '\n$&')
|
|
22603
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
22604
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
22605
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
22606
|
+
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
22607
|
+
return `${header}\n${indent}${body}`;
|
|
22764
22608
|
}
|
|
22765
22609
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
22766
22610
|
const { type, value } = item;
|
|
@@ -22769,9 +22613,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22769
22613
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
22770
22614
|
return quotedString(value, ctx);
|
|
22771
22615
|
}
|
|
22772
|
-
if (
|
|
22616
|
+
if (!value ||
|
|
22617
|
+
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
22773
22618
|
// not allowed:
|
|
22774
|
-
// - '-' or '?'
|
|
22619
|
+
// - empty string, '-' or '?'
|
|
22775
22620
|
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
22776
22621
|
// - '\n ', ': ' or ' \n' anywhere
|
|
22777
22622
|
// - '#' not preceded by a non-space char
|
|
@@ -22900,12 +22745,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22900
22745
|
let obj;
|
|
22901
22746
|
if (isScalar$1(item)) {
|
|
22902
22747
|
obj = item.value;
|
|
22903
|
-
|
|
22904
|
-
if (match.length > 1) {
|
|
22905
|
-
const testMatch = match.filter(t => t.test);
|
|
22906
|
-
if (testMatch.length > 0)
|
|
22907
|
-
match = testMatch;
|
|
22908
|
-
}
|
|
22748
|
+
const match = tags.filter(t => t.identify?.(obj));
|
|
22909
22749
|
tagObj =
|
|
22910
22750
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
|
22911
22751
|
}
|
|
@@ -22914,7 +22754,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22914
22754
|
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
|
22915
22755
|
}
|
|
22916
22756
|
if (!tagObj) {
|
|
22917
|
-
const name = obj?.constructor?.name ??
|
|
22757
|
+
const name = obj?.constructor?.name ?? typeof obj;
|
|
22918
22758
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
22919
22759
|
}
|
|
22920
22760
|
return tagObj;
|
|
@@ -22929,7 +22769,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22929
22769
|
anchors.add(anchor);
|
|
22930
22770
|
props.push(`&${anchor}`);
|
|
22931
22771
|
}
|
|
22932
|
-
const tag = node.tag
|
|
22772
|
+
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
|
|
22933
22773
|
if (tag)
|
|
22934
22774
|
props.push(doc.directives.tagString(tag));
|
|
22935
22775
|
return props.join(' ');
|
|
@@ -22955,7 +22795,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
22955
22795
|
const node = isNode(item)
|
|
22956
22796
|
? item
|
|
22957
22797
|
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
|
|
22958
|
-
|
|
22798
|
+
if (!tagObj)
|
|
22799
|
+
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
22959
22800
|
const props = stringifyProps(node, tagObj, ctx);
|
|
22960
22801
|
if (props.length > 0)
|
|
22961
22802
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
@@ -23117,10 +22958,54 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23117
22958
|
|
|
23118
22959
|
function warn(logLevel, warning) {
|
|
23119
22960
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
23120
|
-
|
|
22961
|
+
if (typeof process !== 'undefined' && process.emitWarning)
|
|
22962
|
+
process.emitWarning(warning);
|
|
22963
|
+
else
|
|
22964
|
+
console.warn(warning);
|
|
23121
22965
|
}
|
|
23122
22966
|
}
|
|
23123
22967
|
|
|
22968
|
+
const MERGE_KEY = '<<';
|
|
22969
|
+
function addPairToJSMap(ctx, map, { key, value }) {
|
|
22970
|
+
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
|
22971
|
+
value = isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
22972
|
+
if (isSeq(value))
|
|
22973
|
+
for (const it of value.items)
|
|
22974
|
+
mergeToJSMap(ctx, map, it);
|
|
22975
|
+
else if (Array.isArray(value))
|
|
22976
|
+
for (const it of value)
|
|
22977
|
+
mergeToJSMap(ctx, map, it);
|
|
22978
|
+
else
|
|
22979
|
+
mergeToJSMap(ctx, map, value);
|
|
22980
|
+
}
|
|
22981
|
+
else {
|
|
22982
|
+
const jsKey = toJS(key, '', ctx);
|
|
22983
|
+
if (map instanceof Map) {
|
|
22984
|
+
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
22985
|
+
}
|
|
22986
|
+
else if (map instanceof Set) {
|
|
22987
|
+
map.add(jsKey);
|
|
22988
|
+
}
|
|
22989
|
+
else {
|
|
22990
|
+
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
22991
|
+
const jsValue = toJS(value, stringKey, ctx);
|
|
22992
|
+
if (stringKey in map)
|
|
22993
|
+
Object.defineProperty(map, stringKey, {
|
|
22994
|
+
value: jsValue,
|
|
22995
|
+
writable: true,
|
|
22996
|
+
enumerable: true,
|
|
22997
|
+
configurable: true
|
|
22998
|
+
});
|
|
22999
|
+
else
|
|
23000
|
+
map[stringKey] = jsValue;
|
|
23001
|
+
}
|
|
23002
|
+
}
|
|
23003
|
+
return map;
|
|
23004
|
+
}
|
|
23005
|
+
const isMergeKey = (key) => key === MERGE_KEY ||
|
|
23006
|
+
(isScalar$1(key) &&
|
|
23007
|
+
key.value === MERGE_KEY &&
|
|
23008
|
+
(!key.type || key.type === Scalar.PLAIN));
|
|
23124
23009
|
// If the value associated with a merge key is a single mapping node, each of
|
|
23125
23010
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
23126
23011
|
// already exists in it. If the value associated with the merge key is a
|
|
@@ -23128,35 +23013,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23128
23013
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
23129
23014
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
23130
23015
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
23131
|
-
|
|
23132
|
-
const merge = {
|
|
23133
|
-
identify: value => value === MERGE_KEY ||
|
|
23134
|
-
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
23135
|
-
default: 'key',
|
|
23136
|
-
tag: 'tag:yaml.org,2002:merge',
|
|
23137
|
-
test: /^<<$/,
|
|
23138
|
-
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
|
|
23139
|
-
addToJSMap: addMergeToJSMap
|
|
23140
|
-
}),
|
|
23141
|
-
stringify: () => MERGE_KEY
|
|
23142
|
-
};
|
|
23143
|
-
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
23144
|
-
(isScalar$1(key) &&
|
|
23145
|
-
(!key.type || key.type === Scalar.PLAIN) &&
|
|
23146
|
-
merge.identify(key.value))) &&
|
|
23147
|
-
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
23148
|
-
function addMergeToJSMap(ctx, map, value) {
|
|
23149
|
-
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23150
|
-
if (isSeq(value))
|
|
23151
|
-
for (const it of value.items)
|
|
23152
|
-
mergeValue(ctx, map, it);
|
|
23153
|
-
else if (Array.isArray(value))
|
|
23154
|
-
for (const it of value)
|
|
23155
|
-
mergeValue(ctx, map, it);
|
|
23156
|
-
else
|
|
23157
|
-
mergeValue(ctx, map, value);
|
|
23158
|
-
}
|
|
23159
|
-
function mergeValue(ctx, map, value) {
|
|
23016
|
+
function mergeToJSMap(ctx, map, value) {
|
|
23160
23017
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23161
23018
|
if (!isMap(source))
|
|
23162
23019
|
throw new Error('Merge sources must be maps or map aliases');
|
|
@@ -23180,41 +23037,9 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23180
23037
|
}
|
|
23181
23038
|
return map;
|
|
23182
23039
|
}
|
|
23183
|
-
|
|
23184
|
-
function addPairToJSMap(ctx, map, { key, value }) {
|
|
23185
|
-
if (isNode(key) && key.addToJSMap)
|
|
23186
|
-
key.addToJSMap(ctx, map, value);
|
|
23187
|
-
// TODO: Should drop this special case for bare << handling
|
|
23188
|
-
else if (isMergeKey(ctx, key))
|
|
23189
|
-
addMergeToJSMap(ctx, map, value);
|
|
23190
|
-
else {
|
|
23191
|
-
const jsKey = toJS(key, '', ctx);
|
|
23192
|
-
if (map instanceof Map) {
|
|
23193
|
-
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
23194
|
-
}
|
|
23195
|
-
else if (map instanceof Set) {
|
|
23196
|
-
map.add(jsKey);
|
|
23197
|
-
}
|
|
23198
|
-
else {
|
|
23199
|
-
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
23200
|
-
const jsValue = toJS(value, stringKey, ctx);
|
|
23201
|
-
if (stringKey in map)
|
|
23202
|
-
Object.defineProperty(map, stringKey, {
|
|
23203
|
-
value: jsValue,
|
|
23204
|
-
writable: true,
|
|
23205
|
-
enumerable: true,
|
|
23206
|
-
configurable: true
|
|
23207
|
-
});
|
|
23208
|
-
else
|
|
23209
|
-
map[stringKey] = jsValue;
|
|
23210
|
-
}
|
|
23211
|
-
}
|
|
23212
|
-
return map;
|
|
23213
|
-
}
|
|
23214
23040
|
function stringifyKey(key, jsKey, ctx) {
|
|
23215
23041
|
if (jsKey === null)
|
|
23216
23042
|
return '';
|
|
23217
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
23218
23043
|
if (typeof jsKey !== 'object')
|
|
23219
23044
|
return String(jsKey);
|
|
23220
23045
|
if (isNode(key) && ctx?.doc) {
|
|
@@ -23847,7 +23672,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23847
23672
|
identify: value => typeof value === 'boolean',
|
|
23848
23673
|
default: true,
|
|
23849
23674
|
tag: 'tag:yaml.org,2002:bool',
|
|
23850
|
-
test: /^true
|
|
23675
|
+
test: /^true|false$/,
|
|
23851
23676
|
resolve: str => str === 'true',
|
|
23852
23677
|
stringify: stringifyJSON
|
|
23853
23678
|
},
|
|
@@ -23892,7 +23717,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23892
23717
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
23893
23718
|
*/
|
|
23894
23719
|
resolve(src, onError) {
|
|
23895
|
-
if (typeof
|
|
23720
|
+
if (typeof Buffer === 'function') {
|
|
23721
|
+
return Buffer.from(src, 'base64');
|
|
23722
|
+
}
|
|
23723
|
+
else if (typeof atob === 'function') {
|
|
23896
23724
|
// On IE 11, atob() can't handle newlines
|
|
23897
23725
|
const str = atob(src.replace(/[\n\r]/g, ''));
|
|
23898
23726
|
const buffer = new Uint8Array(str.length);
|
|
@@ -23906,11 +23734,15 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23906
23734
|
}
|
|
23907
23735
|
},
|
|
23908
23736
|
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
23909
|
-
if (!value)
|
|
23910
|
-
return '';
|
|
23911
23737
|
const buf = value; // checked earlier by binary.identify()
|
|
23912
23738
|
let str;
|
|
23913
|
-
if (typeof
|
|
23739
|
+
if (typeof Buffer === 'function') {
|
|
23740
|
+
str =
|
|
23741
|
+
buf instanceof Buffer
|
|
23742
|
+
? buf.toString('base64')
|
|
23743
|
+
: Buffer.from(buf.buffer).toString('base64');
|
|
23744
|
+
}
|
|
23745
|
+
else if (typeof btoa === 'function') {
|
|
23914
23746
|
let s = '';
|
|
23915
23747
|
for (let i = 0; i < buf.length; ++i)
|
|
23916
23748
|
s += String.fromCharCode(buf[i]);
|
|
@@ -23919,7 +23751,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23919
23751
|
else {
|
|
23920
23752
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
23921
23753
|
}
|
|
23922
|
-
|
|
23754
|
+
if (!type)
|
|
23755
|
+
type = Scalar.BLOCK_LITERAL;
|
|
23923
23756
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
23924
23757
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
23925
23758
|
const n = Math.ceil(str.length / lineWidth);
|
|
@@ -24388,7 +24221,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24388
24221
|
}
|
|
24389
24222
|
return new Date(date);
|
|
24390
24223
|
},
|
|
24391
|
-
stringify: ({ value }) => value
|
|
24224
|
+
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
|
|
24392
24225
|
};
|
|
24393
24226
|
|
|
24394
24227
|
const schema = [
|
|
@@ -24406,7 +24239,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24406
24239
|
floatExp,
|
|
24407
24240
|
float,
|
|
24408
24241
|
binary,
|
|
24409
|
-
merge,
|
|
24410
24242
|
omap,
|
|
24411
24243
|
pairs,
|
|
24412
24244
|
set,
|
|
@@ -24434,7 +24266,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24434
24266
|
intOct: intOct$1,
|
|
24435
24267
|
intTime,
|
|
24436
24268
|
map,
|
|
24437
|
-
merge,
|
|
24438
24269
|
null: nullTag,
|
|
24439
24270
|
omap,
|
|
24440
24271
|
pairs,
|
|
@@ -24444,20 +24275,13 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24444
24275
|
};
|
|
24445
24276
|
const coreKnownTags = {
|
|
24446
24277
|
'tag:yaml.org,2002:binary': binary,
|
|
24447
|
-
'tag:yaml.org,2002:merge': merge,
|
|
24448
24278
|
'tag:yaml.org,2002:omap': omap,
|
|
24449
24279
|
'tag:yaml.org,2002:pairs': pairs,
|
|
24450
24280
|
'tag:yaml.org,2002:set': set,
|
|
24451
24281
|
'tag:yaml.org,2002:timestamp': timestamp
|
|
24452
24282
|
};
|
|
24453
|
-
function getTags(customTags, schemaName
|
|
24454
|
-
|
|
24455
|
-
if (schemaTags && !customTags) {
|
|
24456
|
-
return addMergeTag && !schemaTags.includes(merge)
|
|
24457
|
-
? schemaTags.concat(merge)
|
|
24458
|
-
: schemaTags.slice();
|
|
24459
|
-
}
|
|
24460
|
-
let tags = schemaTags;
|
|
24283
|
+
function getTags(customTags, schemaName) {
|
|
24284
|
+
let tags = schemas.get(schemaName);
|
|
24461
24285
|
if (!tags) {
|
|
24462
24286
|
if (Array.isArray(customTags))
|
|
24463
24287
|
tags = [];
|
|
@@ -24476,21 +24300,17 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24476
24300
|
else if (typeof customTags === 'function') {
|
|
24477
24301
|
tags = customTags(tags.slice());
|
|
24478
24302
|
}
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
const tagObj =
|
|
24483
|
-
if (
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
if (!tags.includes(tagObj))
|
|
24491
|
-
tags.push(tagObj);
|
|
24492
|
-
return tags;
|
|
24493
|
-
}, []);
|
|
24303
|
+
return tags.map(tag => {
|
|
24304
|
+
if (typeof tag !== 'string')
|
|
24305
|
+
return tag;
|
|
24306
|
+
const tagObj = tagsByName[tag];
|
|
24307
|
+
if (tagObj)
|
|
24308
|
+
return tagObj;
|
|
24309
|
+
const keys = Object.keys(tagsByName)
|
|
24310
|
+
.map(key => JSON.stringify(key))
|
|
24311
|
+
.join(', ');
|
|
24312
|
+
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
|
24313
|
+
});
|
|
24494
24314
|
}
|
|
24495
24315
|
|
|
24496
24316
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
@@ -24501,9 +24321,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24501
24321
|
: compat
|
|
24502
24322
|
? getTags(null, compat)
|
|
24503
24323
|
: null;
|
|
24324
|
+
this.merge = !!merge;
|
|
24504
24325
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
24505
24326
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
24506
|
-
this.tags = getTags(customTags, this.name
|
|
24327
|
+
this.tags = getTags(customTags, this.name);
|
|
24507
24328
|
this.toStringOptions = toStringDefaults ?? null;
|
|
24508
24329
|
Object.defineProperty(this, MAP, { value: map });
|
|
24509
24330
|
Object.defineProperty(this, SCALAR$1, { value: string });
|
|
@@ -24628,7 +24449,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24628
24449
|
logLevel: 'warn',
|
|
24629
24450
|
prettyErrors: true,
|
|
24630
24451
|
strict: true,
|
|
24631
|
-
stringKeys: false,
|
|
24632
24452
|
uniqueKeys: true,
|
|
24633
24453
|
version: '1.2'
|
|
24634
24454
|
}, options);
|
|
@@ -24852,7 +24672,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24852
24672
|
this.directives.yaml.version = '1.1';
|
|
24853
24673
|
else
|
|
24854
24674
|
this.directives = new Directives({ version: '1.1' });
|
|
24855
|
-
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
24675
|
+
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
24856
24676
|
break;
|
|
24857
24677
|
case '1.2':
|
|
24858
24678
|
case 'next':
|
|
@@ -24860,7 +24680,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
24860
24680
|
this.directives.yaml.version = version;
|
|
24861
24681
|
else
|
|
24862
24682
|
this.directives = new Directives({ version });
|
|
24863
|
-
opt = { resolveKnownTags: true, schema: 'core' };
|
|
24683
|
+
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
|
24864
24684
|
break;
|
|
24865
24685
|
case null:
|
|
24866
24686
|
if (this.directives)
|
|
@@ -25038,7 +24858,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25038
24858
|
if (atNewline) {
|
|
25039
24859
|
if (comment)
|
|
25040
24860
|
comment += token.source;
|
|
25041
|
-
else
|
|
24861
|
+
else
|
|
25042
24862
|
spaceBefore = true;
|
|
25043
24863
|
}
|
|
25044
24864
|
else
|
|
@@ -25055,7 +24875,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25055
24875
|
if (token.source.endsWith(':'))
|
|
25056
24876
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
25057
24877
|
anchor = token;
|
|
25058
|
-
|
|
24878
|
+
if (start === null)
|
|
24879
|
+
start = token.offset;
|
|
25059
24880
|
atNewline = false;
|
|
25060
24881
|
hasSpace = false;
|
|
25061
24882
|
reqSpace = true;
|
|
@@ -25064,7 +24885,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25064
24885
|
if (tag)
|
|
25065
24886
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
25066
24887
|
tag = token;
|
|
25067
|
-
|
|
24888
|
+
if (start === null)
|
|
24889
|
+
start = token.offset;
|
|
25068
24890
|
atNewline = false;
|
|
25069
24891
|
hasSpace = false;
|
|
25070
24892
|
reqSpace = true;
|
|
@@ -25177,7 +24999,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25177
24999
|
return false;
|
|
25178
25000
|
const isEqual = typeof uniqueKeys === 'function'
|
|
25179
25001
|
? uniqueKeys
|
|
25180
|
-
: (a, b) => a === b ||
|
|
25002
|
+
: (a, b) => a === b ||
|
|
25003
|
+
(isScalar$1(a) &&
|
|
25004
|
+
isScalar$1(b) &&
|
|
25005
|
+
a.value === b.value &&
|
|
25006
|
+
!(a.value === '<<' && ctx.schema.merge));
|
|
25181
25007
|
return items.some(pair => isEqual(pair.key, search));
|
|
25182
25008
|
}
|
|
25183
25009
|
|
|
@@ -25226,14 +25052,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25226
25052
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
25227
25053
|
}
|
|
25228
25054
|
// key value
|
|
25229
|
-
ctx.atKey = true;
|
|
25230
25055
|
const keyStart = keyProps.end;
|
|
25231
25056
|
const keyNode = key
|
|
25232
25057
|
? composeNode(ctx, key, keyProps, onError)
|
|
25233
25058
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
25234
25059
|
if (ctx.schema.compat)
|
|
25235
25060
|
flowIndentCheck(bm.indent, key, onError);
|
|
25236
|
-
ctx.atKey = false;
|
|
25237
25061
|
if (mapIncludes(ctx, map.items, keyNode))
|
|
25238
25062
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
25239
25063
|
// value properties
|
|
@@ -25293,8 +25117,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25293
25117
|
const seq = new NodeClass(ctx.schema);
|
|
25294
25118
|
if (ctx.atRoot)
|
|
25295
25119
|
ctx.atRoot = false;
|
|
25296
|
-
if (ctx.atKey)
|
|
25297
|
-
ctx.atKey = false;
|
|
25298
25120
|
let offset = bs.offset;
|
|
25299
25121
|
let commentEnd = null;
|
|
25300
25122
|
for (const { start, value } of bs.items) {
|
|
@@ -25379,8 +25201,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25379
25201
|
const atRoot = ctx.atRoot;
|
|
25380
25202
|
if (atRoot)
|
|
25381
25203
|
ctx.atRoot = false;
|
|
25382
|
-
if (ctx.atKey)
|
|
25383
|
-
ctx.atKey = false;
|
|
25384
25204
|
let offset = fc.offset + fc.start.source.length;
|
|
25385
25205
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
25386
25206
|
const collItem = fc.items[i];
|
|
@@ -25460,14 +25280,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25460
25280
|
else {
|
|
25461
25281
|
// item is a key+value pair
|
|
25462
25282
|
// key value
|
|
25463
|
-
ctx.atKey = true;
|
|
25464
25283
|
const keyStart = props.end;
|
|
25465
25284
|
const keyNode = key
|
|
25466
25285
|
? composeNode(ctx, key, props, onError)
|
|
25467
25286
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
25468
25287
|
if (isBlock(key))
|
|
25469
25288
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
25470
|
-
ctx.atKey = false;
|
|
25471
25289
|
// value properties
|
|
25472
25290
|
const valueProps = resolveProps(sep ?? [], {
|
|
25473
25291
|
flow: fcName,
|
|
@@ -25623,8 +25441,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
25623
25441
|
tag = kt;
|
|
25624
25442
|
}
|
|
25625
25443
|
else {
|
|
25626
|
-
if (kt) {
|
|
25627
|
-
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection
|
|
25444
|
+
if (kt?.collection) {
|
|
25445
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
25628
25446
|
}
|
|
25629
25447
|
else {
|
|
25630
25448
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
@@ -26065,16 +25883,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26065
25883
|
const tagName = tagToken
|
|
26066
25884
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
26067
25885
|
: null;
|
|
26068
|
-
|
|
26069
|
-
|
|
26070
|
-
|
|
26071
|
-
|
|
26072
|
-
|
|
26073
|
-
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
26074
|
-
else if (token.type === 'scalar')
|
|
26075
|
-
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
26076
|
-
else
|
|
26077
|
-
tag = ctx.schema[SCALAR$1];
|
|
25886
|
+
const tag = tagToken && tagName
|
|
25887
|
+
? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
|
|
25888
|
+
: token.type === 'scalar'
|
|
25889
|
+
? findScalarTagByTest(ctx, value, token, onError)
|
|
25890
|
+
: ctx.schema[SCALAR$1];
|
|
26078
25891
|
let scalar;
|
|
26079
25892
|
try {
|
|
26080
25893
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
@@ -26122,9 +25935,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26122
25935
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
26123
25936
|
return schema[SCALAR$1];
|
|
26124
25937
|
}
|
|
26125
|
-
function findScalarTagByTest({
|
|
26126
|
-
const tag = schema.tags.find(tag =>
|
|
26127
|
-
tag.test?.test(value)) || schema[SCALAR$1];
|
|
25938
|
+
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
25939
|
+
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
|
|
26128
25940
|
if (schema.compat) {
|
|
26129
25941
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
26130
25942
|
schema[SCALAR$1];
|
|
@@ -26140,7 +25952,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26140
25952
|
|
|
26141
25953
|
function emptyScalarPosition(offset, before, pos) {
|
|
26142
25954
|
if (before) {
|
|
26143
|
-
|
|
25955
|
+
if (pos === null)
|
|
25956
|
+
pos = before.length;
|
|
26144
25957
|
for (let i = pos - 1; i >= 0; --i) {
|
|
26145
25958
|
let st = before[i];
|
|
26146
25959
|
switch (st.type) {
|
|
@@ -26165,7 +25978,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26165
25978
|
|
|
26166
25979
|
const CN = { composeNode, composeEmptyNode };
|
|
26167
25980
|
function composeNode(ctx, token, props, onError) {
|
|
26168
|
-
const atKey = ctx.atKey;
|
|
26169
25981
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
26170
25982
|
let node;
|
|
26171
25983
|
let isSrcToken = true;
|
|
@@ -26201,14 +26013,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26201
26013
|
}
|
|
26202
26014
|
if (anchor && node.anchor === '')
|
|
26203
26015
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
|
26204
|
-
if (atKey &&
|
|
26205
|
-
ctx.options.stringKeys &&
|
|
26206
|
-
(!isScalar$1(node) ||
|
|
26207
|
-
typeof node.value !== 'string' ||
|
|
26208
|
-
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
26209
|
-
const msg = 'With stringKeys, all keys must be strings';
|
|
26210
|
-
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
26211
|
-
}
|
|
26212
26016
|
if (spaceBefore)
|
|
26213
26017
|
node.spaceBefore = true;
|
|
26214
26018
|
if (comment) {
|
|
@@ -26261,7 +26065,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26261
26065
|
const opts = Object.assign({ _directives: directives }, options);
|
|
26262
26066
|
const doc = new Document(undefined, opts);
|
|
26263
26067
|
const ctx = {
|
|
26264
|
-
atKey: false,
|
|
26265
26068
|
atRoot: true,
|
|
26266
26069
|
directives: doc.directives,
|
|
26267
26070
|
options: doc.options,
|
|
@@ -28396,20 +28199,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
28396
28199
|
default: {
|
|
28397
28200
|
const bv = this.startBlockValue(map);
|
|
28398
28201
|
if (bv) {
|
|
28399
|
-
if (bv.type
|
|
28400
|
-
if (!it.explicitKey &&
|
|
28401
|
-
it.sep &&
|
|
28402
|
-
!includesToken(it.sep, 'newline')) {
|
|
28403
|
-
yield* this.pop({
|
|
28404
|
-
type: 'error',
|
|
28405
|
-
offset: this.offset,
|
|
28406
|
-
message: 'Unexpected block-seq-ind on same line with key',
|
|
28407
|
-
source: this.source
|
|
28408
|
-
});
|
|
28409
|
-
return;
|
|
28410
|
-
}
|
|
28411
|
-
}
|
|
28412
|
-
else if (atMapIndent) {
|
|
28202
|
+
if (atMapIndent && bv.type !== 'block-seq') {
|
|
28413
28203
|
map.items.push({ start });
|
|
28414
28204
|
}
|
|
28415
28205
|
this.stack.push(bv);
|
|
@@ -28780,8 +28570,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
28780
28570
|
if (!keepUndefined)
|
|
28781
28571
|
return undefined;
|
|
28782
28572
|
}
|
|
28783
|
-
if (isDocument(value) && !_replacer)
|
|
28784
|
-
return value.toString(options);
|
|
28785
28573
|
return new Document(value, _replacer, options).toString(options);
|
|
28786
28574
|
}
|
|
28787
28575
|
|