@redocly/realm 0.135.0-next.5 → 0.135.0-next.6

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 (64) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  3. package/dist/cli/build/analytics/collectors/get-nested-configs-usage.js +1 -1
  4. package/dist/cli/telemetry/get-portal-config-stats.js +1 -1
  5. package/dist/cli/telemetry/index.js +1 -1
  6. package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
  7. package/dist/client/app/Sidebar/Sidebar.js +3 -3
  8. package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
  9. package/dist/client/app/hooks/catalog/useCatalogFilter.js +1 -1
  10. package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
  11. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  12. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  13. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  14. package/dist/client/app/pages/DevLogin/DevLogin.js +1 -1
  15. package/dist/client/app/search/useSearch.js +1 -1
  16. package/dist/markdoc/helpers/get-operation/get-operation.js +1 -0
  17. package/dist/markdoc/helpers/get-operation/index.d.ts +4 -0
  18. package/dist/markdoc/helpers/get-operation/index.js +1 -0
  19. package/dist/markdoc/helpers/get-resolved-sample-code-block.d.ts +3 -0
  20. package/dist/markdoc/helpers/get-resolved-sample-code-block.js +5 -0
  21. package/dist/markdoc/tags/openapi-code-sample.js +1 -1
  22. package/dist/markdoc/tags/openapi-response-sample.js +1 -1
  23. package/dist/server/constants/common.d.ts +2 -0
  24. package/dist/server/constants/common.js +1 -1
  25. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.d.ts +4 -0
  26. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.js +1 -0
  27. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +7 -0
  28. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.js +1 -0
  29. package/dist/server/plugins/markdown/attribute-resolvers/index.js +1 -1
  30. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.d.ts +4 -0
  31. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -0
  32. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.d.ts +4 -0
  33. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.js +1 -0
  34. package/dist/server/plugins/markdown/attribute-resolvers/utils.d.ts +2 -0
  35. package/dist/server/plugins/markdown/attribute-resolvers/utils.js +1 -1
  36. package/dist/server/plugins/markdown/compiler.js +1 -1
  37. package/dist/server/plugins/markdown/index.js +1 -1
  38. package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
  39. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  40. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  41. package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +11 -0
  42. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  43. package/dist/server/ssr/server-side-props/get-server-props-from-system-handlers.js +1 -1
  44. package/dist/server/store.d.ts +0 -2
  45. package/dist/server/store.js +1 -1
  46. package/dist/server/telemetry/index.js +1 -1
  47. package/dist/types/markdoc.d.ts +5 -0
  48. package/package.json +9 -9
  49. package/dist/client/app/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -1
  50. package/dist/client/app/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -4
  51. package/dist/client/app/markdoc/custom-components/openapi/get-operation/index.js +0 -1
  52. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/get-operation-info-by-id.d.ts +0 -0
  53. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/get-operation-info-by-id.js +0 -0
  54. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  55. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/get-operation-info-by-pointer.js +0 -0
  56. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/get-operation.d.ts +0 -0
  57. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/index.d.ts +0 -0
  58. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/index.js +0 -0
  59. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-identifier.d.ts +0 -0
  60. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-identifier.js +0 -0
  61. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-info.d.ts +0 -0
  62. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-info.js +0 -0
  63. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-parameters.d.ts +0 -0
  64. /package/dist/{client/app/markdoc/custom-components/openapi → markdoc/helpers}/get-operation/types/operation-parameters.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.135.0-next.6
4
+
5
+ ### Minor Changes
6
+
7
+ - 8358282927d: Added support for the `openapi-code-sample` and `openapi-response-sample` Markdoc tags in `llms.txt`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 2046acf9c67: Updated `@redocly/openapi-core` to version `2.35.0`.
12
+ - 21155963477: Fixed layout shift in the sidebar that happened when users selected a sidebar item.
13
+ - f52a2b04b55: Fixed an issue where the deprecated badge didn't appear in search dialog results for the Typesense search engine.
14
+ - ead3c5da075: Fixed an issue where search results were incorrectly scoped to the selected product, version, or filter.
15
+ This issue occurred when names of products, versions or filters included the same word, for example: `Version` and `Version 2`.
16
+ - Updated dependencies [359a05ad5d]
17
+ - Updated dependencies [2046acf9c67]
18
+ - Updated dependencies [9df2991666]
19
+ - Updated dependencies [21155963477]
20
+ - Updated dependencies [8358282927d]
21
+ - Updated dependencies [33b827ed767]
22
+ - @redocly/realm-asyncapi-sdk@0.13.0-next.4
23
+ - @redocly/openapi-docs@3.23.0-next.6
24
+ - @redocly/theme@0.67.0-next.5
25
+ - @redocly/portal-plugin-mock-server@0.20.0-next.6
26
+ - @redocly/asyncapi-docs@1.12.0-next.6
27
+ - @redocly/graphql-docs@1.12.0-next.6
28
+
3
29
  ## 0.135.0-next.5
4
30
 
5
31
  ### Patch Changes
@@ -111,6 +137,24 @@
111
137
  - @redocly/openapi-docs@3.23.0-next.0
112
138
  - @redocly/theme@0.67.0-next.0
113
139
 
140
+ ## 0.134.1
141
+
142
+ ### Patch Changes
143
+
144
+ - 593b45d834e: Fixed security vulnerabilities `CVE-2026-54286`, `CVE-2026-54287`, `CVE-2026-54288`, `CVE-2026-54289`, and `CVE-2026-54290` by upgrading `hono` to version `4.12.25`.
145
+ - 15517889222: Fixed security vulnerability `CVE-2026-53550` by upgrading `js-yaml` to version `4.2.0`.
146
+ - 21fcae7c24a: Fixed security vulnerabilities `GHSA-gvmj-g25r-r7wr`, `CVE-2026-49978`, `GHSA-x4vx-rjvf-j5p4`, `GHSA-vxr8-fq34-vvx9`, `CVE-2026-49459`, `CVE-2026-49458`, `GHSA-76mc-f452-cxcm`, and `GHSA-cmwh-pvxp-8882` by upgrading `dompurify` to version `3.4.11`.
147
+ - afdf3f12bf2: Fixed security vulnerability `GHSA-gv7w-rqvm-qjhr` by upgrading `esbuild` to version `0.28.1`.
148
+ - 89eec49eb26: Fixed security vulnerability `CVE-2026-54285` by upgrading `@opentelemetry/core` to version `2.8.0`.
149
+ - Updated dependencies [21fcae7c24a]
150
+ - Updated dependencies [89eec49eb26]
151
+ - @redocly/openapi-docs@3.22.1
152
+ - @redocly/realm-asyncapi-sdk@0.12.1
153
+ - @redocly/portal-plugin-mock-server@0.19.1
154
+ - @redocly/asyncapi-docs@1.11.1
155
+ - @redocly/graphql-docs@1.11.1
156
+ - @redocly/theme@0.66.0
157
+
114
158
  ## 0.134.0
115
159
 
116
160
  ### Minor Changes
