@redocly/redoc-reef 0.140.0-next.4 → 0.140.0-next.6

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 (120) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/cli/generate/get-schema-template.js +1 -1
  3. package/dist/client/app/hooks/markdown/useMarkdocRenderer.js +1 -1
  4. package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
  5. package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +1 -33
  6. package/dist/compiled/@redocly/pii/index.js +1 -0
  7. package/dist/compiled/@redocly/pii/package.json +1 -0
  8. package/dist/markdoc/attributes/definition-path.d.ts +1 -1
  9. package/dist/markdoc/attributes/json-example-ref.d.ts +1 -1
  10. package/dist/markdoc/attributes/json-schema-ref.d.ts +1 -1
  11. package/dist/markdoc/attributes/parsed-yaml.d.ts +1 -1
  12. package/dist/markdoc/attributes/raw-content.d.ts +1 -1
  13. package/dist/markdoc/attributes/sample-from-json-schema.d.ts +1 -1
  14. package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +1 -1
  15. package/dist/markdoc/helpers/get-inner-text.d.ts +1 -1
  16. package/dist/markdoc/helpers/get-node-attribute.d.ts +1 -1
  17. package/dist/markdoc/helpers/get-variable.d.ts +1 -1
  18. package/dist/markdoc/helpers/guards/is-conditional-node.d.ts +1 -1
  19. package/dist/markdoc/helpers/guards/is-function.d.ts +1 -1
  20. package/dist/markdoc/helpers/guards/is-node.d.ts +1 -1
  21. package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +1 -1
  22. package/dist/markdoc/helpers/guards/is-tag.d.ts +1 -1
  23. package/dist/markdoc/helpers/guards/is-variable.d.ts +1 -1
  24. package/dist/markdoc/helpers/parse-partials.d.ts +1 -1
  25. package/dist/markdoc/helpers/parse-partials.js +1 -1
  26. package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
  27. package/dist/markdoc/helpers/set-node-attribute-value.d.ts +1 -1
  28. package/dist/markdoc/nodes/fence/index.d.ts +1 -1
  29. package/dist/markdoc/nodes/fence/index.js +1 -1
  30. package/dist/markdoc/nodes/gfm-list-item.d.ts +1 -1
  31. package/dist/markdoc/nodes/gfm-list-item.js +1 -1
  32. package/dist/markdoc/nodes/heading.d.ts +1 -1
  33. package/dist/markdoc/nodes/heading.js +1 -1
  34. package/dist/markdoc/nodes/index.d.ts +6 -165
  35. package/dist/markdoc/nodes/index.js +1 -1
  36. package/dist/markdoc/nodes/table.d.ts +1 -1
  37. package/dist/markdoc/nodes/table.js +1 -1
  38. package/dist/markdoc/nodes/text.d.ts +1 -1
  39. package/dist/markdoc/tags/json-example.js +1 -1
  40. package/dist/server/esbuild/plugins/dependency-resolver.js +1 -1
  41. package/dist/server/plugins/api-docs/loader.d.ts +1 -1
  42. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  43. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts +1 -1
  44. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +1 -1
  45. package/dist/server/plugins/markdown/attribute-resolvers/index.d.ts +1 -1
  46. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts +1 -1
  47. package/dist/server/plugins/markdown/attribute-resolvers/resolve-diagram-from-file.d.ts +1 -1
  48. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.d.ts +1 -1
  49. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.d.ts +1 -1
  50. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-gallery.d.ts +1 -1
  51. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.d.ts +1 -1
  52. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.d.ts +1 -1
  53. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +1 -1
  54. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.d.ts +1 -1
  55. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
  56. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.d.ts +1 -1
  57. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.d.ts +1 -1
  58. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.d.ts +1 -1
  59. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +1 -1
  60. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +1 -1
  61. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.d.ts +1 -1
  62. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.d.ts +1 -1
  63. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.d.ts +1 -1
  64. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.d.ts +1 -1
  65. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +1 -1
  66. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.d.ts +1 -1
  67. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +1 -1
  68. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -2
  69. package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +1 -1
  70. package/dist/server/plugins/markdown/compiler.d.ts +1 -1
  71. package/dist/server/plugins/markdown/compiler.js +1 -1
  72. package/dist/server/plugins/markdown/errors.d.ts +1 -1
  73. package/dist/server/plugins/markdown/get-server-props.js +1 -1
  74. package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +1 -1
  75. package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -1
  76. package/dist/server/plugins/markdown/markdoc/functions/concat.d.ts +1 -1
  77. package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +5 -165
  78. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  79. package/dist/server/plugins/markdown/markdoc/partials.d.ts +1 -1
  80. package/dist/server/plugins/markdown/markdoc/plugins/headings.d.ts +1 -1
  81. package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
  82. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +1 -1
  83. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -1
  84. package/dist/server/plugins/markdown/runtime-transform.d.ts +2 -2
  85. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  86. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  87. package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +1 -1
  88. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  89. package/dist/server/plugins/markdown/search/to-markdown.d.ts +1 -1
  90. package/dist/server/plugins/markdown/search/walk-sections.d.ts +1 -1
  91. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  92. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.d.ts +1 -1
  93. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
  94. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -1
  95. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +4 -4
  96. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  97. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +2 -2
  98. package/dist/server/store.d.ts +1 -1
  99. package/dist/server/store.js +1 -1
  100. package/dist/server/tools/notifiers/formatter.js +3 -3
  101. package/dist/server/types/plugins/common.d.ts +1 -1
  102. package/dist/server/utils/codeframes/codeframes.d.ts +1 -1
  103. package/dist/server/utils/codeframes/yaml-ast.d.ts +1 -1
  104. package/dist/types/errors.d.ts +1 -1
  105. package/dist/types/markdoc.d.ts +1 -1
  106. package/package.json +8 -8
  107. package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.d.ts +0 -6
  108. package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +0 -1
  109. package/dist/server/plugins/markdown/html/process-html-tokens.d.ts +0 -2
  110. package/dist/server/plugins/markdown/html/process-html-tokens.js +0 -1
  111. package/dist/server/plugins/markdown/source.d.ts +0 -4
  112. package/dist/server/plugins/markdown/source.js +0 -1
  113. package/dist/server/tools/notifiers/helpers/privacy/mask-email.d.ts +0 -25
  114. package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +0 -1
  115. package/dist/server/tools/notifiers/helpers/privacy/mask-subject.d.ts +0 -13
  116. package/dist/server/tools/notifiers/helpers/privacy/mask-subject.js +0 -1
  117. package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.d.ts +0 -25
  118. package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.js +0 -1
  119. package/dist/server/tools/notifiers/helpers/privacy/remove-pii.d.ts +0 -36
  120. package/dist/server/tools/notifiers/helpers/privacy/remove-pii.js +0 -1
@@ -1,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
1
+ import type { Node } from '@redocly/markdoc';
2
2
  import type { GetInnerContentFn } from '../../../../types/index.js';
3
3
  import type { SearchNode } from './nodes/types.js';
4
4
  import type { RenderTagFn } from '../../../types/plugins/markdown.js';
