UNPKG

superaugment

Version:

Enterprise-grade MCP server with world-class C++ analysis, robust error handling, and production-ready architecture for VS Code Augment

154 lines 3.56 kB
/** * SuperAugment Schema Converter * * Provides robust and maintainable conversion between Zod schemas and JSON Schema * for MCP protocol compatibility. Designed to be simple, reliable, and extensible. */ import { z } from 'zod'; /** * JSON Schema type definitions */ export interface JsonSchemaProperty { type: string; description?: string; enum?: any[]; items?: JsonSchemaProperty; properties?: Record<string, JsonSchemaProperty>; required?: string[]; default?: any; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; pattern?: string; format?: string; } export interface JsonSchema { type: 'object'; properties: Record<string, JsonSchemaProperty>; required?: string[]; additionalProperties?: boolean; } /** * Schema conversion statistics */ export interface ConversionStats { totalProperties: number; successfulConversions: number; failedConversions: number; unsupportedTypes: string[]; conversionTime: number; } /** * Schema conversion options */ export interface ConversionOptions { includeDescriptions: boolean; includeDefaults: boolean; strictMode: boolean; maxDepth: number; } /** * Robust Schema Converter for Zod to JSON Schema conversion */ export declare class SchemaConverter { private conversionCache; private stats; /** * Convert Zod schema to JSON Schema */ convertZodToJsonSchema(zodSchema: z.ZodType<any>, options?: Partial<ConversionOptions>): JsonSchema; /** * Convert Zod type to JSON Schema property */ convertZodTypeToProperty(zodType: z.ZodType<any>, options?: Partial<ConversionOptions>): JsonSchemaProperty; /** * Get conversion statistics */ getStats(): ConversionStats; /** * Clear conversion cache */ clearCache(): void; /** * Internal schema conversion implementation */ private convertZodSchemaInternal; /** * Convert ZodObject to JSON Schema */ private convertZodObject; /** * Convert individual Zod type to JSON Schema property */ private convertZodTypeInternal; /** * Core Zod type conversion logic */ private convertZodTypeCore; /** * Convert ZodString */ private convertZodString; /** * Convert ZodNumber */ private convertZodNumber; /** * Convert ZodBoolean */ private convertZodBoolean; /** * Convert ZodArray */ private convertZodArray; /** * Convert ZodObject to property */ private convertZodObjectToProperty; /** * Convert ZodEnum */ private convertZodEnum; /** * Convert ZodNativeEnum */ private convertZodNativeEnum; /** * Convert ZodLiteral */ private convertZodLiteral; /** * Convert ZodUnion (simplified - takes first option) */ private convertZodUnion; /** * Convert ZodOptional */ private convertZodOptional; /** * Convert ZodDefault */ private convertZodDefault; /** * Convert ZodNullable */ private convertZodNullable; /** * Convert ZodRecord */ private convertZodRecord; /** * Check if a Zod type represents a required property */ private isRequiredProperty; /** * Generate cache key for Zod type */ private getCacheKey; /** * Reset conversion statistics */ private resetStats; } //# sourceMappingURL=SchemaConverter.d.ts.map