@redocly/redoc-reef 0.138.0-next.9 → 0.139.0-next.1

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 (282) hide show
  1. package/CHANGELOG.md +346 -0
  2. package/dist/api-schemas/mcp-fetch-count.d.ts +24 -0
  3. package/dist/api-schemas/mcp-fetch-count.js +1 -0
  4. package/dist/bin.js +0 -0
  5. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  6. package/dist/cli/build/analytics/collectors/get-processed-config-stats-usage.js +1 -1
  7. package/dist/cli/build/index.js +1 -1
  8. package/dist/cli/develop.js +1 -1
  9. package/dist/cli/eject/ejectTheme.js +1 -1
  10. package/dist/cli/translations/collect-config-translations.js +1 -1
  11. package/dist/client/App.js +1 -1
  12. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  13. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  14. package/dist/client/app/pages/Invite/Invite.js +1 -1
  15. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  16. package/dist/client/polyfills.js +1 -1
  17. package/dist/client/runtime/loader.js +1 -1
  18. package/dist/client/templates/api-docs/template.js +1 -1
  19. package/dist/client/utils/catalog/parse-filter-query.js +1 -1
  20. package/dist/compiled/svgo/svgo-node.js +39 -39
  21. package/dist/constants/api.d.ts +1 -0
  22. package/dist/constants/api.js +1 -1
  23. package/dist/constants/common.d.ts +6 -0
  24. package/dist/constants/common.js +1 -1
  25. package/dist/constants/l10n/langs/ar.js +1 -1
  26. package/dist/constants/l10n/langs/de.js +1 -1
  27. package/dist/constants/l10n/langs/en.js +1 -1
  28. package/dist/constants/l10n/langs/es.js +1 -1
  29. package/dist/constants/l10n/langs/fr.js +1 -1
  30. package/dist/constants/l10n/langs/hi.js +1 -1
  31. package/dist/constants/l10n/langs/it.js +1 -1
  32. package/dist/constants/l10n/langs/ja.js +1 -1
  33. package/dist/constants/l10n/langs/ko.js +1 -1
  34. package/dist/constants/l10n/langs/pl.js +1 -1
  35. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  36. package/dist/constants/l10n/langs/pt.js +1 -1
  37. package/dist/constants/l10n/langs/ru.js +1 -1
  38. package/dist/constants/l10n/langs/uk.js +1 -1
  39. package/dist/constants/l10n/langs/zh.js +1 -1
  40. package/dist/markdoc/helpers/get-inner-text.js +2 -2
  41. package/dist/markdoc/helpers/guards/is-prompt-node.d.ts +13 -0
  42. package/dist/markdoc/helpers/guards/is-prompt-node.js +1 -0
  43. package/dist/server/config/env-config.d.ts +0 -2
  44. package/dist/server/config/env-schema.d.ts +0 -5
  45. package/dist/server/config/env-schemas/feature-flags.d.ts +0 -4
  46. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  47. package/dist/server/constants/entitlements.js +1 -1
  48. package/dist/server/entitlements/entitlements-provider.js +1 -1
  49. package/dist/server/esbuild/esbuild.js +3 -3
  50. package/dist/server/esbuild/plugins/on-rebuild.js +1 -1
  51. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  52. package/dist/server/esbuild/plugins/yaml-loader.js +1 -1
  53. package/dist/server/fs/content-fs.js +1 -1
  54. package/dist/server/fs/utils/is-l10n-root-file.d.ts +3 -0
  55. package/dist/server/fs/utils/is-l10n-root-file.js +1 -0
  56. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  57. package/dist/server/plugins/analytics/heap/browser-hooks.js +1 -1
  58. package/dist/server/plugins/api-docs/index.js +1 -1
  59. package/dist/server/plugins/api-docs/loader.js +3 -3
  60. package/dist/server/plugins/api-docs/search/create-indexer.d.ts +9 -2
  61. package/dist/server/plugins/api-docs/search/create-indexer.js +1 -1
  62. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +68 -68
  63. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
  64. package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
  65. package/dist/server/plugins/api-docs/utils/apply-nav-item-to-root.js +1 -1
  66. package/dist/server/plugins/api-docs/utils/decorators.d.ts +11 -0
  67. package/dist/server/plugins/api-docs/utils/decorators.js +1 -1
  68. package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
  69. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  70. package/dist/server/plugins/catalog-entities/utils/extract-parts-from-channels-message-ref.js +1 -1
  71. package/dist/server/plugins/config-parser/format-custom-tags.js +1 -1
  72. package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
  73. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  74. package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
  75. package/dist/server/plugins/config-parser/resolve-mutual-exclusion.js +1 -1
  76. package/dist/server/plugins/config-parser/safe-parse.js +1 -1
  77. package/dist/server/plugins/default-theme/resolve-logo.js +1 -1
  78. package/dist/server/plugins/dev-onboarding/api/adapters/apigee/adapter.js +2 -2
  79. package/dist/server/plugins/dev-onboarding/api/adapters/gravitee/client.js +2 -2
  80. package/dist/server/plugins/dev-onboarding/api/combine.js +1 -1
  81. package/dist/server/plugins/dev-onboarding/template/components/AppOverview.js +1 -1
  82. package/dist/server/plugins/dev-onboarding/template/components/useSortableData.js +1 -1
  83. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/file-chunk-parser.d.ts +1 -1
  84. package/dist/server/plugins/markdown/attribute-resolvers/index.js +1 -1
  85. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  86. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  87. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.d.ts +4 -0
  88. package/dist/server/plugins/markdown/attribute-resolvers/resolve-tag-raw-content.js +2 -0
  89. package/dist/server/plugins/markdown/compiler.js +1 -1
  90. package/dist/server/plugins/markdown/create-source-lines-reader.d.ts +7 -0
  91. package/dist/server/plugins/markdown/create-source-lines-reader.js +1 -0
  92. package/dist/server/plugins/markdown/html/normalize-html-headings.d.ts +9 -0
  93. package/dist/server/plugins/markdown/html/normalize-html-headings.js +1 -0
  94. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  95. package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +1 -1
  96. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  97. package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
  98. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  99. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  100. package/dist/server/plugins/markdown/search/to-markdown.js +13 -13
  101. package/dist/server/plugins/markdown/search/walk-sections.d.ts +3 -1
  102. package/dist/server/plugins/markdown/search/walk-sections.js +3 -3
  103. package/dist/server/plugins/markdown/utils/sanitize-malformed-md-content.js +2 -2
  104. package/dist/server/plugins/mcp/audit/audit-log.d.ts +1 -1
  105. package/dist/server/plugins/mcp/audit/audit-log.js +1 -1
  106. package/dist/server/plugins/mcp/audit/code-credentials.d.ts +9 -0
  107. package/dist/server/plugins/mcp/audit/code-credentials.js +2 -0
  108. package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +5 -5
  109. package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +3 -1
  110. package/dist/server/plugins/mcp/codemode/capabilities/utils.d.ts +2 -1
  111. package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
  112. package/dist/server/plugins/mcp/codemode/code-audit.d.ts +4 -3
  113. package/dist/server/plugins/mcp/codemode/code-execution-audit.js +1 -1
  114. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  115. package/dist/server/plugins/mcp/codemode/prompts.d.ts +2 -1
  116. package/dist/server/plugins/mcp/codemode/prompts.js +8 -8
  117. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +2 -2
  118. package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +2 -0
  119. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  120. package/dist/server/plugins/mcp/constants.d.ts +2 -0
  121. package/dist/server/plugins/mcp/constants.js +1 -1
  122. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  123. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
  124. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.js +2 -2
  125. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +1 -1
  126. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  127. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +12 -3
  128. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
  129. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.d.ts +2 -2
  130. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.js +1 -1
  131. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.d.ts +11 -0
  132. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.js +1 -0
  133. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.d.ts +32 -0
  134. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.js +1 -0
  135. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +8 -4
  136. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -1
  137. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.d.ts +9 -0
  138. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.js +1 -0
  139. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +1 -0
  140. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -5
  141. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +8 -4
  142. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  143. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.d.ts +2 -1
  144. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.js +1 -1
  145. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +11 -1
  146. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
  147. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.d.ts +11 -0
  148. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.js +1 -1
  149. package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
  150. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.d.ts +4 -0
  151. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-client.js +1 -0
  152. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.d.ts +4 -0
  153. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count-secret.js +1 -0
  154. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.d.ts +11 -0
  155. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-count.js +1 -0
  156. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.d.ts +13 -0
  157. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-counter-repository.js +13 -0
  158. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{limits.d.ts → fetch-limiter/fetch-limits.d.ts} +1 -1
  159. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/fetch-limiter/fetch-limits.js +1 -0
  160. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{apply-edge-rate-limit.d.ts → request-limiter/apply-edge-rate-limit.d.ts} +1 -1
  161. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/apply-edge-rate-limit.js +1 -0
  162. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{edge-limiter.d.ts → request-limiter/edge-limiter.d.ts} +3 -3
  163. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/edge-limiter.js +1 -0
  164. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/rate-limit-telemetry.js +1 -0
  165. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.d.ts +6 -0
  166. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/request-limits.js +1 -0
  167. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/ip-key.js +1 -0
  168. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{window-counter.d.ts → utils/window-counter.d.ts} +1 -1
  169. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/utils/window-counter.js +1 -0
  170. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.d.ts +18 -0
  171. package/dist/server/plugins/mcp/gateway-mcp/route-pattern.js +1 -0
  172. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +9 -3
  173. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
  174. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -1
  175. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +2 -0
  176. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +2 -2
  177. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +0 -2
  178. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -1
  179. package/dist/server/plugins/mcp/handlers/credentials-page/constants.d.ts +7 -0
  180. package/dist/server/plugins/mcp/handlers/credentials-page/constants.js +1 -0
  181. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.d.ts +5 -0
  182. package/dist/server/plugins/mcp/handlers/credentials-page/form-contract.js +1 -0
  183. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.d.ts +14 -0
  184. package/dist/server/plugins/mcp/handlers/credentials-page/form-page.js +62 -0
  185. package/dist/server/plugins/mcp/handlers/credentials-page/layout.d.ts +17 -0
  186. package/dist/server/plugins/mcp/handlers/credentials-page/layout.js +11 -0
  187. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.d.ts +10 -0
  188. package/dist/server/plugins/mcp/handlers/credentials-page/outcome-pages.js +11 -0
  189. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.d.ts +10 -0
  190. package/dist/server/plugins/mcp/handlers/credentials-page/site-branding.js +1 -0
  191. package/dist/server/plugins/mcp/handlers/credentials-page/styles.d.ts +4 -0
  192. package/dist/server/plugins/mcp/handlers/credentials-page/styles.js +186 -0
  193. package/dist/server/plugins/mcp/handlers/credentials-page/types.d.ts +32 -0
  194. package/dist/server/plugins/mcp/handlers/credentials-page/types.js +0 -0
  195. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  196. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  197. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.d.ts +0 -1
  198. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
  199. package/dist/server/plugins/mcp/index.js +1 -1
  200. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  201. package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
  202. package/dist/server/plugins/mcp/types.d.ts +16 -1
  203. package/dist/server/plugins/mcp/utils/docs-site-url.d.ts +6 -0
  204. package/dist/server/plugins/mcp/utils/docs-site-url.js +1 -0
  205. package/dist/server/plugins/mcp/utils/mode.d.ts +4 -1
  206. package/dist/server/plugins/mcp/utils/mode.js +1 -1
  207. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +3 -5
  208. package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
  209. package/dist/server/plugins/nav-utils.js +1 -1
  210. package/dist/server/plugins/scorecard-classic/loaders/scorecard.js +1 -1
  211. package/dist/server/plugins/scorecard-classic/template/components.js +1 -1
  212. package/dist/server/plugins/scorecard-classic/template/useData.js +1 -1
  213. package/dist/server/plugins/search/engines/flexsearch/index.js +2 -2
  214. package/dist/server/plugins/sidebars/index.js +2 -2
  215. package/dist/server/plugins/sidebars/utils.js +1 -1
  216. package/dist/server/providers/database/client.d.ts +5 -0
  217. package/dist/server/providers/database/client.js +1 -1
  218. package/dist/server/providers/database/copy-migrations.js +1 -1
  219. package/dist/server/providers/database/database-connections-manager.js +1 -1
  220. package/dist/server/providers/database/has-project-database.d.ts +3 -0
  221. package/dist/server/providers/database/has-project-database.js +1 -0
  222. package/dist/server/store.d.ts +2 -0
  223. package/dist/server/store.js +1 -1
  224. package/dist/server/tools/notifiers/formatter.js +1 -1
  225. package/dist/server/tools/notifiers/helpers/privacy/mask-email.js +1 -1
  226. package/dist/server/tools/notifiers/logger.js +1 -1
  227. package/dist/server/types/plugins/markdown.d.ts +2 -0
  228. package/dist/server/types/web-server.d.ts +1 -0
  229. package/dist/server/utils/codeframes/codeframes.js +2 -2
  230. package/dist/server/utils/entitlements/read-entitlement-number.d.ts +3 -0
  231. package/dist/server/utils/entitlements/read-entitlement-number.js +1 -0
  232. package/dist/server/utils/fs.js +1 -1
  233. package/dist/server/utils/is-api-download-link.d.ts +1 -0
  234. package/dist/server/utils/is-api-download-link.js +1 -1
  235. package/dist/server/utils/rbac.js +1 -1
  236. package/dist/server/utils/redact-url.d.ts +3 -2
  237. package/dist/server/utils/redact-url.js +1 -1
  238. package/dist/server/utils/sandbox-context.d.ts +7 -4
  239. package/dist/server/utils/sandbox-context.js +1 -1
  240. package/dist/server/web-server/auth.d.ts +0 -1
  241. package/dist/server/web-server/auth.js +4 -4
  242. package/dist/server/web-server/dev-server.js +1 -1
  243. package/dist/server/web-server/http.d.ts +2 -1
  244. package/dist/server/web-server/http.js +2 -2
  245. package/dist/server/web-server/jwt/token-types.d.ts +1 -0
  246. package/dist/server/web-server/jwt/token-types.js +1 -1
  247. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  248. package/dist/server/web-server/middleware/dynamic-middleware/hono-compose.js +1 -1
  249. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  250. package/dist/server/web-server/routes/auth.d.ts +1 -1
  251. package/dist/server/web-server/routes/auth.js +1 -1
  252. package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +1756 -1756
  253. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +295 -295
  254. package/dist/server/web-server/routes/cors-proxy.js +2 -2
  255. package/dist/server/web-server/routes/index.js +1 -1
  256. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.d.ts +24 -0
  257. package/dist/server/web-server/routes/mcp-routes/mcp-consent-page.js +35 -0
  258. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.d.ts +8 -0
  259. package/dist/server/web-server/routes/mcp-routes/mcp-fetch-count.js +1 -0
  260. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.d.ts +15 -0
  261. package/dist/server/web-server/routes/mcp-routes/mcp-oauth-store.js +1 -0
  262. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.d.ts +3 -1
  263. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  264. package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
  265. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  266. package/dist/server/web-server/routes/resolve-route.js +1 -1
  267. package/dist/server/workers/worker-pool.js +1 -1
  268. package/dist/types/entitlements.d.ts +2 -0
  269. package/dist/utils/time/debounce.js +1 -1
  270. package/package.json +10 -11
  271. package/dist/client/app/utils/withLoadProgress.d.ts +0 -2
  272. package/dist/client/app/utils/withLoadProgress.js +0 -1
  273. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.js +0 -1
  274. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.js +0 -1
  275. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.js +0 -1
  276. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.js +0 -1
  277. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/rate-limit-telemetry.js +0 -1
  278. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.js +0 -1
  279. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.d.ts +0 -12
  280. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.js +0 -225
  281. /package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{rate-limit-telemetry.d.ts → request-limiter/rate-limit-telemetry.d.ts} +0 -0
  282. /package/dist/server/plugins/mcp/gateway-mcp/rate-limit/{ip-key.d.ts → utils/ip-key.d.ts} +0 -0
