@redocly/realm 0.136.0-next.6 → 0.136.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  4. package/dist/cli/build/index.js +1 -1
  5. package/dist/cli/eject/resolveEjectParams.js +1 -1
  6. package/dist/cli/stats/collectors/openapi/index.js +1 -1
  7. package/dist/cli/stats/index.js +1 -1
  8. package/dist/client/App.js +1 -1
  9. package/dist/client/TestProvider.js +1 -1
  10. package/dist/client/api-docs-builder-entry.d.ts +3 -0
  11. package/dist/client/api-docs-builder-entry.js +1 -0
  12. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  13. package/dist/client/app/Sidebar/Sidebar.js +3 -3
  14. package/dist/client/app/Sidebar/useActions.js +1 -1
  15. package/dist/client/app/hooks/codeHighlight/useCodeHighlight.js +1 -1
  16. package/dist/client/app/hooks/index.d.ts +1 -0
  17. package/dist/client/app/hooks/index.js +1 -1
  18. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  19. package/dist/client/app/hooks/useUserClaims.js +1 -1
  20. package/dist/client/app/l10n/hooks/index.d.ts +1 -0
  21. package/dist/client/app/l10n/hooks/index.js +1 -1
  22. package/dist/client/app/l10n/hooks/useTranslationKeys.d.ts +2 -0
  23. package/dist/client/app/l10n/hooks/useTranslationKeys.js +1 -0
  24. package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +1 -1
  25. package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
  26. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +1 -5
  27. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  28. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  29. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  30. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.d.ts +8 -24
  31. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  32. package/dist/client/app/markdoc/hooks/use-store.d.ts +8 -6
  33. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.d.ts +20 -0
  34. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.js +1 -0
  35. package/dist/client/app/markdoc/utils/find-api-item.d.ts +15 -0
  36. package/dist/client/app/markdoc/utils/find-api-item.js +1 -0
  37. package/dist/client/app/markdoc/utils/find-code-sample-panel.d.ts +11 -0
  38. package/dist/client/app/markdoc/utils/find-code-sample-panel.js +1 -0
  39. package/dist/client/app/markdoc/utils/find-openapi-response-samples.d.ts +15 -0
  40. package/dist/client/app/markdoc/utils/find-openapi-response-samples.js +1 -0
  41. package/dist/client/app/markdoc/utils/openapi-panel-entry.d.ts +18 -0
  42. package/dist/client/app/markdoc/utils/openapi-panel-entry.js +1 -0
  43. package/dist/client/app/utils/resolveRouteBySlug.js +1 -1
  44. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  45. package/dist/client/runtime/loader.js +1 -1
  46. package/dist/client/templates/api-docs/helpers.d.ts +10 -0
  47. package/dist/client/templates/api-docs/helpers.js +1 -0
  48. package/dist/client/templates/api-docs/template.d.ts +17 -0
  49. package/dist/client/templates/api-docs/template.js +14 -0
  50. package/dist/client/types/sidebar.d.ts +0 -1
  51. package/dist/client/utils/utils.d.ts +0 -2
  52. package/dist/client/utils/utils.js +1 -1
  53. package/dist/constants/common.d.ts +1 -0
  54. package/dist/constants/common.js +1 -1
  55. package/dist/constants/l10n/langs/ar.js +1 -1
  56. package/dist/constants/l10n/langs/de.js +1 -1
  57. package/dist/constants/l10n/langs/en.js +1 -1
  58. package/dist/constants/l10n/langs/es.js +1 -1
  59. package/dist/constants/l10n/langs/fr.js +1 -1
  60. package/dist/constants/l10n/langs/hi.js +1 -1
  61. package/dist/constants/l10n/langs/it.js +1 -1
  62. package/dist/constants/l10n/langs/ja.js +1 -1
  63. package/dist/constants/l10n/langs/ko.js +1 -1
  64. package/dist/constants/l10n/langs/pl.js +1 -1
  65. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  66. package/dist/constants/l10n/langs/pt.js +1 -1
  67. package/dist/constants/l10n/langs/ru.js +1 -1
  68. package/dist/constants/l10n/langs/uk.js +1 -1
  69. package/dist/constants/l10n/langs/zh.js +1 -1
  70. package/dist/server/constants/plugins/api-docs.d.ts +3 -0
  71. package/dist/server/constants/plugins/api-docs.js +1 -0
  72. package/dist/server/esbuild/esbuild-logger.js +3 -3
  73. package/dist/server/esbuild/esbuild.js +3 -3
  74. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +9 -0
  75. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +1 -0
  76. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +2 -0
  77. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +1 -0
  78. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +6 -0
  79. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +1 -0
  80. package/dist/server/plugins/api-docs/get-server-props.d.ts +4 -0
  81. package/dist/server/plugins/api-docs/get-server-props.js +1 -0
  82. package/dist/server/plugins/api-docs/get-template-path.d.ts +2 -0
  83. package/dist/server/plugins/api-docs/get-template-path.js +1 -0
  84. package/dist/server/plugins/api-docs/import-api-docs-builder.d.ts +8 -0
  85. package/dist/server/plugins/api-docs/import-api-docs-builder.js +1 -0
  86. package/dist/server/plugins/api-docs/index.d.ts +19 -0
  87. package/dist/server/plugins/api-docs/index.js +1 -0
  88. package/dist/server/plugins/api-docs/loader.d.ts +35 -0
  89. package/dist/server/plugins/api-docs/loader.js +3 -0
  90. package/dist/server/plugins/api-docs/options.d.ts +14 -0
  91. package/dist/server/plugins/api-docs/options.js +1 -0
  92. package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +20 -0
  93. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +105 -0
  94. package/dist/server/plugins/api-docs/search/search-facets.d.ts +10 -0
  95. package/dist/server/plugins/api-docs/search/search-facets.js +1 -0
  96. package/dist/server/plugins/api-docs/search/search-indexer.d.ts +9 -0
  97. package/dist/server/plugins/api-docs/search/search-indexer.js +1 -0
  98. package/dist/server/plugins/api-docs/search/search-resolver.d.ts +5 -0
  99. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -0
  100. package/dist/server/plugins/api-docs/spec-download.api.d.ts +4 -0
  101. package/dist/server/plugins/api-docs/spec-download.api.js +1 -0
  102. package/dist/server/plugins/api-docs/store-definition-bundles.d.ts +3 -0
  103. package/dist/server/plugins/api-docs/store-definition-bundles.js +1 -0
  104. package/dist/server/plugins/api-docs/utils/build-item-positions.d.ts +17 -0
  105. package/dist/server/plugins/api-docs/utils/build-item-positions.js +1 -0
  106. package/dist/server/plugins/api-docs/utils/build-routes-mapping.d.ts +3 -0
  107. package/dist/server/plugins/api-docs/utils/build-routes-mapping.js +1 -0
  108. package/dist/server/plugins/api-docs/utils/collect-item-routes.d.ts +12 -0
  109. package/dist/server/plugins/api-docs/utils/collect-item-routes.js +1 -0
  110. package/dist/server/plugins/api-docs/utils/decorators.d.ts +26 -0
  111. package/dist/server/plugins/api-docs/utils/decorators.js +1 -0
  112. package/dist/server/plugins/api-docs/utils/format-bundle-error.d.ts +6 -0
  113. package/dist/server/plugins/api-docs/utils/format-bundle-error.js +5 -0
  114. package/dist/server/plugins/api-docs/utils/normalize-api-version.d.ts +2 -0
  115. package/dist/server/plugins/api-docs/utils/normalize-api-version.js +1 -0
  116. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.d.ts +2 -0
  117. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.js +1 -0
  118. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.d.ts +20 -0
  119. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.js +1 -0
  120. package/dist/server/plugins/api-docs/utils/replace-file-extension.d.ts +2 -0
  121. package/dist/server/plugins/api-docs/utils/replace-file-extension.js +1 -0
  122. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.d.ts +3 -0
  123. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.js +1 -0
  124. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.d.ts +10 -0
  125. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.js +1 -0
  126. package/dist/server/plugins/api-docs/utils/to-relative-slug.d.ts +2 -0
  127. package/dist/server/plugins/api-docs/utils/to-relative-slug.js +1 -0
  128. package/dist/server/plugins/api-functions/index.js +1 -1
  129. package/dist/server/plugins/arazzo-docs/index.js +1 -1
  130. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  131. package/dist/server/plugins/catalog-classic/index.js +1 -1
  132. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  133. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +13 -5
  134. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  135. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  136. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +6 -5
  137. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
  138. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +12 -5
  139. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  140. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  141. package/dist/server/plugins/catalog-entities/template/index.js +1 -1
  142. package/dist/server/plugins/catalog-entities/types/openapi.d.ts +1 -1
  143. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.d.ts +3 -3
  144. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.js +1 -1
  145. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.d.ts +4 -3
  146. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.js +1 -1
  147. package/dist/server/plugins/config-parser/index.js +1 -1
  148. package/dist/server/plugins/create-slugify.d.ts +17 -0
  149. package/dist/server/plugins/create-slugify.js +1 -0
  150. package/dist/server/plugins/default-theme/index.js +1 -1
  151. package/dist/server/plugins/dev-onboarding/index.js +1 -1
  152. package/dist/server/plugins/entitlements/index.js +1 -1
  153. package/dist/server/plugins/graphql-docs/index.js +1 -1
  154. package/dist/server/plugins/helpers/parse-partials.d.ts +3 -0
  155. package/dist/server/plugins/helpers/parse-partials.js +1 -0
  156. package/dist/server/plugins/l10n/index.js +1 -1
  157. package/dist/server/plugins/lifecycle.js +2 -2
  158. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +5 -3
  159. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.js +1 -1
  160. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  161. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  162. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
  163. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.js +1 -1
  164. package/dist/server/plugins/markdown/index.js +1 -1
  165. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  166. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  167. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  168. package/dist/server/plugins/mcp/codemode/tools/execute.d.ts +1 -0
  169. package/dist/server/plugins/mcp/constants.d.ts +1 -0
  170. package/dist/server/plugins/mcp/constants.js +1 -1
  171. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
  172. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  173. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.d.ts +11 -0
  174. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -0
  175. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.d.ts +4 -0
  176. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.js +1 -0
  177. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
  178. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -4
  179. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +7 -1
  180. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +0 -1
  181. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +5 -1
  182. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +4 -2
  183. package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -0
  184. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  185. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +1 -1
  186. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +1 -1
  187. package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +1 -1
  188. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +2 -2
  189. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +2 -2
  190. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +1 -2
  191. package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +1 -1
  192. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +4 -4
  193. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
  194. package/dist/server/plugins/mcp/gateway-mcp/subject.d.ts +20 -0
  195. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -0
  196. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +9 -9
  197. package/dist/server/plugins/mcp/index.js +1 -1
  198. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  199. package/dist/server/plugins/mcp/servers/mcp-server.js +1 -1
  200. package/dist/server/plugins/mcp/types.d.ts +1 -2
  201. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +1 -1
  202. package/dist/server/plugins/mcp/utils.d.ts +17 -5
  203. package/dist/server/plugins/mcp/utils.js +1 -1
  204. package/dist/server/plugins/openapi-docs/index.js +1 -1
  205. package/dist/server/plugins/pages/index.js +1 -1
  206. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
  207. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  208. package/dist/server/plugins/scorecards/plugin.js +1 -1
  209. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +2 -2
  210. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  211. package/dist/server/plugins/search/index.js +1 -1
  212. package/dist/server/plugins/search/llmstxt/index.js +4 -4
  213. package/dist/server/plugins/sidebars/index.js +1 -1
  214. package/dist/server/plugins/sitemap/index.js +1 -1
  215. package/dist/server/plugins/sso/index.js +1 -1
  216. package/dist/server/ssr/render.js +1 -1
  217. package/dist/server/ssr/utils.d.ts +1 -0
  218. package/dist/server/ssr/utils.js +5 -5
  219. package/dist/server/store.d.ts +2 -6
  220. package/dist/server/store.js +1 -1
  221. package/dist/server/types/plugins/common.d.ts +3 -5
  222. package/dist/server/types/plugins/markdown.d.ts +1 -3
  223. package/dist/server/types/plugins/search.d.ts +1 -0
  224. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -1
  225. package/dist/server/utils/report-all-errors.js +1 -1
  226. package/dist/server/utils/shared-data.js +1 -1
  227. package/dist/server/web-server/routes/resolve-route.js +1 -1
  228. package/dist/types/markdoc.d.ts +2 -1
  229. package/dist/utils/url/get-shared-data-fetch-url.d.ts +17 -0
  230. package/dist/utils/url/get-shared-data-fetch-url.js +1 -0
  231. package/package.json +9 -8
  232. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.d.ts +0 -4
  233. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.js +0 -1
  234. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.d.ts +0 -4
  235. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.js +0 -1
  236. package/dist/markdoc/helpers/get-operation/get-operation.d.ts +0 -14
  237. package/dist/markdoc/helpers/get-operation/get-operation.js +0 -1
  238. package/dist/markdoc/helpers/get-operation/index.d.ts +0 -4
  239. package/dist/markdoc/helpers/get-operation/index.js +0 -1
  240. package/dist/markdoc/helpers/get-operation/types/index.d.ts +0 -4
  241. package/dist/markdoc/helpers/get-operation/types/index.js +0 -0
  242. package/dist/markdoc/helpers/get-operation/types/operation-identifier.d.ts +0 -5
  243. package/dist/markdoc/helpers/get-operation/types/operation-identifier.js +0 -0
  244. package/dist/markdoc/helpers/get-operation/types/operation-info.d.ts +0 -6
  245. package/dist/markdoc/helpers/get-operation/types/operation-info.js +0 -0
  246. package/dist/markdoc/helpers/get-operation/types/operation-parameters.d.ts +0 -3
  247. package/dist/markdoc/helpers/get-operation/types/operation-parameters.js +0 -0
  248. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.d.ts +0 -4
  249. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.js +0 -1
