@redocly/reef 0.131.0-next.2 → 0.131.0-next.4

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 (205) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/develop.js +1 -1
  4. package/dist/cli/eject/resolveTheme.d.ts +1 -1
  5. package/dist/cli/eject/resolveTheme.js +1 -1
  6. package/dist/cli/prepare/copy-env-files.js +1 -1
  7. package/dist/cli/prepare/index.js +1 -1
  8. package/dist/cli/telemetry/index.js +1 -1
  9. package/dist/client/App.js +1 -1
  10. package/dist/client/ErrorBoundary.js +1 -1
  11. package/dist/client/app/DevModeFloatingBar/index.d.ts +3 -0
  12. package/dist/client/app/DevModeFloatingBar/index.js +43 -0
  13. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  14. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  15. package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
  16. package/dist/client/browser-entry.js +5 -5
  17. package/dist/client/constants/common.d.ts +2 -0
  18. package/dist/client/constants/common.js +1 -0
  19. package/dist/client/providers/hooks.js +1 -1
  20. package/dist/client/runtime/loader.js +1 -1
  21. package/dist/client/runtime/useSocketMessages.js +1 -1
  22. package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
  23. package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
  24. package/dist/constants/catalog-entities.d.ts +12 -0
  25. package/dist/constants/catalog-entities.js +1 -0
  26. package/dist/constants/common.d.ts +1 -2
  27. package/dist/constants/common.js +1 -1
  28. package/dist/constants/l10n/langs/ar.js +1 -1
  29. package/dist/constants/l10n/langs/de.js +1 -1
  30. package/dist/constants/l10n/langs/en.js +1 -1
  31. package/dist/constants/l10n/langs/es.js +1 -1
  32. package/dist/constants/l10n/langs/fr.js +1 -1
  33. package/dist/constants/l10n/langs/hi.js +1 -1
  34. package/dist/constants/l10n/langs/it.js +1 -1
  35. package/dist/constants/l10n/langs/ja.js +1 -1
  36. package/dist/constants/l10n/langs/ko.js +1 -1
  37. package/dist/constants/l10n/langs/pl.js +1 -1
  38. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  39. package/dist/constants/l10n/langs/pt.js +1 -1
  40. package/dist/constants/l10n/langs/ru.js +1 -1
  41. package/dist/constants/l10n/langs/uk.js +1 -1
  42. package/dist/constants/l10n/langs/zh.js +1 -1
  43. package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
  44. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  45. package/dist/server/config/env-config.js +1 -0
  46. package/dist/server/constants/common.d.ts +3 -0
  47. package/dist/server/constants/common.js +1 -1
  48. package/dist/server/constants/feedback.d.ts +6 -0
  49. package/dist/server/constants/feedback.js +1 -0
  50. package/dist/server/constants/plugins/catalog-entities.d.ts +0 -11
  51. package/dist/server/constants/plugins/catalog-entities.js +1 -1
  52. package/dist/server/entitlements/entitlements-provider.js +1 -1
  53. package/dist/server/esbuild/esbuild-logger.js +1 -1
  54. package/dist/server/esbuild/esbuild.js +1 -1
  55. package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
  56. package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
  57. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  58. package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
  59. package/dist/server/{config/external-plugins.d.ts → external-plugins/resolve-external-plugins.d.ts} +2 -2
  60. package/dist/server/{config/external-plugins.js → external-plugins/resolve-external-plugins.js} +1 -1
  61. package/dist/server/fs/cache.js +1 -1
  62. package/dist/server/fs/last-modified-tracker.js +1 -1
  63. package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
  64. package/dist/server/node-bundle-entry.js +1 -1
  65. package/dist/server/plugins/analytics/adobe/index.js +1 -1
  66. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  67. package/dist/server/plugins/analytics/fullstory/index.js +1 -1
  68. package/dist/server/plugins/analytics/ga/index.js +1 -1
  69. package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
  70. package/dist/server/plugins/analytics/gtm/index.js +1 -1
  71. package/dist/server/plugins/analytics/heap/index.js +1 -1
  72. package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
  73. package/dist/server/plugins/analytics/segment/index.js +1 -1
  74. package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +27 -27
  75. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  76. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
  77. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  78. package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
  79. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  80. package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
  81. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  82. package/dist/server/plugins/default-theme/index.js +1 -1
  83. package/dist/server/plugins/entitlements/index.js +1 -1
  84. package/dist/server/plugins/lifecycle.js +2 -2
  85. package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
  86. package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
  87. package/dist/server/plugins/markdown/search/to-markdown.js +17 -13
  88. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  89. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.d.ts +1 -0
  90. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.js +1 -1
  91. package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +3 -2
  92. package/dist/server/plugins/mcp/docs-mcp/tools/search.js +6 -1
  93. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  94. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  95. package/dist/server/plugins/mcp/servers/docs-server.d.ts +3 -1
  96. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  97. package/dist/server/plugins/mcp/types.d.ts +7 -0
  98. package/dist/server/plugins/openapi-docs/index.js +1 -1
  99. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +20 -20
  100. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  101. package/dist/server/plugins/scorecards/plugin.js +1 -1
  102. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
  103. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +11 -0
  104. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -0
  105. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  106. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  107. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  108. package/dist/server/plugins/search/index.js +1 -1
  109. package/dist/server/plugins/search/llmstxt/index.js +1 -1
  110. package/dist/server/plugins/search/utils.d.ts +2 -0
  111. package/dist/server/plugins/search/utils.js +2 -2
  112. package/dist/server/plugins/sidebars/index.js +1 -1
  113. package/dist/server/plugins/sso/index.js +1 -1
  114. package/dist/server/providers/database/base-repository.js +1 -1
  115. package/dist/server/providers/database/database-connection-factory.js +1 -1
  116. package/dist/server/providers/database/database-preconnect-service.js +1 -1
  117. package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
  118. package/dist/server/ssr/render.js +1 -1
  119. package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
  120. package/dist/server/ssr/utils.js +1 -1
  121. package/dist/server/store.d.ts +1 -1
  122. package/dist/server/store.js +1 -1
  123. package/dist/server/telemetry/index.js +1 -1
  124. package/dist/server/tools/notifiers/formatter.js +1 -1
  125. package/dist/server/tools/notifiers/helpers/colors.js +1 -1
  126. package/dist/server/tools/notifiers/logger.js +1 -1
  127. package/dist/server/tools/notifiers/reporter.js +1 -1
  128. package/dist/server/tools/notifiers/terminal-manager.js +1 -1
  129. package/dist/server/utils/ai-agent-detection.d.ts +16 -0
  130. package/dist/server/utils/ai-agent-detection.js +1 -0
  131. package/dist/server/utils/envs/load-env-variables.js +1 -1
  132. package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
  133. package/dist/server/utils/is-scorecards-enabled.js +1 -1
  134. package/dist/server/utils/report-all-errors.js +1 -1
  135. package/dist/server/version.js +1 -1
  136. package/dist/server/web-server/auth.d.ts +2 -0
  137. package/dist/server/web-server/auth.js +4 -4
  138. package/dist/server/web-server/handle-api-route-request.js +1 -1
  139. package/dist/server/web-server/http.js +1 -1
  140. package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
  141. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  142. package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
  143. package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
  144. package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
  145. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  146. package/dist/server/web-server/mime-types.js +1 -1
  147. package/dist/server/web-server/routes/auth.js +1 -1
  148. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  149. package/dist/server/web-server/routes/error.js +1 -1
  150. package/dist/server/web-server/routes/feedback.js +1 -1
  151. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.d.ts +2 -0
  152. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.js +1 -0
  153. package/dist/server/web-server/routes/index.js +1 -1
  154. package/dist/server/web-server/routes/info.js +1 -1
  155. package/dist/server/web-server/routes/mcp-oauth.js +1 -1
  156. package/dist/server/web-server/routes/otel/otel.js +1 -1
  157. package/dist/server/web-server/routes/page-data.js +1 -1
  158. package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
  159. package/dist/server/web-server/routes/resolve-route.js +1 -1
  160. package/dist/server/web-server/routes/semantic-search.d.ts +4 -0
  161. package/dist/server/web-server/routes/semantic-search.js +1 -0
  162. package/dist/server/workers/worker-pool.js +1 -1
  163. package/package.json +9 -9
  164. package/dist/client/app/ErrorBubble/index.d.ts +0 -3
  165. package/dist/client/app/ErrorBubble/index.js +0 -59
  166. package/dist/client/app/PageCounter/index.d.ts +0 -3
  167. package/dist/client/app/PageCounter/index.js +0 -64
  168. package/dist/config/env-config.js +0 -1
  169. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.d.ts +0 -6
  170. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +0 -1
  171. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.d.ts +0 -0
  172. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.js +0 -0
  173. /package/dist/{config → server/config}/env-config.d.ts +0 -0
  174. /package/dist/{config → server/config}/env-schema.d.ts +0 -0
  175. /package/dist/{config → server/config}/env-schema.js +0 -0
  176. /package/dist/{config → server/config}/env-schemas/api-urls.d.ts +0 -0
  177. /package/dist/{config → server/config}/env-schemas/api-urls.js +0 -0
  178. /package/dist/{config → server/config}/env-schemas/auth.d.ts +0 -0
  179. /package/dist/{config → server/config}/env-schemas/auth.js +0 -0
  180. /package/dist/{config → server/config}/env-schemas/catalog.d.ts +0 -0
  181. /package/dist/{config → server/config}/env-schemas/catalog.js +0 -0
  182. /package/dist/{config → server/config}/env-schemas/database.d.ts +0 -0
  183. /package/dist/{config → server/config}/env-schemas/database.js +0 -0
  184. /package/dist/{config → server/config}/env-schemas/environment-detection.d.ts +0 -0
  185. /package/dist/{config → server/config}/env-schemas/environment-detection.js +0 -0
  186. /package/dist/{config → server/config}/env-schemas/feature-flags.d.ts +0 -0
  187. /package/dist/{config → server/config}/env-schemas/feature-flags.js +0 -0
  188. /package/dist/{config → server/config}/env-schemas/organization-project.d.ts +0 -0
  189. /package/dist/{config → server/config}/env-schemas/organization-project.js +0 -0
  190. /package/dist/{config → server/config}/env-schemas/scorecards.d.ts +0 -0
  191. /package/dist/{config → server/config}/env-schemas/scorecards.js +0 -0
  192. /package/dist/{config → server/config}/env-schemas/search.d.ts +0 -0
  193. /package/dist/{config → server/config}/env-schemas/search.js +0 -0
  194. /package/dist/{config → server/config}/env-schemas/server-config.d.ts +0 -0
  195. /package/dist/{config → server/config}/env-schemas/server-config.js +0 -0
  196. /package/dist/{config → server/config}/env-schemas/site.d.ts +0 -0
  197. /package/dist/{config → server/config}/env-schemas/site.js +0 -0
  198. /package/dist/{config → server/config}/env-schemas/ssr.d.ts +0 -0
  199. /package/dist/{config → server/config}/env-schemas/ssr.js +0 -0
  200. /package/dist/{config → server/config}/env-schemas/telemetry.d.ts +0 -0
  201. /package/dist/{config → server/config}/env-schemas/telemetry.js +0 -0
  202. /package/dist/{config → server/config}/env-schemas/test.d.ts +0 -0
  203. /package/dist/{config → server/config}/env-schemas/test.js +0 -0
  204. /package/dist/server/{config → external-plugins}/resolve-module.d.ts +0 -0
  205. /package/dist/server/{config → external-plugins}/resolve-module.js +0 -0