@@ -1,105 +1,105 @@
1
- import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as y}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as U}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as v}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as N}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{createApiDocsSearchIndexer as yn}from"./create-indexer.js";function A(t,o){return o==="openapi"&&"openapi"in t}function H(t,o){return o==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:o,store:s,document:n,specType:r,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:c}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...c},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),x=un(m,X,Z),C=d.getConfig(),L=dn(f.fsPath),j=yn(e,s?.schemaStore,n,s?.exampleStore),M=g=>{for(const p of g)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const g of nn)V.set(g.url,g);const R=typeof o.title=="string"?o.title:void 0,_=sn(o.version),D=$n(f.metadata||{},R,_,l),S=[],I=[],q=gn(o,n,r),F=bn(r,o,f.fsPath,C),tn=In(t,C,x),en=q+F+`
2
- `+tn,on=q+F;I.push({title:R||"API Overview",description:typeof o.description=="string"?o.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),S.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,r)?n.security:void 0,E=g=>{for(const p of g){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===y.ITEM){const $=Pn(p,n,r)??Y(p,k,r,_,rn,x);if($){const b=p.label||"";I.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===y.GROUP){const $=On(p,C,r,x);if($){const b=p.label||"";I.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return I},async getSearchDocuments(){return S}}}}function gn(t,o,s){const n=typeof t.title=="string"?t.title:"",r=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
1
+ import T from"node:path";import{REDOCLY_TEAMS_RBAC as C}from"@redocly/config";import{nodeTypes as m,contentType as g,isGraphqlFieldsNode as ln,resolveGraphqlItemFields as fn}from"@redocly/api-docs";import{normalizeApiVersion as an}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as pn,canDownloadApiDefinition as un,extractTeamsFromScopeItems as dn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as H}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as hn}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as mn}from"../../../constants/rbac.js";import{toMarkdown as N}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as $n}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as yn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as gn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as bn}from"../../search/utils.js";import{extractDocumentSearchFacets as In}from"./search-facets.js";import{createApiDocsSearchIndexer as Pn,createLlmDescriptionFormatter as Sn}from"./create-indexer.js";function P(t,r){return r==="openapi"&&"openapi"in t}function K(t,r){return r==="asyncapi"&&"asyncapi"in t}function Xn({items:t,metadata:r,store:l,document:o,specType:n,excludeFromSearch:e,basePath:i,getSearchFacets:c,markdocTags:f}){return async(s,d,p,u)=>{if(e)return;const h={...u.markdocOptions?.tags,...f},{locale:$,translate:nn}=await gn(s.slug,u.getGlobalData?.().l10n),S=$n(h,$,nn),L=u.getConfig(),R=yn(s.fsPath),D=Sn(S),j=Pn(i,D,l?.schemaStore,o,l?.exampleStore,l?.graphqlMeta),V=b=>{for(const a of b)j.addItem(a),a.items?.length&&V(a.items)};V(t);const tn=j.getResult(),F=new Map;for(const b of tn)F.set(b.url,b);const E=typeof r.title=="string"?r.title:void 0,_=an(r.version),k=In(s.metadata||{},E,_,c),A=[],O=[],q=typeof r.description=="string"&&r.description?D(r.description):void 0,G=An(r,q,o,n,D),z=On(n,r,s.fsPath,L),en=xn(t,L,S),on=G+z+`
2
+ `+en,sn=G+z;O.push({title:E||"API Overview",description:q,content:on,slug:i,fsPath:s.fsPath,includeInLLMsTxt:!0}),A.push({title:E||"API Overview",content:sn,url:i,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k});const rn=o&&P(o,n)?o.security:void 0,U=b=>{for(const a of b){if(!a.content||!a.link){a.items?.length&&U(a.items);continue}const cn=F.get(a.link),W=a.content.contentType,B=a[C],J=B?dn(B):void 0,Q=J?.length?J:void 0;if(W===g.ITEM){const y=Ln(a,o,n)??X(a,cn,n,_,rn,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}else if(W===g.GROUP){const y=Rn(a,L,n,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y.llmstxt,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y.aiSearch,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}a.items?.length&&U(a.items)}};return U(t),{async getLLMsTxts(){return O},async getSearchDocuments(){return A}}}}function An(t,r,l,o,n){const e=typeof t.title=="string"?t.title:"",i=typeof t.summary=="string"?t.summary:"",c=typeof t.version=="string"?t.version:"";let f=e?`# ${e}
3
3
 
4
- `:"";if(l+=r?`${r}
4
+ `:"";if(f+=r?`${r}
5
5
 
6
- `:"",l+=i?`${i}
6
+ `:"",f+=i?`${i}
7
7
 
8
- `:"",l+=e?`Version: ${e}
9
- `:"",o){if(A(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
10
- `);const f=c["x-metadata"],a=mn(f);a&&(l+=`
8
+ `:"",f+=c?`Version: ${c}
9
+ `:"",l){if(P(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
10
+ `);const d=s["x-metadata"],p=bn(d);p&&(f+=`
11
11
  Metadata:
12
- ${a}
13
- `)}else if(H(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
14
- `)}}return l+=`
15
- `,l+=An(o,s),l+=Sn(o,s),l}function bn(t,o,s,n){if(!s)return"";let r,i,e;if(t==="openapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(s)||".graphql";r=P.posix.join(an,U(s,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(r,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const c=typeof o.title=="string"&&o.title||e;return`${i}
12
+ ${p}
13
+ `)}else if(K(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
14
+ `)}}return f+=`
15
+ `,f+=Tn(l,o,n),f+=Cn(l,o,n),f}function On(t,r,l,o){if(!l)return"";let n,e,i;if(t==="openapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download OpenAPI description",i="OpenAPI definition";else if(t==="asyncapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download AsyncAPI description",i="AsyncAPI definition";else if(t==="graphql"){const s=T.posix.extname(l)||".graphql";n=T.posix.join(hn,v(l,s)),e="## Download GraphQL schema",i="GraphQL schema"}else return"";if(!un(n,o.access?.rbac??{},o.access?.requiresLogin??!1,mn))return"";const f=typeof r.title=="string"&&r.title||i;return`${e}
16
16
 
17
- - ${N({title:c,description:void 0,slug:r,siteUrl:n.seo?.siteUrl})}`}function An(t,o){if(!t)return"";if(A(t,o)){const{servers:s}=t;if(!s?.length)return"";let n=`## Servers
17
+ - ${w({title:f,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function Tn(t,r,l){if(!t)return"";if(P(t,r)){const{servers:o}=t;if(!o?.length)return"";let n=`## Servers
18
18
 
19
- `;for(const r of s)if(r.description&&(n+=`${r.description}
19
+ `;for(const e of o)if(e.description&&(n+=`${l(e.description)}
20
20
  `),n+=`\`\`\`
21
- ${r.url}
21
+ ${e.url}
22
22
  \`\`\`
23
23
 
24
- `,r.variables){n+=`Variables:
25
- `;for(const[i,e]of Object.entries(r.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
26
- `,e.default&&(n+=` Default: ${JSON.stringify(e.default)}
27
- `),e.enum&&(n+=` Enum: ${e.enum.map(l=>JSON.stringify(l)).join(", ")}
24
+ `,e.variables){n+=`Variables:
25
+ `;for(const[i,c]of Object.entries(e.variables))n+=`- \`${i}\`${c.description?`: ${l(c.description).replace(/\s+/g," ")}`:""}
26
+ `,c.default&&(n+=` Default: ${JSON.stringify(c.default)}
27
+ `),c.enum&&(n+=` Enum: ${c.enum.map(f=>JSON.stringify(f)).join(", ")}
28
28
  `);n+=`
29
- `}return n}if(H(t,o)){const{servers:s}=t;if(!s||!Object.keys(s).length)return"";let n=`## Servers
29
+ `}return n}if(K(t,r)){const{servers:o}=t;if(!o||!Object.keys(o).length)return"";let n=`## Servers
30
30
 
31
- `;for(const[r,i]of Object.entries(s))n+=`### ${r}
31
+ `;for(const[e,i]of Object.entries(o))n+=`### ${e}
32
32
 
33
- `,i.description&&(n+=`${i.description}
33
+ `,i.description&&(n+=`${l(i.description)}
34
34
  `),i.host&&(n+=`Host: ${i.host}
35
35
  `),i.protocol&&(n+=`Protocol: ${i.protocol}
36
36
  `),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
37
37
  `),i.pathname&&(n+=`Pathname: ${i.pathname}
38
38
  `),n+=`
39
- `;return n}return""}function Sn(t,o){if(!t||!A(t,o))return"";const s=t.components?.securitySchemes;if(!s)return"";let n=`## Security
40
-
41
- `;for(const[r,i]of Object.entries(s)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${r}
42
-
43
- `,e.description&&(n+=`${e.description}
44
-
45
- `),e.type&&(n+=`Type: ${e.type}
46
- `),e.in&&(n+=`In: ${e.in}
47
- `),e.name&&(n+=`Name: ${e.name}
48
- `),e.scheme&&(n+=`Scheme: ${e.scheme}
49
- `),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
50
- `),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
51
- `);const l=e.flows,c=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(c&&("authorizationUrl"in c&&c.authorizationUrl&&(n+=`Authorization URL: ${c.authorizationUrl}
52
- `),"tokenUrl"in c&&c.tokenUrl&&(n+=`Token URL: ${c.tokenUrl}
53
- `),c.scopes)){n+=`Scopes:
54
- `;for(const[f,a]of Object.entries(c.scopes))n+=`- \`${f}\`: ${a}
39
+ `;return n}return""}function Cn(t,r,l){if(!t||!P(t,r))return"";const o=t.components?.securitySchemes;if(!o)return"";let n=`## Security
40
+
41
+ `;for(const[e,i]of Object.entries(o)){if(!i||"$ref"in i)continue;const c=i;n+=`### ${e}
42
+
43
+ `,c.description&&(n+=`${l(c.description)}
44
+
45
+ `),c.type&&(n+=`Type: ${c.type}
46
+ `),c.in&&(n+=`In: ${c.in}
47
+ `),c.name&&(n+=`Name: ${c.name}
48
+ `),c.scheme&&(n+=`Scheme: ${c.scheme}
49
+ `),c.bearerFormat&&(n+=`Bearer Format: ${c.bearerFormat}
50
+ `),c.openIdConnectUrl&&(n+=`OpenID Connect URL: ${c.openIdConnectUrl}
51
+ `);const f=c.flows,s=f?.implicit||f?.password||f?.clientCredentials||f?.authorizationCode;if(s&&("authorizationUrl"in s&&s.authorizationUrl&&(n+=`Authorization URL: ${s.authorizationUrl}
52
+ `),"tokenUrl"in s&&s.tokenUrl&&(n+=`Token URL: ${s.tokenUrl}
53
+ `),s.scopes)){n+=`Scopes:
54
+ `;for(const[d,p]of Object.entries(s.scopes))n+=`- \`${d}\`: ${p}
55
55
  `}n+=`
56
- `}return n}function In(t,o,s){let n="";const r=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===y.GROUP)n+=`${e} ${l.label||""}
56
+ `}return n}function xn(t,r,l){let o="";const n=(e,i)=>{for(const c of e)if(c.link){if(c.content?.contentType===g.GROUP)o+=`${i} ${c.label||""}
57
57
 
58
- `,l.items?.length&&r(l.items,e+"#");else if(l.content?.contentType===y.ITEM){if(!w(l,o))continue;const c=l,f=c.httpVerb,a=c.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,s):void 0;n+=` - ${N({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link),siteUrl:o.seo?.siteUrl})}`}}};return r(t,"##"),n}function Y(t,o,s,n,r,i){if(!t.content)return;const e=t,l=t.label||"",c=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
58
+ `,c.items?.length&&n(c.items,i+"#");else if(c.content?.contentType===g.ITEM){if(!M(c,r))continue;const f=c,s=f.httpVerb,d=f.httpPath,p=s&&d?`${s.toUpperCase()} ${d}`:c.label||"",u=c.content?x(c.content.children,l):void 0;o+=` - ${w({title:p,description:u?u.slice(0,200):void 0,slug:H(c.link),siteUrl:r.seo?.siteUrl})}`}}};return n(t,"##"),o}function X(t,r,l,o,n,e,i){if(!t.content)return;const c=t,f=t.label||"",s=x(t.content.children,e),d=t.content.meta?.deprecated;let p=`# ${f}${d?" (deprecated)":""}
59
59
 
60
- `;if(c&&(a+=`${c}
60
+ `;if(s&&(p+=`${s}
61
61
 
62
- `),s==="openapi"||s==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
63
- `:u&&(a+=`Method: ${u.toUpperCase()}
64
- `),n&&(a+=`Version: ${n}
65
- `);const m=Tn(t.content.children,r);m&&(a+=`Security: ${m}
66
- `)}return o?.parameters?.length&&s!=="graphql"&&(a+=`
67
- `+xn(o.parameters)+`
68
- `),s==="graphql"&&(a+=Cn(t.content.children)),a}function Pn(t,o,s){if(t.httpVerb!=="tool"||!o||!A(o,s))return;const n=t.content?.meta?.name,r=n?o["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!r)return;let i=`# ${t.label||r.name}
62
+ `),l==="openapi"||l==="asyncapi"){const u=c.httpVerb,h=c.httpPath;u&&h?p+=`Endpoint: ${u.toUpperCase()} ${h}
63
+ `:u&&(p+=`Method: ${u.toUpperCase()}
64
+ `),o&&(p+=`Version: ${o}
65
+ `);const $=Dn(t.content.children,n);$&&(p+=`Security: ${$}
66
+ `)}return r?.parameters?.length&&l!=="graphql"&&(p+=`
67
+ `+En(r.parameters)+`
68
+ `),l==="graphql"&&(p+=kn(t.content.children,i)),p}function Ln(t,r,l){if(t.httpVerb!=="tool"||!r||!P(r,l))return;const o=t.content?.meta?.name,n=o?r["x-mcp"]?.tools?.find(i=>i.name===o):void 0;if(!n)return;let e=`# ${t.label||n.name}
69
69
 
70
- `;return typeof r.description=="string"&&r.description&&(i+=`${r.description}
70
+ `;return typeof n.description=="string"&&n.description&&(e+=`${n.description}
71
71
 
72
- `),i+=`## Input schema:
72
+ `),e+=`## Input schema:
73
73
 
74
- `,i+=`\`\`\`json
75
- ${JSON.stringify(r.inputSchema,null,2)}
74
+ `,e+=`\`\`\`json
75
+ ${JSON.stringify(n.inputSchema,null,2)}
76
76
  \`\`\`
77
77
 
78
- `,r.outputSchema&&(i+=`## Output schema:
78
+ `,n.outputSchema&&(e+=`## Output schema:
79
79
 
80
- `,i+=`\`\`\`json
81
- ${JSON.stringify(r.outputSchema,null,2)}
80
+ `,e+=`\`\`\`json
81
+ ${JSON.stringify(n.outputSchema,null,2)}
82
82
  \`\`\`
83
83
 
84
- `),i}function On(t,o,s,n){if(!t.content)return;const r=t.label||"",i=T(t.content.children,n);let e=`# ${r}
84
+ `),e}function Rn(t,r,l,o,n){if(!t.content)return;const e=t.label||"",i=x(t.content.children,o);let c=`# ${e}
85
85
 
86
- `;if(i&&(e+=`${i}
86
+ `;if(i&&(c+=`${i}
87
87
 
88
- `),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!w(u,o)))if(u.content.contentType===y.ITEM){const d=Y(u,void 0,s,void 0,void 0,n);d&&(c+=`${d}
88
+ `),l==="graphql"){let s="";const d=p=>{for(const u of p??[])if(!(!u.content||!M(u,r)))if(u.content.contentType===g.ITEM){const h=X(u,void 0,l,void 0,void 0,o,n);h&&(s+=`${h}
89
89
 
90
90
  ---
91
91
 
92
- `)}else u.content.contentType===y.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+c,aiSearch:e}}let l="";if(t.items?.length)for(const c of t.items){if(!c.link||!c.content||c.content.contentType!==y.ITEM||!w(c,o))continue;const f=c,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:c.label||"",m=c.content?T(c.content.children,n):void 0;l+=` - ${N({title:d,description:m?m.slice(0,200):void 0,slug:J(c.link),siteUrl:o.seo?.siteUrl})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,o){const s=[],n=r=>{for(const i of r)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const c of l.schemes)c[O]||c.name&&!s.includes(c.name)&&s.push(c.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),s.length)return s.join(", ");if(o?.length){const r=o.flatMap(i=>Object.keys(i));if(r.length)return[...new Set(r)].join(", ")}}function xn(t){const o={};for(const n of t){const r=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;o[r]||(o[r]=[]),o[r].push(n)}return Object.entries(o).map(([n,r])=>{const i=r.map(e=>{const l=[...e.path||[],e.name],c=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
93
- `;return c&&(f+=` ${c.trim()}
94
- `),e.enum?f+=` Enum: ${e.enum.map(a=>JSON.stringify(a)).join(", ")}
95
- `:e.example&&(f+=` Example: ${e.example}
96
- `),f});return`## ${K(n)}:
92
+ `)}else u.content.contentType===g.GROUP&&d(u.items)};return d(t.items),{llmstxt:c+s,aiSearch:c}}let f="";if(t.items?.length)for(const s of t.items){if(!s.link||!s.content||s.content.contentType!==g.ITEM||!M(s,r))continue;const d=s,p=d.httpVerb,u=d.httpPath,h=p&&u?`${p.toUpperCase()} ${u}`:s.label||"",$=s.content?x(s.content.children,o):void 0;f+=` - ${w({title:h,description:$?$.slice(0,200):void 0,slug:H(s.link),siteUrl:r.seo?.siteUrl})}`}return{llmstxt:c+f,aiSearch:c}}function Dn(t,r){const l=[],o=n=>{for(const e of n)if(e.nodeType===m.SECURITY){const i=e;for(const c of i.requirements)for(const f of c.schemes)f[C]||f.name&&!l.includes(f.name)&&l.push(f.name)}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};if(o(t),l.length)return l.join(", ");if(r?.length){const n=r.flatMap(e=>Object.keys(e));if(n.length)return[...new Set(n)].join(", ")}}function En(t){const r={};for(const o of t){const n=`${o.place}${o.mediaType?` (${o.mediaType})`:""}`;r[n]||(r[n]=[]),r[n].push(o)}return Object.entries(r).map(([o,n])=>{const e=n.map(i=>{const c=[...i.path||[],i.name],f=Array.isArray(i.description)?i.description.join(" "):i.description;let s=` - \`${c.join(".")}\` (${i.type}${i.required?", required":""})
93
+ `;return f&&(s+=` ${f.trim()}
94
+ `),i.enum?s+=` Enum: ${i.enum.map(d=>JSON.stringify(d)).join(", ")}
95
+ `:i.example&&(s+=` Example: ${i.example}
96
+ `),s});return`## ${Z(o)}:
97
97
 
98
- ${i.join(`
98
+ ${e.join(`
99
99
  `)}`}).join(`
100
- `)}function Cn(t){let o="";const s=n=>{for(const r of n)if(r.nodeType===h.ITEM){const i=r;i.graphqlSchema&&(o+=Ln(i.graphqlSchema,i.variant))}else(r.nodeType===h.CONTAINER||r.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&s(r.children)};return s(t),o}function Ln(t,o){let n=`
101
- ## ${K(o==="return-type"?"Return type":o==="graphql-args"||o==="arguments"?"Arguments":o==="graphql-fields"?"Fields":o)}:
100
+ `)}function kn(t,r){let l="";const o=n=>{for(const e of n)if(e.nodeType===m.ITEM){const i=ln(e)?fn(e,r??{}):void 0;i&&(l+=Un(i,e.variant))}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};return o(t),l}function Un(t,r){let o=`
101
+ ## ${Z(r==="return-type"?"Return type":r==="graphql-args"||r==="arguments"?"Arguments":r==="graphql-fields"?"Fields":r)}:
102
102
 
103
- `;const r=i=>{const e=i.description?v(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
104
- `};if(!Array.isArray(t)){const i=t.description?v(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
105
- `;for(const e of t.fields??[])n+=r(e);return n}if(!t.length)return"";for(const i of t)n+=r(i);return n}function T(t,o){const s=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,c=Array.isArray(l)?l:[l],f=v(c,{renderTag:o}).trim();f&&s.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),s.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,o){return o.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},o)}export{Qn as getAiDocumentsStore};
103
+ `;const n=e=>{const i=e.description?N(Array.isArray(e.description)?e.description:[e.description]).trim():"";return` - \`${e.name}\` (${e.type.display})${i?`: ${i}`:""}
104
+ `};if(t.type){const e=t.type.description?N(Array.isArray(t.type.description)?t.type.description:[t.type.description]).trim():"";o+=` Type: ${t.type.display}`,e&&(o+=` - ${e}`),o+=`
105
+ `}else if(!t.fields.length)return"";for(const e of t.fields)o+=n(e);return o}function x(t,r){const l=[],o=e=>{for(const i of e)if(i.nodeType===m.MARKDOC){const c=i.content,f=Array.isArray(c)?c:[c],s=N(f,{renderTag:r}).trim();s&&l.push(s)}else(i.nodeType===m.CONTAINER||i.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(i.children)};return o(t),l.join(" ").trim()||void 0}function Z(t){return t.charAt(0).toUpperCase()+t.slice(1)}function M(t,r){return r.access?.requiresLogin?!0:pn({slug:t.link||"",[C]:t[C]},r)}export{Xn as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function O(u,i,c,S,R,a,g){return async e=>{if(R)return[];const m=e.baseSlug||e.slug,l=new D(m,a?.schemaStore,g,{exampleStore:a?.exampleStore}),f=t=>{for(const r of t)l.addItem(r),r.items?.length&&f(r.items)};f(u);const s=typeof i.title=="string"?i.title:void 0,n=d(i.version),p=x(e.metadata||{},s,n,c);return A(p,c,S),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:n?`${s} (${n})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:p}))}}export{O as searchResolver};
1
+ import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function M(g,i,c,u,S,n,R){return async e=>{if(S)return[];const m=e.baseSlug||e.slug,l=new D(m,n?.schemaStore,R,{exampleStore:n?.exampleStore,graphqlMeta:n?.graphqlMeta}),p=t=>{for(const a of t)l.addItem(a),a.items?.length&&p(a.items)};p(g);const s=typeof i.title=="string"?i.title:void 0,r=d(i.version),f=x(e.metadata||{},s,r,c);return A(f,c,u),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:r?`${s} (${r})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:f}))}}export{M as searchResolver};
@@ -1 +1 @@
1
- import e from"node:path";import{existsSync as c}from"node:fs";import{readFile as F}from"node:fs/promises";import C from"js-yaml";import{withoutPathPrefix as U}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as I,PUBLIC_API_DEFINITIONS_FOLDER as p}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as y}from"../../../constants/common.js";import{canDownloadApiDefinition as O,filterDataByAccessDeep as q}from"../../utils/rbac.js";function A(a,t){const n=e.parse(a);return e.join(n.dir,n.name+t)}const T=async(a,t,n)=>{const{isAuthenticated:i,teams:l,claims:{email:f}}=t.user,S=new URL(a.url),o=U(S.pathname),m=o.startsWith(y),s=decodeURIComponent(m?o.replace(y,""):o.replace(p,"").replace(I,"")),{rbac:u={},requiresLogin:d=!1}=t.config.access||{};if(!O(o,u,d,{isAuthenticated:i,email:f,teams:l}))return new Response("Unauthorized",{status:i?403:401});const r=n.props?.outdir||"";if(m){const E=e.join(r,p,s);if(!c(E))return new Response("Not found",{status:404});const x=await F(E,"utf-8");return new Response(x,{headers:{"Content-Type":"application/graphql"}})}const h=e.join(r,p,A(s,".json")),P=e.join(r,I,A(s,".json")),R=c(h),_=c(P);if(!R&&!_)return new Response("Not found",{status:404});const L=await F(R?h:P,"utf-8"),N=JSON.parse(L),w=q(N,{isAuthenticated:i,email:f,teams:l},u,d),D=e.extname(s),j=D===".yaml"?C.dump(w):JSON.stringify(w,null,2);return new Response(j,{headers:{"Content-Type":D===".yaml"?"application/yaml":"application/json"}})};var k=T;export{k as default};
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 +1 @@
1
- const u=[({label:n,labelTranslationKey:o})=>n?{label:n,labelTranslationKey:o}:void 0,({icon:n,srcSet:o})=>{const t=typeof n=="string"?n:void 0;return t||o?{icon:t,srcSet:o}:void 0},({badges:n})=>n?{badges:n}:void 0];function c(n,o,t){if(!t)return n;const r=d(t);return n.map(e=>i(e,o)?{...e,...r}:e)}function d(n){return u.reduce((o,t)=>({...o,...t(n)}),{})}function i(n,o){return n.link===o}export{c as applyNavItemToRoot};
1
+ const u=[({label:n,labelTranslationKey:o})=>n?{label:n,labelTranslationKey:o}:void 0,({icon:n,srcSet:o})=>{const t=typeof n=="string"?n:void 0;return t||o?{icon:t,srcSet:o}:void 0},({badges:n})=>n?{badges:n}:void 0];function c(n,o,t){if(!t)return n;const r=f(t);return n.map(e=>i(e,o)?{...e,...r}:e)}function f(n){const o={};for(const t of u)Object.assign(o,t(n));return o}function i(n,o){return n.link===o}export{c as applyNavItemToRoot};
@@ -1,5 +1,16 @@
1
1
  import type { RawUniversalConfig } from '@redocly/openapi-core';
