@redocly/redoc-reef 0.140.0-next.6 → 0.140.0-next.8
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 +76 -0
- package/dist/api-schemas/mcp-fetch-count.d.ts +2 -18
- package/dist/api-schemas/otel-traces.d.ts +7 -1345
- package/dist/api-schemas/otel-traces.js +1 -1
- package/dist/api-schemas/search-facets.d.ts +3 -31
- package/dist/api-schemas/search.d.ts +6 -52
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/eject/resolveEjectParams.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +2 -0
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
- package/dist/client/app/useGlobalData.d.ts +1 -1
- package/dist/client/providers/post-message/use-post-message.d.ts +1 -1
- package/dist/compiled/@redocly/pii/index.mjs +1 -0
- package/dist/compiled/@redocly/pii/package.json +1 -1
- package/dist/markdoc/tags/openapi-code-sample.js +1 -1
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/config/env-config.d.ts +26 -24
- package/dist/server/config/env-schema.d.ts +87 -326
- package/dist/server/config/env-schemas/api-urls.d.ts +2 -14
- package/dist/server/config/env-schemas/auth.d.ts +10 -32
- package/dist/server/config/env-schemas/catalog.d.ts +6 -9
- package/dist/server/config/env-schemas/database.d.ts +2 -8
- package/dist/server/config/env-schemas/environment-detection.d.ts +20 -18
- package/dist/server/config/env-schemas/feature-flags.d.ts +29 -33
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/config/env-schemas/organization-project.d.ts +3 -21
- package/dist/server/config/env-schemas/scorecards.d.ts +2 -6
- package/dist/server/config/env-schemas/search.d.ts +9 -15
- package/dist/server/config/env-schemas/server-config.d.ts +6 -31
- package/dist/server/config/env-schemas/site.d.ts +1 -5
- package/dist/server/config/env-schemas/ssr.d.ts +7 -12
- package/dist/server/config/env-schemas/telemetry.d.ts +1 -7
- package/dist/server/esbuild/plugins/themes-resolver.js +3 -3
- package/dist/server/external-plugins/resolve-external-plugins.js +1 -1
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/api-docs/definition-access.d.ts +22 -0
- package/dist/server/plugins/api-docs/definition-access.js +1 -0
- package/dist/server/plugins/api-docs/index.js +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/spec-download.api.js +1 -1
- package/dist/server/plugins/config-parser/index.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -3
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -5
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +2 -2
- package/dist/server/plugins/mcp/types.d.ts +10 -0
- package/dist/server/plugins/mcp/utils/available-tools.d.ts +5 -0
- package/dist/server/plugins/mcp/utils/available-tools.js +1 -0
- package/dist/server/plugins/mcp/workers/worker-context.d.ts +4 -0
- package/dist/server/plugins/mcp/workers/worker-context.js +1 -0
- package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +3 -3
- package/dist/server/store-config.d.ts +33 -0
- package/dist/server/store-config.js +1 -0
- package/dist/server/store.d.ts +10 -15
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +1 -1
- package/dist/server/tools/notifiers/helpers/colors.d.ts +1 -1
- package/dist/server/types/plugins/api-routes.d.ts +4 -1
- package/dist/server/utils/envs/env-boolean-string.d.ts +9 -3
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.d.ts +2 -0
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
- package/dist/server/utils/envs/interpolate-env-variables.d.ts +5 -1
- package/dist/server/utils/envs/interpolate-env-variables.js +1 -1
- package/dist/server/utils/envs/load-env-variables.js +1 -1
- package/dist/server/utils/envs/replace-env-variables-deep.d.ts +17 -9
- package/dist/server/utils/envs/replace-env-variables-deep.js +1 -1
- package/dist/server/utils/rbac.d.ts +2 -1
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/web-server/middleware/jsonValidatorMiddleware.d.ts +5 -325
- package/dist/server/workers/mcp-tool-worker-methods.d.ts +7 -0
- package/dist/server/workers/mcp-tool-worker-methods.js +1 -0
- package/dist/server/workers/mcp-tool-worker-pool.d.ts +0 -1
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker.js +1 -1
- package/dist/server/workers/types.d.ts +4 -8
- package/dist/server/workers/worker-config.d.ts +33 -0
- package/dist/server/workers/worker-config.js +1 -0
- package/package.json +8 -8
- package/dist/compiled/@redocly/pii/index.js +0 -1
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +0 -4
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +0 -1
|
@@ -3,41 +3,37 @@ import { z } from 'zod';
|
|
|
3
3
|
* Schema for feature flags.
|
|
4
4
|
*/
|
|
5
5
|
export declare const featureFlagsSchema: z.ZodObject<{
|
|
6
|
-
NEW_CATALOG_ENABLED: z.
|
|
7
|
-
|
|
6
|
+
NEW_CATALOG_ENABLED: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
false: "false";
|
|
8
|
+
true: "true";
|
|
9
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
10
|
+
NEW_SCORECARDS_ENABLED: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
false: "false";
|
|
12
|
+
true: "true";
|
|
13
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
8
14
|
ENABLE_COMMENTS: z.ZodOptional<z.ZodString>;
|
|
9
|
-
REDOCLY_EXP_DISABLE_MD_VALIDATION: z.
|
|
10
|
-
|
|
15
|
+
REDOCLY_EXP_DISABLE_MD_VALIDATION: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
false: "false";
|
|
17
|
+
true: "true";
|
|
18
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
19
|
+
ENABLE_SOURCE_MAPS: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
false: "false";
|
|
21
|
+
true: "true";
|
|
22
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
11
23
|
PLAN_GATES: z.ZodOptional<z.ZodString>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
false: "false";
|
|
26
|
+
true: "true";
|
|
27
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
15
28
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
16
|
-
/** (Optional) API endpoint for the agent feedback endpoint;**/
|
|
17
29
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
28
|
-
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
29
|
-
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
30
|
-
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
33
|
-
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
34
|
-
ENABLE_COMMENTS?: string | undefined;
|
|
35
|
-
REDOCLY_EXP_DISABLE_MD_VALIDATION?: "false" | "true" | undefined;
|
|
36
|
-
ENABLE_SOURCE_MAPS?: "false" | "true" | undefined;
|
|
37
|
-
PLAN_GATES?: string | undefined;
|
|
38
|
-
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
39
|
-
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
40
|
-
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
41
|
-
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
|
|
42
|
-
}>;
|
|
30
|
+
REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
false: "false";
|
|
32
|
+
true: "true";
|
|
33
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
34
|
+
REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
false: "false";
|
|
36
|
+
true: "true";
|
|
37
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
43
39
|
//# 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 o=_.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_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{o as featureFlagsSchema};
|
|
1
|
+
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const o=_.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_EXP_REPLAY_GRAPHQL_ENABLED:E(),REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED:E()});export{o as featureFlagsSchema};
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const organizationProjectSchema: z.ZodObject<{
|
|
3
|
-
ORGANIZATION_ID: z.
|
|
3
|
+
ORGANIZATION_ID: z.ZodOptional<z.ZodString>;
|
|
4
4
|
ORGANIZATION_SLUG: z.ZodOptional<z.ZodString>;
|
|
5
5
|
ORG_SLUG: z.ZodOptional<z.ZodString>;
|
|
6
|
-
PROJECT_ID: z.
|
|
6
|
+
PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
7
7
|
PROJECT_SLUG: z.ZodOptional<z.ZodString>;
|
|
8
8
|
PROJECT_URL: z.ZodOptional<z.ZodString>;
|
|
9
9
|
PROJECT_BUILD_ID: z.ZodOptional<z.ZodString>;
|
|
10
10
|
PUBLIC_REDOCLY_BRANCH_NAME: z.ZodOptional<z.ZodString>;
|
|
11
|
-
},
|
|
12
|
-
ORGANIZATION_ID?: string | undefined;
|
|
13
|
-
ORGANIZATION_SLUG?: string | undefined;
|
|
14
|
-
ORG_SLUG?: string | undefined;
|
|
15
|
-
PROJECT_ID?: string | undefined;
|
|
16
|
-
PROJECT_SLUG?: string | undefined;
|
|
17
|
-
PROJECT_URL?: string | undefined;
|
|
18
|
-
PROJECT_BUILD_ID?: string | undefined;
|
|
19
|
-
PUBLIC_REDOCLY_BRANCH_NAME?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
ORGANIZATION_ID?: string | undefined;
|
|
22
|
-
ORGANIZATION_SLUG?: string | undefined;
|
|
23
|
-
ORG_SLUG?: string | undefined;
|
|
24
|
-
PROJECT_ID?: string | undefined;
|
|
25
|
-
PROJECT_SLUG?: string | undefined;
|
|
26
|
-
PROJECT_URL?: string | undefined;
|
|
27
|
-
PROJECT_BUILD_ID?: string | undefined;
|
|
28
|
-
PUBLIC_REDOCLY_BRANCH_NAME?: string | undefined;
|
|
29
|
-
}>;
|
|
11
|
+
}, z.core.$strip>;
|
|
30
12
|
//# sourceMappingURL=organization-project.d.ts.map
|
|
@@ -3,10 +3,6 @@ import { z } from 'zod';
|
|
|
3
3
|
* Schema for scorecards configuration variables.
|
|
4
4
|
*/
|
|
5
5
|
export declare const scorecardsSchema: z.ZodObject<{
|
|
6
|
-
SCORECARDS_POLLING_INTERVAL_MS: z.ZodOptional<z.
|
|
7
|
-
},
|
|
8
|
-
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
9
|
-
}, {
|
|
10
|
-
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
11
|
-
}>;
|
|
6
|
+
SCORECARDS_POLLING_INTERVAL_MS: z.ZodOptional<z.ZodCoercedString<unknown>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
12
8
|
//# sourceMappingURL=scorecards.d.ts.map
|
|
@@ -4,21 +4,15 @@ import { z } from 'zod';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const searchSchema: z.ZodObject<{
|
|
6
6
|
SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
|
|
7
|
-
SEARCH_DEV_DEBUG: z.
|
|
8
|
-
|
|
7
|
+
SEARCH_DEV_DEBUG: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
false: "false";
|
|
9
|
+
true: "true";
|
|
10
|
+
}>>, z.ZodTransform<boolean, "false" | "true">>;
|
|
11
|
+
REDOCLY_SKIP_TYPESENSE_INDEXING: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
false: "false";
|
|
13
|
+
true: "true";
|
|
14
|
+
}>>, z.ZodTransform<boolean, "false" | "true">>;
|
|
9
15
|
TYPESENSE_API_URL: z.ZodOptional<z.ZodString>;
|
|
10
16
|
TYPESENSE_API_KEY: z.ZodOptional<z.ZodString>;
|
|
11
|
-
},
|
|
12
|
-
SEARCH_DEV_REINIT?: string | undefined;
|
|
13
|
-
SEARCH_DEV_DEBUG: boolean;
|
|
14
|
-
REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
|
|
15
|
-
TYPESENSE_API_URL?: string | undefined;
|
|
16
|
-
TYPESENSE_API_KEY?: string | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
SEARCH_DEV_REINIT?: string | undefined;
|
|
19
|
-
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
20
|
-
REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
|
|
21
|
-
TYPESENSE_API_URL?: string | undefined;
|
|
22
|
-
TYPESENSE_API_KEY?: string | undefined;
|
|
23
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
24
18
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
* Schema for server configuration variables.
|
|
4
4
|
*/
|
|
5
5
|
export declare const serverConfigSchema: z.ZodObject<{
|
|
6
|
-
PORT: z.ZodOptional<z.
|
|
6
|
+
PORT: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
7
7
|
REDOCLY_LOG_FORMAT: z.ZodOptional<z.ZodString>;
|
|
8
8
|
REDOCLY_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
9
9
|
TERM: z.ZodOptional<z.ZodString>;
|
|
@@ -12,37 +12,12 @@ export declare const serverConfigSchema: z.ZodObject<{
|
|
|
12
12
|
REDOCLY_CONTENT_DIR: z.ZodOptional<z.ZodString>;
|
|
13
13
|
REDOCLY_PORTAL_VERSION: z.ZodOptional<z.ZodString>;
|
|
14
14
|
REDOCLY_TELEMETRY: z.ZodOptional<z.ZodString>;
|
|
15
|
-
TELEMETRY_DEV_DEBUG: z.
|
|
15
|
+
TELEMETRY_DEV_DEBUG: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
false: "false";
|
|
17
|
+
true: "true";
|
|
18
|
+
}>>, z.ZodTransform<boolean | undefined, "false" | "true" | undefined>>;
|
|
16
19
|
WEB_SERVER_IDLE_TIMEOUT: z.ZodOptional<z.ZodString>;
|
|
17
20
|
REDOCLY_PROBLEMS_OUTPUT_FILE: z.ZodOptional<z.ZodString>;
|
|
18
21
|
REDOCLY_METADATA_OUTPUT_FOLDER: z.ZodOptional<z.ZodString>;
|
|
19
|
-
},
|
|
20
|
-
PORT?: number | undefined;
|
|
21
|
-
REDOCLY_LOG_FORMAT?: string | undefined;
|
|
22
|
-
REDOCLY_LOG_LEVEL?: string | undefined;
|
|
23
|
-
TERM?: string | undefined;
|
|
24
|
-
INSPECT_MODE?: string | undefined;
|
|
25
|
-
REDOCLY_PREFIX_PATHS?: string | undefined;
|
|
26
|
-
REDOCLY_CONTENT_DIR?: string | undefined;
|
|
27
|
-
REDOCLY_PORTAL_VERSION?: string | undefined;
|
|
28
|
-
REDOCLY_TELEMETRY?: string | undefined;
|
|
29
|
-
TELEMETRY_DEV_DEBUG?: boolean | undefined;
|
|
30
|
-
WEB_SERVER_IDLE_TIMEOUT?: string | undefined;
|
|
31
|
-
REDOCLY_PROBLEMS_OUTPUT_FILE?: string | undefined;
|
|
32
|
-
REDOCLY_METADATA_OUTPUT_FOLDER?: string | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
PORT?: number | undefined;
|
|
35
|
-
REDOCLY_LOG_FORMAT?: string | undefined;
|
|
36
|
-
REDOCLY_LOG_LEVEL?: string | undefined;
|
|
37
|
-
TERM?: string | undefined;
|
|
38
|
-
INSPECT_MODE?: string | undefined;
|
|
39
|
-
REDOCLY_PREFIX_PATHS?: string | undefined;
|
|
40
|
-
REDOCLY_CONTENT_DIR?: string | undefined;
|
|
41
|
-
REDOCLY_PORTAL_VERSION?: string | undefined;
|
|
42
|
-
REDOCLY_TELEMETRY?: string | undefined;
|
|
43
|
-
TELEMETRY_DEV_DEBUG?: "false" | "true" | undefined;
|
|
44
|
-
WEB_SERVER_IDLE_TIMEOUT?: string | undefined;
|
|
45
|
-
REDOCLY_PROBLEMS_OUTPUT_FILE?: string | undefined;
|
|
46
|
-
REDOCLY_METADATA_OUTPUT_FOLDER?: string | undefined;
|
|
47
|
-
}>;
|
|
22
|
+
}, z.core.$strip>;
|
|
48
23
|
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -4,9 +4,5 @@ import { z } from 'zod';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const siteSchema: z.ZodObject<{
|
|
6
6
|
SITE_URL: z.ZodOptional<z.ZodString>;
|
|
7
|
-
},
|
|
8
|
-
SITE_URL?: string | undefined;
|
|
9
|
-
}, {
|
|
10
|
-
SITE_URL?: string | undefined;
|
|
11
|
-
}>;
|
|
7
|
+
}, z.core.$strip>;
|
|
12
8
|
//# sourceMappingURL=site.d.ts.map
|
|
@@ -3,16 +3,11 @@ import { z } from 'zod';
|
|
|
3
3
|
* Schema for SSR (Server-Side Rendering) configuration variables.
|
|
4
4
|
*/
|
|
5
5
|
export declare const ssrSchema: z.ZodObject<{
|
|
6
|
-
REDOCLY_SSR_RENDER_MODE: z.ZodOptional<z.ZodEnum<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, {
|
|
14
|
-
REDOCLY_SSR_RENDER_MODE?: "main" | "worker" | undefined;
|
|
15
|
-
REDOCLY_SSR_WORKERS_MIN?: number | undefined;
|
|
16
|
-
REDOCLY_SSR_WORKERS_MAX?: number | undefined;
|
|
17
|
-
}>;
|
|
6
|
+
REDOCLY_SSR_RENDER_MODE: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
main: "main";
|
|
8
|
+
worker: "worker";
|
|
9
|
+
}>>;
|
|
10
|
+
REDOCLY_SSR_WORKERS_MIN: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
REDOCLY_SSR_WORKERS_MAX: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
18
13
|
//# sourceMappingURL=ssr.d.ts.map
|
|
@@ -5,11 +5,5 @@ import { z } from 'zod';
|
|
|
5
5
|
export declare const telemetrySchema: z.ZodObject<{
|
|
6
6
|
OTEL_TRACES_URL: z.ZodOptional<z.ZodString>;
|
|
7
7
|
REQUEST_ID: z.ZodOptional<z.ZodString>;
|
|
8
|
-
},
|
|
9
|
-
OTEL_TRACES_URL?: string | undefined;
|
|
10
|
-
REQUEST_ID?: string | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
OTEL_TRACES_URL?: string | undefined;
|
|
13
|
-
REQUEST_ID?: string | undefined;
|
|
14
|
-
}>;
|
|
8
|
+
}, z.core.$strip>;
|
|
15
9
|
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
`),loader:"css",resolveDir:
|
|
1
|
+
import*as m from"node:path";import{CONFIG_FILE_NAME as D,DEFAULT_THEME_NAME as g,USER_THEME_ALIAS as d}from"../../../constants/common.js";import{isDefined as k}from"../../../utils/guards/is-defined.js";import{slash as $}from"../../../utils/path/slash.js";import{resolveExternalPlugins as i}from"../../external-plugins/resolve-external-plugins.js";import{generateMarkdocComponentsEntry as L,generateMarkdocSchemasEntry as M}from"./codegen/index.js";const y=new Map,S=(a,n)=>{const h=m.resolve(n,d),p=m.resolve(n,D),R=["components","core","layouts","markdoc","icons","config","ext"],w="@redocly\\/theme\\/",E=R.map(t=>`${w}${t}`).join("|"),F=new RegExp(`^(@redocly/theme$|${E})`);return{name:"esbuild-redocly-custom-themes-resolver",setup:t=>{t.onResolve({filter:/@redocly-markdoc\/schema/},async e=>{const s=(await i(n,a.config.plugins)).flatMap(r=>r.markdoc?.schemaFile).filter(k);return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,p],watchDirs:[m.resolve(h,"markdoc")],pluginData:{schemaFiles:s}}}),t.onLoad({filter:/@redocly-markdoc\/schema/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:M(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@redocly-markdoc\/components/},async e=>{const s=[...(await i(n,a.config.plugins)).map(r=>r.markdoc?.componentsFile).filter(k)];return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...s,p],pluginData:{componentsFiles:s},watchDirs:[m.resolve(h,"markdoc")]}}),t.onLoad({filter:/@redocly-markdoc\/components/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:L(e),resolveDir:"/",loader:"ts"})),t.onResolve({filter:/@styles/},async e=>{const s=(await i(n,a.config.plugins)).map(r=>r.stylesFile).filter(Boolean);return{namespace:"user-styles-ns",path:e.path,watchFiles:[...s,p],pluginData:{styleFiles:s},watchDirs:[h]}}),t.onLoad({filter:/@styles/,namespace:"user-styles-ns"},async({pluginData:e})=>{const{styleFiles:o}=e;return{contents:o.map(r=>`@import url("${$(m.relative(n,r))}");`).join(`
|
|
2
|
+
`),loader:"css",resolveDir:n}}),t.onResolve({filter:/(^|\/)styles\.css$/},async({path:e,...o})=>{if(o.pluginData==="missing-styles-ns")return;const s=await t.resolve(e,{...o,pluginData:"missing-styles-ns"});return s.errors.length&&s.errors.some(r=>r.text.match(/^Could not resolve .*?\bstyles.css\b/))?{namespace:"missing-styles-ns",path:e}:s}),t.onLoad({filter:/(^|\/)styles\.css$/,namespace:"missing-styles-ns"},async()=>({contents:"",loader:"css"})),t.onResolve({filter:/^react-router-dom$/},()=>({namespace:"react-router-dom-ns",path:"react-router-dom"})),t.onLoad({filter:/^react-router-dom$/,namespace:"react-router-dom-ns"},async()=>{const o=(await i(n,a.config.plugins)).find(({name:c})=>c===g),s=await t.resolve("@redocly/theme/package.json",{resolveDir:o?.pluginDirAbsolutePath??n,kind:"require-resolve"});return{contents:`import * as ReactRouter from 'react-router';
|
|
3
3
|
export const useLocation = ReactRouter.useLocation;
|
|
4
|
-
export const useInRouterContext = ReactRouter.useInRouterContext;`,loader:"js",resolveDir:
|
|
4
|
+
export const useInRouterContext = ReactRouter.useInRouterContext;`,loader:"js",resolveDir:s.errors.length?n:m.dirname(s.path)}}),t.onResolve({filter:F},async e=>{if(e.resolveDir==="")return;const o=`${e.path}:${e.importer}`;if(y.has(o))return y.get(o);const{path:s,...r}=e,c=await i(n,a.config.plugins),u=e.path.replace(g,"")||"index";for(let l=c.length-1;l>=0;l--){const x=c[l].isNpmPackage?[m.join(c[l].name,"src",u),{...r,resolveDir:c[l].pluginDirAbsolutePath}]:[`./${u}`,{...r,resolveDir:c[l].pluginDirAbsolutePath}],f=T(await t.resolve(...x));if("path"in f&&f.path!==e.importer){const v={...f,watchFiles:[p,m.join(n,d,u+".tsx")]};return c[l].name===d||y.set(o,v),v}}})}}};function T(a){return a.errors.length?{errors:a.errors}:a}export{S as ThemesResolver,y as resolveCache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as m,readFileSync as F}from"node:fs";import{createRequire as k}from"node:module";import s from"node:path";import{resolvePlugins as A}from"@redocly/openapi-core";import{DEFAULT_PROJECT_PLUGIN_PATHS as d,DEFAULT_THEME_PLUGIN_PATH as c,STYLES_FILE as S}from"../constants/common.js";import{GATED_PLUGINS as v}from"../constants/entitlements.js";import{DEFAULT_THEME_NAME as h}from"../../constants/common.js";import{isDefined as _}from"../../utils/guards/is-defined.js";import{isPlainObject as g}from"../../utils/guards/is-plain-object.js";import{logger as C}from"../tools/notifiers/logger.js";import{reporter as L}from"../tools/notifiers/reporter.js";import{sha as w}from"../utils/crypto/sha.js";import{resolveModule as P}from"./resolve-module.js";import{EntitlementsProvider as I}from"../entitlements/entitlements-provider.js";const f={sha:"",value:Promise.resolve({resolvedPlugins:[],errors:[]})};async function ee(e,r=[]){const n=w(JSON.stringify(r));if(f.sha!==n){f.sha=n;const o=M(e),a=N(e,r,o),p=await A(a,e)||[];if(!a.some(i=>d.includes(i))){const i=d[0],l=s.join(e,i);p.push({id:"",absolutePath:l,path:i})}f.value=Promise.all(p.map(i=>b(i,i.path===o?c:i.path))).then(i=>{const l=i.filter(_),j=l.filter(u=>u?.type&&["error","warning"].includes(u.type)),D=l.filter(u=>u.type==="resolvedPlugin");return{errors:j,resolvedPlugins:D}})}const t=await f.value;if(t.errors.length)for(let o=0;o<t.errors.length;o++)await L.panicOnBuildContentError(t.errors[o].error);return t.resolvedPlugins}function M(e){const r=s.resolve(e,"package.json");if(!y(s.dirname(r)))return P(c)??c;const n=E(o=>k(r).resolve(o)),t=E(P);return n&&t&&n!==t&&C.warn("The project declares %s %s, and Realm uses it instead of the %s it was built with.",h,n,t),c}function y(e){const r=T(s.join(e,"package.json")),n=[r?.dependencies,r?.devDependencies].some(o=>g(o)&&h in o),t=s.dirname(e);return n||t!==e&&y(t)}function E(e){try{const r=e(`${h}/package.json`),n=r&&T(r)?.version;return typeof n=="string"?n:void 0}catch{return}}function T(e){try{const r=JSON.parse(F(e,"utf8"));return g(r)?r:void 0}catch{return}}function N(e,r=[],n){const t=[...r];for(const o of d)!t.includes(o)&&m(s.join(e,o))&&t.push(o);return t.includes(c)||t.unshift(n),t}async function b(e,r){if(!e.absolutePath||!r)return{type:"error",error:`Plugin with path "${e}" not found`};const n=s.dirname(e.absolutePath),{lifecyclePlugin:t,config:o}=R(e,r);return{name:s.dirname(r),type:"resolvedPlugin",isNpmPackage:O(r),pluginDirAbsolutePath:n,lifecyclePlugin:t,config:o,stylesFile:s.resolve(n,S),markdoc:U(n)}}function O(e){const r=s.dirname(e);return P(s.join(r,"package.json"))!=null}function R(e,r){const n=I.instance(),t=!n.canAccessFeature("customPlugins")&&!v.includes(r),o=e.requiredEntitlements&&v.includes(r)&&!e.requiredEntitlements.every(a=>n.canAccessFeature(a));return t||o?{lifecyclePlugin:{id:e.id},config:{}}:{lifecyclePlugin:{id:e.id,processContent:e.processContent,afterRoutesCreated:e.afterRoutesCreated,loaders:e.loaders,requiredEntitlements:e.requiredEntitlements},config:{schema:e.redoclyConfigSchema,ejectIgnore:e.ejectIgnore}}}function U(e){const r=s.resolve(e,"markdoc"),n=s.join(r,"schema.ts");if(!m(n))return null;const t=s.join(r,"components.tsx");return{schemaFile:n,componentsFile:m(t)?t:void 0}}export{ee as resolveExternalPlugins};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as
|
|
1
|
+
import{resolve as c,dirname as p}from"node:path";import{fileURLToPath as f}from"node:url";import{createReadStream as l}from"fs";import{envConfig as u}from"./config/env-config.js";import{telemetry as d}from"./telemetry/index.js";import{createRouter as v}from"./web-server/router.js";import{installProdRoutes as g}from"./web-server/routes/index.js";import{Store as S}from"./store.js";import{loadEnvVariables as R}from"./utils/envs/load-env-variables.js";import{startHttpServer as x}from"./web-server/http.js";import{readStaticData as D}from"./utils/static-data.js";import{startIdleTimeout as P}from"./web-server/middleware/idleTimeoutMiddleware.js";import{reporter as w}from"./tools/notifiers/reporter.js";import{logger as E}from"./tools/notifiers/logger.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{DatabasePreconnectService as b}from"./providers/database/database-preconnect-service.js";import{KvService as h}from"./persistence/kv/services/kv-service.js";import{runScorecardsWorker as I}from"./plugins/scorecards/workers/run-scorecards-worker.js";import{isScorecardsEnabled as O}from"./utils/is-scorecards-enabled.js";import{isRealmOrReef as T}from"./utils/is-realm-or-reef.js";import{renderPage as rr}from"./ssr/index.js";const k=new URL(import.meta.url),A=k.searchParams.get("only-exports")==="true";if(!A){let s=function(){const r=process.argv.findIndex(i=>i==="--port"||i==="-p");if(r===-1)return null;const t=process.argv[r+1];if(t.startsWith("-"))return null;const o=parseInt(t,10);return isNaN(o)?null:o};const e=p(f(import.meta.url));await R(e);const n=await S.fromServerFiles({outdir:c(e,"../client"),serverOutDir:e,serverMode:!0,contentDir:""});if(await y.instance().init({ignoreTokenExpiration:!0}),T()){await b.init(e);const r=await h.getInstance({baseDbDir:e});setInterval(()=>{r.clearExpired().catch(t=>{E.error("Failed to clear expired KV entries",t)})},300*1e3)}m(n).catch(r=>{console.error(r)});async function m(r){d.initialize();const t=v();g(t,r,{readStaticAsset:async a=>l(a),resolveRouteData:async a=>D(a.slug,r.outdir)}),w.printErrors();const o=s(),i=u.PORT;return await x(t,o??i??4e3),P(),O(r.config)&&I(r.serverOutDir,r.config.scorecards),t}}export{rr as renderPage};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RbacScopeItems } from '@redocly/config';
|
|
2
|
+
import type { BundledApiDefinition } from './loader.js';
|
|
3
|
+
/** What the download route needs to apply the API page's access rule to one definition. */
|
|
4
|
+
export type ApiDefinitionAccess = {
|
|
5
|
+
/** Content-relative source file (`customOutputRelativeFile || relativePath`). */
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
/** The API's base page slug, e.g. `/apis/internal`. */
|
|
8
|
+
slug: string;
|
|
9
|
+
/** `apis.<name>.rbac`; replaces the content rule when present. */
|
|
10
|
+
rbac?: RbacScopeItems;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The key of the definition that a download of `stem` on the GraphQL route (`/_spec-gql`) or
|
|
14
|
+
* on a bundle route (`/_bundle`, `/_spec`) describes; `stem` is the request path after the
|
|
15
|
+
* route prefix without its extension (`apis/museum` for `apis/museum.yaml`), so one bundle
|
|
16
|
+
* answers under `.json`, `.yaml` and `.yml`. A schema and a bundle of one stem have distinct keys.
|
|
17
|
+
*/
|
|
18
|
+
export declare function requestDefinitionAccessKey(isGraphql: boolean, stem: string): string;
|
|
19
|
+
/** The key of `definition` in the access map; undefined for one under the public static folder. */
|
|
20
|
+
export declare function definitionAccessKey(definition: Pick<BundledApiDefinition, 'relativePath' | 'type'>): string | undefined;
|
|
21
|
+
export declare function describeDefinitionAccess(definition: BundledApiDefinition, basePath: string): ApiDefinitionAccess;
|
|
22
|
+
//# sourceMappingURL=definition-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PUBLIC_STATIC_FOLDER as o}from"../../constants/common.js";import{removeTrailingSlash as i}from"../../../utils/url/remove-trailing-slash.js";import{resolveConfigRbac as n}from"./utils/resolve-config-rbac.js";import{replaceFileExtension as c}from"./utils/replace-file-extension.js";function s(e,r){return`${e?"graphql":"bundle"}:${r}`}function f(e){if(!e.relativePath.startsWith(o+"/"))return s(e.type==="graphql",c(e.relativePath,""))}function m(e,r){const t=n(e.config);return{sourcePath:e.customOutputRelativeFile||e.relativePath,slug:i(r),...t===void 0?{}:{rbac:t}}}export{f as definitionAccessKey,m as describeDefinitionAccess,s as requestDefinitionAccessKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as T,REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{mcpTagSchemas as rt,schemaDefinitionTag as at,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as $}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as j,GRAPHQL_SPEC_SLUG as st,PUBLIC_RBAC_SCOPE_ITEM as N}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as it,PUBLIC_API_DEFINITIONS_FOLDER as nt}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as O}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as ct}from"../../utils/paths.js";import{normalizeRouteSlug as pt}from"../../../utils/path/normalize-route-slug.js";import{removeTrailingSlash as ut}from"../../../utils/url/remove-trailing-slash.js";import{isTranslationFallback as lt}from"../../fs/utils/is-translation-fallback.js";import{createSlugify as dt}from"../create-slugify.js";import{apiDocLoader as mt,apiDocsLoader as ft}from"./loader.js";import{getTemplatePath as V}from"./get-template-path.js";import{storeDefinitionBundles as gt}from"./store-definition-bundles.js";import{definitionAccessKey as ht,describeDefinitionAccess as Dt}from"./definition-access.js";import{telemetryTraceStep as St}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as Pt}from"./search/search-resolver.js";import{getAiDocumentsStore as yt}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as At}from"../get-api-config.js";import{getRouteSlugsForPath as It}from"../utils.js";import{collectItemRoutes as vt}from"./utils/collect-item-routes.js";import{isChunkCurrent as bt}from"./utils/decorators.js";import{applyNavItemToRoot as Rt}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as _t}from"./utils/build-routes-mapping.js";import{buildItemPositions as Ct}from"./utils/build-item-positions.js";import{resolveApiDocTitle as Tt}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as K}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as wt}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Et}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as W}from"./import-api-docs-builder.js";import{envConfig as G}from"../../config/env-config.js";import{logger as kt}from"../../tools/notifiers/logger.js";const F="openapi-spec-download",Ot={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function he(){let e=[],r=new Map;const s=new WeakMap;let n=new Set,f={},A={};function Y(o,S,b){const I=s.get(o)??new Map;s.set(o,I);const P=S??"";return I.get(P)===b?!1:(I.set(P,b),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":mt,"api-docs":ft},processContent:async(o,S)=>{await St("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(F,ct(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:nt+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})}),o.addApiRoute({slug:it+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})}),o.addApiRoute({slug:st+"/*",requestHandlerId:F,httpMethod:"all",[v]:N,getStaticData:async()=>({props:{definitionAccess:A}})});const b=o.createTemplate(j,V("../../../client/templates/api-docs/template.js")),I=o.registerServerPropsGetter(j,V("./get-server-props.js")),P=await S.getConfig();r=new Map,f={};const y=await o.loadApiDocuments(S);gt(y,o.outdir),A={};const w=!!P.plugins?.some(t=>typeof t=="string"&&t.startsWith("@redocly/portal-plugin-async-api/"));w&&y.some(t=>t.type==="asyncapi")&&kt.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const p=w?y.filter(t=>t.type!=="asyncapi"):y;e=p.map(({markdocChunks:t,relativePath:u,isVirtual:c,customOutputRelativeFile:a,realRelativePath:D})=>({chunks:t??[],relativePath:u,realRelativePath:D,isVirtual:a!=null||c}));const{buildItems:i}=await W(o.serverOutDir),g=(await S.cache.load("content-slugs","content-slugs")).data,h=dt(g),E=t=>pt(h(t));for(const t of y){const u=ht(t);if(u===void 0)continue;const c=E(t.customOutputRelativeFile||t.relativePath);A[u]=Dt(t,c)}for(const t of p){const u=t.customOutputRelativeFile||t.relativePath,c=E(u);Lt(t,c);const{items:a,store:D}=await i({type:t.type,document:t.document,options:t.options,basePath:c,markdownParser:U}),R=`${O}${t.relativePath}`,M=G.isDevelopMode?t.relativePath:void 0,l=qt(t.document),_=l?.["x-metadata"],C=t.isVirtual?void 0:_?.apiId,L={document:t,basePath:c,sourcePath:M,apiId:C,build:{items:a,store:D}};await o.createSharedData(R,Q(L,a,D));const X=K(t.config),B=!!t.options.excludeFromSearch,J=t.type==="openapi",Z=vt(a,X),tt=lt(t),m=Z.map(d=>{const x=d.metadata?.seo,k={fsPath:u,templateId:b,sharedData:[{key:"apiDocsStore",id:R}],serverPropsGetterIds:[I],excludeFromSearch:B,getStaticData:Mt(d.label,x,tt),[v]:d[v]};return Object.assign(k,Bt(d.link,c)),J&&d.httpVerb&&(k.httpVerb=d.httpVerb,k.metadata={subType:"openapi-operation"}),k});if(!m.length)continue;const H=Tt(l,t.type,a),et=Et(l?.version),q={type:t.type,title:H,version:et,description:typeof l?.description=="string"?l.description:void 0,summary:typeof l?.summary=="string"?l.summary:void 0,...l?.["x-metadata"]&&typeof l["x-metadata"]=="object"?l["x-metadata"]:{}};m[0]={...m[0],metadata:q,hasClientRoutes:!0,getSidebar:(d,x)=>Rt(z(a),c,x),getNavText:()=>H??Ot[t.type]??"API Docs",getSearchDocuments:Pt(a,q,o.getSearchFacets,o.setSearchFacets,B,D,t.document),getAiDocumentsStore:yt({getBuild:()=>L.build,metadata:q,document:t.document,specType:t.type,excludeFromSearch:B,basePath:c,getSearchFacets:o.getSearchFacets,markdocTags:{...rt,schemaDefinition:at}})};const ot=m[0];m[0]=m[m.length-1],m[m.length-1]=ot;for(const d of m)o.addRoute(d);if(C){const d=At(t.config?.apis,t.realRelativePath);f[C]={[v]:d.rbac,[T]:{fsPath:u}}}r.set(R,L)}})},afterRoutesCreated:async(o,S)=>{const{buildItems:b,simplifyAstStructure:I}=await W(o.serverOutDir),P=new Set,y=new Set;for(const{chunks:p,relativePath:i,isVirtual:g}of e){const h=`${O}${i}`,E=It(o.getAllRoutes(),i);for(const{node:t,markdown:u,pointer:c,key:a,relativePath:D}of p){const{ast:R,compoundHash:M}=await o.parseMarkdoc({input:{content:u,relativePath:D,isVirtual:g},resource:c,context:S,deps:{sharedDataIds:[`${O}${D}`],routeSlugs:E}});if(P.add(c),!(a==="graphql-docs"?t?.description?.value!==void 0:!!a&&bt(t,a,u))||!Y(t,a,M))continue;y.add(h);const _=I(R);if(a==="graphql-docs"){t.description&&(t.description.value=_);const C=`${O}${D}`;Ft(r.get(C),_)}else a&&(t[a]=_)}}const w=n.difference(P);for(const p of w)S.cache.delete(p);n=P,Object.entries(f).forEach(([p,i])=>{const g=i[T]?.fsPath;if(!g)return;const h=o.getRouteByFsPath(g)?.baseSlug;f[p]={...i,[T]:{...i[T],slug:h},slug:h}}),o.setGlobalData({apiProducts:f});for(const[p,i]of r){if(!y.has(p))continue;const{items:g,store:h}=await b({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});i.build={items:g,store:h},await o.createSharedData(p,Q(i,g,h))}}}}function Q({document:e,basePath:r,sourcePath:s,apiId:n},f,A){return{[v]:K(e.config),[T]:{slug:ut(r),fsPath:e.customOutputRelativeFile||e.relativePath},items:f,store:A,options:e.options,baseSlug:r,routesMapping:G.isDevelopMode?_t(f,r):{},graphqlPositions:G.isDevelopMode&&e.type==="graphql"?Ct(f,r):void 0,sourcePath:s,apiId:n}}function Ft(e,r){e?.document.type!=="graphql"||!e.document.options||(e.document.options.info={...e.document.options.info||{},description:r})}function Mt(e,r,s){return async function(n){return{...s?{isTranslationFallback:!0}:{},props:{settings:{baseUrlPath:$(n.baseSlug)},disableAutoScroll:!0,seo:{title:e,...r}}}}}function Lt(e,r){const s=e.options?.mockServer,n=$(`/_mock${wt(e.relativePath)}`);s?.url===n&&(e.options={...e.options,mockServer:{...s,url:$(`/_mock${r}`)}})}function Bt(e,r){if(e===r)return{};const s=r==="/"?"/":`${r}/`;if(e.startsWith(s)){const n=e.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:e}}function qt(e){if(e&&typeof e=="object"&&"info"in e)return e.info}function z(e){return e.map(({content:r,items:s,...n})=>({...n,...s&&{items:z(s)}}))}export{he as apiDocsPlugin,Bt as toRouteSlugFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as O from"node:path";import{findFirstBinding as A,markdocParser as F}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 L}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as E}from"../../config/env-config.js";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as B}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as p}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as M}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const a=M(r);return{url:k(`/_mock${a}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(L,`${p(o,O.posix.extname(o))}?download`)]:[i(f,`${p(o,".json")}?download`),i(f,`${p(o,".yaml")}?download`)]).map(a=>({url:k(a)}))}function X(o,r,m){const{rootConfig:a,config:s,apiConfig:c,mergedConfig:e,relativePath:l}=m,n=w(a?.[o]||{},s[o]||{},c[o]||c.theme?.[o]||{}),S=r["x-feedback"]||n.feedback||s.feedback,b=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!a?.[o]?.excludeFromSearch||!!a?.theme?.[o]?.excludeFromSearch,_=e.rbac||c.rbac,g=B(S),u=s.metadata,x={...g&&{feedback:g},mockServer:D(e?.mockServer||a?.mockServer,l),disableRouter:!0,downloadUrls:n.downloadUrls||I(l,o),excludeFromSearch:b,rbac:_,markdownParser:F,replayFeatures:{graphql:E.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1,asyncapi:E.REDOCLY_EXP_REPLAY_ASYNCAPI_ENABLED??!1}};let d;if(o==="graphql"){const t=n;d={title:t.info?.title,...u,...t.metadata??{}}}else{const t=r.info,P=t?.["x-metadata"];d={title:t?.title,description:t?.description,...o==="openapi"&&{summary:t?.summary},...u,...P}}o==="openapi"&&n.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const C=n.markdocOptions??R,h={...n,...x,specType:o,markdocOptions:C,metadata:d};return o==="asyncapi"&&(h.protocol=A(r)??void 0),h}export{I as buildDownloadUrls,X as createOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"node:path";import{existsSync as u}from"node:fs";import{readFile as I}from"node:fs/promises";import L from"js-yaml";import{withoutPathPrefix as j}from"@redocly/theme/core/utils";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as g,PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as T}from"../../../constants/common.js";import{requestDefinitionAccessKey as C}from"./definition-access.js";import{canDownloadApiDefinition as U,filterDataByAccessDeep as B}from"../../utils/rbac.js";import{API_DOWNLOAD_PREFIXES as G}from"../../utils/is-api-download-link.js";import{decodeRequestPath as W}from"../../utils/decode-request-path.js";import{replaceFileExtension as X}from"./utils/replace-file-extension.js";const v=[".json",".yaml",".yml"],H=[".graphql",".gql"];function F(r,o){const t=e.parse(r);return e.join(t.dir,t.name+o)}const J=async(r,o,t)=>{const{isAuthenticated:a,teams:m,claims:{email:d}}=o.user,S=new URL(r.url),n=W(j(S.pathname));if(n===void 0||n.endsWith("/"))return new Response("Bad Request",{status:400});const c=G.find(i=>n.startsWith(`${i}/`));if(c===void 0)return new Response("Not found",{status:404});const p=c===T,s=n.slice(c.length),l=e.extname(s);if(!(p?H:v).includes(l))return new Response("Not found",{status:404});const{rbac:h={},requiresLogin:P=!1}=o.config.access||{},y=(t.props?.definitionAccess??{})[C(p,X(s.slice(1),""))];if(!U(n,h,P,{isAuthenticated:a,email:d,teams:m},y))return new Response("Unauthorized",{status:a?403:401});const f=t.props?.outdir||"";if(p){const i=e.join(f,w,s);if(!u(i))return new Response("Not found",{status:404});const q=await I(i,"utf-8");return new Response(q,{headers:{"Content-Type":"application/graphql"}})}const E=e.join(f,w,F(s,".json")),R=e.join(f,g,F(s,".json")),A=u(E),D=u(R);if(!A&&!D)return new Response("Not found",{status:404});const _=await I(A?E:R,"utf-8"),x=JSON.parse(_),N=B(x,{isAuthenticated:a,email:d,teams:m},h,P),O=l===".yaml"?L.dump(N):JSON.stringify(N,null,2);return new Response(O,{headers:{"Content-Type":l===".yaml"?"application/yaml":"application/json"}})};var ie=J;export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import S from"path";import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import S from"path";import{REDOCLY_ROUTE_RBAC as b,REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{deepMerge as w}from"../../../utils/object/deep-merge.js";import{parsePathVersions as D}from"../../../utils/path/parse-path-versions.js";import{buildWildcardRedirectsTree as T}from"../../utils/redirects/build-wildcard-redirects-tree.js";import{shaHexShort as O}from"../../utils/crypto/sha-hex-short.js";import{isDefined as E}from"../../../utils/guards/is-defined.js";import{logger as L}from"../../tools/notifiers/logger.js";import{formatCustomScripts as h,formatCustomLinks as k}from"./format-custom-tags.js";import{applyL10nToRbacConfig as G,resolveDirectoryHashes as j}from"../../utils/rbac.js";import{isConsentEnabled as B}from"../consent/is-consent-enabled.js";import{copySeoAssets as F}from"./copy-seo-assets.js";import{normalizeRedirectSources as _}from"./normalize-redirect-sources.js";import{applyL10nToRedirects as x}from"./apply-l10n-to-redirects.js";import{DEFAULT_LOADERS as M}from"./loaders/index.js";import{resolveSearchFacets as z}from"./resolve-search-facets.js";import{telemetryTraceStep as I}from"../../../cli/telemetry/helpers/trace-step.js";import{transformMdAst as V}from"../markdown/runtime-transform.js";import{EntitlementsProvider as q}from"../../entitlements/entitlements-provider.js";async function lr(){return{id:"Config Parser",loaders:M,async processContent(e,{getConfig:a,fs:n}){await I("com.redocly.build.plugin.configParser",async t=>{const{contentDir:l,setGlobalConfig:o,setGlobalData:s}=e,r=await a(),i=r.access||{},m=G(n,i.rbac||{}),f={outdir:e.outdir,contentDir:l,consentEnabled:B(r.consent)},C=await h(r.scripts?.head,f),P=await k(r.links,f),R=await h(r.scripts?.body,f),d=w(r,{headScriptTags:C,linkTags:P,postBodyScriptTags:R});t?.setAttribute("config",JSON.stringify(d));const p=r.redirects?_(r.redirects):{},v=Object.keys(p),A=d.banner?.map(c=>typeof c=="object"&&c!==null&&c.rbac?{...c,[y]:c.rbac}:c);o({...d,banner:A,access:{...i,requiresLogin:!!i.requiresLogin,rbac:m},directoryPaths:await j(n,i.rbac),seo:r.seo&&await F(r.seo,f.contentDir,f.outdir),redirects:x(p,r.l10n),wildcardRedirectsTree:T(p),originalRedirectSources:v}),z(r.search?.filters?.facets||[],e.getSearchFacets,e.setSearchFacets);const g=q.instance(),u=!!g.canAccessFeature("removeAttribution");s({removeAttribution:g.pricingTier?u:!0,removeConsoleAttribution:u&&r.removeAttribution===!0})})},async afterRoutesCreated(e,a){H(e);const n=e.getGlobalConfig("banner");if(Array.isArray(n)){const t=await Promise.all(n.map(async(l,o)=>{const{content:s,...r}=l;if(!s){L.warn(`redocly.yaml: banner[${o}] has no content and is not shown.`);return}const{ast:i}=await e.parseMarkdoc({input:{content:s,relativePath:"redocly.yaml"},context:a,resource:`redocly.yaml#banner${o}`}),{renderableAst:m}=await V(i,{variables:{},partials:{}},e.serverOutDir);return Object.assign(r,{ast:m,hash:O(s)})}));e.setGlobalConfig({banner:t.filter(E)})}}}}function H(e){const a=e.getGlobalConfig("access")?.rbac,n=e.getGlobalConfig("directoryPaths");if(!(!a||Object.keys(a).length===0))for(const t of e.getAllRoutes()){if(t.versions&&n){const l=D(t.fsPath)?.filePathInVersion||"index.md";for(const o of t.versions){const s=n[o.folderId],i=s==="."||s==="/"?"":s;o[b]={slug:o.link,fsPath:S.posix.join(i,"@"+o.version,l)}}}t[b]||t[y]||(t[b]={slug:t.slug,fsPath:t.fsPath})}}export{lr as configParserPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildCodeSamples as
|
|
1
|
+
import{buildCodeSamples as v,getRequestBodySamples as d,normalizeOptions as f,resolveOperationSampleContext as S}from"@redocly/api-docs";import{setNodeAttributeValue as O}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{loadOpenapiBundle as b}from"./helpers/load-openapi-bundle.js";import{getOptionalAttribute as t}from"./utils.js";const h={curl:"shell",JavaScript:"javascript","Node.js":"javascript",Python:"python",Java:"java","Java8+Apache":"java","C#":"csharp","C#+Newtonsoft":"csharp",PHP:"php",Go:"go",Ruby:"ruby",R:"r"};async function N(e,u,x,{context:g}){const o=await b(e,g);if(!o)return;const i=t(e,"language"),l=t(e,"options"),n={exampleKey:t(e,"exampleKey"),mimeType:t(e,"mimeType"),parameters:t(e,"parameters"),requestBody:t(e,"requestBody"),environments:t(e,"environments"),environment:t(e,"environment")},y={...o.rawOptions,...l,...o.rawOptions.mockServer&&{mockServer:{...o.rawOptions.mockServer,position:"off"}},codeSamples:{...o.rawOptions.codeSamples,...l?.codeSamples,...i&&{languages:[{lang:i}]}}},m=f(y),r=S(o.definition,m,{operationId:t(e,"operationId"),pointer:t(e,"pointer")});if(!r)return;const s=v(r,n).map(a=>({lang:h[a.lang]??a.lang.toLowerCase(),title:a.label??a.lang,source:a.source})),c=m.codeSamples?.languages??[],p=c.findIndex(({lang:a})=>a==="Payload");if(p!==-1){const a=d(r,{exampleKey:n.exampleKey,mimeType:n.mimeType,titlePrefix:c[p].label});s.splice(p,0,...a)}s.length&&O(e,u,s)}export{N as resolveOpenapiCodeSamples};
|
|
@@ -2,5 +2,5 @@ import type { McpToolSchema } from '../../../../types';
|
|
|
2
2
|
import type { McpToolCallback, McpToolContext } from '../../types.js';
|
|
3
3
|
import { type SandboxCapability } from '../capabilities/index.js';
|
|
4
4
|
export declare function describeToolsSchema(tools: McpToolSchema[], capabilities: SandboxCapability[]): McpToolSchema;
|
|
5
|
-
export declare function describeTools(tools: McpToolSchema[],
|
|
5
|
+
export declare function describeTools(tools: McpToolSchema[], capabilities: SandboxCapability[], context: McpToolContext): McpToolCallback;
|
|
6
6
|
//# sourceMappingURL=describe-tools.d.ts.map
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{renderDescribeToolsOutput as
|
|
2
|
-
|
|
3
|
-
`);return E({tool:l,mode:m,serverType:u.Docs,args:t,result:h,...d}),k({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),outputLength:h.length,...d}),{content:[{type:"text",text:h}]}}catch(e){const i=e instanceof O,a=i?"tool_error":"server_error";throw E({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:a,...d}),C({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),message:e instanceof Error?e.message:String(e),stack:!i&&e instanceof Error&&e.stack||"",errorClass:a,...d}),e}}}export{z as describeTools,B as describeToolsSchema};
|
|
1
|
+
import{renderDescribeToolsOutput as E}from"../capabilities/index.js";import{McpServerType as u,READ_ONLY_ANNOTATIONS as O}from"../../constants.js";import{logMcpToolCallAudit as h,reportMcpToolCalled as S,reportMcpToolError as b}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as l}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as v}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as w}from"./tool-errors.js";import{callAttribution as D}from"../../utils/telemetry-attributes.js";function R(p,i){const n=[...new Set([...p.map(r=>s(r.name)),...i.map(r=>s(r.id))])];return{name:l,title:"Get docs function signatures",description:v,annotations:O,schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${n.join(", ")}. Omit to describe everything.`,items:n.length>0?{type:"string",enum:n}:{type:"string"},nullable:!0}}}}}function U(p,i,n){const r=new Map(p.map(t=>[s(t.name),t])),T=new Map(i.map(t=>[s(t.id),t]));return async t=>{const y=performance.now(),m=n.mcpMode??"code",d=D(n);try{const o=[...new Set((t.tools??[]).map(s))],a=o.length===0,c=o.filter(e=>!r.has(e)&&!T.has(e));if(c.length>0){const e=[...r.keys(),...T.keys()];throw new w(`Unknown tool(s): ${c.join(", ")}. Valid tools: ${e.join(", ")}.`)}const M=a?i:i.filter(e=>o.includes(s(e.id))),g=a?p:o.filter(e=>r.has(e)).map(e=>r.get(e)),f=E(g,M,n);return h({tool:l,mode:m,serverType:u.Docs,args:t,result:f,...d}),S({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-y),outputLength:f.length,...d}),{content:[{type:"text",text:f}]}}catch(o){const a=o instanceof w,c=a?"tool_error":"server_error";throw h({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:c,...d}),b({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-y),message:o instanceof Error?o.message:String(o),stack:!a&&o instanceof Error&&o.stack||"",errorClass:c,...d}),o}}}export{U as describeTools,R as describeToolsSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as A}from"../../../tools/notifiers/logger.js";import{getFeedbackClientIp as
|
|
1
|
+
import{logger as A}from"../../../tools/notifiers/logger.js";import{getFeedbackClientIp as v}from"../../../web-server/utils/feedback-ip.js";import{getForwardedOrigin as M,getInternalOrigin as N}from"../../../web-server/utils/get-request-origin.js";import{GATEWAY_FETCH_LIMIT_DEFAULTS as L,DEFAULT_ANONYMOUS_VISITOR_TEAM as B,RbacFeatures as H}from"../../../../constants/common.js";import{isObject as j}from"../../../../utils/guards/is-object.js";import{getAccessibleSkills as V}from"../../../utils/skills/get-accessible-skills.js";import{getSkillUrl as $}from"../../../utils/skills/get-skill-url.js";import{createMcpHandler as Y}from"@modelcontextprotocol/server";import{createDocsMcpServer as G}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as J,filterGraphqlDescriptionsByRbac as K}from"../utils.js";import{userSubject as z}from"../gateway-mcp/subject.js";import{ipRateLimitKey as X}from"../gateway-mcp/rate-limit/utils/ip-key.js";import{createMethodNotAllowedError as Q,withErrorHandling as W}from"./errors.js";import{constructForbiddenResponse as Z,constructInvalidTokenResponse as q,constructUnauthorizedResponse as x,handleMcpAuth as ee}from"../auth/auth-handlers.js";import{isAssistantAnonymousToken as oe}from"../auth/assistant-anonymous-token.js";import{shouldHandleMcpAuth as re}from"../../../utils/rbac/should-handle-mcp-auth.js";import{extractTokenFromAuthHeader as se}from"../utils/jwt.js";import{resolveMcpClient as ie}from"../utils/mcp-client.js";import{randomUUID as ne}from"../../../utils/crypto/random-uuid.js";import{getPublicMcpEndpointStatus as te}from"../utils/public-endpoint.js";import{narrowMcpConfigForCaller as ce}from"../gateway-mcp/caller-api-calls.js";import{DEFAULT_DOCS_MCP_SERVER_NAME as ae,SSE_KEEPALIVE_INTERVAL_MS as pe}from"../constants.js";import{withPathPrefix as de}from"@redocly/theme/core/utils";import{PUBLIC_MCP_ROUTE as le}from"@redocly/theme/core/constants/mcp";import{canAccessFeature as me}from"../../../utils/rbac.js";import{ANONYMOUS_AUTH_DETAILS as fe}from"../../../constants/rbac.js";const E="X-Redocly-AI-Metadata",ue=1024*1024;function ge(o){if(o)try{const e=JSON.parse(o);if(j(e))return e;A.warn(`Ignoring ${E} header: not a JSON object.`)}catch{A.warn(`Ignoring ${E} header: invalid JSON.`)}}function he(o,e){return new URL(o).searchParams.get("mode")==="tools"?"tools":e}function b(){return{...fe,email:"",idpAccessToken:void 0,idpId:void 0}}const Ae=async(o,e,n)=>{const t=!!e?.config?.access?.requiresLogin,c=e?.config?.access?.rbac||{},I=n?.props?.config?.mcpMode??"tools",p=he(o.url,I),U=n?.props?.config?.gatewayFetchBudgetPerExec??L.budgetPerExec,R=n?.props?.config?.searchIgnoredRoutes??[],r=n,C=!!r?.props?.config?.isPublicEndpoint;let u;const T=o.headers.get("Authorization");if(C)e.user=b();else if(re(t,c)){const{isAuthenticated:i,isTokenValid:d,isFirstPartyAnonymous:g,currentUser:l,accessToken:h}=await ee(o,e);if(g)e.user=b();else if(i)l&&(e.user=l),u=h;else{const a=M(o),m=te(e.config)==="served"?`${a}${de(le)}`:void 0;return d===!1?q(a,m):x(a,m)}}else if(T){const i=se(T)??void 0;u=(i?await oe(i):!1)?void 0:i}const _={isAuthenticated:!!e.user?.isAuthenticated,teams:e.user?.teams||[B],claims:e.user?.claims??{}};return me(H.MCP,_,c,t)?await W(async()=>{const i=p==="code"&&(n?.props?.config?.elicitationEnabled??!1);if(o.method==="GET")return new Response(JSON.stringify({error:"Method Not Allowed",message:`In order to use this MCP server, you need to register it in your MCP client (VS Code, Cursor, Claude Code, etc.) using this URL: ${o.url}`}),{status:405,headers:{"Content-Type":"application/json"}});if(o.method!=="POST")return Q();const d=r?.props?.config?.apiDescriptionsMap||{},g=r?.props?.config?.graphqlDescriptions||[],l=r?.props?.config?.mcpDocsServerName||ae,{config:{mcp:h={}}}=e,a=J(d,e.user,c,t),m=K(g,e.user,c,t),y=e.config.products?Object.values(e.config.products).map(s=>s?.name):[],D=h.docs?.name||l,f=ge(o.headers.get(E)),P=r?.props?.tools||[],O=r?.props?.skillsBaseUrl||M(o),w=V(r?.props?.skills||[],e.user,c,t).map(s=>({slug:s.slug,name:s.name,description:s.description,content:s.content,uri:$(O,s.slug)})),S=r?.props?.fetchCountSecret,F={name:D,tools:P,skills:w,context:{...e,config:{...e.config,mcp:ce(e.config.mcp,f)},configFile:r?.props?.configFile,accessToken:u,outdir:e.outdir||"",baseUrl:e.baseUrl||M(o),internalBaseUrl:N(o),apiDescriptionsMap:a,graphqlDescriptions:m,products:y,metadata:f,mcpMode:p,elicitationEnabled:i,gatewayFetchBudgetPerExec:U,fetchCountRequest:p==="code"&&S?{caller:{subject:z(e.user),ip:X(o)},secret:S}:void 0,searchIgnoredRoutes:R,clientIp:v(o),...ie(o),requestId:ne(),messageId:typeof f?.messageId=="string"?f.messageId:void 0}},k=await G({...F,getKv:e.getKv});return await Y(async()=>k,{keepAliveMs:pe,maxRequestBodySize:ue,onerror:s=>A.warn(`MCP handler: ${s.message}`)}).fetch(o)},p):Z()};var Je=Ae;export{Je as default};
|
|
@@ -12,11 +12,6 @@ export declare class McpError extends Error {
|
|
|
12
12
|
constructor(code: McpErrorCodeTypes, message: string, data?: unknown, requestId?: string | number | null);
|
|
13
13
|
createErrorResponse(): Response;
|
|
14
14
|
}
|
|
15
|
-
export declare class McpClientInputError extends Error {
|
|
16
|
-
constructor(message: string, options?: {
|
|
17
|
-
cause?: unknown;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
15
|
export declare function createMethodNotAllowedError(requestId?: string | number | null): Response;
|
|
21
16
|
export declare function createInternalServerError(error: Error | string, requestId?: string | number | null): Response;
|
|
22
17
|
export declare function withErrorHandling<T>(operation: () => Promise<T>, mode?: McpMode): Promise<T | Response>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{telemetry as c}from"../../../telemetry/index.js";import{McpErrorCodes as o,McpServerType as
|
|
1
|
+
import{telemetry as c}from"../../../telemetry/index.js";import{McpErrorCodes as o,McpServerType as d}from"../constants.js";import{serverAttributes as i}from"../utils/telemetry-attributes.js";class n extends Error{code;data;requestId;constructor(t,e,s,a){super(e),this.name="McpError",this.code=t,this.data=s,this.requestId=a}createErrorResponse(){const t={jsonrpc:"2.0",error:{code:this.code,message:this.message,...this.data?{data:this.data}:{}},id:this.requestId??null},e=p(this.code);return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json"}})}}function p(r){switch(r){case o.InvalidRequest:case o.InvalidParams:return 400;case o.MethodNotFound:return 404;case o.ServerError:return 405;case o.InternalError:default:return 500}}function h(r){return new n(o.ServerError,"Method not allowed",void 0,r).createErrorResponse()}function u(r,t){const e=r instanceof Error?r.message:String(r);return new n(o.InternalError,"Internal server error mcp",e,t).createErrorResponse()}async function f(r,t="tools"){try{return await r()}catch(e){return c.sendMcpErrorMessage([{...i(d.Docs),message:e?.message||"",stack:e?.stack||"",error_class:"server_error",mode:t}]),u(e)}}export{n as McpError,u as createInternalServerError,h as createMethodNotAllowedError,f as withErrorHandling};
|