@@ -1 +1 @@
1
- import{getApiFunctionsUsage as f}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as l}from"./collectors/get-async-api-usage.js";import{getConfigStatsUsage as c}from"./collectors/get-config-stats-usage.js";import{getFileExtensionsUsage as U}from"./collectors/get-file-extensions-usage.js";import{getFrontmatterUsage as d}from"./collectors/get-frontmatter-usage.js";import{getMarkdocUsage as p}from"./collectors/get-markdoc-usage.js";import{getNestedConfigsUsage as u}from"./collectors/get-nested-configs-usage.js";import{getProcessedConfigStatsUsage as S}from"./collectors/get-processed-config-stats-usage.js";import{getRefsUsage as x}from"./collectors/get-refs-usage.js";import{getThemeFolderUsage as y}from"./collectors/get-theme-folder-usage.js";import{telemetry as C}from"../../telemetry/index.js";async function w(r,i){const g=[f,l,c,U,d,p,u,S,x,y],n=await Promise.allSettled(g.map(t=>t({store:r,context:i}))),e={},s={};for(const t of n)if(t.status==="fulfilled"){const{name:o,value:a,version:m}=t.value;a&&(e[o]=a,s[o]=m)}C.sendBuildMessage({usageStats:e.usageStats,asyncApiUsage:e.asyncApiUsage,buildContext:e.buildContext,fileExtensions:e.fileExtensions,frontmatterUsage:e.frontmatterUsage,markdocUsage:e.markdocUsage,processedBuildContext:e.processedBuildContext,refsUsageStats:e.refsUsageStats,themeFolderUsage:e.themeFolderUsage,versions:JSON.stringify(s)})}export{w as collectAnalytics};
1
+ import{getApiFunctionsUsage as f}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as l}from"./collectors/get-async-api-usage.js";import{getConfigStatsUsage as c}from"./collectors/get-config-stats-usage.js";import{getFileExtensionsUsage as d}from"./collectors/get-file-extensions-usage.js";import{getFrontmatterUsage as U}from"./collectors/get-frontmatter-usage.js";import{getMarkdocUsage as p}from"./collectors/get-markdoc-usage.js";import{getNestedConfigsUsage as u}from"./collectors/get-nested-configs-usage.js";import{getProcessedConfigStatsUsage as S}from"./collectors/get-processed-config-stats-usage.js";import{getRefsUsage as C}from"./collectors/get-refs-usage.js";import{getThemeFolderUsage as x}from"./collectors/get-theme-folder-usage.js";import{telemetry as y}from"../../telemetry/index.js";async function w(r,i){const n=[f,l,c,d,U,p,u,S,C,x],g=await Promise.allSettled(n.map(t=>t({store:r,context:i}))),e={},s={};for(const t of g)if(t.status==="fulfilled"){const{name:o,value:a,version:m}=t.value;a&&(e[o]=a,s[o]=m)}y.sendBuildMessage({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,themeFolderUsage:e.themeFolderUsage,versions:JSON.stringify(s)})}export{w as collectAnalytics};
@@ -1 +1 @@
1
- import{dirname as a}from"node:path";import{getPortalConfigStats as i}from"../../../telemetry/get-portal-config-stats.js";const n=[],c=async({context:t})=>{for(const{relativePath:e,isVirtual:o}of t.fs.scan(/redocly\.yaml$/)){if(o||e==="redocly.yaml")continue;const s=await t.getConfig(a(e));n.push(s)}return{version:"1",name:"nestedConfigStats",value:i(n)}};export{c as getNestedConfigsUsage};
1
+ import{dirname as s}from"node:path";import{getPortalConfigStats as f}from"../../../telemetry/get-portal-config-stats.js";const r=20,g=512*1024,d=async({context:n})=>{const e=[];let o=0;for(const{relativePath:i,isVirtual:a}of n.fs.scan(/redocly\.yaml$/)){if(a||i==="redocly.yaml")continue;if(e.length>=r)break;const t=f(await n.getConfig(s(i)));if(t!==void 0){if(o+=Buffer.byteLength(t,"utf8"),o>g)break;e.push(t)}}return{version:"1",name:"nestedConfigStats",value:e.length>0?`[${e.join(",")}]`:void 0}};export{d as getNestedConfigsUsage};
@@ -1 +1 @@
1
- const i=[/.*secret.*/i],o=e=>i.some(r=>r.test(e)),t=e=>{if(!e)return e;if(Array.isArray(e))return e.map(r=>t(r)).filter(r=>r!==void 0);if(typeof e=="object"){const r={};for(const[n,s]of Object.entries(e))r[n]=o(n)?"**********":t(s);return r}return e},a=e=>{if(Array.isArray(e))return e.length>0?JSON.stringify(e.map(t)):void 0;const r=t(e);return r&&JSON.stringify(r)};export{a as getPortalConfigStats};
1
+ import{MARKDOC_PARTIALS_DATA_KEY as o}from"../../server/constants/common.js";const i=[/secret/i,/password|passphrase/i,/private[-_]?key/i],a="**********",f=e=>i.some(t=>t.test(e)),s=e=>{if(!e)return e;if(Array.isArray(e))return e.map(t=>s(t)).filter(t=>t!==void 0);if(typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))t[r]=f(r)?a:s(n);return t}return e},c=e=>{const{[o]:t,...r}=e;return r},A=e=>{if(Array.isArray(e))return e.length>0?JSON.stringify(e.map(s)):void 0;const t=c(e),r=s(t);return r&&JSON.stringify(r)};export{A as getPortalConfigStats};
@@ -1 +1 @@
1
- import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{ulid as l}from"ulid";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as s}from"../../server/tools/shutdowner.js";import{envConfig as r}from"../../server/config/env-config.js";import{PACKAGE_NAME as n}from"../../config/product-gates.js";class d extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organizationId:r.ORGANIZATION_ID||"",organizationSlug:r.ORGANIZATION_SLUG||"",projectId:r.PROJECT_ID||"",projectSlug:r.PROJECT_SLUG||"",origin:"realmCli",actor:{id:`ann_${l()}`,object:"user",uri:""},source:"cli",env:r.REDOCLY_ENV}))}initialize(e,t,o){const a=t!==void 0?!(t&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${n}@${e}`,collectorTraceUrl:r.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:r.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:a,verbose:o}),s.registerShutdownCallback(this.#r.bind(this))}addTraceStepCallbacks(e,{error:t,end:o}){this.#e.set(e,{error:t,end:o})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#r(e){for(const[,{error:t,end:o}]of this.#e)e&&t(e),o();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const m=new d,A=m.tracer;export{m as telemetry,A as telemetryTracer};
1
+ import{AsyncApiRealmCLI as c}from"@redocly/realm-asyncapi-sdk";import{ulid as l}from"ulid";import{TELEMETRY_ENABLED as i}from"../../server/constants/common.js";import{shutdowner as s}from"../../server/tools/shutdowner.js";import{envConfig as r}from"../../server/config/env-config.js";import{PACKAGE_NAME as n}from"../../config/product-gates.js";class d extends c.Telemetry{#e=new Map;constructor(){super(),this.updateCloudEventData(()=>({organizationId:r.ORGANIZATION_ID||"",organizationSlug:r.ORGANIZATION_SLUG||"",projectId:r.PROJECT_ID||"",projectSlug:r.PROJECT_SLUG||"",origin:"realmCli",actor:{id:`ann_${l()}`,object:"user",uri:""},source:"urn:redocly:realm:cli",env:r.REDOCLY_ENV}))}initialize(e,t,o){const a=t!==void 0?!(t&&i):!i;this.init({otel:{serviceName:"realm-cli",serviceVersion:`${n}@${e}`,collectorTraceUrl:r.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:r.isProductionEnv,version:"1.0",tracerName:"cli-telemetry"},disabled:a,verbose:o}),s.registerShutdownCallback(this.#r.bind(this))}addTraceStepCallbacks(e,{error:t,end:o}){this.#e.set(e,{error:t,end:o})}removeTraceStepCallbacks(e){this.#e.delete(e)}async#r(e){for(const[,{error:t,end:o}]of this.#e)e&&t(e),o();this.#e.clear(),await this.forceFlush(),await this.shutdown()}}const m=new d,A=m.tracer;export{m as telemetry,A as telemetryTracer};
@@ -1,4 +1,4 @@
1
- import r,{useEffect as C,useState as a}from"react";import D from"styled-components";import{Button as I}from"@redocly/theme/components/Button/Button";import{Admonition as N}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{withPathPrefix as y}from"@redocly/theme/core/utils";import{usePageData as k}from"../hooks/usePageData";import{usePreloadHistory as w}from"../usePreloadHistory";import{telemetry as b}from"../telemetry/index.js";import{useLoginUrl as q}from"../hooks";const M=e=>{const{apiId:s,status:t,setStatus:i}=e,c=w(),{userData:n}=k("userData")||{},u=q(),[l,p]=a(),[h,g]=a(),[m,A]=a(!0);C(()=>{n?.isAuthenticated&&fetch(`/api/api-keys/api-products/${s}/access`).then(d=>d.json().then(o=>{d.ok?(i(o.status),g(o.appId)):p(o.message)}).catch(()=>p("Something went wrong")).finally(()=>A(!1)))},[n?.isAuthenticated,s,i]);const E=()=>{!n?.isAuthenticated&&u?window.location.href=y(u):t==="ACCEPTED"?c.push("/apps/"+h||""):t==="NONE"&&c.push("/apps/?createApp&apiId="+s),b.sendRequestApiAccessButtonClickedMessage([{object:"button",action:"click"}])},P=(t==="PENDING"||m||l!=null)&&n?.isAuthenticated;return r.createElement(r.Fragment,null,r.createElement(I,{disabled:P,onClick:E,fullWidth:!0,size:"small"},x(t,m,l,!!n?.isAuthenticated)))},x=(e,s,t,i)=>{if(!i)return"Request access";if(s)return"Loading...";if(t)return"Failed to check access";switch(e){case"NONE":return"Request access";case"ACCEPTED":return"Credentials";case"PENDING":return"Pending access..."}return null},O=e=>e==="ACCEPTED"?r.createElement(f,{type:"success",name:"You have access to this API"}):e==="PENDING"?r.createElement(f,{type:"info",name:"You have requested access to this API"}):null,f=D(N)`
1
+ import n,{useEffect as D,useState as a}from"react";import C from"styled-components";import{Button as I}from"@redocly/theme/components/Button/Button";import{Admonition as N}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{withPathPrefix as y,getBaseDataAttributes as k}from"@redocly/theme/core/utils";import{usePageData as q}from"../hooks/usePageData";import{usePreloadHistory as w}from"../usePreloadHistory";import{telemetry as b}from"../telemetry/index.js";import{useLoginUrl as x}from"../hooks";const U=e=>{const{apiId:s,status:t,setStatus:i}=e,c=w(),{userData:r}=q("userData")||{},u=x(),[l,p]=a(),[h,A]=a(),[m,g]=a(!0);D(()=>{r?.isAuthenticated&&fetch(`/api/api-keys/api-products/${s}/access`).then(d=>d.json().then(o=>{d.ok?(i(o.status),A(o.appId)):p(o.message)}).catch(()=>p("Something went wrong")).finally(()=>g(!1)))},[r?.isAuthenticated,s,i]);const E=()=>{!r?.isAuthenticated&&u?window.location.href=y(u):t==="ACCEPTED"?c.push("/apps/"+h||""):t==="NONE"&&c.push("/apps/?createApp&apiId="+s),b.sendRequestApiAccessClickedMessage([k("requestApiAccess","button")])},P=(t==="PENDING"||m||l!=null)&&r?.isAuthenticated;return n.createElement(n.Fragment,null,n.createElement(I,{disabled:P,onClick:E,fullWidth:!0,size:"small"},R(t,m,l,!!r?.isAuthenticated)))},R=(e,s,t,i)=>{if(!i)return"Request access";if(s)return"Loading...";if(t)return"Failed to check access";switch(e){case"NONE":return"Request access";case"ACCEPTED":return"Credentials";case"PENDING":return"Pending access..."}return null},Y=e=>e==="ACCEPTED"?n.createElement(f,{type:"success",name:"You have access to this API"}):e==="PENDING"?n.createElement(f,{type:"info",name:"You have requested access to this API"}):null,f=C(N)`
2
2
  margin-top: 0px;
3
3
  margin-bottom: var(--spacing-sm);
4
- `;export{M as RequestAccessButton,O as renderAdmonition};
4
+ `;export{U as RequestAccessButton,Y as renderAdmonition};
@@ -1,11 +1,11 @@
1
- import e,{useEffect as y,useState as p}from"react";import b from"styled-components";import{Menu as I}from"@redocly/theme/components/Menu/Menu";import{SidebarActions as L}from"@redocly/theme/components/SidebarActions/SidebarActions";import{Sidebar as w}from"@redocly/theme/components/Sidebar/Sidebar";import{VersionPicker as A}from"@redocly/theme/components/VersionPicker/VersionPicker";import{Button as B}from"@redocly/theme/components/Button/Button";import{CatalogEntityHistoryButton as P}from"@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton";import{ArrowLeftIcon as x}from"@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon";import{withPathPrefix as D}from"@redocly/theme/core/utils";import{telemetry as h}from"../telemetry/index.js";import{usePreloadHistory as T}from"../usePreloadHistory";import{useTranslate as C}from"../hooks";import{usePageSharedData as M,usePageVersions as V}from"../../providers/page-data/hooks";import{useSidebarItems as j}from"./useSidebarItems";import{renderAdmonition as H,RequestAccessButton as R}from"./RequestAccessButton";function ie({layoutControls:s}){const{versions:l=[]}=V()||{},k=l.find(t=>t?.active),{translate:o}=C(),{currentItems:m,backLink:n,versionLabel:a,pushDrilldownState:g,popDrilldownState:v}=j(k),[c,S]=p(),{collapsedSidebar:i}=s,d=M("openAPIDocsStore")?.definition.info?.["x-metadata"]?.apiId,E=T(),[u,r]=p(void 0);return y(()=>{const t=setTimeout(()=>r(void 0),350);return()=>clearTimeout(t)},[u]),m.length?e.createElement(e.Fragment,null,e.createElement(w,{collapsed:i,menuItemsAnimation:u,versions:e.createElement(A,{versions:l,onChange:t=>{h.sendVersionPickerSelectionChangeMessage([{object:"version_picker",action:"change"}]);const f=location.hash?t?.link+location.hash:t?.link;f&&E.push(D(f))}}),menu:e.createElement(I,{items:m,onDrilldownOpen:t=>{r("slideInRight"),g(t)}}),footer:e.createElement("div",{style:{width:"100%"}},!i&&H(c),e.createElement(L,{...s,requestAccessButton:d?e.createElement(R,{apiId:d,status:c,setStatus:S}):null})),header:(n||a)&&e.createElement(q,null,n&&e.createElement(J,{icon:e.createElement(x,null),iconPosition:"left",variant:"ghost",size:"medium","data-component-name":"Sidebar/BackButton",to:n.slug,onClick:()=>{r("slideInLeft"),v(),h.sendSidebarDrilldownBackButtonClickedMessage([{object:"button",action:"click"}])}},i?"":n.label?e.createElement("div",{"data-translation-key":"sidebar.menu.backToLabel"},o("sidebar.menu.backToLabel",{value:o(n.labelTranslationKey,n.label)})):e.createElement("div",{"data-translation-key":"sidebar.menu.backLabel"},o("sidebar.menu.backLabel"))),a&&!i&&e.createElement(P,{version:a}))})):null}const q=b.div`
1
+ import e,{useEffect as y,useState as b}from"react";import h from"styled-components";import{Menu as w}from"@redocly/theme/components/Menu/Menu";import{SidebarActions as A}from"@redocly/theme/components/SidebarActions/SidebarActions";import{Sidebar as B}from"@redocly/theme/components/Sidebar/Sidebar";import{VersionPicker as I}from"@redocly/theme/components/VersionPicker/VersionPicker";import{Button as L}from"@redocly/theme/components/Button/Button";import{CatalogEntityHistoryButton as P}from"@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton";import{ArrowLeftIcon as D}from"@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon";import{withPathPrefix as x,getBaseDataAttributes as C,generateBeforeAfterContext as T}from"@redocly/theme/core/utils";import{telemetry as v}from"../telemetry/index.js";import{usePreloadHistory as M}from"../usePreloadHistory";import{useTranslate as V}from"../hooks";import{usePageSharedData as H,usePageVersions as R}from"../../providers/page-data/hooks";import{useSidebarItems as q}from"./useSidebarItems";import{renderAdmonition as J,RequestAccessButton as j}from"./RequestAccessButton";function re({layoutControls:s}){const{versions:l=[]}=R()||{},m=l.find(t=>t?.active),{translate:o}=V(),{currentItems:c,backLink:n,versionLabel:r,pushDrilldownState:g,popDrilldownState:k}=q(m),[d,E]=b(),{collapsedSidebar:i}=s,u=H("openAPIDocsStore")?.definition.info?.["x-metadata"]?.apiId,S=M(),[f,a]=b(void 0);return y(()=>{const t=setTimeout(()=>a(void 0),350);return()=>clearTimeout(t)},[f]),c.length?e.createElement(e.Fragment,null,e.createElement(B,{collapsed:i,menuItemsAnimation:f,versions:e.createElement(I,{versions:l,onChange:t=>{v.sendVersionPickerChangedMessage([...T("versionPicker","dropdown",{version:m?.version||""},{version:t?.version||""})]);const p=location.hash?t?.link+location.hash:t?.link;p&&S.push(x(p))}}),menu:e.createElement(w,{items:c,onDrilldownOpen:t=>{a("slideInRight"),g(t)}}),footer:e.createElement("div",{style:{width:"100%"}},!i&&J(d),e.createElement(A,{...s,requestAccessButton:u?e.createElement(j,{apiId:u,status:d,setStatus:E}):null})),header:(n||r)&&e.createElement(z,null,n&&e.createElement(F,{icon:e.createElement(D,null),iconPosition:"left",variant:"ghost",size:"medium","data-component-name":"Sidebar/BackButton",to:n.slug,onClick:()=>{a("slideInLeft"),k(),v.sendSidebarDrilldownBackClickedMessage([C("sidebarDrilldownBack","button")])}},i?"":n.label?e.createElement("div",{"data-translation-key":"sidebar.menu.backToLabel"},o("sidebar.menu.backToLabel",{value:o(n.labelTranslationKey,n.label)})):e.createElement("div",{"data-translation-key":"sidebar.menu.backLabel"},o("sidebar.menu.backLabel"))),r&&!i&&e.createElement(P,{version:r}))})):null}const z=h.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--menu-header-container-gap);
5
5
  width: 100%;
6
- `,J=b(B)`
6
+ `,F=h(L)`
7
7
  padding: var(--menu-item-padding-vertical) 0;
8
8
  height: calc(var(--line-height-base) + var(--menu-item-padding-vertical) * 2);
9
9
  justify-content: flex-start;
10
10
  width: 100%;
11
- `;export{ie as Sidebar};
11
+ `;export{re as Sidebar};
@@ -1 +1 @@
1
- import*as h from"react";import{useLocation as _,useNavigate as B}from"react-router-dom";import{usePageData as $,usePageSharedData as R}from"../../hooks";import{withoutHash as M}from"@redocly/theme/core/utils";import{telemetry as w}from"../../telemetry/index.js";import{toStringIfDefined as A}from"../../../../utils/string/to-string-if-defined.js";import{findDeepFirst as V}from"../../../../utils/tree/find-deep-first.js";function te(e,o){const r=_(),i=B(),a=$(),t=q(r),s=R("catalog"),[n,p]=h.useState(()=>(e.filters??[]).map(l=>{if(l.type==="date-range"){const[c,u]=t.get(l.property)?.split("--")??[];return!c&&!u?{}:{from:c,to:u}}return new Set(t.getAll(l.property))})),[d,g]=h.useState(()=>t.get("filter")||"");o||(o=[...s]);const S=h.useMemo(()=>j(o??[],e.filters),[o,e.filters]),b=a?.props?.customFields,C=h.useMemo(()=>G(o??[],e,b||{}),[o,e,b]),v=h.useCallback((l,c)=>{p(u=>{const y=u[l]?u[l]:new Set;return y instanceof Set?(y.has(c)?u.forEach((f,m)=>{f instanceof Set&&f.has(c)&&f.delete(c)}):y.add(c),[...u.slice(0,l),y,...u.slice(l+1)]):u}),w.sendCatalogFilterChangedMessage([{object:"catalog_filter",type:"toggle"}]),window.scrollTo(0,0)},[]),I=h.useCallback((l,c)=>{p(u=>{const y=u[l]instanceof Set?new Set(c?[c]:[]):{from:c?.from,to:c?.to},f=S[l];return u.map((m,F)=>F===l?y:S[F].parentFilter===f.property?new Set:m)}),w.sendCatalogFilterChangedMessage([{object:"catalog_filter",type:"select"}]),window.scrollTo(0,0)},[S]),T=()=>{const l=new URLSearchParams(Array.from(t.entries()));d?t.set("filter",d):t.delete("filter"),n.forEach((u,y)=>{const f=e.filters?.[y];if(!f)return;const m=Z(u);J(f.property,m,l)});const c=l.toString();c!==r.search.substring(1)&&i({search:c})};h.useEffect(()=>{T()},[e.filters,n,d,i,r]);const P=h.useMemo(()=>H(e.filters),[e.filters]);return h.useMemo(()=>{const l=S.map((f,m)=>({...f,toggleOption:F=>v(m,F),selectOption:F=>I(m,F),selectedOptions:n[m]??new Set,isFilterUsed:(n[m]?.size??0)>0||!!n[m]?.from})),c=D(C,l,d),u=l.map((f,m)=>{const F=l.findIndex(O=>O.property===f.parentFilter),E=f.parentFilter?(n[F]?.size??0)>0||!!n[F].from:!0,N=l.filter((O,k)=>k!==m&&!P[m]?.has(k)),z=D(C,N,d),U=j(z.map(O=>({metadata:O})),e.filters);return{...f,parentUsed:E,filteredOptions:U[m].options}});return{groups:e.groupByFirstFilter&&u.length>0?K(u,c):[{title:"APIs",items:c}],filters:u,setFilterTerm:f=>{g(f),w.sendCatalogFilterChangedMessage([{object:"catalog_filter",type:"term"}])},filterTerm:d}},[S,C,d,e.groupByFirstFilter,e.filters,n,v,I,P])}function K(e,o){return e[0].options.map(r=>({title:r.value,items:o.filter(i=>{const a=i?.[e[0].property]||e[0].missingCategoryName||"Others";return Array.isArray(a)?a.includes(r.value):a===r.value})})).filter(r=>r.items.length>0)}function q(e){return h.useMemo(()=>new URLSearchParams(e.search),[e.search])}function G(e,o,r){let i;if(o.separateVersions)i=e.map(a);else{const t={};for(const s of e){if(!s.versionFolderId){const p=s.link||s.fsPath||JSON.stringify(s);t[p]=[s];continue}let n=s.versionFolderId;if(t[n]?.find(p=>p.version===s.version)){const p=s.fsPath?.replace(/\/@.*?\//,"/@version/")??"";n=`${n}-${p}`}t[n]||(t[n]=[]),t[n].push(s)}i=Object.values(t).map(s=>{s.sort((d,g)=>(d.version||"").localeCompare(g.version||""));const n=s.map(a);return{...a(s.find(d=>d.isDefault)||s[s.length-1]),versions:n}})}return i.sort((t,s)=>t.title.localeCompare(s.title)),i;function a(t){const s=t.metadata||{},n=r[t.fsPath||""]||{},p=t.link||V(t.items||[],g=>"link"in g&&!!g.link)?.link,d=t.sidebar?.[0];return{...s,...n,publishedAt:s.publishedAt||s.createdAt,title:A(s?.title)||t.label||"Untitled",description:A(s?.description),link:M(p)??"#",docsLink:M(d?.link),image:A(s?.image),version:t.version,versionFolderId:t.versionFolderId}}}function H(e){if(!e)return[];const o=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.parentFilter){const a=e.findIndex(t=>t.property===i.parentFilter);o[a]=o[a]||new Set,o[a].add(r)}}return o}function j(e,o){return(o??[]).map(r=>{const i=r.options?Object.fromEntries(r.options.map(n=>[n,0])):void 0,a=i??{};let t=0;for(const n of e){const p=Array.isArray(n.metadata?.[r.property])?n.metadata?.[r.property]:[n.metadata?.[r.property]];for(const d of p){const g=L(String(d),r.valuesMapping);if(i){g in i&&(a[g]=a[g]+1);continue}d?a[g]=(a[g]??0)+1:t++}}const s=Object.entries(a).map(([n,p])=>({value:n,count:p}));return i||s.sort((n,p)=>n.value.localeCompare(p.value)),t&&s.push({value:r.missingCategoryNameTranslationKey||r.missingCategoryName||"Others",count:t}),{...r,options:s}})}function D(e,o,r){const i=e.filter(a=>o.every(t=>{if(t.selectedOptions&&!(t.selectedOptions instanceof Set))try{const n=new Date(a[t.property]).toISOString().split("T")[0];return n>=(t.selectedOptions.from??"")&&n<=(t.selectedOptions.to??"Z")}catch{return!0}if(t.selectedOptions.size===0)return!0;const s=L(a?.[t.property]||t.missingCategoryName||"Others",t.valuesMapping);return Array.isArray(s)?s.some(n=>t.selectedOptions.has(n)):t.selectedOptions.has(s)}));return r?(r=r.toLowerCase(),i.filter(a=>Object.values(a).some(t=>Array.isArray(t)?t.some(s=>String(s).toLowerCase().includes(r)):String(t).toLowerCase().includes(r)))):i}function L(e,o){return o?Array.isArray(e)?e.map(r=>o[String(r)]||r):o[String(e)]||e:e}function J(e,o,r){r.delete(e),o.forEach(i=>{r.append(e,i)})}function Z(e){const o=new Set;return e instanceof Set?e.forEach(r=>o.add(r)):(e.from||e.to)&&o.add(`${e.from||""}--${e.to||""}`),o}export{J as fillSearchParams,Z as getFilterValues,te as useCatalogClassic};
1
+ import*as h from"react";import{useLocation as $,useNavigate as R}from"react-router-dom";import{usePageData as V,usePageSharedData as K}from"../../hooks";import{withoutHash as D,getBaseDataAttributes as w}from"@redocly/theme/core/utils";import{telemetry as A}from"../../telemetry/index.js";import{toStringIfDefined as v}from"../../../../utils/string/to-string-if-defined.js";import{findDeepFirst as _}from"../../../../utils/tree/find-deep-first.js";function re(e,o){const r=$(),i=R(),a=V(),t=G(r),s=K("catalog"),[n,p]=h.useState(()=>(e.filters??[]).map(l=>{if(l.type==="date-range"){const[c,u]=t.get(l.property)?.split("--")??[];return!c&&!u?{}:{from:c,to:u}}return new Set(t.getAll(l.property))})),[d,g]=h.useState(()=>t.get("filter")||"");o||(o=[...s]);const S=h.useMemo(()=>L(o??[],e.filters),[o,e.filters]),I=a?.props?.customFields,C=h.useMemo(()=>H(o??[],e,I||{}),[o,e,I]),b=h.useCallback((l,c)=>{p(u=>{const F=u[l]?u[l]:new Set;return F instanceof Set?(F.has(c)?u.forEach((f,m)=>{f instanceof Set&&f.has(c)&&f.delete(c)}):F.add(c),[...u.slice(0,l),F,...u.slice(l+1)]):u}),A.sendCatalogFilterChangedMessage([{...w("catalogFilter","field"),type:"toggle"}]),window.scrollTo(0,0)},[]),P=h.useCallback((l,c)=>{p(u=>{const F=u[l]instanceof Set?new Set(c?[c]:[]):{from:c?.from,to:c?.to},f=S[l];return u.map((m,y)=>y===l?F:S[y].parentFilter===f.property?new Set:m)}),A.sendCatalogFilterChangedMessage([{...w("catalogFilter","field"),type:"select"}]),window.scrollTo(0,0)},[S]),N=()=>{const l=new URLSearchParams(Array.from(t.entries()));d?t.set("filter",d):t.delete("filter"),n.forEach((u,F)=>{const f=e.filters?.[F];if(!f)return;const m=Q(u);Z(f.property,m,l)});const c=l.toString();c!==r.search.substring(1)&&i({search:c})};h.useEffect(()=>{N()},[e.filters,n,d,i,r]);const k=h.useMemo(()=>J(e.filters),[e.filters]);return h.useMemo(()=>{const l=S.map((f,m)=>({...f,toggleOption:y=>b(m,y),selectOption:y=>P(m,y),selectedOptions:n[m]??new Set,isFilterUsed:(n[m]?.size??0)>0||!!n[m]?.from})),c=T(C,l,d),u=l.map((f,m)=>{const y=l.findIndex(O=>O.property===f.parentFilter),j=f.parentFilter?(n[y]?.size??0)>0||!!n[y].from:!0,z=l.filter((O,M)=>M!==m&&!k[m]?.has(M)),B=T(C,z,d),U=L(B.map(O=>({metadata:O})),e.filters);return{...f,parentUsed:j,filteredOptions:U[m].options}});return{groups:e.groupByFirstFilter&&u.length>0?q(u,c):[{title:"APIs",items:c}],filters:u,setFilterTerm:f=>{g(f),A.sendCatalogFilterChangedMessage([{...w("catalogFilter","field"),type:"term"}])},filterTerm:d}},[S,C,d,e.groupByFirstFilter,e.filters,n,b,P,k])}function q(e,o){return e[0].options.map(r=>({title:r.value,items:o.filter(i=>{const a=i?.[e[0].property]||e[0].missingCategoryName||"Others";return Array.isArray(a)?a.includes(r.value):a===r.value})})).filter(r=>r.items.length>0)}function G(e){return h.useMemo(()=>new URLSearchParams(e.search),[e.search])}function H(e,o,r){let i;if(o.separateVersions)i=e.map(a);else{const t={};for(const s of e){if(!s.versionFolderId){const p=s.link||s.fsPath||JSON.stringify(s);t[p]=[s];continue}let n=s.versionFolderId;if(t[n]?.find(p=>p.version===s.version)){const p=s.fsPath?.replace(/\/@.*?\//,"/@version/")??"";n=`${n}-${p}`}t[n]||(t[n]=[]),t[n].push(s)}i=Object.values(t).map(s=>{s.sort((d,g)=>(d.version||"").localeCompare(g.version||""));const n=s.map(a);return{...a(s.find(d=>d.isDefault)||s[s.length-1]),versions:n}})}return i.sort((t,s)=>t.title.localeCompare(s.title)),i;function a(t){const s=t.metadata||{},n=r[t.fsPath||""]||{},p=t.link||_(t.items||[],g=>"link"in g&&!!g.link)?.link,d=t.sidebar?.[0];return{...s,...n,publishedAt:s.publishedAt||s.createdAt,title:v(s?.title)||t.label||"Untitled",description:v(s?.description),link:D(p)??"#",docsLink:D(d?.link),image:v(s?.image),version:t.version,versionFolderId:t.versionFolderId}}}function J(e){if(!e)return[];const o=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.parentFilter){const a=e.findIndex(t=>t.property===i.parentFilter);o[a]=o[a]||new Set,o[a].add(r)}}return o}function L(e,o){return(o??[]).map(r=>{const i=r.options?Object.fromEntries(r.options.map(n=>[n,0])):void 0,a=i??{};let t=0;for(const n of e){const p=Array.isArray(n.metadata?.[r.property])?n.metadata?.[r.property]:[n.metadata?.[r.property]];for(const d of p){const g=E(String(d),r.valuesMapping);if(i){g in i&&(a[g]=a[g]+1);continue}d?a[g]=(a[g]??0)+1:t++}}const s=Object.entries(a).map(([n,p])=>({value:n,count:p}));return i||s.sort((n,p)=>n.value.localeCompare(p.value)),t&&s.push({value:r.missingCategoryNameTranslationKey||r.missingCategoryName||"Others",count:t}),{...r,options:s}})}function T(e,o,r){const i=e.filter(a=>o.every(t=>{if(t.selectedOptions&&!(t.selectedOptions instanceof Set))try{const n=new Date(a[t.property]).toISOString().split("T")[0];return n>=(t.selectedOptions.from??"")&&n<=(t.selectedOptions.to??"Z")}catch{return!0}if(t.selectedOptions.size===0)return!0;const s=E(a?.[t.property]||t.missingCategoryName||"Others",t.valuesMapping);return Array.isArray(s)?s.some(n=>t.selectedOptions.has(n)):t.selectedOptions.has(s)}));return r?(r=r.toLowerCase(),i.filter(a=>Object.values(a).some(t=>Array.isArray(t)?t.some(s=>String(s).toLowerCase().includes(r)):String(t).toLowerCase().includes(r)))):i}function E(e,o){return o?Array.isArray(e)?e.map(r=>o[String(r)]||r):o[String(e)]||e:e}function Z(e,o,r){r.delete(e),o.forEach(i=>{r.append(e,i)})}function Q(e){const o=new Set;return e instanceof Set?e.forEach(r=>o.add(r)):(e.from||e.to)&&o.add(`${e.from||""}--${e.to||""}`),o}export{Z as fillSearchParams,Q as getFilterValues,re as useCatalogClassic};
@@ -1 +1 @@
1
- import{useCallback as h,useEffect as w,useMemo as y,useState as P}from"react";import{useSearchParams as Q}from"react-router-dom";import{telemetry as b}from"../../telemetry/index.js";import{parseFilterQuery as g,formatFilterQuery as C,collectFilterOptions as U}from"../../../utils";function O(r){return r instanceof Set?r.size>0:!!(r?.from||r?.to)}function k(r,d){const[u,m]=Q(),i=u.get("filter")||"",[o,f]=P(()=>g(i,r?.filters||[])),p=y(()=>U(r?.filters,d),[r?.filters,d]);w(()=>{const t=r?.filters||[];if(t.length>0&&o.length!==t.length){const e=g(i,t);f(e)}},[r?.filters,o.length,i]);const F=h((t,e)=>{f(l=>l.map((s,c)=>{if(c!==t||!(s instanceof Set))return s;const n=new Set(s);return n.has(e)?n.delete(e):n.add(e),n})),window.scrollTo(0,0)},[]),S=h((t,e)=>{f(l=>l.map((a,s)=>s!==t?a:a instanceof Set?e&&typeof e=="string"?new Set([e]):new Set:{from:typeof e=="object"?e?.from:void 0,to:typeof e=="object"?e?.to:void 0})),b.sendCatalogFilterChangedMessage([{object:"catalog_filter",type:"select"}]),window.scrollTo(0,0)},[]);return w(()=>{const t=new URLSearchParams(u),e=C(o,r?.filters||[]);e?t.set("filter",e):t.delete("filter"),m(t,{replace:!0})},[r?.filters,o,u,m]),y(()=>{const t=p.map((l,a)=>{const s=o[a],c=O(s);return{...l,toggleOption:n=>F(a,n),selectOption:n=>S(a,n),selectedOptions:s??new Set,isFilterUsed:c}});return{filters:t.map(l=>{const a=t.findIndex(n=>n.property===l.parentFilter),s=o[a],c=l.parentFilter?O(s):!0;return{...l,parentUsed:c}}),filterQuery:i}},[p,o,F,S,i])}export{k as useCatalogFilter};
1
+ import{useCallback as h,useEffect as w,useMemo as y,useState as P}from"react";import{useSearchParams as Q}from"react-router-dom";import{telemetry as b}from"../../telemetry/index.js";import{parseFilterQuery as g,formatFilterQuery as C,collectFilterOptions as U}from"../../../utils";import{getBaseDataAttributes as I}from"@redocly/theme/core/utils";function O(r){return r instanceof Set?r.size>0:!!(r?.from||r?.to)}function x(r,m){const[u,d]=Q(),o=u.get("filter")||"",[i,f]=P(()=>g(o,r?.filters||[])),p=y(()=>U(r?.filters,m),[r?.filters,m]);w(()=>{const t=r?.filters||[];if(t.length>0&&i.length!==t.length){const e=g(o,t);f(e)}},[r?.filters,i.length,o]);const F=h((t,e)=>{f(l=>l.map((s,c)=>{if(c!==t||!(s instanceof Set))return s;const n=new Set(s);return n.has(e)?n.delete(e):n.add(e),n})),window.scrollTo(0,0)},[]),S=h((t,e)=>{f(l=>l.map((a,s)=>s!==t?a:a instanceof Set?e&&typeof e=="string"?new Set([e]):new Set:{from:typeof e=="object"?e?.from:void 0,to:typeof e=="object"?e?.to:void 0})),b.sendCatalogFilterChangedMessage([{...I("catalogFilter","field"),type:"select"}]),window.scrollTo(0,0)},[]);return w(()=>{const t=new URLSearchParams(u),e=C(i,r?.filters||[]);e?t.set("filter",e):t.delete("filter"),d(t,{replace:!0})},[r?.filters,i,u,d]),y(()=>{const t=p.map((l,a)=>{const s=i[a],c=O(s);return{...l,toggleOption:n=>F(a,n),selectOption:n=>S(a,n),selectedOptions:s??new Set,isFilterUsed:c}});return{filters:t.map(l=>{const a=t.findIndex(n=>n.property===l.parentFilter),s=i[a],c=l.parentFilter?O(s):!0;return{...l,parentUsed:c}}),filterQuery:o}},[p,i,F,S,o])}export{x as useCatalogFilter};
@@ -1 +1 @@
1
- import{useLocation as f,useNavigate as d,useNavigationType as l}from"react-router-dom";import{useEffect as v,useState as P}from"react";import{useThemeConfig as w}from"@redocly/theme/core/hooks";import{normalizeRouteSlug as E}from"../../../utils/path/normalize-route-slug";import{onRouteChange as M}from"../../runtime/generated/browser-plugins.js";import{resolveRouteBySlug as y}from"../utils/resolveRouteBySlug.js";import{usePageData as b}from"./usePageData.js";import{usePostMessage as C}from"../../providers/post-message/use-post-message.js";import{isInIframe as R}from"../../utils/utils.js";import{waitForContentScripts as I}from"../../ScriptLoader.js";import{telemetry as N}from"../telemetry/index.js";const U=()=>{const e=f(),r=d(),a=l(),n=b(),[t,i]=P(),m=w(),{sendMessage:h}=C();v(()=>{if(e?.pathname.endsWith("/")&&e?.pathname!=="/"){r({pathname:E(e.pathname),search:e.search,hash:e.hash},{replace:!0,state:e.state});return}I().then(()=>{if(e.pathname!==t?.pathname||e.search!==t.search){M({location:e,prevLocation:t},m);const o=`${window.origin}${e.pathname+e.search+e.hash}`,s=t?`${window.origin}${t.pathname+t.search+t.hash}`:void 0;N.sendPageViewedMessage([{object:"page",uri:o,referrer:s||document.referrer||void 0}])}});const c=!!t;i(e);const{pathname:p,hash:g,state:u}=e;(process.env.NODE_ENV==="development"||R())&&c&&y(p+g,n?.templateId).then(o=>{const s=a==="POP"?"browser":u?.origin;s&&h({type:"route-updated",origin:s,...o})}).catch(o=>console.log("Resolve route by slug failed with error: ",o.message))},[e,a])};export{U as useRouteChangeTracker};
1
+ import{useLocation as f,useNavigate as d,useNavigationType as l}from"react-router-dom";import{useEffect as v,useState as P}from"react";import{useThemeConfig as w}from"@redocly/theme/core/hooks";import{normalizeRouteSlug as E}from"../../../utils/path/normalize-route-slug";import{getBaseDataAttributes as M}from"@redocly/theme/core/utils";import{onRouteChange as y}from"../../runtime/generated/browser-plugins.js";import{resolveRouteBySlug as b}from"../utils/resolveRouteBySlug.js";import{usePageData as C}from"./usePageData.js";import{usePostMessage as R}from"../../providers/post-message/use-post-message.js";import{isInIframe as D}from"../../utils/utils.js";import{waitForContentScripts as I}from"../../ScriptLoader.js";import{telemetry as N}from"../telemetry/index.js";const _=()=>{const e=f(),r=d(),a=l(),n=C(),[t,i]=P(),m=w(),{sendMessage:h}=R();v(()=>{if(e?.pathname.endsWith("/")&&e?.pathname!=="/"){r({pathname:E(e.pathname),search:e.search,hash:e.hash},{replace:!0,state:e.state});return}I().then(()=>{if(e.pathname!==t?.pathname||e.search!==t.search){y({location:e,prevLocation:t},m);const o=`${window.origin}${e.pathname+e.search+e.hash}`,s=t?`${window.origin}${t.pathname+t.search+t.hash}`:void 0;N.sendPageViewedMessage([{...M(o,"page",o),referrer:s||document.referrer||void 0}])}});const p=!!t;i(e);const{pathname:c,hash:g,state:u}=e;(process.env.NODE_ENV==="development"||D())&&p&&b(c+g,n?.templateId).then(o=>{const s=a==="POP"?"browser":u?.origin;s&&h({type:"route-updated",origin:s,...o})}).catch(o=>console.log("Resolve route by slug failed with error: ",o.message))},[e,a])};export{_ as useRouteChangeTracker};
@@ -1 +1 @@
1
- import*as o from"react";import{StoreProvider as v,RequestSamples as y,normalizeOptions as E}from"@redocly/openapi-docs";import{ErrorMessage as O,OpenApiComponentWrap as M}from"../styled.elements";import{useStore as b}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as k}from"../../../../templates/openapi-docs/mock-server-config.js";function P(u){const{descriptionFile:d,operationId:a,pointer:m,exampleKey:s,mimeType:l,language:r,requestBody:f,parameters:g,environment:t,environments:n}=u,{store:e,error:S,baseSlug:c}=b(d),i=o.useMemo(()=>({...e?.options,...(r||null)&&{codeSamples:{languages:[{lang:r??""}]},mockServer:k(e?.options?.mockServer,c||"")}}),[r,e?.options,c]),p=o.useMemo(()=>{if(e)return C(e,{operationId:a,pointer:m},E(i),{exampleKey:s,mimeType:l,environments:n,environment:t})},[s,i,l,a,m,e,n,t]);return e?p?o.createElement(M,{"data-testid":"openapi-code-sample"},o.createElement(v,{options:i,definition:e.definition,withState:{environments:n,environment:t,operation:{pointer:p.pointer,state:{requestValues:{body:f,...g}}}}},o.createElement(y,{operation:p,disableFooter:!0}))):o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):o.createElement(O,null,S)}export{P as OpenApiCodeSample};
1
+ import*as o from"react";import{StoreProvider as v,RequestSamples as y,normalizeOptions as E}from"@redocly/openapi-docs";import{ErrorMessage as O,OpenApiComponentWrap as M}from"../styled.elements";import{useStore as b}from"../../hooks/use-store";import{getOperation as C}from"../../../../../markdoc/helpers/get-operation/index.js";import{getMockServerDocsConfig as k}from"../../../../templates/openapi-docs/mock-server-config.js";function P(u){const{descriptionFile:d,operationId:a,pointer:m,exampleKey:s,mimeType:l,language:r,requestBody:f,parameters:g,environment:t,environments:n}=u,{store:e,error:S,baseSlug:c}=b(d),i=o.useMemo(()=>({...e?.options,...(r||null)&&{codeSamples:{languages:[{lang:r??""}]},mockServer:k(e?.options?.mockServer,c||"")}}),[r,e?.options,c]),p=o.useMemo(()=>{if(e)return C(e,{operationId:a,pointer:m},E(i),{exampleKey:s,mimeType:l,environments:n,environment:t})},[s,i,l,a,m,e,n,t]);return e?p?o.createElement(M,{"data-testid":"openapi-code-sample"},o.createElement(v,{options:i,definition:e.definition,withState:{environments:n,environment:t,operation:{pointer:p.pointer,state:{requestValues:{body:f,...g}}}}},o.createElement(y,{operation:p,disableFooter:!0}))):o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):o.createElement(O,null,S)}export{P as OpenApiCodeSample};
@@ -1 +1 @@
1
- import*as e from"react";import{StoreProvider as S,ResponseSamples as v,normalizeOptions as g}from"@redocly/openapi-docs";import{ErrorMessage as b,OpenApiComponentWrap as E}from"../styled.elements";import{useStore as R}from"../../hooks/use-store";import{getOperation as C}from"./get-operation/index";import{getMockServerDocsConfig as O}from"../../../../templates/openapi-docs/mock-server-config.js";function x(a){const{descriptionFile:m,operationId:i,pointer:p,exampleKey:t}=a,{store:o,error:c,baseSlug:s}=R(m),[l,f]=e.useState(),r=e.useMemo(()=>({...o?.options,mockServer:O(o?.options?.mockServer,s||"")}),[o?.options,s]),n=e.useMemo(()=>{if(o)return C(o,{operationId:i,pointer:p},g(r),{exampleKey:t})},[t,r,i,p,o]),d=e.useCallback(u=>{f(u)},[]);return o?n?e.createElement(E,{"data-testid":"openapi-response-sample"},e.createElement(S,{options:r,definition:o.definition,withState:{operation:{pointer:n.pointer,state:{activeExampleName:t}}}},e.createElement(v,{operation:n,activeResponseTab:l,onTabChange:d}))):e.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):e.createElement(b,null,c)}export{x as OpenApiResponseSample};
1
+ import*as e from"react";import{StoreProvider as S,ResponseSamples as v,normalizeOptions as g}from"@redocly/openapi-docs";import{ErrorMessage as b,OpenApiComponentWrap as E}from"../styled.elements";import{useStore as R}from"../../hooks/use-store";import{getOperation as C}from"../../../../../markdoc/helpers/get-operation/index.js";import{getMockServerDocsConfig as O}from"../../../../templates/openapi-docs/mock-server-config.js";function x(a){const{descriptionFile:m,operationId:i,pointer:p,exampleKey:t}=a,{store:o,error:c,baseSlug:s}=R(m),[l,f]=e.useState(),r=e.useMemo(()=>({...o?.options,mockServer:O(o?.options?.mockServer,s||"")}),[o?.options,s]),n=e.useMemo(()=>{if(o)return C(o,{operationId:i,pointer:p},g(r),{exampleKey:t})},[t,r,i,p,o]),d=e.useCallback(u=>{f(u)},[]);return o?n?e.createElement(E,{"data-testid":"openapi-response-sample"},e.createElement(S,{options:r,definition:o.definition,withState:{operation:{pointer:n.pointer,state:{activeExampleName:t}}}},e.createElement(v,{operation:n,activeResponseTab:l,onTabChange:d}))):e.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation by operationId or pointer"):e.createElement(b,null,c)}export{x as OpenApiResponseSample};
@@ -1 +1 @@
1
- import o from"react";import{EmbeddedReplay as M,StoreProvider as b}from"@redocly/openapi-docs";import{useLocation as A}from"react-router-dom";import{Admonition as I}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{ErrorMessage as P,OpenApiComponentWrap as x}from"../styled.elements.js";import{useStore as R}from"../../hooks/use-store.js";import{getOperation as C}from"./get-operation/index.js";import{getMockServerDocsConfig as y}from"../../../../templates/openapi-docs/mock-server-config.js";const L=S=>{const{descriptionFile:i,operationId:p,pointer:m,exampleKey:l,mimeType:u,requestBody:a,parameters:v,options:s,environment:r,environments:c,hideOtherSecuritySchemes:O}=S,h=A(),{store:e,error:g,baseSlug:t}=R(i),d=o.useMemo(()=>({...e?.options,...s}),[s,e?.options]),f=o.useMemo(()=>{const{mockServer:E,...k}=d;return{...k,mockServer:y(E,t??"")}},[d,t]),n=o.useMemo(()=>{if(e)return C(e,{operationId:p,pointer:m},f,{exampleKey:l,mimeType:u,environments:c,environment:r,requestBody:a})},[l,f,u,p,m,e,c,r,a]);return e?n?o.createElement(x,{"data-testid":"replay-openapi"},o.createElement(b,{key:`${h.pathname}-${i}-${p||m}`,options:{...s,disableRouter:!0,routingBasePath:t,mockServer:y(d.mockServer,t)},definition:e.definition,withState:{environments:c,allowedEnvironments:r?[r]:void 0,operation:{pointer:n.pointer,state:{requestValues:{body:a,...v}}}}},o.createElement(M,{activeOperationId:n.operationId||"",fullOpenApi:e.definition,corsProxyUrl:e.options.corsProxyUrl,pointer:n.pointer,hideOtherSecuritySchemes:O}))):o.createElement(I,{type:"danger"},"Cannot find OpenAPI operation by operationId or pointer in ",i):o.createElement(P,null,g)};export{L as ReplayOpenApi};
1
+ import o from"react";import{EmbeddedReplay as M,StoreProvider as b}from"@redocly/openapi-docs";import{useLocation as A}from"react-router-dom";import{Admonition as I}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{ErrorMessage as P,OpenApiComponentWrap as x}from"../styled.elements.js";import{useStore as R}from"../../hooks/use-store.js";import{getOperation as C}from"../../../../../markdoc/helpers/get-operation/index.js";import{getMockServerDocsConfig as y}from"../../../../templates/openapi-docs/mock-server-config.js";const L=S=>{const{descriptionFile:i,operationId:p,pointer:m,exampleKey:l,mimeType:u,requestBody:a,parameters:v,options:s,environment:r,environments:c,hideOtherSecuritySchemes:O}=S,h=A(),{store:e,error:g,baseSlug:t}=R(i),d=o.useMemo(()=>({...e?.options,...s}),[s,e?.options]),f=o.useMemo(()=>{const{mockServer:E,...k}=d;return{...k,mockServer:y(E,t??"")}},[d,t]),n=o.useMemo(()=>{if(e)return C(e,{operationId:p,pointer:m},f,{exampleKey:l,mimeType:u,environments:c,environment:r,requestBody:a})},[l,f,u,p,m,e,c,r,a]);return e?n?o.createElement(x,{"data-testid":"replay-openapi"},o.createElement(b,{key:`${h.pathname}-${i}-${p||m}`,options:{...s,disableRouter:!0,routingBasePath:t,mockServer:y(d.mockServer,t)},definition:e.definition,withState:{environments:c,allowedEnvironments:r?[r]:void 0,operation:{pointer:n.pointer,state:{requestValues:{body:a,...v}}}}},o.createElement(M,{activeOperationId:n.operationId||"",fullOpenApi:e.definition,corsProxyUrl:e.options.corsProxyUrl,pointer:n.pointer,hideOtherSecuritySchemes:O}))):o.createElement(I,{type:"danger"},"Cannot find OpenAPI operation by operationId or pointer in ",i):o.createElement(P,null,g)};export{L as ReplayOpenApi};
@@ -1 +1 @@
1
- import t,{useEffect as g,useState as s}from"react";import{useNavigate as h}from"react-router-dom";import{Button as y}from"@redocly/theme/components/Button/Button";import{H3 as S}from"@redocly/theme/components/Typography/H3";import{H4 as v}from"@redocly/theme/components/Typography/H4";import{Admonition as w}from"@redocly/theme/components/Admonition/Admonition";import{getPathnameForLocale as E,withPathPrefix as P}from"@redocly/theme/core/utils";import{ServerRoutes as L}from"../../../../constants/api";import{telemetry as b}from"../../telemetry/index.js";import{buildLoginUrl as k}from"../../../../utils/auth/build-login-url";import{usePageProps as O}from"../../../providers/page-data/hooks";import{Wrapper as T,HeadingSection as C}from"./styled";import{DevLoginForm as R}from"./DevLoginForm";import{useL10nConfig as F}from"../../hooks";async function x(r){try{const{status:o}=await fetch(P(L.AUTHORIZATION),{method:"POST",body:JSON.stringify(r)});return o}catch(o){console.error(o)}}function G(){const{defaultLocale:r,locales:o,currentLocale:c}=F(),l=h(),[a,d]=s({values:{teams:[],email:"example@example.com"}}),[n,u]=s();g(()=>{const e=new URLSearchParams(window.location.search);u(e.get("redirectTo")||void 0)},[]);const i=O(),m=i?.authIdps,p=(i.rbac?.teams||[]).filter(e=>e!=="*"),f=async()=>{await x(a.values)===200&&(l(n||"/"),window.location.reload())};return t.createElement(T,null,t.createElement(C,null,t.createElement(S,{"data-cy":"login-title"},"Dev-mode login"),t.createElement(w,{type:"warning",name:"This is dev mode login simulator."},"Any email works and password is not checked.")),t.createElement(t.Fragment,null,t.createElement(R,{teams:p,formState:a,setFormState:d,onSubmit:f}),Object.keys(m||{}).length>0&&t.createElement(v,null,"Use SSO:"),Object.values(m||{}).map(e=>t.createElement("div",{key:e.idpId},t.createElement(y,{fullWidth:!0,size:"large","data-cy":"idp-login",to:k(e.idpId,E("",r,c,o),n),onClick:()=>b.sendLoginProviderButtonClickedMessage([{object:"button",provider:e.type}])},e.title||e.type)))))}export{G as default};
1
+ import t,{useEffect as g,useState as s}from"react";import{useNavigate as h}from"react-router-dom";import{Button as y}from"@redocly/theme/components/Button/Button";import{H3 as v}from"@redocly/theme/components/Typography/H3";import{H4 as S}from"@redocly/theme/components/Typography/H4";import{Admonition as w}from"@redocly/theme/components/Admonition/Admonition";import{getBaseDataAttributes as P,getPathnameForLocale as E,withPathPrefix as L}from"@redocly/theme/core/utils";import{ServerRoutes as b}from"../../../../constants/api";import{telemetry as k}from"../../telemetry/index.js";import{buildLoginUrl as O}from"../../../../utils/auth/build-login-url";import{usePageProps as T}from"../../../providers/page-data/hooks";import{Wrapper as C,HeadingSection as R}from"./styled";import{DevLoginForm as A}from"./DevLoginForm";import{useL10nConfig as F}from"../../hooks";async function x(r){try{const{status:o}=await fetch(L(b.AUTHORIZATION),{method:"POST",body:JSON.stringify(r)});return o}catch(o){console.error(o)}}function K(){const{defaultLocale:r,locales:o,currentLocale:c}=F(),l=h(),[a,d]=s({values:{teams:[],email:"example@example.com"}}),[i,u]=s();g(()=>{const e=new URLSearchParams(window.location.search);u(e.get("redirectTo")||void 0)},[]);const n=T(),m=n?.authIdps,p=(n.rbac?.teams||[]).filter(e=>e!=="*"),f=async()=>{await x(a.values)===200&&(l(i||"/"),window.location.reload())};return t.createElement(C,null,t.createElement(R,null,t.createElement(v,{"data-cy":"login-title"},"Dev-mode login"),t.createElement(w,{type:"warning",name:"This is dev mode login simulator."},"Any email works and password is not checked.")),t.createElement(t.Fragment,null,t.createElement(A,{teams:p,formState:a,setFormState:d,onSubmit:f}),Object.keys(m||{}).length>0&&t.createElement(S,null,"Use SSO:"),Object.values(m||{}).map(e=>t.createElement("div",{key:e.idpId},t.createElement(y,{fullWidth:!0,size:"large","data-cy":"idp-login",to:O(e.idpId,E("",r,c,o),i),onClick:()=>k.sendLoginProviderClickedMessage([{...P("loginProvider","button"),provider:e.type}])},e.title||e.type)))))}export{K as default};
@@ -1 +1 @@
1
- import{useCallback as b,useEffect as O,useState as E,useRef as w}from"react";import{SEARCH_DEBOUNCE_TIME_MS as q}from"@redocly/theme/core/constants";import{withPathPrefix as A}from"@redocly/theme/core/utils";import{ServerRoutes as j}from"../../../constants/api";import{SEARCH_GROUP_FACET_FIELD as v,SEARCH_PRODUCT_FIELD as L,SEARCH_VERSION_FIELD as M}from"../../../constants/common";import{debounce as Q}from"../../../utils/time/debounce.js";import{useSearchSession as U}from"@redocly/theme/core/contexts";import{useGlobalData as J,useI18nConfig as D}from"../hooks";import{usePageVersions as B}from"../../providers/page-data/hooks";import{useFacets as K}from"./useFacets";import{telemetry as $}from"../telemetry/index.js";const z=(o,c,r,a,s,u,f,n,l)=>{const{searchSessionId:y}=U(),{currentLocale:F}=D(),m=w(""),d=w(null),p=w(async(e,i)=>{try{u(null);const t=await fetch(A(j.SEARCH),i);if(!t.ok)throw new Error(t.statusText||`Search failed (${t.status})`);if(R(e)){const S=await t.json();a(S.facets),r(S.documents),d.current=null,e.trim().length>1&&$.sendSearchQueryMessage([{object:"search",query:e,resultCount:Object.keys(S.documents).length.toString(),searchSessionId:y,...n&&{product:n}}]),s(!1)}}catch(t){if(!R(e))return;d.current={query:e,requestParams:i},r({}),s(!1),u(t instanceof Error?t.message:"An unknown error occurred")}}),R=e=>m.current===e,h=b(Q(async(e,i,t,S)=>{if(!e.trim().length&&!i.length){r({}),a({}),s(!1),u(null),d.current=null;return}const I={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,filter:H(i,S,f),locale:t})};await p.current(e,I)},q),[f?.version,f?.folderId,n]);return O(()=>{l||(s(!0),h(o,c,F,n),m.current=o)},[l,c,F,n,o,h,s]),{retrySearch:b(async()=>{const e=d.current;e&&(s(!0),m.current=e.query,await p.current(e.query,e.requestParams))},[s])}},W=(o,c,r,a,s,u,f,n,l)=>{const{currentLocale:y}=D();O(()=>{F(r,o,c,y,a,s,n,l)},[a,n,l?.version,l?.folderId]);const F=b(async(m,d,p,R,h,C,e,i)=>{if(h){const{groupKey:t}=h;f(!0);const I={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:d,filter:(()=>{const g=C.find(_=>_.field===v);let P=p;return g&&(p.find(N=>N.field===g.field)||(P=[...p,{field:g.field,values:[t]}])),H(P,e,i)})(),loadMore:h,locale:R})},T=await(await fetch(A(j.SEARCH),I)).json(),k=m[t]||[],x=T.documents[t],G={...m,[t]:[...k,...x]};u(G),f(!1)}},[]);return{}};function ue(o,c){const{searchFeatures:r}=J(),[a,s]=E(""),[u,f]=E([]),[n,l]=E({}),[y,F]=E({}),[m,d]=E(),[p,R]=E(!1),[h,C]=E(null),{facets:e}=K(y),{versions:i=[]}=B()||{},t=i.find(I=>I?.active),{retrySearch:S}=z(a,u,l,F,R,C,t,o,c);return W(a,u,n,m,e,l,R,o,t),{query:a,setQuery:s,filter:u,setFilter:f,items:n,isSearchLoading:p,searchError:h,facets:e,groupField:v,setLoadMore:d,retrySearch:S,advancedSearch:r?.advanced?.enabled,askAi:r?.ai?.enabled}}function H(o,c,r){return[...o,...c?[{field:L,values:[c]}]:[],...r?[{field:M,values:[...r.default?["default"]:[r.folderId,r.version]]}]:[]]}export{ue as useSearch};
1
+ import{useCallback as b,useEffect as A,useState as E,useRef as w}from"react";import{SEARCH_DEBOUNCE_TIME_MS as Q}from"@redocly/theme/core/constants";import{getBaseDataAttributes as q,withPathPrefix as O}from"@redocly/theme/core/utils";import{ServerRoutes as D}from"../../../constants/api";import{SEARCH_GROUP_FACET_FIELD as v,SEARCH_PRODUCT_FIELD as L,SEARCH_VERSION_FIELD as M}from"../../../constants/common";import{debounce as U}from"../../../utils/time/debounce.js";import{useSearchSession as B}from"@redocly/theme/core/contexts";import{useGlobalData as J,useI18nConfig as H}from"../hooks";import{usePageVersions as K}from"../../providers/page-data/hooks";import{useFacets as $}from"./useFacets";import{telemetry as z}from"../telemetry/index.js";const W=(o,c,r,a,s,u,f,n,l)=>{const{searchSessionId:y}=B(),{currentLocale:F}=H(),m=w(""),d=w(null),p=w(async(e,i)=>{try{u(null);const t=await fetch(O(D.SEARCH),i);if(!t.ok)throw new Error(t.statusText||`Search failed (${t.status})`);if(R(e)){const S=await t.json();a(S.facets),r(S.documents),d.current=null,e.trim().length>1&&z.sendSearchQueryMessage([{...q("searchQuery","search"),query:e,resultCount:Object.keys(S.documents).length.toString(),searchSessionId:y,...n&&{product:n}}]),s(!1)}}catch(t){if(!R(e))return;d.current={query:e,requestParams:i},r({}),s(!1),u(t instanceof Error?t.message:"An unknown error occurred")}}),R=e=>m.current===e,h=b(U(async(e,i,t,S)=>{if(!e.trim().length&&!i.length){r({}),a({}),s(!1),u(null),d.current=null;return}const I={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,filter:T(i,S,f),locale:t})};await p.current(e,I)},Q),[f?.version,f?.folderId,n]);return A(()=>{l||(s(!0),h(o,c,F,n),m.current=o)},[l,c,F,n,o,h,s]),{retrySearch:b(async()=>{const e=d.current;e&&(s(!0),m.current=e.query,await p.current(e.query,e.requestParams))},[s])}},X=(o,c,r,a,s,u,f,n,l)=>{const{currentLocale:y}=H();A(()=>{F(r,o,c,y,a,s,n,l)},[a,n,l?.version,l?.folderId]);const F=b(async(m,d,p,R,h,C,e,i)=>{if(h){const{groupKey:t}=h;f(!0);const I={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:d,filter:(()=>{const g=C.find(_=>_.field===v);let P=p;return g&&(p.find(N=>N.field===g.field)||(P=[...p,{field:g.field,values:[t]}])),T(P,e,i)})(),loadMore:h,locale:R})},j=await(await fetch(O(D.SEARCH),I)).json(),k=m[t]||[],x=j.documents[t],G={...m,[t]:[...k,...x]};u(G),f(!1)}},[]);return{}};function le(o,c){const{searchFeatures:r}=J(),[a,s]=E(""),[u,f]=E([]),[n,l]=E({}),[y,F]=E({}),[m,d]=E(),[p,R]=E(!1),[h,C]=E(null),{facets:e}=$(y),{versions:i=[]}=K()||{},t=i.find(I=>I?.active),{retrySearch:S}=W(a,u,l,F,R,C,t,o,c);return X(a,u,n,m,e,l,R,o,t),{query:a,setQuery:s,filter:u,setFilter:f,items:n,isSearchLoading:p,searchError:h,facets:e,groupField:v,setLoadMore:d,retrySearch:S,advancedSearch:r?.advanced?.enabled,askAi:r?.ai?.enabled}}function T(o,c,r){return[...o,...c?[{field:L,values:[c]}]:[],...r?[{field:M,values:[...r.default?["default"]:[r.folderId,r.version]]}]:[]]}export{le as useSearch};
@@ -0,0 +1 @@
1
+ import{getOperation as E,getServerEnvName as l,normalizeOptions as x,OpenAPIParser as h,getTagOrGroup as q}from"@redocly/openapi-docs";import{getOperationInfoById as v}from"./get-operation-info-by-id.js";import{getOperationInfoByPointer as y}from"./get-operation-info-by-pointer.js";function M(s,{operationId:i,pointer:f},m,{exampleKey:r,mimeType:a,environments:p,environment:d,requestBody:g}){let o;if(i?o=v(s.definition,i):f&&(o=y(s.definition,f)),!o)return;const O=new h(s.definition,void 0,x(s.options)),u=o.tags?.[0],B=u?q("group",{name:u},void 0):void 0,n=E(O,o,B,m,"");if(a&&n.requestBody?.content?.mediaTypes&&(n.requestBody.content.mediaTypes=n.requestBody?.content?.mediaTypes.filter(e=>e.name===a)),r&&(n.requestBody?.content?.mediaTypes.forEach(e=>{if(!e.examples)return;const t=e.examples[r];e.examples=t?{[r]:t}:{}}),n.responses?.forEach(e=>{e.content?.mediaTypes?.forEach(t=>{if(!t.examples)return;const c=t.examples[r];t.examples=c?{[r]:c}:{}})})),g&&n.requestBody?.content?.mediaTypes.forEach(e=>{e.examples={}}),p&&(n.servers=n.servers.map(e=>{const t=p?.[l(e)];return t?{...e,url:t.server||e.url}:e})),d){const e=n.servers.filter(t=>d===l(t));n.servers=e.length?e:n.servers}return n}export{M as getOperation};
@@ -0,0 +1,4 @@
1
+ export * from './get-operation-info-by-id.js';
2
+ export * from './get-operation-info-by-pointer.js';
3
+ export * from './get-operation.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export*from"./get-operation-info-by-id.js";export*from"./get-operation-info-by-pointer.js";export*from"./get-operation.js";
@@ -0,0 +1,3 @@
1
+ import type { ResolvedSampleBlock } from '../../types/index.js';
2
+ export declare function getResolvedSampleCodeBlock({ lang, title, source }: ResolvedSampleBlock): string;
3
+ //# sourceMappingURL=get-resolved-sample-code-block.d.ts.map
@@ -0,0 +1,5 @@
1
+ function $({lang:n,title:e,source:o}){return`
2
+ \`\`\`${`${n||""}${e?`${n?" ":""}${e}`:""}`}
3
+ ${o.trimEnd()}
4
+ \`\`\`
5
+ `}export{$ as getResolvedSampleCodeBlock};
@@ -1 +1 @@
1
- import{DefinitionPath as t}from"../attributes/index.js";const a={schema:{attributes:{descriptionFile:{type:t,required:!0},pointer:{type:String,required:!1},operationId:{type:String,required:!1},exampleKey:{type:String,required:!1},mimeType:{type:String,required:!1},language:{type:String,required:!1},parameters:{type:Object,default:{},required:!1},requestBody:{type:Object,required:!1},environments:{type:Object,default:{},required:!1},environment:{type:String,required:!1}},validate(e){const r=[];return e.attributes.pointer&&e.attributes.operationId&&r.push({id:"pointer-and-operationId-attributes-are-mutually-exclusive",level:"error",message:'The "pointer" and "operationId" attributes are mutually exclusive, you can only use one.'}),!e.attributes.pointer&&!e.attributes.operationId&&r.push({id:"pointer-or-operationId-attribute-required",level:"error",message:'This tag requires the "pointer" or "operationId" attribute to render correctly.'}),r},render:"OpenApiCodeSample",selfClosing:!0,dynamicComponentLib:"openapi"},tagName:"openapi-code-sample"};export{a as openApiCodeSample};
1
+ import{DefinitionPath as a}from"../attributes/index.js";import{getNodeAttribute as o}from"../helpers/get-node-attribute.js";import{getResolvedSampleCodeBlock as p}from"../helpers/get-resolved-sample-code-block.js";const u={schema:{attributes:{descriptionFile:{type:a,required:!0},pointer:{type:String,required:!1},operationId:{type:String,required:!1},exampleKey:{type:String,required:!1},mimeType:{type:String,required:!1},language:{type:String,required:!1},parameters:{type:Object,default:{},required:!1},requestBody:{type:Object,required:!1},environments:{type:Object,default:{},required:!1},environment:{type:String,required:!1},codeSamplesResolved:{type:Array,required:!1,resolver:"openapiCodeSamples"}},validate(r){const e=[];return r.attributes.pointer&&r.attributes.operationId&&e.push({id:"pointer-and-operationId-attributes-are-mutually-exclusive",level:"error",message:'The "pointer" and "operationId" attributes are mutually exclusive, you can only use one.'}),!r.attributes.pointer&&!r.attributes.operationId&&e.push({id:"pointer-or-operationId-attribute-required",level:"error",message:'This tag requires the "pointer" or "operationId" attribute to render correctly.'}),e},render:"OpenApiCodeSample",selfClosing:!0,dynamicComponentLib:"openapi",renderForLlms(r){const e=o(r,"codeSamplesResolved");if(!Array.isArray(e)||e.length===0)return"";const t=e.find(({lang:i})=>i==="shell")??e[0];return p(t)}},tagName:"openapi-code-sample"};export{u as openApiCodeSample};
@@ -1 +1 @@
1
- import{DefinitionPath as r}from"../attributes/index.js";const o={schema:{attributes:{descriptionFile:{type:r,required:!0},pointer:{type:String,required:!1},operationId:{type:String,required:!1},exampleKey:{type:String,required:!1}},validate(e){const t=[];return e.attributes.pointer&&e.attributes.operationId&&t.push({id:"pointer-and-operationId-attributes-are-mutually-exclusive",level:"error",message:'The "pointer" and "operationId" attributes are mutually exclusive, you can only use one.'}),!e.attributes.pointer&&!e.attributes.operationId&&t.push({id:"pointer-or-operationId-attribute-required",level:"error",message:'This tag requires the "pointer" or "operationId" attribute to render correctly.'}),t},render:"OpenApiResponseSample",selfClosing:!0,dynamicComponentLib:"openapi"},tagName:"openapi-response-sample"};export{o as openApiResponseSample};
1
+ import{DefinitionPath as t}from"../attributes/index.js";import{getNodeAttribute as i}from"../helpers/get-node-attribute.js";import{getResolvedSampleCodeBlock as o}from"../helpers/get-resolved-sample-code-block.js";const n={schema:{attributes:{descriptionFile:{type:t,required:!0},pointer:{type:String,required:!1},operationId:{type:String,required:!1},exampleKey:{type:String,required:!1},responseSamplesResolved:{type:Array,required:!1,resolver:"openapiResponseSamples"}},validate(r){const e=[];return r.attributes.pointer&&r.attributes.operationId&&e.push({id:"pointer-and-operationId-attributes-are-mutually-exclusive",level:"error",message:'The "pointer" and "operationId" attributes are mutually exclusive, you can only use one.'}),!r.attributes.pointer&&!r.attributes.operationId&&e.push({id:"pointer-or-operationId-attribute-required",level:"error",message:'This tag requires the "pointer" or "operationId" attribute to render correctly.'}),e},render:"OpenApiResponseSample",selfClosing:!0,dynamicComponentLib:"openapi",renderForLlms(r){const e=i(r,"responseSamplesResolved");return!Array.isArray(e)||e.length===0?"":e.map(o).join("")}},tagName:"openapi-response-sample"};export{n as openApiResponseSample};
@@ -49,4 +49,6 @@ export declare const OTEL_TRACES_DEV_URL = "http://localhost:4318/v1/traces";
49
49
  export declare const OTEL_EXCLUDED_ROUTES: "/_health"[];
