@redocly/redoc 0.131.0-next.8 → 0.131.0

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 (112) hide show
  1. package/CHANGELOG.md +201 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/{prepare → build}/index.d.ts +2 -2
  4. package/dist/cli/{prepare → build}/index.js +1 -1
  5. package/dist/cli/develop.js +1 -1
  6. package/dist/cli/stats/collectors/{openapi.d.ts → openapi/index.d.ts} +2 -2
  7. package/dist/cli/stats/collectors/openapi/index.js +1 -0
  8. package/dist/cli/stats/collectors/openapi/oas32.d.ts +15 -0
  9. package/dist/cli/stats/collectors/openapi/oas32.js +1 -0
  10. package/dist/cli/stats/index.js +1 -1
  11. package/dist/cli/utils/listen-stdin.d.ts +10 -0
  12. package/dist/cli/utils/listen-stdin.js +2 -0
  13. package/dist/client/TestProvider.js +1 -1
  14. package/dist/client/app/hooks/index.d.ts +1 -0
  15. package/dist/client/app/hooks/index.js +1 -1
  16. package/dist/client/app/hooks/useAnchorPositioning.d.ts +6 -0
  17. package/dist/client/app/hooks/useAnchorPositioning.js +1 -0
  18. package/dist/client/app/l10n/index.js +1 -1
  19. package/dist/client/app/search/useAiSearch.js +1 -1
  20. package/dist/client/app/search/useSearch.js +1 -1
  21. package/dist/client/app/seo/SeoTags.js +1 -1
  22. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  23. package/dist/client/templates/asyncapi-docs/template.js +1 -3
  24. package/dist/client/templates/openapi-docs/template.js +2 -6
  25. package/dist/client/types/ai-search.d.ts +1 -0
  26. package/dist/constants/l10n/langs/ar.js +1 -1
  27. package/dist/constants/l10n/langs/de.js +1 -1
  28. package/dist/constants/l10n/langs/en.js +1 -1
  29. package/dist/constants/l10n/langs/es.js +1 -1
  30. package/dist/constants/l10n/langs/fr.js +1 -1
  31. package/dist/constants/l10n/langs/hi.js +1 -1
  32. package/dist/constants/l10n/langs/it.js +1 -1
  33. package/dist/constants/l10n/langs/ja.js +1 -1
  34. package/dist/constants/l10n/langs/ko.js +1 -1
  35. package/dist/constants/l10n/langs/pl.js +1 -1
  36. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  37. package/dist/constants/l10n/langs/pt.js +1 -1
  38. package/dist/constants/l10n/langs/ru.js +1 -1
  39. package/dist/constants/l10n/langs/uk.js +1 -1
  40. package/dist/constants/l10n/langs/zh.js +1 -1
  41. package/dist/server/api-routes/execute-api-route.js +1 -1
  42. package/dist/server/config/env-schema.d.ts +3 -3
  43. package/dist/server/config/env-schemas/search.d.ts +2 -2
  44. package/dist/server/config/env-schemas/search.js +1 -1
  45. package/dist/server/constants/plugins/search.d.ts +0 -4
  46. package/dist/server/constants/plugins/search.js +1 -1
  47. package/dist/server/node-bundle-entry.js +1 -1
  48. package/dist/server/plugins/analytics/segment/browser-hooks.js +1 -1
  49. package/dist/server/plugins/analytics/segment/build-script.js +5 -2
  50. package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +37 -37
  51. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +7 -0
  52. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  53. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +22 -0
  54. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +29 -15
  55. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +6 -0
  56. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
  57. package/dist/server/plugins/entitlements/index.js +1 -1
  58. package/dist/server/plugins/entitlements/utils/get-billed-catalog-build-pages-count.d.ts +6 -0
  59. package/dist/server/plugins/entitlements/utils/get-billed-catalog-build-pages-count.js +1 -0
  60. package/dist/server/plugins/graphql-docs/index.js +1 -1
  61. package/dist/server/plugins/markdown/search/nodes/heading-node.js +1 -1
  62. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +25 -25
  63. package/dist/server/plugins/pages/validators/validate-react-pages.js +1 -1
  64. package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +1 -1
  65. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  66. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  67. package/dist/server/plugins/search/utils.js +1 -1
  68. package/dist/server/plugins/sidebars/index.d.ts +0 -1
  69. package/dist/server/plugins/sidebars/index.js +2 -2
  70. package/dist/server/ssr/template.js +3 -3
  71. package/dist/server/tools/notifiers/logger.d.ts +2 -2
  72. package/dist/server/tools/notifiers/logger.js +2 -2
  73. package/dist/server/tools/notifiers/reporter.d.ts +0 -1
  74. package/dist/server/tools/notifiers/reporter.js +6 -7
  75. package/dist/server/tools/notifiers/terminal-manager.d.ts +1 -1
  76. package/dist/server/tools/notifiers/terminal-manager.js +5 -4
  77. package/dist/server/utils/lifecycle-hooks.d.ts +2 -2
  78. package/dist/server/utils/rbac.js +1 -1
  79. package/dist/server/web-server/routes/catalog/catalog.js +1 -1
  80. package/dist/server/web-server/routes/catalog/helpers/upsert-pages-stats.d.ts +12 -0
  81. package/dist/server/web-server/routes/catalog/helpers/upsert-pages-stats.js +1 -0
  82. package/dist/server/web-server/routes/cors-proxy.js +2 -2
  83. package/package.json +13 -13
  84. package/dist/cli/stats/collectors/openapi.js +0 -1
  85. /package/dist/cli/{prepare → build}/analytics/collect-analytics.d.ts +0 -0
  86. /package/dist/cli/{prepare → build}/analytics/collect-analytics.js +0 -0
  87. /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.d.ts +0 -0
  88. /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.js +0 -0
  89. /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.d.ts +0 -0
  90. /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.js +0 -0
  91. /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.d.ts +0 -0
  92. /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.js +0 -0
  93. /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.d.ts +0 -0
  94. /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.js +0 -0
  95. /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.d.ts +0 -0
  96. /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.js +0 -0
  97. /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.d.ts +0 -0
  98. /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.js +0 -0
  99. /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.d.ts +0 -0
  100. /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.js +0 -0
  101. /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.d.ts +0 -0
  102. /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.js +0 -0
  103. /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.d.ts +0 -0
  104. /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.js +0 -0
  105. /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.d.ts +0 -0
  106. /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.js +0 -0
  107. /package/dist/cli/{prepare → build}/copy-env-files.d.ts +0 -0
  108. /package/dist/cli/{prepare → build}/copy-env-files.js +0 -0
  109. /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.d.ts +0 -0
  110. /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.js +0 -0
  111. /package/dist/cli/{prepare → build}/libsql/get-current-platform.d.ts +0 -0
  112. /package/dist/cli/{prepare → build}/libsql/get-current-platform.js +0 -0
