@redocly/realm 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 +44 -0
- package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +45 -0
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.js +1 -0
- package/dist/server/config/env-config.d.ts +2 -0
- package/dist/server/config/env-schema.d.ts +5 -0
- package/dist/server/config/env-schemas/search.d.ts +3 -0
- package/dist/server/config/env-schemas/search.js +1 -1
- package/dist/server/constants/plugins/search.d.ts +0 -2
- package/dist/server/constants/plugins/search.js +1 -1
- package/dist/server/plugins/markdown/utils/sanitize-malformed-md-content.js +2 -2
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/utils.d.ts +2 -1
- package/dist/server/plugins/search/utils.js +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.137.0-next.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4925ce16bea: Fixed an issue in API docs where a schema that inherited its `discriminator` from an `allOf` parent displayed only the discriminator property, without its variants or other properties.
|
|
8
|
+
- 4925ce16bea: Fixed an issue where a variant whose schema was unavailable, such as a schema restricted by RBAC, displayed as an empty option.
|
|
9
|
+
- bff49e7278f: Fixed an issue in OpenAPI docs where selecting an example in the response panel did not update the request code sample.
|
|
10
|
+
The issue occurred when request and response examples shared the same key.
|
|
11
|
+
- ac184788d19: Fixed an issue where angle brackets: `<`, `>` weren't rendered inside inline code within Markdown link text, such as `` [`command <name>`](./page.md) ``.
|
|
12
|
+
- 67c2f278ff4: Fixed an issue where example descriptions weren't rendered in the request and response samples panels.
|
|
13
|
+
Descriptions render as Markdown below the example selector for all languages and include callback payloads and descriptions pre-parsed by the portal.
|
|
14
|
+
- 4925ce16bea: Fixed an issue where code samples omitted the discriminator value of the selected variant.
|
|
15
|
+
- bf3aa0200bf: Improved sidebar accessibility: separators are no longer announced as links by screen readers and no longer receive keyboard focus.
|
|
16
|
+
- 505de02f7b8: Fixed an issue where a search query that contained double characters returned an error.
|
|
17
|
+
- 4925ce16bea: Fixed an issue where a mapping key that pointed to the same schema as `defaultMapping` disappeared from the variant list.
|
|
18
|
+
- 4925ce16bea: Fixed an issue in API docs where the code samples panel displayed no `Discriminator` selector for schemas that inherit their `discriminator` from an `allOf` parent.
|
|
19
|
+
- Updated dependencies [4925ce16bea]
|
|
20
|
+
- Updated dependencies [4925ce16bea]
|
|
21
|
+
- Updated dependencies [bff49e7278f]
|
|
22
|
+
- Updated dependencies [67c2f278ff4]
|
|
23
|
+
- Updated dependencies [4925ce16bea]
|
|
24
|
+
- Updated dependencies [bf3aa0200bf]
|
|
25
|
+
- Updated dependencies [4925ce16bea]
|
|
26
|
+
- Updated dependencies [4925ce16bea]
|
|
27
|
+
- @redocly/api-docs@0.2.0-next.5
|
|
28
|
+
- @redocly/theme@0.69.0-next.5
|
|
29
|
+
- @redocly/asyncapi-docs@1.14.0-next.5
|
|
30
|
+
- @redocly/graphql-docs@1.14.0-next.5
|
|
31
|
+
- @redocly/openapi-docs@3.25.0-next.5
|
|
32
|
+
- @redocly/portal-plugin-mock-server@0.22.0-next.5
|
|
33
|
+
|
|
3
34
|
## 0.137.0-next.4
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -124,6 +155,19 @@
|
|
|
124
155
|
- @redocly/graphql-docs@1.14.0-next.0
|
|
125
156
|
- @redocly/portal-plugin-mock-server@0.22.0-next.0
|
|
126
157
|
|
|
158
|
+
## 0.136.2
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- 7b45d118926: Fixed build and Webview preview failures caused by missing exports in `@xyflow/system`.
|
|
163
|
+
- Updated dependencies [7b45d118926]
|
|
164
|
+
- @redocly/theme@0.68.2
|
|
165
|
+
- @redocly/api-docs@0.1.2
|
|
166
|
+
- @redocly/asyncapi-docs@1.13.2
|
|
167
|
+
- @redocly/graphql-docs@1.13.2
|
|
168
|
+
- @redocly/openapi-docs@3.24.2
|
|
169
|
+
- @redocly/portal-plugin-mock-server@0.21.2
|
|
170
|
+
|
|
127
171
|
## 0.136.1
|
|
128
172
|
|
|
129
173
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MarkdownAdapterProvider as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
2
|
-
${
|
|
1
|
+
function c(n){return n.replace(/\[([^\]]*<[^>]*>[^\]]*)\]\(([^)]+)\)/g,(r,t,s)=>`[${t.replace(/(`+)[^`]+\1|[<>]/g,e=>e==="<"?"<":e===">"?">":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
|
|
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
|
|
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
|
|
2
|
-
`)}export{
|
|
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/realm",
|
|
3
|
-
"version": "0.137.0-next.
|
|
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.
|
|
97
|
-
"@redocly/asyncapi-docs": "1.14.0-next.
|
|
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.
|
|
100
|
-
"@redocly/openapi-docs": "3.25.0-next.
|
|
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.
|
|
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.
|
|
104
|
+
"@redocly/theme": "0.69.0-next.5"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"react": "^19.2.7",
|