@redocly/realm 0.138.0-next.4 → 0.138.0-next.5

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 (138) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  3. package/dist/cli/build/analytics/collectors/get-sidebars-usage.d.ts +12 -0
  4. package/dist/cli/build/analytics/collectors/get-sidebars-usage.js +1 -0
  5. package/dist/cli/build/index.js +1 -1
  6. package/dist/cli/eject/resolveEjectParams.js +1 -1
  7. package/dist/cli/generate/string-utils.js +1 -1
  8. package/dist/cli/stats/collectors/extension-sampling.js +1 -1
  9. package/dist/cli/translations/collect-config-translations.js +1 -1
  10. package/dist/client/TestProvider.js +1 -1
  11. package/dist/client/app/Link.js +1 -1
  12. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  13. package/dist/client/app/hooks/codeHighlight/treeview-transformer.js +1 -1
  14. package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
  15. package/dist/client/app/search/index.d.ts +1 -1
  16. package/dist/client/app/search/index.js +1 -1
  17. package/dist/client/app/search/useSearch.d.ts +3 -0
  18. package/dist/client/app/search/useSearch.js +1 -1
  19. package/dist/client/providers/page-data/hooks.d.ts +2 -0
  20. package/dist/client/providers/page-data/hooks.js +1 -1
  21. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  22. package/dist/client/runtime/loader.js +1 -1
  23. package/dist/client/templates/api-docs/helpers.js +1 -1
  24. package/dist/client/templates/api-docs/template.js +7 -3
  25. package/dist/client/utils/catalog/parse-filter-query.js +1 -1
  26. package/dist/client/{app/Sidebar/helpers → utils}/filter-out-versioned-items.d.ts +12 -2
  27. package/dist/client/utils/filter-out-versioned-items.js +1 -0
  28. package/dist/client/utils/navigation-tabs.d.ts +14 -0
  29. package/dist/client/utils/navigation-tabs.js +1 -0
  30. package/dist/constants/l10n/langs/ar.js +1 -1
  31. package/dist/constants/l10n/langs/de.js +1 -1
  32. package/dist/constants/l10n/langs/en.js +1 -1
  33. package/dist/constants/l10n/langs/es.js +1 -1
  34. package/dist/constants/l10n/langs/fr.js +1 -1
  35. package/dist/constants/l10n/langs/hi.js +1 -1
  36. package/dist/constants/l10n/langs/it.js +1 -1
  37. package/dist/constants/l10n/langs/ja.js +1 -1
  38. package/dist/constants/l10n/langs/ko.js +1 -1
  39. package/dist/constants/l10n/langs/pl.js +1 -1
  40. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  41. package/dist/constants/l10n/langs/pt.js +1 -1
  42. package/dist/constants/l10n/langs/ru.js +1 -1
  43. package/dist/constants/l10n/langs/uk.js +1 -1
  44. package/dist/constants/l10n/langs/zh.js +1 -1
  45. package/dist/server/config/env-config.d.ts +0 -2
  46. package/dist/server/config/env-schema.d.ts +0 -5
  47. package/dist/server/config/env-schemas/feature-flags.d.ts +0 -4
  48. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  49. package/dist/server/constants/common.d.ts +0 -1
  50. package/dist/server/constants/common.js +1 -1
  51. package/dist/server/plugins/api-docs/index.js +1 -1
  52. package/dist/server/plugins/api-docs/utils/apply-nav-item-to-root.d.ts +9 -0
  53. package/dist/server/plugins/api-docs/utils/apply-nav-item-to-root.js +1 -0
  54. package/dist/server/plugins/api-docs/utils/decorators.js +1 -1
  55. package/dist/server/plugins/catalog-entities/utils/ajv-validator.js +1 -1
  56. package/dist/server/plugins/catalog-entities/utils/extract-parts-from-components-ref.js +1 -1
  57. package/dist/server/plugins/catalog-entities/utils/is-valid-tag-name.js +1 -1
  58. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.js +1 -1
  59. package/dist/server/plugins/default-theme/extract-team-names.js +1 -1
  60. package/dist/server/plugins/get-reserved-routes.d.ts +4 -2
  61. package/dist/server/plugins/get-reserved-routes.js +1 -1
  62. package/dist/server/plugins/l10n/index.js +1 -1
  63. package/dist/server/plugins/markdown/search/to-markdown.js +1 -1
  64. package/dist/server/plugins/markdown/utils/sanitize-malformed-md-content.js +1 -1
  65. package/dist/server/plugins/mcp/audit/secret-patterns.js +1 -1
  66. package/dist/server/plugins/mcp/auth/assistant-anonymous-token.js +1 -1
  67. package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
  68. package/dist/server/plugins/mcp/codemode/build-tool-list.d.ts +6 -1
  69. package/dist/server/plugins/mcp/codemode/build-tool-list.js +2 -2
  70. package/dist/server/plugins/mcp/codemode/code-execution-audit.d.ts +3 -2
  71. package/dist/server/plugins/mcp/codemode/code-execution-audit.js +1 -1
  72. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.d.ts +3 -4
  73. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.js +1 -1
  74. package/dist/server/plugins/mcp/codemode/prompts.js +1 -1
  75. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +2 -2
  76. package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
  77. package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +2 -2
  78. package/dist/server/plugins/mcp/custom-tools/scan-custom-tools.js +1 -1
  79. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  80. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/endpoint-suggestions.js +1 -1
  81. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.js +1 -1
  82. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.js +1 -1
  83. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +3 -4
  84. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
  85. package/dist/server/plugins/mcp/docs-mcp/utils/resolve-refs.js +1 -1
  86. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +15 -3
  87. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +6 -5
  88. package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.js +1 -1
  89. package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.js +1 -1
  90. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +2 -2
  91. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  92. package/dist/server/plugins/mcp/handlers/mcp-credentials-page.js +35 -35
  93. package/dist/server/plugins/mcp/index.js +1 -1
  94. package/dist/server/plugins/mcp/servers/mcp-server.js +3 -3
  95. package/dist/server/plugins/mcp/types.d.ts +5 -11
  96. package/dist/server/plugins/mcp/utils/json-schema-validator.d.ts +2 -2
  97. package/dist/server/plugins/mcp/utils/json-schema-validator.js +1 -1
  98. package/dist/server/plugins/mcp/utils/mcp-client.js +1 -1
  99. package/dist/server/plugins/mcp/utils/public-endpoint.d.ts +9 -0
  100. package/dist/server/plugins/mcp/utils/public-endpoint.js +1 -0
  101. package/dist/server/plugins/mcp/utils/telemetry-attributes.d.ts +2 -1
  102. package/dist/server/plugins/mcp/utils/telemetry-attributes.js +1 -1
  103. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +0 -7
  104. package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
  105. package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
  106. package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +5 -7
  107. package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
  108. package/dist/server/plugins/nav-utils.js +1 -1
  109. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  110. package/dist/server/plugins/scorecard-classic/template/useData.js +1 -1
  111. package/dist/server/plugins/search/llmstxt/index.js +1 -1
  112. package/dist/server/plugins/sidebars/index.js +7 -3
  113. package/dist/server/plugins/sidebars/tabs.d.ts +19 -0
  114. package/dist/server/plugins/sidebars/tabs.js +1 -0
  115. package/dist/server/plugins/sso/index.js +1 -1
  116. package/dist/server/store.js +1 -1
  117. package/dist/server/tools/notifiers/helpers/privacy/mask-subject.js +1 -1
  118. package/dist/server/tools/notifiers/helpers/privacy/remove-pii.js +1 -1
  119. package/dist/server/utils/catalog-classic/get-catalog-shared-data-id.d.ts +3 -0
  120. package/dist/server/utils/catalog-classic/get-catalog-shared-data-id.js +1 -0
  121. package/dist/server/utils/envs/interpolate-env-variables.js +1 -1
  122. package/dist/server/utils/rbac.js +1 -1
  123. package/dist/server/utils/report-all-errors.js +1 -1
  124. package/dist/server/utils/sandbox-context.js +1 -1
  125. package/dist/server/utils/write-problems-report.d.ts +3 -0
  126. package/dist/server/utils/write-problems-report.js +1 -0
  127. package/dist/server/web-server/auth.d.ts +9 -3
  128. package/dist/server/web-server/auth.js +4 -4
  129. package/dist/server/web-server/routes/auth.js +1 -1
  130. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  131. package/dist/utils/path/parse-path-versions.js +1 -1
  132. package/dist/utils/string/to-kebab-case.js +1 -1
  133. package/package.json +7 -7
  134. package/dist/client/app/Sidebar/helpers/filter-out-versioned-items.js +0 -1
  135. package/dist/server/plugins/mcp/auth/token-audience-telemetry.d.ts +0 -7
  136. package/dist/server/plugins/mcp/auth/token-audience-telemetry.js +0 -1
  137. package/dist/server/plugins/mcp/auth/token-audience.d.ts +0 -6
  138. package/dist/server/plugins/mcp/auth/token-audience.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.138.0-next.5
4
+
5
+ ### Minor Changes
6
+
7
+ - aa2cc02077f: Added a "Link to this section" tooltip and hover, pressed, and current states to the link icon next to headings and properties in API docs.
8
+ A click on the icon scrolls smoothly to the section and leaves a gap below the header.
9
+ - 91d809f1ef0: Improved the **Expand all** and **Collapse all** controls in API reference schema sections.
10
+ - fcb1b9e93bb: Added `tab` entries to `sidebars.yaml` for organizing projects into logical sections.
11
+
12
+ ### Patch Changes
13
+
14
+ - 53c31e67923: Fixed an issue in API docs where overview pages displayed only the text of `info.description` that came before the first heading.
15
+ The sections under the headings were missing from both the page and the sidebar.
16
+ - 48d6de8aebf: Fixed an issue in OpenAPI docs where `label`, `icon`, and `badges` from `sidebars.yaml` were not applied to the API overview sidebar item.
17
+ - 59baca3ad3b: Updated `@redocly/openapi-core` to version `2.55.0`.
18
+ - 63e49c20ce4: Fixed an issue where the `openapi-code-sample` tag omitted the authentication line when the API description declared `security` at the root instead of on the operation.
19
+ - 94e74d18b8d: Fixed an issue where the link checker reported links to the `/mcp` and `/mcp-public` MCP server setup pages as broken when those pages were served.
20
+ - 6bb03d3e5e6: Fixed an issue where groups in the mobile menu and drilldown sidebar collapsed if user expanded them right after a page loaded.
21
+ - 48d6de8aebf: Fixed an issue in OpenAPI docs where links to headings in API description overview partials briefly displayed a "Page not found" error.
22
+ - aa2cc02077f: Fixed API docs link icons so they open the heading or property link without changing clipboard contents.
23
+ - cbc76e5e88b: Fixed an issue where a React page rendered blank if its page component was wrapped in `React.memo` or `forwardRef`.
24
+ - 555b74a73af: Fixed an issue in the **Try it** console where the toolbar in the **Body**, **Headers**, and **Cookies** tabs hid the copy button in a narrow response panel.
25
+ - 2fe28690761: Fixed an issue where the **Try it** console did not validate the response body against the documented response schema.
26
+ - Updated dependencies [53c31e67923]
27
+ - Updated dependencies [aa2cc02077f]
28
+ - Updated dependencies [59baca3ad3b]
29
+ - Updated dependencies [63e49c20ce4]
30
+ - Updated dependencies [295faffbd0a]
31
+ - Updated dependencies [6bb03d3e5e6]
32
+ - Updated dependencies [91d809f1ef0]
33
+ - Updated dependencies [48d6de8aebf]
34
+ - Updated dependencies [aa2cc02077f]
35
+ - Updated dependencies [fcb1b9e93bb]
36
+ - Updated dependencies [2fe28690761]
37
+ - @redocly/api-docs@0.3.0-next.4
38
+ - @redocly/theme@0.70.0-next.4
39
+ - @redocly/realm-asyncapi-sdk@0.16.0-next.2
40
+ - @redocly/portal-plugin-mock-server@0.23.0-next.0
41
+
3
42
  ## 0.138.0-next.4
4
43
 
5
44
  ### Patch Changes
@@ -126,6 +165,13 @@
126
165
  - @redocly/api-docs@0.3.0-next.0
127
166
  - @redocly/realm-asyncapi-sdk@0.16.0-next.0
128
167
 
168
+ ## 0.137.1
169
+
170
+ ### Patch Changes
171
+
172
+ - 4c8c1cc37c2: Fixed an issue where builds of projects that use the AsciiDoc plugin failed even though JavaScript compilation succeeded.
173
+ - f94d3b5a342: Fixed security issues in the web server.
174
+
129
175
  ## 0.137.0
130
176
 
131
177
  ### Minor Changes