@@ -1,3 +1,3 @@
1
- import{PROMPT_TAG as a}from"@redocly/theme/core/constants";import{logger as w}from"../../../tools/notifiers/logger.js";import{isNode as p}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as b}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as g,TagNode as u}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class G{#r;#e;#o;#s;#c;#n;constructor({ast:i,partials:t,skipConditionals:s=!1,getInnerContent:r,renderTag:e,indexPromptTitles:o=!1}){if(this.#r=i,this.#e=t,this.#o=s,this.#s=r,this.#c=e,this.#n=o,!this.#r||!p(this.#r))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#o,renderTag:this.#c,...i}}*transform(){yield*this.#l(this.#r,{parentNode:null})}*#l(i,t,s=this.#s){if(!(!i||!p(i))){if(N(i)){if(this.#o)return;const r=b(i);r&&r.length>0&&(yield*this.#t(i,{...t,rbacTeams:r},s));return}if(m(i)){yield new n({node:i,content:s([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:s([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#h(i,t,s);return}yield*this.#t(i,t,s)}}*#h(i,t,s=this.#s){switch(i.tag){case"partial":{const r=i.attributes.file,e=i.attributes.variables??{};if(r&&this.#e[r]){yield*this.#l(this.#e[r],t,(o,h)=>s(o,{...h,variables:e}));return}w.warn(`Could not create search indexes for partial \u201C${r}\u201D: file not found`);return}case"html":case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,s);return}case a:{const r=f(i,"title");this.#n&&r&&(yield new u({node:i,content:r,...t}));return}case"markdoc-example":{const r=s([i],this.#i());yield new n({node:i,content:r,...t});return}case"code-snippet":{const r=f(i,"title"),e=s([i],this.#i());if(r){const o=new u({node:i,content:r,...t});t={...t,parentNode:o},yield o}e&&(yield new n({node:i,content:e,...t}));return}default:{const r=this.#f(i,t,s);if(r!==void 0){yield new n({node:i,content:k(r),...t});return}const e=g.find(l=>l in i.attributes),o=(e&&f(i,e))??"",h=typeof o=="string"?o:s([o]);if(h){const l=new u({node:i,content:h,...t});t={...t,parentNode:l},yield l}if(T(i))yield*this.#t(i,t,s);else{const l=s([i],this.#i());l&&(yield new n({node:i,content:l,...t}))}return}}}#f(i,t,s){const r=()=>T(i)?d([...this.#t(i,t,s)]):"";return this.#c?.(i,{getBody:r})}*#t(i,t,s=this.#s){for(const r of[...Object.values(i.slots),...i.children])for(const e of this.#l(r,t,s))e instanceof y&&(t={...t,parentNode:e}),yield e}}function T(c){return c.children.length>0||Object.keys(c.slots).length>0}function k(c){return c.endsWith(`
1
+ import{PROMPT_TAG as a}from"@redocly/theme/core/constants";import{logger as w}from"../../../tools/notifiers/logger.js";import{isNode as p}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as b}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as g,TagNode as u}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class G{#r;#e;#o;#s;#c;#n;constructor({ast:i,partials:t,skipConditionals:s=!1,getInnerContent:r,renderTag:e,indexPromptTitles:o=!1}){if(this.#r=i,this.#e=t,this.#o=s,this.#s=r,this.#c=e,this.#n=o,!this.#r||!p(this.#r))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#o,renderTag:this.#c,...i}}*transform(){yield*this.#l(this.#r,{parentNode:null})}*#l(i,t,s=this.#s){if(!(!i||!p(i))){if(N(i)){if(this.#o)return;const r=b(i);r&&r.length>0&&(yield*this.#t(i,{...t,rbacTeams:r},s));return}if(m(i)){yield new n({node:i,content:s([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:s([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#h(i,t,s);return}yield*this.#t(i,t,s)}}*#h(i,t,s=this.#s){switch(i.tag){case"partial":{const r=i.attributes.file,e=i.attributes.variables??{};if(r&&this.#e[r]){yield*this.#l(this.#e[r],t,(o,h)=>s(o,{...h,variables:e}));return}w.warn(`Could not create search indexes for partial \u201C${r}\u201D: file not found`);return}case"html":case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,s);return}case a:{const r=f(i,"title");this.#n&&r&&(yield new u({node:i,content:r,...t}));return}case"markdoc-example":{const r=s([i],this.#i());yield new n({node:i,content:r,...t});return}case"code-snippet":{const r=f(i,"title"),e=s([i],this.#i());if(r){const o=new u({node:i,content:r,...t});t={...t,parentNode:o},yield o}e&&(yield new n({node:i,content:e,...t}));return}default:{const r=this.#f(i,t,s);if(r!==void 0){yield new n({node:i,content:k(r),...t});return}const e=g.find(l=>l in i.attributes),o=(e&&f(i,e))??"",h=typeof o=="string"?o:s([o]);if(h){const l=new u({node:i,content:h,...t});t={...t,parentNode:l},yield l}if(T(i))yield*this.#t(i,t,s);else{const l=s([i],this.#i());l&&(yield new n({node:i,content:l,...t}))}return}}}#f(i,t,s){const r=()=>T(i)?d([...this.#t(i,t,s)]):"";return this.#c?.(i,{getBody:r})}*#t(i,t,s=this.#s){for(const r of[...Object.values(i.slots??{}),...i.children])for(const e of this.#l(r,t,s))e instanceof y&&(t={...t,parentNode:e}),yield e}}function T(c){return c.children.length>0||Object.keys(c.slots??{}).length>0}function k(c){return c.endsWith(`
2
2
  `)?c:`${c}
3
3
  `}export{G as AstToSearchNodeTransformer};
@@ -1,3 +1,3 @@
1
- import type { Tag } from '@markdoc/markdoc';
1
+ import type { Tag } from '@redocly/markdoc';
2
2
  export declare function stringifyTagChildrenObjects(tag?: Tag | null): void;
3
3
  //# sourceMappingURL=stringify-tag-children-objects.d.ts.map
@@ -1 +1 @@
1
- import{FIELD_SCOPE_KINDS as n,GRAPHQL_TYPE_KINDS as u}from"./constants.js";import{respondWithGraphqlSchema as g,paginate as d}from"./tool-helpers.js";import{groupSchemaTypes as h,fieldMembers as y,filterMembersReferencingType as S,matchesFilter as b}from"./utils.js";function T(r,p,t){if(p==="fields"){if(t&&!n.some(e=>e===t))throw new Error(`scope "fields" lists the fields of object, interface, and input types; kind must be ${n.map(e=>`"${e}"`).join(", ")}, or omitted.`);return y(r,t)}const o=h(r);return(t?[t]:u).flatMap(e=>o[e].map(s=>({kind:e,...s})))}const E=(r,p)=>g(r.name,p,({name:t,schema:o})=>{const{kind:e,scope:s="members",filter:f,referencesType:l,page:m=1,limit:a=300}=r;let i=T(o,s,e);return l&&(i=S(o,i,l)),f&&(i=i.filter(c=>b(c,f))),JSON.stringify({name:t,...d(i,m,a)},null,2)});var D={"get-graphql-type-list":E};export{D as default};
1
+ import{FIELD_SCOPE_KINDS as n,GRAPHQL_TYPE_KINDS as u}from"./constants.js";import{respondWithGraphqlSchema as g,paginate as d}from"./tool-helpers.js";import{groupSchemaTypes as h,fieldMembers as y,filterMembersReferencingType as S,matchesFilter as b}from"./utils.js";function T(r,p,t){if(p==="fields"){if(t&&!n.some(e=>e===t))throw new Error(`scope "fields" lists the fields of object, interface, and input types; kind must be ${n.map(e=>`"${e}"`).join(", ")}, or omitted.`);return y(r,t)}const o=h(r);return(t?[t]:u).flatMap(e=>o[e].map(s=>({kind:e,...s})))}const E=(r,p)=>g(r.name,p,({name:t,schema:o})=>{const{kind:e,scope:s="members",filter:f,referencesType:l,page:m,limit:a}=r;let i=T(o,s,e);return l&&(i=S(o,i,l)),f&&(i=i.filter(c=>b(c,f))),JSON.stringify({name:t,...d(i,m??1,a??300)},null,2)});var D={"get-graphql-type-list":E};export{D as default};
@@ -1 +1 @@
1
- import{paginate as p,textResult as m}from"./tool-helpers.js";const c=async(r,l)=>{const{filter:i,page:o=1,limit:n=300}=r;let t=l.graphqlDescriptions;if(i){const e=i.toLowerCase();t=t.filter(s=>s.name.toLowerCase().includes(e))}const a=p(t,o,n);return m(JSON.stringify({...a,items:a.items.map(({name:e,description:s})=>({name:e,description:s}))}))};var g={"list-graphql-apis":c};export{g as default};
1
+ import{paginate as p,textResult as m}from"./tool-helpers.js";const c=async(r,l)=>{const{filter:i,page:o,limit:n}=r;let t=l.graphqlDescriptions;if(i){const e=i.toLowerCase();t=t.filter(s=>s.name.toLowerCase().includes(e))}const a=p(t,o??1,n??300);return m(JSON.stringify({...a,items:a.items.map(({name:e,description:s})=>({name:e,description:s}))}))};var g={"list-graphql-apis":c};export{g as default};
@@ -14,8 +14,8 @@ export type SchemaMemberWithKind = SchemaMember & {
14
14
  export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
15
15
  export type ListGraphqlApisArgs = {
16
16
  filter?: string;
17
- page?: number;
18
- limit?: number;
17
+ page?: number | null;
18
+ limit?: number | null;
19
19
  };
20
20
  export type GetGraphqlTypeListArgs = {
21
21
  name: string;
@@ -23,8 +23,8 @@ export type GetGraphqlTypeListArgs = {
23
23
  scope?: GraphqlListScope;
24
24
  filter?: string;
25
25
  referencesType?: string;
26
- page?: number;
27
- limit?: number;
26
+ page?: number | null;
27
+ limit?: number | null;
28
28
  };
29
29
  export type GetGraphqlTypeArgs = {
30
30
  name: string;
@@ -1 +1 @@
1
- import{getCallableApis as b}from"../../../gateway-mcp/callable-apis.js";import{filterApiDescriptionsByName as d}from"../../utils/api-name-matching.js";import{apiTitleKey as y,countApiTitles as A,orderSharedTitles as T}from"../../utils/api-titles.js";const x=async(r,l)=>{const{filter:s,page:a=1,limit:e=300}=r,n=new Set(b(l).map(i=>i.relativePath)),m=n.size>0,o=T(Object.values(l.apiDescriptionsMap)),f=A(o);let t=o;s&&(t=d(t,s));const c=(a-1)*e,u=c+e,g=Math.ceil(t.length/e),h=t.length;return t=t.slice(c,u),{content:[{type:"text",text:JSON.stringify({items:t.map(({relativePath:i,fetchEligible:D,...p})=>({filePath:i,...p,...(f.get(y(p.name))??0)>1?{ambiguousTitle:!0}:{},...m?{callable:n.has(i)}:{}})),limit:e,total:h,page:a,totalPages:g})}]}};var I={"list-apis":x};export{I as default};
1
+ import{getCallableApis as b}from"../../../gateway-mcp/callable-apis.js";import{filterApiDescriptionsByName as d}from"../../utils/api-name-matching.js";import{apiTitleKey as y,countApiTitles as A,orderSharedTitles as T}from"../../utils/api-titles.js";const x=async(l,s)=>{const{filter:a}=l,n=l.page??1,e=l.limit??300,o=new Set(b(s).map(i=>i.relativePath)),m=o.size>0,c=T(Object.values(s.apiDescriptionsMap)),f=A(c);let t=c;a&&(t=d(t,a));const p=(n-1)*e,u=p+e,g=Math.ceil(t.length/e),h=t.length;return t=t.slice(p,u),{content:[{type:"text",text:JSON.stringify({items:t.map(({relativePath:i,fetchEligible:D,...r})=>({filePath:i,...r,...(f.get(y(r.name))??0)>1?{ambiguousTitle:!0}:{},...m?{callable:o.has(i)}:{}})),limit:e,total:h,page:n,totalPages:g})}]}};var I={"list-apis":x};export{I as default};
@@ -1,7 +1,7 @@
1
1
  export type ListApisArgs = {
2
2
  filter?: string;
3
- page?: number;
4
- limit?: number;
3
+ page?: number | null;
4
+ limit?: number | null;
5
5
  };
6
6
  export type ApiNameVersionArgs = {
7
7
  name?: string;
@@ -1,4 +1,4 @@
1
- import { type Node } from '@markdoc/markdoc';
1
+ import { type Node } from '@redocly/markdoc';
2
2
  import type { JSX } from 'react';
3
3
  import type { CommonError, GlobalData } from '../types/index.js';
4
4
  import type { MiddlewareDetails, PageRouteInit, PageRouteDetails, RouteDetails, LifecycleContext, ApiRoute, ParseMarkdocOpts, WildcardRedirectsTree, StaticFilePaths, RedirectOptions, McpToolRegistration, McpToolSchema, MarkdocOptions } from './types';
@@ -1 +1 @@
1
- import A from"@markdoc/markdoc";import{parseAndResolveMarkdoc as T}from"./plugins/markdown/compiler.js";import{getPathnameForLocale as M}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as O,MARKDOC_PARTIALS_DATA_KEY as m,MARKDOC_PARTIALS_DEPS_KEY as k}from"./constants/common.js";import{GATED_MARKDOC_TAGS as R}from"./constants/entitlements.js";import{isObject as L}from"../utils/guards/is-object.js";import{mapObject as H}from"../utils/object/map-object.js";import{getValueDeep as y}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as D}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as u}from"../utils/path/normalize-route-slug.js";import{isLocalLink as S}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as h}from"./tools/notifiers/logger.js";import{sha1 as F}from"./utils/crypto/sha1.js";import{envConfig as G,setEnv as _}from"./config/env-config.js";import{KvService as B}from"./persistence/kv/services/kv-service.js";import{SandboxContext as I}from"./utils/sandbox-context.js";import{writeSharedData as N}from"./utils/index.js";import{renderComponents as V}from"./ssr/render.js";import{readStaticData as q,writeStaticData as j}from"./utils/static-data.js";import{getMarkdocOptions as U}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as v}from"./entitlements/entitlements-provider.js";import{isRouteReserved as x}from"./plugins/get-reserved-routes.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as W}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as $}from"./utils/redirects/find-redirect.js";import{followRedirectChain as z}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as Y}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as Z}from"../cli/telemetry/helpers/trace-step.js";const E={routesBySlug:"map",staticFilePaths:"object",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map",skills:"map",devLogin:"object"},P="PLAN_GATES",Q=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],ke="userDefinedApiFunctions";class b{routesBySlug=new Map;staticFilePaths={};replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;skills=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};devLogin=!1;#o=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#i;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#n;userCodeReady;#s=Promise.resolve();#c;#l=Promise.resolve();#d;#h=Promise.resolve();#u;#e=!1;#r=0;#f=0;#a=new Map;constructor({outdir:e,contentDir:s,serverMode:t=!1,serverOutDir:r}){this.#i=s,this.outdir=e,this.serverMode=t,this.serverOutDir=r,I.register({serverOutDir:r,readRoots:[e,process.cwd()]}),this.userCodeReady=new Promise(a=>{this.#n=a})}on(e,s){const t=this.listeners.get(e);t?t.add(s):this.listeners.set(e,new Set([s]))}queueEvent=(e,s,...t)=>{this.#a.set(e+String(s),[e,s,...t])};runListeners=(e,s,...t)=>{for(const r of this.listeners.get(e)||new Set)s?r(s,...t):r(...t)};startPluginsRun(){this.clear(),this.#s=new Promise(e=>{this.#c=e})}waitForPluginsLifecycle(){return Promise.all([this.#s,this.#l,this.#h])}waitForPluginsRun(){return this.#s}finishPluginsRun(){this.#c?.();for(const e of this.#a.values())this.runListeners(...e);this.#a.clear()}startEsbuildRun(){this.#l=new Promise(e=>{this.#d=e})}finishEsbuildRun(){this.#d?.()}markRequestHandlersEntryOutdated(){this.#r++,!this.#e&&(this.#e=!0,this.#h=new Promise(e=>{this.#u=e}))}noteRequestHandlersEntryBuildStart(){this.#f=this.#r}markRequestHandlersEntryUpdated(){this.#e&&(this.#r>this.#f||(this.#e=!1,this.#u?.()))}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#i}markUserCodeReady(){this.#n?.(!0)}async reloadMarkdocOptions(){await Z("com.redocly.build.reloadMarkdocOptions",async()=>{const e=v.instance(),s=await U(this.serverOutDir),t=Object.fromEntries(Object.entries(s.tags).filter(([r])=>R[r]!=null?e.canAccessFeature(R[r]):!0));this.#o={...s,tags:t}})}get markdocOptions(){return{...this.#o,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const s=this.globalData,t={...this.globalData,...e};this.globalData=t,JSON.stringify(t)!==JSON.stringify(s)&&this.queueEvent("global-data-updated",void 0,t)};getGlobalData=()=>this.globalData;getKv=async()=>B.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:s,deps:t,resource:r})=>{const{data:{info:a,ast:i},compoundHash:l}=await T(e,this.markdocOptions,{actions:this,context:s},r);for(const o of a.sharedDataDeps||[]){for(const n of t?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of t?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of a.dynamicMarkdocComponents||[]){for(const n of t?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of t?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}if(t?.routeSlugs&&a.partials?.length)for(const o of t.routeSlugs){const n=this.routesPartials.get(o)||[];for(const c of a.partials)n.includes(c)||n.push(c);this.routesPartials.set(o,n)}return{info:a,ast:i,compoundHash:l}};async loadApiDocuments(e){return(await e.cache.load(".","api-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setStaticFilePaths=e=>{this.staticFilePaths=e};setGlobalConfig=e=>{const s=Object.keys(e);for(const l of s)for(const o in this.replacedEnvVars)if(o===l||o.startsWith(`${l}:`)){const n=o.split(":"),{error:c,value:d}=y(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:t,unsetEnvVars:r,replacedValues:a}=W(e);for(const l of r)this.unsetEnvVars.add(l);Object.assign(this.replacedEnvVars,a);const i=t.seo?.siteUrl?.trim();i&&(t.seo={...t.seo,siteUrl:URL.canParse(i)?new URL(i).origin:D(i)}),Object.assign(this.config,t)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,s,t={})=>{if(!v.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const i=u(e).toLowerCase();this.config.redirects[i]=s;const{trackOriginalSource:l=!0}=t,o=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(o)&&!o.includes(i)&&o.push(i),i.endsWith("*")&&Y(this.config.wildcardRedirectsTree,i)};getRedirect=e=>{const s=u(e).toLowerCase(),t=$(s,this.config.redirects,this.config.wildcardRedirectsTree,this.staticFilePaths);if(!t)return null;if(S(t.to)){const r=u(t.to).toLowerCase();if(!r.endsWith("*")&&z(r,[s],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:t.to,type:t.type}};createSharedData=async(e,s,t)=>{if(t&&this.#t[e]===t)return e;const r=JSON.stringify(s),a=t??F(r);return this.#t[e]===a||(this.#t[e]=a,await N(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,s,t)=>{const r=D(e),a=this.routesSharedData.get(r)||{};a[s]=t,this.routesSharedData.set(r,a),h.verbose(`Adding shared data to ${e}, ${s}, ${t}`)};getRouteSharedDataByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.routesSharedData.get(s)||{}:{}};getPartialsForRoute=e=>{const s=this.getGlobalConfig(m)||{},t=this.routesPartials.get(e);if(!t||t.length===0)return{};const r=this.getGlobalConfig(k)||{},a=new Set(t),i=Array.from(t);for(let o=0;o<i.length;o++){const n=i[o],c=r[n]?.partials??[];for(const d of c)a.has(d)||(a.add(d),i.push(d))}const l={};for(const o of a)s[o]&&(l[o]=s[o]);return l};addRoute=e=>{const t={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:t}),h.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,s,t)=>{const r=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=M(e,g,a.code,r);this.addRouteSharedData(i,s,t)}};addApiRoute=e=>{this.apiRoutes.push(e),h.verbose("Created API route %s",e.slug)};addMcpTools=(e,s)=>{for(const t of s){const r=this.mcpToolHandlers.get(t.name);r&&r.importPath!==e&&h.warn('MCP tool "%s" from %s overwrites the tool registered from %s',t.name,e,r.importPath),this.mcpToolHandlers.set(t.name,{...t,importPath:e}),h.verbose("Created MCP tool %s",t.name)}};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());markGatedMcpTools=e=>{for(const s of e){const t=this.mcpToolHandlers.get(s);t&&this.mcpToolHandlers.set(s,{...t,hasAvailabilityGate:!0})}};addSkills=e=>{for(const s of e)this.skills.set(s.slug,s),h.verbose("Discovered skill %s",s.slug)};getSkills=()=>Array.from(this.skills.values());removeMcpTools=e=>{for(const s of e)this.mcpToolHandlers.delete(s)};addMiddleware=e=>{this.middleware.push(e),h.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,s)=>{this.config.responseHeaders||(this.config.responseHeaders={});const t=new Set(s.map(i=>i.name.toLowerCase())),a=[...(this.config.responseHeaders[e]??[]).filter(i=>!t.has(i.name.toLowerCase())),...s];this.config.responseHeaders[e]=a};getRouteByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.getRouteBySlug(s):void 0};getRouteBySlug=(e,s={})=>{const{followRedirect:t=!0}=s,r=this.getRedirect(e);return t&&r?this.routesBySlug.get(u(r.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e)||x(e,this.getConfig()))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!S(s.to))return!0;const t=u(s.to);return this.routesBySlug.has(t)};getRoutesByTemplateId=e=>this.newRoutes.filter(s=>s.templateId===e);getAllRoutesForLocale=(e=g)=>{const s=Array.from(this.routesBySlug.values()),t=e.toLowerCase();return s.filter(r=>e===g?!K(r.fsPath):r.slug.startsWith(`/${t}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,s)=>(this.templates.set(e,s),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,s)=>(this.apiRoutesRequestHandlers.set(e,s),e);clearRequestHandlersByPrefix=e=>{for(const s of this.apiRoutesRequestHandlers.keys())s.startsWith(e)&&this.apiRoutesRequestHandlers.delete(s)};registerServerPropsGetter=(e,s)=>(this.serverPropsGetters.set(e,s),e);registerPagePropsGetter=(e,s)=>{this.pagePropsGetters.set(e,s)};async writeRouteStaticData(e,s){const t=await this.resolveRouteStaticData(e,s,!1);t&&j(e.slug,t,this.outdir)}async resolveRouteStaticData(e,s,t){if(this.serverMode)return q(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>i.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const o=this.getGlobalConfig("seo"),n=a?.frontmatter||{};return{...a,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:O,...o,...a.props?.seo,siteUrl:o?.siteUrl},compilationErrors:this.compilationErrors},lastModified:t||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,s){if(!e?.length)return;const t=typeof e[0]=="string"?e.join(""):V(e);t&&(s==="head"?this.ssr.headTags.push(t):s==="preBody"?this.ssr.preBodyTags.push(t):this.ssr.postBodyTags.push(t))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.skills.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[t,r]of Object.entries(E))switch(r){case"map":{const a=Array.from(this[t].entries());e.push([t,a]);break}case"object":if(t==="config"){e.push([t,await this.getConfigWithEnvPlaceholders()]);break}e.push([t,this[t]]);break;default:throw new Error("Invalid format")}const s=Object.fromEntries(e);return s[P]=G.PLAN_GATES,s}static fromJson(e,s){const t=new b(s);for(const[a,i]of Object.entries(E))switch(i){case"map":t[a]=new Map(e[a]);break;case"object":if(a==="config"){t.setGlobalConfig(e[a]);break}t[a]=e[a];break;default:throw new Error("Invalid format")}t.config[m]=X(t.config[m]||{});const r=e[P];return r&&_("PLAN_GATES",r),t}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const s in this.replacedEnvVars){const{original:t}=this.replacedEnvVars[s],r=s.split(":"),a=r.pop(),{error:i,value:l}=y(e,r);if(i||!L(l)&&!Array.isArray(l)){await w.panicOnBuild(`Failed to replace env var with env name for ${s}`);continue}l[a]=t}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(t=>!Q.includes(t));if(e.length===0)return;const s=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await w.panicOnBuildContentError(s)}}function X(C){return H(C,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{b as Store,ke as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
1
+ import A from"@redocly/markdoc";import{parseAndResolveMarkdoc as T}from"./plugins/markdown/compiler.js";import{getPathnameForLocale as M}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as O,MARKDOC_PARTIALS_DATA_KEY as m,MARKDOC_PARTIALS_DEPS_KEY as k}from"./constants/common.js";import{GATED_MARKDOC_TAGS as R}from"./constants/entitlements.js";import{isObject as L}from"../utils/guards/is-object.js";import{mapObject as H}from"../utils/object/map-object.js";import{getValueDeep as y}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as D}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as u}from"../utils/path/normalize-route-slug.js";import{isLocalLink as S}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as h}from"./tools/notifiers/logger.js";import{sha1 as F}from"./utils/crypto/sha1.js";import{envConfig as G,setEnv as _}from"./config/env-config.js";import{KvService as B}from"./persistence/kv/services/kv-service.js";import{SandboxContext as I}from"./utils/sandbox-context.js";import{writeSharedData as N}from"./utils/index.js";import{renderComponents as V}from"./ssr/render.js";import{readStaticData as q,writeStaticData as j}from"./utils/static-data.js";import{getMarkdocOptions as U}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as v}from"./entitlements/entitlements-provider.js";import{isRouteReserved as x}from"./plugins/get-reserved-routes.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as W}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as $}from"./utils/redirects/find-redirect.js";import{followRedirectChain as z}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as Y}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as Z}from"../cli/telemetry/helpers/trace-step.js";const E={routesBySlug:"map",staticFilePaths:"object",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map",skills:"map",devLogin:"object"},P="PLAN_GATES",Q=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],ke="userDefinedApiFunctions";class b{routesBySlug=new Map;staticFilePaths={};replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;skills=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};devLogin=!1;#o=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#i;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#n;userCodeReady;#s=Promise.resolve();#c;#l=Promise.resolve();#d;#h=Promise.resolve();#u;#e=!1;#r=0;#f=0;#a=new Map;constructor({outdir:e,contentDir:s,serverMode:t=!1,serverOutDir:r}){this.#i=s,this.outdir=e,this.serverMode=t,this.serverOutDir=r,I.register({serverOutDir:r,readRoots:[e,process.cwd()]}),this.userCodeReady=new Promise(a=>{this.#n=a})}on(e,s){const t=this.listeners.get(e);t?t.add(s):this.listeners.set(e,new Set([s]))}queueEvent=(e,s,...t)=>{this.#a.set(e+String(s),[e,s,...t])};runListeners=(e,s,...t)=>{for(const r of this.listeners.get(e)||new Set)s?r(s,...t):r(...t)};startPluginsRun(){this.clear(),this.#s=new Promise(e=>{this.#c=e})}waitForPluginsLifecycle(){return Promise.all([this.#s,this.#l,this.#h])}waitForPluginsRun(){return this.#s}finishPluginsRun(){this.#c?.();for(const e of this.#a.values())this.runListeners(...e);this.#a.clear()}startEsbuildRun(){this.#l=new Promise(e=>{this.#d=e})}finishEsbuildRun(){this.#d?.()}markRequestHandlersEntryOutdated(){this.#r++,!this.#e&&(this.#e=!0,this.#h=new Promise(e=>{this.#u=e}))}noteRequestHandlersEntryBuildStart(){this.#f=this.#r}markRequestHandlersEntryUpdated(){this.#e&&(this.#r>this.#f||(this.#e=!1,this.#u?.()))}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#i}markUserCodeReady(){this.#n?.(!0)}async reloadMarkdocOptions(){await Z("com.redocly.build.reloadMarkdocOptions",async()=>{const e=v.instance(),s=await U(this.serverOutDir),t=Object.fromEntries(Object.entries(s.tags).filter(([r])=>R[r]!=null?e.canAccessFeature(R[r]):!0));this.#o={...s,tags:t}})}get markdocOptions(){return{...this.#o,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const s=this.globalData,t={...this.globalData,...e};this.globalData=t,JSON.stringify(t)!==JSON.stringify(s)&&this.queueEvent("global-data-updated",void 0,t)};getGlobalData=()=>this.globalData;getKv=async()=>B.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:s,deps:t,resource:r})=>{const{data:{info:a,ast:i},compoundHash:l}=await T(e,this.markdocOptions,{actions:this,context:s},r);for(const o of a.sharedDataDeps||[]){for(const n of t?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of t?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of a.dynamicMarkdocComponents||[]){for(const n of t?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of t?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}if(t?.routeSlugs&&a.partials?.length)for(const o of t.routeSlugs){const n=this.routesPartials.get(o)||[];for(const c of a.partials)n.includes(c)||n.push(c);this.routesPartials.set(o,n)}return{info:a,ast:i,compoundHash:l}};async loadApiDocuments(e){return(await e.cache.load(".","api-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setStaticFilePaths=e=>{this.staticFilePaths=e};setGlobalConfig=e=>{const s=Object.keys(e);for(const l of s)for(const o in this.replacedEnvVars)if(o===l||o.startsWith(`${l}:`)){const n=o.split(":"),{error:c,value:d}=y(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:t,unsetEnvVars:r,replacedValues:a}=W(e);for(const l of r)this.unsetEnvVars.add(l);Object.assign(this.replacedEnvVars,a);const i=t.seo?.siteUrl?.trim();i&&(t.seo={...t.seo,siteUrl:URL.canParse(i)?new URL(i).origin:D(i)}),Object.assign(this.config,t)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,s,t={})=>{if(!v.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const i=u(e).toLowerCase();this.config.redirects[i]=s;const{trackOriginalSource:l=!0}=t,o=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(o)&&!o.includes(i)&&o.push(i),i.endsWith("*")&&Y(this.config.wildcardRedirectsTree,i)};getRedirect=e=>{const s=u(e).toLowerCase(),t=$(s,this.config.redirects,this.config.wildcardRedirectsTree,this.staticFilePaths);if(!t)return null;if(S(t.to)){const r=u(t.to).toLowerCase();if(!r.endsWith("*")&&z(r,[s],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:t.to,type:t.type}};createSharedData=async(e,s,t)=>{if(t&&this.#t[e]===t)return e;const r=JSON.stringify(s),a=t??F(r);return this.#t[e]===a||(this.#t[e]=a,await N(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,s,t)=>{const r=D(e),a=this.routesSharedData.get(r)||{};a[s]=t,this.routesSharedData.set(r,a),h.verbose(`Adding shared data to ${e}, ${s}, ${t}`)};getRouteSharedDataByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.routesSharedData.get(s)||{}:{}};getPartialsForRoute=e=>{const s=this.getGlobalConfig(m)||{},t=this.routesPartials.get(e);if(!t||t.length===0)return{};const r=this.getGlobalConfig(k)||{},a=new Set(t),i=Array.from(t);for(let o=0;o<i.length;o++){const n=i[o],c=r[n]?.partials??[];for(const d of c)a.has(d)||(a.add(d),i.push(d))}const l={};for(const o of a)s[o]&&(l[o]=s[o]);return l};addRoute=e=>{const t={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:t}),h.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,s,t)=>{const r=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=M(e,g,a.code,r);this.addRouteSharedData(i,s,t)}};addApiRoute=e=>{this.apiRoutes.push(e),h.verbose("Created API route %s",e.slug)};addMcpTools=(e,s)=>{for(const t of s){const r=this.mcpToolHandlers.get(t.name);r&&r.importPath!==e&&h.warn('MCP tool "%s" from %s overwrites the tool registered from %s',t.name,e,r.importPath),this.mcpToolHandlers.set(t.name,{...t,importPath:e}),h.verbose("Created MCP tool %s",t.name)}};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());markGatedMcpTools=e=>{for(const s of e){const t=this.mcpToolHandlers.get(s);t&&this.mcpToolHandlers.set(s,{...t,hasAvailabilityGate:!0})}};addSkills=e=>{for(const s of e)this.skills.set(s.slug,s),h.verbose("Discovered skill %s",s.slug)};getSkills=()=>Array.from(this.skills.values());removeMcpTools=e=>{for(const s of e)this.mcpToolHandlers.delete(s)};addMiddleware=e=>{this.middleware.push(e),h.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,s)=>{this.config.responseHeaders||(this.config.responseHeaders={});const t=new Set(s.map(i=>i.name.toLowerCase())),a=[...(this.config.responseHeaders[e]??[]).filter(i=>!t.has(i.name.toLowerCase())),...s];this.config.responseHeaders[e]=a};getRouteByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.getRouteBySlug(s):void 0};getRouteBySlug=(e,s={})=>{const{followRedirect:t=!0}=s,r=this.getRedirect(e);return t&&r?this.routesBySlug.get(u(r.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e)||x(e,this.getConfig()))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!S(s.to))return!0;const t=u(s.to);return this.routesBySlug.has(t)};getRoutesByTemplateId=e=>this.newRoutes.filter(s=>s.templateId===e);getAllRoutesForLocale=(e=g)=>{const s=Array.from(this.routesBySlug.values()),t=e.toLowerCase();return s.filter(r=>e===g?!K(r.fsPath):r.slug.startsWith(`/${t}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,s)=>(this.templates.set(e,s),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,s)=>(this.apiRoutesRequestHandlers.set(e,s),e);clearRequestHandlersByPrefix=e=>{for(const s of this.apiRoutesRequestHandlers.keys())s.startsWith(e)&&this.apiRoutesRequestHandlers.delete(s)};registerServerPropsGetter=(e,s)=>(this.serverPropsGetters.set(e,s),e);registerPagePropsGetter=(e,s)=>{this.pagePropsGetters.set(e,s)};async writeRouteStaticData(e,s){const t=await this.resolveRouteStaticData(e,s,!1);t&&j(e.slug,t,this.outdir)}async resolveRouteStaticData(e,s,t){if(this.serverMode)return q(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>i.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const o=this.getGlobalConfig("seo"),n=a?.frontmatter||{};return{...a,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:O,...o,...a.props?.seo,siteUrl:o?.siteUrl},compilationErrors:this.compilationErrors},lastModified:t||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,s){if(!e?.length)return;const t=typeof e[0]=="string"?e.join(""):V(e);t&&(s==="head"?this.ssr.headTags.push(t):s==="preBody"?this.ssr.preBodyTags.push(t):this.ssr.postBodyTags.push(t))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.skills.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[t,r]of Object.entries(E))switch(r){case"map":{const a=Array.from(this[t].entries());e.push([t,a]);break}case"object":if(t==="config"){e.push([t,await this.getConfigWithEnvPlaceholders()]);break}e.push([t,this[t]]);break;default:throw new Error("Invalid format")}const s=Object.fromEntries(e);return s[P]=G.PLAN_GATES,s}static fromJson(e,s){const t=new b(s);for(const[a,i]of Object.entries(E))switch(i){case"map":t[a]=new Map(e[a]);break;case"object":if(a==="config"){t.setGlobalConfig(e[a]);break}t[a]=e[a];break;default:throw new Error("Invalid format")}t.config[m]=X(t.config[m]||{});const r=e[P];return r&&_("PLAN_GATES",r),t}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const s in this.replacedEnvVars){const{original:t}=this.replacedEnvVars[s],r=s.split(":"),a=r.pop(),{error:i,value:l}=y(e,r);if(i||!L(l)&&!Array.isArray(l)){await w.panicOnBuild(`Failed to replace env var with env name for ${s}`);continue}l[a]=t}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(t=>!Q.includes(t));if(e.length===0)return;const s=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await w.panicOnBuildContentError(s)}}function X(C){return H(C,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{b as Store,ke as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
@@ -1,3 +1,3 @@
1
- import*as E from"node:path";import{envConfig as R}from"../../config/env-config.js";import{maskEmail as T}from"./helpers/privacy/mask-email.js";import{maskSubject as C}from"./helpers/privacy/mask-subject.js";import{removePii as w}from"./helpers/privacy/remove-pii.js";import{removePiiFromUrl as $}from"./helpers/privacy/remove-pii-from-url.js";import{red as x,green as A,bold as F,blue as l,gray as i,yellow as b,cyan as v}from"./helpers/colors.js";function P(e,r){return r?e:w(e)}var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const I={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function L(e,r){return I[e]>=I[r]}function G(e){if(!e)return;const r=e.toUpperCase();if(r in n)return r}const H={[n.INFO]:l,[n.SUCCESS]:A,[n.WARN]:b,[n.ERROR]:x,[n.HTTP]:v,[n.VERBOSE]:i},N={"%ap":e=>l(E.resolve(e)),"%rp":e=>l(E.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>l(e)},M={format(e){return R.REDOCLY_LOG_FORMAT==="JSON"?y(e):U(e)},interpolate(e,...r){const u=Object.keys(N).map(a=>`(${a})`).join("|"),o=new RegExp(u,"g");let s,m=e;for(;(s=o.exec(e))!==null;){s.index===o.lastIndex&&o.lastIndex++;const a=r.shift();if(a===void 0)break;const t=s[0];m=m.replace(t,N[t](a))}return m}};var Y=M;const U=e=>{const{level:r,message:u,duration:o,context:s,preSanitized:m}=e,a=R.isRuntimeMode,t=[H[r](F(`[${r.toLowerCase()}]`))];if(a&&t.push(i(`time="${j()}"`)),s){const{email:c,ipAddress:f,subject:d,method:S,pathname:p,statusCode:h,teams:g,apiFunction:O}=s;O&&t.push(l(`fn="${O}"`)),h&&t.push(D(h)),e.level===n.HTTP&&(S&&t.push(i(`method="${S}"`)),p&&t.push(i(`path="${$(p)}"`))),f&&t.push(i(`ip="${f}"`)),c&&t.push(i(`email="${T(c)}"`)),d&&t.push(i(`sub="${C(d)}"`)),g?.length&&t.push(i(`teams="${g.join(", ")}"`))}if(u){const c=a?`msg="${String(P(u,m)).replaceAll?.('"','\\"')}"`:String(u);t.push(c)}return e.level===n.HTTP&&s?.userAgent&&t.push(i(`agent="${s.userAgent}"`)),o&&t.push(V(o)),t.join(" ")+`
2
- `},y=({context:e,message:r,preSanitized:u,...o})=>{const{method:s,pathname:m,statusCode:a,userAgent:t,subject:c,email:f,teams:d,apiFunction:S}=e||{},p={...o,email:f&&T(f),subject:c&&C(c),teams:d,apiFunction:S,...o.level===n.HTTP?{method:s,pathname:String($(m)),statusCode:a,userAgent:t}:{message:String(P(String(r??""),u))}};return R.isRuntimeMode&&(p.time=j()),JSON.stringify(p,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
3
- `},D=e=>(e%500<100?x:e%400<100?b:A)(`status="${e}"`),j=()=>{const e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},V=e=>i(`dur="${Math.round(e)}ms"`);export{n as LogLevel,Y as default,G as parseLogLevel,L as shouldLog};
1
+ import*as E from"node:path";import{envConfig as R}from"../../config/env-config.js";import{maskEmail as T,maskSubject as C,removePii as w,removePiiFromUrl as $}from"../../../compiled/@redocly/pii/index.js";import{red as x,green as A,bold as F,blue as l,gray as r,yellow as b,cyan as v}from"./helpers/colors.js";function P(e,s){return s?e:w(e)}var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const I={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function J(e,s){return I[e]>=I[s]}function W(e){if(!e)return;const s=e.toUpperCase();if(s in n)return s}const H={[n.INFO]:l,[n.SUCCESS]:A,[n.WARN]:b,[n.ERROR]:x,[n.HTTP]:v,[n.VERBOSE]:r},N={"%ap":e=>l(E.resolve(e)),"%rp":e=>l(E.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>l(e)},M={format(e){return R.REDOCLY_LOG_FORMAT==="JSON"?y(e):U(e)},interpolate(e,...s){const u=Object.keys(N).map(a=>`(${a})`).join("|"),o=new RegExp(u,"g");let i,c=e;for(;(i=o.exec(e))!==null;){i.index===o.lastIndex&&o.lastIndex++;const a=s.shift();if(a===void 0)break;const t=i[0];c=c.replace(t,N[t](a))}return c}};var z=M;const U=e=>{const{level:s,message:u,duration:o,context:i,preSanitized:c}=e,a=R.isRuntimeMode,t=[H[s](F(`[${s.toLowerCase()}]`))];if(a&&t.push(r(`time="${j()}"`)),i){const{email:m,ipAddress:f,subject:d,method:S,pathname:p,statusCode:h,teams:g,apiFunction:O}=i;O&&t.push(l(`fn="${O}"`)),h&&t.push(D(h)),e.level===n.HTTP&&(S&&t.push(r(`method="${S}"`)),p&&t.push(r(`path="${$(p)}"`))),f&&t.push(r(`ip="${f}"`)),m&&t.push(r(`email="${T(m)}"`)),d&&t.push(r(`sub="${C(d)}"`)),g?.length&&t.push(r(`teams="${g.join(", ")}"`))}if(u){const m=a?`msg="${String(P(u,c)).replaceAll?.('"','\\"')}"`:String(u);t.push(m)}return e.level===n.HTTP&&i?.userAgent&&t.push(r(`agent="${i.userAgent}"`)),o&&t.push(V(o)),t.join(" ")+`
2
+ `},y=({context:e,message:s,preSanitized:u,...o})=>{const{method:i,pathname:c,statusCode:a,userAgent:t,subject:m,email:f,teams:d,apiFunction:S}=e||{},p={...o,email:f&&T(f),subject:m&&C(m),teams:d,apiFunction:S,...o.level===n.HTTP?{method:i,pathname:String($(c)),statusCode:a,userAgent:t}:{message:String(P(String(s??""),u))}};return R.isRuntimeMode&&(p.time=j()),JSON.stringify(p,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
3
+ `},D=e=>(e%500<100?x:e%400<100?b:A)(`status="${e}"`),j=()=>{const e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},V=e=>r(`dur="${Math.round(e)}ms"`);export{n as LogLevel,z as default,W as parseLogLevel,J as shouldLog};
@@ -1,7 +1,7 @@
1
1
  import type { REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC, RbacScopeItems, RedirectConfig, RedoclyConfig, ServerPropsContext, ServerPropsRequest, PageProps, PageStaticData, NavItem, ResolvedNavItem, Version, MdOptions, KvService } from '@redocly/config';
2
2
  import type { JSX } from 'react';
3
3
  import type { JSONSchemaType } from '@redocly/ajv';
4
- import type { Node } from '@markdoc/markdoc';
4
+ import type { Node } from '@redocly/markdoc';
5
5
  import type { ProductConfig } from '@redocly/theme/config';
6
6
  import type { SearchFacet } from '@redocly/theme/core/types';
7
7
  import type { GlobalData, Feature } from '../../../types/index.js';
@@ -1,4 +1,4 @@
1
- import type { LocationEdge } from '@markdoc/markdoc';
1
+ import type { LocationEdge } from '@redocly/markdoc';
2
2
  import type { NormalizedLocation } from '../../plugins/markdown/errors';
3
3
  export declare function getCodeframe(location: NormalizedLocation, color: boolean, indent?: string): {
4
4
  frame: string;
@@ -1,4 +1,4 @@
1
- import type { LocationEdge } from '@markdoc/markdoc';
1
+ import type { LocationEdge } from '@redocly/markdoc';
2
2
  export declare function getYamlLocationByPointer(source: string, pointer: (string | number)[], reportOnKey?: boolean): {
3
3
  start: Required<LocationEdge>;
4
4
  end: Required<LocationEdge>;
@@ -1,4 +1,4 @@
1
- import type { LocationEdge } from '@markdoc/markdoc';
1
+ import type { LocationEdge } from '@redocly/markdoc';
2
2
  import type { MARKDOC_ERROR_TYPES } from '../constants/common.js';
3
3
  export type ErrorSeverity = 'PANIC' | 'ERROR';
4
4
  export type CommonError = {
@@ -1,4 +1,4 @@
1
- import type { Node, Variable, RenderableTreeNode, Function } from '@markdoc/markdoc';
1
+ import type { Node, Variable, RenderableTreeNode, Function } from '@redocly/markdoc';
2
2
  import type { RenderForLlmsRenderContext } from '@redocly/theme/markdoc/tags/types';
3
3
  export type RenderTagFn = (node: Node, context: RenderForLlmsRenderContext) => string | undefined;
4
4
  export type GetInnerContentFnOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/redoc-reef",
3
- "version": "0.140.0-next.4",
3
+ "version": "0.140.0-next.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "@hono/zod-validator": "0.8.0",
21
21
  "@jitl/quickjs-singlefile-mjs-release-sync": "0.32.0",
22
22
  "@libsql/client": "0.17.3",
23
- "@markdoc/markdoc": "0.5.2",
23
+ "@markdoc/markdoc": "npm:@redocly/markdoc@0.7.0-beta.2",
24
24
  "@modelcontextprotocol/server": "2.0.0",
25
25
  "@opentelemetry/api": "1.9.1",
26
26
  "@opentelemetry/context-zone": "2.0.1",
@@ -33,13 +33,14 @@
33
33
  "@opentelemetry/sdk-trace-web": "2.8.0",
34
34
  "@opentelemetry/semantic-conventions": "1.40.0",
35
35
  "@redocly/ajv": "8.18.0",
36
- "@redocly/api-docs": "0.5.0-next.2",
37
- "@redocly/config": "0.67.0",
38
- "@redocly/openapi-core": "2.66.0",
36
+ "@redocly/api-docs": "0.5.0-next.4",
37
+ "@redocly/config": "0.68.0",
38
+ "@redocly/markdoc": "0.7.0-beta.2",
39
+ "@redocly/openapi-core": "2.71.1",
39
40
  "@redocly/portal-legacy-ui": "0.19.0",
40
- "@redocly/portal-plugin-mock-server": "0.24.0",
41
+ "@redocly/portal-plugin-mock-server": "0.25.0-next.1",
41
42
  "@redocly/realm-asyncapi-sdk": "0.17.0",
42
- "@redocly/theme": "0.72.0-next.1",
43
+ "@redocly/theme": "0.72.0-next.3",
43
44
  "@shikijs/transformers": "3.21.0",
44
45
  "@tanstack/react-query": "5.62.3",
45
46
  "@tanstack/react-table": "8.21.3",
@@ -62,7 +63,6 @@
62
63
  "flexsearch": "0.7.43",
63
64
  "graphql": "16.14.2",
64
65
  "hono": "4.13.13",
65
- "htmlparser2": "8.0.2",
66
66
  "i18next": "22.4.15",
67
67
  "is-glob": "4.0.3",
68
68
  "js-yaml": "4.3.2",
@@ -1,6 +0,0 @@
1
- export declare function getJsxConvertedAttributes(attrs: {
2
- [key: string]: string;
3
- }, tagName?: string): {
4
- [key: string]: string | boolean | object;
5
- };
6
- //# sourceMappingURL=html-jsx-attribute-mapping.d.ts.map
@@ -1 +0,0 @@
1
- const a={for:"htmlFor",class:"className","accept-charset":"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classID",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang","http-equiv":"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",autocapitalize:"autoCapitalize",autocorrect:"autoCorrect",autosave:"autoSave",itemprop:"itemProp",itemscope:"itemScope",itemtype:"itemType",itemid:"itemID",itemref:"itemRef","accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","arabic-form":"arabicForm","baseline-shift":"baselineShift","cap-height":"capHeight","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","color-profile":"colorProfile","color-rendering":"colorRendering","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","font-family":"fontFamily","font-size":"fontSize","font-size-adjust":"fontSizeAdjust","font-stretch":"fontStretch","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","glyph-name":"glyphName","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","horiz-adv-x":"horizAdvX","horiz-origin-x":"horizOriginX","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","overline-position":"overlinePosition","overline-thickness":"overlineThickness","paint-order":"paintOrder","panose-1":"panose1","pointer-events":"pointerEvents","rendering-intent":"renderingIntent","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","strikethrough-position":"strikethroughPosition","strikethrough-thickness":"strikethroughThickness","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","underline-position":"underlinePosition","underline-thickness":"underlineThickness","unicode-bidi":"unicodeBidi","unicode-range":"unicodeRange","units-per-em":"unitsPerEm","v-alphabetic":"vAlphabetic","v-hanging":"vHanging","v-ideographic":"vIdeographic","v-mathematical":"vMathematical","vector-effect":"vectorEffect","vert-adv-y":"vertAdvY","vert-origin-x":"vertOriginX","vert-origin-y":"vertOriginY","word-spacing":"wordSpacing","writing-mode":"writingMode","x-height":"xHeight","xlink:actuate":"xlinkActuate","xlink:arcrole":"xlinkArcrole","xlink:href":"xlinkHref","xlink:role":"xlinkRole","xlink:show":"xlinkShow","xlink:title":"xlinkTitle","xlink:type":"xlinkType","xml:base":"xmlBase","xmlns:xlink":"xmlnsXlink","xml:lang":"xmlLang","xml:space":"xmlSpace"};function s(r,t){const e={};for(const[i,n]of Object.entries(r))switch(i){case"value":t==="input"||t==="textarea"?e.defaultValue=n:e.value=n;break;case"checked":t==="input"?e.defaultChecked=!0:e.checked=n;break;case"style":e.style=c(n);break;default:e[a[i]||i]=n}return e}function l(r){return r.match(/^--/)?r:r.replace(/-[a-z]/g,t=>t[1].toUpperCase())}function c(r){return r.split(";").filter(t=>t.trim().length).reduce((t,e)=>{const i=e.indexOf(":"),n=i===-1?e:e.slice(0,i),o=i===-1?"":e.slice(i+1);return t[l(n.trim())]=o.trim(),t},{})}export{s as getJsxConvertedAttributes};
@@ -1,2 +0,0 @@
1
- export declare function processHtmlTokens(tokens: any): any[];
2
- //# sourceMappingURL=process-html-tokens.d.ts.map
@@ -1 +0,0 @@
1
- import{Parser as p}from"htmlparser2";import{getJsxConvertedAttributes as i}from"./html-jsx-attribute-mapping.js";function l(r){const e=[],n=[];let o=null;const s=new p({onopentag(t,a){n.push({name:t,token:o}),e.push({type:"tag_open",nesting:1,meta:{tag:"html",attributes:[{type:"attribute",name:"name",value:t},{type:"attribute",name:"attrs",value:i(a,t)}]}})},ontext(t){t?.trim().length>0&&e.push({type:"text",content:t})},onclosetag(){n.pop(),e.push({type:"tag_close",nesting:-1,meta:{tag:"html"}})}});for(const t of r){if(t.type.startsWith("html")){o=t,s.write(t.content);continue}t.type==="inline"&&(t.children=l(t.children)),e.push(t)}for(const t of n)e.push({type:"error",meta:{error:{message:`HTML tag <${t.name}> is not closed, opened at`,location:t?.token?.map?{start:{line:t.token.map[0]},end:{line:t.token.map[1]}}:void 0}}}),e.push({type:"tag_close",nesting:-1,meta:{tag:"html"}});return e}export{l as processHtmlTokens};
@@ -1,4 +0,0 @@
1
- import type { Node } from '@markdoc/markdoc';
2
- export declare function getSourceRange(node: Node, linesOfCode: string[]): any;
3
- export declare function hashSourceContent(content: string): string;
4
- //# sourceMappingURL=source.d.ts.map
@@ -1 +0,0 @@
1
- function s(e,t){if(e.lines.length===0)return"";let l="",i=[];if(e.location){const n=e.lines[0]+1;if(l+=`#L${n}`,n!==e.lines[e.lines.length-1]){const r=e.lines[e.lines.length-1];l+=`-L${e.lines[e.lines.length-1]}`,i=t.slice(n-1,r)}else i=[t[n-1]]}return{range:l,source:i}}function h(e){let t=5381,l=e.length;for(;l;)t=t*33^e.charCodeAt(--l);return(t>>>0).toString(16)}export{s as getSourceRange,h as hashSourceContent};
@@ -1,25 +0,0 @@
1
- /**
2
- * Masks the username part of an email address for privacy or anonymization.
3
- *
4
- * The function preserves the domain while replacing most characters in the username
5
- * with asterisks (`*`). It keeps the first two characters visible when the username
6
- * is longer than two characters. If the input is invalid or not a string containing
7
- * an `@` symbol, it returns the original value unchanged.
8
- *
9
- * @example
10
- * ```ts
11
- * maskEmail("john.doe@example.com");
12
- * // → "jo******@example.com"
13
- *
14
- * maskEmail("ab@example.com");
15
- * // → "ab@example.com"
16
- *
17
- * maskEmail("a@example.com");
18
- * // → "*@example.com"
19
- * ```
20
- *
21
- * @param email - The email address to mask.
22
- * @returns A masked version of the email, or the original value if invalid.
23
- */
24
- export declare const maskEmail: (email: string) => string;
25
- //# sourceMappingURL=mask-email.d.ts.map
@@ -1 +0,0 @@
1
- const r=e=>{if(!e||typeof e!="string"||!e.includes("@"))return e;const[n,t]=e.split("@");return`${n.length>2?n.slice(0,2)+"*".repeat(n.length-2):"*".repeat(n.length)}@${t}`};export{r as maskEmail};
@@ -1,13 +0,0 @@
1
- /**
2
- * Masks all email addresses found within a given subject string.
3
- *
4
- * This utility searches the input text for any email-like patterns and replaces
5
- * each one using the {@link maskEmail} function, preserving the rest of the string.
6
- * It is typically used to sanitize or anonymize email addresses before logging,
7
- * displaying, or transmitting text content.
8
- *
9
- * @param subject - The text that may contain one or more email addresses.
10
- * @returns A new string with all detected email addresses masked.
11
- */
12
- export declare const maskSubject: (subject: string) => string;
13
- //# sourceMappingURL=mask-subject.d.ts.map
@@ -1 +0,0 @@
1
- import{maskEmail as c}from"./mask-email.js";const r=/[a-zA-Z0-9._%+-]/,m=/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/,d=e=>{let o="",i=0,a=0;for(;a<e.length;){const n=e.indexOf("@",a);if(n===-1)break;let t=n;for(;t>i&&r.test(e.charAt(t-1));)t--;const s=t<n?m.exec(e.slice(n+1))?.[0]:void 0;if(!s){a=n+1;continue}const l=n+1+s.length;o+=e.slice(i,t)+c(e.slice(t,l)),i=l,a=l}return o+e.slice(i)};export{d as maskSubject};
@@ -1,25 +0,0 @@
1
- /**
2
- * Sanitizes personally identifiable information (PII) found within a URL or query string.
3
- *
4
- * This function scans all query parameter values and removes or masks any PII using
5
- * the {@link removePii} function. It gracefully handles both absolute and relative URLs.
6
- *
7
- * - If the input is not a string, it is returned unchanged.
8
- * - If parsing as a URL fails, the function falls back to applying {@link removePii}
9
- * directly on the raw string.
10
- * - The output preserves the original format (absolute or relative).
11
- *
12
- * @example
13
- * ```ts
14
- * removePiiFromUrl('https://example.com?email=john.doe@example.com&phone=555-123-4567');
15
- * // → 'https://example.com/?email=[email_removed]&phone=[phone_removed]'
16
- *
17
- * removePiiFromUrl('/profile?ssn=123-45-6789');
18
- * // → '/profile?ssn=[SSN_removed]'
19
- * ```
20
- *
21
- * @param url - The input URL string or relative path to sanitize.
22
- * @returns A sanitized URL string with PII masked, or the input value unchanged if not a string.
23
- */
24
- export declare function removePiiFromUrl(url: unknown): unknown;
25
- //# sourceMappingURL=remove-pii-from-url.d.ts.map
@@ -1 +0,0 @@
1
- import{isString as n}from"../../../../../utils/string/is-string.js";import{removePii as e}from"./remove-pii.js";function m(t){if(!n(t))return t;try{const r=new URL(t,"http://example.com");for(const[i,s]of r.searchParams.entries()){const a=String(e(s));r.searchParams.set(i,a)}return t.startsWith("http://")||t.startsWith("https://")?r.toString():r.pathname+r.search+r.hash}catch{return String(e(t))}}export{m as removePiiFromUrl};
@@ -1,36 +0,0 @@
1
- /**
2
- * Implementation of PII sanitization from @coffeeandfun/remove-pii (MIT licensed) without unnecessary methods
3
- */
4
- type PIIConfigOption = {
5
- enabled: false;
6
- replacement?: string;
7
- pattern?: RegExp;
8
- } | {
9
- enabled: true;
10
- replacement: string;
11
- pattern?: RegExp;
12
- };
13
- type PIIConfig = {
14
- [key: string]: PIIConfigOption;
15
- };
16
- /**
17
- * Removes or masks personally identifiable information (PII) from a given text string.
18
- *
19
- * This function identifies and replaces sensitive data such as email addresses,
20
- * phone numbers, credit card numbers, and other personal identifiers with
21
- * configurable placeholder strings. It’s a lightweight implementation inspired by
22
- * `@coffeeandfun/remove-pii` (MIT licensed), keeping only the essential sanitization logic.
23
- *
24
- * By default, all common PII patterns (email, phone, SSN, credit card, address,
25
- * passport number, driver’s license, ZIP code, bank account, and date of birth)
26
- * are detected and replaced. Custom configuration can override or disable any pattern.
27
- *
28
- * Non-string inputs are returned unchanged.
29
- *
30
- * @param text - The input text that may contain personally identifiable information.
31
- * @param options - Optional configuration to enable, disable, or customize PII replacements.
32
- * @returns A sanitized string with PII masked or removed; if the input is not a string, returns it unchanged.
33
- */
34
- export declare function removePii(text: unknown, options?: PIIConfig): unknown;
35
- export {};
36
- //# sourceMappingURL=remove-pii.d.ts.map
@@ -1 +0,0 @@
1
- import{isString as m}from"../../../../../utils/string/is-string.js";const s={email:{pattern:/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,replacement:"[email_removed]"},phone:{pattern:/(?:\+?1[-.\s]?)?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})(?:\s?(?:ext|x|extension)\.?\s?(\d+))?/g,replacement:"[phone_removed]"},ssn:{pattern:/\b(?!000|666|9\d{2})\d{3}-?(?!00)\d{2}-?(?!0000)\d{4}\b/g,replacement:"[SSN_removed]"},creditCard:{pattern:/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,replacement:"[credit_card_removed]"},address:{pattern:/\b\d+\s[A-Za-z0-9\s,.-]+(?:Street|St|Avenue|Ave|Road|Rd|Boulevard|Blvd|Lane|Ln|Drive|Dr|Court|Ct|Circle|Cir|Way|Place|Pl|Parkway|Pkwy|Terrace|Ter)\b/gi,replacement:"[address_removed]"},passport:{pattern:/\b[A-Z]{2}[0-9]{7}\b/g,replacement:"[passport_number_removed]"},driversLicense:{pattern:/\b[A-Z]{1,2}[0-9]{6,9}\b/g,replacement:"[driver_license_removed]"},zipCode:{pattern:/(?<!\d-)\b\d{5}(?:-\d{4})?\b(?!-\d)/g,replacement:"[zip_code_removed]"},bankAccount:{pattern:/\b\d{8,17}\b/g,replacement:"[bank_account_removed]"},dateOfBirth:{pattern:/\b(?:0[1-9]|1[0-2])[-/](?:0[1-9]|[12][0-9]|3[01])[-/](?:19|20)\d{2}\b/g,replacement:"[date_removed]"}};function l(n={}){const e={email:{enabled:!0,replacement:"[email_removed]"},phone:{enabled:!0,replacement:"[phone_removed]"},ssn:{enabled:!0,replacement:"[SSN_removed]"},creditCard:{enabled:!0,replacement:"[credit_card_removed]"},address:{enabled:!0,replacement:"[address_removed]"},passport:{enabled:!0,replacement:"[passport_number_removed]"},driversLicense:{enabled:!0,replacement:"[driver_license_removed]"},zipCode:{enabled:!0,replacement:"[zip_code_removed]"},bankAccount:{enabled:!0,replacement:"[bank_account_removed]"},dateOfBirth:{enabled:!0,replacement:"[date_removed]"}};for(const[r,t]of Object.entries(n))e[r]?e[r]={...e[r],...t}:e[r]=t;return e}function b(n,e={}){if(!m(n))return n;const r=l(e);let t=n;for(const[c,a]of Object.entries(r)){if(!a.enabled)continue;const d=s[c],o=d?.pattern||a.pattern,p=a.replacement||d?.replacement||"[PII removed]";o&&(t=t.replace(o,p))}return t}export{b as removePii};