@@ -1,3 +1,3 @@
1
- import{writeFileSync as tt}from"node:fs";import*as u from"path";import et from"@markdoc/markdoc";import{withoutHash as ot}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as v,SIDEBAR_PREFIX as at,CONFIG_FILE_NAME as V}from"../../../constants/common.js";import{CATALOG_OUTPUT_FILE_NAME as rt}from"../../constants/common.js";import{findDeepFirst as M}from"../../../utils/tree/find-deep-first.js";import{isDefined as X}from"../../../utils/guards/is-defined.js";import{partition as it}from"../../../utils/array/partition.js";import{collectPropValueDeep as N}from"../../../utils/tree/collect-prop-value-deep.js";import{envConfig as nt}from"../../config/env-config.js";import{isLocalLink as st}from"../../../utils/path/is-local-link.js";import{normalizeRouteSlug as Y}from"../../../utils/path/normalize-route-slug.js";import{slash as lt}from"../../../utils/path/slash.js";import{parsePathVersions as ct}from"../../../utils/path/parse-path-versions.js";import{reporter as A}from"../../tools/notifiers/reporter.js";import{logger as x}from"../../tools/notifiers/logger.js";import{sha1 as ft}from"../../utils/crypto/sha1.js";import{getInnerText as dt}from"../../../markdoc/helpers/get-inner-text.js";import{collectItemsLinkedToSidebars as ut,resolveItems as Z}from"../nav-utils.js";import{getExcludedFromLinkCheckerPatterns as mt,getSidebarReferences as gt,hasCircularDependency as pt}from"./utils.js";import{getLocaleFromRelativePath as ht}from"../../fs/utils/get-locale-from-relative-path.js";import{isSystemRouteSlug as St}from"../../utils/system-routes.js";import{ENTITIES_MAP_GLOBAL_DATA_KEY as yt}from"../../constants/plugins/catalog-entities.js";import{telemetryTraceStep as bt}from"../../../cli/telemetry/helpers/trace-step.js";const Ft=180,It=170,Ct=10;async function Jt({contentDir:l}){return{id:"sidebars",async afterRoutesCreated(o,i){await bt("build.plugin.sidebars",async()=>{const{cache:d,fs:c}=i,I=o.getConfig(),C=new Map,D=new Set,B=[v,...c.localeFolders],j=o.getGlobalData()[yt]||{},G=new Map;let L=c.scan(/sidebars.yaml$/).map(({relativePath:t})=>t).filter(t=>!wt(I.ignore??[],t)&&t);const $=await gt(i,l,L),q=it(L.filter(t=>!$.has(t)),t=>ct(t)?.versionFolderPath||t),_=mt(I),Q=await ut(I?.navbar,o,i,{navFile:V,excludedFromLinkCheckerPatterns:_});let P;const T=pt($);T&&Array.isArray(T)&&await A.panicOnBuildContentError(`Sidebar references have circular dependency. Please check your sidebar files.
1
+ import{writeFileSync as tt}from"node:fs";import*as u from"path";import et from"@markdoc/markdoc";import{withoutHash as ot}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as v,SIDEBAR_PREFIX as at,CONFIG_FILE_NAME as V}from"../../../constants/common.js";import{CATALOG_OUTPUT_FILE_NAME as rt}from"../../constants/common.js";import{findDeepFirst as M}from"../../../utils/tree/find-deep-first.js";import{isDefined as X}from"../../../utils/guards/is-defined.js";import{partition as it}from"../../../utils/array/partition.js";import{collectPropValueDeep as N}from"../../../utils/tree/collect-prop-value-deep.js";import{envConfig as nt}from"../../config/env-config.js";import{isLocalLink as st}from"../../../utils/path/is-local-link.js";import{normalizeRouteSlug as Y}from"../../../utils/path/normalize-route-slug.js";import{slash as lt}from"../../../utils/path/slash.js";import{parsePathVersions as ct}from"../../../utils/path/parse-path-versions.js";import{reporter as k}from"../../tools/notifiers/reporter.js";import{logger as B}from"../../tools/notifiers/logger.js";import{sha1 as ft}from"../../utils/crypto/sha1.js";import{getInnerText as dt}from"../../../markdoc/helpers/get-inner-text.js";import{collectItemsLinkedToSidebars as ut,resolveItems as J}from"../nav-utils.js";import{getExcludedFromLinkCheckerPatterns as mt,getSidebarReferences as gt,hasCircularDependency as pt}from"./utils.js";import{getLocaleFromRelativePath as ht}from"../../fs/utils/get-locale-from-relative-path.js";import{isSystemRouteSlug as St}from"../../utils/system-routes.js";import{ENTITIES_MAP_GLOBAL_DATA_KEY as yt}from"../../constants/plugins/catalog-entities.js";import{telemetryTraceStep as Ft}from"../../../cli/telemetry/helpers/trace-step.js";import{isPathIgnored as It}from"../../utils/paths.js";const bt=180,Ct=170,Dt=10;async function Qt({contentDir:c}){return{id:"sidebars",async afterRoutesCreated(o,s){await Ft("build.plugin.sidebars",async()=>{const{cache:f,fs:d}=s,b=o.getConfig(),C=new Map,D=new Set,x=[v,...d.localeFolders],j=o.getGlobalData()[yt]||{},G=new Map;let R=d.scan(/sidebars.yaml$/).map(({relativePath:t})=>t).filter(t=>!It(t,b.ignore??[])&&t);const $=await gt(s,c,R),Q=it(R.filter(t=>!$.has(t)),t=>ct(t)?.versionFolderPath||t),_=mt(b),Z=await ut(b?.navbar,o,s,{navFile:V,excludedFromLinkCheckerPatterns:_});let P;const T=pt($);T&&Array.isArray(T)&&await k.panicOnBuildContentError(`Sidebar references have circular dependency. Please check your sidebar files.
2
2
  Circular dependency chain: ${T.reverse().join(" -> ")}
3
- `);for(const t of q){const m=(await Promise.all(t.map(async n=>{const e=(await d.load(n,"yaml")).data;if(!Array.isArray(e)){await A.panicOnBuildContentErrorForRealFile('Invalid sidebar contents at %rp, items should be an array, got "%s"',n,c,n,typeof e);return}return{items:e,sidebarRelativePath:n,locale:ht(n)}}))).filter(X),r=(await k(m))?.firstLink;P||(P=r)}const z=Object.entries(I?.catalogClassic??{});for(const t of B){for(const[e,s]of z)await W(e,s,t);const m={},r=new Set,n=o.getAllRoutesForLocale(t);for(const e of n)if(U(e)&&e.fsPath&&!r.has(e.fsPath)){r.add(e.fsPath);let f=u.posix.dirname(e.fsPath);const h=u.parse(f).root;do m[f]=(m[f]||0)+1,f=u.dirname(f);while(f&&f!="."&&h!=f)}for(const e of n){if(C.has(e.slug))continue;const s=U(e),f=u.dirname(e.fsPath),h=m[f]===1,g=vt(e.baseSlug||e.slug);s&&h?await k([{items:[{directory:f}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}]):e.getSidebar!==void 0&&await k([{items:[{page:e.fsPath}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}])}for(const[e,s]of z)await W(e,s,t,!0)}if(L.length===0)for(const t of B){x.verbose("Creating default sidebar");const m=t===v,r=`sidebars.yaml${m?"":"_"+t}`,n=m?"":`${c.localizationFolder}/${t}`,e=(await k([{items:[{directory:`./${n}`}],sidebarRelativePath:r,locale:t,ignoredRoutes:D}]))?.firstLink;P||(P=e)}if(!o.getRouteBySlug("/")&&!o.getConfig().redirects?.["/"]){const m=o.getAllRoutes().find(n=>!St(n.slug)),r=P?P.link:m?.baseSlug??null;if(r){const n=ot(r);o.addRedirect("/",{to:n,type:302}),x.info("Creating default redirect for index page => %s",n)}}const H=nt.REDOCLY_METADATA_OUTPUT_FOLDER;H&&(x.info("Writing catalog data..."),tt(u.join(H,rt),JSON.stringify(Object.fromEntries(G.entries()))));function U(t){return D.has(t.slug)||j[t.fsPath]}async function k(t){if(t.length===0)return;const r=(await Promise.all(t.map(async({items:g,locale:F,sidebarRelativePath:p,ignoredRoutes:R})=>{const a=await Z(g,u.dirname(u.join(l,p)),o,i,{locale:F,ignoredRoutes:R,navFile:p,excludedFromLinkCheckerPatterns:_});if(!a){await A.panicOnBuild("Failed to resolve sidebar configuration. Make sure %rp is valid",p);return}return a}))).flat().filter(X),n=N(r,"routeSlug"),e=t[0].sidebarRelativePath,s=J(e),f=new Set;for(const g of n){const F=o.getRouteBySlug(g)?.fsPath??"",p=j[F];p&&(Array.from(f).find(a=>a.key===p.key&&a.version===p.version)||f.add(p)),o.addRouteSharedData(g,"sidebar",s),C.set(Y(g),r)}const h=f.size===1?Array.from(f)[0]:void 0;return await o.createSharedData(s,{relatedNavbarItem:Q?.get(e),items:r,catalogEntity:h?{key:h.key,version:h.version}:void 0}),{firstLink:M(r,g=>!!g.link),resolved:r}}async function W(t,m,r,n=!1){const e=structuredClone(m);r&&r!==v&&e.items.forEach(a=>{a.directory=u.posix.join(c.localizationFolder||"",r,a.directory||"")});let s=await Z(e.items,l,o,i,{groupCustomSidebars:!0,locale:r,navFile:V,excludedFromLinkCheckerPatterns:_});if(s&&(s=Pt(s)),!s){await A.panicOnBuild(`Failed to resolve catalog configuration. Make sure catalog ${t} has valid config`);return}const f=r===v?"":"/"+r.toLowerCase(),h=r===v?"":`-${r}`,g=Y(u.posix.join(f,e.slug));if(n)for(const a of s){const S=M(a.items||[],b=>!!b.routeSlug);if(!S?.routeSlug)continue;const y=C.get(S.routeSlug);if(!y)continue;const O=N(y,"routeSlug"),E="current-catalog-info-"+a.routeSlug+h,w={catalog:{label:e.title,titleTranslationKey:e.titleTranslationKey,link:g,icon:e?.icon},item:{label:a.metadata?.title,link:a.link,icon:a.icon}};await o.createSharedData(E,w);for(const b of O)o.addRouteSharedData(b,"current-catalog-info",E),D.add(b);const K=M(y,b=>!!b.link&&!b.external&&st(b.link)&&(!a.version||b.version===a.version));K&&(a.sidebar=[{...K,items:void 0}])}const F={},p=new Set;for(const a of s){if(!(a.routeSlug||a.sidebar?.[0]?.routeSlug)||!a.fsPath||p.has(a.fsPath))continue;p.add(a.fsPath);const y=u.dirname(a.fsPath);F[y]=(F[y]||0)+1}if(n){const a=await o.createSharedData("catalog-"+t+h,s.flatMap(S=>{const y=u.dirname(S.fsPath??""),O=F[y]===1,E=w=>({...w,fsPath:O?y:w.fsPath??""});return S.type==="group"&&S.items?.every(w=>w.type==="group")?(S.items||[]).map(E):E(S)}));o.addRouteSharedData(g,"catalog",a),Dt(r,s,G,F)}const R=N(s,"routeSlug");for(const a of R)D.add(a)}})}}}function Dt(l,o,i,d){if(l===v)for(const c of o){const I=c.routeSlug||c.sidebar?.[0]?.routeSlug;if(!I||!c.fsPath)continue;const C=u.dirname(c.fsPath),D=d[C]===1;i.set(I,{rootFileFsPath:c.fsPath,fsPath:D?C:c.fsPath,metadata:c.metadata||{},title:c.metadata?.title||c.label||"Untitled",version:c.version||"latest"})}}function Pt(l){const o=i=>{if(!i)return i;const d=et.parse(i);return dt([d])};return l.map(i=>{const d={...i};return d.metadata?.description&&(d.metadata={...d.metadata,description:o(d.metadata.description)}),d})}function J(l){return at+lt(l)}async function qt(l,o,i){const d=u.posix.join(u.dirname(l),o);return await i.exists(d)?J(d):(await A.panicOnBuildContentErrorForRealFile("File %rp: Failed to create relative path for sidebars.yaml using %s",l,i,l,o),null)}function wt(l,o){const i=/\/?([a-zA-Z0-9-_]+\/)*sidebars?(-[a-zA-Z0-9-_]+)?\.yaml/;return l.filter(c=>i.test(c)).includes(o)}function vt(l){const o=l.replaceAll("/","_");if(o.length>Ft){const i=o.slice(0,It),d=ft(l).slice(0,Ct).replaceAll("/","_");return i+d}else return o}export{wt as isSidebarIgnored,Pt as removeMarkdownTags,qt as resolveSidebarId,Jt as sidebarsPlugin};
3
+ `);for(const t of Q){const m=(await Promise.all(t.map(async i=>{const e=(await f.load(i,"yaml")).data;if(!Array.isArray(e)){await k.panicOnBuildContentErrorForRealFile('Invalid sidebar contents at %rp, items should be an array, got "%s"',i,d,i,typeof e);return}return{items:e,sidebarRelativePath:i,locale:ht(i)}}))).filter(X),r=(await A(m))?.firstLink;P||(P=r)}const H=Object.entries(b?.catalogClassic??{});for(const t of x){for(const[e,n]of H)await z(e,n,t);const m={},r=new Set,i=o.getAllRoutesForLocale(t);for(const e of i)if(W(e)&&e.fsPath&&!r.has(e.fsPath)){r.add(e.fsPath);let l=u.posix.dirname(e.fsPath);const h=u.parse(l).root;do m[l]=(m[l]||0)+1,l=u.dirname(l);while(l&&l!="."&&h!=l)}for(const e of i){if(C.has(e.slug))continue;const n=W(e),l=u.dirname(e.fsPath),h=m[l]===1,g=vt(e.baseSlug||e.slug);n&&h?await A([{items:[{directory:l}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}]):e.getSidebar!==void 0&&await A([{items:[{page:e.fsPath}],sidebarRelativePath:"sidebar.yaml_"+g,locale:t}])}for(const[e,n]of H)await z(e,n,t,!0)}if(R.length===0)for(const t of x){B.verbose("Creating default sidebar");const m=t===v,r=`sidebars.yaml${m?"":"_"+t}`,i=m?"":`${d.localizationFolder}/${t}`,e=(await A([{items:[{directory:`./${i}`}],sidebarRelativePath:r,locale:t,ignoredRoutes:D}]))?.firstLink;P||(P=e)}if(!o.getRouteBySlug("/")&&!o.getConfig().redirects?.["/"]){const m=o.getAllRoutes().find(i=>!St(i.slug)),r=P?P.link:m?.baseSlug??null;if(r){const i=ot(r);o.addRedirect("/",{to:i,type:302}),B.info("Creating default redirect for index page => %s",i)}}const U=nt.REDOCLY_METADATA_OUTPUT_FOLDER;U&&(B.info("Writing catalog data..."),tt(u.join(U,rt),JSON.stringify(Object.fromEntries(G.entries()))));function W(t){return D.has(t.slug)||j[t.fsPath]}async function A(t){if(t.length===0)return;const r=(await Promise.all(t.map(async({items:g,locale:I,sidebarRelativePath:p,ignoredRoutes:L})=>{const a=await J(g,u.dirname(u.join(c,p)),o,s,{locale:I,ignoredRoutes:L,navFile:p,excludedFromLinkCheckerPatterns:_});if(!a){await k.panicOnBuild("Failed to resolve sidebar configuration. Make sure %rp is valid",p);return}return a}))).flat().filter(X),i=N(r,"routeSlug"),e=t[0].sidebarRelativePath,n=q(e),l=new Set;for(const g of i){const I=o.getRouteBySlug(g)?.fsPath??"",p=j[I];p&&(Array.from(l).find(a=>a.key===p.key&&a.version===p.version)||l.add(p)),o.addRouteSharedData(g,"sidebar",n),C.set(Y(g),r)}const h=l.size===1?Array.from(l)[0]:void 0;return await o.createSharedData(n,{relatedNavbarItem:Z?.get(e),items:r,catalogEntity:h?{key:h.key,version:h.version}:void 0}),{firstLink:M(r,g=>!!g.link),resolved:r}}async function z(t,m,r,i=!1){const e=structuredClone(m);r&&r!==v&&e.items.forEach(a=>{a.directory=u.posix.join(d.localizationFolder||"",r,a.directory||"")});let n=await J(e.items,c,o,s,{groupCustomSidebars:!0,locale:r,navFile:V,excludedFromLinkCheckerPatterns:_});if(n&&(n=wt(n)),!n){await k.panicOnBuild(`Failed to resolve catalog configuration. Make sure catalog ${t} has valid config`);return}const l=r===v?"":"/"+r.toLowerCase(),h=r===v?"":`-${r}`,g=Y(u.posix.join(l,e.slug));if(i)for(const a of n){const S=M(a.items||[],F=>!!F.routeSlug);if(!S?.routeSlug)continue;const y=C.get(S.routeSlug);if(!y)continue;const O=N(y,"routeSlug"),E="current-catalog-info-"+a.routeSlug+h,w={catalog:{label:e.title,titleTranslationKey:e.titleTranslationKey,link:g,icon:e?.icon},item:{label:a.metadata?.title,link:a.link,icon:a.icon}};await o.createSharedData(E,w);for(const F of O)o.addRouteSharedData(F,"current-catalog-info",E),D.add(F);const K=M(y,F=>!!F.link&&!F.external&&st(F.link)&&(!a.version||F.version===a.version));K&&(a.sidebar=[{...K,items:void 0}])}const I={},p=new Set;for(const a of n){if(!(a.routeSlug||a.sidebar?.[0]?.routeSlug)||!a.fsPath||p.has(a.fsPath))continue;p.add(a.fsPath);const y=u.dirname(a.fsPath);I[y]=(I[y]||0)+1}if(i){const a=await o.createSharedData("catalog-"+t+h,n.flatMap(S=>{const y=u.dirname(S.fsPath??""),O=I[y]===1,E=w=>({...w,fsPath:O?y:w.fsPath??""});return S.type==="group"&&S.items?.every(w=>w.type==="group")?(S.items||[]).map(E):E(S)}));o.addRouteSharedData(g,"catalog",a),Pt(r,n,G,I)}const L=N(n,"routeSlug");for(const a of L)D.add(a)}})}}}function Pt(c,o,s,f){if(c===v)for(const d of o){const b=d.routeSlug||d.sidebar?.[0]?.routeSlug;if(!b||!d.fsPath)continue;const C=u.dirname(d.fsPath),D=f[C]===1;s.set(b,{rootFileFsPath:d.fsPath,fsPath:D?C:d.fsPath,metadata:d.metadata||{},title:d.metadata?.title||d.label||"Untitled",version:d.version||"latest"})}}function wt(c){const o=s=>{if(!s)return s;const f=et.parse(s);return dt([f])};return c.map(s=>{const f={...s};return f.metadata?.description&&(f.metadata={...f.metadata,description:o(f.metadata.description)}),f})}function q(c){return at+lt(c)}async function Zt(c,o,s){const f=u.posix.join(u.dirname(c),o);return await s.exists(f)?q(f):(await k.panicOnBuildContentErrorForRealFile("File %rp: Failed to create relative path for sidebars.yaml using %s",c,s,c,o),null)}function vt(c){const o=c.replaceAll("/","_");if(o.length>bt){const s=o.slice(0,Ct),f=ft(c).slice(0,Dt).replaceAll("/","_");return s+f}else return o}export{wt as removeMarkdownTags,Zt as resolveSidebarId,Qt as sidebarsPlugin};
@@ -1,4 +1,4 @@
1
- import{withPathPrefix as p}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as y}from"../../constants/common.js";import{RUNTIME_RESOURCES_DIR as E}from"../constants/common.js";import{INIT_BROWSER_HOOKS_SCRIPT as R}from"./init-browser-hooks-script.js";const _="";function w({bodyHtml:r,linkTags:i,title:m,favicon:e,preload:n,headScriptTags:$,postBodyScriptTags:s,preBodyScriptTags:l,lang:t,productClass:o,fonts:a=_,runtimeCss:h}){const c=t&&t!=y?` lang="${t}"`:"",d=o?` class="${o}"`:"";return`<!doctype html>
1
+ import{withPathPrefix as p}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as y}from"../../constants/common.js";import{RUNTIME_RESOURCES_DIR as E}from"../constants/common.js";import{INIT_BROWSER_HOOKS_SCRIPT as R}from"./init-browser-hooks-script.js";const _="";function w({bodyHtml:r,linkTags:i,title:m,favicon:e,preload:n,headScriptTags:$,postBodyScriptTags:l,preBodyScriptTags:s,lang:t,productClass:o,fonts:a=_,runtimeCss:h}){const c=t&&t!=y?` lang="${t}"`:' lang="en"',d=o?` class="${o}"`:"";return`<!doctype html>
2
2
  <html${c}${d}>
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -17,9 +17,9 @@ import{withPathPrefix as p}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE
17
17
  ${h||""}
18
18
  </head>
19
19
  <body>
20
- ${l||""}
20
+ ${s||""}
21
21
  <div id="app_root">${r}</div>
22
22
  <script async type="module" src="${p(E)}/browser-entry.js"></script>
23
- ${s||""}
23
+ ${l||""}
24
24
  </body>
25
25
  </html>`}export{w as htmlTemplate};
@@ -14,12 +14,12 @@ export type LoggerContext = {
14
14
  };
15
15
  type LoggerOptions = {
16
16
  context?: LoggerContext;
17
- forceNonInteractive?: boolean;
17
+ allowInteractive?: boolean;
18
18
  minLogLevel?: LogLevel;
19
19
  };
20
20
  export declare class Logger {
21
21
  #private;
22
- constructor({ context, forceNonInteractive, minLogLevel }?: LoggerOptions);
22
+ constructor({ context, allowInteractive, minLogLevel }?: LoggerOptions);
23
23
  shouldLog(level: LogLevel): boolean;
24
24
  info(message: string, ...args: unknown[]): void;
25
25
  infoTime(timingId: symbol | string, message: string, ...args: unknown[]): {
@@ -1,2 +1,2 @@
1
- import{telemetry as c}from"../../telemetry/index.js";import{envConfig as l}from"../../config/env-config.js";import h,{LogLevel as r,shouldLog as m,parseLogLevel as u}from"./formatter.js";import{isVirtualFile as f}from"../../fs/utils/isVirtualFile.js";import{TerminalManager as g}from"./terminal-manager.js";class p{#e;#l;#i;#n;#r=new Map;#o=new Map;constructor({context:t,forceNonInteractive:e,minLogLevel:i}={}){this.#e=t,this.#l=l.isProductionEnv,this.#i=new g(e),this.#n=i??u(l.REDOCLY_LOG_LEVEL)??(l.isDevelopMode?r.INFO:r.HTTP)}shouldLog(t){return m(t,this.#n)}info(t,...e){this.#t({level:r.INFO,message:t,args:e})}infoTime(t,e,...i){return this.#s(r.INFO,e,t,...i)}success(t,...e){this.#t({level:r.SUCCESS,message:t,args:e})}logInFooter(t,e,...i){const o=h.interpolate(e,...i)+`
2
- `;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!m(t,this.#n))return;let s=e&&h.interpolate(e,...n);s&&i!=null&&t!==r.VERBOSE&&c.sendTimingPerformedMessage([{object:"timing",timeMs:i,message:s}]);const a={level:t,message:s,duration:i,scope:o,context:this.#e};process.stderr.write(h.format(a))}}const R=new p;export{p as Logger,R as logger};
1
+ import{telemetry as c}from"../../telemetry/index.js";import{envConfig as l}from"../../config/env-config.js";import h,{LogLevel as r,shouldLog as m,parseLogLevel as u}from"./formatter.js";import{isVirtualFile as f}from"../../fs/utils/isVirtualFile.js";import{TerminalManager as g}from"./terminal-manager.js";class p{#e;#l;#i;#n;#r=new Map;#o=new Map;constructor({context:t,allowInteractive:e,minLogLevel:i}={}){this.#e=t,this.#l=l.isProductionEnv,this.#i=new g(e),this.#n=i??u(l.REDOCLY_LOG_LEVEL)??(l.isDevelopMode?r.INFO:r.HTTP)}shouldLog(t){return m(t,this.#n)}info(t,...e){this.#t({level:r.INFO,message:t,args:e})}infoTime(t,e,...i){return this.#s(r.INFO,e,t,...i)}success(t,...e){this.#t({level:r.SUCCESS,message:t,args:e})}logInFooter(t,e,...i){const o=h.interpolate(e,...i)+`
2
+ `;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!m(t,this.#n))return;let s=e&&h.interpolate(e,...n);s&&i!=null&&t!==r.VERBOSE&&c.sendTimingPerformedMessage([{object:"timing",timeMs:i,message:s}]);const a={level:t,message:s,duration:i,scope:o,context:this.#e};process.stderr.write(h.format(a))}}const R=new p({allowInteractive:!0});export{p as Logger,R as logger};
@@ -109,7 +109,6 @@ export declare class Reporter {
109
109
  rawLink: string;
110
110
  }) | PageRenderError)[];
111
111
  printErrors(errors?: Array<MarkdocError | CommonError>): void;
112
- listenStdin(): void;
113
112
  }
114
113
  export declare const reporter: Reporter;
115
114
  //# sourceMappingURL=reporter.d.ts.map
@@ -1,12 +1,11 @@
1
- import{envConfig as h}from"../../config/env-config.js";import{logger as e}from"../../tools/notifiers/logger.js";import P from"./formatter.js";import{blue as g,gray as p,red as c}from"./helpers/colors.js";import{isVirtualFile as b}from"../../fs/utils/isVirtualFile.js";import{telemetry as u}from"../../telemetry/index.js";import{shutdowner as f}from"../shutdowner.js";const a=30;class C{#r=[];#o=[];#e=new Map;#t=[];pushError(r,t,...o){const i=P.interpolate(r,...o);this.#r.push({severity:t,message:i,type:"ERROR"})}reportBrokenLink(r){this.#r.push(r)}reportCompilationError(r){const t=`${r.message}::${r.sourceFileRelativePath}::${r?.sourceFileLocation?.line}`;this.#e.has(t)||this.#e.set(t,r)}reportPageRenderError(r){this.#t.push(r)}async panicOnBuild(r,...t){r instanceof Error&&(r=r.message+`
2
- `+r.stack),h.isBuildMode?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,o,...i){b(t,o)||await this.panicOnBuildContentError(r,...i)}async panicOnBuildContentError(r,...t){r instanceof Error&&(r=r.message+`
1
+ import{envConfig as h}from"../../config/env-config.js";import{logger as e}from"../../tools/notifiers/logger.js";import P from"./formatter.js";import{blue as g,gray as p,red as a}from"./helpers/colors.js";import{isVirtualFile as C}from"../../fs/utils/isVirtualFile.js";import{telemetry as u}from"../../telemetry/index.js";import{shutdowner as f}from"../shutdowner.js";const c=30;class b{#r=[];#o=[];#e=new Map;#t=[];pushError(r,t,...o){const n=P.interpolate(r,...o);this.#r.push({severity:t,message:n,type:"ERROR"})}reportBrokenLink(r){this.#r.push(r)}reportCompilationError(r){const t=`${r.message}::${r.sourceFileRelativePath}::${r?.sourceFileLocation?.line}`;this.#e.has(t)||this.#e.set(t,r)}reportPageRenderError(r){this.#t.push(r)}async panicOnBuild(r,...t){r instanceof Error&&(r=r.message+`
2
+ `+r.stack),h.isBuildMode?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,o,...n){C(t,o)||await this.panicOnBuildContentError(r,...n)}async panicOnBuildContentError(r,...t){r instanceof Error&&(r=r.message+`
3
3
  `+r.stack),h.isBuildMode?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
4
4
  `+r.stack):o=new Error(r),e.error(r,...t),u.sendCliErrorCaughtMessage([{object:"cli",message:r}]),await f.exitWithCode(1,o)}async panicOnContentError(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
5
- `+r.stack):o=new Error(r),e.contentError(r,...t),u.sendCliErrorCaughtMessage([{object:"cli",message:r,scope:"content"}]),await f.exitWithCode(1,o)}reportMarkdocProblem(r){this.#o.push(r)}clearErrors(){this.#r=[]}clearMarkdocProblems(){this.#o=[]}clearEsbuildProblems(){this.#e.clear()}clearPageRenderProblems(){this.#t=[]}getCompilationProblem(r){return this.#e.get(r)}getCompilationProblems(){return[...this.#e.values()]}getPageRenderProblems(){return this.#t}getPageRenderProblem(r){return this.#t.find(t=>t.sourceFileRelativePath===r)}getProblems(){return[...this.#r,...this.getCompilationProblems(),...this.#o,...this.#t]}summary(r,t=0){const o=this.getProblems(),i=this.#o.filter(l=>l.type==="BROKEN_LINK").length,s=this.#r.filter(l=>l.type==="BROKEN_LINK").length,m=this.#o.length-i,E=this.#r.length-s+this.getCompilationProblems().length+this.#t.length;return e.logInFooter("validate",o.length?c(" \u274C Status: %s markdoc errors, %s broken links, %s other errors"):" \u2705 Status: No errors found",m,i+s,E),t!==0&&e.logInFooter("pages",` \u{1F4C4} Total pages: ${t}`),e.logInFooter("timing",r),e.logInFooter("validate-sep",""),e.isInteractive()&&(o.length?e.logInFooter("actions","Press (e) to print all errors, (q) to quit"):e.logInFooter("actions",p("Press (q) to quit"))),o}printErrors(r=[]){const t=this.#r.length,o=r.length?r:this.getProblems();let i=0;for(const s of o.slice(0,a))i>=t?e.contentError(c(`[${++i}] `)+d(s)):e.error(c(`[${++i}] `)+d(s));o.length>a&&e.error(`... and ${o.length-a} more errors`)}listenStdin(){if(!e.isInteractive())return;process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");const r=this.printErrors.bind(this);process.stdin.on("data",function(t){if(t===""&&process.exit(),t==="\x7F"){process.stdout.write("\b \b");return}if(t==="\r"){process.stdout.write(`
6
- `);return}if(t==="e"){r();return}t==="q"&&process.exit(0)})}}const $=new C;function d(n){const r=n.sourceFileLocation,t=r?`:${r.line}:${r.character??1}`:"";return n.message+(n.codeframe?`
5
+ `+r.stack):o=new Error(r),e.contentError(r,...t),u.sendCliErrorCaughtMessage([{object:"cli",message:r,scope:"content"}]),await f.exitWithCode(1,o)}reportMarkdocProblem(r){this.#o.push(r)}clearErrors(){this.#r=[]}clearMarkdocProblems(){this.#o=[]}clearEsbuildProblems(){this.#e.clear()}clearPageRenderProblems(){this.#t=[]}getCompilationProblem(r){return this.#e.get(r)}getCompilationProblems(){return[...this.#e.values()]}getPageRenderProblems(){return this.#t}getPageRenderProblem(r){return this.#t.find(t=>t.sourceFileRelativePath===r)}getProblems(){return[...this.#r,...this.getCompilationProblems(),...this.#o,...this.#t]}summary(r,t=0){const o=this.getProblems(),n=this.#o.filter(s=>s.type==="BROKEN_LINK").length,l=this.#r.filter(s=>s.type==="BROKEN_LINK").length,d=this.#o.length-n,E=this.#r.length-l+this.getCompilationProblems().length+this.#t.length;return e.logInFooter("validate",o.length?a(" \u274C Status: %s markdoc errors, %s broken links, %s other errors"):" \u2705 Status: No errors found",d,n+l,E),t!==0&&e.logInFooter("pages",` \u{1F4C4} Total pages: ${t}`),e.logInFooter("timing",r),e.logInFooter("validate-sep",""),e.isInteractive()&&(o.length?e.logInFooter("actions","Press (e) to print all errors, (q) to quit"):e.logInFooter("actions",p("Press (q) to quit"))),o}printErrors(r=[]){const t=this.#r.length,o=r.length?r:this.getProblems();let n=0;for(const l of o.slice(0,c))n>=t?e.contentError(a(`[${++n}] `)+m(l)):e.error(a(`[${++n}] `)+m(l));o.length>c&&e.error(`... and ${o.length-c} more errors`)}}const $=new b;function m(i){const r=i.sourceFileLocation,t=r?`:${r.line}:${r.character??1}`:"";return i.message+(i.codeframe?`
7
6
 
8
- `+n.codeframe+`
7
+ `+i.codeframe+`
9
8
 
10
9
  `:`
11
- `)+(n.sourceFileRelativePath?p(`at ${g("./"+n.sourceFileRelativePath)}${t}`)+`
12
- `:"")}export{C as Reporter,$ as reporter};
10
+ `)+(i.sourceFileRelativePath?p(`at ${g("./"+i.sourceFileRelativePath)}${t}`)+`
11
+ `:"")}export{b as Reporter,$ as reporter};
@@ -1,6 +1,6 @@
1
1
  export declare class TerminalManager {
2
2
  #private;
3
- constructor(forceNonInteractive?: boolean);
3
+ constructor(allowInteractive?: boolean);
4
4
  isInteractive(): boolean;
5
5
  isFooterChanged(id: string, content: string): boolean;
6
6
  updateFooter(id: string, content: string): void;
@@ -1,5 +1,6 @@
1
- import{envConfig as h}from"../../config/env-config.js";import{gray as p}from"./helpers/colors.js";const t="\x1B[",i=`${t}s`,o=`${t}u`,d=`${t}J`,a=c=>`${t}1;${c}r`,f=`${t}r`,w=`${t}?25h`,R=`${t}?25l`,l=()=>`${p("\u2500".repeat(process.stderr.columns||80))}
1
+ import{envConfig as p}from"../../config/env-config.js";import{gray as w}from"./helpers/colors.js";const t="\x1B[",l=`${t}6n`,i=`${t}s`,c=`${t}u`,f=`${t}J`,h=n=>`${t}1;${n}r`,d=`${t}r`,u=`${t}?25h`,R=`${t}?25l`,I=()=>`${w("\u2500".repeat(process.stderr.columns||80))}
2
2
 
3
- `,u=3;class I{#r=new Map;#s=process.stderr.rows;#e=0;#t=!1;#i=!1;constructor(r=!1){this.#i=r}isInteractive(){return!!(!this.#i&&process.stderr&&process.stderr.isTTY&&h.TERM!=="dumb"&&!("CI"in process.env)&&h.isDevelopMode)}isFooterChanged(r,s){return this.#r.get(r)!==s}updateFooter(r,s){const e=!this.#r.has(r);this.#r.set(r,s),this.isInteractive()&&(e?this.#n():this.#c())}get#o(){if(this.#r.size===0)return 0;let r=u;for(const s of this.#r.values())r+=(s.match(/\n/g)||[]).length;return r}#c(){if(!this.isInteractive()||this.#r.size===0)return;this.#h();const r=this.#o,s=process.stderr.rows;if(!(r>s)){process.stderr.write(i),process.stderr.cursorTo(0,s-r+1),process.stderr.write(l());for(const e of this.#r.values())process.stderr.write(e);process.stderr.write(o)}}#n(r=0){if(!this.isInteractive())return;const s=process.stderr.rows;let e=this.#o;e>s&&(e=0);const n=e-this.#e;this.#e=e,n>0&&(process.stderr.write(i),process.stderr.write(`
4
- `.repeat(n)),process.stderr.write(o)),process.stderr.write(i),process.stderr.write(d),r<0&&process.stderr.write(`
5
- `.repeat(e)),process.stderr.write(a(s-e)),process.stderr.write(o),this.#c()}#h(){this.#t||(this.#t=!0,process.stderr.write(R),process.on("exit",this.#p),process.stderr.on("resize",this.#d))}#p=()=>{this.isInteractive()&&(process.stderr.write(f),process.stderr.write(`${t}${process.stderr.rows};1H`),process.stderr.write(w))};#d=()=>{const r=process.stderr.rows-this.#s;this.#s=process.stderr.rows,this.#n(r)}}export{I as TerminalManager};
3
+ `,g=3;class T{#s=new Map;#t=process.stderr.rows;#o=0;#i=!1;#c=!1;#r;constructor(s=!1){this.#c=s,this.isInteractive()&&(this.#a(),process.stderr.write(l))}isInteractive(){return!!(this.#c&&process.stderr&&process.stderr.isTTY&&p.TERM!=="dumb"&&!("CI"in process.env)&&p.isDevelopMode)}isFooterChanged(s,r){return this.#s.get(s)!==r}updateFooter(s,r){const e=!this.#s.has(s);this.#s.set(s,r),this.isInteractive()&&(e?this.#p():this.#n())}get#e(){if(this.#s.size===0)return 0;let s=g;for(const r of this.#s.values())s+=(r.match(/\n/g)||[]).length;return s}#n(){if(!this.isInteractive()||this.#s.size===0||!this.#r)return;this.#h();const s=this.#e,r=process.stderr.rows;if(!(s>r)){process.stderr.write(i),process.stderr.cursorTo(0,r-s-1),process.stderr.write(f),process.stderr.cursorTo(0,r-s+1),process.stderr.write(I());for(const e of this.#s.values())process.stderr.write(e);process.stderr.write(c)}}#p(s=0){if(!this.isInteractive())return;const r=process.stderr.rows;let e=this.#e;e>r&&(e=0);const o=e-this.#o;this.#o=e,o>0&&(process.stderr.write(i),process.stderr.write(`
4
+ `.repeat(o)),process.stderr.write(c)),process.stderr.write(i),s<0&&process.stderr.write(`
5
+ `.repeat(e)),process.stderr.write(h(r-e)),process.stderr.write(c),this.#n()}#h(){this.#i||!this.#r||(this.#i=!0,this.#d(),process.stderr.write(R),process.on("exit",this.#w),process.stderr.on("resize",this.#l))}#d(){if(!this.#r)return;const s=process.stderr.rows,{row:r}=this.#r,e=this.#e,o=s-e;r<o||(process.stderr.write(i),process.stderr.write(d),process.stderr.cursorTo(0,s-1),process.stderr.write(`
6
+ `.repeat(Math.max(0,r-e))),process.stderr.write(h(o)),process.stderr.write(c),process.stderr.cursorTo(0,0))}#a(){if(!this.isInteractive())return;process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");const s=/\[(\d+);(\d+)R/;process.stdin.once("data",r=>{if(s.test(r)){const e=s.exec(r);if(e){const o=parseInt(e[1],10),a=parseInt(e[2],10);this.#r={row:o,col:a}}}process.stdin.setRawMode(!1)})}#w=()=>{this.isInteractive()&&(process.stderr.write(d),process.stderr.write(`${t}${process.stderr.rows};1H`),process.stderr.write(u))};#l=()=>{const s=process.stderr.rows-this.#t;this.#t=process.stderr.rows,this.#p(s)}}export{T as TerminalManager};
@@ -1,6 +1,6 @@
1
1
  import type { DevelopArgs } from '../../cli/develop.js';
2
- import type { PrepareArgs } from '../../cli/prepare/index.js';
2
+ import type { BuildArgs } from '../../cli/build/index.js';
3
3
  import type { Store } from '../store.js';
4
4
  import { cliCommandNames } from '../../constants/common.js';
5
- export declare function beforeCommand(command: cliCommandNames, args: DevelopArgs | PrepareArgs, store: Store): Promise<void>;
5
+ export declare function beforeCommand(command: cliCommandNames, args: DevelopArgs | BuildArgs, store: Store): Promise<void>;
6
6
  //# sourceMappingURL=lifecycle-hooks.d.ts.map
@@ -1 +1 @@
1
- import h from"path";import O from"picomatch";import"../node-crypto-polyfill.js";import{REDOCLY_TEAMS_RBAC as D,REDOCLY_ROUTE_RBAC as R}from"@redocly/config";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as P,ServerRoutes as j,PUBLIC_RBAC_SCOPE_ITEM as A,RBAC_ALL_OTHER_TEAMS as u,DEFAULT_RBAC_SCOPE as _}from"../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as L,PUBLIC_API_DEFINITIONS_FOLDER as g,PUBLIC_ASSETS_FOLDER as F}from"../constants/common.js";import{removeTrailingSlash as w}from"../../utils/url/remove-trailing-slash.js";import{parsePathVersions as N}from"../../utils/path/parse-path-versions.js";import{reporter as B}from"../tools/notifiers/reporter.js";import{bold as k}from"../tools/notifiers/helpers/colors.js";import{shaDirPathShort as W}from"../utils/crypto/sha-dir-path-short.js";import{isTruthy as U}from"../../utils/guards/is-truthy.js";import{canExpandConfig as b,expandRbacConfig as M,getTeamFolderDefaults as $,parseTeamFoldersTemplate as v,parseTeamNameTemplate as Y}from"./rbac-expand.js";import{getUserParamsFromCookies as z}from"../web-server/auth.js";import{getDeeperGlobPattern as H}from"./globs.js";import{EntitlementsProvider as G}from"../entitlements/entitlements-provider.js";const S=["NONE","READ","TRIAGE","WRITE","MAINTAIN","ADMIN"],K=new Set(["x-parsed-md-description","x-parsed-md-summary"]);function dt(t,e){const n=S.indexOf(t.toUpperCase()),r=S.indexOf(e.toUpperCase());return n>r?t:e}const I={};function y(t,e){if(!t?.content)return A;const n=t.content,{slug:r,fsPath:o}=e;if(!r&&!o)return A;const s=f=>{const m=I[f]||O(f);return I[f]=m,!!(r&&m(r))||!!(o&&m(o))};if(V(r||o||"")&&Object.keys(n).filter(T=>s(T)).length===0)return n[_]||A;const c=Object.keys(n).filter(f=>s(f));if(c.length==0)return A;const l=c.map(f=>O.scan(f,{tokens:!0,parts:!0}));let p=l[0];for(let f=1;f<l.length;f++)p=H(p,l[f]);return n[p.input]}function ht(t,e,n={},r=!1){if(r&&Object.keys(n).length===0)return e.isAuthenticated;const o=n.features?.[t];return o?e.teams.some(s=>o[s]&&o[s].toLowerCase()!=="none"):!0}function Rt(t,e){return E(t,{isAuthenticated:!1,teams:[P]},e.rbac||{},e.requiresLogin||!1)}function E(t,e={},n={},r=!1){if(t.slug&&typeof t.slug=="string"&&Object.values(j).some(c=>{const l=c.split(":")[0].replace(/\/$/,"");return t.slug===l||t.slug?.startsWith(c)})||typeof t.slug=="string"&&t.slug?.endsWith("/mcp")&&G.instance().canAccessFeature("mcp"))return!0;if(r&&Object.keys(n).length===0)return!!e.isAuthenticated;const o=M(n,e.teams||[]),s=t[D]||y(o,t[R]||{});if(Object.keys(s||{}).length===0)return!1;if(Object.keys(s).length===1&&s[u]&&s[u].toLowerCase()!=="none")return!0;const i=(e?.email?[...e?.teams||[],e?.email]:e?.teams)||[],a=[];for(const c of i??[])s[c]?a.push(s[c]):s[u]&&c!==e?.email&&a.push(s[u]);return a.length?a.some(c=>c.toLowerCase()!=="none"):!1}function At(t,e,n,r){if(!t.startsWith(g)&&!t.startsWith(L))return!0;const o=t.replace(new RegExp(`^${g}/`),"").replace(new RegExp(`^${L}/`),""),i=o==="."?"":o,a={[R]:{slug:t,fsPath:i},slug:t};return E(a,r,e,n)}function yt(t,e,n,r,o){if(!t.startsWith(F))return!0;const s=t.match(/.*\..{64}\.([A-Fa-f0-9]{8})\.[^\.]+$/)?.[1];if(!s)return!0;const i=r[s];if(!i)return!0;const{base:a,ext:c}=h.parse(t),l=a.split(".")[0],p=c.split(".").join(""),m=i==="."?"":i,T={[R]:{slug:t,fsPath:h.posix.join(m,`${l}.${p}`)},slug:t};return E(T,o,e,n)}async function Et(t,e){const{isAuthenticated:n=!1,idpAccessToken:r,federatedAccessToken:o,federatedIdToken:s,...i}=await z(t,e),{teams:a=[]}=i;let c;return n?c=a.filter(l=>l!==P):c=[P],{isAuthenticated:n,idpAccessToken:r,teams:c,claims:i}}function C(t,e,n={},r=!1){if(!t)return t;if(Array.isArray(t)){const o=[];for(const s of t){const i=C(s,e,n,r);i!==void 0&&o.push(i)}return o}if(typeof t=="object"){if(!E(t,e,n,r))return;let o=!1;const s={};for(const i in t){if(i===D||i===R)continue;if(K.has(i)){s[i]=t[i];continue}const a=C(t[i],e,n,r);if(i==="items"&&Array.isArray(a)&&a.length===0&&t[i].length!==0){o=!0;continue}a!==void 0&&(s[i]=a)}return o?void 0:s}return t}function Tt(t){return typeof t=="string"?t.split(" ").filter(Boolean):Array.isArray(t)?t.map(e=>e.toString()):[]}function Pt(t,e){if(!e)return;const n=e.content;if(!n)return e;const r=Object.entries(n).flatMap(([s,i])=>s===_?[[s,i]]:[[s,i],...t.localeFolders.map(a=>[s.startsWith("/")?`/${a.toLocaleLowerCase()}${s}`:h.posix.join(t.localizationFolder,a,s),i])]),o=Object.fromEntries(r);return{...e,content:o}}async function xt(t,e){if(!e)return{};const n={},r=new Set((await t.scan()).flatMap(({relativePath:o})=>{const{versionFolderPath:s}=N(o)||{},i=h.dirname(o);return s?[s,i]:i}));for(const o of r)n[W(o)]=o;return n}const d=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function V(t){return t?t.split("/").filter(Boolean).some(n=>n.startsWith(".")):!1}const J=t=>{if(t&&d(t)&&("content"in t&&d(t.content)||"reunite"in t&&d(t.reunite)||"features"in t&&d(t.features)||t.teamFolders&&t.teamNamePatterns)){const e=Object.values(t.content||{});if(e.length===0)return!0;if(e.every(d))return e.every(n=>Object.values(n).every(r=>typeof r=="string"))}return!1},Ot=async t=>{if(t){if(Object.keys(t).length===0)return{};if(J(t))return Q(t);await B.panicOnContentError(`You are using an incorrect format of ${k("rbac:")} configuration. See: https://redocly.com/docs/realm/access`)}},Q=t=>{const e={...t};if(e.content){const n={};for(const r in e.content)if(e.content[r]!==void 0){const o=w(r);n[o]=e.content[r]}e.content=n}return e};function Dt(t,e){const n=t.fsPath,r=t.slug,o=[];if(b(e)&&(n||r)){const s=[n,r].filter(U),i=v(e,s);if(i){const a=e?.teamNamePatterns?.map(l=>l.replace("{teamPathSegment}",i.teamPathSegment).replace("{projectRole}","read"))??[];o.push(...a);const c=y({content:{...$(e),...e.content}},t);o.push(...x(c))}else{const a=y(e,t);o.push(...x(a))}}else{const s=y(e,t);o.push(...x(s))}return X(e,o)}function x(t){if(!t)return[];const e=[],n=u in t?{authenticated:t[u],anonymous:t[u]}:{};for(const[r,o]of Object.entries({...n,...t}))o.toLowerCase()!=="none"&&r!==u&&e.push(r);return e}function X(t,e){return e.map(r=>Y(t,r)??{teamName:r}).map(r=>r.projectRole&&r.projectRole!=="READ"?r.teamName?.toLowerCase().replace(r.projectRole?.toLowerCase?.()??"","read")??"":r.teamName?.toLowerCase()??"")}export{S as PROJECT_ROLES_ORDERED_BY_ACCESS_LEVEL,Pt as applyL10nToRbacConfig,yt as canAccessAsset,ht as canAccessFeature,E as canAccessResource,At as canDownloadApiDefinition,X as expandTeamsForRead,x as extractTeamsFromScopeItems,C as filterDataByAccessDeep,Et as getAuthDetailsFromCookies,dt as getHigherRole,Dt as getRbacTeamsListForResource,y as getScopeItemsForResource,J as isRbacConfigValid,Rt as isResourcePubliclyAccessible,Q as normalizeRbacConfig,Ot as parseRbacConfig,Tt as parseTeamClaimToArray,xt as resolveDirectoryHashes};
1
+ import R from"path";import x from"picomatch";import"../node-crypto-polyfill.js";import{REDOCLY_TEAMS_RBAC as _,REDOCLY_ROUTE_RBAC as A}from"@redocly/config";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as O,ServerRoutes as w,PUBLIC_RBAC_SCOPE_ITEM as y,RBAC_ALL_OTHER_TEAMS as u,DEFAULT_RBAC_SCOPE as S}from"../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as I,PUBLIC_API_DEFINITIONS_FOLDER as C,PUBLIC_ASSETS_FOLDER as N}from"../constants/common.js";import{removeTrailingSlash as B}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as k}from"../../utils/url/remove-leading-slash.js";import{parsePathVersions as M}from"../../utils/path/parse-path-versions.js";import{reporter as W}from"../tools/notifiers/reporter.js";import{bold as U}from"../tools/notifiers/helpers/colors.js";import{shaDirPathShort as $}from"../utils/crypto/sha-dir-path-short.js";import{isTruthy as b}from"../../utils/guards/is-truthy.js";import{canExpandConfig as v,expandRbacConfig as Y,getTeamFolderDefaults as z,parseTeamFoldersTemplate as H,parseTeamNameTemplate as K}from"./rbac-expand.js";import{getUserParamsFromCookies as G}from"../web-server/auth.js";import{getDeeperGlobPattern as V}from"./globs.js";import{EntitlementsProvider as J}from"../entitlements/entitlements-provider.js";const j=["NONE","READ","TRIAGE","WRITE","MAINTAIN","ADMIN"],Q=new Set(["x-parsed-md-description","x-parsed-md-summary"]);function yt(t,e){const n=j.indexOf(t.toUpperCase()),r=j.indexOf(e.toUpperCase());return n>r?t:e}const E={};function P(t,e){if(!t?.content)return y;const n=t.content,{slug:r,fsPath:s}=e;if(!r&&!s)return y;const o=f=>{const h=`slug:${f}`,m=E[h]??x(f);E[h]=m;const g=`fsPath:${f}`,L=E[g]??x(k(f));return E[g]=L,!!(r&&m(r))||!!(s&&L(s))};if(X(r||s||"")&&Object.keys(n).filter(m=>o(m)).length===0)return n[S]||y;const c=Object.keys(n).filter(f=>o(f));if(c.length==0)return y;const l=c.map(f=>x.scan(f,{tokens:!0,parts:!0}));let p=l[0];for(let f=1;f<l.length;f++)p=V(p,l[f]);return n[p.input]}function Et(t,e,n={},r=!1){if(r&&Object.keys(n).length===0)return e.isAuthenticated;const s=n.features?.[t];return s?e.teams.some(o=>s[o]&&s[o].toLowerCase()!=="none"):!0}function Pt(t,e){return T(t,{isAuthenticated:!1,teams:[O]},e.rbac||{},e.requiresLogin||!1)}function T(t,e={},n={},r=!1){if(t.slug&&typeof t.slug=="string"&&Object.values(w).some(c=>{const l=c.split(":")[0].replace(/\/$/,"");return t.slug===l||t.slug?.startsWith(c)})||typeof t.slug=="string"&&t.slug?.endsWith("/mcp")&&J.instance().canAccessFeature("mcp"))return!0;if(r&&Object.keys(n).length===0)return!!e.isAuthenticated;const s=Y(n,e.teams||[]),o=t[_]||P(s,t[A]||{});if(Object.keys(o||{}).length===0)return!1;if(Object.keys(o).length===1&&o[u]&&o[u].toLowerCase()!=="none")return!0;const a=(e?.email?[...e?.teams||[],e?.email]:e?.teams)||[],i=[];for(const c of a??[])o[c]?i.push(o[c]):o[u]&&c!==e?.email&&i.push(o[u]);return i.length?i.some(c=>c.toLowerCase()!=="none"):!1}function Tt(t,e,n,r){if(!t.startsWith(C)&&!t.startsWith(I))return!0;const s=t.replace(new RegExp(`^${C}/`),"").replace(new RegExp(`^${I}/`),""),a=s==="."?"":s,i={[A]:{slug:t,fsPath:a},slug:t};return T(i,r,e,n)}function xt(t,e,n,r,s){if(!t.startsWith(N))return!0;const o=t.match(/.*\..{64}\.([A-Fa-f0-9]{8})\.[^\.]+$/)?.[1];if(!o)return!0;const a=r[o];if(!a)return!0;const{base:i,ext:c}=R.parse(t),l=i.split(".")[0],p=c.split(".").join(""),h=a==="."?"":a,m={[A]:{slug:t,fsPath:R.posix.join(h,`${l}.${p}`)},slug:t};return T(m,s,e,n)}async function Ot(t,e){const{isAuthenticated:n=!1,idpAccessToken:r,federatedAccessToken:s,federatedIdToken:o,...a}=await G(t,e),{teams:i=[]}=a;let c;return n?c=i.filter(l=>l!==O):c=[O],{isAuthenticated:n,idpAccessToken:r,teams:c,claims:a}}function F(t,e,n={},r=!1){if(!t)return t;if(Array.isArray(t)){const s=[];for(const o of t){const a=F(o,e,n,r);a!==void 0&&s.push(a)}return s}if(typeof t=="object"){if(!T(t,e,n,r))return;let s=!1;const o={};for(const a in t){if(a===_||a===A)continue;if(Q.has(a)){o[a]=t[a];continue}const i=F(t[a],e,n,r);if(a==="items"&&Array.isArray(i)&&i.length===0&&t[a].length!==0){s=!0;continue}i!==void 0&&(o[a]=i)}return s?void 0:o}return t}function Dt(t){return typeof t=="string"?t.split(" ").filter(Boolean):Array.isArray(t)?t.map(e=>e.toString()):[]}function gt(t,e){if(!e)return;const n=e.content;if(!n)return e;const r=Object.entries(n).flatMap(([o,a])=>o===S?[[o,a]]:[[o,a],...t.localeFolders.map(i=>[o.startsWith("/")?`/${i.toLocaleLowerCase()}${o}`:R.posix.join(t.localizationFolder,i,o),a])]),s=Object.fromEntries(r);return{...e,content:s}}async function Lt(t,e){if(!e)return{};const n={},r=new Set((await t.scan()).flatMap(({relativePath:s})=>{const{versionFolderPath:o}=M(s)||{},a=R.dirname(s);return o?[o,a]:a}));for(const s of r)n[$(s)]=s;return n}const d=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function X(t){return t?t.split("/").filter(Boolean).some(n=>n.startsWith(".")):!1}const Z=t=>{if(t&&d(t)&&("content"in t&&d(t.content)||"reunite"in t&&d(t.reunite)||"features"in t&&d(t.features)||t.teamFolders&&t.teamNamePatterns)){const e=Object.values(t.content||{});if(e.length===0)return!0;if(e.every(d))return e.every(n=>Object.values(n).every(r=>typeof r=="string"))}return!1},_t=async t=>{if(t){if(Object.keys(t).length===0)return{};if(Z(t))return q(t);await W.panicOnContentError(`You are using an incorrect format of ${U("rbac:")} configuration. See: https://redocly.com/docs/realm/access`)}},q=t=>{const e={...t};if(e.content){const n={};for(const r in e.content)if(e.content[r]!==void 0){const s=B(r);n[s]=e.content[r]}e.content=n}return e};function St(t,e){const n=t.fsPath,r=t.slug,s=[];if(v(e)&&(n||r)){const o=[n,r].filter(b),a=H(e,o);if(a){const i=e?.teamNamePatterns?.map(l=>l.replace("{teamPathSegment}",a.teamPathSegment).replace("{projectRole}","read"))??[];s.push(...i);const c=P({content:{...z(e),...e.content}},t);s.push(...D(c))}else{const i=P(e,t);s.push(...D(i))}}else{const o=P(e,t);s.push(...D(o))}return tt(e,s)}function D(t){if(!t)return[];const e=[],n=u in t?{authenticated:t[u],anonymous:t[u]}:{};for(const[r,s]of Object.entries({...n,...t}))s.toLowerCase()!=="none"&&r!==u&&e.push(r);return e}function tt(t,e){return e.map(r=>K(t,r)??{teamName:r}).map(r=>r.projectRole&&r.projectRole!=="READ"?r.teamName?.toLowerCase().replace(r.projectRole?.toLowerCase?.()??"","read")??"":r.teamName?.toLowerCase()??"")}export{j as PROJECT_ROLES_ORDERED_BY_ACCESS_LEVEL,gt as applyL10nToRbacConfig,xt as canAccessAsset,Et as canAccessFeature,T as canAccessResource,Tt as canDownloadApiDefinition,tt as expandTeamsForRead,D as extractTeamsFromScopeItems,F as filterDataByAccessDeep,Ot as getAuthDetailsFromCookies,yt as getHigherRole,St as getRbacTeamsListForResource,P as getScopeItemsForResource,Z as isRbacConfigValid,Pt as isResourcePubliclyAccessible,q as normalizeRbacConfig,_t as parseRbacConfig,Dt as parseTeamClaimToArray,Lt as resolveDirectoryHashes};
@@ -1 +1 @@
1
- import{getCompleteCatalogConfig as w}from"../../../plugins/catalog-entities/get-complete-catalog-config.js";import{telemetryTraceStep as m}from"../../../telemetry/helpers/trace-step.js";import{CATALOG_FILTERS_CACHE_NAMESPACE as h,ALLOWED_CATALOG_QUERY_PARAMS as T}from"../../../constants/plugins/catalog-entities.js";import{CATALOG_ENTITY_ID as E}from"../../../../constants/common.js";import{allowlistObject as b}from"../../../../utils/object/allowlist-object.js";import{isValidIsoDate as j}from"../../../utils/is-valid-iso-date.js";import{CatalogEntitiesService as _}from"../../../plugins/catalog-entities/database/catalog-entities-service.js";import{createPaginationParamsValidator as q}from"../../../providers/database/pagination/schemas.js";import{createEntityRelationDtoFromFileSchema as O}from"../../../plugins/catalog-entities/database/mappers/create-entity-relation-dto-from-file-schema.js";import{CacheService as R}from"../../../persistence/cache/services/cache-service.js";import{hasAccessToEntity as f}from"./helpers/has-access-to-entity.js";import{getRbacRestrictionsDataForCatalog as p}from"../helpers/get-rbac-restrictions-data-for-catalog.js";import{mapEntityReadModelSchemaToEntityReadDto as g}from"./mappers/map-entity-read-model-schema-to-entity-read-dto.js";import{parseEntity as v}from"./parsers/entities/parse-entity.js";import{parseEntityUpdateData as C}from"./parsers/entities/parse-entity-update-data.js";import{parseEntities as F}from"./parsers/entities/parse-entities.js";const D=["type","key","title","summary","tags","metadata","metadata.*","git","contact","links","id","source","sourceFile","createdAt","updatedAt"],A=async n=>{await(await R.getInstance({baseDbDir:n})).deleteByNamespace(h)},I=async({catalogEntitiesService:n,ctx:e,store:y})=>m("catalog_entities.get_entities",async i=>{const a=e.get("logger");try{const t=e.req.query();i?.setAttribute("queryParams",JSON.stringify(b(t,T)));const{currentRbacTeamsForRead:o,excludedTypes:r,excludedEntities:s}=p({store:y,ctx:e}),c=q(D).parse(t),u=await n.getEntities({paginationParams:c,rbacTeams:o,excludedTypes:r,excludedEntities:s});return i?.setAttribute("entitiesCount",u.items.length),e.json({...u,items:u.items.map(g)})}catch(t){return a.error(t),i?.error(t),e.json({message:"Failed to get entities"},500)}}),P=async({catalogEntitiesService:n,ctx:e,store:y})=>m("catalog_entities.get_entity",async i=>{const a=e.req.param(E);if(!a)return i?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);i?.setAttribute("pathParams",JSON.stringify({entityId:a}));const{currentRbacTeamsForRead:t,excludedTypes:o,excludedEntities:r}=p({store:y,ctx:e}),s=await n.getEntityById(a,{rbacTeams:t,excludedTypes:o,excludedEntities:r});return s?(i?.setAttribute("entity",JSON.stringify(s)),e.json(g(s))):(i?.error(new Error("Entity not found")),e.json({message:"Entity not found"},404))}),N=async({catalogEntitiesService:n,ctx:e,catalogConfig:y,serverOutDir:i,store:a})=>m("catalog_entities.create_entity",async t=>{const o=e.get("logger");try{const r=await e.req.json();t?.setAttribute("requestBody",JSON.stringify(r));const s=v(r,y);if(!f({ctx:e,store:a,accessLevel:"WRITE",entityType:s.type,entityKey:s.key}))return t?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const u=await n.createEntity(s),d=s.relations?.map(l=>O(s.key,l));return await n.createEntitiesRelations(d??[]),u?(A(i),t?.setAttribute("entity",JSON.stringify(u)),e.json(g(u))):(t?.error(new Error("Failed to create entity")),e.json({message:"Failed to create entity"},500))}catch(r){return o.error(r),r instanceof Error&&r.message.includes("validation failed")?(t?.error(new Error(r.message)),e.json({message:r.message},400)):(t?.error(r),e.json({message:"Failed to create entity"},500))}}),W=async({catalogEntitiesService:n,ctx:e,catalogConfig:y,serverOutDir:i,store:a})=>m("catalog_entities.bulk_upsert_entities",async t=>{const o=e.get("logger");try{const r=await e.req.json();t?.setAttribute("requestBody",JSON.stringify(r));const s=F(r,y);for(const d of s)if(!f({ctx:e,store:a,accessLevel:"WRITE",entityType:d.type,entityKey:d.key}))return t?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const c=await n.createEntities(s);if(!c.length)return t?.error(new Error("Failed to create entities")),e.json({message:"Failed to create entities"},500);A(i);const u=c.filter(d=>d.status==="ok");return t?.setAttribute("totalSuccess",u.length),t?.setAttribute("totalFailed",c.length-u.length),e.json(u.map(d=>({...d,resource:g(d.resource)})),207)}catch(r){return o.error(r),r instanceof Error&&r.message.includes("validation failed")?(t?.error(new Error(r.message)),e.json({message:r.message},400)):(t?.error(r),e.json({message:"Failed to create entities"},500))}}),k=async({catalogEntitiesService:n,ctx:e,catalogConfig:y,serverOutDir:i,store:a})=>m("catalog_entities.update_entity",async t=>{const o=e.get("logger"),r=e.req.param(E);if(!r)return t?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);t?.setAttribute("pathParams",JSON.stringify({entityId:r}));try{const s=await e.req.json();t?.setAttribute("requestBody",JSON.stringify(s));const c=await n.getEntityById(r);if(!c)return t?.error(new Error(`Entity with id: ${r} not found`)),e.json({message:`Entity with id: ${r} not found`},404);if(!f({ctx:e,store:a,accessLevel:"WRITE",entityType:s.type??c.type,entityKey:s.key??c.key}))return t?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const d=C(s,y,s?.type??c.type);if(d.revision&&!j(d.revision))throw new Error("Entity validation failed: 'entity.revision' must be a valid ISO 8601 date-time string");const l=await n.updateEntity(d,c);return l?(A(i),t?.setAttribute("entity",JSON.stringify(l)),e.json(g(l))):(t?.error(new Error("Failed to update entity")),e.json({message:"Failed to update entity"},500))}catch(s){return o.error(s),s instanceof Error&&s.message.includes("validation failed")?(t?.error(new Error(s.message)),e.json({message:s.message},400)):(t?.error(s),e.json({message:s.message},500))}}),L=async({catalogEntitiesService:n,ctx:e,serverOutDir:y,store:i})=>m("catalog_entities.delete_entity",async a=>{const t=e.req.param(E);if(!t)return a?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);a?.setAttribute("pathParams",JSON.stringify({entityId:t}));const o=await n.getEntityById(t);return o?f({ctx:e,store:i,accessLevel:"WRITE",entityType:o.type,entityKey:o.key})?(await n.deleteEntity(o),A(y),new Response(null,{status:204})):(a?.error(new Error("Access denied")),e.json({message:"Access denied"},403)):new Response(null,{status:204})}),J={GET:I,POST:N,PUT:W},B={GET:P,DELETE:L,PATCH:k};function re(n){return async e=>m("catalog_entities",async y=>{const i=await _.getInstance({baseDbDir:n.serverOutDir}),a=e.req.method;y?.setAttribute("method",a);const t=e.req.param(E)?B:J,o=w(n.config.entitiesCatalog),r=t[a];return r?await r({catalogEntitiesService:i,ctx:e,catalogConfig:o,serverOutDir:n.serverOutDir,store:n}):(y?.error(new Error("Method not allowed")),e.json({message:"Method not allowed"},405))})}export{re as catalogHandler};
1
+ import{getCompleteCatalogConfig as j}from"../../../plugins/catalog-entities/get-complete-catalog-config.js";import{telemetryTraceStep as m}from"../../../telemetry/helpers/trace-step.js";import{CATALOG_FILTERS_CACHE_NAMESPACE as b,ALLOWED_CATALOG_QUERY_PARAMS as F}from"../../../constants/plugins/catalog-entities.js";import{CATALOG_ENTITY_ID as f}from"../../../../constants/common.js";import{allowlistObject as _}from"../../../../utils/object/allowlist-object.js";import{isValidIsoDate as R}from"../../../utils/is-valid-iso-date.js";import{CatalogEntitiesService as q}from"../../../plugins/catalog-entities/database/catalog-entities-service.js";import{createPaginationParamsValidator as I}from"../../../providers/database/pagination/schemas.js";import{createEntityRelationDtoFromFileSchema as O}from"../../../plugins/catalog-entities/database/mappers/create-entity-relation-dto-from-file-schema.js";import{CacheService as C}from"../../../persistence/cache/services/cache-service.js";import{hasAccessToEntity as w}from"./helpers/has-access-to-entity.js";import{getRbacRestrictionsDataForCatalog as T}from"../helpers/get-rbac-restrictions-data-for-catalog.js";import{mapEntityReadModelSchemaToEntityReadDto as g}from"./mappers/map-entity-read-model-schema-to-entity-read-dto.js";import{parseEntity as D}from"./parsers/entities/parse-entity.js";import{parseEntityUpdateData as P}from"./parsers/entities/parse-entity-update-data.js";import{parseEntities as v}from"./parsers/entities/parse-entities.js";import{upsertPagesStats as h}from"./helpers/upsert-pages-stats.js";const N=["type","key","title","summary","tags","metadata","metadata.*","git","contact","links","id","source","sourceFile","createdAt","updatedAt"],A=async n=>{await(await C.getInstance({baseDbDir:n})).deleteByNamespace(b)},W=async({catalogEntitiesService:n,ctx:e,store:u})=>m("catalog_entities.get_entities",async o=>{const i=e.get("logger");try{const r=e.req.query();o?.setAttribute("queryParams",JSON.stringify(_(r,F)));const{currentRbacTeamsForRead:d,excludedTypes:t,excludedEntities:s}=T({store:u,ctx:e}),c=I(N).parse(r),y=await n.getEntities({paginationParams:c,rbacTeams:d,excludedTypes:t,excludedEntities:s});return o?.setAttribute("entitiesCount",y.items.length),e.json({...y,items:y.items.map(g)})}catch(r){return i.error(r),o?.error(r),e.json({message:"Failed to get entities"},500)}}),k=async({catalogEntitiesService:n,ctx:e,store:u})=>m("catalog_entities.get_entity",async o=>{const i=e.req.param(f);if(!i)return o?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);o?.setAttribute("pathParams",JSON.stringify({entityId:i}));const{currentRbacTeamsForRead:r,excludedTypes:d,excludedEntities:t}=T({store:u,ctx:e}),s=await n.getEntityById(i,{rbacTeams:r,excludedTypes:d,excludedEntities:t});return s?(o?.setAttribute("entity",JSON.stringify(s)),e.json(g(s))):(o?.error(new Error("Entity not found")),e.json({message:"Entity not found"},404))}),L=async({catalogEntitiesService:n,ctx:e,catalogConfig:u,serverOutDir:o,store:i})=>m("catalog_entities.create_entity",async r=>{const d=e.get("logger");try{const t=await e.req.json();r?.setAttribute("requestBody",JSON.stringify(t));const s=D(t,u);if(!w({ctx:e,store:i,accessLevel:"WRITE",entityType:s.type,entityKey:s.key}))return r?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const y=await n.remoteTransaction(async()=>{const a=await n.createEntity(s),l=s.relations?.map(E=>O(s.key,E));return await n.createEntitiesRelations(l??[]),await h({ctx:e,catalogEntitiesService:n,addedEntities:a?[a]:void 0}),a});return y?(A(o),r?.setAttribute("entity",JSON.stringify(y)),e.json(g(y))):(r?.error(new Error("Failed to create entity")),e.json({message:"Failed to create entity"},500))}catch(t){return d.error(t),t instanceof Error&&t.message.includes("validation failed")?(r?.error(new Error(t.message)),e.json({message:t.message},400)):(r?.error(t),e.json({message:"Failed to create entity"},500))}}),J=async({catalogEntitiesService:n,ctx:e,catalogConfig:u,serverOutDir:o,store:i})=>m("catalog_entities.bulk_upsert_entities",async r=>{const d=e.get("logger");try{const t=await e.req.json();r?.setAttribute("requestBody",JSON.stringify(t));const s=v(t,u);for(const a of s)if(!w({ctx:e,store:i,accessLevel:"WRITE",entityType:a.type,entityKey:a.key}))return r?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const c=await n.remoteTransaction(async()=>{const a=await n.createEntities(s),l=a.reduce((E,p)=>(p.status==="ok"&&p.resource!=null&&E.push(p.resource),E),[]);return await h({ctx:e,catalogEntitiesService:n,addedEntities:l}),a});if(!c.length)return r?.error(new Error("Failed to create entities")),e.json({message:"Failed to create entities"},500);A(o);const y=c.filter(a=>a.status==="ok");return r?.setAttribute("totalSuccess",y.length),r?.setAttribute("totalFailed",c.length-y.length),e.json(y.map(a=>({...a,resource:g(a.resource)})),207)}catch(t){return d.error(t),t instanceof Error&&t.message.includes("validation failed")?(r?.error(new Error(t.message)),e.json({message:t.message},400)):(r?.error(t),e.json({message:"Failed to create entities"},500))}}),B=async({catalogEntitiesService:n,ctx:e,catalogConfig:u,serverOutDir:o,store:i})=>m("catalog_entities.update_entity",async r=>{const d=e.get("logger"),t=e.req.param(f);if(!t)return r?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);r?.setAttribute("pathParams",JSON.stringify({entityId:t}));try{const s=await e.req.json();r?.setAttribute("requestBody",JSON.stringify(s));const c=await n.getEntityById(t);if(!c)return r?.error(new Error(`Entity with id: ${t} not found`)),e.json({message:`Entity with id: ${t} not found`},404);if(!w({ctx:e,store:i,accessLevel:"WRITE",entityType:s.type??c.type,entityKey:s.key??c.key}))return r?.error(new Error("Access denied")),e.json({message:"Access denied"},403);const a=P(s,u,s?.type??c.type);if(a.revision&&!R(a.revision))throw new Error("Entity validation failed: 'entity.revision' must be a valid ISO 8601 date-time string");const l=await n.updateEntity(a,c);return l?(A(o),r?.setAttribute("entity",JSON.stringify(l)),e.json(g(l))):(r?.error(new Error("Failed to update entity")),e.json({message:"Failed to update entity"},500))}catch(s){return d.error(s),s instanceof Error&&s.message.includes("validation failed")?(r?.error(new Error(s.message)),e.json({message:s.message},400)):(r?.error(s),e.json({message:s.message},500))}}),U=async({catalogEntitiesService:n,ctx:e,serverOutDir:u,store:o})=>m("catalog_entities.delete_entity",async i=>{const r=e.get("logger"),d=e.req.param(f);if(!d)return i?.error(new Error("Entity id is required")),e.json({message:"Entity id is required"},400);i?.setAttribute("pathParams",JSON.stringify({entityId:d}));try{const t=await n.getEntityById(d);return t?w({ctx:e,store:o,accessLevel:"WRITE",entityType:t.type,entityKey:t.key})?await n.remoteTransaction(async()=>{const y=await n.deleteEntity(t);return y?(await h({ctx:e,catalogEntitiesService:n,removedEntities:t?[t]:void 0}),y):null})?(A(u),new Response(null,{status:204})):(i?.error(new Error("Failed to delete entity")),e.json({message:"Failed to delete entity"},500)):(i?.error(new Error("Access denied")),e.json({message:"Access denied"},403)):new Response(null,{status:204})}catch(t){return r.error(t),i?.error(t),e.json({message:"Failed to delete entity"},500)}}),G={GET:W,POST:L,PUT:J},H={GET:k,DELETE:U,PATCH:B};function oe(n){return async e=>m("catalog_entities",async u=>{const o=await q.getInstance({baseDbDir:n.serverOutDir}),i=e.req.method;u?.setAttribute("method",i);const r=e.req.param(f)?H:G,d=j(n.config.entitiesCatalog),t=r[i];return t?await t({catalogEntitiesService:o,ctx:e,catalogConfig:d,serverOutDir:n.serverOutDir,store:n}):(u?.error(new Error("Method not allowed")),e.json({message:"Method not allowed"},405))})}export{oe as catalogHandler};
@@ -0,0 +1,12 @@
1
+ import type { Context } from 'hono';
2
+ import type { CatalogEntitiesService } from '../../../../plugins/catalog-entities/database/catalog-entities-service';
3
+ import type { EntityReadModelSchema } from '../../../../plugins/catalog-entities/schemas/read-model-schemas';
4
+ type UpsertPagesStatsParams = {
5
+ ctx: Context;
6
+ catalogEntitiesService: CatalogEntitiesService;
7
+ addedEntities?: EntityReadModelSchema[];
8
+ removedEntities?: EntityReadModelSchema[];
9
+ };
10
+ export declare function upsertPagesStats({ ctx, catalogEntitiesService, addedEntities, removedEntities, }: UpsertPagesStatsParams): Promise<void>;
11
+ export {};
12
+ //# sourceMappingURL=upsert-pages-stats.d.ts.map
@@ -0,0 +1 @@
1
+ import{envConfig as t}from"../../../../config/env-config.js";async function f({ctx:o,catalogEntitiesService:r,addedEntities:s,removedEntities:n}){if(t.REDOCLY_ENV!=="production"){o.get("logger").info("Skipping pages stats upsert in non-production environment");return}if(!t.BH_API_URL||!t.ORGANIZATION_ID||!t.PROJECT_ID)throw new Error("Pages stats service not configured");const a=o.req.header("apiKey");if(!a)throw new Error("API key is required to upsert pages stats");const{total:i}=await r.getDuplicatedEntitiesCount(s,n),{total:p}=await r.getEntitiesCount("remote",s,n?.length),g={remoteEntityPages:p,duplicatedEntityPages:i,isReported:!1},c=new URL(`/api/orgs/${t.ORGANIZATION_ID}/projects/${t.PROJECT_ID}/project-pages-stats`,t.BH_API_URL).toString();try{const e=await fetch(c,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(g)});if(!e.ok)throw new Error(e.statusText)}catch(e){throw new Error(`Failed to upsert project pages stats: ${e?.message}`)}}export{f as upsertPagesStats};
@@ -1,2 +1,2 @@
1
- import{withPathPrefix as O}from"@redocly/theme/core/utils";import{ServerRoutes as _}from"../../../constants/common.js";import{getRequestOrigin as q}from"../utils/get-request-origin.js";const C=new Set(["connection","keep-alive","proxy-authenticate","proxy-connection","proxy-authorization","te","trailer","transfer-encoding","upgrade","host"]),P=new Set(["cookie","cookie2"]),T=new Set(["set-cookie","set-cookie2"]),E="x-redocly-proxy-streaming",H="x-http-method-override",w="x-redocly-cookie";function x(o=O(_.CORS_PROXY)){return async e=>{const r=new URL(e.req.url).pathname;if(r===o||r===`${o}/`)return e.text(`Realm CORS proxy endpoint.
2
- Usage: ${o}/https://api.example.com/path`);const n=L(e.req.url,o);if(!n)return e.text("Invalid proxied URL",400);const i=q(e),c=n.origin===i,h=n.pathname===o||n.pathname.startsWith(`${o}/`);if(c&&!h)return new Response("Please use a direct request",{status:308,headers:{Location:n.toString(),Vary:"origin","Cache-Control":"private"}});const s=new Headers,f=S(e.req.raw.headers);for(const[t,y]of e.req.raw.headers)f.has(t.toLowerCase())||P.has(t.toLowerCase())||s.append(t,y);const d=s.get(w);if(d){const t=e.req.raw.headers.get("cookie")||"";s.set("cookie",t?`${t}; ${d}`:d),s.delete(w)}const u=e.req.raw.headers.get("origin")||"";A(u)&&s.delete("origin");let p=e.req.method;const m=s.get(H);m&&(p=m.toUpperCase(),s.delete(H));const R={method:p,headers:s,redirect:"follow"};p!=="GET"&&p!=="HEAD"&&e.req.raw.body&&(R.body=e.req.raw.body,R.duplex="half");let a;try{a=await fetch(n,R)}catch(t){return e.text(`Failed to proxy request: ${t instanceof Error?t.message:"unknown error"}`,502)}const l=new Headers(a.headers),g=S(a.headers);for(const t of g)l.delete(t);for(const t of T)l.delete(t);return l.set(E,"1"),new Response(a.body,{status:a.status,statusText:a.statusText,headers:l})}}function k(o){try{return decodeURIComponent(o)}catch{return o}}function D(o){return o.replace(/^(https?):\/(?!\/)/i,"$1://")}function $(o,e){return e?o.includes("?")?e==="?"?o:`${o.endsWith("?")||o.endsWith("&")?o:`${o}&`}${e.slice(1)}`:`${o}${e}`:o}function S(o){const e=new Set(C),r=o.get("connection");if(!r)return e;for(const n of r.split(",")){const i=n.trim().toLowerCase();i&&e.add(i)}return e}function A(o){const e=o.toLowerCase();return e.includes(".redocly.app")||e.includes("localhost")}function L(o,e){const r=new URL(o),n=r.pathname===e,i=r.pathname.startsWith(`${e}/`);if(!n&&!i)return null;const c=r.pathname.slice(e.length).replace(/^\/+/,"");if(!c)return null;const h=[c,k(c)];for(const s of h){const f=D(s),d=$(f,r.search);try{const u=new URL(d);if(u.protocol==="http:"||u.protocol==="https:")return u}catch{continue}}return null}const z=E;export{z as CORS_PROXY_STREAM_HEADER,x as corsProxyHandler,L as resolveCorsProxyTarget};
1
+ import{withPathPrefix as _}from"@redocly/theme/core/utils";import{ServerRoutes as q}from"../../../constants/common.js";import{getRequestOrigin as C}from"../utils/get-request-origin.js";const P=new Set(["connection","keep-alive","proxy-authenticate","proxy-connection","proxy-authorization","te","trailer","transfer-encoding","upgrade","host"]),$=new Set(["cookie","cookie2","accept-encoding"]),T=new Set(["set-cookie","set-cookie2","content-encoding","content-length"]),g="x-redocly-proxy-streaming",H="x-http-method-override",w="x-redocly-cookie";function z(o=_(q.CORS_PROXY)){return async e=>{const n=new URL(e.req.url).pathname;if(n===o||n===`${o}/`)return e.text(`Realm CORS proxy endpoint.
2
+ Usage: ${o}/https://api.example.com/path`);const r=I(e.req.url,o);if(!r)return e.text("Invalid proxied URL",400);const i=C(e),c=r.origin===i,h=r.pathname===o||r.pathname.startsWith(`${o}/`);if(c&&!h)return new Response("Please use a direct request",{status:308,headers:{Location:r.toString(),Vary:"origin","Cache-Control":"private"}});const s=new Headers,f=S(e.req.raw.headers);for(const[t,E]of e.req.raw.headers)f.has(t.toLowerCase())||$.has(t.toLowerCase())||s.append(t,E);const d=s.get(w);if(d){const t=e.req.raw.headers.get("cookie")||"";s.set("cookie",t?`${t}; ${d}`:d),s.delete(w)}const u=e.req.raw.headers.get("origin")||"";L(u)&&s.delete("origin");let p=e.req.method;const R=s.get(H);R&&(p=R.toUpperCase(),s.delete(H));const m={method:p,headers:s,redirect:"follow"};p!=="GET"&&p!=="HEAD"&&e.req.raw.body&&(m.body=e.req.raw.body,m.duplex="half");let a;try{a=await fetch(r,m)}catch(t){const E=t instanceof Error?t.message:"unknown error",O=t instanceof Error&&t.cause instanceof Error?`: ${t.cause.message}`:"";return e.text(`Failed to proxy request: ${E}${O}`,502)}const l=new Headers(a.headers),y=S(a.headers);for(const t of y)l.delete(t);for(const t of T)l.delete(t);return l.set(g,"1"),new Response(a.body,{status:a.status,statusText:a.statusText,headers:l})}}function k(o){try{return decodeURIComponent(o)}catch{return o}}function D(o){return o.replace(/^(https?):\/(?!\/)/i,"$1://")}function A(o,e){return e?o.includes("?")?e==="?"?o:`${o.endsWith("?")||o.endsWith("&")?o:`${o}&`}${e.slice(1)}`:`${o}${e}`:o}function S(o){const e=new Set(P),n=o.get("connection");if(!n)return e;for(const r of n.split(",")){const i=r.trim().toLowerCase();i&&e.add(i)}return e}function L(o){const e=o.toLowerCase();return e.includes(".redocly.app")||e.includes("localhost")}function I(o,e){const n=new URL(o),r=n.pathname===e,i=n.pathname.startsWith(`${e}/`);if(!r&&!i)return null;const c=n.pathname.slice(e.length).replace(/^\/+/,"");if(!c)return null;const h=[c,k(c)];for(const s of h){const f=D(s),d=A(f,n.search);try{const u=new URL(d);if(u.protocol==="http:"||u.protocol==="https:")return u}catch{continue}}return null}const U=g;export{U as CORS_PROXY_STREAM_HEADER,z as corsProxyHandler,I as resolveCorsProxyTarget};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/redoc",
3
- "version": "0.131.0-next.8",
3
+ "version": "0.131.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,8 +28,8 @@
28
28
  "@opentelemetry/sdk-trace-node": "2.0.1",
