@redocly/realm 0.137.0-next.10 → 0.137.0-next.12
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 +38 -0
- package/dist/cli/build/index.js +1 -1
- package/dist/client/app/Sidebar/useActions.js +1 -1
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useCatalogFilter.js +1 -1
- package/dist/client/app/search/useFacets.js +1 -1
- package/dist/client/app/seo/SeoTags.js +1 -1
- package/dist/server/config/env-config.d.ts +2 -0
- package/dist/server/config/env-schema.d.ts +5 -0
- package/dist/server/config/env-schemas/feature-flags.d.ts +4 -0
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/esbuild/esbuild-logger.d.ts +2 -2
- package/dist/server/esbuild/esbuild-logger.js +3 -3
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +1 -1
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +33 -33
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditAppDescriptionDialog.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditAppDialog.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditCallbackUrlDialog.js +1 -1
- package/dist/server/plugins/markdown/is-partial.js +1 -1
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +5 -4
- package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +5 -2
- package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
- package/dist/server/plugins/mcp/codemode/prompts.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/prompts.js +7 -6
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.d.ts +2 -2
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.js +1 -11
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.d.ts +2 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.js +5 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.d.ts +1 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.js +2 -2
- package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.d.ts +5 -0
- package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.js +1 -0
- package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.d.ts +8 -0
- package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.js +2 -0
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +3 -1
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/core/types.d.ts +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +5 -5
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +2 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +4 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +6 -2
- package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.d.ts +5 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.js +1 -0
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
- package/dist/server/plugins/mcp/types.d.ts +1 -0
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -1
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.d.ts +3 -1
- package/dist/server/plugins/search/llmstxt/index.js +9 -9
- package/dist/server/sandbox/sandbox.js +2 -2
- package/dist/server/sandbox/types.d.ts +8 -0
- package/dist/server/sandbox/utils/execution-budget.js +1 -1
- package/dist/server/sandbox/utils/return-last-expression.d.ts +6 -0
- package/dist/server/sandbox/utils/return-last-expression.js +1 -0
- package/dist/server/sandbox/utils/setup-host-functions.d.ts +1 -0
- package/dist/server/sandbox/utils/setup-host-functions.js +2 -2
- package/dist/server/store.js +1 -1
- package/dist/server/utils/globs.d.ts +4 -0
- package/dist/server/utils/globs.js +1 -1
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.137.0-next.12
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7df87b0c29d: Added the `singleExpanded` attribute to the `accordion-group` Markdoc tag to keep only one accordion open at a time.
|
|
8
|
+
- c3957bee9b2: Improved MCP server code mode to reduce AI agent script failures and provide clearer error messages.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 43ec2eb3a83: Fixed the `documentationUrl` in the MCP server card to include the path prefix.
|
|
13
|
+
- c09e6eb1c9d: Fixed an issue in Replay where Basic authentication credentials with non-ASCII characters produced a corrupted Authorization header or prevented the request from being sent.
|
|
14
|
+
- e5705e50add: Fixed an issue in Replay and the Try it console where operations with many editable fields got slower on each reopening.
|
|
15
|
+
- 43ec2eb3a83: Fixed broken `llms.txt` links to use the configured `seo.siteUrl` instead of the Redocly-hosted domain.
|
|
16
|
+
- 8e4959baca4: Updated `@redocly/openapi-core` to version `2.53.0`.
|
|
17
|
+
- Updated dependencies [7df87b0c29d]
|
|
18
|
+
- Updated dependencies [0f773ab0bc9]
|
|
19
|
+
- Updated dependencies [8e4959baca4]
|
|
20
|
+
- @redocly/theme@0.69.0-next.11
|
|
21
|
+
- @redocly/realm-asyncapi-sdk@0.15.0-next.4
|
|
22
|
+
- @redocly/api-docs@0.2.0-next.12
|
|
23
|
+
- @redocly/portal-plugin-mock-server@0.22.0-next.9
|
|
24
|
+
|
|
25
|
+
## 0.137.0-next.11
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 63141551504: Fixed an empty Download panel that appeared on the OpenAPI and AsyncAPI overview page when `downloadUrls` was set to an empty list.
|
|
30
|
+
- 8eb519653cd: Fixed security vulnerabilities `CVE-2026-84375`, `CVE-2026-84363`, `CVE-2026-84364` and `CVE-2026-39408` by upgrading `js-yaml` to version `4.3.2` and `hono` to version `4.13.7`.
|
|
31
|
+
- 2fde3a15587: Fixed an issue in the **Try it** console where closing an inactive tab moved the selection to a different tab instead of keeping the tab the user was working in.
|
|
32
|
+
- efab0652d2f: Fixed an issue in Replay's mobile layout where the first character typed in a request input moved focus to the close button, causing the rest of the input to be lost.
|
|
33
|
+
- e85d19c4926: Fixed an issue where Markdown tables would render a collapsed gray header row when all heading cells were empty.
|
|
34
|
+
- Updated dependencies [63141551504]
|
|
35
|
+
- Updated dependencies [8eb519653cd]
|
|
36
|
+
- Updated dependencies [e85d19c4926]
|
|
37
|
+
- @redocly/api-docs@0.2.0-next.11
|
|
38
|
+
- @redocly/theme@0.69.0-next.10
|
|
39
|
+
- @redocly/portal-plugin-mock-server@0.22.0-next.8
|
|
40
|
+
|
|
3
41
|
## 0.137.0-next.10
|
|
4
42
|
|
|
5
43
|
### Minor Changes
|
package/dist/cli/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import y from"node:path";import{unlink as R}from"node:fs/promises";import{writeFileSync as T}from"node:fs";import{envConfig as h}from"../../server/config/env-config.js";import{PORTAL_VERSION as A}from"../../server/version.js";import{logger as e}from"../../server/tools/notifiers/logger.js";import{reporter as f}from"../../server/tools/notifiers/reporter.js";import{shutdowner as O}from"../../server/tools/shutdowner.js";import{promiseMapLimit as D}from"../../server/utils/async/promise-map-limit.js";import{validateReactPages as E}from"../../server/plugins/pages/validators/validate-react-pages.js";import{ensureDir as S}from"../../server/utils/index.js";import{initPlugins as M,runPlugins as j,writeClientEntries as x}from"../../server/plugins/lifecycle.js";import{createClientCompiler as L,createNodeBundleCompiler as J}from"../../server/esbuild/esbuild.js";import{validateAllMarkdowns as k}from"../../server/plugins/markdown/compiler.js";import{copyEnvFiles as F}from"./copy-env-files.js";import{EsbuildError as s,esbuildLogger as d}from"../../server/esbuild/esbuild-logger.js";import{reportAllErrors as U}from"../../server/utils/report-all-errors.js";import{collectAnalytics as z}from"./analytics/collect-analytics.js";import{copyMigrationsFolder as N}from"../../server/providers/database/copy-migrations.js";import{telemetry as c}from"../telemetry/index.js";import{telemetryTraceStep as m}from"../telemetry/helpers/trace-step.js";async function li(v,i){c.initialize(A),e.info("Starting project build.");const C=e.startTiming();await m("com.redocly.build.start",async P=>{x(i);const p=await L(i,i.outdir,"production"),u=await J(i,i.serverOutDir,"production");let o,g;try{await m("com.redocly.build.clientCompilation",async()=>{const l=e.startTiming(),n=await p.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Client JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.serverCompilation",async()=>{const l=e.startTiming(),n=await u.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Server JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",message:r.message,timeMs:r.timeMs}])}),await i.reloadMarkdocOptions();let t;({pluginInstances:t,lifecycleContext:o}=await M({outdir:i.outdir,serverOutDir:i.serverOutDir,contentDir:i.contentDir,devLogin:v.devLogin,setGlobalConfig:i.setGlobalConfig})),o.fs.dispose(),i.lifecycleContext=o,N(i),await j(t,i,o),g=z(i,o),await m("com.redocly.build.clientServerRecompile",async()=>{const l=e.startTiming();e.info("Re-compiling JavaScript with user code"),(await Promise.all([p.rebuild(),u.rebuild()]).catch(a=>{throw new s(a)})).forEach(({warnings:a})=>{Array.isArray(a)&&d(new s({warnings:a}))});const r=e.infoTime(l,"JavaScript re-compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.pagesValidation",async()=>{await E(i,o),await k(i,o)}),await U(o),i.markUserCodeReady()}catch(t){P?.error(t),t instanceof s&&await d(t),await f.panic(t instanceof Error?t:String(t))}finally{g&&await g.catch(()=>{}),await p.dispose(),await u.dispose()}f.printErrors(),e.info("Rendering pages..."),await m("com.redocly.build.prepareStaticData",async t=>{const l=e.startTiming(),n=[...i.getAllRoutes(),...i.getAllApiRoutes()];t?.setAttribute("totalRoutes",n.length.toString()),await D(n,15,a=>i.writeRouteStaticData(a,o));const r=e.successTime(l,"Page static data prepared.");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.storeSerialization",async()=>{const t=e.startTiming();S(i.serverOutDir),T(y.join(i.serverOutDir,"store.json"),JSON.stringify(await i.toJson())),e.successTime(t,"Store serialized and written."),F(i)});const w=h.REDOCLY_PROBLEMS_OUTPUT_FILE;if(w){const t=e.startTiming();T(S(w),JSON.stringify(f.getProblems()),"utf-8"),e.successTime(t,"Broken links written.")}await R(y.join(i.serverOutDir,"index.css"));const b=e.successTime(C,"All done");b&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...b}])}),await O.exitWithCode(0)}export{li as build};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{LayoutVariant as o}from"@redocly/config";import{usePageSharedData as f}from"../../providers/page-data/hooks";function d(){const t=f("apiDocsStore"),n=!!t,s=t?.options?.layout,[c,i]=e.useState(!1),[l,u]=e.useState(null),a=l??s??o.THREE_PANEL;function r(){u(a===o.STACKED?o.THREE_PANEL:o.STACKED)}function p(){i(S=>!S)}return{onChangeViewClick:r,onChangeCollapseSidebarClick:p,layout:a,collapsedSidebar:c,isApiDocs:n}}export{d as useActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLocation as
|
|
1
|
+
import{useLocation as A}from"react-router";import{useEffect as w,useMemo as f,useRef as _,useState as k}from"react";import{useActiveSectionId as D}from"@redocly/theme/core/hooks";import{getMenuItemType as C}from"@redocly/theme/core/utils";import{MenuItemType as v}from"@redocly/theme/core/constants";import{CATALOG_BASE_SLUG as T,CATALOG_SLUGS as h}from"../../../constants/catalog-entities";import{usePageSharedData as y,useSidebarItemsData as G,useSidebarConnectedCatalogConfig as E,useSidebarConnectedCatalogEntity as O}from"../../providers/page-data/hooks";import{mapItemsPropsToState as b}from"./utils";import{injectCatalogItems as K}from"../../utils/catalog/inject-catalog-items";import{filterOutVersionedItems as R}from"./helpers/filter-out-versioned-items";const B="catalog.backToAllLabel",M=`${T}/${h.ALL}`;function U(o){const e=G();return f(()=>R(e,o),[e,o])}function J(o){const e=A(),t=D(e,!0),a=O(),g=E(),c=U(o),s=a?K(c,a.key,g?.slug,e.search):c,u=_(null),r=f(()=>b(s,e,t),[t,e,s]),l=y("current-catalog-info"),p=f(()=>S(r),[s]),[n,m]=k(p),i=n.length>0?n[n.length-1]:void 0,I=i&&b([...i.item.link?[{...i.item,items:[],menuStyle:void 0,separatorLine:!1}]:[],...i.item.items],e,t);w(()=>{if(!u.current||u.current!==t){const d=S(r);m(d),u.current=t}},[c,e,t]);const L=i?{slug:i.previousLink,event:"sidebar_drilldown_back_button.clicked"}:a?{label:"Back to Catalog",labelTranslationKey:B,slug:M,event:"back_to_catalog_button.clicked"}:l?{label:l.catalog.label,labelTranslationKey:l.catalog.labelTranslationKey,slug:l.catalog.link,event:"back_to_catalog_button.clicked"}:void 0;return{currentItems:I||r,allSidebarItems:r,popDrilldownState:()=>{n.length>0&&m(n.slice(0,n.length-1))},pushDrilldownState:d=>{m([...n,d])},backLink:L,versionLabel:a?.version??null}}function S(o,e=[]){for(const t of o){if(!t.active&&!t.hasActiveSubItem)continue;if(C(t)===v.DrillDown&&e.push({item:t}),t.active)return e;if(t.hasActiveSubItem)return S(t.items,e)}return e}export{U as useRawSidebarItems,J as useSidebarItems};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as h,useEffect as
|
|
1
|
+
import{useCallback as h,useEffect as P,useMemo as w,useState as Q}from"react";import{useSearchParams as b}from"react-router";import{telemetry as C}from"../../telemetry/index.js";import{parseFilterQuery as y,formatFilterQuery as U,collectFilterOptions as j}from"../../../utils";import{getBaseDataAttributes as I}from"@redocly/theme/core/utils";function O(t){return t instanceof Set?t.size>0:!!(t?.from||t?.to)}function z(t,d){const[u,p]=b(),c=u.get("filter")||"",[o,f]=Q(()=>y(c,t?.filters||[])),F=w(()=>j(t?.filters,d),[t?.filters,d]),m=t?.filters||[];m.length>0&&o.length!==m.length&&f(y(c,m));const S=h((s,e)=>{f(l=>l.map((r,i)=>{if(i!==s||!(r instanceof Set))return r;const n=new Set(r);return n.has(e)?n.delete(e):n.add(e),n})),window.scrollTo(0,0)},[]),g=h((s,e)=>{f(l=>l.map((a,r)=>r!==s?a:a instanceof Set?e&&typeof e=="string"?new Set([e]):new Set:{from:typeof e=="object"?e?.from:void 0,to:typeof e=="object"?e?.to:void 0})),C.sendCatalogFilterChangedMessage([{...I("catalogFilter","field"),type:"select"}]),window.scrollTo(0,0)},[]);return P(()=>{const s=new URLSearchParams(u),e=U(o,t?.filters||[]);e?s.set("filter",e):s.delete("filter"),p(s,{replace:!0})},[t?.filters,o,u,p]),w(()=>{const s=F.map((l,a)=>{const r=o[a],i=O(r);return{...l,toggleOption:n=>S(a,n),selectOption:n=>g(a,n),selectedOptions:r??new Set,isFilterUsed:i}});return{filters:s.map(l=>{const a=s.findIndex(n=>n.property===l.parentFilter),r=o[a],i=l.parentFilter?O(r):!0;return{...l,parentUsed:i}}),filterQuery:c}},[F,o,S,g,c])}export{z as useCatalogFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as y,useEffect as
|
|
1
|
+
import{useCallback as y,useEffect as f,useMemo as S,useState as r}from"react";import{withPathPrefix as b}from"@redocly/theme/core/utils";import{ServerRoutes as d}from"../../../constants/api";import{useI18nConfig as g}from"../hooks";function h(e){const[s,a]=r([]),[t,n]=r(null),[c,o]=r(null),[p,i]=r(!1),{currentLocale:l}=g();f(()=>{i(!0),m()},[c]);const m=y(async()=>{if(e&&c===null){i(!1);return}let u={locale:l,field:e};c&&(u={...u,...c});const F=await(await fetch(b(d.SEARCH_FACETS),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(u)})).json();e?n(F):a(F),i(!1)},[l,c,e]);return{initialFacets:s,searchFacets:t,isFacetsLoading:p,setSearchFacetQuery:o}}function L(e){const[s,a]=r(null),{searchFacets:t,setSearchFacetQuery:n}=h(e);return f(()=>{const c=t?t.find(o=>o.field===e)??null:null;a(c)},[t,e]),{searchFacet:s,setSearchFacet:a,setSearchFacetQuery:n}}const O=e=>{const{initialFacets:s}=h();return{facets:S(()=>!e||!Object.keys(e).length?s:s.map(t=>({...t,values:e[t.field]?.map(n=>({...n,isCounterVisible:!0}))||[]})),[s,e])}};export{L as useFacetQuery,O as useFacets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"react";import{Helmet as
|
|
1
|
+
import n from"react";import{Helmet as p}from"@dr.pogodin/react-helmet";import{combineUrls as g,withPathPrefix as k}from"@redocly/theme/core/utils";import{isTruthy as d}from"../../../utils/guards/is-truthy";import{usePageVersions as E}from"../../providers/page-data/hooks";import{getMetaTagsAttributes as h}from"../utils/get-meta-tags-attributes";import{useHreflangLinks as j}from"./hooks/useHreflangLinks";function U(o){const{seo:e,slug:s}=o,{versions:a}=E(),r=e?.siteUrl,{localeAlternates:m}=j(r);if(!e)return null;const c=h(e),f=[e.title,e.projectTitle].filter(d).join(" | "),i=a.find(t=>t.default)?.link,u=i?k(i):s;return n.createElement(p,null,n.createElement("title",null,f),r?n.createElement("link",{rel:"canonical",href:g(r,u)}):null,m.map(({hrefLang:t,href:l})=>n.createElement("link",{key:t,rel:"alternate",hrefLang:t,href:l})),e.jsonLd?n.createElement("script",{type:"application/ld+json"},JSON.stringify(e.jsonLd)):null,c.map((t,l)=>n.createElement("meta",{key:l,...t})))}export{U as SeoTags};
|
|
@@ -55,6 +55,7 @@ declare function loadEnvConfig(): {
|
|
|
55
55
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
56
56
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
57
57
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
58
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
58
59
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
59
60
|
SEARCH_DEV_DEBUG: boolean;
|
|
60
61
|
REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
|
|
@@ -138,6 +139,7 @@ export declare const envConfig: {
|
|
|
138
139
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
139
140
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
140
141
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
142
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
141
143
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
142
144
|
SEARCH_DEV_DEBUG: boolean;
|
|
143
145
|
REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
|
|
@@ -59,6 +59,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
59
59
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
60
60
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
61
61
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
62
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
62
63
|
} & {
|
|
63
64
|
SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
|
|
64
65
|
SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
|
|
@@ -139,6 +140,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
139
140
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
140
141
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
141
142
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
143
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
142
144
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
143
145
|
SEARCH_DEV_DEBUG: boolean;
|
|
144
146
|
REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
|
|
@@ -212,6 +214,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
212
214
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
213
215
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
|
|
214
216
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
|
|
217
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
|
|
215
218
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
216
219
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
217
220
|
REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
|
|
@@ -285,6 +288,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
285
288
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
286
289
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
287
290
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
291
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
288
292
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
289
293
|
SEARCH_DEV_DEBUG: boolean;
|
|
290
294
|
REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
|
|
@@ -358,6 +362,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
358
362
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
359
363
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
|
|
360
364
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
|
|
365
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
|
|
361
366
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
362
367
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
363
368
|
REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
|
|
@@ -21,6 +21,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
21
21
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
22
22
|
/** Experimental: register custom MCP tools from `@mcp` folders. */
|
|
23
23
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
24
|
+
/** Experimental: enables the GraphQL request body in Try It and embedded Replay. */
|
|
25
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
24
26
|
}, "strip", z.ZodTypeAny, {
|
|
25
27
|
NEW_CATALOG_ENABLED?: boolean | undefined;
|
|
26
28
|
NEW_SCORECARDS_ENABLED?: boolean | undefined;
|
|
@@ -34,6 +36,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
34
36
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
35
37
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
36
38
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
39
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
37
40
|
}, {
|
|
38
41
|
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
39
42
|
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
@@ -47,5 +50,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
47
50
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
48
51
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
|
|
49
52
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
|
|
53
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
|
|
50
54
|
}>;
|
|
51
55
|
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const
|
|
1
|
+
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const D=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE:E(),REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED:E(),REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{D as featureFlagsSchema};
|
|
@@ -8,9 +8,9 @@ export type Location = {
|
|
|
8
8
|
export declare class EsbuildError extends Error {
|
|
9
9
|
errors: BuildFailure['errors'];
|
|
10
10
|
warnings: BuildFailure['warnings'];
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(failure: Partial<BuildFailure>);
|
|
12
12
|
}
|
|
13
|
-
export declare function esbuildLogger({ errors, warnings }: EsbuildError): Promise<void>;
|
|
13
|
+
export declare function esbuildLogger({ errors, warnings, message }: EsbuildError): Promise<void>;
|
|
14
14
|
export declare function reportEsbuildError(message: string, sourceFileRelativePath: string, fileContent: string, location?: Location | null): {
|
|
15
15
|
message: string;
|
|
16
16
|
sourceFileRelativePath: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as
|
|
2
|
-
`),hasMatched:!1};const
|
|
3
|
-
`),{lineText:s}=r,
|
|
1
|
+
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as f}from"../tools/notifiers/reporter.js";import{envConfig as m}from"../config/env-config.js";import{telemetry as d}from"../../cli/telemetry/index.js";import{stopAllCompilers as y}from"./esbuild.js";import{getCodeframe as C}from"../utils/codeframes/codeframes.js";import{shutdowner as M}from"../tools/shutdowner.js";class N extends Error{errors;warnings;constructor(r){super(r.message,r instanceof Error?{cause:r}:void 0),this.errors=r.errors??[],this.warnings=r.warnings??[]}}async function T({errors:n,warnings:r,message:t}){const s=await h(n,"error"),o=await h(r,"warning");if(r.forEach((e,i)=>{c.warn(o[i])}),n.forEach((e,i)=>{const a=e.location?.file||"";a&&a.includes("node_modules/")?(c.error(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e)}])):(c.contentError(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e),scope:"content"}]))}),!n.length&&t){const e=`JavaScript compilation failed: ${t}`;c.error(e),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:e}])}(n.length>0||t)&&m.isBuildMode&&(await y(),await M.exitWithCode(1))}async function h(n,r){return n.length?m.REDOCLY_LOG_FORMAT==="JSON"?n.map(t=>JSON.stringify(t)):await E.formatMessages(n,{kind:r,color:!1,terminalWidth:0}):[]}function w(n,r){if(!r?.lineText)return{line:1,column:1,lines:n.split(`
|
|
2
|
+
`),hasMatched:!1};const t=n.split(`
|
|
3
|
+
`),{lineText:s}=r,o=e=>{const i=e.indexOf(s);return i===-1?null:i};if(r.line&&r.line<=t.length&&o(t[r.line-1]))return{line:r.line,column:r.column||1,lines:t,hasMatched:!0};const l=t.findIndex(e=>o(e)!==null);if(l>=0){const e=o(t[l]);return{line:l+1,column:(e??0)+1,lines:t,hasMatched:!0}}return{line:1,column:1,lines:t,hasMatched:!1}}function _(n,r,t,s){const{line:o,column:l,lines:e,hasMatched:i}=w(t,s),{frame:a,start:g}=C({start:{line:o,character:l},end:{line:o,character:l+(s?.lineText?.length||0)},lines:e},!0),p=`${n}::${r}::${o}`,u={message:n,sourceFileRelativePath:r,sourceFileLocation:g,codeframe:a,hasMatched:i};return f.getCompilationProblem(p)||f.reportCompilationError({type:"ERROR",severity:"ERROR",...u}),u}export{N as EsbuildError,T as esbuildLogger,_ as reportEsbuildError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as F from"node:path";import{findFirstBinding as P,markdocParser as _}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as k}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as w}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as L}from"../../config/env-config.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as A}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as g}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as B}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const t=B(r);return{url:k(`/_mock${t}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(w,`${g(o,F.posix.extname(o))}?download`)]:[i(f,`${g(o,".json")}?download`),i(f,`${g(o,".yaml")}?download`)]).map(t=>({url:k(t)}))}function j(o,r,m){const{rootConfig:t,config:c,apiConfig:s,mergedConfig:e,relativePath:l}=m,a=M(t?.[o]||{},c[o]||{},s[o]||s.theme?.[o]||{}),b=r["x-feedback"]||a.feedback||c.feedback,S=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!t?.[o]?.excludeFromSearch||!!t?.theme?.[o]?.excludeFromSearch,x=e.rbac||s.rbac,p=A(b),u=c.metadata,C={...p&&{feedback:p},mockServer:D(e?.mockServer||t?.mockServer,l),disableRouter:!0,downloadUrls:a.downloadUrls||I(l,o),excludeFromSearch:S,rbac:x,markdownParser:_,replayFeatures:{graphql:L.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1}};let d;if(o==="graphql"){const n=a;d={title:n.info?.title,...u,...n.metadata??{}}}else{const n=r.info,E=n?.["x-metadata"];d={title:n?.title,description:n?.description,...o==="openapi"&&{summary:n?.summary},...u,...E}}o==="openapi"&&a.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const O=a.markdocOptions??R,h={...a,...C,specType:o,markdocOptions:O,metadata:d};return o==="asyncapi"&&(h.protocol=P(r)??void 0),h}export{I as buildDownloadUrls,j as createOptions};
|
|
@@ -15,6 +15,6 @@ type AiDocumentsStoreParams = {
|
|
|
15
15
|
getSearchFacets: () => Map<string, SearchFacet>;
|
|
16
16
|
markdocTags?: Record<string, MarkdocTagSchema>;
|
|
17
17
|
};
|
|
18
|
-
export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown,
|
|
18
|
+
export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown, _context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=get-ai-search-documents.d.ts.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as
|
|
2
|
-
`+tn,on=q+F;I.push({title:R||"API Overview",description:typeof
|
|
1
|
+
import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as y}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as U}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as v}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as N}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{createApiDocsSearchIndexer as yn}from"./create-indexer.js";function A(t,o){return o==="openapi"&&"openapi"in t}function H(t,o){return o==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:o,store:s,document:n,specType:r,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:c}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...c},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),x=un(m,X,Z),C=d.getConfig(),L=dn(f.fsPath),j=yn(e,s?.schemaStore,n,s?.exampleStore),M=g=>{for(const p of g)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const g of nn)V.set(g.url,g);const R=typeof o.title=="string"?o.title:void 0,_=sn(o.version),D=$n(f.metadata||{},R,_,l),S=[],I=[],q=gn(o,n,r),F=bn(r,o,f.fsPath,C),tn=In(t,C,x),en=q+F+`
|
|
2
|
+
`+tn,on=q+F;I.push({title:R||"API Overview",description:typeof o.description=="string"?o.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),S.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,r)?n.security:void 0,E=g=>{for(const p of g){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===y.ITEM){const $=Pn(p,n,r)??Y(p,k,r,_,rn,x);if($){const b=p.label||"";I.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===y.GROUP){const $=On(p,C,r,x);if($){const b=p.label||"";I.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return I},async getSearchDocuments(){return S}}}}function gn(t,o,s){const n=typeof t.title=="string"?t.title:"",r=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
|
|
3
3
|
|
|
4
|
-
`:"";if(l+=
|
|
4
|
+
`:"";if(l+=r?`${r}
|
|
5
5
|
|
|
6
6
|
`:"",l+=i?`${i}
|
|
7
7
|
|
|
8
8
|
`:"",l+=e?`Version: ${e}
|
|
9
|
-
`:"",
|
|
9
|
+
`:"",o){if(A(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
|
|
10
10
|
`);const f=c["x-metadata"],a=mn(f);a&&(l+=`
|
|
11
11
|
Metadata:
|
|
12
12
|
${a}
|
|
13
|
-
`)}else if(H(
|
|
13
|
+
`)}else if(H(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
|
|
14
14
|
`)}}return l+=`
|
|
15
|
-
`,l+=An(
|
|
15
|
+
`,l+=An(o,s),l+=Sn(o,s),l}function bn(t,o,s,n){if(!s)return"";let r,i,e;if(t==="openapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(s)||".graphql";r=P.posix.join(an,U(s,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(r,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const c=typeof o.title=="string"&&o.title||e;return`${i}
|
|
16
16
|
|
|
17
|
-
- ${
|
|
17
|
+
- ${N({title:c,description:void 0,slug:r,siteUrl:n.seo?.siteUrl})}`}function An(t,o){if(!t)return"";if(A(t,o)){const{servers:s}=t;if(!s?.length)return"";let n=`## Servers
|
|
18
18
|
|
|
19
|
-
`;for(const
|
|
19
|
+
`;for(const r of s)if(r.description&&(n+=`${r.description}
|
|
20
20
|
`),n+=`\`\`\`
|
|
21
|
-
${
|
|
21
|
+
${r.url}
|
|
22
22
|
\`\`\`
|
|
23
23
|
|
|
24
|
-
`,
|
|
25
|
-
`;for(const[i,e]of Object.entries(
|
|
24
|
+
`,r.variables){n+=`Variables:
|
|
25
|
+
`;for(const[i,e]of Object.entries(r.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
|
|
26
26
|
`,e.default&&(n+=` Default: ${JSON.stringify(e.default)}
|
|
27
27
|
`),e.enum&&(n+=` Enum: ${e.enum.map(l=>JSON.stringify(l)).join(", ")}
|
|
28
28
|
`);n+=`
|
|
29
|
-
`}return n}if(H(t,
|
|
29
|
+
`}return n}if(H(t,o)){const{servers:s}=t;if(!s||!Object.keys(s).length)return"";let n=`## Servers
|
|
30
30
|
|
|
31
|
-
`;for(const[
|
|
31
|
+
`;for(const[r,i]of Object.entries(s))n+=`### ${r}
|
|
32
32
|
|
|
33
33
|
`,i.description&&(n+=`${i.description}
|
|
34
34
|
`),i.host&&(n+=`Host: ${i.host}
|
|
@@ -36,9 +36,9 @@ ${o.url}
|
|
|
36
36
|
`),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
|
|
37
37
|
`),i.pathname&&(n+=`Pathname: ${i.pathname}
|
|
38
38
|
`),n+=`
|
|
39
|
-
`;return n}return""}function Sn(t,
|
|
39
|
+
`;return n}return""}function Sn(t,o){if(!t||!A(t,o))return"";const s=t.components?.securitySchemes;if(!s)return"";let n=`## Security
|
|
40
40
|
|
|
41
|
-
`;for(const[
|
|
41
|
+
`;for(const[r,i]of Object.entries(s)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${r}
|
|
42
42
|
|
|
43
43
|
`,e.description&&(n+=`${e.description}
|
|
44
44
|
|
|
@@ -53,43 +53,43 @@ ${o.url}
|
|
|
53
53
|
`),c.scopes)){n+=`Scopes:
|
|
54
54
|
`;for(const[f,a]of Object.entries(c.scopes))n+=`- \`${f}\`: ${a}
|
|
55
55
|
`}n+=`
|
|
56
|
-
`}return n}function In(t,
|
|
56
|
+
`}return n}function In(t,o,s){let n="";const r=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===y.GROUP)n+=`${e} ${l.label||""}
|
|
57
57
|
|
|
58
|
-
`,l.items?.length&&
|
|
58
|
+
`,l.items?.length&&r(l.items,e+"#");else if(l.content?.contentType===y.ITEM){if(!w(l,o))continue;const c=l,f=c.httpVerb,a=c.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,s):void 0;n+=` - ${N({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link),siteUrl:o.seo?.siteUrl})}`}}};return r(t,"##"),n}function Y(t,o,s,n,r,i){if(!t.content)return;const e=t,l=t.label||"",c=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
|
|
59
59
|
|
|
60
60
|
`;if(c&&(a+=`${c}
|
|
61
61
|
|
|
62
62
|
`),s==="openapi"||s==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
|
|
63
63
|
`:u&&(a+=`Method: ${u.toUpperCase()}
|
|
64
64
|
`),n&&(a+=`Version: ${n}
|
|
65
|
-
`);const m=Tn(t.content.children,
|
|
66
|
-
`)}return
|
|
67
|
-
`+
|
|
68
|
-
`),s==="graphql"&&(a+=
|
|
65
|
+
`);const m=Tn(t.content.children,r);m&&(a+=`Security: ${m}
|
|
66
|
+
`)}return o?.parameters?.length&&s!=="graphql"&&(a+=`
|
|
67
|
+
`+xn(o.parameters)+`
|
|
68
|
+
`),s==="graphql"&&(a+=Cn(t.content.children)),a}function Pn(t,o,s){if(t.httpVerb!=="tool"||!o||!A(o,s))return;const n=t.content?.meta?.name,r=n?o["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!r)return;let i=`# ${t.label||r.name}
|
|
69
69
|
|
|
70
|
-
`;return typeof
|
|
70
|
+
`;return typeof r.description=="string"&&r.description&&(i+=`${r.description}
|
|
71
71
|
|
|
72
72
|
`),i+=`## Input schema:
|
|
73
73
|
|
|
74
74
|
`,i+=`\`\`\`json
|
|
75
|
-
${JSON.stringify(
|
|
75
|
+
${JSON.stringify(r.inputSchema,null,2)}
|
|
76
76
|
\`\`\`
|
|
77
77
|
|
|
78
|
-
`,
|
|
78
|
+
`,r.outputSchema&&(i+=`## Output schema:
|
|
79
79
|
|
|
80
80
|
`,i+=`\`\`\`json
|
|
81
|
-
${JSON.stringify(
|
|
81
|
+
${JSON.stringify(r.outputSchema,null,2)}
|
|
82
82
|
\`\`\`
|
|
83
83
|
|
|
84
|
-
`),i}function On(t,
|
|
84
|
+
`),i}function On(t,o,s,n){if(!t.content)return;const r=t.label||"",i=T(t.content.children,n);let e=`# ${r}
|
|
85
85
|
|
|
86
86
|
`;if(i&&(e+=`${i}
|
|
87
87
|
|
|
88
|
-
`),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!
|
|
88
|
+
`),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!w(u,o)))if(u.content.contentType===y.ITEM){const d=Y(u,void 0,s,void 0,void 0,n);d&&(c+=`${d}
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
`)}else u.content.contentType===
|
|
92
|
+
`)}else u.content.contentType===y.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+c,aiSearch:e}}let l="";if(t.items?.length)for(const c of t.items){if(!c.link||!c.content||c.content.contentType!==y.ITEM||!w(c,o))continue;const f=c,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:c.label||"",m=c.content?T(c.content.children,n):void 0;l+=` - ${N({title:d,description:m?m.slice(0,200):void 0,slug:J(c.link),siteUrl:o.seo?.siteUrl})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,o){const s=[],n=r=>{for(const i of r)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const c of l.schemes)c[O]||c.name&&!s.includes(c.name)&&s.push(c.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),s.length)return s.join(", ");if(o?.length){const r=o.flatMap(i=>Object.keys(i));if(r.length)return[...new Set(r)].join(", ")}}function xn(t){const o={};for(const n of t){const r=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;o[r]||(o[r]=[]),o[r].push(n)}return Object.entries(o).map(([n,r])=>{const i=r.map(e=>{const l=[...e.path||[],e.name],c=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
|
|
93
93
|
`;return c&&(f+=` ${c.trim()}
|
|
94
94
|
`),e.enum?f+=` Enum: ${e.enum.map(a=>JSON.stringify(a)).join(", ")}
|
|
95
95
|
`:e.example&&(f+=` Example: ${e.example}
|
|
@@ -97,9 +97,9 @@ ${JSON.stringify(o.outputSchema,null,2)}
|
|
|
97
97
|
|
|
98
98
|
${i.join(`
|
|
99
99
|
`)}`}).join(`
|
|
100
|
-
`)}function
|
|
101
|
-
## ${K(
|
|
100
|
+
`)}function Cn(t){let o="";const s=n=>{for(const r of n)if(r.nodeType===h.ITEM){const i=r;i.graphqlSchema&&(o+=Ln(i.graphqlSchema,i.variant))}else(r.nodeType===h.CONTAINER||r.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&s(r.children)};return s(t),o}function Ln(t,o){let n=`
|
|
101
|
+
## ${K(o==="return-type"?"Return type":o==="graphql-args"||o==="arguments"?"Arguments":o==="graphql-fields"?"Fields":o)}:
|
|
102
102
|
|
|
103
|
-
`;const
|
|
104
|
-
`};if(!Array.isArray(t)){const i=t.description?
|
|
105
|
-
`;for(const e of t.fields??[])n+=
|
|
103
|
+
`;const r=i=>{const e=i.description?v(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
|
|
104
|
+
`};if(!Array.isArray(t)){const i=t.description?v(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
|
|
105
|
+
`;for(const e of t.fields??[])n+=r(e);return n}if(!t.length)return"";for(const i of t)n+=r(i);return n}function T(t,o){const s=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,c=Array.isArray(l)?l:[l],f=v(c,{renderTag:o}).trim();f&&s.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),s.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,o){return o.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},o)}export{Qn as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;let l=f.posix.dirname(i);const t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as E,useQueryClient as C}from"@tanstack/react-query";import{useParams as f}from"react-router";import{Button as v}from"@redocly/theme/components/Button/Button";import{H2 as D}from"@redocly/theme/components/Typography/H2";import{Admonition as h}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as P}from"../../../../../client/app/hooks";import{Dialog as A}from"./Dialog";import{ButtonWithLoading as k}from"./ButtonWithLoading";import{ButtonsContainer as S}from"./RollAPIKey";import{DialogInputMultiline as T,DialogRow as w,DialogRowContent as K}from"./DialogStyledComponents";import{MAX_DESCRIPTION_LENGTH as d,CharacterCounter as O}from"./CharacterCounter";const Q=o=>{const{initialDescription:n,open:a,onOpen:i,onClose:t}=o;return e.createElement(A,{open:a,onClose:t,onOpen:i},e.createElement(R,{initialDescription:n,onClose:t}))},R=o=>{const{id:n}=f(),{initialDescription:a,onClose:i}=o,{translate:t}=P(),[r,p]=e.useState(a||""),c=async()=>{await y(),i()},u=s=>{s.key==="Enter"&&!l&&c()},g=C(),{mutateAsync:y,isPending:l,error:m}=E({mutationKey:["UPDATE_APP"+n],mutationFn:()=>fetch(`/api/api-keys/apps/${n}`,{method:"PUT",body:JSON.stringify({description:r})}),onSettled:()=>{g.invalidateQueries({queryKey:["APP:"+n]})}});return e.createElement(e.Fragment,null,e.createElement(D,{"data-translation-key":"dev.edit.description.dialog.title"},t("dev.edit.description.dialog.title","Change description")),e.createElement(w,null,e.createElement(K,null,e.createElement(T,{maxLength:d,value:r,onChange:s=>p(s.target.value),onKeyPress:u,rows:6,cols:60}))),e.createElement(O,null,r.length,"/",d),m&&e.createElement(h,{type:"danger"},m.message," "),e.createElement(S,null,e.createElement(v,{onClick:i,"data-translation-key":"dev.edit.description.dialog.cancel",variant:"text",size:"large"},t("dev.edit.description.dialog.cancel","Cancel")),e.createElement(k,{variant:"primary",loading:l,onClick:c,disabled:l,"data-translation-key":"dev.edit.description.dialog.save"},t("dev.edit.description.dialog.save","Save changes"))))};export{Q as EditAppDescriptionDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as v,useQueryClient as E}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as h}from"@redocly/theme/components/Button/Button";import{H2 as P}from"@redocly/theme/components/Typography/H2";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as k}from"../../../../../client/app/hooks";import{Dialog as D}from"./Dialog";import{ButtonWithLoading as N}from"./ButtonWithLoading";import{ButtonsContainer as S}from"./RollAPIKey";import{DialogInput as w,DialogRow as K,DialogRowContent as O}from"./DialogStyledComponents";const U=e.forwardRef((l,a)=>{const{appName:s,appDisplayName:o}=l,[n,i]=e.useState(!1),r=()=>{i(!0)},t=()=>{i(!1)};return e.useImperativeHandle(a,()=>({open:r})),e.createElement(D,{open:n,onClose:t,onOpen:r},e.createElement(R,{initialName:o||s||"",onClose:t}))}),R=l=>{const{id:a}=C(),{initialName:s,onClose:o}=l,[n,i]=e.useState(s),r=p=>i(p.target.value),{translate:t}=k(),d=async()=>{await f(),o()},g=p=>{p.key==="Enter"&&!m&&u&&d()},y=E(),{mutateAsync:f,isPending:m,error:c}=v({mutationKey:["UPDATE_APP"+a],mutationFn:()=>fetch(`/api/api-keys/apps/${a}`,{method:"PUT",body:JSON.stringify({name:n})}),onSettled:()=>{y.invalidateQueries({queryKey:["APPS","APP:"+a]})}}),u=/^(?!\s*$).{1,100}$/gi.test(n);return e.createElement(e.Fragment,null,e.createElement(P,{"data-translation-key":"dev.edit.app.dialog.title"},t("dev.edit.app.dialog.title","Change display name")),e.createElement(K,null,e.createElement(O,null,e.createElement(w,{value:n,onChange:r,onKeyPress:g}))),c&&e.createElement(A,{type:"danger"},c.message," "),e.createElement(S,null,e.createElement(h,{onClick:o,"data-translation-key":"dev.edit.app.dialog.cancel",variant:"text",size:"large"},t("dev.edit.app.dialog.cancel","Cancel")),e.createElement(N,{variant:"primary",loading:m,onClick:d,disabled:m||!u,"data-translation-key":"dev.edit.app.dialog.save"},t("dev.edit.app.dialog.save","Save changes"))))};export{U as EditAppDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as y,useQueryClient as b}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as U}from"@redocly/theme/components/Button/Button";import{H2 as h}from"@redocly/theme/components/Typography/H2";import{Admonition as v}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as E}from"../../../../../client/app/hooks";import{Dialog as f}from"./Dialog";import{ButtonWithLoading as w}from"./ButtonWithLoading";import{ButtonsContainer as P}from"./RollAPIKey";import{DialogHelperText as D,DialogInputMultiline as R,DialogRow as S,DialogRowContent as A}from"./DialogStyledComponents";const Q=o=>{const{initialCallbackUrl:l,open:r,onOpen:n,onClose:a}=o;return e.createElement(f,{open:r,onClose:a,onOpen:n},e.createElement(T,{initialCallbackUrl:l,onClose:a}))},T=o=>{const{id:l}=C(),{initialCallbackUrl:r,onClose:n}=o,{translate:a}=E(),[c,m]=e.useState(r||""),s=async()=>{await g(),n()},p=t=>{t.key==="Enter"&&!i&&s()},u=b(),{mutateAsync:g,isPending:i,error:d}=y({mutationKey:["UPDATE_APP"+l],mutationFn:async()=>{const t=await fetch(`/api/api-keys/apps/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:c})});if(!t.ok){const k=await t.json().catch(()=>null);throw new Error(k?.error||`Request failed with status ${t.status}`)}return t.json()},onSettled:()=>{u.invalidateQueries({queryKey:["APP:"+l]})}});return e.createElement(e.Fragment,null,e.createElement(h,{"data-translation-key":"dev.edit.callbackUrls.dialog.title"},a("dev.edit.callbackUrls.dialog.title","Change callback URLs")),e.createElement(S,null,e.createElement(A,null,e.createElement(R,{value:c,onChange:t=>m(t.target.value),onKeyPress:p,placeholder:a("dev.edit.callbackUrls.dialog.placeholder","https://example.com/callback"),rows:3}),e.createElement(D,{"data-translation-key":"dev.edit.callbackUrls.dialog.hint"},a("dev.edit.callbackUrls.dialog.hint","Separate multiple URLs with a comma")))),d&&e.createElement(v,{type:"danger"},d.message," "),e.createElement(P,null,e.createElement(U,{onClick:n,"data-translation-key":"dev.edit.callbackUrls.dialog.cancel",variant:"text",size:"large"},a("dev.edit.callbackUrls.dialog.cancel","Cancel")),e.createElement(w,{variant:"primary",loading:i,onClick:s,disabled:i,"data-translation-key":"dev.edit.callbackUrls.dialog.save"},a("dev.edit.callbackUrls.dialog.save","Save changes"))))};export{Q as EditCallbackUrlDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import c from"path";import{compileGlobMatcher as n}from"../../utils/globs.js";const m=new WeakMap,i=(o,e)=>{if(e.length===0)return!1;let t=m.get(e);return t||(t=n(e.map(r=>c.posix.normalize(r))),m.set(e,t)),t(o)};export{i as isPartial};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{getCallableApis as n,isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{FETCH_TOOL_NAME as i}from"../../constants.js";const
|
|
2
|
-
`),
|
|
3
|
-
`)
|
|
4
|
-
`)}};
|
|
1
|
+
import{getCallableApis as n,isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{FETCH_TOOL_NAME as i}from"../../constants.js";const l=["```ts","/**"," * Call a documented API. Only the callable APIs' documented hosts are reachable."," * Responses cap at 1 MiB and redirects are not followed."," */","declare function fetch(url: string | URL, init?: {"," method?: string;"," /** `content-type` is set automatically for URLSearchParams/FormData unless you set one. */"," headers?: Record<string, string>;"," /** string \xB7 URLSearchParams (\u2192 application/x-www-form-urlencoded) \xB7 FormData (\u2192 multipart/form-data) */"," body?: string | URLSearchParams | FormData;"," /** Security scheme name (from the operation's `security` or `getSecuritySchemes`) whose credential to send. Omit to let the server choose. */"," securityScheme?: string;","}): Promise<{"," status: number;"," statusText: string;"," ok: boolean;"," headers: { get(name: string): string | null };"," json(): Promise<unknown>;"," text(): Promise<string>;","}>;","```"].join(`
|
|
2
|
+
`),c=["listApis","getEndpoints","getEndpointInfo"],h=["Example - list the paid invoices of a billing API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const ep = endpoints.find((e) => e.method === 'GET' && e.path.includes('invoices'));","const info = await tools.getEndpointInfo({ name: api.name, path: ep.path, method: ep.method });","// Replace every `{placeholder}` first.","const url = new URL((info.servers?.[0]?.url ?? '') + ep.path);","// Every name below comes from `info.endpoint.parameters` - read them first, never guess them.","url.searchParams.set('filter', 'status:paid');","url.searchParams.set('sort', '-createdTime');","url.searchParams.set('limit', '100');","try {"," const res = await fetch(url, { method: ep.method });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error), endpointId: info };","}","```"].join(`
|
|
3
|
+
`),p=["Example - call an endpoint you already read:","","```ts","// Call `getEndpointInfo` first for the server URL, the path, and the parameter names.","// Replace every `{placeholder}` first.","const url = new URL('https://api.example.com/invoices');","url.searchParams.set('filter', 'status:paid');","try {"," const res = await fetch(url, { method: 'GET' });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error) };","}","```"].join(`
|
|
4
|
+
`);function m(r){return c.every(t=>r.includes(t))?h:p}function d(r){const t=new Map;for(const{name:e,version:a}of r){if(!e)continue;const s=t.get(e)??[];a&&s.push(a),t.set(e,s)}return[...t.entries()].map(([e,a])=>a.length>1?`${e} (${a.map(s=>`v${s}`).join(", ")})`:e).join(", ")}const g={id:i,purpose:"Call the documented APIs over HTTP",isActive:o,annotations:{readOnlyHint:!1,destructiveHint:!0,openWorldHint:!0},renderSection(r,t){const e=d(n(r));return["## `fetch` \u2014 call the documented APIs","",l,"","Always call `getEndpointInfo` before `fetch` for the exact URL, required parameters, and body shape. Put filtering, sorting, and paging in the query parameters, and keep sandbox JS for what the endpoint cannot express. Never guess.","","A `servers[].url` or an endpoint path can hold `{placeholders}`. Replace every one before you call `fetch`. Use the server variable `default`. Ask the user when the `default` only repeats the variable name, such as `{organizationId}`.","","When an operation accepts more than one security scheme, pass `securityScheme` with the scheme name the user holds a credential for; without it the server picks one, and a mismatched credential fails upstream.","",`Callable APIs (their documented hosts are reachable via \`fetch\`): ${e}`,"",m(t)].join(`
|
|
5
|
+
`)}};export{l as FETCH_DECLARATION,g as fetchCapability};
|
|
@@ -8,7 +8,10 @@ export type SandboxCapability = {
|
|
|
8
8
|
isActive(context: McpToolContext): boolean;
|
|
9
9
|
/** How this capability changes `execute`'s MCP annotations when active. */
|
|
10
10
|
annotations: Partial<ToolAnnotations>;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The self-contained `describe-tools` section for this capability: heading, TS declaration,
|
|
13
|
+
* guidance, and an example built only from `describedToolNames`.
|
|
14
|
+
*/
|
|
15
|
+
renderSection(context: McpToolContext, describedToolNames: string[]): string;
|
|
13
16
|
};
|
|
14
17
|
//# sourceMappingURL=types.d.ts.map
|