@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.
- package/CHANGELOG.md +33 -0
- package/dist/client/App.js +1 -1
- package/dist/client/app/webmcp/tools/shared.d.ts +2 -3
- package/dist/client/app/webmcp/tools/shared.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/fs/fs.js +1 -1
- package/dist/server/plugins/api-docs/index.js +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +9 -9
- package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -1
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +4 -4
- package/dist/server/types/plugins/common.d.ts +2 -0
- package/dist/server/types/web-server.d.ts +5 -0
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.d.ts +5 -0
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -1
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/page-data.d.ts +2 -1
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/package.json +7 -7
- package/dist/server/utils/llmstxt/get-llms-txt-md-path-by-slug.d.ts +0 -19
- 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
|
|
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,
|
|
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
|
-
|
|
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
|
|
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.
|
|
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.
|
|
37
|
-
"@redocly/config": "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.
|
|
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.
|
|
42
|
-
"@redocly/realm-asyncapi-sdk": "0.
|
|
43
|
-
"@redocly/theme": "0.73.0-next.
|
|
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};
|