@redocly/reef 0.140.0-next.1 → 0.140.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +419 -199
- package/dist/api-schemas/mcp-fetch-count.d.ts +2 -18
- package/dist/api-schemas/otel-traces.d.ts +7 -1345
- package/dist/api-schemas/otel-traces.js +1 -1
- package/dist/api-schemas/search-facets.d.ts +3 -31
- package/dist/api-schemas/search.d.ts +6 -52
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/eject/resolveEjectParams.js +1 -1
- package/dist/cli/generate/get-schema-template.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdocRenderer.js +1 -1
- package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +2 -0
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +1 -33
- package/dist/client/app/useGlobalData.d.ts +1 -1
- package/dist/client/providers/post-message/use-post-message.d.ts +1 -1
- package/dist/client/templates/api-docs/helpers.js +3 -3
- package/dist/compiled/@redocly/pii/index.mjs +1 -0
- package/dist/compiled/@redocly/pii/package.json +1 -0
- package/dist/compiled/svgo/svgo-node.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/markdoc/attributes/definition-path.d.ts +1 -1
- package/dist/markdoc/attributes/json-example-ref.d.ts +1 -1
- package/dist/markdoc/attributes/json-schema-ref.d.ts +1 -1
- package/dist/markdoc/attributes/parsed-yaml.d.ts +1 -1
- package/dist/markdoc/attributes/raw-content.d.ts +1 -1
- package/dist/markdoc/attributes/sample-from-json-schema.d.ts +1 -1
- package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +1 -1
- package/dist/markdoc/helpers/get-inner-text.d.ts +1 -1
- package/dist/markdoc/helpers/get-node-attribute.d.ts +1 -1
- package/dist/markdoc/helpers/get-variable.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-conditional-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-function.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-tag.d.ts +1 -1
- package/dist/markdoc/helpers/guards/is-variable.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.d.ts +1 -1
- package/dist/markdoc/helpers/parse-partials.js +1 -1
- package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
- package/dist/markdoc/helpers/set-node-attribute-value.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.d.ts +1 -1
- package/dist/markdoc/nodes/fence/index.js +1 -1
- package/dist/markdoc/nodes/gfm-list-item.d.ts +1 -1
- package/dist/markdoc/nodes/gfm-list-item.js +1 -1
- package/dist/markdoc/nodes/heading.d.ts +1 -1
- package/dist/markdoc/nodes/heading.js +1 -1
- package/dist/markdoc/nodes/index.d.ts +6 -165
- package/dist/markdoc/nodes/index.js +1 -1
- package/dist/markdoc/nodes/table.d.ts +1 -1
- package/dist/markdoc/nodes/table.js +1 -1
- package/dist/markdoc/nodes/text.d.ts +1 -1
- package/dist/markdoc/tags/json-example.js +1 -1
- package/dist/markdoc/tags/openapi-code-sample.js +1 -1
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/config/env-config.d.ts +26 -24
- package/dist/server/config/env-schema.d.ts +87 -326
- package/dist/server/config/env-schemas/api-urls.d.ts +2 -14
- package/dist/server/config/env-schemas/auth.d.ts +10 -32
- package/dist/server/config/env-schemas/catalog.d.ts +6 -9
- package/dist/server/config/env-schemas/database.d.ts +2 -8
- package/dist/server/config/env-schemas/environment-detection.d.ts +20 -18
- package/dist/server/config/env-schemas/feature-flags.d.ts +29 -33
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/config/env-schemas/organization-project.d.ts +3 -21
- package/dist/server/config/env-schemas/scorecards.d.ts +2 -6
- package/dist/server/config/env-schemas/search.d.ts +9 -15
- package/dist/server/config/env-schemas/server-config.d.ts +6 -31
- package/dist/server/config/env-schemas/site.d.ts +1 -5
- package/dist/server/config/env-schemas/ssr.d.ts +7 -12
- package/dist/server/config/env-schemas/telemetry.d.ts +1 -7
- package/dist/server/constants/common.d.ts +3 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/esbuild/plugins/dependency-resolver.js +1 -1
- package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
- package/dist/server/esbuild/plugins/themes-resolver.js +3 -3
- package/dist/server/external-plugins/resolve-external-plugins.js +1 -1
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/analytics/amplitude/index.js +1 -1
- package/dist/server/plugins/analytics/ga/build-scripts.js +6 -6
- package/dist/server/plugins/api-docs/definition-access.d.ts +22 -0
- package/dist/server/plugins/api-docs/definition-access.js +1 -0
- package/dist/server/plugins/api-docs/index.js +1 -1
- package/dist/server/plugins/api-docs/loader.d.ts +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +23 -23
- package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
- package/dist/server/plugins/config-parser/index.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/index.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-diagram-from-file.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-gallery.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.d.ts +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/errors.d.ts +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +1 -1
- package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -1
- package/dist/server/plugins/markdown/markdoc/functions/concat.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +5 -165
- package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
- package/dist/server/plugins/markdown/markdoc/partials.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/headings.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +1 -1
- package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -1
- package/dist/server/plugins/markdown/runtime-transform.d.ts +2 -2
- package/dist/server/plugins/markdown/runtime-transform.js +1 -1
- package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
- package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +1 -1
- package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
- package/dist/server/plugins/markdown/search/to-markdown.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.d.ts +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +4 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +2 -2
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -5
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
- package/dist/server/plugins/mcp/types.d.ts +10 -0
- package/dist/server/plugins/mcp/utils/available-tools.d.ts +5 -0
- package/dist/server/plugins/mcp/utils/available-tools.js +1 -0
- package/dist/server/plugins/mcp/workers/worker-context.d.ts +4 -0
- package/dist/server/plugins/mcp/workers/worker-context.js +1 -0
- package/dist/server/plugins/scorecard-classic/compute-scorecard.d.ts +2 -2
- package/dist/server/plugins/scorecard-classic/compute-scorecard.js +1 -1
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/shared-utils.js +1 -1
- package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +3 -3
- package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/store-config.d.ts +33 -0
- package/dist/server/store-config.js +1 -0
- package/dist/server/store.d.ts +14 -16
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/helpers/colors.d.ts +1 -1
- package/dist/server/tools/notifiers/logger.d.ts +4 -0
- package/dist/server/tools/notifiers/reporter.js +1 -1
- package/dist/server/types/plugins/api-routes.d.ts +4 -1
- package/dist/server/types/plugins/common.d.ts +2 -1
- package/dist/server/utils/codeframes/codeframes.d.ts +1 -1
- package/dist/server/utils/codeframes/yaml-ast.d.ts +1 -1
- package/dist/server/utils/decode-request-path.d.ts +2 -0
- package/dist/server/utils/decode-request-path.js +1 -0
- package/dist/server/utils/envs/env-boolean-string.d.ts +9 -3
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.d.ts +2 -0
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
- package/dist/server/utils/envs/interpolate-env-variables.d.ts +5 -1
- package/dist/server/utils/envs/interpolate-env-variables.js +1 -1
- package/dist/server/utils/envs/load-env-variables.js +1 -1
- package/dist/server/utils/envs/replace-env-variables-deep.d.ts +17 -9
- package/dist/server/utils/envs/replace-env-variables-deep.js +1 -1
- package/dist/server/utils/errors.d.ts +3 -0
- package/dist/server/utils/errors.js +1 -1
- package/dist/server/utils/globs.d.ts +12 -0
- package/dist/server/utils/globs.js +1 -1
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -1
- package/dist/server/utils/rbac-expand.js +1 -1
- package/dist/server/utils/rbac.d.ts +5 -1
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/web-server/auth.d.ts +2 -0
- package/dist/server/web-server/auth.js +2 -2
- package/dist/server/web-server/middleware/jsonValidatorMiddleware.d.ts +5 -325
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +1756 -1756
- package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +295 -295
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/error.js +1 -1
- package/dist/server/web-server/routes/helpers/process-redirects.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +2 -2
- package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +18 -18
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/utils/ssrf-safe-lookup.d.ts +2 -1
- package/dist/server/web-server/utils/ssrf-safe-lookup.js +1 -1
- package/dist/server/workers/mcp-tool-worker-methods.d.ts +7 -0
- package/dist/server/workers/mcp-tool-worker-methods.js +1 -0
- package/dist/server/workers/mcp-tool-worker-pool.d.ts +0 -1
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker.js +1 -1
- package/dist/server/workers/types.d.ts +4 -8
- package/dist/server/workers/worker-config.d.ts +33 -0
- package/dist/server/workers/worker-config.js +1 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/markdoc.d.ts +1 -1
- package/package.json +12 -12
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.d.ts +0 -6
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +0 -1
- package/dist/server/plugins/markdown/html/process-html-tokens.d.ts +0 -2
- package/dist/server/plugins/markdown/html/process-html-tokens.js +0 -1
- package/dist/server/plugins/markdown/source.d.ts +0 -4
- package/dist/server/plugins/markdown/source.js +0 -1
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +0 -4
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/mask-email.d.ts +0 -25
- package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/mask-subject.d.ts +0 -13
- package/dist/server/tools/notifiers/helpers/privacy/mask-subject.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.d.ts +0 -25
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.js +0 -1
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii.d.ts +0 -36
- package/dist/server/tools/notifiers/helpers/privacy/remove-pii.js +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RbacScopeItems } from '@redocly/config';
|
|
2
|
+
import type { BundledApiDefinition } from './loader.js';
|
|
3
|
+
/** What the download route needs to apply the API page's access rule to one definition. */
|
|
4
|
+
export type ApiDefinitionAccess = {
|
|
5
|
+
/** Content-relative source file (`customOutputRelativeFile || relativePath`). */
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
/** The API's base page slug, e.g. `/apis/internal`. */
|
|
8
|
+
slug: string;
|
|
9
|
+
/** `apis.<name>.rbac`; replaces the content rule when present. */
|
|
10
|
+
rbac?: RbacScopeItems;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The key of the definition that a download of `stem` on the GraphQL route (`/_spec-gql`) or
|
|
14
|
+
* on a bundle route (`/_bundle`, `/_spec`) describes; `stem` is the request path after the
|
|
15
|
+
* route prefix without its extension (`apis/museum` for `apis/museum.yaml`), so one bundle
|
|
16
|
+
* answers under `.json`, `.yaml` and `.yml`. A schema and a bundle of one stem have distinct keys.
|
|
17
|
+
*/
|
|
18
|
+
export declare function requestDefinitionAccessKey(isGraphql: boolean, stem: string): string;
|
|
19
|
+
/** The key of `definition` in the access map; undefined for one under the public static folder. */
|
|
20
|
+
export declare function definitionAccessKey(definition: Pick<BundledApiDefinition, 'relativePath' | 'type'>): string | undefined;
|
|
21
|
+
export declare function describeDefinitionAccess(definition: BundledApiDefinition, basePath: string): ApiDefinitionAccess;
|
|
22
|
+
//# sourceMappingURL=definition-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PUBLIC_STATIC_FOLDER as o}from"../../constants/common.js";import{removeTrailingSlash as i}from"../../../utils/url/remove-trailing-slash.js";import{resolveConfigRbac as n}from"./utils/resolve-config-rbac.js";import{replaceFileExtension as c}from"./utils/replace-file-extension.js";function s(e,r){return`${e?"graphql":"bundle"}:${r}`}function f(e){if(!e.relativePath.startsWith(o+"/"))return s(e.type==="graphql",c(e.relativePath,""))}function m(e,r){const t=n(e.config);return{sourcePath:e.customOutputRelativeFile||e.relativePath,slug:i(r),...t===void 0?{}:{rbac:t}}}export{f as definitionAccessKey,m as describeDefinitionAccess,s as requestDefinitionAccessKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as w,REDOCLY_TEAMS_RBAC as I}from"@redocly/config";import{mcpTagSchemas as ae,schemaDefinitionTag as ie,markdocParser as U,collectPreviousRouteSlugs as se}from"@redocly/api-docs";import{withPathPrefix as $}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as j,GRAPHQL_SPEC_SLUG as ne,PUBLIC_RBAC_SCOPE_ITEM as N}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ce,PUBLIC_API_DEFINITIONS_FOLDER as pe}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as O}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as ue}from"../../utils/paths.js";import{normalizeRouteSlug as le}from"../../../utils/path/normalize-route-slug.js";import{removeTrailingSlash as de}from"../../../utils/url/remove-trailing-slash.js";import{isTranslationFallback as me}from"../../fs/utils/is-translation-fallback.js";import{createSlugify as fe}from"../create-slugify.js";import{apiDocLoader as ge,apiDocsLoader as he}from"./loader.js";import{getTemplatePath as V}from"./get-template-path.js";import{storeDefinitionBundles as Se}from"./store-definition-bundles.js";import{definitionAccessKey as De,describeDefinitionAccess as Pe}from"./definition-access.js";import{telemetryTraceStep as ye}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as ve}from"./search/search-resolver.js";import{getAiDocumentsStore as Ae}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as Ie}from"../get-api-config.js";import{getRouteSlugsForPath as Re}from"../utils.js";import{collectItemRoutes as be}from"./utils/collect-item-routes.js";import{isChunkCurrent as _e}from"./utils/decorators.js";import{applyNavItemToRoot as Ce}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as we}from"./utils/build-routes-mapping.js";import{buildItemPositions as Te}from"./utils/build-item-positions.js";import{resolveApiDocTitle as ke}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as K}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as Ee}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Oe}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as W}from"./import-api-docs-builder.js";import{envConfig as G}from"../../config/env-config.js";import{logger as Fe}from"../../tools/notifiers/logger.js";const F="openapi-spec-download",Me={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function Dt(){let t=[],r=new Map;const a=new WeakMap;let i=new Set,g={},v={};function X(o,D,R){const A=a.get(o)??new Map;a.set(o,A);const P=D??"";return A.get(P)===R?!1:(A.set(P,R),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":ge,"api-docs":he},processContent:async(o,D)=>{await ye("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(F,ue(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:pe+"/*",requestHandlerId:F,httpMethod:"all",[I]:N,getStaticData:async()=>({props:{definitionAccess:v}})}),o.addApiRoute({slug:ce+"/*",requestHandlerId:F,httpMethod:"all",[I]:N,getStaticData:async()=>({props:{definitionAccess:v}})}),o.addApiRoute({slug:ne+"/*",requestHandlerId:F,httpMethod:"all",[I]:N,getStaticData:async()=>({props:{definitionAccess:v}})});const R=o.createTemplate(j,V("../../../client/templates/api-docs/template.js")),A=o.registerServerPropsGetter(j,V("./get-server-props.js")),P=await D.getConfig();r=new Map,g={};const y=await o.loadApiDocuments(D);Se(y,o.outdir),v={};const T=!!P.plugins?.some(e=>typeof e=="string"&&e.startsWith("@redocly/portal-plugin-async-api/"));T&&y.some(e=>e.type==="asyncapi")&&Fe.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const c=T?y.filter(e=>e.type!=="asyncapi"):y;t=c.map(({markdocChunks:e,relativePath:u,isVirtual:p,customOutputRelativeFile:s,realRelativePath:S})=>({chunks:e??[],relativePath:u,realRelativePath:S,isVirtual:s!=null||p}));const{buildItems:n}=await W(o.serverOutDir),m=(await D.cache.load("content-slugs","content-slugs")).data,h=fe(m),k=e=>le(h(e));for(const e of y){const u=De(e);if(u===void 0)continue;const p=k(e.customOutputRelativeFile||e.relativePath);v[u]=Pe(e,p)}for(const e of c){const u=e.customOutputRelativeFile||e.relativePath,p=k(u);qe(e,p);const{items:s,store:S}=await n({type:e.type,document:e.document,options:e.options,basePath:p,markdownParser:U}),b=`${O}${e.relativePath}`,M=G.isDevelopMode?e.relativePath:void 0,l=$e(e.document),_=l?.["x-metadata"],C=e.isVirtual?void 0:_?.apiId,B={document:e,basePath:p,sourcePath:M,apiId:C,build:{items:s,store:S}};await o.createSharedData(b,z(B,s,S));const J=K(e.config),L=!!e.options.excludeFromSearch,Z=e.type==="openapi",ee=be(s,J),te=me(e),f=ee.map(d=>{const x=d.metadata?.seo,E={fsPath:u,templateId:R,sharedData:[{key:"apiDocsStore",id:b}],serverPropsGetterIds:[A],excludeFromSearch:L,getStaticData:Le(d.label,x,te),[I]:d[I]};return Object.assign(E,xe(d.link,p)),Z&&d.httpVerb&&(E.httpVerb=d.httpVerb,E.metadata={subType:"openapi-operation"}),E});if(!f.length)continue;const H=ke(l,e.type,s),oe=Oe(l?.version),q={type:e.type,title:H,version:oe,description:typeof l?.description=="string"?l.description:void 0,summary:typeof l?.summary=="string"?l.summary:void 0,...l?.["x-metadata"]&&typeof l["x-metadata"]=="object"?l["x-metadata"]:{}};f[0]={...f[0],metadata:q,hasClientRoutes:!0,getSidebar:(d,x)=>Ce(Y(s),p,x),getNavText:()=>H??Me[e.type]??"API Docs",getSearchDocuments:ve(s,q,o.getSearchFacets,o.setSearchFacets,L,S,e.document),getAiDocumentsStore:Ae({getBuild:()=>B.build,metadata:q,document:e.document,specType:e.type,excludeFromSearch:L,basePath:p,getSearchFacets:o.getSearchFacets,markdocTags:{...ae,schemaDefinition:ie}})};const re=f[0];f[0]=f[f.length-1],f[f.length-1]=re;for(const d of f)o.addRoute(d);if(C){const d=Ie(e.config?.apis,e.realRelativePath);g[C]={[I]:d.rbac,[w]:{fsPath:u}}}r.set(b,B)}})},afterRoutesCreated:async(o,D)=>{const{buildItems:R,simplifyAstStructure:A}=await W(o.serverOutDir);for(const c of r.values())Q(o,c.build.items);const P=new Set,y=new Set;for(const{chunks:c,relativePath:n,isVirtual:m}of t){const h=`${O}${n}`,k=Re(o.getAllRoutes(),n);for(const{node:e,markdown:u,pointer:p,key:s,relativePath:S}of c){const{ast:b,compoundHash:M}=await o.parseMarkdoc({input:{content:u,relativePath:S,isVirtual:m},resource:p,context:D,deps:{sharedDataIds:[`${O}${S}`],routeSlugs:k}});if(P.add(p),!(s==="graphql-docs"?e?.description?.value!==void 0:!!s&&_e(e,s,u))||!X(e,s,M))continue;y.add(h);const _=A(b);if(s==="graphql-docs"){e.description&&(e.description.value=_);const C=`${O}${S}`;Be(r.get(C),_)}else s&&(e[s]=_)}}const T=i.difference(P);for(const c of T)D.cache.delete(c);i=P,Object.entries(g).forEach(([c,n])=>{const m=n[w]?.fsPath;if(!m)return;const h=o.getRouteByFsPath(m)?.baseSlug;g[c]={...n,[w]:{...n[w],slug:h},slug:h}}),o.setGlobalData({apiProducts:g});for(const[c,n]of r){if(!y.has(c))continue;const{items:m,store:h}=await R({type:n.document.type,document:n.document.document,options:n.document.options,basePath:n.basePath,markdownParser:U});n.build={items:m,store:h},Q(o,m),await o.createSharedData(c,z(n,m,h))}}}}function Q(t,r){for(const{from:a,to:i}of se(r))t.getConfig().redirects?.[a]||t.getRouteBySlug(a,{followRedirect:!1})||(t.addRouteAlias(a,i),t.addRedirect(a,{to:i,type:301},{trackOriginalSource:!1}))}function z({document:t,basePath:r,sourcePath:a,apiId:i},g,v){return{[I]:K(t.config),[w]:{slug:de(r),fsPath:t.customOutputRelativeFile||t.relativePath},items:g,store:v,options:t.options,baseSlug:r,routesMapping:G.isDevelopMode?we(g,r):{},graphqlPositions:G.isDevelopMode&&t.type==="graphql"?Te(g,r):void 0,sourcePath:a,apiId:i}}function Be(t,r){t?.document.type!=="graphql"||!t.document.options||(t.document.options.info={...t.document.options.info||{},description:r})}function Le(t,r,a){return async function(i){return{...a?{isTranslationFallback:!0}:{},props:{settings:{baseUrlPath:$(i.baseSlug)},disableAutoScroll:!0,seo:{title:t,...r}}}}}function qe(t,r){const a=t.options?.mockServer,i=$(`/_mock${Ee(t.relativePath)}`);a?.url===i&&(t.options={...t.options,mockServer:{...a,url:$(`/_mock${r}`)}})}function xe(t,r){if(t===r)return{};const a=r==="/"?"/":`${r}/`;if(t.startsWith(a)){const i=t.slice(a.length);return i?{slugSuffix:i}:{}}return{slug:t}}function $e(t){if(t&&typeof t=="object"&&"info"in t)return t.info}function Y(t){return t.map(({content:r,items:a,...i})=>({...i,...a&&{items:Y(a)}}))}export{Dt as apiDocsPlugin,xe as toRouteSlugFields};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ASTNode, type DocumentNode } from 'graphql';
|
|
2
2
|
import type { OpenAPIDefinition, AsyncApiDefinition, ApiSpecType, RawApiDocsOptions } from '@redocly/api-docs';
|
|
3
|
-
import type { Node as MarkdocNode } from '@
|
|
3
|
+
import type { Node as MarkdocNode } from '@redocly/markdoc';
|
|
4
4
|
import type { LifecycleContext } from '../../types';
|
|
5
5
|
import type { RedoclyConfig } from '@redocly/config';
|
|
6
6
|
export type MarkdocChunk = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as O from"node:path";import{findFirstBinding as A,markdocParser as F}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as k}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as L}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as E}from"../../config/env-config.js";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as B}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as p}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as M}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const a=M(r);return{url:k(`/_mock${a}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(L,`${p(o,O.posix.extname(o))}?download`)]:[i(f,`${p(o,".json")}?download`),i(f,`${p(o,".yaml")}?download`)]).map(a=>({url:k(a)}))}function X(o,r,m){const{rootConfig:a,config:s,apiConfig:c,mergedConfig:e,relativePath:l}=m,n=w(a?.[o]||{},s[o]||{},c[o]||c.theme?.[o]||{}),S=r["x-feedback"]||n.feedback||s.feedback,b=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!a?.[o]?.excludeFromSearch||!!a?.theme?.[o]?.excludeFromSearch,_=e.rbac||c.rbac,g=B(S),u=s.metadata,x={...g&&{feedback:g},mockServer:D(e?.mockServer||a?.mockServer,l),disableRouter:!0,downloadUrls:n.downloadUrls||I(l,o),excludeFromSearch:b,rbac:_,markdownParser:F,replayFeatures:{graphql:E.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1,asyncapi:E.REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED??!1}};let d;if(o==="graphql"){const t=n;d={title:t.info?.title,...u,...t.metadata??{}}}else{const t=r.info,P=t?.["x-metadata"];d={title:t?.title,description:t?.description,...o==="openapi"&&{summary:t?.summary},...u,...P}}o==="openapi"&&n.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const C=n.markdocOptions??R,h={...n,...x,specType:o,markdocOptions:C,metadata:d};return o==="asyncapi"&&(h.protocol=A(r)??void 0),h}export{I as buildDownloadUrls,X as createOptions};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
`+
|
|
1
|
+
import C from"node:path";import{REDOCLY_TEAMS_RBAC as T}from"@redocly/config";import{nodeTypes as y,contentType as b,isGraphqlFieldsNode as pn,resolveGraphqlItemFields as un}from"@redocly/api-docs";import{normalizeApiVersion as dn}from"../utils/normalize-api-version.js";import{replaceFileExtension as N}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as mn,canDownloadApiDefinition as hn,extractTeamsFromScopeItems as yn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as K}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as X}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as $n}from"../../../../constants/common.js";import{isPlainObject as $}from"../../../../utils/guards/is-plain-object.js";import{ANONYMOUS_AUTH_DETAILS as gn}from"../../../constants/rbac.js";import{toMarkdown as j}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as bn}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as In}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as An}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as Pn}from"../../search/utils.js";import{extractDocumentSearchFacets as On}from"./search-facets.js";import{createApiDocsSearchIndexer as Sn,createLlmDescriptionFormatter as xn}from"./create-indexer.js";function P(e,s){return s==="openapi"&&"openapi"in e}function Z(e,s){return s==="asyncapi"&&"asyncapi"in e}function it({getBuild:e,metadata:s,document:c,specType:o,excludeFromSearch:n,basePath:r,getSearchFacets:t,markdocTags:i}){return async(l,f,d,p)=>{if(n)return;const{items:a,store:m}=e(),h={...p.markdocOptions?.tags,...i},{locale:en,translate:on}=await An(l.slug,p.getGlobalData?.().l10n),O=bn(h,en,on),v=p.getConfig(),D=In(l.fsPath),R=xn(O),V=Sn(r,R,m?.schemaStore,c,m?.exampleStore,m?.graphqlMeta),F=I=>{for(const u of I)V.addItem(u),u.items?.length&&F(u.items)};F(a);const rn=V.getResult(),_=new Map;for(const I of rn)_.set(I.url,I);const E=typeof s.title=="string"?s.title:void 0,q=dn(s.version),k=On(l.metadata||{},E,q,t),S=[],x=[],G=Cn(c,s),z=G?R(G):void 0,W=Tn(s,z,c,o,R),B=Ln(o,s,l.fsPath,v),sn=Rn(a,v,O),cn=W+B+`
|
|
2
|
+
`+sn,ln=W+B;x.push({title:E||"API Overview",description:z,content:cn,slug:r,fsPath:l.fsPath,includeInLLMsTxt:!0}),S.push({title:E||"API Overview",content:ln,url:r,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k});const fn=c&&P(c,o)?c.security:void 0,U=I=>{for(const u of I){if(!u.content||!u.link){u.items?.length&&U(u.items);continue}const an=_.get(u.link),J=u.content.contentType,Q=u[T],H=Q?yn(Q):void 0,Y=H?.length?H:void 0;if(J===b.ITEM){const g=En(u,c,o)??nn(u,an,o,q,fn,O,m);if(g){const A=u.label||"";x.push({title:A,description:void 0,content:g,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:A,content:g,url:u.link,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k,rbacTeams:Y})}}else if(J===b.GROUP){const g=kn(u,v,o,O,m);if(g){const A=u.label||"";x.push({title:A,description:void 0,content:g.llmstxt,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:A,content:g.aiSearch,url:u.link,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k,rbacTeams:Y})}}u.items?.length&&U(u.items)}};return U(a),{async getLLMsTxts(){return x},async getSearchDocuments(){return S}}}}function Cn(e,s){const c=$(e?.info)?e.info:void 0,o=$(c?.["x-metadata"])?c["x-metadata"]:{},r=(typeof o.description=="string"?o.description:void 0)??c?.description??s.description;return typeof r=="string"?r||void 0:r&&typeof r=="object"?r:void 0}function Tn(e,s,c,o,n){const r=typeof e.title=="string"?e.title:"",t=typeof e.summary=="string"?e.summary:"",i=typeof e.version=="string"?e.version:"";let l=r?`# ${r}
|
|
3
3
|
|
|
4
4
|
`:"";if(l+=s?`${s}
|
|
5
5
|
|
|
6
6
|
`:"",l+=t?`${t}
|
|
7
7
|
|
|
8
8
|
`:"",l+=i?`Version: ${i}
|
|
9
|
-
`:"",c){if(
|
|
10
|
-
`);const d=f["x-metadata"],p=Object.entries(
|
|
9
|
+
`:"",c){if(P(c,o)){const{info:f}=c;f?.license?.name&&(l+=`License: ${f.license.name}
|
|
10
|
+
`);const d=f["x-metadata"],p=Object.entries($(d)?d:{}).filter(([m,h])=>m!=="description"||typeof h!="string"),a=Pn(Object.fromEntries(p));a&&(l+=`
|
|
11
11
|
Metadata:
|
|
12
12
|
${a}
|
|
13
13
|
`)}else if(Z(c,o)){const{info:f}=c;f?.license?.name&&(l+=`License: ${f.license.name}
|
|
14
14
|
`)}}return l+=`
|
|
15
|
-
`,l+=
|
|
15
|
+
`,l+=vn(c,o,n),l+=Dn(c,o,n),l}function Ln(e,s,c,o){if(!c)return"";let n,r,t;if(e==="openapi")n=C.posix.join(X,N(c,".yaml")),r="## Download OpenAPI description",t="OpenAPI definition";else if(e==="asyncapi")n=C.posix.join(X,N(c,".yaml")),r="## Download AsyncAPI description",t="AsyncAPI definition";else if(e==="graphql"){const f=C.posix.extname(c)||".graphql";n=C.posix.join($n,N(c,f)),r="## Download GraphQL schema",t="GraphQL schema"}else return"";if(!hn(n,o.access?.rbac??{},o.access?.requiresLogin??!1,gn))return"";const l=typeof s.title=="string"&&s.title||t;return`${r}
|
|
16
16
|
|
|
17
|
-
- ${w({title:l,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function
|
|
17
|
+
- ${w({title:l,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function vn(e,s,c){if(!e)return"";if(P(e,s)){const o=Array.isArray(e.servers)?e.servers.filter($):[];if(!o.length)return"";let n=`## Servers
|
|
18
18
|
|
|
19
|
-
`;for(const r of o)
|
|
19
|
+
`;for(const r of o){r.description&&(n+=`${c(r.description)}
|
|
20
20
|
`),n+=`\`\`\`
|
|
21
21
|
${r.url}
|
|
22
22
|
\`\`\`
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
`;for(const[
|
|
26
|
-
`,
|
|
27
|
-
`),
|
|
24
|
+
`;const t=Object.entries($(r.variables)?r.variables:{}).filter(([,i])=>$(i));if(t.length){n+=`Variables:
|
|
25
|
+
`;for(const[i,l]of t)n+=`- \`${i}\`${l.description?`: ${c(l.description).replace(/\s+/g," ")}`:""}
|
|
26
|
+
`,l.default&&(n+=` Default: ${JSON.stringify(l.default)}
|
|
27
|
+
`),Array.isArray(l.enum)&&(n+=` Enum: ${l.enum.map(f=>JSON.stringify(f)).join(", ")}
|
|
28
28
|
`);n+=`
|
|
29
|
-
`}return n}if(Z(e,s)){const
|
|
29
|
+
`}}return n}if(Z(e,s)){const o=Object.entries($(e.servers)?e.servers:{}).filter(([,r])=>$(r));if(!o.length)return"";let n=`## Servers
|
|
30
30
|
|
|
31
|
-
`;for(const[r,t]of
|
|
31
|
+
`;for(const[r,t]of o)n+=`### ${r}
|
|
32
32
|
|
|
33
33
|
`,t.description&&(n+=`${c(t.description)}
|
|
34
34
|
`),t.host&&(n+=`Host: ${t.host}
|
|
@@ -36,7 +36,7 @@ ${r.url}
|
|
|
36
36
|
`),t.protocolVersion&&(n+=`Protocol Version: ${t.protocolVersion}
|
|
37
37
|
`),t.pathname&&(n+=`Pathname: ${t.pathname}
|
|
38
38
|
`),n+=`
|
|
39
|
-
`;return n}return""}function
|
|
39
|
+
`;return n}return""}function Dn(e,s,c){if(!e||!P(e,s))return"";const o=e.components?.securitySchemes;if(!o)return"";let n=`## Security
|
|
40
40
|
|
|
41
41
|
`;for(const[r,t]of Object.entries(o)){if(!t||"$ref"in t)continue;const i=t;n+=`### ${r}
|
|
42
42
|
|
|
@@ -53,19 +53,19 @@ ${r.url}
|
|
|
53
53
|
`),f.scopes)){n+=`Scopes:
|
|
54
54
|
`;for(const[d,p]of Object.entries(f.scopes))n+=`- \`${d}\`: ${p}
|
|
55
55
|
`}n+=`
|
|
56
|
-
`}return n}function
|
|
56
|
+
`}return n}function Rn(e,s,c){let o="";const n=(r,t)=>{for(const i of r)if(i.link){if(i.content?.contentType===b.GROUP)o+=`${t} ${i.label||""}
|
|
57
57
|
|
|
58
|
-
`,i.items?.length&&n(i.items,t+"#");else if(i.content?.contentType===
|
|
58
|
+
`,i.items?.length&&n(i.items,t+"#");else if(i.content?.contentType===b.ITEM){if(!M(i,s))continue;const l=i,f=l.httpVerb,d=l.httpPath,p=f&&d?`${f.toUpperCase()} ${d}`:i.label||"",a=i.content?L(i.content.children,c):void 0;o+=` - ${w({title:p,description:a?a.slice(0,200):void 0,slug:K(i.link),siteUrl:s.seo?.siteUrl})}`}}};return n(e,"##"),o}function nn(e,s,c,o,n,r,t){if(!e.content)return;const i=e,l=e.label||"",f=L(e.content.children,r),d=e.content.meta?.deprecated;let p=`# ${l}${d?" (deprecated)":""}
|
|
59
59
|
|
|
60
60
|
`;if(f&&(p+=`${f}
|
|
61
61
|
|
|
62
62
|
`),c==="openapi"||c==="asyncapi"){const a=i.httpVerb,m=i.httpPath;a&&m?p+=`Endpoint: ${a.toUpperCase()} ${m}
|
|
63
63
|
`:a&&(p+=`Method: ${a.toUpperCase()}
|
|
64
64
|
`),o&&(p+=`Version: ${o}
|
|
65
|
-
`);const h=
|
|
65
|
+
`);const h=Un(e.content.children,n);h&&(p+=`Security: ${h}
|
|
66
66
|
`)}return s?.parameters?.length&&c!=="graphql"&&(p+=`
|
|
67
67
|
`+Nn(s.parameters)+`
|
|
68
|
-
`),c==="graphql"&&(p+=jn(e.content.children,t,r)),p}function
|
|
68
|
+
`),c==="graphql"&&(p+=jn(e.content.children,t,r)),p}function En(e,s,c){if(e.httpVerb!=="tool"||!s||!P(s,c))return;const o=e.content?.meta?.name,n=o?s["x-mcp"]?.tools?.find(t=>t.name===o):void 0;if(!n)return;let r=`# ${e.label||n.name}
|
|
69
69
|
|
|
70
70
|
`;return typeof n.description=="string"&&n.description&&(r+=`${n.description}
|
|
71
71
|
|
|
@@ -81,15 +81,15 @@ ${JSON.stringify(n.inputSchema,null,2)}
|
|
|
81
81
|
${JSON.stringify(n.outputSchema,null,2)}
|
|
82
82
|
\`\`\`
|
|
83
83
|
|
|
84
|
-
`),r}function
|
|
84
|
+
`),r}function kn(e,s,c,o,n){if(!e.content)return;const r=e.label||"",t=L(e.content.children,o);let i=`# ${r}
|
|
85
85
|
|
|
86
86
|
`;if(t&&(i+=`${t}
|
|
87
87
|
|
|
88
|
-
`),c==="graphql"){let f="";const d=p=>{for(const a of p??[])if(!(!a.content||!M(a,s)))if(a.content.contentType===
|
|
88
|
+
`),c==="graphql"){let f="";const d=p=>{for(const a of p??[])if(!(!a.content||!M(a,s)))if(a.content.contentType===b.ITEM){const m=nn(a,void 0,c,void 0,void 0,o,n);m&&(f+=`${m}
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
`)}else a.content.contentType===
|
|
92
|
+
`)}else a.content.contentType===b.GROUP&&d(a.items)};return d(e.items),{llmstxt:i+f,aiSearch:i}}let l="";if(e.items?.length)for(const f of e.items){if(!f.link||!f.content||f.content.contentType!==b.ITEM||!M(f,s))continue;const d=f,p=d.httpVerb,a=d.httpPath,m=p&&a?`${p.toUpperCase()} ${a}`:f.label||"",h=f.content?L(f.content.children,o):void 0;l+=` - ${w({title:m,description:h?h.slice(0,200):void 0,slug:K(f.link),siteUrl:s.seo?.siteUrl})}`}return{llmstxt:i+l,aiSearch:i}}function Un(e,s){const c=[],o=n=>{for(const r of n)if(r.nodeType===y.SECURITY){const t=r;for(const i of t.requirements)for(const l of i.schemes)l[T]||l.name&&!c.includes(l.name)&&c.push(l.name)}else(r.nodeType===y.CONTAINER||r.nodeType===y.OVERVIEW_SECTION_WRAPPER)&&o(r.children)};if(o(e),c.length)return c.join(", ");if(s?.length){const n=s.flatMap(r=>Object.keys(r));if(n.length)return[...new Set(n)].join(", ")}}function Nn(e){const s={};for(const o of e){const n=`${o.place}${o.mediaType?` (${o.mediaType})`:""}`;s[n]||(s[n]=[]),s[n].push(o)}return Object.entries(s).map(([o,n])=>{const r=n.map(t=>{const i=[...t.path||[],t.name],l=Array.isArray(t.description)?t.description.join(" "):t.description;let f=` - \`${i.join(".")}\` (${t.type}${t.required?", required":""})
|
|
93
93
|
`;return l&&(f+=` ${l.trim()}
|
|
94
94
|
`),t.enum?f+=` Enum: ${t.enum.map(d=>JSON.stringify(d)).join(", ")}
|
|
95
95
|
`:t.example&&(f+=` Example: ${t.example}
|
|
@@ -97,9 +97,9 @@ ${JSON.stringify(n.outputSchema,null,2)}
|
|
|
97
97
|
|
|
98
98
|
${r.join(`
|
|
99
99
|
`)}`}).join(`
|
|
100
|
-
`)}function jn(e,s,c){let o="";const n=r=>{for(const t of r)if(t.nodeType
|
|
100
|
+
`)}function jn(e,s,c){let o="";const n=r=>{for(const t of r)if(t.nodeType===y.ITEM){const i=pn(t)?un(t,s??{}):void 0;i&&(o+=wn(i,t.variant,c))}else(t.nodeType===y.CONTAINER||t.nodeType===y.OVERVIEW_SECTION_WRAPPER)&&n(t.children)};return n(e),o}function wn(e,s,c){let n=`
|
|
101
101
|
## ${tn(s==="return-type"?"Return type":s==="graphql-args"||s==="arguments"?"Arguments":s==="graphql-fields"?"Fields":s)}:
|
|
102
102
|
|
|
103
103
|
`;const r=t=>{const i=t.description?j(Array.isArray(t.description)?t.description:[t.description],{renderTag:c}).trim():"";return` - \`${t.name}\` (${t.type.display})${i?`: ${i}`:""}
|
|
104
104
|
`};if(e.type){const t=e.type.description?j(Array.isArray(e.type.description)?e.type.description:[e.type.description],{renderTag:c}).trim():"";n+=` Type: ${e.type.display}`,t&&(n+=` - ${t}`),n+=`
|
|
105
|
-
`}else if(!e.fields.length)return"";for(const t of e.fields)n+=r(t);return n}function
|
|
105
|
+
`}else if(!e.fields.length)return"";for(const t of e.fields)n+=r(t);return n}function L(e,s){const c=[],o=r=>{for(const t of r)if(t.nodeType===y.MARKDOC){const i=t.content,l=Array.isArray(i)?i:[i],f=j(l,{renderTag:s}).trim();f&&c.push(f)}else(t.nodeType===y.CONTAINER||t.nodeType===y.OVERVIEW_SECTION_WRAPPER)&&o(t.children)};return o(e),c.join(" ").trim()||void 0}function tn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function M(e,s){return s.access?.requiresLogin?!0:mn({slug:e.link||"",[T]:e[T]},s)}export{it as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"node:path";import{existsSync as u}from"node:fs";import{readFile as I}from"node:fs/promises";import L from"js-yaml";import{withoutPathPrefix as j}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as g,PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as T}from"../../../constants/common.js";import{requestDefinitionAccessKey as C}from"./definition-access.js";import{canDownloadApiDefinition as U,filterDataByAccessDeep as B}from"../../utils/rbac.js";import{API_DOWNLOAD_PREFIXES as G}from"../../utils/is-api-download-link.js";import{decodeRequestPath as W}from"../../utils/decode-request-path.js";import{replaceFileExtension as X}from"./utils/replace-file-extension.js";const v=[".json",".yaml",".yml"],H=[".graphql",".gql"];function F(r,o){const t=e.parse(r);return e.join(t.dir,t.name+o)}const J=async(r,o,t)=>{const{isAuthenticated:a,teams:m,claims:{email:d}}=o.user,S=new URL(r.url),n=W(j(S.pathname));if(n===void 0||n.endsWith("/"))return new Response("Bad Request",{status:400});const c=G.find(i=>n.startsWith(`${i}/`));if(c===void 0)return new Response("Not found",{status:404});const p=c===T,s=n.slice(c.length),l=e.extname(s);if(!(p?H:v).includes(l))return new Response("Not found",{status:404});const{rbac:h={},requiresLogin:P=!1}=o.config.access||{},y=(t.props?.definitionAccess??{})[C(p,X(s.slice(1),""))];if(!U(n,h,P,{isAuthenticated:a,email:d,teams:m},y))return new Response("Unauthorized",{status:a?403:401});const f=t.props?.outdir||"";if(p){const i=e.join(f,w,s);if(!u(i))return new Response("Not found",{status:404});const q=await I(i,"utf-8");return new Response(q,{headers:{"Content-Type":"application/graphql"}})}const E=e.join(f,w,F(s,".json")),R=e.join(f,g,F(s,".json")),A=u(E),D=u(R);if(!A&&!D)return new Response("Not found",{status:404});const _=await I(A?E:R,"utf-8"),x=JSON.parse(_),N=B(x,{isAuthenticated:a,email:d,teams:m},h,P),O=l===".yaml"?L.dump(N):JSON.stringify(N,null,2);return new Response(O,{headers:{"Content-Type":l===".yaml"?"application/yaml":"application/json"}})};var ie=J;export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import S from"path";import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import S from"path";import{REDOCLY_ROUTE_RBAC as b,REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{parsePathVersions as D}from"../../../utils/path/parse-path-versions.js";import{buildWildcardRedirectsTree as T}from"../../utils/redirects/build-wildcard-redirects-tree.js";import{shaHexShort as O}from"../../utils/crypto/sha-hex-short.js";import{isDefined as E}from"../../../utils/guards/is-defined.js";import{logger as L}from"../../tools/notifiers/logger.js";import{formatCustomScripts as h,formatCustomLinks as k}from"./format-custom-tags.js";import{applyL10nToRbacConfig as G,resolveDirectoryHashes as j}from"../../utils/rbac.js";import{isConsentEnabled as B}from"../consent/is-consent-enabled.js";import{copySeoAssets as F}from"./copy-seo-assets.js";import{normalizeRedirectSources as _}from"./normalize-redirect-sources.js";import{applyL10nToRedirects as x}from"./apply-l10n-to-redirects.js";import{DEFAULT_LOADERS as M}from"./loaders/index.js";import{resolveSearchFacets as z}from"./resolve-search-facets.js";import{telemetryTraceStep as I}from"../../../cli/telemetry/helpers/trace-step.js";import{transformMdAst as V}from"../markdown/runtime-transform.js";import{EntitlementsProvider as q}from"../../entitlements/entitlements-provider.js";async function lr(){return{id:"Config Parser",loaders:M,async processContent(e,{getConfig:a,fs:n}){await I("com.redocly.build.plugin.configParser",async t=>{const{contentDir:l,setGlobalConfig:o,setGlobalData:s}=e,r=await a(),i=r.access||{},m=G(n,i.rbac||{}),f={outdir:e.outdir,contentDir:l,consentEnabled:B(r.consent)},C=await h(r.scripts?.head,f),P=await k(r.links,f),R=await h(r.scripts?.body,f),d=w(r,{headScriptTags:C,linkTags:P,postBodyScriptTags:R});t?.setAttribute("config",JSON.stringify(d));const p=r.redirects?_(r.redirects):{},v=Object.keys(p),A=d.banner?.map(c=>typeof c=="object"&&c!==null&&c.rbac?{...c,[y]:c.rbac}:c);o({...d,banner:A,access:{...i,requiresLogin:!!i.requiresLogin,rbac:m},directoryPaths:await j(n,i.rbac),seo:r.seo&&await F(r.seo,f.contentDir,f.outdir),redirects:x(p,r.l10n),wildcardRedirectsTree:T(p),originalRedirectSources:v}),z(r.search?.filters?.facets||[],e.getSearchFacets,e.setSearchFacets);const g=q.instance(),u=!!g.canAccessFeature("removeAttribution");s({removeAttribution:g.pricingTier?u:!0,removeConsoleAttribution:u&&r.removeAttribution===!0})})},async afterRoutesCreated(e,a){H(e);const n=e.getGlobalConfig("banner");if(Array.isArray(n)){const t=await Promise.all(n.map(async(l,o)=>{const{content:s,...r}=l;if(!s){L.warn(`redocly.yaml: banner[${o}] has no content and is not shown.`);return}const{ast:i}=await e.parseMarkdoc({input:{content:s,relativePath:"redocly.yaml"},context:a,resource:`redocly.yaml#banner${o}`}),{renderableAst:m}=await V(i,{variables:{},partials:{}},e.serverOutDir);return Object.assign(r,{ast:m,hash:O(s)})}));e.setGlobalConfig({banner:t.filter(E)})}}}}function H(e){const a=e.getGlobalConfig("access")?.rbac,n=e.getGlobalConfig("directoryPaths");if(!(!a||Object.keys(a).length===0))for(const t of e.getAllRoutes()){if(t.versions&&n){const l=D(t.fsPath)?.filePathInVersion||"index.md";for(const o of t.versions){const s=n[o.folderId],i=s==="."||s==="/"?"":s;o[b]={slug:o.link,fsPath:S.posix.join(i,"@"+o.version,l)}}}t[b]||t[y]||(t[b]={slug:t.slug,fsPath:t.fsPath})}}export{lr as configParserPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import R from"path";import{lintConfig as j,loadConfig as E,createConfigTypes as L}from"@redocly/openapi-core";import{findEmptyAgentSection as S,rbacConfigSchema as q,rootRedoclyConfigSchema as x,withPlatformSection as B}from"@redocly/config";import{deepMerge as k}from"../../../../../utils/object/deep-merge.js";import{isPlainObject as v}from"../../../../../utils/guards/is-plain-object.js";import{logger as p}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as I}from"../../../../../constants/common.js";import{sanitizeBranchName as M}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{ajv as N,safeParsePartial as _}from"../../safe-parse.js";import{formatConfigProblem as D}from"../../format-error.js";import{ExternalResolver as F}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as G}from"../../resolve-mutual-exclusion.js";function y(e,s,t,n){s in e&&e[s]&&typeof e[s]=="string"&&(/^https?:\/\/.*/.test(e[s])||n(new Error(`Invalid ${t} URL: "${e[s]}". ${t} must start with "http://" or "https://".`)))}function z(e,s){if("access"in e&&e.access&&typeof e.access=="object"){const t=e.access;y(t,"logoutReturnUrl","access.logoutReturnUrl",s),y(t,"residency","access.residency",s);const n=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const r of n)r in t&&t[r]!==void 0&&r in e&&e[r]!==void 0&&s(new Error(`Property '${r}' is defined both at root level and in 'access' object. Please use 'access.${r}' to define this configuration.`))}}function V(e){return N.compile(x.properties.graphql.properties.servers.items.properties.url)(e)}function A(e,s,t){if(v(e)&&Array.isArray(e.servers))for(const n of e.servers){const r=v(n)?n.url:void 0;if(typeof r=="string"&&!V(r)){const a=e.servers.indexOf(n),c=`${s}.servers[${a}].url`;t(new Error(`Invalid ${c}: "${r}". It must be an absolute http:// or https:// URL.`))}}}function Y(e,s){if(A(e.graphql,"graphql",s),!!v(e.apis))for(const[t,n]of Object.entries(e.apis))v(n)&&A(n.graphql,`apis.${t}.graphql`,s)}function H(e,s){const t=[["",e],...Object.entries(e.env??{}).map(([n,r])=>[`env.${n}.`,r])];for(const[n,r]of t){const a=S(r);a&&s(new Error(`Invalid ${n}${a}.agent: it must set at least one option.`))}}async function me(e,s,t,n){const a=s.getFileInfo(e)?.realRelativePath||e;async function c(){const f=new F(s),m=R.join(s.cwd,a),d=await E({configPath:m,externalRefResolver:f}),h=await n(d.resolvedConfig);if(h===void 0)return d.resolvedConfig;const g=d.document?.source,P=[...g?await j({config:d,externalConfigTypes:L(h,d)}):[],...g?G(d.resolvedConfig,g):[]];if(P.length>0)for(const U of P)t(new Error(D(U,s.cwd)));return d.resolvedConfig}const o=s.exists(e)?await c():{},l=Q(o),w=await n(o);y(o,"residency","Residency",t),y(o,"logoutReturnUrl","Logout return URL",t),z(o,t),Y(o,t),H(o,t);let u=w?_(w,o):o;u=W(u),u=J(u,t);const{env:b}=u;if(b){const f=C.REDOCLY_ENV,m=b[f]||{},d=C.PUBLIC_REDOCLY_BRANCH_NAME||"",h=d?M(d):"",g=h&&b[`${I}${h}`]||{};u=k(u,g,m)}const i=Z(u,l);if(i.imports&&i.imports.length>0){p.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const f=new Set([...i.plugins||[],...i.imports.map(m=>R.posix.join(m,"plugin.js"))]);i.plugins=Array.from(f),delete i.imports}if(i.catalog&&(p.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),i.catalogClassic={...i.catalog},delete i.catalog),i.scorecard&&(p.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),i.scorecardClassic=i.scorecard,delete i.scorecard),i.search?.ai){p.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const f={...i.search?.ai,...i.aiAssistant,suggestions:i.aiAssistant?.suggestions?.length?i.aiAssistant.suggestions:i.search?.ai.suggestions||[]};i.aiAssistant=f,delete i.search.ai}return K(i)}function K(e){const s={...e},n={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},r=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],a=[];for(const c of r){const o=s[c];o!==void 0&&(a.push(c),c==="requiresLogin"&&n.requiresLogin===void 0&&(n.requiresLogin=o),c==="logoutReturnUrl"&&n.logoutReturnUrl===void 0&&(n.logoutReturnUrl=o),c==="residency"&&n.residency===void 0&&(n.residency=o),c==="sso"&&n.sso===void 0&&(n.sso=o),c==="idps"&&n.idps===void 0&&(n.idps=o),c==="rbac"&&n.rbac===void 0&&(n.rbac=o),delete s[c])}return a.length>0&&p.warn(`The following properties at root level are deprecated: ${a.join(", ")}. Please move them to the 'access' object.`),Object.keys(n).length>0&&(s.access=n),s}function W(e){const s=Object.entries(e.env??{});[e,...s.map(([,r])=>r)].some(r=>r?.mcp?.docs)&&p.warn("The 'mcp.docs' property is deprecated. Please use the 'mcp' properties instead.");const t=e.mcp?{...e,mcp:$(e.mcp)}:e;if(!e.env)return t;const n=s.map(([r,a])=>[r,a?.mcp?{...a,mcp:$(a.mcp)}:a]);return{...t,env:Object.fromEntries(n)}}function $(e){const s=e.docs??{},t={};(e.hide??s.hide)!==void 0&&(t.hide=e.hide===!0||s.hide===!0);const n=e.name??s.name;n!==void 0&&(t.name=n);const r=e.ignore??s.ignore;r!==void 0&&(t.ignore=r);const a=e.publicEndpoint??s.publicEndpoint;return a!==void 0&&(t.publicEndpoint=a),{...e,...t,docs:{...s,...t}}}function X(e){if(!v(e)||e.platform===void 0)return!1;const s=Object.keys(e).filter(t=>t!=="platform");return s.length>0&&s.every(t=>!Object.hasOwn(q.properties,t))}function J(e,s){const t=Object.entries(e.env??{}),n=new Set;let r=!1;for(const o of[e,...t.map(([,l])=>l)])o?.reunite!==void 0&&n.add("The 'reunite' property is deprecated. Please use 'platform' property instead."),o?.reunite!==void 0&&o?.platform!==void 0&&n.add("Both 'platform' and 'reunite' are set. 'reunite' is ignored, so remove it."),[o?.rbac,o?.access?.rbac].some(l=>l?.reunite!==void 0)&&n.add("The 'access.rbac.reunite' property is deprecated. Please use 'access.rbac.platform' property instead."),[o?.rbac,o?.access?.rbac].some(X)&&(r=!0);for(const o of n)p.warn(o);r&&s(new Error("You are using an incorrect format of 'rbac:' configuration. See: https://redocly.com/docs/realm/access"));const a=T(e);if(!e.env)return a;const c=t.map(([o,l])=>[o,l&&T(l)]);return{...a,env:Object.fromEntries(c)}}function T(e){const s=B(e),t=e.rbac?{...s,rbac:O(e.rbac)}:s;return e.access?.rbac?{...t,access:{...e.access,rbac:O(e.access.rbac)}}:t}function O(e){const{reunite:s,...t}=e;return s===void 0?t:{...t,platform:e.platform??s}}function Q(e){if(!e.theme)return[];p.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const s=[];for(const t of Object.keys(e.theme))e[t]==null?s.push(t):p.warn(`Detected both '${t}' and 'theme.${t}' properties in redocly.yaml. The 'theme.${t}' property will be ignored and needs to be removed or merged into the '${t}'.`);return s}function Z(e,s){if(!e.theme||s.length===0)return e;const t={...e};for(const n of s)t[n]=e.theme[n];return delete t.theme,t}export{K as ensureAccessBackwardsCompatibility,me as readAndValidateConfig};
|
package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../../types';
|
|
3
3
|
export declare function resolveCodeWalkthroughFilesets(node: Node, attributeName: string, pageRelativePath: string, markdocResolveContext: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=filesets-resolver.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
2
|
-
import type { Node } from '@
|
|
2
|
+
import type { Node } from '@redocly/markdoc';
|
|
3
3
|
type ResolverFunction = (node: WithOriginalAttr<Node>, attrName: string, relativePath: string, context: MarkdocResolveContext) => Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
5
5
|
} | undefined | void>;
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveCodeSnippetFromFile(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-code-snippet-from-file.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveDiagramFromFile(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-diagram-from-file.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves HTML href attributes (e.g., `<a href="...">`) using the existing `resolveLink` logic
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveHtmlSourceAttribute(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir, getRouteBySlug }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-html-source-attribute.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageGallery(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-gallery.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageSrcSet(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-src-set.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveImageSrc(node: WithOriginalAttr<Node>, attributeName: string, pageRelativePath: string, { actions: { contentDir, outdir }, context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-image-src.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveJsonExampleRef(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-json-example-ref.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveJsonSchemaRef(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveLink(node: WithOriginalAttr<Node>, attributeName: string, fromPage: string, { actions, context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves native Markdown links/images (e.g., `[]()` or `![]()`) using `resolveLink` and then applies the global
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
2
|
-
import type { Node } from '@
|
|
2
|
+
import type { Node } from '@redocly/markdoc';
|
|
3
3
|
export declare function resolveNavLinks(node: WithOriginalAttr<Node, any>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-nav-links.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveOpenApiRef(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<{
|
|
4
4
|
sharedDataId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiCodeSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-code-samples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildCodeSamples as
|
|
1
|
+
import{buildCodeSamples as v,getRequestBodySamples as d,normalizeOptions as f,resolveOperationSampleContext as S}from"@redocly/api-docs";import{setNodeAttributeValue as O}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as b}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as t}from"./utils.js";const h={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"};async function N(e,u,x,{context:g}){const o=await b(e,g);if(!o)return;const i=t(e,"language"),l=t(e,"options"),n={exampleKey:t(e,"exampleKey"),mimeType:t(e,"mimeType"),parameters:t(e,"parameters"),requestBody:t(e,"requestBody"),environments:t(e,"environments"),environment:t(e,"environment")},y={...o.rawOptions,...l,...o.rawOptions.mockServer&&{mockServer:{...o.rawOptions.mockServer,position:"off"}},codeSamples:{...o.rawOptions.codeSamples,...l?.codeSamples,...i&&{languages:[{lang:i}]}}},m=f(y),r=S(o.definition,m,{operationId:t(e,"operationId"),pointer:t(e,"pointer")});if(!r)return;const s=v(r,n).map(a=>({lang:h[a.lang]??a.lang?.toLowerCase(),title:a.label??a.lang,source:a.source})),c=m.codeSamples?.languages??[],p=c.findIndex(({lang:a})=>a==="Payload");if(p!==-1){const a=d(r,{exampleKey:n.exampleKey,mimeType:n.mimeType,titlePrefix:c[p].label});s.splice(p,0,...a)}s.length&&O(e,u,s)}export{N as resolveOpenapiCodeSamples};
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveOpenapiResponseSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-openapi-response-samples.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveParsedYaml(node: Node, attrName: string, relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-parsed-yaml.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveRawContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-raw-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativeOrCdnIcon(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-or-cdn-icon.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
|
|
3
3
|
export declare function resolveRelativePath(node: WithOriginalAttr<Node>, attrName: string, relativePath: string, context: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-relative-path.d.ts.map
|
package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSampleFromJsonSchema(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-sample-from-json-schema.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveSvgContent(node: Node, attrName: string, relativePath: string, { context, actions }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-svg-content.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Node } from '@
|
|
1
|
+
import type { Node } from '@redocly/markdoc';
|
|
2
2
|
import type { MarkdocResolveContext } from '../../../types';
|
|
3
3
|
export declare function resolveTagRawContent(node: Node, attrName: string, _relativePath: string, { readSourceLines }: MarkdocResolveContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resolve-tag-raw-content.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();
|
|
1
|
+
import s from"@redocly/markdoc";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";async function k(t,i,e,{readSourceLines:n}){if(t.children.length===0&&typeof t.attributes[i]=="string")return;if(t.inline){c(t,i,p(t)),t.children=[];return}if(n===void 0)return;const r=t.location?.start.line,f=t.location?.end.line;if(r===void 0||f===void 0)return;const l=n(),o=g(l.slice(r,f),t.tag);if(o===void 0)return;const u=x(l[r]??""),d=l.slice(r+o.start,r+o.end).map(h=>w(h,u)),a=y(d).join(`
|
|
2
|
+
`).replace(/^(?:[ \t]*\n)+/,"").trimEnd();c(t,i,a),t.children=[]}function g(t,i){const e=m(t);if(e===void 0||i===void 0)return;const n=new RegExp(`\\{%\\s*/${i}(?![\\w-])`);let r=t.length-1;for(;r>e&&!n.test(t[r]??"");)r-=1;return r>e?{start:e+1,end:r}:void 0}function m(t){let i=!1;for(let e=0;e<t.length;e+=1){const n=t[e]??"";for(let r=e===0?n.indexOf("{%")+2:0;r<n.length;r+=1)if(i)n[r]==="\\"?r+=1:n[r]==='"'&&(i=!1);else if(n[r]==='"')i=!0;else if(n[r]==="%"&&n[r+1]==="}")return e}}function p(t){return s.format(new s.Ast.Node("inline",{},t.children)).trim()}function x(t){return t.slice(0,Math.max(t.indexOf("{%"),0)).split(">").length-1}function w(t,i){let e=t;for(let n=0;n<i;n+=1){const r=e.match(/^ {0,3}> ?/);if(!r)break;e=e.slice(r[0].length)}return e}function y(t){const i=t.filter(n=>n.trim()!=="").map(n=>n.match(/^[ \t]*/)?.[0]??""),e=i.reduce(E,i[0]??"");return t.map(n=>n.startsWith(e)?n.slice(e.length):n.trimStart())}function E(t,i){let e=0;for(;e<t.length&&e<i.length&&t[e]===i[e];)e+=1;return t.slice(0,e)}export{k as resolveTagRawContent};
|