@redocly/openapi-docs 3.15.0-rc.1 → 3.15.0-rc.3

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.
@@ -1,11 +1,15 @@
1
- import{jsx as t,jsxs as o,Fragment as l}from"react/jsx-runtime";import*as b from"react";import{NewTabButton as h}from"@redocly/theme/components/Buttons/NewTabButton";import{PageActions as u}from"@redocly/theme/components/PageActions/PageActions";import{Tag as p}from"@redocly/theme/components/Tag/Tag";import{CheckmarkIcon as g}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{MCP_SERVER_CAPABILITIES as f,MCP_SERVER_EXPERIMENTAL_CAPABILITIES as E,PAGE_ACTIONS_MCP as P}from"../../utils/mcp.js";import{PanelItem as r}from"../PanelItem/PanelItem.js";import{PanelItemsList as C}from"../PanelItem/styled.js";import{useTranslate as _}from"../../hooks/index.js";import{styled as c}from"../../styled-components.js";function O({mcpInfo:e,mcpServers:s}){const a=_();function d(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.listChanged}function m(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.subscribe}return o(C,{children:[e?.protocolVersion&&t(r,{header:a("openapi.mcp.protocolVersion","Protocol version"),title:e.protocolVersion}),e?.capabilities&&t(r,{header:a("openapi.mcp.capabilities","Capabilities"),title:t(l,{children:f.map(i=>e?.capabilities[i]?o(p,{size:"small",icon:t(g,{}),children:[i,d(i)?" (list changed)":"",m(i)?" (subscribe)":""]},i):null)})}),e?.capabilities[E]&&t(r,{header:a("openapi.mcp.experimentalCapabilities","Experimental capabilities"),title:t(x,{children:Object.entries(e?.capabilities.experimental||{}).map(([i,n])=>o(b.Fragment,{children:[o("span",{children:[i,":"]}),t(p,{children:typeof n=="object"?JSON.stringify(n):String(n)})]},i))})}),t(r,{header:a("openapi.mcp.endpoint","Endpoint"),title:t(l,{children:s[0]?.url}),actions:[t(h,{data:s[0]?.url},"NewTabButton")]}),t(r,{title:t(j,{children:t(u,{actions:P,mcpUrl:s[0]?.url})})})]})}const j=c.div`
1
+ import{jsx as i,jsxs as s,Fragment as c}from"react/jsx-runtime";import*as g from"react";import{NewTabButton as f}from"@redocly/theme/components/Buttons/NewTabButton";import{PageActions as p}from"@redocly/theme/components/PageActions/PageActions";import{Tag as d}from"@redocly/theme/components/Tag/Tag";import{CheckmarkIcon as P}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{MCP_SERVER_CAPABILITIES as E,MCP_SERVER_EXPERIMENTAL_CAPABILITIES as C,PAGE_ACTIONS_MCP as m}from"../../utils/mcp.js";import{PanelItem as r}from"../PanelItem/PanelItem.js";import{Item as _,PanelItemsList as j,Title as x}from"../PanelItem/styled.js";import{useTranslate as A}from"../../hooks/index.js";import{styled as n}from"../../styled-components.js";function v({mcpInfo:e,mcpServers:a}){const o=A();function h(t){return typeof e?.capabilities[t]=="object"&&e?.capabilities[t]?.listChanged}function u(t){return typeof e?.capabilities[t]=="object"&&e?.capabilities[t]?.subscribe}return s(T,{children:[e?.protocolVersion&&i(r,{header:o("openapi.mcp.protocolVersion","Protocol version"),title:e.protocolVersion}),e?.capabilities&&i(r,{header:o("openapi.mcp.capabilities","Capabilities"),title:i(c,{children:E.map(t=>e?.capabilities[t]?s(d,{size:"small",icon:i(P,{}),children:[t,h(t)?" (list changed)":"",u(t)?" (subscribe)":""]},t):null)})}),e?.capabilities[C]&&i(r,{header:o("openapi.mcp.experimentalCapabilities","Experimental capabilities"),title:i(L,{children:Object.entries(e?.capabilities.experimental||{}).map(([t,l])=>s(g.Fragment,{children:[s("span",{children:[t,":"]}),i(d,{children:typeof l=="object"?JSON.stringify(l):String(l)})]},t))})}),i(r,{header:o("openapi.mcp.endpoint","Endpoint"),title:i(c,{children:a[0]?.url}),actions:[i(f,{data:a[0]?.url},"NewTabButton")]}),!!a[0]?.url&&i(r,{title:i(b,{children:i(p,{actions:m,mcpUrl:a[0]?.url})})}),i(r,{title:i(b,{children:i(p,{actions:m,mcpUrl:a[0]?.url})})})]})}const T=n(j)`
2
+ ${_}, ${x} {
3
+ overflow: visible;
4
+ }
5
+ `,b=n.div`
2
6
  & button {
3
7
  width: 100%;
4
8
  }
