@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.
Files changed (253) hide show
  1. package/CHANGELOG.md +419 -199
  2. package/dist/api-schemas/mcp-fetch-count.d.ts +2 -18
  3. package/dist/api-schemas/otel-traces.d.ts +7 -1345
  4. package/dist/api-schemas/otel-traces.js +1 -1
  5. package/dist/api-schemas/search-facets.d.ts +3 -31
  6. package/dist/api-schemas/search.d.ts +6 -52
  7. package/dist/cli/build/index.js +1 -1
  8. package/dist/cli/eject/resolveEjectParams.js +1 -1
  9. package/dist/cli/generate/get-schema-template.js +1 -1
  10. package/dist/client/app/hooks/markdown/useMarkdocRenderer.js +1 -1
  11. package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
  12. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +2 -0
  13. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  14. package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +1 -33
  15. package/dist/client/app/useGlobalData.d.ts +1 -1
  16. package/dist/client/providers/post-message/use-post-message.d.ts +1 -1
  17. package/dist/client/templates/api-docs/helpers.js +3 -3
  18. package/dist/compiled/@redocly/pii/index.mjs +1 -0
  19. package/dist/compiled/@redocly/pii/package.json +1 -0
  20. package/dist/compiled/svgo/svgo-node.js +1 -1
  21. package/dist/constants/l10n/langs/ar.js +1 -1
  22. package/dist/constants/l10n/langs/de.js +1 -1
  23. package/dist/constants/l10n/langs/en.js +1 -1
  24. package/dist/constants/l10n/langs/es.js +1 -1
  25. package/dist/constants/l10n/langs/fr.js +1 -1
  26. package/dist/constants/l10n/langs/hi.js +1 -1
  27. package/dist/constants/l10n/langs/it.js +1 -1
  28. package/dist/constants/l10n/langs/ja.js +1 -1
  29. package/dist/constants/l10n/langs/ko.js +1 -1
  30. package/dist/constants/l10n/langs/pl.js +1 -1
  31. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  32. package/dist/constants/l10n/langs/pt.js +1 -1
  33. package/dist/constants/l10n/langs/ru.js +1 -1
  34. package/dist/constants/l10n/langs/uk.js +1 -1
  35. package/dist/constants/l10n/langs/zh.js +1 -1
  36. package/dist/markdoc/attributes/definition-path.d.ts +1 -1
  37. package/dist/markdoc/attributes/json-example-ref.d.ts +1 -1
  38. package/dist/markdoc/attributes/json-schema-ref.d.ts +1 -1
  39. package/dist/markdoc/attributes/parsed-yaml.d.ts +1 -1
  40. package/dist/markdoc/attributes/raw-content.d.ts +1 -1
  41. package/dist/markdoc/attributes/sample-from-json-schema.d.ts +1 -1
  42. package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +1 -1
  43. package/dist/markdoc/helpers/get-inner-text.d.ts +1 -1
  44. package/dist/markdoc/helpers/get-node-attribute.d.ts +1 -1
  45. package/dist/markdoc/helpers/get-variable.d.ts +1 -1
  46. package/dist/markdoc/helpers/guards/is-conditional-node.d.ts +1 -1
  47. package/dist/markdoc/helpers/guards/is-function.d.ts +1 -1
  48. package/dist/markdoc/helpers/guards/is-node.d.ts +1 -1
  49. package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +1 -1
  50. package/dist/markdoc/helpers/guards/is-tag.d.ts +1 -1
  51. package/dist/markdoc/helpers/guards/is-variable.d.ts +1 -1
  52. package/dist/markdoc/helpers/parse-partials.d.ts +1 -1
  53. package/dist/markdoc/helpers/parse-partials.js +1 -1
  54. package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
  55. package/dist/markdoc/helpers/set-node-attribute-value.d.ts +1 -1
  56. package/dist/markdoc/nodes/fence/index.d.ts +1 -1
  57. package/dist/markdoc/nodes/fence/index.js +1 -1
  58. package/dist/markdoc/nodes/gfm-list-item.d.ts +1 -1
  59. package/dist/markdoc/nodes/gfm-list-item.js +1 -1
  60. package/dist/markdoc/nodes/heading.d.ts +1 -1
  61. package/dist/markdoc/nodes/heading.js +1 -1
  62. package/dist/markdoc/nodes/index.d.ts +6 -165
  63. package/dist/markdoc/nodes/index.js +1 -1
  64. package/dist/markdoc/nodes/table.d.ts +1 -1
  65. package/dist/markdoc/nodes/table.js +1 -1
  66. package/dist/markdoc/nodes/text.d.ts +1 -1
  67. package/dist/markdoc/tags/json-example.js +1 -1
  68. package/dist/markdoc/tags/openapi-code-sample.js +1 -1
  69. package/dist/server/api-routes/execute-api-route.js +1 -1
  70. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  71. package/dist/server/config/env-config.d.ts +26 -24
  72. package/dist/server/config/env-schema.d.ts +87 -326
  73. package/dist/server/config/env-schemas/api-urls.d.ts +2 -14
  74. package/dist/server/config/env-schemas/auth.d.ts +10 -32
  75. package/dist/server/config/env-schemas/catalog.d.ts +6 -9
  76. package/dist/server/config/env-schemas/database.d.ts +2 -8
  77. package/dist/server/config/env-schemas/environment-detection.d.ts +20 -18
  78. package/dist/server/config/env-schemas/feature-flags.d.ts +29 -33
  79. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  80. package/dist/server/config/env-schemas/organization-project.d.ts +3 -21
  81. package/dist/server/config/env-schemas/scorecards.d.ts +2 -6
  82. package/dist/server/config/env-schemas/search.d.ts +9 -15
  83. package/dist/server/config/env-schemas/server-config.d.ts +6 -31
  84. package/dist/server/config/env-schemas/site.d.ts +1 -5
  85. package/dist/server/config/env-schemas/ssr.d.ts +7 -12
  86. package/dist/server/config/env-schemas/telemetry.d.ts +1 -7
  87. package/dist/server/constants/common.d.ts +3 -0
  88. package/dist/server/constants/common.js +1 -1
  89. package/dist/server/esbuild/plugins/dependency-resolver.js +1 -1
  90. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  91. package/dist/server/esbuild/plugins/themes-resolver.js +3 -3
  92. package/dist/server/external-plugins/resolve-external-plugins.js +1 -1
  93. package/dist/server/node-bundle-entry.js +1 -1
  94. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  95. package/dist/server/plugins/analytics/ga/build-scripts.js +6 -6
  96. package/dist/server/plugins/api-docs/definition-access.d.ts +22 -0
  97. package/dist/server/plugins/api-docs/definition-access.js +1 -0
  98. package/dist/server/plugins/api-docs/index.js +1 -1
  99. package/dist/server/plugins/api-docs/loader.d.ts +1 -1
  100. package/dist/server/plugins/api-docs/options.js +1 -1
  101. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +23 -23
  102. package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
  103. package/dist/server/plugins/config-parser/index.js +1 -1
  104. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  105. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.d.ts +1 -1
  106. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +1 -1
  107. package/dist/server/plugins/markdown/attribute-resolvers/index.d.ts +1 -1
  108. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.d.ts +1 -1
  109. package/dist/server/plugins/markdown/attribute-resolvers/resolve-diagram-from-file.d.ts +1 -1
  110. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.d.ts +1 -1
  111. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.d.ts +1 -1
  112. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-gallery.d.ts +1 -1
  113. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.d.ts +1 -1
  114. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.d.ts +1 -1
  115. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +1 -1
  116. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.d.ts +1 -1
  117. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
  118. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.d.ts +1 -1
  119. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.d.ts +1 -1
  120. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.d.ts +1 -1
  121. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +1 -1
  122. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
  123. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +1 -1
  124. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.d.ts +1 -1
  125. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.d.ts +1 -1
  126. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.d.ts +1 -1
  127. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.d.ts +1 -1
  128. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +1 -1
  129. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.d.ts +1 -1
  130. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +1 -1
  131. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -2
  132. package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +1 -1
  133. package/dist/server/plugins/markdown/compiler.d.ts +1 -1
  134. package/dist/server/plugins/markdown/compiler.js +1 -1
  135. package/dist/server/plugins/markdown/errors.d.ts +1 -1
  136. package/dist/server/plugins/markdown/get-server-props.js +1 -1
  137. package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +1 -1
  138. package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -1
  139. package/dist/server/plugins/markdown/markdoc/functions/concat.d.ts +1 -1
  140. package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +5 -165
  141. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  142. package/dist/server/plugins/markdown/markdoc/partials.d.ts +1 -1
  143. package/dist/server/plugins/markdown/markdoc/plugins/headings.d.ts +1 -1
  144. package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
  145. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +1 -1
  146. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -1
  147. package/dist/server/plugins/markdown/runtime-transform.d.ts +2 -2
  148. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  149. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  150. package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +1 -1
  151. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  152. package/dist/server/plugins/markdown/search/to-markdown.d.ts +1 -1
  153. package/dist/server/plugins/markdown/search/walk-sections.d.ts +1 -1
  154. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  155. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.d.ts +1 -1
  156. package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +1 -1
  157. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -3
  158. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
  159. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -1
  160. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +4 -4
  161. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  162. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +2 -2
  163. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  164. package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -5
  165. package/dist/server/plugins/mcp/handlers/errors.js +1 -1
  166. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  167. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
  168. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  169. package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
  170. package/dist/server/plugins/mcp/types.d.ts +10 -0
  171. package/dist/server/plugins/mcp/utils/available-tools.d.ts +5 -0
  172. package/dist/server/plugins/mcp/utils/available-tools.js +1 -0
  173. package/dist/server/plugins/mcp/workers/worker-context.d.ts +4 -0
  174. package/dist/server/plugins/mcp/workers/worker-context.js +1 -0
  175. package/dist/server/plugins/scorecard-classic/compute-scorecard.d.ts +2 -2
  176. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +1 -1
  177. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  178. package/dist/server/plugins/scorecard-classic/shared-utils.js +1 -1
  179. package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +3 -3
  180. package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
  181. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  182. package/dist/server/store-config.d.ts +33 -0
  183. package/dist/server/store-config.js +1 -0
  184. package/dist/server/store.d.ts +14 -16
  185. package/dist/server/store.js +1 -1
  186. package/dist/server/tools/notifiers/formatter.js +3 -3
  187. package/dist/server/tools/notifiers/helpers/colors.d.ts +1 -1
  188. package/dist/server/tools/notifiers/logger.d.ts +4 -0
  189. package/dist/server/tools/notifiers/reporter.js +1 -1
  190. package/dist/server/types/plugins/api-routes.d.ts +4 -1
  191. package/dist/server/types/plugins/common.d.ts +2 -1
  192. package/dist/server/utils/codeframes/codeframes.d.ts +1 -1
  193. package/dist/server/utils/codeframes/yaml-ast.d.ts +1 -1
  194. package/dist/server/utils/decode-request-path.d.ts +2 -0
  195. package/dist/server/utils/decode-request-path.js +1 -0
  196. package/dist/server/utils/envs/env-boolean-string.d.ts +9 -3
  197. package/dist/server/utils/envs/get-api-route-allowed-env-variables.d.ts +2 -0
  198. package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
  199. package/dist/server/utils/envs/interpolate-env-variables.d.ts +5 -1
  200. package/dist/server/utils/envs/interpolate-env-variables.js +1 -1
  201. package/dist/server/utils/envs/load-env-variables.js +1 -1
  202. package/dist/server/utils/envs/replace-env-variables-deep.d.ts +17 -9
  203. package/dist/server/utils/envs/replace-env-variables-deep.js +1 -1
  204. package/dist/server/utils/errors.d.ts +3 -0
  205. package/dist/server/utils/errors.js +1 -1
  206. package/dist/server/utils/globs.d.ts +12 -0
  207. package/dist/server/utils/globs.js +1 -1
  208. package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -1
  209. package/dist/server/utils/rbac-expand.js +1 -1
  210. package/dist/server/utils/rbac.d.ts +5 -1
  211. package/dist/server/utils/rbac.js +1 -1
  212. package/dist/server/utils/report-all-errors.js +1 -1
  213. package/dist/server/web-server/auth.d.ts +2 -0
  214. package/dist/server/web-server/auth.js +2 -2
  215. package/dist/server/web-server/middleware/jsonValidatorMiddleware.d.ts +5 -325
  216. package/dist/server/web-server/routes/auth.js +1 -1
  217. package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +1756 -1756
  218. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +295 -295
  219. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  220. package/dist/server/web-server/routes/error.js +1 -1
  221. package/dist/server/web-server/routes/helpers/process-redirects.js +1 -1
  222. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +2 -2
  223. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +18 -18
  224. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  225. package/dist/server/web-server/utils/ssrf-safe-lookup.d.ts +2 -1
  226. package/dist/server/web-server/utils/ssrf-safe-lookup.js +1 -1
  227. package/dist/server/workers/mcp-tool-worker-methods.d.ts +7 -0
  228. package/dist/server/workers/mcp-tool-worker-methods.js +1 -0
  229. package/dist/server/workers/mcp-tool-worker-pool.d.ts +0 -1
  230. package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
  231. package/dist/server/workers/mcp-tool-worker.js +1 -1
  232. package/dist/server/workers/types.d.ts +4 -8
  233. package/dist/server/workers/worker-config.d.ts +33 -0
  234. package/dist/server/workers/worker-config.js +1 -0
  235. package/dist/types/errors.d.ts +1 -1
  236. package/dist/types/markdoc.d.ts +1 -1
  237. package/package.json +12 -12
  238. package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.d.ts +0 -6
  239. package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +0 -1
  240. package/dist/server/plugins/markdown/html/process-html-tokens.d.ts +0 -2
  241. package/dist/server/plugins/markdown/html/process-html-tokens.js +0 -1
  242. package/dist/server/plugins/markdown/source.d.ts +0 -4
  243. package/dist/server/plugins/markdown/source.js +0 -1
  244. package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +0 -4
  245. package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +0 -1
  246. package/dist/server/tools/notifiers/helpers/privacy/mask-email.d.ts +0 -25
  247. package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +0 -1
  248. package/dist/server/tools/notifiers/helpers/privacy/mask-subject.d.ts +0 -13
  249. package/dist/server/tools/notifiers/helpers/privacy/mask-subject.js +0 -1
  250. package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.d.ts +0 -25
  251. package/dist/server/tools/notifiers/helpers/privacy/remove-pii-from-url.js +0 -1
  252. package/dist/server/tools/notifiers/helpers/privacy/remove-pii.d.ts +0 -36
  253. 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 C,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{mcpTagSchemas as ot,schemaDefinitionTag as rt,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as $}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as j,GRAPHQL_SPEC_SLUG as at,PUBLIC_RBAC_SCOPE_ITEM as N}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as st,PUBLIC_API_DEFINITIONS_FOLDER as it}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as E}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as nt}from"../../utils/paths.js";import{normalizeRouteSlug as ct}from"../../../utils/path/normalize-route-slug.js";import{removeTrailingSlash as pt}from"../../../utils/url/remove-trailing-slash.js";import{isTranslationFallback as ut}from"../../fs/utils/is-translation-fallback.js";import{createSlugify as lt}from"../create-slugify.js";import{apiDocLoader as dt,apiDocsLoader as mt}from"./loader.js";import{getTemplatePath as V}from"./get-template-path.js";import{storeDefinitionBundles as ft}from"./store-definition-bundles.js";import{telemetryTraceStep as gt}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as ht}from"./search/search-resolver.js";import{getAiDocumentsStore as Dt}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as St}from"../get-api-config.js";import{getRouteSlugsForPath as Pt}from"../utils.js";import{collectItemRoutes as yt}from"./utils/collect-item-routes.js";import{isChunkCurrent as It}from"./utils/decorators.js";import{applyNavItemToRoot as At}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as vt}from"./utils/build-routes-mapping.js";import{buildItemPositions as bt}from"./utils/build-item-positions.js";import{resolveApiDocTitle as Rt}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as W}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as _t}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Ct}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as Q}from"./import-api-docs-builder.js";import{envConfig as G}from"../../config/env-config.js";import{logger as Tt}from"../../tools/notifiers/logger.js";const k="openapi-spec-download",wt={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function de(){let e=[],r=new Map;const s=new WeakMap;let n=new Set,m={};function O(o,D,v){const y=s.get(o)??new Map;s.set(o,y);const S=D??"";return y.get(S)===v?!1:(y.set(S,v),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":dt,"api-docs":mt},processContent:async(o,D)=>{await gt("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(k,nt(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:it+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:st+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:at+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})});const v=o.createTemplate(j,V("../../../client/templates/api-docs/template.js")),y=o.registerServerPropsGetter(j,V("./get-server-props.js")),S=await D.getConfig();r=new Map,m={};const I=await o.loadApiDocuments(D);ft(I,o.outdir);const T=!!S.plugins?.some(t=>typeof t=="string"&&t.startsWith("@redocly/portal-plugin-async-api/"));T&&I.some(t=>t.type==="asyncapi")&&Tt.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?I.filter(t=>t.type!=="asyncapi"):I;e=c.map(({markdocChunks:t,relativePath:P,isVirtual:p,customOutputRelativeFile:a,realRelativePath:h})=>({chunks:t??[],relativePath:P,realRelativePath:h,isVirtual:a!=null||p}));const{buildItems:i}=await Q(o.serverOutDir),f=(await D.cache.load("content-slugs","content-slugs")).data,g=lt(f),F=t=>ct(g(t));for(const t of c){const P=t.customOutputRelativeFile||t.relativePath,p=F(P);Ot(t,p);const{items:a,store:h}=await i({type:t.type,document:t.document,options:t.options,basePath:p,markdownParser:U}),b=`${E}${t.relativePath}`,M=G.isDevelopMode?t.relativePath:void 0,u=Mt(t.document),R=u?.["x-metadata"],_=t.isVirtual?void 0:R?.apiId,L={document:t,basePath:p,sourcePath:M,apiId:_,build:{items:a,store:h}};await o.createSharedData(b,z(L,a,h));const Y=W(t.config),B=!!t.options.excludeFromSearch,X=t.type==="openapi",J=yt(a,Y),Z=ut(t),d=J.map(l=>{const x=l.metadata?.seo,w={fsPath:P,templateId:v,sharedData:[{key:"apiDocsStore",id:b}],serverPropsGetterIds:[y],excludeFromSearch:B,getStaticData:kt(l.label,x,Z),[A]:l[A]};return Object.assign(w,Ft(l.link,p)),X&&l.httpVerb&&(w.httpVerb=l.httpVerb,w.metadata={subType:"openapi-operation"}),w});if(!d.length)continue;const H=Rt(u,t.type,a),tt=Ct(u?.version),q={type:t.type,title:H,version:tt,description:typeof u?.description=="string"?u.description:void 0,summary:typeof u?.summary=="string"?u.summary:void 0,...u?.["x-metadata"]&&typeof u["x-metadata"]=="object"?u["x-metadata"]:{}};d[0]={...d[0],metadata:q,hasClientRoutes:!0,getSidebar:(l,x)=>At(K(a),p,x),getNavText:()=>H??wt[t.type]??"API Docs",getSearchDocuments:ht(a,q,o.getSearchFacets,o.setSearchFacets,B,h,t.document),getAiDocumentsStore:Dt({getBuild:()=>L.build,metadata:q,document:t.document,specType:t.type,excludeFromSearch:B,basePath:p,getSearchFacets:o.getSearchFacets,markdocTags:{...ot,schemaDefinition:rt}})};const et=d[0];d[0]=d[d.length-1],d[d.length-1]=et;for(const l of d)o.addRoute(l);if(_){const l=St(t.config?.apis,t.realRelativePath);m[_]={[A]:l.rbac,[C]:{fsPath:P}}}r.set(b,L)}})},afterRoutesCreated:async(o,D)=>{const{buildItems:v,simplifyAstStructure:y}=await Q(o.serverOutDir),S=new Set,I=new Set;for(const{chunks:c,relativePath:i,isVirtual:f}of e){const g=`${E}${i}`,F=Pt(o.getAllRoutes(),i);for(const{node:t,markdown:P,pointer:p,key:a,relativePath:h}of c){const{ast:b,compoundHash:M}=await o.parseMarkdoc({input:{content:P,relativePath:h,isVirtual:f},resource:p,context:D,deps:{sharedDataIds:[`${E}${h}`],routeSlugs:F}});if(S.add(p),!(a==="graphql-docs"?t?.description?.value!==void 0:!!a&&It(t,a,P))||!O(t,a,M))continue;I.add(g);const R=y(b);if(a==="graphql-docs"){t.description&&(t.description.value=R);const _=`${E}${h}`;Et(r.get(_),R)}else a&&(t[a]=R)}}const T=n.difference(S);for(const c of T)D.cache.delete(c);n=S,Object.entries(m).forEach(([c,i])=>{const f=i[C]?.fsPath;if(!f)return;const g=o.getRouteByFsPath(f)?.baseSlug;m[c]={...i,[C]:{...i[C],slug:g},slug:g}}),o.setGlobalData({apiProducts:m});for(const[c,i]of r){if(!I.has(c))continue;const{items:f,store:g}=await v({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});i.build={items:f,store:g},await o.createSharedData(c,z(i,f,g))}}}}function z({document:e,basePath:r,sourcePath:s,apiId:n},m,O){return{[A]:W(e.config),[C]:{slug:pt(r),fsPath:e.customOutputRelativeFile||e.relativePath},items:m,store:O,options:e.options,baseSlug:r,routesMapping:G.isDevelopMode?vt(m,r):{},graphqlPositions:G.isDevelopMode&&e.type==="graphql"?bt(m,r):void 0,sourcePath:s,apiId:n}}function Et(e,r){e?.document.type!=="graphql"||!e.document.options||(e.document.options.info={...e.document.options.info||{},description:r})}function kt(e,r,s){return async function(n){return{...s?{isTranslationFallback:!0}:{},props:{settings:{baseUrlPath:$(n.baseSlug)},disableAutoScroll:!0,seo:{title:e,...r}}}}}function Ot(e,r){const s=e.options?.mockServer,n=$(`/_mock${_t(e.relativePath)}`);s?.url===n&&(e.options={...e.options,mockServer:{...s,url:$(`/_mock${r}`)}})}function Ft(e,r){if(e===r)return{};const s=r==="/"?"/":`${r}/`;if(e.startsWith(s)){const n=e.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:e}}function Mt(e){if(e&&typeof e=="object"&&"info"in e)return e.info}function K(e){return e.map(({content:r,items:s,...n})=>({...n,...s&&{items:K(s)}}))}export{de as apiDocsPlugin,Ft as toRouteSlugFields};
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 '@markdoc/markdoc';
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 F from"node:path";import{findFirstBinding as P,markdocParser as _}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 w}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as L}from"../../config/env-config.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as A}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as g}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as B}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const t=B(r);return{url:k(`/_mock${t}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(w,`${g(o,F.posix.extname(o))}?download`)]:[i(f,`${g(o,".json")}?download`),i(f,`${g(o,".yaml")}?download`)]).map(t=>({url:k(t)}))}function j(o,r,m){const{rootConfig:t,config:c,apiConfig:s,mergedConfig:e,relativePath:l}=m,a=M(t?.[o]||{},c[o]||{},s[o]||s.theme?.[o]||{}),b=r["x-feedback"]||a.feedback||c.feedback,S=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!t?.[o]?.excludeFromSearch||!!t?.theme?.[o]?.excludeFromSearch,x=e.rbac||s.rbac,p=A(b),u=c.metadata,C={...p&&{feedback:p},mockServer:D(e?.mockServer||t?.mockServer,l),disableRouter:!0,downloadUrls:a.downloadUrls||I(l,o),excludeFromSearch:S,rbac:x,markdownParser:_,replayFeatures:{graphql:L.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1}};let d;if(o==="graphql"){const n=a;d={title:n.info?.title,...u,...n.metadata??{}}}else{const n=r.info,E=n?.["x-metadata"];d={title:n?.title,description:n?.description,...o==="openapi"&&{summary:n?.summary},...u,...E}}o==="openapi"&&a.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const O=a.markdocOptions??R,h={...a,...C,specType:o,markdocOptions:O,metadata:d};return o==="asyncapi"&&(h.protocol=P(r)??void 0),h}export{I as buildDownloadUrls,j as createOptions};
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 x from"node:path";import{REDOCLY_TEAMS_RBAC as C}from"@redocly/config";import{nodeTypes as $,contentType as g,isGraphqlFieldsNode as pn,resolveGraphqlItemFields as un}from"@redocly/api-docs";import{normalizeApiVersion as dn}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as mn,canDownloadApiDefinition as hn,extractTeamsFromScopeItems as $n}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 yn}from"../../../../constants/common.js";import{isPlainObject as N}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 On}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 Sn}from"./search-facets.js";import{createApiDocsSearchIndexer as An,createLlmDescriptionFormatter as xn}from"./create-indexer.js";function O(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 On(l.slug,p.getGlobalData?.().l10n),P=bn(h,en,on),L=p.getConfig(),D=In(l.fsPath),R=xn(P),V=An(r,R,m?.schemaStore,c,m?.exampleStore,m?.graphqlMeta),F=b=>{for(const u of b)V.addItem(u),u.items?.length&&F(u.items)};F(a);const sn=V.getResult(),_=new Map;for(const b of sn)_.set(b.url,b);const E=typeof s.title=="string"?s.title:void 0,q=dn(s.version),k=Sn(l.metadata||{},E,q,t),S=[],A=[],G=Cn(c,s),z=G?R(G):void 0,W=Tn(s,z,c,o,R),B=Ln(o,s,l.fsPath,L),rn=En(a,L,P),cn=W+B+`
2
- `+rn,ln=W+B;A.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&&O(c,o)?c.security:void 0,U=b=>{for(const u of b){if(!u.content||!u.link){u.items?.length&&U(u.items);continue}const an=_.get(u.link),J=u.content.contentType,Q=u[C],H=Q?$n(Q):void 0,Y=H?.length?H:void 0;if(J===g.ITEM){const y=kn(u,c,o)??nn(u,an,o,q,fn,P,m);if(y){const I=u.label||"";A.push({title:I,description:void 0,content:y,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:I,content:y,url:u.link,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k,rbacTeams:Y})}}else if(J===g.GROUP){const y=Un(u,L,o,P,m);if(y){const I=u.label||"";A.push({title:I,description:void 0,content:y.llmstxt,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:I,content:y.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 A},async getSearchDocuments(){return S}}}}function Cn(e,s){const c=N(e?.info)?e.info:void 0,o=N(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}
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(O(c,o)){const{info:f}=c;f?.license?.name&&(l+=`License: ${f.license.name}
10
- `);const d=f["x-metadata"],p=Object.entries(N(d)?d:{}).filter(([m,h])=>m!=="description"||typeof h!="string"),a=Pn(Object.fromEntries(p));a&&(l+=`
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+=Dn(c,o,n),l+=Rn(c,o,n),l}function Ln(e,s,c,o){if(!c)return"";let n,r,t;if(e==="openapi")n=x.posix.join(X,v(c,".yaml")),r="## Download OpenAPI description",t="OpenAPI definition";else if(e==="asyncapi")n=x.posix.join(X,v(c,".yaml")),r="## Download AsyncAPI description",t="AsyncAPI definition";else if(e==="graphql"){const f=x.posix.extname(c)||".graphql";n=x.posix.join(yn,v(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}
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 Dn(e,s,c){if(!e)return"";if(O(e,s)){const{servers:o}=e;if(!o?.length)return"";let n=`## Servers
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)if(r.description&&(n+=`${c(r.description)}
19
+ `;for(const r of o){r.description&&(n+=`${c(r.description)}
20
20
  `),n+=`\`\`\`
21
21
  ${r.url}
22
22
  \`\`\`
23
23
 
24
- `,r.variables){n+=`Variables:
25
- `;for(const[t,i]of Object.entries(r.variables))n+=`- \`${t}\`${i.description?`: ${c(i.description).replace(/\s+/g," ")}`:""}
26
- `,i.default&&(n+=` Default: ${JSON.stringify(i.default)}
27
- `),i.enum&&(n+=` Enum: ${i.enum.map(l=>JSON.stringify(l)).join(", ")}
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{servers:o}=e;if(!o||!Object.keys(o).length)return"";let n=`## Servers
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 Object.entries(o))n+=`### ${r}
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 Rn(e,s,c){if(!e||!O(e,s))return"";const o=e.components?.securitySchemes;if(!o)return"";let n=`## Security
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 En(e,s,c){let o="";const n=(r,t)=>{for(const i of r)if(i.link){if(i.content?.contentType===g.GROUP)o+=`${t} ${i.label||""}
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===g.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?T(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=T(e.content.children,r),d=e.content.meta?.deprecated;let p=`# ${l}${d?" (deprecated)":""}
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=vn(e.content.children,n);h&&(p+=`Security: ${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 kn(e,s,c){if(e.httpVerb!=="tool"||!s||!O(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}
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 Un(e,s,c,o,n){if(!e.content)return;const r=e.label||"",t=T(e.content.children,o);let i=`# ${r}
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===g.ITEM){const m=nn(a,void 0,c,void 0,void 0,o,n);m&&(f+=`${m}
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===g.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!==g.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?T(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 vn(e,s){const c=[],o=n=>{for(const r of n)if(r.nodeType===$.SECURITY){const t=r;for(const i of t.requirements)for(const l of i.schemes)l[C]||l.name&&!c.includes(l.name)&&c.push(l.name)}else(r.nodeType===$.CONTAINER||r.nodeType===$.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":""})
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===$.ITEM){const i=pn(t)?un(t,s??{}):void 0;i&&(o+=wn(i,t.variant,c))}else(t.nodeType===$.CONTAINER||t.nodeType===$.OVERVIEW_SECTION_WRAPPER)&&n(t.children)};return n(e),o}function wn(e,s,c){let n=`
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 T(e,s){const c=[],o=r=>{for(const t of r)if(t.nodeType===$.MARKDOC){const i=t.content,l=Array.isArray(i)?i:[i],f=j(l,{renderTag:s}).trim();f&&c.push(f)}else(t.nodeType===$.CONTAINER||t.nodeType===$.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||"",[C]:e[C]},s)}export{it as getAiDocumentsStore};
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 n from"node:path";import{existsSync as u}from"node:fs";import{readFile as S}from"node:fs/promises";import q from"js-yaml";import{withoutPathPrefix as j}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as x,PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as g}from"../../../constants/common.js";import{canDownloadApiDefinition as C,filterDataByAccessDeep as T}from"../../utils/rbac.js";import{API_DOWNLOAD_PREFIXES as U}from"../../utils/is-api-download-link.js";const v=[".json",".yaml",".yml"],B=[".graphql",".gql"];function A(s,e){const o=n.parse(s);return n.join(o.dir,o.name+e)}function G(s){let e;try{e=decodeURIComponent(s)}catch{return}return e.includes("\\")||e.split("/").slice(1).some(t=>t===""||t==="."||t==="..")?void 0:e}const X=async(s,e,o)=>{const{isAuthenticated:t,teams:d,claims:{email:f}}=e.user,y=new URL(s.url),a=G(j(y.pathname));if(a===void 0)return new Response("Bad Request",{status:400});const c=U.find(r=>a.startsWith(`${r}/`));if(c===void 0)return new Response("Not found",{status:404});const m=c===g,i=a.slice(c.length),p=n.extname(i);if(!(m?B:v).includes(p))return new Response("Not found",{status:404});const{rbac:h={},requiresLogin:P=!1}=e.config.access||{};if(!C(a,h,P,{isAuthenticated:t,email:f,teams:d}))return new Response("Unauthorized",{status:t?403:401});const l=o.props?.outdir||"";if(m){const r=n.join(l,w,i);if(!u(r))return new Response("Not found",{status:404});const L=await S(r,"utf-8");return new Response(L,{headers:{"Content-Type":"application/graphql"}})}const R=n.join(l,w,A(i,".json")),E=n.join(l,x,A(i,".json")),I=u(R),D=u(E);if(!I&&!D)return new Response("Not found",{status:404});const _=await S(I?R:E,"utf-8"),F=JSON.parse(_),N=T(F,{isAuthenticated:t,email:f,teams:d},h,P),O=p===".yaml"?q.dump(N):JSON.stringify(N,null,2);return new Response(O,{headers:{"Content-Type":p===".yaml"?"application/yaml":"application/json"}})};var Y=X;export{Y as default};
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 u,REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{deepMerge as T}from"../../../utils/object/deep-merge.js";import{parsePathVersions as D}from"../../../utils/path/parse-path-versions.js";import{buildWildcardRedirectsTree as w}from"../../utils/redirects/build-wildcard-redirects-tree.js";import{shaHexShort as E}from"../../utils/crypto/sha-hex-short.js";import{formatCustomScripts as h,formatCustomLinks as L}from"./format-custom-tags.js";import{applyL10nToRbacConfig as O,resolveDirectoryHashes as k}from"../../utils/rbac.js";import{isConsentEnabled as G}from"../consent/is-consent-enabled.js";import{copySeoAssets as B}from"./copy-seo-assets.js";import{normalizeRedirectSources as F}from"./normalize-redirect-sources.js";import{applyL10nToRedirects as _}from"./apply-l10n-to-redirects.js";import{DEFAULT_LOADERS as j}from"./loaders/index.js";import{resolveSearchFacets as x}from"./resolve-search-facets.js";import{telemetryTraceStep as M}from"../../../cli/telemetry/helpers/trace-step.js";import{transformMdAst as z}from"../markdown/runtime-transform.js";import{EntitlementsProvider as I}from"../../entitlements/entitlements-provider.js";async function ir(){return{id:"Config Parser",loaders:j,async processContent(e,{getConfig:a,fs:o}){await M("com.redocly.build.plugin.configParser",async t=>{const{contentDir:l,setGlobalConfig:s,setGlobalData:i}=e,r=await a(),n=r.access||{},m=O(o,n.rbac||{}),f={outdir:e.outdir,contentDir:l,consentEnabled:G(r.consent)},C=await h(r.scripts?.head,f),P=await L(r.links,f),R=await h(r.scripts?.body,f),d=T(r,{headScriptTags:C,linkTags:P,postBodyScriptTags:R});t?.setAttribute("config",JSON.stringify(d));const p=r.redirects?F(r.redirects):{},v=Object.keys(p),A=d.banner?.map(c=>typeof c=="object"&&c!==null&&c.rbac?{...c,[y]:c.rbac}:c);s({...d,banner:A,access:{...n,requiresLogin:!!n.requiresLogin,rbac:m},directoryPaths:await k(o,n.rbac),seo:r.seo&&await B(r.seo,f.contentDir,f.outdir),redirects:_(p,r.l10n),wildcardRedirectsTree:w(p),originalRedirectSources:v}),x(r.search?.filters?.facets||[],e.getSearchFacets,e.setSearchFacets);const b=I.instance(),g=!!b.canAccessFeature("removeAttribution");i({removeAttribution:b.pricingTier?g:!0,removeConsoleAttribution:g&&r.removeAttribution===!0})})},async afterRoutesCreated(e,a){V(e);const o=e.getGlobalConfig("banner");if(Array.isArray(o)){const t=await Promise.all(o.map(async(l,s)=>{const{content:i,...r}=l,{ast:n}=await e.parseMarkdoc({input:{content:i,relativePath:"redocly.yaml"},context:a,resource:`redocly.yaml#banner${s}`}),{renderableAst:m}=await z(n,{variables:{},partials:{}},e.serverOutDir);return{...r,ast:m,hash:E(i)}}));e.setGlobalConfig({banner:t})}}}}function V(e){const a=e.getGlobalConfig("access")?.rbac,o=e.getGlobalConfig("directoryPaths");if(!(!a||Object.keys(a).length===0))for(const t of e.getAllRoutes()){if(t.versions&&o){const l=D(t.fsPath)?.filePathInVersion||"index.md";for(const s of t.versions){const i=o[s.folderId],n=i==="."||i==="/"?"":i;s[u]={slug:s.link,fsPath:S.posix.join(n,"@"+s.version,l)}}}t[u]||t[y]||(t[u]={slug:t.slug,fsPath:t.fsPath})}}export{ir as configParserPlugin};
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 w from"path";import{lintConfig as $,loadConfig as T,createConfigTypes as q}from"@redocly/openapi-core";import{rootRedoclyConfigSchema as x}from"@redocly/config";import{deepMerge as L}from"../../../../../utils/object/deep-merge.js";import{isPlainObject as g}from"../../../../../utils/guards/is-plain-object.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as j}from"../../../../../constants/common.js";import{sanitizeBranchName as E}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as R}from"../../../../config/env-config.js";import{ajv as S,safeParsePartial as B}from"../../safe-parse.js";import{formatConfigProblem as I}from"../../format-error.js";import{ExternalResolver as N}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as O}from"../../resolve-mutual-exclusion.js";function y(e,t,r,s){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||s(new Error(`Invalid ${r} URL: "${e[t]}". ${r} must start with "http://" or "https://".`)))}function _(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const r=e.access;y(r,"logoutReturnUrl","access.logoutReturnUrl",t),y(r,"residency","access.residency",t);const s=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const i of s)i in r&&r[i]!==void 0&&i in e&&e[i]!==void 0&&t(new Error(`Property '${i}' is defined both at root level and in 'access' object. Please use 'access.${i}' to define this configuration.`))}}function k(e){return S.compile(x.properties.graphql.properties.servers.items.properties.url)(e)}function C(e,t,r){if(g(e)&&Array.isArray(e.servers))for(const s of e.servers){const i=g(s)?s.url:void 0;if(typeof i=="string"&&!k(i)){const l=e.servers.indexOf(s),a=`${t}.servers[${l}].url`;r(new Error(`Invalid ${a}: "${i}". It must be an absolute http:// or https:// URL.`))}}}function G(e,t){if(C(e.graphql,"graphql",t),!!g(e.apis))for(const[r,s]of Object.entries(e.apis))g(s)&&C(s.graphql,`apis.${r}.graphql`,t)}async function oe(e,t,r,s){const l=t.getFileInfo(e)?.realRelativePath||e;async function a(){const p=new N(t),u=w.join(t.cwd,l),c=await T({configPath:u,externalRefResolver:p}),f=await s(c.resolvedConfig);if(f===void 0)return c.resolvedConfig;const m=c.document?.source,b=[...m?await $({config:c,externalConfigTypes:q(f,c)}):[],...m?O(c.resolvedConfig,m):[]];if(b.length>0)for(const U of b)r(new Error(I(U,t.cwd)));return c.resolvedConfig}const n=t.exists(e)?await a():{},A=D(n),P=await s(n);y(n,"residency","Residency",r),y(n,"logoutReturnUrl","Logout return URL",r),_(n,r),G(n,r);let h=P?B(P,n):n;const{env:v}=h;if(v){const p=R.REDOCLY_ENV,u=v[p]||{},c=R.PUBLIC_REDOCLY_BRANCH_NAME||"",f=c?E(c):"",m=f&&v[`${j}${f}`]||{};h=L(h,m,u)}const o=z(h,A);if(o.imports&&o.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const p=new Set([...o.plugins||[],...o.imports.map(u=>w.posix.join(u,"plugin.js"))]);o.plugins=Array.from(p),delete o.imports}if(o.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),o.catalogClassic={...o.catalog},delete o.catalog),o.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),o.scorecardClassic=o.scorecard,delete o.scorecard),o.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const p={...o.search?.ai,...o.aiAssistant,suggestions:o.aiAssistant?.suggestions?.length?o.aiAssistant.suggestions:o.search?.ai.suggestions||[]};o.aiAssistant=p,delete o.search.ai}return M(o)}function M(e){const t={...e},s={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},i=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],l=[];for(const a of i){const n=t[a];n!==void 0&&(l.push(a),a==="requiresLogin"&&s.requiresLogin===void 0&&(s.requiresLogin=n),a==="logoutReturnUrl"&&s.logoutReturnUrl===void 0&&(s.logoutReturnUrl=n),a==="residency"&&s.residency===void 0&&(s.residency=n),a==="sso"&&s.sso===void 0&&(s.sso=n),a==="idps"&&s.idps===void 0&&(s.idps=n),a==="rbac"&&s.rbac===void 0&&(s.rbac=n),delete t[a])}return l.length>0&&d.warn(`The following properties at root level are deprecated: ${l.join(", ")}. Please move them to the 'access' object.`),Object.keys(s).length>0&&(t.access=s),t}function D(e){if(!e.theme)return[];d.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const t=[];for(const r of Object.keys(e.theme))e[r]==null?t.push(r):d.warn(`Detected both '${r}' and 'theme.${r}' properties in redocly.yaml. The 'theme.${r}' property will be ignored and needs to be removed or merged into the '${r}'.`);return t}function z(e,t){if(!e.theme||t.length===0)return e;const r={...e};for(const s of t)r[s]=e.theme[s];return delete r.theme,r}export{M as ensureAccessBackwardsCompatibility,oe as readAndValidateConfig};
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};
@@ -1,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
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,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
1
+ import type { Node } from '@redocly/markdoc';
2
2
  import type { OpenAPIDefinition, RawApiDocsOptions } from '@redocly/api-docs';
3
3
  import type { LifecycleContext } from '../../../../types';
4
4
  export type OpenapiBundle = {
@@ -1,5 +1,5 @@
1
1
  import type { MarkdocResolveContext, WithOriginalAttr } from '../../../types';
2
- import type { Node } from '@markdoc/markdoc';
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>;
@@ -1,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 y,getRequestBodySamples as v,normalizeOptions as d,resolveOperationSampleContext as f}from"@redocly/api-docs";import{setNodeAttributeValue as S}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as O}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as t}from"./utils.js";const b={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 B(e,c,h,{context:u}){const o=await O(e,u);if(!o)return;const s=t(e,"language"),r={exampleKey:t(e,"exampleKey"),mimeType:t(e,"mimeType"),parameters:t(e,"parameters"),requestBody:t(e,"requestBody"),environments:t(e,"environments"),environment:t(e,"environment")},g={...o.rawOptions,...o.rawOptions.mockServer&&{mockServer:{...o.rawOptions.mockServer,position:"off"}},...s&&{codeSamples:{...o.rawOptions.codeSamples,languages:[{lang:s}]}}},l=d(g),n=f(o.definition,l,{operationId:t(e,"operationId"),pointer:t(e,"pointer")});if(!n)return;const i=y(n,r).map(a=>({lang:b[a.lang]??a.lang.toLowerCase(),title:a.label??a.lang,source:a.source})),m=l.codeSamples?.languages??[],p=m.findIndex(({lang:a})=>a==="Payload");if(p!==-1){const a=v(n,{exampleKey:r.exampleKey,mimeType:r.mimeType,titlePrefix:m[p].label});i.splice(p,0,...a)}i.length&&S(e,c,i)}export{B as resolveOpenapiCodeSamples};
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};
@@ -1,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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
@@ -1,4 +1,4 @@
1
- import type { Node } from '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 '@markdoc/markdoc';
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 l from"@markdoc/markdoc";import{setNodeAttributeValue as u}from"../../../../markdoc/helpers/set-node-attribute-value.js";async function P(t,r,e,{readSourceLines:n}){if(t.children.length===0&&typeof t.attributes[r]=="string")return;if(t.inline){u(t,r,m(t)),t.children=[];return}if(n===void 0)return;const[i,c,o]=t.lines;if(i===void 0||c===void 0||o===void 0)return;const s=n(),f=p(s[i]??""),a=s.slice(c,o).map(h=>g(h,f)),d=b(a).join(`
2
- `).replace(/^(?:[ \t]*\n)+/,"").trimEnd();u(t,r,d),t.children=[]}function m(t){return l.format(new l.Ast.Node("inline",{},t.children)).trim()}function p(t){return t.slice(0,Math.max(t.indexOf("{%"),0)).split(">").length-1}function g(t,r){let e=t;for(let n=0;n<r;n+=1){const i=e.match(/^ {0,3}> ?/);if(!i)break;e=e.slice(i[0].length)}return e}function b(t){const r=t.filter(n=>n.trim()!=="").map(n=>n.match(/^[ \t]*/)?.[0]??""),e=r.reduce(x,r[0]??"");return t.map(n=>n.startsWith(e)?n.slice(e.length):n.trimStart())}function x(t,r){let e=0;for(;e<t.length&&e<r.length&&t[e]===r[e];)e+=1;return t.slice(0,e)}export{P as resolveTagRawContent};
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};