@redocly/realm 0.135.0-next.0 → 0.135.0-next.1
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 +22 -0
- package/dist/client/app/Link.d.ts +1 -1
- package/dist/client/app/Link.js +1 -1
- package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
- package/dist/client/app/hooks/useLoginUrl.js +1 -1
- package/dist/client/app/hooks/useScrollTracker.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
- package/dist/client/app/search/useAiSearch.js +1 -1
- package/dist/client/app/utils/programmatic-scroll.d.ts +22 -0
- package/dist/client/app/utils/programmatic-scroll.js +1 -0
- package/dist/markdoc/tags/json-schema.js +1 -1
- package/dist/server/constants/common.d.ts +4 -1
- package/dist/server/constants/common.js +1 -1
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.d.ts +5 -0
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/markdown/search/to-markdown.js +14 -14
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.d.ts +3 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +11 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/whoami.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-schema.d.ts +8 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-schema.js +3 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.d.ts +14 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.d.ts +10 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.d.ts +10 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/load-graphql-schema.d.ts +7 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/load-graphql-schema.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/tool-helpers.d.ts +14 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/tool-helpers.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +10 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +16 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +3 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +28 -7
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/{get-endpoint-info.d.ts → openapi/get-endpoint-info.d.ts} +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/{get-endpoints.d.ts → openapi/get-endpoints.d.ts} +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/{get-full-api-description.d.ts → openapi/get-full-api-description.d.ts} +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-full-api-description.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/{get-security-schemes.d.ts → openapi/get-security-schemes.d.ts} +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/{list-apis.d.ts → openapi/list-apis.d.ts} +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/{utils.d.ts → openapi/utils.d.ts} +1 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -0
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +7 -0
- package/dist/server/plugins/mcp/utils.d.ts +7 -17
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/store.d.ts +2 -0
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +2 -0
- package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
- package/dist/server/web-server/routes/api-routes/api-routes.d.ts +0 -5
- package/dist/server/web-server/routes/api-routes/api-routes.js +1 -1
- package/dist/server/web-server/routes/app-data.js +1 -1
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/dist/server/web-server/routes/search.js +1 -1
- package/dist/server/web-server/utils.js +1 -1
- package/package.json +6 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/helpers/load-api-description.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +0 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/search.js +0 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.js +0 -11
- package/dist/server/plugins/mcp/docs-mcp/tools/whoami.d.ts +0 -6
- /package/dist/server/plugins/mcp/docs-mcp/tools/{whoami.js → core/whoami.js} +0 -0
- /package/dist/server/plugins/mcp/docs-mcp/tools/{helpers → openapi}/load-api-description.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.135.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 76189db569f: Added `GraphQL` support to Docs MCP server.
|
|
8
|
+
- 736405a5893: Added `title` attribute to the `json-schema` Markdoc tag to display a heading above the rendered schema.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- b93a2a61665: Fixed an issue where the login button did not return users to their previous page after signing in.
|
|
13
|
+
- 08dea434932: Fixed scroll synchronization between the Webview and editor: dragging the Webview scrollbar scrolls the editor, and mouse-wheel scrolling maintains alignment.
|
|
14
|
+
- 4267dc2f1ed: Fixed an issue where the Markdoc `tabs` tag crashed if it contained content without a `label` attribute.
|
|
15
|
+
- c202a2acd4b: Improved HTTP caching for HTML responses by setting `Cache-Control: no-cache` on public projects and `Cache-Control: private` on protected projects.
|
|
16
|
+
Added `X-Redocly-Cache-Control` header to public HTML responses to enhance CDN caching.
|
|
17
|
+
- Updated dependencies [4267dc2f1ed]
|
|
18
|
+
- Updated dependencies [2d154630f33]
|
|
19
|
+
- @redocly/theme@0.67.0-next.1
|
|
20
|
+
- @redocly/openapi-docs@3.23.0-next.1
|
|
21
|
+
- @redocly/asyncapi-docs@1.12.0-next.1
|
|
22
|
+
- @redocly/graphql-docs@1.12.0-next.1
|
|
23
|
+
- @redocly/portal-plugin-mock-server@0.20.0-next.1
|
|
24
|
+
|
|
3
25
|
## 0.135.0-next.0
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { LinkProps } from '@redocly/theme/
|
|
2
|
+
import type { LinkProps } from '@redocly/theme/core/types';
|
|
3
3
|
export declare function Link(props: React.PropsWithChildren<LinkProps>): React.ReactElement;
|
|
4
4
|
//# sourceMappingURL=Link.d.ts.map
|
package/dist/client/app/Link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as s from"react";import u from"path";import{Link as U,useNavigate as z,useLocation as F}from"react-router-dom";import{getPathnameForLocale as M,withPathPrefix as W}from"@redocly/theme/core/utils";import{removeTrailingSlash as I}from"../../utils/url/remove-trailing-slash";import{normalizeRouteSlug as h}from"../../utils/path/normalize-route-slug";import{isAbsoluteUrl as V}from"../../utils/url/is-absolute-url";import{isAssetsLink as j}from"../../utils/path/is-assets-link";import{useL10nConfig as q}from"./hooks/index.js";import{loadAndNavigate as B}from"./utils/loadAndNavigate.js";import{isForcedNavigationLinkClick as G}from"../utils/utils.js";async function g(o,t){if(V(o))return;await(typeof window<"u"?window:global).__LOADER.tryLoad(o,void 0,t)}function oe(o){const{to:t,children:l,className:v,style:a,innerRef:i,target:L,external:c,languageInsensitive:w,onClick:m,active:H,rel:y,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,..._}=o,x=L||(c?"_blank":"_self"),A=c||t.match(/^(https?:\/\/|mailto:)/),f=y||(A?"noreferrer":void 0),n={className:v,children:l,target:x,...f&&{rel:f},onClick:m,..._},{defaultLocale:D,locales:S,currentLocale:b}=q(),O=F();let e=t;e.startsWith(".")&&(e=u.resolve(u.dirname(h(O.pathname)),h(t))),e=e.startsWith("#")?e:W(w?e:M(e,D,b,S));const r=e!=="/"?I(e):e,T=z(),d=typeof window<"u"?new URL(r,window.location.origin+window.location.pathname).search:void 0;return typeof t=="string"&&t.match(/^(https?:\/\/|mailto:)/)?s.createElement("a",{...n,ref:i,style:a,href:t,onMouseOver:async()=>g(t,d)}):j(r)?s.createElement("a",{...n,ref:i,style:a,href:r}):s.createElement(U,{...n,ref:i,style:a,to:r,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,onClick:p=>{m?.(),!G(p,n.target)&&(p.preventDefault(),B({navigate:T,to:r}))},onMouseOver:async()=>g(r,d)})}export{oe as Link};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r,{useEffect as C,useState as a}from"react";import D from"styled-components";import{Button as I}from"@redocly/theme/components/Button/Button";import{Admonition as N}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{withPathPrefix as y}from"@redocly/theme/core/utils";import{usePageData as k}from"../hooks/usePageData";import{usePreloadHistory as w}from"../usePreloadHistory";import{telemetry as b}from"../telemetry/index.js";import{useLoginUrl as q}from"../hooks";const M=e=>{const{apiId:s,status:t,setStatus:i}=e,c=w(),{userData:n}=k("userData")||{},u=q(),[l,p]=a(),[h,g]=a(),[m,A]=a(!0);C(()=>{n?.isAuthenticated&&fetch(`/api/api-keys/api-products/${s}/access`).then(d=>d.json().then(o=>{d.ok?(i(o.status),g(o.appId)):p(o.message)}).catch(()=>p("Something went wrong")).finally(()=>A(!1)))},[n?.isAuthenticated,s,i]);const E=()=>{!n?.isAuthenticated&&u?window.location.href=y(u):t==="ACCEPTED"?c.push("/apps/"+h||""):t==="NONE"&&c.push("/apps/?createApp&apiId="+s),b.sendRequestApiAccessButtonClickedMessage([{object:"button",action:"click"}])},P=(t==="PENDING"||m||l!=null)&&n?.isAuthenticated;return r.createElement(r.Fragment,null,r.createElement(I,{disabled:P,onClick:E,fullWidth:!0,size:"small"},x(t,m,l,!!n?.isAuthenticated)))},x=(e,s,t,i)=>{if(!i)return"Request access";if(s)return"Loading...";if(t)return"Failed to check access";switch(e){case"NONE":return"Request access";case"ACCEPTED":return"Credentials";case"PENDING":return"Pending access..."}return null},O=e=>e==="ACCEPTED"?r.createElement(f,{type:"success",name:"You have access to this API"}):e==="PENDING"?r.createElement(f,{type:"info",name:"You have requested access to this API"}):null,f=D(N)`
|
|
2
2
|
margin-top: 0px;
|
|
3
3
|
margin-bottom: var(--spacing-sm);
|
|
4
|
-
`;export{
|
|
4
|
+
`;export{M as RequestAccessButton,O as renderAdmonition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useThemeConfig as
|
|
1
|
+
import{useLocation as u}from"react-router-dom";import{useThemeConfig as d}from"@redocly/theme/core/hooks";import{getPathnameForLocale as e}from"@redocly/theme/core/utils";import{DEV_LOGIN_SLUG as i}from"../../../constants/common";import{buildLoginUrl as p}from"../../../utils/auth/build-login-url";import{useL10nConfig as a}from"./useL10nConfig";function F(c={}){const f=d(),{auth:o}=f,{defaultLocale:n,locales:t,currentLocale:r}=a(),m=u().pathname,s=()=>{if(o?.idpsInfo?.length){if(o.idpsInfo.length===1){const l=o.idpsInfo[0];return p(l.idpId,e("",n,r,t),m,c)}return e(i,n,r,t)}};return o?.devLogin?e(i,n,r,t):s()}export{F as useLoginUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as n,useEffect as l}from"react";import{syncScrollWithProject as i}from"../utils/syncScrollWithEditor.js";import{installProgrammaticScrollMarking as s,isProgrammaticScrollEvent as c}from"../utils/programmatic-scroll.js";import{usePostMessage as d}from"../../providers/post-message/use-post-message.js";import{isInIframe as a}from"../../utils/utils.js";const g=()=>{const{sendMessage:e}=d(),o=n(()=>{if(c()||!window.document.querySelector(":hover"))return;const{percentScrolled:r,sequenceNumber:t}=i(window.scrollY);e({type:"editor-scroll-updated",percentScrolled:r,sequenceNumber:t}),e({type:"scroll-updated",position:{absolute:window.scrollY,relative:Math.round(window.scrollY/(window.document.body.clientHeight-window.innerHeight)*100)}})},[e]);l(()=>{if(a())return s(),window.addEventListener("scroll",o,{passive:!0}),()=>{window.removeEventListener("scroll",o)}},[o])};export{g as useScrollTracker};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { OpenAPIDefinition, OpenAPISchema } from '@redocly/openapi-docs';
|
|
3
3
|
type JsonSchemaProps = {
|
|
4
4
|
options?: any;
|
|
5
|
+
title?: string;
|
|
5
6
|
schemaResolved?: OpenAPIDefinition;
|
|
6
7
|
schemaResolvedErrors?: string[];
|
|
7
8
|
schema?: OpenAPISchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RedocSchema as
|
|
1
|
+
import{RedocSchema as p,StoreProvider as l}from"@redocly/openapi-docs";import*as e from"react";import{Admonition as d}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{MarkdownLink as h}from"@redocly/theme/markdoc/components/MarkdownLink/MarkdownLink";import{link as f}from"../../../../../markdoc/nodes/index.js";import{OpenApiComponentWrap as E}from"../styled.elements";const k={nodes:{link:f},components:{MarkdownLink:h}};function S(m){const{options:s,title:t,schemaResolved:o,schemaResolvedErrors:n,schema:r}=m;if(r||o){const i={openapi:"3.0.0",info:{version:"1",description:"test",title:"test"},paths:{},"x-root":o?.components?.schemas?.__root||r,components:{schemas:{...o?.components?.schemas}}};return e.createElement(E,{"data-testid":"json-schema"},t?e.createElement("h3",null,t):null,e.createElement(l,{options:{...s,markdocOptions:k},definition:i},n?.length?e.createElement(d,{name:"Problem in json-schema tag",type:"danger"},n.map((a,c)=>e.createElement("div",{key:c},a))):null,e.createElement(p,{pointer:"#/x-root",disableDeepLinks:!0})))}}export{S as JsonSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as E,useEffect as Q,useMemo as J,useRef as m,useState as
|
|
1
|
+
import{useCallback as E,useEffect as Q,useMemo as J,useRef as m,useState as y}from"react";import{AiSearchError as d}from"@redocly/theme/core/constants";import{withPathPrefix as N,splitContentByToolCalls as V}from"@redocly/theme/core/utils";import{ServerRoutes as j}from"../../../constants/common";import{useSearchSession as B}from"@redocly/theme/core/contexts";import{AI_SEARCH_REQUEST_HEADERS as D,HTTP_ERROR_MAP as G}from"../../constants";import{useI18nConfig as K,usePageVersions as L}from"../hooks";import{telemetry as U}from"../telemetry/index.js";import{streamSSEMessages as $}from"./sse-parser";import{handleSSEMessage as z}from"./message-handlers";function or(u){const{searchSessionId:p}=B(),[r,t]=y({status:"idle"}),[P,g]=y([]),[S,b]=y([]),o=m(null),a=m(""),n=m(""),i=m([]),{currentLocale:C}=K(),{versions:_=[]}=L()||{},l=_.find(e=>e?.active),f=E(()=>{t({status:"idle",response:""}),b([]),a.current="",n.current="",i.current=[]},[]),w=E(()=>{o.current?.abort(),o.current=null,f(),g([])},[f]);Q(()=>()=>{o.current?.abort()},[]);const O=E(async(e,q)=>{if(!e)return;o.current?.abort();const h=new AbortController;o.current=h,f(),t({status:"loading",question:e,response:"",resources:[]});try{const c=await fetch(N(j.ASK_AI),{method:"POST",headers:D,body:JSON.stringify({text:e,history:q||[],locale:C,product:u?.product,filter:u?.filter,version:l&&{folder:l.folderId,label:l.label},searchSessionId:p}),signal:h.signal});if(!c.ok){t({status:"error",question:e,error:G[c.status]??d.HttpRequestFailed});return}const A=c.body;if(!A){t({status:"error",question:e,error:d.HttpRequestFailed});return}let I=!1;for await(const s of $(A,h.signal)){const F={messageId:a.current,resources:i.current,accumulatedResponse:n.current,setConversation:g,setState:t,setToolCalls:b},{messageId:v,resources:H,accumulatedResponse:M}=z(s,F);v&&(a.current=v),H&&(i.current=H),M&&(n.current=M),s.type==="error"&&(I=!0)}if(o.current=null,t(s=>s.status==="error"?s:n.current?{status:"success",question:e,response:n.current,resources:i.current}:{status:"error",question:e,error:d.EmptyResponse}),!I&&n.current&&e.trim()&&a.current){const s=a.current;U.sendSearchAIQueryMessage([{id:s,object:"aiSearchMessage",uri:`urn:redocly:realm:ui:aiSearchMessage:${s}`,question:e,answer:n.current,resources:JSON.stringify(i.current),searchSessionId:p,messageId:s,source:"realm",...u?.product&&{product:u.product}}])}}catch(c){if(c instanceof Error&&c.name==="AbortError")return;o.current=null,t({status:"error",question:e,error:d.HttpRequestFailed})}},[f,u?.product,C,u?.filter,l,p]),R=r.status==="loading"||r.status==="success"||r.status==="idle"?r.response:void 0,k=J(()=>V(R,S),[R,S]);return{askQuestion:O,isGeneratingResponse:r.status==="loading",response:R,resources:r.status==="loading"||r.status==="success"?r.resources:[],question:r.status!=="idle"?r.question:"",error:r.status==="error"?r.error:null,clearConversation:w,conversation:P,setConversation:g,toolCalls:S,contentSegments:k}}export{or as useAiSearch};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const SCROLL_SETTLE_MS = 150;
|
|
2
|
+
/**
|
|
3
|
+
* Marks the scroll events of the next SCROLL_SETTLE_MS as programmatic
|
|
4
|
+
* (editor sync, navigation) so the scroll tracker doesn't report them back
|
|
5
|
+
* as user scrolling. The window is short and fixed on purpose: a stray sync
|
|
6
|
+
* push can mute real user scrolling for at most one window, while continuous
|
|
7
|
+
* sync streams stay suppressed because every push re-marks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function markProgrammaticScroll(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Returns true while a recently marked programmatic scroll is settling.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isProgrammaticScrollEvent(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Wraps the window scroll methods so every programmatic page scroll marks
|
|
16
|
+
* itself — callers (portal, theme, custom plugins) don't need to remember to
|
|
17
|
+
* call markProgrammaticScroll(). Element.prototype.scrollIntoView is
|
|
18
|
+
* intentionally left alone: it often targets inner scroll containers, and
|
|
19
|
+
* marking those would swallow real user page scrolls.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installProgrammaticScrollMarking(): void;
|
|
22
|
+
//# sourceMappingURL=programmatic-scroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=150;let r=!1,o=null;function c(){r=!0,o&&clearTimeout(o),o=setTimeout(()=>{r=!1,o=null},150)}function a(){return r}let l=!1;function s(){if(!l){l=!0;for(const t of["scrollTo","scroll","scrollBy"]){const e=window[t].bind(window);window[t]=((...i)=>{c(),e(...i)})}}}export{n as SCROLL_SETTLE_MS,s as installProgrammaticScrollMarking,a as isProgrammaticScrollEvent,c as markProgrammaticScroll};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{JsonSchemaRef as e}from"../attributes/index.js";const o={schema:{attributes:{schema:{type:e},options:{type:Object,default:{}},schemaResolved:{type:Object},schemaResolvedErrors:{type:Array,default:[]}},render:"JsonSchema",selfClosing:!0,dynamicComponentLib:"openapi"},tagName:"json-schema"};export{o as jsonSchema};
|
|
1
|
+
import{JsonSchemaRef as e}from"../attributes/index.js";const o={schema:{attributes:{schema:{type:e},title:{type:String},options:{type:Object,default:{}},schemaResolved:{type:Object},schemaResolvedErrors:{type:Array,default:[]}},render:"JsonSchema",selfClosing:!0,dynamicComponentLib:"openapi"},tagName:"json-schema"};export{o as jsonSchema};
|
|
@@ -32,8 +32,11 @@ export declare const ASK_AI_API_URL: string;
|
|
|
32
32
|
export declare const SEMANTIC_SEARCH_API_URL: string;
|
|
33
33
|
export declare const REGISTRY_APIS_API_URL: string | undefined;
|
|
34
34
|
export declare const REGISTRY_APIS_PATHS_API_URL: string | undefined;
|
|
35
|
-
export declare const
|
|
35
|
+
export declare const CACHE_CONTROL_NO_STORE_HEADER_VALUE = "no-store";
|
|
36
36
|
export declare const DEFAULT_IMMUTABLE_CACHE_MAX_AGE: number;
|
|
37
|
+
export declare const X_REDOCLY_CACHE_CONTROL_HEADER = "X-Redocly-Cache-Control";
|
|
38
|
+
export declare const CACHE_CONTROL_PUBLIC_HTML = "no-cache";
|
|
39
|
+
export declare const X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML = "public, s-maxage=86400, max-age=10, must-revalidate";
|
|
37
40
|
export declare const AUTH_URL: string | undefined;
|
|
38
41
|
export declare const DEFAULT_TITLE = "Developer Documentation";
|
|
39
42
|
export declare const SSR_RENDER_MODE: 'worker' | 'main';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ServerRoutes as L,USER_THEME_ALIAS as c}from"../../constants/common.js";import{envConfig as
|
|
1
|
+
import{ServerRoutes as L,USER_THEME_ALIAS as c}from"../../constants/common.js";import{envConfig as _}from"../config/env-config.js";const D="runtime",N="/assets",x="/_spec",U="/_bundle",P="static",l="redocly:::linkOriginal",M="@",a="default",i=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),m="@redocly/theme/plugin.js",H="styles.css",F=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],u=_.JWT_SECRET_KEY||"test_secret_key",A="@i18n",p="@l10n",G=[c,A,p],Y="https://redocly.com/auth/aud",d="catalog.json",g="scorecard.json",B="page-count.json",h="sitemap.xml",K="llms.txt",R=_.PROJECT_ID,e=_.PROJECT_SLUG,n=_.ORGANIZATION_ID,s=_.ORG_SLUG,E=_.BH_API_URL,t=E&&s&&e?`${E}/orgs/${s}/projects/${e}`:void 0,o=E&&n&&R?`${E}/orgs/${n}/projects/${R}`:void 0,S=E?`${E}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",j=_.ENTITLEMENTS_JWKS_CDN_URL||S,J=t?`${t}/feedback`:"",W=o?`${o}/ai-agentic-conversations`:"",$=o?`${o}/semantic-search`:"",y=t&&`${t}/registry/apis`,f=t&&`${t}/registry/paths`,V="no-store",X=365*24*60*60,k="X-Redocly-Cache-Control",w="no-cache",v="public, s-maxage=86400, max-age=10, must-revalidate",b=_.AUTH_URL,Z="Developer Documentation",T=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",q=T==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,z=T==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,Q="-----BEGIN CERTIFICATE-----",__="-----END CERTIFICATE-----",E_=_.REDOCLY_TELEMETRY_ENDPOINT||"https://app.cloud.redocly.com/api/telemetry/project",t_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",o_="http://localhost:4318/v1/traces",R_=[L.HEALTH],r=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",e_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(I=>I.trim()).filter(Boolean).concat(r):[r];export{e_ as ALLOWED_CORS_ORIGINS,Y as ALTERNATIVE_AUD_CLAIM_NAME,W as ASK_AI_API_URL,b as AUTH_URL,Q as BEGIN_CERTIFICATE_DELIMITER,t as BH_API_PROJECTS_URL,o as BH_API_PROJECTS_URL_V2,V as CACHE_CONTROL_NO_STORE_HEADER_VALUE,w as CACHE_CONTROL_PUBLIC_HTML,d as CATALOG_OUTPUT_FILE_NAME,X as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,F as DEFAULT_PROJECT_PLUGIN_PATHS,m as DEFAULT_THEME_PLUGIN_PATH,Z as DEFAULT_TITLE,a as DEFAULT_VERSION_NAME,x as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,__ as END_CERTIFICATE_DELIMITER,j as ENTITLEMENTS_JWKS_URL,J as FEEDBACK_API_URL,A as I18N_DIR_NAME,u as JWT_SECRET_KEY,p as L10N_DIR_NAME,l as LINK_ORIGINAL_ATTR_NAME,K as LLMS_TXT_FILE_NAME,n as ORG_ID,s as ORG_SLUG,R_ as OTEL_EXCLUDED_ROUTES,o_ as OTEL_TRACES_DEV_URL,B as PAGE_COUNT_OUTPUT_FILE_NAME,R as PROJECT_ID,e as PROJECT_SLUG,U as PUBLIC_API_DEFINITIONS_FOLDER,N as PUBLIC_ASSETS_FOLDER,P as PUBLIC_STATIC_FOLDER,y as REGISTRY_APIS_API_URL,f as REGISTRY_APIS_PATHS_API_URL,G as RESERVED_DIR_NAMES,D as RUNTIME_RESOURCES_DIR,g as SCORECARD_OUTPUT_FILE_NAME,$ as SEMANTIC_SEARCH_API_URL,r as SERVER_EDITOR_APP_URL,h as SITEMAP_FILE_NAME,T as SSR_RENDER_MODE,z as SSR_WORKERS_MAX,q as SSR_WORKERS_MIN,H as STYLES_FILE,t_ as TELEMETRY_ENABLED,E_ as TELEMETRY_ENDPOINT,i as VERSIONED_FOLDER_REGEXP_MATCH,M as VERSION_SEPARATOR,k as X_REDOCLY_CACHE_CONTROL_HEADER,v as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
|
|
@@ -9,4 +9,9 @@ export type GraphqlLoadResult = {
|
|
|
9
9
|
settings: GraphQLConfig;
|
|
10
10
|
} | undefined;
|
|
11
11
|
export declare const graphqlDocLoader: LoaderFn;
|
|
12
|
+
export type BundledDefinition = {
|
|
13
|
+
relativePath: string;
|
|
14
|
+
settings: GraphQLConfig;
|
|
15
|
+
};
|
|
16
|
+
export declare const graphqlDocsLoader: LoaderFn<BundledDefinition[]>;
|
|
12
17
|
//# sourceMappingURL=graphql-doc-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildSchema as d}from"graphql";import{MenuStore as f,AppStore as g}from"@redocly/graphql-docs";import
|
|
1
|
+
import{buildSchema as d}from"graphql";import{MenuStore as f,AppStore as g}from"@redocly/graphql-docs";import h from"node:path";import{combineUrls as u}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as w}from"../../../constants/common.js";import{deepMerge as q}from"../../../utils/object/deep-merge.js";import{reporter as S}from"../../tools/notifiers/reporter.js";import{getApiConfigByPath as b}from"../get-api-config.js";import{replaceFileExtension as x}from"../openapi-docs/store-definition-bundles.js";const E=async(r,{getConfig:i,fs:c})=>{const e=await i(),o=e?.graphql??{},t=await c.read(r),{graphql:n={},metadata:m}=b(e.apis,r),s=q(o||{},n,{feedback:o.feedback||e.feedback,downloadUrls:o.downloadUrls||[{url:u(w,`${x(r,h.posix.extname(r))}?download`)}]});let p,l;try{const a=d(t);l=new g(a),p=new f(a,s)}catch(a){await S.panicOnBuild(a);return}return{menu:p,store:l,settings:s,metadata:m,content:t}},F=async(r,{fs:i,cache:c,isPathIgnored:e})=>{const o=[];for(const{relativePath:t}of i.scan(/(\.gql|\.graphql)$/)){if(await e(t))continue;const n=await c.load(t,"graphql-doc").catch(()=>null);n?.data&&o.push({relativePath:t,settings:n.data.settings})}return o};export{E as graphqlDocLoader,F as graphqlDocsLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeFileSync as v}from"node:fs";import C from"node:path";import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{combineUrls as
|
|
1
|
+
import{writeFileSync as v}from"node:fs";import C from"node:path";import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{combineUrls as q}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_TEMPLATE_ID as O,GRAPHQL_SPEC_SLUG as Q,PUBLIC_RBAC_SCOPE_ITEM as H}from"../../../constants/common.js";import{removeTrailingSlash as I}from"../../../utils/url/remove-trailing-slash.js";import{getTemplatePath as N}from"./get-template-path.js";import{searchResolver as F}from"./search/search-resolver.js";import{graphqlDocLoader as M,graphqlDocsLoader as U}from"./graphql-doc-loader.js";import{getAiDocumentsStore as _}from"./search/ai/get-ai-search-document.js";import{fromCurrentDir as k}from"../../utils/paths.js";import{ensureDir as x}from"../../utils/fs.js";import{telemetryTraceStep as B}from"../../../cli/telemetry/helpers/trace-step.js";const j="graphql-docs-",R="graphql-spec-download";async function nt(){return{id:"graphql",requiredEntitlements:["graphql"],loaders:{"graphql-doc":M,"load-graphql-docs":U},processContent:async(t,{fs:l,cache:n,isPathIgnored:i,withPathPrefix:p})=>{await B("build.plugin.graphql_docs",async()=>{t.createRequestHandler(R,k(import.meta.url,"./spec-download.api.js")),t.addApiRoute({slug:Q+"/*",requestHandlerId:R,httpMethod:"all",[$]:H,getStaticData:async()=>({props:{}})});const m=t.createTemplate(O,N("./template/GraphQLDocs.js"));for(const{relativePath:o}of l.scan(/(\.gql|\.graphql)$/)){if(await i(o))continue;const h=await n.load(o,"graphql-doc");if(!h.data)continue;K(h.data.content,t.outdir,o);const{menu:A,content:G,settings:u,metadata:T,store:d}=h.data,L=`${j}${o}`;await t.createSharedData(L,G);const c=[{key:"graphQlSettings",id:L}],b=A.getGroups(),y=A.getSidebarItems(),g={type:"graphql",title:b[0].name,...T},s=[{slugSuffix:"",fsPath:o,templateId:m,getStaticData:S(void 0,u,p),sharedData:c,getAiDocumentsStore:_({label:u.info?.title??"GraphQL Overview",groupName:"overview",metadata:g,actions:t,store:d,includeInLLMsTxt:!0})}];for(const r of b){const f=`${r.id}`;s.push({slugSuffix:f,fsPath:o,templateId:m,getStaticData:S(r,u,p),sharedData:c});for(const e of r.typeGroups){const a=`${e.id}`;s.push({slugSuffix:a,fsPath:o,templateId:m,getStaticData:S(e,u,p),sharedData:c,getAiDocumentsStore:_({label:e.name,groupName:e.name,metadata:g,actions:t,store:d,isTypeGroup:!0,items:new Set(e.items)})});for(const E of e.items){const P=`${e.id}/${E}`;s.push({slugSuffix:P,fsPath:o,templateId:m,getStaticData:S(e,u,p),sharedData:c,getAiDocumentsStore:_({label:E,groupName:e.name,metadata:g,actions:t,store:d})})}}}if(!s.length)return;const D=s[s.length-1];D.metadata=g,D.getSidebar=r=>{function f(e){return e.map(a=>({...a,slug:a.slug&&I(q(r.baseSlug,a.slug)),routeSlug:a.routeSlug&&I(q(r.baseSlug,a.routeSlug)),link:a.link&&I(q(r.baseSlug,a.link)),items:a.items&&f(a.items)}))}return f(y)},D.getSearchDocuments=F(t,d);for(const r of s)t.addRoute(r)}})}}}function S(t,l,n){return async function(i){return{props:{seo:{title:t?.name??l.info?.title??"GraphQL Overview"},settings:{...l,location:{section:t?.id},sidebar:{hide:!0},baseUrlPath:n(i.baseSlug)},disableAutoScroll:!0}}}}function K(t,l,n){const i=w.slice(1);v(x(C.resolve(l,`${i}/${n}`)),t,"utf8")}export{nt as graphqlDocsPlugin,K as storeGqlSchema};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{isPrimitive as
|
|
2
|
-
`);break;case"fence":const i=c(e,"process")===!1;r.push(
|
|
1
|
+
import{isPrimitive as S}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as c}from"../../../../markdoc/helpers/get-node-attribute.js";import{getVariable as v}from"../../../../markdoc/helpers/get-variable.js";import{isTag as A}from"../../../../markdoc/helpers/guards/is-tag.js";import{isNode as C}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as y}from"../../../../markdoc/helpers/guards/is-variable.js";import{isExampleNode as B}from"../../../../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as E}from"../../../../markdoc/helpers/guards/is-fence-node.js";function a(s,n={}){const r=[];for(const e of s){if(S(e)){const i=n.isTrim?m(String(e)):String(e);i&&r.push(i)}else if(C(e))switch(e.type){case"text":r.push(a([c(e,"content")],n));break;case"code":r.push(`\`${a([c(e,"content")],n)}\``);break;case"blockquote":r.push(`> ${a(e.children,n)}
|
|
2
|
+
`);break;case"fence":const i=c(e,"process")===!1;r.push(g(e,n,i));break;case"list":const h=c(e,"ordered")||!1,l=c(e,"marker"),d=e.children.map((t,o)=>`${" ".repeat((n?.indent??0)*2)}${h?o+1:""}${l} ${a([t],{...n??{},indent:(n?.indent??0)+1})}`);r.push(`${d.join("")}
|
|
3
3
|
`);break;case"item":r.push(e.children.map(t=>`${a([t],n).trimEnd()}
|
|
4
|
-
`).join(""));break;case"thead":const
|
|
5
|
-
`);break;case"tr":const
|
|
4
|
+
`).join(""));break;case"thead":const u=e.children.map(t=>a([t],n));r.push(`${u}| ${" --- |".repeat(e.children?.[0]?.children.length)}
|
|
5
|
+
`);break;case"tr":const f=e.children.map(t=>a([t],n));r.push(`| ${f.join(" | ")} |
|
|
6
6
|
`);break;case"em":r.push(`*${a(e.children,n)}*`);break;case"strong":r.push(`**${a(e.children,n)}**`);break;case"softbreak":case"hardbreak":r.push(`
|
|
7
7
|
`);break;case"hr":r.push(`
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`);break;case"heading":const
|
|
12
|
-
`);break;case"image":const k=c(e,"alt")||"",b=c(e,"src")||"";r.push(``);break;case"link":const
|
|
13
|
-
`);break;case"tag":if(
|
|
14
|
-
\`\`\`${`${
|
|
11
|
+
`);break;case"heading":const p=c(e,"level")??0;r.push(`${"#".repeat(p)} ${a(e.children,n)}
|
|
12
|
+
`);break;case"image":const k=c(e,"alt")||"",b=c(e,"src")||"";r.push(``);break;case"link":const T=c(e,"href")||"";r.push(`[${a(e.children,n)}](${T})`);break;case"paragraph":case"table":r.push(`${a(e.children,n)}
|
|
13
|
+
`);break;case"tag":if(N(e)&&n.skipConditionals)continue;if(B(e)){r.push(...e.children.map(t=>{if(E(t)){const o=c(t,"process")!==!0;return g(t,n,o)}return a([t],n)}));continue}if(e.tag==="code-snippet"){const t=c(e,"rawContent");if(t){const o=c(e,"language"),$=c(e,"title"),j=`
|
|
14
|
+
\`\`\`${`${o||""}${$?`${o?" ":""}${$}`:""}`}
|
|
15
15
|
${t.trimEnd()}
|
|
16
16
|
\`\`\`
|
|
17
|
-
`;r.push(
|
|
18
|
-
\`\`\`${
|
|
19
|
-
${
|
|
17
|
+
`;r.push(j)}continue}if(e.tag==="json-example"){const t=w(e);t&&r.push(t);continue}if(e.tag==="json-schema"){const t=x(e);t&&r.push(t);continue}if(n.renderTag){const t=n.renderTag(e,{getBody:()=>a(e.children,n)});if(t!==void 0){r.push(t);continue}}r.push(`${a(e.children,n)}`);break;default:r.push(a(e.children,n));break}else A(e)&&r.push(a(e.children,n));y(e)&&r.push(a([v(e,n.variables)],n))}return n.isTrim?m(r.map(e=>m(e)).join("")):r.join("")}function m(s){return s.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function g(s,n={},r=!1){const e=c(s,"title"),i=c(s,"language"),h=`${i||""}${e?`${i?" ":""}${e}`:""}`,l=r?(c(s,"content")||"").trimEnd():a(s.children,n).trimEnd();return`
|
|
18
|
+
\`\`\`${h}
|
|
19
|
+
${l}
|
|
20
20
|
\`\`\`
|
|
21
21
|
`}function w(s){const n=c(s,"json")??c(s,"valueResolved")??c(s,"schemaResolved"),r=c(s,"title");return n===null?null:`
|
|
22
22
|
\`\`\`${`json${r?` ${r}`:""}`}
|
|
23
23
|
${JSON.stringify(n,null,2)}
|
|
24
24
|
\`\`\`
|
|
25
|
-
`}function x(s){const n=c(s,"schemaResolved");if(n===null)return null;const{components:
|
|
26
|
-
|
|
27
|
-
${JSON.stringify(
|
|
25
|
+
`}function x(s){const n=c(s,"schemaResolved");if(n===null)return null;const r=c(s,"title"),{components:e,openapi:i,...h}=n,{__root:l,...d}=e?.schemas||{},u=l?{...l,...Object.keys(d).length>0?{components:{schemas:d}}:{},...h}:n;return`
|
|
26
|
+
\`\`\`${`json${r?` ${r}`:""}`}
|
|
27
|
+
${JSON.stringify(u,null,2)}
|
|
28
28
|
\`\`\`
|
|
29
29
|
`}export{a as toMarkdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldHandleMcpAuth as n}from"../auth/auth-handlers.js";const i=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"];function
|
|
1
|
+
import{shouldHandleMcpAuth as n}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as a}from"./tools/graphql/types.js";const i=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"];function c(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:{type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"API name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:{type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...i,...i.map(r=>r.toLowerCase())],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},o(e.products)];return n(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:{type:"object",required:[],additionalProperties:!1,properties:{}}}),e.hasGraphqlApis&&t.push(...s()),t}function s(){const e={name:{type:"string",description:"GraphQL schema name",minLength:1}},t={page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}};return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:{type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},...t}}},{name:"get-graphql-type-list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category) and/or `filter` (member-name substring, e.g. "book") to explore a domain cheaply instead of pulling the full schema.',schema:{type:"object",required:["name"],additionalProperties:!1,properties:{...e,kind:{type:"string",description:"Optional: return only a single category of schema members",enum:[...a],nullable:!0},filter:{type:"string",description:'Optional: only members whose name contains this substring (e.g. "book")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},...t}}},{name:"get-graphql-type",description:"Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Set includeReferencedTypes to also pull in every type it references transitively \u2014 the full structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches).",schema:{type:"object",required:["name","type"],additionalProperties:!1,properties:{...e,type:{type:"string",description:"Name of the type, operation, or directive",minLength:1},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}}},{name:"get-graphql-schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:{type:"object",required:["name"],additionalProperties:!1,properties:e}}]}function o(e){const t=e&&e.length>0;return{name:"search",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...t?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{}}}}}export{c as getDefaultToolSchemas};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{withPathPrefix as p}from"@redocly/theme/core/utils";import{ServerRoutes as h}from"../../../../../../constants/common.js";const f=async(a,t)=>{const{query:c,product:u}=a,l=JSON.stringify({query:c,product:u});let e=`${t.baseUrl}${p(h.SEMANTIC_SEARCH)}`;e.startsWith("http://")&&(e=e.replace(/^http:\/\//,"https://"));const o=t.accessToken?`authorization=${String(t.accessToken).replace(/^Bearer /,"")}`:"";try{const s=await fetch(e,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...o?{Cookie:o}:{}},body:l});if(!s.ok)return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0};const r=await s.json();if(!r||r.length===0)return{content:[{type:"text",text:"No results found."}]};const i=r.map(n=>`### [${n.title}](${new URL(n.url,t.baseUrl).toString()})
|
|
2
|
+
|
|
3
|
+
${n.content}
|
|
4
|
+
`).join(`
|
|
5
|
+
|
|
6
|
+
`).trim();return{content:[{type:"text",text:i.length?i:"No results found."}]}}catch{return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0}}};var m={search:f};export{m as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import c from"node:fs";import f from"node:path";import{MAX_DOCUMENTS_PER_CATEGORY as $}from"../../../constants.js";function j(m,u){return Object.entries(m).map(([h,s])=>{if(!s||s.length===0)return"";const x=s.slice(0,$).map(d=>{const{document:t,highlight:o}=d,p=o?.title||(Array.isArray(t.title)?t.title[0]:t.title);let n=`Document: ${t.title}`;n+=`### [${p}](${t.url})
|
|
2
|
+
|
|
3
|
+
`;let r;if(t.url)try{let e=t.url.startsWith("/")?t.url.slice(1):t.url;const i=e.indexOf("#");i!==-1&&(e=e.substring(0,i));const l=f.extname(e);l&&(e=e.slice(0,-l.length));let y=e+".md";const a=f.join(u,y);c.existsSync(a)&&(r=c.readFileSync(a,"utf8"))}catch{}return r||(r=o?.text||(Array.isArray(t.text)?t.text[0]:t.text)),n+=r,t.facets&&(n+=`
|
|
4
|
+
|
|
5
|
+
**Categories:**
|
|
6
|
+
`,Object.entries(t.facets).forEach(([e,i])=>{n+=`- ${e}: ${i}
|
|
7
|
+
`})),n});return`## ${h}
|
|
8
|
+
|
|
9
|
+
${x}`}).join(`
|
|
10
|
+
|
|
11
|
+
`).trim()}export{j as processDocuments};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { GraphqlTypeKind } from './types.js';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
'get-graphql-type-list': McpToolHandler<{
|
|
5
|
+
name: string;
|
|
6
|
+
kind?: GraphqlTypeKind;
|
|
7
|
+
filter?: string;
|
|
8
|
+
referencesType?: string;
|
|
9
|
+
page?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=get-graphql-type-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{GRAPHQL_TYPE_KINDS as g}from"./types.js";import{respondWithGraphqlSchema as d,paginate as u}from"./tool-helpers.js";import{groupSchemaTypes as y,filterMembersReferencingType as h}from"./utils.js";const T=(i,a)=>d(i.name,a,({name:f,schema:o})=>{const{kind:p,filter:n,referencesType:l,page:s=1,limit:m=300}=i,c=y(o);let e=(p?[p]:g).flatMap(t=>c[t].map(r=>({kind:t,...r})));if(l&&(e=h(o,e,l)),n){const t=n.toLowerCase();e=e.filter(r=>r.name.toLowerCase().includes(t))}return JSON.stringify({name:f,...u(e,s,m)},null,2)});var G={"get-graphql-type-list":T};export{G as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
'get-graphql-type': McpToolHandler<{
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
includeReferencedTypes?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=get-graphql-type.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{respondWithGraphqlSchema as d}from"./tool-helpers.js";import{printTypeOrField as y,printTypeOrFieldWithReferences as f}from"./utils.js";const l=(n,p)=>d(n.name,p,({name:r,schema:t})=>{const{type:e,includeReferencedTypes:i}=n;if(i){const{sdl:o,referencedCount:c}=f(t,e);return`# Schema: ${r}
|
|
2
|
+
# Type: ${e} (+ ${c} referenced types)
|
|
3
|
+
|
|
4
|
+
${o}`}return`# Schema: ${r}
|
|
5
|
+
# Type: ${e}
|
|
6
|
+
|
|
7
|
+
${y(t,e)}`});var m={"get-graphql-type":l};export{m as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
'list-graphql-apis': McpToolHandler<{
|
|
4
|
+
filter?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=list-graphql-apis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{paginate as p,textResult as r}from"./tool-helpers.js";const c=async(l,n)=>{const{filter:a,page:o=1,limit:m=300}=l;let e=n.graphqlDescriptions;if(a){const s=a.toLowerCase();e=e.filter(i=>i.name.toLowerCase().includes(s))}const t=p(e,o,m);return t.items.length===0?r("No GraphQL schemas available"):r(JSON.stringify({...t,items:t.items.map(({name:s,description:i})=>({name:s,description:i}))}))};var f={"list-graphql-apis":c};export{f as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GraphQLSchema } from 'graphql';
|
|
2
|
+
import type { McpToolContext } from '../../../types.js';
|
|
3
|
+
export declare function loadGraphqlSchema(name: string, context: McpToolContext): Promise<{
|
|
4
|
+
name: string;
|
|
5
|
+
schema: GraphQLSchema;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=load-graphql-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"node:path";import{existsSync as m}from"node:fs";import{readFile as h}from"node:fs/promises";import{buildSchema as e}from"graphql";import{PUBLIC_API_DEFINITIONS_FOLDER as n}from"../../../../../constants/common.js";import{findGraphqlSchemaByName as f}from"./utils.js";async function w(r,a){const o=f(a.graphqlDescriptions,r);if(!o)throw new Error(`No GraphQL schema found matching "${r}".`);const i=t.join(a.outdir||"",n,o.relativePath);if(!m(i))throw new Error(`No GraphQL schema found matching "${r}".`);return{name:o.name,schema:e(await h(i,"utf-8"))}}export{w as loadGraphqlSchema};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { McpToolContext, McpToolWorkerResponse } from '../../../types.js';
|
|
2
|
+
import { loadGraphqlSchema } from './load-graphql-schema.js';
|
|
3
|
+
type LoadedGraphqlSchema = Awaited<ReturnType<typeof loadGraphqlSchema>>;
|
|
4
|
+
export declare function textResult(text: string, isError?: boolean): McpToolWorkerResponse;
|
|
5
|
+
export declare function respondWithGraphqlSchema(name: string, context: McpToolContext, render: (loaded: LoadedGraphqlSchema) => string): Promise<McpToolWorkerResponse>;
|
|
6
|
+
export declare function paginate<T>(items: T[], page: number, limit: number): {
|
|
7
|
+
items: T[];
|
|
8
|
+
limit: number;
|
|
9
|
+
total: number;
|
|
10
|
+
page: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadGraphqlSchema as c}from"./load-graphql-schema.js";function o(t,e=!1){return{content:[{type:"text",text:t}],isError:e?!0:void 0}}async function u(t,e,r){try{return o(r(await c(t,e)))}catch(n){return o(n.message,!0)}}function h(t,e,r){const n=t.length,a=(e-1)*r;return{items:t.slice(a,a+r),limit:r,total:n,page:e,totalPages:Math.ceil(n/r)}}export{h as paginate,u as respondWithGraphqlSchema,o as textResult};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
|
|
2
|
+
export type GraphqlTypeKind = (typeof GRAPHQL_TYPE_KINDS)[number];
|
|
3
|
+
export type SchemaMember = {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
args?: string;
|
|
8
|
+
};
|
|
9
|
+
export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"];export{s as GRAPHQL_TYPE_KINDS};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GraphQLSchema } from 'graphql';
|
|
2
|
+
import type { GraphqlDescriptionInfo } from '../../../types.js';
|
|
3
|
+
import type { GraphqlTypeKind, GroupedSchemaTypes } from './types.js';
|
|
4
|
+
export declare function findGraphqlSchemaByName(graphqlDescriptions: GraphqlDescriptionInfo[], name: string): GraphqlDescriptionInfo | undefined;
|
|
5
|
+
export declare function groupSchemaTypes(schema: GraphQLSchema): GroupedSchemaTypes;
|
|
6
|
+
export declare function filterMembersReferencingType<T extends {
|
|
7
|
+
kind: GraphqlTypeKind;
|
|
8
|
+
name: string;
|
|
9
|
+
}>(schema: GraphQLSchema, members: T[], targetName: string): T[];
|
|
10
|
+
export declare function referencedTypeClosure(schema: GraphQLSchema, name: string): string[];
|
|
11
|
+
export declare function printTypeOrField(schema: GraphQLSchema, name: string): string;
|
|
12
|
+
export declare function printTypeOrFieldWithReferences(schema: GraphQLSchema, name: string): {
|
|
13
|
+
sdl: string;
|
|
14
|
+
referencedCount: number;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{getNamedType as p,isEnumType as v,isInputObjectType as y,isInterfaceType as g,isIntrospectionType as u,isObjectType as T,isScalarType as m,isSpecifiedScalarType as S,isUnionType as b,print as c,printType as N,specifiedDirectives as O}from"graphql";const j=new Set(["queries","mutations","subscriptions"]);function C(e,r){const t=r.toLowerCase();return e.find(i=>i.name.toLowerCase().includes(t))}function a(e,r){return e.getQueryType()?.getFields()[r]??e.getMutationType()?.getFields()[r]??e.getSubscriptionType()?.getFields()[r]}function w(e){return[p(e.type).name,...e.args.map(r=>p(r.type).name)]}function d(e){const r=new Set;if(T(e)||g(e)){for(const t of Object.values(e.getFields())){r.add(p(t.type).name);for(const i of t.args)r.add(p(i.type).name)}for(const t of e.getInterfaces())r.add(t.name)}else if(b(e))for(const t of e.getTypes())r.add(t.name);else if(y(e))for(const t of Object.values(e.getFields()))r.add(p(t.type).name);return r}function $(e){const r=new Set([e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(n=>!!n).map(n=>n.name)),t={queries:l(e.getQueryType()),mutations:l(e.getMutationType()),subscriptions:l(e.getSubscriptionType()),objects:[],interfaces:[],unions:[],enums:[],inputs:[],scalars:[],directives:[]};for(const n of Object.values(e.getTypeMap())){if(u(n)||r.has(n.name))continue;const o={name:n.name,description:n.description??void 0};m(n)?S(n)||t.scalars.push(o):T(n)?t.objects.push(o):g(n)?t.interfaces.push(o):b(n)?t.unions.push(o):v(n)?t.enums.push(o):y(n)&&t.inputs.push(o)}const i=new Set(O.map(n=>n.name));return t.directives=e.getDirectives().filter(n=>!i.has(n.name)).map(n=>({name:n.name,description:n.description??void 0})),t}function l(e){return e?Object.values(e.getFields()).map(r=>({name:r.name,description:r.description??void 0,type:r.type.toString(),args:r.args.length?`(${r.args.map(t=>{const i=t.astNode?.defaultValue?` = ${c(t.astNode.defaultValue)}`:"";return`${t.name}: ${t.type}${i}`}).join(", ")})`:void 0})):[]}function q(e,r,t){const i=h(e,t);if(!i)return[];const n=new Set([i,...x(e,i)]);return r.filter(o=>{if(!j.has(o.kind))return n.has(o.name);const s=a(e,o.name);return s?w(s).some(f=>n.has(f)):!1})}function F(e,r){const t=new Set,i=[...M(e,r)];for(let n=0;n<i.length;n+=1){const o=i[n];if(t.has(o))continue;t.add(o);const s=e.getType(o);if(s)for(const f of d(s))t.has(f)||i.push(f)}return[...t].filter(n=>n!==r&&D(e,n))}function M(e,r){const t=e.getType(r);if(t)return d(t);const i=a(e,r);if(i)return new Set(w(i));const n=e.getDirective(r);return n?new Set(n.args.map(o=>p(o.type).name)):new Set}function x(e,r){const t=new Map;for(const o of Object.values(e.getTypeMap()))if(!u(o))for(const s of d(o)){let f=t.get(s);f||(f=new Set,t.set(s,f)),f.add(o.name)}const i=new Set,n=[r];for(let o=0;o<n.length;o+=1)for(const s of t.get(n[o])??[])i.has(s)||(i.add(s),n.push(s));return i}function h(e,r){const t=r.toLowerCase();return Object.keys(e.getTypeMap()).find(i=>i.toLowerCase()===t)}function D(e,r){const t=e.getType(r);return!t||u(t)?!1:!(m(t)&&S(t))}function I(e,r){const t=e.getType(r);if(t)return N(t);const i=a(e,r);if(i?.astNode)return c(i.astNode);const n=e.getDirective(r);if(n?.astNode)return c(n.astNode);throw new Error(`No GraphQL type, operation, or directive named "${r}" found.`)}function L(e,r){const t=I(e,r),i=F(e,r).map(n=>e.getType(n)).filter(n=>!!n).map(n=>N(n));return{sdl:[t,...i].join(`
|
|
2
|
+
|
|
3
|
+
`),referencedCount:i.length}}export{q as filterMembersReferencingType,C as findGraphqlSchemaByName,$ as groupSchemaTypes,I as printTypeOrField,L as printTypeOrFieldWithReferences,F as referencedTypeClosure};
|