@@ -1 +1 @@
1
- import{getApiFunctionsUsage as c}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as d}from"./collectors/get-async-api-usage.js";import{getConfigStatsUsage as p}from"./collectors/get-config-stats-usage.js";import{getFileExtensionsUsage as U}from"./collectors/get-file-extensions-usage.js";import{getFrontmatterUsage as u}from"./collectors/get-frontmatter-usage.js";import{getMarkdocUsage as S}from"./collectors/get-markdoc-usage.js";import{getNestedConfigsUsage as C}from"./collectors/get-nested-configs-usage.js";import{getProcessedConfigStatsUsage as x}from"./collectors/get-processed-config-stats-usage.js";import{getRefsUsage as y}from"./collectors/get-refs-usage.js";import{getSkillsUsage as k}from"./collectors/get-skills-usage.js";import{getThemeFolderUsage as v}from"./collectors/get-theme-folder-usage.js";import{telemetry as B}from"../../telemetry/index.js";import{envConfig as A}from"../../../server/config/env-config.js";async function R(i,n){const g=[c,d,p,U,u,S,C,x,y,k,v],l=await Promise.allSettled(g.map(t=>t({store:i,context:n}))),e={},s={};for(const t of l)if(t.status==="fulfilled"){const{name:r,value:a,version:f}=t.value;a&&(e[r]=a,s[r]=f)}const m={usageStats:e.usageStats,asyncApiUsage:e.asyncApiUsage,buildContext:e.buildContext,fileExtensions:e.fileExtensions,frontmatterUsage:e.frontmatterUsage,markdocUsage:e.markdocUsage,processedBuildContext:e.processedBuildContext,nestedConfigStats:e.nestedConfigStats,refsUsageStats:e.refsUsageStats,skillsUsage:e.skillsUsage,themeFolderUsage:e.themeFolderUsage,versions:JSON.stringify(s)},o=A.PROJECT_BUILD_ID||"unknown";B.sendBuildMessage([{id:o,object:"projectBuild",uri:`urn:redocly:realm:cli:projectBuild:${o}`,...m}])}export{R as collectAnalytics};
1
+ import{getApiFunctionsUsage as c}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as d}from"./collectors/get-async-api-usage.js";import{getConfigStatsUsage as U}from"./collectors/get-config-stats-usage.js";import{getFileExtensionsUsage as p}from"./collectors/get-file-extensions-usage.js";import{getFrontmatterUsage as u}from"./collectors/get-frontmatter-usage.js";import{getMarkdocUsage as S}from"./collectors/get-markdoc-usage.js";import{getNestedConfigsUsage as C}from"./collectors/get-nested-configs-usage.js";import{getProcessedConfigStatsUsage as b}from"./collectors/get-processed-config-stats-usage.js";import{getRefsUsage as x}from"./collectors/get-refs-usage.js";import{getSidebarsUsage as y}from"./collectors/get-sidebars-usage.js";import{getSkillsUsage as k}from"./collectors/get-skills-usage.js";import{getThemeFolderUsage as v}from"./collectors/get-theme-folder-usage.js";import{telemetry as B}from"../../telemetry/index.js";import{envConfig as A}from"../../../server/config/env-config.js";async function _(i,n){const g=[c,d,U,p,u,S,C,b,x,y,k,v],m=await Promise.allSettled(g.map(t=>t({store:i,context:n}))),e={},s={};for(const t of m)if(t.status==="fulfilled"){const{name:a,value:r,version:f}=t.value;r&&(e[a]=r,s[a]=f)}const l={usageStats:e.usageStats,asyncApiUsage:e.asyncApiUsage,buildContext:e.buildContext,fileExtensions:e.fileExtensions,frontmatterUsage:e.frontmatterUsage,markdocUsage:e.markdocUsage,processedBuildContext:e.processedBuildContext,nestedConfigStats:e.nestedConfigStats,refsUsageStats:e.refsUsageStats,sidebarsUsage:e.sidebarsUsage,skillsUsage:e.skillsUsage,themeFolderUsage:e.themeFolderUsage,versions:JSON.stringify(s)},o=A.PROJECT_BUILD_ID||"unknown";B.sendBuildMessage([{id:o,object:"projectBuild",uri:`urn:redocly:realm:cli:projectBuild:${o}`,...l}])}export{_ as collectAnalytics};
@@ -0,0 +1,12 @@
1
+ import type { Collector } from '../collect-analytics.js';
2
+ type SidebarsUsage = {
3
+ files: number;
4
+ filesWithTabs: number;
5
+ tabs: number;
6
+ menuTabs: number;
7
+ menuEntries: number;
8
+ };
9
+ export declare function summarizeSidebarFile(items: unknown): Omit<SidebarsUsage, 'files'>;
10
+ export declare const getSidebarsUsage: Collector;
11
+ export {};
12
+ //# sourceMappingURL=get-sidebars-usage.d.ts.map
@@ -0,0 +1 @@
1
+ import{isObject as r}from"../../../../utils/guards/is-object.js";function n(t){const s={filesWithTabs:0,tabs:0,menuTabs:0,menuEntries:0};if(!Array.isArray(t))return s;const e=t.filter(a=>r(a)&&typeof a.tab=="string");if(!e.length)return s;s.filesWithTabs=1,s.tabs=e.length;for(const a of e)Array.isArray(a.menu)&&(s.menuTabs+=1,s.menuEntries+=a.menu.length);return s}const b=async({context:t})=>{const s={files:0,filesWithTabs:0,tabs:0,menuTabs:0,menuEntries:0};for(const e of t.fs.scan(/sidebars\.yaml$/)){if(e.isVirtual||await t.isPathIgnored(e.relativePath))continue;s.files+=1;const{data:a}=await t.cache.load(e.relativePath,"yaml"),i=n(a);s.filesWithTabs+=i.filesWithTabs,s.tabs+=i.tabs,s.menuTabs+=i.menuTabs,s.menuEntries+=i.menuEntries}return{version:"1",name:"sidebarsUsage",value:JSON.stringify(s)}};export{b as getSidebarsUsage,n as summarizeSidebarFile};
@@ -1 +1 @@
1
- import y from"node:path";import{unlink as R}from"node:fs/promises";import{writeFileSync as T}from"node:fs";import{envConfig as h}from"../../server/config/env-config.js";import{PORTAL_VERSION as A}from"../../server/version.js";import{logger as e}from"../../server/tools/notifiers/logger.js";import{reporter as f}from"../../server/tools/notifiers/reporter.js";import{shutdowner as O}from"../../server/tools/shutdowner.js";import{promiseMapLimit as D}from"../../server/utils/async/promise-map-limit.js";import{validateReactPages as E}from"../../server/plugins/pages/validators/validate-react-pages.js";import{ensureDir as S}from"../../server/utils/index.js";import{initPlugins as M,runPlugins as j,writeClientEntries as x}from"../../server/plugins/lifecycle.js";import{createClientCompiler as L,createNodeBundleCompiler as J}from"../../server/esbuild/esbuild.js";import{validateAllMarkdowns as k}from"../../server/plugins/markdown/compiler.js";import{copyEnvFiles as F}from"./copy-env-files.js";import{EsbuildError as s,esbuildLogger as d}from"../../server/esbuild/esbuild-logger.js";import{reportAllErrors as U}from"../../server/utils/report-all-errors.js";import{collectAnalytics as z}from"./analytics/collect-analytics.js";import{copyMigrationsFolder as N}from"../../server/providers/database/copy-migrations.js";import{telemetry as c}from"../telemetry/index.js";import{telemetryTraceStep as m}from"../telemetry/helpers/trace-step.js";async function li(v,i){c.initialize(A),e.info("Starting project build.");const C=e.startTiming();await m("com.redocly.build.start",async P=>{x(i);const p=await L(i,i.outdir,"production"),u=await J(i,i.serverOutDir,"production");let o,g;try{await m("com.redocly.build.clientCompilation",async()=>{const l=e.startTiming(),n=await p.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Client JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.serverCompilation",async()=>{const l=e.startTiming(),n=await u.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Server JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",message:r.message,timeMs:r.timeMs}])}),await i.reloadMarkdocOptions();let t;({pluginInstances:t,lifecycleContext:o}=await M({outdir:i.outdir,serverOutDir:i.serverOutDir,contentDir:i.contentDir,devLogin:v.devLogin,setGlobalConfig:i.setGlobalConfig})),o.fs.dispose(),i.lifecycleContext=o,N(i),await j(t,i,o),g=z(i,o),await m("com.redocly.build.clientServerRecompile",async()=>{const l=e.startTiming();e.info("Re-compiling JavaScript with user code"),(await Promise.all([p.rebuild(),u.rebuild()]).catch(a=>{throw new s(a)})).forEach(({warnings:a})=>{Array.isArray(a)&&d(new s({warnings:a}))});const r=e.infoTime(l,"JavaScript re-compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.pagesValidation",async()=>{await E(i,o),await k(i,o)}),await U(o),i.markUserCodeReady()}catch(t){P?.error(t),t instanceof s&&await d(t),await f.panic(t instanceof Error?t:String(t))}finally{g&&await g.catch(()=>{}),await p.dispose(),await u.dispose()}f.printErrors(),e.info("Rendering pages..."),await m("com.redocly.build.prepareStaticData",async t=>{const l=e.startTiming(),n=[...i.getAllRoutes(),...i.getAllApiRoutes()];t?.setAttribute("totalRoutes",n.length.toString()),await D(n,15,a=>i.writeRouteStaticData(a,o));const r=e.successTime(l,"Page static data prepared.");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.storeSerialization",async()=>{const t=e.startTiming();S(i.serverOutDir),T(y.join(i.serverOutDir,"store.json"),JSON.stringify(await i.toJson())),e.successTime(t,"Store serialized and written."),F(i)});const w=h.REDOCLY_PROBLEMS_OUTPUT_FILE;if(w){const t=e.startTiming();T(S(w),JSON.stringify(f.getProblems()),"utf-8"),e.successTime(t,"Broken links written.")}await R(y.join(i.serverOutDir,"index.css"));const b=e.successTime(C,"All done");b&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...b}])}),await O.exitWithCode(0)}export{li as build};
1
+ import w from"node:path";import{unlink as C}from"node:fs/promises";import{writeFileSync as P}from"node:fs";import{PORTAL_VERSION as R}from"../../server/version.js";import{logger as e}from"../../server/tools/notifiers/logger.js";import{reporter as b}from"../../server/tools/notifiers/reporter.js";import{shutdowner as h}from"../../server/tools/shutdowner.js";import{promiseMapLimit as A}from"../../server/utils/async/promise-map-limit.js";import{validateReactPages as D}from"../../server/plugins/pages/validators/validate-react-pages.js";import{ensureDir as j}from"../../server/utils/index.js";import{initPlugins as E,runPlugins as M,writeClientEntries as O}from"../../server/plugins/lifecycle.js";import{createClientCompiler as x,createNodeBundleCompiler as k}from"../../server/esbuild/esbuild.js";import{validateAllMarkdowns as J}from"../../server/plugins/markdown/compiler.js";import{copyEnvFiles as L}from"./copy-env-files.js";import{EsbuildError as s,esbuildLogger as d}from"../../server/esbuild/esbuild-logger.js";import{reportAllErrors as z}from"../../server/utils/report-all-errors.js";import{writeProblemsReport as F}from"../../server/utils/write-problems-report.js";import{collectAnalytics as N}from"./analytics/collect-analytics.js";import{copyMigrationsFolder as U}from"../../server/providers/database/copy-migrations.js";import{telemetry as c}from"../telemetry/index.js";import{telemetryTraceStep as m}from"../telemetry/helpers/trace-step.js";async function li(y,i){c.initialize(R),e.info("Starting project build.");const T=e.startTiming();await m("com.redocly.build.start",async S=>{O(i);const p=await x(i,i.outdir,"production"),u=await k(i,i.serverOutDir,"production");let o,g;try{await m("com.redocly.build.clientCompilation",async()=>{const l=e.startTiming(),n=await p.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Client JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.serverCompilation",async()=>{const l=e.startTiming(),n=await u.rebuild().catch(a=>{throw new s(a)});Array.isArray(n.warnings)&&d(new s({warnings:n.warnings}));const r=e.infoTime(l,"Server JavaScript compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",message:r.message,timeMs:r.timeMs}])}),await i.reloadMarkdocOptions();let t;({pluginInstances:t,lifecycleContext:o}=await E({outdir:i.outdir,serverOutDir:i.serverOutDir,contentDir:i.contentDir,devLogin:y.devLogin,setGlobalConfig:i.setGlobalConfig})),o.fs.dispose(),i.lifecycleContext=o,U(i),await M(t,i,o),g=N(i,o),await m("com.redocly.build.clientServerRecompile",async()=>{const l=e.startTiming();e.info("Re-compiling JavaScript with user code"),(await Promise.all([p.rebuild(),u.rebuild()]).catch(a=>{throw new s(a)})).forEach(({warnings:a})=>{Array.isArray(a)&&d(new s({warnings:a}))});const r=e.infoTime(l,"JavaScript re-compiled");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.pagesValidation",async()=>{await D(i,o),await J(i,o)}),await z(o),i.markUserCodeReady()}catch(t){S?.error(t),t instanceof s&&await d(t),await b.panic(t instanceof Error?t:String(t))}finally{g&&await g.catch(()=>{}),await p.dispose(),await u.dispose()}b.printErrors(),e.info("Rendering pages..."),await m("com.redocly.build.prepareStaticData",async t=>{const l=e.startTiming(),n=[...i.getAllRoutes(),...i.getAllApiRoutes()];t?.setAttribute("totalRoutes",n.length.toString()),await A(n,15,a=>i.writeRouteStaticData(a,o));const r=e.successTime(l,"Page static data prepared.");r&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...r}])}),await m("com.redocly.build.storeSerialization",async()=>{const t=e.startTiming();j(i.serverOutDir),P(w.join(i.serverOutDir,"store.json"),JSON.stringify(await i.toJson())),e.successTime(t,"Store serialized and written."),L(i)});const v=e.startTiming();F()&&e.successTime(v,"Broken links written."),await C(w.join(i.serverOutDir,"index.css"));const f=e.successTime(T,"All done");f&&c.sendTimingPerformedMessage([{id:"buildStep",object:"timing",uri:"urn:redocly:realm:cli:timing:buildStep",...f}])}),await h.exitWithCode(0)}export{li as build};
@@ -1 +1 @@
1
- import*as c from"path";import{DEFAULT_THEME_NAME as i,USER_THEME_ALIAS as f}from"../../constants/common.js";import{logger as k}from"../../server/tools/notifiers/logger.js";import{reporter as T}from"../../server/tools/notifiers/reporter.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const L=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],m=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...L],S=["./components/CatalogClassic/CatalogClassicCard.*","./components/ColorModeSwitcher/**","./components/ReplayGate/**","./components/ReplaySecuritySchemeActions/**","./components/ReplayTopBarActions/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/NotFound.*","./layouts/Forbidden.*","./layouts/DocumentationLayoutTop.*","./layouts/DocumentationLayoutBottom.*","./icons/**","./markdoc/**","./ext/**"];async function v(t){const[p,r]=t._,{theme:l,force:u,onSuccess:d,onError:g,onOverride:h,config:E}=t,_=F.instance(),s=c.resolve(t["project-dir"]);let o=l;o||(o=i);const n=await A(s,E.plugins||[],o,r);n||await T.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const e=n?.config.ejectIgnore;e&&!Array.isArray(e)&&k.warn("'ejectIgnore' must be of type Array. Skipping.");const a=await _.getPackageEjectIgnore(),y={force:u,onSuccess:d,onError:g,onOverride:h,onlyFiles:o===i?S:void 0,ignoreFiles:Array.isArray(e)?[...e,...a,...m]:[...a,...m]};return{objectType:p,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:c.resolve(s,f),componentToEject:r,theme:o,options:y}}export{m as DEFAULT_IGNORED_FILES,S as EJECTABLE_FILES,v as default};
1
+ import*as c from"path";import{DEFAULT_THEME_NAME as i,USER_THEME_ALIAS as f}from"../../constants/common.js";import{logger as k}from"../../server/tools/notifiers/logger.js";import{reporter as T}from"../../server/tools/notifiers/reporter.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const v=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],m=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...v],L=["./components/CatalogClassic/CatalogClassicCard.*","./components/ColorModeSwitcher/**","./components/ReplayGate/**","./components/ReplaySecuritySchemeActions/**","./components/ReplayTopBarActions/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/NavigationTabs/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/NotFound.*","./layouts/Forbidden.*","./layouts/DocumentationLayoutTop.*","./layouts/DocumentationLayoutBottom.*","./icons/**","./markdoc/**","./ext/**"];async function S(t){const[p,r]=t._,{theme:l,force:u,onSuccess:d,onError:g,onOverride:h,config:E}=t,_=F.instance(),s=c.resolve(t["project-dir"]);let o=l;o||(o=i);const n=await A(s,E.plugins||[],o,r);n||await T.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const e=n?.config.ejectIgnore;e&&!Array.isArray(e)&&k.warn("'ejectIgnore' must be of type Array. Skipping.");const a=await _.getPackageEjectIgnore(),y={force:u,onSuccess:d,onError:g,onOverride:h,onlyFiles:o===i?L:void 0,ignoreFiles:Array.isArray(e)?[...e,...a,...m]:[...a,...m]};return{objectType:p,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:c.resolve(s,f),componentToEject:r,theme:o,options:y}}export{m as DEFAULT_IGNORED_FILES,L as EJECTABLE_FILES,S as default};
@@ -1 +1 @@
1
- function t(e){return e.length===0?e:`${e[0]?.toUpperCase()}${e.slice(1)}`}function c(e){return e.length===0?e:`${e[0]?.toLowerCase()}${e.slice(1)}`.replace(/[\W_]+(.)/g,(a,r)=>r.toUpperCase()).replace(/[\W_]/g,"")}function l(e){return/^[a-z][A-Za-z0-9]*$/.test(e)}export{c as camelCase,t as capitalize,l as isCamelCaseAlphaNumeric};
1
+ function t(e){return e.length===0?e:`${e[0]?.toUpperCase()}${e.slice(1)}`}function c(e){return e.length===0?e:`${e[0]?.toLowerCase()}${e.slice(1)}`.replace(/(?<![\W_])[\W_]+(.)/g,(a,r)=>r.toUpperCase()).replace(/[\W_]/g,"")}function l(e){return/^[a-z][A-Za-z0-9]*$/.test(e)}export{c as camelCase,t as capitalize,l as isCamelCaseAlphaNumeric};
@@ -1 +1 @@
1
- import{isRedocExtension as S}from"@redocly/api-docs/lib/utils/extract-extensions.js";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{isRef as m}from"@redocly/openapi-core";const u=40,g=20,R=20,f="$value",h="$keys",E="<truncated>",a="<masked>",x=new Set(["x-metadata","x-enumDescriptions","x-webhooks","x-examples"]),d="x-rbac",P=/key|token|secret|password|credential|session|bearer|auth|email|phone|contact|url|uri|host|domain|address|location/i,j=/^(?=.*\d)[A-Za-z0-9+/=_-]{16,}$/,_=/\S@\S+\.\S/,y=/:\/\//;function K(t){const n={enter(r,o){if(m(o.parent))return;const s=o.key.toString();S(s)&&A(t,s,r)}};return{any:{enter(r){if(!i(r))return;const o=r[O];o!==void 0&&A(t,d,o)}},SpecExtension:n,XCodeSampleList:n,ExamplesMap:n,EnumDescriptions:n,TagGroups:n,Logo:n,XServerList:n,XUsePkce:n,WebhooksMap:n}}function w(t){const n=Object.fromEntries(Object.entries(t).map(([e,{count:r,props:o}])=>[e,{count:r,props:Object.fromEntries(Object.entries(o).map(([s,c])=>[s,[...c].sort().join(", ")]))}]));return Object.keys(n).length>0?n:void 0}function A(t,n,e){const r=t[n]??={count:0,props:{}};if(r.count++,n===d){L(r.props,e);return}if(x.has(n)){l(r.props,e);return}for(const[o,s]of k(e)){const c=P.test(o)?a:b(s);p(r.props,T(o),c)}}function l(t,n){if(i(n))for(const[e,r]of Object.entries(n))p(t,h,`${N(e)}:${X(r)}`)}function L(t,n){if(i(n))for(const e of Object.values(n))p(t,f,b(e))}function X(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function k(t){return i(t)?Object.entries(t):Array.isArray(t)?t.flatMap(n=>i(n)?Object.entries(n):[[f,n]]):[[f,t]]}function b(t){return t===null?"<null>":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?j.test(t)||_.test(t)||y.test(t)?a:t.length<=u?t:`<string:${t.length}>`:Array.isArray(t)?`<array:${t.length}>`:i(t)?"$ref"in t?"<ref>":"<object>":"<unknown>"}function N(t){return _.test(t)||y.test(t)?a:t.length<=u?t:`<string:${t.length}>`}function p(t,n,e){!(n in t)&&Object.keys(t).length>=R&&(n=E),M(t[n]??=new Set,e)}function M(t,n){t.has(n)||t.has(E)||t.add(t.size>=g?E:n)}function T(t){return t.replace(/\./g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}export{K as createExtensionsVisitor,w as toCollectedExtensions};
1
+ import{isRedocExtension as O}from"@redocly/api-docs/lib/utils/extract-extensions.js";import{REDOCLY_TEAMS_RBAC as l}from"@redocly/config";import{isRef as m}from"@redocly/openapi-core";const p=40,S=20,g=20,f="$value",x="$keys",a="<truncated>",E="<masked>",h=new Set(["x-metadata","x-enumDescriptions","x-webhooks","x-examples"]),d="x-rbac",R=/key|token|secret|password|credential|session|bearer|auth|email|phone|contact|url|uri|host|domain|address|location/i,P=/^(?=.*\d)[A-Za-z0-9+/=_-]{16,}$/,_=/:\/\//;function y(n){for(const t of n.split(/\s/)){const e=t.indexOf("@",1);if(e===-1)continue;const r=t.indexOf(".",e+2);if(r!==-1&&r<=t.length-2)return!0}return!1}function K(n){const t={enter(r,o){if(m(o.parent))return;const s=o.key.toString();O(s)&&b(n,s,r)}};return{any:{enter(r){if(!i(r))return;const o=r[l];o!==void 0&&b(n,d,o)}},SpecExtension:t,XCodeSampleList:t,ExamplesMap:t,EnumDescriptions:t,TagGroups:t,Logo:t,XServerList:t,XUsePkce:t,WebhooksMap:t}}function w(n){const t=Object.fromEntries(Object.entries(n).map(([e,{count:r,props:o}])=>[e,{count:r,props:Object.fromEntries(Object.entries(o).map(([s,c])=>[s,[...c].sort().join(", ")]))}]));return Object.keys(t).length>0?t:void 0}function b(n,t,e){const r=n[t]??={count:0,props:{}};if(r.count++,t===d){k(r.props,e);return}if(h.has(t)){j(r.props,e);return}for(const[o,s]of N(e)){const c=R.test(o)?E:A(s);u(r.props,$(o),c)}}function j(n,t){if(i(t))for(const[e,r]of Object.entries(t))u(n,x,`${X(e)}:${L(r)}`)}function k(n,t){if(i(t))for(const e of Object.values(t))u(n,f,A(e))}function L(n){return n===null?"null":Array.isArray(n)?"array":typeof n}function N(n){return i(n)?Object.entries(n):Array.isArray(n)?n.flatMap(t=>i(t)?Object.entries(t):[[f,t]]):[[f,n]]}function A(n){return n===null?"<null>":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?P.test(n)||y(n)||_.test(n)?E:n.length<=p?n:`<string:${n.length}>`:Array.isArray(n)?`<array:${n.length}>`:i(n)?"$ref"in n?"<ref>":"<object>":"<unknown>"}function X(n){return y(n)||_.test(n)?E:n.length<=p?n:`<string:${n.length}>`}function u(n,t,e){!(t in n)&&Object.keys(n).length>=g&&(t=a),T(n[t]??=new Set,e)}function T(n,t){n.has(t)||n.has(a)||n.add(n.size>=S?a:t)}function $(n){return n.replace(/\./g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export{K as createExtensionsVisitor,w as toCollectedExtensions};
@@ -1 +1 @@
1
- const i="TranslationKey",u=async({getConfig:e,cache:t,fs:s})=>{const a=await e(),n=r(a),o=s.scan(/.*sidebars.yaml$/),c=await Promise.all(o.map(f=>t.load(f.relativePath,"yaml").then(d=>d.data)));return{...r(c),...n}},r=e=>{let t={};if(!e)return{};if(Array.isArray(e))for(const s of e)t={...t,...r(s)};if(typeof e=="object")for(const[s,a]of Object.entries(e))if(s.endsWith(i)&&typeof a=="string"){const n=s.slice(0,i.length*-1),o=e[n];if(!l(n)||!l(a)||!y(o))continue;t[a]=o||""}else t={...t,...r(a)};return t},l=e=>e.trim().length>0,y=e=>e==null||typeof e=="string";export{u as collectConfigTranslations};
1
+ const i="TranslationKey",u=async({getConfig:e,cache:t,fs:s})=>{const a=await e(),n=r(a),o=s.scan(/sidebars.yaml$/),c=await Promise.all(o.map(f=>t.load(f.relativePath,"yaml").then(d=>d.data)));return{...r(c),...n}},r=e=>{let t={};if(!e)return{};if(Array.isArray(e))for(const s of e)t={...t,...r(s)};if(typeof e=="object")for(const[s,a]of Object.entries(e))if(s.endsWith(i)&&typeof a=="string"){const n=s.slice(0,i.length*-1),o=e[n];if(!l(n)||!l(a)||!y(o))continue;t[a]=o||""}else t={...t,...r(a)};return t},l=e=>e.trim().length>0,y=e=>e==null||typeof e=="string";export{u as collectConfigTranslations};
@@ -1 +1 @@
1
- import e from"react";import{BrowserRouter as i}from"react-router";import{ThemeDataContext as u,SearchSessionProvider as m}from"@redocly/theme/core/contexts";import d from"@redocly/theme/core/templates/Markdown";import{useBreadcrumbs as l,useBanner as c,useConsent as p,useCatalogClassic as g,useCurrentProduct as h,useGlobalData as f,useI18n as C,useI18nConfig as T,useL10n as b,useL10nConfig as k,usePageData as v,usePageSharedData as w,usePageVersions as y,usePreloadHistory as P,useProducts as S,useUserMenu as D,useSubmitFeedback as $,useTranslate as E,useTranslationKeys as I,useSidebarSiblingsData as L,usePageProps as M,useUserTeams as x,useMarkdownText as F,useMarkdocRenderer as H,useCodeHighlight as R,useLoadAndNavigate as A,useCatalog as B,useCatalogSort as G,useCatalogSearch as O,useFetchCatalogEntities as U,useFetchCatalogEntitiesRelations as K,useTelemetry as r,useMcpData as N,useFetchCatalogEntityRevisions as Q}from"./app/hooks";import{Link as V}from"./app/Link";import{useFacetQuery as j,useSearch as q,useAiSearch as z}from"./app/search";import{useSidebarItems as J}from"./app/Sidebar/useSidebarItems";import{PageDataContext as W}from"./providers/page-data/PageDataContext";const s={Template:({pageProps:a,children:t})=>e.createElement(d,{pageProps:{...a,metadata:{...a.metadata,markdoc:{tagList:[]}}}},t),templateId:"markdown",isPublic:!0,props:{seo:{title:"Test"},ast:{$$mdtype:"Tag",name:"div",children:[{$$mdtype:"Tag",name:"Heading",attributes:{id:"github-flavored-markdown",level:1},children:["GitHub-flavored markdown"]},{$$mdtype:"Tag",name:"p",attributes:{},children:["These exercises assume you have",{$$mdtype:"Tag",name:"a",attributes:{href:"https://docs.redoc.ly/"},children:["basic markdown knowledge"]},"."]},{$$mdtype:"Tag",name:"Heading",attributes:{id:"create-a-new-plain-markdown-page",level:2},children:["Create a new plain markdown page"]}]},lastModified:new Date("2022-01-01").toISOString()},slug:"",userData:{isAuthenticated:!1,name:"test name",picture:""},sidebar:null,sharedData:{},sharedDataIds:{}},X={useBreadcrumbs:l,useBanner:c,useConsent:p,useCatalog:B,useCatalogSort:G,useCatalogSearch:O,useFetchCatalogEntities:U,useFetchCatalogEntitiesRelations:K,useFetchCatalogEntityRevisions:Q,useCatalogClassic:g,useCurrentProduct:h,useGlobalData:f,useSearch:q,useAiSearch:z,useFacetQuery:j,useI18n:C,useI18nConfig:T,useL10n:b,useL10nConfig:k,usePageData:v,usePageSharedData:w,usePageVersions:y,usePreloadHistory:P,useProducts:S,useUserMenu:D,useSidebarItems:J,useSidebarSiblingsData:L,useSubmitFeedback:$,useTranslate:E,useTranslationKeys:I,useUserTeams:x,usePageProps:M,useMarkdownText:F,useMarkdocRenderer:H,useCodeHighlight:R,useLoadAndNavigate:A,useTelemetry:r,useOtelTelemetry:r,useMcpData:N},Y={LinkComponent:V},o={hooks:X,components:Y,config:{}};function ie({children:a,customPageData:t,config:n}){return e.createElement(i,null,e.createElement(m,null,e.createElement(W.Provider,{value:{...s,...t,props:{...s.props,...t?.props}}},e.createElement(u.Provider,{value:{...o,config:n??o.config}},a))))}export{ie as TestProvider};
1
+ import e from"react";import{BrowserRouter as i}from"react-router";import{ThemeDataContext as u,SearchSessionProvider as m}from"@redocly/theme/core/contexts";import d from"@redocly/theme/core/templates/Markdown";import{useBreadcrumbs as l,useBanner as c,useConsent as p,useCatalogClassic as g,useCurrentProduct as h,useGlobalData as f,useI18n as T,useI18nConfig as b,useL10n as C,useL10nConfig as k,usePageData as v,usePageSharedData as S,usePageVersions as w,usePreloadHistory as y,useProducts as P,useUserMenu as D,useSubmitFeedback as $,useTranslate as E,useTranslationKeys as F,useSidebarSiblingsData as I,useNavigationTabs as L,usePageProps as M,useUserTeams as x,useMarkdownText as H,useMarkdocRenderer as R,useCodeHighlight as A,useLoadAndNavigate as B,useCatalog as G,useCatalogSort as N,useCatalogSearch as O,useFetchCatalogEntities as U,useFetchCatalogEntitiesRelations as K,useTelemetry as r,useMcpData as Q,useFetchCatalogEntityRevisions as V}from"./app/hooks";import{Link as j}from"./app/Link";import{useFacetQuery as q,useSearch as z,useSearchFeatures as J,useAiSearch as W}from"./app/search";import{useSidebarItems as X}from"./app/Sidebar/useSidebarItems";import{PageDataContext as Y}from"./providers/page-data/PageDataContext";const s={Template:({pageProps:a,children:t})=>e.createElement(d,{pageProps:{...a,metadata:{...a.metadata,markdoc:{tagList:[]}}}},t),templateId:"markdown",isPublic:!0,props:{seo:{title:"Test"},ast:{$$mdtype:"Tag",name:"div",children:[{$$mdtype:"Tag",name:"Heading",attributes:{id:"github-flavored-markdown",level:1},children:["GitHub-flavored markdown"]},{$$mdtype:"Tag",name:"p",attributes:{},children:["These exercises assume you have",{$$mdtype:"Tag",name:"a",attributes:{href:"https://docs.redoc.ly/"},children:["basic markdown knowledge"]},"."]},{$$mdtype:"Tag",name:"Heading",attributes:{id:"create-a-new-plain-markdown-page",level:2},children:["Create a new plain markdown page"]}]},lastModified:new Date("2022-01-01").toISOString()},slug:"",userData:{isAuthenticated:!1,name:"test name",picture:""},sidebar:null,sharedData:{},sharedDataIds:{}},Z={useBreadcrumbs:l,useBanner:c,useConsent:p,useCatalog:G,useCatalogSort:N,useCatalogSearch:O,useFetchCatalogEntities:U,useFetchCatalogEntitiesRelations:K,useFetchCatalogEntityRevisions:V,useCatalogClassic:g,useCurrentProduct:h,useGlobalData:f,useSearch:z,useSearchFeatures:J,useAiSearch:W,useFacetQuery:q,useI18n:T,useI18nConfig:b,useL10n:C,useL10nConfig:k,usePageData:v,usePageSharedData:S,usePageVersions:w,usePreloadHistory:y,useProducts:P,useUserMenu:D,useSidebarItems:X,useSidebarSiblingsData:I,useNavigationTabs:L,useSubmitFeedback:$,useTranslate:E,useTranslationKeys:F,useUserTeams:x,usePageProps:M,useMarkdownText:H,useMarkdocRenderer:R,useCodeHighlight:A,useLoadAndNavigate:B,useTelemetry:r,useOtelTelemetry:r,useMcpData:Q},_={LinkComponent:j},o={hooks:Z,components:_,config:{}};function me({children:a,customPageData:t,config:n}){return e.createElement(i,null,e.createElement(m,null,e.createElement(Y.Provider,{value:{...s,...t,props:{...s.props,...t?.props}}},e.createElement(u.Provider,{value:{...o,config:n??o.config}},a))))}export{me as TestProvider};
@@ -1 +1 @@
1
- import*as s from"react";import u from"path";import{Link as U,useNavigate as z,useLocation as F}from"react-router";import{getPathnameForLocale as M,withPathPrefix as W}from"@redocly/theme/core/utils";import{removeTrailingSlash as I}from"../../utils/url/remove-trailing-slash";import{normalizeRouteSlug as h}from"../../utils/path/normalize-route-slug";import{isAbsoluteUrl as V}from"../../utils/url/is-absolute-url";import{isAssetsLink as j}from"../../utils/path/is-assets-link";import{useL10nConfig as q}from"./hooks/index.js";import{loadAndNavigate as B}from"./utils/loadAndNavigate.js";import{isForcedNavigationLinkClick as G}from"../utils/utils.js";async function g(o,t){if(V(o))return;await(typeof window<"u"?window:global).__LOADER.tryLoad(o,void 0,t)}function oe(o){const{to:t,children:l,className:v,style:a,innerRef:i,target:L,external:c,languageInsensitive:w,onClick:m,active:H,rel:y,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,..._}=o,x=L||(c?"_blank":"_self"),A=c||t.match(/^(https?:\/\/|mailto:)/),f=y||(A?"noreferrer":void 0),n={className:v,children:l,target:x,...f&&{rel:f},onClick:m,..._},{defaultLocale:D,locales:S,currentLocale:b}=q(),O=F();let e=t;e.startsWith(".")&&(e=u.resolve(u.dirname(h(O.pathname)),h(t))),e=e.startsWith("#")?e:W(w?e:M(e,D,b,S));const r=e!=="/"?I(e):e,T=z(),d=typeof window<"u"?new URL(r,window.location.origin+window.location.pathname).search:void 0;return typeof t=="string"&&t.match(/^(https?:\/\/|mailto:)/)?s.createElement("a",{...n,ref:i,style:a,href:t,onMouseOver:async()=>g(t,d)}):j(r)?s.createElement("a",{...n,ref:i,style:a,href:r}):s.createElement(U,{...n,ref:i,style:a,to:r,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,onClick:p=>{m?.(),!G(p,n.target)&&(p.preventDefault(),B({navigate:T,to:r}))},onMouseOver:async()=>g(r,d)})}export{oe as Link};
1
+ import*as l from"react";import d from"path";import{Link as U,useNavigate as z,useLocation as F}from"react-router";import{getPathnameForLocale as M,withPathPrefix as W}from"@redocly/theme/core/utils";import{removeTrailingSlash as I}from"../../utils/url/remove-trailing-slash";import{normalizeRouteSlug as h}from"../../utils/path/normalize-route-slug";import{isAbsoluteUrl as V}from"../../utils/url/is-absolute-url";import{isAssetsLink as j}from"../../utils/path/is-assets-link";import{useL10nConfig as q}from"./hooks/index.js";import{loadAndNavigate as B}from"./utils/loadAndNavigate.js";import{isForcedNavigationLinkClick as G}from"../utils/utils.js";async function g(o,t){if(V(o))return;await(typeof window<"u"?window:global).__LOADER.tryLoad(o,void 0,t)}function oe(o){const{to:t,children:n,className:v,style:i,innerRef:s,target:L,external:c,languageInsensitive:w,onClick:m,active:H,rel:y,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,..._}=o,x=L||(c?"_blank":"_self"),A=c||t.match(/^(https?:\/\/|mailto:)/),f=y||(A?"noreferrer":void 0),a={className:v,target:x,...f&&{rel:f},onClick:m,..._},{defaultLocale:D,locales:S,currentLocale:b}=q(),O=F();let e=t;e.startsWith(".")&&(e=d.resolve(d.dirname(h(O.pathname)),h(t))),e=e.startsWith("#")?e:W(w?e:M(e,D,b,S));const r=e!=="/"?I(e):e,T=z(),p=typeof window<"u"?new URL(r,window.location.origin+window.location.pathname).search:void 0;return typeof t=="string"&&t.match(/^(https?:\/\/|mailto:)/)?l.createElement("a",{...a,ref:s,style:i,href:t,onMouseOver:async()=>g(t,p)},n):j(r)?l.createElement("a",{...a,ref:s,style:i,href:r},n):l.createElement(U,{...a,ref:s,style:i,to:r,reloadDocument:k,preventScrollReset:R,relative:P,viewTransition:C,state:E,replace:N,onClick:u=>{m?.(),!G(u,a.target)&&(u.preventDefault(),B({navigate:T,to:r}))},onMouseOver:async()=>g(r,p)},n)}export{oe as Link};
@@ -1 +1 @@
1
- import{useLocation as A}from"react-router";import{useEffect as w,useMemo as f,useRef as _,useState as k}from"react";import{useActiveSectionId as D}from"@redocly/theme/core/hooks";import{getMenuItemType as C}from"@redocly/theme/core/utils";import{MenuItemType as v}from"@redocly/theme/core/constants";import{CATALOG_BASE_SLUG as T,CATALOG_SLUGS as h}from"../../../constants/catalog-entities";import{usePageSharedData as y,useSidebarItemsData as G,useSidebarConnectedCatalogConfig as E,useSidebarConnectedCatalogEntity as O}from"../../providers/page-data/hooks";import{mapItemsPropsToState as b}from"./utils";import{injectCatalogItems as K}from"../../utils/catalog/inject-catalog-items";import{filterOutVersionedItems as R}from"./helpers/filter-out-versioned-items";const B="catalog.backToAllLabel",M=`${T}/${h.ALL}`;function U(o){const e=G();return f(()=>R(e,o),[e,o])}function J(o){const e=A(),t=D(e,!0),a=O(),g=E(),c=U(o),s=a?K(c,a.key,g?.slug,e.search):c,u=_(null),r=f(()=>b(s,e,t),[t,e,s]),l=y("current-catalog-info"),p=f(()=>S(r),[s]),[n,m]=k(p),i=n.length>0?n[n.length-1]:void 0,I=i&&b([...i.item.link?[{...i.item,items:[],menuStyle:void 0,separatorLine:!1}]:[],...i.item.items],e,t);w(()=>{if(!u.current||u.current!==t){const d=S(r);m(d),u.current=t}},[c,e,t]);const L=i?{slug:i.previousLink,event:"sidebar_drilldown_back_button.clicked"}:a?{label:"Back to Catalog",labelTranslationKey:B,slug:M,event:"back_to_catalog_button.clicked"}:l?{label:l.catalog.label,labelTranslationKey:l.catalog.labelTranslationKey,slug:l.catalog.link,event:"back_to_catalog_button.clicked"}:void 0;return{currentItems:I||r,allSidebarItems:r,popDrilldownState:()=>{n.length>0&&m(n.slice(0,n.length-1))},pushDrilldownState:d=>{m([...n,d])},backLink:L,versionLabel:a?.version??null}}function S(o,e=[]){for(const t of o){if(!t.active&&!t.hasActiveSubItem)continue;if(C(t)===v.DrillDown&&e.push({item:t}),t.active)return e;if(t.hasActiveSubItem)return S(t.items,e)}return e}export{U as useRawSidebarItems,J as useSidebarItems};
1
+ import{useLocation as A}from"react-router";import{useEffect as w,useMemo as c,useRef as _,useState as k}from"react";import{useActiveSectionId as D}from"@redocly/theme/core/hooks";import{getMenuItemType as C}from"@redocly/theme/core/utils";import{MenuItemType as v}from"@redocly/theme/core/constants";import{CATALOG_BASE_SLUG as T,CATALOG_SLUGS as h}from"../../../constants/catalog-entities";import{usePageSharedData as y,useSidebarItemsData as G,useSidebarConnectedCatalogConfig as E,useSidebarConnectedCatalogEntity as O}from"../../providers/page-data/hooks";import{mapItemsPropsToState as b}from"./utils";import{injectCatalogItems as K}from"../../utils/catalog/inject-catalog-items";import{filterOutVersionedItems as R}from"../../utils/filter-out-versioned-items";const B="catalog.backToAllLabel",M=`${T}/${h.ALL}`;function U(i){const e=G();return c(()=>R(e,i),[e,i])}function J(i){const e=A(),t=D(e,!0),a=O(),g=E(),s=U(i),u=a?K(s,a.key,g?.slug,e.search):s,m=_(null),r=c(()=>b(u,e,t),[t,e,u]),l=y("current-catalog-info"),p=c(()=>S(r),[u]),[n,d]=k(p),o=n.length>0?n[n.length-1]:void 0,I=c(()=>o&&b([...o.item.link?[{...o.item,items:[],menuStyle:void 0,separatorLine:!1}]:[],...o.item.items],e,t),[o,e,t]);w(()=>{if(!m.current||m.current!==t){const f=S(r);d(f),m.current=t}},[s,e,t]);const L=o?{slug:o.previousLink,event:"sidebar_drilldown_back_button.clicked"}:a?{label:"Back to Catalog",labelTranslationKey:B,slug:M,event:"back_to_catalog_button.clicked"}:l?{label:l.catalog.label,labelTranslationKey:l.catalog.labelTranslationKey,slug:l.catalog.link,event:"back_to_catalog_button.clicked"}:void 0;return{currentItems:I||r,allSidebarItems:r,popDrilldownState:()=>{n.length>0&&d(n.slice(0,n.length-1))},pushDrilldownState:f=>{d([...n,f])},backLink:L,versionLabel:a?.version??null}}function S(i,e=[]){for(const t of i){if(!t.active&&!t.hasActiveSubItem)continue;if(C(t)===v.DrillDown&&e.push({item:t}),t.active)return e;if(t.hasActiveSubItem)return S(t.items,e)}return e}export{U as useRawSidebarItems,J as useSidebarItems};
@@ -1 +1 @@
1
- function u(){return{root(e){this.addClassToHast(e.children?.[0],"tree-view-root")},line(e){this.addClassToHast(e,"tree-view-line");const r=e.children?.[0]?.children?.[0];if(r?.type!=="text")return e;const s=r.value||"",t=s.match(/^(.*?)(\s*#.*)?$/);let a=s,i="";t&&(a=(t[1]||"").trimEnd(),i=t[2]||"");const f=a.trim().split(" "),c=[],o=[];let p=!1;f.forEach(n=>{n.match(/(\w+|\.|\/|-|_)/g)||p?(o.push(n),p=!0):c.push(n)});const l=o.join(" ").trim(),m=l.split("."),h=m.length>1?m.pop():void 0;return e.children=[{type:"element",tagName:"span",properties:{class:"tree-view-branch"},children:[{type:"text",value:c.join(" ")}]},{type:"element",tagName:"span",properties:{class:`tree-view-file ${l?"ext-"+(h||"folder"):"no-file"}`},children:[{type:"text",value:l}]}],i&&e.children.push({type:"element",tagName:"span",properties:{class:"tree-view-comment"},children:[{type:"text",value:i}]}),e}}}export{u as default};
1
+ function u(){return{root(e){this.addClassToHast(e.children?.[0],"tree-view-root")},line(e){this.addClassToHast(e,"tree-view-line");const s=e.children?.[0]?.children?.[0];if(s?.type!=="text")return e;const r=s.value||"",t=r.match(/^([^#\n]*?)((?<=[^\s]|^)\s*#.*)?$/);let a=r,i="";t&&(a=(t[1]||"").trimEnd(),i=t[2]||"");const f=a.trim().split(" "),c=[],o=[];let p=!1;f.forEach(n=>{n.match(/(\w+|\.|\/|-|_)/g)||p?(o.push(n),p=!0):c.push(n)});const l=o.join(" ").trim(),m=l.split("."),h=m.length>1?m.pop():void 0;return e.children=[{type:"element",tagName:"span",properties:{class:"tree-view-branch"},children:[{type:"text",value:c.join(" ")}]},{type:"element",tagName:"span",properties:{class:`tree-view-file ${l?"ext-"+(h||"folder"):"no-file"}`},children:[{type:"text",value:l}]}],i&&e.children.push({type:"element",tagName:"span",properties:{class:"tree-view-comment"},children:[{type:"text",value:i}]}),e}}}export{u as default};
@@ -1 +1 @@
1
- import m,{useMemo as h}from"react";import{parse as p,transform as u,renderers as b,Tag as g,nodes as d}from"@markdoc/markdoc";import{CodeBlock as k}from"@redocly/theme/components/CodeBlock/CodeBlock";import{tags as C,components as y}from"@redocly/theme/markdoc/default";const N=Object.fromEntries(Object.entries(y).filter(([,t])=>typeof t=="function")),T=t=>/\{%\s*(?:\/?\w+(?:-\w+)*|\/)(?:\s+[^%]+)?\s*(?:\/%|%\})/.test(t),w=(t,e)=>{try{const r=u(t,e);return Array.isArray(r)?r:[r]}catch(r){console.error("Error transforming node:",r)}return[]},l=(t,e,r,n)=>new g("CodeBlock",{...t,header:{title:n,controls:{copy:{}}},source:e,lang:r},[]),A=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"]||"markdoc",c=r["data-title"],o=t.attributes.content||"",a=l(r,o,n,c),s=[];if(!t.children||t.children.length<=1)return{codeNode:a,contentNodes:s};for(const i of t.children){if(!i)continue;const f=w(i,e);s.push(...f)}return{codeNode:a,contentNodes:s}},F=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"],c=r["data-title"],o=t.attributes.content||"";if(!T(o)||!t.children||t.children.length===0)return l(r,o,n,c);const a=t.children[0];if(!a||a.type!=="tag")return l(r,o,n,c);const{codeNode:s,contentNodes:i}=A(t,e);return new g("Fragment",{},[s,...i])},x=t=>h(()=>{if(!t)return null;const r=p(t),n=u(r,{tags:C,nodes:{document:{...d.document,render:"div"},fence:{...d.fence,attributes:{...d.fence.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform:F}}});return b.react(n,m,{components:{...N,CodeBlock:k,Fragment:m.Fragment}})},[t]);export{T as containsMarkdocTags,x as useMarkdownText};
1
+ import m,{useMemo as h}from"react";import{parse as p,transform as u,renderers as b,Tag as g,nodes as d}from"@markdoc/markdoc";import{CodeBlock as k}from"@redocly/theme/components/CodeBlock/CodeBlock";import{tags as C,components as y}from"@redocly/theme/markdoc/default";const N=Object.fromEntries(Object.entries(y).filter(([,t])=>typeof t=="function")),T=t=>/\{%\s*(?:\/?\w+(?:-\w+)*|\/)(?:\s[^%]*)?(?:\/%|%\})/.test(t),w=(t,e)=>{try{const r=u(t,e);return Array.isArray(r)?r:[r]}catch(r){console.error("Error transforming node:",r)}return[]},l=(t,e,r,n)=>new g("CodeBlock",{...t,header:{title:n,controls:{copy:{}}},source:e,lang:r},[]),A=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"]||"markdoc",c=r["data-title"],o=t.attributes.content||"",a=l(r,o,n,c),s=[];if(!t.children||t.children.length<=1)return{codeNode:a,contentNodes:s};for(const i of t.children){if(!i)continue;const f=w(i,e);s.push(...f)}return{codeNode:a,contentNodes:s}},F=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"],c=r["data-title"],o=t.attributes.content||"";if(!T(o)||!t.children||t.children.length===0)return l(r,o,n,c);const a=t.children[0];if(!a||a.type!=="tag")return l(r,o,n,c);const{codeNode:s,contentNodes:i}=A(t,e);return new g("Fragment",{},[s,...i])},x=t=>h(()=>{if(!t)return null;const r=p(t),n=u(r,{tags:C,nodes:{document:{...d.document,render:"div"},fence:{...d.fence,attributes:{...d.fence.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform:F}}});return b.react(n,m,{components:{...N,CodeBlock:k,Fragment:m.Fragment}})},[t]);export{T as containsMarkdocTags,x as useMarkdownText};
@@ -1,4 +1,4 @@
1
- export { useSearch } from './useSearch';
1
+ export { useSearch, useSearchFeatures } from './useSearch';
2
2
  export { useFacetQuery } from './useFacets';
3
3
  export { useAiSearch } from './useAiSearch';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{useSearch as o}from"./useSearch";import{useFacetQuery as u}from"./useFacets";import{useAiSearch as c}from"./useAiSearch";export{c as useAiSearch,u as useFacetQuery,o as useSearch};
1
+ import{useSearch as o,useSearchFeatures as u}from"./useSearch";import{useFacetQuery as s}from"./useFacets";import{useAiSearch as c}from"./useAiSearch";export{c as useAiSearch,s as useFacetQuery,o as useSearch,u as useSearchFeatures};
@@ -1,4 +1,7 @@
1
1
  import type { SearchItemData, SearchFilterItem, SearchFacet } from '@redocly/theme/core/types';
2
+ export declare function useSearchFeatures(): {
3
+ askAi: boolean | undefined;
4
+ };
2
5
  export declare function useSearch(product?: string, disableAutoSearch?: boolean): {
3
6
  query: string;
4
7
  setQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
@@ -1 +1 @@
1
- import{useCallback as P,useEffect as v,useState as S,useRef as _}from"react";import{SEARCH_DEBOUNCE_TIME_MS as L}from"@redocly/theme/core/constants";import{getBaseDataAttributes as M,withPathPrefix as H}from"@redocly/theme/core/utils";import{ServerRoutes as T}from"../../../constants/api";import{SEARCH_GROUP_FACET_FIELD as j,SEARCH_PRODUCT_FIELD as U,SEARCH_VERSION_FIELD as B}from"../../../constants/common";import{debounce as J}from"../../../utils/time/debounce.js";import{useSearchSession as K}from"@redocly/theme/core/contexts";import{useGlobalData as $,useI18nConfig as k}from"../hooks";import{usePageVersions as z}from"../../providers/page-data/hooks";import{useFacets as W}from"./useFacets";import{telemetry as X}from"../telemetry/index.js";const Y=(o,u,r,l,E,s,R,i,n,d)=>{const{searchSessionId:C}=K(),{currentLocale:F}=k(),f=_(""),p=_(null),h=_(async(e,c)=>{try{R(null);const t=await fetch(H(T.SEARCH),c);if(!t.ok)throw new Error(t.statusText||`Search failed (${t.status})`);if(y(e)){const a=await t.json();l(a.facets),r(a.documents),E(a.groupCounts??{}),p.current=null,e.trim().length>1&&X.sendSearchQueryMessage([{...M("searchQuery","search"),query:e,resultCount:Object.keys(a.documents).length.toString(),searchSessionId:C,...n&&{product:n}}]),s(!1)}}catch(t){if(!y(e))return;p.current={query:e,requestParams:c},r({}),s(!1),R(t instanceof Error?t.message:"An unknown error occurred")}}),y=e=>f.current===e,m=P(J(async(e,c,t,a)=>{if(!e.trim().length&&!c.length){r({}),l({}),E({}),s(!1),R(null),p.current=null;return}const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,filter:x(c,a,i),locale:t})};await h.current(e,g)},L),[i?.version,i?.folderId,n]);return v(()=>{d||(s(!0),m(o,u,F,n),f.current=o)},[d,u,F,n,o,m,s]),{retrySearch:P(async()=>{const e=p.current;e&&(s(!0),f.current=e.query,await h.current(e.query,e.requestParams))},[s])}},Z=(o,u,r,l,E,s,R,i,n,d)=>{const{currentLocale:C}=k();v(()=>{F(r,o,u,C,l,E,n,d)},[l,n,d?.version,d?.folderId]);const F=P(async(f,p,h,y,m,b,e,c)=>{if(m){const{groupKey:t}=m;i(!0);const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:p,filter:(()=>{const I=b.find(D=>D.field===j);let O=h;return I&&(h.find(q=>q.field===I.field)||(O=[...h,{field:I.field,values:[t]}])),x(O,e,c)})(),loadMore:m,locale:y})},w=await(await fetch(H(T.SEARCH),g)).json(),G=f[t]||[],N=w.documents[t]??[],Q={...f,[t]:[...G,...N]};s(Q),w.groupCounts&&R(I=>({...I,...w.groupCounts})),i(!1)}},[]);return{}};function ie(o,u){const{searchFeatures:r}=$(),[l,E]=S(""),[s,R]=S([]),[i,n]=S({}),[d,C]=S({}),[F,f]=S({}),[p,h]=S(),[y,m]=S(!1),[b,e]=S(null),{facets:c}=W(d),{versions:t=[]}=z()||{},a=t.find(A=>A?.active),{retrySearch:g}=Y(l,s,n,C,f,m,e,a,o,u);return Z(l,s,i,p,c,n,f,m,o,a),{query:l,setQuery:E,filter:s,setFilter:R,items:i,isSearchLoading:y,searchError:b,facets:c,groupCounts:F,groupField:j,setLoadMore:h,retrySearch:g,advancedSearch:r?.advanced?.enabled,askAi:r?.ai?.enabled}}function x(o,u,r){return[...o,...u?[{field:U,values:[u]}]:[],...r?[{field:B,values:[...r.default?["default"]:[r.folderId,r.version]]}]:[]]}export{ie as useSearch};
1
+ import{useCallback as A,useEffect as k,useState as S,useRef as P}from"react";import{SEARCH_DEBOUNCE_TIME_MS as M}from"@redocly/theme/core/constants";import{getBaseDataAttributes as U,withPathPrefix as v}from"@redocly/theme/core/utils";import{ServerRoutes as H}from"../../../constants/api";import{SEARCH_GROUP_FACET_FIELD as T,SEARCH_PRODUCT_FIELD as B,SEARCH_VERSION_FIELD as J}from"../../../constants/common";import{debounce as K}from"../../../utils/time/debounce.js";import{useSearchSession as $}from"@redocly/theme/core/contexts";import{useGlobalData as j,useI18nConfig as x}from"../hooks";import{usePageVersions as z}from"../../providers/page-data/hooks";import{useFacets as W}from"./useFacets";import{telemetry as X}from"../telemetry/index.js";const Y=(n,u,r,i,R,s,F,l,o,d)=>{const{searchSessionId:C}=$(),{currentLocale:E}=x(),f=P(""),p=P(null),h=P(async(e,a)=>{try{F(null);const t=await fetch(v(H.SEARCH),a);if(!t.ok)throw new Error(t.statusText||`Search failed (${t.status})`);if(y(e)){const c=await t.json();i(c.facets),r(c.documents),R(c.groupCounts??{}),p.current=null,e.trim().length>1&&X.sendSearchQueryMessage([{...U("searchQuery","search"),query:e,resultCount:Object.keys(c.documents).length.toString(),searchSessionId:C,...o&&{product:o}}]),s(!1)}}catch(t){if(!y(e))return;p.current={query:e,requestParams:a},r({}),s(!1),F(t instanceof Error?t.message:"An unknown error occurred")}}),y=e=>f.current===e,m=A(K(async(e,a,t,c)=>{if(!e.trim().length&&!a.length){r({}),i({}),R({}),s(!1),F(null),p.current=null;return}const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,filter:G(a,c,l),locale:t})};await h.current(e,g)},M),[l?.version,l?.folderId,o]);return k(()=>{d||(s(!0),m(n,u,E,o),f.current=n)},[d,u,E,o,n,m,s]),{retrySearch:A(async()=>{const e=p.current;e&&(s(!0),f.current=e.query,await h.current(e.query,e.requestParams))},[s])}},Z=(n,u,r,i,R,s,F,l,o,d)=>{const{currentLocale:C}=x();k(()=>{E(r,n,u,C,i,R,o,d)},[i,o,d?.version,d?.folderId]);const E=A(async(f,p,h,y,m,b,e,a)=>{if(m){const{groupKey:t}=m;l(!0);const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:p,filter:(()=>{const I=b.find(D=>D.field===T);let O=h;return I&&(h.find(L=>L.field===I.field)||(O=[...h,{field:I.field,values:[t]}])),G(O,e,a)})(),loadMore:m,locale:y})},w=await(await fetch(v(H.SEARCH),g)).json(),N=f[t]||[],Q=w.documents[t]??[],q={...f,[t]:[...N,...Q]};s(q),w.groupCounts&&F(I=>({...I,...w.groupCounts})),l(!1)}},[]);return{}};function le(){const{searchFeatures:n}=j();return{askAi:n?.ai?.enabled}}function fe(n,u){const{searchFeatures:r}=j(),[i,R]=S(""),[s,F]=S([]),[l,o]=S({}),[d,C]=S({}),[E,f]=S({}),[p,h]=S(),[y,m]=S(!1),[b,e]=S(null),{facets:a}=W(d),{versions:t=[]}=z()||{},c=t.find(_=>_?.active),{retrySearch:g}=Y(i,s,o,C,f,m,e,c,n,u);return Z(i,s,l,p,a,o,f,m,n,c),{query:i,setQuery:R,filter:s,setFilter:F,items:l,isSearchLoading:y,searchError:b,facets:a,groupCounts:E,groupField:T,setLoadMore:h,retrySearch:g,advancedSearch:r?.advanced?.enabled,askAi:r?.ai?.enabled}}function G(n,u,r){return[...n,...u?[{field:B,values:[u]}]:[],...r?[{field:J,values:[...r.default?["default"]:[r.folderId,r.version]]}]:[]]}export{fe as useSearch,le as useSearchFeatures};
@@ -1,5 +1,6 @@
1
1
  import type { PageProps, ResolvedNavItem, CatalogEntityConfig } from '@redocly/config';
2
2
  import type { SidebarConnectedEntity } from '@redocly/theme/core/types';
3
+ import type { ResolvedNavigationTabs } from '../../utils/navigation-tabs';
3
4
  export * from './use-page-shared-data';
4
5
  export declare function usePageData(): import("../../../types").ResolvedPageData | null;
5
6
  export declare function usePageProps<T extends object>(): PageProps & T;
@@ -18,6 +19,7 @@ export declare function usePageVersions(): {
18
19
  link: string;
19
20
  }[];
20
21
  };
22
+ export declare function useNavigationTabs(): ResolvedNavigationTabs | undefined;
21
23
  export declare function useSidebarItemsData(): ResolvedNavItem[];
22
24
  export declare function useSidebarConnectedCatalogEntity(): SidebarConnectedEntity | undefined;
23
25
  export declare function useSidebarConnectedCatalogConfig(): CatalogEntityConfig | undefined;
@@ -1 +1 @@
1
- import i,{useContext as a}from"react";import{useLocation as p}from"react-router";import{removeLeadingSlash as m,removeTrailingSlash as f}from"@redocly/theme/core/utils";import{findDeepFirst as g}from"../../../utils/tree/find-deep-first.js";import{getSiblingPages as y}from"../../utils";import{PageDataContext as s}from"./PageDataContext.js";import{Loader as b}from"../../runtime/loader";import{useRawSidebarItems as v}from"../../app/Sidebar/useSidebarItems";import{usePageSharedData as u}from"./use-page-shared-data";export*from"./use-page-shared-data";function d(){return a(s)}function F(){return a(s)?.props||{}}function C(){const t=k(),{versions:n=[]}=a(s)||{};return{versions:i.useMemo(()=>n.map(e=>{const r=!!g(t,o=>o.version===e.version&&typeof o.link=="string"&&m(f(o.link))===m(f(e.link))),l=g(t,o=>o.version===e.version&&!!o.link);return{...e,link:(r?e.link:l?.link)||e.link}}),[n,t])}}function k(){const t=u("sidebar")?.items;return i.useMemo(()=>t||[],[t])}function R(){const t=u("sidebar")?.catalogEntity,n=d()?.props.entity;return t?{key:t.key,version:t.version}:n?.key?{key:n.key,version:n.version}:void 0}function w(){const t=u("sidebar")?.catalogEntity;return d()?.props?.catalogConfig||t?.catalogConfig}function T(){const t=p(),{versions:n=[]}=C()||{},c=n.find(r=>r?.active),e=v(c);return i.useMemo(()=>{if(e)return y(e,t.pathname)},[t.pathname,e])}function V(){const t=p();return b.loadSync(t.pathname)}export{d as usePageData,V as usePageDataLoader,F as usePageProps,C as usePageVersions,w as useSidebarConnectedCatalogConfig,R as useSidebarConnectedCatalogEntity,k as useSidebarItemsData,T as useSidebarSiblingsData};
1
+ import i,{useContext as a}from"react";import{useLocation as c}from"react-router";import{removeLeadingSlash as p,removeTrailingSlash as g}from"@redocly/theme/core/utils";import{findDeepFirst as d}from"../../../utils/tree/find-deep-first.js";import{flattenTabItems as v,resolveNavigationTabs as S,navigationTabSidebarItems as y}from"../../utils/navigation-tabs";import{getSiblingPages as C}from"../../utils";import{PageDataContext as s}from"./PageDataContext.js";import{Loader as k}from"../../runtime/loader";import{useRawSidebarItems as x}from"../../app/Sidebar/useSidebarItems";import{usePageSharedData as m}from"./use-page-shared-data";export*from"./use-page-shared-data";function b(){return a(s)}function _(){return a(s)?.props||{}}const E=[];function I(){const t=D(),{versions:e=E}=a(s)||{};return{versions:i.useMemo(()=>e.map(n=>{const u=!!d(t,o=>o.version===n.version&&typeof o.link=="string"&&p(g(o.link))===p(g(n.link))),l=d(t,o=>o.version===n.version&&!!o.link);return{...n,link:(u?n.link:l?.link)||n.link}}),[e,t])}}function h(){const t=f(),{pathname:e}=c(),r=P();return i.useMemo(()=>t?.tabs?.length?S({tabs:t.tabs,pathname:e,activeVersion:r}):void 0,[t,e,r])}function j(){const t=f(),e=h();return i.useMemo(()=>e?y(e):t?.items??[],[t,e])}function q(){const t=m("sidebar")?.catalogEntity,e=b()?.props.entity;return t?{key:t.key,version:t.version}:e?.key?{key:e.key,version:e.version}:void 0}function z(){const t=m("sidebar")?.catalogEntity;return b()?.props?.catalogConfig||t?.catalogConfig}function B(){const t=c(),{versions:e=[]}=I()||{},r=e.find(u=>u?.active),n=x(r);return i.useMemo(()=>{if(n)return C(n,t.pathname)},[t.pathname,n])}function G(){const t=c();return k.loadSync(t.pathname)}function D(){const t=f();return i.useMemo(()=>t?.tabs?.length?v(t.tabs):t?.items??[],[t])}function f(){return m("sidebar")}function P(){const{versions:t=[]}=a(s)||{};return t.find(e=>e.active)}export{h as useNavigationTabs,b as usePageData,G as usePageDataLoader,_ as usePageProps,I as usePageVersions,z as useSidebarConnectedCatalogConfig,q as useSidebarConnectedCatalogEntity,j as useSidebarItemsData,B as useSidebarSiblingsData};
@@ -1 +1 @@
1
- import e from"react";import{ThemeDataContext as m,SearchSessionProvider as d}from"@redocly/theme/core/contexts";import{useBreadcrumbs as g,useBanner as p,useConsent as b,useCatalogClassic as f,useCurrentProduct as C,useGlobalData as s,useI18n as h,useI18nConfig as S,useL10n as P,useL10nConfig as T,usePageData as r,usePageSharedData as D,usePageVersions as M,usePreloadHistory as k,useProducts as v,useUserMenu as F,useSubmitFeedback as y,useTranslate as E,useTranslationKeys as L,useSidebarSiblingsData as R,usePageProps as O,useUserTeams as w,useMarkdownText as x,useMarkdocRenderer as A,useCodeHighlight as I,useLoadAndNavigate as j,useCatalog as B,useCatalogSort as H,useCatalogSearch as N,useFetchCatalogEntities as U,useFetchCatalogEntitiesRelations as _,useFetchCatalogEntityRevisions as G,useTelemetry as n,useMcpData as K}from"../../app/hooks";import{Link as Q}from"../../app/Link";import{useFacetQuery as V,useSearch as W,useAiSearch as q}from"../../app/search";import{useSidebarItems as z}from"../../app/Sidebar/useSidebarItems";import{deepMerge as J}from"../../../utils/object/deep-merge";import{allowlistObject as X}from"../../../utils/object/allowlist-object";const Y=["title","description","seo","sidebar","excludeFromSearch","template","redirects","rbac","metadata","slug","codeSnippet","breadcrumbs","markdown","seo","navbar","footer","colorMode","feedback","navigation"],Z={useBreadcrumbs:g,useBanner:p,useConsent:b,useCatalog:B,useCatalogSort:H,useCatalogSearch:N,useFetchCatalogEntities:U,useFetchCatalogEntitiesRelations:_,useFetchCatalogEntityRevisions:G,useCatalogClassic:f,useCurrentProduct:C,useGlobalData:s,useSearch:W,useAiSearch:q,useFacetQuery:V,useI18n:h,useI18nConfig:S,useL10n:P,useL10nConfig:T,usePageData:r,usePageSharedData:D,usePageVersions:M,usePreloadHistory:k,useProducts:v,useUserMenu:F,useSidebarItems:z,useSidebarSiblingsData:R,useSubmitFeedback:y,useTranslate:E,useTranslationKeys:L,useUserTeams:w,usePageProps:O,useMarkdownText:x,useMarkdocRenderer:A,useCodeHighlight:I,useLoadAndNavigate:j,useTelemetry:n,useOtelTelemetry:n,useMcpData:K},$={LinkComponent:Q};function ie({children:u}){const{props:t}=r()||{},a=s(),o=e.useMemo(()=>a||{},[a]),i=e.useMemo(()=>{const l=X(t?.frontmatter||{},Y);return J(o,l)},[o,t?.frontmatter]),c={hooks:Z,components:$,config:i};return e.createElement(d,null,e.createElement(m.Provider,{value:c},u))}export{ie as ThemeDataProvider};
1
+ import e from"react";import{ThemeDataContext as m,SearchSessionProvider as d}from"@redocly/theme/core/contexts";import{useBreadcrumbs as g,useBanner as p,useConsent as b,useCatalogClassic as f,useCurrentProduct as C,useGlobalData as o,useI18n as h,useI18nConfig as S,useL10n as P,useL10nConfig as T,usePageData as r,usePageSharedData as D,usePageVersions as M,usePreloadHistory as v,useProducts as F,useUserMenu as k,useSubmitFeedback as y,useTranslate as E,useTranslationKeys as L,useSidebarSiblingsData as R,useNavigationTabs as O,usePageProps as w,useUserTeams as x,useMarkdownText as A,useMarkdocRenderer as I,useCodeHighlight as N,useLoadAndNavigate as j,useCatalog as B,useCatalogSort as H,useCatalogSearch as U,useFetchCatalogEntities as _,useFetchCatalogEntitiesRelations as G,useFetchCatalogEntityRevisions as K,useTelemetry as n,useMcpData as Q}from"../../app/hooks";import{Link as V}from"../../app/Link";import{useFacetQuery as W,useSearch as q,useSearchFeatures as z,useAiSearch as J}from"../../app/search";import{useSidebarItems as X}from"../../app/Sidebar/useSidebarItems";import{deepMerge as Y}from"../../../utils/object/deep-merge";import{allowlistObject as Z}from"../../../utils/object/allowlist-object";const $=["title","description","seo","sidebar","excludeFromSearch","template","redirects","rbac","metadata","slug","codeSnippet","breadcrumbs","markdown","seo","navbar","footer","colorMode","feedback","navigation"],ee={useBreadcrumbs:g,useBanner:p,useConsent:b,useCatalog:B,useCatalogSort:H,useCatalogSearch:U,useFetchCatalogEntities:_,useFetchCatalogEntitiesRelations:G,useFetchCatalogEntityRevisions:K,useCatalogClassic:f,useCurrentProduct:C,useGlobalData:o,useSearch:q,useSearchFeatures:z,useAiSearch:J,useFacetQuery:W,useI18n:h,useI18nConfig:S,useL10n:P,useL10nConfig:T,usePageData:r,usePageSharedData:D,usePageVersions:M,usePreloadHistory:v,useProducts:F,useUserMenu:k,useSidebarItems:X,useNavigationTabs:O,useSidebarSiblingsData:R,useSubmitFeedback:y,useTranslate:E,useTranslationKeys:L,useUserTeams:x,usePageProps:w,useMarkdownText:A,useMarkdocRenderer:I,useCodeHighlight:N,useLoadAndNavigate:j,useTelemetry:n,useOtelTelemetry:n,useMcpData:Q},te={LinkComponent:V};function le({children:u}){const{props:t}=r()||{},a=o(),s=e.useMemo(()=>a||{},[a]),i=e.useMemo(()=>{const l=Z(t?.frontmatter||{},$);return Y(s,l)},[s,t?.frontmatter]),c={hooks:ee,components:te,config:i};return e.createElement(d,null,e.createElement(m.Provider,{value:c},u))}export{le as ThemeDataProvider};
@@ -1 +1 @@
1
- import*as x from"react";import{withPathPrefix as j}from"@redocly/theme/core/utils";import{appendSearchParams as z}from"../utils";import{mapObject as I}from"../../utils/object/map-object.js";import{mapObjectAsync as A}from"../../utils/object/map-object-async.js";import{isFunction as G}from"../../utils/guards/is-function.js";import{isBrowser as N}from"../../utils/env/is-browser.js";import{GLOBAL_DATA_URL as $}from"../../constants/common.js";import{getClientPageDataUrl as V}from"../../utils/url/get-client-page-data-url.js";import{getSharedDataFetchUrl as B}from"../../utils/url/get-shared-data-fetch-url.js";import{normalizeRouteSlug as d}from"../../utils/path/normalize-route-slug.js";import{templates as v}from"./generated/templates.js";import{AsyncCache as g}from"./cache.js";import{fetch as y}from"./fetch.js";import{updateTranslations as F}from"../app/l10n";import{PageMissingDefaultExportError as S}from"./errors/page-missing-default-export-error.js";const i=new g,c=new g;let D=null,m,K;const f=new Set;async function W(){const o=await(await y(j($))).json();return m=o,o}async function b(o){const t=B(o,process.env.NODE_ENV==="development");return await(await y(t)).json()}async function q(o){return c.has(o)||c.set(o,b(o)),c.get(o)}function lt(){const[,o]=x.useReducer(t=>t+1,0);typeof window>"u"||process.env.NODE_ENV!=="production"&&(window.__redoclyRefresh=o)}function C(o,t){const e=t?new URLSearchParams(t).get("revision"):null,a=t?new URLSearchParams(t).get("version"):null;return e||a?`${o}?${e?`revision=${encodeURIComponent(e)}`:""}${a?`&version=${encodeURIComponent(a)}`:""}`.trim():o}class p{static markdocComponents={};static async updateTemplate(t,e,a){const n=d(t);v[a]=()=>e;const r=d(window.location.pathname);n===r&&(await this.load(t,!0),window.__redoclyRefresh())}static async update(t){const e=d(t),a=d(window.location.pathname);if(e!==a){i.delete(e);return}await this.load(t,!0),window.__redoclyRefresh()}static async updateSharedData(t){await c.set(t,b(t)),window.__redoclyRefresh()}static addGlobalDataListener(t){f.add(t)}static removeGlobalDataListener(t){f.delete(t)}static updateGlobalData(t){f.forEach(e=>e(t)),m=t,F(m.l10n)}static async tryLoad(t,e,a){try{return await this.load(t,e,a)}catch{return null}}static async loadDynamicMarkdocComponents(t){const e=this.markdocComponents?.[t];e&&G(e)&&Object.assign(this.markdocComponents,await e())}static async load(t,e,a){const n=d(t),r=C(n,a);if(!m&&!D&&(D=W()),!e&&i.has(r)){const u=await i.get(r);if(u)return u}const[s]=await Promise.all([i.set(r,l(a)),D]);return s;async function l(u){const _=V(n),k=z(_,u),E=await y(k),{templateId:P,sharedDataIds:w,props:R,userData:T,versions:L,redirectTo:M,isPublic:O}=await E.json(),[U]=await Promise.all([(async()=>p.loadTemplate(P))(),Promise.all((R.dynamicMarkdocComponents||[]).map(h=>p.loadDynamicMarkdocComponents(h))),w?A(w,h=>q(h)):Promise.resolve({})]);return{templateId:P,slug:n,sharedDataIds:w,redirectTo:M,props:R,Template:U,userData:T,versions:L,isPublic:O}}}static loadSync(t){const e=d(t),a=C(e,typeof window<"u"?window.location.search:void 0),n=i.tryGetSync(a);if(!n)return;const r=I(n.sharedDataIds,s=>c.getSync(s,"Data dependency not cached ahead of time: "+s));return{...n,sharedData:r}}static async prepare(t,e,a,n){const r=t.templateId;if(await Promise.all((t.props.dynamicMarkdocComponents||[]).map(l=>this.loadDynamicMarkdocComponents(l))),e)for(const l of Object.keys(e))c.setSync(l,e[l]);const s=await p.loadTemplate(r);s&&i.setSync(t.slug,{templateId:r,slug:t.slug,props:t.props,sharedDataIds:t.sharedDataIds||{},Template:s,userData:t.userInfo,versions:t.versions,isPublic:t.isPublic}),m=a,K=n}static async loadTemplate(t){try{const e=await v[t]();if(t.endsWith("page.tsx")&&!e.default)throw new S(t);const a=e.default;return typeof a=="function"?a:a.default}catch(e){if(!(process.env.NODE_ENV==="development")||!N())throw e;return e instanceof S?()=>(window.location.reload(),null):(window.location.reload(),null)}}static clear(){f.clear(),c.clear(),i.clear()}}(typeof window<"u"?window:global).__LOADER=p;export{p as Loader,q as getSharedData,m as globalData,K as initLocale,lt as useRefresh};
1
+ import*as j from"react";import{withPathPrefix as x}from"@redocly/theme/core/utils";import{appendSearchParams as z}from"../utils";import{mapObject as I}from"../../utils/object/map-object.js";import{mapObjectAsync as $}from"../../utils/object/map-object-async.js";import{isFunction as A}from"../../utils/guards/is-function.js";import{isBrowser as G}from"../../utils/env/is-browser.js";import{GLOBAL_DATA_URL as N}from"../../constants/common.js";import{getClientPageDataUrl as V}from"../../utils/url/get-client-page-data-url.js";import{getSharedDataFetchUrl as B}from"../../utils/url/get-shared-data-fetch-url.js";import{normalizeRouteSlug as d}from"../../utils/path/normalize-route-slug.js";import{templates as g}from"./generated/templates.js";import{AsyncCache as b}from"./cache.js";import{fetch as y}from"./fetch.js";import{updateTranslations as F}from"../app/l10n";import{PageMissingDefaultExportError as S}from"./errors/page-missing-default-export-error.js";const i=new b,c=new b;let D=null,m,K;const u=new Set;async function W(){const o=await(await y(x(N))).json();return m=o,o}async function v(o){const t=B(o,process.env.NODE_ENV==="development");return await(await y(t)).json()}async function q(o){return c.has(o)||c.set(o,v(o)),c.get(o)}function dt(){const[,o]=j.useReducer(t=>t+1,0);typeof window>"u"||process.env.NODE_ENV!=="production"&&(window.__redoclyRefresh=o)}function C(o,t){const e=t?new URLSearchParams(t).get("revision"):null,a=t?new URLSearchParams(t).get("version"):null;return e||a?`${o}?${e?`revision=${encodeURIComponent(e)}`:""}${a?`&version=${encodeURIComponent(a)}`:""}`.trim():o}class p{static markdocComponents={};static async updateTemplate(t,e,a){const n=d(t);g[a]=()=>e;const r=d(window.location.pathname);n===r&&(await this.load(t,!0),window.__redoclyRefresh())}static async update(t){const e=d(t),a=d(window.location.pathname);if(e!==a){i.delete(e);return}await this.load(t,!0),window.__redoclyRefresh()}static async updateSharedData(t){await c.set(t,v(t)),window.__redoclyRefresh()}static addGlobalDataListener(t){u.add(t)}static removeGlobalDataListener(t){u.delete(t)}static updateGlobalData(t){u.forEach(e=>e(t)),m=t,F(m.l10n)}static async tryLoad(t,e,a){try{return await this.load(t,e,a)}catch{return null}}static async loadDynamicMarkdocComponents(t){const e=this.markdocComponents?.[t];e&&A(e)&&Object.assign(this.markdocComponents,await e())}static async load(t,e,a){const n=d(t),r=C(n,a);if(!m&&!D&&(D=W()),!e&&i.has(r)){const f=await i.get(r);if(f)return f}const[s]=await Promise.all([i.set(r,l(a)),D]);return s;async function l(f){const _=V(n),T=z(_,f),k=await y(T),{templateId:P,sharedDataIds:w,props:R,userData:E,versions:L,redirectTo:M,isPublic:O}=await k.json(),[U]=await Promise.all([(async()=>p.loadTemplate(P))(),Promise.all((R.dynamicMarkdocComponents||[]).map(h=>p.loadDynamicMarkdocComponents(h))),w?$(w,h=>q(h)):Promise.resolve({})]);return{templateId:P,slug:n,sharedDataIds:w,redirectTo:M,props:R,Template:U,userData:E,versions:L,isPublic:O}}}static loadSync(t){const e=d(t),a=C(e,typeof window<"u"?window.location.search:void 0),n=i.tryGetSync(a);if(!n)return;const r=I(n.sharedDataIds,s=>c.getSync(s,"Data dependency not cached ahead of time: "+s));return{...n,sharedData:r}}static async prepare(t,e,a,n){const r=t.templateId;if(await Promise.all((t.props.dynamicMarkdocComponents||[]).map(l=>this.loadDynamicMarkdocComponents(l))),e)for(const l of Object.keys(e))c.setSync(l,e[l]);const s=await p.loadTemplate(r);s&&i.setSync(t.slug,{templateId:r,slug:t.slug,props:t.props,sharedDataIds:t.sharedDataIds||{},Template:s,userData:t.userInfo,versions:t.versions,isPublic:t.isPublic}),m=a,K=n}static async loadTemplate(t){try{const e=await g[t]();if(t.endsWith("page.tsx")&&!e.default)throw new S(t);const a=e.default;return H(a)?a:a?.default}catch(e){if(!(process.env.NODE_ENV==="development")||!G())throw e;return e instanceof S?()=>(window.location.reload(),null):(window.location.reload(),null)}}static clear(){u.clear(),c.clear(),i.clear()}}(typeof window<"u"?window:global).__LOADER=p;function H(o){return typeof o=="function"||typeof o=="object"&&o!==null&&"$$typeof"in o}export{p as Loader,q as getSharedData,m as globalData,K as initLocale,dt as useRefresh};
@@ -1,4 +1,4 @@
1
- import{useMemo as u,useRef as m}from"react";import{components as c}from"@redocly-markdoc/components";import{schema as s}from"@redocly-markdoc/schema";import{withPathPrefix as i}from"@redocly/theme/core/utils";import{tags as p,components as f}from"@redocly/theme/markdoc/default";import*as l from"../../app/markdoc/custom-components/index.js";import{parsePartials as d}from"../../../markdoc/helpers/parse-partials.js";import*as g from"../../../markdoc/nodes/index.js";import w from"../../../markdoc/tags/index.js";import{normalizeCustomTags as h}from"../../../markdoc/helpers/normalize-custom-tags.js";import{deepEqual as y}from"../../../utils/object/deep-equal.js";function b(t){return t.map(r=>{const o={...r};return typeof o.link=="string"&&(o.link=i(o.link)),typeof o.routeSlug=="string"&&(o.routeSlug=i(o.routeSlug)),Array.isArray(o.items)&&(o.items=b(o.items)),o})}function a(t){const r=m(t);return y(r.current,t)||(r.current=t),r.current}function E(t,r){const o=a(t),n=a(r);return u(()=>{const e=globalThis.__LOADER?.markdocComponents??{};return{...n,...o,tags:{...n?.tags??{},...w,...p,...h(s?.tags??{})},nodes:{...n?.nodes??{},...g,...s?.nodes??{}},functions:{...s?.functions??{}},components:{...n?.components??{},...l,...f,...c,...e},partials:d(o?.partials)}},[o,n])}function M(t){if(typeof window>"u")return null;if(typeof t=="function")return t;if(typeof t!="string")return null;try{const r=t.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(e=>r.includes(e)))throw new Error("Function contains prohibited keywords");return new Function("event",`
1
+ import{useMemo as u,useRef as m}from"react";import{components as c}from"@redocly-markdoc/components";import{schema as s}from"@redocly-markdoc/schema";import{withPathPrefix as i}from"@redocly/theme/core/utils";import{tags as p,components as f}from"@redocly/theme/markdoc/default";import*as l from"../../app/markdoc/custom-components/index.js";import{parsePartials as d}from"../../../markdoc/helpers/parse-partials.js";import*as g from"../../../markdoc/nodes/index.js";import w from"../../../markdoc/tags/index.js";import{normalizeCustomTags as h}from"../../../markdoc/helpers/normalize-custom-tags.js";import{deepEqual as y}from"../../../utils/object/deep-equal.js";function b(t){return t.map(r=>{const o={...r};return typeof o.link=="string"&&(o.link=i(o.link)),typeof o.routeSlug=="string"&&(o.routeSlug=i(o.routeSlug)),Array.isArray(o.items)&&(o.items=b(o.items)),o})}function a(t){const r=m(t);return y(r.current,t)||(r.current=t),r.current}function E(t,r){const o=a(t),n=a(r);return u(()=>{const e=globalThis.__LOADER?.markdocComponents??{};return{...n,...o,tags:{...n?.tags??{},...w,...p,...h(s?.tags??{})},nodes:{...n?.nodes??{},...g,...s?.nodes??{}},functions:{...s?.functions??{}},components:{...n?.components??{},...l,...f,...c,...e},partials:d(o?.partials)}},[o,n])}function M(t){if(typeof window>"u")return null;if(typeof t=="function")return t;if(typeof t!="string")return null;try{const r=t.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*\S.*|[a-zA-Z_$][\w$]*\s*=>\s*\S.*)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(e=>r.includes(e)))throw new Error("Function contains prohibited keywords");return new Function("event",`
2
2
  'use strict';
3
3
  const userFn = ${r};
4
4
  return userFn(event);
@@ -1,13 +1,17 @@
1
- import*as e from"react";import{useMemo as i}from"react";import A from"styled-components";import{RedoclyApiDocs as k,createMarkdocAdapter as T}from"@redocly/api-docs";import{LayoutVariant as B}from"@redocly/theme/components/SidebarActions/SidebarActions";import{ThreePanelLayout as U}from"@redocly/theme/layouts/ThreePanelLayout";import{CatalogClassicInfoBlock as x}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{Breadcrumbs as D}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as s}from"@redocly/theme/core/utils";import{usePageSharedData as I,useUserClaims as $}from"../../app/hooks";import{ServerRoutes as p}from"../../../constants/api.js";import{isBrowser as M}from"../../../utils/env/is-browser.js";import{CLIENT_TELEMETRY_ENABLED as N}from"../../constants/common.js";import{PACKAGE_NAME as H}from"../../../config/product-gates";import{applyPathPrefixToApiItems as Y,safeParseFunction as V,useCollectMarkdocOptions as W}from"./helpers";function z({pageProps:{markdown:c,apiOptions:f,metadata:w}}){const u=I("apiDocsStore"),{items:l,options:o,store:y,baseSlug:r}=u,a=M(),g=$(),n=W(c,o.markdocOptions),d=i(()=>s(r),[r]),C=i(()=>d===r?l:Y(l),[l,r,d]),v=i(()=>T(n),[n]),L=i(()=>{const b=a?`${window.location.origin}${s(p.REPLAY_OAUTH2_CALLBACK)}`:void 0;let m=o.corsProxyUrl;if(m===void 0){const t=s(`${p.CORS_PROXY}/`);m=a?new URL(t,window.location.origin).toString():t}const E=o.events,h=E?Object.entries(E).reduce((t,[O,_])=>{const P=V(_);return P&&(t[O]=P),t},{}):void 0;return{...o,markdocOptions:n,oAuth2RedirectURI:b,corsProxyUrl:m,userClaims:g,...h&&{events:h},unstable_hooks:{...o.unstable_hooks,MiddlePanelHeader:()=>e.createElement(D,null)}}},[o,n,a,g]);if(!u)return e.createElement("div",null,"Something went wrong");const S=a?{collectorUrl:new URL(s(p.OTEL_TRACES),window.location.origin).toString(),disabled:!N,serviceVersion:`${H}@${process.env.REDOCLY_PORTAL_VERSION}`}:void 0;return e.createElement(K,null,e.createElement(R,{layout:f?.layout},e.createElement(x,{metadata:w})),e.createElement(k,{items:C,store:y,basePath:d,options:L,markdownAdapter:v,layout:f?.layout,telemetryConfig:S}))}const R=A(U)`
1
+ import*as e from"react";import{useMemo as i}from"react";import A from"styled-components";import{RedoclyApiDocs as _,createMarkdocAdapter as T}from"@redocly/api-docs";import{LayoutVariant as x}from"@redocly/theme/components/SidebarActions/SidebarActions";import{ThreePanelLayout as B}from"@redocly/theme/layouts/ThreePanelLayout";import{CatalogClassicInfoBlock as U}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{Breadcrumbs as D}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as s}from"@redocly/theme/core/utils";import{usePageSharedData as I,useUserClaims as $}from"../../app/hooks";import{ServerRoutes as p}from"../../../constants/api.js";import{isBrowser as M}from"../../../utils/env/is-browser.js";import{CLIENT_TELEMETRY_ENABLED as N}from"../../constants/common.js";import{PACKAGE_NAME as H}from"../../../config/product-gates";import{applyPathPrefixToApiItems as Y,safeParseFunction as V,useCollectMarkdocOptions as W}from"./helpers";function z({pageProps:{markdown:c,apiOptions:f,metadata:v}}){const u=I("apiDocsStore"),{items:l,options:o,store:w,baseSlug:r}=u,a=M(),g=$(),n=W(c,o.markdocOptions),d=i(()=>s(r),[r]),y=i(()=>d===r?l:Y(l),[l,r,d]),C=i(()=>T(n),[n]),k=i(()=>{const S=a?`${window.location.origin}${s(p.REPLAY_OAUTH2_CALLBACK)}`:void 0;let m=o.corsProxyUrl;if(m===void 0){const t=s(`${p.CORS_PROXY}/`);m=a?new URL(t,window.location.origin).toString():t}const E=o.events,h=E?Object.entries(E).reduce((t,[b,O])=>{const P=V(O);return P&&(t[b]=P),t},{}):void 0;return{...o,markdocOptions:n,oAuth2RedirectURI:S,corsProxyUrl:m,userClaims:g,...h&&{events:h},unstable_hooks:{...o.unstable_hooks,MiddlePanelHeader:()=>e.createElement(D,null)}}},[o,n,a,g]);if(!u)return e.createElement("div",null,"Something went wrong");const L=a?{collectorUrl:new URL(s(p.OTEL_TRACES),window.location.origin).toString(),disabled:!N,serviceVersion:`${H}@${process.env.REDOCLY_PORTAL_VERSION}`}:void 0;return e.createElement(K,null,e.createElement(R,{layout:f?.layout},e.createElement(U,{metadata:v})),e.createElement(_,{items:y,store:w,basePath:d,options:k,markdownAdapter:C,layout:f?.layout,telemetryConfig:L}))}const R=A(B)`
2
2
  && {
3
- padding-right: ${({layout:c})=>c===B.THREE_PANEL?"calc(var(--panel-gap-horizontal) * 2)":"var(--panel-gap-horizontal)"};
3
+ padding-right: ${({layout:c})=>c===x.THREE_PANEL?"calc(var(--panel-gap-horizontal) * 2)":"var(--panel-gap-horizontal)"};
4
4
  }
5
5
  `,K=A.main`
6
6
  div[id],
7
7
  a[id],
8
8
  a[data-section-id],
9
9
  div[data-section-id] {
10
- scroll-margin-top: calc(var(--navbar-height) + var(--banner-height));
10
+ scroll-margin-top: var(--navbar-offset);
11
+ }
12
+
13
+ [id]:not([data-section-id]):has([data-deep-link-anchor]) {
14
+ scroll-margin-top: calc(var(--navbar-offset) + var(--deep-link-scroll-gap, var(--spacing-xl)));
11
15
  }
12
16
 
13
17
  --sidebar-width: 0px;
@@ -1 +1 @@
1
- function m(c,s=[]){const n=Array.from({length:s.length},()=>new Set),r=decodeURIComponent(c);if(!r)return n;const o=r.split(/\s+(?:AND|OR)\s+|\(|\)/).reduce((t,e)=>{const l=e.trim();return l.length>0&&t.push(l),t},[]);for(const t of o){const e=Math.max(t.indexOf(":"),t.indexOf("~"));if(e===-1)continue;const l=t.slice(0,e);let a=t.slice(e+1);const i=s.findIndex(f=>f.property===l);if(i===-1)continue;if(s[i].type==="date-range"&&a.includes("..")){const[f,u]=a.split("..");n[i]={from:f,to:u}}else{const f=d(a.toLowerCase()),u=n[i]instanceof Set?n[i]:new Set;f.forEach(p=>u.add(p))}}return n}function d(c){const s=[];let n="",r=!1,o="";for(let t=0;t<c.length;t++){const e=c[t];!r&&(e==='"'||e==="'")?(r=!0,o=e):r&&e===o?(r=!1,o=""):!r&&e===","?(s.push(n.trim()),n=""):n+=e}return n.trim()&&s.push(n.trim()),s.map(t=>t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t)}export{m as parseFilterQuery};
1
+ function m(c,s=[]){const n=Array.from({length:s.length},()=>new Set),r=decodeURIComponent(c);if(!r)return n;const o=r.split(/(?<!\s)\s+(?:AND|OR)\s+|\(|\)/).reduce((t,e)=>{const l=e.trim();return l.length>0&&t.push(l),t},[]);for(const t of o){const e=Math.max(t.indexOf(":"),t.indexOf("~"));if(e===-1)continue;const l=t.slice(0,e);let a=t.slice(e+1);const i=s.findIndex(f=>f.property===l);if(i===-1)continue;if(s[i].type==="date-range"&&a.includes("..")){const[f,u]=a.split("..");n[i]={from:f,to:u}}else{const f=d(a.toLowerCase()),u=n[i]instanceof Set?n[i]:new Set;f.forEach(p=>u.add(p))}}return n}function d(c){const s=[];let n="",r=!1,o="";for(let t=0;t<c.length;t++){const e=c[t];!r&&(e==='"'||e==="'")?(r=!0,o=e):r&&e===o?(r=!1,o=""):!r&&e===","?(s.push(n.trim()),n=""):n+=e}return n.trim()&&s.push(n.trim()),s.map(t=>t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t)}export{m as parseFilterQuery};
@@ -1,4 +1,13 @@
1
- import type { ResolvedNavItem, Version } from '@redocly/config';
1
+ import type { Version } from '@redocly/config';
2
+ type VersionedItem = {
3
+ version?: string;
4
+ isDefault?: boolean;
5
+ versionFolderId?: string;
6
+ link?: string;
7
+ } & {
8
+ [key in (typeof CHILDREN_KEYS)[number]]?: VersionedItem[];
9
+ };
10
+ declare const CHILDREN_KEYS: readonly ['items', 'menu'];
2
11
  /**
3
12
  * Filters the sidebar items based on the active version.
4
13
  *
@@ -22,5 +31,6 @@ import type { ResolvedNavItem, Version } from '@redocly/config';
22
31
  * - if the active version name doesn't exist in its own folder, that folder
23
32
  * falls back to its default version
24
33
  */
25
- export declare function filterOutVersionedItems(items: ResolvedNavItem[], activeVersion?: Version | null, versionNamesByFolderId?: Record<string, Set<string>>): ResolvedNavItem[];
34
+ export declare function filterOutVersionedItems<T extends VersionedItem>(items: T[], activeVersion?: Version | null, versionNamesByFolderId?: Record<string, Set<string>>): T[];
35
+ export {};
26
36
  //# sourceMappingURL=filter-out-versioned-items.d.ts.map
@@ -0,0 +1 @@
1
+ const l=["items","menu"];function u(r,e,i={}){for(const n of r)n.versionFolderId&&n.version&&(i[n.versionFolderId]=i[n.versionFolderId]??new Set).add(n.version);const s=[];for(const n of r){if(n.version!=null&&!(!e||n.versionFolderId!==e.folderId?n.isDefault:n.versionFolderId&&i[n.versionFolderId]?.has(e.version)?n.version===e.version:n.isDefault))continue;const o=l.find(f=>Array.isArray(n[f]));if(o===void 0){s.push(n);continue}const t=n[o]??[],d=u(t,e,i);d.length===0&&t.length>0&&!n.link||s.push({...n,[o]:d})}return s}export{u as filterOutVersionedItems};
@@ -0,0 +1,14 @@
1
+ import type { ResolvedNavItem, ResolvedTab, ResolvedTabMenuEntry, Version } from '@redocly/config';
2
+ export type ResolvedNavigationTabs = {
3
+ tabs: ResolvedTab[];
4
+ activeTab?: ResolvedTab;
5
+ activeMenuEntry?: ResolvedTabMenuEntry;
6
+ };
7
+ export declare function resolveNavigationTabs({ tabs, pathname, activeVersion, }: {
8
+ tabs: ResolvedTab[];
9
+ pathname: string;
10
+ activeVersion?: Version | null;
11
+ }): ResolvedNavigationTabs;
12
+ export declare function navigationTabSidebarItems(navigationTabs: ResolvedNavigationTabs): ResolvedNavItem[];
13
+ export declare function flattenTabItems(tabs: ResolvedTab[]): ResolvedNavItem[];
14
+ //# sourceMappingURL=navigation-tabs.d.ts.map
@@ -0,0 +1 @@
1
+ import{withPathPrefix as a}from"@redocly/theme/core/utils";import{removeTrailingSlash as c}from"../../utils/url/remove-trailing-slash";import{isAbsoluteUrl as l}from"../../utils/url/is-absolute-url";import{filterOutVersionedItems as d}from"./filter-out-versioned-items";function w({tabs:e,pathname:t,activeVersion:n}){const i=d(e,n),r=p(i,t);return{tabs:i,activeTab:r?.tab,activeMenuEntry:r?.menuEntry}}function E(e){if(e.activeTab)return e.activeMenuEntry?.items??e.activeTab.items??[];const t=b(e.tabs);return t?.menuEntry?.items??t?.tab.items??[]}function M(e){return e.flatMap(t=>t.menu?t.menu.flatMap(n=>[n,...n.items]):[{...t,type:"group"},...t.items??[]])}function p(e,t){const n=u(t);return s({tabs:e,pathname:n,routeKey:"routeSlug"})??s({tabs:e,pathname:n,routeKey:"link"})}function b(e){const t=e[0];if(t)return t.menu?{tab:t,menuEntry:t.menu[0]}:{tab:t}}function u(e){return decodeURIComponent(c(e))||"/"}function s({tabs:e,pathname:t,routeKey:n}){const i=r=>f(r.link,t)||m({items:r.items,pathname:t,routeKey:n});for(const r of e)if(r.menu){const o=r.menu.find(i);if(o)return{tab:r,menuEntry:o}}else if(i(r))return{tab:r}}function f(e,t){return!e||l(e)?!1:u(a(e.split("#")[0]))===t}function m({items:e,pathname:t,routeKey:n}){return(e??[]).some(i=>f(i[n],t)||m({items:i.items,pathname:t,routeKey:n}))}export{M as flattenTabItems,E as navigationTabSidebarItems,w as resolveNavigationTabs};