29
29
  "@opentelemetry/sdk-trace-web": "2.0.1",
30
30
  "@opentelemetry/semantic-conventions": "1.34.0",
31
- "@redocly/ajv": "8.17.4",
32
- "@redocly/openapi-core": "2.19.0",
31
+ "@redocly/ajv": "8.18.0",
32
+ "@redocly/openapi-core": "2.20.5",
33
33
  "@shikijs/transformers": "3.21.0",
34
34
  "@tanstack/react-query": "5.62.3",
35
35
  "@tanstack/react-table": "8.21.3",
@@ -51,7 +51,7 @@
51
51
  "fetch-to-node": "^2.1.0",
52
52
  "fflate": "0.7.4",
53
53
  "flexsearch": "0.7.43",
54
- "graphql": "16.9.0",
54
+ "graphql": "16.12.0",
55
55
  "gray-matter": "4.0.3",
56
56
  "hono": "4.11.10",
57
57
  "htmlparser2": "8.0.2",
@@ -64,7 +64,7 @@
64
64
  "nanoid": "5.0.9",
65
65
  "node-fetch": "3.3.1",
66
66
  "nprogress": "0.2.0",
67
- "openapi-sampler": "1.7.0",
67
+ "openapi-sampler": "^1.7.2",
68
68
  "os-browserify": "0.3.0",