@@ -1,25 +1,25 @@
1
- import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{isResourcePubliclyAccessible as u}from"../../../utils/rbac.js";import{getLocaleFromRelativePath as P}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as A}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as d}from"./schema-processor.js";import{llmsTxtLink as L,getLLMsTxtMdSlug as j}from"../../search/llmstxt/index.js";const W=({actions:e,document:t,metadata:i})=>async(n,s,o)=>{const a=n.getSidebar?.(n)||[],c=await o.getConfig(),{allSearchDocuments:r,publiclyAccessibleSearchDocuments:l}=b(n,a,t,e,i,c);if(r.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:n.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return r}}};function b(e,t,i,n,s,o,a){const c=[],r=[];for(const l of t){if(l.type==="group"){const h=l.apiItemData?.type==="channel"?l:a,{allSearchDocuments:D,publiclyAccessibleSearchDocuments:S}=b(e,l.items||[],i,n,s,o,h);c.push(...D),r.push(...S)}const f=k(e,l,i,n,s,o);f&&(c.push(f),q(l,o,a)&&r.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:r}}function k(e,t,i,n,s,o){const a=F(t,i);if(!a)return null;const c=t.link||"",r=t.httpVerb||"",l=P(e.fsPath),f=A(n,s),h=M(e,t,i,a,r,c,o);return{url:c||e.slug,fsPath:e.fsPath,content:h.trim(),title:m(a.title||"")||C(e.fsPath),locale:l,facets:f,includeInLLMsTxt:!t.apiItemData}}function M(e,t,i,n,s,o,a){let c="";const r=m(n.title||""),l=m(n.description||"")+m(n.summary||"");return r&&(c+=`# ${r}
1
+ import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{isResourcePubliclyAccessible as u}from"../../../utils/rbac.js";import{getLocaleFromRelativePath as P}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as A}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as d}from"./schema-processor.js";import{llmsTxtLink as L,getLLMsTxtMdSlug as j}from"../../search/llmstxt/index.js";const W=({actions:n,document:t,metadata:i})=>async(e,s,o)=>{const a=e.getSidebar?.(e)||[],c=await o.getConfig(),{allSearchDocuments:r,publiclyAccessibleSearchDocuments:l}=b(e,a,t,n,i,c);if(r.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:e.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return r}}};function b(n,t,i,e,s,o,a){const c=[],r=[];for(const l of t){if(l.type==="group"){const h=l.apiItemData?.type==="channel"?l:a,{allSearchDocuments:D,publiclyAccessibleSearchDocuments:S}=b(n,l.items||[],i,e,s,o,h);c.push(...D),r.push(...S)}const f=k(n,l,i,e,s,o);f&&(c.push(f),q(l,o,a)&&r.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:r}}function k(n,t,i,e,s,o){const a=F(t,i);if(!a)return null;const c=t.link||"",r=t.httpVerb||"",l=P(n.fsPath),f=A(e,s),h=M(n,t,i,a,r,c,o);return{url:c||n.slug,fsPath:n.fsPath,content:h.trim(),title:m(a.title||"")||C(n.fsPath),locale:l,product:n.product?.name,facets:f,includeInLLMsTxt:!t.apiItemData}}function M(n,t,i,e,s,o,a){let c="";const r=m(e.title||""),l=m(e.description||"")+m(e.summary||"");return r&&(c+=`# ${r}
2
2
 
3
3
  `),l&&(c+=`${l}
4
4
 
5
5
  `),s&&(c+=`Method: ${s.toUpperCase()}
6
- `),c+=I(i),c+=O(i),t.type==="link"&&!t.apiItemData&&(c+=v(e,a)),t.apiItemData?.type==="channel"&&(c+=T(t,i,o,e)),t.apiItemData?.type==="operation"&&(c+=N(t,i)),c}function I(e){let t="";return e.info?.version&&(t+=`Version: ${e.info.version}
7
- `),e.info?.license?.name&&(t+=`License: ${e.info.license.name}
8
- `),t}function O(e){if(!e.servers||Object.keys(e.servers).length===0)return"";let t=`
6
+ `),c+=I(i),c+=O(i),t.type==="link"&&!t.apiItemData&&(c+=v(n,a)),t.apiItemData?.type==="channel"&&(c+=T(t,i,o,n)),t.apiItemData?.type==="operation"&&(c+=N(t,i)),c}function I(n){let t="";return n.info?.version&&(t+=`Version: ${n.info.version}
7
+ `),n.info?.license?.name&&(t+=`License: ${n.info.license.name}
8
+ `),t}function O(n){if(!n.servers||Object.keys(n.servers).length===0)return"";let t=`
9
9
  ## Servers
10
10
 
11
- `;for(const[i,n]of Object.entries(e.servers))t+=`### ${i}
12
- `,n.description&&(t+=`${n.description}
13
- `),t+=`Host: ${n.host}
14
- `,t+=`Protocol: ${n.protocol}
15
- `,n.protocolVersion&&(t+=`Protocol Version: ${n.protocolVersion}
16
- `),n.pathname&&(t+=`Path: ${n.pathname}
11
+ `;for(const[i,e]of Object.entries(n.servers))t+=`### ${i}
12
+ `,e.description&&(t+=`${e.description}
13
+ `),t+=`Host: ${e.host}
14
+ `,t+=`Protocol: ${e.protocol}
15
+ `,e.protocolVersion&&(t+=`Protocol Version: ${e.protocolVersion}
16
+ `),e.pathname&&(t+=`Path: ${e.pathname}
17
17
  `),t+=`
18
- `;return t}function v(e,t){const i=e.getSidebar?.(e)||[],n=$(i,t);if(Object.keys(n).length===0)return"";let s="";for(const[,o]of Object.entries(n))if(o.length>0)for(const a of o){const c=a.label||"Untitled",r=a.link||a.routeSlug||"";s+=`#### ${c}
18
+ `;return t}function v(n,t){const i=n.getSidebar?.(n)||[],e=$(i,t);if(Object.keys(e).length===0)return"";let s="";for(const[,o]of Object.entries(e))if(o.length>0)for(const a of o){const c=a.label||"Untitled",r=a.link||a.routeSlug||"";s+=`#### ${c}
19
19
 
20
20
  `,r&&(s+=` - ${L({title:c,description:void 0,slug:j(r)})}
21
21
 
22
- `)}return s}function T(e,t,i,n){const s=e.apiItemData?.id;if(!s)return"";const o=t.channels?.[s];if(!o)return"";let a="";if(o.parameters&&Object.keys(o.parameters).length>0){a+=`## Parameters
22
+ `)}return s}function T(n,t,i,e){const s=n.apiItemData?.id;if(!s)return"";const o=t.channels?.[s];if(!o)return"";let a="";if(o.parameters&&Object.keys(o.parameters).length>0){a+=`## Parameters
23
23
 
24
24
  `;for(const[c,r]of Object.entries(o.parameters))a+=`### ${c}
25
25
  `,typeof r=="object"&&r!==null&&"description"in r&&r.description&&(a+=`${r.description}
@@ -28,29 +28,29 @@ import{basename as C}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocl
28
28
  `),a+=`
29
29
  `}if(o.messages&&Object.keys(o.messages).length>0){a+=`## Messages
30
30
 
31
- `;for(const[c,r]of Object.entries(o.messages))a+=x(r,c,i,n)}return a}function x(e,t,i,n){let o=`### ${e.title||e.name||t}
32
- `;if(e.description&&(o+=`${e.description}
33
- `),e.summary&&(o+=`${e.summary}
34
- `),e.payload){const a=d(e.payload,"message payload",i.replace(n.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
31
+ `;for(const[c,r]of Object.entries(o.messages))a+=x(r,c,i,e)}return a}function x(n,t,i,e){let o=`### ${n.title||n.name||t}
32
+ `;if(n.description&&(o+=`${n.description}
33
+ `),n.summary&&(o+=`${n.summary}
34
+ `),n.payload){const a=d(n.payload,"message payload",i.replace(e.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
35
35
  #### Payload Schema
36
36
 
37
- `,o+=g(a))}if(e.headers){const a=d(e.headers,"message headers",i.replace(n.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
37
+ `,o+=g(a))}if(n.headers){const a=d(n.headers,"message headers",i.replace(e.slug+"/","").replace(/^\//,""),t);a.length>0&&(o+=`
38
38
  #### Headers Schema
39
39
 
40
- `,o+=g(a))}return o}function g(e){let t="";for(const i of e)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const n=i;t+=`- **${n.name}** (${n.type}${n.required?", required":""})
41
- `,n.description&&(t+=` ${n.description}
42
- `),n.enum&&Array.isArray(n.enum)&&n.enum.length>0&&(t+=` Enum: ${n.enum.join(", ")}
40
+ `,o+=g(a))}return o}function g(n){let t="";for(const i of n)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const e=i;t+=`- **${e.name}** (${e.type}${e.required?", required":""})
41
+ `,e.description&&(t+=` ${e.description}
42
+ `),e.enum&&Array.isArray(e.enum)&&e.enum.length>0&&(t+=` Enum: ${e.enum.join(", ")}
43
43
  `),t+=`
44
- `}return t}function N(e,t){const i=e.apiItemData?.id;if(!i)return"";const n=t.operations?.[i];if(!n)return"";let s=`## Operation Details
44
+ `}return t}function N(n,t){const i=n.apiItemData?.id;if(!i)return"";const e=t.operations?.[i];if(!e)return"";let s=`## Operation Details
45
45
 
46
- `;if(n.action&&(s+=`Action: ${n.action}
47
- `),n.description&&(s+=`${n.description}
48
- `),n.summary&&(s+=`${n.summary}
49
- `),n.messages&&n.messages.length>0){s+=`
46
+ `;if(e.action&&(s+=`Action: ${e.action}
47
+ `),e.description&&(s+=`${e.description}
48
+ `),e.summary&&(s+=`${e.summary}
49
+ `),e.messages&&e.messages.length>0){s+=`
50
50
  ### Messages
51
51
 
52
- `;for(const o of n.messages){const a=o.title||o.name||"Message";s+=`#### ${a}
52
+ `;for(const o of e.messages){const a=o.title||o.name||"Message";s+=`#### ${a}
53
53
  `,o.description&&(s+=`${o.description}
54
54
  `),o.summary&&(s+=`${o.summary}
55
55
  `),s+=`
56
- `}}return s}function $(e,t){const i={};for(const n of e)n.type==="group"?n.apiItemData?.type==="channel"?R(n,i,t):V(n,i,t):n.apiItemData?.type==="channel"&&E(n,i,t);return i}function R(e,t,i){const n=e.label||"Channel";if(u(p(e),i)&&(t[n]||(t[n]=[]),t[n].push(e),e.items))for(const s of e.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[n].push(s)}function V(e,t,i){if(e.items){const n=$(e.items,i);for(const[s,o]of Object.entries(n))t[s]||(t[s]=[]),t[s].push(...o)}}function E(e,t,i){const n=e.label||"Channel";if(u(p(e),i)&&(t[n]||(t[n]=[]),t[n].push(e),e.items))for(const s of e.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[n].push(s)}function F(e,t){const{apiItemData:i,type:n}=e;return i?.type?w(i,t):n==="link"?_(t):null}function w(e,t){switch(e.type){case"channel":return t.channels?.[e.id]||null;case"operation":return t.operations?.[e.id]||null;default:return null}}function _(e){return{description:e.info?.description||"",title:e.info?.title||"",summary:""}}function q(e,t,i){const n=u(p(e),t);if(e.apiItemData?.type==="operation"&&i){const s=u(p(i),t);return n&&s}return n}function p(e){return{slug:e.link||"",[y]:e[y]}}export{W as getAiDocumentsStore};
56
+ `}}return s}function $(n,t){const i={};for(const e of n)e.type==="group"?e.apiItemData?.type==="channel"?R(e,i,t):V(e,i,t):e.apiItemData?.type==="channel"&&E(e,i,t);return i}function R(n,t,i){const e=n.label||"Channel";if(u(p(n),i)&&(t[e]||(t[e]=[]),t[e].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[e].push(s)}function V(n,t,i){if(n.items){const e=$(n.items,i);for(const[s,o]of Object.entries(e))t[s]||(t[s]=[]),t[s].push(...o)}}function E(n,t,i){const e=n.label||"Channel";if(u(p(n),i)&&(t[e]||(t[e]=[]),t[e].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&u(p(s),i)&&t[e].push(s)}function F(n,t){const{apiItemData:i,type:e}=n;return i?.type?w(i,t):e==="link"?_(t):null}function w(n,t){switch(n.type){case"channel":return t.channels?.[n.id]||null;case"operation":return t.operations?.[n.id]||null;default:return null}}function _(n){return{description:n.info?.description||"",title:n.info?.title||"",summary:""}}function q(n,t,i){const e=u(p(n),t);if(n.apiItemData?.type==="operation"&&i){const s=u(p(i),t);return e&&s}return e}function p(n){return{slug:n.link||"",[y]:n[y]}}export{W as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{promiseMapLimit as u}from"../../../utils/async/promise-map-limit.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{envConfig as r}from"../../../../config/env-config.js";import{CatalogEntitiesLocalRepository as w}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as p}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as l}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as d}from"./mappers/field-transformations.js";import{hasOptionsChanged as m}from"../utils/has-options-changed.js";const h=15;class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([w.getInstance(t),t.runOnlyLocalDatabase?null:p.getInstance(t)]),i=new n(e,a);a&&(r.isDevelopMode&&c.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=r.isDevelopMode),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||m(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityById(t,e){return await this.#e?.sync(),await this.#t.getEntityById(t,e)}async getEntityKeysAndVersionsBySourceFile(t){return await this.#e?.sync(),this.#t.getEntityKeysAndVersionsBySourceFile(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");return this.#e?this.#e.createEntity(t):(c.warn("No remote database found"),null)}async createEntities(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");const e=this.#e;return e?await u(t,h,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(c.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){return this.#t.createEntity(t)}async createEntitiesInLocalDatabase(t){await this.#t.createEntities(t)}async createEntityRelationInLocalDatabase(t){await this.#t.createEntityRelation(t)}async createEntityRelationsInLocalDatabase(t){await this.#t.createEntityRelations(t)}async updateEntity(t,e){if(r.isDevelopMode)throw new Error("Entity update is not supported in the develop mode");return await this.#e?.updateEntity(t,e)}async deleteEntity(t){if(r.isDevelopMode)throw new Error("Entity deletion is not supported in the develop mode");return await this.#e?.deleteEntity(t)}async deleteEntitiesInLocalDatabase(t){await this.#t.deleteEntities(t)}async getEntityRelationById(t){return await this.#e?.sync(),await this.#t.getEntityRelationById(t)}async getEntitiesRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesRelations(t);return l({data:e,params:t,totalCount:a,nameTransformationsFromDatabase:d,hasMore:i})}async createEntityRelation(t){return this.#e?.createEntityRelation(t)}async createEntitiesRelations(t){const e=this.#e;return e?await u(t,h,async a=>e.createEntityRelation(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.sourceKey,status:"error",error:i}))):(c.warn("No remote database found"),[])}async updateEntityRelation(t,e){const a={...e,...t,type:t.type??e.type};return this.#e?.createEntityRelation(a)}async deleteEntityRelation(t){let e=await this.#e?.deleteEntityRelation(t);return e||(e=await this.#t.deleteEntityRelation(t)),e}async deleteEntityRelationsInLocalDatabase(t){await this.#t.deleteEntityRelations(t)}async getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){return this.#t.getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s})}async getRelatedEntities({entityKey:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){await this.#e?.sync();const{items:o,total:y,hasMore:E}=await this.#t.getRelatedEntities({key:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s});return l({data:o,params:e,totalCount:y,nameTransformationsFromDatabase:d,hasMore:E})}async softDeleteEntitiesInLocalDatabase({filter:t,revision:e,fileHash:a}){await this.#t.softDeleteEntities({filter:t,revision:e,fileHash:a})}async listEntityRevisions(t,e){return await this.#e?.sync(),this.#t.listEntityRevisions(t,e)}async updateEntityScorecardsStatus(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatus(t,e)}async updateEntityScorecardsStatusIfCalculating(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatusIfCalculating(t,e)}async getOutdatedEntities(t){return await this.#e?.sync(),this.#t.getOutdatedEntities(t)}async setEntitiesAsOutdated(t){await this.#e?.sync(),await this.#t.setEntitiesAsOutdated(t)}}export{n as CatalogEntitiesService};
1
+ import{promiseMapLimit as u}from"../../../utils/async/promise-map-limit.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{envConfig as r}from"../../../config/env-config.js";import{CatalogEntitiesLocalRepository as w}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as p}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as l}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as d}from"./mappers/field-transformations.js";import{hasOptionsChanged as m}from"../utils/has-options-changed.js";const h=15;class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([w.getInstance(t),t.runOnlyLocalDatabase?null:p.getInstance(t)]),i=new n(e,a);a&&(r.isDevelopMode&&c.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=r.isDevelopMode),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||m(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntities({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityById(t,e){return await this.#e?.sync(),await this.#t.getEntityById(t,e)}async getEntityKeysAndVersionsBySourceFile(t){return await this.#e?.sync(),this.#t.getEntityKeysAndVersionsBySourceFile(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");return this.#e?this.#e.createEntity(t):(c.warn("No remote database found"),null)}async createEntities(t){if(r.isDevelopMode)throw new Error("Entity creation is not supported in the develop mode");const e=this.#e;return e?await u(t,h,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(c.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){return this.#t.createEntity(t)}async createEntitiesInLocalDatabase(t){await this.#t.createEntities(t)}async createEntityRelationInLocalDatabase(t){await this.#t.createEntityRelation(t)}async createEntityRelationsInLocalDatabase(t){await this.#t.createEntityRelations(t)}async updateEntity(t,e){if(r.isDevelopMode)throw new Error("Entity update is not supported in the develop mode");return await this.#e?.updateEntity(t,e)}async deleteEntity(t){if(r.isDevelopMode)throw new Error("Entity deletion is not supported in the develop mode");return await this.#e?.deleteEntity(t)}async deleteEntitiesInLocalDatabase(t){await this.#t.deleteEntities(t)}async getEntityRelationById(t){return await this.#e?.sync(),await this.#t.getEntityRelationById(t)}async getEntitiesRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesRelations(t);return l({data:e,params:t,totalCount:a,nameTransformationsFromDatabase:d,hasMore:i})}async createEntityRelation(t){return this.#e?.createEntityRelation(t)}async createEntitiesRelations(t){const e=this.#e;return e?await u(t,h,async a=>e.createEntityRelation(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.sourceKey,status:"error",error:i}))):(c.warn("No remote database found"),[])}async updateEntityRelation(t,e){const a={...e,...t,type:t.type??e.type};return this.#e?.createEntityRelation(a)}async deleteEntityRelation(t){let e=await this.#e?.deleteEntityRelation(t);return e||(e=await this.#t.deleteEntityRelation(t)),e}async deleteEntityRelationsInLocalDatabase(t){await this.#t.deleteEntityRelations(t)}async getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i}){await this.#e?.sync();const{items:s,total:o,hasMore:y}=await this.#t.getEntitiesWithRelations({paginationParams:t,rbacTeams:e,excludedTypes:a,excludedEntities:i});return l({data:s,params:t,totalCount:o,hasMore:y})}async getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){return this.#t.getEntityWithRelationsByKey({entityKey:t,filter:e,rbacTeams:a,excludedTypes:i,excludedEntities:s})}async getRelatedEntities({entityKey:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s}){await this.#e?.sync();const{items:o,total:y,hasMore:E}=await this.#t.getRelatedEntities({key:t,paginationParams:e,rbacTeams:a,excludedTypes:i,excludedEntities:s});return l({data:o,params:e,totalCount:y,nameTransformationsFromDatabase:d,hasMore:E})}async softDeleteEntitiesInLocalDatabase({filter:t,revision:e,fileHash:a}){await this.#t.softDeleteEntities({filter:t,revision:e,fileHash:a})}async listEntityRevisions(t,e){return await this.#e?.sync(),this.#t.listEntityRevisions(t,e)}async updateEntityScorecardsStatus(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatus(t,e)}async updateEntityScorecardsStatusIfCalculating(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatusIfCalculating(t,e)}async getOutdatedEntities(t){return await this.#e?.sync(),this.#t.getOutdatedEntities(t)}async setEntitiesAsOutdated(t){await this.#e?.sync(),await this.#t.setEntitiesAsOutdated(t)}}export{n as CatalogEntitiesService};
@@ -1 +1 @@
1
- import{and as m,eq as c,isNull as v,or as T,sql as F}from"drizzle-orm";import{logger as u}from"../../../../../tools/notifiers/logger.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{sha1 as O}from"../../../../../utils/crypto/sha1.js";import{envConfig as V}from"../../../../../../config/env-config.js";import{VERSION_NOT_SPECIFIED as U}from"@redocly/theme/core/constants";import{entitiesAttributesTable as I}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-attributes-table.js";import{createEntityDbRecord as b}from"../../mappers/create-entity-db-record.js";import{createEntityRelationDbRecordFromFileSchema as K}from"../../mappers/create-entity-relation-db-record-from-file-schema.js";import{entitiesTable as r}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-table.js";import{entitiesRelationsTable as i}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js";import{convertFilterToWhereCondition as C}from"../../../../../providers/database/pagination/filter.js";import{createEntityAttributesDbRecord as z}from"../../mappers/create-entity-attributes-db-record.js";import{RevisionRepository as L}from"../common/revision-repository.js";import{VersionRepository as P}from"../common/version-repository.js";const w=15;class re{#e;#t;#r;#i;#s;constructor(e,t,s){this.#e=e,this.#t=t,this.#r=s,this.#i=new L(e),this.#s=new P(e)}async createEntity({entity:e,fileHash:t,sourceFile:s,revision:a=new Date().toISOString(),isRootEntity:o=!1,isDeleted:n=!1,rbacTeams:d}){try{const{relations:l=[],...f}=e,p=O(JSON.stringify(f)),y=e.version??U,g=await this.#i.shouldSkipRevisionCreation(e.key,y,p,o,n);if(Array.isArray(d)&&await this.#o({entityKey:e.key,rbacTeams:d}),g)return{result:"skipped",entityKey:e.key};const h=await this.#i.shouldSetNewCurrentRevision({key:e.key,version:y,revision:a}),R=b({entity:{...e,revision:a,hash:p,isCurrent:h,isDefaultVersion:h,isDeleted:n,version:y},sourceFile:s,organizationId:this.#t,projectId:this.#r,source:"file",fileHash:t}),{key:D,source:x,...S}=R;if(h&&(await this.#i.markAllRevisionsAsNotCurrent(D),await this.#s.markAllVersionsAsNotDefault(D)),V.isDevelopMode&&V.REDOCLY_INTERNAL_DEV!=="true")return await this.#n(R,l),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y};const A=this.#e.client.insert(r).values(R).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:S}),N=l?.length&&l.length>0?this.#e.client.insert(i).values(l.map(k=>K({relation:k,sourceFile:s,fileHash:t,sourceKey:e.key,sourceVersion:y,sourceRevision:a??null,organizationId:this.#t,projectId:this.#r}))).onConflictDoNothing({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation]}).run():Promise.resolve();return await E([A,N],w,async k=>k),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y}}catch(l){return u.error("Error adding entity",l),{result:"error",entityKey:e.key}}}async deleteEntity(e){try{return await this.#e.client.delete(r).where(c(r.key,e)),e}catch(t){return u.error("Error deleting entity",t),null}}async deleteEntities(e){try{const t=C(e);if(!t)return!1;const s=await this.#e.client.delete(r).where(t).returning({key:r.key,source:r.source,isCurrent:r.isCurrent,isDefaultVersion:r.isDefaultVersion,version:r.version});if(s.length===0)return!0;const a=s.reduce((o,n)=>((n.isCurrent||n.isDefaultVersion)&&o.add(n.key),o),new Set);if(a.size===0)return!0;await E(Array.from(a),w,async o=>this.#i.ensureDefaultAndCurrentRevisionForKey(o));for(const o of s)await this.#e.client.delete(i).where(T(m(c(i.sourceKey,o.key),...o.version?[c(i.sourceVersion,o.version)]:[v(i.sourceVersion)]),m(c(i.targetKey,o.key),...o.version?[c(i.targetVersion,o.version)]:[v(i.targetVersion)])));return!0}catch(t){return u.error("Error deleting entities",t),!1}}async deleteEntityRelation(e){try{return await this.#e.client.delete(i).where(c(i.id,e)),e}catch{return null}}async softDeleteEntities(e,t,s){try{const a=e.map(n=>{const d={type:n.type,key:n.key,title:n.title,summary:n.summary??void 0,tags:n.tags??void 0,metadata:n.metadata??void 0,git:n.git??void 0,contact:n.contact??void 0,links:n.links??void 0,version:n.version??void 0};return this.createEntity({entity:d,revision:t,sourceFile:n.sourceFile??"",fileHash:s,isDeleted:!0})});return await E(a,w,async n=>n)}catch(a){return u.error("Error soft deleting entities",a),[]}}async deleteEntityRelations(e){try{const t=C(e);return t?(await this.#e.client.delete(i).where(t),!0):!1}catch(t){return u.error("Error deleting entity relations",t),!1}}async upsertEntityRelation(e){if(!e)return null;try{const{sourceKey:t,targetKey:s,sourceVersion:a,targetVersion:o,sourceRevision:n,targetRevision:d,...l}=e,f=await this.#e.client.insert(i).values(e).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:l}).returning();return f?.length?f[0]:null}catch(t){return u.error("Error creating entity relation",t),null}}async#n(e,t){const{key:s,source:a,version:o,isDefaultVersion:n,...d}=e,p=(await this.#e.client.select({id:r.id}).from(r).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).limit(1).run()).rows.length>0?this.#e.client.update(r).set(d).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).run():this.#e.client.insert(r).values(e).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:d}).run(),y=t?.map(g=>{const h=K({relation:g,sourceFile:e.sourceFile??"",fileHash:e.fileHash??"",sourceKey:e.key,sourceVersion:e.version??null,sourceRevision:e.revision??null,organizationId:this.#t,projectId:this.#r});return this.#e.client.insert(i).values(h).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:h}).run()})??[];await E([p,...y],w,async g=>g)}async updateEntityScorecardsStatus(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(c(r.id,e)).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status",s),!1}}async updateEntityScorecardsStatusIfCalculating(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(F`${r.id} = ${e} AND ${r.scorecardsStatus} = 'CALCULATING'`).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status if calculating",s),!1}}async#o({entityKey:e,rbacTeams:t}){try{await this.#e.client.insert(I).values(z({rbacTeams:t,entityKey:e,organizationId:this.#t,projectId:this.#r})).onConflictDoUpdate({target:[I.entityKey],set:{rbacTeams:JSON.stringify(t)}}).run()}catch(s){u.error("Error saving entity attributes",s)}}async setEntitiesAsOutdated(e){try{const t=C(e);await this.#e.client.update(r).set({scorecardsStatus:"OUTDATED"}).where(t)}catch(t){u.error("Error updating entities as outdated",t)}}}export{re as CatalogEntitiesLocalWriteRepository};
1
+ import{and as m,eq as c,isNull as v,or as T,sql as F}from"drizzle-orm";import{logger as u}from"../../../../../tools/notifiers/logger.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{sha1 as O}from"../../../../../utils/crypto/sha1.js";import{envConfig as V}from"../../../../../config/env-config.js";import{VERSION_NOT_SPECIFIED as U}from"@redocly/theme/core/constants";import{entitiesAttributesTable as I}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-attributes-table.js";import{createEntityDbRecord as b}from"../../mappers/create-entity-db-record.js";import{createEntityRelationDbRecordFromFileSchema as K}from"../../mappers/create-entity-relation-db-record-from-file-schema.js";import{entitiesTable as r}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-table.js";import{entitiesRelationsTable as i}from"../../../../../providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js";import{convertFilterToWhereCondition as C}from"../../../../../providers/database/pagination/filter.js";import{createEntityAttributesDbRecord as z}from"../../mappers/create-entity-attributes-db-record.js";import{RevisionRepository as L}from"../common/revision-repository.js";import{VersionRepository as P}from"../common/version-repository.js";const w=15;class re{#e;#t;#r;#i;#s;constructor(e,t,s){this.#e=e,this.#t=t,this.#r=s,this.#i=new L(e),this.#s=new P(e)}async createEntity({entity:e,fileHash:t,sourceFile:s,revision:a=new Date().toISOString(),isRootEntity:o=!1,isDeleted:n=!1,rbacTeams:d}){try{const{relations:l=[],...f}=e,p=O(JSON.stringify(f)),y=e.version??U,g=await this.#i.shouldSkipRevisionCreation(e.key,y,p,o,n);if(Array.isArray(d)&&await this.#o({entityKey:e.key,rbacTeams:d}),g)return{result:"skipped",entityKey:e.key};const h=await this.#i.shouldSetNewCurrentRevision({key:e.key,version:y,revision:a}),R=b({entity:{...e,revision:a,hash:p,isCurrent:h,isDefaultVersion:h,isDeleted:n,version:y},sourceFile:s,organizationId:this.#t,projectId:this.#r,source:"file",fileHash:t}),{key:D,source:x,...S}=R;if(h&&(await this.#i.markAllRevisionsAsNotCurrent(D),await this.#s.markAllVersionsAsNotDefault(D)),V.isDevelopMode&&V.REDOCLY_INTERNAL_DEV!=="true")return await this.#n(R,l),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y};const A=this.#e.client.insert(r).values(R).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:S}),N=l?.length&&l.length>0?this.#e.client.insert(i).values(l.map(k=>K({relation:k,sourceFile:s,fileHash:t,sourceKey:e.key,sourceVersion:y,sourceRevision:a??null,organizationId:this.#t,projectId:this.#r}))).onConflictDoNothing({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation]}).run():Promise.resolve();return await E([A,N],w,async k=>k),{result:"created",entityKey:e.key,entityRevision:a,entityVersion:y}}catch(l){return u.error("Error adding entity",l),{result:"error",entityKey:e.key}}}async deleteEntity(e){try{return await this.#e.client.delete(r).where(c(r.key,e)),e}catch(t){return u.error("Error deleting entity",t),null}}async deleteEntities(e){try{const t=C(e);if(!t)return!1;const s=await this.#e.client.delete(r).where(t).returning({key:r.key,source:r.source,isCurrent:r.isCurrent,isDefaultVersion:r.isDefaultVersion,version:r.version});if(s.length===0)return!0;const a=s.reduce((o,n)=>((n.isCurrent||n.isDefaultVersion)&&o.add(n.key),o),new Set);if(a.size===0)return!0;await E(Array.from(a),w,async o=>this.#i.ensureDefaultAndCurrentRevisionForKey(o));for(const o of s)await this.#e.client.delete(i).where(T(m(c(i.sourceKey,o.key),...o.version?[c(i.sourceVersion,o.version)]:[v(i.sourceVersion)]),m(c(i.targetKey,o.key),...o.version?[c(i.targetVersion,o.version)]:[v(i.targetVersion)])));return!0}catch(t){return u.error("Error deleting entities",t),!1}}async deleteEntityRelation(e){try{return await this.#e.client.delete(i).where(c(i.id,e)),e}catch{return null}}async softDeleteEntities(e,t,s){try{const a=e.map(n=>{const d={type:n.type,key:n.key,title:n.title,summary:n.summary??void 0,tags:n.tags??void 0,metadata:n.metadata??void 0,git:n.git??void 0,contact:n.contact??void 0,links:n.links??void 0,version:n.version??void 0};return this.createEntity({entity:d,revision:t,sourceFile:n.sourceFile??"",fileHash:s,isDeleted:!0})});return await E(a,w,async n=>n)}catch(a){return u.error("Error soft deleting entities",a),[]}}async deleteEntityRelations(e){try{const t=C(e);return t?(await this.#e.client.delete(i).where(t),!0):!1}catch(t){return u.error("Error deleting entity relations",t),!1}}async upsertEntityRelation(e){if(!e)return null;try{const{sourceKey:t,targetKey:s,sourceVersion:a,targetVersion:o,sourceRevision:n,targetRevision:d,...l}=e,f=await this.#e.client.insert(i).values(e).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:l}).returning();return f?.length?f[0]:null}catch(t){return u.error("Error creating entity relation",t),null}}async#n(e,t){const{key:s,source:a,version:o,isDefaultVersion:n,...d}=e,p=(await this.#e.client.select({id:r.id}).from(r).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).limit(1).run()).rows.length>0?this.#e.client.update(r).set(d).where(m(c(r.key,s),c(r.source,a??"file"),o?c(r.version,o):v(r.version))).run():this.#e.client.insert(r).values(e).onConflictDoUpdate({target:[r.key,r.source,r.revision,r.version],set:d}).run(),y=t?.map(g=>{const h=K({relation:g,sourceFile:e.sourceFile??"",fileHash:e.fileHash??"",sourceKey:e.key,sourceVersion:e.version??null,sourceRevision:e.revision??null,organizationId:this.#t,projectId:this.#r});return this.#e.client.insert(i).values(h).onConflictDoUpdate({target:[i.sourceKey,i.targetKey,i.sourceVersion,i.targetVersion,i.sourceRevision,i.targetRevision,i.sourceToTargetRelation],set:h}).run()})??[];await E([p,...y],w,async g=>g)}async updateEntityScorecardsStatus(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(c(r.id,e)).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status",s),!1}}async updateEntityScorecardsStatusIfCalculating(e,t){try{return(await this.#e.client.update(r).set({scorecardsStatus:t}).where(F`${r.id} = ${e} AND ${r.scorecardsStatus} = 'CALCULATING'`).returning()).length>0}catch(s){return u.error("Error updating entity scorecards status if calculating",s),!1}}async#o({entityKey:e,rbacTeams:t}){try{await this.#e.client.insert(I).values(z({rbacTeams:t,entityKey:e,organizationId:this.#t,projectId:this.#r})).onConflictDoUpdate({target:[I.entityKey],set:{rbacTeams:JSON.stringify(t)}}).run()}catch(s){u.error("Error saving entity attributes",s)}}async setEntitiesAsOutdated(e){try{const t=C(e);await this.#e.client.update(r).set({scorecardsStatus:"OUTDATED"}).where(t)}catch(t){u.error("Error updating entities as outdated",t)}}}export{re as CatalogEntitiesLocalWriteRepository};
@@ -1 +1 @@
1
- import{entityRelationFileSchema as g}from"@redocly/config";import{FileHashStatus as c}from"../../../../../persistence/file-hashes/types.js";import{promiseMapLimit as m}from"../../../../../utils/async/promise-map-limit.js";import{OPERATORS as u}from"../../../../../providers/database/pagination/constants.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{getRbacTeamsListForResource as v}from"../../../../../utils/rbac.js";import{envConfig as h}from"../../../../../../config/env-config.js";import{resolveEntityVersion as y}from"../../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../../utils/catalog-data-collector.js";import{createValidator as d}from"../../../utils/ajv-validator.js";const R=3;class x{type="api-description";specType;fileType;actions;context;catalogEntitiesService;fileHashManager;entitySources={};#e;constructor(t,e){this.specType=t,this.fileType=e.fileType,this.actions=e.actions,this.context=e.context,this.catalogEntitiesService=e.catalogEntitiesService,this.fileHashManager=e.fileHashManager,this.#e=e.shouldCalculateEntities??!1}async extract(){const t=await this.loadApiDescriptions();await this.fileHashManager.markAllAsOutdated(this.fileType),t.length&&f.addExtractor(this.specType),await m(t,R,async e=>{try{if(e.isVirtual||!e.hash)return;if(!((await this.fileHashManager.getByPath(e.realRelativePath))?.hash!==e.hash||this.#e||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE);return}const a=await this.catalogEntitiesService.getEntityKeysAndVersionsBySourceFile(e.realRelativePath);h.FORCE_CATALOG_CACHE_REVALIDATE==="true"&&(await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:Array.from(a).map(o=>o.split(":")[0])}),a.clear());const s=new Date().toISOString(),n=this.#a(e);await this.processApiDescription(e,s,n,a),await this.#i(a,e.realRelativePath,s,e.hash),f.increaseProcessedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE)}catch(i){this.context.logger.warn(`Error extracting entities from ${this.specType} description: ${e.realRelativePath}`),this.context.logger.warn(i)}}),await this.#t()}#t=async()=>{const t=await this.fileHashManager.getAllOutdated(this.fileType);if(!t||t.length===0)return;const e=await this.catalogEntitiesService.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:t.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});e&&e.items.length>0&&await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:e.items.map(({key:i})=>i)}),await this.fileHashManager.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:this.fileType},{field:"status",operator:"equal",value:c.OUTDATED}]})};#i=async(t,e,i,r)=>{if(t.size===0||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")return;const a=Array.from(t).map(o=>{const[l,E]=o.split(":");return{key:l,version:E}}),s=Array.from(new Set(a.map(({key:o})=>o))),n=a.map(({key:o,version:l})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:o},{field:"version",operator:"equal",value:l}]}));await this.catalogEntitiesService.softDeleteEntitiesInLocalDatabase({revision:i,fileHash:r,filter:{op:"AND",conditions:[{field:"key",operator:"in",value:s},{op:u.OR,conditions:n},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:e}]}})};#a(t){const e=t.document?.info?.version??t.definition?.info?.version??null,i=y(e,t.realRelativePath);return i.success?i.version??p:p}validateEntityRelationFileSchema(t){d(g,{errorPrefix:"Entity relation validation failed:",dataVar:"relation"})(t)}getRbacTeamsForDefinition(t){const e=this.actions.getConfig().rbac,i=this.actions.getRouteByFsPath(t);return v(i||{fsPath:t},e||{})}}export{x as BaseApiEntitiesExtractor};
1
+ import{entityRelationFileSchema as g}from"@redocly/config";import{FileHashStatus as c}from"../../../../../persistence/file-hashes/types.js";import{promiseMapLimit as m}from"../../../../../utils/async/promise-map-limit.js";import{OPERATORS as u}from"../../../../../providers/database/pagination/constants.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{getRbacTeamsListForResource as v}from"../../../../../utils/rbac.js";import{envConfig as h}from"../../../../../config/env-config.js";import{resolveEntityVersion as y}from"../../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../../utils/catalog-data-collector.js";import{createValidator as d}from"../../../utils/ajv-validator.js";const R=3;class x{type="api-description";specType;fileType;actions;context;catalogEntitiesService;fileHashManager;entitySources={};#e;constructor(t,e){this.specType=t,this.fileType=e.fileType,this.actions=e.actions,this.context=e.context,this.catalogEntitiesService=e.catalogEntitiesService,this.fileHashManager=e.fileHashManager,this.#e=e.shouldCalculateEntities??!1}async extract(){const t=await this.loadApiDescriptions();await this.fileHashManager.markAllAsOutdated(this.fileType),t.length&&f.addExtractor(this.specType),await m(t,R,async e=>{try{if(e.isVirtual||!e.hash)return;if(!((await this.fileHashManager.getByPath(e.realRelativePath))?.hash!==e.hash||this.#e||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE);return}const a=await this.catalogEntitiesService.getEntityKeysAndVersionsBySourceFile(e.realRelativePath);h.FORCE_CATALOG_CACHE_REVALIDATE==="true"&&(await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:Array.from(a).map(o=>o.split(":")[0])}),a.clear());const s=new Date().toISOString(),n=this.#a(e);await this.processApiDescription(e,s,n,a),await this.#i(a,e.realRelativePath,s,e.hash),f.increaseProcessedFilesCount(),await this.fileHashManager.upsert(this.fileType,e.realRelativePath,e.hash,c.UP_TO_DATE)}catch(i){this.context.logger.warn(`Error extracting entities from ${this.specType} description: ${e.realRelativePath}`),this.context.logger.warn(i)}}),await this.#t()}#t=async()=>{const t=await this.fileHashManager.getAllOutdated(this.fileType);if(!t||t.length===0)return;const e=await this.catalogEntitiesService.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:t.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});e&&e.items.length>0&&await this.catalogEntitiesService.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:e.items.map(({key:i})=>i)}),await this.fileHashManager.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:this.fileType},{field:"status",operator:"equal",value:c.OUTDATED}]})};#i=async(t,e,i,r)=>{if(t.size===0||h.FORCE_CATALOG_CACHE_REVALIDATE==="true")return;const a=Array.from(t).map(o=>{const[l,E]=o.split(":");return{key:l,version:E}}),s=Array.from(new Set(a.map(({key:o})=>o))),n=a.map(({key:o,version:l})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:o},{field:"version",operator:"equal",value:l}]}));await this.catalogEntitiesService.softDeleteEntitiesInLocalDatabase({revision:i,fileHash:r,filter:{op:"AND",conditions:[{field:"key",operator:"in",value:s},{op:u.OR,conditions:n},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:e}]}})};#a(t){const e=t.document?.info?.version??t.definition?.info?.version??null,i=y(e,t.realRelativePath);return i.success?i.version??p:p}validateEntityRelationFileSchema(t){d(g,{errorPrefix:"Entity relation validation failed:",dataVar:"relation"})(t)}getRbacTeamsForDefinition(t){const e=this.actions.getConfig().rbac,i=this.actions.getRouteByFsPath(t);return v(i||{fsPath:t},e||{})}}export{x as BaseApiEntitiesExtractor};
@@ -1 +1 @@
1
- import{CATALOG_ENTITIES_FILES_REGEX as E,ENTITY_SCHEMA_EXCLUDED_FOLDERS as d}from"../../../../constants/plugins/catalog-entities.js";import{FileHashStatus as l,FileType as a}from"../../../../persistence/file-hashes/types.js";import{OPERATORS as u}from"../../../../providers/database/pagination/constants.js";import{promiseMapLimit as m}from"../../../../utils/async/promise-map-limit.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{parseEntities as h}from"../../../../web-server/routes/catalog/parsers/entities/parse-entities.js";import{envConfig as g}from"../../../../../config/env-config.js";import{extractFileContent as y}from"../../entities/extract-file-content.js";import{resolveEntityVersion as I}from"../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../utils/catalog-data-collector.js";const T=15;class ${#t;#e;#i;#r;#s;constructor({fileHashManager:e,context:t,catalogEntitiesService:i,catalogConfig:o,shouldCalculateEntities:s}){this.#t=e,this.#e=t,this.#i=i,this.#r=o,this.#s=s}async extract(e){try{if(e&&this.#o(e)){await this.#n(e);return}await this.#t.markAllAsOutdated(a.ENTITY_DEFINITION);const i=this.#e.fs.scan(E).filter(({relativePath:o})=>this.#o(o));i.length&&f.addExtractor("fs"),await m(i,T,async({relativePath:o})=>{await this.#n(o)}),await this.#f()}catch(t){this.#e.logger.error("Error extracting entities.",t)}}#o=e=>!!(e.match(E)&&!d.some(t=>e.includes(t)));#n=async e=>{try{const t=await y(e,this.#e);if(!t){this.#e.logger.warn(`Error extracting content from ${e}.`);return}const i=await this.#t.computeFileHash(t);if(!((await this.#t.getByPath(e))?.hash!==i||this.#s||g.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE);return}const r=this.#a(t.entities,e);if(!r)return;const n=await this.#i.getEntityKeysAndVersionsBySourceFile(e);await this.#c(r,e,i,n),await this.#l(n,e),f.increaseProcessedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE)}catch(t){this.#e.logger.warn(`Error processing file "${e}". ${t instanceof Error?t.message:String(t)}.`)}};#a=(e,t)=>{try{return h(e,this.#r)}catch(i){return this.#e.logger.warn(`Error validating entities in "${t}". ${i instanceof Error?i.message:String(i)}.`),null}};#c=async(e,t,i,o)=>{for(const s of e)try{const r=I(s.version,t);if(!r.success){this.#e.logger.warn(`Entity "${s.key}" in file "${t}" has conflicting versions: file version "${r.fileVersion}" differs from folder version "${r.folderVersion}". Entity will not be created.`);continue}const n={...s,version:r.version};if(await this.#i.createEntityInLocalDatabase({entity:n,sourceFile:t,fileHash:i}),s.key){const c=r.version??p;o.delete(`${s.key}:${c}`)}}catch(r){const n=s.key??"unknown";this.#e.logger.warn(`Error processing entity "${n}" from "${t}". ${r instanceof Error?r.message:String(r)}.`)}};#l=async(e,t)=>{if(e.size===0)return;const i=Array.from(e).map(r=>{const[n,c]=r.split(":");return{key:n,version:c}}),o=Array.from(new Set(i.map(({key:r})=>r))),s=i.map(({key:r,version:n})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:r},{field:"version",operator:"equal",value:n}]}));await this.#i.deleteEntitiesInLocalDatabase({op:"AND",conditions:[{field:"key",operator:"in",value:o},{op:u.OR,conditions:s},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:t}]})};#f=async()=>{const e=await this.#t.getAllOutdated(a.ENTITY_DEFINITION);if(!e||e.length===0)return;const t=await this.#i.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:e.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});!t||t.items.length===0||(await this.#i.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:t.items.map(({key:i})=>i)}),await this.#t.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:a.ENTITY_DEFINITION},{field:"status",operator:"equal",value:l.OUTDATED}]}))}}export{$ as FsEntitiesExtractor};
1
+ import{CATALOG_ENTITIES_FILES_REGEX as E,ENTITY_SCHEMA_EXCLUDED_FOLDERS as d}from"../../../../constants/plugins/catalog-entities.js";import{FileHashStatus as l,FileType as a}from"../../../../persistence/file-hashes/types.js";import{OPERATORS as u}from"../../../../providers/database/pagination/constants.js";import{promiseMapLimit as m}from"../../../../utils/async/promise-map-limit.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{parseEntities as h}from"../../../../web-server/routes/catalog/parsers/entities/parse-entities.js";import{envConfig as g}from"../../../../config/env-config.js";import{extractFileContent as y}from"../../entities/extract-file-content.js";import{resolveEntityVersion as I}from"../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../utils/catalog-data-collector.js";const T=15;class ${#t;#e;#i;#r;#s;constructor({fileHashManager:e,context:t,catalogEntitiesService:i,catalogConfig:o,shouldCalculateEntities:s}){this.#t=e,this.#e=t,this.#i=i,this.#r=o,this.#s=s}async extract(e){try{if(e&&this.#o(e)){await this.#n(e);return}await this.#t.markAllAsOutdated(a.ENTITY_DEFINITION);const i=this.#e.fs.scan(E).filter(({relativePath:o})=>this.#o(o));i.length&&f.addExtractor("fs"),await m(i,T,async({relativePath:o})=>{await this.#n(o)}),await this.#f()}catch(t){this.#e.logger.error("Error extracting entities.",t)}}#o=e=>!!(e.match(E)&&!d.some(t=>e.includes(t)));#n=async e=>{try{const t=await y(e,this.#e);if(!t){this.#e.logger.warn(`Error extracting content from ${e}.`);return}const i=await this.#t.computeFileHash(t);if(!((await this.#t.getByPath(e))?.hash!==i||this.#s||g.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE);return}const r=this.#a(t.entities,e);if(!r)return;const n=await this.#i.getEntityKeysAndVersionsBySourceFile(e);await this.#c(r,e,i,n),await this.#l(n,e),f.increaseProcessedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE)}catch(t){this.#e.logger.warn(`Error processing file "${e}". ${t instanceof Error?t.message:String(t)}.`)}};#a=(e,t)=>{try{return h(e,this.#r)}catch(i){return this.#e.logger.warn(`Error validating entities in "${t}". ${i instanceof Error?i.message:String(i)}.`),null}};#c=async(e,t,i,o)=>{for(const s of e)try{const r=I(s.version,t);if(!r.success){this.#e.logger.warn(`Entity "${s.key}" in file "${t}" has conflicting versions: file version "${r.fileVersion}" differs from folder version "${r.folderVersion}". Entity will not be created.`);continue}const n={...s,version:r.version};if(await this.#i.createEntityInLocalDatabase({entity:n,sourceFile:t,fileHash:i}),s.key){const c=r.version??p;o.delete(`${s.key}:${c}`)}}catch(r){const n=s.key??"unknown";this.#e.logger.warn(`Error processing entity "${n}" from "${t}". ${r instanceof Error?r.message:String(r)}.`)}};#l=async(e,t)=>{if(e.size===0)return;const i=Array.from(e).map(r=>{const[n,c]=r.split(":");return{key:n,version:c}}),o=Array.from(new Set(i.map(({key:r})=>r))),s=i.map(({key:r,version:n})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:r},{field:"version",operator:"equal",value:n}]}));await this.#i.deleteEntitiesInLocalDatabase({op:"AND",conditions:[{field:"key",operator:"in",value:o},{op:u.OR,conditions:s},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:t}]})};#f=async()=>{const e=await this.#t.getAllOutdated(a.ENTITY_DEFINITION);if(!e||e.length===0)return;const t=await this.#i.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:e.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});!t||t.items.length===0||(await this.#i.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:t.items.map(({key:i})=>i)}),await this.#t.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:a.ENTITY_DEFINITION},{field:"status",operator:"equal",value:l.OUTDATED}]}))}}export{$ as FsEntitiesExtractor};
@@ -1 +1 @@
1
- import{FileType as p}from"../../persistence/file-hashes/types.js";import{envConfig as P}from"../../../config/env-config.js";import{deepEqual as I}from"../../../utils/object/deep-equal.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";import{catalogDataCollector as O}from"./utils/catalog-data-collector.js";import{CATALOG_BASE_SLUG as m,CATALOG_FILTERS_CACHE_NAMESPACE as b,ENTITIES_MAP_GLOBAL_DATA_KEY as _}from"../../constants/plugins/catalog-entities.js";import{CacheService as v}from"../../persistence/cache/services/cache-service.js";import{getTemplatePath as f}from"./utils/get-template-path.js";import{getCompleteCatalogConfig as E}from"./get-complete-catalog-config.js";import{AsyncApiEntitiesExtractor as w}from"./extensions/extractors/api-description/asyncapi-entities-extractor.js";import{GraphqlEntitiesExtractor as R}from"./extensions/extractors/api-description/graphql-entities-extractor.js";import{FileHashesService as N}from"../../persistence/file-hashes/services/file-hashes-service.js";import{CatalogEntitiesService as L}from"./database/catalog-entities-service.js";import{ArazzoEntitiesExtractor as G}from"./extensions/extractors/api-description/arazzo-entities-extractor.js";import{FsEntitiesExtractor as x}from"./extensions/extractors/fs-entities-extractor.js";import{HashManager as F}from"./utils/hash-manager.js";import{OpenApiEntitiesExtractor as H}from"./extensions/extractors/api-description/openapi-entities-extractor.js";const B="catalog-entity-template",M="catalog-entity";let C=!0,d;async function Y(){return{id:"CatalogEntities",requiredEntitlements:["catalog"],async processContent(t,e){const a=await e.getConfig(),r=E(a.entitiesCatalog);if(!r.show)return;const{logger:s}=e,n=t.registerServerPropsGetter(M,f("../get-server-props.js")),g=t.createTemplate(B,f("../template/index.js"));t.addRoute({duplicateInAllLocales:!0,slug:m,fsPath:"",templateId:g,excludeFromSidebar:!0,hasClientRoutes:!0,serverPropsGetterIds:[n],getNavText:()=>Promise.resolve("Catalog"),getStaticData:async()=>({props:{catalogConfig:r}})});const[u]=Object.entries(r.catalogs??{}).find(([o,i])=>!i?.hide)||[];u&&t.addRedirect(m,{type:302,to:`${m}/${u}`}),s.info("Catalog Entities plugin finished")},async afterRoutesCreated(t,e){await D("build.plugin.catalog_entities",async a=>{const r=await e.getConfig(),s=E(r.entitiesCatalog);if(a?.setAttribute("config",JSON.stringify(s)),!s.show)return;const{logger:n}=e,g=C&&P.isDevelopMode,u=!I(d,r.rbac);d=r.rbac;const o=g||u,i=await L.getInstance({baseDbDir:t.serverOutDir,removeExisting:g,runOnlyLocalDatabase:!0,runWithPragmaWalWriteOptimization:!0}),A=await N.getInstance({baseDbDir:t.serverOutDir}),l=new F(A),T=[new x({fileHashManager:l,context:e,catalogEntitiesService:i,catalogConfig:s,shouldCalculateEntities:o}),new H({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.OPENAPI_DESCRIPTION,shouldCalculateEntities:o}),new w({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ASYNCAPI_DESCRIPTION,shouldCalculateEntities:o}),new R({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.GRAPHQL_DESCRIPTION,shouldCalculateEntities:o}),new G({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ARAZZO_DESCRIPTION,shouldCalculateEntities:o})];n.info("Starting entities extractors...");const y=n.startTiming();await i.transaction(async()=>{await Promise.all(T.map(async S=>S.extract()))});const h=i.getEntitySources();t.setGlobalData({[_]:h}),await(await v.getInstance({baseDbDir:t.serverOutDir})).deleteByNamespace(b),n.infoTime(y,"Entities extractors finished");const c=await O.getCatalogEntitiesData(i);a?.setAttribute("totalEntities",c.totalEntitiesCount),a?.setAttribute("entitiesCountByType",JSON.stringify(c.countOfEntitiesByType)),a?.setAttribute("totalFilesSkippedByHash",c.totalFilesSkippedByHash),a?.setAttribute("totalProcessedFiles",c.totalProcessedFiles),a?.setAttribute("extractors",c.extractors),C=!1})}}}var ot=Y;export{Y as catalogEntitiesPlugin,ot as default};
1
+ import{FileType as p}from"../../persistence/file-hashes/types.js";import{envConfig as P}from"../../config/env-config.js";import{deepEqual as I}from"../../../utils/object/deep-equal.js";import{CATALOG_BASE_SLUG as u}from"../../../constants/catalog-entities.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";import{catalogDataCollector as O}from"./utils/catalog-data-collector.js";import{CATALOG_FILTERS_CACHE_NAMESPACE as b,ENTITIES_MAP_GLOBAL_DATA_KEY as _}from"../../constants/plugins/catalog-entities.js";import{CacheService as v}from"../../persistence/cache/services/cache-service.js";import{getTemplatePath as f}from"./utils/get-template-path.js";import{getCompleteCatalogConfig as E}from"./get-complete-catalog-config.js";import{AsyncApiEntitiesExtractor as w}from"./extensions/extractors/api-description/asyncapi-entities-extractor.js";import{GraphqlEntitiesExtractor as R}from"./extensions/extractors/api-description/graphql-entities-extractor.js";import{FileHashesService as N}from"../../persistence/file-hashes/services/file-hashes-service.js";import{CatalogEntitiesService as L}from"./database/catalog-entities-service.js";import{ArazzoEntitiesExtractor as G}from"./extensions/extractors/api-description/arazzo-entities-extractor.js";import{FsEntitiesExtractor as x}from"./extensions/extractors/fs-entities-extractor.js";import{HashManager as F}from"./utils/hash-manager.js";import{OpenApiEntitiesExtractor as H}from"./extensions/extractors/api-description/openapi-entities-extractor.js";const B="catalog-entity-template",M="catalog-entity";let C=!0,d;async function Y(){return{id:"CatalogEntities",requiredEntitlements:["catalog"],async processContent(t,e){const a=await e.getConfig(),r=E(a.entitiesCatalog);if(!r.show)return;const{logger:s}=e,n=t.registerServerPropsGetter(M,f("../get-server-props.js")),g=t.createTemplate(B,f("../template/index.js"));t.addRoute({duplicateInAllLocales:!0,slug:u,fsPath:"",templateId:g,excludeFromSidebar:!0,hasClientRoutes:!0,serverPropsGetterIds:[n],getNavText:()=>Promise.resolve("Catalog"),getStaticData:async()=>({props:{catalogConfig:r}})});const[m]=Object.entries(r.catalogs??{}).find(([o,i])=>!i?.hide)||[];m&&t.addRedirect(u,{type:302,to:`${u}/${m}`}),s.info("Catalog Entities plugin finished")},async afterRoutesCreated(t,e){await D("build.plugin.catalog_entities",async a=>{const r=await e.getConfig(),s=E(r.entitiesCatalog);if(a?.setAttribute("config",JSON.stringify(s)),!s.show)return;const{logger:n}=e,g=C&&P.isDevelopMode,m=!I(d,r.rbac);d=r.rbac;const o=g||m,i=await L.getInstance({baseDbDir:t.serverOutDir,removeExisting:g,runOnlyLocalDatabase:!0,runWithPragmaWalWriteOptimization:!0}),A=await N.getInstance({baseDbDir:t.serverOutDir}),l=new F(A),T=[new x({fileHashManager:l,context:e,catalogEntitiesService:i,catalogConfig:s,shouldCalculateEntities:o}),new H({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.OPENAPI_DESCRIPTION,shouldCalculateEntities:o}),new w({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ASYNCAPI_DESCRIPTION,shouldCalculateEntities:o}),new R({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.GRAPHQL_DESCRIPTION,shouldCalculateEntities:o}),new G({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ARAZZO_DESCRIPTION,shouldCalculateEntities:o})];n.info("Starting entities extractors...");const y=n.startTiming();await i.transaction(async()=>{await Promise.all(T.map(async S=>S.extract()))});const h=i.getEntitySources();t.setGlobalData({[_]:h}),await(await v.getInstance({baseDbDir:t.serverOutDir})).deleteByNamespace(b),n.infoTime(y,"Entities extractors finished");const c=await O.getCatalogEntitiesData(i);a?.setAttribute("totalEntities",c.totalEntitiesCount),a?.setAttribute("entitiesCountByType",JSON.stringify(c.countOfEntitiesByType)),a?.setAttribute("totalFilesSkippedByHash",c.totalFilesSkippedByHash),a?.setAttribute("totalProcessedFiles",c.totalProcessedFiles),a?.setAttribute("extractors",c.extractors),C=!1})}}}var st=Y;export{Y as catalogEntitiesPlugin,st as default};
@@ -1 +1 @@
1
- import{redocConfigSchema as m,rootRedoclyConfigSchema as t}from"@redocly/config";import p from"is-glob";import{I18N_DIR_NAME as d,L10N_DIR_NAME as u}from"../../../constants/common.js";import{CONFIG_FILE_NAME as f}from"../../../../constants/common.js";import{DEFAULT_SEARCH_ENGINE as A}from"../../../constants/plugins/search.js";import{deepMerge as F}from"../../../../utils/object/deep-merge.js";import{logger as b}from"../../../tools/notifiers/logger.js";import{EntitlementsProvider as C}from"../../../entitlements/entitlements-provider.js";import{readAndValidateConfig as h}from"./utils/read-and-validate-config.js";import{resolvePlugins as v}from"../../../config/external-plugins.js";import{getPathForAllLocales as l}from"../../../fs/utils/get-path-for-all-locales.js";import{parseRbacConfig as y}from"../../../utils/rbac.js";import{RbacConfigLocation as g,validateRbacConfig as S}from"../../validate-rbac-config.js";const z=async(e,{fs:r},a)=>{const n=await h(e,r,a,async c=>e===f?E(r.cwd,c?.plugins||[]):void 0);n?.rbac&&(n.rbac=await y(n.rbac),S(n.rbac,e===f?g.RootRedoclyYaml:void 0)),(n?.l10n||n?.i18n)&&(n.l10n=L(n),n.i18n=void 0);const s=F(n||{},{markdown:{partialsFolders:(n?.markdown?.partialsFolders||[]).flatMap(c=>l(c,r))}});return R({...s,configPath:e,ignore:I(n?.ignore,r)})};async function E(e,r){const a=await v(e,r),n=a.map(i=>i.config.schema?i.lifecyclePlugin.id:""),s={};for(const i of a){const o=i.lifecyclePlugin?.id;i.config.schema&&o&&t.properties&&(s[o]=i.config.schema)}return{...t,properties:{...s,...t.properties,openapi:m},$id:t.$id+n.join("")}}function R(e){const r=C.instance();return r.canAccessFeature("apiFunctions")||(e.apiFunctions=void 0),r.canAccessFeature("products")||(e.products=void 0),r.canAccessFeature("breadcrumbs")||(e.breadcrumbs={hide:!0}),r.canAccessFeature("seo")||(e.seo=void 0),r.canAccessFeature("redirects")||(e.redirects={}),r.canAccessFeature("l10n")||(e.l10n=void 0),r.canAccessFeature("rbac")||(e.rbac=void 0),r.canAccessFeature("sso")||(e.sso=void 0),r.canAccessFeature("ssoDirect")||(e.ssoDirect=void 0),r.canAccessFeature("catalogClassic")||(e.catalog=void 0,e.catalogClassic=void 0),r.canAccessFeature("scorecard")||(e.scorecard=void 0,e.scorecardClassic=void 0),r.canAccessFeature("scorecards")||(e.scorecards=void 0),r.canAccessFeature("devOnboarding")||(e.developerOnboarding=void 0),r.canAccessFeature("analytics")||(e.analytics=void 0),r.canAccessFeature("removeAttribution")||(e.removeAttribution=void 0),r.canAccessFeature("mockServer")||(e.mockServer={off:!0}),r.canAccessFeature("advancedSearch")||e.search&&(e.search.engine=A),r.canAccessFeature("banner")||(e.banner=void 0),e}function I(e=[],r){return["static",...e].flatMap(a=>p(a)&&(a.startsWith("*")||a.startsWith(u)||a.startsWith("/"+u)||a.startsWith(d)||a.startsWith("/"+d))?a:l(a,r))}function L(e){return e.i18n&&b.warn("The `i18n` configuration is deprecated. Please use `l10n` instead."),e.l10n||e.i18n||{}}export{z as redoclyConfigLoader};
1
+ import{redocConfigSchema as m,rootRedoclyConfigSchema as t}from"@redocly/config";import p from"is-glob";import{I18N_DIR_NAME as d,L10N_DIR_NAME as u}from"../../../constants/common.js";import{CONFIG_FILE_NAME as f}from"../../../../constants/common.js";import{DEFAULT_SEARCH_ENGINE as A}from"../../../constants/plugins/search.js";import{deepMerge as F}from"../../../../utils/object/deep-merge.js";import{logger as b}from"../../../tools/notifiers/logger.js";import{EntitlementsProvider as C}from"../../../entitlements/entitlements-provider.js";import{readAndValidateConfig as h}from"./utils/read-and-validate-config.js";import{resolveExternalPlugins as v}from"../../../external-plugins/resolve-external-plugins.js";import{getPathForAllLocales as l}from"../../../fs/utils/get-path-for-all-locales.js";import{parseRbacConfig as y}from"../../../utils/rbac.js";import{RbacConfigLocation as g,validateRbacConfig as E}from"../../validate-rbac-config.js";const z=async(e,{fs:r},a)=>{const n=await h(e,r,a,async c=>e===f?S(r.cwd,c?.plugins||[]):void 0);n?.rbac&&(n.rbac=await y(n.rbac),E(n.rbac,e===f?g.RootRedoclyYaml:void 0)),(n?.l10n||n?.i18n)&&(n.l10n=L(n),n.i18n=void 0);const s=F(n||{},{markdown:{partialsFolders:(n?.markdown?.partialsFolders||[]).flatMap(c=>l(c,r))}});return R({...s,configPath:e,ignore:I(n?.ignore,r)})};async function S(e,r){const a=await v(e,r),n=a.map(i=>i.config.schema?i.lifecyclePlugin.id:""),s={};for(const i of a){const o=i.lifecyclePlugin?.id;i.config.schema&&o&&t.properties&&(s[o]=i.config.schema)}return{...t,properties:{...s,...t.properties,openapi:m},$id:t.$id+n.join("")}}function R(e){const r=C.instance();return r.canAccessFeature("apiFunctions")||(e.apiFunctions=void 0),r.canAccessFeature("products")||(e.products=void 0),r.canAccessFeature("breadcrumbs")||(e.breadcrumbs={hide:!0}),r.canAccessFeature("seo")||(e.seo=void 0),r.canAccessFeature("redirects")||(e.redirects={}),r.canAccessFeature("l10n")||(e.l10n=void 0),r.canAccessFeature("rbac")||(e.rbac=void 0),r.canAccessFeature("sso")||(e.sso=void 0),r.canAccessFeature("ssoDirect")||(e.ssoDirect=void 0),r.canAccessFeature("catalogClassic")||(e.catalog=void 0,e.catalogClassic=void 0),r.canAccessFeature("scorecard")||(e.scorecard=void 0,e.scorecardClassic=void 0),r.canAccessFeature("scorecards")||(e.scorecards=void 0),r.canAccessFeature("devOnboarding")||(e.developerOnboarding=void 0),r.canAccessFeature("analytics")||(e.analytics=void 0),r.canAccessFeature("removeAttribution")||(e.removeAttribution=void 0),r.canAccessFeature("mockServer")||(e.mockServer={off:!0}),r.canAccessFeature("advancedSearch")||e.search&&(e.search.engine=A),r.canAccessFeature("banner")||(e.banner=void 0),e}function I(e=[],r){return["static",...e].flatMap(a=>p(a)&&(a.startsWith("*")||a.startsWith(u)||a.startsWith("/"+u)||a.startsWith(d)||a.startsWith("/"+d))?a:l(a,r))}function L(e){return e.i18n&&b.warn("The `i18n` configuration is deprecated. Please use `l10n` instead."),e.l10n||e.i18n||{}}export{z as redoclyConfigLoader};
@@ -1 +1 @@
1
- import P from"path";import{lintConfig as C,loadConfig as T,createConfigTypes as A}from"@redocly/openapi-core";import{deepMerge as U}from"../../../../../utils/object/deep-merge.js";import{logger as l}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as $}from"../../../../../constants/common.js";import{sanitizeBranchName as L}from"../../../../utils/envs/sanitize-branch-name.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as q}from"../../format-error.js";import{ExternalResolver as x}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as B}from"../../resolve-mutual-exclusion.js";function g(o,e,t,r){e in o&&o[e]&&typeof o[e]=="string"&&(/^https?:\/\/.*/.test(o[e])||r(new Error(`Invalid ${t} URL: "${o[e]}". ${t} must start with "http://" or "https://".`)))}function j(o,e){if("access"in o&&o.access&&typeof o.access=="object"){const t=o.access;g(t,"logoutReturnUrl","access.logoutReturnUrl",e),g(t,"residency","access.residency",e);const r=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const n of r)n in t&&t[n]!==void 0&&n in o&&o[n]!==void 0&&e(new Error(`Property '${n}' is defined both at root level and in 'access' object. Please use 'access.${n}' to define this configuration.`))}}async function X(o,e,t,r){const h=e.getFileInfo(o)?.realRelativePath||o;async function d(){const a=new x(e),u=P.join(e.cwd,h),i=await T({configPath:u,externalRefResolver:a}),p=await r(i.resolvedConfig);if(p===void 0)return i.resolvedConfig;const m=[...i.document?.source?await C({config:i,externalConfigTypes:A(p,i)}):[],...i.document?.source?B(i.resolvedConfig,i.document?.source):[]];if(m.length>0)for(const b of m)t(new Error(q(b,e.cwd)));return i.resolvedConfig}const c=await e.exists(o)?await d():{},R=M(c),w=await r(c);g(c,"residency","Residency",t),g(c,"logoutReturnUrl","Logout return URL",t),j(c,t);let f=w?E(w,c):c;const{env:y}=f;if(y){const{envConfig:a}=await import("../../../../../config/env-config.js"),u=a.redoclyEnv,i=y[u]||{},p=a.PUBLIC_REDOCLY_BRANCH_NAME||"",v=p?L(p):"",m=v&&y[`${$}${v}`]||{};f=U(f,m,i)}const s=N(f,R);if(s.imports&&s.imports.length>0){l.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const a=new Set([...s.plugins||[],...s.imports.map(u=>P.posix.join(u,"plugin.js"))]);s.plugins=Array.from(a),delete s.imports}if(s.catalog&&(l.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),s.catalogClassic={...s.catalog},delete s.catalog),s.scorecard&&(l.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),s.scorecardClassic=s.scorecard,delete s.scorecard),s.search?.ai){l.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const a={...s.search?.ai,...s.aiAssistant,suggestions:s.aiAssistant?.suggestions?.length?s.aiAssistant.suggestions:s.search?.ai.suggestions||[]};s.aiAssistant=a,delete s.search.ai}return I(s)}function I(o){const e="access"in o?o.access:void 0;if(!e||typeof e!="object")return o;const t={...o},r=[{name:"requiresLogin",type:"boolean"},{name:"logoutReturnUrl",type:"string"},{name:"residency",type:"string"},{name:"sso",type:"string | string[]"},{name:"rbac",type:"object"}],n=[];for(const h of r){const d=h.name;d in t&&t[d]!==void 0&&!(d in e)&&n.push(d)}return n.length>0&&l.warn(`The following properties at root level are deprecated: ${n.join(", ")}. Please move them to the 'access' object.`),"requiresLogin"in e&&e.requiresLogin!==void 0&&(t.requiresLogin=e.requiresLogin),"logoutReturnUrl"in e&&e.logoutReturnUrl!==void 0&&(t.logoutReturnUrl=e.logoutReturnUrl),"residency"in e&&e.residency!==void 0&&(t.residency=e.residency),"sso"in e&&e.sso!==void 0&&(t.sso=e.sso),"rbac"in e&&e.rbac!==void 0&&(t.rbac=e.rbac),delete t.access,t}function M(o){if(!o.theme)return[];l.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const e=[];for(const t of Object.keys(o.theme))o[t]==null?e.push(t):l.warn(`Detected both '${t}' and 'theme.${t}' properties in redocly.yaml. The 'theme.${t}' property will be ignored and needs to be removed or merged into the '${t}'.`);return e}function N(o,e){if(!o.theme||e.length===0)return o;const t={...o};for(const r of e)t[r]=o.theme[r];return delete t.theme,t}export{X as readAndValidateConfig};
1
+ import P from"path";import{lintConfig as C,loadConfig as T,createConfigTypes as A}from"@redocly/openapi-core";import{deepMerge as U}from"../../../../../utils/object/deep-merge.js";import{logger as l}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as $}from"../../../../../constants/common.js";import{sanitizeBranchName as L}from"../../../../utils/envs/sanitize-branch-name.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as q}from"../../format-error.js";import{ExternalResolver as x}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as B}from"../../resolve-mutual-exclusion.js";function g(o,e,t,r){e in o&&o[e]&&typeof o[e]=="string"&&(/^https?:\/\/.*/.test(o[e])||r(new Error(`Invalid ${t} URL: "${o[e]}". ${t} must start with "http://" or "https://".`)))}function j(o,e){if("access"in o&&o.access&&typeof o.access=="object"){const t=o.access;g(t,"logoutReturnUrl","access.logoutReturnUrl",e),g(t,"residency","access.residency",e);const r=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const n of r)n in t&&t[n]!==void 0&&n in o&&o[n]!==void 0&&e(new Error(`Property '${n}' is defined both at root level and in 'access' object. Please use 'access.${n}' to define this configuration.`))}}async function X(o,e,t,r){const h=e.getFileInfo(o)?.realRelativePath||o;async function d(){const a=new x(e),u=P.join(e.cwd,h),i=await T({configPath:u,externalRefResolver:a}),p=await r(i.resolvedConfig);if(p===void 0)return i.resolvedConfig;const m=[...i.document?.source?await C({config:i,externalConfigTypes:A(p,i)}):[],...i.document?.source?B(i.resolvedConfig,i.document?.source):[]];if(m.length>0)for(const b of m)t(new Error(q(b,e.cwd)));return i.resolvedConfig}const c=await e.exists(o)?await d():{},R=M(c),w=await r(c);g(c,"residency","Residency",t),g(c,"logoutReturnUrl","Logout return URL",t),j(c,t);let f=w?E(w,c):c;const{env:y}=f;if(y){const{envConfig:a}=await import("../../../../config/env-config.js"),u=a.redoclyEnv,i=y[u]||{},p=a.PUBLIC_REDOCLY_BRANCH_NAME||"",v=p?L(p):"",m=v&&y[`${$}${v}`]||{};f=U(f,m,i)}const s=N(f,R);if(s.imports&&s.imports.length>0){l.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const a=new Set([...s.plugins||[],...s.imports.map(u=>P.posix.join(u,"plugin.js"))]);s.plugins=Array.from(a),delete s.imports}if(s.catalog&&(l.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),s.catalogClassic={...s.catalog},delete s.catalog),s.scorecard&&(l.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),s.scorecardClassic=s.scorecard,delete s.scorecard),s.search?.ai){l.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const a={...s.search?.ai,...s.aiAssistant,suggestions:s.aiAssistant?.suggestions?.length?s.aiAssistant.suggestions:s.search?.ai.suggestions||[]};s.aiAssistant=a,delete s.search.ai}return I(s)}function I(o){const e="access"in o?o.access:void 0;if(!e||typeof e!="object")return o;const t={...o},r=[{name:"requiresLogin",type:"boolean"},{name:"logoutReturnUrl",type:"string"},{name:"residency",type:"string"},{name:"sso",type:"string | string[]"},{name:"rbac",type:"object"}],n=[];for(const h of r){const d=h.name;d in t&&t[d]!==void 0&&!(d in e)&&n.push(d)}return n.length>0&&l.warn(`The following properties at root level are deprecated: ${n.join(", ")}. Please move them to the 'access' object.`),"requiresLogin"in e&&e.requiresLogin!==void 0&&(t.requiresLogin=e.requiresLogin),"logoutReturnUrl"in e&&e.logoutReturnUrl!==void 0&&(t.logoutReturnUrl=e.logoutReturnUrl),"residency"in e&&e.residency!==void 0&&(t.residency=e.residency),"sso"in e&&e.sso!==void 0&&(t.sso=e.sso),"rbac"in e&&e.rbac!==void 0&&(t.rbac=e.rbac),delete t.access,t}function M(o){if(!o.theme)return[];l.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const e=[];for(const t of Object.keys(o.theme))o[t]==null?e.push(t):l.warn(`Detected both '${t}' and 'theme.${t}' properties in redocly.yaml. The 'theme.${t}' property will be ignored and needs to be removed or merged into the '${t}'.`);return e}function N(o,e){if(!o.theme||e.length===0)return o;const t={...o};for(const r of e)t[r]=o.theme[r];return delete t.theme,t}export{X as readAndValidateConfig};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{DEV_LOGIN_SLUG as g,INVITE_SLUG as h,PUBLIC_RBAC_SCOPE_ITEM as m,UI_ACCESSIBLE_CONFIG_PROPS as P,CONFIG_FILE_NAME as n,DEFAULT_SSO_IDP_TITLE as _}from"../../../constants/common.js";import{envConfig as T}from"../../../config/env-config.js";import{getTemplatePath as s}from"./get-template-path.js";import{resolveLinksFromConfig as p}from"../nav-utils.js";import{resolveLogoConfig as F}from"./resolve-logo.js";import{extractTeamNames as E}from"./extract-team-names.js";import{resolveProductsConfig as O}from"./resolve-products-config.js";import{getExcludedFromLinkCheckerPatterns as y}from"../sidebars/utils.js";import{resolveEntitiesCatalogConfig as A}from"./resolve-catalog-entities.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";async function q(r){return{id:"Default Theme",async processContent(e){await j("build.plugin.default_theme",async()=>{const t=v(e),o=Object.keys(e.getConfig()?.ssoDirect||{}).length>0,a=e.createTemplate("invite",s("../../../../dist/client/app/pages/Invite/Invite.js"));if(e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:h,[c]:m,fsPath:h,templateId:a}),r.devLogin&&o){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t),rbac:{teams:E(e.getConfig().rbac)}},l=e.createTemplate("dev-login",s("../../../../dist/client/app/pages/DevLogin/DevLogin.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}else if(t.length>1){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t)},l=e.createTemplate("login",s("../../../../dist/client/app/pages/Login/Login.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}e.createTemplate("404",s("../../../../dist/client/app/pages/404/404.js")),e.createTemplate("403",s("../../../../dist/client/app/pages/403/403.js")),e.createTemplate("403OIDC",s("../../../../dist/client/app/pages/403/403OIDC.js")),T.isDevelopMode&&e.createTemplate("compilation-error",s("../../../../dist/client/app/pages/CompilationError/CompilationError.js"))})},async afterRoutesCreated(e,t){const{contentDir:o,outdir:a}=e,i=e.getConfig(),{navbar:l,footer:D,userMenu:u,search:f,breadcrumbs:I,products:b}=i,C=Object.keys(i?.ssoDirect||{}).length>0,d=y(i),L={navFile:n,excludedFromLinkCheckerPatterns:d};e.setGlobalData({...k(i),navbar:await p(l,o,e,t,L),footer:await p(D,o,e,t,L),breadcrumbs:{...I,prefixItems:await p(I?.prefixItems||[],o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},userMenu:{...u,hide:u?.hide??!C,menu:await p(u?.items,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},logo:await F(i.logo,n,a,t.fs),auth:{idpsInfo:v(e),devLogin:r.devLogin&&C},products:await O(b,e,t),search:{...f,suggestedPages:await p(f?.suggestedPages,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},entitiesCatalog:await A(i.entitiesCatalog,n,a,t.fs),headScriptTags:void 0,linkTags:void 0,postBodyScriptTags:void 0,preBodyScriptTags:void 0})}}}function v(r){const e=r.getConfig().ssoDirect;return Object.entries(e||{}).map(([o,a])=>({idpId:o,type:a.type,title:a.title}))}function S(r){return T.LOCALHOST_LOGIN==="true"?r:r.filter(t=>t.title!==_)}function k(r){const e={};for(const t of P)r[t]&&(e[t]=r[t]);return e}export{q as defaultThemePlugin,k as pickUiAccessibleConfig};
1
+ import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{DEV_LOGIN_SLUG as g,INVITE_SLUG as h,PUBLIC_RBAC_SCOPE_ITEM as m,UI_ACCESSIBLE_CONFIG_PROPS as P,CONFIG_FILE_NAME as n,DEFAULT_SSO_IDP_TITLE as _}from"../../../constants/common.js";import{envConfig as T}from"../../config/env-config.js";import{getTemplatePath as s}from"./get-template-path.js";import{resolveLinksFromConfig as p}from"../nav-utils.js";import{resolveLogoConfig as F}from"./resolve-logo.js";import{extractTeamNames as E}from"./extract-team-names.js";import{resolveProductsConfig as O}from"./resolve-products-config.js";import{getExcludedFromLinkCheckerPatterns as y}from"../sidebars/utils.js";import{resolveEntitiesCatalogConfig as A}from"./resolve-catalog-entities.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";async function q(r){return{id:"Default Theme",async processContent(e){await j("build.plugin.default_theme",async()=>{const t=v(e),o=Object.keys(e.getConfig()?.ssoDirect||{}).length>0,a=e.createTemplate("invite",s("../../../../dist/client/app/pages/Invite/Invite.js"));if(e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:h,[c]:m,fsPath:h,templateId:a}),r.devLogin&&o){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t),rbac:{teams:E(e.getConfig().rbac)}},l=e.createTemplate("dev-login",s("../../../../dist/client/app/pages/DevLogin/DevLogin.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}else if(t.length>1){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t)},l=e.createTemplate("login",s("../../../../dist/client/app/pages/Login/Login.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}e.createTemplate("404",s("../../../../dist/client/app/pages/404/404.js")),e.createTemplate("403",s("../../../../dist/client/app/pages/403/403.js")),e.createTemplate("403OIDC",s("../../../../dist/client/app/pages/403/403OIDC.js")),T.isDevelopMode&&e.createTemplate("compilation-error",s("../../../../dist/client/app/pages/CompilationError/CompilationError.js"))})},async afterRoutesCreated(e,t){const{contentDir:o,outdir:a}=e,i=e.getConfig(),{navbar:l,footer:D,userMenu:u,search:f,breadcrumbs:I,products:b}=i,C=Object.keys(i?.ssoDirect||{}).length>0,d=y(i),L={navFile:n,excludedFromLinkCheckerPatterns:d};e.setGlobalData({...k(i),navbar:await p(l,o,e,t,L),footer:await p(D,o,e,t,L),breadcrumbs:{...I,prefixItems:await p(I?.prefixItems||[],o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},userMenu:{...u,hide:u?.hide??!C,menu:await p(u?.items,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},logo:await F(i.logo,n,a,t.fs),auth:{idpsInfo:v(e),devLogin:r.devLogin&&C},products:await O(b,e,t),search:{...f,suggestedPages:await p(f?.suggestedPages,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},entitiesCatalog:await A(i.entitiesCatalog,n,a,t.fs),headScriptTags:void 0,linkTags:void 0,postBodyScriptTags:void 0,preBodyScriptTags:void 0})}}}function v(r){const e=r.getConfig().ssoDirect;return Object.entries(e||{}).map(([o,a])=>({idpId:o,type:a.type,title:a.title}))}function S(r){return T.LOCALHOST_LOGIN==="true"?r:r.filter(t=>t.title!==_)}function k(r){const e={};for(const t of P)r[t]&&(e[t]=r[t]);return e}export{q as defaultThemePlugin,k as pickUiAccessibleConfig};
@@ -1 +1 @@
1
- import{writeFileSync as P}from"node:fs";import T from"path";import{PAGE_COUNT_OUTPUT_FILE_NAME as y}from"../../constants/common.js";import{envConfig as F}from"../../../config/env-config.js";import{logger as o}from"../../tools/notifiers/logger.js";import{isReactPage as S}from"../../utils/content/is-react-page.js";import{EntitlementsProvider as b}from"../../entitlements/entitlements-provider.js";import{getBilledPagesCount as O,isPathIgnored as R}from"../../utils/index.js";import{isGraphqlDoc as $}from"../graphql-docs/is-graphql-doc.js";import{isMarkdownPage as M}from"../markdown/is-markdown-page.js";import{isOpenapiDoc as k}from"../openapi-docs/is-openapi-doc.js";import{PRODUCT_NAME as l}from"../../../config/product-gates.js";import{isAsyncapiDoc as E}from"../asyncapi-docs/is-asyncapi-doc.js";import{telemetryTraceStep as _}from"../../../cli/telemetry/helpers/trace-step.js";async function z(){return{id:"entitlements",async afterRoutesCreated(w,u){await _("build.plugin.entitlements",async t=>{const i=b.instance(),n=[],r=[],s=[],a=[],p=[];for(const{relativePath:e}of u.fs.scan())R(e)||(M(e)?n.push(e):$(e)?s.push(e):S(e)?a.push(e):await k(e,u)?r.push(e):await E(e,u)&&p.push(e));const g=i.canAccessFeature("markdown");t?.setAttribute("totalMarkdownFiles",n.length.toString()),t?.setAttribute("isMarkdownSupported",(!!g).toString()),n.length>0&&!g&&o.warn(`The product you are using ("${l}") does not support Markdown pages. The following Markdown files were detected but will be ignored: ${n.map(()=>"%rp").join(", ")}`,...n);const c=i.canAccessFeature("openapi");t?.setAttribute("totalOpenApiFiles",r.length.toString()),t?.setAttribute("isOpenApiSupported",(!!c).toString()),r.length>0&&!c&&o.warn(`The product you are using ("${l}") does not support OpenAPI documents. The following files are ignored: ${r.map(()=>"%rp").join(", ")}`,...r);const d=i.canAccessFeature("asyncapi");t?.setAttribute("totalAsyncApiFiles",p.length.toString()),t?.setAttribute("isAsyncApiSupported",(!!d).toString()),p.length>0&&!d&&o.warn(`The product you are using ("${l}") does not support AsyncAPI documents. The following files are ignored: ${p.map(()=>"%rp").join(", ")}`,...p);const m=i.canAccessFeature("graphql");t?.setAttribute("totalGraphqlFiles",s.length.toString()),t?.setAttribute("isGraphqlSupported",(!!m).toString()),s.length>0&&!m&&o.warn(`The product you are using ("${l}") does not support GraphQL documents. The following files are ignored: ${s.map(()=>"%rp").join(", ")}`,...s);const f=i.canAccessFeature("reactPages");t?.setAttribute("totalReactFiles",a.length.toString()),t?.setAttribute("isReactPagesSupported",(!!f).toString()),a.length>0&&!f&&o.warn(`The product you are using ("${l}") does not support React pages. The following files are ignored: ${a.map(()=>"%rp").join(", ")}`,...a);const A=O(w.getAllRoutes());t?.setAttribute("totalBilledPages",A.toString());const h=F.REDOCLY_METADATA_OUTPUT_FOLDER;h&&(o.info("Save total pages..."),P(T.join(h,y),JSON.stringify({totalPages:A},null)))})}}}export{z as entitlementsPlugin};
1
+ import{writeFileSync as P}from"node:fs";import T from"path";import{PAGE_COUNT_OUTPUT_FILE_NAME as y}from"../../constants/common.js";import{envConfig as F}from"../../config/env-config.js";import{logger as o}from"../../tools/notifiers/logger.js";import{isReactPage as S}from"../../utils/content/is-react-page.js";import{EntitlementsProvider as b}from"../../entitlements/entitlements-provider.js";import{getBilledPagesCount as O,isPathIgnored as R}from"../../utils/index.js";import{isGraphqlDoc as $}from"../graphql-docs/is-graphql-doc.js";import{isMarkdownPage as M}from"../markdown/is-markdown-page.js";import{isOpenapiDoc as k}from"../openapi-docs/is-openapi-doc.js";import{PRODUCT_NAME as l}from"../../../config/product-gates.js";import{isAsyncapiDoc as E}from"../asyncapi-docs/is-asyncapi-doc.js";import{telemetryTraceStep as _}from"../../../cli/telemetry/helpers/trace-step.js";async function z(){return{id:"entitlements",async afterRoutesCreated(w,u){await _("build.plugin.entitlements",async t=>{const i=b.instance(),n=[],r=[],s=[],a=[],p=[];for(const{relativePath:e}of u.fs.scan())R(e)||(M(e)?n.push(e):$(e)?s.push(e):S(e)?a.push(e):await k(e,u)?r.push(e):await E(e,u)&&p.push(e));const g=i.canAccessFeature("markdown");t?.setAttribute("totalMarkdownFiles",n.length.toString()),t?.setAttribute("isMarkdownSupported",(!!g).toString()),n.length>0&&!g&&o.warn(`The product you are using ("${l}") does not support Markdown pages. The following Markdown files were detected but will be ignored: ${n.map(()=>"%rp").join(", ")}`,...n);const c=i.canAccessFeature("openapi");t?.setAttribute("totalOpenApiFiles",r.length.toString()),t?.setAttribute("isOpenApiSupported",(!!c).toString()),r.length>0&&!c&&o.warn(`The product you are using ("${l}") does not support OpenAPI documents. The following files are ignored: ${r.map(()=>"%rp").join(", ")}`,...r);const d=i.canAccessFeature("asyncapi");t?.setAttribute("totalAsyncApiFiles",p.length.toString()),t?.setAttribute("isAsyncApiSupported",(!!d).toString()),p.length>0&&!d&&o.warn(`The product you are using ("${l}") does not support AsyncAPI documents. The following files are ignored: ${p.map(()=>"%rp").join(", ")}`,...p);const m=i.canAccessFeature("graphql");t?.setAttribute("totalGraphqlFiles",s.length.toString()),t?.setAttribute("isGraphqlSupported",(!!m).toString()),s.length>0&&!m&&o.warn(`The product you are using ("${l}") does not support GraphQL documents. The following files are ignored: ${s.map(()=>"%rp").join(", ")}`,...s);const f=i.canAccessFeature("reactPages");t?.setAttribute("totalReactFiles",a.length.toString()),t?.setAttribute("isReactPagesSupported",(!!f).toString()),a.length>0&&!f&&o.warn(`The product you are using ("${l}") does not support React pages. The following files are ignored: ${a.map(()=>"%rp").join(", ")}`,...a);const A=O(w.getAllRoutes());t?.setAttribute("totalBilledPages",A.toString());const h=F.REDOCLY_METADATA_OUTPUT_FOLDER;h&&(o.info("Save total pages..."),P(T.join(h,y),JSON.stringify({totalPages:A},null)))})}}}export{z as entitlementsPlugin};
@@ -1,2 +1,2 @@
1
- import B from"@redocly/portal-plugin-mock-server";import x from"path";import{REDOCLY_ROUTE_RBAC as O}from"@redocly/config";import{combineUrls as v,withPathPrefix as N}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as L}from"../constants/common.js";import{removeTrailingSlash as F}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as V}from"../../utils/url/remove-leading-slash.js";import{isTruthy as j}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as T}from"../../utils/path/normalize-route-slug.js";import{slash as k}from"../../utils/path/slash.js";import{parsePathVersions as $}from"../../utils/path/parse-path-versions.js";import{reporter as E}from"../tools/notifiers/reporter.js";import{logger as P}from"../tools/notifiers/logger.js";import{envConfig as A}from"../../config/env-config.js";import{shaDirPathShort as z}from"../utils/crypto/sha-dir-path-short.js";import{customPagesPlugin as M}from"../../server/plugins/pages/index.js";import{openAPIDocsPlugin as q}from"../../server/plugins/openapi-docs/index.js";import{asyncAPIDocsPlugin as I}from"../../server/plugins/asyncapi-docs/index.js";import{configParserPlugin as U}from"./config-parser/index.js";import{markdownPlugin as G}from"./markdown/index.js";import{generateBrowserPluginsModule as W,generateClientRoutes as K,generateTemplatesModule as H}from"../esbuild/generate.js";import{graphqlDocsPlugin as Y}from"./graphql-docs/index.js";import{searchPlugin as J}from"./search/index.js";import{defaultThemePlugin as Q}from"./default-theme/index.js";import{apiKeyMgmtPlugin as X}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as Z}from"./api-functions/index.js";import{scorecardClassicPlugin as ee}from"./scorecard-classic/index.js";import{lintPlugin as te}from"./lint/index.js";import{resolvePlugins as oe}from"../config/external-plugins.js";import{sidebarsPlugin as ie}from"./sidebars/index.js";import{l10nPlugin as ne}from"./l10n/index.js";import{analyticsPlugins as re}from"./analytics/index.js";import{sitemapPlugin as se}from"./sitemap/index.js";import{entitlementsPlugin as ae}from"./entitlements/index.js";import{getBilledPagesCount as le,slug as ce}from"../utils/index.js";import{telemetry as ue}from"../../cli/telemetry/index.js";import{telemetryTraceStep as b}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as D}from"../entitlements/entitlements-provider.js";import{ssoPlugin as fe}from"./sso/index.js";import{Cache as me}from"../fs/cache.js";import{ContentFs as de}from"../fs/content-fs.js";import{findProductBySlug as ge}from"../utils/product.js";import{parseBaseName as pe}from"./utils.js";import{isRouteReserved as Pe}from"./get-reserved-routes.js";import{catalogClassicPlugin as he}from"./catalog-classic/index.js";import{arazzoDocsPlugin as ye}from"./arazzo-docs/index.js";const Ce=[U,fe,Q,ne,G,q,I,ye,ee,te,Z,M,Y,X,he,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>A.NEW_CATALOG_ENABLED==="true"},{importPath:"./scorecards/plugin.js",loadCondition:()=>A.NEW_SCORECARDS_ENABLED==="true"},{importPath:"./mcp/index.js",loadCondition:()=>D.instance().canAccessFeature("mcp")},ie,se,ae,J,B,...re];async function pt(o,t=Ce){return await b("build.plugins_init",async()=>{const n=[],w=D.instance(),h={};for(const f of t){let a;if("loadCondition"in f){if(!f.loadCondition())continue;const e=await import(f.importPath);if(!e.default||typeof e.default!="function"){await E.panicOnBuild(`Dynamic plugin ${f.importPath} does not export a default export or it is not a function`);continue}a=e.default}else a=f;const d=await a(o);for(const[e,i]of Object.entries(d.loaders||{}))h[e]&&await E.panicOnBuild(`Duplicate loader with name ${e}`),h[e]=i;(!d.requiredEntitlements||d.requiredEntitlements?.every(e=>w.canAccessFeature(e)))&&n.push(d)}const s=new de(o.contentDir);await s.ready;const u=new me(s);return u.setLoaders(h),P.verbose("All plugins instantiated"),{pluginInstances:n,lifecycleContext:ve(s,u)}})}function _(o){P.verbose("Generating templates"),b("build.write_client_entries",()=>{H(o),W(o),K(o)})}async function we(o){const t=o.getAllRoutes();le(t)||await E.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function Pt(o,t,n,w={}){const h=D.instance();try{await b("build.plugins_run",async()=>{t.startPluginsRun();let s=[];await b("build.plugins_process_content",async a=>{for(const e of o){const i=P.startTiming();await e.processContent?.(t,n),P.verboseTime(i,`processContent for ${e.id}`)}s=(await oe(t.contentDir,t.config.plugins)).map(e=>e.lifecyclePlugin).filter(e=>j(e)&&(!e.requiredEntitlements||e.requiredEntitlements?.every(i=>h.canAccessFeature(i)))),n.cache.setLoaders(Object.fromEntries(s.flatMap(e=>Object.entries(e.loaders||{}))));for(const e of s){const i=P.startTiming();await e.processContent?.(t,n),P.verboseTime(i,`processContent for ${e.id}`)}a?.setAttribute("externalPluginsProcessed",s.length.toString())});const u=await Re(t,n),f=[...o,...s];_(t),A.isDevelopMode?await t.userCodeReady:t.buildRevision++,await b("build.plugins_after_routes_created",async()=>{for(const a of f){const d=P.startTiming();await a.afterRoutesCreated?.(t,u),P.verboseTime(d,`afterRoutesCreated for ${a.id}`)}}),await t.reportUnsetEnvVars(),await we(t),_(t)})}catch(s){const u="Unhandled error in plugin. "+s.message+`
2
- `+s.stack;ue.sendCliErrorCaughtMessage({message:u}),w.failFast?await E.panic(u):await E.panicOnBuild(u)}finally{t.finishPluginsRun()}}async function Re(o,t){const{cache:n,fs:w}=t,h=await t.getConfig(),s=Object.values(h.products||{}),u=(await n.load("versions-config","versions-config")).data,f=(await n.load("content-slugs","content-slugs")).data;for(const{duplicateInAllLocales:e,slugSuffix:i,sharedData:y=[],redirectFrom:C=[],...l}of o.newRoutes){const c=T(l.slug?l.slug:a(l.fsPath)),g=F(i?v(c,i):c),r={...l,[O]:{slug:g,fsPath:l.fsPath},slug:g,baseSlug:c,versions:d(l.fsPath,i),product:ge(s,g,a)};Pe(g,h)&&await E.panicOnBuildContentError(`Route "${g}" is reserved and cannot be used. Please choose a different slug for "${l.fsPath}".`),o.routesByFsPath.set(r.fsPath,r.slug),o.routesBySlug.set(r.slug,r);for(const{key:p,id:m}of y)o.addRouteSharedData(r.slug,p,m);for(const p of C)o.addRedirect(p.from,{type:p.type,to:r.slug});if(e)for(const p of w.localeFolders){const m={...r,slug:"/"+p.toLowerCase()+r.slug};o.routesByFsPath.set(m.fsPath,m.slug),o.routesBySlug.set(m.slug,m);for(const{key:R,id:S}of y)o.addRouteSharedData(m.slug,R,S);for(const R of C){const S=v(w.localizationFolder,p,R.from);o.addRedirect(S,{type:R.type,to:m.slug})}}}return o.newRoutes=[],{...t,slugify:a};function a(e){const i=k(e).replace(new RegExp("^(@i18n|@l10n)\\/"),""),y=f.fileSlugs.get(i)||f.dirSlugs.get(F(i));if(y)return y;const{baseName:C,isIndexFile:l}=pe(e);let c=x.dirname(e.replace(new RegExp("^(@i18n|@l10n)\\/"),""));return c=c==="."?"/":c,v("/",ce(l?c:v(c,C)),"/")}function d(e,i=""){const y=$(e);if(!y?.versionName)return;const{versionFolderPath:C,filePathInVersion:l,versionName:c}=y,g=u.get(C);if(g)return g.versions.map(r=>{const p=g.defaultVersion===r.version,m=V(v(C,L+r.version,l)),R=a(m);return{version:r.version,label:r.name||r.version,link:T(v(R,i)),default:p,active:c===r.version,folderId:z(`${C}`)}})}}function ve(o,t){return{fs:o,cache:t,getConfig:async(n=".")=>(await t.load(n,"nearest-redocly-config",o.localeFolders)).data,isPathIgnored:async n=>(await t.load(n,"is-ignored")).data,withPathPrefix:N,logger:P}}export{Ce as INTERNAL_PLUGINS,ve as createLifecycleContext,pt as initPlugins,Pt as runPlugins,_ as writeClientEntries};
1
+ import x from"@redocly/portal-plugin-mock-server";import B from"path";import{REDOCLY_ROUTE_RBAC as O}from"@redocly/config";import{combineUrls as v,withPathPrefix as N}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as L}from"../constants/common.js";import{removeTrailingSlash as F}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as V}from"../../utils/url/remove-leading-slash.js";import{isTruthy as j}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as T}from"../../utils/path/normalize-route-slug.js";import{slash as k}from"../../utils/path/slash.js";import{parsePathVersions as $}from"../../utils/path/parse-path-versions.js";import{reporter as E}from"../tools/notifiers/reporter.js";import{logger as P}from"../tools/notifiers/logger.js";import{envConfig as A}from"../config/env-config.js";import{shaDirPathShort as z}from"../utils/crypto/sha-dir-path-short.js";import{customPagesPlugin as M}from"../../server/plugins/pages/index.js";import{openAPIDocsPlugin as q}from"../../server/plugins/openapi-docs/index.js";import{asyncAPIDocsPlugin as I}from"../../server/plugins/asyncapi-docs/index.js";import{configParserPlugin as U}from"./config-parser/index.js";import{markdownPlugin as G}from"./markdown/index.js";import{generateBrowserPluginsModule as W,generateClientRoutes as K,generateTemplatesModule as H}from"../esbuild/generate.js";import{graphqlDocsPlugin as Y}from"./graphql-docs/index.js";import{searchPlugin as J}from"./search/index.js";import{defaultThemePlugin as Q}from"./default-theme/index.js";import{apiKeyMgmtPlugin as X}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as Z}from"./api-functions/index.js";import{scorecardClassicPlugin as ee}from"./scorecard-classic/index.js";import{lintPlugin as te}from"./lint/index.js";import{resolveExternalPlugins as oe}from"../external-plugins/resolve-external-plugins.js";import{sidebarsPlugin as ie}from"./sidebars/index.js";import{l10nPlugin as ne}from"./l10n/index.js";import{analyticsPlugins as re}from"./analytics/index.js";import{sitemapPlugin as se}from"./sitemap/index.js";import{entitlementsPlugin as ae}from"./entitlements/index.js";import{getBilledPagesCount as le,slug as ce}from"../utils/index.js";import{telemetry as ue}from"../../cli/telemetry/index.js";import{telemetryTraceStep as b}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as D}from"../entitlements/entitlements-provider.js";import{ssoPlugin as fe}from"./sso/index.js";import{Cache as me}from"../fs/cache.js";import{ContentFs as de}from"../fs/content-fs.js";import{findProductBySlug as ge}from"../utils/product.js";import{parseBaseName as pe}from"./utils.js";import{isRouteReserved as Pe}from"./get-reserved-routes.js";import{catalogClassicPlugin as he}from"./catalog-classic/index.js";import{arazzoDocsPlugin as ye}from"./arazzo-docs/index.js";const Ce=[U,fe,Q,ne,G,q,I,ye,ee,te,Z,M,Y,X,he,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>A.NEW_CATALOG_ENABLED==="true"},{importPath:"./scorecards/plugin.js",loadCondition:()=>A.NEW_SCORECARDS_ENABLED==="true"},{importPath:"./mcp/index.js",loadCondition:()=>D.instance().canAccessFeature("mcp")},ie,se,ae,J,x,...re];async function pt(o,t=Ce){return await b("build.plugins_init",async()=>{const n=[],w=D.instance(),h={};for(const f of t){let a;if("loadCondition"in f){if(!f.loadCondition())continue;const e=await import(f.importPath);if(!e.default||typeof e.default!="function"){await E.panicOnBuild(`Dynamic plugin ${f.importPath} does not export a default export or it is not a function`);continue}a=e.default}else a=f;const d=await a(o);for(const[e,i]of Object.entries(d.loaders||{}))h[e]&&await E.panicOnBuild(`Duplicate loader with name ${e}`),h[e]=i;(!d.requiredEntitlements||d.requiredEntitlements?.every(e=>w.canAccessFeature(e)))&&n.push(d)}const s=new de(o.contentDir);await s.ready;const u=new me(s);return u.setLoaders(h),P.verbose("All plugins instantiated"),{pluginInstances:n,lifecycleContext:ve(s,u)}})}function _(o){P.verbose("Generating templates"),b("build.write_client_entries",()=>{H(o),W(o),K(o)})}async function we(o){const t=o.getAllRoutes();le(t)||await E.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function Pt(o,t,n,w={}){const h=D.instance();try{await b("build.plugins_run",async()=>{t.startPluginsRun();let s=[];await b("build.plugins_process_content",async a=>{for(const e of o){const i=P.startTiming();await e.processContent?.(t,n),P.verboseTime(i,`processContent for ${e.id}`)}s=(await oe(t.contentDir,t.config.plugins)).map(e=>e.lifecyclePlugin).filter(e=>j(e)&&(!e.requiredEntitlements||e.requiredEntitlements?.every(i=>h.canAccessFeature(i)))),n.cache.setLoaders(Object.fromEntries(s.flatMap(e=>Object.entries(e.loaders||{}))));for(const e of s){const i=P.startTiming();await e.processContent?.(t,n),P.verboseTime(i,`processContent for ${e.id}`)}a?.setAttribute("externalPluginsProcessed",s.length.toString())});const u=await Re(t,n),f=[...o,...s];_(t),A.isDevelopMode?await t.userCodeReady:t.buildRevision++,await b("build.plugins_after_routes_created",async()=>{for(const a of f){const d=P.startTiming();await a.afterRoutesCreated?.(t,u),P.verboseTime(d,`afterRoutesCreated for ${a.id}`)}}),await t.reportUnsetEnvVars(),await we(t),_(t)})}catch(s){const u="Unhandled error in plugin. "+s.message+`
2
+ `+s.stack;ue.sendCliErrorCaughtMessage({message:u}),w.failFast?await E.panic(u):await E.panicOnBuild(u)}finally{t.finishPluginsRun()}}async function Re(o,t){const{cache:n,fs:w}=t,h=await t.getConfig(),s=Object.values(h.products||{}),u=(await n.load("versions-config","versions-config")).data,f=(await n.load("content-slugs","content-slugs")).data;for(const{duplicateInAllLocales:e,slugSuffix:i,sharedData:y=[],redirectFrom:C=[],...l}of o.newRoutes){const c=T(l.slug?l.slug:a(l.fsPath)),g=F(i?v(c,i):c),r={...l,[O]:{slug:g,fsPath:l.fsPath},slug:g,baseSlug:c,versions:d(l.fsPath,i),product:ge(s,g,a)};Pe(g,h)&&await E.panicOnBuildContentError(`Route "${g}" is reserved and cannot be used. Please choose a different slug for "${l.fsPath}".`),o.routesByFsPath.set(r.fsPath,r.slug),o.routesBySlug.set(r.slug,r);for(const{key:p,id:m}of y)o.addRouteSharedData(r.slug,p,m);for(const p of C)o.addRedirect(p.from,{type:p.type,to:r.slug});if(e)for(const p of w.localeFolders){const m={...r,slug:"/"+p.toLowerCase()+r.slug};o.routesByFsPath.set(m.fsPath,m.slug),o.routesBySlug.set(m.slug,m);for(const{key:R,id:S}of y)o.addRouteSharedData(m.slug,R,S);for(const R of C){const S=v(w.localizationFolder,p,R.from);o.addRedirect(S,{type:R.type,to:m.slug})}}}return o.newRoutes=[],{...t,slugify:a};function a(e){const i=k(e).replace(new RegExp("^(@i18n|@l10n)\\/"),""),y=f.fileSlugs.get(i)||f.dirSlugs.get(F(i));if(y)return y;const{baseName:C,isIndexFile:l}=pe(e);let c=B.dirname(e.replace(new RegExp("^(@i18n|@l10n)\\/"),""));return c=c==="."?"/":c,v("/",ce(l?c:v(c,C)),"/")}function d(e,i=""){const y=$(e);if(!y?.versionName)return;const{versionFolderPath:C,filePathInVersion:l,versionName:c}=y,g=u.get(C);if(g)return g.versions.map(r=>{const p=g.defaultVersion===r.version,m=V(v(C,L+r.version,l)),R=a(m);return{version:r.version,label:r.name||r.version,link:T(v(R,i)),default:p,active:c===r.version,folderId:z(`${C}`)}})}}function ve(o,t){return{fs:o,cache:t,getConfig:async(n=".")=>(await t.load(n,"nearest-redocly-config",o.localeFolders)).data,isPathIgnored:async n=>(await t.load(n,"is-ignored")).data,withPathPrefix:N,logger:P}}export{Ce as INTERNAL_PLUGINS,ve as createLifecycleContext,pt as initPlugins,Pt as runPlugins,_ as writeClientEntries};
@@ -1 +1 @@
1
- import{pathToFileURL as o}from"url";import{envConfig as r}from"../../../../config/env-config.js";async function n(t){if(r.isRuntimeMode)return await import("@redocly-markdoc/schema");try{const e=r.isDevelopMode?"js":"mjs";return await import(o(`${t}/user-tags-entry.${e}`)+"?"+new Date)}catch(e){if(r.isDevelopMode)return{schema:{}};throw e}}export{n as importUserTags};
1
+ import{pathToFileURL as o}from"url";import{envConfig as r}from"../../../config/env-config.js";async function n(t){if(r.isRuntimeMode)return await import("@redocly-markdoc/schema");try{const e=r.isDevelopMode?"js":"mjs";return await import(o(`${t}/user-tags-entry.${e}`)+"?"+new Date)}catch(e){if(r.isDevelopMode)return{schema:{}};throw e}}export{n as importUserTags};
@@ -1 +1 @@
1
- import{nanoid as R}from"nanoid";import{envConfig as i}from"../../../../../config/env-config.js";import{logger as h}from"../../../../tools/notifiers/logger.js";import{sha as g}from"../../../../utils/crypto/sha.js";const s={};function c(t){if(t.toLowerCase().includes("gantt")&&!t.toLowerCase().includes("todaymarker off")){const o=new Date().toISOString().split("T")[0];return g(t+o)}return g(t)}async function O(t,d="default"){if(t.length===0)return[];const r=[];for(let e=0;e<t.length;e++){const n=c(t[e]);s[n]||r.push(t[e])}if(r.length){const e=i.REDOCLY_MERMAID_MICROSERVICE_URL||"https://api.redocly.com/mermaid",n=h.startTiming(),f=R(),m=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-request-id":i.REQUEST_ID||""},body:JSON.stringify({definitions:r,rayId:f,theme:d,organizationId:i.ORGANIZATION_ID})});if(m.status!==200)throw new Error(`Something went wrong during remote rendering. Please, save this Ray ID: ${f} and contact Redocly team.`);h.verboseTime(n,"Rendered mermaid diagrams (%s)",r.length);const l=await m.json();for(let a=0;a<r.length;a++){const p=c(r[a]);s[p]=l[a]}}const o=[];for(let e=0;e<t.length;e++){const n=c(t[e]);o.push(s[n])}return o}export{s as cache,c as generateDiagramHash,O as renderMermaid};
1
+ import{nanoid as R}from"nanoid";import{envConfig as i}from"../../../../config/env-config.js";import{logger as h}from"../../../../tools/notifiers/logger.js";import{sha as g}from"../../../../utils/crypto/sha.js";const s={};function c(t){if(t.toLowerCase().includes("gantt")&&!t.toLowerCase().includes("todaymarker off")){const o=new Date().toISOString().split("T")[0];return g(t+o)}return g(t)}async function O(t,d="default"){if(t.length===0)return[];const r=[];for(let e=0;e<t.length;e++){const n=c(t[e]);s[n]||r.push(t[e])}if(r.length){const e=i.REDOCLY_MERMAID_MICROSERVICE_URL||"https://api.redocly.com/mermaid",n=h.startTiming(),f=R(),m=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-request-id":i.REQUEST_ID||""},body:JSON.stringify({definitions:r,rayId:f,theme:d,organizationId:i.ORGANIZATION_ID})});if(m.status!==200)throw new Error(`Something went wrong during remote rendering. Please, save this Ray ID: ${f} and contact Redocly team.`);h.verboseTime(n,"Rendered mermaid diagrams (%s)",r.length);const l=await m.json();for(let a=0;a<r.length;a++){const p=c(r[a]);s[p]=l[a]}}const o=[];for(let e=0;e<t.length;e++){const n=c(t[e]);o.push(s[n])}return o}export{s as cache,c as generateDiagramHash,O as renderMermaid};
@@ -1,17 +1,21 @@
1
- import{isPrimitive as j}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as c}from"../markdoc/helpers/get-node-attribute.js";import{getVariable as N}from"../markdoc/helpers/get-variable.js";import{isTag as v}from"../markdoc/helpers/guards/is-tag.js";import{isNode as E}from"../markdoc/helpers/guards/is-node.js";import{isConditionalNode as S}from"../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as w}from"../markdoc/helpers/guards/is-variable.js";import{isExampleNode as x}from"../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as C}from"../markdoc/helpers/guards/is-fence-node.js";function n(i,r={}){const a=[];for(const e of i){if(j(e)){const t=r.isTrim?l(String(e)):String(e);t&&a.push(t)}else if(E(e))switch(e.type){case"text":a.push(n([c(e,"content")],r));break;case"code":a.push(`\`${n([c(e,"content")],r)}\``);break;case"blockquote":a.push(`> ${n(e.children,r)}
2
- `);break;case"fence":const t=c(e,"process")===!1;a.push(d(e,r,t));break;case"list":const m=c(e,"ordered")||!1,u=c(e,"marker"),f=e.children.map((s,h)=>`${" ".repeat((r?.indent??0)*2)}${m?h+1:""}${u} ${n([s],{...r??{},indent:(r?.indent??0)+1})}`);a.push(`${f.join("")}
3
- `);break;case"item":a.push(e.children.map(s=>`${n([s],r).trimEnd()}
4
- `).join(""));break;case"thead":const p=e.children.map(s=>n([s],r));a.push(`${p}| ${" --- |".repeat(e.children?.[0]?.children.length)}
5
- `);break;case"tr":const k=e.children.map(s=>n([s],r));a.push(`| ${k.join(" | ")} |
6
- `);break;case"em":a.push(`*${n(e.children,r)}*`);break;case"strong":a.push(`**${n(e.children,r)}**`);break;case"softbreak":case"hardbreak":a.push(`
7
- `);break;case"hr":a.push(`
1
+ import{isPrimitive as w}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as t}from"../markdoc/helpers/get-node-attribute.js";import{getVariable as C}from"../markdoc/helpers/get-variable.js";import{isTag as E}from"../markdoc/helpers/guards/is-tag.js";import{isNode as N}from"../markdoc/helpers/guards/is-node.js";import{isConditionalNode as v}from"../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as A}from"../markdoc/helpers/guards/is-variable.js";import{isExampleNode as S}from"../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as x}from"../markdoc/helpers/guards/is-fence-node.js";function a(s,r={}){const n=[];for(const e of s){if(w(e)){const i=r.isTrim?u(String(e)):String(e);i&&n.push(i)}else if(N(e))switch(e.type){case"text":n.push(a([t(e,"content")],r));break;case"code":n.push(`\`${a([t(e,"content")],r)}\``);break;case"blockquote":n.push(`> ${a(e.children,r)}
2
+ `);break;case"fence":const i=t(e,"process")===!1;n.push(o(e,r,i));break;case"list":const h=t(e,"ordered")||!1,d=t(e,"marker"),f=e.children.map((c,l)=>`${" ".repeat((r?.indent??0)*2)}${h?l+1:""}${d} ${a([c],{...r??{},indent:(r?.indent??0)+1})}`);n.push(`${f.join("")}
3
+ `);break;case"item":n.push(e.children.map(c=>`${a([c],r).trimEnd()}
4
+ `).join(""));break;case"thead":const $=e.children.map(c=>a([c],r));n.push(`${$}| ${" --- |".repeat(e.children?.[0]?.children.length)}
5
+ `);break;case"tr":const p=e.children.map(c=>a([c],r));n.push(`| ${p.join(" | ")} |
6
+ `);break;case"em":n.push(`*${a(e.children,r)}*`);break;case"strong":n.push(`**${a(e.children,r)}**`);break;case"softbreak":case"hardbreak":n.push(`
7
+ `);break;case"hr":n.push(`
8
8
 
9
9
  ---
10
10
 
11
- `);break;case"heading":const b=c(e,"level")??0;a.push(`${"#".repeat(b)} ${n(e.children,r)}
12
- `);break;case"image":const $=c(e,"alt")||"",o=c(e,"src")||"";a.push(`![${$}](${o})`);break;case"link":const g=c(e,"href")||"";a.push(`[${n(e.children,r)}](${g})`);break;case"paragraph":case"table":a.push(`${n(e.children,r)}
13
- `);break;case"tag":if(S(e)&&r.skipConditionals)continue;if(x(e)){a.push(...e.children.map(s=>{if(C(s)){const h=c(s,"process")!==!0;return d(s,r,h)}return n([s],r)}));continue}a.push(`${n(e.children,r)}`);break;default:a.push(n(e.children,r));break}else v(e)&&a.push(n(e.children,r));w(e)&&a.push(n([N(e,r.variables)],r))}return r.isTrim?l(a.map(e=>l(e)).join("")):a.join("")}function l(i){return i.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function d(i,r={},a=!1){const e=c(i,"title");return`
14
- \`\`\`${c(i,"language")||""}${e?` ${e}`:""}
15
- ${a?(c(i,"content")||"").trimEnd():n(i.children,r).trimEnd()}
11
+ `);break;case"heading":const k=t(e,"level")??0;n.push(`${"#".repeat(k)} ${a(e.children,r)}
12
+ `);break;case"image":const b=t(e,"alt")||"",g=t(e,"src")||"";n.push(`![${b}](${g})`);break;case"link":const T=t(e,"href")||"";n.push(`[${a(e.children,r)}](${T})`);break;case"paragraph":case"table":n.push(`${a(e.children,r)}
13
+ `);break;case"tag":if(v(e)&&r.skipConditionals)continue;if(S(e)){n.push(...e.children.map(c=>{if(x(c)){const l=t(c,"process")!==!0;return o(c,r,l)}return a([c],r)}));continue}if(e.tag==="code-snippet"){const c=t(e,"rawContent");if(c){const l=t(e,"language"),m=t(e,"title"),j=`
14
+ \`\`\`${`${l||""}${m?`${l?" ":""}${m}`:""}`}
15
+ ${c.trimEnd()}
16
16
  \`\`\`
17
- `}export{n as toMarkdown};
17
+ `;n.push(j)}continue}n.push(`${a(e.children,r)}`);break;default:n.push(a(e.children,r));break}else E(e)&&n.push(a(e.children,r));A(e)&&n.push(a([C(e,r.variables)],r))}return r.isTrim?u(n.map(e=>u(e)).join("")):n.join("")}function u(s){return s.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function o(s,r={},n=!1){const e=t(s,"title"),i=t(s,"language"),h=`${i||""}${e?`${i?" ":""}${e}`:""}`,d=n?(t(s,"content")||"").trimEnd():a(s.children,r).trimEnd();return`
18
+ \`\`\`${h}
19
+ ${d}
20
+ \`\`\`
21
+ `}export{a as toMarkdown};
@@ -1 +1 @@
1
- import{logger as a}from"../../../tools/notifiers/logger.js";import{HeadingNode as h}from"./nodes/heading-node.js";import{TAG_TITLE_ATTRIBUTES as u,TagNode as n}from"./nodes/tag-node.js";import{TextNode as l}from"./nodes/text-node.js";import{isNode as p}from"../markdoc/helpers/guards/is-node.js";import{isConditionalNode as y}from"../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as N}from"../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as f}from"../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as T}from"../markdoc/helpers/extract-rbac-from-condition-node.js";class E{#t;#o;#i;#r;constructor({ast:i,partials:t,skipConditionals:s=!1,getInnerContent:r}){if(this.#t=i,this.#o=t,this.#i=s,this.#r=r,!this.#t||!p(this.#t))throw new Error("ast is not a valid Markdoc Node.")}*transform(){yield*this.#c(this.#t,{parentNode:null})}*#c(i,t,s=this.#r){if(!(!i||!p(i))){if(y(i)){if(this.#i)return;const r=T(i);r!==null&&(yield*this.#s(i,{...t,rbacTeam:r},s));return}if(N(i)){yield new l({node:i,content:s([i],{skipConditionals:this.#i}),...t});return}if(i.type==="heading"){yield new h({node:i,content:s([i],{skipConditionals:this.#i}),rbacTeam:t?.rbacTeam});return}if(i.type==="tag"){yield*this.#e(i,t,s);return}yield*this.#s(i,t,s)}}*#e(i,t,s=this.#r){switch(i.tag){case"partial":{const r=i.attributes.file,o=i.attributes.variables??{};if(r&&this.#o[r]){yield*this.#c(this.#o[r],t,(c,e)=>s(c,{...e,variables:o}));return}a.warn(`Could not create search indexes for partial \u201C${r}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#s(i,t,s);return}case"markdoc-example":{const r=s([i],{skipConditionals:this.#i});yield new l({node:i,content:r,...t});return}case"code-snippet":{const r=f(i,"title"),o=f(i,"rawContent");if(r){const c=new n({node:i,content:r,...t});t={...t,parentNode:c},yield c}o&&(yield new l({node:i,content:o,...t}));return}default:{const r=u.find(e=>e in i.attributes),o=(r&&f(i,r))??"",c=typeof o=="string"?o:s([o]);if(c){const e=new n({node:i,content:c,...t});t={...t,parentNode:e},yield e}yield*this.#s(i,t,s);return}}}*#s(i,t,s=this.#r){for(const r of[...Object.values(i.slots),...i.children])for(const o of this.#c(r,t,s))o instanceof h&&(t={...t,parentNode:o}),yield o}}export{E as AstToSearchNodeTransformer};
1
+ import{logger as a}from"../../../tools/notifiers/logger.js";import{HeadingNode as f}from"./nodes/heading-node.js";import{TAG_TITLE_ATTRIBUTES as u,TagNode as h}from"./nodes/tag-node.js";import{TextNode as e}from"./nodes/text-node.js";import{isNode as n}from"../markdoc/helpers/guards/is-node.js";import{isConditionalNode as y}from"../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as N}from"../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as p}from"../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as T}from"../markdoc/helpers/extract-rbac-from-condition-node.js";class C{#t;#o;#i;#s;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s}){if(this.#t=i,this.#o=t,this.#i=r,this.#s=s,!this.#t||!n(this.#t))throw new Error("ast is not a valid Markdoc Node.")}*transform(){yield*this.#l(this.#t,{parentNode:null})}*#l(i,t,r=this.#s){if(!(!i||!n(i))){if(y(i)){if(this.#i)return;const s=T(i);s!==null&&(yield*this.#r(i,{...t,rbacTeam:s},r));return}if(N(i)){yield new e({node:i,content:r([i],{skipConditionals:this.#i}),...t});return}if(i.type==="heading"){yield new f({node:i,content:r([i],{skipConditionals:this.#i}),rbacTeam:t?.rbacTeam});return}if(i.type==="tag"){yield*this.#c(i,t,r);return}yield*this.#r(i,t,r)}}*#c(i,t,r=this.#s){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#l(this.#o[s],t,(l,c)=>r(l,{...c,variables:o}));return}a.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#r(i,t,r);return}case"markdoc-example":{const s=r([i],{skipConditionals:this.#i});yield new e({node:i,content:s,...t});return}case"code-snippet":{const s=p(i,"title"),o=r([i],{skipConditionals:this.#i});if(s){const l=new h({node:i,content:s,...t});t={...t,parentNode:l},yield l}o&&(yield new e({node:i,content:o,...t}));return}default:{const s=u.find(c=>c in i.attributes),o=(s&&p(i,s))??"",l=typeof o=="string"?o:r([o]);if(l){const c=new h({node:i,content:l,...t});t={...t,parentNode:c},yield c}yield*this.#r(i,t,r);return}}}*#r(i,t,r=this.#s){for(const s of[...Object.values(i.slots),...i.children])for(const o of this.#l(s,t,r))o instanceof f&&(t={...t,parentNode:o}),yield o}}export{C as AstToSearchNodeTransformer};
@@ -9,6 +9,7 @@ export type DocsMcpToolRegistrationOptions = {
9
9
  apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
10
10
  headers?: Record<string, string | string[] | undefined>;
11
11
  accessInfo: AccessInfo;
12
+ products?: string[];
12
13
  };
13
14
  /** Keys that can be passed to the tool context (excludes 'server' which is not serializable) */
14
15
  export type ContextKey = Exclude<keyof DocsMcpToolRegistrationOptions, 'server'>;
@@ -1 +1 @@
1
- import{telemetry as i}from"../../../../telemetry/index.js";import{mcpToolWorkers as n,MCP_TOOL_WORKER_KEY as a}from"../../../../workers/mcp-tool-worker-pool.js";import{findApiDescriptionByName as p}from"../utils.js";import{getApiDescriptionFromFs as u}from"./utils.js";function f(o,t,s){return{toolName:o,args:t,context:s}}class g{schema;constructor(t){this.schema=t}getContext(t){const s={};for(const e of this.requiredContext)s[e]=t[e];return{...s,apiDescriptionsMap:t.apiDescriptionsMap}}register(t){const s=async(e,r)=>{const c=f(this.name,e,this.getContext(t));return await n.exec(a,[c],{timeout:6e4})};t.server.tool(this.name,this.description,this.schema,s)}async execute(t,s){try{const e=await this.executeAction(t,s);return i.sendMcpToolCalledMessage([{object:"mcp_server",server_type:"docs",tool:this.name}]),e}catch(e){throw i.sendMcpErrorMessage([{object:"mcp_server",server_type:"docs",tool:this.name,message:e instanceof Error?e.message:String(e),stack:e instanceof Error&&e.stack||""}]),e}}async getApiDefinition(t,s){if(!s.outdir||!s.accessInfo)throw new Error("Missing required context: outdir and accessInfo");const e=p(s.apiDescriptionsMap,t);if(!e)return{success:!1,response:{content:[{type:"text",text:`No API found matching "${t}".`}]}};const r=await u({relativePath:e.relativePath||"",outdir:s.outdir,accessInfo:s.accessInfo});return r?{success:!0,definition:r}:{success:!1,response:{content:[{type:"text",text:`Spec not found from the file system with "${t}".`}]}}}}export{g as DocsMcpTool};
1
+ import{telemetry as o}from"../../../../telemetry/index.js";import{mcpToolWorkers as n,MCP_TOOL_WORKER_KEY as a}from"../../../../workers/mcp-tool-worker-pool.js";import{findApiDescriptionByName as p}from"../utils.js";import{getApiDescriptionFromFs as m}from"./utils.js";function u(i,t,s){return{toolName:i,args:t,context:s}}class g{schema;constructor(t){this.schema=t}getContext(t){const s={};for(const e of this.requiredContext)s[e]=t[e];return{...s,apiDescriptionsMap:t.apiDescriptionsMap}}register(t){const s=async(e,r)=>{const c=u(this.name,e,this.getContext(t));return await n.exec(a,[c],{timeout:6e4})};t.server.tool(this.name,this.description,this.schema,s)}async execute(t,s){try{const e=await this.executeAction(t,s);return e.isError?o.sendMcpErrorMessage([{object:"mcp_server",server_type:"docs",tool:this.name,message:`${e.content.map(({text:r})=>r).join(" ")}`,stack:""}]):o.sendMcpToolCalledMessage([{object:"mcp_server",server_type:"docs",tool:this.name}]),e}catch(e){throw o.sendMcpErrorMessage([{object:"mcp_server",server_type:"docs",tool:this.name,message:e instanceof Error?e.message:String(e),stack:e instanceof Error&&e.stack||""}]),e}}async getApiDefinition(t,s){if(!s.outdir||!s.accessInfo)throw new Error("Missing required context: outdir and accessInfo");const e=p(s.apiDescriptionsMap,t);if(!e)return{success:!1,response:{content:[{type:"text",text:`No API found matching "${t}".`}]}};const r=await m({relativePath:e.relativePath||"",outdir:s.outdir,accessInfo:s.accessInfo});return r?{success:!0,definition:r}:{success:!1,response:{content:[{type:"text",text:`Spec not found from the file system with "${t}".`}]}}}}export{g as DocsMcpTool};
@@ -1,10 +1,11 @@
1
1
  import type { McpToolWorkerParams, McpToolWorkerResponse, ToolArgsMap } from '../../types.js';
2
- import { DocsMcpTool, type ContextKey } from './docs-mcp-tool.js';
2
+ import { DocsMcpTool, type DocsMcpToolRegistrationOptions, type ContextKey } from './docs-mcp-tool.js';
3
3
  export declare class SearchTool extends DocsMcpTool<'search'> {
4
4
  readonly name = "search";
5
5
  readonly description = "Search across the documentation to fetch relevant content for a given query";
6
6
  readonly requiredContext: readonly ContextKey[];
7
- constructor();
7
+ constructor(products?: string[]);
8
+ register(options: DocsMcpToolRegistrationOptions): void;
8
9
  protected executeAction(args: ToolArgsMap['search'], context: McpToolWorkerParams['context']): Promise<McpToolWorkerResponse>;
9
10
  }
10
11
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1,6 @@
1
- import{withPathPrefix as d}from"@redocly/theme/core/utils";import{ServerRoutes as p}from"../../../../../constants/common.js";import{DocsMcpTool as l}from"./docs-mcp-tool.js";import{processDocuments as m}from"./utils.js";const f={type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1}}};class g extends l{name="search";description="Search across the documentation to fetch relevant content for a given query";requiredContext=["baseUrl","outdir","headers"];constructor(){super(f)}async executeAction(a,e){const{query:i}=a;if(!e.baseUrl||!e.outdir)throw new Error("Missing required context: baseUrl and outdir");const c=JSON.stringify({query:i});let t=`${e.baseUrl}${d(p.SEARCH)}`;t.startsWith("http://")&&(t=t.replace(/^http:\/\//,"https://"));const o=e.headers?.authorization,s=o?`authorization=${String(o).replace(/^Bearer /,"")}`:"",r=await fetch(t,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...s?{Cookie:s}:{}},body:c});if(!r.ok){const u=await r.text().catch(()=>"Unable to read error response");throw new Error(`Search request failed with status ${r.status}: ${u}`)}const h=await r.json(),n=m(h.documents||{},e.outdir);return{content:[{type:"text",text:n.trim().length?n:"No results found."}]}}}export{g as SearchTool};
1
+ import{withPathPrefix as f}from"@redocly/theme/core/utils";import{ServerRoutes as y}from"../../../../../constants/common.js";import{DocsMcpTool as m}from"./docs-mcp-tool.js";class b extends m{name="search";description="Search across the documentation to fetch relevant content for a given query";requiredContext=["baseUrl","headers","products"];constructor(t){super(h(t))}register(t){this.schema=h(t.products),super.register(t)}async executeAction(t,r){const{query:p,product:l}=t;if(!r.baseUrl)throw new Error("Missing required context: baseUrl");const d=JSON.stringify({query:p,product:l});let n=`${r.baseUrl}${f(y.SEMANTIC_SEARCH)}`;n.startsWith("http://")&&(n=n.replace(/^http:\/\//,"https://"));const i=r.headers?.authorization,a=i?`authorization=${String(i).replace(/^Bearer /,"")}`:"";try{const c=await fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...a?{Cookie:a}:{}},body:d});if(!c.ok)return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0};const o=await c.json();if(!o||o.length===0)return{content:[{type:"text",text:"No results found."}]};const u=o.map(s=>`### [${s.title}](${new URL(s.url,r.baseUrl).toString()})
2
+
3
+ ${s.content}
4
+ `).join(`
5
+
6
+ `).trim();return{content:[{type:"text",text:u.length?u:"No results found."}]}}catch{return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0}}}}function h(e){const t=e&&e.length>0;return{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...t?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{}}}}export{b as SearchTool};
@@ -1 +1 @@
1
- import{createMcpRequestHandler as v}from"./mcp-request-handler.js";import{createDocsMcpServer as D}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as h}from"../utils.js";import{createInternalServerError as y}from"./errors.js";import{McpServerType as m}from"../constants.js";import{telemetry as f}from"../../../telemetry/index.js";import{constructInvalidTokenResponse as b,constructUnauthorizedResponse as A,handleMcpAuth as L,shouldHandleMcpAuth as S}from"../auth/auth-handlers.js";async function I(r,s,i,n){try{f.initialize();const e=s,t=e?.props?.config?.apiDescriptionsMap||{},a=e?.props?.outdir||"",o=e?.props?.config?.mcpDocsServerName||"Docs MCP server",u=new URL(n.url).origin,{user:c,config:{rbac:p={},mcp:l={}}}=r,d=h(t,c,p,r.config.requiresLogin||!1),g=l.docs?.name||o,M={rbac:p,email:c?.email,teams:c?.teams,isAuthenticated:!!c?.isAuthenticated,requiresLogin:r.config.requiresLogin||!1};return await D({name:g,baseUrl:u,headers:i,apiDescriptionsMap:d,outdir:a,accessInfo:M})}catch(e){throw f.sendMcpErrorMessage([{object:"mcp_server",server_type:m.Docs,message:e?.message||"",stack:e?.stack||""}]),y(e?.message||"Internal server error mcp docs")}}const R=v({createServerInstance:I,serverType:m.Docs}),w=async(r,s,i)=>{const n=!!s?.config?.requiresLogin,e=s?.config?.rbac;if(S(n,e)){const{isAuthenticated:t,isTokenValid:a,currentUser:o}=await L(r,s);if(!t)return A(new URL(r.url).origin);if(!a)return b();o&&(s.user=o)}return R(r,s,i)};var E=w;export{E as default};
1
+ import{createMcpRequestHandler as h}from"./mcp-request-handler.js";import{createDocsMcpServer as y}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as b}from"../utils.js";import{createInternalServerError as A}from"./errors.js";import{McpServerType as m}from"../constants.js";import{telemetry as u}from"../../../telemetry/index.js";import{constructInvalidTokenResponse as L,constructUnauthorizedResponse as S,handleMcpAuth as I,shouldHandleMcpAuth as R}from"../auth/auth-handlers.js";async function w(e,s,i,n){try{u.initialize();const r=s,t=r?.props?.config?.apiDescriptionsMap||{},a=r?.props?.outdir||"",o=r?.props?.config?.mcpDocsServerName||"Docs MCP server",f=new URL(n.url).origin,{user:c,config:{rbac:p={},mcp:l={}}}=e,d=b(t,c,p,e.config.requiresLogin||!1),g=l.docs?.name||o,v=e.config.products?Object.values(e.config.products).map(D=>D?.name):[],M={rbac:p,email:c?.email,teams:c?.teams,isAuthenticated:!!c?.isAuthenticated,requiresLogin:e.config.requiresLogin||!1};return await y({name:g,baseUrl:f,headers:i,apiDescriptionsMap:d,outdir:a,accessInfo:M,products:v})}catch(r){throw u.sendMcpErrorMessage([{object:"mcp_server",server_type:m.Docs,message:r?.message||"",stack:r?.stack||""}]),A(r?.message||"Internal server error mcp docs")}}const T=h({createServerInstance:w,serverType:m.Docs}),U=async(e,s,i)=>{const n=!!s?.config?.requiresLogin,r=s?.config?.rbac;if(R(n,r)){const{isAuthenticated:t,isTokenValid:a,currentUser:o}=await I(e,s);if(!t)return S(new URL(e.url).origin);if(!a)return L();o&&(s.user=o)}return T(e,s,i)};var N=U;export{N as default};
@@ -1 +1 @@
1
- import{withPathPrefix as d}from"@redocly/theme/core/utils";import{importApiRoutesHandler as f}from"../../../api-routes/import-api-routes-handlers.js";import{enhanceContext as h}from"../../../api-routes/helpers/enhance-context.js";import{telemetry as A}from"../../../telemetry/index.js";import{KvService as D}from"../../../persistence/kv/services/kv-service.js";import{envConfig as o}from"../../../../config/env-config.js";async function y(a,s,t){const e=s.get("auth"),i=await t.resolveRouteStaticData(a)||{},r=d(a.slug),{requestHandlers:c}=await f(t.serverOutDir),p=c[a.requestHandlerId],m=(await p()).default,u=async()=>await D.getInstance({baseDbDir:t.serverOutDir,sqldRemoteDatabaseUrl:o.SQLD_REMOTE_DATABASE_URL,sqldRemoteDatabaseAuthToken:o.SQLD_REMOTE_DATABASE_AUTH_TOKEN}),l=h({honoCtx:s,ctx:{user:{teams:e.teams,email:e.claims.email,claims:e.claims,idpAccessToken:e.idpAccessToken,idpId:e.claims.idpId,isAuthenticated:e.isAuthenticated},config:t.config},telemetry:A,getKv:u}),n=await m(s.req.raw,l,{...i,props:{...i.props,routeSlug:r,outdir:t.outdir}});return n instanceof Response?n:typeof n=="string"?new Response(n,{headers:{"Content-Type":"text/plain"}}):new Response(JSON.stringify(n),{headers:{"Content-Type":"application/json"}})}export{y as handleMcpRequest};
1
+ import{withPathPrefix as d}from"@redocly/theme/core/utils";import{importApiRoutesHandler as f}from"../../../api-routes/import-api-routes-handlers.js";import{enhanceContext as h}from"../../../api-routes/helpers/enhance-context.js";import{telemetry as A}from"../../../telemetry/index.js";import{KvService as D}from"../../../persistence/kv/services/kv-service.js";import{envConfig as o}from"../../../config/env-config.js";async function y(a,s,t){const e=s.get("auth"),i=await t.resolveRouteStaticData(a)||{},r=d(a.slug),{requestHandlers:c}=await f(t.serverOutDir),p=c[a.requestHandlerId],m=(await p()).default,u=async()=>await D.getInstance({baseDbDir:t.serverOutDir,sqldRemoteDatabaseUrl:o.SQLD_REMOTE_DATABASE_URL,sqldRemoteDatabaseAuthToken:o.SQLD_REMOTE_DATABASE_AUTH_TOKEN}),l=h({honoCtx:s,ctx:{user:{teams:e.teams,email:e.claims.email,claims:e.claims,idpAccessToken:e.idpAccessToken,idpId:e.claims.idpId,isAuthenticated:e.isAuthenticated},config:t.config},telemetry:A,getKv:u}),n=await m(s.req.raw,l,{...i,props:{...i.props,routeSlug:r,outdir:t.outdir}});return n instanceof Response?n:typeof n=="string"?new Response(n,{headers:{"Content-Type":"text/plain"}}):new Response(JSON.stringify(n),{headers:{"Content-Type":"application/json"}})}export{y as handleMcpRequest};
@@ -7,16 +7,18 @@ export declare class DocsMcpServer extends BaseMcpServer {
7
7
  headers: Record<string, string | string[] | undefined>;
8
8
  outdir: string;
9
9
  accessInfo: AccessInfo;
10
+ products?: string[];
10
11
  });
11
12
  protected registerTools(): void;
12
13
  protected getServerType(): McpServerType;
13
14
  }
14
- export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, }: {
15
+ export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, products, }: {
15
16
  name: string;
16
17
  baseUrl: string;
17
18
  headers: Record<string, string | string[] | undefined>;
18
19
  apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
19
20
  outdir: string;
20
21
  accessInfo: AccessInfo;
22
+ products: string[];
21
23
  }): Promise<import("../types.js").McpServerInstance>;
22
24
  //# sourceMappingURL=docs-server.d.ts.map