50
50
  export declare const SERVER_EDITOR_APP_URL: string;
51
51
  export declare const ALLOWED_CORS_ORIGINS: string[];
52
+ export declare const MARKDOC_PARTIALS_DATA_KEY = "markdown/partials";
53
+ export declare const MARKDOC_PARTIALS_DEPS_KEY = "markdown/partials-deps";
52
54
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- import{ServerRoutes as L}from"../../constants/api.js";import{USER_THEME_ALIAS as c}from"../../constants/common.js";import{envConfig as _}from"../config/env-config.js";const N="runtime",x="/assets",U="/_spec",P="/_bundle",l="static",M="redocly:::linkOriginal",a="@",i="default",m=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),H="@redocly/theme/plugin.js",F="styles.css",G=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],u=_.JWT_SECRET_KEY||"test_secret_key",A="@i18n",p="@l10n",Y=[c,A,p],d="https://redocly.com/auth/aud",g="catalog.json",B="scorecard.json",h="page-count.json",K="sitemap.xml",J="llms.txt",R=_.PROJECT_ID,e=_.PROJECT_SLUG,n=_.ORGANIZATION_ID,s=_.ORG_SLUG,E=_.BH_API_URL,t=E&&s&&e?`${E}/orgs/${s}/projects/${e}`:void 0,o=E&&n&&R?`${E}/orgs/${n}/projects/${R}`:void 0,S=E?`${E}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",W=_.ENTITLEMENTS_JWKS_CDN_URL||S,$=t?`${t}/feedback`:"",f=o?`${o}/ai-agentic-conversations`:"",j=o?`${o}/semantic-search`:"",V=t&&`${t}/registry/apis`,X=t&&`${t}/registry/paths`,k="no-store",w=365*24*60*60,y="X-Redocly-Cache-Control",v="no-cache",b="public, s-maxage=86400, max-age=10, must-revalidate",Z=_.AUTH_URL,q="Developer Documentation",T=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",z=T==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,Q=T==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,__="-----BEGIN CERTIFICATE-----",E_="-----END CERTIFICATE-----",t_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",o_="http://localhost:4318/v1/traces",R_=[L.HEALTH],r=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",e_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(I=>I.trim()).filter(Boolean).concat(r):[r];export{e_ as ALLOWED_CORS_ORIGINS,d as ALTERNATIVE_AUD_CLAIM_NAME,f as ASK_AI_API_URL,Z as AUTH_URL,__ as BEGIN_CERTIFICATE_DELIMITER,t as BH_API_PROJECTS_URL,o as BH_API_PROJECTS_URL_V2,k as CACHE_CONTROL_NO_STORE_HEADER_VALUE,v as CACHE_CONTROL_PUBLIC_HTML,g as CATALOG_OUTPUT_FILE_NAME,w as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,G as DEFAULT_PROJECT_PLUGIN_PATHS,H as DEFAULT_THEME_PLUGIN_PATH,q as DEFAULT_TITLE,i as DEFAULT_VERSION_NAME,U as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,E_ as END_CERTIFICATE_DELIMITER,W as ENTITLEMENTS_JWKS_URL,$ as FEEDBACK_API_URL,A as I18N_DIR_NAME,u as JWT_SECRET_KEY,p as L10N_DIR_NAME,M as LINK_ORIGINAL_ATTR_NAME,J as LLMS_TXT_FILE_NAME,n as ORG_ID,s as ORG_SLUG,R_ as OTEL_EXCLUDED_ROUTES,o_ as OTEL_TRACES_DEV_URL,h as PAGE_COUNT_OUTPUT_FILE_NAME,R as PROJECT_ID,e as PROJECT_SLUG,P as PUBLIC_API_DEFINITIONS_FOLDER,x as PUBLIC_ASSETS_FOLDER,l as PUBLIC_STATIC_FOLDER,V as REGISTRY_APIS_API_URL,X as REGISTRY_APIS_PATHS_API_URL,Y as RESERVED_DIR_NAMES,N as RUNTIME_RESOURCES_DIR,B as SCORECARD_OUTPUT_FILE_NAME,j as SEMANTIC_SEARCH_API_URL,r as SERVER_EDITOR_APP_URL,K as SITEMAP_FILE_NAME,T as SSR_RENDER_MODE,Q as SSR_WORKERS_MAX,z as SSR_WORKERS_MIN,F as STYLES_FILE,t_ as TELEMETRY_ENABLED,m as VERSIONED_FOLDER_REGEXP_MATCH,a as VERSION_SEPARATOR,y as X_REDOCLY_CACHE_CONTROL_HEADER,b as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
1
+ import{ServerRoutes as I}from"../../constants/api.js";import{USER_THEME_ALIAS as L}from"../../constants/common.js";import{envConfig as _}from"../config/env-config.js";const x="runtime",N="/assets",U="/_spec",P="/_bundle",a="static",l="redocly:::linkOriginal",M="@",i="default",m=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),H="@redocly/theme/plugin.js",F="styles.css",G=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],u=_.JWT_SECRET_KEY||"test_secret_key",c="@i18n",p="@l10n",Y=[L,c,p],d="https://redocly.com/auth/aud",K="catalog.json",g="scorecard.json",B="page-count.json",h="sitemap.xml",J="llms.txt",R=_.PROJECT_ID,e=_.PROJECT_SLUG,n=_.ORGANIZATION_ID,s=_.ORG_SLUG,E=_.BH_API_URL,t=E&&s&&e?`${E}/orgs/${s}/projects/${e}`:void 0,o=E&&n&&R?`${E}/orgs/${n}/projects/${R}`:void 0,S=E?`${E}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",W=_.ENTITLEMENTS_JWKS_CDN_URL||S,$=t?`${t}/feedback`:"",f=o?`${o}/ai-agentic-conversations`:"",j=o?`${o}/semantic-search`:"",k=t&&`${t}/registry/apis`,w=t&&`${t}/registry/paths`,V="no-store",X=365*24*60*60,y="X-Redocly-Cache-Control",v="no-cache",b="public, s-maxage=86400, max-age=10, must-revalidate",Z=_.AUTH_URL,q="Developer Documentation",r=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",z=r==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,Q=r==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,__="-----BEGIN CERTIFICATE-----",E_="-----END CERTIFICATE-----",t_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",o_="http://localhost:4318/v1/traces",R_=[I.HEALTH],T=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",e_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(A=>A.trim()).filter(Boolean).concat(T):[T],n_="markdown/partials",s_="markdown/partials-deps";export{e_ as ALLOWED_CORS_ORIGINS,d as ALTERNATIVE_AUD_CLAIM_NAME,f as ASK_AI_API_URL,Z as AUTH_URL,__ as BEGIN_CERTIFICATE_DELIMITER,t as BH_API_PROJECTS_URL,o as BH_API_PROJECTS_URL_V2,V as CACHE_CONTROL_NO_STORE_HEADER_VALUE,v as CACHE_CONTROL_PUBLIC_HTML,K as CATALOG_OUTPUT_FILE_NAME,X as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,G as DEFAULT_PROJECT_PLUGIN_PATHS,H as DEFAULT_THEME_PLUGIN_PATH,q as DEFAULT_TITLE,i as DEFAULT_VERSION_NAME,U as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,E_ as END_CERTIFICATE_DELIMITER,W as ENTITLEMENTS_JWKS_URL,$ as FEEDBACK_API_URL,c as I18N_DIR_NAME,u as JWT_SECRET_KEY,p as L10N_DIR_NAME,l as LINK_ORIGINAL_ATTR_NAME,J as LLMS_TXT_FILE_NAME,n_ as MARKDOC_PARTIALS_DATA_KEY,s_ as MARKDOC_PARTIALS_DEPS_KEY,n as ORG_ID,s as ORG_SLUG,R_ as OTEL_EXCLUDED_ROUTES,o_ as OTEL_TRACES_DEV_URL,B as PAGE_COUNT_OUTPUT_FILE_NAME,R as PROJECT_ID,e as PROJECT_SLUG,P as PUBLIC_API_DEFINITIONS_FOLDER,N as PUBLIC_ASSETS_FOLDER,a as PUBLIC_STATIC_FOLDER,k as REGISTRY_APIS_API_URL,w as REGISTRY_APIS_PATHS_API_URL,Y as RESERVED_DIR_NAMES,x as RUNTIME_RESOURCES_DIR,g as SCORECARD_OUTPUT_FILE_NAME,j as SEMANTIC_SEARCH_API_URL,T as SERVER_EDITOR_APP_URL,h as SITEMAP_FILE_NAME,r as SSR_RENDER_MODE,Q as SSR_WORKERS_MAX,z as SSR_WORKERS_MIN,F as STYLES_FILE,t_ as TELEMETRY_ENABLED,m as VERSIONED_FOLDER_REGEXP_MATCH,M as VERSION_SEPARATOR,y as X_REDOCLY_CACHE_CONTROL_HEADER,b as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
@@ -0,0 +1,4 @@
1
+ import type { MediaContentModel } from '@redocly/openapi-docs/lib/models/types.js';
2
+ import type { ResolvedSampleBlock } from '../../../../../types/index.js';
3
+ export declare function getMediaContentSamples(content: MediaContentModel | undefined, exampleKey: string | undefined, titlePrefix: string): ResolvedSampleBlock[];
4
+ //# sourceMappingURL=get-media-content-samples.d.ts.map
@@ -0,0 +1 @@
1
+ import{convertSampleToString as p}from"@redocly/openapi-docs/lib/services/code-samples/convertSampleToString.js";import{langFromMime as r}from"@redocly/openapi-docs/lib/utils/openapi.js";import{getExampleValueByMimeType as c}from"@redocly/openapi-docs/lib/services/code-samples/get-example-value-by-mime-type.js";function d(o,t,l){const a=[];if(!o?.hasSample)return a;for(const e of o.mediaTypes??[]){const n=e.examples||e.formExamples||{},m=Object.keys(n);if(!m.length)continue;const s=m.length===1?n[m[0]]:t&&n[t]||n[m[0]],i=p(s.value,e.name,e.schema);i!==void 0&&a.push({lang:r(e.name),title:`${l} ${e.name}`,source:c(i,e.name,s.encoding)})}return a}export{d as getMediaContentSamples};
@@ -0,0 +1,7 @@
1
+ import type { Node } from '@markdoc/markdoc';
2
+ import type { LifecycleContext } from '../../../../types';
3
+ import type { BundledDefinition } from '../../../openapi-docs/load-definition.js';
4
+ type OpenapiBundle = Pick<BundledDefinition, 'definition' | 'rawOptions'>;
5
+ export declare function loadOpenapiBundle(node: Node, context: LifecycleContext): Promise<OpenapiBundle | undefined>;
6
+ export {};
7
+ //# sourceMappingURL=load-openapi-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ import{OPENAPI_SHARED_DATA_PREFIX as n}from"../../../../constants/plugins/openapi-docs.js";import{getNodeAttribute as a}from"../../../../../markdoc/helpers/get-node-attribute.js";import{logger as d}from"../../../../tools/notifiers/logger.js";async function l(r,i){const e=a(r,"descriptionFile");if(typeof e!="string"||!e.startsWith(n))return;const o=e.slice(n.length);try{const{data:t}=await i.cache.load(o,"load-oas");return t?.[0]}catch(t){d.verbose(`Failed to load OpenAPI definition ${o} for the ${r.tag} tag: ${t instanceof Error?t.message:"Unknown error"}`);return}}export{l as loadOpenapiBundle};
@@ -1 +1 @@
1
- import{resolveOpenApiRef as e}from"./resolve-open-api-ref.js";import{resolveJsonSchemaRef as r}from"./resolve-json-schema-ref.js";import{resolveParsedYaml as o}from"./resolve-parsed-yaml.js";import{resolveRawContent as m}from"./resolve-raw-content.js";import{resolveSvgContent as t}from"./resolve-svg-content.js";import{resolveRelativePath as i}from"./resolve-relative-path.js";import{resolveLink as l}from"./resolve-link.js";import{resolveNativeMdLink as a}from"./resolve-native-md-link.js";import{resolveCodeSnippetFromFile as s}from"./resolve-code-snippet-from-file.js";import{resolveDiagramFromFile as p}from"./resolve-diagram-from-file.js";import{resolveHtmlSourceAttribute as n}from"./resolve-html-source-attribute.js";import{resolveHtmlHref as v}from"./resolve-html-href.js";import{resolveImageSrc as f}from"./resolve-image-src.js";import{resolveImageSrcSet as S}from"./resolve-image-src-set.js";import{resolveImageGallery as c}from"./resolve-image-gallery.js";import{resolveNavLinks as g}from"./resolve-nav-links.js";import{resolveRelativeOrCdnIcon as h}from"./resolve-relative-or-cdn-icon.js";import{resolveCodeWalkthroughFilesets as d}from"./code-walkthrough/filesets-resolver.js";import{resolveJsonExampleRef as F}from"./resolve-json-example-ref.js";import{resolveSampleFromJsonSchema as R}from"./resolve-sample-from-json-schema.js";const Y={openapiRef:e,jsonSchemaRef:r,parsedYaml:o,rawContent:m,svgContent:t,relativePath:i,link:l,nativeMdLink:a,codeSnippetFile:s,diagramFile:p,htmlSourceAttribute:n,htmlHref:v,imageSrc:f,imageSrcSet:S,imageGallery:c,navLinks:g,relativeOrCdnIcon:h,codeWalkthroughFilesets:d,jsonExampleRef:F,sampleFromJsonSchema:R};export{Y as attributeResolvers};
1
+ import{resolveOpenApiRef as e}from"./resolve-open-api-ref.js";import{resolveJsonSchemaRef as o}from"./resolve-json-schema-ref.js";import{resolveParsedYaml as r}from"./resolve-parsed-yaml.js";import{resolveRawContent as m}from"./resolve-raw-content.js";import{resolveSvgContent as t}from"./resolve-svg-content.js";import{resolveRelativePath as i}from"./resolve-relative-path.js";import{resolveLink as l}from"./resolve-link.js";import{resolveNativeMdLink as p}from"./resolve-native-md-link.js";import{resolveCodeSnippetFromFile as s}from"./resolve-code-snippet-from-file.js";import{resolveDiagramFromFile as a}from"./resolve-diagram-from-file.js";import{resolveHtmlSourceAttribute as n}from"./resolve-html-source-attribute.js";import{resolveHtmlHref as v}from"./resolve-html-href.js";import{resolveImageSrc as f}from"./resolve-image-src.js";import{resolveImageSrcSet as S}from"./resolve-image-src-set.js";import{resolveImageGallery as c}from"./resolve-image-gallery.js";import{resolveNavLinks as d}from"./resolve-nav-links.js";import{resolveRelativeOrCdnIcon as g}from"./resolve-relative-or-cdn-icon.js";import{resolveCodeWalkthroughFilesets as h}from"./code-walkthrough/filesets-resolver.js";import{resolveJsonExampleRef as R}from"./resolve-json-example-ref.js";import{resolveSampleFromJsonSchema as C}from"./resolve-sample-from-json-schema.js";import{resolveOpenapiCodeSamples as F}from"./resolve-openapi-code-samples.js";import{resolveOpenapiResponseSamples as k}from"./resolve-openapi-response-samples.js";const B={openapiRef:e,jsonSchemaRef:o,parsedYaml:r,rawContent:m,svgContent:t,relativePath:i,link:l,nativeMdLink:p,codeSnippetFile:s,diagramFile:a,htmlSourceAttribute:n,htmlHref:v,imageSrc:f,imageSrcSet:S,imageGallery:c,navLinks:d,relativeOrCdnIcon:g,codeWalkthroughFilesets:h,jsonExampleRef:R,sampleFromJsonSchema:C,openapiCodeSamples:F,openapiResponseSamples:k};export{B as attributeResolvers};
@@ -0,0 +1,4 @@
1
+ import type { Node } from '@markdoc/markdoc';
2
+ import type { MarkdocResolveContext } from '../../../types';
3
+ export declare function resolveOpenapiCodeSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
4
+ //# sourceMappingURL=resolve-openapi-code-samples.d.ts.map
@@ -0,0 +1 @@
1
+ import{normalizeOptions as y}from"@redocly/openapi-docs";import{buildCodeSamples as f}from"@redocly/openapi-docs/lib/services/code-samples/build-code-samples.js";import{getOperation as v}from"../../../../markdoc/helpers/get-operation/index.js";import{setNodeAttributeValue as O}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{getMediaContentSamples as S}from"./helpers/get-media-content-samples.js";import{loadOpenapiBundle as b}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as a}from"./utils.js";const h={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"},C=(e,n)=>typeof n=="string"?n:String(e??"");async function K(e,n,w,{context:u}){const o=await b(e,u);if(!o)return;const m=a(e,"language"),r={exampleKey:a(e,"exampleKey"),mimeType:a(e,"mimeType"),parameters:a(e,"parameters"),requestBody:a(e,"requestBody"),environments:a(e,"environments"),environment:a(e,"environment")},c=m?{...o.rawOptions,codeSamples:{...o.rawOptions.codeSamples,languages:[{lang:m}]}}:o.rawOptions,i=y(c),s=v({definition:o.definition,options:c},{operationId:a(e,"operationId"),pointer:a(e,"pointer")},i,r);if(!s)return;const p=f(s,i,o.definition,r,C).map(t=>({lang:h[t.lang]??t.lang.toLowerCase(),title:t.label??t.lang,source:t.source})),g=i.codeSamples.languages??[],l=g.find(({lang:t})=>t==="Payload");if(l){const t=S(s.payload?.requestBodyContent,r.exampleKey,l.label??"Payload"),d=g.indexOf(l);p.splice(d,0,...t)}p.length&&O(e,n,p)}export{K as resolveOpenapiCodeSamples};
@@ -0,0 +1,4 @@
1
+ import type { Node } from '@markdoc/markdoc';
2
+ import type { MarkdocResolveContext } from '../../../types';
3
+ export declare function resolveOpenapiResponseSamples(node: Node, attrName: string, _relativePath: string, { context }: MarkdocResolveContext): Promise<void>;
4
+ //# sourceMappingURL=resolve-openapi-response-samples.d.ts.map
@@ -0,0 +1 @@
1
+ import{normalizeOptions as s}from"@redocly/openapi-docs";import{getOperation as l}from"../../../../markdoc/helpers/get-operation/index.js";import{setNodeAttributeValue as f}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{getMediaContentSamples as c}from"./helpers/get-media-content-samples.js";import{loadOpenapiBundle as u}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as o}from"./utils.js";async function h(t,a,O,{context:m}){const e=await u(t,m);if(!e)return;const i=o(t,"exampleKey"),n=l({definition:e.definition,options:e.rawOptions},{operationId:o(t,"operationId"),pointer:o(t,"pointer")},s(e.rawOptions),{exampleKey:i});if(!n)return;const r=(n.responses??[]).flatMap(p=>c(p.content,i,`${p.code}`));r.length&&f(t,a,r)}export{h as resolveOpenapiResponseSamples};
@@ -1,2 +1,4 @@
1
+ import type { Node, Tag } from '@markdoc/markdoc';
1
2
  export declare function getLinkOriginalAttrName(attributeName: string): `redocly:::linkOriginal:${string}`;
