@redocly/realm 0.141.0-next.21 → 0.141.0-next.23

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 (46) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/cli/build/libsql/copy-prebuilt-binary.js +1 -1
  3. package/dist/cli/eject/resolveEjectParams.js +1 -1
  4. package/dist/client/app/Sidebar/Sidebar.js +2 -3
  5. package/dist/client/app/hooks/catalog/useFetchCatalogEntities.d.ts +5 -0
  6. package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
  7. package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.d.ts +5 -0
  8. package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.js +1 -1
  9. package/dist/client/app/hooks/markdown/useMarkdownText.js +1 -1
  10. package/dist/client/app/l10n/hooks/useL10n.d.ts +2 -4
  11. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  12. package/dist/client/app/markdoc/embedded-code-components.d.ts +8 -0
  13. package/dist/client/app/markdoc/embedded-code-components.js +1 -0
  14. package/dist/client/app/search/useAiSearch.js +1 -1
  15. package/dist/client/templates/api-docs/helpers.js +2 -2
  16. package/dist/constants/l10n/langs/ar.js +1 -1
  17. package/dist/constants/l10n/langs/de.js +1 -1
  18. package/dist/constants/l10n/langs/en.js +1 -1
  19. package/dist/constants/l10n/langs/es.js +1 -1
  20. package/dist/constants/l10n/langs/fr.js +1 -1
  21. package/dist/constants/l10n/langs/hi.js +1 -1
  22. package/dist/constants/l10n/langs/it.js +1 -1
  23. package/dist/constants/l10n/langs/ja.js +1 -1
  24. package/dist/constants/l10n/langs/ko.js +1 -1
  25. package/dist/constants/l10n/langs/pl.js +1 -1
  26. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  27. package/dist/constants/l10n/langs/pt.js +1 -1
  28. package/dist/constants/l10n/langs/ru.js +1 -1
  29. package/dist/constants/l10n/langs/uk.js +1 -1
  30. package/dist/constants/l10n/langs/zh.js +1 -1
  31. package/dist/markdoc/nodes/fence/index.js +1 -1
  32. package/dist/server/api-routes/helpers/enhance-context.js +1 -1
  33. package/dist/server/node-bundle-entry.js +1 -1
  34. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +15 -15
  35. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  36. package/dist/server/plugins/mcp/gateway-mcp/api-call-operations.d.ts +2 -2
  37. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/request-limiter/apply-edge-rate-limit.js +1 -1
  38. package/dist/server/plugins/mcp/types.d.ts +3 -1
  39. package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
  40. package/dist/server/providers/database/client.d.ts +3 -3
  41. package/dist/server/providers/database/client.js +1 -1
  42. package/dist/server/providers/database/database-connection-factory.js +1 -1
  43. package/dist/server/utils/sandbox-context.js +1 -1
  44. package/dist/server/web-server/dev-server.js +1 -1
  45. package/dist/server/web-server/node-asset-reader.d.ts +1 -1
  46. package/package.json +14 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,87 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.141.0-next.23
4
+
5
+ ### Patch Changes
6
+
7
+ - 3682740e6e0: Fixed an issue where the `eject` command couldn't eject the AI assistant conversation component.
8
+ - Updated dependencies [d059d217173]
9
+ - Updated dependencies [2b134fd4111]
10
+ - Updated dependencies [d059d217173]
11
+ - Updated dependencies [d059d217173]
12
+ - Updated dependencies [53630b1afb2]
13
+ - Updated dependencies [f62be656937]
14
+ - Updated dependencies [f01ae4e5552]
15
+ - Updated dependencies [3682740e6e0]
16
+ - Updated dependencies [eabf2b1767d]
17
+ - Updated dependencies [d17fea29b59]
18
+ - Updated dependencies [d17fea29b59]
19
+ - Updated dependencies [d17fea29b59]
20
+ - Updated dependencies [97979bae96e]
21
+ - Updated dependencies [97979bae96e]
22
+ - @redocly/api-docs@0.6.0-next.23
23
+ - @redocly/portal-plugin-mock-server@0.26.0-next.8
24
+ - @redocly/theme@0.73.0-next.18
25
+
26
+ ## 0.141.0-next.22
27
+
28
+ ### Minor Changes
29
+
30
+ - 07d0489aaaf: Added `isLoading`, `hasMore`, `isLoadingMore`, `loadMore` and `isPlaceholderData` to the catalog entity hook results and deprecated their `query` field for ejected catalog components.
31
+ - 189240aa3cb: Updated code snippets to use the page background color for the code, and the layer color for headers with a title or a language dropdown.
32
+ - 189240aa3cb: Added the `previewLines` code block attribute and the `codeSnippet.previewLines` option to shorten long code snippets with a **Show more** button.
33
+ - 32a0382dc0d: Aligned the navbar logo with sidebar items and added the `--navbar-logo-margin-start` CSS variable to control the space before the logo. This variable replaces the left side of `--navbar-logo-margin`.
34
+ - 32a0382dc0d: Added the `sidebar.chevronPosition` option to position group chevrons on the right.
35
+ - 1dad33f83d9: Added the `closeOnClick` option to the `Tooltip` component to keep the tooltip open when users click its trigger.
36
+ - 5c30a1c62ff: Added the `Trans` component to translate sentences that contain React elements in React pages, with numbered placeholders that let each language set its word order.
37
+ - 9cba16436c7: Added the `x-mcp.hide` option to hide a path or an operation from the MCP server. The `x-mcp.docs.hide` option is deprecated and works as before.
38
+
39
+ ### Patch Changes
40
+
41
+ - 076d410f086: Fixed an issue where the Markdown copy of a page, which AI agents and `llms.txt` read, left out OpenAPI code and response samples for webhooks and some other operations.
42
+ - 076d410f086: Fixed an issue where OpenAPI code samples in the Markdown copy of a page used the wrong HTTP method for `QUERY` operations.
43
+ - da6634c1866: Fixed security vulnerability `CVE-2026-128080` by upgrading `@opentelemetry/instrumentation-http` to version `0.223.2`.
44
+ - 3d7ea2b9eaf: Fixed security vulnerability `CVE-2026-63402` by upgrading `i18next` to version `26.7.2`.
45
+ - 36f1a64d4f5: Fixed an issue where the mock server used more memory and skipped some request validation after an API description changed.
46
+ - 4d059bf1fea: Fixed an issue where server-side code, such as MCP tools, couldn't make network requests when the project ran on Node.js 25 or later.
47
+ - baac2d6fd40: Fixed an issue where a line break from an input method editor went into a one-line field other than the URL in the **Try it** console and Replay.
48
+ - 1dad33f83d9: Fixed an issue in the **Try it** console where a click on an info icon, a status, or a shortened text hid its tooltip.
49
+ - a31ef11b510: Fixed Replay saving the values of inputs used in a request URL to the request history in the browser.
50
+ - baac2d6fd40: Updated one-line fields other than the URL in the **Try it** console and Replay to remove the line breaks from pasted multi-line text, as the URL field does. Before, each line break became a space.
51
+ - a31ef11b510: Fixed Replay sending the values of Secret inputs and of inputs kept only in memory in its telemetry.
52
+ - 2c10a682d6a: Fixed an issue in the **Try it** console and Replay where the close icon didn't close notifications.
53
+ - a31ef11b510: Fixed API reference code samples showing the values of Secret inputs and of inputs kept **Until Try it closes** after **Try it** closes.
54
+ - a0f5ffc3805: Fixed an issue in the **Try it** console and Replay where the value list of a field opened over the details of an `{$inputs.name}` expression.
55
+ - 32a0382dc0d: Aligned sidebar items, section titles, icons, and the back button with the navbar logo.
56
+ - 32a0382dc0d: Added spacing between sidebar sections.
57
+ - Updated dependencies [b9dada01e21]
58
+ - Updated dependencies [2b3e75566f7]
59
+ - Updated dependencies [2b3e75566f7]
60
+ - Updated dependencies [be639b1c90c]
61
+ - Updated dependencies [be639b1c90c]
62
+ - Updated dependencies [076d410f086]
63
+ - Updated dependencies [076d410f086]
64
+ - Updated dependencies [96181b2e0b8]
65
+ - Updated dependencies [df1d7e2c9e7]
66
+ - Updated dependencies [da6634c1866]
67
+ - Updated dependencies [07d0489aaaf]
68
+ - Updated dependencies [189240aa3cb]
69
+ - Updated dependencies [189240aa3cb]
70
+ - Updated dependencies [3d7ea2b9eaf]
71
+ - Updated dependencies [cea1b781e34]
72
+ - Updated dependencies [32a0382dc0d]
73
+ - Updated dependencies [32a0382dc0d]
74
+ - Updated dependencies [32a0382dc0d]
75
+ - Updated dependencies [3cae620b5f9]
76
+ - Updated dependencies [32a0382dc0d]
77
+ - Updated dependencies [1dad33f83d9]
78
+ - Updated dependencies [5c30a1c62ff]
79
+ - Updated dependencies [03bd33343ab]
80
+ - @redocly/api-docs@0.6.0-next.22
81
+ - @redocly/realm-asyncapi-sdk@0.18.0-next.4
82
+ - @redocly/theme@0.73.0-next.17
83
+ - @redocly/portal-plugin-mock-server@0.26.0-next.7
84
+
3
85
  ## 0.141.0-next.21
