@thoughtspot/visual-embed-sdk 1.42.1-alpha.2 → 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.
Files changed (38) hide show
  1. package/cjs/package.json +1 -2
  2. package/cjs/src/api-intercept.d.ts +9 -6
  3. package/cjs/src/api-intercept.d.ts.map +1 -1
  4. package/cjs/src/api-intercept.js +10 -7
  5. package/cjs/src/api-intercept.js.map +1 -1
  6. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  7. package/cjs/src/embed/ts-embed.spec.js +0 -85
  8. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  9. package/cjs/src/react/util.d.ts +0 -1
  10. package/cjs/src/react/util.d.ts.map +1 -1
  11. package/cjs/src/utils/processData.spec.js.map +1 -1
  12. package/dist/index-BaESA9rq.js +7371 -0
  13. package/dist/index-DhFH7b7U.js +7447 -0
  14. package/dist/src/api-intercept.d.ts +9 -6
  15. package/dist/src/api-intercept.d.ts.map +1 -1
  16. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  17. package/dist/src/react/util.d.ts +0 -1
  18. package/dist/src/react/util.d.ts.map +1 -1
  19. package/dist/tsembed-react.es.js +13 -10
  20. package/dist/tsembed-react.js +233 -154
  21. package/dist/tsembed.es.js +13 -10
  22. package/dist/tsembed.js +233 -154
  23. package/lib/package.json +1 -2
  24. package/lib/src/api-intercept.d.ts +9 -6
  25. package/lib/src/api-intercept.d.ts.map +1 -1
  26. package/lib/src/api-intercept.js +10 -7
  27. package/lib/src/api-intercept.js.map +1 -1
  28. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  29. package/lib/src/embed/ts-embed.spec.js +0 -85
  30. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  31. package/lib/src/react/util.d.ts +0 -1
  32. package/lib/src/react/util.d.ts.map +1 -1
  33. package/lib/src/utils/processData.spec.js.map +1 -1
  34. package/package.json +1 -2
  35. package/src/api-intercept.ts +11 -8
  36. package/src/embed/ts-embed.spec.ts +0 -105
  37. package/src/utils/processData.spec.ts +0 -1
  38. 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.2 */
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.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
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.
@@ -17788,14 +17788,17 @@ 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
- errors: [
17792
- {
17793
- errorObj: {
17794
- title,
17795
- desc
17791
+ body: {
17792
+ errors: [
17793
+ {
17794
+ errorObj: {
17795
+ title,
17796
+ desc
17797
+ }
17796
17798
  }
17797
- }
17798
- ],
17799
+ ],
17800
+ },
17801
+ status: 200,
17799
17802
  };
17800
17803
  return { data: payloadToSend };
17801
17804
  };
@@ -22027,8 +22030,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22027
22030
  return {
22028
22031
  onAnchor: (source) => {
22029
22032
  aliasObjects.push(source);
22030
- if (!prevAnchors)
22031
- prevAnchors = anchorNames(doc);
22033
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
22032
22034
  const anchor = findNewAnchor(prefix, prevAnchors);
22033
22035
  prevAnchors.add(anchor);
22034
22036
  return anchor;
@@ -22192,23 +22194,36 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22192
22194
  * Resolve the value of this alias within `doc`, finding the last
22193
22195
  * instance of the `source` anchor before this node.
22194
22196
  */
22195
- 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
+ }
22196
22213
  let found = undefined;
22197
- visit$1(doc, {
22198
- Node: (_key, node) => {
22199
- if (node === this)
22200
- return visit$1.BREAK;
22201
- if (node.anchor === this.source)
22202
- found = node;
22203
- }
22204
- });
22214
+ for (const node of nodes) {
22215
+ if (node === this)
22216
+ break;
22217
+ if (node.anchor === this.source)
22218
+ found = node;
22219
+ }
22205
22220
  return found;
22206
22221
  }