3
+ export declare function getOptionalAttribute<T>(node: Node | Tag, attrName: string): T | undefined;
2
4
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- import{LINK_ORIGINAL_ATTR_NAME as t}from"../../../constants/common.js";function n(r){return`${t}:${r}`}export{n as getLinkOriginalAttrName};
1
+ import{LINK_ORIGINAL_ATTR_NAME as e}from"../../../constants/common.js";import{getNodeAttribute as i}from"../../../../markdoc/helpers/get-node-attribute.js";function u(t){return`${e}:${t}`}function A(t,r){return i(t,r)??void 0}export{u as getLinkOriginalAttrName,A as getOptionalAttribute};
@@ -1 +1 @@
1
- import M from"@markdoc/markdoc";import*as S from"path";import{GATED_MARKDOC_TAGS as O}from"../../constants/entitlements.js";import{logger as F}from"../../tools/notifiers/logger.js";import{reporter as N}from"../../tools/notifiers/reporter.js";import{sha1 as G}from"../../utils/crypto/sha1.js";import{formatMarkdocError as H}from"./errors.js";import{extractFirstHeading as j,visit as K}from"./markdoc/plugins/utils.js";import{attributeResolvers as y}from"./attribute-resolvers/index.js";import{MdResolveError as $}from"./attribute-resolvers/md-resolve-error.js";import{processHtmlTokens as U}from"./html/process-html-tokens.js";import{resolveRawPartials as W}from"./markdoc/resolve-raw-partials.js";import{EntitlementsProvider as Y}from"../../entitlements/entitlements-provider.js";import{MARKDOC_PARTIALS_DEPS_KEY as B}from"../../store.js";import{getLinkOriginalAttrName as V}from"./attribute-resolvers/utils.js";const q="EMPTY";async function C(a,s,e){const n=Y.instance(),{actions:m}=e,{relativePath:i,resolveErrors:E}=a,k=new Set,g=new Set,b=new Set,c=new Set,u={},f=new Set,w={},_={};function R(t,P){const D=P||q;t[D]=(t[D]||0)+1}const A=[];return a.resolveErrors.length=0,K(a.ast,t=>{const P=D();A.push(P.then(r=>{r?.sharedDataIds&&r.sharedDataIds.forEach(d=>k.add(d))}).catch(z));async function D(){const r=[];switch(t.type){case"fence":R(w,t.attributes.language);break;case"link":case"image":await y.nativeMdLink(t,t.type==="link"?"href":"src",i,e);break;case"tag":if(!t.tag)break;const d=s?.tags?.[t.tag];if(!d){O[t.tag]&&!n.canAccessFeature(O[t.tag])&&(t.errors.push({level:"warning",id:"invalid-tag",message:`Undefined tag: ${t.tag}`}),t.tag="",t.type="error",t.attributes={});break}const v=t.tag==="html"?t.attributes.name:t.tag;if((t.tag==="html"?f:c).add(v),u[v]=(u[v]||0)+1,v==="code-snippet"&&R(w,t.attributes.language),d.attributes?.__idx&&(t.attributes.__idx=u[t.tag]),d.dynamicComponentLib&&g.add(d.dynamicComponentLib),!d.attributes)break;if(v==="partial"&&t.attributes?.file){const o=V("file"),l=t[o]||t.attributes.file,h=l.startsWith("/")?l.slice(1):S.posix.normalize(S.posix.join(S.posix.dirname(i),l));b.add(h);const p=(m.getGlobalConfig(B)||{})[h];if(p?.dynamicComponents)for(const L of p.dynamicComponents)g.add(L);if(p?.sharedDataDeps)for(const L of p.sharedDataDeps)k.add(L)}for(const[o,l]of Object.entries(d.attributes)){const h=l.type;if(h&&(h.resolver||l.resolver)){const T=y[h.resolver||l.resolver],p=await T?.(t,o,i,e);p?.sharedDataId&&r.push(p.sharedDataId)}}if(v==="code-walkthrough")for(const o of t.attributes.resolvedFilesets||[])for(const l of o.files||[])R(_,l.language);const I=t.attributes?.attrs;if(I&&t.tag==="html")for(const o of Object.keys(I))o==="src"||o==="srcSet"?await y.htmlSourceAttribute(t,o,i,e):o==="href"&&await y.htmlHref(t,o,i,e);break}return{sharedDataIds:r}}async function z(r){if(!(r instanceof $)){await N.panicOnBuild(r.message);return}E.push(H({type:"resolve_link",meta:{...r.meta,link:r.meta.link??r.meta.rawLink},lines:t.lines,location:t.location,error:{id:"",level:"error",message:r.message,location:t.location}},a.relativePath,a.rawContent))}}),await Promise.all(A),a.sharedDataDeps=k,a.dynamicMarkdocComponents=g,a.validatedAtRevision<m.buildRevision&&(a.markdocErrors=M.validate(a.ast,s).map(t=>H(t,i,a.rawContent)),a.validatedAtRevision=m.buildRevision),{sharedDataDeps:a.sharedDataDeps,dynamicMarkdocComponents:Array.from(a.dynamicMarkdocComponents?.values()??[]),partials:Array.from(b),tagList:Array.from(c),htmlTagsList:Array.from(f),tagOccurrence:u,codeSnippetLanguages:w,codeWalkthroughLanguages:_}}const x=new M.Tokenizer({html:!0,allowIndentation:!0,allowComments:!0});x.parser.block.ruler.getRules("reference").length=0;function J(a,s){const e=x.tokenize(s),n=U(e);return{ast:M.parse(n,{file:a,slots:!0}),rawContent:s,resolveErrors:[],markdocErrors:[],relativePath:a,sharedDataDeps:void 0,validatedAtRevision:-1}}async function dt(a,s){const{data:e}=await s.cache.load(a,"markdown-ast");return j(e.ast)}async function gt(a,s){N.clearMarkdocProblems();const e=a.getAllRoutes();let n=0;const m=F.isInteractive();for(const i of e)await a.resolveRouteStaticData(i,s,!0),n++,m&&n%100===0&&F.logInFooter("validate",` \u{1F50D} Status: validating markdoc (${n}/${e.length})`)}async function ut(a,s,e,n){const m=a.content?G(a.content):"";return await e.context.cache.load(n||a.relativePath,{loader:E,name:"markdown-inline-parser"},[m,String(e.actions.buildRevision)]);async function E(k,g,b){let c;if(a.content){const f=await g.getConfig(),w=await W(a.content,a.relativePath,f.markdown?.partialsFolders,g);c=J(a.relativePath,w)}else c=(await g.cache.load(a.relativePath,"markdown-ast")).data;let u={};if(e.actions.buildRevision!==0&&(u=await C(c,s,e)),!a.isVirtual){for(const f of c.markdocErrors)b(f);for(const f of c.resolveErrors)b(f)}return{ast:c.ast,info:u}}}export{dt as extractMdFirstHeading,J as getAst,ut as parseAndResolveMarkdoc,C as resolveAndValidateMarkdoc,gt as validateAllMarkdowns};
1
+ import M from"@markdoc/markdoc";import*as S from"path";import{GATED_MARKDOC_TAGS as O}from"../../constants/entitlements.js";import{logger as F}from"../../tools/notifiers/logger.js";import{reporter as N}from"../../tools/notifiers/reporter.js";import{sha1 as G}from"../../utils/crypto/sha1.js";import{formatMarkdocError as H}from"./errors.js";import{extractFirstHeading as j,visit as K}from"./markdoc/plugins/utils.js";import{attributeResolvers as y}from"./attribute-resolvers/index.js";import{MdResolveError as $}from"./attribute-resolvers/md-resolve-error.js";import{processHtmlTokens as U}from"./html/process-html-tokens.js";import{resolveRawPartials as W}from"./markdoc/resolve-raw-partials.js";import{EntitlementsProvider as Y}from"../../entitlements/entitlements-provider.js";import{MARKDOC_PARTIALS_DEPS_KEY as B}from"../../constants/common.js";import{getLinkOriginalAttrName as V}from"./attribute-resolvers/utils.js";const q="EMPTY";async function C(a,s,e){const n=Y.instance(),{actions:m}=e,{relativePath:i,resolveErrors:E}=a,k=new Set,g=new Set,b=new Set,c=new Set,u={},f=new Set,w={},_={};function R(t,P){const D=P||q;t[D]=(t[D]||0)+1}const A=[];return a.resolveErrors.length=0,K(a.ast,t=>{const P=D();A.push(P.then(r=>{r?.sharedDataIds&&r.sharedDataIds.forEach(d=>k.add(d))}).catch(z));async function D(){const r=[];switch(t.type){case"fence":R(w,t.attributes.language);break;case"link":case"image":await y.nativeMdLink(t,t.type==="link"?"href":"src",i,e);break;case"tag":if(!t.tag)break;const d=s?.tags?.[t.tag];if(!d){O[t.tag]&&!n.canAccessFeature(O[t.tag])&&(t.errors.push({level:"warning",id:"invalid-tag",message:`Undefined tag: ${t.tag}`}),t.tag="",t.type="error",t.attributes={});break}const v=t.tag==="html"?t.attributes.name:t.tag;if((t.tag==="html"?f:c).add(v),u[v]=(u[v]||0)+1,v==="code-snippet"&&R(w,t.attributes.language),d.attributes?.__idx&&(t.attributes.__idx=u[t.tag]),d.dynamicComponentLib&&g.add(d.dynamicComponentLib),!d.attributes)break;if(v==="partial"&&t.attributes?.file){const o=V("file"),l=t[o]||t.attributes.file,h=l.startsWith("/")?l.slice(1):S.posix.normalize(S.posix.join(S.posix.dirname(i),l));b.add(h);const p=(m.getGlobalConfig(B)||{})[h];if(p?.dynamicComponents)for(const L of p.dynamicComponents)g.add(L);if(p?.sharedDataDeps)for(const L of p.sharedDataDeps)k.add(L)}for(const[o,l]of Object.entries(d.attributes)){const h=l.type;if(h&&(h.resolver||l.resolver)){const T=y[h.resolver||l.resolver],p=await T?.(t,o,i,e);p?.sharedDataId&&r.push(p.sharedDataId)}}if(v==="code-walkthrough")for(const o of t.attributes.resolvedFilesets||[])for(const l of o.files||[])R(_,l.language);const I=t.attributes?.attrs;if(I&&t.tag==="html")for(const o of Object.keys(I))o==="src"||o==="srcSet"?await y.htmlSourceAttribute(t,o,i,e):o==="href"&&await y.htmlHref(t,o,i,e);break}return{sharedDataIds:r}}async function z(r){if(!(r instanceof $)){await N.panicOnBuild(r.message);return}E.push(H({type:"resolve_link",meta:{...r.meta,link:r.meta.link??r.meta.rawLink},lines:t.lines,location:t.location,error:{id:"",level:"error",message:r.message,location:t.location}},a.relativePath,a.rawContent))}}),await Promise.all(A),a.sharedDataDeps=k,a.dynamicMarkdocComponents=g,a.validatedAtRevision<m.buildRevision&&(a.markdocErrors=M.validate(a.ast,s).map(t=>H(t,i,a.rawContent)),a.validatedAtRevision=m.buildRevision),{sharedDataDeps:a.sharedDataDeps,dynamicMarkdocComponents:Array.from(a.dynamicMarkdocComponents?.values()??[]),partials:Array.from(b),tagList:Array.from(c),htmlTagsList:Array.from(f),tagOccurrence:u,codeSnippetLanguages:w,codeWalkthroughLanguages:_}}const x=new M.Tokenizer({html:!0,allowIndentation:!0,allowComments:!0});x.parser.block.ruler.getRules("reference").length=0;function J(a,s){const e=x.tokenize(s),n=U(e);return{ast:M.parse(n,{file:a,slots:!0}),rawContent:s,resolveErrors:[],markdocErrors:[],relativePath:a,sharedDataDeps:void 0,validatedAtRevision:-1}}async function dt(a,s){const{data:e}=await s.cache.load(a,"markdown-ast");return j(e.ast)}async function gt(a,s){N.clearMarkdocProblems();const e=a.getAllRoutes();let n=0;const m=F.isInteractive();for(const i of e)await a.resolveRouteStaticData(i,s,!0),n++,m&&n%100===0&&F.logInFooter("validate",` \u{1F50D} Status: validating markdoc (${n}/${e.length})`)}async function ut(a,s,e,n){const m=a.content?G(a.content):"";return await e.context.cache.load(n||a.relativePath,{loader:E,name:"markdown-inline-parser"},[m,String(e.actions.buildRevision)]);async function E(k,g,b){let c;if(a.content){const f=await g.getConfig(),w=await W(a.content,a.relativePath,f.markdown?.partialsFolders,g);c=J(a.relativePath,w)}else c=(await g.cache.load(a.relativePath,"markdown-ast")).data;let u={};if(e.actions.buildRevision!==0&&(u=await C(c,s,e)),!a.isVirtual){for(const f of c.markdocErrors)b(f);for(const f of c.resolveErrors)b(f)}return{ast:c.ast,info:u}}}export{dt as extractMdFirstHeading,J as getAst,ut as parseAndResolveMarkdoc,C as resolveAndValidateMarkdoc,gt as validateAllMarkdowns};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../store.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function le(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},F=await _(a,"markdown-frontmatter",r,t),p=L(F,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const f=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});f&&(u=e.createTemplate(f.templateRef,f.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),await Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(v=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:v,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([l,{type:c}])=>({type:c||301,from:l})),[y]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(l,c){return E(o,l,t,r,c)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{le as markdownPlugin};
1
+ import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../constants/common.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function le(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},F=await _(a,"markdown-frontmatter",r,t),p=L(F,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const f=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});f&&(u=e.createTemplate(f.templateRef,f.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),await Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(v=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:v,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([l,{type:c}])=>({type:c||301,from:l})),[y]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(l,c){return E(o,l,t,r,c)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{le as markdownPlugin};
@@ -1 +1 @@
1
- import*as f from"path";import{MARKDOC_PARTIALS_DATA_KEY as D,MARKDOC_PARTIALS_DEPS_KEY as A}from"../../../store.js";import{isPartial as y}from"../is-partial.js";function h(t,s){return Promise.all(t.map(s)).then(i=>t.filter((o,n)=>i[n]))}async function b(t,s){const{markdown:i}=await t.getConfig(),o=i?.partialsFolders??[],n=await h(t.fs.scan(/\.md$/),async a=>!(!f.posix.basename(a.relativePath).endsWith(".md")||await t.isPathIgnored(a.relativePath)||!y(a.relativePath,o)));s.setGlobalConfig({[D]:Object.fromEntries(n.map(a=>[a.relativePath,{}]))});const p={},m={};for(const a of n){const{ast:e,info:r}=await s.parseMarkdoc({input:a,context:t});p[a.relativePath]=e;const l=Array.isArray(r.dynamicMarkdocComponents)?r.dynamicMarkdocComponents:[],c=r.sharedDataDeps instanceof Set?Array.from(r.sharedDataDeps):Array.isArray(r.sharedDataDeps)?r.sharedDataDeps:[],d=Array.isArray(r.partials)?r.partials:[];m[a.relativePath]={dynamicComponents:new Set(l),sharedDataDeps:new Set(c),partials:new Set(d)}}return s.setGlobalConfig({[A]:Object.fromEntries(Object.entries(m).map(([a,e])=>[a,{dynamicComponents:Array.from(e.dynamicComponents),sharedDataDeps:Array.from(e.sharedDataDeps),partials:Array.from(e.partials)}]))}),p}export{b as prepareMarkdocPartials};
1
+ import*as f from"path";import{MARKDOC_PARTIALS_DATA_KEY as D,MARKDOC_PARTIALS_DEPS_KEY as A}from"../../../constants/common.js";import{isPartial as y}from"../is-partial.js";function h(t,s){return Promise.all(t.map(s)).then(i=>t.filter((o,n)=>i[n]))}async function b(t,s){const{markdown:i}=await t.getConfig(),o=i?.partialsFolders??[],n=await h(t.fs.scan(/\.md$/),async a=>!(!f.posix.basename(a.relativePath).endsWith(".md")||await t.isPathIgnored(a.relativePath)||!y(a.relativePath,o)));s.setGlobalConfig({[D]:Object.fromEntries(n.map(a=>[a.relativePath,{}]))});const p={},m={};for(const a of n){const{ast:e,info:r}=await s.parseMarkdoc({input:a,context:t});p[a.relativePath]=e;const l=Array.isArray(r.dynamicMarkdocComponents)?r.dynamicMarkdocComponents:[],c=r.sharedDataDeps instanceof Set?Array.from(r.sharedDataDeps):Array.isArray(r.sharedDataDeps)?r.sharedDataDeps:[],d=Array.isArray(r.partials)?r.partials:[];m[a.relativePath]={dynamicComponents:new Set(l),sharedDataDeps:new Set(c),partials:new Set(d)}}return s.setGlobalConfig({[A]:Object.fromEntries(Object.entries(m).map(([a,e])=>[a,{dynamicComponents:Array.from(e.dynamicComponents),sharedDataDeps:Array.from(e.sharedDataDeps),partials:Array.from(e.partials)}]))}),p}export{b as prepareMarkdocPartials};
@@ -1,4 +1,4 @@
1
- import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as E,AI_SEARCH_DOCUMENT_CHUNK_SIZE as M}from"../../../constants/plugins/search.js";import{slugger as P}from"../../../../utils/slugger.js";import{joinSectionContent as U}from"./join-section-content.js";import{toMarkdown as b}from"./to-markdown.js";import{AstToSearchNodeTransformer as I}from"./walk-sections.js";import{createRenderTagFn as x}from"./create-render-tag-fn.js";import{getLocaleFromRelativePath as y}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as L}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as H}from"./search-facets.js";import{formatDocumentMetadata as K}from"../../search/utils.js";import{TagNode as N}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as R}from"../../../store.js";const j=Symbol(),et=(n,r)=>async(e,c,i,s)=>{if(r?.excludeFromSearch)return;P.reset();const a=await e.getNavText?.()||D.basename(e.fsPath),u=_.Ast.fromJSON(c.ast),f=new I({partials:s.getGlobalConfig(R)||{},renderTag:x(s.markdocOptions.tags),getInnerContent:b,ast:u,skipConditionals:!0}),d=Array.from(f.transform());return{async getLLMsTxts(){const o=r?.seo,g=o&&typeof o=="object"&&"description"in o?String(o.description):void 0,C=U(d);return[{title:a,description:g,slug:e.slug,fsPath:e.fsPath,content:C,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,d,n,a)}}};function F(n,r,e,c){const i=n.slug,s=new Map,a=n.metadata||{},u=H(a,e),f=K(a),d=f?`Metadata:
1
+ import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as E,AI_SEARCH_DOCUMENT_CHUNK_SIZE as M}from"../../../constants/plugins/search.js";import{slugger as P}from"../../../../utils/slugger.js";import{joinSectionContent as U}from"./join-section-content.js";import{toMarkdown as b}from"./to-markdown.js";import{AstToSearchNodeTransformer as I}from"./walk-sections.js";import{createRenderTagFn as x}from"./create-render-tag-fn.js";import{getLocaleFromRelativePath as y}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as L}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as H}from"./search-facets.js";import{formatDocumentMetadata as K}from"../../search/utils.js";import{TagNode as N}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as R}from"../../../constants/common.js";const j=Symbol(),et=(n,r)=>async(e,c,i,s)=>{if(r?.excludeFromSearch)return;P.reset();const a=await e.getNavText?.()||D.basename(e.fsPath),u=_.Ast.fromJSON(c.ast),f=new I({partials:s.getGlobalConfig(R)||{},renderTag:x(s.markdocOptions.tags),getInnerContent:b,ast:u,skipConditionals:!0}),d=Array.from(f.transform());return{async getLLMsTxts(){const o=r?.seo,g=o&&typeof o=="object"&&"description"in o?String(o.description):void 0,C=U(d);return[{title:a,description:g,slug:e.slug,fsPath:e.fsPath,content:C,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,d,n,a)}}};function F(n,r,e,c){const i=n.slug,s=new Map,a=n.metadata||{},u=H(a,e),f=K(a),d=f?`Metadata:
2
2
  ${f}
3
3
  `:"";let o=[];for(const t of r)if(t instanceof L){o.splice(t.attributes.level-1,6);const l=t.attributes.level>2,m=o[o.length-1]?.title,S=o[o.length-1]?.url,T=l&&m?m:O(c,t),A=l&&S?S:t.getUrl(i),h={title:T,content:"",url:A,level:t.attributes.level,toc:o.map(v=>p(v.section)).join(`
4
4
  `)};(t.attributes.level>1||p(t)!==c)&&(h.content+=h.content?`
@@ -1 +1 @@
1
- import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as h}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as T}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../store.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new R({ast:i,getInnerContent:h,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=C(u,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return T(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
1
+ import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as h}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as T}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../constants/common.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new R({ast:i,getInnerContent:h,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=C(u,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return T(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
@@ -13,6 +13,17 @@ export declare const getScorecardConfig: (config: Partial<RedoclyConfig>) => {
13
13
  [x: string]: unknown;
14
14
  };
15
15
  } | undefined;
16
+ arazzo1_1Decorators?: {
17
+ [x: string]: unknown;
18
+ } | undefined;
19
+ arazzo1_1Preprocessors?: {
20
+ [x: string]: unknown;
21
+ } | undefined;
22
+ arazzo1_1Rules?: {
23
+ [x: string]: string | {
24
+ [x: string]: unknown;
25
+ };
26
+ } | undefined;
16
27
  async2Decorators?: {
17
28
  [x: string]: unknown;
18
29
  } | undefined;
@@ -1 +1 @@
1
- import{appendFile as g}from"node:fs/promises";import{existsSync as I}from"node:fs";import m from"node:path";import{Client as $}from"typesense";import{SEARCH_GROUP_FACET_FIELD as E,SEARCH_PRODUCT_FIELD as R,SEARCH_RBAC_FIELD as A,SEARCH_VERSION_FIELD as f}from"../../../../../constants/common.js";import{BASE_SEARCH_DOCUMENT as T,DISABLE_DEEP_LINK_IF_FIELDS_EXIST as O,HIGHLIGHTED_TEXT_MAX_LENGTH as b,SEARCH_DATA_EXPORT_FOLDER as F,SEARCH_DOCUMENT_METADATA_KEY as P,SEARCH_GROUP_LIMIT as N,SEARCH_MAX_FACET_VALUES as S,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as C}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as D}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as p}from"../../../../config/env-config.js";import{ensureDir as d}from"../../../../utils/index.js";class U{#e=null;#o="";#t=[{name:"title",type:"string",facet:!1,optional:!0},{name:"text",type:"string",facet:!1,optional:!0},{name:"path",type:"string[]",facet:!1,optional:!0},{name:"isAdditionalOperation",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"parameters",type:"object[]",facet:!1,optional:!0},{name:R,type:"string",facet:!0,optional:!0},{name:f,type:"object",facet:!0,optional:!0},{name:A,type:"string[]",facet:!0},{name:"metadata_curated",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"metadata_keywords_excludes",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:"metadata_keywords_includes",type:"string[]",facet:!1,optional:!0,queryable:!1}];#s=new Map;#n={ORGANIZATION_ID:p.ORGANIZATION_ID??"",PROJECT_ID:p.PROJECT_ID??"",TYPESENSE_API_URL:p.TYPESENSE_API_URL??"",TYPESENSE_API_KEY:p.TYPESENSE_API_KEY??""};constructor(){if(!p.isBuildMode){for(const[e,t]of Object.entries(this.#n))if(!t)throw new Error(`Cannot initialize search index. ${e} is not set`);this.#o=`${this.#n.ORGANIZATION_ID}_${this.#n.PROJECT_ID}_`,this.#e=new $({nodes:[{url:this.#n.TYPESENSE_API_URL}],apiKey:this.#n.TYPESENSE_API_KEY,connectionTimeoutSeconds:5})}}async initIndexSchema(e){this.#p(e)}async addDocuments(e,t){e.push(T);const{locale:n,outDir:r}=t,s=e.map(a=>{const o={...a},c=a[P];return c&&(c.curated&&(o.metadata_curated=c.curated),c.excludes&&(o.metadata_keywords_excludes=c.excludes),c.includes&&(o.metadata_keywords_includes=c.includes)),o}),i=this.#s.get(n)??[];this.#s.set(n,i.concat(s)),i.length+e.length>=C&&await this.exportDocuments(r)}async search(e,t){return await D("search",async n=>{const{query:r,locale:s,filter:i,loadMore:a}=e,o=this.#c(s),c={collection:o,q:r||"*",query_by:this.#l(),max_facet_values:S};if(n?.setAttribute("collectionName",o),n?.setAttribute("locale",s),this.#e)if(a){const{groupKey:l,offset:u}=a,h={offset:u,filter_by:this.#r(t,i),facet_by:"*"};return n?.setAttribute("isLoadMore",!0),n?.setAttribute("filter",h.filter_by),this.#u(await this.#e.collections(o).documents().search({...c,...h}),l)}else{const l={group_by:this.#m(),group_limit:N,filter_by:this.#r(t,i)};n?.setAttribute("groups",l.group_by),n?.setAttribute("filter",l.filter_by);const u=[l,...this.#y(t,i)];return this.#f(await this.#e?.multiSearch.perform({searches:u},c),i)}else return{facets:{},documents:{}}})}#u(e,t){const n={facets:{},documents:{[t]:[]}};if(e.hits&&e.hits.length)for(const r of e.hits)n.documents[t].push({document:this.#i(r),highlight:this.#a(r)});return n}#f(e,t){const n={facets:{},documents:{}};for(const r of this.#_(t))n.documents[r]=[];if("results"in e)for(const r of e.results){if(r.facet_counts&&r.facet_counts.length)for(const s of r.facet_counts)n.facets[s.field_name]=s.counts.map(i=>({value:i.value,count:i.count}));if(r.grouped_hits&&r.grouped_hits.length)for(const s of r.grouped_hits){const i=s.group_key[0],a=[];for(const o of s.hits)a.push({document:this.#i(o),highlight:this.#a(o)});n.documents[i]=a}}return n}#i(e){return this.#h(e)}#a(e){const t={},n=[];for(const[r,s]of Object.entries(e.highlight??{}))if(Array.isArray(s)){if(r==="path"){const i=s,a=[];for(const o of i)a.push(o.snippet);t.path=a}else if(r==="parameters"){const i=s;for(const a of i){let o=!1;for(const[c,l]of Object.entries(a))if(c!=="deepLink")if(Array.isArray(l))for(const u of l)u.matched_tokens?.length&&(o=!0);else l.matched_tokens?.length&&(o=!0);if(o){const c={name:a.name?.snippet||"",description:a.description?.snippet||"",place:a.place?.snippet||"",path:a.path?.map(l=>l?.snippet)||[]};t.parameters=[c];break}}}}else t[r]=s.snippet,n.push(r);for(const[r,s]of Object.entries(e.document))!n.includes(r)&&typeof s=="string"&&(t[r]=s.length>b?`${s.substring(0,b)}...`:s);return t.parameters||(t.parameters=[]),t}#h(e){let t;const n=Object.keys(e.highlight);for(const s of O)if(n.some(i=>i===s))return e.document;const r=e.highlight.parameters;if(r){for(const s of r)for(const[i,a]of Object.entries(s))if(i!=="deepLink"){if(Array.isArray(a)){for(const o of a)if(o.matched_tokens?.length){t=s.deepLink.snippet;break}}else if(a.matched_tokens?.length){t=s.deepLink.snippet;break}}}if(t){const s=t.split("#")[1];return{...e.document,url:`${e.document.url}#${s}`}}return e.document}async exportDocuments(e){const t='{"documents":[',n=d(m.join(e,F));for(const[r,s]of this.#s){if(s.length===0)continue;const i=d(m.join(n,`${r}.json`)),a=!I(i),o=JSON.stringify(s).substring(1).slice(0,-1),c=a?t+o:","+o;await g(i,c,{encoding:"utf8"}),this.#s.set(r,[])}}async exportIndexes(e){const t=d(m.join(e,F));for(const n of this.#s.keys()){const r=d(m.join(t,`${n}.json`)),s=`],"schemaFields":${JSON.stringify(this.#t)}}`;await g(r,s,{encoding:"utf8"})}}async import(e){}async countFacets(e,t){return await D("search.facets",async n=>{const{locale:r,query:s,facetQuery:i,filter:a,field:o}=e,c=this.#c(r),l={q:s||"*",query_by:this.#l(),facet_by:"*",facet_query:this.#d(i,o),filter_by:this.#r(t,a,o),max_facet_values:S};if(n?.setAttribute("collectionName",c),n?.setAttribute("query",l.q),n?.setAttribute("facetQuery",l.facet_query),n?.setAttribute("filter",l.filter_by),this.#e){const u={},h=await this.#e.collections(c).documents().search(l);if(h.facet_counts&&h.facet_counts.length)for(const _ of h.facet_counts)u[_.field_name]=_.counts.map(y=>({value:y.value,count:y.count,isCounterVisible:!!s||(a?.length||0)>0}));return u}else return{}})}#c(e){return`${this.#o}${e}`}#p(e){for(const[t,{queryable:n}]of e)this.#t.find(r=>r.name===t)||this.#t.push({queryable:n,name:t,type:"string",facet:!0,optional:!0})}#l(){return this.#t.filter(e=>e.facet?e.queryable:e.queryable!==!1).map(e=>e.name).join(",")}#m(){return this.#t.filter(e=>e.facet&&e.name===E).map(e=>e.name).join(",")}#r(e,t,n){const r=`${A}:[${e.teams.map(i=>`'${i}'`).join(", ")}]`;let s=`${f}.isDefault:true`;if(t&&t.length){const i=t.filter(o=>o.field!==n&&o.field!==f).map(o=>{const c=o.values.map(l=>`'${l}'`);return c.length?`${o.field}:[${c.join(", ")}]`:""}).join(" && "),a=t.find(o=>o.field===f);if(a&&a.values.length&&a.values.length===2){const o=a.values[0],c=a.values[1],l=`(${f}.folderId:! ${o} && ${f}.isDefault:true)`,u=`(${f}.folderId:${o} && ${f}.version:${c})`;s=`(${l} || ${u})`}return i?`${r} && ${i} && ${s}`:`${r} && ${s}`}else return`${r} && ${s}`}#d(e,t){return e&&t?`${t}:${e}`:""}#_(e){const t=[];if(e&&e.length)for(const n of e)n.field===E&&t.push(...n.values);return t}#y(e,t){const n=[],r=this.#t.filter(s=>s.facet);for(const s of r){const i={facet_by:s.name,filter_by:this.#r(e,t,s.name)};n.push(i)}return n}cleanupFacetValues(e){const t=e.getSearchFacets();t.forEach(n=>{n.values=[]}),e.setSearchFacets(t)}}export{U as Typesense};
1
+ import{appendFile as g}from"node:fs/promises";import{existsSync as I}from"node:fs";import m from"node:path";import{Client as $}from"typesense";import{SEARCH_GROUP_FACET_FIELD as E,SEARCH_PRODUCT_FIELD as R,SEARCH_RBAC_FIELD as A,SEARCH_VERSION_FIELD as f}from"../../../../../constants/common.js";import{BASE_SEARCH_DOCUMENT as T,DISABLE_DEEP_LINK_IF_FIELDS_EXIST as O,HIGHLIGHTED_TEXT_MAX_LENGTH as b,SEARCH_DATA_EXPORT_FOLDER as F,SEARCH_DOCUMENT_METADATA_KEY as P,SEARCH_GROUP_LIMIT as N,SEARCH_MAX_FACET_VALUES as S,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as C}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as D}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as p}from"../../../../config/env-config.js";import{ensureDir as d}from"../../../../utils/index.js";class U{#e=null;#r="";#t=[{name:"title",type:"string",facet:!1,optional:!0},{name:"text",type:"string",facet:!1,optional:!0},{name:"path",type:"string[]",facet:!1,optional:!0},{name:"isAdditionalOperation",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"deprecated",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"parameters",type:"object[]",facet:!1,optional:!0},{name:R,type:"string",facet:!0,optional:!0},{name:f,type:"object",facet:!0,optional:!0},{name:A,type:"string[]",facet:!0},{name:"metadata_curated",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"metadata_keywords_excludes",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:"metadata_keywords_includes",type:"string[]",facet:!1,optional:!0,queryable:!1}];#s=new Map;#n={ORGANIZATION_ID:p.ORGANIZATION_ID??"",PROJECT_ID:p.PROJECT_ID??"",TYPESENSE_API_URL:p.TYPESENSE_API_URL??"",TYPESENSE_API_KEY:p.TYPESENSE_API_KEY??""};constructor(){if(!p.isBuildMode){for(const[e,t]of Object.entries(this.#n))if(!t)throw new Error(`Cannot initialize search index. ${e} is not set`);this.#r=`${this.#n.ORGANIZATION_ID}_${this.#n.PROJECT_ID}_`,this.#e=new $({nodes:[{url:this.#n.TYPESENSE_API_URL}],apiKey:this.#n.TYPESENSE_API_KEY,connectionTimeoutSeconds:5})}}async initIndexSchema(e){this.#p(e)}async addDocuments(e,t){e.push(T);const{locale:n,outDir:o}=t,s=e.map(i=>{const r={...i},c=i[P];return c&&(c.curated&&(r.metadata_curated=c.curated),c.excludes&&(r.metadata_keywords_excludes=c.excludes),c.includes&&(r.metadata_keywords_includes=c.includes)),r}),a=this.#s.get(n)??[];this.#s.set(n,a.concat(s)),a.length+e.length>=C&&await this.exportDocuments(o)}async search(e,t){return await D("search",async n=>{const{query:o,locale:s,filter:a,loadMore:i}=e,r=this.#c(s),c={collection:r,q:o||"*",query_by:this.#l(),max_facet_values:S};if(n?.setAttribute("collectionName",r),n?.setAttribute("locale",s),this.#e)if(i){const{groupKey:l,offset:u}=i,h={offset:u,filter_by:this.#o(t,a),facet_by:"*"};return n?.setAttribute("isLoadMore",!0),n?.setAttribute("filter",h.filter_by),this.#u(await this.#e.collections(r).documents().search({...c,...h}),l)}else{const l={group_by:this.#m(),group_limit:N,filter_by:this.#o(t,a)};n?.setAttribute("groups",l.group_by),n?.setAttribute("filter",l.filter_by);const u=[l,...this.#y(t,a)];return this.#f(await this.#e?.multiSearch.perform({searches:u},c),a)}else return{facets:{},documents:{}}})}#u(e,t){const n={facets:{},documents:{[t]:[]}};if(e.hits&&e.hits.length)for(const o of e.hits)n.documents[t].push({document:this.#a(o),highlight:this.#i(o)});return n}#f(e,t){const n={facets:{},documents:{}};for(const o of this.#_(t))n.documents[o]=[];if("results"in e)for(const o of e.results){if(o.facet_counts&&o.facet_counts.length)for(const s of o.facet_counts)n.facets[s.field_name]=s.counts.map(a=>({value:a.value,count:a.count}));if(o.grouped_hits&&o.grouped_hits.length)for(const s of o.grouped_hits){const a=s.group_key[0],i=[];for(const r of s.hits)i.push({document:this.#a(r),highlight:this.#i(r)});n.documents[a]=i}}return n}#a(e){return this.#h(e)}#i(e){const t={},n=[];for(const[o,s]of Object.entries(e.highlight??{}))if(Array.isArray(s)){if(o==="path"){const a=s,i=[];for(const r of a)i.push(r.snippet);t.path=i}else if(o==="parameters"){const a=s;for(const i of a){let r=!1;for(const[c,l]of Object.entries(i))if(c!=="deepLink")if(Array.isArray(l))for(const u of l)u.matched_tokens?.length&&(r=!0);else l.matched_tokens?.length&&(r=!0);if(r){const c={name:i.name?.snippet||"",description:i.description?.snippet||"",place:i.place?.snippet||"",path:i.path?.map(l=>l?.snippet)||[]};t.parameters=[c];break}}}}else t[o]=s.snippet,n.push(o);for(const[o,s]of Object.entries(e.document))!n.includes(o)&&typeof s=="string"&&(t[o]=s.length>b?`${s.substring(0,b)}...`:s);return t.parameters||(t.parameters=[]),t}#h(e){let t;const n=Object.keys(e.highlight);for(const s of O)if(n.some(a=>a===s))return e.document;const o=e.highlight.parameters;if(o){for(const s of o)for(const[a,i]of Object.entries(s))if(a!=="deepLink"){if(Array.isArray(i)){for(const r of i)if(r.matched_tokens?.length){t=s.deepLink.snippet;break}}else if(i.matched_tokens?.length){t=s.deepLink.snippet;break}}}if(t){const s=t.split("#")[1];return{...e.document,url:`${e.document.url}#${s}`}}return e.document}async exportDocuments(e){const t='{"documents":[',n=d(m.join(e,F));for(const[o,s]of this.#s){if(s.length===0)continue;const a=d(m.join(n,`${o}.json`)),i=!I(a),r=JSON.stringify(s).substring(1).slice(0,-1),c=i?t+r:","+r;await g(a,c,{encoding:"utf8"}),this.#s.set(o,[])}}async exportIndexes(e){const t=d(m.join(e,F));for(const n of this.#s.keys()){const o=d(m.join(t,`${n}.json`)),s=`],"schemaFields":${JSON.stringify(this.#t)}}`;await g(o,s,{encoding:"utf8"})}}async import(e){}async countFacets(e,t){return await D("search.facets",async n=>{const{locale:o,query:s,facetQuery:a,filter:i,field:r}=e,c=this.#c(o),l={q:s||"*",query_by:this.#l(),facet_by:"*",facet_query:this.#d(a,r),filter_by:this.#o(t,i,r),max_facet_values:S};if(n?.setAttribute("collectionName",c),n?.setAttribute("query",l.q),n?.setAttribute("facetQuery",l.facet_query),n?.setAttribute("filter",l.filter_by),this.#e){const u={},h=await this.#e.collections(c).documents().search(l);if(h.facet_counts&&h.facet_counts.length)for(const _ of h.facet_counts)u[_.field_name]=_.counts.map(y=>({value:y.value,count:y.count,isCounterVisible:!!s||(i?.length||0)>0}));return u}else return{}})}#c(e){return`${this.#r}${e}`}#p(e){for(const[t,{queryable:n}]of e)this.#t.find(o=>o.name===t)||this.#t.push({queryable:n,name:t,type:"string",facet:!0,optional:!0})}#l(){return this.#t.filter(e=>e.facet?e.queryable:e.queryable!==!1).map(e=>e.name).join(",")}#m(){return this.#t.filter(e=>e.facet&&e.name===E).map(e=>e.name).join(",")}#o(e,t,n){const o=`${A}:[${e.teams.map(a=>`'${a}'`).join(", ")}]`;let s=`${f}.isDefault:true`;if(t&&t.length){const a=t.filter(r=>r.field!==n&&r.field!==f).map(r=>{const c=r.values.map(l=>`'${l}'`);return c.length?`${r.field}:=[${c.join(", ")}]`:""}).join(" && "),i=t.find(r=>r.field===f);if(i&&i.values.length&&i.values.length===2){const r=i.values[0],c=i.values[1],l=`(${f}.folderId:! ${r} && ${f}.isDefault:true)`,u=`(${f}.folderId: ${r} && ${f}.version:='${c}')`;s=`(${l} || ${u})`}return a?`${o} && ${a} && ${s}`:`${o} && ${s}`}else return`${o} && ${s}`}#d(e,t){return e&&t?`${t}:${e}`:""}#_(e){const t=[];if(e&&e.length)for(const n of e)n.field===E&&t.push(...n.values);return t}#y(e,t){const n=[],o=this.#t.filter(s=>s.facet);for(const s of o){const a={facet_by:s.name,filter_by:this.#o(e,t,s.name)};n.push(a)}return n}cleanupFacetValues(e){const t=e.getSearchFacets();t.forEach(n=>{n.values=[]}),e.setSearchFacets(t)}}export{U as Typesense};
@@ -1 +1 @@
1
- import{reporter as f}from"../../tools/notifiers/reporter.js";import{MARKDOC_PARTIALS_DATA_KEY as u}from"../../store.js";async function c(r,e,n,i,l,o,a){const m=!!e?.props?.compilationErrors?.length,s=r?.serverPropsGetterIds;return s?.length?Promise.all(s.map(async t=>{const p=l[t];if(!p){if(m)return{...e.props};await f.panicOnBuild(`Invalid server props getter id: "${t}" for route "${r.slug}"`)}return await(await p()).default({...r,...a},e,{variables:{...n,pageProps:i},partials:o.getGlobalConfig(u)},o)})||[]):[]}export{c as getServerPropsFromSystemHandlers};
1
+ import{reporter as f}from"../../tools/notifiers/reporter.js";import{MARKDOC_PARTIALS_DATA_KEY as u}from"../../constants/common.js";async function c(r,e,n,i,l,o,a){const m=!!e?.props?.compilationErrors?.length,s=r?.serverPropsGetterIds;return s?.length?Promise.all(s.map(async t=>{const p=l[t];if(!p){if(m)return{...e.props};await f.panicOnBuild(`Invalid server props getter id: "${t}" for route "${r.slug}"`)}return await(await p()).default({...r,...a},e,{variables:{...n,pageProps:i},partials:o.getGlobalConfig(u)},o)})||[]):[]}export{c as getServerPropsFromSystemHandlers};
@@ -9,8 +9,6 @@ import type { BundledDefinition as AsyncApiBundledDefinition } from './plugins/a
9
9
  import type { BundledDefinition as GraphqlBundledDefinition } from './plugins/graphql-docs/graphql-doc-loader.js';
10
10
  import type { SearchEngine } from './plugins/search/engines/search-engine.js';
11
11
  import { KvService } from './persistence/kv/services/kv-service.js';
12
- export declare const MARKDOC_PARTIALS_DATA_KEY = "markdown/partials";
13
- export declare const MARKDOC_PARTIALS_DEPS_KEY = "markdown/partials-deps";
14
12
  export declare const USER_DEFINED_API_FUNCTIONS_COUNTER_KEY = "userDefinedApiFunctions";
15
13
  type LifecycleEventType = 'global-data-updated' | 'shared-data-updated' | 'routes-updated' | 'build-updated' | 'build-started' | 'errors-updated' | 'pages-updated';
16
14
  export type StoreOptions = {
@@ -1 +1 @@
1
- import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as T}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as O}from"../utils/guards/is-object.js";import{mapObject as M}from"../utils/object/map-object.js";import{getValueDeep as R}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as L}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as h}from"../utils/path/normalize-route-slug.js";import{isLocalLink as y}from"../utils/path/is-local-link.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as u}from"./tools/notifiers/logger.js";import{sha1 as k}from"./utils/crypto/sha1.js";import{envConfig as _,setEnv as G}from"./config/env-config.js";import{KvService as F}from"./persistence/kv/services/kv-service.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as I}from"./ssr/render.js";import{readStaticData as H,writeStaticData as N}from"./utils/static-data.js";import{parseAndResolveMarkdoc as V}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as j}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as S}from"./entitlements/entitlements-provider.js";import{isL10nPath as q}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as K}from"./utils/globs.js";import{replaceEnvVariablesDeep as U}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{followRedirectChain as J}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as W}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as $}from"../cli/telemetry/helpers/trace-step.js";const v={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map"},m="markdown/partials",z="markdown/partials-deps",E="PLAN_GATES",Y=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],Ae="userDefinedApiFunctions";class P{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:s,serverMode:t=!1,serverOutDir:a}){this.#r=s,this.outdir=e,this.serverMode=t,this.serverOutDir=a,this.userCodeReady=new Promise(r=>{this.#a=r})}on(e,s){const t=this.listeners.get(e);t?t.add(s):this.listeners.set(e,new Set([s]))}queueEvent=(e,s,...t)=>{this.#t.set(e+String(s),[e,s,...t])};runListeners=(e,s,...t)=>{for(const a of this.listeners.get(e)||new Set)s?a(s,...t):a(...t)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await $("build.reload_markdoc_options",async()=>{const e=S.instance(),s=await j(this.serverOutDir),t=Object.fromEntries(Object.entries(s.tags).filter(([a])=>D[a]!=null?e.canAccessFeature(D[a]):!0));this.#s={...s,tags:t}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const s=this.globalData,t={...this.globalData,...e};this.globalData=t,JSON.stringify(t)!==JSON.stringify(s)&&this.queueEvent("global-data-updated",void 0,t)};getGlobalData=()=>this.globalData;getKv=async()=>F.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:s,deps:t,resource:a})=>{const{data:{info:r,ast:o},compoundHash:l}=await V(e,this.markdocOptions,{actions:this,context:s},a);for(const i of r.sharedDataDeps||[]){for(const n of t?.routeSlugs||[])this.addRouteSharedData(n,i,i);for(const n of t?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(i),this.sharedDataDeps.set(n,c)}}for(const i of r.dynamicMarkdocComponents||[]){for(const n of t?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(i),this.routesDynamicComponents.set(n,c)}for(const n of t?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(i),this.sharedDataMarkdocComponents.set(n,c)}}if(t?.routeSlugs&&r.partials?.length)for(const i of t.routeSlugs){const n=this.routesPartials.get(i)||[];for(const c of r.partials)n.includes(c)||n.push(c);this.routesPartials.set(i,n)}return{info:r,ast:o,compoundHash:l}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}async loadGraphqlDefinitions(e){return(await e.cache.load(".","load-graphql-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const s=Object.keys(e);for(const o of s)for(const l in this.replacedEnvVars)if(l===o||l.startsWith(`${o}:`)){const i=l.split(":"),{error:n,value:c}=R(e,i);(n||c!==this.replacedEnvVars[l].replaced)&&delete this.replacedEnvVars[l]}const{resolvedObj:t,unsetEnvVars:a,replacedValues:r}=U(e);for(const o of a)this.unsetEnvVars.add(o);Object.assign(this.replacedEnvVars,r),Object.assign(this.config,t)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,s,t={})=>{if(!S.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const o=h(e).toLowerCase();this.config.redirects[o]=s;const{trackOriginalSource:l=!0}=t,i=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(i)&&!i.includes(o)&&i.push(o),o.endsWith("*")&&W(this.config.wildcardRedirectsTree,o)};getRedirect=e=>{const s=h(e).toLowerCase(),t=x(s,this.config.redirects,this.config.wildcardRedirectsTree);if(!t)return null;if(y(t.to)){const a=h(t.to).toLowerCase();if(!a.endsWith("*")&&J(a,[s],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:t.to,type:t.type}};createSharedData=async(e,s,t)=>{if(t&&this.#e[e]===t)return e;const a=JSON.stringify(s),r=t??k(a);return this.#e[e]===r||(this.#e[e]=r,await B(e,a,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,s,t)=>{const a=L(e),r=this.routesSharedData.get(a)||{};r[s]=t,this.routesSharedData.set(a,r),u.verbose(`Adding shared data to ${e}, ${s}, ${t}`)};getRouteSharedDataByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.routesSharedData.get(s)||{}:{}};getPartialsForRoute=e=>{const s=this.getGlobalConfig(m)||{},t=this.routesPartials.get(e);if(!t||t.length===0)return{};const a=this.getGlobalConfig(z)||{},r=new Set(t),o=Array.from(t);for(let i=0;i<o.length;i++){const n=o[i],c=a[n]?.partials??[];for(const d of c)r.has(d)||(r.add(d),o.push(d))}const l={};for(const i of r)s[i]&&(l[i]=s[i]);return l};addRoute=e=>{const t={...K(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:t}),u.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,s,t)=>{const a=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(r=>({code:r,name:r}));for(const r of a){const o=A(e,g,r.code,a);this.addRouteSharedData(o,s,t)}};addApiRoute=e=>{this.apiRoutes.push(e),u.verbose("Created API route %s",e.slug)};addMcpTools=(e,s)=>{for(const t of s)this.mcpToolHandlers.set(t.name,{...t,importPath:e}),u.verbose("Created MCP tool %s",t.name)};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());addMiddleware=e=>{this.middleware.push(e),u.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,s)=>{this.config.responseHeaders||(this.config.responseHeaders={});const t=new Set(s.map(o=>o.name.toLowerCase())),r=[...(this.config.responseHeaders[e]??[]).filter(o=>!t.has(o.name.toLowerCase())),...s];this.config.responseHeaders[e]=r};getRouteByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.getRouteBySlug(s):void 0};getRouteBySlug=(e,s={})=>{const{followRedirect:t=!0}=s,a=this.getRedirect(e);return t&&a?this.routesBySlug.get(h(a.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!y(s.to))return!0;const t=h(s.to);return this.routesBySlug.has(t)};getRoutesByTemplateId=e=>this.newRoutes.filter(s=>s.templateId===e);getAllRoutesForLocale=(e=g)=>{const s=Array.from(this.routesBySlug.values()),t=e.toLowerCase();return s.filter(a=>e===g?!q(a.fsPath):a.slug.startsWith(`/${t}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,s)=>(this.templates.set(e,s),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,s)=>(this.apiRoutesRequestHandlers.set(e,s),e);clearRequestHandlersByPrefix=e=>{for(const s of this.apiRoutesRequestHandlers.keys())s.startsWith(e)&&this.apiRoutesRequestHandlers.delete(s)};registerServerPropsGetter=(e,s)=>(this.serverPropsGetters.set(e,s),e);registerPagePropsGetter=(e,s)=>{this.pagePropsGetters.set(e,s)};async writeRouteStaticData(e,s){const t=await this.resolveRouteStaticData(e,s,!1);t&&N(e.slug,t,this.outdir)}async resolveRouteStaticData(e,s,t){if(this.serverMode)return H(e.slug,this.outdir);const a={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},r=await e.getStaticData?.(e,a)||{},o=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>o.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const i=this.getGlobalConfig("seo"),n=r?.frontmatter||{};return{...r,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...r.props,dynamicMarkdocComponents:Array.from(o),metadata:{...r?.props?.metadata,...e.metadata},seo:{title:T,...i,...r.props?.seo},compilationErrors:this.compilationErrors},lastModified:t||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,s){if(!e?.length)return;const t=typeof e[0]=="string"?e.join(""):I(e);t&&(s==="head"?this.ssr.headTags.push(t):s==="preBody"?this.ssr.preBodyTags.push(t):this.ssr.postBodyTags.push(t))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[t,a]of Object.entries(v))switch(a){case"map":const r=Array.from(this[t].entries());e.push([t,r]);break;case"object":t==="config"&&e.push([t,await this.getConfigWithEnvPlaceholders()]),e.push([t,this[t]]);break;default:throw new Error("Invalid format")}const s=Object.fromEntries(e);return s[E]=_.PLAN_GATES,s}static fromJson(e,s){const t=new P(s);for(const[r,o]of Object.entries(v))switch(o){case"map":t[r]=new Map(e[r]);break;case"object":if(r==="config"){t.setGlobalConfig(e[r]);break}t[r]=e[r];break;default:throw new Error("Invalid format")}t.config[m]=Z(t.config[m]||{});const a=e[E];return a&&G("PLAN_GATES",a),t}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const s in this.replacedEnvVars){const{original:t}=this.replacedEnvVars[s],a=s.split(":"),r=a.pop(),{error:o,value:l}=R(e,a);if(o||!O(l)&&!Array.isArray(l)){await w.panicOnBuild(`Failed to replace env var with env name for ${s}`);continue}l[r]=t}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(t=>!Y.includes(t));if(e.length===0)return;const s=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await w.panicOnBuildContentError(s)}}function Z(C){return M(C,e=>b.Ast.fromJSON(JSON.stringify(e)))}export{m as MARKDOC_PARTIALS_DATA_KEY,z as MARKDOC_PARTIALS_DEPS_KEY,P as Store,Ae as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
1
+ import b from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as T}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{MARKDOC_PARTIALS_DATA_KEY as m,MARKDOC_PARTIALS_DEPS_KEY as O}from"./constants/common.js";import{isObject as M}from"../utils/guards/is-object.js";import{mapObject as L}from"../utils/object/map-object.js";import{getValueDeep as R}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as k}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as h}from"../utils/path/normalize-route-slug.js";import{isLocalLink as y}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as u}from"./tools/notifiers/logger.js";import{sha1 as _}from"./utils/crypto/sha1.js";import{envConfig as G,setEnv as F}from"./config/env-config.js";import{KvService as B}from"./persistence/kv/services/kv-service.js";import{writeSharedData as I}from"./utils/index.js";import{renderComponents as H}from"./ssr/render.js";import{readStaticData as N,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as q}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as w}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as U}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{followRedirectChain as W}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as $}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as z}from"../cli/telemetry/helpers/trace-step.js";const v={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map"},E="PLAN_GATES",Y=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],Te="userDefinedApiFunctions";class P{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:s,serverMode:t=!1,serverOutDir:a}){this.#r=s,this.outdir=e,this.serverMode=t,this.serverOutDir=a,this.userCodeReady=new Promise(r=>{this.#a=r})}on(e,s){const t=this.listeners.get(e);t?t.add(s):this.listeners.set(e,new Set([s]))}queueEvent=(e,s,...t)=>{this.#t.set(e+String(s),[e,s,...t])};runListeners=(e,s,...t)=>{for(const a of this.listeners.get(e)||new Set)s?a(s,...t):a(...t)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await z("build.reload_markdoc_options",async()=>{const e=w.instance(),s=await q(this.serverOutDir),t=Object.fromEntries(Object.entries(s.tags).filter(([a])=>D[a]!=null?e.canAccessFeature(D[a]):!0));this.#s={...s,tags:t}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const s=this.globalData,t={...this.globalData,...e};this.globalData=t,JSON.stringify(t)!==JSON.stringify(s)&&this.queueEvent("global-data-updated",void 0,t)};getGlobalData=()=>this.globalData;getKv=async()=>B.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:s,deps:t,resource:a})=>{const{data:{info:r,ast:o},compoundHash:l}=await j(e,this.markdocOptions,{actions:this,context:s},a);for(const i of r.sharedDataDeps||[]){for(const n of t?.routeSlugs||[])this.addRouteSharedData(n,i,i);for(const n of t?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(i),this.sharedDataDeps.set(n,c)}}for(const i of r.dynamicMarkdocComponents||[]){for(const n of t?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(i),this.routesDynamicComponents.set(n,c)}for(const n of t?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(i),this.sharedDataMarkdocComponents.set(n,c)}}if(t?.routeSlugs&&r.partials?.length)for(const i of t.routeSlugs){const n=this.routesPartials.get(i)||[];for(const c of r.partials)n.includes(c)||n.push(c);this.routesPartials.set(i,n)}return{info:r,ast:o,compoundHash:l}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}async loadGraphqlDefinitions(e){return(await e.cache.load(".","load-graphql-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const s=Object.keys(e);for(const o of s)for(const l in this.replacedEnvVars)if(l===o||l.startsWith(`${o}:`)){const i=l.split(":"),{error:n,value:c}=R(e,i);(n||c!==this.replacedEnvVars[l].replaced)&&delete this.replacedEnvVars[l]}const{resolvedObj:t,unsetEnvVars:a,replacedValues:r}=J(e);for(const o of a)this.unsetEnvVars.add(o);Object.assign(this.replacedEnvVars,r),Object.assign(this.config,t)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,s,t={})=>{if(!w.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const o=h(e).toLowerCase();this.config.redirects[o]=s;const{trackOriginalSource:l=!0}=t,i=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(i)&&!i.includes(o)&&i.push(o),o.endsWith("*")&&$(this.config.wildcardRedirectsTree,o)};getRedirect=e=>{const s=h(e).toLowerCase(),t=x(s,this.config.redirects,this.config.wildcardRedirectsTree);if(!t)return null;if(y(t.to)){const a=h(t.to).toLowerCase();if(!a.endsWith("*")&&W(a,[s],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:t.to,type:t.type}};createSharedData=async(e,s,t)=>{if(t&&this.#e[e]===t)return e;const a=JSON.stringify(s),r=t??_(a);return this.#e[e]===r||(this.#e[e]=r,await I(e,a,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,s,t)=>{const a=k(e),r=this.routesSharedData.get(a)||{};r[s]=t,this.routesSharedData.set(a,r),u.verbose(`Adding shared data to ${e}, ${s}, ${t}`)};getRouteSharedDataByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.routesSharedData.get(s)||{}:{}};getPartialsForRoute=e=>{const s=this.getGlobalConfig(m)||{},t=this.routesPartials.get(e);if(!t||t.length===0)return{};const a=this.getGlobalConfig(O)||{},r=new Set(t),o=Array.from(t);for(let i=0;i<o.length;i++){const n=o[i],c=a[n]?.partials??[];for(const d of c)r.has(d)||(r.add(d),o.push(d))}const l={};for(const i of r)s[i]&&(l[i]=s[i]);return l};addRoute=e=>{const t={...U(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:t}),u.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,s,t)=>{const a=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(r=>({code:r,name:r}));for(const r of a){const o=A(e,g,r.code,a);this.addRouteSharedData(o,s,t)}};addApiRoute=e=>{this.apiRoutes.push(e),u.verbose("Created API route %s",e.slug)};addMcpTools=(e,s)=>{for(const t of s)this.mcpToolHandlers.set(t.name,{...t,importPath:e}),u.verbose("Created MCP tool %s",t.name)};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());addMiddleware=e=>{this.middleware.push(e),u.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,s)=>{this.config.responseHeaders||(this.config.responseHeaders={});const t=new Set(s.map(o=>o.name.toLowerCase())),r=[...(this.config.responseHeaders[e]??[]).filter(o=>!t.has(o.name.toLowerCase())),...s];this.config.responseHeaders[e]=r};getRouteByFsPath=e=>{const s=this.routesByFsPath.get(e);return s?this.getRouteBySlug(s):void 0};getRouteBySlug=(e,s={})=>{const{followRedirect:t=!0}=s,a=this.getRedirect(e);return t&&a?this.routesBySlug.get(h(a.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!y(s.to))return!0;const t=h(s.to);return this.routesBySlug.has(t)};getRoutesByTemplateId=e=>this.newRoutes.filter(s=>s.templateId===e);getAllRoutesForLocale=(e=g)=>{const s=Array.from(this.routesBySlug.values()),t=e.toLowerCase();return s.filter(a=>e===g?!K(a.fsPath):a.slug.startsWith(`/${t}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,s)=>(this.templates.set(e,s),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,s)=>(this.apiRoutesRequestHandlers.set(e,s),e);clearRequestHandlersByPrefix=e=>{for(const s of this.apiRoutesRequestHandlers.keys())s.startsWith(e)&&this.apiRoutesRequestHandlers.delete(s)};registerServerPropsGetter=(e,s)=>(this.serverPropsGetters.set(e,s),e);registerPagePropsGetter=(e,s)=>{this.pagePropsGetters.set(e,s)};async writeRouteStaticData(e,s){const t=await this.resolveRouteStaticData(e,s,!1);t&&V(e.slug,t,this.outdir)}async resolveRouteStaticData(e,s,t){if(this.serverMode)return N(e.slug,this.outdir);const a={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},r=await e.getStaticData?.(e,a)||{},o=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>o.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const i=this.getGlobalConfig("seo"),n=r?.frontmatter||{};return{...r,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...r.props,dynamicMarkdocComponents:Array.from(o),metadata:{...r?.props?.metadata,...e.metadata},seo:{title:T,...i,...r.props?.seo},compilationErrors:this.compilationErrors},lastModified:t||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,s){if(!e?.length)return;const t=typeof e[0]=="string"?e.join(""):H(e);t&&(s==="head"?this.ssr.headTags.push(t):s==="preBody"?this.ssr.preBodyTags.push(t):this.ssr.postBodyTags.push(t))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[t,a]of Object.entries(v))switch(a){case"map":const r=Array.from(this[t].entries());e.push([t,r]);break;case"object":t==="config"&&e.push([t,await this.getConfigWithEnvPlaceholders()]),e.push([t,this[t]]);break;default:throw new Error("Invalid format")}const s=Object.fromEntries(e);return s[E]=G.PLAN_GATES,s}static fromJson(e,s){const t=new P(s);for(const[r,o]of Object.entries(v))switch(o){case"map":t[r]=new Map(e[r]);break;case"object":if(r==="config"){t.setGlobalConfig(e[r]);break}t[r]=e[r];break;default:throw new Error("Invalid format")}t.config[m]=Z(t.config[m]||{});const a=e[E];return a&&F("PLAN_GATES",a),t}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const s in this.replacedEnvVars){const{original:t}=this.replacedEnvVars[s],a=s.split(":"),r=a.pop(),{error:o,value:l}=R(e,a);if(o||!M(l)&&!Array.isArray(l)){await S.panicOnBuild(`Failed to replace env var with env name for ${s}`);continue}l[r]=t}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(t=>!Y.includes(t));if(e.length===0)return;const s=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(s)}}function Z(C){return L(C,e=>b.Ast.fromJSON(JSON.stringify(e)))}export{P as Store,Te as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
@@ -1 +1 @@
1
- import{AsyncApiRealmAPI as o}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../config/env-config.js";import{PACKAGE_NAME as t}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as i,TELEMETRY_ENABLED as s}from"../constants/common.js";class E extends o.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organizationId:e.ORGANIZATION_ID||"",organizationSlug:e.ORGANIZATION_SLUG||"",projectId:e.PROJECT_ID||"",projectSlug:e.PROJECT_SLUG||"",origin:"realmApi",actor:{id:"Anonymous",object:"user",uri:""},source:"server",env:e.REDOCLY_ENV}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${t}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?!e.TELEMETRY_DEV_DEBUG:!s})}}const A=new E;export{A as telemetry};
1
+ import{AsyncApiRealmAPI as o}from"@redocly/realm-asyncapi-sdk";import{envConfig as e}from"../config/env-config.js";import{PACKAGE_NAME as t}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as i,TELEMETRY_ENABLED as l}from"../constants/common.js";class s extends o.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organizationId:e.ORGANIZATION_ID||"",organizationSlug:e.ORGANIZATION_SLUG||"",projectId:e.PROJECT_ID||"",projectSlug:e.PROJECT_SLUG||"",origin:"realmApi",actor:{id:"Anonymous",object:"user",uri:""},source:"urn:redocly:realm:api",env:e.REDOCLY_ENV}))}initialize(r=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${t}@${e.REDOCLY_PORTAL_VERSION||""}`,collectorTraceUrl:r?i:e.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:e.isProductionEnv,version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:r?!e.TELEMETRY_DEV_DEBUG:!l})}}const A=new s;export{A as telemetry};
@@ -8,4 +8,9 @@ export type GetInnerContentFnOptions = {
8
8
  renderTag?: RenderTagFn;
9
9
  };
10
10
  export type GetInnerContentFn = (children: (RenderableTreeNode | Node | Variable | Function)[], options?: GetInnerContentFnOptions) => string;
11
+ export type ResolvedSampleBlock = {
12
+ lang?: string;
13
+ title?: string;
14
+ source: string;
15
+ };
11
16
  //# sourceMappingURL=markdoc.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/realm",
3
- "version": "0.135.0-next.5",
3
+ "version": "0.135.0-next.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "@opentelemetry/semantic-conventions": "1.40.0",
34
34
  "@redocly/ajv": "8.18.0",
35
35
  "@redocly/mcp-typescript-sdk": "1.18.1",
36
- "@redocly/openapi-core": "2.34.0",
36
+ "@redocly/openapi-core": "2.35.0",
37
37
  "@shikijs/transformers": "3.21.0",
38
38
  "@tanstack/react-query": "5.62.3",
39
39
  "@tanstack/react-table": "8.21.3",
@@ -93,14 +93,14 @@
93
93
  "xpath": "0.0.34",
94
94
  "yaml-ast-parser": "0.0.43",
95
95
  "zod": "^3.25.76",
96
- "@redocly/asyncapi-docs": "1.12.0-next.5",
97
- "@redocly/config": "0.49.0",
98
- "@redocly/graphql-docs": "1.12.0-next.5",
99
- "@redocly/openapi-docs": "3.23.0-next.5",
96
+ "@redocly/asyncapi-docs": "1.12.0-next.6",
97
+ "@redocly/config": "0.49.1",
98
+ "@redocly/graphql-docs": "1.12.0-next.6",
99
+ "@redocly/openapi-docs": "3.23.0-next.6",
100
100
  "@redocly/portal-legacy-ui": "0.18.0-next.0",
101
- "@redocly/portal-plugin-mock-server": "0.20.0-next.5",
102
- "@redocly/realm-asyncapi-sdk": "0.13.0-next.3",
103
- "@redocly/theme": "0.67.0-next.4"
101
+ "@redocly/portal-plugin-mock-server": "0.20.0-next.6",
102
+ "@redocly/realm-asyncapi-sdk": "0.13.0-next.4",
103
+ "@redocly/theme": "0.67.0-next.5"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "react": "^19.2.4",
@@ -1 +0,0 @@
1
- import{getOperation as E,getServerEnvName as l,normalizeOptions as x,OpenAPIParser as h,getTagOrGroup as q}from"@redocly/openapi-docs";import{getOperationInfoById as v}from"./get-operation-info-by-id";import{getOperationInfoByPointer as y}from"./get-operation-info-by-pointer";function M(s,{operationId:i,pointer:f},m,{exampleKey:r,mimeType:a,environments:p,environment:d,requestBody:g}){let o;if(i?o=v(s.definition,i):f&&(o=y(s.definition,f)),!o)return;const O=new h(s.definition,void 0,x(s.options)),u=o.tags?.[0],B=u?q("group",{name:u},void 0):void 0,n=E(O,o,B,m,"");if(a&&n.requestBody?.content?.mediaTypes&&(n.requestBody.content.mediaTypes=n.requestBody?.content?.mediaTypes.filter(e=>e.name===a)),r&&(n.requestBody?.content?.mediaTypes.forEach(e=>{if(!e.examples)return;const t=e.examples[r];e.examples=t?{[r]:t}:{}}),n.responses?.forEach(e=>{e.content?.mediaTypes?.forEach(t=>{if(!t.examples)return;const c=t.examples[r];t.examples=c?{[r]:c}:{}})})),g&&n.requestBody?.content?.mediaTypes.forEach(e=>{e.examples={}}),p&&(n.servers=n.servers.map(e=>{const t=p?.[l(e)];return t?{...e,url:t.server||e.url}:e})),d){const e=n.servers.filter(t=>d===l(t));n.servers=e.length?e:n.servers}return n}export{M as getOperation};
@@ -1,4 +0,0 @@
1
- export * from './get-operation-info-by-id';
2
- export * from './get-operation-info-by-pointer';
3
- export * from './get-operation';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- export*from"./get-operation-info-by-id";export*from"./get-operation-info-by-pointer";export*from"./get-operation";