@redocly/revel 0.141.0-next.4 → 0.141.0-next.6

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 (39) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/client/App.js +1 -1
  3. package/dist/client/app/webmcp/tools/shared.d.ts +2 -3
  4. package/dist/client/app/webmcp/tools/shared.js +1 -1
  5. package/dist/constants/l10n/langs/ar.js +1 -1
  6. package/dist/constants/l10n/langs/de.js +1 -1
  7. package/dist/constants/l10n/langs/en.js +1 -1
  8. package/dist/constants/l10n/langs/es.js +1 -1
  9. package/dist/constants/l10n/langs/fr.js +1 -1
  10. package/dist/constants/l10n/langs/hi.js +1 -1
  11. package/dist/constants/l10n/langs/it.js +1 -1
  12. package/dist/constants/l10n/langs/ja.js +1 -1
  13. package/dist/constants/l10n/langs/ko.js +1 -1
  14. package/dist/constants/l10n/langs/pl.js +1 -1
  15. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  16. package/dist/constants/l10n/langs/pt.js +1 -1
  17. package/dist/constants/l10n/langs/ru.js +1 -1
  18. package/dist/constants/l10n/langs/uk.js +1 -1
  19. package/dist/constants/l10n/langs/zh.js +1 -1
  20. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  21. package/dist/server/fs/fs.js +1 -1
  22. package/dist/server/plugins/api-docs/index.js +1 -1
  23. package/dist/server/plugins/api-docs/options.js +1 -1
  24. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +9 -9
  25. package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
  26. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -1
  27. package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -1
  28. package/dist/server/plugins/search/llmstxt/index.js +4 -4
  29. package/dist/server/types/plugins/common.d.ts +2 -0
  30. package/dist/server/types/web-server.d.ts +5 -0
  31. package/dist/server/utils/llmstxt/resolve-llms-txt-md.d.ts +5 -0
  32. package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -1
  33. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  34. package/dist/server/web-server/routes/index.js +1 -1
  35. package/dist/server/web-server/routes/page-data.d.ts +2 -1
  36. package/dist/server/web-server/routes/page-data.js +1 -1
  37. package/package.json +7 -7
  38. package/dist/server/utils/llmstxt/get-llms-txt-md-path-by-slug.d.ts +0 -19
  39. package/dist/server/utils/llmstxt/get-llms-txt-md-path-by-slug.js +0 -1