22207
22222
  toJSON(_arg, ctx) {
22208
22223
  if (!ctx)
22209
22224
  return { source: this.source };
22210
22225
  const { anchors, doc, maxAliasCount } = ctx;
22211
- const source = this.resolve(doc);
22226
+ const source = this.resolve(doc, ctx);
22212
22227
  if (!source) {
22213
22228
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
22214
22229
  throw new ReferenceError(msg);
@@ -22327,8 +22342,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22327
22342
  if (aliasDuplicateObjects && value && typeof value === 'object') {
22328
22343
  ref = sourceObjects.get(value);
22329
22344
  if (ref) {
22330
- if (!ref.anchor)
22331
- ref.anchor = onAnchor(value);
22345
+ ref.anchor ?? (ref.anchor = onAnchor(value));
22332
22346
  return new Alias(ref.anchor);
22333
22347
  }
22334
22348
  else {
@@ -22839,7 +22853,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22839
22853
  const { blockQuote, commentString, lineWidth } = ctx.options;
22840
22854
  // 1. Block can't end in whitespace unless the last line is non-empty.
22841
22855
  // 2. Strings consisting of only whitespace are best rendered explicitly.
22842
- if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
22856
+ if (!blockQuote || /\n[\t ]+$/.test(value)) {
22843
22857
  return quotedString(value, ctx);
22844
22858
  }
22845
22859
  const indent = ctx.indent ||
@@ -22899,23 +22913,32 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22899
22913
  start = start.replace(/\n+/g, `$&${indent}`);
22900
22914
  }
22901
22915
  const indentSize = indent ? '2' : '1'; // root is at -1
22902
- let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
22916
+ // Leading | or > is added later
22917
+ let header = (startWithSpace ? indentSize : '') + chomp;
22903
22918
  if (comment) {
22904
22919
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
22905
22920
  if (onComment)
22906
22921
  onComment();
22907
22922
  }
22908
- if (literal) {
22909
- value = value.replace(/\n+/g, `$&${indent}`);
22910
- return `${header}\n${indent}${start}${value}${end}`;
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}`;
22911
22939
  }
22912
- value = value
22913
- .replace(/\n+/g, '\n$&')
22914
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22915
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22916
- .replace(/\n+/g, `$&${indent}`);
22917
- const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
22918
- return `${header}\n${indent}${body}`;
22940
+ value = value.replace(/\n+/g, `$&${indent}`);
22941
+ return `|${header}\n${indent}${start}${value}${end}`;
22919
22942
  }
22920
22943
  function plainString(item, ctx, onComment, onChompKeep) {
22921
22944
  const { type, value } = item;
@@ -22924,10 +22947,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
22924
22947
  (inFlow && /[[\]{},]/.test(value))) {
22925
22948
  return quotedString(value, ctx);
22926
22949
  }
22927
- if (!value ||
22928
- /^[\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)) {
22929
22951
  // not allowed:
22930
- // - empty string, '-' or '?'
22952
+ // - '-' or '?'
22931
22953
  // - start with an indicator character (except [?:-]) or /[?-] /
22932
22954
  // - '\n ', ': ' or ' \n' anywhere
22933
22955
  // - '#' not preceded by a non-space char
@@ -23056,7 +23078,12 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23056
23078
  let obj;
23057
23079
  if (isScalar$1(item)) {
23058
23080
  obj = item.value;
23059
- const match = tags.filter(t => t.identify?.(obj));
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
+ }
23060
23087
  tagObj =
23061
23088
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
23062
23089
  }
@@ -23065,7 +23092,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23065
23092
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
23066
23093
  }
23067
23094
  if (!tagObj) {
23068
- const name = obj?.constructor?.name ?? typeof obj;
23095
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
23069
23096
  throw new Error(`Tag not resolved for ${name} value`);
23070
23097
  }
23071
23098
  return tagObj;
@@ -23080,7 +23107,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23080
23107
  anchors.add(anchor);
23081
23108
  props.push(`&${anchor}`);
23082
23109
  }
23083
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
23110
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
23084
23111
  if (tag)
23085
23112
  props.push(doc.directives.tagString(tag));
23086
23113
  return props.join(' ');
@@ -23106,8 +23133,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23106
23133
  const node = isNode(item)
23107
23134
  ? item
23108
23135
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
23109
- if (!tagObj)
23110
- tagObj = getTagObject(ctx.doc.schema.tags, node);
23136
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
23111
23137
  const props = stringifyProps(node, tagObj, ctx);
23112
23138
  if (props.length > 0)
23113
23139
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -23269,54 +23295,10 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23269
23295
 
23270
23296
  function warn(logLevel, warning) {
23271
23297
  if (logLevel === 'debug' || logLevel === 'warn') {
23272
- if (typeof process !== 'undefined' && process.emitWarning)
23273
- process.emitWarning(warning);
23274
- else
23275
- console.warn(warning);
23298
+ console.warn(warning);
23276
23299
  }
23277
23300
  }
23278
23301
 
23279
- const MERGE_KEY = '<<';
23280
- function addPairToJSMap(ctx, map, { key, value }) {
23281
- if (ctx?.doc.schema.merge && isMergeKey(key)) {
23282
- value = isAlias(value) ? value.resolve(ctx.doc) : value;
23283
- if (isSeq(value))
23284
- for (const it of value.items)
23285
- mergeToJSMap(ctx, map, it);
23286
- else if (Array.isArray(value))
23287
- for (const it of value)
23288
- mergeToJSMap(ctx, map, it);
23289
- else
23290
- mergeToJSMap(ctx, map, value);
23291
- }
23292
- else {
23293
- const jsKey = toJS(key, '', ctx);
23294
- if (map instanceof Map) {
23295
- map.set(jsKey, toJS(value, jsKey, ctx));
23296
- }
23297
- else if (map instanceof Set) {
23298
- map.add(jsKey);
23299
- }
23300
- else {
23301
- const stringKey = stringifyKey(key, jsKey, ctx);
23302
- const jsValue = toJS(value, stringKey, ctx);
23303
- if (stringKey in map)
23304
- Object.defineProperty(map, stringKey, {
23305
- value: jsValue,
23306
- writable: true,
23307
- enumerable: true,
23308
- configurable: true
23309
- });
23310
- else
23311
- map[stringKey] = jsValue;
23312
- }
23313
- }
23314
- return map;
23315
- }
23316
- const isMergeKey = (key) => key === MERGE_KEY ||
23317
- (isScalar$1(key) &&
23318
- key.value === MERGE_KEY &&
23319
- (!key.type || key.type === Scalar.PLAIN));
23320
23302
  // If the value associated with a merge key is a single mapping node, each of
23321
23303
  // its key/value pairs is inserted into the current mapping, unless the key
23322
23304
  // already exists in it. If the value associated with the merge key is a
@@ -23324,7 +23306,35 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23324
23306
  // of these nodes is merged in turn according to its order in the sequence.
23325
23307
  // Keys in mapping nodes earlier in the sequence override keys specified in
23326
23308
  // later mapping nodes. -- http://yaml.org/type/merge.html
23327
- function mergeToJSMap(ctx, map, value) {
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) {
23328
23338
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23329
23339
  if (!isMap(source))
23330
23340
  throw new Error('Merge sources must be maps or map aliases');
@@ -23348,9 +23358,41 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23348
23358
  }
23349
23359
  return map;
23350
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
+ }
23351
23392
  function stringifyKey(key, jsKey, ctx) {
23352
23393
  if (jsKey === null)
23353
23394
  return '';
23395
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
23354
23396
  if (typeof jsKey !== 'object')
23355
23397
  return String(jsKey);
23356
23398
  if (isNode(key) && ctx?.doc) {
@@ -23983,7 +24025,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
23983
24025
  identify: value => typeof value === 'boolean',
23984
24026
  default: true,
23985
24027
  tag: 'tag:yaml.org,2002:bool',
23986
- test: /^true|false$/,
24028
+ test: /^true$|^false$/,
23987
24029
  resolve: str => str === 'true',
23988
24030
  stringify: stringifyJSON
23989
24031
  },
@@ -24028,10 +24070,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24028
24070
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
24029
24071
  */
24030
24072
  resolve(src, onError) {
24031
- if (typeof Buffer === 'function') {
24032
- return Buffer.from(src, 'base64');
24033
- }
24034
- else if (typeof atob === 'function') {
24073
+ if (typeof atob === 'function') {
24035
24074
  // On IE 11, atob() can't handle newlines
24036
24075
  const str = atob(src.replace(/[\n\r]/g, ''));
24037
24076
  const buffer = new Uint8Array(str.length);
@@ -24045,15 +24084,11 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24045
24084
  }
24046
24085
  },
24047
24086
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
24087
+ if (!value)
24088
+ return '';
24048
24089
  const buf = value; // checked earlier by binary.identify()
24049
24090
  let str;
24050
- if (typeof Buffer === 'function') {
24051
- str =
24052
- buf instanceof Buffer
24053
- ? buf.toString('base64')
24054
- : Buffer.from(buf.buffer).toString('base64');
24055
- }
24056
- else if (typeof btoa === 'function') {
24091
+ if (typeof btoa === 'function') {
24057
24092
  let s = '';
24058
24093
  for (let i = 0; i < buf.length; ++i)
24059
24094
  s += String.fromCharCode(buf[i]);
@@ -24062,8 +24097,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24062
24097
  else {
24063
24098
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
24064
24099
  }
24065
- if (!type)
24066
- type = Scalar.BLOCK_LITERAL;
24100
+ type ?? (type = Scalar.BLOCK_LITERAL);
24067
24101
  if (type !== Scalar.QUOTE_DOUBLE) {
24068
24102
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
24069
24103
  const n = Math.ceil(str.length / lineWidth);
@@ -24532,7 +24566,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24532
24566
  }
24533
24567
  return new Date(date);
24534
24568
  },
24535
- stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
24569
+ stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
24536
24570
  };
24537
24571
 
24538
24572
  const schema = [
@@ -24550,6 +24584,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24550
24584
  floatExp,
24551
24585
  float,
24552
24586
  binary,
24587
+ merge,
24553
24588
  omap,
24554
24589
  pairs,
24555
24590
  set,
@@ -24577,6 +24612,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24577
24612
  intOct: intOct$1,
24578
24613
  intTime,
24579
24614
  map,
24615
+ merge,
24580
24616
  null: nullTag,
24581
24617
  omap,
24582
24618
  pairs,
@@ -24586,13 +24622,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24586
24622
  };
24587
24623
  const coreKnownTags = {
24588
24624
  'tag:yaml.org,2002:binary': binary,
24625
+ 'tag:yaml.org,2002:merge': merge,
24589
24626
  'tag:yaml.org,2002:omap': omap,
24590
24627
  'tag:yaml.org,2002:pairs': pairs,
24591
24628
  'tag:yaml.org,2002:set': set,
24592
24629
  'tag:yaml.org,2002:timestamp': timestamp
24593
24630
  };
24594
- function getTags(customTags, schemaName) {
24595
- let tags = schemas.get(schemaName);
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;
24596
24639
  if (!tags) {
24597
24640
  if (Array.isArray(customTags))
24598
24641
  tags = [];
@@ -24611,17 +24654,21 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24611
24654
  else if (typeof customTags === 'function') {
24612
24655
  tags = customTags(tags.slice());
24613
24656
  }
24614
- return tags.map(tag => {
24615
- if (typeof tag !== 'string')
24616
- return tag;
24617
- const tagObj = tagsByName[tag];
24618
- if (tagObj)
24619
- return tagObj;
24620
- const keys = Object.keys(tagsByName)
24621
- .map(key => JSON.stringify(key))
24622
- .join(', ');
24623
- throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
24624
- });
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
+ }, []);
24625
24672
  }
24626
24673
 
24627
24674
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -24632,10 +24679,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24632
24679
  : compat
24633
24680
  ? getTags(null, compat)
24634
24681
  : null;
24635
- this.merge = !!merge;
24636
24682
  this.name = (typeof schema === 'string' && schema) || 'core';
24637
24683
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
24638
- this.tags = getTags(customTags, this.name);
24684
+ this.tags = getTags(customTags, this.name, merge);
24639
24685
  this.toStringOptions = toStringDefaults ?? null;
24640
24686
  Object.defineProperty(this, MAP, { value: map });
24641
24687
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -24760,6 +24806,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24760
24806
  logLevel: 'warn',
24761
24807
  prettyErrors: true,
24762
24808
  strict: true,
24809
+ stringKeys: false,
24763
24810
  uniqueKeys: true,
24764
24811
  version: '1.2'
24765
24812
  }, options);
@@ -24983,7 +25030,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24983
25030
  this.directives.yaml.version = '1.1';
24984
25031
  else
24985
25032
  this.directives = new Directives({ version: '1.1' });
24986
- opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
25033
+ opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
24987
25034
  break;
24988
25035
  case '1.2':
24989
25036
  case 'next':
@@ -24991,7 +25038,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
24991
25038
  this.directives.yaml.version = version;
24992
25039
  else
24993
25040
  this.directives = new Directives({ version });
24994
- opt = { merge: false, resolveKnownTags: true, schema: 'core' };
25041
+ opt = { resolveKnownTags: true, schema: 'core' };
24995
25042
  break;
24996
25043
  case null:
24997
25044
  if (this.directives)
@@ -25169,7 +25216,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25169
25216
  if (atNewline) {
25170
25217
  if (comment)
25171
25218
  comment += token.source;
25172
- else
25219
+ else if (!found || indicator !== 'seq-item-ind')
25173
25220
  spaceBefore = true;
25174
25221
  }
25175
25222
  else
@@ -25186,8 +25233,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25186
25233
  if (token.source.endsWith(':'))
25187
25234
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
25188
25235
  anchor = token;
25189
- if (start === null)
25190
- start = token.offset;
25236
+ start ?? (start = token.offset);
25191
25237
  atNewline = false;
25192
25238
  hasSpace = false;
25193
25239
  reqSpace = true;
@@ -25196,8 +25242,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25196
25242
  if (tag)
25197
25243
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
25198
25244
  tag = token;
25199
- if (start === null)
25200
- start = token.offset;
25245
+ start ?? (start = token.offset);
25201
25246
  atNewline = false;
25202
25247
  hasSpace = false;
25203
25248
  reqSpace = true;
@@ -25310,11 +25355,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25310
25355
  return false;
25311
25356
  const isEqual = typeof uniqueKeys === 'function'
25312
25357
  ? uniqueKeys
25313
- : (a, b) => a === b ||
25314
- (isScalar$1(a) &&
25315
- isScalar$1(b) &&
25316
- a.value === b.value &&
25317
- !(a.value === '<<' && ctx.schema.merge));
25358
+ : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
25318
25359
  return items.some(pair => isEqual(pair.key, search));
25319
25360
  }
25320
25361
 
@@ -25363,12 +25404,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25363
25404
  onError(offset, 'BAD_INDENT', startColMsg);
25364
25405
  }
25365
25406
  // key value
25407
+ ctx.atKey = true;
25366
25408
  const keyStart = keyProps.end;
25367
25409
  const keyNode = key
25368
25410
  ? composeNode(ctx, key, keyProps, onError)
25369
25411
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
25370
25412
  if (ctx.schema.compat)
25371
25413
  flowIndentCheck(bm.indent, key, onError);
25414
+ ctx.atKey = false;
25372
25415
  if (mapIncludes(ctx, map.items, keyNode))
25373
25416
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
25374
25417
  // value properties
@@ -25428,6 +25471,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25428
25471
  const seq = new NodeClass(ctx.schema);
25429
25472
  if (ctx.atRoot)
25430
25473
  ctx.atRoot = false;
25474
+ if (ctx.atKey)
25475
+ ctx.atKey = false;
25431
25476
  let offset = bs.offset;
25432
25477
  let commentEnd = null;
25433
25478
  for (const { start, value } of bs.items) {
@@ -25512,6 +25557,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25512
25557
  const atRoot = ctx.atRoot;
25513
25558
  if (atRoot)
25514
25559
  ctx.atRoot = false;
25560
+ if (ctx.atKey)
25561
+ ctx.atKey = false;
25515
25562
  let offset = fc.offset + fc.start.source.length;
25516
25563
  for (let i = 0; i < fc.items.length; ++i) {
25517
25564
  const collItem = fc.items[i];
@@ -25591,12 +25638,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25591
25638
  else {
25592
25639
  // item is a key+value pair
25593
25640
  // key value
25641
+ ctx.atKey = true;
25594
25642
  const keyStart = props.end;
25595
25643
  const keyNode = key
25596
25644
  ? composeNode(ctx, key, props, onError)
25597
25645
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
25598
25646
  if (isBlock(key))
25599
25647
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
25648
+ ctx.atKey = false;
25600
25649
  // value properties
25601
25650
  const valueProps = resolveProps(sep ?? [], {
25602
25651
  flow: fcName,
@@ -25752,8 +25801,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
25752
25801
  tag = kt;
25753
25802
  }
25754
25803
  else {
25755
- if (kt?.collection) {
25756
- 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);
25757
25806
  }
25758
25807
  else {
25759
25808
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -26194,11 +26243,16 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26194
26243
  const tagName = tagToken
26195
26244
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
26196
26245
  : null;
26197
- const tag = tagToken && tagName
26198
- ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
26199
- : token.type === 'scalar'
26200
- ? findScalarTagByTest(ctx, value, token, onError)
26201
- : ctx.schema[SCALAR$1];
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];
26202
26256
  let scalar;
26203
26257
  try {
26204
26258
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -26246,8 +26300,9 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26246
26300
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
26247
26301
  return schema[SCALAR$1];
26248
26302
  }
26249
- function findScalarTagByTest({ directives, schema }, value, token, onError) {
26250
- const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
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];
26251
26306
  if (schema.compat) {
26252
26307
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
26253
26308
  schema[SCALAR$1];
@@ -26263,8 +26318,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26263
26318
 
26264
26319
  function emptyScalarPosition(offset, before, pos) {
26265
26320
  if (before) {
26266
- if (pos === null)
26267
- pos = before.length;
26321
+ pos ?? (pos = before.length);
26268
26322
  for (let i = pos - 1; i >= 0; --i) {
26269
26323
  let st = before[i];
26270
26324
  switch (st.type) {
@@ -26289,6 +26343,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26289
26343
 
26290
26344
  const CN = { composeNode, composeEmptyNode };
26291
26345
  function composeNode(ctx, token, props, onError) {
26346
+ const atKey = ctx.atKey;
26292
26347
  const { spaceBefore, comment, anchor, tag } = props;
26293
26348
  let node;
26294
26349
  let isSrcToken = true;
@@ -26324,6 +26379,14 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26324
26379
  }
26325
26380
  if (anchor && node.anchor === '')
26326
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
+ }
26327
26390
  if (spaceBefore)
26328
26391
  node.spaceBefore = true;
26329
26392
  if (comment) {
@@ -26376,6 +26439,7 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
26376
26439
  const opts = Object.assign({ _directives: directives }, options);
26377
26440
  const doc = new Document(undefined, opts);
26378
26441
  const ctx = {
26442
+ atKey: false,
26379
26443
  atRoot: true,
26380
26444
  directives: doc.directives,
26381
26445
  options: doc.options,
@@ -28510,7 +28574,20 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28510
28574
  default: {
28511
28575
  const bv = this.startBlockValue(map);
28512
28576
  if (bv) {
28513
- if (atMapIndent && bv.type !== 'block-seq') {
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) {
28514
28591
  map.items.push({ start });
28515
28592
  }
28516
28593
  this.stack.push(bv);
@@ -28881,6 +28958,8 @@ query GetEurekaResults($params: Input_eureka_SearchRequest) {
28881
28958
  if (!keepUndefined)
28882
28959
  return undefined;
28883
28960
  }
28961
+ if (isDocument(value) && !_replacer)
28962
+ return value.toString(options);
28884
28963
  return new Document(value, _replacer, options).toString(options);
28885
28964
  }
28886
28965