5
9
  > div {
6
10
  padding: 0;
7
11
  }
8
- `,x=c.div`
12
+ `,L=n.div`
9
13
  display: grid;
10
14
  grid-template-columns: 1fr 2fr;
11
15
  gap: 10px;
@@ -13,4 +17,4 @@ import{jsx as t,jsxs as o,Fragment as l}from"react/jsx-runtime";import*as b from
13
17
  > * {
14
18
  justify-self: start;
15
19
  }
16
- `;export{O as McpOverview};
20
+ `;export{v as McpOverview};
@@ -1,13 +1,13 @@
1
- import{jsx as t,jsxs as s,Fragment as x}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as k}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as v}from"../PageFooter/index.js";import{globalOptionsAtom as b}from"../../jotai/store.js";import{RenderHook as y}from"../RenderHook/index.js";import{RightPanel as C}from"../RightPanel/index.js";import{layoutAtom as w}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as j,SamplesPanel as M}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as m}from"../../styled-components.js";function G({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(b),l=d(w),o=l===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(v,{})}),[n,o]),S=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(y,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:s(x,{children:[S,s(B,{layout:l,children:[t(R,{layout:l,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(_,{isStacked:o,tabIndex:0,children:t(C,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=m(j)`
1
+ import{jsx as t,jsxs as m,Fragment as S}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as k}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as v}from"../PageFooter/index.js";import{globalOptionsAtom as y}from"../../jotai/store.js";import{RenderHook as b}from"../RenderHook/index.js";import{RightPanel as C}from"../RightPanel/index.js";import{layoutAtom as w}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as j,SamplesPanel as I}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as s}from"../../styled-components.js";function G({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(y),l=d(w),o=l===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(v,{})}),[n,o]),x=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(b,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:m(S,{children:[x,m(B,{layout:l,style:{zIndex:1},children:[t(M,{layout:l,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(R,{isStacked:o,tabIndex:0,children:t(C,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=s(j)`
2
2
  align-self: flex-start;
3
3
  padding-top: var(--panel-gap-vertical);
4
4
  padding-bottom: var(--panel-gap-vertical);
5
- `,R=m.div`
5
+ `,M=s.div`
6
6
  width: 100%;
7
7
 
8
8
  @media screen and (min-width: ${k.large}) {
9
9
  width: ${({layout:e})=>e===c.STACKED?"100%":"calc(100% - var(--panel-samples-width))"};
10
10
  }
11
- `,_=m(M)`
11
+ `,R=s(I)`
12
12
  margin: var(--spacing-base) 0;
13
- `;export{_ as RightPanelContainer,R as SectionContainer,G as SectionContent};
13
+ `;export{R as RightPanelContainer,M as SectionContainer,G as SectionContent};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as n}from"@redocly/config";import{joinWithSeparator as x}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as C}from"../utils/saveTextBeforeHeading.js";function B(m,e,i){let s;i?.id&&(m==="schema"||m==="mcp")?s=x(i.id,o(e.name)):s=e.id||o(e.name);const t=e["x-displayName"]||e.name,c=e.level||1,d=e.isSchema,f=e.ast||void 0,l=C(S(e,"description")||""),a=e.items||[],h=e.externalDocs;return{id:s.toLowerCase(),type:m,parent:i,name:t,level:c,depth:0,isSchema:d,description:l,items:a,ast:f,externalDocs:h,href:v({id:s}),[n]:e[n]||i?.[n]}}export{B as getTagOrGroup};
1
+ import{REDOCLY_TEAMS_RBAC as n}from"@redocly/config";import{joinWithSeparator as h}from"../services/index.js";import{getValueFromMdParsedExtension as S,safeSlugify as o}from"../utils/index.js";import{getHref as v}from"../services/menu/operation.js";import{saveTextBeforeHeading as C}from"../utils/saveTextBeforeHeading.js";function B(m,e,i){let s;i?.id&&(m==="schema"||m==="mcp")?s=h(i.id,o(e.name)):s=e.id||o(e.name);const c=e["x-displayName"]||e.name,d=e.level||1,t=e.isSchema,f=e.ast||void 0,l=C(S(e,"description")||""),a=e.items||[],x=e.externalDocs;return{id:s.toLowerCase(),type:m,parent:i,name:c,level:d,badges:e["x-badges"]||[],depth:0,isSchema:t,description:l,items:a,ast:f,externalDocs:x,href:v({id:s}),[n]:e[n]||i?.[n]}}export{B as getTagOrGroup};
@@ -1,2 +1,4 @@
1
- import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as l,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as $,safeSlugify as N}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as x}from"./markdown.js";import{joinWithSeparator as b}from"../history/helpers.js";const y=["tools"];function k(s,c,o,e,a){let t;if(e===void 0?t=Object.keys(c):t=e.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(n=>c[n]?(c[n].used=!0,c[n]):(console.warn(`Non-existing tag "${n}" is added to the group "${e?.name}"`),null)),i=[];for(const n of f){if(!n)continue;const r=d("tag",n,o);if(r.depth=g+1,n.name===""){const P=[...x(h(n,"description")||"",r,r.depth+1),...T(void 0,n,r.depth+1)];i.push(...P);continue}const p=v({definition:s.definition,tag:n,parent:r,schemaDefinitionsTagName:a.schemaDefinitionsTagName}),m=w(s.definition,n,r);r.items=[...p,...m,...x(h(n,"description")||"",r,r.depth+1),...T(r,n,r.depth+1)],i.push(r)}return i.filter(({name:n,items:r})=>n!==l||r.length>0)}function R(s,c,o,e,a){const t=[];for(const f of o){const i=d("group",f,c);i.depth=g,i.items=k(s,e,i,f,a),t.push(i)}return t}function v({definition:s,tag:c,parent:o,schemaDefinitionsTagName:e}){const a=e?[e]:[];return Object.entries(s.components?.schemas||{}).map(([t,f])=>{if(!(f["x-tags"]||a).includes(c.name))return null;const n=d("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return n.depth=o.depth+1,n}).filter(Boolean)}function w(s,c,o){const e=[];for(const a of y)if(s["x-mcp"]?.[a]){const t=O(a),f=[t];for(const i of s["x-mcp"]?.[a]||[])if((i.tags?.length?i.tags:f).includes(c.name)){const r=b(o.id,N(i.name)),p=d("mcp",{name:i.name,"x-displayName":i.title||i.name,description:`${i.description||""}
2
- {% mcp${t.slice(0,-1)} toolName="${i.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(s,c){const{definition:o}=s,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&u(s,o.paths,e),a&&u(s,a,e,!0),t&&E(t,e),e}function E(s,c){for(const o of y)if(s[o])for(const e of s[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function u(s,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const i of f){const n=t[i];if(t.$ref){const{resolved:p}=s.deref(t);u(s,{[a]:p},o,e);continue}let r=n?.tags;(!r||!r.length)&&(r=e?[l]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...n,pathName:a,pointer:$.compile(["paths",a,i]),httpVerb:i,pathParameters:t.parameters||[],pathServers:t.servers,isWebhook:!!e})}}}}function O(s){return s.charAt(0).toUpperCase()+s.slice(1)}export{O as capitalize,R as getTagGroupsItems,k as getTagsItems,U as getTagsWithOperations};
1
+ import{getTagOrGroup as d}from"../../models/group.js";import{DEFAULT_WEBHOOKS_TAG_NAME as u,GROUP_DEPTH as g}from"../../constants.js";import{getValueFromMdParsedExtension as h,isOperationName as S,JsonPointer as $,safeSlugify as N}from"../../utils/index.js";import{getOperationsItems as T}from"./operation.js";import{addMarkdownItems as x}from"./markdown.js";import{joinWithSeparator as b}from"../history/helpers.js";const y=["tools"];function k(i,c,o,e,a){let t;if(e===void 0?t=Object.keys(c):t=e.tags,!Array.isArray(t))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const f=t.map(s=>c[s]?(c[s].used=!0,c[s]):(console.warn(`Non-existing tag "${s}" is added to the group "${e?.name}"`),null)),n=[];for(const s of f){if(!s)continue;const r=d("tag",s,o);if(r.depth=g+1,s.name===""){const P=[...x(h(s,"description")||"",r,r.depth+1),...T(void 0,s,r.depth+1)];n.push(...P);continue}const p=v({definition:i.definition,tag:s,parent:r,schemaDefinitionsTagName:a.schemaDefinitionsTagName}),m=w(i.definition,s,r);r.items=[...p,...m,...x(h(s,"description")||"",r,r.depth+1),...T(r,s,r.depth+1)],n.push(r)}return n.filter(({name:s,items:r})=>s!==u||r.length>0)}function R(i,c,o,e,a){const t=[];for(const f of o){const n=d("group",f,c);n.depth=g,n.items=k(i,e,n,f,a),t.push(n)}return t}function v({definition:i,tag:c,parent:o,schemaDefinitionsTagName:e}){const a=e?[e]:[];return Object.entries(i.components?.schemas||{}).map(([t,f])=>{if(!(f["x-tags"]||a).includes(c.name))return null;const s=d("schema",{name:t,"x-displayName":`${f.title||t}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${t}" /%}`,isSchema:!0,level:2},o);return s.depth=o.depth+1,s}).filter(Boolean)}function w(i,c,o){const e=[];for(const a of y)if(i["x-mcp"]?.[a]){const t=O(a),f=[t];for(const n of i["x-mcp"]?.[a]||[])if((n.tags?.length?n.tags:f).includes(c.name)){const r=b(o.id,N(n.name)),p=d("mcp",{name:n.name,"x-displayName":n.title||n.name,description:`Tool name: \`${n.name}\`
2
+
3
+ ${n.description||""}
4
+ {% mcp${t.slice(0,-1)} toolName="${n.name}" id="${r}" /%}`,isSchema:!0,level:2},o);p.depth=o.depth+1,e.push(p)}}return e}function U(i,c){const{definition:o}=i,e={},a=o["x-webhooks"]||o.webhooks,t=o["x-mcp"];for(const f of c||[])e[f.name]={...f,operations:[]};return o.paths&&l(i,o.paths,e),a&&l(i,a,e,!0),t&&E(t,e),e}function E(i,c){for(const o of y)if(i[o])for(const e of i[o]){const a=e.tags&&e.tags.length?e.tags:[O(o)];for(const t of a){let f=c[t];f===void 0&&(f={name:t,operations:[],used:!0},c[t]=f)}}}function l(i,c,o,e){for(const a of Object.keys(c||{})){const t=c[a],f=Object.keys(t).filter(S);for(const n of f){const s=t[n];if(t.$ref){const{resolved:p}=i.deref(t);l(i,{[a]:p},o,e);continue}let r=s?.tags;(!r||!r.length)&&(r=e?[u]:[""]);for(const p of r){let m=o[p];m===void 0&&(m={name:p,operations:[]},o[p]=m),!m["x-traitTag"]&&m.operations.push({...s,pathName:a,pointer:$.compile(["paths",a,n]),httpVerb:n,pathParameters:t.parameters||[],pathServers:t.servers,isWebhook:!!e})}}}}function O(i){return i.charAt(0).toUpperCase()+i.slice(1)}export{O as capitalize,R as getTagGroupsItems,k as getTagsItems,U as getTagsWithOperations};
@@ -1,3 +1,3 @@
1
1
  export declare const MCP_SERVER_CAPABILITIES: string[];
2
2
  export declare const MCP_SERVER_EXPERIMENTAL_CAPABILITIES = "experimental";
3
- export declare const PAGE_ACTIONS_MCP: "mcp-cursor"[];
3
+ export declare const PAGE_ACTIONS_MCP: "mcp-json"[];
package/lib/utils/mcp.js CHANGED
@@ -1 +1 @@
1
- const o=["tools","resources","prompts","logging","subscribe","completions"],s="experimental",e=["mcp-cursor"];export{o as MCP_SERVER_CAPABILITIES,s as MCP_SERVER_EXPERIMENTAL_CAPABILITIES,e as PAGE_ACTIONS_MCP};
1
+ const o=["tools","resources","prompts","logging","subscribe","completions"],s="experimental",e=["mcp-json"];export{o as MCP_SERVER_CAPABILITIES,s as MCP_SERVER_EXPERIMENTAL_CAPABILITIES,e as PAGE_ACTIONS_MCP};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.15.0-rc.1",
3
+ "version": "3.15.0-rc.3",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -75,7 +75,7 @@
75
75
  "typescript": "5.9.3",
76
76
  "url": "~0.11.0",
77
77
  "vite": "6.3.6",
78
- "@redocly/theme": "0.59.0-rc.1"
78
+ "@redocly/theme": "0.59.0-rc.2"
79
79
  },
80
80
  "scripts": {
81
81
  "start": "npm run copy-highlight-hook && vite",