2
+ import type { MarkdocChunk } from '../loader.js';
2
3
  export declare function isPlainNonMarkdownText(markdown: string): boolean;
4
+ /**
5
+ * False once `node[key]` holds a string other than the chunk's markdown: the value was replaced
6
+ * after bundling (e.g. by an AsyncAPI 2.x trait), so writing the chunk back would restore it.
7
+ */
8
+ export declare function isChunkCurrent(node: Record<string, unknown>, key: string, markdown: string): boolean;
9
+ /**
10
+ * Chunks for `description` strings that were copied onto other objects after bundling (AsyncAPI
11
+ * traits), each taking the parse source of the chunk whose markdown it copies.
12
+ */
13
+ export declare function collectCopiedDescriptionChunks(document: unknown, chunks: MarkdocChunk[]): MarkdocChunk[];
3
14
  export declare const MarkdownParserDecorator: ({ outputRelativePath, cwd, }: {
4
15
  outputRelativePath: string;
5
16
  cwd: string;
@@ -1 +1 @@
1
- import b from"node:path";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{slash as k}from"../../../../utils/path/slash.js";function f(t,r,a){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",a.location.absolutePointer+"/description",a);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,a.location.absolutePointer+"/x-enumDescriptions/"+o,a)}}const x=/^[a-zA-Z0-9\s\-,.!?:;'"()/]+$/,d=/^[^\S\r\n\u2028\u2029]*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return x.test(t)&&!d.test(t)}const s=({outputRelativePath:t,cwd:r})=>{const a=function(e,u,l,m){const{node:n}=m.resolve(e[u]);if(!n||typeof n!="string"||g(n))return;const i=m.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:t,key:u})};return{any:{leave(o,e){f(o,a,e)}},ref:{leave(o,e){f(o,a,e)}}}},c=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,a){if((a.type.name==="Operation"||a.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,a){const o={id:"markdown",decorators:{oas2:{markdown:s,rbac:c},oas3:{markdown:s,rbac:c},async3:{markdown:s,rbac:c}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:a},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{s as MarkdownParserDecorator,c as RbacDecorator,D as injectDecoratorIntoConfig,g as isPlainNonMarkdownText};
1
+ import k from"node:path";import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{slash as w}from"../../../../utils/path/slash.js";function d(t,r,n){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",n.location.absolutePointer+"/description",n);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,n.location.absolutePointer+"/x-enumDescriptions/"+o,n)}}const b=/^[a-zA-Z0-9\s\-,.!?:;'"()/]+$/,l=/^[^\S\r\n\u2028\u2029]*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return b.test(t)&&!l.test(t)}function C(t,r,n){const o=t[r];return!!o&&(typeof o!="string"||o===n)}function M(t,r){const n=new Map,o=new Map;for(const e of r)e.key==="description"&&(n.has(e.markdown)||n.set(e.markdown,e),o.set(e.node,e.markdown));const a=[],c=new Set,f=e=>{if(typeof e!="object"||e===null||c.has(e))return;c.add(e);const{description:s}=e;if(typeof s=="string"&&o.get(e)!==s){const i=n.get(s);i&&a.push({...i,node:e})}for(const i of Object.values(e))f(i)};return f(t),a}const p=({outputRelativePath:t,cwd:r})=>{const n=function(a,c,f,e){const{node:s}=e.resolve(a[c]);if(!s||typeof s!="string"||g(s))return;const i=e.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:a,pointer:w(k.relative(r,f)),markdown:s,relativePath:t,key:c})};return{any:{leave(o,a){d(o,n,a)}},ref:{leave(o,a){d(o,n,a)}}}},u=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,n){if((n.type.name==="Operation"||n.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,n){const o={id:"markdown",decorators:{oas2:{markdown:p,rbac:u},oas3:{markdown:p,rbac:u},async2:{markdown:p,rbac:u},async3:{markdown:p,rbac:u}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:n},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{p as MarkdownParserDecorator,u as RbacDecorator,M as collectCopiedDescriptionChunks,D as injectDecoratorIntoConfig,C as isChunkCurrent,g as isPlainNonMarkdownText};
@@ -1,5 +1,5 @@
1
- import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],r=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;r&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,r);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],e=B(z);let b=[e.errors&&`${e.errors} ${$(e.errors,"error","errors")}`,e.warnings&&`${e.warnings} ${$(e.warnings,"warning","warnings")}`,e.ignored&&`${e.ignored} ignored`].filter(Boolean).join(", ");if(e.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
1
+ import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],e=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;e&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,e);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],r=B(z),b=[r.errors&&`${r.errors} ${$(r.errors,"error","errors")}`,r.warnings&&`${r.warnings} ${$(r.warnings,"warning","warnings")}`,r.ignored&&`${r.ignored} ignored`].filter(Boolean).join(", ");if(r.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
2
2
 
3
3
  ${C?.message} at ${C?.location?.[0]?.pointer}
4
4
 
5
- `)}e.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:r?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:r?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let r;try{r=await u.load(i.relativePath,"arazzo-doc")}catch{continue}r.data?.length&&f.push(...r.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:r.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
5
+ `)}r.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:e?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:e?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let e;try{e=await u.load(i.relativePath,"arazzo-doc")}catch{continue}e.data?.length&&f.push(...e.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:e.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{removeLeadingSlash as T}from"@redocly/theme/core/utils";import{toKebabCase as y}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as x}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as R}from"../../../../../utils/rbac.js";import{removeMarkdocTags as w}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as b}from"./base.js";import{OpenapiSchemaResolver as S}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as A}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as v}from"../../../utils/is-valid-tag-name.js";const N=["get","post","put","delete","patch"],d=15,O=15;class V extends b{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const s=T(e.realRelativePath),r=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:r,summary:w(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&v(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:s},version:o}}async processApiDescription(e,o,s,r){if(S.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),r.delete(`${a.key}:${s}`),await this.#r(e,a.key,a.version,s,o,r,t);const n=this.#s(e.document.paths);if(n.length!==0){const i=(await x(n,d,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#n(m,h,f,e,a.key,a.version,o,t);r.delete(`${l}:${s}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${n.length} operations for ${a.key}`)}}#s(e){return Object.entries(e??{}).flatMap(([o,s])=>N.filter(r=>s[r]).map(r=>{const t=s[r];if(!t)throw new Error(`Operation not found for method ${r} on path ${o}`);return{operation:t,path:o,method:r.toUpperCase()}}))}async#r(e,o,s,r,t,a,n){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await E(i,O,async([m,h])=>{const f=`${o}-${y(m)}`,l=await this.#o({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:s,parentRevision:t,rbacTeams:n});a.delete(`${f}:${r}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:s,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:s,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#o({schemaName:e,schema:o,description:s,parentKey:r,parentVersion:t,parentRevision:a,rbacTeams:n}){const c=S.resolveSchemaRefs(o,s.document),i=JSON.stringify(c),m=c[$]?R(c[$]):n,h=R(c["x-rbac"]),f={type:"data-schema",key:`${r}-${y(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:s.realRelativePath,fileHash:s.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#n(e,o,s,r,t,a,n,c){const i=`${t}-${y(`${e.operationId}`)}`,m=await Promise.all([this.#m(e.requestBody??null,r),this.#h(e.responses??{},r)]),h=m[0].schemaNames,f=m[1].schemaNames;m[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m[0].errors.join(", ")}`),m[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${m[1].errors.join(", ")}`);const l=h.map(p=>`${t}-${y(p)}`),u=f.map(p=>`${t}-${y(p)}`),g=await this.#f({path:o,method:s,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:u,description:r,parentKey:t,parentVersion:a,parentRevision:n,rbacTeams:c});return g&&await Promise.all([this.#c(h,e.operationId??"",r.realRelativePath,r.hash,t,a,n),this.#i(f,e.operationId??"",r.realRelativePath,r.hash,t,a,n),this.#p({apiOperationKey:g.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:r,parentVersion:a,parentRevision:n})]),i}async#c(e,o,s,r,t,a,n){return e.length===0||!o?[]:await this.#a(e,o,s,r,t,a,n)}async#i(e,o,s,r,t,a,n){return e.length===0||!o?[]:await this.#a(e,o,s,r,t,a,n)}#m(e,o){const s=[],r=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){if(!t.schema?.$ref)continue;const a=this.#t(t.schema.$ref);a?.componentType==="schemas"&&a.componentName&&s.push(a.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const n of Object.values(a.content??{})){if(!n.schema?.$ref)continue;const c=this.#t(n.schema.$ref);c?.componentType==="schemas"&&c.componentName&&s.push(c.componentName)}}}}catch(t){r.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:r}}#h(e,o){const s=[],r=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){if(!a.schema?.$ref)continue;const n=this.#t(a.schema.$ref);n?.componentType==="schemas"&&n.componentName&&s.push(n.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const n=o.document.components?.responses?.[a.componentName];if(n&&"content"in n)for(const c of Object.values(n.content??{})){if(!c.schema?.$ref)continue;const i=this.#t(c.schema.$ref);i?.componentType==="schemas"&&i.componentName&&s.push(i.componentName)}}}}}catch(t){r.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:r}}#t(e){try{return A(e)}catch{return{componentType:"",componentName:null}}}async#a(e,o,s,r,t,a,n){return e.length===0?[]:await E(e,O,async c=>await this.#l({operationId:o,schemaName:c,descriptionSourceFile:s,descriptionHash:r,parentKey:t,parentVersion:a,parentRevision:n}))}async#l({operationId:e,schemaName:o,descriptionSourceFile:s,descriptionHash:r,parentKey:t,parentVersion:a,parentRevision:n}){const c=`${t}-${y(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${y(e)}`,type:"uses",targetKey:c,sourceFile:s,fileHash:r,sourceVersion:a,targetVersion:a,sourceRevision:n,targetRevision:n}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#f({path:e,method:o,operation:s,requestBodySchemasKeys:r,responseSchemasKeys:t,description:a,parentKey:n,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${s.operationId}`,f=`${n}-${y(h)}`,l=s[$]?R(s[$]):m,u=R(s["x-rbac"]),g={type:"api-operation",key:f,title:h,summary:w(s.summary),tags:s.tags?.filter(p=>v(p)),metadata:{path:e,method:o,payload:r,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(p){return this.#e.error(`Failed to create API operation entity for ${h}: ${p instanceof Error?p.message:"Unknown error"}`),null}}async#p({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:s,description:r,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:s,sourceFile:r.realRelativePath,fileHash:r.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#y(e,r,o,t,a)}catch(n){this.#e.error(`Failed to create API operation relations for ${e}: ${n instanceof Error?n.message:"Unknown error"}`)}}async#y(e,o,s,r,t){s?.length&&await E(s,d,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:r,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(n){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${n instanceof Error?n.message:"Unknown error"}`)}})}}export{V as OpenApiEntitiesExtractor};
1
+ import{REDOCLY_TEAMS_RBAC as R}from"@redocly/config";import{removeLeadingSlash as O}from"@redocly/theme/core/utils";import{toKebabCase as y}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as x}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as $}from"../../../../../utils/rbac.js";import{removeMarkdocTags as S}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as b}from"./base.js";import{OpenapiSchemaResolver as w}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as N}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as d}from"../../../utils/is-valid-tag-name.js";const A=["get","post","put","delete","patch"],T=15,v=15;class V extends b{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const n=O(e.realRelativePath),s=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:s,summary:S(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&d(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:n},version:o}}async processApiDescription(e,o,n,s){if(w.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,n);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),s.delete(`${a.key}:${n}`),await this.#o(e,a.key,a.version,n,o,s,t);const r=this.#n(e.document.paths);if(r.length!==0){const i=(await x(r,T,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#c(m,h,f,e,a.key,a.version,o,t);s.delete(`${l}:${n}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${r.length} operations for ${a.key}`)}}#n(e){return Object.entries(e??{}).flatMap(([o,n])=>A.filter(s=>n[s]).map(s=>{const t=n[s];if(!t)throw new Error(`Operation not found for method ${s} on path ${o}`);return{operation:t,path:o,method:s.toUpperCase()}}))}async#o(e,o,n,s,t,a,r){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await E(i,v,async([m,h])=>{const f=`${o}-${y(m)}`,l=await this.#r({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:n,parentRevision:t,rbacTeams:r});a.delete(`${f}:${s}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:n,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:n,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#r({schemaName:e,schema:o,description:n,parentKey:s,parentVersion:t,parentRevision:a,rbacTeams:r}){const c=w.resolveSchemaRefs(o,n.document),i=JSON.stringify(c),m=c[R]?$(c[R]):r,h=$(c["x-rbac"]),f={type:"data-schema",key:`${s}-${y(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:n.realRelativePath,fileHash:n.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#c(e,o,n,s,t,a,r,c){const i=`${t}-${y(`${e.operationId}`)}`,m=await Promise.all([this.#h(e.requestBody??null,s),this.#l(e.responses??{},s)]),h=m[0].schemaNames,f=m[1].schemaNames;m[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m[0].errors.join(", ")}`),m[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${m[1].errors.join(", ")}`);const l=h.map(p=>`${t}-${y(p)}`),u=f.map(p=>`${t}-${y(p)}`),g=await this.#p({path:o,method:n,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:u,description:s,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:c});return g&&await Promise.all([this.#i(h,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#m(f,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#y({apiOperationKey:g.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:s,parentVersion:a,parentRevision:r})]),i}async#i(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}async#m(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}#h(e,o){const n=[],s=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){const a=this.#a(t,o);if(!a)continue;const r=this.#t(a);r?.componentType==="schemas"&&r.componentName&&n.push(r.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){const c=this.#a(r,o);if(!c)continue;const i=this.#t(c);i?.componentType==="schemas"&&i.componentName&&n.push(i.componentName)}}}}catch(t){s.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#l(e,o){const n=[],s=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){const r=this.#a(a,o);if(!r)continue;const c=this.#t(r);c?.componentType==="schemas"&&c.componentName&&n.push(c.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.document.components?.responses?.[a.componentName];if(r&&"content"in r)for(const c of Object.values(r.content??{})){const i=this.#a(c,o);if(!i)continue;const m=this.#t(i);m?.componentType==="schemas"&&m.componentName&&n.push(m.componentName)}}}}}catch(t){s.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#a(e,o){const n=new Set;let s=e;for(;s&&"$ref"in s;){const t=this.#t(s.$ref),a=t?.componentName;if(t?.componentType!=="mediaTypes"||!a||n.has(a))return;n.add(a),s=o.document.components?.mediaTypes?.[a]}return s?.schema?.$ref}#t(e){try{return N(e)}catch{return{componentType:"",componentName:null}}}async#s(e,o,n,s,t,a,r){return e.length===0?[]:await E(e,v,async c=>await this.#f({operationId:o,schemaName:c,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}))}async#f({operationId:e,schemaName:o,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}){const c=`${t}-${y(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${y(e)}`,type:"uses",targetKey:c,sourceFile:n,fileHash:s,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:n,requestBodySchemasKeys:s,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${n.operationId}`,f=`${r}-${y(h)}`,l=n[R]?$(n[R]):m,u=$(n["x-rbac"]),g={type:"api-operation",key:f,title:h,summary:S(n.summary),tags:n.tags?.filter(p=>d(p)),metadata:{path:e,method:o,payload:s,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(p){return this.#e.error(`Failed to create API operation entity for ${h}: ${p instanceof Error?p.message:"Unknown error"}`),null}}async#y({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:n,description:s,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:n,sourceFile:s.realRelativePath,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#u(e,s,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#u(e,o,n,s,t){n?.length&&await E(n,T,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:s,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(r){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${r instanceof Error?r.message:"Unknown error"}`)}})}}export{V as OpenApiEntitiesExtractor};
@@ -1 +1 @@
1
- function s(a){const n=/^#\/channels\/(?<channelName>.+)\/messages\/(?<messageName>.+)$/,e=a.match(n);return!e||!e.groups?null:{channelName:e?.groups?.channelName??null,messageName:e?.groups?.messageName??null}}export{s as extractPartsFromChannelsMessageRef};
1
+ import{unescapePointerFragment as a}from"@redocly/openapi-core";function m(n){const s=/^#\/channels\/(?<channelName>.+)\/messages\/(?<messageName>.+)$/,e=n.match(s);return!e||!e.groups?null:{channelName:a(e.groups.channelName),messageName:a(e.groups.messageName)}}export{m as extractPartsFromChannelsMessageRef};
@@ -1 +1 @@
1
- import{readFileSync as g}from"fs";import{join as j}from"path";import{isLocalLink as p}from"../../../utils/path/is-local-link.js";import{copyStaticFile as x}from"../../utils/fs.js";async function T(n,t){return m(n,"src",(e,o)=>`<script ${e}>${o}</script>`,t)}async function b(n,t){return m(n,"href",e=>`<link ${e} />`,{...t,defaultAttrs:{rel:"stylesheet"}})}async function m(n=[],t,e,{contentDir:o,outdir:y,defaultAttrs:h={},consentEnabled:d=!1}){if(!Array.isArray(n)||!n.length)return"";const c=[];for(const i of n){const C=typeof i=="string"?{[t]:i}:{...i},{src:$,href:k,inline:a,consent:l,...s}=C;l&&d&&t==="src"&&(s["data-consent"]=l,s.type&&(s["data-consent-type"]=s.type),s.type="text/plain");let r=t==="href"?k:$,u="";if(p(r)&&!a){const f=await x(o,r,y);if(!f)continue;r=f}else p(r)&&a&&(u=g(j(o,r),"utf-8"),r=!1);const S=F({...h,...s,[t]:r});c.push(e(S,u))}return c.join("")}function F(n){const t=[];for(let e in n){const o=n[e];o!==!1&&(o===!0?t.push(e):t.push(`${e}="${o}"`))}return t.join(" ")}export{b as formatCustomLinks,T as formatCustomScripts};
1
+ import{readFileSync as g}from"fs";import{join as j}from"path";import{isLocalLink as p}from"../../../utils/path/is-local-link.js";import{copyStaticFile as x}from"../../utils/fs.js";async function T(n,t){return m(n,"src",(e,o)=>`<script ${e}>${o}</script>`,t)}async function b(n,t){return m(n,"href",e=>`<link ${e} />`,{...t,defaultAttrs:{rel:"stylesheet"}})}async function m(n=[],t,e,{contentDir:o,outdir:y,defaultAttrs:h={},consentEnabled:d=!1}){if(!Array.isArray(n)||!n.length)return"";const c=[];for(const i of n){const C=typeof i=="string"?{[t]:i}:{...i},{src:$,href:k,inline:a,consent:l,...s}=C;l&&d&&t==="src"&&(s["data-consent"]=l,s.type&&(s["data-consent-type"]=s.type),s.type="text/plain");let r=t==="href"?k:$,u="";if(p(r)&&!a){const f=await x(o,r,y);if(!f)continue;r=f}else p(r)&&a&&(u=g(j(o,r),"utf-8"),r=!1);const S=F({...h,...s,[t]:r});c.push(e(S,u))}return c.join("")}function F(n){const t=[];for(const e in n){const o=n[e];o!==!1&&(o===!0?t.push(e):t.push(`${e}="${o}"`))}return t.join(" ")}export{b as formatCustomLinks,T as formatCustomScripts};
@@ -1 +1 @@
1
- import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;let l=f.posix.dirname(i);const t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
1
+ import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;const l=f.posix.dirname(i),t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
@@ -1 +1 @@
1
- import w from"path";import{lintConfig as A,loadConfig as T,createConfigTypes as U}from"@redocly/openapi-core";import{deepMerge as $}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as L}from"../../../../../constants/common.js";import{sanitizeBranchName as x}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as B}from"../../format-error.js";import{ExternalResolver as j}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as q}from"../../resolve-mutual-exclusion.js";function h(e,t,s,o){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||o(new Error(`Invalid ${s} URL: "${e[t]}". ${s} must start with "http://" or "https://".`)))}function N(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const s=e.access;h(s,"logoutReturnUrl","access.logoutReturnUrl",t),h(s,"residency","access.residency",t);const o=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const a of o)a in s&&s[a]!==void 0&&a in e&&e[a]!==void 0&&t(new Error(`Property '${a}' is defined both at root level and in 'access' object. Please use 'access.${a}' to define this configuration.`))}}async function J(e,t,s,o){const p=t.getFileInfo(e)?.realRelativePath||e;async function i(){const l=new j(t),u=w.join(t.cwd,p),c=await T({configPath:u,externalRefResolver:l}),f=await o(c.resolvedConfig);if(f===void 0)return c.resolvedConfig;const m=c.document?.source,P=[...m?await A({config:c,externalConfigTypes:U(f,c)}):[],...m?q(c.resolvedConfig,m):[]];if(P.length>0)for(const b of P)s(new Error(B(b,t.cwd)));return c.resolvedConfig}const r=await t.exists(e)?await i():{},R=k(r),v=await o(r);h(r,"residency","Residency",s),h(r,"logoutReturnUrl","Logout return URL",s),N(r,s);let g=v?E(v,r):r;const{env:y}=g;if(y){const l=C.REDOCLY_ENV,u=y[l]||{},c=C.PUBLIC_REDOCLY_BRANCH_NAME||"",f=c?x(c):"",m=f&&y[`${L}${f}`]||{};g=$(g,m,u)}const n=I(g,R);if(n.imports&&n.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const l=new Set([...n.plugins||[],...n.imports.map(u=>w.posix.join(u,"plugin.js"))]);n.plugins=Array.from(l),delete n.imports}if(n.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),n.catalogClassic={...n.catalog},delete n.catalog),n.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),n.scorecardClassic=n.scorecard,delete n.scorecard),n.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const l={...n.search?.ai,...n.aiAssistant,suggestions:n.aiAssistant?.suggestions?.length?n.aiAssistant.suggestions:n.search?.ai.suggestions||[]};n.aiAssistant=l,delete n.search.ai}return _(n)}function _(e){const t={...e},o={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},a=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],p=[];for(const i of a){const r=t[i];r!==void 0&&(p.push(i),i==="requiresLogin"&&o.requiresLogin===void 0&&(o.requiresLogin=r),i==="logoutReturnUrl"&&o.logoutReturnUrl===void 0&&(o.logoutReturnUrl=r),i==="residency"&&o.residency===void 0&&(o.residency=r),i==="sso"&&o.sso===void 0&&(o.sso=r),i==="idps"&&o.idps===void 0&&(o.idps=r),i==="rbac"&&o.rbac===void 0&&(o.rbac=r),delete t[i])}return p.length>0&&d.warn(`The following properties at root level are deprecated: ${p.join(", ")}. Please move them to the 'access' object.`),Object.keys(o).length>0&&(t.access=o),t}function k(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 s of Object.keys(e.theme))e[s]==null?t.push(s):d.warn(`Detected both '${s}' and 'theme.${s}' properties in redocly.yaml. The 'theme.${s}' property will be ignored and needs to be removed or merged into the '${s}'.`);return t}function I(e,t){if(!e.theme||t.length===0)return e;const s={...e};for(const o of t)s[o]=e.theme[o];return delete s.theme,s}export{_ as ensureAccessBackwardsCompatibility,J as readAndValidateConfig};
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 +1 @@
1
- import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(i,{cache:r,fs:s})=>{const e=new Map,a=await s.scan();await E(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await F(n,e,r);continue}const o=l(n);if(o==null||u.includes(V+o.versionName))continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(m=>m.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return w(e)};async function F(i,r,s){let e=v.posix.dirname(i);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(i,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,i),n.versions=[]):(!n.versions||n.versions.length===0)&&y.warn("Property 'versions' is empty at %rp. This is likely a mistake.",i);const o=r.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),r.set(e,o)}async function E(i){const r=new Set;for(const{relativePath:s}of i){const e=l(s);if(!(e?.versionFolderPath&&u.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(P)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}r.has(e.versionFolderPath)||r.add(e.versionFolderPath)}}}function w(i){for(let[r,s]of i){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>g(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;i.set(r,{...s,versions:e,defaultVersion:n})}return i}function S(i,r){const s=l(i);return s==null?null:r.get(s.versionFolderPath)?.defaultVersion}export{S as getDefaultVersionByPath,A as versionsConfigLoader};
1
+ import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(i,{cache:r,fs:s})=>{const e=new Map,a=await s.scan();await E(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await F(n,e,r);continue}const o=l(n);if(o==null||u.includes(V+o.versionName))continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(m=>m.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return w(e)};async function F(i,r,s){let e=v.posix.dirname(i);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(i,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,i),n.versions=[]):(!n.versions||n.versions.length===0)&&y.warn("Property 'versions' is empty at %rp. This is likely a mistake.",i);const o=r.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),r.set(e,o)}async function E(i){const r=new Set;for(const{relativePath:s}of i){const e=l(s);if(!(e?.versionFolderPath&&u.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(P)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}r.has(e.versionFolderPath)||r.add(e.versionFolderPath)}}}function w(i){for(const[r,s]of i){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>g(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;i.set(r,{...s,versions:e,defaultVersion:n})}return i}function S(i,r){const s=l(i);return s==null?null:r.get(s.versionFolderPath)?.defaultVersion}export{S as getDefaultVersionByPath,A as versionsConfigLoader};
@@ -1 +1 @@
1
- function u(s,r){const n=[["requiresLogin","rbac"]];let e=[];for(const t of n)if(t.filter(i=>o(s,i)).length>1){const i={ruleId:"configuration struct",severity:"error",message:`Properties '${t.join(", ")}' are mutually exclusive and can't be used together.`,location:[{source:r,pointer:`#/${t[0]}`}],suggest:[]};e.push(i)}return e}function o(s,r){return{rbac:e=>e&&Object.keys(e).length>=0,requiresLogin:e=>!!e}[r]?.(s[r])??s[r]!==void 0}export{u as resolveMutuallyExclusiveProps};
1
+ function u(s,r){const n=[["requiresLogin","rbac"]],e=[];for(const t of n)if(t.filter(i=>o(s,i)).length>1){const i={ruleId:"configuration struct",severity:"error",message:`Properties '${t.join(", ")}' are mutually exclusive and can't be used together.`,location:[{source:r,pointer:`#/${t[0]}`}],suggest:[]};e.push(i)}return e}function o(s,r){return{rbac:e=>e&&Object.keys(e).length>=0,requiresLogin:e=>!!e}[r]?.(s[r])??s[r]!==void 0}export{u as resolveMutuallyExclusiveProps};
@@ -1 +1 @@
1
- import s from"@redocly/ajv";import l from"ajv-formats";import{removeDeepProperty as c}from"../../../utils/object/remove-deep-property.js";function F(t,e){const i=JSON.parse(JSON.stringify(e)),a=d(t);return a(i||{})||(a.errors?.map(o=>o.instancePath.slice(1))?.forEach(o=>{const n=o.split("/");c(i,n)}),a(i||{})),i||{}}function d(t){if(!t.$id)return r.compile(t);const e=r.getSchema(t.$id);return e||(r.addSchema(t),r.compile(t))}const r=new s({strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,discriminator:!0,strictTypes:!1,verbose:!0});l(r);export{r as ajv,F as safeParsePartial};
1
+ import s from"@redocly/ajv";import c from"ajv-formats";import{removeDeepProperty as d}from"../../../utils/object/remove-deep-property.js";function v(t,e){const i=JSON.parse(JSON.stringify(e)),a=l(t);if(!a(i||{})){for(const o of a.errors||[]){const n=o.instancePath.slice(1).split("/");o.keyword==="additionalProperties"&&o.instancePath!==""&&n.push(o.params.additionalProperty),d(i,n)}a(i||{})}return i||{}}function l(t){if(!t.$id)return r.compile(t);const e=r.getSchema(t.$id);return e||(r.addSchema(t),r.compile(t))}const r=new s({strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,discriminator:!0,strictTypes:!1,verbose:!0});c(r);export{r as ajv,v as safeParsePartial};
@@ -1 +1 @@
1
- import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as l}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as m,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as v}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,a){const t={...e};if(e.image)try{t.image=await f(e.image,a,{fromFileRelativePath:o,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.image": %rp',e.image):await r.panicOnBuild(`Cannot resolve "logo.image": %rp: ${i.message}`,e.image)}if(e.srcSet)try{t.srcSet=await v(e.srcSet,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError(`Cannot resolve "logo.srcSet" "${e.srcSet}"`):await r.panicOnBuild(`Cannot resolve "logo.srcSet" "${e.srcSet}": ${i.message}`)}if(e.favicon)try{t.favicon=await f(e.favicon,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.favicon": %rp',e.favicon):await r.panicOnBuild(`Cannot resolve "logo.favicon": %rp: ${i.message}`,e.favicon)}return t.favicon||(t.favicon=await w(n,a)),t}async function w(e,o){for(let n of p){const a=`favicon.${n}`,t=l(a);if(await o.exists(t))return m(o.cwd,a,e)}}export{u as resolveLogoConfig};
1
+ import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as m}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as v,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as l}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,a){const t={...e};if(e.image)try{t.image=await f(e.image,a,{fromFileRelativePath:o,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.image": %rp',e.image):await r.panicOnBuild(`Cannot resolve "logo.image": %rp: ${i.message}`,e.image)}if(e.srcSet)try{t.srcSet=await l(e.srcSet,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError(`Cannot resolve "logo.srcSet" "${e.srcSet}"`):await r.panicOnBuild(`Cannot resolve "logo.srcSet" "${e.srcSet}": ${i.message}`)}if(e.favicon)try{t.favicon=await f(e.favicon,a,{fromFileRelativePath:s,contentDir:a.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.favicon": %rp',e.favicon):await r.panicOnBuild(`Cannot resolve "logo.favicon": %rp: ${i.message}`,e.favicon)}return t.favicon||(t.favicon=await w(n,a)),t}async function w(e,o){for(const n of p){const a=`favicon.${n}`,t=m(a);if(await o.exists(t))return v(o.cwd,a,e)}}export{u as resolveLogoConfig};
@@ -1,5 +1,5 @@
1
- import{logger as n}from"../../../../../tools/notifiers/logger.js";import{canAccessResource as U}from"../../../../../utils/rbac.js";import{ApigeeDevOnboardingIntegrationAuthType as w,APIGEE_VERSION as m}from"./types.js";import{AlgorithmTypes as D}from"../../../../../web-server/jwt/types.js";import*as S from"../../../../../web-server/jwt/jwt.js";import{getFirstNameFromClaims as k,getLastNameFromClaims as T}from"../../../utils.js";import{HttpError as b}from"../../../../../utils/errors.js";const f="developer.service.DeveloperDoesNotExist",$=3600*24*365*1;function O(s){return s.replace(/\+/g,"%2B")}function y(s){return{id:s.consumerKey,clientId:s.consumerKey,clientSecret:s.consumerSecret,scopes:s.scopes,issuedAt:s.issuedAt,expiresAt:s.expiresAt,attributes:N(s.attributes),status:s.status,apiProductsStatus:s.apiProducts?.map(e=>({id:e.apiproduct,status:e.status,name:e.apiproduct}))||[],canBeRolled:!1,canBeRevoked:!0,valueToUseInHeader:"clientId"}}function A(s){const e=Object.fromEntries((s.attributes||[]).map(t=>[t.name,t.value]));return{id:s.name,name:e.DisplayName||s.name,description:e.Notes||"",...s.callbackUrl!==void 0?{callbackUrl:s.callbackUrl}:{},attributes:e,createdAt:s.createdAt,lastModifiedAt:s.lastModifiedAt,scopes:s.scopes,credentials:s.credentials?.map(y)||[],supportsLogs:!1,canCreateKey:!0}}function x(s){const e=Object.fromEntries((s.attributes||[]).map(t=>[t.name,t.value]));return{id:s.name,name:e.DisplayName||s.name,description:s.description,attributes:e,createdAt:s.createdAt,lastModifiedAt:s.lastModifiedAt,approvalType:s.approvalType,scopes:s.scopes}}function v(s){return Object.entries(s||{}).map(([e,t])=>({name:e,value:t}))}function N(s){return Object.fromEntries((s||[]).map(e=>[e.name,e.value]))}let h=null;async function I(s){h?(await h).expiresAt<Date.now()/1e3&&(n.info("Token expired, requesting new apigee access token"),h=C(s)):(n.info("Requesting apigee access token"),h=C(s));try{return(await h).token}catch(e){throw h=null,e}}async function C({auth:s}){switch(s.type){case w.OAUTH2:return j(s);case w.SERVICE_ACCOUNT:return _(s)}}async function j(s){const e={grant_type:"client_credentials",client_id:s.clientId,client_secret:s.clientSecret};let t=await fetch(s.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(e).toString()});if(!t.ok)throw new Error(`Failed to get access token: ${t.statusText}
1
+ import{logger as n}from"../../../../../tools/notifiers/logger.js";import{canAccessResource as U}from"../../../../../utils/rbac.js";import{ApigeeDevOnboardingIntegrationAuthType as w,APIGEE_VERSION as m}from"./types.js";import{AlgorithmTypes as D}from"../../../../../web-server/jwt/types.js";import*as S from"../../../../../web-server/jwt/jwt.js";import{getFirstNameFromClaims as k,getLastNameFromClaims as T}from"../../../utils.js";import{HttpError as b}from"../../../../../utils/errors.js";const f="developer.service.DeveloperDoesNotExist",$=3600*24*365*1;function O(s){return s.replace(/\+/g,"%2B")}function y(s){return{id:s.consumerKey,clientId:s.consumerKey,clientSecret:s.consumerSecret,scopes:s.scopes,issuedAt:s.issuedAt,expiresAt:s.expiresAt,attributes:N(s.attributes),status:s.status,apiProductsStatus:s.apiProducts?.map(e=>({id:e.apiproduct,status:e.status,name:e.apiproduct}))||[],canBeRolled:!1,canBeRevoked:!0,valueToUseInHeader:"clientId"}}function A(s){const e=Object.fromEntries((s.attributes||[]).map(t=>[t.name,t.value]));return{id:s.name,name:e.DisplayName||s.name,description:e.Notes||"",...s.callbackUrl!==void 0?{callbackUrl:s.callbackUrl}:{},attributes:e,createdAt:s.createdAt,lastModifiedAt:s.lastModifiedAt,scopes:s.scopes,credentials:s.credentials?.map(y)||[],supportsLogs:!1,canCreateKey:!0}}function x(s){const e=Object.fromEntries((s.attributes||[]).map(t=>[t.name,t.value]));return{id:s.name,name:e.DisplayName||s.name,description:s.description,attributes:e,createdAt:s.createdAt,lastModifiedAt:s.lastModifiedAt,approvalType:s.approvalType,scopes:s.scopes}}function v(s){return Object.entries(s||{}).map(([e,t])=>({name:e,value:t}))}function N(s){return Object.fromEntries((s||[]).map(e=>[e.name,e.value]))}let h=null;async function I(s){h?(await h).expiresAt<Date.now()/1e3&&(n.info("Token expired, requesting new apigee access token"),h=C(s)):(n.info("Requesting apigee access token"),h=C(s));try{return(await h).token}catch(e){throw h=null,e}}async function C({auth:s}){switch(s.type){case w.OAUTH2:return j(s);case w.SERVICE_ACCOUNT:return _(s)}}async function j(s){const e={grant_type:"client_credentials",client_id:s.clientId,client_secret:s.clientSecret},t=await fetch(s.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(e).toString()});if(!t.ok)throw new Error(`Failed to get access token: ${t.statusText}
2
2
  ${await t.text()}`);const a=await t.json(),{access_token:i,expires_in:r}=a;return n.info("Apigee access token received"),{token:i,expiresAt:Math.floor(Date.now()/1e3)+r}}async function _(s){n.verbose(`Using service account to sign JWT token: Email: "%s" Private key:
3
3
  %s
4
- `,s.serviceAccountEmail,s.serviceAccountPrivateKey.slice(0,30)+"***"+s.serviceAccountPrivateKey.slice(-30));const t={grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:await S.sign({sub:s.serviceAccountEmail,iss:s.serviceAccountEmail,aud:"https://www.googleapis.com/oauth2/v4/token",iat:Math.floor(Date.now()/1e3),exp:Math.floor(Date.now()/1e3)+3600,scope:"https://www.googleapis.com/auth/cloud-platform"},s.serviceAccountPrivateKey,D.RS256)};n.verbose("Exchanging JWT for access token",s.serviceAccountEmail,s.serviceAccountPrivateKey.slice(0,30)+"***"+s.serviceAccountPrivateKey.slice(-30));let a=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()});if(!a.ok)throw new Error(`Failed to get access token: ${a.statusText}
4
+ `,s.serviceAccountEmail,s.serviceAccountPrivateKey.slice(0,30)+"***"+s.serviceAccountPrivateKey.slice(-30));const t={grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:await S.sign({sub:s.serviceAccountEmail,iss:s.serviceAccountEmail,aud:"https://www.googleapis.com/oauth2/v4/token",iat:Math.floor(Date.now()/1e3),exp:Math.floor(Date.now()/1e3)+3600,scope:"https://www.googleapis.com/auth/cloud-platform"},s.serviceAccountPrivateKey,D.RS256)};n.verbose("Exchanging JWT for access token",s.serviceAccountEmail,s.serviceAccountPrivateKey.slice(0,30)+"***"+s.serviceAccountPrivateKey.slice(-30));const a=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()});if(!a.ok)throw new Error(`Failed to get access token: ${a.statusText}
5
5
  ${await a.text()}`);const i=await a.json(),{access_token:r,expires_in:o}=i;return n.info("Apigee access token received"),{token:r,expiresAt:Math.floor(Date.now()/1e3)+o}}class F{apiUrl;developerUrl;accessToken=null;organizationName;email;organizationUrl;version;userClaims;config;ignoreApiProducts;catalogApiProducts;allowApiProductsOutsideCatalog;adapterId;stage;rbacConfig;constructor(e,t,a,i){const r=e;this.apiUrl=r.apiUrl||"https://apigee.googleapis.com/v1",this.organizationName=r.organizationName,this.email=a.email,this.organizationUrl=`${this.apiUrl}/organizations/${this.organizationName}`,this.developerUrl=`${this.organizationUrl}/developers/${O(this.email)}`,this.version=e.type==="APIGEE_X"?m.x:m.edge,this.userClaims=a,this.adapterId=r.organizationName,this.ignoreApiProducts=new Set(r.ignoreApiProducts||[]),this.catalogApiProducts=new Map(Object.entries(i)),this.allowApiProductsOutsideCatalog=r.allowApiProductsOutsideCatalog??!1,this.config=r,this.stage=r.stage||"non-production",this.rbacConfig=t}async setAuthHeader(e){return e=e||{},e.headers={...e.headers,"Accept-Encoding":"identity",accept:"application/json",Authorization:"Bearer "+await I(this.config),"X-Api-Key":this.config.auth.type===w.OAUTH2?this.config.auth.clientId:void 0},e}getErrorMessage(e){if(!e)return"Fetch error";try{const t=JSON.parse(e);return t.code===f?t.code:t.error.details[0]?.["@type"]==="type.googleapis.com/google.rpc.PreconditionFailure"&&t.error.details[0]?.violations[0]?.type===f?f:t?.message||t.error.message}catch{return e}}async fetchData(e,t){const a=await this.setAuthHeader(t),i=typeof e=="string"?e:e.url,r=typeof e=="string"?"GET":e.method;n.verbose(`${r.toUpperCase()} request to "${i}"`);const o=await fetch(e,a);if(!o.ok){const d=await o.text(),c=this.getErrorMessage(d);if(c===f){const p=this.userClaims,g=k(p),u=T(p),l=this.email;return await this.createDeveloper(this.email,g,u,l),await this.fetchData(e,t)}throw o.status!==404&&n.warn(`${r.toUpperCase()} request to "${i}" failed with ${o.status} code`),new b(o.status,c)}return o.headers.get("x-redocly-apigee-version")===m.x&&(this.version=m.x),n.verbose(`${r.toUpperCase()} request to "${i}" OK`),o.json()}async getApps(){const e=`${this.developerUrl}/apps?expand=true`,{app:t}=await this.fetchData(e),a=(t||[]).map(A);return{data:a,total:a.length}}async getApiProducts(){const e=`${this.organizationUrl}/apiproducts?expand=true`,{apiProduct:t}=await this.fetchData(e),a=(t||[]).filter(i=>U(this.catalogApiProducts.get(i.name)||{},this.userClaims,this.rbacConfig)&&(this.allowApiProductsOutsideCatalog||this.catalogApiProducts.has(i.name))&&!this.ignoreApiProducts.has(i.name)).map(x);return{data:a,total:a.length}}async getApp(e){const t=`${this.developerUrl}/apps/${e}${this.version===m.edge?"?expand=true":""}`,a=await this.fetchData(t);return A(a)}createDeveloper(e,t,a,i){const r=`${this.organizationUrl}/developers`;return this.fetchData(r,{headers:{"Content-type":"application/json"},body:JSON.stringify({email:e,firstName:t,lastName:a,userName:i}),method:"POST"})}async createApp(e){const t=`${this.developerUrl}/apps`;n.verbose(`Creating app ${e.id} ${e.apiProductIds}`);const a=await this.fetchData(t,{headers:{"Content-type":"application/json"},body:JSON.stringify({name:e.id,apiProducts:e.apiProductIds||[],...e.callbackUrl!==void 0?{callbackUrl:e.callbackUrl}:{},keyExpiresIn:1*365*24*60*60*1e3,attributes:v({...e.attributes,DisplayName:e.name,Notes:e.description||""})}),method:"POST"});if(e.credentials){const i=e.credentials[0];await this.fetchData(`${this.developerUrl}/apps/${e.id}/keys/create`,{headers:{"Content-type":"application/json"},body:JSON.stringify({consumerKey:i.clientId,consumerSecret:i.clientSecret,expiresInSeconds:P(i.expiresAt,$)}),method:"POST"}),n.info("Imported previously provided key");const r=a.credentials[0].consumerKey;await this.fetchData(`${this.developerUrl}/apps/${e.id}/keys/${r}`,{method:"DELETE"}),n.info("Deleted autogenerated key");const o=await this.fetchData(`${this.developerUrl}/apps/${e.id}/keys/${i.clientId}`,{headers:{"Content-type":"application/json"},body:JSON.stringify({apiProducts:e.apiProductIds||[]}),method:"POST"});a.credentials=[o]}return A(a)}async updateApp(e,t){const a=`${this.developerUrl}/apps/${e}`;try{const i=await this.getApp(e),r={...t.attributes};t.name&&(r.DisplayName=t.name),t.description&&(r.Notes=t.description);const o={attributes:v({...i.attributes,...r})};t.callbackUrl!==void 0&&(o.callbackUrl=t.callbackUrl);const d=await this.fetchData(a,{headers:{"Content-type":"application/json"},body:JSON.stringify(o),method:"PUT"});return A(d)}catch(i){if(i.message.includes("does not exist"))return;throw i}}async deleteApp(e){const t=`${this.developerUrl}/apps/${e}`;try{return await this.fetchData(t,{headers:{"Content-type":"application/json"},method:"DELETE"})}catch(a){if(a.message.includes("does not exist"))return;throw a}}async createCredential(e,t){const a=`${this.developerUrl}/apps/${e}`;let i;if(t.clientId&&t.clientSecret)await this.fetchData(`${this.developerUrl}/apps/${e}/keys/create`,{headers:{"Content-type":"application/json"},body:JSON.stringify({consumerKey:t.clientId,consumerSecret:t.clientSecret,expiresInSeconds:P(t.expiresAt,$)}),method:"POST"}),i=await this.fetchData(`${this.developerUrl}/apps/${e}/keys/${t.clientId}`,{headers:{"Content-type":"application/json"},body:JSON.stringify({apiProducts:t.apiProductIds||[]}),method:"POST"}),n.info("Imported previously provided key");else{const r=await this.getApp(e);i=(await this.fetchData(a,{headers:{"Content-type":"application/json"},method:"PUT",body:JSON.stringify({apiProducts:t.apiProductIds,attributes:v({...r.attributes,...t.attributes})})})).credentials[0]}return y(i)}async updateCredential(e,t,a){let i;try{i=await this.fetchData(`${this.developerUrl}/apps/${e}/keys/${t}`)}catch{i=void 0}if(!i)throw new b(404,"Cannot update credential that does not exist");const r=`${this.developerUrl}/apps/${e}/keys/${t}`,o=await this.fetchData(r,{headers:{"Content-type":"application/json"},method:"PUT",body:JSON.stringify({apiProducts:a.apiProductIds})}),d=o.apiProducts.filter(c=>!a.apiProductIds.includes(c.apiproduct)).map(c=>c.apiproduct);return await Promise.all(d.map(c=>this.fetchData(`${this.developerUrl}/apps/${e}/keys/${t}/apiproducts/${c}`,{method:"DELETE"}))),y(o)}async deleteCredential(e,t){const a=`${this.developerUrl}/apps/${e}/keys/${t}`;return y(await this.fetchData(a,{headers:{"Content-type":"application/octet-stream"},method:"DELETE"}))}async getAppLogDetails(e,t){throw new Error("Not implemented")}async getAppLogs(e,t){return{total:0,data:[]}}async getApiAccessStatus(e,t){const{data:a}=await this.getApps(),i=(a||[]).filter(p=>(p.credentials||[]).find(u=>u.apiProductsStatus.find(l=>l.id===e))),r=p=>i.find(g=>g.credentials?.find(l=>l.status===p&&l.apiProductsStatus.find(E=>E.id===e))),o=t?i.map(p=>{if(p.credentials?.find(u=>u.status==="approved"&&u.apiProductsStatus.find(l=>l.id===e)))return{id:p.id,title:p.name}}).filter(Boolean):void 0,d=r("approved");if(d)return{status:"ACCEPTED",appId:d.id,apps:o};const c=r("pending");return c?{status:"PENDING",appId:c.id,apps:o}:{status:"NONE"}}}function P(s,e){if(!(!s&&!e))return s=s||(Date.now()+e*1e3).toString(),Math.floor((parseInt(s,10)-Date.now())/1e3).toString()}export{F as ApigeeAdapter};