@redocly/revel 0.137.0-next.4 → 0.137.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @redocly/revel
2
2
 
3
+ ## 0.137.0-next.5
4
+
5
+ ### Patch Changes
6
+
7
+ - ac184788d19: Fixed an issue where angle brackets: `<`, `>` weren't rendered inside inline code within Markdown link text, such as `` [`command <name>`](./page.md) ``.
8
+ - bf3aa0200bf: Improved sidebar accessibility: separators are no longer announced as links by screen readers and no longer receive keyboard focus.
9
+ - 505de02f7b8: Fixed an issue where a search query that contained double characters returned an error.
10
+ - Updated dependencies [4925ce16bea]
11
+ - Updated dependencies [4925ce16bea]
12
+ - Updated dependencies [bff49e7278f]
13
+ - Updated dependencies [67c2f278ff4]
14
+ - Updated dependencies [4925ce16bea]
15
+ - Updated dependencies [bf3aa0200bf]
16
+ - Updated dependencies [4925ce16bea]
17
+ - Updated dependencies [4925ce16bea]
18
+ - @redocly/api-docs@0.2.0-next.5
19
+ - @redocly/theme@0.69.0-next.5
20
+ - @redocly/asyncapi-docs@1.14.0-next.5
21
+ - @redocly/graphql-docs@1.14.0-next.5
22
+ - @redocly/openapi-docs@3.25.0-next.5
23
+ - @redocly/portal-plugin-mock-server@0.22.0-next.5
24
+
3
25
  ## 0.137.0-next.4
4
26
 
5
27
  ### Patch Changes
@@ -115,6 +137,19 @@
115
137
  - @redocly/graphql-docs@1.14.0-next.0
116
138
  - @redocly/portal-plugin-mock-server@0.22.0-next.0
117
139
 
140
+ ## 0.136.2
141
+
142
+ ### Patch Changes
143
+
144
+ - 7b45d118926: Fixed build and Webview preview failures caused by missing exports in `@xyflow/system`.
145
+ - Updated dependencies [7b45d118926]
146
+ - @redocly/theme@0.68.2
147
+ - @redocly/api-docs@0.1.2
148
+ - @redocly/asyncapi-docs@1.13.2
149
+ - @redocly/graphql-docs@1.13.2
150
+ - @redocly/openapi-docs@3.24.2
151
+ - @redocly/portal-plugin-mock-server@0.21.2
152
+
118
153
  ## 0.136.1
119
154
 
120
155
  ### Patch Changes
