@redocly/realm 0.136.0-next.11 → 0.136.0-next.13
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 +28 -0
- package/dist/client/app/search/useSearch.d.ts +1 -0
- package/dist/client/app/search/useSearch.js +1 -1
- package/dist/constants/api.d.ts +1 -0
- package/dist/constants/api.js +1 -1
- package/dist/server/constants/common.d.ts +1 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/constants/plugins/search.d.ts +1 -1
- package/dist/server/constants/plugins/search.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/web-server/routes/ask-ai.d.ts +6 -0
- package/dist/server/web-server/routes/ask-ai.js +1 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/types/api.d.ts +3 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.136.0-next.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 16d0c11a8a7: Fixed an issue where some pages containing curation keywords were missing from search results.
|
|
8
|
+
- 16d0c11a8a7: Fixed an issue where some queries returned multiple search results for the same page.
|
|
9
|
+
- 16d0c11a8a7: Fixed an issue where the **Show more** command would display even though only one search result existed.
|
|
10
|
+
- Updated dependencies [16d0c11a8a7]
|
|
11
|
+
- Updated dependencies [16d0c11a8a7]
|
|
12
|
+
- Updated dependencies [16d0c11a8a7]
|
|
13
|
+
- @redocly/theme@0.68.0-next.8
|
|
14
|
+
- @redocly/api-docs@0.1.0-next.5
|
|
15
|
+
- @redocly/asyncapi-docs@1.13.0-next.11
|
|
16
|
+
- @redocly/graphql-docs@1.13.0-next.11
|
|
17
|
+
- @redocly/openapi-docs@3.24.0-next.11
|
|
18
|
+
- @redocly/portal-plugin-mock-server@0.21.0-next.11
|
|
19
|
+
|
|
20
|
+
## 0.136.0-next.12
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 931df5a101b: Fixed an issue where API docs callbacks failed to render when expanded.
|
|
25
|
+
|
|
26
|
+
Fixed an issue where deep links to callbacks navigated users to the operation instead.
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [931df5a101b]
|
|
29
|
+
- @redocly/api-docs@0.1.0-next.4
|
|
30
|
+
|
|
3
31
|
## 0.136.0-next.11
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ export declare function useSearch(product?: string, disableAutoSearch?: boolean)
|
|
|
8
8
|
isSearchLoading: boolean;
|
|
9
9
|
searchError: string | null;
|
|
10
10
|
facets: SearchFacet[];
|
|
11
|
+
groupCounts: Record<string, number>;
|
|
11
12
|
groupField: string;
|
|
12
13
|
setLoadMore: import("react").Dispatch<import("react").SetStateAction<{
|
|
13
14
|
groupKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as P,useEffect as v,useState as S,useRef as _}from"react";import{SEARCH_DEBOUNCE_TIME_MS as L}from"@redocly/theme/core/constants";import{getBaseDataAttributes as M,withPathPrefix as H}from"@redocly/theme/core/utils";import{ServerRoutes as T}from"../../../constants/api";import{SEARCH_GROUP_FACET_FIELD as j,SEARCH_PRODUCT_FIELD as U,SEARCH_VERSION_FIELD as B}from"../../../constants/common";import{debounce as J}from"../../../utils/time/debounce.js";import{useSearchSession as K}from"@redocly/theme/core/contexts";import{useGlobalData as $,useI18nConfig as k}from"../hooks";import{usePageVersions as z}from"../../providers/page-data/hooks";import{useFacets as W}from"./useFacets";import{telemetry as X}from"../telemetry/index.js";const Y=(o,u,r,l,E,s,R,i,n,d)=>{const{searchSessionId:C}=K(),{currentLocale:F}=k(),f=_(""),p=_(null),h=_(async(e,c)=>{try{R(null);const t=await fetch(H(T.SEARCH),c);if(!t.ok)throw new Error(t.statusText||`Search failed (${t.status})`);if(y(e)){const a=await t.json();l(a.facets),r(a.documents),E(a.groupCounts??{}),p.current=null,e.trim().length>1&&X.sendSearchQueryMessage([{...M("searchQuery","search"),query:e,resultCount:Object.keys(a.documents).length.toString(),searchSessionId:C,...n&&{product:n}}]),s(!1)}}catch(t){if(!y(e))return;p.current={query:e,requestParams:c},r({}),s(!1),R(t instanceof Error?t.message:"An unknown error occurred")}}),y=e=>f.current===e,m=P(J(async(e,c,t,a)=>{if(!e.trim().length&&!c.length){r({}),l({}),E({}),s(!1),R(null),p.current=null;return}const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,filter:x(c,a,i),locale:t})};await h.current(e,g)},L),[i?.version,i?.folderId,n]);return v(()=>{d||(s(!0),m(o,u,F,n),f.current=o)},[d,u,F,n,o,m,s]),{retrySearch:P(async()=>{const e=p.current;e&&(s(!0),f.current=e.query,await h.current(e.query,e.requestParams))},[s])}},Z=(o,u,r,l,E,s,R,i,n,d)=>{const{currentLocale:C}=k();v(()=>{F(r,o,u,C,l,E,n,d)},[l,n,d?.version,d?.folderId]);const F=P(async(f,p,h,y,m,b,e,c)=>{if(m){const{groupKey:t}=m;i(!0);const g={method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:p,filter:(()=>{const I=b.find(D=>D.field===j);let O=h;return I&&(h.find(q=>q.field===I.field)||(O=[...h,{field:I.field,values:[t]}])),x(O,e,c)})(),loadMore:m,locale:y})},w=await(await fetch(H(T.SEARCH),g)).json(),G=f[t]||[],N=w.documents[t]??[],Q={...f,[t]:[...G,...N]};s(Q),w.groupCounts&&R(I=>({...I,...w.groupCounts})),i(!1)}},[]);return{}};function ie(o,u){const{searchFeatures:r}=$(),[l,E]=S(""),[s,R]=S([]),[i,n]=S({}),[d,C]=S({}),[F,f]=S({}),[p,h]=S(),[y,m]=S(!1),[b,e]=S(null),{facets:c}=W(d),{versions:t=[]}=z()||{},a=t.find(A=>A?.active),{retrySearch:g}=Y(l,s,n,C,f,m,e,a,o,u);return Z(l,s,i,p,c,n,f,m,o,a),{query:l,setQuery:E,filter:s,setFilter:R,items:i,isSearchLoading:y,searchError:b,facets:c,groupCounts:F,groupField:j,setLoadMore:h,retrySearch:g,advancedSearch:r?.advanced?.enabled,askAi:r?.ai?.enabled}}function x(o,u,r){return[...o,...u?[{field:U,values:[u]}]:[],...r?[{field:B,values:[...r.default?["default"]:[r.folderId,r.version]]}]:[]]}export{ie as useSearch};
|
package/dist/constants/api.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const ServerRoutes: {
|
|
|
33
33
|
readonly OTEL_TRACES: '/_otel/v1/traces';
|
|
34
34
|
readonly HEALTH: '/_health';
|
|
35
35
|
readonly ASK_AI: '/_ask-ai';
|
|
36
|
+
readonly AI_ASSISTANT_ESCALATIONS: '/_ai-assistant-escalations';
|
|
36
37
|
readonly CATALOG_ENTITIES: "/catalog-entities/:entityId?";
|
|
37
38
|
readonly CATALOG_ENTITIES_RELATIONS: "/catalog-entities-relations/:entityRelationId?";
|
|
38
39
|
readonly BFF_CATALOG_ENTITIES: "/bff/catalog-entities/:entityKey?";
|
package/dist/constants/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _="_auth",e="entityKey",t="entityId",A="entityRelationId",T={CORS_PROXY:"/_api/cors",INFO:"/_info",EJECT_COMPONENT:"/eject-component/:componentName",SHARED_PAGE_DATA:"/page-data/shared/*",PAGE_DATA:"/page-data/*",APP_DATA:"/app-data.json",AUTHORIZATION:"/authorize",OIDC_CALLBACK:`/${_}/oidc`,SAML_CALLBACK:`/${_}/saml2`,REDOCLY_CALLBACK:`/${_}/redocly`,REPLAY_OAUTH2_CALLBACK:`/${_}/replay-oauth2`,REDOCLY_LOGIN_CALLBACK:`/${_}/redocly/redocly-login`,REDOCLY_TOKEN_LOGIN:`/${_}/redocly-token-login`,SEARCH:"/_search",SEARCH_FACETS:"/_search-facets",SEMANTIC_SEARCH:"/_semantic-search",LOGOUT:"/logout",POST_LOGOUT:"/post-logout",LOGIN:"/login",IDP_LOGIN:`/${_}/idp-login`,INVITE:"/invite/:code",RESOLVE_ROUTE_BY_PATH:"/resolve-route-by-path",RESOLVE_ROUTES_BY_PATHS:"/resolve-routes-by-paths",RESOLVE_ROUTE_BY_SLUG:"/resolve-route-by-slug",GET_ROUTES_BY_LINE:"/get-routes-by-line",FEEDBACK:"/feedback",TELEMETRY:"/_events",OTEL_TRACES:"/_otel/v1/traces",HEALTH:"/_health",ASK_AI:"/_ask-ai",AI_ASSISTANT_ESCALATIONS:"/_ai-assistant-escalations",CATALOG_ENTITIES:`/catalog-entities/:${t}?`,CATALOG_ENTITIES_RELATIONS:`/catalog-entities-relations/:${A}?`,BFF_CATALOG_ENTITIES:`/bff/catalog-entities/:${e}?`,BFF_CATALOG_RELATED_ENTITIES:`/bff/catalog-related-entities/:${e}`,BFF_CATALOG_REVISIONS:"/bff/catalog-revisions",MCP_OAUTH_AUTHORIZATION_SERVER:"/.well-known/oauth-authorization-server",MCP_OAUTH_PROTECTED_RESOURCE:"/.well-known/oauth-protected-resource",MCP_DYNAMIC_CLIENT_REGISTRATION:"/_mcp/register",MCP_AUTHORIZATION:"/_mcp/oauth2/auth",MCP_TOKEN_PORTAL:"/_mcp/oauth2/token-portal",MCP_CALLBACK:"/_mcp/oauth/callback",SCORECARDS:"/scorecards"};export{_ as AUTH_SEGMENT,t as CATALOG_ENTITY_ID,e as CATALOG_ENTITY_KEY,A as CATALOG_ENTITY_RELATION_ID,T as ServerRoutes};
|
|
@@ -31,6 +31,7 @@ export declare const BH_API_PROJECTS_URL_V2: string | undefined;
|
|
|
31
31
|
export declare const ENTITLEMENTS_JWKS_URL: string;
|
|
32
32
|
export declare const FEEDBACK_API_URL: string;
|
|
33
33
|
export declare const ASK_AI_API_URL: string;
|
|
34
|
+
export declare const AI_ASSISTANT_ESCALATIONS_API_URL: string;
|
|
34
35
|
export declare const SEMANTIC_SEARCH_API_URL: string;
|
|
35
36
|
export declare const CACHE_CONTROL_NO_STORE_HEADER_VALUE = "no-store";
|
|
36
37
|
export declare const DEFAULT_IMMUTABLE_CACHE_MAX_AGE: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ServerRoutes as I}from"../../constants/api.js";import{USER_THEME_ALIAS as
|
|
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 N="runtime",x="/assets",U="/_spec",a="/_bundle",M="static",P="redocly:::linkOriginal",l="@",i="default",m=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),F="@redocly/theme/plugin.js",H="styles.css",u=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],d=_.JWT_SECRET_KEY||"test_secret_key",G=3600,K=1440*60,c="@i18n",S="@l10n",Y=[L,c,S],B="https://redocly.com/auth/aud",g="catalog.json",h="scorecard.json",J="page-count.json",W="sitemap.xml",f="llms.txt",o=_.PROJECT_ID,R=_.PROJECT_SLUG,e=_.ORGANIZATION_ID,n=_.ORG_SLUG,E=_.BH_API_URL,s=E&&n&&R?`${E}/orgs/${n}/projects/${R}`:void 0,t=E&&e&&o?`${E}/orgs/${e}/projects/${o}`:void 0,p=E?`${E}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",j=_.ENTITLEMENTS_JWKS_CDN_URL||p,k=s?`${s}/feedback`:"",w=t?`${t}/ai-agentic-conversations`:"",$=t?`${t}/ai-assistant-escalations`:"",V=t?`${t}/semantic-search`:"",X="no-store",v=365*24*60*60,y="X-Redocly-Cache-Control",b="no-cache",Z="public, s-maxage=86400, max-age=10, must-revalidate",q=_.AUTH_URL,z="Developer Documentation",T=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",Q=T==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,__=T==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,E_="-----BEGIN CERTIFICATE-----",t_="-----END CERTIFICATE-----",o_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",R_="http://localhost:4318/v1/traces",e_=[I.HEALTH],A=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",n_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(r=>r.trim()).filter(Boolean).concat(A):[A],s_="markdown/partials",T_="markdown/partials-deps";export{$ as AI_ASSISTANT_ESCALATIONS_API_URL,n_ as ALLOWED_CORS_ORIGINS,B as ALTERNATIVE_AUD_CLAIM_NAME,w as ASK_AI_API_URL,q as AUTH_URL,E_ as BEGIN_CERTIFICATE_DELIMITER,s as BH_API_PROJECTS_URL,t as BH_API_PROJECTS_URL_V2,X as CACHE_CONTROL_NO_STORE_HEADER_VALUE,b as CACHE_CONTROL_PUBLIC_HTML,g as CATALOG_OUTPUT_FILE_NAME,v as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,u as DEFAULT_PROJECT_PLUGIN_PATHS,F as DEFAULT_THEME_PLUGIN_PATH,z as DEFAULT_TITLE,i as DEFAULT_VERSION_NAME,U as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,t_ as END_CERTIFICATE_DELIMITER,j as ENTITLEMENTS_JWKS_URL,k as FEEDBACK_API_URL,c as I18N_DIR_NAME,d as JWT_SECRET_KEY,S as L10N_DIR_NAME,P as LINK_ORIGINAL_ATTR_NAME,f as LLMS_TXT_FILE_NAME,s_ as MARKDOC_PARTIALS_DATA_KEY,T_ as MARKDOC_PARTIALS_DEPS_KEY,G as MCP_ACCESS_TOKEN_TTL_SEC,K as MCP_REFRESH_SESSION_LIFETIME_SEC,e as ORG_ID,n as ORG_SLUG,e_ as OTEL_EXCLUDED_ROUTES,R_ as OTEL_TRACES_DEV_URL,J as PAGE_COUNT_OUTPUT_FILE_NAME,o as PROJECT_ID,R as PROJECT_SLUG,a as PUBLIC_API_DEFINITIONS_FOLDER,x as PUBLIC_ASSETS_FOLDER,M as PUBLIC_STATIC_FOLDER,Y as RESERVED_DIR_NAMES,N as RUNTIME_RESOURCES_DIR,h as SCORECARD_OUTPUT_FILE_NAME,V as SEMANTIC_SEARCH_API_URL,A as SERVER_EDITOR_APP_URL,W as SITEMAP_FILE_NAME,T as SSR_RENDER_MODE,__ as SSR_WORKERS_MAX,Q as SSR_WORKERS_MIN,H as STYLES_FILE,o_ as TELEMETRY_ENABLED,m as VERSIONED_FOLDER_REGEXP_MATCH,l as VERSION_SEPARATOR,y as X_REDOCLY_CACHE_CONTROL_HEADER,Z as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
|
|
@@ -5,7 +5,7 @@ export declare const SEARCH_GROUP_NAME_API = "API Reference";
|
|
|
5
5
|
export declare const SEARCH_DATA_EXPORT_FOLDER = "search";
|
|
6
6
|
export declare const SEARCH_LIMIT = 100;
|
|
7
7
|
export declare const SEARCH_GROUP_LIMIT = 10;
|
|
8
|
-
export declare const SEARCH_MAX_FACET_VALUES =
|
|
8
|
+
export declare const SEARCH_MAX_FACET_VALUES = 25;
|
|
9
9
|
export declare const SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT = 100;
|
|
10
10
|
export declare const HIGHLIGHTED_TEXT_MAX_LENGTH = 150;
|
|
11
11
|
export declare const AI_INDEX_EXPORT_FOLDER = "ai-search";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],A="Documentation",o="API Reference",r="search",p=100,T=10,a=
|
|
1
|
+
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],A="Documentation",o="API Reference",r="search",p=100,T=10,a=25,n=100,s=150,c="ai-search",I=50,S=250,C=Symbol("metadata"),R={id:"",url:"",title:"",text:"",security:[],parameters:[{place:"",mediaType:void 0,name:"",description:"",path:[],type:"object",required:!1,example:void 0,enum:void 0}],rbacTeams:[e,t]},D=!0,H=["title"];export{c as AI_INDEX_EXPORT_FOLDER,I as AI_SEARCH_CHUNK_SIZE,S as AI_SEARCH_DOCUMENT_CHUNK_SIZE,R as BASE_SEARCH_DOCUMENT,D as DEFAULT_AI_SEARCH_ENABLED,H as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,s as HIGHLIGHTED_TEXT_MAX_LENGTH,r as SEARCH_DATA_EXPORT_FOLDER,C as SEARCH_DOCUMENT_METADATA_KEY,T as SEARCH_GROUP_LIMIT,o as SEARCH_GROUP_NAME_API,A as SEARCH_GROUP_NAME_DOCUMENTATION,_ as SEARCH_INDEX_FIELDS,p as SEARCH_LIMIT,a as SEARCH_MAX_FACET_VALUES,n as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{appendFile as
|
|
1
|
+
import{appendFile as D}from"node:fs/promises";import{existsSync as P}from"node:fs";import E from"node:path";import{Client as v}from"typesense";import{SEARCH_GROUP_FACET_FIELD as A,SEARCH_PRODUCT_FIELD as L,SEARCH_RBAC_FIELD as T,SEARCH_VERSION_FIELD as h}from"../../../../../constants/common.js";import{BASE_SEARCH_DOCUMENT as j,DISABLE_DEEP_LINK_IF_FIELDS_EXIST as k,HIGHLIGHTED_TEXT_MAX_LENGTH as R,SEARCH_DATA_EXPORT_FOLDER as C,SEARCH_DOCUMENT_METADATA_KEY as w,SEARCH_GROUP_LIMIT as O,SEARCH_MAX_FACET_VALUES as y,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as q}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as N}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as _}from"../../../../config/env-config.js";import{logger as F}from"../../../../tools/notifiers/logger.js";import{ensureDir as b}from"../../../../utils/index.js";class J{#e=null;#a="";#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:L,type:"string",facet:!0,optional:!0},{name:h,type:"object",facet:!0,optional:!0},{name:T,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;#r={ORGANIZATION_ID:_.ORGANIZATION_ID??"",PROJECT_ID:_.PROJECT_ID??"",TYPESENSE_API_URL:_.TYPESENSE_API_URL??"",TYPESENSE_API_KEY:_.TYPESENSE_API_KEY??""};constructor(){if(!_.isBuildMode){for(const[e,t]of Object.entries(this.#r))if(!t)throw new Error(`Cannot initialize search index. ${e} is not set`);this.#a=`${this.#r.ORGANIZATION_ID}_${this.#r.PROJECT_ID}_`,this.#e=new v({nodes:[{url:this.#r.TYPESENSE_API_URL}],apiKey:this.#r.TYPESENSE_API_KEY,connectionTimeoutSeconds:5})}}async initIndexSchema(e){this.#_(e)}async addDocuments(e,t){e.push(j);const{locale:s,outDir:o}=t,r=e.map(n=>{const a={...n},c=n[w];return c&&(c.curated&&(a.metadata_curated=c.curated),c.excludes&&(a.metadata_keywords_excludes=c.excludes),c.includes&&(a.metadata_keywords_includes=c.includes)),a}),i=this.#s.get(s)??[];this.#s.set(s,i.concat(r)),i.length+e.length>=q&&await this.exportDocuments(o)}async search(e,t){return await N("com.redocly.search.performed",async s=>{s?.setAttribute("id","searchQueryId"),s?.setAttribute("object","searchQuery"),s?.setAttribute("uri","urn:redocly:realm:api:searchQuery:searchQueryId");const{query:o,locale:r,filter:i,loadMore:n}=e,a=this.#u(r),c={collection:a,q:o||"*",query_by:this.#f(),max_facet_values:y};if(s?.setAttribute("collectionName",a),s?.setAttribute("locale",r),this.#e)if(n){const{groupKey:l,offset:u}=n,f={offset:u,filter_by:this.#o(t,i),facet_by:"*",per_page:O};return s?.setAttribute("isLoadMore",!0),s?.setAttribute("filter",f.filter_by),this.#m(await this.#e.collections(a).documents().search({...c,...f}),l)}else{const l=this.#o(t,i);s?.setAttribute("filter",l);const u=await this.#e.multiSearch.perform({searches:this.#E(t,i)},c),f=this.#i(u,this.#t.filter(m=>m.facet).map(m=>m.name));f&&F.warn("Search facet requests failed: %s",f);const p=this.#p(u),d=(p[A]??[]).map(m=>m.value);s?.setAttribute("groups",d.join(",")),d.length===y&&F.warn("Search category facet list reached the limit of %s; results for some categories may be missing",y);const I=[...new Set(this.#h(i))].slice(0,y),g=I.length?I:d;if(!g.length)return{facets:p,documents:{},groupCounts:{}};const $=await this.#e.multiSearch.perform({searches:g.map(m=>({filter_by:`${A}:=${this.#n(m)} && ${l}`,per_page:O}))},c),S=this.#i($,g);return S&&F.warn("Search category requests failed: %s",S),this.#d($,g,p,i)}else return{facets:{},documents:{}}})}#m(e,t){const s={facets:{},documents:{[t]:[]},groupCounts:typeof e.found=="number"?{[t]:e.found}:{}};if(e.hits&&e.hits.length)for(const o of e.hits)s.documents[t].push({document:this.#c(o),highlight:this.#l(o)});return s}#p(e){const t={};if("results"in e){for(const s of e.results)if(s.facet_counts&&s.facet_counts.length)for(const o of s.facet_counts)t[o.field_name]=o.counts.map(r=>({value:r.value,count:r.count}))}return t}#i(e,t){return"results"in e?e.results.map((s,o)=>({result:s,label:t[o]})).filter(({result:s})=>"error"in s).map(({result:s,label:o})=>`${o}: ${s.error}`).join("; "):""}#d(e,t,s,o){const r={},i={facets:s,documents:{},groupCounts:r};for(const n of this.#h(o))i.documents[n]=[];return"results"in e&&e.results.forEach((n,a)=>{const c=t[a];typeof n.found=="number"&&(r[c]=n.found);const l=n.hits??[];l.length&&(i.documents[c]=l.map(u=>({document:this.#c(u),highlight:this.#l(u)})))}),i}#c(e){return this.#y(e)}#l(e){const t={},s=[];for(const[o,r]of Object.entries(e.highlight??{}))if(Array.isArray(r)){if(o==="path"){const i=r,n=[];for(const a of i)n.push(a.snippet);t.path=n}else if(o==="parameters"){const i=r;for(const n of i){let a=!1;for(const[c,l]of Object.entries(n))if(c!=="deepLink")if(Array.isArray(l))for(const u of l)u.matched_tokens?.length&&(a=!0);else l.matched_tokens?.length&&(a=!0);if(a){const c={name:n.name?.snippet||"",description:n.description?.snippet||"",place:n.place?.snippet||"",path:n.path?.map(l=>l?.snippet)||[]};t.parameters=[c];break}}}}else t[o]=r.snippet,s.push(o);for(const[o,r]of Object.entries(e.document))!s.includes(o)&&typeof r=="string"&&(t[o]=r.length>R?`${r.substring(0,R)}...`:r);return t.parameters||(t.parameters=[]),t}#y(e){let t;const s=Object.keys(e.highlight??{});for(const r of k)if(s.some(i=>i===r))return e.document;const o=e.highlight?.parameters;if(o){for(const r of o)for(const[i,n]of Object.entries(r))if(i!=="deepLink"){if(Array.isArray(n)){for(const a of n)if(a.matched_tokens?.length){t=r.deepLink?.snippet??t;break}}else if(n.matched_tokens?.length){t=r.deepLink?.snippet??t;break}}}if(t){const r=t.split("#")[1];return{...e.document,url:`${e.document.url}#${r}`}}return e.document}async exportDocuments(e){const t='{"documents":[',s=b(E.join(e,C));for(const[o,r]of this.#s){if(r.length===0)continue;const i=b(E.join(s,`${o}.json`)),n=!P(i),a=JSON.stringify(r).substring(1).slice(0,-1),c=n?t+a:","+a;await D(i,c,{encoding:"utf8"}),this.#s.set(o,[])}}async exportIndexes(e){const t=b(E.join(e,C));for(const s of this.#s.keys()){const o=b(E.join(t,`${s}.json`)),r=`],"schemaFields":${JSON.stringify(this.#t)}}`;await D(o,r,{encoding:"utf8"})}}async import(e){}async countFacets(e,t){return await N("com.redocly.search.facets",async s=>{s?.setAttribute("id","searchFacetsId"),s?.setAttribute("object","searchFacets"),s?.setAttribute("uri","urn:redocly:realm:api:searchFacets:searchFacetsId");const{locale:o,query:r,facetQuery:i,filter:n,field:a}=e,c=this.#u(o),l={q:r||"*",query_by:this.#f(),facet_by:"*",facet_query:this.#g(i,a),filter_by:this.#o(t,n,a),max_facet_values:y};if(s?.setAttribute("collectionName",c),s?.setAttribute("query",l.q),s?.setAttribute("facetQuery",l.facet_query),s?.setAttribute("filter",l.filter_by),this.#e){const u={},f=await this.#e.collections(c).documents().search(l);if(f.facet_counts&&f.facet_counts.length)for(const p of f.facet_counts)u[p.field_name]=p.counts.map(d=>({value:d.value,count:d.count,isCounterVisible:!!r||(n?.length||0)>0}));return u}else return{}})}#u(e){return`${this.#a}${e}`}#_(e){for(const[t,{queryable:s}]of e)this.#t.find(o=>o.name===t)||this.#t.push({queryable:s,name:t,type:"string",facet:!0,optional:!0})}#f(){return this.#t.filter(e=>e.facet?e.queryable:e.queryable!==!1).map(e=>e.name).join(",")}#n(e){return`\`${e.replaceAll("`","")}\``}#o(e,t,s){const o=`${T}:[${e.teams.map(i=>`'${i}'`).join(", ")}]`;let r=`${h}.isDefault:true`;if(t&&t.length){const i=t.filter(a=>a.field!==s&&a.field!==h).map(a=>{const c=a.values.map(l=>this.#n(l));return c.length?`${a.field}:=[${c.join(", ")}]`:""}).join(" && "),n=t.find(a=>a.field===h);if(n&&n.values.length&&n.values.length===2){const a=n.values[0],c=n.values[1],l=`(${h}.folderId:! ${a} && ${h}.isDefault:true)`,u=`(${h}.folderId: ${a} && ${h}.version:=${this.#n(c)})`;r=`(${l} || ${u})`}return i?`${o} && ${i} && ${r}`:`${o} && ${r}`}else return`${o} && ${r}`}#g(e,t){return e&&t?`${t}:${e}`:""}#h(e){const t=[];if(e&&e.length)for(const s of e)s.field===A&&t.push(...s.values);return t}#E(e,t){const s=[],o=this.#t.filter(r=>r.facet);for(const r of o){const i={facet_by:r.name,filter_by:this.#o(e,t,r.name)};s.push(i)}return s}cleanupFacetValues(e){const t=e.getSearchFacets();t.forEach(s=>{s.values=[]}),e.setSearchFacets(t)}}export{J as Typesense};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Handler } from 'hono';
|
|
2
2
|
import type { Store } from '../../store';
|
|
3
3
|
export declare function askAiHandler(store: Store): Handler;
|
|
4
|
+
/**
|
|
5
|
+
* Ticket submissions from the embedded assistant. Proxied for the portal's own org/project so the
|
|
6
|
+
* embedding page never needs those ids, and gated exactly like `/_ask-ai`: escalation is reachable
|
|
7
|
+
* only by portal users who can use AI search.
|
|
8
|
+
*/
|
|
9
|
+
export declare function aiAssistantEscalationsHandler(store: Store): Handler;
|
|
4
10
|
//# sourceMappingURL=ask-ai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RbacFeatures as
|
|
1
|
+
import{RbacFeatures as a}from"../../../constants/common.js";import{ASK_AI_API_URL as c,AI_ASSISTANT_ESCALATIONS_API_URL as u}from"../../constants/common.js";import{fetchWithClient as p}from"../../utils/fetch-with-client.js";import{canAccessFeature as A}from"../../utils/rbac.js";import{handleUnauthorizedApiRequest as h}from"../utils.js";import{isAiSearchEnabled as f}from"../../plugins/search/utils.js";function l(e,t){const o=t.getConfig();return f(o)?A(a.AI_SEARCH,e.get("auth"),o.access?.rbac,o.access?.requiresLogin)?null:h(e):e.newResponse(null,403,{})}function d(e){const t=e.get("auth"),o={"Content-Type":"application/json"},n=[];t.claims?.authCookie&&n.push(`authorization=${t.claims.authCookie}`),t.idpAccessToken&&n.push(`accessToken=${t.idpAccessToken}`),n.length>0&&(o.Cookie=n.join("; "));const s=e.req.header("Authorization");return s&&(o.Authorization=s),o}function i({store:e,apiUrl:t,successContentType:o="application/json"}){return async n=>{if(!t)return n.newResponse(null,404);const s=l(n,e);if(s)return s;const r=await p(t,{method:"POST",body:JSON.stringify(await n.req.json()),headers:d(n)});return n.newResponse(r.body,r.status,{"Content-Type":r.ok?o:"application/json"})}}function y(e){return i({store:e,apiUrl:c,successContentType:"text/event-stream"})}function R(e){return i({store:e,apiUrl:u})}export{R as aiAssistantEscalationsHandler,y as askAiHandler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{serveStatic as
|
|
1
|
+
import{serveStatic as R}from"hono/serve-static";import{withPathPrefix as i,withoutPathPrefix as c}from"@redocly/theme/core/utils";import{ServerRoutes as l}from"../../../constants/api.js";import{PUBLIC_STATIC_FOLDER as H}from"../../constants/common.js";import{envConfig as L}from"../../config/env-config.js";import{authMiddleware as C}from"../middleware/authMiddleware.js";import{ensureSearchData as g}from"../middleware/ensureSearchData.js";import{dynamicMiddleware as I}from"../middleware/dynamic-middleware/dynamic-middleware.js";import{installRoutes as h}from"../../plugins/dev-onboarding/api/routes/index.js";import{installSkillsRoutes as D}from"./skills/skills-routes.js";import{authorizeHandler as P,oidcCallbackHandler as N,logoutHandler as s,postLogoutHandler as w,idpLoginHandler as M,redoclyLoginCallbackHandler as v,samlCallbackHandler as B,redoclyTokenLoginHandler as G,inviteHandler as F}from"./auth.js";import{appDataHandler as U}from"./app-data.js";import{searchFacetsHandler as y,searchHandler as Y}from"./search.js";import{dynamicRouteHandler as k}from"./dynamic-route.js";import{pageDataHandler as K,sharedPageDataHandler as b}from"./page-data.js";import{pathPrefixRedirectHandler as V}from"./path-prefix-redirect.js";import{getRoutesByLineHandler as f,resolvePathHandler as r,resolvePathsHandler as x,resolveSlugHandler as E}from"./resolve-route.js";import{feedbackHandler as q}from"./feedback.js";import{loggerMiddleware as X}from"../middleware/loggerMiddleware.js";import{responseHeadersMiddleware as $}from"../middleware/responseHeadersMiddleware.js";import{idleTimeoutMiddleware as j}from"../middleware/idleTimeoutMiddleware.js";import{otelTracesHandler as u}from"./otel/otel.js";import{healthCheckHandler as z}from"./health.js";import{askAiHandler as W,aiAssistantEscalationsHandler as Z}from"./ask-ai.js";import{semanticSearchHandler as J}from"./semantic-search.js";import{replayOauth2RedirectCallbackHandler as Q}from"./replay-oauth2-redirect.js";import{corsProxyHandler as O}from"./cors-proxy.js";import{corsMiddleware as m}from"../middleware/corsMiddleware.js";import{installApiRoutes as aa}from"./api-routes/api-routes.js";import{cookieMiddleware as ea}from"../middleware/cookieMiddleware.js";import{staticContentHandler as ia}from"../routes/static-content.js";import{infoHandler as _}from"./info.js";import{catalogHandler as la}from"./catalog/catalog.js";import{catalogRelationsHandler as ta}from"./catalog/catalog-relations.js";import{bffCatalogHandler as ma}from"./catalog/bff-catalog.js";import{bffCatalogRevisionsHandler as oa}from"./catalog/bff-catalog-revisions.js";import{bffCatalogRelatedEntitiesHandler as da}from"./catalog/bff-catalog-related-entities.js";import{catalogAuthMiddleware as t}from"../middleware/catalogAuthMiddleware.js";import{telemetryMiddleware as na}from"../middleware/telemetry-middleware.js";import{errorHandler as pa}from"./error.js";import{installMcpRoutes as Aa}from"./mcp-routes/mcp-routes.js";import{jsonValidatorMiddleware as T}from"../middleware/jsonValidatorMiddleware.js";import{searchFacetsRequestSchema as sa}from"../../../api-schemas/search-facets.js";import{searchRequestSchema as fa}from"../../../api-schemas/search.js";function te(a,e,o){const{resolveRouteData:n,readStaticAsset:p}=o;a.use("*",j()),a.use("*",ea()),a.use("*",I(e)),a.use("*",C(e)),a.use("*",X()),a.use("*",$(e)),a.use("*",na()),a.use(i("*"),R({root:`./${H}`,getContent:(d,S)=>ia(d,S,e,p),rewriteRequestPath:d=>c(d)})),a.use(i(l.FEEDBACK),m({allowMethods:["POST"]})),a.use(i(l.ASK_AI),m({allowMethods:["POST"]})),a.use(i(l.AI_ASSISTANT_ESCALATIONS),m({allowMethods:["POST"]})),a.use(i(l.SEMANTIC_SEARCH),m({allowMethods:["POST"]})),a.use("*",ra(e));const A=g(e);a.use(i(l.INFO),_()),L.NEW_CATALOG_ENABLED&&(a.use(i(l.CATALOG_ENTITIES),t({serverOutDir:e.serverOutDir}),la(e)),a.use(i(l.CATALOG_ENTITIES_RELATIONS),t({serverOutDir:e.serverOutDir}),ta(e)),a.get(i(l.BFF_CATALOG_ENTITIES),t({serverOutDir:e.serverOutDir,protectReadMethods:!1}),ma(e)),a.get(i(l.BFF_CATALOG_RELATED_ENTITIES),t({serverOutDir:e.serverOutDir,protectReadMethods:!1}),da(e)),a.get(i(l.BFF_CATALOG_REVISIONS),t({serverOutDir:e.serverOutDir,protectReadMethods:!1}),oa(e))),a.get(i(l.SHARED_PAGE_DATA),b(e)),a.get(i(l.PAGE_DATA),K(e,n)),a.get(i(l.APP_DATA),U(e)),a.post(i(l.SEARCH),A,T(fa),Y(e)),a.post(i(l.SEARCH_FACETS),A,T(sa),y(e)),a.post(i(l.AUTHORIZATION),P),a.post(i(l.LOGOUT),s(e)),a.get(i(l.LOGOUT),s(e)),a.get(i(l.POST_LOGOUT),w(e)),a.get(i(l.OIDC_CALLBACK),N(e)),a.get(i(l.REDOCLY_TOKEN_LOGIN),G(e)),a.get(i(l.REDOCLY_LOGIN_CALLBACK),v()),a.get(i(l.IDP_LOGIN),M(e)),a.post(i(l.SAML_CALLBACK),B(e)),a.get(i(l.INVITE),F(e)),a.get(i(l.HEALTH),z),Aa(a,e),h(a,e),D(a,e),a.all(i(l.CORS_PROXY),O(e)),a.all(i(`${l.CORS_PROXY}/*`),O(e)),aa(a,e),a.post(i(l.FEEDBACK),q(e)),a.post(i(l.RESOLVE_ROUTE_BY_PATH),r(e)),a.post(i(l.RESOLVE_ROUTES_BY_PATHS),x(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),E(e)),a.post(i(l.ASK_AI),W(e)),a.post(i(l.AI_ASSISTANT_ESCALATIONS),Z(e)),a.post(i(l.SEMANTIC_SEARCH),J(e)),a.get(i(l.GET_ROUTES_BY_LINE),f(e)),a.post(i(l.OTEL_TRACES),u),a.get(i(l.REPLAY_OAUTH2_CALLBACK),Q),a.all(i("/*"),k(e,n,p)),a.get("*",V),a.onError(pa)}function ra(a){return async(e,o)=>{await a.waitForPluginsLifecycle(),await o()}}function me(a,e){a.get(i(l.INFO),_()),a.post(i(l.RESOLVE_ROUTE_BY_PATH),r(e)),a.post(i(l.RESOLVE_ROUTE_BY_SLUG),E(e)),a.get(i(l.GET_ROUTES_BY_LINE),f(e))}export{me as installDevRoutes,te as installProdRoutes,ra as waitForPluginsLifecycle};
|
package/dist/types/api.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/realm",
|
|
3
|
-
"version": "0.136.0-next.
|
|
3
|
+
"version": "0.136.0-next.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -93,15 +93,15 @@
|
|
|
93
93
|
"xpath": "0.0.34",
|
|
94
94
|
"yaml-ast-parser": "0.0.43",
|
|
95
95
|
"zod": "^3.25.76",
|
|
96
|
-
"@redocly/api-docs": "0.1.0-next.
|
|
97
|
-
"@redocly/asyncapi-docs": "1.13.0-next.
|
|
96
|
+
"@redocly/api-docs": "0.1.0-next.5",
|
|
97
|
+
"@redocly/asyncapi-docs": "1.13.0-next.11",
|
|
98
98
|
"@redocly/config": "0.53.1",
|
|
99
|
-
"@redocly/graphql-docs": "1.13.0-next.
|
|
100
|
-
"@redocly/openapi-docs": "3.24.0-next.
|
|
99
|
+
"@redocly/graphql-docs": "1.13.0-next.11",
|
|
100
|
+
"@redocly/openapi-docs": "3.24.0-next.11",
|
|
101
101
|
"@redocly/portal-legacy-ui": "0.19.0-next.0",
|
|
102
|
-
"@redocly/portal-plugin-mock-server": "0.21.0-next.10",
|
|
103
102
|
"@redocly/realm-asyncapi-sdk": "0.14.0-next.3",
|
|
104
|
-
"@redocly/theme": "0.68.0-next.
|
|
103
|
+
"@redocly/theme": "0.68.0-next.8",
|
|
104
|
+
"@redocly/portal-plugin-mock-server": "0.21.0-next.11"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"react": "^19.2.7",
|