4
86
 
5
87
  ### Patch Changes
@@ -418,6 +500,20 @@
418
500
  - Updated dependencies [646e97c1085]
419
501
  - @redocly/api-docs@0.6.0-next.0
420
502
 
503
+ ## 0.140.2
504
+
505
+ ### Patch Changes
506
+
507
+ - e6c79019791: Fixed an issue where OpenAPI documentation and code samples exposed servers restricted by `x-rbac` to readers outside the allowed teams.
508
+ - fd61451fdc1: Hardened validation of authorization requests.
509
+ - 50703ca7061: Hardened authorization request handling.
510
+ - 12784a69c75: Fixed security vulnerabilities `CVE-2026-126355`, `CVE-2026-126356`, `CVE-2026-126357`, `CVE-2026-126358` and `CVE-2026-126359` by upgrading `hono` to version `4.13.18`.
511
+ - 2c23c91ffda: Fixed security vulnerability `CVE-2026-63402` by upgrading `i18next` to version `26.7.2`.
512
+ - Updated dependencies [e6c79019791]
513
+ - Updated dependencies [2c23c91ffda]
514
+ - @redocly/api-docs@0.5.2
515
+ - @redocly/theme@0.72.2
516
+
421
517
  ## 0.140.1
422
518
 
423
519
  ### Patch Changes