@@ -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 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
+ 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 A}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("com.redocly.build.plugin.graphqlDocs",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:_,content:y,settings:u,metadata:G,store:c}=h.data,L=`${j}${o}`;await t.createSharedData(L,y);const d=[{key:"graphQlSettings",id:L}],b=_.getGroups(),T=_.getSidebarItems(),g={type:"graphql",title:b[0].name,...G},s=[{slugSuffix:"",fsPath:o,templateId:m,getStaticData:S(void 0,u,p),sharedData:d,getAiDocumentsStore:A({label:u.info?.title??"GraphQL Overview",groupName:"overview",metadata:g,actions:t,store:c,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:d});for(const e of r.typeGroups){const a=`${e.id}`;s.push({slugSuffix:a,fsPath:o,templateId:m,getStaticData:S(e,u,p),sharedData:d,getAiDocumentsStore:A({label:e.name,groupName:e.name,metadata:g,actions:t,store:c,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:d,getAiDocumentsStore:A({label:E,groupName:e.name,metadata:g,actions:t,store:c})})}}}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(T)},D.getSearchDocuments=F(t,c);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};
@@ -0,0 +1,3 @@
1
+ import { type Node } from '@markdoc/markdoc';
2
+ export declare function parsePartials(partials?: Record<string, any>): Record<string, Node[] | Node> | undefined;
3
+ //# sourceMappingURL=parse-partials.d.ts.map
@@ -0,0 +1 @@
1
+ import{Ast as i}from"@markdoc/markdoc";function o(r){if(r)return Object.entries(r).reduce((e,[t,n])=>(e[t]=i.fromJSON(JSON.stringify(n)),e),{})}export{o as parsePartials};
@@ -1 +1 @@
1
- import g from"path";import{DEFAULT_LOCALE_PLACEHOLDER as d,TRANSLATIONS_FILE_NAME as h}from"../../../constants/common.js";import{I18N_DIR_NAME as y,L10N_DIR_NAME as A}from"../../constants/common.js";import{logger as m}from"../../tools/notifiers/logger.js";import{reporter as w}from"../../tools/notifiers/reporter.js";import{EntitlementsProvider as O}from"../../entitlements/entitlements-provider.js";import{isL10nPath as E}from"../../fs/utils/is-l10n-path.js";import{isOpenapiDoc as I}from"../openapi-docs/is-openapi-doc.js";import{telemetryTraceStep as N}from"../../../cli/telemetry/helpers/trace-step.js";async function $(){return{id:"l10n",async processContent(n,i){await N("build.plugin.l10n",async a=>{const{fs:t,cache:c,getConfig:r}=i,e={},p=O.instance(),l=await r();a?.setAttribute("config",JSON.stringify(l.l10n||{}));const s=l.l10n?.defaultLocale||d;if(p.canAccessFeature("l10n")){await F(i);for(const{relativePath:o}of t.scan(/(^|.*[\/\\])translations\.yaml$/)){const u=await c.load(o,"yaml"),L=P(o)||s;e[L]={translation:u.data||{}}}}e[s]={translation:{...e[s]?.translation||{}}};const f=l.l10n?.locales||[d,...t.localeFolders].map(o=>({code:o.toLowerCase(),name:o}));a?.setAttribute("locales",JSON.stringify(f)),n.setGlobalData({l10n:{translations:e,defaultLocale:s,locales:f.map(o=>({code:o.code,name:o.name||o.code}))}})})}}}function P(n){return n.indexOf("/")>0?n.split("/")[1]:void 0}async function F(n){const i=n.fs.scan();for(const{isVirtual:a,realRelativePath:t}of i){if(a)continue;if(E(t)&&t.endsWith(".page.tsx")&&await w.panicOnBuild(`The file %rp is not allowed in ${A} or ${y} folders`,t),g.posix.basename(t)===h){const r=/^(?:@(i18n|l10n)[\/\\][^\/\\]+[\/\\])?translations\.yaml$/.test(t),e=await I(t,n);!r&&!e&&m.warn("The file %rp is in the wrong location. Make sure it is located in the root directory or in the locale root directory.",t),r&&e&&m.warn("It looks like the file %rp might be an OpenAPI definition and is located in a location reserved for translation files. Please rename it or move to another directory if it is not a translations file",t)}}}export{$ as l10nPlugin};
1
+ import g from"path";import{DEFAULT_LOCALE_PLACEHOLDER as d,TRANSLATIONS_FILE_NAME as h}from"../../../constants/common.js";import{I18N_DIR_NAME as y,L10N_DIR_NAME as A}from"../../constants/common.js";import{logger as m}from"../../tools/notifiers/logger.js";import{reporter as w}from"../../tools/notifiers/reporter.js";import{EntitlementsProvider as O}from"../../entitlements/entitlements-provider.js";import{isL10nPath as E}from"../../fs/utils/is-l10n-path.js";import{isOpenapiDoc as I}from"../openapi-docs/is-openapi-doc.js";import{telemetryTraceStep as N}from"../../../cli/telemetry/helpers/trace-step.js";async function $(){return{id:"l10n",async processContent(n,i){await N("com.redocly.build.plugin.l10n",async a=>{const{fs:t,cache:c,getConfig:r}=i,e={},p=O.instance(),l=await r();a?.setAttribute("config",JSON.stringify(l.l10n||{}));const s=l.l10n?.defaultLocale||d;if(p.canAccessFeature("l10n")){await F(i);for(const{relativePath:o}of t.scan(/(^|.*[\/\\])translations\.yaml$/)){const u=await c.load(o,"yaml"),L=P(o)||s;e[L]={translation:u.data||{}}}}e[s]={translation:{...e[s]?.translation||{}}};const f=l.l10n?.locales||[d,...t.localeFolders].map(o=>({code:o.toLowerCase(),name:o}));a?.setAttribute("locales",JSON.stringify(f)),n.setGlobalData({l10n:{translations:e,defaultLocale:s,locales:f.map(o=>({code:o.code,name:o.name||o.code}))}})})}}}function P(n){return n.indexOf("/")>0?n.split("/")[1]:void 0}async function F(n){const i=n.fs.scan();for(const{isVirtual:a,realRelativePath:t}of i){if(a)continue;if(E(t)&&t.endsWith(".page.tsx")&&await w.panicOnBuild(`The file %rp is not allowed in ${A} or ${y} folders`,t),g.posix.basename(t)===h){const r=/^(?:@(i18n|l10n)[\/\\][^\/\\]+[\/\\])?translations\.yaml$/.test(t),e=await I(t,n);!r&&!e&&m.warn("The file %rp is in the wrong location. Make sure it is located in the root directory or in the locale root directory.",t),r&&e&&m.warn("It looks like the file %rp might be an OpenAPI definition and is located in a location reserved for translation files. Please rename it or move to another directory if it is not a translations file",t)}}}export{$ as l10nPlugin};
@@ -1,2 +1,2 @@
1
- import B from"@redocly/portal-plugin-mock-server";import _ from"path";import{REDOCLY_ROUTE_RBAC as x}from"@redocly/config";import{combineUrls as v,withPathPrefix as N}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as k}from"../constants/common.js";import{removeTrailingSlash as T}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as L}from"../../utils/url/remove-leading-slash.js";import{isTruthy as j}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as F}from"../../utils/path/normalize-route-slug.js";import{slash as q}from"../../utils/path/slash.js";import{parsePathVersions as V}from"../../utils/path/parse-path-versions.js";import{reporter as b}from"../tools/notifiers/reporter.js";import{logger as h}from"../tools/notifiers/logger.js";import{envConfig as S}from"../config/env-config.js";import{shaDirPathShort as $}from"../utils/crypto/sha-dir-path-short.js";import{writeServerRebuildTrigger as M}from"../esbuild/generate.js";import{customPagesPlugin as z}from"../../server/plugins/pages/index.js";import{openAPIDocsPlugin as H}from"../../server/plugins/openapi-docs/index.js";import{asyncAPIDocsPlugin as I}from"../../server/plugins/asyncapi-docs/index.js";import{configParserPlugin as U}from"./config-parser/index.js";import{markdownPlugin as G}from"./markdown/index.js";import{generateBrowserPluginsModule as W,generateClientRoutes as K,generateTemplatesModule as Y}from"../esbuild/generate.js";import{graphqlDocsPlugin as J}from"./graphql-docs/index.js";import{searchPlugin as Q}from"./search/index.js";import{skillsPlugin as X}from"./skills/index.js";import{defaultThemePlugin as Z}from"./default-theme/index.js";import{apiKeyMgmtPlugin as ee}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as te}from"./api-functions/index.js";import{scorecardClassicPlugin as oe}from"./scorecard-classic/index.js";import{lintPlugin as ie}from"./lint/index.js";import{resolveExternalPlugins as re}from"../external-plugins/resolve-external-plugins.js";import{sidebarsPlugin as ne}from"./sidebars/index.js";import{l10nPlugin as se}from"./l10n/index.js";import{validateRedirects as ae}from"../utils/redirects/validate-redirects.js";import{analyticsPlugins as le}from"./analytics/index.js";import{sitemapPlugin as ue}from"./sitemap/index.js";import{entitlementsPlugin as ce}from"./entitlements/index.js";import{getBilledPagesCount as fe,slug as me}from"../utils/index.js";import{telemetry as de}from"../../cli/telemetry/index.js";import{telemetryTraceStep as E}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as D}from"../entitlements/entitlements-provider.js";import{enforceLoginPlugin as pe}from"./enforce-login/index.js";import{ssoPlugin as ge}from"./sso/index.js";import{Cache as Pe}from"../fs/cache.js";import{ContentFs as he}from"../fs/content-fs.js";import{findProductBySlug as ye}from"../utils/product.js";import{parseBaseName as Re}from"./utils.js";import{isRouteReserved as we}from"./get-reserved-routes.js";import{catalogClassicPlugin as Ce}from"./catalog-classic/index.js";import{arazzoDocsPlugin as ve}from"./arazzo-docs/index.js";const be=[U,pe,ge,Z,se,G,H,I,ve,oe,ie,te,z,J,ee,Ce,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>S.NEW_CATALOG_ENABLED??!1},{importPath:"./scorecards/plugin.js",loadCondition:()=>S.NEW_SCORECARDS_ENABLED??!1},{importPath:"./mcp/index.js",loadCondition:()=>D.instance().canAccessFeature("mcp")},ne,ue,ce,Q,X,B,...le];async function bt(t,e=be){return await E("build.plugins_init",async()=>{const r=[],w=D.instance(),y={};for(const s of e){let d;if("loadCondition"in s){if(!s.loadCondition())continue;const o=await import(s.importPath);if(!o.default||typeof o.default!="function"){await b.panicOnBuild(`Dynamic plugin ${s.importPath} does not export a default export or it is not a function`);continue}d=o.default}else d=s;const R=await d(t);for(const[o,l]of Object.entries(R.loaders||{}))y[o]&&await b.panicOnBuild(`Duplicate loader with name ${o}`),y[o]=l;(!R.requiredEntitlements||R.requiredEntitlements?.every(o=>w.canAccessFeature(o)))&&r.push(R)}const u=new he(t.contentDir);await u.ready;const m=new Pe(u);return m.setLoaders(y),h.verbose("All plugins instantiated"),{pluginInstances:r,lifecycleContext:Ae(u,m)}})}function O(t){h.verbose("Generating templates"),E("build.write_client_entries",()=>{Y(t),W(t),K(t)})}async function Ee(t){const e=t.getAllRoutes();fe(e)||await b.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function Et(t,e,r,w={}){const y=D.instance();try{await E("build.plugins_run",async()=>{e.startPluginsRun();const u=S.isDevelopMode&&e.buildRevision>0,m=u?Array.from(e.apiRoutesRequestHandlers.keys()).sort().join(","):"";let s=[];await E("build.plugins_process_content",async o=>{for(const i of t){const a=h.startTiming();await i.processContent?.(e,r),h.verboseTime(a,`processContent for ${i.id}`)}s=(await re(e.contentDir,e.config.plugins)).map(i=>i.lifecyclePlugin).filter(i=>j(i)&&(!i.requiredEntitlements||i.requiredEntitlements?.every(a=>y.canAccessFeature(a)))),r.cache.setLoaders(Object.fromEntries(s.flatMap(i=>Object.entries(i.loaders||{}))));for(const i of s){const a=h.startTiming();await i.processContent?.(e,r),h.verboseTime(a,`processContent for ${i.id}`)}o?.setAttribute("externalPluginsProcessed",s.length.toString())});const d=await Se(e,r),R=[...t,...s];if(O(e),S.isDevelopMode?await e.userCodeReady:e.buildRevision++,await E("build.plugins_after_routes_created",async()=>{for(const o of R){const l=h.startTiming();await o.afterRoutesCreated?.(e,d),h.verboseTime(l,`afterRoutesCreated for ${o.id}`)}}),ae(e),await e.reportUnsetEnvVars(),await Ee(e),O(e),u){const o=Array.from(e.apiRoutesRequestHandlers.keys()).sort().join(",");m!==o&&(e.markRequestHandlersEntryOutdated(),M(e.serverOutDir))}})}catch(u){const m="Unhandled error in plugin. "+u.message+`
2
- `+u.stack;de.sendCliErrorCaughtMessage({message:m}),w.failFast?await b.panic(m):await b.panicOnBuild(m)}finally{e.finishPluginsRun()}}async function Se(t,e){const{cache:r,fs:w}=e,y=await e.getConfig(),u=Object.values(y.products||{}),m=(await r.load("versions-config","versions-config")).data,s=(await r.load("content-slugs","content-slugs")).data;for(const{duplicateInAllLocales:o,slugSuffix:l,sharedData:i=[],redirectFrom:a=[],...c}of t.newRoutes){const f=F(c.slug?c.slug:d(c.fsPath)),g=T(l?v(f,l):f),n={...c,[x]:{slug:g,fsPath:c.fsPath},slug:g,baseSlug:f,versions:R(c.fsPath,l),product:ye(u,g,d)};we(g,y)&&await b.panicOnBuildContentError(`Route "${g}" is reserved and cannot be used. Please choose a different slug for "${c.fsPath}".`),t.routesByFsPath.set(n.fsPath,n.slug),t.routesBySlug.set(n.slug,n);for(const{key:P,id:p}of i)t.addRouteSharedData(n.slug,P,p);for(const P of a)t.addRedirect(P.from,{type:P.type,to:n.slug});if(o)for(const P of w.localeFolders){const p={...n,slug:"/"+P.toLowerCase()+n.slug};t.routesByFsPath.set(p.fsPath,p.slug),t.routesBySlug.set(p.slug,p);for(const{key:C,id:A}of i)t.addRouteSharedData(p.slug,C,A);for(const C of a){const A=v(w.localizationFolder,P,C.from);t.addRedirect(A,{type:C.type,to:p.slug},{trackOriginalSource:!1})}}}return t.newRoutes=[],{...e,slugify:d};function d(o){const l=q(o).replace(new RegExp("^(@i18n|@l10n)\\/"),""),i=s.fileSlugs.get(l)||s.dirSlugs.get(T(l));if(i)return i;const{baseName:a,isIndexFile:c}=Re(o);let f=_.dirname(o.replace(new RegExp("^(@i18n|@l10n)\\/"),""));return f=f==="."?"/":f,v("/",me(c?f:v(f,a)),"/")}function R(o,l=""){const i=V(o);if(!i?.versionName)return;const{versionFolderPath:a,filePathInVersion:c,versionName:f}=i,g=m.get(a);if(g)return g.versions.map(n=>{const P=g.defaultVersion===n.version,p=L(v(a,k+n.version,c)),C=d(p);return{version:n.version,label:n.name||n.version,link:F(v(C,l)),default:P,active:f===n.version,folderId:$(`${a}`)}})}}function Ae(t,e){return{fs:t,cache:e,getConfig:async(r=".")=>(await e.load(r,"nearest-redocly-config",t.localeFolders)).data,isPathIgnored:async r=>(await e.load(r,"is-ignored")).data,withPathPrefix:N,logger:h}}export{be as INTERNAL_PLUGINS,Ae as createLifecycleContext,bt as initPlugins,Et as runPlugins,O as writeClientEntries};
1
+ import F from"@redocly/portal-plugin-mock-server";import{REDOCLY_ROUTE_RBAC as B}from"@redocly/config";import{combineUrls as E,withPathPrefix as k}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as x}from"../constants/common.js";import{removeTrailingSlash as L}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as N}from"../../utils/url/remove-leading-slash.js";import{isTruthy as j}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as D}from"../../utils/path/normalize-route-slug.js";import{parsePathVersions as q}from"../../utils/path/parse-path-versions.js";import{reporter as w}from"../tools/notifiers/reporter.js";import{logger as P}from"../tools/notifiers/logger.js";import{envConfig as S}from"../config/env-config.js";import{shaDirPathShort as V}from"../utils/crypto/sha-dir-path-short.js";import{writeServerRebuildTrigger as _}from"../esbuild/generate.js";import{customPagesPlugin as $}from"../../server/plugins/pages/index.js";import{apiDocsPlugin as M}from"../../server/plugins/api-docs/index.js";import{configParserPlugin as z}from"./config-parser/index.js";import{createSlugify as H}from"./create-slugify.js";import{markdownPlugin as U}from"./markdown/index.js";import{generateBrowserPluginsModule as G,generateClientRoutes as I,generateTemplatesModule as W}from"../esbuild/generate.js";import{searchPlugin as K}from"./search/index.js";import{skillsPlugin as Y}from"./skills/index.js";import{defaultThemePlugin as J}from"./default-theme/index.js";import{apiKeyMgmtPlugin as Q}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as X}from"./api-functions/index.js";import{scorecardClassicPlugin as Z}from"./scorecard-classic/index.js";import{lintPlugin as ee}from"./lint/index.js";import{resolveExternalPlugins as te}from"../external-plugins/resolve-external-plugins.js";import{sidebarsPlugin as oe}from"./sidebars/index.js";import{l10nPlugin as ie}from"./l10n/index.js";import{validateRedirects as re}from"../utils/redirects/validate-redirects.js";import{analyticsPlugins as ne}from"./analytics/index.js";import{sitemapPlugin as se}from"./sitemap/index.js";import{entitlementsPlugin as ae}from"./entitlements/index.js";import{getBilledPagesCount as le}from"../utils/index.js";import{telemetry as ce}from"../../cli/telemetry/index.js";import{telemetryTraceStep as b}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as T}from"../entitlements/entitlements-provider.js";import{enforceLoginPlugin as ue}from"./enforce-login/index.js";import{ssoPlugin as fe}from"./sso/index.js";import{Cache as me}from"../fs/cache.js";import{ContentFs as de}from"../fs/content-fs.js";import{findProductBySlug as ge}from"../utils/product.js";import{isRouteReserved as pe}from"./get-reserved-routes.js";import{catalogClassicPlugin as Pe}from"./catalog-classic/index.js";import{arazzoDocsPlugin as ye}from"./arazzo-docs/index.js";const he=[z,ue,fe,J,ie,U,M,ye,Z,ee,X,$,Q,Pe,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>S.NEW_CATALOG_ENABLED??!1},{importPath:"./scorecards/plugin.js",loadCondition:()=>S.NEW_SCORECARDS_ENABLED??!1},{importPath:"./mcp/index.js",loadCondition:()=>T.instance().canAccessFeature("mcp")},oe,se,ae,K,Y,F,...ne];async function gt(t,e=he){return await b("com.redocly.build.pluginsInit",async()=>{const r=[],R=T.instance(),y={};for(const s of e){let u;if("loadCondition"in s){if(!s.loadCondition())continue;const o=await import(s.importPath);if(!o.default||typeof o.default!="function"){await w.panicOnBuild(`Dynamic plugin ${s.importPath} does not export a default export or it is not a function`);continue}u=o.default}else u=s;const h=await u(t);for(const[o,f]of Object.entries(h.loaders||{}))y[o]&&await w.panicOnBuild(`Duplicate loader with name ${o}`),y[o]=f;(!h.requiredEntitlements||h.requiredEntitlements?.every(o=>R.canAccessFeature(o)))&&r.push(h)}const l=new de(t.contentDir);await l.ready;const c=new me(l);return c.setLoaders(y),P.verbose("All plugins instantiated"),{pluginInstances:r,lifecycleContext:we(l,c)}})}function O(t){P.verbose("Generating templates"),b("com.redocly.build.writeClientEntries",()=>{W(t),G(t),I(t)})}async function Re(t){const e=t.getAllRoutes();le(e)||await w.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function pt(t,e,r,R={}){const y=T.instance();try{await b("com.redocly.build.pluginsRun",async()=>{e.startPluginsRun();const l=S.isDevelopMode&&e.buildRevision>0,c=l?Array.from(e.apiRoutesRequestHandlers.keys()).sort().join(","):"";let s=[];await b("com.redocly.build.pluginsProcessContent",async o=>{for(const i of t){const a=P.startTiming();await i.processContent?.(e,r),P.verboseTime(a,`processContent for ${i.id}`)}s=(await te(e.contentDir,e.config.plugins)).map(i=>i.lifecyclePlugin).filter(i=>j(i)&&(!i.requiredEntitlements||i.requiredEntitlements?.every(a=>y.canAccessFeature(a)))),r.cache.setLoaders(Object.fromEntries(s.flatMap(i=>Object.entries(i.loaders||{}))));for(const i of s){const a=P.startTiming();await i.processContent?.(e,r),P.verboseTime(a,`processContent for ${i.id}`)}o?.setAttribute("externalPluginsProcessed",s.length.toString())});const u=await Ce(e,r),h=[...t,...s];if(O(e),S.isDevelopMode?await e.userCodeReady:e.buildRevision++,await b("com.redocly.build.pluginsAfterRoutesCreated",async()=>{for(const o of h){const f=P.startTiming();await o.afterRoutesCreated?.(e,u),P.verboseTime(f,`afterRoutesCreated for ${o.id}`)}}),re(e),await e.reportUnsetEnvVars(),await Re(e),O(e),l){const o=Array.from(e.apiRoutesRequestHandlers.keys()).sort().join(",");c!==o&&(e.markRequestHandlersEntryOutdated(),_(e.serverOutDir))}})}catch(l){const c="Unhandled error in plugin. "+l.message+`
2
+ `+l.stack;ce.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:c}]),R.failFast?await w.panic(c):await w.panicOnBuild(c)}finally{e.finishPluginsRun()}}async function Ce(t,e){const{cache:r,fs:R}=e,y=await e.getConfig(),l=Object.values(y.products||{}),c=(await r.load("versions-config","versions-config")).data,s=(await r.load("content-slugs","content-slugs")).data,u=H(s);for(const{duplicateInAllLocales:o,slugSuffix:f,sharedData:i=[],redirectFrom:a=[],...d}of t.newRoutes){const v=D(d.slug?d.slug:u(d.fsPath)),g=L(f?E(v,f):v),n={...d,[B]:{slug:g,fsPath:d.fsPath},slug:g,baseSlug:v,versions:h(d.fsPath,f),product:ge(l,g,u)};pe(g,y)&&await w.panicOnBuildContentError(`Route "${g}" is reserved and cannot be used. Please choose a different slug for "${d.fsPath}".`),t.routesByFsPath.set(n.fsPath,n.slug),t.routesBySlug.set(n.slug,n);for(const{key:p,id:m}of i)t.addRouteSharedData(n.slug,p,m);for(const p of a)t.addRedirect(p.from,{type:p.type,to:n.slug});if(o)for(const p of R.localeFolders){const m={...n,slug:"/"+p.toLowerCase()+n.slug};t.routesByFsPath.set(m.fsPath,m.slug),t.routesBySlug.set(m.slug,m);for(const{key:C,id:A}of i)t.addRouteSharedData(m.slug,C,A);for(const C of a){const A=E(R.localizationFolder,p,C.from);t.addRedirect(A,{type:C.type,to:m.slug},{trackOriginalSource:!1})}}}return t.newRoutes=[],{...e,slugify:u};function h(o,f=""){const i=q(o);if(!i?.versionName)return;const{versionFolderPath:a,filePathInVersion:d,versionName:v}=i,g=c.get(a);if(g)return g.versions.map(n=>{const p=g.defaultVersion===n.version,m=N(E(a,x+n.version,d)),C=u(m);return{version:n.version,label:n.name||n.version,link:D(E(C,f)),default:p,active:v===n.version,folderId:V(`${a}`)}})}}function we(t,e){return{fs:t,cache:e,getConfig:async(r=".")=>(await e.load(r,"nearest-redocly-config",t.localeFolders)).data,isPathIgnored:async r=>(await e.load(r,"is-ignored")).data,withPathPrefix:k,logger:P}}export{he as INTERNAL_PLUGINS,we as createLifecycleContext,gt as initPlugins,pt as runPlugins,O as writeClientEntries};
@@ -1,7 +1,9 @@
1
1
  import type { Node } from '@markdoc/markdoc';
