UNPKG

@codai/memorai

Version:

Universal Database & Storage Service for CODAI Ecosystem - CBD Backend

476 lines 14.4 kB
import { z } from 'zod'; export interface MemoraiConfig { database: { url: string; type: 'postgresql' | 'mysql' | 'sqlite' | 'mongodb'; maxConnections: number; connectionTimeout: number; queryTimeout: number; ssl?: boolean; migrations?: { auto: boolean; directory: string; }; }; vectorDB: { url: string; type: 'pinecone' | 'weaviate' | 'qdrant' | 'chroma' | 'local'; apiKey?: string; dimensions: number; metric: 'cosine' | 'euclidean' | 'dotproduct'; indexName: string; }; storage: { provider: 'local' | 'aws-s3' | 'cloudflare-r2' | 'supabase' | 'vercel-blob'; bucket: string; region?: string; accessKey?: string; secretKey?: string; publicUrl?: string; maxFileSize: number; allowedTypes: string[]; enableCDN: boolean; }; cache: { provider: 'redis' | 'memory' | 'upstash'; url?: string; password?: string; ttl: number; maxSize: number; }; ai: { provider: 'openai' | 'anthropic' | 'local'; apiKey?: string; model: string; embeddingModel: string; maxTokens: number; }; realtime: { enabled: boolean; provider: 'socket.io' | 'supabase' | 'pusher'; url?: string; apiKey?: string; secret?: string; }; security: { encryption: { enabled: boolean; algorithm: string; key?: string; }; rateLimit: { enabled: boolean; windowMs: number; maxRequests: number; }; cors: { origins: string[]; credentials: boolean; }; }; performance: { queryOptimization: boolean; indexOptimization: boolean; compressionEnabled: boolean; batchSize: number; cacheStrategy: 'aggressive' | 'balanced' | 'conservative'; }; } export declare const MemoraiConfigSchema: z.ZodObject<{ database: z.ZodObject<{ url: z.ZodEffects<z.ZodString, string, string>; type: z.ZodEnum<["postgresql", "mysql", "sqlite", "mongodb"]>; maxConnections: z.ZodNumber; connectionTimeout: z.ZodNumber; queryTimeout: z.ZodNumber; ssl: z.ZodOptional<z.ZodBoolean>; migrations: z.ZodOptional<z.ZodObject<{ auto: z.ZodBoolean; directory: z.ZodString; }, "strip", z.ZodTypeAny, { auto?: boolean; directory?: string; }, { auto?: boolean; directory?: string; }>>; }, "strip", z.ZodTypeAny, { type?: "postgresql" | "mysql" | "sqlite" | "mongodb"; url?: string; maxConnections?: number; connectionTimeout?: number; queryTimeout?: number; ssl?: boolean; migrations?: { auto?: boolean; directory?: string; }; }, { type?: "postgresql" | "mysql" | "sqlite" | "mongodb"; url?: string; maxConnections?: number; connectionTimeout?: number; queryTimeout?: number; ssl?: boolean; migrations?: { auto?: boolean; directory?: string; }; }>; vectorDB: z.ZodObject<{ url: z.ZodEffects<z.ZodString, string, string>; type: z.ZodEnum<["pinecone", "weaviate", "qdrant", "chroma", "local"]>; apiKey: z.ZodOptional<z.ZodString>; dimensions: z.ZodNumber; metric: z.ZodEnum<["cosine", "euclidean", "dotproduct"]>; indexName: z.ZodString; }, "strip", z.ZodTypeAny, { type?: "pinecone" | "weaviate" | "qdrant" | "chroma" | "local"; url?: string; apiKey?: string; dimensions?: number; metric?: "cosine" | "euclidean" | "dotproduct"; indexName?: string; }, { type?: "pinecone" | "weaviate" | "qdrant" | "chroma" | "local"; url?: string; apiKey?: string; dimensions?: number; metric?: "cosine" | "euclidean" | "dotproduct"; indexName?: string; }>; storage: z.ZodObject<{ provider: z.ZodEnum<["local", "aws-s3", "cloudflare-r2", "supabase", "vercel-blob"]>; bucket: z.ZodString; region: z.ZodOptional<z.ZodString>; accessKey: z.ZodOptional<z.ZodString>; secretKey: z.ZodOptional<z.ZodString>; publicUrl: z.ZodOptional<z.ZodString>; maxFileSize: z.ZodNumber; allowedTypes: z.ZodArray<z.ZodString, "many">; enableCDN: z.ZodBoolean; }, "strip", z.ZodTypeAny, { provider?: "local" | "aws-s3" | "cloudflare-r2" | "supabase" | "vercel-blob"; bucket?: string; region?: string; accessKey?: string; secretKey?: string; publicUrl?: string; maxFileSize?: number; allowedTypes?: string[]; enableCDN?: boolean; }, { provider?: "local" | "aws-s3" | "cloudflare-r2" | "supabase" | "vercel-blob"; bucket?: string; region?: string; accessKey?: string; secretKey?: string; publicUrl?: string; maxFileSize?: number; allowedTypes?: string[]; enableCDN?: boolean; }>; cache: z.ZodObject<{ provider: z.ZodEnum<["redis", "memory", "upstash"]>; url: z.ZodOptional<z.ZodString>; password: z.ZodOptional<z.ZodString>; ttl: z.ZodNumber; maxSize: z.ZodNumber; }, "strip", z.ZodTypeAny, { url?: string; provider?: "redis" | "memory" | "upstash"; password?: string; ttl?: number; maxSize?: number; }, { url?: string; provider?: "redis" | "memory" | "upstash"; password?: string; ttl?: number; maxSize?: number; }>; ai: z.ZodObject<{ provider: z.ZodEnum<["openai", "anthropic", "local"]>; apiKey: z.ZodOptional<z.ZodString>; model: z.ZodString; embeddingModel: z.ZodString; maxTokens: z.ZodNumber; }, "strip", z.ZodTypeAny, { apiKey?: string; provider?: "local" | "openai" | "anthropic"; model?: string; embeddingModel?: string; maxTokens?: number; }, { apiKey?: string; provider?: "local" | "openai" | "anthropic"; model?: string; embeddingModel?: string; maxTokens?: number; }>; realtime: z.ZodObject<{ enabled: z.ZodBoolean; provider: z.ZodEnum<["socket.io", "supabase", "pusher"]>; url: z.ZodOptional<z.ZodString>; apiKey: z.ZodOptional<z.ZodString>; secret: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { url?: string; apiKey?: string; provider?: "supabase" | "socket.io" | "pusher"; enabled?: boolean; secret?: string; }, { url?: string; apiKey?: string; provider?: "supabase" | "socket.io" | "pusher"; enabled?: boolean; secret?: string; }>; security: z.ZodObject<{ encryption: z.ZodObject<{ enabled: z.ZodBoolean; algorithm: z.ZodString; key: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { enabled?: boolean; algorithm?: string; key?: string; }, { enabled?: boolean; algorithm?: string; key?: string; }>; rateLimit: z.ZodObject<{ enabled: z.ZodBoolean; windowMs: z.ZodNumber; maxRequests: z.ZodNumber; }, "strip", z.ZodTypeAny, { enabled?: boolean; windowMs?: number; maxRequests?: number; }, { enabled?: boolean; windowMs?: number; maxRequests?: number; }>; cors: z.ZodObject<{ origins: z.ZodArray<z.ZodString, "many">; credentials: z.ZodBoolean; }, "strip", z.ZodTypeAny, { origins?: string[]; credentials?: boolean; }, { origins?: string[]; credentials?: boolean; }>; }, "strip", z.ZodTypeAny, { encryption?: { enabled?: boolean; algorithm?: string; key?: string; }; rateLimit?: { enabled?: boolean; windowMs?: number; maxRequests?: number; }; cors?: { origins?: string[]; credentials?: boolean; }; }, { encryption?: { enabled?: boolean; algorithm?: string; key?: string; }; rateLimit?: { enabled?: boolean; windowMs?: number; maxRequests?: number; }; cors?: { origins?: string[]; credentials?: boolean; }; }>; performance: z.ZodObject<{ queryOptimization: z.ZodBoolean; indexOptimization: z.ZodBoolean; compressionEnabled: z.ZodBoolean; batchSize: z.ZodNumber; cacheStrategy: z.ZodEnum<["aggressive", "balanced", "conservative"]>; }, "strip", z.ZodTypeAny, { queryOptimization?: boolean; indexOptimization?: boolean; compressionEnabled?: boolean; batchSize?: number; cacheStrategy?: "aggressive" | "balanced" | "conservative"; }, { queryOptimization?: boolean; indexOptimization?: boolean; compressionEnabled?: boolean; batchSize?: number; cacheStrategy?: "aggressive" | "balanced" | "conservative"; }>; }, "strip", z.ZodTypeAny, { database?: { type?: "postgresql" | "mysql" | "sqlite" | "mongodb"; url?: string; maxConnections?: number; connectionTimeout?: number; queryTimeout?: number; ssl?: boolean; migrations?: { auto?: boolean; directory?: string; }; }; vectorDB?: { type?: "pinecone" | "weaviate" | "qdrant" | "chroma" | "local"; url?: string; apiKey?: string; dimensions?: number; metric?: "cosine" | "euclidean" | "dotproduct"; indexName?: string; }; storage?: { provider?: "local" | "aws-s3" | "cloudflare-r2" | "supabase" | "vercel-blob"; bucket?: string; region?: string; accessKey?: string; secretKey?: string; publicUrl?: string; maxFileSize?: number; allowedTypes?: string[]; enableCDN?: boolean; }; cache?: { url?: string; provider?: "redis" | "memory" | "upstash"; password?: string; ttl?: number; maxSize?: number; }; ai?: { apiKey?: string; provider?: "local" | "openai" | "anthropic"; model?: string; embeddingModel?: string; maxTokens?: number; }; realtime?: { url?: string; apiKey?: string; provider?: "supabase" | "socket.io" | "pusher"; enabled?: boolean; secret?: string; }; security?: { encryption?: { enabled?: boolean; algorithm?: string; key?: string; }; rateLimit?: { enabled?: boolean; windowMs?: number; maxRequests?: number; }; cors?: { origins?: string[]; credentials?: boolean; }; }; performance?: { queryOptimization?: boolean; indexOptimization?: boolean; compressionEnabled?: boolean; batchSize?: number; cacheStrategy?: "aggressive" | "balanced" | "conservative"; }; }, { database?: { type?: "postgresql" | "mysql" | "sqlite" | "mongodb"; url?: string; maxConnections?: number; connectionTimeout?: number; queryTimeout?: number; ssl?: boolean; migrations?: { auto?: boolean; directory?: string; }; }; vectorDB?: { type?: "pinecone" | "weaviate" | "qdrant" | "chroma" | "local"; url?: string; apiKey?: string; dimensions?: number; metric?: "cosine" | "euclidean" | "dotproduct"; indexName?: string; }; storage?: { provider?: "local" | "aws-s3" | "cloudflare-r2" | "supabase" | "vercel-blob"; bucket?: string; region?: string; accessKey?: string; secretKey?: string; publicUrl?: string; maxFileSize?: number; allowedTypes?: string[]; enableCDN?: boolean; }; cache?: { url?: string; provider?: "redis" | "memory" | "upstash"; password?: string; ttl?: number; maxSize?: number; }; ai?: { apiKey?: string; provider?: "local" | "openai" | "anthropic"; model?: string; embeddingModel?: string; maxTokens?: number; }; realtime?: { url?: string; apiKey?: string; provider?: "supabase" | "socket.io" | "pusher"; enabled?: boolean; secret?: string; }; security?: { encryption?: { enabled?: boolean; algorithm?: string; key?: string; }; rateLimit?: { enabled?: boolean; windowMs?: number; maxRequests?: number; }; cors?: { origins?: string[]; credentials?: boolean; }; }; performance?: { queryOptimization?: boolean; indexOptimization?: boolean; compressionEnabled?: boolean; batchSize?: number; cacheStrategy?: "aggressive" | "balanced" | "conservative"; }; }>; export declare const DEFAULT_CONFIG: MemoraiConfig; export declare const DEVELOPMENT_CONFIG: Partial<MemoraiConfig>; export declare const PRODUCTION_CONFIG: Partial<MemoraiConfig>; export declare function createMemoraiConfig(overrides?: Partial<MemoraiConfig>, environment?: 'development' | 'production' | 'test'): MemoraiConfig; export declare function validateConfig(config: Partial<MemoraiConfig>): boolean; export declare function getConfigErrors(config: Partial<MemoraiConfig>): string[]; //# sourceMappingURL=config.d.ts.map