@@ -1 +1 @@
1
- import n from"node:path";import{createRequire as c}from"node:module";import{cpSync as m}from"node:fs";import{currentPlatform as a}from"./get-current-platform.js";const r=c(import.meta.url);function f(i){const l=a(),t=r.resolve("@libsql/client"),e=r.resolve("libsql",{paths:[t]}),o=r.resolve(`@libsql/${l}`,{paths:[e]}),s=n.dirname(o);m(s,`${i}/node_modules/@libsql/${l}`,{recursive:!0})}export{f as copyLibsqlPrebuiltBinary};
1
+ import n from"node:path";import{createRequire as a}from"node:module";import{cpSync as m}from"node:fs";import{hasProjectDatabase as c}from"../../../server/providers/database/has-project-database.js";import{currentPlatform as b}from"./get-current-platform.js";const r=a(import.meta.url);function h(e){if(!c())return;const t=b(),i=r.resolve("@libsql/client"),l=r.resolve("libsql",{paths:[i]}),o=r.resolve(`@libsql/${t}`,{paths:[l]}),s=n.dirname(o);m(s,`${e}/node_modules/@libsql/${t}`,{recursive:!0})}export{h as copyLibsqlPrebuiltBinary};
@@ -1 +1 @@
1
- import*as c from"path";import{DEFAULT_THEME_NAME as i,USER_THEME_ALIAS as f}from"../../constants/common.js";import{logger as k}from"../../server/tools/notifiers/logger.js";import{reporter as T}from"../../server/tools/notifiers/reporter.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const C=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],m=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...C],v=["./components/CatalogClassic/CatalogClassicCard.*","./components/ColorModeSwitcher/**","./components/ReplayGate/**","./components/ReplaySecuritySchemeActions/**","./components/ReplayTopBarActions/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/MissingTranslationNotice/**","./components/NavigationTabs/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/CustomContexts.*","./layouts/NotFound.*","./layouts/Forbidden.*","./layouts/McpNotAllowed.*","./layouts/DocumentationLayoutTop.*","./layouts/DocumentationLayoutBottom.*","./icons/**","./markdoc/**","./ext/**"];async function L(t){const[p,r]=t._,{theme:l,force:u,onSuccess:d,onError:g,onOverride:h,config:y}=t,E=F.instance(),s=c.resolve(t["project-dir"]);let o=l;o||(o=i);const n=await A(s,y.plugins||[],o,r);n||await T.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const e=n?.config.ejectIgnore;e&&!Array.isArray(e)&&k.warn("'ejectIgnore' must be of type Array. Skipping.");const a=await E.getPackageEjectIgnore(),_={force:u,onSuccess:d,onError:g,onOverride:h,onlyFiles:o===i?v:void 0,ignoreFiles:Array.isArray(e)?[...e,...a,...m]:[...a,...m]};return{objectType:p,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:c.resolve(s,f),componentToEject:r,theme:o,options:_}}export{m as DEFAULT_IGNORED_FILES,v as EJECTABLE_FILES,L as default};
1
+ import*as c from"path";import{DEFAULT_THEME_NAME as i,USER_THEME_ALIAS as f}from"../../constants/common.js";import{logger as k}from"../../server/tools/notifiers/logger.js";import{reporter as T}from"../../server/tools/notifiers/reporter.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const C=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],m=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...C],v=["./components/AiAssistant/**","./components/CatalogClassic/CatalogClassicCard.*","./components/ColorModeSwitcher/**","./components/ReplayGate/**","./components/ReplaySecuritySchemeActions/**","./components/ReplayTopBarActions/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/MissingTranslationNotice/**","./components/NavigationTabs/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/CustomContexts.*","./layouts/NotFound.*","./layouts/Forbidden.*","./layouts/McpNotAllowed.*","./layouts/DocumentationLayoutTop.*","./layouts/DocumentationLayoutBottom.*","./icons/**","./markdoc/**","./ext/**"];async function L(e){const[p,s]=e._,{theme:l,force:u,onSuccess:d,onError:g,onOverride:h,config:y}=e,E=F.instance(),r=c.resolve(e["project-dir"]);let o=l;o||(o=i);const n=await A(r,y.plugins||[],o,s);n||await T.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const t=n?.config.ejectIgnore;t&&!Array.isArray(t)&&k.warn("'ejectIgnore' must be of type Array. Skipping.");const a=await E.getPackageEjectIgnore(),_={force:u,onSuccess:d,onError:g,onOverride:h,onlyFiles:o===i?v:void 0,ignoreFiles:Array.isArray(t)?[...t,...a,...m]:[...a,...m]};return{objectType:p,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:c.resolve(r,f),componentToEject:s,theme:o,options:_}}export{m as DEFAULT_IGNORED_FILES,v as EJECTABLE_FILES,L as default};
@@ -1,11 +1,10 @@
1
- import e,{useEffect as w,useState as b}from"react";import h from"styled-components";import{Menu as B}from"@redocly/theme/components/Menu/Menu";import{SidebarActions as A}from"@redocly/theme/components/SidebarActions/SidebarActions";import{Sidebar as D}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 C}from"@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon";import{withPathPrefix as x,getBaseDataAttributes as T,generateBeforeAfterContext as M}from"@redocly/theme/core/utils";import{telemetry as v}from"../telemetry/index.js";import{usePreloadHistory as R}from"../usePreloadHistory";import{useTranslate as V}from"../hooks";import{useGlobalData as H}from"../useGlobalData";import{usePageSharedData as q,usePageVersions as F}from"../../providers/page-data/hooks";import{useSidebarItems as j}from"./useSidebarItems";import{renderAdmonition as z,RequestAccessButton as G}from"./RequestAccessButton";import{PoweredByRedocly as K,SidebarFooterControls as O}from"./PoweredByRedocly";function de({layoutControls:l}){const{versions:r=[]}=F()||{},m=r.find(t=>t?.active),{translate:a}=V(),{removeAttribution:g}=H(),{currentItems:c,backLink:n,versionLabel:i,pushDrilldownState:k,popDrilldownState:S}=j(m),[d,E]=b(),{collapsedSidebar:o}=l,u=q("apiDocsStore")?.apiId,y=R(),[p,s]=b(void 0);return w(()=>{const t=setTimeout(()=>s(void 0),350);return()=>clearTimeout(t)},[p]),!c.length&&r.length<2?null:e.createElement(e.Fragment,null,e.createElement(D,{collapsed:o,menuItemsAnimation:p,versions:e.createElement(I,{versions:r,onChange:t=>{v.sendVersionPickerChangedMessage([...M("versionPicker","dropdown",{version:m?.version||""},{version:t?.version||""})]);const f=location.hash?t?.link+location.hash:t?.link;f&&y.push(x(f))}}),menu:e.createElement(B,{items:c,onDrilldownOpen:t=>{s("slideInRight"),k(t)}}),footer:e.createElement("div",{style:{width:"100%"}},!o&&z(d),e.createElement(O,{$collapsed:o},!g&&!o&&e.createElement(K,null),e.createElement(A,{...l,requestAccessButton:u?e.createElement(G,{apiId:u,status:d,setStatus:E}):null}))),header:(n||i)&&e.createElement($,null,n&&e.createElement(J,{icon:e.createElement(C,null),iconPosition:"left",variant:"ghost",size:"medium","data-component-name":"Sidebar/BackButton",to:n.slug,onClick:()=>{s("slideInLeft"),S(),v.sendSidebarDrilldownBackClickedMessage([T("sidebarDrilldownBack","button")])}},o?"":n.label?e.createElement("div",{"data-translation-key":"sidebar.menu.backToLabel"},a("sidebar.menu.backToLabel",{value:a(n.labelTranslationKey,n.label)})):e.createElement("div",{"data-translation-key":"sidebar.menu.backLabel"},a("sidebar.menu.backLabel"))),i&&!o&&e.createElement(P,{version:i}))}))}const $=h.div`
1
+ import e,{useEffect as w,useState as b}from"react";import h from"styled-components";import{Menu as B}from"@redocly/theme/components/Menu/Menu";import{SidebarActions as A}from"@redocly/theme/components/SidebarActions/SidebarActions";import{Sidebar as D}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 C}from"@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon";import{withPathPrefix as x,getBaseDataAttributes as T,generateBeforeAfterContext as M}from"@redocly/theme/core/utils";import{telemetry as k}from"../telemetry/index.js";import{usePreloadHistory as R}from"../usePreloadHistory";import{useTranslate as V}from"../hooks";import{useGlobalData as H}from"../useGlobalData";import{usePageSharedData as q,usePageVersions as F}from"../../providers/page-data/hooks";import{useSidebarItems as j}from"./useSidebarItems";import{renderAdmonition as z,RequestAccessButton as G}from"./RequestAccessButton";import{PoweredByRedocly as K,SidebarFooterControls as O}from"./PoweredByRedocly";function de({layoutControls:l}){const{versions:r=[]}=F()||{},m=r.find(t=>t?.active),{translate:a}=V(),{removeAttribution:g}=H(),{currentItems:c,backLink:n,versionLabel:i,pushDrilldownState:v,popDrilldownState:S}=j(m),[d,E]=b(),{collapsedSidebar:o}=l,u=q("apiDocsStore")?.apiId,y=R(),[p,s]=b(void 0);return w(()=>{const t=setTimeout(()=>s(void 0),350);return()=>clearTimeout(t)},[p]),!c.length&&r.length<2?null:e.createElement(e.Fragment,null,e.createElement(D,{collapsed:o,menuItemsAnimation:p,versions:e.createElement(I,{versions:r,onChange:t=>{k.sendVersionPickerChangedMessage([...M("versionPicker","dropdown",{version:m?.version||""},{version:t?.version||""})]);const f=location.hash?t?.link+location.hash:t?.link;f&&y.push(x(f))}}),menu:e.createElement(B,{items:c,onDrilldownOpen:t=>{s("slideInRight"),v(t)}}),footer:e.createElement("div",{style:{width:"100%"}},!o&&z(d),e.createElement(O,{$collapsed:o},!g&&!o&&e.createElement(K,null),e.createElement(A,{...l,requestAccessButton:u?e.createElement(G,{apiId:u,status:d,setStatus:E}):null}))),header:(n||i)&&e.createElement($,null,n&&e.createElement(J,{icon:e.createElement(C,null),iconPosition:"left",variant:"ghost",size:"medium","data-component-name":"Sidebar/BackButton",to:n.slug,onClick:()=>{s("slideInLeft"),S(),k.sendSidebarDrilldownBackClickedMessage([T("sidebarDrilldownBack","button")])}},o?"":n.label?e.createElement("div",{"data-translation-key":"sidebar.menu.backToLabel"},a("sidebar.menu.backToLabel",{value:a(n.labelTranslationKey,n.label)})):e.createElement("div",{"data-translation-key":"sidebar.menu.backLabel"},a("sidebar.menu.backLabel"))),i&&!o&&e.createElement(P,{version:i}))}))}const $=h.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--menu-header-container-gap);
5
5
  width: 100%;
6
6
  `,J=h(L)`
7
- padding: var(--menu-item-padding-vertical) 0;
8
- height: calc(var(--line-height-base) + var(--menu-item-padding-vertical) * 2);
7
+ padding: 0;
9
8
  justify-content: flex-start;
10
9
  width: 100%;
11
10
  `;export{de as Sidebar};
@@ -3,5 +3,10 @@ export declare function useFetchCatalogEntities({ limit, filter, sort, search }?
3
3
  query: import("@tanstack/react-query").DefinedUseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<BffCatalogEntityList, unknown>, Error>;
4
4
  items: import("@redocly/theme").BffCatalogEntity[];
5
5
  total: number;
6
+ isLoading: false;
7
+ hasMore: boolean;
8
+ isLoadingMore: boolean;
9
+ loadMore: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BffCatalogEntityList, unknown>, Error>>;
10
+ isPlaceholderData: boolean;
6
11
  };
7
12
  //# sourceMappingURL=useFetchCatalogEntities.d.ts.map
@@ -1 +1 @@
1
- import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as u,useRef as w}from"react";import{withPathPrefix as R}from"@redocly/theme/core/utils";import{getNextPageParam as S}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as F}from"./useSearchTracker";function x({limit:o=20,filter:i,sort:s="updated_at",search:n}={},r){const d=r?r.items.map(e=>e.key).join("-"):[],c=w(!0),m=c.current&&r;c.current&&(c.current=!1);const a=y({queryFn:async e=>{const t=new URLSearchParams;i&&t.append("filter",i),s&&t.append("sort",s),o&&t.append("limit",o.toString()),n&&t.append("search",n),e.pageParam&&Object.entries(e.pageParam).forEach(([P,f])=>{f!=null&&t.append(P,f.toString())});const p=new URL(R("/bff/catalog-entities"),window.location.origin);p.search=t.toString();const g=await fetch(p.toString());if(!g.ok)throw new Error(`Failed to fetch catalog entities from ${p.pathname}`);return g.json()},queryKey:["bff/catalog-entities",{limit:o,filter:i,sort:s,search:n,initialDataKeys:d}],initialData:m?{pages:[r],pageParams:[null]}:void 0,initialPageParam:null,getNextPageParam:S,refetchOnMount:!0,placeholderData:e=>e}),l=u(()=>{const e=a.data?.pages||[];return e[e.length-1]?.page.total},[a.data?.pages]),h=u(()=>(a.data?.pages||[]).flatMap(e=>e.items||[]),[a.data?.pages]);return F({isLoading:a.isLoading||a.isFetching,apiResource:"entities",searchQuery:n??""}),{query:a,items:h,total:l}}export{x as useFetchCatalogEntities};
1
+ import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as d,useRef as w}from"react";import{withPathPrefix as x}from"@redocly/theme/core/utils";import{getNextPageParam as D}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as F}from"./useSearchTracker";function j({limit:o=20,filter:i,sort:s="updated_at",search:n}={},r){const u=r?r.items.map(a=>a.key).join("-"):[],c=w(!0),l=c.current&&r;c.current&&(c.current=!1);const e=y({queryFn:async a=>{const t=new URLSearchParams;i&&t.append("filter",i),s&&t.append("sort",s),o&&t.append("limit",o.toString()),n&&t.append("search",n),a.pageParam&&Object.entries(a.pageParam).forEach(([P,p])=>{p!=null&&t.append(P,p.toString())});const g=new URL(x("/bff/catalog-entities"),window.location.origin);g.search=t.toString();const f=await fetch(g.toString());if(!f.ok)throw new Error(`Failed to fetch catalog entities from ${g.pathname}`);return f.json()},queryKey:["bff/catalog-entities",{limit:o,filter:i,sort:s,search:n,initialDataKeys:u}],initialData:l?{pages:[r],pageParams:[null]}:void 0,initialPageParam:null,getNextPageParam:D,refetchOnMount:!0,placeholderData:a=>a}),h=d(()=>{const a=e.data?.pages||[];return a[a.length-1]?.page.total},[e.data?.pages]),m=d(()=>(e.data?.pages||[]).flatMap(a=>a.items||[]),[e.data?.pages]);return F({isLoading:e.isLoading||e.isFetching,apiResource:"entities",searchQuery:n??""}),{query:e,items:m,total:h,isLoading:e.isPending,hasMore:e.hasNextPage,isLoadingMore:e.isFetchingNextPage,loadMore:e.fetchNextPage,isPlaceholderData:e.isPlaceholderData}}export{j as useFetchCatalogEntities};
@@ -5,5 +5,10 @@ export declare function useFetchCatalogEntitiesRelations({ entityKey, limit, fil
5
5
  query: import("@tanstack/react-query").DefinedUseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<BffCatalogRelatedEntityList, unknown>, Error>;
6
6
  items: import("@redocly/theme").BffCatalogRelatedEntity[];
7
7
  total: number;
8
+ isLoading: false;
9
+ hasMore: boolean;
10
+ isLoadingMore: boolean;
11
+ loadMore: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BffCatalogRelatedEntityList, unknown>, Error>>;
12
+ isPlaceholderData: boolean;
8
13
  };
9
14
  //# sourceMappingURL=useFetchCatalogEntitiesRelations.d.ts.map
@@ -1 +1 @@
1
- import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as d,useRef as S}from"react";import{withPathPrefix as F}from"@redocly/theme/core/utils";import{getNextPageParam as R}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as b}from"./useSearchTracker";function E({entityKey:g,limit:o=20,filter:i,sort:s="updated_at",search:r},n){const m=n?n.items.map(e=>e.key).join("-"):[],c=S(!0),l=c.current&&n;c.current&&(c.current=!1);const t=y({queryFn:async e=>{const a=new URLSearchParams;i&&a.append("filter",i),s&&a.append("sort",s),o&&a.append("limit",o.toString()),r&&a.append("search",r),e.pageParam&&Object.entries(e.pageParam).forEach(([w,f])=>{f!=null&&a.append(w,f.toString())});const p=new URL(F(`/bff/catalog-related-entities/${g}`),window.location.origin);p.search=a.toString();const u=await fetch(p.toString());if(!u.ok)throw new Error(`Failed to fetch catalog entity relations from ${p.pathname}`);return u.json()},queryKey:["bff/catalog-entities-relations",{limit:o,filter:i,sort:s,search:r,entityKey:g,initialDataKeys:m}],initialPageParam:null,initialData:l?{pages:[n],pageParams:[null]}:void 0,refetchOnMount:!0,getNextPageParam:R}),h=d(()=>{const e=t.data?.pages||[];return e[e.length-1]?.page?.total},[t.data?.pages]),P=d(()=>(t.data?.pages||[]).flatMap(e=>e.items||[]),[t.data?.pages]);return b({isLoading:t.isLoading||t.isFetching,apiResource:"related_entities",searchQuery:r??""}),{query:t,items:P,total:h}}export{E as useFetchCatalogEntitiesRelations};
1
+ import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as u,useRef as x}from"react";import{withPathPrefix as F}from"@redocly/theme/core/utils";import{getNextPageParam as M}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as S}from"./useSearchTracker";function k({entityKey:p,limit:o=20,filter:i,sort:s="updated_at",search:r},n){const l=n?n.items.map(a=>a.key).join("-"):[],c=x(!0),m=c.current&&n;c.current&&(c.current=!1);const e=y({queryFn:async a=>{const t=new URLSearchParams;i&&t.append("filter",i),s&&t.append("sort",s),o&&t.append("limit",o.toString()),r&&t.append("search",r),a.pageParam&&Object.entries(a.pageParam).forEach(([w,f])=>{f!=null&&t.append(w,f.toString())});const g=new URL(F(`/bff/catalog-related-entities/${p}`),window.location.origin);g.search=t.toString();const d=await fetch(g.toString());if(!d.ok)throw new Error(`Failed to fetch catalog entity relations from ${g.pathname}`);return d.json()},queryKey:["bff/catalog-entities-relations",{limit:o,filter:i,sort:s,search:r,entityKey:p,initialDataKeys:l}],initialPageParam:null,initialData:m?{pages:[n],pageParams:[null]}:void 0,refetchOnMount:!0,getNextPageParam:M}),h=u(()=>{const a=e.data?.pages||[];return a[a.length-1]?.page?.total},[e.data?.pages]),P=u(()=>(e.data?.pages||[]).flatMap(a=>a.items||[]),[e.data?.pages]);return S({isLoading:e.isLoading||e.isFetching,apiResource:"related_entities",searchQuery:r??""}),{query:e,items:P,total:h,isLoading:e.isPending,hasMore:e.hasNextPage,isLoadingMore:e.isFetchingNextPage,loadMore:e.fetchNextPage,isPlaceholderData:e.isPlaceholderData}}export{k as useFetchCatalogEntitiesRelations};
@@ -1 +1 @@
1
- import m,{useMemo as h}from"react";import{parse as p,transform as u,renderers as b,Tag as g,nodes as d}from"@redocly/markdoc";import{CodeBlock as k}from"@redocly/theme/components/CodeBlock/CodeBlock";import{tags as C,components as y}from"@redocly/theme/markdoc/default";const N=Object.fromEntries(Object.entries(y).filter(([,t])=>typeof t=="function")),T=t=>/\{%\s*(?:\/?\w+(?:-\w+)*|\/)(?:\s[^%]*)?(?:\/%|%\})/.test(t),w=(t,e)=>{try{const r=u(t,e);return Array.isArray(r)?r:[r]}catch(r){console.error("Error transforming node:",r)}return[]},l=(t,e,r,n)=>new g("CodeBlock",{...t,header:{title:n,controls:{copy:{}}},source:e,lang:r},[]),A=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"]||"markdoc",c=r["data-title"],o=t.attributes.content||"",a=l(r,o,n,c),s=[];if(!t.children||t.children.length<=1)return{codeNode:a,contentNodes:s};for(const i of t.children){if(!i)continue;const f=w(i,e);s.push(...f)}return{codeNode:a,contentNodes:s}},F=(t,e)=>{const r=t.transformAttributes(e),n=r["data-language"],c=r["data-title"],o=t.attributes.content||"";if(!T(o)||!t.children||t.children.length===0)return l(r,o,n,c);const a=t.children[0];if(!a||a.type!=="tag")return l(r,o,n,c);const{codeNode:s,contentNodes:i}=A(t,e);return new g("Fragment",{},[s,...i])},x=t=>h(()=>{if(!t)return null;const r=p(t),n=u(r,{tags:C,nodes:{document:{...d.document,render:"div"},fence:{...d.fence,attributes:{...d.fence.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform:F}}});return b.react(n,m,{components:{...N,CodeBlock:k,Fragment:m.Fragment}})},[t]);export{T as containsMarkdocTags,x as useMarkdownText};
1
+ import m,{useMemo as h}from"react";import{parse as p,transform as u,renderers as b,Tag as g,nodes as d}from"@redocly/markdoc";import{CodeBlock as C}from"@redocly/theme/components/CodeBlock/CodeBlock";import{tags as k,components as y}from"@redocly/theme/markdoc/default";import{withEmbeddedCodeComponents as w}from"../../../app/markdoc/embedded-code-components.js";const N=Object.fromEntries(Object.entries(y).filter(([,t])=>typeof t=="function")),T=t=>/\{%\s*(?:\/?\w+(?:-\w+)*|\/)(?:\s[^%]*)?(?:\/%|%\})/.test(t),A=(t,r)=>{try{const e=u(t,r);return Array.isArray(e)?e:[e]}catch(e){console.error("Error transforming node:",e)}return[]},l=(t,r,e,n)=>new g("CodeBlock",{...t,header:{title:n,controls:{copy:{}}},source:r,lang:e},[]),F=(t,r)=>{const e=t.transformAttributes(r),n=e["data-language"]||"markdoc",c=e["data-title"],o=t.attributes.content||"",a=l(e,o,n,c),s=[];if(!t.children||t.children.length<=1)return{codeNode:a,contentNodes:s};for(const i of t.children){if(!i)continue;const f=A(i,r);s.push(...f)}return{codeNode:a,contentNodes:s}},M=(t,r)=>{const e=t.transformAttributes(r),n=e["data-language"],c=e["data-title"],o=t.attributes.content||"";if(!T(o)||!t.children||t.children.length===0)return l(e,o,n,c);const a=t.children[0];if(!a||a.type!=="tag")return l(e,o,n,c);const{codeNode:s,contentNodes:i}=F(t,r);return new g("Fragment",{},[s,...i])},O=t=>h(()=>{if(!t)return null;const e=p(t),n=u(e,{tags:k,nodes:{document:{...d.document,render:"div"},fence:{...d.fence,attributes:{...d.fence.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform:M}}});return b.react(n,m,{components:{...w(N),CodeBlock:C,Fragment:m.Fragment}})},[t]);export{T as containsMarkdocTags,O as useMarkdownText};
@@ -1,5 +1,3 @@
1
- export declare const useL10n: () => {
2
- changeLanguage: (lng?: string, callback?: import("i18next").Callback) => Promise<import("i18next").TFunction>;
3
- lang: string;
4
- };
1
+ import type { ThemeHooks } from '@redocly/theme/core/types';
2
+ export declare const useL10n: ThemeHooks['useL10n'];
5
3
  //# sourceMappingURL=useL10n.d.ts.map
@@ -1 +1 @@
1
- import*as o from"react";import{MarkdownAdapterProvider as A,StoreProvider as C,RedocCodeSample as M,appendUndeclaredConfigureParameters as q,excludeMockServers as m,markdocParser as w}from"@redocly/api-docs";import{ErrorMessage as x,OpenApiComponentWrap as I}from"../styled.elements";import{isEmbedTargetWithheld as O,useStore as T}from"../../hooks/use-store";import{findCodeSamplePanel as R}from"../../utils/find-code-sample-panel.js";import{usePortalMarkdownAdapter as b}from"./use-markdown-adapter";function U(d){const{descriptionFile:c,operationId:a,pointer:p,exampleKey:l,mimeType:u,language:n,requestBody:f,parameters:e,options:s,environment:v,environments:y,embedResolved:S}=d,{store:r,error:g,restricted:h}=T(c),k=b(),E=o.useMemo(()=>({specType:"openapi",...r?.options,...s,codeSamples:{...r?.options?.codeSamples,...s?.codeSamples,...n&&{languages:[{lang:n}]}},markdownParser:w}),[n,s,r?.options]),i=o.useMemo(()=>{if(!r?.items?.length)return;const t=R(r.items,{pointer:p,sourceId:a});if(!t)return;const P=q({...t.source,servers:m(t.source.servers)},{...e?.path&&{path:e.path},...e?.query&&{query:e.query},...e?.header&&{headers:e.header},...e?.cookie&&{cookie:e.cookie}});return{...t,...t.servers&&{servers:m(t.servers)},source:P}},[r?.items,p,a,e]);return r?i?o.createElement(I,{"data-testid":"openapi-code-sample"},o.createElement(C,{options:E,apiStore:r.store},o.createElement(A,{value:k},o.createElement(M,{node:i,mimeType:u,exampleKey:l,requestBody:f,parameters:e,environment:v,environments:y})))):O(S)?null:o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation (use pointer or operationId)"):h?null:o.createElement(x,null,g)}export{U as OpenApiCodeSample};
1
+ import*as o from"react";import{MarkdownAdapterProvider as A,StoreProvider as C,RedocCodeSample as q,appendUndeclaredConfigureParameters as w,excludeMockServers as a,markdocParser as x}from"@redocly/api-docs";import{ErrorMessage as I,OpenApiComponentWrap as O}from"../styled.elements";import{isEmbedTargetWithheld as T,useStore as R}from"../../hooks/use-store";import{findCodeSamplePanel as b}from"../../utils/find-code-sample-panel.js";import{usePortalMarkdownAdapter as B}from"./use-markdown-adapter";function j(d){const{descriptionFile:c,operationId:p,pointer:i,exampleKey:l,mimeType:u,language:n,requestBody:f,parameters:r,options:s,environment:v,environments:S,embedResolved:y}=d,{store:e,error:g,restricted:h}=R(c),k=B(),E=o.useMemo(()=>({specType:"openapi",...e?.options,...s,codeSamples:{...e?.options?.codeSamples,...s?.codeSamples,...n&&{languages:[{lang:n}]}},markdownParser:x}),[n,s,e?.options]),m=o.useMemo(()=>{if(!e?.items?.length)return;const t=b(e.items,{pointer:i,sourceId:p});if(!t)return;const M=w({...t.source,servers:a(t.source.servers)},{...r?.path&&{path:r.path},...r?.query&&{query:r.query},...r?.header&&{headers:r.header},...r?.cookie&&{cookie:r.cookie}});return{...t,...t.servers&&{servers:a(t.servers)},source:M}},[e?.items,i,p,r]),P=o.useMemo(()=>e?.store.servers?{...e.store,servers:a(e.store.servers)}:e?.store,[e?.store]);return e?m?o.createElement(O,{"data-testid":"openapi-code-sample"},o.createElement(C,{options:E,apiStore:P},o.createElement(A,{value:k},o.createElement(q,{node:m,mimeType:u,exampleKey:l,requestBody:f,parameters:r,environment:v,environments:S})))):T(y)?null:o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation (use pointer or operationId)"):h?null:o.createElement(I,null,g)}export{j as OpenApiCodeSample};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns The component map for Markdown rendered outside a page's content (API descriptions,
3
+ * `useMarkdownText`): the theme's code block and code group, ejected or not, are wrapped so that
4
+ * they do not take `codeSnippet.previewLines` from the configuration. A project's own components
5
+ * are kept.
6
+ */
7
+ export declare function withEmbeddedCodeComponents<T extends Record<string, unknown>>(components: T): T;
8
+ //# sourceMappingURL=embedded-code-components.d.ts.map
@@ -0,0 +1 @@
1
+ import t from"react";import{normalizePreviewLines as i}from"@redocly/theme/core/utils";import{CodeBlock as d}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as m}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{components as c}from"@redocly/theme/markdoc/default";function s(e){return t.createElement(d,{...e,previewLines:i(e.previewLines)??0})}function f(e){return t.createElement(m,{...e,defaultPreviewLines:0})}const p={CodeBlock:s,CodeGroup:f};function E(e){const r=c,n=Object.entries(p).filter(([o])=>o in e&&e[o]===r[o]);return{...e,...Object.fromEntries(n)}}export{E as withEmbeddedCodeComponents};
@@ -1 +1 @@
1
- import{useCallback as E,useEffect as Q,useMemo as J,useRef as m,useState as y}from"react";import{AiSearchError as d}from"@redocly/theme/core/constants";import{withPathPrefix as N,splitContentByToolCalls as V}from"@redocly/theme/core/utils";import{ServerRoutes as j}from"../../../constants/api";import{useSearchSession as B}from"@redocly/theme/core/contexts";import{AI_SEARCH_REQUEST_HEADERS as D,HTTP_ERROR_MAP as G}from"../../constants";import{useI18nConfig as K,usePageVersions as L}from"../hooks";import{telemetry as U}from"../telemetry/index.js";import{streamSSEMessages as $}from"./sse-parser";import{handleSSEMessage as z}from"./message-handlers";function or(u){const{searchSessionId:p}=B(),[r,t]=y({status:"idle"}),[P,g]=y([]),[S,b]=y([]),o=m(null),a=m(""),n=m(""),i=m([]),{currentLocale:C}=K(),{versions:_=[]}=L()||{},l=_.find(e=>e?.active),f=E(()=>{t({status:"idle",response:""}),b([]),a.current="",n.current="",i.current=[]},[]),w=E(()=>{o.current?.abort(),o.current=null,f(),g([])},[f]);Q(()=>()=>{o.current?.abort()},[]);const O=E(async(e,q)=>{if(!e)return;o.current?.abort();const h=new AbortController;o.current=h,f(),t({status:"loading",question:e,response:"",resources:[]});try{const c=await fetch(N(j.ASK_AI),{method:"POST",headers:D,body:JSON.stringify({text:e,history:q||[],locale:C,product:u?.product,filter:u?.filter,version:l&&{folder:l.folderId,label:l.label},searchSessionId:p}),signal:h.signal});if(!c.ok){t({status:"error",question:e,error:G[c.status]??d.HttpRequestFailed});return}const A=c.body;if(!A){t({status:"error",question:e,error:d.HttpRequestFailed});return}let I=!1;for await(const s of $(A,h.signal)){const F={messageId:a.current,resources:i.current,accumulatedResponse:n.current,setConversation:g,setState:t,setToolCalls:b},{messageId:v,resources:H,accumulatedResponse:M}=z(s,F);v&&(a.current=v),H&&(i.current=H),M&&(n.current=M),s.type==="error"&&(I=!0)}if(o.current=null,t(s=>s.status==="error"?s:n.current?{status:"success",question:e,response:n.current,resources:i.current}:{status:"error",question:e,error:d.EmptyResponse}),!I&&n.current&&e.trim()&&a.current){const s=a.current;U.sendSearchAIQueryMessage([{id:s,object:"aiSearchMessage",uri:`urn:redocly:realm:ui:aiSearchMessage:${s}`,question:e,answer:n.current,resources:JSON.stringify(i.current),searchSessionId:p,messageId:s,source:"realm",...u?.product&&{product:u.product}}])}}catch(c){if(c instanceof Error&&c.name==="AbortError")return;o.current=null,t({status:"error",question:e,error:d.HttpRequestFailed})}},[f,u?.product,C,u?.filter,l,p]),R=r.status==="loading"||r.status==="success"||r.status==="idle"?r.response:void 0,k=J(()=>V(R,S),[R,S]);return{askQuestion:O,isGeneratingResponse:r.status==="loading",response:R,resources:r.status==="loading"||r.status==="success"?r.resources:[],question:r.status!=="idle"?r.question:"",error:r.status==="error"?r.error:null,clearConversation:w,conversation:P,setConversation:g,toolCalls:S,contentSegments:k}}export{or as useAiSearch};
1
+ import{useCallback as E,useEffect as Q,useMemo as J,useRef as d,useState as y}from"react";import{AiSearchError as p}from"@redocly/theme/core/constants";import{withPathPrefix as N,splitContentByToolCalls as V}from"@redocly/theme/core/utils";import{ServerRoutes as j}from"../../../constants/api";import{useSearchSession as B}from"@redocly/theme/core/contexts";import{AI_SEARCH_REQUEST_HEADERS as D,HTTP_ERROR_MAP as G}from"../../constants";import{useI18nConfig as K,usePageVersions as L}from"../hooks";import{telemetry as U}from"../telemetry/index.js";import{streamSSEMessages as $}from"./sse-parser";import{handleSSEMessage as z}from"./message-handlers";function or(u){const{searchSessionId:l}=B(),[r,t]=y({status:"idle"}),[P,g]=y([]),[S,b]=y([]),o=d(null),a=d(""),n=d(""),i=d([]),{currentLocale:C}=K(),{versions:_=[]}=L()||{},f=_.find(e=>e?.active),m=E(()=>{t({status:"idle",response:""}),b([]),a.current="",n.current="",i.current=[]},[]),w=E(()=>{o.current?.abort(),o.current=null,m(),g([])},[m]);Q(()=>()=>{o.current?.abort()},[]);const O=E(async(e,q)=>{if(!e)return;o.current?.abort();const h=new AbortController;o.current=h,m(),t({status:"loading",question:e,response:"",resources:[]});try{const c=await fetch(N(j.ASK_AI),{method:"POST",headers:D,body:JSON.stringify({text:e,history:q||[],locale:C,product:u?.product,filter:u?.filter,version:f&&{folder:f.folderId,label:f.label},searchSessionId:l}),signal:h.signal});if(!c.ok){t({status:"error",question:e,error:G[c.status]??p.HttpRequestFailed});return}const A=c.body;if(!A){t({status:"error",question:e,error:p.HttpRequestFailed});return}let I=!1;for await(const s of $(A,h.signal)){const F={messageId:a.current,resources:i.current,accumulatedResponse:n.current,setConversation:g,setState:t,setToolCalls:b},{messageId:v,resources:H,accumulatedResponse:M}=z(s,F);v&&(a.current=v),H&&(i.current=H),M&&(n.current=M),s.type==="error"&&(I=!0)}if(o.current=null,t(s=>s.status==="error"?s:n.current?{status:"success",question:e,response:n.current,resources:i.current}:{status:"error",question:e,error:p.EmptyResponse}),!I&&n.current&&e.trim()&&a.current&&l){const s=a.current;U.sendSearchAIQueryMessage([{id:s,object:"aiSearchMessage",uri:`urn:redocly:realm:ui:aiSearchMessage:${s}`,question:e,answer:n.current,resources:JSON.stringify(i.current),searchSessionId:l,messageId:s,source:"realm",...u?.product&&{product:u.product}}])}}catch(c){if(c instanceof Error&&c.name==="AbortError")return;o.current=null,t({status:"error",question:e,error:p.HttpRequestFailed})}},[m,u?.product,C,u?.filter,f,l]),R=r.status==="loading"||r.status==="success"||r.status==="idle"?r.response:void 0,k=J(()=>V(R,S),[R,S]);return{askQuestion:O,isGeneratingResponse:r.status==="loading",response:R,resources:r.status==="loading"||r.status==="success"?r.resources:[],question:r.status!=="idle"?r.question:"",error:r.status==="error"?r.error:null,clearConversation:w,conversation:P,setConversation:g,toolCalls:S,contentSegments:k}}export{or as useAiSearch};
@@ -1,5 +1,5 @@
1
- import{useMemo as a,useRef as m}from"react";import{components as c}from"@redocly-markdoc/components";import{schema as s}from"@redocly-markdoc/schema";import{ITEM_ROUTE_PATH_KEYS as u}from"@redocly/api-docs/lib/utils/previous-route-slug.js";import{withPathPrefix as p}from"@redocly/theme/core/utils";import{tags as f,components as l}from"@redocly/theme/markdoc/default";import*as d from"../../app/markdoc/custom-components/index.js";import{parsePartials as g}from"../../../markdoc/helpers/parse-partials.js";import*as w from"../../../markdoc/nodes/index.js";import h from"../../../markdoc/tags/index.js";import{normalizeCustomTags as y}from"../../../markdoc/helpers/normalize-custom-tags.js";import{deepEqual as T}from"../../../utils/object/deep-equal.js";function _(r){return r.map(o=>{const t={...o};for(const n of u){const e=t[n];typeof e=="string"&&(t[n]=p(e))}return Array.isArray(t.items)&&(t.items=_(t.items)),t})}function i(r){const o=m(r);return T(o.current,r)||(o.current=r),o.current}function S(r,o){const t=i(r),n=i(o);return a(()=>{const e=globalThis.__LOADER?.markdocComponents??{};return{...n,...t,tags:{...n?.tags??{},...h,...f,...y(s?.tags??{})},nodes:{...n?.nodes??{},...w,...s?.nodes??{}},functions:{...s?.functions??{}},components:{...n?.components??{},...d,...l,...c,...e},partials:g(t?.partials)}},[t,n])}function $(r){if(typeof window>"u")return null;if(typeof r=="function")return r;if(typeof r!="string")return null;try{const o=r.trim();if(!o.match(/^(\([^)]*\)\s*=>\s*\S.*|[a-zA-Z_$][\w$]*\s*=>\s*\S.*)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(e=>o.includes(e)))throw new Error("Function contains prohibited keywords");return new Function("event",`
1
+ import{useMemo as m,useRef as a}from"react";import{components as c}from"@redocly-markdoc/components";import{schema as s}from"@redocly-markdoc/schema";import{ITEM_ROUTE_PATH_KEYS as u}from"@redocly/api-docs/lib/utils/previous-route-slug.js";import{withPathPrefix as p}from"@redocly/theme/core/utils";import{tags as f,components as l}from"@redocly/theme/markdoc/default";import*as d from"../../app/markdoc/custom-components/index.js";import{withEmbeddedCodeComponents as g}from"../../app/markdoc/embedded-code-components.js";import{parsePartials as w}from"../../../markdoc/helpers/parse-partials.js";import*as h from"../../../markdoc/nodes/index.js";import y from"../../../markdoc/tags/index.js";import{normalizeCustomTags as T}from"../../../markdoc/helpers/normalize-custom-tags.js";import{deepEqual as _}from"../../../utils/object/deep-equal.js";function b(r){return r.map(o=>{const t={...o};for(const n of u){const e=t[n];typeof e=="string"&&(t[n]=p(e))}return Array.isArray(t.items)&&(t.items=b(t.items)),t})}function i(r){const o=a(r);return _(o.current,r)||(o.current=r),o.current}function v(r,o){const t=i(r),n=i(o);return m(()=>{const e=globalThis.__LOADER?.markdocComponents??{};return{...n,...t,tags:{...n?.tags??{},...y,...f,...T(s?.tags??{})},nodes:{...n?.nodes??{},...h,...s?.nodes??{}},functions:{...s?.functions??{}},components:g({...n?.components??{},...d,...l,...c,...e}),partials:w(t?.partials)}},[t,n])}function R(r){if(typeof window>"u")return null;if(typeof r=="function")return r;if(typeof r!="string")return null;try{const o=r.trim();if(!o.match(/^(\([^)]*\)\s*=>\s*\S.*|[a-zA-Z_$][\w$]*\s*=>\s*\S.*)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(e=>o.includes(e)))throw new Error("Function contains prohibited keywords");return new Function("event",`
2
2
  'use strict';
3
3
  const userFn = ${o};
4
4
  return userFn(event);
5
- `)}catch(o){return console.error("Function parsing error:",o),null}}export{_ as applyPathPrefixToApiItems,$ as safeParseFunction,S as useCollectMarkdocOptions};
5
+ `)}catch(o){return console.error("Function parsing error:",o),null}}export{b as applyPathPrefixToApiItems,R as safeParseFunction,v as useCollectMarkdocOptions};