@thoughtspot/visual-embed-sdk 1.42.1-alpha.3 → 1.42.1-alpha.4
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/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-DhFH7b7U.js +7447 -0
- 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 +3 -3
- package/dist/tsembed-react.js +223 -147
- package/dist/tsembed.es.js +3 -3
- package/dist/tsembed.js +223 -147
- package/lib/package.json +1 -2
- 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/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.4 */
|
|
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.4";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.
|
|
@@ -22030,8 +22030,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22030
22030
|
return {
|
|
22031
22031
|
onAnchor: (source) => {
|
|
22032
22032
|
aliasObjects.push(source);
|
|
22033
|
-
|
|
22034
|
-
prevAnchors = anchorNames(doc);
|
|
22033
|
+
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
22035
22034
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
22036
22035
|
prevAnchors.add(anchor);
|
|
22037
22036
|
return anchor;
|
|
@@ -22195,23 +22194,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22195
22194
|
* Resolve the value of this alias within `doc`, finding the last
|
|
22196
22195
|
* instance of the `source` anchor before this node.
|
|
22197
22196
|
*/
|
|
22198
|
-
resolve(doc) {
|
|
22197
|
+
resolve(doc, ctx) {
|
|
22198
|
+
let nodes;
|
|
22199
|
+
if (ctx?.aliasResolveCache) {
|
|
22200
|
+
nodes = ctx.aliasResolveCache;
|
|
22201
|
+
}
|
|
22202
|
+
else {
|
|
22203
|
+
nodes = [];
|
|
22204
|
+
visit$1(doc, {
|
|
22205
|
+
Node: (_key, node) => {
|
|
22206
|
+
if (isAlias(node) || hasAnchor(node))
|
|
22207
|
+
nodes.push(node);
|
|
22208
|
+
}
|
|
22209
|
+
});
|
|
22210
|
+
if (ctx)
|
|
22211
|
+
ctx.aliasResolveCache = nodes;
|
|
22212
|
+
}
|
|
22199
22213
|
let found = undefined;
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
}
|
|
22207
|
-
});
|
|
22214
|
+
for (const node of nodes) {
|
|
22215
|
+
if (node === this)
|
|
22216
|
+
break;
|
|
22217
|
+
if (node.anchor === this.source)
|
|
22218
|
+
found = node;
|
|
22219
|
+
}
|
|
22208
22220
|
return found;
|
|
22209
22221
|
}
|
|
22210
22222
|
toJSON(_arg, ctx) {
|
|
22211
22223
|
if (!ctx)
|
|
22212
22224
|
return { source: this.source };
|
|
22213
22225
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
22214
|
-
const source = this.resolve(doc);
|
|
22226
|
+
const source = this.resolve(doc, ctx);
|
|
22215
22227
|
if (!source) {
|
|
22216
22228
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
22217
22229
|
throw new ReferenceError(msg);
|
|
@@ -22330,8 +22342,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22330
22342
|
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
22331
22343
|
ref = sourceObjects.get(value);
|
|
22332
22344
|
if (ref) {
|
|
22333
|
-
|
|
22334
|
-
ref.anchor = onAnchor(value);
|
|
22345
|
+
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
22335
22346
|
return new Alias(ref.anchor);
|
|
22336
22347
|
}
|
|
22337
22348
|
else {
|
|
@@ -22842,7 +22853,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22842
22853
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
22843
22854
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
22844
22855
|
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
22845
|
-
if (!blockQuote || /\n[\t ]+$/.test(value)
|
|
22856
|
+
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
22846
22857
|
return quotedString(value, ctx);
|
|
22847
22858
|
}
|
|
22848
22859
|
const indent = ctx.indent ||
|
|
@@ -22902,23 +22913,32 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22902
22913
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
22903
22914
|
}
|
|
22904
22915
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
22905
|
-
|
|
22916
|
+
// Leading | or > is added later
|
|
22917
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
22906
22918
|
if (comment) {
|
|
22907
22919
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
22908
22920
|
if (onComment)
|
|
22909
22921
|
onComment();
|
|
22910
22922
|
}
|
|
22911
|
-
if (literal) {
|
|
22912
|
-
|
|
22913
|
-
|
|
22923
|
+
if (!literal) {
|
|
22924
|
+
const foldedValue = value
|
|
22925
|
+
.replace(/\n+/g, '\n$&')
|
|
22926
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
22927
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
22928
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
22929
|
+
let literalFallback = false;
|
|
22930
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
22931
|
+
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
22932
|
+
foldOptions.onOverflow = () => {
|
|
22933
|
+
literalFallback = true;
|
|
22934
|
+
};
|
|
22935
|
+
}
|
|
22936
|
+
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
22937
|
+
if (!literalFallback)
|
|
22938
|
+
return `>${header}\n${indent}${body}`;
|
|
22914
22939
|
}
|
|
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}`;
|
|
22940
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
22941
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
22922
22942
|
}
|
|
22923
22943
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
22924
22944
|
const { type, value } = item;
|
|
@@ -22927,10 +22947,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
22927
22947
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
22928
22948
|
return quotedString(value, ctx);
|
|
22929
22949
|
}
|
|
22930
|
-
if (
|
|
22931
|
-
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
22950
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
22932
22951
|
// not allowed:
|
|
22933
|
-
// -
|
|
22952
|
+
// - '-' or '?'
|
|
22934
22953
|
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
22935
22954
|
// - '\n ', ': ' or ' \n' anywhere
|
|
22936
22955
|
// - '#' not preceded by a non-space char
|
|
@@ -23059,7 +23078,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23059
23078
|
let obj;
|
|
23060
23079
|
if (isScalar$1(item)) {
|
|
23061
23080
|
obj = item.value;
|
|
23062
|
-
|
|
23081
|
+
let match = tags.filter(t => t.identify?.(obj));
|
|
23082
|
+
if (match.length > 1) {
|
|
23083
|
+
const testMatch = match.filter(t => t.test);
|
|
23084
|
+
if (testMatch.length > 0)
|
|
23085
|
+
match = testMatch;
|
|
23086
|
+
}
|
|
23063
23087
|
tagObj =
|
|
23064
23088
|
match.find(t => t.format === item.format) ?? match.find(t => !t.format);
|
|
23065
23089
|
}
|
|
@@ -23068,7 +23092,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23068
23092
|
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
|
23069
23093
|
}
|
|
23070
23094
|
if (!tagObj) {
|
|
23071
|
-
const name = obj?.constructor?.name ?? typeof obj;
|
|
23095
|
+
const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
|
|
23072
23096
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
23073
23097
|
}
|
|
23074
23098
|
return tagObj;
|
|
@@ -23083,7 +23107,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23083
23107
|
anchors.add(anchor);
|
|
23084
23108
|
props.push(`&${anchor}`);
|
|
23085
23109
|
}
|
|
23086
|
-
const tag = node.tag
|
|
23110
|
+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
|
|
23087
23111
|
if (tag)
|
|
23088
23112
|
props.push(doc.directives.tagString(tag));
|
|
23089
23113
|
return props.join(' ');
|
|
@@ -23109,8 +23133,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23109
23133
|
const node = isNode(item)
|
|
23110
23134
|
? item
|
|
23111
23135
|
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
|
|
23112
|
-
|
|
23113
|
-
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
23136
|
+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
23114
23137
|
const props = stringifyProps(node, tagObj, ctx);
|
|
23115
23138
|
if (props.length > 0)
|
|
23116
23139
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
@@ -23272,54 +23295,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23272
23295
|
|
|
23273
23296
|
function warn(logLevel, warning) {
|
|
23274
23297
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
23275
|
-
|
|
23276
|
-
process.emitWarning(warning);
|
|
23277
|
-
else
|
|
23278
|
-
console.warn(warning);
|
|
23298
|
+
console.warn(warning);
|
|
23279
23299
|
}
|
|
23280
23300
|
}
|
|
23281
23301
|
|
|
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
23302
|
// If the value associated with a merge key is a single mapping node, each of
|
|
23324
23303
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
23325
23304
|
// already exists in it. If the value associated with the merge key is a
|
|
@@ -23327,7 +23306,35 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23327
23306
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
23328
23307
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
23329
23308
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
23330
|
-
|
|
23309
|
+
const MERGE_KEY = '<<';
|
|
23310
|
+
const merge = {
|
|
23311
|
+
identify: value => value === MERGE_KEY ||
|
|
23312
|
+
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
23313
|
+
default: 'key',
|
|
23314
|
+
tag: 'tag:yaml.org,2002:merge',
|
|
23315
|
+
test: /^<<$/,
|
|
23316
|
+
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
|
|
23317
|
+
addToJSMap: addMergeToJSMap
|
|
23318
|
+
}),
|
|
23319
|
+
stringify: () => MERGE_KEY
|
|
23320
|
+
};
|
|
23321
|
+
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
23322
|
+
(isScalar$1(key) &&
|
|
23323
|
+
(!key.type || key.type === Scalar.PLAIN) &&
|
|
23324
|
+
merge.identify(key.value))) &&
|
|
23325
|
+
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
23326
|
+
function addMergeToJSMap(ctx, map, value) {
|
|
23327
|
+
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23328
|
+
if (isSeq(value))
|
|
23329
|
+
for (const it of value.items)
|
|
23330
|
+
mergeValue(ctx, map, it);
|
|
23331
|
+
else if (Array.isArray(value))
|
|
23332
|
+
for (const it of value)
|
|
23333
|
+
mergeValue(ctx, map, it);
|
|
23334
|
+
else
|
|
23335
|
+
mergeValue(ctx, map, value);
|
|
23336
|
+
}
|
|
23337
|
+
function mergeValue(ctx, map, value) {
|
|
23331
23338
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
23332
23339
|
if (!isMap(source))
|
|
23333
23340
|
throw new Error('Merge sources must be maps or map aliases');
|
|
@@ -23351,9 +23358,41 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23351
23358
|
}
|
|
23352
23359
|
return map;
|
|
23353
23360
|
}
|
|
23361
|
+
|
|
23362
|
+
function addPairToJSMap(ctx, map, { key, value }) {
|
|
23363
|
+
if (isNode(key) && key.addToJSMap)
|
|
23364
|
+
key.addToJSMap(ctx, map, value);
|
|
23365
|
+
// TODO: Should drop this special case for bare << handling
|
|
23366
|
+
else if (isMergeKey(ctx, key))
|
|
23367
|
+
addMergeToJSMap(ctx, map, value);
|
|
23368
|
+
else {
|
|
23369
|
+
const jsKey = toJS(key, '', ctx);
|
|
23370
|
+
if (map instanceof Map) {
|
|
23371
|
+
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
23372
|
+
}
|
|
23373
|
+
else if (map instanceof Set) {
|
|
23374
|
+
map.add(jsKey);
|
|
23375
|
+
}
|
|
23376
|
+
else {
|
|
23377
|
+
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
23378
|
+
const jsValue = toJS(value, stringKey, ctx);
|
|
23379
|
+
if (stringKey in map)
|
|
23380
|
+
Object.defineProperty(map, stringKey, {
|
|
23381
|
+
value: jsValue,
|
|
23382
|
+
writable: true,
|
|
23383
|
+
enumerable: true,
|
|
23384
|
+
configurable: true
|
|
23385
|
+
});
|
|
23386
|
+
else
|
|
23387
|
+
map[stringKey] = jsValue;
|
|
23388
|
+
}
|
|
23389
|
+
}
|
|
23390
|
+
return map;
|
|
23391
|
+
}
|
|
23354
23392
|
function stringifyKey(key, jsKey, ctx) {
|
|
23355
23393
|
if (jsKey === null)
|
|
23356
23394
|
return '';
|
|
23395
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
23357
23396
|
if (typeof jsKey !== 'object')
|
|
23358
23397
|
return String(jsKey);
|
|
23359
23398
|
if (isNode(key) && ctx?.doc) {
|
|
@@ -23986,7 +24025,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
23986
24025
|
identify: value => typeof value === 'boolean',
|
|
23987
24026
|
default: true,
|
|
23988
24027
|
tag: 'tag:yaml.org,2002:bool',
|
|
23989
|
-
test: /^true
|
|
24028
|
+
test: /^true$|^false$/,
|
|
23990
24029
|
resolve: str => str === 'true',
|
|
23991
24030
|
stringify: stringifyJSON
|
|
23992
24031
|
},
|
|
@@ -24031,10 +24070,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24031
24070
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
24032
24071
|
*/
|
|
24033
24072
|
resolve(src, onError) {
|
|
24034
|
-
if (typeof
|
|
24035
|
-
return Buffer.from(src, 'base64');
|
|
24036
|
-
}
|
|
24037
|
-
else if (typeof atob === 'function') {
|
|
24073
|
+
if (typeof atob === 'function') {
|
|
24038
24074
|
// On IE 11, atob() can't handle newlines
|
|
24039
24075
|
const str = atob(src.replace(/[\n\r]/g, ''));
|
|
24040
24076
|
const buffer = new Uint8Array(str.length);
|
|
@@ -24048,15 +24084,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24048
24084
|
}
|
|
24049
24085
|
},
|
|
24050
24086
|
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
24087
|
+
if (!value)
|
|
24088
|
+
return '';
|
|
24051
24089
|
const buf = value; // checked earlier by binary.identify()
|
|
24052
24090
|
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') {
|
|
24091
|
+
if (typeof btoa === 'function') {
|
|
24060
24092
|
let s = '';
|
|
24061
24093
|
for (let i = 0; i < buf.length; ++i)
|
|
24062
24094
|
s += String.fromCharCode(buf[i]);
|
|
@@ -24065,8 +24097,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24065
24097
|
else {
|
|
24066
24098
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
24067
24099
|
}
|
|
24068
|
-
|
|
24069
|
-
type = Scalar.BLOCK_LITERAL;
|
|
24100
|
+
type ?? (type = Scalar.BLOCK_LITERAL);
|
|
24070
24101
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
24071
24102
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
24072
24103
|
const n = Math.ceil(str.length / lineWidth);
|
|
@@ -24535,7 +24566,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24535
24566
|
}
|
|
24536
24567
|
return new Date(date);
|
|
24537
24568
|
},
|
|
24538
|
-
stringify: ({ value }) => value
|
|
24569
|
+
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
|
|
24539
24570
|
};
|
|
24540
24571
|
|
|
24541
24572
|
const schema = [
|
|
@@ -24553,6 +24584,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24553
24584
|
floatExp,
|
|
24554
24585
|
float,
|
|
24555
24586
|
binary,
|
|
24587
|
+
merge,
|
|
24556
24588
|
omap,
|
|
24557
24589
|
pairs,
|
|
24558
24590
|
set,
|
|
@@ -24580,6 +24612,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24580
24612
|
intOct: intOct$1,
|
|
24581
24613
|
intTime,
|
|
24582
24614
|
map,
|
|
24615
|
+
merge,
|
|
24583
24616
|
null: nullTag,
|
|
24584
24617
|
omap,
|
|
24585
24618
|
pairs,
|
|
@@ -24589,13 +24622,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24589
24622
|
};
|
|
24590
24623
|
const coreKnownTags = {
|
|
24591
24624
|
'tag:yaml.org,2002:binary': binary,
|
|
24625
|
+
'tag:yaml.org,2002:merge': merge,
|
|
24592
24626
|
'tag:yaml.org,2002:omap': omap,
|
|
24593
24627
|
'tag:yaml.org,2002:pairs': pairs,
|
|
24594
24628
|
'tag:yaml.org,2002:set': set,
|
|
24595
24629
|
'tag:yaml.org,2002:timestamp': timestamp
|
|
24596
24630
|
};
|
|
24597
|
-
function getTags(customTags, schemaName) {
|
|
24598
|
-
|
|
24631
|
+
function getTags(customTags, schemaName, addMergeTag) {
|
|
24632
|
+
const schemaTags = schemas.get(schemaName);
|
|
24633
|
+
if (schemaTags && !customTags) {
|
|
24634
|
+
return addMergeTag && !schemaTags.includes(merge)
|
|
24635
|
+
? schemaTags.concat(merge)
|
|
24636
|
+
: schemaTags.slice();
|
|
24637
|
+
}
|
|
24638
|
+
let tags = schemaTags;
|
|
24599
24639
|
if (!tags) {
|
|
24600
24640
|
if (Array.isArray(customTags))
|
|
24601
24641
|
tags = [];
|
|
@@ -24614,17 +24654,21 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24614
24654
|
else if (typeof customTags === 'function') {
|
|
24615
24655
|
tags = customTags(tags.slice());
|
|
24616
24656
|
}
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
const tagObj = tagsByName[tag];
|
|
24621
|
-
if (tagObj)
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24657
|
+
if (addMergeTag)
|
|
24658
|
+
tags = tags.concat(merge);
|
|
24659
|
+
return tags.reduce((tags, tag) => {
|
|
24660
|
+
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
|
24661
|
+
if (!tagObj) {
|
|
24662
|
+
const tagName = JSON.stringify(tag);
|
|
24663
|
+
const keys = Object.keys(tagsByName)
|
|
24664
|
+
.map(key => JSON.stringify(key))
|
|
24665
|
+
.join(', ');
|
|
24666
|
+
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
24667
|
+
}
|
|
24668
|
+
if (!tags.includes(tagObj))
|
|
24669
|
+
tags.push(tagObj);
|
|
24670
|
+
return tags;
|
|
24671
|
+
}, []);
|
|
24628
24672
|
}
|
|
24629
24673
|
|
|
24630
24674
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
@@ -24635,10 +24679,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24635
24679
|
: compat
|
|
24636
24680
|
? getTags(null, compat)
|
|
24637
24681
|
: null;
|
|
24638
|
-
this.merge = !!merge;
|
|
24639
24682
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
24640
24683
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
24641
|
-
this.tags = getTags(customTags, this.name);
|
|
24684
|
+
this.tags = getTags(customTags, this.name, merge);
|
|
24642
24685
|
this.toStringOptions = toStringDefaults ?? null;
|
|
24643
24686
|
Object.defineProperty(this, MAP, { value: map });
|
|
24644
24687
|
Object.defineProperty(this, SCALAR$1, { value: string });
|
|
@@ -24763,6 +24806,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24763
24806
|
logLevel: 'warn',
|
|
24764
24807
|
prettyErrors: true,
|
|
24765
24808
|
strict: true,
|
|
24809
|
+
stringKeys: false,
|
|
24766
24810
|
uniqueKeys: true,
|
|
24767
24811
|
version: '1.2'
|
|
24768
24812
|
}, options);
|
|
@@ -24986,7 +25030,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24986
25030
|
this.directives.yaml.version = '1.1';
|
|
24987
25031
|
else
|
|
24988
25032
|
this.directives = new Directives({ version: '1.1' });
|
|
24989
|
-
opt = {
|
|
25033
|
+
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
24990
25034
|
break;
|
|
24991
25035
|
case '1.2':
|
|
24992
25036
|
case 'next':
|
|
@@ -24994,7 +25038,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
24994
25038
|
this.directives.yaml.version = version;
|
|
24995
25039
|
else
|
|
24996
25040
|
this.directives = new Directives({ version });
|
|
24997
|
-
opt = {
|
|
25041
|
+
opt = { resolveKnownTags: true, schema: 'core' };
|
|
24998
25042
|
break;
|
|
24999
25043
|
case null:
|
|
25000
25044
|
if (this.directives)
|
|
@@ -25172,7 +25216,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25172
25216
|
if (atNewline) {
|
|
25173
25217
|
if (comment)
|
|
25174
25218
|
comment += token.source;
|
|
25175
|
-
else
|
|
25219
|
+
else if (!found || indicator !== 'seq-item-ind')
|
|
25176
25220
|
spaceBefore = true;
|
|
25177
25221
|
}
|
|
25178
25222
|
else
|
|
@@ -25189,8 +25233,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25189
25233
|
if (token.source.endsWith(':'))
|
|
25190
25234
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
25191
25235
|
anchor = token;
|
|
25192
|
-
|
|
25193
|
-
start = token.offset;
|
|
25236
|
+
start ?? (start = token.offset);
|
|
25194
25237
|
atNewline = false;
|
|
25195
25238
|
hasSpace = false;
|
|
25196
25239
|
reqSpace = true;
|
|
@@ -25199,8 +25242,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25199
25242
|
if (tag)
|
|
25200
25243
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
25201
25244
|
tag = token;
|
|
25202
|
-
|
|
25203
|
-
start = token.offset;
|
|
25245
|
+
start ?? (start = token.offset);
|
|
25204
25246
|
atNewline = false;
|
|
25205
25247
|
hasSpace = false;
|
|
25206
25248
|
reqSpace = true;
|
|
@@ -25313,11 +25355,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25313
25355
|
return false;
|
|
25314
25356
|
const isEqual = typeof uniqueKeys === 'function'
|
|
25315
25357
|
? 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));
|
|
25358
|
+
: (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
|
|
25321
25359
|
return items.some(pair => isEqual(pair.key, search));
|
|
25322
25360
|
}
|
|
25323
25361
|
|
|
@@ -25366,12 +25404,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25366
25404
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
25367
25405
|
}
|
|
25368
25406
|
// key value
|
|
25407
|
+
ctx.atKey = true;
|
|
25369
25408
|
const keyStart = keyProps.end;
|
|
25370
25409
|
const keyNode = key
|
|
25371
25410
|
? composeNode(ctx, key, keyProps, onError)
|
|
25372
25411
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
25373
25412
|
if (ctx.schema.compat)
|
|
25374
25413
|
flowIndentCheck(bm.indent, key, onError);
|
|
25414
|
+
ctx.atKey = false;
|
|
25375
25415
|
if (mapIncludes(ctx, map.items, keyNode))
|
|
25376
25416
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
25377
25417
|
// value properties
|
|
@@ -25431,6 +25471,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25431
25471
|
const seq = new NodeClass(ctx.schema);
|
|
25432
25472
|
if (ctx.atRoot)
|
|
25433
25473
|
ctx.atRoot = false;
|
|
25474
|
+
if (ctx.atKey)
|
|
25475
|
+
ctx.atKey = false;
|
|
25434
25476
|
let offset = bs.offset;
|
|
25435
25477
|
let commentEnd = null;
|
|
25436
25478
|
for (const { start, value } of bs.items) {
|
|
@@ -25515,6 +25557,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25515
25557
|
const atRoot = ctx.atRoot;
|
|
25516
25558
|
if (atRoot)
|
|
25517
25559
|
ctx.atRoot = false;
|
|
25560
|
+
if (ctx.atKey)
|
|
25561
|
+
ctx.atKey = false;
|
|
25518
25562
|
let offset = fc.offset + fc.start.source.length;
|
|
25519
25563
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
25520
25564
|
const collItem = fc.items[i];
|
|
@@ -25594,12 +25638,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25594
25638
|
else {
|
|
25595
25639
|
// item is a key+value pair
|
|
25596
25640
|
// key value
|
|
25641
|
+
ctx.atKey = true;
|
|
25597
25642
|
const keyStart = props.end;
|
|
25598
25643
|
const keyNode = key
|
|
25599
25644
|
? composeNode(ctx, key, props, onError)
|
|
25600
25645
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
25601
25646
|
if (isBlock(key))
|
|
25602
25647
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
25648
|
+
ctx.atKey = false;
|
|
25603
25649
|
// value properties
|
|
25604
25650
|
const valueProps = resolveProps(sep ?? [], {
|
|
25605
25651
|
flow: fcName,
|
|
@@ -25755,8 +25801,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
25755
25801
|
tag = kt;
|
|
25756
25802
|
}
|
|
25757
25803
|
else {
|
|
25758
|
-
if (kt
|
|
25759
|
-
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
25804
|
+
if (kt) {
|
|
25805
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
|
|
25760
25806
|
}
|
|
25761
25807
|
else {
|
|
25762
25808
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
@@ -26197,11 +26243,16 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26197
26243
|
const tagName = tagToken
|
|
26198
26244
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
26199
26245
|
: null;
|
|
26200
|
-
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26204
|
-
|
|
26246
|
+
let tag;
|
|
26247
|
+
if (ctx.options.stringKeys && ctx.atKey) {
|
|
26248
|
+
tag = ctx.schema[SCALAR$1];
|
|
26249
|
+
}
|
|
26250
|
+
else if (tagName)
|
|
26251
|
+
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
26252
|
+
else if (token.type === 'scalar')
|
|
26253
|
+
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
26254
|
+
else
|
|
26255
|
+
tag = ctx.schema[SCALAR$1];
|
|
26205
26256
|
let scalar;
|
|
26206
26257
|
try {
|
|
26207
26258
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
@@ -26249,8 +26300,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26249
26300
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
26250
26301
|
return schema[SCALAR$1];
|
|
26251
26302
|
}
|
|
26252
|
-
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
26253
|
-
const tag = schema.tags.find(tag => tag.default && tag.
|
|
26303
|
+
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
26304
|
+
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
|
|
26305
|
+
tag.test?.test(value)) || schema[SCALAR$1];
|
|
26254
26306
|
if (schema.compat) {
|
|
26255
26307
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
26256
26308
|
schema[SCALAR$1];
|
|
@@ -26266,8 +26318,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26266
26318
|
|
|
26267
26319
|
function emptyScalarPosition(offset, before, pos) {
|
|
26268
26320
|
if (before) {
|
|
26269
|
-
|
|
26270
|
-
pos = before.length;
|
|
26321
|
+
pos ?? (pos = before.length);
|
|
26271
26322
|
for (let i = pos - 1; i >= 0; --i) {
|
|
26272
26323
|
let st = before[i];
|
|
26273
26324
|
switch (st.type) {
|
|
@@ -26292,6 +26343,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26292
26343
|
|
|
26293
26344
|
const CN = { composeNode, composeEmptyNode };
|
|
26294
26345
|
function composeNode(ctx, token, props, onError) {
|
|
26346
|
+
const atKey = ctx.atKey;
|
|
26295
26347
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
26296
26348
|
let node;
|
|
26297
26349
|
let isSrcToken = true;
|
|
@@ -26327,6 +26379,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26327
26379
|
}
|
|
26328
26380
|
if (anchor && node.anchor === '')
|
|
26329
26381
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
|
26382
|
+
if (atKey &&
|
|
26383
|
+
ctx.options.stringKeys &&
|
|
26384
|
+
(!isScalar$1(node) ||
|
|
26385
|
+
typeof node.value !== 'string' ||
|
|
26386
|
+
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
26387
|
+
const msg = 'With stringKeys, all keys must be strings';
|
|
26388
|
+
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
26389
|
+
}
|
|
26330
26390
|
if (spaceBefore)
|
|
26331
26391
|
node.spaceBefore = true;
|
|
26332
26392
|
if (comment) {
|
|
@@ -26379,6 +26439,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
26379
26439
|
const opts = Object.assign({ _directives: directives }, options);
|
|
26380
26440
|
const doc = new Document(undefined, opts);
|
|
26381
26441
|
const ctx = {
|
|
26442
|
+
atKey: false,
|
|
26382
26443
|
atRoot: true,
|
|
26383
26444
|
directives: doc.directives,
|
|
26384
26445
|
options: doc.options,
|
|
@@ -28513,7 +28574,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28513
28574
|
default: {
|
|
28514
28575
|
const bv = this.startBlockValue(map);
|
|
28515
28576
|
if (bv) {
|
|
28516
|
-
if (
|
|
28577
|
+
if (bv.type === 'block-seq') {
|
|
28578
|
+
if (!it.explicitKey &&
|
|
28579
|
+
it.sep &&
|
|
28580
|
+
!includesToken(it.sep, 'newline')) {
|
|
28581
|
+
yield* this.pop({
|
|
28582
|
+
type: 'error',
|
|
28583
|
+
offset: this.offset,
|
|
28584
|
+
message: 'Unexpected block-seq-ind on same line with key',
|
|
28585
|
+
source: this.source
|
|
28586
|
+
});
|
|
28587
|
+
return;
|
|
28588
|
+
}
|
|
28589
|
+
}
|
|
28590
|
+
else if (atMapIndent) {
|
|
28517
28591
|
map.items.push({ start });
|
|
28518
28592
|
}
|
|
28519
28593
|
this.stack.push(bv);
|
|
@@ -28884,6 +28958,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
|
|
|
28884
28958
|
if (!keepUndefined)
|
|
28885
28959
|
return undefined;
|
|
28886
28960
|
}
|
|
28961
|
+
if (isDocument(value) && !_replacer)
|
|
28962
|
+
return value.toString(options);
|
|
28887
28963
|
return new Document(value, _replacer, options).toString(options);
|
|
28888
28964
|
}
|
|
28889
28965
|
|