@frontmcp/sdk 0.6.0 → 0.6.1
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/README.md +1 -0
- package/package.json +13 -6
- package/src/auth/session/index.d.ts +1 -0
- package/src/auth/session/index.js +3 -1
- package/src/auth/session/index.js.map +1 -1
- package/src/auth/session/vercel-kv-session.store.d.ts +96 -0
- package/src/auth/session/vercel-kv-session.store.js +216 -0
- package/src/auth/session/vercel-kv-session.store.js.map +1 -0
- package/src/common/decorators/front-mcp.decorator.js +14 -17
- package/src/common/decorators/front-mcp.decorator.js.map +1 -1
- package/src/common/metadata/front-mcp.metadata.d.ts +705 -23
- package/src/common/metadata/front-mcp.metadata.js +1 -0
- package/src/common/metadata/front-mcp.metadata.js.map +1 -1
- package/src/common/metadata/prompt.metadata.d.ts +4 -0
- package/src/common/metadata/resource.metadata.d.ts +8 -0
- package/src/common/metadata/tool-ui.metadata.d.ts +2 -2
- package/src/common/metadata/tool-ui.metadata.js +1 -1
- package/src/common/metadata/tool-ui.metadata.js.map +1 -1
- package/src/common/metadata/tool.metadata.d.ts +4 -0
- package/src/common/schemas/http-output.schema.d.ts +24 -6
- package/src/common/tokens/front-mcp.tokens.js +1 -0
- package/src/common/tokens/front-mcp.tokens.js.map +1 -1
- package/src/common/types/options/redis.options.d.ts +173 -5
- package/src/common/types/options/redis.options.js +157 -11
- package/src/common/types/options/redis.options.js.map +1 -1
- package/src/common/types/options/server-info.options.d.ts +4 -0
- package/src/common/types/options/transport.options.d.ts +68 -4
- package/src/common/utils/global-config.utils.d.ts +36 -0
- package/src/common/utils/global-config.utils.js +44 -0
- package/src/common/utils/global-config.utils.js.map +1 -0
- package/src/common/utils/index.d.ts +1 -0
- package/src/common/utils/index.js +1 -0
- package/src/common/utils/index.js.map +1 -1
- package/src/completion/flows/complete.flow.d.ts +6 -8
- package/src/errors/index.d.ts +1 -1
- package/src/errors/index.js +2 -1
- package/src/errors/index.js.map +1 -1
- package/src/errors/mcp.error.d.ts +9 -0
- package/src/errors/mcp.error.js +19 -1
- package/src/errors/mcp.error.js.map +1 -1
- package/src/front-mcp/front-mcp.providers.d.ts +208 -0
- package/src/front-mcp/index.d.ts +1 -0
- package/src/front-mcp/index.js +3 -0
- package/src/front-mcp/index.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/logging/flows/set-level.flow.d.ts +6 -8
- package/src/prompt/flows/get-prompt.flow.d.ts +14 -8
- package/src/prompt/flows/prompts-list.flow.d.ts +8 -7
- package/src/resource/flows/read-resource.flow.d.ts +8 -9
- package/src/resource/flows/resource-templates-list.flow.d.ts +8 -7
- package/src/resource/flows/resources-list.flow.d.ts +8 -7
- package/src/resource/flows/subscribe-resource.flow.d.ts +6 -8
- package/src/resource/flows/unsubscribe-resource.flow.d.ts +6 -8
- package/src/store/adapters/store.vercel-kv.adapter.d.ts +86 -0
- package/src/store/adapters/store.vercel-kv.adapter.js +155 -0
- package/src/store/adapters/store.vercel-kv.adapter.js.map +1 -0
- package/src/store/index.d.ts +2 -0
- package/src/store/index.js +2 -0
- package/src/store/index.js.map +1 -1
- package/src/store/store.factory.d.ts +86 -0
- package/src/store/store.factory.js +194 -0
- package/src/store/store.factory.js.map +1 -0
- package/src/tool/flows/call-tool.flow.d.ts +18 -9
- package/src/tool/flows/call-tool.flow.js +2 -2
- package/src/tool/flows/call-tool.flow.js.map +1 -1
- package/src/tool/flows/tools-list.flow.d.ts +9 -8
- package/src/tool/flows/tools-list.flow.js +2 -2
- package/src/tool/flows/tools-list.flow.js.map +1 -1
- package/src/tool/ui/index.d.ts +4 -4
- package/src/tool/ui/index.js +4 -4
- package/src/tool/ui/index.js.map +1 -1
- package/src/tool/ui/platform-adapters.d.ts +2 -2
- package/src/tool/ui/platform-adapters.js +3 -3
- package/src/tool/ui/platform-adapters.js.map +1 -1
- package/src/tool/ui/template-helpers.d.ts +5 -7
- package/src/tool/ui/template-helpers.js +9 -26
- package/src/tool/ui/template-helpers.js.map +1 -1
- package/src/tool/ui/ui-resource.handler.d.ts +1 -1
- package/src/tool/ui/ui-resource.handler.js +5 -5
- package/src/tool/ui/ui-resource.handler.js.map +1 -1
- package/src/transport/mcp-handlers/complete-request.handler.d.ts +4 -15
- package/src/transport/mcp-handlers/get-prompt-request.handler.d.ts +5 -15
- package/src/transport/mcp-handlers/index.d.ts +67 -195
- package/src/transport/mcp-handlers/list-prompts-request.handler.d.ts +5 -15
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.d.ts +5 -15
- package/src/transport/mcp-handlers/list-resources-request.handler.d.ts +5 -15
- package/src/transport/mcp-handlers/list-tools-request.handler.d.ts +5 -15
- package/src/transport/mcp-handlers/logging-set-level-request.handler.d.ts +3 -14
- package/src/transport/mcp-handlers/read-resource-request.handler.d.ts +4 -15
- package/src/transport/mcp-handlers/subscribe-request.handler.d.ts +3 -14
- package/src/transport/mcp-handlers/unsubscribe-request.handler.d.ts +3 -14
- package/src/transport/transport.registry.d.ts +5 -1
- package/src/transport/transport.registry.js +52 -23
- package/src/transport/transport.registry.js.map +1 -1
|
@@ -13,6 +13,7 @@ exports.frontMcpBaseSchema = zod_1.z.object({
|
|
|
13
13
|
serve: zod_1.z.boolean().optional().default(true),
|
|
14
14
|
http: types_1.httpOptionsSchema.optional(),
|
|
15
15
|
redis: types_1.redisOptionsSchema.optional(),
|
|
16
|
+
pubsub: types_1.pubsubOptionsSchema.optional(),
|
|
16
17
|
transport: types_1.transportOptionsSchema.optional().transform((val) => val ?? types_1.transportOptionsSchema.parse({})),
|
|
17
18
|
session: types_1.sessionOptionsSchema.optional(), // @deprecated - kept for backward compatibility
|
|
18
19
|
logging: types_1.loggingOptionsSchema.optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-mcp.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/front-mcp.metadata.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
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,CAAC,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IACxG,IAAI,EAAE,yBAAiB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAClC,CAAC,CAAC;AAOzE,MAAM,wBAAwB,GAAG,0BAAkB,CAAC,MAAM,CAAC;IACzD,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACnG,IAAI,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC6C,CAAC,CAAC;AAI9D,QAAA,sBAAsB,GAAG,sBAAsB,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n AuthOptions,\n authOptionsSchema,\n SessionOptions,\n sessionOptionsSchema,\n ServerInfoOptions,\n serverInfoOptionsSchema,\n HttpOptions,\n httpOptionsSchema,\n LoggingOptions,\n loggingOptionsSchema,\n RawZodShape,\n AuthOptionsInput,\n RedisOptionsInput,\n redisOptionsSchema,\n PubsubOptionsInput,\n pubsubOptionsSchema,\n TransportOptionsInput,\n transportOptionsSchema,\n} from '../types';\nimport {\n annotatedFrontMcpAppSchema,\n annotatedFrontMcpProvidersSchema,\n annotatedFrontMcpResourcesSchema,\n annotatedFrontMcpToolsSchema,\n} from '../schemas';\nimport { AppType, ProviderType, ResourceType, ToolType } from '../interfaces';\n\nexport interface FrontMcpBaseMetadata {\n info: ServerInfoOptions;\n apps: AppType[];\n http?: HttpOptions;\n logging?: LoggingOptions;\n\n serve?: boolean; // default to true\n\n /**\n * Shared storage configuration\n * Used by transport persistence and auth token storage.\n * Supports both Redis and Vercel KV providers.\n */\n redis?: RedisOptionsInput;\n\n /**\n * Pub/Sub configuration (Redis-only)\n * Required for resource subscriptions when using Vercel KV for sessions.\n * Falls back to `redis` config if not specified and redis is configured with Redis provider.\n */\n pubsub?: PubsubOptionsInput;\n\n /**\n * Transport and session lifecycle configuration\n * Controls transport protocols, session management, and persistence\n * @default {} (all transport options use their schema defaults)\n */\n transport?: TransportOptionsInput; // Optional in input, but always defined in output\n\n /**\n * @deprecated Use `transport` instead. Session config has been merged into transport.\n */\n session?: SessionOptions;\n\n /**\n * Additional providers that are available to all apps.\n */\n providers?: ProviderType[];\n\n /**\n * Shared tools that are available to all apps.\n * These are merged (additively) with app-specific tools.\n */\n tools?: ToolType[];\n\n /**\n * Shared resources that are available to all apps.\n * These are merged (additively) with app-specific resources.\n */\n resources?: ResourceType[];\n}\n\nexport const frontMcpBaseSchema = z.object({\n info: serverInfoOptionsSchema,\n providers: z.array(annotatedFrontMcpProvidersSchema).optional().default([]),\n tools: z.array(annotatedFrontMcpToolsSchema).optional().default([]),\n resources: z.array(annotatedFrontMcpResourcesSchema).optional().default([]),\n apps: z.array(annotatedFrontMcpAppSchema),\n serve: z.boolean().optional().default(true),\n http: httpOptionsSchema.optional(),\n redis: redisOptionsSchema.optional(),\n pubsub: pubsubOptionsSchema.optional(),\n transport: transportOptionsSchema.optional().transform((val) => val ?? transportOptionsSchema.parse({})),\n session: sessionOptionsSchema.optional(), // @deprecated - kept for backward compatibility\n logging: loggingOptionsSchema.optional(),\n} satisfies RawZodShape<FrontMcpBaseMetadata>);\n\nexport interface FrontMcpMultiAppMetadata extends FrontMcpBaseMetadata {\n splitByApp?: false;\n auth?: AuthOptionsInput;\n}\n\nconst frontMcpMultiAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(false).default(false).describe('If true, each app gets its own scope & basePath.'),\n auth: authOptionsSchema.optional().describe(\"Configures the server's default authentication provider.\"),\n} satisfies RawZodShape<FrontMcpMultiAppMetadata, FrontMcpBaseMetadata>);\n\nexport interface FrontMcpSplitByAppMetadata extends FrontMcpBaseMetadata {\n splitByApp: true;\n auth?: never;\n}\n\nconst frontMcpSplitByAppSchema = frontMcpBaseSchema.extend({\n splitByApp: z.literal(true).describe('If false, apps are grouped under the same scope & basePath.'),\n auth: z.never().optional(),\n} satisfies RawZodShape<FrontMcpSplitByAppMetadata, FrontMcpBaseMetadata>);\n\nexport type FrontMcpMetadata = FrontMcpMultiAppMetadata | FrontMcpSplitByAppMetadata;\n\nexport const frontMcpMetadataSchema = frontMcpMultiAppSchema.or(frontMcpSplitByAppSchema);\n\nexport type FrontMcpMultiAppConfig = z.infer<typeof frontMcpMultiAppSchema>;\nexport type FrontMcpSplitByAppConfig = z.infer<typeof frontMcpSplitByAppSchema>;\n\nexport type FrontMcpConfigType = z.infer<typeof frontMcpMetadataSchema>;\n\nexport interface AppScopeMetadata extends Omit<FrontMcpSplitByAppMetadata, 'auth' | 'splitByApp'> {\n id: string;\n apps: [AppType];\n auth?: AuthOptions;\n}\n\nexport interface MultiAppScopeMetadata extends FrontMcpMultiAppMetadata {\n id: string;\n apps: AppType[];\n}\n\nexport type ScopeMetadata = AppScopeMetadata | MultiAppScopeMetadata;\n"]}
|
|
@@ -64,6 +64,10 @@ export declare const frontMcpPromptMetadataSchema: z.ZodObject<{
|
|
|
64
64
|
src: z.ZodString;
|
|
65
65
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
66
66
|
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
light: "light";
|
|
69
|
+
dark: "dark";
|
|
70
|
+
}>>;
|
|
67
71
|
}, z.core.$strip>>>;
|
|
68
72
|
}, z.core.$loose>;
|
|
69
73
|
export { FrontMcpPromptMetadata as PromptMetadata, };
|
|
@@ -56,6 +56,10 @@ export declare const frontMcpResourceMetadataSchema: z.ZodObject<{
|
|
|
56
56
|
src: z.ZodString;
|
|
57
57
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
58
58
|
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
light: "light";
|
|
61
|
+
dark: "dark";
|
|
62
|
+
}>>;
|
|
59
63
|
}, z.core.$strip>>>;
|
|
60
64
|
}, z.core.$loose>;
|
|
61
65
|
/**
|
|
@@ -102,6 +106,10 @@ export declare const frontMcpResourceTemplateMetadataSchema: z.ZodObject<{
|
|
|
102
106
|
src: z.ZodString;
|
|
103
107
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
104
108
|
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
light: "light";
|
|
111
|
+
dark: "dark";
|
|
112
|
+
}>>;
|
|
105
113
|
}, z.core.$strip>>>;
|
|
106
114
|
}, z.core.$loose>;
|
|
107
115
|
export { ResourceMetadata, ResourceMetadata as FrontMcpResourceMetadata, ResourceTemplateMetadata, ResourceTemplateMetadata as FrontMcpResourceTemplateMetadata, };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool UI Configuration Types
|
|
3
3
|
*
|
|
4
|
-
* Re-exports types from @frontmcp/
|
|
4
|
+
* Re-exports types from @frontmcp/uipack/types for SDK consumers.
|
|
5
5
|
* This provides a single source of truth for UI configuration types
|
|
6
6
|
* while maintaining backwards compatibility.
|
|
7
7
|
*
|
|
8
8
|
* @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}
|
|
9
9
|
*/
|
|
10
|
-
export { type UIContentSecurityPolicy, type TemplateHelpers, type TemplateContext, type TemplateBuilderFn, type WidgetServingMode, type WidgetDisplayMode, type UITemplateConfig as ToolUIConfig, type UIType, type BundlingMode, type DisplayMode, type ResourceMode, type CSPDirectives, type RendererAssets, type WidgetManifest, type RuntimePayload, type WidgetConfig, type WidgetTemplate, type WidgetRuntimeOptions, type BuildManifestResult, type BuildManifestOptions, } from '@frontmcp/
|
|
10
|
+
export { type UIContentSecurityPolicy, type TemplateHelpers, type TemplateContext, type TemplateBuilderFn, type WidgetServingMode, type WidgetDisplayMode, type UITemplateConfig as ToolUIConfig, type UIType, type BundlingMode, type DisplayMode, type ResourceMode, type CSPDirectives, type RendererAssets, type WidgetManifest, type RuntimePayload, type WidgetConfig, type WidgetTemplate, type WidgetRuntimeOptions, type BuildManifestResult, type BuildManifestOptions, } from '@frontmcp/uipack/types';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Tool UI Configuration Types
|
|
4
4
|
*
|
|
5
|
-
* Re-exports types from @frontmcp/
|
|
5
|
+
* Re-exports types from @frontmcp/uipack/types for SDK consumers.
|
|
6
6
|
* This provides a single source of truth for UI configuration types
|
|
7
7
|
* while maintaining backwards compatibility.
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-ui.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool-ui.metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Tool UI Configuration Types\n *\n * Re-exports types from @frontmcp/
|
|
1
|
+
{"version":3,"file":"tool-ui.metadata.js","sourceRoot":"","sources":["../../../../src/common/metadata/tool-ui.metadata.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Tool UI Configuration Types\n *\n * Re-exports types from @frontmcp/uipack/types for SDK consumers.\n * This provides a single source of truth for UI configuration types\n * while maintaining backwards compatibility.\n *\n * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}\n */\n\n// Re-export all UI configuration types from @frontmcp/uipack\nexport {\n // Legacy UI Config Types\n type UIContentSecurityPolicy,\n type TemplateHelpers,\n type TemplateContext,\n type TemplateBuilderFn,\n type WidgetServingMode,\n type WidgetDisplayMode,\n // Re-export UITemplateConfig as ToolUIConfig for backwards compatibility\n type UITemplateConfig as ToolUIConfig,\n // New Widget Runtime Types\n type UIType,\n type BundlingMode,\n type DisplayMode,\n type ResourceMode,\n type CSPDirectives,\n type RendererAssets,\n type WidgetManifest,\n type RuntimePayload,\n type WidgetConfig,\n type WidgetTemplate,\n type WidgetRuntimeOptions,\n type BuildManifestResult,\n type BuildManifestOptions,\n} from '@frontmcp/uipack/types';\n"]}
|
|
@@ -159,6 +159,10 @@ export declare const ResourceLinkOutputSchema: z.ZodObject<{
|
|
|
159
159
|
src: z.ZodString;
|
|
160
160
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
161
161
|
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
163
|
+
light: "light";
|
|
164
|
+
dark: "dark";
|
|
165
|
+
}>>;
|
|
162
166
|
}, z.core.$strip>>>;
|
|
163
167
|
name: z.ZodString;
|
|
164
168
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -298,19 +298,28 @@ export declare const HttpJsonRpcSchema: z.ZodObject<{
|
|
|
298
298
|
kind: z.ZodLiteral<"jsonrpc">;
|
|
299
299
|
status: z.ZodNumber;
|
|
300
300
|
contentType: z.ZodDefault<z.ZodString>;
|
|
301
|
-
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
301
|
+
body: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
302
302
|
jsonrpc: z.ZodLiteral<"2.0">;
|
|
303
303
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
304
304
|
result: z.ZodObject<{
|
|
305
305
|
_meta: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
306
307
|
"io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
|
|
307
308
|
taskId: z.ZodString;
|
|
308
|
-
}, z.core.$
|
|
309
|
+
}, z.core.$strip>>;
|
|
309
310
|
}, z.core.$loose>>;
|
|
310
311
|
}, z.core.$loose>;
|
|
311
312
|
}, z.core.$strict>, z.ZodObject<{
|
|
312
313
|
jsonrpc: z.ZodLiteral<"2.0">;
|
|
313
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]
|
|
314
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
315
|
+
error: z.ZodObject<{
|
|
316
|
+
code: z.ZodNumber;
|
|
317
|
+
message: z.ZodString;
|
|
318
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
}, z.core.$strict>]>, z.ZodObject<{
|
|
321
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
322
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
314
323
|
error: z.ZodObject<{
|
|
315
324
|
code: z.ZodNumber;
|
|
316
325
|
message: z.ZodString;
|
|
@@ -596,19 +605,28 @@ export declare const httpOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
596
605
|
kind: z.ZodLiteral<"jsonrpc">;
|
|
597
606
|
status: z.ZodNumber;
|
|
598
607
|
contentType: z.ZodDefault<z.ZodString>;
|
|
599
|
-
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
608
|
+
body: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
600
609
|
jsonrpc: z.ZodLiteral<"2.0">;
|
|
601
610
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
602
611
|
result: z.ZodObject<{
|
|
603
612
|
_meta: z.ZodOptional<z.ZodObject<{
|
|
613
|
+
progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
604
614
|
"io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
|
|
605
615
|
taskId: z.ZodString;
|
|
606
|
-
}, z.core.$
|
|
616
|
+
}, z.core.$strip>>;
|
|
607
617
|
}, z.core.$loose>>;
|
|
608
618
|
}, z.core.$loose>;
|
|
609
619
|
}, z.core.$strict>, z.ZodObject<{
|
|
610
620
|
jsonrpc: z.ZodLiteral<"2.0">;
|
|
611
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]
|
|
621
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
622
|
+
error: z.ZodObject<{
|
|
623
|
+
code: z.ZodNumber;
|
|
624
|
+
message: z.ZodString;
|
|
625
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
626
|
+
}, z.core.$strip>;
|
|
627
|
+
}, z.core.$strict>]>, z.ZodObject<{
|
|
628
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
629
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
612
630
|
error: z.ZodObject<{
|
|
613
631
|
code: z.ZodNumber;
|
|
614
632
|
message: z.ZodString;
|
|
@@ -8,6 +8,7 @@ exports.FrontMcpTokens = {
|
|
|
8
8
|
apps: base_tokens_1.tokenFactory.meta('apps'),
|
|
9
9
|
http: base_tokens_1.tokenFactory.meta('http'),
|
|
10
10
|
redis: base_tokens_1.tokenFactory.meta('redis'),
|
|
11
|
+
pubsub: base_tokens_1.tokenFactory.meta('pubsub'),
|
|
11
12
|
transport: base_tokens_1.tokenFactory.meta('transport'),
|
|
12
13
|
session: base_tokens_1.tokenFactory.meta('session'), // @deprecated - kept for backward compatibility
|
|
13
14
|
serve: base_tokens_1.tokenFactory.meta('serve'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-mcp.tokens.js","sourceRoot":"","sources":["../../../../src/common/tokens/front-mcp.tokens.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAIhC,QAAA,cAAc,GAAuC;IAChE,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;IACzC,OAAO,EAAE,0BAAY,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,gDAAgD;IACvF,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,UAAU,EAAE,0BAAY,CAAC,IAAI,CAAC,YAAY,CAAC;IAC3C,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,0BAAY,CAAC,IAAI,CAAC,SAAS,CAAC;IAErC,0BAA0B;IAC1B,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;IACzC,2CAA2C;IAC3C,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,+CAA+C;IAC/C,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;CAC1C,CAAC","sourcesContent":["import { tokenFactory } from './base.tokens';\nimport { RawMetadataShape } from '../types';\nimport { FrontMcpMetadata } from '../metadata';\n\nexport const FrontMcpTokens: RawMetadataShape<FrontMcpMetadata> = {\n type: tokenFactory.type('root'),\n info: tokenFactory.meta('info'),\n apps: tokenFactory.meta('apps'),\n http: tokenFactory.meta('http'),\n redis: tokenFactory.meta('redis'),\n transport: tokenFactory.meta('transport'),\n session: tokenFactory.meta('session'), // @deprecated - kept for backward compatibility\n serve: tokenFactory.meta('serve'),\n splitByApp: tokenFactory.meta('splitByApp'),\n auth: tokenFactory.meta('auth'),\n logging: tokenFactory.meta('logging'),\n\n // global scoped providers\n providers: tokenFactory.meta('providers'),\n // global scoped tools (shared across apps)\n tools: tokenFactory.meta('tools'),\n // global scoped resources (shared across apps)\n resources: tokenFactory.meta('resources'),\n};\n"]}
|
|
1
|
+
{"version":3,"file":"front-mcp.tokens.js","sourceRoot":"","sources":["../../../../src/common/tokens/front-mcp.tokens.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAIhC,QAAA,cAAc,GAAuC;IAChE,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,MAAM,EAAE,0BAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;IACnC,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;IACzC,OAAO,EAAE,0BAAY,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,gDAAgD;IACvF,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,UAAU,EAAE,0BAAY,CAAC,IAAI,CAAC,YAAY,CAAC;IAC3C,IAAI,EAAE,0BAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,0BAAY,CAAC,IAAI,CAAC,SAAS,CAAC;IAErC,0BAA0B;IAC1B,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;IACzC,2CAA2C;IAC3C,KAAK,EAAE,0BAAY,CAAC,IAAI,CAAC,OAAO,CAAC;IACjC,+CAA+C;IAC/C,SAAS,EAAE,0BAAY,CAAC,IAAI,CAAC,WAAW,CAAC;CAC1C,CAAC","sourcesContent":["import { tokenFactory } from './base.tokens';\nimport { RawMetadataShape } from '../types';\nimport { FrontMcpMetadata } from '../metadata';\n\nexport const FrontMcpTokens: RawMetadataShape<FrontMcpMetadata> = {\n type: tokenFactory.type('root'),\n info: tokenFactory.meta('info'),\n apps: tokenFactory.meta('apps'),\n http: tokenFactory.meta('http'),\n redis: tokenFactory.meta('redis'),\n pubsub: tokenFactory.meta('pubsub'),\n transport: tokenFactory.meta('transport'),\n session: tokenFactory.meta('session'), // @deprecated - kept for backward compatibility\n serve: tokenFactory.meta('serve'),\n splitByApp: tokenFactory.meta('splitByApp'),\n auth: tokenFactory.meta('auth'),\n logging: tokenFactory.meta('logging'),\n\n // global scoped providers\n providers: tokenFactory.meta('providers'),\n // global scoped tools (shared across apps)\n tools: tokenFactory.meta('tools'),\n // global scoped resources (shared across apps)\n resources: tokenFactory.meta('resources'),\n};\n"]}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Used by transport persistence and auth token storage
|
|
3
|
+
* Supported storage providers
|
|
5
4
|
*/
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const storageProviderSchema: z.ZodEnum<{
|
|
6
|
+
redis: "redis";
|
|
7
|
+
"vercel-kv": "vercel-kv";
|
|
8
|
+
}>;
|
|
9
|
+
export type StorageProvider = z.infer<typeof storageProviderSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* Full Redis provider configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare const redisProviderSchema: z.ZodObject<{
|
|
14
|
+
provider: z.ZodLiteral<"redis">;
|
|
7
15
|
host: z.ZodString;
|
|
8
16
|
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
17
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -12,11 +20,171 @@ export declare const redisOptionsSchema: z.ZodObject<{
|
|
|
12
20
|
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
13
21
|
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
14
22
|
}, z.core.$strip>;
|
|
23
|
+
export type RedisProviderOptions = z.infer<typeof redisProviderSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Vercel KV provider configuration
|
|
26
|
+
* Uses environment variables by default (KV_REST_API_URL, KV_REST_API_TOKEN)
|
|
27
|
+
*/
|
|
28
|
+
export declare const vercelKvProviderSchema: z.ZodObject<{
|
|
29
|
+
provider: z.ZodLiteral<"vercel-kv">;
|
|
30
|
+
url: z.ZodOptional<z.ZodString>;
|
|
31
|
+
token: z.ZodOptional<z.ZodString>;
|
|
32
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
33
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type VercelKvProviderOptions = z.infer<typeof vercelKvProviderSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Shared storage configuration
|
|
38
|
+
* Supports both Redis and Vercel KV providers.
|
|
39
|
+
*
|
|
40
|
+
* @example Redis (explicit provider)
|
|
41
|
+
* ```typescript
|
|
42
|
+
* {
|
|
43
|
+
* provider: 'redis',
|
|
44
|
+
* host: 'localhost',
|
|
45
|
+
* port: 6379,
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Redis (legacy format - backwards compatible)
|
|
50
|
+
* ```typescript
|
|
51
|
+
* {
|
|
52
|
+
* host: 'localhost',
|
|
53
|
+
* port: 6379,
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Vercel KV (uses env vars by default)
|
|
58
|
+
* ```typescript
|
|
59
|
+
* {
|
|
60
|
+
* provider: 'vercel-kv',
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Vercel KV (explicit config)
|
|
65
|
+
* ```typescript
|
|
66
|
+
* {
|
|
67
|
+
* provider: 'vercel-kv',
|
|
68
|
+
* url: 'https://my-kv.vercel-storage.com',
|
|
69
|
+
* token: 'my-token',
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const redisOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
74
|
+
provider: z.ZodLiteral<"redis">;
|
|
75
|
+
host: z.ZodString;
|
|
76
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
77
|
+
password: z.ZodOptional<z.ZodString>;
|
|
78
|
+
db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
79
|
+
tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
80
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
81
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
provider: z.ZodLiteral<"vercel-kv">;
|
|
84
|
+
url: z.ZodOptional<z.ZodString>;
|
|
85
|
+
token: z.ZodOptional<z.ZodString>;
|
|
86
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
87
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
88
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
89
|
+
host: z.ZodString;
|
|
90
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
91
|
+
password: z.ZodOptional<z.ZodString>;
|
|
92
|
+
db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
93
|
+
tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
94
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
96
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
97
|
+
provider: "redis";
|
|
98
|
+
host: string;
|
|
99
|
+
port: number;
|
|
100
|
+
db: number;
|
|
101
|
+
tls: boolean;
|
|
102
|
+
keyPrefix: string;
|
|
103
|
+
defaultTtlMs: number;
|
|
104
|
+
password?: string | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
host: string;
|
|
107
|
+
port: number;
|
|
108
|
+
db: number;
|
|
109
|
+
tls: boolean;
|
|
110
|
+
keyPrefix: string;
|
|
111
|
+
defaultTtlMs: number;
|
|
112
|
+
password?: string | undefined;
|
|
113
|
+
}>>]>;
|
|
15
114
|
/**
|
|
16
|
-
*
|
|
115
|
+
* Storage configuration type (with defaults applied)
|
|
17
116
|
*/
|
|
18
117
|
export type RedisOptions = z.infer<typeof redisOptionsSchema>;
|
|
19
118
|
/**
|
|
20
|
-
*
|
|
119
|
+
* Storage configuration input type (for user configuration)
|
|
21
120
|
*/
|
|
22
121
|
export type RedisOptionsInput = z.input<typeof redisOptionsSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* Pub/Sub configuration (requires Redis, not compatible with Vercel KV)
|
|
124
|
+
*
|
|
125
|
+
* Use this when you need pub/sub features like resource subscriptions
|
|
126
|
+
* but want to use Vercel KV for sessions/cache.
|
|
127
|
+
*
|
|
128
|
+
* @example Hybrid config
|
|
129
|
+
* ```typescript
|
|
130
|
+
* {
|
|
131
|
+
* redis: { provider: 'vercel-kv' }, // sessions/cache
|
|
132
|
+
* pubsub: { host: 'localhost' }, // pub/sub
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare const pubsubOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
137
|
+
provider: z.ZodLiteral<"redis">;
|
|
138
|
+
host: z.ZodString;
|
|
139
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
140
|
+
password: z.ZodOptional<z.ZodString>;
|
|
141
|
+
db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
142
|
+
tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
143
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
144
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
145
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
146
|
+
host: z.ZodString;
|
|
147
|
+
port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
148
|
+
password: z.ZodOptional<z.ZodString>;
|
|
149
|
+
db: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
150
|
+
tls: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
151
|
+
keyPrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
152
|
+
defaultTtlMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
153
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
154
|
+
provider: "redis";
|
|
155
|
+
host: string;
|
|
156
|
+
port: number;
|
|
157
|
+
db: number;
|
|
158
|
+
tls: boolean;
|
|
159
|
+
keyPrefix: string;
|
|
160
|
+
defaultTtlMs: number;
|
|
161
|
+
password?: string | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
host: string;
|
|
164
|
+
port: number;
|
|
165
|
+
db: number;
|
|
166
|
+
tls: boolean;
|
|
167
|
+
keyPrefix: string;
|
|
168
|
+
defaultTtlMs: number;
|
|
169
|
+
password?: string | undefined;
|
|
170
|
+
}>>]>;
|
|
171
|
+
/**
|
|
172
|
+
* Pub/Sub configuration type (Redis-only)
|
|
173
|
+
*/
|
|
174
|
+
export type PubsubOptions = z.infer<typeof pubsubOptionsSchema>;
|
|
175
|
+
/**
|
|
176
|
+
* Pub/Sub configuration input type
|
|
177
|
+
*/
|
|
178
|
+
export type PubsubOptionsInput = z.input<typeof pubsubOptionsSchema>;
|
|
179
|
+
/**
|
|
180
|
+
* Check if options are for Redis provider
|
|
181
|
+
*/
|
|
182
|
+
export declare function isRedisProvider(options: RedisOptions): options is RedisProviderOptions;
|
|
183
|
+
/**
|
|
184
|
+
* Check if options are for Vercel KV provider
|
|
185
|
+
*/
|
|
186
|
+
export declare function isVercelKvProvider(options: RedisOptions): options is VercelKvProviderOptions;
|
|
187
|
+
/**
|
|
188
|
+
* Check if pub/sub options are valid Redis config
|
|
189
|
+
*/
|
|
190
|
+
export declare function isPubsubConfigured(options: PubsubOptions): options is RedisProviderOptions;
|
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// common/types/options/redis.options.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.redisOptionsSchema = void 0;
|
|
4
|
+
exports.pubsubOptionsSchema = exports.redisOptionsSchema = exports.vercelKvProviderSchema = exports.redisProviderSchema = exports.storageProviderSchema = void 0;
|
|
5
|
+
exports.isRedisProvider = isRedisProvider;
|
|
6
|
+
exports.isVercelKvProvider = isVercelKvProvider;
|
|
7
|
+
exports.isPubsubConfigured = isPubsubConfigured;
|
|
5
8
|
const zod_1 = require("zod");
|
|
9
|
+
// ============================================
|
|
10
|
+
// Storage Provider Types
|
|
11
|
+
// ============================================
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
8
|
-
* Used by transport persistence and auth token storage
|
|
13
|
+
* Supported storage providers
|
|
9
14
|
*/
|
|
10
|
-
exports.
|
|
15
|
+
exports.storageProviderSchema = zod_1.z.enum(['redis', 'vercel-kv']);
|
|
16
|
+
// ============================================
|
|
17
|
+
// Common Options (shared between providers)
|
|
18
|
+
// ============================================
|
|
19
|
+
const commonOptionsSchema = zod_1.z.object({
|
|
20
|
+
/**
|
|
21
|
+
* Key prefix for all keys
|
|
22
|
+
* @default 'mcp:'
|
|
23
|
+
*/
|
|
24
|
+
keyPrefix: zod_1.z.string().optional().default('mcp:'),
|
|
25
|
+
/**
|
|
26
|
+
* Default TTL in milliseconds for stored data
|
|
27
|
+
* @default 3600000 (1 hour)
|
|
28
|
+
*/
|
|
29
|
+
defaultTtlMs: zod_1.z.number().int().positive().optional().default(3600000),
|
|
30
|
+
});
|
|
31
|
+
// ============================================
|
|
32
|
+
// Redis Provider Configuration
|
|
33
|
+
// ============================================
|
|
34
|
+
/**
|
|
35
|
+
* Redis-specific connection options
|
|
36
|
+
*/
|
|
37
|
+
const redisConnectionSchema = zod_1.z.object({
|
|
11
38
|
/**
|
|
12
39
|
* Redis host
|
|
13
40
|
*/
|
|
@@ -31,15 +58,134 @@ exports.redisOptionsSchema = zod_1.z.object({
|
|
|
31
58
|
* @default false
|
|
32
59
|
*/
|
|
33
60
|
tls: zod_1.z.boolean().optional().default(false),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Full Redis provider configuration
|
|
64
|
+
*/
|
|
65
|
+
exports.redisProviderSchema = zod_1.z
|
|
66
|
+
.object({
|
|
34
67
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @default '
|
|
68
|
+
* Storage provider type
|
|
69
|
+
* @default 'redis'
|
|
37
70
|
*/
|
|
38
|
-
|
|
71
|
+
provider: zod_1.z.literal('redis'),
|
|
72
|
+
})
|
|
73
|
+
.merge(redisConnectionSchema)
|
|
74
|
+
.merge(commonOptionsSchema);
|
|
75
|
+
// ============================================
|
|
76
|
+
// Vercel KV Provider Configuration
|
|
77
|
+
// ============================================
|
|
78
|
+
/**
|
|
79
|
+
* Vercel KV provider configuration
|
|
80
|
+
* Uses environment variables by default (KV_REST_API_URL, KV_REST_API_TOKEN)
|
|
81
|
+
*/
|
|
82
|
+
exports.vercelKvProviderSchema = zod_1.z
|
|
83
|
+
.object({
|
|
39
84
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @default 3600000 (1 hour)
|
|
85
|
+
* Storage provider type
|
|
42
86
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
provider: zod_1.z.literal('vercel-kv'),
|
|
88
|
+
/**
|
|
89
|
+
* KV REST API URL
|
|
90
|
+
* @default process.env.KV_REST_API_URL
|
|
91
|
+
*/
|
|
92
|
+
url: zod_1.z.string().url().optional(),
|
|
93
|
+
/**
|
|
94
|
+
* KV REST API Token
|
|
95
|
+
* @default process.env.KV_REST_API_TOKEN
|
|
96
|
+
*/
|
|
97
|
+
token: zod_1.z.string().optional(),
|
|
98
|
+
})
|
|
99
|
+
.merge(commonOptionsSchema);
|
|
100
|
+
// ============================================
|
|
101
|
+
// Legacy Redis Schema (backwards compatibility)
|
|
102
|
+
// ============================================
|
|
103
|
+
/**
|
|
104
|
+
* Legacy Redis configuration without provider field
|
|
105
|
+
* Automatically transforms to redis provider
|
|
106
|
+
*/
|
|
107
|
+
const legacyRedisSchema = redisConnectionSchema.merge(commonOptionsSchema).transform((val) => ({
|
|
108
|
+
...val,
|
|
109
|
+
provider: 'redis',
|
|
110
|
+
}));
|
|
111
|
+
// ============================================
|
|
112
|
+
// Combined Redis Options Schema
|
|
113
|
+
// ============================================
|
|
114
|
+
/**
|
|
115
|
+
* Shared storage configuration
|
|
116
|
+
* Supports both Redis and Vercel KV providers.
|
|
117
|
+
*
|
|
118
|
+
* @example Redis (explicit provider)
|
|
119
|
+
* ```typescript
|
|
120
|
+
* {
|
|
121
|
+
* provider: 'redis',
|
|
122
|
+
* host: 'localhost',
|
|
123
|
+
* port: 6379,
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example Redis (legacy format - backwards compatible)
|
|
128
|
+
* ```typescript
|
|
129
|
+
* {
|
|
130
|
+
* host: 'localhost',
|
|
131
|
+
* port: 6379,
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example Vercel KV (uses env vars by default)
|
|
136
|
+
* ```typescript
|
|
137
|
+
* {
|
|
138
|
+
* provider: 'vercel-kv',
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @example Vercel KV (explicit config)
|
|
143
|
+
* ```typescript
|
|
144
|
+
* {
|
|
145
|
+
* provider: 'vercel-kv',
|
|
146
|
+
* url: 'https://my-kv.vercel-storage.com',
|
|
147
|
+
* token: 'my-token',
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
exports.redisOptionsSchema = zod_1.z.union([exports.redisProviderSchema, exports.vercelKvProviderSchema, legacyRedisSchema]);
|
|
152
|
+
// ============================================
|
|
153
|
+
// Pub/Sub Options Schema (Redis-only)
|
|
154
|
+
// ============================================
|
|
155
|
+
/**
|
|
156
|
+
* Pub/Sub configuration (requires Redis, not compatible with Vercel KV)
|
|
157
|
+
*
|
|
158
|
+
* Use this when you need pub/sub features like resource subscriptions
|
|
159
|
+
* but want to use Vercel KV for sessions/cache.
|
|
160
|
+
*
|
|
161
|
+
* @example Hybrid config
|
|
162
|
+
* ```typescript
|
|
163
|
+
* {
|
|
164
|
+
* redis: { provider: 'vercel-kv' }, // sessions/cache
|
|
165
|
+
* pubsub: { host: 'localhost' }, // pub/sub
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
exports.pubsubOptionsSchema = zod_1.z.union([exports.redisProviderSchema, legacyRedisSchema]);
|
|
170
|
+
// ============================================
|
|
171
|
+
// Type Guards
|
|
172
|
+
// ============================================
|
|
173
|
+
/**
|
|
174
|
+
* Check if options are for Redis provider
|
|
175
|
+
*/
|
|
176
|
+
function isRedisProvider(options) {
|
|
177
|
+
return options.provider === 'redis';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if options are for Vercel KV provider
|
|
181
|
+
*/
|
|
182
|
+
function isVercelKvProvider(options) {
|
|
183
|
+
return options.provider === 'vercel-kv';
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if pub/sub options are valid Redis config
|
|
187
|
+
*/
|
|
188
|
+
function isPubsubConfigured(options) {
|
|
189
|
+
return options.provider === 'redis';
|
|
190
|
+
}
|
|
45
191
|
//# sourceMappingURL=redis.options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/redis.options.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;
|
|
1
|
+
{"version":3,"file":"redis.options.js","sourceRoot":"","sources":["../../../../../src/common/types/options/redis.options.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AA2NxC,0CAEC;AAKD,gDAEC;AAKD,gDAEC;AAzOD,6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E,iBAAiB,CAAC,CAAC,CAAC;AAYrF,+CAA+C;AAC/C,cAAc;AACd,+CAA+C;AAE/C;;GAEG;AACH,SAAgB,eAAe,CAAC,OAAqB;IACnD,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,OAAqB;IACtD,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,OAAsB;IACvD,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtC,CAAC","sourcesContent":["// common/types/options/redis.options.ts\n\nimport { z } from 'zod';\n\n// ============================================\n// Storage Provider Types\n// ============================================\n\n/**\n * Supported storage providers\n */\nexport const storageProviderSchema = z.enum(['redis', 'vercel-kv']);\nexport type StorageProvider = z.infer<typeof storageProviderSchema>;\n\n// ============================================\n// Common Options (shared between providers)\n// ============================================\n\nconst commonOptionsSchema = z.object({\n /**\n * Key prefix for all keys\n * @default 'mcp:'\n */\n keyPrefix: z.string().optional().default('mcp:'),\n\n /**\n * Default TTL in milliseconds for stored data\n * @default 3600000 (1 hour)\n */\n defaultTtlMs: z.number().int().positive().optional().default(3600000),\n});\n\n// ============================================\n// Redis Provider Configuration\n// ============================================\n\n/**\n * Redis-specific connection options\n */\nconst redisConnectionSchema = z.object({\n /**\n * Redis host\n */\n host: z.string().trim().min(1),\n\n /**\n * Redis port\n * @default 6379\n */\n port: z.number().int().positive().max(65535).optional().default(6379),\n\n /**\n * Redis password (optional)\n */\n password: z.string().optional(),\n\n /**\n * Redis database number\n * @default 0\n */\n db: z.number().int().nonnegative().optional().default(0),\n\n /**\n * Enable TLS connection\n * @default false\n */\n tls: z.boolean().optional().default(false),\n});\n\n/**\n * Full Redis provider configuration\n */\nexport const redisProviderSchema = z\n .object({\n /**\n * Storage provider type\n * @default 'redis'\n */\n provider: z.literal('redis'),\n })\n .merge(redisConnectionSchema)\n .merge(commonOptionsSchema);\n\nexport type RedisProviderOptions = z.infer<typeof redisProviderSchema>;\n\n// ============================================\n// Vercel KV Provider Configuration\n// ============================================\n\n/**\n * Vercel KV provider configuration\n * Uses environment variables by default (KV_REST_API_URL, KV_REST_API_TOKEN)\n */\nexport const vercelKvProviderSchema = z\n .object({\n /**\n * Storage provider type\n */\n provider: z.literal('vercel-kv'),\n\n /**\n * KV REST API URL\n * @default process.env.KV_REST_API_URL\n */\n url: z.string().url().optional(),\n\n /**\n * KV REST API Token\n * @default process.env.KV_REST_API_TOKEN\n */\n token: z.string().optional(),\n })\n .merge(commonOptionsSchema);\n\nexport type VercelKvProviderOptions = z.infer<typeof vercelKvProviderSchema>;\n\n// ============================================\n// Legacy Redis Schema (backwards compatibility)\n// ============================================\n\n/**\n * Legacy Redis configuration without provider field\n * Automatically transforms to redis provider\n */\nconst legacyRedisSchema = redisConnectionSchema.merge(commonOptionsSchema).transform((val) => ({\n ...val,\n provider: 'redis' as const,\n}));\n\n// ============================================\n// Combined Redis Options Schema\n// ============================================\n\n/**\n * Shared storage configuration\n * Supports both Redis and Vercel KV providers.\n *\n * @example Redis (explicit provider)\n * ```typescript\n * {\n * provider: 'redis',\n * host: 'localhost',\n * port: 6379,\n * }\n * ```\n *\n * @example Redis (legacy format - backwards compatible)\n * ```typescript\n * {\n * host: 'localhost',\n * port: 6379,\n * }\n * ```\n *\n * @example Vercel KV (uses env vars by default)\n * ```typescript\n * {\n * provider: 'vercel-kv',\n * }\n * ```\n *\n * @example Vercel KV (explicit config)\n * ```typescript\n * {\n * provider: 'vercel-kv',\n * url: 'https://my-kv.vercel-storage.com',\n * token: 'my-token',\n * }\n * ```\n */\nexport const redisOptionsSchema = z.union([redisProviderSchema, vercelKvProviderSchema, legacyRedisSchema]);\n\n/**\n * Storage configuration type (with defaults applied)\n */\nexport type RedisOptions = z.infer<typeof redisOptionsSchema>;\n\n/**\n * Storage configuration input type (for user configuration)\n */\nexport type RedisOptionsInput = z.input<typeof redisOptionsSchema>;\n\n// ============================================\n// Pub/Sub Options Schema (Redis-only)\n// ============================================\n\n/**\n * Pub/Sub configuration (requires Redis, not compatible with Vercel KV)\n *\n * Use this when you need pub/sub features like resource subscriptions\n * but want to use Vercel KV for sessions/cache.\n *\n * @example Hybrid config\n * ```typescript\n * {\n * redis: { provider: 'vercel-kv' }, // sessions/cache\n * pubsub: { host: 'localhost' }, // pub/sub\n * }\n * ```\n */\nexport const pubsubOptionsSchema = z.union([redisProviderSchema, legacyRedisSchema]);\n\n/**\n * Pub/Sub configuration type (Redis-only)\n */\nexport type PubsubOptions = z.infer<typeof pubsubOptionsSchema>;\n\n/**\n * Pub/Sub configuration input type\n */\nexport type PubsubOptionsInput = z.input<typeof pubsubOptionsSchema>;\n\n// ============================================\n// Type Guards\n// ============================================\n\n/**\n * Check if options are for Redis provider\n */\nexport function isRedisProvider(options: RedisOptions): options is RedisProviderOptions {\n return options.provider === 'redis';\n}\n\n/**\n * Check if options are for Vercel KV provider\n */\nexport function isVercelKvProvider(options: RedisOptions): options is VercelKvProviderOptions {\n return options.provider === 'vercel-kv';\n}\n\n/**\n * Check if pub/sub options are valid Redis config\n */\nexport function isPubsubConfigured(options: PubsubOptions): options is RedisProviderOptions {\n return options.provider === 'redis';\n}\n"]}
|
|
@@ -16,5 +16,9 @@ export declare const serverInfoOptionsSchema: z.ZodObject<{
|
|
|
16
16
|
src: z.ZodString;
|
|
17
17
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
18
18
|
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
light: "light";
|
|
21
|
+
dark: "dark";
|
|
22
|
+
}>>;
|
|
19
23
|
}, z.core.$strip>>>;
|
|
20
24
|
}, z.core.$strip>;
|