@redocly/framework 1.0.0-next.7 → 1.0.0-next.8
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/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/routes/source-sync-route.js +1 -1
- package/dist/bundler/dev/run.js +1 -1
- package/dist/bundler/dev/runtime-app.js +1 -1
- package/dist/bundler/dev/vite-chunk-url.js +1 -1
- package/dist/bundler/user-markdoc-schema.js +1 -1
- package/dist/bundler/vite-config.base.js +2 -2
- package/dist/cli/args.js +1 -1
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/dev.js +1 -1
- package/dist/cli/commands/ingest.js +1 -1
- package/dist/cli/commands/translate.js +2 -2
- package/dist/cli/dev-console/index.js +1 -1
- package/dist/cli/log-output/index.js +1 -1
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/ai-search/use-ai-search.js +1 -1
- package/dist/client/analytics-page-view.js +1 -1
- package/dist/client/app.js +2 -7
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/dev-problems/ProblemsBar.js +26 -16
- package/dist/client/feedback.js +1 -1
- package/dist/client/l10n/ssr-l10n.js +1 -1
- package/dist/client/l10n/use-l10n-config.js +1 -1
- package/dist/client/products.js +1 -1
- package/dist/client/review/ReviewBar.js +163 -69
- package/dist/client/review/login-url.js +1 -0
- package/dist/client/review/use-review.js +1 -1
- package/dist/client/sidebar/SidebarDataProvider.js +1 -1
- package/dist/client/sidebar/drilldown.js +1 -1
- package/dist/client/ssr.js +1 -1
- package/dist/client/telemetry/config.js +1 -1
- package/dist/client/theme-logo.js +1 -1
- package/dist/client/use-bar-position.js +1 -0
- package/dist/client/use-entity-revisions.js +1 -1
- package/dist/client/use-page-versions.js +1 -1
- package/dist/client/use-search.js +1 -1
- package/dist/client/webmcp/tools/shared.js +1 -1
- package/dist/client/webmcp/tools/site-tools.js +1 -1
- package/dist/client/webmcp/use-webmcp-tools.js +1 -1
- package/dist/content-layer/api-outputs.js +1 -1
- package/dist/content-layer/config-schema.js +1 -1
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/database/files.js +1 -1
- package/dist/content-layer/database/finalize.js +1 -1
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.d.ts +2 -0
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/schema.d.ts +17 -0
- package/dist/content-layer/database/schema.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/hash.js +1 -1
- package/dist/content-layer/ingest/l10n-warnings.js +1 -1
- package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
- package/dist/content-layer/ingest/run.js +1 -1
- package/dist/content-layer/ingest/search-sync.js +1 -1
- package/dist/content-layer/ingest/sync.js +1 -1
- package/dist/content-layer/link-checker/delta.js +1 -1
- package/dist/content-layer/link-checker/fingerprint.js +1 -1
- package/dist/content-layer/link-checker/load-view.js +1 -1
- package/dist/content-layer/link-checker/run-build.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/link-checker/view.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/loaders/define.d.ts +3 -0
- package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
- package/dist/content-layer/markdown/client/code-highlight-notation.js +3 -3
- package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
- package/dist/content-layer/markdown/client/markdown-text.js +1 -1
- package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
- package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
- package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
- package/dist/content-layer/markdown/nodes/fence.js +1 -1
- package/dist/content-layer/markdown/nodes/heading.js +1 -1
- package/dist/content-layer/markdown/nodes/table.js +1 -1
- package/dist/content-layer/markdown/resolve/audience-tag.d.ts +1 -5
- package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
- package/dist/content-layer/markdown/resolve/references.js +1 -1
- package/dist/content-layer/markdown/search/to-markdown.js +2 -2
- package/dist/content-layer/markdown/search/to-sections.d.ts +1 -1
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- package/dist/content-layer/markdown/server/render.js +1 -1
- package/dist/content-layer/markdown/tags/html.d.ts +2 -2
- package/dist/content-layer/markdown/tags/html.js +1 -1
- package/dist/content-layer/markdown/tags/openapi.js +1 -1
- package/dist/content-layer/markdown/tags/variant.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/event-handlers.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +11 -3
- package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +21 -11
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.d.ts +1 -4
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +13 -13
- package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/constants.d.ts +17 -0
- package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +6 -6
- package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
- package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/allowed-http-methods.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -0
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +10 -10
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/outcome-pages.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -6
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/ssrf-guard.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/upstream-detail.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
- package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/tokens.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.d.ts +2 -1
- package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
- package/dist/content-layer/plugins/internal/sidebar/subtree.js +1 -1
- package/dist/content-layer/plugins/internal/skills/index.js +1 -1
- package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
- package/dist/content-layer/plugins/project/load.js +2 -2
- package/dist/content-layer/plugins/types/markdoc.d.ts +2 -0
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/plugins/utils/route-index.js +1 -1
- package/dist/content-layer/problems/codes.js +1 -1
- package/dist/content-layer/search/postings/fragment-field.d.ts +2 -0
- package/dist/content-layer/search/postings/fragment-field.js +1 -1
- package/dist/content-layer/search/postings/postings-store.js +1 -1
- package/dist/content-layer/server/database.js +1 -1
- package/dist/content-layer/static/registry.js +1 -1
- package/dist/content-layer/templates/template-set.js +1 -1
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/content-layer/versions/version-groups.d.ts +5 -1
- package/dist/content-layer/versions/version-groups.js +1 -1
- package/dist/server/app.js +3 -3
- package/dist/server/ask-ai/route.js +1 -1
- package/dist/server/auth/access-config.js +1 -1
- package/dist/server/auth/gate.js +1 -1
- package/dist/server/auth/middleware.js +1 -1
- package/dist/server/auth/oidc.js +1 -1
- package/dist/server/auth/request.js +1 -1
- package/dist/server/auth/routes.js +1 -1
- package/dist/server/content.js +12 -12
- package/dist/server/cors-proxy/handler.js +1 -1
- package/dist/server/feedback/route.js +1 -1
- package/dist/server/lambda-entry.js +1 -1
- package/dist/server/manifest-assets.js +4 -4
- package/dist/server/node-entry.js +1 -1
- package/dist/server/page-handlers.js +2 -2
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/review/route.js +1 -1
- package/dist/server/search/route.js +1 -1
- package/dist/server/seo-tags.js +2 -2
- package/dist/server/sitemap.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/child-entry.js +1 -1
- package/dist/server/subprocess/host.js +1 -1
- package/dist/shared/constants/manifest-version.d.ts +3 -1
- package/dist/shared/constants/openapi-operation-methods.d.ts +2 -0
- package/dist/shared/constants/openapi-operation-methods.js +1 -0
- package/dist/shared/constants/review.d.ts +5 -0
- package/dist/shared/constants/review.js +1 -1
- package/dist/shared/constants/system-routes.js +1 -1
- package/dist/shared/load-dot-env.js +1 -1
- package/dist/shared/rbac/api-docs.d.ts +2 -1
- package/dist/shared/rbac/api-docs.js +1 -1
- package/dist/shared/rbac/engine.d.ts +12 -9
- package/dist/shared/rbac/engine.js +0 -0
- package/dist/shared/rbac/filter.js +1 -1
- package/dist/shared/rbac/l10n-rules.js +1 -1
- package/dist/shared/rbac/route-scope.d.ts +1 -1
- package/dist/shared/rbac/team-templates.js +1 -1
- package/dist/shared/types/auth.d.ts +1 -0
- package/dist/shared/types/config.d.ts +1 -0
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/drizzle/20261111152552_page_markdown_rbac_scope/migration.sql +1 -0
- package/package.json +6 -5
- package/dist/client/review/use-bar-position.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{applyEnvDefaults as e,readPublicEnv as t,setPublicEnv as n}from"../shared/public-env.js";import{BUILD_ASSETS_DIRNAME as r,RUNTIME_CONTENT_ASSETS_DIRNAME as i,RUNTIME_SSR_ENTRY_FILENAME as a,RUNTIME_STATIC_FILES_DIRNAME as o}from"../shared/constants/runtime-layout.js";import{openContentLayerDatabase as s}from"../content-layer/database/connection.js";import{setGlobalPathPrefix as c}from"../shared/path-prefix.js";import"../content-layer/server/database.js";import{searchCacheOptionsFromEnv as l}from"./search/cache.js";import{resolveAccessConfig as ee}from"./auth/access-config.js";import{resolveAuthKeySeed as u}from"./auth/keys.js";import{createAuthRuntime as d}from"./auth/runtime.js";import{createCorsProxyHandler as f}from"./cors-proxy/handler.js";import{createRuntimeSubprocessHost as p}from"./subprocess/host.js";import{createPageHandlers as m}from"./page-handlers.js";import{registerDevAuthRoutes as h}from"./auth/routes.js";import{collectManualAuthPaths as g,createServerModuleLoader as _}from"./plugin-routes.js";import{createApp as v}from"./app.js";import{registerLocalContentAssetRoute as y}from"./content-assets/serve-local.js";import{registerEntityRevisionsAdminRoute as b}from"./revisions-admin.js";import{loadTemplateManifestKeys as te,loadViteManifest as ne,renderClientAssetTags as x,resolveClientAssets as S}from"./manifest-assets.js";import{loadRuntimeConfig as C}from"./runtime-config.js";import{createRuntimeLogger as w}from"./runtime-logger.js";import{loadDotEnv as T}from"../shared/load-dot-env.js";import{fileURLToPath as E}from"node:url";import{dirname as D,join as O}from"node:path";import k from"node:process";import{createServer as A}from"node:http";import{getRequestListener as j}from"@hono/node-server";const M=D(E(import.meta.url));async function N(){T(M),T(k.cwd()),e(k.env,typeof __REALM_BUILD_ENV_FILE_DEFAULTS__==`object`?__REALM_BUILD_ENV_FILE_DEFAULTS__:{}),n(t(k.env));let E=k.env.DATABASE_URL,D=k.env.AUTH_TOKEN,N=k.env.HOST??`0.0.0.0`,P=Number(k.env.PORT??`3000`),F=w(`text`);E||(F.error(`DATABASE_URL environment variable is required`),k.exit(1));let I=O(M,`client`),L=O(M,`server`,a),R=await ne(I),z=S(R,await te(I),F),B=await s({databaseUrl:E,authToken:D,runMigrations:!1,logger:F.child(`runtime:db`)}),{config:V,unsetVars:H}=await C(B,k.env);H.length>0&&F.warn(`The config references environment variables that are not set`,{names:H});let U=await d({env:k.env,getAccessConfig:()=>ee(V),devLogin:typeof __REALM_BUILD_DEV_LOGIN__==`boolean`&&__REALM_BUILD_DEV_LOGIN__&&k.env.REDOCLY_ENV!==`production`,logger:F});c((typeof __REALM_BUILD_PATH_PREFIX__==`string`?__REALM_BUILD_PATH_PREFIX__:void 0)??k.env.REDOCLY_PREFIX_PATHS??``);let W=await import(L),{serverRoutes:G,mcpTools:K}=W,q=_(W.serverModules),{entryPreloadTags:J,stylesheetTags:Y,templateHeadTags:X,translationPackHeadTags:Z}=x(z),re=O(I,r),ie=O(M,i),ae=v({getConfig:()=>V,assetDir:re,registerRoutes:e=>{y(e,{contentAssetsDir:ie,logger:F}),U&&h(e,U);let t=k.env.REALM_REVISIONS_ADMIN_TOKEN;t&&b(e,{database:B,logger:F,token:t})},clientBootstrap:{type:`script-src`,src:z.entryScript},auth:U,corsProxy:f({getConfig:()=>V}),database:B,logger:F,manualAuthPaths:g(G),pluginRoutes:{routes:G,mcpToolEntries:K,loadContentModule:q,gatewaySecretSeed:u(k.env,{allowDevFallback:!1}),subprocess:p({runtimeDir:M,databaseUrl:E,authToken:D})},search:{cache:l(k.env)},staticFiles:{staticFilesDir:O(M,o)},...m({database:B,logger:F,authInfo:U?.pageAuthInfo,staticDataImmutable:!1,preloadTags:J,headTags:Y,templateHeadTags:X,translationPackHeadTags:Z,loadSsr:async()=>W})}),oe=j(ae.fetch),Q=A(oe);Q.listen(P,N,()=>{F.info(`Production server running at http://${N===`0.0.0.0`?`127.0.0.1`:N}:${P}`)});let $=()=>{Q.close(()=>{B.close().then(()=>k.exit(0))})};k.once(`SIGINT`,$),k.once(`SIGTERM`,$)}N().catch(e=>{w(`text`).error(`Failed to start server`,{err:e}),k.exit(1)});export{};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{withPathPrefix as e}from"../shared/path-prefix.js";import{
|
|
2
|
-
`)}function u(e){let{contentDir:
|
|
1
|
+
import{withPathPrefix as e}from"../shared/path-prefix.js";import{publicOrigin as t}from"../content-layer/plugins/utils/request-origin.js";import{escapeHtml as n}from"../shared/utils/escape-html.js";import{executeServerFn as r,loadRuntimeEntityDataByKey as i,loadRuntimePageMetadata as a,resolveRuntimePage as o}from"./content.js";import{isAskAiAvailable as s}from"./ask-ai/route.js";import{addAccessFields as c}from"./request-log.js";function l(t){return Object.values(t.loaderData).flatMap(t=>t.kind===`remote`?[`<link rel="preload" as="fetch" href="${n(e(t.url))}" crossorigin="anonymous">`]:[]).join(`
|
|
2
|
+
`)}function u(e){let{contentDir:n,context:u,database:d,logger:f}=e,p={contentDir:n,context:u,database:d,logger:f};return{loadPageMetadata:async({config:t,request:n,slug:r})=>(await e.beforeLoad?.(),a({...p,config:t,aiAvailable:s(t),authInfo:e.authInfo,cacheControl:e.cacheControl,request:n,slug:r,url:n.url})),loadEntityData:async({config:t,key:n,locale:r,request:a})=>(await e.beforeLoad?.(),i({...p,config:t,key:n,locale:r,request:a,staticDataImmutable:e.staticDataImmutable})),loadServerFnData:async({args:t,config:n,id:i,request:a})=>(await e.beforeLoad?.(),r({...p,config:n,args:t,id:i,request:a})),renderPage:async(n,r)=>{await e.beforeLoad?.();let i=performance.now(),a=await o({...p,config:r,aiAvailable:s(r),authInfo:e.authInfo,cacheControl:e.cacheControl,development:e.development,request:n,url:n.url}),u=performance.now()-i,{page:d}=a,f={page:d,status:d.status,title:d.title,cacheControl:a.cacheControl};if(a.redirect)return{...f,appHtml:``,redirect:a.redirect};if(a.redirectTo)return{...f,appHtml:``,redirectTo:a.redirectTo,...a.siteStart?{siteStart:a.siteStart}:{}};let m=await e.loadSsr(),h=performance.now(),g=await m.render(d,a.resolvedLoaderData,n.url,t(n)),_=performance.now()-h;return c({template:d.template,resolveMs:Math.round(u),ssrMs:Math.round(_)}),e.onRender?.({request:n,page:d,resolveMs:u,ssrMs:_}),{...f,appHtml:g.stream,bodyTags:a.htmlTags?.body,colorMode:a.colorMode,favicon:a.favicon,headTags:[e.preloadTags??``,e.templateHeadTags?.(d.template)??``,e.translationPackHeadTags?.(g.translationPack)??``,l(d),a.htmlTags?.links??``,g.styleTags,e.headTags,await e.loadHeadTags?.()??``,a.htmlTags?.head??``].filter(Boolean).join(`
|
|
3
3
|
`),lang:g.lang,htmlClass:g.htmlClass}}}}export{u as createPageHandlers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isApiFunctionEntityKey as e}from"../content-layer/plugins/internal/api-functions/constants.js";import{resolveRbacDenialStatus as t}from"../shared/rbac/engine.js";import{APP_DATA_ENTITY_KEY as n}from"../shared/constants/app-data.js";import{MCP_CREDENTIALS_THEME_ENTITY_KEY as r,MCP_IGNORED_ROUTES_ENTITY_KEY as i}from"../shared/constants/mcp.js";var a=class extends Error{name=`EntityAccessDeniedError`;status;constructor(e,n){super(`Entity "${e}" is not visible to this viewer.`),this.status=t(n)}getResponse(){return new Response(null,{status:this.status,headers:{"Cache-Control":`no-store`}})}};function o(){return new Response(`Not found`,{status:404,headers:{"Cache-Control":`no-store`}})}const s=/* @__PURE__ */ new Set([n,i,r]);function c(t){let{store:n,visibility:r}=t;if(!r)return n;let i=t=>s.has(t.key)||e(t.key)||r.isEntityVisible(t.key,t.metadata),o=async e=>{let t=await n.get(e);return t&&i(t)?t:null};return{get:o,list:async e=>(await n.list(e)).filter(i),listRevisions:async e=>{let r=await t.loadCurrentMetadata(e);return n.listRevisions(r.filter(i).map(e=>e.key))},load:async e=>{if(!await o(e))throw new a(e,t.teams);return n.load(e)}}}export{a as EntityAccessDeniedError,c as createRequestEntityStore,o as notFoundResponse};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../shared/utils/is-object.js";import{SystemRoute as t}from"../../shared/constants/system-routes.js";import{IDP_ACCESS_TOKEN_COOKIE as n}from"../auth/constants.js";import{getRequestViewer as r}from"../auth/middleware.js";import{ReuniteRefusal as i,createReuniteReviews as a}from"./reunite.js";import{getCookie as o}from"hono/cookie";function s(e,n){let{config:r}=n,o=n.fetcher??fetch;function s(e,t){return async n=>{n.set(`realmCacheControlOwned`,!0),n.header(`Cache-Control`,`no-store`);let s=
|
|
1
|
+
import{isObject as e}from"../../shared/utils/is-object.js";import{SystemRoute as t}from"../../shared/constants/system-routes.js";import{IDP_ACCESS_TOKEN_COOKIE as n}from"../auth/constants.js";import{getRequestViewer as r}from"../auth/middleware.js";import{ReuniteRefusal as i,createReuniteReviews as a}from"./reunite.js";import{getCookie as o}from"hono/cookie";function s(e,n){let{config:r}=n,o=n.fetcher??fetch;function s(e,t){return async n=>{n.set(`realmCacheControlOwned`,!0),n.header(`Cache-Control`,`no-store`);let s=p(n);if(!s)return n.json({signedIn:!1},e);let c=a({config:r,fetcher:o,accessToken:s,signal:n.req.raw.signal});try{return await t(n,c)}catch(e){if(e instanceof i)return u(n,e.response);throw e}}}e.get(t.Review,s(200,c)),e.post(t.Review,s(401,async(e,t)=>{if(!e.req.header(`content-type`)?.startsWith(`application/json`))return e.json({error:`Review request body must be JSON.`},415);let n=l(await e.req.json().catch(()=>null));return n?await t.addPageComment(n)?c(e,t):e.json({error:`This branch has no open pull request.`},404):e.json({error:`This is not a valid comment.`},400)})),e.delete(`${t.Review}/comments/:commentId`,s(401,async(e,t)=>await t.deletePendingComment(e.req.param(`commentId`))?c(e,t):e.json({error:`You can delete only your pending comments here.`},403)))}async function c(e,t){return e.json({signedIn:!0,pullRequest:await t.load()})}function l(t){if(!e(t)||typeof t.pageSlug!=`string`||!t.pageSlug)return null;let n=typeof t.text==`string`?t.text.trim():``;return n?{pageSlug:t.pageSlug,text:n}:null}async function u(e,t){return t.status===401||await d(t)?e.json({signedIn:!1}):e.json({error:await f(t)},t.status>=500?502:t.status)}async function d(t){if(t.status!==403)return!1;let n=await t.clone().json().catch(()=>null);return e(n)&&n.type===`ORGANIZATION_SIGN_IN_REQUIRED`}async function f(t){if(t.status===403)return`You do not have access to review this project.`;if(t.status>=500)return`Platform is unavailable. Try again later.`;let n=await t.json().catch(()=>null);return e(n)&&typeof n.detail==`string`?n.detail:`Platform answered ${t.status}.`}function p(e){return r(e)?.isAuthenticated?o(e,n):void 0}export{s as registerReviewRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEARCH_GROUP_FACET_FIELD as e,SEARCH_PRODUCT_FACET_FIELD as t,buildSearchAppData as n,searchVersionFacetValue as r}from"../../shared/search/facets.js";import{isObject as i}from"../../shared/utils/is-object.js";import{normalizeL10nConfig as a,toLocaleSlug as o}from"../../shared/utils/l10n.js";import{
|
|
1
|
+
import{SEARCH_GROUP_FACET_FIELD as e,SEARCH_PRODUCT_FACET_FIELD as t,buildSearchAppData as n,searchVersionFacetValue as r}from"../../shared/search/facets.js";import{isObject as i}from"../../shared/utils/is-object.js";import{normalizeL10nConfig as a,toLocaleSlug as o}from"../../shared/utils/l10n.js";import{SystemRoute as s}from"../../shared/constants/system-routes.js";import{toPublicVersionedSlug as c}from"../../shared/constants/versions.js";import{tokenizeSearchQuery as l}from"../../content-layer/search/tokenize.js";import{errorMessage as u}from"../../shared/utils/error-message.js";import{stopwordsOfLocale as d}from"../../content-layer/search/stopwords.js";import{createSearchStore as f}from"../../content-layer/search/store.js";import{readSearchCache as p,searchCacheKey as m,writeSearchCache as h}from"./cache.js";import{loadL10nRouteIndex as g,loadVersionCatalog as _}from"../content.js";import{sendServerEvent as v}from"../telemetry/sender.js";import{searchFacetsEvent as y,searchPerformedEvent as b}from"./search-telemetry.js";const x=e=>Math.round((performance.now()-e)*10)/10,S=100;function C(e){let t=l(e);return t.length>0?t.join(` `):null}function w(e,t,n){let r=e.extra??{},i=e.anchor??e.parameterAnchor,a=t.get(e.routeSlug)??e.routeSlug,s=e.locale===``?o(a,n):a,c={document:{id:`${e.entityKey}:${e.docKey}`,url:i?`${s}#${i}`:s,title:e.title,text:e.text,...e.httpMethod?{httpMethod:e.httpMethod}:{},...e.httpPath?{httpPath:e.httpPath}:{},...e.deprecated?{deprecated:!0}:{},...r.path?{path:r.path}:{},...r.badges?{badges:r.badges}:{}},highlight:e.highlight};return r.product&&(c.document.product=r.product),r.isAdditionalOperation&&(c.document.isAdditionalOperation=!0),c}const T=e=>e.groupKey??`Results`;function E(e,t,n={}){let r=n.publicSlugs??/* @__PURE__ */ new Map,i=n.locale??``,a=/* @__PURE__ */ new Map;for(let t of e){let e=T(t),n=a.get(e);n||a.set(e,n=[]),n.push(t)}let o={};if(n.loadMore){let{groupKey:e}=n.loadMore;o[e]=(a.get(e)??[]).slice(0,50).map(e=>w(e,r,i))}else for(let[e,t]of a)o[e]=t.slice(0,50).map(e=>w(e,r,i));let s={};for(let{value:e,count:n}of t.redocly_category??[])s[e]=Math.min(n,500);return{documents:o,facets:t,groupCounts:s,partial:n.partial}}async function D(e,t){let n=await _(e),r=/* @__PURE__ */ new Map;for(let e of t){let t=e.extra?.version;t===void 0||r.has(e.routeSlug)||(await n.groupInfo(t.group)).defaultVersion===t.version&&r.set(e.routeSlug,c(e.routeSlug,t.group,t.version,!0))}return r}async function O(e,t){let n=await _(e),i=t&&n.pairs.some(e=>e.versionGroup===t.group&&e.version===t.version)?t:void 0,a=[];for(let e of new Set(n.pairs.map(e=>e.versionGroup))){let t=i?.group===e?i.version:(await n.groupInfo(e)).defaultVersion;t!==null&&a.push(r(e,t))}return a}async function k(e){let[t,r]=await Promise.all([g(e.database),O(e.database,e.version)]),i=e.locale!==void 0&&t.locales.has(e.locale)?e.locale:``,o=i||a(e.config.l10n).defaultLocale;return{store:f(e.database),locale:i,scope:i===``?{locales:[``]}:{locales:[i,``],canonicalFallback:{locale:i,translatedPrefixes:t.translatedPrefixes(i)}},stopwords:d(o),search:n(e.config),versions:r}}function A(e,t){let n=new Set(t.map(e=>e.field)),r=/* @__PURE__ */ new Set;for(let t of e){if(!n.has(t.field))throw new F(`filter field "${t.field}" is not a search facet.`);if(r.has(t.field))throw new F(`filter field "${t.field}" is selected more than once.`);r.add(t.field)}return e.map(({field:e,values:t})=>({field:e,values:[...new Set(t)]}))}async function j(t){let n=C(t.query),r=await t.loadIndexCoverage?.();if(n===null&&(t.filter??[]).every(e=>e.values.length===0))return E([],{},{partial:r});let{store:i,locale:a,scope:o,stopwords:s,search:c,versions:l}=await k(t),u=[...A(t.filter??[],c.facets),...N(t)],d=t.loadMore,f=d?[...u.filter(t=>t.field!==e),{field:e,values:[d.groupKey]}]:u,{hits:p,facetCounts:m}=await i.query({q:n??``,limit:d?50:100,offset:d?.offset,perGroup:d?void 0:50,...o,stopwords:s,filter:f,teams:t.request.teams,versions:l,countFields:d?[]:c.advanced?c.facets.map(e=>e.field):[e]});return E(p,m,{partial:r,loadMore:d,publicSlugs:await D(t.database,p),locale:a})}async function M(e){let{store:t,scope:n,stopwords:r,search:i,versions:a}=await k(e),o=[...A(e.filter??[],i.facets),...N(e)];if(e.field!==void 0&&!i.facets.some(t=>t.field===e.field))throw new F(`field "${e.field}" is not a search facet.`);let s=i.facets.map(e=>e.field).filter(t=>e.field===void 0||t===e.field),{facetCounts:c}=await t.query({q:C(e.query??``)??``,limit:1,...n,stopwords:r,filter:o,teams:e.request.teams,versions:a,countFields:s,countValuePrefix:e.facetQuery,countOnly:!0});return i.facets.filter(e=>s.includes(e.field)).map(e=>({...e,values:c[e.field]??[]}))}function N(e){return e.product===void 0?[]:[{field:t,values:[e.product]}]}const P=6e5;var F=class extends Error{status;name=`SearchRequestError`;constructor(e,t=400){super(e),this.status=t}};async function I(e){if(Number(e.req.header(`content-length`))>6e5)throw new F(`Request body is too large.`,413);let t;try{t=await e.req.json()}catch{throw new F(`Request body must be JSON.`)}if(JSON.stringify(t).length>6e5)throw new F(`Request body is too large.`,413);if(!i(t))throw new F(`Request body must be a JSON object.`);return t}function L(e,t,n,r=0){if(typeof e!=`string`||e.length<r)throw new F(r>0?`${t} must be a non-empty string.`:`${t} must be a string.`);if(e.length>n)throw new F(`${t} must be at most ${n} characters.`);return e}function R(e,t){if(!i(e))throw new F(`${t} must be an object.`);return e}function z(e,t,n,r){if(!Array.isArray(e))throw new F(`${t} must be an array.`);if(e.length>n)throw new F(`${t} must have at most ${n} items.`);return e.map(r)}const B=e=>t=>t===void 0?void 0:e(t),V=(e,t=`query`)=>L(e,t,100),H=B(e=>L(e,`locale`,35)),U=(e,t)=>L(e,t,200,1),W=B(e=>z(e,`filter`,20,e=>{let t=R(e,`filter items`);return{field:U(t.field,`filter.field`),values:z(t.values,`filter.values`,50,e=>L(e,`filter values`,500))}}));function G(e){if(e==null)return;let t=R(e,`version`);return{group:U(t.group,`version.group`),version:U(t.version,`version.version`)}}const K=B(e=>{let t=R(e,`loadMore`),{offset:n}=t;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw new F(`loadMore.offset must be a non-negative integer.`);return{groupKey:U(t.groupKey,`loadMore.groupKey`),offset:n}}),q=B(e=>U(e,`product`)),J=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));async function Y(e){let t=await I(e);return J({query:V(t.query),locale:H(t.locale),filter:W(t.filter),version:G(t.version),product:q(t.product),loadMore:K(t.loadMore)})}async function X(e){let t=await I(e);return J({locale:H(t.locale),field:B(e=>U(e,`field`))(t.field),query:B(V)(t.query),filter:W(t.filter),facetQuery:B(e=>V(e,`facetQuery`))(t.facetQuery),version:G(t.version),product:q(t.product)})}function Z(e,t){let n=async(e,t)=>{e.header(`Cache-Control`,`no-store`);try{return e.json(await t())}catch(t){if(t instanceof F)return e.json({error:t.message},t.status);throw t}},r=t.logger?.child(`runtime:search-cache`),i=async(e,n,i)=>{let{config:a,request:o}=n,s=C(e.body.query??``)??``,c=e.kind===`search`?{kind:`search`,body:{...e.body,query:s}}:{kind:`facets`,body:{...e.body,query:s}},l=m(c,o.teams,a),u=performance.now(),d=p(t.database,l),f={kind:e.kind,query:s,teams:o.teams.length,entries:d.entries};if(d.hit)return r?.debug(`Search cache hit`,{...f,ms:x(u)}),d.value;let g=await i(),_=h(t.database,l,g,d.generation,t.cache);return r?.debug(`Search cache miss (${d.reason})`,{...f,ms:x(u),stored:_.stored,..._.skipped?{skipped:_.skipped}:{},entries:_.entries,kb:Math.round(_.bytes/1024),evicted:_.evicted}),g},a={logger:t.logger};e.post(s.Search,e=>n(e,async()=>{let n=await Y(e),r={config:t.getConfig(),request:t.buildRequest(e)};return Q(e=>b(r,n.query,e),()=>i({kind:`search`,body:n},r,()=>j({...t,...n,...r})),a)})),e.post(s.SearchFacets,e=>n(e,async()=>{let n=await X(e),r={config:t.getConfig(),request:t.buildRequest(e)};return Q(()=>y(r),()=>i({kind:`facets`,body:n},r,()=>M({...t,...n,...r})),a)}))}async function Q(e,t,n){let r=/* @__PURE__ */ new Date,i=(e,t)=>v({...e,signal:`trace`,time:r,endTime:/* @__PURE__ */ new Date,error:t},n),a;try{a=await t()}catch(t){throw t instanceof F||await i(e(),u(t)),t}return await i(e(a)),a}export{S as SEARCH_CANDIDATE_LIMIT,P as SEARCH_MAX_BODY_LENGTH,F as SearchRequestError,E as buildSearchResponse,C as normalizeSearchQuery,X as parseSearchFacetsRequest,Y as parseSearchRequest,Z as registerSearchRoute,M as runFacetValues,j as runSearch};
|
package/dist/server/seo-tags.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)}function l(
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../shared/constants/l10n/defaults.js";import{isObject as t}from"../shared/utils/is-object.js";import{delocalizeRouteSlug as n,toLocaleSlug as r}from"../shared/utils/l10n.js";import{withPathPrefix as i}from"../shared/path-prefix.js";import{routableLocales as a}from"../shared/utils/l10n/routable-locales.js";import{escapeHtml as o}from"../shared/utils/escape-html.js";import{siteBaseUrl as s}from"./site-url.js";function c(e){let n={};for(let r of[e.site,...e.page])t(r)&&Object.assign(n,r);let r=s(h(t(e.site)?e.site.siteUrl:void 0)),a=[];f(a,`title`,e.title);let c=h(n.description);c&&f(a,`description`,c);let u=h(n.image);u&&f(a,`image`,m(u,r));let d=Array.isArray(n.keywords)?n.keywords.filter(e=>typeof e==`string`).join(`, `):h(n.keywords);if(d&&a.push(p({name:`keywords`,content:d})),Array.isArray(n.meta))for(let e of n.meta)t(e)&&typeof e.name==`string`&&typeof e.content==`string`&&a.push(e.name.includes(`og:`)?p({property:e.name,content:e.content}):p({name:e.name,content:e.content}));if(r){let t=`${r}${i(e.canonicalSlug??e.slug)}`;a.push(` <link rel="canonical" href="${o(t)}">`,` <link rel="sitemap" type="application/xml" href="${o(i(`/sitemap.xml`))}">`);for(let{hreflang:t,slug:n}of l(e.canonicalSlug??e.slug,e.l10n)){let e=`${r}${i(n)}`;a.push(` <link rel="alternate" hreflang="${o(t)}" href="${o(e)}">`)}}if(t(n.jsonLd)||Array.isArray(n.jsonLd)){let e=JSON.stringify(n.jsonLd).replaceAll(`<`,`\\u003C`);a.push(` <script type="application/ld+json">${e}<\/script>`)}return a.join(`
|
|
2
|
+
`)}function l(t,n){if(n===void 0)return[];let i=new Set(a(n).map(({code:e})=>e.toLowerCase())),o=n.locales.map(e=>e.code).filter(t=>t!==e&&(t===n.defaultLocale||i.has(t.toLowerCase())));if(o.length===0)return[];let s=u(t,n);return[...o.map(e=>({hreflang:e.replaceAll(`_`,`-`),slug:e===n.defaultLocale?s:n.slugOverrides[e]?.[s]??r(s,e)})),{hreflang:`x-default`,slug:s}]}function u(e,t){for(let n of Object.values(t.slugOverrides))for(let[t,r]of Object.entries(n))if(r===e)return t;return d(e,t).slug}function d(e,t){for(let{code:r}of a(t)){if(r===t?.defaultLocale)continue;let i=n(e,r);if(i!==void 0)return{locale:r,slug:i}}return{locale:``,slug:e}}function f(e,t,n){e.push(p({name:t,content:n})),e.push(p({property:`og:${t}`,content:n})),e.push(p({name:`twitter:${t}`,property:`twitter:${t}`,content:n}))}function p(e){return` <meta${Object.entries(e).map(([e,t])=>` ${e}="${o(t)}"`).join(``)}>`}function m(e,t){if(!e.startsWith(`/`)||e.startsWith(`//`))return e;let n=i(e);return t?`${t}${n}`:n}function h(e){return typeof e==`string`&&e.trim()!==``?e:void 0}export{c as renderSeoHeadTags,d as splitPageLocale};
|
package/dist/server/sitemap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isObject as e}from"../shared/utils/is-object.js";import{withPathPrefix as t}from"../shared/path-prefix.js";import{escapeHtml as n}from"../shared/utils/escape-html.js";const r=`/sitemap.xml`;function i(t,n={}){let r=n.isNonDefaultVersion?.3:.5,i=(e(t)&&e(t.seo)?t.seo:{}).priority;return i===void 0?r:typeof i==`number`&&i>=0&&i<=1?i:(n.warn?.(`Invalid seo.priority "${String(i)}"; a priority must be between 0 and 1.`),r)}function a(e){let r=e.siteUrl?.replace(/(?<!\/)\/+$/,``);return!r||e.entries.length===0?null:[`<?xml version="1.0" encoding="UTF-8"?>`,`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`,...e.entries.map(e=>` <url><loc>${n(r+encodeURI(t(e.slug)))}</loc><priority>${e.priority}</priority></url>`),`</urlset>`,``].join(`
|
|
2
2
|
`)}export{r as SITEMAP_ROUTE_PATH,a as renderSitemapXml,i as routePriority};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{canView as e,matchContentScope as t,resolveAudience as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../shared/rbac/engine.js";import{isObject as a}from"../../shared/utils/is-object.js";import{resolveRouteScope as o}from"../../shared/rbac/route-scope.js";import{stripPathPrefix as s}from"../../shared/path-prefix.js";import{producerContentType as c,toStaticBodyBytes as l}from"../../content-layer/static/producer-value.js";import{normalizeStaticPath as u}from"../../content-layer/static/normalize-path.js";import{createRuntimeEntityStore as d,loadRbacRouteIndex as f,loadRbacRuntime as p,loadStaticFileIndex as m}from"../content.js";import{attachmentDisposition as h}from"../../shared/utils/attachment-disposition.js";import{CONTENT_ASSET_PRIVATE_CACHE_CONTROL as g,contentAssetDenied as _,contentAssetNotFound as v}from"../content-assets/access.js";import{readLocalFileBody as y,sendFileBody as b}from"../content-assets/file-body.js";import{join as x}from"node:path";const S=`public, max-age=3600`;function C(e,t){let{database:n,logger:r}=t,i=t.staticFilesDir===void 0;e.get(`*`,async(e,a)=>{let o=w(e),s=o===null?void 0:(await m(n)).get(o);if(!s)return a();let c=t.buildRequest(e),l=await T({config:t.getConfig(),database:n,logger:r,row:s,request:c});if(l.deny)return _(e,l.status);let u=await E({...t,row:s,method:e.req.method});if(!u)return r?.debug(`Static file "${s.path}" is registered but its bytes are missing.`),v(e);let d=l.audience===`public`&&!e.get(`realmAccessConfig`)?.requiresLogin;e.set(`realmCacheControlOwned`,!0);let f={"Cache-Control":i?`no-store`:d?S:g,"Content-Type":u.contentType,"Access-Control-Allow-Origin":`*`};return new URL(e.req.url).searchParams.has(`download`)&&(f[`Content-Disposition`]=h(s.path.slice(s.path.lastIndexOf(`/`)+1))),b(e,u,f)})}function w(e){let t=s(new URL(e.req.url).pathname);if(t===null)return null;try{return u(decodeURIComponent(t).slice(1))}catch{return null}}async function T(a){let s=await p(a);if(!s)return{deny:!1,audience:`public`};let c=a.request.teams,l={deny:!0,status:r(c)};if(a.row.kind===`copy`){let r=t(s.matcher,{filePath:a.row.sourcePath,slug:`/${a.row.path}`});return e(i(r,c))?{deny:!1,audience:n(r)===`public`?`public`:`private`}:l}let u=a.row.audience??`public`;if(u===`public`)return{deny:!1,audience:`public`};let d=(await f(a.database)).bySlug.get(u.routeSlug);if(!d)return l;let m=o(s.matcher,d,()=>{});return e(i(m,c))?{deny:!1,audience:`private`}:l}async function E(e){let{row:t}=e;if(t.kind===`producer`){if(!t.entityKey)return null;let n=await d(e).load(t.entityKey);if(!a(n))return null;let r=l(n.body);return{bytes:r,size:r.byteLength,contentType:c(n,t)}}let n=e.staticFilesDir===void 0?e.contentDir!==void 0&&t.sourcePath?x(e.contentDir,t.sourcePath):null:x(e.staticFilesDir,...t.path.split(`/`));if(n===null)return null;let r=await y(n,e.method);return r&&{...r,contentType:t.contentType}}export{S as STATIC_FILE_PUBLIC_CACHE_CONTROL,C as registerStaticFileRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toPosixPath as e}from"../../shared/utils/to-posix-path.js";import{openContentLayerDatabase as t}from"../../content-layer/database/connection.js";import{createKvStore as n}from"../../content-layer/database/kv.js";import"../../content-layer/server/database.js";import
|
|
1
|
+
import{toPosixPath as e}from"../../shared/utils/to-posix-path.js";import{openContentLayerDatabase as t}from"../../content-layer/database/connection.js";import"./protocol.js";import{createKvStore as n}from"../../content-layer/database/kv.js";import"../../content-layer/server/database.js";import{pathToFileURL as r}from"node:url";import{createWriteStream as i}from"node:fs";import a from"node:process";async function o(){let e=[];for await(let t of a.stdin)e.push(t);return JSON.parse(Buffer.concat(e).toString(`utf8`))}function s(e){return e instanceof Error?e.cause===void 0?e.message:`${e.message}: ${s(e.cause)}`:String(e)}function c(e,t){return{ok:!1,code:e,message:s(t)}}function l(e){return typeof e==`object`&&!!e&&`response`in e&&`id`in e&&typeof e.id==`number`}async function u(){let{ESModulesEvaluator:t,ModuleRunner:n,createNodeImportMeta:r}=await import(`vite/module-runner`),i=/* @__PURE__ */ new Map,o=a.send?.bind(a);if(!o)throw Error(`The vite loader needs an IPC channel`);let s=0;a.on(`message`,e=>{l(e)&&(i.get(e.id)?.resolve(e.response),i.delete(e.id))});let c=new n({transport:{invoke:e=>new Promise((t,n)=>{let r=s++;i.set(r,{reject:n,resolve:t}),o({id:r,payload:e},e=>{e&&(i.get(r)?.reject(e),i.delete(r))})})},hmr:!1,createImportMeta:r},new t);return t=>c.import(`/@fs${e(t)}`)}const d=e=>import(r(e).href);async function f(e,t){t.loader??=e.loader===`vite`?u():Promise.resolve(d);let n=await t.loader,r=(await n(e.modulePath))[e.exportName];if(typeof r!=`function`)throw Error(`Export "${e.exportName}" of ${e.modulePath} is not a function`);return{handler:r,loadModule:n}}async function p(e,r){let i,a;try{({handler:i,loadModule:a}=await f(e,r))}catch(e){return c(`module-load`,e)}let o=Symbol(`none`),{database:s}=e,l=s?async()=>(r.database??=t({databaseUrl:s.databaseUrl,authToken:s.authToken,runMigrations:!1}).catch(e=>{throw r.database=void 0,o=e,e}),n(await r.database)):void 0;try{return{ok:!0,output:await i(e.input,{getKv:l,loadModule:a})}}catch(e){return c(e===o?`database-open`:`handler-throw`,e)}}async function m(e){await e.database?.then(e=>e.close()).catch(()=>{})}function h(e){try{return JSON.stringify(e)}catch(e){return JSON.stringify(c(`handler-throw`,`Handler output is not JSON serializable: ${String(e)}`))}}function g(e){return new Promise((t,n)=>{let r=i(``,{fd:3});r.on(`error`,n),r.end(h(e),()=>t())})}async function*_(){let e=[];for await(let t of a.stdin){let n=t;for(let t=n.indexOf(10);t!==-1;t=n.indexOf(10))e.push(n.subarray(0,t)),yield Buffer.concat(e).toString(`utf8`),e=[],n=n.subarray(t+1);e.push(n)}}function v(e){try{return JSON.parse(e)}catch(e){return c(`bad-message`,e)}}async function y(e){let t=i(``,{fd:3});for await(let n of _()){let r=v(n),i=`modulePath`in r?await p(r,e):r;await new Promise((e,n)=>{t.write(`${h(i)}\n`,t=>t?n(t):e())})}}async function b(){let e={};if(a.argv.includes(`--reuse`))await y(e);else{let t=await p(await o(),e);await m(e),await g(t)}a.exit(0)}b().catch(e=>{a.stderr.write(`subprocess child failed: ${e instanceof Error?e.stack:e}\n`),a.exit(1)});export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RUNTIME_SSR_DIRNAME as e,RUNTIME_SUBPROCESS_CHILD_FILENAME as t,serverModuleChunkPath as n}from"../../shared/constants/runtime-layout.js";import{isRemoteDatabaseUrl as r}from"../../content-layer/database/utils/is-remote-database-url.js";import{resolveLocalDatabasePath as i}from"../../content-layer/database/connection.js";import
|
|
1
|
+
import{RUNTIME_SSR_DIRNAME as e,RUNTIME_SUBPROCESS_CHILD_FILENAME as t,serverModuleChunkPath as n}from"../../shared/constants/runtime-layout.js";import{isRemoteDatabaseUrl as r}from"../../content-layer/database/utils/is-remote-database-url.js";import{resolveLocalDatabasePath as i}from"../../content-layer/database/connection.js";import{SubprocessError as a,runSubprocess as o,startReusedSubprocess as s,toRealPath as c}from"./runner.js";import"../../content-layer/server/database.js";import{fileURLToPath as l,pathToFileURL as u}from"node:url";import{existsSync as d,lstatSync as f,readdirSync as p}from"node:fs";import{basename as m,dirname as h,isAbsolute as g,join as _,sep as v}from"node:path";function y(e){let{database:t,resolveContentModule:n,...r}=e,i=0,c=[],l=/* @__PURE__ */ new Map,u=async e=>{let n=l.get(e.modulePath);n||(n=[],l.set(e.modulePath,n));let i=n.pop();for(;i&&!i.alive;)i=n.pop();i??=s({...r,modulePath:e.modulePath,database:t});let a=!0;try{let t=await i.run(e);return a=!1,t}finally{a||!i.alive?i.stop():n.push(i)}};return{resolveContentModule:n,run:async e=>{let n=Date.now()+(e.timeoutMs??1e4);i<8?i+=1:await new Promise((e,t)=>{let r=()=>{clearTimeout(i),e()},i=setTimeout(()=>{c.splice(c.indexOf(r),1),t(new a(`timeout`,`Subprocess timed out waiting for a free slot`))},n-Date.now());c.push(r)});try{let i=n-Date.now();return e.reuse?await u({...e,timeoutMs:i}):await o({...r,...e,timeoutMs:i,database:t})}finally{let e=c.shift();e?e():--i}}}}const b=[``,`-wal`,`-shm`,`-journal`];function x(e){if(r(e))return{databaseUrl:e};let t=i(e),n=_(c(h(t)),m(t));return{databaseUrl:u(n).href,fsRead:[h(n)],fsWrite:b.map(e=>`${n}${e}`),allowAddons:!0}}function S(r){let{databaseUrl:i,...a}=x(r.databaseUrl);return y({...a,childEntryPath:_(r.runtimeDir,t),resolveContentModule:t=>_(r.runtimeDir,e,n(t)),fsRead:[r.runtimeDir,...a.fsRead??[]],database:{databaseUrl:i,authToken:r.authToken}})}function C(e){let t=[];for(let n=e;;n=h(n)){let e=_(n,`node_modules`);if(d(e)&&t.push(e),h(n)===n)return t}}function w(e){let t=[],n=e=>{let n=!1;try{n=f(e).isSymbolicLink()}catch{return}if(!n)return;let r=c(e);r.includes(`${v}node_modules${v}`)||t.push(r)};for(let t of T(e)){let r=_(e,t);if(t.startsWith(`@`))for(let e of T(r))n(_(r,e));else n(r)}return t}function T(e){try{return p(e)}catch{return[]}}function E(e){let t=l(new URL(`../../../`,import.meta.url)),{databaseUrl:n,...r}=x(e.databaseUrl);return y({...r,childEntryPath:e.childEntryPath??l(new URL(`./child-entry.js`,import.meta.url)),resolveContentModule:t=>g(t)?t:_(e.contentDir,t),fsRead:[e.contentDir,t,...C(t),...C(e.contentDir),...w(_(t,`node_modules`)),...r.fsRead??[]],database:{databaseUrl:n},viteInvoke:e.viteInvoke})}export{b as LOCAL_DATABASE_FILE_SUFFIXES,E as createDevSubprocessHost,S as createRuntimeSubprocessHost,y as createSubprocessHost};
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Version of the manifest extraction algorithm (`extractManifest`). Bump it on
|
|
3
3
|
* any change to scanner behavior, a js-yaml upgrade included: markdown
|
|
4
4
|
* frontmatter is a full yaml parse, so the manifest depends on the parser too.
|
|
5
|
+
* Bump it also when outputs that no plugin version covers go stale, such as the
|
|
6
|
+
* content-asset audience tags in rendered Markdown.
|
|
5
7
|
*
|
|
6
8
|
* Each file row stores it as `files.manifest_v`. A stale row triggers a full
|
|
7
9
|
* content database reset on the next ingest, not a per-row backfill.
|
|
8
10
|
*/
|
|
9
|
-
export declare const MANIFEST_VERSION =
|
|
11
|
+
export declare const MANIFEST_VERSION = 6;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=[`get`,`put`,`post`,`delete`,`options`,`head`,`patch`,`trace`,`query`,`x-query`];export{e as OPERATION_METHODS};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/** The preview review bar endpoint (GET state, POST decision), served under the site path prefix. */
|
|
2
2
|
export declare const REVIEW_ROUTE_PATH = "/_realm/review";
|
|
3
|
+
/**
|
|
4
|
+
* Query flag of the Reunite login route: `true` asks Reunite to apply the organization's Platform
|
|
5
|
+
* sign-in rules instead of the project's, because only a person with Platform access can review.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PLATFORM_LOGIN_PARAM = "platformLogin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`/_realm/review`;export{e as REVIEW_ROUTE_PATH};
|
|
1
|
+
const e=`/_realm/review`,t=`platformLogin`;export{t as PLATFORM_LOGIN_PARAM,e as REVIEW_ROUTE_PATH};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONTENT_ASSETS_URL_PREFIX as e}from"./content-assets.js";import{
|
|
1
|
+
import{CONTENT_ASSETS_URL_PREFIX as e}from"./content-assets.js";import{BUILD_ASSETS_URL_PREFIX as t}from"./runtime-layout.js";import{AI_ASSISTANT_ESCALATIONS_ROUTE_PATH as n,AI_ASSISTANT_FEEDBACK_ROUTE_PATH as r,ASK_AI_ROUTE_PATH as i,SEMANTIC_SEARCH_ROUTE_PATH as a}from"./ask-ai.js";import{FEEDBACK_ROUTE_PATH as o}from"./feedback.js";import{CORS_PROXY_ROUTE_PATH as s}from"./cors-proxy.js";import{REPLAY_OAUTH2_ROUTE_PATH as c}from"./replay.js";import{SEARCH_FACETS_ROUTE_PATH as l,SEARCH_ROUTE_PATH as u}from"./search.js";import{OTEL_TRACES_ROUTE_PATH as d}from"./telemetry.js";import{REVIEW_ROUTE_PATH as f}from"./review.js";const p=`/_realm`,m=`/page-data`,h=`/entity-data`,g=`/server-fn`,_=Object.freeze([p,`/_auth`,t,`/blob-data`,e,s,m,h,g]),v={Health:`/_health`,Favicon:`/favicon.ico`,Info:`/_info`,LlmsTxt:`/llms.txt`,LlmsFullTxt:`/llms-full.txt`,Search:u,SearchFacets:l,AskAi:i,AiAssistantEscalations:n,AiAssistantFeedback:r,SemanticSearch:a,Feedback:o,OtelTraces:d,CorsProxy:s,Review:f,Login:`/login`,Logout:`/logout`,PostLogout:`/post-logout`,AuthIdpLogin:`/_auth/idp-login`,AuthOidcCallback:`/_auth/oidc`,AuthRedoclyTokenLogin:`/_auth/redocly-token-login`,AuthDevAuthorize:`/_auth/authorize`,ReplayOAuth2Callback:c},y=Object.freeze(Object.values(v));export{t as BUILD_ASSETS_URL_PREFIX,_ as ENGINE_ROUTE_PREFIXES,p as RESERVED_NAMESPACE_PREFIX,h as RUNTIME_ENTITY_DATA_PATH_PREFIX,m as RUNTIME_PAGE_PATH_PREFIX,g as RUNTIME_SERVER_FN_PATH_PREFIX,y as SYSTEM_ROUTES,v as SystemRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyEnvDefaults as e,readPublicEnv as t,resolveRedoclyEnvironment as n,sanitizeBranchName as r,setEnvFileDefaults as i,setProcessEnv as a}from"./public-env.js";import{existsSync as o,readFileSync as s}from"node:fs";import{join as c}from"node:path";import{spawnSync as l}from"node:child_process";import{parseEnv as u}from"node:util";function d(e){let t=c(e,`.env`);if(!o(t))return!1;try{return process.loadEnvFile(t),!0}catch{return!1}}const f=[`PLAN_GATES`,`REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED`,`REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED`];function p(o){let s=f.map(e=>[e,process.env[e]]),l=[],u={},d=m(c(o,`.env`));d&&(e(process.env,d),Object.assign(u,d),l.push(`.env`));let p=process.env.PUBLIC_REDOCLY_BRANCH_NAME||h(o);p&&!process.env.PUBLIC_REDOCLY_BRANCH_NAME&&(process.env.PUBLIC_REDOCLY_BRANCH_NAME=p);let g=[...p?[`.env.branch.${r(p)}`]:[],`.env.${n(process.env.REDOCLY_ENV)}`];for(let e of g){let t=m(c(o,e));t&&(Object.assign(process.env,t),Object.assign(u,t),l.push(e))}for(let[e,t]of s)t===void 0?delete process.env[e]:process.env[e]=t;return a(process.env),i(t(u)),l}function m(e){if(!o(e))return null;try{return u(s(e,`utf8`))}catch{return null}}function h(e){let t=l(`git`,[`rev-parse`,`--abbrev-ref`,`HEAD`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}),n=t.status===0?t.stdout.trim():``;return n&&n!==`HEAD`?n:null}export{d as loadDotEnv,p as loadProjectEnv};
|
|
1
|
+
import{applyEnvDefaults as e,readPublicEnv as t,resolveRedoclyEnvironment as n,sanitizeBranchName as r,setEnvFileDefaults as i,setProcessEnv as a}from"./public-env.js";import{existsSync as o,readFileSync as s}from"node:fs";import{join as c}from"node:path";import{spawnSync as l}from"node:child_process";import{parseEnv as u}from"node:util";function d(e){let t=c(e,`.env`);if(!o(t))return!1;try{return process.loadEnvFile(t),!0}catch{return!1}}const f=[`PLAN_GATES`,`REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED`,`REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED`,`REDOCLY_EXP_GRPC_DOCS_ENABLED`];function p(o){let s=f.map(e=>[e,process.env[e]]),l=[],u={},d=m(c(o,`.env`));d&&(e(process.env,d),Object.assign(u,d),l.push(`.env`));let p=process.env.PUBLIC_REDOCLY_BRANCH_NAME||h(o);p&&!process.env.PUBLIC_REDOCLY_BRANCH_NAME&&(process.env.PUBLIC_REDOCLY_BRANCH_NAME=p);let g=[...p?[`.env.branch.${r(p)}`]:[],`.env.${n(process.env.REDOCLY_ENV)}`];for(let e of g){let t=m(c(o,e));t&&(Object.assign(process.env,t),Object.assign(u,t),l.push(e))}for(let[e,t]of s)t===void 0?delete process.env[e]:process.env[e]=t;return a(process.env),i(t(u)),l}function m(e){if(!o(e))return null;try{return u(s(e,`utf8`))}catch{return null}}function h(e){let t=l(`git`,[`rev-parse`,`--abbrev-ref`,`HEAD`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}),n=t.status===0?t.stdout.trim():``;return n&&n!==`HEAD`?n:null}export{d as loadDotEnv,p as loadProjectEnv};
|
|
@@ -5,7 +5,8 @@ export type RbacAnnotationOptions = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Copies each node's `x-rbac` onto `REDOCLY_TEAMS_RBAC` (invalid scopes fail closed) without
|
|
7
7
|
* mutating `document`: annotated nodes and their ancestors are copied, everything else is
|
|
8
|
-
* shared, and a document without `x-rbac` comes back as is.
|
|
8
|
+
* shared, and a document without `x-rbac` comes back as is. An operation without its own
|
|
9
|
+
* `x-rbac` takes the one of its first tag that has one. GraphQL has no `x-rbac`.
|
|
9
10
|
*/
|
|
10
11
|
export declare function annotateApiDocsRbac<T>(document: T, kind: ApiSpecType, options: RbacAnnotationOptions): T;
|
|
11
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRbacScope as e}from"./engine.js";import{
|
|
1
|
+
import{isRbacScope as e}from"./engine.js";import{isObject as t}from"../utils/is-object.js";import{filterRbacAnnotatedDocument as n}from"./filter.js";import{OPERATION_METHODS as r}from"../constants/openapi-operation-methods.js";import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";function a(e,t,n){return t===`graphql`?e:d(l(e),n.warn,/* @__PURE__ */ new Map)}function o(e,t,r,i){let o=a(e,t,i);return o===e?e:n(o,r)}const s=/* @__PURE__ */ new Set([`paths`,`webhooks`,`x-webhooks`]),c=new Set(r);function l(n){if(!t(n)||!Array.isArray(n.tags))return n;let r=/* @__PURE__ */ new Map;for(let i of n.tags)t(i)&&Object.hasOwn(i,`x-rbac`)&&r.set(i.name,e(i[`x-rbac`])?i[`x-rbac`]:{});if(r.size===0)return n;let a=e=>{if(!t(e))return e;let n=l(e.callbacks),a=n===e.callbacks?e:{...e,callbacks:n};if(Object.hasOwn(a,`x-rbac`)||!Array.isArray(a.tags))return a;let o=a.tags.find(e=>r.has(e));return o===void 0?a:{...a,[i]:r.get(o)}},o=e=>u(e,(e,t)=>t===`additionalOperations`?u(e,a):c.has(t)?a(e):e),l=e=>u(e,e=>u(e,o));return u(n,(e,t)=>s.has(t)?u(e,o):t===`components`?u(e,(e,t)=>t===`pathItems`?u(e,o):t===`callbacks`?l(e):e):e)}function u(e,n){if(!t(e))return e;let r;for(let[t,i]of Object.entries(e)){let a=n(i,t);a!==i&&((r??={...e})[t]=a)}return r??e}function d(e,t,n){if(typeof e!=`object`||!e)return e;if(n.has(e))return n.get(e);n.set(e,e);let r=Array.isArray(e)?f(e,t,n):p(e,t,n);return n.set(e,r),r}function f(e,t,n){let r=e.map(e=>d(e,t,n));return r.some((t,n)=>t!==e[n])?r:e}function p(t,n,r){let a;for(let[e,i]of Object.entries(t)){let o=d(i,n,r);o!==i&&((a??={...t})[e]=o)}if(Object.prototype.hasOwnProperty.call(t,`x-rbac`)){let r=t[`x-rbac`],o=e(r);o||n(`api-docs: invalid "x-rbac" value — treating as deny-all`),(a??={...t})[i]=o?r:{}}return a??t}export{a as annotateApiDocsRbac,o as filterApiDocsByRbac};
|
|
@@ -9,7 +9,8 @@ export declare function isRbacScope(value: unknown): value is RbacScope;
|
|
|
9
9
|
export declare function parseRbacScope(scope: unknown, rulePath: string, warn: (message: string) => void): RbacScope;
|
|
10
10
|
/**
|
|
11
11
|
* Validates an untrusted RBAC config value. `null`/`undefined` disables RBAC (returns `null`);
|
|
12
|
-
*
|
|
12
|
+
* an invalid role or scope denies access and a malformed `content` section or root is ignored,
|
|
13
|
+
* each with a `warn` call, never a throw.
|
|
13
14
|
*/
|
|
14
15
|
export declare function parseRbacConfigData(raw: unknown, warn?: (message: string) => void): RbacConfigData | null;
|
|
15
16
|
/** Escapes one literal path segment (a directory name) for use inside a picomatch pattern. */
|
|
@@ -39,32 +40,34 @@ export type MatchedContentRule = {
|
|
|
39
40
|
scope: RbacScope;
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
|
-
* The single most specific rule whose glob matches the file path or slug (no merging)
|
|
43
|
-
*
|
|
43
|
+
* The single most specific rule whose glob matches the file path or slug (no merging). Content
|
|
44
|
+
* that no rule matches is public, as in classic Realm: it gets `'**': { '*': read }`.
|
|
44
45
|
*/
|
|
45
46
|
export declare function matchContentRule(matcher: RbacMatcher, target: {
|
|
46
47
|
filePath?: string | null;
|
|
47
48
|
slug?: string | null;
|
|
48
|
-
}): MatchedContentRule
|
|
49
|
+
}): MatchedContentRule;
|
|
49
50
|
/** Scope-only view of {@link matchContentRule} — what role resolution needs. */
|
|
50
51
|
export declare function matchContentScope(matcher: RbacMatcher, target: {
|
|
51
52
|
filePath?: string | null;
|
|
52
53
|
slug?: string | null;
|
|
53
|
-
}): RbacScope
|
|
54
|
+
}): RbacScope;
|
|
54
55
|
/**
|
|
55
56
|
* The highest `scope[team] ?? scope['*'] ?? 'none'` across `teams`, with team names matched in
|
|
56
57
|
* any case; `'none'` for an undefined scope. Two entries that name one team in different case
|
|
57
58
|
* give that team the lower role.
|
|
58
59
|
*/
|
|
59
60
|
export declare function resolveRole(scope: RbacScope | undefined, teams: readonly string[]): RbacRole;
|
|
60
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Whether the config rules deny anonymous viewers all content: a `**` rule denies them and no
|
|
63
|
+
* rule admits them. Without a `**` rule, the content that no rule matches is public.
|
|
64
|
+
*/
|
|
61
65
|
export declare function isClosedToAnonymous(config: RbacConfigData): boolean;
|
|
62
66
|
/**
|
|
63
67
|
* `'public'` when {@link resolveRole} lets an anonymous viewer read the scope; otherwise the
|
|
64
68
|
* sorted teams that can, `authenticated` included when it inherits `read` from `*`.
|
|
65
|
-
* An undefined scope (no rule matched) returns `[]`, never `'public'`: fail closed.
|
|
66
69
|
*/
|
|
67
|
-
export declare function resolveAudience(scope: RbacScope
|
|
70
|
+
export declare function resolveAudience(scope: RbacScope): 'public' | string[];
|
|
68
71
|
/**
|
|
69
72
|
* Who may read the assets carrying a non-public tag: the viewer's effective teams intersect
|
|
70
73
|
* `teams`. `teamPatterns` is an edge-contract slot for anchored regexes that the build does
|
|
@@ -76,7 +79,7 @@ export type AssetAudienceDescriptor = {
|
|
|
76
79
|
};
|
|
77
80
|
/**
|
|
78
81
|
* The `.a-<tag>` segment of a non-public asset filename: 5 base36 chars of the xxhash of
|
|
79
|
-
* `<source dir> <winning rule pattern
|
|
82
|
+
* `<source dir> <winning rule pattern>`. The edge parses it.
|
|
80
83
|
*/
|
|
81
84
|
export declare function deriveAssetTag(input: {
|
|
82
85
|
dirPath: string;
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NAV_ITEM_RBAC as e}from"./types.js";import{canView as t,isRbacScope as n,resolveRole as r}from"./engine.js";import{findRouteEntry as i,resolveRouteScope as a}from"./route-scope.js";import{isPackedMarkdocAst as o,unpackMarkdocAst as s}from"../utils/packed-ast.js";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";const l=Symbol(`rbac-remove`);function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e,i){if(e===void 0)return!0;let a=n(e)?e:{};return t(r(a,i))}function f(t,r){return t===void 0?{}:n(t)?{[e]:t}:(r?.(),{[e]:{}})}const p=/* @__PURE__ */ new WeakMap;function m(e){let{matcher:t,routeIndex:n}=e,r=()=>{},o=p.get(t);o===void 0&&(o=/* @__PURE__ */ new WeakMap,p.set(t,o));let s=e=>(o.has(e)||o.set(e,a(t,e,r)),{kind:`route`,scope:o.get(e)});return{resolve(t){let r=i(n,t);if(r)return s(r);let a=e.aliasToPhysical?.(t);if(a!=null){let e=i(n,a);if(e)return s(e)}return{kind:`no-route`}}}}const h=/* @__PURE__ */ new WeakMap;function g(e){if(typeof e!=`object`||!e)return!1;let t=h.get(e);return t===void 0&&(t=_(e),h.set(e,t)),t}function _(e){return Array.isArray(e)?e.some(_):u(e)?Object.prototype.hasOwnProperty.call(e,c)||Object.prototype.hasOwnProperty.call(e,`redocly::nav-item-rbac`)?!0:Object.values(e).some(_):!1}function v(e,t){let n=y(e,t,!1);return n===l?null:n}function y(e,t,n){if(o(e))return y(s(e),t,n);if(Array.isArray(e)){let n=[];for(let r of e){let e=y(r,t,!0);e!==l&&n.push(e)}return n}if(!u(e))return e;if(!d(e[`redocly::nav-item-rbac`],t))return l;let r=d(e[c],t);if(!r&&(e.tab===!0||e.tabId!==void 0))return l;let i=x(e,t),a=i.some(({filtered:e})=>e.length>0);if(!r&&!
|
|
1
|
+
import{NAV_ITEM_RBAC as e}from"./types.js";import{canView as t,isRbacScope as n,resolveRole as r}from"./engine.js";import{findRouteEntry as i,resolveRouteScope as a}from"./route-scope.js";import{isPackedMarkdocAst as o,unpackMarkdocAst as s}from"../utils/packed-ast.js";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";const l=Symbol(`rbac-remove`);function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e,i){if(e===void 0)return!0;let a=n(e)?e:{};return t(r(a,i))}function f(t,r){return t===void 0?{}:n(t)?{[e]:t}:(r?.(),{[e]:{}})}const p=/* @__PURE__ */ new WeakMap;function m(e){let{matcher:t,routeIndex:n}=e,r=()=>{},o=p.get(t);o===void 0&&(o=/* @__PURE__ */ new WeakMap,p.set(t,o));let s=e=>(o.has(e)||o.set(e,a(t,e,r)),{kind:`route`,scope:o.get(e)});return{resolve(t){let r=i(n,t);if(r)return s(r);let a=e.aliasToPhysical?.(t);if(a!=null){let e=i(n,a);if(e)return s(e)}return{kind:`no-route`}}}}const h=/* @__PURE__ */ new WeakMap;function g(e){if(typeof e!=`object`||!e)return!1;let t=h.get(e);return t===void 0&&(t=_(e),h.set(e,t)),t}function _(e){return Array.isArray(e)?e.some(_):u(e)?Object.prototype.hasOwnProperty.call(e,c)||Object.prototype.hasOwnProperty.call(e,`redocly::nav-item-rbac`)?!0:Object.values(e).some(_):!1}function v(e,t){let n=y(e,t,!1);return n===l?null:n}function y(e,t,n){if(o(e))return y(s(e),t,n);if(Array.isArray(e)){let n=[];for(let r of e){let e=y(r,t,!0);e!==l&&n.push(e)}return n}if(!u(e))return e;if(!d(e[`redocly::nav-item-rbac`],t))return l;let r=d(e[c],t);if(!r&&(e.tab===!0||e.tabId!==void 0))return l;let i=x(e,t),a=i.some(({filtered:e})=>e.length>0),f=i.some(({filtered:e})=>e.some(e=>!C(e)));if(!r&&!f)return l;let p=S(e,t,r,i),m=i.some(({raw:e})=>e.length>0)&&!a;return n&&m&&w(p)?l:p}const b=[`items`,`menu`];function x(e,t){return b.flatMap(n=>{let r=e[n];return Array.isArray(r)?[{key:n,raw:r,filtered:y(r,t,!1)}]:[]})}function S(e,t,n,r){let i={};for(let[a,o]of Object.entries(e)){if(a===c||a===`redocly::nav-item-rbac`)continue;let e=r.find(e=>e.key===a);if(e){i[a]=e.filtered;continue}if(!n&&a===`link`)continue;if(!n&&a===`content`){i.content=null;continue}let s=y(o,t,!1);s!==l&&(i[a]=s)}return i}function C(e){return u(e)&&e.type===`separator`}function w(e){return(e.link===void 0||e.link===``)&&!(`content`in e)}function T(e,t){let n=E(e,t);if(n===l)return null;if(u(n)&&u(n.paths))for(let[e,t]of Object.entries(n.paths))u(t)&&Object.keys(t).length===0&&delete n.paths[e];return n}function E(e,t){if(Array.isArray(e)){let n=[];for(let r of e){let e=E(r,t);e!==l&&n.push(e)}return n}if(!u(e))return e;if(Object.prototype.hasOwnProperty.call(e,c)&&!d(e[c],t))return l;let n={};for(let[r,i]of Object.entries(e)){if(r===c)continue;let e=E(i,t);e!==l&&(n[r]=e)}return n}export{m as createRbacLinkScopes,T as filterRbacAnnotatedDocument,v as filterRbacAnnotatedValue,g as hasRbacAnnotation,f as toNavItemRbacAnnotation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L10N_DIR as e}from"../constants/l10n/defaults.js";import{
|
|
1
|
+
import{L10N_DIR as e}from"../constants/l10n/defaults.js";import{stripLeadingSlash as t}from"../utils/strip-leading-slash.js";import{RBAC_L10N_RULES_KEY as n}from"./types.js";import{escapeGlobLiteral as r}from"./engine.js";import{isObject as i}from"../utils/is-object.js";import{slugifySegment as a}from"../utils/routes/slugify-segment.js";import{resolveLocaleContext as o}from"../utils/l10n.js";function s(n,i){let o=i.locales;if(!i.enabled)return{content:n,l10nRules:{}};let s=o.map(e=>a(e)),c=o.map(t=>`${e}/${r(t)}`),l={...n},u={},d=new Set(Object.keys(n).map(t)),f=(e,t,n)=>{d.has(e)||(d.add(e),l[e]=t,u[e]={canonical:n,generated:!0})};for(let[e,r]of Object.entries(n)){let n=t(e),i=s.findIndex(e=>n.startsWith(`${e}/`));if(i===-1)continue;let a=n.slice(s[i].length+1);u[n]={canonical:a,generated:!1},f(`${c[i]}/${a}`,r,a)}for(let[e,r]of Object.entries(n)){let n=t(e);if(!n.startsWith(`@l10n/`)&&!s.some(e=>n===e||n.startsWith(`${e}/`)))for(let e=0;e<o.length;e+=1)f(`${c[e]}/${n}`,r,n),f(`${s[e]}/${n}`,r,n)}return{content:l,l10nRules:u}}function c(e,t){let r=n in e,a=e.content,o=i(a)?s(a,t):{content:a,l10nRules:{}},c=Object.keys(o.l10nRules).length>0;if(!c&&!r)return e;let{[n]:l,...u}=e;return c?{...u,content:o.content,[n]:o.l10nRules}:u}function l(e,t){let n=o(e.l10n,t),r=e.access;if(!i(r))return e;let a=r.rbac;if(!i(a))return e;let s=c(a,n);return s===a?e:{...e,access:{...r,rbac:s}}}export{l as expandConfigRbacForL10n,c as expandRbacForL10n};
|
|
@@ -20,4 +20,4 @@ export declare function findRouteEntry(index: RbacRouteIndex, path: string): Rba
|
|
|
20
20
|
* Frontmatter `rbac:` replaces the config scope (no merge); an invalid frontmatter value denies
|
|
21
21
|
* (empty scope) and never falls through. Otherwise the config matcher decides by path and slug.
|
|
22
22
|
*/
|
|
23
|
-
export declare function resolveRouteScope(matcher: RbacMatcher, target: RbacRouteEntry, warn: (message: string) => void): RbacScope
|
|
23
|
+
export declare function resolveRouteScope(matcher: RbacMatcher, target: RbacRouteEntry, warn: (message: string) => void): RbacScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../utils/compare-strings.js";import{
|
|
1
|
+
import{compareStrings as e}from"../utils/compare-strings.js";import{stripLeadingSlash as t}from"../utils/strip-leading-slash.js";import{escapeGlobLiteral as n,hasGlobMetachar as r}from"./engine.js";import{isObject as i}from"../utils/is-object.js";import{listSubdirectories as a}from"../utils/list-subdirectories.js";const o=`{folder}`,s=[`teamNamePatterns`,`teamFolders`,`teamFoldersBaseRoles`];function c(t,n,r){let a=Object.keys(i(t.content)?t.content:{}).map(e=>f(e)).filter(e=>e.kind===`team`),o=s.some(e=>e in t);if(a.length===0&&!o&&!h(t))return t;let c=[...new Set(a.flatMap(e=>n[e.prefix]??[]))].sort(e),l={};for(let[e,a]of Object.entries(t))s.includes(e)?r({code:`configuration/ignored`,message:`access.rbac.${e} is ignored: Realm Plus derives team rules from directories. Write the rule with a {folder} segment, for example "apis/{folder}/**" with the team name "P-{folder}-WRITE".`}):l[e]=e===`content`&&i(a)?p(a,n,c,r):e===`features`&&i(a)?Object.fromEntries(Object.entries(a).map(([e,t])=>[e,m(t,c,`access.rbac.features.${e}`,r)])):e===`platform`?m(a,c,`access.rbac.platform`,r):a;return l}function l(e){if(!i(e.content))return[];let t=Object.keys(e.content).map(e=>f(e)).flatMap(e=>e.kind===`team`?[e.prefix]:[]);return[...new Set(t)]}async function u(e,t,n){let r={};for(let i of n)r[i]=(await a(i===``?e:`${e}/${i}`,t)).filter(e=>!e.startsWith(`.`)&&!e.startsWith(`@`));return r}function d(e,t,n){let r=e.access;if(!i(r))return e;let a=r.rbac;if(!i(a))return e;let o=c(a,t,n);return o===a?e:{...e,access:{...r,rbac:o}}}function f(e){let n=t(e).split(`/`),i=n.flatMap((e,t)=>e.includes(o)?[t]:[]);if(i.length===0)return{kind:`plain`};if(i.length>1)return{kind:`invalid`,reason:`only one path segment can be {folder}`};let[a]=i;if(n[a]!==o)return{kind:`invalid`,reason:`{folder} must be a whole path segment`};let s=n.slice(0,a);return s.some(e=>e===``||e.startsWith(`.`)||r(e))?{kind:`invalid`,reason:`the path before {folder} must be a plain directory path`}:{kind:`team`,prefix:s.join(`/`)}}function p(e,r,i,a){let s=new Set(Object.keys(e).filter(e=>f(e).kind===`plain`).map(t)),c={};for(let[l,u]of Object.entries(e)){let e=f(l),d=`access.rbac.content["${l}"]`;if(e.kind===`invalid`){a({code:`configuration/invalid`,message:`${d} is ignored: ${e.reason}, for example "apis/{folder}/**".`});continue}if(e.kind===`plain`){c[l]=m(u,i,d,a);continue}let p=r[e.prefix]??[];if(p.length===0){a({code:`configuration/ignored`,message:`${d} matched no directory under ${e.prefix===``?`the content root`:`"${e.prefix}/"`}, so it adds no rule.`});continue}for(let e of p){let r=l.replace(o,()=>n(e));s.has(t(r))||(c[r]=m(u,[e],d,a))}}return c}function m(e,t,n,r){if(!i(e))return e;let a={};for(let[i,s]of Object.entries(e))if(!i.includes(o))a[i]=s;else if(t.length===0)r({code:`configuration/invalid`,message:`${n}["${i}"] is ignored: {folder} has no values: no access.rbac.content key with a {folder} segment matched a directory.`});else for(let e of t)a[i.replaceAll(o,()=>e)]=s;return a}function h(e){return i(e)?Object.entries(e).some(([e,t])=>e.includes(o)||h(t)):!1}export{d as expandConfigRbacTeamTemplates,c as expandRbacTeamTemplates,u as listTeamDirs,l as teamTemplatePrefixes};
|
|
@@ -49,6 +49,7 @@ export type AccessRuntimeConfig = {
|
|
|
49
49
|
/** Whether `access.rbac` is configured; sessions must then resolve even with login and OIDC off. */
|
|
50
50
|
rbacConfigured?: boolean;
|
|
51
51
|
sso?: string;
|
|
52
|
+
idps?: string;
|
|
52
53
|
logoutReturnUrl?: string;
|
|
53
54
|
/** Reunite residency app origin, e.g. https://app.eu.redocly.com. */
|
|
54
55
|
residency?: string;
|
|
@@ -36,6 +36,7 @@ export type RealmConfig = Omit<RedoclyConfig, 'apis' | 'redirects' | 'scripts' |
|
|
|
36
36
|
linkChecker?: {
|
|
37
37
|
anchors?: {
|
|
38
38
|
hide?: boolean;
|
|
39
|
+
severity?: 'error' | 'warning';
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
/** Entity revision history for the content files `include` matches; Realm Plus only. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{compareStrings as e}from"./compare-strings.js";import{DEFAULT_LOCALE_PLACEHOLDER as t,L10N_DIR as n}from"../constants/l10n/defaults.js";import{isObject as r}from"./is-object.js";import{listSubdirectories as i}from"./list-subdirectories.js";import{normalizeRouteSlug as a}from"./routes/normalize-route-slug.js";import{slugifySegment as o}from"./routes/slugify-segment.js";function s(e){return typeof e==`string`&&e!==``}function c(e){let n=r(e)?e:void 0,i=s(n?.defaultLocale)?n.defaultLocale:t;if(!Array.isArray(n?.locales))return{defaultLocale:i,locales:void 0};let a=[];for(let e of n.locales)r(e)&&s(e.code)&&a.push({code:e.code,name:s(e.name)?e.name:e.code,showMissingTranslationNotice:e.showMissingTranslationNotice===!0||void 0});return{defaultLocale:i,locales:a}}const l=`${n}/`;function u(e){return e.split(`/`).filter(e=>e!==``)}function d(e){if(!e.startsWith(l))return;let t=l.length,n=e.indexOf(`/`,t);if(n!==-1&&n!==t&&n!==e.length-1)return e.slice(t,n)}function f(e){let t=d(e);return t===void 0?void 0:e.slice(l.length+t.length+1)}function p(e,t){return t===``?e:a(`/${o(t)}${e}`)}function m(e,t){let n=`/${o(t)}`;return e===n?`/`:e.startsWith(`${n}/`)?e.slice(n.length):void 0}function h(t){let n=/* @__PURE__ */ new Set;for(let e of t){let t=d(e);t!==void 0&&n.add(t)}return[...n].sort(e)}async function g(e,t){return i(`${e}/${n}`,t)}var _=class{enabled;defaultLocale;locales;codes;slugSegmentToCode;constructor(e,t){this.enabled=t.length>0,this.defaultLocale=e,this.locales=t,this.codes=new Set(t),this.slugSegmentToCode=new Map(t.map(e=>[o(e),e]))}isLocale(e){return this.codes.has(e)}isL10nPath(e){return e.startsWith(l)}splitLocaleFromPath(e){if(!this.enabled)return{locale:``,canonicalPath:e};let t=u(e);return t[0]!==`@l10n`||t.length<2?{locale:this.defaultLocale,canonicalPath:e}:{locale:t[1],canonicalPath:t.slice(2).join(`/`)}}toL10nPath(e,t){return!this.enabled||t===this.defaultLocale?e:e===``?`${n}/${t}`:`${n}/${t}/${e}`}toL10nSlug(e,t){return!this.enabled||t===this.defaultLocale?e:p(e,t)}splitLocaleFromSlug(e){if(!this.enabled)return{locale:``,canonicalSlug:e};let t=a(e),n=t.split(`/`).filter(e=>e!==``),r=n.length>0?this.slugSegmentToCode.get(n[0]):void 0;return r===void 0||r===this.defaultLocale?{locale:this.defaultLocale,canonicalSlug:t}:{locale:r,canonicalSlug:a(`/${n.slice(1).join(`/`)}`)}}};function v(t,n){let{defaultLocale:r}=c(t);return new _(r,[...new Set(n)].filter(e=>e!==r).sort(e))}export{t as DEFAULT_LOCALE_PLACEHOLDER,n as L10N_DIR,_ as LocaleContext,h as collectL10nDirLocales,f as delocalizeL10nPath,m as delocalizeRouteSlug,s as isLocaleCode,d as l10nDirOf,g as listL10nDirs,c as normalizeL10nConfig,v as resolveLocaleContext,p as toLocaleSlug};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{toPosixPath as e}from"../to-posix-path.js";import{normalizeRouteSlug as t}from"./normalize-route-slug.js";import{slugifySegment as n}from"./slugify-segment.js";import{extname as r,posix as i}from"node:path";function a(a,o){let s=i.normalize(e(a)),c=o||r(s),l=(c===``?s:s.slice(0,-c.length)).split(`/`).filter(Boolean);l.at(-1)===`index`&&l.pop();let u=l.map(e=>n(e));return t(u.join(`/`))}export{a as filePathToRouteSlug};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `page_markdown` ADD `rbac_scope` text;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/framework",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.8",
|
|
4
4
|
"description": "A modern hybrid CMS and API documentation platform",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"@hono/node-server": "^2.0.5",
|
|
28
28
|
"@jitl/quickjs-singlefile-mjs-release-sync": "0.32.0",
|
|
29
29
|
"@modelcontextprotocol/server": "2.3.1",
|
|
30
|
-
"@redocly/api-docs": "0.6.0-next.
|
|
30
|
+
"@redocly/api-docs": "0.6.0-next.7",
|
|
31
31
|
"@redocly/config": "0.74.0",
|
|
32
32
|
"@redocly/markdoc": "0.7.0-beta.2",
|
|
33
33
|
"@redocly/mock-server": "0.15.0-next.1",
|
|
34
34
|
"@redocly/openapi-core": "2.77.0",
|
|
35
35
|
"@redocly/realm-asyncapi-sdk": "0.18.0-next.0",
|
|
36
36
|
"@redocly/realm-db-client": "0.3.0",
|
|
37
|
-
"@redocly/theme": "0.73.0-next.
|
|
37
|
+
"@redocly/theme": "0.73.0-next.3",
|
|
38
38
|
"@tanstack/highlight": "0.0.10",
|
|
39
39
|
"@vitejs/plugin-react": "6.2.1",
|
|
40
40
|
"chokidar": "npm:@redocly/chokidar@3.6.0",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
}
|
|
108
108
|
],
|
|
109
109
|
"outputs": [
|
|
110
|
-
"{projectRoot}/dist"
|
|
110
|
+
"{projectRoot}/dist",
|
|
111
|
+
"{projectRoot}/dist-engine"
|
|
111
112
|
]
|
|
112
113
|
},
|
|
113
114
|
"e2e": {
|
|
@@ -184,7 +185,7 @@
|
|
|
184
185
|
"browser-shell": "pnpm run build && DEV_SHELL=1 REALM_VITE_CACHE_DIR=src/browser-engine/node_modules/.vite-shell node scripts/engine-vite.mjs --config src/browser-engine/shell/vite.config.ts",
|
|
185
186
|
"browser-engine": "pnpm run build && REALM_VITE_CACHE_DIR=src/browser-engine/node_modules/.vite-engine node scripts/engine-vite.mjs --config src/browser-engine/shell/vite.config.ts",
|
|
186
187
|
"browser-engine:build": "pnpm run browser-engine:build:shell && REALM_VITE_CACHE_DIR=src/browser-engine/node_modules/.vite-standalone node src/browser-engine/shell/build-fs-pack.mts --standalone && playwright install --only-shell chromium && node src/browser-engine/shell/record-precompiled-ssr.mts",
|
|
187
|
-
"browser-engine:build:shell": "pnpm run build && rm -rf dist
|
|
188
|
+
"browser-engine:build:shell": "pnpm run build && rm -rf dist-engine && REALM_VITE_CACHE_DIR=src/browser-engine/node_modules/.vite-standalone node scripts/engine-vite.mjs optimize --force --config src/browser-engine/shell/vite.config.ts && node src/browser-engine/shell/engine-deps.mts && REALM_STANDALONE=1 REALM_VITE_CACHE_DIR=src/browser-engine/node_modules/.vite-standalone node scripts/engine-vite.mjs build --config src/browser-engine/shell/vite.config.ts",
|
|
188
189
|
"browser-engine:preview": "node scripts/engine-vite.mjs preview --config src/browser-engine/shell/vite.config.ts",
|
|
189
190
|
"browser-engine:deploy": "tools/deploy-engine.sh",
|
|
190
191
|
"build:playground": "node dist/cli/bin.js build --project-dir playground",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";const i=[`left`,`middle`,`right`],a=`realm.review-bar-slot`;function o(){try{let e=localStorage.getItem(a);return i.includes(e)?e:`middle`}catch{return`middle`}}function s(e,t){let n=24+t/2,r=window.innerWidth-24-t/2;return e===`left`?n:e===`right`?r:(n+r)/2}function c(){let c=n(null),[l,u]=r(o),[d,f]=r(!1),[p,m]=r(null),h=n(0),g=n(null),_=e(()=>c.current?.getBoundingClientRect().width??0,[]);t(()=>{if(!d)return;let e=e=>{let t=_(),n=Math.min(Math.max(e.clientX-h.current,s(`left`,t)),s(`right`,t));g.current=n,m(n)},t=()=>{let e=g.current??0,t=_(),n=[...i].sort((n,r)=>Math.abs(s(n,t)-e)-Math.abs(s(r,t)-e))[0];u(n);try{localStorage.setItem(a,n)}catch{}g.current=null,m(null),f(!1)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[d,_]);let v=e(e=>{let t=c.current?.getBoundingClientRect();if(e.button!==0||!t)return;let n=t.left+t.width/2;h.current=e.clientX-n,g.current=n,m(n),f(!0),e.preventDefault()},[]);return{barRef:c,slot:l,dragging:d,style:p===null?l===`left`?{left:`24px`}:l===`right`?{right:`24px`}:{left:`50%`,transform:`translateX(-50%)`}:{left:`${p}px`,transform:`translateX(-50%)`},onDragStart:v}}export{c as useBarPosition};
|