@redocly/framework 1.0.0-next.12 → 1.0.0-next.14
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/README.md +0 -1
- package/dist/bundler/build/dependency-pack.js +1 -1
- package/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/theme-global-stylesheets.js +1 -1
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -1
- 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 +5 -5
- package/dist/cli/api-docs-build-event.js +1 -1
- 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 +1 -1
- package/dist/cli/problems-output.js +3 -3
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/UnversionedVersionButton.js +1 -1
- package/dist/client/VersionPicker.js +343 -0
- 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 -2
- package/dist/client/classic-webview-sync.js +1 -1
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/feedback.js +1 -1
- package/dist/client/history-mount.js +6 -5
- 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 +31 -31
- package/dist/client/review/login-url.js +1 -1
- package/dist/client/review/use-review.js +1 -1
- package/dist/client/revisions-history.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-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/config-schema.js +1 -1
- package/dist/content-layer/config.d.ts +8 -0
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/context-state.js +1 -1
- package/dist/content-layer/context.d.ts +6 -0
- package/dist/content-layer/context.js +1 -1
- package/dist/content-layer/database/assets.js +1 -1
- package/dist/content-layer/database/blobs.js +1 -1
- package/dist/content-layer/database/entities.d.ts +2 -0
- package/dist/content-layer/database/entities.js +1 -1
- package/dist/content-layer/database/entity-store.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/link-refs.js +1 -1
- package/dist/content-layer/database/origins.d.ts +2 -1
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/route-query-deps.d.ts +19 -3
- package/dist/content-layer/database/route-query-deps.js +1 -1
- package/dist/content-layer/database/search-vocab.js +2 -2
- package/dist/content-layer/database/static-files.js +1 -1
- package/dist/content-layer/ingest/extract-all-phase.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/git-last-modified.d.ts +20 -0
- package/dist/content-layer/ingest/git-last-modified.js +5 -4
- package/dist/content-layer/ingest/hash.js +1 -1
- package/dist/content-layer/ingest/hook-inputs.js +1 -1
- package/dist/content-layer/ingest/l10n-warnings.js +1 -1
- package/dist/content-layer/ingest/markdoc-schema-problem.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/scan.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/config-links.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/node-ref.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/loaders/context.js +1 -1
- package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
- 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/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/ast.d.ts +2 -0
- package/dist/content-layer/markdown/resolve/ast.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.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 +3 -3
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- package/dist/content-layer/markdown/search/to-text.js +5 -5
- package/dist/content-layer/markdown/server/render.js +1 -1
- package/dist/content-layer/markdown/service.js +1 -1
- package/dist/content-layer/markdown/tags/variant.js +1 -1
- package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
- package/dist/content-layer/markdown/utils/first-heading.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.d.ts +5 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/materialization/asset-reconcile.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/materializer.js +1 -1
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plugins/execute.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +2 -2
- 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 +4 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +12 -10
- package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/logo.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
- package/dist/content-layer/plugins/internal/assets/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/catalog-classic/resolve-items.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/l10n/translations-loader.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/app-data.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/constants.d.ts +4 -3
- 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/index.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/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
- package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.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/index.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/gateway/subject.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
- 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/client-metadata.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/register.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/token.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/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/mcp/server/workflows/resolve-workflows.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +2 -1
- package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/setup-page.js +1 -1
- 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/client/template.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.js +2 -2
- 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/io.js +1 -1
- package/dist/content-layer/plugins/project/load.js +2 -2
- package/dist/content-layer/plugins/source-file.js +1 -1
- 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/revisions/delete.js +1 -1
- package/dist/content-layer/revisions/read.js +1 -1
- package/dist/content-layer/search/engine/core/search-engine.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/server/app.js +3 -3
- package/dist/server/ask-ai/feature-gate.js +1 -1
- package/dist/server/ask-ai/route.js +1 -1
- package/dist/server/auth/middleware.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/rbac/content-asset-access.js +1 -1
- package/dist/server/runtime-config.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/server/template-ids.js +1 -1
- package/dist/shared/constants/system-routes.js +1 -1
- package/dist/shared/rbac/engine.js +0 -0
- package/dist/shared/rbac/l10n-rules.js +1 -1
- package/dist/shared/rbac/route-scope.js +1 -1
- package/dist/shared/rbac/team-templates.js +1 -1
- package/dist/shared/types/config.d.ts +2 -1
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/package.json +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{slugifySegment as m}from"../../../../shared/utils/routes/slugify-segment.js";import{API_DOCS_API_LOADER_ID as h,API_DOCS_PLUGIN_ID as g,API_DOCS_RENDER_DEP_KEY as _,API_DOCS_RENDER_LOADER_ID as v,API_DOCS_SIDEBAR_LOADER_ID as y,API_DOCS_TEMPLATE_ID as b,SPEC_DOWNLOAD_ROUTE_PATHS as x,SPEC_PATH_PARAM as ee}from"./server/shared.js";import{toPublicVersionedSlug as te}from"../../../../shared/constants/versions.js";import{API_DOCS_MARKDOC_TAG_SET as S,resolveMarkdocTagSet as ne}from"../../../markdown/constants/tag-sets.js";import{SERVER_ONLY_VALUE_KEY as C}from"../../../loaders/server-only-value.js";import{packMarkdocAstsDeep as w,unpackMarkdocAstsDeep as T}from"../../../../shared/utils/packed-ast.js";import{toPosixPath as re}from"../../../../shared/utils/to-posix-path.js";import{findVersionFolder as ie}from"../../utils/version-path.js";import{readVersionsYaml as ae,versionsYamlPath as oe}from"../../../versions/version-groups.js";import{notInPlanProblem as E}from"../../../plan-gates.js";import{filePathToRouteSlug as se}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{parseMarkdownCached as D}from"../../../markdown/utils/parse-cache.js";import{SPEC_KIND_ARAZZO as O,SPEC_KIND_ASYNCAPI as k,SPEC_KIND_GRAPHQL as A,SPEC_KIND_GRPC as j,SPEC_KIND_OPENAPI as M}from"../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as N}from"../../utils/api-entity-key.js";import{resolveApiBundleConfig as ce,resolveApiOptions as le,resolveNestedFeedback as ue,schemaCatalogLink as de,withDownloadUrls as fe,withFeedbackOption as pe,withMockServerOption as me}from"./server/options.js";import{annotateApiDocsRbac as P}from"../../../../shared/rbac/api-docs.js";import{getLoadedProjectPlugins as F}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as I}from"../../../api-outputs.js";import{pageLocale as L}from"../../utils/page-locale.js";import{buildBundledApiDefinition as R,resolveLlmsDescriptions as z}from"./server/build-definition.js";import{collectSidebarSubpathTargets as he,toSidebarSubtree as ge,toSubpathTarget as _e}from"./server/build-sidebar.js";import{declaresProtoService as B}from"./server/declares-proto-service.js";import{join as ve,relative as ye,resolve as V}from"node:path";import be from"@redocly/markdoc";async function xe(e,t){let n=t.originFilePath===null?null:ie(t.originFilePath);if(n===null||t.version===null||t.versionGroup===null)return{slug:t.slug,entityDeps:[]};let r=await ae({io:{exists:t=>e.io.exists(V(e.contentDir,t)),readFile:t=>e.io.readFile(V(e.contentDir,t))},directory:n.parent}),i=typeof r?.default==`string`&&m(r.default)===t.version;return{slug:te(t.slug,t.versionGroup,t.version,i),entityDeps:[{kind:`file`,path:oe(n.parent)}]}}const Se=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`,`.proto`],Ce={[M]:`OpenAPI`,[k]:`AsyncAPI`,[A]:`GraphQL`,[O]:`Arazzo`,[j]:`gRPC`},H=t(v,async e=>{let{buildItems:t,descriptionOptions:n}=await import(`@redocly/api-docs/server`),r=G(e),i=await e.io.readFile(r.absolutePath),a=e.routes.byFilePath(e.file.path),o=a?.slug,s=a&&e.args.kind===`openapi`?await xe(e,a):{slug:void 0,entityDeps:[]},c=fe(e.args.options,e.file.path,e.args.kind),l=e.args.kind===`openapi`?me(c,e.config,s.slug):c,u={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},d=W(e.contentDir),f={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:u},m=await R({kind:e.args.kind,source:i,relativePath:r.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:l,bundle:K(e.args,d),metadata:Y(e.args.options),io:e.io,markdownResolution:f,rbac:{warn:t=>e.logger?.warn(t)}}),h={...p(m.document)&&p(m.document.info)?{infoDescription:m.document.info.description}:{},...await z(m.document,f,{contentDir:e.contentDir,specPath:r.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&l.showSchemaCatalogLinks&&p(m.document)&&(m.document[`x-schema-catalog-link`]=de(e.file.path)),m.options={...pe(m.options,m.document,e.args.feedback??e.config.feedback),...n(e.args.kind,m.document,Y(e.args.options))};let g=o?.toLowerCase()??`/`,{items:_,store:v,specType:y}=await t({...m,basePath:g,markdownParser:e=>be.compact(D(e))}),b=JSON.stringify({items:w(_),store:w(v),options:m.options,specType:y,basePath:g,title:ke(m.document,e.args.kind,_),metadata:Oe(m.document),[C]:{llms:h}});return{value:await e.createBlobRef(b,{format:`json`}),entityDeps:[...J(e.file.path,[...m.fileDependencies,...d.paths]),...u.entityDeps,...s.entityDeps],assetUsages:u.assetUsages,markdoc:{tagSet:S},linkRefs:u.linkRefs,problems:u.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=T(e);if(n.specType===`grpc`)return{docs:[]};let r=await $(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=T(e);if(n.specType===`grpc`)return null;let r=t.route.originFilePath??void 0,i=await $(t.entities,r),{tags:a}=await ne(S,t.config),{buildApiDocsMarkdownCopies:o}=await import(`./server/markdown-copy.js`);return o(n,De(i,n[C]?.llms),{originFilePath:r,markdown:{tags:a,locale:L(t)},warn:e=>t.logger?.warn(e)})},usesProjectMarkdocSchema:!0}),U=t(h,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await R({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:Y(e.args.options),io:e.io}),a=e.args.kind===A,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...X(e.file.path,e.args.kind,e.args.options,e.args.rbac),...Te(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths]),problems:i.problems}});function W(e){let t=F(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>re(ye(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:ve(e.contentDir,t)}}function we(e){let t=e[I];return p(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function Te(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Z(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(y,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(N(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=P(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:D}),s=ge(o),c=n(o).map(({from:e})=>_e(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...he(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const Ee={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,grpc:`gRPC Docs`,openapi:`OpenAPI Docs`};function De(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function Oe(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function ke(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:Ee[t]}const Ae=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function je(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Z(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of Ae)delete r[e];return r}function Y(e){return p(e.metadata)?e.metadata:void 0}function Me(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function X(e,t,n,r){let i=Me(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Z(e){return typeof e==`string`||typeof e==`number`}function Ne(e){if(e.ext===`.gql`||e.ext===`.graphql`)return A;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Z(t)||Z(n)?M:Z(r)?k:Z(i)?O:null}async function Pe(e,t){return t.config.grpcDocsEnabled===!0&&B(await t.io.readFile(e.path))?j:null}const Fe=e({id:g,version:`0.52.0`,content:{filter:{extensions:Se},async extractFile(e,t){if(f.test(e.path))return null;let n=e.ext===`.proto`?await Pe(e,t):Ne(e);if(n===null)return null;if(n!==`arazzo`&&n!==`grpc`&&!d(t.config,n))return{routes:[],problems:[E(`${Ce[n]} documents`)]};let r=e.path,i=we(e.manifest),a=i??r,{rbac:o,...s}=await le(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ue(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`&&n!==`grpc`){let e=await ce(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:N(r),type:`api`,metadata:X(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let p=je(e,s);s.excludeFromSearch===!0&&(p.excludeFromSearch=!0),p.type=n,c.rbac!==void 0&&(p.rbac=c.rbac);let m=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),h=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),g=se(r);return{routes:[{deps:{[_]:m},metadata:p,routeId:`page`,sidebarSubtree:h,slug:null,slugHint:g,template:b,wildcardPrefix:!0}],entities:[u,m,h]}}},loaders:[U,H,q],templates:{[b]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[Q(x.bundle,`bundle`),Q(x.deprecatedBundle,`bundle`),Q(x.graphql,`graphql`)]}});function Q(e,t){return{method:`GET`,path:e+ee,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function $(e,t){if(t)try{return await e.load(N(t))}catch{return}}export{Fe as apiDocsContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{toPosixPath as f}from"../../../../shared/utils/to-posix-path.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{API_DOCS_MARKDOC_TAG_SET as m,resolveMarkdocTagSet as h}from"../../../markdown/constants/tag-sets.js";import{TRANSLATIONS_FILE_PATTERN as g}from"../../../../shared/constants/l10n/defaults.js";import{slugifySegment as _}from"../../../../shared/utils/routes/slugify-segment.js";import{notInPlanProblem as v}from"../../../plan-gates.js";import{filePathToRouteSlug as y}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as b,SPEC_KIND_ASYNCAPI as x,SPEC_KIND_GRAPHQL as S,SPEC_KIND_GRPC as C,SPEC_KIND_OPENAPI as w}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as T,unpackMarkdocAstsDeep as E}from"../../../../shared/utils/packed-ast.js";import{findVersionFolder as D}from"../../utils/version-path.js";import{toPublicVersionedSlug as O}from"../../../../shared/constants/versions.js";import{readVersionsYaml as ee,versionsYamlPath as te}from"../../../versions/version-groups.js";import{parseMarkdownCached as k}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as A}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ne,API_DOCS_PLUGIN_ID as re,API_DOCS_RENDER_DEP_KEY as ie,API_DOCS_RENDER_LOADER_ID as ae,API_DOCS_SIDEBAR_LOADER_ID as oe,API_DOCS_TEMPLATE_ID as j,SPEC_DOWNLOAD_ROUTE_PATHS as M,SPEC_PATH_PARAM as se}from"./server/shared.js";import{resolveApiBundleConfig as ce,resolveApiOptions as le,resolveNestedFeedback as ue,schemaCatalogLink as de,withDownloadUrls as fe,withFeedbackOption as pe,withMockServerOption as me}from"./server/options.js";import{annotateApiDocsRbac as N}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as P}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as F}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as I}from"../../../api-outputs.js";import{pageLocale as L}from"../../utils/page-locale.js";import{buildBundledApiDefinition as R,resolveLlmsDescriptions as z}from"./server/build-definition.js";import{collectSidebarSubpathTargets as he,toSidebarSubtree as ge,toSubpathTarget as _e}from"./server/build-sidebar.js";import{declaresProtoService as ve}from"./server/declares-proto-service.js";import{join as ye,relative as be,resolve as B}from"node:path";import xe from"@redocly/markdoc";async function Se(e,t){let n=t.originFilePath===null?null:D(t.originFilePath);if(n===null||t.version===null||t.versionGroup===null)return{slug:t.slug,entityDeps:[]};let r=await ee({io:{exists:t=>e.io.exists(B(e.contentDir,t)),readFile:t=>e.io.readFile(B(e.contentDir,t))},directory:n.parent}),i=typeof r?.default==`string`&&_(r.default)===t.version;return{slug:O(t.slug,t.versionGroup,t.version,i),entityDeps:[{kind:`file`,path:te(n.parent)}]}}const Ce=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`,`.proto`],we={[w]:`OpenAPI`,[x]:`AsyncAPI`,[S]:`GraphQL`,[b]:`Arazzo`,[C]:`gRPC`},V=t(ae,async e=>{let{buildItems:t,descriptionOptions:n}=await import(`@redocly/api-docs/server`),r=W(e),i=await e.io.readFile(r.absolutePath),a=e.routes.byFilePath(e.file.path),o=a?.slug,s=a&&e.args.kind===`openapi`?await Se(e,a):{slug:void 0,entityDeps:[]},c=fe(e.args.options,e.file.path,e.args.kind),l=e.args.kind===`openapi`?me(c,e.config,s.slug):c,u={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},d=U(e.contentDir),f={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:u},h=await R({kind:e.args.kind,source:i,relativePath:r.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:l,importPaths:e.args.importPaths,bundle:G(e.args,d),metadata:Y(e.args.options),io:e.io,markdownResolution:f,rbac:{warn:t=>e.logger?.warn(t)}}),g={...p(h.document)&&p(h.document.info)?{infoDescription:h.document.info.description}:{},...await z(h.document,f,{contentDir:e.contentDir,specPath:r.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&l.showSchemaCatalogLinks&&p(h.document)&&(h.document[`x-schema-catalog-link`]=de(e.file.path)),h.options={...pe(h.options,h.document,e.args.feedback??e.config.feedback),...n(e.args.kind,h.document,Y(e.args.options))};let _=o?.toLowerCase()??`/`,{items:v,store:y,specType:b}=await t({...h,basePath:_,markdownParser:e=>xe.compact(k(e))}),x=JSON.stringify({items:T(v),store:T(y),options:h.options,specType:b,basePath:_,title:Ae(h.document,e.args.kind,v),metadata:ke(h.document),[P]:{llms:g}});return{value:await e.createBlobRef(x,{format:`json`}),entityDeps:[...q(e.file.path,[...h.fileDependencies,...d.paths]),...u.entityDeps,...s.entityDeps],assetUsages:u.assetUsages,markdoc:{tagSet:m},linkRefs:u.linkRefs,problems:u.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=E(e);if(n.specType===`grpc`)return{docs:[]};let r=await $(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=E(e),r=t.route.originFilePath??void 0,i=await $(t.entities,r),{tags:a}=await h(m,t.config),{buildApiDocsMarkdownCopies:o}=await import(`./server/markdown-copy.js`);return o(n,Oe(i,n[P]?.llms),{originFilePath:r,markdown:{tags:a,locale:L(t)},warn:e=>t.logger?.warn(e)})},usesProjectMarkdocSchema:!0}),H=t(ne,async e=>{let t=W(e),n=await e.io.readFile(t.absolutePath),r=U(e.contentDir),i=await R({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,importPaths:e.args.importPaths,bundle:G(e.args,r),metadata:Y(e.args.options),io:e.io}),a=e.args.kind===S,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...X(e.file.path,e.args.kind,e.args.options,e.args.rbac),...Ee(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:q(e.file.path,[...i.fileDependencies,...r.paths]),problems:i.problems}});function U(e){let t=F(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>f(be(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function W(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:ye(e.contentDir,t)}}function Te(e){let t=e[I];return p(t)&&typeof t.root==`string`?t.root:void 0}function G(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function Ee(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Z(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const K=t(oe,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(A(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=N(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:k}),s=ge(o),c=n(o).map(({from:e})=>_e(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...he(s),...c]}]}});function q(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const De={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,grpc:`gRPC Docs`,openapi:`OpenAPI Docs`};function Oe(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ke(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function Ae(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:De[t]}const J=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function je(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Z(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of J)delete r[e];return r}function Y(e){return p(e.metadata)?e.metadata:void 0}function Me(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function X(e,t,n,r){let i=Me(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Z(e){return typeof e==`string`||typeof e==`number`}function Ne(e){if(e.ext===`.gql`||e.ext===`.graphql`)return S;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Z(t)||Z(n)?w:Z(r)?x:Z(i)?b:null}async function Pe(e,t){return t.config.grpcDocsEnabled===!0&&ve(await t.io.readFile(e.path))?C:null}const Fe=e({id:re,version:`0.56.0`,content:{filter:{extensions:Ce},async extractFile(e,t){if(g.test(e.path))return null;let n=e.ext===`.proto`?await Pe(e,t):Ne(e);if(n===null)return null;if(n!==`arazzo`&&n!==`grpc`&&!d(t.config,n))return{routes:[],problems:[v(`${we[n]} documents`)]};let r=e.path,i=Te(e.manifest),a=i??r,{rbac:o,importPaths:s,...c}=await le(t.io,t.config,r,n,a),l={filePath:r,kind:n,options:c,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(l.source={path:i}),s!==void 0&&(l.importPaths=s);let u=await ue(t.io,t.config,a);if(u!==void 0&&(l.feedback=u),n!==`graphql`&&n!==`grpc`){let e=await ce(t.io,t.config,r,a);Object.keys(e.config).length>0&&(l.bundleConfig=e)}let f=H.withArgs(l,{stableKey:A(r),type:`api`,metadata:X(r,n,c,l.rbac)});if(n===`arazzo`)return{routes:[],entities:[f]};let p=je(e,c);c.excludeFromSearch===!0&&(p.excludeFromSearch=!0),p.type=n,l.rbac!==void 0&&(p.rbac=l.rbac);let m=V.withArgs(l,{stableKey:`api-docs:render:${r}`}),h=K.withArgs(l,{stableKey:`api-docs:sidebar:${r}`}),_=y(r);return{routes:[{deps:{[ie]:m},metadata:p,routeId:`page`,sidebarSubtree:h,slug:null,slugHint:_,template:j,wildcardPrefix:!0}],entities:[f,m,h]}}},loaders:[H,V,K],templates:{[j]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[Q(M.bundle,`bundle`),Q(M.deprecatedBundle,`bundle`),Q(M.graphql,`graphql`)]}});function Q(e,t){return{method:`GET`,path:e+se,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function $(e,t){if(t)try{return await e.load(A(t))}catch{return}}export{Fe as apiDocsContentPlugin};
|
|
@@ -2,6 +2,7 @@ import type { createConfig as CreateConfigFn } from '@redocly/openapi-core';
|
|
|
2
2
|
import { type MarkdownUsageSink, type PendingMarkdownResolution } from './markdown-decorator.js';
|
|
3
3
|
import type { MarkdownService } from '../../../../markdown/types/service.js';
|
|
4
4
|
import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
|
|
5
|
+
import type { MarkdownParseMode } from '../../../../markdown/utils/parse-cache.js';
|
|
5
6
|
import { type ApiSpecType } from '../../../types/api-entity.js';
|
|
6
7
|
import type { JsonObject } from '../../../../database/schema.js';
|
|
7
8
|
import type { ProblemDraft } from '../../../../problems/types.js';
|
|
@@ -61,6 +62,8 @@ export declare function buildBundledApiDefinition(input: {
|
|
|
61
62
|
/** Absolute content root; `relativePath` is relative to it. */
|
|
62
63
|
contentDir: string;
|
|
63
64
|
options?: Record<string, unknown>;
|
|
65
|
+
/** The content-relative folders a grpc import resolves from, before the content root. */
|
|
66
|
+
importPaths?: string[];
|
|
64
67
|
/**
|
|
65
68
|
* When provided, registers the markdown decorator during the bundle walk to collect
|
|
66
69
|
* `description` fields; the async post-bundle pass resolves them and writes back the AST.
|
|
@@ -104,4 +107,4 @@ export declare function resolveLlmsDescriptions(document: unknown, resolution: A
|
|
|
104
107
|
specPath: string;
|
|
105
108
|
pagePath: string;
|
|
106
109
|
}): Promise<LlmsDescriptions>;
|
|
107
|
-
export declare function resolvePendingMarkdown(resolution: ApiDocsMarkdownResolution, pendingList: readonly PendingMarkdownResolution[], contentDir: string, pagePath: string): Promise<void>;
|
|
110
|
+
export declare function resolvePendingMarkdown(resolution: ApiDocsMarkdownResolution, pendingList: readonly PendingMarkdownResolution[], contentDir: string, pagePath: string, parseMode?: MarkdownParseMode): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{ProblemError as n}from"../../../../problems/problem-error.js";import{SPEC_KIND_ARAZZO as r,SPEC_KIND_GRPC as i}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as o}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as s,REALM_MARKDOWN_DECORATOR_KEY as c,REALM_MARKDOWN_DECORATOR_NAME as l,createMarkdownDecoratorPlugin as u}from"./markdown-decorator.js";import{captureSnippet as d,splitSourceLines as f}from"../../../../../shared/utils/capture-snippet.js";import{existsSync as p}from"node:fs";import{join as m}from"node:path";async function h(e){if(e.kind===`grpc`){let{io:t}=e;if(t===void 0)throw Error(`A gRPC definition reads its imports through the loader io.`);return x({...e,io:t})}if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw w(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[],problems:[]}}let{BaseResolver:t,bundleFromString:n,createConfig:i,getLineColLocation:o}=await import(`@redocly/openapi-core`),s=await T(i,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),c=y(t,s.resolve,e.contentDir),l;try{l=await n({source:e.source,absoluteRef:m(e.contentDir,e.relativePath),config:s,externalRefResolver:c,dereference:e.kind===r})}catch(t){throw w(e.relativePath,t)}let u=l.bundle.parsed,d=k([...l.fileDependencies,...c.catalogLinkPaths],e.contentDir),f=b(l.problems,o,{contentDir:e.contentDir,specRelativePath:e.relativePath});e.markdownResolution&&await D(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let p;try{p=await g(e.kind,u)}catch(t){throw w(e.relativePath,t)}let h=_(p,e.metadata);return{type:e.kind,document:e.rbac?a(h,e.kind,e.rbac):h,relativePath:e.relativePath,options:e.options??{},fileDependencies:d,problems:f}}async function g(e,t){if(typeof t!=`object`||!t||Array.isArray(t))return t;let n=t;if(e===`openapi`&&n.swagger!==void 0){let{convertSwaggerToOpenApi:e}=await import(`@redocly/api-docs/server`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/server`);return e(n)}return t}function _(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}const v=/^https?:\/\/.*\/_bundle\/(.*\.(?:ya?ml|json))$/u;function y(e,n,r){class i extends e{catalogLinkPaths=/* @__PURE__ */ new Set;resolveExternalRef(e,n){let i=super.resolveExternalRef(e,n),a=v.exec(i)?.[1];if(a===void 0)return i;let o=m(r,a);return t(r,o)===null?i:(this.catalogLinkPaths.add(o),p(o)?o:i)}}return new i(n)}function b(e,n,r){return e.filter(e=>e.severity===`error`&&e.ignored!==!0).map(e=>{let i=e.message.replaceAll(`${r.contentDir}/`,``),a=e.location[0],o=a?.source?t(r.contentDir,a.source.absoluteRef):null;if(a===void 0||o===null)return{code:`spec/bundle-error`,message:i,location:{filePath:r.specRelativePath}};let{start:s,end:c}=n(a),l={start:{line:s.line,character:s.col},...c?{end:{line:c.line,character:c.col}}:{}};return{code:`spec/bundle-error`,message:i,location:{filePath:o,range:l,snippet:d(f(a.source.body),l)}}})}async function x(e){let{parseProto:t}=await import(`@redocly/api-docs/server`),r=/* @__PURE__ */ new Set,a=[],o;try{o=await t({entry:e.relativePath,importPaths:[...e.importPaths??[],``],read:async t=>{if(t===e.relativePath)return e.source;r.add(t);let n=m(e.contentDir,t);return await e.io.exists(n)?e.io.readFile(n):void 0},onMissingImport:({file:e,message:t})=>{a.push({code:`spec/bundle-error`,message:t,location:{filePath:e}})}})}catch(t){let r=t instanceof Error&&`file`in t?t.file:void 0,i=typeof r==`string`?r:e.relativePath;throw a.length===0?w(i,t):new n({code:`spec/bundle-error`,message:`${a.map(e=>e.message).join(` `)} ${C(t)}`,location:{filePath:i}})}return e.markdownResolution&&await D(e.markdownResolution,S(o),e.contentDir,e.pagePath??e.relativePath,{html:!1}),{type:i,document:o,relativePath:e.relativePath,options:e.options??{},fileDependencies:[...r].sort(),problems:a}}function S(e){let t=[],n=(e,n)=>{t.push({read:()=>e.description,sourceFilePath:n,writeBack:t=>{e.description=t}})};for(let t of e.services){n(t,t.file);for(let e of t.methods)n(e,t.file)}for(let t of e.messages){n(t,t.file);for(let e of t.fields)n(e,t.file)}for(let t of e.enums){n(t,t.file);for(let e of t.values)n(e,t.file)}return t}function C(e){return e instanceof Error?e.message:String(e)}function w(e,t){let r=C(t);return new n({code:`spec/parse-failed`,message:r,location:{filePath:e}})}function T(e,n){let{bundle:r,resolution:i}=n,a=m(n.rootDir,r.configDir,`redocly.yaml`),o={configPath:m(a,`redocly.yaml`)},s=async(t,n)=>{let r=await e(t,n);return r.configPath=a,r},d=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return s({...r.config,plugins:d},o);let{sink:f}=i,p=u({specSourcePath:n.specRelativePath,sink:f,toContentRelative:e=>t(n.rootDir,e)});return s({...r.config,plugins:[...d,p],decorators:{...r.config.decorators,[c]:`on`,[l]:`on`}},o)}async function E(t,n,r){if(!e(t))return{};let i=[],a=(t,n)=>{if(!e(t)||!e(n))return;let a=n[s];i.push({read:()=>t.description,sourceFilePath:typeof a==`string`?a:r.specPath,writeBack:e=>{t.description=e}})},o={},c=t.servers;if(Array.isArray(c)||e(c)){o.servers=structuredClone(c);for(let[e,t]of Object.entries(c))a(o.servers[e],t)}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;o.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))a(o.securitySchemes[t],n)}return await D(n,i,r.contentDir,r.pagePath),o}async function D(e,t,n,r,i){let{markdown:a,sink:s}=e,c={...e.loader,contentDir:n,markdown:a};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!a.looksLikeMarkdown(t))return;let{ast:n,entityDeps:l,assetUsages:u,linkRefs:d,problems:f}=await o(t,e.sourceFilePath,{resolverContext:c,parseMode:i});s.entityDeps.push(...l),s.assetUsages.push(...u);for(let t of d)t.raw.trim().startsWith(`#`)?s.linkRefs.push(O({...t,target:r})):e.sourceFilePath===r||t.filePath!==void 0?s.linkRefs.push(O(t)):s.linkRefs.push({...O(t),filePath:e.sourceFilePath});for(let t of f)s.problems.push({...t,location:{filePath:e.sourceFilePath}});e.writeBack(n)}))}function O(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function k(e,n){let r=/* @__PURE__ */ new Set;for(let i of e){let e=t(n,i);e!==null&&r.add(e)}return[...r].sort()}export{h as buildBundledApiDefinition,T as createBundleConfig,E as resolveLlmsDescriptions,D as resolvePendingMarkdown};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{headingSlugger as t}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as n}from"../../../../../shared/rbac/types.js";import{canView as r,isRbacScope as i,resolveRole as a}from"../../../../../shared/rbac/engine.js";import{filterRbacAnnotatedDocument as o,withoutRemovedRequired as s}from"../../../../../shared/rbac/filter.js";import{parseMarkdownCached as c}from"../../../../markdown/utils/parse-cache.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as l}from"./shared.js";import{annotateApiDocsRbac as u}from"../../../../../shared/rbac/api-docs.js";import{markdocAstToMarkdownChunks as d}from"../../../../markdown/search/to-markdown.js";import{isMarkdocAstNode as f}from"../../../../markdown/server/render.js";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{JsonPointer as m,buildSpecSlice as h,describeSliceTarget as g,resolveSpecSliceScope as _,sliceCopyIntro as v,wrapSliceForCopy as y}from"@redocly/api-docs/server";const b=1e6;async function x(t,n,r){let i=S(r.markdown),{slice:a,readable:o}=await C(t,n,i,r.warn),s=e(n)&&e(n.info)?n.info:{},c=e(s[`x-metadata`])?s[`x-metadata`]:{},l=typeof s.title==`string`&&s.title!==``?s.title:t.title,u=t.specType===`grpc`?U(E(t.items),i).join(`
|
|
2
2
|
|
|
3
|
-
`)
|
|
3
|
+
`):i(typeof c.description==`string`?c.description:s.description).join(`
|
|
4
4
|
|
|
5
|
-
`)
|
|
6
|
-
|
|
5
|
+
`),d=D(t.specType,r.originFilePath),f=t.items,p=/* @__PURE__ */ new Map,m=e=>{typeof e.link==`string`&&!p.has(e.link)&&W(e)&&p.set(e.link,G(e));for(let t of e.items??[])m(t)};for(let e of f)m(e);let h=/* @__PURE__ */ new Map,v=e=>{let n=_(t.specType,e.content,e.label);n?.kind===`graphql-type`&&typeof e.link==`string`&&h.set(n.name,e.link);for(let t of e.items??[])v(t)};if(t.specType===`graphql`)for(let e of f)v(e);let y=[],b=/* @__PURE__ */ new Set,x=async e=>{let r=e.content?.contentType,c=e.link;if(typeof c==`string`&&r!==void 0&&!b.has(c)){b.add(c);let m=r===`overview`,v=p.has(c)?p.get(c):G(e),x=m?l:e.label??``,S={specType:t.specType,document:n,renderMarkdown:i},C=r===`item`?_(t.specType,e.content,e.label):void 0,E=C===void 0?void 0:await a(C,p.has(c)),D;if(m)D=k({...S,title:x,description:u,info:s,readable:o,download:d,items:f});else if(C!==void 0&&E!==void 0){let e=w(E,{scope:C,title:x,target:g(C,n),specUrl:d,contentKind:T[t.specType]??`yaml`}),r=t.specType===`graphql`?await O(E,h):``;D=[r===``?e:`${e}\n\n${r}`]}else D=[x===``?``:`# ${x}`,...U(e.content?.children??[],i),P(e.items??[],`##`,S)].filter(e=>e!==``);y.push({routeSlug:c,chunks:D,headings:q(D),title:x,description:m?u:void 0,rbacScope:v})}for(let t of e.items??[])await x(t)};for(let e of f)await x(e);return y}function S(e){let t=t=>{let n=K(t)?t:{type:`document`,children:Array.isArray(t)?t:[t]};return d(n,e)};return e=>{if(e==null)return[];if(typeof e!=`string`)return t(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}return t(c(e))}}async function C(e,t,n,r){let i=e.specType,a=e=>n(e).join(`
|
|
6
|
+
|
|
7
|
+
`);if(i===`graphql`){let e=typeof t==`string`?await H(t,a):void 0;return{slice:t=>h(i,e,t,{maxRefDepth:0}),readable:void 0}}let o=(e,t)=>h(i,e,t,{maxRefDepth:3}),s=V(t,a),c=u(s,e.specType,{warn:r});if(c===s)return{slice:e=>o(s,e),readable:s};let l=F(c);return{slice:(e,t)=>o(t?l:F(B(c,z(e,c))),e),readable:l}}function w(e,t){return e.length<=1e6?y(e,t).trimEnd():`${v(t)}\n\nThe subset is longer than ${b} characters, so it is not included.`}const T={graphql:`graphql`,grpc:`proto`};function E(e){return e.find(e=>e.content?.contentType===`overview`)?.content?.children??[]}function D(e,t){if(t!==void 0&&e!==`grpc`)return`${e===`graphql`?l.graphql:l.bundle}/${t}`}async function O(e,t){let{parse:n,visit:r}=await import(`graphql`),i=n(e,{noLocation:!0}),a=new Set(i.definitions.map(e=>`name`in e?e.name?.value:``)),o=/* @__PURE__ */ new Set;r(i,{NamedType(e){o.add(e.name.value)}});let s=[...o].filter(e=>!a.has(e)&&t.has(e)).map(e=>`- [${e}](${t.get(e)}.md)`);return s.length===0?``:`Types:\n\n${s.join(`
|
|
8
|
+
`)}`}function k(t){let{info:n}=t,r=[`# ${t.title}`,t.description];typeof n.summary==`string`&&r.push(n.summary);let i=[];n.version!==void 0&&n.version!==``&&i.push(`Version: ${String(n.version)}`);let a=e(n.license)?n.license:void 0;typeof a?.name==`string`&&i.push(`License: ${a.name}`);let o=e(n[`x-metadata`])?n[`x-metadata`]:{},s=Object.entries(o).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);s.length>0&&i.push(`Metadata:\n${s.join(`
|
|
7
9
|
`)}`),r.push(i.join(`
|
|
8
|
-
`));let c=e(t.readable)?t.readable:{},l=
|
|
10
|
+
`));let c=e(t.readable)?t.readable:{},l=A[t.specType]??`API description`;return[r.filter(e=>e!==``).join(`
|
|
9
11
|
|
|
10
|
-
`),
|
|
12
|
+
`),j(c.servers,t.renderMarkdown),M(c.components,t.renderMarkdown),t.download===void 0?``:`## Download ${l}\n\n[${t.title}](${t.download})`,P(t.items,`##`,t)].filter(e=>e!==``)}const A={openapi:`OpenAPI description`,asyncapi:`AsyncAPI description`,graphql:`GraphQL schema`};function j(t,n){if(!Array.isArray(t)||t.length===0)return``;let r=`## Servers
|
|
11
13
|
|
|
12
14
|
`;for(let i of t){if(!e(i))continue;let t=n(i.description).join(`
|
|
13
15
|
|
|
14
16
|
`);if(t&&(r+=`${t}\n`),r+=`\`\`\`\n${String(i.url??``)}\n\`\`\`\n\n`,e(i.variables)){r+=`Variables:
|
|
15
17
|
`;for(let[t,a]of Object.entries(i.variables)){if(!e(a))continue;let i=n(a.description).join(` `).replace(/\s+/g,` `);r+=`- \`${t}\`${i?`: ${i}`:``}\n`,a.default!==void 0&&(r+=` Default: ${JSON.stringify(a.default)}\n`),Array.isArray(a.enum)&&(r+=` Enum: ${a.enum.map(e=>JSON.stringify(e)).join(`, `)}\n`)}r+=`
|
|
16
|
-
`}}return r.trim()}function
|
|
18
|
+
`}}return r.trim()}function M(t,n){let r=e(t)&&e(t.securitySchemes)?t.securitySchemes:void 0;if(r===void 0)return``;let i=`## Security
|
|
17
19
|
|
|
18
20
|
`;for(let[t,a]of Object.entries(r)){if(!e(a)||`$ref`in a)continue;i+=`### ${t}\n\n`;let r=n(a.description).join(`
|
|
19
21
|
|
|
20
|
-
`);r&&(i+=`${r}\n\n`);for(let[e,t]of
|
|
22
|
+
`);r&&(i+=`${r}\n\n`);for(let[e,t]of N)typeof a[t]==`string`&&a[t]&&(i+=`${e}: ${a[t]}\n`);let o=e(a.flows)?a.flows:{},s=[o.implicit,o.password,o.clientCredentials,o.authorizationCode].find(e);if(s!==void 0&&(typeof s.authorizationUrl==`string`&&(i+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(i+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){i+=`Scopes:
|
|
21
23
|
`;for(let[e,t]of Object.entries(s.scopes))i+=`- \`${e}\`: ${String(t)}\n`}i+=`
|
|
22
|
-
`}return i.trim()}const
|
|
23
|
-
`,1)[0]??``);if(!
|
|
24
|
+
`}return i.trim()}const N=[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]];function P(e,t,n){let r=``;for(let i of e)if(W(i)){if(i.content?.contentType===`group`){r+=`${t} ${i.label??``}\n\n`;let e=P(i.items??[],`${t}#`,n);e!==``&&(r+=`${e}\n\n`)}else if(i.content?.contentType===`item`&&typeof i.link==`string`){let e=_(n.specType,i.content,i.label),t=(e===void 0?void 0:g(e,n.document))??i.label??``,a=U(i.content.children??[],n.renderMarkdown).join(` `).replace(/\s+/g,` `).trim();r+=`- [${t}](${i.link}.md)${a?`: ${a.slice(0,200)}`:``}\n`}}return r.trim()}function F(e){return L(o(e,[n]),e)}const I=Symbol(`removed`);function L(t,n){let r=/* @__PURE__ */ new Map,i=a=>{let o=r.get(a);if(o!==void 0)return o;let s=R(t,a),c=s===void 0?R(n,a)!==void 0:e(s)&&typeof s.$ref==`string`&&i(s.$ref);return r.set(a,c),c},a=t=>{if(Array.isArray(t))return t.map(a).filter(e=>e!==I);if(!e(t))return t;if(typeof t.$ref==`string`&&i(t.$ref))return I;let n={};for(let[e,r]of Object.entries(t)){let t=a(r);t!==I&&(n[e]=t)}return s(t,n)},o=a(t);return o===I?void 0:o}function R(t,n){if(!n.startsWith(`#/`))return;let r=t;for(let t of m.parse(n)){if(!(e(r)||Array.isArray(r))||!Object.hasOwn(r,t))return;r=r[t]}return r}function z(t,n){switch(t.kind){case`operation`:{let r=e(n)&&n[`x-webhooks`]?`x-webhooks`:`webhooks`;return[t.source===`webhooks`?r:`paths`,t.pathName,t.httpVerb]}case`schema`:return[`components`,`schemas`,t.name];case`channel`:return[`channels`,t.channelId];case`async-operation`:return[`operations`,t.operationId];default:return[]}}function B(t,n){let[r,...i]=n;if(r===void 0){if(!e(t))return t;let n={...t};return delete n[p],n}return!e(t)||!Object.hasOwn(t,r)?t:{...t,[r]:B(t[r],i)}}function V(t,n,r=!1){if(Array.isArray(t)){let e=t.map(e=>V(e,n));return e.some((e,n)=>e!==t[n])?e:t}if(!e(t))return t;let i;for(let[e,a]of Object.entries(t)){let o=(r||e===`description`||e===`summary`||e===`x-summary`)&&(typeof a==`string`?a.includes(`{%`):f(a))?n(a):V(a,n,e===`x-enumDescriptions`);o!==a&&((i??={...t})[e]=o)}return i??t}async function H(e,t){if(!e.includes(`{%`))return e;let{parse:n,print:r,visit:i}=await import(`graphql`);return r(i(n(e,{noLocation:!0}),{enter(e){let n=`description`in e?e.description:void 0;if(n?.value.includes(`{%`))return{...e,description:{...n,value:t(n.value)}}}}))}function U(e,t){let n=[],r=e=>{if(W(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`||e.nodeType===`overview-section-wrapper`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function W(e){let t=G(e);return t===void 0||r(a(t,[`anonymous`]))}function G(e){let t=e[p];if(t!==void 0)return i(t)?t:{}}function K(t){return e(t)&&t.type===`document`}function q(e){return t.reset(),e.map(e=>{let n=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
|
|
25
|
+
`,1)[0]??``);if(!n)return null;let r=n[1].trim();return{heading:r,anchor:t.slug(r)}})}export{b as MAX_MARKDOWN_SLICE_LENGTH,x as buildApiDocsMarkdownCopies};
|
|
@@ -4,7 +4,7 @@ import type { PluginIO } from '../../../types/io.js';
|
|
|
4
4
|
import type { JsonObject } from '../../../../database/schema.js';
|
|
5
5
|
/**
|
|
6
6
|
* The api options one config supplies for `filePath`, plus the entry's `rbac`;
|
|
7
|
-
* `configDir` anchors `apis.*.root`.
|
|
7
|
+
* `configDir` anchors `apis.*.root` and `grpc.importPaths`.
|
|
8
8
|
*/
|
|
9
9
|
export declare function readApiOptionsFromConfig(config: Pick<NestedConfig, 'apis'>, filePath: string, configDir?: string): Record<string, unknown>;
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{toPosixPath as t}from"../../../../../shared/utils/to-posix-path.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{isMissingError as r}from"../../../../../shared/utils/is-missing-error.js";import{NESTED_CONFIG_FILENAME as i,deepMergeConfig as a,parseNestedConfig as o,resolveGrpcImportPaths as s}from"../../../../config.js";import{contentIgnoreMatcherOf as c}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as l}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as u,mockPathPrefix as d}from"../../../types/api-entity.js";import{withPathPrefix as f}from"../../../../../shared/path-prefix.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as p}from"./shared.js";import{posix as m}from"node:path";import{FEEDBACK_TYPES as h}from"@redocly/theme/core/constants";import{decoratorTypes as g,preprocessorTypes as _}from"@redocly/config";const v=[`openapi`,`asyncapi`,`graphql`,`grpc`];function y(e,t,n){let r=k(t),i=Object.values(e.apis??{}),a=e=>k(m.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function b(e,t,n=``){let r=y(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of v)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.grpc?.importPaths!==void 0&&(i.importPaths=s(r.grpc.importPaths,n).folders),r.rbac!==void 0&&(i.rbac=r.rbac),i}async function x(e,t,n,r,i=n){let o=E(t,r,``),s=await T(e,i,c(t));return s===null?a(o,b(t,n)):a(a(o,D(s.config,r,s.dir)),b(s.config,n,s.dir))}const S=[...g,..._];async function C(e,t,r,i=r){let o=await T(e,i,c(t)),s=o===null?[t,y(t,r,``)]:[t,o.config,y(o.config,r,o.dir)],l={};for(let e of s){if(!n(e))continue;let t={};for(let r of S)n(e[r])&&(t[r]=e[r]);l=a(l,t)}return{config:l,configDir:o?.dir??``}}async function w(e,t,n){return(await T(e,n,c(t)))?.config.feedback}async function T(e,t,n){for(let r=m.dirname(t);r!==`.`&&r!==`/`;r=m.dirname(r)){let t=m.join(r,i);if(n(t))continue;let a=await O(e,t);if(a!==null)return{config:a,dir:r}}return null}function E(e,t,n){if(t===`arazzo`)return{};let r=e[t]??{};return t===`grpc`&&e.grpc?.importPaths!==void 0?{...r,importPaths:s(e.grpc.importPaths,n).folders}:r}function D(e,t,n){let r={...E(e,t,n)};return e.mockServer&&(r.mockServer=e.mockServer),r}async function O(e,t){let n;try{n=await e.readFile(t)}catch(e){if(r(e))return null;throw e}return o(n,t).config}function k(e){return m.normalize(t(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function A(t,r,i){let a=n(t.mockServer)?t.mockServer:{},o={...r.mockServer,...a};if(i===void 0||o.off===!0||!e(r,`mockServer`))return t;let s=f(u+d(i));return{...t,mockServer:{url:s,position:`first`,description:`Mock server`,...o}}}function j(e,t,n){if(n===`grpc`)return e;let r=e=>e.split(`/`).map(encodeURIComponent).join(`/`),i=n===l,a=i?p.graphql:p.bundle,o=(i?[t]:[`.json`,`.yaml`].map(e=>t.replace(/\.[^./]+$/u,e))).map(e=>({url:f(`${a}/${r(e)}?download`),title:m.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:o,replayDefinitionUrl:o[0]?.url}}function M(e){return f(`${p.bundle}/${e}`)}const N={[h.RATING]:`Rate this section`,[h.SENTIMENT]:`Was this section helpful?`,[h.MOOD]:`Was this section helpful?`,[h.COMMENT]:`Share your feedback about this section`,[h.SCALE]:`How would you rate this section?`};function P(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?N[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{b as readApiOptionsFromConfig,C as resolveApiBundleConfig,x as resolveApiOptions,w as resolveNestedFeedback,M as schemaCatalogLink,j as withDownloadUrls,P as withFeedbackOption,A as withMockServerOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{
|
|
1
|
+
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{parseMarkdownCached as r}from"../../../../markdown/utils/parse-cache.js";import{markdocAstToText as i}from"../../../../markdown/search/to-text.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as o}from"./implied-discriminators.js";import{createHash as s}from"node:crypto";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{ApiDocsSearchIndexer as l,extractFullText as u,isOperationName as d}from"@redocly/api-docs/server";const f=`API Reference`;function p(e,t,n={}){let r=b(e.store)?e.store:{},i=a(t,e.specType,{warn:n.warn??(()=>{})}),s=o(i),c=new l(e.basePath,r.schemaStore,b(s)?s:void 0,{exampleStore:r.exampleStore,graphqlMeta:r.graphqlMeta,formatDescription:m}),u=e=>{for(let t of e)c.addItem(t),b(t)&&Array.isArray(t.items)&&u(t.items)};u(e.items);let d=[],f=/* @__PURE__ */ new Set,p=[],y=h(t),x=/* @__PURE__ */ new Map;return{docs:c.getResult().map(t=>{let r=(x.get(t.id)??0)+1;x.set(t.id,r);let i=r===1?t.id:`${t.id}#${r}`;for(let e of t.parameters??[]){let t=_(e),n=t.fragmentKey;f.has(n)||(f.add(n),d.push(t));let r={docKey:i,fragmentKey:n,place:e.place,anchor:v(e.deepLink)};e.path&&e.path.length>0&&(r.path=e.path),p.push(r)}let a=g(t,i,n);return y&&t.url===e.basePath&&(a.title=y),a}),fragments:d,uses:p}}const m=e=>typeof e==`string`&&e.includes(`{%`)?i(r(e)).replace(/\s+/g,` `):u(e);function h(e){let t=b(e)&&b(e.info)?e.info:{};if(typeof t.title!=`string`||t.title===``)return;let n=t.version;return typeof n==`string`&&n!==``||typeof n==`number`?`${t.title} (${n})`:t.title}function g(r,i,a){let o=r.httpPath?y(r.httpPath):void 0,s={...a.facets},l=r.isAdditionalOperation?r.httpMethod:r.httpMethod&&d(r.httpMethod)?r.httpMethod.toLowerCase():void 0;l&&(s[e]=l,o&&(s[t]=o));let u={docKey:i,routeSlug:r.url,title:y(r.title),text:y(r.text),groupKey:a.groupKey??`API Reference`,facets:s},f=r[c];return n(f)&&(u.rbacScope=f),r.httpMethod&&(u.httpMethod=r.httpMethod),o&&(u.httpPath=o),r.deprecated&&(u.deprecated=!0),r.isAdditionalOperation&&(u.isAdditionalOperation=!0),r.badges&&r.badges.length>0&&(u.badges=r.badges),u}function _(e){let t={name:y(e.name),description:y(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:s(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function v(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function y(e){return Array.isArray(e)?e.join(` `):e}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{f as API_DOCS_SEARCH_GROUP,p as buildApiDocsSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../shared/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i!==`grpc`&&i===`graphql`===n})??null}async function p(n,a){let o=e(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new r(t(a),n.request.teams).getResponse():i()}function m(e,t,n,r,i){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(n,200,{...u,"Content-Type":r,...o?{"Content-Disposition":a(i)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let r=e.req.param(`api`)??``,i=await f(t,r,!1);if(!i)return p(t,r);let a=n(await t.entities.load(i.key),i.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(r),s=d(c.basename(String(i.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(a,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(a,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{API_FUNCTION_ENTITY_TYPE as e}from"../constants.js";import{stripPathPrefix as t}from"../../../../../shared/path-prefix.js";import{compareApiFunctionRoutes as n}from"../route-path.js";import{isSubprocessError as r}from"../../../../../server/subprocess/runner.js";import{errorMessage as i}from"../../../../../shared/utils/error-message.js";import{resolveApiFunctionAccess as a,resolveRbacMatcher as o}from"./access.js";import{sendApiFunctionEvent as s}from"./api-function-telemetry.js";import{BodyTooLargeError as c,MAX_REQUEST_BODY_BYTES as l,MAX_RESPONSE_BODY_BYTES as u,deserializeResponse as d,serializeRequest as f}from"./serialize.js";import{invoke as p}from"./invoke.js";import{fileURLToPath as m}from"node:url";import{getCookie as h}from"hono/cookie";import{TrieRouter as g}from"hono/router/trie-router";import{getPath as _,tryDecodeURIComponent as v}from"hono/utils/url";const y=1048576,b=m(import.meta.url);function x(e){let{method:t,honoPath:n,sourcePath:r}=e.metadata??{};return typeof t==`string`&&typeof n==`string`&&typeof r==`string`?{method:t,honoPath:n,sourcePath:r}:null}const S=/* @__PURE__ */ new WeakMap;function C(e){let t=S.get(e);if(!t){t=new g;let r=e.map(x).filter(e=>e!==null);for(let e of r.sort(n))t.add(e.method,e.honoPath,e);S.set(e,t)}return t}function w(e,t,n){let r=C(e),i=t.toUpperCase(),[[a]]=r.match(i===`HEAD`?`GET`:i,n);if(!a)return null;let[o,s]=a,c=Object.fromEntries(Object.entries(s).map(([e,t])=>{let n=v(t);return[e,o.honoPath.includes(`:${e}{.+}`)?n.split(`/`).filter(Boolean):n]}));return{sourcePath:o.sourcePath,params:c}}function T(e){let t={};for(let n of new Set(e.searchParams.keys())){let r=e.searchParams.getAll(n);t[n]=r.length===1?r[0]:r}return t}const E=1048576,D=`Request body size exceeded limit of ${l/E} MB.`,O=`Response size exceeded limit of ${u/E}MB`,k=1e4,A=`Promise timed out after ${k} ms`;function j(e,t){return Response.json({message:t},{status:e,headers:{"Cache-Control":`no-store`}})}function M(e,t){switch(e){case`timeout`:return N(504,`Timeout exceeded`,A);case`input-too-large`:return N(413,D);case`output-too-large`:case`response-too-large`:return N(500,O);default:return N(500,import.meta.env.DEV?t:`Internal server error`,t)}}function N(e,t,n=t){return{response:j(e,t),failure:n}}async function P(n,r,c){let l=t(_(n.req.raw));if(l===null)return r();let u=new URL(c.request.url),d=w(await c.entities.list({type:e}),c.request.method,l);if(!d)return r();n.set(`realmApiFunctionResponder`,`runtime`);let f=o(c.config);if(f){let e=a(f,{sourcePath:d.sourcePath,pathname:l,teams:c.request.teams});if(!e.allow)return j(e.status,e.status===401?`Unauthorized`:`Forbidden`)}let{subprocess:p}=c;if(!p)return j(501,`API functions do not run on this host.`);let m=(e,t)=>s({sourcePath:d.sourcePath,status:e,failure:t},{logger:c.logger}),h;try{h=await F(n,c,p,d,u)}catch(e){throw m(500,i(e)),e}return m(h.response.status,h.failure),h.response}async function F(e,t,n,i,a){let o;try{o={modulePath:n.resolveContentModule(i.sourcePath),request:await f(e.req.raw,l),params:i.params,query:T(a),cookies:h(e),user:{teams:t.request.teams,claims:{...t.request.viewer},email:t.request.viewer?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:t.request.viewer?.isAuthenticated??!1},config:t.config,baseUrl:a.origin}}catch(e){if(e instanceof c)return M(`input-too-large`,e.message);throw e}let s;try{s=await n.run({modulePath:b,exportName:`invoke`,input:o,reuse:!import.meta.env.DEV,timeoutMs:k,maxInputBytes:Math.ceil(4/3*l)+y,maxOutputBytes:Math.ceil(4/3*u)+y})}catch(n){if(!r(n))throw n;return n.code===`output-too-large`&&e.set(`realmApiFunctionResponder`,`project`),t.logger?.error(`API function ${i.sourcePath} failed (${n.code}): ${n.message}`),M(n.code,n.message)}if(e.set(`realmApiFunctionResponder`,`project`),!s.ok)return t.logger?.error(`API function ${i.sourcePath} failed (${s.code}): ${s.stack??s.message}`),M(s.code,s.message);let p=d(s.response);return p.headers.has(`cache-control`)||p.headers.set(`Cache-Control`,`no-store`),{response:p}}export{P as dispatch,p as invoke,w as matchApiFunction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{isAttributionRemoved as o,isPlanFeatureGranted as s}from"../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{isAttributionRemoved as o,isPlanFeatureGranted as s}from"../../../../shared/plan-gates.js";import{isObject as c}from"../../../../shared/utils/is-object.js";import{isAiHidden as l}from"../../../../shared/ask-ai/config-gate.js";import{APP_DATA_STATIC_DATA_SLUG as u}from"../../../../shared/constants/app-data.js";import{splitUrlSuffix as d}from"../../../../shared/utils/routes/split-url-suffix.js";import{toNavItemRbacAnnotation as f}from"../../../../shared/rbac/filter.js";import{resolvePageTarget as p}from"../../../../shared/utils/routes/resolve-page-target.js";import{listConfiguredProducts as m}from"../../../products.js";import{collectVersionGroups as h,findVersionedDirectories as g}from"../../../versions/version-groups.js";import{publicLink as _}from"../../../versions/public-link.js";import{linkedPageAccess as v}from"../../utils/link-access.js";import{loadSidebarSubtreeLabel as y}from"../../utils/sidebar-label.js";import{resolveBannerForAppData as ee}from"./banner.js";import{resolveLogoForAppData as te}from"./logo.js";import{resolveNavbarIconsForAppData as b}from"./navbar-icons.js";import{resolveHtmlForAppData as x}from"./html.js";import{resolveSeoForAppData as S}from"./seo.js";import{productConfigPath as C,productLandingLink as w,readProductConfig as T,resolveProductAssetsForAppData as E}from"./products.js";import{dirname as D,resolve as O}from"node:path";import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";const A=`internal.app-data`,j=`1.35.0`,M=i(A,`app-data`);function N(e){return c(e)&&typeof e.owner==`string`&&`value`in e}const P=r(M,async e=>{let n=new Set(e.pluginRegistry.listFinalizePlugins().map(e=>e.id)),r={};for(let[t,i]of Object.entries(e.args.fragments??{}))N(i)&&n.has(i.owner)&&(r[t]=i.value);let i=await te(e.config.logo,e.markdown,e.file.path);if(Object.keys(i.logo).length>0){let e=c(r.theme)?r.theme:{};r.theme=t({...e,logo:i.logo})}let a=await ee(e.config.banner,e);if(a){let e=c(r.theme)?r.theme:{};r.theme=t({...e,banner:a.banner})}let o=await b(c(r.theme)?r.theme.navbar:void 0,e.markdown,e.file.path);if(o){let e=c(r.theme)?r.theme:{};r.theme=t({...e,navbar:o.navbar})}let s=await b(c(r.theme)?r.theme.footer:void 0,e.markdown,e.file.path);if(s){let e=c(r.theme)?r.theme:{};r.theme=t({...e,footer:s.navbar})}let l=await E(c(r.theme)?r.theme.products:void 0,e.markdown,e.file.path);if(l){let e=c(r.theme)?r.theme:{};r.theme=t({...e,products:l.products})}let u=await x(e.config,e.markdown,e.file.path,t=>e.io.readFile(O(D(e.file.absolutePath),t)),e.logger);u&&(r.html=t(u.html));let d=await S(r.seo,e.markdown,e.file.path);d&&(r.seo=d.seo);let f=[i,a,o,s,l,u,d];return{value:r,entityDeps:f.flatMap(e=>e?.deps??[]),assetUsages:f.flatMap(e=>e?.assetUsages??[])}});function F(e){return{isSystem:!0,key:u,kind:`loader`,type:null,metadata:null,loaderArgs:{pluginVersion:j},loaderId:M,pluginId:A,shouldInvalidateValue:!1,value:null,version:null,fragmentUpdates:e.fragmentUpdates}}const I=e({id:A,version:j,async finalize(e){let r=await h({io:e.io,routes:e.routes,versionedDirectories:g(e.routes.all())}),i=e=>e&&_(e,r),a=t=>t&&{slug:_(t,r),loadLabel:()=>y(e.entities,t)},o=t=>a(e.routes.byFilePath(t)),s=t=>a(e.routes.bySlug(t)),l=t=>v(t,e.routes,r),u=await V(e.config,o,s,e.logger,l),d=await R(e,o,s,i,l);if(Object.keys(d).length>0){let e=c(u.theme)?u.theme:{};u.theme=t({...e,products:d}),u.pageProducts=n(Object.values(d).map(L))}return{appData:u}},loaders:[P]});function L(e){let{name:t,slug:n,configOverride:r}=e,i={name:t,slug:n},a=r?.analytics?.ga;return a&&(i.ga=a),i}async function R(e,n,r,i,o){let s={};for(let t of m(e.config)){let c=await w(t,e.routes,e.io,i);if(c===void 0){e.logger.warn(`Product "${t.id}" is left out of the product picker: "${t.folder}" has no page.`);continue}let l={name:t.name,folder:t.folder,slug:t.slug,link:c,[k]:o(c)??void 0};t.icon!==void 0&&(l.icon=t.icon);let u=C(t.folder),d=await e.io.exists(u)?await z(T(await e.io.readFile(u),u),{page:Q(n,r,u,e.logger),access:o},a(e.config),e.config):{};Object.keys(d).length>0&&(l.configOverride=d),s[t.id]=l}return t(s)}async function z(e,t,n,r){let i={},a=await K(e.navbar,t),o=await G(e.footer,t),c=W(e.breadcrumbs,t);return e.logo&&(i.logo=e.logo),a&&(i.navbar=a),o&&(i.footer=o),c&&s(r,`breadcrumbs`)&&(i.breadcrumbs=c),e.feedback&&(i.feedback=e.feedback),e.sidebar&&(i.sidebar=e.sidebar),e.codeSnippet&&(i.codeSnippet=e.codeSnippet),e.palette&&(i.palette=e.palette),e.search&&(i.search=await B(e.search,n,t)),e.analytics?.ga&&s(r,`analytics`)&&(i.analytics={ga:e.analytics.ga}),i}async function B(e,n,r){let i={...n},a=await q(e?.suggestedPages,r);return e?.hide!==void 0&&(i.hide=e.hide),e?.placement!==void 0&&(i.placement=e.placement),e?.shortcuts!==void 0&&(i.shortcuts=e.shortcuts),a.length>0&&(i.suggestedPages=a),t(i)}async function V(e,n,r,i,s=()=>void 0){let c={},l={page:Q(n,r,ie,i),access:s},u=await K(e.navbar,l),d=await G(e.footer,l),f=e.seo?.projectTitle,p=W(e.breadcrumbs,l),m={...u?{navbar:u}:{},...d?{footer:d}:{},...p?{breadcrumbs:p}:{},markdown:e.markdown,navigation:e.navigation,userMenu:await X(e.userMenu,l),feedback:e.feedback,consent:e.consent,...f?{seo:{projectTitle:f}}:{},aiAssistant:H(e),mcp:U(e),search:await B(e.search,a(e),l),sidebar:e.sidebar,versionPicker:e.versionPicker,codeSnippet:e.codeSnippet,palette:e.palette};if(e.colorMode&&(m.colorMode=e.colorMode),Object.keys(m).length>0&&(c.theme=m),e.analytics&&(c.analytics=e.analytics),e.planGates&&(c.removeAttribution=o(e)),e.removeAttribution===!0&&(c.removeConsoleAttribution=!0),e.seo){let{projectTitle:t,llmstxt:n,...r}=e.seo;Object.keys(r).length>0&&(c.seo=r)}return t(c)}function H(e){let t=l(e),n=e.aiAssistant?.trigger;return{...e.aiAssistant,hide:t,trigger:{...n,hide:n?.hide??t}}}function U(e){let t=e.mcp?.hide===!0;return{hide:t,docs:{hide:t}}}function W(e,n){if(!e)return null;let r={};e.hide!==void 0&&(r.hide=e.hide);let i=(e.prefixItems??[]).map(e=>{let t=e.page?n.page(e.page)?.link:void 0;return{icon:$(e.icon),label:$(e.label)??``,labelTranslationKey:$(e.labelTranslationKey),link:t,[k]:Y(n,t)}});return i.length>0&&(r.prefixItems=i),Object.keys(r).length>0?t(r):null}async function G(e,n){if(!e)return null;let r={hide:e.hide===!0},i=await q(e.items,n);return e.copyrightText!==void 0&&(r.copyrightText=e.copyrightText),e.logo&&(r.logo=e.logo),i.length>0&&(r.items=i),t(r)}async function K(e,n){if(!e)return null;let r={},i=await q(e.items,n);return e.hide!==void 0&&(r.hide=e.hide),i.length>0&&(r.items=i),Object.keys(r).length>0?t(r):null}async function q(e,t){return Array.isArray(e)?(await Promise.all(e.map(e=>J(e,t)))).filter(e=>e!==null):[]}async function J(e,n){if(typeof e==`string`)return J({page:e},n);if(!c(e))return null;if(typeof e.separator==`string`)return t({...Z(e),label:e.separator,type:`separator`});let r=await q(e.items,n),i=re(e,n.page),a=i?.link,o=e.rbac===void 0?Y(n,a):void 0,s=$(e.label)??$(e.group)??(i?i.anchor??await i.loadLabel?.()??i.link:``);return typeof e.group==`string`||r.length>0?t({...Z(e),...a?{link:a}:{},...r.length>0?{items:r}:{},label:s,labelTranslationKey:$(e.groupTranslationKey)??$(e.labelTranslationKey),type:`group`,[k]:o}):a?t({...Z(e),external:oe(e.external),label:s,link:a,type:`link`,[k]:o}):null}function Y(e,t){return t===void 0?void 0:e.access(t)??void 0}async function X(e,n){if(!e)return;let r=[];for(let t of e.items??[])r.push({...t,href:t.link});let i=await q(r,n);return t({...e,menu:i.length>0?i:void 0})}function Z(e){let t=ae(e,[`additionalProps`,`expanded`,`labelTranslationKey`,`languageInsensitive`,`linePosition`,`linkedSidebars`,`menuStyle`,`selectFirstItemOnExpand`,`separatorLine`,`target`,`version`]),n=ne(e.icon);return n.icon&&(t.icon=n.icon),n.srcSet&&(t.srcSet=n.srcSet),{...t,...f(e.rbac)}}function ne(e){return typeof e==`string`?{icon:e}:c(e)&&typeof e.srcSet==`string`?{srcSet:e.srcSet}:{}}function re(e,t){return typeof e.href==`string`&&e.href.trim()!==``?{link:e.href.trim()}:typeof e.page==`string`&&e.page.trim()!==``?t(e.page):null}const ie=`redocly.yaml`;function Q(e,t,n,r){let i={bySlug:e=>t?.(e),byFilePath:t=>e?.(t)};return e=>{let{path:t,suffix:a,anchor:o}=d(e.trim()),s=p(t,n,i);return s.kind===`escaped`?(r?.warn(`Config page reference escapes the content root`,{page:e}),null):s.kind===`missing`?(r?.warn(`Config page has no matching route`,{page:e}),{link:e.trim()}):{link:`${s.value.slug}${a}`,anchor:o,loadLabel:s.value.loadLabel}}}function ae(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function $(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function oe(e){return typeof e==`boolean`?e:void 0}export{A as APP_DATA_PLUGIN_ID,j as APP_DATA_PLUGIN_VERSION,M as APP_DATA_STATIC_DATA_LOADER_ID,u as APP_DATA_STATIC_DATA_SLUG,I as appDataContentPlugin,F as appDataSystemEntityDescriptor,V as buildConfigAppData,N as isAppDataFragment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{resolveContentPath as e}from"../../../../shared/utils/resolve-content-path.js";import{isLocalImagePath as t}from"../assets/extensions.js";import{safeDecodeURI as n}from"../../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as r,parseSrcSet as i}from"../assets/srcset.js";const a=[`favicon.png`,`favicon.svg`,`favicon.ico`];async function o(e={},t,n){let r={},i=[],o=[];if(e.image!==void 0){let[a,c,l]=await s(e.image,t,n);r.image=a,i.push(...c),o.push(...l)}if(e.srcSet!==void 0){let[a,s,l]=await c(e.srcSet,t,n);r.srcSet=a,i.push(...s),o.push(...l)}if(e.favicon!==void 0){let[a,c,l]=await s(e.favicon,t,n);r.favicon=a,i.push(...c),o.push(...l)}else for(let e of a){i.push({kind:`file`,path:e});let n=await t.resolveImageReference(`/${e}`,``);if(n.result.kind===`assetRef`){r.favicon=n.result.url,o.push(...n.assetUsages);break}}return e.altText!==void 0&&(r.altText=e.altText),e.link!==void 0&&(r.link=e.link),{logo:r,deps:i,assetUsages:o}}async function s(r,i,a){let o=t(r)?e(r,a):null;if(o===null)return[r,[],[]];let{result:s,entityDeps:c,assetUsages:l}=await i.resolveImageReference(o,``);return s.kind===`assetRef`?[s.url,c,l]:[`/${o}`,[{kind:`file`,path:n(o)}],[]]}async function c(e,t,n){let a=i(e);if(a===null||a.length===0)return[e,[],[]];let o=[],c=[],l=await Promise.all(a.map(async e=>{let[r,i,a]=await s(e.src,t,n);return o.push(...i),c.push(...a),{src:r,descriptor:e.descriptor}}));return[r(l),o,c]}export{s as resolveConfigImagePath,c as resolveConfigImageSrcSet,o as resolveLogoForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{
|
|
1
|
+
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{parseNestedConfig as r}from"../../../config.js";import{PRODUCT_CONFIG_FILENAME as i,isInFolder as a}from"../../../products.js";import{resolveConfigImagePath as o,resolveConfigImageSrcSet as s}from"./logo.js";import{resolveNavbarIconsForAppData as c}from"./navbar-icons.js";import{SIDEBAR_FILENAME_REGEX as l}from"../sidebar/index.js";import u from"js-yaml";function d(e){return e===``?i:`${e}/${i}`}function f(e,t){try{return r(e,t).config}catch{return{}}}async function p(e,r,i,o){let s=r.bySlug(e.slug===`/`?`/`:e.slug.slice(0,-1));if(s?.originFilePath&&a(s.originFilePath,e.folder))return o(s);let[c]=(await i.glob(e.folder===``?`**`:`${e.folder}/**`)).filter(e=>l.test(e)).sort((e,t)=>e.split(`/`).length-t.split(`/`).length||e.localeCompare(t));if(c){let e=d(m(await i.readFile(c)),c);if(e!==void 0)return e}let[u]=r.inDirectory(e.folder);return u?o(u):void 0;function d(e,n){if(Array.isArray(e))for(let r of e){if(!t(r))continue;let e=f(r,n),i=e?o(e):void 0;if(i!==void 0)return i;if(typeof r.href==`string`&&r.href.trim()!==``)return r.href.trim();let a=d(r.items,n);if(a!==void 0)return a}}function f(e,t){if(typeof e.page==`string`){let i=n(e.page,t);return i===null?void 0:r.byFilePath(i)}if(typeof e.directory==`string`){let i=n(e.directory,t);return i===null?void 0:r.inDirectory(i)[0]}}}function m(e){try{return u.load(e)}catch{return}}async function h(n,r,i){if(!t(n))return null;let a=[],l=[],u={};for(let[e,f]of Object.entries(n)){if(!t(f)||typeof f.folder!=`string`)continue;let n={...f};if(typeof f.icon==`string`){let[e,t,s]=await o(f.icon,r,i);n.icon=e,a.push(...t),l.push(...s)}if(t(f.configOverride)){let e={...f.configOverride},i=d(f.folder);if(t(e.logo)){let{favicon:t,...n}=e.logo;if(typeof n.image==`string`){let[e,t,s]=await o(n.image,r,i);n.image=e,a.push(...t),l.push(...s)}if(typeof n.srcSet==`string`){let[e,t,o]=await s(n.srcSet,r,i);n.srcSet=e,a.push(...t),l.push(...o)}Object.keys(n).length>0?e.logo=n:delete e.logo}for(let t of[`navbar`,`footer`]){let n=await c(e[t],r,i);n&&(e[t]=n.navbar,a.push(...n.deps),l.push(...n.assetUsages))}n.configOverride=e}u[e]=n}return{products:e(u),deps:a,assetUsages:l}}export{d as productConfigPath,p as productLandingLink,f as readProductConfig,h as resolveProductAssetsForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{buildContentAssetUrl as n}from"./url.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{buildContentAssetUrl as n}from"./url.js";import{getContentType as r}from"../../../../shared/mime.js";import{IMAGE_EXTENSIONS as i}from"./extensions.js";const a=`internal.assets`,o=`asset:`,s=e({id:a,version:`1.1.0`,content:{filter:{extensions:[...i]},extractFile(e){let i={kind:`image`,originalPath:e.path,hash:e.hash,url:n(e.path,e.hash),mimeType:r(e.path)};return{routes:[],entities:[t(i,{stableKey:`${o}${e.path}`})]}}}});export{a as ASSETS_PLUGIN_ID,o as ASSET_ENTITY_KEY_PREFIX,s as assetsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{CATALOG_CLASSIC_DEP_KEY as e}from"./contract.js";import{LoaderDataContext as t}from"../../../../../client/contexts.js";import{telemetry as n}from"../../../../../client/telemetry/telemetry.js";import{readSelectionsFromSearch as r,readTermFromSearch as i,resolveCatalog as a,selectFilterOption as o,toCatalogItems as s,toggleFilterOption as c,writeSelectionsToSearch as l}from"./catalog-filtering.js";import*as u from"react";import{useLocation as d,useNavigate as f}from"react-router";import{getBaseDataAttributes as p}from"@redocly/theme/core/utils";const m=[];function h(e){n.sendCatalogFilterChangedMessage([{...p(`catalogFilter`,`field`),type:e}])}function g(n){let p=d(),g=f(),_=u.useContext(t)[e],v=n.filters??m,[y,b]=u.useState(()=>r(p.search,v)),[x,S]=u.useState(()=>i(p.search)),C=u.useCallback(e=>{S(e),h(`term`)},[]),w=u.useMemo(()=>s(_?.items??[]),[_]);u.useEffect(()=>{let e=l(p.search,v,y,x);e!==p.search.replace(/^\?/,``)&&g({search:e},{replace:!0})},[v,x,p.search,g,y]);let T=u.useMemo(()=>a({filters:v,groupByFirstFilter:n.groupByFirstFilter,items:w,selections:y,term:x}),[n.groupByFirstFilter,v,x,w,y]);return u.useMemo(()=>({groups:T.groups,filters:T.filters.map((e,t)=>({...e,toggleOption:e=>{b(n=>c(n,t,e)),h(`toggle`),window.scrollTo(0,0)},selectOption:e=>{b(n=>o(n,v,t,e)),h(`select`),window.scrollTo(0,0)}})),filterTerm:x,setFilterTerm:C}),[C,v,x,T])}export{g as useCatalogClassic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{SIDEBAR_CONTRIBUTIONS_ENTITY_TYPE as s}from"../sidebar/contributions.js";import{CATALOG_CLASSIC_DEP_KEY as c}from"./client/contract.js";import{catalogEntityKey as l}from"./entity-key.js";import{buildCatalogCards as u,loadVersionGroups as d,pickDefaultVersions as f,resolveCatalogMembers as p}from"./resolve-items.js";import{catalogSidebarContributions as m}from"./sidebars.js";const h=`internal.catalog-classic`,g=`catalog-classic`,_=i(h,`catalog`),v=i(h,`sidebars`),y=i(h,`deliver`),b=t(_,async e=>{let t=p(e.args.items,e),{versionGroups:n,entityDeps:r}=await d(t,e),i=e.args.config.separateVersions?t:f(t,n),a=await u(i,n,e);return{value:{catalogId:e.args.catalogId,config:e.args.config,items:a},entityDeps:r}}),x=t(v,async e=>{let t=p(e.args.items,{routes:e.routes}),{versionGroups:n,entityDeps:r}=await d(t,e);return{value:await m(t,n,{label:e.args.title,link:e.args.slug},e),entityDeps:r}}),S=r(y,{filePath:`./server/deliver.ts`,importer:import.meta.url,exportName:`deliver`,cacheable:!0});function C(e){return Object.entries(e.catalogClassic??e.catalog??{})}const w=e({id:h,version:`1.9.0`,content:{extractAll(e){let t=[],n=[];for(let[r,i]of C(e.config)){let{items:e,...a}=i,u=o(String(i.slug)),d=typeof i.title==`string`?i.title:`API Catalog`;t.push(b.withArgs({catalogId:r,config:a,items:e},{stableKey:l(r),metadata:{sourcePath:u}}),x.withArgs({items:e,slug:u,title:d},{stableKey:`${l(r)}:sidebars`,type:s})),n.push({deps:{[c]:S.withArgs({catalogId:r})},metadata:{title:d},routeId:r,slug:u,template:g})}return{entities:t,routes:n}}},loaders:[b,x],server:{functions:[S]},templates:{[g]:a(n(`./client/template.tsx`,import.meta.url))}});export{_ as CATALOG_CLASSIC_LOADER_ID,h as CATALOG_CLASSIC_PLUGIN_ID,y as CATALOG_CLASSIC_SERVER_FN_ID,v as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,g as CATALOG_CLASSIC_TEMPLATE_ID,w as catalogClassicContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toStableJsonString as e}from"../../../database/utils/json.js";import{
|
|
1
|
+
import{toStableJsonString as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{L10N_DIR as n}from"../../../../shared/constants/l10n/defaults.js";import{normalizeRouteSlug as r}from"../../../../shared/utils/routes/normalize-route-slug.js";import"../../../../shared/utils/l10n.js";import{resolveContentPath as i}from"../../../../shared/utils/resolve-content-path.js";import{collectVersionGroups as a,findVersionedDirectories as o,versionsYamlPath as s}from"../../../versions/version-groups.js";import{publicLink as c}from"../../../versions/public-link.js";import{parseMarkdown as l}from"../../../markdown/utils/parse-cache.js";import{markdocAstToText as u}from"../../../markdown/search/to-text.js";import{createApiEntityKey as d}from"../../utils/api-entity-key.js";import{sidebarStartEntityKey as f}from"../sidebar/contributions.js";import{CATALOG_CARD_METADATA_ENTITY_TYPE as p}from"./card-metadata.js";import{resolve as m}from"node:path";import{REDOCLY_TEAMS_RBAC as h}from"@redocly/config";const g=`redocly.yaml`;function _(e,t){let n=[],r=e=>{if(typeof e.directory==`string`)n.push(...C(e,e.directory,t));else if(typeof e.page==`string`){let r=w(e,e.page,t);r&&n.push(r)}else typeof e.href==`string`&&n.push(T(e,e.href,t));for(let t of e.items??[])r(t)};for(let t of e??[])r(t);return n}async function v(e,t){let n=e.flatMap(e=>`route`in e?[e.route]:[]),r=o(n);return{versionGroups:await a({io:{exists:e=>t.io.exists(m(t.contentDir,e)),readFile:e=>t.io.readFile(m(t.contentDir,e))},routes:t.routes,versionedDirectories:r}),entityDeps:r.map(e=>({kind:`file`,path:s(e)}))}}function y(e,t){let n=/* @__PURE__ */ new Map;for(let[r,i]of e.entries()){let e=`route`in i?c(i.route,t,!0):`${r}`,a=`route`in i&&i.route.versionGroup!==null&&t.get(i.route.versionGroup)?.defaultVersion===i.route.version;(!n.has(e)||a)&&n.set(e,i)}return[...n.values()]}async function b(e,t){return P(e.route.metadata.title)??P(e.entry.label)??await A(e.route,t)??N(e.route.slug)}async function x(e,t,n){let r=await S(n.entities),i=[];for(let a of e)i.push(`route`in a?await E(a,t,r,n):{link:a.link,title:a.title});return i}async function S(e){let t=/* @__PURE__ */ new Map;for(let n of await e.list({type:p}))for(let{route:r,metadata:i}of await e.load(n.key))t.set(r,{...t.get(r),...i});return t}function C(e,r,a){let o=i(r,g);if(o===null)return a.logger?.warn(`Catalog directory reference escapes the content root`,{directory:r}),[];let s=a.routes.inDirectory(o);if(s.length===0)return a.logger?.warn(`Catalog directory matched no routes`,{directory:r}),[];let c=t(e.includeByMetadata)?e.includeByMetadata:void 0,l=o.startsWith(`${n}/`),u=[];for(let t of s){if(!l&&t.locale!==``)continue;let n=a.routes.get(t.slug);n&&M(j(n.metadata),c)&&u.push({route:n,entry:e})}return u}function w(e,t,n){let r=i(t,g);if(r===null){n.logger?.warn(`Catalog page reference escapes the content root`,{page:t});return}let a=n.routes.byFilePath(r),o=a&&n.routes.get(a.slug);if(!o){n.logger?.warn(`Catalog page has no matching route`,{page:t});return}return{route:o,entry:e}}function T(e,t,n){let i=t.startsWith(`/`)?n.routes.bySlug(r(t)):void 0,a=i&&n.routes.get(i.slug);return a?{route:a,entry:e}:{link:t,title:P(e.label)??t}}async function E(e,t,n,r){let{route:i}=e,a={...j(i.metadata),...n.get(i.slug)};delete a.rbac;let o=await b(e,r),s=k(a.description)??P(a.summary)??await O(i,r),l=F(a.tags),u=await D(i,t,r),d={link:c(i,t),title:o,metadata:a};return s!==void 0&&(d.description=s),l!==void 0&&(d.tags=l),u!==void 0&&(d.docsLink=u),i.version!==null&&(d.version=i.version),i.access!==null&&(d[h]=i.access),d}async function D(t,n,r){let i=f(t.slug);if(await r.entities.get(i)===null)return;let a=r.routes.get(await r.entities.load(i));if(a!==void 0&&a.slug!==t.slug&&e(a.access)===e(t.access))return c(a,n)}async function O(e,n){if(e.originFilePath===null)return;let r=d(e.originFilePath);if((await n.entities.get(r))?.type!==`api`)return;let i=await n.entities.tryLoad(r),a=t(i)&&t(i.info)?i.info:{};return P(a.summary)??k(a.description)}function k(e){let t=P(e);if(t!==void 0)return P(u(l(t)))}async function A(e,n){if(!e.sidebarSubtreeEntityKey)return;let r=await n.entities.tryLoad(e.sidebarSubtreeEntityKey);return t(r)?P(r.label):void 0}function j(e){let{metadata:n,...r}=e;return t(n)?{...r,...n}:r}function M(e,t){return!t||Object.entries(t).every(([t,n])=>{let r=e?.[t];return Array.isArray(n)?n.includes(r):r===n})}function N(e){return e.split(`/`).filter(Boolean).at(-1)??e}function P(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function F(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:void 0}export{x as buildCatalogCards,v as loadVersionGroups,y as pickDefaultVersions,_ as resolveCatalogMembers,b as resolveMemberTitle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./api-functions/constants.js";import{STATIC_FOLDER_PLUGIN_ID as e,STATIC_FOLDER_PREFIX as t,isStaticFolderPath as n,staticFolderContentPlugin as r}from"./static-folder/index.js";import{ASSETS_PLUGIN_ID as i,ASSET_ENTITY_KEY_PREFIX as a,assetsContentPlugin as o}from"./assets/index.js";import{APP_DATA_STATIC_DATA_SLUG as s}from"../../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as c}from"../../../shared/constants/route-deps.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as l,SIDEBAR_AGGREGATOR_LOADER_ID as u,SIDEBAR_FILENAME_REGEX as d,SIDEBAR_PLUGIN_ID as f,isTabbedSidebar as p,resolveAutoSidebar as m,sidebarContentPlugin as h}from"./sidebar/index.js";import{APP_DATA_PLUGIN_ID as g,APP_DATA_PLUGIN_VERSION as ee,APP_DATA_STATIC_DATA_LOADER_ID as _,appDataContentPlugin as v,appDataSystemEntityDescriptor as y,buildConfigAppData as b,isAppDataFragment as x}from"./app-data/index.js";import{apiDocsContentPlugin as S}from"./api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as C,apiFunctionsContentPlugin as w}from"./api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as T,CATALOG_CLASSIC_PLUGIN_ID as E,CATALOG_CLASSIC_SERVER_FN_ID as D,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as O,CATALOG_CLASSIC_TEMPLATE_ID as k,catalogClassicContentPlugin as A}from"./catalog-classic/index.js";import{L10N_PLUGIN_ID as j}from"./l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as M,l10nContentPlugin as N}from"./l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as P,MARKDOC_SEARCH_GROUP as F,MARKDOC_SIDEBAR_ITEM_LOADER_ID as te,MARKDOC_TEMPLATE_ID as I,markdocContentPlugin as L}from"./markdoc/index.js";import{mcpContentPlugin as R}from"./mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as z,MOCK_SERVER_ROUTE_PATH as B,mockServerContentPlugin as V}from"./mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as H,reactPageContentPlugin as U}from"./react-page/index.js";import{REVISIONS_PLUGIN_ID as W,revisionsContentPlugin as G}from"./revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as K,SCORECARD_CLASSIC_TEMPLATE_ID as q,scorecardClassicContentPlugin as J}from"./scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Y,SKILL_MARKDOWN_ROUTE_PATH as X,skillsContentPlugin as Z}from"./skills/index.js";import{VERSIONS_PLUGIN_ID as Q,versionsContentPlugin as $}from"./versions/index.js";function ne(){return[v,N,r,o,L,h,$,G,A,S,J,w,V,R,U,Z]}export{C as API_FUNCTIONS_PLUGIN_ID,g as APP_DATA_PLUGIN_ID,ee as APP_DATA_PLUGIN_VERSION,_ as APP_DATA_STATIC_DATA_LOADER_ID,s as APP_DATA_STATIC_DATA_SLUG,i as ASSETS_PLUGIN_ID,a as ASSET_ENTITY_KEY_PREFIX,T as CATALOG_CLASSIC_LOADER_ID,E as CATALOG_CLASSIC_PLUGIN_ID,D as CATALOG_CLASSIC_SERVER_FN_ID,O as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,k as CATALOG_CLASSIC_TEMPLATE_ID,l as FOLDER_SIDEBAR_FILENAME_REGEX,j as L10N_PLUGIN_ID,M as L10N_PLUGIN_VERSION,P as MARKDOC_DOCUMENT_LOADER_ID,F as MARKDOC_SEARCH_GROUP,te as MARKDOC_SIDEBAR_ITEM_LOADER_ID,I as MARKDOC_TEMPLATE_ID,z as MOCK_SERVER_PLUGIN_ID,B as MOCK_SERVER_ROUTE_PATH,H as REACT_PAGE_SEARCH_LOADER_KEY,W as REVISIONS_PLUGIN_ID,K as SCORECARD_CLASSIC_PLUGIN_ID,q as SCORECARD_CLASSIC_TEMPLATE_ID,u as SIDEBAR_AGGREGATOR_LOADER_ID,d as SIDEBAR_FILENAME_REGEX,f as SIDEBAR_PLUGIN_ID,c as SIDEBAR_ROUTE_DEP_KEY,Y as SKILLS_PLUGIN_ID,X as SKILL_MARKDOWN_ROUTE_PATH,e as STATIC_FOLDER_PLUGIN_ID,t as STATIC_FOLDER_PREFIX,Q as VERSIONS_PLUGIN_ID,S as apiDocsContentPlugin,w as apiFunctionsContentPlugin,v as appDataContentPlugin,y as appDataSystemEntityDescriptor,o as assetsContentPlugin,b as buildConfigAppData,A as catalogClassicContentPlugin,ne as createInternalContentPlugins,x as isAppDataFragment,n as isStaticFolderPath,p as isTabbedSidebar,N as l10nContentPlugin,L as markdocContentPlugin,R as mcpContentPlugin,V as mockServerContentPlugin,U as reactPageContentPlugin,m as resolveAutoSidebar,G as revisionsContentPlugin,J as scorecardClassicContentPlugin,h as sidebarContentPlugin,Z as skillsContentPlugin,r as staticFolderContentPlugin,$ as versionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{compareStrings as r}from"../../../../shared/utils/compare-strings.js";import{TRANSLATIONS_FILE_PATTERN as i}from"../../../../shared/constants/l10n/defaults.js";import{normalizeL10nConfig as a}from"../../../../shared/utils/l10n.js";import{collectSlugOverrides as o}from"../../utils/slug-overrides.js";import{L10N_PLUGIN_ID as s,L10N_TRANSLATIONS_ENTITY_TYPE as c,l10nTranslationsLoader as l}from"./translations-loader.js";const u=`0.2.0`,d=e({id:s,version:u,loaders:[l],content:{filter:{match:e=>i.test(e)},extractFile(e){return{routes:[],entities:[l.withArgs({path:e.path},{stableKey:`${c}:${e.path}`,type:c})]}}},async finalize(e){let r=a(e.config.l10n).locales,{localeContext:i}=e,{defaultLocale:s,locales:c}=i,l={},u=n(e.config,`l10n`)?await f(e,i):/* @__PURE__ */ new Map;for(let[e,t]of u)l[e]={translation:t};l[s]??={translation:{}};let d={defaultLocale:s,locales:r??[s,...c].map(e=>({code:e,name:e})),contentLocales:[...c],slugOverrides:o(e.routes.all(),i),translations:l};return{appData:t({l10n:d})}}});async function f(e,t){let n=await e.entities.list({type:c}),i=/* @__PURE__ */ new Map;for(let a of[...n].sort((e,t)=>r(e.key,t.key))){let n=await e.entities.load(a.key),r=n?.dir;if(r==null)continue;let o=r===``?t.defaultLocale:r;(r===``||t.isLocale(r))&&(i.has(o)||i.set(o,n.translation))}return i}export{s as L10N_PLUGIN_ID,u as L10N_PLUGIN_VERSION,d as l10nContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEntityLoader as e}from"../../../loaders/define.js";import{createPluginScopedId as t}from"../../utils/scoped-id.js";import{
|
|
1
|
+
import{createEntityLoader as e}from"../../../loaders/define.js";import{createPluginScopedId as t}from"../../utils/scoped-id.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{L10N_DIR as r,TRANSLATIONS_FILE_NAMES as i}from"../../../../shared/constants/l10n/defaults.js";import a from"js-yaml";const o=`internal.l10n`,s=`l10n-translations`,c=t(o,`translations`),l=RegExp(`^${r}/([^/]+)/(translations\\.ya?ml)$`,`i`),u=e(c,async e=>{let t=e.file.path,r=d(t);if(r===null)return{value:{dir:null,translation:{}},type:s,problems:[p(t,"Not loaded as UI-string translations: place the file at the project root or in `@l10n/<locale>/`.")]};let i;try{i=await e.io.readFile(e.file.absolutePath)}catch(e){return f(r,t,`reading failed`,e)}let o;try{o=a.load(i)}catch(e){return f(r,t,`invalid YAML`,e)}return o!=null&&!n(o)?f(r,t,`expected a key-value map`):{value:{dir:r,translation:o??{}},type:s}});function d(e){let t=e.toLowerCase();return i.some(e=>t===e)?``:l.exec(e)?.[1]??null}function f(e,t,n,r){let i=r instanceof Error?`: ${r.message}`:``;return{value:{dir:e,translation:{}},type:s,problems:[p(t,`Ignoring translations file: ${n}${i}.`)]}}function p(e,t){return{code:`configuration/l10n-translations-invalid`,message:t,location:{filePath:e}}}export{o as L10N_PLUGIN_ID,s as L10N_TRANSLATIONS_ENTITY_TYPE,c as L10N_TRANSLATIONS_LOADER_ID,u as l10nTranslationsLoader,d as translationsFileDir};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import
|
|
1
|
+
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import{DEFAULT_FEEDBACK_TYPE as r}from"@redocly/theme/core/constants";import*as i from"react";import{extendDetailsBehaviour as a}from"@redocly/theme/core/utils";import{jsx as o}from"react/jsx-runtime";import{useThemeConfig as s,useThemeHooks as c}from"@redocly/theme/core/hooks";import{useLoaderData as l}from"virtual:realm-runtime";import{Feedback as u}from"@redocly/theme/components/Feedback/Feedback";import{TableOfContent as d}from"@redocly/theme/components/TableOfContent/TableOfContent";import{CodeWalkthroughLayout as f}from"@redocly/theme/layouts/CodeWalkthroughLayout";import{DocumentationLayout as p}from"@redocly/theme/layouts/DocumentationLayout";function m(m){let h=l(e),{useSidebarSiblingsData:g}=c(),{markdown:_,feedback:v}=s(),{nextPage:y,prevPage:b}=g()??{},[x,S]=i.useState(null),C=i.useMemo(()=>h?t(h.ast):[],[h]);if(i.useEffect(()=>a(),[h]),!h)return null;let w=/* @__PURE__ */ o(n,{ast:h.ast,withPageActions:!0});return h.tagList?.includes(`code-walkthrough`)?/* @__PURE__ */ o(f,{children:w}):/* @__PURE__ */ o(p,{config:_,editPage:h.editPage,lastModified:h.lastModified,feedback:/* @__PURE__ */ o(u,{...v,type:v?.type??r,settings:v?.settings??{},path:m.page.slug??m.page.path}),nextPage:y,prevPage:b,tableOfContent:/* @__PURE__ */ o(d,{contentWrapper:x,headings:C}),children:/* @__PURE__ */ o(`div`,{ref:S,children:w})})}export{m as default};
|