@redocly/realm 0.134.0-next.6 → 0.134.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/server/plugins/openapi-docs/ai-search-indexer.d.ts +5 -2
- package/dist/server/plugins/openapi-docs/ai-search-indexer.js +1 -1
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +52 -50
- package/dist/server/plugins/openapi-docs/types.d.ts +11 -0
- package/dist/server/plugins/openapi-docs/utils.d.ts +6 -1
- package/dist/server/plugins/openapi-docs/utils.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.134.0-next.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fb00f8a1283: Fixed an issue where schema fields inside `oneOf`, `anyOf`, or behind a `discriminator` weren't rendering in `llms.txt` API description pages.
|
|
8
|
+
|
|
9
|
+
## 0.134.0-next.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c57df6366d5: Fixed page navigation buttons stretching excessively on large screens.
|
|
14
|
+
- c9c79a6716b: Fixed security vulnerabilities `CVE-2026-47675`, `CVE-2026-47676`, `CVE-2026-47673`, `CVE-2026-47674` by upgrading `hono` to version `4.12.23`.
|
|
15
|
+
- Updated dependencies [c57df6366d5]
|
|
16
|
+
- @redocly/theme@0.66.0-next.5
|
|
17
|
+
- @redocly/asyncapi-docs@1.11.0-next.6
|
|
18
|
+
- @redocly/graphql-docs@1.11.0-next.6
|
|
19
|
+
- @redocly/openapi-docs@3.22.0-next.6
|
|
20
|
+
- @redocly/portal-plugin-mock-server@0.19.0-next.6
|
|
21
|
+
|
|
3
22
|
## 0.134.0-next.6
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentItemModel, OpenAPIParser, OperationModel, Options, SchemaModel } from '@redocly/openapi-docs';
|
|
2
2
|
import type { OperationParameter } from '@redocly/theme/core/types';
|
|
3
3
|
import type { SearchDocument } from '../../types';
|
|
4
4
|
import { OpenApiSearchBuilder } from './openapi-search-builder.js';
|
|
5
|
+
type Parameters = Record<string, OperationParameter>;
|
|
5
6
|
export declare class AiSearchIndexer extends OpenApiSearchBuilder {
|
|
7
|
+
#private;
|
|
6
8
|
constructor(parser: OpenAPIParser, options: Options, basePath: string);
|
|
7
9
|
addItem(item: ContentItemModel): SearchDocument | undefined;
|
|
8
10
|
protected buildOperationDocument(operation: OperationModel): SearchDocument | undefined;
|
|
9
|
-
protected addSchema(parameters:
|
|
11
|
+
protected addSchema(parameters: Parameters, schema: SchemaModel | undefined, mediaType: string | undefined, place: string, isResponse: boolean, path?: string[], visited?: Set<string>, level?: number, skipFields?: Set<string>): void;
|
|
10
12
|
}
|
|
13
|
+
export {};
|
|
11
14
|
//# sourceMappingURL=ai-search-indexer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{OpenApiSearchBuilder as h}from"./openapi-search-builder.js";import{getOneOfSchema as O}from"./utils.js";class y extends h{constructor(t,e,n){super(t,e,n)}addItem(t){try{return this.buildSearchDocument(t)}catch(e){console.error("Cannot add item to AI search indexer",e.message);return}}buildOperationDocument(t){const e=this.createOperationDocumentBase(t),n=e?.parameters?.find(i=>i.place==="request fields"&&i.name==="body"&&"oneOf"in i&&i.oneOf!==void 0);return n&&(n.required=t.requestBody?.required??!1),e}addSchema(t,e,n,i,s,u=[],o=new Set,d=0,c){if(!(!e||e.isCircular||d>this.options.generatedSamplesMaxDepth)){if(e.pointer){if(o.has(e.pointer))return;o.add(e.pointer)}for(const r of e.fields??[]){if(c?.has(r.name)||this.#t(e,r,s))continue;const a=this.createSchemaFieldParameter(r,e,i,n,u),f=this.getParameterId(a);if(t[f]!=null)continue;t[f]=a,this.addSchema(t,r.schema,n,i,s,[...u,r.name],o,d+1);const l=O(r.schema);l&&(a.oneOf=this.#e(l,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1}))}if(e.items&&this.addSchema(t,e.items,n,i,s,u,o,d+1),d===0&&u.length===0&&e.oneOf){const r=this.#e(e,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1});if(r){const a={name:"body",description:"",place:i,mediaType:n,path:[],type:e.displayType||"object",required:!1,example:void 0,enum:void 0,oneOf:r};t[this.getParameterId(a)]=a}}}}#t(t,e,n){return!!t[m]||e.kind==="additionalProperties"||!!e.schema?.readOnly&&!n||!!e.schema?.writeOnly&&n}#e(t,e){const{mediaType:n,place:i,isResponse:s,visited:u,level:o}=e,d=new Set((t.fields??[]).map(r=>r.name)),c=(t.oneOf??[]).map((r,a)=>{const f={};return this.addSchema(f,r,n,i,s,[],new Set(u),o,d),{title:r.title||`variant ${a+1}`,parameters:Object.values(f)}}).filter(r=>r.parameters.length>0);if(c.length!==0)return{discriminator:t.discriminatorProp,variants:c}}}export{y as AiSearchIndexer};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as
|
|
2
|
-
`;for(const[S,T]of y?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!T.length)continue;const
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as _,join as q}from"node:path";import C from"@markdoc/markdoc";import{joinSectionContent as J}from"../../../plugins/markdown/search/join-section-content.js";import{toMarkdown as G}from"../../../plugins/markdown/search/to-markdown.js";import{AstToSearchNodeTransformer as z}from"../../../plugins/markdown/search/walk-sections.js";import{createRenderTagFn as B}from"../../../plugins/markdown/search/create-render-tag-fn.js";import{canDownloadApiDefinition as v,isResourcePubliclyAccessible as V}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as H}from"../../../../constants/common.js";import{getLlmsTxtMdPathBySlug as I}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{AiSearchIndexer as K}from"../ai-search-indexer.js";import{getLocaleFromRelativePath as Q}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as W}from"./search-facets.js";import{formatDocumentMetadata as X}from"../../search/utils.js";import{llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as Z}from"../store-definition-bundles.js";const k=new Map,xe=({parser:s,options:c,info:n,tagOperations:r,relativePath:t,openapiContentItem:e,metadata:i,getSearchFacets:u,includeInLLMsTxt:a,excludeFromSearch:f})=>async(o,p,l,j)=>{if(f)return;const P=await o.getNavText?.()||_(o.fsPath),D=new K(s,c,o.baseSlug||o.slug),d=D.addItem(e);if(!d)return;const O=await l.getConfig(),b=Array.isArray(d.title)?d.title.join(" "):d.title;let g,m,y=k.get(t);if((e.type==="tag"||e.type==="section"&&e.infoDefinition)&&!y){const{all:A,publiclyAccessible:$}=ae(r.tagged,D,O),{all:S,publiclyAccessible:T}=ue(r.untagged,D,O);k.set(t,{taggedSearchDocuments:new Map(A),untaggedSearchDocuments:S,publiclyAccessibleTaggedSearchDocuments:new Map($),publiclyAccessibleUntaggedSearchDocuments:T})}y=k.get(t);const h="#";switch(e.type){case"operation":const A=D.getOperation(e);g=m=se({title:b,security:s.definition.security,document:d,version:d.version||n.version,headingLevel:h,operation:A});break;case"section":if(e.infoDefinition){y=k.get(t),m=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:P,config:O}),m+=`
|
|
2
|
+
`;for(const[S,T]of y?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!T.length)continue;const U=s.definition.tags?.find(L=>L.name===S);m+=x({title:U?.["x-displayName"]||S,description:U?.description,operationSearchDocuments:T,headingLevel:`${h}#`})}const $=y?.publiclyAccessibleUntaggedSearchDocuments||[];$.length&&(m+=x({title:"Other",description:void 0,operationSearchDocuments:$,headingLevel:`${h}#`})),g=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:P,config:O})}else if(e.ast){const $=new C.Ast.Node("document",{},e.ast),S=Array.from(new z({ast:$,partials:{},renderTag:B(j.markdocOptions.tags),getInnerContent:G,skipConditionals:!0}).transform());m=g=J(S)}break;case"tag":m=x({title:b,description:e.description,operationSearchDocuments:y?.publiclyAccessibleTaggedSearchDocuments.get(e.name)||[],headingLevel:h}),g=x({title:b,description:e.description,operationSearchDocuments:[],headingLevel:h});break;case"rsrc":case"prompt":case"tool":m=ce({title:b,description:e.description,name:e.name,xMcpConfig:s.definition["x-mcp"],headingLevel:h}),g=m;break}return{async getLLMsTxts(){return[{title:e.name,description:e.type==="tag"?e.description:void 0,content:m||"",slug:o.slug,fsPath:o.fsPath,includeInLLMsTxt:a}]},async getSearchDocuments(){if(e.type==="operation"||e.type==="section"&&(e.infoDefinition||e.ast)||e.type==="tag"){const A=Q(o.fsPath),$=W({...d,...i},n,u);return[{title:b,description:Array.isArray(d.text)?d.text.join(" "):d.text,content:g||"",url:d.url??o.slug,fsPath:o.fsPath,locale:A,product:o.product?.name,rbacTeams:d.rbacTeams,facets:$}]}return[]}}};async function N({parser:s,info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}){const u=X(c["x-metadata"]);let a=c.title?`${e} ${c.title}
|
|
3
3
|
|
|
4
|
-
`:`${e} ${
|
|
4
|
+
`:`${e} ${t}
|
|
5
5
|
|
|
6
6
|
`;return a+=c.description?`${c.description}
|
|
7
7
|
|
|
@@ -9,84 +9,86 @@ import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{basename as L,join a
|
|
|
9
9
|
|
|
10
10
|
`:"",a+=c.version?`Version: ${c.version}
|
|
11
11
|
`:"",a+=c.license?`License: ${c.license.name}
|
|
12
|
-
`:"",e=`${e}#`,a+=
|
|
13
|
-
${
|
|
12
|
+
`:"",e=`${e}#`,a+=u.length?`Metadata:
|
|
13
|
+
${u}
|
|
14
14
|
`:"",a+=`
|
|
15
|
-
`,a+=
|
|
15
|
+
`,a+=ee({parser:s,headingLevel:e}),a+=te({parser:s,headingLevel:e}),a+=await ne({info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}),a}function x({title:s="",description:c,operationSearchDocuments:n,headingLevel:r}){let t=`${r} ${s}
|
|
16
16
|
|
|
17
|
-
`;return c&&(
|
|
17
|
+
`;return c&&(t+=`${c}
|
|
18
18
|
|
|
19
|
-
`),
|
|
19
|
+
`),n.length&&n.forEach(e=>{const i=Array.isArray(e.title)?e.title.join(" "):e.title;t+=`${r}# ${i}${e.deprecated?" (deprecated)":""}
|
|
20
20
|
|
|
21
|
-
`,
|
|
22
|
-
`}),
|
|
21
|
+
`,t+=` - ${M({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:I(e.url)})}`,t+=`
|
|
22
|
+
`}),t}function ee({parser:s,headingLevel:c}){const{servers:n}=s.definition;if(n&&n.length){let r=`${c} Servers
|
|
23
23
|
|
|
24
|
-
`;return
|
|
24
|
+
`;return n.forEach(t=>{r+=t.description?`${t.description}
|
|
25
25
|
`:"",r+=`\`\`\`
|
|
26
|
-
${
|
|
26
|
+
${t.url}
|
|
27
27
|
\`\`\`
|
|
28
28
|
|
|
29
|
-
`,
|
|
30
|
-
`,Object.entries(
|
|
29
|
+
`,t.variables&&(r+=`Variables:
|
|
30
|
+
`,Object.entries(t.variables).forEach(([e,i])=>{r+=`- \`${e}\`${i.description?`: ${i.description}`:""}
|
|
31
31
|
`,r+=i.default?`Default: ${JSON.stringify(i.default)}
|
|
32
|
-
`:"",r+=i.enum?`Enum: ${i.enum.map(
|
|
32
|
+
`:"",r+=i.enum?`Enum: ${i.enum.map(u=>JSON.stringify(u)).join(", ")}
|
|
33
33
|
`:""}),r+=`
|
|
34
|
-
`)}),r}return""}async function
|
|
34
|
+
`)}),r}return""}async function ne({info:s,staticData:c,relativePath:n,pageName:r,headingLevel:t,config:e}){const i=q(c.props?.outdir||"",Y,Z(n,".yaml")),u=e.access?.rbac,a=e.access?.requiresLogin;if(v(i,u??{},a??!1,{isAuthenticated:!1,teams:[H]})){let f=`${t} Download OpenAPI description
|
|
35
35
|
|
|
36
|
-
`;return
|
|
36
|
+
`;return f+=M({title:s.title||r||"OpenAPI definition",description:void 0,slug:i}),f}return""}function te({parser:s,headingLevel:c}){if(!s.definition.components?.securitySchemes)return"";let n=`${c} Security
|
|
37
37
|
|
|
38
|
-
`;const{securitySchemes:r}=s.definition.components;return Object.keys(r).forEach(
|
|
38
|
+
`;const{securitySchemes:r}=s.definition.components;return Object.keys(r).forEach(t=>{const e=r[t];e&&(n+=`${c}# ${t}
|
|
39
39
|
|
|
40
|
-
`,
|
|
40
|
+
`,n+=e.description?`${e.description}
|
|
41
41
|
|
|
42
|
-
`:"",e.type&&(
|
|
43
|
-
`),e.openIdConnectUrl&&(
|
|
44
|
-
`),e.in&&(
|
|
45
|
-
`),e.name&&(
|
|
46
|
-
`),e.scheme&&(
|
|
47
|
-
`),e.bearerFormat&&(
|
|
48
|
-
`),e.flows?.implicit?.authorizationUrl&&(
|
|
49
|
-
`),e.flows?.implicit?.scopes&&(
|
|
50
|
-
`,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([i,
|
|
51
|
-
`})),e.flows?.password?.tokenUrl&&(
|
|
52
|
-
`),e.flows?.password?.scopes&&(
|
|
53
|
-
`,Object.entries(e.flows?.password?.scopes||{}).forEach(([i,
|
|
54
|
-
`})),
|
|
55
|
-
`)}),
|
|
42
|
+
`:"",e.type&&(n+=`Type: ${e.type}
|
|
43
|
+
`),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
|
|
44
|
+
`),e.in&&(n+=`In: ${e.in}
|
|
45
|
+
`),e.name&&(n+=`Name: ${e.name}
|
|
46
|
+
`),e.scheme&&(n+=`Scheme: ${e.scheme}
|
|
47
|
+
`),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
|
|
48
|
+
`),e.flows?.implicit?.authorizationUrl&&(n+=`Authorization URL: ${e.flows.implicit?.authorizationUrl}
|
|
49
|
+
`),e.flows?.implicit?.scopes&&(n+=`Scopes:
|
|
50
|
+
`,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
|
|
51
|
+
`})),e.flows?.password?.tokenUrl&&(n+=`Token URL: ${e.flows.password?.tokenUrl}
|
|
52
|
+
`),e.flows?.password?.scopes&&(n+=`Scopes:
|
|
53
|
+
`,Object.entries(e.flows?.password?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
|
|
54
|
+
`})),n+=`
|
|
55
|
+
`)}),n}function se({title:s,security:c,document:n,version:r,headingLevel:t,operation:e}){const{text:i,httpMethod:u,httpPath:a,deprecated:f}=n,o=oe(n.parameters||[],`${t}#`),p=re(`${t}#`,n.parameters,e);let l=s?`${t} ${s}${f?" (deprecated)":""}
|
|
56
56
|
|
|
57
57
|
`:"";return l+=i?`${i}
|
|
58
58
|
|
|
59
|
-
`:"",l+=`Endpoint: ${
|
|
59
|
+
`:"",l+=`Endpoint: ${u?.toUpperCase()} ${a}
|
|
60
60
|
`,l+=r?`Version: ${r}
|
|
61
|
-
`:"",l+=
|
|
61
|
+
`:"",l+=n.security?.length?`Security: ${n.security.join(", ")}
|
|
62
62
|
`:c?.length?`Security: ${c.map(j=>j.id).join(", ")}
|
|
63
63
|
`:"",l+=`
|
|
64
|
-
`,l+=
|
|
64
|
+
`,l+=o?`${o}
|
|
65
65
|
`:"",l+=`
|
|
66
|
-
`,l+=`${
|
|
67
|
-
`)}`,l}function ce({title:s,name:c,xMcpConfig:
|
|
66
|
+
`,l+=`${p.join(`
|
|
67
|
+
`)}`,l}function ce({title:s,name:c,xMcpConfig:n,headingLevel:r}){const t=n?.tools.find(i=>i.name===c);if(!t)return"";let e=`${r} ${s}
|
|
68
68
|
|
|
69
|
-
`;return e+=
|
|
69
|
+
`;return e+=t.description?`${t.description}
|
|
70
70
|
|
|
71
71
|
`:"",e+=`${r}# Input schema:
|
|
72
72
|
|
|
73
73
|
`,e+=`\`\`\`json
|
|
74
|
-
${JSON.stringify(
|
|
74
|
+
${JSON.stringify(t.inputSchema,null,2)}
|
|
75
75
|
\`\`\`
|
|
76
76
|
|
|
77
|
-
`,
|
|
77
|
+
`,t.outputSchema&&(e+=`${r}# Output schema:
|
|
78
78
|
|
|
79
79
|
`,e+=`\`\`\`json
|
|
80
|
-
${JSON.stringify(
|
|
80
|
+
${JSON.stringify(t.outputSchema,null,2)}
|
|
81
81
|
\`\`\`
|
|
82
82
|
|
|
83
|
-
`),e}function
|
|
84
|
-
`)}function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
`),e}function re(s,c,n){return!c&&!n||!n?.responses?[]:n?.responses.filter(t=>!t.content?.mediaTypes[0]?.schema).map(t=>`${s} ${R(`response ${t.code} fields`)}
|
|
84
|
+
`)}function ie(s,c,n,r){const t=JSON.stringify(s),e=r.get(t);return e?`${n}Enum: same as ${e} (${s.length} values)
|
|
85
|
+
`:(r.set(t,c),`${n}Enum: ${s.map(i=>JSON.stringify(i)).join(", ")}
|
|
86
|
+
`)}function E(s,c,n,r){const t=`${c} `,e=s.oneOf,u=[...s.path||[],s.name].join("."),a=Array.isArray(s.description)?s.description.join(" "):s.description,f=!!e&&e.variants.length>1;let o=`${c}- \`${u}\` (${s.type}${s.required?", required":""})`;if(f&&(o+=e.discriminator?` \u2014 one of (discriminator: ${e.discriminator}):`:" \u2014 one of:"),o+=`
|
|
87
|
+
`,o+=a?`${t}${a.trim()}
|
|
88
|
+
`:"",s.enum){const p=r?`\`${u}\` in "${r}"`:`\`${u}\``;o+=ie(s.enum,p,t,n)}else s.example&&(o+=`${t}Example: ${s.example}
|
|
89
|
+
`);if(f)for(const p of e.variants){o+=`${c} - ${p.title}:
|
|
90
|
+
`;for(const l of p.parameters)o+=E(l,`${c} `,n,p.title)}else if(e)for(const p of e.variants[0].parameters)o+=E(p,`${c} `,n);return o}function oe(s,c){const n={};for(const e of s){const i=`${e.place}${e.mediaType?` (${e.mediaType})`:""}`;n[i]=[...n[i]||[],e]}const r=new Map;return Object.entries(n).map(([e,i])=>{const u=i.map(a=>E(a," ",r));return`${c} ${R(e)}:
|
|
89
91
|
|
|
90
|
-
${
|
|
92
|
+
${u.join(`
|
|
91
93
|
`)}`}).join(`
|
|
92
|
-
`)}function
|
|
94
|
+
`)}function ae(s,c,n){const r=[],t=[];return s.forEach((e,i)=>{const u=[],a=[];e.forEach(f=>{const o=c.addItem(f);o&&(u.push(o),F({[w]:f[w],slug:o.url},n)&&a.push(o))}),r.push([i,u]),t.push([i,a])}),{all:r,publiclyAccessible:t}}function ue(s,c,n){const r=[],t=[];return s.forEach(e=>{const i=c.addItem(e);i&&(r.push(i),F({[w]:e[w],slug:i.url},n)&&t.push(i))}),{all:r,publiclyAccessible:t}}function R(s){return s.charAt(0).toUpperCase()+s.slice(1)}function F(s,c){return c.access?.requiresLogin?!0:V(s,c)}export{xe as getAiDocumentsStore};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { OperationMenuItem } from '@redocly/openapi-docs/lib/models';
|
|
2
|
+
import type { OperationParameter } from '@redocly/theme/core/types';
|
|
2
3
|
export type TagOperations = {
|
|
3
4
|
untagged: OperationMenuItem[];
|
|
4
5
|
tagged: Map<string, OperationMenuItem[]>;
|
|
5
6
|
};
|
|
7
|
+
export type SchemaVariant = {
|
|
8
|
+
title: string;
|
|
9
|
+
parameters: OperationParameter[];
|
|
10
|
+
};
|
|
11
|
+
export type OperationParameterWithVariants = OperationParameter & {
|
|
12
|
+
oneOf?: {
|
|
13
|
+
discriminator?: string;
|
|
14
|
+
variants: SchemaVariant[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
6
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IMenuItem } from '@redocly/openapi-docs';
|
|
1
|
+
import type { IMenuItem, SchemaModel } from '@redocly/openapi-docs';
|
|
2
2
|
import type { ItemBadge, NavItem, ResolvedNavItem } from '@redocly/config';
|
|
3
3
|
export type IMenuItemExtended = {
|
|
4
4
|
httpVerb?: string;
|
|
@@ -17,4 +17,9 @@ export declare function shouldAddRoute({ item }: {
|
|
|
17
17
|
export declare const removeMarkdownLinks: (text: string | Record<string, any>) => any;
|
|
18
18
|
export declare function normalizeFeedbackOptions(feedbackOptions: Record<string, any> | null | undefined): Record<string, any> | undefined;
|
|
19
19
|
export declare function stripFormatting(text: string | Record<string, any> | null): string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the oneOf schema when `schema` (or, for an array, its items) is a
|
|
22
|
+
* oneOf/anyOf/discriminator — the single `oneOf` property the model uses for all of them.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getOneOfSchema(schema: SchemaModel | undefined): SchemaModel | undefined;
|
|
20
25
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{combineUrls as p}from"@redocly/theme/core/utils";import{FEEDBACK_TYPES as c}from"../../../constants/common.js";import{normalizeRouteSlug as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{combineUrls as p}from"@redocly/theme/core/utils";import{FEEDBACK_TYPES as c}from"../../../constants/common.js";import{normalizeRouteSlug as g}from"../../../utils/path/normalize-route-slug.js";function u(t){const{contentItems:r,sidebarItems:a,routeSlug:o,navItem:s}=t;let b=!0;for(const e of r){let n;switch(e.type){case"group":a.push({type:"separator",label:e.name,[i]:e[i]}),u({...t,contentItems:e.items,sidebarItems:a});break;case"tag":n=p(o,e.href);const m={type:"group",label:e.name,items:[],link:n,routeSlug:n,[i]:e[i]};a.push(m),u({routeSlug:o,contentItems:e.items,sidebarItems:m.items||[],navItem:s});break;case"operation":case"schema":case"rsrc":case"prompt":case"tool":e.isWebhook&&b&&(a.push({type:"separator",label:"Webhooks",variant:"secondary"}),b=!1),n=p(o,e.href),a.push({type:"link",label:e.name,httpVerb:e.type==="operation"?e.httpVerb:e.type,routeSlug:g(n),badges:e.badges,link:n,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation,[i]:e[i]});break;case"section":if(e.depth===-1)continue;n=p(o,e.href);const l=e.href==="/",f={type:e.items.length?"group":"link",label:l&&s?.label?s.label:e.name,labelTranslationKey:s?.labelTranslationKey,routeSlug:n.split("#")[0]===o?o:g(n),link:n,items:[],...l&&s?.icon&&{icon:typeof s.icon=="object"?s.icon.srcSet:s.icon},...l&&s?.badges&&{badges:s.badges}};a.push(f),e.items.length&&u({routeSlug:o,contentItems:e.items,sidebarItems:f.items});break}}}function S({item:t}){return t.id===""?!0:t.type!=="group"||t.description!==""}const I=t=>(typeof t=="string"?t:t?.raw)?.replace(/\[(.*?)\][\[\(].*?[\]\)]/g,"$1")||"";function O(t){if(!t)return;let r="";const{type:a,settings:o}=t;switch(a){case c.RATING:r="Rate this section";break;case c.SENTIMENT:r="Was this section helpful?";break;case c.MOOD:r="Was this section helpful?";break;case c.COMMENT:r="Share your feedback about this section";break;case c.SCALE:r="How would you rate this section?";break}return{...t,settings:{...o,label:o?.label||r}}}function A(t){return(typeof t=="string"?t:t?.raw||"").replace(/<[^>]*>/g,"").replace(/```([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").trim()}function E(t){if(t?.oneOf)return t;if(t?.items?.oneOf)return t.items}export{u as convertOpenAPIDocs2Sidebar,E as getOneOfSchema,O as normalizeFeedbackOptions,I as removeMarkdownLinks,S as shouldAddRoute,A as stripFormatting};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/realm",
|
|
3
|
-
"version": "0.134.0-next.
|
|
3
|
+
"version": "0.134.0-next.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"flexsearch": "0.7.43",
|
|
55
55
|
"graphql": "16.12.0",
|
|
56
56
|
"gray-matter": "4.0.3",
|
|
57
|
-
"hono": "4.12.
|
|
57
|
+
"hono": "4.12.23",
|
|
58
58
|
"htmlparser2": "8.0.2",
|
|
59
59
|
"i18next": "22.4.15",
|
|
60
60
|
"is-glob": "4.0.3",
|
|
@@ -91,14 +91,14 @@
|
|
|
91
91
|
"xpath": "0.0.34",
|
|
92
92
|
"yaml-ast-parser": "0.0.43",
|
|
93
93
|
"zod": "^3.25.76",
|
|
94
|
-
"@redocly/asyncapi-docs": "1.11.0-next.
|
|
94
|
+
"@redocly/asyncapi-docs": "1.11.0-next.6",
|
|
95
95
|
"@redocly/config": "0.49.0",
|
|
96
|
-
"@redocly/graphql-docs": "1.11.0-next.
|
|
97
|
-
"@redocly/openapi-docs": "3.22.0-next.
|
|
96
|
+
"@redocly/graphql-docs": "1.11.0-next.6",
|
|
97
|
+
"@redocly/openapi-docs": "3.22.0-next.6",
|
|
98
98
|
"@redocly/portal-legacy-ui": "0.17.0-next.1",
|
|
99
|
-
"@redocly/portal-plugin-mock-server": "0.19.0-next.
|
|
99
|
+
"@redocly/portal-plugin-mock-server": "0.19.0-next.6",
|
|
100
100
|
"@redocly/realm-asyncapi-sdk": "0.12.0-next.3",
|
|
101
|
-
"@redocly/theme": "0.66.0-next.
|
|
101
|
+
"@redocly/theme": "0.66.0-next.5"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
104
|
"react": "^19.2.4",
|