69
69
  "path-browserify": "1.0.1",
70
70
  "picomatch": "2.3.1",
@@ -91,14 +91,14 @@
91
91
  "xpath": "0.0.34",
92
92
  "yaml-ast-parser": "0.0.43",
93
93
  "zod": "^3.25.76",
94
- "@redocly/asyncapi-docs": "1.8.0-next.5",
95
- "@redocly/config": "0.43.0",
96
- "@redocly/graphql-docs": "1.8.0-next.4",
97
- "@redocly/openapi-docs": "3.19.0-next.5",
98
- "@redocly/portal-legacy-ui": "0.14.0-next.0",
99
- "@redocly/portal-plugin-mock-server": "0.16.0-next.5",
100
- "@redocly/realm-asyncapi-sdk": "0.9.0-next.2",
101
- "@redocly/theme": "0.63.0-next.3"
94
+ "@redocly/portal-legacy-ui": "0.14.0",
95
+ "@redocly/config": "0.44.1",
96
+ "@redocly/portal-plugin-mock-server": "0.16.0",
97
+ "@redocly/realm-asyncapi-sdk": "0.9.0",
98
+ "@redocly/asyncapi-docs": "1.8.0",
99
+ "@redocly/theme": "0.63.0",
100
+ "@redocly/graphql-docs": "1.8.0",
101
+ "@redocly/openapi-docs": "3.19.0"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": "^19.2.4",
@@ -1 +0,0 @@
1
- import{detectSpec as m,getTypes as f,normalizeTypes as d,normalizeVisitors as u,resolveDocument as w,BaseResolver as h,Stats as y,walkDocument as S}from"@redocly/openapi-core";import{logger as l}from"../../../server/tools/notifiers/logger.js";import{envConfig as g}from"../../../server/config/env-config.js";import{telemetryTraceStep as D}from"../../telemetry/helpers/trace-step.js";import{telemetry as I}from"../../telemetry/index.js";const t={refs:{metric:"References",total:0,color:"red",items:new Set},externalDocs:{metric:"External Documents",total:0,color:"magenta"},schemas:{metric:"Schemas",total:0,color:"white"},parameters:{metric:"Parameters",total:0,color:"yellow",items:new Set},links:{metric:"Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"Path Items",total:0,color:"green"},webhooks:{metric:"Webhooks",total:0,color:"green"},operations:{metric:"Operations",total:0,color:"yellow"},tags:{metric:"Tags",total:0,color:"white",items:new Set}};async function T(s,a){await D("stats.openapi",async()=>{l.info("OpenAPI collector: start processing documents...");const e=(await s.cache.load(".","load-oas-docs")).data,o=[];for(const r of e)if(!r.isVirtual){const n=await v(r);o.push(n),I.sendStatsOpenapiCollectedMessage([{...n,projectBuildId:g.PROJECT_BUILD_ID||""}])}a||console.table(o),l.info("OpenAPI collector: openapi docments processing completed.")})}async function v(s){const a=s.definition,e=m(a),o=d(f(e)),r=u([{severity:"warn",ruleId:"openapi_stats",visitor:y(t)}],o),n={problems:[],specVersion:e,visitorsData:{}},c={source:{absoluteRef:""},parsed:a},i=o.Root;if(!i)throw new Error("Root type not found in OpenAPI spec types");const p=await w({rootDocument:c,rootType:i,externalRefResolver:new h});return S({rootType:i,normalizedVisitors:r,resolvedRefMap:p,document:c,ctx:n}),{path:s.relativePath,refs:t.refs.total,externalDocs:t.externalDocs.total,schemas:t.schemas.total,parameters:t.parameters.total,links:t.links.total,pathItems:t.pathItems.total,webhooks:t.webhooks.total,operations:t.operations.total,tags:t.tags.total,version:e}}export{T as collectOpenapiDocumentsStatistics};
File without changes
File without changes