@@ -1 +1 @@
1
- import m from"path";import{realpath as G}from"fs/promises";import{REDOCLY_ROUTE_RBAC as z,REDOCLY_TEAMS_RBAC as j}from"@redocly/config";import{combineUrls as V,withoutPathPrefix as ie,withPathPrefix as R}from"@redocly/theme/core/utils";import{CACHE_CONTROL_NO_STORE_HEADER_VALUE as W,CACHE_CONTROL_PUBLIC_HTML as ae,DEFAULT_IMMUTABLE_CACHE_MAX_AGE as se,DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ce,PAGE_DATA_FOLDER as le,PUBLIC_API_DEFINITIONS_FOLDER as me,PUBLIC_ASSETS_FOLDER as ue,STATIC_DATA_FOLDER as de,X_REDOCLY_CACHE_CONTROL_HEADER as fe,X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML as ge}from"../../constants/common.js";import{removeTrailingSlash as Z}from"../../../utils/url/remove-trailing-slash.js";import{findInIterable as pe}from"../../../utils/collection/find-in-iterable.js";import{sanitizeRedirectPathname as he}from"../../../utils/url/sanitize-redirect-pathname.js";import{envConfig as Re}from"../../config/env-config.js";import{addLeadingSlash as Ae}from"../../../utils/url/add-leading-slash.js";import{isPathInFolder as D}from"../../../utils/path/is-path-in-folder.js";import{getLlmsTxtMdPathBySlug as Ee}from"../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{resolveLlmsTxtMd as J}from"../../utils/llmstxt/resolve-llms-txt-md.js";import{removeLeadingSlash as I}from"../../../utils/url/remove-leading-slash.js";import{decodeRequestPath as Ce}from"../../utils/decode-request-path.js";import{AI_INDEX_EXPORT_FOLDER as _e,SEARCH_DATA_EXPORT_FOLDER as Le}from"../../constants/plugins/search.js";import{processRedirects as Te}from"./helpers/process-redirects.js";import{renderPage as Pe,getServerProps as Oe}from"../../ssr/index.js";import{canAccessAsset as we,canAccessResource as K}from"../../utils/rbac.js";import{handleErrorPageRender as A,handleUnauthorized as Q,handleUnauthorizedAsset as x}from"../utils.js";import{DEFAULT_MAX_AGE_FOR_MIME_TYPE as De,MIME_TYPES as Ie}from"../mime-types.js";import{fileExistsAsync as Se}from"../../utils/index.js";import{isAiAgentRequest as ye}from"../../utils/ai-agent-detection.js";import{getRedirectRoute as Ue}from"../utils/legacy-openapi-redirects.js";import{getContentTypeHeaderValue as ee}from"../utils/content-type.js";import{telemetry as be}from"../../../cli/telemetry/index.js";import{telemetry as Me}from"../../telemetry/index.js";const Fe=[Le,_e,de,I(me),I(ce),le];async function qe(e,E){try{const[C,u]=await Promise.all([G(e),G(E)]);return Fe.some(t=>D(C,m.join(u,t)))}catch{return!1}}function mt(e,E,C,u){return async t=>{const S=t.get("logger"),i=t.req,c=new URL(i.url),_=c.pathname.replace(/\/{2,}/g,"/"),y=Ce(_);if(y===void 0)return t.text("Bad Request",400);const d=Re.isProductionEnv?301:302;if(_!==c.pathname)return t.newResponse(null,d,{Location:_+c.search});const r=ie(y),U=m.parse(r).ext.toLowerCase()===".md",b=ye({accept:i.header("accept"),signatureAgent:i.header("signature-agent"),signature:i.header("signature"),signatureInput:i.header("signature-input"),userAgent:i.header("user-agent")}),a=Ae(Z(r)),o=(i.method==="GET"||i.method==="HEAD")&&!U?e.getRouteBySlug(a,{followRedirect:!1})||pe(e.routesBySlug?.values(),n=>n.hasClientRoutes&&(r===n.slug||r.startsWith(n.slug+"/"))):void 0,M=e.getRedirect(a);if(M){const n=Te({redirect:M,reqUrlSearch:c.search});return Me.sendRedirectMessage([{id:a,object:"redirect",uri:`urn:redocly:realm:api:redirect:${a}`,from:a,templateId:n.type.toString()}]),t.newResponse(null,n.type,{Location:n.location})}if(o?.metadata?.type==="openapi"){const n=Ue(c.pathname);if(n)return S.info("Legacy OpenAPI docs redirect from "+c.pathname),t.newResponse(null,d,{Location:encodeURI(n)});if(r.match(/[A-Z]/))return S.warn("Redirect to lowercase route to avoid 404 error"),t.newResponse(null,d,{Location:encodeURI(R(r.toLowerCase()))})}if(r.endsWith("/")&&r!=="/"){const n=he(new URL(a||"/",t.req.url).pathname);return t.newResponse(null,d,{Location:R((n==="/"?"/":Z(n))+c.search)})}const{isAuthenticated:f,teams:L,claims:{email:T}}=t.get("auth");if(o&&!K(o,{isAuthenticated:f,email:T,teams:L},e.config.access?.rbac,e.config.access?.requiresLogin))return f?A(t,e,{slug:o.slug,[j]:o[j],[z]:o[z]},403):Q(t,e,o.slug);const g=o&&b?Ee(o.slug):void 0,F=g?await J(g,e,u):void 0,P=F?.exists??!1;if(o&&(!b||!P)){const n=await E(o),N=await Oe(o,t,n,e),{html:ne,statusCode:X,error:oe}=await Pe(o,N,t,e,be),Y=e.config.access?.rbac,$=!e.config.access?.requiresLogin&&(!Y||!Object.keys(Y).length),k=X>=400||!!oe||!!e.compilationErrors?.length,re=$&&!k;let h;return k?h=W:$?h=ae:h="private",t.html(ne,X,{"Cache-Control":h,...re&&{[fe]:ge}})}const p=g&&P?g:r,te=I(p),s=m.resolve(e.outdir,te);if(!D(s,e.outdir))return x(t);const q=U?await J(r,e,u):void 0,l=q?.route;if(l&&!K(l,{isAuthenticated:f,email:T,teams:L},e.config.access?.rbac,e.config.access?.requiresLogin))return Q(t,e,r);if(!P&&!l){if(await qe(s,e.outdir))return A(t,e,{slug:a},404);const n=e.getGlobalConfig("access");if(!we(p,n?.rbac||{},n?.requiresLogin||!1,e.getGlobalConfig("directoryPaths"),{isAuthenticated:f,email:T,teams:L}))return D(p,ue)?x(t):A(t,e,{slug:a},404)}const O=Ie[m.extname(s)]||"text/plain",w=s.match(/assets\/.*\.[a-f0-9]{8,}\..+/)||s.match(/runtime\/chunks\/.*/)?se:De[O],H=w?{"Cache-Control":`public, max-age=${w}, immutable`,Expires:new Date(Date.now()+w*1e3).toUTCString()}:{"Cache-Control":W},B=i.query("download")!=null,v=F?.content??q?.content;if(v!==void 0)return t.newResponse(v,200,{"Content-Type":ee(O),"Access-Control-Allow-Origin":"*",...H,...l&&{"X-Robots-Tag":"noindex, follow",...e.config.seo?.siteUrl&&{Link:`<${V(e.config.seo.siteUrl,R(l.slug))}>; rel="canonical"`}},...B&&{"Content-Disposition":`attachment; filename="${m.basename(p)}"`}});if(await Se(s)){const n=await C(s);return t.newResponse(n,200,{"Content-Type":ee(O),"Access-Control-Allow-Origin":"*",...H,...l&&{"X-Robots-Tag":"noindex, follow",...e.config.seo?.siteUrl&&{Link:`<${V(e.config.seo.siteUrl,R(l.slug))}>; rel="canonical"`}},...B&&{"Content-Disposition":`attachment; filename="${m.basename(s)}"`}})}else return A(t,e,{slug:a},404)}}export{mt as dynamicRouteHandler};
1
+ import m from"path";import{realpath as z}from"fs/promises";import{REDOCLY_ROUTE_RBAC as G,REDOCLY_TEAMS_RBAC as j}from"@redocly/config";import{combineUrls as V,getMarkdownCopyPath as ae,withoutPathPrefix as se,withPathPrefix as R}from"@redocly/theme/core/utils";import{CACHE_CONTROL_NO_STORE_HEADER_VALUE as W,CACHE_CONTROL_PUBLIC_HTML as ce,DEFAULT_IMMUTABLE_CACHE_MAX_AGE as le,DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as me,PAGE_DATA_FOLDER as ue,PUBLIC_API_DEFINITIONS_FOLDER as de,PUBLIC_ASSETS_FOLDER as fe,STATIC_DATA_FOLDER as ge,X_REDOCLY_CACHE_CONTROL_HEADER as pe,X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML as he}from"../../constants/common.js";import{removeTrailingSlash as Z}from"../../../utils/url/remove-trailing-slash.js";import{findInIterable as Re}from"../../../utils/collection/find-in-iterable.js";import{sanitizeRedirectPathname as Ae}from"../../../utils/url/sanitize-redirect-pathname.js";import{envConfig as Ee}from"../../config/env-config.js";import{addLeadingSlash as Ce}from"../../../utils/url/add-leading-slash.js";import{isPathInFolder as I}from"../../../utils/path/is-path-in-folder.js";import{resolveLlmsTxtMd as J,resolvePageMarkdownUrl as _e}from"../../utils/llmstxt/resolve-llms-txt-md.js";import{removeLeadingSlash as U}from"../../../utils/url/remove-leading-slash.js";import{decodeRequestPath as Le}from"../../utils/decode-request-path.js";import{AI_INDEX_EXPORT_FOLDER as we,SEARCH_DATA_EXPORT_FOLDER as Pe}from"../../constants/plugins/search.js";import{processRedirects as Te}from"./helpers/process-redirects.js";import{renderPage as Oe,getServerProps as De}from"../../ssr/index.js";import{canAccessAsset as Ie,canAccessResource as K}from"../../utils/rbac.js";import{handleErrorPageRender as A,handleUnauthorized as Q,handleUnauthorizedAsset as x}from"../utils.js";import{DEFAULT_MAX_AGE_FOR_MIME_TYPE as Ue,MIME_TYPES as Se}from"../mime-types.js";import{fileExistsAsync as ye}from"../../utils/index.js";import{isAiAgentRequest as Me}from"../../utils/ai-agent-detection.js";import{getRedirectRoute as be}from"../utils/legacy-openapi-redirects.js";import{getContentTypeHeaderValue as ee}from"../utils/content-type.js";import{telemetry as Fe}from"../../../cli/telemetry/index.js";import{telemetry as qe}from"../../telemetry/index.js";const He=[Pe,we,ge,U(de),U(me),ue];async function ve(e,E){try{const[C,u]=await Promise.all([z(e),z(E)]);return He.some(n=>I(C,m.join(u,n)))}catch{return!1}}function dn(e,E,C,u){return async n=>{const S=n.get("logger"),a=n.req,c=new URL(a.url),_=c.pathname.replace(/\/{2,}/g,"/"),y=Le(_);if(y===void 0)return n.text("Bad Request",400);const d=Ee.isProductionEnv?301:302;if(_!==c.pathname)return n.newResponse(null,d,{Location:_+c.search});const r=se(y),M=m.parse(r).ext.toLowerCase()===".md",b=Me({accept:a.header("accept"),signatureAgent:a.header("signature-agent"),signature:a.header("signature"),signatureInput:a.header("signature-input"),userAgent:a.header("user-agent")}),i=Ce(Z(r)),o=(a.method==="GET"||a.method==="HEAD")&&!M?e.getRouteBySlug(i,{followRedirect:!1})||Re(e.routesBySlug?.values(),t=>t.hasClientRoutes&&(r===t.slug||r.startsWith(t.slug+"/"))):void 0,F=e.getRedirect(i);if(F){const t=Te({redirect:F,reqUrlSearch:c.search});return qe.sendRedirectMessage([{id:i,object:"redirect",uri:`urn:redocly:realm:api:redirect:${i}`,from:i,templateId:t.type.toString()}]),n.newResponse(null,t.type,{Location:t.location})}if(o?.metadata?.type==="openapi"){const t=be(c.pathname);if(t)return S.info("Legacy OpenAPI docs redirect from "+c.pathname),n.newResponse(null,d,{Location:encodeURI(t)});if(r.match(/[A-Z]/))return S.warn("Redirect to lowercase route to avoid 404 error"),n.newResponse(null,d,{Location:encodeURI(R(r.toLowerCase()))})}if(r.endsWith("/")&&r!=="/"){const t=Ae(new URL(i||"/",n.req.url).pathname);return n.newResponse(null,d,{Location:R((t==="/"?"/":Z(t))+c.search)})}const{isAuthenticated:f,teams:L,claims:{email:w}}=n.get("auth");if(o&&!K(o,{isAuthenticated:f,email:w,teams:L},e.config.access?.rbac,e.config.access?.requiresLogin))return f?A(n,e,{slug:o.slug,[j]:o[j],[G]:o[G]},403):Q(n,e,o.slug);const g=o&&b?ae(i):void 0,q=g?await J(g,e,u):void 0,P=q?.exists??!1;if(o&&(!b||!P)){const t=await E(o),D=await _e(i,e,u),te={...await De(o,n,t,e),...D?{markdownUrl:D}:{}},{html:oe,statusCode:X,error:re}=await Oe(o,te,n,e,Fe),k=e.config.access?.rbac,Y=!e.config.access?.requiresLogin&&(!k||!Object.keys(k).length),$=X>=400||!!re||!!e.compilationErrors?.length,ie=Y&&!$;let h;return $?h=W:Y?h=ce:h="private",n.html(oe,X,{"Cache-Control":h,...ie&&{[pe]:he}})}const p=g&&P?g:r,ne=U(p),s=m.resolve(e.outdir,ne);if(!I(s,e.outdir))return x(n);const H=M?await J(r,e,u):void 0,l=H?.route;if(l&&!K(l,{isAuthenticated:f,email:w,teams:L},e.config.access?.rbac,e.config.access?.requiresLogin))return Q(n,e,r);if(!P&&!l){if(await ve(s,e.outdir))return A(n,e,{slug:i},404);const t=e.getGlobalConfig("access");if(!Ie(p,t?.rbac||{},t?.requiresLogin||!1,e.getGlobalConfig("directoryPaths"),{isAuthenticated:f,email:w,teams:L}))return I(p,fe)?x(n):A(n,e,{slug:i},404)}const T=Se[m.extname(s)]||"text/plain",O=s.match(/assets\/.*\.[a-f0-9]{8,}\..+/)||s.match(/runtime\/chunks\/.*/)?le:Ue[T],v=O?{"Cache-Control":`public, max-age=${O}, immutable`,Expires:new Date(Date.now()+O*1e3).toUTCString()}:{"Cache-Control":W},B=a.query("download")!=null,N=q?.content??H?.content;if(N!==void 0)return n.newResponse(N,200,{"Content-Type":ee(T),"Access-Control-Allow-Origin":"*",...v,...l&&{"X-Robots-Tag":"noindex, follow",...e.config.seo?.siteUrl&&{Link:`<${V(e.config.seo.siteUrl,R(l.slug))}>; rel="canonical"`}},...B&&{"Content-Disposition":`attachment; filename="${m.basename(p)}"`}});if(await ye(s)){const t=await C(s);return n.newResponse(t,200,{"Content-Type":ee(T),"Access-Control-Allow-Origin":"*",...v,...l&&{"X-Robots-Tag":"noindex, follow",...e.config.seo?.siteUrl&&{Link:`<${V(e.config.seo.siteUrl,R(l.slug))}>; rel="canonical"`}},...B&&{"Content-Disposition":`attachment; filename="${m.basename(s)}"`}})}else return A(n,e,{slug:i},404)}}export{dn as dynamicRouteHandler};
@@ -1 +1 @@
1
- import{serveStatic as c}from"hono/serve-static";import{withPathPrefix as i,withoutPathPrefix as H}from"@redocly/theme/core/utils";import{ServerRoutes as l}from"../../../constants/api.js";import{LLMS_TXT_FILE_NAME as L,PUBLIC_STATIC_FOLDER as C}from"../../constants/common.js";import{envConfig as I}from"../../config/env-config.js";import{authMiddleware as g}from"../middleware/authMiddleware.js";import{ensureSearchData as h}from"../middleware/ensureSearchData.js";import{dynamicMiddleware as D}from"../middleware/dynamic-middleware/dynamic-middleware.js";import{installRoutes as P}from"../../plugins/dev-onboarding/api/routes/index.js";import{installSkillsRoutes as N}from"./skills/skills-routes.js";import{llmsTxtHandler as M}from"./llms-txt.js";import{authorizeHandler as w,oidcCallbackHandler as B,logoutHandler as E,postLogoutHandler as v,idpLoginHandler as F,redoclyLoginCallbackHandler as G,samlCallbackHandler as U,redoclyTokenLoginHandler as Y,inviteHandler as y}from"./auth.js";import{appDataHandler as K}from"./app-data.js";import{searchFacetsHandler as k,searchHandler as x}from"./search.js";import{dynamicRouteHandler as b}from"./dynamic-route.js";import{pageDataHandler as V,sharedPageDataHandler as q}from"./page-data.js";import{pathPrefixRedirectHandler as X}from"./path-prefix-redirect.js";import{getRoutesByLineHandler as _,resolvePathHandler as S,resolvePathsHandler as $,resolveSlugHandler as f}from"./resolve-route.js";import{feedbackHandler as j}from"./feedback.js";import{loggerMiddleware as z}from"../middleware/loggerMiddleware.js";import{responseHeadersMiddleware as W}from"../middleware/responseHeadersMiddleware.js";import{idleTimeoutMiddleware as Z}from"../middleware/idleTimeoutMiddleware.js";import{otelTracesHandler as u}from"./otel/otel.js";import{healthCheckHandler as J}from"./health.js";import{askAiHandler as Q,aiAssistantEscalationsHandler as aa,aiAssistantFeedbackHandler as ea,AI_ASSISTANT_IDENTITY_STATUS_HEADER as ia}from"./ask-ai.js";import{semanticSearchHandler as la}from"./semantic-search.js";import{replayOauth2RedirectCallbackHandler as ta}from"./replay-oauth2-redirect.js";import{corsProxyHandler as r}from"./cors-proxy.js";import{corsMiddleware as m}from"../middleware/corsMiddleware.js";import{installApiRoutes as ma}from"./api-routes/api-routes.js";import{cookieMiddleware as oa}from"../middleware/cookieMiddleware.js";import{staticContentHandler as da}from"../routes/static-content.js";import{infoHandler as O}from"./info.js";import{catalogHandler as Aa}from"./catalog/catalog.js";import{catalogRelationsHandler as na}from"./catalog/catalog-relations.js";import{bffCatalogHandler as sa}from"./catalog/bff-catalog.js";import{bffCatalogRevisionsHandler as pa}from"./catalog/bff-catalog-revisions.js";import{bffCatalogRelatedEntitiesHandler as Ta}from"./catalog/bff-catalog-related-entities.js";import{catalogAuthMiddleware as o}from"../middleware/catalogAuthMiddleware.js";import{telemetryMiddleware as Ea}from"../middleware/telemetry-middleware.js";import{errorHandler as _a}from"./error.js";import{installMcpRoutes as Sa}from"./mcp-routes/mcp-routes.js";import{jsonValidatorMiddleware as n}from"../middleware/jsonValidatorMiddleware.js";import{otelTracesRequestSchema as fa}from"../../../api-schemas/otel-traces.js";import{searchFacetsRequestSchema as ra}from"../../../api-schemas/search-facets.js";import{searchRequestSchema as Oa}from"../../../api-schemas/search.js";function Te(a,e,d){const{resolveRouteData:s,readStaticAsset:p,llmsTxtGenerator:A}=d;a.use("*",Z()),a.use("*",oa()),a.use("*",D(e)),a.use("*",g(e)),a.use("*",z()),a.use("*",W(e)),a.use("*",Ea()),a.use(i("*"),c({root:`./${C}`,getContent:(t,R)=>da(t,R,e,p),rewriteRequestPath:t=>H(t)})),a.use(i(l.FEEDBACK),m({allowMethods:["POST"]})),a.use(i(l.ASK_AI),m({allowMethods:["POST"],exposeHeaders:[ia]})),a.use(i(l.AI_ASSISTANT_ESCALATIONS),m({allowMethods:["POST"]})),a.use(i(l.AI_ASSISTANT_FEEDBACK),m({allowMethods:["POST"]})),a.use(i(l.SEMANTIC_SEARCH),m({allowMethods:["POST"]})),a.use("*",Ra(e));const T=h(e);a.use(i(l.INFO),O()),I.NEW_CATALOG_ENABLED&&(a.use(i(l.CATALOG_ENTITIES),o({serverOutDir:e.serverOutDir}),Aa(e)),a.use(i(l.CATALOG_ENTITIES_RELATIONS),o({serverOutDir:e.serverOutDir}),na(e)),a.get(i(l.BFF_CATALOG_ENTITIES),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),sa(e)),a.get(i(l.BFF_CATALOG_RELATED_ENTITIES),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),Ta(e)),a.get(i(l.BFF_CATALOG_REVISIONS),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),pa(e))),a.get(i(l.SHARED_PAGE_DATA),q(e)),a.get(i(l.PAGE_DATA),V(e,s)),a.get(i(l.APP_DATA),K(e)),a.post(i(l.SEARCH),T,n(Oa),x(e)),a.post(i(l.SEARCH_FACETS),T,n(ra),k(e)),a.post(i(l.AUTHORIZATION),t=>w(t,e)),a.post(i(l.LOGOUT),E(e)),a.get(i(l.LOGOUT),E(e)),a.get(i(l.POST_LOGOUT),v(e)),a.get(i(l.OIDC_CALLBACK),B(e)),a.get(i(l.REDOCLY_TOKEN_LOGIN),Y(e)),a.get(i(l.REDOCLY_LOGIN_CALLBACK),G()),a.get(i(l.IDP_LOGIN),F(e)),a.post(i(l.SAML_CALLBACK),U(e)),a.get(i(l.INVITE),y(e)),a.get(i(l.HEALTH),J),Sa(a,e),P(a,e),N(a,e),a.all(i(l.CORS_PROXY),r(e)),a.all(i(`${l.CORS_PROXY}/*`),r(e)),ma(a,e),a.post(i(l.FEEDBACK),j(e)),a.post(i(l.RESOLVE_ROUTE_BY_PATH),S(e)),a.post(i(l.RESOLVE_ROUTES_BY_PATHS),$(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),f(e)),a.post(i(l.ASK_AI),Q(e)),a.post(i(l.AI_ASSISTANT_ESCALATIONS),aa(e)),a.post(i(l.AI_ASSISTANT_FEEDBACK),ea(e)),a.post(i(l.SEMANTIC_SEARCH),la(e)),a.get(i(l.GET_ROUTES_BY_LINE),_(e)),a.post(i(l.OTEL_TRACES),n(fa),u),a.get(i(l.REPLAY_OAUTH2_CALLBACK),ta),A&&a.get(i(`/${L}`),M(A)),a.all(i("/*"),b(e,s,p,A)),a.get("*",X),a.onError(_a)}function Ra(a){return async(e,d)=>{await a.waitForPluginsLifecycle(),await d()}}function Ee(a,e){a.get(i(l.INFO),O()),a.post(i(l.RESOLVE_ROUTE_BY_PATH),S(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),f(e)),a.get(i(l.GET_ROUTES_BY_LINE),_(e))}export{Ee as installDevRoutes,Te as installProdRoutes,Ra as waitForPluginsLifecycle};
1
+ import{serveStatic as c}from"hono/serve-static";import{withPathPrefix as i,withoutPathPrefix as H}from"@redocly/theme/core/utils";import{ServerRoutes as l}from"../../../constants/api.js";import{LLMS_TXT_FILE_NAME as L,PUBLIC_STATIC_FOLDER as C}from"../../constants/common.js";import{envConfig as I}from"../../config/env-config.js";import{authMiddleware as g}from"../middleware/authMiddleware.js";import{ensureSearchData as h}from"../middleware/ensureSearchData.js";import{dynamicMiddleware as D}from"../middleware/dynamic-middleware/dynamic-middleware.js";import{installRoutes as P}from"../../plugins/dev-onboarding/api/routes/index.js";import{installSkillsRoutes as N}from"./skills/skills-routes.js";import{llmsTxtHandler as M}from"./llms-txt.js";import{authorizeHandler as w,oidcCallbackHandler as B,logoutHandler as E,postLogoutHandler as v,idpLoginHandler as F,redoclyLoginCallbackHandler as G,samlCallbackHandler as U,redoclyTokenLoginHandler as Y,inviteHandler as y}from"./auth.js";import{appDataHandler as K}from"./app-data.js";import{searchFacetsHandler as k,searchHandler as x}from"./search.js";import{dynamicRouteHandler as b}from"./dynamic-route.js";import{pageDataHandler as V,sharedPageDataHandler as q}from"./page-data.js";import{pathPrefixRedirectHandler as X}from"./path-prefix-redirect.js";import{getRoutesByLineHandler as _,resolvePathHandler as S,resolvePathsHandler as $,resolveSlugHandler as f}from"./resolve-route.js";import{feedbackHandler as j}from"./feedback.js";import{loggerMiddleware as z}from"../middleware/loggerMiddleware.js";import{responseHeadersMiddleware as W}from"../middleware/responseHeadersMiddleware.js";import{idleTimeoutMiddleware as Z}from"../middleware/idleTimeoutMiddleware.js";import{otelTracesHandler as u}from"./otel/otel.js";import{healthCheckHandler as J}from"./health.js";import{askAiHandler as Q,aiAssistantEscalationsHandler as aa,aiAssistantFeedbackHandler as ea,AI_ASSISTANT_IDENTITY_STATUS_HEADER as ia}from"./ask-ai.js";import{semanticSearchHandler as la}from"./semantic-search.js";import{replayOauth2RedirectCallbackHandler as ta}from"./replay-oauth2-redirect.js";import{corsProxyHandler as r}from"./cors-proxy.js";import{corsMiddleware as m}from"../middleware/corsMiddleware.js";import{installApiRoutes as ma}from"./api-routes/api-routes.js";import{cookieMiddleware as oa}from"../middleware/cookieMiddleware.js";import{staticContentHandler as da}from"../routes/static-content.js";import{infoHandler as O}from"./info.js";import{catalogHandler as Aa}from"./catalog/catalog.js";import{catalogRelationsHandler as na}from"./catalog/catalog-relations.js";import{bffCatalogHandler as sa}from"./catalog/bff-catalog.js";import{bffCatalogRevisionsHandler as pa}from"./catalog/bff-catalog-revisions.js";import{bffCatalogRelatedEntitiesHandler as Ta}from"./catalog/bff-catalog-related-entities.js";import{catalogAuthMiddleware as o}from"../middleware/catalogAuthMiddleware.js";import{telemetryMiddleware as Ea}from"../middleware/telemetry-middleware.js";import{errorHandler as _a}from"./error.js";import{installMcpRoutes as Sa}from"./mcp-routes/mcp-routes.js";import{jsonValidatorMiddleware as n}from"../middleware/jsonValidatorMiddleware.js";import{otelTracesRequestSchema as fa}from"../../../api-schemas/otel-traces.js";import{searchFacetsRequestSchema as ra}from"../../../api-schemas/search-facets.js";import{searchRequestSchema as Oa}from"../../../api-schemas/search.js";function Te(a,e,A){const{resolveRouteData:s,readStaticAsset:p,llmsTxtGenerator:d}=A;a.use("*",Z()),a.use("*",oa()),a.use("*",D(e)),a.use("*",g(e)),a.use("*",z()),a.use("*",W(e)),a.use("*",Ea()),a.use(i("*"),c({root:`./${C}`,getContent:(t,R)=>da(t,R,e,p),rewriteRequestPath:t=>H(t)})),a.use(i(l.FEEDBACK),m({allowMethods:["POST"]})),a.use(i(l.ASK_AI),m({allowMethods:["POST"],exposeHeaders:[ia]})),a.use(i(l.AI_ASSISTANT_ESCALATIONS),m({allowMethods:["POST"]})),a.use(i(l.AI_ASSISTANT_FEEDBACK),m({allowMethods:["POST"]})),a.use(i(l.SEMANTIC_SEARCH),m({allowMethods:["POST"]})),a.use("*",Ra(e));const T=h(e);a.use(i(l.INFO),O()),I.NEW_CATALOG_ENABLED&&(a.use(i(l.CATALOG_ENTITIES),o({serverOutDir:e.serverOutDir}),Aa(e)),a.use(i(l.CATALOG_ENTITIES_RELATIONS),o({serverOutDir:e.serverOutDir}),na(e)),a.get(i(l.BFF_CATALOG_ENTITIES),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),sa(e)),a.get(i(l.BFF_CATALOG_RELATED_ENTITIES),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),Ta(e)),a.get(i(l.BFF_CATALOG_REVISIONS),o({serverOutDir:e.serverOutDir,protectReadMethods:!1}),pa(e))),a.get(i(l.SHARED_PAGE_DATA),q(e)),a.get(i(l.PAGE_DATA),V(e,s,d)),a.get(i(l.APP_DATA),K(e)),a.post(i(l.SEARCH),T,n(Oa),x(e)),a.post(i(l.SEARCH_FACETS),T,n(ra),k(e)),a.post(i(l.AUTHORIZATION),t=>w(t,e)),a.post(i(l.LOGOUT),E(e)),a.get(i(l.LOGOUT),E(e)),a.get(i(l.POST_LOGOUT),v(e)),a.get(i(l.OIDC_CALLBACK),B(e)),a.get(i(l.REDOCLY_TOKEN_LOGIN),Y(e)),a.get(i(l.REDOCLY_LOGIN_CALLBACK),G()),a.get(i(l.IDP_LOGIN),F(e)),a.post(i(l.SAML_CALLBACK),U(e)),a.get(i(l.INVITE),y(e)),a.get(i(l.HEALTH),J),Sa(a,e),P(a,e),N(a,e),a.all(i(l.CORS_PROXY),r(e)),a.all(i(`${l.CORS_PROXY}/*`),r(e)),ma(a,e),a.post(i(l.FEEDBACK),j(e)),a.post(i(l.RESOLVE_ROUTE_BY_PATH),S(e)),a.post(i(l.RESOLVE_ROUTES_BY_PATHS),$(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),f(e)),a.post(i(l.ASK_AI),Q(e)),a.post(i(l.AI_ASSISTANT_ESCALATIONS),aa(e)),a.post(i(l.AI_ASSISTANT_FEEDBACK),ea(e)),a.post(i(l.SEMANTIC_SEARCH),la(e)),a.get(i(l.GET_ROUTES_BY_LINE),_(e)),a.post(i(l.OTEL_TRACES),n(fa),u),a.get(i(l.REPLAY_OAUTH2_CALLBACK),ta),d&&a.get(i(`/${L}`),M(d)),a.all(i("/*"),b(e,s,p,d)),a.get("*",X),a.onError(_a)}function Ra(a){return async(e,A)=>{await a.waitForPluginsLifecycle(),await A()}}function Ee(a,e){a.get(i(l.INFO),O()),a.post(i(l.RESOLVE_ROUTE_BY_PATH),S(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),f(e)),a.get(i(l.GET_ROUTES_BY_LINE),_(e))}export{Ee as installDevRoutes,Te as installProdRoutes,Ra as waitForPluginsLifecycle};
@@ -1,6 +1,7 @@
1
1
  import type { Handler } from 'hono';
