@thoughtspot/visual-embed-sdk 1.49.2 → 1.50.0
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 -10
- package/cjs/src/authToken.spec.js +5 -0
- package/cjs/src/authToken.spec.js.map +1 -1
- package/cjs/src/embed/app.d.ts +7 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +6 -0
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +11 -2
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +12 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +30 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.spec.d.ts +2 -0
- package/cjs/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/cjs/src/embed/embedConfig.spec.js +74 -0
- package/cjs/src/embed/embedConfig.spec.js.map +1 -0
- package/cjs/src/embed/host-events.spec.d.ts +2 -0
- package/cjs/src/embed/host-events.spec.d.ts.map +1 -0
- package/cjs/src/embed/host-events.spec.js +1219 -0
- package/cjs/src/embed/host-events.spec.js.map +1 -0
- package/cjs/src/embed/liveboard.d.ts +6 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.d.ts +29 -0
- package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +14 -0
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/types.d.ts +93 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +88 -3
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.spec.js +26 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +15 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +30 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/reporting.spec.js +21 -0
- package/cjs/src/utils/reporting.spec.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/cjs/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/cjs/src/utils/sessionInfoService.spec.js +130 -0
- package/cjs/src/utils/sessionInfoService.spec.js.map +1 -0
- package/cjs/src/utils.js +2 -3
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +158 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-CS7yJ2Jj.js → index-B5xoN6Cp.js} +303 -187
- package/dist/src/embed/app.d.ts +7 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +12 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.spec.d.ts +2 -0
- package/dist/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/dist/src/embed/host-events.spec.d.ts +2 -0
- package/dist/src/embed/host-events.spec.d.ts.map +1 -0
- package/dist/src/embed/liveboard.d.ts +6 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/spotter-viz-utils.d.ts +29 -0
- package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +93 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/dist/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/dist/tsembed-react.es.js +126 -18
- package/dist/tsembed-react.js +427 -203
- package/dist/tsembed.es.js +126 -18
- package/dist/tsembed.js +427 -203
- package/dist/visual-embed-sdk-react-full.d.ts +147 -7
- package/dist/visual-embed-sdk-react.d.ts +147 -7
- package/dist/visual-embed-sdk.d.ts +147 -7
- package/lib/package.json +4 -10
- package/lib/src/authToken.spec.js +5 -0
- package/lib/src/authToken.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +7 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +6 -0
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +11 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +12 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +30 -0
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.spec.d.ts +2 -0
- package/lib/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/lib/src/embed/embedConfig.spec.js +72 -0
- package/lib/src/embed/embedConfig.spec.js.map +1 -0
- package/lib/src/embed/host-events.spec.d.ts +2 -0
- package/lib/src/embed/host-events.spec.d.ts.map +1 -0
- package/lib/src/embed/host-events.spec.js +1216 -0
- package/lib/src/embed/host-events.spec.js.map +1 -0
- package/lib/src/embed/liveboard.d.ts +6 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/spotter-viz-utils.d.ts +29 -0
- package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/lib/src/embed/spotter-viz-utils.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +14 -0
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/types.d.ts +93 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +88 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.spec.js +26 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +15 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/processData.spec.js +30 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/reporting.spec.js +21 -0
- package/lib/src/utils/reporting.spec.js.map +1 -1
- package/lib/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/lib/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/lib/src/utils/sessionInfoService.spec.js +127 -0
- package/lib/src/utils/sessionInfoService.spec.js.map +1 -0
- package/lib/src/utils.js +1 -1
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +159 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +147 -7
- package/package.json +4 -10
- package/src/authToken.spec.ts +6 -0
- package/src/embed/app.spec.ts +15 -2
- package/src/embed/app.ts +13 -1
- package/src/embed/conversation.spec.ts +32 -0
- package/src/embed/conversation.ts +12 -0
- package/src/embed/embedConfig.spec.ts +79 -0
- package/src/embed/host-events.spec.ts +1635 -0
- package/src/embed/liveboard.ts +6 -0
- package/src/embed/spotter-viz-utils.ts +30 -0
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +15 -0
- package/src/types.ts +96 -6
- package/src/utils/custom-actions.spec.ts +28 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +18 -0
- package/src/utils/processData.spec.ts +32 -0
- package/src/utils/reporting.spec.ts +27 -0
- package/src/utils/sessionInfoService.spec.ts +151 -0
- package/src/utils.spec.ts +195 -0
- package/src/utils.ts +1 -1
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.50.0 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -1829,10 +1829,11 @@
|
|
|
1829
1829
|
*/
|
|
1830
1830
|
EmbedEvent["EmbedPageContextChanged"] = "EmbedPageContextChanged";
|
|
1831
1831
|
/**
|
|
1832
|
-
* Represents a special embed event that is triggered whenever any host event is
|
|
1832
|
+
* Represents a special embed event that is triggered whenever any host event is
|
|
1833
|
+
* subscribed.
|
|
1833
1834
|
*
|
|
1834
|
-
* You can listen to this event when you need to dispatch a host event during load or
|
|
1835
|
-
* particularly in situations where timing issues may occur.
|
|
1835
|
+
* You can listen to this event when you need to dispatch a host event during load or
|
|
1836
|
+
* render, particularly in situations where timing issues may occur.
|
|
1836
1837
|
*
|
|
1837
1838
|
* @example
|
|
1838
1839
|
* ```js
|
|
@@ -4072,6 +4073,24 @@
|
|
|
4072
4073
|
* ```
|
|
4073
4074
|
*/
|
|
4074
4075
|
HostEvent["InitSpotterVizConversation"] = "InitSpotterVizConversation";
|
|
4076
|
+
/**
|
|
4077
|
+
* Opens the SpotterViz panel.
|
|
4078
|
+
* @version SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl
|
|
4079
|
+
* @example
|
|
4080
|
+
* ```js
|
|
4081
|
+
* liveboardEmbed.trigger(HostEvent.OpenSpotterVizPanel);
|
|
4082
|
+
* ```
|
|
4083
|
+
*/
|
|
4084
|
+
HostEvent["OpenSpotterVizPanel"] = "OpenSpotterVizPanel";
|
|
4085
|
+
/**
|
|
4086
|
+
* Closes the SpotterViz panel.
|
|
4087
|
+
* @version SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl
|
|
4088
|
+
* @example
|
|
4089
|
+
* ```js
|
|
4090
|
+
* liveboardEmbed.trigger(HostEvent.CloseSpotterVizPanel);
|
|
4091
|
+
* ```
|
|
4092
|
+
*/
|
|
4093
|
+
HostEvent["CloseSpotterVizPanel"] = "CloseSpotterVizPanel";
|
|
4075
4094
|
/**
|
|
4076
4095
|
* Clears browser cache and fetches new data for liveboard ChartViz Containers.
|
|
4077
4096
|
* Requires `enableLiveboardDataCache` to be enabled.
|
|
@@ -5996,6 +6015,72 @@
|
|
|
5996
6015
|
* @version SDK: 1.49.0 | ThoughtSpot Cloud: 26.6.0.cl
|
|
5997
6016
|
*/
|
|
5998
6017
|
Action["RefreshLiveboardBrowserCache"] = "refreshLiveboardBrowserCache";
|
|
6018
|
+
/**
|
|
6019
|
+
* Controls visibility and disable state of the share action
|
|
6020
|
+
* in the Spotter Analyst interface.
|
|
6021
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6022
|
+
* @example
|
|
6023
|
+
* ```js
|
|
6024
|
+
* hiddenActions: [Action.SpotterAnalystShare]
|
|
6025
|
+
* disabledActions: [Action.SpotterAnalystShare]
|
|
6026
|
+
* ```
|
|
6027
|
+
*/
|
|
6028
|
+
Action["SpotterAnalystShare"] = "spotterAnalystShare";
|
|
6029
|
+
/**
|
|
6030
|
+
* Controls visibility and disable state of the edit action
|
|
6031
|
+
* in the Spotter Analyst interface.
|
|
6032
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6033
|
+
* @example
|
|
6034
|
+
* ```js
|
|
6035
|
+
* hiddenActions: [Action.SpotterAnalystEdit]
|
|
6036
|
+
* disabledActions: [Action.SpotterAnalystEdit]
|
|
6037
|
+
* ```
|
|
6038
|
+
*/
|
|
6039
|
+
Action["SpotterAnalystEdit"] = "spotterAnalystEdit";
|
|
6040
|
+
/**
|
|
6041
|
+
* Controls visibility and disable state of the create action
|
|
6042
|
+
* in the Spotter Analyst interface.
|
|
6043
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6044
|
+
* @example
|
|
6045
|
+
* ```js
|
|
6046
|
+
* hiddenActions: [Action.SpotterAnalystCreate]
|
|
6047
|
+
* disabledActions: [Action.SpotterAnalystCreate]
|
|
6048
|
+
* ```
|
|
6049
|
+
*/
|
|
6050
|
+
Action["SpotterAnalystCreate"] = "spotterAnalystCreate";
|
|
6051
|
+
/**
|
|
6052
|
+
* Controls visibility and disable state of the delete action
|
|
6053
|
+
* in the Spotter Analyst interface.
|
|
6054
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6055
|
+
* @example
|
|
6056
|
+
* ```js
|
|
6057
|
+
* hiddenActions: [Action.SpotterAnalystDelete]
|
|
6058
|
+
* disabledActions: [Action.SpotterAnalystDelete]
|
|
6059
|
+
* ```
|
|
6060
|
+
*/
|
|
6061
|
+
Action["SpotterAnalystDelete"] = "spotterAnalystDelete";
|
|
6062
|
+
/**
|
|
6063
|
+
* Controls visibility and disable state of the make a copy action
|
|
6064
|
+
* in the Spotter Analyst interface.
|
|
6065
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6066
|
+
* @example
|
|
6067
|
+
* ```js
|
|
6068
|
+
* hiddenActions: [Action.SpotterAnalystMakeACopy]
|
|
6069
|
+
* disabledActions: [Action.SpotterAnalystMakeACopy]
|
|
6070
|
+
* ```
|
|
6071
|
+
*/
|
|
6072
|
+
Action["SpotterAnalystMakeACopy"] = "spotterAnalystMakeACopy";
|
|
6073
|
+
/**
|
|
6074
|
+
* Controls visibility and disable state of the sidebar
|
|
6075
|
+
* in the Spotter Analyst interface.
|
|
6076
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6077
|
+
* @example
|
|
6078
|
+
* ```js
|
|
6079
|
+
* hiddenActions: [Action.SpotterAnalystSidebar]
|
|
6080
|
+
* disabledActions: [Action.SpotterAnalystSidebar]
|
|
6081
|
+
* ```
|
|
6082
|
+
*/
|
|
6083
|
+
Action["SpotterAnalystSidebar"] = "spotterAnalystSidebar";
|
|
5999
6084
|
})(exports.Action || (exports.Action = {}));
|
|
6000
6085
|
exports.PrefetchFeatures = void 0;
|
|
6001
6086
|
(function (PrefetchFeatures) {
|
|
@@ -6461,7 +6546,7 @@
|
|
|
6461
6546
|
TableContentDensity["Compact"] = "COMPACT";
|
|
6462
6547
|
})(exports.TableContentDensity || (exports.TableContentDensity = {}));
|
|
6463
6548
|
|
|
6464
|
-
var version$1="1.
|
|
6549
|
+
var version$1="1.50.0";var pkg = {version:version$1};
|
|
6465
6550
|
|
|
6466
6551
|
const { version } = pkg;
|
|
6467
6552
|
|
|
@@ -6546,28 +6631,45 @@
|
|
|
6546
6631
|
}
|
|
6547
6632
|
return false;
|
|
6548
6633
|
};
|
|
6549
|
-
const
|
|
6634
|
+
const UNSAFE_KEYS = new Set([
|
|
6635
|
+
"__proto__",
|
|
6636
|
+
"constructor",
|
|
6637
|
+
"prototype",
|
|
6638
|
+
"toString",
|
|
6639
|
+
"valueOf",
|
|
6640
|
+
"hasOwnProperty",
|
|
6641
|
+
"isPrototypeOf",
|
|
6642
|
+
"propertyIsEnumerable",
|
|
6643
|
+
"toLocaleString",
|
|
6644
|
+
]);
|
|
6645
|
+
const merge$1 = (...objects) => objects.reduce((result, current) => {
|
|
6646
|
+
if (current === undefined) {
|
|
6647
|
+
return result;
|
|
6648
|
+
}
|
|
6550
6649
|
if (Array.isArray(current)) {
|
|
6551
6650
|
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
6552
6651
|
}
|
|
6553
6652
|
Object.keys(current).forEach((key) => {
|
|
6554
|
-
if (
|
|
6653
|
+
if (UNSAFE_KEYS.has(key)) {
|
|
6555
6654
|
return;
|
|
6556
6655
|
}
|
|
6557
6656
|
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
6558
|
-
result[key] = merge.options.mergeArrays
|
|
6559
|
-
? merge.options.uniqueArrayItems
|
|
6657
|
+
result[key] = merge$1.options.mergeArrays
|
|
6658
|
+
? merge$1.options.uniqueArrayItems
|
|
6560
6659
|
? Array.from(new Set(result[key].concat(current[key])))
|
|
6561
6660
|
: [...result[key], ...current[key]]
|
|
6562
6661
|
: current[key];
|
|
6563
6662
|
}
|
|
6564
6663
|
else if (isObject$1(result[key]) && isObject$1(current[key])) {
|
|
6565
|
-
result[key] = merge(result[key], current[key]);
|
|
6664
|
+
result[key] = merge$1(result[key], current[key]);
|
|
6665
|
+
}
|
|
6666
|
+
else if (!isObject$1(result[key]) && isObject$1(current[key])) {
|
|
6667
|
+
result[key] = merge$1(current[key], undefined);
|
|
6566
6668
|
}
|
|
6567
6669
|
else {
|
|
6568
6670
|
result[key] =
|
|
6569
6671
|
current[key] === undefined
|
|
6570
|
-
? merge.options.allowUndefinedOverrides
|
|
6672
|
+
? merge$1.options.allowUndefinedOverrides
|
|
6571
6673
|
? current[key]
|
|
6572
6674
|
: result[key]
|
|
6573
6675
|
: current[key];
|
|
@@ -6580,11 +6682,11 @@
|
|
|
6580
6682
|
mergeArrays: true,
|
|
6581
6683
|
uniqueArrayItems: true,
|
|
6582
6684
|
};
|
|
6583
|
-
merge.options = defaultOptions;
|
|
6584
|
-
merge.withOptions = (options, ...objects) => {
|
|
6585
|
-
merge.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
6586
|
-
const result = merge(...objects);
|
|
6587
|
-
merge.options = defaultOptions;
|
|
6685
|
+
merge$1.options = defaultOptions;
|
|
6686
|
+
merge$1.withOptions = (options, ...objects) => {
|
|
6687
|
+
merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
6688
|
+
const result = merge$1(...objects);
|
|
6689
|
+
merge$1.options = defaultOptions;
|
|
6588
6690
|
return result;
|
|
6589
6691
|
};
|
|
6590
6692
|
|
|
@@ -6881,7 +6983,7 @@
|
|
|
6881
6983
|
}
|
|
6882
6984
|
return null;
|
|
6883
6985
|
}
|
|
6884
|
-
const deepMerge = (target, source) => merge(target, source);
|
|
6986
|
+
const deepMerge = (target, source) => merge$1(target, source);
|
|
6885
6987
|
const getOperationNameFromQuery = (query) => {
|
|
6886
6988
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
6887
6989
|
const matches = query.match(regex);
|
|
@@ -22662,6 +22764,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
22662
22764
|
}
|
|
22663
22765
|
if (discoveryExperience.homePage === exports.HomePage.Focused) {
|
|
22664
22766
|
params[Param.HomepageVersion] = exports.HomePage.Focused;
|
|
22767
|
+
// The Focused (V4) homepage experience requires the updated
|
|
22768
|
+
// Spotter chat prompt. Enable it automatically unless the
|
|
22769
|
+
// developer has explicitly set updatedSpotterChatPrompt.
|
|
22770
|
+
if (isUndefined(updatedSpotterChatPrompt)) {
|
|
22771
|
+
params[Param.UpdatedSpotterChatPrompt] = true;
|
|
22772
|
+
}
|
|
22665
22773
|
}
|
|
22666
22774
|
}
|
|
22667
22775
|
const queryParams = getQueryParamString(params, true);
|
|
@@ -25422,8 +25530,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25422
25530
|
return {
|
|
25423
25531
|
onAnchor: (source) => {
|
|
25424
25532
|
aliasObjects.push(source);
|
|
25425
|
-
|
|
25426
|
-
prevAnchors = anchorNames(doc);
|
|
25533
|
+
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
25427
25534
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
25428
25535
|
prevAnchors.add(anchor);
|
|
25429
25536
|
return anchor;
|
|
@@ -25587,23 +25694,38 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25587
25694
|
* Resolve the value of this alias within `doc`, finding the last
|
|
25588
25695
|
* instance of the `source` anchor before this node.
|
|
25589
25696
|
*/
|
|
25590
|
-
resolve(doc) {
|
|
25697
|
+
resolve(doc, ctx) {
|
|
25698
|
+
if (ctx?.maxAliasCount === 0)
|
|
25699
|
+
throw new ReferenceError('Alias resolution is disabled');
|
|
25700
|
+
let nodes;
|
|
25701
|
+
if (ctx?.aliasResolveCache) {
|
|
25702
|
+
nodes = ctx.aliasResolveCache;
|
|
25703
|
+
}
|
|
25704
|
+
else {
|
|
25705
|
+
nodes = [];
|
|
25706
|
+
visit$1(doc, {
|
|
25707
|
+
Node: (_key, node) => {
|
|
25708
|
+
if (isAlias(node) || hasAnchor(node))
|
|
25709
|
+
nodes.push(node);
|
|
25710
|
+
}
|
|
25711
|
+
});
|
|
25712
|
+
if (ctx)
|
|
25713
|
+
ctx.aliasResolveCache = nodes;
|
|
25714
|
+
}
|
|
25591
25715
|
let found = undefined;
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
}
|
|
25599
|
-
});
|
|
25716
|
+
for (const node of nodes) {
|
|
25717
|
+
if (node === this)
|
|
25718
|
+
break;
|
|
25719
|
+
if (node.anchor === this.source)
|
|
25720
|
+
found = node;
|
|
25721
|
+
}
|
|
25600
25722
|
return found;
|
|
25601
25723
|
}
|
|
25602
25724
|
toJSON(_arg, ctx) {
|
|
25603
25725
|
if (!ctx)
|
|
25604
25726
|
return { source: this.source };
|
|
25605
25727
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
25606
|
-
const source = this.resolve(doc);
|
|
25728
|
+
const source = this.resolve(doc, ctx);
|
|
25607
25729
|
if (!source) {
|
|
25608
25730
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
25609
25731
|
throw new ReferenceError(msg);
|
|
@@ -25615,7 +25737,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25615
25737
|
data = anchors.get(source);
|
|
25616
25738
|
}
|
|
25617
25739
|
/* istanbul ignore if */
|
|
25618
|
-
if (
|
|
25740
|
+
if (data?.res === undefined) {
|
|
25619
25741
|
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
25620
25742
|
throw new ReferenceError(msg);
|
|
25621
25743
|
}
|
|
@@ -25722,8 +25844,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25722
25844
|
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
25723
25845
|
ref = sourceObjects.get(value);
|
|
25724
25846
|
if (ref) {
|
|
25725
|
-
|
|
25726
|
-
ref.anchor = onAnchor(value);
|
|
25847
|
+
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
25727
25848
|
return new Alias(ref.anchor);
|
|
25728
25849
|
}
|
|
25729
25850
|
else {
|
|
@@ -26234,7 +26355,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26234
26355
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
26235
26356
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
26236
26357
|
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
26237
|
-
if (!blockQuote || /\n[\t ]+$/.test(value)
|
|
26358
|
+
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
26238
26359
|
return quotedString(value, ctx);
|
|
26239
26360
|
}
|
|
26240
26361
|
const indent = ctx.indent ||
|
|
@@ -26294,23 +26415,32 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26294
26415
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
26295
26416
|
}
|
|
26296
26417
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
26297
|
-
|
|
26418
|
+
// Leading | or > is added later
|
|
26419
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
26298
26420
|
if (comment) {
|
|
26299
26421
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
26300
26422
|
if (onComment)
|
|
26301
26423
|
onComment();
|
|
26302
26424
|
}
|
|
26303
|
-
if (literal) {
|
|
26304
|
-
|
|
26305
|
-
|
|
26425
|
+
if (!literal) {
|
|
26426
|
+
const foldedValue = value
|
|
26427
|
+
.replace(/\n+/g, '\n$&')
|
|
26428
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
26429
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
26430
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
26431
|
+
let literalFallback = false;
|
|
26432
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
26433
|
+
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
26434
|
+
foldOptions.onOverflow = () => {
|
|
26435
|
+
literalFallback = true;
|
|
26436
|
+
};
|
|
26437
|
+
}
|
|
26438
|
+
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
26439
|
+
if (!literalFallback)
|
|
26440
|
+
return `>${header}\n${indent}${body}`;
|
|
26306
26441
|
}
|
|
26307
|
-
value = value
|
|
26308
|
-
|
|
26309
|
-
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
26310
|
-
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
26311
|
-
.replace(/\n+/g, `$&${indent}`);
|
|
26312
|
-
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
26313
|
-
return `${header}\n${indent}${body}`;
|
|
26442
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
26443
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
26314
26444
|
}
|
|
26315
26445
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
26316
26446
|
const { type, value } = item;
|
|
@@ -26319,10 +26449,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26319
26449
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
26320
26450
|
return quotedString(value, ctx);
|
|
26321
26451
|
}
|
|
26322
|
-
if (
|
|
26323
|
-
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
26452
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
26324
26453
|
// not allowed:
|
|
26325
|
-
// -
|
|
26454
|
+
// - '-' or '?'
|
|
26326
26455
|
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
26327
26456
|
// - '\n ', ': ' or ' \n' anywhere
|
|
26328
26457
|
// - '#' not preceded by a non-space char
|
|
@@ -26417,6 +26546,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26417
26546
|
nullStr: 'null',
|
|
26418
26547
|
simpleKeys: false,
|
|
26419
26548
|
singleQuote: null,
|
|
26549
|
+
trailingComma: false,
|
|
26420
26550
|
trueStr: 'true',
|
|
26421
26551
|
verifyAliasOrder: true
|
|
26422
26552
|
}, doc.schema.toStringOptions, options);
|
|
@@ -26451,7 +26581,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26451
26581
|
let obj;
|
|
26452
26582
|
if (isScalar$1(item)) {
|
|
26453
26583
|
obj = item.value;
|
|
26454
|
-
|
|
26584
|
+
let match = tags.filter(t => t.identify?.(obj));
|
|
26585
|
+
if (match.length > 1) {
|
|
26586
|
+
const testMatch = match.filter(t => t.test);
|
|
26587
|
+
if (testMatch.length > 0)
|
|
26588
|
+
match = testMatch;
|
|
26589
|
+
}
|
|
26455
26590
|
tagObj =
|
|
26456
26591
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
|
26457
26592
|
}
|
|
@@ -26460,7 +26595,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26460
26595
|
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
|
26461
26596
|
}
|
|
26462
26597
|
if (!tagObj) {
|
|
26463
|
-
const name = obj?.constructor?.name ?? typeof obj;
|
|
26598
|
+
const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
|
|
26464
26599
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
26465
26600
|
}
|
|
26466
26601
|
return tagObj;
|
|
@@ -26475,7 +26610,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26475
26610
|
anchors.add(anchor);
|
|
26476
26611
|
props.push(`&${anchor}`);
|
|
26477
26612
|
}
|
|
26478
|
-
const tag = node.tag
|
|
26613
|
+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
|
|
26479
26614
|
if (tag)
|
|
26480
26615
|
props.push(doc.directives.tagString(tag));
|
|
26481
26616
|
return props.join(' ');
|
|
@@ -26501,8 +26636,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26501
26636
|
const node = isNode(item)
|
|
26502
26637
|
? item
|
|
26503
26638
|
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
|
|
26504
|
-
|
|
26505
|
-
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
26639
|
+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
26506
26640
|
const props = stringifyProps(node, tagObj, ctx);
|
|
26507
26641
|
if (props.length > 0)
|
|
26508
26642
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
@@ -26616,7 +26750,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26616
26750
|
ws += `\n${indentComment(cs, ctx.indent)}`;
|
|
26617
26751
|
}
|
|
26618
26752
|
if (valueStr === '' && !ctx.inFlow) {
|
|
26619
|
-
if (ws === '\n')
|
|
26753
|
+
if (ws === '\n' && valueComment)
|
|
26620
26754
|
ws = '\n\n';
|
|
26621
26755
|
}
|
|
26622
26756
|
else {
|
|
@@ -26664,54 +26798,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26664
26798
|
|
|
26665
26799
|
function warn(logLevel, warning) {
|
|
26666
26800
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
26667
|
-
|
|
26668
|
-
process.emitWarning(warning);
|
|
26669
|
-
else
|
|
26670
|
-
console.warn(warning);
|
|
26801
|
+
console.warn(warning);
|
|
26671
26802
|
}
|
|
26672
26803
|
}
|
|
26673
26804
|
|
|
26674
|
-
const MERGE_KEY = '<<';
|
|
26675
|
-
function addPairToJSMap(ctx, map, { key, value }) {
|
|
26676
|
-
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
|
26677
|
-
value = isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
26678
|
-
if (isSeq(value))
|
|
26679
|
-
for (const it of value.items)
|
|
26680
|
-
mergeToJSMap(ctx, map, it);
|
|
26681
|
-
else if (Array.isArray(value))
|
|
26682
|
-
for (const it of value)
|
|
26683
|
-
mergeToJSMap(ctx, map, it);
|
|
26684
|
-
else
|
|
26685
|
-
mergeToJSMap(ctx, map, value);
|
|
26686
|
-
}
|
|
26687
|
-
else {
|
|
26688
|
-
const jsKey = toJS(key, '', ctx);
|
|
26689
|
-
if (map instanceof Map) {
|
|
26690
|
-
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
26691
|
-
}
|
|
26692
|
-
else if (map instanceof Set) {
|
|
26693
|
-
map.add(jsKey);
|
|
26694
|
-
}
|
|
26695
|
-
else {
|
|
26696
|
-
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
26697
|
-
const jsValue = toJS(value, stringKey, ctx);
|
|
26698
|
-
if (stringKey in map)
|
|
26699
|
-
Object.defineProperty(map, stringKey, {
|
|
26700
|
-
value: jsValue,
|
|
26701
|
-
writable: true,
|
|
26702
|
-
enumerable: true,
|
|
26703
|
-
configurable: true
|
|
26704
|
-
});
|
|
26705
|
-
else
|
|
26706
|
-
map[stringKey] = jsValue;
|
|
26707
|
-
}
|
|
26708
|
-
}
|
|
26709
|
-
return map;
|
|
26710
|
-
}
|
|
26711
|
-
const isMergeKey = (key) => key === MERGE_KEY ||
|
|
26712
|
-
(isScalar$1(key) &&
|
|
26713
|
-
key.value === MERGE_KEY &&
|
|
26714
|
-
(!key.type || key.type === Scalar.PLAIN));
|
|
26715
26805
|
// If the value associated with a merge key is a single mapping node, each of
|
|
26716
26806
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
26717
26807
|
// already exists in it. If the value associated with the merge key is a
|
|
@@ -26719,8 +26809,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26719
26809
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
26720
26810
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
26721
26811
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
26722
|
-
|
|
26723
|
-
|
|
26812
|
+
const MERGE_KEY = '<<';
|
|
26813
|
+
const merge = {
|
|
26814
|
+
identify: value => value === MERGE_KEY ||
|
|
26815
|
+
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
26816
|
+
default: 'key',
|
|
26817
|
+
tag: 'tag:yaml.org,2002:merge',
|
|
26818
|
+
test: /^<<$/,
|
|
26819
|
+
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
|
|
26820
|
+
addToJSMap: addMergeToJSMap
|
|
26821
|
+
}),
|
|
26822
|
+
stringify: () => MERGE_KEY
|
|
26823
|
+
};
|
|
26824
|
+
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
26825
|
+
(isScalar$1(key) &&
|
|
26826
|
+
(!key.type || key.type === Scalar.PLAIN) &&
|
|
26827
|
+
merge.identify(key.value))) &&
|
|
26828
|
+
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
26829
|
+
function addMergeToJSMap(ctx, map, value) {
|
|
26830
|
+
const source = resolveAliasValue(ctx, value);
|
|
26831
|
+
if (isSeq(source))
|
|
26832
|
+
for (const it of source.items)
|
|
26833
|
+
mergeValue(ctx, map, it);
|
|
26834
|
+
else if (Array.isArray(source))
|
|
26835
|
+
for (const it of source)
|
|
26836
|
+
mergeValue(ctx, map, it);
|
|
26837
|
+
else
|
|
26838
|
+
mergeValue(ctx, map, source);
|
|
26839
|
+
}
|
|
26840
|
+
function mergeValue(ctx, map, value) {
|
|
26841
|
+
const source = resolveAliasValue(ctx, value);
|
|
26724
26842
|
if (!isMap(source))
|
|
26725
26843
|
throw new Error('Merge sources must be maps or map aliases');
|
|
26726
26844
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -26743,9 +26861,44 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26743
26861
|
}
|
|
26744
26862
|
return map;
|
|
26745
26863
|
}
|
|
26864
|
+
function resolveAliasValue(ctx, value) {
|
|
26865
|
+
return ctx && isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
26866
|
+
}
|
|
26867
|
+
|
|
26868
|
+
function addPairToJSMap(ctx, map, { key, value }) {
|
|
26869
|
+
if (isNode(key) && key.addToJSMap)
|
|
26870
|
+
key.addToJSMap(ctx, map, value);
|
|
26871
|
+
// TODO: Should drop this special case for bare << handling
|
|
26872
|
+
else if (isMergeKey(ctx, key))
|
|
26873
|
+
addMergeToJSMap(ctx, map, value);
|
|
26874
|
+
else {
|
|
26875
|
+
const jsKey = toJS(key, '', ctx);
|
|
26876
|
+
if (map instanceof Map) {
|
|
26877
|
+
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
26878
|
+
}
|
|
26879
|
+
else if (map instanceof Set) {
|
|
26880
|
+
map.add(jsKey);
|
|
26881
|
+
}
|
|
26882
|
+
else {
|
|
26883
|
+
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
26884
|
+
const jsValue = toJS(value, stringKey, ctx);
|
|
26885
|
+
if (stringKey in map)
|
|
26886
|
+
Object.defineProperty(map, stringKey, {
|
|
26887
|
+
value: jsValue,
|
|
26888
|
+
writable: true,
|
|
26889
|
+
enumerable: true,
|
|
26890
|
+
configurable: true
|
|
26891
|
+
});
|
|
26892
|
+
else
|
|
26893
|
+
map[stringKey] = jsValue;
|
|
26894
|
+
}
|
|
26895
|
+
}
|
|
26896
|
+
return map;
|
|
26897
|
+
}
|
|
26746
26898
|
function stringifyKey(key, jsKey, ctx) {
|
|
26747
26899
|
if (jsKey === null)
|
|
26748
26900
|
return '';
|
|
26901
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
26749
26902
|
if (typeof jsKey !== 'object')
|
|
26750
26903
|
return String(jsKey);
|
|
26751
26904
|
if (isNode(key) && ctx?.doc) {
|
|
@@ -26898,12 +27051,22 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26898
27051
|
if (comment)
|
|
26899
27052
|
reqNewline = true;
|
|
26900
27053
|
let str = stringify$2(item, itemCtx, () => (comment = null));
|
|
26901
|
-
|
|
27054
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n'));
|
|
27055
|
+
if (i < items.length - 1) {
|
|
26902
27056
|
str += ',';
|
|
27057
|
+
}
|
|
27058
|
+
else if (ctx.options.trailingComma) {
|
|
27059
|
+
if (ctx.options.lineWidth > 0) {
|
|
27060
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +
|
|
27061
|
+
(str.length + 2) >
|
|
27062
|
+
ctx.options.lineWidth);
|
|
27063
|
+
}
|
|
27064
|
+
if (reqNewline) {
|
|
27065
|
+
str += ',';
|
|
27066
|
+
}
|
|
27067
|
+
}
|
|
26903
27068
|
if (comment)
|
|
26904
27069
|
str += lineComment(str, itemIndent, commentString(comment));
|
|
26905
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
|
|
26906
|
-
reqNewline = true;
|
|
26907
27070
|
lines.push(str);
|
|
26908
27071
|
linesAtValue = lines.length;
|
|
26909
27072
|
}
|
|
@@ -27248,11 +27411,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27248
27411
|
const num = typeof value === 'number' ? value : Number(value);
|
|
27249
27412
|
if (!isFinite(num))
|
|
27250
27413
|
return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
|
|
27251
|
-
let n = JSON.stringify(value);
|
|
27414
|
+
let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
|
|
27252
27415
|
if (!format &&
|
|
27253
27416
|
minFractionDigits &&
|
|
27254
27417
|
(!tag || tag === 'tag:yaml.org,2002:float') &&
|
|
27255
|
-
|
|
27418
|
+
/^-?\d/.test(n) &&
|
|
27419
|
+
!n.includes('e')) {
|
|
27256
27420
|
let i = n.indexOf('.');
|
|
27257
27421
|
if (i < 0) {
|
|
27258
27422
|
i = n.length;
|
|
@@ -27378,7 +27542,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27378
27542
|
identify: value => typeof value === 'boolean',
|
|
27379
27543
|
default: true,
|
|
27380
27544
|
tag: 'tag:yaml.org,2002:bool',
|
|
27381
|
-
test: /^true
|
|
27545
|
+
test: /^true$|^false$/,
|
|
27382
27546
|
resolve: str => str === 'true',
|
|
27383
27547
|
stringify: stringifyJSON
|
|
27384
27548
|
},
|
|
@@ -27423,10 +27587,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27423
27587
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
27424
27588
|
*/
|
|
27425
27589
|
resolve(src, onError) {
|
|
27426
|
-
if (typeof
|
|
27427
|
-
return Buffer.from(src, 'base64');
|
|
27428
|
-
}
|
|
27429
|
-
else if (typeof atob === 'function') {
|
|
27590
|
+
if (typeof atob === 'function') {
|
|
27430
27591
|
// On IE 11, atob() can't handle newlines
|
|
27431
27592
|
const str = atob(src.replace(/[\n\r]/g, ''));
|
|
27432
27593
|
const buffer = new Uint8Array(str.length);
|
|
@@ -27440,15 +27601,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27440
27601
|
}
|
|
27441
27602
|
},
|
|
27442
27603
|
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
27604
|
+
if (!value)
|
|
27605
|
+
return '';
|
|
27443
27606
|
const buf = value; // checked earlier by binary.identify()
|
|
27444
27607
|
let str;
|
|
27445
|
-
if (typeof
|
|
27446
|
-
str =
|
|
27447
|
-
buf instanceof Buffer
|
|
27448
|
-
? buf.toString('base64')
|
|
27449
|
-
: Buffer.from(buf.buffer).toString('base64');
|
|
27450
|
-
}
|
|
27451
|
-
else if (typeof btoa === 'function') {
|
|
27608
|
+
if (typeof btoa === 'function') {
|
|
27452
27609
|
let s = '';
|
|
27453
27610
|
for (let i = 0; i < buf.length; ++i)
|
|
27454
27611
|
s += String.fromCharCode(buf[i]);
|
|
@@ -27457,8 +27614,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27457
27614
|
else {
|
|
27458
27615
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
27459
27616
|
}
|
|
27460
|
-
|
|
27461
|
-
type = Scalar.BLOCK_LITERAL;
|
|
27617
|
+
type ?? (type = Scalar.BLOCK_LITERAL);
|
|
27462
27618
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
27463
27619
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
27464
27620
|
const n = Math.ceil(str.length / lineWidth);
|
|
@@ -27927,7 +28083,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27927
28083
|
}
|
|
27928
28084
|
return new Date(date);
|
|
27929
28085
|
},
|
|
27930
|
-
stringify: ({ value }) => value
|
|
28086
|
+
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
|
|
27931
28087
|
};
|
|
27932
28088
|
|
|
27933
28089
|
const schema = [
|
|
@@ -27945,6 +28101,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27945
28101
|
floatExp,
|
|
27946
28102
|
float,
|
|
27947
28103
|
binary,
|
|
28104
|
+
merge,
|
|
27948
28105
|
omap,
|
|
27949
28106
|
pairs,
|
|
27950
28107
|
set,
|
|
@@ -27972,6 +28129,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27972
28129
|
intOct: intOct$1,
|
|
27973
28130
|
intTime,
|
|
27974
28131
|
map,
|
|
28132
|
+
merge,
|
|
27975
28133
|
null: nullTag,
|
|
27976
28134
|
omap,
|
|
27977
28135
|
pairs,
|
|
@@ -27981,13 +28139,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
27981
28139
|
};
|
|
27982
28140
|
const coreKnownTags = {
|
|
27983
28141
|
'tag:yaml.org,2002:binary': binary,
|
|
28142
|
+
'tag:yaml.org,2002:merge': merge,
|
|
27984
28143
|
'tag:yaml.org,2002:omap': omap,
|
|
27985
28144
|
'tag:yaml.org,2002:pairs': pairs,
|
|
27986
28145
|
'tag:yaml.org,2002:set': set,
|
|
27987
28146
|
'tag:yaml.org,2002:timestamp': timestamp
|
|
27988
28147
|
};
|
|
27989
|
-
function getTags(customTags, schemaName) {
|
|
27990
|
-
|
|
28148
|
+
function getTags(customTags, schemaName, addMergeTag) {
|
|
28149
|
+
const schemaTags = schemas.get(schemaName);
|
|
28150
|
+
if (schemaTags && !customTags) {
|
|
28151
|
+
return addMergeTag && !schemaTags.includes(merge)
|
|
28152
|
+
? schemaTags.concat(merge)
|
|
28153
|
+
: schemaTags.slice();
|
|
28154
|
+
}
|
|
28155
|
+
let tags = schemaTags;
|
|
27991
28156
|
if (!tags) {
|
|
27992
28157
|
if (Array.isArray(customTags))
|
|
27993
28158
|
tags = [];
|
|
@@ -28006,17 +28171,21 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28006
28171
|
else if (typeof customTags === 'function') {
|
|
28007
28172
|
tags = customTags(tags.slice());
|
|
28008
28173
|
}
|
|
28009
|
-
|
|
28010
|
-
|
|
28011
|
-
|
|
28012
|
-
const tagObj = tagsByName[tag];
|
|
28013
|
-
if (tagObj)
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
|
|
28174
|
+
if (addMergeTag)
|
|
28175
|
+
tags = tags.concat(merge);
|
|
28176
|
+
return tags.reduce((tags, tag) => {
|
|
28177
|
+
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
|
28178
|
+
if (!tagObj) {
|
|
28179
|
+
const tagName = JSON.stringify(tag);
|
|
28180
|
+
const keys = Object.keys(tagsByName)
|
|
28181
|
+
.map(key => JSON.stringify(key))
|
|
28182
|
+
.join(', ');
|
|
28183
|
+
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
28184
|
+
}
|
|
28185
|
+
if (!tags.includes(tagObj))
|
|
28186
|
+
tags.push(tagObj);
|
|
28187
|
+
return tags;
|
|
28188
|
+
}, []);
|
|
28020
28189
|
}
|
|
28021
28190
|
|
|
28022
28191
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
@@ -28027,10 +28196,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28027
28196
|
: compat
|
|
28028
28197
|
? getTags(null, compat)
|
|
28029
28198
|
: null;
|
|
28030
|
-
this.merge = !!merge;
|
|
28031
28199
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
28032
28200
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
28033
|
-
this.tags = getTags(customTags, this.name);
|
|
28201
|
+
this.tags = getTags(customTags, this.name, merge);
|
|
28034
28202
|
this.toStringOptions = toStringDefaults ?? null;
|
|
28035
28203
|
Object.defineProperty(this, MAP, { value: map });
|
|
28036
28204
|
Object.defineProperty(this, SCALAR$1, { value: string });
|
|
@@ -28155,6 +28323,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28155
28323
|
logLevel: 'warn',
|
|
28156
28324
|
prettyErrors: true,
|
|
28157
28325
|
strict: true,
|
|
28326
|
+
stringKeys: false,
|
|
28158
28327
|
uniqueKeys: true,
|
|
28159
28328
|
version: '1.2'
|
|
28160
28329
|
}, options);
|
|
@@ -28378,7 +28547,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28378
28547
|
this.directives.yaml.version = '1.1';
|
|
28379
28548
|
else
|
|
28380
28549
|
this.directives = new Directives({ version: '1.1' });
|
|
28381
|
-
opt = {
|
|
28550
|
+
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
28382
28551
|
break;
|
|
28383
28552
|
case '1.2':
|
|
28384
28553
|
case 'next':
|
|
@@ -28386,7 +28555,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28386
28555
|
this.directives.yaml.version = version;
|
|
28387
28556
|
else
|
|
28388
28557
|
this.directives = new Directives({ version });
|
|
28389
|
-
opt = {
|
|
28558
|
+
opt = { resolveKnownTags: true, schema: 'core' };
|
|
28390
28559
|
break;
|
|
28391
28560
|
case null:
|
|
28392
28561
|
if (this.directives)
|
|
@@ -28499,7 +28668,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28499
28668
|
if (/[^ ]/.test(lineStr)) {
|
|
28500
28669
|
let count = 1;
|
|
28501
28670
|
const end = error.linePos[1];
|
|
28502
|
-
if (end
|
|
28671
|
+
if (end?.line === line && end.col > col) {
|
|
28503
28672
|
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
28504
28673
|
}
|
|
28505
28674
|
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
@@ -28564,7 +28733,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28564
28733
|
if (atNewline) {
|
|
28565
28734
|
if (comment)
|
|
28566
28735
|
comment += token.source;
|
|
28567
|
-
else
|
|
28736
|
+
else if (!found || indicator !== 'seq-item-ind')
|
|
28568
28737
|
spaceBefore = true;
|
|
28569
28738
|
}
|
|
28570
28739
|
else
|
|
@@ -28581,8 +28750,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28581
28750
|
if (token.source.endsWith(':'))
|
|
28582
28751
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
28583
28752
|
anchor = token;
|
|
28584
|
-
|
|
28585
|
-
start = token.offset;
|
|
28753
|
+
start ?? (start = token.offset);
|
|
28586
28754
|
atNewline = false;
|
|
28587
28755
|
hasSpace = false;
|
|
28588
28756
|
reqSpace = true;
|
|
@@ -28591,8 +28759,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28591
28759
|
if (tag)
|
|
28592
28760
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
28593
28761
|
tag = token;
|
|
28594
|
-
|
|
28595
|
-
start = token.offset;
|
|
28762
|
+
start ?? (start = token.offset);
|
|
28596
28763
|
atNewline = false;
|
|
28597
28764
|
hasSpace = false;
|
|
28598
28765
|
reqSpace = true;
|
|
@@ -28705,11 +28872,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28705
28872
|
return false;
|
|
28706
28873
|
const isEqual = typeof uniqueKeys === 'function'
|
|
28707
28874
|
? uniqueKeys
|
|
28708
|
-
: (a, b) => a === b ||
|
|
28709
|
-
(isScalar$1(a) &&
|
|
28710
|
-
isScalar$1(b) &&
|
|
28711
|
-
a.value === b.value &&
|
|
28712
|
-
!(a.value === '<<' && ctx.schema.merge));
|
|
28875
|
+
: (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
|
|
28713
28876
|
return items.some(pair => isEqual(pair.key, search));
|
|
28714
28877
|
}
|
|
28715
28878
|
|
|
@@ -28758,12 +28921,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28758
28921
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
28759
28922
|
}
|
|
28760
28923
|
// key value
|
|
28924
|
+
ctx.atKey = true;
|
|
28761
28925
|
const keyStart = keyProps.end;
|
|
28762
28926
|
const keyNode = key
|
|
28763
28927
|
? composeNode(ctx, key, keyProps, onError)
|
|
28764
28928
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
28765
28929
|
if (ctx.schema.compat)
|
|
28766
28930
|
flowIndentCheck(bm.indent, key, onError);
|
|
28931
|
+
ctx.atKey = false;
|
|
28767
28932
|
if (mapIncludes(ctx, map.items, keyNode))
|
|
28768
28933
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
28769
28934
|
// value properties
|
|
@@ -28823,6 +28988,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28823
28988
|
const seq = new NodeClass(ctx.schema);
|
|
28824
28989
|
if (ctx.atRoot)
|
|
28825
28990
|
ctx.atRoot = false;
|
|
28991
|
+
if (ctx.atKey)
|
|
28992
|
+
ctx.atKey = false;
|
|
28826
28993
|
let offset = bs.offset;
|
|
28827
28994
|
let commentEnd = null;
|
|
28828
28995
|
for (const { start, value } of bs.items) {
|
|
@@ -28836,7 +29003,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28836
29003
|
});
|
|
28837
29004
|
if (!props.found) {
|
|
28838
29005
|
if (props.anchor || props.tag || value) {
|
|
28839
|
-
if (value
|
|
29006
|
+
if (value?.type === 'block-seq')
|
|
28840
29007
|
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
|
|
28841
29008
|
else
|
|
28842
29009
|
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
|
|
@@ -28907,6 +29074,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28907
29074
|
const atRoot = ctx.atRoot;
|
|
28908
29075
|
if (atRoot)
|
|
28909
29076
|
ctx.atRoot = false;
|
|
29077
|
+
if (ctx.atKey)
|
|
29078
|
+
ctx.atKey = false;
|
|
28910
29079
|
let offset = fc.offset + fc.start.source.length;
|
|
28911
29080
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
28912
29081
|
const collItem = fc.items[i];
|
|
@@ -28986,12 +29155,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28986
29155
|
else {
|
|
28987
29156
|
// item is a key+value pair
|
|
28988
29157
|
// key value
|
|
29158
|
+
ctx.atKey = true;
|
|
28989
29159
|
const keyStart = props.end;
|
|
28990
29160
|
const keyNode = key
|
|
28991
29161
|
? composeNode(ctx, key, props, onError)
|
|
28992
29162
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
28993
29163
|
if (isBlock(key))
|
|
28994
29164
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
29165
|
+
ctx.atKey = false;
|
|
28995
29166
|
// value properties
|
|
28996
29167
|
const valueProps = resolveProps(sep ?? [], {
|
|
28997
29168
|
flow: fcName,
|
|
@@ -29018,7 +29189,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29018
29189
|
}
|
|
29019
29190
|
}
|
|
29020
29191
|
else if (value) {
|
|
29021
|
-
if ('source' in value && value.source
|
|
29192
|
+
if ('source' in value && value.source?.[0] === ':')
|
|
29022
29193
|
onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
|
|
29023
29194
|
else
|
|
29024
29195
|
onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
|
|
@@ -29062,7 +29233,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29062
29233
|
const expectedEnd = isMap ? '}' : ']';
|
|
29063
29234
|
const [ce, ...ee] = fc.end;
|
|
29064
29235
|
let cePos = offset;
|
|
29065
|
-
if (ce
|
|
29236
|
+
if (ce?.source === expectedEnd)
|
|
29066
29237
|
cePos = ce.offset + ce.source.length;
|
|
29067
29238
|
else {
|
|
29068
29239
|
const name = fcName[0].toUpperCase() + fcName.substring(1);
|
|
@@ -29142,13 +29313,13 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29142
29313
|
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
|
|
29143
29314
|
if (!tag) {
|
|
29144
29315
|
const kt = ctx.schema.knownTags[tagName];
|
|
29145
|
-
if (kt
|
|
29316
|
+
if (kt?.collection === expType) {
|
|
29146
29317
|
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
29147
29318
|
tag = kt;
|
|
29148
29319
|
}
|
|
29149
29320
|
else {
|
|
29150
|
-
if (kt
|
|
29151
|
-
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
29321
|
+
if (kt) {
|
|
29322
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
|
|
29152
29323
|
}
|
|
29153
29324
|
else {
|
|
29154
29325
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
@@ -29504,7 +29675,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29504
29675
|
next = source[++i + 1];
|
|
29505
29676
|
}
|
|
29506
29677
|
else if (next === 'x' || next === 'u' || next === 'U') {
|
|
29507
|
-
const length =
|
|
29678
|
+
const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
|
|
29508
29679
|
res += parseCharCode(source, i + 1, length, onError);
|
|
29509
29680
|
i += length;
|
|
29510
29681
|
}
|
|
@@ -29574,12 +29745,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29574
29745
|
const cc = source.substr(offset, length);
|
|
29575
29746
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
29576
29747
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
29577
|
-
|
|
29748
|
+
try {
|
|
29749
|
+
return String.fromCodePoint(code);
|
|
29750
|
+
}
|
|
29751
|
+
catch {
|
|
29578
29752
|
const raw = source.substr(offset - 2, length + 2);
|
|
29579
29753
|
onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
|
|
29580
29754
|
return raw;
|
|
29581
29755
|
}
|
|
29582
|
-
return String.fromCodePoint(code);
|
|
29583
29756
|
}
|
|
29584
29757
|
|
|
29585
29758
|
function composeScalar(ctx, token, tagToken, onError) {
|
|
@@ -29589,11 +29762,16 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29589
29762
|
const tagName = tagToken
|
|
29590
29763
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
29591
29764
|
: null;
|
|
29592
|
-
|
|
29593
|
-
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
|
|
29765
|
+
let tag;
|
|
29766
|
+
if (ctx.options.stringKeys && ctx.atKey) {
|
|
29767
|
+
tag = ctx.schema[SCALAR$1];
|
|
29768
|
+
}
|
|
29769
|
+
else if (tagName)
|
|
29770
|
+
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
29771
|
+
else if (token.type === 'scalar')
|
|
29772
|
+
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
29773
|
+
else
|
|
29774
|
+
tag = ctx.schema[SCALAR$1];
|
|
29597
29775
|
let scalar;
|
|
29598
29776
|
try {
|
|
29599
29777
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
@@ -29641,8 +29819,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29641
29819
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
29642
29820
|
return schema[SCALAR$1];
|
|
29643
29821
|
}
|
|
29644
|
-
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
29645
|
-
const tag = schema.tags.find(tag => tag.default && tag.
|
|
29822
|
+
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
29823
|
+
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
|
|
29824
|
+
tag.test?.test(value)) || schema[SCALAR$1];
|
|
29646
29825
|
if (schema.compat) {
|
|
29647
29826
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
29648
29827
|
schema[SCALAR$1];
|
|
@@ -29658,8 +29837,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29658
29837
|
|
|
29659
29838
|
function emptyScalarPosition(offset, before, pos) {
|
|
29660
29839
|
if (before) {
|
|
29661
|
-
|
|
29662
|
-
pos = before.length;
|
|
29840
|
+
pos ?? (pos = before.length);
|
|
29663
29841
|
for (let i = pos - 1; i >= 0; --i) {
|
|
29664
29842
|
let st = before[i];
|
|
29665
29843
|
switch (st.type) {
|
|
@@ -29684,6 +29862,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29684
29862
|
|
|
29685
29863
|
const CN = { composeNode, composeEmptyNode };
|
|
29686
29864
|
function composeNode(ctx, token, props, onError) {
|
|
29865
|
+
const atKey = ctx.atKey;
|
|
29687
29866
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
29688
29867
|
let node;
|
|
29689
29868
|
let isSrcToken = true;
|
|
@@ -29704,21 +29883,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29704
29883
|
case 'block-map':
|
|
29705
29884
|
case 'block-seq':
|
|
29706
29885
|
case 'flow-collection':
|
|
29707
|
-
|
|
29708
|
-
|
|
29709
|
-
|
|
29886
|
+
try {
|
|
29887
|
+
node = composeCollection(CN, ctx, token, props, onError);
|
|
29888
|
+
if (anchor)
|
|
29889
|
+
node.anchor = anchor.source.substring(1);
|
|
29890
|
+
}
|
|
29891
|
+
catch (error) {
|
|
29892
|
+
// Almost certainly here due to a stack overflow
|
|
29893
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
29894
|
+
onError(token, 'RESOURCE_EXHAUSTION', message);
|
|
29895
|
+
}
|
|
29710
29896
|
break;
|
|
29711
29897
|
default: {
|
|
29712
29898
|
const message = token.type === 'error'
|
|
29713
29899
|
? token.message
|
|
29714
29900
|
: `Unsupported token (type: ${token.type})`;
|
|
29715
29901
|
onError(token, 'UNEXPECTED_TOKEN', message);
|
|
29716
|
-
node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
|
|
29717
29902
|
isSrcToken = false;
|
|
29718
29903
|
}
|
|
29719
29904
|
}
|
|
29905
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
|
|
29720
29906
|
if (anchor && node.anchor === '')
|
|
29721
29907
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
|
29908
|
+
if (atKey &&
|
|
29909
|
+
ctx.options.stringKeys &&
|
|
29910
|
+
(!isScalar$1(node) ||
|
|
29911
|
+
typeof node.value !== 'string' ||
|
|
29912
|
+
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
29913
|
+
const msg = 'With stringKeys, all keys must be strings';
|
|
29914
|
+
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
29915
|
+
}
|
|
29722
29916
|
if (spaceBefore)
|
|
29723
29917
|
node.spaceBefore = true;
|
|
29724
29918
|
if (comment) {
|
|
@@ -29771,6 +29965,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29771
29965
|
const opts = Object.assign({ _directives: directives }, options);
|
|
29772
29966
|
const doc = new Document(undefined, opts);
|
|
29773
29967
|
const ctx = {
|
|
29968
|
+
atKey: false,
|
|
29774
29969
|
atRoot: true,
|
|
29775
29970
|
directives: doc.directives,
|
|
29776
29971
|
options: doc.options,
|
|
@@ -29892,8 +30087,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
29892
30087
|
}
|
|
29893
30088
|
}
|
|
29894
30089
|
if (afterDoc) {
|
|
29895
|
-
|
|
29896
|
-
|
|
30090
|
+
for (let i = 0; i < this.errors.length; ++i)
|
|
30091
|
+
doc.errors.push(this.errors[i]);
|
|
30092
|
+
for (let i = 0; i < this.warnings.length; ++i)
|
|
30093
|
+
doc.warnings.push(this.warnings[i]);
|
|
29897
30094
|
}
|
|
29898
30095
|
else {
|
|
29899
30096
|
doc.errors = this.errors;
|
|
@@ -30796,7 +30993,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
30796
30993
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
30797
30994
|
this.indentNext = this.indentValue + 1;
|
|
30798
30995
|
this.indentValue += n;
|
|
30799
|
-
return
|
|
30996
|
+
return 'block-start';
|
|
30800
30997
|
}
|
|
30801
30998
|
return 'doc';
|
|
30802
30999
|
}
|
|
@@ -31117,32 +31314,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31117
31314
|
return 0;
|
|
31118
31315
|
}
|
|
31119
31316
|
*pushIndicators() {
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
|
|
31141
|
-
|
|
31317
|
+
let n = 0;
|
|
31318
|
+
loop: while (true) {
|
|
31319
|
+
switch (this.charAt(0)) {
|
|
31320
|
+
case '!':
|
|
31321
|
+
n += yield* this.pushTag();
|
|
31322
|
+
n += yield* this.pushSpaces(true);
|
|
31323
|
+
continue loop;
|
|
31324
|
+
case '&':
|
|
31325
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
31326
|
+
n += yield* this.pushSpaces(true);
|
|
31327
|
+
continue loop;
|
|
31328
|
+
case '-': // this is an error
|
|
31329
|
+
case '?': // this is an error outside flow collections
|
|
31330
|
+
case ':': {
|
|
31331
|
+
const inFlow = this.flowLevel > 0;
|
|
31332
|
+
const ch1 = this.charAt(1);
|
|
31333
|
+
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
|
31334
|
+
if (!inFlow)
|
|
31335
|
+
this.indentNext = this.indentValue + 1;
|
|
31336
|
+
else if (this.flowKey)
|
|
31337
|
+
this.flowKey = false;
|
|
31338
|
+
n += yield* this.pushCount(1);
|
|
31339
|
+
n += yield* this.pushSpaces(true);
|
|
31340
|
+
continue loop;
|
|
31341
|
+
}
|
|
31142
31342
|
}
|
|
31143
31343
|
}
|
|
31344
|
+
break loop;
|
|
31144
31345
|
}
|
|
31145
|
-
return
|
|
31346
|
+
return n;
|
|
31146
31347
|
}
|
|
31147
31348
|
*pushTag() {
|
|
31148
31349
|
if (this.charAt(1) === '<') {
|
|
@@ -31304,6 +31505,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31304
31505
|
}
|
|
31305
31506
|
return prev.splice(i, prev.length);
|
|
31306
31507
|
}
|
|
31508
|
+
function arrayPushArray(target, source) {
|
|
31509
|
+
// May exhaust call stack with large `source` array
|
|
31510
|
+
if (source.length < 1e5)
|
|
31511
|
+
Array.prototype.push.apply(target, source);
|
|
31512
|
+
else
|
|
31513
|
+
for (let i = 0; i < source.length; ++i)
|
|
31514
|
+
target.push(source[i]);
|
|
31515
|
+
}
|
|
31307
31516
|
function fixFlowSeqItems(fc) {
|
|
31308
31517
|
if (fc.start.type === 'flow-seq-start') {
|
|
31309
31518
|
for (const it of fc.items) {
|
|
@@ -31316,12 +31525,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31316
31525
|
delete it.key;
|
|
31317
31526
|
if (isFlowToken(it.value)) {
|
|
31318
31527
|
if (it.value.end)
|
|
31319
|
-
|
|
31528
|
+
arrayPushArray(it.value.end, it.sep);
|
|
31320
31529
|
else
|
|
31321
31530
|
it.value.end = it.sep;
|
|
31322
31531
|
}
|
|
31323
31532
|
else
|
|
31324
|
-
|
|
31533
|
+
arrayPushArray(it.start, it.sep);
|
|
31325
31534
|
delete it.sep;
|
|
31326
31535
|
}
|
|
31327
31536
|
}
|
|
@@ -31463,7 +31672,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31463
31672
|
}
|
|
31464
31673
|
*step() {
|
|
31465
31674
|
const top = this.peek(1);
|
|
31466
|
-
if (this.type === 'doc-end' &&
|
|
31675
|
+
if (this.type === 'doc-end' && top?.type !== 'doc-end') {
|
|
31467
31676
|
while (this.stack.length > 0)
|
|
31468
31677
|
yield* this.pop();
|
|
31469
31678
|
this.stack.push({
|
|
@@ -31739,7 +31948,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31739
31948
|
const prev = map.items[map.items.length - 2];
|
|
31740
31949
|
const end = prev?.value?.end;
|
|
31741
31950
|
if (Array.isArray(end)) {
|
|
31742
|
-
|
|
31951
|
+
arrayPushArray(end, it.start);
|
|
31743
31952
|
end.push(this.sourceToken);
|
|
31744
31953
|
map.items.pop();
|
|
31745
31954
|
return;
|
|
@@ -31905,7 +32114,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31905
32114
|
default: {
|
|
31906
32115
|
const bv = this.startBlockValue(map);
|
|
31907
32116
|
if (bv) {
|
|
31908
|
-
if (
|
|
32117
|
+
if (bv.type === 'block-seq') {
|
|
32118
|
+
if (!it.explicitKey &&
|
|
32119
|
+
it.sep &&
|
|
32120
|
+
!includesToken(it.sep, 'newline')) {
|
|
32121
|
+
yield* this.pop({
|
|
32122
|
+
type: 'error',
|
|
32123
|
+
offset: this.offset,
|
|
32124
|
+
message: 'Unexpected block-seq-ind on same line with key',
|
|
32125
|
+
source: this.source
|
|
32126
|
+
});
|
|
32127
|
+
return;
|
|
32128
|
+
}
|
|
32129
|
+
}
|
|
32130
|
+
else if (atMapIndent) {
|
|
31909
32131
|
map.items.push({ start });
|
|
31910
32132
|
}
|
|
31911
32133
|
this.stack.push(bv);
|
|
@@ -31941,7 +32163,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31941
32163
|
const prev = seq.items[seq.items.length - 2];
|
|
31942
32164
|
const end = prev?.value?.end;
|
|
31943
32165
|
if (Array.isArray(end)) {
|
|
31944
|
-
|
|
32166
|
+
arrayPushArray(end, it.start);
|
|
31945
32167
|
end.push(this.sourceToken);
|
|
31946
32168
|
seq.items.pop();
|
|
31947
32169
|
return;
|
|
@@ -31982,7 +32204,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
31982
32204
|
do {
|
|
31983
32205
|
yield* this.pop();
|
|
31984
32206
|
top = this.peek(1);
|
|
31985
|
-
} while (top
|
|
32207
|
+
} while (top?.type === 'flow-collection');
|
|
31986
32208
|
}
|
|
31987
32209
|
else if (fc.end.length === 0) {
|
|
31988
32210
|
switch (this.type) {
|
|
@@ -32276,6 +32498,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
32276
32498
|
if (!keepUndefined)
|
|
32277
32499
|
return undefined;
|
|
32278
32500
|
}
|
|
32501
|
+
if (isDocument(value) && !_replacer)
|
|
32502
|
+
return value.toString(options);
|
|
32279
32503
|
return new Document(value, _replacer, options).toString(options);
|
|
32280
32504
|
}
|
|
32281
32505
|
|