2
+ import type { OpenAPIDefinition, RawApiDocsOptions } from '@redocly/api-docs';
2
3
  import type { LifecycleContext } from '../../../../types';
3
- import type { BundledDefinition } from '../../../openapi-docs/load-definition.js';
4
- type OpenapiBundle = Pick<BundledDefinition, 'definition' | 'rawOptions'>;
4
+ export type OpenapiBundle = {
5
+ definition: OpenAPIDefinition;
6
+ rawOptions: RawApiDocsOptions;
7
+ };
5
8
  export declare function loadOpenapiBundle(node: Node, context: LifecycleContext): Promise<OpenapiBundle | undefined>;
6
- export {};
7
9
  //# sourceMappingURL=load-openapi-bundle.d.ts.map
@@ -1 +1 @@
1
- import{OPENAPI_SHARED_DATA_PREFIX as n}from"../../../../constants/plugins/openapi-docs.js";import{getNodeAttribute as a}from"../../../../../markdoc/helpers/get-node-attribute.js";import{logger as d}from"../../../../tools/notifiers/logger.js";async function l(r,i){const e=a(r,"descriptionFile");if(typeof e!="string"||!e.startsWith(n))return;const o=e.slice(n.length);try{const{data:t}=await i.cache.load(o,"load-oas");return t?.[0]}catch(t){d.verbose(`Failed to load OpenAPI definition ${o} for the ${r.tag} tag: ${t instanceof Error?t.message:"Unknown error"}`);return}}export{l as loadOpenapiBundle};
1
+ import{API_DOCS_SHARED_DATA_PREFIX as r}from"../../../../constants/plugins/api-docs.js";import{getNodeAttribute as p}from"../../../../../markdoc/helpers/get-node-attribute.js";import{logger as s}from"../../../../tools/notifiers/logger.js";async function l(i,a){const e=p(i,"descriptionFile");if(typeof e!="string"||!e.startsWith(r))return;const o=e.slice(r.length);try{const{data:t}=await a.cache.load(o,"api-doc"),n=t?.find(d=>d.type==="openapi");return n?{definition:n.document,rawOptions:n.options}:void 0}catch(t){s.verbose(`Failed to load OpenAPI definition ${o} for the ${i.tag} tag: ${t instanceof Error?t.message:"Unknown error"}`);return}}export{l as loadOpenapiBundle};
@@ -1 +1 @@
1
- import{JsonPointer as w}from"@redocly/openapi-docs";import{isObject as d}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=u(e,o);try{if(!d(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=await n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=w.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
1
+ import{JsonPointer as w}from"@redocly/api-docs";import{isObject as d}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=u(e,o);try{if(!d(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=await n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=w.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
@@ -1 +1 @@
1
- import f from"node:path";import{OPENAPI_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/openapi-docs.js";import{getNodeAttribute as A}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../openapi-docs/is-openapi-doc.js";import{MdResolveError as a}from"./md-resolve-error.js";import{getLinkOriginalAttrName as g}from"./utils.js";async function O(r,t,e,{context:n}){const s=g(t);let o=r[s]||A(r,t);if(o||await d(e,n)&&(o=f.basename(e)),r[s]=o,!o)return;const i=f.posix.join(f.posix.dirname(e),o),m=p+i;if(w(r,t,m),!n.fs.exists(i))throw new a(`Definition file ${i} does not exist`,{rawLink:i});if(await n.isPathIgnored(i))throw new a(`Definition file ${i} is ignored in config`,{rawLink:i});return{sharedDataId:m}}export{O as resolveOpenApiRef};
1
+ import f from"node:path";import{API_DOCS_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/api-docs.js";import{getNodeAttribute as A}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../openapi-docs/is-openapi-doc.js";import{MdResolveError as a}from"./md-resolve-error.js";import{getLinkOriginalAttrName as g}from"./utils.js";async function R(r,t,e,{context:n}){const s=g(t);let o=r[s]||A(r,t);if(o||await d(e,n)&&(o=f.basename(e)),r[s]=o,!o)return;const i=f.posix.join(f.posix.dirname(e),o),m=p+i;if(w(r,t,m),!n.fs.exists(i))throw new a(`Definition file ${i} does not exist`,{rawLink:i});if(await n.isPathIgnored(i))throw new a(`Definition file ${i} is ignored in config`,{rawLink:i});return{sharedDataId:m}}export{R as resolveOpenApiRef};
@@ -1 +1 @@
1
- import{normalizeOptions as y}from"@redocly/openapi-docs";import{buildCodeSamples as f}from"@redocly/openapi-docs/lib/services/code-samples/build-code-samples.js";import{getOperation as v}from"../../../../markdoc/helpers/get-operation/index.js";import{setNodeAttributeValue as O}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{getMediaContentSamples as S}from"./helpers/get-media-content-samples.js";import{loadOpenapiBundle as b}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as a}from"./utils.js";const h={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"},C=(e,n)=>typeof n=="string"?n:String(e??"");async function K(e,n,w,{context:u}){const o=await b(e,u);if(!o)return;const m=a(e,"language"),r={exampleKey:a(e,"exampleKey"),mimeType:a(e,"mimeType"),parameters:a(e,"parameters"),requestBody:a(e,"requestBody"),environments:a(e,"environments"),environment:a(e,"environment")},c=m?{...o.rawOptions,codeSamples:{...o.rawOptions.codeSamples,languages:[{lang:m}]}}:o.rawOptions,i=y(c),s=v({definition:o.definition,options:c},{operationId:a(e,"operationId"),pointer:a(e,"pointer")},i,r);if(!s)return;const p=f(s,i,o.definition,r,C).map(t=>({lang:h[t.lang]??t.lang.toLowerCase(),title:t.label??t.lang,source:t.source})),g=i.codeSamples.languages??[],l=g.find(({lang:t})=>t==="Payload");if(l){const t=S(s.payload?.requestBodyContent,r.exampleKey,l.label??"Payload"),d=g.indexOf(l);p.splice(d,0,...t)}p.length&&O(e,n,p)}export{K as resolveOpenapiCodeSamples};
1
+ import{buildCodeSamples as y,getRequestBodySamples as v,normalizeOptions as d,resolveOperationSampleContext as f}from"@redocly/api-docs";import{setNodeAttributeValue as S}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as O}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as t}from"./utils.js";const b={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"};async function B(e,c,h,{context:u}){const o=await O(e,u);if(!o)return;const s=t(e,"language"),r={exampleKey:t(e,"exampleKey"),mimeType:t(e,"mimeType"),parameters:t(e,"parameters"),requestBody:t(e,"requestBody"),environments:t(e,"environments"),environment:t(e,"environment")},g={...o.rawOptions,...o.rawOptions.mockServer&&{mockServer:{...o.rawOptions.mockServer,position:"off"}},...s&&{codeSamples:{...o.rawOptions.codeSamples,languages:[{lang:s}]}}},l=d(g),n=f(o.definition,l,{operationId:t(e,"operationId"),pointer:t(e,"pointer")});if(!n)return;const i=y(n,r).map(a=>({lang:b[a.lang]??a.lang.toLowerCase(),title:a.label??a.lang,source:a.source})),m=l.codeSamples?.languages??[],p=m.findIndex(({lang:a})=>a==="Payload");if(p!==-1){const a=v(n,{exampleKey:r.exampleKey,mimeType:r.mimeType,titlePrefix:m[p].label});i.splice(p,0,...a)}i.length&&S(e,c,i)}export{B as resolveOpenapiCodeSamples};
@@ -1 +1 @@
1
- import{normalizeOptions as s}from"@redocly/openapi-docs";import{getOperation as l}from"../../../../markdoc/helpers/get-operation/index.js";import{setNodeAttributeValue as f}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{getMediaContentSamples as c}from"./helpers/get-media-content-samples.js";import{loadOpenapiBundle as u}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as o}from"./utils.js";async function h(t,a,O,{context:m}){const e=await u(t,m);if(!e)return;const i=o(t,"exampleKey"),n=l({definition:e.definition,options:e.rawOptions},{operationId:o(t,"operationId"),pointer:o(t,"pointer")},s(e.rawOptions),{exampleKey:i});if(!n)return;const r=(n.responses??[]).flatMap(p=>c(p.content,i,`${p.code}`));r.length&&f(t,a,r)}export{h as resolveOpenapiResponseSamples};
1
+ import{getResponseSamples as s,normalizeOptions as l,resolveOperationSampleContext as m}from"@redocly/api-docs";import{setNodeAttributeValue as f}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as u}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as o}from"./utils.js";async function g(e,p,c,{context:r}){const t=await u(e,r);if(!t)return;const a=o(e,"exampleKey"),i=m(t.definition,l(t.rawOptions),{operationId:o(e,"operationId"),pointer:o(e,"pointer")});if(!i)return;const n=s(i,{exampleKey:a});n.length&&f(e,p,n)}export{g as resolveOpenapiResponseSamples};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../constants/common.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function le(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},F=await _(a,"markdown-frontmatter",r,t),p=L(F,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const f=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});f&&(u=e.createTemplate(f.templateRef,f.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),await Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(v=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:v,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([l,{type:c}])=>({type:c||301,from:l})),[y]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(l,c){return E(o,l,t,r,c)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{le as markdownPlugin};
1
+ import{REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../constants/common.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function ce(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("com.redocly.build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},y=await _(a,"markdown-frontmatter",r,t),p=L(y,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const l=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});l&&(u=e.createTemplate(l.templateRef,l.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),await Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(F=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:F,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([c,{type:f}])=>({type:f||301,from:c})),[v]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(c,f){return E(o,c,t,r,f)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{ce as markdownPlugin};
@@ -1,3 +1,3 @@
1
- import{logger as N}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as T}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as w}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as b,TagNode as p}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class B{#s;#o;#e;#r;#c;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s,renderTag:o}){if(this.#s=i,this.#o=t,this.#e=r,this.#r=s,this.#c=o,!this.#s||!f(this.#s))throw new Error("ast is not a valid Markdoc Node.")}#i(){return{skipConditionals:this.#e,renderTag:this.#c}}*transform(){yield*this.#n(this.#s,{parentNode:null})}*#n(i,t,r=this.#r){if(!(!i||!f(i))){if(T(i)){if(this.#e)return;const s=w(i);s&&s.length>0&&(yield*this.#t(i,{...t,rbacTeams:s},r));return}if(m(i)){yield new n({node:i,content:r([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:r([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#l(i,t,r);return}yield*this.#t(i,t,r)}}*#l(i,t,r=this.#r){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#n(this.#o[s],t,(e,l)=>r(e,{...l,variables:o}));return}N.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,r);return}case"markdoc-example":{const s=r([i],this.#i());yield new n({node:i,content:s,...t});return}case"code-snippet":{const s=u(i,"title"),o=r([i],this.#i());if(s){const e=new p({node:i,content:s,...t});t={...t,parentNode:e},yield e}o&&(yield new n({node:i,content:o,...t}));return}default:{const s=this.#h(i,t,r);if(s){yield*s;return}const o=b.find(c=>c in i.attributes),e=(o&&u(i,o))??"",l=typeof e=="string"?e:r([e]);if(l){const c=new p({node:i,content:l,...t});t={...t,parentNode:c},yield c}if(a(i))yield*this.#t(i,t,r);else{const c=r([i],this.#i());c&&(yield new n({node:i,content:c,...t}))}return}}}#h(i,t,r){const s=()=>a(i)?d([...this.#t(i,t,r)]):"",o=this.#c?.(i,{getBody:s});return o===void 0?void 0:[new n({node:i,content:o.endsWith(`
1
+ import{logger as N}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as T}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as w}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as b,TagNode as p}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class B{#s;#o;#e;#r;#c;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s,renderTag:o}){if(this.#s=i,this.#o=t,this.#e=r,this.#r=s,this.#c=o,!this.#s||!f(this.#s))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#e,renderTag:this.#c,...i}}*transform(){yield*this.#n(this.#s,{parentNode:null})}*#n(i,t,r=this.#r){if(!(!i||!f(i))){if(T(i)){if(this.#e)return;const s=w(i);s&&s.length>0&&(yield*this.#t(i,{...t,rbacTeams:s},r));return}if(m(i)){yield new n({node:i,content:r([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:r([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#l(i,t,r);return}yield*this.#t(i,t,r)}}*#l(i,t,r=this.#r){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#n(this.#o[s],t,(e,l)=>r(e,{...l,variables:o}));return}N.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,r);return}case"markdoc-example":{const s=r([i],this.#i());yield new n({node:i,content:s,...t});return}case"code-snippet":{const s=u(i,"title"),o=r([i],this.#i());if(s){const e=new p({node:i,content:s,...t});t={...t,parentNode:e},yield e}o&&(yield new n({node:i,content:o,...t}));return}default:{const s=this.#h(i,t,r);if(s){yield*s;return}const o=b.find(c=>c in i.attributes),e=(o&&u(i,o))??"",l=typeof e=="string"?e:r([e]);if(l){const c=new p({node:i,content:l,...t});t={...t,parentNode:c},yield c}if(a(i))yield*this.#t(i,t,r);else{const c=r([i],this.#i());c&&(yield new n({node:i,content:c,...t}))}return}}}#h(i,t,r){const s=()=>a(i)?d([...this.#t(i,t,r)]):"",o=this.#c?.(i,{getBody:s});return o===void 0?void 0:[new n({node:i,content:o.endsWith(`
2
2
  `)?o:`${o}
3
3
  `,...t})]}*#t(i,t,r=this.#r){for(const s of[...Object.values(i.slots),...i.children])for(const o of this.#n(s,t,r))o instanceof y&&(t={...t,parentNode:o}),yield o}}function a(h){return h.children.length>0||Object.keys(h.slots).length>0}export{B as AstToSearchNodeTransformer};
@@ -1 +1 @@
1
- const t="execute",_="describe-tools",E="fetch",e=new Set([t,_]),o="tools",O="__fetchBridge",c="fetch";export{e as CODE_MODE_TOOL_NAMES,_ as DESCRIBE_TOOLS_TOOL_NAME,t as EXECUTE_TOOL_NAME,c as FETCH_BRIDGE_FUNCTION_NAME,O as FETCH_BRIDGE_GLOBAL_NAME,E as FETCH_TOOL_NAME,o as TOOLS_BRIDGE_GLOBAL_NAME};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _}from"../constants.js";const E="execute",t="describe-tools",o="fetch",e=new Set([E,t,_]),N="tools",T="__fetchBridge",c="fetch";export{e as CODE_MODE_TOOL_NAMES,t as DESCRIBE_TOOLS_TOOL_NAME,E as EXECUTE_TOOL_NAME,c as FETCH_BRIDGE_FUNCTION_NAME,T as FETCH_BRIDGE_GLOBAL_NAME,o as FETCH_TOOL_NAME,N as TOOLS_BRIDGE_GLOBAL_NAME};
@@ -1 +1 @@
1
- import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const i={title:"Execute code",readOnlyHint:!0,openWorldHint:!1},n={name:e,description:t(!1),annotations:i,schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1}}}};export{i as EXECUTE_BASE_ANNOTATIONS,n as EXECUTE_TOOL_SCHEMA};
1
+ import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const n={title:"Execute code",readOnlyHint:!0,openWorldHint:!1},r={name:e,description:t(!1),annotations:n,schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}}};export{n as EXECUTE_BASE_ANNOTATIONS,r as EXECUTE_TOOL_SCHEMA};
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  execute: McpToolHandler<{
4
4
  code: string;
5
5
  description: string;
6
+ sessionHandle?: string;
6
7
  }>;
7
8
  };
8
9
  export default _default;
@@ -14,4 +14,5 @@ export declare const SSE_KEEPALIVE_INTERVAL_MS = 15000;
14
14
  export declare const MAX_DOCUMENTS_PER_CATEGORY = 3;
15
15
  export declare const MCP_NOT_ALLOWED_TEMPLATE_ID = "mcp-not-allowed";
16
16
  export declare const DEFAULT_DOCS_MCP_SERVER_NAME = "Docs MCP server";
17
+ export declare const CREATE_ANONYMOUS_SESSION_TOOL_NAME = "createAnonymousSession";
17
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- const o={Docs:"docs"},r={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},E="2025-06-18",e=3e4,t=15e3,_=3,s="mcp-not-allowed",c="Docs MCP server";export{e as DEFAULT_CONNECTION_TIMEOUT_MS,c as DEFAULT_DOCS_MCP_SERVER_NAME,_ as MAX_DOCUMENTS_PER_CATEGORY,s as MCP_NOT_ALLOWED_TEMPLATE_ID,E as MCP_PROTOCOL_VERSION,r as McpErrorCodes,o as McpServerType,t as SSE_KEEPALIVE_INTERVAL_MS};
1
+ const o={Docs:"docs"},r={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},E="2025-06-18",e=3e4,t=15e3,_=3,s="mcp-not-allowed",n="Docs MCP server",O="createAnonymousSession";export{O as CREATE_ANONYMOUS_SESSION_TOOL_NAME,e as DEFAULT_CONNECTION_TIMEOUT_MS,n as DEFAULT_DOCS_MCP_SERVER_NAME,_ as MAX_DOCUMENTS_PER_CATEGORY,s as MCP_NOT_ALLOWED_TEMPLATE_ID,E as MCP_PROTOCOL_VERSION,r as McpErrorCodes,o as McpServerType,t as SSE_KEEPALIVE_INTERVAL_MS};
@@ -5,5 +5,6 @@ export declare function getDefaultToolSchemas(config: {
5
5
  requiresLogin: boolean;
6
6
  rbac?: Record<string, unknown>;
7
7
  hasGraphqlApis?: boolean;
8
+ elicitationEnabled?: boolean;
8
9
  }): McpToolSchema[];
9
10
  //# sourceMappingURL=tool-schemas.d.ts.map
@@ -1 +1 @@
1
- import{shouldHandleMcpAuth as m}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as o}from"./tools/graphql/types.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const t={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},d={codemodeType:"OpenApiDocument"},h={codemodeType:"OpenApiOperation & { path: string; method: string }"},y={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}}},a={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}}},g={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:[...p.map(e=>e.toUpperCase()),...p],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},f={type:"object",required:[],additionalProperties:!1,properties:{}};function T(e){const i=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:y,annotations:{title:"List APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:t,version:t,servers:r}}},...n}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{title:"Get Endpoints",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:t,description:t,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:g,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:h,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{title:"Get Security Schemes",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:t,version:t,securitySchemes:l,security:s}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:a,annotations:{title:"Get Full API Description",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:d}}},P(e.products,e.locales)];return m(e.requiresLogin,e.rbac)&&i.push({name:"whoami",description:"Get information about the currently authenticated user",schema:f,annotations:{title:"Who Am I",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&i.push(...L()),i}const b={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema 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 results per page. Default is 300",minimum:1,default:300,nullable:!0}}},S={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:"Optional: return only a single category of schema members",enum:[...o],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},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}}},v={type:"object",required:["name","type"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},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}}},H={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function L(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:b,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:t}}},...n}}},{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), `filter` (member-name substring, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema.',schema:S,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:t,type:{type:"string"},args:{type:"string"}}}},...n}}},{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). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.",schema:v,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{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:H,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function P(e,i){const c=e&&e.length>0,u=i&&i.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},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:i,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{T as getDefaultToolSchemas};
1
+ import{shouldHandleMcpAuth as d}from"../auth/auth-handlers.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as m}from"../constants.js";import{GRAPHQL_TYPE_KINDS as o,GRAPHQL_LIST_SCOPES as h}from"./tools/graphql/constants.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},y={codemodeType:"OpenApiDocument"},f={codemodeType:"OpenApiOperation & { path: string; method: string }"},g={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}}},a={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}}},b={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:[...p.map(e=>e.toUpperCase()),...p],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},S={type:"object",required:[],additionalProperties:!1,properties:{}},v={type:"object",required:[],additionalProperties:!1,properties:{}};function I(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:g,annotations:{title:"List APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i,version:i,servers:r}}},...n}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{title:"Get Endpoints",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:b,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:f,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{title:"Get Security Schemes",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:i,version:i,securitySchemes:l,security:s}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:a,annotations:{title:"Get Full API Description",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:y}}},q(e.products,e.locales)];return d(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:S,annotations:{title:"Who Am I",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...T()),e.elicitationEnabled&&t.push({name:m,description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:v,annotations:{title:"Create anonymous session",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const H={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema 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 results per page. Default is 300",minimum:1,default:300,nullable:!0}}},L={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...o],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...h],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',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},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}}},P={type:"object",required:["name","type"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},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}}},A={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function T(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:H,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i}}},...n}}},{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), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:L,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...n}}},{name:"get-graphql-type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:P,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{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:A,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function q(e,t){const c=e&&e.length>0,u=t&&t.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},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:t,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{I as getDefaultToolSchemas};
@@ -0,0 +1,11 @@
1
+ import type { McpToolContext, McpToolHandler } from '../../../types.js';
2
+ export type CreateAnonymousSessionArgs = Record<string, never>;
3
+ export declare function isAnonymousSessionToolAvailable(context: McpToolContext): boolean;
4
+ declare const _default: {
5
+ createAnonymousSession: {
6
+ execute: McpToolHandler<CreateAnonymousSessionArgs>;
7
+ isAvailable: typeof isAnonymousSessionToolAvailable;
8
+ };
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=create-anonymous-session.d.ts.map
@@ -0,0 +1 @@
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const o=async()=>({content:[{type:"text",text:JSON.stringify({sessionHandle:n()})}],isError:!1});function i(e){return!!e.elicitationEnabled&&!e.user?.isAuthenticated}var a={[t]:{execute:o,isAvailable:i}};export{a as default,i as isAnonymousSessionToolAvailable};
@@ -0,0 +1,4 @@
1
+ export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
2
+ export declare const GRAPHQL_LIST_SCOPES: readonly ['members', 'fields'];
3
+ export declare const FIELD_SCOPE_KINDS: readonly ['objects', 'interfaces', 'inputs'];
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"],e=["members","fields"],t=["objects","interfaces","inputs"];export{t as FIELD_SCOPE_KINDS,e as GRAPHQL_LIST_SCOPES,s as GRAPHQL_TYPE_KINDS};
@@ -1 +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};
1
+ import{FIELD_SCOPE_KINDS as n,GRAPHQL_TYPE_KINDS as u}from"./constants.js";import{respondWithGraphqlSchema as g,paginate as d}from"./tool-helpers.js";import{groupSchemaTypes as h,fieldMembers as y,filterMembersReferencingType as S,matchesFilter as b}from"./utils.js";function T(r,p,t){if(p==="fields"){if(t&&!n.some(e=>e===t))throw new Error(`scope "fields" lists the fields of object, interface, and input types; kind must be ${n.map(e=>`"${e}"`).join(", ")}, or omitted.`);return y(r,t)}const o=h(r);return(t?[t]:u).flatMap(e=>o[e].map(s=>({kind:e,...s})))}const E=(r,p)=>g(r.name,p,({name:t,schema:o})=>{const{kind:e,scope:s="members",filter:f,referencesType:l,page:m=1,limit:a=300}=r;let i=T(o,s,e);return l&&(i=S(o,i,l)),f&&(i=i.filter(c=>b(c,f))),JSON.stringify({name:t,...d(i,m,a)},null,2)});var D={"get-graphql-type-list":E};export{D as default};
@@ -1,7 +1,10 @@
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)
1
+ import{respondWithGraphqlSchema as d}from"./tool-helpers.js";import{printTypeOrField as y,printTypeOrFieldWithReferences as a,referencedTypeManifest as $}from"./utils.js";const m=(r,c)=>d(r.name,c,({name:p,schema:n})=>{const{type:e,includeReferencedTypes:l}=r;if(l){const{sdl:t,referencedCount:s}=a(n,e);return`# Schema: ${p}
2
+ # Type: ${e} (+ ${s} referenced types)
3
3
 
4
- ${o}`}return`# Schema: ${r}
4
+ ${t}`}const o=`# Schema: ${p}
5
5
  # Type: ${e}
6
6
 
7
- ${y(t,e)}`});var m={"get-graphql-type":l};export{m as default};
7
+ ${y(n,e)}`,f=$(n,e);if(f.length===0)return o;const i=["# Referenced types (one level, names only; fetch a type or set includeReferencedTypes for full SDL):",...f.map(t=>`# ${t}`)].join(`
8
+ `);return`${o}
9
+
10
+ ${i}`});var h={"get-graphql-type":m};export{h as default};
@@ -1,10 +1,15 @@
1
- export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
1
+ import type { GRAPHQL_LIST_SCOPES, GRAPHQL_TYPE_KINDS } from './constants.js';
2
2
  export type GraphqlTypeKind = (typeof GRAPHQL_TYPE_KINDS)[number];
3
+ export type GraphqlListScope = (typeof GRAPHQL_LIST_SCOPES)[number];
3
4
  export type SchemaMember = {
4
5
  name: string;
5
6
  description?: string;
6
7
  type?: string;
7
8
  args?: string;
9
+ directives?: string;
10
+ };
11
+ export type SchemaMemberWithKind = SchemaMember & {
12
+ kind: GraphqlTypeKind;
8
13
  };
9
14
  export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
10
15
  export type ListGraphqlApisArgs = {
@@ -15,6 +20,7 @@ export type ListGraphqlApisArgs = {
15
20
  export type GetGraphqlTypeListArgs = {
16
21
  name: string;
17
22
  kind?: GraphqlTypeKind;
23
+ scope?: GraphqlListScope;
18
24
  filter?: string;
19
25
  referencesType?: string;
20
26
  page?: number;
@@ -1 +0,0 @@
1
- const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"];export{s as GRAPHQL_TYPE_KINDS};
@@ -1,14 +1,18 @@
1
1
  import type { GraphQLSchema } from 'graphql';
2
2
  import type { GraphqlDescriptionInfo } from '../../../types.js';
3
- import type { GraphqlTypeKind, GroupedSchemaTypes } from './types.js';
3
+ import type { GraphqlTypeKind, GroupedSchemaTypes, SchemaMember, SchemaMemberWithKind } from './types.js';
4
4
  export declare function findGraphqlSchemaByName(graphqlDescriptions: GraphqlDescriptionInfo[], name: string): GraphqlDescriptionInfo | undefined;
5
5
  export declare function groupSchemaTypes(schema: GraphQLSchema): GroupedSchemaTypes;
6
+ export declare function fieldMembers(schema: GraphQLSchema, kind?: GraphqlTypeKind): SchemaMemberWithKind[];
7
+ /** Case-insensitive substring match against the member's name or description. */
8
+ export declare function matchesFilter(member: SchemaMember, filter: string): boolean;
6
9
  export declare function filterMembersReferencingType<T extends {
7
10
  kind: GraphqlTypeKind;
8
11
  name: string;
9
12
  }>(schema: GraphQLSchema, members: T[], targetName: string): T[];
10
13
  export declare function referencedTypeClosure(schema: GraphQLSchema, name: string): string[];
11
14
  export declare function printTypeOrField(schema: GraphQLSchema, name: string): string;
15
+ export declare function referencedTypeManifest(schema: GraphQLSchema, name: string): string[];
12
16
  export declare function printTypeOrFieldWithReferences(schema: GraphQLSchema, name: string): {
13
17
  sdl: string;
14
18
  referencedCount: number;
@@ -1,3 +1,5 @@
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(`
1
+ import{getNamedType as u,isEnumType as j,isInputObjectType as d,isInterfaceType as p,isIntrospectionType as l,isObjectType as g,isScalarType as y,isSpecifiedScalarType as v,isUnionType as T,print as a,printType as L,specifiedDirectives as I}from"graphql";const D=new Set(["queries","mutations","subscriptions"]);function w(e){return e.toLowerCase().split(/[^a-z0-9_]+/).filter(Boolean)}function V(e,n){const t=n.toLowerCase(),r=e.find(s=>s.name.toLowerCase().includes(t));if(r)return r;const i=new Set(w(t));let o,f=0;for(const s of e){const c=w(s.name);c.length>f&&c.every(k=>i.has(k))&&(o=s,f=c.length)}return o}function m(e,n){return e.getQueryType()?.getFields()[n]??e.getMutationType()?.getFields()[n]??e.getSubscriptionType()?.getFields()[n]}function N(e){return[u(e.type).name,...(e.args??[]).map(n=>u(n.type).name)]}function S(e){const n=new Set;if(g(e)||p(e)){for(const t of Object.values(e.getFields())){n.add(u(t.type).name);for(const r of t.args)n.add(u(r.type).name)}for(const t of e.getInterfaces())n.add(t.name)}else if(T(e))for(const t of e.getTypes())n.add(t.name);else if(d(e))for(const t of Object.values(e.getFields()))n.add(u(t.type).name);return n}function O(e){return new Set([e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(n=>!!n).map(n=>n.name))}function A(e){const n=O(e),t={queries:b(e.getQueryType()),mutations:b(e.getMutationType()),subscriptions:b(e.getSubscriptionType()),objects:[],interfaces:[],unions:[],enums:[],inputs:[],scalars:[],directives:[]};for(const i of Object.values(e.getTypeMap())){if(l(i)||n.has(i.name))continue;const o=$(i);o&&t[o].push({name:i.name,description:i.description??void 0})}const r=new Set(I.map(i=>i.name));return t.directives=e.getDirectives().filter(i=>!r.has(i.name)).map(i=>({name:i.name,description:i.description??void 0})),t}function $(e){if(y(e))return v(e)?void 0:"scalars";if(g(e))return"objects";if(p(e))return"interfaces";if(T(e))return"unions";if(j(e))return"enums";if(d(e))return"inputs"}function F(e){return g(e)||p(e)||d(e)?e:void 0}function x(e){const n=e.astNode?.directives;return n?.length?n.map(t=>a(t)).join(" "):void 0}function b(e){return e?Object.values(e.getFields()).map(n=>({name:n.name,description:n.description??void 0,type:n.type.toString(),args:n.args.length?`(${n.args.map(t=>{const r=t.astNode?.defaultValue?` = ${a(t.astNode.defaultValue)}`:"";return`${t.name}: ${t.type}${r}`}).join(", ")})`:void 0,directives:x(n)})):[]}function G(e,n){const t=O(e),r=[];for(const i of Object.values(e.getTypeMap())){if(l(i)||t.has(i.name))continue;const o=F(i);if(!o)continue;const f=$(o);if(!(!f||n&&n!==f))for(const s of Object.values(o.getFields()))r.push({kind:f,name:`${o.name}.${s.name}`,description:s.description??void 0,type:s.type.toString(),directives:x(s)})}return r}function K(e,n){const t=n.toLowerCase();return e.name.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}function R(e,n){const t=n.indexOf(".");return t===-1?void 0:F(e.getType(n.slice(0,t)))?.getFields()[n.slice(t+1)]}function _(e,n,t){const r=B(e,t);if(!r)return[];const i=new Set([r,...q(e,r)]);return n.filter(o=>{if(o.name.includes(".")){const s=R(e,o.name);return s?N(s).some(c=>i.has(c)):!1}if(!D.has(o.kind))return i.has(o.name);const f=m(e,o.name);return f?N(f).some(s=>i.has(s)):!1})}function z(e,n){const t=new Set,r=[...M(e,n)];for(let i=0;i<r.length;i+=1){const o=r[i];if(t.has(o))continue;t.add(o);const f=e.getType(o);if(f)for(const s of S(f))t.has(s)||r.push(s)}return[...t].filter(i=>i!==n&&h(e,i))}function M(e,n){const t=e.getType(n);if(t)return S(t);const r=m(e,n);if(r)return new Set(N(r));const i=e.getDirective(n);return i?new Set(i.args.map(o=>u(o.type).name)):new Set}function q(e,n){const t=new Map;for(const o of Object.values(e.getTypeMap()))if(!l(o))for(const f of S(o)){let s=t.get(f);s||(s=new Set,t.set(f,s)),s.add(o.name)}const r=new Set,i=[n];for(let o=0;o<i.length;o+=1)for(const f of t.get(i[o])??[])r.has(f)||(r.add(f),i.push(f));return r}function B(e,n){const t=n.toLowerCase();return Object.keys(e.getTypeMap()).find(r=>r.toLowerCase()===t)}function h(e,n){const t=e.getType(n);return!t||l(t)?!1:!(y(t)&&v(t))}function C(e){return e.astNode?[e.astNode,...e.extensionASTNodes??[]].map(n=>a(n)).join(`
2
2
 
3
- `),referencedCount:i.length}}export{q as filterMembersReferencingType,C as findGraphqlSchemaByName,$ as groupSchemaTypes,I as printTypeOrField,L as printTypeOrFieldWithReferences,F as referencedTypeClosure};
3
+ `):L(e)}function Q(e,n){const t=e.getType(n);if(t)return C(t);const r=m(e,n);if(r?.astNode)return a(r.astNode);const i=e.getDirective(n);if(i?.astNode)return a(i.astNode);throw new Error(`No GraphQL type, operation, or directive named "${n}" found.`)}function P(e,n){const t=[];for(const r of M(e,n)){if(r===n||!h(e,r))continue;const i=e.getType(r);g(i)?t.push(`type ${r} { ${Object.keys(i.getFields()).join(", ")} }`):p(i)?t.push(`interface ${r} { ${Object.keys(i.getFields()).join(", ")} }`):d(i)?t.push(`input ${r} { ${Object.keys(i.getFields()).join(", ")} }`):j(i)?t.push(`enum ${r} { ${i.getValues().map(o=>o.name).join(", ")} }`):T(i)?t.push(`union ${r} = ${i.getTypes().map(o=>o.name).join(" | ")}`):y(i)&&t.push(`scalar ${r}`)}return t}function U(e,n){const t=Q(e,n),r=z(e,n).map(i=>e.getType(i)).filter(i=>!!i).map(i=>C(i));return{sdl:[t,...r].join(`
4
+
5
+ `),referencedCount:r.length}}export{G as fieldMembers,_ as filterMembersReferencingType,V as findGraphqlSchemaByName,A as groupSchemaTypes,K as matchesFilter,Q as printTypeOrField,U as printTypeOrFieldWithReferences,z as referencedTypeClosure,P as referencedTypeManifest};
@@ -1,4 +1,8 @@
1
1
  declare const _default: {
2
+ createAnonymousSession: {
3
+ execute: import("../../types.js").McpToolHandler<import("./core/create-anonymous-session.js").CreateAnonymousSessionArgs>;
4
+ isAvailable: typeof import("./core/create-anonymous-session.js").isAnonymousSessionToolAvailable;
5
+ };
2
6
  'list-apis': import("../../types.js").McpToolHandler<import("./openapi/types.js").ListApisArgs>;
3
7
  'get-endpoints': import("../../types.js").McpToolHandler<import("./openapi/types.js").ApiNameVersionArgs>;
4
8
  'get-endpoint-info': import("../../types.js").McpToolHandler<import("./openapi/types.js").GetEndpointInfoArgs>;
@@ -1 +1 @@
1
- import r from"./openapi/list-apis.js";import o from"./openapi/get-endpoints.js";import t from"./openapi/get-endpoint-info.js";import m from"./openapi/get-security-schemes.js";import p from"./openapi/get-full-api-description.js";import i from"./core/search.js";import e from"./core/whoami.js";import f from"./graphql/list-graphql-apis.js";import l from"./graphql/get-graphql-type-list.js";import s from"./graphql/get-graphql-type.js";import a from"./graphql/get-graphql-schema.js";var E={...r,...o,...t,...m,...p,...i,...e,...f,...l,...s,...a};export{E as default};
1
+ import o from"./openapi/list-apis.js";import r from"./openapi/get-endpoints.js";import t from"./openapi/get-endpoint-info.js";import m from"./openapi/get-security-schemes.js";import i from"./openapi/get-full-api-description.js";import p from"./core/search.js";import e from"./core/whoami.js";import f from"./core/create-anonymous-session.js";import s from"./graphql/list-graphql-apis.js";import a from"./graphql/get-graphql-type-list.js";import l from"./graphql/get-graphql-type.js";import n from"./graphql/get-graphql-schema.js";var w={...o,...r,...t,...m,...i,...p,...e,...f,...s,...a,...l,...n};export{w as default};
@@ -1,4 +1,4 @@
1
- import type { OpenAPIDefinition } from '@redocly/openapi-docs';
1
+ import type { OpenAPIDefinition } from '@redocly/api-docs';
2
2
  import type { McpToolContext } from '../../../types.js';
3
3
  export declare function loadApiDescription(name: string, context: McpToolContext, version?: string): Promise<OpenAPIDefinition>;
4
4
  //# sourceMappingURL=load-api-description.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { OpenAPIDefinition, OpenAPIOperation } from '@redocly/openapi-docs';
1
+ import type { OpenAPIDefinition, OpenAPIOperation } from '@redocly/api-docs';
2
2
  import type { ApiFunctionsUser, RbacConfig } from '@redocly/config';
3
3
  import type { McpEndpoint } from '../../../types';
4
4
  export declare function isMcpEndpoint(value: unknown): value is McpEndpoint;
@@ -1,4 +1,4 @@
1
- import type { OpenAPISchema, OpenAPIParameter, OpenAPIResponse, OpenAPIRequestBody, Referenced, OpenAPIDefinition } from '@redocly/openapi-docs/lib/types/open-api.js';
1
+ import type { OpenAPISchema, OpenAPIParameter, OpenAPIResponse, OpenAPIRequestBody, Referenced, OpenAPIDefinition } from '@redocly/api-docs';
2
2
  import type { ApiDescriptionInfo } from '../types.js';
3
3
  export declare function findApiDescriptionByNameAndVersion(apiDescriptionsMap: Record<string, ApiDescriptionInfo>, name: string, version?: string): ApiDescriptionInfo | undefined;
4
4
  export declare function filterApiDescriptionsByName(apiDescriptionsMap: ApiDescriptionInfo[], filter: string): ApiDescriptionInfo[];
@@ -15,10 +15,10 @@ export type ElicitationOutcome = {
15
15
  } | {
16
16
  status: 'skipped';
17
17
  };
18
- export declare function runUpstreamCredentialElicitation({ sendRequest, clientSupportsElicitation, sessionId, baseUrl, events, auth, kv, }: {
18
+ export declare function runUpstreamCredentialElicitation({ sendRequest, clientSupportsElicitation, subject, baseUrl, events, auth, kv, }: {
19
19
  sendRequest: SendElicitRequest;
20
20
  clientSupportsElicitation: boolean;
21
- sessionId: string;
21
+ subject: string;
22
22
  baseUrl: string;
23
23
  events: UpstreamAuthRequiredEvent[];
24
24
  auth: UpstreamAuthScheme;
@@ -1,2 +1,2 @@
1
- import{ElicitResultSchema as d}from"@redocly/mcp-typescript-sdk/types.js";import{logger as p}from"../../../tools/notifiers/logger.js";import{secretStore as h,ELICITATION_TTL_MS as f}from"./secret-store.js";const g=3e5;async function $({sendRequest:e,clientSupportsElicitation:t,sessionId:r,baseUrl:a,events:n,auth:o,kv:s}){const c=n[0],u=await h.createElicitation(s,{sessionId:r,api:c.api,name:c.name,auth:o}),l=T(a,u);if(!t)return{status:"fallback",text:m(n,l)};try{return(await e({method:"elicitation/create",params:{mode:"url",message:`The "${c.name}" API requires credentials. Open the link to provide them securely; they never pass through the chat.`,url:l,elicitationId:u}},d,{timeout:g})).action==="accept"?{status:"accepted"}:{status:"skipped"}}catch(i){return p.warn(`URL-mode elicitation failed, falling back to markdown link: ${i instanceof Error?i.message:String(i)}`),{status:"fallback",text:m(n,l)}}}function T(e,t){if(!e)return`/mcp/credentials?token=${t}`;try{const r=new URL("/mcp/credentials",e);return r.searchParams.set("token",t),r.toString()}catch{return`${e}/mcp/credentials?token=${t}`}}function m(e,t){const[r,...a]=e,n=[`The upstream API "${r.name}" returned 401 Unauthorized.`,"",`**Action required: show the user the link below and ask them to open it in a browser to provide the API credentials (valid ${Math.round(f/6e4)} minutes):**`,"",t,"","Then call this tool again - the credentials are applied server-side and never appear in the conversation."];if(a.length>0){const o=a.map(s=>`"${s.name}"`).join(", ");n.push("",`The remaining APIs (${o}) will prompt for credentials on subsequent calls.`)}return n.join(`
2
- `)}export{g as ELICITATION_TIMEOUT_MS,$ as runUpstreamCredentialElicitation};
1
+ import{ElicitResultSchema as p}from"@redocly/mcp-typescript-sdk/types.js";import{logger as f}from"../../../tools/notifiers/logger.js";import{secretStore as g,ELICITATION_TTL_MS as T}from"./secret-store.js";import{ANONYMOUS_SUBJECT_PREFIX as h}from"./subject.js";const I=3e5;async function A({sendRequest:t,clientSupportsElicitation:n,subject:e,baseUrl:s,events:r,auth:a,kv:c}){const i=e.startsWith(h)?e.slice(h.length):void 0,l=r[0],u=await g.createElicitation(c,{subject:e,api:l.api,name:l.name,auth:a}),d=k(s,u);if(!n)return{status:"fallback",text:m(r,d,i)};try{return(await t({method:"elicitation/create",params:{mode:"url",message:`The "${l.name}" API requires credentials. Open the link to provide them securely; they never pass through the chat.`,url:d,elicitationId:u}},p,{timeout:I})).action==="accept"?{status:"accepted"}:{status:"skipped"}}catch(o){return f.warn(`URL-mode elicitation failed, falling back to markdown link: ${o instanceof Error?o.message:String(o)}`),{status:"fallback",text:m(r,d,i)}}}function k(t,n){if(!t)return`/mcp/credentials?token=${n}`;try{const e=new URL("/mcp/credentials",t);return e.searchParams.set("token",n),e.toString()}catch{return`${t}/mcp/credentials?token=${n}`}}function m(t,n,e){const[s,...r]=t,a=[`The upstream API "${s.name}" returned 401 Unauthorized.`,"",`**Action required: show the user the link below and ask them to open it in a browser to provide the API credentials (valid ${Math.round(T/6e4)} minutes):**`,"",n,"",e?`Then call this tool again with sessionHandle: "${e}" - the credentials are stored against that handle, applied server-side, and never appear in the conversation.`:"Then call this tool again - the credentials are applied server-side and never appear in the conversation."];if(r.length>0){const c=r.map(i=>`"${i.name}"`).join(", ");a.push("",`The remaining APIs (${c}) will prompt for credentials on subsequent calls.`)}return a.join(`
2
+ `)}export{I as ELICITATION_TIMEOUT_MS,A as runUpstreamCredentialElicitation};
@@ -1,5 +1,4 @@
1
- import type { OpenAPIDefinition } from '@redocly/openapi-docs';
2
- import type { OpenAPIMcp } from '@redocly/openapi-docs/lib/types/open-api.js';
1
+ import type { OpenAPIDefinition, OpenAPIMcp } from '@redocly/api-docs';
3
2
  import type { RbacConfig, RedoclyConfig } from '@redocly/config';
4
3
  /** Whether the gateway fetch capability is on: the feature flag plus none of mcp/docs hidden. */
5
4
  export declare function isGatewayCapabilityEnabled(mcp?: RedoclyConfig['mcp']): boolean;
@@ -1,4 +1,4 @@
1
- import type { OpenAPIServer } from '@redocly/openapi-docs/lib/types/open-api.js';
1
+ import type { OpenAPIServer } from '@redocly/api-docs';
2
2
  /**
3
3
  * Build case-insensitive host matchers from an API's server URL templates. A server URL host
4
4
  * may contain server-variable placeholders (e.g. a tenant `{subdomain}`); each placeholder
@@ -6,16 +6,16 @@ export type StoredSecret = {
6
6
  value: string;
7
7
  };
8
8
  export type ElicitationTarget = {
9
- sessionId: string;
9
+ subject: string;
10
10
  api: string;
11
11
  name: string;
12
12
  auth: UpstreamAuthScheme;
13
13
  };
14
14
  export declare class SecretStore {
15
15
  #private;
16
- setSecret(kv: KvService, sessionId: string, api: string, secret: StoredSecret): Promise<void>;
17
- getSecretsForSession(kv: KvService, sessionId: string): Promise<Record<string, StoredSecret>>;
18
- deleteSession(kv: KvService, sessionId: string): Promise<void>;
16
+ setSecret(kv: KvService, subject: string, api: string, secret: StoredSecret): Promise<void>;
17
+ getSecretsForSubject(kv: KvService, subject: string): Promise<Record<string, StoredSecret>>;
18
+ deleteSubject(kv: KvService, subject: string): Promise<void>;
19
19
  createElicitation(kv: KvService, target: ElicitationTarget): Promise<string>;
20
20
  peekElicitation(kv: KvService, token: string): Promise<ElicitationTarget | undefined>;
21
21
  consumeElicitation(kv: KvService, token: string): Promise<ElicitationTarget | undefined>;