2
2
  import type { Store } from '../../store';
3
3
  import type { RouteDataResolver } from './index';
4
- export declare function pageDataHandler(store: Store, resolveRouteData: RouteDataResolver): Handler;
4
+ import type { LlmsTxtGenerator } from '../../types';
5
+ export declare function pageDataHandler(store: Store, resolveRouteData: RouteDataResolver, llmsTxtGenerator?: LlmsTxtGenerator): Handler;
5
6
  export declare function sharedPageDataHandler(store: Store): Handler;
6
7
  //# sourceMappingURL=page-data.d.ts.map
@@ -1 +1 @@
1
- import{MCP_ROUTE as $,PUBLIC_MCP_ROUTE as w}from"@redocly/theme/core/constants/mcp";import{ServerRoutes as M}from"../../../constants/api.js";import{DEV_LOGIN_SLUG as F}from"../../../constants/common.js";import{CACHE_CONTROL_NO_STORE_HEADER_VALUE as a,DEFAULT_TITLE as N}from"../../constants/common.js";import{findInIterable as B}from"../../../utils/collection/find-in-iterable.js";import{removeTrailingSlash as q}from"../../../utils/url/remove-trailing-slash.js";import{envConfig as b}from"../../config/env-config.js";import{canAccessResource as H,filterDataByAccessDeep as T,isResourcePubliclyAccessible as G}from"../../utils/rbac.js";import{getServerProps as V}from"../../ssr/index.js";import{readSharedData as W}from"../../utils/index.js";import{getRedirectLoginUrl as k}from"../utils/get-redirect-login-url.js";import{processRedirects as K}from"./helpers/process-redirects.js";import{removeErrorDetails as z}from"../utils/remove-error-details.js";import{telemetry as J}from"../../telemetry/index.js";import{MCP_NOT_ALLOWED_TEMPLATE_ID as Q}from"../../constants/mcp.js";function ue(e,n){return async(t,g)=>{const p=t.get("logger"),{req:u}=t,{pathname:d}=new URL(u.url),{seo:f,ssoDirect:h}=e.getConfig(),i=f?.title||N;if(e?.compilationErrors?.length&&b.isDevelopMode)return t.json({templateId:"compilation-error",props:{compilationErrors:e?.compilationErrors},sharedDataIds:{}},500,{"Cache-Control":a});const m=d.match(/page-data(.*)data.json$/);if(!m)return g();const c=decodeURI(m[1]),r=c==="/index/"?"/":q(c),o=e.getRouteBySlug(r,{followRedirect:!1})||B(e.routesBySlug.values(),s=>s.hasClientRoutes&&c.startsWith(s.slug+"/"));if(c===M.OIDC_CALLBACK+"/")return t.json({templateId:"403OIDC",sharedDataIds:{},props:{seo:{title:`${i} - Forbidden`}}},200,{"Cache-Control":a});const{isAuthenticated:C,teams:D,claims:{name:_,picture:P,email:I}}=t.get("auth"),R={isAuthenticated:C,email:I,teams:D},l={isAuthenticated:C,name:_,picture:P,email:I,teams:D};if((r===$||r===w&&!!e.globalData.mcpData?.docs?.publicEndpoint)&&e.globalData.mcpData?.docs?.enabled)return t.json({templateId:Q,sharedDataIds:{},props:{},userData:l},405,{"Cache-Control":a});const E=e.getRedirect(r);if(E){const{location:s,type:U}=K({redirect:E});return J.sendRedirectMessage([{id:r,object:"redirect",uri:`urn:redocly:realm:api:redirect:${r}`,from:r,templateId:"404"}]),t.json({templateId:"404",redirectTo:s,sharedDataIds:{},props:{}},U,{"Cache-Control":a})}if(!o){const s=e.getRouteBySlug(r,{followRedirect:!0});return p.error(`Page not found: ${d}`),t.json({templateId:"404",redirectTo:s?.slug,sharedDataIds:{},props:{seo:{title:`${i} - Not Found`}},userData:l},404,{"Cache-Control":a})}if(p.verbose(`Page viewed: ${o.slug}`),!H(o,R,e.config.access?.rbac,e.config.access?.requiresLogin)&&o.slug!==F){if(C)return t.json({templateId:"403",sharedDataIds:{},props:{seo:{title:`${i} - Forbidden`}},userData:l},403,{"Cache-Control":a});const s=Object.keys(h||{}).length>0;return t.json({templateId:"404",sharedDataIds:{},props:{seo:{title:`${i} - Not Found`}},userData:l,...s?{redirectTo:k(e,o.slug)}:{}},s?401:404,{"Cache-Control":a})}const S=T(o.versions,R,e.config.access?.rbac,e.config.access?.requiresLogin),j=e.routesSharedData.get(o.slug)||{},A=await n(o),v=await V(o,t,A,e),{sharedDataIds:O,...L}=v,y={templateId:o.templateId,versions:S,sharedDataIds:{...j,...O||{}},props:b.isProductionEnv?z(L):L,slug:o.slug,userData:l,isPublic:G(o,e.config)};return t.json(y,200,{"Cache-Control":a})}}function me(e){return async(n,t)=>{const g=n.get("logger"),{req:p}=n,{pathname:u}=new URL(p.url),d=u.match(/\/page-data\/shared\/(.*)\.json/);if(!d)return t();const f=decodeURIComponent(d[1]),h=await W(f,e.outdir),{isAuthenticated:i,teams:m,claims:{email:c}}=n.get("auth"),r=T(h,{isAuthenticated:i,email:c,teams:m},e.config.access?.rbac,e.config.access?.requiresLogin);return r?n.json(r,200,{"Cache-Control":a}):(g.error(`Shared data not found: ${u}`),n.text("Not Found",404,{"Cache-Control":a}))}}export{ue as pageDataHandler,me as sharedPageDataHandler};
1
+ import{MCP_ROUTE as $,PUBLIC_MCP_ROUTE as F}from"@redocly/theme/core/constants/mcp";import{ServerRoutes as N}from"../../../constants/api.js";import{DEV_LOGIN_SLUG as B}from"../../../constants/common.js";import{CACHE_CONTROL_NO_STORE_HEADER_VALUE as r,DEFAULT_TITLE as q}from"../../constants/common.js";import{findInIterable as H}from"../../../utils/collection/find-in-iterable.js";import{removeTrailingSlash as k}from"../../../utils/url/remove-trailing-slash.js";import{envConfig as T}from"../../config/env-config.js";import{canAccessResource as G,filterDataByAccessDeep as _,isResourcePubliclyAccessible as V}from"../../utils/rbac.js";import{getServerProps as W}from"../../ssr/index.js";import{readSharedData as K}from"../../utils/index.js";import{getRedirectLoginUrl as z}from"../utils/get-redirect-login-url.js";import{processRedirects as J}from"./helpers/process-redirects.js";import{removeErrorDetails as Q}from"../utils/remove-error-details.js";import{resolvePageMarkdownUrl as X}from"../../utils/llmstxt/resolve-llms-txt-md.js";import{telemetry as Y}from"../../telemetry/index.js";import{MCP_NOT_ALLOWED_TEMPLATE_ID as Z}from"../../constants/mcp.js";function he(e,n,g){return async(t,f)=>{const d=t.get("logger"),{req:p}=t,{pathname:m}=new URL(p.url),{seo:h,ssoDirect:C}=e.getConfig(),c=h?.title||q;if(e?.compilationErrors?.length&&T.isDevelopMode)return t.json({templateId:"compilation-error",props:{compilationErrors:e?.compilationErrors},sharedDataIds:{}},500,{"Cache-Control":r});const u=m.match(/page-data(.*)data.json$/);if(!u)return f();const i=decodeURI(u[1]),a=i==="/index/"?"/":k(i),o=e.getRouteBySlug(a,{followRedirect:!1})||H(e.routesBySlug.values(),s=>s.hasClientRoutes&&i.startsWith(s.slug+"/"));if(i===N.OIDC_CALLBACK+"/")return t.json({templateId:"403OIDC",sharedDataIds:{},props:{seo:{title:`${c} - Forbidden`}}},200,{"Cache-Control":r});const{isAuthenticated:D,teams:I,claims:{name:S,picture:j,email:R}}=t.get("auth"),E={isAuthenticated:D,email:R,teams:I},l={isAuthenticated:D,name:S,picture:j,email:R,teams:I};if((a===$||a===F&&!!e.globalData.mcpData?.docs?.publicEndpoint)&&e.globalData.mcpData?.docs?.enabled)return t.json({templateId:Z,sharedDataIds:{},props:{},userData:l},405,{"Cache-Control":r});const L=e.getRedirect(a);if(L){const{location:s,type:M}=J({redirect:L});return Y.sendRedirectMessage([{id:a,object:"redirect",uri:`urn:redocly:realm:api:redirect:${a}`,from:a,templateId:"404"}]),t.json({templateId:"404",redirectTo:s,sharedDataIds:{},props:{}},M,{"Cache-Control":r})}if(!o){const s=e.getRouteBySlug(a,{followRedirect:!0});return d.error(`Page not found: ${m}`),t.json({templateId:"404",redirectTo:s?.slug,sharedDataIds:{},props:{seo:{title:`${c} - Not Found`}},userData:l},404,{"Cache-Control":r})}if(d.verbose(`Page viewed: ${o.slug}`),!G(o,E,e.config.access?.rbac,e.config.access?.requiresLogin)&&o.slug!==B){if(D)return t.json({templateId:"403",sharedDataIds:{},props:{seo:{title:`${c} - Forbidden`}},userData:l},403,{"Cache-Control":r});const s=Object.keys(C||{}).length>0;return t.json({templateId:"404",sharedDataIds:{},props:{seo:{title:`${c} - Not Found`}},userData:l,...s?{redirectTo:z(e,o.slug)}:{}},s?401:404,{"Cache-Control":r})}const v=_(o.versions,E,e.config.access?.rbac,e.config.access?.requiresLogin),A=e.routesSharedData.get(o.slug)||{},U=await n(o),O=await W(o,t,U,e),b=await X(a,e,g),{sharedDataIds:w,...P}={...O,...b?{markdownUrl:b}:{}},y={templateId:o.templateId,versions:v,sharedDataIds:{...A,...w||{}},props:T.isProductionEnv?Q(P):P,slug:o.slug,userData:l,isPublic:V(o,e.config)};return t.json(y,200,{"Cache-Control":r})}}function Ce(e){return async(n,g)=>{const t=n.get("logger"),{req:f}=n,{pathname:d}=new URL(f.url),p=d.match(/\/page-data\/shared\/(.*)\.json/);if(!p)return g();const m=decodeURIComponent(p[1]),h=await K(m,e.outdir),{isAuthenticated:C,teams:c,claims:{email:u}}=n.get("auth"),i=_(h,{isAuthenticated:C,email:u,teams:c},e.config.access?.rbac,e.config.access?.requiresLogin);return i?n.json(i,200,{"Cache-Control":r}):(t.error(`Shared data not found: ${d}`),n.text("Not Found",404,{"Cache-Control":r}))}}export{he as pageDataHandler,Ce as sharedPageDataHandler};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/revel",
3
- "version": "0.141.0-next.4",
3
+ "version": "0.141.0-next.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,14 +33,14 @@
33
33
  "@opentelemetry/sdk-trace-web": "2.8.0",
