@redocly/realm 0.130.2 → 0.130.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.130.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b1e533559: Fixed security vulnerability CVE-2026-25128 in fast-xml-parser by upgrading openapi-sampler to version 1.7.0.
8
+ - Updated dependencies [5b1e533559]
9
+ - @redocly/portal-plugin-mock-server@0.15.2
10
+ - @redocly/asyncapi-docs@1.7.2
11
+ - @redocly/openapi-docs@3.18.2
12
+ - @redocly/theme@0.62.1
13
+ - @redocly/graphql-docs@1.7.1
14
+
15
+ ## 0.130.3
16
+
17
+ ### Patch Changes
18
+
19
+ - 0beb1adad0: Fixed a bug where AI search events were not tracked for project analytics.
20
+ - Updated dependencies [e7708a15f1]
21
+ - Updated dependencies [e7708a15f1]
22
+ - @redocly/portal-plugin-mock-server@0.15.1
23
+ - @redocly/asyncapi-docs@1.7.1
24
+ - @redocly/openapi-docs@3.18.1
25
+
3
26
  ## 0.130.2
4
27
 
5
28
  ### Patch Changes
@@ -1 +1 @@
1
- import{useCallback as h,useEffect as J,useMemo as N,useRef as f,useState as C}from"react";import{AiSearchError as m}from"@redocly/theme/core/constants";import{withPathPrefix as V,splitContentByToolCalls as j}from"@redocly/theme/core/utils";import{ServerRoutes as B}from"../../../constants/common";import{useSearchSession as D}from"@redocly/theme/core/contexts";import{AI_SEARCH_REQUEST_HEADERS as G,HTTP_ERROR_MAP as K}from"../../constants";import{useI18nConfig as L,useCurrentProduct as U,usePageVersions as z}from"../hooks";import{telemetry as W}from"../telemetry/index.js";import{streamSSEMessages as X}from"./sse-parser";import{handleSSEMessage as Y}from"./message-handlers";function ue(E){const{searchSessionId:d}=D(),[e,s]=C({status:"idle"}),[w,p]=C([]),[g,b]=C([]),t=f(null),u=f(""),o=f(""),c=f([]),{currentLocale:y}=L(),A=U(),{versions:M=[]}=z()||{},a=M.find(r=>r?.active),i=h(()=>{s({status:"idle",response:""}),b([]),u.current="",o.current="",c.current=[]},[]),O=h(()=>{t.current?.abort(),t.current=null,i(),p([])},[i]);J(()=>()=>{t.current?.abort()},[]);const k=h(async(r,F)=>{if(!r)return;t.current?.abort();const R=new AbortController;t.current=R,i(),s({status:"loading",question:r,response:"",resources:[]});try{const n=await fetch(V(B.ASK_AI),{method:"POST",headers:G,body:JSON.stringify({text:r,history:F||[],locale:y,product:A?.name,filter:E?.filter,version:a&&{folder:a.folderId,label:a.label},searchSessionId:d}),signal:R.signal});if(!n.ok){s({status:"error",question:r,error:K[n.status]??m.HttpRequestFailed});return}const I=n.body;if(!I){s({status:"error",question:r,error:m.HttpRequestFailed});return}for await(const l of X(I,R.signal)){const Q={messageId:u.current,resources:c.current,accumulatedResponse:o.current,setConversation:p,setState:s,setToolCalls:b},{messageId:H,resources:P,accumulatedResponse:_}=Y(l,Q);H&&(u.current=H),P&&(c.current=P),_&&(o.current=_)}t.current=null;let v=!1;s(l=>l.status==="error"?l:o.current?(v=!0,{status:"success",question:r,response:o.current,resources:c.current}):{status:"error",question:r,error:m.EmptyResponse}),v&&r.trim()&&u.current&&W.sendSearchAIQueryMessage([{object:"search",question:r,answer:o.current,resources:JSON.stringify(c.current),searchSessionId:d,messageId:u.current}])}catch(n){if(n instanceof Error&&n.name==="AbortError")return;t.current=null,s({status:"error",question:r,error:m.HttpRequestFailed})}},[i,y,A?.name,E?.filter,a,d]),S=e.status==="loading"||e.status==="success"||e.status==="idle"?e.response:void 0,q=N(()=>j(S,g),[S,g]);return{askQuestion:k,isGeneratingResponse:e.status==="loading",response:S,resources:e.status==="loading"||e.status==="success"?e.resources:[],question:e.status!=="idle"?e.question:"",error:e.status==="error"?e.error:null,clearConversation:O,conversation:w,setConversation:p,toolCalls:g,contentSegments:q}}export{ue as useAiSearch};
1
+ import{useCallback as h,useEffect as J,useMemo as N,useRef as f,useState as E}from"react";import{AiSearchError as m}from"@redocly/theme/core/constants";import{withPathPrefix as V,splitContentByToolCalls as j}from"@redocly/theme/core/utils";import{ServerRoutes as B}from"../../../constants/common";import{useSearchSession as D}from"@redocly/theme/core/contexts";import{AI_SEARCH_REQUEST_HEADERS as G,HTTP_ERROR_MAP as K}from"../../constants";import{useI18nConfig as L,useCurrentProduct as U,usePageVersions as z}from"../hooks";import{telemetry as W}from"../telemetry/index.js";import{streamSSEMessages as X}from"./sse-parser";import{handleSSEMessage as Y}from"./message-handlers";function ur(C){const{searchSessionId:d}=D(),[r,s]=E({status:"idle"}),[w,p]=E([]),[g,b]=E([]),t=f(null),u=f(""),o=f(""),a=f([]),{currentLocale:y}=L(),A=U(),{versions:M=[]}=z()||{},i=M.find(e=>e?.active),l=h(()=>{s({status:"idle",response:""}),b([]),u.current="",o.current="",a.current=[]},[]),O=h(()=>{t.current?.abort(),t.current=null,l(),p([])},[l]);J(()=>()=>{t.current?.abort()},[]);const k=h(async(e,F)=>{if(!e)return;t.current?.abort();const R=new AbortController;t.current=R,l(),s({status:"loading",question:e,response:"",resources:[]});try{const n=await fetch(V(B.ASK_AI),{method:"POST",headers:G,body:JSON.stringify({text:e,history:F||[],locale:y,product:A?.name,filter:C?.filter,version:i&&{folder:i.folderId,label:i.label},searchSessionId:d}),signal:R.signal});if(!n.ok){s({status:"error",question:e,error:K[n.status]??m.HttpRequestFailed});return}const I=n.body;if(!I){s({status:"error",question:e,error:m.HttpRequestFailed});return}let v=!1;for await(const c of X(I,R.signal)){const Q={messageId:u.current,resources:a.current,accumulatedResponse:o.current,setConversation:p,setState:s,setToolCalls:b},{messageId:H,resources:P,accumulatedResponse:_}=Y(c,Q);H&&(u.current=H),P&&(a.current=P),_&&(o.current=_),c.type==="error"&&(v=!0)}t.current=null,s(c=>c.status==="error"?c:o.current?{status:"success",question:e,response:o.current,resources:a.current}:{status:"error",question:e,error:m.EmptyResponse}),!v&&o.current&&e.trim()&&u.current&&W.sendSearchAIQueryMessage([{object:"search",question:e,answer:o.current,resources:JSON.stringify(a.current),searchSessionId:d,messageId:u.current}])}catch(n){if(n instanceof Error&&n.name==="AbortError")return;t.current=null,s({status:"error",question:e,error:m.HttpRequestFailed})}},[l,y,A?.name,C?.filter,i,d]),S=r.status==="loading"||r.status==="success"||r.status==="idle"?r.response:void 0,q=N(()=>j(S,g),[S,g]);return{askQuestion:k,isGeneratingResponse:r.status==="loading",response:S,resources:r.status==="loading"||r.status==="success"?r.resources:[],question:r.status!=="idle"?r.question:"",error:r.status==="error"?r.error:null,clearConversation:O,conversation:w,setConversation:p,toolCalls:g,contentSegments:q}}export{ur as useAiSearch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/realm",
3
- "version": "0.130.2",
3
+ "version": "0.130.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -64,7 +64,7 @@
64
64
  "nanoid": "5.0.9",
65
65
  "node-fetch": "3.3.1",
66
66
  "nprogress": "0.2.0",
67
- "openapi-sampler": "1.6.2",
67
+ "openapi-sampler": "1.7.0",
68
68
  "os-browserify": "0.3.0",
69
69
  "path-browserify": "1.0.1",
70
70
  "picomatch": "2.3.1",
@@ -91,13 +91,13 @@
91
91
  "xpath": "0.0.34",
92
92
  "yaml-ast-parser": "0.0.43",
93
93
  "@redocly/config": "0.42.0",
94
- "@redocly/asyncapi-docs": "1.7.0",
94
+ "@redocly/portal-plugin-mock-server": "0.15.2",
95
+ "@redocly/portal-legacy-ui": "0.13.0",
96
+ "@redocly/graphql-docs": "1.7.1",
97
+ "@redocly/openapi-docs": "3.18.2",
98
+ "@redocly/theme": "0.62.1",
95
99
  "@redocly/realm-asyncapi-sdk": "0.8.1",
96
- "@redocly/openapi-docs": "3.18.0",
97
- "@redocly/theme": "0.62.0",
98
- "@redocly/graphql-docs": "1.7.0",
99
- "@redocly/portal-plugin-mock-server": "0.15.0",
100
- "@redocly/portal-legacy-ui": "0.13.0"
100
+ "@redocly/asyncapi-docs": "1.7.2"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": "^19.2.4",