@thoughtspot/visual-embed-sdk 1.42.1-alpha.3 → 1.42.1-alpha.5
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 +1 -2
- package/cjs/src/api-intercept.d.ts +10 -8
- package/cjs/src/api-intercept.d.ts.map +1 -1
- package/cjs/src/api-intercept.js +12 -10
- package/cjs/src/api-intercept.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +0 -85
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/react/util.d.ts +0 -1
- package/cjs/src/react/util.d.ts.map +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/index-DFnPKcjZ.js +7447 -0
- package/dist/index-DhFH7b7U.js +7447 -0
- package/dist/src/api-intercept.d.ts +10 -8
- package/dist/src/api-intercept.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +0 -1
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +15 -13
- package/dist/tsembed-react.js +235 -157
- package/dist/tsembed.es.js +15 -13
- package/dist/tsembed.js +235 -157
- package/lib/package.json +1 -2
- package/lib/src/api-intercept.d.ts +10 -8
- package/lib/src/api-intercept.d.ts.map +1 -1
- package/lib/src/api-intercept.js +12 -10
- package/lib/src/api-intercept.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +0 -85
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/react/util.d.ts +0 -1
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/package.json +1 -2
- package/src/api-intercept.ts +12 -10
- package/src/embed/ts-embed.spec.ts +0 -105
- package/src/utils/processData.spec.ts +0 -1
- package/src/api-intercept.spec.ts +0 -147
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.5 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
return false;
|
|
34
34
|
};
|
|
35
|
-
const merge = (...objects) => objects.reduce((result, current) => {
|
|
35
|
+
const merge$1 = (...objects) => objects.reduce((result, current) => {
|
|
36
36
|
if (Array.isArray(current)) {
|
|
37
37
|
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
38
38
|
}
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
44
|
-
result[key] = merge.options.mergeArrays
|
|
45
|
-
? merge.options.uniqueArrayItems
|
|
44
|
+
result[key] = merge$1.options.mergeArrays
|
|
45
|
+
? merge$1.options.uniqueArrayItems
|
|
46
46
|
? Array.from(new Set(result[key].concat(current[key])))
|
|
47
47
|
: [...result[key], ...current[key]]
|
|
48
48
|
: current[key];
|
|
49
49
|
}
|
|
50
50
|
else if (isObject$1(result[key]) && isObject$1(current[key])) {
|
|
51
|
-
result[key] = merge(result[key], current[key]);
|
|
51
|
+
result[key] = merge$1(result[key], current[key]);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
result[key] =
|
|
55
55
|
current[key] === undefined
|
|
56
|
-
? merge.options.allowUndefinedOverrides
|
|
56
|
+
? merge$1.options.allowUndefinedOverrides
|
|
57
57
|
? current[key]
|
|
58
58
|
: result[key]
|
|
59
59
|
: current[key];
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
mergeArrays: true,
|
|
67
67
|
uniqueArrayItems: true,
|
|
68
68
|
};
|
|
69
|
-
merge.options = defaultOptions;
|
|
70
|
-
merge.withOptions = (options, ...objects) => {
|
|
71
|
-
merge.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
72
|
-
const result = merge(...objects);
|
|
73
|
-
merge.options = defaultOptions;
|
|
69
|
+
merge$1.options = defaultOptions;
|
|
70
|
+
merge$1.withOptions = (options, ...objects) => {
|
|
71
|
+
merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
72
|
+
const result = merge$1(...objects);
|
|
73
|
+
merge$1.options = defaultOptions;
|
|
74
74
|
return result;
|
|
75
75
|
};
|
|
76
76
|
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
function getDOMNode(domSelector) {
|
|
272
272
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
273
273
|
}
|
|
274
|
-
const deepMerge = (target, source) => merge(target, source);
|
|
274
|
+
const deepMerge = (target, source) => merge$1(target, source);
|
|
275
275
|
const getOperationNameFromQuery = (query) => {
|
|
276
276
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
277
277
|
const matches = query.match(regex);
|
|
@@ -17536,7 +17536,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17536
17536
|
return eventData;
|
|
17537
17537
|
}
|
|
17538
17538
|
|
|
17539
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1-alpha.
|
|
17539
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1-alpha.5";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
17540
17540
|
|
|
17541
17541
|
/**
|
|
17542
17542
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -17788,17 +17788,19 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17788
17788
|
const desc = (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.errorDescription;
|
|
17789
17789
|
const payloadToSend = {
|
|
17790
17790
|
execute: (_c = payload === null || payload === void 0 ? void 0 : payload.data) === null || _c === void 0 ? void 0 : _c.execute,
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17791
|
+
response: {
|
|
17792
|
+
body: {
|
|
17793
|
+
errors: [
|
|
17794
|
+
{
|
|
17795
|
+
errorObj: {
|
|
17796
|
+
title,
|
|
17797
|
+
desc
|
|
17798
|
+
}
|
|
17797
17799
|
}
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17800
|
+
],
|
|
17801
|
+
},
|
|
17802
|
+
status: 200,
|
|
17803
|
+
}
|
|
17802
17804
|
};
|
|
17803
17805
|
return { data: payloadToSend };
|
|
17804
17806
|
};
|
|
@@ -22030,8 +22032,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22030
22032
|
return {
|
|
22031
22033
|
onAnchor: (source) => {
|
|
22032
22034
|
aliasObjects.push(source);
|
|
22033
|
-
|
|
22034
|
-
prevAnchors = anchorNames(doc);
|
|
22035
|
+
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
22035
22036
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
22036
22037
|
prevAnchors.add(anchor);
|
|
22037
22038
|
return anchor;
|
|
@@ -22195,23 +22196,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22195
22196
|
* Resolve the value of this alias within `doc`, finding the last
|
|
22196
22197
|
* instance of the `source` anchor before this node.
|
|
22197
22198
|
*/
|
|
22198
|
-
resolve(doc) {
|
|
22199
|
+
resolve(doc, ctx) {
|
|
22200
|
+
let nodes;
|
|
22201
|
+
if (ctx?.aliasResolveCache) {
|
|
22202
|
+
nodes = ctx.aliasResolveCache;
|
|
22203
|
+
}
|
|
22204
|
+
else {
|
|
22205
|
+
nodes = [];
|
|
22206
|
+
visit$1(doc, {
|
|
22207
|
+
Node: (_key, node) => {
|
|
22208
|
+
if (isAlias(node) || hasAnchor(node))
|
|
22209
|
+
nodes.push(node);
|
|
22210
|
+
}
|
|
22211
|
+
});
|
|
22212
|
+
if (ctx)
|
|
22213
|
+
ctx.aliasResolveCache = nodes;
|
|
22214
|
+
}
|
|
22199
22215
|
let found = undefined;
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
}
|
|
22207
|
-
});
|
|
22216
|
+
for (const node of nodes) {
|
|
22217
|
+
if (node === this)
|
|
22218
|
+
break;
|
|
22219
|
+
if (node.anchor === this.source)
|
|
22220
|
+
found = node;
|
|
22221
|
+
}
|
|
22208
22222
|
return found;
|
|
22209
22223
|
}
|
|
22210
22224
|
toJSON(_arg, ctx) {
|
|
22211
22225
|
if (!ctx)
|
|
22212
22226
|
return { source: this.source };
|
|
22213
22227
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
22214
|
-
const source = this.resolve(doc);
|
|
22228
|
+
const source = this.resolve(doc, ctx);
|
|
22215
22229
|
if (!source) {
|
|
22216
22230
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
22217
22231
|
throw new ReferenceError(msg);
|
|
@@ -22330,8 +22344,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22330
22344
|
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
22331
22345
|
ref = sourceObjects.get(value);
|
|
22332
22346
|
if (ref) {
|
|
22333
|
-
|
|
22334
|
-
ref.anchor = onAnchor(value);
|
|
22347
|
+
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
22335
22348
|
return new Alias(ref.anchor);
|
|
22336
22349
|
}
|
|
22337
22350
|
else {
|
|
@@ -22842,7 +22855,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22842
22855
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
22843
22856
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
22844
22857
|
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
22845
|
-
if (!blockQuote || /\n[\t ]+$/.test(value)
|
|
22858
|
+
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
22846
22859
|
return quotedString(value, ctx);
|
|
22847
22860
|
}
|
|
22848
22861
|
const indent = ctx.indent ||
|
|
@@ -22902,23 +22915,32 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22902
22915
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
22903
22916
|
}
|
|
22904
22917
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
22905
|
-
|
|
22918
|
+
// Leading | or > is added later
|
|
22919
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
22906
22920
|
if (comment) {
|
|
22907
22921
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
22908
22922
|
if (onComment)
|
|
22909
22923
|
onComment();
|
|
22910
22924
|
}
|
|
22911
|
-
if (literal) {
|
|
22912
|
-
|
|
22913
|
-
|
|
22925
|
+
if (!literal) {
|
|
22926
|
+
const foldedValue = value
|
|
22927
|
+
.replace(/\n+/g, '\n$&')
|
|
22928
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
22929
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
22930
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
22931
|
+
let literalFallback = false;
|
|
22932
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
22933
|
+
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
22934
|
+
foldOptions.onOverflow = () => {
|
|
22935
|
+
literalFallback = true;
|
|
22936
|
+
};
|
|
22937
|
+
}
|
|
22938
|
+
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
22939
|
+
if (!literalFallback)
|
|
22940
|
+
return `>${header}\n${indent}${body}`;
|
|
22914
22941
|
}
|
|
22915
|
-
value = value
|
|
22916
|
-
|
|
22917
|
-
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
22918
|
-
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
22919
|
-
.replace(/\n+/g, `$&${indent}`);
|
|
22920
|
-
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
22921
|
-
return `${header}\n${indent}${body}`;
|
|
22942
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
22943
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
22922
22944
|
}
|
|
22923
22945
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
22924
22946
|
const { type, value } = item;
|
|
@@ -22927,10 +22949,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22927
22949
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
22928
22950
|
return quotedString(value, ctx);
|
|
22929
22951
|
}
|
|
22930
|
-
if (
|
|
22931
|
-
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
22952
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
22932
22953
|
// not allowed:
|
|
22933
|
-
// -
|
|
22954
|
+
// - '-' or '?'
|
|
22934
22955
|
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
22935
22956
|
// - '\n ', ': ' or ' \n' anywhere
|
|
22936
22957
|
// - '#' not preceded by a non-space char
|
|
@@ -23059,7 +23080,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23059
23080
|
let obj;
|
|
23060
23081
|
if (isScalar$1(item)) {
|
|
23061
23082
|
obj = item.value;
|
|
23062
|
-
|
|
23083
|
+
let match = tags.filter(t => t.identify?.(obj));
|
|
23084
|
+
if (match.length > 1) {
|
|
23085
|
+
const testMatch = match.filter(t => t.test);
|
|
23086
|
+
if (testMatch.length > 0)
|
|
23087
|
+
match = testMatch;
|
|
23088
|
+
}
|
|
23063
23089
|
tagObj =
|
|
23064
23090
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
|
23065
23091
|
}
|
|
@@ -23068,7 +23094,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23068
23094
|
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
|
23069
23095
|
}
|
|
23070
23096
|
if (!tagObj) {
|
|
23071
|
-
const name = obj?.constructor?.name ?? typeof obj;
|
|
23097
|
+
const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
|
|
23072
23098
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
23073
23099
|
}
|
|
23074
23100
|
return tagObj;
|
|
@@ -23083,7 +23109,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23083
23109
|
anchors.add(anchor);
|
|
23084
23110
|
props.push(`&${anchor}`);
|
|
23085
23111
|
}
|
|
23086
|
-
const tag = node.tag
|
|
23112
|
+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
|
|
23087
23113
|
if (tag)
|
|
23088
23114
|
props.push(doc.directives.tagString(tag));
|
|
23089
23115
|
return props.join(' ');
|
|
@@ -23109,8 +23135,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23109
23135
|
const node = isNode(item)
|
|
23110
23136
|
? item
|
|
23111
23137
|
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
|
|
23112
|
-
|
|
23113
|
-
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
23138
|
+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
23114
23139
|
const props = stringifyProps(node, tagObj, ctx);
|
|
23115
23140
|
if (props.length > 0)
|
|
23116
23141
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
@@ -23272,54 +23297,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23272
23297
|
|
|
23273
23298
|
function warn(logLevel, warning) {
|
|
23274
23299
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
23275
|
-
|
|
23276
|
-
process.emitWarning(warning);
|
|
23277
|
-
else
|
|
23278
|
-
console.warn(warning);
|
|
23300
|
+
console.warn(warning);
|
|
23279
23301
|
}
|
|
23280
23302
|
}
|
|
23281
23303
|
|
|
23282
|
-
const MERGE_KEY = '<<';
|
|
23283
|
-
function addPairToJSMap(ctx, map, { key, value }) {
|
|
23284
|
-
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
|
23285
|
-
value = isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23286
|
-
if (isSeq(value))
|
|
23287
|
-
for (const it of value.items)
|
|
23288
|
-
mergeToJSMap(ctx, map, it);
|
|
23289
|
-
else if (Array.isArray(value))
|
|
23290
|
-
for (const it of value)
|
|
23291
|
-
mergeToJSMap(ctx, map, it);
|
|
23292
|
-
else
|
|
23293
|
-
mergeToJSMap(ctx, map, value);
|
|
23294
|
-
}
|
|
23295
|
-
else {
|
|
23296
|
-
const jsKey = toJS(key, '', ctx);
|
|
23297
|
-
if (map instanceof Map) {
|
|
23298
|
-
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
23299
|
-
}
|
|
23300
|
-
else if (map instanceof Set) {
|
|
23301
|
-
map.add(jsKey);
|
|
23302
|
-
}
|
|
23303
|
-
else {
|
|
23304
|
-
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
23305
|
-
const jsValue = toJS(value, stringKey, ctx);
|
|
23306
|
-
if (stringKey in map)
|
|
23307
|
-
Object.defineProperty(map, stringKey, {
|
|
23308
|
-
value: jsValue,
|
|
23309
|
-
writable: true,
|
|
23310
|
-
enumerable: true,
|
|
23311
|
-
configurable: true
|
|
23312
|
-
});
|
|
23313
|
-
else
|
|
23314
|
-
map[stringKey] = jsValue;
|
|
23315
|
-
}
|
|
23316
|
-
}
|
|
23317
|
-
return map;
|
|
23318
|
-
}
|
|
23319
|
-
const isMergeKey = (key) => key === MERGE_KEY ||
|
|
23320
|
-
(isScalar$1(key) &&
|
|
23321
|
-
key.value === MERGE_KEY &&
|
|
23322
|
-
(!key.type || key.type === Scalar.PLAIN));
|
|
23323
23304
|
// If the value associated with a merge key is a single mapping node, each of
|
|
23324
23305
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
23325
23306
|
// already exists in it. If the value associated with the merge key is a
|
|
@@ -23327,7 +23308,35 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23327
23308
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
23328
23309
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
23329
23310
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
23330
|
-
|
|
23311
|
+
const MERGE_KEY = '<<';
|
|
23312
|
+
const merge = {
|
|
23313
|
+
identify: value => value === MERGE_KEY ||
|
|
23314
|
+
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
23315
|
+
default: 'key',
|
|
23316
|
+
tag: 'tag:yaml.org,2002:merge',
|
|
23317
|
+
test: /^<<$/,
|
|
23318
|
+
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
|
|
23319
|
+
addToJSMap: addMergeToJSMap
|
|
23320
|
+
}),
|
|
23321
|
+
stringify: () => MERGE_KEY
|
|
23322
|
+
};
|
|
23323
|
+
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
23324
|
+
(isScalar$1(key) &&
|
|
23325
|
+
(!key.type || key.type === Scalar.PLAIN) &&
|
|
23326
|
+
merge.identify(key.value))) &&
|
|
23327
|
+
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
23328
|
+
function addMergeToJSMap(ctx, map, value) {
|
|
23329
|
+
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23330
|
+
if (isSeq(value))
|
|
23331
|
+
for (const it of value.items)
|
|
23332
|
+
mergeValue(ctx, map, it);
|
|
23333
|
+
else if (Array.isArray(value))
|
|
23334
|
+
for (const it of value)
|
|
23335
|
+
mergeValue(ctx, map, it);
|
|
23336
|
+
else
|
|
23337
|
+
mergeValue(ctx, map, value);
|
|
23338
|
+
}
|
|
23339
|
+
function mergeValue(ctx, map, value) {
|
|
23331
23340
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23332
23341
|
if (!isMap(source))
|
|
23333
23342
|
throw new Error('Merge sources must be maps or map aliases');
|
|
@@ -23351,9 +23360,41 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23351
23360
|
}
|
|
23352
23361
|
return map;
|
|
23353
23362
|
}
|
|
23363
|
+
|
|
23364
|
+
function addPairToJSMap(ctx, map, { key, value }) {
|
|
23365
|
+
if (isNode(key) && key.addToJSMap)
|
|
23366
|
+
key.addToJSMap(ctx, map, value);
|
|
23367
|
+
// TODO: Should drop this special case for bare << handling
|
|
23368
|
+
else if (isMergeKey(ctx, key))
|
|
23369
|
+
addMergeToJSMap(ctx, map, value);
|
|
23370
|
+
else {
|
|
23371
|
+
const jsKey = toJS(key, '', ctx);
|
|
23372
|
+
if (map instanceof Map) {
|
|
23373
|
+
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
23374
|
+
}
|
|
23375
|
+
else if (map instanceof Set) {
|
|
23376
|
+
map.add(jsKey);
|
|
23377
|
+
}
|
|
23378
|
+
else {
|
|
23379
|
+
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
23380
|
+
const jsValue = toJS(value, stringKey, ctx);
|
|
23381
|
+
if (stringKey in map)
|
|
23382
|
+
Object.defineProperty(map, stringKey, {
|
|
23383
|
+
value: jsValue,
|
|
23384
|
+
writable: true,
|
|
23385
|
+
enumerable: true,
|
|
23386
|
+
configurable: true
|
|
23387
|
+
});
|
|
23388
|
+
else
|
|
23389
|
+
map[stringKey] = jsValue;
|
|
23390
|
+
}
|
|
23391
|
+
}
|
|
23392
|
+
return map;
|
|
23393
|
+
}
|
|
23354
23394
|
function stringifyKey(key, jsKey, ctx) {
|
|
23355
23395
|
if (jsKey === null)
|
|
23356
23396
|
return '';
|
|
23397
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
23357
23398
|
if (typeof jsKey !== 'object')
|
|
23358
23399
|
return String(jsKey);
|
|
23359
23400
|
if (isNode(key) && ctx?.doc) {
|
|
@@ -23986,7 +24027,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23986
24027
|
identify: value => typeof value === 'boolean',
|
|
23987
24028
|
default: true,
|
|
23988
24029
|
tag: 'tag:yaml.org,2002:bool',
|
|
23989
|
-
test: /^true
|
|
24030
|
+
test: /^true$|^false$/,
|
|
23990
24031
|
resolve: str => str === 'true',
|
|
23991
24032
|
stringify: stringifyJSON
|
|
23992
24033
|
},
|
|
@@ -24031,10 +24072,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24031
24072
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
24032
24073
|
*/
|
|
24033
24074
|
resolve(src, onError) {
|
|
24034
|
-
if (typeof
|
|
24035
|
-
return Buffer.from(src, 'base64');
|
|
24036
|
-
}
|
|
24037
|
-
else if (typeof atob === 'function') {
|
|
24075
|
+
if (typeof atob === 'function') {
|
|
24038
24076
|
// On IE 11, atob() can't handle newlines
|
|
24039
24077
|
const str = atob(src.replace(/[\n\r]/g, ''));
|
|
24040
24078
|
const buffer = new Uint8Array(str.length);
|
|
@@ -24048,15 +24086,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24048
24086
|
}
|
|
24049
24087
|
},
|
|
24050
24088
|
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
24089
|
+
if (!value)
|
|
24090
|
+
return '';
|
|
24051
24091
|
const buf = value; // checked earlier by binary.identify()
|
|
24052
24092
|
let str;
|
|
24053
|
-
if (typeof
|
|
24054
|
-
str =
|
|
24055
|
-
buf instanceof Buffer
|
|
24056
|
-
? buf.toString('base64')
|
|
24057
|
-
: Buffer.from(buf.buffer).toString('base64');
|
|
24058
|
-
}
|
|
24059
|
-
else if (typeof btoa === 'function') {
|
|
24093
|
+
if (typeof btoa === 'function') {
|
|
24060
24094
|
let s = '';
|
|
24061
24095
|
for (let i = 0; i < buf.length; ++i)
|
|
24062
24096
|
s += String.fromCharCode(buf[i]);
|
|
@@ -24065,8 +24099,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24065
24099
|
else {
|
|
24066
24100
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
24067
24101
|
}
|
|
24068
|
-
|
|
24069
|
-
type = Scalar.BLOCK_LITERAL;
|
|
24102
|
+
type ?? (type = Scalar.BLOCK_LITERAL);
|
|
24070
24103
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
24071
24104
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
24072
24105
|
const n = Math.ceil(str.length / lineWidth);
|
|
@@ -24535,7 +24568,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24535
24568
|
}
|
|
24536
24569
|
return new Date(date);
|
|
24537
24570
|
},
|
|
24538
|
-
stringify: ({ value }) => value
|
|
24571
|
+
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
|
|
24539
24572
|
};
|
|
24540
24573
|
|
|
24541
24574
|
const schema = [
|
|
@@ -24553,6 +24586,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24553
24586
|
floatExp,
|
|
24554
24587
|
float,
|
|
24555
24588
|
binary,
|
|
24589
|
+
merge,
|
|
24556
24590
|
omap,
|
|
24557
24591
|
pairs,
|
|
24558
24592
|
set,
|
|
@@ -24580,6 +24614,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24580
24614
|
intOct: intOct$1,
|
|
24581
24615
|
intTime,
|
|
24582
24616
|
map,
|
|
24617
|
+
merge,
|
|
24583
24618
|
null: nullTag,
|
|
24584
24619
|
omap,
|
|
24585
24620
|
pairs,
|
|
@@ -24589,13 +24624,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24589
24624
|
};
|
|
24590
24625
|
const coreKnownTags = {
|
|
24591
24626
|
'tag:yaml.org,2002:binary': binary,
|
|
24627
|
+
'tag:yaml.org,2002:merge': merge,
|
|
24592
24628
|
'tag:yaml.org,2002:omap': omap,
|
|
24593
24629
|
'tag:yaml.org,2002:pairs': pairs,
|
|
24594
24630
|
'tag:yaml.org,2002:set': set,
|
|
24595
24631
|
'tag:yaml.org,2002:timestamp': timestamp
|
|
24596
24632
|
};
|
|
24597
|
-
function getTags(customTags, schemaName) {
|
|
24598
|
-
|
|
24633
|
+
function getTags(customTags, schemaName, addMergeTag) {
|
|
24634
|
+
const schemaTags = schemas.get(schemaName);
|
|
24635
|
+
if (schemaTags && !customTags) {
|
|
24636
|
+
return addMergeTag && !schemaTags.includes(merge)
|
|
24637
|
+
? schemaTags.concat(merge)
|
|
24638
|
+
: schemaTags.slice();
|
|
24639
|
+
}
|
|
24640
|
+
let tags = schemaTags;
|
|
24599
24641
|
if (!tags) {
|
|
24600
24642
|
if (Array.isArray(customTags))
|
|
24601
24643
|
tags = [];
|
|
@@ -24614,17 +24656,21 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24614
24656
|
else if (typeof customTags === 'function') {
|
|
24615
24657
|
tags = customTags(tags.slice());
|
|
24616
24658
|
}
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
const tagObj = tagsByName[tag];
|
|
24621
|
-
if (tagObj)
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24659
|
+
if (addMergeTag)
|
|
24660
|
+
tags = tags.concat(merge);
|
|
24661
|
+
return tags.reduce((tags, tag) => {
|
|
24662
|
+
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
|
24663
|
+
if (!tagObj) {
|
|
24664
|
+
const tagName = JSON.stringify(tag);
|
|
24665
|
+
const keys = Object.keys(tagsByName)
|
|
24666
|
+
.map(key => JSON.stringify(key))
|
|
24667
|
+
.join(', ');
|
|
24668
|
+
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
24669
|
+
}
|
|
24670
|
+
if (!tags.includes(tagObj))
|
|
24671
|
+
tags.push(tagObj);
|
|
24672
|
+
return tags;
|
|
24673
|
+
}, []);
|
|
24628
24674
|
}
|
|
24629
24675
|
|
|
24630
24676
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
@@ -24635,10 +24681,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24635
24681
|
: compat
|
|
24636
24682
|
? getTags(null, compat)
|
|
24637
24683
|
: null;
|
|
24638
|
-
this.merge = !!merge;
|
|
24639
24684
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
24640
24685
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
24641
|
-
this.tags = getTags(customTags, this.name);
|
|
24686
|
+
this.tags = getTags(customTags, this.name, merge);
|
|
24642
24687
|
this.toStringOptions = toStringDefaults ?? null;
|
|
24643
24688
|
Object.defineProperty(this, MAP, { value: map });
|
|
24644
24689
|
Object.defineProperty(this, SCALAR$1, { value: string });
|
|
@@ -24763,6 +24808,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24763
24808
|
logLevel: 'warn',
|
|
24764
24809
|
prettyErrors: true,
|
|
24765
24810
|
strict: true,
|
|
24811
|
+
stringKeys: false,
|
|
24766
24812
|
uniqueKeys: true,
|
|
24767
24813
|
version: '1.2'
|
|
24768
24814
|
}, options);
|
|
@@ -24986,7 +25032,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24986
25032
|
this.directives.yaml.version = '1.1';
|
|
24987
25033
|
else
|
|
24988
25034
|
this.directives = new Directives({ version: '1.1' });
|
|
24989
|
-
opt = {
|
|
25035
|
+
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
24990
25036
|
break;
|
|
24991
25037
|
case '1.2':
|
|
24992
25038
|
case 'next':
|
|
@@ -24994,7 +25040,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24994
25040
|
this.directives.yaml.version = version;
|
|
24995
25041
|
else
|
|
24996
25042
|
this.directives = new Directives({ version });
|
|
24997
|
-
opt = {
|
|
25043
|
+
opt = { resolveKnownTags: true, schema: 'core' };
|
|
24998
25044
|
break;
|
|
24999
25045
|
case null:
|
|
25000
25046
|
if (this.directives)
|
|
@@ -25172,7 +25218,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25172
25218
|
if (atNewline) {
|
|
25173
25219
|
if (comment)
|
|
25174
25220
|
comment += token.source;
|
|
25175
|
-
else
|
|
25221
|
+
else if (!found || indicator !== 'seq-item-ind')
|
|
25176
25222
|
spaceBefore = true;
|
|
25177
25223
|
}
|
|
25178
25224
|
else
|
|
@@ -25189,8 +25235,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25189
25235
|
if (token.source.endsWith(':'))
|
|
25190
25236
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
25191
25237
|
anchor = token;
|
|
25192
|
-
|
|
25193
|
-
start = token.offset;
|
|
25238
|
+
start ?? (start = token.offset);
|
|
25194
25239
|
atNewline = false;
|
|
25195
25240
|
hasSpace = false;
|
|
25196
25241
|
reqSpace = true;
|
|
@@ -25199,8 +25244,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25199
25244
|
if (tag)
|
|
25200
25245
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
25201
25246
|
tag = token;
|
|
25202
|
-
|
|
25203
|
-
start = token.offset;
|
|
25247
|
+
start ?? (start = token.offset);
|
|
25204
25248
|
atNewline = false;
|
|
25205
25249
|
hasSpace = false;
|
|
25206
25250
|
reqSpace = true;
|
|
@@ -25313,11 +25357,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25313
25357
|
return false;
|
|
25314
25358
|
const isEqual = typeof uniqueKeys === 'function'
|
|
25315
25359
|
? uniqueKeys
|
|
25316
|
-
: (a, b) => a === b ||
|
|
25317
|
-
(isScalar$1(a) &&
|
|
25318
|
-
isScalar$1(b) &&
|
|
25319
|
-
a.value === b.value &&
|
|
25320
|
-
!(a.value === '<<' && ctx.schema.merge));
|
|
25360
|
+
: (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
|
|
25321
25361
|
return items.some(pair => isEqual(pair.key, search));
|
|
25322
25362
|
}
|
|
25323
25363
|
|
|
@@ -25366,12 +25406,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25366
25406
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
25367
25407
|
}
|
|
25368
25408
|
// key value
|
|
25409
|
+
ctx.atKey = true;
|
|
25369
25410
|
const keyStart = keyProps.end;
|
|
25370
25411
|
const keyNode = key
|
|
25371
25412
|
? composeNode(ctx, key, keyProps, onError)
|
|
25372
25413
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
25373
25414
|
if (ctx.schema.compat)
|
|
25374
25415
|
flowIndentCheck(bm.indent, key, onError);
|
|
25416
|
+
ctx.atKey = false;
|
|
25375
25417
|
if (mapIncludes(ctx, map.items, keyNode))
|
|
25376
25418
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
25377
25419
|
// value properties
|
|
@@ -25431,6 +25473,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25431
25473
|
const seq = new NodeClass(ctx.schema);
|
|
25432
25474
|
if (ctx.atRoot)
|
|
25433
25475
|
ctx.atRoot = false;
|
|
25476
|
+
if (ctx.atKey)
|
|
25477
|
+
ctx.atKey = false;
|
|
25434
25478
|
let offset = bs.offset;
|
|
25435
25479
|
let commentEnd = null;
|
|
25436
25480
|
for (const { start, value } of bs.items) {
|
|
@@ -25515,6 +25559,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25515
25559
|
const atRoot = ctx.atRoot;
|
|
25516
25560
|
if (atRoot)
|
|
25517
25561
|
ctx.atRoot = false;
|
|
25562
|
+
if (ctx.atKey)
|
|
25563
|
+
ctx.atKey = false;
|
|
25518
25564
|
let offset = fc.offset + fc.start.source.length;
|
|
25519
25565
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
25520
25566
|
const collItem = fc.items[i];
|
|
@@ -25594,12 +25640,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25594
25640
|
else {
|
|
25595
25641
|
// item is a key+value pair
|
|
25596
25642
|
// key value
|
|
25643
|
+
ctx.atKey = true;
|
|
25597
25644
|
const keyStart = props.end;
|
|
25598
25645
|
const keyNode = key
|
|
25599
25646
|
? composeNode(ctx, key, props, onError)
|
|
25600
25647
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
25601
25648
|
if (isBlock(key))
|
|
25602
25649
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
25650
|
+
ctx.atKey = false;
|
|
25603
25651
|
// value properties
|
|
25604
25652
|
const valueProps = resolveProps(sep ?? [], {
|
|
25605
25653
|
flow: fcName,
|
|
@@ -25755,8 +25803,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25755
25803
|
tag = kt;
|
|
25756
25804
|
}
|
|
25757
25805
|
else {
|
|
25758
|
-
if (kt
|
|
25759
|
-
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
25806
|
+
if (kt) {
|
|
25807
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
|
|
25760
25808
|
}
|
|
25761
25809
|
else {
|
|
25762
25810
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
@@ -26197,11 +26245,16 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26197
26245
|
const tagName = tagToken
|
|
26198
26246
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
26199
26247
|
: null;
|
|
26200
|
-
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26204
|
-
|
|
26248
|
+
let tag;
|
|
26249
|
+
if (ctx.options.stringKeys && ctx.atKey) {
|
|
26250
|
+
tag = ctx.schema[SCALAR$1];
|
|
26251
|
+
}
|
|
26252
|
+
else if (tagName)
|
|
26253
|
+
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
26254
|
+
else if (token.type === 'scalar')
|
|
26255
|
+
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
26256
|
+
else
|
|
26257
|
+
tag = ctx.schema[SCALAR$1];
|
|
26205
26258
|
let scalar;
|
|
26206
26259
|
try {
|
|
26207
26260
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
@@ -26249,8 +26302,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26249
26302
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
26250
26303
|
return schema[SCALAR$1];
|
|
26251
26304
|
}
|
|
26252
|
-
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
26253
|
-
const tag = schema.tags.find(tag => tag.default && tag.
|
|
26305
|
+
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
26306
|
+
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
|
|
26307
|
+
tag.test?.test(value)) || schema[SCALAR$1];
|
|
26254
26308
|
if (schema.compat) {
|
|
26255
26309
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
26256
26310
|
schema[SCALAR$1];
|
|
@@ -26266,8 +26320,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26266
26320
|
|
|
26267
26321
|
function emptyScalarPosition(offset, before, pos) {
|
|
26268
26322
|
if (before) {
|
|
26269
|
-
|
|
26270
|
-
pos = before.length;
|
|
26323
|
+
pos ?? (pos = before.length);
|
|
26271
26324
|
for (let i = pos - 1; i >= 0; --i) {
|
|
26272
26325
|
let st = before[i];
|
|
26273
26326
|
switch (st.type) {
|
|
@@ -26292,6 +26345,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26292
26345
|
|
|
26293
26346
|
const CN = { composeNode, composeEmptyNode };
|
|
26294
26347
|
function composeNode(ctx, token, props, onError) {
|
|
26348
|
+
const atKey = ctx.atKey;
|
|
26295
26349
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
26296
26350
|
let node;
|
|
26297
26351
|
let isSrcToken = true;
|
|
@@ -26327,6 +26381,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26327
26381
|
}
|
|
26328
26382
|
if (anchor && node.anchor === '')
|
|
26329
26383
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
|
26384
|
+
if (atKey &&
|
|
26385
|
+
ctx.options.stringKeys &&
|
|
26386
|
+
(!isScalar$1(node) ||
|
|
26387
|
+
typeof node.value !== 'string' ||
|
|
26388
|
+
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
26389
|
+
const msg = 'With stringKeys, all keys must be strings';
|
|
26390
|
+
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
26391
|
+
}
|
|
26330
26392
|
if (spaceBefore)
|
|
26331
26393
|
node.spaceBefore = true;
|
|
26332
26394
|
if (comment) {
|
|
@@ -26379,6 +26441,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26379
26441
|
const opts = Object.assign({ _directives: directives }, options);
|
|
26380
26442
|
const doc = new Document(undefined, opts);
|
|
26381
26443
|
const ctx = {
|
|
26444
|
+
atKey: false,
|
|
26382
26445
|
atRoot: true,
|
|
26383
26446
|
directives: doc.directives,
|
|
26384
26447
|
options: doc.options,
|
|
@@ -28513,7 +28576,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28513
28576
|
default: {
|
|
28514
28577
|
const bv = this.startBlockValue(map);
|
|
28515
28578
|
if (bv) {
|
|
28516
|
-
if (
|
|
28579
|
+
if (bv.type === 'block-seq') {
|
|
28580
|
+
if (!it.explicitKey &&
|
|
28581
|
+
it.sep &&
|
|
28582
|
+
!includesToken(it.sep, 'newline')) {
|
|
28583
|
+
yield* this.pop({
|
|
28584
|
+
type: 'error',
|
|
28585
|
+
offset: this.offset,
|
|
28586
|
+
message: 'Unexpected block-seq-ind on same line with key',
|
|
28587
|
+
source: this.source
|
|
28588
|
+
});
|
|
28589
|
+
return;
|
|
28590
|
+
}
|
|
28591
|
+
}
|
|
28592
|
+
else if (atMapIndent) {
|
|
28517
28593
|
map.items.push({ start });
|
|
28518
28594
|
}
|
|
28519
28595
|
this.stack.push(bv);
|
|
@@ -28884,6 +28960,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28884
28960
|
if (!keepUndefined)
|
|
28885
28961
|
return undefined;
|
|
28886
28962
|
}
|
|
28963
|
+
if (isDocument(value) && !_replacer)
|
|
28964
|
+
return value.toString(options);
|
|
28887
28965
|
return new Document(value, _replacer, options).toString(options);
|
|
28888
28966
|
}
|
|
28889
28967
|
|