@@ -1 +1 @@
1
- import{MarkdownAdapterProvider as l,RedocSchema as h,StoreProvider as f,createMarkdocAdapter as k,markdocParser as u}from"@redocly/api-docs";import*as e from"react";import{Admonition as E}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{MarkdownLink as v}from"@redocly/theme/markdoc/components/MarkdownLink/MarkdownLink";import{link as A}from"../../../../../markdoc/nodes/index.js";import{OpenApiComponentWrap as P}from"../styled.elements";const a={nodes:{link:A},components:{MarkdownLink:v}};function S(m){const{options:s,title:t,schemaResolved:o,schemaResolvedErrors:n,schema:r}=m,i=e.useMemo(()=>k(a),[]);if(r||o){const c={openapi:"3.0.0",info:{version:"1",description:"test",title:"test"},paths:{},"x-root":o?.components?.schemas?.__root||r,components:{schemas:{...o?.components?.schemas}}};return e.createElement(P,{"data-testid":"json-schema"},t?e.createElement("h3",null,t):null,e.createElement(f,{options:{...s,markdocOptions:a,markdownParser:u},definition:c},e.createElement(l,{value:i},n?.length?e.createElement(E,{name:"Problem in json-schema tag",type:"danger"},n.map((p,d)=>e.createElement("div",{key:d},p))):null,e.createElement(h,{pointer:"#/x-root",disableDeepLinks:!0}))))}}export{S as JsonSchema};
1
+ import{MarkdownAdapterProvider as d,RedocSchema as l,StoreProvider as h,markdocParser as f}from"@redocly/api-docs";import*as e from"react";import{Admonition as k}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{OpenApiComponentWrap as u}from"../styled.elements";import{markdocOptions as E,usePortalMarkdownAdapter as v}from"./use-markdown-adapter";function g(a){const{options:m,title:o,schemaResolved:t,schemaResolvedErrors:r,schema:n}=a,s=v();if(n||t){const i={openapi:"3.0.0",info:{version:"1",description:"test",title:"test"},paths:{},"x-root":t?.components?.schemas?.__root||n,components:{schemas:{...t?.components?.schemas}}};return e.createElement(u,{"data-testid":"json-schema"},o?e.createElement("h3",null,o):null,e.createElement(h,{options:{...m,markdocOptions:E,markdownParser:f},definition:i},e.createElement(d,{value:s},r?.length?e.createElement(k,{name:"Problem in json-schema tag",type:"danger"},r.map((c,p)=>e.createElement("div",{key:p},c))):null,e.createElement(l,{pointer:"#/x-root",disableDeepLinks:!0}))))}}export{g as JsonSchema};
@@ -1 +1 @@
1
- import*as o from"react";import{StoreProvider as h,RedocCodeSample as k,appendUndeclaredConfigureParameters as C,excludeMockServers as i,markdocParser as E}from"@redocly/api-docs";import{ErrorMessage as P,OpenApiComponentWrap as q}from"../styled.elements";import{useStore as x}from"../../hooks/use-store";import{findCodeSamplePanel as I}from"../../utils/find-code-sample-panel.js";function B(m){const{descriptionFile:d,operationId:s,pointer:a,exampleKey:c,mimeType:u,language:t,requestBody:l,parameters:e,environment:f,environments:v}=m,{store:r,error:y}=x(d),g=o.useMemo(()=>({specType:"openapi",...r?.options,...t&&{codeSamples:{languages:[{lang:t??""}]}},markdownParser:E}),[t,r?.options]),p=o.useMemo(()=>{if(!r?.items?.length)return;const n=I(r.items,{pointer:a,sourceId:s});if(!n)return;const S=C({...n.source,servers:i(n.source.servers)},{...e?.path&&{path:e.path},...e?.query&&{query:e.query},...e?.header&&{headers:e.header},...e?.cookie&&{cookie:e.cookie}});return{...n,...n.servers&&{servers:i(n.servers)},source:S}},[r?.items,a,s,e]);return r?p?o.createElement(q,{"data-testid":"openapi-code-sample"},o.createElement(h,{options:g,apiStore:r.store},o.createElement(k,{node:p,mimeType:u,exampleKey:c,requestBody:l,parameters:e,environment:f,environments:v}))):o.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation (use pointer or operationId)"):o.createElement(P,null,y)}export{B as OpenApiCodeSample};
1
+ import*as r from"react";import{MarkdownAdapterProvider as P,StoreProvider as h,RedocCodeSample as E,appendUndeclaredConfigureParameters as A,excludeMockServers as i,markdocParser as C}from"@redocly/api-docs";import{ErrorMessage as M,OpenApiComponentWrap as q}from"../styled.elements";import{useStore as w}from"../../hooks/use-store";import{findCodeSamplePanel as x}from"../../utils/find-code-sample-panel.js";import{usePortalMarkdownAdapter as I}from"./use-markdown-adapter";function F(m){const{descriptionFile:d,operationId:a,pointer:s,exampleKey:c,mimeType:u,language:n,requestBody:l,parameters:e,environment:f,environments:v}=m,{store:o,error:y}=w(d),g=I(),k=r.useMemo(()=>({specType:"openapi",...o?.options,...n&&{codeSamples:{languages:[{lang:n??""}]}},markdownParser:C}),[n,o?.options]),p=r.useMemo(()=>{if(!o?.items?.length)return;const t=x(o.items,{pointer:s,sourceId:a});if(!t)return;const S=A({...t.source,servers:i(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:i(t.servers)},source:S}},[o?.items,s,a,e]);return o?p?r.createElement(q,{"data-testid":"openapi-code-sample"},r.createElement(h,{options:k,apiStore:o.store},r.createElement(P,{value:g},r.createElement(E,{node:p,mimeType:u,exampleKey:c,requestBody:l,parameters:e,environment:f,environments:v})))):r.createElement("pre",{style:{color:"red"}},"Cannot find OpenAPI operation (use pointer or operationId)"):r.createElement(M,null,y)}export{F as OpenApiCodeSample};
@@ -1 +1 @@
1
- import*as e from"react";import{RedocExample as m,StoreProvider as s,markdocParser as c}from"@redocly/api-docs";import{ErrorMessage as l,OpenApiComponentWrap as d}from"../styled.elements";import{useStore as E}from"../../hooks/use-store";function y(o){const{descriptionFile:t,pointer:p,options:n,mimeType:i}=o,{store:r,error:a}=E(t);return r?e.createElement(d,{"data-testid":"openapi-example"},e.createElement(s,{options:{specType:"openapi",...r.options,...n,markdownParser:c},apiStore:r.store},e.createElement(m,{pointer:p,mimeType:i||"application/json"}))):e.createElement(l,null,a)}export{y as OpenApiExample};
1
+ import*as e from"react";import{MarkdownAdapterProvider as s,RedocExample as c,StoreProvider as d,markdocParser as l}from"@redocly/api-docs";import{ErrorMessage as E,OpenApiComponentWrap as f}from"../styled.elements";import{useStore as u}from"../../hooks/use-store";import{usePortalMarkdownAdapter as k}from"./use-markdown-adapter";function v(o){const{descriptionFile:t,pointer:p,options:a,mimeType:n}=o,{store:r,error:i}=u(t),m=k();return r?e.createElement(f,{"data-testid":"openapi-example"},e.createElement(d,{options:{specType:"openapi",...r.options,...a,markdownParser:l},apiStore:r.store},e.createElement(s,{value:m},e.createElement(c,{pointer:p,mimeType:n||"application/json"})))):e.createElement(E,null,i)}export{v as OpenApiExample};
@@ -1 +1 @@
1
- import*as o from"react";import{StoreProvider as l,RedocResponseSamples as d,markdocParser as c}from"@redocly/api-docs";import{ErrorMessage as n,OpenApiComponentWrap as f}from"../styled.elements";import{useStore as u}from"../../hooks/use-store";import{findResponseSamples as S}from"../../utils/find-openapi-response-samples.js";function g(s){const{descriptionFile:t,operationId:p,pointer:a,exampleKey:i}=s,{store:e,error:m}=u(t);if(!e)return o.createElement(n,null,m);const r=e.items?.length?S(e.items,{pointer:a,sourceId:p}):void 0;return r?.responseCodes.length?o.createElement(f,{"data-testid":"openapi-response-sample"},o.createElement(l,{options:{...e.options,specType:"openapi",markdownParser:c},apiStore:e.store},o.createElement(d,{responseCodes:r.responseCodes,exampleKey:i,schemaId:r.schemaId}))):o.createElement(n,null,"Cannot find response samples for the given operation")}export{g as OpenApiResponseSample};
1
+ import*as e from"react";import{MarkdownAdapterProvider as l,RedocResponseSamples as c,StoreProvider as f,markdocParser as u}from"@redocly/api-docs";import{ErrorMessage as t,OpenApiComponentWrap as E}from"../styled.elements";import{useStore as S}from"../../hooks/use-store";import{findResponseSamples as P}from"../../utils/find-openapi-response-samples.js";import{usePortalMarkdownAdapter as h}from"./use-markdown-adapter";function v(n){const{descriptionFile:s,operationId:p,pointer:a,exampleKey:m}=n,{store:r,error:i}=S(s),d=h();if(!r)return e.createElement(t,null,i);const o=r.items?.length?P(r.items,{pointer:a,sourceId:p}):void 0;return o?.responseCodes.length?e.createElement(E,{"data-testid":"openapi-response-sample"},e.createElement(f,{options:{...r.options,specType:"openapi",markdownParser:u},apiStore:r.store},e.createElement(l,{value:d},e.createElement(c,{responseCodes:o.responseCodes,exampleKey:m,schemaId:o.schemaId})))):e.createElement(t,null,"Cannot find response samples for the given operation")}export{v as OpenApiResponseSample};
@@ -0,0 +1,45 @@
1
+ import type { MarkdownAdapter } from '@redocly/api-docs';
2
+ import { MarkdownLink } from '@redocly/theme/markdoc/components/MarkdownLink/MarkdownLink';
3
+ /** Routes description links through portal `Link` (path prefix, locale, etc.). */
4
+ export declare const markdocOptions: {
5
+ nodes: {
6
+ link: {
7
+ attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute>;
8
+ slots?: Record<string, import("@markdoc/markdoc").SchemaSlot>;
9
+ selfClosing?: boolean;
10
+ inline?: boolean;
11
+ transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
12
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
13
+ tags: Record<string, import("@markdoc/markdoc").Schema>;
14
+ variables: Record<string, any>;
15
+ functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
16
+ partials: Record<string, any>;
17
+ validation?: {
18
+ parents?: import("@markdoc/markdoc").Node[];
19
+ validateFunctions?: boolean;
20
+ environment?: string;
21
+ };
22
+ }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
23
+ validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
24
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
25
+ tags: Record<string, import("@markdoc/markdoc").Schema>;
26
+ variables: Record<string, any>;
27
+ functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
28
+ partials: Record<string, any>;
29
+ validation?: {
30
+ parents?: import("@markdoc/markdoc").Node[];
31
+ validateFunctions?: boolean;
32
+ environment?: string;
33
+ };
34
+ }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").ValidationError[]>;
35
+ description?: string;
36
+ render: string;
37
+ children: string[];
38
+ };
39
+ };
40
+ components: {
41
+ MarkdownLink: typeof MarkdownLink;
42
+ };
43
+ };
44
+ export declare function usePortalMarkdownAdapter(): MarkdownAdapter;
45
+ //# sourceMappingURL=use-markdown-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ import*as o from"react";import{createMarkdocAdapter as r}from"@redocly/api-docs";import{MarkdownLink as t}from"@redocly/theme/markdoc/components/MarkdownLink/MarkdownLink";import{link as e}from"../../../../../markdoc/nodes/index.js";const n={nodes:{link:e},components:{MarkdownLink:t}};function i(){return o.useMemo(()=>r(n),[])}export{n as markdocOptions,i as usePortalMarkdownAdapter};
@@ -56,6 +56,7 @@ declare function loadEnvConfig(): {
56
56
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
57
57
  SEARCH_DEV_REINIT?: string | undefined;
58
58
  SEARCH_DEV_DEBUG: boolean;
59
+ REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
59
60
  TYPESENSE_API_URL?: string | undefined;
60
61
  TYPESENSE_API_KEY?: string | undefined;
61
62
  MAIN_API_URL?: string | undefined;
@@ -137,6 +138,7 @@ export declare const envConfig: {
137
138
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
138
139
  SEARCH_DEV_REINIT?: string | undefined;
139
140
  SEARCH_DEV_DEBUG: boolean;
141
+ REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
140
142
  TYPESENSE_API_URL?: string | undefined;
141
143
  TYPESENSE_API_KEY?: string | undefined;
142
144
  MAIN_API_URL?: string | undefined;
@@ -61,6 +61,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
61
61
  } & {
62
62
  SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
63
63
  SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
64
+ REDOCLY_SKIP_TYPESENSE_INDEXING: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
64
65
  TYPESENSE_API_URL: z.ZodOptional<z.ZodString>;
65
66
  TYPESENSE_API_KEY: z.ZodOptional<z.ZodString>;
66
67
  } & {
@@ -138,6 +139,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
138
139
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
139
140
  SEARCH_DEV_REINIT?: string | undefined;
140
141
  SEARCH_DEV_DEBUG: boolean;
142
+ REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
141
143
  TYPESENSE_API_URL?: string | undefined;
142
144
  TYPESENSE_API_KEY?: string | undefined;
143
145
  MAIN_API_URL?: string | undefined;
@@ -209,6 +211,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
209
211
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
210
212
  SEARCH_DEV_REINIT?: string | undefined;
211
213
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
214
+ REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
212
215
  TYPESENSE_API_URL?: string | undefined;
213
216
  TYPESENSE_API_KEY?: string | undefined;
214
217
  MAIN_API_URL?: string | undefined;
@@ -280,6 +283,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
280
283
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
281
284
  SEARCH_DEV_REINIT?: string | undefined;
282
285
  SEARCH_DEV_DEBUG: boolean;
286
+ REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
283
287
  TYPESENSE_API_URL?: string | undefined;
284
288
  TYPESENSE_API_KEY?: string | undefined;
285
289
  MAIN_API_URL?: string | undefined;
@@ -351,6 +355,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
351
355
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
352
356
  SEARCH_DEV_REINIT?: string | undefined;
353
357
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
358
+ REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
354
359
  TYPESENSE_API_URL?: string | undefined;
355
360
  TYPESENSE_API_KEY?: string | undefined;
356
361
  MAIN_API_URL?: string | undefined;
@@ -5,16 +5,19 @@ import { z } from 'zod';
5
5
  export declare const searchSchema: z.ZodObject<{
6
6
  SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
7
7
  SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
8
+ REDOCLY_SKIP_TYPESENSE_INDEXING: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
8
9
  TYPESENSE_API_URL: z.ZodOptional<z.ZodString>;
9
10
  TYPESENSE_API_KEY: z.ZodOptional<z.ZodString>;
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  SEARCH_DEV_REINIT?: string | undefined;
12
13
  SEARCH_DEV_DEBUG: boolean;
14
+ REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
13
15
  TYPESENSE_API_URL?: string | undefined;
14
16
  TYPESENSE_API_KEY?: string | undefined;
15
17
  }, {
16
18
  SEARCH_DEV_REINIT?: string | undefined;
17
19
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
20
+ REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
18
21
  TYPESENSE_API_URL?: string | undefined;
19
22
  TYPESENSE_API_KEY?: string | undefined;
20
23
  }>;
@@ -1 +1 @@
1
- import{z as o}from"zod";import{envBooleanStringDefaultFalse as t}from"../../utils/envs/env-boolean-string.js";const n=o.object({SEARCH_DEV_REINIT:o.string().optional(),SEARCH_DEV_DEBUG:t(),TYPESENSE_API_URL:o.string().url().optional(),TYPESENSE_API_KEY:o.string().optional()});export{n as searchSchema};
1
+ import{z as E}from"zod";import{envBooleanStringDefaultFalse as o}from"../../utils/envs/env-boolean-string.js";const S=E.object({SEARCH_DEV_REINIT:E.string().optional(),SEARCH_DEV_DEBUG:o(),REDOCLY_SKIP_TYPESENSE_INDEXING:o(),TYPESENSE_API_URL:E.string().url().optional(),TYPESENSE_API_KEY:E.string().optional()});export{S as searchSchema};
@@ -1,4 +1,3 @@
1
- import type { SearchDocument } from '../../types';
2
1
  export declare const SEARCH_INDEX_FIELDS: string[];
3
2
  export declare const SEARCH_GROUP_NAME_DOCUMENTATION = "Documentation";
4
3
  export declare const SEARCH_GROUP_NAME_API = "API Reference";
@@ -12,7 +11,6 @@ export declare const AI_INDEX_EXPORT_FOLDER = "ai-search";
12
11
  export declare const AI_SEARCH_CHUNK_SIZE = 50;
13
12
  export declare const AI_SEARCH_DOCUMENT_CHUNK_SIZE = 250;
14
13
  export declare const SEARCH_DOCUMENT_METADATA_KEY: unique symbol;
15
- export declare const BASE_SEARCH_DOCUMENT: SearchDocument;
16
14
  export declare const DEFAULT_AI_SEARCH_ENABLED = true;
17
15
  export declare const DISABLE_DEEP_LINK_IF_FIELDS_EXIST: string[];
18
16
  //# sourceMappingURL=search.d.ts.map
@@ -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=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
+ const t=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],_="Documentation",E="API Reference",e="search",o=100,A=10,r=25,p=100,I=150,s="ai-search",c=50,R=250,S=Symbol("metadata"),a=!0,n=["title"];export{s as AI_INDEX_EXPORT_FOLDER,c as AI_SEARCH_CHUNK_SIZE,R as AI_SEARCH_DOCUMENT_CHUNK_SIZE,a as DEFAULT_AI_SEARCH_ENABLED,n as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,I as HIGHLIGHTED_TEXT_MAX_LENGTH,e as SEARCH_DATA_EXPORT_FOLDER,S as SEARCH_DOCUMENT_METADATA_KEY,A as SEARCH_GROUP_LIMIT,E as SEARCH_GROUP_NAME_API,_ as SEARCH_GROUP_NAME_DOCUMENTATION,t as SEARCH_INDEX_FIELDS,o as SEARCH_LIMIT,r as SEARCH_MAX_FACET_VALUES,p as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
@@ -1,2 +1,2 @@
1
- function l(r){return r.replace(/\[([^\]]*<[^>]*>[^\]]*)\]\(([^)]+)\)/g,(s,e,t)=>`[${e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}](${t})`).replace(/({%\s*(\w+)(?:\s+[^%]*)?%})(\s*)({%\s*\/\2\s*%})/g,(s,e,t,n,a)=>`${e}
2
- ${a}`)}export{l as sanitizeMalformedMdContent};
1
+ function c(n){return n.replace(/\[([^\]]*<[^>]*>[^\]]*)\]\(([^)]+)\)/g,(r,t,s)=>`[${t.replace(/(`+)[^`]+\1|[<>]/g,e=>e==="<"?"&lt;":e===">"?"&gt;":e)}](${s})`).replace(/({%\s*(\w+)(?:\s+[^%]*)?%})(\s*)({%\s*\/\2\s*%})/g,(r,t,s,l,e)=>`${t}
2
+ ${e}`)}export{c as sanitizeMalformedMdContent};
@@ -1 +1 @@
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
+ import{appendFile as D}from"node:fs/promises";import{existsSync as v}from"node:fs";import b from"node:path";import{Client as N}from"typesense";import{SEARCH_GROUP_FACET_FIELD as A,SEARCH_PRODUCT_FIELD as q,SEARCH_RBAC_FIELD as T,SEARCH_VERSION_FIELD as h}from"../../../../../constants/common.js";import{DISABLE_DEEP_LINK_IF_FIELDS_EXIST as L,HIGHLIGHTED_TEXT_MAX_LENGTH as R,SEARCH_DATA_EXPORT_FOLDER as C,SEARCH_DOCUMENT_METADATA_KEY as j,SEARCH_GROUP_LIMIT as O,SEARCH_MAX_FACET_VALUES as y,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as k}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as P}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 E}from"../../../../utils/index.js";class X{#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:"deprecated",type:"bool",facet:!1,optional:!0,queryable:!1},{name:"parameters",type:"object[]",facet:!1,optional:!0},{name:"parameters.name",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:"parameters.description",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:"parameters.place",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:"parameters.path",type:"string[]",facet:!1,optional:!0,queryable:!1},{name:q,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.#o=`${this.#r.ORGANIZATION_ID}_${this.#r.PROJECT_ID}_`,this.#e=new N({nodes:[{url:this.#r.TYPESENSE_API_URL}],apiKey:this.#r.TYPESENSE_API_KEY,connectionTimeoutSeconds:5})}}async initIndexSchema(e){this.#_(e)}async addDocuments(e,t){const{locale:s,outDir:a}=t,r=e.map(n=>{const o={...n},c=n[j];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(s)??[];this.#s.set(s,i.concat(r)),i.length+e.length>=k&&await this.exportDocuments(a)}async search(e,t){return await P("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:a,locale:r,filter:i,loadMore:n}=e,o=this.#u(r),c={collection:o,q:a||"*",query_by:this.#f(),max_facet_values:y};if(s?.setAttribute("collectionName",o),s?.setAttribute("locale",r),this.#e)if(n){const{groupKey:l,offset:u}=n,f={offset:u,filter_by:this.#a(t,i),facet_by:"*",per_page:O};return s?.setAttribute("isLoadMore",!0),s?.setAttribute("filter",f.filter_by),this.#p(await this.#e.collections(o).documents().search({...c,...f}),l)}else{const l=this.#a(t,i);s?.setAttribute("filter",l);const u=await this.#e.multiSearch.perform({searches:this.#b(t,i)},c),f=this.#i(u,this.#t.filter(p=>p.facet).map(p=>p.name));f&&F.warn("Search facet requests failed: %s",f);const m=this.#m(u),d=(m[A]??[]).map(p=>p.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:m,documents:{},groupCounts:{}};const $=await this.#e.multiSearch.perform({searches:g.map(p=>({filter_by:`${A}:=${this.#n(p)} && ${l}`,per_page:O}))},c),S=this.#i($,g);return S&&F.warn("Search category requests failed: %s",S),this.#d($,g,m,i)}else return{facets:{},documents:{}}})}#p(e,t){const s={facets:{},documents:{[t]:[]},groupCounts:typeof e.found=="number"?{[t]:e.found}:{}};if(e.hits&&e.hits.length)for(const a of e.hits)s.documents[t].push({document:this.#c(a),highlight:this.#l(a)});return s}#m(e){const t={};if("results"in e){for(const s of e.results)if(s.facet_counts&&s.facet_counts.length)for(const a of s.facet_counts)t[a.field_name]=a.counts.map(r=>({value:r.value,count:r.count}))}return t}#i(e,t){return"results"in e?e.results.map((s,a)=>({result:s,label:t[a]})).filter(({result:s})=>"error"in s).map(({result:s,label:a})=>`${a}: ${s.error}`).join("; "):""}#d(e,t,s,a){const r={},i={facets:s,documents:{},groupCounts:r};for(const n of this.#h(a))i.documents[n]=[];return"results"in e&&e.results.forEach((n,o)=>{const c=t[o];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[a,r]of Object.entries(e.highlight??{}))if(Array.isArray(r)){if(a==="path"){const i=r,n=[];for(const o of i)n.push(o.snippet);t.path=n}else if(a==="parameters"){const i=r;for(const n of i){let o=!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&&(o=!0);else l.matched_tokens?.length&&(o=!0);if(o){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[a]=r.snippet,s.push(a);for(const[a,r]of Object.entries(e.document))!s.includes(a)&&typeof r=="string"&&(t[a]=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 L)if(s.some(i=>i===r))return e.document;const a=e.highlight?.parameters;if(a){for(const r of a)for(const[i,n]of Object.entries(r))if(i!=="deepLink"){if(Array.isArray(n)){for(const o of n)if(o.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=E(b.join(e,C));for(const[a,r]of this.#s){if(r.length===0)continue;const i=E(b.join(s,`${a}.json`)),n=!v(i),o=JSON.stringify(r).substring(1).slice(0,-1),c=n?t+o:","+o;await D(i,c,{encoding:"utf8"}),this.#s.set(a,[])}}async exportIndexes(e){const t=E(b.join(e,C));for(const s of this.#s.keys()){const a=E(b.join(t,`${s}.json`)),r=`],"schemaFields":${JSON.stringify(this.#t)}}`;await D(a,r,{encoding:"utf8"})}}async import(e){}async countFacets(e,t){return await P("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:a,query:r,facetQuery:i,filter:n,field:o}=e,c=this.#u(a),l={q:r||"*",query_by:this.#f(),facet_by:"*",facet_query:this.#g(i,o),filter_by:this.#a(t,n,o),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 m of f.facet_counts)u[m.field_name]=m.counts.map(d=>({value:d.value,count:d.count,isCounterVisible:!!r||(n?.length||0)>0}));return u}else return{}})}#u(e){return`${this.#o}${e}`}#_(e){for(const[t,{queryable:s}]of e)this.#t.find(a=>a.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("`","")}\``}#a(e,t,s){const a=`${T}:[${e.teams.map(i=>`'${i}'`).join(", ")}]`;let r=`${h}.isDefault:true`;if(t&&t.length){const i=t.filter(o=>o.field!==s&&o.field!==h).map(o=>{const c=o.values.map(l=>this.#n(l));return c.length?`${o.field}:=[${c.join(", ")}]`:""}).join(" && "),n=t.find(o=>o.field===h);if(n&&n.values.length&&n.values.length===2){const o=n.values[0],c=n.values[1],l=`(${h}.folderId:! ${o} && ${h}.isDefault:true)`,u=`(${h}.folderId: ${o} && ${h}.version:=${this.#n(c)})`;r=`(${l} || ${u})`}return i?`${a} && ${i} && ${r}`:`${a} && ${r}`}else return`${a} && ${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}#b(e,t){const s=[],a=this.#t.filter(r=>r.facet);for(const r of a){const i={facet_by:r.name,filter_by:this.#a(e,t,r.name)};s.push(i)}return s}cleanupFacetValues(e){const t=e.getSearchFacets();t.forEach(s=>{s.values=[]}),e.setSearchFacets(t)}}export{X as Typesense};
@@ -1 +1 @@
1
- import{DEFAULT_SEARCH_ENGINE as s,REDOCLY_TEAMS_RBAC as E}from"@redocly/config";import{envConfig as c}from"../../config/env-config.js";import{logger as p}from"../../tools/notifiers/logger.js";import{reporter as u}from"../../tools/notifiers/reporter.js";import{prepareSearchDocuments as S}from"./documents/search-documents.js";import{SearchEngine as b}from"./engines/search-engine.js";import{prepareSemanticDocuments as y}from"./ai-indexer/prepare-semantic-documents.js";import{isAiSearchEnabled as D,shouldGenerateEmbeddings as A}from"./utils.js";import{telemetryTraceStep as C}from"../../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as R}from"../../entitlements/entitlements-provider.js";async function k(){let e=!0;return{async afterRoutesCreated(t,n){(c.SEARCH_DEV_REINIT||e)&&await _(t,n),e=!1},id:"search"}}async function _(e,t){await C("com.redocly.build.plugin.search",async n=>{const r=e.getConfig();if(n?.setAttribute("config",JSON.stringify(r.search||{})),r.search?.hide){p.info("Search is disabled in the config, skipping");return}const o=r.search?.engine||s,m=c.isDevelopMode?c.SEARCH_DEV_DEBUG?o:s:o,{l10n:l}=e.getGlobalData(),d=D(r),i=r.access?.rbac?.features?.aiSearch,f=A(r);let a;try{a=new b(m,l)}catch(g){await u.panic(g);return}await a.initIndexSchema(e.getSearchFacets()),e.setSearchEngine(a),e.setGlobalData({searchFeatures:{advanced:{enabled:m!==s&&!r.search?.filters?.hide},ai:{enabled:d,[E]:i&&Object.keys(i).length?i:void 0}}}),await S(t.fs,e,a);const h=R.instance().canAccessFeature("seo")===!0&&r.seo?.llmstxt?.hide!==!0;await y(e,t,{embeddingsEnabled:f,llmstxtEnabled:h})})}export{k as searchPlugin};
1
+ import{DEFAULT_SEARCH_ENGINE as s,REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{envConfig as o}from"../../config/env-config.js";import{logger as E}from"../../tools/notifiers/logger.js";import{reporter as u}from"../../tools/notifiers/reporter.js";import{prepareSearchDocuments as S}from"./documents/search-documents.js";import{SearchEngine as b}from"./engines/search-engine.js";import{prepareSemanticDocuments as D}from"./ai-indexer/prepare-semantic-documents.js";import{isAiSearchEnabled as y,shouldGenerateEmbeddings as A,shouldIndexSearchDocuments as C}from"./utils.js";import{telemetryTraceStep as R}from"../../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as _}from"../../entitlements/entitlements-provider.js";async function B(){let e=!0;return{async afterRoutesCreated(t,n){(o.SEARCH_DEV_REINIT||e)&&await w(t,n),e=!1},id:"search"}}async function w(e,t){await R("com.redocly.build.plugin.search",async n=>{const r=e.getConfig();if(n?.setAttribute("config",JSON.stringify(r.search||{})),r.search?.hide){E.info("Search is disabled in the config, skipping");return}const m=r.search?.engine||s,i=o.isDevelopMode?o.SEARCH_DEV_DEBUG?m:s:m,{l10n:l}=e.getGlobalData(),d=y(r),c=r.access?.rbac?.features?.aiSearch,h=A(r);let a;try{a=new b(i,l)}catch(g){await u.panic(g);return}await a.initIndexSchema(e.getSearchFacets()),e.setSearchEngine(a),e.setGlobalData({searchFeatures:{advanced:{enabled:i!==s&&!r.search?.filters?.hide},ai:{enabled:d,[p]:c&&Object.keys(c).length?c:void 0}}}),C(i)&&await S(t.fs,e,a);const f=_.instance().canAccessFeature("seo")===!0&&r.seo?.llmstxt?.hide!==!0;await D(e,t,{embeddingsEnabled:h,llmstxtEnabled:f})})}export{B as searchPlugin};
@@ -1,7 +1,8 @@
1
- import type { RedoclyConfig } from '@redocly/config';
1
+ import type { RedoclyConfig, SearchEngineType } from '@redocly/config';
2
2
  export declare function isAiSearchEnabled(config: RedoclyConfig): boolean;
3
3
  export declare function isDocsMcpEnabled(config: RedoclyConfig): boolean;
4
4
  export declare function shouldGenerateEmbeddings(config: RedoclyConfig): boolean;
5
+ export declare function shouldIndexSearchDocuments(engine: SearchEngineType): boolean;
5
6
  export declare function getSearchDocumentGroup(documentFacets?: Record<string, string>): string | undefined;
6
7
  export declare function formatDocumentMetadata(metadata?: Record<string, unknown>): string;
7
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1,2 +1,2 @@
1
- import{SEARCH_GROUP_FACET_FIELD as o}from"../../../constants/common.js";import{DEFAULT_AI_SEARCH_ENABLED as s}from"../../constants/plugins/search.js";import{isPrimitive as c}from"../../../utils/guards/is-primitive.js";import{envConfig as i}from"../../config/env-config.js";import{EntitlementsProvider as n}from"../../entitlements/entitlements-provider.js";function a(e){if(i.isDevelopMode)return i.SEARCH_DEV_DEBUG;if(!n.instance().canAccessFeature("aiSearchLimit"))return!1;const t=e.aiAssistant;return typeof t?.hide=="boolean"?!t?.hide:s}function m(e){return n.instance().canAccessFeature("mcp")?!e.mcp?.hide&&!e.mcp?.docs?.hide:!1}function h(e){const r=a(e),t=m(e);return r||t}function l(e){let r;return e&&Object.keys(e).forEach(t=>{t===o&&(r=e[t])}),r}function S(e){return Object.entries(e||{}).map(([r,t])=>` - ${r}: ${c(t)?t:JSON.stringify(t)}`).join(`
2
- `)}export{S as formatDocumentMetadata,l as getSearchDocumentGroup,a as isAiSearchEnabled,m as isDocsMcpEnabled,h as shouldGenerateEmbeddings};
1
+ import{SEARCH_GROUP_FACET_FIELD as o}from"../../../constants/common.js";import{DEFAULT_AI_SEARCH_ENABLED as s}from"../../constants/plugins/search.js";import{isPrimitive as c}from"../../../utils/guards/is-primitive.js";import{envConfig as n}from"../../config/env-config.js";import{EntitlementsProvider as i}from"../../entitlements/entitlements-provider.js";function a(e){if(n.isDevelopMode)return n.SEARCH_DEV_DEBUG;if(!i.instance().canAccessFeature("aiSearchLimit"))return!1;const t=e.aiAssistant;return typeof t?.hide=="boolean"?!t?.hide:s}function u(e){return i.instance().canAccessFeature("mcp")?!e.mcp?.hide&&!e.mcp?.docs?.hide:!1}function S(e){const r=a(e),t=u(e);return(r||t)&&n.isProductionEnv}function l(e){return e==="typesense"?!n.REDOCLY_SKIP_TYPESENSE_INDEXING:!0}function A(e){let r;return e&&Object.keys(e).forEach(t=>{t===o&&(r=e[t])}),r}function D(e){return Object.entries(e||{}).map(([r,t])=>` - ${r}: ${c(t)?t:JSON.stringify(t)}`).join(`
2
+ `)}export{D as formatDocumentMetadata,A as getSearchDocumentGroup,a as isAiSearchEnabled,u as isDocsMcpEnabled,S as shouldGenerateEmbeddings,l as shouldIndexSearchDocuments};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/revel",
3
- "version": "0.137.0-next.4",
3
+ "version": "0.137.0-next.5",
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.2.0-next.4",
97
- "@redocly/asyncapi-docs": "1.14.0-next.4",
96
+ "@redocly/api-docs": "0.2.0-next.5",
97
+ "@redocly/asyncapi-docs": "1.14.0-next.5",
98
98
  "@redocly/config": "0.53.1",
99
- "@redocly/graphql-docs": "1.14.0-next.4",
100
- "@redocly/openapi-docs": "3.25.0-next.4",
99
+ "@redocly/graphql-docs": "1.14.0-next.5",
100
+ "@redocly/openapi-docs": "3.25.0-next.5",
101
101
  "@redocly/portal-legacy-ui": "0.19.0",
102
- "@redocly/portal-plugin-mock-server": "0.22.0-next.4",
102
+ "@redocly/portal-plugin-mock-server": "0.22.0-next.5",
103
103
  "@redocly/realm-asyncapi-sdk": "0.15.0-next.2",
104
- "@redocly/theme": "0.69.0-next.4"
104
+ "@redocly/theme": "0.69.0-next.5"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "react": "^19.2.7",