UNPKG

@pulzar/core

Version:

Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support

106 lines 2.5 kB
import { SchemaRegistry, EventSchema, ValidationResult } from "../types"; interface RedisSchemaConfig { host?: string; port?: number; password?: string; db?: number; keyPrefix?: string; enableVersioning?: boolean; maxVersionsPerSubject?: number; } export declare class RedisSchemaRegistry implements SchemaRegistry { private redis; private config; private connected; private zodModule; constructor(config?: RedisSchemaConfig); /** * Initialize Redis connection */ connect(): Promise<void>; /** * Disconnect from Redis */ disconnect(): Promise<void>; /** * Register a new schema */ register(schema: EventSchema): Promise<void>; /** * Get schema by subject and version */ get(subject: string, version?: string): Promise<EventSchema | null>; /** * List all schemas */ list(): Promise<EventSchema[]>; /** * Validate data against schema */ validate<T>(subject: string, data: T): Promise<ValidationResult>; /** * Check schema compatibility */ isCompatible(subject: string, newSchema: EventSchema): Promise<boolean>; /** * Validate data with specific schema */ private validateWithSchema; /** * Validate with Zod schema */ private validateWithZod; /** * Validate with JSON Schema */ private validateWithJsonSchema; /** * Validate with Avro schema */ private validateWithAvro; /** * Validate with Protobuf schema */ private validateWithProtobuf; /** * Check compatibility between schemas */ private checkCompatibility; /** * Check backward compatibility */ private isBackwardCompatible; /** * Check forward compatibility */ private isForwardCompatible; /** * Validate schema format */ private validateSchemaFormat; /** * Serialize schema for Redis storage */ private serializeSchema; /** * Deserialize schema from Redis */ private deserializeSchema; /** * Generate Redis keys */ private getSchemaKey; private getSubjectKey; private getSubjectsKey; private getStatsKey; /** * Try to import Redis package */ private importRedis; /** * Try to import Zod package */ private importZod; } export default RedisSchemaRegistry; //# sourceMappingURL=redis-schema-registry.d.ts.map