@redocly/realm 0.137.0-next.8 → 0.137.0
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 +241 -1
- package/dist/cli/build/index.js +1 -1
- package/dist/client/app/Sidebar/useActions.js +1 -1
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
- package/dist/client/app/hooks/catalog/useCatalogFilter.js +1 -1
- package/dist/client/app/search/useFacets.js +1 -1
- package/dist/client/app/seo/SeoTags.js +1 -1
- package/dist/client/app/utils/loadAndNavigate.js +1 -1
- package/dist/client/templates/api-docs/template.js +8 -3
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- 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/feature-flags.d.ts +5 -1
- package/dist/server/config/env-schemas/feature-flags.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.js +1 -1
- package/dist/server/esbuild/esbuild-logger.d.ts +2 -2
- package/dist/server/esbuild/esbuild-logger.js +3 -3
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/search/create-indexer.d.ts +5 -0
- package/dist/server/plugins/api-docs/search/create-indexer.js +1 -0
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +1 -1
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +41 -41
- package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/common/revision-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/common/version-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/utils/normalize-revision-flags.js +1 -1
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditAppDescriptionDialog.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditAppDialog.js +1 -1
- package/dist/server/plugins/dev-onboarding/template/components/EditCallbackUrlDialog.js +1 -1
- package/dist/server/plugins/markdown/is-partial.js +1 -1
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +5 -4
- package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +5 -2
- package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
- package/dist/server/plugins/mcp/codemode/code-execution-audit.js +1 -1
- package/dist/server/plugins/mcp/codemode/prompts.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/prompts.js +7 -6
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.d.ts +2 -2
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.js +1 -11
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.d.ts +2 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.js +7 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.d.ts +1 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.js +2 -2
- package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.d.ts +5 -0
- package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.js +1 -0
- package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.d.ts +8 -0
- package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.js +2 -0
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +3 -1
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.d.ts +2 -2
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/core/types.d.ts +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +5 -5
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +2 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +4 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +6 -2
- package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +11 -0
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -5
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.d.ts +5 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.js +1 -0
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +3 -3
- package/dist/server/plugins/mcp/types.d.ts +1 -0
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +1 -1
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +4 -2
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -3
- package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
- package/dist/server/plugins/search/engines/flexsearch/search-index.d.ts +8 -4
- package/dist/server/plugins/search/engines/flexsearch/search-index.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/build-page-llms-txt-md.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/build-page-llms-txt-md.js +3 -0
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -0
- package/dist/server/plugins/search/llmstxt/get-llms-txt-exclude-matcher.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/get-llms-txt-exclude-matcher.js +1 -0
- package/dist/server/plugins/search/llmstxt/index.d.ts +5 -3
- package/dist/server/plugins/search/llmstxt/index.js +9 -9
- package/dist/server/plugins/search/llmstxt/is-included-in-llms-txt.d.ts +6 -0
- package/dist/server/plugins/search/llmstxt/is-included-in-llms-txt.js +1 -0
- package/dist/server/sandbox/sandbox.js +2 -2
- package/dist/server/sandbox/types.d.ts +9 -0
- package/dist/server/sandbox/utils/execution-budget.js +1 -1
- package/dist/server/sandbox/utils/return-last-expression.d.ts +6 -0
- package/dist/server/sandbox/utils/return-last-expression.js +1 -0
- package/dist/server/sandbox/utils/returns-from-top-level.d.ts +1 -2
- package/dist/server/sandbox/utils/returns-from-top-level.js +1 -1
- package/dist/server/sandbox/utils/setup-host-functions.d.ts +1 -0
- package/dist/server/sandbox/utils/setup-host-functions.js +2 -2
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/search.d.ts +7 -2
- package/dist/server/types/web-server.d.ts +8 -0
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
- package/dist/server/utils/get-route-ai-documents-store.d.ts +5 -0
- package/dist/server/utils/get-route-ai-documents-store.js +1 -0
- package/dist/server/utils/get-route-static-data.d.ts +4 -0
- package/dist/server/utils/get-route-static-data.js +1 -0
- package/dist/server/utils/globs.d.ts +4 -0
- package/dist/server/utils/globs.js +1 -1
- package/dist/server/utils/llmstxt/agent-feedback-llms-footer.js +1 -1
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.d.ts +10 -0
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -0
- package/dist/server/utils/search/highlight-text-for-search.js +1 -1
- package/dist/server/web-server/auth.d.ts +13 -2
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/dev-server.js +1 -1
- package/dist/server/web-server/middleware/ensureSearchData.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/dynamic-route.d.ts +2 -1
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/index.d.ts +2 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/llms-txt.d.ts +4 -0
- package/dist/server/web-server/routes/llms-txt.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
- package/dist/{server/plugins/catalog-entities/utils/version-compare.d.ts → utils/version/compare-versions.d.ts} +1 -16
- package/dist/utils/version/compare-versions.js +1 -0
- package/package.json +13 -12
- package/dist/server/plugins/api-docs/search/search-indexer.d.ts +0 -9
- package/dist/server/plugins/api-docs/search/search-indexer.js +0 -1
- package/dist/server/plugins/catalog-entities/utils/version-compare.js +0 -1
|
@@ -11,7 +11,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
11
11
|
PLAN_GATES: z.ZodOptional<z.ZodString>;
|
|
12
12
|
/** Experimental: append agent feedback instructions to llms.txt Markdown chunks. */
|
|
13
13
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
14
|
-
/** Optional
|
|
14
|
+
/** Optional URL for the agent feedback footer; defaults to `{seo.siteUrl|REDOCLY_PUBLIC_URL}/api/agent-feedback`, or `/api/agent-feedback` on the same origin. */
|
|
15
15
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
16
16
|
/** (Optional) API endpoint for the agent feedback endpoint;**/
|
|
17
17
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
@@ -21,6 +21,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
21
21
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
22
22
|
/** Experimental: register custom MCP tools from `@mcp` folders. */
|
|
23
23
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
24
|
+
/** Experimental: enables the GraphQL request body in Try It and embedded Replay. */
|
|
25
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
24
26
|
}, "strip", z.ZodTypeAny, {
|
|
25
27
|
NEW_CATALOG_ENABLED?: boolean | undefined;
|
|
26
28
|
NEW_SCORECARDS_ENABLED?: boolean | undefined;
|
|
@@ -34,6 +36,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
34
36
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
35
37
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
|
|
36
38
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
|
|
39
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
37
40
|
}, {
|
|
38
41
|
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
39
42
|
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
@@ -47,5 +50,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
47
50
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
48
51
|
REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
|
|
49
52
|
REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
|
|
53
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
|
|
50
54
|
}>;
|
|
51
55
|
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const
|
|
1
|
+
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const D=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE:E(),REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED:E(),REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{D as featureFlagsSchema};
|
|
@@ -11,6 +11,7 @@ export declare const DEFAULT_THEME_PLUGIN_PATH = "@redocly/theme/plugin.js";
|
|
|
11
11
|
export declare const STYLES_FILE = "styles.css";
|
|
12
12
|
export declare const DEFAULT_PROJECT_PLUGIN_PATHS: string[];
|
|
13
13
|
export declare const JWT_SECRET_KEY: string;
|
|
14
|
+
export declare const MAX_AUTH_TOKEN_COOKIE_BYTES: number;
|
|
14
15
|
export declare const MCP_ACCESS_TOKEN_TTL_SEC: number;
|
|
15
16
|
export declare const MCP_REFRESH_SESSION_LIFETIME_SEC: number;
|
|
16
17
|
export declare const I18N_DIR_NAME = "@i18n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ServerRoutes as
|
|
1
|
+
import{ServerRoutes as S}from"../../constants/api.js";import{USER_THEME_ALIAS as r}from"../../constants/common.js";import{envConfig as _}from"../config/env-config.js";const U="runtime",a="/assets",M="/_spec",P="/_bundle",l="static",i="redocly:::linkOriginal",m="@",F="default",H=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),K="@redocly/theme/plugin.js",B="styles.css",Y=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],d=_.JWT_SECRET_KEY||"test_secret_key",L=4096,c=196,u=L-c,G=3600,g=1440*60,O="@i18n",p="@l10n",h=[r,O,p],W="https://redocly.com/auth/aud",f="catalog.json",k="scorecard.json",J="page-count.json",$="sitemap.xml",j="llms.txt",o=_.PROJECT_ID,R=_.PROJECT_SLUG,e=_.ORGANIZATION_ID,s=_.ORG_SLUG,t=_.BH_API_URL,n=t&&s&&R?`${t}/orgs/${s}/projects/${R}`:void 0,E=t&&e&&o?`${t}/orgs/${e}/projects/${o}`:void 0,C=t?`${t}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",w=_.ENTITLEMENTS_JWKS_CDN_URL||C,V=n?`${n}/feedback`:"",X=E?`${E}/ai-agentic-conversations`:"",v=E?`${E}/ai-assistant-escalations`:"",y=E?`${E}/ai-assistant-feedback`:"",b=E?`${E}/semantic-search`:"",Z="no-store",q=365*24*60*60,z="X-Redocly-Cache-Control",Q="no-cache",__="public, s-maxage=86400, max-age=10, must-revalidate",E_=_.AUTH_URL,t_="Developer Documentation",T=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",o_=T==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,R_=T==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,e_="-----BEGIN CERTIFICATE-----",s_="-----END CERTIFICATE-----",n_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",T_="http://localhost:4318/v1/traces",A_=[S.HEALTH],A=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",I_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(I=>I.trim()).filter(Boolean).concat(A):[A],S_="markdown/partials",r_="markdown/partials-deps";export{v as AI_ASSISTANT_ESCALATIONS_API_URL,y as AI_ASSISTANT_FEEDBACK_API_URL,I_ as ALLOWED_CORS_ORIGINS,W as ALTERNATIVE_AUD_CLAIM_NAME,X as ASK_AI_API_URL,E_ as AUTH_URL,e_ as BEGIN_CERTIFICATE_DELIMITER,n as BH_API_PROJECTS_URL,E as BH_API_PROJECTS_URL_V2,Z as CACHE_CONTROL_NO_STORE_HEADER_VALUE,Q as CACHE_CONTROL_PUBLIC_HTML,f as CATALOG_OUTPUT_FILE_NAME,q as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,Y as DEFAULT_PROJECT_PLUGIN_PATHS,K as DEFAULT_THEME_PLUGIN_PATH,t_ as DEFAULT_TITLE,F as DEFAULT_VERSION_NAME,M as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,s_ as END_CERTIFICATE_DELIMITER,w as ENTITLEMENTS_JWKS_URL,V as FEEDBACK_API_URL,O as I18N_DIR_NAME,d as JWT_SECRET_KEY,p as L10N_DIR_NAME,i as LINK_ORIGINAL_ATTR_NAME,j as LLMS_TXT_FILE_NAME,S_ as MARKDOC_PARTIALS_DATA_KEY,r_ as MARKDOC_PARTIALS_DEPS_KEY,u as MAX_AUTH_TOKEN_COOKIE_BYTES,G as MCP_ACCESS_TOKEN_TTL_SEC,g as MCP_REFRESH_SESSION_LIFETIME_SEC,e as ORG_ID,s as ORG_SLUG,A_ as OTEL_EXCLUDED_ROUTES,T_ as OTEL_TRACES_DEV_URL,J as PAGE_COUNT_OUTPUT_FILE_NAME,o as PROJECT_ID,R as PROJECT_SLUG,P as PUBLIC_API_DEFINITIONS_FOLDER,a as PUBLIC_ASSETS_FOLDER,l as PUBLIC_STATIC_FOLDER,h as RESERVED_DIR_NAMES,U as RUNTIME_RESOURCES_DIR,k as SCORECARD_OUTPUT_FILE_NAME,b as SEMANTIC_SEARCH_API_URL,A as SERVER_EDITOR_APP_URL,$ as SITEMAP_FILE_NAME,T as SSR_RENDER_MODE,R_ as SSR_WORKERS_MAX,o_ as SSR_WORKERS_MIN,B as STYLES_FILE,n_ as TELEMETRY_ENABLED,H as VERSIONED_FOLDER_REGEXP_MATCH,m as VERSION_SEPARATOR,z as X_REDOCLY_CACHE_CONTROL_HEADER,__ as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:
|
|
1
|
+
const t=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:path"],_="Documentation",E="API Reference",e="search",o=100,A=10,r=25,I=100,p=150,s="ai-search",R=50,S=250,c=Symbol("metadata"),n=!0,C=["title"];export{s as AI_INDEX_EXPORT_FOLDER,R as AI_SEARCH_CHUNK_SIZE,S as AI_SEARCH_DOCUMENT_CHUNK_SIZE,n as DEFAULT_AI_SEARCH_ENABLED,C as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,p as HIGHLIGHTED_TEXT_MAX_LENGTH,e as SEARCH_DATA_EXPORT_FOLDER,c 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,I as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
|
|
@@ -8,9 +8,9 @@ export type Location = {
|
|
|
8
8
|
export declare class EsbuildError extends Error {
|
|
9
9
|
errors: BuildFailure['errors'];
|
|
10
10
|
warnings: BuildFailure['warnings'];
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(failure: Partial<BuildFailure>);
|
|
12
12
|
}
|
|
13
|
-
export declare function esbuildLogger({ errors, warnings }: EsbuildError): Promise<void>;
|
|
13
|
+
export declare function esbuildLogger({ errors, warnings, message }: EsbuildError): Promise<void>;
|
|
14
14
|
export declare function reportEsbuildError(message: string, sourceFileRelativePath: string, fileContent: string, location?: Location | null): {
|
|
15
15
|
message: string;
|
|
16
16
|
sourceFileRelativePath: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as
|
|
2
|
-
`),hasMatched:!1};const
|
|
3
|
-
`),{lineText:s}=r,
|
|
1
|
+
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as f}from"../tools/notifiers/reporter.js";import{envConfig as m}from"../config/env-config.js";import{telemetry as d}from"../../cli/telemetry/index.js";import{stopAllCompilers as y}from"./esbuild.js";import{getCodeframe as C}from"../utils/codeframes/codeframes.js";import{shutdowner as M}from"../tools/shutdowner.js";class N extends Error{errors;warnings;constructor(r){super(r.message,r instanceof Error?{cause:r}:void 0),this.errors=r.errors??[],this.warnings=r.warnings??[]}}async function T({errors:n,warnings:r,message:t}){const s=await h(n,"error"),o=await h(r,"warning");if(r.forEach((e,i)=>{c.warn(o[i])}),n.forEach((e,i)=>{const a=e.location?.file||"";a&&a.includes("node_modules/")?(c.error(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e)}])):(c.contentError(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e),scope:"content"}]))}),!n.length&&t){const e=`JavaScript compilation failed: ${t}`;c.error(e),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:e}])}(n.length>0||t)&&m.isBuildMode&&(await y(),await M.exitWithCode(1))}async function h(n,r){return n.length?m.REDOCLY_LOG_FORMAT==="JSON"?n.map(t=>JSON.stringify(t)):await E.formatMessages(n,{kind:r,color:!1,terminalWidth:0}):[]}function w(n,r){if(!r?.lineText)return{line:1,column:1,lines:n.split(`
|
|
2
|
+
`),hasMatched:!1};const t=n.split(`
|
|
3
|
+
`),{lineText:s}=r,o=e=>{const i=e.indexOf(s);return i===-1?null:i};if(r.line&&r.line<=t.length&&o(t[r.line-1]))return{line:r.line,column:r.column||1,lines:t,hasMatched:!0};const l=t.findIndex(e=>o(e)!==null);if(l>=0){const e=o(t[l]);return{line:l+1,column:(e??0)+1,lines:t,hasMatched:!0}}return{line:1,column:1,lines:t,hasMatched:!1}}function _(n,r,t,s){const{line:o,column:l,lines:e,hasMatched:i}=w(t,s),{frame:a,start:g}=C({start:{line:o,character:l},end:{line:o,character:l+(s?.lineText?.length||0)},lines:e},!0),p=`${n}::${r}::${o}`,u={message:n,sourceFileRelativePath:r,sourceFileLocation:g,codeframe:a,hasMatched:i};return f.getCompilationProblem(p)||f.reportCompilationError({type:"ERROR",severity:"ERROR",...u}),u}export{N as EsbuildError,T as esbuildLogger,_ as reportEsbuildError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as F from"node:path";import{findFirstBinding as P,markdocParser as _}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as k}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as w}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as L}from"../../config/env-config.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as A}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as g}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as B}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const t=B(r);return{url:k(`/_mock${t}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(w,`${g(o,F.posix.extname(o))}?download`)]:[i(f,`${g(o,".json")}?download`),i(f,`${g(o,".yaml")}?download`)]).map(t=>({url:k(t)}))}function j(o,r,m){const{rootConfig:t,config:c,apiConfig:s,mergedConfig:e,relativePath:l}=m,a=M(t?.[o]||{},c[o]||{},s[o]||s.theme?.[o]||{}),b=r["x-feedback"]||a.feedback||c.feedback,S=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!t?.[o]?.excludeFromSearch||!!t?.theme?.[o]?.excludeFromSearch,x=e.rbac||s.rbac,p=A(b),u=c.metadata,C={...p&&{feedback:p},mockServer:D(e?.mockServer||t?.mockServer,l),disableRouter:!0,downloadUrls:a.downloadUrls||I(l,o),excludeFromSearch:S,rbac:x,markdownParser:_,replayFeatures:{graphql:L.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1}};let d;if(o==="graphql"){const n=a;d={title:n.info?.title,...u,...n.metadata??{}}}else{const n=r.info,E=n?.["x-metadata"];d={title:n?.title,description:n?.description,...o==="openapi"&&{summary:n?.summary},...u,...E}}o==="openapi"&&a.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const O=a.markdocOptions??R,h={...a,...C,specType:o,markdocOptions:O,metadata:d};return o==="asyncapi"&&(h.protocol=P(r)??void 0),h}export{I as buildDownloadUrls,j as createOptions};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ApiDocsSearchIndexer } from '@redocly/api-docs';
|
|
2
|
+
import type { ExampleEntry, SchemaEntry } from '@redocly/api-docs';
|
|
3
|
+
/** The shared api-docs indexer with Markdown descriptions — AI search documents and llms.txt need Markdown. */
|
|
4
|
+
export declare function createApiDocsSearchIndexer(basePath: string, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>): ApiDocsSearchIndexer;
|
|
5
|
+
//# sourceMappingURL=create-indexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ApiDocsSearchIndexer as e}from"@redocly/api-docs";import{toMarkdown as i}from"../../markdown/search/to-markdown.js";function a(r){if(typeof r=="string")return r;const t=Array.isArray(r)?r:[r];return i(t).trim()}function f(r,t,o,n){return new e(r,t,o,{formatDescription:a,exampleStore:n})}export{f as createApiDocsSearchIndexer};
|
|
@@ -15,6 +15,6 @@ type AiDocumentsStoreParams = {
|
|
|
15
15
|
getSearchFacets: () => Map<string, SearchFacet>;
|
|
16
16
|
markdocTags?: Record<string, MarkdocTagSchema>;
|
|
17
17
|
};
|
|
18
|
-
export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown,
|
|
18
|
+
export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown, _context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=get-ai-search-documents.d.ts.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as
|
|
2
|
-
`+tn,on=q+F;
|
|
1
|
+
import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as y}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as U}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as v}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as N}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{createApiDocsSearchIndexer as yn}from"./create-indexer.js";function A(t,o){return o==="openapi"&&"openapi"in t}function H(t,o){return o==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:o,store:s,document:n,specType:r,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:c}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...c},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),x=un(m,X,Z),C=d.getConfig(),L=dn(f.fsPath),j=yn(e,s?.schemaStore,n,s?.exampleStore),M=g=>{for(const p of g)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const g of nn)V.set(g.url,g);const R=typeof o.title=="string"?o.title:void 0,_=sn(o.version),D=$n(f.metadata||{},R,_,l),S=[],I=[],q=gn(o,n,r),F=bn(r,o,f.fsPath,C),tn=In(t,C,x),en=q+F+`
|
|
2
|
+
`+tn,on=q+F;I.push({title:R||"API Overview",description:typeof o.description=="string"?o.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),S.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,r)?n.security:void 0,E=g=>{for(const p of g){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===y.ITEM){const $=Pn(p,n,r)??Y(p,k,r,_,rn,x);if($){const b=p.label||"";I.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===y.GROUP){const $=On(p,C,r,x);if($){const b=p.label||"";I.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return I},async getSearchDocuments(){return S}}}}function gn(t,o,s){const n=typeof t.title=="string"?t.title:"",r=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
|
|
3
3
|
|
|
4
|
-
`:"";if(l+=
|
|
4
|
+
`:"";if(l+=r?`${r}
|
|
5
5
|
|
|
6
6
|
`:"",l+=i?`${i}
|
|
7
7
|
|
|
8
8
|
`:"",l+=e?`Version: ${e}
|
|
9
|
-
`:"",
|
|
10
|
-
`);const f=
|
|
9
|
+
`:"",o){if(A(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
|
|
10
|
+
`);const f=c["x-metadata"],a=mn(f);a&&(l+=`
|
|
11
11
|
Metadata:
|
|
12
12
|
${a}
|
|
13
|
-
`)}else if(H(
|
|
13
|
+
`)}else if(H(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
|
|
14
14
|
`)}}return l+=`
|
|
15
|
-
`,l+=An(
|
|
15
|
+
`,l+=An(o,s),l+=Sn(o,s),l}function bn(t,o,s,n){if(!s)return"";let r,i,e;if(t==="openapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(s)||".graphql";r=P.posix.join(an,U(s,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(r,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const c=typeof o.title=="string"&&o.title||e;return`${i}
|
|
16
16
|
|
|
17
|
-
- ${
|
|
17
|
+
- ${N({title:c,description:void 0,slug:r,siteUrl:n.seo?.siteUrl})}`}function An(t,o){if(!t)return"";if(A(t,o)){const{servers:s}=t;if(!s?.length)return"";let n=`## Servers
|
|
18
18
|
|
|
19
|
-
`;for(const
|
|
19
|
+
`;for(const r of s)if(r.description&&(n+=`${r.description}
|
|
20
20
|
`),n+=`\`\`\`
|
|
21
|
-
${
|
|
21
|
+
${r.url}
|
|
22
22
|
\`\`\`
|
|
23
23
|
|
|
24
|
-
`,
|
|
25
|
-
`;for(const[i,e]of Object.entries(
|
|
24
|
+
`,r.variables){n+=`Variables:
|
|
25
|
+
`;for(const[i,e]of Object.entries(r.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
|
|
26
26
|
`,e.default&&(n+=` Default: ${JSON.stringify(e.default)}
|
|
27
27
|
`),e.enum&&(n+=` Enum: ${e.enum.map(l=>JSON.stringify(l)).join(", ")}
|
|
28
28
|
`);n+=`
|
|
29
|
-
`}return n}if(H(t,
|
|
29
|
+
`}return n}if(H(t,o)){const{servers:s}=t;if(!s||!Object.keys(s).length)return"";let n=`## Servers
|
|
30
30
|
|
|
31
|
-
`;for(const[
|
|
31
|
+
`;for(const[r,i]of Object.entries(s))n+=`### ${r}
|
|
32
32
|
|
|
33
33
|
`,i.description&&(n+=`${i.description}
|
|
34
34
|
`),i.host&&(n+=`Host: ${i.host}
|
|
@@ -36,9 +36,9 @@ ${o.url}
|
|
|
36
36
|
`),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
|
|
37
37
|
`),i.pathname&&(n+=`Pathname: ${i.pathname}
|
|
38
38
|
`),n+=`
|
|
39
|
-
`;return n}return""}function
|
|
39
|
+
`;return n}return""}function Sn(t,o){if(!t||!A(t,o))return"";const s=t.components?.securitySchemes;if(!s)return"";let n=`## Security
|
|
40
40
|
|
|
41
|
-
`;for(const[
|
|
41
|
+
`;for(const[r,i]of Object.entries(s)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${r}
|
|
42
42
|
|
|
43
43
|
`,e.description&&(n+=`${e.description}
|
|
44
44
|
|
|
@@ -48,58 +48,58 @@ ${o.url}
|
|
|
48
48
|
`),e.scheme&&(n+=`Scheme: ${e.scheme}
|
|
49
49
|
`),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
|
|
50
50
|
`),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
|
|
51
|
-
`);const l=e.flows,
|
|
52
|
-
`),"tokenUrl"in
|
|
53
|
-
`),
|
|
54
|
-
`;for(const[f,a]of Object.entries(
|
|
51
|
+
`);const l=e.flows,c=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(c&&("authorizationUrl"in c&&c.authorizationUrl&&(n+=`Authorization URL: ${c.authorizationUrl}
|
|
52
|
+
`),"tokenUrl"in c&&c.tokenUrl&&(n+=`Token URL: ${c.tokenUrl}
|
|
53
|
+
`),c.scopes)){n+=`Scopes:
|
|
54
|
+
`;for(const[f,a]of Object.entries(c.scopes))n+=`- \`${f}\`: ${a}
|
|
55
55
|
`}n+=`
|
|
56
|
-
`}return n}function
|
|
56
|
+
`}return n}function In(t,o,s){let n="";const r=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===y.GROUP)n+=`${e} ${l.label||""}
|
|
57
57
|
|
|
58
|
-
`,l.items?.length&&
|
|
58
|
+
`,l.items?.length&&r(l.items,e+"#");else if(l.content?.contentType===y.ITEM){if(!w(l,o))continue;const c=l,f=c.httpVerb,a=c.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,s):void 0;n+=` - ${N({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link),siteUrl:o.seo?.siteUrl})}`}}};return r(t,"##"),n}function Y(t,o,s,n,r,i){if(!t.content)return;const e=t,l=t.label||"",c=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
|
|
59
59
|
|
|
60
|
-
`;if(
|
|
60
|
+
`;if(c&&(a+=`${c}
|
|
61
61
|
|
|
62
|
-
`),
|
|
62
|
+
`),s==="openapi"||s==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
|
|
63
63
|
`:u&&(a+=`Method: ${u.toUpperCase()}
|
|
64
64
|
`),n&&(a+=`Version: ${n}
|
|
65
|
-
`);const m=Tn(t.content.children,
|
|
66
|
-
`)}return
|
|
67
|
-
`+
|
|
68
|
-
`),
|
|
65
|
+
`);const m=Tn(t.content.children,r);m&&(a+=`Security: ${m}
|
|
66
|
+
`)}return o?.parameters?.length&&s!=="graphql"&&(a+=`
|
|
67
|
+
`+xn(o.parameters)+`
|
|
68
|
+
`),s==="graphql"&&(a+=Cn(t.content.children)),a}function Pn(t,o,s){if(t.httpVerb!=="tool"||!o||!A(o,s))return;const n=t.content?.meta?.name,r=n?o["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!r)return;let i=`# ${t.label||r.name}
|
|
69
69
|
|
|
70
|
-
`;return typeof
|
|
70
|
+
`;return typeof r.description=="string"&&r.description&&(i+=`${r.description}
|
|
71
71
|
|
|
72
72
|
`),i+=`## Input schema:
|
|
73
73
|
|
|
74
74
|
`,i+=`\`\`\`json
|
|
75
|
-
${JSON.stringify(
|
|
75
|
+
${JSON.stringify(r.inputSchema,null,2)}
|
|
76
76
|
\`\`\`
|
|
77
77
|
|
|
78
|
-
`,
|
|
78
|
+
`,r.outputSchema&&(i+=`## Output schema:
|
|
79
79
|
|
|
80
80
|
`,i+=`\`\`\`json
|
|
81
|
-
${JSON.stringify(
|
|
81
|
+
${JSON.stringify(r.outputSchema,null,2)}
|
|
82
82
|
\`\`\`
|
|
83
83
|
|
|
84
|
-
`),i}function On(t,
|
|
84
|
+
`),i}function On(t,o,s,n){if(!t.content)return;const r=t.label||"",i=T(t.content.children,n);let e=`# ${r}
|
|
85
85
|
|
|
86
86
|
`;if(i&&(e+=`${i}
|
|
87
87
|
|
|
88
|
-
`),
|
|
88
|
+
`),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!w(u,o)))if(u.content.contentType===y.ITEM){const d=Y(u,void 0,s,void 0,void 0,n);d&&(c+=`${d}
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
`)}else u.content.contentType===
|
|
93
|
-
`;return
|
|
92
|
+
`)}else u.content.contentType===y.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+c,aiSearch:e}}let l="";if(t.items?.length)for(const c of t.items){if(!c.link||!c.content||c.content.contentType!==y.ITEM||!w(c,o))continue;const f=c,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:c.label||"",m=c.content?T(c.content.children,n):void 0;l+=` - ${N({title:d,description:m?m.slice(0,200):void 0,slug:J(c.link),siteUrl:o.seo?.siteUrl})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,o){const s=[],n=r=>{for(const i of r)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const c of l.schemes)c[O]||c.name&&!s.includes(c.name)&&s.push(c.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),s.length)return s.join(", ");if(o?.length){const r=o.flatMap(i=>Object.keys(i));if(r.length)return[...new Set(r)].join(", ")}}function xn(t){const o={};for(const n of t){const r=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;o[r]||(o[r]=[]),o[r].push(n)}return Object.entries(o).map(([n,r])=>{const i=r.map(e=>{const l=[...e.path||[],e.name],c=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
|
|
93
|
+
`;return c&&(f+=` ${c.trim()}
|
|
94
94
|
`),e.enum?f+=` Enum: ${e.enum.map(a=>JSON.stringify(a)).join(", ")}
|
|
95
95
|
`:e.example&&(f+=` Example: ${e.example}
|
|
96
96
|
`),f});return`## ${K(n)}:
|
|
97
97
|
|
|
98
98
|
${i.join(`
|
|
99
99
|
`)}`}).join(`
|
|
100
|
-
`)}function
|
|
101
|
-
## ${K(
|
|
100
|
+
`)}function Cn(t){let o="";const s=n=>{for(const r of n)if(r.nodeType===h.ITEM){const i=r;i.graphqlSchema&&(o+=Ln(i.graphqlSchema,i.variant))}else(r.nodeType===h.CONTAINER||r.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&s(r.children)};return s(t),o}function Ln(t,o){let n=`
|
|
101
|
+
## ${K(o==="return-type"?"Return type":o==="graphql-args"||o==="arguments"?"Arguments":o==="graphql-fields"?"Fields":o)}:
|
|
102
102
|
|
|
103
|
-
`;const
|
|
104
|
-
`};if(!Array.isArray(t)){const i=t.description?
|
|
105
|
-
`;for(const e of t.fields??[])n+=
|
|
103
|
+
`;const r=i=>{const e=i.description?v(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
|
|
104
|
+
`};if(!Array.isArray(t)){const i=t.description?v(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
|
|
105
|
+
`;for(const e of t.fields??[])n+=r(e);return n}if(!t.length)return"";for(const i of t)n+=r(i);return n}function T(t,o){const s=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,c=Array.isArray(l)?l:[l],f=v(c,{renderTag:o}).trim();f&&s.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),s.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,o){return o.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},o)}export{Qn as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function O(u,i,c,S,R,a,g){return async e=>{if(R)return[];const m=e.baseSlug||e.slug,l=new D(m,a?.schemaStore,g,{exampleStore:a?.exampleStore}),f=t=>{for(const r of t)l.addItem(r),r.items?.length&&f(r.items)};f(u);const s=typeof i.title=="string"?i.title:void 0,n=d(i.version),p=x(e.metadata||{},s,n,c);return A(p,c,S),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:n?`${s} (${n})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:p}))}}export{O as searchResolver};
|
package/dist/server/plugins/catalog-entities/database/repositories/common/revision-repository.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{and as u,desc as v,eq as n,isNull as c,sql as d}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as h}from"
|
|
1
|
+
import{and as u,desc as v,eq as n,isNull as c,sql as d}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as h}from"../../../../../../utils/version/compare-versions.js";import{VersionRepository as m}from"./version-repository.js";import{buildSemanticVersionSortExpr as C}from"../utils/semantic-version-sort.js";import{normalizeRevisionFlags as y}from"../utils/normalize-revision-flags.js";class g{#i;#e;constructor(i){this.#e=i,this.#i=new m(i)}async getCurrentRevisionInfo({key:i,version:t,revision:r}){const o=await this.#t(i);if(!o)return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!1};if(t){const a=await this.#i.doesVersionExist(i,t),s=h(t,o.version)>0,l=o.version===f&&t!==f;if(!a&&(s||l))return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}}return t&&r&&t===o.version&&r>=o.revision?{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}:{shouldSetNewCurrentRevision:!1,hasCurrentRevision:!0}}async markAllRevisionsAsNotCurrent(i){await this.#e.client.update(e).set({isCurrent:!1}).where(n(e.key,i)).run()}async ensureDefaultAndCurrentRevisionForKey(i){const t=await this.#i.getOrderedVersionListForKey(i),r=this.#i.getLatestVersion(t);r&&await this.#e.client.update(e).set({isDefaultVersion:!0,isCurrent:!0}).where(u(n(e.key,i),n(e.revision,r.revision),r.version?n(e.version,r.version):c(e.version))).run()}async shouldSkipRevisionCreation(i,t,r,o,a){if(o||a)return!1;const s=await this.#e.client.select({hash:e.hash,isDeleted:e.isDeleted}).from(e).where(u(n(e.key,i),t?n(e.version,t):c(e.version))).orderBy(v(e.revision)).limit(1).get();return!s||!!s.isDeleted?!1:s.hash===r}async#t(i){return await this.#e.client.select({version:e.version,revision:e.revision}).from(e).where(u(n(e.key,i),n(e.isCurrent,!0))).orderBy(v(e.revision)).limit(1).get()??null}async listEntityRevisions(i,t){const r=[n(e.key,i),n(e.isDeleted,!1),...t?[n(e.version,t)]:[]],a=(await this.#e.client.select({version:e.version,revision:e.revision,isCurrent:e.isCurrent,createdAt:e.createdAt,updatedAt:e.updatedAt,isDefaultVersion:e.isDefaultVersion}).from(e).where(u(...r)).orderBy(d`${C("version")} DESC`,d.raw("revision DESC")).all()).map(s=>({version:s.version,revision:s.revision??"",isCurrent:s.isCurrent!==null?s.isCurrent:!1,createdAt:s.createdAt,updatedAt:s.updatedAt,isDefaultVersion:s.isDefaultVersion!==null?s.isDefaultVersion:!1}));return y(a),a}}export{g as RevisionRepository};
|
package/dist/server/plugins/catalog-entities/database/repositories/common/version-repository.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{eq as a,and as u,desc as c}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{
|
|
1
|
+
import{eq as a,and as u,desc as c}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as m}from"../../../../../../utils/version/compare-versions.js";class A{db;constructor(t){this.db=t}async markAllVersionsAsNotDefault(t){await this.db.client.update(e).set({isDefaultVersion:!1}).where(u(a(e.key,t),a(e.isDefaultVersion,!0))).run()}async doesVersionExist(t,n){return await this.db.client.select().from(e).where(u(a(e.key,t),a(e.version,n))).get()!==void 0}async getOrderedVersionListForKey(t){return(await this.db.client.select({version:e.version,isDefaultVersion:e.isDefaultVersion,revision:e.revision,createdAt:e.createdAt}).from(e).where(u(a(e.key,t))).orderBy(c(e.createdAt)).all()).map(i=>({version:i.version,isDefaultVersion:!!i.isDefaultVersion,revision:i.revision,createdAt:new Date(i.createdAt)}))}getLatestVersion(t){const n=t.find(r=>r.isDefaultVersion);if(n)return n;const{versionedEntities:i,unversionedEntities:d}=t.reduce((r,s)=>(s.version!==null&&s.version!==f?r.versionedEntities.push(s):r.unversionedEntities.push(s),r),{versionedEntities:[],unversionedEntities:[]});if(i.length>0){i.sort((o,l)=>m(l.version,o.version));const r=i[0].version,s=i.filter(o=>o.version===r);return s.sort((o,l)=>l.createdAt.getTime()-o.createdAt.getTime()),s[0]}return d.length>0?(d.sort((r,s)=>s.createdAt.getTime()-r.createdAt.getTime()),d[0]):null}}export{A as VersionRepository};
|
package/dist/server/plugins/catalog-entities/database/repositories/utils/normalize-revision-flags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VERSION_NOT_SPECIFIED as t}from"@redocly/theme/core/constants";import{
|
|
1
|
+
import{VERSION_NOT_SPECIFIED as t}from"@redocly/theme/core/constants";import{compareVersions as f}from"../../../../../../utils/version/compare-versions.js";function s(r){return!r||r===t}function c(r,i){const e=s(r.version),o=s(i.version);if(e&&!o)return 1;if(!e&&o)return-1;const n=f(i.version??"",r.version??"");return n!==0?n:(i.revision??"").localeCompare(r.revision??"")}function a(r){const i=r.filter(e=>e.isCurrent||e.isDefaultVersion);if(!(i.length<=1)){i.sort(c);for(let e=1;e<i.length;e++)i[e].isCurrent=!1,i[e].isDefaultVersion=!1}}export{a as normalizeRevisionFlags};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import f from"path";import{combineUrls as S}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as b}from"../../../constants/common.js";import{removeTrailingSlash as v}from"../../../../utils/url/remove-trailing-slash.js";import{slash as E}from"../../../../utils/path/slash.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{getDefaultVersionByPath as I}from"./versions-config-loader.js";import{GithubSlugger as N,slug as h}from"../../../utils/index.js";import{isPartial as z}from"../../markdown/is-partial.js";import{parseBaseName as T}from"../../utils.js";const j=new Set([".jpg",".jpeg",".png",".gif",".webp",".svg",".ico",".avif",".mp3",".wav",".ogg",".m4a",".mp4",".avi",".mov",".webm",".pdf",".doc",".docx",".zip",".rar",".gz",".ttf",".woff",".woff2"]),U=async(i,{fs:s,cache:r,getConfig:l})=>{const t=m.startTiming(),g=(await r.load("versions-config","versions-config")).data,{markdown:u}=await l(),o=u?.partialsFolders??[],e=new Map,n=new Map,c=new Set,d={pageVsPage:0,dirVsDir:0},D=new N;n.set(".","/"),n.set("/","/");const w=s.scan().sort((a,p)=>p.relativePath.localeCompare(a.relativePath));for(const{relativePath:a}of w){if(j.has(f.posix.extname(a)))continue;const{data:p}=await r.load(a,"is-ignored");if(p||f.posix.extname(a)===".md"&&z(a,o))continue;const F=E(a).replace(new RegExp("^(@i18n|@l10n)\\/"),""),V=I(a,g);y(F,{defaultVersion:V,fileSlugs:e,dirSlugs:n,allFileSlugsList:c,githubSlugger:D,collisions:d})}return m.verboseTime(t,"Calculated slugs. Number of file paths processed: "+w.length),{fileSlugs:e,dirSlugs:n,collisions:d}};function y(i,s){const r=s.fileSlugs.get(i);if(r)return r;let l=f.posix.dirname(i);const t=L(l,s)||"",{baseName:g,isIndexFile:u}=T(i),o=s.dirSlugs.has(f.posix.join(l,g));let e;if(!u&&o){const n=h(S(t,g));s.allFileSlugsList.has(n)||(e=n)}if(!e){const n=u?s.dirSlugs.get(l):void 0;if(n)e=n;else{const c=S(t,g),d=h(c);e=s.githubSlugger.slug(c),e!==d&&(s.collisions.pageVsPage++,m.verbose("File slug collision: %s wanted %s, assigned %s",i,d,e))}}e=v(e),s.fileSlugs.set(i,e),s.allFileSlugsList.add(e)}function L(i,s){if(s.dirSlugs.has(i))return s.dirSlugs.get(i);const r=v(f.posix.normalize(i)).split("/");let l="/",t="";for(const g of r){t=f.posix.join(t,g);const u=P(g,s.defaultVersion);let o=s.dirSlugs.get(t);if(!o){const e=S("/",l,u),n=h(e);o=s.githubSlugger.slug(e),o!==n&&(s.collisions.dirVsDir++,m.verbose("Directory slug collision: %s wanted %s, assigned %s",t,n,o))}o.endsWith("/")||(o=o+"/"),s.dirSlugs.set(t,o),l=o}return s.dirSlugs.get(i)}function P(i,s){if(!i.startsWith(b))return i;const r=i.substring(b.length);return r===s?"":r}export{j as IGNORED_EXTS,U as contentSlugsLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as m,VERSIONED_FOLDER_REGEXP_MATCH as
|
|
1
|
+
import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as m,VERSIONED_FOLDER_REGEXP_MATCH as V}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as P}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as g}from"../../../tools/notifiers/logger.js";const R=async(r,{cache:i,fs:s})=>{const e=new Map,a=await s.scan();await F(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await y(n,e,i);continue}const o=l(n);if(o==null)continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(u=>u.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return w(e)};async function y(r,i,s){let e=v.posix.dirname(r);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(r,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,r),n.versions=[]):(!n.versions||n.versions.length===0)&&g.warn("Property 'versions' is empty at %rp. This is likely a mistake.",r);const o=i.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),i.set(e,o)}async function F(r){const i=new Set;for(const{relativePath:s}of r){const e=l(s);if(!(e?.versionFolderPath&&m.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(V)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}i.has(e.versionFolderPath)||i.add(e.versionFolderPath)}}}function w(r){for(let[i,s]of r){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>P(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;r.set(i,{...s,versions:e,defaultVersion:n})}return r}function A(r,i){const s=l(r);return s==null?null:i.get(s.versionFolderPath)?.defaultVersion}export{A as getDefaultVersionByPath,R as versionsConfigLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as E,useQueryClient as C}from"@tanstack/react-query";import{useParams as f}from"react-router";import{Button as v}from"@redocly/theme/components/Button/Button";import{H2 as D}from"@redocly/theme/components/Typography/H2";import{Admonition as h}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as P}from"../../../../../client/app/hooks";import{Dialog as A}from"./Dialog";import{ButtonWithLoading as k}from"./ButtonWithLoading";import{ButtonsContainer as S}from"./RollAPIKey";import{DialogInputMultiline as T,DialogRow as w,DialogRowContent as K}from"./DialogStyledComponents";import{MAX_DESCRIPTION_LENGTH as d,CharacterCounter as O}from"./CharacterCounter";const Q=o=>{const{initialDescription:n,open:a,onOpen:i,onClose:t}=o;return e.createElement(A,{open:a,onClose:t,onOpen:i},e.createElement(R,{initialDescription:n,onClose:t}))},R=o=>{const{id:n}=f(),{initialDescription:a,onClose:i}=o,{translate:t}=P(),[r,p]=e.useState(a||""),c=async()=>{await y(),i()},u=s=>{s.key==="Enter"&&!l&&c()},g=C(),{mutateAsync:y,isPending:l,error:m}=E({mutationKey:["UPDATE_APP"+n],mutationFn:()=>fetch(`/api/api-keys/apps/${n}`,{method:"PUT",body:JSON.stringify({description:r})}),onSettled:()=>{g.invalidateQueries({queryKey:["APP:"+n]})}});return e.createElement(e.Fragment,null,e.createElement(D,{"data-translation-key":"dev.edit.description.dialog.title"},t("dev.edit.description.dialog.title","Change description")),e.createElement(w,null,e.createElement(K,null,e.createElement(T,{maxLength:d,value:r,onChange:s=>p(s.target.value),onKeyPress:u,rows:6,cols:60}))),e.createElement(O,null,r.length,"/",d),m&&e.createElement(h,{type:"danger"},m.message," "),e.createElement(S,null,e.createElement(v,{onClick:i,"data-translation-key":"dev.edit.description.dialog.cancel",variant:"text",size:"large"},t("dev.edit.description.dialog.cancel","Cancel")),e.createElement(k,{variant:"primary",loading:l,onClick:c,disabled:l,"data-translation-key":"dev.edit.description.dialog.save"},t("dev.edit.description.dialog.save","Save changes"))))};export{Q as EditAppDescriptionDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as v,useQueryClient as E}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as h}from"@redocly/theme/components/Button/Button";import{H2 as P}from"@redocly/theme/components/Typography/H2";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as k}from"../../../../../client/app/hooks";import{Dialog as D}from"./Dialog";import{ButtonWithLoading as N}from"./ButtonWithLoading";import{ButtonsContainer as S}from"./RollAPIKey";import{DialogInput as w,DialogRow as K,DialogRowContent as O}from"./DialogStyledComponents";const U=e.forwardRef((l,a)=>{const{appName:s,appDisplayName:o}=l,[n,i]=e.useState(!1),r=()=>{i(!0)},t=()=>{i(!1)};return e.useImperativeHandle(a,()=>({open:r})),e.createElement(D,{open:n,onClose:t,onOpen:r},e.createElement(R,{initialName:o||s||"",onClose:t}))}),R=l=>{const{id:a}=C(),{initialName:s,onClose:o}=l,[n,i]=e.useState(s),r=p=>i(p.target.value),{translate:t}=k(),d=async()=>{await f(),o()},g=p=>{p.key==="Enter"&&!m&&u&&d()},y=E(),{mutateAsync:f,isPending:m,error:c}=v({mutationKey:["UPDATE_APP"+a],mutationFn:()=>fetch(`/api/api-keys/apps/${a}`,{method:"PUT",body:JSON.stringify({name:n})}),onSettled:()=>{y.invalidateQueries({queryKey:["APPS","APP:"+a]})}}),u=/^(?!\s*$).{1,100}$/gi.test(n);return e.createElement(e.Fragment,null,e.createElement(P,{"data-translation-key":"dev.edit.app.dialog.title"},t("dev.edit.app.dialog.title","Change display name")),e.createElement(K,null,e.createElement(O,null,e.createElement(w,{value:n,onChange:r,onKeyPress:g}))),c&&e.createElement(A,{type:"danger"},c.message," "),e.createElement(S,null,e.createElement(h,{onClick:o,"data-translation-key":"dev.edit.app.dialog.cancel",variant:"text",size:"large"},t("dev.edit.app.dialog.cancel","Cancel")),e.createElement(N,{variant:"primary",loading:m,onClick:d,disabled:m||!u,"data-translation-key":"dev.edit.app.dialog.save"},t("dev.edit.app.dialog.save","Save changes"))))};export{U as EditAppDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useMutation as
|
|
1
|
+
import*as e from"react";import{useMutation as y,useQueryClient as b}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as U}from"@redocly/theme/components/Button/Button";import{H2 as h}from"@redocly/theme/components/Typography/H2";import{Admonition as v}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as E}from"../../../../../client/app/hooks";import{Dialog as f}from"./Dialog";import{ButtonWithLoading as w}from"./ButtonWithLoading";import{ButtonsContainer as P}from"./RollAPIKey";import{DialogHelperText as D,DialogInputMultiline as R,DialogRow as S,DialogRowContent as A}from"./DialogStyledComponents";const Q=o=>{const{initialCallbackUrl:l,open:r,onOpen:n,onClose:a}=o;return e.createElement(f,{open:r,onClose:a,onOpen:n},e.createElement(T,{initialCallbackUrl:l,onClose:a}))},T=o=>{const{id:l}=C(),{initialCallbackUrl:r,onClose:n}=o,{translate:a}=E(),[c,m]=e.useState(r||""),s=async()=>{await g(),n()},p=t=>{t.key==="Enter"&&!i&&s()},u=b(),{mutateAsync:g,isPending:i,error:d}=y({mutationKey:["UPDATE_APP"+l],mutationFn:async()=>{const t=await fetch(`/api/api-keys/apps/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:c})});if(!t.ok){const k=await t.json().catch(()=>null);throw new Error(k?.error||`Request failed with status ${t.status}`)}return t.json()},onSettled:()=>{u.invalidateQueries({queryKey:["APP:"+l]})}});return e.createElement(e.Fragment,null,e.createElement(h,{"data-translation-key":"dev.edit.callbackUrls.dialog.title"},a("dev.edit.callbackUrls.dialog.title","Change callback URLs")),e.createElement(S,null,e.createElement(A,null,e.createElement(R,{value:c,onChange:t=>m(t.target.value),onKeyPress:p,placeholder:a("dev.edit.callbackUrls.dialog.placeholder","https://example.com/callback"),rows:3}),e.createElement(D,{"data-translation-key":"dev.edit.callbackUrls.dialog.hint"},a("dev.edit.callbackUrls.dialog.hint","Separate multiple URLs with a comma")))),d&&e.createElement(v,{type:"danger"},d.message," "),e.createElement(P,null,e.createElement(U,{onClick:n,"data-translation-key":"dev.edit.callbackUrls.dialog.cancel",variant:"text",size:"large"},a("dev.edit.callbackUrls.dialog.cancel","Cancel")),e.createElement(w,{variant:"primary",loading:i,onClick:s,disabled:i,"data-translation-key":"dev.edit.callbackUrls.dialog.save"},a("dev.edit.callbackUrls.dialog.save","Save changes"))))};export{Q as EditCallbackUrlDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import c from"path";import{compileGlobMatcher as n}from"../../utils/globs.js";const m=new WeakMap,i=(o,e)=>{if(e.length===0)return!1;let t=m.get(e);return t||(t=n(e.map(r=>c.posix.normalize(r))),m.set(e,t)),t(o)};export{i as isPartial};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{getCallableApis as n,isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{FETCH_TOOL_NAME as i}from"../../constants.js";const
|
|
2
|
-
`),
|
|
3
|
-
`)
|
|
4
|
-
`)}};
|
|
1
|
+
import{getCallableApis as n,isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{FETCH_TOOL_NAME as i}from"../../constants.js";const l=["```ts","/**"," * Call a documented API. Only the callable APIs' documented hosts are reachable."," * Responses cap at 1 MiB and redirects are not followed."," */","declare function fetch(url: string | URL, init?: {"," method?: string;"," /** `content-type` is set automatically for URLSearchParams/FormData unless you set one. */"," headers?: Record<string, string>;"," /** string \xB7 URLSearchParams (\u2192 application/x-www-form-urlencoded) \xB7 FormData (\u2192 multipart/form-data) */"," body?: string | URLSearchParams | FormData;"," /** Security scheme name (from the operation's `security` or `getSecuritySchemes`) whose credential to send. Omit to let the server choose. */"," securityScheme?: string;","}): Promise<{"," status: number;"," statusText: string;"," ok: boolean;"," headers: { get(name: string): string | null };"," json(): Promise<unknown>;"," text(): Promise<string>;","}>;","```"].join(`
|
|
2
|
+
`),c=["listApis","getEndpoints","getEndpointInfo"],h=["Example - list the paid invoices of a billing API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const ep = endpoints.find((e) => e.method === 'GET' && e.path.includes('invoices'));","const info = await tools.getEndpointInfo({ name: api.name, path: ep.path, method: ep.method });","// Replace every `{placeholder}` first.","const url = new URL((info.servers?.[0]?.url ?? '') + ep.path);","// Every name below comes from `info.endpoint.parameters` - read them first, never guess them.","url.searchParams.set('filter', 'status:paid');","url.searchParams.set('sort', '-createdTime');","url.searchParams.set('limit', '100');","try {"," const res = await fetch(url, { method: ep.method });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error), endpointId: info };","}","```"].join(`
|
|
3
|
+
`),p=["Example - call an endpoint you already read:","","```ts","// Call `getEndpointInfo` first for the server URL, the path, and the parameter names.","// Replace every `{placeholder}` first.","const url = new URL('https://api.example.com/invoices');","url.searchParams.set('filter', 'status:paid');","try {"," const res = await fetch(url, { method: 'GET' });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error) };","}","```"].join(`
|
|
4
|
+
`);function m(r){return c.every(t=>r.includes(t))?h:p}function d(r){const t=new Map;for(const{name:e,version:a}of r){if(!e)continue;const s=t.get(e)??[];a&&s.push(a),t.set(e,s)}return[...t.entries()].map(([e,a])=>a.length>1?`${e} (${a.map(s=>`v${s}`).join(", ")})`:e).join(", ")}const g={id:i,purpose:"Call the documented APIs over HTTP",isActive:o,annotations:{readOnlyHint:!1,destructiveHint:!0,openWorldHint:!0},renderSection(r,t){const e=d(n(r));return["## `fetch` \u2014 call the documented APIs","",l,"","Always call `getEndpointInfo` before `fetch` for the exact URL, required parameters, and body shape. Put filtering, sorting, and paging in the query parameters, and keep sandbox JS for what the endpoint cannot express. Never guess.","","A `servers[].url` or an endpoint path can hold `{placeholders}`. Replace every one before you call `fetch`. Use the server variable `default`. Ask the user when the `default` only repeats the variable name, such as `{organizationId}`.","","When an operation accepts more than one security scheme, pass `securityScheme` with the scheme name the user holds a credential for; without it the server picks one, and a mismatched credential fails upstream.","",`Callable APIs (their documented hosts are reachable via \`fetch\`): ${e}`,"",m(t)].join(`
|
|
5
|
+
`)}};export{l as FETCH_DECLARATION,g as fetchCapability};
|
|
@@ -8,7 +8,10 @@ export type SandboxCapability = {
|
|
|
8
8
|
isActive(context: McpToolContext): boolean;
|
|
9
9
|
/** How this capability changes `execute`'s MCP annotations when active. */
|
|
10
10
|
annotations: Partial<ToolAnnotations>;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The self-contained `describe-tools` section for this capability: heading, TS declaration,
|
|
13
|
+
* guidance, and an example built only from `describedToolNames`.
|
|
14
|
+
*/
|
|
15
|
+
renderSection(context: McpToolContext, describedToolNames: string[]): string;
|
|
13
16
|
};
|
|
14
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{buildToolTypeDeclarations as
|
|
1
|
+
import{buildToolTypeDeclarations as c,sanitizeToolName as p}from"../build-tool-type-declarations.js";import{EXECUTE_BASE_ANNOTATIONS as u}from"../tools/execute-schema.js";import{buildExecuteExample as m,EXECUTE_ARGS_NOTE as a,USAGE_NOTES as E}from"../prompts.js";import{FETCH_TOOL_NAME as f}from"../constants.js";import{ALL_CAPABILITIES as A}from"./registry.js";function S(n){return A.filter(e=>e.isActive(n))}function _(n){return n.reduce((e,i)=>({...e,...i.annotations}),{...u})}function x(n,e,i){const r=n.map(o=>p(o.name)),t=[];if(n.length>0){const o=c(n),s=o.includes("OpenApi")?`
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${E}`:"";t.push(`## Sandbox tools
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${o}${s}`)}t.push(a),n.length>0&&!e.some(o=>o.id===f)&&t.push(m(r));for(const o of e)t.push(o.renderSection(i,r));return t.join(`
|
|
6
6
|
|
|
7
|
-
`)}export{
|
|
7
|
+
`)}export{_ as composeExecuteAnnotations,S as getActiveCapabilities,x as renderDescribeToolsOutput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auditInput as
|
|
1
|
+
import{auditInput as t,auditSha256 as h,logAuditRecord as a}from"../audit/audit-log.js";function g({audit:e,code:c,description:d,sessionHandle:o,toolNames:i,fetchBudget:n,fetchCapable:u}){a("Record code execution input",{code_sha256:e.sha256,code_length:e.length,flags:e.flags,subject_sha256:o?h(o):void 0,description:t(d),tools:[...i].sort().join(","),fetch_capable:u,fetch_budget:n,code:t(c)})}export{g as logCodeExecutionAudit};
|
|
@@ -4,6 +4,6 @@ export declare const EXECUTE_ARGS_NOTE = "Both `execute` arguments are required:
|
|
|
4
4
|
export declare function buildExecuteDescription(hasFetch: boolean, toolList?: ToolListEntry[]): string;
|
|
5
5
|
export declare const DESCRIBE_TOOLS_DESCRIPTION: string;
|
|
6
6
|
export declare function buildCodeModeInstructions(hasFetch: boolean, toolList?: ToolListEntry[]): string;
|
|
7
|
-
export declare
|
|
7
|
+
export declare function buildExecuteExample(toolNames: string[]): string;
|
|
8
8
|
export declare const USAGE_NOTES: string;
|
|
9
9
|
//# sourceMappingURL=prompts.d.ts.map
|