34
34
  "@opentelemetry/semantic-conventions": "1.40.0",
35
35
  "@redocly/ajv": "8.18.0",
36
- "@redocly/api-docs": "0.6.0-next.4",
37
- "@redocly/config": "0.73.0",
36
+ "@redocly/api-docs": "0.6.0-next.6",
37
+ "@redocly/config": "0.74.0",
38
38
  "@redocly/markdoc": "0.7.0-beta.2",
39
- "@redocly/openapi-core": "2.75.0",
39
+ "@redocly/openapi-core": "2.77.0",
40
40
  "@redocly/portal-legacy-ui": "0.19.0",
41
- "@redocly/portal-plugin-mock-server": "0.26.0-next.0",
42
- "@redocly/realm-asyncapi-sdk": "0.17.0",
43
- "@redocly/theme": "0.73.0-next.1",
41
+ "@redocly/portal-plugin-mock-server": "0.26.0-next.1",
42
+ "@redocly/realm-asyncapi-sdk": "0.18.0-next.0",
43
+ "@redocly/theme": "0.73.0-next.2",
44
44
  "@shikijs/transformers": "3.21.0",
45
45
  "@tanstack/react-query": "5.62.3",
46
46
  "@tanstack/react-table": "8.21.3",
@@ -1,19 +0,0 @@
1
- /**
2
- * Builds the markdown asset path used for `llms.txt` / AI agent flows from a route slug.
3
- *
4
- * The site root slug (`/`) maps to `index.html.md` so the home page resolves like other HTML routes;
5
- * every other slug gets a `.md` suffix on the same path.
6
- *
7
- * @param routeSlug - URL path segment for the page (e.g. `/`, `/docs`, `/reference/petstore`)
8
- * @returns Path to the corresponding markdown file (e.g. `/index.html.md`, `/docs.md`)
9
- *
10
- * @example
11
- * getLlmsTxtMdPathBySlug('/');
12
- * // returns '/index.html.md'
13
- *
14
- * @example
15
- * getLlmsTxtMdPathBySlug('/guides/getting-started');
16
- * // returns '/guides/getting-started.md'
17
- */
18
- export declare function getLlmsTxtMdPathBySlug(routeSlug: string): string;
19
- //# sourceMappingURL=get-llms-txt-md-path-by-slug.d.ts.map
@@ -1 +0,0 @@
1
- function d(t){return`${t}${t==="/"?"index.html.md":".md"}`}export{d as getLlmsTxtMdPathBySlug};